From 80f3eaeb9187de0457b60cdf2aaebfe7afc78fdd Mon Sep 17 00:00:00 2001 From: Kelvin Lee Date: Tue, 1 Mar 2022 07:52:18 +1100 Subject: [PATCH] Various *Name() functions can simply return const std::string& (PR #1049) --- source/CPU.cpp | 2 +- source/Disk.cpp | 2 +- source/Disk.h | 2 +- source/FourPlay.cpp | 2 +- source/FourPlay.h | 2 +- source/Harddisk.cpp | 2 +- source/Harddisk.h | 2 +- source/Joystick.cpp | 2 +- source/Keyboard.cpp | 2 +- source/LanguageCard.cpp | 8 ++++---- source/LanguageCard.h | 8 ++++---- source/Memory.cpp | 8 ++++---- source/Memory.h | 2 +- source/Mockingboard.cpp | 4 ++-- source/Mockingboard.h | 4 ++-- source/MouseInterface.cpp | 2 +- source/MouseInterface.h | 2 +- source/NoSlotClock.cpp | 2 +- source/NoSlotClock.h | 2 +- source/ParallelPrinter.cpp | 2 +- source/ParallelPrinter.h | 2 +- source/SAM.cpp | 2 +- source/SAM.h | 2 +- source/SNESMAX.cpp | 2 +- source/SNESMAX.h | 2 +- source/SaveState.cpp | 6 +++--- source/SerialComms.cpp | 2 +- source/SerialComms.h | 2 +- source/Speaker.cpp | 2 +- source/Uthernet1.cpp | 2 +- source/Uthernet1.h | 2 +- source/Uthernet2.cpp | 2 +- source/Uthernet2.h | 2 +- source/VidHD.cpp | 4 ++-- source/VidHD.h | 2 +- source/Video.cpp | 2 +- source/Video.h | 2 +- source/Z80VICE/z80.cpp | 2 +- source/z80emu.h | 2 +- 39 files changed, 53 insertions(+), 53 deletions(-) diff --git a/source/CPU.cpp b/source/CPU.cpp index 9c97a544..47997584 100644 --- a/source/CPU.cpp +++ b/source/CPU.cpp @@ -797,7 +797,7 @@ void CpuNmiDeassert(eIRQSRC Device) #define SS_YAML_VALUE_6502 "6502" #define SS_YAML_VALUE_65C02 "65C02" -static std::string CpuGetSnapshotStructName(void) +static const std::string& CpuGetSnapshotStructName(void) { static const std::string name("CPU"); return name; diff --git a/source/Disk.cpp b/source/Disk.cpp index 5de8023c..03301c5a 100644 --- a/source/Disk.cpp +++ b/source/Disk.cpp @@ -1965,7 +1965,7 @@ static const UINT kUNIT_VERSION = 6; #define SS_YAML_KEY_TRACK_IMAGE_DIRTY "Track Image Dirty" #define SS_YAML_KEY_TRACK_IMAGE "Track Image" -std::string Disk2InterfaceCard::GetSnapshotCardName(void) +const std::string& Disk2InterfaceCard::GetSnapshotCardName(void) { static const std::string name(SS_YAML_VALUE_CARD_DISK2); return name; diff --git a/source/Disk.h b/source/Disk.h index ae5134d4..095f57f4 100644 --- a/source/Disk.h +++ b/source/Disk.h @@ -166,7 +166,7 @@ public: bool DriveSwap(void); bool IsDriveConnected(int drive) { return m_floppyDrive[drive].m_isConnected; } - static std::string GetSnapshotCardName(void); + static const std::string& GetSnapshotCardName(void); virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper); virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version); diff --git a/source/FourPlay.cpp b/source/FourPlay.cpp index 2a3783ca..7d220d16 100644 --- a/source/FourPlay.cpp +++ b/source/FourPlay.cpp @@ -132,7 +132,7 @@ void FourPlayCard::InitializeIO(LPBYTE pCxRomPeripheral) static const UINT kUNIT_VERSION = 1; -std::string FourPlayCard::GetSnapshotCardName(void) +const std::string& FourPlayCard::GetSnapshotCardName(void) { static const std::string name("4Play"); return name; diff --git a/source/FourPlay.h b/source/FourPlay.h index 51de24e2..fc830b01 100644 --- a/source/FourPlay.h +++ b/source/FourPlay.h @@ -19,7 +19,7 @@ public: static BYTE __stdcall IORead(WORD pc, WORD addr, BYTE bWrite, BYTE value, ULONG nExecutedCycles); - static std::string GetSnapshotCardName(void); + static const std::string& GetSnapshotCardName(void); virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper); virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version); diff --git a/source/Harddisk.cpp b/source/Harddisk.cpp index 65503488..fe373b3e 100644 --- a/source/Harddisk.cpp +++ b/source/Harddisk.cpp @@ -774,7 +774,7 @@ static const UINT kUNIT_VERSION = 3; #define SS_YAML_KEY_BUF "Buffer" #define SS_YAML_KEY_NOT_BUSY_CYCLE "Not Busy Cycle" -std::string HarddiskInterfaceCard::GetSnapshotCardName(void) +const std::string& HarddiskInterfaceCard::GetSnapshotCardName(void) { static const std::string name(SS_YAML_VALUE_CARD_HDD); return name; diff --git a/source/Harddisk.h b/source/Harddisk.h index d66b1ee8..882b8bd8 100644 --- a/source/Harddisk.h +++ b/source/Harddisk.h @@ -103,7 +103,7 @@ public: void GetLightStatus(Disk_Status_e* pDisk1Status); bool ImageSwap(void); - static std::string GetSnapshotCardName(void); + static const std::string& GetSnapshotCardName(void); virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper); virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version); diff --git a/source/Joystick.cpp b/source/Joystick.cpp index 4c138476..114ea689 100644 --- a/source/Joystick.cpp +++ b/source/Joystick.cpp @@ -936,7 +936,7 @@ void JoyportControl(const UINT uControl) #define SS_YAML_KEY_JOY1TRIMY "Joystick1 TrimY" #define SS_YAML_KEY_PDL_INACTIVE_CYCLE "Paddle%1d Inactive Cycle" -static std::string JoyGetSnapshotStructName(void) +static const std::string& JoyGetSnapshotStructName(void) { static const std::string name("Joystick"); return name; diff --git a/source/Keyboard.cpp b/source/Keyboard.cpp index 885925e2..6fb87bb4 100644 --- a/source/Keyboard.cpp +++ b/source/Keyboard.cpp @@ -457,7 +457,7 @@ void KeybToggleCapsLock () #define SS_YAML_KEY_LASTKEY "Last Key" #define SS_YAML_KEY_KEYWAITING "Key Waiting" -static std::string KeybGetSnapshotStructName(void) +static const std::string& KeybGetSnapshotStructName(void) { static const std::string name("Keyboard"); return name; diff --git a/source/LanguageCard.cpp b/source/LanguageCard.cpp index 7e14f8a0..df09ff73 100644 --- a/source/LanguageCard.cpp +++ b/source/LanguageCard.cpp @@ -172,13 +172,13 @@ static const UINT kUNIT_LANGUAGECARD_VER = 1; #define SS_YAML_KEY_MEMORYMODE "Memory Mode" #define SS_YAML_KEY_LASTRAMWRITE "Last RAM Write" -std::string LanguageCardSlot0::GetSnapshotMemStructName(void) +const std::string& LanguageCardSlot0::GetSnapshotMemStructName(void) { static const std::string name("Memory Bank"); return name; } -std::string LanguageCardSlot0::GetSnapshotCardName(void) +const std::string& LanguageCardSlot0::GetSnapshotCardName(void) { static const std::string name(SS_YAML_VALUE_CARD_LANGUAGECARD); return name; @@ -379,13 +379,13 @@ static const UINT kUNIT_SATURN_VER = 1; #define SS_YAML_KEY_NUM_SATURN_BANKS "Num Saturn Banks" #define SS_YAML_KEY_ACTIVE_SATURN_BANK "Active Saturn Bank" -std::string Saturn128K::GetSnapshotMemStructName(void) +const std::string& Saturn128K::GetSnapshotMemStructName(void) { static const std::string name("Memory Bank"); return name; } -std::string Saturn128K::GetSnapshotCardName(void) +const std::string& Saturn128K::GetSnapshotCardName(void) { static const std::string name(SS_YAML_VALUE_CARD_SATURN128); return name; diff --git a/source/LanguageCard.h b/source/LanguageCard.h index ca2bac75..fc6ee4be 100644 --- a/source/LanguageCard.h +++ b/source/LanguageCard.h @@ -57,7 +57,7 @@ public: virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version); static const UINT kMemBankSize = 16*1024; - static std::string GetSnapshotCardName(void); + static const std::string& GetSnapshotCardName(void); protected: LanguageCardSlot0(SS_CARDTYPE type, UINT slot); @@ -67,7 +67,7 @@ protected: LPBYTE m_pMemory; private: - std::string GetSnapshotMemStructName(void); + const std::string& GetSnapshotMemStructName(void); }; // @@ -92,10 +92,10 @@ public: // "The boards consist of 16K banks of memory (4 banks for the 64K board, 8 banks for the 128K), accessed one at a time" - Ref: "64K/128K RAM BOARD", Saturn Systems, Ch.1 Introduction(pg-5) static const UINT kMaxSaturnBanks = 8; // 8 * 16K = 128K - static std::string GetSnapshotCardName(void); + static const std::string& GetSnapshotCardName(void); private: - std::string GetSnapshotMemStructName(void); + const std::string& GetSnapshotMemStructName(void); static UINT g_uSaturnBanksFromCmdLine; diff --git a/source/Memory.cpp b/source/Memory.cpp index 67dde266..f50a83fe 100644 --- a/source/Memory.cpp +++ b/source/Memory.cpp @@ -2196,25 +2196,25 @@ static const UINT kUNIT_CARD_VER = 3; #define SS_YAML_KEY_NUMAUXBANKS "Num Aux Banks" #define SS_YAML_KEY_ACTIVEAUXBANK "Active Aux Bank" -static std::string MemGetSnapshotStructName(void) +static const std::string& MemGetSnapshotStructName(void) { static const std::string name("Memory"); return name; } -std::string MemGetSnapshotUnitAuxSlotName(void) +const std::string& MemGetSnapshotUnitAuxSlotName(void) { static const std::string name("Auxiliary Slot"); return name; } -static std::string MemGetSnapshotMainMemStructName(void) +static const std::string& MemGetSnapshotMainMemStructName(void) { static const std::string name("Main Memory"); return name; } -static std::string MemGetSnapshotAuxMemStructName(void) +static const std::string& MemGetSnapshotAuxMemStructName(void) { static const std::string name("Auxiliary Memory Bank"); return name; diff --git a/source/Memory.h b/source/Memory.h index b1c1297c..1a0ef3c1 100644 --- a/source/Memory.h +++ b/source/Memory.h @@ -96,7 +96,7 @@ bool MemGetAnnunciator(UINT annunciator); bool MemHasNoSlotClock(void); void MemInsertNoSlotClock(void); void MemRemoveNoSlotClock(void); -std::string MemGetSnapshotUnitAuxSlotName(void); +const std::string& MemGetSnapshotUnitAuxSlotName(void); void MemSaveSnapshot(class YamlSaveHelper& yamlSaveHelper); bool MemLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT unitVersion); void MemSaveSnapshotAux(class YamlSaveHelper& yamlSaveHelper); diff --git a/source/Mockingboard.cpp b/source/Mockingboard.cpp index 82643999..eb2622d4 100644 --- a/source/Mockingboard.cpp +++ b/source/Mockingboard.cpp @@ -1355,13 +1355,13 @@ const UINT NUM_PHASOR_UNITS = 2; #define SS_YAML_KEY_VOTRAX_PHONEME "Votrax Phoneme" -std::string MB_GetSnapshotCardName(void) +const std::string& MB_GetSnapshotCardName(void) { static const std::string name("Mockingboard C"); return name; } -std::string Phasor_GetSnapshotCardName(void) +const std::string& Phasor_GetSnapshotCardName(void) { static const std::string name("Phasor"); return name; diff --git a/source/Mockingboard.h b/source/Mockingboard.h index df807e81..f4a2b37c 100644 --- a/source/Mockingboard.h +++ b/source/Mockingboard.h @@ -31,10 +31,10 @@ void MB_UpdateIFR(BYTE nDevice, BYTE clr_mask, BYTE set_mask); BYTE MB_GetPCR(BYTE nDevice); void MB_GetSnapshot_v1(struct SS_CARD_MOCKINGBOARD_v1* const pSS, const DWORD dwSlot); // For debugger -std::string MB_GetSnapshotCardName(void); +const std::string& MB_GetSnapshotCardName(void); void MB_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper, const UINT uSlot); bool MB_LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version); -std::string Phasor_GetSnapshotCardName(void); +const std::string& Phasor_GetSnapshotCardName(void); void Phasor_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper, const UINT uSlot); bool Phasor_LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version); diff --git a/source/MouseInterface.cpp b/source/MouseInterface.cpp index 141eaa37..ed9e99bd 100644 --- a/source/MouseInterface.cpp +++ b/source/MouseInterface.cpp @@ -628,7 +628,7 @@ void CMouseInterface::SetButton(eBUTTON Button, eBUTTONSTATE State) #define SS_YAML_KEY_BUTTON1 "Button1" #define SS_YAML_KEY_ENABLED "Enabled" -std::string CMouseInterface::GetSnapshotCardName(void) +const std::string& CMouseInterface::GetSnapshotCardName(void) { static const std::string name(SS_YAML_VALUE_CARD_MOUSE); return name; diff --git a/source/MouseInterface.h b/source/MouseInterface.h index fef998ae..09aa7dea 100644 --- a/source/MouseInterface.h +++ b/source/MouseInterface.h @@ -43,7 +43,7 @@ public: m_iY = iY; } - static std::string GetSnapshotCardName(void); + static const std::string& GetSnapshotCardName(void); virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper); virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version); diff --git a/source/NoSlotClock.cpp b/source/NoSlotClock.cpp index e78a7718..6acb275e 100644 --- a/source/NoSlotClock.cpp +++ b/source/NoSlotClock.cpp @@ -187,7 +187,7 @@ void CNoSlotClock::PopulateClockRegister() #define SS_YAML_KEY_COMPARISON_REGISTER_MASK "Comparison Register Mask" #define SS_YAML_KEY_COMPARISON_REGISTER "Comparison Register" -std::string CNoSlotClock::GetSnapshotStructName(void) +const std::string& CNoSlotClock::GetSnapshotStructName(void) { static const std::string name("No Slot Clock"); return name; diff --git a/source/NoSlotClock.h b/source/NoSlotClock.h index 60969943..9b10380e 100644 --- a/source/NoSlotClock.h +++ b/source/NoSlotClock.h @@ -68,7 +68,7 @@ private: bool Read(int address, BYTE& data); void Write(int address); void PopulateClockRegister(); - std::string GetSnapshotStructName(void); + const std::string& GetSnapshotStructName(void); static const UINT64 kClockInitSequence = 0x5CA33AC55CA33AC5; }; diff --git a/source/ParallelPrinter.cpp b/source/ParallelPrinter.cpp index ec5d3f19..22e1154e 100644 --- a/source/ParallelPrinter.cpp +++ b/source/ParallelPrinter.cpp @@ -209,7 +209,7 @@ void Printer_SetIdleLimit(unsigned int Duration) #define SS_YAML_KEY_APPEND "Printer Append" #define SS_YAML_KEY_DUMPTOREALPRINTER "Enable Dump To Real Printer" -std::string Printer_GetSnapshotCardName(void) +const std::string& Printer_GetSnapshotCardName(void) { static const std::string name(SS_YAML_VALUE_CARD_PRINTER); return name; diff --git a/source/ParallelPrinter.h b/source/ParallelPrinter.h index 6cd8b75b..1f27a43e 100644 --- a/source/ParallelPrinter.h +++ b/source/ParallelPrinter.h @@ -9,7 +9,7 @@ const std::string & Printer_GetFilename(); void Printer_SetIdleLimit(unsigned int Duration); unsigned int Printer_GetIdleLimit(); -std::string Printer_GetSnapshotCardName(void); +const std::string& Printer_GetSnapshotCardName(void); void Printer_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper, const UINT uSlot); bool Printer_LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version); diff --git a/source/SAM.cpp b/source/SAM.cpp index b78b93f3..b36c1242 100644 --- a/source/SAM.cpp +++ b/source/SAM.cpp @@ -96,7 +96,7 @@ void SAMCard::InitializeIO(LPBYTE pCxRomPeripheral) static const UINT kUNIT_VERSION = 1; -std::string SAMCard::GetSnapshotCardName(void) +const std::string& SAMCard::GetSnapshotCardName(void) { static const std::string name("SAM"); return name; diff --git a/source/SAM.h b/source/SAM.h index 9fdfdf30..f9c732d0 100644 --- a/source/SAM.h +++ b/source/SAM.h @@ -19,7 +19,7 @@ public: static BYTE __stdcall IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE value, ULONG nExecutedCycles); - static std::string GetSnapshotCardName(void); + static const std::string& GetSnapshotCardName(void); virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper); virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version); diff --git a/source/SNESMAX.cpp b/source/SNESMAX.cpp index 7dc9f70d..788f85df 100644 --- a/source/SNESMAX.cpp +++ b/source/SNESMAX.cpp @@ -213,7 +213,7 @@ static const UINT kUNIT_VERSION = 1; #define SS_YAML_KEY_BUTTON_INDEX "Button Index" -std::string SNESMAXCard::GetSnapshotCardName(void) +const std::string& SNESMAXCard::GetSnapshotCardName(void) { static const std::string name("SNES MAX"); return name; diff --git a/source/SNESMAX.h b/source/SNESMAX.h index 6722d192..06bdb205 100644 --- a/source/SNESMAX.h +++ b/source/SNESMAX.h @@ -27,7 +27,7 @@ public: static BYTE __stdcall IORead(WORD pc, WORD addr, BYTE bWrite, BYTE value, ULONG nExecutedCycles); static BYTE __stdcall IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE value, ULONG nExecutedCycles); - static std::string GetSnapshotCardName(void); + static const std::string& GetSnapshotCardName(void); virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper); virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version); diff --git a/source/SaveState.cpp b/source/SaveState.cpp index d3a49457..ffbcbeb9 100644 --- a/source/SaveState.cpp +++ b/source/SaveState.cpp @@ -165,19 +165,19 @@ void Snapshot_UpdatePath(void) //----------------------------------------------------------------------------- -static std::string GetSnapshotUnitApple2Name(void) +static const std::string& GetSnapshotUnitApple2Name(void) { static const std::string name("Apple2"); return name; } -static std::string GetSnapshotUnitSlotsName(void) +static const std::string& GetSnapshotUnitSlotsName(void) { static const std::string name("Slots"); return name; } -static std::string GetSnapshotUnitMiscName(void) +static const std::string& GetSnapshotUnitMiscName(void) { static const std::string name("Miscellaneous"); return name; diff --git a/source/SerialComms.cpp b/source/SerialComms.cpp index 905e494c..cfb19084 100644 --- a/source/SerialComms.cpp +++ b/source/SerialComms.cpp @@ -1417,7 +1417,7 @@ static const UINT kUNIT_VERSION = 2; #define SS_YAML_KEY_SERIALPORTNAME "Serial Port Name" #define SS_YAML_KEY_SUPPORT_DCD "Support DCD" -std::string CSuperSerialCard::GetSnapshotCardName(void) +const std::string& CSuperSerialCard::GetSnapshotCardName(void) { static const std::string name(SS_YAML_VALUE_CARD_SSC); return name; diff --git a/source/SerialComms.h b/source/SerialComms.h index 05c905d3..06f4922a 100644 --- a/source/SerialComms.h +++ b/source/SerialComms.h @@ -36,7 +36,7 @@ public: void CommReset(); void CommDestroy(); void CommSetSerialPort(DWORD dwNewSerialPortItem); - static std::string GetSnapshotCardName(void); + static const std::string& GetSnapshotCardName(void); virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper); virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version); diff --git a/source/Speaker.cpp b/source/Speaker.cpp index e147f2c8..816ea5e8 100644 --- a/source/Speaker.cpp +++ b/source/Speaker.cpp @@ -952,7 +952,7 @@ static void Spkr_DSUninit() #define SS_YAML_KEY_LASTCYCLE "Last Cycle" -static std::string SpkrGetSnapshotStructName(void) +static const std::string& SpkrGetSnapshotStructName(void) { static const std::string name("Speaker"); return name; diff --git a/source/Uthernet1.cpp b/source/Uthernet1.cpp index 97ad39d3..e8ba9bb5 100644 --- a/source/Uthernet1.cpp +++ b/source/Uthernet1.cpp @@ -1078,7 +1078,7 @@ void Uthernet1::Update(const ULONG nExecutedCycles) static const UINT kUNIT_VERSION = 1; -std::string Uthernet1::GetSnapshotCardName(void) +const std::string& Uthernet1::GetSnapshotCardName(void) { static const std::string name("Uthernet"); return name; diff --git a/source/Uthernet1.h b/source/Uthernet1.h index 8bf6a5dc..05ad6329 100644 --- a/source/Uthernet1.h +++ b/source/Uthernet1.h @@ -135,7 +135,7 @@ public: BYTE tfe_read(WORD ioaddress); void tfe_store(WORD ioaddress, BYTE byte); - static std::string GetSnapshotCardName(void); + static const std::string& GetSnapshotCardName(void); private: diff --git a/source/Uthernet2.cpp b/source/Uthernet2.cpp index cfa2ff09..7df151a7 100644 --- a/source/Uthernet2.cpp +++ b/source/Uthernet2.cpp @@ -239,7 +239,7 @@ uint16_t Socket::getFreeRoom() const return size - rsr; } -std::string Uthernet2::GetSnapshotCardName() +const std::string& Uthernet2::GetSnapshotCardName() { static const std::string name("Uthernet2"); return name; diff --git a/source/Uthernet2.h b/source/Uthernet2.h index 5cf37b64..dbc437d8 100644 --- a/source/Uthernet2.h +++ b/source/Uthernet2.h @@ -49,7 +49,7 @@ struct Socket class Uthernet2 : public Card { public: - static std::string GetSnapshotCardName(); + static const std::string& GetSnapshotCardName(); Uthernet2(UINT slot); diff --git a/source/VidHD.cpp b/source/VidHD.cpp index 14447028..2920c794 100644 --- a/source/VidHD.cpp +++ b/source/VidHD.cpp @@ -183,13 +183,13 @@ static const UINT kUNIT_VERSION = 1; #define SS_YAML_KEY_BORDER_COLOR "Border Color" #define SS_YAML_KEY_SHADOW "Shadow" -std::string VidHDCard::GetSnapshotCardName(void) +const std::string& VidHDCard::GetSnapshotCardName(void) { static const std::string name("VidHD"); return name; } -static std::string MemGetSnapshotAuxMemStructName(void) +static const std::string& MemGetSnapshotAuxMemStructName(void) { static const std::string name("Auxiliary Memory Bank"); return name; diff --git a/source/VidHD.h b/source/VidHD.h index 733eb2ec..503914ec 100644 --- a/source/VidHD.h +++ b/source/VidHD.h @@ -34,7 +34,7 @@ public: static void UpdateSHRCell(bool is640Mode, bool isColorFillMode, uint16_t addrPalette, bgra_t* pVideoAddress, uint32_t a); - static std::string GetSnapshotCardName(void); + static const std::string& GetSnapshotCardName(void); virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper); virtual bool LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT version); diff --git a/source/Video.cpp b/source/Video.cpp index adebe2c8..d6e47f60 100644 --- a/source/Video.cpp +++ b/source/Video.cpp @@ -275,7 +275,7 @@ bool Video::VideoGetSWAltCharSet(void) #define SS_YAML_KEY_CYCLES_THIS_FRAME "Cycles This Frame" #define SS_YAML_KEY_VIDEO_REFRESH_RATE "Video Refresh Rate" -std::string Video::VideoGetSnapshotStructName(void) +const std::string& Video::VideoGetSnapshotStructName(void) { static const std::string name("Video"); return name; diff --git a/source/Video.h b/source/Video.h index f88ec6c1..d580ec35 100644 --- a/source/Video.h +++ b/source/Video.h @@ -285,7 +285,7 @@ protected: private: void SetFrameBuffer(uint8_t* frameBuffer) { g_pFramebufferbits = frameBuffer; } - std::string VideoGetSnapshotStructName(void); + const std::string& VideoGetSnapshotStructName(void); int g_nAltCharSetOffset; uint32_t g_uVideoMode; // Current Video Mode (this is the last set one as it may change mid-scan line!) diff --git a/source/Z80VICE/z80.cpp b/source/Z80VICE/z80.cpp index 44800867..3cb31950 100644 --- a/source/Z80VICE/z80.cpp +++ b/source/Z80VICE/z80.cpp @@ -6465,7 +6465,7 @@ void z80_WRMEM(WORD Addr, BYTE Value) #define SS_YAML_KEY_REGL2 "L'" #define SS_YAML_KEY_ACTIVE "Active" -std::string Z80_GetSnapshotCardName(void) +const std::string& Z80_GetSnapshotCardName(void) { static const std::string name(SS_YAML_VALUE_CARD_Z80); return name; diff --git a/source/z80emu.h b/source/z80emu.h index 1191a049..dfa882df 100644 --- a/source/z80emu.h +++ b/source/z80emu.h @@ -18,6 +18,6 @@ void Z80_InitializeIO(LPBYTE pCxRomPeripheral, UINT uSlot); // NB. These are in z80.cpp: -std::string Z80_GetSnapshotCardName(void); +const std::string& Z80_GetSnapshotCardName(void); void Z80_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper, const UINT uSlot); bool Z80_LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT uSlot, UINT version);