diff --git a/database/DatabaseType.h b/database/DatabaseType.h index 6083f99..19ed68d 100755 --- a/database/DatabaseType.h +++ b/database/DatabaseType.h @@ -10,10 +10,28 @@ #define COMS_DATABASE_TYPE_H enum DatabaseType : byte { + DB_TYPE_UNKNOWN, DB_TYPE_SQLITE, DB_TYPE_MARIA, DB_TYPE_PSQL, DB_TYPE_MSSQL }; +DatabaseType database_type_from_string(const char* str) +{ + if (str_compare(str, "sqlite", sizeof("sqlite") - 1) == 0) { + return DB_TYPE_SQLITE; + } else if (str_compare(str, "mariadb", sizeof("mariadb") - 1) == 0) { + return DB_TYPE_MARIA; + } else if (str_compare(str, "mysql", sizeof("mysql") - 1) == 0) { + return DB_TYPE_MARIA; + } else if (str_compare(str, "psql", sizeof("psql") - 1) == 0) { + return DB_TYPE_PSQL; + } else if (str_compare(str, "mssql", sizeof("mssql") - 1) == 0) { + return DB_TYPE_MSSQL; + } + + return DB_TYPE_UNKNOWN; +} + #endif \ No newline at end of file diff --git a/platform/win32/FileUtils.cpp b/platform/win32/FileUtils.cpp index b433103..06149ae 100755 --- a/platform/win32/FileUtils.cpp +++ b/platform/win32/FileUtils.cpp @@ -861,7 +861,7 @@ void iterate_directory(const char* base_path, const char* file_ending, void (*ha if (!str_ends_with(base_path, "/")) { str_concat_append(full_path, "/"); } - str_concat_append(full_path, entry->d_name); + str_concat_append(full_path, find_file_data.cFileName); if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { iterate_directory(full_path, file_ending, handler, args); diff --git a/utils/StringUtils.h b/utils/StringUtils.h index 091744d..b5327d3 100755 --- a/utils/StringUtils.h +++ b/utils/StringUtils.h @@ -829,9 +829,8 @@ int32 str_copy_until(char* __restrict dest, const char* __restrict src, char del return len; } -// @todo Inconsistent parameter order of dest and src with other functions inline -void str_copy_until(const char* __restrict src, char* __restrict dest, const char* __restrict delim) noexcept +void str_copy_until(char* __restrict dest, const char* __restrict src, const char* __restrict delim) noexcept { size_t len = str_length(delim);