[Libreoffice-commits] libcdr.git: src/lib

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Mar 29 09:54:38 UTC 2021


 src/lib/CDRParser.cpp    |   10 +++++-----
 src/lib/CMXParser.cpp    |   18 +++++++++---------
 src/lib/libcdr_utils.cpp |   16 ++++++++--------
 3 files changed, 22 insertions(+), 22 deletions(-)

New commits:
commit 65a34c0b3fc58d8d7e209ad71af84a03802ab579
Author:     Fridrich Štrba <fridrich.strba at bluewin.ch>
AuthorDate: Mon Mar 29 11:53:16 2021 +0200
Commit:     Fridrich Štrba <fridrich.strba at bluewin.ch>
CommitDate: Mon Mar 29 11:53:16 2021 +0200

    debug build with maximum werror
    
    Change-Id: I09a451d7841ef049bbefb399a7319df4167952b0

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 1488a13..68f0ab8 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -2211,7 +2211,7 @@ void libcdr::CDRParser::readStlt(librevenge::RVNGInputStream *input, unsigned le
     const unsigned fillSize = 3 * 4 + (m_version >= 1300 ? 48 : 0);
     if (numFills > getRemainingLength(input) / fillSize)
       numFills = getRemainingLength(input) / fillSize;
-    CDR_DEBUG_MSG(("CDRParser::readStlt numFills 0x%x\n", numFills));
+    CDR_DEBUG_MSG(("CDRParser::readStlt numFills 0x%lx\n", numFills));
     std::map<unsigned, unsigned> fillIds;
     for (unsigned long i=0; i<numFills; ++i)
     {
@@ -2224,7 +2224,7 @@ void libcdr::CDRParser::readStlt(librevenge::RVNGInputStream *input, unsigned le
     unsigned long numOutls = readU32(input);
     if (numOutls > getRemainingLength(input) / 12)
       numOutls = getRemainingLength(input) / 12;
-    CDR_DEBUG_MSG(("CDRParser::readStlt numOutls 0x%x\n", numOutls));
+    CDR_DEBUG_MSG(("CDRParser::readStlt numOutls 0x%lx\n", numOutls));
     std::map<unsigned, unsigned> outlIds;
     for (unsigned long i=0; i<numOutls; ++i)
     {
@@ -2236,7 +2236,7 @@ void libcdr::CDRParser::readStlt(librevenge::RVNGInputStream *input, unsigned le
     const unsigned fontsSize = 4 + 2 * 2 + 8 + (m_precision == PRECISION_16BIT ? 2 : 4) + 2 * (m_version < 1000 ? 12 : 20);
     if (numFonts > getRemainingLength(input) / fontsSize)
       numFonts = getRemainingLength(input) / fontsSize;
-    CDR_DEBUG_MSG(("CDRParser::readStlt numFonts 0x%x\n", numFonts));
+    CDR_DEBUG_MSG(("CDRParser::readStlt numFonts 0x%lx\n", numFonts));
     std::map<unsigned,unsigned short> fontIds, fontEncodings;
     std::map<unsigned,double> fontSizes;
     for (unsigned long i=0; i<numFonts; ++i)
@@ -2259,7 +2259,7 @@ void libcdr::CDRParser::readStlt(librevenge::RVNGInputStream *input, unsigned le
     if (numAligns > getRemainingLength(input) / 12)
       numAligns = getRemainingLength(input) / 12;
     std::map<unsigned,unsigned> aligns;
-    CDR_DEBUG_MSG(("CDRParser::readStlt numAligns 0x%x\n", numAligns));
+    CDR_DEBUG_MSG(("CDRParser::readStlt numAligns 0x%lx\n", numAligns));
     for (unsigned long i=0; i<numAligns; ++i)
     {
       unsigned alignId = readU32(input);
@@ -2304,7 +2304,7 @@ void libcdr::CDRParser::readStlt(librevenge::RVNGInputStream *input, unsigned le
     if (numIndents > getRemainingLength(input) / indentSize)
       numIndents = getRemainingLength(input) / indentSize;
     std::map<unsigned, double> rightIndents, firstIndents, leftIndents;
-    CDR_DEBUG_MSG(("CDRParser::readStlt numIndents 0x%x\n", numIndents));
+    CDR_DEBUG_MSG(("CDRParser::readStlt numIndents 0x%lx\n", numIndents));
     for (unsigned long i=0; i<numIndents; ++i)
     {
       unsigned indentId = readU32(input);
diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index f87bb91..72b840b 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -122,7 +122,7 @@ bool libcdr::CMXParser::parseRecord(librevenge::RVNGInputStream *input, unsigned
       length = maxLength;
     long endPosition = input->tell() + length;
 
-    CDR_DEBUG_MSG(("Record: level %u %s, length: 0x%.8x (%u)\n", level, toFourCC(fourCC), length, length));
+    CDR_DEBUG_MSG(("Record: level %u %s, length: 0x%.8lx (%lu)\n", level, toFourCC(fourCC), length, length));
 
     if (fourCC == CDR_FOURCC_RIFF || fourCC == CDR_FOURCC_RIFX || fourCC == CDR_FOURCC_LIST)
     {
@@ -1689,7 +1689,7 @@ void libcdr::CMXParser::readRclr(librevenge::RVNGInputStream *input)
   /* unsigned length = */ readU32(input, m_bigEndian);
 
   unsigned long numRecords = readU16(input, m_bigEndian);
-  CDR_DEBUG_MSG(("CMXParser::readRclr - numRecords %i\n", numRecords));
+  CDR_DEBUG_MSG(("CMXParser::readRclr - numRecords %li\n", numRecords));
   sanitizeNumRecords(numRecords, m_precision, 2, 2 + 0, 2, getRemainingLength(input));
   for (unsigned j = 1; j <= numRecords; ++j)
   {
@@ -1740,7 +1740,7 @@ void libcdr::CMXParser::readRdot(librevenge::RVNGInputStream *input)
   /* unsigned length = */ readU32(input, m_bigEndian);
 
   unsigned long numRecords = readU16(input, m_bigEndian);
-  CDR_DEBUG_MSG(("CMXParser::readRdot - numRecords %i\n", numRecords));
+  CDR_DEBUG_MSG(("CMXParser::readRdot - numRecords %li\n", numRecords));
   sanitizeNumRecords(numRecords, m_precision, 2, 2, 1, getRemainingLength(input));
   for (unsigned j = 1; j <= numRecords; ++j)
   {
@@ -1795,7 +1795,7 @@ void libcdr::CMXParser::readRott(librevenge::RVNGInputStream *input)
   /* unsigned length = */ readU32(input, m_bigEndian);
 
   unsigned long numRecords = readU16(input, m_bigEndian);
-  CDR_DEBUG_MSG(("CMXParser::readRott - numRecords %i\n", numRecords));
+  CDR_DEBUG_MSG(("CMXParser::readRott - numRecords %li\n", numRecords));
   sanitizeNumRecords(numRecords, m_precision, 2, 2, 1, getRemainingLength(input));
   for (unsigned j = 1; j <= numRecords; ++j)
   {
@@ -1844,7 +1844,7 @@ void libcdr::CMXParser::readRotl(librevenge::RVNGInputStream *input)
   /* unsigned length = */ readU32(input, m_bigEndian);
 
   unsigned long numRecords = readU16(input, m_bigEndian);
-  CDR_DEBUG_MSG(("CMXParser::readRotl - numRecords %i\n", numRecords));
+  CDR_DEBUG_MSG(("CMXParser::readRotl - numRecords %li\n", numRecords));
   sanitizeNumRecords(numRecords, m_precision, 12, 12, 1, getRemainingLength(input));
   for (unsigned j = 1; j <= numRecords; ++j)
   {
@@ -1901,7 +1901,7 @@ void libcdr::CMXParser::readRpen(librevenge::RVNGInputStream *input)
   /* unsigned length = */ readU32(input, m_bigEndian);
 
   unsigned long numRecords = readU16(input, m_bigEndian);
-  CDR_DEBUG_MSG(("CMXParser::readRpen - numRecords %i\n", numRecords));
+  CDR_DEBUG_MSG(("CMXParser::readRpen - numRecords %li\n", numRecords));
   sanitizeNumRecords(numRecords, m_precision, 10, 12, 1, getRemainingLength(input));
   for (unsigned j = 1; j <= numRecords; ++j)
   {
@@ -1955,7 +1955,7 @@ void libcdr::CMXParser::readIxtl(librevenge::RVNGInputStream *input)
   /* unsigned length = */ readU32(input, m_bigEndian);
 
   unsigned long numRecords = readU16(input, m_bigEndian);
-  CDR_DEBUG_MSG(("CMXParser::readIxtl - numRecords %i\n", numRecords));
+  CDR_DEBUG_MSG(("CMXParser::readIxtl - numRecords %li\n", numRecords));
   int sizeInFile(0);
   if (m_precision == libcdr::PRECISION_32BIT)
   {
@@ -2000,7 +2000,7 @@ void libcdr::CMXParser::readIxef(librevenge::RVNGInputStream *input)
   /* unsigned length = */ readU32(input, m_bigEndian);
 
   unsigned long numRecords = readU16(input, m_bigEndian);
-  CDR_DEBUG_MSG(("CMXParser::readIxef - numRecords %i\n", numRecords));
+  CDR_DEBUG_MSG(("CMXParser::readIxef - numRecords %li\n", numRecords));
   sanitizeNumRecords(numRecords, m_precision, 6, 8, getRemainingLength(input));
   for (unsigned j = 1; j <= numRecords; ++j)
   {
@@ -2037,7 +2037,7 @@ void libcdr::CMXParser::readIxpg(librevenge::RVNGInputStream *input)
   /* unsigned length = */ readU32(input, m_bigEndian);
 
   unsigned long numRecords = readU16(input, m_bigEndian);
-  CDR_DEBUG_MSG(("CMXParser::readIxpg - numRecords %i\n", numRecords));
+  CDR_DEBUG_MSG(("CMXParser::readIxpg - numRecords %li\n", numRecords));
   sanitizeNumRecords(numRecords, m_precision, 16, 18, getRemainingLength(input));
   for (unsigned j = 1; j <= numRecords; ++j)
   {
diff --git a/src/lib/libcdr_utils.cpp b/src/lib/libcdr_utils.cpp
index d92e62d..e88bda9 100644
--- a/src/lib/libcdr_utils.cpp
+++ b/src/lib/libcdr_utils.cpp
@@ -486,17 +486,17 @@ const char *libcdr::toFourCC(unsigned value, bool bigEndian)
   static char sValue[5] = { 0, 0, 0, 0, 0 };
   if (bigEndian)
   {
-    sValue[3] = value & 0xff;
-    sValue[2] = (value & 0xff00) >> 8;
-    sValue[1] = (value & 0xff0000) >> 16;
-    sValue[0] = (value & 0xff000000) >> 24;
+    sValue[3] = (char)(value & 0xff);
+    sValue[2] = (char)((value & 0xff00) >> 8);
+    sValue[1] = (char)((value & 0xff0000) >> 16);
+    sValue[0] = (char)((value & 0xff000000) >> 24);
   }
   else
   {
-    sValue[0] = value & 0xff;
-    sValue[1] = (value & 0xff00) >> 8;
-    sValue[2] = (value & 0xff0000) >> 16;
-    sValue[3] = (value & 0xff000000) >> 24;
+    sValue[0] = (char)(value & 0xff);
+    sValue[1] = (char)((value & 0xff00) >> 8);
+    sValue[2] = (char)((value & 0xff0000) >> 16);
+    sValue[3] = (char)((value & 0xff000000) >> 24);
   }
   return sValue;
 }


More information about the Libreoffice-commits mailing list