Jim Tcl
Check-in [a25ba46aa3]
Not logged in

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

Overview
Comment:Tidy some signed/unsigned comparisons

Signed-off-by: Steve Bennett <steveb@workware.net.au>

Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a25ba46aa3a21ca4a7baf450d2fc5651cfdb4891
User & Date: steveb@workware.net.au 2018-09-03 22:00:22
Original User & Date: steveb@workware.net.au 2018-09-03 22:00:23
Context
2018-09-03
22:00
bootstrap package support

Allow minimal command "package" to take additional arguments, but ignore them.

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: a2b3125017 user: steveb@workware.net.au tags: trunk

22:00
Tidy some signed/unsigned comparisons

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: a25ba46aa3 user: steveb@workware.net.au tags: trunk

2018-07-28
08:16
distclean: Remove generated tests/Makefile check-in: d8b98f3ecd user: steveb@workware.net.au tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to jim-aio.c.

220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
static int ssl_reader(struct AioFile *af, char *buf, int len)
{
    return SSL_read(af->ssl, buf, len);
}

static const char *ssl_getline(struct AioFile *af, char *buf, int len)
{
    int i;
    for (i = 0; i < len + 1; i++) {
        if (SSL_read(af->ssl, &buf[i], 1) != 1) {
            if (i == 0) {
                return NULL;
            }
            break;
        }







|







220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
static int ssl_reader(struct AioFile *af, char *buf, int len)
{
    return SSL_read(af->ssl, buf, len);
}

static const char *ssl_getline(struct AioFile *af, char *buf, int len)
{
    size_t i;
    for (i = 0; i < len + 1; i++) {
        if (SSL_read(af->ssl, &buf[i], 1) != 1) {
            if (i == 0) {
                return NULL;
            }
            break;
        }

Changes to jim-signal.c.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
    #include <unistd.h>
#endif
#include <jim-subcmd.h>
#include <jim-signal.h>

#define MAX_SIGNALS_WIDE (sizeof(jim_wide) * 8)
#if defined(NSIG)
    #define MAX_SIGNALS ((NSIG < MAX_SIGNALS_WIDE) ? NSIG : MAX_SIGNALS_WIDE)
#else
    #define MAX_SIGNALS MAX_SIGNALS_WIDE
#endif

static jim_wide *sigloc;
static jim_wide sigsblocked;
static struct sigaction *sa_old;
static struct {
    int status;







|

|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
    #include <unistd.h>
#endif
#include <jim-subcmd.h>
#include <jim-signal.h>

#define MAX_SIGNALS_WIDE (sizeof(jim_wide) * 8)
#if defined(NSIG)
    #define MAX_SIGNALS (int)((NSIG < MAX_SIGNALS_WIDE) ? NSIG : MAX_SIGNALS_WIDE)
#else
    #define MAX_SIGNALS (int)MAX_SIGNALS_WIDE
#endif

static jim_wide *sigloc;
static jim_wide sigsblocked;
static struct sigaction *sa_old;
static struct {
    int status;

Changes to jim-tty.c.

142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
...
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
        Jim_ListAppendElement(interp, listObjPtr, Jim_NewStringObj(interp, str2, -1));
    }
}

Jim_Obj *Jim_GetTtySettings(Jim_Interp *interp, int fd)
{
    struct termios tio;
    int i;
    const char *p;
    Jim_Obj *listObjPtr;
    speed_t speed;
    int baud;

    if (tcgetattr(fd, &tio) < 0) {
        return NULL;
................................................................................

    for (i = 0; i < len; i += 2) {
        Jim_Obj *nameObj = Jim_ListGetIndex(interp, dictObjPtr, i);
        Jim_Obj *valueObj = Jim_ListGetIndex(interp, dictObjPtr, i + 1);
        int opt;
        const struct flag_name_map *p;
        long l;
        int j;

        if (Jim_GetEnum(interp, nameObj, tty_settings_names, &opt, "setting", JIM_ERRMSG | JIM_ENUM_ABBREV) != JIM_OK) {
            return JIM_ERR;
        }

        switch (opt) {
            case OPT_BAUD:







|







 







|







142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
...
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
        Jim_ListAppendElement(interp, listObjPtr, Jim_NewStringObj(interp, str2, -1));
    }
}

Jim_Obj *Jim_GetTtySettings(Jim_Interp *interp, int fd)
{
    struct termios tio;
    size_t i;
    const char *p;
    Jim_Obj *listObjPtr;
    speed_t speed;
    int baud;

    if (tcgetattr(fd, &tio) < 0) {
        return NULL;
................................................................................

    for (i = 0; i < len; i += 2) {
        Jim_Obj *nameObj = Jim_ListGetIndex(interp, dictObjPtr, i);
        Jim_Obj *valueObj = Jim_ListGetIndex(interp, dictObjPtr, i + 1);
        int opt;
        const struct flag_name_map *p;
        long l;
        size_t j;

        if (Jim_GetEnum(interp, nameObj, tty_settings_names, &opt, "setting", JIM_ERRMSG | JIM_ENUM_ABBREV) != JIM_OK) {
            return JIM_ERR;
        }

        switch (opt) {
            case OPT_BAUD:

Changes to jim.c.

5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
    int collected = 0;
    Jim_HashTable marks;
    Jim_HashTableIterator htiter;
    Jim_HashEntry *he;
    Jim_Obj *objPtr;

    /* Avoid recursive calls */
    if (interp->lastCollectId == -1) {
        /* Jim_Collect() already running. Return just now. */
        return 0;
    }
    interp->lastCollectId = -1;

    /* Mark all the references found into the 'mark' hash table.
     * The references are searched in every live object that
     * is of a type that can contain references. */
    Jim_InitHashTable(&marks, &JimRefMarkHashTableType, NULL);
    objPtr = interp->liveList;
    while (objPtr) {







|



|







5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
    int collected = 0;
    Jim_HashTable marks;
    Jim_HashTableIterator htiter;
    Jim_HashEntry *he;
    Jim_Obj *objPtr;

    /* Avoid recursive calls */
    if (interp->lastCollectId == (unsigned long)~0) {
        /* Jim_Collect() already running. Return just now. */
        return 0;
    }
    interp->lastCollectId = ~0;

    /* Mark all the references found into the 'mark' hash table.
     * The references are searched in every live object that
     * is of a type that can contain references. */
    Jim_InitHashTable(&marks, &JimRefMarkHashTableType, NULL);
    objPtr = interp->liveList;
    while (objPtr) {

Changes to jim.h.

531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
    Jim_Obj *nullScriptObj; /* script representation of an empty string */
    Jim_Obj *emptyObj; /* Shared empty string object. */
    Jim_Obj *trueObj; /* Shared true int object. */
    Jim_Obj *falseObj; /* Shared false int object. */
    unsigned long referenceNextId; /* Next id for reference. */
    struct Jim_HashTable references; /* References hash table. */
    unsigned long lastCollectId; /* reference max Id of the last GC
                execution. It's set to -1 while the collection
                is running as sentinel to avoid to recursive
                calls via the [collect] command inside
                finalizers. */
    time_t lastCollectTime; /* unix time of the last GC execution */
    Jim_Obj *stackTrace; /* Stack trace object. */
    Jim_Obj *errorProc; /* Name of last procedure which returned an error */
    Jim_Obj *unknown; /* Unknown command cache */







|







531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
    Jim_Obj *nullScriptObj; /* script representation of an empty string */
    Jim_Obj *emptyObj; /* Shared empty string object. */
    Jim_Obj *trueObj; /* Shared true int object. */
    Jim_Obj *falseObj; /* Shared false int object. */
    unsigned long referenceNextId; /* Next id for reference. */
    struct Jim_HashTable references; /* References hash table. */
    unsigned long lastCollectId; /* reference max Id of the last GC
                execution. It's set to ~0 while the collection
                is running as sentinel to avoid to recursive
                calls via the [collect] command inside
                finalizers. */
    time_t lastCollectTime; /* unix time of the last GC execution */
    Jim_Obj *stackTrace; /* Stack trace object. */
    Jim_Obj *errorProc; /* Name of last procedure which returned an error */
    Jim_Obj *unknown; /* Unknown command cache */

Changes to utf8.c.

195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
    }
    return ch;
}

static int cmp_range(const void *key, const void *cm)
{
    const struct utf8range *range = (const struct utf8range *)cm;
    int ch = *(int *)key;
    if (ch < range->lower) {
        return -1;
    }
    if (ch >= range->upper) {
        return 1;
    }
    return 0;







|







195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
    }
    return ch;
}

static int cmp_range(const void *key, const void *cm)
{
    const struct utf8range *range = (const struct utf8range *)cm;
    unsigned ch = *(unsigned *)key;
    if (ch < range->lower) {
        return -1;
    }
    if (ch >= range->upper) {
        return 1;
    }
    return 0;