Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/icu4c/common/fixedstring.cpp
14710 views
1
// © 2025 and later: Unicode, Inc. and others.
2
// License & terms of use: https://www.unicode.org/copyright.html
3
4
#include "fixedstring.h"
5
6
#include "unicode/unistr.h"
7
#include "unicode/utypes.h"
8
9
U_NAMESPACE_BEGIN
10
11
U_EXPORT void copyInvariantChars(const UnicodeString& src, FixedString& dst, UErrorCode& status) {
12
if (U_FAILURE(status)) {
13
return;
14
}
15
16
if (src.isEmpty()) {
17
dst.clear();
18
return;
19
}
20
21
int32_t length = src.length();
22
if (!dst.reserve(length + 1)) {
23
status = U_MEMORY_ALLOCATION_ERROR;
24
return;
25
}
26
src.extract(0, length, dst.getAlias(), length + 1, US_INV);
27
}
28
29
U_NAMESPACE_END
30
31