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

Side by Side Diff: core/include/fxcrt/fx_system.h

Issue 1077903002: Better fix for snprintf non-termination on windows. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Implement Bruce's suggestion about void returns. 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 | « no previous file | core/src/fxcrt/fx_basic_util.cpp » ('j') | core/src/fxcrt/fx_basic_util.cpp » ('J')
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 #ifndef _FX_SYSTEM_H_ 7 #ifndef _FX_SYSTEM_H_
8 #define _FX_SYSTEM_H_ 8 #define _FX_SYSTEM_H_
9 #define _FX_WIN32_DESKTOP_ 1 9 #define _FX_WIN32_DESKTOP_ 1
10 #define _FX_LINUX_DESKTOP_ 4 10 #define _FX_LINUX_DESKTOP_ 4
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 #ifdef _DEBUG 130 #ifdef _DEBUG
131 #define ASSERT FXSYS_assert 131 #define ASSERT FXSYS_assert
132 #else 132 #else
133 133
134 #define ASSERT(a) 134 #define ASSERT(a)
135 #endif 135 #endif
136 #endif 136 #endif
137 #define FX_MAX(a, b) (((a) > (b)) ? (a) : (b)) 137 #define FX_MAX(a, b) (((a) > (b)) ? (a) : (b))
138 #define FX_MIN(a, b) (((a) < (b)) ? (a) : (b)) 138 #define FX_MIN(a, b) (((a) < (b)) ? (a) : (b))
139 #define FX_PI 3.1415926535897932384626433832795f 139 #define FX_PI 3.1415926535897932384626433832795f
140
141 // NOTE: never trust the return value from snprintf(), but provide versions
142 // that always NUL-terminate.
140 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 143 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
brucedawson 2015/04/10 18:03:02 Consider making times version limited. When VS 201
Tom Sepez 2015/04/10 18:23:40 Done.
141 #define FXSYS_snprintf» _snprintf 144 void FXSYS_snprintf(char *str, size_t size, const char* fmt, ...);
brucedawson 2015/04/10 18:03:02 Consider adding SAL annotations that let /analyze
Tom Sepez 2015/04/10 18:23:40 Done.
142 #define FXSYS_vsnprintf»_vsnprintf 145 void FXSYS_vsnprintf(char *str, size_t size, const char* fmt, va_list ap);
143 #else 146 #else
144 #define FXSYS_snprintf» snprintf 147 #define FXSYS_snprintf» (void) snprintf
145 #define FXSYS_vsnprintf»vsnprintf 148 #define FXSYS_vsnprintf»(void) vsnprintf
146 #endif 149 #endif
150
147 #define FXSYS_sprintf DO_NOT_USE_SPRINTF_DIE_DIE_DIE 151 #define FXSYS_sprintf DO_NOT_USE_SPRINTF_DIE_DIE_DIE
148 #define FXSYS_vsprintf DO_NOT_USE_VSPRINTF_DIE_DIE_DIE 152 #define FXSYS_vsprintf DO_NOT_USE_VSPRINTF_DIE_DIE_DIE
149 #define FXSYS_strchr strchr 153 #define FXSYS_strchr strchr
150 #define FXSYS_strlen strlen 154 #define FXSYS_strlen strlen
151 #define FXSYS_strncmp strncmp 155 #define FXSYS_strncmp strncmp
152 #define FXSYS_strcmp strcmp 156 #define FXSYS_strcmp strcmp
153 #define FXSYS_strcpy strcpy 157 #define FXSYS_strcpy strcpy
154 #define FXSYS_strncpy strncpy 158 #define FXSYS_strncpy strncpy
155 #define FXSYS_strstr strstr 159 #define FXSYS_strstr strstr
156 #define FXSYS_FILE FILE 160 #define FXSYS_FILE FILE
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 319
316 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 320 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
317 321
318 #if !defined(PRIuS) 322 #if !defined(PRIuS)
319 #define PRIuS "Iu" 323 #define PRIuS "Iu"
320 #endif 324 #endif
321 325
322 #endif 326 #endif
323 327
324 #endif 328 #endif
OLDNEW
« no previous file with comments | « no previous file | core/src/fxcrt/fx_basic_util.cpp » ('j') | core/src/fxcrt/fx_basic_util.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698