19 Commits

Author SHA1 Message Date
Urs Fleisch
c840222a39 Version 1.13.1 2023-07-01 07:43:27 +02:00
Urs Fleisch
39e712796f ID3v2: Map "TSST" to "DISCSUBTITLE" property (#1087) (#1088) 2023-05-26 13:12:19 +02:00
Urs Fleisch
97203503b0 Do not miss frames when an extended header is present (#1081) 2023-03-18 08:08:37 +01:00
Urs Fleisch
e21640bf10 MP4: Detect atoms with invalid length or type (#1077) 2023-03-18 08:07:46 +01:00
Ziemowit Łąski
a31356e330 Update FindCppUnit.cmake (#1076)
* Update FindCppUnit.cmake

Require a more modern cppunit to fix tagib build breakage.

* Update FindCppUnit.cmake
2022-12-21 14:14:35 +01:00
Rosen Penev
9ef9514bfa clang: remove const return (#1074)
Found with readability-const-return-type

Signed-off-by: Rosen Penev <rosenp@gmail.com>

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-12-10 11:30:21 +01:00
dabrain34
967c0eefed cmake: generate pc files with the use of prefix (#1071) 2022-12-04 13:27:58 +01:00
Rosen Penev
abbf880872 clang-tidy: use member initializer
Found with cppcoreguidelines-prefer-member-initializer

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-11-28 07:04:42 +01:00
Rosen Penev
e49724ae5f clang-tidy: remove unused declaration
Found with bugprone-forward-declaration-namespace

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-11-28 07:04:42 +01:00
Rosen Penev
9427d8f3ba clang-tidy: use patentheses in macros
Found with bugprone-macro-parentheses

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-11-28 07:04:42 +01:00
Rosen Penev
f40290dcaf clang-tidy: don't assign in if
Found with bugprone-assignment-in-if-condition

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-11-28 07:04:42 +01:00
Rosen Penev
983a35f5ae clang-tidy: avoid C casting
Found with google-readability-casting

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-11-28 07:04:42 +01:00
Rosen Penev
4dc6bdcd28 clang-tidy: add ending namespace comments
Found with google-readability-namespace-comments

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-11-28 07:04:42 +01:00
Rosen Penev
c963d1189a clang-tidy: no else after return
Found with readability-else-after-return

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-11-27 06:35:33 +01:00
Rosen Penev
1ac61ffe19 clang-tidy: remove pointless return in void func
Found with readability-redundant-control-flow

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-11-27 06:35:33 +01:00
Rosen Penev
a564d743f8 clang-tidy: remove duplicate include
Found with readability-duplicate-include

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-11-27 06:35:33 +01:00
Rosen Penev
8c4d663393 clang-tidy: simplify booleans
Found with readability-simplify-boolean-expr

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-11-27 06:35:33 +01:00
Urs Fleisch
bc5e56d3eb Fix parsing of TXXX frame without description (#1069) 2022-11-21 21:42:01 +01:00
Ryan Schmidt
8aa7dd81d8 Fix macOS dylib install name to be absolute path
Closes #1065
2022-10-28 18:04:34 +02:00
167 changed files with 435 additions and 421 deletions

2
.gitignore vendored
View File

@@ -3,6 +3,7 @@ cmake_uninstall.cmake
Makefile
CTestTestfile.cmake
CMakeFiles/
CMakeLists.txt.user*
*.so
*.so.*
*.dylib
@@ -50,6 +51,7 @@ taglib.xcodeproj
CMakeScripts
/.clang-format
/compile_commands.json
/build/
.clangd
.cache
.idea

View File

@@ -93,7 +93,7 @@ endif()
# 3. If any interfaces have been added since the last public release, then increment age.
# 4. If any interfaces have been removed since the last public release, then set age to 0.
set(TAGLIB_SOVERSION_CURRENT 20)
set(TAGLIB_SOVERSION_REVISION 0)
set(TAGLIB_SOVERSION_REVISION 1)
set(TAGLIB_SOVERSION_AGE 19)
math(EXPR TAGLIB_SOVERSION_MAJOR "${TAGLIB_SOVERSION_CURRENT} - ${TAGLIB_SOVERSION_AGE}")

12
NEWS
View File

@@ -1,3 +1,15 @@
TagLib 1.13.1 (Jul 1, 2023)
===========================
* Fixed parsing of TXXX frames without description.
* Detect MP4 atoms with invalid length or type.
* Do not miss ID3v2 frames when an extended header is present.
* Use property "DISCSUBTITLE" for ID3v2 "TSST" frame.
* Build system improvements: Use absolute path for macOS dylib install name,
support --define-prefix when using pkg-config, fixed minimum required
CppUnit version.
* Code clean up using clang-tidy.
TagLib 1.13 (Oct 27, 2022)
==========================

View File

@@ -58,7 +58,7 @@ set_target_properties(tag_c PROPERTIES
VERSION 0.0.0
SOVERSION 0
DEFINE_SYMBOL MAKE_TAGLIB_C_LIB
INSTALL_NAME_DIR ${CMAKE_INSTALL_LIBDIR}
INSTALL_NAME_DIR ${CMAKE_INSTALL_FULL_LIBDIR}
)
install(TARGETS tag_c
FRAMEWORK DESTINATION ${FRAMEWORK_INSTALL_DIR}
@@ -69,7 +69,7 @@ install(TARGETS tag_c
)
if(NOT BUILD_FRAMEWORK)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib_c.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib_c.pc)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib_c.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib_c.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/taglib_c.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()

View File

@@ -1,12 +1,11 @@
prefix=${CMAKE_INSTALL_PREFIX}
exec_prefix=${CMAKE_INSTALL_PREFIX}
libdir=${CMAKE_INSTALL_FULL_LIBDIR}
includedir=${CMAKE_INSTALL_FULL_INCLUDEDIR}
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
Name: TagLib C Bindings
Description: Audio meta-data library (C bindings)
Requires: taglib
Version: ${TAGLIB_LIB_VERSION_STRING}
Libs: -L${CMAKE_INSTALL_FULL_LIBDIR} -ltag_c
Cflags: -I${CMAKE_INSTALL_FULL_INCLUDEDIR}/taglib
Version: @TAGLIB_LIB_VERSION_STRING@
Libs: -L${libdir} -ltag_c
Cflags: -I${includedir}/taglib

View File

@@ -8,7 +8,7 @@
include (MacroEnsureVersion)
if(NOT CPPUNIT_MIN_VERSION)
SET(CPPUNIT_MIN_VERSION 1.12.0)
SET(CPPUNIT_MIN_VERSION 1.14.0)
endif(NOT CPPUNIT_MIN_VERSION)
FIND_PROGRAM(CPPUNIT_CONFIG_EXECUTABLE cppunit-config )
@@ -56,7 +56,7 @@ IF(CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARIES)
macro_ensure_version( ${CPPUNIT_MIN_VERSION} ${CPPUNIT_INSTALLED_VERSION} CPPUNIT_INSTALLED_VERSION_OK )
IF(NOT CPPUNIT_INSTALLED_VERSION_OK)
MESSAGE ("** CppUnit version is too old: found ${CPPUNIT_INSTALLED_VERSION} installed, ${CPPUNIT_MIN_VERSION} or major is required")
MESSAGE ("** CppUnit version is too old: found ${CPPUNIT_INSTALLED_VERSION} installed, ${CPPUNIT_MIN_VERSION} or newer is required")
SET(CppUnit_FOUND FALSE)
ENDIF(NOT CPPUNIT_INSTALLED_VERSION_OK)

View File

@@ -1,7 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
Name: TagLib
Description: Audio meta-data library

View File

@@ -344,7 +344,7 @@ endif()
set_target_properties(tag PROPERTIES
VERSION ${TAGLIB_SOVERSION_MAJOR}.${TAGLIB_SOVERSION_MINOR}.${TAGLIB_SOVERSION_PATCH}
SOVERSION ${TAGLIB_SOVERSION_MAJOR}
INSTALL_NAME_DIR ${CMAKE_INSTALL_LIBDIR}
INSTALL_NAME_DIR ${CMAKE_INSTALL_FULL_LIBDIR}
DEFINE_SYMBOL MAKE_TAGLIB_LIB
LINK_INTERFACE_LIBRARIES ""
PUBLIC_HEADER "${tag_HDRS}"

View File

@@ -49,7 +49,7 @@ using namespace TagLib;
namespace
{
enum { ApeAPEIndex = 0, ApeID3v1Index = 1 };
}
} // namespace
class APE::File::FilePrivate
{

View File

@@ -229,7 +229,7 @@ namespace TagLib {
class FilePrivate;
FilePrivate *d;
};
}
}
} // namespace APE
} // namespace TagLib
#endif

View File

@@ -167,7 +167,7 @@ namespace TagLib {
FooterPrivate *d;
};
}
}
} // namespace APE
} // namespace TagLib
#endif

View File

@@ -257,7 +257,7 @@ void APE::Item::parse(const ByteVector &data)
const ByteVector value = data.mid(8 + d->key.size() + 1, valueLength);
setReadOnly(flags & 1);
setType(ItemTypes((flags >> 1) & 3));
setType(static_cast<ItemTypes>((flags >> 1) & 3));
if(Text == d->type)
d->text = StringList(ByteVectorList::split(value, '\0'), String::UTF8);

View File

@@ -31,9 +31,7 @@
#include "tstringlist.h"
namespace TagLib {
namespace APE {
//! An implementation of APE-items
/*!
@@ -215,10 +213,7 @@ namespace TagLib {
class ItemPrivate;
ItemPrivate *d;
};
}
}
} // namespace APE
} // namespace TagLib
#endif

View File

@@ -140,7 +140,7 @@ namespace
return header.toUShort(4, false);
}
}
} // namespace
void APE::Properties::read(File *file, long streamLength)
{

View File

@@ -137,7 +137,7 @@ namespace TagLib {
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
}
} // namespace APE
} // namespace TagLib
#endif

View File

@@ -202,7 +202,7 @@ namespace TagLib {
class TagPrivate;
TagPrivate *d;
};
}
}
} // namespace APE
} // namespace TagLib
#endif

View File

@@ -185,7 +185,7 @@ String ASF::Attribute::parse(ASF::File &f, int kind)
if(kind == 0) {
nameLength = readWORD(&f);
name = readString(&f, nameLength);
d->type = ASF::Attribute::AttributeTypes(readWORD(&f));
d->type = static_cast<ASF::Attribute::AttributeTypes>(readWORD(&f));
size = readWORD(&f);
}
// metadata & metadata library
@@ -197,7 +197,7 @@ String ASF::Attribute::parse(ASF::File &f, int kind)
}
d->stream = readWORD(&f);
nameLength = readWORD(&f);
d->type = ASF::Attribute::AttributeTypes(readWORD(&f));
d->type = static_cast<ASF::Attribute::AttributeTypes>(readWORD(&f));
size = readDWORD(&f);
name = readString(&f, nameLength);
}

View File

@@ -33,10 +33,8 @@
namespace TagLib
{
namespace ASF
{
class File;
class Picture;
@@ -201,8 +199,7 @@ namespace TagLib
class AttributePrivate;
AttributePrivate *d;
};
}
}
} // namespace ASF
} // namespace TagLib
#endif

View File

@@ -33,10 +33,8 @@
#include "asftag.h"
namespace TagLib {
//! An implementation of ASF (WMA) metadata
namespace ASF {
/*!
* This implements and provides an interface for ASF files to the
* TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing
@@ -130,9 +128,7 @@ namespace TagLib {
class FilePrivate;
FilePrivate *d;
};
}
}
} // namespace ASF
} // namespace TagLib
#endif

View File

@@ -172,7 +172,6 @@ void ASF::Picture::parse(const ByteVector& bytes)
d->picture = bytes.mid(pos, dataLen);
d->valid = true;
return;
}
ASF::Picture ASF::Picture::fromInvalid()

View File

@@ -216,7 +216,7 @@ namespace TagLib
class PicturePrivate;
PicturePrivate *d;
};
}
}
} // namespace ASF
} // namespace TagLib
#endif // ASFPICTURE_H

View File

@@ -31,9 +31,7 @@
#include "taglib_export.h"
namespace TagLib {
namespace ASF {
//! An implementation of ASF audio properties
class TAGLIB_EXPORT Properties : public AudioProperties
{
@@ -178,9 +176,6 @@ namespace TagLib {
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
}
} // namespace ASF
} // namespace TagLib
#endif

View File

@@ -206,6 +206,6 @@ namespace TagLib {
class TagPrivate;
TagPrivate *d;
};
}
}
} // namespace ASF
} // namespace TagLib
#endif

View File

@@ -95,9 +95,9 @@ namespace TagLib
return data;
}
}
}
}
} // namespace
} // namespace ASF
} // namespace TagLib
#endif

View File

@@ -122,6 +122,6 @@ namespace TagLib {
AudioPropertiesPrivate *d;
};
}
} // namespace TagLib
#endif

View File

@@ -337,7 +337,7 @@ namespace TagLib {
class FilePrivate;
FilePrivate *d;
};
}
}
} // namespace FLAC
} // namespace TagLib
#endif

View File

@@ -37,8 +37,8 @@ public:
};
FLAC::MetadataBlock::MetadataBlock()
: d(0)
{
d = 0;
}
FLAC::MetadataBlock::~MetadataBlock()

View File

@@ -31,9 +31,7 @@
#include "taglib_export.h"
namespace TagLib {
namespace FLAC {
class TAGLIB_EXPORT MetadataBlock
{
public:
@@ -67,9 +65,6 @@ namespace TagLib {
class MetadataBlockPrivate;
MetadataBlockPrivate *d;
};
}
}
} // namespace FLAC
} // namespace TagLib
#endif

View File

@@ -79,7 +79,7 @@ bool FLAC::Picture::parse(const ByteVector &data)
}
unsigned int pos = 0;
d->type = FLAC::Picture::Type(data.toUInt(pos));
d->type = static_cast<FLAC::Picture::Type>(data.toUInt(pos));
pos += 4;
unsigned int mimeTypeLength = data.toUInt(pos);
pos += 4;

View File

@@ -33,9 +33,7 @@
#include "flacmetadatablock.h"
namespace TagLib {
namespace FLAC {
class TAGLIB_EXPORT Picture : public MetadataBlock
{
public:
@@ -200,9 +198,6 @@ namespace TagLib {
};
typedef List<Picture> PictureList;
}
}
} // namespace FLAC
} // namespace TagLib
#endif

View File

@@ -142,7 +142,7 @@ namespace TagLib {
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
}
} // namespace FLAC
} // namespace TagLib
#endif

View File

@@ -32,9 +32,7 @@
#include "flacmetadatablock.h"
namespace TagLib {
namespace FLAC {
class TAGLIB_EXPORT UnknownMetadataBlock : public MetadataBlock
{
public:
@@ -73,9 +71,6 @@ namespace TagLib {
class UnknownMetadataBlockPrivate;
UnknownMetadataBlockPrivate *d;
};
}
}
} // namespace FLAC
} // namespace TagLib
#endif

View File

@@ -103,7 +103,7 @@ namespace TagLib {
class FilePrivate;
FilePrivate *d;
};
}
}
} // namespace IT
} // namespace TagLib
#endif

View File

@@ -101,7 +101,7 @@ namespace TagLib {
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
}
} // namespace IT
} // namespace TagLib
#endif

View File

@@ -34,9 +34,7 @@
#include "modproperties.h"
namespace TagLib {
namespace Mod {
class TAGLIB_EXPORT File : public TagLib::Mod::FileBase
{
public:
@@ -106,9 +104,6 @@ namespace TagLib {
class FilePrivate;
FilePrivate *d;
};
}
}
} // namespace Mod
} // namespace TagLib
#endif

View File

@@ -35,9 +35,7 @@
#include <algorithm>
namespace TagLib {
namespace Mod {
class TAGLIB_EXPORT FileBase : public TagLib::File
{
protected:
@@ -58,9 +56,6 @@ namespace TagLib {
bool readU16B(unsigned short &number);
bool readU32B(unsigned long &number);
};
}
}
} // namespace Mod
} // namespace TagLib
#endif

View File

@@ -30,9 +30,7 @@
#include "audioproperties.h"
namespace TagLib {
namespace Mod {
class TAGLIB_EXPORT Properties : public AudioProperties
{
public:
@@ -63,9 +61,6 @@ namespace TagLib {
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
}
} // namespace Mod
} // namespace TagLib
#endif

View File

@@ -29,9 +29,7 @@
#include "tag.h"
namespace TagLib {
namespace Mod {
/*!
* Tags for module files (Mod, S3M, IT, XM).
*
@@ -186,9 +184,6 @@ namespace TagLib {
class TagPrivate;
TagPrivate *d;
};
}
}
} // namespace Mod
} // namespace TagLib
#endif

View File

@@ -38,10 +38,10 @@ const char *const MP4::Atom::containers[11] = {
};
MP4::Atom::Atom(File *file)
: offset(file->tell())
{
children.setAutoDelete(true);
offset = file->tell();
ByteVector header = file->readBlock(8);
if(header.size() != 8) {
// The atom header must be 8 bytes long, otherwise there is either
@@ -73,7 +73,7 @@ MP4::Atom::Atom(File *file)
}
}
if(length < 8) {
if(length < 8 || length > file->length() - offset) {
debug("MP4: Invalid atom size");
length = 0;
file->seek(0, File::End);
@@ -81,6 +81,14 @@ MP4::Atom::Atom(File *file)
}
name = header.mid(4, 4);
for(int i = 0; i < 4; ++i) {
const char ch = name.at(i);
if((ch < ' ' || ch > '~') && ch != '\251') {
debug("MP4: Invalid atom type");
length = 0;
file->seek(0, File::End);
}
}
for(int i = 0; i < numContainers; i++) {
if(name == containers[i]) {

View File

@@ -34,9 +34,7 @@
#include "tlist.h"
namespace TagLib {
namespace MP4 {
class Atom;
typedef TagLib::List<Atom *> AtomList;
@@ -101,10 +99,8 @@ namespace TagLib {
AtomList path(const char *name1, const char *name2 = 0, const char *name3 = 0, const char *name4 = 0);
AtomList atoms;
};
}
}
} // namespace MP4
} // namespace TagLib
#endif

View File

@@ -32,9 +32,7 @@
#include "mp4atom.h"
namespace TagLib {
namespace MP4 {
class TAGLIB_EXPORT CoverArt
{
public:
@@ -76,9 +74,6 @@ namespace TagLib {
};
typedef List<CoverArt> CoverArtList;
}
}
} // namespace MP4
} // namespace TagLib
#endif

View File

@@ -33,10 +33,8 @@
#include "mp4tag.h"
namespace TagLib {
//! An implementation of MP4 (AAC, ALAC, ...) metadata
namespace MP4 {
class Atoms;
/*!
@@ -157,9 +155,6 @@ namespace TagLib {
class FilePrivate;
FilePrivate *d;
};
}
}
} // namespace MP4
} // namespace TagLib
#endif

View File

@@ -31,9 +31,7 @@
#include "taglib_export.h"
namespace TagLib {
namespace MP4 {
class TAGLIB_EXPORT Item
{
public:
@@ -85,9 +83,6 @@ namespace TagLib {
class ItemPrivate;
ItemPrivate *d;
};
}
}
} // namespace MP4
} // namespace TagLib
#endif

View File

@@ -30,9 +30,7 @@
#include "audioproperties.h"
namespace TagLib {
namespace MP4 {
class Atoms;
class File;
@@ -112,9 +110,6 @@ namespace TagLib {
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
}
} // namespace MP4
} // namespace TagLib
#endif

View File

@@ -144,7 +144,7 @@ MP4::Tag::parseData2(const MP4::Atom *atom, int expectedFlags, bool freeForm)
debug("MP4: Unexpected atom \"" + name + "\", expecting \"name\"");
return result;
}
result.append(AtomData(AtomDataType(flags), data.mid(pos + 12, length - 12)));
result.append(AtomData(static_cast<AtomDataType>(flags), data.mid(pos + 12, length - 12)));
}
else {
if(name != "data") {
@@ -152,7 +152,7 @@ MP4::Tag::parseData2(const MP4::Atom *atom, int expectedFlags, bool freeForm)
return result;
}
if(expectedFlags == -1 || flags == expectedFlags) {
result.append(AtomData(AtomDataType(flags), data.mid(pos + 16, length - 16)));
result.append(AtomData(static_cast<AtomDataType>(flags), data.mid(pos + 16, length - 16)));
}
}
pos += length;
@@ -316,7 +316,7 @@ MP4::Tag::parseCovr(const MP4::Atom *atom)
}
if(flags == TypeJPEG || flags == TypePNG || flags == TypeBMP ||
flags == TypeGIF || flags == TypeImplicit) {
value.append(MP4::CoverArt(MP4::CoverArt::Format(flags),
value.append(MP4::CoverArt(static_cast<MP4::CoverArt::Format>(flags),
data.mid(pos + 16, length - 16)));
}
else {

View File

@@ -36,9 +36,7 @@
#include "mp4item.h"
namespace TagLib {
namespace MP4 {
/*!
* \deprecated Use ItemMap.
*/
@@ -161,9 +159,6 @@ namespace TagLib {
class TagPrivate;
TagPrivate *d;
};
}
}
} // namespace MP4
} // namespace TagLib
#endif

View File

@@ -41,7 +41,7 @@ using namespace TagLib;
namespace
{
enum { MPCAPEIndex = 0, MPCID3v1Index = 1 };
}
} // namespace
class MPC::File::FilePrivate
{

View File

@@ -232,7 +232,7 @@ namespace TagLib {
class FilePrivate;
FilePrivate *d;
};
}
}
} // namespace MPC
} // namespace TagLib
#endif

View File

@@ -152,7 +152,7 @@ namespace TagLib {
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
}
} // namespace MPC
} // namespace TagLib
#endif

View File

@@ -60,7 +60,7 @@ namespace TagLib {
* will be returned.
*/
int TAGLIB_EXPORT genreIndex(const String &name);
}
}
} // namespace ID3v1
} // namespace TagLib
#endif

View File

@@ -36,7 +36,7 @@ namespace
{
const ID3v1::StringHandler defaultStringHandler;
const ID3v1::StringHandler *stringHandler = &defaultStringHandler;
}
} // namespace
class ID3v1::Tag::TagPrivate
{
@@ -112,9 +112,9 @@ ByteVector ID3v1::Tag::render() const
data.append(stringHandler->render(d->album).resize(30));
data.append(stringHandler->render(d->year).resize(4));
data.append(stringHandler->render(d->comment).resize(28));
data.append(char(0));
data.append(char(d->track));
data.append(char(d->genre));
data.append(static_cast<char>(0));
data.append(static_cast<char>(d->track));
data.append(static_cast<char>(d->genre));
return data;
}

View File

@@ -196,7 +196,7 @@ namespace TagLib {
class TagPrivate;
TagPrivate *d;
};
}
}
} // namespace ID3v1
} // namespace TagLib
#endif

View File

@@ -133,7 +133,7 @@ void AttachedPictureFrame::parseFields(const ByteVector &data)
return;
}
d->textEncoding = String::Type(data[0]);
d->textEncoding = static_cast<String::Type>(data[0]);
int pos = 1;
@@ -156,10 +156,10 @@ ByteVector AttachedPictureFrame::renderFields() const
String::Type encoding = checkTextEncoding(d->description, d->textEncoding);
data.append(char(encoding));
data.append(static_cast<char>(encoding));
data.append(d->mimeType.data(String::Latin1));
data.append(textDelimiter(String::Latin1));
data.append(char(d->type));
data.append(static_cast<char>(d->type));
data.append(d->description.data(encoding));
data.append(textDelimiter(encoding));
data.append(d->data);
@@ -189,7 +189,7 @@ void AttachedPictureFrameV22::parseFields(const ByteVector &data)
return;
}
d->textEncoding = String::Type(data[0]);
d->textEncoding = static_cast<String::Type>(data[0]);
int pos = 1;

View File

@@ -224,7 +224,7 @@ namespace TagLib {
AttachedPictureFrameV22(const ByteVector &data, Header *h);
friend class FrameFactory;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -124,7 +124,7 @@ void ChapterFrame::setElementID(const ByteVector &eID)
{
d->elementID = eID;
if(d->elementID.endsWith(char(0)))
if(d->elementID.endsWith(static_cast<char>(0)))
d->elementID = d->elementID.mid(0, d->elementID.size() - 1);
}

View File

@@ -243,7 +243,7 @@ namespace TagLib {
class ChapterFramePrivate;
ChapterFramePrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -150,7 +150,7 @@ void CommentsFrame::parseFields(const ByteVector &data)
return;
}
d->textEncoding = String::Type(data[0]);
d->textEncoding = static_cast<String::Type>(data[0]);
d->language = data.mid(1, 3);
int byteAlign = d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8 ? 1 : 2;
@@ -177,7 +177,7 @@ ByteVector CommentsFrame::renderFields() const
encoding = checkTextEncoding(d->description, encoding);
encoding = checkTextEncoding(d->text, encoding);
v.append(char(encoding));
v.append(static_cast<char>(encoding));
v.append(d->language.size() == 3 ? d->language : "XXX");
v.append(d->description.data(encoding));
v.append(textDelimiter(encoding));

View File

@@ -174,6 +174,6 @@ namespace TagLib {
CommentsFramePrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -104,7 +104,7 @@ void EventTimingCodesFrame::parseFields(const ByteVector &data)
return;
}
d->timestampFormat = TimestampFormat(data[0]);
d->timestampFormat = static_cast<TimestampFormat>(data[0]);
int pos = 1;
d->synchedEvents.clear();
@@ -120,12 +120,12 @@ ByteVector EventTimingCodesFrame::renderFields() const
{
ByteVector v;
v.append(char(d->timestampFormat));
v.append(static_cast<char>(d->timestampFormat));
for(SynchedEventList::ConstIterator it = d->synchedEvents.begin();
it != d->synchedEvents.end();
++it) {
const SynchedEvent &entry = *it;
v.append(char(entry.type));
v.append(static_cast<char>(entry.type));
v.append(ByteVector::fromUInt(entry.time));
}

View File

@@ -180,6 +180,6 @@ namespace TagLib {
EventTimingCodesFramePrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -142,7 +142,7 @@ void GeneralEncapsulatedObjectFrame::parseFields(const ByteVector &data)
return;
}
d->textEncoding = String::Type(data[0]);
d->textEncoding = static_cast<String::Type>(data[0]);
int pos = 1;
@@ -163,7 +163,7 @@ ByteVector GeneralEncapsulatedObjectFrame::renderFields() const
ByteVector data;
data.append(char(encoding));
data.append(static_cast<char>(encoding));
data.append(d->mimeType.data(String::Latin1));
data.append(textDelimiter(String::Latin1));
data.append(d->fileName.data(encoding));

View File

@@ -173,7 +173,7 @@ namespace TagLib {
class GeneralEncapsulatedObjectFramePrivate;
GeneralEncapsulatedObjectFramePrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -123,7 +123,7 @@ void OwnershipFrame::parseFields(const ByteVector &data)
}
// Get the text encoding
d->textEncoding = String::Type(data[0]);
d->textEncoding = static_cast<String::Type>(data[0]);
pos += 1;
// Read the price paid this is a null terminate string
@@ -155,7 +155,7 @@ ByteVector OwnershipFrame::renderFields() const
ByteVector v;
v.append(char(encoding));
v.append(static_cast<char>(encoding));
v.append(d->pricePaid.data(String::Latin1));
v.append(textDelimiter(String::Latin1));
v.append(d->datePurchased.data(String::Latin1));

View File

@@ -146,6 +146,6 @@ namespace TagLib {
OwnershipFramePrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -77,6 +77,6 @@ namespace TagLib {
PodcastFramePrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -102,7 +102,7 @@ void PopularimeterFrame::setCounter(unsigned int s)
void PopularimeterFrame::parseFields(const ByteVector &data)
{
int pos = 0, size = int(data.size());
int pos = 0, size = static_cast<int>(data.size());
d->email = readStringField(data, String::Latin1, &pos);
@@ -122,7 +122,7 @@ ByteVector PopularimeterFrame::renderFields() const
data.append(d->email.data(String::Latin1));
data.append(textDelimiter(String::Latin1));
data.append(char(d->rating));
data.append(static_cast<char>(d->rating));
data.append(ByteVector::fromUInt(d->counter));
return data;

View File

@@ -127,6 +127,6 @@ namespace TagLib {
PopularimeterFramePrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -106,6 +106,6 @@ namespace TagLib {
PrivateFramePrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -121,7 +121,7 @@ void RelativeVolumeFrame::setVolumeAdjustmentIndex(short index)
float RelativeVolumeFrame::volumeAdjustment(ChannelType type) const
{
return d->channels.contains(type) ? float(d->channels[type].volumeAdjustment) / float(512) : 0;
return d->channels.contains(type) ? static_cast<float>(d->channels[type].volumeAdjustment) / static_cast<float>(512) : 0;
}
float RelativeVolumeFrame::volumeAdjustment() const
@@ -131,7 +131,7 @@ float RelativeVolumeFrame::volumeAdjustment() const
void RelativeVolumeFrame::setVolumeAdjustment(float adjustment, ChannelType type)
{
d->channels[type].volumeAdjustment = short(adjustment * float(512));
d->channels[type].volumeAdjustment = static_cast<short>(adjustment * static_cast<float>(512));
}
void RelativeVolumeFrame::setVolumeAdjustment(float adjustment)
@@ -182,7 +182,7 @@ void RelativeVolumeFrame::parseFields(const ByteVector &data)
while(pos <= static_cast<int>(data.size()) - 4) {
ChannelType type = ChannelType(data[pos]);
ChannelType type = static_cast<ChannelType>(data[pos]);
pos += 1;
ChannelData &channel = d->channels[type];
@@ -212,9 +212,9 @@ ByteVector RelativeVolumeFrame::renderFields() const
ChannelType type = (*it).first;
const ChannelData &channel = (*it).second;
data.append(char(type));
data.append(static_cast<char>(type));
data.append(ByteVector::fromShort(channel.volumeAdjustment));
data.append(char(channel.peakVolume.bitsRepresentingPeak));
data.append(static_cast<char>(channel.peakVolume.bitsRepresentingPeak));
data.append(channel.peakVolume.peakVolume);
}

View File

@@ -269,6 +269,6 @@ namespace TagLib {
RelativeVolumeFramePrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -150,10 +150,10 @@ void SynchronizedLyricsFrame::parseFields(const ByteVector &data)
return;
}
d->textEncoding = String::Type(data[0]);
d->textEncoding = static_cast<String::Type>(data[0]);
d->language = data.mid(1, 3);
d->timestampFormat = TimestampFormat(data[4]);
d->type = Type(data[5]);
d->timestampFormat = static_cast<TimestampFormat>(data[4]);
d->type = static_cast<Type>(data[5]);
int pos = 6;
@@ -212,10 +212,10 @@ ByteVector SynchronizedLyricsFrame::renderFields() const
encoding = checkTextEncoding(it->text, encoding);
}
v.append(char(encoding));
v.append(static_cast<char>(encoding));
v.append(d->language.size() == 3 ? d->language : "XXX");
v.append(char(d->timestampFormat));
v.append(char(d->type));
v.append(static_cast<char>(d->timestampFormat));
v.append(static_cast<char>(d->type));
v.append(d->description.data(encoding));
v.append(textDelimiter(encoding));
for(SynchedTextList::ConstIterator it = d->synchedText.begin();

View File

@@ -226,6 +226,6 @@ namespace TagLib {
SynchronizedLyricsFramePrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -254,7 +254,7 @@ namespace TagLib {
class TableOfContentsFramePrivate;
TableOfContentsFramePrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -194,7 +194,7 @@ void TextIdentificationFrame::parseFields(const ByteVector &data)
// read the string data type (the first byte of the field data)
d->textEncoding = String::Type(data[0]);
d->textEncoding = static_cast<String::Type>(data[0]);
// split the byte array into chunks based on the string type (two byte delimiter
// for unicode encodings)
@@ -220,7 +220,7 @@ void TextIdentificationFrame::parseFields(const ByteVector &data)
unsigned short firstBom = 0;
for(ByteVectorList::ConstIterator it = l.begin(); it != l.end(); it++) {
if(!(*it).isEmpty()) {
if(!it->isEmpty() || (it == l.begin() && frameID() == "TXXX")) {
if(d->textEncoding == String::Latin1) {
d->fieldList.append(Tag::latin1StringHandler()->parse(*it));
}
@@ -254,7 +254,7 @@ ByteVector TextIdentificationFrame::renderFields() const
ByteVector v;
v.append(char(encoding));
v.append(static_cast<char>(encoding));
for(StringList::ConstIterator it = d->fieldList.begin(); it != d->fieldList.end(); it++) {

View File

@@ -308,6 +308,6 @@ namespace TagLib {
UserTextIdentificationFramePrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -134,7 +134,7 @@ ByteVector UniqueFileIdentifierFrame::renderFields() const
ByteVector data;
data.append(d->owner.data(String::Latin1));
data.append(char(0));
data.append(static_cast<char>(0));
data.append(d->identifier);
return data;

View File

@@ -117,7 +117,7 @@ namespace TagLib {
class UniqueFileIdentifierFramePrivate;
UniqueFileIdentifierFramePrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -74,6 +74,6 @@ namespace TagLib {
UnknownFramePrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -147,7 +147,7 @@ void UnsynchronizedLyricsFrame::parseFields(const ByteVector &data)
return;
}
d->textEncoding = String::Type(data[0]);
d->textEncoding = static_cast<String::Type>(data[0]);
d->language = data.mid(1, 3);
int byteAlign
@@ -177,7 +177,7 @@ ByteVector UnsynchronizedLyricsFrame::renderFields() const
ByteVector v;
v.append(char(encoding));
v.append(static_cast<char>(encoding));
v.append(d->language.size() == 3 ? d->language : "XXX");
v.append(d->description.data(encoding));
v.append(textDelimiter(encoding));

View File

@@ -174,6 +174,6 @@ namespace TagLib {
UnsynchronizedLyricsFramePrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -201,7 +201,7 @@ void UserUrlLinkFrame::parseFields(const ByteVector &data)
int pos = 0;
d->textEncoding = String::Type(data[0]);
d->textEncoding = static_cast<String::Type>(data[0]);
pos += 1;
if(d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8) {
@@ -230,7 +230,7 @@ ByteVector UserUrlLinkFrame::renderFields() const
String::Type encoding = checkTextEncoding(d->description, d->textEncoding);
v.append(char(encoding));
v.append(static_cast<char>(encoding));
v.append(d->description.data(encoding));
v.append(textDelimiter(encoding));
v.append(url().data(String::Latin1));

View File

@@ -185,6 +185,6 @@ namespace TagLib {
UserUrlLinkFramePrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -18,7 +18,7 @@ namespace TagLib {
v3 = 3, //<! ID3v2.3
v4 = 4 //<! ID3v2.4
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -88,6 +88,6 @@ namespace TagLib {
ExtendedHeaderPrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -77,6 +77,6 @@ namespace TagLib {
FooterPrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -373,6 +373,7 @@ namespace
std::make_pair("TSO2", "ALBUMARTISTSORT"), // non-standard, used by iTunes
std::make_pair("TSRC", "ISRC"),
std::make_pair("TSSE", "ENCODING"),
std::make_pair("TSST", "DISCSUBTITLE"),
// URL frames
std::make_pair("WCOP", "COPYRIGHTURL"),
std::make_pair("WOAF", "FILEWEBPAGE"),
@@ -815,7 +816,7 @@ bool Frame::Header::dataLengthIndicator() const
ByteVector Frame::Header::render() const
{
ByteVector flags(2, char(0)); // just blank for the moment
ByteVector flags(2, static_cast<char>(0)); // just blank for the moment
ByteVector v = d->frameID +
(d->version == 3

View File

@@ -517,7 +517,7 @@ namespace TagLib {
HeaderPrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -348,13 +348,13 @@ void FrameFactory::rebuildAggregateFrames(ID3v2::Tag *tag) const
tdat &&
tdat->data().size() >= 5)
{
String date(tdat->data().mid(1), String::Type(tdat->data()[0]));
String date(tdat->data().mid(1), static_cast<String::Type>(tdat->data()[0]));
if(date.length() == 4) {
tdrc->setText(tdrc->toString() + '-' + date.substr(2, 2) + '-' + date.substr(0, 2));
if(tag->frameList("TIME").size() == 1) {
UnknownFrame *timeframe = dynamic_cast<UnknownFrame *>(tag->frameList("TIME").front());
if(timeframe && timeframe->data().size() >= 5) {
String time(timeframe->data().mid(1), String::Type(timeframe->data()[0]));
String time(timeframe->data().mid(1), static_cast<String::Type>(timeframe->data()[0]));
if(time.length() == 4) {
tdrc->setText(tdrc->toString() + 'T' + time.substr(0, 2) + ':' + time.substr(2, 2));
}

View File

@@ -163,7 +163,7 @@ namespace TagLib {
FrameFactoryPrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -160,8 +160,8 @@ ByteVector Header::render() const
// add the version number -- we always render a 2.4.0 tag regardless of what
// the tag originally was.
v.append(char(majorVersion()));
v.append(char(0));
v.append(static_cast<char>(majorVersion()));
v.append(static_cast<char>(0));
// Currently we don't actually support writing extended headers, footers or
// unsynchronized tags, make sure that the flags are set accordingly.
@@ -178,7 +178,7 @@ ByteVector Header::render() const
flags[5] = d->experimentalIndicator;
flags[4] = d->footerPresent;
v.append(char(flags.to_ulong()));
v.append(static_cast<char>(flags.to_ulong()));
// add the size
v.append(SynchData::fromUInt(d->tagSize));

View File

@@ -170,7 +170,7 @@ namespace TagLib {
HeaderPrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -62,9 +62,9 @@ namespace TagLib {
* Convert the data from unsynchronized data to its original format.
*/
TAGLIB_EXPORT ByteVector decode(const ByteVector &input);
}
} // namespace SynchData
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -186,9 +186,13 @@ String ID3v2::Tag::genre() const
// the behavior the same as released versions it is being left with " ".
const FrameList &tconFrames = d->frameListMap["TCON"];
TextIdentificationFrame *f;
if(tconFrames.isEmpty() ||
!(f = dynamic_cast<TextIdentificationFrame *>(tconFrames.front())))
if(tconFrames.isEmpty())
{
return String();
}
TextIdentificationFrame *f = dynamic_cast<TextIdentificationFrame *>(tconFrames.front());
if(!f)
{
return String();
}
@@ -780,7 +784,6 @@ void ID3v2::Tag::parse(const ByteVector &origData)
d->extendedHeader->setData(data);
if(d->extendedHeader->size() <= data.size()) {
frameDataPosition += d->extendedHeader->size();
frameDataLength -= d->extendedHeader->size();
}
}

View File

@@ -405,7 +405,7 @@ namespace TagLib {
TagPrivate *d;
};
}
}
} // namespace ID3v2
} // namespace TagLib
#endif

View File

@@ -42,7 +42,7 @@ using namespace TagLib;
namespace
{
enum { ID3v2Index = 0, APEIndex = 1, ID3v1Index = 2 };
}
} // namespace
class MPEG::File::FilePrivate
{
@@ -237,10 +237,10 @@ bool MPEG::File::save(int tags, StripTags strip, ID3v2::Version version, Duplica
// Copy the values from the tag that does exist into the new tag,
// except if the existing tag is to be stripped.
if((tags & ID3v2) && ID3v1Tag() && !(strip == StripOthers && !(tags & ID3v1)))
if((tags & ID3v2) && ID3v1Tag() && (strip != StripOthers || (tags & ID3v1)))
Tag::duplicate(ID3v1Tag(), ID3v2Tag(true), false);
if((tags & ID3v1) && d->tag[ID3v2Index] && !(strip == StripOthers && !(tags & ID3v2)))
if((tags & ID3v1) && d->tag[ID3v2Index] && (strip != StripOthers || (tags & ID3v2)))
Tag::duplicate(ID3v2Tag(), ID3v1Tag(true), false);
}

View File

@@ -381,7 +381,7 @@ namespace TagLib {
class FilePrivate;
FilePrivate *d;
};
}
}
} // namespace MPEG
} // namespace TagLib
#endif

View File

@@ -172,7 +172,7 @@ namespace TagLib {
class HeaderPrivate;
HeaderPrivate *d;
};
}
}
} // namespace MPEG
} // namespace TagLib
#endif

View File

@@ -146,7 +146,7 @@ namespace TagLib {
class PropertiesPrivate;
PropertiesPrivate *d;
};
}
}
} // namespace MPEG
} // namespace TagLib
#endif

View File

@@ -54,9 +54,9 @@ namespace TagLib
return (b1 == 0xFF && b2 != 0xFF && (b2 & 0xE0) == 0xE0);
}
}
}
}
} // namespace
} // namespace MPEG
} // namespace TagLib
#endif

View File

@@ -123,7 +123,7 @@ namespace TagLib {
class XingHeaderPrivate;
XingHeaderPrivate *d;
};
}
}
} // namespace MPEG
} // namespace TagLib
#endif

Some files were not shown because too many files have changed in this diff Show More