More warning suppressions
authorNelson Ferreira <nelson.ferreira@ieee.org>
Thu, 5 Jan 2012 04:05:52 +0000 (23:05 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Thu, 5 Jan 2012 04:05:52 +0000 (23:05 -0500)
* lib-src/gnuslib.c (connect_to_unix_server): Use size_t for sz

* src/ui/X11/event-Xt.c (x_reset_modifier_mapping): Add full
prototype to auto functions

* src/ui/glyphs-eimage.c (png_instantiate): use png_uint_32 in loop

* src/ui/lwlib/xlwmenu.c (parameterize_string): add new offset to
keep signedness in comparison

* src/ui/X11/glyphs-x.c (x_subwindow_query_geometry): add prototyp

* lib-src/gnuslib.c (connect_to_internet_server): Use size_t to
compare with sizeof.

* src/alloc.c (garbage_collect): ditto.
* src/buffer.c (Fgenerate_new_buffer_name): ditto.
* src/dumper.c (pdump_file_try): ditto.
* src/dumper.c (pdump_load): ditto.
* src/editfns.c (Fencode_time): ditto.
* src/editfns.c (Fencode_btime): ditto.
* src/editfns.c (Fcurrent_time_zone): ditto.
* src/extents.c (print_extent_1): ditto.
* src/mule/input-method-xlib.c (EmacsXtCvtStringToXIMStyles): ditto.
* src/mule/input-method-xlib.c (describe_Window): ditto.
* src/print.c (SXE_VSNPRINT_VA): ditto.
* src/print.c (write_hex_ptr): ditto.
* src/print.c (printing_major_badness): ditto.
* src/process-unix.c (allocate_pty_the_old_fashioned_way): ditto.

* src/process-unix.c (unix_open_network_stream): ditto.
* src/process-unix.c (unix_open_network_server_stream): ditto.
* src/process.c (make_process_internal): ditto.
* src/strftime.c (add_num_time_t): ditto.
* src/ui/TTY/objects-tty.c (Ffind_tty_color): ditto.
* src/ui/TTY/objects-tty.c (Ftty_registered_color_list): ditto.
* src/ui/TTY/redisplay-tty.c (term_get_fkeys_1): ditto.
* src/ui/X11/device-x.c (read_locale_specific_resources): ditto.
* src/ui/X11/device-x.c (x_init_device): ditto.
* src/ui/X11/device-x.c (signal_if_x_error): ditto.
* src/ui/X11/dialog-x.c (dbox_descriptor_to_widget_value): ditto.
* src/ui/X11/event-Xt.c (x_keysym_to_emacs_keysym): ditto.
* src/ui/X11/event-Xt.c (describe_event): ditto.
* src/ui/X11/frame-x.c (color_to_string): ditto.
* src/ui/X11/frame-x.c (x_set_initial_frame_size): ditto.
* src/ui/X11/frame-x.c (Fx_window_id): ditto.
* src/ui/X11/objects-x.c (truename_via_random_props): ditto.
* src/ui/X11/scrollbar-x.c (x_create_scrollbar_instance): ditto.
* src/ui/glyphs-eimage.c (tiff_error_func): ditto.
* src/ui/glyphs-eimage.c (tiff_warning_func): ditto.
* src/ui/lwlib/lwlib-Xaw.c (make_dialog): ditto.
* src/ui/lwlib/lwlib-Xaw.c (make_dialog): ditto.
* src/ui/lwlib/xlwgauge.c (GaugeExpose): ditto.
* src/ui/lwlib/xlwgauge.c (MaxLabel): ditto.
* src/ui/lwlib/xlwmenu.c (parameterize_string): ditto.
* src/ui/lwlib/xlwtabs.c (XawTabsSetTop): ditto.
* src/ui/redisplay.c (decode_mode_spec): ditto.
* src/ui/redisplay.c (decode_mode_spec): ditto.
* src/ui/redisplay.c (decode_mode_spec): ditto.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
26 files changed:
lib-src/gnuslib.c
src/alloc.c
src/buffer.c
src/dumper.c
src/editfns.c
src/extents.c
src/mule/input-method-xlib.c
src/print.c
src/process-unix.c
src/process.c
src/strftime.c
src/ui/TTY/objects-tty.c
src/ui/TTY/redisplay-tty.c
src/ui/X11/device-x.c
src/ui/X11/dialog-x.c
src/ui/X11/event-Xt.c
src/ui/X11/frame-x.c
src/ui/X11/glyphs-x.c
src/ui/X11/objects-x.c
src/ui/X11/scrollbar-x.c
src/ui/glyphs-eimage.c
src/ui/lwlib/lwlib-Xaw.c
src/ui/lwlib/xlwgauge.c
src/ui/lwlib/xlwmenu.c
src/ui/lwlib/xlwtabs.c
src/ui/redisplay.c

index b056d6a..d665b30 100644 (file)
@@ -247,7 +247,7 @@ static int connect_to_unix_server(void)
 {
        int s;                  /* connected socket descriptor */
        struct sockaddr_un server;      /* for unix connections */
-       int sz;
+       size_t sz;
 
        if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
                perror(progname);
@@ -389,7 +389,8 @@ 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 && len < sizeof(buf));
+       assert(len >= 0);
+       assert((size_t)len < sizeof(buf));
        t = write(s, buf, len);
        if(t != len) {
                fprintf(stderr, "%s: unable to send auth", progname);
index ab31f2d..55af853 100644 (file)
@@ -4970,7 +4970,7 @@ Garbage collection happens automatically if you cons more than
                                    lcrecord_stats[i].bytes_freed;
 
                        sz = snprintf(buf, sizeof(buf), "%s-storage", name);
-                       assert(sz >=0  && sz < sizeof(buf));
+                       assert(sz >=0  && (size_t)sz < sizeof(buf));
                        pl = gc_plist_hack(buf, lcrecord_stats[i].bytes_in_use,
                                           pl);
                        /* Okay, simple pluralization check for
@@ -4979,7 +4979,7 @@ Garbage collection happens automatically if you cons more than
                                 sz = snprintf(buf, sizeof(buf), "%ses-freed", name);
                        else
                                sz = snprintf(buf, sizeof(buf), "%ss-freed", name);
-                       assert(sz >=0  && sz < sizeof(buf));
+                       assert(sz >=0  && (size_t)sz < sizeof(buf));
                        if (lcrecord_stats[i].instances_freed != 0)
                                pl = gc_plist_hack(buf,
                                                   lcrecord_stats[i].
@@ -4988,7 +4988,7 @@ Garbage collection happens automatically if you cons more than
                                sz = snprintf(buf, sizeof(buf), "%ses-on-free-list", name);
                        else
                                sz = snprintf(buf, sizeof(buf), "%ss-on-free-list", name);
-                       assert(sz >=0  && sz < sizeof(buf));
+                       assert(sz >=0  && (size_t)sz < sizeof(buf));
                        if (lcrecord_stats[i].instances_on_free_list != 0)
                                pl = gc_plist_hack(buf,
                                                   lcrecord_stats[i].
@@ -4997,7 +4997,7 @@ Garbage collection happens automatically if you cons more than
                                sz = snprintf(buf, sizeof(buf), "%ses-used", name);
                        else
                                sz = snprintf(buf, sizeof(buf), "%ss-used", name);
-                       assert(sz >=0  && sz < sizeof(buf));
+                       assert(sz >=0  && (size_t)sz < sizeof(buf));
                        pl = gc_plist_hack(buf,
                                           lcrecord_stats[i].instances_in_use,
                                           pl);
index 0718a59..734cb7b 100644 (file)
@@ -705,7 +705,7 @@ even if a buffer with that name exists.
        count = 1;
        while (1) {
                 prt = snprintf(number, sizeof(number), "<%d>", ++count);
-               assert(prt>=0 && prt < sizeof(number));
+               assert(prt>=0 && (size_t)prt < sizeof(number));
                gentemp = concat2(name, build_string(number));
                if (!NILP(ignore)) {
                        tem = Fstring_equal(gentemp, ignore);
index 9e56aa0..8987436 100644 (file)
@@ -1284,7 +1284,7 @@ static int pdump_file_try(char *exe_path, size_t size)
                sz = snprintf(w, size, "-%d.%d.%d-%08x.dmp", 
                          EMACS_MAJOR_VERSION, EMACS_MINOR_VERSION,
                          EMACS_BETA_VERSION, dump_id);
-               if (sz >=0 && sz < size && pdump_file_get(exe_path)) {
+               if (sz >=0 && (size_t)sz < size && pdump_file_get(exe_path)) {
                        if (pdump_load_check()) {
                                return 1;
                        }
@@ -1293,7 +1293,7 @@ static int pdump_file_try(char *exe_path, size_t size)
 #endif /* EMACS_BETA_VERSION */
 
                sz = snprintf(w, size, "-%08x.dmp", dump_id);
-               if (sz >=0 && sz < size && pdump_file_get(exe_path)) {
+               if (sz >=0 && (size_t)sz < size && pdump_file_get(exe_path)) {
                        if (pdump_load_check()) {
                                return 1;
                        }
@@ -1301,7 +1301,7 @@ static int pdump_file_try(char *exe_path, size_t size)
                }
 
                sz = snprintf(w, size, ".dmp");
-               if (sz >=0 && sz < size && pdump_file_get(exe_path)) {
+               if (sz >=0 && (size_t)sz < size && pdump_file_get(exe_path)) {
                        if (pdump_load_check()) {
                                return 1;
                        }
@@ -1422,7 +1422,7 @@ int pdump_load(const char *argv0)
                                /* Oh well, let's have some kind of default */
                                int sz = snprintf(exe_path, sizeof(exe_path),
                                                  "./%s", name);
-                               assert(sz >= 0 && sz < sizeof(exe_path));
+                               assert(sz >= 0 && (size_t)sz < sizeof(exe_path));
                                break;
                        }
                        path = p + 1;
index 98e7507..a32f51b 100644 (file)
@@ -1352,7 +1352,7 @@ If you want them to stand for years in this century, you must do that yourself.
                        int sz = snprintf(tzbuf, sizeof(tzbuf), "XXX%s%d:%02d:%02d",
                                          "-" + (XINT(zone) < 0), abszone / (60 * 60),
                                          (abszone / 60) % 60, abszone % 60);
-                       assert(sz >= 0 && sz < sizeof(tzbuf));
+                       assert(sz >= 0 && (size_t)sz < sizeof(tzbuf));
                        tzstring = tzbuf;
                } else {
                        error("Invalid time zone specification");
@@ -1427,7 +1427,7 @@ Like `encode-time' but return a big integer time instead.
                        int sz = snprintf(tzbuf, sizeof(tzbuf), "XXX%s%d:%02d:%02d",
                                          "-" + (XINT(zone) < 0), abszone / (60 * 60),
                                          (abszone / 60) % 60, abszone % 60);
-                       assert(sz>=0 && sz < sizeof(tzbuf));
+                       assert(sz>=0 && (size_t)sz < sizeof(tzbuf));
                        tzstring = tzbuf;
                } else
                        error("Invalid time zone specification");
@@ -1566,7 +1566,7 @@ the data it can't find.
                        int sz = snprintf(buf, sizeof(buf), "%c%02d%02d", 
                                          (offset < 0 ? '-' : '+'),
                                          am / 60, am % 60);
-                       assert(sz>=0 && sz < sizeof(buf));
+                       assert(sz>=0 && (size_t)sz < sizeof(buf));
                        s = buf;
                }
                return list2(make_int(offset), build_string(s));
index e5c3ab8..226a17c 100644 (file)
@@ -3140,7 +3140,7 @@ print_extent_1(Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
                sz=snprintf(bp, sizeof(buf)-2, "%ld, %ld",
                            XINT(Fextent_start_position(obj)),
                            XINT(Fextent_end_position(obj)));
-               assert(sz>=0 && sz<(sizeof(buf)-2));
+               assert(sz>=0 && (size_t)sz<(sizeof(buf)-2));
        }
        bp += strlen(bp);
        *bp++ = (extent_end_open_p(anc) ? ')' : ']');
index 7c10248..ef5c0bd 100644 (file)
@@ -714,7 +714,7 @@ EmacsXtCvtStringToXIMStyles (
                               "Cannot convert string \"%s\" to type XIMStyles.\n"
                               "Using default string \"%s\" instead.\n",
                               fromVal->addr, DefaultXIMStyles);
-               assert(len >= 0 && len < sizeof(buf));
+               assert(len >= 0 && (size_t)len < sizeof(buf));
                XtAppWarningMsg(the_app_con, "wrongParameters",
                                "cvtStringToXIMStyle",
                                "XtToolkitError",
@@ -939,9 +939,10 @@ void
 describe_Window (Window win)
 {
        char xwincmd[128];
-       if ( snprintf (xwincmd, sizeof(xwincmd), 
-                      "xwininfo -id 0x%x >&2; xwininfo -events -id 0x%x >&2",
-                      (int) win, (int) win) < sizeof(xwincmd) ) {
+       int sz = snprintf (xwincmd, sizeof(xwincmd), 
+                          "xwininfo -id 0x%x >&2; xwininfo -events -id 0x%x >&2",
+                          (int) win, (int) win);
+       if ( sz >= 0 && (size_t) sz < sizeof(xwincmd) ) {
                int exit_code = system (xwincmd);
                if (  exit_code != 0 )
                        stderr_out("command '%s' failed with exit code %d", 
index 58789f6..9b95721 100644 (file)
@@ -144,7 +144,7 @@ std_handle_out_external(FILE * stream, Lisp_Object lstream,
                        size *= 2;                                      \
                        XMALLOC_OR_ALLOCA(buf,size,type);               \
                        ret = 0;                                        \
-               } else if ( ret > size ) {                              \
+               } else if ( (size_t)ret > (size_t)size ) {              \
                    /* We need more space, so we need to allocate it */ \
                        XMALLOC_UNBIND(buf,size,spec);                  \
                        size = ret + 1;                                 \
@@ -565,7 +565,7 @@ void write_hex_ptr(void* value, Lisp_Object stream)
 {
        char buf[sizeof(value)*2+1];
        int n = snprintf(buf,sizeof(buf),"0x%p",value);
-       assert(n>=0 && n<sizeof(buf));
+       assert(n>=0 && (size_t)n<sizeof(buf));
        write_c_string(buf,stream);
 }
 
@@ -1272,7 +1272,7 @@ printing_major_badness(Lisp_Object printcharfun,
                               badness_string, badness);
                break;
        }
-       assert(len >= 0 && len < sizeof(buf));
+       assert(len >= 0 && (size_t)len < sizeof(buf));
 
        /* Don't abort or signal if called from debug_print() or already
           crashing */
index 1af232f..a9a1296 100644 (file)
@@ -376,7 +376,7 @@ static int allocate_pty_the_old_fashioned_way(void)
                        PTY_NAME_SPRINTF;
 #else
                        sz = snprintf(pty_name, sizeof(pty_name), "/dev/pty%c%x", c, i);
-                       assert(sz >= 0 && sz < sizeof(pty_name));
+                       assert(sz >= 0 && (size_t)sz < sizeof(pty_name));
 #endif                         /* no PTY_NAME_SPRINTF */
 
                        if (sxemacs_stat(pty_name, &stb) < 0) {
@@ -391,9 +391,9 @@ static int allocate_pty_the_old_fashioned_way(void)
 #ifdef PTY_TTY_NAME_SPRINTF
                                PTY_TTY_NAME_SPRINTF;
 #else
-                               int sz = snprintf(pty_name, sizeof(pty_name),
+                               sz = snprintf(pty_name, sizeof(pty_name),
                                                  "/dev/tty%c%x", c, i);
-                               assert(sz >= 0 && sz < sizeof(pty_name));
+                               assert(sz >= 0 && (size_t)sz < sizeof(pty_name));
 #endif                         /* no PTY_TTY_NAME_SPRINTF */
                                if (access(pty_name, R_OK | W_OK) == 0) {
                                        setup_pty(fd);
@@ -1674,7 +1674,7 @@ unix_open_network_stream(Lisp_Object name, Lisp_Object host,
                if (INTP(service)) {
                        int sz= snprintf(portbuf, sizeof(portbuf), "%ld",
                                         (long)XINT(service));
-                       assert(sz >= 0 && sz < sizeof(portbuf));
+                       assert(sz >= 0 && (size_t)sz < sizeof(portbuf));
                        portstring = portbuf;
                        port = htons((unsigned short)XINT(service));
                } else {
@@ -2126,7 +2126,7 @@ unix_open_network_server_stream(Lisp_Object name, Lisp_Object host,
                if (INTP(service)) {
                        int sz = snprintf(portbuf, sizeof(portbuf), "%ld",
                                          (long)XINT(service));
-                       assert(sz >= 0 && sz < sizeof(portbuf));
+                       assert(sz >= 0 && (size_t)sz < sizeof(portbuf));
                        portstring = portbuf;
                        port = htons((unsigned short)XINT(service));
                } else {
index 4e345a5..cb5b035 100644 (file)
@@ -478,7 +478,7 @@ Lisp_Object make_process_internal(Lisp_Object name)
                if (NILP(tem))
                        break;
                sz = snprintf(suffix, sizeof(suffix), "<%d>", i);
-               assert(sz>=0 && sz<sizeof(suffix));
+               assert(sz>=0 && (size_t)sz<sizeof(suffix));
                name1 = concat2(name, build_string(suffix));
        }
        name = name1;
index 6f94d55..84a685f 100644 (file)
@@ -186,7 +186,7 @@ static int add_num_time_t(char *string, int max, time_t num)
        if (sizeof(num) > 16)
                abort();
        length = snprintf(buf, sizeof(buf), "%lu", (unsigned long)num);
-       assert(length >= 0 && length<sizeof(buf));
+       assert(length >= 0 && (size_t)length<sizeof(buf));
        length = add_str(string, buf, max);
        return length;
 }
index 5d3fcf0..0be74fa 100644 (file)
@@ -245,7 +245,7 @@ the nearest available color.
                char term_name[32];
                int sz = snprintf(term_name,sizeof(term_name),"default-%d-color",
                                  CONSOLE_TTY_DATA(console)->maxcolors);
-               assert(sz >= 0 && sz < sizeof(term_name));
+               assert(sz >= 0 && (size_t)sz < sizeof(term_name));
                sym_term = Fintern(make_string((Bufbyte*)term_name,strlen(term_name)),Qnil);
                default_color_slist = color_slist = get_term_color_alias_slist(sym_term,0);
                if ( ! EQ(color_slist,Qnil) ) {
@@ -347,7 +347,7 @@ DEVICE defaults to the selected device if omitted.
                Lisp_Object sym_term;
                int sz = snprintf(term_name,sizeof(term_name),"default-%d-color",
                                  CONSOLE_TTY_DATA(console)->maxcolors);
-               assert(sz>=0 && sz < sizeof(term_name));
+               assert(sz>=0 && (size_t)sz < sizeof(term_name));
                sym_term = Fintern(make_string((Bufbyte*)term_name,strlen(term_name)),Qnil);
                color_slist = get_term_color_alias_slist(sym_term,0);
        }
index 9e8d8b2..c8c8485 100644 (file)
@@ -1453,7 +1453,7 @@ static Lisp_Object term_get_fkeys_1(Lisp_Object function_key_map)
                                char *sequence = tgetstr(fcap, address);
                                if (sequence) {
                                        int sz = snprintf(fkey, sizeof(fkey), "f%d", i);
-                                       assert(sz >= 0 && sz < sizeof(fkey));
+                                       assert(sz >= 0 && (size_t)sz < sizeof(fkey));
                                        Fdefine_key(function_key_map,
                                                    build_ext_string(sequence,
                                                                     Qbinary),
index 622106f..ccb39bd 100644 (file)
@@ -591,7 +591,7 @@ read_locale_specific_resources(Display *dpy)
                        char path[strlen(data_dir) + strlen(locale) + 7];
                        int sz = snprintf(path, sizeof(path),
                                          "%s%s/Emacs", data_dir, locale);
-                       assert(sz >= 0 && sz < sizeof(path));
+                       assert(sz >= 0 && (size_t)sz < sizeof(path));
                        if (!access(path, R_OK)) {
                                XrmCombineFileDatabase(path, &db, False);
                        }
@@ -608,7 +608,7 @@ read_locale_specific_resources(Display *dpy)
                        int sz = snprintf(path, sizeof(path), 
                                          "%sapp-defaults/%s/Emacs",
                                          data_dir, locale);
-                       assert(sz >= 0 && sz < sizeof(path));
+                       assert(sz >= 0 && (size_t)sz < sizeof(path));
                        if (!access(path, R_OK)) {
                                XrmCombineFileDatabase(path, &db, False);
                        }
@@ -720,9 +720,9 @@ static void x_init_device(struct device *d, Lisp_Object props)
                XrmValue value;
 
                int sz = snprintf(buf1, sizeof(buf1), "%s.emacsVisual", app_name);
-               assert(sz >= 0 && sz < sizeof(buf1));
+               assert(sz >= 0 && (size_t)sz < sizeof(buf1));
                sz = snprintf(buf2, sizeof(buf2), "%s.EmacsVisual", app_class);
-               assert(sz >= 0 && sz < sizeof(buf2));
+               assert(sz >= 0 && (size_t)sz < sizeof(buf2));
 
                if (XrmGetResource(XtDatabase(dpy), buf1, buf2, &type, &value)
                    == True) {
@@ -782,10 +782,10 @@ static void x_init_device(struct device *d, Lisp_Object props)
                   PseudoColor, check to see if the user specified that we need
                   a private colormap */
                if (visual == DefaultVisual(dpy, screen)) {
-                       int sz = snprintf(buf1, sizeof(buf1), "%s.privateColormap", app_name);
-                       assert(sz >= 0 && sz < sizeof(buf1));
+                       sz = snprintf(buf1, sizeof(buf1), "%s.privateColormap", app_name);
+                       assert(sz >= 0 && (size_t)sz < sizeof(buf1));
                        sz = snprintf(buf2, sizeof(buf2), "%s.PrivateColormap", app_class);
-                       assert(sz >= 0 && sz < sizeof(buf2));
+                       assert(sz >= 0 && (size_t)sz < sizeof(buf2));
 
                        if ((visual->class == PseudoColor) &&
                            (XrmGetResource
@@ -1151,17 +1151,17 @@ int signal_if_x_error(Display * dpy, int resumable_p)
                return 0;
        data = Qnil;
        sz = snprintf(buf, sizeof(buf), "0x%X", (unsigned int)last_error.resourceid);
-       assert(sz >= 0 && sz < sizeof(buf));
+       assert(sz >= 0 && (size_t)sz < sizeof(buf));
        data = Fcons(build_string(buf), data);
        {
                char num[32];
                sz = snprintf(num, sizeof(num), "%d", last_error.request_code);
-               assert(sz >= 0 && sz < sizeof(num));
+               assert(sz >= 0 && (size_t)sz < sizeof(num));
                XGetErrorDatabaseText(last_error.display, "XRequest", num, "",
                                      buf, sizeof(buf));
                if (!*buf) {
                        sz = snprintf(buf, sizeof(buf), "Request-%d", last_error.request_code);
-                       assert(sz >=0 && sz < sizeof(buf));
+                       assert(sz >=0 && (size_t)sz < sizeof(buf));
                }
                data = Fcons(build_string(buf), data);
        }
index 3c67ada..dfcfa84 100644 (file)
@@ -229,7 +229,7 @@ static widget_value *dbox_descriptor_to_widget_value(Lisp_Object keys)
                              "%c%dBR%d", type, lbuttons + rbuttons,
                              rbuttons);
 
-               assert(sz >= 0 && sz < sizeof(tmp_dbox_name));
+               assert(sz >= 0 && (size_t)sz < sizeof(tmp_dbox_name));
                dbox = xmalloc_widget_value();
                dbox->name = xstrdup(tmp_dbox_name);
                dbox->contents = kids;
index 087c601..b4d8d51 100644 (file)
@@ -512,11 +512,14 @@ x_reset_modifier_mapping(struct device *d)
                KeySym last_sym = 0;
                KeyCode code = xd->x_modifier_keymap->modifiermap
                        [modifier_index * mkpm + modifier_key];
-               auto inline void modbarf() __attribute__((always_inline));
-               auto inline void modwarn() __attribute__((always_inline));
-               auto inline void store_modifier()
+               auto inline void modbarf(const char *name, const char *other) 
                        __attribute__((always_inline));
-               auto inline void check_modifier()
+               auto inline void modwarn(const char *name,
+                                        int old, const char *other) 
+                       __attribute__((always_inline));
+               auto inline void store_modifier(const char *name, int *old)
+                       __attribute__((always_inline));
+               auto inline void check_modifier(const char *name, int mask)
                        __attribute__((always_inline));
 
                auto inline void modbarf(const char *name, const char *other)
@@ -1100,7 +1103,7 @@ x_keysym_to_emacs_keysym(KeySym keysym, int simple_p)
                                int sz = snprintf(buf, sizeof(buf),
                                                  "unknown-keysym-0x%X", 
                                                  (int)keysym);
-                               assert(sz>=0 && sz < sizeof(buf));
+                               assert(sz>=0 && (size_t)sz < sizeof(buf));
                                return KEYSYM(buf);
                        }
                        }
@@ -2734,7 +2737,7 @@ static void describe_event(XEvent * event)
        int sz = snprintf(buf, sizeof(buf),
                          "%s%s", x_event_name(event->type),
                          event->xany.send_event ? " (send)" : "");
-       assert(sz >= 0 && sz < sizeof(buf));
+       assert(sz >= 0 && (size_t)sz < sizeof(buf));
        stderr_out("%-30s", buf);
        switch (event->type) {
        case FocusIn:
index 8367fe1..d709600 100644 (file)
@@ -473,7 +473,7 @@ static Lisp_Object color_to_string(Widget w, unsigned long pixel)
        color.pixel = pixel;
        XQueryColor(XtDisplay(w), w->core.colormap, &color);
        sz = snprintf(buf, sizeof(buf), "#%04x%04x%04x", color.red, color.green, color.blue);
-       assert(sz>=0 && sz < sizeof(buf));
+       assert(sz>=0 && (size_t)sz < sizeof(buf));
        return build_string(buf);
 }
 
@@ -711,7 +711,7 @@ x_set_initial_frame_size(struct frame *f, int flags, int x, int y,
        else if (ussize)
                sz = snprintf(shell_geom, sizeof(shell_geom),
                              "=%dx%d", w, h);
-       assert(sz >=0 && sz < sizeof(shell_geom));
+       assert(sz >=0 && (size_t)sz < sizeof(shell_geom));
        if (uspos || ussize) {
                temp = xnew_atomic_array(char, 1 + strlen(shell_geom));
                strcpy(temp, shell_geom);
@@ -2105,7 +2105,7 @@ a string.
        struct frame *f = decode_x_frame(frame);
 
        int sz = snprintf(str, sizeof(str), "%lu", XtWindow(FRAME_X_TEXT_WIDGET(f)));
-       assert(sz >= 0 && sz < sizeof(str));
+       assert(sz >= 0 && (size_t)sz < sizeof(str));
        return build_string(str);
 }
 \f
index 6888c8c..ba3b46b 100644 (file)
@@ -2224,6 +2224,10 @@ static int x_widget_border_width(void)
        return DEFAULT_WIDGET_BORDER_WIDTH * 2;
 }
 
+void
+x_subwindow_query_geometry(Lisp_Object image_instance,
+                           int *width, int *height);
+
 void
 x_subwindow_query_geometry(Lisp_Object image_instance,
                            int *width, int *height)
index af30648..6419630 100644 (file)
@@ -629,7 +629,7 @@ static Extbyte *truename_via_random_props(Display * dpy, XFontStruct * font)
                      "-%s-%s-%s-%s-%s-%s-%ld-%ld-%ld-%ld-%s-%ld-%s-%s",
                      foundry, family, weight, slant, setwidth, add_style, pixel,
                      point, res_x, res_y, spacing, avg_width, registry, encoding);
-       assert(sz>=0 && sz < sizeof(composed_name));
+       assert(sz>=0 && (size_t)sz < sizeof(composed_name));
        ok = 1;
 
       FAIL:
index c3f0ce9..0e06a97 100644 (file)
@@ -102,7 +102,7 @@ x_create_scrollbar_instance(struct frame *f, int vertical,
 
        SCROLLBAR_X_ID(instance) = new_lwlib_id();
        sz = snprintf(buffer, sizeof(buffer), "scrollbar_%d", SCROLLBAR_X_ID(instance));
-       assert(sz >= 0 && sz < sizeof(buffer));
+       assert(sz >= 0 && (size_t)sz < sizeof(buffer));
        SCROLLBAR_X_NAME(instance) = xstrdup(buffer);
 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) || \
     defined (LWLIB_SCROLLBARS_ATHENA3D)
index e3fc1e4..18f2153 100644 (file)
@@ -957,7 +957,8 @@ png_instantiate(Lisp_Object image_instance, Lisp_Object instantiator,
                     &interlace_type, NULL, NULL);
 
        {
-               int y, pass;
+               png_uint_32 y;
+               int pass;
                int passes = 0;
                png_bytep row_pointers[height];
 
@@ -1211,7 +1212,7 @@ static void tiff_error_func(const char *module, const char *fmt, ...)
        va_start(vargs, fmt);
 
        n = vsnprintf(tiff_err_data.err_str, sizeof(tiff_err_data.err_str), fmt, vargs);
-       assert(n>=0 && n <  sizeof(tiff_err_data.err_str));
+       assert(n>=0 && (size_t)n <  sizeof(tiff_err_data.err_str));
 
        va_end(vargs);
        /* return to setjmp point */
@@ -1227,7 +1228,7 @@ static void tiff_warning_func(const char *module, const char *fmt, ...)
        va_start(vargs, fmt);
 
        n = vsnprintf(warn_str, sizeof(warn_str), fmt, vargs);
-       assert(n>=0 && n < sizeof(warn_str));
+       assert(n>=0 && (size_t)n < sizeof(warn_str));
        va_end(vargs);
        warn_when_safe(Qtiff, Qinfo, "%s - %s", module, warn_str);
 }
index 0f32f5a..acdae40 100644 (file)
@@ -395,7 +395,7 @@ make_dialog(const char *name, Widget parent, Boolean pop_up_p,
                XtSetArg(av[ac], XtNresizable, True);
                ac++;
                sz = snprintf(button_name, sizeof(button_name), "button%d", ++bc);
-               assert(sz >= 0 && sz < sizeof(button_name));
+               assert(sz >= 0 && (size_t)sz < sizeof(button_name));
                button = XtCreateManagedWidget(button_name, commandWidgetClass,
                                               dialog, av, ac);
        }
@@ -454,7 +454,7 @@ make_dialog(const char *name, Widget parent, Boolean pop_up_p,
                XtSetArg(av[ac], XtNresizable, True);
                ac++;
                sz = snprintf(button_name, sizeof(button_name), "button%d", ++bc);
-               assert(sz >= 0 && sz < sizeof(button_name));
+               assert(sz >= 0 && (size_t)sz < sizeof(button_name));
                button = XtCreateManagedWidget(button_name, commandWidgetClass,
                                               dialog, av, ac);
        }
index b6478b4..c308e9e 100644 (file)
@@ -459,7 +459,7 @@ static void GaugeExpose(Widget w, XEvent * event, Region region)
                                             "%d",
                                             v0 + i * (v1 - v0) / 
                                                  (gw->gauge.nlabels - 1));
-                               assert(n >= 0 &&  n < sizeof(label));
+                               assert(n >= 0 &&  (size_t)n < sizeof(label));
                        }
                        else
                                s = gw->gauge.labels[i];
@@ -899,7 +899,7 @@ static void MaxLabel(GaugeWidget gw, Dimension * wid,       /* max label width */
                        if (gw->gauge.labels == NULL)   { /* numeric labels */
                                int sz = snprintf(lbl = lstr, sizeof(lstr), 
                                                  "%d", v0 + i * dv / n);
-                               assert(sz >= 0 && sz < sizeof(lstr));
+                               assert(sz >= 0 && (size_t)sz < sizeof(lstr));
                        } else
                                lbl = gw->gauge.labels[i];
 
index b25921f..7b067d7 100644 (file)
@@ -581,7 +581,8 @@ static char *parameterize_string(const char *string, const char *value)
                off_t offset = percent-string;
 
                if (percent[1] == '%') {        /* it's a real % */
-                       assert( res_left >= (1 + offset) );
+                       assert( offset >=0 && 
+                               res_left >= (size_t)(1 + offset));
                                                /* incl % */
                        strncat(result, string, 1 + offset);
                        res_left -= 1 + offset;
@@ -598,7 +599,8 @@ static char *parameterize_string(const char *string, const char *value)
                        } else if (*p == '-') { /* right pad */
                                right_pad++;
                        } else if (*p == '1') { /* param and terminator */
-                               assert( res_left >= offset );
+                               assert( offset >= 0 && 
+                                       res_left >= (size_t)offset );
                                res_left -= offset;
                                strncat(result, string, offset);
                                if (value[0] != '\0') {
@@ -615,9 +617,11 @@ static char *parameterize_string(const char *string, const char *value)
                                break;  /* out of for() loop */
                        } else {        /* bogus, copy the format as is */
                                /* out of for() loop */
-                               assert( res_left >= (1+ p - string) );
-                               strncat(result, string, 1 + p - string);
-                               res_left -= 1 + p - string;
+                               off_t remain = 1 + p - string;
+                               assert( remain >=0 && 
+                                       res_left >= (size_t)remain );
+                               strncat(result, string, remain);
+                               res_left -= remain;
                                string = (*p ? &p[1] : p);
                                offset = percent - string;
                                break;
index 8a34596..18abf45 100644 (file)
@@ -1236,7 +1236,7 @@ void XawTabsSetTop(Widget w, Bool callCallbacks)
                int n = snprintf(line, sizeof(line),
                        "XawTabsSetTop: widget \"%.64s\" is not the child of a tabs widget.",
                        XtName(w));
-               assert(n >= 0 && n < sizeof(line));
+               assert(n >= 0 && (size_t)n < sizeof(line));
                XtAppWarning(XtWidgetToApplicationContext(w), line);
                return;
        }
index 12da833..0abf104 100644 (file)
@@ -6669,7 +6669,7 @@ static void decode_mode_spec(struct window *w, Emchar spec, int type)
                        const size_t order_strmax = sizeof(f->order_count)*3+2;
                        char *writable_str = alloca_array(char, order_strmax);
                        int n = snprintf(writable_str, order_strmax, "-%d", f->order_count);
-                       assert(n>=0 && n < order_strmax);
+                       assert(n>=0 && (size_t)n < order_strmax);
                        str = writable_str;
                }
 #endif                         /* HAVE_TTY */
@@ -6760,7 +6760,7 @@ static void decode_mode_spec(struct window *w, Emchar spec, int type)
                                percent = 99;
 
                        n = snprintf(buf, sizeof(buf), "%d%%", percent);
-                       assert(n>=0 && n < sizeof(buf));
+                       assert(n>=0 && (size_t)n < sizeof(buf));
                        Dynarr_add_many(mode_spec_bufbyte_string,
                                        (Bufbyte *) buf, strlen(buf));
 
@@ -6809,7 +6809,7 @@ static void decode_mode_spec(struct window *w, Emchar spec, int type)
                                n = snprintf(buf, sizeof(buf), "Top%d%%", percent);
                        else
                                n = snprintf(buf, sizeof(buf), "%d%%", percent);
-                       assert(n>=0 && n < sizeof(buf));
+                       assert(n>=0 && (size_t)n < sizeof(buf));
                        Dynarr_add_many(mode_spec_bufbyte_string,
                                        (Bufbyte *) buf, strlen(buf));