ctype tweaks

None of these explains the Windows assertion failure.
 end.c - post-3.6.0
 options.c - in #else block of #if win32
 winmenu.c - X11
This commit is contained in:
PatR
2016-05-28 17:18:51 -07:00
parent bbe02dca2b
commit a102ee9a1a
3 changed files with 9 additions and 11 deletions

View File

@@ -1678,7 +1678,7 @@ boolean ask;
pfx = !strncmpi(buf, "the ", 3) ? 0 pfx = !strncmpi(buf, "the ", 3) ? 0
: !strncmpi(buf, "an ", 3) ? 1 : !strncmpi(buf, "an ", 3) ? 1
: !strncmpi(buf, "a ", 2) ? 2 : !strncmpi(buf, "a ", 2) ? 2
: !isdigit(buf[2]) ? 4 : 0; : !digit(buf[2]) ? 4 : 0;
if (class_header) if (class_header)
++pfx; ++pfx;
Sprintf(buftoo, "%*s%s", pfx, "", buf); Sprintf(buftoo, "%*s%s", pfx, "", buf);

View File

@@ -2207,12 +2207,13 @@ boolean tinitial, tfrom_file;
bad_negation(fullname, TRUE); bad_negation(fullname, TRUE);
return; return;
} }
#ifdef CHANGE_COLOR #ifdef CHANGE_COLOR
if (match_optname(opts, "palette", 3, TRUE) if (match_optname(opts, "palette", 3, TRUE)
#ifdef MAC #ifdef MAC
|| match_optname(opts, "hicolor", 3, TRUE) || match_optname(opts, "hicolor", 3, TRUE)
#endif #endif
) { ) {
int color_number, color_incr; int color_number, color_incr;
#ifndef WIN32 #ifndef WIN32
@@ -2227,17 +2228,16 @@ boolean tinitial, tfrom_file;
} }
color_number = CLR_MAX + 4; /* HARDCODED inverse number */ color_number = CLR_MAX + 4; /* HARDCODED inverse number */
color_incr = -1; color_incr = -1;
} else { } else
#endif #endif
{
if (negated) { if (negated) {
bad_negation("palette", FALSE); bad_negation("palette", FALSE);
return; return;
} }
color_number = 0; color_number = 0;
color_incr = 1; color_incr = 1;
#ifdef MAC
} }
#endif
#ifdef WIN32 #ifdef WIN32
op = string_for_opt(opts, TRUE); op = string_for_opt(opts, TRUE);
if (!alternative_palette(op)) if (!alternative_palette(op))
@@ -2264,8 +2264,8 @@ boolean tinitial, tfrom_file;
#else #else
rgb <<= 8; rgb <<= 8;
#endif #endif
tmp = *(pt++); tmp = *pt++;
if (isalpha(tmp)) { if (isalpha((uchar) tmp)) {
tmp = (tmp + 9) & 0xf; /* Assumes ASCII... */ tmp = (tmp + 9) & 0xf; /* Assumes ASCII... */
} else { } else {
tmp &= 0xf; /* Digits in ASCII too... */ tmp &= 0xf; /* Digits in ASCII too... */
@@ -2277,9 +2277,8 @@ boolean tinitial, tfrom_file;
rgb += tmp; rgb += tmp;
} }
} }
if (*pt == '/') { if (*pt == '/')
pt++; pt++;
}
change_color(color_number, rgb, reverse); change_color(color_number, rgb, reverse);
color_number += color_incr; color_number += color_incr;
} }

View File

@@ -38,7 +38,6 @@
#include "hack.h" #include "hack.h"
#include "winX.h" #include "winX.h"
#include <ctype.h>
static void FDECL(menu_select, (Widget, XtPointer, XtPointer)); static void FDECL(menu_select, (Widget, XtPointer, XtPointer));
static void FDECL(invert_line, (struct xwindow *, x11_menu_item *, int, long)); static void FDECL(invert_line, (struct xwindow *, x11_menu_item *, int, long));
@@ -251,7 +250,7 @@ Cardinal *num_params;
select_none(wp); select_none(wp);
} else if (ch == '\n' || ch == '\r') { } else if (ch == '\n' || ch == '\r') {
; /* accept */ ; /* accept */
} else if (isdigit(ch)) { } else if (digit(ch)) {
/* special case: '0' is also the default ball class */ /* special case: '0' is also the default ball class */
if (ch == '0' && !menu_info->counting if (ch == '0' && !menu_info->counting
&& index(menu_info->curr_menu.gacc, ch)) && index(menu_info->curr_menu.gacc, ch))