From 86f00145f826ebdccfc3c0367ce432edf48e56d9 Mon Sep 17 00:00:00 2001 From: galaxyhaxz Date: Mon, 5 Nov 2018 23:01:56 -0600 Subject: [PATCH] Remove empty_string garbage --- Source/appfat.cpp | 5 ++--- Source/appfat.h | 1 - Source/control.cpp | 2 +- Source/diablo.cpp | 4 ++-- Source/init.cpp | 10 +++++----- Source/items.cpp | 6 +++--- Source/stores.cpp | 2 +- 7 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Source/appfat.cpp b/Source/appfat.cpp index 253700437..499063c12 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -8,7 +8,6 @@ float appfat_cpp_init_value; char sz_error_buf[256]; int terminating; // weak int cleanup_thread_id; // weak -char empty_string; // appfat_cpp_init initializes the C++ runtime of appfat.cpp. struct appfat_cpp_init { @@ -384,7 +383,7 @@ void __fastcall FileErrDlg(const char *error) v1 = error; FreeDlg(); if (!v1) - v1 = &empty_string; + v1 = ""; if (DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG3), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)v1) == -1) TermMsg("FileErrDlg"); TermMsg(0); @@ -406,7 +405,7 @@ BOOL __cdecl InsertCDDlg() int v0; // edi ShowCursor(1); - v0 = DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG9), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)&empty_string); + v0 = DialogBoxParam(ghInst, MAKEINTRESOURCE(IDD_DIALOG9), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)""); if (v0 == -1) TermMsg("InsertCDDlg"); ShowCursor(0); diff --git a/Source/appfat.h b/Source/appfat.h index eda554d3b..bf437cd70 100644 --- a/Source/appfat.h +++ b/Source/appfat.h @@ -5,7 +5,6 @@ extern char sz_error_buf[256]; extern int terminating; // weak extern int cleanup_thread_id; // weak -extern char empty_string; char *__fastcall GetErrorStr(int error_code); void __fastcall TraceErrorDD(int error_code, char *error_buf, int error_buf_len); diff --git a/Source/control.cpp b/Source/control.cpp index 7e55887b8..27d63d97c 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1007,7 +1007,7 @@ void __cdecl InitControlPan() chrbtnactive = 0; chrbtn[3] = 0; pDurIcons = LoadFileInMem("Items\\DurIcons.CEL", 0); - strcpy(infostr, &empty_string); + strcpy(infostr, ""); ClearPanel(); drawhpflag = TRUE; drawmanaflag = TRUE; diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 8d9c51d0f..33bd79e9f 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -500,8 +500,8 @@ void __fastcall diablo_reload_process(HMODULE hModule) HANDLE hMap; // [esp+2A0h] [ebp-8h] HWND hWnd; // [esp+2A4h] [ebp-4h] - *Filename = empty_string; - memset(Filename + 1, 0, sizeof(Filename) - 1); + //*Filename = empty_string; + memset(Filename, 0, sizeof(Filename)); // *(_WORD *)&Filename[257] = 0; // Filename[259] = 0; GetModuleFileName(hModule, Filename, 0x104u); diff --git a/Source/init.cpp b/Source/init.cpp index e2d3e3af0..6cabc2722 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -69,9 +69,9 @@ void __cdecl init_run_office_from_start_menu() LPITEMIDLIST ppidl; // [esp+100h] [ebp-4h] if (killed_mom_parent) { - *pszPath = empty_string; + //*pszPath = empty_string; killed_mom_parent = 0; - memset(pszPath + 1, 0, sizeof(pszPath) - 1); + memset(pszPath, 0, sizeof(pszPath)); // *(_WORD *)&pszPath[253] = 0; //pszPath[255] = 0; ppidl = 0; @@ -105,8 +105,8 @@ void __fastcall init_run_office(char *dir) do { if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (strcmp(FindFileData.cFileName, ".") && strcmp(FindFileData.cFileName, "..")) { - *Directory = empty_string; - memset(Directory + 1, 0, sizeof(Directory) - 1); + //*Directory = empty_string; + memset(Directory, 0, sizeof(Directory)); v3 = *v1 == 0; // *(_WORD *)&Directory[257] = 0; //Directory[259] = 0; @@ -118,7 +118,7 @@ void __fastcall init_run_office(char *dir) } } else if (!_strcmpi(FindFileData.cFileName, "Microsoft Office Shortcut Bar.lnk")) { v4 = GetDesktopWindow(); - ShellExecute(v4, "open", FindFileData.cFileName, &empty_string, v1, SW_SHOWNORMAL); + ShellExecute(v4, "open", FindFileData.cFileName, "", v1, SW_SHOWNORMAL); } } while (FindNextFile(v2, &FindFileData)); FindClose(v2); diff --git a/Source/items.cpp b/Source/items.cpp index d48607c1a..486bb3d70 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -100,7 +100,7 @@ const PLStruct PL_Prefix[84] = { { "Bountiful", IPL_CHARGES, 3, 3, 9, PLT_STAFF , 0, FALSE, TRUE, 3000, 3000, 3 }, { "Flaming", IPL_FIREDAM, 1, 10, 7, PLT_WEAP | PLT_STAFF , 0, FALSE, TRUE, 5000, 5000, 2 }, { "Lightning", IPL_LIGHTDAM, 2, 20, 18, PLT_WEAP | PLT_STAFF , 0, FALSE, TRUE, 10000, 10000, 2 }, - { &empty_string, IPL_INVALID, 0, 0, 0, 0 , 0, FALSE, FALSE, 0, 0, 0 } + { "", IPL_INVALID, 0, 0, 0, 0 , 0, FALSE, FALSE, 0, 0, 0 } // clang-format on }; const PLStruct PL_Suffix[96] = { @@ -201,7 +201,7 @@ const PLStruct PL_Suffix[96] = { { "stability", IPL_FASTRECOVER, 2, 2, 10, PLT_ARMO | PLT_MISC, 0, FALSE, TRUE, 4000, 4000, 4 }, { "harmony", IPL_FASTRECOVER, 3, 3, 20, PLT_ARMO | PLT_MISC, 0, FALSE, TRUE, 8000, 8000, 8 }, { "blocking", IPL_FASTBLOCK, 1, 1, 5, PLT_SHLD , 0, FALSE, TRUE, 4000, 4000, 4 }, - { &empty_string, IPL_INVALID, 0, 0, 0, 0 , 0, FALSE, FALSE, 0, 0, 0 } + { "", IPL_INVALID, 0, 0, 0, 0 , 0, FALSE, FALSE, 0, 0, 0 } // clang-format on }; const UItemStruct UniqueItemList[91] = { @@ -297,7 +297,7 @@ const UItemStruct UniqueItemList[91] = { { "The Bleeder", UITYPE_RING, 2, 4, 8500, IPL_MAGICRES, 20, 20, IPL_MANA, 30, 30, IPL_LIFE_CURSE, 10, 10, IPL_INVCURS, 8, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, { "Constricting Ring", UITYPE_RING, 5, 3, 62000, IPL_ALLRES, 75, 75, IPL_DRAINLIFE, 0, 0, IPL_INVCURS, 14, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 }, { "Ring of Engagement", UITYPE_RING, 11, 5, 12476, IPL_GETHIT, 1, 2, IPL_THORNS, 1, 3, IPL_SETAC, 5, 5, IPL_TARGAC, 4, 12, IPL_INVCURS, 13, 0, IPL_TOHIT, 0, 0 }, - { &empty_string, UITYPE_INVALID, 0, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 } + { "", UITYPE_INVALID, 0, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0, IPL_TOHIT, 0, 0 } // clang-format on }; diff --git a/Source/stores.cpp b/Source/stores.cpp index 2b15c19a9..9e0ef13dc 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -65,7 +65,7 @@ int SStringY[24] = { char *talkname[9] = { "Griswold", "Pepin", - &empty_string, + "", "Ogden", "Cain", "Farnham",