Control: tag -1 + patch
On Wed, Sep 07, 2016 at 01:18:06PM +0200, Andreas Beckmann wrote:
> exult FTBFS since the default compiler was switched to gcc-6 with lots
> of these errors:
>
> exulticon.h:271:2: error: narrowing conversion of '255' from 'int' to 'char'
> inside { } [-Wnarrowing]
The attached patch fix this (simply drop it in debian/patches).
If necessary I can NMU exult.
Regards,
Stephen
Description: Fix errors and some warnings with GCC 6
Author: Stephen Kitt
This patch fixes the following issues:
* in exulticon.h, the values don't fit in char (which is an error
now); use unsigned char instead;
* in vec.h, a number of method calls aren't scoped; use this->;
* declare const char * for pointers to constant strings.
--- a/exulticon.h
+++ b/exulticon.h
@@ -11,7 +11,7 @@
pixel[2] = header_data_cmap[(unsigned char)data[0]][2]; \
data ++; }
-static char header_data_cmap[256][3] = {
+static unsigned char header_data_cmap[256][3] = {
{ 0,128,128},
{ 34, 34, 34},
{ 0, 0, 0},
--- a/vec.h
+++ b/vec.h
@@ -33,7 +33,7 @@
Exult_vector() : baseClass()
{}
Exult_vector(size_type n) : baseClass()
- { reserve(n); }
+ { this->reserve(n); }
#ifndef MACOS /* should be something like PROPER_STD_CPP_LIB or so */
T& at(int i) { return (*this)[i]; }
@@ -42,8 +42,8 @@
{
if (i >= (int)this->size())
{
-insert(this->begin() + this->size(), i - this->size(), 0);
-push_back(v);
+this->insert(this->begin() + this->size(), i - this->size(), 0);
+this->push_back(v);
}
else
(*this)[i] = v;
@@ -69,7 +69,7 @@
size_type append( const T& obj )
{
- push_back( obj );
+ this->push_back( obj );
return this->size() - 1;
}
--- a/tools/textpack.cc
+++ b/tools/textpack.cc
@@ -85,7 +85,7 @@
static void Write_flex
(
const char *filename, // File to write.
- char *title, // For the header.
+ const char *title, // For the header.
vector& strings // Okay if some are null.
)
{
--- a/tools/ipack.cc
+++ b/tools/ipack.cc
@@ -136,7 +136,7 @@
static long Get_number
(
int linenum, // For printing errors.
- char *errmsg,
+ const char *errmsg,
char *ptr,
char *& endptr // ->past number and spaces returned.
)
--- a/gumps/Newfile_gump.cc
+++ b/gumps/Newfile_gump.cc
@@ -476,7 +476,7 @@
if (actual_game < -2 || actual_game >= num_games) return;
- char *text;
+ const char *text;
if (actual_game == -1)
text = "Quick Save";