Avoid unaligned access. (#172947)

2005-04-07  Matthias Clasen  <mclasen@redhat.com>

	* gtk/updateiconcache.c (write_card32, write_card16): Avoid
	unaligned access.  (#172947)
This commit is contained in:
Matthias Clasen
2005-04-07 19:13:09 +00:00
committed by Matthias Clasen
parent 116699db55
commit c0e5adcf3b
4 changed files with 13 additions and 6 deletions

View File

@@ -1,5 +1,8 @@
2005-04-07 Matthias Clasen <mclasen@redhat.com>
* gtk/updateiconcache.c (write_card32, write_card16): Avoid
unaligned access. (#172947)
Some fixes from Morten Welinder (#172947):
* gtk/updateiconcache.c (icon_name_hash): Make this compiler-

View File

@@ -1,5 +1,8 @@
2005-04-07 Matthias Clasen <mclasen@redhat.com>
* gtk/updateiconcache.c (write_card32, write_card16): Avoid
unaligned access. (#172947)
Some fixes from Morten Welinder (#172947):
* gtk/updateiconcache.c (icon_name_hash): Make this compiler-

View File

@@ -1,5 +1,8 @@
2005-04-07 Matthias Clasen <mclasen@redhat.com>
* gtk/updateiconcache.c (write_card32, write_card16): Avoid
unaligned access. (#172947)
Some fixes from Morten Welinder (#172947):
* gtk/updateiconcache.c (icon_name_hash): Make this compiler-

View File

@@ -291,11 +291,10 @@ gboolean
write_card16 (FILE *cache, guint16 n)
{
int i;
gchar s[2];
*((guint16 *)s) = GUINT16_TO_BE (n);
n = GUINT16_TO_BE (n);
i = fwrite (s, 2, 1, cache);
i = fwrite ((char *)&n, 2, 1, cache);
return i == 1;
}
@@ -304,11 +303,10 @@ gboolean
write_card32 (FILE *cache, guint32 n)
{
int i;
gchar s[4];
*((guint32 *)s) = GUINT32_TO_BE (n);
n = GUINT32_TO_BE (n);
i = fwrite (s, 4, 1, cache);
i = fwrite ((char *)&n, 4, 1, cache);
return i == 1;
}