d3dx8: Implementation of WINAPI D3DXAssembleShaderFromFileA
luis.busquets at ilidium.com
luis.busquets at ilidium.com
Tue Nov 27 01:55:06 CST 2007
I say that it is more readable because I understood you wanted the return
code as soon as possible, but, anyway, what would you propose as code for
this function?
Would the following work for you?
+
+ if ( !pSrcFile )
+ return D3DXERR_INVALIDDATA;
+ else
+ {
+ LPWSTR pSrcFileW = NULL;
+ DWORD len;
+ HRESULT ret;
+ len = MultiByteToWideChar( CP_ACP, 0, pSrcFile, -1, NULL, 0 );
+ pSrcFileW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
+ MultiByteToWideChar( CP_ACP, 0, pSrcFile, -1, pSrcFileW, len );
+ ret=D3DXAssembleShaderFromFileW(pSrcFileW, Flags, ppConstants,
ppCompiledShader, ppCompilationErrors);
+ HeapFree( GetProcessHeap(), 0, pSrcFileW );
+ return ret;
+ }
}
>
> This is not more readable than a previous version. There is no need
> for 'else {}' construct and therefore for additional indentation level
> at all.
>
> --
> Dmitry.
>
>
More information about the wine-devel
mailing list