From 09ac5263a706ecd9e6fef15a8471bad632b7f957 Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Fri, 6 Aug 2010 17:18:37 +0000 Subject: [PATCH] * Fix a few typos. --- sql.c | 12 ++++++------ upnpsoap.c | 6 ++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sql.c b/sql.c index ce208d2..5d1fdc1 100644 --- a/sql.c +++ b/sql.c @@ -124,7 +124,7 @@ sql_get_int_field(sqlite3 *db, const char *fmt, ...) } char * -sql_get_text_field(void *dbh, const char *fmt, ...) +sql_get_text_field(void *db, const char *fmt, ...) { va_list ap; int counter, result, len; @@ -134,9 +134,9 @@ sql_get_text_field(void *dbh, const char *fmt, ...) va_start(ap, fmt); - if (dbh == NULL) + if (db == NULL) { - DPRINTF(E_WARN, L_DB_SQL, "%s: dbh is NULL", __func__); + DPRINTF(E_WARN, L_DB_SQL, "%s: db is NULL", __func__); return NULL; } @@ -144,12 +144,12 @@ sql_get_text_field(void *dbh, const char *fmt, ...) //DPRINTF(E_DEBUG, L_DB_SQL, "sql: %s\n", sql); - switch (sqlite3_prepare_v2(dbh, sql, -1, &stmt, NULL)) + switch (sqlite3_prepare_v2(db, sql, -1, &stmt, NULL)) { case SQLITE_OK: break; default: - DPRINTF(E_ERROR, L_DB_SQL, "prepare failed: %s\n%s\n", sqlite3_errmsg, sql); + DPRINTF(E_ERROR, L_DB_SQL, "prepare failed: %s\n%s\n", sqlite3_errmsg(db), sql); sqlite3_free(sql); return NULL; } @@ -190,7 +190,7 @@ sql_get_text_field(void *dbh, const char *fmt, ...) break; default: - DPRINTF(E_WARN, L_DB_SQL, "%s: step failed: %s", __func__, sqlite3_errmsg); + DPRINTF(E_WARN, L_DB_SQL, "%s: step failed: %s", __func__, sqlite3_errmsg(db)); str = NULL; break; } diff --git a/upnpsoap.c b/upnpsoap.c index ad5806b..3ffe85f 100644 --- a/upnpsoap.c +++ b/upnpsoap.c @@ -957,10 +957,12 @@ BrowseContentDirectory(struct upnphttp * h, const char * action) else { ptr = sql_get_text_field(db, "SELECT OBJECT_ID from OBJECTS" - "where OBJECT_ID in ('1$%s', '2$%s', '3$%s')", + " where OBJECT_ID in ('1$%s', '2$%s', '3$%s')", ObjectId, ObjectId, ObjectId); if( ptr ) ObjectId = ptr; + else + ObjectId = sqlite3_mprintf("%s", ObjectId); } } DPRINTF(E_DEBUG, L_HTTP, "Browsing ContentDirectory:\n" @@ -1132,7 +1134,7 @@ SearchContentDirectory(struct upnphttp * h, const char * action) else { ptr = sql_get_text_field(db, "SELECT OBJECT_ID from OBJECTS" - "where OBJECT_ID in ('1$%s', '2$%s', '3$%s')", + " where OBJECT_ID in ('1$%s', '2$%s', '3$%s')", ContainerID, ContainerID, ContainerID); if( ptr ) ContainerID = ptr;