2009/8/21 Matteo Bruni <matteo.myst...@gmail.com>:
>
> +HRESULT WINAPI D3DXAssembleShaderFromFileA(LPCSTR pSrcFile,
> +                                           CONST D3DXMACRO* pDefines,
> +                                           LPD3DXINCLUDE pInclude,
> +                                           DWORD Flags,
> +                                           LPD3DXBUFFER* ppShader,
> +                                           LPD3DXBUFFER* ppErrorMsgs)
> +{
> +    LPWSTR pSrcFileW = NULL;
> +    DWORD len;
> +    HRESULT ret;
> +
> +    if (!pSrcFile) return D3DXERR_INVALIDDATA;
> +
> +    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, pDefines, pInclude, Flags, 
> ppShader, ppErrorMsgs);
> +    HeapFree( GetProcessHeap(), 0, pSrcFileW );
> +    return ret;
> +}

It doesn't matter much which style you pick, but please try to keep it
consistent (applies to the other patches as well). Note that
HeapAlloc() might fail. Oh, and please don't use hungarian notation.


Reply via email to