OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights
reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights
reserved. |
4 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 4 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 if (!m_impl) | 405 if (!m_impl) |
406 return 0; | 406 return 0; |
407 if (m_impl->hasTerminatingNullCharacter()) | 407 if (m_impl->hasTerminatingNullCharacter()) |
408 return m_impl->characters(); | 408 return m_impl->characters(); |
409 m_impl = StringImpl::createWithTerminatingNullCharacter(*m_impl); | 409 m_impl = StringImpl::createWithTerminatingNullCharacter(*m_impl); |
410 return m_impl->characters(); | 410 return m_impl->characters(); |
411 } | 411 } |
412 | 412 |
413 String String::format(const char *format, ...) | 413 String String::format(const char *format, ...) |
414 { | 414 { |
415 #if PLATFORM(QT) | 415 #if OS(WINCE) |
416 // Use QString::vsprintf to avoid the locale dependent formatting of vsnprin
tf. | |
417 // https://bugs.webkit.org/show_bug.cgi?id=18994 | |
418 va_list args; | 416 va_list args; |
419 va_start(args, format); | 417 va_start(args, format); |
420 | 418 |
421 QString buffer; | |
422 buffer.vsprintf(format, args); | |
423 | |
424 va_end(args); | |
425 | |
426 QByteArray ba = buffer.toUtf8(); | |
427 return StringImpl::create(reinterpret_cast<const LChar*>(ba.constData()), ba
.length()); | |
428 | |
429 #elif OS(WINCE) | |
430 va_list args; | |
431 va_start(args, format); | |
432 | |
433 Vector<char, 256> buffer; | 419 Vector<char, 256> buffer; |
434 | 420 |
435 int bufferSize = 256; | 421 int bufferSize = 256; |
436 buffer.resize(bufferSize); | 422 buffer.resize(bufferSize); |
437 for (;;) { | 423 for (;;) { |
438 int written = vsnprintf(buffer.data(), bufferSize, format, args); | 424 int written = vsnprintf(buffer.data(), bufferSize, format, args); |
439 va_end(args); | 425 va_end(args); |
440 | 426 |
441 if (written == 0) | 427 if (written == 0) |
442 return String(""); | 428 return String(""); |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 buffer.append('\0'); | 1249 buffer.append('\0'); |
1264 return buffer; | 1250 return buffer; |
1265 } | 1251 } |
1266 | 1252 |
1267 Vector<char> asciiDebug(String& string) | 1253 Vector<char> asciiDebug(String& string) |
1268 { | 1254 { |
1269 return asciiDebug(string.impl()); | 1255 return asciiDebug(string.impl()); |
1270 } | 1256 } |
1271 | 1257 |
1272 #endif | 1258 #endif |
OLD | NEW |