[vlc-commits] update: fix hashing of text files with empty lines
Rafaël Carré
git at videolan.org
Mon May 16 22:21:31 CEST 2011
vlc/vlc-1.1 | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Mon May 16 13:30:39 2011 -0400| [36d4a31ca9b106feae9f5cf0fc32271e04b80ed4] | committer: Rafaël Carré
update: fix hashing of text files with empty lines
the current status file for 1.1.9 is one of these
(cherry picked from commit b3c26d999de3d0d56edf93e32ff448725010a1ff)
Signed-off-by: Rafaël Carré <rafael.carre at gmail.com>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=36d4a31ca9b106feae9f5cf0fc32271e04b80ed4
---
src/misc/update_crypto.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/misc/update_crypto.c b/src/misc/update_crypto.c
index f16cb0f..5bcea77 100644
--- a/src/misc/update_crypto.c
+++ b/src/misc/update_crypto.c
@@ -730,15 +730,18 @@ uint8_t *hash_sha1_from_text( const char *psz_string,
while( *psz_string )
{
size_t i_len = strcspn( psz_string, "\r\n" );
- if( !i_len )
- break;
- gcry_md_write( hd, psz_string, i_len );
+ if( i_len )
+ {
+ gcry_md_write( hd, psz_string, i_len );
+ psz_string += i_len;
+ }
gcry_md_putc( hd, '\r' );
gcry_md_putc( hd, '\n' );
- psz_string += i_len;
- while( *psz_string == '\r' || *psz_string == '\n' )
+ if( *psz_string == '\r' )
+ psz_string++;
+ if( *psz_string == '\n' )
psz_string++;
}
else
More information about the vlc-commits
mailing list