Skip to content
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
7 changes: 5 additions & 2 deletions interpreter/cling/lib/Utils/ParserStateRAII.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ cling::ParserStateRAII::~ParserStateRAII() {
// Note: Consuming the EOF token will pop the include stack.
//
{
// Cleanup the TemplateIds before swapping the previous set back.
Parser::DestroyTemplateIdAnnotationsRAIIObj CleanupTemplateIds(*P);
// Forcefully clean up the TemplateIds, ignoring additional checks in
// MaybeDestroyTemplateIds called from DestroyTemplateIdAnnotationsRAIIObj,
// before swapping the previous set back.
P->DestroyTemplateIds();
}
P->TemplateIds.swap(OldTemplateIds);
assert(OldTemplateIds.empty());
if (SkipToEOF)
P->SkipUntil(tok::eof);
else
Expand Down
2 changes: 1 addition & 1 deletion tree/ntuple/v7/doc/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Walkthrough: Reading Data

```c++
auto file = std::make_unique<TFile>("data.root");
auto ntuple = file->Get<RNTuple>("ntpl");
auto ntuple = std::unique_ptr<RNTuple>(file->Get<RNTuple>("ntpl"));

// Option 1: entire row
// The reader creates a page source; the page source creates a model from the on-disk information
Expand Down
5 changes: 4 additions & 1 deletion tree/ntuple/v7/src/RMiniFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,9 @@ ROOT::Experimental::Internal::RNTupleFileWriter::RFileSimple::RFileSimple()
static_assert(kBlockSize % kBlockAlign == 0, "invalid block size");
std::align_val_t blockAlign{kBlockAlign};
fHeaderBlock = static_cast<unsigned char *>(::operator new[](kHeaderBlockSize, blockAlign));
memset(fHeaderBlock, 0, kHeaderBlockSize);
fBlock = static_cast<unsigned char *>(::operator new[](kBlockSize, blockAlign));
memset(fBlock, 0, kBlockSize);
}

ROOT::Experimental::Internal::RNTupleFileWriter::RFileSimple::~RFileSimple()
Expand Down Expand Up @@ -1411,7 +1413,8 @@ void ROOT::Experimental::Internal::RNTupleFileWriter::RFileSimple::Write(const v
if (retval != kBlockSize)
throw RException(R__FAIL(std::string("write failed: ") + strerror(errno)));

// TODO: do we want to null the buffer contents?
// Null the buffer contents for good measure.
memset(fBlock, 0, kBlockSize);
}

fBlockOffset = blockOffset;
Expand Down
3 changes: 2 additions & 1 deletion tree/ntuple/v7/test/ntuple_basics.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ TEST(RNTuple, FileAnchor)
auto readerB = RNTupleReader::Open("B", fileGuard.GetPath());

auto f = std::unique_ptr<TFile>(TFile::Open(fileGuard.GetPath().c_str()));
auto readerA = RNTupleReader::Open(*f->Get<RNTuple>("A"));
auto ntuple = std::unique_ptr<RNTuple>(f->Get<RNTuple>("A"));
auto readerA = RNTupleReader::Open(*ntuple);

EXPECT_EQ(1U, readerA->GetNEntries());
EXPECT_EQ(1U, readerB->GetNEntries());
Expand Down
2 changes: 1 addition & 1 deletion tree/ntuple/v7/test/ntuple_compat.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ TEST(RNTupleCompat, FwdCompat_FutureNTuple)
{
auto tfile = std::unique_ptr<TFile>(TFile::Open(fileGuard.GetPath().c_str(), "READ"));
assert(!tfile->IsZombie());
auto *ntuple = tfile->Get<RNTuple>(kNtupleObjName);
auto ntuple = std::unique_ptr<RNTuple>(tfile->Get<RNTuple>(kNtupleObjName));
EXPECT_EQ(ntuple->GetVersionEpoch(), RXTuple{}.fVersionEpoch);
EXPECT_EQ(ntuple->GetVersionMajor(), RXTuple{}.fVersionMajor);
EXPECT_EQ(ntuple->GetVersionMinor(), RXTuple{}.fVersionMinor);
Expand Down
9 changes: 6 additions & 3 deletions tree/ntuple/v7/test/ntuple_extended.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ TEST(RNTuple, LargeFile1)
{
auto f = std::unique_ptr<TFile>(TFile::Open(fileGuard.GetPath().c_str(), "READ"));
EXPECT_TRUE(f);
auto reader = RNTupleReader::Open(*f->Get<RNTuple>("myNTuple"));
auto ntuple = std::unique_ptr<RNTuple>(f->Get<RNTuple>("myNTuple"));
auto reader = RNTupleReader::Open(*ntuple);
auto rdEnergy = reader->GetView<double>("energy");

double chksumRead = 0.0;
Expand Down Expand Up @@ -257,11 +258,13 @@ TEST(RNTuple, LargeFile2)
auto s2 = f->Get<std::string>("s2");
EXPECT_EQ("two", *s2);

auto reader = RNTupleReader::Open(*f->Get<RNTuple>("small"));
auto small = std::unique_ptr<RNTuple>(f->Get<RNTuple>("small"));
auto reader = RNTupleReader::Open(*small);
reader->LoadEntry(0);
EXPECT_EQ(42.0f, *reader->GetModel().GetDefaultEntry().GetPtr<float>("pt"));

reader = RNTupleReader::Open(*f->Get<RNTuple>("large"));
auto large = std::unique_ptr<RNTuple>(f->Get<RNTuple>("large"));
reader = RNTupleReader::Open(*large);
auto viewE = reader->GetView<double>("E");
double chksumRead = 0.0;
for (auto i : reader->GetEntryRange()) {
Expand Down
6 changes: 4 additions & 2 deletions tree/ntuple/v7/test/ntuple_storage.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,8 @@ TEST(RNTuple, PageFillingString)
TEST(RNTuple, OpenHTTP)
{
std::unique_ptr<TFile> file(TFile::Open("http://root.cern/files/tutorials/ntpl004_dimuon_v1rc2.root"));
auto reader = RNTupleReader::Open(*file->Get<RNTuple>("Events"));
auto Events = std::unique_ptr<RNTuple>(file->Get<RNTuple>("Events"));
auto reader = RNTupleReader::Open(*Events);
reader->LoadEntry(0);
}
#endif
Expand All @@ -416,7 +417,8 @@ TEST(RNTuple, TMemFile)
writer->Fill();
}

auto reader = RNTupleReader::Open(*file.Get<RNTuple>("ntpl"));
auto ntpl = std::unique_ptr<RNTuple>(file.Get<RNTuple>("ntpl"));
auto reader = RNTupleReader::Open(*ntpl);
auto pt = reader->GetModel().GetDefaultEntry().GetPtr<float>("pt");
reader->LoadEntry(0);
EXPECT_EQ(*pt, 42.0);
Expand Down
2 changes: 1 addition & 1 deletion tree/ntupleutil/v7/inc/ROOT/RNTupleInspector.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ using ROOT::Experimental::RNTuple;
using ROOT::Experimental::RNTupleInspector;

auto file = TFile::Open("data.rntuple");
auto rntuple = file->Get<RNTuple>("NTupleName");
auto rntuple = std::unique_ptr<RNTuple>(file->Get<RNTuple>("NTupleName"));
auto inspector = RNTupleInspector::Create(rntuple);

std::cout << "The compression factor is " << inspector->GetCompressionFactor()
Expand Down
2 changes: 1 addition & 1 deletion tree/ntupleutil/v7/test/ntuple_inspector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ TEST(RNTupleInspector, CreateFromPointer)
}

std::unique_ptr<TFile> file(TFile::Open(fileGuard.GetPath().c_str()));
auto ntuple = file->Get<RNTuple>("ntuple");
auto ntuple = std::unique_ptr<RNTuple>(file->Get<RNTuple>("ntuple"));
auto inspector = RNTupleInspector::Create(*ntuple);
EXPECT_EQ(inspector->GetDescriptor()->GetName(), "ntuple");
}
Expand Down
2 changes: 1 addition & 1 deletion tutorials/v7/ntuple/ntpl008_import.C
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void ntpl008_import()
std::cerr << "cannot open " << kNTupleFileName << std::endl;
return;
}
auto ntpl = file->Get<RNTuple>("Events");
auto ntpl = std::unique_ptr<RNTuple>(file->Get<RNTuple>("Events"));
auto reader = RNTupleReader::Open(*ntpl);
reader->PrintInfo();

Expand Down