buf = g_malloc(CHUNKSIZE);
- ret = zip_fread(vdev->capfile, buf,
- CHUNKSIZE / vdev->unitsize * vdev->unitsize);
+ /* unitsize is not defined for purely analog session files. */
+ if (vdev->unitsize)
+ ret = zip_fread(vdev->capfile, buf,
+ CHUNKSIZE / vdev->unitsize * vdev->unitsize);
+ else
+ ret = zip_fread(vdev->capfile, buf, CHUNKSIZE);
+
if (ret > 0) {
got_data = TRUE;
if (vdev->cur_analog_channel != 0) {
int unitsize;
char **sections, **keys, *val;
char channelname[SR_MAX_CHANNELNAME_LEN + 1];
+ gboolean file_has_logic;
if ((ret = sr_sessionfile_check(filename)) != SR_OK)
return ret;
error = NULL;
ret = SR_OK;
+ file_has_logic = FALSE;
sections = g_key_file_get_groups(kf, NULL);
for (i = 0; sections[i] && ret == SR_OK; i++) {
if (!strcmp(sections[i], "global"))
sr_config_set(sdi, NULL, SR_CONF_CAPTUREFILE,
g_variant_new_string(val));
g_free(val);
+ file_has_logic = TRUE;
}
g_clear_error(&error);
g_free(val);
sr_config_set(sdi, NULL, SR_CONF_SAMPLERATE,
g_variant_new_uint64(tmp_u64));
- } else if (!strcmp(keys[j], "unitsize")) {
+ } else if (!strcmp(keys[j], "unitsize") && file_has_logic) {
unitsize = g_key_file_get_integer(kf, sections[i],
keys[j], &error);
if (!sdi || unitsize <= 0 || error) {