From 003f264406446b476049787905645042fad76f7b Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Sun, 8 Aug 2004 10:48:39 +0000 Subject: [PATCH] Fix uint32_t portability problem. Reported by Steve Kennedy. --- Makefile.am | 2 +- crypthash.h | 27 +++++++++++++++++++++++++++ md5.h | 22 +--------------------- sha1.h | 20 +------------------- 4 files changed, 30 insertions(+), 41 deletions(-) create mode 100644 crypthash.h diff --git a/Makefile.am b/Makefile.am index 4deadb0e..0e0f8dbf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -67,7 +67,7 @@ EXTRA_mutt_SOURCES = account.c md5c.c mutt_sasl.c mutt_socket.c mutt_ssl.c \ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO \ configure acconfig.h account.h \ - attach.h buffy.h charset.h copy.h dotlock.h functions.h gen_defs \ + attach.h buffy.h charset.h copy.h crypthash.h dotlock.h functions.h gen_defs \ globals.h hash.h history.h init.h keymap.h mutt_crypt.h \ mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \ mutt_regex.h mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h \ diff --git a/crypthash.h b/crypthash.h new file mode 100644 index 00000000..a2545b8e --- /dev/null +++ b/crypthash.h @@ -0,0 +1,27 @@ +#ifndef _CRYPTHASH_H +# define _CRYPTHASH_H + +# include "config.h" + + +# include +# if HAVE_INTTYPES_H +# include +# else +# if HAVE_STDINT_H +# include +# endif +# endif + +/* POINTER defines a generic pointer type */ +typedef unsigned char *POINTER; + +# ifndef HAVE_UINT32_T +# if SIZEOF_INT == 4 +typedef unsigned int uint32_t; +# elif SIZEOF_LONG == 4 +typedef unsigned long uint32_t; +# endif +# endif + +#endif diff --git a/md5.h b/md5.h index f8254323..521f3f53 100644 --- a/md5.h +++ b/md5.h @@ -26,27 +26,7 @@ documentation and/or software. #ifndef MD5_H #define MD5_H 1 -#include "config.h" - -#include -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# endif -#endif - -/* POINTER defines a generic pointer type */ -typedef unsigned char *POINTER; - -#ifndef HAVE_UINT32_T -# if SIZEOF_INT == 4 -typedef unsigned int uint32_t; -# elif SIZEOF_LONG == 4 -typedef unsigned long int uint32_t; -# endif -#endif +#include "crypthash.h" /* MD5 context. */ typedef struct { diff --git a/sha1.h b/sha1.h index 83819558..304beb93 100644 --- a/sha1.h +++ b/sha1.h @@ -9,24 +9,7 @@ #ifndef _SHA1_H # define _SHA1_H -#include "config.h" - -#include -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# endif -#endif - -#ifndef HAVE_UINT32_T -# if SIZEOF_INT == 4 -typedef unsigned int uint32_t; -# elif SIZEOF_LONG == 4 -typedef unsigned long uint32_t; -# endif -#endif +#include "crypthash.h" typedef struct { uint32_t state[5]; @@ -47,4 +30,3 @@ void SHA1Final(unsigned char digest[20], SHA1_CTX* context); # define SHA_DIGEST_LENGTH 20 #endif - -- 2.40.0