From cc1fe058b013a81014bbd519930628d499bd80e8 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 16 Jan 2022 11:50:14 -0800 Subject: [PATCH] lefty: use C99 bool constants to set 'Gnocallbacks' --- cmd/lefty/common.c | 28 ++++++++++++++-------------- cmd/lefty/g.c | 5 +++-- cmd/lefty/ws/mswin32/gcommon.c | 15 ++++++++------- cmd/lefty/ws/mswin32/gtext.c | 9 +++++---- 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/cmd/lefty/common.c b/cmd/lefty/common.c index 8a89b4b19..da03f2bc2 100644 --- a/cmd/lefty/common.c +++ b/cmd/lefty/common.c @@ -354,11 +354,11 @@ void warning (char *file, int line, char *func, char *fmt, ...) { return; va_start(args, fmt); - Gnocallbacks = TRUE; + Gnocallbacks = true; fprintf (stderr, "warning: (file %s, line %d, func %s) ", file, line, func); vfprintf (stderr, fmt, args); fprintf (stderr, "\n"); - Gnocallbacks = FALSE; + Gnocallbacks = false; va_end(args); #else char buf[256]; @@ -368,9 +368,9 @@ void warning (char *file, int line, char *func, char *fmt, ...) { va_start(args, fmt); vsprintf (buf, fmt, args); - Gnocallbacks = TRUE; + Gnocallbacks = true; MessageBox ((HWND) NULL, buf, "Lefty Warning", MB_APPLMODAL); - Gnocallbacks = FALSE; + Gnocallbacks = false; va_end(args); #endif } @@ -381,21 +381,21 @@ void panic1 (char *file, int line, char *func, char *fmt, ...) { #ifndef FEATURE_MS va_start(args, fmt); - Gnocallbacks = TRUE; + Gnocallbacks = true; fprintf (stderr, "panic: (file %s, line %d, func %s) ", file, line, func); vfprintf (stderr, fmt, args); fprintf (stderr, "\n"); fflush (stdout); - Gnocallbacks = FALSE; + Gnocallbacks = false; va_end(args); #else char buf[256]; va_start(args, fmt); vsprintf (buf, fmt, args); - Gnocallbacks = TRUE; + Gnocallbacks = true; MessageBox ((HWND) NULL, buf, "Lefty PANIC", MB_APPLMODAL); - Gnocallbacks = FALSE; + Gnocallbacks = false; va_end(args); #endif abort (); @@ -409,22 +409,22 @@ void panic2 (char *file, int line, char *func, char *fmt, ...) { #ifndef FEATURE_MS va_start(args, fmt); - Gnocallbacks = TRUE; + Gnocallbacks = true; fprintf (stderr, "panic: (file %s, line %d, func %s) ", file, line, func); vfprintf (stderr, fmt, args); fprintf (stderr, "\n"); perror (""); fflush (stdout); - Gnocallbacks = FALSE; + Gnocallbacks = false; va_end(args); #else char buf[256]; va_start(args, fmt); vsprintf (buf, fmt, args); - Gnocallbacks = TRUE; + Gnocallbacks = true; MessageBox ((HWND) NULL, buf, "Lefty PANIC", MB_APPLMODAL); - Gnocallbacks = FALSE; + Gnocallbacks = false; va_end(args); #endif abort (); @@ -442,9 +442,9 @@ int gprintf (const char *fmt, ...) { if (buf[l - 1] == '\n') buf[l - 1] = 0; if (buf[0]) { - Gnocallbacks = TRUE; + Gnocallbacks = true; MessageBox ((HWND) NULL, buf, "Lefty printf", MB_APPLMODAL); - Gnocallbacks = FALSE; + Gnocallbacks = false; } va_end(args); } diff --git a/cmd/lefty/g.c b/cmd/lefty/g.c index 85986b926..d029dd044 100644 --- a/cmd/lefty/g.c +++ b/cmd/lefty/g.c @@ -14,6 +14,7 @@ #include "g.h" #include "gcommon.h" #include "mem.h" +#include #include Gwidget_t *Gwidgets; @@ -847,9 +848,9 @@ void Gerr (char *file, int line, int errnum, ...) { va_start(args, errnum); vsprintf (buf, errmsg[errnum], args); - Gnocallbacks = TRUE; + Gnocallbacks = true; MessageBox ((HWND) NULL, buf, "Lefty Warning", MB_APPLMODAL); - Gnocallbacks = FALSE; + Gnocallbacks = false; va_end(args); #endif #endif diff --git a/cmd/lefty/ws/mswin32/gcommon.c b/cmd/lefty/ws/mswin32/gcommon.c index 4881a75ce..bfbde0845 100644 --- a/cmd/lefty/ws/mswin32/gcommon.c +++ b/cmd/lefty/ws/mswin32/gcommon.c @@ -10,6 +10,7 @@ /* Lefteris Koutsofios - AT&T Labs Research */ +#include #include "common.h" #include "g.h" #include "gcommon.h" @@ -148,7 +149,7 @@ int Ginitgraphics (void) { else Gfontp[0].font = NULL; ReleaseDC ((HWND) NULL, hdc); - Gnocallbacks = FALSE; + Gnocallbacks = false; return 0; } @@ -614,18 +615,18 @@ static void handleresize (Gwidget_t *widget) { case G_VIEWWIDGET: Gadjustwrect (parent, &ps1); if (ps1.x != ps2.x || ps1.y != ps2.y) { - Gnocallbacks = TRUE; + Gnocallbacks = true; SetWindowPos (widget->w, (HWND) NULL, 0, 0, ps1.x, ps1.y, wflags1); - Gnocallbacks = FALSE; + Gnocallbacks = false; } break; case G_ARRAYWIDGET: - Gnocallbacks = TRUE; + Gnocallbacks = true; Gawresize (parent); - Gnocallbacks = FALSE; + Gnocallbacks = false; break; case G_SCROLLWIDGET: - Gnocallbacks = TRUE; + Gnocallbacks = true; for (i = 0; i < 2; i++) { Gadjustwrect (parent, &ps1); if (ps1.x > ps2.x || ps1.y > ps2.y) @@ -649,7 +650,7 @@ static void handleresize (Gwidget_t *widget) { SetWindowPos (widget->w, (HWND) NULL, -po.x, -po.y, 0, 0, wflags2); ps2 = ps1; } - Gnocallbacks = FALSE; + Gnocallbacks = false; break; } diff --git a/cmd/lefty/ws/mswin32/gtext.c b/cmd/lefty/ws/mswin32/gtext.c index aee54b692..7a96b3294 100644 --- a/cmd/lefty/ws/mswin32/gtext.c +++ b/cmd/lefty/ws/mswin32/gtext.c @@ -10,6 +10,7 @@ /* Lefteris Koutsofios - AT&T Labs Research */ +#include #include "common.h" #include "g.h" #include "gcommon.h" @@ -108,21 +109,21 @@ int GTsetwidgetattr (Gwidget_t *widget, int attrn, Gwattr_t *attrp) { Gerr (POS, G_ERRCANNOTSETATTR2, "borderwidth"); return -1; case G_ATTRTEXT: - Gnocallbacks = TRUE; + Gnocallbacks = true; SendMessage (widget->w, WM_SETTEXT, 0, ""); SendMessage (widget->w, EM_SETSEL, -1, 32760); SendMessage (widget->w, EM_REPLACESEL, 0, (LPARAM) attrp[ai].u.t); SendMessage (widget->w, EM_SETSEL, -1, 32760); - Gnocallbacks = FALSE; + Gnocallbacks = false; break; case G_ATTRAPPENDTEXT: - Gnocallbacks = TRUE; + Gnocallbacks = true; SendMessage (widget->w, EM_SETSEL, -1, 32760); SendMessage (widget->w, EM_REPLACESEL, 0, (LPARAM) attrp[ai].u.t); SendMessage (widget->w, EM_SETSEL, -1, 32760); SendMessage (widget->w, EM_REPLACESEL, 0, (LPARAM) "\r\n"); SendMessage (widget->w, EM_SETSEL, -1, 32760); - Gnocallbacks = FALSE; + Gnocallbacks = false; break; case G_ATTRMODE: if ( -- 2.40.0