1 |
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
2 |
* |
* |
3 |
* ***** BEGIN LICENSE BLOCK ***** |
* ***** BEGIN LICENSE BLOCK ***** |
4 |
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
40 |
/* |
/* |
41 |
* Portable double to alphanumeric string and back converters. |
* Portable double to alphanumeric string and back converters. |
42 |
*/ |
*/ |
|
#include "jsstddef.h" |
|
|
#include "jslibmath.h" |
|
43 |
#include "jstypes.h" |
#include "jstypes.h" |
44 |
|
#include "jsstdint.h" |
45 |
#include "jsdtoa.h" |
#include "jsdtoa.h" |
46 |
#include "jsprf.h" |
#include "jsprf.h" |
47 |
#include "jsutil.h" /* Added by JSIFY */ |
#include "jsutil.h" /* Added by JSIFY */ |
48 |
#include "jspubtd.h" |
#include "jsprvtd.h" |
49 |
#include "jsnum.h" |
#include "jsnum.h" |
50 |
#include "jsbit.h" |
#include "jsbit.h" |
51 |
|
#include "jslibmath.h" |
52 |
|
|
53 |
#ifdef JS_THREADSAFE |
#ifdef JS_THREADSAFE |
54 |
#include "jslock.h" |
#include "jslock.h" |
368 |
JS_ASSERT(base >= 2 && base <= 36); |
JS_ASSERT(base >= 2 && base <= 36); |
369 |
|
|
370 |
dval(d) = dinput; |
dval(d) = dinput; |
371 |
buffer = (char*) malloc(DTOBASESTR_BUFFER_SIZE); |
buffer = (char*) js_malloc(DTOBASESTR_BUFFER_SIZE); |
372 |
if (buffer) { |
if (buffer) { |
373 |
p = buffer; |
p = buffer; |
374 |
if (dval(d) < 0.0 |
if (dval(d) < 0.0 |
412 |
nomem1: |
nomem1: |
413 |
Bfree(b); |
Bfree(b); |
414 |
UNLOCK_DTOA(); |
UNLOCK_DTOA(); |
415 |
free(buffer); |
js_free(buffer); |
416 |
return NULL; |
return NULL; |
417 |
} |
} |
418 |
do { |
do { |
449 |
Bfree(mlo); |
Bfree(mlo); |
450 |
Bfree(mhi); |
Bfree(mhi); |
451 |
UNLOCK_DTOA(); |
UNLOCK_DTOA(); |
452 |
free(buffer); |
js_free(buffer); |
453 |
return NULL; |
return NULL; |
454 |
} |
} |
455 |
JS_ASSERT(e < 0); |
JS_ASSERT(e < 0); |