2019-05-01 Fred Gleason <fredg@paravelsystems.com>

* Fixed bugs in the 'Import' Web API call that caused import of
	filenames containing multibyte UTF-8 characters to fail.
This commit is contained in:
Fred Gleason 2019-05-01 17:15:59 -04:00
parent e1db731e0c
commit b0e92a7899
3 changed files with 14 additions and 8 deletions

View File

@ -18629,3 +18629,6 @@
2019-05-01 Fred Gleason <fredg@paravelsystems.com>
* Fixed bugs in rd_import(7) that caused corruption of multi-byte
UTF-8 characters.
2019-05-01 Fred Gleason <fredg@paravelsystems.com>
* Fixed bugs in the 'Import' Web API call that caused import of
filenames containing multibyte UTF-8 characters to fail.

View File

@ -160,7 +160,9 @@ RDAudioConvert::ErrorCode RDAudioConvert::convert()
if(!RDAudioConvert::settingsValid(conv_settings)) {
return RDAudioConvert::ErrorInvalidSettings;
}
if(!QFile::exists(conv_src_filename)) {
struct stat stats;
memset(&stats,0,sizeof(stats));
if(stat((const char *)conv_src_filename.toUtf8(),&stats)!=0) {
return RDAudioConvert::ErrorNoSource;
}
if(conv_dst_filename.isEmpty()) {
@ -338,7 +340,7 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage1Convert(const QString &srcfile,
// Try Libsndfile
//
memset(&sf_src_info,0,sizeof(sf_src_info));
if((sf_src=sf_open(srcfile,SFM_READ,&sf_src_info))!=NULL) {
if((sf_src=sf_open(srcfile.toUtf8(),SFM_READ,&sf_src_info))!=NULL) {
err=Stage1SndFile(dstfile,sf_src,&sf_src_info);
sf_close(sf_src);
return RDAudioConvert::ErrorOk;
@ -425,7 +427,7 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage1Vorbis(const QString &dstfile,
//
// Initialize Decoder
//
if((fd=open(wave->getName(),O_RDONLY))<0) {
if((fd=open(wave->getName().toUtf8(),O_RDONLY))<0) {
sf_close(sf_dst);
return RDAudioConvert::ErrorNoSource;
}
@ -718,7 +720,7 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage1M4A(const QString &dstfile,
//
// Open source
//
f = dlmp4.MP4Read(wave->getName());
f = dlmp4.MP4Read(wave->getName().toUtf8());
if(f == MP4_INVALID_FILE_HANDLE)
return RDAudioConvert::ErrorNoSource;

View File

@ -223,9 +223,13 @@ bool RDWaveFile::openWave(RDWaveData *data)
vorbis_info *vorbis_info;
#endif // HAVE_VORBIS
unsigned char tmc_buffer[4];
int fd=-1;
wave_data=data;
if(!wave_file.open(QIODevice::ReadOnly)) {
if((fd=open(wave_file.name().toUtf8(),O_RDONLY))<0) {
return false;
}
if(!wave_file.open(fd,QIODevice::ReadOnly)) {
return false;
}
@ -401,7 +405,6 @@ bool RDWaveFile::openWave(RDWaveData *data)
}
dlmp4.MP4Close(f, 0);
return true;
#else
@ -1337,10 +1340,8 @@ int RDWaveFile::seekWave(int offset,int whence)
switch(whence) {
case SEEK_SET:
if(ov_pcm_seek(&vorbis_file,offset/(2*channels))==0) {
//printf("RDWaveFile::seekWave() = %d\n",offset);
return offset;
}
//printf("RDWaveFile::seekWave() = -1\n");
return -1;
break;