psd_loader: Fix bad assumption about signedness of chars
authorDerek Foreman <derekf@osg.samsung.com>
Fri, 3 Jun 2016 21:25:50 +0000 (16:25 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Fri, 3 Jun 2016 21:28:24 +0000 (16:28 -0500)
Whether "char" is signed or unsigned is architecture dependent, so if we
know we need a -1 in a char type we must declared it to be signed.

src/modules/evas/image_loaders/psd/evas_image_load_psd.c

index 6c8879a..f39fd28 100644 (file)
@@ -200,7 +200,8 @@ read_compressed_channel(const unsigned char *map, size_t length, size_t *positio
 {
    // FIXME: what does channel_length means, and why is it not used
    unsigned int i;
-   char headbyte, c;
+   signed char headbyte;
+   unsigned char c;
 
 #define CHECK_RET(Call)                                         \
    if (!Call) return READ_COMPRESSED_ERROR_FILE_READ_ERROR;    \
@@ -502,7 +503,7 @@ get_single_channel(PSD_Header *head,
                   Eina_Bool compressed)
 {
    unsigned int i, bpc;
-   char headbyte;
+   signed char headbyte;
    int c;
    int pixels_count;