From cc736158a61094a598da331acd8769318ad4c327 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 7 Mar 2021 09:51:21 +0400 Subject: [PATCH] Get rid of QByteArray in djbStringHash --- Telegram/SourceFiles/platform/linux/main_window_linux.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp index 7a9f7d846b..605412c3d5 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp @@ -469,9 +469,8 @@ bool IsSNIAvailable() { uint djbStringHash(const std::string &string) { uint hash = 5381; - const auto chars = QByteArray::fromStdString(string.data()); - for(int i = 0; i < chars.length(); i++){ - hash = (hash << 5) + hash + chars[i]; + for (const auto &curChar : string) { + hash = (hash << 5) + hash + curChar; } return hash; }