unsigned char exif_app1_xmp[2] = {0, };
gsize exif_app1_xmp_size = 0;
unsigned char exif_app1_xmp_t[2] = {0, };
- char *xmp_data = NULL;
+ GString *xmp_data = NULL;
int fdata = 0;
- int temp = 0;
int result = 0;
memset(exif_header, 0x00, sizeof(exif_header));
goto ERROR;
if ((exif_app1_xmp[0] == 0xff) && (exif_app1_xmp[1] == 0xe1)) {
- char *ptr = NULL;
size = fread(exif_app1_xmp_t, 1, sizeof(exif_app1_xmp_t), fp);
if (size <= 0)
goto ERROR;
if (exif_app1_xmp_size == 0)
goto ERROR;
- xmp_data = g_malloc(exif_app1_xmp_size);
- ptr = xmp_data;
+ xmp_data = g_string_sized_new(exif_app1_xmp_size);
do {
exif_app1_xmp_size--;
continue;
if (fdata == '\0')
continue;
- *ptr = (char)fdata;
- ptr++;
- temp++;
- } while (exif_app1_xmp_size > 0);
- ptr -= temp;
+ xmp_data = g_string_append_c(xmp_data, (gchar)fdata);
+ } while (exif_app1_xmp_size > 0);
- if (strstr(ptr, "UsePanoramaViewer")
- && strstr(ptr, "True")
- && strstr(ptr, "ProjectionType")
- && strstr(ptr, "equirectangular"))
+ if (strstr(xmp_data->str, "UsePanoramaViewer") &&
+ strstr(xmp_data->str, "True") &&
+ strstr(xmp_data->str, "ProjectionType") &&
+ strstr(xmp_data->str, "equirectangular"))
result = 1;
- g_free(xmp_data);
+ g_string_free(xmp_data, TRUE);
}
}