diff options
| author | dam <dam@gudinoff> | 2022-12-13 00:47:14 +0000 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2022-12-13 00:47:14 +0000 |
| commit | 65fbe4576d09dff30d2b0c6bc80b3166d82fb510 (patch) | |
| tree | b7d77b0a5d60fb8a17eb22c4511ea34cddcb515e | |
| parent | 7262a43720e62c17df50aca6c1c48685b0b3b6d1 (diff) | |
| download | task-time-tracker-65fbe4576d09dff30d2b0c6bc80b3166d82fb510.tar.zst task-time-tracker-65fbe4576d09dff30d2b0c6bc80b3166d82fb510.zip | |
Fixing final to-dos.
| -rw-r--r-- | main.c | 11 | ||||
| -rw-r--r-- | readme.md | 1 |
2 files changed, 5 insertions, 7 deletions
@@ -118,7 +118,7 @@ bool is_equal_to_any(const char *to_compare, const char *test_a, const char *tes // The string should have capacity for at least length + 1. // The terminating null byte ('\0') is not included in length. // Returns the truncated string length. -size_t truncate_string_utf8(char *string, size_t length) { // TODO Rename to truncate_utf_string +size_t truncate_string_utf8(char *string, size_t length) { assert(string != NULL); // TODO Review this function... @@ -649,8 +649,8 @@ bool export_to_csv(const database_st *db, const char *path) { ); char name[TASK_NAME_BYTES]; - task_st *limit = db->tasks + db->count; - for (task_st *task = db->tasks; task < limit; task++) { // TODO Simplify for loop. + for (size_t idx = 0; idx < db->count; idx++) { + task_st *task = db->tasks[idx]; memcpy(name, task->name, TASK_NAME_BYTES); replace_char(name, ',', ' '); fprintf(file, "%s,%" PRId64 ",%" PRId64 ",%" PRId64 ",%" PRId64 ",%" PRId64 ",%" PRId64 ",%" PRId64 "\n", @@ -1193,7 +1193,7 @@ int main(int argc, char *argv[]) { bool is_exit_requested = false; for (unsigned idx = 1; idx < argc; idx++) { if (is_equal_to_any(argv[idx], "--help", "-h")) { - // TODO Maybe rearrange the order of the command. + // TODO Maybe rearrange the order of the command... or chose other hot-keys? fprintf(stdout, "Usage: ttt [OPTION]... [FILE]...\n" " -i, --import-csv [FILE] Import CSV file to database (discard first row).\n" @@ -1364,7 +1364,7 @@ int main(int argc, char *argv[]) { struct tm *now_local = localtime(&now_utc); strftime(new_task->name, TASK_NAME_BYTES, "%Y-%m-%d %H:%M:%S", now_local); - // Select new task. TODO Maybe do this on the database? + // Select new task. select_task(db, new_task); selected_task = get_selected_task(db); trigger_autosave(); @@ -1645,7 +1645,6 @@ int main(int argc, char *argv[]) { case '\t': { if (db == &database) { - reset_database(&archive); // TODO Not needed because we never leave things hanging. import_from_csv(&archive, ar_file_path); db = &archive; } @@ -72,5 +72,4 @@ Task Time Tracker - By having each column-print job decoulpled, we avoid havint to measure and compensate lengths of UTF8 strings; - [x] Review all code for bugs related to auto-cast on ptrdiff_t (signed/unsigned); - [x] Review all code for bugs related to auto-cast on size_t (signed/unsigned); -- [ ] Try to fix flickering of ncurses; - [ ] Go over all `TODO` items; |
