mirror of
https://github.com/taglib/taglib.git
synced 2026-11-18 20:38:57 -05:00
Fix sign-compare warnings when building for 32-bit
This commit is contained in:
@@ -53,7 +53,7 @@ void EBML::BinaryElement::setValue(const ByteVector& val)
|
||||
bool EBML::BinaryElement::read(File &file)
|
||||
{
|
||||
value = file.readBlock(dataSize);
|
||||
if(value.size() != dataSize) {
|
||||
if(static_cast<offset_t>(value.size()) != dataSize) {
|
||||
debug("Failed to read binary element");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ void EBML::FloatElement::setValue(FloatVariantType val)
|
||||
bool EBML::FloatElement::read(File &file)
|
||||
{
|
||||
const ByteVector buffer = file.readBlock(dataSize);
|
||||
if(buffer.size() != dataSize) {
|
||||
if(static_cast<offset_t>(buffer.size()) != dataSize) {
|
||||
debug("Failed to read EBML Float element");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ ByteVector EBML::MasterElement::render()
|
||||
buffer.append(data);
|
||||
if(minRenderSize) {
|
||||
if(const auto bufferSize = buffer.size();
|
||||
minRenderSize >= bufferSize + MIN_VOID_ELEMENT_SIZE)
|
||||
minRenderSize >= static_cast<offset_t>(bufferSize + MIN_VOID_ELEMENT_SIZE))
|
||||
buffer.append(VoidElement::renderSize(minRenderSize - bufferSize));
|
||||
}
|
||||
return buffer;
|
||||
|
||||
@@ -46,7 +46,7 @@ void EBML::StringElement::setValue(const String& val)
|
||||
bool EBML::StringElement::read(File &file)
|
||||
{
|
||||
ByteVector buffer = file.readBlock(dataSize);
|
||||
if(buffer.size() != dataSize) {
|
||||
if(static_cast<offset_t>(buffer.size()) != dataSize) {
|
||||
debug("Failed to read string");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ void EBML::UIntElement::setValue(unsigned long long val)
|
||||
bool EBML::UIntElement::read(File &file)
|
||||
{
|
||||
const ByteVector buffer = file.readBlock(dataSize);
|
||||
if(buffer.size() != dataSize) {
|
||||
if(static_cast<offset_t>(buffer.size()) != dataSize) {
|
||||
debug("Failed to read EBML Uint element");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -129,9 +129,9 @@ bool Matroska::Element::render()
|
||||
const auto beforeSize = sizeRenderedOrWritten();
|
||||
const auto data = renderInternal();
|
||||
setNeedsRender(false);
|
||||
if(const auto afterSize = data.size(); afterSize != beforeSize) {
|
||||
if(const auto afterSize = data.size(); static_cast<offset_t>(afterSize) != beforeSize) {
|
||||
if(e->writeStyle == WriteStyle::AvoidInsert && !e->isLastElement
|
||||
&& afterSize > beforeSize && beforeSize > 0) {
|
||||
&& static_cast<offset_t>(afterSize) > beforeSize && beforeSize > 0) {
|
||||
// Record old slot for void-overwrite, move element to end of segment.
|
||||
e->voidAtOffset = e->offset;
|
||||
e->voidAtSize = beforeSize;
|
||||
|
||||
@@ -44,7 +44,7 @@ bool Matroska::Segment::render()
|
||||
const auto beforeSize = sizeLength;
|
||||
auto data = renderInternal();
|
||||
setNeedsRender(false);
|
||||
if(auto afterSize = data.size(); afterSize != beforeSize) {
|
||||
if(auto afterSize = data.size(); static_cast<offset_t>(afterSize) != beforeSize) {
|
||||
sizeLength = 8;
|
||||
data = renderInternal();
|
||||
setNeedsRender(false);
|
||||
|
||||
@@ -905,7 +905,7 @@ namespace
|
||||
if(chunkOffsets.empty())
|
||||
return {};
|
||||
// Sample count cannot be > file length / 4 as every sample consumes 4 bytes in stsz
|
||||
if(sizeInfo.sampleCount == 0 || sizeInfo.sampleCount > file->length() / 4)
|
||||
if(sizeInfo.sampleCount == 0 || static_cast<offset_t>(sizeInfo.sampleCount) > file->length() / 4)
|
||||
return {};
|
||||
|
||||
// Read stsc entries
|
||||
@@ -1052,7 +1052,7 @@ namespace
|
||||
const unsigned int trakSize = file->readBlock(4).toUInt();
|
||||
if(static_cast<offset_t>(trefSize) != trefLen
|
||||
|| static_cast<offset_t>(trakSize) != audioTrak->length()
|
||||
|| trefSize < cutLen || trakSize < cutLen)
|
||||
|| static_cast<offset_t>(trefSize) < cutLen || static_cast<offset_t>(trakSize) < cutLen)
|
||||
return;
|
||||
|
||||
file->removeBlock(cutOff, cutLen);
|
||||
|
||||
@@ -73,7 +73,7 @@ ByteVector ByteVectorStream::readBlock(size_t length)
|
||||
void ByteVectorStream::writeBlock(const ByteVector &data)
|
||||
{
|
||||
unsigned int size = data.size();
|
||||
if(d->position + size > length()) {
|
||||
if(static_cast<offset_t>(d->position + size) > length()) {
|
||||
truncate(d->position + size);
|
||||
}
|
||||
memcpy(d->data.data() + d->position, data.data(), size);
|
||||
|
||||
Reference in New Issue
Block a user