From 21b1b13866349dfaaabc4442c911479f4590c54e Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Fri, 22 Jan 2010 20:56:26 +0000 Subject: [PATCH] Print the last summary information instead of the first to handle nested documents, perhaps we should build a tree and check it that way? --- src/cdf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cdf.c b/src/cdf.c index c3f456fb..d59e52b1 100644 --- a/src/cdf.c +++ b/src/cdf.c @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: cdf.c,v 1.34 2009/08/12 17:22:22 christos Exp $") +FILE_RCSID("@(#)$File: cdf.c,v 1.35 2009/09/13 23:25:16 christos Exp $") #endif #include @@ -676,18 +676,18 @@ cdf_read_summary_info(const cdf_info_t *info, const cdf_header_t *h, const cdf_directory_t *d; static const char name[] = "\05SummaryInformation"; - for (i = 0; i < dir->dir_len; i++) - if (dir->dir_tab[i].d_type == CDF_DIR_TYPE_USER_STREAM && - cdf_namecmp(name, dir->dir_tab[i].d_name, sizeof(name)) + for (i = dir->dir_len; i > 0; i--) + if (dir->dir_tab[i - 1].d_type == CDF_DIR_TYPE_USER_STREAM && + cdf_namecmp(name, dir->dir_tab[i - 1].d_name, sizeof(name)) == 0) break; - if (i == dir->dir_len) { + if (i == 0) { DPRINTF(("Cannot find summary information section\n")); errno = ESRCH; return -1; } - d = &dir->dir_tab[i]; + d = &dir->dir_tab[i - 1]; return cdf_read_sector_chain(info, h, sat, ssat, sst, d->d_stream_first_sector, d->d_size, scn); } -- 2.40.0