]> git.cworth.org Git - notmuch/commitdiff
compat/getdelim: Silence a warning about mixing of signed/unsigned.
authorCarl Worth <cworth@cworth.org>
Tue, 1 Dec 2009 22:12:01 +0000 (14:12 -0800)
committerCarl Worth <cworth@cworth.org>
Wed, 2 Dec 2009 00:27:35 +0000 (16:27 -0800)
If the length is ever so large as to overflow, then we'll end up
returning a negative value (which indicates an error anyway).

compat/getdelim.c

index 84bef87b09b644149a9127feb1667edcfc549126..1bedef7c903ccb1b2296ef59d674a6d2f898f067 100644 (file)
@@ -124,7 +124,7 @@ getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
        break;
     }
   (*lineptr)[cur_len] = '\0';
-  result = cur_len ? cur_len : result;
+  result = cur_len ? (ssize_t) cur_len : result;
 
  unlock_return:
   funlockfile (fp); /* doesn't set errno */