]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix a sizeof using an array index variable that is never initialized (harmless but...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 7 Feb 2013 12:59:53 +0000 (12:59 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Mon, 25 Feb 2013 08:24:07 +0000 (09:24 +0100)
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
::stable-branch::merge=d5ffe81473b3fd1eb7d382ded58057fe6bb94601

fs.c
gl_rmain.c

diff --git a/fs.c b/fs.c
index 6e45cd81ac4cb5704cad7af857b63bd7176a6ae0..b026b6ed9a59a01effaf80f299cb5061348ebb2b 100644 (file)
--- 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;
        }
 }
index de09ae9dcb90462ff20db8041a6fdb94e4982f96..834b7ce65892409c8136249d533be0b481142a31 100644 (file)
@@ -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;