summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2024-02-28 19:43:50 -0500
committerThomas E. Dickey <dickey@invisible-island.net>2024-02-28 20:48:36 -0500
commit36ac433450b7e0b260e44b4320c4b6af0ba12a8f (patch)
treebf89e5aa20d11be5de4535ee392b5187e3c0a23e
parenteb5cbbd6f8056b3008c0f8e7e603b10a3ff4cbb2 (diff)
quiet conversion-warnings with casts
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
-rw-r--r--src/AsciiSink.c10
-rw-r--r--src/AsciiSrc.c6
-rw-r--r--src/Command.c4
-rw-r--r--src/DisplayList.c2
-rw-r--r--src/Label.c30
-rw-r--r--src/MultiSink.c1
-rw-r--r--src/MultiSrc.c4
-rw-r--r--src/Paned.c2
-rw-r--r--src/SimpleMenu.c2
-rw-r--r--src/Text.c8
-rw-r--r--src/TextAction.c8
-rw-r--r--src/TextSink.c8
-rw-r--r--src/TextSrc.c17
-rw-r--r--src/Tip.c12
14 files changed, 57 insertions, 57 deletions
diff --git a/src/AsciiSink.c b/src/AsciiSink.c
index d0d5d3d..5851ae0 100644
--- a/src/AsciiSink.c
+++ b/src/AsciiSink.c
@@ -1000,7 +1000,7 @@ AsciiDoPaint(Widget w)
if (paint->x < XtWidth(ctx) && paint->x + paint->width > 0) {
XRectangle rect2 = {
.x = (short)(paint->x + paint->width),
- .width = (XawAbs(paint->width)), /* more than enough */
+ .width = (unsigned short)(XawAbs(paint->width)), /* more than enough */
.y = (short)(paint->y - font->ascent),
.height = (unsigned short)((paint->y - font->ascent) +
font->ascent + font->descent)
@@ -1408,7 +1408,7 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx,
while (!done) {
if (XawTextSourceAnchorAndEntity(source, pos, &anchor, &entity)) {
length = (Cardinal)(anchor->position + entity->offset + entity->length);
- length = (XawMin(toPos, length) - pos);
+ length = (Cardinal)(XawMin(toPos, length) - pos);
if ((property = XawTextSinkGetProperty((Widget)sink,
entity->property)) != NULL &&
(property->mask & XAW_TPROP_FONT))
@@ -1422,13 +1422,13 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx,
entity = entity->next;
if (entity) {
length = (Cardinal)(anchor->position + entity->offset);
- length = (XawMin(toPos, length) - pos);
+ length = (Cardinal)(XawMin(toPos, length) - pos);
}
else
- length = (XawMin(toPos - pos, 4096));
+ length = (Cardinal)(XawMin(toPos - pos, 4096));
}
else
- length = (XawMin(toPos - pos, 4096));
+ length = (Cardinal)(XawMin(toPos - pos, 4096));
font = sink->ascii_sink.font;
}
diff --git a/src/AsciiSrc.c b/src/AsciiSrc.c
index 61b19e1..f1a68a5 100644
--- a/src/AsciiSrc.c
+++ b/src/AsciiSrc.c
@@ -418,7 +418,7 @@ ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length)
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 = (int)(Max(0, (length > count) ? count : length));
text->format = XawFmt8Bit;
return (pos + text->length);
@@ -468,7 +468,7 @@ ReplaceText(Widget w, XawTextPosition startPos, XawTextPosition endPos,
if (start_piece->used) {
int i;
- for (i = 0; i < src->text_src.num_text; i++) {
+ for (i = 0; i < (int)src->text_src.num_text; i++) {
int line;
TextWidget ctx = (TextWidget)src->text_src.text[i];
@@ -1331,7 +1331,7 @@ WritePiecesToFile(AsciiSrcObject src, String name)
Piece *tmp;
if (bytes > 0 && (tmp = piece->next) != NULL) {
- bytes = (XawMin(bytes, tmp->used));
+ bytes = (int)(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;
diff --git a/src/Command.c b/src/Command.c
index a021073..a2b298a 100644
--- a/src/Command.c
+++ b/src/Command.c
@@ -298,8 +298,8 @@ HighlightRegion(CommandWidget cbw)
rect.height = XtHeight(cbw);
XUnionRectWithRegion(&rect, emptyRegion, outerRegion);
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);
+ rect.width = (unsigned short)(rect.width - cbw->command.highlight_thickness * 2);
+ rect.height = (unsigned short)(rect.height - cbw->command.highlight_thickness * 2);
XUnionRectWithRegion(&rect, emptyRegion, innerRegion);
XSubtractRegion(outerRegion, innerRegion, outerRegion);
diff --git a/src/DisplayList.c b/src/DisplayList.c
index ed4fbc8..f06ac34 100644
--- a/src/DisplayList.c
+++ b/src/DisplayList.c
@@ -914,7 +914,7 @@ DlLineWidth(Widget w, XtPointer args, XtPointer data,
XawXlibData *xdata = (XawXlibData *)data;
unsigned line_width = (unsigned)(unsigned long)args;
- if (xdata->values.line_width != line_width)
+ if ((unsigned)xdata->values.line_width != line_width)
{
xdata->mask |= GCLineWidth;
xdata->values.line_width = (int)line_width;
diff --git a/src/Label.c b/src/Label.c
index 5707dd0..ab7c6bb 100644
--- a/src/Label.c
+++ b/src/Label.c
@@ -358,7 +358,7 @@ SetTextWidthAndHeight(LabelWidget lw)
label = nl + 1;
if (*label)
lw->label.label_height +=
- fs->max_bounds.ascent + fs->max_bounds.descent;
+ (Dimension)(fs->max_bounds.ascent + fs->max_bounds.descent);
}
if (*label) {
int width;
@@ -495,9 +495,9 @@ XawLabelInitialize(Widget request _X_UNUSED, Widget cnew,
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) = (Dimension)(lw->label.label_width
+ + (unsigned)(2 * lw->label.internal_width)
+ + LEFT_OFFSET(lw));
lw->label.label_x = lw->label.label_y = 0;
(*XtClass(cnew)->core_class.resize)((Widget)lw);
@@ -535,7 +535,7 @@ XawLabelRedisplay(Widget gw, XEvent *event, Region region)
if (w->simple.international == True) {
XFontSetExtents *ext = XExtentsOfFontSet(w->label.fontset);
- ksy = (ksy + XawAbs(ext->max_ink_extent.y));
+ ksy = (Position) (ksy + XawAbs(ext->max_ink_extent.y));
if (len == MULTI_LINE_LABEL) {
char *nl;
@@ -544,7 +544,7 @@ 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 = (ksy + ext->max_ink_extent.height);
+ ksy = (Position) (ksy + ext->max_ink_extent.height);
label = nl + 1;
}
len = (int)strlen(label);
@@ -565,8 +565,8 @@ 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 += (Position) (w->label.font->max_bounds.ascent +
+ w->label.font->max_bounds.descent);
label = nl + 1;
}
len = (int)strlen(label);
@@ -601,7 +601,7 @@ _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 = (Position)(lw->label.internal_width + LEFT_OFFSET(lw));
switch (lw->label.justify) {
case XtJustifyLeft:
@@ -703,9 +703,9 @@ XawLabelSetValues(Widget current, Widget request, Widget cnew,
set_bitmap_info(newlw);
if (XtWidth(curlw) == XtWidth(reqlw) && !checks[WIDTH])
- XtWidth(newlw) = (newlw->label.label_width
- + LEFT_OFFSET(newlw)
- + (unsigned)(newlw->label.internal_width << 1));
+ XtWidth(newlw) = (Dimension)(newlw->label.label_width
+ + LEFT_OFFSET(newlw)
+ + (unsigned)(newlw->label.internal_width << 1));
}
if (curlw->label.foreground != newlw->label.foreground
@@ -756,9 +756,9 @@ XawLabelQueryGeometry(Widget w, XtWidgetGeometry *intended,
LabelWidget lw = (LabelWidget)w;
preferred->request_mode = CWWidth | CWHeight;
- preferred->width = (lw->label.label_width
- + (unsigned)(lw->label.internal_width << 1)
- + LEFT_OFFSET(lw));
+ preferred->width = (Dimension)(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));
diff --git a/src/MultiSink.c b/src/MultiSink.c
index 9f7fc78..6bb2465 100644
--- a/src/MultiSink.c
+++ b/src/MultiSink.c
@@ -212,7 +212,6 @@ MultiSinkClassRec multiSinkClassRec = {
MaxHeight, /* MaxHeight */
SetTabs, /* SetTabs */
GetCursorBounds, /* GetCursorBounds */
- NULL, /* extension */
},
/* multi_sink */
{
diff --git a/src/MultiSrc.c b/src/MultiSrc.c
index d4af34e..9cef918 100644
--- a/src/MultiSrc.c
+++ b/src/MultiSrc.c
@@ -335,7 +335,7 @@ ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length)
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 = (int)(Max(0, (length > count) ? count : length));
return (pos + text->length);
}
@@ -1323,7 +1323,7 @@ LoadPieces(MultiSrcObject src, FILE *file, char *string)
else {
if (src->multi_src.length != 0) {
temp_mb_holder =
- XtMalloc(((size_t)(src->multi_src.length + 1) * sizeof(unsigned char)));
+ XtMalloc((Cardinal)((size_t)(src->multi_src.length + 1) * sizeof(unsigned char)));
fseek(file, 0, SEEK_SET);
src->multi_src.length = (XawTextPosition)fread(temp_mb_holder,
sizeof(unsigned char),
diff --git a/src/Paned.c b/src/Paned.c
index e68615a..b8bfdb0 100644
--- a/src/Paned.c
+++ b/src/Paned.c
@@ -510,7 +510,7 @@ AdjustPanedSize(PanedWidget pw, unsigned int off_size,
int size = Max(PaneInfo(*childP)->size, (int)PaneInfo(*childP)->min);
AssignMin(size, (int)PaneInfo(*childP)->max);
- newsize = (newsize + (size + pw->paned.internal_bw));
+ newsize = (Dimension)(newsize + (size + pw->paned.internal_bw));
}
newsize = (Dimension)(newsize - pw->paned.internal_bw);
diff --git a/src/SimpleMenu.c b/src/SimpleMenu.c
index e3f1e2b..9eb8cd9 100644
--- a/src/SimpleMenu.c
+++ b/src/SimpleMenu.c
@@ -1199,7 +1199,7 @@ Layout(Widget w, Dimension *width_ret, Dimension *height_ret)
++n;
}
- height = (tmp_h + smw->simple_menu.bottom_margin);
+ height = (Dimension)(tmp_h + smw->simple_menu.bottom_margin);
width = (Dimension)(width + tmp_w);
if (smw->simple_menu.label && width < XtWidth(smw->simple_menu.label)) {
diff --git a/src/Text.c b/src/Text.c
index b70fa5a..489fa53 100644
--- a/src/Text.c
+++ b/src/Text.c
@@ -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 += (Position) (XtWidth(vbar) + XtBorderWidth(vbar));
ctx->text.left_margin = ctx->text.margin.left = ctx->text.r_margin.left;
PositionVScrollBar(ctx);
@@ -950,7 +950,7 @@ XawTextInitialize(Widget request _X_UNUSED, Widget cnew,
if (XtHeight(ctx) == DEFAULT_TEXT_HEIGHT) {
XtHeight(ctx) = (Dimension)VMargins(ctx);
if (ctx->text.sink != NULL)
- XtHeight(ctx) += XawTextSinkMaxHeight(ctx->text.sink, 1);
+ XtHeight(ctx) += (Dimension) XawTextSinkMaxHeight(ctx->text.sink, 1);
}
if (ctx->text.scroll_vert == XawtextScrollAlways)
@@ -2051,7 +2051,7 @@ TextConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
*length = strlen((char *)*value);
}
else {
- *value = XtMalloc(((size_t)(salt->length + 1) * sizeof(unsigned char)));
+ *value = XtMalloc((Cardinal)((size_t)(salt->length + 1) * sizeof(unsigned char)));
strcpy ((char *)*value, salt->contents);
*length = (unsigned long)salt->length;
}
@@ -2404,7 +2404,7 @@ _SetSelection(TextWidget ctx, XawTextPosition left, XawTextPosition right,
while (len > max_len) {
len -= max_len;
tptr += max_len;
- amount = Min (len, max_len);
+ amount = (unsigned) Min (len, max_len);
XChangeProperty(XtDisplay(w), RootWindow(XtDisplay(w), 0),
selection, XA_STRING, 8, PropModeAppend,
tptr, (int)amount);
diff --git a/src/TextAction.c b/src/TextAction.c
index 01cc752..88febd8 100644
--- a/src/TextAction.c
+++ b/src/TextAction.c
@@ -1037,7 +1037,7 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
*length = strlen(*value);
}
else {
- *value = XtMalloc(((size_t)(salt->length + 1) * sizeof(unsigned char)));
+ *value = XtMalloc((Cardinal)((size_t)(salt->length + 1) * sizeof(unsigned char)));
strcpy (*value, salt->contents);
*length = (unsigned long)salt->length;
}
@@ -1293,7 +1293,7 @@ _DeleteOrKill(TextWidget ctx, XawTextPosition from, XawTextPosition to,
if (!append)
salt->contents = string;
else {
- salt->contents = XtMalloc((length + size + 1));
+ salt->contents = XtMalloc((Cardinal)(length + size + 1));
if (from >= old_from) {
strncpy(salt->contents, ring, (size_t)size);
salt->contents[size] = '\0';
@@ -2608,7 +2608,7 @@ InsertNewLineAndIndent(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n
char *ptr;
length = (int)strlen(line_to_ip);
- text.ptr = XtMalloc(((size_t)(2 + length) * sizeof(char)));
+ text.ptr = XtMalloc((Cardinal)((size_t)(2 + length) * sizeof(char)));
ptr = text.ptr;
ptr[0] = XawLF;
strcpy(++ptr, line_to_ip);
@@ -3302,7 +3302,7 @@ InsertString(Widget w, XEvent *event, String *params, Cardinal *num_params)
StartAction(ctx, event);
for (i = (int)*num_params; i; i--, params++) { /* DO FOR EACH PARAMETER */
- text.ptr = IfHexConvertHexElseReturnParam(*params, &text.length);
+ text.ptr = IfHexConvertHexElseReturnParam((char*) *params, &text.length);
if (text.length == 0)
continue;
diff --git a/src/TextSink.c b/src/TextSink.c
index e96348f..b484310 100644
--- a/src/TextSink.c
+++ b/src/TextSink.c
@@ -426,10 +426,10 @@ 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 = (Position) (XawMax(x, xaw->text.r_margin.left));
+ y1 = (Position) (XawMax(y, xaw->text.r_margin.top));
+ x2 = (Position) (XawMin(x + (int)width, (int)XtWidth(xaw) - xaw->text.r_margin.right));
+ y2 = (Position) (XawMin(y + (int)height, (int)XtHeight(xaw) - xaw->text.r_margin.bottom));
x = (int)x1;
y = (int)y1;
diff --git a/src/TextSrc.c b/src/TextSrc.c
index 9295b85..97cbd30 100644
--- a/src/TextSrc.c
+++ b/src/TextSrc.c
@@ -735,6 +735,7 @@ XawTextSourceReplace(Widget w, XawTextPosition left,
Bool enable_undo;
XawTextPosition start, end;
int i, error, lines = 0;
+ Cardinal j;
if (src->textSrc.edit_mode == XawtextRead)
return (XawEditError);
@@ -754,9 +755,9 @@ XawTextSourceReplace(Widget w, XawTextPosition left,
if (left < right) {
Widget ctx = NULL;
- for (i = 0; i < src->textSrc.num_text; i++)
- if (XtIsSubclass(src->textSrc.text[i], textWidgetClass)) {
- ctx = src->textSrc.text[i];
+ for (j = 0; j < src->textSrc.num_text; j++)
+ if (XtIsSubclass(src->textSrc.text[j], textWidgetClass)) {
+ ctx = src->textSrc.text[j];
break;
}
l_state->buffer = _XawTextGetText((TextWidget)ctx, left, right);
@@ -826,8 +827,8 @@ XawTextSourceReplace(Widget w, XawTextPosition left,
*/
if (left > LARGE_VALUE) {
start = XawTextSourceScan(w, left, XawstEOL, XawsdLeft, 2, False);
- for (i = 0; i < src->textSrc.num_text; i++) {
- TextWidget tw = (TextWidget)src->textSrc.text[i];
+ for (j = 0; j < src->textSrc.num_text; j++) {
+ TextWidget tw = (TextWidget)src->textSrc.text[j];
if (left <= tw->text.lt.top &&
left + block->length - (right - left) > tw->text.lt.top)
@@ -1053,7 +1054,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 = (Cardinal) (XawMin(entity->length, offset - right));
goto exit_anchor_loop;
}
@@ -1935,7 +1936,7 @@ XawTextSourceClearEntities(Widget w, XawTextPosition left, XawTextPosition right
offset = anchor->position + entity->offset;
if (offset <= left) {
- int length = (XawMin(entity->length, left - offset));
+ int length = (int) (XawMin(entity->length, left - offset));
if (length <= 0) {
enext = entity->next;
@@ -1970,7 +1971,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 = (Cardinal) (XawMin(entity->length, offset - right));
return;
}
diff --git a/src/Tip.c b/src/Tip.c
index 9c65de9..0d939ba 100644
--- a/src/Tip.c
+++ b/src/Tip.c
@@ -330,13 +330,13 @@ XawTipExpose(Widget w, XEvent *event, Region region)
Position ksy = (Position)tip->tip.top_margin;
XFontSetExtents *ext = XExtentsOfFontSet(tip->tip.fontset);
- ksy = (ksy + XawAbs(ext->max_ink_extent.y));
+ ksy = (Position) (ksy + XawAbs(ext->max_ink_extent.y));
while ((nl = strchr(label, '\n')) != NULL) {
XmbDrawString(XtDisplay(w), XtWindow(w), tip->tip.fontset,
gc, tip->tip.left_margin, ksy, label,
(int)(nl - label));
- ksy = (ksy + ext->max_ink_extent.height);
+ ksy = (Position) (ksy + ext->max_ink_extent.height);
label = nl + 1;
}
len = (int)strlen(label);
@@ -455,10 +455,10 @@ TipLayout(XawTipInfo *info)
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) = (Dimension) (width + info->tip->tip.left_margin +
+ info->tip->tip.right_margin);
+ XtHeight(info->tip) = (Dimension) (height + info->tip->tip.top_margin +
+ info->tip->tip.bottom_margin);
}
#define DEFAULT_TIP_Y_OFFSET 12