Skip to content

Commit

Permalink
Merge pull request #242 from TI-Tokyo/develop-3.0
Browse files Browse the repository at this point in the history
Unbreak 32-bit build
  • Loading branch information
martinsumner authored Jun 21, 2022
2 parents bd45b8a + 1674ebf commit 6fb8242
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 56 deletions.
11 changes: 3 additions & 8 deletions port/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@
#include <string.h>
#include "leveldb/ldb_config.h"

// Include the appropriate platform specific file below. If you are
// porting to a new platform, see "port_example.h" for documentation
// of what the new port_<platform>.h file must provide.
#if defined(LEVELDB_PLATFORM_POSIX)
# include "port/port_posix.h"
#elif defined(LEVELDB_PLATFORM_CHROMIUM)
# include "port/port_chromium.h"
#endif
// there used to be more port_*.h, but everything seems to have become
// posix-compliant by now
#include "port/port_posix.h"

#endif // STORAGE_LEVELDB_PORT_PORT_H_
6 changes: 3 additions & 3 deletions table/table_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -826,9 +826,9 @@ TEST(TableTest, ApproximateOffsetOfCompressed) {
ASSERT_TRUE(Between(c.ApproximateOffsetOf("abc"), 0, 0));
ASSERT_TRUE(Between(c.ApproximateOffsetOf("k01"), 0, 0));
ASSERT_TRUE(Between(c.ApproximateOffsetOf("k02"), 0, 0));
ASSERT_TRUE(Between(c.ApproximateOffsetOf("k03"), 2000, 3000));
ASSERT_TRUE(Between(c.ApproximateOffsetOf("k04"), 2000, 3000));
ASSERT_TRUE(Between(c.ApproximateOffsetOf("xyz"), 4000, 6000));
ASSERT_TRUE(Between(c.ApproximateOffsetOf("k03"), 2000, 3500));
ASSERT_TRUE(Between(c.ApproximateOffsetOf("k04"), 2000, 3500));
ASSERT_TRUE(Between(c.ApproximateOffsetOf("xyz"), 4000, 6500));
}

} // namespace leveldb
Expand Down
4 changes: 2 additions & 2 deletions tools/sst_rewrite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ main(
{
leveldb::WritableFile * outfile;
leveldb::Status s;
std::auto_ptr<leveldb::Iterator> it;
std::auto_ptr<leveldb::TableBuilder> builder;
std::unique_ptr<leveldb::Iterator> it;
std::unique_ptr<leveldb::TableBuilder> builder;

LDbTable in_file(options, fname);

Expand Down
2 changes: 1 addition & 1 deletion util/bloom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const FilterPolicy* NewBloomFilterPolicy(int bits_per_key) {
// container to hold one bloom filter and auto destruct
struct BloomInventoryItem
{
std::auto_ptr<const FilterPolicy> m_Item;
std::unique_ptr<const FilterPolicy> m_Item;

BloomInventoryItem()
{
Expand Down
2 changes: 1 addition & 1 deletion util/bloom2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const FilterPolicy* NewBloomFilterPolicy2(int bits_per_key) {
// container to hold one bloom filter and auto destruct
struct BloomInventoryItem2
{
std::auto_ptr<const FilterPolicy> m_Item;
std::unique_ptr<const FilterPolicy> m_Item;

BloomInventoryItem2()
{
Expand Down
2 changes: 1 addition & 1 deletion util/expiry_os_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ TEST(ExpiryDBTester, Simple)
Status s;
sExpiryDBObject * cursor;
std::string buffer;
std::auto_ptr<leveldb::Iterator> iterator;
std::unique_ptr<leveldb::Iterator> iterator;

// enable compaction expiry
m_Expiry->expiry_enabled=true;
Expand Down
40 changes: 0 additions & 40 deletions util/perf_count.cc
Original file line number Diff line number Diff line change
Expand Up @@ -353,20 +353,8 @@ PerformanceCounters * gPerfCounters(&LocalStartupCounters);

val_ptr=&m_Counter[Index];

# if ULONG_MAX != 4294967295UL
inc_and_fetch(val_ptr);
#else
// hack fest for 64 bit semi-atomic on 32bit machine
uint32_t ret_32, * ptr_32;

ptr_32=(uint32_t *)&val_ptr;
ret_32=inc_and_fetch(ptr_32, 1);
if (0==ret_32)
{
++ptr_32;
inc_and_fetch(ptr_32, 1);
} // if
#endif
ret_val=*val_ptr;
} // if

Expand All @@ -388,20 +376,8 @@ PerformanceCounters * gPerfCounters(&LocalStartupCounters);

val_ptr=&m_Counter[Index];

# if ULONG_MAX != 4294967295UL
dec_and_fetch(val_ptr);
#else
// hack fest for 64 bit semi-atomic on 32bit machine
uint32_t ret_32, * ptr_32;

ptr_32=(uint32_t *)&val_ptr;
ret_32=dec_and_fetch(ptr_32);
if (0xFFFFFFFF==ret_32)
{
++ptr_32;
dec_and_fetch(ptr_32);
} // if
#endif
ret_val=*val_ptr;
} // if

Expand All @@ -424,23 +400,7 @@ PerformanceCounters * gPerfCounters(&LocalStartupCounters);

val_ptr=&m_Counter[Index];

# if ULONG_MAX != 4294967295UL
ret_val=add_and_fetch(val_ptr, Amount);
#else
// hack fest for 64 bit semi-atomic on 32bit machine
uint32_t old_32, ret_32, * ptr_32;

ptr_32=(uint32_t *)&val_ptr;
old_32=*ptr_32;
ret_32=add_and_fetch(ptr_32, Amount);
if (ret_32<old_32)
{
++ptr_32;
add_and_fetch(ptr_32, 1);
} // if

ret_val=*val_ptr;
#endif
} // if

return(ret_val);
Expand Down

0 comments on commit 6fb8242

Please sign in to comment.