Commit 77ee90b5 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3dx9: Avoid LPSTR.

parent 0d2d8479
...@@ -604,7 +604,7 @@ static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOO ...@@ -604,7 +604,7 @@ static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOO
switch (param->type) switch (param->type)
{ {
case D3DXPT_STRING: case D3DXPT_STRING:
HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data); HeapFree(GetProcessHeap(), 0, *(char **)param->data);
if (!child) HeapFree(GetProcessHeap(), 0, param->data); if (!child) HeapFree(GetProcessHeap(), 0, param->data);
break; break;
...@@ -621,7 +621,7 @@ static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOO ...@@ -621,7 +621,7 @@ static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOO
} }
else else
{ {
HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data); HeapFree(GetProcessHeap(), 0, *(char **)param->data);
} }
if (!child) HeapFree(GetProcessHeap(), 0, param->data); if (!child) HeapFree(GetProcessHeap(), 0, param->data);
break; break;
...@@ -637,7 +637,7 @@ static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOO ...@@ -637,7 +637,7 @@ static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOO
} }
else else
{ {
HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data); HeapFree(GetProcessHeap(), 0, *(char **)param->data);
} }
/* samplers have always own data, so free that */ /* samplers have always own data, so free that */
HeapFree(GetProcessHeap(), 0, param->data); HeapFree(GetProcessHeap(), 0, param->data);
...@@ -654,7 +654,7 @@ static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOO ...@@ -654,7 +654,7 @@ static void free_parameter_state(struct d3dx_parameter *param, BOOL element, BOO
{ {
if (st != ST_CONSTANT) if (st != ST_CONSTANT)
{ {
HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data); HeapFree(GetProcessHeap(), 0, *(char **)param->data);
} }
HeapFree(GetProcessHeap(), 0, param->data); HeapFree(GetProcessHeap(), 0, param->data);
} }
...@@ -4417,7 +4417,7 @@ static HRESULT d3dx9_parse_data(struct d3dx_parameter *param, const char **ptr, ...@@ -4417,7 +4417,7 @@ static HRESULT d3dx9_parse_data(struct d3dx_parameter *param, const char **ptr,
{ {
case D3DXPT_STRING: case D3DXPT_STRING:
/* re-read with size (sizeof(DWORD) = 4) */ /* 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) if (hr != D3D_OK)
{ {
WARN("Failed to parse string data\n"); WARN("Failed to parse string data\n");
......
...@@ -2638,7 +2638,7 @@ struct mesh_data { ...@@ -2638,7 +2638,7 @@ struct mesh_data {
DWORD nb_bones; 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; HRESULT hr;
SIZE_T data_size; SIZE_T data_size;
...@@ -2658,12 +2658,13 @@ static HRESULT parse_texture_filename(ID3DXFileData *filedata, LPSTR *filename_o ...@@ -2658,12 +2658,13 @@ static HRESULT parse_texture_filename(ID3DXFileData *filedata, LPSTR *filename_o
if (FAILED(hr)) return hr; if (FAILED(hr)) return hr;
/* FIXME: String must be retrieved directly instead of through a pointer once ID3DXFILE is fixed */ /* 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); WARN("truncated data (%lu bytes)\n", data_size);
filedata->lpVtbl->Unlock(filedata); filedata->lpVtbl->Unlock(filedata);
return E_FAIL; return E_FAIL;
} }
filename_in = *(LPSTR*)data; filename_in = *(char **)data;
filename = HeapAlloc(GetProcessHeap(), 0, strlen(filename_in) + 1); filename = HeapAlloc(GetProcessHeap(), 0, strlen(filename_in) + 1);
if (!filename) { if (!filename) {
...@@ -3398,7 +3399,7 @@ static HRESULT generate_effects(ID3DXBuffer *materials, DWORD num_materials, ...@@ -3398,7 +3399,7 @@ static HRESULT generate_effects(ID3DXBuffer *materials, DWORD num_materials,
for (j = 0; j < ARRAY_SIZE(material_effects); j++) 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); strcpy(defaults->pParamName, material_effects[j].param_name);
defaults->pValue = defaults->pParamName + material_effects[j].name_size; defaults->pValue = defaults->pParamName + material_effects[j].name_size;
defaults->Type = D3DXEDT_FLOATS; defaults->Type = D3DXEDT_FLOATS;
...@@ -3408,8 +3409,9 @@ static HRESULT generate_effects(ID3DXBuffer *materials, DWORD num_materials, ...@@ -3408,8 +3409,9 @@ static HRESULT generate_effects(ID3DXBuffer *materials, DWORD num_materials,
defaults++; defaults++;
} }
if (material_ptr->pTextureFilename) { if (material_ptr->pTextureFilename)
defaults->pParamName = (LPSTR)out_ptr; {
defaults->pParamName = (char *)out_ptr;
strcpy(defaults->pParamName, texture_paramname); strcpy(defaults->pParamName, texture_paramname);
defaults->pValue = defaults->pParamName + sizeof(texture_paramname); defaults->pValue = defaults->pParamName + sizeof(texture_paramname);
defaults->Type = D3DXEDT_STRING; defaults->Type = D3DXEDT_STRING;
......
...@@ -1781,7 +1781,7 @@ static void check_generated_effects_(int line, const D3DXMATERIAL *materials, DW ...@@ -1781,7 +1781,7 @@ static void check_generated_effects_(int line, const D3DXMATERIAL *materials, DW
static char *strdupA(const char *p) static char *strdupA(const char *p)
{ {
LPSTR ret; char *ret;
if (!p) return NULL; if (!p) return NULL;
ret = HeapAlloc(GetProcessHeap(), 0, strlen(p) + 1); ret = HeapAlloc(GetProcessHeap(), 0, strlen(p) + 1);
if (ret) strcpy(ret, p); if (ret) strcpy(ret, p);
......
...@@ -92,7 +92,7 @@ typedef struct _D3DXMESHDATA ...@@ -92,7 +92,7 @@ typedef struct _D3DXMESHDATA
typedef struct _D3DXMESHCONTAINER typedef struct _D3DXMESHCONTAINER
{ {
LPSTR Name; char *Name;
D3DXMESHDATA MeshData; D3DXMESHDATA MeshData;
LPD3DXMATERIAL pMaterials; LPD3DXMATERIAL pMaterials;
LPD3DXEFFECTINSTANCE pEffects; LPD3DXEFFECTINSTANCE pEffects;
...@@ -104,7 +104,7 @@ typedef struct _D3DXMESHCONTAINER ...@@ -104,7 +104,7 @@ typedef struct _D3DXMESHCONTAINER
typedef struct _D3DXFRAME typedef struct _D3DXFRAME
{ {
LPSTR Name; char *Name;
D3DXMATRIX TransformationMatrix; D3DXMATRIX TransformationMatrix;
LPD3DXMESHCONTAINER pMeshContainer; LPD3DXMESHCONTAINER pMeshContainer;
struct _D3DXFRAME *pFrameSibling; struct _D3DXFRAME *pFrameSibling;
......
...@@ -193,12 +193,12 @@ typedef D3DXATTRIBUTERANGE* LPD3DXATTRIBUTERANGE; ...@@ -193,12 +193,12 @@ typedef D3DXATTRIBUTERANGE* LPD3DXATTRIBUTERANGE;
typedef struct _D3DXMATERIAL typedef struct _D3DXMATERIAL
{ {
D3DMATERIAL9 MatD3D; D3DMATERIAL9 MatD3D;
LPSTR pTextureFilename; char *pTextureFilename;
} D3DXMATERIAL, *LPD3DXMATERIAL; } D3DXMATERIAL, *LPD3DXMATERIAL;
typedef struct _D3DXEFFECTDEFAULT typedef struct _D3DXEFFECTDEFAULT
{ {
LPSTR pParamName; char *pParamName;
D3DXEFFECTDEFAULTTYPE Type; D3DXEFFECTDEFAULTTYPE Type;
DWORD NumBytes; DWORD NumBytes;
LPVOID pValue; LPVOID pValue;
...@@ -206,7 +206,7 @@ typedef struct _D3DXEFFECTDEFAULT ...@@ -206,7 +206,7 @@ typedef struct _D3DXEFFECTDEFAULT
typedef struct _D3DXEFFECTINSTANCE typedef struct _D3DXEFFECTINSTANCE
{ {
LPSTR pEffectFilename; char *pEffectFilename;
DWORD NumDefaults; DWORD NumDefaults;
LPD3DXEFFECTDEFAULT pDefaults; LPD3DXEFFECTDEFAULT pDefaults;
} D3DXEFFECTINSTANCE, *LPD3DXEFFECTINSTANCE; } D3DXEFFECTINSTANCE, *LPD3DXEFFECTINSTANCE;
......
...@@ -110,7 +110,7 @@ DECLARE_INTERFACE_IID_(ID3DXFileSaveData,IUnknown,"cef08cfb-7b4f-4429-9624-2a690 ...@@ -110,7 +110,7 @@ DECLARE_INTERFACE_IID_(ID3DXFileSaveData,IUnknown,"cef08cfb-7b4f-4429-9624-2a690
STDMETHOD_(ULONG,Release)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** ID3DXFileSaveObject methods ***/ /*** ID3DXFileSaveObject methods ***/
STDMETHOD(GetSave)(THIS_ ID3DXFileSaveObject **save_obj) PURE; 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(GetId)(THIS_ LPGUID) PURE;
STDMETHOD(GetType)(THIS_ GUID*) PURE; STDMETHOD(GetType)(THIS_ GUID*) PURE;
STDMETHOD(AddDataObject)(THIS_ REFGUID template_guid, const char *name, const GUID *guid, 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 ...@@ -145,7 +145,7 @@ DECLARE_INTERFACE_IID_(ID3DXFileData,IUnknown,"cef08cfd-7b4f-4429-9624-2a690a933
STDMETHOD_(ULONG,Release)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** ID3DXFileData methods ***/ /*** ID3DXFileData methods ***/
STDMETHOD(GetEnum)(THIS_ ID3DXFileEnumObject **enum_obj) PURE; 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(GetId)(THIS_ LPGUID) PURE;
STDMETHOD(Lock)(THIS_ SIZE_T*, LPCVOID*) PURE; STDMETHOD(Lock)(THIS_ SIZE_T*, LPCVOID*) PURE;
STDMETHOD(Unlock)(THIS) PURE; STDMETHOD(Unlock)(THIS) PURE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment