From: José Fonseca Date: Thu, 21 Apr 2011 08:28:10 +0000 (+0100) Subject: Minor code whitespace cleanup. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=dbaae4936e6b647dd0157e5e6b37e668e1fad983;p=apitrace Minor code whitespace cleanup. --- diff --git a/d3dshader.py b/d3dshader.py index 24372e2..08a2d7f 100644 --- a/d3dshader.py +++ b/d3dshader.py @@ -55,18 +55,18 @@ typedef HRESULT static HMODULE hD3DXModule = NULL; static PD3DXDISASSEMBLESHADER pfnD3DXDisassembleShader = NULL; - if(firsttime) { - if(!hD3DXModule) { + if (firsttime) { + if (!hD3DXModule) { unsigned release; int version; - for(release = 0; release <= 1; ++release) { + for (release = 0; release <= 1; ++release) { /* Version 41 corresponds to Mar 2009 version of DirectX Runtime / SDK */ - for(version = 41; version >= 0; --version) { + for (version = 41; version >= 0; --version) { char filename[256]; _snprintf(filename, sizeof(filename), "d3dx9%s%s%u.dll", release ? "" : "d", version ? "_" : "", version); hD3DXModule = LoadLibraryA(filename); - if(hD3DXModule) + if (hD3DXModule) goto found; } } @@ -75,19 +75,19 @@ found: } if (hD3DXModule) - if(!pfnD3DXDisassembleShader) + if (!pfnD3DXDisassembleShader) pfnD3DXDisassembleShader = (PD3DXDISASSEMBLESHADER)GetProcAddress(hD3DXModule, "D3DXDisassembleShader"); firsttime = FALSE; } - if(pfnD3DXDisassembleShader) { + if (pfnD3DXDisassembleShader) { LPD3DXBUFFER pDisassembly = NULL; if (pfnD3DXDisassembleShader( (DWORD *)tokens, FALSE, NULL, &pDisassembly) == D3D_OK) Trace::LiteralString((char *)pDisassembly->GetBufferPointer()); - if(pDisassembly) + if (pDisassembly) pDisassembly->Release(); } } diff --git a/glxtrace.py b/glxtrace.py index a5317a4..7f5426f 100644 --- a/glxtrace.py +++ b/glxtrace.py @@ -77,7 +77,7 @@ if __name__ == '__main__': for f in api.functions: ptype = function_pointer_type(f) pvalue = function_pointer_value(f) - print ' if(!strcmp("%s", (const char *)procName)) {' % f.name + print ' if (!strcmp("%s", (const char *)procName)) {' % f.name print ' %s = (%s)procPtr;' % (pvalue, ptype) print ' return (__GLXextFuncPtr)&%s;' % (f.name,) print ' }' diff --git a/os_win32.cpp b/os_win32.cpp index 57a7fbc..6cddc55 100644 --- a/os_win32.cpp +++ b/os_win32.cpp @@ -110,7 +110,7 @@ long long GetTime(void) { static LARGE_INTEGER frequency; LARGE_INTEGER counter; - if(!frequency.QuadPart) + if (!frequency.QuadPart) QueryPerformanceFrequency(&frequency); QueryPerformanceCounter(&counter); return counter.QuadPart*1000000LL/frequency.QuadPart; diff --git a/retrace.py b/retrace.py index 4169b26..27d0afe 100644 --- a/retrace.py +++ b/retrace.py @@ -74,7 +74,7 @@ class ValueExtractor(stdapi.Visitor): length = '__a%s->values.size()' % array.id print ' %s = new %s[%s];' % (lvalue, array.type, length) index = '__j' + array.id - print ' for(size_t {i} = 0; {i} < {length}; ++{i}) {{'.format(i = index, length = length) + print ' for (size_t {i} = 0; {i} < {length}; ++{i}) {{'.format(i = index, length = length) try: self.visit(array.type, '%s[%s]' % (lvalue, index), '*__a%s->values[%s]' % (array.id, index)) finally: @@ -137,7 +137,7 @@ class ValueWrapper(stdapi.Visitor): print ' if (__a%s) {' % (array.id) length = '__a%s->values.size()' % array.id index = '__j' + array.id - print ' for(size_t {i} = 0; {i} < {length}; ++{i}) {{'.format(i = index, length = length) + print ' for (size_t {i} = 0; {i} < {length}; ++{i}) {{'.format(i = index, length = length) try: self.visit(array.type, '%s[%s]' % (lvalue, index), '*__a%s->values[%s]' % (array.id, index)) finally: @@ -166,7 +166,7 @@ class ValueWrapper(stdapi.Visitor): lvalue = "%s + %s" % (lvalue, i) rvalue = "__orig_result + %s" % (i,) entry = handle_entry(handle, rvalue) - print ' for({handle.type} {i} = 0; {i} < {handle.range}; ++{i}) {{'.format(**locals()) + print ' for ({handle.type} {i} = 0; {i} < {handle.range}; ++{i}) {{'.format(**locals()) print ' {entry} = {lvalue};'.format(**locals()) print ' if (retrace::verbosity >= 2)' print ' std::cout << "{handle.name} " << ({rvalue}) << " -> " << ({lvalue}) << "\\n";'.format(**locals()) diff --git a/trace.py b/trace.py index 7b2ba73..7d40cb7 100644 --- a/trace.py +++ b/trace.py @@ -152,7 +152,7 @@ class DumpImplementer(stdapi.Visitor): print ' __traceStruct%s(%s);' % (struct.id, instance) def visit_array(self, array, instance): - print ' if(%s) {' % instance + print ' if (%s) {' % instance index = '__i' + array.type.id print ' Trace::BeginArray(%s);' % (array.length,) print ' for (int %s = 0; %s < %s; ++%s) {' % (index, index, array.length, index) @@ -175,7 +175,7 @@ class DumpImplementer(stdapi.Visitor): print ' Trace::LiteralBitmask(__bitmask%s_sig, %s);' % (bitmask.id, instance) def visit_pointer(self, pointer, instance): - print ' if(%s) {' % instance + print ' if (%s) {' % instance print ' Trace::BeginArray(1);' print ' Trace::BeginElement();' dump_instance(pointer.type, "*" + instance) @@ -249,7 +249,7 @@ class Wrapper(stdapi.Visitor): def visit_interface(self, interface, instance): assert instance.startswith('*') instance = instance[1:] - print " if(%s)" % instance + print " if (%s)" % instance print " %s = new %s(%s);" % (instance, interface_wrap_name(interface), instance) @@ -258,7 +258,7 @@ class Unwrapper(Wrapper): def visit_interface(self, interface, instance): assert instance.startswith('*') instance = instance[1:] - print " if(%s)" % instance + print " if (%s)" % instance print " %s = static_cast<%s *>(%s)->m_pInstance;" % (instance, interface_wrap_name(interface), instance) diff --git a/trace_write.cpp b/trace_write.cpp index 3187b99..dc1fee9 100644 --- a/trace_write.cpp +++ b/trace_write.cpp @@ -44,7 +44,7 @@ namespace Trace { static gzFile g_gzFile = NULL; static void _Close(void) { - if(g_gzFile != NULL) { + if (g_gzFile != NULL) { gzclose(g_gzFile); g_gzFile = NULL; } @@ -77,7 +77,7 @@ static void _Open(const char *szExtension) { snprintf(szFileName, PATH_MAX, "%s%c%s.%s", szCurrentDir, PATH_SEP, szProcessName, szExtension); file = fopen(szFileName, "rb"); - if(file == NULL) + if (file == NULL) break; fclose(file);