tags 564233 patch
thanks

Hi,

(this FTBFS everywhere /amd64 here/ with newer/stricter compiler)

Patch attached.
Rationale: there are two prototypes/overloads available:

const char * strchr ( const char * str, int character );
      char * strchr (       char * str, int character );

since your first argument given to strchr() in your code is const char * (that is 'cs'), the first function prototype matches which returns const char * and compiler rightfully complains because it is then assigned to char *.

alternative resolution would be to const_cast the first argument, so that the second prototype matches, which wold then return non-const.

--- src/DebugConsole.cpp.orig	2010-01-16 19:06:33.000000000 +0200
+++ src/DebugConsole.cpp	2010-01-16 19:06:38.000000000 +0200
@@ -119,7 +119,7 @@
 			if(!nc)return -1;
 			nl=lines_count(cs,lwidth);
 			// we count exactly the number of new entries needed in the arrays we have
-			if((s=strchr(cs,'\n'))!=NULL && s!=cs)nl+=(ccol+(s-cs-1))/lwidth;// single line with \n or multiline
+			if((s=const_cast<char*>(strchr(cs,'\n')))!=NULL && s!=cs)nl+=(ccol+(s-cs-1))/lwidth;// single line with \n or multiline
 			else nl+=(strlen(cs)+ccol)/lwidth;	// single line, with no terminators
 
 			/*

Reply via email to