summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2013-01-14 03:54:47 +0000
committerCedric BAIL <cedric.bail@free.fr>2013-01-14 03:54:47 +0000
commit55bc6a16fb85a597a785bd08df3af3085cf0eb54 (patch)
tree7471fc8904e100739f9e84e0a4bdddfd0c697596
parentc7aead6fdc8d29932b090857a6e47581b3c5f20c (diff)
efl: fix endianness issue.
Patch by Albin Tonnerre <albin.tonnerre@gmail.com>. SVN revision: 82743
-rw-r--r--ChangeLog4
-rw-r--r--NEWS1
-rw-r--r--src/lib/eet/eet_cipher.c10
-rw-r--r--src/lib/eet/eet_image.c18
4 files changed, 28 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 3444004eaa..ef531fbc26 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
12013-01-14 Albin Tonerre
2
3 * Fix endianess issue in Eet_Image.
4
12013-01-13 Boris Faure (billiob) 52013-01-13 Boris Faure (billiob)
2 6
3 * Fixed condition based on uninitialized value in ecore_x_selection 7 * Fixed condition based on uninitialized value in ecore_x_selection
diff --git a/NEWS b/NEWS
index abc29ea1e7..6541f05457 100644
--- a/NEWS
+++ b/NEWS
@@ -109,3 +109,4 @@ Fixes:
109 * Fix evas bmp loader code which deal with image size. 109 * Fix evas bmp loader code which deal with image size.
110 * Fix not up to date clip cache for Evas_Object_Text. 110 * Fix not up to date clip cache for Evas_Object_Text.
111 * Evas texblock: Fixed a bug with breaking after format items. 111 * Evas texblock: Fixed a bug with breaking after format items.
112 * Fix endianess issue in Eet_Image.
diff --git a/src/lib/eet/eet_cipher.c b/src/lib/eet/eet_cipher.c
index d9f35c8a53..270e957ac7 100644
--- a/src/lib/eet/eet_cipher.c
+++ b/src/lib/eet/eet_cipher.c
@@ -655,9 +655,13 @@ eet_identity_check(const void *data_base,
655 return NULL; 655 return NULL;
656 656
657 /* Get the header */ 657 /* Get the header */
658 magic = ntohl(header[0]); 658 memcpy(&magic, header, sizeof(int));
659 sign_len = ntohl(header[1]); 659 memcpy(&sign_len, header+1, sizeof(int));
660 cert_len = ntohl(header[2]); 660 memcpy(&cert_len, header+2, sizeof(int));
661
662 magic = ntohl(magic);
663 sign_len = ntohl(sign_len);
664 cert_len = ntohl(cert_len);
661 665
662 /* Verify the header */ 666 /* Verify the header */
663 if (magic != EET_MAGIC_SIGN) 667 if (magic != EET_MAGIC_SIGN)
diff --git a/src/lib/eet/eet_image.c b/src/lib/eet/eet_image.c
index 1a73d1b16d..6eb59da545 100644
--- a/src/lib/eet/eet_image.c
+++ b/src/lib/eet/eet_image.c
@@ -727,13 +727,26 @@ eet_data_image_lossless_compressed_convert(int *size,
727 727
728 { 728 {
729 unsigned char *d, *comp; 729 unsigned char *d, *comp;
730 int *header, ret, ok = 1; 730 int *header, *bigend_data, ret, ok = 1;
731 uLongf buflen = 0; 731 uLongf buflen = 0;
732 732
733 buflen = (((w * h * 101) / 100) + 3) * 4; 733 buflen = (((w * h * 101) / 100) + 3) * 4;
734 ret = LZ4_compressBound((w * h * 4)); 734 ret = LZ4_compressBound((w * h * 4));
735 if ((ret > 0) && ((uLongf)ret > buflen)) buflen = ret; 735 if ((ret > 0) && ((uLongf)ret > buflen)) buflen = ret;
736 736
737 if (_eet_image_words_bigendian)
738 {
739 int i;
740
741 bigend_data = (int *) malloc(w * h * 4);
742 if (!bigend_data) return NULL;
743
744 memcpy(bigend_data, data, w * h * 4);
745 for (i = 0; i < w * h; i++) SWAP32(bigend_data[i]);
746
747 data = (const char *) bigend_data;
748 }
749
737 comp = malloc(buflen); 750 comp = malloc(buflen);
738 if (!comp) return NULL; 751 if (!comp) return NULL;
739 752
@@ -784,6 +797,7 @@ eet_data_image_lossless_compressed_convert(int *size,
784 unsigned int i; 797 unsigned int i;
785 798
786 for (i = 0; i < 8; i++) SWAP32(header[i]); 799 for (i = 0; i < 8; i++) SWAP32(header[i]);
800 free(bigend_data);
787 } 801 }
788 802
789 memcpy(d + (8 * sizeof(int)), comp, buflen); 803 memcpy(d + (8 * sizeof(int)), comp, buflen);