Skip to content

Commit

Permalink
Merge pull request #783 from kiwix/windows_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mgautierfr authored Jun 10, 2022
2 parents 69c5c88 + ae47e5e commit 3bbbd1b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ std::shared_ptr<Reader> Library::getReaderById(const std::string& id)
{
auto archive = getArchiveById(id);
if(archive) {
return std::make_shared<Reader>(archive);
return std::shared_ptr<Reader>(new Reader(archive, true));
} else {
return nullptr;
}
Expand Down
6 changes: 3 additions & 3 deletions test/lrucache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ TEST(CacheTest, DropValue) {
TEST(CacheTest1, KeepsAllValuesWithinCapacity) {
kiwix::lru_cache<int, int> cache_lru(TEST2_CACHE_CAPACITY);

for (uint i = 0; i < NUM_OF_TEST2_RECORDS; ++i) {
for (unsigned int i = 0; i < NUM_OF_TEST2_RECORDS; ++i) {
cache_lru.put(i, i);
}

for (uint i = 0; i < NUM_OF_TEST2_RECORDS - TEST2_CACHE_CAPACITY; ++i) {
for (unsigned int i = 0; i < NUM_OF_TEST2_RECORDS - TEST2_CACHE_CAPACITY; ++i) {
EXPECT_FALSE(cache_lru.exists(i));
}

for (uint i = NUM_OF_TEST2_RECORDS - TEST2_CACHE_CAPACITY; i < NUM_OF_TEST2_RECORDS; ++i) {
for (unsigned int i = NUM_OF_TEST2_RECORDS - TEST2_CACHE_CAPACITY; i < NUM_OF_TEST2_RECORDS; ++i) {
EXPECT_TRUE(cache_lru.exists(i));
EXPECT_EQ((int)i, cache_lru.get(i));
}
Expand Down

0 comments on commit 3bbbd1b

Please sign in to comment.