From ded87462dccac69a1d654c3665750e6a7048bea9 Mon Sep 17 00:00:00 2001 From: anders_k Date: Sat, 4 Sep 2021 01:06:30 +0000 Subject: [PATCH] Only count a section as required if it is both SELECTED and RO git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7312 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/build.cpp | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/Source/build.cpp b/Source/build.cpp index 4011da2f..f47fef4a 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -2795,20 +2795,14 @@ retry_output: if (PAGE_COMPLETED != PAGE_INSTFILES && np) --np; // Special page not part of count INFO_MSG(_T("%d page%") NPRIs _T(" (%d bytes), "),np,np==1?_T(""):_T("s"),np*sizeof(page)); #endif +#define IsRequiredSection(s) ( !(s).name_ptr || (((s).flags & (SF_RO|SF_SELECTED)) == (SF_RO|SF_SELECTED))) { - int ns=build_sections.getlen()/sizeof(section); + int ns=build_sections.getlen()/sizeof(section), x; section *s=(section*)build_sections.get(); - int x; unsigned int req=0; - for (x = 1; x < ns; x ++) - { - if (!s[x].name_ptr || s[x].flags & SF_RO) req++; - } + for (x = 0; x < ns; x ++) if (IsRequiredSection(s[x])) ++req; INFO_MSG(_T("%d section%") NPRIs,ns,ns==1?_T(""):_T("s")); - if (req) - { - INFO_MSG(_T(" (%u required)"),req); - } + if (req) INFO_MSG(_T(" (%u required)"),req); INFO_MSG(_T(" (%d bytes), "), build_sections.getlen()); } int ne=build_header.blocks[NB_ENTRIES].num; @@ -2826,19 +2820,12 @@ retry_output: INFO_MSG(_T("%d page%") NPRIs _T(" (%d bytes), "),np,np==1?_T(""):_T("s"),ubuild_pages.getlen()); #endif { - int ns=ubuild_sections.getlen()/sizeof(section); + int ns=ubuild_sections.getlen()/sizeof(section), x; section *s=(section*)ubuild_sections.get(); - int x; unsigned int req=0; - for (x = 1; x < ns; x ++) - { - if (!s[x].name_ptr || s[x].flags & SF_RO) req++; - } + for (x = 0; x < ns; x ++) if (IsRequiredSection(s[x])) ++req; INFO_MSG(_T("%d section%") NPRIs,ns,ns==1?_T(""):_T("s")); - if (req) - { - INFO_MSG(_T(" (%u required)"),req); - } + if (req) INFO_MSG(_T(" (%u required)"),req); INFO_MSG(_T(" (%d bytes), "), ubuild_sections.getlen()); } ne=build_uninst.blocks[NB_ENTRIES].num;