From b80bb538af99d6e4eff4c0102db3cc389e34ce16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D1=81=D0=BB=D0=B0=D0=B2=20?= =?UTF-8?q?=D0=A1=D1=83=D1=85=D0=BE=D0=B2?= <22411953+Vladislav4KZ@users.noreply.github.com> Date: Mon, 10 Oct 2022 01:51:32 +0600 Subject: [PATCH] fix: do not write modified_by if the name matches the author (#375) fix: do not write modified_by if the name matches the author fix: missing empty author string check --- src/graph.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/graph.cpp b/src/graph.cpp index 0f58408..ee416a8 100644 --- a/src/graph.cpp +++ b/src/graph.cpp @@ -1792,7 +1792,10 @@ template bool BotGraph::loadStorage (StringRef ext, StringRef name, strings.copy (m_extenHeader.author, exten->author, cr::bufsize (exten->author)); if (extenSize <= actuallyRead) { - strings.copy (m_extenHeader.modified, exten->modified, cr::bufsize (exten->modified)); + // write modified by, only if the name is different + if (!strings.isEmpty (m_extenHeader.author) && strncmp (m_extenHeader.author, exten->modified, cr::bufsize (m_extenHeader.author)) != 0) { + strings.copy (m_extenHeader.modified, exten->modified, cr::bufsize (exten->modified)); + } } else { strings.copy (m_extenHeader.modified, "(none)", cr::bufsize (exten->modified)); @@ -1889,7 +1892,7 @@ bool BotGraph::saveGraphData () { } ExtenHeader exten {}; - // only modify the author if no author currenlty assigned to graph file + // only modify the author if no author currently assigned to graph file if (m_graphAuthor.empty () || strings.isEmpty (m_extenHeader.author)) { strings.copy (exten.author, editorName.chars (), cr::bufsize (exten.author)); }