Browse Source

Remove hsFileStream

It's unused windows-specific garbage.
Adam Johnson 12 years ago
parent
commit
c8419b0107
  1. 122
      Sources/Plasma/CoreLib/hsStream.cpp
  2. 22
      Sources/Plasma/CoreLib/hsStream.h

122
Sources/Plasma/CoreLib/hsStream.cpp

@ -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);
}
//////////////////////////////////////////////////////////////////////////////////////

22
Sources/Plasma/CoreLib/hsStream.h

@ -288,28 +288,6 @@ public:
virtual uint32_t GetStreamSize() = 0;
};
class hsFileStream: public hsStream
{
uint32_t fRef;
public:
hsFileStream();
virtual ~hsFileStream();
virtual bool Open(const char *name, const char *mode = "rb");
virtual bool Open(const wchar_t *name, const wchar_t *mode = L"rb");
virtual bool Close();
virtual bool AtEnd();
virtual uint32_t Read(uint32_t byteCount, void* buffer);
virtual uint32_t Write(uint32_t byteCount, const void* buffer);
virtual void Skip(uint32_t deltaByteCount);
virtual void Rewind();
virtual void Truncate();
virtual uint32_t GetFileRef();
virtual void SetFileRef(uint32_t refNum);
};
class hsUNIXStream: public hsStream
{
FILE* fRef;

Loading…
Cancel
Save