[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - 2 commits - include/LibreOfficeKit smoketest/libtest.cxx

Michael Meeks michael.meeks at collabora.com
Thu Jun 12 08:49:03 PDT 2014


 include/LibreOfficeKit/LibreOfficeKit.h |   10 ++++++----
 smoketest/libtest.cxx                   |    7 ++++---
 2 files changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 053fbcfdbe572f4e18f35d66dd365c78a1e6e54e
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Jun 12 16:33:23 2014 +0100

    liblok: add include for size_t.
    
    Change-Id: Icd7d78a332fbb67e32ab929f0afc5881ab7448eb

diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 43eb212..4c32fd2 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -10,6 +10,8 @@
 #ifndef INCLUDED_DESKTOP_INC_LIBREOFFICEKIT_H
 #define INCLUDED_DESKTOP_INC_LIBREOFFICEKIT_H
 
+#include <stddef.h>
+
 #ifdef __cplusplus
 extern "C"
 {
commit c297b91fdce2342b4febdf4eff5b89c6526f7e86
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 12 14:28:17 2014 +0100

    cast loses precision
    
    Change-Id: Ic688f08cada4ae70ea1dfb1e29e249a166456452

diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 657c16c..43eb212 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -20,14 +20,14 @@ typedef struct _LibreOfficeKitDocument LibreOfficeKitDocument;
 
 // Do we have an extended member in this struct ?
 #define LIBREOFFICEKIT_HAS_MEMBER(strct,member,nSize) \
-    ((((int)((unsigned char *)&((strct *) 0)->member) +  \
-      (int)sizeof ((strct *) 0)->member)) <= (nSize))
+    ((((size_t)((unsigned char *)&((strct *) 0)->member) +  \
+      sizeof ((strct *) 0)->member)) <= (nSize))
 
 #define LIBREOFFICEKIT_HAS(pKit,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKit,member,(pKit)->nSize)
 
 struct _LibreOfficeKit
 {
-  int  nSize;
+  size_t  nSize;
 
   void                    (*destroy)       (LibreOfficeKit *pThis);
   int                     (*initialize)    (LibreOfficeKit *pThis, const char *pInstallPath);
@@ -39,7 +39,7 @@ struct _LibreOfficeKit
 
 struct _LibreOfficeKitDocument
 {
-  int  nSize;
+  size_t  nSize;
 
   void (*destroy)   (LibreOfficeKitDocument* pThis);
   int (*saveAs)     (LibreOfficeKitDocument* pThis,
diff --git a/smoketest/libtest.cxx b/smoketest/libtest.cxx
index 2316b8c..51c184b 100644
--- a/smoketest/libtest.cxx
+++ b/smoketest/libtest.cxx
@@ -13,6 +13,7 @@
 #include <assert.h>
 #include <math.h>
 #include <sys/time.h>
+#include <sal/types.h>
 #include <LibreOfficeKit/LibreOfficeKit.hxx>
 
 using namespace ::lok;
@@ -77,9 +78,9 @@ int main (int argc, char **argv)
 
     if (!LIBREOFFICEKIT_DOCUMENT_HAS(pDocument->get(), saveAsWithOptions))
     {
-        fprintf( stderr, "using obsolete LibreOffice %d + %d vs. %d\n",
-                 (int)((unsigned char *)&((LibreOfficeKitDocument *) 0)->saveAsWithOptions),
-                 (int)sizeof ((LibreOfficeKitDocument *) 0)->saveAsWithOptions,
+        fprintf( stderr, "using obsolete LibreOffice %" SAL_PRI_SIZET "d + %" SAL_PRI_SIZET "d vs. %" SAL_PRI_SIZET "d\n",
+                 (size_t)((unsigned char *)&((LibreOfficeKitDocument *) 0)->saveAsWithOptions),
+                 sizeof ((LibreOfficeKitDocument *) 0)->saveAsWithOptions,
                  pDocument->get()->nSize );
         return -1;
     }


More information about the Libreoffice-commits mailing list