Bug 114340 - Compile error on Solaris 2.9 in date_object.cpp
Summary: Compile error on Solaris 2.9 in date_object.cpp
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: kjs (show other bugs)
Version: unspecified
Platform: Compiled Sources Solaris
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-13 16:33 UTC by Bernd Kuhls
Modified: 2005-10-28 16:30 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
solaris date_object.cpp patch (1.04 KB, patch)
2005-10-13 22:27 UTC, Jaime Peñalba
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bernd Kuhls 2005-10-13 16:33:08 UTC
Version:            (using KDE KDE 3.4.3)
Installed from:    Compiled From Sources
Compiler:          gcc-3.3.5 
OS:                Solaris

make[2]: Entering directory `/disk/sunray/sd2h/local/lude/soft/KDE-3.4.3/src/orig/kdelibs-3.4.3/kjs'
if /bin/bash ../libtool --silent --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../dcop -I../kdecore -I../kio/kssl -I.. -I/usr/local2/lude/soft/pcre-4.5/run/default/sparc_sun_solaris2.9/include -I../dcop -I../libltdl -I../kdefx -I../kdecore -I../kdecore -I../kdeui -I../kio -I../kio/kio -I../kio/kfile -I.. -I/usr/local/qt-050201/include  -I/usr/local/KDE-3.4.3/include   -DQT_THREAD_SUPPORT  -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4  -Wno-long-long -Wundef -Wall -W -Wpointer-arith -DNDEBUG -DNO_DEBUG -O2 -Wno-non-virtual-dtor -fno-exceptions -fno-check-new -fno-common  -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION  -MT date_object.lo -MD -MP -MF ".deps/date_object.Tpo" -c -o date_object.lo date_object.cpp; \
then mv -f ".deps/date_object.Tpo" ".deps/date_object.Plo"; else rm -f ".deps/date_object.Tpo"; exit 1; fi
date_object.cpp: In function `KJS::UString formatTime(tm&)':
date_object.cpp:99: error: 'struct tm' has no member named 'tm_gmtoff'
date_object.cpp:102: error: 'struct tm' has no member named 'tm_gmtoff'
date_object.cpp:108: error: 'struct tm' has no member named 'tm_gmtoff'
date_object.cpp: In member function `virtual KJS::Value
   KJS::DateProtoFuncImp::call(KJS::ExecState*, KJS::Object&, const KJS::List&)
   ':
date_object.cpp:465: warning: `%c' yields only last 2 digits of year in some
   locales
date_object.cpp:469: warning: `%x' yields only last 2 digits of year in some
   locales
make[2]: *** [date_object.lo] Error 1
make[2]: Leaving directory `/disk/sunray/sd2h/local/lude/soft/KDE-3.4.3/src/orig/kdelibs-3.4.3/kjs'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/disk/sunray/sd2h/local/lude/soft/KDE-3.4.3/src/orig/kdelibs-3.4.3'
make: *** [all] Error 2
Comment 1 Jaime Peñalba 2005-10-13 22:27:37 UTC
Created attachment 12979 [details]
solaris date_object.cpp patch

Same for me using gcc 3.4.3.

This patch should fix the compilation problem, and hopefully formatTime will
still work.
Comment 2 Bernd Kuhls 2005-10-20 09:57:16 UTC
Your patch creates another bug on Solaris 9/Sparc:
if /bin/bash ../libtool --silent --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../dcop -I../kdecore -I../kio/kssl -I. -I/usr/local2/lude/soft/pcre-4.5/run/default/sparc_sun_solaris2.9/include -I../dcop -I../libltdl -I../kdefx -I../kdecore -I../kdecore -I../kdeui -I../kio -I../kio/kio -I../kio/kfile -I.. -I/usr/local/qt-050201/include  -I/usr/local/KDE-3.5b2/include   -DQT_THREAD_SUPPORT  -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4  -Wno-long-long -Wundef -Wall -W -Wpointer-arith -DNDEBUG -DNO_DEBUG -O2 -Wno-non-virtual-dtor -fno-exceptions -fno-check-new -fno-common  -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION  -MT date_object.lo -MD -MP -MF ".deps/date_object.Tpo" -c -o date_object.lo date_object.cpp; \
then mv -f ".deps/date_object.Tpo" ".deps/date_object.Plo"; else rm -f ".deps/date_object.Tpo"; exit 1; fi
date_object.cpp:71: error: `LONG_MIN' was not declared in this scope
date_object.cpp: In member function `virtual KJS::Value
   KJS::DateProtoFuncImp::call(KJS::ExecState*, KJS::Object&, const KJS::List&)
   ':
date_object.cpp:481: warning: `%c' yields only last 2 digits of year in some
   locales
date_object.cpp:485: warning: `%x' yields only last 2 digits of year in some
   locales
Comment 3 George Staikos 2005-10-22 02:51:18 UTC
SVN commit 472803 by staikos:

fix two solaris compile bugs
BUGS: 114340,114759


 M  +14 -3     date_object.cpp  


--- branches/KDE/3.5/kdelibs/kjs/date_object.cpp #472802:472803
@@ -54,6 +54,7 @@
 #include <locale.h>
 #include <ctype.h>
 #include <assert.h>
+#include <limits.h>
 
 #include "date_object.h"
 #include "error_object.h"
@@ -99,17 +100,27 @@
 
 static UString formatTime(struct tm &tm)
 {
+    int tz;
     char buffer[100];
-    if (tm.tm_gmtoff == 0) {
+#if defined BSD || defined(__linux__) || defined(__APPLE__)
+    tz = tm.tm_gmtoff;
+#else
+#  if defined(__BORLANDC__)
+    tz = - _timezone;
+#  else
+    tz = - timezone;
+#  endif
+#endif
+    if (tz == 0) {
         snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT", tm.tm_hour, tm.tm_min, tm.tm_sec);
     } else {
-        int offset = tm.tm_gmtoff;
+        int offset = tz;
         if (offset < 0) {
             offset = -offset;
         }
         snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT%c%02d%02d",
                 tm.tm_hour, tm.tm_min, tm.tm_sec,
-                tm.tm_gmtoff < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60);
+                tz < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60);
     }
     return UString(buffer);
 }
Comment 4 Bernd Kuhls 2005-10-28 16:30:12 UTC
Confirmed fixed, thanks