{
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);
#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);
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
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].
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].
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);
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);
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;
}
#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;
}
}
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;
}
/* 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;
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");
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");
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));
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) ? ')' : ']');
"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",
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",
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; \
{
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);
}
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 */
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) {
#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);
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 {
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 {
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;
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;
}
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) ) {
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);
}
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),
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);
}
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);
}
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) {
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
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);
}
"%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;
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)
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);
}
}
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:
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);
}
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);
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
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)
"-%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:
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)
&interlace_type, NULL, NULL);
{
- int y, pass;
+ png_uint_32 y;
+ int pass;
int passes = 0;
png_bytep row_pointers[height];
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 */
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);
}
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);
}
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);
}
"%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];
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];
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;
} 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') {
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;
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;
}
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 */
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));
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));