1 /****************************************************************************
3 GLUI User Interface Toolkit
4 ---------------------------
9 --------------------------------------------------
11 Copyright (c) 1998 Paul Rademacher (this file, Bill Baxter 2005)
13 This library is free software; you can redistribute it and/or modify
14 it under the terms of the GNU Lesser General Public License as
15 published by the Free Software Foundation; either version 2.1 of the
16 License, or (at your option) any later version.
18 This library is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
23 You should have received a copy of the GNU Lesser General Public
24 License along with this library; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
28 This program is -not- in the public domain.
30 *****************************************************************************/
35 #if defined (_MSC_VER) && (_MSC_VER < 1500)
36 #define vsnprintf _vsnprintf
39 GLUI_String& glui_format_str(GLUI_String& str, const char* fmt, ...)
41 const size_t ISIZE = 128;
49 int ret = vsnprintf(buf,299,fmt,arg);
54 // else make a bigger buf, try again
56 if (buf==stackbuf) buf = (char*)malloc(sizeof(char)*bufsz);
57 else buf = (char*)realloc(buf, sizeof(char)*bufsz);
59 if (buf!=stackbuf) free(buf);