luis.busquets@ilidium.com wrote:
- LPWSTR pSrcFileW = NULL;
- DWORD len;
- HRESULT ret;
- if (pSrcFile)
{
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;
}
- else return D3DXERR_INVALIDDATA;
}
Usually it's much more readable and helps to avoid not necessary indentation to check parameters at the start of the function and return right away with appropriate error code. Besides you are mixing tabs and spaces.
-HRESULT WINAPI D3DXAssembleShaderFromFileW(LPSTR pSrcFile, DWORD Flags, +HRESULT WINAPI D3DXAssembleShaderFromFileW(LPWSTR pSrcFile, DWORD Flags,
You marked pSrcFile parameter 'const' in D3DXAssembleShaderFromFileA declaration but not in D3DXAssembleShaderFromFileW, any reason for that?