Chromium Code Reviews

Side by Side Diff: net/base/net_errors.cc

Issue 5103001: Add shared macros for stringizing and converting ANSI string constants... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
« no previous file with comments | « media/base/media_posix.cc ('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 (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium 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 #include "net/base/net_errors.h" 5 #include "net/base/net_errors.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 8 #include "base/stringize_macros.h"
9 #define STRINGIZE(x) #x
10 9
11 namespace net { 10 namespace net {
12 11
13 const char kErrorDomain[] = "net"; 12 const char kErrorDomain[] = "net";
14 13
15 const char* ErrorToString(int error) { 14 const char* ErrorToString(int error) {
16 if (error == 0) 15 if (error == 0)
17 return "net::OK"; 16 return "net::OK";
18 17
19 switch (error) { 18 switch (error) {
20 #define NET_ERROR(label, value) \ 19 #define NET_ERROR(label, value) \
21 case ERR_ ## label: \ 20 case ERR_ ## label: \
22 return "net::" STRINGIZE(ERR_ ## label); 21 return "net::" STRINGIZE_NO_EXPANSION(ERR_ ## label);
23 #include "net/base/net_error_list.h" 22 #include "net/base/net_error_list.h"
24 #undef NET_ERROR 23 #undef NET_ERROR
25 default: 24 default:
26 return "net::<unknown>"; 25 return "net::<unknown>";
27 } 26 }
28 } 27 }
29 28
30 } // namespace net 29 } // namespace net
OLDNEW
« no previous file with comments | « media/base/media_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine