diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2008-12-28 21:48:52 +0200 |
---|---|---|
committer | Ville Skyttä <ville.skytta@iki.fi> | 2008-12-28 21:48:52 +0200 |
commit | 82f9623c25f4f4d07c81644d01f156b9cedc80b6 (patch) | |
tree | 57025da4c789e27efca132dbad627478ec759497 | |
parent | cc1a932981135954289d39046c15d39483ab9332 (diff) | |
download | vdr-plugin-muggle-82f9623c25f4f4d07c81644d01f156b9cedc80b6.tar.gz vdr-plugin-muggle-82f9623c25f4f4d07c81644d01f156b9cedc80b6.tar.bz2 |
Eliminate compiler warnings, improve error messages.
-rw-r--r-- | mg_db.c | 4 | ||||
-rw-r--r-- | mg_image_provider.c | 7 | ||||
-rw-r--r-- | mg_skin.c | 2 | ||||
-rw-r--r-- | mg_tools.c | 8 | ||||
-rw-r--r-- | vdr_actions.c | 7 | ||||
-rw-r--r-- | vdr_player.c | 2 |
6 files changed, 18 insertions, 12 deletions
@@ -46,8 +46,8 @@ mugglepath() { memset(buf,0,5000); if (getenv("PWD")) strncpy(buf,getenv("PWD"),4990); - else - getcwd(buf,4990); + else if (!getcwd(buf,4990)) + mgError("Cannot get current directory: %s", strerror(errno)); strcat(buf,"/"); return strdup(buf); } diff --git a/mg_image_provider.c b/mg_image_provider.c index 5766d9e..00a5b16 100644 --- a/mg_image_provider.c +++ b/mg_image_provider.c @@ -345,7 +345,7 @@ bool mgMpgImageProvider::updateItem( mgItemGd *newitem ) { } void mgMpgImageProvider::Action() { - // convert all imges + // convert all images Lock(); vector<string> images( m_need_conversion ); mgItemGd *cnvItem = currItem; @@ -406,14 +406,15 @@ void mgImageProvider::fillImageList( string dir ) { void mgImageProvider::writeImage( TagLib::ByteVector &image, int num, string &image_cache ) { char* image_data = image.data(); - int len = image.size(); + uint len = image.size(); // save image_data to temporary file char *buf; msprintf( &buf, "%s/image-%d.jpg", image_cache.c_str(), num ); FILE *f = fopen( buf, "w+" ); - fwrite( image_data, sizeof(char), len, f ); + if (fwrite( image_data, sizeof(char), len, f ) != len) + mgWarning("Potential short write while writing to %s", buf); fclose( f ); free( buf ); } @@ -231,7 +231,7 @@ int cmgSkin::StoreSkin(const char *ThemeName) { if(filestr) { while (getline(filestr, line, '\n')) { line = line + "\n"; - fprintf(f, line.c_str()); + fprintf(f, "%s", line.c_str()); } filestr.close(); } @@ -198,8 +198,12 @@ bool samedir( const char *d1, const char *d2 ) { char rp1[path_max], rp2[path_max]; - realpath(d1, rp1); - realpath(d2, rp2); + if (!realpath(d1, rp1)) + mgWarning("Error canonicalizing pathname %s: %s", + d1, strerror(errno)); + if (!realpath(d2, rp2)) + mgWarning("Error canonicalizing pathname %s: %s", + d2, strerror(errno)); return (!strcmp( rp1, rp2 ) ); } diff --git a/vdr_actions.c b/vdr_actions.c index 42fc4fc..df816ea 100644 --- a/vdr_actions.c +++ b/vdr_actions.c @@ -588,12 +588,13 @@ mgExternal::Execute() { string quoted = "'" + m3u_file + "'"; char prev[1000]; if (!getcwd(prev,1000)) - mgError("current path too long"); + mgError("cannot get current directory: %s", strerror(errno)); if (chdir(the_setup.ToplevelDir)) - mgError("cannnot change to directory %s", + mgError("cannot change to directory %s", the_setup.ToplevelDir); command->Execute (quoted.c_str ()); - chdir(prev); + if (chdir(prev)) + mgError("cannot change to directory %s", prev); selection()->clearCache(); // the ext cmd could change the database osd()->forcerefresh = true; diff --git a/vdr_player.c b/vdr_player.c index e66f695..d73bfc1 100644 --- a/vdr_player.c +++ b/vdr_player.c @@ -672,7 +672,7 @@ mgPlayerControl::ShowProgress (bool open) { if (currItem) { // send progress to status monitor if (changed||orderchanged) { - snprintf(buf,sizeof(buf),currItem->getArtist().size()?"[%c%c] (%d/%d) %s - %s":"[%c%c] (%d/%d) %s", + snprintf(buf,sizeof(buf),currItem->getArtist().size()?"[%c%c] (%d/%zd) %s - %s":"[%c%c] (%d/%zd) %s", LoopChar(),ShuffleChar(),currPos,PlayList()->items().size(),currItem->getTitle().c_str(),currItem->getArtist().c_str()); #if APIVERSNUM >= 10338 cStatus::MsgReplaying(this,buf,currItem->getSourceFile().size()?currItem->getSourceFile().c_str():0,true); |