From 6e468be50e0dbd48e2b28128fb816b7eb55cd2bc Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Sun, 15 Feb 2004 16:02:36 +0000 Subject: [PATCH] (memrchr): Fixed implementation. Problem pointed out by Adriaan de Groot. --- ChangeLog | 4 ++++ THANKS | 3 ++- autogen.sh | 2 +- gpgme/ChangeLog | 5 +++++ gpgme/memrchr.c | 15 +++++++++------ 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index fbb131d..30f8749 100644 --- a/ChangeLog +++ b/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/THANKS b/THANKS index 414927b..8a63d28 100644 --- a/THANKS +++ b/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/autogen.sh b/autogen.sh index 4f1205c..81061e3 100755 --- a/autogen.sh +++ b/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/gpgme/ChangeLog b/gpgme/ChangeLog index d21819a..065f8cd 100644 --- a/gpgme/ChangeLog +++ b/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/gpgme/memrchr.c b/gpgme/memrchr.c index 3e60c55..41d38ae 100644 --- a/gpgme/memrchr.c +++ b/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; } -- 2.26.2