diff options
author | chi <chi> | 2005-04-11 17:25:56 +0000 |
---|---|---|
committer | chi <chi> | 2005-04-11 17:25:56 +0000 |
commit | 116e3c15ce7fd800aab2af6b4e7d0fa854b66875 (patch) | |
tree | 89e3596cd4c305e46ff4bba1fc9a5d917dd5df81 /jim.c | |
parent | 04a5f746b663d35d4e0e2b3b8ffca76119f725a5 (diff) | |
download | jimtcl-116e3c15ce7fd800aab2af6b4e7d0fa854b66875.zip jimtcl-116e3c15ce7fd800aab2af6b4e7d0fa854b66875.tar.gz jimtcl-116e3c15ce7fd800aab2af6b4e7d0fa854b66875.tar.bz2 |
- Remove the '%lu' scan format specification. The largest possible type
in the Jim core is jim_wide. That type is a signed one. A unsigned
variante of jim_wide is not forseen. So a '%lu' specification seems not
to make any sense.
- Some extra castings necessary to let the Jim core interpreter compile and
run under Tru64U on Dec Alpha.
- Fix a bug in UpdateStringOfList(). If a list was created via the Jim
command [list] w/o any argument, the internal representation of that list
pointed to ZERO and the len attribute was equally set to ZERO. If now
UpdateStringOfList was called to create the string representation of
the list, Jim_Alloc for quotingType got a ZERO size for number of bytes
to allocate. That let to SIGSEGV under Tru64U, so I changed that to
allocate at least 1 byte then.
Diffstat (limited to 'jim.c')
-rw-r--r-- | jim.c | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -2,7 +2,7 @@ * Copyright 2005 Salvatore Sanfilippo <antirez@invece.org> * Copyright 2005 Clemens Hintze <c.hintze@gmx.net> * - * $Id: jim.c,v 1.159 2005/04/11 14:34:18 antirez Exp $ + * $Id: jim.c,v 1.160 2005/04/11 17:25:56 chi Exp $ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -279,7 +279,7 @@ static int JimStringMatch(const char *pattern, int patternLen, if (pattern[0] != string[0]) return 0; /* no match */ } else { - if (tolower(pattern[0]) != tolower(string[0])) + if (tolower((int)pattern[0]) != tolower((int)string[0])) return 0; /* no match */ } string++; @@ -4674,7 +4674,7 @@ void UpdateStringOfList(struct Jim_Obj *objPtr) Jim_Obj **ele = objPtr->internalRep.listValue.ele; /* (Over) Estimate the space needed. */ - quotingType = Jim_Alloc(sizeof(int)*objPtr->internalRep.listValue.len); + quotingType = Jim_Alloc(sizeof(int)*objPtr->internalRep.listValue.len+1); bufLen = 0; for (i = 0; i < objPtr->internalRep.listValue.len; i++) { int len; @@ -6964,7 +6964,7 @@ static int SetScanFmtFromAny(Jim_Interp *interp, Jim_Obj *objPtr) } else { /* Remember any valid modifier if given */ if (strchr("hlL", *fmt) != 0) - descr->modifier = tolower(*fmt++); + descr->modifier = tolower((int)*fmt++); descr->type = *fmt; if (strchr("efgcsndoxui", *fmt) == 0) { @@ -6974,6 +6974,9 @@ static int SetScanFmtFromAny(Jim_Interp *interp, Jim_Obj *objPtr) fmtObj->error = "field width may not be specified in %c " "conversion"; return JIM_ERR; + } else if (*fmt == 'u' && descr->modifier == 'l') { + fmtObj->error = "unsigned wide not supported"; + return JIM_ERR; } } curr++; @@ -7158,10 +7161,11 @@ static int ScanOneEntry(Jim_Interp *interp, const char *str, long pos, do { /* Try to scan a number with the given base */ if (descr->modifier == 'l') - if (descr->type == 'u') - *(jim_wide*)value = strtoull(tok, &endp, base); - else - *(jim_wide*)value = strtoll(tok, &endp, base); +#ifdef HAVE_LONG_LONG + *(jim_wide*)value = JimStrtoll(tok, &endp, base); +#else + *(jim_wide*)value = strtol(tok, &endp, base); +#endif else if (descr->type == 'u') *(long*)value = strtoul(tok, &endp, base); @@ -11613,7 +11617,7 @@ int Jim_InteractivePrompt(Jim_Interp *interp) printf("Welcome to Jim version %d.%d, " "Copyright (c) 2005 Salvatore Sanfilippo\n", JIM_VERSION / 100, JIM_VERSION % 100); - printf("CVS ID: $Id: jim.c,v 1.159 2005/04/11 14:34:18 antirez Exp $\n"); + printf("CVS ID: $Id: jim.c,v 1.160 2005/04/11 17:25:56 chi Exp $\n"); Jim_SetVariableStrWithStr(interp, "jim_interactive", "1"); while (1) { char buf[1024]; |