From 4fb1ab04af9593b7aea4be4ef8b5e56eec4f5f0d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 8 Nov 2012 10:23:40 +0000 Subject: [PATCH] Don't defer arguments when functions fail. --- wrappers/trace.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wrappers/trace.py b/wrappers/trace.py index 5d0a566..da61e2a 100644 --- a/wrappers/trace.py +++ b/wrappers/trace.py @@ -494,10 +494,12 @@ class Tracer: self.invokeFunction(function) if not function.internal: print ' trace::localWriter.beginLeave(_call);' + print ' if (%s) {' % self.wasFunctionSuccessful(function) for arg in function.args: if arg.output: self.serializeArg(function, arg) self.wrapArg(function, arg) + print ' }' if function.type is not stdapi.Void: self.serializeRet(function, "_result") print ' trace::localWriter.endLeave();' @@ -512,6 +514,13 @@ class Tracer: dispatch = prefix + function.name + suffix print ' %s%s(%s);' % (result, dispatch, ', '.join([str(arg.name) for arg in function.args])) + def wasFunctionSuccessful(self, function): + if function.type is stdapi.Void: + return 'true' + if str(function.type) == 'HRESULT': + return 'SUCCEEDED(_result)' + return 'false' + def serializeArg(self, function, arg): print ' trace::localWriter.beginArg(%u);' % (arg.index,) self.serializeArgValue(function, arg) @@ -651,10 +660,13 @@ class Tracer: self.invokeMethod(interface, base, method) print ' trace::localWriter.beginLeave(_call);' + + print ' if (%s) {' % self.wasFunctionSuccessful(method) for arg in method.args: if arg.output: self.serializeArg(method, arg) self.wrapArg(method, arg) + print ' }' if method.type is not stdapi.Void: self.serializeRet(method, '_result') -- 2.43.0