source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Absurdly, the return value of sqlite3_column_text() is "const
Date: Tue, 5 Aug 2014 10:43:11 -0400 (EDT)	[thread overview]
Message-ID: <201408051443.s75EhBQP017378@krisdoz.my.domain> (raw)

Log Message:
-----------
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@.

Modified Files:
--------------
    mdocml:
        mandocdb.c
        mansearch.c

Revision Data
-------------
Index: mansearch.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mansearch.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -Lmansearch.c -Lmansearch.c -u -p -r1.40 -r1.41
--- mansearch.c
+++ mansearch.c
@@ -302,7 +302,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);
 		}
@@ -406,9 +406,9 @@ buildnames(struct manpage *mpage, sqlite
 
 		/* 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. */
 
@@ -497,7 +497,7 @@ buildoutput(sqlite3 *db, sqlite3_stmt *s
 			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);
Index: mandocdb.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandocdb.c,v
retrieving revision 1.153
retrieving revision 1.154
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.153 -r1.154
--- mandocdb.c
+++ mandocdb.c
@@ -1306,10 +1306,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);
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2014-08-05 14:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201408051443.s75EhBQP017378@krisdoz.my.domain \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).