Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi,
        It looks nice :-) then again - I noticed this mess:

#if defined( WNT )
  __cdecl
#endif
#if defined( ICC )
  _Optlink
#endif

        Which (you would hope) would be implied by the extern "C" { } construct
on Windows - with a SAL_CALL macro annotation instead :-) That won't
work for ICC - but - our ICC support is almost certainly broken anyway
and I doubt anyone cares.

Find patch attached. Here is what I did:

- changed a variables holding boolean values from int to bool
- used include-what-you-use and created new list of #includes
- introduced SAL_CALL

A question to SAL_CALL: The following command

find . -name "*.cxx"|xargs pcregrep -M 'WNT.*\n.*cdecl'

shows SAL_CALL candidates. But where in LO I can assume that it's fine to use SAL_CALL. Everywhere? E.g. autodoc/source/exes/adc_uni/main.cxx? Or for the first run only replace occurrences similar enough to the one above?

Christina
From 7efde856d38bff43e4319473f52b5b1c411bad90 Mon Sep 17 00:00:00 2001
From: Christina Rossmanith <ChrRossmanith@web.de>
Date: Tue, 17 May 2011 20:55:42 +0200
Subject: [PATCH] Use SAL_CALL / refurbish #include's (IWYU) / sal_Bool->bool

---
 svtools/source/svhtml/htmlkywd.cxx |   57 +++++++++++------------------------
 1 files changed, 18 insertions(+), 39 deletions(-)

diff --git a/svtools/source/svhtml/htmlkywd.cxx b/svtools/source/svhtml/htmlkywd.cxx
index c45d7e0..0b40a6f 100644
--- a/svtools/source/svhtml/htmlkywd.cxx
+++ b/svtools/source/svhtml/htmlkywd.cxx
@@ -29,14 +29,14 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_svtools.hxx"
 
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-
-#include <svtools/svparser.hxx>
-#include <svtools/htmlkywd.hxx>
+#include <limits.h>                     // for USHRT_MAX
+#include <sal/types.h>                  // for sal_Char, sal_Unicode, etc
+#include <stdlib.h>                     // for bsearch, qsort
+#include <string.h>                     // for strcmp
 #include <svtools/htmltokn.h>
+#include <tools/solar.h>                // for String
+#include <svtools/htmlkywd.hxx>
+#include <tools/string.hxx>             // for String::CompareToAscii, etc
 
 // Table has still to be sorted
 struct HTML_TokenEntry
@@ -50,7 +50,7 @@ struct HTML_TokenEntry
 };
 
 // Flag: RTF token table has already been sorted
-static int bSortKeyWords = sal_False;
+static bool bSortKeyWords = false;
 
 static HTML_TokenEntry aHTMLTokenTab[] = {
     {{OOO_STRING_SVTOOLS_HTML_area},                   HTML_AREA}, // Netscape 2.0
@@ -203,14 +203,7 @@ static HTML_TokenEntry aHTMLTokenTab[] = {
 extern "C"
 {
     
-static int
-#if defined( WNT )
- __cdecl
-#endif
-#if defined( ICC ) && defined( OS2 )
- _Optlink
-#endif
-    HTMLKeyCompare( const void *pFirst, const void *pSecond)
+static int SAL_CALL HTMLKeyCompare( const void *pFirst, const void *pSecond)
 {
     int nRet = 0;
     if( -1 == ((HTML_TokenEntry*)pFirst)->nToken )
@@ -245,7 +238,7 @@ int GetHTMLToken( const String& rName )
                 sizeof( aHTMLTokenTab ) / sizeof( HTML_TokenEntry ),
                 sizeof( HTML_TokenEntry ),
                 HTMLKeyCompare );
-        bSortKeyWords = sal_True;
+        bSortKeyWords = true;
     }
 
     int nRet = 0;
@@ -278,7 +271,7 @@ struct HTML_CharEntry
 };
 
 // Flag: RTF token table has already been sorted
-static int bSortCharKeyWords = sal_False;
+static bool bSortCharKeyWords = false;
 
 static HTML_CharEntry aHTMLCharNameTab[] = {
     {{OOO_STRING_SVTOOLS_HTML_C_lt},                    60},
@@ -556,14 +549,7 @@ static HTML_CharEntry aHTMLCharNameTab[] = {
 extern "C"
 {
 
-static int
-#if defined( WNT )
- __cdecl
-#endif
-#if defined( ICC ) && defined( OS2 )
- _Optlink
-#endif
-    HTMLCharNameCompare( const void *pFirst, const void *pSecond)
+static int SAL_CALL HTMLCharNameCompare( const void *pFirst, const void *pSecond)
 {
     int nRet = 0;
     if( USHRT_MAX == ((HTML_CharEntry*)pFirst)->cChar )
@@ -598,7 +584,7 @@ sal_Unicode GetHTMLCharName( const String& rName )
                 sizeof( aHTMLCharNameTab ) / sizeof( HTML_CharEntry ),
                 sizeof( HTML_CharEntry ),
                 HTMLCharNameCompare );
-        bSortCharKeyWords = sal_True;
+        bSortCharKeyWords = true;
     }
 
     sal_Unicode cRet = 0;
@@ -617,7 +603,7 @@ sal_Unicode GetHTMLCharName( const String& rName )
 }
 
 // Flag: Options table has already been sorted
-static int bSortOptionKeyWords = sal_False;
+static bool bSortOptionKeyWords = false;
 
 static HTML_TokenEntry aHTMLOptionTab[] = {
 
@@ -829,7 +815,7 @@ int GetHTMLOption( const String& rName )
                 sizeof( aHTMLOptionTab ) / sizeof( HTML_TokenEntry ),
                 sizeof( HTML_TokenEntry ),
                 HTMLKeyCompare );
-        bSortOptionKeyWords = sal_True;
+        bSortOptionKeyWords = true;
     }
 
     int nRet = HTML_O_UNKNOWN;
@@ -859,7 +845,7 @@ struct HTML_ColorEntry
 };
 
 // Flag: color table has already been sorted
-static int bSortColorKeyWords = sal_False;
+static bool bSortColorKeyWords = false;
 
 #define HTML_NO_COLOR 0xffffffffUL
 
@@ -1012,14 +998,7 @@ static HTML_ColorEntry aHTMLColorNameTab[] = {
 extern "C"
 {
 
-static int
-#if defined( WNT )
- __cdecl
-#endif
-#if defined( ICC ) && defined( OS2 )
- _Optlink
-#endif
-    HTMLColorNameCompare( const void *pFirst, const void *pSecond)
+static int SAL_CALL HTMLColorNameCompare( const void *pFirst, const void *pSecond)
 {
     int nRet = 0;
     if( HTML_NO_COLOR == ((HTML_ColorEntry*)pFirst)->nColor )
@@ -1054,7 +1033,7 @@ sal_uInt32 GetHTMLColor( const String& rName )
                 sizeof( aHTMLColorNameTab ) / sizeof( HTML_ColorEntry ),
                 sizeof( HTML_ColorEntry ),
                 HTMLColorNameCompare );
-        bSortColorKeyWords = sal_True;
+        bSortColorKeyWords = true;
     }
 
     sal_uInt32 nRet = HTML_NO_COLOR;
-- 
1.7.0.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.