|
3 | 3 | // |
4 | 4 | // Copyright (C) : 2000 - 2002 |
5 | 5 | // LifeLine Networks BV (www.lifeline.nl). All rights reserved. |
6 | | -// Bastiaan Bakker. All rights reserved. |
7 | | -// |
| 6 | +// Bastiaan Bakker. All rights reserved. |
| 7 | +// |
8 | 8 | // 2004,2005,2006,2007,2008,2009,2010,2011,2012 |
9 | 9 | // Synchrotron SOLEIL |
10 | 10 | // L'Orme des Merisiers |
|
16 | 16 | // it under the terms of the GNU Lesser General Public License as published by |
17 | 17 | // the Free Software Foundation, either version 3 of the License, or |
18 | 18 | // (at your option) any later version. |
19 | | -// |
| 19 | +// |
20 | 20 | // Log4tango is distributed in the hope that it will be useful, |
21 | 21 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
22 | 22 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
23 | 23 | // GNU Lesser General Public License for more details. |
24 | | -// |
| 24 | +// |
25 | 25 | // You should have received a copy of the GNU Lesser General Public License |
26 | 26 | // along with Log4Tango. If not, see <http://www.gnu.org/licenses/>. |
27 | 27 |
|
@@ -57,22 +57,22 @@ namespace log4tango { |
57 | 57 | std::string StringUtil::vform(const char* format, va_list args) { |
58 | 58 | size_t size = 1024; |
59 | 59 | char* buffer = new char[size]; |
60 | | - |
| 60 | + |
61 | 61 | while (1) { |
62 | 62 | int n = VSNPRINTF(buffer, size, format, args); |
63 | | - |
| 63 | + |
64 | 64 | // If that worked, return a string. |
65 | 65 | if ((n > -1) && (static_cast<size_t>(n) < size)) { |
66 | 66 | std::string s(buffer); |
67 | 67 | delete [] buffer; |
68 | 68 | return s; |
69 | 69 | } |
70 | | - |
| 70 | + |
71 | 71 | // Else try again with more space. |
72 | 72 | size = (n > -1) ? |
73 | 73 | n + 1 : // ISO/IEC 9899:1999 |
74 | 74 | size * 2; // twice the old size |
75 | | - |
| 75 | + |
76 | 76 | delete [] buffer; |
77 | 77 | buffer = new char[size]; |
78 | 78 | } |
|
0 commit comments