diff --git a/TactilityC/Include/tt_app.h b/TactilityC/Include/tt_app.h index 03bfdd3b..371dd529 100644 --- a/TactilityC/Include/tt_app.h +++ b/TactilityC/Include/tt_app.h @@ -29,7 +29,7 @@ bool tt_app_has_result(AppHandle handle); * @param[out] buffer the output buffer (recommended size is 256 bytes) * @param[inout] size used as input for maximum buffer size (including null terminator) and is set with the path string length by this function */ -void tt_app_get_data_directory(AppPathsHandle handle, char* buffer, size_t& size); +void tt_app_get_data_directory(AppPathsHandle handle, char* buffer, size_t* size); /** Get the path to the data directory of this app, with LVGL drive letter prefix applied. * The recommended buffer size is 256 bytes. @@ -37,7 +37,7 @@ void tt_app_get_data_directory(AppPathsHandle handle, char* buffer, size_t& size * @param[out] buffer the output buffer (recommended size is 256 bytes) * @param[inout] size used as input for maximum buffer size (including null terminator) and is set with the path string length by this function */ -void tt_app_get_data_directory_lvgl(AppPathsHandle handle, char* buffer, size_t& size); +void tt_app_get_data_directory_lvgl(AppPathsHandle handle, char* buffer, size_t* size); /** * Start an app by id. diff --git a/TactilityC/Include/tt_kernel.h b/TactilityC/Include/tt_kernel.h index c399b200..0777c706 100644 --- a/TactilityC/Include/tt_kernel.h +++ b/TactilityC/Include/tt_kernel.h @@ -8,6 +8,8 @@ extern "C" { typedef unsigned long TickType; +#define MAX_TICKS INT32_MAX + /** * Stall the current task for the specified amount of time. * @param milliseconds the time in milliseconds to stall. diff --git a/TactilityC/Source/tt_app.cpp b/TactilityC/Source/tt_app.cpp index ad152b36..e1b4a204 100644 --- a/TactilityC/Source/tt_app.cpp +++ b/TactilityC/Source/tt_app.cpp @@ -33,38 +33,40 @@ void tt_app_stop() { tt::app::stop(); } -void tt_app_get_data_directory(AppPathsHandle handle, char* buffer, size_t& size) { +void tt_app_get_data_directory(AppPathsHandle handle, char* buffer, size_t* size) { assert(buffer != nullptr); - assert(size > 0); + assert(size != nullptr); + assert(*size > 0); auto paths = HANDLE_AS_APP_CONTEXT(handle)->getPaths(); auto data_path = paths->getDataDirectory(); auto expected_length = data_path.length() + 1; - if (size < expected_length) { + if (*size < expected_length) { TT_LOG_E(TAG, "Path buffer not large enough (%d < %d)", size, expected_length); - size = 0; + *size = 0; buffer[0] = 0; return; } strcpy(buffer, data_path.c_str()); - size = data_path.length(); + *size = data_path.length(); } -void tt_app_get_data_directory_lvgl(AppPathsHandle handle, char* buffer, size_t& size) { +void tt_app_get_data_directory_lvgl(AppPathsHandle handle, char* buffer, size_t* size) { assert(buffer != nullptr); - assert(size > 0); + assert(size != nullptr); + assert(*size > 0); auto paths = HANDLE_AS_APP_CONTEXT(handle)->getPaths(); auto data_path = paths->getDataDirectoryLvgl(); auto expected_length = data_path.length() + 1; - if (size < expected_length) { + if (*size < expected_length) { TT_LOG_E(TAG, "Path buffer not large enough (%d < %d)", size, expected_length); - size = 0; + *size = 0; buffer[0] = 0; return; } strcpy(buffer, data_path.c_str()); - size = data_path.length(); + *size = data_path.length(); } } \ No newline at end of file