From b8e421d8df28d68967f8b5eea5a1191ec767d29c Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Sun, 9 Jan 2005 20:34:12 +0000 Subject: [PATCH] Fix for "my libc doesn't have atoll" bug. --- configure.in | 2 ++ src/Makefile.am | 3 ++- src/atoll.c | 24 ++++++++++++++++++++++++ src/atoll.h | 7 +++++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/atoll.c create mode 100644 src/atoll.h diff --git a/configure.in b/configure.in index aaa1f31e..cb3e041a 100644 --- a/configure.in +++ b/configure.in @@ -56,6 +56,7 @@ AM_CONDITIONAL(COND_OGGVORBIS, test x$use_oggvorbis = xtrue) AM_CONDITIONAL(COND_NEED_STRCASESTR,false) AM_CONDITIONAL(COND_NEED_STRSEP,false) +AM_CONDITIONAL(COND_NEED_ATOLL,false) dnl Darwin's stupid cpp preprocessor.... echo Host type is $host @@ -195,6 +196,7 @@ fi AC_REPLACE_FUNCS(strcasestr) AC_REPLACE_FUNCS(strsep) +AC_REPLACE_FUNCS(atoll) dnl Checks for header files. AC_HEADER_STDC diff --git a/src/Makefile.am b/src/Makefile.am index 1115ba96..b2420026 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,10 +28,11 @@ mt_daapd_SOURCES = main.c daapd.h rend.h uici.c uici.h webserver.c \ mp3-scanner.h mp3-scanner.c playlist.c playlist.h \ rend-unix.h lexer.l parser.y strcasestr.c strcasestr.h strsep.c \ redblack.c redblack.h dynamic-art.c dynamic-art.h query.c query.h \ + atoll.c atoll.h \ $(PRENDSRC) $(ORENDSRC) $(HRENDSRC) $(OGGVORBISSRC) EXTRA_DIST = mDNS.c mDNSClientAPI.h mDNSDebug.h mDNSPosix.c \ mDNSUNP.c mDNSPlatformFunctions.h mDNSPosix.h mDNSUNP.h \ - rend-howl.c rend-posix.c rend-osx.c strcasestr.c strsep.c db-memory.c \ + rend-howl.c rend-posix.c rend-osx.c db-memory.c \ db-gdbm.c strcasestr.h redblack.c redblack.h db-memory.c \ parser.h ogg.c diff --git a/src/atoll.c b/src/atoll.c new file mode 100644 index 00000000..f33be858 --- /dev/null +++ b/src/atoll.c @@ -0,0 +1,24 @@ +/* + * $Id$ + * + * The only platform I know without atoll is OSX 10.2, and it has + * 32 bit inodes, so this will be a fine workaround until such time + * as I move away from inodes as db index. + * + * Weak, I know. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include + +#if !HAVE_ATOLL + +long long atoll(const char *nptr) { + return (long long)atol(nptr); +} + +#endif /* !HAVE_ATOLL */ diff --git a/src/atoll.h b/src/atoll.h new file mode 100644 index 00000000..1217d957 --- /dev/null +++ b/src/atoll.h @@ -0,0 +1,7 @@ +#ifndef _ATOLL_H_ +#defien _ATOLL_H_ + +extern long long atoll(const char *nptr); + +#endif /* _ATOLL_H_ */ +