diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2024-02-28 20:46:24 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2024-02-28 20:48:49 -0500 |
commit | f181d10b934c85a30f27de6aa0b71c94e68d2293 (patch) | |
tree | 277ae3215c330a67df5f7e957a48cf2e3b236bfd | |
parent | 785ba6f4ee7677f395252daf9c1de30fb80a179d (diff) |
reduce compiler-warnings using casts
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
-rw-r--r-- | src/AsciiSink.c | 4 | ||||
-rw-r--r-- | src/AsciiSrc.c | 4 | ||||
-rw-r--r-- | src/Form.c | 4 | ||||
-rw-r--r-- | src/Pixmap.c | 20 | ||||
-rw-r--r-- | src/Text.c | 2 | ||||
-rw-r--r-- | src/TextAction.c | 24 | ||||
-rw-r--r-- | src/TextSrc.c | 2 |
7 files changed, 30 insertions, 30 deletions
diff --git a/src/AsciiSink.c b/src/AsciiSink.c index 5851ae0..5756563 100644 --- a/src/AsciiSink.c +++ b/src/AsciiSink.c @@ -1467,14 +1467,14 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx, XawTextBlock blk; int i, rWidth; - pos = XawTextSourceRead(source, fromPos, &blk, toPos - fromPos); + pos = XawTextSourceRead(source, fromPos, &blk, (int)(toPos - fromPos)); rWidth = 0; for (i = 0, idx = fromPos; idx < toPos; i++, idx++) { unsigned char c; if (i >= blk.length) { i = 0; - pos = XawTextSourceRead(source, pos, &blk, toPos - pos); + pos = XawTextSourceRead(source, pos, &blk, (int)(toPos - pos)); if (blk.length == 0) break; } diff --git a/src/AsciiSrc.c b/src/AsciiSrc.c index f1a68a5..21683f9 100644 --- a/src/AsciiSrc.c +++ b/src/AsciiSrc.c @@ -396,7 +396,7 @@ ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length) text->format = XawFmt8Bit; if (length == 0) { text->firstPos = (int)(end = (offset + entity->length)); - text->ptr = ""; + text->ptr = (char*)""; } else { text->firstPos = (int)pos; @@ -1454,7 +1454,7 @@ InitStringOrFile(AsciiSrcObject src, Bool newString) case XawtextAppend: case XawtextEdit: if (src->ascii_src.string == NULL) { - src->ascii_src.string = "*ascii-src*"; + src->ascii_src.string = (char*)"*ascii-src*"; src->ascii_src.is_tempfile = True; } else { @@ -780,8 +780,8 @@ XawFormResize(Widget w) fw->form.old_height, XtHeight(fw), form->form.bottom) - (y + (XtBorderWidth(*childP) << 1)); - form->form.virtual_width = width; - form->form.virtual_height = height; + form->form.virtual_width = (short)width; + form->form.virtual_height = (short)height; #endif width = width < 1 ? 1 : width; diff --git a/src/Pixmap.c b/src/Pixmap.c index 9a3a765..b076cfb 100644 --- a/src/Pixmap.c +++ b/src/Pixmap.c @@ -664,7 +664,7 @@ GetResourcePixmapPath(Display *display) XrmRepresentation rep_type; XrmValue value; static char *default_path = - "%H/%T/%N:%P/include/X11/%T/%N:/usr/X11R6/include/X11/%T/%N:/usr/include/X11/%T/%N:%N"; + (char*)"%H/%T/%N:%P/include/X11/%T/%N:/usr/X11R6/include/X11/%T/%N:/usr/include/X11/%T/%N:%N"; xrm_name[0] = XrmPermStringToQuark("pixmapFilePath"); xrm_name[1] = NULLQUARK; @@ -715,8 +715,8 @@ BitmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, static SubstitutionRec sub[] = { {'H', NULL}, {'N', NULL}, - {'T', "bitmaps"}, - {'P', PROJECT_ROOT}, + {'T', (_XtString) "bitmaps"}, + {'P', (_XtString) PROJECT_ROOT}, }; char *filename; @@ -746,7 +746,7 @@ BitmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, { if (!sub[0].substitution) sub[0].substitution = getenv("HOME"); - sub[1].substitution = params->name; + sub[1].substitution = (_XtString)params->name; if (pixmap_path == NULL) GetResourcePixmapPath(DisplayOfScreen(screen)); filename = XtFindFile(pixmap_path, sub, XtNumber(sub), NULL); @@ -754,7 +754,7 @@ BitmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, return (FALSE); } else - filename = params->name; + filename = (char*)params->name; if (XReadBitmapFileData(filename, &width, &height, &data, &hotX, &hotY) == BitmapSuccess) @@ -828,7 +828,7 @@ GradientLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, value = NULL; if ((argval = XawFindArgVal(params, "start")) != NULL) - value = argval->value; + value = (char*)argval->value; if (value && !XAllocNamedColor(DisplayOfScreen(screen), colormap, value, &start, &color)) return (False); @@ -839,7 +839,7 @@ GradientLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, } value = NULL; if ((argval = XawFindArgVal(params, "end")) != NULL) - value = argval->value; + value = (char*)argval->value; if (value && !XAllocNamedColor(DisplayOfScreen(screen), colormap, value, &end, &color)) return (False); @@ -936,8 +936,8 @@ XPixmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth _X static SubstitutionRec sub[] = { {'H', NULL}, {'N', NULL}, - {'T', "pixmaps"}, - {'P', PROJECT_ROOT}, + {'T', (_XtString) "pixmaps"}, + {'P', (_XtString) PROJECT_ROOT}, }; const char *filename; @@ -949,7 +949,7 @@ XPixmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth _X { if (!sub[0].substitution) sub[0].substitution = getenv("HOME"); - sub[1].substitution = params->name; + sub[1].substitution = (_XtString)params->name; if (pixmap_path == NULL) GetResourcePixmapPath(DisplayOfScreen(screen)); filename = XtFindFile(pixmap_path, sub, XtNumber(sub), NULL); @@ -1385,7 +1385,7 @@ _BuildLineTable(TextWidget ctx, XawTextPosition position, int line) if (lt->textWidth != (Cardinal)width) { if (lt->textWidth > (Cardinal)width) ctx->text.clear_to_eol = True; - lt->textWidth = (unsigned)width; + lt->textWidth = (Dimension)width; } y = (Position)(y + height); diff --git a/src/TextAction.c b/src/TextAction.c index 88febd8..c3c70f6 100644 --- a/src/TextAction.c +++ b/src/TextAction.c @@ -421,7 +421,7 @@ _SelectionReceived(Widget w, XtPointer client_data, Atom *selection _X_UNUSED, fprintf(stderr, "Xaw Text Widget: An attempt was made to insert " "an illegal selection.\n"); - textprop.value = (const unsigned char *)" >> ILLEGAL SELECTION << "; + textprop.value = (unsigned char *)" >> ILLEGAL SELECTION << "; textprop.nitems = strlen((char *) textprop.value); if (XwcTextPropertyToTextList(d, &textprop, &wlist, &count) != Success @@ -1334,7 +1334,7 @@ _DeleteOrKill(TextWidget ctx, XawTextPosition from, XawTextPosition to, text.firstPos = 0; text.format = (unsigned long)_XawTextFormat(ctx); - text.ptr = ""; + text.ptr = (char*)""; if (_XawTextReplace(ctx, from, to, &text)) { XBell(XtDisplay(ctx), 50); @@ -1604,7 +1604,7 @@ StripSpaces(TextWidget ctx, XawTextPosition left, XawTextPosition right, text.firstPos = 0; text.format = XawFmt8Bit; - text.ptr = " "; + text.ptr = (char*)" "; text.length = 1; position = XawTextSourceRead(ctx->text.source, position, @@ -1641,7 +1641,7 @@ StripSpaces(TextWidget ctx, XawTextPosition left, XawTextPosition right, done = True; } - text.ptr = ""; + text.ptr = (char*)""; text.length = 0; position = tmp = left; position = XawTextSourceRead(ctx->text.source, position, @@ -1721,7 +1721,7 @@ Tabify(TextWidget ctx, XawTextPosition left, XawTextPosition right, int tab_index = 0, tab_column = 0, TAB_SIZE = DEFAULT_TAB_SIZE; text.firstPos = 0; - text.ptr = "\t"; + text.ptr = (char*)"\t"; text.format = XawFmt8Bit; text.length = 1; @@ -1863,7 +1863,7 @@ Untabify(TextWidget ctx, XawTextPosition left, XawTextPosition right, short *char_tabs = sink->text_sink.char_tabs; int tab_count = sink->text_sink.tab_count; int tab_index = 0, tab_column = 0, tab_base = 0; - static char *tabs = " "; + static char *tabs = (char*)" "; text.firstPos = 0; text.format = XawFmt8Bit; @@ -2186,7 +2186,7 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool force, int level, position = tmp; if (position > left && position - left > ctx->text.left_column && position != right) { - text.ptr = "\n"; + text.ptr = (char*)"\n"; text.length = 1; CHECK_SAVE(); if (_XawTextReplace(ctx, position, position + 1, &text)) @@ -2336,7 +2336,7 @@ Indent(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _ text.firstPos = 0; text.format = XawFmt8Bit; - text.ptr = ""; + text.ptr = (char*)""; StartAction(ctx, event); @@ -3027,7 +3027,7 @@ AutoFill(TextWidget ctx) return; text.format = XawFmt8Bit; - text.ptr = "\n"; + text.ptr = (char*)"\n"; } text.length = 1; text.firstPos = 0; @@ -3377,7 +3377,7 @@ DisplayCaret(Widget w, XEvent *event, String *params, Cardinal *num_params) if (*num_params > 0) { /* default arg is "True" */ XrmValue from, to; - from.size = (unsigned)strlen(from.addr = params[0]); + from.size = (unsigned)strlen(from.addr = (char*)params[0]); XtConvert(w, XtRString, &from, XtRBoolean, &to); if (to.addr != NULL) @@ -3538,7 +3538,7 @@ StripOutOldCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to, text.firstPos = 0; text.format = (unsigned long)_XawTextFormat(ctx); if (text.format == XawFmt8Bit) - text.ptr= " "; + text.ptr= (char*)" "; else { wc_two_spaces[0] = _Xaw_atowc(XawSP); wc_two_spaces[1] = _Xaw_atowc(XawSP); @@ -3646,7 +3646,7 @@ InsertNewCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to, text.format = (unsigned long)_XawTextFormat(ctx); if (text.format == XawFmt8Bit) - text.ptr = "\n"; + text.ptr = (char*)"\n"; else { wide_CR[0] = _Xaw_atowc(XawLF); wide_CR[1] = 0; diff --git a/src/TextSrc.c b/src/TextSrc.c index 97cbd30..7b44717 100644 --- a/src/TextSrc.c +++ b/src/TextSrc.c @@ -241,7 +241,7 @@ WidgetClass textSrcObjectClass = (WidgetClass)&textSrcClassRec; static XrmQuark QRead, QAppend, QEdit; #ifndef OLDXAW -static char *SrcNL = "\n"; +static char *SrcNL = (char*)"\n"; static wchar_t SrcWNL[2]; #endif |