]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Better tun the use of open_memstream to safe versions of glibc
authorSteve Underwood <steveu@haswell.coppice.org>
Mon, 19 Aug 2013 14:49:03 +0000 (22:49 +0800)
committerSteve Underwood <steveu@haswell.coppice.org>
Mon, 19 Aug 2013 14:49:03 +0000 (22:49 +0800)
libs/spandsp/src/t30.c
libs/spandsp/src/t42.c
libs/spandsp/src/t4_tx.c

index 1d3555a97da3b5c35a88abf12bc90185e70191c8..d629d7908760d74e7bbebe11dac9d06560e73666 100644 (file)
@@ -2589,7 +2589,7 @@ static int start_sending_document(t30_state_t *s)
             t30_set_status(s, T30_ERR_NORESSUPPORT);
             break;
         default:
-            span_log(&s->logging, SPAN_LOG_WARNING, "Cannot negotiate an image format\n");
+            span_log(&s->logging, SPAN_LOG_WARNING, "Cannot negotiate an image mode\n");
             t30_set_status(s, T30_ERR_BADTIFF);
             break;
         }
index 2fa943cb9c56541fed9172c93f3b84e47ea647d2..fc90ddba63e0b0b201d59b69ea025c2aa704b29d 100644 (file)
 #include "spandsp/private/t85.h"
 #include "spandsp/private/t42.h"
 
+/* The open_memstream() and fmemopen() in older versions of glibc seems quirky */
+#if defined(__GLIBC__)  &&  (__GLIBC__ < 2  ||  (__GLIBC__ == 2  &&  __GLIBC_MINOR__ < 12))
+#undef OPEN_MEMSTREAM
+#endif
+
 #define T42_USE_LUTS
 
 #include "t42_t43_local.h"
@@ -1209,7 +1214,7 @@ SPAN_DECLARE(void) t42_decode_rx_status(t42_decode_state_t *s, int status)
         {
             if (t42_itulab_jpeg_to_srgb(s))
                 span_log(&s->logging, SPAN_LOG_FLOW, "Failed to convert from ITULAB.\n");
-            s->end_of_data = 1;
+            s->end_of_data = true;
         }
         break;
     default:
@@ -1229,7 +1234,7 @@ SPAN_DECLARE(int) t42_decode_put(t42_decode_state_t *s, const uint8_t data[], si
         {
             if (t42_itulab_jpeg_to_srgb(s))
                 span_log(&s->logging, SPAN_LOG_FLOW, "Failed to convert from ITULAB.\n");
-            s->end_of_data = 1;
+            s->end_of_data = true;
         }
         return T4_DECODE_OK;
     }
@@ -1319,7 +1324,7 @@ set_lab_illuminant(&s->lab, 95.047f, 100.000f, 108.883f);
         set_lab_gamut(&s->lab, 0, 100, -85, 85, -75, 125, false);
     }
 
-    s->end_of_data = 0;
+    s->end_of_data = false;
     s->compressed_image_size = 0;
 
     s->error_message[0] = '\0';
index f349a136c58e55661f91b38db876d0ec293c5a2d..639ddc93dd280efd51a789bf93f167cf0280dc11 100644 (file)
@@ -1863,7 +1863,7 @@ SPAN_DECLARE(int) t4_tx_set_tx_image_format(t4_tx_state_t *s,
                 s->metadata.image_type = T4_IMAGE_TYPE_BILEVEL;
             }
             /* Squashing to a bi-level image is possible */
-            span_log(&s->logging, SPAN_LOG_FLOW, "The image will be flattened to %d\n", s->metadata.image_type);
+            span_log(&s->logging, SPAN_LOG_FLOW, "The image may be flattened to %d\n", s->metadata.image_type);
         }
     }
 
@@ -2022,8 +2022,18 @@ SPAN_DECLARE(int) t4_tx_set_tx_image_format(t4_tx_state_t *s,
 
     if (s->metadata.image_type != s->tiff.image_type  ||  s->metadata.image_width != s->tiff.image_width)
     {
-        if (image_translate_init(&s->translator, s->metadata.image_type, s->metadata.image_width, -1, s->tiff.image_type, s->tiff.image_width, s->tiff.image_length, translate_row_read2, s) == NULL)
+        if (image_translate_init(&s->translator,
+                                 s->metadata.image_type,
+                                 s->metadata.image_width,
+                                 -1,
+                                 s->tiff.image_type,
+                                 s->tiff.image_width,
+                                 s->tiff.image_length,
+                                 translate_row_read2,
+                                 s) == NULL)
+        {
             return T4_IMAGE_FORMAT_INCOMPATIBLE;
+        }
         s->metadata.image_length = image_translate_get_output_length(&s->translator);
     }