[Libreoffice-commits] core.git: include/LibreOfficeKit

Thorsten Behrens Thorsten.Behrens at CIB.de
Thu Apr 6 14:06:25 UTC 2017


 include/LibreOfficeKit/LibreOfficeKit.h     |    6 ++++--
 include/LibreOfficeKit/LibreOfficeKitInit.h |   15 ++++++++-------
 2 files changed, 12 insertions(+), 9 deletions(-)

New commits:
commit a016ac1667cdf7fb81a78b51a6aaab455e376782
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date:   Thu Apr 6 04:07:18 2017 +0200

    lokit: make this build on windows, silence extra warnings
    
    Change-Id: I78d5ce58d55d27eaa0256a0c1ddffed3a5f2cf91
    Reviewed-on: https://gerrit.libreoffice.org/36175
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 2a5dbcabb817..a4035c7351f0 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -13,9 +13,11 @@
 #include <stddef.h>
 
 #if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
+# ifndef _WIN32
 // the unstable API needs C99's bool
-#include <stdbool.h>
-#include <stdint.h>
+#  include <stdbool.h>
+# endif
+# include <stdint.h>
 #endif
 
 #include <LibreOfficeKit/LibreOfficeKitTypes.h>
diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h
index 08b3e1c32947..0c9555afe174 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -72,7 +72,7 @@ extern "C"
     }
 
 #else
-
+    #pragma warning(disable:4996)
     #include  <windows.h>
     #define TARGET_LIB        "sofficeapp" ".dll"
     #define TARGET_MERGED_LIB "mergedlo" ".dll"
@@ -124,15 +124,16 @@ extern "C"
         size_t size_sEnvPath = 0;
         if(sEnvPath)
             size_sEnvPath = strlen(sEnvPath);
-        char* sNewPath = new char[size_sEnvPath + 2*strlen(pPath) + strlen(UNOPATH) + 4];
+        size_t buffer_size = size_sEnvPath + 2*strlen(pPath) + strlen(UNOPATH) + 4;
+        char* sNewPath = new char[buffer_size];
         sNewPath[0] = L'\0';
-        strcat(sNewPath, pPath);     // program to PATH
-        strcat(sNewPath, ";");
-        strcat(sNewPath, UNOPATH);   // UNO to PATH
+        strcat_s(sNewPath, buffer_size, pPath);     // program to PATH
+        strcat_s(sNewPath, buffer_size, ";");
+        strcat_s(sNewPath, buffer_size, UNOPATH);   // UNO to PATH
         if (size_sEnvPath > 0)
         {
-            strcat(sNewPath, ";");
-            strcat(sNewPath, sEnvPath);
+            strcat_s(sNewPath, buffer_size, ";");
+            strcat_s(sNewPath, buffer_size, sEnvPath);
         }
 
         SetEnvironmentVariableA("PATH", sNewPath);


More information about the Libreoffice-commits mailing list