Check-in [0c2181284c]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fix compiler warnings in tk
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:0c2181284cf3ee97f3a8f9460c4605ea600a6ea0
User & Date: chw 2019-03-16 16:59:39
Context
2019-03-16
17:01
fix compiler warnings in libwebsockets, snap7, tkvlc, and tserialport check-in: 98264290ff user: chw tags: trunk
16:59
fix compiler warnings in tk check-in: 0c2181284c user: chw tags: trunk
16:58
fix some compiler warnings in tcl check-in: 38e824c84e user: chw tags: trunk
Changes

Changes to jni/sdl2tk/generic/tkClipboard.c.

141
142
143
144
145
146
147

148
149
150
151
152
153
154
155
156
157
    p = dispPtr->clipboardAppPtr->winPtr->nameUid;
    length = strlen(p);
    length -= offset;
    if (length <= 0) {
	return 0;
    }
    if (length > (size_t) maxBytes) {

	length = maxBytes;
    }
    strncpy(buffer, p, length);
    return (int)length;
}
 
/*
 *----------------------------------------------------------------------
 *
 * ClipboardWindowHandler --







>
|

|







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
    p = dispPtr->clipboardAppPtr->winPtr->nameUid;
    length = strlen(p);
    length -= offset;
    if (length <= 0) {
	return 0;
    }
    if (length > (size_t) maxBytes) {
	memcpy(buffer, p, maxBytes);
	return (int)maxBytes;
    }
    strcpy(buffer, p);
    return (int)length;
}
 
/*
 *----------------------------------------------------------------------
 *
 * ClipboardWindowHandler --

Changes to jni/sdl2tk/sdl/SdlTkInt.c.

1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
....
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
....
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
....
4053
4054
4055
4056
4057
4058
4059
4060



4061

4062
4063
4064
4065
4066
4067
4068
....
4078
4079
4080
4081
4082
4083
4084


4085
4086
4087





4088
4089
4090
4091
4092
4093
4094
4095
4096
4097

4098
4099
4100





4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
....
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
....
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
	    event->xany.send_event = False;
	    event->xany.window = (Window) SdlTkX.screen->root;
	    event->xbutton.root = (Window) SdlTkX.screen->root;
	    event->xany.display = SdlTkX.display;
	    ((XVirtualEvent *) event)->name = (Tk_Uid) evname;
	    event->xany.serial = SdlTkX.display->request;
	    event->xbutton.x = event->xbutton.y = sdl_event->user.code;
	    event->xbutton.state = (long) sdl_event->user.data2;
	    /* only TK_APP_TOP_LEVEL windows will get this */
	    event->xany.window = (Window)
		SendAppEvent(event, &nsent,
			     ((_Window *) SdlTkX.screen->root)->child);
	}
	return nsent > 0;
    }
................................................................................
	event->xany.display = SdlTkX.display;
	event->xany.serial = SdlTkX.display->request;
	event->xbutton.state = sdl_event->jdevice.which;
	event->xbutton.x_root = event->xbutton.y_root =
	    sdl_event->jdevice.which;
	if (sdl_event->type == SDL_JOYDEVICEADDED) {
	    SDL_Joystick *stick;
	    long which;
	    int new;
	    Tcl_HashEntry *hPtr;

	    stick = SDL_JoystickOpen(sdl_event->jdevice.which);
	    if (stick == NULL) {
		return 0;
	    }
................................................................................
		event->xbutton.state;
#ifdef ANDROID
	    if (strcmp(SDL_JoystickName(stick),
		       "Android Accelerometer") == 0) {
		SdlTkX.accel_id = event->xbutton.state;
	    }
#endif
	    which = event->xbutton.state;
	    hPtr = Tcl_CreateHashEntry(&SdlTkX.joystick_table,
				       (ClientData) which, &new);
	    if (!new) {
		SDL_JoystickClose(stick);
		return 0;
	    }
	    Tcl_SetHashValue(hPtr, (char *) stick);
	    ((XVirtualEvent *) event)->name = (Tk_Uid) "JoystickAdded";
	} else {
	    long which = sdl_event->jdevice.which;
	    Tcl_HashEntry *hPtr;

	    hPtr = Tcl_FindHashEntry(&SdlTkX.joystick_table,
				     (ClientData) which);
	    if (hPtr == NULL) {
		return 0;
	    }
	    SDL_JoystickClose((SDL_Joystick *) Tcl_GetHashValue(hPtr));
	    Tcl_DeleteHashEntry(hPtr);
	    ((XVirtualEvent *) event)->name = (Tk_Uid) "JoystickRemoved";
	}
................................................................................
	"numbuttons", "numhats",
	NULL
    };
    enum jopts {
	JOY_IDS, JOY_GUID, JOY_NAME, JOY_NAXES, JOY_NBALLS,
	JOY_NBUTTONS, JOY_NHATS
    };
    int index, joy_id;



    long joy_idl;

    Tcl_HashEntry *hPtr;
    SDL_Joystick *stick;

    if (objc < 2) {
	Tcl_WrongNumArgs(interp, 1, objv, "suboption ?joyid?");
	return TCL_ERROR;
    }
................................................................................
	    Tcl_WrongNumArgs(interp, 2, objv, "");
	    return TCL_ERROR;
	}
	result = Tcl_NewListObj(0, NULL);
	SdlTkLock(NULL);
	hPtr = Tcl_FirstHashEntry(&SdlTkX.joystick_table, &search);
	while (hPtr != NULL) {


	    joy_idl = (long) Tcl_GetHashKey(&SdlTkX.joystick_table, hPtr);
	    Tcl_ListObjAppendElement(interp, result,
				     Tcl_NewIntObj((int) joy_idl));





	    hPtr = Tcl_NextHashEntry(&search);
	}
	SdlTkUnlock(NULL);
	Tcl_SetObjResult(interp, result);
	return TCL_OK;
    }
    if (objc != 3) {
	Tcl_WrongNumArgs(interp, 2, objv, "joyid");
	return TCL_ERROR;
    }

    if (Tcl_GetIntFromObj(interp, objv[2], &joy_id) != TCL_OK) {
	return TCL_ERROR;
    }





    SdlTkLock(NULL);
    joy_idl = joy_id;
    hPtr = Tcl_FindHashEntry(&SdlTkX.joystick_table, (ClientData) joy_idl);
    if (hPtr == NULL) {
	SdlTkUnlock(NULL);
	Tcl_SetResult(interp, "unknown joystick identifier", TCL_STATIC);
	return TCL_ERROR;
    }
    stick = (SDL_Joystick *) Tcl_GetHashValue(hPtr);
    switch (index) {
................................................................................

	if ((void *) new_sc != last_sc) {
	    last_sc = (void *) new_sc;
	    SdlTkSetSWCursor(new_sc);
	}
	return;
    }
    hPtr = Tcl_FindHashEntry(&SdlTkX.sdlcursors, (ClientData) shape);
    if (hPtr == NULL) {
#ifndef __HAIKU__
	if (SdlTkX.is_framebuffer) {
	    const unsigned char *data, *mask;
	    int x, y;

	    data = SdlTkGetSystemCursorData(shape);
................................................................................
#endif
	sc = SDL_CreateSystemCursor(shape);
madeCursor:
	if (sc != NULL) {
	    int isNew;

	    hPtr = Tcl_CreateHashEntry(&SdlTkX.sdlcursors,
				       (ClientData) shape, &isNew);
	    Tcl_SetHashValue(hPtr, (ClientData) sc);
	}
    } else {
	sc = (SDL_Cursor *) Tcl_GetHashValue(hPtr);
    }
    if (sc != NULL) {
	if ((void *) sc != last_sc) {







|







 







|







 







|
|
<







|


|
<







 







|
>
>
>
|
>







 







>
>
|

<
>
>
>
>
>










>
|


>
>
>
>
>

<
|







 







|







 







|







1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
....
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
....
2057
2058
2059
2060
2061
2062
2063
2064
2065

2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076

2077
2078
2079
2080
2081
2082
2083
....
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
....
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090

4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115

4116
4117
4118
4119
4120
4121
4122
4123
....
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
....
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
	    event->xany.send_event = False;
	    event->xany.window = (Window) SdlTkX.screen->root;
	    event->xbutton.root = (Window) SdlTkX.screen->root;
	    event->xany.display = SdlTkX.display;
	    ((XVirtualEvent *) event)->name = (Tk_Uid) evname;
	    event->xany.serial = SdlTkX.display->request;
	    event->xbutton.x = event->xbutton.y = sdl_event->user.code;
	    event->xbutton.state = PTR2INT(sdl_event->user.data2);
	    /* only TK_APP_TOP_LEVEL windows will get this */
	    event->xany.window = (Window)
		SendAppEvent(event, &nsent,
			     ((_Window *) SdlTkX.screen->root)->child);
	}
	return nsent > 0;
    }
................................................................................
	event->xany.display = SdlTkX.display;
	event->xany.serial = SdlTkX.display->request;
	event->xbutton.state = sdl_event->jdevice.which;
	event->xbutton.x_root = event->xbutton.y_root =
	    sdl_event->jdevice.which;
	if (sdl_event->type == SDL_JOYDEVICEADDED) {
	    SDL_Joystick *stick;
	    ClientData which;
	    int new;
	    Tcl_HashEntry *hPtr;

	    stick = SDL_JoystickOpen(sdl_event->jdevice.which);
	    if (stick == NULL) {
		return 0;
	    }
................................................................................
		event->xbutton.state;
#ifdef ANDROID
	    if (strcmp(SDL_JoystickName(stick),
		       "Android Accelerometer") == 0) {
		SdlTkX.accel_id = event->xbutton.state;
	    }
#endif
	    which = INT2PTR(event->xbutton.state);
	    hPtr = Tcl_CreateHashEntry(&SdlTkX.joystick_table, which, &new);

	    if (!new) {
		SDL_JoystickClose(stick);
		return 0;
	    }
	    Tcl_SetHashValue(hPtr, (char *) stick);
	    ((XVirtualEvent *) event)->name = (Tk_Uid) "JoystickAdded";
	} else {
	    ClientData which = INT2PTR(sdl_event->jdevice.which);
	    Tcl_HashEntry *hPtr;

	    hPtr = Tcl_FindHashEntry(&SdlTkX.joystick_table, which);

	    if (hPtr == NULL) {
		return 0;
	    }
	    SDL_JoystickClose((SDL_Joystick *) Tcl_GetHashValue(hPtr));
	    Tcl_DeleteHashEntry(hPtr);
	    ((XVirtualEvent *) event)->name = (Tk_Uid) "JoystickRemoved";
	}
................................................................................
	"numbuttons", "numhats",
	NULL
    };
    enum jopts {
	JOY_IDS, JOY_GUID, JOY_NAME, JOY_NAXES, JOY_NBALLS,
	JOY_NBUTTONS, JOY_NHATS
    };
    int index;
#ifdef _WIN64
    Tcl_WideInt joy_id;
#else
    long joy_id;
#endif
    Tcl_HashEntry *hPtr;
    SDL_Joystick *stick;

    if (objc < 2) {
	Tcl_WrongNumArgs(interp, 1, objv, "suboption ?joyid?");
	return TCL_ERROR;
    }
................................................................................
	    Tcl_WrongNumArgs(interp, 2, objv, "");
	    return TCL_ERROR;
	}
	result = Tcl_NewListObj(0, NULL);
	SdlTkLock(NULL);
	hPtr = Tcl_FirstHashEntry(&SdlTkX.joystick_table, &search);
	while (hPtr != NULL) {
#ifdef _WIN64
	    joy_id =
		    (Tcl_WideInt) Tcl_GetHashKey(&SdlTkX.joystick_table, hPtr);
	    Tcl_ListObjAppendElement(interp, result,

				     Tcl_NewWideIntObj(joy_id));
#else
	    joy_id = (long) Tcl_GetHashKey(&SdlTkX.joystick_table, hPtr);
	    Tcl_ListObjAppendElement(interp, result, Tcl_NewLongObj(joy_id));
#endif
	    hPtr = Tcl_NextHashEntry(&search);
	}
	SdlTkUnlock(NULL);
	Tcl_SetObjResult(interp, result);
	return TCL_OK;
    }
    if (objc != 3) {
	Tcl_WrongNumArgs(interp, 2, objv, "joyid");
	return TCL_ERROR;
    }
#ifdef _WIN64
    if (Tcl_GetWideIntFromObj(interp, objv[2], &joy_id) != TCL_OK) {
	return TCL_ERROR;
    }
#else
    if (Tcl_GetLongFromObj(interp, objv[2], &joy_id) != TCL_OK) {
	return TCL_ERROR;
    }
#endif
    SdlTkLock(NULL);

    hPtr = Tcl_FindHashEntry(&SdlTkX.joystick_table, (ClientData) joy_id);
    if (hPtr == NULL) {
	SdlTkUnlock(NULL);
	Tcl_SetResult(interp, "unknown joystick identifier", TCL_STATIC);
	return TCL_ERROR;
    }
    stick = (SDL_Joystick *) Tcl_GetHashValue(hPtr);
    switch (index) {
................................................................................

	if ((void *) new_sc != last_sc) {
	    last_sc = (void *) new_sc;
	    SdlTkSetSWCursor(new_sc);
	}
	return;
    }
    hPtr = Tcl_FindHashEntry(&SdlTkX.sdlcursors, INT2PTR(shape));
    if (hPtr == NULL) {
#ifndef __HAIKU__
	if (SdlTkX.is_framebuffer) {
	    const unsigned char *data, *mask;
	    int x, y;

	    data = SdlTkGetSystemCursorData(shape);
................................................................................
#endif
	sc = SDL_CreateSystemCursor(shape);
madeCursor:
	if (sc != NULL) {
	    int isNew;

	    hPtr = Tcl_CreateHashEntry(&SdlTkX.sdlcursors,
				       INT2PTR(shape), &isNew);
	    Tcl_SetHashValue(hPtr, (ClientData) sc);
	}
    } else {
	sc = (SDL_Cursor *) Tcl_GetHashValue(hPtr);
    }
    if (sc != NULL) {
	if ((void *) sc != last_sc) {

Changes to jni/sdl2tk/sdl/SdlTkUtils.c.

357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
...
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
...
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
    fterr = FT_Open_Face(ftlib, &ftarg, ffKey->index, &face);
    if (fterr != 0) {
	Tcl_Panic("loading freetype font failed");
    }
    FT_Select_Charmap(face, FT_ENCODING_UNICODE);
    charcode = FT_Get_First_Char(face, &gindex);
    while (gindex != 0) {
	hPtr = Tcl_CreateHashEntry(&ghash->hash,
				   (char *) charcode, &isNew);
	if (isNew) {
	    Tcl_SetHashValue(hPtr, (char *) charcode);
	}
	charcode = FT_Get_Next_Char(face, charcode, &gindex);
    }
    FT_Done_Face(face);
    FT_Done_FreeType(ftlib);
    ghash->hashLoaded = 1;
}
................................................................................

int
SdlTkFontHasChar(XFontStruct *fontStructPtr, char *buf)
{
    _Font *_f = (_Font *) fontStructPtr->fid;
    Tcl_HashEntry *hPtr;
    unsigned int ucs4 = ((unsigned int *) buf)[0];
    unsigned long lucs4 = ucs4;
    int ret = 0;

    Tcl_MutexLock(&fontMutex);
    hPtr = Tcl_FindHashEntry(&_f->glyphIndexHash->hash, (char *) lucs4);
    if (hPtr != NULL) {
	ret = (Tcl_GetHashValue(hPtr) != 0);
    }
    Tcl_MutexUnlock(&fontMutex);
    return ret;
}

int
SdlTkFontCanDisplayChar(char *xlfd, TkFontAttributes *faPtr, int ch)
{
    Tcl_HashSearch search;
    Tcl_HashEntry *hPtr, *hPtr2;
    unsigned long lch = ch;

    Tcl_MutexLock(&fontMutex);
    hPtr = Tcl_FirstHashEntry(&fileFaceHash, &search);
    while (hPtr != NULL) {
	GlyphIndexHash *ghash;

	ghash = (GlyphIndexHash *) Tcl_GetHashValue(hPtr);
................................................................................
	    }
	    if (!ghash->hashLoaded) {
	        FileFaceKey *ffKey;

		ffKey = (FileFaceKey *) Tcl_GetHashKey(&fileFaceHash, hPtr);
		SdlTkLoadGlyphHash(ghash, ffKey, 0);
	    }
	    hPtr2 = Tcl_FindHashEntry(&ghash->hash, (char *) lch);
	    Tcl_MutexUnlock(&fontMutex);
	    return (hPtr2 == NULL) ? 0 : 1;
	}
next:
	hPtr = Tcl_NextHashEntry(&search);
    }
    Tcl_MutexUnlock(&fontMutex);







|
<

|







 







<



|












<







 







|







357
358
359
360
361
362
363
364

365
366
367
368
369
370
371
372
373
...
519
520
521
522
523
524
525

526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541

542
543
544
545
546
547
548
...
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
    fterr = FT_Open_Face(ftlib, &ftarg, ffKey->index, &face);
    if (fterr != 0) {
	Tcl_Panic("loading freetype font failed");
    }
    FT_Select_Charmap(face, FT_ENCODING_UNICODE);
    charcode = FT_Get_First_Char(face, &gindex);
    while (gindex != 0) {
	hPtr = Tcl_CreateHashEntry(&ghash->hash, INT2PTR(charcode), &isNew);

	if (isNew) {
	    Tcl_SetHashValue(hPtr, INT2PTR(charcode));
	}
	charcode = FT_Get_Next_Char(face, charcode, &gindex);
    }
    FT_Done_Face(face);
    FT_Done_FreeType(ftlib);
    ghash->hashLoaded = 1;
}
................................................................................

int
SdlTkFontHasChar(XFontStruct *fontStructPtr, char *buf)
{
    _Font *_f = (_Font *) fontStructPtr->fid;
    Tcl_HashEntry *hPtr;
    unsigned int ucs4 = ((unsigned int *) buf)[0];

    int ret = 0;

    Tcl_MutexLock(&fontMutex);
    hPtr = Tcl_FindHashEntry(&_f->glyphIndexHash->hash, INT2PTR(ucs4));
    if (hPtr != NULL) {
	ret = (Tcl_GetHashValue(hPtr) != 0);
    }
    Tcl_MutexUnlock(&fontMutex);
    return ret;
}

int
SdlTkFontCanDisplayChar(char *xlfd, TkFontAttributes *faPtr, int ch)
{
    Tcl_HashSearch search;
    Tcl_HashEntry *hPtr, *hPtr2;


    Tcl_MutexLock(&fontMutex);
    hPtr = Tcl_FirstHashEntry(&fileFaceHash, &search);
    while (hPtr != NULL) {
	GlyphIndexHash *ghash;

	ghash = (GlyphIndexHash *) Tcl_GetHashValue(hPtr);
................................................................................
	    }
	    if (!ghash->hashLoaded) {
	        FileFaceKey *ffKey;

		ffKey = (FileFaceKey *) Tcl_GetHashKey(&fileFaceHash, hPtr);
		SdlTkLoadGlyphHash(ghash, ffKey, 0);
	    }
	    hPtr2 = Tcl_FindHashEntry(&ghash->hash, INT2PTR(ch));
	    Tcl_MutexUnlock(&fontMutex);
	    return (hPtr2 == NULL) ? 0 : 1;
	}
next:
	hPtr = Tcl_NextHashEntry(&search);
    }
    Tcl_MutexUnlock(&fontMutex);

Changes to jni/sdl2tk/sdl/agg-2.4/include/agg_path_storage.h.

716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
        void flip_y(double y1, double y2);

        // Concatenate path. The path is added as is.
        //--------------------------------------------------------------------
        template<class VertexSource> 
        void concat_path(VertexSource& vs, unsigned path_id = 0)
        {
            double x, y;
            unsigned cmd;
            vs.rewind(path_id);
            while(!is_stop(cmd = vs.vertex(&x, &y)))
            {
                m_vertices.add_vertex(x, y, cmd);
            }
        }







|







716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
        void flip_y(double y1, double y2);

        // Concatenate path. The path is added as is.
        //--------------------------------------------------------------------
        template<class VertexSource> 
        void concat_path(VertexSource& vs, unsigned path_id = 0)
        {
            double x = 0, y = 0;
            unsigned cmd;
            vs.rewind(path_id);
            while(!is_stop(cmd = vs.vertex(&x, &y)))
            {
                m_vertices.add_vertex(x, y, cmd);
            }
        }

jni/tcl/tests/tcltest.test became executable.