mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-07 20:33:23 +00:00
Remove function isCloudUrl()
The function isCloudUrl() was only called in one place, parse_file(). But, isCloudUrl() could only return true if the filename was of the git-repository kind (url[branch]). In such a case, control flow would never reach the point where isCloudUrl() is called, since is_git_repository() returns non-NULL and the function returns early. Therefore, remove this function. Moreover, adapt the affected if-statement by replacing "str && !strcmp(str, ...)" with the more concise "same_string(str, ...)". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
375490dfc9
commit
074ddc0596
3 changed files with 2 additions and 14 deletions
|
@ -497,9 +497,8 @@ int parse_file(const char *filename)
|
||||||
return git_load_dives(git, branch);
|
return git_load_dives(git, branch);
|
||||||
|
|
||||||
if ((ret = readfile(filename, &mem)) < 0) {
|
if ((ret = readfile(filename, &mem)) < 0) {
|
||||||
/* we don't want to display an error if this was the default file or the cloud storage */
|
/* we don't want to display an error if this was the default file */
|
||||||
if ((prefs.default_filename && !strcmp(filename, prefs.default_filename)) ||
|
if (same_string(filename, prefs.default_filename))
|
||||||
isCloudUrl(filename))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return report_error(translate("gettextFromC", "Failed to read '%s'"), filename);
|
return report_error(translate("gettextFromC", "Failed to read '%s'"), filename);
|
||||||
|
|
|
@ -1449,16 +1449,6 @@ extern "C" char *cloud_url()
|
||||||
return strdup(filename.toUtf8().data());
|
return strdup(filename.toUtf8().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" bool isCloudUrl(const char *filename)
|
|
||||||
{
|
|
||||||
QString email = QString(prefs.cloud_storage_email);
|
|
||||||
email.replace(QRegularExpression("[^a-zA-Z0-9@._+-]"), "");
|
|
||||||
if (!email.isEmpty() &&
|
|
||||||
QString(QString(prefs.cloud_git_url) + "/%1[%1]").arg(email) == filename)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" bool getProxyString(char **buffer)
|
extern "C" bool getProxyString(char **buffer)
|
||||||
{
|
{
|
||||||
if (prefs.proxy_type == QNetworkProxy::HttpProxy) {
|
if (prefs.proxy_type == QNetworkProxy::HttpProxy) {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
bool getProxyString(char **buffer);
|
bool getProxyString(char **buffer);
|
||||||
bool canReachCloudServer();
|
bool canReachCloudServer();
|
||||||
void updateWindowTitle();
|
void updateWindowTitle();
|
||||||
bool isCloudUrl(const char *filename);
|
|
||||||
void subsurface_mkdir(const char *dir);
|
void subsurface_mkdir(const char *dir);
|
||||||
char *get_file_name(const char *fileName);
|
char *get_file_name(const char *fileName);
|
||||||
void copy_image_and_overwrite(const char *cfileName, const char *path, const char *cnewName);
|
void copy_image_and_overwrite(const char *cfileName, const char *path, const char *cnewName);
|
||||||
|
|
Loading…
Add table
Reference in a new issue