X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=wrappers%2Ftrace.py;h=10f71a4dc7a32362dfafe3d96d68705ed3578db8;hb=a78c14780294e326d79f3968f82de1e7bab412c2;hp=9bacf8a2ff5b4d04bdc1c2f9827b1ac34a3283d0;hpb=621d0b3f841872e7d73465a7ec55afebad17bfdb;p=apitrace diff --git a/wrappers/trace.py b/wrappers/trace.py index 9bacf8a..10f71a4 100644 --- a/wrappers/trace.py +++ b/wrappers/trace.py @@ -213,11 +213,12 @@ class ValueSerializer(stdapi.Visitor, stdapi.ExpanderMixin): # determine the array length which must be passed to writeArray() up front count = '_c' + array.keyType.tag + print ' {' print ' int %s;' % count print ' for (%(c)s = 0; %(array)s && %(array)s[%(c)s] != %(terminator)s; %(c)s += 2) {' \ % {'c': count, 'array': instance, 'terminator': array.terminator} if array.hasKeysWithoutValues: - print ' switch (%(array)s[%(c)s]) {' % {'array': instance, 'c': count} + print ' switch (int(%(array)s[%(c)s])) {' % {'array': instance, 'c': count} for key, valueType in array.valueTypes: if valueType is None: print ' case %s:' % key @@ -238,7 +239,7 @@ class ValueSerializer(stdapi.Visitor, stdapi.ExpanderMixin): print ' if (%(i)s + 1 >= %(count)s) {' % {'i': index, 'count': count} print ' break;' print ' }' - print ' switch (%(array)s[%(i)s++]) {' % {'array': instance, 'i': index} + print ' switch (int(%(array)s[%(i)s++])) {' % {'array': instance, 'i': index} # write generic value the usual way for key, valueType in array.valueTypes: if valueType is not None: @@ -258,13 +259,14 @@ class ValueSerializer(stdapi.Visitor, stdapi.ExpanderMixin): print ' default:' print ' trace::localWriter.beginElement();' print ' os::log("apitrace: warning: %s: unknown key 0x%04X, interpreting value as int\\n", ' + \ - '__FUNCTION__, %(array)s[%(i)s]);' % {'array': instance, 'i': index} + '__FUNCTION__, int(%(array)s[%(i)s]));' % {'array': instance, 'i': index} print ' trace::localWriter.writeSInt(%(array)s[%(i)s]);' % {'array': instance, 'i': index} print ' trace::localWriter.endElement();' print ' break;' print ' }' print ' }' print ' trace::localWriter.endArray();' + print ' }' def visitBlob(self, blob, instance):