@nxtedition/rocksdb 7.0.41 → 7.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,22 +4,9 @@
4
4
 
5
5
  int compareRev(const rocksdb::Slice& a, const rocksdb::Slice& b) {
6
6
  auto indexA = 0;
7
- const auto endA = a.size();
8
- auto lenA = endA;
9
-
10
7
  auto indexB = 0;
8
+ const auto endA = a.size();
11
9
  const auto endB = b.size();
12
- auto lenB = endB;
13
-
14
- // Skip leading zeroes
15
- while (a[indexA] == '0') {
16
- ++indexA;
17
- --lenA;
18
- }
19
- while (b[indexB] == '0') {
20
- ++indexB;
21
- --lenB;
22
- }
23
10
 
24
11
  // Compare the revision number
25
12
  auto result = 0;
@@ -47,7 +34,7 @@ int compareRev(const rocksdb::Slice& a, const rocksdb::Slice& b) {
47
34
  }
48
35
 
49
36
  // Compare the rest
50
- while (indexA < end) {
37
+ while (indexA < end && indexB < end) {
51
38
  const auto ac = a[indexA++];
52
39
  const auto bc = b[indexB++];
53
40
  if (ac != bc) {
@@ -55,7 +42,7 @@ int compareRev(const rocksdb::Slice& a, const rocksdb::Slice& b) {
55
42
  }
56
43
  }
57
44
 
58
- return lenA - lenB;
45
+ return endA - endB;
59
46
  }
60
47
 
61
48
  // Merge operator that picks the maximum operand, Comparison is based on
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/rocksdb",
3
- "version": "7.0.41",
3
+ "version": "7.0.42",
4
4
  "description": "A low-level Node.js RocksDB binding",
5
5
  "license": "MIT",
6
6
  "main": "index.js",