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

Side by Side Diff: tools/json_schema_compiler/cc_generator.py

Issue 121123002: Update uses of UTF conversions in ppapi/, printing/, remoting/, rlz/, sandbox/, skia/, sql/, sync/,… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 from code import Code 5 from code import Code
6 from model import PropertyType 6 from model import PropertyType
7 import cpp_util 7 import cpp_util
8 import schema_util 8 import schema_util
9 import util_cc_helper 9 import util_cc_helper
10 10
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 920
921 def _GenerateError(self, body): 921 def _GenerateError(self, body):
922 """Generates an error message pertaining to population failure. 922 """Generates an error message pertaining to population failure.
923 923
924 E.g 'expected bool, got int' 924 E.g 'expected bool, got int'
925 """ 925 """
926 c = Code() 926 c = Code()
927 if not self._generate_error_messages: 927 if not self._generate_error_messages:
928 return c 928 return c
929 (c.Append('if (error)') 929 (c.Append('if (error)')
930 .Append(' *error = UTF8ToUTF16(' + body + ');')) 930 .Append(' *error = base::UTF8ToUTF16(' + body + ');'))
931 return c 931 return c
932 932
933 def _GenerateParams(self, params): 933 def _GenerateParams(self, params):
934 """Builds the parameter list for a function, given an array of parameters. 934 """Builds the parameter list for a function, given an array of parameters.
935 """ 935 """
936 if self._generate_error_messages: 936 if self._generate_error_messages:
937 params = list(params) + ['base::string16* error'] 937 params = list(params) + ['base::string16* error']
938 return ', '.join(str(p) for p in params) 938 return ', '.join(str(p) for p in params)
939 939
940 def _GenerateArgs(self, args): 940 def _GenerateArgs(self, args):
941 """Builds the argument list for a function, given an array of arguments. 941 """Builds the argument list for a function, given an array of arguments.
942 """ 942 """
943 if self._generate_error_messages: 943 if self._generate_error_messages:
944 args = list(args) + ['error'] 944 args = list(args) + ['error']
945 return ', '.join(str(a) for a in args) 945 return ', '.join(str(a) for a in args)
OLDNEW
« no previous file with comments | « tools/ipc_fuzzer/mutate/mutate.cc ('k') | tools/json_schema_compiler/test/error_generation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698