diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index bb71fdceb..44fe6e3eb 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -59,9 +59,6 @@ #include #include -//NI -#include - extern CPictureViewer * g_PicViewer; #define ICON_LARGE_WIDTH 26 @@ -1272,7 +1269,8 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start else picname = imdb->getFilename(channel, epgData.eventID); - if (!File_copy(imdb->posterfile.c_str(), picname.c_str())) + CFileHelpers fh; + if (!fh.copyFile(imdb->posterfile.c_str(), picname.c_str())) perror( "IMDb: error copy file" ); sleep(2); diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index 936e0ef2b..39a63d79d 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -1083,7 +1083,8 @@ void CInfoViewerBB::paint_cam_icons() int CInfoViewerBB::check_ecmInfo() { int caid = 0; - if (File_copy("/tmp/ecm.info", "/tmp/ecm.info.tmp")) { + CFileHelpers fh; + if (fh.copyFile("/tmp/ecm.info", "/tmp/ecm.info.tmp")) { g_InfoViewer->md5_ecmInfo = filehash((char *)"/tmp/ecm.info.tmp"); caid = parse_ecmInfo("/tmp/ecm.info.tmp"); } diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index ef232a1d8..b2cee1652 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -911,8 +911,11 @@ int CMovieBrowser::exec(CMenuTarget* parent, const std::string & actionKey) printf("Poster\n"); poster = m_movieSelectionHandler->file.Name.substr(0, pos); poster += ".jpg"; - File_copy(imdb->posterfile.c_str(), poster.c_str()); - printf("* poster: %s\n", poster.c_str()); + CFileHelpers fh; + if (fh.copyFile(imdb->posterfile.c_str(), poster.c_str())) + printf("* poster: %s\n", poster.c_str()); + else + printf("* poster: copy error\n"); } //m_movieInfo.saveMovieInfo(*m_movieSelectionHandler); diff --git a/src/gui/ni_menu.cpp b/src/gui/ni_menu.cpp index a9c832a5c..6e02dfee7 100644 --- a/src/gui/ni_menu.cpp +++ b/src/gui/ni_menu.cpp @@ -156,7 +156,8 @@ int CNIMenu::exec(CMenuTarget* parent, const std::string &actionkey) else if(actionkey == "ecmInfo") { buffer=NULL; - if (File_copy("/tmp/ecm.info", "/tmp/ecm.info.tmp")) + CFileHelpers fhlp; + if (fhlp.copyFile("/tmp/ecm.info", "/tmp/ecm.info.tmp")) { if ((fh = fopen("/tmp/ecm.info.tmp", "r"))) { diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 59a715805..66edc4c2f 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -1110,44 +1110,7 @@ std::string Lang2ISO639_1(std::string& lang) } //NI -bool File_copy(std::string rstr, std::string wstr) -{ - char * buffer; - long size; - - std::ifstream infile(rstr.c_str(), std::ifstream::binary); - if (infile) - { - std::ofstream outfile(wstr.c_str(), std::ofstream::binary); - if (outfile) - { - // get size of file - infile.seekg(0,std::ifstream::end); - size=infile.tellg(); - infile.seekg(0); - - buffer = new char [size]; - infile.read (buffer,size); - - outfile.write (buffer,size); - - delete[] buffer; - outfile.close(); - } - else - { - return false; - } - infile.close(); - return true; - } - else - { - return false; - } -} - -// rreturns the pid of the first process found in /proc +// returns the pid of the first process found in /proc int getpidof(const char *process) { DIR *dp; diff --git a/src/system/helpers.h b/src/system/helpers.h index 0199161c3..e90a2e82a 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -122,10 +122,9 @@ std::string getJFFS2MountPoint(int mtdPos); std::string Lang2ISO639_1(std::string& lang); //NI -bool File_copy(std::string rstr, std::string wstr); -int getpidof(const char *process); -std::string filehash(const char * file); -std::string get_path(const char * path); +int getpidof(const char *process); +std::string filehash(const char * file); +std::string get_path(const char * path); inline bool file_exists(const std::string file) { return file_exists(file.c_str()); } #endif