Skip to content

Commit

Permalink
Convert {to,from}Ascii to {to,from}Latin1.
Browse files Browse the repository at this point in the history
The ascii functions are depreciated in Qt5 and don't actually do what they are supposed to do in Qt4.
  • Loading branch information
daniel-kristjansson authored and jyavenard committed Mar 8, 2013
1 parent a1672a2 commit f6c4a4c
Show file tree
Hide file tree
Showing 92 changed files with 248 additions and 248 deletions.
2 changes: 1 addition & 1 deletion mythtv/external/qjson/src/qobjecthelper.cpp
Expand Up @@ -66,7 +66,7 @@ void QObjectHelper::qvariant2qobject(const QVariantMap& variant, QObject* object

QVariantMap::const_iterator iter;
for (iter = variant.constBegin(); iter != variant.constEnd(); ++iter) {
int pIdx = metaobject->indexOfProperty( iter.key().toAscii() );
int pIdx = metaobject->indexOfProperty( iter.key().toLatin1() );

if ( pIdx < 0 ) {
continue;
Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmyth/audio/audiooutputalsa.cpp
Expand Up @@ -117,7 +117,7 @@ int AudioOutputALSA::TryOpenDevice(int open_mode, int try_ac3)

if (try_ac3)
{
dev_ba = passthru_device.toAscii();
dev_ba = passthru_device.toLatin1();
VBAUDIO(QString("OpenDevice %1 for passthrough").arg(passthru_device));
err = snd_pcm_open(&pcm_handle, dev_ba.constData(),
SND_PCM_STREAM_PLAYBACK, open_mode);
Expand All @@ -137,7 +137,7 @@ int AudioOutputALSA::TryOpenDevice(int open_mode, int try_ac3)
{
// passthru open failed, retry default device
VBAUDIO(QString("OpenDevice %1").arg(main_device));
dev_ba = main_device.toAscii();
dev_ba = main_device.toLatin1();
err = snd_pcm_open(&pcm_handle, dev_ba.constData(),
SND_PCM_STREAM_PLAYBACK, open_mode);
m_lastdevice = main_device;
Expand Down Expand Up @@ -261,7 +261,7 @@ QByteArray *AudioOutputALSA::GetELD(int card, int device, int subdevice)
snd_ctl_elem_id_set_name(id, "ELD");
snd_ctl_elem_id_set_device(id, device);
if ((err = snd_hctl_open(&hctl,
QString("hw:%1").arg(card).toAscii().constData(),
QString("hw:%1").arg(card).toLatin1().constData(),
0)) < 0)
{
VBAUDIO(QString("Control %1 open error: %2")
Expand Down Expand Up @@ -911,7 +911,7 @@ bool AudioOutputALSA::OpenMixer(void)
return false;
}

QByteArray dev_ba = m_mixer.device.toAscii();
QByteArray dev_ba = m_mixer.device.toLatin1();
struct snd_mixer_selem_regopt regopts =
{1, SND_MIXER_SABSTRACT_NONE, dev_ba.constData(), NULL, NULL};

Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmyth/audio/audiooutputjack.cpp
Expand Up @@ -154,7 +154,7 @@ bool AudioOutputJACK::OpenDevice()
for (i = 0; i < channels; i++)
{
QString port_name = QString("out_%1").arg(i);
ports[i] = jack_port_register(client, port_name.toAscii().constData(),
ports[i] = jack_port_register(client, port_name.toLatin1().constData(),
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput, 0);
if (!ports[i])
Expand Down Expand Up @@ -559,7 +559,7 @@ jack_client_t* AudioOutputJACK::_jack_client_open(void)
(jack_options_t)(JackUseExactName | JackNoStartServer);
jack_status_t open_status;

client = jack_client_open(client_name.toAscii().constData(),
client = jack_client_open(client_name.toLatin1().constData(),
open_options, &open_status);

return client;
Expand All @@ -574,7 +574,7 @@ const char** AudioOutputJACK::_jack_get_ports(void)
// Have we been given a target port to connect to
if (!main_device.isEmpty())
{
port_name = main_device.toAscii().constData();
port_name = main_device.toLatin1().constData();
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmyth/audio/audiooutputoss.cpp
Expand Up @@ -47,7 +47,7 @@ AudioOutputSettings* AudioOutputOSS::GetOutputSettings(bool /*digital*/)
{
AudioOutputSettings *settings = new AudioOutputSettings();

QByteArray device = main_device.toAscii();
QByteArray device = main_device.toLatin1();
audiofd = open(device.constData(), O_WRONLY | O_NONBLOCK);

AudioFormat fmt;
Expand Down Expand Up @@ -121,7 +121,7 @@ bool AudioOutputOSS::OpenDevice()

while (timer.elapsed() < 2000 && audiofd == -1)
{
QByteArray device = main_device.toAscii();
QByteArray device = main_device.toLatin1();
audiofd = open(device.constData(), O_WRONLY);
if (audiofd < 0 && errno != EAGAIN && errno != EINTR)
{
Expand Down Expand Up @@ -282,7 +282,7 @@ void AudioOutputOSS::VolumeInit()
if (device.toLower() == "software")
return;

QByteArray dev = device.toAscii();
QByteArray dev = device.toLatin1();
mixerfd = open(dev.constData(), O_RDONLY);

QString controlLabel = gCoreContext->GetSetting("MixerControl", "PCM");
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/audio/audiooutputpulse.cpp
Expand Up @@ -470,7 +470,7 @@ char *AudioOutputPulseAudio::ChooseHost(void)
{
QString fn_log_tag = "ChooseHost, ";
char *pulse_host = NULL;
char *device = strdup(main_device.toAscii().constData());
char *device = strdup(main_device.toLatin1().constData());
const char *host;

for (host=device; host && *host != ':' && *host != 0; host++);
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/audio/spdifencoder.cpp
Expand Up @@ -24,7 +24,7 @@ extern "C" {
SPDIFEncoder::SPDIFEncoder(QString muxer, int codec_id)
: m_complete(false), m_oc(NULL), m_stream(NULL), m_size(0)
{
QByteArray dev_ba = muxer.toAscii();
QByteArray dev_ba = muxer.toLatin1();
AVOutputFormat *fmt;

avcodeclock->lock();
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmyth/mediamonitor-darwin.cpp
Expand Up @@ -418,11 +418,11 @@ void MonitorThreadDarwin::diskInsert(const char *devName,

// We store the volume name for user activities like ChooseAndEjectMedia().
media->setVolumeID(volName);
media->setDeviceModel(model.toAscii()); // Same for the Manufacturer and model
media->setDeviceModel(model.toLatin1()); // Same for the Manufacturer and model

// Mac OS X devices are pre-mounted here:
QString mnt = "/Volumes/"; mnt += volName;
media->setMountPath(mnt.toAscii());
media->setMountPath(mnt.toLatin1());

int attempts = 0;
QDir d(mnt);
Expand Down Expand Up @@ -496,7 +496,7 @@ void MonitorThreadDarwin::diskRename(const char *devName, const char *volName)
pDevice->setStatus(MEDIASTAT_NODISK);

pDevice->setVolumeID(volName);
pDevice->setMountPath((QString("/Volumes/") + volName).toAscii());
pDevice->setMountPath((QString("/Volumes/") + volName).toLatin1());

// Plugins can now use it again:
if (m_Monitor->m_SendEvent)
Expand Down
16 changes: 8 additions & 8 deletions mythtv/libs/libmyth/mediamonitor-unix.cpp
Expand Up @@ -234,9 +234,9 @@ bool MediaMonitorUnix::CheckMountable(void)

MythMediaDevice* pDevice;
if (DeviceProperty(*it, "DeviceIsRemovable").toBool())
pDevice = MythCDROM::get(this, dev.toAscii(), false, m_AllowEject);
pDevice = MythCDROM::get(this, dev.toLatin1(), false, m_AllowEject);
else
pDevice = MythHDD::Get(this, dev.toAscii(), false, false);
pDevice = MythHDD::Get(this, dev.toLatin1(), false, false);

if (pDevice && !AddDevice(pDevice))
pDevice->deleteLater();
Expand Down Expand Up @@ -332,7 +332,7 @@ QString MediaMonitorUnix::GetDeviceFile(const QString &sysfs)
if (udev != NULL)
{
struct udev_device *device =
udev_device_new_from_syspath(udev, sysfs.toAscii().constData());
udev_device_new_from_syspath(udev, sysfs.toLatin1().constData());
if (device != NULL)
{
const char *name = udev_device_get_devnode(device);
Expand Down Expand Up @@ -533,7 +533,7 @@ static void LookupModel(MythMediaDevice* device)

LOG(VB_MEDIA, LOG_DEBUG, QString("LookupModel '%1' -> '%2'")
.arg(device->getRealDevice()).arg(desc) );
device->setDeviceModel(desc.toAscii().constData());
device->setDeviceModel(desc.toLatin1().constData());
}

/**
Expand Down Expand Up @@ -714,9 +714,9 @@ void MediaMonitorUnix::deviceAdded( QDBusObjectPath o)

MythMediaDevice* pDevice;
if (DeviceProperty(o, "DeviceIsRemovable").toBool())
pDevice = MythCDROM::get(this, dev.toAscii(), false, m_AllowEject);
pDevice = MythCDROM::get(this, dev.toLatin1(), false, m_AllowEject);
else
pDevice = MythHDD::Get(this, dev.toAscii(), false, false);
pDevice = MythHDD::Get(this, dev.toLatin1(), false, false);

if (pDevice && !AddDevice(pDevice))
pDevice->deleteLater();
Expand Down Expand Up @@ -804,13 +804,13 @@ bool MediaMonitorUnix::FindPartitions(const QString &dev, bool checkPartitions)
{
// found cdrom device
pDevice = MythCDROM::get(
this, device_file.toAscii().constData(), false, m_AllowEject);
this, device_file.toLatin1().constData(), false, m_AllowEject);
}
else
{
// found block or partition device
pDevice = MythHDD::Get(
this, device_file.toAscii().constData(), false, false);
this, device_file.toLatin1().constData(), false, false);
}

if (AddDevice(pDevice))
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmyth/mythdialogs.cpp
Expand Up @@ -700,7 +700,7 @@ bool MythPopupBox::showOkPopup(
if (button_msg.isEmpty())
button_msg = QObject::tr("OK");

MythPopupBox *popup = new MythPopupBox(parent, title.toAscii().constData());
MythPopupBox *popup = new MythPopupBox(parent, title.toLatin1().constData());

popup->addLabel(message, MythPopupBox::Medium, true);
QAbstractButton *okButton = popup->addButton(button_msg, popup, SLOT(accept()));
Expand All @@ -716,7 +716,7 @@ bool MythPopupBox::showOkPopup(
bool MythPopupBox::showGetTextPopup(MythMainWindow *parent, QString title,
QString message, QString& text)
{
MythPopupBox *popup = new MythPopupBox(parent, title.toAscii().constData());
MythPopupBox *popup = new MythPopupBox(parent, title.toLatin1().constData());

popup->addLabel(message, Medium, true);

Expand Down Expand Up @@ -763,7 +763,7 @@ DialogCode MythPopupBox::ShowButtonPopup(
const QStringList &buttonmsgs,
DialogCode default_button)
{
MythPopupBox *popup = new MythPopupBox(parent, title.toAscii().constData());
MythPopupBox *popup = new MythPopupBox(parent, title.toLatin1().constData());

popup->addLabel(message, Medium, true);
popup->addLabel("");
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/mythmediamonitor.cpp
Expand Up @@ -545,7 +545,7 @@ QString MediaMonitor::GetMountPath(const QString& devPath)
// Create a fake media device just to lookup mount map:
else
{
pMedia = MythCDROM::get(NULL, devPath.toAscii(), true, false);
pMedia = MythCDROM::get(NULL, devPath.toLatin1(), true, false);
if (pMedia && pMedia->findMountPath())
mountPath = pMedia->getMountPath();
else
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/remoteutil.cpp
Expand Up @@ -271,7 +271,7 @@ QDateTime RemoteGetPreviewIfModified(

size_t length = strlist[1].toULongLong();
quint16 checksum16 = strlist[2].toUInt();
QByteArray data = QByteArray::fromBase64(strlist[3].toAscii());
QByteArray data = QByteArray::fromBase64(strlist[3].toLatin1());
if ((size_t) data.size() < length)
{ // (note data.size() may be up to 3 bytes longer after decoding
LOG(VB_GENERAL, LOG_ERR, loc +
Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmyth/settings.cpp
Expand Up @@ -308,7 +308,7 @@ QWidget* LineEditSetting::configWidget(ConfigurationGroup *cg, QWidget* parent,

edit = new MythLineEdit(
settingValue, NULL,
QString(QString(widgetName) + "-edit").toAscii().constData());
QString(QString(widgetName) + "-edit").toLatin1().constData());
edit->setHelpText(getHelpText());
edit->setText( getValue() );
edit->setMinimumHeight(25);
Expand Down Expand Up @@ -408,7 +408,7 @@ QWidget* SliderSetting::configWidget(ConfigurationGroup *cg, QWidget* parent,
}

MythSlider *slider = new MythSlider(
NULL, QString(QString(widgetName) + "-slider").toAscii().constData());
NULL, QString(QString(widgetName) + "-slider").toLatin1().constData());
slider->setHelpText(getHelpText());
slider->setMinimum(min);
slider->setMaximum(max);
Expand All @@ -419,7 +419,7 @@ QWidget* SliderSetting::configWidget(ConfigurationGroup *cg, QWidget* parent,

QLCDNumber *lcd = new QLCDNumber();
lcd->setObjectName(QString(QString(widgetName) + "-lcd")
.toAscii().constData());
.toLatin1().constData());
lcd->setMode(QLCDNumber::Dec);
lcd->setSegmentStyle(QLCDNumber::Flat);
lcd->display(intValue());
Expand Down Expand Up @@ -484,7 +484,7 @@ QWidget* SpinBoxSetting::configWidget(ConfigurationGroup *cg, QWidget* parent,
this, SLOT(widgetDeleted(QObject*)));

QString sbname = QString(widgetName) + "MythSpinBox";
spinbox = new MythSpinBox(NULL, sbname.toAscii().constData(), sstep);
spinbox = new MythSpinBox(NULL, sbname.toLatin1().constData(), sstep);
spinbox->setHelpText(getHelpText());
spinbox->setMinimum(min);
spinbox->setMaximum(max);
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/storagegroupeditor.cpp
Expand Up @@ -28,7 +28,7 @@ class StorageGroupPopup
SGPopupResult StorageGroupPopup::showPopup(MythMainWindow *parent,
QString title, QString message, QString& text)
{
MythPopupBox *popup = new MythPopupBox(parent, title.toAscii().constData());
MythPopupBox *popup = new MythPopupBox(parent, title.toLatin1().constData());
popup->addLabel(message);

MythLineEdit *textEdit = new MythLineEdit(popup, "chooseEdit");
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/filesysteminfo.cpp
Expand Up @@ -230,7 +230,7 @@ void FileSystemInfo::Consolidate(QList<FileSystemInfo> &disks,
void FileSystemInfo::PopulateDiskSpace(void)
{
int64_t total = -1, used = -1;
getDiskSpace(getPath().toAscii().constData(), total, used);
getDiskSpace(getPath().toLatin1().constData(), total, used);
setTotalSpace(total);
setUsedSpace(used);
}
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/iso639.cpp
Expand Up @@ -64,7 +64,7 @@ vector<int> iso639_get_language_key_list(void)

QString iso639_str2_to_str3(const QString &str2)
{
int key2 = iso639_str2_to_key2(str2.toAscii().constData());
int key2 = iso639_str2_to_key2(str2.toLatin1().constData());
int key3 = 0;
if (_iso639_key2_to_key3.contains(key2))
key3 = _iso639_key2_to_key3[key2];
Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmythbase/iso639.h
Expand Up @@ -78,9 +78,9 @@ static inline int iso639_str3_to_key(const QString &iso639_2)
}
else
{
return ((iso639_2.at(0).toAscii()<<16) |
(iso639_2.at(1).toAscii()<<8) |
(iso639_2.at(2).toAscii()));
return ((iso639_2.at(0).toLatin1()<<16) |
(iso639_2.at(1).toLatin1()<<8) |
(iso639_2.at(2).toLatin1()));
}
}

Expand All @@ -97,7 +97,7 @@ static inline int iso639_str2_to_key2(const char *iso639_1)

static inline QString iso639_str_to_canonoical_str(const QString &str3)
{
int key = iso639_str3_to_key(str3.toAscii().constData());
int key = iso639_str3_to_key(str3.toLatin1().constData());
int can = iso639_key_to_canonical_key(key);
return iso639_key_to_str3(can);
}
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythcdrom-linux.cpp
Expand Up @@ -503,7 +503,7 @@ MythMediaStatus MythCDROMLinux::checkMedia()
// Check for a DVD/BD disk by reading the UDF root dir.
// This allows DVD's to play immediately upon insertion without
// calling mount, which either needs pmount or changes to fstab.
udf_t *pUdf = udf_open(m_DevicePath.toAscii());
udf_t *pUdf = udf_open(m_DevicePath.toLatin1());
if (NULL != pUdf)
{
udf_dirent_t *pUdfRoot = udf_get_root(pUdf, true, 0);
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythbase/mythcommandlineparser.cpp
Expand Up @@ -1875,7 +1875,7 @@ QMap<QString,QString> MythCommandLineParser::GetSettingsOverride(void)
}
else
{
QByteArray tmp = filename.toAscii();
QByteArray tmp = filename.toLatin1();
cerr << "Failed to open the override settings file: '"
<< tmp.constData() << "'" << endl;
}
Expand Down Expand Up @@ -2613,7 +2613,7 @@ bool openPidfile(ofstream &pidfs, const QString &pidfile)
{
if (!pidfile.isEmpty())
{
pidfs.open(pidfile.toAscii().constData());
pidfs.open(pidfile.toLatin1().constData());
if (!pidfs)
{
cerr << "Could not open pid file: " << ENO_STR << endl;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythdownloadmanager.cpp
Expand Up @@ -1089,7 +1089,7 @@ void MythDownloadManager::downloadFinished(MythDownloadInfo *dlInfo)
QNetworkCacheMetaData::RawHeader newheader;
QDateTime now = MythDate::current();
newheader = QNetworkCacheMetaData::RawHeader("Date",
now.toString(dateFormat).toAscii());
now.toString(dateFormat).toLatin1());
headers.append(newheader);
urlData.setRawHeaders(headers);
m_infoLock->lock();
Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmythbase/mythmiscutil.cpp
Expand Up @@ -371,7 +371,7 @@ QString createTempFile(QString name_template, bool dir)
}
QString tmpFileName(tempfilename);
#else
QByteArray safe_name_template = name_template.toAscii();
QByteArray safe_name_template = name_template.toLatin1();
const char *tmp = safe_name_template.constData();
char *ctemplate = strdup(tmp);

Expand Down Expand Up @@ -423,7 +423,7 @@ QString createTempFile(QString name_template, bool dir)
*/
void makeFileAccessible(QString filename)
{
QByteArray fname = filename.toAscii();
QByteArray fname = filename.toLatin1();
chmod(fname.constData(), 0666);
}

Expand Down Expand Up @@ -936,8 +936,8 @@ void setHttpProxy(void)
url = "http://%1:%2";

url = url.arg(p.hostName()).arg(p.port());
setenv("HTTP_PROXY", url.toAscii(), 1);
setenv("http_proxy", url.toAscii(), 0);
setenv("HTTP_PROXY", url.toLatin1(), 1);
setenv("http_proxy", url.toLatin1(), 0);

return;
}
Expand Down

0 comments on commit f6c4a4c

Please sign in to comment.