From: havoc Date: Thu, 7 Feb 2013 12:59:53 +0000 (+0000) Subject: fix a sizeof using an array index variable that is never initialized (harmless but... X-Git-Tag: xonotic-v0.8.0~96^2~147 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d5ffe81473b3fd1eb7d382ded58057fe6bb94601;p=xonotic%2Fdarkplaces.git fix a sizeof using an array index variable that is never initialized (harmless but the variable is unused by actual code and thus causes a warning) declare macros for ID3DXBuffer_ functions because they were removed in a DX SDK update git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11892 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/fs.c b/fs.c index 6e45cd81..b026b6ed 100644 --- a/fs.c +++ b/fs.c @@ -1632,7 +1632,7 @@ const char *FS_CheckGameDir(const char *gamedir) static void FS_ListGameDirs(void) { stringlist_t list, list2; - int i, j; + int i; const char *info; char vabuf[1024]; @@ -1673,8 +1673,8 @@ static void FS_ListGameDirs(void) continue; if(!*info) continue; - strlcpy(fs_all_gamedirs[fs_all_gamedirs_count].name, list2.strings[i], sizeof(fs_all_gamedirs[j].name)); - strlcpy(fs_all_gamedirs[fs_all_gamedirs_count].description, info, sizeof(fs_all_gamedirs[j].description)); + strlcpy(fs_all_gamedirs[fs_all_gamedirs_count].name, list2.strings[i], sizeof(fs_all_gamedirs[fs_all_gamedirs_count].name)); + strlcpy(fs_all_gamedirs[fs_all_gamedirs_count].description, info, sizeof(fs_all_gamedirs[fs_all_gamedirs_count].description)); ++fs_all_gamedirs_count; } } diff --git a/gl_rmain.c b/gl_rmain.c index de09ae9d..834b7ce6 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -1533,6 +1533,18 @@ static void R_HLSL_CacheShader(r_hlsl_permutation_t *p, const char *cachename, c {"D3DXCompileShader", (void **) &qD3DXCompileShader}, {NULL, NULL} }; + // LordHavoc: the June 2010 SDK lacks these macros to make ID3DXBuffer usable in C, and to make it work in both C and C++ the macros are needed... +#ifndef ID3DXBuffer_GetBufferPointer +#if !defined(__cplusplus) || defined(CINTERFACE) +#define ID3DXBuffer_GetBufferPointer(p) (p)->lpVtbl->GetBufferPointer(p) +#define ID3DXBuffer_GetBufferSize(p) (p)->lpVtbl->GetBufferSize(p) +#define ID3DXBuffer_Release(p) (p)->lpVtbl->Release(p) +#else +#define ID3DXBuffer_GetBufferPointer(p) (p)->GetBufferPointer() +#define ID3DXBuffer_GetBufferSize(p) (p)->GetBufferSize() +#define ID3DXBuffer_Release(p) (p)->Release() +#endif +#endif if (Sys_LoadLibrary(dllnames_d3dx9, &d3dx9_dll, d3dx9_dllfuncs)) { DWORD shaderflags = 0;