From 667c5075fea20fe3c30237b834346513d3f6effd Mon Sep 17 00:00:00 2001 From: Jason Hearne-McGuiness Date: Wed, 4 Sep 2013 20:32:47 +0100 Subject: [PATCH] Ensure that we only add uncompressed text at the moment, as we don't handle compressed text yet. --- plugins/thunar-apr/thunar-apr-png-read-data.c | 54 +++++++++++++++------------ 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/plugins/thunar-apr/thunar-apr-png-read-data.c b/plugins/thunar-apr/thunar-apr-png-read-data.c index 5e3570b..ed2b8cf 100644 --- a/plugins/thunar-apr/thunar-apr-png-read-data.c +++ b/plugins/thunar-apr/thunar-apr-png-read-data.c @@ -420,20 +420,20 @@ read_png_data_from_file(FILE *fp) } { int unit=PNG_SCALE_UNKNOWN; - double width=0.0, height=0.0; - if (png_get_valid(read_ptr, read_info_ptr, PNG_INFO_sCAL) && png_get_sCAL(read_ptr, read_info_ptr, &unit, &width, &height)) + double width_sCAL=0.0, height_sCAL=0.0; + if (png_get_valid(read_ptr, read_info_ptr, PNG_INFO_sCAL) && png_get_sCAL(read_ptr, read_info_ptr, &unit, &width_sCAL, &height_sCAL)) { int error; switch (unit) { case PNG_SCALE_METER: - error=asprintf(&png_data_read[png_chunk_names_sCAL].data, png_chunk_details[png_chunk_names_sCAL].fmt_str, width, height, "meters"); + error=asprintf(&png_data_read[png_chunk_names_sCAL].data, png_chunk_details[png_chunk_names_sCAL].fmt_str, width_sCAL, height_sCAL, "meters"); break; case PNG_SCALE_RADIAN: - error=asprintf(&png_data_read[png_chunk_names_sCAL].data, png_chunk_details[png_chunk_names_sCAL].fmt_str, width, height, "radians"); + error=asprintf(&png_data_read[png_chunk_names_sCAL].data, png_chunk_details[png_chunk_names_sCAL].fmt_str, width_sCAL, height_sCAL, "radians"); break; default: - error=asprintf(&png_data_read[png_chunk_names_sCAL].data, png_chunk_details[png_chunk_names_sCAL].fmt_str, width, height, "unknown"); + error=asprintf(&png_data_read[png_chunk_names_sCAL].data, png_chunk_details[png_chunk_names_sCAL].fmt_str, width_sCAL, height_sCAL, "unknown"); } if (error<0) { @@ -474,28 +474,34 @@ read_png_data_from_file(FILE *fp) int num_text=0; if (png_get_text(read_ptr, read_info_ptr, &text_ptr, &num_text)) { - size_t total_size=(max_key_size+sizeof(key_separator)+sizeof(text_separator))*num_text; - int i; - for(i=0; icompression==PNG_TEXT_COMPRESSION_NONE_WR + || text_ptr->compression==PNG_TEXT_COMPRESSION_NONE + || text_ptr->compression==PNG_ITXT_COMPRESSION_NONE) { - total_size+=text_ptr[i].text_length; - } - png_data_read[png_chunk_names_tEXt].data=malloc(total_size); - if (png_data_read[png_chunk_names_tEXt].data!=NULL) - { - char *pos=png_data_read[png_chunk_names_tEXt].data; - // Make sure strcat() works correctly. - memset(pos, 0, total_size); + size_t total_size=(max_key_size+sizeof(key_separator)+sizeof(text_separator))*num_text; + int i; for(i=0; i