[Scummvm-cvs-logs] CVS: scummvm/scumm script_v6.cpp,1.89,1.90

Max Horn max at quendi.de
Sun Apr 6 09:39:03 CEST 2003


Am Sonntag, 06.04.03 um 14:57 Uhr schrieb Nicolas Bacca:

> Update of /cvsroot/scummvm/scummvm/scumm
> In directory sc8-pr-cvs1:/tmp/cvs-serv10088
>
> Modified Files:
> 	script_v6.cpp
> Log Message:
> Alignment fix
>
> Index: script_v6.cpp
> ===================================================================
> RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
> retrieving revision 1.89
> retrieving revision 1.90
> diff -u -d -r1.89 -r1.90
> --- script_v6.cpp	1 Apr 2003 20:56:27 -0000	1.89
> +++ script_v6.cpp	6 Apr 2003 12:57:25 -0000	1.90
> @@ -423,9 +423,18 @@
>  	if (ah->type == 4) {
>  		ah->data[base] = value;
>  	} else if (_features & GF_AFTER_V8) {
> +#if defined(SCUMM_NEED_ALIGNMENT)
> +		memcpy(&ah->data[base], &TO_LE_32(value), 4);
> +#else
>  		((uint32 *)ah->data)[base] = TO_LE_32(value);
> +#endif
> +		
>  	} else {
> +#if defined(SCUMM_NEED_ALIGNMENT)
> +		memcpy(&ah->data[base], &TO_LE_16(value), 2);
> +#else
>  		((uint16 *)ah->data)[base] = TO_LE_16(value);
> +#endif
>  	}
>  }
Uhm, that code is not portable and won't work on big endian systems 
which need alignment, Nicolas. TO_LE_32 is a function on bigendian 
systems, and taking the address of that is certainly not what you want 
(in fact it generates a compiler error). You'll have to put the 
intermediate value into a variable before calling memcpy.

Now who the heck decided that all big endian system with SDL need 
SCUMM_NEED_ALIGNMENT ?!? *grmbl*



Max





More information about the Scummvm-git-logs mailing list