diff options
author | Antoine Cellerier <dionoea@videolan.org> | 2008-06-10 13:55:47 +0000 |
---|---|---|
committer | Antoine Cellerier <dionoea@videolan.org> | 2008-06-10 13:55:47 +0000 |
commit | 8e7454cc73e1836a55a5c5c1405f2d5de9f98df0 (patch) | |
tree | f2125fa2095888200b38d7bd1f02780b94679827 /apps | |
parent | 34d4165f7b8a36419c417f164ccdebbe04808247 (diff) |
Hopefully fix compilation warnings and link errors. Add some feedback (file being hashed). Boost CPU.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17710 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/lib/md5.c | 17 | ||||
-rw-r--r-- | apps/plugins/md5sum.c | 22 |
2 files changed, 31 insertions, 8 deletions
diff --git a/apps/plugins/lib/md5.c b/apps/plugins/lib/md5.c index 97156634e5..05535de12c 100644 --- a/apps/plugins/lib/md5.c +++ b/apps/plugins/lib/md5.c @@ -34,7 +34,14 @@ void md5_init( const struct plugin_api *api ) rb = api; } -#ifdef WORDS_BIGENDIAN +#ifdef ROCKBOX_BIG_ENDIAN +static inline uint32_t GetDWLE( const void * _p ) +{ + const uint8_t * p = (const uint8_t *)_p; + return ( ((uint32_t)p[3] << 24) | ((uint32_t)p[2] << 16) + | ((uint32_t)p[1] << 8) | p[0] ); +} + /***************************************************************************** * Reverse: reverse byte order *****************************************************************************/ @@ -246,10 +253,10 @@ void psz_md5_hash( char *psz, struct md5_s *md5_s ) for ( i = 0; i < 4; i++ ) { rb->snprintf( &psz[8*i], 9, "%02x%02x%02x%02x", - md5_s->p_digest[i] & 0xff, - ( md5_s->p_digest[i] >> 8 ) & 0xff, - ( md5_s->p_digest[i] >> 16 ) & 0xff, - md5_s->p_digest[i] >> 24 + (unsigned int)(md5_s->p_digest[i] & 0xff), + (unsigned int)(( md5_s->p_digest[i] >> 8 ) & 0xff), + (unsigned int)(( md5_s->p_digest[i] >> 16 ) & 0xff), + (unsigned int)(md5_s->p_digest[i] >> 24) ); } } diff --git a/apps/plugins/md5sum.c b/apps/plugins/md5sum.c index 6845c4c473..1c27fe53ac 100644 --- a/apps/plugins/md5sum.c +++ b/apps/plugins/md5sum.c @@ -24,12 +24,15 @@ PLUGIN_HEADER static const struct plugin_api *rb; +MEM_FUNCTION_WRAPPERS(rb); + int hash( char *string, const char *path ) { char *buffer[512]; ssize_t len; struct md5_s md5; int in = rb->open( path, O_RDONLY ); + rb->splash( 0, path ); if( in < 0 ) return -1; InitMD5( &md5 ); @@ -50,7 +53,7 @@ void hash_file( int out, const char *path ) rb->write( out, "error", 5 ); else rb->write( out, string, MD5_STRING_LENGTH ); - rb->write( out, " ", 1 ); + rb->write( out, " ", 2 ); rb->write( out, path, rb->strlen( path ) ); rb->write( out, "\n", 1 ); } @@ -129,7 +132,8 @@ void hash_check( int out, const char *path ) else { char string[MD5_STRING_LENGTH+1]; - filename++; + while( *filename == ' ' ) + filename++; rb->write( out, filename, rb->strlen( filename ) ); rb->write( out, ": ", 2 ); if( hash( string, filename ) ) @@ -151,6 +155,9 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame md5_init( api ); rb = api; +#ifdef HAVE_ADJUSTABLE_CPU_FREQ + rb->cpu_boost( true ); +#endif if( arg && *arg ) { @@ -158,7 +165,13 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame DIR *dir; rb->snprintf( filename, MAX_PATH, "%s.md5sum", arg ); out = rb->open( filename, O_WRONLY|O_CREAT ); - if( out < 0 ) return PLUGIN_ERROR; + if( out < 0 ) + { +#ifdef HAVE_ADJUSTABLE_CPU_FREQ + rb->cpu_boost( false ); +#endif + return PLUGIN_ERROR; + } if( ext ) { @@ -202,5 +215,8 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame exit: rb->close( out ); +#ifdef HAVE_ADJUSTABLE_CPU_FREQ + rb->cpu_boost( false ); +#endif return PLUGIN_OK; } |