Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/efreet

Dir     : e17/libs/efreet/src/lib


Modified Files:
        efreet_mime.c 


Log Message:


1. stop doing unaligned memory accesses - htons() on a pointer to some
arbitrary point...
2. use int not long - long will be 64bit on 64bit platforms, but 32bit almost
everywhere (yes in theory it may not - but in practice, it won't - long
though will vary).

===================================================================
RCS file: /cvs/e/e17/libs/efreet/src/lib/efreet_mime.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- efreet_mime.c       4 Nov 2007 09:32:35 -0000       1.34
+++ efreet_mime.c       6 Apr 2008 23:02:54 -0000       1.35
@@ -921,6 +921,8 @@
         }
         else
         {
+           short tshort;
+          
             if (!mime) continue;
             if (!entry)
             {
@@ -952,7 +954,9 @@
 
                 case '=':
                     ptr++;
-                    entry->value_len = ntohs(*((short*)(ptr)));
+              
+                   memcpy(&tshort, ptr, sizeof(short));
+                    entry->value_len = ntohs(tshort);
                     ptr += 2;
 
                     entry->value = NEW(1, entry->value_len);
@@ -1002,12 +1006,12 @@
                             }
                             else if (entry->word_size == 4)
                             {
-                                ((long*)entry->value)[j] =
-                                              ntohl(((long*)entry->value)[j]);
+                                ((int*)entry->value)[j] =
+                                              ntohl(((int*)entry->value)[j]);
 
                                 if (entry->mask)
-                                    ((long*)entry->mask)[j] =
-                                              ntohl(((long*)entry->mask)[j]);
+                                    ((int*)entry->mask)[j] =
+                                              ntohl(((int*)entry->mask)[j]);
                             }
                         }
                     }



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to