|
|
|
@ -678,128 +678,6 @@ uint32_t hsStream::ReadLEAtom(uint32_t* sizePtr)
|
|
|
|
|
return tag; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#define kFileStream_Uninitialized ~0 |
|
|
|
|
|
|
|
|
|
bool hsFileStream::Open(const char *name, const char *mode) |
|
|
|
|
{ |
|
|
|
|
hsAssert(0, "hsFileStream::Open NotImplemented"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool hsFileStream::Open(const wchar_t *name, const wchar_t *mode) |
|
|
|
|
{ |
|
|
|
|
hsAssert(0, "hsFileStream::Open NotImplemented"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool hsFileStream::Close () |
|
|
|
|
{ |
|
|
|
|
hsAssert(0, "hsFileStream::Close NotImplemented"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
uint32_t hsFileStream::GetFileRef() |
|
|
|
|
{ |
|
|
|
|
return fRef; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void hsFileStream::SetFileRef(uint32_t ref) |
|
|
|
|
{ |
|
|
|
|
hsAssert(ref != kFileStream_Uninitialized, "bad ref"); |
|
|
|
|
fRef = ref; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
hsFileStream::hsFileStream() |
|
|
|
|
{ |
|
|
|
|
fRef = kFileStream_Uninitialized; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
hsFileStream::~hsFileStream() |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
uint32_t hsFileStream::Read(uint32_t bytes, void* buffer) |
|
|
|
|
{ |
|
|
|
|
hsAssert(fRef != kFileStream_Uninitialized, "fRef uninitialized"); |
|
|
|
|
|
|
|
|
|
fBytesRead += bytes; |
|
|
|
|
fPosition += bytes; |
|
|
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
|
uint32_t rBytes; |
|
|
|
|
ReadFile((HANDLE)fRef, buffer, bytes, (LPDWORD)&rBytes, nil); |
|
|
|
|
if(bytes == rBytes) |
|
|
|
|
return bytes; |
|
|
|
|
else |
|
|
|
|
return 0; |
|
|
|
|
#else |
|
|
|
|
return 0; |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
uint32_t hsFileStream::Write(uint32_t bytes, const void* buffer) |
|
|
|
|
{ |
|
|
|
|
hsAssert(fRef != kFileStream_Uninitialized, "fRef uninitialized"); |
|
|
|
|
|
|
|
|
|
fBytesRead += bytes; |
|
|
|
|
fPosition += bytes; |
|
|
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
|
uint32_t wBytes; |
|
|
|
|
WriteFile((HANDLE)fRef, buffer, bytes, (LPDWORD)&wBytes, nil); |
|
|
|
|
if(bytes == wBytes) |
|
|
|
|
return bytes; |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
char str[128]; |
|
|
|
|
sprintf(str, "hsFileStream::Write failed. err %d", GetLastError()); |
|
|
|
|
hsAssert(false, str); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|
return 0; |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool hsFileStream::AtEnd() |
|
|
|
|
{ |
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
|
uint32_t bytes; |
|
|
|
|
PeekNamedPipe((void*)fRef, nil, 0, nil, (LPDWORD)&bytes, nil); |
|
|
|
|
return bytes>0; |
|
|
|
|
#else |
|
|
|
|
hsAssert(0,"No hsStream::AtEnd() implemented for this stream class"); |
|
|
|
|
return false; |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void hsFileStream::Skip(uint32_t delta) |
|
|
|
|
{ |
|
|
|
|
fBytesRead += delta; |
|
|
|
|
fPosition += delta; |
|
|
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
|
hsDebugMessage("hsFileStream::Skip unimplemented", 0); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void hsFileStream::Rewind() |
|
|
|
|
{ |
|
|
|
|
fBytesRead = 0; |
|
|
|
|
fPosition = 0; |
|
|
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
|
hsDebugMessage("hsFileStream::Rewind unimplemented", 0); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void hsFileStream::Truncate() |
|
|
|
|
{ |
|
|
|
|
hsDebugMessage("hsFileStream::Truncate unimplemented", 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|