From 099a2893da45412275584135d0f96d2d4ce4d172 Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Wed, 14 Mar 2007 07:58:19 +0000 Subject: [PATCH] minor tweaks to private md5 interface --- src/libFLAC/include/private/md5.h | 24 ++++++++++-------------- src/libFLAC/stream_decoder.c | 2 +- src/libFLAC/stream_encoder.c | 2 +- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/libFLAC/include/private/md5.h b/src/libFLAC/include/private/md5.h index b2a96da1..1497196c 100644 --- a/src/libFLAC/include/private/md5.h +++ b/src/libFLAC/include/private/md5.h @@ -1,3 +1,6 @@ +#ifndef FLAC__PRIVATE__MD5_H +#define FLAC__PRIVATE__MD5_H + /* * This is the header file for the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. This code was @@ -20,29 +23,22 @@ * Still in the public domain. * * Josh Coalson: made some changes to integrate with libFLAC. - * Still in the public domain. + * Still in the public domain, with no warranty. */ -#ifndef FLAC__PRIVATE__MD5_H -#define FLAC__PRIVATE__MD5_H - -#define md5byte unsigned char - #include "FLAC/ordinals.h" -struct FLAC__MD5Context { +typedef struct { FLAC__uint32 buf[4]; FLAC__uint32 bytes[2]; FLAC__uint32 in[16]; FLAC__byte *internal_buf; unsigned capacity; -}; +} FLAC__MD5Context; -void FLAC__MD5Init(struct FLAC__MD5Context *context); -void FLAC__MD5Update(struct FLAC__MD5Context *context, md5byte const *buf, unsigned len); -void FLAC__MD5Final(md5byte digest[16], struct FLAC__MD5Context *context); -void FLAC__MD5Transform(FLAC__uint32 buf[4], FLAC__uint32 const in[16]); +void FLAC__MD5Init(FLAC__MD5Context *context); +void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *context); -FLAC__bool FLAC__MD5Accumulate(struct FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample); +FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample); -#endif /* !MD5_H */ +#endif diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c index 544f6d75..f0edb111 100644 --- a/src/libFLAC/stream_decoder.c +++ b/src/libFLAC/stream_decoder.c @@ -192,7 +192,7 @@ typedef struct FLAC__StreamDecoderPrivate { FLAC__bool do_md5_checking; /* initially gets protected_->md5_checking but is turned off after a seek or if the metadata has a zero MD5 */ FLAC__bool internal_reset_hack; /* used only during init() so we can call reset to set up the decoder without rewinding the input */ FLAC__bool is_seeking; - struct FLAC__MD5Context md5context; + FLAC__MD5Context md5context; FLAC__byte computed_md5sum[16]; /* this is the sum we computed from the decoded data */ /* (the rest of these are only used for seeking) */ FLAC__Frame last_frame; /* holds the info of the last frame we seeked to */ diff --git a/src/libFLAC/stream_encoder.c b/src/libFLAC/stream_encoder.c index fdb0abd0..489c3220 100644 --- a/src/libFLAC/stream_encoder.c +++ b/src/libFLAC/stream_encoder.c @@ -361,7 +361,7 @@ typedef struct FLAC__StreamEncoderPrivate { FLAC__StreamMetadata_SeekTable *seek_table; /* pointer into encoder->protected_->metadata_ where the seek table is */ unsigned current_sample_number; unsigned current_frame_number; - struct FLAC__MD5Context md5context; + FLAC__MD5Context md5context; FLAC__CPUInfo cpuinfo; #ifndef FLAC__INTEGER_ONLY_LIBRARY unsigned (*local_fixed_compute_best_predictor)(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]);