From 43218f1685ec1eedb60c3a3197a211dd285905e0 Mon Sep 17 00:00:00 2001 From: smallmodel <15067410+smallmodel@users.noreply.github.com> Date: Fri, 29 Dec 2023 20:19:28 +0100 Subject: [PATCH] Use a const str& reference --- code/client/cl_uifilepicker.cpp | 4 ++-- code/client/cl_uifilepicker.h | 4 ++-- code/client/cl_uimaprunner.cpp | 8 ++++---- code/client/cl_uimaprunner.h | 8 ++++---- code/client/cl_uisoundpicker.cpp | 4 ++-- code/client/cl_uisoundpicker.h | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/code/client/cl_uifilepicker.cpp b/code/client/cl_uifilepicker.cpp index 7f1ca8f3..4a368691 100644 --- a/code/client/cl_uifilepicker.cpp +++ b/code/client/cl_uifilepicker.cpp @@ -203,7 +203,7 @@ void FilePickerClass::SetupFiles(void) window->setTitle(currentDirectory); } -void FilePickerClass::FileSelected(str& currentDirectory, str& partialName, str& fullname) {} +void FilePickerClass::FileSelected(const str& currentDirectory, const str& partialName, const str& fullname) {} void FilePickerClass::FileSelected(Event *ev) { @@ -216,7 +216,7 @@ void FilePickerClass::FileSelected(Event *ev) uii.Snd_PlaySound("sound/menu/scroll.wav"); } -void FilePickerClass::FileChosen(str& currentDirectory, str& partialName, str& fullname) {} +void FilePickerClass::FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) {} void FilePickerClass::FileChosen(Event *ev) { diff --git a/code/client/cl_uifilepicker.h b/code/client/cl_uifilepicker.h index b7ecfae8..9881d9ee 100644 --- a/code/client/cl_uifilepicker.h +++ b/code/client/cl_uifilepicker.h @@ -47,9 +47,9 @@ private: protected: void CloseWindow(void); void FileSelected(Event *ev); - virtual void FileSelected(str& currentDirectory, str& partialName, str& fullname); + virtual void FileSelected(const str& currentDirectory, const str& partialName, const str& fullname); void FileChosen(Event *ev); - virtual void FileChosen(str& currentDirectory, str& partialName, str& fullname); + virtual void FileChosen(const str& currentDirectory, const str& partialName, const str& fullname); void OnDeactivated(Event *ev); public: diff --git a/code/client/cl_uimaprunner.cpp b/code/client/cl_uimaprunner.cpp index 514fe490..6a5cf205 100644 --- a/code/client/cl_uimaprunner.cpp +++ b/code/client/cl_uimaprunner.cpp @@ -26,7 +26,7 @@ CLASS_DECLARATION(FilePickerClass, MapRunnerClass, NULL) { {NULL, NULL} }; -void MapRunnerClass::FileChosen(str& currentDirectory, str& partialName, str& fullname) +void MapRunnerClass::FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) { str newName; @@ -54,7 +54,7 @@ UIPickFileClass::~UIPickFileClass() } } -void UIPickFileClass::FileChosen(str& currentDirectory, str& partialName, str& fullname) +void UIPickFileClass::FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) { if (!retobj || !retevent) { CloseWindow(); @@ -101,7 +101,7 @@ CLASS_DECLARATION(FilePickerClass, ViewSpawnerClass, NULL) { {NULL, NULL} }; -void ViewSpawnerClass::FileChosen(str& currentDirectory, str& partialName, str& fullname) +void ViewSpawnerClass::FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) { str newName; @@ -116,7 +116,7 @@ CLASS_DECLARATION(FilePickerClass, LODSpawnerClass, NULL) { {NULL, NULL} }; -void LODSpawnerClass::FileChosen(str& currentDirectory, str& partialName, str& fullname) +void LODSpawnerClass::FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) { str newName; diff --git a/code/client/cl_uimaprunner.h b/code/client/cl_uimaprunner.h index f666b0cc..21d8a708 100644 --- a/code/client/cl_uimaprunner.h +++ b/code/client/cl_uimaprunner.h @@ -27,7 +27,7 @@ class MapRunnerClass : public FilePickerClass public: CLASS_PROTOTYPE(MapRunnerClass); - void FileChosen(str& currentDirectory, str& partialName, str& fullname) override; + void FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) override; }; class ViewSpawnerClass : public FilePickerClass @@ -35,7 +35,7 @@ class ViewSpawnerClass : public FilePickerClass public: CLASS_PROTOTYPE(ViewSpawnerClass); - void FileChosen(str& currentDirectory, str& partialName, str& fullname) override; + void FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) override; }; class LODSpawnerClass : public FilePickerClass @@ -43,7 +43,7 @@ class LODSpawnerClass : public FilePickerClass public: CLASS_PROTOTYPE(LODSpawnerClass); - void FileChosen(str& currentDirectory, str& partialName, str& fullname) override; + void FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) override; }; class UIPickFileClass : public FilePickerClass @@ -57,7 +57,7 @@ public: UIPickFileClass(); ~UIPickFileClass(); - void FileChosen(str& currentDirectory, str& partialName, str& fullname) override; + void FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) override; }; void PickFile(const char *name, Listener *obj, Event& event); diff --git a/code/client/cl_uisoundpicker.cpp b/code/client/cl_uisoundpicker.cpp index 15e64e2b..0d10b7ac 100644 --- a/code/client/cl_uisoundpicker.cpp +++ b/code/client/cl_uisoundpicker.cpp @@ -31,12 +31,12 @@ SoundPickerClass::SoundPickerClass() // FIXME: stub } -void SoundPickerClass::FileSelected(str& currentDirectory, str& partialName, str& fullname) +void SoundPickerClass::FileSelected(const str& currentDirectory, const str& partialName, const str& fullname) { // FIXME: stub } -void SoundPickerClass::FileChosen(str& currentDirectory, str& partialName, str& fullname) +void SoundPickerClass::FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) { // FIXME: stub } diff --git a/code/client/cl_uisoundpicker.h b/code/client/cl_uisoundpicker.h index 6918e271..6c6a9275 100644 --- a/code/client/cl_uisoundpicker.h +++ b/code/client/cl_uisoundpicker.h @@ -29,6 +29,6 @@ public: SoundPickerClass(); - void FileSelected(str& currentDirectory, str& partialName, str& fullname) override; - void FileChosen(str& currentDirectory, str& partialName, str& fullname) override; + void FileSelected(const str& currentDirectory, const str& partialName, const str& fullname) override; + void FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) override; };