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

Side by Side Diff: core/src/fxcrt/fx_basic_util.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/include/fxcrt/fx_system.h ('k') | core/src/fxcrt/fx_basic_wstring.cpp » ('j') | 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 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 8 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <dirent.h> 10 #include <dirent.h>
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 value += fraction_scales[scale] * (str[cc] - '0'); 162 value += fraction_scales[scale] * (str[cc] - '0');
163 scale ++; 163 scale ++;
164 if (scale == sizeof fraction_scales / sizeof(FX_FLOAT)) { 164 if (scale == sizeof fraction_scales / sizeof(FX_FLOAT)) {
165 break; 165 break;
166 } 166 }
167 cc ++; 167 cc ++;
168 } 168 }
169 } 169 }
170 return bNegative ? -value : value; 170 return bNegative ? -value : value;
171 } 171 }
172
173 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ && _MSC_VER < 1900
174 void FXSYS_snprintf(char *str, size_t size, _Printf_format_string_ const char* f mt, ...)
175 {
176 va_list ap;
177 va_start(ap, fmt);
178 FXSYS_vsnprintf(str, size, fmt, ap);
179 va_end(ap);
180 }
181 void FXSYS_vsnprintf(char *str, size_t size, const char* fmt, va_list ap)
182 {
183 (void) _vsnprintf(str, size, fmt, ap);
184 if (size) {
185 str[size - 1] = 0;
186 }
187 }
188 #endif // _FXM_PLATFORM_WINDOWS_ && _MSC_VER < 1900
189
172 static FX_BOOL FX_IsDigit(FX_BYTE ch) 190 static FX_BOOL FX_IsDigit(FX_BYTE ch)
173 { 191 {
174 return (ch >= '0' && ch <= '9') ? TRUE : FALSE; 192 return (ch >= '0' && ch <= '9') ? TRUE : FALSE;
175 } 193 }
176 static FX_BOOL FX_IsXDigit(FX_BYTE ch) 194 static FX_BOOL FX_IsXDigit(FX_BYTE ch)
177 { 195 {
178 return (FX_IsDigit(ch) || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f ')) ? TRUE : FALSE; 196 return (FX_IsDigit(ch) || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f ')) ? TRUE : FALSE;
179 } 197 }
180 static FX_BYTE FX_MakeUpper(FX_BYTE ch) 198 static FX_BYTE FX_MakeUpper(FX_BYTE ch)
181 { 199 {
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } 496 }
479 497
480 CFX_Vector_3by1 CFX_Matrix_3by3::TransformVector(const CFX_Vector_3by1 &v) 498 CFX_Vector_3by1 CFX_Matrix_3by3::TransformVector(const CFX_Vector_3by1 &v)
481 { 499 {
482 return CFX_Vector_3by1( 500 return CFX_Vector_3by1(
483 a * v.a + b * v.b + c * v.c, 501 a * v.a + b * v.b + c * v.c,
484 d * v.a + e * v.b + f * v.c, 502 d * v.a + e * v.b + f * v.c,
485 g * v.a + h * v.b + i * v.c 503 g * v.a + h * v.b + i * v.c
486 ); 504 );
487 } 505 }
OLDNEW
« no previous file with comments | « core/include/fxcrt/fx_system.h ('k') | core/src/fxcrt/fx_basic_wstring.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698