summaryrefslogtreecommitdiffstats
path: root/apps/plugins/md5sum.c
diff options
context:
space:
mode:
authorAntoine Cellerier <dionoea@videolan.org>2008-06-10 13:55:47 +0000
committerAntoine Cellerier <dionoea@videolan.org>2008-06-10 13:55:47 +0000
commit8e7454cc73e1836a55a5c5c1405f2d5de9f98df0 (patch)
treef2125fa2095888200b38d7bd1f02780b94679827 /apps/plugins/md5sum.c
parent34d4165f7b8a36419c417f164ccdebbe04808247 (diff)
downloadrockbox-8e7454cc73e1836a55a5c5c1405f2d5de9f98df0.tar.gz
rockbox-8e7454cc73e1836a55a5c5c1405f2d5de9f98df0.zip
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/plugins/md5sum.c')
-rw-r--r--apps/plugins/md5sum.c22
1 files changed, 19 insertions, 3 deletions
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;
}