diff --git a/.github/workflows/arduino-lint.yml b/.github/workflows/arduino-lint.yml index 4201286..287b3ef 100644 --- a/.github/workflows/arduino-lint.yml +++ b/.github/workflows/arduino-lint.yml @@ -1,4 +1,4 @@ -name: Aarduino-lint +name: arduino-lint on: [push, pull_request] jobs: lint: @@ -7,4 +7,6 @@ jobs: - uses: actions/checkout@v2 - uses: arduino/arduino-lint-action@v1 with: - library-manager: update + library-manager: update + compliance: strict + diff --git a/README.md b/README.md index 979b8f3..9a15ef0 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,6 @@ int readValue(); int readValue(void *buff, unsigned int byteNum); -void compareKeyExactly(); - -void compareHashOnly(); - cdbResult close(); ``` diff --git a/examples/airports/airports.ino b/examples/airports/airports.ino index 0d5f48d..079f13c 100644 --- a/examples/airports/airports.ino +++ b/examples/airports/airports.ino @@ -71,8 +71,6 @@ void setup() { SD.begin(10); if (ucdb.open(fileName) == CDB_OK) { - // ucdb.compareHashOnly(); - // Find some existing codes. for (unsigned int i = 0; i < sizeof (air) / sizeof (const char *); i++) { query(air[i], strlen(air[i])); diff --git a/library.properties b/library.properties index 002e618..e7ecf8d 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=uCDB -version=0.3.0 +version=0.4.0 author=Ioulianos Kakoulidis maintainer=Ioulianos Kakoulidis sentence=API for querying Constant DataBase file store. diff --git a/src/uCDB.cpp b/src/uCDB.cpp index da47b7d..7b5b4b2 100644 --- a/src/uCDB.cpp +++ b/src/uCDB.cpp @@ -15,7 +15,6 @@ static unsigned long unpack(const byte buff[]); uCDB::uCDB() { - cmp = COMPARE_KEY_EXACTLY; state = CDB_CLOSED; } @@ -173,22 +172,8 @@ cdbResult uCDB::findNextValue() { valueBytesAvail = dataValueLen; - switch (cmp) { - case COMPARE_HASH_ONLY: - if (cdb.seek(dataPos + CDB_DESCRIPTOR_SIZE + dataKeyLen)) { - return (state = KEY_FOUND); - } - else { - return (state = FILE_ERROR); - } - - default: - if (keyLen_ != dataKeyLen) { - break; // Scan next slot - } - if (compareKey() == KEY_FOUND) { - return (state = KEY_FOUND); - } + if ((keyLen_ == dataKeyLen) & (compareKey() == KEY_FOUND)) { + return (state = KEY_FOUND); } } } @@ -226,14 +211,6 @@ int uCDB::readValue(void *buff, unsigned int byteNum) { return cdb.read(buff, byteNum); } -void uCDB::compareKeyExactly() { - cmp = COMPARE_KEY_EXACTLY; -} - -void uCDB::compareHashOnly() { - cmp = COMPARE_HASH_ONLY; -} - cdbResult uCDB::close() { cdb.close(); return (state = CDB_CLOSED); diff --git a/src/uCDB.h b/src/uCDB.h index 4b2b352..7d18615 100644 --- a/src/uCDB.h +++ b/src/uCDB.h @@ -13,12 +13,6 @@ #include #include -/** Key compare rule type */ -enum compareRule { - COMPARE_KEY_EXACTLY = 0, //< Match key exactly (key hash, key length, key) - COMPARE_HASH_ONLY //< Match only key hash (key hash) -}; - enum cdbResult { CDB_OK = 0, CDB_CLOSED, // Initial state @@ -65,9 +59,6 @@ class uCDB */ int readValue(void *buff, unsigned int byteNum); - void compareKeyExactly(); - void compareHashOnly(); - /** Close CDB */ @@ -76,7 +67,6 @@ class uCDB private: File cdb; cdbResult state; - compareRule cmp; const byte *key_; unsigned long keyLen_;