Bug 59247 - KPilot doesn't compile because of wrong SysInfo struct
Summary: KPilot doesn't compile because of wrong SysInfo struct
Status: RESOLVED FIXED
Alias: None
Product: kpilot
Classification: Applications
Component: General (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: groot
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-02 11:24 UTC by Thomas Vollmer
Modified: 2004-10-19 16:20 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 Thomas Vollmer 2003-06-02 11:24:31 UTC
Version:           CVS from 02.06.2003 11:00 AM (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 3.2 
OS:          Linux

Compilation fails with following error message:

depmode=gcc3 /bin/sh ../../admin/depcomp \
/bin/sh ../../libtool --silent --mode=compile --tag=CXX g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I/opt/kde-cvs/include -I/usr/lib/qt3-kde/include -I/usr/X11R6/include    -DQT_THREAD_SUPPORT -O2 -march=pentium4 -mfpmath=sse -msse2 -D_REENTRANT  -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -pedantic -W -Wpointer-arith -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -O2 -O2 -march=pentium4 -mfpmath=sse -msse2 -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION -DDEBUG -c -o kpilotlink.lo `test -f 'kpilotlink.cc' || echo './'`kpilotlink.cc
In file included from kpilotlink.cc:62:
pilotSysInfo.h: In member function `const int
   KPilotSysInfo::getProductIDLength() const':
pilotSysInfo.h:61: `struct SysInfo' has no member named `prodIDLength'
pilotSysInfo.h: In member function `const char* KPilotSysInfo::getProductID()
   const':
pilotSysInfo.h:62: `struct SysInfo' has no member named `prodID'
pilotSysInfo.h: In member function `void KPilotSysInfo::setProductID(char*)':
pilotSysInfo.h:65: `struct SysInfo' has no member named `prodID'
pilotSysInfo.h:65: `struct SysInfo' has no member named `prodID'
pilotSysInfo.h:66: `struct SysInfo' has no member named `prodID'
pilotSysInfo.h:66: `struct SysInfo' has no member named `prodID'
pilotSysInfo.h:68: `struct SysInfo' has no member named `prodIDLength'
pilotSysInfo.h:68: `struct SysInfo' has no member named `prodID'
pilotSysInfo.h: In member function `const short unsigned int
   KPilotSysInfo::getMajorVersion() const':
pilotSysInfo.h:71: `struct SysInfo' has no member named `dlpMajorVersion'
pilotSysInfo.h: In member function `const short unsigned int
   KPilotSysInfo::getMinorVersion() const':
pilotSysInfo.h:72: `struct SysInfo' has no member named `dlpMinorVersion'
pilotSysInfo.h: In member function `const short unsigned int
   KPilotSysInfo::getCompatMajorVersion() const':
pilotSysInfo.h:73: `struct SysInfo' has no member named `compatMajorVersion'
pilotSysInfo.h: In member function `const short unsigned int
   KPilotSysInfo::getCompatMinorVersion() const':
pilotSysInfo.h:74: `struct SysInfo' has no member named `compatMinorVersion'
pilotSysInfo.h: In member function `const short unsigned int
   KPilotSysInfo::getMaxRecSize() const':
pilotSysInfo.h:75: `struct SysInfo' has no member named `maxRecSize'
make[3]: *** [kpilotlink.lo] Fehler 1
make[3]: Verlassen des Verzeichnisses 
Comment 1 groot 2003-06-02 12:45:52 UTC
Subject: Re:  New: KPilot doesn't compile because of wrong SysInfo
 struct         

On 2 Jun 2003, Thomas Vollmer wrote:
> pilotSysInfo.h:62: `struct SysInfo' has no member named `prodID'
> pilotSysInfo.h: In member function `void KPilotSysInfo::setProductID(char*)':

Which pilot-link version are you using? My version (0.11.7) certainly does
have the fields, so perhaps we've forgotten about backwards compatibility
with older pilot-link versions.

Comment 2 Thomas Vollmer 2003-06-02 13:06:02 UTC
Subject: Re:

Well, it is 0.9.5. This is the original package delivered by SuSE for 
their 8.1 professional distribution.

Thomas Vollmer
Comment 3 Reinhold Kainhofer 2003-06-02 13:33:05 UTC
Subject: Re:  KPilot doesn't compile because of wrong SysInfo struct

Yes, pilot-link 0.9.5 doesn't have prodID and prodIDlength, but they have name 
and nameLength. I added a #if check to the code and use the appropriate code 
depending on the pilot-link version. This should fix the bug (but I don't 
have a system with pilot-link 0.9.x installed, so I'm just hoping that it 
compiles...). 
Can you please check if it compiles now?

Thanks,
Reinhold
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+2zXpTqjEwhXvPN0RAt34AKCQHdCAR5LmT+7F3fQJvRcrUAIJtwCeL8Y9
bsuYyL8Zkvqh67Y27IdgCy8=
=VnJO
-----END PGP SIGNATURE-----

Comment 4 Reinhold Kainhofer 2003-06-02 13:33:33 UTC
Subject: kdepim/kpilot/lib

CVS commit by kainhofe: 

Argh, why does pilot-link change their API with every version??? 
CCMAIL: 59247-done@bugs.kde.org


  M +23 -2     pilotSysInfo.h   1.2


--- kdepim/kpilot/lib/pilotSysInfo.h  #1.1:1.2
@@ -33,7 +33,6 @@
 #include <time.h>
 
-#ifndef _PILOT_DLP_H_
 #include <pi-dlp.h>
-#endif
+#include <pi-version.h>
 
 class KPilotSysInfo
@@ -59,4 +58,24 @@ public:
         void setLocale(unsigned long newval)  {fSysInfo.locale=newval;}
 
+#if (PILOT_LINK_VERSION * 1000 + PILOT_LINK_MAJOR * 10 + PILOT_LINK_MINOR) < 100
+// Older pilot-link versions < 0.11.x don't have prodID, but name instead, 
+// and they also do not have the *Version members.
+        const int getProductIDLength() const { return fSysInfo.nameLength; }
+        const char* getProductID() const     { return fSysInfo.name; }
+        void setProductID(char* prodid)
+        {
+                ::memset(&fSysInfo.name, 0, sizeof(fSysInfo.name));
+                ::strncpy(fSysInfo.name, prodid, sizeof(fSysInfo.name)-1);
+                boundsCheck();
+                fSysInfo.nameLength = ::strlen(fSysInfo.name);
+        }
+
+        const unsigned short getMajorVersion() const {return 0;}
+        const unsigned short getMinorVersion() const {return 0;}
+        const unsigned short getCompatMajorVersion() const {return 0;}
+        const unsigned short getCompatMinorVersion() const {return 0;}
+        const unsigned short getMaxRecSize() const {return 0;}
+#else
+// Newer pilot-link versions have these fields, so use them:
         const int getProductIDLength() const { return fSysInfo.prodIDLength; }
         const char* getProductID() const     { return fSysInfo.prodID; }
@@ -74,4 +93,6 @@ public:
         const unsigned short getCompatMinorVersion() const {return fSysInfo.compatMinorVersion;}
         const unsigned short getMaxRecSize() const {return fSysInfo.maxRecSize;}
+#endif
+
 private:
         struct SysInfo fSysInfo;


Comment 5 Thomas Vollmer 2003-06-02 13:45:06 UTC
Subject: Re:

It is good now (or with other words it compiles now). If it's not 
perfect I reopen the bug ;-)