comparison src/c/urweb.c @ 276:ed4af33681d8

Switch base types to 64-bit versions
author Adam Chlipala <adamc@hcoop.net>
date Tue, 02 Sep 2008 14:59:27 -0400
parents 4d80d6122df1
children 137744c5b1ae
comparison
equal deleted inserted replaced
275:73456bfde988 276:ed4af33681d8
231 char *lw_Basis_attrifyInt(lw_context ctx, lw_Basis_int n) { 231 char *lw_Basis_attrifyInt(lw_context ctx, lw_Basis_int n) {
232 char *result; 232 char *result;
233 int len; 233 int len;
234 lw_check_heap(ctx, INTS_MAX); 234 lw_check_heap(ctx, INTS_MAX);
235 result = ctx->heap_front; 235 result = ctx->heap_front;
236 sprintf(result, "%d%n", n, &len); 236 sprintf(result, "%lld%n", n, &len);
237 ctx->heap_front += len+1; 237 ctx->heap_front += len+1;
238 return result; 238 return result;
239 } 239 }
240 240
241 char *lw_Basis_attrifyFloat(lw_context ctx, lw_Basis_float n) { 241 char *lw_Basis_attrifyFloat(lw_context ctx, lw_Basis_float n) {
280 } 280 }
281 281
282 static void lw_Basis_attrifyInt_w_unsafe(lw_context ctx, lw_Basis_int n) { 282 static void lw_Basis_attrifyInt_w_unsafe(lw_context ctx, lw_Basis_int n) {
283 int len; 283 int len;
284 284
285 sprintf(ctx->page_front, "%d%n", n, &len); 285 sprintf(ctx->page_front, "%lld%n", n, &len);
286 ctx->page_front += len; 286 ctx->page_front += len;
287 } 287 }
288 288
289 void lw_Basis_attrifyInt_w(lw_context ctx, lw_Basis_int n) { 289 void lw_Basis_attrifyInt_w(lw_context ctx, lw_Basis_int n) {
290 lw_check(ctx, INTS_MAX); 290 lw_check(ctx, INTS_MAX);
324 int len; 324 int len;
325 char *r; 325 char *r;
326 326
327 lw_check_heap(ctx, INTS_MAX); 327 lw_check_heap(ctx, INTS_MAX);
328 r = ctx->heap_front; 328 r = ctx->heap_front;
329 sprintf(r, "%d%n", n, &len); 329 sprintf(r, "%lld%n", n, &len);
330 ctx->heap_front += len+1; 330 ctx->heap_front += len+1;
331 return r; 331 return r;
332 } 332 }
333 333
334 char *lw_Basis_urlifyFloat(lw_context ctx, lw_Basis_float n) { 334 char *lw_Basis_urlifyFloat(lw_context ctx, lw_Basis_float n) {
373 } 373 }
374 374
375 static void lw_Basis_urlifyInt_w_unsafe(lw_context ctx, lw_Basis_int n) { 375 static void lw_Basis_urlifyInt_w_unsafe(lw_context ctx, lw_Basis_int n) {
376 int len; 376 int len;
377 377
378 sprintf(ctx->page_front, "%d%n", n, &len); 378 sprintf(ctx->page_front, "%lld%n", n, &len);
379 ctx->page_front += len; 379 ctx->page_front += len;
380 } 380 }
381 381
382 void lw_Basis_urlifyInt_w(lw_context ctx, lw_Basis_int n) { 382 void lw_Basis_urlifyInt_w(lw_context ctx, lw_Basis_int n) {
383 lw_check(ctx, INTS_MAX); 383 lw_check(ctx, INTS_MAX);
428 return new_s; 428 return new_s;
429 } 429 }
430 430
431 lw_Basis_int lw_Basis_unurlifyInt(lw_context ctx, char **s) { 431 lw_Basis_int lw_Basis_unurlifyInt(lw_context ctx, char **s) {
432 char *new_s = lw_unurlify_advance(*s); 432 char *new_s = lw_unurlify_advance(*s);
433 int r; 433 lw_Basis_int r;
434 434
435 r = atoi(*s); 435 r = atoll(*s);
436 *s = new_s; 436 *s = new_s;
437 return r; 437 return r;
438 } 438 }
439 439
440 lw_Basis_float lw_Basis_unurlifyFloat(lw_context ctx, char **s) { 440 lw_Basis_float lw_Basis_unurlifyFloat(lw_context ctx, char **s) {
441 char *new_s = lw_unurlify_advance(*s); 441 char *new_s = lw_unurlify_advance(*s);
442 int r; 442 lw_Basis_float r;
443 443
444 r = atof(*s); 444 r = atof(*s);
445 *s = new_s; 445 *s = new_s;
446 return r; 446 return r;
447 } 447 }