summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2019-07-03 09:56:08 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2019-07-04 13:08:34 -0400
commit88dabfee7a5a45ef747f4e3367c1705cddfd871a (patch)
tree358d28b3ab4f8e4fd61c89b6f381e21e5e1cdd27
parentbc737a82007a880c6d17d2334bf85346640409e7 (diff)
downloadxorg-lib-libXaw-88dabfee7a5a45ef747f4e3367c1705cddfd871a.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/AsciiSrc.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/AsciiSrc.c b/src/AsciiSrc.c
index 74f05aa..b9b847c 100644
--- a/src/AsciiSrc.c
+++ b/src/AsciiSrc.c
@@ -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);
@@ -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);
}
@@ -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);
@@ -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;