summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2013-07-28 09:53:48 +1000
committerDamien Miller <djm@mindrot.org>2013-07-28 09:53:48 +1000
commitbae2b6181523d39d9313f9b996199e618684ed63 (patch)
treec59d3e74c8ef7699d9868c68a14d7702edd80cec
parente72cf0d46a6afb7b3a38d629ee5968c5e5cf2f3d (diff)
downloadpy-bcrypt-bae2b6181523d39d9313f9b996199e618684ed63.tar.gz
issue#9: use C99 fixed integer types if available
-rw-r--r--bcrypt/bcrypt_python.c3
-rw-r--r--bcrypt/pybc_blf.h13
2 files changed, 9 insertions, 7 deletions
diff --git a/bcrypt/bcrypt_python.c b/bcrypt/bcrypt_python.c
index a41352e..5450b48 100644
--- a/bcrypt/bcrypt_python.c
+++ b/bcrypt/bcrypt_python.c
@@ -24,9 +24,6 @@ typedef int Py_ssize_t;
#define PYBCRYPT_VERSION "0.4"
#if defined(_WIN32)
-typedef unsigned __int8 u_int8_t;
-typedef unsigned __int16 u_int16_t;
-typedef unsigned __int32 u_int32_t;
#define bzero(s,n) memset(s, '\0', n)
#endif
diff --git a/bcrypt/pybc_blf.h b/bcrypt/pybc_blf.h
index 55ac12c..5f9ecd7 100644
--- a/bcrypt/pybc_blf.h
+++ b/bcrypt/pybc_blf.h
@@ -34,10 +34,15 @@
#ifndef _PYBC_BLF_H_
#define _PYBC_BLF_H_
-#if defined(_WIN32)
-typedef unsigned __int8 u_int8_t;
-typedef unsigned __int16 u_int16_t;
-typedef unsigned __int32 u_int32_t;
+#if __STDC_VERSION__ >= 199901L /* C99 or later */
+#include <stdint.h>
+typedef uint8_t u_int8_t;
+typedef uint16_t u_int16_t;
+typedef uint32_t u_int32_t;
+#elif defined(_WIN32)
+typedef unsigned __int8 u_int8_t;
+typedef unsigned __int16 u_int16_t;
+typedef unsigned __int32 u_int32_t;
#endif
/* Schneier specifies a maximum key length of 56 bytes.