Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Johannes Zarl-Zierl
KPhotoAlbum
Commits
4f2f3bde
Commit
4f2f3bde
authored
Oct 04, 2020
by
Robert Krawitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor point optimizations
parent
771d973d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
DB/MD5.cpp
DB/MD5.cpp
+4
-4
Utilities/FileNameUtil.cpp
Utilities/FileNameUtil.cpp
+8
-4
No files found.
DB/MD5.cpp
View file @
4f2f3bde
...
...
@@ -39,8 +39,8 @@ DB::MD5::MD5()
DB
::
MD5
::
MD5
(
const
QString
&
md5str
)
:
m_isNull
(
md5str
.
isEmpty
())
,
m_v0
(
md5str
.
left
(
16
).
toULongLong
(
0
,
16
))
,
m_v1
(
md5str
.
mid
(
16
,
16
).
toULongLong
(
0
,
16
))
,
m_v0
(
md5str
.
left
Ref
(
16
).
toULongLong
(
0
,
16
))
,
m_v1
(
md5str
.
mid
Ref
(
16
,
16
).
toULongLong
(
0
,
16
))
{
}
...
...
@@ -55,8 +55,8 @@ DB::MD5 &DB::MD5::operator=(const QString &md5str)
m_isNull
=
true
;
}
else
{
m_isNull
=
false
;
m_v0
=
md5str
.
left
(
16
).
toULongLong
(
0
,
16
);
m_v1
=
md5str
.
mid
(
16
,
16
).
toULongLong
(
0
,
16
);
m_v0
=
md5str
.
left
Ref
(
16
).
toULongLong
(
0
,
16
);
m_v1
=
md5str
.
mid
Ref
(
16
,
16
).
toULongLong
(
0
,
16
);
}
return
*
this
;
}
...
...
Utilities/FileNameUtil.cpp
View file @
4f2f3bde
...
...
@@ -31,7 +31,8 @@ QString Utilities::stripEndingForwardSlash(const QString &fileName)
QString
Utilities
::
relativeFolderName
(
const
QString
&
fileName
)
{
int
index
=
fileName
.
lastIndexOf
(
QChar
::
fromLatin1
(
'/'
),
-
1
);
static
QChar
slash
=
QChar
::
fromLatin1
(
'/'
);
int
index
=
fileName
.
lastIndexOf
(
slash
,
-
1
);
if
(
index
==
-
1
)
return
QString
();
else
...
...
@@ -40,16 +41,19 @@ QString Utilities::relativeFolderName(const QString &fileName)
QString
Utilities
::
absoluteImageFileName
(
const
QString
&
relativeName
)
{
return
stripEndingForwardSlash
(
Settings
::
SettingsData
::
instance
()
->
imageDirectory
())
+
QString
::
fromLatin1
(
"/"
)
+
relativeName
;
static
QString
slash
=
QString
::
fromLatin1
(
"/"
);
return
stripEndingForwardSlash
(
Settings
::
SettingsData
::
instance
()
->
imageDirectory
())
+
slash
+
relativeName
;
}
QString
Utilities
::
imageFileNameToAbsolute
(
const
QString
&
fileName
)
{
static
QString
slash
=
QString
::
fromLatin1
(
"/"
);
static
QString
fileslashslash
=
QString
::
fromLatin1
(
"file://"
);
if
(
fileName
.
startsWith
(
Settings
::
SettingsData
::
instance
()
->
imageDirectory
()))
return
fileName
;
else
if
(
fileName
.
startsWith
(
QString
::
fromLatin1
(
"file://"
)
))
else
if
(
fileName
.
startsWith
(
fileslashslash
))
return
imageFileNameToAbsolute
(
fileName
.
mid
(
7
));
// 7 == length("file://")
else
if
(
fileName
.
startsWith
(
QString
::
fromLatin1
(
"/"
)
))
else
if
(
fileName
.
startsWith
(
slash
))
return
QString
();
// Not within our image root
else
return
absoluteImageFileName
(
fileName
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment