Commit e472f8af authored by Fathi Boudra's avatar Fathi Boudra
Browse files

Fix null string assignment

parent 64c89886
......@@ -120,7 +120,7 @@ bool kio_isoProtocol::checkNewFile(QString fullPath, QString & path, int startse
// Find where the iso file is in the full path
int pos = 0;
QString isoFile;
path = QString();
path.clear();
int len = fullPath.length();
if (len != 0 && fullPath[ len - 1 ] != DIR_SEPARATOR_CHAR)
......
......@@ -385,7 +385,7 @@ bool KIso::openArchive(QIODevice::OpenMode mode)
c_b = 1;c_i = 1;c_j = 1;
root = rootDir();
if (trackno > 1) {
path = QString();
path.clear();
QTextStream(&path) << "Track " << tracks[(i<<1)+1];
root = new KIsoDirectory(this, path, access | S_IFDIR,
buf.st_mtime, buf.st_atime, buf.st_ctime, uid, gid, QString());
......
......@@ -769,7 +769,7 @@ bool kio_krarcProtocol::setArcFile(const KUrl& url)
codec = QTextCodec::codecForMib(4 /* latin-1 */);
delete arcFile;
password = QString();
password.clear();
extArcReady = false;
arcFile = newArcFile;
} else { // same old file
......@@ -782,7 +782,7 @@ bool kio_krarcProtocol::setArcFile(const KUrl& url)
extArcReady = false;
if (arcFile) {
delete arcFile;
password = QString();
password.clear();
arcFile = 0L;
}
QString newPath = path;
......@@ -1080,14 +1080,14 @@ void kio_krarcProtocol::parseLine(int lineNo, QString line)
UDSEntryList* dir;
UDSEntry entry;
QString owner = QString();
QString group = QString();
QString symlinkDest = QString();
QString perm = QString();
QString owner;
QString group;
QString symlinkDest;
QString perm;
mode_t mode = 0666;
size_t size = 0;
time_t time = ::time(0);
QString fullName = QString();
QString fullName;
if (arcType == "zip") {
// permissions
......@@ -1381,7 +1381,7 @@ bool kio_krarcProtocol::initArcParameters()
noencoding = false;
cmd = QString();
cmd.clear();
listCmd = QStringList();
getCmd = QStringList();
copyCmd = QStringList();
......@@ -1759,7 +1759,7 @@ void kio_krarcProtocol::invalidatePassword()
authInfo.url.setHost(fileName /*.replace('/','_')*/);
authInfo.url.setProtocol("krarc");
password = QString();
password.clear();
cacheAuthentication(authInfo);
}
......@@ -1789,7 +1789,7 @@ QString kio_krarcProtocol::getPassword()
return (password = authInfo.password);
}
authInfo.password = QString();
authInfo.password.clear();
if (openPasswordDialog(authInfo, i18n("Accessing the file requires password.")) && !authInfo.password.isNull()) {
KRDEBUG(authInfo.password);
......
......@@ -98,7 +98,7 @@ KUrl KRSpWidgets::newFTP()
int uriStart = uri.lastIndexOf('@'); /* lets the user enter user and password in the URI field */
if (uriStart != -1) {
QString uriUser = uri.left(uriStart);
QString uriPsw = QString();
QString uriPsw;
uri = uri.mid(uriStart + 1);
int pswStart = uriUser.indexOf(':'); /* getting the password name from the URL */
......@@ -117,7 +117,7 @@ KUrl KRSpWidgets::newFTP()
}
QString host = uri; /* separating the hostname and path from the uri */
QString path = QString();
QString path;
int pathStart = uri.indexOf("/");
if (pathStart != -1) {
path = host.mid(pathStart);
......
......@@ -71,12 +71,12 @@ void KrSqueezedTextLabel::squeezeTextToLabel(int index, int length)
}
QLabel::setText(sqtext);
setToolTip(QString::null);
setToolTip(QString());
setToolTip(fullText);
} else {
QLabel::setText(fullText);
setToolTip(QString::null);
setToolTip(QString());
QToolTip::hideText();
}
}
......
......@@ -91,7 +91,7 @@ void KURLListRequester::slotAdd()
{
QString text = urlLineEdit->text().simplified();
if (text.length()) {
QString error = QString();
QString error;
emit checkValidity(text, error);
if (!error.isNull())
......@@ -156,7 +156,7 @@ KUrl::List KURLListRequester::urlList()
QString text = urlLineEdit->text().simplified();
if (!text.isEmpty()) {
QString error = QString();
QString error;
emit checkValidity(text, error);
if (error.isNull())
urls.append(KUrl(text));
......@@ -167,7 +167,7 @@ KUrl::List KURLListRequester::urlList()
QString text = item->text().simplified();
QString error = QString();
QString error;
emit checkValidity(text, error);
if (error.isNull())
urls.append(KUrl(text));
......
......@@ -123,9 +123,9 @@ void PackGUI::accept()
void PackGUI::reject()
{
filename = QString();
destination = QString();
type = QString();
filename.clear();
destination.clear();
type.clear();
PackGUIBase::reject();
}
......
......@@ -511,7 +511,7 @@ void LocateDlg::operate(QTreeWidgetItem *item, int task)
return;
}
QString first = QString::null;
QString first;
if (list.count() != 0) {
first = list.first();
}
......
......@@ -429,7 +429,7 @@ QString KMountMan::findUdiForPath(QString path, const Solid::DeviceInterface::Ty
if (!(bool)mp) {
mp = findInListByMntPoint(possible, path);
if (!(bool)mp)
return QString::null;
return QString();
}
QString dev = QDir(mp->mountedFrom()).canonicalPath();
QList<Solid::Device> storageDevices = Solid::Device::listFromType(Solid::DeviceInterface::Block);
......@@ -448,7 +448,7 @@ QString KMountMan::findUdiForPath(QString path, const Solid::DeviceInterface::Ty
}
}
return QString::null;
return QString();
}
void KMountMan::slotTeardownDone(Solid::ErrorType error, QVariant errorData, const QString &udi)
......
......@@ -117,7 +117,7 @@ KrPopupMenu::KrPopupMenu(ListPanel *thePanel, QWidget *parent) : KMenu(parent),
// check if all the list have the same mimetype
for (int i = 1; i < items.size(); ++i) {
if (panel->func->getVFile(items[ i ]) ->vfile_getMime() != mime) {
mime = QString();
mime.clear();
break;
}
}
......
......@@ -141,7 +141,7 @@ void KRSearchMod::scanLocalDir(KUrl urlToScan)
KUrl url = KUrl(dir + name);
QString mime = QString();
QString mime;
if (query->searchInArchives() || !query->hasMimeType()) {
KMimeType::Ptr mt = KMimeType::findByUrl(url, stat_p.st_mode, true, false);
if (mt)
......
......@@ -115,7 +115,8 @@ void Synchronizer::reset()
leftCopyNr = rightCopyNr = deleteNr = 0;
leftCopySize = rightCopySize = deleteSize = 0;
comparedDirs = fileCount = 0;
leftBaseDir = rightBaseDir = QString();
leftBaseDir.clear();
rightBaseDir.clear();
clearLists();
}
......
......@@ -170,7 +170,7 @@ bool SynchronizerDirList::load(const QString &urlIn, bool wait)
}
}
QString mime = QString();
QString mime;
KUrl fileURL = KUrl(fullName);
......
......@@ -668,7 +668,7 @@ TagString exp_Ask::expFunc(const ListPanel*, const QStringList& parameter, const
else
caption = parameter[2];
if (parameter.count() <= 1 || parameter[1].isEmpty())
preset = QString();
preset.clear();
else
preset = parameter[1];
......@@ -1049,7 +1049,7 @@ TagString exp_Script::expFunc(const ListPanel*, const QStringList& parameter, co
KJS::ExecState *exec = krJS->globalExec();
QString jsReturn = QString();
QString jsReturn;
if (parameter[1].toLower() == "yes") // to stay compatible with the old-style parameter
jsReturn = "cmd";
else {
......@@ -1170,7 +1170,7 @@ void Expander::expand(const QString& stringToExpand, bool useUrl)
TagString Expander::expandCurrent(const QString& stringToExpand, bool useUrl)
{
TagString result;
QString exp = QString();
QString exp;
TagString tmpResult;
int begin, end, i;
// int brackets = 0;
......
......@@ -42,7 +42,7 @@ class KrAction: public KAction, public KrActionBase
{
Q_OBJECT
public:
KrAction(KActionCollection *parent, QString name = QString::null);
KrAction(KActionCollection *parent, QString name = QString());
~KrAction();
/**
......
......@@ -160,7 +160,7 @@ void ftp_vfs::slotListResult(KJob *job)
bool ftp_vfs::populateVfsList(const KUrl& origin, bool showHidden)
{
QString errorMsg = QString();
QString errorMsg;
if (!origin.isValid())
errorMsg = i18n("Malformed URL:\n%1", origin.url());
if (!KProtocolManager::supportsListing(origin)) {
......
......@@ -484,7 +484,7 @@ bool KRarcHandler::pack(QStringList fileNames, QString type, QString dest, long
packer << KrServices::fullPathName("7z") << "-y" << "a"; type = "-7z";
} else return false;
QString password = QString();
QString password;
if (extraProps.count("Password") > 0) {
password = extraProps[ "Password" ];
......@@ -502,7 +502,7 @@ bool KRarcHandler::pack(QStringList fileNames, QString type, QString dest, long
else
packer << QString("-p%1").arg(password);
} else
password = QString();
password.clear();
}
}
......
......@@ -413,7 +413,7 @@ bool KRQuery::containsContent(QString file) const
if (checkBuffer(buffer, 0))
return true;
lastSuccessfulGrep = QString(); // nothing was found
lastSuccessfulGrep.clear(); // nothing was found
return false;
}
......
......@@ -262,7 +262,7 @@ vfile* normal_vfs::vfileFromName(const QString& name, char * rawName)
if (S_ISDIR(stat_p.st_mode)) perm[0] = 'd';
KUrl mimeUrl = KUrl(path);
QString mime = QString();
QString mime;
char symDest[256];
memset(symDest, 0, 256);
......@@ -292,7 +292,8 @@ vfile* normal_vfs::vfileFromName(const QString& name, char * rawName)
void normal_vfs::getACL(vfile *file, QString &acl, QString &defAcl)
{
acl = defAcl = QString();
acl.clear();
defAcl.clear();
#ifdef HAVE_POSIX_ACL
QByteArray fileName = file->vfile_getUrl().path(KUrl::RemoveTrailingSlash).toLocal8Bit();
#ifdef HAVE_NON_POSIX_ACL_EXTENSIONS
......
......@@ -60,7 +60,7 @@ Attributes::Attributes()
uid = (uid_t) - 1;
gid = (gid_t) - 1;
mode = (mode_t) - 1;
acl = QString();
acl.clear();
}
Attributes::Attributes(time_t tIn, uid_t uIn, gid_t gIn, mode_t modeIn, const QString & aclIn)
......
......@@ -63,11 +63,11 @@ vfile::vfile(const QString& name, // useful construtor
{
vfile_name = name;
vfile_size = size;
vfile_owner = QString();
vfile_owner.clear();
vfile_ownerId = owner;
vfile_group = QString();
vfile_group.clear();
vfile_groupId = group;
vfile_userName = QString();
vfile_userName.clear();
vfile_perm = perm;
vfile_time_t = mtime;
vfile_symLink = symLink;
......
......@@ -276,9 +276,9 @@ vfile* virt_vfs::stat(const KUrl& url)
bool symLink = kfi->isLink();
mode_t mode = kfi->mode() | kfi->permissions();
QString perm = KRpermHandler::mode2QString(mode);
// set the mimetype
QString mime = QString();
QString symDest = "";
// set the mimetype
QString mime;
QString symDest;
if (symLink) {
symDest = kfi->linkDest();
if (kfi->isDir()) perm[ 0 ] = 'd';
......
......@@ -192,7 +192,8 @@ void KRslots::compareContent(KUrl url1, KUrl url2)
return;
}
QString tmp1 = QString(), tmp2 = QString();
QString tmp1;
QString tmp2;
// kdiff3 sucks with spaces
if (KUrl(diffProg).fileName() == "kdiff3" && !url1.prettyUrl().contains(" ") && !url2.prettyUrl().contains(" ")) {
......@@ -886,7 +887,7 @@ void KRslots::slotCombine()
KUrl baseURL;
bool unixStyle = false;
bool windowsStyle = false;
QString commonName = QString();
QString commonName;
int commonLength = 0;
((ListPanel*)ACTIVE_PANEL)->getSelectedNames(&list);
......
......@@ -321,7 +321,7 @@ Krusader::Krusader() : KParts::MainWindow(0,
if (!leftTabs[ i ].startsWith('/') && leftTabs[ i ].indexOf(":/") < 0)
leftTabs[ i ] = QDir::currentPath() + '/' + leftTabs[ i ];
}
startProfile = QString();
startProfile.clear();
}
if (args->isSet("right")) {
rightTabs = args->getOption("right").split(',');
......@@ -336,7 +336,7 @@ Krusader::Krusader() : KParts::MainWindow(0,
if (!rightTabs[ i ].startsWith('/') && rightTabs[ i ].indexOf(":/") < 0)
rightTabs[ i ] = QDir::currentPath() + '/' + rightTabs[ i ];
}
startProfile = QString();
startProfile.clear();
}
while (leftTabTypes.count() < leftTabs.count())
......
......@@ -130,7 +130,7 @@ bool ArchiveProtocol::checkNewFile(const KUrl & url, QString & path)
// Find where the tar file is in the full path
int pos = 0;
QString archiveFile;
path = QString();
path.clear();
int len = fullPath.length();
if (len != 0 && fullPath[ len - 1 ] != '/')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment