diff options
Diffstat (limited to 'lib/libXaw/src')
46 files changed, 1852 insertions, 1746 deletions
diff --git a/lib/libXaw/src/Actions.c b/lib/libXaw/src/Actions.c index cec9bdd5e..eceb1f92e 100644 --- a/lib/libXaw/src/Actions.c +++ b/lib/libXaw/src/Actions.c @@ -110,8 +110,8 @@ static Bool prim(XawEvalInfo*); /* resources */ static String XawConvertActionRes(XawActionResList*, Widget w, String); -static String _XawEscapeActionVarValue(String); -static String _XawUnescapeActionVarValue(String); +static char * _XawEscapeActionVarValue(String); +static char * _XawUnescapeActionVarValue(String); static XawActionResList *_XawCreateActionResList(WidgetClass); static XawActionResList *_XawFindActionResList(WidgetClass); static void _XawBindActionResList(XawActionResList*); @@ -151,7 +151,7 @@ static Cardinal num_variable_list; Bool XawParseBoolean(Widget w, String param, XEvent *event, Bool *succed) { - char *tmp = param; + char *tmp = (char *)param; int value; if (!param) @@ -206,7 +206,7 @@ XawBooleanExpression(Widget w, String param, XEvent *event) info.parse_proc = XawParseBoolean; info.event = event; - info.cp = info.lp = param; + info.cp = info.lp = (char *)param; #ifdef DIAGNOSTIC fprintf(stderr, "(*) Parsing expression \"%s\"\n", param); @@ -423,7 +423,7 @@ XawSetValuesAction(Widget w, XEvent *event, vlist = XawGetActionVarList(w); num_args = 0; - arglist = (Arg *)XtMalloc(sizeof(Arg) * ((*num_params) >> 1)); + arglist = (Arg *)XtMalloc((Cardinal)sizeof(Arg) * ((*num_params) >> 1)); for (count = 1; count < *num_params; count += 2) { @@ -437,8 +437,8 @@ XawSetValuesAction(Widget w, XEvent *event, continue; } value = XawConvertActionVar(vlist, params[count + 1]); - from.size = strlen(value) + 1; - from.addr = value; + from.size = (Cardinal) strlen(value) + 1; + from.addr = (char *)value; to.size = resource->size; switch (to.size) { @@ -646,13 +646,15 @@ XawPrintActionErrorMsg(String action_name, Widget w, char msg[1024]; unsigned int size, idx; - size = snprintf(msg, sizeof(msg), "%s(): bad number of parameters.\n\t(", - action_name); + size = (unsigned)snprintf(msg, + sizeof(msg), + "%s(): bad number of parameters.\n\t(", + action_name); idx = 0; while (idx < *num_params - 1 && size < sizeof(msg)) - size += snprintf(&msg[size], sizeof(msg) - size, "%s, ", - params[idx++]); + size += (unsigned)snprintf(&msg[size], sizeof(msg) - size, "%s, ", + params[idx++]); if (*num_params) snprintf(&msg[size], sizeof(msg) - size, "%s)", params[idx]); else @@ -677,8 +679,8 @@ static int qcmp_action_resource_list(register _Xconst void *left, register _Xconst void *right) { - return ((char *)((*(XawActionResList **)left)->widget_class) - - (char *)((*(XawActionResList **)right)->widget_class)); + return (int)((char *)((*(XawActionResList **)left)->widget_class) - + (char *)((*(XawActionResList **)right)->widget_class)); } static XawActionResList * @@ -686,7 +688,7 @@ _XawCreateActionResList(WidgetClass wc) { XawActionResList *list; - list = (XawActionResList *)XtMalloc(sizeof(XawActionResList)); + list = (XawActionResList *)XtMalloc((Cardinal)sizeof(XawActionResList)); list->widget_class = wc; list->num_common_resources = list->num_constraint_resources = 0; list->resources = NULL; @@ -694,14 +696,14 @@ _XawCreateActionResList(WidgetClass wc) if (!resource_list) { num_resource_list = 1; - resource_list = (XawActionResList **)XtMalloc(sizeof(XawActionResList*)); + resource_list = (XawActionResList **)XtMalloc((Cardinal)sizeof(XawActionResList*)); resource_list[0] = list; } else { ++num_resource_list; resource_list = (XawActionResList **)XtRealloc((char *)resource_list, - sizeof(XawActionResList*) + (Cardinal) sizeof(XawActionResList*) * num_resource_list); resource_list[num_resource_list - 1] = list; qsort(resource_list, num_resource_list, sizeof(XawActionResList*), @@ -717,7 +719,8 @@ static int bcmp_action_resource_list(register _Xconst void *wc, register _Xconst void *list) { - return ((char *)wc - (char *)((*(XawActionResList **)list)->widget_class)); + return (int)((char *)wc + - (char *)((*(XawActionResList **)list)->widget_class)); } static XawActionResList * @@ -761,7 +764,7 @@ _XawBindActionResList(XawActionResList *list) list->num_constraint_resources = num_cons; list->resources = (XawActionRes **) - XtMalloc(sizeof(XawActionRes*) * (num_xt + num_cons)); + XtMalloc((Cardinal)sizeof(XawActionRes*) * (num_xt + num_cons)); #ifdef DIAGNOSTIC fprintf(stderr, "Common resources\n---\n"); @@ -769,7 +772,7 @@ _XawBindActionResList(XawActionResList *list) for (i = 0; i < num_xt; i++) { - list->resources[i] = (XawActionRes *)XtMalloc(sizeof(XawActionRes)); + list->resources[i] = (XawActionRes *)XtMalloc((Cardinal)sizeof(XawActionRes)); list->resources[i]->qname = XrmPermStringToQuark(xt_list[i].resource_name); list->resources[i]->qtype = @@ -790,7 +793,7 @@ _XawBindActionResList(XawActionResList *list) for (; i < num_xt + num_cons; i++) { - list->resources[i] = (XawActionRes *)XtMalloc(sizeof(XawActionRes)); + list->resources[i] = (XawActionRes *)XtMalloc((Cardinal)sizeof(XawActionRes)); list->resources[i]->qname = XrmPermStringToQuark(cons_list[i - num_xt].resource_name); list->resources[i]->qtype = @@ -859,14 +862,14 @@ _XawFindActionRes(XawActionResList *list, Widget detail, String name) * Start of Variables Implementation Code */ /* For speed, only does memory allocation when really required */ -static String +static char * _XawEscapeActionVarValue(String value) { - String escape; + char * escape; if (value[0] == '$' || value[0] == '\\') { - escape = XtMalloc(strlen(value) + 2); + escape = XtMalloc((Cardinal)strlen(value) + 2); escape[0] = '\\'; strcpy(escape + 1, value); return (escape); @@ -875,14 +878,14 @@ _XawEscapeActionVarValue(String value) } /* For speed, only does memory allocation when really required */ -static String +static char * _XawUnescapeActionVarValue(String value) { - String unescape; + char * unescape; if (value[0] == '\\') { - unescape = XtMalloc(strlen(value)); + unescape = XtMalloc((Cardinal)strlen(value)); strcpy(unescape, value + 1); return (unescape); } @@ -893,7 +896,7 @@ static void XawDeclareActionVar(XawActionVarList *list, String name, String value) { XawActionVar *variable; - String escape = NULL; + char * escape = NULL; if (name[0] != XAW_PRIV_VAR_PREFIX) { @@ -932,7 +935,7 @@ static String XawConvertActionVar(XawActionVarList *list, String name) { XawActionVar *variable; - String unescape; + char * unescape; XrmQuark quark; if (name[0] != XAW_PRIV_VAR_PREFIX) @@ -969,8 +972,8 @@ static int qcmp_action_variable_list(register _Xconst void *left, register _Xconst void *right) { - return ((char *)((*(XawActionVarList **)left)->widget) - - (char *)((*(XawActionVarList **)right)->widget)); + return (int)((char *)((*(XawActionVarList **)left)->widget) - + (char *)((*(XawActionVarList **)right)->widget)); } static XawActionVarList * @@ -983,7 +986,7 @@ _XawCreateActionVarList(Widget w) XtName(w), w); #endif - list = (XawActionVarList *)XtMalloc(sizeof(XawActionVarList)); + list = (XawActionVarList *)XtMalloc((Cardinal)sizeof(XawActionVarList)); list->widget = w; list->num_variables = 0; list->variables = NULL; @@ -991,7 +994,7 @@ _XawCreateActionVarList(Widget w) if (!variable_list) { num_variable_list = 1; - variable_list = (XawActionVarList **)XtMalloc(sizeof(XawActionVarList*)); + variable_list = (XawActionVarList **)XtMalloc((Cardinal)sizeof(XawActionVarList*)); variable_list[0] = list; } else @@ -999,7 +1002,7 @@ _XawCreateActionVarList(Widget w) ++num_variable_list; variable_list = (XawActionVarList **) XtRealloc((char *)variable_list, - sizeof(XawActionVarList *) * num_variable_list); + (Cardinal)sizeof(XawActionVarList *) * num_variable_list); variable_list[num_variable_list - 1] = list; qsort(variable_list, num_variable_list, sizeof(XawActionVarList*), qcmp_action_variable_list); @@ -1015,7 +1018,8 @@ static int bcmp_action_variable_list(register _Xconst void *widget, register _Xconst void *list) { - return ((char *)widget - (char *)((*(XawActionVarList **)list)->widget)); + return (int)((char *)widget + - (char *)((*(XawActionVarList **)list)->widget)); } static XawActionVarList * @@ -1051,21 +1055,21 @@ _XawCreateActionVar(XawActionVarList *list, String name) name, XtName(list->widget), list->widget); #endif - variable = (XawActionVar *)XtMalloc(sizeof(XawActionVar)); + variable = (XawActionVar *)XtMalloc((Cardinal)sizeof(XawActionVar)); variable->qname = XrmStringToQuark(name); variable->qvalue = NULLQUARK; if (!list->variables) { list->num_variables = 1; - list->variables = (XawActionVar **)XtMalloc(sizeof(XawActionVar*)); + list->variables = (XawActionVar **)XtMalloc((Cardinal)sizeof(XawActionVar*)); list->variables[0] = variable; } else { ++list->num_variables; list->variables = (XawActionVar **)XtRealloc((char *)list->variables, - sizeof(XawActionVar *) * + (Cardinal) sizeof(XawActionVar *) * list->num_variables); list->variables[list->num_variables - 1] = variable; qsort(list->variables, list->num_variables, sizeof(XawActionVar*), @@ -1098,7 +1102,7 @@ _XawFindActionVar(XawActionVarList *list, String name) /*ARGSUSED*/ static void -_XawDestroyActionVarList(Widget w, XtPointer client_data, XtPointer call_data) +_XawDestroyActionVarList(Widget w, XtPointer client_data, XtPointer call_data _X_UNUSED) { XawActionVarList *list = (XawActionVarList *)client_data; Cardinal i; @@ -1117,7 +1121,7 @@ _XawDestroyActionVarList(Widget w, XtPointer client_data, XtPointer call_data) memmove(&variable_list[i], &variable_list[i + 1], (num_variable_list - i) * sizeof(XawActionVarList *)); variable_list = (XawActionVarList **) - XtRealloc((char *)variable_list, sizeof(XawActionVarList *) * + XtRealloc((char *)variable_list, (Cardinal) sizeof(XawActionVarList *) * num_variable_list); } else diff --git a/lib/libXaw/src/AllWidgets.c b/lib/libXaw/src/AllWidgets.c index 3b1343877..8a7490f73 100644 --- a/lib/libXaw/src/AllWidgets.c +++ b/lib/libXaw/src/AllWidgets.c @@ -60,50 +60,52 @@ in this Software without prior written authorization from The Open Group. #include <X11/Xaw/Tree.h> #include <X11/Xaw/Viewport.h> +#define DATA(name,class) { (char *)name, class } XmuWidgetNode XawWidgetArray[] = { -{ "applicationShell", &applicationShellWidgetClass }, -{ "asciiSink", &asciiSinkObjectClass }, -{ "asciiSrc", &asciiSrcObjectClass }, -{ "asciiText", &asciiTextWidgetClass }, -{ "box", &boxWidgetClass }, -{ "command", &commandWidgetClass }, -{ "composite", &compositeWidgetClass }, -{ "constraint", &constraintWidgetClass }, -{ "core", &coreWidgetClass }, -{ "dialog", &dialogWidgetClass }, -{ "form", &formWidgetClass }, -{ "grip", &gripWidgetClass }, -{ "label", &labelWidgetClass }, -{ "list", &listWidgetClass }, -{ "menuButton", &menuButtonWidgetClass }, -{ "multiSink", &multiSinkObjectClass }, -{ "multiSrc", &multiSrcObjectClass }, -{ "object", &objectClass }, -{ "overrideShell", &overrideShellWidgetClass }, -{ "paned", &panedWidgetClass }, -{ "panner", &pannerWidgetClass }, -{ "porthole", &portholeWidgetClass }, -{ "rect", &rectObjClass }, -{ "repeater", &repeaterWidgetClass }, -{ "scrollbar", &scrollbarWidgetClass }, -{ "shell", &shellWidgetClass }, -{ "simpleMenu", &simpleMenuWidgetClass }, -{ "simple", &simpleWidgetClass }, -{ "smeBSB", &smeBSBObjectClass }, -{ "smeLine", &smeLineObjectClass }, -{ "sme", &smeObjectClass }, -{ "stripChart", &stripChartWidgetClass }, -{ "textSink", &textSinkObjectClass }, -{ "textSrc", &textSrcObjectClass }, -{ "text", &textWidgetClass }, -{ "toggle", &toggleWidgetClass }, -{ "topLevelShell", &topLevelShellWidgetClass }, -{ "transientShell", &transientShellWidgetClass }, -{ "tree", &treeWidgetClass }, -{ "vendorShell", &vendorShellWidgetClass }, -{ "viewport", &viewportWidgetClass }, -{ "wmShell", &wmShellWidgetClass }, +DATA( "applicationShell", &applicationShellWidgetClass ), +DATA( "asciiSink", &asciiSinkObjectClass ), +DATA( "asciiSrc", &asciiSrcObjectClass ), +DATA( "asciiText", &asciiTextWidgetClass ), +DATA( "box", &boxWidgetClass ), +DATA( "command", &commandWidgetClass ), +DATA( "composite", &compositeWidgetClass ), +DATA( "constraint", &constraintWidgetClass ), +DATA( "core", &coreWidgetClass ), +DATA( "dialog", &dialogWidgetClass ), +DATA( "form", &formWidgetClass ), +DATA( "grip", &gripWidgetClass ), +DATA( "label", &labelWidgetClass ), +DATA( "list", &listWidgetClass ), +DATA( "menuButton", &menuButtonWidgetClass ), +DATA( "multiSink", &multiSinkObjectClass ), +DATA( "multiSrc", &multiSrcObjectClass ), +DATA( "object", &objectClass ), +DATA( "overrideShell", &overrideShellWidgetClass ), +DATA( "paned", &panedWidgetClass ), +DATA( "panner", &pannerWidgetClass ), +DATA( "porthole", &portholeWidgetClass ), +DATA( "rect", &rectObjClass ), +DATA( "repeater", &repeaterWidgetClass ), +DATA( "scrollbar", &scrollbarWidgetClass ), +DATA( "shell", &shellWidgetClass ), +DATA( "simpleMenu", &simpleMenuWidgetClass ), +DATA( "simple", &simpleWidgetClass ), +DATA( "smeBSB", &smeBSBObjectClass ), +DATA( "smeLine", &smeLineObjectClass ), +DATA( "sme", &smeObjectClass ), +DATA( "stripChart", &stripChartWidgetClass ), +DATA( "textSink", &textSinkObjectClass ), +DATA( "textSrc", &textSrcObjectClass ), +DATA( "text", &textWidgetClass ), +DATA( "toggle", &toggleWidgetClass ), +DATA( "topLevelShell", &topLevelShellWidgetClass ), +DATA( "transientShell", &transientShellWidgetClass ), +DATA( "tree", &treeWidgetClass ), +DATA( "vendorShell", &vendorShellWidgetClass ), +DATA( "viewport", &viewportWidgetClass ), +DATA( "wmShell", &wmShellWidgetClass ), }; +#undef DATA int XawWidgetCount = XtNumber(XawWidgetArray); diff --git a/lib/libXaw/src/AsciiSink.c b/lib/libXaw/src/AsciiSink.c index d77689518..af715f00b 100644 --- a/lib/libXaw/src/AsciiSink.c +++ b/lib/libXaw/src/AsciiSink.c @@ -118,7 +118,7 @@ static XtResource resources[] = { sizeof(XFontStruct*), offset(font), XtRString, - XtDefaultFont + (XtPointer)XtDefaultFont }, { XtNecho, @@ -207,7 +207,7 @@ WidgetClass asciiSinkObjectClass = (WidgetClass)&asciiSinkClassRec; * Implementation */ static void -XawAsciiSinkClassPartInitialize(WidgetClass wc) +XawAsciiSinkClassPartInitialize(WidgetClass wc _X_UNUSED) { #ifndef OLDXAW AsciiSinkObjectClass cclass = (AsciiSinkObjectClass)wc; @@ -302,7 +302,7 @@ GetTextWidth(TextWidget ctx, int current_width, XFontStruct *font, while (length > 0) { pos = XawTextSourceRead(ctx->text.source, from, &block, length); - length -= pos - from; + length = (int)(length - (pos - from)); from = pos; for (i = 0; i < block.length; i++) width += CharWidth((AsciiSinkObject)ctx->text.sink, font, @@ -364,7 +364,7 @@ void CalculateBearing(TextWidget ctx, XawTextPosition position, int x, int y, c = ' '; else if ((c & 0177) < XawSP || c == 0177) { if (sink->ascii_sink.display_nonprinting) - c = c > 0177 ? (c & 7) + '0' : c + '@'; + c = (unsigned char)(c > 0177 ? (c & 7) + '0' : c + '@'); else c = ' '; } @@ -382,10 +382,10 @@ void CalculateBearing(TextWidget ctx, XawTextPosition position, int x, int y, paint->max_ascent = ascent; paint->max_descent = descent; paint->backtabs = NULL; - paint->highlight = highlight; + paint->highlight = (Boolean)highlight; paint->length = 1; paint->text = XtMalloc(1); - paint->text[0] = c; + paint->text[0] = (char)c; } } } @@ -400,7 +400,7 @@ void CalculateBearing(TextWidget ctx, XawTextPosition position, int x, int y, c = ' '; else if ((c & 0177) < XawSP || c == 0177) { if (sink->ascii_sink.display_nonprinting) - c = c > 0177 ? '\\' : c + '^'; + c = (unsigned char)(c > 0177 ? '\\' : c + '^'); else c = ' '; } @@ -418,10 +418,10 @@ void CalculateBearing(TextWidget ctx, XawTextPosition position, int x, int y, paint->max_ascent = ascent; paint->max_descent = descent; paint->backtabs = NULL; - paint->highlight = highlight; + paint->highlight = (Boolean)highlight; paint->length = 1; paint->text = XtMalloc(1); - paint->text[0] = c; + paint->text[0] = (char)c; } } } @@ -470,7 +470,7 @@ AsciiPreparePaint(Widget w, int y, int line, tmp = pos; pos = anchor->position + entity->offset + entity->length; if ((length = XawMin(from, pos) - tmp) > 0) - x += GetTextWidth(ctx, x, font, tmp, length); + x += GetTextWidth(ctx, x, font, tmp, (int)length); ascent = XawMax(font->ascent, ascent); descent = XawMax(font->descent, descent); } @@ -484,7 +484,7 @@ AsciiPreparePaint(Widget w, int y, int line, else { if ((length = XawMin(from, pos) - tmp) > 0) { x += GetTextWidth(ctx, x, sink->ascii_sink.font, tmp, - length); + (int)length); tmp += length; } if (pos < right) { @@ -496,7 +496,7 @@ AsciiPreparePaint(Widget w, int y, int line, else font = sink->ascii_sink.font; if ((length = XawMin(from, pos) - tmp) > 0) - x += GetTextWidth(ctx, x, font, tmp, length); + x += GetTextWidth(ctx, x, font, tmp, (int)length); ascent = XawMax(font->ascent, ascent); descent = XawMax(font->descent, descent); } @@ -507,14 +507,14 @@ AsciiPreparePaint(Widget w, int y, int line, if (anchor->entities == NULL) { tmp = XawMin(pos, from); if ((length = from - tmp) > 0) - x += GetTextWidth(ctx, x, sink->ascii_sink.font, tmp, length); + x += GetTextWidth(ctx, x, sink->ascii_sink.font, tmp, (int)length); break; } } else { tmp = XawMin(pos, from); if ((length = from - tmp) > 0) - x += GetTextWidth(ctx, x, sink->ascii_sink.font, tmp, length); + x += GetTextWidth(ctx, x, sink->ascii_sink.font, tmp, (int)length); ascent = XawMax(sink->ascii_sink.font->ascent, ascent); descent = XawMax(sink->ascii_sink.font->descent, descent); break; @@ -539,7 +539,7 @@ AsciiPreparePaint(Widget w, int y, int line, paint->max_ascent = ascent; paint->max_descent = descent; paint->backtabs = NULL; - paint->highlight = highlight; + paint->highlight = (Boolean)highlight; tmp = pos; if (XawTextSourceAnchorAndEntity(ctx->text.source, pos, @@ -568,27 +568,27 @@ AsciiPreparePaint(Widget w, int y, int line, pos = XawMin(pos, to); length = pos - tmp; - paint->text = XtMalloc(bufsiz = pos - tmp + 4); + paint->text = XtMalloc((Cardinal)(bufsiz = (int)(pos - tmp + 4))); paint->length = 0; segment.x1 = x; pos2 = tmp; while (length > 0) { - pos2 = XawTextSourceRead(ctx->text.source, tmp, &block, length); + pos2 = XawTextSourceRead(ctx->text.source, tmp, &block, (int)length); length = pos - pos2; tmp = pos2; for (i = 0; i < block.length; i++) { unsigned char c = (unsigned char)block.ptr[i]; - if (paint->length + 4 > bufsiz) - paint->text = XtRealloc(paint->text, bufsiz += 32); - paint->text[paint->length] = c; + if ((paint->length + 4) > (unsigned)bufsiz) + paint->text = XtRealloc(paint->text, (Cardinal)(bufsiz += 32)); + paint->text[paint->length] = (char)c; if (c == '\n') { x += CharWidth(sink, font, 0, ' '); continue; } if (c == '\t') { - x += XTextWidth(font, paint->text, paint->length); + x += XTextWidth(font, paint->text, (int)paint->length); segment.x2 = x + CharWidth(sink, font, x, '\t'); if (XmuValidSegment(&segment)) { @@ -642,9 +642,9 @@ AsciiPreparePaint(Widget w, int y, int line, paint->max_ascent = ascent; paint->max_descent = descent; paint->backtabs = NULL; - paint->highlight = highlight; - paint->text = XtMalloc(bufsiz = pos - tmp - length + - block.length - i + 4); + paint->highlight = (Boolean)highlight; + paint->text = XtMalloc((Cardinal)(bufsiz = (int)(pos - tmp - length + + block.length - i + 4))); paint->length = 0; continue; } @@ -652,14 +652,14 @@ AsciiPreparePaint(Widget w, int y, int line, if (sink->ascii_sink.display_nonprinting) { if (c > 0177) { paint->text[paint->length++] = '\\'; - paint->text[paint->length++] = ((c >> 6) & 7) + '0'; - paint->text[paint->length++] = ((c >> 3) & 7) + '0'; - paint->text[paint->length] = (c & 7) + '0'; + paint->text[paint->length++] = (char)(((c >> 6) & 7) + '0'); + paint->text[paint->length++] = (char)(((c >> 3) & 7) + '0'); + paint->text[paint->length] = (char)((c & 7) + '0'); } else { c |= 0100; paint->text[paint->length++] = '^'; - paint->text[paint->length] = c == 0177 ? '?' : c; + paint->text[paint->length] = (char)(c == 0177 ? '?' : c); } } else @@ -669,7 +669,7 @@ AsciiPreparePaint(Widget w, int y, int line, } } - x += XTextWidth(font, paint->text, paint->length); + x += XTextWidth(font, paint->text, (int)paint->length); segment.x2 = x; if (XmuValidSegment(&segment)) { /* erase only what really is needed */ @@ -724,8 +724,8 @@ AsciiPreparePaint(Widget w, int y, int line, static int qcmp_paint_struct(_Xconst void *left, _Xconst void *right) { - return ((*(XawTextPaintStruct**)left)->property - - (*(XawTextPaintStruct**)right)->property); + return (int)((*(XawTextPaintStruct* _Xconst *)left)->property - + (*(XawTextPaintStruct* _Xconst *)right)->property); } static void @@ -759,8 +759,8 @@ AsciiDoPaint(Widget w) for (seg = scan->segment; seg; seg = seg->next) _XawTextSinkClearToBackground(ctx->text.sink, seg->x1, scan->y, - seg->x2 - seg->x1, - scan->next->y - scan->y); + (unsigned)(seg->x2 - seg->x1), + (unsigned)(scan->next->y - scan->y)); /* pass 2: optimize drawing list to avoid too much GC change requests */ /* XXX this assumes there will not exist entities drawn over other @@ -791,13 +791,13 @@ AsciiDoPaint(Widget w) ++n_paints; } paints = (XawTextPaintStruct**) - XtMalloc(n_paints * sizeof(XawTextPaintStruct)); + XtMalloc((Cardinal)((size_t)n_paints * sizeof(XawTextPaintStruct))); paint = list->paint; while (paint) { paints[i++] = paint; paint = paint->next; } - qsort((void*)paints, n_paints, sizeof(XawTextPaintStruct*), + qsort((void*)paints, (size_t)n_paints, sizeof(XawTextPaintStruct*), qcmp_paint_struct); list->paint = paints[0]; for (i = 0; i < n_paints - 1; i++) @@ -813,8 +813,8 @@ AsciiDoPaint(Widget w) rect.y = ctx->text.r_margin.top; width = (int)XtWidth(ctx) - RHMargins(ctx); height = (int)XtHeight(ctx) - RVMargins(ctx); - rect.width = width; - rect.height = height; + rect.width = (unsigned short)width; + rect.height = (unsigned short)height; if (width >= 0 && height >= 0) XSetClipRectangles(XtDisplay((Widget)ctx), gc, 0, 0, &rect, 1, Unsorted); @@ -842,12 +842,12 @@ AsciiDoPaint(Widget w) } if (i_rects <= n_rects) rects = (XRectangle*) - XtRealloc((XtPointer)rects, sizeof(XRectangle) * - ++n_rects); - rects[i_rects].x = paint->x; - rects[i_rects].y = paint->y - font->ascent; - rects[i_rects].width = paint->width; - rects[i_rects++].height = font->ascent + font->descent; + XtRealloc((XtPointer)rects, (Cardinal)(sizeof(XRectangle) * + (size_t)++n_rects)); + rects[i_rects].x = (short)paint->x; + rects[i_rects].y = (short)(paint->y - font->ascent); + rects[i_rects].width = (unsigned short)paint->width; + rects[i_rects++].height = (unsigned short)(font->ascent + font->descent); if (paint->backtabs) { for (scan = paint->backtabs->scanline; scan && scan->next; @@ -855,12 +855,12 @@ AsciiDoPaint(Widget w) for (seg = scan->segment; seg; seg = seg->next) { if (i_rects <= n_rects) rects = (XRectangle*) - XtRealloc((XtPointer)rects, sizeof(XRectangle) * - ++n_rects); - rects[i_rects].x = seg->x1; - rects[i_rects].y = scan->y; - rects[i_rects].width = seg->x2 - seg->x1; - rects[i_rects++].height = scan->next->y - scan->y; + XtRealloc((XtPointer)rects, (Cardinal)(sizeof(XRectangle) * + (size_t)++n_rects)); + rects[i_rects].x = (short)seg->x1; + rects[i_rects].y = (short)scan->y; + rects[i_rects].width = (unsigned short)(seg->x2 - seg->x1); + rects[i_rects++].height = (unsigned short)(scan->next->y - scan->y); } } @@ -879,12 +879,12 @@ AsciiDoPaint(Widget w) XSetForeground(XtDisplay(ctx), gc, sink->text_sink.cursor_color); if (i_rects <= n_rects) rects = (XRectangle*) - XtRealloc((XtPointer)rects, sizeof(XRectangle) * - ++n_rects); - rects[i_rects].x = paint->x; - rects[i_rects].y = paint->y - paint->max_ascent; - rects[i_rects].width = paint->width; - rects[i_rects++].height = paint->max_ascent + paint->max_descent + 1; + XtRealloc((XtPointer)rects, (Cardinal)(sizeof(XRectangle) * + (size_t)++n_rects)); + rects[i_rects].x = (short)paint->x; + rects[i_rects].y = (short)(paint->y - paint->max_ascent); + rects[i_rects].width = (unsigned short)paint->width; + rects[i_rects++].height = (unsigned short)(paint->max_ascent + paint->max_descent + 1); } paint = paint->next; } @@ -897,12 +897,12 @@ AsciiDoPaint(Widget w) sink->text_sink.cursor_color); if (i_rects <= n_rects) rects = (XRectangle*) - XtRealloc((XtPointer)rects, sizeof(XRectangle) * - ++n_rects); - rects[i_rects].x = seg->x1; - rects[i_rects].y = scan->y; - rects[i_rects].width = seg->x2 - seg->x1; - rects[i_rects++].height = scan->next->y - scan->y; + XtRealloc((XtPointer)rects, (Cardinal)(sizeof(XRectangle) * + (size_t)++n_rects)); + rects[i_rects].x = (short)seg->x1; + rects[i_rects].y = (short)scan->y; + rects[i_rects].width = (unsigned short)(seg->x2 - seg->x1); + rects[i_rects++].height = (unsigned short)(scan->next->y - scan->y); } } @@ -946,7 +946,7 @@ AsciiDoPaint(Widget w) if (paint->x < XtWidth(ctx) && paint->x + paint->width > 0) { XDrawString(XtDisplay(ctx), XtWindow(ctx), gc, paint->x, paint->y, - paint->text, paint->length); + paint->text, (int)paint->length); if (property) { if (property->mask & XAW_TPROP_UNDERLINE) { if (line_width != property->underline_thickness) { @@ -982,7 +982,7 @@ AsciiDoPaint(Widget w) /* dont care on order of drawing or caching of state (by now) */ paint = list->bearings; while (paint) { - XRectangle rect; + XRectangle rect2; if (paint->highlight) XSetForeground(XtDisplay(ctx), gc, sink->text_sink.background); @@ -999,14 +999,14 @@ AsciiDoPaint(Widget w) XSetForeground(XtDisplay(ctx), gc, paint->property->foreground); } if (paint->x < XtWidth(ctx) && paint->x + paint->width > 0) { - rect.x = paint->x + paint->width; - rect.width = XawAbs(paint->width); /* more than enough */ - rect.y = paint->y - font->ascent; - rect.height = rect.y + font->ascent + font->descent; + rect2.x = (short)(paint->x + paint->width); + rect2.width = (XawAbs(paint->width)); /* more than enough */ + rect2.y = (short)(paint->y - font->ascent); + rect2.height = (unsigned short)(rect2.y + font->ascent + font->descent); XSetClipRectangles(XtDisplay((Widget)ctx), gc, - 0, 0, &rect, 1, Unsorted); + 0, 0, &rect2, 1, Unsorted); XDrawString(XtDisplay(ctx), XtWindow(ctx), gc, paint->x, paint->y, - paint->text, paint->length); + paint->text, (int)paint->length); } paint = paint->next; } @@ -1040,18 +1040,19 @@ PaintText(Widget w, GC gc, int x, int y, char *buf, int len, Bool clear_bg) int width = XTextWidth(sink->ascii_sink.font, buf, len); if ((x > XtWidth(ctx)) || width <= -x) /* Don't draw if we can't see it */ - return (width); + return (unsigned)(width); if (clear_bg) { _XawTextSinkClearToBackground(w, x, y - sink->ascii_sink.font->ascent, - width, sink->ascii_sink.font->ascent - + sink->ascii_sink.font->descent); + (unsigned)width, + (unsigned)(sink->ascii_sink.font->ascent + + sink->ascii_sink.font->descent)); XDrawString(XtDisplay(ctx), XtWindow(ctx), gc, x, y, buf, len); } else XDrawImageString(XtDisplay(ctx), XtWindow(ctx), gc, x, y, buf, len); - return (width); + return (unsigned)(width); } static void @@ -1085,15 +1086,15 @@ DisplayText(Widget w, int x, int y, y += sink->ascii_sink.font->ascent; for (j = 0; pos1 < pos2;) { - pos1 = XawTextSourceRead(source, pos1, &blk, pos2 - pos1); + pos1 = XawTextSourceRead(source, pos1, &blk, (int)(pos2 - pos1)); for (k = 0; k < blk.length; k++) { - if (j >= sizeof(buf) - 4) { /* buffer full, dump the text */ - if ((x += PaintText(w, gc, x, y, (char*)buf, j, clear_bg)) + if ((unsigned)j >= sizeof(buf) - 4) { /* buffer full, dump the text */ + if ((x = (int)((unsigned)x + PaintText(w, gc, x, y, (char*)buf, j, clear_bg))) >= max_x) return; j = 0; } - buf[j] = blk.ptr[k]; + buf[j] = (unsigned char)blk.ptr[k]; if (buf[j] == XawLF) /* line feeds ('\n') are not printed */ continue; @@ -1101,18 +1102,18 @@ DisplayText(Widget w, int x, int y, int width; if (j != 0 - && (x += PaintText(w, gc, x, y, (char*)buf, j, clear_bg)) + && (x = (int)((unsigned)x + PaintText(w, gc, x, y, (char*)buf, j, clear_bg))) >= max_x) return; if ((width = CharWidth(sink, font, x, '\t')) > -x) { if (clear_bg) - _XawTextSinkClearToBackground(w, x, y-font->ascent, width, - font->ascent+font->descent); + _XawTextSinkClearToBackground(w, x, y-font->ascent, (unsigned)width, + (unsigned)(font->ascent+font->descent)); else XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w), - tabgc, x, y - font->ascent, width, - font->ascent + font->descent); + tabgc, x, y - font->ascent, (unsigned)width, + (unsigned)(font->ascent + font->descent)); } if ((x += width) >= max_x) @@ -1126,9 +1127,9 @@ DisplayText(Widget w, int x, int y, if (c > 0177) { buf[j++] = '\\'; - buf[j++] = ((c >> 6) & 7) + '0'; - buf[j++] = ((c >> 3) & 7) + '0'; - buf[j] = (c & 7) + '0'; + buf[j++] = (unsigned char)(((c >> 6) & 7) + '0'); + buf[j++] = (unsigned char)(((c >> 3) & 7) + '0'); + buf[j] = (unsigned char)((c & 7) + '0'); } else { c |= 0100; @@ -1196,14 +1197,14 @@ GetCursorBounds(Widget w, XRectangle *rect) ch = ' '; #endif - rect->width = CharWidth(sink, font, 0, ch); - rect->height = font->descent + font->ascent + 1; + rect->width = (unsigned short)(CharWidth(sink, font, 0, ch)); + rect->height = (unsigned short)(font->descent + font->ascent + 1); rect->x = sink->ascii_sink.cursor_x; - rect->y = sink->ascii_sink.cursor_y - font->ascent; + rect->y = (short)(sink->ascii_sink.cursor_y - font->ascent); } -/* this function is required to support diferent fonts and correctly place +/* this function is required to support different fonts and correctly place * the cursor. There are better ways to calculate the base line, but there is * no place/code (yet) to store this information. */ @@ -1280,7 +1281,7 @@ InsertCursor(Widget w, int x, int y, XawTextInsertState state) XFontStruct *font = sink->ascii_sink.font; TextWidget ctx = (TextWidget)XtParent(w); XawTextPosition position = XawTextGetInsertionPoint((Widget)ctx); - Boolean overflow = (x & 0xffff8000) != 0; + Boolean overflow = ((unsigned)x & 0xffff8000) != 0; #ifndef OLDXAW XawTextAnchor *anchor; XawTextEntity *entity; @@ -1305,19 +1306,19 @@ InsertCursor(Widget w, int x, int y, XawTextInsertState state) if (ctx->text.hasfocus) XFillRectangle(XtDisplay(ctx), XtWindow(ctx), sink->ascii_sink.xorgc, x, y, - width + 1, fheight + 1); + (unsigned)(width + 1), (unsigned)(fheight + 1)); else XDrawRectangle(XtDisplay(ctx), XtWindow(ctx), sink->ascii_sink.xorgc, x, y, - width, fheight); + (unsigned)width, (unsigned)fheight); } else _XawTextSinkClearToBackground(w, x, y, - width + 1, fheight + 1); + (unsigned)(width + 1), (unsigned)(fheight + 1)); } - sink->ascii_sink.cursor_x = x; - sink->ascii_sink.cursor_y = y; + sink->ascii_sink.cursor_x = (short)x; + sink->ascii_sink.cursor_y = (short)y; sink->ascii_sink.laststate = state; return; } @@ -1359,16 +1360,18 @@ InsertCursor(Widget w, int x, int y, XawTextInsertState state) if (ctx->text.hasfocus && !has_selection) XFillRectangle(XtDisplay(ctx), XtWindow(ctx), sink->ascii_sink.xorgc, x, y - font->ascent, - CharWidth(sink, font, 0, ch), fheight + 1); + (unsigned)CharWidth(sink, font, 0, ch), + (unsigned)(fheight + 1)); else XDrawRectangle(XtDisplay(ctx), XtWindow(ctx), sink->ascii_sink.xorgc, x, y - font->ascent, - CharWidth(sink, font, 0, ch) - 1, fheight); + (unsigned)(CharWidth(sink, font, 0, ch) - 1), + (unsigned)fheight); } } - sink->ascii_sink.cursor_x = overflow ? -16384 : x; - sink->ascii_sink.cursor_y = y; + sink->ascii_sink.cursor_x = (short)(overflow ? -16384 : x); + sink->ascii_sink.cursor_y = (short)y; sink->ascii_sink.laststate = state; sink->ascii_sink.cursor_position = position; } @@ -1402,8 +1405,8 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx, while (!done) { if (XawTextSourceAnchorAndEntity(source, pos, &anchor, &entity)) { - length = anchor->position + entity->offset + entity->length; - length = XawMin(toPos, length) - pos; + length = (Cardinal)(anchor->position + entity->offset + entity->length); + length = (XawMin(toPos, length) - pos); if ((property = XawTextSinkGetProperty((Widget)sink, entity->property)) != NULL && (property->mask & XAW_TPROP_FONT)) @@ -1416,21 +1419,21 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx, while (entity && anchor->position + entity->offset < pos) entity = entity->next; if (entity) { - length = anchor->position + entity->offset; - length = XawMin(toPos, length) - pos; + length = (Cardinal)(anchor->position + entity->offset); + length = (XawMin(toPos, length) - pos); } else - length = XawMin(toPos - pos, 4096); + length = (XawMin(toPos - pos, 4096)); } else - length = XawMin(toPos - pos, 4096); + length = (XawMin(toPos - pos, 4096)); font = sink->ascii_sink.font; } ascent = XawMax(font->ascent, ascent); descent = XawMax(font->descent, descent); - pos = XawTextSourceRead(source, pos, &blk, length); + pos = XawTextSourceRead(source, pos, &blk, (int)length); if (blk.length == 0 && pos == idx) /* eof reached */ break; @@ -1438,7 +1441,7 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx, for (i = 0; idx < toPos; i++, idx++) { if (i >= blk.length) break; - c = blk.ptr[i]; + c = (unsigned char)blk.ptr[i]; rWidth += CharWidth(sink, font, fromx + rWidth, c); if (c == XawLF) { idx++; @@ -1472,7 +1475,7 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx, if (blk.length == 0) break; } - c = blk.ptr[i]; + c = (unsigned char)blk.ptr[i]; rWidth += CharWidth(sink, font, fromx + rWidth, c); if (c == XawLF) { idx++; @@ -1515,7 +1518,7 @@ FindPosition(Widget w, XawTextPosition fromPos, int fromx, int width, while (!done) { font = sink->ascii_sink.font; if (XawTextSourceAnchorAndEntity(source, pos, &anchor, &entity)) { - length = anchor->position + entity->offset + entity->length - pos; + length = (Cardinal)(anchor->position + entity->offset + entity->length - pos); if ((property = XawTextSinkGetProperty((Widget)sink, entity->property)) != NULL && (property->mask & XAW_TPROP_FONT)) @@ -1526,7 +1529,7 @@ FindPosition(Widget w, XawTextPosition fromPos, int fromx, int width, while (entity && anchor->position + entity->offset < pos) entity = entity->next; if (entity) - length = anchor->position + entity->offset - pos; + length = (Cardinal)(anchor->position + entity->offset - pos); else length = 4096; } @@ -1537,13 +1540,13 @@ FindPosition(Widget w, XawTextPosition fromPos, int fromx, int width, ascent = XawMax(font->ascent, ascent); descent = XawMax(font->descent, descent); - pos = XawTextSourceRead(source, pos, &blk, length); + pos = XawTextSourceRead(source, pos, &blk, (int)length); if (blk.length == 0 && pos == idx) /* eof reached */ break; idx = blk.firstPos; for (i = 0; rWidth <= width && i < blk.length; i++, idx++) { - c = blk.ptr[i]; + c = (unsigned char)blk.ptr[i]; lastWidth = rWidth; rWidth += CharWidth(sink, font, fromx + rWidth, c); @@ -1600,7 +1603,7 @@ FindPosition(Widget w, XawTextPosition fromPos, int fromx, int width, if (blk.length == 0) break; } - c = blk.ptr[i]; + c = (unsigned char)blk.ptr[i]; lastWidth = rWidth; rWidth += CharWidth(sink, font, fromx + rWidth, c); @@ -1653,7 +1656,7 @@ GetGC(AsciiSinkObject sink) XGCValues values; /* XXX We dont want do share a gc that will change the clip-mask */ - values.clip_x_origin = (long)sink; + values.clip_x_origin = (int)(long)sink; values.clip_mask = None; values.font = sink->ascii_sink.font->fid; values.graphics_exposures = False; @@ -1699,15 +1702,15 @@ GetGC(AsciiSinkObject sink) */ /*ARGSUSED*/ static void -XawAsciiSinkInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawAsciiSinkInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { AsciiSinkObject sink = (AsciiSinkObject)cnew; - GetGC(sink); - if (!sink->ascii_sink.font) XtError("Aborting: no font found\n"); + GetGC(sink); + sink->ascii_sink.cursor_position = 0; sink->ascii_sink.laststate = XawisOff; sink->ascii_sink.cursor_x = sink->ascii_sink.cursor_y = 0; @@ -1752,8 +1755,8 @@ XawAsciiSinkResize(Widget w) rect.y = ctx->text.r_margin.top; width = (int)XtWidth(ctx) - RHMargins(ctx); height = (int)XtHeight(ctx) - RVMargins(ctx); - rect.width = width; - rect.height = height; + rect.width = (unsigned short)width; + rect.height = (unsigned short)height; if (sink->ascii_sink.normgc) { if (width >= 0 && height >= 0) @@ -1795,8 +1798,8 @@ XawAsciiSinkResize(Widget w) */ /*ARGSUSED*/ static Boolean -XawAsciiSinkSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawAsciiSinkSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { AsciiSinkObject w = (AsciiSinkObject)cnew; AsciiSinkObject old_w = (AsciiSinkObject)current; @@ -1919,20 +1922,20 @@ SetTabs(Widget w, int tab_count, short *tabs) || figure_width == 0)) { if (font->per_char && font->min_char_or_byte2 <= '$' && font->max_char_or_byte2 >= '$') - figure_width = font->per_char['$' - font->min_char_or_byte2].width; + figure_width = (unsigned long)font->per_char['$' - font->min_char_or_byte2].width; else - figure_width = font->max_bounds.width; + figure_width = (unsigned long)font->max_bounds.width; } if (tab_count > sink->text_sink.tab_count) { sink->text_sink.tabs = (Position *) - XtRealloc((char*)sink->text_sink.tabs, tab_count * sizeof(Position)); + XtRealloc((char*)sink->text_sink.tabs, (Cardinal)((size_t)tab_count * sizeof(Position))); sink->text_sink.char_tabs = (short *) - XtRealloc((char*)sink->text_sink.char_tabs, tab_count * sizeof(short)); + XtRealloc((char*)sink->text_sink.char_tabs, (Cardinal)((size_t)tab_count * sizeof(short))); } for (i = 0 ; i < tab_count ; i++) { - sink->text_sink.tabs[i] = tabs[i] * figure_width; + sink->text_sink.tabs[i] = (Position)((size_t)tabs[i] * figure_width); sink->text_sink.char_tabs[i] = tabs[i]; } diff --git a/lib/libXaw/src/AsciiSrc.c b/lib/libXaw/src/AsciiSrc.c index 9e5fa5ec7..875b97c6c 100644 --- a/lib/libXaw/src/AsciiSrc.c +++ b/lib/libXaw/src/AsciiSrc.c @@ -94,7 +94,7 @@ static FILE *InitStringOrFile(AsciiSrcObject, Bool); static void LoadPieces(AsciiSrcObject, FILE*, char*); static void RemoveOldStringOrFile(AsciiSrcObject, Bool); static void RemovePiece(AsciiSrcObject, Piece*); -static String StorePiecesInString(AsciiSrcObject); +static char * StorePiecesInString(AsciiSrcObject); static Bool WriteToFile(String, String, unsigned); static Bool WritePiecesToFile(AsciiSrcObject, String); static void GetDefaultPieceSize(Widget, int, XrmValue*); @@ -288,8 +288,8 @@ XawAsciiSrcClassInitialize(void) */ /*ARGSUSED*/ static void -XawAsciiSrcInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawAsciiSrcInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { AsciiSrcObject src = (AsciiSrcObject)cnew; FILE *file; @@ -297,7 +297,7 @@ XawAsciiSrcInitialize(Widget request, Widget cnew, /* * Set correct flags (override resources) depending upon widget class */ - src->text_src.text_format = XawFmt8Bit; + src->text_src.text_format = (XrmQuark)XawFmt8Bit; #ifdef ASCII_DISK if (XtIsSubclass(XtParent(cnew), asciiDiskWidgetClass)) { @@ -383,16 +383,16 @@ ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length) offset = anchor->position + entity->offset; end = XawMin(end, offset + block->length); - if ((length = end - pos) < 0) + if ((length = (int)(end - pos)) < 0) length = 0; text->length = length; text->format = XawFmt8Bit; if (length == 0) { - text->firstPos = end = offset + entity->length; + text->firstPos = (int)(end = (offset + entity->length)); text->ptr = ""; } else { - text->firstPos = pos; + text->firstPos = (int)pos; text->ptr = block->ptr + (pos - offset); if (pos + length < offset + block->length) end = pos + length; /* there is data left to be read */ @@ -403,15 +403,15 @@ ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length) return (end); } - if ((length = end - pos) < 0) + if ((length = (int)(end - pos)) < 0) length = 0; #endif piece = FindPiece(src, pos, &start); - text->firstPos = pos; + text->firstPos = (int)pos; text->ptr = piece->text + (pos - start); count = piece->used - (pos - start); - text->length = Max(0, (length > count) ? count : length); + text->length = (Max(0, (length > count) ? count : length)); text->format = XawFmt8Bit; return (pos + text->length); @@ -493,7 +493,7 @@ ReplaceText(Widget w, XawTextPosition startPos, XawTextPosition endPos, c = ' '; else if ((c & 0177) < XawSP || c == 0177) { if (sink->ascii_sink.display_nonprinting) - c = c > 0177 ? '\\' : c + '^'; + c = (unsigned char)(c > 0177 ? '\\' : c + '^'); else c = ' '; } @@ -678,7 +678,7 @@ Scan(Widget w, register XawTextPosition position, XawTextScanType type, lim = piece->text + piece->used; } - c = *ptr++; + c = (unsigned char)*ptr++; ++position; if (type == XawstEOL) { @@ -752,7 +752,7 @@ Scan(Widget w, register XawTextPosition position, XawTextScanType type, lim = piece->text; } - c = *ptr--; + c = (unsigned char)*ptr--; --position; if (type == XawstEOL) { @@ -845,7 +845,7 @@ Search(Widget w, register XawTextPosition position, XawTextScanDirection dir, position--; } - buf = XtMalloc((unsigned)sizeof(unsigned char) * text->length); + buf = XtMalloc((unsigned)sizeof(unsigned char) * (unsigned)text->length); memcpy(buf, text->ptr, (unsigned)text->length); piece = FindPiece(src, position, &first); ptr = (position - first) + piece->text; @@ -872,7 +872,7 @@ Search(Widget w, register XawTextPosition position, XawTextScanDirection dir, if (ptr < piece->text) { do { - cnt = piece->text - ptr; + cnt = (int)(piece->text - ptr); piece = piece->prev; if (piece == NULL) { XtFree(buf); @@ -885,7 +885,7 @@ Search(Widget w, register XawTextPosition position, XawTextScanDirection dir, position++; if (ptr >= (piece->text + piece->used)) { do { - cnt = ptr - (piece->text + piece->used); + cnt = (int)(ptr - (piece->text + piece->used)); piece = piece->next; if (piece == NULL) { XtFree(buf); @@ -919,7 +919,7 @@ Search(Widget w, register XawTextPosition position, XawTextScanDirection dir, if (ptr >= (piece->text + piece->used)) { do { - cnt = ptr - (piece->text + piece->used); + cnt = (int)(ptr - (piece->text + piece->used)); piece = piece->next; if (piece == NULL) { XtFree(buf); @@ -932,7 +932,7 @@ Search(Widget w, register XawTextPosition position, XawTextScanDirection dir, position--; if (ptr < piece->text) { do { - cnt = piece->text - ptr; + cnt = (int)(piece->text - ptr); piece = piece->prev; if (piece == NULL) { XtFree(buf); @@ -967,7 +967,7 @@ Search(Widget w, register XawTextPosition position, XawTextScanDirection dir, * True if redisplay is needed */ static Boolean -XawAsciiSrcSetValues(Widget current, Widget request, Widget cnew, +XawAsciiSrcSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, ArgList args, Cardinal *num_args) { AsciiSrcObject src = (AsciiSrcObject)cnew; @@ -1012,7 +1012,7 @@ XawAsciiSrcSetValues(Widget current, Widget request, Widget cnew, if (!total_reset && old_src->ascii_src.piece_size != src->ascii_src.piece_size) { - String string = StorePiecesInString(old_src); + char * string = StorePiecesInString(old_src); FreeAllPieces(old_src); LoadPieces(src, NULL, string); @@ -1203,9 +1203,9 @@ XawAsciiSaveAsFile(Widget w, _Xconst char *name) if (src->ascii_src.type == XawAsciiFile) ret = WritePiecesToFile(src, (String)name); else { - String string = StorePiecesInString(src); + char * string = StorePiecesInString(src); - ret = WriteToFile(string, (String)name, src->ascii_src.length); + ret = WriteToFile(string, (String)name, (unsigned)src->ascii_src.length); XtFree(string); } @@ -1321,12 +1321,12 @@ WritePiecesToFile(AsciiSrcObject src, String name) piece = src->ascii_src.first_piece; while (piece) { - int bytes = src->ascii_src.piece_size - piece->used; + int bytes = (int)(src->ascii_src.piece_size - piece->used); if (bytes > 0 && (tmp = piece->next) != NULL) { - bytes = XawMin(bytes, tmp->used); - memcpy(piece->text + piece->used, tmp->text, bytes); - memmove(tmp->text, tmp->text + bytes, tmp->used - bytes); + bytes = (XawMin(bytes, tmp->used)); + memcpy(piece->text + piece->used, tmp->text, (size_t)bytes); + memmove(tmp->text, tmp->text + bytes, (size_t)(tmp->used - bytes)); piece->used += bytes; if ((tmp->used -= bytes) == 0) { RemovePiece(src, tmp); @@ -1341,7 +1341,7 @@ WritePiecesToFile(AsciiSrcObject src, String name) return (False); for (piece = src->ascii_src.first_piece; piece; piece = piece->next) - if (write(fd, piece->text, piece->used) == -1) { + if (write(fd, piece->text, (size_t)piece->used) == -1) { close(fd); return (False); } @@ -1362,10 +1362,10 @@ WritePiecesToFile(AsciiSrcObject src, String name) * Description: * Store the pieces in memory into a standard ascii string. */ -static String +static char * StorePiecesInString(AsciiSrcObject src) { - String string; + char * string; XawTextPosition first; Piece *piece; @@ -1413,15 +1413,15 @@ InitStringOrFile(AsciiSrcObject src, Bool newString) else if (!src->ascii_src.use_string_in_place) { src->ascii_src.string = XtNewString(src->ascii_src.string); src->ascii_src.allocated_string = True; - src->ascii_src.length = strlen(src->ascii_src.string); + src->ascii_src.length = (XawTextPosition)strlen(src->ascii_src.string); } if (src->ascii_src.use_string_in_place) { if (src->ascii_src.string != NULL) - src->ascii_src.length = strlen(src->ascii_src.string); + src->ascii_src.length = (XawTextPosition)strlen(src->ascii_src.string); /* In case the length resource is incorrectly set */ if (src->ascii_src.length > src->ascii_src.ascii_length) - src->ascii_src.ascii_length = src->ascii_src.length; + src->ascii_src.ascii_length = (int)src->ascii_src.length; if (src->ascii_src.ascii_length == MAGIC_VALUE) src->ascii_src.piece_size = src->ascii_src.length; @@ -1477,7 +1477,7 @@ InitStringOrFile(AsciiSrcObject src, Bool newString) } if (!src->ascii_src.is_tempfile) { - if ((fd = open(src->ascii_src.string, open_mode, 0666)) != -1) { + if ((fd = open(src->ascii_src.string, (int)open_mode, 0666)) != -1) { if ((file = fdopen(fd, fdopen_mode))) { (void)fseek(file, 0, SEEK_END); src->ascii_src.length = (XawTextPosition)ftell(file); @@ -1517,7 +1517,7 @@ LoadPieces(AsciiSrcObject src, FILE *file, char *string) fseek(file, 0, SEEK_SET); while (left < src->ascii_src.length) { ptr = XtMalloc((unsigned)src->ascii_src.piece_size); - if ((len = fread(ptr, sizeof(unsigned char), + if ((len = (int)fread(ptr, sizeof(unsigned char), (size_t)src->ascii_src.piece_size, file)) < 0) XtErrorMsg("readError", "asciiSourceCreate", "XawError", "fread returned error.", NULL, NULL); @@ -1707,7 +1707,7 @@ BreakPiece(AsciiSrcObject src, Piece *piece) /*ARGSUSED*/ static void -CvtStringToAsciiType(XrmValuePtr args, Cardinal *num_args, +CvtStringToAsciiType(XrmValuePtr args _X_UNUSED, Cardinal *num_args _X_UNUSED, XrmValuePtr fromVal, XrmValuePtr toVal) { static XawAsciiType type; @@ -1733,9 +1733,9 @@ CvtStringToAsciiType(XrmValuePtr args, Cardinal *num_args, /*ARGSUSED*/ static Boolean -CvtAsciiTypeToString(Display *dpy, XrmValuePtr args, Cardinal *num_args, +CvtAsciiTypeToString(Display *dpy, XrmValuePtr args _X_UNUSED, Cardinal *num_args _X_UNUSED, XrmValuePtr fromVal, XrmValuePtr toVal, - XtPointer *data) + XtPointer *data _X_UNUSED) { static String buffer; Cardinal size; @@ -1754,7 +1754,7 @@ CvtAsciiTypeToString(Display *dpy, XrmValuePtr args, Cardinal *num_args, return (False); } - size = strlen(buffer) + 1; + size = (Cardinal)(strlen(buffer) + 1); if (toVal->addr != NULL) { if (toVal->size < size) { toVal->size = size; @@ -1771,7 +1771,7 @@ CvtAsciiTypeToString(Display *dpy, XrmValuePtr args, Cardinal *num_args, /*ARGSUSED*/ static void -GetDefaultPieceSize(Widget w, int offset, XrmValue *value) +GetDefaultPieceSize(Widget w _X_UNUSED, int offset _X_UNUSED, XrmValue *value) { static XPointer pagesize; diff --git a/lib/libXaw/src/AsciiText.c b/lib/libXaw/src/AsciiText.c index 8e2f0aa66..65a2323f7 100644 --- a/lib/libXaw/src/AsciiText.c +++ b/lib/libXaw/src/AsciiText.c @@ -310,7 +310,7 @@ XawAsciiInitialize(Widget request, Widget cnew, } if (XtHeight(w) == DEFAULT_TEXT_HEIGHT) - XtHeight(w) = VMargins(w) + XawTextSinkMaxHeight(w->text.sink, 1); + XtHeight(w) = (Dimension)(VMargins(w) + XawTextSinkMaxHeight(w->text.sink, 1)); for (i = 0, tab = 0; i < TAB_COUNT; i++) tabs[i] = (tab += 8); diff --git a/lib/libXaw/src/Box.c b/lib/libXaw/src/Box.c index 266fb08ab..2a1bc688e 100644 --- a/lib/libXaw/src/Box.c +++ b/lib/libXaw/src/Box.c @@ -220,7 +220,7 @@ DoLayout(BoxWidget bbw, unsigned int width, unsigned int height, && bbw->composite.children[i]->core.width > w) w = bbw->composite.children[i]->core.width; } - w += h_space; + w = (Dimension)(w + h_space); if (w > width) width = w; h = bbw->box.v_space; @@ -235,7 +235,7 @@ DoLayout(BoxWidget bbw, unsigned int width, unsigned int height, if (widget->core.mapped_when_managed) num_mapped_children++; /* Compute widget width */ - bw = XtWidth(widget) + (XtBorderWidth(widget)<<1) + h_space; + bw = (Dimension)(XtWidth(widget) + (XtBorderWidth(widget)<<1) + h_space); if ((Dimension)(lw + bw) > width) { if (lw > h_space) { /* At least one widget on this line, and @@ -243,7 +243,7 @@ DoLayout(BoxWidget bbw, unsigned int width, unsigned int height, */ AssignMax(w, lw); if (vbox) { - h += lh + bbw->box.v_space; + h = (Dimension)(h + (lh + bbw->box.v_space)); lh = 0; lw = h_space; } @@ -270,10 +270,10 @@ DoLayout(BoxWidget bbw, unsigned int width, unsigned int height, */ if (XtIsRealized(widget) && widget->core.mapped_when_managed) XUnmapWindow( XtDisplay(widget), XtWindow(widget)); - XtMoveWidget(widget, (int)lw, (int)h); + XtMoveWidget(widget, (Position)lw, (Position)h); } - lw += bw; - bh = XtHeight(widget) + (XtBorderWidth(widget) << 1); + lw = (Dimension)(lw + bw); + bh = (Dimension)(XtHeight(widget) + (XtBorderWidth(widget) << 1)); AssignMax(lh, bh); } } @@ -281,7 +281,7 @@ DoLayout(BoxWidget bbw, unsigned int width, unsigned int height, if (!vbox && width && lw > width && lh < height) { /* reduce width if too wide and height not filled */ Dimension sw = lw, sh = lh; - Dimension width_needed = width; + Dimension width_needed = (Dimension)width; XtOrientation orientation = bbw->box.orientation; bbw->box.orientation = XtorientVertical; @@ -308,7 +308,7 @@ DoLayout(BoxWidget bbw, unsigned int width, unsigned int height, if (bbw->composite.num_children == num_mapped_children) XMapSubwindows(XtDisplay((Widget)bbw), XtWindow((Widget)bbw)); else { - int ii = bbw->composite.num_children; + int ii = (int)bbw->composite.num_children; Widget *childP = bbw->composite.children; for (; ii > 0; childP++, ii--) @@ -321,7 +321,7 @@ DoLayout(BoxWidget bbw, unsigned int width, unsigned int height, /* Finish off last line */ if (lw > h_space) { AssignMax(w, lw); - h += lh + bbw->box.v_space; + h = (Dimension)(h + (lh + bbw->box.v_space)); } *reply_width = Max(w, 1); @@ -395,7 +395,7 @@ XawBoxQueryGeometry(Widget widget, XtWidgetGeometry *constraint, if (width > (constraint->width >> 1)) /* avoid short int overflow */ width = constraint->width; else - width <<= 1; + width = (Dimension)(width << 1); DoLayout(w, width, 0, &preferred_width, &preferred_height, False); } while (preferred_height > constraint->height && width < constraint->width); @@ -523,7 +523,7 @@ TryNewLayout(BoxWidget bbw) /*ARGSUSED*/ static XtGeometryResult XawBoxGeometryManager(Widget w, XtWidgetGeometry *request, - XtWidgetGeometry *reply) + XtWidgetGeometry *reply _X_UNUSED) { Dimension width, height, borderWidth; BoxWidget bbw; @@ -597,8 +597,8 @@ XawBoxClassInitialize(void) /*ARGSUSED*/ static void -XawBoxInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawBoxInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { BoxWidget newbbw = (BoxWidget)cnew; @@ -627,7 +627,7 @@ XawBoxRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes) #ifndef OLDXAW if (w->core.background_pixmap > XtUnspecifiedPixmap) { pixmap = XawPixmapFromXPixmap(w->core.background_pixmap, XtScreen(w), - w->core.colormap, w->core.depth); + w->core.colormap, (int)w->core.depth); if (pixmap && pixmap->mask) XawReshapeWidget(w, pixmap); } @@ -636,8 +636,8 @@ XawBoxRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes) /*ARGSUSED*/ static Boolean -XawBoxSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawBoxSetValues(Widget current _X_UNUSED, Widget request _X_UNUSED, Widget cnew _X_UNUSED, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { /* need to relayout if h_space or v_space change */ #ifndef OLDXAW @@ -649,10 +649,10 @@ XawBoxSetValues(Widget current, Widget request, Widget cnew, opix = XawPixmapFromXPixmap(b_old->core.background_pixmap, XtScreen(b_old), b_old->core.colormap, - b_old->core.depth); + (int)b_old->core.depth); npix = XawPixmapFromXPixmap(b_new->core.background_pixmap, XtScreen(b_new), b_new->core.colormap, - b_new->core.depth); + (int)b_new->core.depth); if ((npix && npix->mask) || (opix && opix->mask)) XawReshapeWidget(cnew, npix); } diff --git a/lib/libXaw/src/Command.c b/lib/libXaw/src/Command.c index 4535423a0..d9db81a69 100644 --- a/lib/libXaw/src/Command.c +++ b/lib/libXaw/src/Command.c @@ -243,8 +243,8 @@ Get_GC(CommandWidget cbw, Pixel fg, Pixel bg) /*ARGSUSED*/ static void -XawCommandInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawCommandInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { CommandWidget cbw = (CommandWidget)cnew; int shape_event_base, shape_error_base; @@ -295,9 +295,9 @@ HighlightRegion(CommandWidget cbw) rect.width = XtWidth(cbw); rect.height = XtHeight(cbw); XUnionRectWithRegion(&rect, emptyRegion, outerRegion); - rect.x = rect.y = cbw->command.highlight_thickness; - rect.width -= cbw->command.highlight_thickness * 2; - rect.height -= cbw->command.highlight_thickness * 2; + rect.x = rect.y = (short)cbw->command.highlight_thickness; + rect.width = (rect.width - cbw->command.highlight_thickness * 2); + rect.height = (rect.height - cbw->command.highlight_thickness * 2); XUnionRectWithRegion(&rect, emptyRegion, innerRegion); XSubtractRegion(outerRegion, innerRegion, outerRegion); @@ -324,7 +324,7 @@ XawCommandToggle(Widget w) /*ARGSUSED*/ static void -Set(Widget w, XEvent *event, String *params, Cardinal *num_params) +Set(Widget w, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { CommandWidget cbw = (CommandWidget)w; @@ -337,7 +337,7 @@ Set(Widget w, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static void -Unset(Widget w, XEvent *event, String *params, Cardinal *num_params) +Unset(Widget w, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { CommandWidget cbw = (CommandWidget)w; @@ -390,7 +390,7 @@ Highlight(Widget w, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static void -Unhighlight(Widget w, XEvent *event, String *params, Cardinal *num_params) +Unhighlight(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { CommandWidget cbw = (CommandWidget)w; @@ -401,7 +401,7 @@ Unhighlight(Widget w, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static void -Notify(Widget w, XEvent *event, String *params, Cardinal *num_params) +Notify(Widget w, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { CommandWidget cbw = (CommandWidget)w; @@ -469,13 +469,13 @@ PaintCommandWidget(Widget w, XEvent *event, Region region, Bool change) XClearArea(XtDisplay(w), XtWindow(w), 0, cbw->command.highlight_thickness, cbw->command.highlight_thickness, - XtHeight(cbw) - (cbw->command.highlight_thickness<<1), + (unsigned)(XtHeight(cbw) - (cbw->command.highlight_thickness<<1)), False); XClearArea(XtDisplay(w), XtWindow(w), XtWidth(cbw) - cbw->command.highlight_thickness, cbw->command.highlight_thickness, cbw->command.highlight_thickness, - XtHeight(cbw) - (cbw->command.highlight_thickness<<1), + (unsigned)(XtHeight(cbw) - (cbw->command.highlight_thickness<<1)), False); XClearArea(XtDisplay(w), XtWindow(w), 0, XtHeight(cbw) - cbw->command.highlight_thickness, @@ -486,8 +486,8 @@ PaintCommandWidget(Widget w, XEvent *event, Region region, Bool change) int offset = cbw->command.highlight_thickness / 2; XDrawRectangle(XtDisplay(w),XtWindow(w), rev_gc, offset, offset, - XtWidth(cbw) - cbw->command.highlight_thickness, - XtHeight(cbw) - cbw->command.highlight_thickness); + (unsigned)(XtWidth(cbw) - cbw->command.highlight_thickness), + (unsigned)(XtHeight(cbw) - cbw->command.highlight_thickness)); } } } @@ -506,7 +506,7 @@ XawCommandDestroy(Widget w) /*ARGSUSED*/ static Boolean -XawCommandSetValues(Widget current, Widget request, Widget cnew, +XawCommandSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, ArgList args, Cardinal *num_args) { CommandWidget oldcbw = (CommandWidget)current; @@ -593,7 +593,7 @@ ShapeButton(CommandWidget cbw, Bool checkRectangular) if (cbw->command.shape_style == XawShapeRoundedRectangle) { corner_size = XtWidth(cbw) < XtHeight(cbw) ? XtWidth(cbw) : XtHeight(cbw); - corner_size = (corner_size * cbw->command.corner_round) / 100; + corner_size = (Dimension)((corner_size * cbw->command.corner_round) / 100); } if (checkRectangular || cbw->command.shape_style != XawShapeRectangle) { diff --git a/lib/libXaw/src/Converters.c b/lib/libXaw/src/Converters.c index 9795671cd..cc3efcbb0 100644 --- a/lib/libXaw/src/Converters.c +++ b/lib/libXaw/src/Converters.c @@ -247,9 +247,9 @@ TypeToStringNoArgsWarning(Display *dpy, String type) /*ARGSUSED*/ static Boolean -_XawCvtBooleanToString(Display *dpy, XrmValue *args, Cardinal *num_args, +_XawCvtBooleanToString(Display *dpy, XrmValue *args _X_UNUSED, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, - XtPointer *converter_data) + XtPointer *converter_data _X_UNUSED) { static char buffer[6]; Cardinal size; @@ -259,16 +259,16 @@ _XawCvtBooleanToString(Display *dpy, XrmValue *args, Cardinal *num_args, snprintf(buffer, sizeof(buffer), "%s", *(Boolean *)fromVal->addr ? XtEtrue : XtEfalse); - size = strlen(buffer) + 1; + size = (Cardinal)(strlen(buffer) + 1); string_done(buffer); } /*ARGSUSED*/ static Boolean -_XawCvtBoolToString(Display *dpy, XrmValue *args, Cardinal *num_args, +_XawCvtBoolToString(Display *dpy, XrmValue *args _X_UNUSED, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, - XtPointer *converter_data) + XtPointer *converter_data _X_UNUSED) { static char buffer[6]; Cardinal size; @@ -278,16 +278,16 @@ _XawCvtBoolToString(Display *dpy, XrmValue *args, Cardinal *num_args, snprintf(buffer, sizeof(buffer), "%s", *(Bool *)fromVal->addr ? XtEtrue : XtEfalse); - size = strlen(buffer) + 1; + size = (Cardinal)(strlen(buffer) + 1); string_done(buffer); } /*ARGSUSED*/ static Boolean -_XawCvtPositionToString(Display *dpy, XrmValue *args, Cardinal *num_args, +_XawCvtPositionToString(Display *dpy, XrmValue *args _X_UNUSED, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, - XtPointer *converter_data) + XtPointer *converter_data _X_UNUSED) { static char buffer[7]; Cardinal size; @@ -296,16 +296,16 @@ _XawCvtPositionToString(Display *dpy, XrmValue *args, Cardinal *num_args, TypeToStringNoArgsWarning(dpy, XtRPosition); snprintf(buffer, sizeof(buffer), "%d", *(Position *)fromVal->addr); - size = strlen(buffer) + 1; + size = (Cardinal)(strlen(buffer) + 1); string_done(buffer); } /*ARGSUSED*/ static Boolean -_XawCvtShortToString(Display *dpy, XrmValue *args, Cardinal *num_args, +_XawCvtShortToString(Display *dpy, XrmValue *args _X_UNUSED, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, - XtPointer *converter_data) + XtPointer *converter_data _X_UNUSED) { static char buffer[7]; Cardinal size; @@ -314,16 +314,16 @@ _XawCvtShortToString(Display *dpy, XrmValue *args, Cardinal *num_args, TypeToStringNoArgsWarning(dpy, XtRShort); snprintf(buffer, sizeof(buffer), "%d", *(short *)fromVal->addr); - size = strlen(buffer) + 1; + size = (Cardinal)(strlen(buffer) + 1); string_done(buffer); } /*ARGSUSED*/ static Boolean -_XawCvtDimensionToString(Display *dpy, XrmValue *args, Cardinal *num_args, +_XawCvtDimensionToString(Display *dpy, XrmValue *args _X_UNUSED, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, - XtPointer *converter_data) + XtPointer *converter_data _X_UNUSED) { static char buffer[6]; Cardinal size; @@ -332,16 +332,16 @@ _XawCvtDimensionToString(Display *dpy, XrmValue *args, Cardinal *num_args, TypeToStringNoArgsWarning(dpy, XtRDimension); snprintf(buffer, sizeof(buffer), "%u", *(Dimension *)fromVal->addr); - size = strlen(buffer) + 1; + size = (Cardinal)(strlen(buffer) + 1); string_done(buffer); } /*ARGSUSED*/ static Boolean -_XawCvtCARD32ToString(Display *dpy, XrmValue *args, Cardinal *num_args, +_XawCvtCARD32ToString(Display *dpy, XrmValue *args _X_UNUSED, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, - XtPointer *converter_data) + XtPointer *converter_data _X_UNUSED) { static char buffer[11]; Cardinal size; @@ -350,16 +350,16 @@ _XawCvtCARD32ToString(Display *dpy, XrmValue *args, Cardinal *num_args, TypeToStringNoArgsWarning(dpy, "CARD32"); snprintf(buffer, sizeof(buffer), "0x%08hx", *(int *)fromVal->addr); - size = strlen(buffer) + 1; + size = (Cardinal)(strlen(buffer) + 1); string_done(buffer); } /*ARGSUSED*/ static Boolean -_XawCvtIntToString(Display *dpy, XrmValue *args, Cardinal *num_args, +_XawCvtIntToString(Display *dpy, XrmValue *args _X_UNUSED, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, - XtPointer *converter_data) + XtPointer *converter_data _X_UNUSED) { static char buffer[12]; Cardinal size; @@ -368,16 +368,16 @@ _XawCvtIntToString(Display *dpy, XrmValue *args, Cardinal *num_args, TypeToStringNoArgsWarning(dpy, XtRInt); snprintf(buffer, sizeof(buffer), "%d", *(int *)fromVal->addr); - size = strlen(buffer) + 1; + size = (Cardinal)(strlen(buffer) + 1); string_done(buffer); } /*ARGSUSED*/ static Boolean -_XawCvtCardinalToString(Display *dpy, XrmValue *args, Cardinal *num_args, +_XawCvtCardinalToString(Display *dpy, XrmValue *args _X_UNUSED, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, - XtPointer *converter_data) + XtPointer *converter_data _X_UNUSED) { static char buffer[11]; Cardinal size; @@ -386,19 +386,19 @@ _XawCvtCardinalToString(Display *dpy, XrmValue *args, Cardinal *num_args, TypeToStringNoArgsWarning(dpy, XtRCardinal); snprintf(buffer, sizeof(buffer), "%u", *(Cardinal *)fromVal->addr); - size = strlen(buffer) + 1; + size = (Cardinal)(strlen(buffer) + 1); string_done(buffer); } /*ARGSUSED*/ static Boolean -_XawCvtAtomToString(Display *dpy, XrmValue *args, Cardinal *num_args, +_XawCvtAtomToString(Display *dpy, XrmValue *args _X_UNUSED, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, - XtPointer *converter_data) + XtPointer *converter_data _X_UNUSED) { static char *buffer = NULL; - static char *nullatom = "NULL"; + static char *nullatom = (char *)"NULL"; Cardinal size; Atom atom; @@ -419,7 +419,7 @@ _XawCvtAtomToString(Display *dpy, XrmValue *args, Cardinal *num_args, return (False); } - size = strlen(buffer) + 1; + size = (Cardinal)(strlen(buffer) + 1); string_done(buffer); } @@ -428,7 +428,7 @@ _XawCvtAtomToString(Display *dpy, XrmValue *args, Cardinal *num_args, static Boolean _XawCvtPixelToString(Display *dpy, XrmValue *args, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, - XtPointer *converter_data) + XtPointer *converter_data _X_UNUSED) { static char buffer[19]; Cardinal size; @@ -455,16 +455,16 @@ _XawCvtPixelToString(Display *dpy, XrmValue *args, Cardinal *num_args, XQueryColor(dpy, colormap, &color); snprintf(buffer, sizeof(buffer), "rgb:%04hx/%04hx/%04hx", color.red, color.green, color.blue); - size = strlen(buffer) + 1; + size = (Cardinal)(strlen(buffer) + 1); string_done(buffer); } /*ARGSUSED*/ static Boolean -_XawCvtFontStructToString(Display *dpy, XrmValue *args, Cardinal *num_args, +_XawCvtFontStructToString(Display *dpy, XrmValue *args _X_UNUSED, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, - XtPointer *converter_data) + XtPointer *converter_data _X_UNUSED) { static char buffer[128]; Cardinal size; @@ -486,7 +486,7 @@ _XawCvtFontStructToString(Display *dpy, XrmValue *args, Cardinal *num_args, if (tmp) { snprintf(buffer, sizeof(buffer), "%s", tmp); - size = strlen(tmp); + size = (Cardinal)strlen(tmp); XFree(tmp); } } @@ -504,9 +504,9 @@ _XawCvtFontStructToString(Display *dpy, XrmValue *args, Cardinal *num_args, /*ARGSUSED*/ static Boolean -_XawCvtUnsignedCharToString(Display *dpy, XrmValue *args, Cardinal *num_args, +_XawCvtUnsignedCharToString(Display *dpy, XrmValue *args _X_UNUSED, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, - XtPointer *converter_data) + XtPointer *converter_data _X_UNUSED) { static char buffer[4]; Cardinal size; @@ -516,7 +516,7 @@ _XawCvtUnsignedCharToString(Display *dpy, XrmValue *args, Cardinal *num_args, snprintf(buffer, sizeof(buffer), "%u", *(unsigned char *)fromVal->addr); - size = strlen(buffer) + 1; + size = (Cardinal)(strlen(buffer) + 1); string_done(buffer); } @@ -525,7 +525,7 @@ _XawCvtUnsignedCharToString(Display *dpy, XrmValue *args, Cardinal *num_args, static Boolean _XawCvtStringToDisplayList(Display *dpy, XrmValue *args, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, - XtPointer *converter_data) + XtPointer *converter_data _X_UNUSED) { XawDisplayList *dlist; Screen *screen; @@ -566,9 +566,9 @@ _XawCvtStringToDisplayList(Display *dpy, XrmValue *args, Cardinal *num_args, /*ARGSUSED*/ static Boolean -_XawCvtDisplayListToString(Display *dpy, XrmValue *args, Cardinal *num_args, +_XawCvtDisplayListToString(Display *dpy, XrmValue *args _X_UNUSED, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, - XtPointer *converter_data) + XtPointer *converter_data _X_UNUSED) { String buffer; Cardinal size; @@ -577,7 +577,7 @@ _XawCvtDisplayListToString(Display *dpy, XrmValue *args, Cardinal *num_args, TypeToStringNoArgsWarning(dpy, XawRDisplayList); buffer = XawDisplayListString(*(XawDisplayList **)(fromVal[0].addr)); - size = strlen(buffer) + 1; + size = (Cardinal)(strlen(buffer) + 1); string_done(buffer); } @@ -586,7 +586,7 @@ _XawCvtDisplayListToString(Display *dpy, XrmValue *args, Cardinal *num_args, static Boolean _XawCvtStringToPixmap(Display *dpy, XrmValue *args, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, - XtPointer *converter_data) + XtPointer *converter_data _X_UNUSED) { XawPixmap *xaw_pixmap; Pixmap pixmap; @@ -690,7 +690,7 @@ _XawCvtPixmapToString(Display *dpy, XrmValue *args, Cardinal *num_args, return (_XawCvtCARD32ToString(dpy, args, num_args, fromVal, toVal, converter_data)); - size = strlen(buffer) + 1; + size = (Cardinal)(strlen(buffer) + 1); string_done(buffer); } diff --git a/lib/libXaw/src/Dialog.c b/lib/libXaw/src/Dialog.c index 9c98d3696..925c975d1 100644 --- a/lib/libXaw/src/Dialog.c +++ b/lib/libXaw/src/Dialog.c @@ -188,8 +188,8 @@ WidgetClass dialogWidgetClass = (WidgetClass)&dialogClassRec; */ /*ARGSUSED*/ static void -XawDialogInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawDialogInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { DialogWidget dw = (DialogWidget)cnew; Arg arglist[9]; @@ -228,8 +228,8 @@ XawDialogInitialize(Widget request, Widget cnew, /*ARGSUSED*/ static void -XawDialogConstraintInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawDialogConstraintInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { DialogWidget dw = (DialogWidget)cnew->core.parent; DialogConstraints constraint = (DialogConstraints)cnew->core.constraints; @@ -265,7 +265,7 @@ XawDialogConstraintInitialize(Widget request, Widget cnew, #define NUM_CHECKS 2 /*ARGSUSED*/ static Boolean -XawDialogSetValues(Widget current, Widget request, Widget cnew, +XawDialogSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, ArgList in_args, Cardinal *in_num_args) { DialogWidget w = (DialogWidget)cnew; @@ -357,7 +357,7 @@ static void XawDialogGetValuesHook(Widget w, ArgList args, Cardinal *num_args) { Arg a[1]; - String s; + char * s; DialogWidget src = (DialogWidget)w; unsigned int i; diff --git a/lib/libXaw/src/DisplayList.c b/lib/libXaw/src/DisplayList.c index 0581bf708..540cc1e78 100644 --- a/lib/libXaw/src/DisplayList.c +++ b/lib/libXaw/src/DisplayList.c @@ -140,8 +140,8 @@ XawRunDisplayList(Widget w, _XawDisplayList *list, #define DLEND 1 #define DLNAME 2 #define DLARG 3 -static char * -read_token(char *src, char *dst, Cardinal size, int *status) +static String +read_token(String src, char *dst, Cardinal size, int *status) { int ch; Bool esc, quote; @@ -177,7 +177,7 @@ read_token(char *src, char *dst, Cardinal size, int *status) { if (esc) { - dst[i++] = ch; + dst[i++] = (char)ch; esc = False; continue; } @@ -216,7 +216,7 @@ read_token(char *src, char *dst, Cardinal size, int *status) } else esc = False; - dst[i++] = ch; + dst[i++] = (char)ch; } *status = DLERR; @@ -235,7 +235,9 @@ _XawDisplayList *XawCreateDisplayList(String string, Screen *screen, XawDLProc *proc; char cname[64], fname[64], aname[1024]; Cardinal i; - char *cp, *fp, *lp; + String cp; + String fp; + String lp; int status; xlibc = XawGetDisplayListClass(xlib); @@ -287,7 +289,7 @@ _XawDisplayList *XawCreateDisplayList(String string, Screen *screen, } if (fp) { - snprintf(cname, fp - fname + 1, "%s", fname); + snprintf(cname, (size_t)(fp - fname + 1), "%s", fname); memmove(fname, fp + 1, strlen(fp)); lc = cname[0] ? XawGetDisplayListClass(cname) : xlibc; if (!lc) @@ -337,8 +339,8 @@ _XawDisplayList *XawCreateDisplayList(String string, Screen *screen, { ++dlist->num_procs; dlist->procs = (XawDLProc**) - XtRealloc((char *)dlist->procs, sizeof(XawDLProc*) * - dlist->num_procs); + XtRealloc((char *)dlist->procs, (Cardinal)(sizeof(XawDLProc*) * + dlist->num_procs)); } dlist->procs[dlist->num_procs - 1] = proc; @@ -368,8 +370,8 @@ _XawDisplayList *XawCreateDisplayList(String string, Screen *screen, { ++proc->num_params; proc->params = (String *)XtRealloc((char *)proc->params, - sizeof(String) * - proc->num_params); + (Cardinal)(sizeof(String) * + proc->num_params)); } proc->params[proc->num_params - 1] = XtNewString(aname); } @@ -401,8 +403,8 @@ _XawDisplayList *XawCreateDisplayList(String string, Screen *screen, { ++dlist->num_data; dlist->data = (XawDLData **) - XtRealloc((char *)dlist->data, sizeof(XawDLData*) * - dlist->num_data); + XtRealloc((char *)dlist->data, (Cardinal)(sizeof(XawDLData*) * + dlist->num_data)); } dlist->data[dlist->num_data - 1] = data; } @@ -478,7 +480,7 @@ XawDestroyDisplayList(_XawDisplayList *dlist) } for (j = 0; j < proc->num_params; j++) - XtFree(proc->params[j]); + XtFree((char *)proc->params[j]); if (proc->num_params) XtFree((char *)proc->params); XtFree((char *)proc); @@ -544,12 +546,12 @@ typedef struct _XawDLImageArgs { int depth; } XawDLImageArgs; -#define X_ARG(x) (Position)(((x).denom != 0) ? \ +#define X_ARG(x) ((Position)(((x).denom != 0) ? \ ((float)XtWidth(w) * ((float)(x).pos / (float)(x).denom)) : \ - ((x).high ? XtWidth(w) - (x).pos : (x).pos)) -#define Y_ARG(x) (Position)(((x).denom != 0) ? \ + (float)((x).high ? XtWidth(w) - (x).pos : (x).pos))) +#define Y_ARG(x) ((Position)(((x).denom != 0) ? \ ((float)XtHeight(w) * ((float)(x).pos / (float)(x).denom)): \ - ((x).high ? XtHeight(w) - (x).pos : (x).pos)) + (float)((x).high ? XtHeight(w) - (x).pos : (x).pos))) #define DRECT 0 #define FRECT 1 #define LINE 2 @@ -600,17 +602,17 @@ Dl1Point(Widget w, XtPointer args, XtPointer data, int id) Window window; Position x, y; - x = X_ARG(pos[0]); - y = Y_ARG(pos[1]); + x = (Position)(X_ARG(pos[0])); + y = (Position)(Y_ARG(pos[1])); if (!XtIsWidget(w)) { Position xpad, ypad; - xpad = XtX(w) + XtBorderWidth(w); - ypad = XtY(w) + XtBorderWidth(w); - x += xpad; - y += ypad; + xpad = (Position)(XtX(w) + XtBorderWidth(w)); + ypad = (Position)(XtY(w) + XtBorderWidth(w)); + x = (Position)(x + xpad); + y = (Position)(y + ypad); display = XtDisplayOfObject(w); window = XtWindowOfObject(w); } @@ -656,10 +658,10 @@ Dl2Points(Widget w, XtPointer args, XtPointer data, int id) { Position xpad, ypad; - xpad = XtX(w) + XtBorderWidth(w); - ypad = XtY(w) + XtBorderWidth(w); - x1 += xpad; y1 += ypad; - x2 += xpad; y2 += ypad; + xpad = (Position)(XtX(w) + XtBorderWidth(w)); + ypad = (Position)(XtY(w) + XtBorderWidth(w)); + x1 = (Position)(x1 + xpad); y1 = (Position)(y1 + ypad); + x2 = (Position)(x2 + xpad); y2 = (Position)(y2 + ypad); display = XtDisplayOfObject(w); window = XtWindowOfObject(w); } @@ -670,16 +672,16 @@ Dl2Points(Widget w, XtPointer args, XtPointer data, int id) } if (id == DRECT) - XDrawRectangle(display, window, xdata->gc, x1, y1, x2 - x1, y2 - y1); + XDrawRectangle(display, window, xdata->gc, x1, y1, (unsigned)(x2 - x1), (unsigned)(y2 - y1)); else if (id == FRECT) - XFillRectangle(display, window, xdata->gc, x1, y1, x2 - x1, y2 - y1); + XFillRectangle(display, window, xdata->gc, x1, y1, (unsigned)(x2 - x1), (unsigned)(y2 - y1)); else if (id == LINE) XDrawLine(display, window, xdata->gc, x1, y1, x2, y2); } /* ARGSUSED */ static void -DlLine(Widget w, XtPointer args, XtPointer data, XEvent *event, Region region) +DlLine(Widget w, XtPointer args, XtPointer data, XEvent *event _X_UNUSED, Region region _X_UNUSED) { Dl2Points(w, args, data, LINE); } @@ -687,7 +689,7 @@ DlLine(Widget w, XtPointer args, XtPointer data, XEvent *event, Region region) /* ARGSUSED */ static void DlDrawRectangle(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { Dl2Points(w, args, data, DRECT); } @@ -695,7 +697,7 @@ DlDrawRectangle(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlFillRectangle(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { Dl2Points(w, args, data, FRECT); } @@ -726,20 +728,20 @@ DlXPoints(Widget w, XtPointer args, XtPointer data, int id) { Position xpad, ypad; - xpad = XtX(w) + XtBorderWidth(w); - ypad = XtY(w) + XtBorderWidth(w); + xpad = (Position)(XtX(w) + XtBorderWidth(w)); + ypad = (Position)(XtY(w) + XtBorderWidth(w)); if (xdata->mode != CoordModePrevious) { for (i = 0; i < num_points; i++) { - points[i].x += xpad; - points[i].y += ypad; + points[i].x = (short)(points[i].x + xpad); + points[i].y = (short)(points[i].y + ypad); } } else { - points[0].x += xpad; - points[0].y += ypad; + points[0].x = (short)(points[0].x + xpad); + points[0].y = (short)(points[0].y + ypad); } display = XtDisplayOfObject(w); window = XtWindowOfObject(w); @@ -751,12 +753,12 @@ DlXPoints(Widget w, XtPointer args, XtPointer data, int id) } if (id == FPOLY) - XFillPolygon(display, window, xdata->gc, points, num_points, + XFillPolygon(display, window, xdata->gc, points, (int)num_points, xdata->shape, xdata->mode); else if (id == DLINES) - XDrawLines(display, window, xdata->gc, points, num_points, xdata->mode); + XDrawLines(display, window, xdata->gc, points, (int)num_points, xdata->mode); else if (id == POINTS) - XDrawPoints(display, window, xdata->gc, points, num_points, xdata->mode); + XDrawPoints(display, window, xdata->gc, points, (int)num_points, xdata->mode); XawStackFree(points, points_buf); } @@ -764,7 +766,7 @@ DlXPoints(Widget w, XtPointer args, XtPointer data, int id) /* ARGSUSED */ static void DlFillPolygon(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { DlXPoints(w, args, data, FPOLY); } @@ -772,7 +774,7 @@ DlFillPolygon(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlDrawLines(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { DlXPoints(w, args, data, DLINES); } @@ -780,7 +782,7 @@ DlDrawLines(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlDrawPoints(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { DlXPoints(w, args, data, POINTS); } @@ -788,7 +790,7 @@ DlDrawPoints(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlForeground(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; Pixel foreground = (Pixel)args; @@ -804,7 +806,7 @@ DlForeground(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlBackground(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; Pixel background = (Pixel)args; @@ -835,12 +837,12 @@ DlArc(Widget w, XtPointer args, XtPointer data, Bool fill) { Position xpad, ypad; - xpad = XtX(w) + XtBorderWidth(w); - ypad = XtY(w) + XtBorderWidth(w); - x1 += xpad; - y1 += ypad; - x2 += xpad; - y2 += ypad; + xpad = (Position)(XtX(w) + XtBorderWidth(w)); + ypad = (Position)(XtY(w) + XtBorderWidth(w)); + x1 = (Position)(x1 + xpad); + y1 = (Position)(y1 + ypad); + x2 = (Position)(x2 + xpad); + y2 = (Position)(y2 + ypad); display = XtDisplayOfObject(w); window = XtWindowOfObject(w); } @@ -851,17 +853,17 @@ DlArc(Widget w, XtPointer args, XtPointer data, Bool fill) } if (fill) - XFillArc(display, window, xdata->gc, x1, y1, x2 - x1, y2 - y1, + XFillArc(display, window, xdata->gc, x1, y1, (unsigned)(x2 - x1), (unsigned)(y2 - y1), arc->angle1, arc->angle2); else - XDrawArc(display, window, xdata->gc, x1, y1, x2 - x1, y2 - y1, + XDrawArc(display, window, xdata->gc, x1, y1, (unsigned)(x2 - x1), (unsigned)(y2 - y1), arc->angle1, arc->angle2); } /* ARGSUSED */ static void DlDrawArc(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { DlArc(w, args, data, False); } @@ -869,14 +871,14 @@ DlDrawArc(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlFillArc(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { DlArc(w, args, data, True); } /*ARGSUSED*/ static void -DlMask(Widget w, XtPointer args, XtPointer data, +DlMask(Widget w, XtPointer args _X_UNUSED, XtPointer data, XEvent *event, Region region) { XawXlibData *xdata = (XawXlibData *)data; @@ -888,18 +890,18 @@ DlMask(Widget w, XtPointer args, XtPointer data, { XRectangle rect; - rect.x = event->xexpose.x; - rect.y = event->xexpose.y; - rect.width = event->xexpose.width; - rect.height = event->xexpose.height; + rect.x = (short)event->xexpose.x; + rect.y = (short)event->xexpose.y; + rect.width = (unsigned short)event->xexpose.width; + rect.height = (unsigned short)event->xexpose.height; XSetClipRectangles(display, xdata->gc, 0, 0, &rect, 1, Unsorted); } } /* ARGSUSED */ static void -DlUmask(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) +DlUmask(Widget w, XtPointer args _X_UNUSED, XtPointer data, + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; @@ -909,22 +911,22 @@ DlUmask(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlLineWidth(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; - unsigned line_width = (unsigned long)args; + unsigned line_width = (unsigned)(unsigned long)args; if (xdata->values.line_width != line_width) { xdata->mask |= GCLineWidth; - xdata->values.line_width = line_width; + xdata->values.line_width = (int)line_width; XChangeGC(XtDisplayOfObject(w), xdata->gc, GCLineWidth, &xdata->values); } } /* ARGSUSED */ static void -DlDrawPoint(Widget w, XtPointer args, XtPointer data, XEvent *event, Region region) +DlDrawPoint(Widget w, XtPointer args, XtPointer data, XEvent *event _X_UNUSED, Region region _X_UNUSED) { Dl1Point(w, args, data, POINT); } @@ -932,7 +934,7 @@ DlDrawPoint(Widget w, XtPointer args, XtPointer data, XEvent *event, Region regi /* ARGSUSED */ static void DlDrawSegments(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawDLPositionPtr *pos_ptr = (XawDLPositionPtr *)args; XawXlibData *xdata = (XawXlibData *)data; @@ -959,14 +961,14 @@ DlDrawSegments(Widget w, XtPointer args, XtPointer data, { Position xpad, ypad; - xpad = XtX(w) + XtBorderWidth(w); - ypad = XtY(w) + XtBorderWidth(w); + xpad = (Position)(XtX(w) + XtBorderWidth(w)); + ypad = (Position)(XtY(w) + XtBorderWidth(w)); for (i = 0; i < num_segments; i++) { - segments[i].x1 += xpad; - segments[i].y1 += ypad; - segments[i].x2 += xpad; - segments[i].y2 += ypad; + segments[i].x1 = (short)(segments[i].x1 + xpad); + segments[i].y1 = (short)(segments[i].y1 + ypad); + segments[i].x2 = (short)(segments[i].x2 + xpad); + segments[i].y2 = (short)(segments[i].y2 + ypad); } display = XtDisplayOfObject(w); window = XtWindowOfObject(w); @@ -977,7 +979,7 @@ DlDrawSegments(Widget w, XtPointer args, XtPointer data, window = XtWindow(w); } - XDrawSegments(display, window, xdata->gc, segments, num_segments); + XDrawSegments(display, window, xdata->gc, segments, (int)num_segments); XawStackFree(segments, segments_buf); } @@ -985,10 +987,10 @@ DlDrawSegments(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlArcMode(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; - int arc_mode = (long)args; + int arc_mode = (int)(long)args; if (xdata->values.arc_mode != arc_mode) { @@ -1000,22 +1002,22 @@ DlArcMode(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void -DlCoordMode(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) +DlCoordMode(Widget w _X_UNUSED, XtPointer args, XtPointer data, + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; - int mode = (long)args; + int mode = (int)(long)args; xdata->mode = mode; } /* ARGSUSED */ static void -DlShapeMode(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) +DlShapeMode(Widget w _X_UNUSED, XtPointer args, XtPointer data, + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; - int shape = (long)args; + int shape = (int)(long)args; xdata->shape = shape; } @@ -1023,10 +1025,10 @@ DlShapeMode(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlLineStyle(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; - int line_style = (long)args; + int line_style = (int)(long)args; if (xdata->values.line_style != line_style) { @@ -1039,10 +1041,10 @@ DlLineStyle(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlCapStyle(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; - int cap_style = (long)args; + int cap_style = (int)(long)args; if (xdata->values.cap_style != cap_style) { @@ -1055,10 +1057,10 @@ DlCapStyle(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlJoinStyle(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; - int join_style = (long)args; + int join_style = (int)(long)args; if (xdata->values.join_style != join_style) { @@ -1071,10 +1073,10 @@ DlJoinStyle(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlFillStyle(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; - int fill_style = (long)args; + int fill_style = (int)(long)args; if (xdata->values.fill_style != fill_style) { @@ -1087,10 +1089,10 @@ DlFillStyle(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlFillRule(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; - int fill_rule = (long)args; + int fill_rule = (int)(long)args; if (xdata->values.fill_rule != fill_rule) { @@ -1103,7 +1105,7 @@ DlFillRule(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlTile(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; XawPixmap *pixmap = (XawPixmap *)args; @@ -1119,7 +1121,7 @@ DlTile(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlStipple(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; XawPixmap *pixmap = (XawPixmap *)args; @@ -1134,7 +1136,7 @@ DlStipple(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void -DlTSOrigin(Widget w, XtPointer args, XtPointer data, XEvent *event, Region region) +DlTSOrigin(Widget w, XtPointer args, XtPointer data, XEvent *event _X_UNUSED, Region region _X_UNUSED) { Dl1Point(w, args, data, TSORIGIN); } @@ -1142,10 +1144,10 @@ DlTSOrigin(Widget w, XtPointer args, XtPointer data, XEvent *event, Region regio /* ARGSUSED */ static void DlFunction(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; - int function = (long)args; + int function = (int)(long)args; if (function != xdata->values.function) { @@ -1158,7 +1160,7 @@ DlFunction(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlPlaneMask(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; unsigned long plane_mask = (unsigned long)args; @@ -1180,17 +1182,17 @@ DlString(Widget w, XtPointer args, XtPointer data, Bool image) Window window; Position x, y; - x = X_ARG(string->pos[0]); - y = Y_ARG(string->pos[1]); + x = (Position)(X_ARG(string->pos[0])); + y = (Position)(Y_ARG(string->pos[1])); if (!XtIsWidget(w)) { Position xpad, ypad; - xpad = XtX(w) + XtBorderWidth(w); - ypad = XtY(w) + XtBorderWidth(w); - x += xpad; - y += ypad; + xpad = (Position)(XtX(w) + XtBorderWidth(w)); + ypad = (Position)(XtY(w) + XtBorderWidth(w)); + x = (Position)(x + xpad); + y = (Position)(y + ypad); display = XtDisplayOfObject(w); window = XtWindowOfObject(w); } @@ -1209,7 +1211,7 @@ DlString(Widget w, XtPointer args, XtPointer data, Bool image) /* ARGSUSED */ static void DlDrawString(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { DlString(w, args, data, False); } @@ -1217,7 +1219,7 @@ DlDrawString(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlPaintString(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { DlString(w, args, data, True); } @@ -1225,7 +1227,7 @@ DlPaintString(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlFont(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; Font font = (Font)args; @@ -1241,7 +1243,7 @@ DlFont(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlDashes(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; char *dashes = args; @@ -1257,10 +1259,10 @@ DlDashes(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlSubwindowMode(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; - int subwindow_mode = (long)args; + int subwindow_mode = (int)(long)args; if (xdata->values.subwindow_mode != subwindow_mode) { @@ -1273,7 +1275,7 @@ DlSubwindowMode(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlExposures(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; Bool graphics_exposures = (Bool)(long)args; @@ -1288,7 +1290,7 @@ DlExposures(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void -DlClipOrigin(Widget w, XtPointer args, XtPointer data, XEvent *event, Region region) +DlClipOrigin(Widget w, XtPointer args, XtPointer data, XEvent *event _X_UNUSED, Region region _X_UNUSED) { Dl1Point(w, args, data, CLIPORIGIN); } @@ -1296,7 +1298,7 @@ DlClipOrigin(Widget w, XtPointer args, XtPointer data, XEvent *event, Region reg /* ARGSUSED */ static void DlClipMask(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawXlibData *xdata = (XawXlibData *)data; XawPixmap *pixmap = (XawPixmap *)args; @@ -1317,7 +1319,7 @@ DlClipMask(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlClipRectangles(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawDLPositionPtr *pos_ptr = (XawDLPositionPtr *)args; XawXlibData *xdata = (XawXlibData *)data; @@ -1339,24 +1341,24 @@ DlClipRectangles(Widget w, XtPointer args, XtPointer data, y2 = Y_ARG(pos[3]); rects[i].x = XawMin(x1, x2); rects[i].y = XawMin(y1, y2); - rects[i].width = XawMax(x1, x2) - rects[i].x; - rects[i].height = XawMax(y1, y2) - rects[i].y; + rects[i].width = (unsigned short)(XawMax(x1, x2) - rects[i].x); + rects[i].height = (unsigned short)(XawMax(y1, y2) - rects[i].y); } if (!XtIsWidget(w)) { Position xpad, ypad; - xpad = XtX(w) + XtBorderWidth(w); - ypad = XtY(w) + XtBorderWidth(w); + xpad = (Position)(XtX(w) + XtBorderWidth(w)); + ypad = (Position)(XtY(w) + XtBorderWidth(w)); for (i = 0; i < num_rects; i++) { - rects[i].x += xpad; - rects[i].y += ypad; + rects[i].x = (short)(rects[i].x + xpad); + rects[i].y = (short)(rects[i].y + ypad); } } - XSetClipRectangles(XtDisplayOfObject(w), xdata->gc, 0, 0, rects, num_rects, Unsorted); + XSetClipRectangles(XtDisplayOfObject(w), xdata->gc, 0, 0, rects, (int)num_rects, Unsorted); XawStackFree(rects, rects_buf); } @@ -1406,8 +1408,8 @@ DlCopy(Widget w, XtPointer args, XtPointer data, Bool plane) { Position xpad, ypad; - xpad = XtX(w) + XtBorderWidth(w); - ypad = XtY(w) + XtBorderWidth(w); + xpad = (Position)(XtX(w) + XtBorderWidth(w)); + ypad = (Position)(XtY(w) + XtBorderWidth(w)); src_x += xpad; src_y += ypad; dst_x += xpad; @@ -1417,18 +1419,18 @@ DlCopy(Widget w, XtPointer args, XtPointer data, Bool plane) if (plane) XCopyPlane(XtDisplayOfObject(w), XtWindowOfObject(w), copy->pixmap ? copy->pixmap->pixmap : XtWindowOfObject(w), - xdata->gc, src_x, src_y, width, height, dst_x, dst_y, - copy->plane ? copy->plane : 1); + xdata->gc, src_x, src_y, (unsigned)width, (unsigned)height, dst_x, dst_y, + (unsigned long)(copy->plane ? copy->plane : 1)); else XCopyArea(XtDisplayOfObject(w), copy->pixmap ? copy->pixmap->pixmap : XtWindowOfObject(w), - XtWindowOfObject(w), xdata->gc, src_x, src_y, width, height, dst_x, dst_y); + XtWindowOfObject(w), xdata->gc, src_x, src_y, (unsigned)width, (unsigned)height, dst_x, dst_y); } /* ARGSUSED */ static void DlCopyArea(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { DlCopy(w, args, data, False); } @@ -1436,7 +1438,7 @@ DlCopyArea(Widget w, XtPointer args, XtPointer data, /* ARGSUSED */ static void DlCopyPlane(Widget w, XtPointer args, XtPointer data, - XEvent *event, Region region) + XEvent *event _X_UNUSED, Region region _X_UNUSED) { DlCopy(w, args, data, True); } @@ -1449,7 +1451,7 @@ DlCopyPlane(Widget w, XtPointer args, XtPointer data, * set them after calling this function. */ static void -DlImage(Widget w, XtPointer args, XtPointer data, XEvent *event, Region region) +DlImage(Widget w, XtPointer args, XtPointer data, XEvent *event _X_UNUSED, Region region _X_UNUSED) { XawDLImageArgs *image = (XawDLImageArgs *)args; XawXlibData *xdata = (XawXlibData *)data; @@ -1473,8 +1475,8 @@ DlImage(Widget w, XtPointer args, XtPointer data, XEvent *event, Region region) { Position xpad, ypad; - xpad = XtX(w) + XtBorderWidth(w); - ypad = XtY(w) + XtBorderWidth(w); + xpad = (Position)(XtX(w) + XtBorderWidth(w)); + ypad = (Position)(XtY(w) + XtBorderWidth(w)); xe += xpad; ye += ypad; xe += xpad; @@ -1496,11 +1498,11 @@ DlImage(Widget w, XtPointer args, XtPointer data, XEvent *event, Region region) XSetClipMask(display, xdata->gc, image->pixmap->mask); if (image->depth == 1) XCopyPlane(display, image->pixmap->pixmap, window, xdata->gc, - 0, 0, XawMin(width, xe - x), XawMin(height, ye - y), + 0, 0, (unsigned)XawMin(width, xe - x), (unsigned)XawMin(height, ye - y), x, y, 1L); else XCopyArea(display, image->pixmap->pixmap, window, xdata->gc, 0, 0, - XawMin(width, xe - x), XawMin(height, ye - y), x, y); + (unsigned)XawMin(width, xe - x), (unsigned)XawMin(height, ye - y), x, y); } XSetClipMask(display, xdata->gc, None); @@ -1631,14 +1633,14 @@ read_position(char *arg, XawDLPosition *pos) ++str; if (ch == '-') pos->high = True; - pos->pos = read_int(str, NULL); + pos->pos = (Position)read_int(str, NULL); } else if (isdigit(ch)) { - pos->pos = read_int(str, &str); + pos->pos = (Position)read_int(str, &str); ch = *str++; if (ch == '/') - pos->denom = read_int(str, NULL); + pos->denom = (Position)read_int(str, NULL); } } @@ -1668,7 +1670,7 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params, XawDLPosition *pos = (XawDLPosition *)XtCalloc(1, sizeof(XawDLPosition) * 4); for (i = 0; i < 4; i++) - read_position(params[i], &pos[i]); + read_position((char *)params[i], &pos[i]); retval = (void *)pos; } break; @@ -1679,8 +1681,8 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params, { XawDLPosition *pos = (XawDLPosition *)XtCalloc(1, sizeof(XawDLPosition) * 2); - read_position(params[0], &pos[0]); - read_position(params[1], &pos[1]); + read_position((char *)params[0], &pos[0]); + read_position((char *)params[1], &pos[1]); retval = (void *)pos; } break; @@ -1691,11 +1693,11 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params, { XawDLPositionPtr *pos = XtNew(XawDLPositionPtr); - pos->pos = (XawDLPosition *)XtCalloc(1, sizeof(XawDLPosition) * - *num_params); + pos->pos = (XawDLPosition *)XtCalloc(1, (Cardinal)(sizeof(XawDLPosition) * + (size_t)*num_params)); pos->num_pos = *num_params; for (i = 0; i < *num_params; i++) - read_position(params[i], &pos->pos[i]); + read_position((char *)params[i], &pos->pos[i]); retval = (void *)pos; } break; @@ -1705,11 +1707,11 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params, { XawDLPositionPtr *pos = XtNew(XawDLPositionPtr); - pos->pos = (XawDLPosition *)XtCalloc(1, sizeof(XawDLPosition) * - *num_params); + pos->pos = (XawDLPosition *)XtCalloc(1, (Cardinal)(sizeof(XawDLPosition) * + (size_t)*num_params)); pos->num_pos = *num_params; for (i = 0; i < *num_params; i++) - read_position(params[i], &pos->pos[i]); + read_position((char *)params[i], &pos->pos[i]); retval = (void *)pos; } break; @@ -1722,11 +1724,11 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params, args->angle1 = 0; args->angle2 = 360; for (i = 0; i < 4; i++) - read_position(params[i], &args->pos[i]); + read_position((char *)params[i], &args->pos[i]); if (*num_params > 4) - args->angle1 = read_int(params[4], NULL); + args->angle1 = (int)read_int((char *)params[4], NULL); if (*num_params > 5) - args->angle2 = read_int(params[5], NULL); + args->angle2 = (int)read_int((char *)params[5], NULL); args->angle1 *= 64; args->angle2 *= 64; retval = (void *)args; @@ -1749,7 +1751,7 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params, break; case LWIDTH: if (*num_params == 1) - retval = (void *)read_int(params[0], NULL); + retval = (void *)read_int((char *)params[0], NULL); break; case ARCMODE: if (*num_params == 1) @@ -1894,7 +1896,7 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params, break; case PLANEMASK: if (*num_params == 1) - retval = (void *)read_int(params[0], NULL); + retval = (void *)read_int((char *)params[0], NULL); break; case DSTRING: case PSTRING: @@ -1903,10 +1905,10 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params, XawDLStringArgs *string = (XawDLStringArgs *) XtCalloc(1, sizeof(XawDLStringArgs)); - read_position(params[0], &string->pos[0]); - read_position(params[1], &string->pos[1]); + read_position((char *)params[0], &string->pos[0]); + read_position((char *)params[1], &string->pos[1]); string->string = XtNewString(params[2]); - string->length = strlen(string->string); + string->length = (int)strlen(string->string); retval = string; } break; @@ -1922,8 +1924,8 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params, dashes = XtMalloc(*num_params + 1); for (i = 0; i < *num_params; i++) - dashes[i + 1] = read_int(params[i], NULL); - *dashes = *num_params; + dashes[i + 1] = (char)read_int((char *)params[i], NULL); + *dashes = (char)*num_params; retval = dashes; } break; @@ -1940,7 +1942,7 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params, if (*num_params == 1) { if (isdigit(params[0][0]) || params[0][0] == '+' || params[0][0] == '-') - retval = (void *)read_int(params[0], NULL); + retval = (void *)read_int((char *)params[0], NULL); else if (XmuCompareISOLatin1(params[0], "true") == 0 || XmuCompareISOLatin1(params[0], "on") == 0) retval = (void *)True; @@ -1983,9 +1985,9 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params, if (retval != XAWDL_CONVERT_ERROR) { for (i = 1; i < *num_params && i < 7; i++) - read_position(params[i], &args->pos[i - 1]); + read_position((char *)params[i], &args->pos[i - 1]); if (*num_params > 7) - args->plane = read_int(params[7], NULL); + args->plane = (int)read_int((char *)params[7], NULL); } } break; @@ -2008,7 +2010,7 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params, { args->depth = depth; for (i = 1; i < *num_params && i < 5; i++) - read_position(params[i], &args->pos[i - 1]); + read_position((char *)params[i], &args->pos[i - 1]); } } break; @@ -2019,8 +2021,8 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params, /* ARGSUSED */ static void * -_Xaw_Xlib_DataInitProc(String class_name, - Screen *screen, Colormap colormap, int depth) +_Xaw_Xlib_DataInitProc(String class_name _X_UNUSED, + Screen *screen _X_UNUSED, Colormap colormap _X_UNUSED, int depth) { XawXlibData *data; Window tmp_win; @@ -2043,8 +2045,8 @@ _Xaw_Xlib_DataInitProc(String class_name, /* ARGSUSED */ static void -_Xaw_Xlib_ArgsDestructor(Display *display, String proc_name, XtPointer args, - String *params, Cardinal *num_params) +_Xaw_Xlib_ArgsDestructor(Display *display _X_UNUSED, String proc_name, XtPointer args, + String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { Cardinal id; Dl_init *init; @@ -2095,7 +2097,7 @@ _Xaw_Xlib_ArgsDestructor(Display *display, String proc_name, XtPointer args, /* ARGSUSED */ static void -_Xaw_Xlib_DataDestructor(Display *display, String class_name, XtPointer data) +_Xaw_Xlib_DataDestructor(Display *display, String class_name _X_UNUSED, XtPointer data) { if (data) { @@ -2144,7 +2146,7 @@ Bool XawDeclareDisplayListProc(XawDLClass *lc, String name, { ++lc->num_infos; lc->infos = (XawDLInfo **) - XtRealloc((char *)lc->infos, sizeof(XawDLInfo*) * lc->num_infos); + XtRealloc((char *)lc->infos, (Cardinal)(sizeof(XawDLInfo*) * (size_t)lc->num_infos)); } lc->infos[lc->num_infos - 1] = info; @@ -2218,7 +2220,7 @@ XawCreateDisplayListClass(String name, { ++num_classes; classes = (XawDLClass **)XtRealloc((char *)classes, - sizeof(XawDLClass) * num_classes); + (Cardinal)(sizeof(XawDLClass) * (size_t)num_classes)); } classes[num_classes - 1] = lc; diff --git a/lib/libXaw/src/Form.c b/lib/libXaw/src/Form.c index dcc26f3a6..ea33cbcf6 100644 --- a/lib/libXaw/src/Form.c +++ b/lib/libXaw/src/Form.c @@ -286,6 +286,9 @@ FormClassRec formClassRec = { /* form */ { Layout, /* layout */ +#ifndef OLDXAW + NULL, +#endif }, }; @@ -304,7 +307,7 @@ XawFormRealize(Widget w, Mask *mask, XSetWindowAttributes *attr) if (w->core.background_pixmap > XtUnspecifiedPixmap) { pixmap = XawPixmapFromXPixmap(w->core.background_pixmap, XtScreen(w), - w->core.colormap, w->core.depth); + w->core.colormap, (int)w->core.depth); if (pixmap && pixmap->mask) XawReshapeWidget(w, pixmap); } @@ -322,7 +325,7 @@ XawFormRedisplay(Widget w, XEvent *event, Region region) /*ARGSUSED*/ static void -_CvtStringToEdgeType(XrmValuePtr args, Cardinal *num_args, +_CvtStringToEdgeType(XrmValuePtr args _X_UNUSED, Cardinal *num_args _X_UNUSED, XrmValuePtr fromVal, XrmValuePtr toVal) { static XtEdgeType edgeType; @@ -355,8 +358,8 @@ _CvtStringToEdgeType(XrmValuePtr args, Cardinal *num_args, /*ARGSUSED*/ Boolean -CvtEdgeTypeToString(Display *dpy, XrmValuePtr args, Cardinal *num_args, - XrmValuePtr fromVal, XrmValuePtr toVal, XtPointer *data) +CvtEdgeTypeToString(Display *dpy, XrmValuePtr args _X_UNUSED, Cardinal *num_args _X_UNUSED, + XrmValuePtr fromVal, XrmValuePtr toVal, XtPointer *data _X_UNUSED) { static String buffer; Cardinal size; @@ -384,7 +387,7 @@ CvtEdgeTypeToString(Display *dpy, XrmValuePtr args, Cardinal *num_args, return (False); } - size = strlen(buffer) + 1; + size = (Cardinal)strlen(buffer) + 1; if (toVal->addr != NULL) { if (toVal->size < size) { toVal->size = size; @@ -443,8 +446,8 @@ XawFormClassPartInitialize(WidgetClass cclass) /*ARGSUSED*/ static void -XawFormInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawFormInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { FormWidget fw = (FormWidget)cnew; @@ -490,8 +493,8 @@ ChangeFormGeometry(Widget w, Bool query_only, if (width == XtWidth(fw) && height == XtHeight(fw)) return (True); - request.width = width; - request.height = height; + request.width = (Dimension)width; + request.height = (Dimension)height; request.request_mode = CWWidth | CWHeight; if (query_only) request.request_mode |= XtCWQueryOnly; @@ -540,10 +543,10 @@ ChangeFormGeometry(Widget w, Bool query_only, */ /*ARGSUSED*/ static Boolean -Layout(FormWidget fw, unsigned int width, unsigned int height, +Layout(FormWidget fw, unsigned int width _X_UNUSED, unsigned int height _X_UNUSED, Bool force_relayout) { - int num_children = fw->composite.num_children; + int num_children = (int)fw->composite.num_children; WidgetList children = fw->composite.children; Widget *childP; Dimension maxx, maxy; @@ -564,26 +567,26 @@ Layout(FormWidget fw, unsigned int width, unsigned int height, LayoutChild(*childP); - x = form->form.new_x + XtWidth(*childP) - + (XtBorderWidth(*childP) << 1); + x = (Position)(form->form.new_x + XtWidth(*childP) + + (XtBorderWidth(*childP) << 1)); if (x > (int)maxx) - maxx = x; + maxx = (Dimension)x; - y = form->form.new_y + XtHeight(*childP) - + (XtBorderWidth(*childP) << 1); + y = (Position)(form->form.new_y + XtHeight(*childP) + + (XtBorderWidth(*childP) << 1)); if (y > (int)maxy) - maxy = y; + maxy = (Dimension)y; } } - fw->form.preferred_width = (maxx += fw->form.default_spacing); - fw->form.preferred_height = (maxy += fw->form.default_spacing); + fw->form.preferred_width = (maxx = (Dimension)(maxx + fw->form.default_spacing)); + fw->form.preferred_height = (maxy = (Dimension)(maxy + fw->form.default_spacing)); if (fw->form.resize_in_layout) { Boolean always_resize_children; always_resize_children = - ChangeFormGeometry((Widget)fw, False, maxx, maxy, NULL, NULL); + (Boolean)ChangeFormGeometry((Widget)fw, False, maxx, maxy, NULL, NULL); #ifdef OLDXAW fw->form.old_width = fw->core.width; @@ -621,7 +624,7 @@ static void ResizeChildren(Widget w) { FormWidget fw = (FormWidget)w; - int num_children = fw->composite.num_children; + int num_children = (int)fw->composite.num_children; WidgetList children = fw->composite.children; Widget *childP; @@ -635,9 +638,9 @@ ResizeChildren(Widget w) form = (FormConstraints)(*childP)->core.constraints; if (fw->form.old_width && fw->form.old_height) { - x = TransformCoord(form->form.new_x, fw->form.old_width, + x = (Position)TransformCoord(form->form.new_x, fw->form.old_width, XtWidth(fw), form->form.left); - y = TransformCoord(form->form.new_y, fw->form.old_height, + y = (Position)TransformCoord(form->form.new_y, fw->form.old_height, XtHeight(fw), form->form.top); } else { @@ -687,21 +690,25 @@ LayoutChild(Widget w) } return; } - form->form.new_x = form->form.dx; - form->form.new_y = form->form.dy; + form->form.new_x = (Position)form->form.dx; + form->form.new_y = (Position)form->form.dy; if ((ref = form->form.horiz_base) != NULL) { FormConstraints ref_form = (FormConstraints)ref->core.constraints; LayoutChild(ref); - form->form.new_x += ref_form->form.new_x + XtWidth(ref) + - (XtBorderWidth(ref) << 1); + form->form.new_x = (Position)(form->form.new_x + + (ref_form->form.new_x + + XtWidth(ref) + + (XtBorderWidth(ref) << 1))); } if ((ref = form->form.vert_base) != NULL) { FormConstraints ref_form = (FormConstraints)ref->core.constraints; LayoutChild(ref); - form->form.new_y += ref_form->form.new_y + XtHeight(ref) + - (XtBorderWidth(ref) << 1); + form->form.new_y = (Position)(form->form.new_y + + (ref_form->form.new_y + + XtHeight(ref) + + (XtBorderWidth(ref) << 1))); } form->form.layout_state = LayoutDone; @@ -725,7 +732,7 @@ XawFormResize(Widget w) { FormWidget fw = (FormWidget)w; WidgetList children = fw->composite.children; - int num_children = fw->composite.num_children; + int num_children = (int)fw->composite.num_children; Widget *childP; int x, y; int width, height; @@ -781,7 +788,9 @@ XawFormResize(Widget w) width = width < 1 ? 1 : width; height = height < 1 ? 1 : height; - XtConfigureWidget(*childP, x, y, width, height, + XtConfigureWidget(*childP, + (Position)x, (Position)y, + (Dimension)width, (Dimension)height, XtBorderWidth(*childP)); } @@ -797,7 +806,7 @@ XawFormResize(Widget w) /*ARGSUSED*/ static XtGeometryResult XawFormGeometryManager(Widget w, XtWidgetGeometry *request, - XtWidgetGeometry *reply) + XtWidgetGeometry *reply _X_UNUSED) { Dimension old_width, old_height; FormWidget fw = (FormWidget)XtParent(w); @@ -863,7 +872,7 @@ XawFormGeometryManager(Widget w, XtWidgetGeometry *request, fw->form.resize_in_layout = True; - always_resize_children = ChangeFormGeometry(w, True, + always_resize_children = (Boolean)ChangeFormGeometry(w, True, fw->form.preferred_width, fw->form.preferred_height, &ret_width, &ret_height); @@ -879,7 +888,7 @@ XawFormGeometryManager(Widget w, XtWidgetGeometry *request, if ((*((FormWidgetClass)fw->core.widget_class)->form_class.layout) (fw, XtWidth(w), XtHeight(w), False)) { Widget *childP; - int num_children = fw->composite.num_children; + int num_children = (int)fw->composite.num_children; WidgetList children = fw->composite.children; if (fw->form.no_refigure) { @@ -913,8 +922,8 @@ XawFormGeometryManager(Widget w, XtWidgetGeometry *request, nform->form.virtual_x = XtX(nw); nform->form.virtual_y = XtY(nw); #endif - nform->form.virtual_width = XtWidth(nw); - nform->form.virtual_height = XtHeight(nw); + nform->form.virtual_width = (short)XtWidth(nw); + nform->form.virtual_height = (short)XtHeight(nw); } } } @@ -930,8 +939,8 @@ XawFormGeometryManager(Widget w, XtWidgetGeometry *request, /*ARGSUSED*/ static Boolean -XawFormSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawFormSetValues(Widget current _X_UNUSED, Widget request _X_UNUSED, Widget cnew _X_UNUSED, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { #ifndef OLDXAW FormWidget f_old = (FormWidget)current; @@ -941,9 +950,9 @@ XawFormSetValues(Widget current, Widget request, Widget cnew, XawPixmap *opix, *npix; opix = XawPixmapFromXPixmap(f_old->core.background_pixmap, XtScreen(f_old), - f_old->core.colormap, f_old->core.depth); + f_old->core.colormap, (int)f_old->core.depth); npix = XawPixmapFromXPixmap(f_new->core.background_pixmap, XtScreen(f_new), - f_new->core.colormap, f_new->core.depth); + f_new->core.colormap, (int)f_new->core.depth); if ((npix && npix->mask) || (opix && opix->mask)) XawReshapeWidget(cnew, npix); } @@ -954,8 +963,8 @@ XawFormSetValues(Widget current, Widget request, Widget cnew, /* ARGSUSED */ static void -XawFormConstraintInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawFormConstraintInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { FormConstraints form = (FormConstraints)cnew->core.constraints; FormWidget fw = (FormWidget)cnew->core.parent; @@ -964,8 +973,8 @@ XawFormConstraintInitialize(Widget request, Widget cnew, form->form.virtual_x = XtX(cnew); form->form.virtual_y = XtY(cnew); #endif - form->form.virtual_width = XtWidth(cnew); - form->form.virtual_height = XtHeight(cnew); + form->form.virtual_width = (short)XtWidth(cnew); + form->form.virtual_height = (short)XtHeight(cnew); if (form->form.dx == default_value) form->form.dx = fw->form.default_spacing; @@ -978,8 +987,8 @@ XawFormConstraintInitialize(Widget request, Widget cnew, /*ARGSUSED*/ static Boolean -XawFormConstraintSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawFormConstraintSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { FormConstraints cfc = (FormConstraints)current->core.constraints; FormConstraints nfc = (FormConstraints)cnew->core.constraints; @@ -1015,7 +1024,7 @@ XawFormChangeManaged(Widget w) FormWidget fw = (FormWidget)w; FormConstraints form; WidgetList children, childP; - int num_children = fw->composite.num_children; + int num_children = (int)fw->composite.num_children; Widget child; (*((FormWidgetClass)w->core.widget_class)->form_class.layout) @@ -1034,8 +1043,8 @@ XawFormChangeManaged(Widget w) form->form.virtual_x = XtX(child); form->form.virtual_y = XtY(child); #endif - form->form.virtual_width = XtWidth(child); - form->form.virtual_height = XtHeight(child); + form->form.virtual_width = (short)XtWidth(child); + form->form.virtual_height = (short)XtHeight(child); } } @@ -1076,7 +1085,7 @@ XawFormDoLayout(Widget w, { Widget *childP; FormWidget fw = (FormWidget)w; - int num_children = fw->composite.num_children; + int num_children = (int)fw->composite.num_children; WidgetList children = fw->composite.children; if ((fw->form.no_refigure = !force) == True || !XtIsRealized(w)) diff --git a/lib/libXaw/src/Grip.c b/lib/libXaw/src/Grip.c index 85f021b9c..1682a757b 100644 --- a/lib/libXaw/src/Grip.c +++ b/lib/libXaw/src/Grip.c @@ -92,7 +92,7 @@ static XtResource resources[] = { sizeof(Pixel), XtOffsetOf(GripRec, core.background_pixel), XtRString, - XtDefaultForeground + (XtPointer)XtDefaultForeground }, { XtNborderWidth, diff --git a/lib/libXaw/src/Label.c b/lib/libXaw/src/Label.c index 024d01aa8..4c95d4261 100644 --- a/lib/libXaw/src/Label.c +++ b/lib/libXaw/src/Label.c @@ -100,7 +100,7 @@ static XtResource resources[] = { sizeof(Pixel), offset(label.foreground), XtRString, - XtDefaultForeground + (XtPointer)XtDefaultForeground }, { XtNfont, @@ -109,7 +109,7 @@ static XtResource resources[] = { sizeof(XFontStruct*), offset(label.font), XtRString, - XtDefaultFont + (XtPointer)XtDefaultFont }, { XtNfontSet, @@ -118,7 +118,7 @@ static XtResource resources[] = { sizeof(XFontSet), offset(label.fontset), XtRString, - XtDefaultFontSet + (XtPointer)XtDefaultFontSet }, { XtNlabel, @@ -290,9 +290,9 @@ SetTextWidthAndHeight(LabelWidget lw) if (XGetGeometry(XtDisplay(lw), lw->label.pixmap, &root, &x, &y, &width, &height, &bw, &depth)) { - lw->label.label_height = height; - lw->label.label_width = width; - lw->label.label_len = depth; + lw->label.label_height = (Dimension)height; + lw->label.label_width = (Dimension)width; + lw->label.label_len = (Dimension)depth; return; } } @@ -314,26 +314,26 @@ SetTextWidthAndHeight(LabelWidget lw) int width = XmbTextEscapement(fset, label, (int)(nl - label)); if (width > (int)lw->label.label_width) - lw->label.label_width = width; + lw->label.label_width = (Dimension)width; label = nl + 1; if (*label) - lw->label.label_height += ext->max_ink_extent.height; + lw->label.label_height = (Dimension)(lw->label.label_height + ext->max_ink_extent.height); } if (*label) { - int width = XmbTextEscapement(fset, label, strlen(label)); + int width = XmbTextEscapement(fset, label, (int)strlen(label)); if (width > (int)lw->label.label_width) - lw->label.label_width = width; + lw->label.label_width = (Dimension)width; } } else { - lw->label.label_len = strlen(lw->label.label); + lw->label.label_len = (Dimension)strlen(lw->label.label); lw->label.label_width = - XmbTextEscapement(fset, lw->label.label, lw->label.label_len); + (Dimension)XmbTextEscapement(fset, lw->label.label, lw->label.label_len); } } else { - lw->label.label_height = fs->max_bounds.ascent + fs->max_bounds.descent; + lw->label.label_height = (Dimension)(fs->max_bounds.ascent + fs->max_bounds.descent); if (lw->label.label == NULL) { lw->label.label_len = 0; lw->label.label_width = 0; @@ -351,32 +351,32 @@ SetTextWidthAndHeight(LabelWidget lw) else width = XTextWidth(fs, label, (int)(nl - label)); if (width > (int)lw->label.label_width) - lw->label.label_width = width; + lw->label.label_width = (Dimension)width; label = nl + 1; if (*label) lw->label.label_height += fs->max_bounds.ascent + fs->max_bounds.descent; } if (*label) { - int width = XTextWidth(fs, label, strlen(label)); + int width = XTextWidth(fs, label, (int)strlen(label)); if (lw->label.encoding) - width = XTextWidth16(fs, (XChar2b *)label, strlen(label) / 2); + width = XTextWidth16(fs, (XChar2b *)label, (int)(strlen(label) / 2)); else - width = XTextWidth(fs, label, strlen(label)); + width = XTextWidth(fs, label, (int)strlen(label)); if (width > (int) lw->label.label_width) - lw->label.label_width = width; + lw->label.label_width = (Dimension)width; } } else { - lw->label.label_len = strlen(lw->label.label); + lw->label.label_len = (Dimension)strlen(lw->label.label); if (lw->label.encoding) lw->label.label_width = - XTextWidth16(fs, (XChar2b *)lw->label.label, + (Dimension)XTextWidth16(fs, (XChar2b *)lw->label.label, (int)lw->label.label_len / 2); else lw->label.label_width = - XTextWidth(fs, lw->label.label, (int)lw->label.label_len); + (Dimension)XTextWidth(fs, lw->label.label, (int)lw->label.label_len); } } } @@ -442,8 +442,9 @@ compute_bitmap_offsets(LabelWidget lw) * (internal_width, internal_height + lbm_y) */ if (lw->label.lbm_height != 0) - lw->label.lbm_y = (XtHeight(lw) - (lw->label.internal_height * 2 + - lw->label.lbm_height)) / 2; + lw->label.lbm_y = (int)((XtHeight(lw) + - ((lw->label.internal_height * 2) + + lw->label.lbm_height)) / 2); else lw->label.lbm_y = 0; } @@ -466,8 +467,8 @@ set_bitmap_info(LabelWidget lw) /*ARGSUSED*/ static void -XawLabelInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawLabelInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { LabelWidget lw = (LabelWidget)cnew; @@ -486,13 +487,14 @@ XawLabelInitialize(Widget request, Widget cnew, SetTextWidthAndHeight(lw); if (XtHeight(lw) == 0) - XtHeight(lw) = lw->label.label_height + 2 * lw->label.internal_height; + XtHeight(lw) = (Dimension)(lw->label.label_height + 2 * lw->label.internal_height); set_bitmap_info(lw); /* need core.height */ if (XtWidth(lw) == 0) /* need label.lbm_width */ - XtWidth(lw) = lw->label.label_width + 2 * lw->label.internal_width + - LEFT_OFFSET(lw); + XtWidth(lw) = (lw->label.label_width + + (2 * lw->label.internal_width) + + LEFT_OFFSET(lw)); lw->label.label_x = lw->label.label_y = 0; (*XtClass(cnew)->core_class.resize)((Widget)lw); @@ -517,7 +519,7 @@ XawLabelRedisplay(Widget gw, XEvent *event, Region region) if (w->label.pixmap == None) { int len = w->label.label_len; char *label = w->label.label; - Position y = w->label.label_y + w->label.font->max_bounds.ascent; + Position y = (Position)(w->label.label_y + w->label.font->max_bounds.ascent); Position ksy = w->label.label_y; /* display left bitmap */ @@ -530,7 +532,7 @@ XawLabelRedisplay(Widget gw, XEvent *event, Region region) if (w->simple.international == True) { XFontSetExtents *ext = XExtentsOfFontSet(w->label.fontset); - ksy += XawAbs(ext->max_ink_extent.y); + ksy = (ksy + XawAbs(ext->max_ink_extent.y)); if (len == MULTI_LINE_LABEL) { char *nl; @@ -539,10 +541,10 @@ XawLabelRedisplay(Widget gw, XEvent *event, Region region) XmbDrawString(XtDisplay(w), XtWindow(w), w->label.fontset, gc, w->label.label_x, ksy, label, (int)(nl - label)); - ksy += ext->max_ink_extent.height; + ksy = (ksy + ext->max_ink_extent.height); label = nl + 1; } - len = strlen(label); + len = (int)strlen(label); } if (len) XmbDrawString(XtDisplay(w), XtWindow(w), w->label.fontset, gc, @@ -560,11 +562,11 @@ XawLabelRedisplay(Widget gw, XEvent *event, Region region) else XDrawString(XtDisplay(gw), XtWindow(gw), gc, w->label.label_x, y, label, (int)(nl - label)); - y += w->label.font->max_bounds.ascent + - w->label.font->max_bounds.descent; + y += (w->label.font->max_bounds.ascent + + w->label.font->max_bounds.descent); label = nl + 1; } - len = strlen(label); + len = (int)strlen(label); } if (len) { if (w->label.encoding) @@ -596,28 +598,28 @@ _Reposition(LabelWidget lw, unsigned int width, unsigned int height, Position *dx, Position *dy) { Position newPos; - Position leftedge = lw->label.internal_width + LEFT_OFFSET(lw); + Position leftedge = (lw->label.internal_width + LEFT_OFFSET(lw)); switch (lw->label.justify) { case XtJustifyLeft: newPos = leftedge; break; case XtJustifyRight: - newPos = width - (lw->label.label_width + lw->label.internal_width); + newPos = (Position)(width - (unsigned)(lw->label.label_width + lw->label.internal_width)); break; case XtJustifyCenter: /*FALLTRHOUGH*/ default: - newPos = (int)(width - lw->label.label_width) >> 1; + newPos = (Position)((int)(width - lw->label.label_width) >> 1); break; } if (newPos < (Position)leftedge) newPos = leftedge; - *dx = newPos - lw->label.label_x; + *dx = (Position)(newPos - lw->label.label_x); lw->label.label_x = newPos; - newPos = (height - lw->label.label_height) >> 1; - *dy = newPos - lw->label.label_y; + newPos = (Position)((height - lw->label.label_height) >> 1); + *dy = (Position)(newPos - lw->label.label_y); lw->label.label_y = newPos; } @@ -658,7 +660,7 @@ XawLabelSetValues(Widget current, Widget request, Widget cnew, } if (newlw->label.label == NULL) - newlw->label.label = newlw->core.name; + newlw->label.label = (char *)newlw->core.name; /* * resize on bitmap change @@ -692,14 +694,15 @@ XawLabelSetValues(Widget current, Widget request, Widget cnew, /* recalculate the window size if something has changed */ if (newlw->label.resize && was_resized) { if (XtHeight(curlw) == XtHeight(reqlw) && !checks[HEIGHT]) - XtHeight(newlw) = newlw->label.label_height + - (newlw->label.internal_height << 1); + XtHeight(newlw) = (Dimension)(newlw->label.label_height + + (newlw->label.internal_height << 1)); set_bitmap_info(newlw); if (XtWidth(curlw) == XtWidth(reqlw) && !checks[WIDTH]) - XtWidth(newlw) = newlw->label.label_width + LEFT_OFFSET(newlw) + - (newlw->label.internal_width << 1); + XtWidth(newlw) = (newlw->label.label_width + + LEFT_OFFSET(newlw) + + (unsigned)(newlw->label.internal_width << 1)); } if (curlw->label.foreground != newlw->label.foreground @@ -750,10 +753,11 @@ XawLabelQueryGeometry(Widget w, XtWidgetGeometry *intended, LabelWidget lw = (LabelWidget)w; preferred->request_mode = CWWidth | CWHeight; - preferred->width = lw->label.label_width + - (lw->label.internal_width << 1) + LEFT_OFFSET(lw); - preferred->height = lw->label.label_height + - (lw->label.internal_height << 1); + preferred->width = (lw->label.label_width + + (unsigned)(lw->label.internal_width << 1) + + LEFT_OFFSET(lw)); + preferred->height = (Dimension)(lw->label.label_height + + (lw->label.internal_height << 1)); if (((intended->request_mode & (CWWidth | CWHeight)) == (CWWidth | CWHeight)) && intended->width == preferred->width diff --git a/lib/libXaw/src/List.c b/lib/libXaw/src/List.c index ce0ab5f23..a68a7bdd0 100644 --- a/lib/libXaw/src/List.c +++ b/lib/libXaw/src/List.c @@ -105,7 +105,7 @@ static XtResource resources[] = { sizeof(Pixel), offset(list.foreground), XtRString, - XtDefaultForeground + (XtPointer)XtDefaultForeground }, { XtNcursor, @@ -114,7 +114,7 @@ static XtResource resources[] = { sizeof(Cursor), offset(simple.cursor), XtRString, - "left_ptr" + (XtPointer)"left_ptr" }, { XtNfont, @@ -123,7 +123,7 @@ static XtResource resources[] = { sizeof(XFontStruct*), offset(list.font), XtRString, - XtDefaultFont + (XtPointer)XtDefaultFont }, { XtNfontSet, @@ -132,7 +132,7 @@ static XtResource resources[] = { sizeof(XFontSet), offset(list.fontset), XtRString, - XtDefaultFontSet + (XtPointer)XtDefaultFontSet }, { XtNlist, @@ -374,10 +374,10 @@ CalculatedValues(Widget w) for (i = 0 ; i < lw->list.nitems; i++) { if (lw->simple.international == True) len = XmbTextEscapement(lw->list.fontset, lw->list.list[i], - strlen(lw->list.list[i])); + (int)strlen(lw->list.list[i])); else len = XTextWidth(lw->list.font, lw->list.list[i], - strlen(lw->list.list[i])); + (int)strlen(lw->list.list[i])); if (len > lw->list.longest) lw->list.longest = len; } @@ -435,8 +435,8 @@ ChangeSize(Widget w, unsigned int width, unsigned int height) XtWidgetGeometry request, reply; request.request_mode = CWWidth | CWHeight; - request.width = width; - request.height = height; + request.width = (Dimension)width; + request.height = (Dimension)height; switch (XtMakeGeometryRequest(w, &request, &reply)) { case XtGeometryYes: @@ -467,7 +467,7 @@ ChangeSize(Widget w, unsigned int width, unsigned int height) /*ARGSUSED*/ static void -XawListInitialize(Widget temp1, Widget cnew, ArgList args, Cardinal *num_args) +XawListInitialize(Widget temp1 _X_UNUSED, Widget cnew, ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { ListWidget lw = (ListWidget)cnew; @@ -628,10 +628,10 @@ static void HighlightBackground(Widget w, int x, int y, GC gc) { ListWidget lw = (ListWidget)w; - Dimension width = lw->list.col_width; - Dimension height = lw->list.row_height; - Dimension frame_limited_width = XtWidth(w) - lw->list.internal_width - x; - Dimension frame_limited_height= XtHeight(w) - lw->list.internal_height - y; + Dimension width = (Dimension)lw->list.col_width; + Dimension height = (Dimension)lw->list.row_height; + Dimension frame_limited_width = (Dimension)(XtWidth(w) - lw->list.internal_width - x); + Dimension frame_limited_height= (Dimension)(XtHeight(w) - lw->list.internal_height - y); /* Clip the rectangle width and height to the edge of the drawable area */ if (width > frame_limited_width) @@ -641,11 +641,11 @@ HighlightBackground(Widget w, int x, int y, GC gc) /* Clip the rectangle x and y to the edge of the drawable area */ if (x < lw->list.internal_width) { - width = width - (lw->list.internal_width - x); + width = (Dimension)(width - (lw->list.internal_width - x)); x = lw->list.internal_width; } if (y < lw->list.internal_height) { - height = height - (lw->list.internal_height - y); + height = (Dimension)(height - (lw->list.internal_height - y)); y = lw->list.internal_height; } @@ -670,12 +670,12 @@ ClipToShadowInteriorAndLongest(ListWidget lw, GC *gc_p, unsigned int x) { XRectangle rect; - rect.x = x; - rect.y = lw->list.internal_height; - rect.height = XtHeight(lw) - (lw->list.internal_height << 1); - rect.width = XtWidth(lw) - lw->list.internal_width - x; + rect.x = (short)x; + rect.y = (short)lw->list.internal_height; + rect.height = (unsigned short)(XtHeight(lw) - (lw->list.internal_height << 1)); + rect.width = (unsigned short)(XtWidth(lw) - (unsigned)lw->list.internal_width - x); if (rect.width > lw->list.longest) - rect.width = lw->list.longest; + rect.width = (unsigned short)lw->list.longest; XSetClipRectangles(XtDisplay((Widget)lw), *gc_p, 0, 0, &rect, 1, YXBanded); } @@ -683,7 +683,7 @@ ClipToShadowInteriorAndLongest(ListWidget lw, GC *gc_p, unsigned int x) static void PaintItemName(Widget w, int item) { - char *str; + _Xconst char *str; GC gc; int x, y, str_y; ListWidget lw = (ListWidget)w; @@ -748,13 +748,13 @@ PaintItemName(Widget w, int item) str = lw->list.list[item]; /* draw it */ - ClipToShadowInteriorAndLongest(lw, &gc, x); + ClipToShadowInteriorAndLongest(lw, &gc, (unsigned)x); if (lw->simple.international == True) XmbDrawString(XtDisplay(w), XtWindow(w), lw->list.fontset, - gc, x, str_y, str, strlen(str)); + gc, x, str_y, str, (int)strlen(str)); else - XDrawString(XtDisplay(w), XtWindow(w), gc, x, str_y, str, strlen(str)); + XDrawString(XtDisplay(w), XtWindow(w), gc, x, str_y, str, (int)strlen(str)); XSetClipMask(XtDisplay(w), gc, None); } @@ -876,13 +876,13 @@ Layout(Widget w, Bool xfree, Bool yfree, Dimension *width, Dimension *height) /* this counts the same number of inter-column column_space 's as columns. There should thus be a half column_space margin on each side of each column...*/ - width2 = lw->list.ncols * lw->list.col_width + - (lw->list.internal_width << 1); + width2 = (unsigned long)(lw->list.ncols * lw->list.col_width + + (lw->list.internal_width << 1)); change = True; } if (yfree) { - height2 = lw->list.nrows * lw->list.row_height + - (lw->list.internal_height << 1); + height2 = (unsigned long)(lw->list.nrows * lw->list.row_height + + (lw->list.internal_height << 1)); change = True; } } @@ -902,10 +902,10 @@ Layout(Widget w, Bool xfree, Bool yfree, Dimension *width, Dimension *height) || (lw->list.ncols = wid / lw->list.col_width) <= 0) lw->list.ncols = 1; } - width2 = lw->list.ncols * lw->list.col_width - + (lw->list.internal_width << 1); - height2 = (lw->list.nrows * lw->list.row_height) - + (lw->list.internal_height << 1); + width2 = (unsigned long)((lw->list.ncols * lw->list.col_width) + + (lw->list.internal_width << 1)); + height2 = (unsigned long)((lw->list.nrows * lw->list.row_height) + + (lw->list.internal_height << 1)); change = True; } @@ -921,8 +921,8 @@ Layout(Widget w, Bool xfree, Bool yfree, Dimension *width, Dimension *height) lw->list.ncols = 1; lw->list.nrows = ((lw->list.nitems - 1) / lw->list.ncols) + 1; if (yfree) { - height2 = lw->list.nrows * lw->list.row_height + - (lw->list.internal_height << 1); + height2 = (unsigned long)((lw->list.nrows * lw->list.row_height) + + (lw->list.internal_height << 1)); change = True; } } @@ -938,8 +938,8 @@ Layout(Widget w, Bool xfree, Bool yfree, Dimension *width, Dimension *height) if (lw->list.nrows <= 0) lw->list.nrows = 1; lw->list.ncols = ((lw->list.nitems - 1) / lw->list.nrows) + 1; - width2 = lw->list.ncols * lw->list.col_width + - (lw->list.internal_width << 1); + width2 = (unsigned long)((lw->list.ncols * lw->list.col_width) + + (lw->list.internal_width << 1)); change = True; } @@ -947,10 +947,10 @@ Layout(Widget w, Bool xfree, Bool yfree, Dimension *width, Dimension *height) /*CONSTCOND*/ while (1) { lw->list.nrows = ((lw->list.nitems - 1) / lw->list.ncols) + 1; - width2 = lw->list.ncols * lw->list.col_width + - (lw->list.internal_width << 1); - height2 = lw->list.nrows * lw->list.row_height + - (lw->list.internal_height << 1); + width2 = (unsigned long)((lw->list.ncols * lw->list.col_width) + + (lw->list.internal_width << 1)); + height2 = (unsigned long)((lw->list.nrows * lw->list.row_height) + + (lw->list.internal_height << 1)); if (width2 >= MaxSize && height2 >= MaxSize) break; if (height2 > MaxSize) @@ -962,9 +962,9 @@ Layout(Widget w, Bool xfree, Bool yfree, Dimension *width, Dimension *height) } } if (width2) - *width = width2; + *width = (Dimension)width2; if (height2) - *height = height2; + *height = (Dimension)height2; return (change); } @@ -976,7 +976,7 @@ Layout(Widget w, Bool xfree, Bool yfree, Dimension *width, Dimension *height) * then the name of the item is also put in CUT_BUFFER0 */ /*ARGSUSED*/ static void -Notify(Widget w, XEvent *event, String *params, Cardinal *num_params) +Notify(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { ListWidget lw = (ListWidget)w; int item, item_len; @@ -1001,7 +1001,7 @@ Notify(Widget w, XEvent *event, String *params, Cardinal *num_params) return; } - item_len = strlen(lw->list.list[item]); + item_len = (int)strlen(lw->list.list[item]); if (lw->list.paste) /* if XtNpasteBuffer set then paste it */ XStoreBytes(XtDisplay(w), lw->list.list[item], item_len); @@ -1023,7 +1023,7 @@ Notify(Widget w, XEvent *event, String *params, Cardinal *num_params) * unhighlights the current element */ /*ARGSUSED*/ static void -Unset(Widget w, XEvent *event, String *params, Cardinal *num_params) +Unset(Widget w, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { XawListUnhighlight(w); } @@ -1033,7 +1033,7 @@ Unset(Widget w, XEvent *event, String *params, Cardinal *num_params) * Highlights the current element */ /*ARGSUSED*/ static void -Set(Widget w, XEvent *event, String *params, Cardinal *num_params) +Set(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { int item; ListWidget lw = (ListWidget)w; @@ -1053,7 +1053,7 @@ Set(Widget w, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static Boolean XawListSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { ListWidget cl = (ListWidget)current; ListWidget rl = (ListWidget)request; @@ -1143,7 +1143,7 @@ XawListSetValues(Widget current, Widget request, Widget cnew, redraw = True; } - return (redraw); + return (Boolean)(redraw); } static void @@ -1178,7 +1178,7 @@ XawListDestroy(Widget w) * If nitems is <= 0 then the list needs to be NULL terminated */ void -XawListChange(Widget w, char **list, int nitems, int longest, +XawListChange(Widget w, _Xconst char **list, int nitems, int longest, #if NeedWidePrototypes int resize_it #else diff --git a/lib/libXaw/src/Makefile.am b/lib/libXaw/src/Makefile.am index befd850e9..b5f2bd145 100644 --- a/lib/libXaw/src/Makefile.am +++ b/lib/libXaw/src/Makefile.am @@ -55,10 +55,10 @@ COMMON_SOURCES = \ XawI18n.c \ XawI18n.h -COMMON_CFLAGS = \ +AM_CFLAGS = \ $(CWARNFLAGS) -COMMON_CPPFLAGS = \ +AM_CPPFLAGS = \ -I${top_srcdir}/include \ -DPROJECT_ROOT=\"$(prefix)\" @@ -67,10 +67,10 @@ if BUILD_XAW6 lib_LTLIBRARIES += libXaw6.la libXaw6_la_CPPFLAGS = \ - $(COMMON_CPPFLAGS) + $(AM_CPPFLAGS) libXaw6_la_CFLAGS = \ - $(COMMON_CFLAGS) \ + $(AM_CFLAGS) \ -DOLDXAW \ $(XAW6_CFLAGS) @@ -105,15 +105,15 @@ if BUILD_XAW7 lib_LTLIBRARIES += libXaw7.la libXaw7_la_CPPFLAGS = \ - $(COMMON_CPPFLAGS) + $(AM_CPPFLAGS) libXaw7_la_CFLAGS = \ - $(COMMON_CFLAGS) \ + $(AM_CFLAGS) \ -DXAW7 \ $(XAW7_CFLAGS) -libXaw7_la_SOURCES = \ - $(COMMON_SOURCES) \ +libXaw7_la_SOURCES = \ + $(COMMON_SOURCES) \ Tip.c libXaw7_la_LDFLAGS = -version-info 7:0:0 -no-undefined diff --git a/lib/libXaw/src/Makefile.in b/lib/libXaw/src/Makefile.in index 278250fe0..65e499ec5 100644 --- a/lib/libXaw/src/Makefile.in +++ b/lib/libXaw/src/Makefile.in @@ -355,6 +355,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -419,18 +420,18 @@ COMMON_SOURCES = \ XawI18n.c \ XawI18n.h -COMMON_CFLAGS = \ +AM_CFLAGS = \ $(CWARNFLAGS) -COMMON_CPPFLAGS = \ +AM_CPPFLAGS = \ -I${top_srcdir}/include \ -DPROJECT_ROOT=\"$(prefix)\" @BUILD_XAW6_TRUE@libXaw6_la_CPPFLAGS = \ -@BUILD_XAW6_TRUE@ $(COMMON_CPPFLAGS) +@BUILD_XAW6_TRUE@ $(AM_CPPFLAGS) @BUILD_XAW6_TRUE@libXaw6_la_CFLAGS = \ -@BUILD_XAW6_TRUE@ $(COMMON_CFLAGS) \ +@BUILD_XAW6_TRUE@ $(AM_CFLAGS) \ @BUILD_XAW6_TRUE@ -DOLDXAW \ @BUILD_XAW6_TRUE@ $(XAW6_CFLAGS) @@ -440,15 +441,15 @@ COMMON_CPPFLAGS = \ @BUILD_XAW6_TRUE@libXaw6_la_LDFLAGS = -version-info 6:1:0 -no-undefined @BUILD_XAW6_TRUE@libXaw6_la_LIBADD = $(XAW6_LIBS) @BUILD_XAW7_TRUE@libXaw7_la_CPPFLAGS = \ -@BUILD_XAW7_TRUE@ $(COMMON_CPPFLAGS) +@BUILD_XAW7_TRUE@ $(AM_CPPFLAGS) @BUILD_XAW7_TRUE@libXaw7_la_CFLAGS = \ -@BUILD_XAW7_TRUE@ $(COMMON_CFLAGS) \ +@BUILD_XAW7_TRUE@ $(AM_CFLAGS) \ @BUILD_XAW7_TRUE@ -DXAW7 \ @BUILD_XAW7_TRUE@ $(XAW7_CFLAGS) @BUILD_XAW7_TRUE@libXaw7_la_SOURCES = \ -@BUILD_XAW7_TRUE@ $(COMMON_SOURCES) \ +@BUILD_XAW7_TRUE@ $(COMMON_SOURCES) \ @BUILD_XAW7_TRUE@ Tip.c @BUILD_XAW7_TRUE@libXaw7_la_LDFLAGS = -version-info 7:0:0 -no-undefined diff --git a/lib/libXaw/src/MenuButton.c b/lib/libXaw/src/MenuButton.c index e1908512d..ff75d9002 100644 --- a/lib/libXaw/src/MenuButton.c +++ b/lib/libXaw/src/MenuButton.c @@ -160,8 +160,8 @@ XawMenuButtonClassInitialize(void) /*ARGSUSED*/ static void -XawMenuButtonInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawMenuButtonInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { MenuButtonWidget mbw = (MenuButtonWidget)cnew; @@ -180,8 +180,8 @@ XawMenuButtonDestroy(Widget w) /*ARGSUSED*/ static Boolean -XawMenuButtonSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawMenuButtonSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { MenuButtonWidget mbw_old = (MenuButtonWidget)current; MenuButtonWidget mbw_new = (MenuButtonWidget)cnew; @@ -199,7 +199,7 @@ XawMenuButtonSetValues(Widget current, Widget request, Widget cnew, /*ARGSUSED*/ static void -PopupMenu(Widget w, XEvent *event, String *params, Cardinal *num_params) +PopupMenu(Widget w, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { MenuButtonWidget mbw = (MenuButtonWidget)w; Widget menu = NULL, temp; diff --git a/lib/libXaw/src/MultiSink.c b/lib/libXaw/src/MultiSink.c index 77eb42fd9..3e9a6f379 100644 --- a/lib/libXaw/src/MultiSink.c +++ b/lib/libXaw/src/MultiSink.c @@ -140,7 +140,7 @@ static XtResource resources[] = { sizeof(XFontSet), offset(fontset), XtRString, - XtDefaultFontSet + (XtPointer)XtDefaultFontSet }, { XtNecho, @@ -308,7 +308,7 @@ PaintText(Widget w, GC gc, int x, int y, wchar_t *buf, int len, Bool clear_bg) MultiSinkObject sink = (MultiSinkObject)w; TextWidget ctx = (TextWidget)XtParent(w); XFontSet fontset = sink->multi_sink.fontset; - unsigned int width = XwcTextEscapement(fontset, buf, len); + unsigned int width = (unsigned)XwcTextEscapement(fontset, buf, len); if (((int)width) <= -x) /* Don't draw if we can't see it */ return (width); @@ -363,11 +363,11 @@ DisplayText(Widget w, int x, int y, y += abs(ext->max_logical_extent.y); for (j = 0; pos1 < pos2;) { - pos1 = XawTextSourceRead(source, pos1, &blk, (int) pos2 - pos1); + pos1 = XawTextSourceRead(source, pos1, &blk, (int) (pos2 - pos1)); for (k = 0; k < blk.length; k++) { if ((unsigned) j >= (sizeof(buf) / sizeof(wchar_t)) - 1) { /* buffer full, dump the text */ - if ((x += PaintText(w, gc, x, y, buf, j, clear_bg)) >= max_x) + if ((x = (int)((unsigned)x + PaintText(w, gc, x, y, buf, j, clear_bg))) >= max_x) return; j = 0; } @@ -379,10 +379,10 @@ DisplayText(Widget w, int x, int y, unsigned int width; if (j != 0 && - (x += PaintText(w, gc, x, y, buf, j, clear_bg)) >= max_x) + (x = (int)((unsigned)x + PaintText(w, gc, x, y, buf, j, clear_bg))) >= max_x) return; - width = CharWidth(sink, fontset, x, _Xaw_atowc(XawTAB)); + width = (unsigned)CharWidth(sink, fontset, x, _Xaw_atowc(XawTAB)); if (clear_bg) _XawTextSinkClearToBackground(w, x, y - abs(ext->max_logical_extent.y), @@ -393,7 +393,7 @@ DisplayText(Widget w, int x, int y, y - abs(ext->max_logical_extent.y), width, ext->max_logical_extent.height); - x += width; + x = (int)((unsigned)x + width); j = -1; } else if (XwcTextEscapement(sink->multi_sink.fontset, &buf[j], 1) @@ -427,11 +427,11 @@ GetCursorBounds(Widget w, XRectangle *rect) { MultiSinkObject sink = (MultiSinkObject)w; - rect->width = CharWidth(sink, sink->multi_sink.fontset, 0, _Xaw_atowc(XawSP)); + rect->width = (unsigned short)CharWidth(sink, sink->multi_sink.fontset, 0, _Xaw_atowc(XawSP)); rect->height = (XExtentsOfFontSet(sink->multi_sink.fontset) ->max_logical_extent.height); rect->x = sink->multi_sink.cursor_x; - rect->y = sink->multi_sink.cursor_y - (short)rect->height; + rect->y = (short)(sink->multi_sink.cursor_y - (short)rect->height); } /* @@ -481,9 +481,9 @@ InsertCursor(Widget w, int x, int y, XawTextInsertState state) if (!ochar) _XawTextSinkClearToBackground(w, sink->multi_sink.cursor_x, (sink->multi_sink.cursor_y - 1 - - fheight), CharWidth(sink, fontset, - 0, wspace[0]), - fheight); + fheight), + (unsigned)CharWidth(sink, fontset, 0, wspace[0]), + (unsigned)fheight); else { if (XwcTextEscapement(sink->multi_sink.fontset, ochar, 1) != 0) DisplayText(w, sink->multi_sink.cursor_x, @@ -527,13 +527,13 @@ InsertCursor(Widget w, int x, int y, XawTextInsertState state) sink->multi_sink.xorgc ? sink->multi_sink.xorgc : sink->multi_sink.normgc, x, y - 1 - fheight, - CharWidth(sink, fontset, 0, *nchar) - 1, - fheight - 1); + (unsigned)(CharWidth(sink, fontset, 0, *nchar) - 1), + (unsigned)(fheight - 1)); } } - sink->multi_sink.cursor_x = x; - sink->multi_sink.cursor_y = y; + sink->multi_sink.cursor_x = (short)x; + sink->multi_sink.cursor_y = (short)y; sink->multi_sink.laststate = state; sink->multi_sink.cursor_position = position; } @@ -556,12 +556,12 @@ 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++) { if (i >= blk.length) { i = 0; - XawTextSourceRead(source, pos, &blk, toPos - pos); + XawTextSourceRead(source, pos, &blk, (int)(toPos - pos)); if (blk.length == 0) break; } @@ -659,7 +659,7 @@ GetGC(MultiSinkObject sink) XGCValues values; /* XXX We dont want do share a gc that will change the clip-mask */ - values.clip_x_origin = (long)sink; + values.clip_x_origin = (int)(long)sink; values.clip_mask = None; values.graphics_exposures = False; @@ -711,8 +711,8 @@ XawMultiSinkClassInitialize(void) */ /* ARGSUSED */ static void -XawMultiSinkInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawMultiSinkInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { MultiSinkObject sink = (MultiSinkObject)cnew; @@ -766,8 +766,8 @@ XawMultiSinkResize(Widget w) (int)ctx->text.r_margin.right - (int)ctx->text.r_margin.left; height = (int)XtHeight(ctx) - (int)ctx->text.r_margin.top - (int)ctx->text.r_margin.bottom; - rect.width = width; - rect.height = height; + rect.width = (unsigned short)width; + rect.height = (unsigned short)height; if (sink->multi_sink.normgc) { if (width >= 0 && height >= 0) @@ -809,8 +809,8 @@ XawMultiSinkResize(Widget w) */ /*ARGSUSED*/ static Boolean -XawMultiSinkSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawMultiSinkSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { MultiSinkObject w = (MultiSinkObject)cnew; MultiSinkObject old_w = (MultiSinkObject)current; @@ -868,7 +868,7 @@ MaxLines(Widget w, unsigned int height) XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset); font_height = ext->max_logical_extent.height; - return (height / font_height); + return (int)(height / (unsigned)font_height); } /* @@ -938,22 +938,22 @@ SetTabs(Widget w, int tab_count, short* tabs) || figure_width == 0)) { if (font->per_char && font->min_char_or_byte2 <= '$' && font->max_char_or_byte2 >= '$') - figure_width = font->per_char['$' - font->min_char_or_byte2].width; + figure_width = (unsigned long)font->per_char['$' - font->min_char_or_byte2].width; else - figure_width = font->max_bounds.width; + figure_width = (unsigned long)font->max_bounds.width; } if (tab_count > sink->text_sink.tab_count) { sink->text_sink.tabs = (Position *) XtRealloc((char *)sink->text_sink.tabs, - (Cardinal)(tab_count * sizeof(Position))); + (Cardinal)((unsigned long)tab_count * sizeof(Position))); sink->text_sink.char_tabs = (short *) XtRealloc((char *)sink->text_sink.char_tabs, - (Cardinal)(tab_count * sizeof(short))); + (Cardinal)((unsigned long)tab_count * sizeof(short))); } for (i = 0 ; i < tab_count ; i++) { - sink->text_sink.tabs[i] = tabs[i] * figure_width; + sink->text_sink.tabs[i] = (Position)((unsigned long)tabs[i] * figure_width); sink->text_sink.char_tabs[i] = tabs[i]; } @@ -971,5 +971,5 @@ _XawMultiSinkPosToXY(Widget w, XawTextPosition pos, Position *x, Position *y) XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset); _XawTextPosToXY(w, pos, x, y); - *y += abs(ext->max_logical_extent.y); + *y = (Position)(*y + abs(ext->max_logical_extent.y)); } diff --git a/lib/libXaw/src/MultiSrc.c b/lib/libXaw/src/MultiSrc.c index 15bdaf8c7..b4a123c14 100644 --- a/lib/libXaw/src/MultiSrc.c +++ b/lib/libXaw/src/MultiSrc.c @@ -112,7 +112,7 @@ static FILE *InitStringOrFile(MultiSrcObject, Bool); static void LoadPieces(MultiSrcObject, FILE*, char*); static void RemovePiece(MultiSrcObject, MultiPiece*); static void RemoveOldStringOrFile(MultiSrcObject, Bool); -static String StorePiecesInString(MultiSrcObject); +static char * StorePiecesInString(MultiSrcObject); static Bool WriteToFile(String, String); static void GetDefaultPieceSize(Widget, int, XrmValue*); @@ -234,6 +234,9 @@ MultiSrcClassRec multiSrcClassRec = { Search, /* Search */ XtInheritSetSelection, /* SetSelection */ XtInheritConvertSelection, /* ConvertSelection */ +#ifndef OLDXAW + NULL +#endif }, /* multi_src */ { @@ -274,8 +277,8 @@ XawMultiSrcClassInitialize(void) */ /*ARGSUSED*/ static void -XawMultiSrcInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawMultiSrcInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { MultiSrcObject src = (MultiSrcObject)cnew; FILE *file; @@ -298,7 +301,7 @@ XawMultiSrcInitialize(Widget request, Widget cnew, if (file != NULL) fclose(file); - src->text_src.text_format = XawFmtWide; + src->text_src.text_format = (XrmQuark)XawFmtWide; } /* @@ -325,10 +328,10 @@ ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length) MultiPiece *piece = FindPiece(src, pos, &start); text->format = XawFmtWide; - text->firstPos = pos; + text->firstPos = (int)pos; text->ptr = (char *)(piece->text + (pos - start)); count = piece->used - (pos - start); - text->length = Max(0, (length > count) ? count : length); + text->length = (Max(0, (length > count) ? count : length)); return (pos + text->length); } @@ -420,7 +423,7 @@ ReplaceText(Widget w, XawTextPosition startPos, XawTextPosition endPos, end_piece->used -= endPos - end_first; if (end_piece->used != 0) memmove(end_piece->text, end_piece->text + endPos - end_first, - end_piece->used * sizeof(wchar_t)); + (size_t)end_piece->used * sizeof(wchar_t)); } else { /* We are fully in one piece */ if ((start_piece->used -= endPos - startPos) == 0) { @@ -430,7 +433,7 @@ ReplaceText(Widget w, XawTextPosition startPos, XawTextPosition endPos, else { memmove(start_piece->text + (startPos - start_first), start_piece->text + (endPos - start_first), - (start_piece->used - (startPos - start_first)) * + (size_t)(start_piece->used - (startPos - start_first)) * sizeof(wchar_t)); if (src->multi_src.use_string_in_place && ((src->multi_src.length - (endPos - startPos)) @@ -475,10 +478,10 @@ ReplaceText(Widget w, XawTextPosition startPos, XawTextPosition endPos, fill = Min((int)(src->multi_src.piece_size - start_piece->used), length); ptr = start_piece->text + (startPos - start_first); - memmove(ptr + fill, ptr, (start_piece->used - + memmove(ptr + fill, ptr, (size_t)(start_piece->used - (startPos - start_first)) * sizeof(wchar_t)); wptr =(wchar_t *)text.ptr; - (void)wcsncpy(ptr, wptr + firstPos, fill); + (void)wcsncpy(ptr, wptr + firstPos, (size_t)fill); startPos += fill; firstPos += fill; @@ -598,7 +601,7 @@ Scan(Widget w, register XawTextPosition position, XawTextScanType type, position += inc; if (type == XawstAlphaNumeric) { - if (!iswalnum(c)) { + if (!iswalnum((wint_t)c)) { if (non_space) break; } @@ -720,8 +723,8 @@ Search(Widget w, register XawTextPosition position, XawTextScanDirection dir, effectively factored out of the following computations */ /* STEP 3: SEARCH! */ - buf = (wchar_t *)XtMalloc(sizeof(wchar_t) * wtarget_len); - (void)wcsncpy(buf, wtarget, wtarget_len); + buf = (wchar_t *)XtMalloc((Cardinal)(sizeof(wchar_t) * (size_t)wtarget_len)); + (void)wcsncpy(buf, wtarget, (size_t)wtarget_len); piece = FindPiece(src, position, &first); ptr = (position - first) + piece->text; @@ -746,7 +749,7 @@ Search(Widget w, register XawTextPosition position, XawTextScanDirection dir, position += inc; while (ptr < piece->text) { - cnt = piece->text - ptr; + cnt = (int)(piece->text - ptr); piece = piece->prev; if (piece == NULL) { /* Begining of text */ @@ -757,7 +760,7 @@ Search(Widget w, register XawTextPosition position, XawTextScanDirection dir, } while (ptr >= piece->text + piece->used) { - cnt = ptr - (piece->text + piece->used); + cnt = (int)(ptr - (piece->text + piece->used)); piece = piece->next; if (piece == NULL) { /* End of text */ @@ -793,7 +796,7 @@ Search(Widget w, register XawTextPosition position, XawTextScanDirection dir, * True if redisplay is needed */ static Boolean -XawMultiSrcSetValues(Widget current, Widget request, Widget cnew, +XawMultiSrcSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, ArgList args, Cardinal *num_args) { MultiSrcObject src = (MultiSrcObject)cnew; @@ -841,7 +844,7 @@ XawMultiSrcSetValues(Widget current, Widget request, Widget cnew, if ( !total_reset && old_src->multi_src.piece_size != src->multi_src.piece_size) { - String mb_string = StorePiecesInString(old_src); + char * mb_string = StorePiecesInString(old_src); if (mb_string != 0) { FreeAllPieces(old_src); @@ -1031,13 +1034,13 @@ Bool _XawMultiSaveAsFile(Widget w, _Xconst char* name) { MultiSrcObject src = (MultiSrcObject)w; - String mb_string; + char * mb_string; Bool ret; mb_string = StorePiecesInString(src); if (mb_string != 0) { - ret = WriteToFile(mb_string, (char *)name); + ret = WriteToFile(mb_string, (String)name); XtFree(mb_string); return (ret); @@ -1114,21 +1117,21 @@ WriteToFile(String string, String name) * (or) * NULL: conversion error */ -static String +static char * StorePiecesInString(MultiSrcObject src) { wchar_t *wc_string; char *mb_string; - int char_count = src->multi_src.length; + int char_count = (int)src->multi_src.length; XawTextPosition first; MultiPiece *piece; /* I believe the char_count + 1 and the NULL termination are unneeded! FS */ - wc_string = (wchar_t*)XtMalloc((char_count + 1) * sizeof(wchar_t)); + wc_string = (wchar_t*)XtMalloc((Cardinal)((size_t)(char_count + 1) * sizeof(wchar_t))); for (first = 0, piece = src->multi_src.first_piece ; piece != NULL; first += piece->used, piece = piece->next) - (void)wcsncpy(wc_string + first, piece->text, piece->used); + (void)wcsncpy(wc_string + first, piece->text, (size_t)piece->used); wc_string[char_count] = 0; @@ -1173,24 +1176,24 @@ InitStringOrFile(MultiSrcObject src, Bool newString) else if (!src->multi_src.use_string_in_place) { int length; - String temp = XtNewString((char *)src->multi_src.string); + char * temp = XtNewString((char *)src->multi_src.string); if (src->multi_src.allocated_string) XtFree((char *)src->multi_src.string); src->multi_src.allocated_string = True; src->multi_src.string = temp; - length = strlen((char *)src->multi_src.string); + length = (int)strlen((char *)src->multi_src.string); /* Wasteful, throwing away the WC string, but need side effect! */ (void)_XawTextMBToWC(d, (char *)src->multi_src.string, &length); src->multi_src.length = (XawTextPosition)length; } else { - src->multi_src.length = strlen((char *)src->multi_src.string); + src->multi_src.length = (XawTextPosition)strlen((char *)src->multi_src.string); /* In case the length resource is incorrectly set */ if (src->multi_src.length > src->multi_src.multi_length) - src->multi_src.multi_length = src->multi_src.length; + src->multi_src.multi_length = (int)src->multi_src.length; if (src->multi_src.multi_length == MAGIC_VALUE) src->multi_src.piece_size = src->multi_src.length; @@ -1218,7 +1221,7 @@ InitStringOrFile(MultiSrcObject src, Bool newString) case XawtextAppend: case XawtextEdit: if (src->multi_src.string == NULL) { - src->multi_src.string = "*multi-src*"; + src->multi_src.string = (char *)"*multi-src*"; src->multi_src.is_tempfile = True; } else { @@ -1240,7 +1243,7 @@ InitStringOrFile(MultiSrcObject src, Bool newString) /* If is_tempfile, allocate a private copy of the text * Unlikely to be changed, just to set allocated_string */ if (newString || src->multi_src.is_tempfile) { - String temp = XtNewString((char *)src->multi_src.string); + char * temp = XtNewString((char *)src->multi_src.string); if (src->multi_src.allocated_string) XtFree((char *)src->multi_src.string); @@ -1249,7 +1252,7 @@ InitStringOrFile(MultiSrcObject src, Bool newString) } if (!src->multi_src.is_tempfile) { - if ((fd = open((char *)src->multi_src.string, open_mode, 0666)) != -1) { + if ((fd = open((char *)src->multi_src.string, (int)open_mode, 0666)) != -1) { if ((file = fdopen(fd, fdopen_mode)) != NULL) { (void)fseek(file, 0, SEEK_END); src->multi_src.length = (XawTextPosition)ftell(file); @@ -1296,7 +1299,7 @@ LoadPieces(MultiSrcObject src, FILE *file, char *string) * in as MB length, out as WC length. We want local_length to be * WC count. */ - int local_length = src->multi_src.length; + int local_length = (int)src->multi_src.length; if (string != NULL) { /* @@ -1312,24 +1315,24 @@ LoadPieces(MultiSrcObject src, FILE *file, char *string) * here, we are not changing the contents, just reloading, * so don't change len... */ - local_length = src->multi_src.string ? - strlen((char *)src->multi_src.string) : 0; + local_length = (int)(src->multi_src.string ? + strlen((char *)src->multi_src.string) : 0); local_str = _XawTextMBToWC(d, (char *)src->multi_src.string, &local_length); } else { if (src->multi_src.length != 0) { temp_mb_holder = - XtMalloc((src->multi_src.length + 1) * sizeof(unsigned char)); + XtMalloc(((size_t)(src->multi_src.length + 1) * sizeof(unsigned char))); fseek(file, 0, SEEK_SET); - src->multi_src.length = fread(temp_mb_holder, + src->multi_src.length = (XawTextPosition)fread(temp_mb_holder, sizeof(unsigned char), (size_t)src->multi_src.length, file); if (src->multi_src.length <= 0) XtAppErrorMsg(XtWidgetToApplicationContext ((Widget) src), "readError", "multiSource", "XawError", "fread returned error.", NULL, NULL); - local_length = src->multi_src.length; + local_length = (int)src->multi_src.length; local_str = _XawTextMBToWC(d, temp_mb_holder, &local_length); src->multi_src.length = local_length; @@ -1349,7 +1352,7 @@ LoadPieces(MultiSrcObject src, FILE *file, char *string) "not representable in this locale.", params, &num_params); src->multi_src.length = sizeof err_text; - local_length = src->multi_src.length; + local_length = (int)src->multi_src.length; local_str = _XawTextMBToWC(d, err_text, &local_length); src->multi_src.length = local_length; } @@ -1378,7 +1381,7 @@ LoadPieces(MultiSrcObject src, FILE *file, char *string) * bytes)); piece->used = Min(left, src->multi_src.piece_size); if (piece->used != 0) - (void)wcsncpy(piece->text, ptr, piece->used); + (void)wcsncpy(piece->text, ptr, (size_t)piece->used); left -= piece->used; ptr += piece->used; @@ -1527,16 +1530,16 @@ BreakPiece(MultiSrcObject src, MultiPiece *piece) MultiPiece *cnew = AllocNewPiece(src, piece); cnew->text = (wchar_t *) - XtMalloc(src->multi_src.piece_size * sizeof(wchar_t)); + XtMalloc((Cardinal)((size_t)src->multi_src.piece_size * sizeof(wchar_t))); (void)wcsncpy(cnew->text, piece->text + HALF_PIECE, - src->multi_src.piece_size - HALF_PIECE); + (size_t)(src->multi_src.piece_size - HALF_PIECE)); piece->used = HALF_PIECE; cnew->used = src->multi_src.piece_size - HALF_PIECE; } /*ARGSUSED*/ static void -CvtStringToMultiType(XrmValuePtr args, Cardinal *num_args, +CvtStringToMultiType(XrmValuePtr args _X_UNUSED, Cardinal *num_args _X_UNUSED, XrmValuePtr fromVal, XrmValuePtr toVal) { static XawAsciiType type = XawAsciiString; @@ -1562,9 +1565,9 @@ CvtStringToMultiType(XrmValuePtr args, Cardinal *num_args, /*ARGSUSED*/ static Boolean -CvtMultiTypeToString(Display *dpy, XrmValuePtr args, Cardinal *num_args, +CvtMultiTypeToString(Display *dpy, XrmValuePtr args _X_UNUSED, Cardinal *num_args _X_UNUSED, XrmValuePtr fromVal, XrmValuePtr toVal, - XtPointer *data) + XtPointer *data _X_UNUSED) { static String buffer; Cardinal size; @@ -1583,7 +1586,7 @@ CvtMultiTypeToString(Display *dpy, XrmValuePtr args, Cardinal *num_args, return (False); } - size = strlen(buffer) + 1; + size = (Cardinal)strlen(buffer) + 1; if (toVal->addr != NULL) { if (toVal->size < size) { toVal->size = size; @@ -1600,7 +1603,7 @@ CvtMultiTypeToString(Display *dpy, XrmValuePtr args, Cardinal *num_args, /*ARGSUSED*/ static void -GetDefaultPieceSize(Widget w, int offset, XrmValue *value) +GetDefaultPieceSize(Widget w _X_UNUSED, int offset _X_UNUSED, XrmValue *value) { static XPointer pagesize; diff --git a/lib/libXaw/src/OS.c b/lib/libXaw/src/OS.c index 4c69005c8..bbd4079c6 100644 --- a/lib/libXaw/src/OS.c +++ b/lib/libXaw/src/OS.c @@ -11,6 +11,12 @@ #include <unistd.h> /* for sysconf(), and getpagesize() */ #endif +#if defined(_WIN32) && !defined(__CYGWIN__) +/* AC_CHECK_FUNCS([getpagesize]) may report a false positive for + getpagesize() when using MinGW gcc, since it's present in libgcc.a */ +#undef HAVE_GETPAGESIZE +#endif + #if defined(linux) /* kernel header doesn't work with -ansi */ /* #include <asm/page.h> *//* for PAGE_SIZE */ @@ -28,12 +34,12 @@ _XawGetPageSize(void) /* Try each supported method in the preferred order */ #if defined(_SC_PAGESIZE) || defined(HAS_SC_PAGESIZE) - pagesize = sysconf(_SC_PAGESIZE); + pagesize = (int) sysconf(_SC_PAGESIZE); #endif #ifdef _SC_PAGE_SIZE if (pagesize == -1) - pagesize = sysconf(_SC_PAGE_SIZE); + pagesize = (int) sysconf(_SC_PAGE_SIZE); #endif #ifdef HAVE_GETPAGESIZE diff --git a/lib/libXaw/src/Paned.c b/lib/libXaw/src/Paned.c index 26ff81261..1cd5e4a9f 100644 --- a/lib/libXaw/src/Paned.c +++ b/lib/libXaw/src/Paned.c @@ -256,7 +256,7 @@ static XtResource resources[] = { sizeof(Cursor), offset(v_grip_cursor), XtRString, - "sb_v_double_arrow" + (XtPointer)"sb_v_double_arrow" }, { XtNhorizontalGripCursor, @@ -265,7 +265,7 @@ static XtResource resources[] = { sizeof(Cursor), offset(h_grip_cursor), XtRString, - "sb_h_double_arrow" + (XtPointer)"sb_h_double_arrow" }, { XtNbetweenCursor, @@ -283,7 +283,7 @@ static XtResource resources[] = { sizeof(Cursor), offset(v_adjust_this_cursor), XtRString, - "sb_left_arrow" + (XtPointer)"sb_left_arrow" }, { XtNhorizontalBetweenCursor, @@ -292,7 +292,7 @@ static XtResource resources[] = { sizeof(Cursor), offset(h_adjust_this_cursor), XtRString, - "sb_up_arrow" + (XtPointer)"sb_up_arrow" }, { XtNupperCursor, @@ -301,7 +301,7 @@ static XtResource resources[] = { sizeof(Cursor), offset(adjust_upper_cursor), XtRString, - "sb_up_arrow" + (XtPointer)"sb_up_arrow" }, { XtNlowerCursor, @@ -310,7 +310,7 @@ static XtResource resources[] = { sizeof(Cursor), offset(adjust_lower_cursor), XtRString, - "sb_down_arrow" + (XtPointer)"sb_down_arrow" }, { XtNleftCursor, @@ -319,7 +319,7 @@ static XtResource resources[] = { sizeof(Cursor), offset(adjust_left_cursor), XtRString, - "sb_left_arrow" + (XtPointer)"sb_left_arrow" }, { XtNrightCursor, @@ -328,7 +328,7 @@ static XtResource resources[] = { sizeof(Cursor), offset(adjust_right_cursor), XtRString, - "sb_right_arrow" + (XtPointer)"sb_right_arrow" }, }; #undef offset @@ -506,20 +506,20 @@ AdjustPanedSize(PanedWidget pw, unsigned int off_size, int size = Max(PaneInfo(*childP)->size, (int)PaneInfo(*childP)->min); AssignMin(size, (int)PaneInfo(*childP)->max); - newsize += size + pw->paned.internal_bw; + newsize = (newsize + (size + pw->paned.internal_bw)); } - newsize -= pw->paned.internal_bw; + newsize = (Dimension)(newsize - pw->paned.internal_bw); if (newsize < 1) newsize = 1; if (IsVert(pw)) { - request.width = off_size; + request.width = (Dimension)off_size; request.height = newsize; } else { request.width = newsize; - request.height = off_size; + request.height = (Dimension)off_size; } if (result_ret != NULL) { @@ -530,7 +530,7 @@ AdjustPanedSize(PanedWidget pw, unsigned int off_size, if (newsize == old_size || *result_ret == XtGeometryNo) { *on_size_ret = old_size; - *off_size_ret = off_size; + *off_size_ret = (Dimension)off_size; return; } if (*result_ret != XtGeometryAlmost) { @@ -679,7 +679,7 @@ LoopAndRefigureChildren(PanedWidget pw, int paneindex, Direction dir, * Try to resize this pane so that all panes will fit, take min and max * into account */ - old = pane->size; + old = (Dimension) pane->size; pane->size += pane_size - *sizeused; if (from_stack) { @@ -758,7 +758,7 @@ RefigureLocations(PanedWidget pw, int paneindex, Direction dir) */ if (paneindex != NO_INDEX && dir != AnyPane) { Pane pane = PaneInfo(*(pw->composite.children + paneindex)); - Dimension old = pane->size; + Dimension old = (Dimension)pane->size; pane->size += pane_size - sizeused; AssignMax(pane->size, (int) pane->min); @@ -774,7 +774,7 @@ RefigureLocations(PanedWidget pw, int paneindex, Direction dir) */ ForAllPanes(pw, childP) { PaneInfo(*childP)->delta = loc; - loc += PaneInfo(*childP)->size + pw->paned.internal_bw; + loc = (Position)(loc + (PaneInfo(*childP)->size + pw->paned.internal_bw)); } } @@ -802,7 +802,7 @@ CommitNewLocations(PanedWidget pw) if (IsVert(pw)) { XtMoveWidget(*childP, (Position) 0, pane->delta); - XtResizeWidget(*childP, XtWidth(pw), pane->size, 0); + XtResizeWidget(*childP, XtWidth(pw), (Dimension)pane->size, 0); if (HasGrip(*childP)) { /* Move and Display the Grip */ changes.x = XtWidth(pw) - pw->paned.grip_indent - @@ -814,7 +814,7 @@ CommitNewLocations(PanedWidget pw) } else { XtMoveWidget(*childP, pane->delta, 0); - XtResizeWidget(*childP, pane->size, XtHeight(pw), 0); + XtResizeWidget(*childP, (Dimension)pane->size, (Dimension)XtHeight(pw), 0); if (HasGrip(*childP)) { /* Move and Display the Grip */ changes.x = XtX(*childP) + XtWidth(*childP) - @@ -831,8 +831,8 @@ CommitNewLocations(PanedWidget pw) */ if (HasGrip(*childP)) { - XtX(grip) = changes.x; - XtY(grip) = changes.y; + XtX(grip) = (Position)changes.x; + XtY(grip) = (Position)changes.y; if (XtIsRealized(pane->grip)) XConfigureWindow(XtDisplay(pane->grip), XtWindow(pane->grip), @@ -1165,12 +1165,12 @@ CommitGripAdjustment(PanedWidget pw) if (pw->paned.whichadd) { Pane pane = PaneInfo(pw->paned.whichadd); - pane->wp_size = pane->size; + pane->wp_size = (Dimension)pane->size; } if (pw->paned.whichsub) { Pane pane = PaneInfo(pw->paned.whichsub); - pane->wp_size = pane->size; + pane->wp_size = (Dimension)pane->size; } } @@ -1188,7 +1188,7 @@ CommitGripAdjustment(PanedWidget pw) */ /*ARGSUSED*/ static void -HandleGrip(Widget grip, XtPointer temp, XtPointer callData) +HandleGrip(Widget grip, XtPointer temp _X_UNUSED, XtPointer callData) { XawGripCallData call_data = (XawGripCallData)callData; PanedWidget pw = (PanedWidget) XtParent(grip); @@ -1293,7 +1293,7 @@ ManageAndUnmanageGrips(PanedWidget pw) Widget *managedP, *unmanagedP, *childP; Cardinal alloc_size; - alloc_size = sizeof(Widget) * (pw->composite.num_children >> 1); + alloc_size = (Cardinal)(sizeof(Widget) * (pw->composite.num_children >> 1)); managedP = managed_grips = (WidgetList)XtMalloc(alloc_size); unmanagedP = unmanaged_grips = (WidgetList)XtMalloc(alloc_size); @@ -1307,11 +1307,11 @@ ManageAndUnmanageGrips(PanedWidget pw) if (managedP != managed_grips) { *unmanagedP++ = *--managedP; /* Last grip is never managed */ - XtManageChildren(managed_grips, managedP - managed_grips); + XtManageChildren(managed_grips, (Cardinal)(managedP - managed_grips)); } if (unmanagedP != unmanaged_grips) - XtUnmanageChildren(unmanaged_grips, unmanagedP - unmanaged_grips); + XtUnmanageChildren(unmanaged_grips, (Cardinal)(unmanagedP - unmanaged_grips)); XtFree((char *)managed_grips); XtFree((char *)unmanaged_grips); @@ -1417,11 +1417,11 @@ SetChildrenPrefSizes(PanedWidget pw, unsigned int off_size) else { if(vert) { request.request_mode = CWWidth; - request.width = off_size; + request.width = (Dimension) off_size; } else { request.request_mode = CWHeight; - request.height = off_size; + request.height = (Dimension) off_size; } if ((XtQueryGeometry(*childP, &request, &reply) @@ -1613,15 +1613,15 @@ XawPanedGeometryManager(Widget w, XtWidgetGeometry *request, if ((XtIsRealized((Widget)pw) && !pane->allow_resize) || !(mask & (vert ? CWHeight : CWWidth)) - ||(mask & ~(CWWidth | CWHeight)) + || (mask & (XtGeometryMask)(~(CWWidth | CWHeight))) || GetRequestInfo(request, vert) == PaneSize(w, vert)) return (XtGeometryNo); old_paned_size = PaneSize((Widget)pw, vert); old_wpsize = pane->wp_size; - old_size = pane->size; + old_size = (Dimension)pane->size; - pane->wp_size = pane->size = GetRequestInfo(request, vert); + pane->wp_size = (Dimension)(pane->size = GetRequestInfo(request, vert)); AdjustPanedSize(pw, PaneSize((Widget)pw, !vert), &result, &on_size, &off_size); @@ -1645,13 +1645,13 @@ XawPanedGeometryManager(Widget w, XtWidgetGeometry *request, */ if (vert) { XtHeight(pw) = old_paned_size; - reply->height = pane->size; + reply->height = (Dimension) pane->size; reply->width = off_size; } else { XtWidth(pw) = old_paned_size; reply->height = off_size; - reply->width = pane->size; + reply->width = (Dimension) pane->size; } /* @@ -1673,7 +1673,7 @@ XawPanedGeometryManager(Widget w, XtWidgetGeometry *request, } almost = GetRequestInfo(request, !vert) != GetRequestInfo(reply, !vert); - almost |= (GetRequestInfo(request, vert) != GetRequestInfo(reply, vert)); + almost = (Boolean)(almost | (GetRequestInfo(request, vert) != GetRequestInfo(reply, vert))); if ((mask & XtCWQueryOnly) || almost) { pane->wp_size = old_wpsize; @@ -1693,8 +1693,8 @@ XawPanedGeometryManager(Widget w, XtWidgetGeometry *request, /*ARGSUSED*/ static void -XawPanedInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawPanedInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { PanedWidget pw = (PanedWidget)cnew; @@ -1851,15 +1851,15 @@ XawPanedResize(Widget w) /*ARGSUSED*/ static void -XawPanedRedisplay(Widget w, XEvent *event, Region region) +XawPanedRedisplay(Widget w, XEvent *event _X_UNUSED, Region region _X_UNUSED) { DrawInternalBorders((PanedWidget)w); } /*ARGSUSED*/ static Boolean -XawPanedSetValues(Widget old, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawPanedSetValues(Widget old, Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { PanedWidget old_pw = (PanedWidget)old; PanedWidget new_pw = (PanedWidget)cnew; @@ -1916,8 +1916,8 @@ XawPanedSetValues(Widget old, Widget request, Widget cnew, /*ARGSUSED*/ static Boolean -XawPanedPaneSetValues(Widget old, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawPanedPaneSetValues(Widget old, Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { Pane old_pane = PaneInfo(old); Pane new_pane = PaneInfo(cnew); @@ -1970,8 +1970,8 @@ XawPanedSetMinMax(Widget widget, int min, int max) { Pane pane = PaneInfo(widget); - pane->min = min; - pane->max = max; + pane->min = (Dimension) min; + pane->max = (Dimension) max; RefigureLocationsAndCommit(widget->core.parent); } diff --git a/lib/libXaw/src/Panner.c b/lib/libXaw/src/Panner.c index aa902336e..eada8f9f8 100644 --- a/lib/libXaw/src/Panner.c +++ b/lib/libXaw/src/Panner.c @@ -67,7 +67,7 @@ static void check_knob(PannerWidget, Bool); static void get_default_size(PannerWidget, Dimension*, Dimension*); static Bool get_event_xy(PannerWidget, XEvent*, int*, int*); static void move_shadow(PannerWidget); -static int parse_page_string(char*, int, int, Bool*); +static int parse_page_string(String, int, int, Bool*); static void rescale(PannerWidget); static void reset_shadow_gc(PannerWidget); static void reset_slider_gc(PannerWidget); @@ -323,6 +323,9 @@ PannerClassRec pannerClassRec = { /* simple */ { XtInheritChangeSensitive, /* change_sensitive */ +#ifndef OLDXAW + NULL, +#endif }, /* panner */ { @@ -420,11 +423,9 @@ reset_xor_gc(PannerWidget pw) static void check_knob(PannerWidget pw, Bool knob) { - Position pad = pw->panner.internal_border << 1; - Position maxx = (Position)XtWidth(pw) - pad - - (Position)pw->panner.knob_width; - Position maxy = (Position)XtHeight(pw) - pad - - (Position)pw->panner.knob_height; + Position pad = (Position)(pw->panner.internal_border << 1); + Position maxx = (Position)(XtWidth(pw) - pad - pw->panner.knob_width); + Position maxy = (Position)(XtHeight(pw) - pad - pw->panner.knob_height); Position *x = knob ? &pw->panner.knob_x : &pw->panner.tmp.x; Position *y = knob ? &pw->panner.knob_y : &pw->panner.tmp.y; @@ -461,15 +462,15 @@ move_shadow(PannerWidget pw) if (pw->panner.knob_height > lw && pw->panner.knob_width > lw) { XRectangle *r = pw->panner.shadow_rects; - r->x = pw->panner.knob_x + pad + pw->panner.knob_width; - r->y = pw->panner.knob_y + pad + lw; - r->width = pw->panner.shadow_thickness; - r->height = pw->panner.knob_height - lw; + r->x = (short)(pw->panner.knob_x + pad + pw->panner.knob_width); + r->y = (short)(pw->panner.knob_y + pad + lw); + r->width = (unsigned short)(pw->panner.shadow_thickness); + r->height = (unsigned short)(pw->panner.knob_height - lw); r++; - r->x = pw->panner.knob_x + pad + lw; - r->y = pw->panner.knob_y + pad + pw->panner.knob_height; - r->width = pw->panner.knob_width - lw + pw->panner.shadow_thickness; - r->height = pw->panner.shadow_thickness; + r->x = (short)(pw->panner.knob_x + pad + lw); + r->y = (short)(pw->panner.knob_y + pad + pw->panner.knob_height); + r->width = (unsigned short)(pw->panner.knob_width - lw + pw->panner.shadow_thickness); + r->height = (unsigned short)(pw->panner.shadow_thickness); pw->panner.shadow_valid = True; return; } @@ -528,10 +529,10 @@ rescale(PannerWidget pw) static void get_default_size(PannerWidget pw, Dimension *wp, Dimension *hp) { - Dimension pad = pw->panner.internal_border << 1; + Dimension pad = (Dimension)(pw->panner.internal_border << 1); - *wp = PANNER_DSCALE(pw, pw->panner.canvas_width) + pad; - *hp = PANNER_DSCALE(pw, pw->panner.canvas_height) + pad; + *wp = (Dimension)(PANNER_DSCALE(pw, pw->panner.canvas_width) + pad); + *hp = (Dimension)(PANNER_DSCALE(pw, pw->panner.canvas_height) + pad); } static Bool @@ -565,9 +566,9 @@ get_event_xy(PannerWidget pw, XEvent *event, int *x, int *y) } static int -parse_page_string(char *s, int pagesize, int canvassize, Bool *relative) +parse_page_string(String s, int pagesize, int canvassize, Bool *relative) { - char *cp; + String cp; double val = 1.0; Bool rel = False; @@ -618,10 +619,10 @@ parse_page_string(char *s, int pagesize, int canvassize, Bool *relative) { \ XDrawRectangle(XtDisplay(pw), XtWindow(pw), \ pw->panner.xor_gc, \ - pw->panner.tmp.x + pw->panner.internal_border, \ - pw->panner.tmp.y + pw->panner.internal_border, \ - pw->panner.knob_width - 1, \ - pw->panner.knob_height - 1); \ + (pw->panner.tmp.x + pw->panner.internal_border), \ + (pw->panner.tmp.y + pw->panner.internal_border), \ + (unsigned)(pw->panner.knob_width - 1), \ + (unsigned)(pw->panner.knob_height - 1)); \ pw->panner.tmp.showing = !pw->panner.tmp.showing; \ } @@ -640,7 +641,7 @@ XmuLocatePixmapFile(pw->core.screen, pw->panner.stipple_name, \ /*ARGSUSED*/ static void -XawPannerInitialize(Widget greq, Widget gnew, ArgList args, Cardinal *num_args) +XawPannerInitialize(Widget greq, Widget gnew, ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { PannerWidget req = (PannerWidget)greq, cnew = (PannerWidget)gnew; Dimension defwidth, defheight; @@ -686,7 +687,7 @@ XawPannerRealize(Widget gw, XtValueMask *valuemaskp, if (PIXMAP_OKAY(pm)) { attr->background_pixmap = pm; *valuemaskp |= CWBackPixmap; - *valuemaskp &= ~CWBackPixel; + *valuemaskp &= (XtValueMask)(~CWBackPixel); gotpm = True; } } @@ -721,7 +722,7 @@ XawPannerRedisplay(Widget gw, XEvent *event, Region region) Window w = XtWindow(gw); int pad = pw->panner.internal_border; Dimension lw = pw->panner.line_width; - Dimension extra = pw->panner.shadow_thickness + (lw << 1); + Dimension extra = (Dimension)(pw->panner.shadow_thickness + (lw << 1)); int kx = pw->panner.knob_x + pad, ky = pw->panner.knob_y + pad; if (Superclass->core_class.expose) @@ -731,18 +732,20 @@ XawPannerRedisplay(Widget gw, XEvent *event, Region region) XClearArea(XtDisplay(pw), XtWindow(pw), (int)pw->panner.last_x - ((int)lw) + pad, (int)pw->panner.last_y - ((int)lw) + pad, - pw->panner.knob_width + extra, - pw->panner.knob_height + extra, + (unsigned)(pw->panner.knob_width + extra), + (unsigned)(pw->panner.knob_height + extra), False); pw->panner.last_x = pw->panner.knob_x; pw->panner.last_y = pw->panner.knob_y; XFillRectangle(dpy, w, pw->panner.slider_gc, kx, ky, - pw->panner.knob_width - 1, pw->panner.knob_height - 1); + (unsigned)(pw->panner.knob_width - 1), + (unsigned)(pw->panner.knob_height - 1)); if (lw) XDrawRectangle(dpy, w, pw->panner.shadow_gc, kx, ky, - pw->panner.knob_width - 1, pw->panner.knob_height - 1); + (unsigned)(pw->panner.knob_width - 1), + (unsigned)(pw->panner.knob_height - 1)); if (pw->panner.shadow_valid) XFillRectangles(dpy, w, pw->panner.shadow_gc, pw->panner.shadow_rects, 2); @@ -753,8 +756,8 @@ XawPannerRedisplay(Widget gw, XEvent *event, Region region) /*ARGSUSED*/ static Boolean -XawPannerSetValues(Widget gcur, Widget greq, Widget gnew, - ArgList args, Cardinal *num_args) +XawPannerSetValues(Widget gcur, Widget greq _X_UNUSED, Widget gnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { PannerWidget cur = (PannerWidget)gcur; PannerWidget cnew = (PannerWidget)gnew; @@ -830,7 +833,7 @@ XawPannerSetValues(Widget gcur, Widget greq, Widget gnew, } } - return (redisplay); + return (Boolean)(redisplay); } static void @@ -865,7 +868,7 @@ XawPannerQueryGeometry(Widget gw, XtWidgetGeometry *intended, /*ARGSUSED*/ static void -ActionStart(Widget gw, XEvent *event, String *params, Cardinal *num_params) +ActionStart(Widget gw, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { PannerWidget pw = (PannerWidget)gw; int x, y; @@ -878,8 +881,8 @@ ActionStart(Widget gw, XEvent *event, String *params, Cardinal *num_params) pw->panner.tmp.doing = True; pw->panner.tmp.startx = pw->panner.knob_x; pw->panner.tmp.starty = pw->panner.knob_y; - pw->panner.tmp.dx = x - pw->panner.knob_x; - pw->panner.tmp.dy = y - pw->panner.knob_y; + pw->panner.tmp.dx = (Position)(x - pw->panner.knob_x); + pw->panner.tmp.dy = (Position)(y - pw->panner.knob_y); pw->panner.tmp.x = pw->panner.knob_x; pw->panner.tmp.y = pw->panner.knob_y; if (pw->panner.rubber_band) @@ -888,14 +891,14 @@ ActionStart(Widget gw, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static void -ActionStop(Widget gw, XEvent *event, String *params, Cardinal *num_params) +ActionStop(Widget gw, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { PannerWidget pw = (PannerWidget)gw; int x, y; if (get_event_xy(pw, event, &x, &y)) { - pw->panner.tmp.x = x - pw->panner.tmp.dx; - pw->panner.tmp.y = y - pw->panner.tmp.dy; + pw->panner.tmp.x = (Position)(x - pw->panner.tmp.dx); + pw->panner.tmp.y = (Position)(y - pw->panner.tmp.dy); if (!pw->panner.allow_off) check_knob(pw, False); } @@ -939,8 +942,8 @@ ActionMove(Widget gw, XEvent *event, String *params, Cardinal *num_params) if (pw->panner.rubber_band) UNDRAW_TMP(pw); - pw->panner.tmp.x = x - pw->panner.tmp.dx; - pw->panner.tmp.y = y - pw->panner.tmp.dy; + pw->panner.tmp.x = (Position)(x - pw->panner.tmp.dx); + pw->panner.tmp.y = (Position)(y - pw->panner.tmp.dy); if (!pw->panner.rubber_band) ActionNotify(gw, event, params, num_params); @@ -987,8 +990,8 @@ ActionPage(Widget gw, XEvent *event, String *params, Cardinal *num_params) } else { pw->panner.tmp.doing = True; - pw->panner.tmp.x = x; - pw->panner.tmp.y = y; + pw->panner.tmp.x = (Position)x; + pw->panner.tmp.y = (Position)y; ActionNotify(gw, event, NULL, &zero); pw->panner.tmp.doing = False; } @@ -996,7 +999,7 @@ ActionPage(Widget gw, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static void -ActionNotify(Widget gw, XEvent *event, String *params, Cardinal *num_params) +ActionNotify(Widget gw, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { PannerWidget pw = (PannerWidget)gw; @@ -1017,14 +1020,14 @@ ActionNotify(Widget gw, XEvent *event, String *params, Cardinal *num_params) Position tmp; if (pw->panner.slider_x - > (tmp = (Position)pw->panner.canvas_width - - (Position)pw->panner.slider_width)) + > (tmp = (Position)(pw->panner.canvas_width - + pw->panner.slider_width))) pw->panner.slider_x = tmp; if (pw->panner.slider_x < 0) pw->panner.slider_x = 0; if (pw->panner.slider_y - > (tmp = (Position)pw->panner.canvas_height - - (Position)pw->panner.slider_height)) + > (tmp = (Position)(pw->panner.canvas_height - + pw->panner.slider_height))) pw->panner.slider_y = tmp; if (pw->panner.slider_y < 0) pw->panner.slider_y = 0; @@ -1048,7 +1051,7 @@ ActionNotify(Widget gw, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static void -ActionSet(Widget gw, XEvent *event, String *params, Cardinal *num_params) +ActionSet(Widget gw, XEvent *event _X_UNUSED, String *params, Cardinal *num_params) { PannerWidget pw = (PannerWidget)gw; Bool rb; diff --git a/lib/libXaw/src/Pixmap.c b/lib/libXaw/src/Pixmap.c index d2fa1ef02..9798c9c3b 100644 --- a/lib/libXaw/src/Pixmap.c +++ b/lib/libXaw/src/Pixmap.c @@ -213,7 +213,7 @@ XawParseParamsString(String name) ++xaw_params->num_args; xaw_params->args = (XawArgVal **) XtRealloc((char *)xaw_params->args, - sizeof(XawArgVal*) * xaw_params->num_args); + (Cardinal)(sizeof(XawArgVal*) * (size_t)xaw_params->num_args)); } xaw_params->args[xaw_params->num_args - 1] = xaw_arg; } @@ -238,9 +238,9 @@ XawFreeParamsStruct(XawParams *params) for (i = 0; i < params->num_args; i++) { - XtFree(params->args[i]->name); + XtFree((char *)params->args[i]->name); if (params->args[i]->value) - XtFree(params->args[i]->value); + XtFree((char *)params->args[i]->value); XtFree((char *)params->args[i]); } @@ -332,9 +332,9 @@ XawAddPixmapLoader(String type, String ext, XawPixmapLoader loader) { loader_info[i]->loader = loader; if (loader_info[i]->type) - XtFree(loader_info[i]->type); + XtFree((char *)loader_info[i]->type); if (loader_info[i]->ext) - XtFree(loader_info[i]->ext); + XtFree((char *)loader_info[i]->ext); loader_info[i]->type = type ? XtNewString(type) : NULL; loader_info[i]->ext = ext ? XtNewString(ext) : NULL; return (True); @@ -359,7 +359,7 @@ XawAddPixmapLoader(String type, String ext, XawPixmapLoader loader) ++num_loader_info; loader_info = (XawPixmapLoaderInfo**) XtRealloc((char *)loader_info, - sizeof(XawPixmapLoaderInfo) * num_loader_info); + (Cardinal)(sizeof(XawPixmapLoaderInfo) * (size_t)num_loader_info)); } loader_info[num_loader_info - 1] = info; @@ -401,8 +401,8 @@ bcmp_x_cache(register _Xconst void *pixmap, register _Xconst void *xaw) static int qcmp_long(register _Xconst void *left, register _Xconst void *right) { - return ((long)((*(XawCache **)left)->value) - - (long)((*(XawCache **)right)->value)); + return (int)((long)((*(XawCache **)left)->value) - + (long)((*(XawCache **)right)->value)); } static int @@ -415,7 +415,7 @@ qcmp_string(register _Xconst void *left, register _Xconst void *right) static int bcmp_long(register _Xconst void *value, register _Xconst void *cache) { - return ((long)value - (long)((*(XawCache **)cache)->value)); + return (int)((long)value - (long)((*(XawCache **)cache)->value)); } static int @@ -490,7 +490,7 @@ _XawGetCache(XawCache *xaw, Screen *screen, Colormap colormap, int depth) ++xaw->num_elems; xaw->elems = (XtPointer*) XtRealloc((char *)xaw->elems, - sizeof(XtPointer) * xaw->num_elems); + (Cardinal)(sizeof(XtPointer) * (size_t)xaw->num_elems)); } pcache->value = (long)screen; pcache->elems = NULL; @@ -516,7 +516,7 @@ _XawGetCache(XawCache *xaw, Screen *screen, Colormap colormap, int depth) ++s_cache->num_elems; s_cache->elems = (XtPointer*) XtRealloc((char *)s_cache->elems, - sizeof(XtPointer) * s_cache->num_elems); + (Cardinal)(sizeof(XtPointer) * s_cache->num_elems)); } pcache->value = (long)colormap; pcache->elems = NULL; @@ -543,7 +543,7 @@ _XawGetCache(XawCache *xaw, Screen *screen, Colormap colormap, int depth) ++c_cache->num_elems; c_cache->elems = (XtPointer*) XtRealloc((char *)c_cache->elems, - sizeof(XtPointer) * c_cache->num_elems); + (Cardinal)(sizeof(XtPointer) * c_cache->num_elems)); } pcache->value = (long)depth; pcache->elems = NULL; @@ -622,8 +622,8 @@ _XawCachePixmap(XawPixmap *pixmap, { ++xaw_cache->num_elems; xaw_cache->elems = (XtPointer*)XtRealloc((char *)xaw_cache->elems, - sizeof(XtPointer) * - xaw_cache->num_elems); + (Cardinal)(sizeof(XtPointer) * + xaw_cache->num_elems)); } xaw_cache->elems[xaw_cache->num_elems - 1] = (XtPointer)pixmap; @@ -641,8 +641,8 @@ _XawCachePixmap(XawPixmap *pixmap, { ++x_cache->num_elems; x_cache->elems = (XtPointer*)XtRealloc((char *)x_cache->elems, - sizeof(XtPointer) * - x_cache->num_elems); + (Cardinal)(sizeof(XtPointer) * + x_cache->num_elems)); } x_cache->elems[x_cache->num_elems - 1] = (XtPointer)pixmap; @@ -679,18 +679,18 @@ GetResourcePixmapPath(Display *display) char *tok, *buffer = XtNewString(value.addr); for (tok = strtok(buffer, ":"); tok; tok = strtok(NULL, ":")) { - int toklen = strlen(tok); + int toklen = (int)strlen(tok); if (toklen) { - pixmap_path = XtRealloc(pixmap_path, length + toklen + 5); + pixmap_path = XtRealloc(pixmap_path, (Cardinal)(length + toklen + 5)); strcpy(pixmap_path + length, tok); if (length) pixmap_path[length++] = ':'; sprintf(pixmap_path + length, "%s/%%N", tok); - length += strlen(tok) + 3; + length = (length + (int)strlen(tok) + 3); } } - pixmap_path = XtRealloc(pixmap_path, length + strlen(default_path) + 2); + pixmap_path = XtRealloc(pixmap_path, (Cardinal)((size_t)length + strlen(default_path) + 2)); if (length) pixmap_path[length++] = ':'; strcpy(pixmap_path + length, default_path); @@ -762,13 +762,13 @@ BitmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, pixmap = XCreatePixmapFromBitmapData(DisplayOfScreen(screen), RootWindowOfScreen(screen), (char *)data, - width, height, fg, bg, depth); + width, height, fg, bg, (unsigned)depth); if (data) XFree(data); *pixmap_return = pixmap; *mask_return = None; - *width_return = width; - *height_return = height; + *width_return = (Dimension)width; + *height_return = (Dimension)height; retval = True; } @@ -850,8 +850,8 @@ GradientLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, if ((pixmap = XCreatePixmap(DisplayOfScreen(screen), RootWindowOfScreen(screen), - orientation == VERTICAL ? 1 : dimension, - orientation == VERTICAL ? dimension : 1, depth)) + (unsigned)(orientation == VERTICAL ? 1 : dimension), + (unsigned)(orientation == VERTICAL ? dimension : 1), (unsigned)depth)) == 0) return (False); @@ -916,8 +916,8 @@ GradientLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, *pixmap_return = pixmap; *mask_return = None; - *width_return = orientation == VERTICAL ? 1 : dimension; - *height_return = orientation == VERTICAL ? dimension : 1; + *width_return = (Dimension)(orientation == VERTICAL ? 1 : dimension); + *height_return = (Dimension)(orientation == VERTICAL ? dimension : 1); XFreeGC(DisplayOfScreen(screen), gc); @@ -925,7 +925,7 @@ GradientLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, } static Bool -XPixmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, +XPixmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth _X_UNUSED, Pixmap *pixmap_return, Pixmap *mask_return, Dimension *width_return, Dimension *height_return) { @@ -938,11 +938,11 @@ XPixmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, {'T', "pixmaps"}, {'P', PROJECT_ROOT}, }; - char *filename; + const char *filename; if ((argval = XawFindArgVal(params, "closeness")) != NULL && argval->value) - closeness = atoi(argval->value); + closeness = (unsigned)atoi(argval->value); if (params->name[0] != '/' && params->name[0] != '.') { @@ -965,8 +965,8 @@ XPixmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, RootWindowOfScreen(screen), filename, pixmap_return, mask_return, &xpm_attributes) == XpmSuccess) { - *width_return = xpm_attributes.width; - *height_return = xpm_attributes.height; + *width_return = (Dimension)xpm_attributes.width; + *height_return = (Dimension)xpm_attributes.height; return (True); } diff --git a/lib/libXaw/src/Porthole.c b/lib/libXaw/src/Porthole.c index 4842e70d7..c87be98b5 100644 --- a/lib/libXaw/src/Porthole.c +++ b/lib/libXaw/src/Porthole.c @@ -156,8 +156,8 @@ SendReport(PortholeWidget pw, unsigned int changed) XawPannerReport prep; prep.changed = changed; - prep.slider_x = -XtX(child); /* porthole is "inner" */ - prep.slider_y = -XtY(child); /* child is outer since it is larger */ + prep.slider_x = (Position)(-XtX(child)); /* porthole is "inner" */ + prep.slider_y = (Position)(-XtY(child)); /* child is outer since it is larger */ prep.slider_width = XtWidth(pw); prep.slider_height = XtHeight(pw); prep.canvas_width = XtWidth(child); @@ -199,8 +199,8 @@ layout_child(PortholeWidget pw, Widget child, XtWidgetGeometry *geomp, * Make sure that the child is still on the screen. Note that this must * be done *after* the size computation so that we know where to put it */ - minx = (Position)XtWidth(pw) - (Position)*widthp; - miny = (Position)XtHeight(pw) - (Position)*heightp; + minx = (Position)(XtWidth(pw) - *widthp); + miny = (Position)(XtHeight(pw) - *heightp); if (*xp < minx) *xp = minx; diff --git a/lib/libXaw/src/Private.h b/lib/libXaw/src/Private.h index ca70d5f30..9067204de 100644 --- a/lib/libXaw/src/Private.h +++ b/lib/libXaw/src/Private.h @@ -35,7 +35,7 @@ #define XawStackAlloc(size, stk_buffer) \ ((size) <= sizeof(stk_buffer) \ ? (XtPointer)(stk_buffer) \ - : XtMalloc((unsigned)(size))) + : XtMalloc((Cardinal)(size))) #define XawStackFree(pointer, stk_buffer) \ do { \ diff --git a/lib/libXaw/src/Repeater.c b/lib/libXaw/src/Repeater.c index 9b16ced7c..19537b428 100644 --- a/lib/libXaw/src/Repeater.c +++ b/lib/libXaw/src/Repeater.c @@ -213,7 +213,7 @@ WidgetClass repeaterWidgetClass = (WidgetClass) &repeaterClassRec; */ /*ARGSUSED*/ static void -tic(XtPointer client_data, XtIntervalId *id) +tic(XtPointer client_data, XtIntervalId *id _X_UNUSED) { RepeaterWidget rw = (RepeaterWidget)client_data; @@ -228,7 +228,7 @@ tic(XtPointer client_data, XtIntervalId *id) } DO_CALLBACK(rw); - rw->repeater.timer = ADD_TIMEOUT(rw, rw->repeater.next_delay); + rw->repeater.timer = ADD_TIMEOUT(rw, (unsigned long)rw->repeater.next_delay); if (rw->repeater.decay) { rw->repeater.next_delay -= rw->repeater.decay; @@ -239,8 +239,8 @@ tic(XtPointer client_data, XtIntervalId *id) /*ARGSUSED*/ static void -XawRepeaterInitialize(Widget greq, Widget gnew, - ArgList args, Cardinal *num_args) +XawRepeaterInitialize(Widget greq _X_UNUSED, Widget gnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { RepeaterWidget cnew = (RepeaterWidget)gnew; @@ -257,8 +257,8 @@ XawRepeaterDestroy(Widget gw) /*ARGSUSED*/ static Boolean -XawRepeaterSetValues(Widget gcur, Widget greq, Widget gnew, - ArgList args, Cardinal *num_args) +XawRepeaterSetValues(Widget gcur, Widget greq _X_UNUSED, Widget gnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { RepeaterWidget cur = (RepeaterWidget)gcur; RepeaterWidget cnew = (RepeaterWidget)gnew; @@ -273,7 +273,7 @@ XawRepeaterSetValues(Widget gcur, Widget greq, Widget gnew, /*ARGSUSED*/ static void -ActionStart(Widget gw, XEvent *event, String *params, Cardinal *num_params) +ActionStart(Widget gw, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { RepeaterWidget rw = (RepeaterWidget)gw; @@ -282,13 +282,13 @@ ActionStart(Widget gw, XEvent *event, String *params, Cardinal *num_params) XtCallCallbackList(gw, rw->repeater.start_callbacks, NULL); DO_CALLBACK(rw); - rw->repeater.timer = ADD_TIMEOUT(rw, rw->repeater.initial_delay); + rw->repeater.timer = ADD_TIMEOUT(rw, (unsigned long)rw->repeater.initial_delay); rw->repeater.next_delay = rw->repeater.repeat_delay; } /*ARGSUSED*/ static void -ActionStop(Widget gw, XEvent *event, String *params, Cardinal *num_params) +ActionStop(Widget gw, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { RepeaterWidget rw = (RepeaterWidget)gw; diff --git a/lib/libXaw/src/Scrollbar.c b/lib/libXaw/src/Scrollbar.c index 894a945d2..855013db5 100644 --- a/lib/libXaw/src/Scrollbar.c +++ b/lib/libXaw/src/Scrollbar.c @@ -102,6 +102,8 @@ static char defaultTranslations[] = "<Btn1Down>:" "StartScroll(Forward)\n" "<Btn2Down>:" "StartScroll(Continuous) MoveThumb() NotifyThumb()\n" "<Btn3Down>:" "StartScroll(Backward)\n" +"<Btn4Down>:" "StartScroll(Backward)\n" +"<Btn5Down>:" "StartScroll(Forward)\n" "<Btn2Motion>:" "MoveThumb() NotifyThumb()\n" "<BtnUp>:" "NotifyScroll(Proportional) EndScroll()\n"; @@ -180,7 +182,7 @@ static XtResource resources[] = { sizeof(Pixel), Offset(scrollbar.foreground), XtRString, - XtDefaultForeground + (XtPointer)XtDefaultForeground }, { XtNshown, @@ -207,7 +209,7 @@ static XtResource resources[] = { sizeof(Cursor), Offset(scrollbar.verCursor), XtRString, - "sb_v_double_arrow" + (XtPointer)"sb_v_double_arrow" }, { XtNscrollHCursor, @@ -216,7 +218,7 @@ static XtResource resources[] = { sizeof(Cursor), Offset(scrollbar.horCursor), XtRString, - "sb_h_double_arrow" + (XtPointer)"sb_h_double_arrow" }, { XtNscrollUCursor, @@ -225,7 +227,7 @@ static XtResource resources[] = { sizeof(Cursor), Offset(scrollbar.upCursor), XtRString, - "sb_up_arrow" + (XtPointer)"sb_up_arrow" }, { XtNscrollDCursor, @@ -234,7 +236,7 @@ static XtResource resources[] = { sizeof(Cursor), Offset(scrollbar.downCursor), XtRString, - "sb_down_arrow" + (XtPointer)"sb_down_arrow" }, { XtNscrollLCursor, @@ -243,7 +245,7 @@ static XtResource resources[] = { sizeof(Cursor), Offset(scrollbar.leftCursor), XtRString, - "sb_left_arrow" + (XtPointer)"sb_left_arrow" }, { XtNscrollRCursor, @@ -252,7 +254,7 @@ static XtResource resources[] = { sizeof(Cursor), Offset(scrollbar.rightCursor), XtRString, - "sb_right_arrow" + (XtPointer)"sb_right_arrow" }, { XtNminimumThumb, @@ -361,7 +363,7 @@ FractionLoc(ScrollbarWidget w, int x, int y) { float result; - result = PICKLENGTH(w, x / (float)XtWidth(w), y / (float)XtHeight(w)); + result = PICKLENGTH(w, (float)x / (float)XtWidth(w), (float)y / (float)XtHeight(w)); return (FloatInRange(result, 0.0, 1.0)); } @@ -380,26 +382,26 @@ FillArea(ScrollbarWidget w, int top, int bottom, int thumb) if (bottom <= top) return; - length = bottom - top; + length = (Dimension)(bottom - top); switch(thumb) { /* Fill the new Thumb location */ case 1: if (w->scrollbar.orientation == XtorientHorizontal) XFillRectangle(XtDisplay(w), XtWindow(w), w->scrollbar.gc, - top, 1, length, XtHeight(w) - 2); + top, 1, length, (unsigned)(XtHeight(w) - 2)); else XFillRectangle(XtDisplay(w), XtWindow(w), w->scrollbar.gc, - 1, top, XtWidth(w) - 2, length); + 1, top, (unsigned)(XtWidth(w) - 2), length); break; /* Clear the old Thumb location */ case 0: if (w->scrollbar.orientation == XtorientHorizontal) XClearArea(XtDisplay(w), XtWindow(w), - top, 1, length, XtHeight(w) - 2, False); + top, 1, length, (unsigned)(XtHeight(w) - 2), False); else XClearArea(XtDisplay(w), XtWindow(w), - 1, top, XtWidth(w) - 2, length, False); + 1, top, (unsigned)(XtWidth(w) - 2), length, False); break; } } @@ -414,13 +416,13 @@ PaintThumb(ScrollbarWidget w) Position oldtop, oldbot, newtop, newbot; oldtop = w->scrollbar.topLoc; - oldbot = oldtop + w->scrollbar.shownLength; - newtop = w->scrollbar.length * w->scrollbar.top; - newbot = newtop + (int)(w->scrollbar.length * w->scrollbar.shown); + oldbot = (Position)(oldtop + w->scrollbar.shownLength); + newtop = (Position)(w->scrollbar.length * w->scrollbar.top); + newbot = (Position)(newtop + (int)(w->scrollbar.length * w->scrollbar.shown)); if (newbot < newtop + (int)w->scrollbar.min_thumb) - newbot = newtop + w->scrollbar.min_thumb; + newbot = (Position)(newtop + w->scrollbar.min_thumb); w->scrollbar.topLoc = newtop; - w->scrollbar.shownLength = newbot - newtop; + w->scrollbar.shownLength = (Dimension)(newbot - newtop); if (XtIsRealized((Widget)w)) { if (newtop < oldtop) @@ -497,8 +499,8 @@ CreateGC(Widget w) /* ARGSUSED */ static void -XawScrollbarInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawScrollbarInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { ScrollbarWidget w = (ScrollbarWidget)cnew; @@ -538,8 +540,8 @@ XawScrollbarRealize(Widget gw, Mask *valueMask, /*ARGSUSED*/ static Boolean -XawScrollbarSetValues(Widget current, Widget request, Widget desired, - ArgList args, Cardinal *num_args) +XawScrollbarSetValues(Widget current, Widget request _X_UNUSED, Widget desired, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { ScrollbarWidget w = (ScrollbarWidget)current; ScrollbarWidget dw = (ScrollbarWidget)desired; @@ -593,27 +595,27 @@ XawScrollbarRedisplay(Widget gw, XEvent *event, Region region) if (w->scrollbar.orientation == XtorientHorizontal) { x = w->scrollbar.topLoc; y = 1; - width = w->scrollbar.shownLength; - height = XtHeight(w) - 2; + width = (unsigned)(w->scrollbar.shownLength); + height = (unsigned)(XtHeight(w) - 2); } else { x = 1; y = w->scrollbar.topLoc; - width = XtWidth(w) - 2; - height = w->scrollbar.shownLength; + width = (unsigned)(XtWidth(w) - 2); + height = (unsigned)(w->scrollbar.shownLength); } if (region == NULL || XRectInRegion(region, x, y, width, height) != RectangleOut) { /* Forces entire thumb to be painted */ - w->scrollbar.topLoc = -(w->scrollbar.length + 1); + w->scrollbar.topLoc = (Position)(-(w->scrollbar.length + 1)); PaintThumb(w); } } /*ARGSUSED*/ static void -StartScroll(Widget gw, XEvent *event, String *params, Cardinal *num_params) +StartScroll(Widget gw, XEvent *event _X_UNUSED, String *params, Cardinal *num_params) { ScrollbarWidget w = (ScrollbarWidget)gw; Cursor cursor; @@ -727,23 +729,23 @@ ExtractPosition(XEvent *event, Position *x, Position *y) { switch(event->type) { case MotionNotify: - *x = event->xmotion.x; - *y = event->xmotion.y; + *x = (Position)event->xmotion.x; + *y = (Position)event->xmotion.y; break; case ButtonPress: case ButtonRelease: - *x = event->xbutton.x; - *y = event->xbutton.y; + *x = (Position)event->xbutton.x; + *y = (Position)event->xbutton.y; break; case KeyPress: case KeyRelease: - *x = event->xkey.x; - *y = event->xkey.y; + *x = (Position)event->xkey.x; + *y = (Position)event->xkey.y; break; case EnterNotify: case LeaveNotify: - *x = event->xcrossing.x; - *y = event->xcrossing.y; + *x = (Position)event->xcrossing.x; + *y = (Position)event->xcrossing.y; break; default: *x = 0; @@ -800,7 +802,7 @@ NotifyScroll(Widget gw, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static void -EndScroll(Widget gw, XEvent *event, String *params, Cardinal *num_params) +EndScroll(Widget gw, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { ScrollbarWidget w = (ScrollbarWidget)gw; @@ -812,7 +814,7 @@ EndScroll(Widget gw, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static void -MoveThumb(Widget gw, XEvent *event, String *params, Cardinal *num_params) +MoveThumb(Widget gw, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { ScrollbarWidget w = (ScrollbarWidget)gw; Position x, y; @@ -832,7 +834,7 @@ MoveThumb(Widget gw, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static void -NotifyThumb(Widget gw, XEvent *event, String *params, Cardinal *num_params) +NotifyThumb(Widget gw, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { ScrollbarWidget w = (ScrollbarWidget)gw; union { @@ -874,9 +876,16 @@ XawScrollbarSetThumb(Widget gw, if (w->scrollbar.direction == 'c') /* if still thumbing */ return; - w->scrollbar.top = top > 1.0 ? 1.0 : top >= 0.0 ? top : w->scrollbar.top; - - w->scrollbar.shown = shown > 1.0 ? 1.0 : shown >= 0.0 ? - shown : w->scrollbar.shown; + w->scrollbar.top = (float)((top > 1.0) + ? 1.0 + : ((top >= 0.0) + ? top + : w->scrollbar.top)); + + w->scrollbar.shown = (float)((shown > 1.0) + ? 1.0 + : (shown >= 0.0 + ? shown + : w->scrollbar.shown)); PaintThumb(w); } diff --git a/lib/libXaw/src/Simple.c b/lib/libXaw/src/Simple.c index be5597b2b..ae322cb48 100644 --- a/lib/libXaw/src/Simple.c +++ b/lib/libXaw/src/Simple.c @@ -117,7 +117,7 @@ static XtResource resources[] = { sizeof(Pixel), offset(pointer_fg), XtRString, - XtDefaultForeground + (XtPointer)XtDefaultForeground }, { XtNpointerColorBackground, @@ -126,7 +126,7 @@ static XtResource resources[] = { sizeof(Pixel), offset(pointer_bg), XtRString, - XtDefaultBackground + (XtPointer)XtDefaultBackground }, { XtNcursorName, @@ -286,8 +286,8 @@ XawSimpleClassPartInitialize(WidgetClass cclass) #ifndef OLDXAW /*ARGSUSED*/ static void -XawSimpleInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawSimpleInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { SimpleWidget simple = (SimpleWidget)cnew; @@ -328,7 +328,7 @@ XawSimpleRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes) w->core.border_pixmap = ((SimpleWidget)w)->simple.insensitive_border; *valueMask |= CWBorderPixmap; - *valueMask &= ~CWBorderPixel; + *valueMask &= (Mask)(~CWBorderPixel); } ConvertCursor(w); @@ -345,7 +345,7 @@ XawSimpleRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes) #ifndef OLDXAW if (w->core.background_pixmap > XtUnspecifiedPixmap) { pixmap = XawPixmapFromXPixmap(w->core.background_pixmap, XtScreen(w), - w->core.colormap, w->core.depth); + w->core.colormap, (int)w->core.depth); if (pixmap && pixmap->mask) XawReshapeWidget(w, pixmap); } @@ -376,7 +376,7 @@ ConvertCursor(Widget w) return; from.addr = (XPointer)simple->simple.cursor_name; - from.size = strlen((char *)from.addr) + 1; + from.size = (unsigned)strlen((char *)from.addr) + 1; to.size = sizeof(Cursor); to.addr = (XPointer)&cursor; @@ -393,8 +393,8 @@ ConvertCursor(Widget w) /*ARGSUSED*/ static Boolean -XawSimpleSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawSimpleSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { SimpleWidget s_old = (SimpleWidget)current; SimpleWidget s_new = (SimpleWidget)cnew; @@ -434,10 +434,10 @@ XawSimpleSetValues(Widget current, Widget request, Widget cnew, opix = XawPixmapFromXPixmap(s_old->core.background_pixmap, XtScreen(s_old), s_old->core.colormap, - s_old->core.depth); + (int)s_old->core.depth); npix = XawPixmapFromXPixmap(s_new->core.background_pixmap, XtScreen(s_new), s_new->core.colormap, - s_new->core.depth); + (int)s_new->core.depth); if ((npix && npix->mask) || (opix && opix->mask)) XawReshapeWidget(cnew, npix); } diff --git a/lib/libXaw/src/SimpleMenu.c b/lib/libXaw/src/SimpleMenu.c index 8defdf7d3..89711b9a5 100644 --- a/lib/libXaw/src/SimpleMenu.c +++ b/lib/libXaw/src/SimpleMenu.c @@ -390,8 +390,8 @@ XawSimpleMenuClassPartInitialize(WidgetClass wc) */ /*ARGSUSED*/ static void -XawSimpleMenuInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawSimpleMenuInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { SimpleMenuWidget smw = (SimpleMenuWidget)cnew; Dimension width, height; @@ -451,7 +451,7 @@ XawSimpleMenuInitialize(Widget request, Widget cnew, */ /*ARGSUSED*/ static void -XawSimpleMenuRedisplay(Widget w, XEvent *event, Region region) +XawSimpleMenuRedisplay(Widget w, XEvent *event _X_UNUSED, Region region) { SimpleMenuWidget smw = (SimpleMenuWidget)w; SmeObject *entry; @@ -518,14 +518,14 @@ XawSimpleMenuRealize(Widget w, XtValueMask *mask, XSetWindowAttributes *attrs) attrs->backing_store = smw->simple_menu.backing_store; } else - *mask &= ~CWBackingStore; + *mask &= (XtValueMask)(~CWBackingStore); (*Superclass->core_class.realize)(w, mask, attrs); #ifndef OLDXAW if (w->core.background_pixmap > XtUnspecifiedPixmap) { pixmap = XawPixmapFromXPixmap(w->core.background_pixmap, XtScreen(w), - w->core.colormap, w->core.depth); + w->core.colormap, (int)w->core.depth); if (pixmap && pixmap->mask) XawReshapeWidget(w, pixmap); } @@ -567,8 +567,8 @@ XawSimpleMenuResize(Widget w) */ /*ARGSUSED*/ static Boolean -XawSimpleMenuSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawSimpleMenuSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { SimpleMenuWidget smw_old = (SimpleMenuWidget)current; SimpleMenuWidget smw_new = (SimpleMenuWidget)cnew; @@ -622,10 +622,10 @@ XawSimpleMenuSetValues(Widget current, Widget request, Widget cnew, opix = XawPixmapFromXPixmap(smw_old->core.background_pixmap, XtScreen(smw_old), smw_old->core.colormap, - smw_old->core.depth); + (int)smw_old->core.depth); npix = XawPixmapFromXPixmap(smw_new->core.background_pixmap, XtScreen(smw_new), smw_new->core.colormap, - smw_new->core.depth); + (int)smw_new->core.depth); if ((npix && npix->mask) || (opix && opix->mask)) XawReshapeWidget(cnew, npix); } @@ -814,19 +814,19 @@ PositionMenuAction(Widget w, XEvent *event, switch (event->type) { case ButtonPress: case ButtonRelease: - loc.x = event->xbutton.x_root; - loc.y = event->xbutton.y_root; + loc.x = (short)event->xbutton.x_root; + loc.y = (short)event->xbutton.y_root; PositionMenu(menu, &loc); break; case EnterNotify: case LeaveNotify: - loc.x = event->xcrossing.x_root; - loc.y = event->xcrossing.y_root; + loc.x = (short)event->xcrossing.x_root; + loc.y = (short)event->xcrossing.y_root; PositionMenu(menu, &loc); break; case MotionNotify: - loc.x = event->xmotion.x_root; - loc.y = event->xmotion.y_root; + loc.x = (short)event->xmotion.x_root; + loc.y = (short)event->xmotion.y_root; PositionMenu(menu, &loc); break; default: @@ -853,7 +853,7 @@ PositionMenuAction(Widget w, XEvent *event, */ /*ARGSUSED*/ static void -Unhighlight(Widget w, XEvent *event, String *params, Cardinal *num_params) +Unhighlight(Widget w, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { SimpleMenuWidget smw = (SimpleMenuWidget)w; SmeObject entry = smw->simple_menu.entry_set; @@ -952,7 +952,7 @@ Highlight(Widget w, XEvent *event, String *params, Cardinal *num_params) */ /*ARGSUSED*/ static void -Notify(Widget w, XEvent *event, String *params, Cardinal *num_params) +Notify(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { SmeObject entry; SmeObjectClass cclass; @@ -1065,7 +1065,7 @@ CreateLabel(Widget w) next_child = NULL; for (child = smw->composite.children + smw->composite.num_children, - i = smw->composite.num_children; i > 0; i--, child--) { + i = (int)smw->composite.num_children; i > 0; i--, child--) { if (next_child != NULL) *next_child = *child; next_child = child; @@ -1156,17 +1156,17 @@ Layout(Widget w, Dimension *width_ret, Dimension *height_ret) widths = (Dimension *)XtMalloc(sizeof(Dimension)); #ifndef OLDXAW - hadd = smw->simple_menu.left_margin; + hadd = (short)smw->simple_menu.left_margin; #else hadd = 0; #endif - vadd = smw->simple_menu.top_margin; + vadd = (short)smw->simple_menu.top_margin; if (smw->simple_menu.label) - vadd += XtHeight(smw->simple_menu.label); + vadd = (short)(vadd + XtHeight(smw->simple_menu.label)); count = 1; - width = tmp_w = tmp_h = n = 0; - height = vadd; + width = (Dimension)(tmp_w = tmp_h = (int)(n = 0)); + height = (Dimension)vadd; for (i = smw->simple_menu.label ? 1 : 0; i < smw->composite.num_children; @@ -1181,38 +1181,38 @@ Layout(Widget w, Dimension *width_ret, Dimension *height_ret) > XtHeight(smw))) { ++count; widths = (Dimension *)XtRealloc((char *)widths, - sizeof(Dimension) * count); - widths[count - 1] = width_kid; - width += tmp_w; + (Cardinal)(sizeof(Dimension) * count)); + widths[count - 1] = (Dimension)width_kid; + width = (Dimension)(width + tmp_w); tmp_w = width_kid; - height = height_kid + vadd; + height = (Dimension)(height_kid + vadd); } else - height += height_kid; + height = (Dimension)(height + height_kid); if (height > tmp_h) tmp_h = height; if (width_kid > tmp_w) - widths[count - 1] = tmp_w = width_kid; + widths[count - 1] = (Dimension)(tmp_w = width_kid); ++n; } - height = tmp_h + smw->simple_menu.bottom_margin; - width += tmp_w; + height = (tmp_h + smw->simple_menu.bottom_margin); + width = (Dimension)(width + tmp_w); if (smw->simple_menu.label && width < XtWidth(smw->simple_menu.label)) { float inc; - inc = (XtWidth(smw->simple_menu.label) - width) / (float)count; + inc = (float)(XtWidth(smw->simple_menu.label) - width) / (float)count; width = XtWidth(smw->simple_menu.label); for (n = 0; n < count; n++) - widths[n] += inc; + widths[n] = (Dimension)(widths[n] + inc); } #ifndef OLDXAW - width += hadd + smw->simple_menu.right_margin; + width = (Dimension)(width + (hadd + smw->simple_menu.right_margin)); #endif - x_ins = n = count = 0; + x_ins = (short)(n = count = 0); tmp_w = widths[0]; tmp_h = vadd; @@ -1227,19 +1227,19 @@ Layout(Widget w, Dimension *width_ret, Dimension *height_ret) if (n && (tmp_h + height_kid + smw->simple_menu.bottom_margin > XtHeight(smw))) { - x_ins = tmp_w; + x_ins = (short)tmp_w; y_ins = vadd; ++count; tmp_w += widths[count]; tmp_h = height_kid + vadd; } else { - y_ins = tmp_h; + y_ins = (short)tmp_h; tmp_h += height_kid; } ++n; - XtX(kid) = x_ins + hadd; + XtX(kid) = (Position)(x_ins + hadd); XtY(kid) = y_ins; XtWidth(kid) = widths[count]; } @@ -1251,12 +1251,12 @@ Layout(Widget w, Dimension *width_ret, Dimension *height_ret) if (smw->simple_menu.label) { XtX(smw->simple_menu.label) = 0; - XtY(smw->simple_menu.label) = smw->simple_menu.top_margin; - XtWidth(smw->simple_menu.label) = XtWidth(smw) + XtY(smw->simple_menu.label) = (Position)smw->simple_menu.top_margin; + XtWidth(smw->simple_menu.label) = (Dimension)(XtWidth(smw) #ifndef OLDXAW - (smw->simple_menu.left_margin + smw->simple_menu.right_margin) #endif - ; + ); } if (current_entry) { if (width_ret) @@ -1280,7 +1280,7 @@ Layout(Widget w, Dimension *width_ret, Dimension *height_ret) */ /*ARGSUSED*/ static void -AddPositionAction(XtAppContext app_con, XPointer data) +AddPositionAction(XtAppContext app_con, XPointer data _X_UNUSED) { static XtActionsRec pos_action[] = { {"XawPositionSimpleMenu", PositionMenuAction}, @@ -1355,7 +1355,7 @@ PositionMenu(Widget w, XPoint *location) */ XtRealizeWidget(w); - location->x -= XtWidth(w) >> 1; + location->x = (short)(location->x - (XtWidth(w) >> 1)); if (smw->simple_menu.popup_entry == NULL) entry = smw->simple_menu.label; @@ -1363,7 +1363,7 @@ PositionMenu(Widget w, XPoint *location) entry = smw->simple_menu.popup_entry; if (entry != NULL) - location->y -= XtY(entry) + (XtHeight(entry) >> 1); + location->y = (short)(location->y - (XtY(entry) + (XtHeight(entry) >> 1))); MoveMenu(w, location->x, location->y); } @@ -1431,7 +1431,7 @@ MoveMenu(Widget w, int x, int y) */ /*ARGSUSED*/ static void -ChangeCursorOnGrab(Widget w, XtPointer temp1, XtPointer temp2) +ChangeCursorOnGrab(Widget w, XtPointer temp1 _X_UNUSED, XtPointer temp2 _X_UNUSED) { SimpleMenuWidget smw = (SimpleMenuWidget)w; @@ -1596,7 +1596,7 @@ GetEventEntry(Widget w, XEvent *event) move = warp = 0; if (move) - XtMoveWidget(w, XtX(w) + move, XtY(w)); + XtMoveWidget(w, (Position)(XtX(w) + move), XtY(w)); if (warp) XWarpPointer(XtDisplay(w), None, None, 0, 0, 0, 0, warp, 0); @@ -1616,13 +1616,13 @@ CalculateNewSize(Widget w, Dimension *width_return, Dimension *height_return) Boolean try_layout = False; #ifndef OLDXAW - hadd = xaw->simple_menu.left_margin + xaw->simple_menu.right_margin; + hadd = (short)(xaw->simple_menu.left_margin + xaw->simple_menu.right_margin); #else hadd = 0; #endif - vadd = xaw->simple_menu.top_margin + xaw->simple_menu.bottom_margin; + vadd = (short)(xaw->simple_menu.top_margin + xaw->simple_menu.bottom_margin); if (xaw->simple_menu.label) - vadd += XtHeight(xaw->simple_menu.label); + vadd = (short)(vadd + XtHeight(xaw->simple_menu.label)); if (*height_return) max_dim = *height_return; @@ -1674,8 +1674,8 @@ CalculateNewSize(Widget w, Dimension *width_return, Dimension *height_return) if (xaw->simple_menu.label) width = XawMax(width, XtWidth(xaw->simple_menu.label) + hadd); - *width_return = width; - *height_return = height; + *width_return = (Dimension)width; + *height_return = (Dimension)height; if (try_layout && columns > 1 && num_children > 2) { int space; @@ -1690,7 +1690,7 @@ CalculateNewSize(Widget w, Dimension *width_return, Dimension *height_return) height = max_dim - space / columns; if (height % test_h) height += test_h - (height % test_h); - *height_return = height + vadd; + *height_return = (Dimension)(height + vadd); CalculateNewSize(w, width_return, height_return); } } @@ -1762,17 +1762,21 @@ PopupSubMenu(SimpleMenuWidget smw) popleft = (smw->simple_menu.state & SMW_POPLEFT) != 0; if (popleft) - XtTranslateCoords((Widget)smw, -(int)XtWidth(menu), - XtY(entry) - XtBorderWidth(menu), &menu_x, &menu_y); + XtTranslateCoords((Widget)smw, + (Position)(-(int)XtWidth(menu)), + (Position)(XtY(entry) - XtBorderWidth(menu)), + &menu_x, &menu_y); else - XtTranslateCoords((Widget)smw, XtWidth(smw), XtY(entry) - - XtBorderWidth(menu), &menu_x, &menu_y); + XtTranslateCoords((Widget)smw, + (Position)XtWidth(smw), + (Position)(XtY(entry) - XtBorderWidth(menu)), + &menu_x, &menu_y); if (!popleft && menu_x >= 0) { int scr_width = WidthOfScreen(XtScreen(menu)); if (menu_x + XtWidth(menu) > scr_width) { - menu_x -= XtWidth(menu) + XtWidth(smw); + menu_x = (Position)(menu_x - (XtWidth(menu) + XtWidth(smw))); popleft = True; } } @@ -1784,7 +1788,7 @@ PopupSubMenu(SimpleMenuWidget smw) int scr_height = HeightOfScreen(XtScreen(menu)); if (menu_y + XtHeight(menu) > scr_height) - menu_y = scr_height - XtHeight(menu) - XtBorderWidth(menu); + menu_y = (Position)(scr_height - XtHeight(menu) - XtBorderWidth(menu)); } if (menu_y < 0) menu_y = 0; @@ -1797,7 +1801,7 @@ PopupSubMenu(SimpleMenuWidget smw) if (popleft) ((SimpleMenuWidget)menu)->simple_menu.state |= SMW_POPLEFT; else - ((SimpleMenuWidget)menu)->simple_menu.state &= ~SMW_POPLEFT; + ((SimpleMenuWidget)menu)->simple_menu.state &= (unsigned char)(~SMW_POPLEFT); XtPopup(menu, XtGrabNone); } @@ -1820,10 +1824,10 @@ PopdownSubMenu(SimpleMenuWidget smw) /*ARGSUSED*/ static void -PopupCB(Widget w, XtPointer client_data, XtPointer call_data) +PopupCB(Widget w, XtPointer client_data _X_UNUSED, XtPointer call_data _X_UNUSED) { SimpleMenuWidget smw = (SimpleMenuWidget)w; - smw->simple_menu.state &= ~(SMW_UNMAPPING | SMW_POPLEFT); + smw->simple_menu.state &= (unsigned char)(~(SMW_UNMAPPING | SMW_POPLEFT)); } #endif /* OLDXAW */ diff --git a/lib/libXaw/src/Sme.c b/lib/libXaw/src/Sme.c index 24d4fedb2..7814eb8ba 100644 --- a/lib/libXaw/src/Sme.c +++ b/lib/libXaw/src/Sme.c @@ -170,8 +170,8 @@ XawSmeClassPartInitialize(WidgetClass cclass) */ /*ARGSUSED*/ static void -XawSmeInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawSmeInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { SmeObject entry = (SmeObject)cnew; @@ -190,7 +190,7 @@ XawSmeInitialize(Widget request, Widget cnew, */ /*ARGSUSED*/ static void -Highlight(Widget w) +Highlight(Widget w _X_UNUSED) { } @@ -206,7 +206,7 @@ Highlight(Widget w) */ /*ARGSUSED*/ static void -Unhighlight(Widget w) +Unhighlight(Widget w _X_UNUSED) { } diff --git a/lib/libXaw/src/SmeBSB.c b/lib/libXaw/src/SmeBSB.c index 52a789ae8..380a21555 100644 --- a/lib/libXaw/src/SmeBSB.c +++ b/lib/libXaw/src/SmeBSB.c @@ -145,7 +145,7 @@ static XtResource resources[] = { sizeof(Pixel), offset(foreground), XtRString, - XtDefaultForeground + (XtPointer)XtDefaultForeground }, { XtNfont, @@ -154,7 +154,7 @@ static XtResource resources[] = { sizeof(XFontStruct*), offset(font), XtRString, - XtDefaultFont + (XtPointer)XtDefaultFont }, { XtNfontSet, @@ -163,7 +163,7 @@ static XtResource resources[] = { sizeof(XFontSet), offset(fontset), XtRString, - XtDefaultFontSet + (XtPointer)XtDefaultFontSet }, #ifndef OLDXAW { @@ -259,8 +259,8 @@ XawSmeBSBClassInitialize(void) */ /*ARGSUSED*/ static void -XawSmeBSBInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawSmeBSBInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { SmeBSBObject entry = (SmeBSBObject)cnew; @@ -295,7 +295,7 @@ XawSmeBSBDestroy(Widget w) DestroyGCs(w); if (entry->sme_bsb.label != XtName(w)) - XtFree(entry->sme_bsb.label); + XtFree((char *)entry->sme_bsb.label); } /* @@ -312,7 +312,7 @@ XawSmeBSBDestroy(Widget w) */ /* ARGSUSED */ static void -XawSmeBSBRedisplay(Widget w, XEvent *event, Region region) +XawSmeBSBRedisplay(Widget w, XEvent *event _X_UNUSED, Region region _X_UNUSED) { GC gc; SmeBSBObject entry = (SmeBSBObject)w; @@ -348,8 +348,8 @@ XawSmeBSBRedisplay(Widget w, XEvent *event, Region region) if (entry->sme_bsb.label != NULL) { int x_loc = entry->sme_bsb.left_margin; - int len = strlen(entry->sme_bsb.label); - char *label = entry->sme_bsb.label; + int len = (int)strlen(entry->sme_bsb.label); + _Xconst char *label = entry->sme_bsb.label; int width, t_width; switch(entry->sme_bsb.justify) { @@ -424,8 +424,8 @@ XawSmeBSBRedisplay(Widget w, XEvent *event, Region region) /*ARGSUSED*/ static Boolean -XawSmeBSBSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawSmeBSBSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { SmeBSBObject entry = (SmeBSBObject)cnew; SmeBSBObject old_entry = (SmeBSBObject)current; @@ -573,28 +573,28 @@ GetDefaultSize(Widget w, Dimension *width, Dimension *height) if (entry->sme_bsb.label == NULL) *width = 0; else - *width = XmbTextEscapement(entry->sme_bsb.fontset, + *width = (Dimension)XmbTextEscapement(entry->sme_bsb.fontset, entry->sme_bsb.label, - strlen(entry->sme_bsb.label)); - *width += entry->sme_bsb.left_margin + entry->sme_bsb.right_margin; + (int)strlen(entry->sme_bsb.label)); + *width = (Dimension)(*width + (entry->sme_bsb.left_margin + entry->sme_bsb.right_margin)); *height = ext->max_ink_extent.height; - *height = ((int)*height * (ONE_HUNDRED + - entry->sme_bsb.vert_space)) / ONE_HUNDRED; + *height = (Dimension)(((int)*height * (ONE_HUNDRED + + entry->sme_bsb.vert_space)) / ONE_HUNDRED); } else { if (entry->sme_bsb.label == NULL) *width = 0; else - *width = XTextWidth(entry->sme_bsb.font, entry->sme_bsb.label, - strlen(entry->sme_bsb.label)); + *width = (Dimension)XTextWidth(entry->sme_bsb.font, entry->sme_bsb.label, + (int)strlen(entry->sme_bsb.label)); - *width += entry->sme_bsb.left_margin + entry->sme_bsb.right_margin; + *width = (Dimension)(*width + (entry->sme_bsb.left_margin + entry->sme_bsb.right_margin)); - *height = entry->sme_bsb.font->max_bounds.ascent + - entry->sme_bsb.font->max_bounds.descent; + *height = (Dimension)(entry->sme_bsb.font->max_bounds.ascent + + entry->sme_bsb.font->max_bounds.descent); - *height = ((int)*height * (ONE_HUNDRED + - entry->sme_bsb.vert_space)) / ONE_HUNDRED; + *height = (Dimension)(((int)*height * (ONE_HUNDRED + + entry->sme_bsb.vert_space)) / ONE_HUNDRED); } } @@ -678,16 +678,16 @@ GetBitmapInfo(Widget w, Bool is_left) XGetGeometry(XtDisplayOfObject(w), entry->sme_bsb.left_bitmap, &root, &x, &y, &width, &height, &bw, &depth)) { - entry->sme_bsb.left_bitmap_width = width; - entry->sme_bsb.left_bitmap_height = height; + entry->sme_bsb.left_bitmap_width = (Dimension)width; + entry->sme_bsb.left_bitmap_height = (Dimension)height; } } else if (entry->sme_bsb.right_bitmap != None && XGetGeometry(XtDisplayOfObject(w), entry->sme_bsb.right_bitmap, &root, &x, &y, &width, &height, &bw, &depth)) { - entry->sme_bsb.right_bitmap_width = width; - entry->sme_bsb.right_bitmap_height = height; + entry->sme_bsb.right_bitmap_width = (Dimension)width; + entry->sme_bsb.right_bitmap_height = (Dimension)height; } } diff --git a/lib/libXaw/src/SmeLine.c b/lib/libXaw/src/SmeLine.c index 801134267..350b3fd41 100644 --- a/lib/libXaw/src/SmeLine.c +++ b/lib/libXaw/src/SmeLine.c @@ -90,7 +90,7 @@ static XtResource resources[] = { sizeof(Pixel), offset(foreground), XtRString, - XtDefaultForeground + (XtPointer)XtDefaultForeground }, }; #undef offset @@ -152,8 +152,8 @@ WidgetClass smeLineObjectClass = (WidgetClass)&smeLineClassRec; */ /*ARGSUSED*/ static void -XawSmeLineInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawSmeLineInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { SmeLineObject entry = (SmeLineObject)cnew; @@ -220,7 +220,7 @@ DestroyGC(Widget w) /*ARGSUSED*/ static void -XawSmeLineRedisplay(Widget w, XEvent *event, Region region) +XawSmeLineRedisplay(Widget w, XEvent *event _X_UNUSED, Region region _X_UNUSED) { SmeLineObject entry = (SmeLineObject)w; int y = XtY(w) + (((int)XtHeight(w) - entry->sme_line.line_width) >> 1); @@ -247,8 +247,8 @@ XawSmeLineRedisplay(Widget w, XEvent *event, Region region) */ /*ARGSUSED*/ static Boolean -XawSmeLineSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawSmeLineSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { SmeLineObject entry = (SmeLineObject)cnew; SmeLineObject old_entry = (SmeLineObject)current; diff --git a/lib/libXaw/src/StripChart.c b/lib/libXaw/src/StripChart.c index fa7357cea..96ae48dbc 100644 --- a/lib/libXaw/src/StripChart.c +++ b/lib/libXaw/src/StripChart.c @@ -57,6 +57,8 @@ SOFTWARE. #include "Private.h" #define MS_PER_SEC 1000 +#define NUM_VALUEDATA(w) (sizeof((w)->strip_chart.valuedata) / \ + sizeof((w)->strip_chart.valuedata[0])) /* * Class Methods @@ -126,7 +128,7 @@ static XtResource resources[] = { sizeof(Pixel), offset(strip_chart.fgpixel), XtRString, - XtDefaultForeground + (XtPointer)XtDefaultForeground }, { XtNhighlight, @@ -135,7 +137,7 @@ static XtResource resources[] = { sizeof(Pixel), offset(strip_chart.hipixel), XtRString, - XtDefaultForeground + (XtPointer)XtDefaultForeground }, { XtNgetValue, @@ -198,6 +200,13 @@ StripChartClassRec stripChartClassRec = { /* simple */ { XtInheritChangeSensitive, /* change_sensitive */ +#ifndef OLDXAW + NULL +#endif + }, + /* strip_chart_class */ + { + NULL } }; @@ -256,15 +265,15 @@ DestroyGC(StripChartWidget w, unsigned int which) /*ARGSUSED*/ static void -XawStripChartInitialize(Widget greq, Widget gnew, - ArgList args, Cardinal *num_args) +XawStripChartInitialize(Widget greq _X_UNUSED, Widget gnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { StripChartWidget w = (StripChartWidget)gnew; if (w->strip_chart.update > 0) w->strip_chart.interval_id = XtAppAddTimeOut(XtWidgetToApplicationContext(gnew), - w->strip_chart.update * MS_PER_SEC, + (unsigned long)(w->strip_chart.update * MS_PER_SEC), draw_it, (XtPointer)gnew); CreateGC(w, ALL_GCS); @@ -294,7 +303,7 @@ XawStripChartDestroy(Widget gw) */ /*ARGSUSED*/ static void -XawStripChartRedisplay(Widget w, XEvent *event, Region region) +XawStripChartRedisplay(Widget w, XEvent *event, Region region _X_UNUSED) { if (event->type == GraphicsExpose) (void)repaint_window((StripChartWidget)w, event->xgraphicsexpose.x, @@ -306,7 +315,7 @@ XawStripChartRedisplay(Widget w, XEvent *event, Region region) /*ARGSUSED*/ static void -draw_it(XtPointer client_data, XtIntervalId *id) +draw_it(XtPointer client_data, XtIntervalId *id _X_UNUSED) { StripChartWidget w = (StripChartWidget)client_data; double value; @@ -314,10 +323,11 @@ draw_it(XtPointer client_data, XtIntervalId *id) if (w->strip_chart.update > 0) w->strip_chart.interval_id = XtAppAddTimeOut(XtWidgetToApplicationContext((Widget)w), - w->strip_chart.update * MS_PER_SEC,draw_it, + (unsigned long)(w->strip_chart.update * MS_PER_SEC), draw_it, client_data); - if (w->strip_chart.interval >= XtWidth(w)) + if ((w->strip_chart.interval >= XtWidth(w)) || + ((Cardinal)w->strip_chart.interval >= NUM_VALUEDATA(w))) MoveChart((StripChartWidget)w, True); /* Get the value, stash the point and draw corresponding line */ @@ -346,13 +356,13 @@ draw_it(XtPointer client_data, XtIntervalId *id) XFillRectangle(XtDisplay(w), XtWindow(w), w->strip_chart.fgGC, w->strip_chart.interval, y, - 1, XtHeight(w) - y); + 1, (unsigned)(XtHeight(w) - y)); /* * Fill in the graph lines we just painted over */ if (w->strip_chart.points != NULL) { - w->strip_chart.points[0].x = w->strip_chart.interval; + w->strip_chart.points[0].x = (short)w->strip_chart.interval; XDrawPoints(XtDisplay(w), XtWindow(w), w->strip_chart.hiGC, w->strip_chart.points, w->strip_chart.scale - 1, CoordModePrevious); @@ -383,9 +393,9 @@ repaint_window(StripChartWidget w, int left, int width) /* Compute the minimum scale required to graph the data, but don't go lower than min_scale */ if (w->strip_chart.interval != 0 || scale <= w->strip_chart.max_value) - scale = w->strip_chart.max_value + 1; - if (scale < w->strip_chart.min_scale) - scale = w->strip_chart.min_scale; + scale = (int)(w->strip_chart.max_value + 1); + if (scale < w->strip_chart.min_scale) + scale = w->strip_chart.min_scale; if (scale != w->strip_chart.scale) { w->strip_chart.scale = scale; @@ -410,13 +420,16 @@ repaint_window(StripChartWidget w, int left, int width) if (next < ++width) width = next; + if ((Cardinal)width > NUM_VALUEDATA(w)) + width = NUM_VALUEDATA(w); + /* Draw data point lines */ for (i = left; i < width; i++) { - int y = XtHeight(w) - (XtHeight(w) * w->strip_chart.valuedata[i]) - / w->strip_chart.scale; + int y = (int)(XtHeight(w) - (XtHeight(w) * w->strip_chart.valuedata[i]) + / w->strip_chart.scale); XFillRectangle(dpy, win, w->strip_chart.fgGC, - i, y, 1, XtHeight(w) - y); + i, y, 1, (unsigned)(XtHeight(w) - y)); } /* Draw graph reference lines */ @@ -449,19 +462,23 @@ MoveChart(StripChartWidget w, Bool blit) if (!XtIsRealized((Widget)w)) return; + if (XtWidth(w) > NUM_VALUEDATA(w)) + j = (int) NUM_VALUEDATA(w); + else + j = (int) XtWidth(w); if (w->strip_chart.jump_val < 0) w->strip_chart.jump_val = DEFAULT_JUMP; if (w->strip_chart.jump_val == DEFAULT_JUMP) - j = XtWidth(w) >> 1; + j = j >> 1; else { - j = (int)XtWidth(w) - w->strip_chart.jump_val; + j -= w->strip_chart.jump_val; if (j < 0) j = 0; } (void)memmove((char *)w->strip_chart.valuedata, (char *)(w->strip_chart.valuedata + next - j), - j * sizeof(double)); + (size_t)j * sizeof(double)); next = w->strip_chart.interval = j; /* @@ -485,10 +502,10 @@ MoveChart(StripChartWidget w, Bool blit) } XCopyArea(XtDisplay((Widget)w), XtWindow((Widget)w), XtWindow((Widget)w), - w->strip_chart.hiGC, (int)XtWidth(w) - j, 0, j, XtHeight(w), 0, 0); + w->strip_chart.hiGC, (int)XtWidth(w) - j, 0, (unsigned)j, XtHeight(w), 0, 0); XClearArea(XtDisplay((Widget)w), XtWindow((Widget)w), - j, 0, XtWidth(w) - j, XtHeight(w), False); + j, 0, (unsigned)(XtWidth(w) - j), XtHeight(w), False); /* Draw graph reference lines */ left = j; @@ -501,8 +518,8 @@ MoveChart(StripChartWidget w, Bool blit) /*ARGSUSED*/ static Boolean -XawStripChartSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawStripChartSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { StripChartWidget old = (StripChartWidget)current; StripChartWidget w = (StripChartWidget)cnew; @@ -515,7 +532,7 @@ XawStripChartSetValues(Widget current, Widget request, Widget cnew, if (w->strip_chart.update > 0) w->strip_chart.interval_id = XtAppAddTimeOut(XtWidgetToApplicationContext(cnew), - w->strip_chart.update * MS_PER_SEC, + (unsigned long)(w->strip_chart.update * MS_PER_SEC), draw_it, (XtPointer)w); } @@ -535,7 +552,7 @@ XawStripChartSetValues(Widget current, Widget request, Widget cnew, DestroyGC(old, new_gc); CreateGC(w, new_gc); - return (ret_val); + return (Boolean)(ret_val); } /* @@ -562,7 +579,7 @@ XawStripChartResize(Widget widget) return; } - size = sizeof(XPoint) * (w->strip_chart.scale - 1); + size = (Cardinal)(sizeof(XPoint) * (size_t)(w->strip_chart.scale - 1)); points = (XPoint *)XtRealloc((XtPointer)w->strip_chart.points, size); w->strip_chart.points = points; @@ -571,6 +588,6 @@ XawStripChartResize(Widget widget) for (i = 1; i < w->strip_chart.scale; i++) { points[i - 1].x = 0; - points[i - 1].y = XtHeight(w) / w->strip_chart.scale; + points[i - 1].y = (short)(XtHeight(w) / w->strip_chart.scale); } } diff --git a/lib/libXaw/src/Text.c b/lib/libXaw/src/Text.c index 81001226d..9a2a2efc3 100644 --- a/lib/libXaw/src/Text.c +++ b/lib/libXaw/src/Text.c @@ -292,7 +292,7 @@ static XtResource resources[] = { sizeof(Cursor), offset(simple.cursor), XtRString, - "xterm" + (XtPointer)"xterm" }, { XtNheight, @@ -481,7 +481,7 @@ static XrmQuark QJustifyLeft, QJustifyRight, QJustifyCenter, QJustifyFull; /*ARGSUSED*/ static void -CvtStringToScrollMode(XrmValuePtr args, Cardinal *num_args, +CvtStringToScrollMode(XrmValuePtr args _X_UNUSED, Cardinal *num_args _X_UNUSED, XrmValuePtr fromVal, XrmValuePtr toVal) { static XawTextScrollMode scrollMode = XawtextScrollNever; @@ -507,10 +507,10 @@ CvtStringToScrollMode(XrmValuePtr args, Cardinal *num_args, /*ARGSUSED*/ static Boolean -CvtScrollModeToString(Display *dpy, XrmValue *args, Cardinal *num_args, - XrmValue *fromVal, XrmValue *toVal, XtPointer *data) +CvtScrollModeToString(Display *dpy, XrmValue *args _X_UNUSED, Cardinal *num_args _X_UNUSED, + XrmValue *fromVal, XrmValue *toVal _X_UNUSED, XtPointer *data _X_UNUSED) { - static char *buffer; + static String buffer; Cardinal size; switch (*(XawTextScrollMode *)fromVal->addr) { @@ -527,7 +527,7 @@ CvtScrollModeToString(Display *dpy, XrmValue *args, Cardinal *num_args, toVal->size = 0; return (False); } - size = strlen(buffer) + 1; + size = (Cardinal)strlen(buffer) + 1; if (toVal->addr != NULL) { if (toVal->size < size) { toVal->size = size; @@ -544,7 +544,7 @@ CvtScrollModeToString(Display *dpy, XrmValue *args, Cardinal *num_args, /*ARGSUSED*/ static void -CvtStringToWrapMode(XrmValuePtr args, Cardinal *num_args, +CvtStringToWrapMode(XrmValuePtr args _X_UNUSED, Cardinal *num_args _X_UNUSED, XrmValuePtr fromVal, XrmValuePtr toVal) { static XawTextWrapMode wrapMode = XawtextWrapNever; @@ -569,10 +569,10 @@ CvtStringToWrapMode(XrmValuePtr args, Cardinal *num_args, /*ARGSUSED*/ static Boolean -CvtWrapModeToString(Display *dpy, XrmValue *args, Cardinal *num_args, - XrmValue *fromVal, XrmValue *toVal, XtPointer *data) +CvtWrapModeToString(Display *dpy, XrmValue *args _X_UNUSED, Cardinal *num_args _X_UNUSED, + XrmValue *fromVal, XrmValue *toVal _X_UNUSED, XtPointer *data _X_UNUSED) { - static char *buffer; + static String buffer; Cardinal size; switch (*(XawTextWrapMode *)fromVal->addr) { @@ -591,7 +591,7 @@ CvtWrapModeToString(Display *dpy, XrmValue *args, Cardinal *num_args, toVal->size = 0; return (False); } - size = strlen(buffer) + 1; + size = (Cardinal)strlen(buffer) + 1; if (toVal->addr != NULL) { if (toVal->size < size) { toVal->size = size; @@ -608,8 +608,8 @@ CvtWrapModeToString(Display *dpy, XrmValue *args, Cardinal *num_args, /*ARGSUSED*/ static Boolean -CvtStringToJustifyMode(Display *dpy, XrmValue *args, Cardinal *num_args, - XrmValue *fromVal, XrmValue *toVal, XtPointer *data) +CvtStringToJustifyMode(Display *dpy _X_UNUSED, XrmValue *args _X_UNUSED, Cardinal *num_args _X_UNUSED, + XrmValue *fromVal, XrmValue *toVal, XtPointer *data _X_UNUSED) { XawTextJustifyMode justify; XrmQuark q; @@ -641,10 +641,10 @@ CvtStringToJustifyMode(Display *dpy, XrmValue *args, Cardinal *num_args, /*ARGSUSED*/ static Boolean -CvtJustifyModeToString(Display *dpy, XrmValue *args, Cardinal *num_args, - XrmValue *fromVal, XrmValue *toVal, XtPointer *data) +CvtJustifyModeToString(Display *dpy, XrmValue *args _X_UNUSED, Cardinal *num_args _X_UNUSED, + XrmValue *fromVal, XrmValue *toVal, XtPointer *data _X_UNUSED) { - static char *buffer; + static String buffer; Cardinal size; switch (*(XawTextJustifyMode *)fromVal->addr) { @@ -666,7 +666,7 @@ CvtJustifyModeToString(Display *dpy, XrmValue *args, Cardinal *num_args, toVal->size = 0; return (False); } - size = strlen(buffer) + 1; + size = (Cardinal)strlen(buffer) + 1; if (toVal->addr != NULL) { if (toVal->size < size) { toVal->size = size; @@ -687,9 +687,9 @@ static void XawTextClassInitialize(void) { if (!XawFmt8Bit) - FMT8BIT = XawFmt8Bit = XrmPermStringToQuark("FMT8BIT"); + FMT8BIT = XawFmt8Bit = (unsigned long)XrmPermStringToQuark("FMT8BIT"); if (!XawFmtWide) - XawFmtWide = XrmPermStringToQuark("FMTWIDE"); + XawFmtWide = (unsigned long)XrmPermStringToQuark("FMTWIDE"); XawInitializeWidgetSet(); @@ -739,12 +739,12 @@ PositionHScrollBar(TextWidget ctx) return; if (vbar != NULL) - x = XtWidth(vbar); + x = (Position)XtWidth(vbar); else - x = -XtBorderWidth(hbar); - y = XtHeight(ctx) - XtHeight(hbar) - XtBorderWidth(hbar); + x = (Position)(-XtBorderWidth(hbar)); + y = (Position)(XtHeight(ctx) - XtHeight(hbar) - XtBorderWidth(hbar)); if (vbar != NULL) { - width = XtWidth(ctx) - XtWidth(vbar) - XtBorderWidth(vbar); + width = (Dimension)(XtWidth(ctx) - XtWidth(vbar) - XtBorderWidth(vbar)); if (width > XtWidth(ctx)) width = XtWidth(ctx); } @@ -775,7 +775,7 @@ PositionVScrollBar(TextWidget ctx) if (vbar == NULL) return; - x = y = -XtBorderWidth(vbar); + x = y = (Position)(-XtBorderWidth(vbar)); height = XtHeight(ctx); width = XtWidth(vbar); @@ -795,7 +795,7 @@ CreateVScrollBar(TextWidget ctx) XtAddCallback(vbar, XtNscrollProc, VScroll, (XtPointer)ctx); XtAddCallback(vbar, XtNjumpProc, VJump, (XtPointer)ctx); - ctx->text.r_margin.left += XtWidth(vbar) + XtBorderWidth(vbar); + ctx->text.r_margin.left += (XtWidth(vbar) + XtBorderWidth(vbar)); ctx->text.left_margin = ctx->text.margin.left = ctx->text.r_margin.left; PositionVScrollBar(ctx); @@ -827,7 +827,7 @@ DestroyVScrollBar(TextWidget ctx) if (vbar == NULL) return; - ctx->text.r_margin.left -= XtWidth(vbar) + XtBorderWidth(vbar); + ctx->text.r_margin.left = (Position)(ctx->text.r_margin.left - (XtWidth(vbar) + XtBorderWidth(vbar))); ctx->text.left_margin = ctx->text.margin.left = ctx->text.r_margin.left; XtDestroyWidget(vbar); @@ -856,7 +856,7 @@ CreateHScrollBar(TextWidget ctx) bottom = ctx->text.r_margin.bottom + XtHeight(hbar) + XtBorderWidth(hbar); - ctx->text.margin.bottom = ctx->text.r_margin.bottom = bottom; + ctx->text.margin.bottom = ctx->text.r_margin.bottom = (Position)bottom; PositionHScrollBar(ctx); TextSinkResize(ctx->text.sink); @@ -886,7 +886,9 @@ DestroyHScrollBar(TextWidget ctx) if (hbar == NULL) return; - ctx->text.r_margin.bottom -= XtHeight(hbar) + XtBorderWidth(hbar); + ctx->text.r_margin.bottom = (Position)(ctx->text.r_margin.bottom + - (XtHeight(hbar) + + XtBorderWidth(hbar))); ctx->text.margin.bottom = ctx->text.r_margin.bottom; XtDestroyWidget(hbar); @@ -897,8 +899,8 @@ DestroyHScrollBar(TextWidget ctx) /*ARGSUSED*/ static void -XawTextInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawTextInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { TextWidget ctx = (TextWidget)cnew; @@ -946,7 +948,7 @@ XawTextInitialize(Widget request, Widget cnew, #endif if (XtHeight(ctx) == DEFAULT_TEXT_HEIGHT) { - XtHeight(ctx) = VMargins(ctx); + XtHeight(ctx) = (Dimension)VMargins(ctx); if (ctx->text.sink != NULL) XtHeight(ctx) += XawTextSinkMaxHeight(ctx->text.sink, 1); } @@ -1046,7 +1048,7 @@ InsertCursor(Widget w, XawTextInsertState state) else y += (ctx->text.lt.info[line].y - ctx->text.lt.info[line - 1].y) + 1; - XawTextSinkInsertCursor(ctx->text.sink, x, y, state); + XawTextSinkInsertCursor(ctx->text.sink, (Position)x, (Position)y, state); } /* Keep Input Method up to speed */ @@ -1097,7 +1099,7 @@ _XawTextGetText(TextWidget ctx, XawTextPosition left, XawTextPosition right) bytes = 1; /* leave space for ZERO */ - tempResult = result = XtMalloc((unsigned)(right - left + ONE) * bytes); + tempResult = result = XtMalloc((unsigned)(right - left + ONE) * (unsigned)bytes); while (left < right) { left = SrcRead(ctx->text.source, left, &text, (int)(right - left)); @@ -1131,7 +1133,7 @@ _XawTextGetSTRING(TextWidget ctx, XawTextPosition left, XawTextPosition right) if (XawTextFormat(ctx, XawFmtWide)) { MultiSinkObject sink = (MultiSinkObject)ctx->text.sink; ws = (wchar_t *)_XawTextGetText(ctx, left, right); - n = wcslen(ws); + n = (long)wcslen(ws); for (j = 0, i = 0; j < n; j++) { wc = ws[j]; if (XwcTextEscapement (sink->multi_sink.fontset, &wc, 1) @@ -1145,7 +1147,7 @@ _XawTextGetSTRING(TextWidget ctx, XawTextPosition left, XawTextPosition right) else { s = (unsigned char *)_XawTextGetText(ctx, left, right); /* only HT and NL control chars are allowed, strip out others */ - n = strlen((char *)s); + n = (long)strlen((char *)s); i = 0; for (j = 0; j < n; j++) { c = s[j]; @@ -1255,10 +1257,10 @@ _XawTextBuildLineTable(TextWidget ctx, XawTextPosition position, Cardinal size; if ((int)XtHeight(ctx) > VMargins(ctx)) { - height = XtHeight(ctx) - VMargins(ctx); + height = (Dimension)(XtHeight(ctx) - VMargins(ctx)); lines = XawTextSinkMaxLines(ctx->text.sink, height); } - size = sizeof(XawTextLineTableEntry) * (lines + 1); + size = (Cardinal)(sizeof(XawTextLineTableEntry) * (size_t)(lines + 1)); if (lines != ctx->text.lt.lines || ctx->text.lt.info == NULL) { ctx->text.lt.info = (XawTextLineTableEntry *) @@ -1380,12 +1382,12 @@ _BuildLineTable(TextWidget ctx, XawTextPosition position, int line) lt->y = y; ctx->text.clear_to_eol = True; } - if (lt->textWidth != width) { - if (lt->textWidth > width) + if (lt->textWidth != (Cardinal)width) { + if (lt->textWidth > (Cardinal)width) ctx->text.clear_to_eol = True; - lt->textWidth = width; + lt->textWidth = (unsigned)width; } - y += height; + y = (Position)(y + height); if (end > ctx->text.lastPos) { position = end; @@ -1406,7 +1408,7 @@ _BuildLineTable(TextWidget ctx, XawTextPosition position, int line) } lt->position = ++position; lt->textWidth = 0; - y += height; + y = (Position)(y + height); } if (update_from >= 0) _XawTextNeedsUpdating(ctx, update_from, @@ -1424,7 +1426,7 @@ _BuildLineTable(TextWidget ctx, XawTextPosition position, int line) /* grow the line table */ ctx->text.lt.info = (XawTextLineTableEntry *) XtRealloc((char *)ctx->text.lt.info, - sizeof(XawTextLineTableEntry) * (line + 1)); + (Cardinal)(sizeof(XawTextLineTableEntry) * (size_t)(line + 1))); lt = ctx->text.lt.info + line; bzero(lt, sizeof(XawTextLineTableEntry)); ++ctx->text.lt.lines; @@ -1490,10 +1492,10 @@ _XawTextSetScrollBars(TextWidget ctx) if (ctx->text.lastPos == 0) first = 0.0; else - first = ctx->text.lt.top / (float)ctx->text.lastPos; + first = (float)ctx->text.lt.top / (float)ctx->text.lastPos; if (ctx->text.lt.info[ctx->text.lt.lines].position < ctx->text.lastPos) - last = ctx->text.lt.info[ctx->text.lt.lines].position / + last = (float)ctx->text.lt.info[ctx->text.lt.lines].position / (float)ctx->text.lastPos; else last = 1.0; @@ -1502,13 +1504,13 @@ _XawTextSetScrollBars(TextWidget ctx) } if (ctx->text.scroll_horiz == XawtextScrollAlways) { - denom = GetWidestLine(ctx); + denom = (float)GetWidestLine(ctx); if (denom <= 0) - denom = (int)XtWidth(ctx) - RHMargins(ctx); + denom = (float)((int)XtWidth(ctx) - RHMargins(ctx)); if (denom <= 0) denom = 1; - widest = ((int)XtWidth(ctx) - RHMargins(ctx)) / denom; - first = ctx->text.r_margin.left - ctx->text.left_margin; + widest = (float)((int)XtWidth(ctx) - RHMargins(ctx)) / denom; + first = (float)(ctx->text.r_margin.left - ctx->text.left_margin); first /= denom; XawScrollbarSetThumb(ctx->text.hbar, first, widest); @@ -1533,8 +1535,8 @@ DoCopyArea(TextWidget ctx, int src_x, int src_y, src_y = XawMax(y1, XawMin(src_y, y2)); dst_x = XawMax(x1, XawMin(dst_x, x2)); dst_y = XawMax(y1, XawMin(dst_y, y2)); - width = XawMax(0, XawMin(x2 - dst_x, (int)width)); - height = XawMax(0, XawMin(y2 - dst_y, (int)height)); + width = (unsigned)XawMax(0, XawMin(x2 - dst_x, (int)width)); + height = (unsigned)XawMax(0, XawMin(y2 - dst_y, (int)height)); XCopyArea(XtDisplay(ctx), XtWindow(ctx), XtWindow(ctx), ctx->text.gc, src_x, src_y, width, height, dst_x, dst_y); @@ -1703,8 +1705,8 @@ XawTextScroll(TextWidget ctx, int vlines, int hpixels) update_to = lt->info[-vlines + 1].position - 1; y1 = lt->info[lt->lines + vlines].y; y2 = lt->info[-vlines].y; - DoCopyArea(ctx, ctx->text.r_margin.left, y0, vwidth, - y1 - y0, + DoCopyArea(ctx, ctx->text.r_margin.left, y0, (unsigned)vwidth, + (unsigned)(y1 - y0), ctx->text.r_margin.left, y2); } else { @@ -1713,7 +1715,7 @@ XawTextScroll(TextWidget ctx, int vlines, int hpixels) y1 = lt->info[lt->lines - vlines].y; y2 = lt->info[vlines].y; DoCopyArea(ctx, ctx->text.r_margin.left, y2, - vwidth, lt->info[lt->lines].y - y2, + (unsigned)vwidth, (unsigned)(lt->info[lt->lines].y - y2), ctx->text.r_margin.left, y0); } _XawTextNeedsUpdating(ctx, update_from, update_to); @@ -1733,7 +1735,7 @@ _XawTextVScroll(TextWidget ctx, int n) /*ARGSUSED*/ static void -HScroll(Widget w, XtPointer closure, XtPointer callData) +HScroll(Widget w _X_UNUSED, XtPointer closure, XtPointer callData) { TextWidget ctx = (TextWidget)closure; long pixels = (long)callData; @@ -1749,7 +1751,7 @@ HScroll(Widget w, XtPointer closure, XtPointer callData) if (pixels) { _XawTextPrepareToUpdate(ctx); - XawTextScroll(ctx, 0, pixels); + XawTextScroll(ctx, 0, (int)pixels); _XawTextExecuteUpdate(ctx); } } @@ -1763,7 +1765,7 @@ HJump(Widget w, XtPointer closure, XtPointer callData) long pixels; pixels = ctx->text.left_margin - - (ctx->text.r_margin.left - (int)(percent * GetWidestLine(ctx))); + (ctx->text.r_margin.left - (int)(percent * (float)GetWidestLine(ctx))); HScroll(w, (XtPointer)ctx, (XtPointer)pixels); } @@ -1803,7 +1805,7 @@ UpdateTextInLine(TextWidget ctx, int line, int x1, int x2) False, &left, &width, &height); if (line == ctx->text.lt.lines) right = -1; - else if (x2 >= lt->textWidth - from_x) + else if ((Cardinal)x2 >= (lt->textWidth - (unsigned)from_x)) right = lt[1].position - 1; else { from_x += width; @@ -1825,7 +1827,7 @@ UpdateTextInLine(TextWidget ctx, int line, int x1, int x2) */ /*ARGSUSED*/ static void -VScroll(Widget w, XtPointer closure, XtPointer callData) +VScroll(Widget w _X_UNUSED, XtPointer closure, XtPointer callData) { TextWidget ctx = (TextWidget)closure; long height, lines = (long)callData; @@ -1835,13 +1837,13 @@ VScroll(Widget w, XtPointer closure, XtPointer callData) height = 1; lines = (lines * ctx->text.lt.lines) / height; _XawTextPrepareToUpdate(ctx); - XawTextScroll(ctx, lines, 0); + XawTextScroll(ctx, (int)lines, 0); _XawTextExecuteUpdate(ctx); } /*ARGSUSED*/ static void -VJump(Widget w, XtPointer closure, XtPointer callData) +VJump(Widget w _X_UNUSED, XtPointer closure, XtPointer callData) { float percent = *(float *)callData; TextWidget ctx = (TextWidget)closure; @@ -1850,7 +1852,7 @@ VJump(Widget w, XtPointer closure, XtPointer callData) int dim, vlines = 0, wwidth = GetMaxTextWidth(ctx); Bool scroll = True; - position = percent * ctx->text.lastPos; + position = (XawTextPosition)(percent * (float)ctx->text.lastPos); top = lt->top; if (!lt->lines || (position >= lt->top && position < lt->info[1].position)) { @@ -1972,8 +1974,8 @@ TextConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, target, type, (XPointer*)&std_targets, &std_length, format); - *length = 7 + (edit_mode == XawtextEdit) + std_length; - *value = XtMalloc((unsigned)sizeof(Atom)*(*length)); + *length = 7 + (unsigned long)(edit_mode == XawtextEdit) + std_length; + *value = XtMalloc((Cardinal)(sizeof(Atom)*(*length))); targetP = *(Atom**)value; *targetP++ = XA_STRING; *targetP++ = XA_TEXT(d); @@ -2043,9 +2045,9 @@ TextConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, *length = strlen((char *)*value); } else { - *value = XtMalloc((salt->length + 1) * sizeof(unsigned char)); + *value = XtMalloc(((size_t)(salt->length + 1) * sizeof(unsigned char))); strcpy ((char *)*value, salt->contents); - *length = salt->length; + *length = (unsigned long)salt->length; } /* Got *value,*length, now in COMPOUND_TEXT format. */ if (XawTextFormat(ctx, XawFmtWide) && *type == XA_STRING) { @@ -2256,7 +2258,7 @@ _XawTextSaltAwaySelection(TextWidget ctx, Atom *selections, int num_atoms) XtMalloc((unsigned)sizeof(XawTextSelectionSalt)); if (!salt) return; - salt->s.selections = (Atom *)XtMalloc((unsigned)(num_atoms * sizeof(Atom))); + salt->s.selections = (Atom *)XtMalloc((Cardinal)((size_t)num_atoms * sizeof(Atom))); if (!salt->s.selections) { XtFree((char *)salt); return; @@ -2277,10 +2279,10 @@ _XawTextSaltAwaySelection(TextWidget ctx, Atom *selections, int num_atoms) } XtFree(salt->contents); salt->contents = (char *)textprop.value; - salt->length = textprop.nitems; + salt->length = (int)textprop.nitems; } else - salt->length = strlen (salt->contents); + salt->length = (int)strlen (salt->contents); salt->next = ctx->text.salt; ctx->text.salt = salt; j = 0; @@ -2340,7 +2342,7 @@ _SetSelection(TextWidget ctx, XawTextPosition left, XawTextPosition right, #ifndef OLDXAW if (needs_updating) { _XawTextExecuteUpdate(tw); - tw->text.showposition = showposition; + tw->text.showposition = (Boolean)showposition; } } #endif /* OLDXAW */ @@ -2360,7 +2362,7 @@ _SetSelection(TextWidget ctx, XawTextPosition left, XawTextPosition right, */ if ((buffer = GetCutBufferNumber(selection)) != NOT_A_CUT_BUFFER) { unsigned char *ptr, *tptr; - unsigned int amount, max_len = MAX_CUT_LEN(XtDisplay(w)); + unsigned int amount, max_len = (unsigned)MAX_CUT_LEN(XtDisplay(w)); unsigned long len; tptr= ptr= (unsigned char *)_XawTextGetSTRING(ctx, @@ -2386,10 +2388,10 @@ _SetSelection(TextWidget ctx, XawTextPosition left, XawTextPosition right, _CreateCutBuffers(XtDisplay(w)); XRotateBuffers(XtDisplay(w), 1); } - amount = Min ((len = strlen((char *)ptr)), max_len); + amount = (unsigned)Min ((len = strlen((char *)ptr)), max_len); XChangeProperty(XtDisplay(w), RootWindow(XtDisplay(w), 0), selection, XA_STRING, 8, PropModeReplace, - ptr, amount); + ptr, (int)amount); while (len > max_len) { len -= max_len; @@ -2397,7 +2399,7 @@ _SetSelection(TextWidget ctx, XawTextPosition left, XawTextPosition right, amount = Min (len, max_len); XChangeProperty(XtDisplay(w), RootWindow(XtDisplay(w), 0), selection, XA_STRING, 8, PropModeAppend, - tptr, amount); + tptr, (int)amount); } XtFree ((char *)ptr); } @@ -2430,7 +2432,7 @@ _XawTextSetLineAndColumnNumber(TextWidget ctx, Bool force) XawTextPositionInfo info; ctx->text.line_number = info.line_number = line_number; - ctx->text.column_number = info.column_number = column_number; + ctx->text.column_number = (short)(info.column_number = column_number); info.insert_position = ctx->text.insertPos; info.last_position = ctx->text.lastPos; info.overwrite_mode = ctx->text.overwrite; @@ -2446,7 +2448,7 @@ ResolveColumnNumber(TextWidget ctx) short column_number = 0; XawTextPosition position; XawTextBlock block; - unsigned long format = _XawTextFormat(ctx); + unsigned long format = (unsigned long)_XawTextFormat(ctx); TextSinkObject sink = (TextSinkObject)ctx->text.sink; short *char_tabs = sink->text_sink.char_tabs; int tab_count = sink->text_sink.tab_count; @@ -2456,11 +2458,11 @@ ResolveColumnNumber(TextWidget ctx) return (ctx->text.column_number); position = SrcScan(src, ctx->text.insertPos, XawstEOL, XawsdLeft, 1, False); - XawTextSourceRead(src, position, &block, ctx->text.insertPos - position); + XawTextSourceRead(src, position, &block, (int)(ctx->text.insertPos - position)); for (; position < ctx->text.insertPos; position++) { if (position - block.firstPos >= block.length) - XawTextSourceRead(src, position, &block, ctx->text.insertPos - position); + XawTextSourceRead(src, position, &block, (int)(ctx->text.insertPos - position)); if ((format == XawFmt8Bit && block.ptr[position - block.firstPos] == '\t') || (format == XawFmtWide && ((wchar_t*)block.ptr)[position - block.firstPos] == _Xaw_atowc(XawTAB))) { while (tab_base + tab_column <= column_number) { @@ -2478,7 +2480,7 @@ ResolveColumnNumber(TextWidget ctx) else tab_column += DEFAULT_TAB_SIZE; } - column_number = tab_base + tab_column; + column_number = (short)(tab_base + tab_column); } else ++column_number; @@ -2494,7 +2496,7 @@ ResolveColumnNumber(TextWidget ctx) void _XawTextSourceChanged(Widget w, XawTextPosition left, XawTextPosition right, - XawTextBlock *block, int lines) + XawTextBlock *block, int lines _X_UNUSED) { TextWidget ctx = (TextWidget)w; Widget src = ctx->text.source; @@ -2528,7 +2530,7 @@ _XawTextSourceChanged(Widget w, XawTextPosition left, XawTextPosition right, update_from = left; update_to = left + block->length; update_to = SrcScan(src, update_to, XawstEOL, XawsdRight, 1, False); - delta = block->length - (right - left); + delta = (int)(block->length - (right - left)); if (delta < 0) ctx->text.clear_to_eol = True; if (update_to == update_from) @@ -2719,7 +2721,7 @@ OldDisplayText(Widget w, XawTextPosition left, XawTextPosition right) x = ctx->text.left_margin; if (cleol) { - segment.x1 = ctx->text.lt.info[line].textWidth + x; + segment.x1 = (int)(ctx->text.lt.info[line].textWidth + (unsigned)x); if (XmuValidSegment(&segment)) { scanline.y = y; next.y = ctx->text.lt.info[line + 1].y; @@ -2736,7 +2738,8 @@ OldDisplayText(Widget w, XawTextPosition left, XawTextPosition right) for (seg = scan->segment; seg; seg = seg->next) SinkClearToBG(ctx->text.sink, seg->x1, scan->y, - seg->x2 - seg->x1, scan->next->y - scan->y); + (unsigned)(seg->x2 - seg->x1), + (unsigned)(scan->next->y - scan->y)); XmuDestroyArea(clip); } } @@ -2795,7 +2798,7 @@ DisplayText(Widget w, XawTextPosition left, XawTextPosition right) } if (cleol) { - segment.x1 = ctx->text.lt.info[line].textWidth + ctx->text.left_margin; + segment.x1 = (int)(ctx->text.lt.info[line].textWidth + (unsigned)ctx->text.left_margin); if (XmuValidSegment(&segment)) { scanline.y = y; next.y = ctx->text.lt.info[line + 1].y; @@ -3093,7 +3096,7 @@ TextSinkResize(Widget w) /* ARGSUSED */ void -_XawTextCheckResize(TextWidget ctx) +_XawTextCheckResize(TextWidget ctx _X_UNUSED) { return; } @@ -3110,13 +3113,13 @@ _XawTextSelectionList(TextWidget ctx, String *list, Cardinal nelems) int n; if (nelems > (Cardinal)ctx->text.s.array_size) { - sel = (Atom *)XtRealloc((char *)sel, sizeof(Atom) * nelems); - ctx->text.s.array_size = nelems; + sel = (Atom *)XtRealloc((char *)sel, (Cardinal)(sizeof(Atom) * (size_t)nelems)); + ctx->text.s.array_size = (int)nelems; ctx->text.s.selections = sel; } - for (n = nelems; --n >= 0; sel++, list++) + for (n = (int)nelems; --n >= 0; sel++, list++) *sel = XInternAtom(dpy, *list, False); - ctx->text.s.atom_count = nelems; + ctx->text.s.atom_count = (int)nelems; return (ctx->text.s.selections); } @@ -3254,16 +3257,16 @@ XawTextExpose(Widget w, XEvent *event, Region region) XRectangle expose; if (event->type == Expose) { - expose.x = event->xexpose.x; - expose.y = event->xexpose.y; - expose.width = event->xexpose.width; - expose.height = event->xexpose.height; + expose.x = (short)event->xexpose.x; + expose.y = (short)event->xexpose.y; + expose.width = (unsigned short)event->xexpose.width; + expose.height = (unsigned short)event->xexpose.height; } else if (event->type == GraphicsExpose) { - expose.x = event->xgraphicsexpose.x; - expose.y = event->xgraphicsexpose.y; - expose.width = event->xgraphicsexpose.width; - expose.height = event->xgraphicsexpose.height; + expose.x = (short)event->xgraphicsexpose.x; + expose.y = (short)event->xgraphicsexpose.y; + expose.width = (unsigned short)event->xgraphicsexpose.width; + expose.height = (unsigned short)event->xgraphicsexpose.height; } else return; @@ -3642,7 +3645,7 @@ XawTextResize(Widget w) */ /*ARGSUSED*/ static Boolean -XawTextSetValues(Widget current, Widget request, Widget cnew, +XawTextSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, ArgList args, Cardinal *num_args) { TextWidget oldtw = (TextWidget)current; @@ -3679,8 +3682,9 @@ XawTextSetValues(Widget current, Widget request, Widget cnew, if (oldtw->text.r_margin.bottom != newtw->text.r_margin.bottom) { newtw->text.margin.bottom = newtw->text.r_margin.bottom; if (newtw->text.hbar != NULL) - newtw->text.margin.bottom += newtw->text.hbar->core.height + - newtw->text.hbar->core.border_width; + newtw->text.margin.bottom = (Position)(newtw->text.margin.bottom + + (newtw->text.hbar->core.height + + newtw->text.hbar->core.border_width)); redisplay = True; } @@ -3818,8 +3822,8 @@ _XawTextPosToXY(Widget w, XawTextPosition pos, Position *x, Position *y) int line, ix, iy; LineAndXYForPosition((TextWidget)w, pos, &line, &ix, &iy); - *x = ix; - *y = iy; + *x = (Position)ix; + *y = (Position)iy; } /******************************************************************* @@ -4147,6 +4151,9 @@ TextClassRec textClassRec = { /* simple */ { XawTextChangeSensitive, /* change_sensitive */ +#ifndef OLDXAW + NULL, +#endif }, /* text */ { diff --git a/lib/libXaw/src/TextAction.c b/lib/libXaw/src/TextAction.c index 6363259d1..43d1d3258 100644 --- a/lib/libXaw/src/TextAction.c +++ b/lib/libXaw/src/TextAction.c @@ -245,7 +245,7 @@ void _XawSourceSetUndoMerge(TextSrcObject, Bool); #ifndef OLDXAW #define MAX_KILL_RINGS 1024 XawTextKillRing *xaw_text_kill_ring; -static XawTextKillRing kill_ring_prev, kill_ring_null = { &kill_ring_prev, }; +static XawTextKillRing kill_ring_prev, kill_ring_null = { &kill_ring_prev, NULL, 0, 0, 0 }; static unsigned num_kill_rings; #endif @@ -307,24 +307,24 @@ NotePosition(TextWidget ctx, XEvent *event) switch (event->type) { case ButtonPress: case ButtonRelease: - ctx->text.ev_x = event->xbutton.x; - ctx->text.ev_y = event->xbutton.y; + ctx->text.ev_x = (Position)event->xbutton.x; + ctx->text.ev_y = (Position)event->xbutton.y; break; case KeyPress: case KeyRelease: { XRectangle cursor; XawTextSinkGetCursorBounds(ctx->text.sink, &cursor); - ctx->text.ev_x = cursor.x + cursor.width / 2; - ctx->text.ev_y = cursor.y + cursor.height / 2; + ctx->text.ev_x = (Position)(cursor.x + cursor.width / 2); + ctx->text.ev_y = (Position)(cursor.y + cursor.height / 2); } break; case MotionNotify: - ctx->text.ev_x = event->xmotion.x; - ctx->text.ev_y = event->xmotion.y; + ctx->text.ev_x = (Position)(event->xmotion.x); + ctx->text.ev_y = (Position)(event->xmotion.y); break; case EnterNotify: case LeaveNotify: - ctx->text.ev_x = event->xcrossing.x; - ctx->text.ev_y = event->xcrossing.y; + ctx->text.ev_x = (Position)(event->xcrossing.x); + ctx->text.ev_y = (Position)(event->xcrossing.y); } } @@ -365,9 +365,9 @@ struct _SelectionList { /*ARGSUSED*/ static void -_SelectionReceived(Widget w, XtPointer client_data, Atom *selection, +_SelectionReceived(Widget w, XtPointer client_data, Atom *selection _X_UNUSED, Atom *type, XtPointer value, unsigned long *length, - int *format) + int *format _X_UNUSED) { Display *d = XtDisplay(w); TextWidget ctx = (TextWidget)w; @@ -421,7 +421,7 @@ _SelectionReceived(Widget w, XtPointer client_data, Atom *selection, fprintf(stderr, "Xaw Text Widget: An attempt was made to insert " "an illegal selection.\n"); - textprop.value = (unsigned char *)" >> ILLEGAL SELECTION << "; + textprop.value = (const unsigned char *)" >> ILLEGAL SELECTION << "; textprop.nitems = strlen((char *) textprop.value); if (XwcTextPropertyToTextList(d, &textprop, &wlist, &count) != Success @@ -438,7 +438,7 @@ _SelectionReceived(Widget w, XtPointer client_data, Atom *selection, } text.ptr = (char*)value; text.firstPos = 0; - text.length = *length; + text.length = (int)*length; if (_XawTextReplace(ctx, ctx->text.insertPos, ctx->text.insertPos, &text)) { XBell(XtDisplay(ctx), 0); EndAction(ctx); @@ -481,7 +481,7 @@ GetSelection(Widget w, Time timev, String *params, Cardinal num_params) Atom type = XA_STRING; char *line = XFetchBuffer(XtDisplay(w), &nbytes, buffer); - if ((length = nbytes) != 0L) + if ((length = (unsigned long)nbytes) != 0L) _SelectionReceived(w, NULL, &selection, &type, line, &length, &fmt8); else if (num_params > 1) GetSelection(w, timev, params+1, num_params-1); @@ -524,12 +524,12 @@ Move(TextWidget ctx, XEvent *event, XawTextScanDirection dir, short mult = MULT(ctx); if (mult < 0) { - mult = -mult; + mult = (short)(-mult); dir = dir == XawsdLeft ? XawsdRight : XawsdLeft; } insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, - type, dir, mult, include); + type, dir, mult, (Boolean)include); StartAction(ctx, event); @@ -548,14 +548,14 @@ Move(TextWidget ctx, XEvent *event, XawTextScanDirection dir, /*ARGSUSED*/ static void -MoveForwardChar(Widget w, XEvent *event, String *p, Cardinal *n) +MoveForwardChar(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { Move((TextWidget)w, event, XawsdRight, XawstPositions, True); } /*ARGSUSED*/ static void -MoveBackwardChar(Widget w, XEvent *event, String *p, Cardinal *n) +MoveBackwardChar(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { Move((TextWidget)w, event, XawsdLeft, XawstPositions, True); } @@ -586,7 +586,7 @@ MoveForwardParagraph(Widget w, XEvent *event, String *p, Cardinal *n) short mult = MULT(ctx); if (mult < 0) { - ctx->text.mult = -mult; + ctx->text.mult = (short)(-mult); MoveBackwardParagraph(w, event, p, n); return; } @@ -632,7 +632,7 @@ MoveBackwardParagraph(Widget w, XEvent *event, String *p, Cardinal *n) short mult = MULT(ctx); if (mult < 0) { - ctx->text.mult = -mult; + ctx->text.mult = (short)(-mult); MoveForwardParagraph(w, event, p, n); return; } @@ -670,14 +670,14 @@ MoveBackwardParagraph(Widget w, XEvent *event, String *p, Cardinal *n) /*ARGSUSED*/ static void -MoveToLineEnd(Widget w, XEvent *event, String *p, Cardinal *n) +MoveToLineEnd(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { Move((TextWidget)w, event, XawsdRight, XawstEOL, False); } /*ARGSUSED*/ static void -MoveToLineStart(Widget w, XEvent *event, String *p, Cardinal *n) +MoveToLineStart(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { Move((TextWidget)w, event, XawsdLeft, XawstEOL, False); } @@ -694,7 +694,7 @@ MoveLine(TextWidget ctx, XEvent *event, XawTextScanDirection dir) XawTextUnsetSelection((Widget)ctx); if (dir == XawsdLeft) - mult = mult == 0 ? 5 : mult + 1; + mult = (short)((mult == 0) ? 5 : mult + 1); cnew = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL, XawsdLeft, 1, False); @@ -738,7 +738,7 @@ MoveNextLine(Widget w, XEvent *event, String *p, Cardinal *n) short mult = MULT(ctx); if (mult < 0) { - ctx->text.mult = -mult; + ctx->text.mult = (short)(-mult); MovePreviousLine(w, event, p, n); return; } @@ -756,7 +756,7 @@ MovePreviousLine(Widget w, XEvent *event, String *p, Cardinal *n) short mult = MULT(ctx); if (mult < 0) { - ctx->text.mult = -mult; + ctx->text.mult = (short)(-mult); MoveNextLine(w, event, p, n); return; } @@ -770,14 +770,14 @@ MovePreviousLine(Widget w, XEvent *event, String *p, Cardinal *n) /*ARGSUSED*/ static void -MoveBeginningOfFile(Widget w, XEvent *event, String *p, Cardinal *n) +MoveBeginningOfFile(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { Move((TextWidget)w, event, XawsdLeft, XawstAll, True); } /*ARGSUSED*/ static void -MoveEndOfFile(Widget w, XEvent *event, String *p, Cardinal *n) +MoveEndOfFile(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { Move((TextWidget)w, event, XawsdRight, XawstAll, True); } @@ -788,7 +788,7 @@ Scroll(TextWidget ctx, XEvent *event, XawTextScanDirection dir) short mult = MULT(ctx); if (mult < 0) { - mult = -mult; + mult = (short)(-mult); dir = dir == XawsdLeft ? XawsdRight : XawsdLeft; } @@ -814,20 +814,20 @@ Scroll(TextWidget ctx, XEvent *event, XawTextScanDirection dir) /*ARGSUSED*/ static void -ScrollOneLineUp(Widget w, XEvent *event, String *p, Cardinal *n) +ScrollOneLineUp(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { Scroll((TextWidget)w, event, XawsdLeft); } /*ARGSUSED*/ static void -ScrollOneLineDown(Widget w, XEvent *event, String *p, Cardinal *n) +ScrollOneLineDown(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { Scroll((TextWidget)w, event, XawsdRight); } static void -MovePage(TextWidget ctx, XEvent *event, XawTextScanDirection dir) +MovePage(TextWidget ctx, XEvent *event _X_UNUSED, XawTextScanDirection dir) { int scroll_val = 0; XawTextPosition old_pos; @@ -837,7 +837,7 @@ MovePage(TextWidget ctx, XEvent *event, XawTextScanDirection dir) case XawsdLeft: if (ctx->text.lt.top != 0) scroll_val = -Max(1, ctx->text.lt.lines - 1); - break; + break; case XawsdRight: if (!IsPositionVisible(ctx, Max(0, ctx->text.lastPos))) scroll_val = Max(1, ctx->text.lt.lines - 1); @@ -881,7 +881,7 @@ MoveNextPage(Widget w, XEvent *event, String *p, Cardinal *n) short mult = MULT(ctx); if (mult < 0) { - ctx->text.mult = -mult; + ctx->text.mult = (short)(-mult); MovePreviousPage(w, event, p, n); return; } @@ -906,7 +906,7 @@ MovePreviousPage(Widget w, XEvent *event, String *p, Cardinal *n) short mult = MULT(ctx); if (mult < 0) { - ctx->text.mult = -mult; + ctx->text.mult = (short)(-mult); MoveNextPage(w, event, p, n); return; } @@ -968,8 +968,8 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, target, type, (XPointer *)&std_targets, &std_length, format); - *length = 7 + (edit_mode == XawtextEdit) + std_length; - *value = XtMalloc((unsigned)sizeof(Atom)*(*length)); + *length = (7 + (unsigned long)(edit_mode == XawtextEdit) + std_length); + *value = XtMalloc((Cardinal)((unsigned)sizeof(Atom)*(*length))); targetP = *(Atom**)value; *targetP++ = XA_STRING; *targetP++ = XA_TEXT(d); @@ -1035,9 +1035,9 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, *length = strlen(*value); } else { - *value = XtMalloc((salt->length + 1) * sizeof(unsigned char)); + *value = XtMalloc(((size_t)(salt->length + 1) * sizeof(unsigned char))); strcpy (*value, salt->contents); - *length = salt->length; + *length = (unsigned long)salt->length; } /* Got *value,*length, now in COMPOUND_TEXT format. */ if (XawTextFormat(ctx, XawFmtWide)) { @@ -1144,7 +1144,7 @@ LoseSelection(Widget w, Atom *selection) } static void -_LoseSelection(Widget w, Atom *selection, char **contents, int *length) +_LoseSelection(Widget w, Atom *selection, char **contents _X_UNUSED, int *length _X_UNUSED) { TextWidget ctx = (TextWidget)w; Atom *atomP; @@ -1278,10 +1278,10 @@ _DeleteOrKill(TextWidget ctx, XawTextPosition from, XawTextPosition to, } XtFree(string); string = (char *)textprop.value; - length = textprop.nitems; + length = (int)textprop.nitems; } else - length = strlen(string); + length = (int)strlen(string); salt->length = length + size; @@ -1289,16 +1289,16 @@ _DeleteOrKill(TextWidget ctx, XawTextPosition from, XawTextPosition to, if (!append) salt->contents = string; else { - salt->contents = XtMalloc(length + size + 1); + salt->contents = XtMalloc((length + size + 1)); if (from >= old_from) { - strncpy(salt->contents, ring, size); + strncpy(salt->contents, ring, (size_t)size); salt->contents[size] = '\0'; - strncat(salt->contents, string, length); + strncat(salt->contents, string, (size_t)length); } else { - strncpy(salt->contents, string, length); + strncpy(salt->contents, string, (size_t)length); salt->contents[length] = '\0'; - strncat(salt->contents, ring, size); + strncat(salt->contents, ring, (size_t)size); } salt->contents[length + size] = '\0'; XtFree(ring); @@ -1329,7 +1329,7 @@ _DeleteOrKill(TextWidget ctx, XawTextPosition from, XawTextPosition to, text.length = 0; text.firstPos = 0; - text.format = _XawTextFormat(ctx); + text.format = (unsigned long)_XawTextFormat(ctx); text.ptr = ""; if (_XawTextReplace(ctx, from, to, &text)) { @@ -1349,7 +1349,7 @@ DeleteOrKill(TextWidget ctx, XEvent *event, XawTextScanDirection dir, short mult = MULT(ctx); if (mult < 0) { - mult = -mult; + mult = (short)(-mult); dir = dir == XawsdLeft ? XawsdRight : XawsdLeft; } @@ -1359,7 +1359,7 @@ DeleteOrKill(TextWidget ctx, XEvent *event, XawTextScanDirection dir, _XawSourceSetUndoMerge((TextSrcObject)ctx->text.source, True); #endif to = SrcScan(ctx->text.source, ctx->text.insertPos, - type, dir, mult, include); + type, dir, mult, (Boolean)include); /* * If no movement actually happened, then bump the count and try again. @@ -1368,7 +1368,7 @@ DeleteOrKill(TextWidget ctx, XEvent *event, XawTextScanDirection dir, */ if (to == ctx->text.insertPos) to = SrcScan(ctx->text.source, ctx->text.insertPos, - type, dir, mult + 1, include); + type, dir, mult + 1, (Boolean)include); if (dir == XawsdLeft) { from = to; @@ -1399,7 +1399,7 @@ DeleteChar(Widget w, XEvent *event, XawTextScanDirection dir) short mul = MULT(ctx); if (mul < 0) { - ctx->text.mult = mul = -mul; + ctx->text.mult = mul = (short)(-mul); dir = dir == XawsdLeft ? XawsdRight : XawsdLeft; } DeleteOrKill(ctx, event, dir, XawstPositions, True, False); @@ -1412,14 +1412,14 @@ DeleteChar(Widget w, XEvent *event, XawTextScanDirection dir) /*ARGSUSED*/ static void -DeleteForwardChar(Widget w, XEvent *event, String *p, Cardinal *n) +DeleteForwardChar(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { DeleteChar(w, event, XawsdRight); } /*ARGSUSED*/ static void -DeleteBackwardChar(Widget w, XEvent *event, String *p, Cardinal *n) +DeleteBackwardChar(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { DeleteChar(w, event, XawsdLeft); } @@ -1478,7 +1478,7 @@ KillBackwardWord(Widget w, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static void -KillToEndOfLine(Widget w, XEvent *event, String *p, Cardinal *n) +KillToEndOfLine(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { TextWidget ctx = (TextWidget)w; XawTextPosition end_of_line; @@ -1487,7 +1487,7 @@ KillToEndOfLine(Widget w, XEvent *event, String *p, Cardinal *n) if (mult < 0) { dir = XawsdLeft; - mult = -mult; + mult = (short)(-mult); } StartAction(ctx, event); @@ -1506,7 +1506,7 @@ KillToEndOfLine(Widget w, XEvent *event, String *p, Cardinal *n) /*ARGSUSED*/ static void -KillToEndOfParagraph(Widget w, XEvent *event, String *p, Cardinal *n) +KillToEndOfParagraph(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { DeleteOrKill((TextWidget)w, event, XawsdRight, XawstParagraph, False, True); } @@ -1521,7 +1521,7 @@ _XawTextZapSelection(TextWidget ctx, XEvent *event, Bool kill) /*ARGSUSED*/ static void -KillCurrentSelection(Widget w, XEvent *event, String *p, Cardinal *n) +KillCurrentSelection(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { _XawTextZapSelection((TextWidget) w, event, True); } @@ -1529,7 +1529,7 @@ KillCurrentSelection(Widget w, XEvent *event, String *p, Cardinal *n) #ifndef OLDXAW /*ARGSUSED*/ static void -KillRingYank(Widget w, XEvent *event, String *params, Cardinal *num_params) +KillRingYank(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { TextWidget ctx = (TextWidget)w; XawTextPosition insertPos = ctx->text.insertPos; @@ -1579,7 +1579,7 @@ KillRingYank(Widget w, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static void -DeleteCurrentSelection(Widget w, XEvent *event, String *p, Cardinal *n) +DeleteCurrentSelection(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { _XawTextZapSelection((TextWidget)w, event, False); } @@ -1604,7 +1604,7 @@ StripSpaces(TextWidget ctx, XawTextPosition left, XawTextPosition right, text.length = 1; position = XawTextSourceRead(ctx->text.source, position, - &block, right - left); + &block, (int)(right - left)); done = False; space = False; /* convert tabs and returns to spaces */ @@ -1632,7 +1632,7 @@ StripSpaces(TextWidget ctx, XawTextPosition left, XawTextPosition right, } tmp += i; position = XawTextSourceRead(ctx->text.source, tmp, - &block, right - tmp); + &block, (int)(right - tmp)); if (block.length == 0 || tmp == position || tmp >= right) done = True; } @@ -1641,7 +1641,7 @@ StripSpaces(TextWidget ctx, XawTextPosition left, XawTextPosition right, text.length = 0; position = tmp = left; position = XawTextSourceRead(ctx->text.source, position, - &block, right - left); + &block, (int)(right - left)); ipos = ctx->text.insertPos; done = False; while (!done) { @@ -1693,7 +1693,7 @@ StripSpaces(TextWidget ctx, XawTextPosition left, XawTextPosition right, tmp += i + 1; count = 0; position = XawTextSourceRead(ctx->text.source, tmp, - &block, right - tmp); + &block, (int)(right - tmp)); if (block.length == 0 || tmp == position || tmp >= right) done = True; } @@ -1722,7 +1722,7 @@ Tabify(TextWidget ctx, XawTextPosition left, XawTextPosition right, text.length = 1; position = XawTextSourceRead(ctx->text.source, position, - &block, right - left); + &block, (int)(right - left)); ipos = ctx->text.insertPos; done = zero = False; if (tab_count) @@ -1837,7 +1837,7 @@ Tabify(TextWidget ctx, XawTextPosition left, XawTextPosition right, count = 0; tmp = left + offset; position = XawTextSourceRead(ctx->text.source, tmp, - &block, right - tmp); + &block, (int)(right - tmp)); if (tmp == position || tmp >= right) done = True; } @@ -1866,7 +1866,7 @@ Untabify(TextWidget ctx, XawTextPosition left, XawTextPosition right, text.ptr = tabs; position = XawTextSourceRead(ctx->text.source, position, - &block, right - left); + &block, (int)(right - left)); ipos = ctx->text.insertPos; done = False; zero = False; @@ -1913,7 +1913,7 @@ Untabify(TextWidget ctx, XawTextPosition left, XawTextPosition right, if (text.length > 8) { int j; - text.ptr = XtMalloc(text.length); + text.ptr = XtMalloc((Cardinal)text.length); for (j = 0; j < text.length; j++) text.ptr[j] = ' '; } @@ -1962,7 +1962,7 @@ Untabify(TextWidget ctx, XawTextPosition left, XawTextPosition right, tab_base = tab_column = tab_index = 0; } position = XawTextSourceRead(ctx->text.source, tmp, - &block, right - tmp); + &block, (int)(right - tmp)); if (tmp == position || tmp >= right) done = True; } @@ -1988,8 +1988,8 @@ FormatText(TextWidget ctx, XawTextPosition left, Bool force, undo = src->textSrc.enable_undo && src->textSrc.undo_state == False; if (undo) { if (!pos) { - num_pos = src->textSrc.num_text; - pos = XawStackAlloc(sizeof(XawTextPosition) * num_pos, buf); + num_pos = (int)src->textSrc.num_text; + pos = (XawStackAlloc(sizeof(XawTextPosition) * (size_t)num_pos, buf)); for (i = 0; i < num_pos; i++) pos[i] = ((TextWidget)src->textSrc.text[i])->text.insertPos; freepos = True; @@ -1998,8 +1998,8 @@ FormatText(TextWidget ctx, XawTextPosition left, Bool force, freepos = False; src->textSrc.undo_state = True; block.ptr = NULL; - block.firstPos = left; - block.length = right - left; + block.firstPos = (int)left; + block.length = (int)(right - left); text = █ } else @@ -2011,23 +2011,23 @@ FormatText(TextWidget ctx, XawTextPosition left, Bool force, unsigned llen, rlen, size; ptr = lbuf = block.ptr; - llen = block.length; - rlen = llen + (ctx->text.lastPos - end); + llen = (unsigned)block.length; + rlen = (unsigned)(llen + (ctx->text.lastPos - end)); block.firstPos = 0; - block.format = _XawTextFormat(ctx); + block.format = (unsigned long)_XawTextFormat(ctx); rbuf = _XawTextGetText(ctx, left, left + rlen); size = XawTextFormat(ctx, XawFmtWide) ? sizeof(wchar_t) : sizeof(char); if (llen != rlen || memcmp(lbuf, rbuf, llen * size)) { block.ptr = lbuf; - block.length = llen; + block.length = (int)llen; _XawTextReplace(ctx, left, left + rlen, &block); src->textSrc.undo_state = False; block.ptr = rbuf; - block.length = rlen; + block.length = (int)rlen; _XawTextReplace(ctx, left, left + llen, &block); } else @@ -2064,7 +2064,7 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool force, int level, int i, count, cpos; Bool done, force2 = force, recurse = False; - position = XawTextSourceRead(ctx->text.source, left, &block, right - left); + position = XawTextSourceRead(ctx->text.source, left, &block, (int)(right - left)); if (block.length == 0 || left >= right || (level == 1 && ((XawTextFormat(ctx, XawFmt8Bit) && block.ptr[0] != ' ' && @@ -2073,7 +2073,7 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool force, int level, (XawTextFormat(ctx, XawFmtWide) && _Xaw_atowc(XawSP) != *(wchar_t*)block.ptr && _Xaw_atowc(XawTAB) != *(wchar_t*)block.ptr && - !iswalnum(*(wchar_t*)block.ptr))))) + !iswalnum((wint_t)*(wchar_t*)block.ptr))))) return (XawEditDone); if (level == 1 && !paragraph) { @@ -2082,7 +2082,7 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool force, int level, return (XawEditError); right += ctx->text.lastPos - tmp; position = XawTextSourceRead(ctx->text.source, left, &block, - right - left); + (int)(right - left)); } text.firstPos = 0; @@ -2113,7 +2113,7 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool force, int level, } tmp = position; position = XawTextSourceRead(ctx->text.source, position, - &block, right - position); + &block, (int)(right - position)); if (tmp == position) done = True; } @@ -2121,7 +2121,7 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool force, int level, if (count < ctx->text.left_column) { int bytes = ctx->text.left_column - count; - text.ptr = XawStackAlloc(bytes, buf); + text.ptr = XawStackAlloc((unsigned)bytes, buf); text.length = bytes; for (i = 0; i < bytes; i++) text.ptr[i] = ' '; @@ -2199,7 +2199,7 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool force, int level, else count = ctx->text.right_column; if (count > right - left) - count -= right - left; + count = (int)(count - (right - left)); else count = 0; } @@ -2219,12 +2219,12 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool force, int level, if ((XawTextFormat(ctx, XawFmt8Bit) && isalnum(*(unsigned char*)block.ptr)) || (XawTextFormat(ctx, XawFmtWide) - && iswalnum(*(wchar_t*)block.ptr))) + && iswalnum((wint_t)*(wchar_t*)block.ptr))) alnum = 1; } count = (count + alnum) >> 1; } - text.ptr = XawStackAlloc(count, buf); + text.ptr = XawStackAlloc((unsigned)count, buf); text.length = count; for (i = 0; i < count; i++) text.ptr[i] = ' '; @@ -2264,7 +2264,7 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool force, int level, inc = ii = (count + .5) / (double)i; steps = count; - text.ptr = XawStackAlloc(steps, buf); + text.ptr = XawStackAlloc((unsigned)steps, buf); for (i = 0; i < steps; i++) text.ptr[i] = ' '; tmp = left; @@ -2317,7 +2317,7 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool force, int level, /*ARGSUSED*/ static void -Indent(Widget w, XEvent *event, String *params, Cardinal *num_params) +Indent(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { TextWidget ctx = (TextWidget)w; TextSrcObject src = (TextSrcObject)ctx->text.source; @@ -2338,7 +2338,7 @@ Indent(Widget w, XEvent *event, String *params, Cardinal *num_params) StartAction(ctx, event); pos = XawStackAlloc(sizeof(XawTextPosition) * src->textSrc.num_text, posbuf); - for (i = 0; i < src->textSrc.num_text; i++) + for (i = 0; (Cardinal)i < src->textSrc.num_text; i++) pos[i] = ((TextWidget)src->textSrc.text[i])->text.insertPos; if (!GetBlockBoundaries(ctx, &from, &to)) { @@ -2348,14 +2348,14 @@ Indent(Widget w, XEvent *event, String *params, Cardinal *num_params) } if (undo) { - llen = to - from; + llen = (unsigned)(to - from); end = ctx->text.lastPos; lbuf = _XawTextGetText(ctx, from, to); src->textSrc.undo_state = True; } tmp = ctx->text.lastPos; - if (!Untabify(ctx, from, to, pos, src->textSrc.num_text, NULL)) { + if (!Untabify(ctx, from, to, pos, (int)src->textSrc.num_text, NULL)) { XBell(XtDisplay(ctx), 0); EndAction(ctx); XawStackFree(pos, posbuf); @@ -2370,7 +2370,7 @@ Indent(Widget w, XEvent *event, String *params, Cardinal *num_params) tmp = from; if (spaces > 0) { - text.ptr = XawStackAlloc(spaces, buf); + text.ptr = XawStackAlloc((unsigned)spaces, buf); for (i = 0; i < spaces; i++) text.ptr[i] = ' '; @@ -2378,7 +2378,7 @@ Indent(Widget w, XEvent *event, String *params, Cardinal *num_params) while (tmp < to) { _XawTextReplace(ctx, tmp, tmp, &text); - for (i = 0; i < src->textSrc.num_text; i++) + for (i = 0; (Cardinal)i < src->textSrc.num_text; i++) if (tmp < pos[i]) pos[i] += spaces; @@ -2407,7 +2407,7 @@ Indent(Widget w, XEvent *event, String *params, Cardinal *num_params) while (tmp < to) { _XawTextReplace(ctx, tmp, tmp + spaces, &text); - for (i = 0; i < src->textSrc.num_text; i++) + for (i = 0; (Cardinal)i < src->textSrc.num_text; i++) if (tmp < pos[i]) { if (tmp + spaces < pos[i]) pos[i] -= spaces; @@ -2421,22 +2421,22 @@ Indent(Widget w, XEvent *event, String *params, Cardinal *num_params) } if (!format) - Tabify(ctx, from, to, pos, src->textSrc.num_text, NULL); + Tabify(ctx, from, to, pos, (int)src->textSrc.num_text, NULL); if (undo) { - rlen = llen + (ctx->text.lastPos - end); + rlen = (unsigned)(llen + (ctx->text.lastPos - end)); rbuf = _XawTextGetText(ctx, from, from + rlen); - text.format = _XawTextFormat(ctx); + text.format = (unsigned long)_XawTextFormat(ctx); size = XawTextFormat(ctx, XawFmtWide) ? sizeof(wchar_t) : sizeof(char); if (llen != rlen || memcmp(lbuf, rbuf, llen * size)) { text.ptr = lbuf; - text.length = llen; + text.length = (int)llen; _XawTextReplace(ctx, from, from + rlen, &text); src->textSrc.undo_state = False; text.ptr = rbuf; - text.length = rlen; + text.length = (int)rlen; _XawTextReplace(ctx, from, from + llen, &text); } else @@ -2445,7 +2445,7 @@ Indent(Widget w, XEvent *event, String *params, Cardinal *num_params) XtFree(rbuf); } - for (i = 0; i < src->textSrc.num_text; i++) { + for (i = 0; (Cardinal)i < src->textSrc.num_text; i++) { TextWidget tw = (TextWidget)src->textSrc.text[i]; tw->text.insertPos = XawMin(XawMax(0, pos[i]), tw->text.lastPos); @@ -2458,7 +2458,7 @@ Indent(Widget w, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static void -ToggleOverwrite(Widget w, XEvent *event, String *params, Cardinal *num_params) +ToggleOverwrite(Widget w, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { TextWidget ctx = (TextWidget)w; @@ -2487,20 +2487,20 @@ InsertNewLineAndBackupInternal(TextWidget ctx) return (XawEditError); } - text.format = _XawTextFormat(ctx); + text.format = (unsigned long)_XawTextFormat(ctx); text.length = mult; text.firstPos = 0; if (text.format == XawFmtWide) { wchar_t *wptr; - text.ptr = XawStackAlloc(sizeof(wchar_t) * mult, buf); + text.ptr = (XawStackAlloc(sizeof(wchar_t) * (size_t)mult, buf)); wptr = (wchar_t *)text.ptr; for (count = 0; count < mult; count++) wptr[count] = _Xaw_atowc(XawLF); } else { - text.ptr = XawStackAlloc(sizeof(char) * mult, buf); + text.ptr = (XawStackAlloc(sizeof(char) * (size_t)mult, buf)); for (count = 0; count < mult; count++) text.ptr[count] = XawLF; } @@ -2531,7 +2531,7 @@ InsertNewLineAndBackupInternal(TextWidget ctx) /*ARGSUSED*/ static void -InsertNewLineAndBackup(Widget w, XEvent *event, String *p, Cardinal *n) +InsertNewLineAndBackup(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { TextWidget ctx = (TextWidget)w; XawTextPosition insertPos = ctx->text.insertPos; @@ -2558,20 +2558,20 @@ LocalInsertNewLine(TextWidget ctx, XEvent *event) /*ARGSUSED*/ static void -InsertNewLine(Widget w, XEvent *event, String *p, Cardinal *n) +InsertNewLine(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { (void)LocalInsertNewLine((TextWidget)w, event); } /*ARGSUSED*/ static void -InsertNewLineAndIndent(Widget w, XEvent *event, String *p, Cardinal *n) +InsertNewLineAndIndent(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { XawTextBlock text; XawTextPosition pos1; int length; TextWidget ctx = (TextWidget)w; - String line_to_ip; + char * line_to_ip; StartAction(ctx, event); pos1 = SrcScan(ctx->text.source, ctx->text.insertPos, @@ -2579,29 +2579,29 @@ InsertNewLineAndIndent(Widget w, XEvent *event, String *p, Cardinal *n) line_to_ip = _XawTextGetText(ctx, pos1, ctx->text.insertPos); - text.format = _XawTextFormat(ctx); + text.format = (unsigned long)_XawTextFormat(ctx); text.firstPos = 0; if (text.format == XawFmtWide) { wchar_t *ptr; - text.ptr = XtMalloc((2 + wcslen((wchar_t*)line_to_ip)) - * sizeof(wchar_t)); + text.ptr = XtMalloc((Cardinal)((2 + wcslen((wchar_t*)line_to_ip)) + * sizeof(wchar_t))); ptr = (wchar_t*)text.ptr; ptr[0] = _Xaw_atowc(XawLF); wcscpy((wchar_t*)++ptr, (wchar_t*)line_to_ip); - length = wcslen((wchar_t*)text.ptr); + length = (int)wcslen((wchar_t*)text.ptr); while (length && (iswspace(*ptr) || *ptr == _Xaw_atowc(XawTAB))) ptr++, length--; *ptr = (wchar_t)0; - text.length = wcslen((wchar_t*)text.ptr); + text.length = (int)wcslen((wchar_t*)text.ptr); } else { char *ptr; - length = strlen(line_to_ip); - text.ptr = XtMalloc((2 + length) * sizeof(char)); + length = (int)strlen(line_to_ip); + text.ptr = XtMalloc(((size_t)(2 + length) * sizeof(char))); ptr = text.ptr; ptr[0] = XawLF; strcpy(++ptr, line_to_ip); @@ -2610,7 +2610,7 @@ InsertNewLineAndIndent(Widget w, XEvent *event, String *p, Cardinal *n) while (length && (isspace(*ptr) || (*ptr == XawTAB))) ptr++, length--; *ptr = '\0'; - text.length = strlen(text.ptr); + text.length = (int)strlen(text.ptr); } XtFree(line_to_ip); @@ -2778,18 +2778,17 @@ ExtendEnd(Widget w, XEvent *event, String *params, Cardinal *num_params) static void SelectSave(Widget w, XEvent *event, String *params, Cardinal *num_params) { - int num_atoms; + int num_atoms, n; Atom *sel; Display *dpy = XtDisplay(w); Atom selections[256]; StartAction((TextWidget)w, event); - num_atoms = *num_params; + num_atoms = (int)*num_params; if (num_atoms > 256) num_atoms = 256; - for (sel=selections; --num_atoms >= 0; sel++, params++) + for (sel = selections, n = 0; n < num_atoms; n++, sel++, params++) *sel = XInternAtom(dpy, *params, False); - num_atoms = *num_params; _XawTextSaltAwaySelection((TextWidget)w, selections, num_atoms); EndAction((TextWidget)w); } @@ -2799,7 +2798,7 @@ SelectSave(Widget w, XEvent *event, String *params, Cardinal *num_params) */ /*ARGSUSED*/ static void -SetKeyboardFocus(Widget w, XEvent *event, String *params, Cardinal *num_params) +SetKeyboardFocus(Widget w, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { Widget shell, parent; @@ -2814,7 +2813,7 @@ SetKeyboardFocus(Widget w, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static void -RedrawDisplay(Widget w, XEvent *event, String *p, Cardinal *n) +RedrawDisplay(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { StartAction((TextWidget)w, event); _XawTextClearAndCenterDisplay((TextWidget)w); @@ -2834,7 +2833,7 @@ static Cardinal num_focus; /*ARGSUSED*/ static void -DestroyFocusCallback(Widget w, XtPointer user_data, XtPointer call_data) +DestroyFocusCallback(Widget w, XtPointer user_data, XtPointer call_data _X_UNUSED) { struct _focus *f = (struct _focus*)(user_data); @@ -2877,13 +2876,13 @@ TextFocusIn(Widget w, XEvent *event, String *p, Cardinal *n) if (display_caret) EndAction(ctx); - for (i = 0; i < num_focus; i++) + for (i = 0; (Cardinal)i < num_focus; i++) if (focus[i].display == XtDisplay(w)) break; - if (i >= num_focus) { + if ((Cardinal)i >= num_focus) { focus = (struct _focus*) - XtRealloc((XtPointer)focus, sizeof(struct _focus) * (num_focus + 1)); - i = num_focus; + XtRealloc((XtPointer)focus, (Cardinal)(sizeof(struct _focus) * (num_focus + 1))); + i = (int)num_focus; focus[i].widget = NULL; focus[i].display = XtDisplay(w); num_focus++; @@ -2904,7 +2903,7 @@ TextFocusIn(Widget w, XEvent *event, String *p, Cardinal *n) /*ARGSUSED*/ static void -TextFocusOut(Widget w, XEvent *event, String *p, Cardinal *n) +TextFocusOut(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { TextWidget ctx = (TextWidget)w; Bool display_caret = ctx->text.display_caret; @@ -2919,16 +2918,16 @@ TextFocusOut(Widget w, XEvent *event, String *p, Cardinal *n) shell = XtParent(shell); } - for (i = 0; i < num_focus; i++) + for (i = 0; (Cardinal)i < num_focus; i++) if (focus[i].display == XtDisplay(w)) break; XGetInputFocus(XtDisplay(w), &window, &revert); if ((XtWindow(shell) == window && - (i < num_focus && focus[i].widget == w)) + ((Cardinal)i < num_focus && focus[i].widget == w)) || event->xfocus.detail == NotifyPointer) return; - if (i < num_focus && focus[i].widget) { + if ((Cardinal)i < num_focus && focus[i].widget) { XtRemoveCallback(focus[i].widget, XtNdestroyCallback, DestroyFocusCallback, (XtPointer)&focus[i]); focus[i].widget = NULL; @@ -2946,7 +2945,7 @@ TextFocusOut(Widget w, XEvent *event, String *p, Cardinal *n) /*ARGSUSED*/ static void -TextEnterWindow(Widget w, XEvent *event, String *params, Cardinal *num_params) +TextEnterWindow(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { TextWidget ctx = (TextWidget)w; @@ -2957,7 +2956,7 @@ TextEnterWindow(Widget w, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static void -TextLeaveWindow(Widget w, XEvent *event, String *params, Cardinal *num_params) +TextLeaveWindow(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { TextWidget ctx = (TextWidget)w; @@ -3035,7 +3034,7 @@ AutoFill(TextWidget ctx) /*ARGSUSED*/ static void -InsertChar(Widget w, XEvent *event, String *p, Cardinal *n) +InsertChar(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n _X_UNUSED) { TextWidget ctx = (TextWidget)w; char *ptr, strbuf[128], ptrbuf[512]; @@ -3062,13 +3061,13 @@ InsertChar(Widget w, XEvent *event, String *p, Cardinal *n) return; } - text.format = _XawTextFormat(ctx); + text.format = (unsigned long)_XawTextFormat(ctx); if (text.format == XawFmtWide) { - text.ptr = ptr = XawStackAlloc(sizeof(wchar_t) * text.length - * mult, ptrbuf); + text.ptr = ptr = XawStackAlloc(sizeof(wchar_t) * (size_t)text.length + * (size_t)mult, ptrbuf); for (count = 0; count < mult; count++) { - memcpy((char*)ptr, (char *)strbuf, sizeof(wchar_t) * text.length); - ptr += sizeof(wchar_t) * text.length; + memcpy((char*)ptr, (char *)strbuf, sizeof(wchar_t) * (size_t)text.length); + ptr += sizeof(wchar_t) * (size_t)text.length; } #ifndef OLDXAW if (mult == 1) @@ -3076,9 +3075,9 @@ InsertChar(Widget w, XEvent *event, String *p, Cardinal *n) #endif } else { /* == XawFmt8Bit */ - text.ptr = ptr = XawStackAlloc(text.length * mult, ptrbuf); + text.ptr = ptr = XawStackAlloc((unsigned)(text.length * mult), ptrbuf); for (count = 0; count < mult; count++) { - strncpy(ptr, strbuf, text.length); + strncpy(ptr, strbuf, (size_t)text.length); ptr += text.length; } #ifndef OLDXAW @@ -3226,7 +3225,7 @@ IfHexConvertHexElseReturnParam(char *param, int *len_return) /* reject if it doesn't begin with 0x and at least one more character. */ if ((param[0] != '0') || (param[1] != 'x') || (param[2] == '\0')) { - *len_return = strlen(param); + *len_return = (int)strlen(param); return(param); } @@ -3236,13 +3235,13 @@ IfHexConvertHexElseReturnParam(char *param, int *len_return) hexval[ind] = '\0'; for (p = param+2; (c = *p) != '\0'; p++) { - hexval[ind] *= 16; + hexval[ind] = (char)(hexval[ind] * 16); if (c >= '0' && c <= '9') - hexval[ind] += c - '0'; + hexval[ind] = (char)(hexval[ind] + (c - '0')); else if (c >= 'a' && c <= 'f') - hexval[ind] += c - 'a' + 10; + hexval[ind] = (char)(hexval[ind] + (c - 'a' + 10)); else if (c >= 'A' && c <= 'F') - hexval[ind] += c - 'A' + 10; + hexval[ind] = (char)(hexval[ind] + (c - 'A' + 10)); else break; @@ -3254,7 +3253,7 @@ IfHexConvertHexElseReturnParam(char *param, int *len_return) if (++ind < XawTextActionMaxHexChars) hexval[ind] = '\0'; else { - *len_return = strlen(param); + *len_return = (int)strlen(param); return(param); } } @@ -3262,13 +3261,13 @@ IfHexConvertHexElseReturnParam(char *param, int *len_return) /* We quit the above loop becasue we hit a non hex. If that char is \0... */ if ((c == '\0') && first_digit) { - *len_return = strlen(hexval); + *len_return = (int)strlen(hexval); return (hexval); /* ...it was a legal hex string, so return it */ } /* Else, there were non-hex chars or odd digit count, so... */ - *len_return = strlen(param); + *len_return = (int)strlen(param); return (param); /* ...return the verbatim string. */ } @@ -3292,10 +3291,10 @@ InsertString(Widget w, XEvent *event, String *params, Cardinal *num_params) int i; text.firstPos = 0; - text.format = _XawTextFormat(ctx); + text.format = (unsigned long)_XawTextFormat(ctx); StartAction(ctx, event); - for (i = *num_params; i; i--, params++) { /* DO FOR EACH PARAMETER */ + for (i = (int)*num_params; i; i--, params++) { /* DO FOR EACH PARAMETER */ text.ptr = IfHexConvertHexElseReturnParam(*params, &text.length); if (text.length == 0) @@ -3371,7 +3370,7 @@ DisplayCaret(Widget w, XEvent *event, String *params, Cardinal *num_params) if (*num_params > 0) { /* default arg is "True" */ XrmValue from, to; - from.size = strlen(from.addr = params[0]); + from.size = (unsigned)strlen(from.addr = params[0]); XtConvert(w, XtRString, &from, XtRBoolean, &to); if (to.addr != NULL) @@ -3380,7 +3379,7 @@ DisplayCaret(Widget w, XEvent *event, String *params, Cardinal *num_params) return; } StartAction(ctx, event); - ctx->text.display_caret = display_caret; + ctx->text.display_caret = (Boolean)display_caret; EndAction(ctx); } @@ -3417,13 +3416,13 @@ Numeric(Widget w, XEvent *event, String *params, Cardinal *num_params) return; } else if (mult == 32767) { - mult = ctx->text.mult = - (params[0][0] - '0'); + mult = ctx->text.mult = (short)(- (params[0][0] - '0')); return; } else { mult = mult * 10 + (params[0][0] - '0') * (mult < 0 ? -1 : 1); - ctx->text.mult = ctx->text.mult * 10 + (params[0][0] - '0') * - (mult < 0 ? -1 : 1); + ctx->text.mult = (short)(ctx->text.mult * 10 + (params[0][0] - '0') * + (mult < 0 ? -1 : 1)); } if (mult != ctx->text.mult || mult >= 32767) { /* checks for overflow */ XBell(XtDisplay(w), 0); @@ -3438,7 +3437,7 @@ Numeric(Widget w, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static void -KeyboardReset(Widget w, XEvent *event, String *params, Cardinal *num_params) +KeyboardReset(Widget w, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { TextWidget ctx = (TextWidget)w; @@ -3468,7 +3467,7 @@ KeyboardReset(Widget w, XEvent *event, String *params, Cardinal *num_params) * The string reset will reset the mutiplication factor to 1. */ /*ARGSUSED*/ static void -Multiply(Widget w, XEvent *event, String *params, Cardinal *num_params) +Multiply(Widget w, XEvent *event _X_UNUSED, String *params, Cardinal *num_params) { TextWidget ctx = (TextWidget)w; int mult; @@ -3508,7 +3507,7 @@ Multiply(Widget w, XEvent *event, String *params, Cardinal *num_params) return; } - ctx->text.mult *= mult; + ctx->text.mult = (short)(ctx->text.mult * mult); } /* StripOutOldCRs() - called from FormRegion @@ -3530,7 +3529,7 @@ StripOutOldCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to, /* Initialize our TextBlock with two spaces. */ text.firstPos = 0; - text.format = _XawTextFormat(ctx); + text.format = (unsigned long)_XawTextFormat(ctx); if (text.format == XawFmt8Bit) text.ptr= " "; else { @@ -3572,7 +3571,7 @@ StripOutOldCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to, next_word = SrcScan(src, endPos, XawstWhiteSpace, XawsdRight, 1, False); - len = next_word - periodPos; + len = (int)(next_word - periodPos); text.length = 1; buf = _XawTextGetText(ctx, periodPos, next_word); @@ -3635,7 +3634,7 @@ InsertNewCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to, text.firstPos = 0; text.length = 1; - text.format = _XawTextFormat(ctx); + text.format = (unsigned long)_XawTextFormat(ctx); if (text.format == XawFmt8Bit) text.ptr = "\n"; @@ -3771,7 +3770,7 @@ BlankLine(Widget w, XawTextPosition pos, int *blanks_return) XawTextPosition r = SrcScan(src, pos, XawstEOL, XawsdRight, 1, False); while (l < r) { - l = XawTextSourceRead(src, l, &block, r - l); + l = XawTextSourceRead(src, l, &block, (int)(r - l)); if (block.length == 0) { if (blanks_return) *blanks_return = blanks; @@ -3837,7 +3836,7 @@ GetBlockBoundaries(TextWidget ctx, (XawTextFormat(ctx, XawFmtWide) && _Xaw_atowc(XawSP) != *(wchar_t*)block.ptr && _Xaw_atowc(XawTAB) != *(wchar_t*)block.ptr && - !iswalnum(*(wchar_t*)block.ptr)) || + !iswalnum((wint_t)*(wchar_t*)block.ptr)) || BlankLine((Widget)ctx, from, NULL)) { from = tmp; break; @@ -3865,7 +3864,7 @@ GetBlockBoundaries(TextWidget ctx, (XawTextFormat(ctx, XawFmtWide) && _Xaw_atowc(XawSP) != *(wchar_t*)block.ptr && _Xaw_atowc(XawTAB) != *(wchar_t*)block.ptr && - !iswalnum(*(wchar_t*)block.ptr)) || + !iswalnum((wint_t)*(wchar_t*)block.ptr)) || BlankLine((Widget)ctx, to, NULL)) break; if (to == tmp && !first) @@ -3903,7 +3902,7 @@ GetBlockBoundaries(TextWidget ctx, * removes and reinserts CRs to maximize line length without clipping */ /*ARGSUSED*/ static void -FormParagraph(Widget w, XEvent *event, String *params, Cardinal *num_params) +FormParagraph(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { TextWidget ctx = (TextWidget)w; XawTextPosition from, to, buf[32], *pos; @@ -3939,7 +3938,7 @@ FormParagraph(Widget w, XEvent *event, String *params, Cardinal *num_params) endPos = ctx->text.lastPos; } - if (FormRegion(ctx, from, to, pos, src->textSrc.num_text) == XawReplaceError) { + if (FormRegion(ctx, from, to, pos, (int)src->textSrc.num_text) == XawReplaceError) { XawStackFree(pos, buf); pos = buf; #else @@ -3964,23 +3963,23 @@ FormParagraph(Widget w, XEvent *event, String *params, Cardinal *num_params) unsigned llen, rlen, size; XawTextBlock block; - llen = to - from; - rlen = llen + (ctx->text.lastPos - endPos); + llen = (unsigned)(to - from); + rlen = (unsigned)(llen + (ctx->text.lastPos - endPos)); block.firstPos = 0; - block.format = _XawTextFormat(ctx); + block.format = (unsigned long)_XawTextFormat(ctx); rbuf = _XawTextGetText(ctx, from, from + rlen); size = XawTextFormat(ctx, XawFmtWide) ? sizeof(wchar_t) : sizeof(char); if (llen != rlen || memcmp(lbuf, rbuf, llen * size)) { block.ptr = lbuf; - block.length = llen; + block.length = (int)llen; _XawTextReplace(ctx, from, from + rlen, &block); src->textSrc.undo_state = False; block.ptr = rbuf; - block.length = rlen; + block.length = (int)rlen; _XawTextReplace(ctx, from, from + llen, &block); } else @@ -4016,7 +4015,7 @@ FormParagraph(Widget w, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static void TransposeCharacters(Widget w, XEvent *event, - String *params, Cardinal *num_params) + String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { TextWidget ctx = (TextWidget)w; XawTextPosition start, end; @@ -4050,7 +4049,7 @@ TransposeCharacters(Widget w, XEvent *event, ctx->text.insertPos = end; text.firstPos = 0; - text.format = _XawTextFormat(ctx); + text.format = (unsigned long)_XawTextFormat(ctx); /* Retrieve text and swap the characters. */ if (text.format == XawFmtWide) { @@ -4058,7 +4057,7 @@ TransposeCharacters(Widget w, XEvent *event, wchar_t *wbuf; wbuf = (wchar_t*)_XawTextGetText(ctx, start, end); - text.length = wcslen(wbuf); + text.length = (int)wcslen(wbuf); wc = wbuf[0]; for (i = 1; i < text.length; i++) wbuf[i - 1] = wbuf[i]; @@ -4069,7 +4068,7 @@ TransposeCharacters(Widget w, XEvent *event, char c; buf = _XawTextGetText(ctx, start, end); - text.length = strlen(buf); + text.length = (int)strlen(buf); c = buf[0]; for (i = 1; i < text.length; i++) buf[i - 1] = buf[i]; @@ -4089,7 +4088,7 @@ TransposeCharacters(Widget w, XEvent *event, #ifndef OLDXAW /*ARGSUSED*/ static void -Undo(Widget w, XEvent *event, String *params, Cardinal *num_params) +Undo(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { TextWidget ctx = (TextWidget)w; int mul = MULT(ctx); @@ -4098,7 +4097,7 @@ Undo(Widget w, XEvent *event, String *params, Cardinal *num_params) if (mul < 0) { toggle = True; _XawTextSrcToggleUndo((TextSrcObject)ctx->text.source); - ctx->text.mult = mul = -mul; + ctx->text.mult = (short)(mul = -mul); } StartAction(ctx, event); @@ -4122,7 +4121,7 @@ Undo(Widget w, XEvent *event, String *params, Cardinal *num_params) */ /*ARGSUSED*/ static void -NoOp(Widget w, XEvent *event, String *params, Cardinal *num_params) +NoOp(Widget w, XEvent *event _X_UNUSED, String *params, Cardinal *num_params) { if (*num_params != 1) return; @@ -4144,7 +4143,7 @@ NoOp(Widget w, XEvent *event, String *params, Cardinal *num_params) */ /*ARGSUSED*/ static void -Reconnect(Widget w, XEvent *event, String *params, Cardinal *num_params) +Reconnect(Widget w, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { _XawImReconnect(w); } @@ -4233,8 +4232,8 @@ CaseProc(Widget w, XEvent *event, int cmd) left = SrcScan(ctx->text.source, right = ctx->text.insertPos, XawstAlphaNumeric, XawsdLeft, 1 + -mul, False); block.firstPos = 0; - block.format = _XawTextFormat(ctx); - block.length = right - left; + block.format = (unsigned long)_XawTextFormat(ctx); + block.length = (int)(right - left); block.ptr = _XawTextGetText(ctx, left, right); count = 0; @@ -4243,16 +4242,16 @@ CaseProc(Widget w, XEvent *event, int cmd) if (!IsAlnum(*mb = (unsigned char)block.ptr[i])) count = 0; else if (++count == 1 || cmd != CAPITALIZE) { - ch = cmd == DOWNCASE ? ToLower(*mb) : ToUpper(*mb); + ch = (unsigned char)((cmd == DOWNCASE) ? ToLower(*mb) : ToUpper(*mb)); if (ch != *mb) { changed = True; - block.ptr[i] = ch; + block.ptr[i] = (char)ch; } } else if (cmd == CAPITALIZE) { - if ((ch = ToLower(*mb)) != *mb) { + if ((ch = (unsigned char)(ToLower(*mb))) != *mb) { changed = True; - block.ptr[i] = ch; + block.ptr[i] = (char)ch; } } } @@ -4262,14 +4261,14 @@ CaseProc(Widget w, XEvent *event, int cmd) if (!IsAlnum(*mb)) count = 0; else if (++count == 1 || cmd != CAPITALIZE) { - ch = cmd == DOWNCASE ? ToLower(*mb) : ToUpper(*mb); + ch = (unsigned char)((cmd == DOWNCASE) ? ToLower(*mb) : ToUpper(*mb)); if (ch != *mb) { changed = True; ((wchar_t*)block.ptr)[i] = _Xaw_atowc(ch); } } else if (cmd == CAPITALIZE) { - if ((ch = ToLower(*mb)) != *mb) { + if ((ch = (unsigned char)(ToLower(*mb))) != *mb) { changed = True; ((wchar_t*)block.ptr)[i] = _Xaw_atowc(ch); } @@ -4287,21 +4286,21 @@ CaseProc(Widget w, XEvent *event, int cmd) /*ARGSUSED*/ static void -CapitalizeWord(Widget w, XEvent *event, String *params, Cardinal *num_params) +CapitalizeWord(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { CaseProc(w, event, CAPITALIZE); } /*ARGSUSED*/ static void -DowncaseWord(Widget w, XEvent *event, String *params, Cardinal *num_params) +DowncaseWord(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { CaseProc(w, event, DOWNCASE); } /*ARGSUSED*/ static void -UpcaseWord(Widget w, XEvent *event, String *params, Cardinal *num_params) +UpcaseWord(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { CaseProc(w, event, UPCASE); } diff --git a/lib/libXaw/src/TextPop.c b/lib/libXaw/src/TextPop.c index 3ff29b953..3f942aa4d 100644 --- a/lib/libXaw/src/TextPop.c +++ b/lib/libXaw/src/TextPop.c @@ -61,25 +61,25 @@ in this Software without prior written authorization from The Open Group. #include <X11/Xaw/Toggle.h> #include "XawI18n.h" -static char* INSERT_FILE = "Enter Filename:"; -static char* SEARCH_LABEL_1 = "Use <Tab> to change fields."; -static char* SEARCH_LABEL_2 = "Use ^q<Tab> for <Tab>."; -static char* DISMISS_NAME = "cancel"; +static _Xconst char* INSERT_FILE = "Enter Filename:"; +static _Xconst char* SEARCH_LABEL_1 = "Use <Tab> to change fields."; +static _Xconst char* SEARCH_LABEL_2 = "Use ^q<Tab> for <Tab>."; +static _Xconst char* DISMISS_NAME = "cancel"; #define DISMISS_NAME_LEN 6 -static char* FORM_NAME = "form"; -static char* LABEL_NAME = "label"; -static char* TEXT_NAME = "text"; +static _Xconst char* FORM_NAME = "form"; +static _Xconst char* LABEL_NAME = "label"; +static _Xconst char* TEXT_NAME = "text"; #define R_OFFSET 1 -typedef void (*AddFunc)(Widget, char*, Widget); +typedef void (*AddFunc)(Widget, String, Widget); /* * Prototypes */ static void _SetField(Widget, Widget); -static void AddSearchChildren(Widget, char*, Widget); -static void AddInsertFileChildren(Widget, char*, Widget); +static void AddSearchChildren(Widget, String, Widget); +static void AddInsertFileChildren(Widget, String, Widget); static void CenterWidgetOnPoint(Widget, XEvent*); static Widget CreateDialog(Widget, String, String, AddFunc); static void DoInsert(Widget, XtPointer, XtPointer); @@ -88,17 +88,17 @@ static void DoReplaceOne(Widget, XtPointer, XtPointer); static Bool DoSearch(struct SearchAndReplace*); static Widget GetShell(Widget); static String GetString(Widget); -static String GetStringRaw(Widget); +static _XtString GetStringRaw(Widget); static void InitializeSearchWidget(struct SearchAndReplace*, XawTextScanDirection, Bool); static Bool InParams(String, String*, unsigned int); -static Bool InsertFileNamed(Widget, char*); +static Bool InsertFileNamed(Widget, String); static void PopdownFileInsert(Widget, XtPointer, XtPointer); static void PopdownSearch(Widget, XtPointer, XtPointer); static Bool Replace(struct SearchAndReplace*, Bool, Bool); static void SearchButton(Widget, XtPointer, XtPointer); -static void SetResource(Widget, char*, XtArgVal); -static Bool SetResourceByName(Widget, char*, char*, XtArgVal); +static void SetResource(Widget, String, XtArgVal); +static Bool SetResourceByName(Widget, String, String, XtArgVal); static void SetSearchLabels(struct SearchAndReplace*, String, String, Bool); static void SetWMProtocolTranslations(Widget); @@ -165,8 +165,8 @@ static char rep_text_trans[] = */ /*ARGSUSED*/ void -_XawTextInsertFileAction(Widget w, XEvent *event, - String *params, Cardinal *num_params) +_XawTextInsertFileAction(Widget w, XEvent *event _X_UNUSED, + String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { DoInsert(w, (XtPointer)XtParent(XtParent(XtParent(w))), NULL); } @@ -197,7 +197,7 @@ _XawTextInsertFile(Widget w, XEvent *event, String *params, Cardinal *num_params) { TextWidget ctx = (TextWidget)w; - char *ptr; + String ptr; XawTextEditType edit_mode; Arg args[1]; @@ -239,7 +239,7 @@ _XawTextInsertFile(Widget w, XEvent *event, */ /*ARGSUSED*/ static void -PopdownFileInsert(Widget w, XtPointer closure, XtPointer call_data) +PopdownFileInsert(Widget w _X_UNUSED, XtPointer closure, XtPointer call_data _X_UNUSED) { TextWidget ctx = (TextWidget)closure; @@ -299,7 +299,7 @@ DoInsert(Widget w, XtPointer closure, XtPointer call_data) * True if the insert was sucessful, False otherwise. */ static Bool -InsertFileNamed(Widget tw, char *str) +InsertFileNamed(Widget tw, String str) { FILE *file; XawTextBlock text; @@ -313,12 +313,12 @@ InsertFileNamed(Widget tw, char *str) fseek(file, 0L, SEEK_END); text.firstPos = 0; - text.length = ftell(file); - text.ptr = XtMalloc(text.length + 1); + text.length = (int)ftell(file); + text.ptr = XtMalloc((Cardinal)(text.length + 1)); text.format = XawFmt8Bit; fseek(file, 0L, SEEK_SET); - if (fread(text.ptr, 1, text.length, file) != text.length) + if (fread(text.ptr, 1, (size_t)text.length, file) != (size_t)text.length) XtErrorMsg("readError", "insertFileNamed", "XawError", "fread returned error", NULL, NULL); @@ -349,7 +349,7 @@ InsertFileNamed(Widget tw, char *str) * Adds all children to the InsertFile dialog widget. */ static void -AddInsertFileChildren(Widget form, char *ptr, Widget tw) +AddInsertFileChildren(Widget form, String ptr, Widget tw) { Arg args[10]; Cardinal num_args; @@ -423,7 +423,7 @@ AddInsertFileChildren(Widget form, char *ptr, Widget tw) */ /*ARGSUSED*/ void -_XawTextDoSearchAction(Widget w, XEvent *event, +_XawTextDoSearchAction(Widget w, XEvent *event _X_UNUSED, String *params, Cardinal *num_params) { TextWidget tw = (TextWidget)XtParent(XtParent(XtParent(w))); @@ -446,8 +446,8 @@ _XawTextDoSearchAction(Widget w, XEvent *event, */ /*ARGSUSED*/ void -_XawTextPopdownSearchAction(Widget w, XEvent *event, - String *params, Cardinal *num_params) +_XawTextPopdownSearchAction(Widget w, XEvent *event _X_UNUSED, + String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { TextWidget tw = (TextWidget)XtParent(XtParent(XtParent(w))); @@ -468,7 +468,7 @@ _XawTextPopdownSearchAction(Widget w, XEvent *event, */ /*ARGSUSED*/ static void -PopdownSearch(Widget w, XtPointer closure, XtPointer call_data) +PopdownSearch(Widget w _X_UNUSED, XtPointer closure, XtPointer call_data _X_UNUSED) { struct SearchAndReplace *search = (struct SearchAndReplace *)closure; @@ -490,7 +490,7 @@ PopdownSearch(Widget w, XtPointer closure, XtPointer call_data) */ /*ARGSUSED*/ static void -SearchButton(Widget w, XtPointer closure, XtPointer call_data) +SearchButton(Widget w _X_UNUSED, XtPointer closure, XtPointer call_data _X_UNUSED) { (void)DoSearch((struct SearchAndReplace *)closure); } @@ -529,7 +529,8 @@ _XawTextSearch(Widget w, XEvent *event, String *params, Cardinal *num_params) { TextWidget ctx = (TextWidget)w; XawTextScanDirection dir; - char *ptr, buf[BUFSIZ]; + String ptr; + char buf[BUFSIZ]; XawTextEditType edit_mode; Arg args[1]; wchar_t wcs[1]; @@ -634,7 +635,7 @@ InitializeSearchWidget(struct SearchAndReplace *search, * Adds all children to the Search Dialog Widget. */ static void -AddSearchChildren(Widget form, char *ptr, Widget tw) +AddSearchChildren(Widget form, String ptr, Widget tw) { Arg args[10]; Cardinal num_args; @@ -844,10 +845,10 @@ DoSearch(struct SearchAndReplace *search) text.firstPos = 0; text.ptr = GetStringRaw(search->search_text); - if ((text.format = _XawTextFormat(ctx)) == XawFmtWide) - text.length = wcslen((wchar_t*)text.ptr); + if ((text.format = (unsigned long)_XawTextFormat(ctx)) == XawFmtWide) + text.length = (int)wcslen((wchar_t*)text.ptr); else { - text.length = strlen(text.ptr); + text.length = (int)strlen(text.ptr); #ifndef OLDXAW if (search->case_sensitive) { @@ -873,19 +874,19 @@ DoSearch(struct SearchAndReplace *search) GetString to get a tame version */ if (pos == XawTextSearchError) { - char *ptr; + String ptr; int len; ptr = GetString(search->search_text); - len = strlen(ptr); + len = (int)strlen(ptr); snprintf(msg, sizeof(msg), "%s", ptr); ptr = strchr(msg, '\n'); - if (ptr != NULL || sizeof(msg) - 1 < len) { + if (ptr != NULL || sizeof(msg) - 1 < (size_t)len) { if (ptr != NULL) - len = ptr - msg + 4; + len = (int)(ptr - msg + 4); else - len = strlen(msg); + len = (int)strlen(msg); if (len < 4) strcpy(msg, "..."); @@ -925,7 +926,7 @@ DoSearch(struct SearchAndReplace *search) */ /*ARGSUSED*/ void -_XawTextDoReplaceAction(Widget w, XEvent *event, +_XawTextDoReplaceAction(Widget w, XEvent *event _X_UNUSED, String *params, Cardinal *num_params) { TextWidget ctx = (TextWidget)XtParent(XtParent(XtParent(w))); @@ -953,7 +954,7 @@ _XawTextDoReplaceAction(Widget w, XEvent *event, */ /*ARGSUSED*/ static void -DoReplaceOne(Widget w, XtPointer closure, XtPointer call_data) +DoReplaceOne(Widget w _X_UNUSED, XtPointer closure, XtPointer call_data _X_UNUSED) { Replace((struct SearchAndReplace *)closure, True, False); } @@ -973,7 +974,7 @@ DoReplaceOne(Widget w, XtPointer closure, XtPointer call_data) */ /*ARGSUSED*/ static void -DoReplaceAll(Widget w, XtPointer closure, XtPointer call_data) +DoReplaceAll(Widget w _X_UNUSED, XtPointer closure, XtPointer call_data _X_UNUSED) { Replace((struct SearchAndReplace *)closure, False, False); } @@ -1006,18 +1007,18 @@ Replace(struct SearchAndReplace *search, Bool once_only, Bool show_current) Bool redisplay; find.ptr = GetStringRaw(search->search_text); - if ((find.format = _XawTextFormat(ctx)) == XawFmtWide) - find.length = (XawTextPosition)wcslen((wchar_t*)find.ptr); + if ((find.format = (unsigned long)_XawTextFormat(ctx)) == XawFmtWide) + find.length = (int)(XawTextPosition)wcslen((wchar_t*)find.ptr); else - find.length = (XawTextPosition)strlen(find.ptr); + find.length = (int)(XawTextPosition)strlen(find.ptr); find.firstPos = 0; replace.ptr = GetStringRaw(search->rep_text); replace.firstPos = 0; - if ((replace.format = _XawTextFormat(ctx)) == XawFmtWide) - replace.length = wcslen((wchar_t*)replace.ptr); + if ((replace.format = (unsigned long)_XawTextFormat(ctx)) == XawFmtWide) + replace.length = (int)wcslen((wchar_t*)replace.ptr); else - replace.length = strlen(replace.ptr); + replace.length = (int)strlen(replace.ptr); dir = (XawTextScanDirection)(unsigned long) ((XPointer)XawToggleGetCurrent(search->left_toggle) - R_OFFSET); @@ -1034,18 +1035,18 @@ Replace(struct SearchAndReplace *search, Bool once_only, Bool show_current) if (new_pos == XawTextSearchError) { if (count == 0) { char msg[37]; - char *ptr; + String ptr; int len; ptr = GetString(search->search_text); - len = strlen(ptr); + len = (int)strlen(ptr); snprintf(msg, sizeof(msg), "%s", ptr); ptr = strchr(msg, '\n'); - if (ptr != NULL || sizeof(msg) - 1 < len) { + if (ptr != NULL || sizeof(msg) - 1 < (size_t)len) { if (ptr != NULL) - len = ptr - msg + 4; + len = (int)(ptr - msg + 4); else - len = strlen(msg); + len = (int)strlen(msg); if (len < 4) strcpy(msg, "..."); @@ -1170,7 +1171,7 @@ SetSearchLabels(struct SearchAndReplace *search, String msg1, String msg2, */ /*ARGSUSED*/ void -_XawTextSetField(Widget w, XEvent *event, String *params, Cardinal *num_params) +_XawTextSetField(Widget w, XEvent *event _X_UNUSED, String *params, Cardinal *num_params) { struct SearchAndReplace *search; Widget cnew, old; @@ -1258,7 +1259,7 @@ _SetField(Widget cnew, Widget old) * True if sucessful */ static Bool -SetResourceByName(Widget shell, char *name, char *res_name, XtArgVal value) +SetResourceByName(Widget shell, String name, String res_name, XtArgVal value) { Widget temp_widget; char buf[BUFSIZ]; @@ -1285,7 +1286,7 @@ SetResourceByName(Widget shell, char *name, char *res_name, XtArgVal value) * Sets a resource in a widget */ static void -SetResource(Widget w, char *res_name, XtArgVal value) +SetResource(Widget w, String res_name, XtArgVal value) { Arg args[1]; @@ -1319,7 +1320,7 @@ GetString(Widget text) return (string); } -static String +static _XtString GetStringRaw(Widget tw) { TextWidget ctx = (TextWidget)tw; @@ -1356,13 +1357,13 @@ CenterWidgetOnPoint(Widget w, XEvent *event) switch (event->type) { case ButtonPress: case ButtonRelease: - x = event->xbutton.x_root; - y = event->xbutton.y_root; + x = (Position)event->xbutton.x_root; + y = (Position)event->xbutton.y_root; break; case KeyPress: case KeyRelease: - x = event->xkey.x_root; - y = event->xkey.y_root; + x = (Position)event->xkey.x_root; + y = (Position)event->xkey.y_root; break; default: return; @@ -1377,16 +1378,16 @@ CenterWidgetOnPoint(Widget w, XEvent *event) XtSetArg(args[num_args], XtNborderWidth, &b_width); num_args++; XtGetValues(w, args, num_args); - width += b_width << 1; - height += b_width << 1; + width = (Dimension)(width + (b_width << 1)); + height = (Dimension)(height + (b_width << 1)); - x -= (Position)(width >> 1); + x = (Position)(x - (width >> 1)); if (x < 0) x = 0; if (x > (max_x = (Position)(XtScreen(w)->width - width))) x = max_x; - y -= (Position)(height >> 1); + y = (Position)(y - (height >> 1)); if (y < 0) y = 0; if (y > (max_y = (Position)(XtScreen(w)->height - height))) @@ -1475,7 +1476,7 @@ InParams(String str, String *p, unsigned int n) return (False); } -static char *WM_DELETE_WINDOW = "WM_DELETE_WINDOW"; +static const char *WM_DELETE_WINDOW = "WM_DELETE_WINDOW"; static void WMProtocols(Widget w, XEvent *event, String *params, Cardinal *num_params) @@ -1495,7 +1496,7 @@ WMProtocols(Widget w, XEvent *event, String *params, Cardinal *num_params) if ((event->type == ClientMessage && event->xclient.message_type == wm_protocols - && event->xclient.data.l[0] == wm_delete_window + && (Atom)event->xclient.data.l[0] == wm_delete_window && (*num_params == 0 || DO_DELETE_WINDOW)) || (event->type != ClientMessage && DO_DELETE_WINDOW)) { #undef DO_DELETE_WINDOW @@ -1537,7 +1538,7 @@ SetWMProtocolTranslations(Widget w) actions[0].proc = WMProtocols; list_size++; app_context_list = (XtAppContext *)XtRealloc - ((char *)app_context_list, list_size * sizeof(XtAppContext)); + ((char *)app_context_list, (Cardinal)(list_size * sizeof(XtAppContext))); XtAppAddActions(app_context, actions, 1); app_context_list[i] = app_context; } diff --git a/lib/libXaw/src/TextSink.c b/lib/libXaw/src/TextSink.c index 333701b03..bb6b0f2d3 100644 --- a/lib/libXaw/src/TextSink.c +++ b/lib/libXaw/src/TextSink.c @@ -100,7 +100,7 @@ static XtResource resources[] = { sizeof(Pixel), offset(foreground), XtRString, - XtDefaultForeground + (XtPointer)XtDefaultForeground }, { XtNbackground, @@ -109,7 +109,7 @@ static XtResource resources[] = { sizeof(Pixel), offset(background), XtRString, - XtDefaultBackground + (XtPointer)XtDefaultBackground }, #ifndef OLDXAW { @@ -119,7 +119,7 @@ static XtResource resources[] = { sizeof(Pixel), offset(cursor_color), XtRString, - XtDefaultForeground + (XtPointer)XtDefaultForeground }, { XawNtextProperties, @@ -293,8 +293,8 @@ XawTextSinkClassPartInitialize(WidgetClass wc) */ /*ARGSUSED*/ static void -XawTextSinkInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawTextSinkInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { TextSinkObject sink = (TextSinkObject)cnew; @@ -342,8 +342,8 @@ XawTextSinkDestroy(Widget w) */ /*ARGSUSED*/ static Boolean -XawTextSinkSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawTextSinkSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { TextSinkObject w = (TextSinkObject)cnew; TextSinkObject old_w = (TextSinkObject)current; @@ -371,8 +371,8 @@ XawTextSinkSetValues(Widget current, Widget request, Widget cnew, */ /*ARGSUSED*/ static void -DisplayText(Widget w, int x, int y, - XawTextPosition pos1, XawTextPosition pos2, Bool highlight) +DisplayText(Widget w _X_UNUSED, int x _X_UNUSED, int y _X_UNUSED, + XawTextPosition pos1 _X_UNUSED, XawTextPosition pos2 _X_UNUSED, Bool highlight _X_UNUSED) { return; } @@ -392,7 +392,7 @@ DisplayText(Widget w, int x, int y, */ /*ARGSUSED*/ static void -InsertCursor(Widget w, int x, int y, XawTextInsertState state) +InsertCursor(Widget w _X_UNUSED, int x _X_UNUSED, int y _X_UNUSED, XawTextInsertState state _X_UNUSED) { return; } @@ -423,15 +423,15 @@ ClearToBackground(Widget w, int x, int y, TextWidget xaw = (TextWidget)XtParent(w); Position x1, y1, x2, y2; - x1 = XawMax(x, xaw->text.r_margin.left); - y1 = XawMax(y, xaw->text.r_margin.top); - x2 = XawMin(x + (int)width, (int)XtWidth(xaw) - xaw->text.r_margin.right); - y2 = XawMin(y + (int)height, (int)XtHeight(xaw) - xaw->text.r_margin.bottom); + x1 = (XawMax(x, xaw->text.r_margin.left)); + y1 = (XawMax(y, xaw->text.r_margin.top)); + x2 = (XawMin(x + (int)width, (int)XtWidth(xaw) - xaw->text.r_margin.right)); + y2 = (XawMin(y + (int)height, (int)XtHeight(xaw) - xaw->text.r_margin.bottom)); - x = x1; - y = y1; - width = XawMax(0, x2 - x1); - height = XawMax(0, y2 - y1); + x = (int)x1; + y = (int)y1; + width = (unsigned)(XawMax(0, x2 - x1)); + height = (unsigned)(XawMax(0, y2 - y1)); if (height != 0 && width != 0) XClearArea(XtDisplayOfObject(w), XtWindowOfObject(w), @@ -457,8 +457,8 @@ ClearToBackground(Widget w, int x, int y, */ /*ARGSUSED*/ static void -FindPosition(Widget w, XawTextPosition fromPos, int fromx, int width, - Bool stopAtWordBreak, XawTextPosition *resPos, +FindPosition(Widget w _X_UNUSED, XawTextPosition fromPos _X_UNUSED, int fromx _X_UNUSED, int width _X_UNUSED, + Bool stopAtWordBreak _X_UNUSED, XawTextPosition *resPos, int *resWidth, int *resHeight) { *resPos = fromPos; @@ -483,8 +483,8 @@ FindPosition(Widget w, XawTextPosition fromPos, int fromx, int width, */ /*ARGSUSED*/ static void -FindDistance(Widget w, XawTextPosition fromPos, int fromx, - XawTextPosition toPos, int *resWidth, +FindDistance(Widget w _X_UNUSED, XawTextPosition fromPos, int fromx _X_UNUSED, + XawTextPosition toPos _X_UNUSED, int *resWidth, XawTextPosition *resPos, int *resHeight) { *resWidth = *resHeight = 0; @@ -507,7 +507,7 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx, */ /*ARGSUSED*/ static void -Resolve(Widget w, XawTextPosition pos, int fromx, int width, +Resolve(Widget w _X_UNUSED, XawTextPosition pos _X_UNUSED, int fromx _X_UNUSED, int width _X_UNUSED, XawTextPosition *resPos) { *resPos = pos; @@ -529,7 +529,7 @@ Resolve(Widget w, XawTextPosition pos, int fromx, int width, */ /*ARGSUSED*/ static int -MaxLines(Widget w, unsigned int height) +MaxLines(Widget w _X_UNUSED, unsigned int height _X_UNUSED) { /* * The fontset has gone down to descent Sink Widget, so @@ -556,7 +556,7 @@ MaxLines(Widget w, unsigned int height) */ /*ARGSUSED*/ static int -MaxHeight(Widget w, int lines) +MaxHeight(Widget w _X_UNUSED, int lines _X_UNUSED) { return (0); } @@ -574,7 +574,7 @@ MaxHeight(Widget w, int lines) */ /*ARGSUSED*/ static void -SetTabs(Widget w, int tab_count, short *tabs) +SetTabs(Widget w _X_UNUSED, int tab_count _X_UNUSED, short *tabs _X_UNUSED) { return; } @@ -592,9 +592,9 @@ SetTabs(Widget w, int tab_count, short *tabs) */ /*ARGSUSED*/ static void -GetCursorBounds(Widget w, XRectangle *rect) +GetCursorBounds(Widget w _X_UNUSED, XRectangle *rect) { - rect->x = rect->y = rect->width = rect->height = 0; + rect->x = rect->y = (short)(rect->width = rect->height = 0); } /* @@ -858,7 +858,7 @@ XawTextSinkSetTabs(Widget w, int tab_count, int *tabs) { if (tab_count > 0) { TextSinkObjectClass cclass = (TextSinkObjectClass)w->core.widget_class; - short *char_tabs = (short*)XtMalloc((unsigned)tab_count * sizeof(short)); + short *char_tabs = (short*)XtMalloc((Cardinal)((unsigned)tab_count * sizeof(short))); short *tab, len = 0; int i; @@ -1015,7 +1015,7 @@ static Cardinal num_prop_lists; static int bcmp_qident(_Xconst void *left, _Xconst void *right) { - return ((long)left - (*(XawTextProperty**)right)->identifier); + return (int)((long)left - (*(XawTextProperty**)right)->identifier); } static int @@ -1102,7 +1102,7 @@ SetXlfdDefaults(Display *display, XawTextProperty *property) atom = XInternAtom(display, "UNDERLINE_THICKNESS", True); if (XGetFontProperty(property->font, atom, &value) && (str = XGetAtomName(display, value)) != NULL) { - property->underline_thickness = atoi(str); + property->underline_thickness = (short)(atoi(str)); XFree(str); } else { @@ -1115,9 +1115,9 @@ SetXlfdDefaults(Display *display, XawTextProperty *property) */ if (property->pixel_size != NULLQUARK) { property->underline_thickness = - atoi(XrmQuarkToString(property->pixel_size)) / 10; + (short)(atoi(XrmQuarkToString(property->pixel_size)) / 10); property->underline_thickness = - XawMax(1, property->underline_thickness); + (XawMax(1, property->underline_thickness)); } else property->underline_thickness = 1; @@ -1126,7 +1126,7 @@ SetXlfdDefaults(Display *display, XawTextProperty *property) atom = XInternAtom(display, "UNDERLINE_POSITION", True); if (XGetFontProperty(property->font, atom, &value) && (str = XGetAtomName(display, value)) != NULL) { - property->underline_position = atoi(str); + property->underline_position = (short)(atoi(str)); XFree(str); } else @@ -1139,8 +1139,8 @@ SetXlfdDefaults(Display *display, XawTextProperty *property) /* I am assuming xlfd does not consider that lines are * centered in the path */ - property->underline_position += property->underline_thickness >> 1; - + property->underline_position = (short)(property->underline_position + + (property->underline_thickness >> 1)); } static void @@ -1148,7 +1148,7 @@ DestroyTextPropertyList(XawTextPropertyList *list) { int i; - for (i = 0; i < list->num_properties; i++) { + for (i = 0; (Cardinal)i < list->num_properties; i++) { if (list->properties[i]->font) XFreeFont(DisplayOfScreen(list->screen), list->properties[i]->font); XtFree((char*)list->properties[i]); @@ -1194,7 +1194,7 @@ XawTextSinkCopyProperty(Widget w, XrmQuark property) if (cur) memcpy(ret, cur, sizeof(XawTextProperty)); ret->identifier = NULLQUARK; - ret->mask &= ~XAW_TPROP_FONT; + ret->mask &= (unsigned long)(~XAW_TPROP_FONT); return (ret); } @@ -1208,10 +1208,11 @@ _XawTextSinkAddProperty(XawTextPropertyList *list, XawTextProperty *property, char identifier[1024]; char foreground[16]; char background[16]; - char *foundry, *family, *weight, *slant, *setwidth, *addstyle, *pixel_size, + const char *foundry, *family, *weight, *slant, *setwidth, *addstyle, *pixel_size, *point_size, *res_x, *res_y, *spacing, *avgwidth, *registry, *encoding; - char *xlfd; - static char *asterisk = "*", *null = ""; + const char *xlfd; + static const char *asterisk = "*"; + static const char *null = ""; XrmQuark quark; if (list == NULL || property == NULL) @@ -1324,7 +1325,7 @@ _XawTextSinkAddProperty(XawTextPropertyList *list, XawTextProperty *property, SetXlfdDefaults(DisplayOfScreen(list->screen), result); } else - result->mask &= ~XAW_TPROP_FONT; + result->mask &= (unsigned long)(~XAW_TPROP_FONT); } if (result->font) @@ -1356,8 +1357,9 @@ _XawTextSinkAddProperty(XawTextPropertyList *list, XawTextProperty *property, } list->properties = (XawTextProperty**) - XtRealloc((XtPointer)list->properties, sizeof(XawTextProperty*) * - (list->num_properties + 1)); + XtRealloc((XtPointer)list->properties, + (Cardinal)(sizeof(XawTextProperty*) * + (list->num_properties + 1))); list->properties[list->num_properties++] = result; qsort((void*)list->properties, list->num_properties, sizeof(XawTextProperty*), qcmp_qident); @@ -1375,7 +1377,7 @@ XawTextSinkAddProperty(Widget w, XawTextProperty *property) } XawTextProperty * -XawTextSinkCombineProperty(Widget w, +XawTextSinkCombineProperty(Widget w _X_UNUSED, XawTextProperty *property, XawTextProperty *combine, Bool override) { @@ -1498,7 +1500,9 @@ XawTextSinkConvertPropertyList(String name, String spec, Screen *screen, XawTextPropertyList **ptr = NULL; XawTextPropertyList *propl, *prev = NULL; XawTextProperty *def_prop = NULL; - String str, tok, tmp; + char * str; + String tok; + char *tmp; char buffer[BUFSIZ]; if (prop_lists) ptr = (XawTextPropertyList**) @@ -1712,8 +1716,9 @@ XawTextSinkConvertPropertyList(String name, String spec, Screen *screen, } prop_lists = (XawTextPropertyList**) - XtRealloc((XtPointer)prop_lists, sizeof(XawTextPropertyList*) * - (num_prop_lists + 1)); + XtRealloc((XtPointer)prop_lists, + (Cardinal)(sizeof(XawTextPropertyList*) * + (num_prop_lists + 1))); prop_lists[num_prop_lists++] = propl; qsort((void*)prop_lists, num_prop_lists, sizeof(XawTextPropertyList*), qcmp_qident); @@ -1727,7 +1732,7 @@ XawTextSinkConvertPropertyList(String name, String spec, Screen *screen, static Boolean CvtStringToPropertyList(Display *dpy, XrmValue *args, Cardinal *num_args, XrmValue *fromVal, XrmValue *toVal, - XtPointer *converter_data) + XtPointer *converter_data _X_UNUSED) { XawTextPropertyList *propl = NULL; String name; @@ -1758,7 +1763,7 @@ CvtStringToPropertyList(Display *dpy, XrmValue *args, Cardinal *num_args, if (ptr) { Screen *screen = w->core.screen; Colormap colormap = w->core.colormap; - int depth = w->core.depth; + int depth = (int)w->core.depth; propl = *ptr; while (propl) { @@ -1799,18 +1804,26 @@ CvtStringToPropertyList(Display *dpy, XrmValue *args, Cardinal *num_args, /*ARGSUSED*/ static Boolean -CvtPropertyListToString(Display *dpy, XrmValue *args, Cardinal *num_args, +CvtPropertyListToString(Display *dpy, XrmValue *args _X_UNUSED, Cardinal *num_args _X_UNUSED, XrmValue *fromVal, XrmValue *toVal, - XtPointer *converter_data) + XtPointer *converter_data _X_UNUSED) { static char *buffer; Cardinal size; XawTextPropertyList *propl; propl = *(XawTextPropertyList**)fromVal[0].addr; + if (propl == NULL) { + XtAppWarningMsg(XtDisplayToApplicationContext(dpy), + "wrongParameters", "cvtPropertyListToString", + "ToolkitError", + "textProperties to String conversion needs property list argument", + NULL, NULL); + return (False); + } buffer = XrmQuarkToString(propl->identifier); - size = strlen(buffer) + 1; + size = (Cardinal)(strlen(buffer) + 1); if (toVal->addr != NULL) { if (toVal->size < size) { diff --git a/lib/libXaw/src/TextSrc.c b/lib/libXaw/src/TextSrc.c index 26ce47416..0a9db664b 100644 --- a/lib/libXaw/src/TextSrc.c +++ b/lib/libXaw/src/TextSrc.c @@ -143,7 +143,7 @@ static XtResource resources[] = { sizeof(XawTextEditType), offset(edit_mode), XtRString, - "read" + (XtPointer)"read" }, #ifndef OLDXAW { @@ -296,8 +296,8 @@ XawTextSrcClassPartInitialize(WidgetClass wc) /*ARGSUSED*/ static void -XawTextSrcInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawTextSrcInitialize(Widget request _X_UNUSED, Widget cnew _X_UNUSED, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { #ifndef OLDXAW TextSrcObject src = (TextSrcObject)cnew; @@ -326,7 +326,7 @@ XawTextSrcInitialize(Widget request, Widget cnew, } static void -XawTextSrcDestroy(Widget w) +XawTextSrcDestroy(Widget w _X_UNUSED) { #ifndef OLDXAW TextSrcObject src = (TextSrcObject)w; @@ -357,8 +357,8 @@ XawTextSrcDestroy(Widget w) /*ARGSUSED*/ static Boolean -XawTextSrcSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawTextSrcSetValues(Widget current _X_UNUSED, Widget request _X_UNUSED, Widget cnew _X_UNUSED, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { #ifndef OLDXAW TextSrcObject oldtw = (TextSrcObject)current; @@ -411,7 +411,7 @@ XawTextSrcSetValues(Widget current, Widget request, Widget cnew, */ /*ARGSUSED*/ static XawTextPosition -Read(Widget w, XawTextPosition pos, XawTextBlock *text, int length) +Read(Widget w _X_UNUSED, XawTextPosition pos _X_UNUSED, XawTextBlock *text _X_UNUSED, int length _X_UNUSED) { return ((XawTextPosition)0); } @@ -431,8 +431,8 @@ Read(Widget w, XawTextPosition pos, XawTextBlock *text, int length) */ /*ARGSUSED*/ static int -Replace(Widget w, XawTextPosition startPos, XawTextPosition endPos, - XawTextBlock *text) +Replace(Widget w _X_UNUSED, XawTextPosition startPos _X_UNUSED, XawTextPosition endPos _X_UNUSED, + XawTextBlock *text _X_UNUSED) { return (XawEditError); } @@ -455,8 +455,8 @@ Replace(Widget w, XawTextPosition startPos, XawTextPosition endPos, */ /*ARGSUSED*/ static XawTextPosition -Scan(Widget w, XawTextPosition position, XawTextScanType type, - XawTextScanDirection dir, int count, Bool include) +Scan(Widget w _X_UNUSED, XawTextPosition position _X_UNUSED, XawTextScanType type _X_UNUSED, + XawTextScanDirection dir _X_UNUSED, int count _X_UNUSED, Bool include _X_UNUSED) { return ((XawTextPosition)0); } @@ -476,30 +476,30 @@ Scan(Widget w, XawTextPosition position, XawTextScanType type, */ /*ARGSUSED*/ static XawTextPosition -Search(Widget w, XawTextPosition position, XawTextScanDirection dir, - XawTextBlock *text) +Search(Widget w _X_UNUSED, XawTextPosition position _X_UNUSED, XawTextScanDirection dir _X_UNUSED, + XawTextBlock *text _X_UNUSED) { return (XawTextSearchError); } /*ARGSUSED*/ static Boolean -ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, - XtPointer *value, unsigned long *length, int *format) +ConvertSelection(Widget w _X_UNUSED, Atom *selection _X_UNUSED, Atom *target _X_UNUSED, Atom *type _X_UNUSED, + XtPointer *value _X_UNUSED, unsigned long *length _X_UNUSED, int *format _X_UNUSED) { return (False); } /*ARGSUSED*/ static void -SetSelection(Widget w, XawTextPosition left, XawTextPosition right, - Atom selection) +SetSelection(Widget w _X_UNUSED, XawTextPosition left _X_UNUSED, XawTextPosition right _X_UNUSED, + Atom selection _X_UNUSED) { } /*ARGSUSED*/ static void -CvtStringToEditMode(XrmValuePtr args, Cardinal *num_args, +CvtStringToEditMode(XrmValuePtr args _X_UNUSED, Cardinal *num_args _X_UNUSED, XrmValuePtr fromVal, XrmValuePtr toVal) { static XawTextEditType editType; @@ -526,9 +526,9 @@ CvtStringToEditMode(XrmValuePtr args, Cardinal *num_args, /*ARGSUSED*/ static Boolean -CvtEditModeToString(Display *dpy, XrmValuePtr args, Cardinal *num_args, +CvtEditModeToString(Display *dpy, XrmValuePtr args _X_UNUSED, Cardinal *num_args _X_UNUSED, XrmValuePtr fromVal, XrmValuePtr toVal, - XtPointer *data) + XtPointer *data _X_UNUSED) { static String buffer; Cardinal size; @@ -550,7 +550,7 @@ CvtEditModeToString(Display *dpy, XrmValuePtr args, Cardinal *num_args, return (False); } - size = strlen(buffer) + 1; + size = (Cardinal)(strlen(buffer) + 1); if (toVal->addr != NULL) { if (toVal->size < size) { toVal->size = size; @@ -573,7 +573,7 @@ _XawTextSourceNewLineAtEOF(Widget w) XawTextBlock text; text.firstPos = 0; - if ((text.format = src->textSrc.text_format) == XawFmt8Bit) + if ((text.format = (unsigned long)src->textSrc.text_format) == XawFmt8Bit) text.ptr = SrcNL; else text.ptr = (char*)SrcWNL; @@ -600,7 +600,7 @@ _XawSourceAddText(Widget source, Widget text) if (!found) { src->textSrc.text = (WidgetList) XtRealloc((char*)src->textSrc.text, - sizeof(Widget) * (src->textSrc.num_text + 1)); + (Cardinal)(sizeof(Widget) * (src->textSrc.num_text + 1))); src->textSrc.text[src->textSrc.num_text++] = text; } } @@ -757,13 +757,13 @@ XawTextSourceReplace(Widget w, XawTextPosition left, break; } l_state->buffer = _XawTextGetText((TextWidget)ctx, left, right); - l_state->length = right - left; + l_state->length = (unsigned)(right - left); } else { l_state->length = 0; l_state->buffer = NULL; } - l_state->format = src->textSrc.text_format; + l_state->format = (unsigned long)src->textSrc.text_format; if (l_state->length == 1) { if (l_state->format == XawFmtWide && *(wchar_t*)l_state->buffer == *SrcWNL) { @@ -786,8 +786,8 @@ XawTextSourceReplace(Widget w, XawTextPosition left, r_state->position = left; r_state->format = block->format; size = block->format == XawFmtWide ? sizeof(wchar_t) : sizeof(char); - total = size * block->length; - r_state->length = block->length; + total = (size * (unsigned)block->length); + r_state->length = (unsigned)block->length; r_state->buffer = NULL; if (total == size) { if (r_state->format == XawFmtWide && @@ -953,8 +953,8 @@ XawTextSourceReplace(Widget w, XawTextPosition left, else { src->textSrc.undo->undo = (XawTextUndoBuffer**) XtRealloc((char*)src->textSrc.undo->undo, - (2 + src->textSrc.undo->num_undo) - * sizeof(XawTextUndoBuffer)); + (Cardinal)((2 + src->textSrc.undo->num_undo) + * sizeof(XawTextUndoBuffer))); src->textSrc.undo->undo[src->textSrc.undo->num_undo++] = l_state; src->textSrc.undo->undo[src->textSrc.undo->num_undo++] = r_state; @@ -1019,9 +1019,9 @@ XawTextSourceReplace(Widget w, XawTextPosition left, /* adjust entity length */ if (entity && offset <= left) { if (offset + entity->length < right) - entity->length = left - offset + block->length; + entity->length = (Cardinal)(left - offset + block->length); else - entity->length += diff; + entity->length = (Cardinal)(entity->length + diff); if (entity->length == 0) { enext = entity->next; @@ -1051,7 +1051,7 @@ XawTextSourceReplace(Widget w, XawTextPosition left, offset = anchor->position + entity->offset + entity->length; if (offset > right) { - entity->length = XawMin(entity->length, offset - right); + entity->length = (XawMin(entity->length, offset - right)); goto exit_anchor_loop; } @@ -1068,7 +1068,7 @@ XawTextSourceReplace(Widget w, XawTextPosition left, else if (i < --src->textSrc.num_anchors) { memmove(&src->textSrc.anchors[i], &src->textSrc.anchors[i + 1], - (src->textSrc.num_anchors - i) * + (size_t)(src->textSrc.num_anchors - i) * sizeof(XawTextAnchor*)); XtFree((XtPointer)anchor); } @@ -1158,7 +1158,7 @@ exit_anchor_loop: anchor->cache = NULL; if ((anchor->entities = entity) != NULL) { if ((entity->offset += diff) < 0) { - entity->length += entity->offset; + entity->length = (Cardinal)(entity->length + entity->offset); entity->offset = 0; } } @@ -1229,7 +1229,7 @@ _XawTextSrcUndo(TextSrcObject src, XawTextPosition *insert_pos) src->textSrc.changed = True; block.firstPos = 0; - block.length = r_state->length; + block.length = (int)r_state->length; block.ptr = r_state->buffer ? r_state->buffer : (char*)&wnull; block.format = r_state->format; @@ -1343,7 +1343,7 @@ FreeUndoBuffer(XawTextUndo *undo) undo->l_no_change = undo->r_no_change = NULL; undo->undo = NULL; undo->dir = XawsdLeft; - undo->num_undo = undo->num_list = undo->erase = undo->merge = 0; + undo->num_undo = undo->num_list = (unsigned)(undo->erase = undo->merge = 0); } static void @@ -1538,7 +1538,7 @@ _XawTextWCToMB(Display *d, wchar_t *wstr, int *len_in_out) *len_in_out = 0; return (NULL); } - *len_in_out = textprop.nitems; + *len_in_out = (int)textprop.nitems; return ((char *)textprop.value); } @@ -1563,9 +1563,9 @@ _XawTextMBToWC(Display *d, char *str, int *len_in_out) if (*len_in_out == 0) return (NULL); - buf = XtMalloc(*len_in_out + 1); + buf = XtMalloc((Cardinal)(*len_in_out + 1)); - strncpy(buf, str, *len_in_out); + strncpy(buf, str, (size_t)*len_in_out); *(buf + *len_in_out) = '\0'; if (XmbTextListToTextProperty(d, &buf, 1, XTextStyle, &textprop) != Success) { XtWarningMsg("convertError", "textSource", "XawError", @@ -1584,7 +1584,7 @@ _XawTextMBToWC(Display *d, char *str, int *len_in_out) return (NULL); } wstr = wlist[0]; - *len_in_out = wcslen(wstr); + *len_in_out = (int)wcslen(wstr); XtFree((XtPointer)wlist); return (wstr); @@ -1594,8 +1594,8 @@ _XawTextMBToWC(Display *d, char *str, int *len_in_out) static int qcmp_anchors(_Xconst void *left, _Xconst void *right) { - return ((*(XawTextAnchor**)left)->position - - (*(XawTextAnchor**)right)->position); + return (int)((*(XawTextAnchor**)left)->position - + (*(XawTextAnchor**)right)->position); } XawTextAnchor * @@ -1658,10 +1658,12 @@ XawTextSourceAddAnchor(Widget w, XawTextPosition position) anchor->cache = NULL; src->textSrc.anchors = (XawTextAnchor**) - XtRealloc((XtPointer)src->textSrc.anchors, sizeof(XawTextAnchor*) * - (src->textSrc.num_anchors + 1)); + XtRealloc((XtPointer)src->textSrc.anchors, + (Cardinal)(sizeof(XawTextAnchor*) * + (size_t)(src->textSrc.num_anchors + 1))); src->textSrc.anchors[src->textSrc.num_anchors++] = anchor; - qsort((void*)src->textSrc.anchors, src->textSrc.num_anchors, + qsort((void*)src->textSrc.anchors, + (size_t)src->textSrc.num_anchors, sizeof(XawTextAnchor*), qcmp_anchors); return (anchor); @@ -1782,7 +1784,7 @@ XawTextSourceRemoveAnchor(Widget w, XawTextAnchor *anchor) if (i < --src->textSrc.num_anchors) { memmove(&src->textSrc.anchors[i], &src->textSrc.anchors[i + 1], - (src->textSrc.num_anchors - i) * + (size_t)(src->textSrc.num_anchors - i) * sizeof(XawTextAnchor*)); return (src->textSrc.anchors[i]); @@ -1865,8 +1867,8 @@ XawTextSourceAddEntity(Widget w, int type, int flags, XtPointer data, } entity = XtNew(XawTextEntity); - entity->type = type; - entity->flags = flags; + entity->type = (short)type; + entity->flags = (short)flags; entity->data = data; entity->offset = position - anchor->position; entity->length = length; @@ -1926,7 +1928,7 @@ XawTextSourceClearEntities(Widget w, XawTextPosition left, XawTextPosition right offset = anchor->position + entity->offset; if (offset <= left) { - length = XawMin(entity->length, left - offset); + length = (XawMin(entity->length, left - offset)); if (length <= 0) { enext = entity->next; @@ -1947,7 +1949,7 @@ XawTextSourceClearEntities(Widget w, XawTextPosition left, XawTextPosition right entity = enext; } else { - entity->length = length; + entity->length = (Cardinal)length; eprev = entity; entity = entity->next; } @@ -1961,7 +1963,7 @@ XawTextSourceClearEntities(Widget w, XawTextPosition left, XawTextPosition right if (offset > right) { anchor->cache = NULL; entity->offset = XawMax(entity->offset, right - anchor->position); - entity->length = XawMin(entity->length, offset - right); + entity->length = (XawMin(entity->length, offset - right)); return; } diff --git a/lib/libXaw/src/Tip.c b/lib/libXaw/src/Tip.c index 8328aace3..06d53c818 100644 --- a/lib/libXaw/src/Tip.c +++ b/lib/libXaw/src/Tip.c @@ -92,7 +92,7 @@ static XtResource resources[] = { sizeof(Pixel), offset(foreground), XtRString, - XtDefaultForeground, + (XtPointer)XtDefaultForeground, }, { XtNfont, @@ -101,7 +101,7 @@ static XtResource resources[] = { sizeof(XFontStruct*), offset(font), XtRString, - XtDefaultFont + (XtPointer)XtDefaultFont }, { XtNfontSet, @@ -110,7 +110,7 @@ static XtResource resources[] = { sizeof(XFontSet), offset(fontset), XtRString, - XtDefaultFontSet + (XtPointer)XtDefaultFontSet }, { XtNtopMargin, @@ -239,7 +239,7 @@ XawTipClassInitialize(void) /*ARGSUSED*/ static void -XawTipInitialize(Widget req, Widget w, ArgList args, Cardinal *num_args) +XawTipInitialize(Widget req _X_UNUSED, Widget w _X_UNUSED, ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { TipWidget tip = (TipWidget)w; XGCValues values; @@ -297,7 +297,7 @@ XawTipRealize(Widget w, Mask *mask, XSetWindowAttributes *attr) attr->backing_store = tip->tip.backing_store; } else - *mask &= ~CWBackingStore; + *mask &= (Mask)(~CWBackingStore); *mask |= CWOverrideRedirect; attr->override_redirect = True; @@ -318,27 +318,28 @@ XawTipExpose(Widget w, XEvent *event, Region region) { TipWidget tip = (TipWidget)w; GC gc = tip->tip.gc; - char *nl, *label = tip->tip.label; - Position y = tip->tip.top_margin + tip->tip.font->max_bounds.ascent; + char *nl; + _Xconst char * label = tip->tip.label; + Position y = (Position)(tip->tip.top_margin + tip->tip.font->max_bounds.ascent); int len; if (tip->tip.display_list) XawRunDisplayList(w, tip->tip.display_list, event, region); if (tip->tip.international == True) { - Position ksy = tip->tip.top_margin; + Position ksy = (Position)tip->tip.top_margin; XFontSetExtents *ext = XExtentsOfFontSet(tip->tip.fontset); - ksy += XawAbs(ext->max_ink_extent.y); + ksy = (ksy + XawAbs(ext->max_ink_extent.y)); while ((nl = index(label, '\n')) != NULL) { XmbDrawString(XtDisplay(w), XtWindow(w), tip->tip.fontset, gc, tip->tip.left_margin, ksy, label, (int)(nl - label)); - ksy += ext->max_ink_extent.height; + ksy = (ksy + ext->max_ink_extent.height); label = nl + 1; } - len = strlen(label); + len = (int)strlen(label); if (len) XmbDrawString(XtDisplay(w), XtWindow(w), tip->tip.fontset, gc, tip->tip.left_margin, ksy, label, len); @@ -348,19 +349,19 @@ XawTipExpose(Widget w, XEvent *event, Region region) if (tip->tip.encoding) XDrawString16(XtDisplay(w), XtWindow(w), gc, tip->tip.left_margin, y, - (XChar2b*)label, (int)(nl - label) >> 1); + (_Xconst XChar2b*)label, (int)(nl - label) >> 1); else XDrawString(XtDisplay(w), XtWindow(w), gc, tip->tip.left_margin, y, label, (int)(nl - label)); - y += tip->tip.font->max_bounds.ascent + - tip->tip.font->max_bounds.descent; + y = (Position)(y + (tip->tip.font->max_bounds.ascent + + tip->tip.font->max_bounds.descent)); label = nl + 1; } - len = strlen(label); + len = (int)strlen(label); if (len) { if (tip->tip.encoding) XDrawString16(XtDisplay(w), XtWindow(w), gc, - tip->tip.left_margin, y, (XChar2b*)label, len >> 1); + tip->tip.left_margin, y, (_Xconst XChar2b*)label, len >> 1); else XDrawString(XtDisplay(w), XtWindow(w), gc, tip->tip.left_margin, y, label, len); @@ -370,8 +371,8 @@ XawTipExpose(Widget w, XEvent *event, Region region) /*ARGSUSED*/ static Boolean -XawTipSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawTipSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { TipWidget curtip = (TipWidget)current; TipWidget newtip = (TipWidget)cnew; @@ -402,7 +403,8 @@ TipLayout(XawTipInfo *info) { XFontStruct *fs = info->tip->tip.font; int width = 0, height; - char *nl, *label = info->tip->tip.label; + char *nl; + _Xconst char *label = info->tip->tip.label; if (info->tip->tip.international == True) { XFontSet fset = info->tip->tip.fontset; @@ -426,7 +428,7 @@ TipLayout(XawTipInfo *info) } } else - width = XmbTextEscapement(fset, label, strlen(label)); + width = XmbTextEscapement(fset, label, (int)strlen(label)); } else { height = fs->max_bounds.ascent + fs->max_bounds.descent; @@ -434,7 +436,7 @@ TipLayout(XawTipInfo *info) /*CONSTCOND*/ while (True) { int w = info->tip->tip.encoding ? - XTextWidth16(fs, (XChar2b*)label, (int)(nl - label) >> 1) : + XTextWidth16(fs, (_Xconst XChar2b*)label, (int)(nl - label) >> 1) : XTextWidth(fs, label, (int)(nl - label)); if (w > width) width = w; @@ -449,13 +451,13 @@ TipLayout(XawTipInfo *info) } else width = info->tip->tip.encoding ? - XTextWidth16(fs, (XChar2b*)label, strlen(label) >> 1) : - XTextWidth(fs, label, strlen(label)); + XTextWidth16(fs, (_Xconst XChar2b*)label, (int)(strlen(label) >> 1)) : + XTextWidth(fs, label, (int)strlen(label)); } - XtWidth(info->tip) = width + info->tip->tip.left_margin + - info->tip->tip.right_margin; - XtHeight(info->tip) = height + info->tip->tip.top_margin + - info->tip->tip.bottom_margin; + XtWidth(info->tip) = (width + info->tip->tip.left_margin + + info->tip->tip.right_margin); + XtHeight(info->tip) = (height + info->tip->tip.top_margin + + info->tip->tip.bottom_margin); } #define DEFAULT_TIP_Y_OFFSET 12 @@ -469,14 +471,14 @@ TipPosition(XawTipInfo *info) XQueryPointer(XtDisplay((Widget)info->tip), XtWindow((Widget)info->tip), &r, &c, &rx, &ry, &wx, &wy, &mask); - x = rx - (XtWidth(info->tip) >> 1); - y = ry + DEFAULT_TIP_Y_OFFSET; + x = (Position)(rx - (XtWidth(info->tip) >> 1)); + y = (Position)(ry + DEFAULT_TIP_Y_OFFSET); if (x >= 0) { int scr_width = WidthOfScreen(XtScreen(info->tip)); if (x + XtWidth(info->tip) + XtBorderWidth(info->tip) > scr_width) - x = scr_width - XtWidth(info->tip) - XtBorderWidth(info->tip); + x = (Position)(scr_width - XtWidth(info->tip) - XtBorderWidth(info->tip)); } if (x < 0) x = 0; @@ -484,8 +486,8 @@ TipPosition(XawTipInfo *info) int scr_height = HeightOfScreen(XtScreen(info->tip)); if (y + XtHeight(info->tip) + XtBorderWidth(info->tip) > scr_height) - y -= XtHeight(info->tip) + XtBorderWidth(info->tip) + - (DEFAULT_TIP_Y_OFFSET << 1); + y = (Position)(y - (XtHeight(info->tip) + XtBorderWidth(info->tip) + + (DEFAULT_TIP_Y_OFFSET << 1))); } if (y < 0) y = 0; @@ -548,13 +550,14 @@ ResetTip(XawTipInfo *info, Bool add_timeout) if (add_timeout) { info->tip->tip.timer = XtAppAddTimeOut(XtWidgetToApplicationContext((Widget)info->tip), - info->tip->tip.timeout, TipTimeoutCallback, + (unsigned long)info->tip->tip.timeout, + TipTimeoutCallback, (XtPointer)info); } } static void -TipTimeoutCallback(XtPointer closure, XtIntervalId *id) +TipTimeoutCallback(XtPointer closure, XtIntervalId *id _X_UNUSED) { XawTipInfo *info = (XawTipInfo*)closure; Arg args[3]; @@ -579,16 +582,16 @@ TipTimeoutCallback(XtPointer closure, XtIntervalId *id) /*ARGSUSED*/ static void -TipShellEventHandler(Widget w, XtPointer client_data, XEvent *event, - Boolean *continue_to_dispatch) +TipShellEventHandler(Widget w, XtPointer client_data _X_UNUSED, XEvent *event _X_UNUSED, + Boolean *continue_to_dispatch _X_UNUSED) { ResetTip(FindTipInfo(w), False); } /*ARGSUSED*/ static void -TipEventHandler(Widget w, XtPointer client_data, XEvent *event, - Boolean *continue_to_dispatch) +TipEventHandler(Widget w, XtPointer client_data _X_UNUSED, XEvent *event, + Boolean *continue_to_dispatch _X_UNUSED) { XawTipInfo *info = FindTipInfo(w); Boolean add_timeout; diff --git a/lib/libXaw/src/Toggle.c b/lib/libXaw/src/Toggle.c index b484878cc..9b93d4128 100644 --- a/lib/libXaw/src/Toggle.c +++ b/lib/libXaw/src/Toggle.c @@ -90,7 +90,7 @@ static XtResource resources[] = { sizeof(Boolean), offset(command.set), XtRString, - "off" + (XtPointer)"off" }, { XtNradioGroup, @@ -225,7 +225,7 @@ XawToggleClassInitialize(void) /*ARGSUSED*/ static void XawToggleInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { ToggleWidget tw = (ToggleWidget)cnew; ToggleWidget tw_req = (ToggleWidget)request; @@ -259,7 +259,7 @@ XawToggleInitialize(Widget request, Widget cnew, /*ARGSUSED*/ static void -ToggleSet(Widget w, XEvent *event, String *params, Cardinal *num_params) +ToggleSet(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { ToggleWidgetClass cclass = (ToggleWidgetClass)w->core.widget_class; @@ -281,7 +281,7 @@ Toggle(Widget w, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static void -Notify(Widget w, XEvent *event, String *params, Cardinal *num_params) +Notify(Widget w, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal *num_params _X_UNUSED) { ToggleWidget tw = (ToggleWidget)w; long antilint = tw->command.set; @@ -292,7 +292,7 @@ Notify(Widget w, XEvent *event, String *params, Cardinal *num_params) /*ARGSUSED*/ static Boolean XawToggleSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { ToggleWidget oldtw = (ToggleWidget)current; ToggleWidget tw = (ToggleWidget)cnew; @@ -326,7 +326,7 @@ XawToggleSetValues(Widget current, Widget request, Widget cnew, */ /*ARGSUSED*/ static void -XawToggleDestroy(Widget w, XtPointer temp1, XtPointer temp2) +XawToggleDestroy(Widget w, XtPointer temp1 _X_UNUSED, XtPointer temp2 _X_UNUSED) { RemoveFromRadioGroup(w); } diff --git a/lib/libXaw/src/Tree.c b/lib/libXaw/src/Tree.c index f4781bfd1..b3485f55a 100644 --- a/lib/libXaw/src/Tree.c +++ b/lib/libXaw/src/Tree.c @@ -109,7 +109,7 @@ static XtResource resources[] = { XtOffsetOf(TreeRec, tree.vpad), XtRImmediate, (XtPointer) 0 }, { XtNforeground, XtCForeground, XtRPixel, sizeof (Pixel), XtOffsetOf(TreeRec, tree.foreground), XtRString, - XtDefaultForeground}, + (XtPointer) XtDefaultForeground}, { XtNlineWidth, XtCLineWidth, XtRDimension, sizeof (Dimension), XtOffsetOf(TreeRec, tree.line_width), XtRImmediate, (XtPointer) 0 }, { XtNgravity, XtCGravity, XtRGravity, sizeof (XtGravity), @@ -217,7 +217,7 @@ initialize_dimensions(Dimension **listp, int *sizep, int n) } if (n > *sizep) { *listp = (Dimension *) XtRealloc((char *) *listp, - (unsigned int) (n*sizeof(Dimension))); + (Cardinal) ((size_t)n*sizeof(Dimension))); if (!*listp) { *sizep = 0; return; @@ -265,8 +265,8 @@ insert_node(Widget parent, Widget node) if (pc->tree.n_children == pc->tree.max_children) { pc->tree.max_children += (pc->tree.max_children / 2) + 2; pc->tree.children = (WidgetList) XtRealloc ((char *)pc->tree.children, - (unsigned int) - ((pc->tree.max_children) * + (Cardinal) + ((size_t)pc->tree.max_children * sizeof(Widget))); } @@ -346,7 +346,7 @@ XawTreeClassInitialize(void) /*ARGSUSED*/ static void XawTreeInitialize(Widget grequest, Widget gnew, - ArgList args, Cardinal *num_args) + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { TreeWidget request = (TreeWidget) grequest, cnew = (TreeWidget) gnew; Arg arglist[2]; @@ -402,8 +402,8 @@ XawTreeInitialize(Widget grequest, Widget gnew, /* ARGSUSED */ static void -XawTreeConstraintInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawTreeConstraintInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { TreeConstraints tc = TREE_CONSTRAINT(cnew); TreeWidget tw = (TreeWidget) cnew->core.parent; @@ -433,8 +433,8 @@ XawTreeConstraintInitialize(Widget request, Widget cnew, /* ARGSUSED */ static Boolean -XawTreeSetValues(Widget gcurrent, Widget grequest, Widget gnew, - ArgList args, Cardinal *num_args) +XawTreeSetValues(Widget gcurrent, Widget grequest _X_UNUSED, Widget gnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { TreeWidget current = (TreeWidget) gcurrent, cnew = (TreeWidget) gnew; Boolean redraw = FALSE; @@ -480,8 +480,8 @@ XawTreeSetValues(Widget gcurrent, Widget grequest, Widget gnew, /* ARGSUSED */ static Boolean -XawTreeConstraintSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawTreeConstraintSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { TreeConstraints newc = TREE_CONSTRAINT(cnew); TreeConstraints curc = TREE_CONSTRAINT(current); @@ -538,7 +538,7 @@ XawTreeConstraintDestroy(Widget w) /* ARGSUSED */ static XtGeometryResult XawTreeGeometryManager(Widget w, XtWidgetGeometry *request, - XtWidgetGeometry *reply) + XtWidgetGeometry *reply _X_UNUSED) { TreeWidget tw = (TreeWidget) w->core.parent; @@ -584,7 +584,7 @@ XawTreeDestroy(Widget gw) /* ARGSUSED */ static void -XawTreeRedisplay(Widget gw, XEvent *event, Region region) +XawTreeRedisplay(Widget gw, XEvent *event _X_UNUSED, Region region _X_UNUSED) { TreeWidget tw = (TreeWidget) gw; @@ -725,7 +725,7 @@ compute_bounding_box_subtree(TreeWidget tree, Widget w, int depth) int i; Bool horiz = IsHorizontal (tree); Dimension newwidth, newheight; - Dimension bw2 = w->core.border_width * 2; + Dimension bw2 = (Dimension)(w->core.border_width * 2); /* * Set the max-size per level. @@ -734,7 +734,7 @@ compute_bounding_box_subtree(TreeWidget tree, Widget w, int depth) initialize_dimensions (&tree->tree.largest, &tree->tree.n_largest, depth + 1); } - newwidth = ((horiz ? w->core.width : w->core.height) + bw2); + newwidth = (Dimension)((horiz ? w->core.width : w->core.height) + bw2); if (tree->tree.largest[depth] < newwidth) tree->tree.largest[depth] = newwidth; @@ -742,8 +742,8 @@ compute_bounding_box_subtree(TreeWidget tree, Widget w, int depth) /* * initialize */ - tc->tree.bbwidth = w->core.width + bw2; - tc->tree.bbheight = w->core.height + bw2; + tc->tree.bbwidth = (Dimension)(w->core.width + bw2); + tc->tree.bbheight = (Dimension)(w->core.height + bw2); if (tc->tree.n_children == 0) return; @@ -762,10 +762,10 @@ compute_bounding_box_subtree(TreeWidget tree, Widget w, int depth) if (horiz) { if (newwidth < cc->tree.bbwidth) newwidth = cc->tree.bbwidth; - newheight += tree->tree.vpad + cc->tree.bbheight; + newheight = (Dimension)(newheight + (tree->tree.vpad + cc->tree.bbheight)); } else { if (newheight < cc->tree.bbheight) newheight = cc->tree.bbheight; - newwidth += tree->tree.hpad + cc->tree.bbwidth; + newwidth = (Dimension)(newwidth + (tree->tree.hpad + cc->tree.bbwidth)); } } @@ -778,12 +778,12 @@ compute_bounding_box_subtree(TreeWidget tree, Widget w, int depth) * extra padding. Be careful of unsigned arithmetic. */ if (horiz) { - tc->tree.bbwidth += tree->tree.hpad + newwidth; - newheight -= tree->tree.vpad; + tc->tree.bbwidth = (Dimension)(tc->tree.bbwidth + (tree->tree.hpad + newwidth)); + newheight = (Dimension)(newheight - tree->tree.vpad); if (newheight > tc->tree.bbheight) tc->tree.bbheight = newheight; } else { - tc->tree.bbheight += tree->tree.vpad + newheight; - newwidth -= tree->tree.hpad; + tc->tree.bbheight = (Dimension)(tc->tree.bbheight + (tree->tree.vpad + newheight)); + newwidth = (Dimension)(newwidth - tree->tree.hpad); if (newwidth > tc->tree.bbwidth) tc->tree.bbwidth = newwidth; } } @@ -803,13 +803,13 @@ set_positions(TreeWidget tw, Widget w, int level) */ switch (tw->tree.gravity) { case EastGravity: - tc->tree.x = (((Position) tw->tree.maxwidth) - - ((Position) w->core.width) - tc->tree.x); + tc->tree.x = (Position) (tw->tree.maxwidth - + w->core.width - tc->tree.x); break; case SouthGravity: - tc->tree.y = (((Position) tw->tree.maxheight) - - ((Position) w->core.height) - tc->tree.y); + tc->tree.y = (Position) (tw->tree.maxheight - + w->core.height - tc->tree.y); break; } @@ -838,15 +838,15 @@ arrange_subtree(TreeWidget tree, Widget w, int depth, int x, int y) Bool horiz = IsHorizontal (tree); Widget child = NULL; Dimension tmp; - Dimension bw2 = w->core.border_width * 2; + Dimension bw2 = (Dimension)(w->core.border_width * 2); Bool relayout = True; /* * If no children, then just lay out where requested. */ - tc->tree.x = x; - tc->tree.y = y; + tc->tree.x = (Position)x; + tc->tree.y = (Position)y; if (horiz) { int myh = (w->core.height + bw2); @@ -864,9 +864,9 @@ arrange_subtree(TreeWidget tree, Widget w, int depth, int x, int y) } } - if ((tmp = ((Dimension) x) + tc->tree.bbwidth) > tree->tree.maxwidth) + if ((tmp = (Dimension)(x + tc->tree.bbwidth)) > tree->tree.maxwidth) tree->tree.maxwidth = tmp; - if ((tmp = ((Dimension) y) + tc->tree.bbheight) > tree->tree.maxheight) + if ((tmp = (Dimension)(y + tc->tree.bbheight)) > tree->tree.maxheight) tree->tree.maxheight = tmp; if (tc->tree.n_children == 0) return; @@ -913,21 +913,21 @@ arrange_subtree(TreeWidget tree, Widget w, int depth, int x, int y) * this could collide with the position of the previous sibling. */ if (horiz) { - tc->tree.x = x; - adjusted = firstcc->tree.y + + tc->tree.x = (Position)x; + adjusted = (Position)(firstcc->tree.y + ((lastcc->tree.y + (Position) child->core.height + (Position) child->core.border_width * 2 - firstcc->tree.y - (Position) w->core.height - - (Position) w->core.border_width * 2 + 1) / 2); + (Position) w->core.border_width * 2 + 1) / 2)); if (adjusted > tc->tree.y) tc->tree.y = adjusted; } else { - adjusted = firstcc->tree.x + + adjusted = (Position)(firstcc->tree.x + ((lastcc->tree.x + (Position) child->core.width + (Position) child->core.border_width * 2 - firstcc->tree.x - (Position) w->core.width - - (Position) w->core.border_width * 2 + 1) / 2); + (Position) w->core.border_width * 2 + 1) / 2)); if (adjusted > tc->tree.x) tc->tree.x = adjusted; - tc->tree.y = y; + tc->tree.y = (Position)y; } } } @@ -937,12 +937,13 @@ set_tree_size(TreeWidget tw, Bool insetvalues, unsigned int width, unsigned int height) { if (insetvalues) { - tw->core.width = width; - tw->core.height = height; + tw->core.width = (Dimension)width; + tw->core.height = (Dimension)height; } else { Dimension replyWidth = 0, replyHeight = 0; XtGeometryResult result = XtMakeResizeRequest ((Widget) tw, - width, height, + (Dimension)width, + (Dimension)height, &replyWidth, &replyHeight); /* diff --git a/lib/libXaw/src/Vendor.c b/lib/libXaw/src/Vendor.c index b8797f59d..7940d2e5c 100644 --- a/lib/libXaw/src/Vendor.c +++ b/lib/libXaw/src/Vendor.c @@ -111,12 +111,20 @@ static XtResource resources[] = { * ***************************************************************************/ -#if defined(__CYGWIN__) || defined(__MINGW32__) +#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__) /* to fix the EditRes problem because of wrong linker semantics */ extern WidgetClass vendorShellWidgetClass; /* from Xt/Vendor.c */ extern VendorShellClassRec _XawVendorShellClassRec; extern void _XawFixupVendorShell(); +#if defined(__APPLE__) +__attribute__((constructor)) +static void __VendorShellHack(void) +{ + vendorShellWidgetClass = (WidgetClass)(&_XawVendorShellClassRec); + _XawFixupVendorShell(); +} +#else int __stdcall DllMain(unsigned long mod_handle, unsigned long flag, void *routine) { @@ -131,6 +139,7 @@ DllMain(unsigned long mod_handle, unsigned long flag, void *routine) } return 1; } +#endif #define vendorShellClassRec _XawVendorShellClassRec @@ -195,7 +204,7 @@ externaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = { } }; -#ifndef __UNIXOS2__ +#if !defined(__UNIXOS2__) && !defined(__APPLE__) externaldef(vendorshellwidgetclass) WidgetClass vendorShellWidgetClass = (WidgetClass) (&vendorShellClassRec); #endif @@ -267,9 +276,9 @@ externaldef(xawvendorshellwidgetclass) WidgetClass /*ARGSUSED*/ static Boolean -XawCvtCompoundTextToString(Display *dpy, XrmValuePtr args, Cardinal *num_args, +XawCvtCompoundTextToString(Display *dpy, XrmValuePtr args _X_UNUSED, Cardinal *num_args _X_UNUSED, XrmValue *fromVal, XrmValue *toVal, - XtPointer *cvt_data) + XtPointer *cvt_data _X_UNUSED) { XTextProperty prop; char **list; @@ -288,9 +297,9 @@ XawCvtCompoundTextToString(Display *dpy, XrmValuePtr args, Cardinal *num_args, "conversion from CT to MB failed.", NULL, NULL); return False; } - len = strlen(*list); - toVal->size = len; - mbs = XtRealloc(mbs, len + 1); /* keep buffer because no one call free :( */ + len = (int)strlen(*list); + toVal->size = (unsigned)len; + mbs = XtRealloc(mbs, (Cardinal)(len + 1)); /* keep buffer because no one call free :( */ strcpy(mbs, *list); XFreeStringList(list); toVal->addr = (XtPointer)mbs; @@ -339,7 +348,7 @@ XawVendorShellClassPartInit(WidgetClass cclass) } } -#if defined(__osf__) || defined(__UNIXOS2__) || defined(__CYGWIN__) || defined(__MINGW32__) +#if defined(__osf__) || defined(__UNIXOS2__) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__) /* stupid OSF/1 shared libraries have the wrong semantics */ /* symbols do not get resolved external to the shared library */ void _XawFixupVendorShell() @@ -353,7 +362,7 @@ void _XawFixupVendorShell() /* ARGSUSED */ static void -XawVendorShellInitialize(Widget req, Widget cnew, +XawVendorShellInitialize(Widget req _X_UNUSED, Widget cnew, ArgList args, Cardinal *num_args) { XtAddEventHandler(cnew, (EventMask) 0, TRUE, _XEditResCheckMessages, NULL); @@ -364,8 +373,8 @@ XawVendorShellInitialize(Widget req, Widget cnew, /* ARGSUSED */ static Boolean -XawVendorShellSetValues(Widget old, Widget ref, Widget cnew, - ArgList args, Cardinal *num_args) +XawVendorShellSetValues(Widget old _X_UNUSED, Widget ref _X_UNUSED, Widget cnew _X_UNUSED, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { return FALSE; } @@ -389,8 +398,8 @@ XawVendorShellExtClassInitialize(void) /* ARGSUSED */ static void -XawVendorShellExtInitialize(Widget req, Widget cnew, - ArgList args, Cardinal *num_args) +XawVendorShellExtInitialize(Widget req _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { _XawImInitialize(cnew->core.parent, cnew); } @@ -404,8 +413,8 @@ XawVendorShellExtDestroy(Widget w) /* ARGSUSED */ static Boolean -XawVendorShellExtSetValues(Widget old, Widget ref, Widget cnew, - ArgList args, Cardinal *num_args) +XawVendorShellExtSetValues(Widget old _X_UNUSED, Widget ref _X_UNUSED, Widget cnew _X_UNUSED, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { return FALSE; } @@ -423,7 +432,9 @@ XawVendorShellExtResize(Widget w) for( i = 0; i < sw->composite.num_children; i++ ) { if( XtIsManaged( sw->composite.children[ i ] ) ) { childwid = sw->composite.children[ i ]; - XtResizeWidget( childwid, sw->core.width, core_height, + XtResizeWidget( childwid, + (Dimension)sw->core.width, + (Dimension)core_height, childwid->core.border_width ); } } @@ -431,8 +442,8 @@ XawVendorShellExtResize(Widget w) /*ARGSUSED*/ void -XawVendorStructureNotifyHandler(Widget w, XtPointer closure, XEvent *event, - Boolean *continue_to_dispatch) +XawVendorStructureNotifyHandler(Widget w, XtPointer closure _X_UNUSED, XEvent *event _X_UNUSED, + Boolean *continue_to_dispatch _X_UNUSED) { XawVendorShellExtResize(w); } @@ -440,7 +451,7 @@ XawVendorStructureNotifyHandler(Widget w, XtPointer closure, XEvent *event, /*ARGSUSED*/ static XtGeometryResult XawVendorShellGeometryManager(Widget wid, XtWidgetGeometry *request, - XtWidgetGeometry *reply) + XtWidgetGeometry *reply _X_UNUSED) { ShellWidget shell = (ShellWidget)(wid->core.parent); XtWidgetGeometry my_request; @@ -458,8 +469,8 @@ XawVendorShellGeometryManager(Widget wid, XtWidgetGeometry *request, my_request.request_mode |= CWWidth; } if (request->request_mode & CWHeight) { - my_request.height = request->height - + _XawImGetImAreaHeight( wid ); + my_request.height = (Dimension)(request->height + + _XawImGetImAreaHeight( wid )); my_request.request_mode |= CWHeight; } if (request->request_mode & CWBorderWidth) { @@ -480,7 +491,7 @@ XawVendorShellGeometryManager(Widget wid, XtWidgetGeometry *request, wid->core.width = shell->core.width; wid->core.height = shell->core.height; if (request->request_mode & CWBorderWidth) { - wid->core.x = wid->core.y = -request->border_width; + wid->core.x = wid->core.y = (Position)(-request->border_width); } _XawImCallVendorShellExtResize(wid); return XtGeometryYes; @@ -495,7 +506,7 @@ XawVendorShellChangeManaged(Widget wid) int i; (*SuperClass->composite_class.change_managed)(wid); - for (i = w->composite.num_children, childP = w->composite.children; + for (i = (int)w->composite.num_children, childP = w->composite.children; i; i--, childP++) { if (XtIsManaged(*childP)) { XtSetKeyboardFocus(wid, *childP); diff --git a/lib/libXaw/src/Viewport.c b/lib/libXaw/src/Viewport.c index 082682f82..893c8bf66 100644 --- a/lib/libXaw/src/Viewport.c +++ b/lib/libXaw/src/Viewport.c @@ -280,8 +280,8 @@ CreateScrollbar(ViewportWidget w, Bool horizontal) /*ARGSUSED*/ static void -XawViewportInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawViewportInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { ViewportWidget w = (ViewportWidget)cnew; static Arg clip_args[8]; @@ -331,10 +331,10 @@ XawViewportInitialize(Widget request, Widget cnew, clip_height = XtHeight(w); if (h_bar != NULL && XtWidth(w) > XtWidth(h_bar) + XtBorderWidth(h_bar)) - clip_width -= XtWidth(h_bar) + XtBorderWidth(h_bar); + clip_width = (Dimension)(clip_width - (XtWidth(h_bar) + XtBorderWidth(h_bar))); if (v_bar != NULL && XtHeight(w) > XtHeight(v_bar) + XtBorderWidth(v_bar)) - clip_height -= XtHeight(v_bar) + XtBorderWidth(v_bar); + clip_height = (Dimension)(clip_height - (XtHeight(v_bar) + XtBorderWidth(v_bar))); arg_cnt = 0; XtSetArg(clip_args[arg_cnt], XtNwidth, clip_width); arg_cnt++; @@ -344,8 +344,8 @@ XawViewportInitialize(Widget request, Widget cnew, /*ARGSUSED*/ static void -XawViewportConstraintInitialize(Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawViewportConstraintInitialize(Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { ((ViewportConstraints)cnew->core.constraints)->viewport.reparented = False; } @@ -375,8 +375,8 @@ XawViewportRealize(Widget widget, XtValueMask *value_mask, /*ARGSUSED*/ static Boolean -XawViewportSetValues(Widget current, Widget request, Widget cnew, - ArgList args, Cardinal *num_args) +XawViewportSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, + ArgList args _X_UNUSED, Cardinal *num_args _X_UNUSED) { ViewportWidget w = (ViewportWidget)cnew; ViewportWidget cw = (ViewportWidget)current; @@ -395,7 +395,7 @@ static void XawViewportChangeManaged(Widget widget) { ViewportWidget w = (ViewportWidget)widget; - int num_children = w->composite.num_children; + int num_children = (int)w->composite.num_children; Widget child, *childP; int i; @@ -479,8 +479,8 @@ SendReport(ViewportWidget w, unsigned int changed) Widget clip = w->viewport.clip; rep.changed = changed; - rep.slider_x = -XtX(child); /* child is canvas */ - rep.slider_y = -XtY(child); /* clip is slider */ + rep.slider_x = (Position) -XtX(child); /* child is canvas */ + rep.slider_y = (Position) -XtY(child); /* clip is slider */ rep.slider_width = XtWidth(clip); rep.slider_height = XtHeight(clip); rep.canvas_width = XtWidth(child); @@ -509,7 +509,7 @@ MoveChild(ViewportWidget w, int x, int y) if (y >= 0) y = 0; - XtMoveWidget(child, x, y); + XtMoveWidget(child, (Position) x, (Position) y); SendReport(w, (XawPRSliderX | XawPRSliderY)); RedrawThumbs(w); @@ -557,12 +557,12 @@ ComputeLayout(Widget widget, Bool query, Bool destroy_scrollbars) intended.request_mode |= CWWidth; if (XtWidth(child) < clip_width) - intended.width = clip_width; + intended.width = (Dimension)clip_width; else intended.width = XtWidth(child); if (XtHeight(child) < clip_height) - intended.height = clip_height; + intended.height = (Dimension)clip_height; else intended.height = XtHeight(child); @@ -593,12 +593,12 @@ ComputeLayout(Widget widget, Bool query, Bool destroy_scrollbars) if (w->viewport.allowhoriz && \ preferred.width > clip_width) { \ if (!needshoriz) { \ - Widget bar; \ + Widget bar2; \ \ needshoriz = True; \ - if ((bar = w->viewport.horiz_bar) == NULL) \ - bar = CreateScrollbar(w, True); \ - clip_height -= XtHeight(bar) + XtBorderWidth(bar); \ + if ((bar2 = w->viewport.horiz_bar) == NULL) \ + bar2 = CreateScrollbar(w, True); \ + clip_height -= XtHeight(bar2) + XtBorderWidth(bar2);\ if (clip_height < 1) \ clip_height = 1; \ } \ @@ -620,11 +620,11 @@ ComputeLayout(Widget widget, Bool query, Bool destroy_scrollbars) intended.height = preferred.height; } if (!w->viewport.allowhoriz || preferred.width < clip_width) { - intended.width = clip_width; + intended.width = (Dimension)clip_width; intended.request_mode |= CWWidth; } if (!w->viewport.allowvert || preferred.height < clip_height) { - intended.height = clip_height; + intended.height = (Dimension)clip_height; intended.request_mode |= CWHeight; } } while (intended.request_mode != prev_mode @@ -638,13 +638,13 @@ ComputeLayout(Widget widget, Bool query, Bool destroy_scrollbars) XRaiseWindow(XtDisplay(clip), XtWindow(clip)); XtMoveWidget(clip, - needsvert ? w->viewport.useright ? 0 : - XtWidth(w->viewport.vert_bar) - + XtBorderWidth(w->viewport.vert_bar) : 0, - needshoriz ? w->viewport.usebottom ? 0 : - XtHeight(w->viewport.horiz_bar) - + XtBorderWidth(w->viewport.horiz_bar) : 0); - XtResizeWidget(clip, clip_width, clip_height, 0); + (Position)(needsvert ? w->viewport.useright ? 0 : + XtWidth(w->viewport.vert_bar) + + XtBorderWidth(w->viewport.vert_bar) : 0), + (Position)(needshoriz ? w->viewport.usebottom ? 0 : + XtHeight(w->viewport.horiz_bar) + + XtBorderWidth(w->viewport.horiz_bar) : 0)); + XtResizeWidget(clip, (Dimension)clip_width, (Dimension)clip_height, 0); if (w->viewport.horiz_bar != NULL) { Widget bar = w->viewport.horiz_bar; @@ -659,12 +659,12 @@ ComputeLayout(Widget widget, Bool query, Bool destroy_scrollbars) else { int bw = XtBorderWidth(bar); - XtResizeWidget(bar, clip_width, XtHeight(bar), bw); + XtResizeWidget(bar, (Dimension)clip_width, (Dimension)XtHeight(bar), (Dimension)bw); XtMoveWidget(bar, - needsvert && !w->viewport.useright - ? XtWidth(w->viewport.vert_bar) : -bw, - w->viewport.usebottom - ? XtHeight(w) - XtHeight(bar) - bw : -bw); + (Position)(needsvert && !w->viewport.useright + ? XtWidth(w->viewport.vert_bar) : -bw), + (Position)(w->viewport.usebottom + ? XtHeight(w) - XtHeight(bar) - bw : -bw)); XtSetMappedWhenManaged(bar, True); } } @@ -682,12 +682,12 @@ ComputeLayout(Widget widget, Bool query, Bool destroy_scrollbars) else { int bw = bar->core.border_width; - XtResizeWidget(bar, XtWidth(bar), clip_height, bw); + XtResizeWidget(bar, (Dimension)XtWidth(bar), (Dimension)clip_height, (Dimension)bw); XtMoveWidget(bar, - w->viewport.useright - ? XtWidth(w) - XtWidth(bar) - bw : -bw, - needshoriz && !w->viewport.usebottom - ? XtHeight(w->viewport.horiz_bar) : -bw); + (Position)(w->viewport.useright + ? XtWidth(w) - XtWidth(bar) - bw : -bw), + (Position)(needshoriz && !w->viewport.usebottom + ? XtHeight(w->viewport.horiz_bar) : -bw)); XtSetMappedWhenManaged(bar, True); } } @@ -747,11 +747,11 @@ ComputeWithForceBars(Widget widget, Bool query, XtWidgetGeometry *intended, AssignMax(*clip_height, 1); if (!w->viewport.allowvert) { - intended->height = *clip_height; + intended->height = (Dimension)*clip_height; intended->request_mode = CWHeight; } if (!w->viewport.allowhoriz) { - intended->width = *clip_width; + intended->width = (Dimension)*clip_width; intended->request_mode = CWWidth; } @@ -782,9 +782,9 @@ ComputeWithForceBars(Widget widget, Bool query, XtWidgetGeometry *intended, } if (*clip_width > (int)intended->width) - intended->width = *clip_width; + intended->width = (Dimension)*clip_width; if (*clip_height > (int)intended->height) - intended->height = *clip_height; + intended->height = (Dimension)*clip_height; } static void @@ -795,7 +795,7 @@ XawViewportResize(Widget widget) /*ARGSUSED*/ static Boolean -Layout(FormWidget w, unsigned int width, unsigned int height, Bool force) +Layout(FormWidget w, unsigned int width _X_UNUSED, unsigned int height _X_UNUSED, Bool force _X_UNUSED) { ComputeLayout((Widget)w, True, True); w->form.preferred_width = XtWidth(w); @@ -809,7 +809,7 @@ ScrollUpDownProc(Widget widget, XtPointer closure, XtPointer call_data) { ViewportWidget w = (ViewportWidget)closure; Widget child = w->viewport.child; - int pix = (long)call_data; + int pix = (int)(long)call_data; int x, y; if (child == NULL) @@ -833,12 +833,12 @@ ThumbProc(Widget widget, XtPointer closure, XtPointer call_data) return; if (widget == w->viewport.horiz_bar) - x = -percent * XtWidth(child); + x = (int)(-percent * XtWidth(child)); else x = XtX(child); if (widget == w->viewport.vert_bar) - y = -percent * XtHeight(child); + y = (int)(-percent * XtHeight(child)); else y = XtY(child); @@ -866,8 +866,8 @@ GeometryRequestPlusScrollbar(ViewportWidget w, Bool horizontal, plusScrollbars = *request; if ((sb = w->viewport.horiz_bar) == NULL) sb = CreateScrollbar(w, horizontal); - request->width += XtWidth(sb); - request->height += XtHeight(sb); + request->width = (Dimension)(request->width + XtWidth(sb)); + request->height = (Dimension)(request->height + XtHeight(sb)); XtDestroyWidget(sb); return (XtMakeGeometryRequest((Widget)w, &plusScrollbars, reply_return)); } @@ -924,7 +924,7 @@ XawViewportGeometryManager(Widget child, XtWidgetGeometry *request, return (QueryGeometry(w, request, reply)); if (child != w->viewport.child - || request->request_mode & ~(CWWidth | CWHeight | CWBorderWidth) + || request->request_mode & (XtGeometryMask)(~(CWWidth | CWHeight | CWBorderWidth)) || ((request->request_mode & CWBorderWidth) && request->border_width > 0)) return (XtGeometryNo); @@ -946,7 +946,7 @@ XawViewportGeometryManager(Widget child, XtWidgetGeometry *request, if ((bar = w->viewport.horiz_bar) == NULL) bar = CreateScrollbar(w, True); - height_remaining -= XtHeight(bar) + XtBorderWidth(bar); + height_remaining = (height_remaining - (unsigned)(XtHeight(bar) + XtBorderWidth(bar))); reconfigured = True; } else @@ -965,14 +965,14 @@ XawViewportGeometryManager(Widget child, XtWidgetGeometry *request, allowed.request_mode |= CWWidth; } if (allowed.width > XtWidth(bar) + XtBorderWidth(bar)) - allowed.width -= XtWidth(bar) + XtBorderWidth(bar); + allowed.width = (Dimension)(allowed.width - (XtWidth(bar) + XtBorderWidth(bar))); else allowed.width = 1; reconfigured = True; } } else - allowed.height = height_remaining; + allowed.height = (Dimension)height_remaining; } if (allowed.width != request->width || allowed.height != request->height) { @@ -1003,8 +1003,8 @@ GetGeometry(Widget w, unsigned int width, unsigned int height) return (False); geometry.request_mode = CWWidth | CWHeight; - geometry.width = width; - geometry.height = height; + geometry.width = (Dimension)width; + geometry.height = (Dimension)height; if (XtIsRealized(w)) { if (((ViewportWidget)w)->viewport.allowhoriz && width > XtWidth(w)) @@ -1061,14 +1061,14 @@ XawViewportSetLocation else if (xoff < 0.0) /* if the offset is < 0.0 nothing */ x = XtX(child); else - x = (float)XtWidth(child) * xoff; + x = (int)((float)XtWidth(child) * xoff); if (yoff > 1.0) y = XtHeight(child); else if (yoff < 0.0) y = XtY(child); else - y = (float)XtHeight(child) * yoff; + y = (int)((float)XtHeight(child) * yoff); MoveChild (w, -x, -y); } @@ -1086,14 +1086,14 @@ XawViewportSetCoordinates(Widget gw, Widget child = w->viewport.child; if (x > XtWidth(child)) - x = XtWidth(child); + x = (Position)XtWidth(child); else if (x < 0) - x = XtX(child); + x = (Position)XtX(child); if (y > XtHeight(child)) - y = XtHeight(child); + y = (Position)XtHeight(child); else if (y < 0) - y = XtY(child); + y = (Position)XtY(child); MoveChild (w, -x, -y); } diff --git a/lib/libXaw/src/XawI18n.c b/lib/libXaw/src/XawI18n.c index 99ed2ca18..b75f70a32 100644 --- a/lib/libXaw/src/XawI18n.c +++ b/lib/libXaw/src/XawI18n.c @@ -68,7 +68,7 @@ _Xaw_atowc(unsigned char c) wchar_t wc; char str[2]; - str[0] = c; + str[0] = (char)c; str[1] = '\0'; mbtowc(&wc, str, 1); @@ -94,7 +94,7 @@ int _Xaw_iswalnum(wchar_t ch) { #ifdef HAVE_ISWALNUM - return iswalnum(ch); + return iswalnum((wint_t)ch); #else unsigned char mb[MB_LEN_MAX]; diff --git a/lib/libXaw/src/XawIm.c b/lib/libXaw/src/XawIm.c index 7a7152fb6..1c733cdb3 100644 --- a/lib/libXaw/src/XawIm.c +++ b/lib/libXaw/src/XawIm.c @@ -155,7 +155,7 @@ static XtResource resources[] = { { XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet), - Offset (font_set), XtRString, XtDefaultFontSet + Offset (font_set), XtRString, (XtPointer)XtDefaultFontSet }, { XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), @@ -262,7 +262,7 @@ GetInputStyleOfIC(XawVendorShellExtPart *ve) /*ARGSUSED*/ static void -ConfigureCB(Widget w, XtPointer closure, XEvent *event, Boolean *unused) +ConfigureCB(Widget w, XtPointer closure _X_UNUSED, XEvent *event, Boolean *unused _X_UNUSED) { XawIcTableList p; XawVendorShellExtPart *ve; @@ -285,10 +285,10 @@ ConfigureCB(Widget w, XtPointer closure, XEvent *event, Boolean *unused) pe_area.width = w->core.width; pe_area.height = w->core.height; margin = &(((TextWidget)w)->text.margin); - pe_area.x += margin->left; - pe_area.y += margin->top; - pe_area.width -= (margin->left + margin->right - 1); - pe_area.height -= (margin->top + margin->bottom - 1); + pe_area.x = (short)(pe_area.x + margin->left); + pe_area.y = (short)(pe_area.y + margin->top); + pe_area.width = (unsigned short)(pe_area.width - (margin->left + margin->right - 1)); + pe_area.height = (unsigned short)(pe_area.height - (margin->top + margin->bottom - 1)); pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL); XSetICValues(p->xic, XNPreeditAttributes, pe_attr, NULL); @@ -344,7 +344,7 @@ SetVendorShellHeight(XawVendorShellExtPart* ve, unsigned int height) if (ve->im.area_height < height || height == 0) { XtSetArg(args[i], XtNheight, (ve->parent->core.height + height - ve->im.area_height)); - ve->im.area_height = height; + ve->im.area_height = (Dimension)height; XtSetValues(ve->parent, args, 1); } return(ve->im.area_height); @@ -416,7 +416,7 @@ FreeAllDataOfVendorShell(XawVendorShellExtPart *ve, VendorShellWidget vw) } static void -VendorShellDestroyed(Widget w, XtPointer cl_data, XtPointer ca_data) +VendorShellDestroyed(Widget w, XtPointer cl_data _X_UNUSED, XtPointer ca_data _X_UNUSED) { XawVendorShellExtPart *ve; @@ -449,7 +449,8 @@ static void OpenIM(XawVendorShellExtPart *ve) { int i; - char *p, *s, *ns, *end, *pbuf, buf[32]; + _Xconst char *s, *ns, *end; + char *p, *pbuf, buf[32]; XIM xim = NULL; XIMStyles *xim_styles; XIMStyle input_style = 0; @@ -462,7 +463,7 @@ OpenIM(XawVendorShellExtPart *ve) xim = XOpenIM(XtDisplay(ve->parent), NULL, NULL, NULL); } else { /* no fragment can be longer than the whole string */ - Cardinal len = strlen (ve->im.input_method) + 5; + Cardinal len = (Cardinal)strlen (ve->im.input_method) + 5; if (len < sizeof buf) pbuf = buf; else pbuf = XtMalloc (len); @@ -481,7 +482,7 @@ OpenIM(XawVendorShellExtPart *ve) while (isspace(*(end - 1))) end--; strcpy (pbuf, "@im="); - strncat (pbuf, s, end - s); + strncat (pbuf, s, (size_t)(end - s)); pbuf[end - s + 4] = '\0'; } @@ -522,11 +523,11 @@ OpenIM(XawVendorShellExtPart *ve) if (end > s) while (isspace(*(end - 1))) end--; - if (!strncmp(s, "OverTheSpot", end - s)) { + if (!strncmp(s, "OverTheSpot", (size_t)(end - s))) { input_style = (XIMPreeditPosition | XIMStatusArea); - } else if (!strncmp(s, "OffTheSpot", end - s)) { + } else if (!strncmp(s, "OffTheSpot", (size_t)(end - s))) { input_style = (XIMPreeditArea | XIMStatusArea); - } else if (!strncmp(s, "Root", end - s)) { + } else if (!strncmp(s, "Root", (size_t)(end - s))) { input_style = (XIMPreeditNothing | XIMStatusNothing); } for (i = 0; (unsigned short)i < xim_styles->count_styles; i++) @@ -566,7 +567,7 @@ ResizeVendorShell_Core(VendorShellWidget vw, XawVendorShellExtPart *ve, return(FALSE); } st_area.x = 0; - st_area.y = vw->core.height - ve->im.area_height; + st_area.y = (short)(vw->core.height - ve->im.area_height); st_area.width = get_st_area->width; st_area.height = get_st_area->height; XFree(get_st_area); @@ -584,12 +585,12 @@ ResizeVendorShell_Core(VendorShellWidget vw, XawVendorShellExtPart *ve, if (p->xic == NULL) { return(FALSE); } - pe_area.x = st_area.width; - pe_area.y = vw->core.height - ve->im.area_height; + pe_area.x = (short)st_area.width; + pe_area.y = (short)(vw->core.height - ve->im.area_height); pe_area.width = vw->core.width; pe_area.height = get_pe_area->height; if (p->input_style & XIMStatusArea) { - pe_area.width -= st_area.width; + pe_area.width = (unsigned short)(pe_area.width - st_area.width); } XFree(get_pe_area); pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL); @@ -617,7 +618,7 @@ ResizeVendorShell(VendorShellWidget vw, XawVendorShellExtPart *ve) } static XawIcTableList -CreateIcTable(Widget w, XawVendorShellExtPart *ve) +CreateIcTable(Widget w, XawVendorShellExtPart *ve _X_UNUSED) { XawIcTableList table; @@ -742,11 +743,11 @@ SizeNegotiation(XawIcTableList p, unsigned int width, unsigned int height) if (p->input_style & XIMStatusArea) { st_area.height = st_area_needed->height; st_area.x = 0; - st_area.y = height - st_area.height; + st_area.y = (short)(height - st_area.height); if (p->input_style & XIMPreeditArea) { st_area.width = st_area_needed->width; } else { - st_area.width = width; + st_area.width = (unsigned short)width; } XFree(st_area_needed); @@ -756,15 +757,15 @@ SizeNegotiation(XawIcTableList p, unsigned int width, unsigned int height) } if (p->input_style & XIMPreeditArea) { if (p->input_style & XIMStatusArea) { - pe_area.x = st_area.width; - pe_area.width = width - st_area.width; + pe_area.x = (short)st_area.width; + pe_area.width = (unsigned short)(width - st_area.width); } else { pe_area.x = 0; - pe_area.width = width; + pe_area.width = (unsigned short)width; } pe_area.height = pe_area_needed->height; XFree(pe_area_needed); - pe_area.y = height - pe_area.height; + pe_area.y = (short)(height - pe_area.height); pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL); ic_a[ic_cnt] = (XPointer) XNPreeditAttributes; ic_cnt++; ic_a[ic_cnt] = (XPointer) pe_attr; ic_cnt++; @@ -808,10 +809,10 @@ CreateIC(Widget w, XawVendorShellExtPart *ve) st_a[st_cnt] = (XPointer) XNFontSet; st_cnt++; st_a[st_cnt] = (XPointer) p->font_set; st_cnt++; if (p->font_set) { - height = maxAscentOfFontSet(p->font_set) - + maxDescentOfFontSet(p->font_set); + height = (Dimension)(maxAscentOfFontSet(p->font_set) + + maxDescentOfFontSet(p->font_set)); } - height = SetVendorShellHeight(ve, height); + height = (Dimension)SetVendorShellHeight(ve, height); } if (p->flg & CIFg) { pe_a[pe_cnt] = (XPointer) XNForeground; pe_cnt++; @@ -840,7 +841,7 @@ CreateIC(Widget w, XawVendorShellExtPart *ve) } if (p->input_style & XIMPreeditArea) { pe_area.x = 0; - pe_area.y = ve->parent->core.height - height; + pe_area.y = (short)(ve->parent->core.height - height); pe_area.width = ve->parent->core.width; pe_area.height = height; pe_a[pe_cnt] = (XPointer) XNArea; pe_cnt++; @@ -852,10 +853,10 @@ CreateIC(Widget w, XawVendorShellExtPart *ve) pe_area.width = w->core.width; pe_area.height = w->core.height; margin = &(((TextWidget)w)->text.margin); - pe_area.x += margin->left; - pe_area.y += margin->top; - pe_area.width -= (margin->left + margin->right - 1); - pe_area.height -= (margin->top + margin->bottom - 1); + pe_area.x = (short)(pe_area.x + margin->left); + pe_area.y = (short)(pe_area.y + margin->top); + pe_area.width = (unsigned short)(pe_area.width - (margin->left + margin->right - 1)); + pe_area.height = (unsigned short)(pe_area.height - (margin->top + margin->bottom - 1)); pe_a[pe_cnt] = (XPointer) XNArea; pe_cnt++; pe_a[pe_cnt] = (XPointer) &pe_area; pe_cnt++; if (p->flg & CICursorP) { @@ -868,7 +869,7 @@ CreateIC(Widget w, XawVendorShellExtPart *ve) } if (p->input_style & XIMStatusArea) { st_area.x = 0; - st_area.y = ve->parent->core.height - height; + st_area.y = (short)(ve->parent->core.height - height); st_area.width = ve->parent->core.width; st_area.height = height; st_a[st_cnt] = (XPointer) XNArea; st_cnt++; @@ -919,7 +920,7 @@ CreateIC(Widget w, XawVendorShellExtPart *ve) SizeNegotiation(p, ve->parent->core.width, ve->parent->core.height); - p->flg &= ~(CIFontSet | CIFg | CIBg | CIBgPixmap | CICursorP | CILineS); + p->flg &= (unsigned long)(~(CIFontSet | CIFg | CIBg | CIBgPixmap | CICursorP | CILineS)); if (!IsSharedIC(ve)) { if (p->input_style & XIMPreeditPosition) { @@ -970,7 +971,7 @@ SetICValues(Widget w, XawVendorShellExtPart *ve, Bool focus) height = maxAscentOfFontSet(p->font_set) + maxDescentOfFontSet(p->font_set); } - height = SetVendorShellHeight(ve, height); + height = (int)SetVendorShellHeight(ve, (unsigned)height); } if (p->flg & CIFg) { pe_a[pe_cnt] = (XPointer) XNForeground; pe_cnt++; @@ -1011,10 +1012,10 @@ SetICValues(Widget w, XawVendorShellExtPart *ve, Bool focus) pe_area.width = w->core.width; pe_area.height = w->core.height; margin = &(((TextWidget)w)->text.margin); - pe_area.x += margin->left; - pe_area.y += margin->top; - pe_area.width -= (margin->left + margin->right - 1); - pe_area.height -= (margin->top + margin->bottom - 1); + pe_area.x = (short)(pe_area.x + margin->left); + pe_area.y = (short)(pe_area.y + margin->top); + pe_area.width = (unsigned short)(pe_area.width - (margin->left + margin->right - 1)); + pe_area.height = (unsigned short)(pe_area.height - (margin->top + margin->bottom - 1)); pe_a[pe_cnt] = (XPointer) XNArea; pe_cnt++; pe_a[pe_cnt] = (XPointer) &pe_area; pe_cnt++; } @@ -1057,12 +1058,12 @@ SetICValues(Widget w, XawVendorShellExtPart *ve, Bool focus) if (IsSharedIC(ve) && p->flg & CIFontSet) SizeNegotiation(p, ve->parent->core.width, ve->parent->core.height); - p->flg &= ~(CIFontSet | CIFg | CIBg | CIBgPixmap | CICursorP | CILineS); + p->flg &= (unsigned long)(~(CIFontSet | CIFg | CIBg | CIBgPixmap | CICursorP | CILineS)); } static void SharedICChangeFocusWindow(Widget w, XawVendorShellExtPart *ve, - XawIcTableList p) + XawIcTableList p _X_UNUSED) { XawIcTableList pp; @@ -1099,7 +1100,7 @@ SetICFocus(Widget w, XawVendorShellExtPart *ve) p->ic_focused = TRUE; XSetICFocus(p->xic); } - p->flg &= ~CIICFocus; + p->flg &= (unsigned long)(~CIICFocus); } static void @@ -1237,9 +1238,9 @@ UnsetFocus(Widget inwidg) if ((ve = GetExtPart(vw)) != NULL) { if ((p = GetIcTableShared(inwidg, ve)) == NULL) return; if (p->flg & CIICFocus) { - p->flg &= ~CIICFocus; + p->flg &= (unsigned long)(~CIICFocus); } - p->prev_flg &= ~CIICFocus; + p->prev_flg &= (unsigned long)(~CIICFocus); if (ve->im.xim && XtIsRealized((Widget)vw) && p->xic) { UnsetICFocus(inwidg, ve); } @@ -1364,7 +1365,7 @@ CompileResourceList(XtResourceList res, unsigned int num_res) xrmres->xrm_name = XrmPermStringToQuark(res->resource_name); xrmres->xrm_class = XrmPermStringToQuark(res->resource_class); xrmres->xrm_type = XrmPermStringToQuark(res->resource_type); - xrmres->xrm_offset = -res->resource_offset - 1; + xrmres->xrm_offset = (int)(-res->resource_offset - 1); xrmres->xrm_default_type = XrmPermStringToQuark(res->default_type); } #undef xrmres @@ -1443,7 +1444,7 @@ _XawImGetShellHeight(Widget w) if (!XtIsVendorShell( w ) ) return( w->core.height ); if ( (ve = GetExtPart( (VendorShellWidget) w )) != NULL ) { - return( w->core.height - ve->im.area_height ); + return (Dimension)( w->core.height - ve->im.area_height ); } return( w->core.height ); } @@ -1542,13 +1543,14 @@ _XawImWcLookupString(Widget inwidg, XKeyPressedEvent *event, if ((vw = SearchVendorShell(inwidg)) && (ve = GetExtPart(vw)) && ve->im.xim && (p = GetIcTableShared(inwidg, ve)) && p->xic) { - return(XwcLookupString(p->xic, event, buffer_return, bytes_buffer/sizeof(wchar_t), + return(XwcLookupString(p->xic, event, buffer_return, + (int)((size_t)bytes_buffer/sizeof(wchar_t)), keysym_return, NULL)); } ret = XLookupString( event, tmp_buf, sizeof(tmp_buf), keysym_return, NULL ); for ( i = 0, tmp_p = tmp_buf, buf_p = buffer_return; i < ret; i++ ) { - *buf_p++ = _Xaw_atowc(*tmp_p++); + *buf_p++ = _Xaw_atowc((unsigned char)*tmp_p++); } return( ret ); } @@ -1599,7 +1601,7 @@ _XawImCallVendorShellExtResize(Widget w) * core Destroy method. Sheeran, Omron KK 93/08/05 */ void -_XawImDestroy(Widget w, Widget ext) +_XawImDestroy(Widget w, Widget ext _X_UNUSED) { XawVendorShellExtPart *ve; diff --git a/lib/libXaw/src/XawInit.c b/lib/libXaw/src/XawInit.c index 5ca1ef88a..702ea5c3d 100644 --- a/lib/libXaw/src/XawInit.c +++ b/lib/libXaw/src/XawInit.c @@ -66,7 +66,7 @@ Widget XawOpenApplication(XtAppContext *app_context_return, String application_class, WidgetClass widget_class, int *argc, - String *argv) + _XtString *argv) { Widget toplevel; Cardinal n; |