Blame SOURCES/0293-Keep-LibreOfficeKit.hxx-compatible-with-C-03.patch

f325b2
From 994720658cfc4e3e82493ca5ef1859cc0b42960c Mon Sep 17 00:00:00 2001
f325b2
From: Stephan Bergmann <sbergman@redhat.com>
f325b2
Date: Tue, 10 Nov 2015 11:08:30 +0100
f325b2
Subject: [PATCH 293/398] Keep LibreOfficeKit.hxx compatible with C++03
f325b2
f325b2
Change-Id: Ic2f123c9b341dbb421b766c3bba1fc56c1bfb41d
f325b2
(cherry picked from commit 1cd6e2e08eba3bc55fbf6dda3cd3d19a5d95f798)
f325b2
---
f325b2
 compilerplugins/clang/store/nullptr.cxx   |  9 +++++++++
f325b2
 include/LibreOfficeKit/LibreOfficeKit.hxx | 20 ++++++++++----------
f325b2
 2 files changed, 19 insertions(+), 10 deletions(-)
f325b2
f325b2
diff --git a/compilerplugins/clang/store/nullptr.cxx b/compilerplugins/clang/store/nullptr.cxx
f325b2
index 528bb6aac9bc..83812d0ccd49 100644
f325b2
--- a/compilerplugins/clang/store/nullptr.cxx
f325b2
+++ b/compilerplugins/clang/store/nullptr.cxx
f325b2
@@ -42,6 +42,8 @@ public:
f325b2
     bool VisitImplicitCastExpr(CastExpr const * expr);
f325b2
 
f325b2
 private:
f325b2
+    bool isInLokIncludeFile(SourceLocation spellingLocation) const;
f325b2
+
f325b2
     bool isFromCIncludeFile(SourceLocation spellingLocation) const;
f325b2
 
f325b2
     bool isMacroBodyExpansion(SourceLocation location) const;
f325b2
@@ -134,6 +136,8 @@ bool Nullptr::VisitImplicitCastExpr(CastExpr const * expr) {
f325b2
                 ((!compiler.getLangOpts().CPlusPlus
f325b2
                   || isInUnoIncludeFile(
f325b2
                       compiler.getSourceManager().getSpellingLoc(loc))
f325b2
+                  || isInLokIncludeFile(
f325b2
+                      compiler.getSourceManager().getSpellingLoc(loc))
f325b2
                   || isFromCIncludeFile(
f325b2
                       compiler.getSourceManager().getSpellingLoc(loc)))
f325b2
                  ? "NULL" : "nullptr"));
f325b2
@@ -143,6 +147,11 @@ bool Nullptr::VisitImplicitCastExpr(CastExpr const * expr) {
f325b2
     return true;
f325b2
 }
f325b2
 
f325b2
+bool Nullptr::isInLokIncludeFile(SourceLocation spellingLocation) const {
f325b2
+    return compiler.getSourceManager().getFilename(spellingLocation)
f325b2
+        .startswith(SRCDIR "/include/LibreOfficeKit/");
f325b2
+}
f325b2
+
f325b2
 bool Nullptr::isFromCIncludeFile(SourceLocation spellingLocation) const {
f325b2
     return !compat::isInMainFile(compiler.getSourceManager(), spellingLocation)
f325b2
         && (StringRef(
f325b2
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
f325b2
index dde371ddc95b..ec48d39368e3 100644
f325b2
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
f325b2
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
f325b2
@@ -47,7 +47,7 @@ public:
f325b2
      * @param pFormat the format to use while exporting, when omitted, then deducted from pURL's extension
f325b2
      * @param pFilterOptions options for the export filter, e.g. SkipImages.
f325b2
      */
f325b2
-    inline bool saveAs(const char* pUrl, const char* pFormat = nullptr, const char* pFilterOptions = nullptr)
f325b2
+    inline bool saveAs(const char* pUrl, const char* pFormat = NULL, const char* pFilterOptions = NULL)
f325b2
     {
f325b2
         return mpDoc->pClass->saveAs(mpDoc, pUrl, pFormat, pFilterOptions) != 0;
f325b2
     }
f325b2
@@ -220,7 +220,7 @@ public:
f325b2
      * @param pCommand uno command to be posted to the document, like ".uno:Bold"
f325b2
      * @param pArguments arguments of the uno command.
f325b2
      */
f325b2
-    inline void postUnoCommand(const char* pCommand, const char* pArguments = nullptr, bool bNotifyWhenFinished = false)
f325b2
+    inline void postUnoCommand(const char* pCommand, const char* pArguments = NULL, bool bNotifyWhenFinished = false)
f325b2
     {
f325b2
         mpDoc->pClass->postUnoCommand(mpDoc, pCommand, pArguments, bNotifyWhenFinished);
f325b2
     }
f325b2
@@ -243,7 +243,7 @@ public:
f325b2
      * @param pMimeType suggests the return format, for example text/plain;charset=utf-8.
f325b2
      * @param pUsedMimeType output parameter to inform about the determined format (suggested one or plain text).
f325b2
      */
f325b2
-    inline char* getTextSelection(const char* pMimeType, char** pUsedMimeType = nullptr)
f325b2
+    inline char* getTextSelection(const char* pMimeType, char** pUsedMimeType = NULL)
f325b2
     {
f325b2
         return mpDoc->pClass->getTextSelection(mpDoc, pMimeType, pUsedMimeType);
f325b2
     }
f325b2
@@ -361,17 +361,17 @@ public:
f325b2
      * @param pUrl the URL of the document to load
f325b2
      * @param pFilterOptions options for the import filter, e.g. SkipImages.
f325b2
      */
f325b2
-    inline Document* documentLoad(const char* pUrl, const char* pFilterOptions = nullptr)
f325b2
+    inline Document* documentLoad(const char* pUrl, const char* pFilterOptions = NULL)
f325b2
     {
f325b2
-        LibreOfficeKitDocument* pDoc = nullptr;
f325b2
+        LibreOfficeKitDocument* pDoc = NULL;
f325b2
 
f325b2
         if (LIBREOFFICEKIT_HAS(mpThis, documentLoadWithOptions))
f325b2
             pDoc = mpThis->pClass->documentLoadWithOptions(mpThis, pUrl, pFilterOptions);
f325b2
         else
f325b2
             pDoc = mpThis->pClass->documentLoad(mpThis, pUrl);
f325b2
 
f325b2
-        if (pDoc == nullptr)
f325b2
-            return nullptr;
f325b2
+        if (pDoc == NULL)
f325b2
+            return NULL;
f325b2
 
f325b2
         return new Document(pDoc);
f325b2
     }
f325b2
@@ -405,11 +405,11 @@ public:
f325b2
 };
f325b2
 
f325b2
 /// Factory method to create a lok::Office instance.
f325b2
-inline Office* lok_cpp_init(const char* pInstallPath, const char* pUserProfilePath = nullptr)
f325b2
+inline Office* lok_cpp_init(const char* pInstallPath, const char* pUserProfilePath = NULL)
f325b2
 {
f325b2
     LibreOfficeKit* pThis = lok_init_2(pInstallPath, pUserProfilePath);
f325b2
-    if (pThis == nullptr || pThis->pClass->nSize == 0)
f325b2
-        return nullptr;
f325b2
+    if (pThis == NULL || pThis->pClass->nSize == 0)
f325b2
+        return NULL;
f325b2
     return new ::lok::Office(pThis);
f325b2
 }
f325b2
 
f325b2
-- 
f325b2
2.12.0
f325b2