summaryrefslogtreecommitdiff
path: root/glib/gchecksum.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2008-04-17 11:29:26 +0000
committerEmmanuele Bassi <ebassi@src.gnome.org>2008-04-17 11:29:26 +0000
commit62b18e67b7ef12b0475e12b631a7f384030567de (patch)
tree6f4d069339751de7fc401a9ff9468a8667d01c0d /glib/gchecksum.c
parent9fd295d28545f096ad1e453d7ad121013d018613 (diff)
downloadglib-62b18e67b7ef12b0475e12b631a7f384030567de.tar.gz
Use the macro GLib provides for byte-swapping as it can be optimized.
2008-04-17 Emmanuele Bassi <ebassi@gnome.org> * glib/gchecksum.c: (sha_byte_reverse): Use the macro GLib provides for byte-swapping as it can be optimized. (g_checksum_update): Fix a compiler warning. svn path=/trunk/; revision=6861
Diffstat (limited to 'glib/gchecksum.c')
-rw-r--r--glib/gchecksum.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/glib/gchecksum.c b/glib/gchecksum.c
index ded85ca5a..0b0ce54fc 100644
--- a/glib/gchecksum.c
+++ b/glib/gchecksum.c
@@ -122,10 +122,7 @@ sha_byte_reverse (guint32 *buffer,
length /= sizeof (guint32);
while (length--)
{
- *buffer = ((guint32) (((*buffer & (guint32) 0x000000ffU) << 24) |
- ((*buffer & (guint32) 0x0000ff00U) << 8) |
- ((*buffer & (guint32) 0x00ff0000U) >> 8) |
- ((*buffer & (guint32) 0xff000000U) >> 24)));
+ *buffer = GUINT32_SWAP_LE_BE (*buffer);
++buffer;
}
}
@@ -1204,7 +1201,7 @@ g_checksum_update (GChecksum *checksum,
g_return_if_fail (data != NULL);
if (length < 0)
- length = strlen (data);
+ length = strlen ((const gchar *) data);
if (checksum->digest_str)
{