Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Build warnings



Hi Marc,

Please note that the bzero(), bcopy() and bcmp() functions
are not standard ISO C and are marked LEGACY in POSIX.
It is better to replace them with the
memset(,0,), memcpy() and memcmp() functions respectively.

Best regards,
Manuel


On Thursday 15 March 2007 02:17, Marc Krochmal wrote:
> Hi Igor,
>
> Thanks for the fix.  I filed the following bug report to track the
> change.
>
> <rdar://problem/5064572> POSIX: Build warnings with mDNSResponder-107.6
>
> The problem is that anytime we make changes like this we always break
> some platform.  Hopefully that won't happen this time.
>
> Best Regards,
>
> -Marc
>
> On Mar 10, 2007, at 5:51 AM, Igor Seleznev wrote:
> > Hi,
> >
> > Building my 107.6 version gives the following warnings:
> >
> > =======Solaris
> > PosixDaemon.c: In function `ParseCmdLinArgs':
> > PosixDaemon.c:169: warning: implicit declaration of function `daemon'
> > PosixDaemon.c: In function `main':
> > PosixDaemon.c:234: warning: implicit declaration of function `bzero'
> > mDNSPosix.c: In function `mDNSPosixListenForSignalInEventLoop':
> > mDNSPosix.c:1689: warning: implicit declaration of function `bzero'
> > mDNSUNP.c: In function `daemon':
> > mDNSUNP.c:744: warning: implicit declaration of function `signal'
> > ../mDNSShared/uds_daemon.c: In function `udsserver_init':
> > ../mDNSShared/uds_daemon.c:993: warning: implicit declaration of
> > function `bzero'
> > ../mDNSShared/dnssd_clientstub.c: In function `create_hdr':
> > ../mDNSShared/dnssd_clientstub.c:328: warning: implicit declaration
> > of function `bzero'
> > Responder.c: In function `main':
> > Responder.c:727: warning: implicit declaration of function `daemon'
> > NetMonitor.c: In function `main':
> > NetMonitor.c:1158: warning: implicit declaration of function `bcopy'
> > dnsextd.c: In function `ConnectToServer':
> > dnsextd.c:402: warning: implicit declaration of function `bzero'
> > dnsextd.c: In function `main':
> > dnsextd.c:2095: warning: implicit declaration of function `daemon'
> > =======RedHat
> > PosixDaemon.c:271: warning: long int format, different type arg
> > (arg 2)
> >
> >
> > The changes below fix them all, and it compiles with no warnings
> > after that under RedHat/Solaris.
> > Please, consider applying this patch.
> >
> >
> > Index: src/mDNSPosix/NetMonitor.c
> > ===================================================================
> > --- src/mDNSPosix/NetMonitor.c  (revision 315)
> > +++ src/mDNSPosix/NetMonitor.c  (working copy)
> > @@ -308,7 +308,8 @@
> >
> > #include <stdio.h>         // For printf()
> > #include <stdlib.h>            // For malloc()
> > -#include <string.h>            // For bcopy()
> > +#include <string.h>            // For strcmp(), strrchr()
> > +#include <strings.h>       // For bcopy(), bzero()
> > #include <time.h>          // For "struct tm" etc.
> > #include <signal.h>            // For SIGINT, SIGTERM
> > #include <netdb.h>         // For gethostbyname()
> > Index: src/mDNSPosix/Responder.c
> > ===================================================================
> > --- src/mDNSPosix/Responder.c   (revision 315)
> > +++ src/mDNSPosix/Responder.c   (working copy)
> > @@ -123,6 +123,7 @@
> >
> > #include "mDNSEmbeddedAPI.h"// Defines the interface to the client
> > layer
> > above
> > #include "mDNSPosix.h"    // Defines the specific types needed to
> > run mDNS
> > on this platform
> > +#include "mDNSUNP.h"       // For daemon()
> >
> > #include <assert.h>
> > #include <stdio.h>         // For printf()
> > Index: src/mDNSPosix/dnsextd.c
> > ===================================================================
> > --- src/mDNSPosix/dnsextd.c (revision 315)
> > +++ src/mDNSPosix/dnsextd.c (working copy)
> > @@ -138,6 +138,7 @@
> > #include "../mDNSCore/mDNSEmbeddedAPI.h"
> > #include "../mDNSCore/DNSCommon.h"
> > #include "../mDNSCore/mDNS.c"
> > +#include "mDNSUNP.h"        // For daemon()
> > //!!!KRS we #include mDNS.c for the various constants defined
> > there  - we
> > should move these to DNSCommon.h
> >
> > #include <signal.h>
> > @@ -151,6 +152,7 @@
> > #include <stdio.h>
> > #include <syslog.h>
> > #include <string.h>
> > +#include <strings.h>        // For bzero()
> > #include <sys/time.h>
> > #include <time.h>
> > #include <errno.h>
> > Index: src/mDNSPosix/mDNSUNP.c
> > ===================================================================
> > --- src/mDNSPosix/mDNSUNP.c (revision 315)
> > +++ src/mDNSPosix/mDNSUNP.c (working copy)
> > @@ -728,7 +728,7 @@
> > #ifdef NOT_HAVE_DAEMON
> > #include <fcntl.h>
> > #include <sys/stat.h>
> > -#include <sys/signal.h>
> > +#include <signal.h>
> >
> > int daemon(int nochdir, int noclose)
> >     {
> > Index: src/mDNSPosix/mDNSPosix.c
> > ===================================================================
> > --- src/mDNSPosix/mDNSPosix.c   (revision 315)
> > +++ src/mDNSPosix/mDNSPosix.c   (working copy)
> > @@ -298,6 +298,7 @@
> > #include <stdlib.h>
> > #include <errno.h>
> > #include <string.h>
> > +#include <strings.h>                // For bzero()
> > #include <unistd.h>
> > #include <syslog.h>
> > #include <stdarg.h>
> > Index: src/mDNSPosix/PosixDaemon.c
> > ===================================================================
> > --- src/mDNSPosix/PosixDaemon.c (revision 315)
> > +++ src/mDNSPosix/PosixDaemon.c (working copy)
> > @@ -119,6 +119,7 @@
> >
> > #include <stdio.h>
> > #include <string.h>
> > +#include <strings.h>        // For bzero()
> > #include <unistd.h>
> > #include <stdlib.h>
> > #include <signal.h>
> > @@ -130,6 +131,7 @@
> > #include "mDNSEmbeddedAPI.h"
> > #include "mDNSDebug.h"
> > #include "mDNSPosix.h"
> > +#include "mDNSUNP.h"        // For daemon()
> > #include "uds_daemon.h"
> > #include "PlatformCommon.h"
> >
> > @@ -267,7 +269,7 @@
> >        LogMsg("ExitCallback: udsserver_exit failed");
> >
> >  #if MDNS_DEBUGMSGS > 0
> > -   printf("mDNSResponder exiting normally with %ld\n", err);
> > +   printf("mDNSResponder exiting normally with %ld\n", (long)err);
> >  #endif
> >
> >    return err;
> > Index: src/mDNSShared/dnssd_clientstub.c
> > ===================================================================
> > --- src/mDNSShared/dnssd_clientstub.c   (revision 315)
> > +++ src/mDNSShared/dnssd_clientstub.c   (working copy)
> > @@ -219,6 +219,7 @@
> > #include <sys/time.h>
> > #include <sys/socket.h>
> > #include <syslog.h>
> > +#include <strings.h>        // For bzero()
> >
> > #define sockaddr_mdns sockaddr_un
> > #define AF_MDNS AF_LOCAL
> > Index: src/mDNSShared/uds_daemon.c
> > ===================================================================
> > --- src/mDNSShared/uds_daemon.c (revision 315)
> > +++ src/mDNSShared/uds_daemon.c (working copy)
> > @@ -658,6 +658,7 @@
> > #include <sys/types.h>
> > #include <sys/time.h>
> > #include <sys/resource.h>
> > +#include <strings.h>        // For bzero()
> > #define dnssd_strerror(X)  strerror(X)
> > #endif
> >
> >
> > Kind regards,
> > Igor
> > _______________________________________________
> > Do not post admin requests to the list. They will be ignored.
> > Bonjour-dev mailing list      (email@hidden)
> > Help/Unsubscribe/Update your Subscription:
> > http://lists.apple.com/mailman/options/bonjour-dev/email@hidden
> >
> > This email sent to email@hidden
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Bonjour-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/bonjour-dev/manuels%40allieddata.n
>l
>
> This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Bonjour-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/bonjour-dev/email@hidden

This email sent to email@hidden

References: 
 >Build warnings (From: "Igor Seleznev" <email@hidden>)
 >Re: Build warnings (From: Marc Krochmal <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.