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

Unified Diff: ppapi/generators/idl_c_proto.py

Issue 490433002: PPAPI: make generator output a pointer to an array correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/generators/idl_c_proto.py
diff --git a/ppapi/generators/idl_c_proto.py b/ppapi/generators/idl_c_proto.py
index a6179a8f4b677fde965621e9721bb05a767b8435..d029f93d04d795d32aad8b7fe4d71add1eb2266c 100755
--- a/ppapi/generators/idl_c_proto.py
+++ b/ppapi/generators/idl_c_proto.py
@@ -384,6 +384,13 @@ class CGen(object):
# Generate passing type by modifying root type
rtype = self.GetTypeByMode(node, release, mode)
+ # If this is an array output, change it from type* foo[] to type** foo.
+ # type* foo[] means an array of pointers to type, which is confusing.
Justin Chuang 2014/08/19 17:31:13 nit: optionally elaborate more like this: Functio
dmichael (off chromium) 2014/08/19 21:43:21 I don't mean to come off as harsh, but I'm not sur
+ arrayspec = [self.GetArraySpec(array) for array in node.GetListOf('Array')]
+ if mode == 'out' and len(arrayspec) == 1 and arrayspec[0] == '[]':
+ rtype += '*'
+ del arrayspec[0]
+
if node.IsA('Enum', 'Interface', 'Struct'):
rname = node.GetName()
else:
@@ -394,7 +401,6 @@ class CGen(object):
if '%' in rtype:
rtype = rtype % rname
name = node.GetName()
- arrayspec = [self.GetArraySpec(array) for array in node.GetListOf('Array')]
callnode = node.GetOneOf('Callspec')
if callnode:
callspec = []
« no previous file with comments | « ppapi/c/private/ppp_flash_browser_operations.h ('k') | ppapi/thunk/ppb_camera_capabilities_private_thunk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698