mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: pass QString and QByteArray const-refs to qthelper functions
Passing of QStrings and QByteArrays was inconsistent in qthelper.cpp. Unify to passing const-references. Passing by value is no big deal, since QString and QByteArray do copy-on-write "optimization". Nevertheless, let's keep it as consistent and effective as possible. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
f5eafe2a71
commit
e5dcd9fc16
2 changed files with 8 additions and 8 deletions
|
@ -1127,7 +1127,7 @@ void write_hashes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_hash(const QString filename, QByteArray hash)
|
void add_hash(const QString &filename, const QByteArray &hash)
|
||||||
{
|
{
|
||||||
if (hash.isEmpty())
|
if (hash.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
@ -1136,7 +1136,7 @@ void add_hash(const QString filename, QByteArray hash)
|
||||||
localFilenameOf[hash] = filename;
|
localFilenameOf[hash] = filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray hashFile(const QString filename)
|
QByteArray hashFile(const QString &filename)
|
||||||
{
|
{
|
||||||
QCryptographicHash hash(QCryptographicHash::Sha1);
|
QCryptographicHash hash(QCryptographicHash::Sha1);
|
||||||
QFile imagefile(filename);
|
QFile imagefile(filename);
|
||||||
|
@ -1164,7 +1164,7 @@ static bool haveHash(const QString &filename)
|
||||||
return hashOf.contains(filename);
|
return hashOf.contains(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString localFilePath(const QString originalFilename)
|
QString localFilePath(const QString &originalFilename)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&hashOfMutex);
|
QMutexLocker locker(&hashOfMutex);
|
||||||
|
|
||||||
|
@ -1486,7 +1486,7 @@ QByteArray getCurrentAppState()
|
||||||
return currentApplicationState;
|
return currentApplicationState;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCurrentAppState(QByteArray state)
|
void setCurrentAppState(const QByteArray &state)
|
||||||
{
|
{
|
||||||
currentApplicationState = state;
|
currentApplicationState = state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,12 +33,12 @@ QString get_divepoint_gas_string(struct dive *d, const divedatapoint& dp);
|
||||||
void read_hashes();
|
void read_hashes();
|
||||||
void write_hashes();
|
void write_hashes();
|
||||||
void updateHash(struct picture *picture);
|
void updateHash(struct picture *picture);
|
||||||
QByteArray hashFile(const QString filename);
|
QByteArray hashFile(const QString &filename);
|
||||||
void learnImages(const QDir dir, int max_recursions);
|
void learnImages(const QDir dir, int max_recursions);
|
||||||
void add_hash(const QString filename, QByteArray hash);
|
void add_hash(const QString &filename, const QByteArray &hash);
|
||||||
void hashPicture(struct picture *picture);
|
void hashPicture(struct picture *picture);
|
||||||
extern "C" char *hashstring(const char *filename);
|
extern "C" char *hashstring(const char *filename);
|
||||||
QString localFilePath(const QString originalFilename);
|
QString localFilePath(const QString &originalFilename);
|
||||||
QString fileFromHash(const char *hash);
|
QString fileFromHash(const char *hash);
|
||||||
void learnHash(const QString &originalName, const QString &localName, const QByteArray &hash);
|
void learnHash(const QString &originalName, const QString &localName, const QByteArray &hash);
|
||||||
weight_t string_to_weight(const char *str);
|
weight_t string_to_weight(const char *str);
|
||||||
|
@ -49,7 +49,7 @@ fraction_t string_to_fraction(const char *str);
|
||||||
int getCloudURL(QString &filename);
|
int getCloudURL(QString &filename);
|
||||||
bool parseGpsText(const QString &gps_text, double *latitude, double *longitude);
|
bool parseGpsText(const QString &gps_text, double *latitude, double *longitude);
|
||||||
QByteArray getCurrentAppState();
|
QByteArray getCurrentAppState();
|
||||||
void setCurrentAppState(QByteArray state);
|
void setCurrentAppState(const QByteArray &state);
|
||||||
void init_proxy();
|
void init_proxy();
|
||||||
QString getUUID();
|
QString getUUID();
|
||||||
QStringList imageExtensionFilters();
|
QStringList imageExtensionFilters();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue