d3dx9: Avoid LPSTR.

This commit is contained in:
Henri Verbeet 2013-09-03 09:47:24 +02:00 committed by Alexandre Julliard
parent 0d2d847914
commit 77ee90b59f
6 changed files with 21 additions and 19 deletions

View File

@ -604,7 +604,7 @@ static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOO
switch (param->type)
{
case D3DXPT_STRING:
HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data);
HeapFree(GetProcessHeap(), 0, *(char **)param->data);
if (!child) HeapFree(GetProcessHeap(), 0, param->data);
break;
@ -621,7 +621,7 @@ static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOO
}
else
{
HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data);
HeapFree(GetProcessHeap(), 0, *(char **)param->data);
}
if (!child) HeapFree(GetProcessHeap(), 0, param->data);
break;
@ -637,7 +637,7 @@ static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOO
}
else
{
HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data);
HeapFree(GetProcessHeap(), 0, *(char **)param->data);
}
/* samplers have always own data, so free that */
HeapFree(GetProcessHeap(), 0, param->data);
@ -654,7 +654,7 @@ static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOO
{
if (st != ST_CONSTANT)
{
HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data);
HeapFree(GetProcessHeap(), 0, *(char **)param->data);
}
HeapFree(GetProcessHeap(), 0, param->data);
}
@ -4417,7 +4417,7 @@ static HRESULT d3dx9_parse_data(struct d3dx_parameter *param, const char **ptr,
{
case D3DXPT_STRING:
/* re-read with size (sizeof(DWORD) = 4) */
hr = d3dx9_parse_name((LPSTR *)param->data, *ptr - 4);
hr = d3dx9_parse_name((char **)param->data, *ptr - 4);
if (hr != D3D_OK)
{
WARN("Failed to parse string data\n");

View File

@ -2638,7 +2638,7 @@ struct mesh_data {
DWORD nb_bones;
};
static HRESULT parse_texture_filename(ID3DXFileData *filedata, LPSTR *filename_out)
static HRESULT parse_texture_filename(ID3DXFileData *filedata, char **filename_out)
{
HRESULT hr;
SIZE_T data_size;
@ -2658,12 +2658,13 @@ static HRESULT parse_texture_filename(ID3DXFileData *filedata, LPSTR *filename_o
if (FAILED(hr)) return hr;
/* FIXME: String must be retrieved directly instead of through a pointer once ID3DXFILE is fixed */
if (data_size < sizeof(LPSTR)) {
if (data_size < sizeof(filename_in))
{
WARN("truncated data (%lu bytes)\n", data_size);
filedata->lpVtbl->Unlock(filedata);
return E_FAIL;
}
filename_in = *(LPSTR*)data;
filename_in = *(char **)data;
filename = HeapAlloc(GetProcessHeap(), 0, strlen(filename_in) + 1);
if (!filename) {
@ -3398,7 +3399,7 @@ static HRESULT generate_effects(ID3DXBuffer *materials, DWORD num_materials,
for (j = 0; j < ARRAY_SIZE(material_effects); j++)
{
defaults->pParamName = (LPSTR)out_ptr;
defaults->pParamName = (char *)out_ptr;
strcpy(defaults->pParamName, material_effects[j].param_name);
defaults->pValue = defaults->pParamName + material_effects[j].name_size;
defaults->Type = D3DXEDT_FLOATS;
@ -3408,8 +3409,9 @@ static HRESULT generate_effects(ID3DXBuffer *materials, DWORD num_materials,
defaults++;
}
if (material_ptr->pTextureFilename) {
defaults->pParamName = (LPSTR)out_ptr;
if (material_ptr->pTextureFilename)
{
defaults->pParamName = (char *)out_ptr;
strcpy(defaults->pParamName, texture_paramname);
defaults->pValue = defaults->pParamName + sizeof(texture_paramname);
defaults->Type = D3DXEDT_STRING;

View File

@ -1781,7 +1781,7 @@ static void check_generated_effects_(int line, const D3DXMATERIAL *materials, DW
static char *strdupA(const char *p)
{
LPSTR ret;
char *ret;
if (!p) return NULL;
ret = HeapAlloc(GetProcessHeap(), 0, strlen(p) + 1);
if (ret) strcpy(ret, p);

View File

@ -92,7 +92,7 @@ typedef struct _D3DXMESHDATA
typedef struct _D3DXMESHCONTAINER
{
LPSTR Name;
char *Name;
D3DXMESHDATA MeshData;
LPD3DXMATERIAL pMaterials;
LPD3DXEFFECTINSTANCE pEffects;
@ -104,7 +104,7 @@ typedef struct _D3DXMESHCONTAINER
typedef struct _D3DXFRAME
{
LPSTR Name;
char *Name;
D3DXMATRIX TransformationMatrix;
LPD3DXMESHCONTAINER pMeshContainer;
struct _D3DXFRAME *pFrameSibling;

View File

@ -193,12 +193,12 @@ typedef D3DXATTRIBUTERANGE* LPD3DXATTRIBUTERANGE;
typedef struct _D3DXMATERIAL
{
D3DMATERIAL9 MatD3D;
LPSTR pTextureFilename;
char *pTextureFilename;
} D3DXMATERIAL, *LPD3DXMATERIAL;
typedef struct _D3DXEFFECTDEFAULT
{
LPSTR pParamName;
char *pParamName;
D3DXEFFECTDEFAULTTYPE Type;
DWORD NumBytes;
LPVOID pValue;
@ -206,7 +206,7 @@ typedef struct _D3DXEFFECTDEFAULT
typedef struct _D3DXEFFECTINSTANCE
{
LPSTR pEffectFilename;
char *pEffectFilename;
DWORD NumDefaults;
LPD3DXEFFECTDEFAULT pDefaults;
} D3DXEFFECTINSTANCE, *LPD3DXEFFECTINSTANCE;

View File

@ -110,7 +110,7 @@ DECLARE_INTERFACE_IID_(ID3DXFileSaveData,IUnknown,"cef08cfb-7b4f-4429-9624-2a690
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** ID3DXFileSaveObject methods ***/
STDMETHOD(GetSave)(THIS_ ID3DXFileSaveObject **save_obj) PURE;
STDMETHOD(GetName)(THIS_ LPSTR, SIZE_T*) PURE;
STDMETHOD(GetName)(THIS_ char *name, SIZE_T *size) PURE;
STDMETHOD(GetId)(THIS_ LPGUID) PURE;
STDMETHOD(GetType)(THIS_ GUID*) PURE;
STDMETHOD(AddDataObject)(THIS_ REFGUID template_guid, const char *name, const GUID *guid,
@ -145,7 +145,7 @@ DECLARE_INTERFACE_IID_(ID3DXFileData,IUnknown,"cef08cfd-7b4f-4429-9624-2a690a933
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** ID3DXFileData methods ***/
STDMETHOD(GetEnum)(THIS_ ID3DXFileEnumObject **enum_obj) PURE;
STDMETHOD(GetName)(THIS_ LPSTR, SIZE_T*) PURE;
STDMETHOD(GetName)(THIS_ char *name, SIZE_T *size) PURE;
STDMETHOD(GetId)(THIS_ LPGUID) PURE;
STDMETHOD(Lock)(THIS_ SIZE_T*, LPCVOID*) PURE;
STDMETHOD(Unlock)(THIS) PURE;