[exim-cvs] Fix 64b build.

Góra strony
Delete this message
Reply to this message
Autor: Exim Git Commits Mailing List
Data:  
Dla: exim-cvs
Temat: [exim-cvs] Fix 64b build.
Gitweb: http://git.exim.org/exim.git/commitdiff/4328fd3cb019281becab844b6bf560632b1d34b1
Commit:     4328fd3cb019281becab844b6bf560632b1d34b1
Parent:     3f1df0e341c4ddc4add38fa97d9d34972655a6c7
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Sat Nov 17 21:47:26 2012 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Thu Nov 22 20:59:54 2012 +0000


    Fix 64b build.
---
 src/src/config.h.defaults |    5 ++++-
 src/src/exim.h            |    9 +++++++++
 src/src/expand.c          |   12 ++++++------
 3 files changed, 19 insertions(+), 7 deletions(-)


diff --git a/src/src/config.h.defaults b/src/src/config.h.defaults
index ef83621..3610518 100644
--- a/src/src/config.h.defaults
+++ b/src/src/config.h.defaults
@@ -180,7 +180,10 @@ just in case. */
 #define ROOT_UID                      0
 #define ROOT_GID                      0


-/* Sizes for integer arithmetic.  Go for 64bit; can be overridden in OS/Makefile-FOO */
+/* Sizes for integer arithmetic.
+Go for 64bit; can be overridden in OS/Makefile-FOO
+If you make it a different number of bits, provide a definition
+for EXIM_64B_MAX and _MIN in OS/oh.h-FOO */
 #define int_eximarith_t int64_t
 #define PR_EXIM_ARITH "%" PRId64        /* C99 standard, printf %lld */
 #define SC_EXIM_ARITH "%" SCNi64        /* scanf incl. 0x prefix */
diff --git a/src/src/exim.h b/src/src/exim.h
index 2816fc9..066e99d 100644
--- a/src/src/exim.h
+++ b/src/src/exim.h
@@ -106,6 +106,15 @@ making unique names. */
 #define UCHAR_MAX 255
 #endif


+
+/* To match int_eximarith_t. Define in OS/os.h-<your-system> to override. */
+#ifndef EXIM_ARITH_MAX
+# define EXIM_ARITH_MAX ((int_eximarith_t)9223372036854775807LL)
+#endif
+#ifndef EXIM_ARITH_MIN
+# define EXIM_ARITH_MIN (-EXIM_ARITH_MAX - 1)
+#endif
+
/* Some systems have PATH_MAX and some have MAX_PATH_LEN. */

 #ifndef PATH_MAX
diff --git a/src/src/expand.c b/src/src/expand.c
index 9fc00cf..c7dc274 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -3389,12 +3389,12 @@ if (*error == NULL)
      * can just let the other invalid results occur otherwise, as they have
      * until now.  For this one case, we can coerce.
      */
-    if (y == -1 && x == LLONG_MIN && op != '*')
+    if (y == -1 && x == EXIM_ARITH_MIN && op != '*')
       {
       DEBUG(D_expand)
         debug_printf("Integer exception dodging: " PR_EXIM_ARITH "%c-1 coerced to " PR_EXIM_ARITH "\n",
-            LLONG_MIN, op, LLONG_MAX);
-      x = LLONG_MAX;
+            EXIM_ARITH_MIN, op, EXIM_ARITH_MAX);
+      x = EXIM_ARITH_MAX;
       continue;
       }
     if (op == '*')
@@ -6514,17 +6514,17 @@ else
     default:
       break;
     case 'k':
-      if (value > LLONG_MAX/1024 || value < LLONG_MIN/1024) errno = ERANGE;
+      if (value > EXIM_ARITH_MAX/1024 || value < EXIM_ARITH_MIN/1024) errno = ERANGE;
       else value *= 1024;
       endptr++;
       break;
     case 'm':
-      if (value > LLONG_MAX/(1024*1024) || value < LLONG_MIN/(1024*1024)) errno = ERANGE;
+      if (value > EXIM_ARITH_MAX/(1024*1024) || value < EXIM_ARITH_MIN/(1024*1024)) errno = ERANGE;
       else value *= 1024*1024;
       endptr++;
       break;
     case 'g':
-      if (value > LLONG_MAX/(1024*1024*1024) || value < LLONG_MIN/(1024*1024*1024)) errno = ERANGE;
+      if (value > EXIM_ARITH_MAX/(1024*1024*1024) || value < EXIM_ARITH_MIN/(1024*1024*1024)) errno = ERANGE;
       else value *= 1024*1024*1024;
       endptr++;
       break;