1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-20 01:14:20 +00:00

New class: ScopedPointer, which auto-releases a pointer when it goes out of scope. I've used this extensively to replace a lot of pointer deletions with more RAII-style patterns.

This commit is contained in:
Julian Storer 2010-01-02 23:01:18 +00:00
parent 4ed1d791e5
commit c22c06c80c
126 changed files with 1454 additions and 1838 deletions

View file

@ -32,6 +32,7 @@ BEGIN_JUCE_NAMESPACE
#include "../io/files/juce_FileOutputStream.h"
#include "../io/files/juce_FileInputStream.h"
#include "../threads/juce_ScopedLock.h"
#include "../containers/juce_ScopedPointer.h"
#include "juce_SystemStats.h"
@ -64,7 +65,6 @@ FileLogger::FileLogger (const File& logFile_,
FileLogger::~FileLogger()
{
deleteAndZero (logStream);
}
//==============================================================================
@ -93,7 +93,7 @@ void FileLogger::trimFileSize (int maxFileSizeBytes) const
if (fileSize > maxFileSizeBytes)
{
FileInputStream* const in = logFile.createInputStream();
ScopedPointer <FileInputStream> in (logFile.createInputStream());
jassert (in != 0);
if (in != 0)
@ -107,7 +107,7 @@ void FileLogger::trimFileSize (int maxFileSizeBytes) const
contentToSave.fillWith (0);
in->read (contentToSave.getData(), maxFileSizeBytes);
delete in;
in = 0;
content = contentToSave.toString();
}