From: Uwe Hermann Date: Thu, 23 Jan 2014 21:45:08 +0000 (+0100) Subject: sr file format: Bump version to 2. X-Git-Tag: libsigrok-0.3.0~189 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=3a841040800101909c95a9a9f95d0b0ab19b3b7c sr file format: Bump version to 2. The *.sr (libsigrok session) file format has changed since the last libsigrok release. Frontends using older libsigrok versions will not be able to read *.sr files created by frontends using the new file format. Thus, bump the version number of the file format to 2. Current libsigrok will read both version 1 and version 2 files correctly, and always write version 2 files. --- diff --git a/session_file.c b/session_file.c index 545abcfd..11adb47f 100644 --- a/session_file.c +++ b/session_file.c @@ -81,10 +81,11 @@ SR_PRIV int sr_sessionfile_check(const char *filename) zip_fclose(zf); s[ret] = 0; version = strtoull(s, NULL, 10); - if (version != 1) { + if (version > 2) { sr_dbg("Cannot handle sigrok session file version %d.", version); return SR_ERR; } + sr_spew("Detected sigrok session file version %d.", version); /* read "metadata" */ if (zip_stat(archive, "metadata", 0, &zs) == -1) { @@ -304,7 +305,7 @@ SR_API int sr_session_save_init(const char *filename, uint64_t samplerate, return SR_ERR; /* "version" */ - version[0] = '1'; + version[0] = '2'; if (!(versrc = zip_source_buffer(zipfile, version, 1, 0))) return SR_ERR; if (zip_add(zipfile, "version", versrc) == -1) {