From 7eb0d2763b9d890bf10b3cf8e847f7a012e9fa8b Mon Sep 17 00:00:00 2001 From: Alice Grey Date: Sun, 15 Mar 2020 15:34:32 -0700 Subject: [PATCH] Make it so mark_written has to be used Make it so mark_written has to be used --- lib/neographics | 2 +- rcore/fs.c | 2 -- rcore/fs_test.c | 15 +++++++++------ rcore/service/blob_db.c | 1 + 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/neographics b/lib/neographics index 2996647d..0b74ee50 160000 --- a/lib/neographics +++ b/lib/neographics @@ -1 +1 @@ -Subproject commit 2996647d76bb2a64ebeb9a45ce9e37c01ab721ee +Subproject commit 0b74ee50784f55e90cdbbfcd90b937324938ef24 diff --git a/rcore/fs.c b/rcore/fs.c index b413b9e1..16920388 100644 --- a/rcore/fs.c +++ b/rcore/fs.c @@ -525,8 +525,6 @@ struct fd *fs_creat_replacing(struct fd *fd, const char *name, size_t bytes, con filehdr.flag_2 &= ~HDR_FLAG_2_HAS_FILENAME; assert(strlen(name) < MAX_FILENAME_LEN); filehdr.filename_len = strlen(name); - if (!previous) - filehdr.st_tmp_file = 0x0; int rv = _fs_write_page_ofs(pg, 0, &filehdr, sizeof(filehdr)); assert(rv >= 0); diff --git a/rcore/fs_test.c b/rcore/fs_test.c index 64657981..df6c484f 100644 --- a/rcore/fs_test.c +++ b/rcore/fs_test.c @@ -50,10 +50,12 @@ TEST(fs_two_files) { fdp = fs_creat(&fd1, "hello", 5); if (!fdp) { *artifact = 1; return TEST_FAIL; } fs_write(&fd1, "Hello", 5); + fs_mark_written(fdp); fdp = fs_creat(&fd2, "world", 5); if (!fdp) { *artifact = 2; return TEST_FAIL; } fs_write(&fd2, "World", 5); + fs_mark_written(fdp); char buf[5]; @@ -89,8 +91,9 @@ TEST(fs_replace_file_basic) { //create a file with contents a fdp = fs_creat(&fd, "hello", 5); - if (!fdp) { *artifact = 1; return TEST_FAIL; } - fs_write(&fd, "Hello", 5); + if (!fdp) { *artifact = 1; return TEST_FAIL; } + fs_write(&fd, "Hello", 5); + fs_mark_written(fdp); //create a file replacing that file with contents B rv = fs_find_file(&file, "hello"); @@ -113,11 +116,11 @@ TEST(fs_replace_file_basic) { //open the file for read and make sure you get contents B; rv = fs_find_file(&file, "hello"); - if (rv < 0) { *artifact = 5; return TEST_FAIL; } + if (rv < 0) { *artifact = 5; return TEST_FAIL; } - fs_open(&fd, &file); - rv = fs_read(&fd, buf, 5); - if (memcmp(buf, "World", 5)) { *artifact = 6; return TEST_FAIL; } + fs_open(&fd, &file); + rv = fs_read(&fd, buf, 5); + if (memcmp(buf, "World", 5)) { *artifact = 6; return TEST_FAIL; } *artifact = 0; return TEST_PASS; diff --git a/rcore/service/blob_db.c b/rcore/service/blob_db.c index 9ef60a8a..06de33fb 100644 --- a/rcore/service/blob_db.c +++ b/rcore/service/blob_db.c @@ -410,6 +410,7 @@ uint8_t blobdb_insert(uint16_t database_id, uint8_t *key, uint16_t key_size, uin LOG_ERROR("nope, that did not work either, I give up"); return Blob_DatabaseFull; } + fs_mark_written(&fd); } int pos = 0;