40 #define SMALL_BUFFER_LENGTH (PH_OBJECT_SMALL_OBJECT_SIZE - FIELD_OFFSET(PH_STRING, Data) - sizeof(WCHAR))
41 #define BUFFER_SIZE 512
43 #define PHP_FORMAT_NEGATIVE 0x1
44 #define PHP_FORMAT_POSITIVE 0x2
45 #define PHP_FORMAT_PAD 0x4
49 errno_t __cdecl
_cfltcvt_l(
double *arg,
char *buffer,
size_t sizeInBytes,
50 int format,
int precision,
int caps, _locale_t plocinfo);
52 void __cdecl
_cropzeros_l(
char *_Buf, _locale_t _Locale);
53 void __cdecl
_forcdecpt_l(
char *_Buf, _locale_t _Locale);
68 static WCHAR PhpFormatDecimalSeparator =
'.';
69 static WCHAR PhpFormatThousandSeparator =
',';
70 static _locale_t PhpFormatUserLocale = NULL;
74 _Inout_ PSIZE_T AllocatedLength,
75 _In_ SIZE_T UsedLength,
76 _In_ SIZE_T NeededLength
80 SIZE_T allocatedLength;
82 allocatedLength = *AllocatedLength;
85 if (allocatedLength < UsedLength + NeededLength)
86 allocatedLength = UsedLength + NeededLength;
89 memcpy(newString->
Buffer, String->Buffer, UsedLength);
92 *AllocatedLength = allocatedLength;
108 _In_opt_ SIZE_T InitialCapacity
112 SIZE_T allocatedLength;
125 allocatedLength = InitialCapacity;
126 buffer =
string->Buffer;
131 #undef ADVANCE_BUFFER
133 #define ENSURE_BUFFER(NeededLength) \
135 if (allocatedLength < usedLength + (NeededLength)) \
137 string = PhpResizeFormatBuffer(string, &allocatedLength, usedLength, (NeededLength)); \
138 buffer = string->Buffer + usedLength / sizeof(WCHAR); \
142 #define OK_BUFFER (TRUE)
144 #define ADVANCE_BUFFER(Length) \
145 do { buffer += (Length) / sizeof(WCHAR); usedLength += (Length); } while (0)
149 string->Length = usedLength;
151 string->Buffer[usedLength /
sizeof(WCHAR)] = 0;
178 _Out_writes_bytes_opt_(BufferLength) PWSTR Buffer,
179 _In_opt_ SIZE_T BufferLength,
180 _Out_opt_ PSIZE_T ReturnLength
197 #undef ADVANCE_BUFFER
199 #define ENSURE_BUFFER(NeededLength) \
201 if (!overrun && (BufferLength < usedLength + (NeededLength))) \
205 #define OK_BUFFER (!overrun)
207 #define ADVANCE_BUFFER(Length) \
208 do { buffer += (Length) / sizeof(WCHAR); usedLength += (Length); } while (0)
216 else if (Buffer && BufferLength != 0)
221 *ReturnLength = usedLength;