Version: (using KDE Devel) Installed from: Compiled sources Compiler: gcc (GCC) 4.1.2 20060901 (prerelease) (Debian 4.1.1-13) OS: Linux compiling /home/hasso/source/kdelibs/dnssd/remoteservice.cpp g++ -DHAVE_CONFIG_H -I../dnssd -I/home/hasso/source/kdelibs/dnssd -I.. -I/home/hasso/source/kdelibs -I/home/hasso/source/kdelibs/dcop -I/home/hasso/source/kdelibs/libltdl -I/home/hasso/source/kdelibs/kdefx -I../kdecore -I/home/hasso/source/kdelibs/kdecore -I/home/hasso/source/kdelibs/kdeui -I/home/hasso/source/kdelibs/kio -I/home/hasso/source/kdelibs/kio/kio -I/home/hasso/source/kdelibs/kio/kfile -I/home/hasso/source/kdelibs -I/usr/local/qt-copy/include -I. -I/usr/local/kde/include -DQT_THREAD_SUPPORT -D_REENTRANT -Wno-long-long -Wundef -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -O2 -Wformat-security -Wmissing-format-attribute -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 -fPIC -DPIC -c /home/hasso/source/kdelibs/dnssd/remoteservice.cpp -o ../dnssd/.libs/remoteservice.o -Wp,-MD,../dnssd/.deps/remoteservice.TUlo /home/hasso/source/kdelibs/dnssd/remoteservice.cpp: In member function 'void DNSSD::RemoteService::resolveAsync()': /home/hasso/source/kdelibs/dnssd/remoteservice.cpp:105: error: invalid conversion from 'void (*)(_DNSServiceRef_t*, DNSServiceFlags, uint32_t, DNSServiceErrorType, const char*, const char*, uint16_t, uint16_t, const char*, void*)' to 'void (*)(_DNSServiceRef_t*, DNSServiceFlags, uint32_t, DNSServiceErrorType, const char*, const char*, uint16_t, uint16_t, const unsigned char*, void*)' /home/hasso/source/kdelibs/dnssd/remoteservice.cpp:105: error: initializing argument 7 of 'DNSServiceErrorType DNSServiceResolve(_DNSServiceRef_t**, DNSServiceFlags, uint32_t, const char*, const char*, const char*, void (*)(_DNSServiceRef_t*, DNSServiceFlags, uint32_t, DNSServiceErrorType, const char*, const char*, uint16_t, uint16_t, const unsigned char*, void*), void*)' Error creating ../dnssd/remoteservice.lo. Exit status 1. Comment from /usr/include/avahi-compat-libdns_sd/dns_sd.h header: NOTE: In earlier versions of this header file, the txtRecord parameter was declared "const char *" This is incorrect, since it contains length bytes which are values in the range 0 to 255, not -128 to +127. Depending on your compiler settings, this change may cause signed/unsigned mismatch warnings. These should be fixed by updating your own callback function definition to match the corrected function signature using "const unsigned char *txtRecord". Making this change may also fix inadvertent bugs in your callback function, where it could have incorrectly interpreted a length byte with value 250 as being -6 instead, with various bad consequences ranging from incorrect operation to software crashes. If you need to maintain portable code that will compile cleanly with both the old and new versions of this header file, you should update your callback function definition to use the correct unsigned value, and then in the place where you pass your callback function to DNSServiceResolve(), use a cast to eliminate the compiler warning, e.g.: DNSServiceResolve(sd, flags, index, name, regtype, domain, (DNSServiceResolveReply)MyCallback, context); This will ensure that your code compiles cleanly without warnings (and more importantly, works correctly) with both the old header and with the new corrected version.
Created attachment 17809 [details] Patch to fix the problem against 3.5 branch
*** Bug 138963 has been marked as a duplicate of this bug. ***
SVN commit 616448 by qbast: Make it compile with avahi-compat-dns_sd and newer versions of libdns_sd. Thanks to Hasso Tepper for the patch. Include config-dnssd.h instead of config.h so HAVE_DNSSD macro can actually be noticed. BUG: 134212 M +1 -1 publicservice.cpp M +4 -4 remoteservice.cpp M +1 -1 responder.h M +1 -1 servicebrowser.cpp --- trunk/KDE/kdelibs/dnssd/publicservice.cpp #616447:616448 @@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -#include "config.h" +#include <config-dnssd.h> #include "publicservice.h" #ifdef HAVE_SYS_TYPES_H --- trunk/KDE/kdelibs/dnssd/remoteservice.cpp #616447:616448 @@ -18,7 +18,7 @@ * Boston, MA 02110-1301, USA. */ -#include <config.h> +#include <config-dnssd.h> #include <qeventloop.h> #include <qapplication.h> @@ -43,7 +43,7 @@ const char *hosttarget, uint16_t port, uint16_t txtLen, - const char *txtRecord, + const unsigned char *txtRecord, void *context ); @@ -101,7 +101,7 @@ #ifdef HAVE_DNSSD DNSServiceRef ref; if (DNSServiceResolve(&ref,0,0,m_serviceName.toUtf8(), m_type.toAscii().constData(), - domainToDNS(m_domain),resolve_callback,reinterpret_cast<void*>(this)) + domainToDNS(m_domain),(DNSServiceResolveReply)resolve_callback,reinterpret_cast<void*>(this)) == kDNSServiceErr_NoError) d->setRef(ref); #endif if (!d->isRunning()) emit resolved(false); @@ -163,7 +163,7 @@ const char *hosttarget, uint16_t port, uint16_t txtLen, - const char *txtRecord, + const unsigned char *txtRecord, void *context ) { --- trunk/KDE/kdelibs/dnssd/responder.h #616447:616448 @@ -23,7 +23,7 @@ #include <qobject.h> #include <qsocketnotifier.h> -#include <config.h> +#include <config-dnssd.h> #ifdef HAVE_DNSSD #include <dns_sd.h> #else --- trunk/KDE/kdelibs/dnssd/servicebrowser.cpp #616447:616448 @@ -22,7 +22,7 @@ #include "domainbrowser.h" #include "query.h" #include "servicebrowser.h" -#include <config.h> +#include <config-dnssd.h> #include <QHash> #ifdef HAVE_DNSSD #include <dns_sd.h>