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

Fridrich Å trba fridrich.strba at bluewin.ch
Sun Apr 7 12:36:53 PDT 2013


 src/lib/CDRCollector.cpp        |   14 +++++++-------
 src/lib/CDRContentCollector.cpp |   20 ++++++++++----------
 src/lib/CDRInternalStream.cpp   |    4 ++--
 3 files changed, 19 insertions(+), 19 deletions(-)

New commits:
commit b11e5a536fa1c9194f5b4d03ce28ba85b5963ce4
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Sun Apr 7 21:29:42 2013 +0200

    Removing some warnings

diff --git a/src/lib/CDRCollector.cpp b/src/lib/CDRCollector.cpp
index be4eaec..d6958d5 100644
--- a/src/lib/CDRCollector.cpp
+++ b/src/lib/CDRCollector.cpp
@@ -62,7 +62,7 @@ void libcdr::CDRParserState::setColorTransform(const std::vector<unsigned char>
 {
   if (profile.empty())
     return;
-  cmsHPROFILE tmpProfile = cmsOpenProfileFromMem(&profile[0], profile.size());
+  cmsHPROFILE tmpProfile = cmsOpenProfileFromMem(&profile[0], cmsUInt32Number(profile.size()));
   cmsHPROFILE tmpRGBProfile = cmsCreate_sRGBProfile();
   cmsColorSpaceSignature signature = cmsGetColorSpace(tmpProfile);
   switch (signature)
@@ -322,7 +322,7 @@ unsigned libcdr::CDRParserState::_getRGBColor(const CDRColor &color)
       0x00, 0x46, 0x73, 0x91, 0xa2, 0xad, 0x2a, 0x3d, 0x69, 0x7d, 0x85, 0x8f, 0xa3,
     };
 
-    unsigned short pantoneIndex = ((unsigned short)col1 << 8) | (unsigned short)col0;
+    unsigned short pantoneIndex = (unsigned short)(((int)col1 << 8) | (int)col0);
     double pantoneSaturation = (double)(((unsigned short)col3 << 8) | (unsigned short)col2) / 100.0;
     typedef struct
     {
@@ -339,9 +339,9 @@ unsigned libcdr::CDRParserState::_getRGBColor(const CDRColor &color)
       pureColor.g = WaldoColorType0_G[pantoneIndex];
       pureColor.b = WaldoColorType0_B[pantoneIndex];
     }
-    unsigned tmpRed = cdr_round(255.0*(1-pantoneSaturation) + (double)pureColor.r*pantoneSaturation);
-    unsigned tmpGreen = cdr_round(255.0*(1-pantoneSaturation) + (double)pureColor.g*pantoneSaturation);
-    unsigned tmpBlue = cdr_round(255.0*(1-pantoneSaturation) + (double)pureColor.b*pantoneSaturation);
+    unsigned tmpRed = (unsigned)cdr_round(255.0*(1-pantoneSaturation) + (double)pureColor.r*pantoneSaturation);
+    unsigned tmpGreen = (unsigned)cdr_round(255.0*(1-pantoneSaturation) + (double)pureColor.g*pantoneSaturation);
+    unsigned tmpBlue = (unsigned)cdr_round(255.0*(1-pantoneSaturation) + (double)pureColor.b*pantoneSaturation);
     red = (tmpRed < 255 ? (unsigned char)tmpRed : 255);
     green = (tmpGreen < 255 ? (unsigned char)tmpGreen : 255);
     blue = (tmpBlue < 255 ? (unsigned char)tmpBlue : 255);
@@ -407,7 +407,7 @@ unsigned libcdr::CDRParserState::_getRGBColor(const CDRColor &color)
   // HSB
   case 0x06:
   {
-    unsigned short hue = (col1<<8) | col0;
+    unsigned short hue = (unsigned short)(((int)col1<<8) | col0);
     double saturation = (double)col2/255.0;
     double brightness = (double)col3/255.0;
 
@@ -442,7 +442,7 @@ unsigned libcdr::CDRParserState::_getRGBColor(const CDRColor &color)
   // HLS
   case 0x07:
   {
-    unsigned short hue = (col1<<8) | col0;
+    unsigned short hue = (unsigned short)(((int)col1<<8) | col0);
     double lightness = (double)col2/255.0;
     double saturation = (double)col3/255.0;
 
diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index a2a3808..502cf65 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -396,7 +396,7 @@ void libcdr::CDRContentCollector::_flushCurrentPath()
     double y1 = m_currentTextBox.m_y;
     double x2 = m_currentTextBox.m_x + m_currentTextBox.m_w;
     double y2 = m_currentTextBox.m_y - m_currentTextBox.m_h;
-    if (m_currentTextBox.m_h != 0.0 && m_currentTextBox.m_w != 0)
+    if (!CDR_ALMOST_ZERO(m_currentTextBox.m_h) && !CDR_ALMOST_ZERO(m_currentTextBox.m_w))
     {
       m_currentTransforms.applyToPoint(x1, y1);
       m_currentTransforms.applyToPoint(x2, y2);
@@ -406,7 +406,7 @@ void libcdr::CDRContentCollector::_flushCurrentPath()
         m_groupTransforms.top().applyToPoint(x2, y2);
       }
     }
-    else if (m_currentBBox.getWidth() != 0.0 && m_currentBBox.getHeight() != 0.0)
+    else if (!CDR_ALMOST_ZERO(m_currentBBox.getWidth()) && !CDR_ALMOST_ZERO(m_currentBBox.getHeight()))
     {
       y1 = m_currentBBox.getMinY();
       y2 = m_currentBBox.getMinY() + m_currentBBox.getHeight();
@@ -1015,7 +1015,7 @@ void libcdr::CDRContentCollector::_lineProperties(WPXPropertyList &propList)
           gap = iter->second.dashArray[1];
         }
 
-        unsigned count = iter->second.dashArray.size() / 2;
+        unsigned long count = iter->second.dashArray.size() / 2;
         unsigned i = 0;
         for (; i < count;)
         {
@@ -1081,21 +1081,21 @@ void libcdr::CDRContentCollector::_generateBitmapFromPattern(WPXBinaryData &bitm
 
   // Create DIB file header
   writeU16(bitmap, 0x4D42);  // Type
-  writeU32(bitmap, tmpDIBFileSize); // Size
+  writeU32(bitmap, (int)tmpDIBFileSize); // Size
   writeU16(bitmap, 0); // Reserved1
   writeU16(bitmap, 0); // Reserved2
-  writeU32(bitmap, tmpDIBOffsetBits); // OffsetBits
+  writeU32(bitmap, (int)tmpDIBOffsetBits); // OffsetBits
 
   // Create DIB Info header
   writeU32(bitmap, 40); // Size
 
-  writeU32(bitmap, width);  // Width
-  writeU32(bitmap, height); // Height
+  writeU32(bitmap, (int)width);  // Width
+  writeU32(bitmap, (int)height); // Height
 
   writeU16(bitmap, 1); // Planes
   writeU16(bitmap, 32); // BitCount
   writeU32(bitmap, 0); // Compression
-  writeU32(bitmap, tmpDIBImageSize); // SizeImage
+  writeU32(bitmap, (int)tmpDIBImageSize); // SizeImage
   writeU32(bitmap, 0); // XPelsPerMeter
   writeU32(bitmap, 0); // YPelsPerMeter
   writeU32(bitmap, 0); // ColorsUsed
@@ -1119,9 +1119,9 @@ void libcdr::CDRContentCollector::_generateBitmapFromPattern(WPXBinaryData &bitm
       while (k < width && l < 8)
       {
         if (c & 0x80)
-          writeU32(bitmap, background);
+          writeU32(bitmap, (int)background);
         else
-          writeU32(bitmap, foreground);
+          writeU32(bitmap, (int)foreground);
         c <<= 1;
         l++;
         k++;
diff --git a/src/lib/CDRInternalStream.cpp b/src/lib/CDRInternalStream.cpp
index 6813db2..9dac80f 100644
--- a/src/lib/CDRInternalStream.cpp
+++ b/src/lib/CDRInternalStream.cpp
@@ -86,7 +86,7 @@ libcdr::CDRInternalStream::CDRInternalStream(WPXInputStream *input, unsigned lon
     if (size != tmpNumBytesRead)
       return;
 
-    strm.avail_in = tmpNumBytesRead;
+    strm.avail_in = (uInt)tmpNumBytesRead;
     strm.next_in = (Bytef *)tmpBuffer;
 
     do
@@ -122,7 +122,7 @@ const unsigned char *libcdr::CDRInternalStream::read(unsigned long numBytes, uns
   if (numBytes == 0)
     return 0;
 
-  int numBytesToRead;
+  unsigned numBytesToRead;
 
   if ((m_offset+numBytes) < m_buffer.size())
     numBytesToRead = numBytes;


More information about the Libreoffice-commits mailing list