From 2b68a0e0db9e16c551df38873c58511fddef8a9a Mon Sep 17 00:00:00 2001 From: vididvidid Date: Thu, 2 Oct 2025 05:50:06 +0000 Subject: [PATCH] used the cp startegy of string and pointer combination to get the part and comliance --- pdfio-file.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/pdfio-file.c b/pdfio-file.c index 9e6a624..c4de43d 100644 --- a/pdfio-file.c +++ b/pdfio-file.c @@ -2747,18 +2747,27 @@ write_metadata(pdfio_file_t *pdf) // I - PDF file if (pdf->pdfa != _PDFIO_PDFA_NONE) { - static const char * const parts[] = // Part numbers - { - "1", "1", "2", "2", "2", "3", "3", "3", "4" + static const char * const pdfa_versions[] = + { + "1A", // _PDFIO_PDFA_1A + "1B", // _PDFIO_PDFA_1B + "2A", // _PDFIO_PDFA_2A + "2B", // _PDFIO_PDFA_2B + "2U", // _PDFIO_PDFA_2U + "3A", // _PDFIO_PDFA_3A + "3B", // _PDFIO_PDFA_3B + "3U", // _PDFIO_PDFA_3U + "4", // _PDFIO_PDFA_4 }; - static const char * const conformances[] = // Conformance levels - { - "A", "B", "A", "B", "U", "A", "B", "U", "" - }; - - const char *part = parts[pdf->pdfa - 1]; - const char *conformance = conformances[pdf->pdfa - 1]; - + const char *version_info = pdfa_versions[pdf->pdfa - _PDFIO_PDFA_1A]; + char part[2]; + const char *conformance; + part[0] = version_info[0]; + part[1] = '\0'; + if (version_info[1]) + conformance = version_info + 1; + else + conformance = ""; status &= pdfioStreamPuts(st, " \n"); status &= pdfioStreamPrintf(st, " %s\n",part);