OSDN Git Service

Ver.1.4.26: Fix error on 64 bits machine.
authorwatanaby <>
Fri, 29 Feb 2008 09:51:00 +0000 (09:51 +0000)
committerwatanaby <>
Fri, 29 Feb 2008 09:51:00 +0000 (09:51 +0000)
opengate/doc/Changes.html
opengate/opengatesrv/addr-convert.c
opengate/opengatesrv/ctrl-alarms.c

index e57f09f..aa5d599 100644 (file)
@@ -608,6 +608,11 @@ Ver.1.4.25 at 2007.12.21</DT>
 <DD>\r
 Fix typo in Makefile (change from Lockfile to LockFile).\r
 </DD>\r
+<DT>\r
+Ver.1.4.26 at 2008.2.29</DT>\r
+<DD>\r
+Fix error in 64 bits machine.\r
+</DD>\r
 \r
 </DL>\r
 <b>Please see CVS in SourceForge.net to check the file difference between versions.</b>\r
index e33b60b..47e965b 100644 (file)
@@ -74,15 +74,23 @@ int addrDecode(char dotSepAddr[], char encodeAddr[])
   unsigned long address;
   int illform=0;
   int checkDigit;
-  time_t encodeTiming, diffTime;
+  /* on 64 bit machines time_t and int are different, to read a correct */
+  /* value with sscanf() we declare encodeTiming and diffTime as int    */
+  /* and later on cast time(NULL) to int                                */
+  /* this should work on 32 and 64 bit                                  */
+  /* WARNING: this is WILL fail in the year 2038!                       */
+  /* Fri Feb 29 00:42:57 CET 2008 // ob@sysadm.in                       */
+  /* time_t encodeTiming, diffTime; */
+  int encodeTiming, diffTime;
 
   /* convert string to integer */
   if(sscanf(encodeAddr, "%lu-%d-%d", &address, &checkDigit, &encodeTiming)!=3){
     illform=1;
   }
 
+  /* if(debug>1) err_msg("DEBUG:AddrDecode encodeTiming=%d", encodeTiming); */
   /* if the time difference between encode and decode is too large, retry */
-  diffTime = time(NULL) - encodeTiming;
+  diffTime = (int)time(NULL) - encodeTiming;
   if(diffTime <0 || diffTime > atoi(GetConfValue("ForwardingDelay"))){
     illform = 1;
   }
index 2702bcf..01c4ddf 100644 (file)
@@ -302,7 +302,7 @@ void listAlarm(void)
 {
   Alarm *p;
 
-  printf("TimeNow=%d\n",time(NULL));
+  printf("TimeNow=%d\n",(int)time(NULL));
 
   p=pAlarmTop;