From: Werner Koch Date: Sun, 15 Feb 2004 16:02:36 +0000 (+0000) Subject: (memrchr): Fixed implementation. Problem pointed out X-Git-Tag: gpgme-1.2.0@1385~483 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=80997967c501c0a911ddbd42d67b0db95a3c96a6;p=gpgme.git (memrchr): Fixed implementation. Problem pointed out by Adriaan de Groot. --- diff --git a/trunk/ChangeLog b/trunk/ChangeLog index fbb131d..30f8749 100644 --- a/trunk/ChangeLog +++ b/trunk/ChangeLog @@ -1,3 +1,7 @@ +2004-02-11 Werner Koch + + * autogen.sh (check_version): Removed bashism and simplified. + 2004-02-10 Werner Koch * configure.ac: Fixed funopen test change. diff --git a/trunk/THANKS b/trunk/THANKS index 414927b..8a63d28 100644 --- a/trunk/THANKS +++ b/trunk/THANKS @@ -1,4 +1,5 @@ +Adriaan de Groot adridg@cs.kun.nl Alfons Hoogervorst alfons@proteus.demon.nl Enno Cramer uebergeek@web.de Frank Heckenbach frank@g-n-u.de @@ -12,7 +13,7 @@ Timo Schulz twoaday@freakmail.de Tommy Reynolds reynolds@redhat.com - Copyright 2001, 2002 g10 Code GmbH + Copyright 2001, 2002, 2004 g10 Code GmbH This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without diff --git a/trunk/autogen.sh b/trunk/autogen.sh index 4f1205c..81061e3 100755 --- a/trunk/autogen.sh +++ b/trunk/autogen.sh @@ -18,7 +18,7 @@ cvtver () { } check_version () { - if [ $(( `("$1" --version || echo "0") | cvtver` >= $2 )) == 1 ]; then + if [ `("$1" --version || echo "0") | cvtver` -ge "$2" ]; then return 0 fi echo "**Error**: "\`$1\'" not installed or too old." >&2 diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index d21819a..065f8cd 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,3 +1,8 @@ +2004-02-15 Werner Koch + + * memrchr.c (memrchr): Fixed implementation. Problem pointed out + by Adriaan de Groot. + 2004-02-01 Marcus Brinkmann * rungpg.c (build_argv): Use --no-comment, not --comment "". diff --git a/trunk/gpgme/memrchr.c b/trunk/gpgme/memrchr.c index 3e60c55..41d38ae 100644 --- a/trunk/gpgme/memrchr.c +++ b/trunk/gpgme/memrchr.c @@ -1,5 +1,5 @@ /* memrchr.c - Replacement for memrchr. - * Copyright (C) 2002 Free Software Foundation, Inc. + * Copyright (C) 2002, 2004 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -27,10 +27,13 @@ void * memrchr (const void *block, int c, size_t size) { - void *p; + const unsigned char *p = block; - for (p = block + size; p != block; p --) - if (*p == c) - return p; - return 0; + if (size) + { + for (p += size - 1; size; p--, size--) + if (*p == c) + return (void *)p; + } + return NULL; }