X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fatoin.c;h=e9b20e64be39078608bc7b28211c59ef5cf2c31f;hb=5c3d2d2ab097e4bb59ba5718a396b020a2d302c0;hp=1bc5947e8f433fa9a4ddd8789bff3d6be3060738;hpb=c6e47cbbff56f39f6d81b079ebaeac41d793d4d9;p=yaz-moved-to-github.git diff --git a/src/atoin.c b/src/atoin.c index 1bc5947..e9b20e6 100644 --- a/src/atoin.c +++ b/src/atoin.c @@ -1,8 +1,13 @@ /* - * Copyright (c) 1997-2003, Index Data + * Copyright (c) 1997-2004, Index Data * See the file LICENSE for details. * - * $Id: atoin.c,v 1.1 2003-10-27 12:21:30 adam Exp $ + * $Id: atoin.c,v 1.5 2004-12-16 08:59:56 adam Exp $ + */ + +/** + * \file atoin.c + * \brief Implements atoi_n function. */ #if HAVE_CONFIG_H @@ -11,15 +16,18 @@ #include #include -#include +#include +/** + * atoi_n: like atoi but reads at most len characters. + */ int atoi_n (const char *buf, int len) { int val = 0; while (--len >= 0) { - if (isdigit (*buf)) + if (isdigit (*(const unsigned char *) buf)) val = val*10 + (*buf - '0'); buf++; }