Changeset 12435 in webkit for trunk/JavaScriptCore/kjs/number_object.cpp
- Timestamp:
- Jan 28, 2006, 8:12:59 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/number_object.cpp
r12317 r12435 30 30 #include "dtoa.h" 31 31 32 #include <kxmlcore/Vector.h> 33 32 34 #include "number_object.lut.h" 33 35 34 36 #include <assert.h> 35 37 #include <math.h> 38 36 39 using namespace KJS; 37 40 … … 95 98 str += UString("0"); 96 99 } else { 97 char *buf;100 Vector<char, 1024> buf(decimalPoint + 1); 98 101 99 102 if (length <= decimalPoint) { 100 buf = (char*)fastMalloc(decimalPoint+1); 101 strcpy(buf,result); 102 memset(buf+length,'0',decimalPoint-length); 103 } else { 104 buf = (char*)fastMalloc(decimalPoint+1); 105 strncpy(buf,result,decimalPoint); 106 } 103 strcpy(buf, result); 104 memset(buf + length, '0', decimalPoint - length); 105 } else 106 strncpy(buf, result, decimalPoint); 107 107 108 108 buf[decimalPoint] = '\0'; 109 109 str += UString(buf); 110 fastFree(buf);111 110 } 112 111 … … 118 117 static UString char_sequence(char c, int count) 119 118 { 120 char *buf = (char*)fastMalloc(count+1); 121 memset(buf,c,count); 119 Vector<char, 2048> buf(count + 1, c); 122 120 buf[count] = '\0'; 123 UString s(buf); 124 fastFree(buf); 125 return s; 121 122 return UString(buf); 126 123 } 127 124
Note:
See TracChangeset
for help on using the changeset viewer.