Author: tpot
Date: 2005-08-02 20:44:30 +0000 (Tue, 02 Aug 2005)
New Revision: 8946

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8946

Log:
Some casts to fix warnings when time_t is an unsigned type.  Fixes 
bugzilla #1888 and #1894.

Modified:
   branches/SAMBA_3_0/source/lib/time.c
   branches/SAMBA_3_0/source/nmbd/nmbd_workgroupdb.c
   trunk/source/lib/time.c
   trunk/source/nmbd/nmbd_workgroupdb.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/time.c
===================================================================
--- branches/SAMBA_3_0/source/lib/time.c        2005-08-02 20:37:52 UTC (rev 
8945)
+++ branches/SAMBA_3_0/source/lib/time.c        2005-08-02 20:44:30 UTC (rev 
8946)
@@ -366,7 +366,7 @@
                return(0);
 
        if (nt->high==0x80000000 && nt->low==0)
-               return -1;
+               return (time_t)-1;
 
        /* reverse the time */
        /* it's a negative value, turn it to positive */
@@ -421,7 +421,7 @@
                nt->high = 0x7fffffff;
                return;
        }               
-       if (t == -1) {
+       if (t == (time_t)-1) {
                nt->low = 0xffffffff;
                nt->high = 0xffffffff;
                return;
@@ -462,7 +462,7 @@
                return;
        }
                
-       if (t == -1) {
+       if (t == (time_t)-1) {
                /* that's what NT uses for infinite */
                nt->low = 0x0;
                nt->high = 0x80000000;

Modified: branches/SAMBA_3_0/source/nmbd/nmbd_workgroupdb.c
===================================================================
--- branches/SAMBA_3_0/source/nmbd/nmbd_workgroupdb.c   2005-08-02 20:37:52 UTC 
(rev 8945)
+++ branches/SAMBA_3_0/source/nmbd/nmbd_workgroupdb.c   2005-08-02 20:44:30 UTC 
(rev 8946)
@@ -322,7 +322,7 @@
                        expire_servers(work, t);
 
                        if ((work->serverlist == NULL) && (work->death_time != 
PERMANENT_TTL) && 
-                                       ((t == -1) || (work->death_time < t))) {
+                                       ((t == (time_t)-1) || (work->death_time 
< t))) {
                                DEBUG(3,("expire_workgroups_and_servers: 
Removing timed out workgroup %s\n",
                                                work->work_group));
                                remove_workgroup_from_subnet(subrec, work);

Modified: trunk/source/lib/time.c
===================================================================
--- trunk/source/lib/time.c     2005-08-02 20:37:52 UTC (rev 8945)
+++ trunk/source/lib/time.c     2005-08-02 20:44:30 UTC (rev 8946)
@@ -366,7 +366,7 @@
                return(0);
 
        if (nt->high==0x80000000 && nt->low==0)
-               return -1;
+               return (time_t)-1;
 
        /* reverse the time */
        /* it's a negative value, turn it to positive */
@@ -421,7 +421,7 @@
                nt->high = 0x7fffffff;
                return;
        }               
-       if (t == -1) {
+       if (t == (time_t)-1) {
                nt->low = 0xffffffff;
                nt->high = 0xffffffff;
                return;
@@ -462,7 +462,7 @@
                return;
        }
                
-       if (t == -1) {
+       if (t == (time_t)-1) {
                /* that's what NT uses for infinite */
                nt->low = 0x0;
                nt->high = 0x80000000;

Modified: trunk/source/nmbd/nmbd_workgroupdb.c
===================================================================
--- trunk/source/nmbd/nmbd_workgroupdb.c        2005-08-02 20:37:52 UTC (rev 
8945)
+++ trunk/source/nmbd/nmbd_workgroupdb.c        2005-08-02 20:44:30 UTC (rev 
8946)
@@ -322,7 +322,7 @@
                        expire_servers(work, t);
 
                        if ((work->serverlist == NULL) && (work->death_time != 
PERMANENT_TTL) && 
-                                       ((t == -1) || (work->death_time < t))) {
+                                       ((t == (time_t)-1) || (work->death_time 
< t))) {
                                DEBUG(3,("expire_workgroups_and_servers: 
Removing timed out workgroup %s\n",
                                                work->work_group));
                                remove_workgroup_from_subnet(subrec, work);

Reply via email to