Skip to content

Commit e849b43

Browse files
committed
API changes: COMPARE_HASH_ONLY removed
1 parent f5fd140 commit e849b43

File tree

6 files changed

+7
-44
lines changed

6 files changed

+7
-44
lines changed

.github/workflows/arduino-lint.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Aarduino-lint
1+
name: arduino-lint
22
on: [push, pull_request]
33
jobs:
44
lint:
@@ -7,4 +7,6 @@ jobs:
77
- uses: actions/checkout@v2
88
- uses: arduino/arduino-lint-action@v1
99
with:
10-
library-manager: update
10+
library-manager: update
11+
compliance: strict
12+

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ int readValue();
1616

1717
int readValue(void *buff, unsigned int byteNum);
1818

19-
void compareKeyExactly();
20-
21-
void compareHashOnly();
22-
2319
cdbResult close();
2420
```
2521

examples/airports/airports.ino

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ void setup() {
7171
SD.begin(10);
7272

7373
if (ucdb.open(fileName) == CDB_OK) {
74-
// ucdb.compareHashOnly();
75-
7674
// Find some existing codes.
7775
for (unsigned int i = 0; i < sizeof (air) / sizeof (const char *); i++) {
7876
query(air[i], strlen(air[i]));

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=uCDB
2-
version=0.3.0
2+
version=0.4.0
33
author=Ioulianos Kakoulidis
44
maintainer=Ioulianos Kakoulidis <[email protected]>
55
sentence=API for querying Constant DataBase file store.

src/uCDB.cpp

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
static unsigned long unpack(const byte buff[]);
1616

1717
uCDB::uCDB() {
18-
cmp = COMPARE_KEY_EXACTLY;
1918
state = CDB_CLOSED;
2019
}
2120

@@ -173,22 +172,8 @@ cdbResult uCDB::findNextValue() {
173172

174173
valueBytesAvail = dataValueLen;
175174

176-
switch (cmp) {
177-
case COMPARE_HASH_ONLY:
178-
if (cdb.seek(dataPos + CDB_DESCRIPTOR_SIZE + dataKeyLen)) {
179-
return (state = KEY_FOUND);
180-
}
181-
else {
182-
return (state = FILE_ERROR);
183-
}
184-
185-
default:
186-
if (keyLen_ != dataKeyLen) {
187-
break; // Scan next slot
188-
}
189-
if (compareKey() == KEY_FOUND) {
190-
return (state = KEY_FOUND);
191-
}
175+
if ((keyLen_ == dataKeyLen) & (compareKey() == KEY_FOUND)) {
176+
return (state = KEY_FOUND);
192177
}
193178
}
194179
}
@@ -226,14 +211,6 @@ int uCDB::readValue(void *buff, unsigned int byteNum) {
226211
return cdb.read(buff, byteNum);
227212
}
228213

229-
void uCDB::compareKeyExactly() {
230-
cmp = COMPARE_KEY_EXACTLY;
231-
}
232-
233-
void uCDB::compareHashOnly() {
234-
cmp = COMPARE_HASH_ONLY;
235-
}
236-
237214
cdbResult uCDB::close() {
238215
cdb.close();
239216
return (state = CDB_CLOSED);

src/uCDB.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
#include <SPI.h>
1414
#include <SD.h>
1515

16-
/** Key compare rule type */
17-
enum compareRule {
18-
COMPARE_KEY_EXACTLY = 0, //< Match key exactly (key hash, key length, key)
19-
COMPARE_HASH_ONLY //< Match only key hash (key hash)
20-
};
21-
2216
enum cdbResult {
2317
CDB_OK = 0,
2418
CDB_CLOSED, // Initial state
@@ -65,9 +59,6 @@ class uCDB
6559
*/
6660
int readValue(void *buff, unsigned int byteNum);
6761

68-
void compareKeyExactly();
69-
void compareHashOnly();
70-
7162
/**
7263
Close CDB
7364
*/
@@ -76,7 +67,6 @@ class uCDB
7667
private:
7768
File cdb;
7869
cdbResult state;
79-
compareRule cmp;
8070

8171
const byte *key_;
8272
unsigned long keyLen_;

0 commit comments

Comments
 (0)