@@ -476,7 +476,7 @@ bool File::loadFileAsData (MemoryBlock& destBlock) const | |||||
return false; | return false; | ||||
FileInputStream in (*this); | FileInputStream in (*this); | ||||
return in.openedOk() && getSize() == in.readIntoMemoryBlock (destBlock); | |||||
return in.openedOk() && getSize() == (int64) in.readIntoMemoryBlock (destBlock); | |||||
} | } | ||||
String File::loadFileAsString() const | String File::loadFileAsString() const | ||||
@@ -209,10 +209,10 @@ String InputStream::readNextLine() | |||||
return String::fromUTF8 (data, (int) i); | return String::fromUTF8 (data, (int) i); | ||||
} | } | ||||
int InputStream::readIntoMemoryBlock (MemoryBlock& block, ssize_t numBytes) | |||||
size_t InputStream::readIntoMemoryBlock (MemoryBlock& block, ssize_t numBytes) | |||||
{ | { | ||||
MemoryOutputStream mo (block, true); | MemoryOutputStream mo (block, true); | ||||
return mo.writeFromInputStream (*this, numBytes); | |||||
return (size_t) mo.writeFromInputStream (*this, numBytes); | |||||
} | } | ||||
String InputStream::readEntireStreamAsString() | String InputStream::readEntireStreamAsString() | ||||
@@ -211,7 +211,7 @@ public: | |||||
/** Tries to read the whole stream and turn it into a string. | /** Tries to read the whole stream and turn it into a string. | ||||
This will read from the stream's current position until the end-of-stream. | This will read from the stream's current position until the end-of-stream. | ||||
It can read from either UTF-16 or UTF-8 formats. | |||||
It can read from UTF-8 data, or UTF-16 if it detects suitable header-bytes. | |||||
*/ | */ | ||||
virtual String readEntireStreamAsString(); | virtual String readEntireStreamAsString(); | ||||
@@ -223,8 +223,8 @@ public: | |||||
will be read until the stream is exhausted. | will be read until the stream is exhausted. | ||||
@returns the number of bytes that were added to the memory block | @returns the number of bytes that were added to the memory block | ||||
*/ | */ | ||||
virtual int readIntoMemoryBlock (MemoryBlock& destBlock, | |||||
ssize_t maxNumBytesToRead = -1); | |||||
virtual size_t readIntoMemoryBlock (MemoryBlock& destBlock, | |||||
ssize_t maxNumBytesToRead = -1); | |||||
//============================================================================== | //============================================================================== | ||||
/** Returns the offset of the next byte that will be read from the stream. | /** Returns the offset of the next byte that will be read from the stream. | ||||
@@ -175,7 +175,7 @@ bool MemoryOutputStream::setPosition (int64 newPosition) | |||||
return false; | return false; | ||||
} | } | ||||
int MemoryOutputStream::writeFromInputStream (InputStream& source, int64 maxNumBytesToWrite) | |||||
int64 MemoryOutputStream::writeFromInputStream (InputStream& source, int64 maxNumBytesToWrite) | |||||
{ | { | ||||
// before writing from an input, see if we can preallocate to make it more efficient.. | // before writing from an input, see if we can preallocate to make it more efficient.. | ||||
int64 availableData = source.getTotalLength() - source.getPosition(); | int64 availableData = source.getTotalLength() - source.getPosition(); | ||||
@@ -116,7 +116,7 @@ public: | |||||
bool write (const void*, size_t) override; | bool write (const void*, size_t) override; | ||||
int64 getPosition() override { return (int64) position; } | int64 getPosition() override { return (int64) position; } | ||||
bool setPosition (int64) override; | bool setPosition (int64) override; | ||||
int writeFromInputStream (InputStream&, int64 maxNumBytesToWrite) override; | |||||
int64 writeFromInputStream (InputStream&, int64 maxNumBytesToWrite) override; | |||||
bool writeRepeatedByte (uint8 byte, size_t numTimesToRepeat) override; | bool writeRepeatedByte (uint8 byte, size_t numTimesToRepeat) override; | ||||
private: | private: | ||||
@@ -252,12 +252,12 @@ bool OutputStream::writeText (const String& text, const bool asUTF16, | |||||
return true; | return true; | ||||
} | } | ||||
int OutputStream::writeFromInputStream (InputStream& source, int64 numBytesToWrite) | |||||
int64 OutputStream::writeFromInputStream (InputStream& source, int64 numBytesToWrite) | |||||
{ | { | ||||
if (numBytesToWrite < 0) | if (numBytesToWrite < 0) | ||||
numBytesToWrite = std::numeric_limits<int64>::max(); | numBytesToWrite = std::numeric_limits<int64>::max(); | ||||
int numWritten = 0; | |||||
int64 numWritten = 0; | |||||
while (numBytesToWrite > 0) | while (numBytesToWrite > 0) | ||||
{ | { | ||||
@@ -221,7 +221,7 @@ public: | |||||
is exhausted) | is exhausted) | ||||
@returns the number of bytes written | @returns the number of bytes written | ||||
*/ | */ | ||||
virtual int writeFromInputStream (InputStream& source, int64 maxNumBytesToWrite); | |||||
virtual int64 writeFromInputStream (InputStream& source, int64 maxNumBytesToWrite); | |||||
//============================================================================== | //============================================================================== | ||||
/** Sets the string that will be written to the stream when the writeNewLine() | /** Sets the string that will be written to the stream when the writeNewLine() | ||||