Update taglib
This commit is contained in:
parent
2384a42d33
commit
3d13c12cb7
@ -339,7 +339,13 @@ UserTextIdentificationFrame::UserTextIdentificationFrame(const String &descripti
|
||||
|
||||
String UserTextIdentificationFrame::toString() const
|
||||
{
|
||||
return "[" + description() + "] " + fieldList().toString();
|
||||
// first entry is the description itself, drop from values list
|
||||
StringList l = fieldList();
|
||||
for(StringList::Iterator it = l.begin(); it != l.end(); ++it) {
|
||||
l.erase(it);
|
||||
break;
|
||||
}
|
||||
return "[" + description() + "] " + l.toString();
|
||||
}
|
||||
|
||||
String UserTextIdentificationFrame::description() const
|
||||
|
14
3rdparty/taglib/ogg/flac/oggflacfile.cpp
vendored
14
3rdparty/taglib/ogg/flac/oggflacfile.cpp
vendored
@ -231,11 +231,21 @@ void Ogg::FLAC::File::scan()
|
||||
|
||||
if(!metadataHeader.startsWith("fLaC")) {
|
||||
// FLAC 1.1.2+
|
||||
// See https://xiph.org/flac/ogg_mapping.html for the header specification.
|
||||
if(metadataHeader.size() < 13)
|
||||
return;
|
||||
|
||||
if(metadataHeader[0] != 0x7f)
|
||||
return;
|
||||
|
||||
if(metadataHeader.mid(1, 4) != "FLAC")
|
||||
return;
|
||||
|
||||
if(metadataHeader[5] != 1)
|
||||
return; // not version 1
|
||||
if(metadataHeader[5] != 1 && metadataHeader[6] != 0)
|
||||
return; // not version 1.0
|
||||
|
||||
if(metadataHeader.mid(9, 4) != "fLaC")
|
||||
return;
|
||||
|
||||
metadataHeader = metadataHeader.mid(13);
|
||||
}
|
||||
|
41
3rdparty/taglib/toolkit/tfilestream.cpp
vendored
41
3rdparty/taglib/toolkit/tfilestream.cpp
vendored
@ -58,6 +58,11 @@ namespace
|
||||
#endif
|
||||
}
|
||||
|
||||
FileHandle openFile(const int fileDescriptor, bool readOnly)
|
||||
{
|
||||
return InvalidFileHandle;
|
||||
}
|
||||
|
||||
void closeFile(FileHandle file)
|
||||
{
|
||||
CloseHandle(file);
|
||||
@ -98,6 +103,11 @@ namespace
|
||||
return fopen(path, readOnly ? "rb" : "rb+");
|
||||
}
|
||||
|
||||
FileHandle openFile(const int fileDescriptor, bool readOnly)
|
||||
{
|
||||
return fdopen(fileDescriptor, readOnly ? "rb" : "rb+");
|
||||
}
|
||||
|
||||
void closeFile(FileHandle file)
|
||||
{
|
||||
fclose(file);
|
||||
@ -149,13 +159,28 @@ FileStream::FileStream(FileName fileName, bool openReadOnly)
|
||||
d->file = openFile(fileName, true);
|
||||
|
||||
if(d->file == InvalidFileHandle)
|
||||
{
|
||||
# ifdef _WIN32
|
||||
debug("Could not open file " + fileName.toString());
|
||||
# else
|
||||
debug("Could not open file " + String(static_cast<const char *>(d->name)));
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
||||
FileStream::FileStream(int fileDescriptor, bool openReadOnly)
|
||||
: d(new FileStreamPrivate(""))
|
||||
{
|
||||
// First try with read / write mode, if that fails, fall back to read only.
|
||||
|
||||
if(!openReadOnly)
|
||||
d->file = openFile(fileDescriptor, false);
|
||||
|
||||
if(d->file != InvalidFileHandle)
|
||||
d->readOnly = false;
|
||||
else
|
||||
d->file = openFile(fileDescriptor, true);
|
||||
|
||||
if(d->file == InvalidFileHandle)
|
||||
debug("Could not open file using file descriptor");
|
||||
}
|
||||
|
||||
FileStream::~FileStream()
|
||||
@ -255,8 +280,7 @@ void FileStream::insert(const ByteVector &data, unsigned long start, unsigned lo
|
||||
ByteVector buffer = data;
|
||||
ByteVector aboutToOverwrite(static_cast<unsigned int>(bufferLength));
|
||||
|
||||
while(true)
|
||||
{
|
||||
while(true) {
|
||||
// Seek to the current read position and read the data that we're about
|
||||
// to overwrite. Appropriately increment the readPosition.
|
||||
|
||||
@ -304,8 +328,7 @@ void FileStream::removeBlock(unsigned long start, unsigned long length)
|
||||
|
||||
ByteVector buffer(static_cast<unsigned int>(bufferLength));
|
||||
|
||||
for(unsigned int bytesRead = -1; bytesRead != 0;)
|
||||
{
|
||||
for(unsigned int bytesRead = -1; bytesRead != 0;) {
|
||||
seek(readPosition);
|
||||
bytesRead = static_cast<unsigned int>(readFile(d->file, buffer));
|
||||
readPosition += bytesRead;
|
||||
@ -401,7 +424,8 @@ long FileStream::tell() const
|
||||
const LARGE_INTEGER zero = {};
|
||||
LARGE_INTEGER position;
|
||||
|
||||
if(SetFilePointerEx(d->file, zero, &position, FILE_CURRENT) && position.QuadPart <= LONG_MAX) {
|
||||
if(SetFilePointerEx(d->file, zero, &position, FILE_CURRENT) &&
|
||||
position.QuadPart <= LONG_MAX) {
|
||||
return static_cast<long>(position.QuadPart);
|
||||
}
|
||||
else {
|
||||
@ -470,9 +494,8 @@ void FileStream::truncate(long length)
|
||||
#else
|
||||
|
||||
const int error = ftruncate(fileno(d->file), length);
|
||||
if(error != 0) {
|
||||
if(error != 0)
|
||||
debug("FileStream::truncate() -- Coundn't truncate the file.");
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
5
3rdparty/taglib/toolkit/tfilestream.h
vendored
5
3rdparty/taglib/toolkit/tfilestream.h
vendored
@ -54,6 +54,11 @@ namespace TagLib {
|
||||
*/
|
||||
FileStream(FileName file, bool openReadOnly = false);
|
||||
|
||||
/*!
|
||||
* Construct a File object and opens the \a file using file descriptor.
|
||||
*/
|
||||
FileStream(int fileDescriptor, bool openReadOnly = false);
|
||||
|
||||
/*!
|
||||
* Destroys this FileStream instance.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user