Skip to content

Commit

Permalink
[io] warn user about the trailing blanks being stripped from keyname …
Browse files Browse the repository at this point in the history
…upon writing

See #17003
  • Loading branch information
ferdymercury authored and dpiparo committed Nov 22, 2024
1 parent 1c94d18 commit b386810
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions io/io/src/TDirectoryFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<nch;i++) {
Expand Down

0 comments on commit b386810

Please sign in to comment.