fixed some warnings

This commit is contained in:
Martchus 2015-09-19 23:42:05 +02:00
parent 05aef3a831
commit e4a487cb73
3 changed files with 9 additions and 7 deletions

View File

@ -106,7 +106,7 @@ void EbmlElement::internalParse()
throw InvalidDataException();
}
// read size into buffer
*reinterpret_cast<dataSizeType *>(buf) = 0; // reset buffer
memset(buf, 0, sizeof(dataSizeType)); // reset buffer
reader().read(buf + (GenericFileElement<implementationType>::maximumSizeLengthSupported() - m_sizeLength), m_sizeLength);
*(buf + (GenericFileElement<implementationType>::maximumSizeLengthSupported() - m_sizeLength)) ^= mask; // xor the first byte in buffer which has been read from the file with mask
m_dataSize = ConversionUtilities::BE::toUInt64(buf);

View File

@ -133,21 +133,23 @@ void MediaFileInfo::parseContainerFormat()
m_containerOffset = 0;
// read signatrue
char buff[16];
const char *const buffEnd = buff + sizeof(buff), *buffOffset;
startParsingSignature:
if(size() - m_containerOffset >= 16) {
stream().seekg(m_containerOffset, ios_base::beg);
stream().read(buff, sizeof(buff));
// skip zero bytes/padding
if(!(*reinterpret_cast<uint32 *>(buff))) {
size_t bytesSkipped = 0;
for(buffOffset = buff; buffOffset != buffEnd && !(*buffOffset); ++buffOffset, ++bytesSkipped);
if(bytesSkipped >= 4) {
m_containerOffset += bytesSkipped;
// give up after 0x100 bytes
if(m_paddingSize >= 0x100u) {
if((m_paddingSize += bytesSkipped) >= 0x100u) {
m_containerParsed = true;
m_containerFormat = ContainerFormat::Unknown;
return;
}
m_containerOffset += sizeof(uint32); // set the container offset
m_paddingSize += sizeof(uint32);
goto startParsingSignature; // read signature again
goto startParsingSignature;
}
if(m_paddingSize) {
addNotification(NotificationType::Warning, ConversionUtilities::numberToString(m_paddingSize) + " zero-bytes skipped at the beginning of the file.", context);

View File

@ -19,7 +19,7 @@ const char *mpegChannelModeString(MpegChannelMode channelMode)
case MpegChannelMode::JointStereo: return "2 channels: joint stereo";
case MpegChannelMode::DualChannel: return "2 channels: dual channel";
case MpegChannelMode::SingleChannel: return "1 channel: single channel";
case MpegChannelMode::Unspecifed: return nullptr;
default: return nullptr;
}
}