OSDN Git Service

Address some GCC-4.7 string initialisation warnings.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Sat, 4 May 2013 19:13:36 +0000 (20:13 +0100)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Sat, 4 May 2013 19:13:36 +0000 (20:13 +0100)
ChangeLog
src/pkgdata.cpp
src/pkglist.cpp

index 03a97ba..139257c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2013-05-04  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+       Address some GCC-4.7 string initialisation warnings.
+
+       * src/pkglist.cpp (AppWindowMaker::InitPackageListView): Declare all
+       headings[].text initialisers as 'const'; cast to 'char *' as required.
+       (pkgListViewMaker::Dispatch): Ditto, when inserting the 'const' empty
+       string into the list, as a component class value.
+
+       * src/pkgdata.cpp (AppWindowMaker::InitPackageTabControl): Declare all
+       TabLegend[] initialisers as 'const'; cast to 'char *' as required.
+
 2013-05-02  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
        Correct a spin wait thread synchronisation issue.
index cf3dec7..3bbab20 100644 (file)
@@ -947,7 +947,7 @@ void AppWindowMaker::InitPackageTabControl()
    */
   TCITEM tab;
   tab.mask = TCIF_TEXT;
-  char *TabLegend[] =
+  const char *TabLegend[] =
   { "General", "Description", "Dependencies", "Installed Files", "Versions",
 
     /* ...with a NULL sentinel marking the preceding label as
@@ -959,7 +959,7 @@ void AppWindowMaker::InitPackageTabControl()
   {
     /* This loop assumes responsibility for actual tab creation...
      */
-    tab.pszText = TabLegend[i];
+    tab.pszText = (char *)(TabLegend[i]);
     if( TabCtrl_InsertItem( PackageTabControl, i, &tab ) == -1 )
     {
       /* ...bailing out, and deleting the container window,
index 450cc75..24f760a 100644 (file)
@@ -73,7 +73,7 @@ void AppWindowMaker::InitPackageListView()
   /* Initialise the table layout, and assign column headings.
    */
   LVCOLUMN table;
-  struct { int id; int width; char *text; } headings[] =
+  struct { int id; int width; const char *text; } headings[] =
   {
     /* Specify the column headings for the package list table.
      */
@@ -96,7 +96,7 @@ void AppWindowMaker::InitPackageListView()
      * (in pixels), and assigning the heading to each.
      */
     table.cx = headings[index].width;
-    table.pszText = headings[index].text;
+    table.pszText = (char *)(headings[index].text);
     ListView_InsertColumn( PackageListView, index, &table );
   }
   /* "Update" the package list, to initialise the list view.
@@ -443,7 +443,7 @@ void pkgListViewMaker::Dispatch( pkgXmlNode *package )
       /* ...otherwise, simply insert an unclassified list entry
        * for the bare package name, omitting the component class.
        */
-      InsertItem( package, "" );
+      InsertItem( package, (char *)("") );
   }
   else if( package->IsElementOfType( component_key ) )
   {