Patch by Albin Tonnerre <albin.tonnerre@gmail.com>.
SVN revision: 82743
+2013-01-14 Albin Tonerre
+
+ * Fix endianess issue in Eet_Image.
+
2013-01-13 Boris Faure (billiob)
* Fixed condition based on uninitialized value in ecore_x_selection
* Fix evas bmp loader code which deal with image size.
* Fix not up to date clip cache for Evas_Object_Text.
* Evas texblock: Fixed a bug with breaking after format items.
+ * Fix endianess issue in Eet_Image.
return NULL;
/* Get the header */
- magic = ntohl(header[0]);
- sign_len = ntohl(header[1]);
- cert_len = ntohl(header[2]);
+ memcpy(&magic, header, sizeof(int));
+ memcpy(&sign_len, header+1, sizeof(int));
+ memcpy(&cert_len, header+2, sizeof(int));
+
+ magic = ntohl(magic);
+ sign_len = ntohl(sign_len);
+ cert_len = ntohl(cert_len);
/* Verify the header */
if (magic != EET_MAGIC_SIGN)
{
unsigned char *d, *comp;
- int *header, ret, ok = 1;
+ int *header, *bigend_data, ret, ok = 1;
uLongf buflen = 0;
buflen = (((w * h * 101) / 100) + 3) * 4;
ret = LZ4_compressBound((w * h * 4));
if ((ret > 0) && ((uLongf)ret > buflen)) buflen = ret;
-
+
+ if (_eet_image_words_bigendian)
+ {
+ int i;
+
+ bigend_data = (int *) malloc(w * h * 4);
+ if (!bigend_data) return NULL;
+
+ memcpy(bigend_data, data, w * h * 4);
+ for (i = 0; i < w * h; i++) SWAP32(bigend_data[i]);
+
+ data = (const char *) bigend_data;
+ }
+
comp = malloc(buflen);
if (!comp) return NULL;
unsigned int i;
for (i = 0; i < 8; i++) SWAP32(header[i]);
+ free(bigend_data);
}
memcpy(d + (8 * sizeof(int)), comp, buflen);