| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |