[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 pSrcFileW = NULL; DWORD len; HRESULT ret; ... Like Dimitry said the "else" is not needed at all. bye michael > + > + 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. >> >> > > > > -- Michael Stefaniuc Tel.: +49-711-96437-199 Sr. Network Engineer Fax.: +49-711-96437-111 -------------------------------------------------------------------- Reg. Adresse: Red Hat GmbH, Hauptstätter Strasse 58, 70178 Stuttgart Handelsregister: Amtsgericht Stuttgart HRB 153243 Geschäftsführer: Brendan Lane, Charlie Peters, Michael Cunningham, Werner Knoblich