From 5906f669472d1d61f67458e42f9187d1b7242144 Mon Sep 17 00:00:00 2001 From: Kiandisor Date: Tue, 14 Jul 2026 23:56:55 +1000 Subject: [PATCH 01/13] Out of range bugfix Fixed the std::out_of_range exception that was happening in the unit tests for the functions: - bin_to_dec - oct_to_dec --- coresdk/src/coresdk/basics.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/coresdk/src/coresdk/basics.cpp b/coresdk/src/coresdk/basics.cpp index 7fe72bf5..dfc215dc 100644 --- a/coresdk/src/coresdk/basics.cpp +++ b/coresdk/src/coresdk/basics.cpp @@ -206,7 +206,7 @@ namespace splashkit_lib return 0; } - return stoi(bin_str, nullptr, 2); + return static_cast(std::stoul(bin_str, nullptr, 2)); } string hex_to_bin(const string &hex_str) @@ -300,7 +300,7 @@ namespace splashkit_lib return 0; } - return stoi(octal_string, nullptr, 8); + return static_cast(std::stoul(octal_string, nullptr, 8)); } unsigned int hex_to_dec(const string &hex_string) @@ -496,4 +496,4 @@ namespace splashkit_lib return abs(number1 * number2) / greatest_common_divisor(number1, number2); } -} \ No newline at end of file +} From f535846e7ef7ec3fcbd76e3df8a2468365fb6787 Mon Sep 17 00:00:00 2001 From: Kiandisor Date: Sun, 26 Jul 2026 21:12:53 +1000 Subject: [PATCH 02/13] Added over 32-bit check Added checks in the `bin_to_dec' and 'oct_to_dec' functions for when the input string length is larger than the maximum value a unsigned int can hold. If it's above a 32-bit value it will just return the max value of an unsigned int. Added tests to verify that the max value of unsigned int is returned when above inputs are given --- coresdk/src/coresdk/basics.cpp | 29 +++++++++++++++++++++++++++-- coresdk/src/test/test_terminal.cpp | 13 +++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/coresdk/src/coresdk/basics.cpp b/coresdk/src/coresdk/basics.cpp index dfc215dc..76cfeda3 100644 --- a/coresdk/src/coresdk/basics.cpp +++ b/coresdk/src/coresdk/basics.cpp @@ -205,8 +205,20 @@ namespace splashkit_lib LOG(ERROR) << "Invalid binary string \"" << bin_str << "\" passed to bin_to_dec. Returning 0."; return 0; } + if(bin_str.length() > 32) + { + return std::numeric_limits::max(); + } - return static_cast(std::stoul(bin_str, nullptr, 2)); + try + { + return static_cast(std::stoul(bin_str, nullptr, 2)); + } + catch(const std::exception& error) + { + LOG(ERROR) << "Invalid binary string \"" << bin_str << "\" passed to bin_to_dec. Returning 0."; + return 0; + } } string hex_to_bin(const string &hex_str) @@ -300,7 +312,20 @@ namespace splashkit_lib return 0; } - return static_cast(std::stoul(octal_string, nullptr, 8)); + if(octal_string.length() > 11) + { + return std::numeric_limits::max(); + } + + try + { + return static_cast(std::stoul(octal_string, nullptr, 8)); + } + catch(const std::exception& error) + { + LOG(ERROR) << "Invalid octal string \"" << octal_string << "\" passed to oct_to_dec. Returning 0."; + return 0; + } } unsigned int hex_to_dec(const string &hex_string) diff --git a/coresdk/src/test/test_terminal.cpp b/coresdk/src/test/test_terminal.cpp index bb012c43..49f7392d 100644 --- a/coresdk/src/test/test_terminal.cpp +++ b/coresdk/src/test/test_terminal.cpp @@ -6,6 +6,7 @@ * Copyright © 2016 Andrew Cain. All rights reserved. */ +#include #include "terminal.h" #include "utils.h" #include @@ -143,6 +144,12 @@ void bin_to_dec() assert(bin_to_dec("abcde") != 2147483647); assert(bin_to_dec("a1b2b3i4f02") != 1234); + // Test for over 32-bits + assert(bin_to_dec("111111111111111111111111111111111") == std::numeric_limits::max()); + + // Test over 64-bit limit + assert(bin_to_dec("11111111111111111111111111111111111111111111111111111111111111111") == std::numeric_limits::max()); + string bin_input1 = "1111011"; int result1 = bin_to_dec(bin_input1); write_line("1111011 in decimal is " + to_string(result1)); @@ -341,6 +348,12 @@ void test_oct_to_dec() assert(oct_to_dec("abcde") != 2147483647); assert(oct_to_dec("a1b2b3i4f02") != 1234); + // Test for over 32-bit limit + assert(oct_to_dec("377777777777") == std::numeric_limits::max()); + + // Test over 64-bit limit + assert(oct_to_dec("3777777777777777777777") == std::numeric_limits::max()); + string oct_input1 = "173"; int result1 = oct_to_dec(oct_input1); write_line("173 in decimal is " + to_string(result1)); From 767b8c0fd713e4203f5c69788c56ca09f983ffe6 Mon Sep 17 00:00:00 2001 From: Kiandisor Date: Sun, 26 Jul 2026 21:35:07 +1000 Subject: [PATCH 03/13] Added oct_to dec max value check Added a check to return the max value of an unsigned int if the input string would be greater than it --- coresdk/src/coresdk/basics.cpp | 5 +++++ coresdk/src/test/test_terminal.cpp | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/coresdk/src/coresdk/basics.cpp b/coresdk/src/coresdk/basics.cpp index 76cfeda3..0e753bff 100644 --- a/coresdk/src/coresdk/basics.cpp +++ b/coresdk/src/coresdk/basics.cpp @@ -317,6 +317,11 @@ namespace splashkit_lib return std::numeric_limits::max(); } + if(octal_string.length() == 11 && octal_string.front() > '3') + { + return std::numeric_limits::max(); + } + try { return static_cast(std::stoul(octal_string, nullptr, 8)); diff --git a/coresdk/src/test/test_terminal.cpp b/coresdk/src/test/test_terminal.cpp index 49f7392d..c685fc24 100644 --- a/coresdk/src/test/test_terminal.cpp +++ b/coresdk/src/test/test_terminal.cpp @@ -349,7 +349,8 @@ void test_oct_to_dec() assert(oct_to_dec("a1b2b3i4f02") != 1234); // Test for over 32-bit limit - assert(oct_to_dec("377777777777") == std::numeric_limits::max()); + assert(oct_to_dec("47777777777") == std::numeric_limits::max()); + assert(oct_to_dec("40000000000") == std::numeric_limits::max()); // Test over 64-bit limit assert(oct_to_dec("3777777777777777777777") == std::numeric_limits::max()); From 07ef3325ef9c6fb3073ec1d93fc2c6156eec5948 Mon Sep 17 00:00:00 2001 From: Kiandisor Date: Sun, 26 Jul 2026 22:14:39 +1000 Subject: [PATCH 04/13] Added fully qualified call to stoi This was the only call to a string to integer type that was not fully qualified in this file to add consistency --- coresdk/src/coresdk/basics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coresdk/src/coresdk/basics.cpp b/coresdk/src/coresdk/basics.cpp index 0e753bff..01c2b0e9 100644 --- a/coresdk/src/coresdk/basics.cpp +++ b/coresdk/src/coresdk/basics.cpp @@ -341,7 +341,7 @@ namespace splashkit_lib return 0; } - return stoi(hex_string, nullptr, 16); + return std::stoi(hex_string, nullptr, 16); } string oct_to_bin(const string &octal_str) From c433f1acfc45a9ebd71aa611fc0fad6b204e9472 Mon Sep 17 00:00:00 2001 From: Kiandisor Date: Thu, 30 Jul 2026 13:25:46 +1000 Subject: [PATCH 05/13] Updated header file documentation Added extra documentation to the basics.h to reflect changes to oct_to_dec and bin_to_dec --- coresdk/src/coresdk/basics.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/coresdk/src/coresdk/basics.h b/coresdk/src/coresdk/basics.h index ddf1abe1..650c8612 100644 --- a/coresdk/src/coresdk/basics.h +++ b/coresdk/src/coresdk/basics.h @@ -19,7 +19,7 @@ using std::vector; namespace splashkit_lib { - + /** * Return a new string that removes the spaces from the start and end of * the input string. @@ -101,7 +101,7 @@ namespace splashkit_lib /** * Returns true if the string contains the substring. - * + * * @param text The text to search * @param subtext The substring to search for * @returns True if the substring is found in the text. @@ -110,7 +110,7 @@ namespace splashkit_lib /** * Returns the index of the first occurrence of the substring in the text. - * + * * @param text The text to search * @param subtext The substring to search for * @returns The index of the first occurrence of the substring in the text, or -1 if the substring is not found. @@ -119,7 +119,7 @@ namespace splashkit_lib /** * Replace all occurrences of a substring in a string with another string. - * + * * @param text The text to search * @param substr The substring to find and replace * @param new_text The string to replace the substring with @@ -129,7 +129,7 @@ namespace splashkit_lib /** * Split a string into an array of strings based on a delimiter. - * + * * @param text The text to split * @param delimiter The character to split the text on * @returns An array of strings @@ -169,7 +169,7 @@ namespace splashkit_lib * @returns True if the string is a valid octal string, false otherwise */ bool is_octal(const string &octal_str); - + /** * @brief Converts a decimal (unsigned integer) to a binary string * @@ -187,6 +187,8 @@ namespace splashkit_lib * * Converts the provided binary string into an unsigned integer. * For example, "1010" will be converted to 10. + * Any input that exceedes the max value of unsigned integer will silently truncate and not be treated as an error. + * Any out of range error that occurs will result in the value being returned being 0. * * @param bin Binary string to convert * @@ -235,6 +237,8 @@ namespace splashkit_lib * * Converts the provided octal string into its decimal representation. * For example, "100" will be converted to 64. + * Any input that exceedes the max value of unsigned integer will silently truncate and not be treated as an error. + * Any out of range error that occurs will result in the value being returned being 0. * * @param octal_string Octal string to convert * @@ -280,9 +284,9 @@ namespace splashkit_lib /** * @brief Convert a hexadecimal string to its numeric value. - * + * * @param hex_string the data to convert - * + * * @return unsigned int the numeric value of the hex string */ unsigned int hex_to_dec(const string &hex_string); From bd24a5cfb62e3a328318cf4c60629d8c278a2bd9 Mon Sep 17 00:00:00 2001 From: Kiandisor Date: Thu, 30 Jul 2026 14:05:54 +1000 Subject: [PATCH 06/13] Changes to bin_to_dec clamping Changed the way that clamping worked in the bin_to_dec function to convert the value first then check if the value is larger than unsigned int. Changed unit tests to reflect the changes --- coresdk/src/coresdk/basics.cpp | 17 +++++++++++------ coresdk/src/test/test_terminal.cpp | 8 +++----- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/coresdk/src/coresdk/basics.cpp b/coresdk/src/coresdk/basics.cpp index 01c2b0e9..f881d819 100644 --- a/coresdk/src/coresdk/basics.cpp +++ b/coresdk/src/coresdk/basics.cpp @@ -205,16 +205,21 @@ namespace splashkit_lib LOG(ERROR) << "Invalid binary string \"" << bin_str << "\" passed to bin_to_dec. Returning 0."; return 0; } - if(bin_str.length() > 32) - { - return std::numeric_limits::max(); - } try { - return static_cast(std::stoul(bin_str, nullptr, 2)); + const unsigned long result = std::stoul(bin_str, nullptr, 2); + + if (result > std::numeric_limits::max()) + { + return std::numeric_limits::max(); + } + else + { + return static_cast(result); + } } - catch(const std::exception& error) + catch (const std::exception& error) { LOG(ERROR) << "Invalid binary string \"" << bin_str << "\" passed to bin_to_dec. Returning 0."; return 0; diff --git a/coresdk/src/test/test_terminal.cpp b/coresdk/src/test/test_terminal.cpp index c685fc24..2f1f378f 100644 --- a/coresdk/src/test/test_terminal.cpp +++ b/coresdk/src/test/test_terminal.cpp @@ -125,6 +125,9 @@ void bin_to_dec() // High values (32-bit boundaries) assert(bin_to_dec("10000000000000000000000000000000") == 2147483648); + // Test for over unsigned int max + assert(bin_to_dec("1111111111111111111111111111111111111111111111111111111111111111") == std::numeric_limits::max()); + // Mixed bits assert(bin_to_dec("1111011") == 123); assert(bin_to_dec("10000000001") == 1025); @@ -144,11 +147,6 @@ void bin_to_dec() assert(bin_to_dec("abcde") != 2147483647); assert(bin_to_dec("a1b2b3i4f02") != 1234); - // Test for over 32-bits - assert(bin_to_dec("111111111111111111111111111111111") == std::numeric_limits::max()); - - // Test over 64-bit limit - assert(bin_to_dec("11111111111111111111111111111111111111111111111111111111111111111") == std::numeric_limits::max()); string bin_input1 = "1111011"; int result1 = bin_to_dec(bin_input1); From c54b45e5c45fe02885975bb517981c46b4d69e76 Mon Sep 17 00:00:00 2001 From: Kiandisor Date: Thu, 30 Jul 2026 14:11:45 +1000 Subject: [PATCH 07/13] Fixed formatting Corrected the formatting inconsistency in bin_to_dec and oct_to_dec --- coresdk/src/coresdk/basics.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/coresdk/src/coresdk/basics.cpp b/coresdk/src/coresdk/basics.cpp index 01c2b0e9..f2563048 100644 --- a/coresdk/src/coresdk/basics.cpp +++ b/coresdk/src/coresdk/basics.cpp @@ -205,7 +205,7 @@ namespace splashkit_lib LOG(ERROR) << "Invalid binary string \"" << bin_str << "\" passed to bin_to_dec. Returning 0."; return 0; } - if(bin_str.length() > 32) + if (bin_str.length() > 32) { return std::numeric_limits::max(); } @@ -214,7 +214,7 @@ namespace splashkit_lib { return static_cast(std::stoul(bin_str, nullptr, 2)); } - catch(const std::exception& error) + catch (const std::exception& error) { LOG(ERROR) << "Invalid binary string \"" << bin_str << "\" passed to bin_to_dec. Returning 0."; return 0; @@ -312,12 +312,12 @@ namespace splashkit_lib return 0; } - if(octal_string.length() > 11) + if (octal_string.length() > 11) { return std::numeric_limits::max(); } - if(octal_string.length() == 11 && octal_string.front() > '3') + if (octal_string.length() == 11 && octal_string.front() > '3') { return std::numeric_limits::max(); } @@ -326,7 +326,7 @@ namespace splashkit_lib { return static_cast(std::stoul(octal_string, nullptr, 8)); } - catch(const std::exception& error) + catch (const std::exception& error) { LOG(ERROR) << "Invalid octal string \"" << octal_string << "\" passed to oct_to_dec. Returning 0."; return 0; From 11e81db0223e0e99a0fb873af129da802462c6a9 Mon Sep 17 00:00:00 2001 From: Kiandisor Date: Thu, 30 Jul 2026 14:46:30 +1000 Subject: [PATCH 08/13] Changes to oct_to_dec clamping Changed the way that oct_to_dec clamps the value to work like bin_to_dec. Adjusted the unit test to reflect these changes --- coresdk/src/coresdk/basics.cpp | 17 +++++++---------- coresdk/src/test/test_terminal.cpp | 8 ++------ 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/coresdk/src/coresdk/basics.cpp b/coresdk/src/coresdk/basics.cpp index f881d819..6d35dbeb 100644 --- a/coresdk/src/coresdk/basics.cpp +++ b/coresdk/src/coresdk/basics.cpp @@ -317,19 +317,16 @@ namespace splashkit_lib return 0; } - if(octal_string.length() > 11) + try { - return std::numeric_limits::max(); - } + const unsigned long result = std::stoul(octal_string, nullptr, 8); - if(octal_string.length() == 11 && octal_string.front() > '3') - { - return std::numeric_limits::max(); - } + if (result > std::numeric_limits::max()) + { + return std::numeric_limits::max(); + } - try - { - return static_cast(std::stoul(octal_string, nullptr, 8)); + return static_cast(result); } catch(const std::exception& error) { diff --git a/coresdk/src/test/test_terminal.cpp b/coresdk/src/test/test_terminal.cpp index 2f1f378f..6aa8317d 100644 --- a/coresdk/src/test/test_terminal.cpp +++ b/coresdk/src/test/test_terminal.cpp @@ -346,12 +346,8 @@ void test_oct_to_dec() assert(oct_to_dec("abcde") != 2147483647); assert(oct_to_dec("a1b2b3i4f02") != 1234); - // Test for over 32-bit limit - assert(oct_to_dec("47777777777") == std::numeric_limits::max()); - assert(oct_to_dec("40000000000") == std::numeric_limits::max()); - - // Test over 64-bit limit - assert(oct_to_dec("3777777777777777777777") == std::numeric_limits::max()); + // Test over unsigned int max + assert(oct_to_dec("1777777777777777777777") == std::numeric_limits::max()); string oct_input1 = "173"; int result1 = oct_to_dec(oct_input1); From 89541ddc7d56389e7f0899b0454369b824454bfc Mon Sep 17 00:00:00 2001 From: Kiandisor Date: Fri, 31 Jul 2026 19:47:36 +1000 Subject: [PATCH 09/13] Updated header file documentation Added to hex_to_dec documentation that there will be truncation if result is greater than the max value of unsigned int to the max of unsigned int. If the input is out of range of an unsigned long then 0 will be returned --- coresdk/src/coresdk/basics.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coresdk/src/coresdk/basics.h b/coresdk/src/coresdk/basics.h index 650c8612..38778b8b 100644 --- a/coresdk/src/coresdk/basics.h +++ b/coresdk/src/coresdk/basics.h @@ -284,6 +284,9 @@ namespace splashkit_lib /** * @brief Convert a hexadecimal string to its numeric value. + * For example, "A" will be converted to 10. + * Any input that exceedes the max value of unsigned integer will silently truncate and not be treated as an error. + * Any out of range error that occurs will result in the value being returned being 0. * * @param hex_string the data to convert * From 66ecb4e61c8361d535f5b10eaf659b52160c0815 Mon Sep 17 00:00:00 2001 From: Kiandisor Date: Fri, 31 Jul 2026 19:49:16 +1000 Subject: [PATCH 10/13] Refactored hex_to_dec Changed the hex_to_dec function to behave the same way as the other _to_dec functions in basics --- coresdk/src/coresdk/basics.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/coresdk/src/coresdk/basics.cpp b/coresdk/src/coresdk/basics.cpp index 0fc1f046..8dd5603f 100644 --- a/coresdk/src/coresdk/basics.cpp +++ b/coresdk/src/coresdk/basics.cpp @@ -341,11 +341,28 @@ namespace splashkit_lib { if (!is_hex(hex_string)) { - LOG(ERROR) << "Invalid octal string \"" << hex_string << "\" passed to hex_to_dec. Returning 0."; + LOG(ERROR) << "Invalid hex string \"" << hex_string << "\" passed to hex_to_dec. Returning 0."; return 0; } - return std::stoi(hex_string, nullptr, 16); + try + { + const unsigned long result = std::stoul(hex_string, nullptr, 16); + + if (result > std::numeric_limits::max()) + { + return std::numeric_limits::max(); + } + else + { + return static_cast(result); + } + } + catch (const std::exception& error) + { + LOG(ERROR) << "Invalid hex string \"" << hex_string << "\" passed to hex_to_dec. Returning 0."; + return 0; + } } string oct_to_bin(const string &octal_str) From edf1955b11d1836be9e6f7d5d210568c9a1bc6b0 Mon Sep 17 00:00:00 2001 From: Kiandisor Date: Fri, 31 Jul 2026 19:50:25 +1000 Subject: [PATCH 11/13] Added hex_to_dec tests Added integration tests for hex_to_dec to validate outputs and correctness --- coresdk/src/test/test_terminal.cpp | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/coresdk/src/test/test_terminal.cpp b/coresdk/src/test/test_terminal.cpp index 6aa8317d..d3963785 100644 --- a/coresdk/src/test/test_terminal.cpp +++ b/coresdk/src/test/test_terminal.cpp @@ -208,6 +208,59 @@ void hex_to_bin() write_line("-------------------------------------"); } +void hex_to_dec_tests() +{ + write_line("Testing hexadecimal to decimal conversion"); + + // Basic cases + assert(hex_to_dec("0") == 0); + assert(hex_to_dec("1") == 1); + assert(hex_to_dec("A") == 10); + assert(hex_to_dec("F") == 15); + assert(hex_to_dec("10") == 16); + assert(hex_to_dec("FF") == 255); + assert(hex_to_dec("100") == 256); + assert(hex_to_dec("ABC") == 2748); + assert(hex_to_dec("1234") == 4660); + + // Larger hexadecimal values + assert(hex_to_dec("FFFF") == 65535); + assert(hex_to_dec("FFFFFFFF") == 4294967295); + assert(hex_to_dec("1FFFFFF") == 33554431); + assert(hex_to_dec("ABCDEF") == 11259375); + + // Tests for inequality + assert(hex_to_dec("0") != 1); + assert(hex_to_dec("1") != 0); + assert(hex_to_dec("A") != 11); + assert(hex_to_dec("F") != 16); + assert(hex_to_dec("10") != 10); + assert(hex_to_dec("FF") != 256); + assert(hex_to_dec("100") != 255); + assert(hex_to_dec("ABC") != 2749); + assert(hex_to_dec("1234") != 4670); + assert(hex_to_dec("FFFF") != 100); + assert(hex_to_dec("FFFFFFFF") != 200); + assert(hex_to_dec("1FFFFFF") != 300); + assert(hex_to_dec("GGGGGG") != 400); + + // Test over unsigned int + assert(hex_to_dec("100000000") == 4294967295); + // Test over unsigned long + assert(hex_to_dec("10000000000000000") == 0); + + const string hex_input1 = "ABCDEF"; + const unsigned int result1 = hex_to_dec(hex_input1); + write_line("ABCDEF in decimal is " + to_string(result1)); + + const string hex_input2 = "1234"; + const unsigned int result2 = hex_to_dec(hex_input2); + write_line("1234 in decimal is " + to_string(result2)); + + write_line("All hexadecimal to decimal tests passed!"); + write_line("-------------------------------------"); +} + void bin_to_hex() { write_line("Testing binary to hexadecimal conversion"); @@ -893,6 +946,7 @@ void run_terminal_test() dec_to_bin(); bin_to_dec(); hex_to_bin(); + hex_to_dec_tests(); bin_to_hex(); test_dec_to_oct(); test_oct_to_dec(); From 06086d7922c7c111180037f72a4291cda5158088 Mon Sep 17 00:00:00 2001 From: Kiandisor Date: Fri, 31 Jul 2026 19:57:50 +1000 Subject: [PATCH 12/13] Formatting Changes Corrected formatting problems --- coresdk/src/coresdk/basics.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/coresdk/src/coresdk/basics.cpp b/coresdk/src/coresdk/basics.cpp index 8dd5603f..011c7641 100644 --- a/coresdk/src/coresdk/basics.cpp +++ b/coresdk/src/coresdk/basics.cpp @@ -347,21 +347,21 @@ namespace splashkit_lib try { - const unsigned long result = std::stoul(hex_string, nullptr, 16); + const unsigned long result = std::stoul(hex_string, nullptr, 16); - if (result > std::numeric_limits::max()) - { - return std::numeric_limits::max(); - } - else - { - return static_cast(result); - } + if (result > std::numeric_limits::max()) + { + return std::numeric_limits::max(); + } + else + { + return static_cast(result); + } } catch (const std::exception& error) { LOG(ERROR) << "Invalid hex string \"" << hex_string << "\" passed to hex_to_dec. Returning 0."; - return 0; + return 0; } } From 61f6c28e3605bf29a53a16b4090e5db2f2bc74ac Mon Sep 17 00:00:00 2001 From: Kiandisor Date: Sun, 2 Aug 2026 16:38:04 +1000 Subject: [PATCH 13/13] Formatting Corrected formating problem --- coresdk/src/coresdk/basics.cpp | 42 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/coresdk/src/coresdk/basics.cpp b/coresdk/src/coresdk/basics.cpp index 011c7641..104081ac 100644 --- a/coresdk/src/coresdk/basics.cpp +++ b/coresdk/src/coresdk/basics.cpp @@ -208,16 +208,16 @@ namespace splashkit_lib try { - const unsigned long result = std::stoul(bin_str, nullptr, 2); + const unsigned long result = std::stoul(bin_str, nullptr, 2); - if (result > std::numeric_limits::max()) - { - return std::numeric_limits::max(); - } - else - { - return static_cast(result); - } + if (result > std::numeric_limits::max()) + { + return std::numeric_limits::max(); + } + else + { + return static_cast(result); + } } catch (const std::exception& error) { @@ -319,21 +319,21 @@ namespace splashkit_lib try { - const unsigned long result = std::stoul(octal_string, nullptr, 8); + const unsigned long result = std::stoul(octal_string, nullptr, 8); - if (result > std::numeric_limits::max()) - { - return std::numeric_limits::max(); - } - else - { - return static_cast(result); - } + if (result > std::numeric_limits::max()) + { + return std::numeric_limits::max(); + } + else + { + return static_cast(result); + } } catch (const std::exception& error) { LOG(ERROR) << "Invalid octal string \"" << octal_string << "\" passed to oct_to_dec. Returning 0."; - return 0; + return 0; } } @@ -351,11 +351,11 @@ namespace splashkit_lib if (result > std::numeric_limits::max()) { - return std::numeric_limits::max(); + return std::numeric_limits::max(); } else { - return static_cast(result); + return static_cast(result); } } catch (const std::exception& error)