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 == ' ') { |
Lei Zhang
2016/02/24 01:37:01
negate this and break?
dsinclair
2016/02/24 14:51:08
Done.
| |
490 ; | 490 } else { |
491 else { | |
492 break; | 491 break; |
493 } | 492 } |
494 } | 493 } |
495 if (nWidth == 0) { | 494 if (nWidth == 0) { |
496 nWidth = FXSYS_atoi(lpsz); | 495 nWidth = FXSYS_atoi(lpsz); |
497 while (std::isdigit(*lpsz)) | 496 while (std::isdigit(*lpsz)) |
498 lpsz++; | 497 lpsz++; |
499 } | 498 } |
500 if (nWidth < 0 || nWidth > 128 * 1024) { | 499 if (nWidth < 0 || nWidth > 128 * 1024) { |
501 lpszFormat = "Bad width"; | 500 lpszFormat = "Bad width"; |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1081 fraction %= scale; | 1080 fraction %= scale; |
1082 scale /= 10; | 1081 scale /= 10; |
1083 } | 1082 } |
1084 return buf_size; | 1083 return buf_size; |
1085 } | 1084 } |
1086 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { | 1085 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { |
1087 FX_CHAR buf[32]; | 1086 FX_CHAR buf[32]; |
1088 FX_STRSIZE len = FX_ftoa(d, buf); | 1087 FX_STRSIZE len = FX_ftoa(d, buf); |
1089 return CFX_ByteString(buf, len); | 1088 return CFX_ByteString(buf, len); |
1090 } | 1089 } |
OLD | NEW |