Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io: Allow implicit conversion from vector<pair<A<B> > to map<A,B> #17591

Merged
merged 5 commits into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions io/io/src/TBufferJSON.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -717,8 +717,10 @@ TString TBufferJSON::StoreObject(const void *obj, const TClass *cl)

////////////////////////////////////////////////////////////////////////////////
/// Converts selected data member into json
/// Parameter ptr specifies address in memory, where data member is located
/// compact parameter defines compactness of produced JSON (from 0 to 3)
/// Parameter ptr specifies address in memory, where data member is located.
/// Note; if data member described by 'member'is pointer, `ptr` should be the
/// value of the pointer, not the address of the pointer.
/// compact parameter defines compactness of produced JSON (from 0 to 3).
/// arraylen (when specified) is array length for this data member, //[fN] case

TString TBufferJSON::ConvertToJSON(const void *ptr, TDataMember *member, Int_t compact, Int_t arraylen)
Expand Down Expand Up @@ -1002,6 +1004,8 @@ void *TBufferJSON::ConvertFromJSONChecked(const char *str, const TClass *expecte

////////////////////////////////////////////////////////////////////////////////
/// Convert single data member to JSON structures
/// Note; if data member described by 'member'is pointer, `ptr` should be the
/// value of the pointer, not the address of the pointer.
/// Returns string with converted member

TString TBufferJSON::JsonWriteMember(const void *ptr, TDataMember *member, TClass *memberClass, Int_t arraylen)
Expand Down Expand Up @@ -1034,7 +1038,13 @@ TString TBufferJSON::JsonWriteMember(const void *ptr, TDataMember *member, TClas
if (indx.IsArray() && (tid == kChar_t))
shift = indx.ReduceDimension();

auto unitSize = member->GetUnitSize();
char *ppp = (char *)ptr;
if (member->IsaPointer()) {
// UnitSize was the sizeof(void*)
assert(member->GetDataType());
unitSize = member->GetDataType()->Size();
}

if (indx.IsArray())
fOutBuffer.Append(indx.GetBegin());
Expand Down Expand Up @@ -1075,7 +1085,7 @@ TString TBufferJSON::JsonWriteMember(const void *ptr, TDataMember *member, TClas
if (indx.IsArray())
fOutBuffer.Append(indx.NextSeparator());

ppp += shift * member->GetUnitSize();
ppp += shift * unitSize;
pcanal marked this conversation as resolved.
Show resolved Hide resolved

} while (!indx.IsDone());

Expand Down
4 changes: 3 additions & 1 deletion io/io/src/TStreamerInfo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2459,7 +2459,9 @@ void TStreamerInfo::BuildOld()

} else if ( (newkind==ROOT::kSTLmap || newkind==ROOT::kSTLmultimap) &&
(oldkind!=ROOT::kSTLmap && oldkind!=ROOT::kSTLmultimap) ) {
element->SetNewType(TVirtualStreamerInfo::kUnsupportedConversion);
// This case was not previously not supported, however it is unclear
// why so we keep it as a separate case for the time behind.
element->Update(oldClass, newClass.GetClass());
} else {
element->Update(oldClass, newClass.GetClass());
}
Expand Down
Loading