[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [FEATURE_REQUEST] support openssl checksum format too
From: |
Jim Meyering |
Subject: |
Re: [FEATURE_REQUEST] support openssl checksum format too |
Date: |
Sat, 03 Oct 2009 20:09:07 +0200 |
> Since the patch is really small I would like to ask you for a review
> without urging me to go through all the git stuff;
It's really not that hard.
Have you looked at the instructions here?
http://git.sv.gnu.org/cgit/coreutils.git/plain/HACKING
> if you accept the
> simple patch then I will follow up with the docs / NEWS update.
And a test, please.
Guenter Knauf wrote:
> - size_t i;
> + size_t i = 0;
> bool escaped_filename = false;
> size_t algo_name_len;
>
> - i = 0;
> while (ISWHITE (s[i]))
> ++i;
Instead, please move the declaration "down".
> @@ -263,11 +262,14 @@
> algo_name_len = strlen (DIGEST_TYPE_STRING);
> if (strncmp (s + i, DIGEST_TYPE_STRING, algo_name_len) == 0)
> {
> - if (strncmp (s + i + algo_name_len, " (", 2) == 0)
> + size_t j = i + algo_name_len;
> + while (ISWHITE (s[j]))
> + ++j;
That allows two or more white-space bytes.
Let's restrict it to just 0 or 1 space (not white-space) byte.
> + if (strncmp (s + j, "(", 1) == 0)
This would be better as:
if (s[j] == '(')
> {
> *binary = 0;
> - return bsd_split_3 (s + i + algo_name_len + 2,
> - s_len - (i + algo_name_len + 2),
> + return bsd_split_3 (s + j + 1, s_len - (j + 1),
> hex_digest, file_name);
> }
> }
> --- src/md5sum.c.orig 2009-09-01 13:01:16.000000000 +0200
> +++ src/md5sum.c 2009-10-03 19:13:27.000000000 +0200
> @@ -251,11 +251,10 @@
> split_3 (char *s, size_t s_len,
> unsigned char **hex_digest, int *binary, char **file_name)
> {
> - size_t i;
> + size_t i = 0;
> bool escaped_filename = false;
> size_t algo_name_len;
>
> - i = 0;
Same here.
> while (ISWHITE (s[i]))
> ++i;
>
> @@ -263,11 +262,14 @@
> algo_name_len = strlen (DIGEST_TYPE_STRING);
> if (strncmp (s + i, DIGEST_TYPE_STRING, algo_name_len) == 0)
> {
> - if (strncmp (s + i + algo_name_len, " (", 2) == 0)
> + size_t j = i + algo_name_len;
> + while (ISWHITE (s[j]))
> + ++j;
And here.
> + if (strncmp (s + j, "(", 1) == 0)
And here.
> {
> *binary = 0;
> - return bsd_split_3 (s + i + algo_name_len + 2,
> - s_len - (i + algo_name_len + 2),
> + return bsd_split_3 (s + j + 1, s_len - (j + 1),
> hex_digest, file_name);
> }
> }
- Re: [FEATURE_REQUEST] support openssl checksum format too, Guenter Knauf, 2009/10/03
- Re: [FEATURE_REQUEST] support openssl checksum format too,
Jim Meyering <=
- Re: [FEATURE_REQUEST] support openssl checksum format too, Guenter Knauf, 2009/10/03
- Re: [FEATURE_REQUEST] support openssl checksum format too, Jim Meyering, 2009/10/03
- Re: [FEATURE_REQUEST] support openssl checksum format too, Guenter Knauf, 2009/10/03
- Re: [FEATURE_REQUEST] support openssl checksum format too, Guenter Knauf, 2009/10/06
- Re: [FEATURE_REQUEST] support openssl checksum format too, Jim Meyering, 2009/10/07
- Re: [FEATURE_REQUEST] support openssl checksum format too, Guenter Knauf, 2009/10/07
- Re: [FEATURE_REQUEST] support openssl checksum format too, Jim Meyering, 2009/10/07
- Re: [FEATURE_REQUEST] support openssl checksum format too, Eric Blake, 2009/10/07