git repos / PlatformFolders

commit ba428e10

sum01 · 2018-04-27 05:42
ba428e10608fc3ee784598c5d609437d97f0b716 patch · browse files
parent a9fe2cf35ca68018c8bdb7773abb14991d4aef33

Add an Astyle config file & format

The used settings are what were referred to in Gitter

"I usually use astyle. Typically "astyle -t -j -y -c -k1 -z2 -A2 --pad-header "."

Changed files

A .astylerc
M sago/platform_folders.cpp before
diff --git a/.astylerc b/.astylerc new file mode 100644 index 0000000..a131157 --- /dev/null +++ b/.astylerc
@@ -0,0 +1,8 @@
+-t
+-j
+-y
+-c
+-k1
+-z2
+-A2
+--pad-header
diff --git a/sago/platform_folders.cpp b/sago/platform_folders.cpp index d170d97..c7b1709 100644 --- a/sago/platform_folders.cpp +++ b/sago/platform_folders.cpp
@@ -46,8 +46,7 @@ SOFTWARE.
// For SHGetFolderPathW and various CSIDL "magic numbers"
#include <shlobj.h>
-static std::string win32_utf16_to_utf8(const wchar_t* wstr)
-{
+static std::string win32_utf16_to_utf8(const wchar_t* wstr) {
std::string res;
// If the 6th parameter is 0 then WideCharToMultiByte returns the number of bytes needed to store the result.
int actualSize = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, nullptr, 0, nullptr, nullptr);
@@ -68,8 +67,7 @@ static std::string win32_utf16_to_utf8(const wchar_t* wstr)
static std::string GetWindowsFolder(int folderId, const char* errorMsg) {
wchar_t szPath[MAX_PATH];
szPath[0] = 0;
- if ( !SUCCEEDED( SHGetFolderPathW( nullptr, folderId, nullptr, 0, szPath ) ) )
- {
+ if ( !SUCCEEDED( SHGetFolderPathW( nullptr, folderId, nullptr, 0, szPath ) ) ) {
throw std::runtime_error(errorMsg);
}
return win32_utf16_to_utf8(szPath);