From b3868102a787e7b44c1ba49d8446f5796568ec42 Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Thu, 21 Nov 2024 18:17:29 +0100 Subject: [PATCH] [io] warn user about the trailing blanks being stripped from keyname upon writing See https://github.com/root-project/root/issues/17003 --- io/io/src/TDirectoryFile.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/io/io/src/TDirectoryFile.cxx b/io/io/src/TDirectoryFile.cxx index 0d4e8be9ce967..6953c660fe801 100644 --- a/io/io/src/TDirectoryFile.cxx +++ b/io/io/src/TDirectoryFile.cxx @@ -1946,6 +1946,8 @@ Int_t TDirectoryFile::WriteTObject(const TObject *obj, const char *name, Option_ Int_t nch = strlen(oname); char *newName = nullptr; if (nch && oname[nch-1] == ' ') { + Warning("WriteTObject", "The key name '%s' will be stored in file without the trailing blanks.", obj->GetName()); + // See https://github.com/root-project/root/issues/17003 newName = new char[nch+1]; strlcpy(newName,oname,nch+1); for (Int_t i=0;i