Tk Source Code

Check-in [955354d8]
Login

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

Overview
Comment:gcc warning: signed-unsigned compare
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-4-branch
Files: files | file ages | folders
SHA1: 955354d8412a1cc99dc57ad3c306d6525683dd91
User & Date: jan.nijtmans 2012-04-02 09:14:24
Context
2012-04-06
21:47
format tk.decls like tcl8.5/8.6, re-generiate tk(Int)Decls.h check-in: 4af947ee user: jan.nijtmans tags: core-8-4-branch
2012-04-02
09:29
gcc warning: signed-unsigned compare check-in: b5705781 user: jan.nijtmans tags: core-8-5-branch
09:14
gcc warning: signed-unsigned compare check-in: 955354d8 user: jan.nijtmans tags: core-8-4-branch
2012-03-29
22:37
Only check for cygwin with $GCC check-in: 0f2cc67a user: jan.nijtmans tags: core-8-4-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to xlib/xcolors.c.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

#include "tkInt.h"

/*
 * Index array. For each of the characters 'a'-'y', this table gives the first color
 * starting with that character in the xColors table.
 */
static int az[] = {0, 4, 12, 19, 43, 43, 46, 56, 58, 60, 60, 61, 84, 99,
	102, 107, 118, 118, 121, 134, 138, 138, 140, 143, 143, 145};

/*
 * Define an array that defines the mapping from color names to RGB values.
 * Note that this array must be kept sorted alphabetically so that the
 * binary search used in XParseColor will succeed.
 *







|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

#include "tkInt.h"

/*
 * Index array. For each of the characters 'a'-'y', this table gives the first color
 * starting with that character in the xColors table.
 */
static unsigned char az[] = {0, 4, 12, 19, 43, 43, 46, 56, 58, 60, 60, 61, 84, 99,
	102, 107, 118, 118, 121, 134, 138, 138, 140, 143, 143, 145};

/*
 * Define an array that defines the mapping from color names to RGB values.
 * Note that this array must be kept sorted alphabetically so that the
 * binary search used in XParseColor will succeed.
 *
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
	const char *q;
	/*
	 * Perform a binary search on the sorted array of colors.
	 * size = current size of search range
	 * p    = pointer to current element being considered.
	 */
	int r = (spec[0] - 'A') & 0xdf;
	if (r > (sizeof(az)/sizeof(az[0] - 1))) {
	    return 0;
	}
	size = az[r + 1] - az[r];
	p = &xColors[(az[r + 1] + az[r]) >> 1];
	r = colorcmp(spec + 1, *p, &num);

	while (r != 0) {







|







347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
	const char *q;
	/*
	 * Perform a binary search on the sorted array of colors.
	 * size = current size of search range
	 * p    = pointer to current element being considered.
	 */
	int r = (spec[0] - 'A') & 0xdf;
	if (r >= (int) sizeof(az) - 1) {
	    return 0;
	}
	size = az[r + 1] - az[r];
	p = &xColors[(az[r + 1] + az[r]) >> 1];
	r = colorcmp(spec + 1, *p, &num);

	while (r != 0) {