Skip to content

Commit

Permalink
Fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
netheril96 committed Mar 6, 2024
1 parent 83b4051 commit edd55b2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(NOT CMAKE_CXX_STANDARD)
Expand Down Expand Up @@ -89,7 +89,7 @@ if(SECUREFS_USE_VCPKG)
target_link_libraries(securefs-static PUBLIC cryptopp::cryptopp)
find_package(unofficial-utf8proc CONFIG REQUIRED)
target_link_libraries(securefs-static PUBLIC utf8proc)
find_package(unofficial-libargon2 CONFIG REQUIRED)
find_package(unofficial-argon2 CONFIG REQUIRED)
target_link_libraries(securefs-static PUBLIC unofficial::argon2::libargon2)
find_package(jsoncpp CONFIG REQUIRED)
target_link_libraries(securefs-static PUBLIC JsonCpp::JsonCpp)
Expand Down
11 changes: 8 additions & 3 deletions sources/lite_format.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "lite_format.h"
#include "exceptions.h"
#include "lite_long_name_lookup_table.h"
#include "lock_guard.h"
#include "logger.h"
#include "macro.h"
#include "platform.h"
Expand Down Expand Up @@ -177,9 +178,13 @@ namespace lite_format
}
else
{
decoded = name_trans_.decrypt_path_component(lazy_get_table().transact(
[&](LongNameLookupTable& table) -> std::string
{ return table.lookup(under_name); }));
auto&& table = lazy_get_table();
std::string encrypted_name;
{
LockGuard<LongNameLookupTable> lg(table);
encrypted_name = table.lookup(under_name);
}
decoded = name_trans_.decrypt_path_component(encrypted_name);
decoded.value().swap(*name);
}
}
Expand Down
8 changes: 0 additions & 8 deletions sources/lite_long_name_lookup_table.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#include "crypto.h"
#include "lock_guard.h"
#include "platform.h"
#include "sqlite_helper.h"

Expand All @@ -23,13 +22,6 @@ class ABSL_LOCKABLE LongNameLookupTable
ABSL_EXCLUSIVE_LOCKS_REQUIRED(*this);
void delete_once(absl::string_view encrypted_hash) ABSL_EXCLUSIVE_LOCKS_REQUIRED(*this);

template <typename Callback>
auto transact(Callback&& callback) -> decltype(callback(*this))
{
LockGuard<LongNameLookupTable> lg(*this);
return callback(*this);
}

void lock() ABSL_EXCLUSIVE_LOCK_FUNCTION(*this) ABSL_NO_THREAD_SAFETY_ANALYSIS
{
db_.mutex().lock();
Expand Down

0 comments on commit edd55b2

Please sign in to comment.