mirror of
https://github.com/azahar-emu/azahar.git
synced 2026-06-07 19:23:39 -04:00
Apply clang-format
This commit is contained in:
parent
d7cb523e75
commit
3ab7fa4dd8
2 changed files with 13 additions and 23 deletions
|
|
@ -24,8 +24,6 @@
|
|||
#include <CoreFoundation/CFString.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
namespace Common {
|
||||
|
||||
/// Make a char lowercase
|
||||
|
|
@ -176,21 +174,17 @@ std::u16string UTF8ToUTF16(std::string_view input) {
|
|||
std::string NormalizeNFDToNFC(std::string_view input) {
|
||||
const std::string fallback(input);
|
||||
|
||||
//Core Foundation string
|
||||
CFStringRef source = CFStringCreateWithBytes(
|
||||
kCFAllocatorDefault,
|
||||
reinterpret_cast<const UInt8*>(input.data()),
|
||||
static_cast<CFIndex>(input.size()),
|
||||
kCFStringEncodingUTF8,
|
||||
false);
|
||||
// Core Foundation string
|
||||
CFStringRef source =
|
||||
CFStringCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(input.data()),
|
||||
static_cast<CFIndex>(input.size()), kCFStringEncodingUTF8, false);
|
||||
|
||||
if (source == nullptr) {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
// Mutable copy of the source string
|
||||
CFMutableStringRef normalized =
|
||||
CFStringCreateMutableCopy(kCFAllocatorDefault, 0, source);
|
||||
CFMutableStringRef normalized = CFStringCreateMutableCopy(kCFAllocatorDefault, 0, source);
|
||||
CFRelease(source);
|
||||
|
||||
if (normalized == nullptr) {
|
||||
|
|
@ -199,19 +193,15 @@ std::string NormalizeNFDToNFC(std::string_view input) {
|
|||
// Normalize the string to NFC form
|
||||
CFStringNormalize(normalized, kCFStringNormalizationFormC);
|
||||
|
||||
const CFIndex max_size =
|
||||
CFStringGetMaximumSizeForEncoding(
|
||||
CFStringGetLength(normalized),
|
||||
kCFStringEncodingUTF8) + 1; // +1 for null terminator
|
||||
const CFIndex max_size = CFStringGetMaximumSizeForEncoding(CFStringGetLength(normalized),
|
||||
kCFStringEncodingUTF8) +
|
||||
1; // +1 for null terminator
|
||||
|
||||
std::string output(static_cast<std::size_t>(max_size), '\0');
|
||||
|
||||
// Convert the normalized string back to UTF-8
|
||||
const bool converted = CFStringGetCString(
|
||||
normalized,
|
||||
&output[0],
|
||||
max_size,
|
||||
kCFStringEncodingUTF8);
|
||||
const bool converted =
|
||||
CFStringGetCString(normalized, &output[0], max_size, kCFStringEncodingUTF8);
|
||||
|
||||
CFRelease(normalized);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include "common/archives.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/file_util.h"
|
||||
|
|
@ -67,9 +67,9 @@ u32 DiskDirectory::Read(const u32 count, Entry* entries) {
|
|||
// Directory entries are exposed to the guest as UTF-16. Normalize host UTF-8 names first
|
||||
// so host Unicode normalization differences do not leak into guest-visible SDMC paths.
|
||||
#if defined(__APPLE__)
|
||||
const std::string filename = Common::NormalizeNFDToNFC(file.virtualName);
|
||||
const std::string filename = Common::NormalizeNFDToNFC(file.virtualName);
|
||||
#else
|
||||
const std::string& filename = file.virtualName;
|
||||
const std::string& filename = file.virtualName;
|
||||
#endif
|
||||
const std::u16string filename_utf16 = Common::UTF8ToUTF16(filename);
|
||||
Entry& entry = entries[entries_read];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue