From: Toni Wilen Date: Sat, 31 Oct 2020 11:05:26 +0000 (+0200) Subject: const changes X-Git-Tag: 4900~273 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=ffb34290ef28b4f4adb93490f9f920b002b3dff2;p=francis%2Fwinuae.git const changes --- diff --git a/archivers/chd/chdglue.cpp b/archivers/chd/chdglue.cpp index 555da858..c02a592a 100644 --- a/archivers/chd/chdglue.cpp +++ b/archivers/chd/chdglue.cpp @@ -15,7 +15,7 @@ int core_fseek(core_file *file, INT64 offset, int whence) } file_error core_fopen(const TCHAR *filename, UINT32 openflags, core_file **file) { - TCHAR *mode; + const TCHAR *mode; if (openflags & OPEN_FLAG_CREATE) mode = _T("wb"); diff --git a/disk.cpp b/disk.cpp index cd7a517a..a706e0ae 100644 --- a/disk.cpp +++ b/disk.cpp @@ -4431,7 +4431,7 @@ using namespace tinyxml2; static bool abr_loaded; static tinyxml2::XMLDocument abr_xml[2]; -static TCHAR* abr_files[] = { _T("brainfile.xml"), _T("catlist.xml"), NULL }; +static const TCHAR* abr_files[] = { _T("brainfile.xml"), _T("catlist.xml"), NULL }; static void abrcheck(struct diskinfo *di) { diff --git a/epsonprinter.cpp b/epsonprinter.cpp index 3bc8af9e..c97b1d95 100644 --- a/epsonprinter.cpp +++ b/epsonprinter.cpp @@ -56,7 +56,7 @@ int pngprint = 0; static const TCHAR *epsonprintername; static HFONT curFont; static float curFontHorizPoints, curFontVertPoints; -static TCHAR *curFontName; +static const TCHAR *curFontName; static HDC memHDC; static LPOUTLINETEXTMETRIC otm; #else @@ -473,7 +473,7 @@ static void selectCodepage(Bit16u cp) static int selectfont(Bit16u style) { - static TCHAR *thisFontName; + static const TCHAR *thisFontName; static float thisFontHorizPoints; static float thisFontVertPoints; static Bit16u thisStyle; @@ -544,7 +544,7 @@ static void updateFont(void) { Real64 horizPoints = 10.5; Real64 vertPoints = 10.5; - TCHAR *fontName; + const TCHAR *fontName; if (curFont != NULL) #ifdef WINFONT diff --git a/od-win32/debug_win32.cpp b/od-win32/debug_win32.cpp index a50d82f9..fa75530b 100644 --- a/od-win32/debug_win32.cpp +++ b/od-win32/debug_win32.cpp @@ -81,7 +81,7 @@ static struct debuggerpage dbgpage[MAXPAGES]; static int currpage, pages; static int pagetype; -TCHAR *pname[] = { _T("OUT1"), _T("OUT2"), _T("MEM1"), _T("MEM2"), _T("DASM1"), _T("DASM2"), _T("BRKPTS"), _T("MISC"), _T("CUSTOM") }; +const TCHAR *pname[] = { _T("OUT1"), _T("OUT2"), _T("MEM1"), _T("MEM2"), _T("DASM1"), _T("DASM2"), _T("BRKPTS"), _T("MISC"), _T("CUSTOM") }; static int pstatuscolor[MAXPAGES]; static int dbgwnd_minx = 800, dbgwnd_miny = 600; diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index 60e31659..b730d999 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -42,7 +42,7 @@ int forcedframelatency = -1; #include "direct3d.h" -static TCHAR *D3DHEAD = _T("-"); +static const TCHAR *D3DHEAD = _T("-"); static bool showoverlay = true; static int slicecnt; @@ -293,7 +293,7 @@ static int ddraw_fs_hack_init (struct d3dstruct *d3d) return 1; } -static TCHAR *D3D_ErrorText (HRESULT error) +static const TCHAR *D3D_ErrorText (HRESULT error) { return _T(""); } diff --git a/od-win32/hardfile_win32.cpp b/od-win32/hardfile_win32.cpp index f38206f5..6052514e 100644 --- a/od-win32/hardfile_win32.cpp +++ b/od-win32/hardfile_win32.cpp @@ -438,7 +438,7 @@ int isharddrive (const TCHAR *name) return -1; } -static TCHAR *hdz[] = { _T("hdz"), _T("zip"), _T("rar"), _T("7z"), NULL }; +static const TCHAR *hdz[] = { _T("hdz"), _T("zip"), _T("rar"), _T("7z"), NULL }; static int progressdialogreturn; static int progressdialogactive; @@ -891,7 +891,7 @@ static bool hd_get_meta_hack_realtek(HWND hDlg, HANDLE h, uae_u8 *data, uae_u8 * int state = 0; memset(cmd, 0, 6); // TEST UNIT READY - TCHAR *infotxt; + const TCHAR *infotxt; if (do_scsi_in(h, cmd, 6, data, 0, true) < 0) { state = 1; infotxt = _T("Realtek hack, insert card."); @@ -2558,7 +2558,7 @@ static int hdf_write_2 (struct hardfiledata *hfd, void *buffer, uae_u64 offset, poscheck (hfd, len); memcpy (hfd->cache, buffer, len); if (hfd->handle_valid == HDF_HANDLE_WIN32_NORMAL) { - TCHAR *name = hfd->emptyname == NULL ? _T("") : hfd->emptyname; + const TCHAR *name = hfd->emptyname == NULL ? _T("") : hfd->emptyname; if (offset == 0) { if (!hfd->handle->firstwrite && (hfd->flags & HFD_FLAGS_REALDRIVE) && !(hfd->flags & HFD_FLAGS_REALDRIVEPARTITION)) { hfd->handle->firstwrite = true; @@ -3326,8 +3326,8 @@ TCHAR *hdf_getnameharddrive (int index, int flags, int *sectorsize, int *dangero TCHAR tmp[32]; uae_u64 size = udi->size; int nomedia = udi->nomedia; - TCHAR *dang = _T("?"); - TCHAR *rw = _T("RW"); + const TCHAR *dang = _T("?"); + const TCHAR *rw = _T("RW"); bool noaccess = false; if (outflags) { diff --git a/od-win32/screenshot.cpp b/od-win32/screenshot.cpp index dbbadb68..8df06841 100644 --- a/od-win32/screenshot.cpp +++ b/od-win32/screenshot.cpp @@ -794,7 +794,7 @@ int screenshotf(int monid, const TCHAR *spath, int mode, int doprepare, int imag FILE *fp = NULL; int failed = 0; int screenshot_max = 1000; // limit 999 iterations / screenshots - TCHAR *format = _T("%s%s%s%03d.%s"); + const TCHAR *format = _T("%s%s%s%03d.%s"); bool alpha = usealpha(); HBITMAP offscreen_bitmap = NULL; // bitmap that is converted to a DIB diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index a1845169..2eda4d42 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -3262,7 +3262,7 @@ int WIN32_CleanupLibraries (void) /* HtmlHelp Initialization - optional component */ int WIN32_InitHtmlHelp (void) { - TCHAR *chm = _T("WinUAE.chm"); + const TCHAR *chm = _T("WinUAE.chm"); int result = 0; _stprintf(help_file, _T("%s%s"), start_path_data, chm); if (!zfile_exists (help_file)) @@ -3348,7 +3348,7 @@ const struct winuae_lang langs[] = { 0x400, _T("guidll.dll") }, { 0, NULL } }; -static TCHAR *getlanguagename(DWORD id) +static const TCHAR *getlanguagename(DWORD id) { int i; for (i = 0; langs[i].name; i++) { @@ -3383,7 +3383,7 @@ HMODULE language_load (WORD language) #if LANG_DLL > 0 TCHAR dllbuf[MAX_DPATH]; - TCHAR *dllname; + const TCHAR *dllname; dllname = getlanguagename (language); if (dllname) { DWORD dwVersionHandle, dwFileVersionInfoSize; @@ -3773,7 +3773,7 @@ uae_u8 *target_load_keyfile (struct uae_prefs *p, const TCHAR *path, int *sizep, HMODULE h; PFN_GetKey pfnGetKey; int size; - TCHAR *libname = _T("amigaforever.dll"); + const TCHAR *libname = _T("amigaforever.dll"); h = WIN32_LoadLibrary(libname); if (!h) { @@ -5191,7 +5191,7 @@ static int shell_deassociate (const TCHAR *extension) return 1; } -static int shell_associate_2 (const TCHAR *extension, TCHAR *shellcommand, TCHAR *command, struct contextcommand *cc, const TCHAR *perceivedtype, +static int shell_associate_2 (const TCHAR *extension, const TCHAR *shellcommand, const TCHAR *command, struct contextcommand *cc, const TCHAR *perceivedtype, const TCHAR *description, const TCHAR *ext2, int icon) { TCHAR rpath1[MAX_DPATH], rpath2[MAX_DPATH], progid2[MAX_DPATH]; @@ -5292,7 +5292,7 @@ static int shell_associate_2 (const TCHAR *extension, TCHAR *shellcommand, TCHAR regclosetree (fkey); return 1; } -static int shell_associate (const TCHAR *extension, TCHAR *command, struct contextcommand *cc, const TCHAR *perceivedtype, const TCHAR *description, const TCHAR *ext2, int icon) +static int shell_associate (const TCHAR *extension, const TCHAR *command, struct contextcommand *cc, const TCHAR *perceivedtype, const TCHAR *description, const TCHAR *ext2, int icon) { int v = shell_associate_2 (extension, NULL, command, cc, perceivedtype, description, ext2, icon); if (!_tcscmp (extension, _T(".uae"))) @@ -5660,7 +5660,7 @@ static void WIN32_HandleRegistryStuff (void) } #if WINUAEPUBLICBETA > 0 -static TCHAR *BETAMESSAGE = { +static const TCHAR *BETAMESSAGE = { _T("This is unstable beta software. Click cancel if you are not comfortable using software that is incomplete and can have serious programming errors.") }; #endif diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 58515aaa..3398d92a 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -2826,7 +2826,8 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs TCHAR file_name[MAX_DPATH] = _T(""); TCHAR init_path[MAX_DPATH] = _T(""); BOOL result = FALSE; - TCHAR *amiga_path = NULL, *initialdir = NULL, *defext = NULL; + TCHAR* amiga_path = NULL, * initialdir = NULL; + const TCHAR *defext = NULL; TCHAR *p, *nextp; int all = 1; int next; @@ -6509,8 +6510,8 @@ typedef struct url_info { int id; BOOL state; - TCHAR *display; - TCHAR *url; + const TCHAR *display; + const TCHAR *url; } urlinfo; static urlinfo urls[] = @@ -6623,7 +6624,7 @@ static void setmultiautocomplete (HWND hDlg, int *ids) setautocomplete (hDlg, ids[i]); } -static void wsetpath (HWND hDlg, TCHAR *name, DWORD d, TCHAR *def) +static void wsetpath (HWND hDlg, const TCHAR *name, DWORD d, const TCHAR *def) { TCHAR tmp[MAX_DPATH]; @@ -8316,7 +8317,7 @@ static void init_resolution_combo (HWND hDlg) static void init_displays_combo (HWND hDlg, bool rtg) { - TCHAR *adapter = _T(""); + const TCHAR *adapter = _T(""); struct MultiDisplay *md = Displays; int cnt = 0, cnt2 = 0; int displaynum; @@ -8349,7 +8350,7 @@ static bool get_displays_combo (HWND hDlg, bool rtg) { struct MultiDisplay *md = Displays; LRESULT posn; - TCHAR *adapter = _T(""); + const TCHAR *adapter = _T(""); int cnt = 0, cnt2 = 0; int displaynum; int id = rtg ? IDC_RTG_DISPLAYSELECT : IDC_DISPLAYSELECT; @@ -12056,7 +12057,7 @@ static void enable_for_miscdlg (HWND hDlg) static void misc_kbled (HWND hDlg, int v, int nv) { - TCHAR *defname = v == IDC_KBLED1 ? _T("(NumLock)") : v == IDC_KBLED2 ? _T("(CapsLock)") : _T("(ScrollLock)"); + const TCHAR *defname = v == IDC_KBLED1 ? _T("(NumLock)") : v == IDC_KBLED2 ? _T("(CapsLock)") : _T("(ScrollLock)"); SendDlgItemMessage (hDlg, v, CB_RESETCONTENT, 0, 0L); SendDlgItemMessage (hDlg, v, CB_ADDSTRING, 0, (LPARAM)defname); SendDlgItemMessage (hDlg, v, CB_ADDSTRING, 0, (LPARAM)_T("POWER")); @@ -19276,7 +19277,7 @@ static void *filtervars2[] = { }; struct filterpreset { - TCHAR *name; + const TCHAR *name; int conf[27]; }; static const struct filterpreset filterpresets[] = diff --git a/pcem/device.h b/pcem/device.h index e8177154..e7152b38 100644 --- a/pcem/device.h +++ b/pcem/device.h @@ -46,8 +46,8 @@ void device_add_status_info(char *s, int max_len); extern char *current_device_name; -int device_get_config_int(char *name); -char *device_get_config_string(char *name); +int device_get_config_int(const char *name); +char *device_get_config_string(const char *name); enum { @@ -58,7 +58,7 @@ enum DEVICE_PS1 = 0x80 /*Device is only for IBM PS/1 Model 2011*/ }; -int model_get_config_int(char *s); -char *model_get_config_string(char *s); +int model_get_config_int(const char *s); +char *model_get_config_string(const char *s); #endif diff --git a/pcem/pcemglue.cpp b/pcem/pcemglue.cpp index 8282396e..2af395ed 100644 --- a/pcem/pcemglue.cpp +++ b/pcem/pcemglue.cpp @@ -340,7 +340,7 @@ MODEL models[] = { "[386SX] AMI 386SX clone", ROM_AMI386SX, "ami386", { { "386SX", cpus_i386SX }, { "386DX", cpus_i386DX }, { "486", cpus_i486 } }, MODEL_GFX_NONE | MODEL_AT | MODEL_HAS_IDE, 512, 16384, 128, model_init, NULL }, }; -int rom_present(char *s) +int rom_present(const char *s) { return 0; } diff --git a/pcem/rom.h b/pcem/rom.h index 18e8cf8e..e7f746fa 100644 --- a/pcem/rom.h +++ b/pcem/rom.h @@ -2,7 +2,7 @@ #define _ROM_H_ FILE *romfopen(char *fn, char *mode); -int rom_present(char *fn); +int rom_present(const char *fn); typedef struct rom_t { diff --git a/pcem/x86.h b/pcem/x86.h index 5391e4fb..d761d69a 100644 --- a/pcem/x86.h +++ b/pcem/x86.h @@ -273,7 +273,7 @@ extern uint8_t *pccache2; void x86illegal(); void x86seg_reset(); -void x86gpf(char *s, uint16_t error); +void x86gpf(const char *s, uint16_t error); void resetx86(); void softresetx86(); diff --git a/pcem/x86seg.cpp b/pcem/x86seg.cpp index 766d0bc0..7c39a9cf 100644 --- a/pcem/x86seg.cpp +++ b/pcem/x86seg.cpp @@ -170,25 +170,25 @@ void x86_doabrt(int x86_abrt) } } } -void x86gpf(char *s, uint16_t error) +void x86gpf(const char *s, uint16_t error) { // pclog("GPF %04X\n", error); cpu_state.abrt = ABRT_GPF; abrt_error = error; } -void x86ss(char *s, uint16_t error) +void x86ss(const char *s, uint16_t error) { // pclog("SS %04X\n", error); cpu_state.abrt = ABRT_SS; abrt_error = error; } -void x86ts(char *s, uint16_t error) +void x86ts(const char *s, uint16_t error) { // pclog("TS %04X\n", error); cpu_state.abrt = ABRT_TS; abrt_error = error; } -void x86np(char *s, uint16_t error) +void x86np(const char *s, uint16_t error) { // pclog("NP %04X : %s\n", error, s); cpu_state.abrt = ABRT_NP; diff --git a/x86.cpp b/x86.cpp index 4627de8a..6c5cb0ab 100644 --- a/x86.cpp +++ b/x86.cpp @@ -3292,7 +3292,7 @@ void *cms_init(); static int x86_global_settings; -int device_get_config_int(char *s) +int device_get_config_int(const char *s) { if (!strcmp(s, "bilinear")) { return 1;