From: John Ellson Date: Sat, 9 Jan 2016 21:34:08 +0000 (-0500) Subject: janitor - fix some consts for c++ and -Wwrite-strings X-Git-Tag: TRAVIS_CI_BUILD_EXPERIMENTAL~62 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eb83246597731a3e07619a1aa21e6a1825b6623e;p=graphviz janitor - fix some consts for c++ and -Wwrite-strings --- diff --git a/cmd/gvedit/mainwindow.cpp b/cmd/gvedit/mainwindow.cpp index 4f9ed3392..8e3dd68f5 100644 --- a/cmd/gvedit/mainwindow.cpp +++ b/cmd/gvedit/mainwindow.cpp @@ -37,8 +37,8 @@ static void freeList(char **lp, int count) free(lp); } -static int LoadPlugins(QComboBox * cb, GVC_t * gvc, char *kind, - char *more[], char *prefer) +static int LoadPlugins(QComboBox * cb, GVC_t * gvc, const char *kind, + const char *more[], const char *prefer) { int count; char **lp = gvPluginList(gvc, kind, &count, NULL); @@ -55,7 +55,7 @@ static int LoadPlugins(QComboBox * cb, GVC_t * gvc, char *kind, /* Add additional items if supplied */ if (more) { int i = 0; - char *s; + const char *s; while ((s = more[i++])) { cb->addItem(QString(s)); } @@ -117,9 +117,9 @@ void CMainWindow::createConsole() } -static char *xtra[] = { +static const char *xtra[] = { "NONE", - (char *) 0 + (const char *) NULL }; CMainWindow::CMainWindow(char*** Files) @@ -171,7 +171,7 @@ CMainWindow::CMainWindow(char*** Files) // (QComboBox*)frmSettings->findChild("cbLayout") QComboBox *cb = (QComboBox *) frmSettings->findChild < QComboBox * >("cbLayout"); - dfltLayoutIdx = LoadPlugins(cb, frmSettings->gvc, "layout", 0, "dot"); + dfltLayoutIdx = LoadPlugins(cb, frmSettings->gvc, "layout", NULL, "dot"); cb = (QComboBox *) frmSettings->findChild < QComboBox * >("cbExtension"); dfltRenderIdx = diff --git a/lib/gvc/gvc.h b/lib/gvc/gvc.h index a955c425c..5e08e96e1 100644 --- a/lib/gvc/gvc.h +++ b/lib/gvc/gvc.h @@ -104,7 +104,7 @@ extern int gvFreeContext(GVC_t *gvc); * At present, the str argument is unused, but may be used to modify * the search as in gvplugin_list above. */ -extern char** gvPluginList (GVC_t *gvc, char* kind, int* sz, char*); +extern char** gvPluginList (GVC_t *gvc, const char* kind, int* sz, char*); /** Add a library from your user application * @param gvc Graphviz context to add library to diff --git a/lib/gvc/gvplugin.c b/lib/gvc/gvplugin.c index 5b7ef1ba5..a2e09c421 100644 --- a/lib/gvc/gvplugin.c +++ b/lib/gvc/gvplugin.c @@ -412,7 +412,7 @@ char *gvplugin_list(GVC_t * gvc, api_t api, const char *str) * At present, the str argument is unused, but may be used to modify * the search as in gvplugin_list above. */ -char **gvPluginList(GVC_t * gvc, char *kind, int *sz, const char *str) +char **gvPluginList(GVC_t * gvc, const char *kind, int *sz, const char *str) { int api; gvplugin_available_t **pnext, **plugin;