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

Side by Side Diff: src/core/SkError.cpp

Issue 2391133005: remove sprintf (Closed)
Patch Set: Created 4 years, 2 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 | src/core/SkRegion.cpp » ('j') | tests/PathOpsOpCircleThreadedTest.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkTLS.h" 8 #include "SkTLS.h"
9 #include "SkTypes.h" 9 #include "SkTypes.h"
10 #include "SkError.h" 10 #include "SkError.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 error_name = "Out Of Memory"; 109 error_name = "Out Of Memory";
110 break; 110 break;
111 case kParseError_SkError: 111 case kParseError_SkError:
112 error_name = "Parse Error"; 112 error_name = "Parse Error";
113 break; 113 break;
114 default: 114 default:
115 error_name = "Unknown error"; 115 error_name = "Unknown error";
116 break; 116 break;
117 } 117 }
118 118
119 sprintf( str, "%s: ", error_name ); 119 snprintf( str, ERROR_STRING_LENGTH, "%s: ", error_name );
120 int string_left = SkToInt(ERROR_STRING_LENGTH - strlen(str)); 120 int string_left = SkToInt(ERROR_STRING_LENGTH - strlen(str));
121 str += strlen(str); 121 str += strlen(str);
122 122
123 va_start( args, fmt ); 123 va_start( args, fmt );
124 vsnprintf( str, string_left, fmt, args ); 124 vsnprintf( str, string_left, fmt, args );
125 va_end( args ); 125 va_end( args );
126 SkErrorCallbackFunction fn = THREAD_ERROR_CALLBACK; 126 SkErrorCallbackFunction fn = THREAD_ERROR_CALLBACK;
127 if (fn && code != kNoError_SkError) { 127 if (fn && code != kNoError_SkError) {
128 fn(code, THREAD_ERROR_CONTEXT); 128 fn(code, THREAD_ERROR_CONTEXT);
129 } 129 }
130 } 130 }
OLDNEW
« no previous file with comments | « no previous file | src/core/SkRegion.cpp » ('j') | tests/PathOpsOpCircleThreadedTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698