diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2019-07-03 09:55:56 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2019-07-04 13:08:34 -0400 |
commit | bca947bda79e992b1bd0537ad68fedc9740188e3 (patch) | |
tree | 78f20aeb18236bec3ba27bc9bf03da4bbbd7a0ec | |
parent | 88dabfee7a5a45ef747f4e3367c1705cddfd871a (diff) | |
download | xorg-lib-libXaw-bca947bda79e992b1bd0537ad68fedc9740188e3.tar.gz |
add casts to quiet gcc conversion-warnings, no object change
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
-rw-r--r-- | src/AsciiSink.c | 233 |
1 files changed, 118 insertions, 115 deletions
diff --git a/src/AsciiSink.c b/src/AsciiSink.c index 1cccb1c..41cac7d 100644 --- a/src/AsciiSink.c +++ b/src/AsciiSink.c @@ -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; + 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**)left)->property - + (*(XawTextPaintStruct**)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 ((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++; @@ -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); @@ -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)sink; values.clip_mask = None; values.font = sink->ascii_sink.font->fid; values.graphics_exposures = False; @@ -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) @@ -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]; } |