From 470b09fe9d7cdef8c7c1178d3017b50e365af04c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 27 May 2018 18:24:43 -0400 Subject: [PATCH] CDUtils: Amend function names Amends the function names to follow our coding style. --- Source/Core/Common/CDUtils.cpp | 22 +++++++++++----------- Source/Core/Common/CDUtils.h | 4 ++-- Source/Core/Core/Boot/Boot.cpp | 2 +- Source/Core/DiscIO/Blob.cpp | 2 +- Source/Core/DolphinQt2/MenuBar.cpp | 2 +- Source/Core/DolphinWX/GameListCtrl.cpp | 2 +- Source/Core/DolphinWX/MainMenuBar.cpp | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Source/Core/Common/CDUtils.cpp b/Source/Core/Common/CDUtils.cpp index d3f0221fef..635df4309e 100644 --- a/Source/Core/Common/CDUtils.cpp +++ b/Source/Core/Common/CDUtils.cpp @@ -38,13 +38,13 @@ namespace Common { #ifdef _WIN32 // takes a root drive path, returns true if it is a cdrom drive -bool is_cdrom(const TCHAR* drive) +static bool IsCDROM(const TCHAR* drive) { return (DRIVE_CDROM == GetDriveType(drive)); } // Returns a vector with the device names -std::vector cdio_get_devices() +std::vector GetCDDevices() { std::vector drives; @@ -55,7 +55,7 @@ std::vector cdio_get_devices() auto drive = buff.data(); while (*drive) { - if (is_cdrom(drive)) + if (IsCDROM(drive)) { std::string str(TStrToUTF8(drive)); str.pop_back(); // we don't want the final backslash @@ -72,7 +72,7 @@ std::vector cdio_get_devices() } #elif defined __APPLE__ // Returns a pointer to an array of strings with the device names -std::vector cdio_get_devices() +std::vector GetCDDevices() { io_object_t next_media; mach_port_t master_port; @@ -150,7 +150,7 @@ static struct {nullptr, 0, 0}}; // Returns true if a device is a block or char device and not a symbolic link -static bool is_device(const std::string& source_name) +static bool IsDevice(const std::string& source_name) { struct stat buf; if (0 != lstat(source_name.c_str(), &buf)) @@ -160,10 +160,10 @@ static bool is_device(const std::string& source_name) } // Check a device to see if it is a DVD/CD-ROM drive -static bool is_cdrom(const std::string& drive, char* mnttype) +static bool IsCDROM(const std::string& drive, char* mnttype) { // Check if the device exists - if (!is_device(drive)) + if (!IsDevice(drive)) return false; bool is_cd = false; @@ -181,7 +181,7 @@ static bool is_cdrom(const std::string& drive, char* mnttype) } // Returns a pointer to an array of strings with the device names -std::vector cdio_get_devices() +std::vector GetCDDevices() { std::vector drives; // Scan the system for DVD/CD-ROM drives. @@ -190,7 +190,7 @@ std::vector cdio_get_devices() for (unsigned int j = checklist[i].num_min; j <= checklist[i].num_max; ++j) { std::string drive = StringFromFormat(checklist[i].format, j); - if (is_cdrom(drive, nullptr)) + if (IsCDROM(drive, nullptr)) { drives.push_back(std::move(drive)); } @@ -201,7 +201,7 @@ std::vector cdio_get_devices() #endif // Returns true if device is a cdrom/dvd drive -bool cdio_is_cdrom(std::string device) +bool IsCDROMDevice(std::string device) { #ifndef _WIN32 // Resolve symbolic links. This allows symbolic links to valid @@ -213,7 +213,7 @@ bool cdio_is_cdrom(std::string device) device = devname; #endif - std::vector devices = cdio_get_devices(); + std::vector devices = GetCDDevices(); for (const std::string& d : devices) { if (d == device) diff --git a/Source/Core/Common/CDUtils.h b/Source/Core/Common/CDUtils.h index f74f10640a..d9c17c58f3 100644 --- a/Source/Core/Common/CDUtils.h +++ b/Source/Core/Common/CDUtils.h @@ -10,8 +10,8 @@ namespace Common { // Returns a pointer to an array of strings with the device names -std::vector cdio_get_devices(); +std::vector GetCDDevices(); // Returns true if device is cdrom/dvd -bool cdio_is_cdrom(std::string device); +bool IsCDROMDevice(std::string device); } // namespace Common diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index 6c868cbf88..ac05211481 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -62,7 +62,7 @@ std::unique_ptr BootParameters::GenerateFromFile(const std::string& path, const std::optional& savestate_path) { - const bool is_drive = Common::cdio_is_cdrom(path); + const bool is_drive = Common::IsCDROMDevice(path); // Check if the file exist, we may have gotten it from a --elf command line // that gave an incorrect file name if (!is_drive && !File::Exists(path)) diff --git a/Source/Core/DiscIO/Blob.cpp b/Source/Core/DiscIO/Blob.cpp index 477daafd40..7db5748ae3 100644 --- a/Source/Core/DiscIO/Blob.cpp +++ b/Source/Core/DiscIO/Blob.cpp @@ -176,7 +176,7 @@ u32 SectorReader::ReadChunk(u8* buffer, u64 chunk_num) std::unique_ptr CreateBlobReader(const std::string& filename) { - if (Common::cdio_is_cdrom(filename)) + if (Common::IsCDROMDevice(filename)) return DriveReader::Create(filename); File::IOFile file(filename, "rb"); diff --git a/Source/Core/DolphinQt2/MenuBar.cpp b/Source/Core/DolphinQt2/MenuBar.cpp index 96cc4d8f6f..fc6bb7dcea 100644 --- a/Source/Core/DolphinQt2/MenuBar.cpp +++ b/Source/Core/DolphinQt2/MenuBar.cpp @@ -166,7 +166,7 @@ void MenuBar::AddDVDBackupMenu(QMenu* file_menu) { m_backup_menu = file_menu->addMenu(tr("&Boot from DVD Backup")); - const std::vector drives = Common::cdio_get_devices(); + const std::vector drives = Common::GetCDDevices(); // Windows Limitation of 24 character drives for (size_t i = 0; i < drives.size() && i < 24; i++) { diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp index 89d6fc2302..1a70fe5b28 100644 --- a/Source/Core/DolphinWX/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/GameListCtrl.cpp @@ -397,7 +397,7 @@ void GameListCtrl::RefreshList() if (SConfig::GetInstance().m_ListDrives) { std::unique_lock lk(m_title_database_mutex); - for (const auto& drive : Common::cdio_get_devices()) + for (const auto& drive : Common::GetCDDevices()) { auto file = std::make_shared(drive); if (file->IsValid()) diff --git a/Source/Core/DolphinWX/MainMenuBar.cpp b/Source/Core/DolphinWX/MainMenuBar.cpp index d58a2d7cf6..92c979ec62 100644 --- a/Source/Core/DolphinWX/MainMenuBar.cpp +++ b/Source/Core/DolphinWX/MainMenuBar.cpp @@ -72,7 +72,7 @@ wxMenu* MainMenuBar::CreateFileMenu() const { auto* const external_drive_menu = new wxMenu; - const std::vector drives = Common::cdio_get_devices(); + const std::vector drives = Common::GetCDDevices(); // Windows Limitation of 24 character drives for (size_t i = 0; i < drives.size() && i < 24; i++) {