From 890ec1ede261db6a0adc45de55119668e947e7be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20LE=20STUM?= <sebastien.le-stum@savoirfairelinux.com> Date: Wed, 30 Sep 2020 15:37:16 -0400 Subject: [PATCH] archiver: clarify usage of past-the-end iterator Previous implementation was introducing ambiguity on a potential off-by-one. Rework the statement so it is clear that char_file_end is to be considered as collection's end(). Change-Id: I7af6f9333c80c8a897ff21ca5ccfe2a2c268546d --- src/archiver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/archiver.cpp b/src/archiver.cpp index ecee28612d..48dac4e9f3 100644 --- a/src/archiver.cpp +++ b/src/archiver.cpp @@ -202,7 +202,7 @@ importAccounts(const std::string& archivePath, const std::string& password) try { const auto* char_file_begin = reinterpret_cast<const char*>(&file[0]); - const auto* char_file_end = reinterpret_cast<const char*>(&file[file.size()]); + const auto* char_file_end = char_file_begin + file.size(); // Add std::string err; -- GitLab