Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
ugursoy committed Feb 1, 2025
1 parent b58b354 commit d0edc02
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/gdsqlite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1160,25 +1160,23 @@ int SQLite::enable_load_extension(const bool &p_onoff) {
int rc;
if (p_onoff == true) {
rc = sqlite3_enable_load_extension(db, 1);
}
else{
} else {
rc = sqlite3_enable_load_extension(db, 0);
}
if (rc != SQLITE_OK) {
UtilityFunctions::printerr("GDSQLite Error: Extension loading cannot be enabled/disabled.");
}
}
return rc;
}

int SQLite::load_extension(const String &p_path, const String &entrypoint) {

int rc;

char *zErrMsg = 0;
String globalized_path = ProjectSettings::get_singleton()->globalize_path(p_path.strip_edges());
const CharString dummy_path = globalized_path.utf8();
const char *char_path = dummy_path.get_data();

const CharString dummy_func_name = entrypoint.utf8();
const char *func_name = dummy_func_name.get_data();

Expand All @@ -1188,7 +1186,7 @@ int SQLite::load_extension(const String &p_path, const String &entrypoint) {
rc = sqlite3_load_extension(db, char_path, func_name, &zErrMsg);
// Disable C-API
sqlite3_db_config(db, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 0, NULL);

if (rc != SQLITE_OK) {
UtilityFunctions::printerr("GDSQLite Error: Unable to load extension: " + String::utf8(zErrMsg));
sqlite3_free(zErrMsg);
Expand All @@ -1197,6 +1195,6 @@ int SQLite::load_extension(const String &p_path, const String &entrypoint) {
if (verbosity_level > VerbosityLevel::QUIET) {
UtilityFunctions::print("Loaded extension successfully (" + globalized_path + ")");
}

return rc;
}

0 comments on commit d0edc02

Please sign in to comment.