nsCRT::memcpy(buffer, *imageHandle, imageLength);
memcpy(buffer, *imageHandle, imageLength);
static nsresult encodeGWorld(GWorldPtr world, OSType type, nsIInputStream **result, PRInt32 *length){    nsresult rv = NS_ERROR_OUT_OF_MEMORY;    GraphicsExporter exporter(type);    if (exporter.valid()) {        Handle imageHandle = ::NewHandle(0);        if (imageHandle != NULL) {            if (exporter.setInputGWorld(world) == noErr &&                exporter.setOutputHandle(imageHandle) == noErr &&                exporter.doExport() == noErr) {                UInt32 imageLength = ::GetHandleSize(imageHandle);                char* buffer = (char*) nsMemory::Alloc(imageLength);                if (buffer != NULL) {                    nsCRT::memcpy(buffer, *imageHandle, imageLength);                    nsCOMPtr<nsIByteArrayInputStream> stream;                    rv = ::NS_NewByteArrayInputStream(getter_AddRefs(stream), buffer, imageLength);                    if (NS_SUCCEEDED(rv)) {                        *result = stream;                        NS_ADDREF(*result);                        *length = imageLength;                    } else {                        nsMemory::Free(buffer);                    }                }            }            ::DisposeHandle(imageHandle);        }    }    return rv;}