Re: d3dx8: Implementation of WINAPI D3DXAssembleShaderFromFileA

2007-11-27 Thread Michael Stefaniuc
[EMAIL PROTECTED] wrote: 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? Just go for if ( !pSrcFile ) return D3DXERR_INVALIDDATA; LPWSTR

Re: d3dx8: Implementation of WINAPI D3DXAssembleShaderFromFileA

2007-11-27 Thread Frank Richter
On 27.11.2007 09:28, Michael Stefaniuc wrote: Just go for if ( !pSrcFile ) return D3DXERR_INVALIDDATA; LPWSTR pSrcFileW = NULL; DWORD len; HRESULT ret; ... That's C++, not C, isn't it? -f.r.

Re: d3dx8: Implementation of WINAPI D3DXAssembleShaderFromFileA

2007-11-27 Thread Michael Stefaniuc
Frank Richter wrote: On 27.11.2007 09:28, Michael Stefaniuc wrote: Just go for if ( !pSrcFile ) return D3DXERR_INVALIDDATA; LPWSTR pSrcFileW = NULL; DWORD len; HRESULT ret; ... That's C++, not C, isn't it? No it is C as C99 allows to have the variable definitions in the middle of

Re: d3dx8: Implementation of WINAPI D3DXAssembleShaderFromFileA

2007-11-26 Thread Dmitry Timoshkov
Luis C. Busquets PĂ©rez [EMAIL PROTECTED] wrote: Changed the if clauses to make the implementation more readable. ... + if ( !pSrcFile ) + return D3DXERR_INVALIDDATA; + else + { + len = MultiByteToWideChar( CP_ACP, 0, pSrcFile, -1, NULL, 0 ); + pSrcFileW = HeapAlloc(

Re: d3dx8: Implementation of WINAPI D3DXAssembleShaderFromFileA

2007-11-26 Thread luis . busquets
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; +