From: schwarze Date: Fri, 8 Aug 2014 17:36:21 +0000 (+0000) Subject: Absurdly, the return value of sqlite3_column_text() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0c60863e93b1e5e1216a806e9e69a4d68709f790;p=openbsd Absurdly, the return value of sqlite3_column_text() is "const unsigned char *", which causes warnings with GCC on Linux. Explicitly cast to "const char *" to avoid this. Issue noticed by kristaps@. --- diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c index 30e77a99916..85d78d6a514 100644 --- a/usr.bin/mandoc/mandocdb.c +++ b/usr.bin/mandoc/mandocdb.c @@ -1,4 +1,4 @@ -/* $Id: mandocdb.c,v 1.112 2014/08/08 16:17:09 schwarze Exp $ */ +/* $Id: mandocdb.c,v 1.113 2014/08/08 17:36:21 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze @@ -1299,10 +1299,10 @@ names_check(void) say("", "%s", sqlite3_errmsg(db)); while (SQLITE_ROW == (irc = sqlite3_step(stmt))) { - name = sqlite3_column_text(stmt, 0); - sec = sqlite3_column_text(stmt, 1); - arch = sqlite3_column_text(stmt, 2); - key = sqlite3_column_text(stmt, 3); + name = (const char *)sqlite3_column_text(stmt, 0); + sec = (const char *)sqlite3_column_text(stmt, 1); + arch = (const char *)sqlite3_column_text(stmt, 2); + key = (const char *)sqlite3_column_text(stmt, 3); say("", "%s(%s%s%s) lacks mlink \"%s\"", name, sec, '\0' == *arch ? "" : "/", '\0' == *arch ? "" : arch, key); diff --git a/usr.bin/mandoc/mansearch.c b/usr.bin/mandoc/mansearch.c index d58813531bc..b457453ca3c 100644 --- a/usr.bin/mandoc/mansearch.c +++ b/usr.bin/mandoc/mansearch.c @@ -1,4 +1,4 @@ -/* $Id: mansearch.c,v 1.29 2014/07/24 20:30:38 schwarze Exp $ */ +/* $Id: mansearch.c,v 1.30 2014/08/08 17:36:21 schwarze Exp $ */ /* * Copyright (c) 2012 Kristaps Dzonsons * Copyright (c) 2013, 2014 Ingo Schwarze @@ -291,7 +291,7 @@ mansearch(const struct mansearch *search, mp->pageid = pageid; mp->form = sqlite3_column_int(s, 1); if (TYPE_Nd == outbit) - mp->desc = mandoc_strdup( + mp->desc = mandoc_strdup((const char *) sqlite3_column_text(s, 0)); ohash_insert(&htab, idx, mp); } @@ -395,9 +395,9 @@ buildnames(struct manpage *mpage, sqlite3 *db, sqlite3_stmt *s, /* Fetch the next name. */ - sec = sqlite3_column_text(s, 0); - arch = sqlite3_column_text(s, 1); - name = sqlite3_column_text(s, 2); + sec = (const char *)sqlite3_column_text(s, 0); + arch = (const char *)sqlite3_column_text(s, 1); + name = (const char *)sqlite3_column_text(s, 2); /* Remember the first section found. */ @@ -486,7 +486,7 @@ buildoutput(sqlite3 *db, sqlite3_stmt *s, uint64_t pageid, uint64_t outbit) oldoutput = output; sep1 = " # "; } - data = sqlite3_column_text(s, 1); + data = (const char *)sqlite3_column_text(s, 1); mandoc_asprintf(&newoutput, "%s%s%s", oldoutput, sep1, data); free(output);