diff options
author | 2016-06-24 23:53:38 +1000 | |
---|---|---|
committer | 2016-06-24 23:53:38 +1000 | |
commit | 20a95045e16ab69cfb13c6d3cf520e63aa553102 (patch) | |
tree | 3a4b4bab3ed8afaedc6a9c499c5737dc6df5d91e /src/osd/modules/file/winfile.cpp | |
parent | 83a9cf42056efe9c78d39b89e4ba394a07c79dce (diff) | |
parent | 7509a56dc0cf8a380eada014167b8075fbcbcdc9 (diff) |
Load save state preparations [Nathan Woods]
* A number of changes and refactorings in preparation for a new load/save state menu. Most notably, I am C++-ifying osd_directory (now osd::directory) and changing osd_stat() to return std::unique_ptrosd::directory::entry
* Take note that this change completely omits POSIX support, simply because I lack a development environment to support it. This will have to be done by someone else.
Diffstat (limited to 'src/osd/modules/file/winfile.cpp')
-rw-r--r-- | src/osd/modules/file/winfile.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/osd/modules/file/winfile.cpp b/src/osd/modules/file/winfile.cpp index 9b6ecdc0535..13af3a025c8 100644 --- a/src/osd/modules/file/winfile.cpp +++ b/src/osd/modules/file/winfile.cpp @@ -354,7 +354,7 @@ int osd_get_physical_drive_geometry(const char *filename, UINT32 *cylinders, UIN // osd_stat //============================================================ -osd_directory_entry *osd_stat(const std::string &path) +std::unique_ptr<osd::directory::entry> osd_stat(const std::string &path) { // convert the path to TCHARs std::unique_ptr<TCHAR, void (*)(void *)> const t_path(tstring_from_utf8(path.c_str()), &osd_free); @@ -379,17 +379,18 @@ osd_directory_entry *osd_stat(const std::string &path) FindClose(find); } - // create an osd_directory_entry; be sure to make sure that the caller can - // free all resources by just freeing the resulting osd_directory_entry - osd_directory_entry *const result = (osd_directory_entry *)osd_malloc_array(sizeof(*result) + path.length() + 1); + // create an osd::directory::entry; be sure to make sure that the caller can + // free all resources by just freeing the resulting osd::directory::entry + osd::directory::entry *result = (osd::directory::entry *) ::operator new(sizeof(*result) + path.length() + 1); if (!result) return nullptr; strcpy(((char *) result) + sizeof(*result), path.c_str()); result->name = ((char *) result) + sizeof(*result); result->type = win_attributes_to_entry_type(find_data.dwFileAttributes); result->size = find_data.nFileSizeLow | ((UINT64) find_data.nFileSizeHigh << 32); + result->last_modified = win_time_point_from_filetime(&find_data.ftLastWriteTime); - return result; + return std::unique_ptr<osd::directory::entry>(result); } |