mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-18 17:47:42 +02:00
2019-05-03 Fred Gleason <fredg@paravelsystems.com>
* Cleaned up a compiler warning for rdimport(1).
This commit is contained in:
parent
aa59fbb0f5
commit
128a977d56
@ -18639,3 +18639,5 @@
|
||||
* Updated the package version to 3.0.0rc01.
|
||||
2019-05-03 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Fixed a regression that broke audio importation in rdimport(1).
|
||||
2019-05-03 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Cleaned up a compiler warning for rdimport(1).
|
||||
|
@ -740,7 +740,7 @@ int RDSetTimeLength(const QString &str)
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
bool RDCopy(const QString &srcfile,const QString &destfile)
|
||||
{
|
||||
int src_fd;
|
||||
@ -777,6 +777,81 @@ bool RDCopy(const QString &srcfile,const QString &destfile)
|
||||
close(dest_fd);
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
bool RDCopy(const QString &srcfile,const QString &destfile)
|
||||
{
|
||||
int src_fd;
|
||||
int dest_fd;
|
||||
|
||||
if((src_fd=open((const char *)srcfile,O_RDONLY))<0) {
|
||||
return false;
|
||||
}
|
||||
if((dest_fd=open((const char *)destfile,O_WRONLY|O_CREAT,S_IWUSR))<0) {
|
||||
close(src_fd);
|
||||
return false;
|
||||
}
|
||||
bool ret=RDCopy(src_fd,dest_fd);
|
||||
close(src_fd);
|
||||
close(dest_fd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool RDCopy(const QString &srcfile,int dest_fd)
|
||||
{
|
||||
int src_fd;
|
||||
|
||||
if((src_fd=open((const char *)srcfile,O_RDONLY))<0) {
|
||||
return false;
|
||||
}
|
||||
bool ret=RDCopy(src_fd,dest_fd);
|
||||
close(src_fd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool RDCopy(int src_fd,const QString &destfile)
|
||||
{
|
||||
int dest_fd;
|
||||
|
||||
if((dest_fd=open((const char *)destfile,O_WRONLY|O_CREAT,S_IWUSR))<0) {
|
||||
return false;
|
||||
}
|
||||
bool ret=RDCopy(src_fd,dest_fd);
|
||||
close(dest_fd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool RDCopy(int src_fd,int dest_fd)
|
||||
{
|
||||
struct stat src_stat;
|
||||
struct stat dest_stat;
|
||||
char *buf=NULL;
|
||||
int n;
|
||||
|
||||
if(fstat(src_fd,&src_stat)<0) {
|
||||
return false;
|
||||
}
|
||||
if(fstat(dest_fd,&dest_stat)<0) {
|
||||
return false;
|
||||
}
|
||||
if(fchmod(dest_fd,src_stat.st_mode)<0) {
|
||||
return false;
|
||||
}
|
||||
buf=(char *)malloc(dest_stat.st_blksize);
|
||||
while((n=read(src_fd,buf,dest_stat.st_blksize))==dest_stat.st_blksize) {
|
||||
write(dest_fd,buf,dest_stat.st_blksize);
|
||||
}
|
||||
write(dest_fd,buf,n);
|
||||
free(buf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RDWritePid(const QString &dirname,const QString &filename,int owner,
|
||||
|
@ -84,6 +84,9 @@ bool RDIsSqlNull(const QString &table,const QString &name,unsigned test,
|
||||
QString RDGetTimeLength(int mseconds,bool leadzero=false,bool tenths=true);
|
||||
int RDSetTimeLength(const QString &string);
|
||||
bool RDCopy(const QString &srcfile,const QString &destfile);
|
||||
bool RDCopy(const QString &srcfile,int dest_fd);
|
||||
bool RDCopy(int src_fd,const QString &destfile);
|
||||
bool RDCopy(int src_fd,int dest_fd);
|
||||
bool RDWritePid(const QString &dirname,const QString &filename,int owner=-1,
|
||||
int group=-1);
|
||||
void RDDeletePid(const QString &dirname,const QString &filename);
|
||||
|
@ -1480,14 +1480,18 @@ RDWaveFile *MainObject::FixFile(const QString &filename,RDWaveData *wavedata)
|
||||
//
|
||||
// Copy File
|
||||
//
|
||||
import_temp_fix_filename=
|
||||
QString(tempnam(RDTempDirectory::basePath(),"rdfix"))+QString(".wav");
|
||||
if(import_temp_fix_filename.isNull()) {
|
||||
char tempfile[PATH_MAX];
|
||||
strncpy(tempfile,RDTempDirectory::basePath()+
|
||||
QString().sprintf("/rdimport%dXXXXXX",getpid()),PATH_MAX);
|
||||
int dest_fd=mkstemp(tempfile);
|
||||
if(dest_fd<0) {
|
||||
return NULL;
|
||||
}
|
||||
if(!RDCopy(filename,import_temp_fix_filename)) {
|
||||
import_temp_fix_filename=tempfile;
|
||||
if(!RDCopy(filename,dest_fd)) {
|
||||
return NULL;
|
||||
}
|
||||
close(dest_fd);
|
||||
|
||||
//
|
||||
// Apply Fix
|
||||
|
Loading…
x
Reference in New Issue
Block a user