feat(flatfile): warn on missing or mismatched log format-version
This commit is contained in:
@@ -24,8 +24,13 @@
|
||||
|
||||
// --- Constants ---
|
||||
|
||||
#define DIR_FLATLOG "flatlog"
|
||||
#define FLATFILE_HEADER "# profanity chat log — UTF-8, LF line endings\n# vim: set fileencoding=utf-8 fileformat=unix :\n"
|
||||
#define DIR_FLATLOG "flatlog"
|
||||
#define FLATFILE_FORMAT_VERSION 1
|
||||
#define FF_VERSION_PREFIX "# format-version: "
|
||||
#define FLATFILE_HEADER \
|
||||
"# profanity chat log — UTF-8, LF line endings\n" \
|
||||
"# format-version: 1\n" \
|
||||
"# vim: set fileencoding=utf-8 fileformat=unix :\n"
|
||||
#define FF_MAX_LINE_LEN (10 * 1024 * 1024) /* 10 MB — reject lines longer than this */
|
||||
#define FF_MAX_LMC_DEPTH 100 /* max correction chain depth */
|
||||
|
||||
@@ -125,6 +130,11 @@ char* ff_unescape_meta_value(const char* val);
|
||||
// Skip UTF-8 BOM if present; returns 3 if skipped, 0 otherwise.
|
||||
int ff_skip_bom(FILE* fp);
|
||||
|
||||
// Scan leading '#' comment lines for the format-version marker. Returns
|
||||
// the version found, 0 if no marker is present, or -1 on read error.
|
||||
// File position is rewound to the start of the comment block on entry.
|
||||
int ff_read_format_version(FILE* fp);
|
||||
|
||||
char* ff_readline(FILE* fp, gboolean* truncated);
|
||||
void ff_write_line(FILE* fp, const char* timestamp, const char* type, const char* enc,
|
||||
const char* stanza_id, const char* archive_id, const char* replace_id,
|
||||
|
||||
Reference in New Issue
Block a user