Branch: Tag:

2004-11-11

2004-11-11 16:01:05 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Now uses SNPRINTF() in preference to snprintf().
Added support for the 't' and 'z' integer field widths.

Rev: src/stralloc.c:1.190

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: stralloc.c,v 1.189 2004/11/11 14:57:11 grubba Exp $ + || $Id: stralloc.c,v 1.190 2004/11/11 16:01:05 grubba Exp $   */      #include "global.h"
19:   #include "block_alloc.h"   #include "operators.h"   #include "pike_float.h" + #include "port.h"      #include <errno.h>   #include <float.h>
2403:    }    continue;    +  case 't': /* ptrdiff_t */ +  case 'z': /* size_t */ +  flags = (flags & ~APPEND_WIDTH_MASK) | APPEND_WIDTH_PTR; +  continue; +     case 'O':    {    /* FIXME: Doesn't care about field or integer widths yet. */
2543:    break;    }    /* FIXME: Field lengths and precision. */ -  if ((bytes = snprintf(NULL, 0, "%f", val))) { +  if ((bytes = SNPRINTF(NULL, 0, "%f", val))) {    p_wchar0 *p = string_builder_allocate(s, bytes, 0); -  size_t check = snprintf(p, bytes+1, "%f", val); +  size_t check = SNPRINTF(p, bytes+1, "%f", val);    if (check != bytes) {    Pike_fatal("string_builder_vsprintf(): snprintf(%f) is not "    "trustworthy: %"PRINTSIZET"u != %"PRINTSIZET"u\n",