Skip to content

Commit

Permalink
Addressign comments
Browse files Browse the repository at this point in the history
Change-Id: I2530e3c539d817786ef456bb0387552bce65454e
  • Loading branch information
madhurajayaraman committed Jun 14, 2024
1 parent 49edf72 commit 4c026ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions starboard/android/shared/posix_emu/dirent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static int gen_fd() {
Mutex mutex_;
static std::map<int, AAssetDir*>* asset_map = nullptr;

int handle_db_put(AAssetDir* assetDir) {
static int handle_db_put(AAssetDir* assetDir) {
ScopedLock scoped_lock(mutex_);
if (asset_map == nullptr) {
asset_map = new std::map<int, AAssetDir*>();
Expand Down Expand Up @@ -90,7 +90,7 @@ static AAssetDir* handle_db_get(int fd, bool erase) {

AAssetDir* asset_dir = itr->second;
if (erase) {
asset_map->erase(fd);
asset_map->erase(itr);
}
return asset_dir;
}
Expand Down
10 changes: 6 additions & 4 deletions starboard/shared/win32/posix_emu/dirent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static int gen_fd() {
static std::map<int, std::deque<std::string>>* directory_map = nullptr;
static CriticalSection g_critical_section;

int handle_db_put(std::deque<std::string> next_directory_entry) {
static int handle_db_put(std::deque<std::string> next_directory_entry) {
EnterCriticalSection(&g_critical_section.critical_section_);
if (directory_map == nullptr) {
directory_map = new std::map<int, std::deque<std::string>>();
Expand All @@ -68,24 +68,26 @@ static std::deque<std::string> handle_db_get(int handle, bool erase) {
}
EnterCriticalSection(&g_critical_section.critical_section_);
if (directory_map == nullptr) {
directory_map = new std::map<int, std::deque<std::string>>();
LeaveCriticalSection(&g_critical_section.critical_section_);
return empty_deque;
}

auto itr = directory_map->find(handle);
if (itr == directory_map->end()) {
LeaveCriticalSection(&g_critical_section.critical_section_);
return empty_deque;
}

std::deque<std::string> next_directory_entry = itr->second;
if (erase) {
directory_map->erase(handle);
directory_map->erase(itr);
}
LeaveCriticalSection(&g_critical_section.critical_section_);
return next_directory_entry;
}

void handle_db_replace(int fd, std::deque<std::string> next_directory_entry) {
static void handle_db_replace(int fd,
std::deque<std::string> next_directory_entry) {
EnterCriticalSection(&g_critical_section.critical_section_);
if (directory_map == nullptr) {
directory_map = new std::map<int, std::deque<std::string>>();
Expand Down

0 comments on commit 4c026ac

Please sign in to comment.