mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +02:00
Merge branch 'ni/mp' into ni/cst-next
Conflicts:
data/icons/shutdown.jpg
data/icons/start.jpg
data/locale/Makefile.am
data/locale/deutsch.locale
data/locale/english.locale
lib/libdvbsub/dvbsub.cpp
lib/libdvbsub/dvbsubtitle.cpp
lib/libtuxtxt/tuxtxt.cpp
lib/libtuxtxt/tuxtxt.h
src/gui/dboxinfo.cpp
src/gui/movieplayer.cpp
src/gui/streaminfo2.cpp
src/gui/themes.cpp
src/neutrino.cpp
src/neutrino_menue.cpp
src/nhttpd/Makefile.am
src/system/flashtool.cpp
Origin commit data
------------------
Commit: 161347db29
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-08-26 (Fri, 26 Aug 2016)
This commit is contained in:
@@ -30,11 +30,13 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/vfs.h> /* or <sys/statfs.h> */
|
||||
#include <sys/time.h> /* gettimeofday */
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
@@ -44,6 +46,7 @@
|
||||
#include <linux/hdreg.h>
|
||||
#include <linux/fs.h>
|
||||
#include "debug.h"
|
||||
#include <driver/fontrenderer.h>
|
||||
#include <global.h>
|
||||
#include <system/helpers.h>
|
||||
#include <gui/update_ext.h>
|
||||
@@ -413,7 +416,7 @@ int check_dir(const char * dir, bool allow_tmp)
|
||||
ret = 0; // ok
|
||||
}
|
||||
if(ret == -1)
|
||||
printf("Wrong Filessystem Type: 0x%" PRIx32"\n",s.f_type);
|
||||
printf("Wrong Filessystem Type: 0x%llx\n", (unsigned long long)s.f_type);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -666,7 +669,6 @@ CFileHelpers::CFileHelpers()
|
||||
{
|
||||
FileBufSize = 0xFFFF;
|
||||
FileBuf = new char[FileBufSize];
|
||||
doCopyFlag = true;
|
||||
}
|
||||
|
||||
CFileHelpers::~CFileHelpers()
|
||||
@@ -685,7 +687,6 @@ CFileHelpers* CFileHelpers::getInstance()
|
||||
|
||||
bool CFileHelpers::copyFile(const char *Src, const char *Dst, mode_t mode)
|
||||
{
|
||||
doCopyFlag = true;
|
||||
unlink(Dst);
|
||||
if ((fd1 = open(Src, O_RDONLY)) < 0)
|
||||
return false;
|
||||
@@ -697,63 +698,26 @@ bool CFileHelpers::copyFile(const char *Src, const char *Dst, mode_t mode)
|
||||
uint32_t block;
|
||||
off64_t fsizeSrc64 = lseek64(fd1, 0, SEEK_END);
|
||||
lseek64(fd1, 0, SEEK_SET);
|
||||
if (fsizeSrc64 > 0x7FFFFFF0) { // > 2GB
|
||||
off64_t fsize64 = fsizeSrc64;
|
||||
block = FileBufSize;
|
||||
//printf("#####[%s] fsizeSrc64: %lld 0x%010llX - large file\n", __FUNCTION__, fsizeSrc64, fsizeSrc64);
|
||||
while(fsize64 > 0) {
|
||||
if(fsize64 < (off64_t)FileBufSize)
|
||||
block = (uint32_t)fsize64;
|
||||
read(fd1, FileBuf, block);
|
||||
write(fd2, FileBuf, block);
|
||||
fsize64 -= block;
|
||||
if (!doCopyFlag)
|
||||
break;
|
||||
}
|
||||
if (doCopyFlag) {
|
||||
lseek64(fd2, 0, SEEK_SET);
|
||||
off64_t fsizeDst64 = lseek64(fd2, 0, SEEK_END);
|
||||
if (fsizeSrc64 != fsizeDst64){
|
||||
close(fd1);
|
||||
close(fd2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
off64_t fsize64 = fsizeSrc64;
|
||||
block = FileBufSize;
|
||||
//printf("#####[%s] fsizeSrc64: %lld 0x%010llX - large file\n", __func__, fsizeSrc64, fsizeSrc64);
|
||||
while (fsize64 > 0) {
|
||||
if (fsize64 < (off64_t)FileBufSize)
|
||||
block = (uint32_t)fsize64;
|
||||
read(fd1, FileBuf, block); /* FIXME: short read??? */
|
||||
write(fd2, FileBuf, block); /* FIXME: short write?? */
|
||||
fsize64 -= block;
|
||||
}
|
||||
else { // < 2GB
|
||||
off_t fsizeSrc = lseek(fd1, 0, SEEK_END);
|
||||
lseek(fd1, 0, SEEK_SET);
|
||||
off_t fsize = fsizeSrc;
|
||||
block = FileBufSize;
|
||||
//printf("#####[%s] fsizeSrc: %ld 0x%08lX - normal file\n", __FUNCTION__, fsizeSrc, fsizeSrc);
|
||||
while(fsize > 0) {
|
||||
if(fsize < (off_t)FileBufSize)
|
||||
block = (uint32_t)fsize;
|
||||
read(fd1, FileBuf, block);
|
||||
write(fd2, FileBuf, block);
|
||||
fsize -= block;
|
||||
if (!doCopyFlag)
|
||||
break;
|
||||
}
|
||||
if (doCopyFlag) {
|
||||
lseek(fd2, 0, SEEK_SET);
|
||||
off_t fsizeDst = lseek(fd2, 0, SEEK_END);
|
||||
if (fsizeSrc != fsizeDst){
|
||||
close(fd1);
|
||||
close(fd2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
lseek64(fd2, 0, SEEK_SET);
|
||||
off64_t fsizeDst64 = lseek64(fd2, 0, SEEK_END);
|
||||
if (fsizeSrc64 != fsizeDst64) {
|
||||
close(fd1);
|
||||
close(fd2);
|
||||
return false;
|
||||
}
|
||||
close(fd1);
|
||||
close(fd2);
|
||||
|
||||
if (!doCopyFlag) {
|
||||
sync();
|
||||
unlink(Dst);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -819,8 +783,11 @@ bool CFileHelpers::copyDir(const char *Src, const char *Dst, bool backupMode)
|
||||
// is file
|
||||
else if (S_ISREG(FileInfo.st_mode)) {
|
||||
std::string save = "";
|
||||
(void)backupMode; /* squelch unused parameter warning */
|
||||
#if ENABLE_EXTUPDATE
|
||||
if (backupMode && (CExtUpdate::getInstance()->isBlacklistEntry(srcPath)))
|
||||
save = ".save";
|
||||
#endif
|
||||
copyFile(srcPath, (dstPath + save).c_str(), FileInfo.st_mode & 0x0FFF);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user