OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include <stddef.h> // For offsetof(). | 7 #include <stddef.h> // For offsetof(). |
8 #include <cctype> | 8 #include <cctype> |
9 | 9 |
10 #include "core/include/fxcrt/fx_basic.h" | 10 #include "core/include/fxcrt/fx_basic.h" |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 nMaxLen += FXSYS_strlen(lpsz); | 479 nMaxLen += FXSYS_strlen(lpsz); |
480 continue; | 480 continue; |
481 } | 481 } |
482 int nItemLen = 0; | 482 int nItemLen = 0; |
483 int nWidth = 0; | 483 int nWidth = 0; |
484 for (; *lpsz != 0; lpsz++) { | 484 for (; *lpsz != 0; lpsz++) { |
485 if (*lpsz == '#') { | 485 if (*lpsz == '#') { |
486 nMaxLen += 2; | 486 nMaxLen += 2; |
487 } else if (*lpsz == '*') { | 487 } else if (*lpsz == '*') { |
488 nWidth = va_arg(argList, int); | 488 nWidth = va_arg(argList, int); |
489 } else if (*lpsz == '-' || *lpsz == '+' || *lpsz == '0' || *lpsz == ' ') | 489 } else if (*lpsz != '-' && *lpsz != '+' && *lpsz != '0' && *lpsz != ' ') { |
490 ; | |
491 else { | |
492 break; | 490 break; |
493 } | 491 } |
494 } | 492 } |
495 if (nWidth == 0) { | 493 if (nWidth == 0) { |
496 nWidth = FXSYS_atoi(lpsz); | 494 nWidth = FXSYS_atoi(lpsz); |
497 while (std::isdigit(*lpsz)) | 495 while (std::isdigit(*lpsz)) |
498 lpsz++; | 496 lpsz++; |
499 } | 497 } |
500 if (nWidth < 0 || nWidth > 128 * 1024) { | 498 if (nWidth < 0 || nWidth > 128 * 1024) { |
501 lpszFormat = "Bad width"; | 499 lpszFormat = "Bad width"; |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 fraction %= scale; | 1079 fraction %= scale; |
1082 scale /= 10; | 1080 scale /= 10; |
1083 } | 1081 } |
1084 return buf_size; | 1082 return buf_size; |
1085 } | 1083 } |
1086 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { | 1084 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { |
1087 FX_CHAR buf[32]; | 1085 FX_CHAR buf[32]; |
1088 FX_STRSIZE len = FX_ftoa(d, buf); | 1086 FX_STRSIZE len = FX_ftoa(d, buf); |
1089 return CFX_ByteString(buf, len); | 1087 return CFX_ByteString(buf, len); |
1090 } | 1088 } |
OLD | NEW |