summaryrefslogtreecommitdiff
path: root/contrib/pgcrypto/crypt-gensalt.c
diff options
context:
space:
mode:
authorTom Lane2001-10-15 19:15:18 +0000
committerTom Lane2001-10-15 19:15:18 +0000
commit77f27d5ec36584addbbad0239d31753240e44001 (patch)
treebb10398a8c365adb7ecb79df35b06b87560381b2 /contrib/pgcrypto/crypt-gensalt.c
parentaa6970efff0569801f7d09235fdd193ebaee62d7 (diff)
Fix some portability problems (get it to compile, at least, on HP's cc)
Diffstat (limited to 'contrib/pgcrypto/crypt-gensalt.c')
-rw-r--r--contrib/pgcrypto/crypt-gensalt.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/contrib/pgcrypto/crypt-gensalt.c b/contrib/pgcrypto/crypt-gensalt.c
index 8bb17147334..69138268424 100644
--- a/contrib/pgcrypto/crypt-gensalt.c
+++ b/contrib/pgcrypto/crypt-gensalt.c
@@ -10,19 +10,13 @@
* may not be compiled always. -- marko
*/
-#include <postgres.h>
+#include "postgres.h"
+
#include "px-crypt.h"
#include <errno.h>
#ifndef __set_errno
-#define __set_errno(val) errno = (val)
-#endif
-
-#undef __CONST
-#ifdef __GNUC__
-#define __CONST __const
-#else
-#define __CONST
+#define __set_errno(val) (errno = (val))
#endif
typedef unsigned int BF_word;
@@ -31,7 +25,7 @@ unsigned char _crypt_itoa64[64 + 1] =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
char *_crypt_gensalt_traditional_rn(unsigned long count,
- __CONST char *input, int size, char *output, int output_size)
+ const char *input, int size, char *output, int output_size)
{
if (size < 2 || output_size < 2 + 1 || (count && count != 25)) {
if (output_size > 0) output[0] = '\0';
@@ -47,7 +41,7 @@ char *_crypt_gensalt_traditional_rn(unsigned long count,
}
char *_crypt_gensalt_extended_rn(unsigned long count,
- __CONST char *input, int size, char *output, int output_size)
+ const char *input, int size, char *output, int output_size)
{
unsigned long value;
@@ -80,7 +74,7 @@ char *_crypt_gensalt_extended_rn(unsigned long count,
}
char *_crypt_gensalt_md5_rn(unsigned long count,
- __CONST char *input, int size, char *output, int output_size)
+ const char *input, int size, char *output, int output_size)
{
unsigned long value;
@@ -121,7 +115,7 @@ char *_crypt_gensalt_md5_rn(unsigned long count,
static unsigned char BF_itoa64[64 + 1] =
"./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-static void BF_encode(char *dst, __CONST BF_word *src, int size)
+static void BF_encode(char *dst, const BF_word *src, int size)
{
unsigned char *sptr = (unsigned char *)src;
unsigned char *end = sptr + size;
@@ -154,7 +148,7 @@ static void BF_encode(char *dst, __CONST BF_word *src, int size)
}
char *_crypt_gensalt_blowfish_rn(unsigned long count,
- __CONST char *input, int size, char *output, int output_size)
+ const char *input, int size, char *output, int output_size)
{
if (size < 16 || output_size < 7 + 22 + 1 ||
(count && (count < 4 || count > 31))) {