> Index: lib/framework/debug.c
> ===================================================================
> --- lib/framework/debug.c (revision 316)
> +++ lib/framework/debug.c (working copy)
> @@ -249,7 +249,7 @@
> }
>
>
> -void debug( code_part part, const char *str, ... )
> +int debug( code_part part, const char *str, ... )
> {
> va_list ap;
> static char inputBuffer[2][MAX_LEN_LOG_LINE];
> Index: lib/framework/debug.h
> ===================================================================
> --- lib/framework/debug.h (revision 316)
> +++ lib/framework/debug.h (working copy)
> @@ -157,7 +157,7 @@
> * \param part Code part to associate with this message
> * \param str printf style formatstring
> */
> -void debug( code_part part, const char *str, ...)
> +int debug( code_part part, const char *str, ...)
> wz__attribute((format (printf, 2, 3)) );
>
> #endif
I changed this because g++ complains about the ASSERT macro if debug
returns void. I guess the macro could also be fixed somehow, but this
was the easiest solution I found.
> Index: lib/script/stack.c
> ===================================================================
> --- lib/script/stack.c (revision 316)
> +++ lib/script/stack.c (working copy)
> @@ -501,8 +501,8 @@
> break;
> case OP_CANC: //String cancatenation
> {
> - char *tempstr1[MAXSTRLEN];
> - char *tempstr2[MAXSTRLEN];
> + char tempstr1[MAXSTRLEN];
> + char tempstr2[MAXSTRLEN];
>
> /* Check first value if it's compatible with Strings */
> if((psV1->type == VAL_INT) || (psV1->type == VAL_BOOL))
> //First value isn't string, but can be converted to string
Looks like a bug: char t[] is a char*, so the extra * is superfluous.
> Index: lib/script/script_parser.y
> ===================================================================
> --- lib/script/script_parser.y (revision 316)
> +++ lib/script/script_parser.y (working copy)
> @@ -4958,7 +4958,7 @@
>
> if(psStorage->storage == ST_LOCAL)
> {
> - if(scriptLookUpVariable(psVarIdent->pIdent, &ppsVarSym))
> + if(scriptLookUpVariable(psVarIdent->pIdent, ppsVarSym))
> {
> debug(LOG_ERROR, "var found");
> debug(LOG_ERROR, "var=%s, index=%d of %d",
> psVarIdent->pIdent, (*ppsVarSym)->index, psCurEvent->numParams);
Another bug: ppsVarSym is already a VAR_SYMBOL**, no need for the &.
> @@ -5540,7 +5540,7 @@
> {
> ASSERT( psTypeTab[i].typeID == type,
> "scriptSetTypeTab: ID's must be >= VAL_USERTYPESTART
> and sequential" );
> - type += 1;
> + type = type + 1;
> }
> #endif
>
> @@ -5583,7 +5583,7 @@
> {
> ASSERT( psCallTab[i].type == type,
> "scriptSetCallbackTab: ID's must be >=
> VAL_CALLBACKSTART and sequential" );
> - type += 1;
> + type = type + 1;
> }
> #endif
>
Since type is no built-in data type, g++ can't find an overloaded
operator+= for it.
> Index: src/effects.c
> ===================================================================
> --- src/effects.c (revision 316)
> +++ src/effects.c (working copy)
> @@ -3091,7 +3091,7 @@
> if(asEffectsList[i].imd)
> {
> /* Restore the pointer from the hashed ID */
> - endian_udword(&asEffectsList[i].imd);
> + endian_udword((UDWORD*)&asEffectsList[i].imd);
> asEffectsList[i].imd =
> (iIMDShape*)resGetDataFromHash("IMD",(UDWORD)asEffectsList[i].imd);
> }
> }
This was changed to fix some bug in r299. I put the cast outside this
time, and g++ compiles it without problems. Does this reintroduce the
original problem or is it OK this way?
As I said, this patch makes Warzone almost compile with g++. The only
file missing is src/scripttabs.c where some parts of those huge tables
are not casted to the right stuff or something. As g++ only spits out
the last line of each assignment (which is quite useless), I haven't
checked those yet.
--
Well, that's more-or-less what I was saying, though obviously addition
is a little more cosmic than the bitwise operators.
-- Larry Wall in <[EMAIL PROTECTED]>
_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev