From 1d5710151de69ea205c5698a178164f44cacc7ca Mon Sep 17 00:00:00 2001 From: Andrea Odetti Date: Mon, 22 Jun 2020 15:24:32 +0100 Subject: [PATCH] Some minor c++ correctness changes. Add const, static forward declaration. Remove windows.h (already in StdAfx.h) and crtdbg.h (not needed). --- source/AY8910.cpp | 10 ++++------ source/AY8910.h | 8 ++++---- source/Mockingboard.cpp | 4 ++-- source/SoundCore.cpp | 4 ++-- source/SoundCore.h | 4 ++-- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/source/AY8910.cpp b/source/AY8910.cpp index 701a958a..686ba78a 100644 --- a/source/AY8910.cpp +++ b/source/AY8910.cpp @@ -26,9 +26,7 @@ #include "StdAfx.h" -#include #include -#include #include "AY8910.h" #include "Applewin.h" // For g_fh @@ -991,7 +989,7 @@ sound_beeper( int is_tape, int on ) #define SS_YAML_KEY_CHANGE "Change" #define SS_YAML_VALUE_CHANGE_FORMAT "%d, %d, 0x%1X, 0x%02X" -void CAY8910::SaveSnapshot(YamlSaveHelper& yamlSaveHelper, std::string& suffix) +void CAY8910::SaveSnapshot(YamlSaveHelper& yamlSaveHelper, const std::string& suffix) { std::string unit = std::string(SS_YAML_KEY_AY8910) + suffix; YamlSaveHelper::Label label(yamlSaveHelper, "%s:\n", unit.c_str()); @@ -1046,7 +1044,7 @@ void CAY8910::SaveSnapshot(YamlSaveHelper& yamlSaveHelper, std::string& suffix) } } -bool CAY8910::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, std::string& suffix) +bool CAY8910::LoadSnapshot(YamlLoadHelper& yamlLoadHelper, const std::string& suffix) { std::string unit = std::string(SS_YAML_KEY_AY8910) + suffix; if (!yamlLoadHelper.GetSubMap(unit)) @@ -1201,7 +1199,7 @@ BYTE* AY8910_GetRegsPtr(UINT uChip) return g_AY8910[uChip].GetAYRegsPtr(); } -UINT AY8910_SaveSnapshot(YamlSaveHelper& yamlSaveHelper, UINT uChip, std::string& suffix) +UINT AY8910_SaveSnapshot(YamlSaveHelper& yamlSaveHelper, UINT uChip, const std::string& suffix) { if (uChip >= MAX_8910) return 0; @@ -1210,7 +1208,7 @@ UINT AY8910_SaveSnapshot(YamlSaveHelper& yamlSaveHelper, UINT uChip, std::string return 1; } -UINT AY8910_LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT uChip, std::string& suffix) +UINT AY8910_LoadSnapshot(YamlLoadHelper& yamlLoadHelper, UINT uChip, const std::string& suffix) { if (uChip >= MAX_8910) return 0; diff --git a/source/AY8910.h b/source/AY8910.h index 31ad9a15..42962649 100644 --- a/source/AY8910.h +++ b/source/AY8910.h @@ -17,8 +17,8 @@ BYTE* AY8910_GetRegsPtr(UINT uChip); void AY8910UpdateSetCycles(); -UINT AY8910_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper, UINT uChip, std::string& suffix); -UINT AY8910_LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT uChip, std::string& suffix); +UINT AY8910_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper, UINT uChip, const std::string& suffix); +UINT AY8910_LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT uChip, const std::string& suffix); //------------------------------------- // FUSE stuff @@ -46,8 +46,8 @@ public: void sound_frame( void ); BYTE* GetAYRegsPtr( void ) { return &sound_ay_registers[0]; } static void SetCLK( double CLK ) { m_fCurrentCLK_AY8910 = CLK; } - void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper, std::string& suffix); - bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, std::string& suffix); + void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper, const std::string& suffix); + bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, const std::string& suffix); private: void init( void ); diff --git a/source/Mockingboard.cpp b/source/Mockingboard.cpp index b71e42d9..3524b39c 100644 --- a/source/Mockingboard.cpp +++ b/source/Mockingboard.cpp @@ -555,7 +555,7 @@ static BYTE SY6522_Read(BYTE nDevice, BYTE nReg) //--------------------------------------------------------------------------- -void SSI263_Play(unsigned int nPhoneme); +static void SSI263_Play(unsigned int nPhoneme); #if 0 typedef struct @@ -1510,7 +1510,7 @@ void MB_Initialize() g_bCritSectionValid = true; } -void MB_SetSoundcardType(SS_CARDTYPE NewSoundcardType); +static void MB_SetSoundcardType(SS_CARDTYPE NewSoundcardType); // NB. Mockingboard voice is *already* muted because showing 'Select Load State file' dialog // . and voice will be demuted when dialog is closed diff --git a/source/SoundCore.cpp b/source/SoundCore.cpp index 6ec6c623..29d66d52 100644 --- a/source/SoundCore.cpp +++ b/source/SoundCore.cpp @@ -224,7 +224,7 @@ void DSReleaseSoundBuffer(VOICE* pVoice) //----------------------------------------------------------------------------- -bool DSZeroVoiceBuffer(PVOICE Voice, char* pszDevName, DWORD dwBufferSize) +bool DSZeroVoiceBuffer(PVOICE Voice, const char* pszDevName, DWORD dwBufferSize) { #ifdef NO_DIRECT_X @@ -273,7 +273,7 @@ bool DSZeroVoiceBuffer(PVOICE Voice, char* pszDevName, DWORD dwBufferSize) //----------------------------------------------------------------------------- -bool DSZeroVoiceWritableBuffer(PVOICE Voice, char* pszDevName, DWORD dwBufferSize) +bool DSZeroVoiceWritableBuffer(PVOICE Voice, const char* pszDevName, DWORD dwBufferSize) { DWORD dwDSLockedBufferSize0=0, dwDSLockedBufferSize1=0; SHORT *pDSLockedBuffer0, *pDSLockedBuffer1; diff --git a/source/SoundCore.h b/source/SoundCore.h index ecc2f2b1..02b129c2 100644 --- a/source/SoundCore.h +++ b/source/SoundCore.h @@ -29,8 +29,8 @@ bool DSGetLock(LPDIRECTSOUNDBUFFER pVoice, DWORD dwOffset, DWORD dwBytes, HRESULT DSGetSoundBuffer(VOICE* pVoice, DWORD dwFlags, DWORD dwBufferSize, DWORD nSampleRate, int nChannels); void DSReleaseSoundBuffer(VOICE* pVoice); -bool DSZeroVoiceBuffer(PVOICE Voice, char* pszDevName, DWORD dwBufferSize); -bool DSZeroVoiceWritableBuffer(PVOICE Voice, char* pszDevName, DWORD dwBufferSize); +bool DSZeroVoiceBuffer(PVOICE Voice, const char* pszDevName, DWORD dwBufferSize); +bool DSZeroVoiceWritableBuffer(PVOICE Voice, const char* pszDevName, DWORD dwBufferSize); enum eFADE {FADE_NONE, FADE_IN, FADE_OUT}; void SoundCore_SetFade(eFADE FadeType);