File tree Expand file tree Collapse file tree 1 file changed +11
-32
lines changed
Expand file tree Collapse file tree 1 file changed +11
-32
lines changed Original file line number Diff line number Diff line change @@ -256,45 +256,24 @@ class OutBuffer
256256 auto psize = buffer.length;
257257 for (;;)
258258 {
259- version (Windows )
259+ va_list args2;
260+ va_copy(args2, args);
261+ count = vsnprintf(p, psize, f, args2);
262+ va_end(args2);
263+ if (count == - 1 )
260264 {
261- va_list args2;
262- va_copy(args2, args);
263- count = vsnprintf(p,psize,f,args2);
264- va_end(args2);
265- if (count != - 1 )
266- break ;
267-
268265 if (psize > psize.max / 2 ) assert (0 ); // overflow check
269266 psize *= 2 ;
270-
271- p = cast (char * ) alloca(psize); // buffer too small, try again with larger size
272267 }
273- else version ( Posix )
268+ else if (count >= psize )
274269 {
275- va_list args2;
276- va_copy(args2, args);
277- count = vsnprintf(p, psize, f, args2);
278- va_end(args2);
279- if (count == - 1 )
280- {
281- if (psize > psize.max / 2 ) assert (0 ); // overflow check
282- psize *= 2 ;
283- }
284- else if (count >= psize)
285- {
286- if (count == count.max) assert (0 ); // overflow check
287- psize = count + 1 ;
288- }
289- else
290- break ;
291-
292- p = cast (char * ) alloca(psize); // buffer too small, try again with larger size
270+ if (count == count.max) assert (0 ); // overflow check
271+ psize = count + 1 ;
293272 }
294273 else
295- {
296- static assert ( 0 );
297- }
274+ break ;
275+
276+ p = cast ( char * ) alloca(psize); // buffer too small, try again with larger size
298277 }
299278 write(cast (ubyte []) p[0 .. count]);
300279 }
You can’t perform that action at this time.
0 commit comments