mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
This commit is contained in:
parent
84da4b0622
commit
79940bf1a5
4 changed files with 21 additions and 28 deletions
|
|
@ -889,7 +889,7 @@ FileOutputStream* File::createOutputStream (const int bufferSize) const throw()
|
|||
{
|
||||
FileOutputStream* const out = new FileOutputStream (*this, bufferSize);
|
||||
|
||||
if (out->areAnyErrors())
|
||||
if (out->failedToOpen())
|
||||
{
|
||||
delete out;
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@ BEGIN_JUCE_NAMESPACE
|
|||
|
||||
|
||||
//==============================================================================
|
||||
void* juce_fileOpen (const String& path, bool forWriting);
|
||||
void juce_fileClose (void* handle);
|
||||
int juce_fileRead (void* handle, void* buffer, int size);
|
||||
int64 juce_fileSetPosition (void* handle, int64 pos);
|
||||
void* juce_fileOpen (const String& path, bool forWriting) throw();
|
||||
void juce_fileClose (void* handle) throw();
|
||||
int juce_fileRead (void* handle, void* buffer, int size) throw();
|
||||
int64 juce_fileSetPosition (void* handle, int64 pos) throw();
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -33,15 +33,14 @@
|
|||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
|
||||
#include "juce_FileOutputStream.h"
|
||||
|
||||
void* juce_fileOpen (const String& path, bool forWriting);
|
||||
void juce_fileClose (void* handle);
|
||||
int juce_fileWrite (void* handle, const void* buffer, int size);
|
||||
void juce_fileFlush (void* handle);
|
||||
int64 juce_fileGetPosition (void* handle);
|
||||
int64 juce_fileSetPosition (void* handle, int64 pos);
|
||||
void* juce_fileOpen (const String& path, bool forWriting) throw();
|
||||
void juce_fileClose (void* handle) throw();
|
||||
int juce_fileWrite (void* handle, const void* buffer, int size) throw();
|
||||
void juce_fileFlush (void* handle) throw();
|
||||
int64 juce_fileGetPosition (void* handle) throw();
|
||||
int64 juce_fileSetPosition (void* handle, int64 pos) throw();
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -65,7 +64,7 @@ FileOutputStream::FileOutputStream (const File& f,
|
|||
}
|
||||
}
|
||||
|
||||
buffer = (char*) juce_malloc (jmax (bufferSize_, 64));
|
||||
buffer = (char*) juce_malloc (jmax (bufferSize_, 16));
|
||||
}
|
||||
|
||||
FileOutputStream::~FileOutputStream()
|
||||
|
|
@ -76,16 +75,6 @@ FileOutputStream::~FileOutputStream()
|
|||
juce_free (buffer);
|
||||
}
|
||||
|
||||
const File FileOutputStream::getFile() const
|
||||
{
|
||||
return file;
|
||||
}
|
||||
|
||||
bool FileOutputStream::areAnyErrors()
|
||||
{
|
||||
return fileHandle == 0;
|
||||
}
|
||||
|
||||
int64 FileOutputStream::getPosition()
|
||||
{
|
||||
return currentPosition;
|
||||
|
|
@ -113,7 +102,7 @@ void FileOutputStream::flush()
|
|||
juce_fileFlush (fileHandle);
|
||||
}
|
||||
|
||||
bool FileOutputStream::write (const void* src, int numBytes)
|
||||
bool FileOutputStream::write (const void* const src, const int numBytes)
|
||||
{
|
||||
if (bytesInBuffer + numBytes < bufferSize)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public:
|
|||
/** Creates a FileOutputStream.
|
||||
|
||||
If the file doesn't exist, it will first be created. If the file can't be
|
||||
created or opened, the areAnyErrors() method will return
|
||||
created or opened, the failedToOpen() method will return
|
||||
true.
|
||||
|
||||
If the file already exists when opened, the stream's write-postion will
|
||||
|
|
@ -67,7 +67,13 @@ public:
|
|||
~FileOutputStream();
|
||||
|
||||
//==============================================================================
|
||||
const File getFile() const;
|
||||
/** Returns the file that this stream is writing to.
|
||||
*/
|
||||
const File& getFile() const throw() { return file; }
|
||||
|
||||
/** Returns true if the stream couldn't be opened for some reason.
|
||||
*/
|
||||
bool failedToOpen() const throw() { return fileHandle == 0; }
|
||||
|
||||
//==============================================================================
|
||||
void flush();
|
||||
|
|
@ -75,8 +81,6 @@ public:
|
|||
bool setPosition (int64 pos);
|
||||
bool write (const void* data, int numBytes);
|
||||
|
||||
bool areAnyErrors();
|
||||
|
||||
|
||||
//==============================================================================
|
||||
juce_UseDebuggingNewOperator
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue