diff options
author | Robey Pointer <robey@src.gnome.org> | 2000-09-06 23:21:08 +0000 |
---|---|---|
committer | Robey Pointer <robey@src.gnome.org> | 2000-09-06 23:21:08 +0000 |
commit | 1af435cd614f3102c88e1e495b561bbd63e2e02b (patch) | |
tree | 6694e08af8000d242f62dd598e3062eaa82e8e9b /components | |
parent | 4ed4b066cd819ba413c6beebf19d7fc135c96920 (diff) | |
download | nautilus-1af435cd614f3102c88e1e495b561bbd63e2e02b.tar.gz |
fix evil gint/gchar types in MD5 to use native types according to the style guide
Diffstat (limited to 'components')
-rw-r--r-- | components/services/install/lib/eazel-install-md5.c | 28 | ||||
-rw-r--r-- | components/services/install/lib/eazel-install-md5.h | 8 |
2 files changed, 18 insertions, 18 deletions
diff --git a/components/services/install/lib/eazel-install-md5.c b/components/services/install/lib/eazel-install-md5.c index 72ffec020..79417c179 100644 --- a/components/services/install/lib/eazel-install-md5.c +++ b/components/services/install/lib/eazel-install-md5.c @@ -31,8 +31,8 @@ static void md5_transform (guint32 buf[4], const guint32 in[16]); -static gint _ie = 0x44332211; -static union _endian { gint i; gchar b[4]; } *_endian = (union _endian *)&_ie; +static int _ie = 0x44332211; +static union _endian { int i; char b[4]; } *_endian = (union _endian *)&_ie; #define IS_BIG_ENDIAN() (_endian->b[0] == '\x44') #define IS_LITTLE_ENDIAN() (_endian->b[0] == '\x11') @@ -41,7 +41,7 @@ static union _endian { gint i; gchar b[4]; } *_endian = (union _endian *)&_ie; * Note: this code is harmless on little-endian machines. */ static void -_byte_reverse (guchar *buf, guint32 longs) +_byte_reverse (unsigned char *buf, guint32 longs) { guint32 t; do { @@ -88,7 +88,7 @@ md5_init (MD5Context *ctx) * of bytes. Use this to progressively construct an md5 hash. **/ static void -md5_update (MD5Context *ctx, const guchar *buf, guint32 len) +md5_update (MD5Context *ctx, const unsigned char *buf, guint32 len) { guint32 t; @@ -104,7 +104,7 @@ md5_update (MD5Context *ctx, const guchar *buf, guint32 len) /* Handle any leading odd-sized chunks */ if (t) { - guchar *p = (guchar *) ctx->in + t; + unsigned char *p = (unsigned char *) ctx->in + t; t = 64 - t; if (len < t) { @@ -150,10 +150,10 @@ md5_update (MD5Context *ctx, const guchar *buf, guint32 len) * copy the final md5 hash to a bufer **/ static void -md5_final (MD5Context *ctx, guchar digest[16]) +md5_final (MD5Context *ctx, unsigned char digest[16]) { guint32 count; - guchar *p; + unsigned char *p; /* Compute number of bytes mod 64 */ count = (ctx->bits[0] >> 3) & 0x3F; @@ -189,7 +189,7 @@ md5_final (MD5Context *ctx, guchar digest[16]) md5_transform (ctx->buf, (guint32 *) ctx->in); if (ctx->doByteReverse) - _byte_reverse ((guchar *) ctx->buf, 4); + _byte_reverse ((unsigned char *) ctx->buf, 4); memcpy (digest, ctx->buf, 16); } @@ -310,7 +310,7 @@ md5_transform (guint32 buf[4], const guint32 in[16]) * the 16 bytes buffer @digest . **/ void -md5_get_digest (const gchar *buffer, gint buffer_size, guchar digest[16]) +md5_get_digest (const char *buffer, int buffer_size, unsigned char digest[16]) { MD5Context ctx; @@ -330,11 +330,11 @@ md5_get_digest (const gchar *buffer, gint buffer_size, guchar digest[16]) * the 16 bytes buffer @digest . **/ void -md5_get_digest_from_file (const gchar *filename, guchar digest[16]) +md5_get_digest_from_file (const char *filename, unsigned char digest[16]) { MD5Context ctx; - guchar tmp_buf[1024]; - gint nb_bytes_read; + unsigned char tmp_buf[1024]; + int nb_bytes_read; FILE *fp; md5_init (&ctx); @@ -343,7 +343,7 @@ md5_get_digest_from_file (const gchar *filename, guchar digest[16]) return; } - while ((nb_bytes_read = fread (tmp_buf, sizeof (guchar), 1024, fp)) > 0) + while ((nb_bytes_read = fread (tmp_buf, sizeof (unsigned char), 1024, fp)) > 0) md5_update (&ctx, tmp_buf, nb_bytes_read); if (ferror(fp)) { @@ -360,7 +360,7 @@ md5_get_digest_from_file (const gchar *filename, guchar digest[16]) int main (int argc, char **argv) { - guchar digest[16]; + unsigned char digest[16]; int i; md5_get_digest_from_file (argv[1], digest); diff --git a/components/services/install/lib/eazel-install-md5.h b/components/services/install/lib/eazel-install-md5.h index d027e6b82..74e432375 100644 --- a/components/services/install/lib/eazel-install-md5.h +++ b/components/services/install/lib/eazel-install-md5.h @@ -31,12 +31,12 @@ typedef struct { guint32 buf[4]; guint32 bits[2]; - guchar in[64]; - gint doByteReverse; + unsigned char in[64]; + int doByteReverse; } MD5Context ; -void md5_get_digest (const gchar *buffer, gint buffer_size, guchar digest[16]); -void md5_get_digest_from_file (const gchar *filename, guchar digest[16]); +void md5_get_digest (const char *buffer, int buffer_size, unsigned char digest[16]); +void md5_get_digest_from_file (const char *filename, unsigned char digest[16]); #endif /* MD5_UTILS_H */ |