Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: core/src/fxcrt/fx_basic_wstring.cpp

Issue 1077903002: Better fix for snprintf non-termination on windows. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix #endif // comment Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxcrt/fx_basic_util.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "../../include/fxcrt/fx_basic.h" 7 #include "../../include/fxcrt/fx_basic.h"
8 #include "../../../third_party/base/numerics/safe_math.h" 8 #include "../../../third_party/base/numerics/safe_math.h"
9 9
10 static CFX_StringDataW* FX_AllocStringW(int nLen) 10 static CFX_StringDataW* FX_AllocStringW(int nLen)
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 nItemLen = 128; 969 nItemLen = 128;
970 if (nItemLen < nWidth + nPrecision) { 970 if (nItemLen < nWidth + nPrecision) {
971 nItemLen = nWidth + nPrecision; 971 nItemLen = nWidth + nPrecision;
972 } 972 }
973 break; 973 break;
974 case 'f': 974 case 'f':
975 if (nWidth + nPrecision > 100) { 975 if (nWidth + nPrecision > 100) {
976 nItemLen = nPrecision + nWidth + 128; 976 nItemLen = nPrecision + nWidth + 128;
977 } else { 977 } else {
978 double f; 978 double f;
979 char pszTemp[256] = {0}; 979 char pszTemp[256];
980 f = va_arg(argList, double); 980 f = va_arg(argList, double);
981 FXSYS_snprintf(pszTemp, sizeof(pszTemp) - 1, "%*.*f", nW idth, nPrecision + 6, f ); 981 FXSYS_snprintf(pszTemp, sizeof(pszTemp), "%*.*f", nWidth , nPrecision + 6, f );
982 nItemLen = (FX_STRSIZE)FXSYS_strlen(pszTemp); 982 nItemLen = (FX_STRSIZE)FXSYS_strlen(pszTemp);
983 } 983 }
984 break; 984 break;
985 case 'p': 985 case 'p':
986 va_arg(argList, void*); 986 va_arg(argList, void*);
987 nItemLen = 32; 987 nItemLen = 32;
988 if (nItemLen < nWidth + nPrecision) { 988 if (nItemLen < nWidth + nPrecision) {
989 nItemLen = nWidth + nPrecision; 989 nItemLen = nWidth + nPrecision;
990 } 990 }
991 break; 991 break;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 return (CFX_CharMap*)&g_DefaultJISMapper; 1116 return (CFX_CharMap*)&g_DefaultJISMapper;
1117 case 936: 1117 case 936:
1118 return (CFX_CharMap*)&g_DefaultGBKMapper; 1118 return (CFX_CharMap*)&g_DefaultGBKMapper;
1119 case 949: 1119 case 949:
1120 return (CFX_CharMap*)&g_DefaultUHCMapper; 1120 return (CFX_CharMap*)&g_DefaultUHCMapper;
1121 case 950: 1121 case 950:
1122 return (CFX_CharMap*)&g_DefaultBig5Mapper; 1122 return (CFX_CharMap*)&g_DefaultBig5Mapper;
1123 } 1123 }
1124 return NULL; 1124 return NULL;
1125 } 1125 }
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_basic_util.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698