summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-03-06 15:29:54 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-03-06 15:29:54 (GMT)
commit7293da8bb72712757786b863b3e5ecd826917916 (patch)
tree0acc593d65c0ed250414e43684b95b74b1d4b44a /unix
parent7f94543bc8a39f0f426203faef8b5b5a9fa4fb56 (diff)
downloadtk-7293da8bb72712757786b863b3e5ecd826917916.zip
tk-7293da8bb72712757786b863b3e5ecd826917916.tar.gz
tk-7293da8bb72712757786b863b3e5ecd826917916.tar.bz2
More -Wconversion C warning fixes
Diffstat (limited to 'unix')
-rw-r--r--unix/tkUnixButton.c4
-rw-r--r--unix/tkUnixColor.c2
-rw-r--r--unix/tkUnixCursor.c8
-rw-r--r--unix/tkUnixEmbed.c2
-rw-r--r--unix/tkUnixKey.c13
-rw-r--r--unix/tkUnixMenubu.c2
-rw-r--r--unix/tkUnixScale.c8
7 files changed, 20 insertions, 19 deletions
diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c
index e02e079..25f99d4 100644
--- a/unix/tkUnixButton.c
+++ b/unix/tkUnixButton.c
@@ -396,7 +396,7 @@ TkpDrawCheckIndicator(
scalingPctPtr = Tcl_GetVar(interp, "::tk::scalingPct", TCL_GLOBAL_ONLY);
scalingFactor = (scalingPctPtr == NULL ? 1.0 : atof(scalingPctPtr) / 100);
- dim *= scalingFactor;
+ dim = (int)(dim * scalingFactor);
/*
* Adjust the image's coordinates in the drawable and display the image
@@ -977,7 +977,7 @@ TkpComputeButtonGeometry(
Tk_FreeTextLayout(butPtr->textLayout);
butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont,
- Tcl_GetString(butPtr->textPtr), -1, butPtr->wrapLength,
+ Tcl_GetString(butPtr->textPtr), TCL_INDEX_NONE, butPtr->wrapLength,
butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight);
txtWidth = butPtr->textWidth;
diff --git a/unix/tkUnixColor.c b/unix/tkUnixColor.c
index eccec3b..8965ab6 100644
--- a/unix/tkUnixColor.c
+++ b/unix/tkUnixColor.c
@@ -291,7 +291,7 @@ FindClosestColor(
stressPtr->numColors = visInfoPtr->colormap_size;
XFree((char *) visInfoPtr);
stressPtr->colorPtr = (XColor *)
- ckalloc(stressPtr->numColors * sizeof(XColor));
+ ckalloc((size_t)stressPtr->numColors * sizeof(XColor));
for (i = 0; i < stressPtr->numColors; i++) {
stressPtr->colorPtr[i].pixel = (unsigned long) i;
}
diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c
index 55b592e..55d1a08 100644
--- a/unix/tkUnixCursor.c
+++ b/unix/tkUnixCursor.c
@@ -312,7 +312,7 @@ TkGetCursorByName(
if (!inTkTable && Tcl_IsSafe(interp)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can't get cursor from a file in a safe interpreter",
- -1));
+ TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "SAFE", "CURSOR_FILE", NULL);
cursorPtr = NULL;
goto cleanup;
@@ -432,7 +432,7 @@ CreateCursorFromTableOrFile(
goto cleanup;
}
- source = XCreateBitmapFromData(display, drawable, data, width,height);
+ source = XCreateBitmapFromData(display, drawable, data, (unsigned)width, (unsigned)height);
ckfree(data);
} else {
if (TkReadBitmapFile(display, drawable, &argv[0][1],
@@ -530,8 +530,8 @@ CreateCursorFromTableOrFile(
goto cleanup;
}
- mask = XCreateBitmapFromData(display, drawable, data, maskWidth,
- maskHeight);
+ mask = XCreateBitmapFromData(display, drawable, data, (unsigned)maskWidth,
+ (unsigned)maskHeight);
ckfree(data);
} else {
diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c
index 1d4662b..e36ce35 100644
--- a/unix/tkUnixEmbed.c
+++ b/unix/tkUnixEmbed.c
@@ -111,7 +111,7 @@ Tk_UseWindow(
if (winPtr->window != None) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "can't modify container after widget is created", -1));
+ "can't modify container after widget is created", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "EMBED", "POST_CREATE", NULL);
return TCL_ERROR;
}
diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c
index f54a445..c595fbb 100644
--- a/unix/tkUnixKey.c
+++ b/unix/tkUnixKey.c
@@ -133,8 +133,8 @@ TkpGetString(
#if X_HAVE_UTF8_STRING
Tcl_DStringSetLength(dsPtr, TCL_DSTRING_STATIC_SIZE-1);
- len = Xutf8LookupString(winPtr->inputContext, &eventPtr->xkey,
- Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr),
+ len = (Tcl_Size)Xutf8LookupString(winPtr->inputContext, &eventPtr->xkey,
+ Tcl_DStringValue(dsPtr), (int)Tcl_DStringLength(dsPtr),
&kePtr->keysym, &status);
if (status == XBufferOverflow) {
@@ -143,8 +143,8 @@ TkpGetString(
*/
Tcl_DStringSetLength(dsPtr, len);
- len = Xutf8LookupString(winPtr->inputContext, &eventPtr->xkey,
- Tcl_DStringValue(dsPtr), Tcl_DStringLength(dsPtr),
+ len =(Tcl_Size) Xutf8LookupString(winPtr->inputContext, &eventPtr->xkey,
+ Tcl_DStringValue(dsPtr), (int)Tcl_DStringLength(dsPtr),
&kePtr->keysym, &status);
}
if ((status != XLookupChars) && (status != XLookupBoth)) {
@@ -191,7 +191,7 @@ TkpGetString(
Tcl_DStringInit(&buf);
Tcl_DStringSetLength(&buf, TCL_DSTRING_STATIC_SIZE-1);
- len = XLookupString(&eventPtr->xkey, Tcl_DStringValue(&buf),
+ len = (Tcl_Size)XLookupString(&eventPtr->xkey, Tcl_DStringValue(&buf),
TCL_DSTRING_STATIC_SIZE, &kePtr->keysym, 0);
Tcl_DStringValue(&buf)[len] = '\0';
@@ -421,7 +421,8 @@ TkpInitKeymapInfo(
XModifierKeymap *modMapPtr;
KeyCode *codePtr;
KeySym keysym;
- int count, i, j, max, arraySize;
+ int count, i, max;
+ Tcl_Size j, arraySize;
#define KEYCODE_ARRAY_SIZE 20
dispPtr->bindInfoStale = 0;
diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c
index 5bb82f1..27cbef4 100644
--- a/unix/tkUnixMenubu.c
+++ b/unix/tkUnixMenubu.c
@@ -369,7 +369,7 @@ TkpComputeMenuButtonGeometry(
Tk_FreeTextLayout(mbPtr->textLayout);
mbPtr->textLayout = Tk_ComputeTextLayout(mbPtr->tkfont, mbPtr->text,
- -1, mbPtr->wrapLength, mbPtr->justify, 0, &mbPtr->textWidth,
+ TCL_INDEX_NONE, mbPtr->wrapLength, mbPtr->justify, 0, &mbPtr->textWidth,
&mbPtr->textHeight);
txtWidth = mbPtr->textWidth;
txtHeight = mbPtr->textHeight;
diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c
index 8ccb998..baec088 100644
--- a/unix/tkUnixScale.c
+++ b/unix/tkUnixScale.c
@@ -268,7 +268,7 @@ DisplayVerticalValue(
const char *format) /* Format string to use for the value */
{
Tk_Window tkwin = scalePtr->tkwin;
- int y, width, length;
+ int y, width;
char valueString[TCL_DOUBLE_SPACE];
Tk_FontMetrics fm;
@@ -277,7 +277,7 @@ DisplayVerticalValue(
if (snprintf(valueString, TCL_DOUBLE_SPACE, format, value) < 0) {
valueString[TCL_DOUBLE_SPACE - 1] = '\0';
}
- length = (int) strlen(valueString);
+ Tcl_Size length = strlen(valueString);
width = Tk_TextWidth(scalePtr->tkfont, valueString, length);
/*
@@ -491,7 +491,7 @@ DisplayHorizontalValue(
const char *format) /* Format string to use for the value */
{
Tk_Window tkwin = scalePtr->tkwin;
- int x, y, length, width;
+ int x, y, width;
char valueString[TCL_DOUBLE_SPACE];
Tk_FontMetrics fm;
@@ -501,7 +501,7 @@ DisplayHorizontalValue(
if (snprintf(valueString, TCL_DOUBLE_SPACE, format, value) < 0) {
valueString[TCL_DOUBLE_SPACE - 1] = '\0';
}
- length = (int) strlen(valueString);
+ Tcl_Size length = strlen(valueString);
width = Tk_TextWidth(scalePtr->tkfont, valueString, length);
/*