From 18c786cbcd45ee314bed6303c62e23ecf4022a8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 12 Jun 2014 14:28:17 +0100 Subject: [PATCH] cast loses precision Change-Id: Ic688f08cada4ae70ea1dfb1e29e249a166456452 --- include/LibreOfficeKit/LibreOfficeKit.h | 8 ++++---- smoketest/libtest.cxx | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 657c16c37db6..43eb2122f7d5 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 2316b8c24184..51c184b11af6 100644 --- a/smoketest/libtest.cxx +++ b/smoketest/libtest.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include 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; }