Fix casts from QByteArray
This commit is contained in:
parent
b5fc19f08a
commit
78d6fd634b
@ -126,7 +126,8 @@ class LoggedDebug : public DebugBase<LoggedDebug> {
|
||||
static void MessageHandler(QtMsgType type, const QMessageLogContext&, const QString &message) {
|
||||
|
||||
if (message.startsWith(kMessageHandlerMagic)) {
|
||||
fprintf(type == QtCriticalMsg || type == QtFatalMsg ? stderr : stdout, "%s\n", message.toUtf8().data() + kMessageHandlerMagicLength);
|
||||
QByteArray message_data = message.toUtf8();
|
||||
fprintf(type == QtCriticalMsg || type == QtFatalMsg ? stderr : stdout, "%s\n", message_data.constData() + kMessageHandlerMagicLength);
|
||||
fflush(type == QtCriticalMsg || type == QtFatalMsg ? stderr : stdout);
|
||||
return;
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ void GME::VGM::Read(const QFileInfo &file_info, spb::tagreader::SongMetadata *so
|
||||
QByteArray gd3_head = file.read(4);
|
||||
if (gd3_head.size() < 4) return;
|
||||
|
||||
quint64 pt = GME::UnpackBytes32(gd3_head, gd3_head.size());
|
||||
quint64 pt = GME::UnpackBytes32(gd3_head.constData(), gd3_head.size());
|
||||
|
||||
file.seek(SAMPLE_COUNT);
|
||||
QByteArray sample_count_bytes = file.read(4);
|
||||
@ -215,7 +215,7 @@ void GME::VGM::Read(const QFileInfo &file_info, spb::tagreader::SongMetadata *so
|
||||
|
||||
file.seek(file.pos() + 4);
|
||||
QByteArray gd3_length_bytes = file.read(4);
|
||||
quint32 gd3_length = GME::UnpackBytes32(gd3_length_bytes, gd3_length_bytes.size());
|
||||
quint32 gd3_length = GME::UnpackBytes32(gd3_length_bytes.constData(), gd3_length_bytes.size());
|
||||
|
||||
QByteArray gd3Data = file.read(gd3_length);
|
||||
QTextStream fileTagStream(gd3Data, QIODevice::ReadOnly);
|
||||
@ -246,11 +246,11 @@ bool GME::VGM::GetPlaybackLength(const QByteArray &sample_count_bytes, const QBy
|
||||
if (sample_count_bytes.size() != 4) return false;
|
||||
if (loop_count_bytes.size() != 4) return false;
|
||||
|
||||
quint64 sample_count = GME::UnpackBytes32(sample_count_bytes, sample_count_bytes.size());
|
||||
quint64 sample_count = GME::UnpackBytes32(sample_count_bytes.constData(), sample_count_bytes.size());
|
||||
|
||||
if (sample_count <= 0) return false;
|
||||
|
||||
quint64 loop_sample_count = GME::UnpackBytes32(loop_count_bytes, loop_count_bytes.size());
|
||||
quint64 loop_sample_count = GME::UnpackBytes32(loop_count_bytes.constData(), loop_count_bytes.size());
|
||||
|
||||
if (loop_sample_count <= 0) {
|
||||
out_length = sample_count * 1000 / SAMPLE_TIMEBASE;
|
||||
|
@ -536,7 +536,8 @@ void Database::DoBackup() {
|
||||
|
||||
bool Database::OpenDatabase(const QString &filename, sqlite3 **connection) {
|
||||
|
||||
int ret = sqlite3_open(filename.toUtf8(), connection);
|
||||
const QByteArray filename_data = filename.toUtf8();
|
||||
int ret = sqlite3_open(filename_data.constData(), connection);
|
||||
if (ret != 0) {
|
||||
if (*connection) {
|
||||
const char *error_message = sqlite3_errmsg(*connection);
|
||||
|
@ -693,7 +693,8 @@ QString FiddleFileExtension(const QString &filename, const QString &new_extensio
|
||||
}
|
||||
|
||||
QString GetEnv(const QString &key) {
|
||||
return QString::fromLocal8Bit(qgetenv(key.toLocal8Bit()));
|
||||
const QByteArray key_data = key.toLocal8Bit();
|
||||
return QString::fromLocal8Bit(qgetenv(key_data.constData()));
|
||||
}
|
||||
|
||||
void SetEnv(const char *key, const QString &value) {
|
||||
|
@ -175,7 +175,7 @@ void DeviceProperties::UpdateHardwareInfo() {
|
||||
AddHardwareInfo(row++, tr("Manufacturer"), lister->DeviceManufacturer(id));
|
||||
keys = info.keys();
|
||||
for (const QString &key : keys) {
|
||||
AddHardwareInfo(row++, tr(key.toLatin1()), info[key].toString());
|
||||
AddHardwareInfo(row++, key, info[key].toString());
|
||||
}
|
||||
|
||||
ui_->hardware_info->sortItems(0);
|
||||
|
@ -203,7 +203,8 @@ bool GPodDevice::CopyToStorage(const CopyJob &job) {
|
||||
cover_file->close();
|
||||
QImage image = job.metadata_.image();
|
||||
if (image.save(cover_file->fileName(), "JPG")) {
|
||||
result = itdb_track_set_thumbnails(track, QFile::encodeName(cover_file->fileName()));
|
||||
const QByteArray filename = QFile::encodeName(cover_file->fileName());
|
||||
result = itdb_track_set_thumbnails(track, filename.constData());
|
||||
if (result) {
|
||||
cover_files_ << cover_file;
|
||||
track->has_artwork = 1;
|
||||
@ -218,7 +219,8 @@ bool GPodDevice::CopyToStorage(const CopyJob &job) {
|
||||
}
|
||||
}
|
||||
else if (!job.cover_source_.isEmpty()) {
|
||||
result = itdb_track_set_thumbnails(track, QFile::encodeName(job.cover_source_));
|
||||
const QByteArray filename = QFile::encodeName(job.cover_source_);
|
||||
result = itdb_track_set_thumbnails(track, filename.constData());
|
||||
if (result) track->has_artwork = 1;
|
||||
}
|
||||
else {
|
||||
@ -245,14 +247,15 @@ bool GPodDevice::CopyToStorage(const CopyJob &job) {
|
||||
// Put the track in the playlist, if one is specified
|
||||
if (!job.playlist_.isEmpty()) {
|
||||
// Does the playlist already exist?
|
||||
auto itdbPlaylist = itdb_playlist_by_name(db_, job.playlist_.toUtf8().data());
|
||||
if (itdbPlaylist == nullptr) {
|
||||
QByteArray playlist_name = job.playlist_.toUtf8();
|
||||
Itdb_Playlist *playlist = itdb_playlist_by_name(db_, playlist_name.data());
|
||||
if (!playlist) {
|
||||
// Create the playlist
|
||||
itdbPlaylist = itdb_playlist_new(job.playlist_.toUtf8().data(), false);
|
||||
itdb_playlist_add(db_, itdbPlaylist, -1);
|
||||
playlist = itdb_playlist_new(playlist_name.data(), false);
|
||||
itdb_playlist_add(db_, playlist, -1);
|
||||
}
|
||||
// Playlist should exist so add the track to the playlist
|
||||
itdb_playlist_add_track(itdbPlaylist, track, -1);
|
||||
itdb_playlist_add_track(playlist, track, -1);
|
||||
}
|
||||
|
||||
AddTrackToModel(track, url_.path());
|
||||
|
@ -65,8 +65,9 @@ void GPodLoader::LoadDatabase() {
|
||||
Itdb_iTunesDB *GPodLoader::TryLoad() {
|
||||
|
||||
// Load the iTunes database
|
||||
const QByteArray mountpoint = QDir::toNativeSeparators(mount_point_).toLocal8Bit();
|
||||
GError *error = nullptr;
|
||||
Itdb_iTunesDB *db = itdb_parse(QDir::toNativeSeparators(mount_point_).toLocal8Bit(), &error);
|
||||
Itdb_iTunesDB *db = itdb_parse(mountpoint.constData(), &error);
|
||||
|
||||
// Check for errors
|
||||
if (!db) {
|
||||
|
@ -352,7 +352,8 @@ void LocalRedirectServer::WriteTemplate() const {
|
||||
break;
|
||||
}
|
||||
|
||||
page_data.replace(offset, re_match.capturedLength(), tr(re_match.captured(1).toUtf8()));
|
||||
const QByteArray captured_data = re_match.captured(1).toUtf8();
|
||||
page_data.replace(offset, re_match.capturedLength(), tr(captured_data.constData()));
|
||||
offset += re_match.capturedLength();
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,8 @@ int main(int argc, char *argv[]) {
|
||||
#endif
|
||||
|
||||
// This makes us show up nicely in gnome-volume-control
|
||||
g_set_application_name(QCoreApplication::applicationName().toLocal8Bit());
|
||||
const QByteArray g_application_name = QCoreApplication::applicationName().toLocal8Bit();
|
||||
g_set_application_name(g_application_name.constData());
|
||||
|
||||
RegisterMetaTypes();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user