summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-03-04 21:52:10 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-03-04 21:52:10 (GMT)
commitc565904256ce552372be8e3f3171082bb0cf51f7 (patch)
treec44d1cb87ddb9ee27228b47fac1d2dd48b947de2 /macosx
parent5a03048c707ee966457a12a6901c488012ecde2c (diff)
downloadtk-c565904256ce552372be8e3f3171082bb0cf51f7.zip
tk-c565904256ce552372be8e3f3171082bb0cf51f7.tar.gz
tk-c565904256ce552372be8e3f3171082bb0cf51f7.tar.bz2
More serious elimination of -Wconversion C warnings
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXBitmap.c15
-rw-r--r--macosx/tkMacOSXButton.c6
-rw-r--r--macosx/tkMacOSXClipboard.c2
-rw-r--r--macosx/tkMacOSXColor.c41
-rw-r--r--macosx/tkMacOSXColor.h4
-rw-r--r--macosx/tkMacOSXCursor.c2
-rw-r--r--macosx/tkMacOSXDialog.c63
-rw-r--r--macosx/tkMacOSXDraw.c10
-rw-r--r--macosx/tkMacOSXEmbed.c6
-rw-r--r--macosx/tkMacOSXEntry.c6
-rw-r--r--macosx/tkMacOSXFont.c27
-rw-r--r--macosx/tkMacOSXHLEvents.c22
-rw-r--r--macosx/tkMacOSXImage.c12
-rw-r--r--macosx/tkMacOSXInit.c18
-rw-r--r--macosx/tkMacOSXMenu.c26
-rw-r--r--macosx/tkMacOSXMenubutton.c2
-rw-r--r--macosx/tkMacOSXMenus.c8
-rw-r--r--macosx/tkMacOSXPrint.c2
-rw-r--r--macosx/tkMacOSXScale.c8
-rw-r--r--macosx/tkMacOSXSend.c7
-rw-r--r--macosx/tkMacOSXWindowEvent.c6
-rw-r--r--macosx/tkMacOSXWm.c63
-rw-r--r--macosx/tkMacOSXXStubs.c6
23 files changed, 185 insertions, 177 deletions
diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c
index e4cbcdf..0a15d66 100644
--- a/macosx/tkMacOSXBitmap.c
+++ b/macosx/tkMacOSXBitmap.c
@@ -136,7 +136,7 @@ PixmapFromImage(
TkMacOSXDrawingContext dc;
Pixmap pixmap;
- pixmap = Tk_GetPixmap(display, None, size.width, size.height, 0);
+ pixmap = Tk_GetPixmap(display, None, (int)size.width, (int)size.height, 0);
if (TkMacOSXSetupDrawingContext(pixmap, NULL, &dc)) {
if (dc.context) {
CGAffineTransform t = { .a = 1, .b = 0, .c = 0, .d = -1,
@@ -307,8 +307,8 @@ TkpGetNativeAppBitmap(
}
}
if (image) {
- *width = size.width;
- *height = size.height;
+ *width = (int)size.width;
+ *height = (int)size.height;
pixmap = PixmapFromImage(display, image, NSSizeToCGSize(size));
} else if (name) {
/*
@@ -350,7 +350,8 @@ TkMacOSXIconBitmapObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_HashEntry *hPtr;
- int i = 1, len, isNew, result = TCL_ERROR;
+ int isNew, result = TCL_ERROR;
+ Tcl_Size i = 1, len;
const char *name, *value;
IconBitmap ib, *iconBitmap;
@@ -362,7 +363,7 @@ TkMacOSXIconBitmapObjCmd(
}
name = Tcl_GetStringFromObj(objv[i++], &len);
if (!len) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("empty bitmap name", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("empty bitmap name", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "MACBITMAP", "BAD", NULL);
goto end;
}
@@ -378,7 +379,7 @@ TkMacOSXIconBitmapObjCmd(
}
value = Tcl_GetStringFromObj(objv[i++], &len);
if (!len) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("empty bitmap value", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("empty bitmap value", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "MACBITMAP", "EMPTY", NULL);
goto end;
}
@@ -393,7 +394,7 @@ TkMacOSXIconBitmapObjCmd(
Tcl_FreeEncoding(encoding);
if (len > 4) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "invalid bitmap value", -1));
+ "invalid bitmap value", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "MACBITMAP", "INVALID", NULL);
goto end;
}
diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c
index 09ff17b..06e4593 100644
--- a/macosx/tkMacOSXButton.c
+++ b/macosx/tkMacOSXButton.c
@@ -316,7 +316,7 @@ TkpComputeButtonGeometry(
if (haveImage == 0 || butPtr->compound != COMPOUND_NONE) {
Tk_FreeTextLayout(butPtr->textLayout);
butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont,
- text, -1, butPtr->wrapLength, butPtr->justify, 0,
+ text, TCL_INDEX_NONE, butPtr->wrapLength, butPtr->justify, 0,
&butPtr->textWidth, &butPtr->textHeight);
txtWidth = butPtr->textWidth + 2*butPtr->padX;
@@ -409,10 +409,10 @@ TkpComputeButtonGeometry(
tmpRect = CGRectMake(0, 0, width + 2*HI_PADX, height + 2*HI_PADY);
HIThemeGetButtonContentBounds(&tmpRect, &mbPtr->drawinfo, &contBounds);
if (height < contBounds.size.height) {
- height = contBounds.size.height;
+ height = (int)contBounds.size.height;
}
if (width < contBounds.size.width) {
- width = contBounds.size.width;
+ width = (int)contBounds.size.width;
}
height += 2*HI_PADY;
width += 2*HI_PADX;
diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c
index 41887f4..c5df750 100644
--- a/macosx/tkMacOSXClipboard.c
+++ b/macosx/tkMacOSXClipboard.c
@@ -37,7 +37,7 @@ static Tk_Window clipboardOwner = NULL;
cbPtr; cbPtr = cbPtr->nextPtr) {
NSString *s = [[TKNSString alloc]
initWithTclUtfBytes:cbPtr->buffer
- length:cbPtr->length];
+ length:(NSUInteger)cbPtr->length];
[string appendString:s];
[s release];
}
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index e3a271c..15cf3df 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -20,11 +20,11 @@
#include "tkMacOSXColor.h"
static Tcl_HashTable systemColors;
-static int numSystemColors;
-static int rgbColorIndex;
-static int controlAccentIndex;
-static int selectedTabTextIndex;
-static int pressedButtonTextIndex;
+static size_t numSystemColors;
+static size_t rgbColorIndex;
+static size_t controlAccentIndex;
+static size_t selectedTabTextIndex;
+static size_t pressedButtonTextIndex;
static Bool useFakeAccentColor = NO;
static SystemColorDatum **systemColorIndex;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
@@ -43,7 +43,8 @@ void initColorTable()
SystemColorDatum *entry, *oldEntry;
Tcl_HashSearch search;
Tcl_HashEntry *hPtr;
- int newPtr, index = 0;
+ int newPtr;
+ size_t index = 0;
NSColorList *systemColorList = [NSColorList colorListNamed:@"System"];
NSString *key;
@@ -93,13 +94,13 @@ void initColorTable()
*/
for (key in [systemColorList allKeys]) {
- int length = [key lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
+ NSUInteger length = [key lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
char *name;
entry = (SystemColorDatum *)ckalloc(sizeof(SystemColorDatum));
bzero(entry, sizeof(SystemColorDatum));
name = (char *)ckalloc(length + 1);
strcpy(name, key.UTF8String);
- name[0] = toupper(name[0]);
+ name[0] = (char)toupper(UCHAR(name[0]));
if (!strcmp(name, "WindowBackgroundColor")) {
/*
@@ -185,9 +186,9 @@ TkMacOSXRGBPixel(
{
MacPixel p = {0};
p.pixel.colortype = rgbColor;
- p.pixel.value = ((red & 0xff) << 16) |
+ p.pixel.value = (unsigned int)(((red & 0xff) << 16) |
((green & 0xff) << 8) |
- (blue & 0xff);
+ (blue & 0xff));
return p.ulong;
}
@@ -243,7 +244,7 @@ GetEntryFromPixel(
unsigned long pixel)
{
MacPixel p = {0};
- int index = rgbColorIndex;
+ size_t index = rgbColorIndex;
p.ulong = pixel;
if (p.pixel.colortype != rgbColor) {
@@ -503,7 +504,7 @@ TkMacOSXGetNSColor(
if (cgColor) {
nsColor = [NSColor colorWithColorSpace:sRGB
components:CGColorGetComponents(cgColor)
- count:CGColorGetNumberOfComponents(cgColor)];
+ count:(NSInteger)CGColorGetNumberOfComponents(cgColor)];
CGColorRelease(cgColor);
}
return nsColor;
@@ -621,7 +622,7 @@ TkpGetColor(
CGColorRef c = NULL;
p.pixel.colortype = entry->type;
- p.pixel.value = entry->index;
+ p.pixel.value = (unsigned int)entry->index;
color.pixel = p.ulong;
if (entry->type == semantic) {
CGFloat rgba[4];
@@ -659,9 +660,9 @@ TkpGetColor(
#else
GetRGBA(entry, p.ulong, rgba);
#endif
- color.red = rgba[0] * 65535.0;
- color.green = rgba[1] * 65535.0;
- color.blue = rgba[2] * 65535.0;
+ color.red = (unsigned short)(rgba[0] * 65535.0);
+ color.green = (unsigned short)(rgba[1] * 65535.0);
+ color.blue = (unsigned short)(rgba[2] * 65535.0);
goto validXColor;
} else if (SetCGColorComponents(entry, 0, &c)) {
const size_t n = CGColorGetNumberOfComponents(c);
@@ -669,12 +670,12 @@ TkpGetColor(
switch (n) {
case 4:
- color.red = rgba[0] * 65535.0;
- color.green = rgba[1] * 65535.0;
- color.blue = rgba[2] * 65535.0;
+ color.red = (unsigned short)(rgba[0] * 65535.0);
+ color.green = (unsigned short)(rgba[1] * 65535.0);
+ color.blue = (unsigned short)(rgba[2] * 65535.0);
break;
case 2:
- color.red = color.green = color.blue = rgba[0] * 65535.0;
+ color.red = color.green = color.blue = (unsigned short)(rgba[0] * 65535.0);
break;
default:
Tcl_Panic("CGColor with %d components", (int) n);
diff --git a/macosx/tkMacOSXColor.h b/macosx/tkMacOSXColor.h
index 7e82cbd..77f1558 100644
--- a/macosx/tkMacOSXColor.h
+++ b/macosx/tkMacOSXColor.h
@@ -71,10 +71,10 @@ enum macColormap {
typedef struct {
const char *name;
enum colorType type;
- int value;
+ ThemeBrush value;
const char *macName;
/* Fields below are filled in after or during construction of the hash table. */
- int index;
+ size_t index;
NSString *selector;
} SystemColorDatum;
diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c
index 3155f36..f235c75 100644
--- a/macosx/tkMacOSXCursor.c
+++ b/macosx/tkMacOSXCursor.c
@@ -231,7 +231,7 @@ FindCursorByName(
macCursorPtr->type = IMAGEPATH;
path = [NSString stringWithUTF8String:&name[1]];
} else {
- Tcl_Obj *strPtr = Tcl_NewStringObj(name, -1);
+ Tcl_Obj *strPtr = Tcl_NewStringObj(name, TCL_INDEX_NONE);
int idx;
result = Tcl_GetIndexFromObjStruct(NULL, strPtr, cursorNames,
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index c0c1181..da9e101 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -255,14 +255,15 @@ getFileURL(
resultObj = Tcl_NewListObj(0, NULL);
for (NSURL *url in [(NSOpenPanel*)panel URLs]) {
Tcl_ListObjAppendElement(callbackInfo->interp, resultObj,
- Tcl_NewStringObj([[url path] UTF8String], -1));
+ Tcl_NewStringObj([[url path] UTF8String], TCL_INDEX_NONE));
}
} else {
- resultObj = Tcl_NewStringObj([[[panel URL]path] UTF8String], -1);
+ resultObj = Tcl_NewStringObj([[[panel URL]path] UTF8String], TCL_INDEX_NONE);
}
if (callbackInfo->cmdObj) {
Tcl_Obj **objv, **tmpv;
- Tcl_Size objc, result = Tcl_ListObjGetElements(callbackInfo->interp,
+ Tcl_Size objc;
+ int result = Tcl_ListObjGetElements(callbackInfo->interp,
callbackInfo->cmdObj, &objc, &objv);
if (result == TCL_OK && objc) {
@@ -290,11 +291,12 @@ getFileURL(
if (returnCode >= NSAlertFirstButtonReturn) {
Tcl_Obj *resultObj = Tcl_NewStringObj(alertButtonStrings[
alertNativeButtonIndexAndTypeToButtonIndex[callbackInfo->
- typeIndex][returnCode - NSAlertFirstButtonReturn]], -1);
+ typeIndex][returnCode - NSAlertFirstButtonReturn]], TCL_INDEX_NONE);
if (callbackInfo->cmdObj) {
Tcl_Obj **objv, **tmpv;
- Tcl_Size objc, result = Tcl_ListObjGetElements(callbackInfo->interp,
+ Tcl_Size objc;
+ int result = Tcl_ListObjGetElements(callbackInfo->interp,
callbackInfo->cmdObj, &objc, &objv);
if (result == TCL_OK && objc) {
@@ -316,7 +318,7 @@ getFileURL(
- (void)selectFormat:(id)sender {
NSPopUpButton *button = (NSPopUpButton *)sender;
- filterInfo.fileTypeIndex = [button indexOfSelectedItem];
+ filterInfo.fileTypeIndex = (NSUInteger)[button indexOfSelectedItem];
if ([[filterInfo.fileTypeAllowsAll objectAtIndex:filterInfo.fileTypeIndex] boolValue]) {
[openpanel setAllowsOtherFileTypes:YES];
@@ -340,7 +342,7 @@ getFileURL(
- (void)saveFormat:(id)sender {
NSPopUpButton *button = (NSPopUpButton *)sender;
- filterInfo.fileTypeIndex = [button indexOfSelectedItem];
+ filterInfo.fileTypeIndex = (NSUInteger)[button indexOfSelectedItem];
if ([[filterInfo.fileTypeAllowsAll objectAtIndex:filterInfo.fileTypeIndex] boolValue]) {
[savepanel setAllowsOtherFileTypes:YES];
@@ -486,7 +488,7 @@ Tk_ChooseColorObjCmd(
[colorPanel setShowsAlpha: NO];
[colorPanel _setUseModalAppearance:YES];
if (title) {
- NSString *s = [[TKNSString alloc] initWithTclUtfBytes:title length:-1];
+ NSString *s = [[TKNSString alloc] initWithTclUtfBytes:title length:TCL_INDEX_NONE];
[colorPanel setTitle:s];
[s release];
@@ -558,7 +560,7 @@ parseFileFilters(
if (filterInfo.doFileTypes) {
for (FileFilter *filterPtr = fl.filters; filterPtr;
filterPtr = filterPtr->next) {
- NSString *name = [[TKNSString alloc] initWithTclUtfBytes: filterPtr->name length:-1];
+ NSString *name = [[TKNSString alloc] initWithTclUtfBytes: filterPtr->name length:TCL_INDEX_NONE];
[filterInfo.fileTypeNames addObject:name];
[name release];
@@ -576,7 +578,7 @@ parseFileFilters(
str++;
}
if (*str) {
- NSString *extension = [[TKNSString alloc] initWithTclUtfBytes:str length:-1];
+ NSString *extension = [[TKNSString alloc] initWithTclUtfBytes:str length:TCL_INDEX_NONE];
if (![filterInfo.allowedExtensions containsObject:extension]) {
[filterInfo.allowedExtensions addObject:extension];
}
@@ -629,7 +631,7 @@ parseFileFilters(
const char *selectedFileType =
Tcl_GetString(selectedFileTypeObj);
NSString *selectedFileTypeStr =
- [[TKNSString alloc] initWithTclUtfBytes:selectedFileType length:-1];
+ [[TKNSString alloc] initWithTclUtfBytes:selectedFileType length:TCL_INDEX_NONE];
NSUInteger index =
[filterInfo.fileTypeNames indexOfObject:selectedFileTypeStr];
@@ -649,7 +651,7 @@ parseFileFilters(
static bool
filterCompatible(
NSString *extension,
- int filterIndex)
+ NSUInteger filterIndex)
{
NSMutableArray *allowedExtensions =
[filterInfo.fileTypeExtensions objectAtIndex: filterIndex];
@@ -691,7 +693,8 @@ Tk_GetOpenFileObjCmd(
Tk_Window tkwin = (Tk_Window)clientData;
char *str;
int i, result = TCL_ERROR, haveParentOption = 0;
- int index, len, multiple = 0;
+ int index, multiple = 0;
+ Tcl_Size len;
Tcl_Obj *cmdObj = NULL, *typeVariablePtr = NULL, *fileTypesPtr = NULL;
NSString *directory = nil, *filename = nil;
NSString *message = nil, *title = nil;
@@ -789,7 +792,7 @@ Tk_GetOpenFileObjCmd(
[message release];
}
- [openpanel setAllowsMultipleSelection:multiple];
+ [openpanel setAllowsMultipleSelection:multiple != 0];
if (parseFileFilters(interp, fileTypesPtr, typeVariablePtr) != TCL_OK) {
goto end;
@@ -820,7 +823,7 @@ Tk_GetOpenFileObjCmd(
* and open the accessory view.
*/
- [popupButton selectItemAtIndex:filterInfo.fileTypeIndex];
+ [popupButton selectItemAtIndex:(NSInteger)filterInfo.fileTypeIndex];
/*
* On OSX > 10.11, the options are not visible by default. Ergo
@@ -928,7 +931,7 @@ Tk_GetOpenFileObjCmd(
}
}
Tcl_ObjSetVar2(interp, typeVariablePtr, NULL,
- Tcl_NewStringObj([selectedFilter UTF8String], -1),
+ Tcl_NewStringObj([selectedFilter UTF8String], TCL_INDEX_NONE),
TCL_GLOBAL_ONLY);
}
end:
@@ -963,7 +966,8 @@ Tk_GetSaveFileObjCmd(
char *str;
int i, result = TCL_ERROR, haveParentOption = 0;
int confirmOverwrite = 1;
- int index, len;
+ int index;
+ Tcl_Size len;
Tcl_Obj *cmdObj = NULL, *typeVariablePtr = NULL, *fileTypesPtr = NULL;
NSString *directory = nil, *filename = nil, *defaultType = nil;
NSString *message = nil, *title = nil;
@@ -1093,7 +1097,7 @@ Tk_GetSaveFileObjCmd(
initWithFrame:NSMakeRect(50.0, 2, 340, 22.0) pullsDown:NO];
[popupButton addItemsWithTitles:filterInfo.fileTypeLabels];
- [popupButton selectItemAtIndex:filterInfo.fileTypeIndex];
+ [popupButton selectItemAtIndex:(NSInteger)filterInfo.fileTypeIndex];
[popupButton setTarget:NSApp];
[popupButton setAction:@selector(saveFormat:)];
[accessoryView addSubview:label];
@@ -1168,7 +1172,7 @@ Tk_GetSaveFileObjCmd(
NSString *selectedFilter =
[filterInfo.fileTypeNames objectAtIndex:filterInfo.fileTypeIndex];
Tcl_ObjSetVar2(interp, typeVariablePtr, NULL,
- Tcl_NewStringObj([selectedFilter UTF8String], -1),
+ Tcl_NewStringObj([selectedFilter UTF8String], TCL_INDEX_NONE),
TCL_GLOBAL_ONLY);
}
@@ -1204,7 +1208,8 @@ Tk_ChooseDirectoryObjCmd(
Tk_Window tkwin = (Tk_Window)clientData;
char *str;
int i, result = TCL_ERROR, haveParentOption = 0;
- int index, len, mustexist = 0;
+ int index, mustexist = 0;
+ Tcl_Size len;
Tcl_Obj *cmdObj = NULL;
NSString *directory = nil;
NSString *message, *title;
@@ -1421,7 +1426,7 @@ Tk_MessageBoxObjCmd(
case ALERT_DETAIL:
str = Tcl_GetString(objv[i + 1]);
message = [[TKNSString alloc] initWithTclUtfBytes:
- str length:-1];
+ str length:TCL_INDEX_NONE];
[alert setInformativeText:message];
[message release];
break;
@@ -1436,7 +1441,7 @@ Tk_MessageBoxObjCmd(
case ALERT_MESSAGE:
str = Tcl_GetString(objv[i + 1]);
message = [[TKNSString alloc] initWithTclUtfBytes:
- str length:-1];
+ str length:TCL_INDEX_NONE];
[alert setMessageText:message];
[message release];
break;
@@ -1453,7 +1458,7 @@ Tk_MessageBoxObjCmd(
case ALERT_TITLE:
str = Tcl_GetString(objv[i + 1]);
title = [[TKNSString alloc] initWithTclUtfBytes:
- str length:-1];
+ str length:TCL_INDEX_NONE];
[[alert window] setTitle:title];
[title release];
break;
@@ -1489,7 +1494,7 @@ Tk_MessageBoxObjCmd(
alertButtonIndexAndTypeToNativeButtonIndex[typeIndex][index];
if (!defaultNativeButtonIndex) {
Tcl_SetObjResult(interp,
- Tcl_NewStringObj("Illegal default option", -1));
+ Tcl_NewStringObj("Illegal default option", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "MSGBOX", "DEFAULT", NULL);
goto end;
}
@@ -1510,7 +1515,7 @@ Tk_MessageBoxObjCmd(
}
}
[[buttons objectAtIndex: [buttons count]-1] setKeyEquivalent: @"\033"];
- [[buttons objectAtIndex: defaultNativeButtonIndex-1]
+ [[buttons objectAtIndex: (NSUInteger)(defaultNativeButtonIndex-1)]
setKeyEquivalent: @"\r"];
if (cmdObj) {
if (Tcl_IsShared(cmdObj)) {
@@ -1755,7 +1760,7 @@ FontchooserCget(
case FontchooserParent:
if (fcdPtr->parent != NULL) {
resObj = Tcl_NewStringObj(
- ((TkWindow *)fcdPtr->parent)->pathName, -1);
+ ((TkWindow *)fcdPtr->parent)->pathName, TCL_INDEX_NONE);
} else {
resObj = Tcl_NewStringObj(".", 1);
}
@@ -1830,8 +1835,8 @@ FontchooserConfigureCmd(
Tcl_Obj *dictObj = Tcl_NewDictObj();
for (i = 0; r == TCL_OK && fontchooserOptionStrings[i] != NULL; ++i) {
- keyObj = Tcl_NewStringObj(fontchooserOptionStrings[i], -1);
- valueObj = FontchooserCget(fcdPtr, i);
+ keyObj = Tcl_NewStringObj(fontchooserOptionStrings[i], TCL_INDEX_NONE);
+ valueObj = FontchooserCget(fcdPtr, (int)i);
r = Tcl_DictObjPut(interp, dictObj, keyObj, valueObj);
}
if (r == TCL_OK) {
@@ -1866,7 +1871,7 @@ FontchooserConfigureCmd(
const char *msg = "cannot change read-only option "
"\"-visible\": use the show or hide command";
- Tcl_SetObjResult(interp, Tcl_NewStringObj(msg, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(msg, TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "FONTDIALOG", "READONLY", NULL);
return TCL_ERROR;
}
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index ea1615b..f0f5d1d 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -175,7 +175,7 @@ TkMacOSXGetNSImageFromBitmap(
gc->background = transparentColor;
XSetClipOrigin(display, gc, 0, 0);
- XCopyPlane(display, bitmap, pixmap, gc, 0, 0, width, height, 0, 0, 1);
+ XCopyPlane(display, bitmap, pixmap, gc, 0, 0, (unsigned)width, (unsigned)height, 0, 0, 1);
gc->background = origBackground;
nsImage = CreateNSImageFromPixmap(pixmap, width, height);
Tk_FreePixmap(display, pixmap);
@@ -270,11 +270,11 @@ Tk_MacOSXGetCGContextForDrawable(
}
bytesPerRow = ((size_t)
macDraw->size.width * bitsPerPixel + 127) >> 3 & ~15;
- len = macDraw->size.height * bytesPerRow;
+ len = (size_t)(macDraw->size.height * bytesPerRow);
data = (char *)ckalloc(len);
bzero(data, len);
- macDraw->context = CGBitmapContextCreate(data, macDraw->size.width,
- macDraw->size.height, bitsPerComponent, bytesPerRow,
+ macDraw->context = CGBitmapContextCreate(data, (unsigned)macDraw->size.width,
+ (unsigned)macDraw->size.height, bitsPerComponent, bytesPerRow,
colorspace, bitmapInfo);
if (macDraw->context) {
CGContextClearRect(macDraw->context, bounds);
@@ -1415,7 +1415,7 @@ TkMacOSXSetupDrawingContext(
CGContextSetShouldAntialias(dc.context, shouldAntialias);
CGContextSetLineWidth(dc.context, w);
if (gc->line_style != LineSolid) {
- int num = 0;
+ size_t num = 0;
char *p = &gc->dashes;
CGFloat dashOffset = gc->dash_offset;
dashOffset -= (gc->line_width % 2) ? 0.5 : 0.0;
diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c
index 1e511c5..0002de9 100644
--- a/macosx/tkMacOSXEmbed.c
+++ b/macosx/tkMacOSXEmbed.c
@@ -214,7 +214,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;
}
@@ -869,8 +869,8 @@ EmbedStructureProc(
errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1,
-1, -1, NULL, NULL);
Tk_MoveResizeWindow((Tk_Window)containerPtr->embeddedPtr, 0, 0,
- (unsigned) Tk_Width((Tk_Window)containerPtr->parentPtr),
- (unsigned) Tk_Height((Tk_Window)containerPtr->parentPtr));
+ Tk_Width((Tk_Window)containerPtr->parentPtr),
+ Tk_Height((Tk_Window)containerPtr->parentPtr));
Tk_DeleteErrorHandler(errHandler);
}
} else if (eventPtr->type == DestroyNotify) {
diff --git a/macosx/tkMacOSXEntry.c b/macosx/tkMacOSXEntry.c
index 66c4bce..286a7fe 100644
--- a/macosx/tkMacOSXEntry.c
+++ b/macosx/tkMacOSXEntry.c
@@ -259,10 +259,10 @@ TkpDrawSpinboxButtons(
*/
bgGC = Tk_GCForColor(sbPtr->entry.highlightBgColorPtr, d);
- rects[0].x = Tk_Width(tkwin) - incDecWidth - 1;
+ rects[0].x = (short)(Tk_Width(tkwin) - incDecWidth - 1);
rects[0].y = 0;
- rects[0].width = incDecWidth + 1;
- rects[0].height = Tk_Height(tkwin);
+ rects[0].width = (unsigned short)(incDecWidth + 1);
+ rects[0].height = (unsigned short)Tk_Height(tkwin);
XFillRectangles(Tk_Display(tkwin), d, bgGC, rects, 1);
if (!TkMacOSXSetupDrawingContext(d, NULL, &dc)) {
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index 0c5cd67..69ef797 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -47,7 +47,7 @@ typedef struct {
#define MENUITEMFONT_NAME "menu"
struct SystemFontMapEntry {
- const ThemeFontID id;
+ ThemeFontID id;
const char *systemName;
const char *tkName;
const char *tkName1;
@@ -74,7 +74,7 @@ static const struct SystemFontMapEntry systemFontMap[] = {
ThemeFont(MiniSystem, NULL, NULL),
{ kThemeSystemFontDetail, "systemDetailSystemFont", NULL, NULL },
{ kThemeSystemFontDetailEmphasized, "systemDetailEmphasizedSystemFont", NULL, NULL },
- { -1, NULL, NULL, NULL }
+ { (ThemeFontID)-1, NULL, NULL, NULL }
};
#undef ThemeFont
@@ -166,7 +166,7 @@ static int CreateNamedSystemFont(Tcl_Interp *interp,
for (index = 0; index < [_string length]; index++) {
p += Tcl_UniCharToUtf([_string characterAtIndex: index], p);
}
- Tcl_DStringSetLength(&_ds, p - Tcl_DStringValue(&_ds));
+ Tcl_DStringSetLength(&_ds, (Tcl_Size)(p - Tcl_DStringValue(&_ds)));
}
return _ds;
}
@@ -245,7 +245,7 @@ FindNSFont(
NSString *family;
if (familyName) {
- family = [[[TKNSString alloc] initWithTclUtfBytes:familyName length:-1] autorelease];
+ family = [[[TKNSString alloc] initWithTclUtfBytes:familyName length:TCL_INDEX_NONE] autorelease];
} else {
family = [defaultFont familyName];
}
@@ -350,9 +350,9 @@ InitFont(
nsFont = [nsFont screenFontWithRenderingMode:renderingMode];
GetTkFontAttributesForNSFont(nsFont, faPtr);
fmPtr = &fontPtr->font.fm;
- fmPtr->ascent = floor([nsFont ascender] + [nsFont leading] + 0.5);
- fmPtr->descent = floor(-[nsFont descender] + 0.5);
- fmPtr->maxWidth = [nsFont maximumAdvancement].width;
+ fmPtr->ascent = (int)floor([nsFont ascender] + [nsFont leading] + 0.5);
+ fmPtr->descent = (int)floor(-[nsFont descender] + 0.5);
+ fmPtr->maxWidth = (int)[nsFont maximumAdvancement].width;
fmPtr->fixed = [nsFont isFixedPitch]; /* Does not work for all fonts */
/*
@@ -370,8 +370,8 @@ InitFont(
kern = [nsFont advancementForGlyph:glyphs[2]].width -
[fontPtr->nsFont advancementForGlyph:glyphs[2]].width;
}
- descent = floor(-bounds.origin.y + 0.5);
- ascent = floor(bounds.size.height + bounds.origin.y + 0.5);
+ descent = (int)floor(-bounds.origin.y + 0.5);
+ ascent = (int)floor(bounds.size.height + bounds.origin.y + 0.5);
if (ascent > fmPtr->ascent) {
fmPtr->ascent = ascent;
}
@@ -451,8 +451,7 @@ startOfClusterObjCmd(
{
TKNSString *S;
const char *stringArg;
- int numBytes;
- Tcl_Size index;
+ Tcl_Size numBytes, index;
if ((unsigned)(objc - 3) > 1) {
Tcl_WrongNumArgs(interp, 1 , objv, "str start ?locale?");
return TCL_ERROR;
@@ -805,7 +804,7 @@ TkpGetFontFamilies(
for (NSString *family in list) {
Tcl_ListObjAppendElement(NULL, resultPtr,
- Tcl_NewStringObj([family UTF8String], -1));
+ Tcl_NewStringObj([family UTF8String], TCL_INDEX_NONE));
}
Tcl_SetObjResult(interp, resultPtr);
}
@@ -845,7 +844,7 @@ TkpGetSubFonts(
if (family) {
Tcl_ListObjAppendElement(NULL, resultPtr,
- Tcl_NewStringObj([family UTF8String], -1));
+ Tcl_NewStringObj([family UTF8String], TCL_INDEX_NONE));
}
}
}
@@ -1441,7 +1440,7 @@ TkMacOSXFontDescriptionForNSFontAndNSFontAttributes(
id strikethrough = [nsAttributes objectForKey:
NSStrikethroughStyleAttributeName];
- objv[i++] = Tcl_NewStringObj(familyName, -1);
+ objv[i++] = Tcl_NewStringObj(familyName, TCL_INDEX_NONE);
objv[i++] = Tcl_NewWideIntObj((Tcl_WideInt)floor([nsFont pointSize] * FACTOR + 0.5));
#define S(s) Tcl_NewStringObj(STRINGIFY(s), (sizeof(STRINGIFY(s))-1))
objv[i++] = (traits & NSBoldFontMask) ? S(bold) : S(normal);
diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c
index 44047d5..af09f83 100644
--- a/macosx/tkMacOSXHLEvents.c
+++ b/macosx/tkMacOSXHLEvents.c
@@ -115,7 +115,7 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
if (_eventInterp &&
Tcl_FindCommand(_eventInterp, "::tk::mac::OpenApplication", NULL, 0)){
int code = Tcl_EvalEx(_eventInterp, "::tk::mac::OpenApplication",
- -1, TCL_EVAL_GLOBAL);
+ TCL_INDEX_NONE, TCL_EVAL_GLOBAL);
if (code != TCL_OK) {
Tcl_BackgroundException(_eventInterp, code);
}
@@ -132,7 +132,7 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
if (_eventInterp && Tcl_FindCommand(_eventInterp,
"::tk::mac::ReopenApplication", NULL, 0)) {
int code = Tcl_EvalEx(_eventInterp, "::tk::mac::ReopenApplication",
- -1, TCL_EVAL_GLOBAL);
+ TCL_INDEX_NONE, TCL_EVAL_GLOBAL);
if (code != TCL_OK){
Tcl_BackgroundException(_eventInterp, code);
}
@@ -148,7 +148,7 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
if (_eventInterp &&
Tcl_FindCommand(_eventInterp, "::tk::mac::ShowPreferences", NULL, 0)){
int code = Tcl_EvalEx(_eventInterp, "::tk::mac::ShowPreferences",
- -1, TCL_EVAL_GLOBAL);
+ TCL_INDEX_NONE, TCL_EVAL_GLOBAL);
if (code != TCL_OK) {
Tcl_BackgroundException(_eventInterp, code);
}
@@ -211,7 +211,7 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo));
Tcl_DString *openCommand = &AEInfo->command;
Tcl_DStringInit(openCommand);
- Tcl_DStringAppend(openCommand, openDocumentProc, -1);
+ Tcl_DStringAppend(openCommand, openDocumentProc, TCL_INDEX_NONE);
utf8 = Tcl_GetEncoding(NULL, "utf-8");
for (index = 1; index <= count; index++) {
@@ -227,7 +227,7 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
if (fileURL == nil) {
continue;
}
- (void)Tcl_ExternalToUtfDString(utf8, [[fileURL path] UTF8String], -1,
+ (void)Tcl_ExternalToUtfDString(utf8, [[fileURL path] UTF8String], TCL_INDEX_NONE,
&pathName);
Tcl_DStringAppendElement(openCommand, Tcl_DStringValue(&pathName));
Tcl_DStringFree(&pathName);
@@ -257,7 +257,7 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
(void)replyEvent;
Tcl_DStringInit(printCommand);
- Tcl_DStringAppend(printCommand, printDocProc, -1);
+ Tcl_DStringAppend(printCommand, printDocProc, TCL_INDEX_NONE);
Tcl_DStringAppendElement(printCommand, printFile);
AEInfo->interp = _eventInterp;
AEInfo->procedure = printDocProc;
@@ -319,7 +319,7 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo));
Tcl_DString *scriptFileCommand = &AEInfo->command;
Tcl_DStringInit(scriptFileCommand);
- Tcl_DStringAppend(scriptFileCommand, scriptFileProc, -1);
+ Tcl_DStringAppend(scriptFileCommand, scriptFileProc, TCL_INDEX_NONE);
Tcl_DStringAppendElement(scriptFileCommand, [[fileURL path] UTF8String]);
AEInfo->interp = _eventInterp;
AEInfo->procedure = scriptFileProc;
@@ -345,7 +345,7 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo));
Tcl_DString *scriptTextCommand = &AEInfo->command;
Tcl_DStringInit(scriptTextCommand);
- Tcl_DStringAppend(scriptTextCommand, scriptTextProc, -1);
+ Tcl_DStringAppend(scriptTextCommand, scriptTextProc, TCL_INDEX_NONE);
Tcl_DStringAppendElement(scriptTextCommand, data);
AEInfo->interp = _eventInterp;
AEInfo->procedure = scriptTextProc;
@@ -373,7 +373,7 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
(void)replyEvent;
Tcl_DStringInit(launchCommand);
- Tcl_DStringAppend(launchCommand, launchURLProc, -1);
+ Tcl_DStringAppend(launchCommand, launchURLProc, TCL_INDEX_NONE);
Tcl_DStringAppendElement(launchCommand, cURL);
AEInfo->interp = _eventInterp;
AEInfo->procedure = launchURLProc;
@@ -389,7 +389,7 @@ static const char getSdefProc[] = "::tk::mac::GetDynamicSdef";
(void)replyEvent;
Tcl_DStringInit(sdefCommand);
- Tcl_DStringAppend(sdefCommand, getSdefProc, -1);
+ Tcl_DStringAppend(sdefCommand, getSdefProc, TCL_INDEX_NONE);
AEInfo->interp = _eventInterp;
AEInfo->procedure = getSdefProc;
AEInfo->replyEvent = nil;
@@ -623,7 +623,7 @@ ReallyKillMe(
Tcl_Exit(0);
}
- int code = Tcl_EvalEx(interp, "::tk::mac::Quit", -1, TCL_EVAL_GLOBAL);
+ int code = Tcl_EvalEx(interp, "::tk::mac::Quit", TCL_INDEX_NONE, TCL_EVAL_GLOBAL);
if (code != TCL_OK) {
/*
diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c
index 36e686c..9169530 100644
--- a/macosx/tkMacOSXImage.c
+++ b/macosx/tkMacOSXImage.c
@@ -1232,7 +1232,7 @@ TkMacOSXNSImageConfigureModel(
int oldWidth = modelPtr->width, oldHeight = modelPtr->height;
if (asOption == NULL) {
- asOption = Tcl_NewStringObj("-as", -1);
+ asOption = Tcl_NewStringObj("-as", TCL_INDEX_NONE);
Tcl_IncrRefCount(asOption);
}
@@ -1248,7 +1248,7 @@ TkMacOSXNSImageConfigureModel(
}
if (modelPtr->source == NULL || modelPtr->source[0] == '0') {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("-source is required.", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("-source is required.", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "SYSTEM", "BAD_VALUE", NULL);
goto errorExit;
}
@@ -1259,7 +1259,7 @@ TkMacOSXNSImageConfigureModel(
0, &sourceInterpretation) != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"Unknown interpretation for source in -as option. "
- "Should be name, file, path, or filetype.", -1));
+ "Should be name, file, path, or filetype.", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "SYSTEM", "BAD_VALUE", NULL);
goto errorExit;
}
@@ -1320,18 +1320,18 @@ TkMacOSXNSImageConfigureModel(
case NAME_SOURCE:
Tcl_SetObjResult(interp, Tcl_NewStringObj("Unknown named NSImage.\n"
"Try omitting ImageName, "
- "e.g. use NSCaution for NSImageNameCaution.", -1));
+ "e.g. use NSCaution for NSImageNameCaution.", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "SYSTEM", "BAD_VALUE", NULL);
goto errorExit;
case FILE_SOURCE:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "Failed to load image file.\n", -1));
+ "Failed to load image file.\n", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "SYSTEM", "BAD_VALUE", NULL);
goto errorExit;
default:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"Unrecognized file type.\n"
- "If using a filename extension, do not include the dot.\n", -1));
+ "If using a filename extension, do not include the dot.\n", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "SYSTEM", "BAD_VALUE", NULL);
goto errorExit;
}
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index 8eb1fb6..039d1d1 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -258,8 +258,8 @@ static int TkMacOSVersionObjCmd(ClientData cd, Tcl_Interp *ip,
#else
NSOperatingSystemVersion systemVersion;
systemVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
- majorVersion = systemVersion.majorVersion;
- minorVersion = systemVersion.minorVersion;
+ majorVersion = (int)systemVersion.majorVersion;
+ minorVersion = (int)systemVersion.minorVersion;
#endif
if (majorVersion == 10 && minorVersion == 16) {
@@ -275,7 +275,7 @@ static int TkMacOSVersionObjCmd(ClientData cd, Tcl_Interp *ip,
struct utsname name;
char *endptr;
if (uname(&name) == 0) {
- majorVersion = strtol(name.release, &endptr, 10) - 9;
+ majorVersion = (int)strtol(name.release, &endptr, 10) - 9;
minorVersion = 0;
}
}
@@ -430,7 +430,7 @@ TCL_NORETURN void TkpExitProc(
if (doCleanup == YES) {
[(TKApplication *)NSApp superTerminate:nil]; /* Should not return. */
}
- exit((long)clientdata); /* Convince the compiler that we don't return. */
+ exit((int)PTR2INT(clientdata)); /* Convince the compiler that we don't return. */
}
#endif
@@ -715,7 +715,7 @@ TkMacOSXGetAppPathObjCmd(
*/
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- CFStringGetCStringPtr(appPath, CFStringGetSystemEncoding()), -1));
+ CFStringGetCStringPtr(appPath, CFStringGetSystemEncoding()), TCL_INDEX_NONE));
CFRelease(mainBundleURL);
CFRelease(appPath);
@@ -757,7 +757,7 @@ TkpGetAppName(
name = p+1;
}
}
- Tcl_DStringAppend(namePtr, name, -1);
+ Tcl_DStringAppend(namePtr, name, TCL_INDEX_NONE);
}
/*
@@ -822,9 +822,9 @@ TkpDisplayWarning(
Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
if (errChannel) {
- Tcl_WriteChars(errChannel, title, -1);
+ Tcl_WriteChars(errChannel, title, TCL_INDEX_NONE);
Tcl_WriteChars(errChannel, ": ", 2);
- Tcl_WriteChars(errChannel, msg, -1);
+ Tcl_WriteChars(errChannel, msg, TCL_INDEX_NONE);
Tcl_WriteChars(errChannel, "\n", 1);
}
}
@@ -865,7 +865,7 @@ TkMacOSXDefaultStartupScript(void)
if (CFURLGetFileSystemRepresentation(appMainURL, true,
(unsigned char *) startupScript, PATH_MAX)) {
- Tcl_SetStartupScript(Tcl_NewStringObj(startupScript,-1), NULL);
+ Tcl_SetStartupScript(Tcl_NewStringObj(startupScript, TCL_INDEX_NONE), NULL);
scriptFldrURL = CFURLCreateCopyDeletingLastPathComponent(NULL,
appMainURL);
if (scriptFldrURL != NULL) {
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index cd93592..076d825 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.c
@@ -174,7 +174,7 @@ TKBackgroundLoop *backgroundLoop = nil;
@interface TKMenu(TKMenuPrivate)
- (id) initWithTkMenu: (TkMenu *) tkMenu;
- (TkMenu *) tkMenu;
-- (int) tkIndexOfItem: (NSMenuItem *) menuItem;
+- (Tcl_Size) tkIndexOfItem: (NSMenuItem *) menuItem;
- (void) insertItem: (NSMenuItem *) newItem atTkIndex: (NSInteger) index;
@end
@@ -247,7 +247,7 @@ static Bool runMenuCommand = true;
- (id) initWithTkMenu: (TkMenu *) tkMenu
{
NSString *title = [[TKNSString alloc] initWithTclUtfBytes:
- Tk_PathName(tkMenu->tkwin) length:-1];
+ Tk_PathName(tkMenu->tkwin) length:TCL_INDEX_NONE];
self = [self initWithTitle:title];
[title release];
@@ -274,14 +274,14 @@ static Bool runMenuCommand = true;
return (TkMenu *)_tkMenu;
}
-- (int) tkIndexOfItem: (NSMenuItem *) menuItem
+- (Tcl_Size) tkIndexOfItem: (NSMenuItem *) menuItem
{
- return [self indexOfItem:menuItem] - _tkOffset;
+ return ((Tcl_Size)[self indexOfItem:menuItem] - (NSUInteger)_tkOffset);
}
- (void) insertItem: (NSMenuItem *) newItem atTkIndex: (NSInteger) index
{
- [super insertItem:newItem atIndex:index + _tkOffset];
+ [super insertItem:newItem atIndex:index + (NSInteger)_tkOffset];
_tkItemCount++;
}
@@ -1027,7 +1027,7 @@ TkpPostTearoffMenu(
int vRootX, vRootY, vRootWidth, vRootHeight;
int result;
- TkActivateMenuEntry(menuPtr, -1);
+ TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE);
TkRecomputeMenu(menuPtr);
result = TkPostCommand(menuPtr);
if (result != TCL_OK) {
@@ -1239,7 +1239,7 @@ CheckForSpecialMenu(
Tcl_DString ds;
Tcl_DStringInit(&ds);
- Tcl_DStringAppend(&ds, Tk_PathName(mainMenuPtr->tkwin), -1);
+ Tcl_DStringAppend(&ds, Tk_PathName(mainMenuPtr->tkwin), TCL_INDEX_NONE);
while (specialMenus[i].name) {
Tcl_DStringAppend(&ds, specialMenus[i].name,
specialMenus[i].len);
@@ -1287,7 +1287,7 @@ ParseAccelerator(
while (1) {
i = 0;
while (allModifiers[i].name) {
- int l = allModifiers[i].len;
+ size_t l = allModifiers[i].len;
if (!strncasecmp(accel, allModifiers[i].name, l) &&
(accel[l] == '-' || accel[l] == '+')) {
@@ -1330,7 +1330,7 @@ ParseAccelerator(
if (ch) {
return [[[NSString alloc] initWithCharacters:&ch length:1] autorelease];
} else {
- return [[[[TKNSString alloc] initWithTclUtfBytes:accel length:-1] autorelease]
+ return [[[[TKNSString alloc] initWithTclUtfBytes:accel length:TCL_INDEX_NONE] autorelease]
lowercaseString];
}
}
@@ -1584,11 +1584,11 @@ GenerateMenuSelectEvent(
TkMenu *menuPtr = [menu tkMenu];
if (menuPtr) {
- int index = [menu tkIndexOfItem:menuItem];
+ Tcl_Size index = [menu tkIndexOfItem:menuItem];
- if (index < 0 || index >= (int) menuPtr->numEntries ||
+ if (index == TCL_INDEX_NONE || index >= menuPtr->numEntries ||
(menuPtr->entries[index])->state == ENTRY_DISABLED) {
- TkActivateMenuEntry(menuPtr, -1);
+ TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE);
} else {
TkActivateMenuEntry(menuPtr, index);
MenuSelectEvent(menuPtr);
@@ -1664,7 +1664,7 @@ RecursivelyClearActiveMenu(
{
int i;
- TkActivateMenuEntry(menuPtr, -1);
+ TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE);
for (i = 0; i < (int) menuPtr->numEntries; i++) {
TkMenuEntry *mePtr = menuPtr->entries[i];
diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c
index b677523..fcb7999 100644
--- a/macosx/tkMacOSXMenubutton.c
+++ b/macosx/tkMacOSXMenubutton.c
@@ -270,7 +270,7 @@ TkpComputeMenuButtonGeometry(
haveText = 1;
Tk_FreeTextLayout(butPtr->textLayout);
butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont,
- butPtr->text, -1, butPtr->wrapLength,
+ butPtr->text, TCL_INDEX_NONE, butPtr->wrapLength,
butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight);
txtWidth = butPtr->textWidth;
txtHeight = butPtr->textHeight;
diff --git a/macosx/tkMacOSXMenus.c b/macosx/tkMacOSXMenus.c
index ca412c7..54f32d5 100644
--- a/macosx/tkMacOSXMenus.c
+++ b/macosx/tkMacOSXMenus.c
@@ -205,7 +205,7 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp);
NULL, 0) || (GetCurrentEventKeyModifiers() & optionKey)) {
[super orderFrontStandardAboutPanel:nil];
} else {
- int code = Tcl_EvalEx(_eventInterp, "tkAboutDialog", -1,
+ int code = Tcl_EvalEx(_eventInterp, "tkAboutDialog", TCL_INDEX_NONE,
TCL_EVAL_GLOBAL);
if (code != TCL_OK) {
@@ -221,7 +221,7 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp);
"::tk::mac::ShowHelp", NULL, 0)) {
[super showHelp:sender];
} else {
- int code = Tcl_EvalEx(_eventInterp, "::tk::mac::ShowHelp", -1,
+ int code = Tcl_EvalEx(_eventInterp, "::tk::mac::ShowHelp", TCL_INDEX_NONE,
TCL_EVAL_GLOBAL);
if (code != TCL_OK) {
@@ -238,7 +238,7 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp);
if (_eventInterp) {
if (Tcl_EvalEx(_eventInterp, "tk_getOpenFile -filetypes {"
"{{TCL Scripts} {.tcl} TEXT} {{Text Files} {} TEXT}}",
- -1, TCL_EVAL_GLOBAL) == TCL_OK) {
+ TCL_INDEX_NONE, TCL_EVAL_GLOBAL) == TCL_OK) {
Tcl_Obj *path = Tcl_GetObjResult(_eventInterp);
int len;
@@ -333,7 +333,7 @@ GetWidgetDemoPath(
Tcl_Obj *result = NULL;
if (Tcl_EvalEx(interp, "::tk::pkgconfig get demodir,runtime",
- -1, TCL_EVAL_GLOBAL) == TCL_OK) {
+ TCL_INDEX_NONE, TCL_EVAL_GLOBAL) == TCL_OK) {
Tcl_Obj *libpath, *demo[1] = { Tcl_NewStringObj("widget", 6) };
libpath = Tcl_GetObjResult(interp);
diff --git a/macosx/tkMacOSXPrint.c b/macosx/tkMacOSXPrint.c
index fdb66aa..f81f8bd 100644
--- a/macosx/tkMacOSXPrint.c
+++ b/macosx/tkMacOSXPrint.c
@@ -123,7 +123,7 @@ StartPrint(
(void)(PMPageFormat)[printInfo PMPageFormat];
printSettings = (PMPrintSettings)[printInfo PMPrintSettings];
- accepted = [printPanel runModalWithPrintInfo: printInfo];
+ accepted = (int)[printPanel runModalWithPrintInfo: printInfo];
[printDelegate printPanelDidEnd: printPanel
returnCode: accepted
contextInfo: printInfo];
diff --git a/macosx/tkMacOSXScale.c b/macosx/tkMacOSXScale.c
index c226aeb..bc2a87e 100644
--- a/macosx/tkMacOSXScale.c
+++ b/macosx/tkMacOSXScale.c
@@ -174,10 +174,10 @@ TkpDisplayScale(
string[TCL_DOUBLE_SPACE - 1] = '\0';
}
Tcl_DStringInit(&buf);
- Tcl_DStringAppend(&buf, scalePtr->command, -1);
- Tcl_DStringAppend(&buf, " ", -1);
- Tcl_DStringAppend(&buf, string, -1);
- result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
+ Tcl_DStringAppend(&buf, scalePtr->command, TCL_INDEX_NONE);
+ Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE);
+ Tcl_DStringAppend(&buf, string, TCL_INDEX_NONE);
+ result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
if (result != TCL_OK) {
Tcl_AddErrorInfo(interp, "\n (command executed by scale)");
diff --git a/macosx/tkMacOSXSend.c b/macosx/tkMacOSXSend.c
index 1b3e2b3..101da1d 100644
--- a/macosx/tkMacOSXSend.c
+++ b/macosx/tkMacOSXSend.c
@@ -209,7 +209,8 @@ Tk_SetAppName(
{
TkWindow *winPtr = (TkWindow *) tkwin;
Tcl_Interp *interp = winPtr->mainPtr->interp;
- int i, suffix, offset, result;
+ int suffix, result;
+ Tcl_Size i, offset;
RegisteredInterp *riPtr, *prevPtr;
const char *actualName;
Tcl_DString dString;
@@ -260,7 +261,7 @@ Tk_SetAppName(
interpName = Tcl_GetString(interpNamePtr);
if (strcmp(actualName, interpName) == 0) {
if (suffix == 1) {
- Tcl_DStringAppend(&dString, name, -1);
+ Tcl_DStringAppend(&dString, name, TCL_INDEX_NONE);
Tcl_DStringAppend(&dString, " #", 2);
offset = Tcl_DStringLength(&dString);
Tcl_DStringSetLength(&dString, offset + TCL_INTEGER_SPACE);
@@ -473,7 +474,7 @@ TkGetInterpNames(
riPtr = interpListPtr;
while (riPtr != NULL) {
Tcl_ListObjAppendElement(interp, listObjPtr,
- Tcl_NewStringObj(riPtr->name, -1));
+ Tcl_NewStringObj(riPtr->name, TCL_INDEX_NONE));
riPtr = riPtr->nextPtr;
}
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 3e88dfe..e6c5584 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -422,7 +422,7 @@ static void RefocusGrabWindow(void *data) {
"::tk::mac::OnShow" : "::tk::mac::OnHide");
if (_eventInterp && Tcl_FindCommand(_eventInterp, cmd, NULL, 0)) {
- int code = Tcl_EvalEx(_eventInterp, cmd, -1, TCL_EVAL_GLOBAL);
+ int code = Tcl_EvalEx(_eventInterp, cmd, TCL_INDEX_NONE, TCL_EVAL_GLOBAL);
if (code != TCL_OK) {
Tcl_BackgroundException(_eventInterp, code);
@@ -871,7 +871,7 @@ TkWmProtocolEventProc(
Tcl_Preserve(protPtr);
interp = protPtr->interp;
Tcl_Preserve(interp);
- result = Tcl_EvalEx(interp, protPtr->command, -1, TCL_EVAL_GLOBAL);
+ result = Tcl_EvalEx(interp, protPtr->command, TCL_INDEX_NONE, TCL_EVAL_GLOBAL);
if (result != TCL_OK) {
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (command for \"%s\" window manager protocol)",
@@ -1271,7 +1271,7 @@ static const char *const accentNames[] = {
snprintf(data, 256, "Appearance %s Accent %s Highlight %s",
effectiveAppearanceName.UTF8String, accentName,
highlightName);
- Tk_SendVirtualEvent(tkwin, "AppearanceChanged", Tcl_NewStringObj(data, -1));
+ Tk_SendVirtualEvent(tkwin, "AppearanceChanged", Tcl_NewStringObj(data, TCL_INDEX_NONE));
}
- (void)observeValueForKeyPath:(NSString *)keyPath
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 5feb6e4..558adf7 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -1180,7 +1180,8 @@ Tk_WmObjCmd(
WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM,
WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT,
WMOPT_WITHDRAW };
- int index, length;
+ int index;
+ Tcl_Size length;
char *argv1;
TkWindow *winPtr;
@@ -1356,7 +1357,7 @@ WmAspectCmd(
if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) ||
(denom2 <= 0)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "aspect number can't be <= 0", -1));
+ "aspect number can't be <= 0", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "WM", "ASPECT", NULL);
return TCL_ERROR;
}
@@ -1435,7 +1436,7 @@ WmSetAttribute(
return TCL_ERROR;
}
if (boolean != [macWindow isDocumentEdited]) {
- [macWindow setDocumentEdited:boolean];
+ [macWindow setDocumentEdited:(BOOL)boolean];
}
break;
case WMATT_NOTIFY:
@@ -1549,7 +1550,7 @@ WmGetAttribute(
break;
case WMATT_TITLEPATH:
result = Tcl_NewStringObj([[macWindow representedFilename] UTF8String],
- -1);
+ TCL_INDEX_NONE);
break;
case WMATT_TOPMOST:
result = Tcl_NewBooleanObj(wmPtr->flags & WM_TOPMOST);
@@ -1558,7 +1559,7 @@ WmGetAttribute(
result = Tcl_NewBooleanObj(wmPtr->flags & WM_TRANSPARENT);
break;
case WMATT_TYPE:
- result = Tcl_NewStringObj("unsupported", -1);
+ result = Tcl_NewStringObj("unsupported", TCL_INDEX_NONE);
break;
case _WMATT_LAST_ATTRIBUTE:
default:
@@ -1608,7 +1609,7 @@ WmAttributesCmd(
for (attribute = 0; attribute < _WMATT_LAST_ATTRIBUTE; ++attribute) {
Tcl_ListObjAppendElement(NULL, result,
- Tcl_NewStringObj(WmAttributeNames[attribute], -1));
+ Tcl_NewStringObj(WmAttributeNames[attribute], TCL_INDEX_NONE));
Tcl_ListObjAppendElement(NULL, result,
WmGetAttribute(winPtr, macWindow, (WmAttribute)attribute));
}
@@ -1666,7 +1667,7 @@ WmClientCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
char *argv3;
- int length;
+ Tcl_Size length;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?name?");
@@ -1675,7 +1676,7 @@ WmClientCmd(
if (objc == 3) {
if (wmPtr->clientMachine != NULL) {
Tcl_SetObjResult(interp,
- Tcl_NewStringObj(wmPtr->clientMachine, -1));
+ Tcl_NewStringObj(wmPtr->clientMachine, TCL_INDEX_NONE));
}
return TCL_OK;
}
@@ -1960,7 +1961,7 @@ WmFocusmodelCmd(
}
if (objc == 3) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- wmPtr->hints.input ? "passive" : "active", -1));
+ wmPtr->hints.input ? "passive" : "active", TCL_INDEX_NONE));
return TCL_OK;
}
@@ -2080,7 +2081,7 @@ WmFrameCmd(
window = Tk_WindowId((Tk_Window)winPtr);
}
snprintf(buf, sizeof(buf), "0x%" TCL_Z_MODIFIER "x", (size_t)window);
- Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, TCL_INDEX_NONE));
return TCL_OK;
}
@@ -2244,7 +2245,7 @@ WmGridCmd(
return TCL_OK;
error:
- Tcl_SetObjResult(interp, Tcl_NewStringObj(errorMsg, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(errorMsg, TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "WM", "GRID", NULL);
return TCL_ERROR;
}
@@ -2285,7 +2286,7 @@ WmGroupCmd(
}
if (objc == 3) {
if (wmPtr->hints.flags & WindowGroupHint) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->leaderName, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->leaderName, TCL_INDEX_NONE));
}
return TCL_OK;
}
@@ -2626,7 +2627,7 @@ WmIconnameCmd(
}
if (objc == 3) {
if (wmPtr->iconName != NULL) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->iconName, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->iconName, TCL_INDEX_NONE));
}
return TCL_OK;
}
@@ -3165,9 +3166,9 @@ WmPositionfromCmd(
if (objc == 3) {
if (wmPtr->sizeHintsFlags & USPosition) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("user", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("user", TCL_INDEX_NONE));
} else if (wmPtr->sizeHintsFlags & PPosition) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("program", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("program", TCL_INDEX_NONE));
}
return TCL_OK;
}
@@ -3254,7 +3255,7 @@ WmProtocolCmd(
protPtr = protPtr->nextPtr) {
if (protPtr->protocol == protocol) {
Tcl_SetObjResult(interp,
- Tcl_NewStringObj(protPtr->command, -1));
+ Tcl_NewStringObj(protPtr->command, TCL_INDEX_NONE));
return TCL_OK;
}
}
@@ -3409,9 +3410,9 @@ WmSizefromCmd(
if (objc == 3) {
if (wmPtr->sizeHintsFlags & USSize) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("user", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("user", TCL_INDEX_NONE));
} else if (wmPtr->sizeHintsFlags & PSize) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("program", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("program", TCL_INDEX_NONE));
}
return TCL_OK;
}
@@ -3527,7 +3528,7 @@ WmStackorderCmd(
windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr);
if (windows == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "TkWmStackorderToplevel failed", -1));
+ "TkWmStackorderToplevel failed", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "WM", "STACK", "FAIL", NULL);
return TCL_ERROR;
}
@@ -3657,7 +3658,7 @@ WmStateCmd(
break;
}
} else if (wmPtr->iconFor != NULL) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("icon", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("icon", TCL_INDEX_NONE));
} else {
if (wmPtr->hints.initial_state == NormalState ||
wmPtr->hints.initial_state == ZoomState) {
@@ -3666,16 +3667,16 @@ WmStateCmd(
}
switch (wmPtr->hints.initial_state) {
case NormalState:
- Tcl_SetObjResult(interp, Tcl_NewStringObj("normal", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("normal", TCL_INDEX_NONE));
break;
case IconicState:
- Tcl_SetObjResult(interp, Tcl_NewStringObj("iconic", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("iconic", TCL_INDEX_NONE));
break;
case WithdrawnState:
- Tcl_SetObjResult(interp, Tcl_NewStringObj("withdrawn", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("withdrawn", TCL_INDEX_NONE));
break;
case ZoomState:
- Tcl_SetObjResult(interp, Tcl_NewStringObj("zoomed", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("zoomed", TCL_INDEX_NONE));
break;
}
}
@@ -3718,7 +3719,7 @@ WmTitleCmd(
if (objc == 3) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- wmPtr->titleUid ? wmPtr->titleUid : winPtr->nameUid, -1));
+ wmPtr->titleUid ? wmPtr->titleUid : winPtr->nameUid, TCL_INDEX_NONE));
return TCL_OK;
}
@@ -3768,7 +3769,7 @@ WmTransientCmd(
if (objc == 3) {
if (wmPtr->container != NULL) {
Tcl_SetObjResult(interp,
- Tcl_NewStringObj(Tk_PathName(wmPtr->container), -1));
+ Tcl_NewStringObj(Tk_PathName(wmPtr->container), TCL_INDEX_NONE));
}
return TCL_OK;
}
@@ -5472,7 +5473,7 @@ TkSetWMName(
return;
}
- NSString *title = [[TKNSString alloc] initWithTclUtfBytes:titleUid length:-1];
+ NSString *title = [[TKNSString alloc] initWithTclUtfBytes:titleUid length:TCL_INDEX_NONE];
[TkMacOSXGetNSWindowForDrawable(winPtr->window) setTitle:title];
[title release];
}
@@ -5711,7 +5712,7 @@ TkUnsupported1ObjCmd(
case TKMWS_TABID:
if ([NSApp macOSVersion] < 101200) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "Tabbing identifiers did not exist until OSX 10.12.", -1));
+ "Tabbing identifiers did not exist until OSX 10.12.", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "WINDOWSTYLE", "TABBINGID", NULL);
return TCL_ERROR;
}
@@ -5723,7 +5724,7 @@ TkUnsupported1ObjCmd(
case TKMWS_APPEARANCE:
if ([NSApp macOSVersion] < 100900) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "Window appearances did not exist until OSX 10.9.", -1));
+ "Window appearances did not exist until OSX 10.9.", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "WINDOWSTYLE", "APPEARANCE", NULL);
return TCL_ERROR;
}
@@ -5855,7 +5856,7 @@ WmWinStyle(
for (i = 0; classMap[i].strValue != NULL; i++) {
if (wmPtr->macClass == classMap[i].intValue) {
- newResult = Tcl_NewStringObj(classMap[i].strValue, -1);
+ newResult = Tcl_NewStringObj(classMap[i].strValue, TCL_INDEX_NONE);
break;
}
}
@@ -5880,7 +5881,7 @@ WmWinStyle(
for (i = 0; attrMap[i].strValue != NULL; i++) {
if (attributes & attrMap[i].intValue) {
Tcl_ListObjAppendElement(NULL, attributeList,
- Tcl_NewStringObj(attrMap[i].strValue, -1));
+ Tcl_NewStringObj(attrMap[i].strValue, TCL_INDEX_NONE));
}
}
Tcl_ListObjAppendElement(NULL, newResult, attributeList);
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index 823fba8..9d7f1f7 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -293,9 +293,9 @@ XkbOpenDisplay(
Gestalt(gestaltSystemVersionBugFix, (SInt32*)&patch);
#else
NSOperatingSystemVersion systemVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
- major = systemVersion.majorVersion;
- minor = systemVersion.minorVersion;
- patch = systemVersion.patchVersion;
+ major = (int)systemVersion.majorVersion;
+ minor = (int)systemVersion.minorVersion;
+ patch = (int)systemVersion.patchVersion;
#endif
display->release = major << 16 | minor << 8 | patch;
}