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

Stephan Bergmann sbergman at redhat.com
Tue Mar 10 08:14:31 PDT 2015


 include/LibreOfficeKit/LibreOfficeKit.h |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit f75aafb3a2ec7a53b1797db41b497e97558730f2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Mar 10 16:13:39 2015 +0100

    Avoid undef use of null ptr, use offsetof instead
    
    Change-Id: I47b1d8e7b119e50406b50f580ee06f9f1b5f8401

diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index ea9846a..d4b7906 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -25,8 +25,7 @@ typedef struct _LibreOfficeKitDocumentClass LibreOfficeKitDocumentClass;
 
 // Do we have an extended member in this struct ?
 #define LIBREOFFICEKIT_HAS_MEMBER(strct,member,nSize) \
-    ((((size_t)((unsigned char *)&((strct *) 0)->member) +  \
-      sizeof ((strct *) 0)->member)) <= (nSize))
+    (offsetof(strct, member) < (nSize))
 
 #define LIBREOFFICEKIT_HAS(pKit,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitClass,member,(pKit)->pClass->nSize)
 


More information about the Libreoffice-commits mailing list