Mercurial > geeqie
comparison src/exif.c @ 855:0c3f6ef17d18
Tidy up.
author | zas_ |
---|---|
date | Wed, 25 Jun 2008 20:53:52 +0000 |
parents | f606e8962329 |
children | 6ca2c5fd7b13 |
comparison
equal
deleted
inserted
replaced
854:a0cdc9d066ae | 855:0c3f6ef17d18 |
---|---|
1102 static gint map_file(const gchar *path, void **mapping, int *size) | 1102 static gint map_file(const gchar *path, void **mapping, int *size) |
1103 { | 1103 { |
1104 int fd; | 1104 int fd; |
1105 struct stat fs; | 1105 struct stat fs; |
1106 | 1106 |
1107 if ((fd = open(path, O_RDONLY)) == -1) | 1107 fd = open(path, O_RDONLY); |
1108 if (fd == -1) | |
1108 { | 1109 { |
1109 perror(path); | 1110 perror(path); |
1110 return -1; | 1111 return -1; |
1111 } | 1112 } |
1112 | 1113 |
1117 return -1; | 1118 return -1; |
1118 } | 1119 } |
1119 | 1120 |
1120 *size = fs.st_size; | 1121 *size = fs.st_size; |
1121 | 1122 |
1122 if ((*mapping = mmap(0, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0)) == MAP_FAILED) | 1123 *mapping = mmap(0, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); |
1124 if (*mapping == MAP_FAILED) | |
1123 { | 1125 { |
1124 perror(path); | 1126 perror(path); |
1125 close(fd); | 1127 close(fd); |
1126 return -1; | 1128 return -1; |
1127 } | 1129 } |
1178 | 1180 |
1179 exif = g_new0(ExifData, 1); | 1181 exif = g_new0(ExifData, 1); |
1180 exif->items = NULL; | 1182 exif->items = NULL; |
1181 exif->current = NULL; | 1183 exif->current = NULL; |
1182 | 1184 |
1183 if ((res = exif_jpeg_parse(exif, (unsigned char *)f, size, | 1185 res = exif_jpeg_parse(exif, (unsigned char *)f, size, ExifKnownMarkersList); |
1184 ExifKnownMarkersList)) == -2) | 1186 if (res == -2) |
1185 { | 1187 { |
1186 res = exif_tiff_parse(exif, (unsigned char *)f, size, ExifKnownMarkersList); | 1188 res = exif_tiff_parse(exif, (unsigned char *)f, size, ExifKnownMarkersList); |
1187 } | 1189 } |
1188 | 1190 |
1189 if (res != 0) | 1191 if (res != 0) |