mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-23 11:35:19 +01:00
Merge branch 'master' of https://github.com/CloverHackyColor/CloverBootloader
This commit is contained in:
commit
3a7b3d84b3
@ -528,6 +528,9 @@ uint32_t getUptimeInMilliseconds()
|
||||
#endif
|
||||
#endif //PRINTF_LITE_TIMESTAMP_SUPPORT
|
||||
|
||||
#ifdef __GNUC__
|
||||
static void print_longlong(INT_BIGGEST_TYPE v, unsigned int base, PrintfParams* printfParams) __attribute__((no_sanitize("undefined"))); // disable sanitize because we'll do -v
|
||||
#endif
|
||||
|
||||
#if DEFINE_SECTIONS == 1
|
||||
__attribute__((noinline, section(".print_longlong")))
|
||||
|
@ -213,10 +213,16 @@
|
||||
|
||||
<sourceEntries>
|
||||
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="MemLogLibDefault"/>
|
||||
|
||||
<entry excluding="wchar.cpp|strlen.cpp|strcmp.cpp|stdio.cpp" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="Posix"/>
|
||||
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="cpp_foundation"/>
|
||||
|
||||
<entry excluding="printlib-test.cpp|poolprint-test.cpp" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="cpp_unit_test"/>
|
||||
|
||||
<entry excluding="operatorNewDelete.cpp|memory.cpp|globals_dtor.cpp|globals_ctor.cpp" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="cpp_util"/>
|
||||
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="src"/>
|
||||
|
||||
</sourceEntries>
|
||||
@ -441,6 +447,8 @@
|
||||
|
||||
<entry excluding="MemLogLib.c" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="MemLogLibDefault"/>
|
||||
|
||||
<entry excluding="strlen.cpp|wchar.cpp|strcmp.cpp|stdio.cpp" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="Posix"/>
|
||||
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="cpp_foundation"/>
|
||||
|
||||
<entry excluding="printlib-test.cpp|poolprint-test.cpp" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="cpp_unit_test"/>
|
||||
|
@ -30,6 +30,11 @@
|
||||
<type>2</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/Library/MemLogLibDefault</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>Posix</name>
|
||||
<type>2</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/rEFIt_UEFI/Platform/Posix</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>cpp_foundation</name>
|
||||
<type>2</type>
|
||||
|
@ -2,5 +2,5 @@
|
||||
SCRIPT_ABS_FILENAME=`LC_ALL=en_US.ISO8859-1 perl -e 'use Cwd "abs_path";print abs_path(shift)' "${BASH_SOURCE[0]}"`
|
||||
SCRIPT_DIR=`dirname "$SCRIPT_ABS_FILENAME"`
|
||||
|
||||
echo -g -fshort-wchar -include ../src/Platform.h
|
||||
echo -g -fshort-wchar
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
9A0B08562402FF7700E2B470 /* XStringWArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08472402FE9300E2B470 /* XStringWArray.cpp */; };
|
||||
9A0B08572402FF7A00E2B470 /* XToolsCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08492402FE9300E2B470 /* XToolsCommon.cpp */; };
|
||||
9A0B08582402FF7F00E2B470 /* XStringWArray_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B084F2402FE9B00E2B470 /* XStringWArray_test.cpp */; };
|
||||
9A0B08592402FF8200E2B470 /* all_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08512402FE9B00E2B470 /* all_tests.cpp */; };
|
||||
9A0B085A2402FF8400E2B470 /* XObjArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08522402FE9B00E2B470 /* XObjArray_tests.cpp */; };
|
||||
@ -20,7 +19,6 @@
|
||||
9A0B08772403B08400E2B470 /* XStringWArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08472402FE9300E2B470 /* XStringWArray.cpp */; };
|
||||
9A0B087A2403B08400E2B470 /* all_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08512402FE9B00E2B470 /* all_tests.cpp */; };
|
||||
9A0B087B2403B08400E2B470 /* global_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08642403144C00E2B470 /* global_test.cpp */; };
|
||||
9A0B087C2403B08400E2B470 /* XToolsCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08492402FE9300E2B470 /* XToolsCommon.cpp */; };
|
||||
9A0B087D2403B08400E2B470 /* XStringWArray_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B084F2402FE9B00E2B470 /* XStringWArray_test.cpp */; };
|
||||
9A0B087E2403B08400E2B470 /* XArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08532402FE9B00E2B470 /* XArray_tests.cpp */; };
|
||||
9A0B087F2403B08400E2B470 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B085D240300E000E2B470 /* Platform.cpp */; };
|
||||
@ -42,9 +40,9 @@
|
||||
9A28CD22241BB61B00F3D247 /* strlen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD1E241BB61B00F3D247 /* strlen.cpp */; };
|
||||
9A28CD23241BB61B00F3D247 /* strlen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD1E241BB61B00F3D247 /* strlen.cpp */; };
|
||||
9A28CD24241BB61B00F3D247 /* strlen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD1E241BB61B00F3D247 /* strlen.cpp */; };
|
||||
9A28CD4B241F4CCE00F3D247 /* xcode_utf16.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD4A241F4CCE00F3D247 /* xcode_utf16.cpp */; };
|
||||
9A28CD4C241F4CCE00F3D247 /* xcode_utf16.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD4A241F4CCE00F3D247 /* xcode_utf16.cpp */; };
|
||||
9A28CD4D241F4CCE00F3D247 /* xcode_utf16.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD4A241F4CCE00F3D247 /* xcode_utf16.cpp */; };
|
||||
9A28CD4B241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD4A241F4CCE00F3D247 /* xcode_utf_fixed.cpp */; };
|
||||
9A28CD4C241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD4A241F4CCE00F3D247 /* xcode_utf_fixed.cpp */; };
|
||||
9A28CD4D241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD4A241F4CCE00F3D247 /* xcode_utf_fixed.cpp */; };
|
||||
9A4185B12439E4D600BEAFB8 /* LoadOptions_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185AF2439E4D500BEAFB8 /* LoadOptions_test.cpp */; };
|
||||
9A4185B22439E4D600BEAFB8 /* LoadOptions_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185AF2439E4D500BEAFB8 /* LoadOptions_test.cpp */; };
|
||||
9A4185B32439E4D600BEAFB8 /* LoadOptions_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185AF2439E4D500BEAFB8 /* LoadOptions_test.cpp */; };
|
||||
@ -60,10 +58,8 @@
|
||||
9A57C21A2418B9A00029A39F /* XObjArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08522402FE9B00E2B470 /* XObjArray_tests.cpp */; };
|
||||
9A57C21B2418B9A00029A39F /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9223302402FD1000483CBA /* main.cpp */; };
|
||||
9A57C21D2418B9A00029A39F /* XStringWArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08472402FE9300E2B470 /* XStringWArray.cpp */; };
|
||||
9A57C2202418B9A00029A39F /* panic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC780A32417DD2F005CDD5C /* panic.cpp */; };
|
||||
9A57C2222418B9A00029A39F /* all_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08512402FE9B00E2B470 /* all_tests.cpp */; };
|
||||
9A57C2232418B9A00029A39F /* global_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08642403144C00E2B470 /* global_test.cpp */; };
|
||||
9A57C2242418B9A00029A39F /* XToolsCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08492402FE9300E2B470 /* XToolsCommon.cpp */; };
|
||||
9A57C2252418B9A00029A39F /* XStringWArray_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B084F2402FE9B00E2B470 /* XStringWArray_test.cpp */; };
|
||||
9A57C2272418B9A00029A39F /* XArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08532402FE9B00E2B470 /* XArray_tests.cpp */; };
|
||||
9A57C2282418B9A00029A39F /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B085D240300E000E2B470 /* Platform.cpp */; };
|
||||
@ -74,14 +70,9 @@
|
||||
9AA0458A2425F94D000D6970 /* printf_lite-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AA045892425F94D000D6970 /* printf_lite-test.cpp */; };
|
||||
9AA0458B2425F94D000D6970 /* printf_lite-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AA045892425F94D000D6970 /* printf_lite-test.cpp */; };
|
||||
9AA0458C2425F94D000D6970 /* printf_lite-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AA045892425F94D000D6970 /* printf_lite-test.cpp */; };
|
||||
9AC780AE2417DD2F005CDD5C /* panic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC780A32417DD2F005CDD5C /* panic.cpp */; };
|
||||
9AC780AF2417DD2F005CDD5C /* panic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC780A32417DD2F005CDD5C /* panic.cpp */; };
|
||||
9ACAB117242623EE00BDB3CF /* printf_lite.c in Sources */ = {isa = PBXBuildFile; fileRef = 9ACAB116242623EE00BDB3CF /* printf_lite.c */; };
|
||||
9ACAB1192426255C00BDB3CF /* printf_lite.c in Sources */ = {isa = PBXBuildFile; fileRef = 9ACAB116242623EE00BDB3CF /* printf_lite.c */; };
|
||||
9ACAB11A2426255C00BDB3CF /* printf_lite.c in Sources */ = {isa = PBXBuildFile; fileRef = 9ACAB116242623EE00BDB3CF /* printf_lite.c */; };
|
||||
9AD469492452B33700D6D0DB /* shared_with_menu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AD469472452B33700D6D0DB /* shared_with_menu.cpp */; };
|
||||
9AD4694A2452B33700D6D0DB /* shared_with_menu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AD469472452B33700D6D0DB /* shared_with_menu.cpp */; };
|
||||
9AD4694B2452B33700D6D0DB /* shared_with_menu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AD469472452B33700D6D0DB /* shared_with_menu.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@ -116,9 +107,7 @@
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
9A0B08442402FE9300E2B470 /* XStringWArray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XStringWArray.h; sourceTree = "<group>"; };
|
||||
9A0B08452402FE9300E2B470 /* XToolsCommon.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XToolsCommon.h; sourceTree = "<group>"; };
|
||||
9A0B08472402FE9300E2B470 /* XStringWArray.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = XStringWArray.cpp; sourceTree = "<group>"; };
|
||||
9A0B08492402FE9300E2B470 /* XToolsCommon.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = XToolsCommon.cpp; sourceTree = "<group>"; };
|
||||
9A0B084A2402FE9300E2B470 /* XArray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XArray.h; sourceTree = "<group>"; };
|
||||
9A0B084B2402FE9300E2B470 /* XObjArray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XObjArray.h; sourceTree = "<group>"; };
|
||||
9A0B084D2402FE9B00E2B470 /* XStringWArray_test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XStringWArray_test.h; sourceTree = "<group>"; };
|
||||
@ -143,8 +132,8 @@
|
||||
9A28CD15241BACBB00F3D247 /* strlen_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strlen_test.cpp; sourceTree = "<group>"; };
|
||||
9A28CD1D241BB61B00F3D247 /* abort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = abort.cpp; sourceTree = "<group>"; };
|
||||
9A28CD1E241BB61B00F3D247 /* strlen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strlen.cpp; sourceTree = "<group>"; };
|
||||
9A28CD49241F437C00F3D247 /* xcode_utf16.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xcode_utf16.h; sourceTree = "<group>"; };
|
||||
9A28CD4A241F4CCE00F3D247 /* xcode_utf16.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xcode_utf16.cpp; sourceTree = "<group>"; };
|
||||
9A28CD49241F437C00F3D247 /* xcode_utf_fixed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xcode_utf_fixed.h; sourceTree = "<group>"; };
|
||||
9A28CD4A241F4CCE00F3D247 /* xcode_utf_fixed.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xcode_utf_fixed.cpp; sourceTree = "<group>"; };
|
||||
9A4185AF2439E4D500BEAFB8 /* LoadOptions_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadOptions_test.cpp; sourceTree = "<group>"; };
|
||||
9A4185B02439E4D600BEAFB8 /* LoadOptions_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadOptions_test.h; sourceTree = "<group>"; };
|
||||
9A4185BE2439F73A00BEAFB8 /* XStringArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XStringArray.cpp; sourceTree = "<group>"; };
|
||||
@ -165,8 +154,7 @@
|
||||
9AA045742425D200000D6970 /* IO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IO.cpp; sourceTree = "<group>"; };
|
||||
9AA045882425F94D000D6970 /* printf_lite-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printf_lite-test.h"; sourceTree = "<group>"; };
|
||||
9AA045892425F94D000D6970 /* printf_lite-test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "printf_lite-test.cpp"; sourceTree = "<group>"; };
|
||||
9AC780A32417DD2F005CDD5C /* panic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = panic.cpp; sourceTree = "<group>"; };
|
||||
9AC780A62417DD2F005CDD5C /* panic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = panic.h; sourceTree = "<group>"; };
|
||||
9AC790112452C45A0004FBE9 /* abort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = abort.h; sourceTree = "<group>"; };
|
||||
9ACAB116242623EE00BDB3CF /* printf_lite.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = printf_lite.c; sourceTree = "<group>"; };
|
||||
9ACAB1182426240C00BDB3CF /* printf_lite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = printf_lite.h; path = ../../Include/Library/printf_lite.h; sourceTree = "<group>"; };
|
||||
9AD469472452B33700D6D0DB /* shared_with_menu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = shared_with_menu.cpp; sourceTree = "<group>"; };
|
||||
@ -226,8 +214,6 @@
|
||||
9A4185BF2439F73A00BEAFB8 /* XStringArray.h */,
|
||||
9A0B08472402FE9300E2B470 /* XStringWArray.cpp */,
|
||||
9A0B08442402FE9300E2B470 /* XStringWArray.h */,
|
||||
9A0B08492402FE9300E2B470 /* XToolsCommon.cpp */,
|
||||
9A0B08452402FE9300E2B470 /* XToolsCommon.h */,
|
||||
);
|
||||
name = cpp_foundation;
|
||||
path = ../../rEFIt_UEFI/cpp_foundation;
|
||||
@ -294,6 +280,7 @@
|
||||
9A28CCAF241B816400F3D247 /* Posix */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9AC790112452C45A0004FBE9 /* abort.h */,
|
||||
9A28CD1D241BB61B00F3D247 /* abort.cpp */,
|
||||
9A28CD1E241BB61B00F3D247 /* strlen.cpp */,
|
||||
9A28CD0F241B9EF800F3D247 /* strcmp.cpp */,
|
||||
@ -308,7 +295,6 @@
|
||||
9A1A3FD82424BC22008C89EB /* MemLogLibDefault */,
|
||||
9A0B08432402FE9300E2B470 /* cpp_foundation */,
|
||||
9A0B084C2402FE9B00E2B470 /* cpp_unit_test */,
|
||||
9AC7809C2417DD2F005CDD5C /* cpp_util */,
|
||||
9A92232F2402FD1000483CBA /* Main */,
|
||||
9A28CCAC241B816400F3D247 /* Platform */,
|
||||
9A92232E2402FD1000483CBA /* Products */,
|
||||
@ -339,8 +325,8 @@
|
||||
9A28CD13241B9FEE00F3D247 /* posix.h */,
|
||||
9AF4156E242CBC6000D2644C /* printf_lite-conf.h */,
|
||||
9AF4156B242CBB5600D2644C /* printf_lite-test-cpp_conf.h */,
|
||||
9A28CD4A241F4CCE00F3D247 /* xcode_utf16.cpp */,
|
||||
9A28CD49241F437C00F3D247 /* xcode_utf16.h */,
|
||||
9A28CD4A241F4CCE00F3D247 /* xcode_utf_fixed.cpp */,
|
||||
9A28CD49241F437C00F3D247 /* xcode_utf_fixed.h */,
|
||||
);
|
||||
name = Main;
|
||||
path = src;
|
||||
@ -355,16 +341,6 @@
|
||||
path = PoolPrint;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9AC7809C2417DD2F005CDD5C /* cpp_util */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9AC780A32417DD2F005CDD5C /* panic.cpp */,
|
||||
9AC780A62417DD2F005CDD5C /* panic.h */,
|
||||
);
|
||||
name = cpp_util;
|
||||
path = ../../rEFIt_UEFI/cpp_util;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9AD469462452B30500D6D0DB /* gui */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -473,18 +449,15 @@
|
||||
9A4FFA842451C9740050B38B /* XString.cpp in Sources */,
|
||||
9A4FFA822451C88D0050B38B /* XString_test.cpp in Sources */,
|
||||
9A28CD23241BB61B00F3D247 /* strlen.cpp in Sources */,
|
||||
9A28CD4C241F4CCE00F3D247 /* xcode_utf16.cpp in Sources */,
|
||||
9A28CD4C241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */,
|
||||
9A0B08742403B08400E2B470 /* main.cpp in Sources */,
|
||||
9A28CD17241BACBB00F3D247 /* strlen_test.cpp in Sources */,
|
||||
9A0B08772403B08400E2B470 /* XStringWArray.cpp in Sources */,
|
||||
9A28CD0D241B8DD400F3D247 /* strcmp_test.cpp in Sources */,
|
||||
9A28CD0A241B8DD400F3D247 /* strncmp_test.cpp in Sources */,
|
||||
9AC780AF2417DD2F005CDD5C /* panic.cpp in Sources */,
|
||||
9A0B087A2403B08400E2B470 /* all_tests.cpp in Sources */,
|
||||
9A9AEB8E243F752C00FBD7D8 /* unicode_conversions.cpp in Sources */,
|
||||
9A0B087B2403B08400E2B470 /* global_test.cpp in Sources */,
|
||||
9A0B087C2403B08400E2B470 /* XToolsCommon.cpp in Sources */,
|
||||
9AD4694A2452B33700D6D0DB /* shared_with_menu.cpp in Sources */,
|
||||
9ACAB1192426255C00BDB3CF /* printf_lite.c in Sources */,
|
||||
9A0B087D2403B08400E2B470 /* XStringWArray_test.cpp in Sources */,
|
||||
9A28CD11241B9EF800F3D247 /* strcmp.cpp in Sources */,
|
||||
@ -505,18 +478,15 @@
|
||||
9A4FFA852451C9740050B38B /* XString.cpp in Sources */,
|
||||
9A4FFA832451C88D0050B38B /* XString_test.cpp in Sources */,
|
||||
9A28CD24241BB61B00F3D247 /* strlen.cpp in Sources */,
|
||||
9A28CD4D241F4CCE00F3D247 /* xcode_utf16.cpp in Sources */,
|
||||
9A28CD4D241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */,
|
||||
9A57C21B2418B9A00029A39F /* main.cpp in Sources */,
|
||||
9A28CD18241BACBB00F3D247 /* strlen_test.cpp in Sources */,
|
||||
9A57C21D2418B9A00029A39F /* XStringWArray.cpp in Sources */,
|
||||
9A28CD0E241B8DD400F3D247 /* strcmp_test.cpp in Sources */,
|
||||
9A28CD0B241B8DD400F3D247 /* strncmp_test.cpp in Sources */,
|
||||
9A57C2202418B9A00029A39F /* panic.cpp in Sources */,
|
||||
9A57C2222418B9A00029A39F /* all_tests.cpp in Sources */,
|
||||
9A9AEB8F243F752C00FBD7D8 /* unicode_conversions.cpp in Sources */,
|
||||
9A57C2232418B9A00029A39F /* global_test.cpp in Sources */,
|
||||
9A57C2242418B9A00029A39F /* XToolsCommon.cpp in Sources */,
|
||||
9AD4694B2452B33700D6D0DB /* shared_with_menu.cpp in Sources */,
|
||||
9ACAB11A2426255C00BDB3CF /* printf_lite.c in Sources */,
|
||||
9A57C2252418B9A00029A39F /* XStringWArray_test.cpp in Sources */,
|
||||
9A28CD12241B9EF800F3D247 /* strcmp.cpp in Sources */,
|
||||
@ -536,19 +506,16 @@
|
||||
9A4FFA7E2451C8330050B38B /* XString.cpp in Sources */,
|
||||
9A4FFA812451C88D0050B38B /* XString_test.cpp in Sources */,
|
||||
9A28CD22241BB61B00F3D247 /* strlen.cpp in Sources */,
|
||||
9A28CD4B241F4CCE00F3D247 /* xcode_utf16.cpp in Sources */,
|
||||
9A28CD4B241F4CCE00F3D247 /* xcode_utf_fixed.cpp in Sources */,
|
||||
9A9223312402FD1000483CBA /* main.cpp in Sources */,
|
||||
9A28CD16241BACBB00F3D247 /* strlen_test.cpp in Sources */,
|
||||
9A0B08562402FF7700E2B470 /* XStringWArray.cpp in Sources */,
|
||||
9A28CD0C241B8DD400F3D247 /* strcmp_test.cpp in Sources */,
|
||||
9A28CD09241B8DD400F3D247 /* strncmp_test.cpp in Sources */,
|
||||
9AC780AE2417DD2F005CDD5C /* panic.cpp in Sources */,
|
||||
9A0B08592402FF8200E2B470 /* all_tests.cpp in Sources */,
|
||||
9A0B08662403144C00E2B470 /* global_test.cpp in Sources */,
|
||||
9A4185B12439E4D600BEAFB8 /* LoadOptions_test.cpp in Sources */,
|
||||
9A0B08572402FF7A00E2B470 /* XToolsCommon.cpp in Sources */,
|
||||
9ACAB117242623EE00BDB3CF /* printf_lite.c in Sources */,
|
||||
9AD469492452B33700D6D0DB /* shared_with_menu.cpp in Sources */,
|
||||
9A0B08582402FF7F00E2B470 /* XStringWArray_test.cpp in Sources */,
|
||||
9A9AEB8D243F73CE00FBD7D8 /* unicode_conversions.cpp in Sources */,
|
||||
9A4185C02439F73A00BEAFB8 /* XStringArray.cpp in Sources */,
|
||||
@ -584,11 +551,7 @@
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
GCC_CHAR_IS_UNSIGNED_CHAR = YES;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
"wcslen=utf16_wcslen",
|
||||
"wcsncmp=utf16_wcsncmp",
|
||||
);
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
|
||||
OTHER_CFLAGS = (
|
||||
"$(inherited)",
|
||||
"-fshort-wchar",
|
||||
@ -663,11 +626,8 @@
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREFIX_HEADER = src/Platform.h;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
JIEF_DEBUG,
|
||||
XSTRING16_DEV,
|
||||
);
|
||||
GCC_PREFIX_HEADER = "";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = JIEF_DEBUG;
|
||||
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
|
||||
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
@ -752,7 +712,7 @@
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_PREFIX_HEADER = src/Platform.h;
|
||||
GCC_PREFIX_HEADER = "";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "";
|
||||
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
|
||||
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
|
||||
@ -790,11 +750,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
"wcslen=utf16_wcslen",
|
||||
"wcsncmp=utf16_wcsncmp",
|
||||
);
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
|
||||
OTHER_CFLAGS = (
|
||||
"$(inherited)",
|
||||
"-fshort-wchar",
|
||||
|
@ -25,51 +25,51 @@ void CpuDeadLoop(void)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static char *dull_replace(const char *in, const char *pattern, const char *by, char* res)
|
||||
{
|
||||
// size_t outsize = strlen(in) + 1;
|
||||
// TODO maybe avoid reallocing by counting the non-overlapping occurences of pattern
|
||||
// char *res = malloc(outsize);
|
||||
// use this to iterate over the output
|
||||
size_t resoffset = 0;
|
||||
|
||||
const char *needle;
|
||||
while ( (needle = strstr(in, pattern)) ) {
|
||||
// copy everything up to the pattern
|
||||
memcpy(res + resoffset, in, (size_t)(needle - in));
|
||||
resoffset += (size_t)(needle - in);
|
||||
|
||||
// skip the pattern in the input-string
|
||||
in = needle + strlen(pattern);
|
||||
|
||||
// adjust space for replacement
|
||||
// outsize = outsize - strlen(pattern) + strlen(by);
|
||||
// res = realloc(res, outsize);
|
||||
|
||||
// copy the pattern
|
||||
memcpy(res + resoffset, by, strlen(by));
|
||||
resoffset += strlen(by);
|
||||
}
|
||||
|
||||
// copy the remaining input
|
||||
strcpy(res + resoffset, in);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void DebugLog(INTN DebugMode, const char *FormatString, ...)
|
||||
{
|
||||
(void)DebugMode;
|
||||
|
||||
char* NewFormat = (char*)alloca(strlen(FormatString)+1);
|
||||
dull_replace(FormatString, "%a", "%s", NewFormat);
|
||||
|
||||
va_list va;
|
||||
va_start(va, FormatString);
|
||||
vprintf(NewFormat, va);
|
||||
va_end(va);
|
||||
}
|
||||
//
|
||||
//static char *dull_replace(const char *in, const char *pattern, const char *by, char* res)
|
||||
//{
|
||||
//// size_t outsize = strlen(in) + 1;
|
||||
// // TODO maybe avoid reallocing by counting the non-overlapping occurences of pattern
|
||||
//// char *res = malloc(outsize);
|
||||
// // use this to iterate over the output
|
||||
// size_t resoffset = 0;
|
||||
//
|
||||
// const char *needle;
|
||||
// while ( (needle = strstr(in, pattern)) ) {
|
||||
// // copy everything up to the pattern
|
||||
// memcpy(res + resoffset, in, (size_t)(needle - in));
|
||||
// resoffset += (size_t)(needle - in);
|
||||
//
|
||||
// // skip the pattern in the input-string
|
||||
// in = needle + strlen(pattern);
|
||||
//
|
||||
// // adjust space for replacement
|
||||
//// outsize = outsize - strlen(pattern) + strlen(by);
|
||||
//// res = realloc(res, outsize);
|
||||
//
|
||||
// // copy the pattern
|
||||
// memcpy(res + resoffset, by, strlen(by));
|
||||
// resoffset += strlen(by);
|
||||
// }
|
||||
//
|
||||
// // copy the remaining input
|
||||
// strcpy(res + resoffset, in);
|
||||
//
|
||||
// return res;
|
||||
//}
|
||||
//
|
||||
//void DebugLog(INTN DebugMode, const char *FormatString, ...)
|
||||
//{
|
||||
// (void)DebugMode;
|
||||
//
|
||||
// char* NewFormat = (char*)alloca(strlen(FormatString)+1);
|
||||
//// dull_replace(FormatString, "%a", "%s", NewFormat);
|
||||
//
|
||||
// va_list va;
|
||||
// va_start(va, FormatString);
|
||||
// vprintf(NewFormat, va);
|
||||
// va_end(va);
|
||||
//}
|
||||
|
||||
void PauseForKey(const wchar_t* msg)
|
||||
{
|
||||
@ -132,14 +132,14 @@ void CopyMem(void *Destination, void *Source, UINTN Length)
|
||||
|
||||
CHAR16* EfiStrDuplicate (IN CONST CHAR16 *Src)
|
||||
{
|
||||
CHAR16* newS = (CHAR16*)malloc((wcslen(Src)+1)*sizeof(wchar_t));
|
||||
memcpy(newS, Src, (wcslen(Src)+1)*sizeof(wchar_t));
|
||||
CHAR16* newS = (CHAR16*)malloc((wcslen_fixed(Src)+1)*sizeof(wchar_t));
|
||||
memcpy(newS, Src, (wcslen_fixed(Src)+1)*sizeof(wchar_t));
|
||||
return newS;
|
||||
}
|
||||
|
||||
CHAR16* StrStr (IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
|
||||
{
|
||||
return (CHAR16*)wcsstr(String, SearchString);
|
||||
return (CHAR16*)wcsstr_fixed(String, SearchString);
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,10 +17,11 @@
|
||||
#include <wchar.h>
|
||||
#include "posix.h"
|
||||
|
||||
#include "../../../rEFIt_UEFI/Platform/Posix/abort.h"
|
||||
#include "../../../rEFIt_UEFI/cpp_foundation/unicode_conversions.h"
|
||||
#include "../../../rEFIt_UEFI/cpp_foundation/XString.h"
|
||||
|
||||
#include "xcode_utf16.h"
|
||||
#include "xcode_utf_fixed.h"
|
||||
|
||||
|
||||
#ifndef __cplusplus
|
||||
@ -64,7 +65,7 @@ typedef UINTN RETURN_STATUS;
|
||||
#endif
|
||||
|
||||
void CpuDeadLoop(void);
|
||||
void DebugLog(INTN DebugMode, const char *FormatString, ...);
|
||||
//void DebugLog(INTN DebugMode, const char *FormatString, ...);
|
||||
|
||||
void PauseForKey(const wchar_t* msg);
|
||||
|
||||
|
@ -9,30 +9,17 @@
|
||||
#define MAX_XSIZE SIZE_T_MAX
|
||||
//#define MAX_XISIZE MAX_INTN
|
||||
|
||||
extern xsize XArrayGrowByDefault;
|
||||
extern xsize XBufferGrowByDefault;
|
||||
#define XStringGrowByDefault 10
|
||||
#define XArrayGrowByDefault 8
|
||||
//extern xsize XBufferGrowByDefault;
|
||||
|
||||
/* For convience, operator [] is define with int parameter.
|
||||
* Defining __XTOOLS_INT_CHECK__ make a check that the parameter is >= 0
|
||||
* Defining __XTOOLS_CHECK_OVERFLOW__ make a check that the parameter is >= 0
|
||||
* TODO : make new XString using __XTOOLS_CHECK_OVERFLOW__
|
||||
*/
|
||||
#define __XTOOLS_INT_CHECK__
|
||||
#define __XTOOLS_CHECK_OVERFLOW__
|
||||
|
||||
#include "../cpp_util/panic.h"
|
||||
|
||||
#define realloc(ptr, newsize, oldsize) realloc(ptr, newsize)
|
||||
|
||||
|
||||
// Declare here instead of include to avoid circular dependency.
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
DebugLog (
|
||||
IN INTN DebugMode,
|
||||
IN CONST CHAR8 *FormatString, ...) __attribute__((format(printf, 2, 3)));;
|
||||
#define Xrealloc(ptr, newsize, oldsize) realloc(ptr, newsize)
|
||||
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#define PRIF "%a"
|
||||
#define PRILF "%s"
|
||||
|
||||
//#define loggf(...) DebugLog(2, __VA_ARGS__)
|
||||
//#define loggf(...) printf__VA_ARGS__)
|
||||
#define loggf(...) printf(__VA_ARGS__)
|
||||
|
||||
//#define DISPLAY_ONLY_FAILED
|
||||
|
@ -4,7 +4,7 @@
|
||||
#define PRIF "%a"
|
||||
#define PRILF "%s"
|
||||
|
||||
#define loggf(...) DebugLog(2, __VA_ARGS__)
|
||||
#define loggf(...) printf__VA_ARGS__)
|
||||
//#define loggf(...) printf(__VA_ARGS__)
|
||||
|
||||
#define DISPLAY_ONLY_FAILED
|
||||
|
@ -18,7 +18,7 @@
|
||||
// Currently with clang version Apple LLVM version 10.0.0 (clang-1000.11.45.5) with High Sierra
|
||||
// If it's fixed one day, a version number could added to this #ifdef
|
||||
|
||||
# include "xcode_utf16.h"
|
||||
# include "xcode_utf_fixed.h"
|
||||
#else
|
||||
# include <wchar.h>
|
||||
#endif
|
||||
|
@ -9,13 +9,14 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifdef _MSC_VER
|
||||
typedef UINT16 wchar_t;
|
||||
#endif
|
||||
typedef UINT32 char32_t;
|
||||
typedef UINT16 char16_t;
|
||||
typedef uint32_t char32_t;
|
||||
typedef uint16_t char16_t;
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -4,7 +4,7 @@
|
||||
#define PRIF "%s"
|
||||
#define PRILF "%ls"
|
||||
|
||||
#define loggf(...) DebugLog(2, __VA_ARGS__)
|
||||
#define loggf(...) printf(__VA_ARGS__)
|
||||
//#define loggf(...) printf(__VA_ARGS__)
|
||||
|
||||
#define DISPLAY_ONLY_FAILED
|
||||
|
@ -4,7 +4,7 @@
|
||||
#define PRIF "%s"
|
||||
#define PRILF "%ls"
|
||||
|
||||
//#define loggf(...) DebugLog(2, __VA_ARGS__)
|
||||
//#define loggf(...) printf__VA_ARGS__)
|
||||
#define loggf(...) printf(__VA_ARGS__)
|
||||
|
||||
//#define DISPLAY_ONLY_FAILED
|
||||
|
@ -1,36 +0,0 @@
|
||||
//
|
||||
// wfunction.hpp
|
||||
// cpp_tests
|
||||
//
|
||||
// Created by jief on 15.03.20.
|
||||
// Copyright © 2020 JF Knudsen. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __xcode_utf16_h__
|
||||
#define __xcode_utf16_h__
|
||||
|
||||
|
||||
#if defined(__APPLE__) && defined(__clang__) && __WCHAR_MAX__ <= 0xFFFFu
|
||||
|
||||
//#define wcslen utf16_wcsleny
|
||||
//#define strlen utf16_wcslenx
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* all the functions w... seems to expect utf32 even when compiled with short-wchar
|
||||
*/
|
||||
|
||||
size_t utf16_wcslen(const wchar_t *s);
|
||||
int utf16_wcsncmp(const wchar_t *s1, const wchar_t * s2, size_t n);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif // defined(__APPLE__) && defined(__clang__) && __WCHAR_MAX__ <= 0xFFFFu
|
||||
#endif /* wfunction_hpp */
|
@ -6,20 +6,17 @@
|
||||
// Copyright © 2020 JF Knudsen. All rights reserved.
|
||||
//
|
||||
|
||||
//#include <stdarg.h>
|
||||
//#include <stdint.h>
|
||||
//#include <limits.h>
|
||||
//#include <stdlib.h>
|
||||
|
||||
#if defined(__APPLE__) && defined(__clang__) && __WCHAR_MAX__ <= 0xFFFFu
|
||||
|
||||
/*
|
||||
* clang had poisoned identifier like wcslen.
|
||||
* It's not possible to define a function with that name, not even a macro... except on the command line.
|
||||
* So, for this to work, pass macro definition argument on command line : wcslen=utf16_wcslen wcsncmp=utf16_wcsncmp
|
||||
* So, for this to work, pass macro definition argument on command line : wcslen=utf16_wcslen wcsncmp=utf16_wcsncmp wcsstr=utf16_wcsstr
|
||||
*/
|
||||
|
||||
#include <wchar.h>
|
||||
#include <vector>
|
||||
#include <cwchar>
|
||||
|
||||
#if __WCHAR_MAX__ < 0x10000
|
||||
|
||||
static int is_surrogate(char16_t uc) { return (uc - 0xd800u) < 2048u; }
|
||||
static int is_high_surrogate(char16_t uc) { return (uc & 0xfffffc00) == 0xd800; }
|
||||
@ -31,7 +28,7 @@ static char32_t surrogate_to_utf32(char16_t high, char16_t low) {
|
||||
|
||||
static void convert_utf16_to_utf32(const char16_t* input, size_t input_size, std::vector<char32_t>* output)
|
||||
{
|
||||
const char16_t * const end = input + input_size;
|
||||
const char16_t* const end = input + input_size;
|
||||
while (input < end && *input) {
|
||||
const char16_t uc = *input++;
|
||||
if (!is_surrogate(uc)) {
|
||||
@ -47,17 +44,27 @@ static void convert_utf16_to_utf32(const char16_t* input, size_t input_size, std
|
||||
(*output).push_back(0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
size_t utf16_wcslen(const wchar_t *s)
|
||||
|
||||
size_t wcslen_fixed(const wchar_t *s)
|
||||
{
|
||||
#if __WCHAR_MAX__ >= 0x10000
|
||||
return wcslen(s);
|
||||
#else
|
||||
// wcslen seems not to work if sizeof(wchar_t) == 2
|
||||
const wchar_t* p;
|
||||
for ( p = s ; *p ; p++ );
|
||||
return (size_t)(p-s);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
int utf16_wcsncmp(const wchar_t *s1, const wchar_t * s2, size_t n)
|
||||
int wcsncmp_fixed(const wchar_t *s1, const wchar_t * s2, size_t n)
|
||||
{
|
||||
#if __WCHAR_MAX__ >= 0x10000
|
||||
return wcsncmp(s1, s2, n);
|
||||
#else
|
||||
// Looks like wcscmp doesn't work with Utf16, even if compiled with -fshort-wchar.
|
||||
// So conversion to Utf32 needed first.
|
||||
|
||||
@ -71,11 +78,26 @@ int utf16_wcsncmp(const wchar_t *s1, const wchar_t * s2, size_t n)
|
||||
// but that's ok because we converted only n UTF16 chars in the call of convert_utf16_to_utf32
|
||||
int ret = wcscmp((const wchar_t*)s1Utf32.data(), (const wchar_t*)s2Utf32.data());
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
const wchar_t* wcsstr_fixed(const wchar_t* haystack, const wchar_t* needle)
|
||||
{
|
||||
#if __WCHAR_MAX__ >= 0x10000
|
||||
return wcsstr(haystack, needle);
|
||||
#else
|
||||
// Looks like wcscmp doesn't work with Utf16, even if compiled with -fshort-wchar.
|
||||
// So conversion to Utf32 needed first.
|
||||
|
||||
|
||||
const wchar_t *a = haystack, *b = needle;
|
||||
for (;;)
|
||||
if (!*b) return a - wcslen_fixed(needle);
|
||||
else if (!*a) return NULL;
|
||||
else if (*a++ != *b++) { a = ++haystack; b = needle;}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // defined(__APPLE__) && defined(__clang__) && __WCHAR_MAX__ <= 0xFFFFu
|
||||
|
22
Xcode/cpp_tests/src/xcode_utf_fixed.h
Normal file
22
Xcode/cpp_tests/src/xcode_utf_fixed.h
Normal file
@ -0,0 +1,22 @@
|
||||
//
|
||||
// wfunction.hpp
|
||||
// cpp_tests
|
||||
//
|
||||
// Created by jief on 15.03.20.
|
||||
// Copyright © 2020 JF Knudsen. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __xcode_utf16_h__
|
||||
#define __xcode_utf16_h__
|
||||
|
||||
|
||||
/*
|
||||
* all the functions w... seems to expect utf32 even when compiled with short-wchar
|
||||
*/
|
||||
|
||||
size_t wcslen_fixed(const wchar_t *s);
|
||||
int wcsncmp_fixed(const wchar_t *s1, const wchar_t * s2, size_t n);
|
||||
const wchar_t* wcsstr_fixed(const wchar_t* s1, const wchar_t* s2);
|
||||
|
||||
|
||||
#endif /* wfunction_hpp */
|
@ -1,5 +1,5 @@
|
||||
//#ifdef CLOVER_BUILD
|
||||
#include "../../Platform/BootLog.h"
|
||||
//#include "../../Platform/BootLog.h"
|
||||
|
||||
#include <Platform.h>
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
void abort(void)
|
||||
{
|
||||
DebugLog(2, "A fatal error happened. System halted\n");
|
||||
printf("A fatal error happened. System halted\n");
|
||||
while (1) { // tis will avoid warning : Function declared 'noreturn' should not return
|
||||
CpuDeadLoop();
|
||||
}
|
||||
@ -52,8 +52,8 @@ void panic(const char* format, ...)
|
||||
if ( stop_at_panic ) {
|
||||
VA_LIST va;
|
||||
VA_START(va, format);
|
||||
panic_(format, va);
|
||||
VA_END(va);
|
||||
panic_(format, va); // panic doesn't return
|
||||
//VA_END(va);
|
||||
}else{
|
||||
i_have_panicked = true;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
|
||||
#if 0
|
||||
#define XArray_DBG(...) DebugLog(2, __VA_ARGS__)
|
||||
#define XArray_DBG(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define XArray_DBG(...)
|
||||
#endif
|
||||
@ -185,8 +185,7 @@ void XArray<TYPE>::CheckSize(xsize nNewSize, xsize nGrowBy)
|
||||
nNewSize += nGrowBy;
|
||||
m_data = (TYPE *)Xrealloc((void *)m_data, nNewSize * sizeof(TYPE), m_allocatedSize * sizeof(TYPE) );
|
||||
if ( !m_data ) {
|
||||
DebugLog(2, "XArray<TYPE>::CheckSize(nNewSize=%zu, nGrowBy=%zu) : Xrealloc(%zu, %lu, %" PRIuPTR ") returned NULL. System halted\n", nNewSize, nGrowBy, m_allocatedSize, nNewSize*sizeof(TYPE), (uintptr_t)m_data);
|
||||
panic();
|
||||
panic("XArray<TYPE>::CheckSize(nNewSize=%zu, nGrowBy=%zu) : Xrealloc(%zu, %lu, %" PRIuPTR ") returned NULL. System halted\n", nNewSize, nGrowBy, m_allocatedSize, nNewSize*sizeof(TYPE), (uintptr_t)m_data);
|
||||
}
|
||||
// memset(&_Data[_Size], 0, (nNewSize-_Size) * sizeof(TYPE)); // Could help for debugging, but zeroing in not needed.
|
||||
m_allocatedSize = nNewSize;
|
||||
@ -208,8 +207,7 @@ void XArray<TYPE>::setSize(xsize l)
|
||||
m_len = l;
|
||||
#ifdef DEBUG
|
||||
if(m_len > m_allocatedSize) {
|
||||
DebugLog(2, "XArray::SetLength(xsize) -> _Len > _Size");
|
||||
panic();
|
||||
panic("XArray::SetLength(xsize) -> _Len > _Size");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -221,8 +219,7 @@ TYPE &XArray<TYPE>::ElementAt(xsize index)
|
||||
{
|
||||
// #ifdef _DEBUG
|
||||
if ( index >= m_len ) {
|
||||
DebugLog(2, "XArray::ElementAt(xsize) -> Operator [] : index > m_len");
|
||||
panic();
|
||||
panic("XArray::ElementAt(xsize) -> Operator [] : index > m_len");
|
||||
}
|
||||
// #endif
|
||||
return m_data[index];
|
||||
@ -234,8 +231,7 @@ const TYPE& XArray<TYPE>::ElementAt(xsize index) const
|
||||
{
|
||||
// #ifdef _DEBUG
|
||||
if ( index >= m_len ) {
|
||||
DebugLog(2, "XArray::ElementAt(xsize) const -> Operator [] : index > m_len");
|
||||
panic();
|
||||
panic("XArray::ElementAt(xsize) const -> Operator [] : index > m_len");
|
||||
}
|
||||
// #endif
|
||||
return m_data[index];
|
||||
@ -250,8 +246,7 @@ TYPE &XArray<TYPE>::ElementAt(int index)
|
||||
panic("XArray::ElementAt(int) -> Operator [] : index < 0");
|
||||
}
|
||||
if ( (unsigned int)index >= m_len ) { // cast safe, index > 0
|
||||
DebugLog(2, "XArray::ElementAt(int) -> Operator [] : index > m_len");
|
||||
panic();
|
||||
panic("XArray::ElementAt(int) -> Operator [] : index > m_len");
|
||||
}
|
||||
// #endif
|
||||
return m_data[index];
|
||||
@ -266,8 +261,7 @@ const TYPE& XArray<TYPE>::ElementAt(int index) const
|
||||
panic("XArray::ElementAt(int) const -> Operator [] : index < 0");
|
||||
}
|
||||
if ( (unsigned int)index >= m_len ) { // cast ok as index > 0. Ideally cast would be like '(unsigned __typeof__(index))'
|
||||
DebugLog(2, "XArray::ElementAt(int) const -> Operator [] : index > m_len");
|
||||
panic();
|
||||
panic("XArray::ElementAt(int) const -> Operator [] : index > m_len");
|
||||
}
|
||||
// #endif
|
||||
return m_data[index];
|
||||
@ -350,9 +344,8 @@ void XArray<TYPE>::RemoveAtIndex(int nIndex)
|
||||
{
|
||||
#if defined(__XTOOLS_CHECK_OVERFLOW__)
|
||||
if ( nIndex < 0 ) {
|
||||
DebugLog(2, "XArray<TYPE>::RemoveAtIndex(int nIndex) : BUG nIndex (%d) is < 0. System halted\n", nIndex);
|
||||
panic();
|
||||
}
|
||||
panic("XArray<TYPE>::RemoveAtIndex(int nIndex) : BUG nIndex (%d) is < 0. System halted\n", nIndex);
|
||||
}
|
||||
#endif
|
||||
|
||||
RemoveAtIndex( (xsize)nIndex ); // Check of nIndex is made in Remove(xsize nIndex)
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
|
||||
#if 1
|
||||
#define XObjArray_DBG(...) DebugLog(2, __VA_ARGS__)
|
||||
#define XObjArray_DBG(...) printf__VA_ARGS__)
|
||||
#else
|
||||
#define XObjArray_DBG(...)
|
||||
#endif
|
||||
@ -44,8 +44,10 @@ class XObjArrayNC
|
||||
virtual ~XObjArrayNC();
|
||||
|
||||
protected:
|
||||
XObjArrayNC(const XObjArrayNC<TYPE> &anObjArrayNC) { (void)anObjArrayNC; DebugLog(2, "Intentionally not defined"); panic(); }
|
||||
const XObjArrayNC<TYPE> &operator =(const XObjArrayNC<TYPE> &anObjArrayNC) { (void)anObjArrayNC; DebugLog(2, "Intentionally not defined"); panic(); }
|
||||
// XObjArrayNC(const XObjArrayNC<TYPE> &anObjArrayNC) { (void)anObjArrayNC; panic("Intentionally not defined"); }
|
||||
// const XObjArrayNC<TYPE> &operator =(const XObjArrayNC<TYPE> &anObjArrayNC) { (void)anObjArrayNC; panic("Intentionally not defined"); }
|
||||
XObjArrayNC(const XObjArrayNC<TYPE> &anObjArrayNC) = delete;
|
||||
const XObjArrayNC<TYPE> &operator =(const XObjArrayNC<TYPE> &anObjArrayNC) = delete;
|
||||
xsize _getLen() const { return _Len; }
|
||||
|
||||
public:
|
||||
@ -424,8 +426,7 @@ void XObjArrayNC<TYPE>::RemoveAtIndex(xsize nIndex)
|
||||
if ( nIndex < XObjArrayNC<TYPE>::_Len )
|
||||
{
|
||||
if ( nIndex >= XObjArrayNC<TYPE>::_Len ) {
|
||||
DebugLog(2, "void XObjArrayNC<TYPE>::RemoveAtIndex(xsize nIndex) : BUG nIndex (%zu) is > length(). System halted\n", nIndex);
|
||||
panic();
|
||||
panic("void XObjArrayNC<TYPE>::RemoveAtIndex(xsize nIndex) : BUG nIndex (%zu) is > length(). System halted\n", nIndex);
|
||||
}
|
||||
}
|
||||
if ( _Data[nIndex].FreeIt )
|
||||
@ -467,9 +468,8 @@ void XObjArrayNC<TYPE>::RemoveAtIndex(int nIndex)
|
||||
{
|
||||
#if defined(__XTOOLS_CHECK_OVERFLOW__)
|
||||
if ( nIndex < 0 ) {
|
||||
DebugLog(2, "XArray<TYPE>::RemoveAtIndex(int nIndex) : BUG nIndex (%d) is < 0. System halted\n", nIndex);
|
||||
panic();
|
||||
}
|
||||
panic("XArray<TYPE>::RemoveAtIndex(int nIndex) : BUG nIndex (%d) is < 0. System halted\n", nIndex);
|
||||
}
|
||||
#endif
|
||||
RemoveAtIndex( (xsize)nIndex ); // Remove(xsize) will check that index is < _Len
|
||||
}
|
||||
@ -487,7 +487,7 @@ void XObjArrayNC<TYPE>::Remove(const TYPE &Element)
|
||||
}
|
||||
}
|
||||
#if defined(_DEBUG)
|
||||
DebugLog(2, "XObjArray::Remove(TYPE &) -> Not found\n");
|
||||
printf("XObjArray::Remove(TYPE &) -> Not found\n");
|
||||
panic();
|
||||
#endif
|
||||
}
|
||||
|
@ -10,11 +10,12 @@
|
||||
|
||||
|
||||
#if 0
|
||||
#define DBG(...) DebugLog(2, __VA_ARGS__)
|
||||
#define DBG(...) printf__VA_ARGS__)
|
||||
#else
|
||||
#define DBG(...)
|
||||
#endif
|
||||
|
||||
#include <Platform.h>
|
||||
#include "XString.h"
|
||||
|
||||
#include "../../Include/Library/printf_lite.h"
|
||||
|
@ -152,7 +152,6 @@ int XStringAbstract__compare(const S* src, const O* other, bool ignoreCase)
|
||||
template<typename O, typename P>
|
||||
size_t XStringAbstract__indexOf(const O** s, const P* other, size_t offsetRet, bool toLower)
|
||||
{
|
||||
size_t i;
|
||||
size_t Idx = 0;
|
||||
|
||||
char32_t s_char32;
|
||||
@ -160,7 +159,6 @@ size_t XStringAbstract__indexOf(const O** s, const P* other, size_t offsetRet, b
|
||||
|
||||
do
|
||||
{
|
||||
i = 0;
|
||||
const O* s2 = *s;
|
||||
const P* other2 = other;
|
||||
do {
|
||||
@ -359,8 +357,7 @@ public:
|
||||
char32_t char32At(IntegralType i) const
|
||||
{
|
||||
if (i < 0) {
|
||||
DBG_XSTRING("XStringAbstract<T>::char32At(size_t i) : i < 0. System halted\n");
|
||||
panic();
|
||||
panic("XStringAbstract<T>::char32At(size_t i) : i < 0. System halted\n");
|
||||
}
|
||||
size_t nb = 0;
|
||||
const T *p = m_data;
|
||||
@ -571,10 +568,12 @@ public:
|
||||
// }
|
||||
//}
|
||||
|
||||
XStringAbstract subString(size_t pos, size_t count) const
|
||||
ThisXStringClass subString(size_t pos, size_t count) const
|
||||
{
|
||||
if ( pos > length() ) return ThisXStringClass();
|
||||
if ( count > length()-pos ) count = length()-pos;
|
||||
XStringAbstract ret;
|
||||
|
||||
ThisXStringClass ret;
|
||||
|
||||
const T* src = m_data;
|
||||
char32_t char32 = 1;
|
||||
@ -690,45 +689,45 @@ public:
|
||||
// == operator
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator == (const XStringAbstract<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) == 0; }
|
||||
template<typename O>
|
||||
bool operator == (const O* s2) const { return (*this).strcmp(s2) == 0; }
|
||||
template<typename O>
|
||||
friend bool operator == (const O* s1, ThisXStringClass& s2) { return s2.strcmp(s1) == 0; }
|
||||
// template<typename O>
|
||||
// bool operator == (const O* s2) const { return (*this).strcmp(s2) == 0; }
|
||||
// template<typename O>
|
||||
// friend bool operator == (const O* s1, ThisXStringClass& s2) { return s2.strcmp(s1) == 0; }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator != (const XStringAbstract<O, OtherXStringClass>& s2) const { return !(*this == s2); }
|
||||
template<typename O>
|
||||
bool operator != (const O* s2) const { return !(*this == s2); }
|
||||
template<typename O>
|
||||
friend bool operator != (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) != 0; }
|
||||
// template<typename O>
|
||||
// bool operator != (const O* s2) const { return !(*this == s2); }
|
||||
// template<typename O>
|
||||
// friend bool operator != (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) != 0; }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator < (const XStringAbstract<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) < 0; }
|
||||
template<typename O>
|
||||
bool operator < (const O* s2) const { return (*this).strcmp(s2) < 0; }
|
||||
template<typename O>
|
||||
friend bool operator < (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) > 0; }
|
||||
// template<typename O>
|
||||
// bool operator < (const O* s2) const { return (*this).strcmp(s2) < 0; }
|
||||
// template<typename O>
|
||||
// friend bool operator < (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) > 0; }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator > (const XStringAbstract<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) > 0; }
|
||||
template<typename O>
|
||||
bool operator > (const O* s2) const { return (*this).strcmp(s2) > 0; }
|
||||
template<typename O>
|
||||
friend bool operator > (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) < 0; }
|
||||
// template<typename O>
|
||||
// bool operator > (const O* s2) const { return (*this).strcmp(s2) > 0; }
|
||||
// template<typename O>
|
||||
// friend bool operator > (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) < 0; }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator <= (const XStringAbstract<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) <= 0; }
|
||||
template<typename O>
|
||||
bool operator <= (const O* s2) const { return (*this).strcmp(s2) <= 0; }
|
||||
template<typename O>
|
||||
friend bool operator <= (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) >= 0; }
|
||||
// template<typename O>
|
||||
// bool operator <= (const O* s2) const { return (*this).strcmp(s2) <= 0; }
|
||||
// template<typename O>
|
||||
// friend bool operator <= (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) >= 0; }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator >= (const XStringAbstract<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) >= 0; }
|
||||
template<typename O>
|
||||
bool operator >= (const O* s2) const { return (*this).strcmp(s2) >= 0; }
|
||||
template<typename O>
|
||||
friend bool operator >= (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) <= 0; }
|
||||
// template<typename O>
|
||||
// bool operator >= (const O* s2) const { return (*this).strcmp(s2) >= 0; }
|
||||
// template<typename O>
|
||||
// friend bool operator >= (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) <= 0; }
|
||||
|
||||
};
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
//
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
|
||||
#include "XStringArray.h"
|
||||
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#if !defined(__XSTRINGWS_CPP__)
|
||||
#define __XSTRINGWS_CPP__
|
||||
|
||||
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
|
||||
#include "XStringWArray.h"
|
||||
|
||||
|
||||
|
@ -175,7 +175,7 @@ int BootOptions_tests()
|
||||
{
|
||||
|
||||
#ifdef JIEF_DEBUG
|
||||
// DebugLog(2, "XStringW_tests -> Enter\n");
|
||||
// printf("XStringW_tests -> Enter\n");
|
||||
#endif
|
||||
|
||||
{
|
||||
@ -188,11 +188,11 @@ int BootOptions_tests()
|
||||
if ( XString().takeValueFrom(LoadOptions) != "opt1 opt2 opt3"_XS ) return 1;
|
||||
|
||||
CHAR16* LoadOptions1 = Old1_RemoveLoadOption(LoadOptions, L"opt1");
|
||||
if ( XString().takeValueFrom(LoadOptions1) != "opt2 opt3"_XS ) return 1;
|
||||
if ( XString().takeValueFrom(LoadOptions1) != "opt2 opt3"_XS ) return 2;
|
||||
CHAR16* LoadOptions2 = Old1_RemoveLoadOption(LoadOptions, L"opt2");
|
||||
if ( XString().takeValueFrom(LoadOptions2) != "opt1 opt3"_XS ) return 1;
|
||||
if ( XString().takeValueFrom(LoadOptions2) != "opt1 opt3"_XS ) return 3;
|
||||
CHAR16* LoadOptions3 = Old1_RemoveLoadOption(LoadOptions, L"opt3");
|
||||
if ( XString().takeValueFrom(LoadOptions3) != "opt1 opt2"_XS ) return 1;
|
||||
if ( XString().takeValueFrom(LoadOptions3) != "opt1 opt2"_XS ) return 4;
|
||||
}
|
||||
// {
|
||||
// XString LoadOptions;
|
||||
@ -217,17 +217,17 @@ int BootOptions_tests()
|
||||
LoadOptions.AddID("opt2"_XS);
|
||||
LoadOptions.AddID("opt3"_XS);
|
||||
|
||||
if ( LoadOptions.ConcatAll(" "_XS) != "opt1 opt2 opt3"_XS ) return 1;
|
||||
if ( LoadOptions.ConcatAll(" "_XS) != "opt1 opt2 opt3"_XS ) return 30;
|
||||
|
||||
XStringArray LoadOptions1 = LoadOptions;
|
||||
LoadOptions1.Remove("opt1"_XS);
|
||||
if ( LoadOptions1.ConcatAll(" "_XS) != "opt2 opt3"_XS ) return 1;
|
||||
if ( LoadOptions1.ConcatAll(" "_XS) != "opt2 opt3"_XS ) return 31;
|
||||
XStringArray LoadOptions2 = LoadOptions;
|
||||
LoadOptions2.Remove("opt2"_XS);
|
||||
if ( LoadOptions2.ConcatAll(" "_XS) != "opt1 opt3"_XS ) return 1;
|
||||
if ( LoadOptions2.ConcatAll(" "_XS) != "opt1 opt3"_XS ) return 32;
|
||||
XStringArray LoadOptions3 = LoadOptions;
|
||||
LoadOptions3.Remove("opt3"_XS);
|
||||
if ( LoadOptions3.ConcatAll(" "_XS) != "opt1 opt2"_XS ) return 1;
|
||||
if ( LoadOptions3.ConcatAll(" "_XS) != "opt1 opt2"_XS ) return 33;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
|
||||
#include "../cpp_foundation/XArray.h"
|
||||
|
||||
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
|
||||
|
||||
int XArray_tests()
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "../cpp_foundation/XObjArray.h"
|
||||
|
||||
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
|
||||
#include "../cpp_foundation/XObjArray.h"
|
||||
|
||||
class TestObjInt
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ int XStringWArray_tests()
|
||||
{
|
||||
|
||||
#ifdef JIEF_DEBUG
|
||||
// DebugLog(2, "XStringWArray_tests -> Enter\n");
|
||||
// printf("XStringWArray_tests -> Enter\n");
|
||||
#endif
|
||||
|
||||
XStringWArray array1;
|
||||
|
@ -114,8 +114,9 @@ public:
|
||||
~SimpleString() { delete data; }
|
||||
};
|
||||
|
||||
SimpleString sprintf(const char* format, ...) __attribute__((__format__(__printf__, 1, 2)));
|
||||
SimpleString sprintf(const char* format, ...)
|
||||
/* ssprintf = SimpleStringprintf */
|
||||
SimpleString ssprintf(const char* format, ...) __attribute__((__format__(__printf__, 1, 2)));
|
||||
SimpleString ssprintf(const char* format, ...)
|
||||
{
|
||||
SimpleString ss;
|
||||
va_list va;
|
||||
@ -447,19 +448,19 @@ template<class XStringClass>
|
||||
SimpleString testDefaultCtor_()
|
||||
{
|
||||
XStringClass xstr;
|
||||
TEST_TITLE(displayOnlyFailed, sprintf("Test default ctor of %s", XStringClassInfo<XStringClass>::xStringClassName));
|
||||
TEST_TITLE(displayOnlyFailed, ssprintf("Test default ctor of %s", XStringClassInfo<XStringClass>::xStringClassName));
|
||||
|
||||
CHECK_RESULT(xstr.length() == 0,
|
||||
sprintf("xstr.length() == 0"),
|
||||
sprintf("xstr.length() != 0")
|
||||
ssprintf("xstr.length() == 0"),
|
||||
ssprintf("xstr.length() != 0")
|
||||
);
|
||||
CHECK_RESULT(xstr.sizeInBytes() == 0,
|
||||
sprintf("xstr.sizeInBytes() == 0"),
|
||||
sprintf("xstr.sizeInBytes() != 0")
|
||||
ssprintf("xstr.sizeInBytes() == 0"),
|
||||
ssprintf("xstr.sizeInBytes() != 0")
|
||||
);
|
||||
CHECK_RESULT(*xstr.s() == 0,
|
||||
sprintf("*xstr.s() == 0"),
|
||||
sprintf("*xstr.s() != 0")
|
||||
ssprintf("*xstr.s() == 0"),
|
||||
ssprintf("*xstr.s() != 0")
|
||||
);
|
||||
return SimpleString();
|
||||
}
|
||||
@ -474,19 +475,19 @@ template<class XStringClass, class TestStringSrc, class TestStringExpectedResult
|
||||
SimpleString testTakeValueFrom_(const TestStringSrc& src, const TestStringExpectedResult& expectedResult)
|
||||
{
|
||||
|
||||
TEST_TITLE(displayOnlyFailed, sprintf("Test %s::testTakeValueFrom(%s\"%s\")", XStringClassInfo<XStringClass>::xStringClassName, XStringClassInfo<TestStringSrc>::prefix, SimpleString(src.cha).c_str()));
|
||||
TEST_TITLE(displayOnlyFailed, ssprintf("Test %s::testTakeValueFrom(%s\"%s\")", XStringClassInfo<XStringClass>::xStringClassName, XStringClassInfo<TestStringSrc>::prefix, SimpleString(src.cha).c_str()));
|
||||
|
||||
XStringClass xstr;
|
||||
xstr.takeValueFrom(src.cha);
|
||||
|
||||
size_t expectedSize = expectedResult.size*sizeof(expectedResult.cha[0]);
|
||||
CHECK_RESULT(xstr.sizeInBytes() == expectedSize,
|
||||
sprintf("xstr.sizeInBytes() == expectedSize (%zu)", expectedSize),
|
||||
sprintf("xstr.sizeInBytes() != expectedSize (%zu!=%zu)", xstr.sizeInBytes(), expectedSize)
|
||||
ssprintf("xstr.sizeInBytes() == expectedSize (%zu)", expectedSize),
|
||||
ssprintf("xstr.sizeInBytes() != expectedSize (%zu!=%zu)", xstr.sizeInBytes(), expectedSize)
|
||||
);
|
||||
CHECK_RESULT(memcmp(xstr.s(), expectedResult.cha, expectedSize) == 0,
|
||||
sprintf("memcmp(xstr.s(), expectedResult.cha, expectedSize) == 0"),
|
||||
sprintf("memcmp(xstr.s(), expectedResult.cha, expectedSize) != 0")
|
||||
ssprintf("memcmp(xstr.s(), expectedResult.cha, expectedSize) == 0"),
|
||||
ssprintf("memcmp(xstr.s(), expectedResult.cha, expectedSize) != 0")
|
||||
);
|
||||
|
||||
// TODO test ctor with litteral
|
||||
@ -509,7 +510,7 @@ SimpleString testTakeValueFromXString_(const TestStringSrc& src, const TestStrin
|
||||
{
|
||||
// TODO test ctor with litteral
|
||||
|
||||
TEST_TITLE(displayOnlyFailed, sprintf("Test %s::testTakeValueFrom(%s\"%s\")", XStringClassInfo<XStringClass>::xStringClassName, XStringClassInfo<TestStringSrc>::prefix, SimpleString(src.cha).c_str()));
|
||||
TEST_TITLE(displayOnlyFailed, ssprintf("Test %s::testTakeValueFrom(%s\"%s\")", XStringClassInfo<XStringClass>::xStringClassName, XStringClassInfo<TestStringSrc>::prefix, SimpleString(src.cha).c_str()));
|
||||
|
||||
typename XStringClassInfo<TestStringSrc>::xs_t srcXString;
|
||||
srcXString.takeValueFrom(src.cha);
|
||||
@ -519,23 +520,23 @@ SimpleString testTakeValueFromXString_(const TestStringSrc& src, const TestStrin
|
||||
|
||||
size_t expectedSize = expectedResult.size*sizeof(expectedResult.cha[0]);
|
||||
CHECK_RESULT(xstr.sizeInBytes() == expectedSize,
|
||||
sprintf("xstr.sizeInBytes() == expectedSize (%zu)", expectedSize),
|
||||
sprintf("xstr.sizeInBytes() != expectedSize (%zu!=%zu)", xstr.sizeInBytes(), expectedSize)
|
||||
ssprintf("xstr.sizeInBytes() == expectedSize (%zu)", expectedSize),
|
||||
ssprintf("xstr.sizeInBytes() != expectedSize (%zu!=%zu)", xstr.sizeInBytes(), expectedSize)
|
||||
);
|
||||
CHECK_RESULT(memcmp(xstr.s(), expectedResult.cha, expectedSize+sizeof(expectedResult.cha[0])) == 0,
|
||||
sprintf("memcmp(xstr.s(), expectedResult.cha, expectedResult.size) == 0"),
|
||||
sprintf("memcmp(xstr.s(), expectedResult.cha, expectedResult.size) != 0")
|
||||
ssprintf("memcmp(xstr.s(), expectedResult.cha, expectedResult.size) == 0"),
|
||||
ssprintf("memcmp(xstr.s(), expectedResult.cha, expectedResult.size) != 0")
|
||||
);
|
||||
{
|
||||
XStringClass xstr2(srcXString);
|
||||
// We don't use operator == to check xstr == xstr2 because operator == is not tested yet.
|
||||
CHECK_RESULT(xstr2.sizeInBytes() == xstr.sizeInBytes(),
|
||||
sprintf("xstr2.sizeInBytes() == xstr.sizeInBytes() (%zu)", xstr.sizeInBytes()),
|
||||
sprintf("xstr2.sizeInBytes() != xstr.sizeInBytes() (%zu!=%zu)", xstr2.sizeInBytes(), xstr.sizeInBytes())
|
||||
ssprintf("xstr2.sizeInBytes() == xstr.sizeInBytes() (%zu)", xstr.sizeInBytes()),
|
||||
ssprintf("xstr2.sizeInBytes() != xstr.sizeInBytes() (%zu!=%zu)", xstr2.sizeInBytes(), xstr.sizeInBytes())
|
||||
);
|
||||
CHECK_RESULT(memcmp(xstr2.s(), xstr.s(), xstr.sizeInBytes()+sizeof(xstr.s()[0])) == 0,
|
||||
sprintf("memcmp(xstr2.s(), xstr.s(), xstr.sizeInBytes()) == 0"),
|
||||
sprintf("memcmp(xstr2.s(), xstr.s(), xstr.sizeInBytes()) != 0")
|
||||
ssprintf("memcmp(xstr2.s(), xstr.s(), xstr.sizeInBytes()) == 0"),
|
||||
ssprintf("memcmp(xstr2.s(), xstr.s(), xstr.sizeInBytes()) != 0")
|
||||
);
|
||||
}
|
||||
{
|
||||
@ -543,12 +544,12 @@ SimpleString testTakeValueFromXString_(const TestStringSrc& src, const TestStrin
|
||||
xstr2 = srcXString;
|
||||
// We don't use operator == to check xstr == xstr2 because operator == is not tested yet.
|
||||
CHECK_RESULT(xstr2.sizeInBytes() == xstr.sizeInBytes(),
|
||||
sprintf("xstr2.sizeInBytes() == xstr.sizeInBytes() (%zu)", xstr.sizeInBytes()),
|
||||
sprintf("xstr2.sizeInBytes() != xstr.sizeInBytes() (%zu!=%zu)", xstr2.sizeInBytes(), xstr.sizeInBytes())
|
||||
ssprintf("xstr2.sizeInBytes() == xstr.sizeInBytes() (%zu)", xstr.sizeInBytes()),
|
||||
ssprintf("xstr2.sizeInBytes() != xstr.sizeInBytes() (%zu!=%zu)", xstr2.sizeInBytes(), xstr.sizeInBytes())
|
||||
);
|
||||
CHECK_RESULT(memcmp(xstr2.s(), xstr.s(), xstr.sizeInBytes()+sizeof(xstr.s()[0])) == 0,
|
||||
sprintf("memcmp(xstr2.s(), xstr.s(), xstr.sizeInBytes()) == 0"),
|
||||
sprintf("memcmp(xstr2.s(), xstr.s(), xstr.sizeInBytes()) != 0")
|
||||
ssprintf("memcmp(xstr2.s(), xstr.s(), xstr.sizeInBytes()) == 0"),
|
||||
ssprintf("memcmp(xstr2.s(), xstr.s(), xstr.sizeInBytes()) != 0")
|
||||
);
|
||||
}
|
||||
return SimpleString();
|
||||
@ -566,29 +567,29 @@ SimpleString testTakeValueFromXString_(const TestStringSrc& src, const TestStrin
|
||||
template<class XStringClass>
|
||||
SimpleString testEmpty_()
|
||||
{
|
||||
TEST_TITLE(displayOnlyFailed, sprintf("Test isEmpty(),notEmpty(),setEmpty() of %s", XStringClassInfo<XStringClass>::xStringClassName));
|
||||
TEST_TITLE(displayOnlyFailed, ssprintf("Test isEmpty(),notEmpty(),setEmpty() of %s", XStringClassInfo<XStringClass>::xStringClassName));
|
||||
|
||||
XStringClass str;
|
||||
str.takeValueFrom("aa");
|
||||
|
||||
CHECK_RESULT(str.isEmpty() == false,
|
||||
sprintf("str.isEmpty() == false"),
|
||||
sprintf("str.isEmpty() != true")
|
||||
ssprintf("str.isEmpty() == false"),
|
||||
ssprintf("str.isEmpty() != true")
|
||||
);
|
||||
CHECK_RESULT(str.notEmpty() == true,
|
||||
sprintf("str.notEmpty() == true"),
|
||||
sprintf("str.notEmpty() != false")
|
||||
ssprintf("str.notEmpty() == true"),
|
||||
ssprintf("str.notEmpty() != false")
|
||||
);
|
||||
|
||||
str.setEmpty();
|
||||
|
||||
CHECK_RESULT(str.isEmpty() == true,
|
||||
sprintf("str.isEmpty() == true"),
|
||||
sprintf("str.isEmpty() != false")
|
||||
ssprintf("str.isEmpty() == true"),
|
||||
ssprintf("str.isEmpty() != false")
|
||||
);
|
||||
CHECK_RESULT(str.notEmpty() == false,
|
||||
sprintf("str.notEmpty() == false"),
|
||||
sprintf("str.notEmpty() != true")
|
||||
ssprintf("str.notEmpty() == false"),
|
||||
ssprintf("str.notEmpty() != true")
|
||||
);
|
||||
|
||||
return SimpleString();
|
||||
@ -603,15 +604,15 @@ SimpleString testEmpty_()
|
||||
template<class XStringClass, typename integralType, class InitialValue>
|
||||
SimpleString testchar32At_(const InitialValue& initialValue)
|
||||
{
|
||||
TEST_TITLE(displayOnlyFailed, sprintf("Test %s::char32At_u()", XStringClassInfo<XStringClass>::xStringClassName));
|
||||
TEST_TITLE(displayOnlyFailed, ssprintf("Test %s::char32At_u()", XStringClassInfo<XStringClass>::xStringClassName));
|
||||
|
||||
XStringClass xstr;
|
||||
xstr.takeValueFrom(initialValue.cha);
|
||||
for ( integralType i=0 ; (typename make_unsigned<integralType>::type)i < xstr.length() ; i++ )
|
||||
{
|
||||
CHECK_RESULT(xstr[i] == initialValue.utf32[i],
|
||||
sprintf("xstr[i] == dst.cha[i] (%d)", initialValue.utf32[i]),
|
||||
sprintf("xstr[i] != dst.cha[i] (%d!=%d)", xstr[i], initialValue.utf32[i])
|
||||
ssprintf("xstr[i] == dst.cha[i] (%d)", initialValue.utf32[i]),
|
||||
ssprintf("xstr[i] != dst.cha[i] (%d!=%d)", xstr[i], initialValue.utf32[i])
|
||||
);
|
||||
}
|
||||
return SimpleString();
|
||||
@ -628,15 +629,15 @@ SimpleString testchar32At_(const InitialValue& initialValue)
|
||||
template<class XStringClass, typename integralType>
|
||||
SimpleString testdataSized_()
|
||||
{
|
||||
TEST_TITLE(displayOnlyFailed, sprintf("Test %s::dataSized()", XStringClassInfo<XStringClass>::xStringClassName));
|
||||
TEST_TITLE(displayOnlyFailed, ssprintf("Test %s::dataSized()", XStringClassInfo<XStringClass>::xStringClassName));
|
||||
|
||||
XStringClass xstr;
|
||||
integralType i = 10;
|
||||
typename XStringClassInfo<XStringClass>::ch_t* s = xstr.dataSized(i);
|
||||
(void)s;
|
||||
CHECK_RESULT(xstr.allocatedSize() >= 10,
|
||||
sprintf("xstr[i] == dst.cha[i] (%d)", 10),
|
||||
sprintf("xstr[i] != dst.cha[i] (%zu!=%d)", xstr.allocatedSize(), 10)
|
||||
ssprintf("xstr[i] == dst.cha[i] (%d)", 10),
|
||||
ssprintf("xstr[i] != dst.cha[i] (%zu!=%d)", xstr.allocatedSize(), 10)
|
||||
);
|
||||
return SimpleString();
|
||||
}
|
||||
@ -652,7 +653,7 @@ SimpleString testdataSized_()
|
||||
template<class XStringClass, class TestStringSameAsClass, class TestStringSrc>
|
||||
SimpleString teststrcpy_(const TestStringSameAsClass& encodedSameAsClass, const TestStringSrc& src)
|
||||
{
|
||||
TEST_TITLE(displayOnlyFailed, sprintf("Test %s::strcpy(%s\"%s\")", XStringClassInfo<XStringClass>::xStringClassName, XStringClassInfo<TestStringSrc>::prefix, SimpleString(src.cha).c_str()));
|
||||
TEST_TITLE(displayOnlyFailed, ssprintf("Test %s::strcpy(%s\"%s\")", XStringClassInfo<XStringClass>::xStringClassName, XStringClassInfo<TestStringSrc>::prefix, SimpleString(src.cha).c_str()));
|
||||
|
||||
XStringClass xstr;
|
||||
xstr.takeValueFrom("foobar");
|
||||
@ -660,12 +661,12 @@ SimpleString teststrcpy_(const TestStringSameAsClass& encodedSameAsClass, const
|
||||
|
||||
size_t expectedSize = encodedSameAsClass.size*sizeof(encodedSameAsClass.cha[0]);
|
||||
CHECK_RESULT(xstr.sizeInBytes() == expectedSize,
|
||||
sprintf("xstr.sizeInBytes() == dst.size (%zu)", expectedSize),
|
||||
sprintf("xstr.sizeInBytes() != dst.size (%zu!=%zu)", xstr.sizeInBytes(), expectedSize)
|
||||
ssprintf("xstr.sizeInBytes() == dst.size (%zu)", expectedSize),
|
||||
ssprintf("xstr.sizeInBytes() != dst.size (%zu!=%zu)", xstr.sizeInBytes(), expectedSize)
|
||||
);
|
||||
CHECK_RESULT(memcmp(xstr.s(), encodedSameAsClass.cha, expectedSize+sizeof(encodedSameAsClass.cha[0])) == 0,
|
||||
sprintf("memcmp(xstr.s(), dst.cha, dst.size) == 0"),
|
||||
sprintf("memcmp(xstr.s(), dst.cha, dst.size) != 0")
|
||||
ssprintf("memcmp(xstr.s(), dst.cha, dst.size) == 0"),
|
||||
ssprintf("memcmp(xstr.s(), dst.cha, dst.size) != 0")
|
||||
);
|
||||
return SimpleString();
|
||||
}
|
||||
@ -682,7 +683,7 @@ SimpleString teststrcpy_(const TestStringSameAsClass& encodedSameAsClass, const
|
||||
template<class XStringClass, class TestStringSameAsClass, class TestStringSrc>
|
||||
SimpleString teststrncpy_(const TestStringSameAsClass& encodedSameAsClass, const TestStringSrc& src)
|
||||
{
|
||||
TEST_TITLE(displayOnlyFailed, sprintf("Test %s::strncpy(%s\"%s\")", XStringClassInfo<XStringClass>::xStringClassName, XStringClassInfo<TestStringSrc>::prefix, SimpleString(src.cha).c_str()));
|
||||
TEST_TITLE(displayOnlyFailed, ssprintf("Test %s::strncpy(%s\"%s\")", XStringClassInfo<XStringClass>::xStringClassName, XStringClassInfo<TestStringSrc>::prefix, SimpleString(src.cha).c_str()));
|
||||
|
||||
for ( size_t i = 0 ; i < length_of_utf_string(src.cha)+5 ; i++ )
|
||||
{
|
||||
@ -691,12 +692,12 @@ SimpleString teststrncpy_(const TestStringSameAsClass& encodedSameAsClass, const
|
||||
xstr.strncpy(src.cha, i);
|
||||
|
||||
CHECK_RESULT((length_of_utf_string(encodedSameAsClass.cha) >= i && xstr.length() == i) || (xstr.length() == length_of_utf_string(encodedSameAsClass.cha)),
|
||||
sprintf("xstr.sizeInBytes() == dst.size (%zu)", xstr.sizeInBytes()),
|
||||
sprintf("xstr.sizeInBytes() != dst.size (%zu!=%zu)", xstr.sizeInBytes(), encodedSameAsClass.size)
|
||||
ssprintf("xstr.sizeInBytes() == dst.size (%zu)", xstr.sizeInBytes()),
|
||||
ssprintf("xstr.sizeInBytes() != dst.size (%zu!=%zu)", xstr.sizeInBytes(), encodedSameAsClass.size)
|
||||
);
|
||||
CHECK_RESULT(memcmp(xstr.s(), encodedSameAsClass.cha, xstr.sizeInBytes()) == 0,
|
||||
sprintf("memcmp(xstr.s(), dst.cha, dst.size) == 0"),
|
||||
sprintf("memcmp(xstr.s(), dst.cha, dst.size) != 0")
|
||||
ssprintf("memcmp(xstr.s(), dst.cha, dst.size) == 0"),
|
||||
ssprintf("memcmp(xstr.s(), dst.cha, dst.size) != 0")
|
||||
);
|
||||
}
|
||||
return SimpleString();
|
||||
@ -714,28 +715,28 @@ template<class XStringClass, typename ch_t>
|
||||
static void teststrcatCheckResult(size_t expectedLength, size_t expectedSize, ch_t* expectedString, XStringClass xstr)
|
||||
{
|
||||
CHECK_RESULT(xstr.length() == expectedLength,
|
||||
sprintf("xstr.length() == expectedLength (%zu)", expectedLength),
|
||||
sprintf("xstr.length() != expectedLength (%zu!=%zu)", xstr.length(), expectedLength)
|
||||
ssprintf("xstr.length() == expectedLength (%zu)", expectedLength),
|
||||
ssprintf("xstr.length() != expectedLength (%zu!=%zu)", xstr.length(), expectedLength)
|
||||
);
|
||||
//expectedLength = length_of_utf_string(initialValue.cha) + length_of_utf_string(valueToCat.cha);
|
||||
//xstr.takeValueFrom(initialValue.cha);
|
||||
//xstr.strcat(valueToCat.cha);
|
||||
|
||||
CHECK_RESULT(xstr.sizeInBytes() == expectedSize,
|
||||
sprintf("xstr.sizeInBytes() == expectedSize (%zu)", expectedSize),
|
||||
sprintf("xstr.sizeInBytes() != expectedSize (%zu!=%zu)", xstr.sizeInBytes(), expectedSize)
|
||||
ssprintf("xstr.sizeInBytes() == expectedSize (%zu)", expectedSize),
|
||||
ssprintf("xstr.sizeInBytes() != expectedSize (%zu!=%zu)", xstr.sizeInBytes(), expectedSize)
|
||||
);
|
||||
|
||||
CHECK_RESULT(memcmp(xstr.s(), expectedString, expectedSize+sizeof(ch_t)) == 0,
|
||||
sprintf("memcmp(xstr.s(), dst.cha, dst.size) == 0"),
|
||||
sprintf("memcmp(xstr.s(), dst.cha, dst.size) != 0")
|
||||
ssprintf("memcmp(xstr.s(), dst.cha, dst.size) == 0"),
|
||||
ssprintf("memcmp(xstr.s(), dst.cha, dst.size) != 0")
|
||||
);
|
||||
}
|
||||
|
||||
template<class XStringClass, class InitialValue, class ValueToCat>
|
||||
SimpleString teststrcat_(const InitialValue& initialValue, const ValueToCat& valueToCat)
|
||||
{
|
||||
TEST_TITLE(displayOnlyFailed, sprintf("Test %s::strcpy(%s\"%s\") strcat(%s\"%s\")", XStringClassInfo<XStringClass>::xStringClassName, XStringClassInfo<InitialValue>::prefix, SimpleString(initialValue.cha).c_str(), XStringClassInfo<ValueToCat>::prefix, SimpleString(valueToCat.cha).c_str()));
|
||||
TEST_TITLE(displayOnlyFailed, ssprintf("Test %s::strcpy(%s\"%s\") strcat(%s\"%s\")", XStringClassInfo<XStringClass>::xStringClassName, XStringClassInfo<InitialValue>::prefix, SimpleString(initialValue.cha).c_str(), XStringClassInfo<ValueToCat>::prefix, SimpleString(valueToCat.cha).c_str()));
|
||||
|
||||
typedef typename XStringClassInfo<XStringClass>::ch_t ch_t;
|
||||
ch_t c; // dummy for call utf function
|
||||
@ -815,7 +816,7 @@ SimpleString teststrcat_(const InitialValue& initialValue, const ValueToCat& val
|
||||
template<class XStringClass, class InitialValue, class ValueToCat>
|
||||
SimpleString teststrncat_(const InitialValue& initialValue, const ValueToCat& valueToCat)
|
||||
{
|
||||
TEST_TITLE(displayOnlyFailed, sprintf("Test %s::strcpy(%s\"%s\") strncat(%s\"%s\")", XStringClassInfo<XStringClass>::xStringClassName, XStringClassInfo<InitialValue>::prefix, SimpleString(initialValue.cha).c_str(), XStringClassInfo<ValueToCat>::prefix, SimpleString(valueToCat.cha).c_str()));
|
||||
TEST_TITLE(displayOnlyFailed, ssprintf("Test %s::strcpy(%s\"%s\") strncat(%s\"%s\")", XStringClassInfo<XStringClass>::xStringClassName, XStringClassInfo<InitialValue>::prefix, SimpleString(initialValue.cha).c_str(), XStringClassInfo<ValueToCat>::prefix, SimpleString(valueToCat.cha).c_str()));
|
||||
|
||||
for ( size_t i = 0 ; i < valueToCat.utf32_length+5 ; i++ )
|
||||
{
|
||||
@ -829,8 +830,8 @@ SimpleString teststrncat_(const InitialValue& initialValue, const ValueToCat& va
|
||||
|
||||
size_t expectedLength = length_of_utf_string(initialValue.cha) + min(i, valueToCat.utf32_length);
|
||||
CHECK_RESULT(xstr.length() == expectedLength,
|
||||
sprintf("xstr.length() == expectedLength (%zu)", expectedLength),
|
||||
sprintf("xstr.length() != expectedLength (%zu!=%zu)", xstr.length(), expectedLength)
|
||||
ssprintf("xstr.length() == expectedLength (%zu)", expectedLength),
|
||||
ssprintf("xstr.length() != expectedLength (%zu!=%zu)", xstr.length(), expectedLength)
|
||||
);
|
||||
//expectedLength = length_of_utf_string(initialValue.cha) + min(i, valueToCat.utf32_length);
|
||||
//xstr.takeValueFrom(initialValue.cha);
|
||||
@ -838,16 +839,16 @@ SimpleString teststrncat_(const InitialValue& initialValue, const ValueToCat& va
|
||||
|
||||
size_t expectedSize = (utf_size_of_utf_string(&c, initialValue.cha) + utf_size_of_utf_string_len(&c, valueToCat.cha, i));
|
||||
CHECK_RESULT(xstr.sizeInBytes() == expectedSize * sizeof(ch_t),
|
||||
sprintf("xstr.sizeInBytes() == expectedSize (%zu)", expectedSize * sizeof(ch_t)),
|
||||
sprintf("xstr.sizeInBytes() != expectedSize (%zu!=%zu)", xstr.sizeInBytes(), expectedSize * sizeof(ch_t))
|
||||
ssprintf("xstr.sizeInBytes() == expectedSize (%zu)", expectedSize * sizeof(ch_t)),
|
||||
ssprintf("xstr.sizeInBytes() != expectedSize (%zu!=%zu)", xstr.sizeInBytes(), expectedSize * sizeof(ch_t))
|
||||
);
|
||||
|
||||
ch_t* expectedString = (ch_t*)malloc((expectedSize+1)*sizeof(ch_t));
|
||||
utf_string_from_utf_string(expectedString, expectedSize + 1, initialValue.cha);
|
||||
utf_string_from_utf_string_len(expectedString + utf_size_of_utf_string(&c, initialValue.cha), expectedSize + 1 - size_of_utf_string(expectedString), valueToCat.cha, i);
|
||||
CHECK_RESULT(memcmp(xstr.s(), expectedString, expectedSize+sizeof(ch_t)) == 0,
|
||||
sprintf("memcmp(xstr.s(), expectedString, dst.size) == 0"),
|
||||
sprintf("memcmp(xstr.s(), expectedString, dst.size) != 0")
|
||||
ssprintf("memcmp(xstr.s(), expectedString, dst.size) == 0"),
|
||||
ssprintf("memcmp(xstr.s(), expectedString, dst.size) != 0")
|
||||
);
|
||||
//utf_string_from_utf_string(expectedString, expectedSize*sizeof(XStringCharClass) + 1, initialValue.cha);
|
||||
//utf_string_from_utf_string_len(expectedString + utf_size_of_utf_string(&c, initialValue.cha), expectedSize*sizeof(XStringCharClass) + 1 - size_of_utf_string(expectedString), valueToCat.cha, i);
|
||||
@ -873,7 +874,7 @@ SimpleString teststrncat_(const InitialValue& initialValue, const ValueToCat& va
|
||||
template<class XStringClass, class InitialValue>
|
||||
SimpleString testSubString_(const InitialValue& initialValue)
|
||||
{
|
||||
TEST_TITLE(displayOnlyFailed, sprintf("Test %s::subString(%s\"%s\"", XStringClassInfo<XStringClass>::xStringClassName, XStringClassInfo<InitialValue>::prefix, SimpleString(initialValue.cha).c_str()));
|
||||
TEST_TITLE(displayOnlyFailed, ssprintf("Test %s::subString(%s\"%s\"", XStringClassInfo<XStringClass>::xStringClassName, XStringClassInfo<InitialValue>::prefix, SimpleString(initialValue.cha).c_str()));
|
||||
|
||||
typedef typename XStringClassInfo<XStringClass>::ch_t ch_t;
|
||||
ch_t c; // dummy for call utf function
|
||||
@ -897,12 +898,13 @@ SimpleString testSubString_(const InitialValue& initialValue)
|
||||
XStringClass subStr = str.subString(pos, count);
|
||||
|
||||
CHECK_RESULT(subStr.length() == expectedLength,
|
||||
sprintf("subStr.length() == expectedLength (%zu)", expectedLength),
|
||||
sprintf("subStr.length() != expectedLength (%zu!=%zu)", subStr.length(), expectedLength)
|
||||
ssprintf("subStr.length() == expectedLength (%zu)", expectedLength),
|
||||
ssprintf("subStr.length() != expectedLength (%zu!=%zu)", subStr.length(), expectedLength)
|
||||
);
|
||||
subStr = str.subString(pos, count);
|
||||
CHECK_RESULT(memcmp(subStr.s(), initialValue.cha + offset, expectedSize) == 0,
|
||||
sprintf("memcmp == 0"),
|
||||
sprintf("memcmp != 0)")
|
||||
ssprintf("memcmp == 0"),
|
||||
ssprintf("memcmp != 0)")
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -942,13 +944,14 @@ CharType* incrementChar(const CharType* s, size_t pos, int increment)
|
||||
s = get_char32_from_string(s, &char32);
|
||||
n++;
|
||||
}
|
||||
*d = 0;
|
||||
return buf;
|
||||
}
|
||||
|
||||
template<class XStringClass, class InitialValue>
|
||||
SimpleString testCompare_(const InitialValue& initialValue)
|
||||
{
|
||||
TEST_TITLE(displayOnlyFailed, sprintf("Test %s::strcmp(%s\"%s\")", XStringClassInfo<XStringClass>::xStringClassName, XStringClassInfo<InitialValue>::prefix, SimpleString(initialValue.cha).c_str()));
|
||||
TEST_TITLE(displayOnlyFailed, ssprintf("Test %s::strcmp(%s\"%s\")", XStringClassInfo<XStringClass>::xStringClassName, XStringClassInfo<InitialValue>::prefix, SimpleString(initialValue.cha).c_str()));
|
||||
|
||||
// typedef typename XStringClassInfo<XStringClass>::ch_t xs_ch_t;
|
||||
// ch_t c; // dummy for call utf function
|
||||
@ -960,34 +963,34 @@ SimpleString testCompare_(const InitialValue& initialValue)
|
||||
xstr2.takeValueFrom(initialValue.cha);
|
||||
|
||||
CHECK_RESULT(xstr.strcmp(xstr2.s()) == 0,
|
||||
sprintf("subStr.length() == 0"),
|
||||
sprintf("subStr.length() != 0 (%d)", xstr.strcmp(xstr2.s()))
|
||||
ssprintf("subStr.length() == 0"),
|
||||
ssprintf("subStr.length() != 0 (%d)", xstr.strcmp(xstr2.s()))
|
||||
);
|
||||
|
||||
CHECK_RESULT(xstr == xstr2.s(),
|
||||
sprintf("subStr.length() == 0"),
|
||||
sprintf("subStr.length() != 0 (%d)", xstr.strcmp(xstr2.s()))
|
||||
);
|
||||
// CHECK_RESULT(xstr == xstr2.s(),
|
||||
// ssprintf("subStr.length() == 0"),
|
||||
// ssprintf("subStr.length() != 0 (%d)", xstr.strcmp(xstr2.s()))
|
||||
// );
|
||||
CHECK_RESULT(xstr == xstr2,
|
||||
sprintf("subStr.length() == 0"),
|
||||
sprintf("subStr.length() != 0 (%d)", xstr.strcmp(xstr2.s()))
|
||||
);
|
||||
CHECK_RESULT(!(xstr != xstr2.s()),
|
||||
sprintf("subStr.length() == 0"),
|
||||
sprintf("subStr.length() != 0 (%d)", xstr.strcmp(xstr2.s()))
|
||||
ssprintf("subStr.length() == 0"),
|
||||
ssprintf("subStr.length() != 0 (%d)", xstr.strcmp(xstr2.s()))
|
||||
);
|
||||
// CHECK_RESULT(!(xstr != xstr2.s()),
|
||||
// ssprintf("subStr.length() == 0"),
|
||||
// ssprintf("subStr.length() != 0 (%d)", xstr.strcmp(xstr2.s()))
|
||||
// );
|
||||
|
||||
CHECK_RESULT(!(xstr != xstr2),
|
||||
sprintf("subStr.length() == 0"),
|
||||
sprintf("subStr.length() != 0 (%d)", xstr.strcmp(xstr2.s()))
|
||||
);
|
||||
CHECK_RESULT(!(xstr != xstr2.s()),
|
||||
sprintf("subStr.length() == 0"),
|
||||
sprintf("subStr.length() != 0 (%d)", xstr.strcmp(xstr2.s()))
|
||||
ssprintf("subStr.length() == 0"),
|
||||
ssprintf("subStr.length() != 0 (%d)", xstr.strcmp(xstr2.s()))
|
||||
);
|
||||
// CHECK_RESULT(!(xstr != xstr2.s()),
|
||||
// ssprintf("subStr.length() == 0"),
|
||||
// ssprintf("subStr.length() != 0 (%d)", xstr.strcmp(xstr2.s()))
|
||||
// );
|
||||
CHECK_RESULT(!(xstr != xstr2),
|
||||
sprintf("subStr.length() == 0"),
|
||||
sprintf("subStr.length() != 0 (%d)", xstr.strcmp(xstr2.s()))
|
||||
ssprintf("subStr.length() == 0"),
|
||||
ssprintf("subStr.length() != 0 (%d)", xstr.strcmp(xstr2.s()))
|
||||
);
|
||||
//res = xstr.strcmp(xstr2.s());
|
||||
|
||||
@ -997,109 +1000,111 @@ SimpleString testCompare_(const InitialValue& initialValue)
|
||||
{
|
||||
const ch_t* s = incrementChar(initialValue.cha, pos, 1);
|
||||
CHECK_RESULT(xstr.strcmp(s) == -1,
|
||||
sprintf("xstr.strcmp(s) == -1"),
|
||||
sprintf("xstr.strcmp(s) != -1 (%d)", xstr.strcmp(s))
|
||||
ssprintf("xstr.strcmp(s) == -1"),
|
||||
ssprintf("xstr.strcmp(s) != -1 (%d)", xstr.strcmp(s))
|
||||
);
|
||||
/* operator comparison with native type */
|
||||
CHECK_RESULT(!(xstr == s),
|
||||
sprintf("!(xstr == s)"),
|
||||
sprintf("!!(xstr == s)")
|
||||
);
|
||||
CHECK_RESULT(!(s == xstr),
|
||||
sprintf("!(s == xstr)"),
|
||||
sprintf("!!(s == xstr)")
|
||||
);
|
||||
CHECK_RESULT(xstr != s,
|
||||
sprintf("xstr != s"),
|
||||
sprintf("!xstr != s")
|
||||
);
|
||||
CHECK_RESULT(s != xstr,
|
||||
sprintf("s != xstr"),
|
||||
sprintf("!s != xstr")
|
||||
);
|
||||
CHECK_RESULT(xstr < s,
|
||||
sprintf("xstr < s"),
|
||||
sprintf("!xstr < s")
|
||||
);
|
||||
CHECK_RESULT(s > xstr,
|
||||
sprintf("s > xstr"),
|
||||
sprintf("!s > xstr")
|
||||
);
|
||||
CHECK_RESULT(xstr <= s,
|
||||
sprintf("xstr <= s"),
|
||||
sprintf("!xstr <= s")
|
||||
);
|
||||
CHECK_RESULT(s >= xstr,
|
||||
sprintf("s >= xstr"),
|
||||
sprintf("!s >= xstr")
|
||||
);
|
||||
CHECK_RESULT(!(xstr > s),
|
||||
sprintf("!(xstr > s)"),
|
||||
sprintf("!!(xstr < s)")
|
||||
);
|
||||
CHECK_RESULT(!(s < xstr),
|
||||
sprintf("!(s < xstr)"),
|
||||
sprintf("!!(s < xstr)")
|
||||
);
|
||||
CHECK_RESULT(!(xstr >= s),
|
||||
sprintf("!(xstr >= s)"),
|
||||
sprintf("!!(xstr >= s)")
|
||||
);
|
||||
CHECK_RESULT(!(s <= xstr),
|
||||
sprintf("!(s <= xstr)"),
|
||||
sprintf("!!(s <= xstr)")
|
||||
);
|
||||
// CHECK_RESULT(!(xstr == s),
|
||||
// ssprintf("!(xstr == s)"),
|
||||
// ssprintf("!!(xstr == s)")
|
||||
// );
|
||||
// CHECK_RESULT(!(s == xstr),
|
||||
// ssprintf("!(s == xstr)"),
|
||||
// ssprintf("!!(s == xstr)")
|
||||
// );
|
||||
// CHECK_RESULT(xstr != s,
|
||||
// ssprintf("xstr != s"),
|
||||
// ssprintf("!xstr != s")
|
||||
// );
|
||||
// CHECK_RESULT(s != xstr,
|
||||
// ssprintf("s != xstr"),
|
||||
// ssprintf("!s != xstr")
|
||||
// );
|
||||
// CHECK_RESULT(xstr < s,
|
||||
// ssprintf("xstr < s"),
|
||||
// ssprintf("!xstr < s")
|
||||
// );
|
||||
// CHECK_RESULT(s > xstr,
|
||||
// ssprintf("s > xstr"),
|
||||
// ssprintf("!s > xstr")
|
||||
// );
|
||||
// CHECK_RESULT(xstr <= s,
|
||||
// ssprintf("xstr <= s"),
|
||||
// ssprintf("!xstr <= s")
|
||||
// );
|
||||
// CHECK_RESULT(s >= xstr,
|
||||
// ssprintf("s >= xstr"),
|
||||
// ssprintf("!s >= xstr")
|
||||
// );
|
||||
// CHECK_RESULT(!(xstr > s),
|
||||
// ssprintf("!(xstr > s)"),
|
||||
// ssprintf("!!(xstr < s)")
|
||||
// );
|
||||
// CHECK_RESULT(!(s < xstr),
|
||||
// ssprintf("!(s < xstr)"),
|
||||
// ssprintf("!!(s < xstr)")
|
||||
// );
|
||||
// CHECK_RESULT(!(xstr >= s),
|
||||
// ssprintf("!(xstr >= s)"),
|
||||
// ssprintf("!!(xstr >= s)")
|
||||
// );
|
||||
// CHECK_RESULT(!(s <= xstr),
|
||||
// ssprintf("!(s <= xstr)"),
|
||||
// ssprintf("!!(s <= xstr)")
|
||||
// );
|
||||
|
||||
/* operator comparison with other XString */
|
||||
xstr2.takeValueFrom(s);
|
||||
|
||||
CHECK_RESULT(!(xstr == xstr2),
|
||||
sprintf("!(xstr == xstr2)"),
|
||||
sprintf("!!(xstr == xstr2)")
|
||||
ssprintf("!(xstr == xstr2)"),
|
||||
ssprintf("!!(xstr == xstr2)")
|
||||
);
|
||||
CHECK_RESULT(!(xstr2 == xstr),
|
||||
sprintf("!(xstr2 == xstr)"),
|
||||
sprintf("!!(xstr2 == xstr)")
|
||||
ssprintf("!(xstr2 == xstr)"),
|
||||
ssprintf("!!(xstr2 == xstr)")
|
||||
);
|
||||
CHECK_RESULT(xstr != xstr2,
|
||||
sprintf("xstr != xstr2"),
|
||||
sprintf("!xstr != xstr2")
|
||||
ssprintf("xstr != xstr2"),
|
||||
ssprintf("!xstr != xstr2")
|
||||
);
|
||||
CHECK_RESULT(xstr2 != xstr,
|
||||
sprintf("xstr2 != xstr"),
|
||||
sprintf("!xstr2 != xstr")
|
||||
ssprintf("xstr2 != xstr"),
|
||||
ssprintf("!xstr2 != xstr")
|
||||
);
|
||||
CHECK_RESULT(xstr < xstr2,
|
||||
sprintf("xstr < xstr2"),
|
||||
sprintf("!xstr < xstr2")
|
||||
ssprintf("xstr < xstr2"),
|
||||
ssprintf("!xstr < xstr2")
|
||||
);
|
||||
CHECK_RESULT(xstr2 > xstr,
|
||||
sprintf("xstr2 > xstr"),
|
||||
sprintf("!xstr2 > xstr")
|
||||
ssprintf("xstr2 > xstr"),
|
||||
ssprintf("!xstr2 > xstr")
|
||||
);
|
||||
CHECK_RESULT(xstr <= xstr2,
|
||||
sprintf("xstr <= xstr2"),
|
||||
sprintf("!xstr <= xstr2")
|
||||
ssprintf("xstr <= xstr2"),
|
||||
ssprintf("!xstr <= xstr2")
|
||||
);
|
||||
CHECK_RESULT(xstr2 >= xstr,
|
||||
sprintf("xstr2 >= xstr"),
|
||||
sprintf("!xstr2 >= xstr")
|
||||
ssprintf("xstr2 >= xstr"),
|
||||
ssprintf("!xstr2 >= xstr")
|
||||
);
|
||||
CHECK_RESULT(!(xstr > xstr2),
|
||||
sprintf("!(xstr > xstr2)"),
|
||||
sprintf("!!(xstr < xstr2)")
|
||||
ssprintf("!(xstr > xstr2)"),
|
||||
ssprintf("!!(xstr < xstr2)")
|
||||
);
|
||||
CHECK_RESULT(!(xstr2 < xstr),
|
||||
sprintf("!(xstr2 < xstr)"),
|
||||
sprintf("!!(xstr2 < xstr)")
|
||||
ssprintf("!(xstr2 < xstr)"),
|
||||
ssprintf("!!(xstr2 < xstr)")
|
||||
);
|
||||
CHECK_RESULT(!(xstr >= xstr2),
|
||||
sprintf("!(xstr >= xstr2)"),
|
||||
sprintf("!!(xstr >= xstr2)")
|
||||
ssprintf("!(xstr >= xstr2)"),
|
||||
ssprintf("!!(xstr >= xstr2)")
|
||||
);
|
||||
CHECK_RESULT(!(xstr2 <= xstr),
|
||||
sprintf("!(xstr2 <= xstr)"),
|
||||
sprintf("!!(xstr2 <= xstr)")
|
||||
ssprintf("!(xstr2 <= xstr)"),
|
||||
ssprintf("!!(xstr2 <= xstr)")
|
||||
);
|
||||
free((void*)s);
|
||||
|
||||
}
|
||||
|
||||
@ -1107,8 +1112,8 @@ SimpleString testCompare_(const InitialValue& initialValue)
|
||||
{
|
||||
const ch_t* s = incrementChar(initialValue.cha, pos, -1);
|
||||
CHECK_RESULT(xstr.strcmp(s) == 1,
|
||||
sprintf("xstr.strcmp(s) == 1"),
|
||||
sprintf("xstr.strcmp(s) != 1 (%d)", xstr.strcmp(s))
|
||||
ssprintf("xstr.strcmp(s) == 1"),
|
||||
ssprintf("xstr.strcmp(s) != 1 (%d)", xstr.strcmp(s))
|
||||
);
|
||||
//const ch_t* s2 = incrementChar(initialValue.cha, pos, 1);
|
||||
}
|
||||
@ -1139,27 +1144,27 @@ static void testindexOf__(XStringClass subStr, bool ignoreCase,
|
||||
testStr = subStr;
|
||||
if ( ignoreCase ) testStr.lowerAscii();
|
||||
CHECK_RESULT((testStr.*indexOfString)(subStr.s(), 0) == 0,
|
||||
sprintf("testStr.indexOf(subStr.s(), 0) == 0"),
|
||||
sprintf("testStr.indexOf(subStr.s(), 0) != 0 (%zu)", (testStr.*indexOfString)(subStr.s(), 0))
|
||||
ssprintf("testStr.indexOf(subStr.s(), 0) == 0"),
|
||||
ssprintf("testStr.indexOf(subStr.s(), 0) != 0 (%zu)", (testStr.*indexOfString)(subStr.s(), 0))
|
||||
);
|
||||
(testStr.*indexOfString)(subStr.s(), 0);
|
||||
size_t expectedPos = subStr.length()==0 ? testStr.length() : 0;
|
||||
CHECK_RESULT((testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1) == expectedPos,
|
||||
sprintf("testStr.indexOf(subStr.s(), 0) == expectedPos (%zu)", expectedPos),
|
||||
sprintf("testStr.indexOf(subStr.s(), 0) != 0 (%zu!=%zu)", (testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1), expectedPos)
|
||||
ssprintf("testStr.indexOf(subStr.s(), 0) == expectedPos (%zu)", expectedPos),
|
||||
ssprintf("testStr.indexOf(subStr.s(), 0) != 0 (%zu!=%zu)", (testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1), expectedPos)
|
||||
);
|
||||
(testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1);
|
||||
|
||||
XStringClass apple;
|
||||
apple.takeValueFrom("");
|
||||
CHECK_RESULT((testStr.*indexOfString)(apple.s(), 0) == MAX_XSIZE,
|
||||
sprintf("testStr.*indexOfString)(\"\", 0) == MAX_XSIZE"),
|
||||
sprintf("testStr.*indexOfString)(\"\", 0) != MAX_XSIZE (%zu)", (testStr.*indexOfString)(subStr.s(), 0))
|
||||
ssprintf("testStr.*indexOfString)(\"\", 0) == MAX_XSIZE"),
|
||||
ssprintf("testStr.*indexOfString)(\"\", 0) != MAX_XSIZE (%zu)", (testStr.*indexOfString)(subStr.s(), 0))
|
||||
);
|
||||
//(testStr.*indexOfString)("");
|
||||
CHECK_RESULT((testStr.*rindexOfString)(apple.s(), MAX_XSIZE-1) == MAX_XSIZE,
|
||||
sprintf("(testStr.*rindexOfString)(\"\", MAX_XSIZE-1) == MAX_XSIZE"),
|
||||
sprintf("(testStr.*rindexOfString)(\"\", MAX_XSIZE-1) != MAX_XSIZE (%zu)", (testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1))
|
||||
ssprintf("(testStr.*rindexOfString)(\"\", MAX_XSIZE-1) == MAX_XSIZE"),
|
||||
ssprintf("(testStr.*rindexOfString)(\"\", MAX_XSIZE-1) != MAX_XSIZE (%zu)", (testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1))
|
||||
);
|
||||
|
||||
if ( subStr.length() > 0 )
|
||||
@ -1168,30 +1173,30 @@ static void testindexOf__(XStringClass subStr, bool ignoreCase,
|
||||
testStr.strcat(subStr.s());
|
||||
if ( ignoreCase ) testStr.lowerAscii();
|
||||
CHECK_RESULT((testStr.*indexOfString)(subStr.s(), 0) == 3,
|
||||
sprintf("testStr.indexOf(subStr.s(), 0) == 3"),
|
||||
sprintf("testStr.indexOf(subStr.s(), 0) != 3 (%zu)", (testStr.*indexOfString)(subStr.s(), 0))
|
||||
ssprintf("testStr.indexOf(subStr.s(), 0) == 3"),
|
||||
ssprintf("testStr.indexOf(subStr.s(), 0) != 3 (%zu)", (testStr.*indexOfString)(subStr.s(), 0))
|
||||
);
|
||||
(testStr.*indexOfString)(subStr.s(), 0);
|
||||
CHECK_RESULT((testStr.*indexOfString)(subStr.s(), 0) == 3,
|
||||
sprintf("(testStr.*indexOfString)(subStr.s(), 0) == 3"),
|
||||
sprintf("(testStr.*indexOfString)(subStr.s(), 0) != 3 (%zu)", (testStr.*indexOfString)(subStr.s(), 0))
|
||||
ssprintf("(testStr.*indexOfString)(subStr.s(), 0) == 3"),
|
||||
ssprintf("(testStr.*indexOfString)(subStr.s(), 0) != 3 (%zu)", (testStr.*indexOfString)(subStr.s(), 0))
|
||||
);
|
||||
CHECK_RESULT((testStr.*indexOfChar)(subStr[0], 0) == 3,
|
||||
sprintf("(testStr.*indexOfString)(subStr[0]) == 3"),
|
||||
sprintf("(testStr.*indexOfString)(subStr[0]) != 3 (%zu)", (testStr.*indexOfChar)(subStr[0], 0))
|
||||
ssprintf("(testStr.*indexOfString)(subStr[0]) == 3"),
|
||||
ssprintf("(testStr.*indexOfString)(subStr[0]) != 3 (%zu)", (testStr.*indexOfChar)(subStr[0], 0))
|
||||
);
|
||||
CHECK_RESULT((testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1) == 3,
|
||||
sprintf("testStr.indexOf(subStr.s(), MAX_XSIZE-1) == 3"),
|
||||
sprintf("testStr.indexOf(subStr.s(), MAX_XSIZE-1) != 3 (%zu)", (testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1))
|
||||
ssprintf("testStr.indexOf(subStr.s(), MAX_XSIZE-1) == 3"),
|
||||
ssprintf("testStr.indexOf(subStr.s(), MAX_XSIZE-1) != 3 (%zu)", (testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1))
|
||||
);
|
||||
(testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1);
|
||||
CHECK_RESULT((testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1) == 3,
|
||||
sprintf("(testStr.*rindexOfString)(subStr.s(), 0) == 3"),
|
||||
sprintf("(testStr.*rindexOfString)(subStr.s(), 0) != 3 (%zu)", (testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1))
|
||||
ssprintf("(testStr.*rindexOfString)(subStr.s(), 0) == 3"),
|
||||
ssprintf("(testStr.*rindexOfString)(subStr.s(), 0) != 3 (%zu)", (testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1))
|
||||
);
|
||||
CHECK_RESULT((testStr.*rindexOfChar)(subStr[subStr.length()-1], MAX_XSIZE-1) == 3 + subStr.length() - 1,
|
||||
sprintf("(testStr.*rindexOfString)(subStr[subStr.length()-1]) == 3 + subStr.length() - 1 (%zu)", 3 + subStr.length() - 1),
|
||||
sprintf("(testStr.*rindexOfString)(subStr[subStr.length()-1]) == 3 + subStr.length() - 1 (%zu!=%zu)", (testStr.*rindexOfChar)(subStr[subStr.length()-1], MAX_XSIZE-1), 3 + subStr.length() - 1)
|
||||
ssprintf("(testStr.*rindexOfString)(subStr[subStr.length()-1]) == 3 + subStr.length() - 1 (%zu)", 3 + subStr.length() - 1),
|
||||
ssprintf("(testStr.*rindexOfString)(subStr[subStr.length()-1]) == 3 + subStr.length() - 1 (%zu!=%zu)", (testStr.*rindexOfChar)(subStr[subStr.length()-1], MAX_XSIZE-1), 3 + subStr.length() - 1)
|
||||
);
|
||||
|
||||
testStr.takeValueFrom("");
|
||||
@ -1199,29 +1204,29 @@ static void testindexOf__(XStringClass subStr, bool ignoreCase,
|
||||
testStr.strcat("");
|
||||
if ( ignoreCase ) testStr.lowerAscii();
|
||||
CHECK_RESULT((testStr.*indexOfString)(subStr.s(), 0) == 4,
|
||||
sprintf("testStr.indexOf(subStr.s(), 0) == 4"),
|
||||
sprintf("testStr.indexOf(subStr.s(), 0) != 4 (%zu)", (testStr.*indexOfString)(subStr.s(), 0))
|
||||
ssprintf("testStr.indexOf(subStr.s(), 0) == 4"),
|
||||
ssprintf("testStr.indexOf(subStr.s(), 0) != 4 (%zu)", (testStr.*indexOfString)(subStr.s(), 0))
|
||||
);
|
||||
(testStr.*indexOfString)(subStr.s(), 0);
|
||||
CHECK_RESULT((testStr.*indexOfString)(subStr.s(), 0) == 4,
|
||||
sprintf("(testStr.*indexOfString)(subStr.s(), 0) == 4"),
|
||||
sprintf("(testStr.*indexOfString)(subStr.s(), 0) != 4 (%zu)", (testStr.*indexOfString)(subStr.s(), 0))
|
||||
ssprintf("(testStr.*indexOfString)(subStr.s(), 0) == 4"),
|
||||
ssprintf("(testStr.*indexOfString)(subStr.s(), 0) != 4 (%zu)", (testStr.*indexOfString)(subStr.s(), 0))
|
||||
);
|
||||
CHECK_RESULT((testStr.*indexOfChar)(subStr[0], 0) == 4,
|
||||
sprintf("(testStr.*indexOfString)(subStr[0]) == 4"),
|
||||
sprintf("(testStr.*indexOfString)(subStr[0]) != 4 (%zu)", (testStr.*indexOfChar)(subStr[0], 0))
|
||||
ssprintf("(testStr.*indexOfString)(subStr[0]) == 4"),
|
||||
ssprintf("(testStr.*indexOfString)(subStr[0]) != 4 (%zu)", (testStr.*indexOfChar)(subStr[0], 0))
|
||||
);
|
||||
CHECK_RESULT((testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1) == 4,
|
||||
sprintf("testStr.indexOf(subStr.s(), 0) == 4"),
|
||||
sprintf("testStr.indexOf(subStr.s(), 0) != 4 (%zu)", (testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1))
|
||||
ssprintf("testStr.indexOf(subStr.s(), 0) == 4"),
|
||||
ssprintf("testStr.indexOf(subStr.s(), 0) != 4 (%zu)", (testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1))
|
||||
);
|
||||
CHECK_RESULT((testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1) == 4,
|
||||
sprintf("(testStr.*rindexOfString)(subStr.s(), 0) == 4"),
|
||||
sprintf("(testStr.*rindexOfString)(subStr.s(), 0) != 4 (%zu)", (testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1))
|
||||
ssprintf("(testStr.*rindexOfString)(subStr.s(), 0) == 4"),
|
||||
ssprintf("(testStr.*rindexOfString)(subStr.s(), 0) != 4 (%zu)", (testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1))
|
||||
);
|
||||
CHECK_RESULT((testStr.*rindexOfChar)(subStr[subStr.length()-1], MAX_XSIZE-1) == 4 + subStr.length() - 1,
|
||||
sprintf("(testStr.*rindexOfString)(subStr[subStr.length()-1]) == 4 + subStr.length() - 1 (%zu)", 4 + subStr.length() - 1),
|
||||
sprintf("(testStr.*rindexOfString)(subStr[subStr.length()-1]) == 4 + subStr.length() - 1 (%zu!=%zu)", (testStr.*rindexOfChar)(subStr[subStr.length()-1], MAX_XSIZE-1), 4 + subStr.length() - 1)
|
||||
ssprintf("(testStr.*rindexOfString)(subStr[subStr.length()-1]) == 4 + subStr.length() - 1 (%zu)", 4 + subStr.length() - 1),
|
||||
ssprintf("(testStr.*rindexOfString)(subStr[subStr.length()-1]) == 4 + subStr.length() - 1 (%zu!=%zu)", (testStr.*rindexOfChar)(subStr[subStr.length()-1], MAX_XSIZE-1), 4 + subStr.length() - 1)
|
||||
);
|
||||
|
||||
testStr.takeValueFrom("");
|
||||
@ -1231,29 +1236,29 @@ static void testindexOf__(XStringClass subStr, bool ignoreCase,
|
||||
testStr.strcat("");
|
||||
if ( ignoreCase ) testStr.lowerAscii();
|
||||
CHECK_RESULT((testStr.*indexOfString)(subStr.s(), 0) == 5,
|
||||
sprintf("testStr.indexOf(subStr.s(), 0) == 5"),
|
||||
sprintf("testStr.indexOf(subStr.s(), 0) != 5 (%zu)", (testStr.*indexOfString)(subStr.s(), 0))
|
||||
ssprintf("testStr.indexOf(subStr.s(), 0) == 5"),
|
||||
ssprintf("testStr.indexOf(subStr.s(), 0) != 5 (%zu)", (testStr.*indexOfString)(subStr.s(), 0))
|
||||
);
|
||||
CHECK_RESULT((testStr.*indexOfString)(subStr.s(), 0) == 5,
|
||||
sprintf("(testStr.*indexOfString)(subStr.s(), 0) == 5"),
|
||||
sprintf("(testStr.*indexOfString)(subStr.s(), 0) != 5 (%zu)", (testStr.*indexOfString)(subStr.s(), 0))
|
||||
ssprintf("(testStr.*indexOfString)(subStr.s(), 0) == 5"),
|
||||
ssprintf("(testStr.*indexOfString)(subStr.s(), 0) != 5 (%zu)", (testStr.*indexOfString)(subStr.s(), 0))
|
||||
);
|
||||
CHECK_RESULT((testStr.*indexOfChar)(subStr[0], 0) == 5,
|
||||
sprintf("(testStr.*indexOfString)(subStr[0]) == 5"),
|
||||
sprintf("(testStr.*indexOfString)(subStr[0]) != 5 (%zu)", (testStr.*indexOfChar)(subStr[0], 0))
|
||||
ssprintf("(testStr.*indexOfString)(subStr[0]) == 5"),
|
||||
ssprintf("(testStr.*indexOfString)(subStr[0]) != 5 (%zu)", (testStr.*indexOfChar)(subStr[0], 0))
|
||||
);
|
||||
CHECK_RESULT((testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1) == 5 + subStr.length() + 6,
|
||||
sprintf("testStr.indexOf(subStr.s(), 0) == 5 + subStr.length() + 6"),
|
||||
sprintf("testStr.indexOf(subStr.s(), 0) != 5 + subStr.length() + 6 (%zu!=%zu)", (testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1), 5 + subStr.length() + 6)
|
||||
ssprintf("testStr.indexOf(subStr.s(), 0) == 5 + subStr.length() + 6"),
|
||||
ssprintf("testStr.indexOf(subStr.s(), 0) != 5 + subStr.length() + 6 (%zu!=%zu)", (testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1), 5 + subStr.length() + 6)
|
||||
);
|
||||
(testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1);
|
||||
CHECK_RESULT((testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1) == 5 + subStr.length() + 6,
|
||||
sprintf("(testStr.*rindexOfString)(subStr.s(), 0) == 5 + subStr.length() + 6"),
|
||||
sprintf("(testStr.*rindexOfString)(subStr.s(), 0) != 5 + subStr.length() + 6 (%zu!=%zu)", (testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1), 5 + subStr.length() + 6)
|
||||
ssprintf("(testStr.*rindexOfString)(subStr.s(), 0) == 5 + subStr.length() + 6"),
|
||||
ssprintf("(testStr.*rindexOfString)(subStr.s(), 0) != 5 + subStr.length() + 6 (%zu!=%zu)", (testStr.*rindexOfString)(subStr.s(), MAX_XSIZE-1), 5 + subStr.length() + 6)
|
||||
);
|
||||
CHECK_RESULT((testStr.*rindexOfChar)(subStr[subStr.length()-1], MAX_XSIZE-1) == 5 + subStr.length() + 6 + subStr.length() - 1,
|
||||
sprintf("(testStr.*rindexOfString)(subStr[subStr.length()-1]) == 5 + subStr.length() + 6 + subStr.length() - 1 (%zu)", 5 + subStr.length() + 6 + subStr.length() - 1),
|
||||
sprintf("(testStr.*rindexOfString)(subStr[subStr.length()-1]) == 5 + subStr.length() + 6 + subStr.length() - 1 (%zu!=%zu)", (testStr.*rindexOfChar)(subStr[subStr.length()-1], MAX_XSIZE-1), 5 + subStr.length() + 6 + subStr.length() - 1)
|
||||
ssprintf("(testStr.*rindexOfString)(subStr[subStr.length()-1]) == 5 + subStr.length() + 6 + subStr.length() - 1 (%zu)", 5 + subStr.length() + 6 + subStr.length() - 1),
|
||||
ssprintf("(testStr.*rindexOfString)(subStr[subStr.length()-1]) == 5 + subStr.length() + 6 + subStr.length() - 1 (%zu!=%zu)", (testStr.*rindexOfChar)(subStr[subStr.length()-1], MAX_XSIZE-1), 5 + subStr.length() + 6 + subStr.length() - 1)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1261,7 +1266,7 @@ static void testindexOf__(XStringClass subStr, bool ignoreCase,
|
||||
template<class XStringClass, class InitialValue>
|
||||
SimpleString testindexOf_(const InitialValue& initialValue)
|
||||
{
|
||||
TEST_TITLE(displayOnlyFailed, sprintf("Test %s::idxOf", XStringClassInfo<XStringClass>::xStringClassName));
|
||||
TEST_TITLE(displayOnlyFailed, ssprintf("Test %s::idxOf", XStringClassInfo<XStringClass>::xStringClassName));
|
||||
|
||||
typedef typename XStringClassInfo<XStringClass>::xs_t ixs_t;
|
||||
typedef typename XStringClassInfo<XStringClass>::ch_t ich_t;
|
||||
@ -1317,7 +1322,7 @@ void func_test(XStringW& xsw)
|
||||
int XString_tests()
|
||||
{
|
||||
#ifdef JIEF_DEBUG
|
||||
// DebugLog(2, "XString16_tests -> Enter\n");
|
||||
// printf("XString16_tests -> Enter\n");
|
||||
#endif
|
||||
|
||||
//const char c = ' ';
|
||||
@ -1354,10 +1359,6 @@ xw1.dataSized(ll);
|
||||
|
||||
// testDefaultCtor<XString>("XString");
|
||||
// XString16 a = u"toto"_XS16;
|
||||
// teststrncpy_<XString>("utf8", testStringMultiCodedArray[1].utf8, testStringMultiCodedArray[1].wchar);
|
||||
//testindexOf(XString, utf8, utf16);
|
||||
//testCompare(XString, utf8, utf8);
|
||||
//testindexOf_<XString>(testStringMultiCoded4CaseArray[0].utf8);
|
||||
|
||||
const char* utf8 = "ギ"; (void)utf8;
|
||||
size_t utf8_size = sizeof("ギ") - 1; (void)utf8_size; // this char is 6 bytes long !
|
||||
@ -1372,24 +1373,29 @@ size_t utf32_size = sizeof(U"ギ") - 1; (void)utf32_size; // this char is 6 b
|
||||
//size_t size = sizeof("楘")-1; // this char is 3 bytes long
|
||||
//XString str = "ギꇉ伽楘"_XS;
|
||||
//char* s = str.data(42);
|
||||
TEST_ALL_CLASSES(testchar32At, TEST_ALL_INTEGRAL);
|
||||
|
||||
|
||||
//teststrncpy_<XString>("utf8", testStringMultiCodedArray[1].utf8, testStringMultiCodedArray[1].wchar);
|
||||
//testindexOf(XString, utf8, utf16);
|
||||
testCompare(XString, utf8, utf16);
|
||||
//testindexOf_<XString>(testStringMultiCoded4CaseArray[0].utf8);
|
||||
|
||||
|
||||
|
||||
|
||||
TEST_ALL_CLASSES(testDefaultCtor, __TEST0);
|
||||
TEST_ALL_CLASSES(testEmpty, __TEST0);
|
||||
TEST_ALL_CLASSES(testTakeValueFrom, TEST_ALL_UTF);
|
||||
TEST_ALL_CLASSES(testTakeValueFromXString, TEST_ALL_UTF);
|
||||
TEST_ALL_CLASSES(testchar32At, TEST_ALL_INTEGRAL);
|
||||
TEST_ALL_CLASSES(testdataSized, TEST_ALL_INTEGRAL);
|
||||
|
||||
TEST_ALL_CLASSES(teststrcpy, TEST_ALL_UTF);
|
||||
TEST_ALL_CLASSES(teststrncpy, TEST_ALL_UTF); // 26944 tests
|
||||
TEST_ALL_CLASSES(teststrcat, TEST_ALL_UTF_ALL_UTF);
|
||||
TEST_ALL_CLASSES(teststrncat, TEST_ALL_UTF_ALL_UTF); // 2101632 tests
|
||||
|
||||
TEST_ALL_CLASSES(testSubString, __TEST0);
|
||||
// TEST_ALL_CLASSES(testDefaultCtor, __TEST0);
|
||||
// TEST_ALL_CLASSES(testEmpty, __TEST0);
|
||||
// TEST_ALL_CLASSES(testTakeValueFrom, TEST_ALL_UTF);
|
||||
// TEST_ALL_CLASSES(testTakeValueFromXString, TEST_ALL_UTF);
|
||||
// TEST_ALL_CLASSES(testchar32At, TEST_ALL_INTEGRAL);
|
||||
// TEST_ALL_CLASSES(testdataSized, TEST_ALL_INTEGRAL);
|
||||
//
|
||||
// TEST_ALL_CLASSES(teststrcpy, TEST_ALL_UTF);
|
||||
// TEST_ALL_CLASSES(teststrncpy, TEST_ALL_UTF); // 26944 tests
|
||||
// TEST_ALL_CLASSES(teststrcat, TEST_ALL_UTF_ALL_UTF);
|
||||
// TEST_ALL_CLASSES(teststrncat, TEST_ALL_UTF_ALL_UTF); // 2101632 tests
|
||||
//
|
||||
// TEST_ALL_CLASSES(testSubString, __TEST0);
|
||||
TEST_ALL_CLASSES(testCompare, TEST_ALL_UTF);
|
||||
TEST_ALL_CLASSES(testindexOf, TEST_ALL_UTF);
|
||||
|
||||
@ -1398,7 +1404,7 @@ TEST_ALL_CLASSES(testchar32At, TEST_ALL_INTEGRAL);
|
||||
//
|
||||
//// str2.insert(1, str);
|
||||
//
|
||||
// str2.SPrintf("%c", 'a'); // signle UTF8 ascii char
|
||||
// str2.ssprintf("%c", 'a'); // signle UTF8 ascii char
|
||||
// if ( str2 != L"a" ) return
|
||||
|
||||
|
||||
@ -1410,7 +1416,7 @@ TEST_ALL_CLASSES(testchar32At, TEST_ALL_INTEGRAL);
|
||||
|
||||
#ifdef JIEF_DEBUG
|
||||
if ( nbTestFailed == 0 ) printf("All %d tests succeeded.\n", nbTest);
|
||||
else printf("%d tests succeeded out of %d.\n", nbTest-nbTestFailed, nbTestFailed);
|
||||
else printf("%d tests succeeded out of %d.\n", nbTest-nbTestFailed, nbTest);
|
||||
#endif
|
||||
return 0;
|
||||
return nbTestFailed > 0;
|
||||
}
|
||||
|
@ -33,77 +33,77 @@ bool all_tests()
|
||||
|
||||
ret = XString_tests();
|
||||
if ( ret != 0 ) {
|
||||
DebugLog(2, "XString16_tests() failed at test %d\n", ret);
|
||||
printf("XString16_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
//return ret;
|
||||
// ret = XUINTN_tests();
|
||||
// if ( ret != 0 ) {
|
||||
// DebugLog(2, "XUINTN_tests() failed at test %d\n", ret);
|
||||
// printf("XUINTN_tests() failed at test %d\n", ret);
|
||||
// all_ok = false;
|
||||
// }
|
||||
#if defined(JIEF_DEBUG) && defined(CLOVER_BUILD)
|
||||
ret = printlib_tests();
|
||||
if ( ret != 0 ) {
|
||||
DebugLog(2, "printlib_tests() failed at test %d\n", ret);
|
||||
printf("printlib_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
ret = poolprint_tests();
|
||||
if ( ret != 0 ) {
|
||||
DebugLog(2, "poolprint_tests() failed at test %d\n", ret);
|
||||
printf("poolprint_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#ifndef _MSC_VER
|
||||
ret = printf_lite_tests();
|
||||
if ( ret != 0 ) {
|
||||
DebugLog(2, "printf_lite_tests() failed at test %d\n", ret);
|
||||
printf("printf_lite_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
#endif
|
||||
ret = strlen_tests();
|
||||
if ( ret != 0 ) {
|
||||
DebugLog(2, "strlen_tests() failed at test %d\n", ret);
|
||||
printf("strlen_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
ret = BootOptions_tests();
|
||||
if ( ret != 0 ) {
|
||||
DebugLog(2, "BootOptions_tests() failed at test %d\n", ret);
|
||||
printf("BootOptions_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
ret = strcmp_tests();
|
||||
if ( ret != 0 ) {
|
||||
DebugLog(2, "strcmp_tests() failed at test %d\n", ret);
|
||||
printf("strcmp_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
ret = strncmp_tests();
|
||||
if ( ret != 0 ) {
|
||||
DebugLog(2, "strncmp_tests() failed at test %d\n", ret);
|
||||
printf("strncmp_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
ret = XArray_tests();
|
||||
if ( ret != 0 ) {
|
||||
DebugLog(2, "XArray_tests() failed at test %d\n", ret);
|
||||
printf("XArray_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
ret = XObjArray_tests();
|
||||
if ( ret != 0 ) {
|
||||
DebugLog(2, "XObjArray_tests() failed at test %d\n", ret);
|
||||
printf("XObjArray_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
ret = XStringWArray_tests();
|
||||
if ( ret != 0 ) {
|
||||
DebugLog(2, "XStringWArray_tests() failed at test %d\n", ret);
|
||||
printf("XStringWArray_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
// ret = XUINTN_tests();
|
||||
// if ( ret != 0 ) {
|
||||
// DebugLog(2, "XUINTN_tests() failed at test %d\n", ret);
|
||||
// printf("XUINTN_tests() failed at test %d\n", ret);
|
||||
// all_ok = false;
|
||||
// }
|
||||
|
||||
if ( !all_ok ) {
|
||||
DebugLog(2, "A test failed\n");
|
||||
printf("A test failed\n");
|
||||
}
|
||||
|
||||
#if defined(JIEF_DEBUG)
|
||||
|
@ -4,7 +4,7 @@
|
||||
#define PRIF "%a"
|
||||
#define PRILF "%s"
|
||||
|
||||
#define loggf(...) DebugLog(2, __VA_ARGS__)
|
||||
#define loggf(...) printf(__VA_ARGS__)
|
||||
//#define loggf(...) printf(__VA_ARGS__)
|
||||
|
||||
#define DISPLAY_ONLY_FAILED
|
||||
|
@ -4,7 +4,7 @@
|
||||
#define PRIF "%s"
|
||||
#define PRILF "%ls"
|
||||
|
||||
#define loggf(...) DebugLog(2, __VA_ARGS__)
|
||||
#define loggf(...) printf(__VA_ARGS__)
|
||||
//#define loggf(...) printf(__VA_ARGS__)
|
||||
|
||||
#define DISPLAY_ONLY_FAILED
|
||||
|
@ -288,22 +288,22 @@ int printf_lite_tests(void)
|
||||
Test1arg(F("| c|"), F("|%5x|"), 12);
|
||||
Test1arg(F("| C|"), F("|%5X|"), 12);
|
||||
|
||||
Test1arg(F("| -12|"), F("|%5hhd|"), (char)-12);
|
||||
Test1arg(F("| -12|"), F("|%5d|"), (char)-12);
|
||||
Test1arg(F("| -12|"), F("|%5hhd|"), (signed char)-12);
|
||||
Test1arg(F("| -12|"), F("|%5d|"), (signed char)-12);
|
||||
Test1arg(F("| -12|"), F("|%5hd|"), (short)-12);
|
||||
Test1arg(F("| -12|"), F("|%5d|"), -12);
|
||||
Test1arg(F("| -12|"), F("|%5ld|"), -12L);
|
||||
Test1arg(F("| -12|"), F("|%5lld|"), -12LL);
|
||||
|
||||
Test1arg(F("| 244|"), F("|%5hhu|"), (char)-12);
|
||||
Test1arg(F("|4294967284|"), F("|%5u|"), (char)-12);
|
||||
Test1arg(F("| 244|"), F("|%5hhu|"), (signed char)-12);
|
||||
Test1arg(F("|4294967284|"), F("|%5u|"), (signed char)-12);
|
||||
Test1arg(F("|65524|"), F("|%5hu|"), (short)-12);
|
||||
Test1arg(F("|4294967284|"), F("|%5u|"), -12);
|
||||
Test1arg(F("|18446744073709551604|"), F("|%5lu|"), -12L);
|
||||
Test1arg(F("|18446744073709551604|"), F("|%5llu|"), -12LL);
|
||||
|
||||
Test1arg(F("| f4|"), F("|%5hhx|"), (char)-12);
|
||||
Test1arg(F("|fffffff4|"), F("|%5x|"), (char)-12);
|
||||
Test1arg(F("| f4|"), F("|%5hhx|"), (signed char)-12);
|
||||
Test1arg(F("|fffffff4|"), F("|%5x|"), (signed char)-12);
|
||||
Test1arg(F("| fff4|"), F("|%5hx|"), (short)-12);
|
||||
Test1arg(F("|fffffff4|"), F("|%5x|"), -12);
|
||||
Test1arg(F("|fffffffffffffff4|"), F("|%5lx|"), -12L);
|
||||
|
@ -4,7 +4,7 @@
|
||||
#define PRIF "%s"
|
||||
#define PRILF "%ls"
|
||||
|
||||
#define loggf(...) DebugLog(2, __VA_ARGS__)
|
||||
#define loggf(...) printf(__VA_ARGS__)
|
||||
//#define loggf(...) printf(__VA_ARGS__)
|
||||
|
||||
#define DISPLAY_ONLY_FAILED
|
||||
|
@ -45,7 +45,7 @@ static int compare(const char*s1, const char*s2)
|
||||
int ret2 = strcmp_reference(s1, s2);;
|
||||
|
||||
if ( sign(ret1) != sign(ret2) ) {
|
||||
DebugLog(2, "Comparing '%s' and '%s' gives %d and should have given %d\n", s1, s2, ret1, ret2);
|
||||
printf("Comparing '%s' and '%s' gives %d and should have given %d\n", s1, s2, ret1, ret2);
|
||||
return 1; // whatever if not 0
|
||||
}
|
||||
return 0;
|
||||
@ -101,7 +101,7 @@ static int compare_s1_with_variable_sizes(const char* s1, int code)
|
||||
{
|
||||
size_t count = (size_t)(rndf()*sizeof(s2)-1);
|
||||
if ( count >= sizeof(s2) ) {
|
||||
DebugLog(2, "compare_s1_with_variable_sizes, BUG : sizeof=%lu, count=%zu\n", sizeof(s2), count);
|
||||
printf("compare_s1_with_variable_sizes, BUG : sizeof=%lu, count=%zu\n", sizeof(s2), count);
|
||||
continue;
|
||||
}
|
||||
fillRandom(s2, count);
|
||||
|
@ -7,12 +7,12 @@
|
||||
|
||||
static int len(const char* s1, size_t count, int code)
|
||||
{
|
||||
//DebugLog(2, "strlen of '%s'\n", s1);
|
||||
//printf("strlen of '%s'\n", s1);
|
||||
|
||||
size_t ret1 = strlen(s1);
|
||||
|
||||
if ( ret1 != count ) {
|
||||
DebugLog(2, "strlen of '%s' gives %zu and should have given %zu\n", s1, ret1, count);
|
||||
printf("strlen of '%s' gives %zu and should have given %zu\n", s1, ret1, count);
|
||||
return code;
|
||||
}
|
||||
return 0;
|
||||
@ -59,7 +59,7 @@ int strlen_tests()
|
||||
{
|
||||
|
||||
#ifdef JIEF_DEBUG
|
||||
// DebugLog(2, "XStringW_tests -> Enter\n");
|
||||
// printf("XStringW_tests -> Enter\n");
|
||||
#endif
|
||||
const char* s;
|
||||
s = "1234567890"; // use intermediary var to not be optimized out.
|
||||
@ -77,15 +77,15 @@ int strlen_tests()
|
||||
|
||||
#ifdef CLOVER_BUILD
|
||||
// UINTN start = AsmReadTsc();
|
||||
// DebugLog(2, "strlen_tests -> Enter\n");
|
||||
// printf("strlen_tests -> Enter\n");
|
||||
//
|
||||
// for ( UINTN i=0 ; i<100000 ; i++ ) {
|
||||
// ret = strlen_s1_all_offset(s, 50, 10);
|
||||
// }
|
||||
//
|
||||
// DebugLog(2, "strlen_tests -> Exit\n");
|
||||
// printf("strlen_tests -> Exit\n");
|
||||
// UINTN end = AsmReadTsc();
|
||||
// DebugLog(2, "Strlen bench time = %d\n", end - start);
|
||||
// printf("Strlen bench time = %d\n", end - start);
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -52,12 +52,12 @@ static int nb_compare = 0;
|
||||
static int compare(const char*s1, const char*s2, size_t count)
|
||||
{
|
||||
nb_compare ++;
|
||||
//DebugLog(2, "Comparing '%s' and '%s' with count %d\n", s1, s2, count);
|
||||
//printf("Comparing '%s' and '%s' with count %d\n", s1, s2, count);
|
||||
int ret1 = strncmp(s1, s2, count);
|
||||
int ret2 = strncmp_reference(s1, s2, count);
|
||||
|
||||
if ( sign(ret1) != sign(ret2) ) {
|
||||
DebugLog(2, "Comparing '%s' and '%s' with count %zu gives %d and should have given %d\n", s1, s2, count, ret1, ret2);
|
||||
printf("Comparing '%s' and '%s' with count %zu gives %d and should have given %d\n", s1, s2, count, ret1, ret2);
|
||||
int ret3 = strncmp(s1, s2, count); // for live debugging
|
||||
(void)ret3;
|
||||
return 1; // whatever if not 0
|
||||
@ -141,7 +141,7 @@ static int compare_s1_with_variable_sizes(const char* s1, size_t s1count, int co
|
||||
{
|
||||
size_t s2count = (size_t)(rndf()*sizeof(s2)-1);
|
||||
if ( s2count >= sizeof(s2) ) {
|
||||
DebugLog(2, "compare_s1_with_variable_sizes, BUG : sizeof=%lu, count=%zu\n", sizeof(s2), s2count);
|
||||
printf("compare_s1_with_variable_sizes, BUG : sizeof=%lu, count=%zu\n", sizeof(s2), s2count);
|
||||
continue;
|
||||
}
|
||||
fillRandom(s2, s2count);
|
||||
|
@ -1,36 +0,0 @@
|
||||
#include "panic.h"
|
||||
#include <Platform.h>
|
||||
|
||||
//extern "C" {
|
||||
//#include <Library/BaseLib.h> // for CpuDeadLoop
|
||||
//}
|
||||
|
||||
bool stop_at_panic = true;
|
||||
bool i_have_panicked = false;
|
||||
|
||||
/*
|
||||
*
|
||||
* Function panic_ seems useless. It's same as panic(). It's to be able to put a breakpoint in gdb with br panic_(). This is done in gdb_launch script in Qemu
|
||||
*/
|
||||
static void panic_(const char* s)
|
||||
{
|
||||
if ( s ) DebugLog(2, "%s\n", s);
|
||||
DebugLog(2, "A fatal error happened. System halted\n");
|
||||
CpuDeadLoop();
|
||||
}
|
||||
|
||||
|
||||
void panic(const char* s)
|
||||
{
|
||||
if ( stop_at_panic ) {
|
||||
panic_(s);
|
||||
}else{
|
||||
i_have_panicked = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void panic(void)
|
||||
{
|
||||
panic(nullptr);
|
||||
}
|
@ -1248,7 +1248,7 @@ VOID ScanLoader(VOID)
|
||||
//----- Test common linux name and path like /EFI/ubuntu/grubx64.efi
|
||||
REFIT_DIR_ITER DirIter;
|
||||
EFI_FILE_INFO *DirEntry = NULL;
|
||||
DirIterOpen(SelfRootDir, L"\\EFI", &DirIter);
|
||||
DirIterOpen(Volume->RootDir, L"\\EFI", &DirIter);
|
||||
while (DirIterNext(&DirIter, 1, L"*", &DirEntry)) {
|
||||
if (DirEntry->FileName[0] == '.') {
|
||||
//DBG("Skip dot entries: %ls\n", DirEntry->FileName);
|
||||
@ -1256,7 +1256,7 @@ VOID ScanLoader(VOID)
|
||||
}
|
||||
XString OSName = SPrintf("%ls", DirEntry->FileName); //this is folder name "ubuntu"
|
||||
XStringW File = SWPrintf("EFI\\%ls\\grubx64.efi", DirEntry->FileName);
|
||||
if (FileExists(SelfRootDir, File.wc_str())) {
|
||||
if (FileExists(Volume->RootDir, File.wc_str())) {
|
||||
XStringW LoaderTitle = SWPrintf("%s OS EFI boot menu", OSName.c_str());
|
||||
XString IconXS = OSName + ",linux"_XS;
|
||||
IconXS.lowerAscii(); //to avoid misconception
|
||||
|
Loading…
Reference in New Issue
Block a user