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

Miklos Vajna vmiklos at collabora.co.uk
Thu Aug 17 07:49:48 UTC 2017


 src/conv/raw/cdr2raw.cpp        |    2 +-
 src/conv/raw/cmx2raw.cpp        |    2 +-
 src/conv/svg/cdr2xhtml.cpp      |    2 +-
 src/conv/svg/cmx2xhtml.cpp      |    2 +-
 src/conv/text/cdr2text.cpp      |    2 +-
 src/conv/text/cmx2text.cpp      |    2 +-
 src/lib/CDRCollector.cpp        |    4 ++--
 src/lib/CDRContentCollector.cpp |   12 ++++++------
 src/lib/CDRInternalStream.cpp   |    4 ++--
 src/lib/CDRInternalStream.h     |    6 +++---
 src/lib/CMXParser.cpp           |   10 +++++-----
 src/lib/libcdr_utils.cpp        |    4 ++--
 12 files changed, 26 insertions(+), 26 deletions(-)

New commits:
commit 3a93808cf271b5d39e91bd0606d1716d7d5b6ffb
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Aug 17 09:49:27 2017 +0200

    Convert 0 to nullptr where it's used as a pointer value
    
    To make the code easier to read, because this means the remaining zeros
    all mean numbers.
    
    Change-Id: Ia1e06d3b1ce49603595459f78b2d400e0ba5bea8

diff --git a/src/conv/raw/cdr2raw.cpp b/src/conv/raw/cdr2raw.cpp
index 8a21498..90cdf09 100644
--- a/src/conv/raw/cdr2raw.cpp
+++ b/src/conv/raw/cdr2raw.cpp
@@ -51,7 +51,7 @@ int printVersion()
 int main(int argc, char *argv[])
 {
   bool printIndentLevel = false;
-  char *file = 0;
+  char *file = nullptr;
 
   if (argc < 2)
     return printUsage();
diff --git a/src/conv/raw/cmx2raw.cpp b/src/conv/raw/cmx2raw.cpp
index ebc5ddc..59d2b58 100644
--- a/src/conv/raw/cmx2raw.cpp
+++ b/src/conv/raw/cmx2raw.cpp
@@ -51,7 +51,7 @@ int printVersion()
 int main(int argc, char *argv[])
 {
   bool printIndentLevel = false;
-  char *file = 0;
+  char *file = nullptr;
 
   if (argc < 2)
     return printUsage();
diff --git a/src/conv/svg/cdr2xhtml.cpp b/src/conv/svg/cdr2xhtml.cpp
index 4a9245c..5ccaab6 100644
--- a/src/conv/svg/cdr2xhtml.cpp
+++ b/src/conv/svg/cdr2xhtml.cpp
@@ -54,7 +54,7 @@ int main(int argc, char *argv[])
   if (argc < 2)
     return printUsage();
 
-  char *file = 0;
+  char *file = nullptr;
 
   for (int i = 1; i < argc; i++)
   {
diff --git a/src/conv/svg/cmx2xhtml.cpp b/src/conv/svg/cmx2xhtml.cpp
index 54aaf92..ebcf79c 100644
--- a/src/conv/svg/cmx2xhtml.cpp
+++ b/src/conv/svg/cmx2xhtml.cpp
@@ -54,7 +54,7 @@ int main(int argc, char *argv[])
   if (argc < 2)
     return printUsage();
 
-  char *file = 0;
+  char *file = nullptr;
 
   for (int i = 1; i < argc; i++)
   {
diff --git a/src/conv/text/cdr2text.cpp b/src/conv/text/cdr2text.cpp
index e9f6c94..59c575f 100644
--- a/src/conv/text/cdr2text.cpp
+++ b/src/conv/text/cdr2text.cpp
@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
   if (argc < 2)
     return printUsage();
 
-  char *file = 0;
+  char *file = nullptr;
 
   for (int i = 1; i < argc; i++)
   {
diff --git a/src/conv/text/cmx2text.cpp b/src/conv/text/cmx2text.cpp
index e533371..9a4fbac 100644
--- a/src/conv/text/cmx2text.cpp
+++ b/src/conv/text/cmx2text.cpp
@@ -52,7 +52,7 @@ int main(int argc, char *argv[])
   if (argc < 2)
     return printUsage();
 
-  char *file = 0;
+  char *file = nullptr;
 
   for (int i = 1; i < argc; i++)
   {
diff --git a/src/lib/CDRCollector.cpp b/src/lib/CDRCollector.cpp
index 7b52258..ee88045 100644
--- a/src/lib/CDRCollector.cpp
+++ b/src/lib/CDRCollector.cpp
@@ -16,13 +16,13 @@
 libcdr::CDRParserState::CDRParserState()
   : m_bmps(), m_patterns(), m_vects(), m_pages(), m_documentPalette(), m_texts(),
     m_styles(), m_fillStyles(), m_lineStyles(),
-    m_colorTransformCMYK2RGB(0), m_colorTransformLab2RGB(0), m_colorTransformRGB2RGB(0)
+    m_colorTransformCMYK2RGB(nullptr), m_colorTransformLab2RGB(nullptr), m_colorTransformRGB2RGB(nullptr)
 {
   cmsHPROFILE tmpRGBProfile = cmsCreate_sRGBProfile();
   m_colorTransformRGB2RGB = cmsCreateTransform(tmpRGBProfile, TYPE_RGB_8, tmpRGBProfile, TYPE_RGB_8, INTENT_PERCEPTUAL, 0);
   cmsHPROFILE tmpCMYKProfile = cmsOpenProfileFromMem(CMYK_icc, sizeof(CMYK_icc)/sizeof(CMYK_icc[0]));
   m_colorTransformCMYK2RGB = cmsCreateTransform(tmpCMYKProfile, TYPE_CMYK_DBL, tmpRGBProfile, TYPE_RGB_8, INTENT_PERCEPTUAL, 0);
-  cmsHPROFILE tmpLabProfile = cmsCreateLab4Profile(0);
+  cmsHPROFILE tmpLabProfile = cmsCreateLab4Profile(nullptr);
   m_colorTransformLab2RGB = cmsCreateTransform(tmpLabProfile, TYPE_Lab_DBL, tmpRGBProfile, TYPE_RGB_8, INTENT_PERCEPTUAL, 0);
   cmsCloseProfile(tmpLabProfile);
   cmsCloseProfile(tmpCMYKProfile);
diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index d9e143e..0843fc1 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -57,10 +57,10 @@ libcdr::CDRContentCollector::CDRContentCollector(libcdr::CDRParserState &ps, lib
   : m_painter(painter), m_isDocumentStarted(false), m_isPageProperties(false), m_isPageStarted(false),
     m_ignorePage(false), m_page(ps.m_pages[0]), m_pageIndex(0), m_currentFillStyle(), m_currentLineStyle(),
     m_spnd(0), m_currentObjectLevel(0), m_currentGroupLevel(0), m_currentVectLevel(0), m_currentPageLevel(0),
-    m_currentStyleId(0), m_currentImage(), m_currentText(0), m_currentBBox(), m_currentTextBox(), m_currentPath(),
-    m_currentTransforms(), m_fillTransforms(), m_polygon(0), m_isInPolygon(false), m_isInSpline(false),
-    m_outputElementsStack(0), m_contentOutputElementsStack(), m_fillOutputElementsStack(),
-    m_outputElementsQueue(0), m_contentOutputElementsQueue(), m_fillOutputElementsQueue(),
+    m_currentStyleId(0), m_currentImage(), m_currentText(nullptr), m_currentBBox(), m_currentTextBox(), m_currentPath(),
+    m_currentTransforms(), m_fillTransforms(), m_polygon(nullptr), m_isInPolygon(false), m_isInSpline(false),
+    m_outputElementsStack(nullptr), m_contentOutputElementsStack(), m_fillOutputElementsStack(),
+    m_outputElementsQueue(nullptr), m_contentOutputElementsQueue(), m_fillOutputElementsQueue(),
     m_groupLevels(), m_groupTransforms(), m_splineData(), m_fillOpacity(1.0), m_reverseOrder(reverseOrder),
     m_ps(ps)
 {
@@ -217,7 +217,7 @@ void libcdr::CDRContentCollector::_flushCurrentPath()
     if (m_polygon)
     {
       delete m_polygon;
-      m_polygon = 0;
+      m_polygon = nullptr;
     }
     m_isInPolygon = false;
     if (!m_splineData.empty() && m_isInSpline)
@@ -537,7 +537,7 @@ void libcdr::CDRContentCollector::_flushCurrentPath()
   m_currentTransforms.clear();
   m_fillTransforms = libcdr::CDRTransforms();
   m_fillOpacity = 1.0;
-  m_currentText = 0;
+  m_currentText = nullptr;
 }
 
 void libcdr::CDRContentCollector::collectTransform(const CDRTransforms &transforms, bool considerGroupTransform)
diff --git a/src/lib/CDRInternalStream.cpp b/src/lib/CDRInternalStream.cpp
index b1e5520..d06ea2e 100644
--- a/src/lib/CDRInternalStream.cpp
+++ b/src/lib/CDRInternalStream.cpp
@@ -100,7 +100,7 @@ const unsigned char *libcdr::CDRInternalStream::read(unsigned long numBytes, uns
   numBytesRead = 0;
 
   if (numBytes == 0)
-    return 0;
+    return nullptr;
 
   unsigned numBytesToRead;
 
@@ -112,7 +112,7 @@ const unsigned char *libcdr::CDRInternalStream::read(unsigned long numBytes, uns
   numBytesRead = numBytesToRead; // about as paranoid as we can be..
 
   if (numBytesToRead == 0)
-    return 0;
+    return nullptr;
 
   long oldOffset = m_offset;
   m_offset += numBytesToRead;
diff --git a/src/lib/CDRInternalStream.h b/src/lib/CDRInternalStream.h
index 5b70653..f8bf668 100644
--- a/src/lib/CDRInternalStream.h
+++ b/src/lib/CDRInternalStream.h
@@ -34,7 +34,7 @@ public:
   }
   const char *subStreamName(unsigned) override
   {
-    return 0;
+    return nullptr;
   }
   bool existsSubStream(const char *) override
   {
@@ -42,11 +42,11 @@ public:
   }
   librevenge::RVNGInputStream *getSubStreamByName(const char *) override
   {
-    return 0;
+    return nullptr;
   }
   librevenge::RVNGInputStream *getSubStreamById(unsigned) override
   {
-    return 0;
+    return nullptr;
   }
   const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead) override;
   int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override;
diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index de0344e..4d2e24f 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -50,7 +50,7 @@ libcdr::CMXParser::CMXParser(libcdr::CDRCollector *collector, CMXParserState &pa
     m_bigEndian(false), m_unit(0),
     m_scale(0.0), m_xmin(0.0), m_xmax(0.0), m_ymin(0.0), m_ymax(0.0),
     m_fillIndex(0), m_nextInstructionOffset(0), m_parserState(parserState),
-    m_currentImageInfo(), m_currentPattern(0), m_currentBitmap(0) {}
+    m_currentImageInfo(), m_currentPattern(nullptr), m_currentBitmap(nullptr) {}
 
 libcdr::CMXParser::~CMXParser()
 {
@@ -319,7 +319,7 @@ const unsigned *libcdr::CMXParser::_getOffsetByType(unsigned short type, const s
   std::map<unsigned short, unsigned>::const_iterator iter = offsets.find(type);
   if (iter != offsets.end())
     return &(iter->second);
-  return 0;
+  return nullptr;
 }
 
 void libcdr::CMXParser::readIxmr(librevenge::RVNGInputStream *input)
@@ -343,7 +343,7 @@ void libcdr::CMXParser::readIxmr(librevenge::RVNGInputStream *input)
     offsets[indexRecordId] = offset;
   }
   long oldOffset = input->tell();
-  const unsigned *address = 0;
+  const unsigned *address = nullptr;
   if ((address = _getOffsetByType(CMX_COLOR_DESCRIPTION_SECTION, offsets)))
   {
     input->seek(*address, librevenge::RVNG_SEEK_SET);
@@ -1938,7 +1938,7 @@ void libcdr::CMXParser::readIxtl(librevenge::RVNGInputStream *input)
         m_collector->collectBmpf(j, m_currentPattern->width, m_currentPattern->height, m_currentPattern->pattern);
       if (m_currentPattern)
         delete m_currentPattern;
-      m_currentPattern = 0;
+      m_currentPattern = nullptr;
       break;
     }
     case 6:
@@ -1983,7 +1983,7 @@ void libcdr::CMXParser::readIxef(librevenge::RVNGInputStream *input)
                                 m_currentBitmap->bpp, m_currentBitmap->palette, m_currentBitmap->bitmap);
       if (m_currentBitmap)
         delete m_currentBitmap;
-      m_currentBitmap = 0;
+      m_currentBitmap = nullptr;
     }
     if (sizeInFile)
       input->seek(sizeInFile-6, librevenge::RVNG_SEEK_CUR);
diff --git a/src/lib/libcdr_utils.cpp b/src/lib/libcdr_utils.cpp
index 6d480cd..3fa0bbf 100644
--- a/src/lib/libcdr_utils.cpp
+++ b/src/lib/libcdr_utils.cpp
@@ -102,7 +102,7 @@ static unsigned short getEncoding(const unsigned char *buffer, unsigned bufferLe
   if (!buffer)
     return 0;
   UErrorCode status = U_ZERO_ERROR;
-  UCharsetDetector *csd = 0;
+  UCharsetDetector *csd = nullptr;
   try
   {
     csd = ucsdet_open(&status);
@@ -377,7 +377,7 @@ void libcdr::appendCharacters(librevenge::RVNGString &text, std::vector<unsigned
   else
   {
     UErrorCode status = U_ZERO_ERROR;
-    UConverter *conv = NULL;
+    UConverter *conv = nullptr;
     switch (charset)
     {
     case 0x80: // SHIFTJIS


More information about the Libreoffice-commits mailing list