From 928e334831f87dfe3b35b50e119b0ade9980b944 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Wed, 26 Jun 2002 21:11:29 +0000 Subject: Added id3 tracknum (Yusef Napora) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1204 a1c6a512-1295-4272-9138-f99709370657 --- firmware/common/atoi.c | 31 +++++++++++++++++++++++++++++++ firmware/common/atoi.h | 25 +++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 firmware/common/atoi.c create mode 100644 firmware/common/atoi.h (limited to 'firmware/common') diff --git a/firmware/common/atoi.c b/firmware/common/atoi.c new file mode 100644 index 0000000000..4911d93e92 --- /dev/null +++ b/firmware/common/atoi.c @@ -0,0 +1,31 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2002 by Gary Czvitkovicz + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "string.h" + +int atoi (const char *str) +{ + int val = 0, mlt = 1; + char *p; + p = (char *) (str + strlen(str) - 1); + for (; p >= str; --p, mlt *=10) + val += (mlt * ((int)*p - '0')); + return val; +} + diff --git a/firmware/common/atoi.h b/firmware/common/atoi.h new file mode 100644 index 0000000000..118879622b --- /dev/null +++ b/firmware/common/atoi.h @@ -0,0 +1,25 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2002 by Felix Arends + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef __ATOI_H__ +#define __ATOI_H__ + +int atoi (const char *str); + +#endif /* __ATOI_H__ */ -- cgit v1.2.3