mirror of https://github.com/PrimeDecomp/prime.git
Match COutputStream::DoPut (Thanks HeartPiece!)
Former-commit-id: 26d6394bb1
This commit is contained in:
parent
67fff47df5
commit
b08714313d
|
@ -883,7 +883,7 @@ LIBS = [
|
|||
"Runtime/e_pow",
|
||||
["Runtime/e_rem_pio2", True],
|
||||
["Runtime/k_cos", True],
|
||||
"Runtime/k_rem_pio2",
|
||||
["Runtime/k_rem_pio2", True],
|
||||
["Runtime/k_sin", True],
|
||||
["Runtime/k_tan", True],
|
||||
"Runtime/s_atan",
|
||||
|
|
|
@ -760,7 +760,7 @@ MSL_COMMON_MATH :=\
|
|||
$(BUILD_DIR)/asm/Runtime/e_pow.o\
|
||||
$(BUILD_DIR)/src/Runtime/e_rem_pio2.o\
|
||||
$(BUILD_DIR)/src/Runtime/k_cos.o\
|
||||
$(BUILD_DIR)/asm/Runtime/k_rem_pio2.o\
|
||||
$(BUILD_DIR)/src/Runtime/k_rem_pio2.o\
|
||||
$(BUILD_DIR)/src/Runtime/k_sin.o\
|
||||
$(BUILD_DIR)/src/Runtime/k_tan.o\
|
||||
$(BUILD_DIR)/asm/Runtime/s_atan.o\
|
||||
|
|
|
@ -21,28 +21,32 @@ COutputStream::~COutputStream() {
|
|||
}
|
||||
|
||||
void COutputStream::DoPut(const void* ptr, size_t len) {
|
||||
if (len == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
mNumWrites += len;
|
||||
if (mBufLen <= len + mUnwrittenLen) {
|
||||
memcpy((uchar*)mBufPtr + mUnwrittenLen, ptr, len);
|
||||
mUnwrittenLen += len;
|
||||
return;
|
||||
}
|
||||
while (len != 0) {
|
||||
uint count = mBufLen - mUnwrittenLen;
|
||||
uint offset = len;
|
||||
if (count < len) {
|
||||
len = count;
|
||||
uint offset;
|
||||
uchar* offsetPtr;
|
||||
uint tempLen = len;
|
||||
if (tempLen != 0) {
|
||||
mNumWrites += tempLen;
|
||||
if (tempLen + mUnwrittenLen <= mBufLen) {
|
||||
memcpy((uchar*)mBufPtr + mUnwrittenLen, ptr, tempLen);
|
||||
mUnwrittenLen += tempLen;
|
||||
return;
|
||||
}
|
||||
if (count != 0) {
|
||||
memcpy((uchar*)mBufPtr + mUnwrittenLen, (uchar*)ptr + offset, len);
|
||||
mUnwrittenLen += len;
|
||||
len -= len;
|
||||
} else {
|
||||
DoFlush();
|
||||
|
||||
offsetPtr = (uchar*)ptr + tempLen;
|
||||
while (tempLen != 0) {
|
||||
uint count = mBufLen - mUnwrittenLen;
|
||||
offset = count;
|
||||
if (tempLen < count) {
|
||||
offset = tempLen;
|
||||
}
|
||||
if (offset != 0) {
|
||||
memcpy((uchar*)mBufPtr + mUnwrittenLen, (offsetPtr - tempLen), offset);
|
||||
|
||||
tempLen -= offset;
|
||||
mUnwrittenLen += offset;
|
||||
} else {
|
||||
DoFlush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
*/
|
||||
|
||||
#include "fdlibm.h"
|
||||
|
||||
#ifdef __STDC__
|
||||
static const double
|
||||
#else
|
||||
|
|
Loading…
Reference in New Issue