mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Apply smart pointers to MPC::File.
This commit is contained in:
parent
ff34e42aef
commit
6048cdef3e
@ -29,6 +29,7 @@
|
||||
#include <tdebug.h>
|
||||
#include <tpropertymap.h>
|
||||
#include <tagutils.h>
|
||||
#include <tsmartptr.h>
|
||||
|
||||
#include "mpcfile.h"
|
||||
#include "id3v1tag.h"
|
||||
@ -50,29 +51,21 @@ public:
|
||||
APELocation(-1),
|
||||
APESize(0),
|
||||
ID3v1Location(-1),
|
||||
ID3v2Header(0),
|
||||
ID3v2Location(-1),
|
||||
ID3v2Size(0),
|
||||
properties(0) {}
|
||||
|
||||
~FilePrivate()
|
||||
{
|
||||
delete ID3v2Header;
|
||||
delete properties;
|
||||
}
|
||||
ID3v2Size(0) {}
|
||||
|
||||
long long APELocation;
|
||||
long long APESize;
|
||||
|
||||
long long ID3v1Location;
|
||||
|
||||
ID3v2::Header *ID3v2Header;
|
||||
SCOPED_PTR<ID3v2::Header> ID3v2Header;
|
||||
long long ID3v2Location;
|
||||
long long ID3v2Size;
|
||||
|
||||
DoubleTagUnion tag;
|
||||
|
||||
AudioProperties *properties;
|
||||
SCOPED_PTR<AudioProperties> properties;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -128,7 +121,7 @@ PropertyMap MPC::File::setProperties(const PropertyMap &properties)
|
||||
|
||||
MPC::AudioProperties *MPC::File::audioProperties() const
|
||||
{
|
||||
return d->properties;
|
||||
return d->properties.get();
|
||||
}
|
||||
|
||||
bool MPC::File::save()
|
||||
@ -239,10 +232,8 @@ void MPC::File::strip(int tags)
|
||||
if(!ID3v1Tag())
|
||||
APETag(true);
|
||||
|
||||
if(tags & ID3v2) {
|
||||
delete d->ID3v2Header;
|
||||
d->ID3v2Header = 0;
|
||||
}
|
||||
if(tags & ID3v2)
|
||||
d->ID3v2Header.reset();
|
||||
}
|
||||
|
||||
void MPC::File::remove(int tags)
|
||||
@ -272,7 +263,7 @@ void MPC::File::read(bool readProperties)
|
||||
|
||||
if(d->ID3v2Location >= 0) {
|
||||
seek(d->ID3v2Location);
|
||||
d->ID3v2Header = new ID3v2::Header(readBlock(ID3v2::Header::size()));
|
||||
d->ID3v2Header.reset(new ID3v2::Header(readBlock(ID3v2::Header::size())));
|
||||
d->ID3v2Size = d->ID3v2Header->completeTagSize();
|
||||
}
|
||||
|
||||
@ -317,6 +308,6 @@ void MPC::File::read(bool readProperties)
|
||||
seek(0);
|
||||
}
|
||||
|
||||
d->properties = new AudioProperties(this, streamLength);
|
||||
d->properties.reset(new AudioProperties(this, streamLength));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user