X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fsession_file.c;h=149e6d1a0237000c93e85b793310603ca85fd8e2;hb=6e68da5140e80443bbb122f0c23ae5a17d91c697;hp=fdceba1476b3b8c690412fd52a2936064f25fa62;hpb=5e1fb33469841b194e606752b865fa0d08b99067;p=libsigrok.git diff --git a/src/session_file.c b/src/session_file.c index fdceba14..149e6d1a 100644 --- a/src/session_file.c +++ b/src/session_file.c @@ -46,6 +46,16 @@ extern SR_PRIV struct sr_dev_driver session_driver; static int session_driver_initialized = 0; +#if !HAVE_ZIP_DISCARD +/* Replacement for zip_discard() if it isn't available. + */ +SR_PRIV void sr_zip_discard(struct zip *archive) +{ + if (zip_unchange_all(archive) < 0 || zip_close(archive) < 0) + sr_err("Failed to discard ZIP archive: %s", zip_strerror(archive)); +} +#endif + /** Read metadata entries from a session archive. * @param[in] archive An open ZIP archive. * @param[in] entry Stat buffer filled in for the metadata archive member. @@ -266,15 +276,15 @@ SR_API int sr_session_load(struct sr_context *ctx, const char *filename, break; } sr_config_set(sdi, NULL, SR_CONF_NUM_LOGIC_CHANNELS, - g_variant_new_uint64(total_channels)); + g_variant_new_int32(total_channels)); for (k = 0; k < total_channels; k++) { - g_snprintf(channelname, sizeof channelname, + g_snprintf(channelname, sizeof(channelname), "%d", k); sr_channel_new(sdi, k, SR_CHANNEL_LOGIC, FALSE, channelname); } } else if (!strncmp(keys[j], "probe", 5)) { - tmp_u64 = g_ascii_strtoull(keys[j]+5, NULL, 10); + tmp_u64 = g_ascii_strtoull(keys[j] + 5, NULL, 10); if (!sdi || tmp_u64 == 0 || tmp_u64 > G_MAXINT) { ret = SR_ERR_DATA; break;