]> git.xolatile.top Git - soikk-DB.git/commitdiff
Updated README and fixed error on example images. Removed deleted dependencies. Fixed...
authorSoikk <76824648+Soikk@users.noreply.github.com>
Sat, 13 Aug 2022 19:32:42 +0000 (21:32 +0200)
committerSoikk <76824648+Soikk@users.noreply.github.com>
Sat, 13 Aug 2022 19:32:42 +0000 (21:32 +0200)
CHANGELOG
README.md
include/db.h
multimedia/example1.jpg
multimedia/example2.jpg
src/main.c
src/storage.c

index 088cd04585f45845576036458ad765fb3fff6814..a1fb73fad2914dc73c6c1f545b276be60af39ffc 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+1660419119 (Sat Aug 13 2022 21:31:59 GMT+0200 (Central European Summer Time))
+Updated README and fixed error on example images. Removed deleted dependencies. Fixed AVL tree bug.
+
 1660415513 (Sat Aug 13 2022 20:31:53 GMT+0200 (Central European Summer Time))
 Added README and images. Fixed random thing in changelog.
 
index c52fb05a987fc99bd3f143cf8b72013b33be28b7..795d6e96802d037756f047a6ff6140f2e1ac909d 100644 (file)
--- a/README.md
+++ b/README.md
@@ -6,4 +6,4 @@ Uses a mix of AVL trees and normal arrays to work with the data
 ## Example
 Loading and debugging|Showing and removing tags
 :-------------------------:|:-------------------------:
-![](https://github.com/Soikk/DB/blob/master/multimedia/example1.jpg)  |  ![](https://github.com/Soikk/DB/blob/master/multimedia/example1.jpg)
+![](https://github.com/Soikk/DB/blob/master/multimedia/example1.jpg)  |  ![](https://github.com/Soikk/DB/blob/master/multimedia/example2.jpg)
index 2571d02c889922c08293a0d96a697323d2e0684f..1777fc219262238e92cc560ec4124b99ef680c26 100644 (file)
@@ -10,7 +10,6 @@
 #include <stdarg.h>
 
 
-#include "strnatcmp.h"
 #include "crc64.h"
 
 #include "str.h"
@@ -18,6 +17,5 @@
 #include "database.h"
 #include "repl.h"
 #include "parser.h"
-#include "bm.h"
 
 #endif
index 891556b5d39268466710e56f902544824fbdd365..37e8c541286a8aac394707d4f476e09eab0d9aa1 100644 (file)
Binary files a/multimedia/example1.jpg and b/multimedia/example1.jpg differ
index 1521a80342c3994caff172cd944d7a0c7522a5ec..f8e3f510a1c14e3e3af132c68a0db0b6fcad8fb0 100644 (file)
Binary files a/multimedia/example2.jpg and b/multimedia/example2.jpg differ
index 23e1fee0051b41a069c3be01a3416e2f5c7e6661..a9a7688d11294ae25c4fba96ed8aa57cfc4664a0 100644 (file)
@@ -6,26 +6,32 @@ int main(){
 
 
        inputBuffer *in = newInputBuffer();
-       /*database *test = newDatabase("miDB");
        
+       /*database *test = newDatabase("miDB");
        addFileTag(test, "vaca.png", "naturalezas");    
        addFileTags(test, "terry-davis.jpg", 3, "holyC", "programmer", "very cool");
        addFileTag(test, "vaca.png", "lovely");
        addFileTags(test, "vaca.png", 3, "nature", "animal", "very cool");
        addFileTag(test, "terry-davis.jpg", "based");
+       
+       printDatabase(test);
+
+       debugDatabase(test);
 
        storeDatabase(test, "db.db");
+       
+       test = loadDatabase("db.db");
 
-       printDatabase(db);
+       printDatabase(test);
 
-       debugDatabase(db);
+       debugDatabase(test);
        
        uint64_t *l, i;
-       searchFile(db, "terry-davis.jpg", 0, &l, &i);
+       searchFile(test, "terry-davis.jpg", 0, &l, &i);
        
        printf("Tags with file 'terry-davis.jpg':\n");
        for(uint64_t j = 0; j < i; ++j){
-               printf("\t%s\n", db->ltags->table[l[j]]);
+               printf("\t%s\n", test->ltags->table[l[j]]);
        
        }*/
 
index bc5ab6b876291359d218c2335c8c1241de81c58e..dc1ad886507c667f14a07ab6f49bbfe39f8b2fff 100644 (file)
@@ -504,13 +504,17 @@ int storeAVLTree(tree root, FILE *fp){
        return 0;
 }
 
-static node *arrayToNodes(uint64_t *array, uint64_t i, uint64_t maxNodes){
-       if(i >= maxNodes*2){
+static node *arrayToNodes(uint64_t *array, uint64_t pos, uint64_t maxNodes){
+       if(pos >= maxNodes*2){
                return NULL;
        }
-       node *n = newNode(array[i+0], array[i+1]);
-       n->left = arrayToNodes(array, (2*i + 1)*2, maxNodes);
-       n->right = arrayToNodes(array, (2*i + 2)*2, maxNodes);
+       uint64_t h = array[pos+0], i = array[pos+1];
+       if(h == UINTMAX_MAX && i == UINTMAX_MAX){
+               return NULL;
+       }
+       node *n = newNode(h, i);
+       n->left = arrayToNodes(array, (2*pos + 1)*2, maxNodes);
+       n->right = arrayToNodes(array, (2*pos + 2)*2, maxNodes);
        return n;
 }