Build break fix

Summary:
(1) Integer size correction (mac build break)
(2) snprint usage in Windows (windows build break)

Test Plan: Build in windows and mac

Reviewers: sdong

Subscribers: andrewkr, dhruba

Differential Revision: https://reviews.facebook.net/D60927
main
krad 8 years ago
parent 68a8e6b8fa
commit 7bedd94406
  1. 2
      utilities/persistent_cache/block_cache_tier_file.cc
  2. 2
      utilities/persistent_cache/block_cache_tier_file.h
  3. 5
      utilities/simulator_cache/sim_cache.cc

@ -38,7 +38,7 @@ Status NewRandomAccessCacheFile(Env* const env, const std::string& filepath,
// //
// BlockCacheFile // BlockCacheFile
// //
Status BlockCacheFile::Delete(size_t* size) { Status BlockCacheFile::Delete(uint64_t* size) {
Status status = env_->GetFileSize(Path(), size); Status status = env_->GetFileSize(Path(), size);
if (!status.ok()) { if (!status.ok()) {
return status; return status;

@ -126,7 +126,7 @@ class BlockCacheFile : public LRUElement<BlockCacheFile> {
// get block information // get block information
std::list<BlockInfo*>& block_infos() { return block_infos_; } std::list<BlockInfo*>& block_infos() { return block_infos_; }
// delete file and return the size of the file // delete file and return the size of the file
virtual Status Delete(size_t* size); virtual Status Delete(uint64_t* size);
protected: protected:
port::RWMutex rwlock_; // synchronization mutex port::RWMutex rwlock_; // synchronization mutex

@ -133,8 +133,13 @@ class SimCacheImpl : public SimCache {
"\n"); "\n");
res.append("SimCache HITs: " + std::to_string(get_hit_counter()) + "\n"); res.append("SimCache HITs: " + std::to_string(get_hit_counter()) + "\n");
char buff[100]; char buff[100];
#ifdef OS_WIN
_snprintf(buff, sizeof(buff), "SimCache HITRATE: %.2f%%\n",
get_hit_rate() * 100);
#else
snprintf(buff, sizeof(buff), "SimCache HITRATE: %.2f%%\n", snprintf(buff, sizeof(buff), "SimCache HITRATE: %.2f%%\n",
get_hit_rate() * 100); get_hit_rate() * 100);
#endif
res.append(buff); res.append(buff);
return res; return res;
} }

Loading…
Cancel
Save