citra/src
Tobias ef73de9386
Port yuzu-emu/yuzu#2511: "common/file_util: Minor cleanup" (#4782)
* common/file_util: Make IOFile's WriteString take a std::string_view

We don't need to force the usage of a std::string here, and can instead
use a std::string_view, which allows writing out other forms of strings
(e.g. C-style strings) without any unnecessary heap allocations.

* common/file_util: Remove unnecessary c_str() calls

The file stream open functions have supported std::string overloads
since C++11, so we don't need to use c_str() here. Same behavior, less
code.

* common/file_util: Make ReadFileToString and WriteStringToFile consistent

Makes the parameter ordering consistent, and also makes the filename
parameter a std::string. A std::string would be constructed anyways with
the previous code, as IOFile's only constructor with a filepath is one
taking a std::string.

We can also make WriteStringToFile's string parameter utilize a
std::string_view for the string, making use of our previous changes to
IOFile.

* common/file_util: Remove duplicated documentation comments

These are already present within the header, so they don't need to be
repeated in the cpp file.

* common/file_util: Make GetCurrentDir() return a std::optional

nullptr was being returned in the error case, which, at a glance may
seem perfectly OK... until you realize that std::string has the
invariant that it may not be constructed from a null pointer. This
means that if this error case was ever hit, then the application would
most likely crash from a thrown exception in std::string's constructor.

Instead, we can change the function to return an optional value,
indicating if a failure occurred.

* common/file_util: Remove unnecessary return at end of void StripTailDirSlashes()

While we're at it, also invert the conditional into a guard clause.
2019-06-08 00:23:57 +02:00
..
android android: add logging 2019-03-09 18:23:32 -06:00
audio_core audio_core: dsp_hle: use better f32 to s16... 2019-05-01 15:58:26 -06:00
citra Port yuzu-emu/yuzu#2511: "common/file_util: Minor cleanup" (#4782) 2019-06-08 00:23:57 +02:00
citra_qt Check input profile name for duplicates in New/Rename (#4779) 2019-05-24 15:28:59 -06:00
common Port yuzu-emu/yuzu#2511: "common/file_util: Minor cleanup" (#4782) 2019-06-08 00:23:57 +02:00
core Merge pull request #4747 from MerryMage/copyblock 2019-05-07 09:34:02 -04:00
dedicated_room Fix getopt on systems where char is unsigned by default 2019-03-15 23:19:24 +00:00
input_common input_common/sdl/sdl_impl: Silence sign conversion warnings 2019-06-01 02:10:46 +02:00
network general: Use deducation guides for std::lock_guard and std::unique_lock 2019-04-07 15:14:29 +02:00
tests kernel/server_session: Return a std::pair from CreateSessionPair() 2019-04-15 21:46:57 +02:00
video_core video_core: Fix fragment_shader compilation failure due to different type variable multiplication 2019-05-19 14:45:41 +02:00
web_service core, web_service: Check for error when registering rooms 2019-04-20 12:50:14 +08:00
.clang-format add java to .clang-format 2019-02-22 16:29:19 -06:00
CMakeLists.txt android: move cmakelist 2019-01-15 19:24:03 -06:00