[quake3-bugzilla] [Bug 5935] QVM memset and memcpy return NULL

bugzilla-daemon at icculus.org bugzilla-daemon at icculus.org
Mon Mar 2 21:26:11 EST 2015


https://bugzilla.icculus.org/show_bug.cgi?id=5935

Simon McVittie <smcv-ioquake3 at pseudorandom.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smcv-ioquake3 at pseudorandom.
                   |                            |co.uk

--- Comment #2 from Simon McVittie <smcv-ioquake3 at pseudorandom.co.uk> ---
Instead of changing the behaviour of syscalls -101 and -102, perhaps it would
be better to change their names to trap_memset0 and trap_memcpy0, and change
bg_lib.h like this?

// *_syscalls.asm --------------------------------------------------
// Like ISO C memset, but returns NULL instead of dest
equ trap_memset0 -101
// Like ISO C memcpy, but returns NULL instead of dest
equ trap_memcpy0 -102

// bg_lib.h --------------------------------------------------------
void *trap_memset0( void *dest, int c, size_t count );
void *trap_memcpy0( void *dest, const void *src, size_t count );

#define memset(dest, c, count) (trap_memset0(dest, c, count), dest)
#define memcpy(dest, src, count) (trap_memcpy0(dest, src, count), dest)

That way, any VMs compiled with an old bg_lib.h (mods are expected to supply
their own copy, right?) will get the result they expects, and any VMs compiled
with a new bg_lib.h (notably ioquake3's own game/cgame/ui) will get the result
*they* expect, consistent with what they'd get as native code.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/quake3-bugzilla/attachments/20150303/44840434/attachment.html>


More information about the quake3-bugzilla mailing list