Summary: cosmetics, fix some warnings about signedness
authorSebastian Freundt <freundt@ga-group.nl>
Fri, 6 Jan 2012 19:06:26 +0000 (19:06 +0000)
committerSebastian Freundt <hroptatyr@fresse.org>
Sun, 8 Jan 2012 03:12:28 +0000 (03:12 +0000)
Keywords: bldchn

* lib-src/gnuslib.c: treat ints returned by snprintf() as size_t for
  assertions

* src/regex.c: strictly return values from the enum as declared

Signed-off-by: Sebastian Freundt <freundt@ga-group.nl>
Conflicts:

lib-src/gnuslib.c
lib-src/profile.c

Signed-off-by: Sebastian Freundt <hroptatyr@fresse.org>
lib-src/gnuslib.c
lib-src/profile.c
src/regex.c

index d665b30..11ad8e2 100644 (file)
@@ -263,7 +263,7 @@ static int connect_to_unix_server(void)
        sz = snprintf(server.sun_path, sizeof(server.sun_path),
                      "%s/gsrv%d", tmpdir, (int)geteuid());
 #endif                         /* HIDE_UNIX_SOCKET */
-       assert(sz>=0 && sz<sizeof(server.sun_path));
+       assert(sz >= 0 && (size_t)sz < sizeof(server.sun_path));
        if (connect(s, (struct sockaddr *)&server, strlen(server.sun_path) + 2)
            < 0) {
                perror(progname);
@@ -389,8 +389,7 @@ static int connect_to_internet_server(char *serverhost, unsigned short port)
 #endif                         /* AUTH_MAGIC_COOKIE */
 
        len = snprintf(buf, sizeof(buf), "%s\n", DEFAUTH_NAME);
-       assert(len >= 0);
-       assert((size_t)len < sizeof(buf));
+       assert(len >= 0 && (size_t)len < sizeof(buf));
        t = write(s, buf, len);
        if(t != len) {
                fprintf(stderr, "%s: unable to send auth", progname);
index f96f436..c8fa369 100644 (file)
@@ -65,7 +65,7 @@ static char *get_time(void)
        sz = snprintf(time_string, sizeof(time_string), "%lu.%06lu",
                      (unsigned long)TV2.tv_sec - TV1.tv_sec,
                      (unsigned long)TV2.tv_usec - TV1.tv_usec);
-       assert(sz>=0 && (size_t)sz<sizeof(time_string));
+       assert(sz >= 0 && (size_t)sz < sizeof(time_string));
        return time_string;
 }
 
index a3da58b..84d21f3 100644 (file)
@@ -1974,7 +1974,7 @@ re_wctype(re_char *str)
        } else if (STREQ (string, "multibyte")) {
                return RECC_MULTIBYTE;
        } else {
-               return 0;
+               return RECC_ERROR;
        }
 }