]> granicus.if.org Git - sudo/commitdiff
Fix sign comparison warning.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 30 Oct 2013 20:27:50 +0000 (14:27 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 30 Oct 2013 20:27:50 +0000 (14:27 -0600)
plugins/sudoers/getdate.c
plugins/sudoers/gram.c

index 9cc2d5a72757cee5a83bd366013884c9903be4f3..ed8db4398039eb284a43051c6dec25908d7fb1bf 100644 (file)
@@ -389,7 +389,7 @@ YYSTYPE yylval;
 short *yyss;
 short *yysslim;
 YYSTYPE *yyvs;
-int yystacksize;
+unsigned int yystacksize;
 #line 326 "getdate.y"
 
 /* Month and day table. */
@@ -1035,7 +1035,8 @@ static int yygrowstack(void)
 static int yygrowstack()
 #endif
 {
-    int newsize, i;
+    unsigned int newsize;
+    long sslen;
     short *newss;
     YYSTYPE *newvs;
 
@@ -1047,23 +1048,27 @@ static int yygrowstack()
 #ifdef SIZE_MAX
 #define YY_SIZE_MAX SIZE_MAX
 #else
-#define YY_SIZE_MAX 0x7fffffff
+#ifdef __STDC__
+#define YY_SIZE_MAX 0xffffffffU
+#else
+#define YY_SIZE_MAX (unsigned int)0xffffffff
+#endif
 #endif
-    if (YY_SIZE_MAX / (unsigned int)newsize < sizeof *newss)
+    if (YY_SIZE_MAX / newsize < sizeof *newss)
         goto bail;
-    i = yyssp - yyss;
+    sslen = yyssp - yyss;
     newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
       (short *)malloc(newsize * sizeof *newss); /* overflow check above */
     if (newss == NULL)
         goto bail;
     yyss = newss;
-    yyssp = newss + i;
+    yyssp = newss + sslen;
     newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :
       (YYSTYPE *)malloc(newsize * sizeof *newvs); /* overflow check above */
     if (newvs == NULL)
         goto bail;
     yyvs = newvs;
-    yyvsp = newvs + i;
+    yyvsp = newvs + sslen;
     yystacksize = newsize;
     yysslim = yyss + newsize - 1;
     return 0;
@@ -1519,7 +1524,7 @@ case 41:
            yyval.Meridian = yyvsp[0].Meridian;
        }
 break;
-#line 1470 "getdate.c"
+#line 1475 "getdate.c"
     }
     yyssp -= yym;
     yystate = *yyssp;
index cd353306a177e8014eb79618c1e2abbf143545ce..a953e2b24bfdc8e6ed91248a09f2f7375432820c 100644 (file)
@@ -698,7 +698,7 @@ YYSTYPE yylval;
 short *yyss;
 short *yysslim;
 YYSTYPE *yyvs;
-int yystacksize;
+unsigned int yystacksize;
 #line 688 "gram.y"
 void
 sudoerserror(const char *s)
@@ -966,7 +966,8 @@ static int yygrowstack(void)
 static int yygrowstack()
 #endif
 {
-    int newsize, i;
+    unsigned int newsize;
+    long sslen;
     short *newss;
     YYSTYPE *newvs;
 
@@ -978,23 +979,27 @@ static int yygrowstack()
 #ifdef SIZE_MAX
 #define YY_SIZE_MAX SIZE_MAX
 #else
-#define YY_SIZE_MAX 0x7fffffff
+#ifdef __STDC__
+#define YY_SIZE_MAX 0xffffffffU
+#else
+#define YY_SIZE_MAX (unsigned int)0xffffffff
+#endif
 #endif
     if (YY_SIZE_MAX / newsize < sizeof *newss)
         goto bail;
-    i = yyssp - yyss;
+    sslen = yyssp - yyss;
     newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
       (short *)malloc(newsize * sizeof *newss); /* overflow check above */
     if (newss == NULL)
         goto bail;
     yyss = newss;
-    yyssp = newss + i;
+    yyssp = newss + sslen;
     newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :
       (YYSTYPE *)malloc(newsize * sizeof *newvs); /* overflow check above */
     if (newvs == NULL)
         goto bail;
     yyvs = newvs;
-    yyvsp = newvs + i;
+    yyvsp = newvs + sslen;
     yystacksize = newsize;
     yysslim = yyss + newsize - 1;
     return 0;
@@ -1844,7 +1849,7 @@ case 111:
                            yyval.member = new_member(yyvsp[0].string, WORD);
                        }
 break;
-#line 1795 "gram.c"
+#line 1800 "gram.c"
     }
     yyssp -= yym;
     yystate = *yyssp;