summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Thiago Macieira <thiago@macieira.org>2013-12-11 17:56:35 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-12 03:37:24 +0100
commit0f3928f315d147e0631e7ca2c6c928847425a273 (patch)
treeb92319398a7218735d3f766556755c86840fcc68
parent841bdf3462ded58266eb884efcbb043579995617 (diff)
downloadsubsurface-0f3928f315d147e0631e7ca2c6c928847425a273.tar.gz
Don't check if a file exists right before trying to open it
The open call will tell us what we need to know. Obviously we can't open a file that doesn't exist. This saves us one stat() or Windows equivalent. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/subsurfacewebservices.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp
index 7828b4012..b6d9261c9 100644
--- a/qt-ui/subsurfacewebservices.cpp
+++ b/qt-ui/subsurfacewebservices.cpp
@@ -559,8 +559,7 @@ void DivelogsDeWebServices::prepareDivesForUpload()
char *filename = prepare_dives_for_divelogs(true);
if (filename) {
QFile f(filename);
- if (f.exists()) {
- f.open(QIODevice::ReadOnly);
+ if (f.open(QIODevice::ReadOnly)) {
uploadDives((QIODevice *)&f);
f.close();
f.remove();