Bug 145502 - Compile error on Solaris 8 - kdepimlibs/kmime/kmime_util.cpp uses strcasestr which doesn't exist
Summary: Compile error on Solaris 8 - kdepimlibs/kmime/kmime_util.cpp uses strcasestr ...
Status: RESOLVED FIXED
Alias: None
Product: kontact
Classification: Applications
Component: mail (show other bugs)
Version: unspecified
Platform: Compiled Sources Solaris
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-16 15:22 UTC by Steve Evans
Modified: 2007-05-17 16:53 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Evans 2007-05-16 15:22:17 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 3.4.6 
OS:                Solaris

(This is bug is in kdepimlibs, but there is no application value for it in bugs.kde.org)

I get this compile error on Solaris:

[ 79%] Building CXX object kmime/CMakeFiles/kmime.dir/kmime_util.o
/cad4/stevee/kde-svn/kdepimlibs/kmime/kmime_util.cpp: In function `QByteArray KMime::extractHeader(const QByteArray&, const QByteArray&)':
/cad4/stevee/kde-svn/kdepimlibs/kmime/kmime_util.cpp:353: error: `strcasestr' was not declared in this scope

The function strcasestr is not available on Solaris. In fact it is probably only available on Linux, as the Linux man page for it says "The strcasestr() function is a non-standard extension."
Comment 1 Volker Krause 2007-05-17 16:53:56 UTC
SVN commit 665647 by vkrause:

Build on systems without strcasestr().
The non-strcasestr code is not optimized at all and about 15x slower.

BUG: 145502


 M  +15 -14    CMakeLists.txt  
 M  +2 -0      config-kmime.h.cmake  
 M  +6 -0      kmime_util.cpp  


--- trunk/KDE/kdepimlibs/kmime/CMakeLists.txt #665646:665647
@@ -5,28 +5,29 @@
 )
 
 include(CheckTimezone)
+check_function_exists(strcasestr HAVE_STRCASESTR)
 configure_file (config-kmime.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kmime.h)
 
 ########### next target ###############
 
 set(kmime_LIB_SRCS
-   kmime_charfreq.cpp 
-   kmime_util.cpp 
-   kmime_mdn.cpp 
-   kmime_codecs.cpp 
-   kmime_codec_base64.cpp 
-   kmime_codec_uuencode.cpp 
-   kmime_codec_qp.cpp 
-   kmime_codec_identity.cpp 
-   kmime_parsers.cpp 
-   kmime_header_parsing.cpp 
+   kmime_charfreq.cpp
+   kmime_util.cpp
+   kmime_mdn.cpp
+   kmime_codecs.cpp
+   kmime_codec_base64.cpp
+   kmime_codec_uuencode.cpp
+   kmime_codec_qp.cpp
+   kmime_codec_identity.cpp
+   kmime_parsers.cpp
+   kmime_header_parsing.cpp
    kmime_content.cpp
    kmime_contentindex.cpp
-   kmime_headers.cpp 
-   kmime_message.cpp 
-   kmime_newsarticle.cpp 
+   kmime_headers.cpp
+   kmime_message.cpp
+   kmime_newsarticle.cpp
    kmime_dateformatter.cpp
-   boolflags.cpp 
+   boolflags.cpp
    kautodeletehash.cpp )
 
 kde4_automoc(${kmime_LIB_SRCS})
--- trunk/KDE/kdepimlibs/kmime/config-kmime.h.cmake #665646:665647
@@ -4,3 +4,5 @@
 /* Define if you have a tm_gmtoff member in struct tm */
 #cmakedefine HAVE_TM_GMTOFF 1
 
+/* Define if strcasestr is available */
+#cmakedefine HAVE_STRCASESTR 1
--- trunk/KDE/kdepimlibs/kmime/kmime_util.cpp #665646:665647
@@ -38,6 +38,8 @@
 #include "kmime_util.h"
 #include "kmime_header_parsing.h"
 
+#include "config-kmime.h"
+
 using namespace KMime;
 
 namespace KMime {
@@ -350,11 +352,15 @@
     pos1 = 0;
   } else {
     n.prepend('\n');
+#ifdef HAVE_STRCASESTR
     const char* p = strcasestr( src.constData(), n.constData() );
     if ( !p )
       pos1 = -1;
     else
       pos1 = p - src.constData();
+#else
+    pos1 = src.toLower().indexOf( n.toLower() );
+#endif
   }
 
   if ( pos1 > -1) {     //there is a header with the given name