aboutsummaryrefslogtreecommitdiff
path: root/lobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'lobject.c')
-rw-r--r--lobject.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lobject.c b/lobject.c
index c7d4c06a..d5e9c1ce 100644
--- a/lobject.c
+++ b/lobject.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.c,v 2.121 2017/11/23 19:29:04 roberto Exp roberto $ 2** $Id: lobject.c,v 2.122 2017/12/30 20:46:18 roberto Exp roberto $
3** Some generic functions over Lua objects 3** Some generic functions over Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -204,7 +204,7 @@ static lua_Number lua_strx2number (const char *s, char **endptr) {
204 int e = 0; /* exponent correction */ 204 int e = 0; /* exponent correction */
205 int neg; /* 1 if number is negative */ 205 int neg; /* 1 if number is negative */
206 int hasdot = 0; /* true after seen a dot */ 206 int hasdot = 0; /* true after seen a dot */
207 *endptr = cast(char *, s); /* nothing is valid yet */ 207 *endptr = cast_charp(s); /* nothing is valid yet */
208 while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ 208 while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */
209 neg = isneg(&s); /* check sign */ 209 neg = isneg(&s); /* check sign */
210 if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))) /* check '0x' */ 210 if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))) /* check '0x' */
@@ -226,7 +226,7 @@ static lua_Number lua_strx2number (const char *s, char **endptr) {
226 } 226 }
227 if (nosigdig + sigdig == 0) /* no digits? */ 227 if (nosigdig + sigdig == 0) /* no digits? */
228 return 0.0; /* invalid format */ 228 return 0.0; /* invalid format */
229 *endptr = cast(char *, s); /* valid up to here */ 229 *endptr = cast_charp(s); /* valid up to here */
230 e *= 4; /* each digit multiplies/divides value by 2^4 */ 230 e *= 4; /* each digit multiplies/divides value by 2^4 */
231 if (*s == 'p' || *s == 'P') { /* exponent part? */ 231 if (*s == 'p' || *s == 'P') { /* exponent part? */
232 int exp1 = 0; /* exponent value */ 232 int exp1 = 0; /* exponent value */
@@ -239,7 +239,7 @@ static lua_Number lua_strx2number (const char *s, char **endptr) {
239 exp1 = exp1 * 10 + *(s++) - '0'; 239 exp1 = exp1 * 10 + *(s++) - '0';
240 if (neg1) exp1 = -exp1; 240 if (neg1) exp1 = -exp1;
241 e += exp1; 241 e += exp1;
242 *endptr = cast(char *, s); /* valid up to here */ 242 *endptr = cast_charp(s); /* valid up to here */
243 } 243 }
244 if (neg) r = -r; 244 if (neg) r = -r;
245 return l_mathop(ldexp)(r, e); 245 return l_mathop(ldexp)(r, e);
@@ -353,15 +353,15 @@ int luaO_utf8esc (char *buff, unsigned long x) {
353 int n = 1; /* number of bytes put in buffer (backwards) */ 353 int n = 1; /* number of bytes put in buffer (backwards) */
354 lua_assert(x <= 0x10FFFF); 354 lua_assert(x <= 0x10FFFF);
355 if (x < 0x80) /* ascii? */ 355 if (x < 0x80) /* ascii? */
356 buff[UTF8BUFFSZ - 1] = cast(char, x); 356 buff[UTF8BUFFSZ - 1] = cast_char(x);
357 else { /* need continuation bytes */ 357 else { /* need continuation bytes */
358 unsigned int mfb = 0x3f; /* maximum that fits in first byte */ 358 unsigned int mfb = 0x3f; /* maximum that fits in first byte */
359 do { /* add continuation bytes */ 359 do { /* add continuation bytes */
360 buff[UTF8BUFFSZ - (n++)] = cast(char, 0x80 | (x & 0x3f)); 360 buff[UTF8BUFFSZ - (n++)] = cast_char(0x80 | (x & 0x3f));
361 x >>= 6; /* remove added bits */ 361 x >>= 6; /* remove added bits */
362 mfb >>= 1; /* now there is one less bit available in first byte */ 362 mfb >>= 1; /* now there is one less bit available in first byte */
363 } while (x > mfb); /* still needs continuation byte? */ 363 } while (x > mfb); /* still needs continuation byte? */
364 buff[UTF8BUFFSZ - n] = cast(char, (~mfb << 1) | x); /* add first byte */ 364 buff[UTF8BUFFSZ - n] = cast_char((~mfb << 1) | x); /* add first byte */
365 } 365 }
366 return n; 366 return n;
367} 367}
@@ -417,7 +417,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
417 break; 417 break;
418 } 418 }
419 case 'c': { /* an 'int' as a character */ 419 case 'c': { /* an 'int' as a character */
420 char buff = cast(char, va_arg(argp, int)); 420 char buff = cast_char(va_arg(argp, int));
421 if (lisprint(cast_uchar(buff))) 421 if (lisprint(cast_uchar(buff)))
422 pushstr(L, &buff, 1); 422 pushstr(L, &buff, 1);
423 else /* non-printable character; print its code */ 423 else /* non-printable character; print its code */