From 4a0b61ed91eaa53d33a725f9300aafa6b4f34025 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Wed, 8 Nov 2023 17:13:17 -0500 Subject: [PATCH 01/36] merge develop/preload-TREs --- UnitTest/UnitTest.vcxproj | 6 --- .../c++/nitf/unittests/test_load_plugins.cpp | 2 +- modules/c/nitf-c.vcxproj | 9 ++++ modules/c/nitf-c.vcxproj.filters | 12 +++++ modules/c/nitf/CMakeLists.txt | 1 + modules/c/nitf/include/nitf/Defines.h | 14 +++--- modules/c/nitf/shared/ACCHZB.c | 4 +- modules/c/nitf/shared/ACFTA.c | 4 +- modules/c/nitf/shared/AIMIDA.c | 2 +- modules/c/nitf/shared/EXPLTA.c | 2 +- modules/c/nitf/shared/HISTOA.c | 4 +- modules/c/nitf/shared/IOMAPA.c | 2 +- modules/c/nitf/shared/MENSRA.c | 2 +- modules/c/nitf/shared/PATCHA.c | 2 +- modules/c/nitf/shared/XML_DATA_CONTENT.c | 4 +- modules/c/nitf/source/PluginRegistry.c | 44 ++++++++++--------- modules/c/nitf/source/TREs.c | 32 ++++++++++++++ nitro.sln | 14 ------ 18 files changed, 99 insertions(+), 61 deletions(-) create mode 100644 modules/c/nitf/source/TREs.c diff --git a/UnitTest/UnitTest.vcxproj b/UnitTest/UnitTest.vcxproj index 91569578c..7e23058b0 100644 --- a/UnitTest/UnitTest.vcxproj +++ b/UnitTest/UnitTest.vcxproj @@ -258,9 +258,6 @@ {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - {53f9f908-c678-4dee-9309-e71c1d03a45f} - {730b1e6e-2469-4f9e-b093-d0c6262453c9} @@ -279,9 +276,6 @@ {53f9f908-c678-4dee-9309-e71c1e03a45f} - - {d749aa73-4c9a-473d-96bb-070a6d9caa54} - {d1d7fcd3-6130-4504-9da0-9d80506be55e} diff --git a/modules/c++/nitf/unittests/test_load_plugins.cpp b/modules/c++/nitf/unittests/test_load_plugins.cpp index c94707f56..0d7b617c2 100644 --- a/modules/c++/nitf/unittests/test_load_plugins.cpp +++ b/modules/c++/nitf/unittests/test_load_plugins.cpp @@ -91,7 +91,7 @@ TEST_CASE(test_load_all_TREs) for (const auto& tre : all_TREs()) { - // TREs are quite the same thing as an arbitrary "plug in;" the underlying + // TREs aren't quite the same thing as an arbitrary "plug in;" the underlying // infrastructure is all built on shared-libraries/DLLs, but details differ. // // As a result, we can't expect loadPlugin() will "just work" on a TRE name. diff --git a/modules/c/nitf-c.vcxproj b/modules/c/nitf-c.vcxproj index aa32c2a33..370fb800b 100644 --- a/modules/c/nitf-c.vcxproj +++ b/modules/c/nitf-c.vcxproj @@ -258,6 +258,14 @@ + + true + true + + + true + true + @@ -303,6 +311,7 @@ + diff --git a/modules/c/nitf-c.vcxproj.filters b/modules/c/nitf-c.vcxproj.filters index 13705f96b..6dd32c62a 100644 --- a/modules/c/nitf-c.vcxproj.filters +++ b/modules/c/nitf-c.vcxproj.filters @@ -16,6 +16,9 @@ {2e28e7c0-ed75-4c97-84b1-cb70b635b60e} + + {e0402428-7ec8-4079-8b39-48d8db79bf50} + @@ -673,5 +676,14 @@ j2k + + nitf\shared + + + nitf + + + nitf\shared + \ No newline at end of file diff --git a/modules/c/nitf/CMakeLists.txt b/modules/c/nitf/CMakeLists.txt index bc705c715..a12260e1f 100644 --- a/modules/c/nitf/CMakeLists.txt +++ b/modules/c/nitf/CMakeLists.txt @@ -52,6 +52,7 @@ coda_add_module( source/StreamIOWriteHandler.c source/SubWindow.c source/TRE.c + source/TREs.c source/TRECursor.c source/TREPrivateData.c source/TREUtils.c diff --git a/modules/c/nitf/include/nitf/Defines.h b/modules/c/nitf/include/nitf/Defines.h index 82f1df118..9210ef6b2 100644 --- a/modules/c/nitf/include/nitf/Defines.h +++ b/modules/c/nitf/include/nitf/Defines.h @@ -32,17 +32,15 @@ * _Tre the name of the input TRE */ #define NITF_DECLARE_PLUGIN(_Tre) \ - static const char *ident[] = { \ + static const char* _Tre##Ident[] = { \ NITF_PLUGIN_TRE_KEY, \ #_Tre, \ NULL \ }; \ static nitf_TREHandler _Tre##Handler; \ NITFAPI(const char**) _Tre##_init(nitf_Error* error){ \ - if (!nitf_TREUtils_createBasicHandler(&descriptionSet,\ - &_Tre##Handler,error)) \ - return NULL; return ident; \ - } \ + if (!nitf_TREUtils_createBasicHandler(&_Tre##DescriptionSet, &_Tre##Handler,error)) return NULL; \ + return _Tre##Ident; } \ NITFAPI(nitf_TREHandler*) _Tre##_handler(nitf_Error* error) { \ (void)error; \ return &_Tre##Handler; \ @@ -55,13 +53,15 @@ * _Description the description to use */ #define NITF_DECLARE_SINGLE_PLUGIN(_Tre, _Description) \ - static nitf_TREDescriptionInfo descriptions[] = { \ + static nitf_TREDescriptionInfo _Tre##Descriptions[] = { \ { #_Tre, _Description, NITF_TRE_DESC_NO_LENGTH }, \ { NULL, NULL, NITF_TRE_DESC_NO_LENGTH } \ }; \ - static nitf_TREDescriptionSet descriptionSet = { 0, descriptions }; \ + static nitf_TREDescriptionSet _Tre##DescriptionSet = { 0, _Tre##Descriptions }; \ NITF_DECLARE_PLUGIN(_Tre) +#define NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(_Tre) \ + NITF_DECLARE_SINGLE_PLUGIN(_Tre, _Tre##_description) /** * Reference a TRE that has been statically compiled inside of a library * diff --git a/modules/c/nitf/shared/ACCHZB.c b/modules/c/nitf/shared/ACCHZB.c index 2107c87b4..7be1d1ea2 100644 --- a/modules/c/nitf/shared/ACCHZB.c +++ b/modules/c/nitf/shared/ACCHZB.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription ACCHZB_description[] = { {NITF_BCS_N, 2, "Number of horizontal accuracy regions", "NUMACHZ", }, {NITF_LOOP, 0, NULL, "NUMACHZ"}, {NITF_BCS_A, 3, "Unit of Measure for AAH", "UNIAAH" }, @@ -44,6 +44,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(ACCHZB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(ACCHZB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/ACFTA.c b/modules/c/nitf/shared/ACFTA.c index 60c7f9ce6..e5d17b906 100644 --- a/modules/c/nitf/shared/ACFTA.c +++ b/modules/c/nitf/shared/ACFTA.c @@ -114,13 +114,13 @@ static nitf_TREDescription descrip_00199[] = { }; /* Define the available descriptions and the default one */ -static nitf_TREDescriptionInfo descriptions[] = { +static nitf_TREDescriptionInfo ACFTADescriptions[] = { { "ACFTA_132", descrip_00132, 132 }, { "ACFTA_154", descrip_00154, 154 }, { "ACFTA_199", descrip_00199, 199 }, { NULL, NULL, NITF_TRE_DESC_NO_LENGTH } }; -static nitf_TREDescriptionSet descriptionSet = { 0, descriptions }; +static nitf_TREDescriptionSet ACFTADescriptionSet = { 0, ACFTADescriptions }; #if 1 diff --git a/modules/c/nitf/shared/AIMIDA.c b/modules/c/nitf/shared/AIMIDA.c index d1d6421ff..749008e98 100644 --- a/modules/c/nitf/shared/AIMIDA.c +++ b/modules/c/nitf/shared/AIMIDA.c @@ -100,7 +100,7 @@ static nitf_TREDescriptionInfo descriptions[] = { { "AIMIDA_89", descrip_00089, 89 }, { NULL, NULL, NITF_TRE_DESC_NO_LENGTH } }; -static nitf_TREDescriptionSet descriptionSet = { 0, descriptions }; +static nitf_TREDescriptionSet AIMIDADescriptionSet = { 0, descriptions }; NITF_DECLARE_PLUGIN(AIMIDA) diff --git a/modules/c/nitf/shared/EXPLTA.c b/modules/c/nitf/shared/EXPLTA.c index c5d84e0e8..b7e0c9764 100644 --- a/modules/c/nitf/shared/EXPLTA.c +++ b/modules/c/nitf/shared/EXPLTA.c @@ -73,7 +73,7 @@ static nitf_TREDescriptionInfo descriptions[] = { { "EXPLTA_101", descrip_00101, 101 }, { NULL, NULL, NITF_TRE_DESC_NO_LENGTH } }; -static nitf_TREDescriptionSet descriptionSet = { 0, descriptions }; +static nitf_TREDescriptionSet EXPLTADescriptionSet = { 0, descriptions }; NITF_DECLARE_PLUGIN(EXPLTA) diff --git a/modules/c/nitf/shared/HISTOA.c b/modules/c/nitf/shared/HISTOA.c index 1432f6b5c..30b505b1c 100644 --- a/modules/c/nitf/shared/HISTOA.c +++ b/modules/c/nitf/shared/HISTOA.c @@ -30,7 +30,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription HISTOA_description[] = { {NITF_BCS_A, 20, "System Type", "SYSTYPE" }, {NITF_BCS_A, 12, "Prior Compression", "PC" }, {NITF_BCS_A, 4, "Prior Enhancements", "PE" }, @@ -124,6 +124,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(HISTOA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(HISTOA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/IOMAPA.c b/modules/c/nitf/shared/IOMAPA.c index a9e412ec8..754055e18 100644 --- a/modules/c/nitf/shared/IOMAPA.c +++ b/modules/c/nitf/shared/IOMAPA.c @@ -81,7 +81,7 @@ static nitf_TREDescriptionInfo descriptions[] = { { "IOMAPA_91", descrip_00091, 91 }, { NULL, NULL, NITF_TRE_DESC_NO_LENGTH } }; -static nitf_TREDescriptionSet descriptionSet = { 0, descriptions }; +static nitf_TREDescriptionSet IOMAPADescriptionSet = { 0, descriptions }; NITF_DECLARE_PLUGIN(IOMAPA) diff --git a/modules/c/nitf/shared/MENSRA.c b/modules/c/nitf/shared/MENSRA.c index b8ebacf2a..f59ae864d 100644 --- a/modules/c/nitf/shared/MENSRA.c +++ b/modules/c/nitf/shared/MENSRA.c @@ -109,7 +109,7 @@ static nitf_TREDescriptionInfo descriptions[] = { { "MENSRA_185", descrip_00185, 185 }, { NULL, NULL, NITF_TRE_DESC_NO_LENGTH } }; -static nitf_TREDescriptionSet descriptionSet = { 0, descriptions }; +static nitf_TREDescriptionSet MENSRADescriptionSet = { 0, descriptions }; NITF_DECLARE_PLUGIN(MENSRA) diff --git a/modules/c/nitf/shared/PATCHA.c b/modules/c/nitf/shared/PATCHA.c index c3ffd29e5..5a098505a 100644 --- a/modules/c/nitf/shared/PATCHA.c +++ b/modules/c/nitf/shared/PATCHA.c @@ -75,7 +75,7 @@ static nitf_TREDescriptionInfo descriptions[] = { { NULL, NULL, NITF_TRE_DESC_NO_LENGTH } }; -static nitf_TREDescriptionSet descriptionSet = { 0, descriptions }; +static nitf_TREDescriptionSet PATCHADescriptionSet = { 0, descriptions }; NITF_DECLARE_PLUGIN(PATCHA) diff --git a/modules/c/nitf/shared/XML_DATA_CONTENT.c b/modules/c/nitf/shared/XML_DATA_CONTENT.c index 02dbc8631..4af8240b8 100644 --- a/modules/c/nitf/shared/XML_DATA_CONTENT.c +++ b/modules/c/nitf/shared/XML_DATA_CONTENT.c @@ -65,13 +65,13 @@ static nitf_TREDescription descrip_0773[] = { }; /* Define the available descriptions and the default one */ -static nitf_TREDescriptionInfo descriptions[] = { +static nitf_TREDescriptionInfo XML_DATA_CONTENTDescriptions[] = { { "XML_DATA_CONTENT_005", descrip_0005, 5 }, { "XML_DATA_CONTENT_283", descrip_0283, 283 }, { "XML_DATA_CONTENT_773", descrip_0773, 773 }, { NULL, NULL, NITF_TRE_DESC_NO_LENGTH } }; -static nitf_TREDescriptionSet descriptionSet = { 0, descriptions }; +static nitf_TREDescriptionSet XML_DATA_CONTENTDescriptionSet = { 0, XML_DATA_CONTENTDescriptions }; NITF_DECLARE_PLUGIN(XML_DATA_CONTENT) diff --git a/modules/c/nitf/source/PluginRegistry.c b/modules/c/nitf/source/PluginRegistry.c index 51734ff27..8b41a6acd 100644 --- a/modules/c/nitf/source/PluginRegistry.c +++ b/modules/c/nitf/source/PluginRegistry.c @@ -470,12 +470,33 @@ nitf_PluginRegistry_unload(nitf_PluginRegistry* reg, nitf_Error* error) return success; } +static NITF_BOOL insertPlugin_(const char* msg, + nitf_PluginRegistry* reg, const char** ident, nitf_DLL* dll, nitf_Error* error) +{ + /* If no ident, we have a set error and an invalid plugin */ + if (ident) + { + /* I expect to have problems with this now and then */ + int ok = insertPlugin(reg, ident, dll, error); + + /* If insertion failed, take our toys and leave */ + if (!ok) + { + return NITF_FAILURE; + } +#ifdef NITF_DEBUG_PLUGIN_REG + printf(msg, keyName, dll); +#endif + return NITF_SUCCESS; + } + return NITF_FAILURE; +} + NITFAPI(NITF_BOOL) nitf_PluginRegistry_loadPlugin(const char* fullName, nitf_Error* error) { /* For now, the key is the dll name minus the extension */ char keyName[NITF_MAX_PATH] = ""; - int ok; nitf_DLL* dll; const char** ident; nitf_PluginRegistry* reg = nitf_PluginRegistry_getInstance(error); @@ -499,24 +520,8 @@ nitf_PluginRegistry_loadPlugin(const char* fullName, nitf_Error* error) /* Now init the plugin!!! */ ident = doInit(dll, keyName, error); - - /* If no ident, we have a set error and an invalid plugin */ - if (ident) - { - /* I expect to have problems with this now and then */ - ok = insertPlugin(reg, ident, dll, error); - - /* If insertion failed, take our toys and leave */ - if (!ok) - { - return NITF_FAILURE; - } -#ifdef NITF_DEBUG_PLUGIN_REG - printf("Successfully loaded plugin: [%s] at [%p]\n", keyName, dll); -#endif - return NITF_SUCCESS; - } - return NITF_FAILURE; + return insertPlugin_("Successfully loaded plugin: [%s] at [%p]\n", + reg, ident, dll, error); } NITFAPI(NITF_BOOL) @@ -945,7 +950,6 @@ insertCreator(nitf_DLL* dso, /* We are trying to find tre_main */ /* Retrieve the main */ NITF_DLL_FUNCTION_PTR dsoMain = nitf_DLL_retrieve(dso, name, error); - if (!dsoMain) { /* If it didnt work, we are done */ diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c new file mode 100644 index 000000000..4b55ad949 --- /dev/null +++ b/modules/c/nitf/source/TREs.c @@ -0,0 +1,32 @@ +/* ========================================================================= + * This file is part of NITRO + * ========================================================================= + * + * (C) Copyright 2004 - 2014, MDA Information Systems LLC + * + * NITRO is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, If not, + * see . + * + */ + +#include "nitf/TRE.h" +#include "nitf/PluginIdentifier.h" + +//#include "../shared/ACCHZB.c" +//#include "../shared/HISTOA.c" + +const void* preloaded[] = { + //"ACCHZB", &ACCHZB_init, &ACCHZB_handler, + //"HISTOA", &HISTOA_init, &HISTOA_handler, + NULL, NULL, NULL }; diff --git a/nitro.sln b/nitro.sln index d32ec9368..ac2598174 100644 --- a/nitro.sln +++ b/nitro.sln @@ -22,8 +22,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nitf-c++", "modules\c++\nit EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACCPOB", "modules\c\nitf\ACCPOB.vcxproj", "{730B1E6E-2469-4F9E-B093-D0C6262453C9}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACCHZB", "modules\c\nitf\ACCHZB.vcxproj", "{53F9F908-C678-4DEE-9309-E71C1D03A45F}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACFTA", "modules\c\nitf\ACFTA.vcxproj", "{51D7B426-899E-428D-9F69-5DDAC9E403FB}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AIMIDB", "modules\c\nitf\AIMIDB.vcxproj", "{12AA0752-4EE3-4E0A-85AF-0E5DEADBF343}" @@ -42,8 +40,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "show_nitf++", "modules\c++\ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PTPRAA", "modules\c\nitf\PTPRAA.vcxproj", "{2BAAACA9-A5A4-412C-AE52-B16C2D107F55}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HISTOA", "modules\c\nitf\HISTOA.vcxproj", "{D749AA73-4C9A-473D-96BB-070A6D9CAA54}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ENGRDA", "modules\c\nitf\ENGRDA.vcxproj", "{53F9F908-C678-4DEE-9309-E71C1E03A45F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "J2KCompress", "modules\c\j2k\J2KCompress.vcxproj", "{A676EDF3-F231-47C8-A6E6-0FE50B50B71B}" @@ -83,10 +79,6 @@ Global {730B1E6E-2469-4F9E-B093-D0C6262453C9}.Debug|x64.Build.0 = Debug|x64 {730B1E6E-2469-4F9E-B093-D0C6262453C9}.Release|x64.ActiveCfg = Release|x64 {730B1E6E-2469-4F9E-B093-D0C6262453C9}.Release|x64.Build.0 = Release|x64 - {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Debug|x64.ActiveCfg = Debug|x64 - {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Debug|x64.Build.0 = Debug|x64 - {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Release|x64.ActiveCfg = Release|x64 - {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Release|x64.Build.0 = Release|x64 {51D7B426-899E-428D-9F69-5DDAC9E403FB}.Debug|x64.ActiveCfg = Debug|x64 {51D7B426-899E-428D-9F69-5DDAC9E403FB}.Debug|x64.Build.0 = Debug|x64 {51D7B426-899E-428D-9F69-5DDAC9E403FB}.Release|x64.ActiveCfg = Release|x64 @@ -119,10 +111,6 @@ Global {2BAAACA9-A5A4-412C-AE52-B16C2D107F55}.Debug|x64.Build.0 = Debug|x64 {2BAAACA9-A5A4-412C-AE52-B16C2D107F55}.Release|x64.ActiveCfg = Release|x64 {2BAAACA9-A5A4-412C-AE52-B16C2D107F55}.Release|x64.Build.0 = Release|x64 - {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Debug|x64.ActiveCfg = Debug|x64 - {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Debug|x64.Build.0 = Debug|x64 - {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Release|x64.ActiveCfg = Release|x64 - {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Release|x64.Build.0 = Release|x64 {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Debug|x64.ActiveCfg = Debug|x64 {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Debug|x64.Build.0 = Debug|x64 {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Release|x64.ActiveCfg = Release|x64 @@ -153,7 +141,6 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {730B1E6E-2469-4F9E-B093-D0C6262453C9} = {27A2685A-E869-42A2-956D-92994F60C536} - {53F9F908-C678-4DEE-9309-E71C1D03A45F} = {27A2685A-E869-42A2-956D-92994F60C536} {51D7B426-899E-428D-9F69-5DDAC9E403FB} = {27A2685A-E869-42A2-956D-92994F60C536} {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343} = {27A2685A-E869-42A2-956D-92994F60C536} {D1D7FCD3-6130-4504-9DA0-9D80506BE55E} = {27A2685A-E869-42A2-956D-92994F60C536} @@ -161,7 +148,6 @@ Global {CF5B4F02-364D-4117-9FB9-6C9C7938E412} = {27A2685A-E869-42A2-956D-92994F60C536} {78849481-D356-4CC7-B182-31C21F857ED1} = {27A2685A-E869-42A2-956D-92994F60C536} {2BAAACA9-A5A4-412C-AE52-B16C2D107F55} = {27A2685A-E869-42A2-956D-92994F60C536} - {D749AA73-4C9A-473D-96BB-070A6D9CAA54} = {27A2685A-E869-42A2-956D-92994F60C536} {53F9F908-C678-4DEE-9309-E71C1E03A45F} = {27A2685A-E869-42A2-956D-92994F60C536} {A676EDF3-F231-47C8-A6E6-0FE50B50B71B} = {27A2685A-E869-42A2-956D-92994F60C536} {C787537A-0CAC-4D6D-A6D6-A66765A06753} = {27A2685A-E869-42A2-956D-92994F60C536} From 33f26bf906f51367fbe5488d3a586c9c59a45033 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Thu, 9 Nov 2023 08:53:21 -0500 Subject: [PATCH 02/36] fix build errors --- modules/c/nitf/source/PluginRegistry.c | 1 + nitro.sln | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/modules/c/nitf/source/PluginRegistry.c b/modules/c/nitf/source/PluginRegistry.c index 8b41a6acd..2594331ad 100644 --- a/modules/c/nitf/source/PluginRegistry.c +++ b/modules/c/nitf/source/PluginRegistry.c @@ -484,6 +484,7 @@ static NITF_BOOL insertPlugin_(const char* msg, { return NITF_FAILURE; } + (void)msg; #ifdef NITF_DEBUG_PLUGIN_REG printf(msg, keyName, dll); #endif diff --git a/nitro.sln b/nitro.sln index ac2598174..c03c4cb6e 100644 --- a/nitro.sln +++ b/nitro.sln @@ -61,6 +61,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "coda-oss", "externals\coda- EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest", "UnitTest\UnitTest.vcxproj", "{8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACCHZB", "modules\c\nitf\ACCHZB.vcxproj", "{53F9F908-C678-4DEE-9309-E71C1D03A45F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HISTOA", "modules\c\nitf\HISTOA.vcxproj", "{D749AA73-4C9A-473D-96BB-070A6D9CAA54}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -135,6 +139,14 @@ Global {8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}.Debug|x64.Build.0 = Debug|x64 {8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}.Release|x64.ActiveCfg = Release|x64 {8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}.Release|x64.Build.0 = Release|x64 + {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Debug|x64.ActiveCfg = Debug|x64 + {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Debug|x64.Build.0 = Debug|x64 + {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Release|x64.ActiveCfg = Release|x64 + {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Release|x64.Build.0 = Release|x64 + {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Debug|x64.ActiveCfg = Debug|x64 + {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Debug|x64.Build.0 = Debug|x64 + {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Release|x64.ActiveCfg = Release|x64 + {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -154,6 +166,8 @@ Global {A45CB073-25A7-411D-A7E7-589BCC8AF547} = {5C5727E7-0CFF-42B4-8F5A-D31B3BC81F21} {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E} = {27A2685A-E869-42A2-956D-92994F60C536} {9997E895-5161-4DDF-8F3F-099894CB2F21} = {7D26D571-0014-4C50-BF86-612E743E64B6} + {53F9F908-C678-4DEE-9309-E71C1D03A45F} = {27A2685A-E869-42A2-956D-92994F60C536} + {D749AA73-4C9A-473D-96BB-070A6D9CAA54} = {27A2685A-E869-42A2-956D-92994F60C536} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2D7AC542-BBB6-4BAC-8BF1-7E76C714BBA4} From 8bb07e8d6f3255a769d454f05d47e0507037e354 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 09:14:35 -0500 Subject: [PATCH 03/36] #including some TREs --- modules/c/nitf/source/TREs.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index 4b55ad949..3475b0461 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -23,10 +23,16 @@ #include "nitf/TRE.h" #include "nitf/PluginIdentifier.h" -//#include "../shared/ACCHZB.c" -//#include "../shared/HISTOA.c" +#if _MSC_VER +#pragma warning(disable: 4464) // relative include path contains '..' +#endif + +#include "../shared/ACCHZB.c" +#include "../shared/HISTOA.c" +#include "../shared/TEST_DES.c" +#include "../shared/XML_DATA_CONTENT.c" const void* preloaded[] = { - //"ACCHZB", &ACCHZB_init, &ACCHZB_handler, - //"HISTOA", &HISTOA_init, &HISTOA_handler, + "ACCHZB", (void*)&ACCHZB_init,(void*)&ACCHZB_handler, + "HISTOA", (void*)&HISTOA_init, (void*)&HISTOA_handler, NULL, NULL, NULL }; From 844685ae9a625404b33626a6b5959d3e4d57e02c Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 09:38:06 -0500 Subject: [PATCH 04/36] "export" TRE routines as "static" --- modules/c/nitf/include/nitf/Defines.h | 7 +++++-- modules/c/nitf/source/TRE.c | 9 ++++++--- modules/c/nitf/source/TREs.c | 3 +++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/modules/c/nitf/include/nitf/Defines.h b/modules/c/nitf/include/nitf/Defines.h index 9210ef6b2..8d5038d9b 100644 --- a/modules/c/nitf/include/nitf/Defines.h +++ b/modules/c/nitf/include/nitf/Defines.h @@ -31,6 +31,9 @@ * * _Tre the name of the input TRE */ +#ifndef NITF_PLUGIN_FUNCTION_EXPORT +#define NITF_PLUGIN_FUNCTION_EXPORT(retval_) NITFAPI(retval_) +#endif #define NITF_DECLARE_PLUGIN(_Tre) \ static const char* _Tre##Ident[] = { \ NITF_PLUGIN_TRE_KEY, \ @@ -38,10 +41,10 @@ NULL \ }; \ static nitf_TREHandler _Tre##Handler; \ - NITFAPI(const char**) _Tre##_init(nitf_Error* error){ \ + NITF_PLUGIN_FUNCTION_EXPORT(const char**) _Tre##_init(nitf_Error* error){ \ if (!nitf_TREUtils_createBasicHandler(&_Tre##DescriptionSet, &_Tre##Handler,error)) return NULL; \ return _Tre##Ident; } \ - NITFAPI(nitf_TREHandler*) _Tre##_handler(nitf_Error* error) { \ + NITF_PLUGIN_FUNCTION_EXPORT(nitf_TREHandler*) _Tre##_handler(nitf_Error* error) { \ (void)error; \ return &_Tre##Handler; \ } diff --git a/modules/c/nitf/source/TRE.c b/modules/c/nitf/source/TRE.c index 154f9acc2..19c8d555b 100644 --- a/modules/c/nitf/source/TRE.c +++ b/modules/c/nitf/source/TRE.c @@ -110,6 +110,11 @@ NITFAPI(void) nitf_TRE_destruct(nitf_TRE ** tre) } NITFAPI(nitf_TREHandler*) nitf_DefaultTRE_handler(nitf_Error * error); +static nitf_TREHandler* retrieveTREHandler(nitf_PluginRegistry* reg, const char* treIdent, + int* hadError, nitf_Error* error) +{ + return nitf_PluginRegistry_retrieveTREHandler(reg, treIdent, hadError, error); +} NITFAPI(nitf_TRE *) nitf_TRE_construct(const char* tag, const char* id, @@ -128,9 +133,7 @@ NITFAPI(nitf_TRE *) nitf_TRE_construct(const char* tag, if (!id || strcmp(id, NITF_TRE_RAW) != 0) { int bad = 0; - tre->handler = - nitf_PluginRegistry_retrieveTREHandler(reg, tag, &bad, error); - + tre->handler = retrieveTREHandler(reg, tag, &bad, error); if (bad) return NULL; } diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index 3475b0461..36a8456a6 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -20,6 +20,9 @@ * */ +#undef NITF_PLUGIN_FUNCTION_EXPORT +#define NITF_PLUGIN_FUNCTION_EXPORT(retval_) static retval_ + #include "nitf/TRE.h" #include "nitf/PluginIdentifier.h" From 27cdcb0ef48127d071d0cf92552f74cbdf295d90 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 10:09:53 -0500 Subject: [PATCH 05/36] struct for pre-loaded TREs rather than "void*" --- modules/c/nitf/include/nitf/PluginIdentifier.h | 7 +++++++ modules/c/nitf/source/TREs.c | 9 +++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/c/nitf/include/nitf/PluginIdentifier.h b/modules/c/nitf/include/nitf/PluginIdentifier.h index ba130bde6..da1203f2c 100644 --- a/modules/c/nitf/include/nitf/PluginIdentifier.h +++ b/modules/c/nitf/include/nitf/PluginIdentifier.h @@ -64,6 +64,13 @@ typedef int (*NITF_PLUGIN_TRE_HANDLER_FUNCTION) typedef nitf_TREHandler* (*NITF_PLUGIN_TRE_HANDLER_FUNCTION)(nitf_Error * error); +// These are TREs which are linked into NITF rather than loaded at run-time. +typedef struct _nitf_TREPreloaded +{ + const char* name; + NITF_PLUGIN_INIT_FUNCTION init; + NITF_PLUGIN_TRE_HANDLER_FUNCTION handler; +} nitf_TREPreloaded; /* \brief NITF_PLUGIN_COMPRESSION_HANDLER_FUNCTION - Function pointer for diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index 36a8456a6..e4f9ccb82 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -35,7 +35,8 @@ #include "../shared/TEST_DES.c" #include "../shared/XML_DATA_CONTENT.c" -const void* preloaded[] = { - "ACCHZB", (void*)&ACCHZB_init,(void*)&ACCHZB_handler, - "HISTOA", (void*)&HISTOA_init, (void*)&HISTOA_handler, - NULL, NULL, NULL }; +const nitf_TREPreloaded preloaded[] = { + { "ACCHZB", ACCHZB_init, ACCHZB_handler }, + { "HISTOA", HISTOA_init, HISTOA_handler }, + { NULL, NULL, NULL } +}; From 29a31d1a5627c85ec447f29aa27772b50bda2ded Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 10:40:52 -0500 Subject: [PATCH 06/36] start working on resolving preloaded TREs --- modules/c/nitf/source/TRE.c | 59 +++++++++++++++++++++++++++++++++++- modules/c/nitf/source/TREs.c | 1 + 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/modules/c/nitf/source/TRE.c b/modules/c/nitf/source/TRE.c index 19c8d555b..e0abd4edb 100644 --- a/modules/c/nitf/source/TRE.c +++ b/modules/c/nitf/source/TRE.c @@ -110,10 +110,67 @@ NITFAPI(void) nitf_TRE_destruct(nitf_TRE ** tre) } NITFAPI(nitf_TREHandler*) nitf_DefaultTRE_handler(nitf_Error * error); +static const nitf_TREPreloaded* findPreloadedTRE(const char* keyName) +{ + extern const nitf_TREPreloaded preloaded[]; + for (size_t i = 0;; i++) + { + const char* pKeyName = preloaded[i].name; + if (pKeyName == NULL) // end of list + { + return NULL; + } + if (strcmp(keyName, pKeyName) == 0) + { + return &(preloaded[i]); + } + } + return NULL; +} +static nitf_TREHandler* retrievePreloadedTREHandler(nitf_PluginRegistry* reg, const char* treIdent, + int* hadError, nitf_Error* error) +{ + /* Construct the DLL object */ + nitf_DLL* dll = nitf_DLL_construct(error); + if (!dll) + { + *hadError = 1; + return NULL; + } + dll->libname = NULL; // not really a DLL + + const nitf_TREPreloaded* plugin = findPreloadedTRE(treIdent); + if (plugin == NULL) + { + *hadError = 1; + return NULL; + } + dll->lib = (NRT_NATIVE_DLL)plugin->handler; // stash the handler here + + /* Now init the plugin!!! */ + const char** ident = (*plugin->init)(error); + if (!ident) + { + nitf_Error_initf(error, NITF_CTXT, NITF_ERR_INVALID_OBJECT, "The plugin [%s] is not preloadable", treIdent); + *hadError = 1; + return NULL; + } + //return insertPlugin_("Successfully pre-loaded plugin: [%s] at [%p]\n", + // reg, ident, dll, error); + *hadError = 1; + return NULL; +} + static nitf_TREHandler* retrieveTREHandler(nitf_PluginRegistry* reg, const char* treIdent, int* hadError, nitf_Error* error) { - return nitf_PluginRegistry_retrieveTREHandler(reg, treIdent, hadError, error); + nitf_TREHandler* handler = nitf_PluginRegistry_retrieveTREHandler(reg, treIdent, hadError, error); + if (*hadError) + { + *hadError = 0; + handler = retrievePreloadedTREHandler(reg, treIdent, hadError, error); + } + return handler; } NITFAPI(nitf_TRE *) nitf_TRE_construct(const char* tag, diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index e4f9ccb82..7c584fa83 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -35,6 +35,7 @@ #include "../shared/TEST_DES.c" #include "../shared/XML_DATA_CONTENT.c" +extern const nitf_TREPreloaded preloaded[]; const nitf_TREPreloaded preloaded[] = { { "ACCHZB", ACCHZB_init, ACCHZB_handler }, { "HISTOA", HISTOA_init, HISTOA_handler }, From 2983c1bb1bb99d473495e36b594417b8e60823b9 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 10:48:44 -0500 Subject: [PATCH 07/36] retrievePreloadedTREHandler() to match nitf_PluginRegistry_retrieveTREHandler() --- modules/c/nitf/source/TRE.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/modules/c/nitf/source/TRE.c b/modules/c/nitf/source/TRE.c index e0abd4edb..ee5887870 100644 --- a/modules/c/nitf/source/TRE.c +++ b/modules/c/nitf/source/TRE.c @@ -130,14 +130,8 @@ static const nitf_TREPreloaded* findPreloadedTRE(const char* keyName) static nitf_TREHandler* retrievePreloadedTREHandler(nitf_PluginRegistry* reg, const char* treIdent, int* hadError, nitf_Error* error) { - /* Construct the DLL object */ - nitf_DLL* dll = nitf_DLL_construct(error); - if (!dll) - { - *hadError = 1; - return NULL; - } - dll->libname = NULL; // not really a DLL + /* No error has occurred (yet) */ + *hadError = 0; const nitf_TREPreloaded* plugin = findPreloadedTRE(treIdent); if (plugin == NULL) @@ -145,20 +139,16 @@ static nitf_TREHandler* retrievePreloadedTREHandler(nitf_PluginRegistry* reg, co *hadError = 1; return NULL; } - dll->lib = (NRT_NATIVE_DLL)plugin->handler; // stash the handler here - /* Now init the plugin!!! */ - const char** ident = (*plugin->init)(error); - if (!ident) + /* If something is, get its DLL part */ + NITF_PLUGIN_TRE_HANDLER_FUNCTION treMain = plugin->handler; + + nitf_TREHandler* theHandler = (*treMain)(error); + if (!theHandler) { - nitf_Error_initf(error, NITF_CTXT, NITF_ERR_INVALID_OBJECT, "The plugin [%s] is not preloadable", treIdent); *hadError = 1; - return NULL; } - //return insertPlugin_("Successfully pre-loaded plugin: [%s] at [%p]\n", - // reg, ident, dll, error); - *hadError = 1; - return NULL; + return theHandler; } static nitf_TREHandler* retrieveTREHandler(nitf_PluginRegistry* reg, const char* treIdent, From 910db14e8ce5252f9414711249631485c3a2ac9d Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 12:01:55 -0500 Subject: [PATCH 08/36] preload a TRE --- modules/c/nitf/include/nitf/PluginRegistry.h | 2 + modules/c/nitf/source/PluginRegistry.c | 4 +- modules/c/nitf/source/TRE.c | 69 ++++++++++++++++---- modules/c/nrt/include/nrt/DLL.h | 3 +- modules/c/nrt/source/DLLUnix.c | 10 +++ modules/c/nrt/source/DLLWin32.c | 11 ++++ 6 files changed, 83 insertions(+), 16 deletions(-) diff --git a/modules/c/nitf/include/nitf/PluginRegistry.h b/modules/c/nitf/include/nitf/PluginRegistry.h index cc22d82f6..858d486fe 100644 --- a/modules/c/nitf/include/nitf/PluginRegistry.h +++ b/modules/c/nitf/include/nitf/PluginRegistry.h @@ -165,6 +165,8 @@ NITFAPI(NITF_BOOL) nitf_PluginRegistry_loadDir(const char* dirName, nitf_Error * error); +NITFAPI(NITF_BOOL) + nitf_PluginRegistry_insertPlugin_(const char* msg, nitf_PluginRegistry* reg, const char** ident, nitf_DLL* dll, nitf_Error* error); NITFAPI(NITF_BOOL) nitf_PluginRegistry_loadPlugin(const char* fullPathName, nitf_Error* error); diff --git a/modules/c/nitf/source/PluginRegistry.c b/modules/c/nitf/source/PluginRegistry.c index 2594331ad..c96d4938d 100644 --- a/modules/c/nitf/source/PluginRegistry.c +++ b/modules/c/nitf/source/PluginRegistry.c @@ -470,7 +470,7 @@ nitf_PluginRegistry_unload(nitf_PluginRegistry* reg, nitf_Error* error) return success; } -static NITF_BOOL insertPlugin_(const char* msg, +NITFAPI(NITF_BOOL) nitf_PluginRegistry_insertPlugin_(const char* msg, nitf_PluginRegistry* reg, const char** ident, nitf_DLL* dll, nitf_Error* error) { /* If no ident, we have a set error and an invalid plugin */ @@ -521,7 +521,7 @@ nitf_PluginRegistry_loadPlugin(const char* fullName, nitf_Error* error) /* Now init the plugin!!! */ ident = doInit(dll, keyName, error); - return insertPlugin_("Successfully loaded plugin: [%s] at [%p]\n", + return nitf_PluginRegistry_insertPlugin_("Successfully loaded plugin: [%s] at [%p]\n", reg, ident, dll, error); } diff --git a/modules/c/nitf/source/TRE.c b/modules/c/nitf/source/TRE.c index ee5887870..5a4c8216e 100644 --- a/modules/c/nitf/source/TRE.c +++ b/modules/c/nitf/source/TRE.c @@ -127,39 +127,82 @@ static const nitf_TREPreloaded* findPreloadedTRE(const char* keyName) } return NULL; } -static nitf_TREHandler* retrievePreloadedTREHandler(nitf_PluginRegistry* reg, const char* treIdent, - int* hadError, nitf_Error* error) + +/* + * Initialize a DSO. The init hook is retrieved and called once + * when the DSO is loaded + */ +static const char** doInit(NITF_PLUGIN_INIT_FUNCTION init, const char* prefix, nitf_Error* error) +{ + /* Else, call it */ + const char** ident = (*init)(error); + if (!ident) + { + nitf_Error_initf(error, NITF_CTXT, NITF_ERR_INVALID_OBJECT, "The plugin [%s] is not retrievable", prefix); + return NULL; + } + return ident; +} + +static NRT_BOOL preloadTRE(const char* keyName, nitf_Error* error) { - /* No error has occurred (yet) */ - *hadError = 0; + const char** ident; + nitf_PluginRegistry* reg = nitf_PluginRegistry_getInstance(error); - const nitf_TREPreloaded* plugin = findPreloadedTRE(treIdent); + /* Construct the DLL object */ + nitf_DLL* dll = nitf_DLL_construct(error); + if (!dll) + { + return NITF_FAILURE; + } + dll->lib = NULL; // not a real DLL + dll->dsoMain = NULL; // filled in after successful findPreloadedTRE() + + const nitf_TREPreloaded* plugin = findPreloadedTRE(keyName); if (plugin == NULL) { - *hadError = 1; - return NULL; + return NITF_FAILURE; } + dll->dsoMain = (NRT_DLL_FUNCTION_PTR)plugin->handler; - /* If something is, get its DLL part */ - NITF_PLUGIN_TRE_HANDLER_FUNCTION treMain = plugin->handler; + /* Now init the plugin!!! */ + ident = doInit(plugin->init, keyName, error); + return nitf_PluginRegistry_insertPlugin_("Successfully pre-loaded plugin: [%s] at [%p]\n", reg, ident, dll, error); +} - nitf_TREHandler* theHandler = (*treMain)(error); - if (!theHandler) +static nitf_TREHandler* retrievePreloadedTREHandler(nitf_PluginRegistry* reg, const char* treIdent, + int* hadError, nitf_Error* error) +{ + if (!preloadTRE(treIdent, error)) { *hadError = 1; + return NULL; } - return theHandler; + + // Successfully preloaded the TRE, it should now be in the hash table. + return nitf_PluginRegistry_retrieveTREHandler(reg, treIdent, hadError, error); } static nitf_TREHandler* retrieveTREHandler(nitf_PluginRegistry* reg, const char* treIdent, int* hadError, nitf_Error* error) { nitf_TREHandler* handler = nitf_PluginRegistry_retrieveTREHandler(reg, treIdent, hadError, error); + if (*hadError) { *hadError = 0; - handler = retrievePreloadedTREHandler(reg, treIdent, hadError, error); + return retrievePreloadedTREHandler(reg, treIdent, hadError, error); + } + + // Normally, a NULL handler is **not** an error. + if (handler == NULL) + { + int bad = 0; + nitf_TREHandler* preloadedHandler = retrievePreloadedTREHandler(reg, treIdent, &bad, error); + if (!bad) + return preloadedHandler; } + return handler; } diff --git a/modules/c/nrt/include/nrt/DLL.h b/modules/c/nrt/include/nrt/DLL.h index 9705b8a54..dbdb2127f 100644 --- a/modules/c/nrt/include/nrt/DLL.h +++ b/modules/c/nrt/include/nrt/DLL.h @@ -51,7 +51,8 @@ typedef struct _NRT_DLL { char *libname; /* The name of the library */ - NRT_NATIVE_DLL lib; /* A handle to the library */ + NRT_NATIVE_DLL lib; /* A handle to the library, or NULL for "preloaded" TREs */ + NRT_DLL_FUNCTION_PTR dsoMain; /* If 'lib' is NULL, the main() function */ } nrt_DLL; NRT_CXX_GUARD diff --git a/modules/c/nrt/source/DLLUnix.c b/modules/c/nrt/source/DLLUnix.c index 1cd147e76..40c3a4215 100644 --- a/modules/c/nrt/source/DLLUnix.c +++ b/modules/c/nrt/source/DLLUnix.c @@ -84,6 +84,7 @@ NRTAPI(NRT_BOOL) nrt_DLL_load(nrt_DLL * dll, const char *libname, return NRT_FAILURE; } + dll->dsoMain = NULL; return NRT_SUCCESS; } @@ -120,7 +121,16 @@ NRTAPI(NRT_DLL_FUNCTION_PTR) nrt_DLL_retrieve(nrt_DLL * dll, NRT_ERR_RETRIEVING_DLL_HOOK); } return ptr; + } + // This might be a "preloaded" TRE + if (dll->dsoMain) + { + const char* underscore = strchr(function, '_'); + if ((underscore != NULL) && strcmp(underscore, "_handler") == 0) + { + return dll->dsoMain; + } } /* You shouldnt be calling it if it didnt load */ diff --git a/modules/c/nrt/source/DLLWin32.c b/modules/c/nrt/source/DLLWin32.c index b6c7138c0..a202d99f1 100644 --- a/modules/c/nrt/source/DLLWin32.c +++ b/modules/c/nrt/source/DLLWin32.c @@ -87,6 +87,7 @@ NRTAPI(NRT_BOOL) nrt_DLL_load(nrt_DLL * dll, const char *libname, dll->libname = NULL; return NRT_FAILURE; } + dll->dsoMain = NULL; return NRT_SUCCESS; } @@ -132,6 +133,16 @@ NRTAPI(NRT_DLL_FUNCTION_PTR) nrt_DLL_retrieve(nrt_DLL * dll, return ptr; } + // This might be a "preloaded" TRE + if (dll->dsoMain) + { + const char* underscore = strchr(function, '_'); + if ((underscore != NULL) && strcmp(underscore, "_handler") == 0) + { + return dll->dsoMain; + } + } + nrt_Error_initf(error, NRT_CTXT, NRT_ERR_UNINITIALIZED_DLL_READ, "Failed to retrieve function [%s] -- DLL appears to be uninitialized", function); From 28465b459b4cd49092aa584cfb62aeb48fdda6b7 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 12:16:35 -0500 Subject: [PATCH 09/36] preload several TREs --- UnitTest/UnitTest.vcxproj | 30 ------------ modules/c/nitf/shared/AIMIDB.c | 4 +- modules/c/nitf/shared/CSCRNA.c | 4 +- modules/c/nitf/shared/CSEXRB.c | 4 +- modules/c/nitf/shared/ENGRDA.c | 10 ++-- modules/c/nitf/shared/JITCID.c | 4 +- modules/c/nitf/shared/PTPRAA.c | 4 +- modules/c/nitf/shared/RPFHDR.c | 4 +- modules/c/nitf/shared/TEST_DES.c | 16 +++--- modules/c/nitf/source/TREs.c | 28 +++++++++-- nitro.sln | 84 -------------------------------- 11 files changed, 50 insertions(+), 142 deletions(-) diff --git a/UnitTest/UnitTest.vcxproj b/UnitTest/UnitTest.vcxproj index 7e23058b0..9cdfdcb9a 100644 --- a/UnitTest/UnitTest.vcxproj +++ b/UnitTest/UnitTest.vcxproj @@ -258,36 +258,6 @@ {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - {730b1e6e-2469-4f9e-b093-d0c6262453c9} - - - {51d7b426-899e-428d-9f69-5ddac9e403fb} - - - {12aa0752-4ee3-4e0a-85af-0e5deadbf343} - - - {023de06d-3967-4406-b1b8-032118bb2552} - - - {0a9bda26-092f-4a2c-bbef-00c64bf0c65e} - - - {53f9f908-c678-4dee-9309-e71c1e03a45f} - - - {d1d7fcd3-6130-4504-9da0-9d80506be55e} - - - {2baaaca9-a5a4-412c-ae52-b16c2d107f55} - - - {cf5b4f02-364d-4117-9fb9-6c9c7938e412} - - - {78849481-d356-4cc7-b182-31c21f857ed1} - diff --git a/modules/c/nitf/shared/AIMIDB.c b/modules/c/nitf/shared/AIMIDB.c index b30cedf03..4f752df7f 100644 --- a/modules/c/nitf/shared/AIMIDB.c +++ b/modules/c/nitf/shared/AIMIDB.c @@ -30,7 +30,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription AIMIDB_description[] = { {NITF_BCS_A, 14, "Acquisition Date/Time", "ACQUISITION_DATE" }, {NITF_BCS_A, 4, "Mission Number", "MISSION_NO" }, {NITF_BCS_A, 10, "Mission ID (ATO)", "MISSION_IDENTIFICATION" }, @@ -52,6 +52,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(AIMIDB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(AIMIDB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/CSCRNA.c b/modules/c/nitf/shared/CSCRNA.c index 04d029578..fc8ea62d2 100644 --- a/modules/c/nitf/shared/CSCRNA.c +++ b/modules/c/nitf/shared/CSCRNA.c @@ -30,7 +30,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription CSCRNA_description[] = { {NITF_BCS_A, 1, "predicted corners flag", "PREDICT_CORNERS" }, {NITF_BCS_N, 9, "lat UL", "ULCNR_LAT" }, {NITF_BCS_N, 10, "long UL", "ULCNR_LONG" }, @@ -47,6 +47,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(CSCRNA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(CSCRNA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/CSEXRB.c b/modules/c/nitf/shared/CSEXRB.c index ada74d1c3..e9fb5af97 100644 --- a/modules/c/nitf/shared/CSEXRB.c +++ b/modules/c/nitf/shared/CSEXRB.c @@ -30,7 +30,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription CSEXRB_description[] = { {NITF_BCS_A, 36, "UUID Assigned to the Current Image Plane", "IMAGE_UUID"}, {NITF_BCS_N, 3, "Number of GLAS/GFM DES Associated with this Image", "NUM_ASSOC_DES"}, {NITF_IF, 0, "> 0", "NUM_ASSOC_DES"}, @@ -144,6 +144,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(CSEXRB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(CSEXRB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/ENGRDA.c b/modules/c/nitf/shared/ENGRDA.c index d9de9d24c..5dc5d0eec 100644 --- a/modules/c/nitf/shared/ENGRDA.c +++ b/modules/c/nitf/shared/ENGRDA.c @@ -31,7 +31,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription ENGRDA_description[] = { {NITF_BCS_A, 20, "Unique Source System Name", "RESRC" }, {NITF_BCS_N, 3, "Record Entry Count", "RECNT" }, {NITF_LOOP, 0, NULL, "RECNT"}, @@ -57,12 +57,12 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -static nitf_TREDescriptionInfo descriptions[] = { - { "ENGRDA", description, NITF_TRE_DESC_NO_LENGTH }, +static nitf_TREDescriptionInfo ENGRDA_descriptions[] = { + { "ENGRDA", ENGRDA_description, NITF_TRE_DESC_NO_LENGTH }, { NULL, NULL, NITF_TRE_DESC_NO_LENGTH } }; -static nitf_TREDescriptionSet descriptionSet = { 0, descriptions }; +static nitf_TREDescriptionSet ENGRDA_descriptionSet = { 0, ENGRDA_descriptions }; static const char *ident[] = { NITF_PLUGIN_TRE_KEY, "ENGRDA", NULL }; @@ -296,7 +296,7 @@ NITFPRIV(NITF_BOOL) ENGRDA_read(nitf_IOInterface* io, NITFAPI(const char**) ENGRDA_init(nitf_Error* error) { - if (!nitf_TREUtils_createBasicHandler(&descriptionSet, + if (!nitf_TREUtils_createBasicHandler(&ENGRDA_descriptionSet, &engrdaHandler, error)) { diff --git a/modules/c/nitf/shared/JITCID.c b/modules/c/nitf/shared/JITCID.c index 73bacd87a..97b21d6e8 100644 --- a/modules/c/nitf/shared/JITCID.c +++ b/modules/c/nitf/shared/JITCID.c @@ -26,11 +26,11 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription JITCID_description[] = { {NITF_BCS_A, NITF_TRE_GOBBLE, "File Comment", "FILCMT" }, {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(JITCID, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(JITCID) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/PTPRAA.c b/modules/c/nitf/shared/PTPRAA.c index c0d63301f..fdf222525 100644 --- a/modules/c/nitf/shared/PTPRAA.c +++ b/modules/c/nitf/shared/PTPRAA.c @@ -31,7 +31,7 @@ NITF_CXX_GUARD // MIL-PRF-89034, Table 38 (page 80) -static nitf_TREDescription description[] = { +static nitf_TREDescription PTPRAA_description[] = { {NITF_BCS_A, 4, "Segment Model ID", "SISEGID" }, {NITF_BCS_N, 8, "Segment Absolute CE 90%", "SNACE" }, {NITF_BCS_N, 8, "Segment Absolute LE 90%", "SNALE" }, @@ -66,6 +66,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(PTPRAA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(PTPRAA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/RPFHDR.c b/modules/c/nitf/shared/RPFHDR.c index d484e83f2..9b32de32d 100644 --- a/modules/c/nitf/shared/RPFHDR.c +++ b/modules/c/nitf/shared/RPFHDR.c @@ -30,7 +30,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription RPFHDR_description[] = { {NITF_BINARY, 1, "endian flag", "ENDIAN" }, {NITF_BINARY, 2, "header section length", "HDSECL" }, {NITF_BCS_A, 12, "filename", "FILENM" }, @@ -44,6 +44,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(RPFHDR, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(RPFHDR) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/TEST_DES.c b/modules/c/nitf/shared/TEST_DES.c index c9a06dd95..dc3a074b9 100644 --- a/modules/c/nitf/shared/TEST_DES.c +++ b/modules/c/nitf/shared/TEST_DES.c @@ -55,7 +55,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription TEST_DES_description[] = { {NITF_BCS_N, 2, "Number of data values", "TEST_DES_COUNT" }, {NITF_BCS_N, 3, "Start value in ramp", "TEST_DES_START" }, {NITF_BCS_N, 2, "Increment between values in ramp", "TEST_DES_INCREMENT" }, @@ -63,7 +63,7 @@ static nitf_TREDescription description[] = { }; -static const char *ident[] = +static const char *TEST_DES_ident[] = { NITF_PLUGIN_TRE_KEY, "TEST DES", @@ -71,21 +71,21 @@ static const char *ident[] = NULL }; -static nitf_TREDescriptionInfo descriptions[] = { - { "TEST DES", description, NITF_TRE_DESC_NO_LENGTH }, - { "TEST_DES", description, NITF_TRE_DESC_NO_LENGTH }, +static nitf_TREDescriptionInfo TEST_DES_descriptions[] = { + { "TEST DES", TEST_DES_description, NITF_TRE_DESC_NO_LENGTH }, + { "TEST_DES", TEST_DES_description, NITF_TRE_DESC_NO_LENGTH }, { NULL, NULL, NITF_TRE_DESC_NO_LENGTH } }; -static nitf_TREDescriptionSet descriptionSet = { 0, descriptions }; +static nitf_TREDescriptionSet TEST_DES_descriptionSet = { 0, TEST_DES_descriptions }; static nitf_TREHandler TEST_DESHandler; NITFAPI(const char**) TEST_DES_init(nitf_Error* error) { - if (!nitf_TREUtils_createBasicHandler(&descriptionSet, + if (!nitf_TREUtils_createBasicHandler(&TEST_DES_descriptionSet, &TEST_DESHandler,error)) return NULL; - return ident; + return TEST_DES_ident; } NITFAPI(void) TEST_DES_cleanup(void){} NITFAPI(nitf_TREHandler*) TEST_DES_handler(nitf_Error* error) { diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index 7c584fa83..6612ef1f9 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -31,13 +31,35 @@ #endif #include "../shared/ACCHZB.c" +#include "../shared/ACCPOB.c" +#include "../shared/ACFTA.c" +#include "../shared/AIMIDB.c" +#include "../shared/CSCRNA.c" +#include "../shared/CSEXRB.c" +#include "../shared/ENGRDA.c" #include "../shared/HISTOA.c" -#include "../shared/TEST_DES.c" +#include "../shared/JITCID.c" +#include "../shared/PTPRAA.c" +#include "../shared/RPFHDR.c" #include "../shared/XML_DATA_CONTENT.c" +#include "../shared/TEST_DES.c" + +#define NITF_preload_TRE(Tre_) { #Tre_, Tre_##_init, Tre_##_handler } extern const nitf_TREPreloaded preloaded[]; const nitf_TREPreloaded preloaded[] = { - { "ACCHZB", ACCHZB_init, ACCHZB_handler }, - { "HISTOA", HISTOA_init, HISTOA_handler }, + NITF_preload_TRE(ACCHZB), + NITF_preload_TRE(ACCPOB), + NITF_preload_TRE(ACFTA), + NITF_preload_TRE(AIMIDB), + NITF_preload_TRE(CSCRNA), + NITF_preload_TRE(CSEXRB), + NITF_preload_TRE(ENGRDA), + NITF_preload_TRE(HISTOA), + NITF_preload_TRE(JITCID), + NITF_preload_TRE(PTPRAA), + NITF_preload_TRE(RPFHDR), + NITF_preload_TRE(TEST_DES), + NITF_preload_TRE(XML_DATA_CONTENT), { NULL, NULL, NULL } }; diff --git a/nitro.sln b/nitro.sln index c03c4cb6e..3d025af7c 100644 --- a/nitro.sln +++ b/nitro.sln @@ -20,28 +20,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nitf-c++", "modules\c++\nit {A676EDF3-F231-47C8-A6E6-0FE50B50B71B} = {A676EDF3-F231-47C8-A6E6-0FE50B50B71B} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACCPOB", "modules\c\nitf\ACCPOB.vcxproj", "{730B1E6E-2469-4F9E-B093-D0C6262453C9}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACFTA", "modules\c\nitf\ACFTA.vcxproj", "{51D7B426-899E-428D-9F69-5DDAC9E403FB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AIMIDB", "modules\c\nitf\AIMIDB.vcxproj", "{12AA0752-4EE3-4E0A-85AF-0E5DEADBF343}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JITCID", "modules\c\nitf\JITCID.vcxproj", "{D1D7FCD3-6130-4504-9DA0-9D80506BE55E}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "c-nitf-shared", "c-nitf-shared", "{27A2685A-E869-42A2-956D-92994F60C536}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSCRNA", "modules\c\nitf\CSCRNA.vcxproj", "{023DE06D-3967-4406-B1B8-032118BB2552}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RPFHDR", "modules\c\nitf\RPFHDR.vcxproj", "{CF5B4F02-364D-4117-9FB9-6C9C7938E412}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XML_DATA_CONTENT", "modules\c\nitf\XML_DATA_CONTENT.vcxproj", "{78849481-D356-4CC7-B182-31C21F857ED1}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "show_nitf++", "modules\c++\nitf\apps\show_nitf++\show_nitf++.vcxproj", "{839FF52C-57D1-45B6-81FD-5C7D72523EE5}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PTPRAA", "modules\c\nitf\PTPRAA.vcxproj", "{2BAAACA9-A5A4-412C-AE52-B16C2D107F55}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ENGRDA", "modules\c\nitf\ENGRDA.vcxproj", "{53F9F908-C678-4DEE-9309-E71C1E03A45F}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "J2KCompress", "modules\c\j2k\J2KCompress.vcxproj", "{A676EDF3-F231-47C8-A6E6-0FE50B50B71B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "J2KDecompress", "modules\c\j2k\J2KDecompress.vcxproj", "{C787537A-0CAC-4D6D-A6D6-A66765A06753}" @@ -53,18 +35,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github-workflows", ".githu .github\workflows\main.yml = .github\workflows\main.yml EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSEXRB", "modules\c\nitf\CSEXRB.vcxproj", "{0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "externals", "externals", "{7D26D571-0014-4C50-BF86-612E743E64B6}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "coda-oss", "externals\coda-oss\modules\c++\coda-oss.vcxproj", "{9997E895-5161-4DDF-8F3F-099894CB2F21}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest", "UnitTest\UnitTest.vcxproj", "{8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACCHZB", "modules\c\nitf\ACCHZB.vcxproj", "{53F9F908-C678-4DEE-9309-E71C1D03A45F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HISTOA", "modules\c\nitf\HISTOA.vcxproj", "{D749AA73-4C9A-473D-96BB-070A6D9CAA54}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -79,46 +55,10 @@ Global {8F357A19-799E-4971-850E-3F28485C130B}.Debug|x64.Build.0 = Debug|x64 {8F357A19-799E-4971-850E-3F28485C130B}.Release|x64.ActiveCfg = Release|x64 {8F357A19-799E-4971-850E-3F28485C130B}.Release|x64.Build.0 = Release|x64 - {730B1E6E-2469-4F9E-B093-D0C6262453C9}.Debug|x64.ActiveCfg = Debug|x64 - {730B1E6E-2469-4F9E-B093-D0C6262453C9}.Debug|x64.Build.0 = Debug|x64 - {730B1E6E-2469-4F9E-B093-D0C6262453C9}.Release|x64.ActiveCfg = Release|x64 - {730B1E6E-2469-4F9E-B093-D0C6262453C9}.Release|x64.Build.0 = Release|x64 - {51D7B426-899E-428D-9F69-5DDAC9E403FB}.Debug|x64.ActiveCfg = Debug|x64 - {51D7B426-899E-428D-9F69-5DDAC9E403FB}.Debug|x64.Build.0 = Debug|x64 - {51D7B426-899E-428D-9F69-5DDAC9E403FB}.Release|x64.ActiveCfg = Release|x64 - {51D7B426-899E-428D-9F69-5DDAC9E403FB}.Release|x64.Build.0 = Release|x64 - {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343}.Debug|x64.ActiveCfg = Debug|x64 - {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343}.Debug|x64.Build.0 = Debug|x64 - {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343}.Release|x64.ActiveCfg = Release|x64 - {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343}.Release|x64.Build.0 = Release|x64 - {D1D7FCD3-6130-4504-9DA0-9D80506BE55E}.Debug|x64.ActiveCfg = Debug|x64 - {D1D7FCD3-6130-4504-9DA0-9D80506BE55E}.Debug|x64.Build.0 = Debug|x64 - {D1D7FCD3-6130-4504-9DA0-9D80506BE55E}.Release|x64.ActiveCfg = Release|x64 - {D1D7FCD3-6130-4504-9DA0-9D80506BE55E}.Release|x64.Build.0 = Release|x64 - {023DE06D-3967-4406-B1B8-032118BB2552}.Debug|x64.ActiveCfg = Debug|x64 - {023DE06D-3967-4406-B1B8-032118BB2552}.Debug|x64.Build.0 = Debug|x64 - {023DE06D-3967-4406-B1B8-032118BB2552}.Release|x64.ActiveCfg = Release|x64 - {023DE06D-3967-4406-B1B8-032118BB2552}.Release|x64.Build.0 = Release|x64 - {CF5B4F02-364D-4117-9FB9-6C9C7938E412}.Debug|x64.ActiveCfg = Debug|x64 - {CF5B4F02-364D-4117-9FB9-6C9C7938E412}.Debug|x64.Build.0 = Debug|x64 - {CF5B4F02-364D-4117-9FB9-6C9C7938E412}.Release|x64.ActiveCfg = Release|x64 - {CF5B4F02-364D-4117-9FB9-6C9C7938E412}.Release|x64.Build.0 = Release|x64 - {78849481-D356-4CC7-B182-31C21F857ED1}.Debug|x64.ActiveCfg = Debug|x64 - {78849481-D356-4CC7-B182-31C21F857ED1}.Debug|x64.Build.0 = Debug|x64 - {78849481-D356-4CC7-B182-31C21F857ED1}.Release|x64.ActiveCfg = Release|x64 - {78849481-D356-4CC7-B182-31C21F857ED1}.Release|x64.Build.0 = Release|x64 {839FF52C-57D1-45B6-81FD-5C7D72523EE5}.Debug|x64.ActiveCfg = Debug|x64 {839FF52C-57D1-45B6-81FD-5C7D72523EE5}.Debug|x64.Build.0 = Debug|x64 {839FF52C-57D1-45B6-81FD-5C7D72523EE5}.Release|x64.ActiveCfg = Release|x64 {839FF52C-57D1-45B6-81FD-5C7D72523EE5}.Release|x64.Build.0 = Release|x64 - {2BAAACA9-A5A4-412C-AE52-B16C2D107F55}.Debug|x64.ActiveCfg = Debug|x64 - {2BAAACA9-A5A4-412C-AE52-B16C2D107F55}.Debug|x64.Build.0 = Debug|x64 - {2BAAACA9-A5A4-412C-AE52-B16C2D107F55}.Release|x64.ActiveCfg = Release|x64 - {2BAAACA9-A5A4-412C-AE52-B16C2D107F55}.Release|x64.Build.0 = Release|x64 - {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Debug|x64.ActiveCfg = Debug|x64 - {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Debug|x64.Build.0 = Debug|x64 - {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Release|x64.ActiveCfg = Release|x64 - {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Release|x64.Build.0 = Release|x64 {A676EDF3-F231-47C8-A6E6-0FE50B50B71B}.Debug|x64.ActiveCfg = Debug|x64 {A676EDF3-F231-47C8-A6E6-0FE50B50B71B}.Debug|x64.Build.0 = Debug|x64 {A676EDF3-F231-47C8-A6E6-0FE50B50B71B}.Release|x64.ActiveCfg = Release|x64 @@ -127,10 +67,6 @@ Global {C787537A-0CAC-4D6D-A6D6-A66765A06753}.Debug|x64.Build.0 = Debug|x64 {C787537A-0CAC-4D6D-A6D6-A66765A06753}.Release|x64.ActiveCfg = Release|x64 {C787537A-0CAC-4D6D-A6D6-A66765A06753}.Release|x64.Build.0 = Release|x64 - {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E}.Debug|x64.ActiveCfg = Debug|x64 - {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E}.Debug|x64.Build.0 = Debug|x64 - {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E}.Release|x64.ActiveCfg = Release|x64 - {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E}.Release|x64.Build.0 = Release|x64 {9997E895-5161-4DDF-8F3F-099894CB2F21}.Debug|x64.ActiveCfg = Debug|x64 {9997E895-5161-4DDF-8F3F-099894CB2F21}.Debug|x64.Build.0 = Debug|x64 {9997E895-5161-4DDF-8F3F-099894CB2F21}.Release|x64.ActiveCfg = Release|x64 @@ -139,35 +75,15 @@ Global {8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}.Debug|x64.Build.0 = Debug|x64 {8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}.Release|x64.ActiveCfg = Release|x64 {8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}.Release|x64.Build.0 = Release|x64 - {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Debug|x64.ActiveCfg = Debug|x64 - {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Debug|x64.Build.0 = Debug|x64 - {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Release|x64.ActiveCfg = Release|x64 - {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Release|x64.Build.0 = Release|x64 - {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Debug|x64.ActiveCfg = Debug|x64 - {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Debug|x64.Build.0 = Debug|x64 - {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Release|x64.ActiveCfg = Release|x64 - {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {730B1E6E-2469-4F9E-B093-D0C6262453C9} = {27A2685A-E869-42A2-956D-92994F60C536} - {51D7B426-899E-428D-9F69-5DDAC9E403FB} = {27A2685A-E869-42A2-956D-92994F60C536} - {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343} = {27A2685A-E869-42A2-956D-92994F60C536} - {D1D7FCD3-6130-4504-9DA0-9D80506BE55E} = {27A2685A-E869-42A2-956D-92994F60C536} - {023DE06D-3967-4406-B1B8-032118BB2552} = {27A2685A-E869-42A2-956D-92994F60C536} - {CF5B4F02-364D-4117-9FB9-6C9C7938E412} = {27A2685A-E869-42A2-956D-92994F60C536} - {78849481-D356-4CC7-B182-31C21F857ED1} = {27A2685A-E869-42A2-956D-92994F60C536} - {2BAAACA9-A5A4-412C-AE52-B16C2D107F55} = {27A2685A-E869-42A2-956D-92994F60C536} - {53F9F908-C678-4DEE-9309-E71C1E03A45F} = {27A2685A-E869-42A2-956D-92994F60C536} {A676EDF3-F231-47C8-A6E6-0FE50B50B71B} = {27A2685A-E869-42A2-956D-92994F60C536} {C787537A-0CAC-4D6D-A6D6-A66765A06753} = {27A2685A-E869-42A2-956D-92994F60C536} {A45CB073-25A7-411D-A7E7-589BCC8AF547} = {5C5727E7-0CFF-42B4-8F5A-D31B3BC81F21} - {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E} = {27A2685A-E869-42A2-956D-92994F60C536} {9997E895-5161-4DDF-8F3F-099894CB2F21} = {7D26D571-0014-4C50-BF86-612E743E64B6} - {53F9F908-C678-4DEE-9309-E71C1D03A45F} = {27A2685A-E869-42A2-956D-92994F60C536} - {D749AA73-4C9A-473D-96BB-070A6D9CAA54} = {27A2685A-E869-42A2-956D-92994F60C536} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2D7AC542-BBB6-4BAC-8BF1-7E76C714BBA4} From ff8642396987c0e2abea35c69f8db88ecda0a330 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 12:25:28 -0500 Subject: [PATCH 10/36] fix duplicate defs --- modules/c/nitf/source/TREs.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index 6612ef1f9..23ffc8083 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -36,13 +36,14 @@ #include "../shared/AIMIDB.c" #include "../shared/CSCRNA.c" #include "../shared/CSEXRB.c" -#include "../shared/ENGRDA.c" +//#include "../shared/ENGRDA.c" #include "../shared/HISTOA.c" #include "../shared/JITCID.c" #include "../shared/PTPRAA.c" #include "../shared/RPFHDR.c" #include "../shared/XML_DATA_CONTENT.c" -#include "../shared/TEST_DES.c" + +//#include "../shared/TEST_DES.c" #define NITF_preload_TRE(Tre_) { #Tre_, Tre_##_init, Tre_##_handler } @@ -54,12 +55,14 @@ const nitf_TREPreloaded preloaded[] = { NITF_preload_TRE(AIMIDB), NITF_preload_TRE(CSCRNA), NITF_preload_TRE(CSEXRB), - NITF_preload_TRE(ENGRDA), + //NITF_preload_TRE(ENGRDA), NITF_preload_TRE(HISTOA), NITF_preload_TRE(JITCID), NITF_preload_TRE(PTPRAA), NITF_preload_TRE(RPFHDR), - NITF_preload_TRE(TEST_DES), NITF_preload_TRE(XML_DATA_CONTENT), + + //NITF_preload_TRE(TEST_DES), + { NULL, NULL, NULL } }; From 78b021f9cad6e13342029e710160a0205d5bd40b Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 12:28:20 -0500 Subject: [PATCH 11/36] fix compiler warning --- modules/c/nitf/source/TRE.c | 7 +++---- modules/c/nitf/source/TREs.c | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/c/nitf/source/TRE.c b/modules/c/nitf/source/TRE.c index 5a4c8216e..0e84d04a3 100644 --- a/modules/c/nitf/source/TRE.c +++ b/modules/c/nitf/source/TRE.c @@ -112,20 +112,19 @@ NITFAPI(nitf_TREHandler*) nitf_DefaultTRE_handler(nitf_Error * error); static const nitf_TREPreloaded* findPreloadedTRE(const char* keyName) { - extern const nitf_TREPreloaded preloaded[]; + extern const nitf_TREPreloaded preloadedTREs[]; for (size_t i = 0;; i++) { - const char* pKeyName = preloaded[i].name; + const char* pKeyName = preloadedTREs[i].name; if (pKeyName == NULL) // end of list { return NULL; } if (strcmp(keyName, pKeyName) == 0) { - return &(preloaded[i]); + return &(preloadedTREs[i]); } } - return NULL; } /* diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index 23ffc8083..9a1b58079 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -47,8 +47,8 @@ #define NITF_preload_TRE(Tre_) { #Tre_, Tre_##_init, Tre_##_handler } -extern const nitf_TREPreloaded preloaded[]; -const nitf_TREPreloaded preloaded[] = { +extern const nitf_TREPreloaded preloadedTREs[]; +const nitf_TREPreloaded preloadedTREs[] = { NITF_preload_TRE(ACCHZB), NITF_preload_TRE(ACCPOB), NITF_preload_TRE(ACFTA), From 5e64418a6cc758dc30df605ed4904fbff39626fd Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 12:33:05 -0500 Subject: [PATCH 12/36] use macros to remove multiple-defined symbols --- modules/c/nitf/shared/ENGRDA.c | 4 ++-- modules/c/nitf/shared/TEST_DES.c | 4 ++-- modules/c/nitf/source/TREs.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/c/nitf/shared/ENGRDA.c b/modules/c/nitf/shared/ENGRDA.c index 5dc5d0eec..f794003f3 100644 --- a/modules/c/nitf/shared/ENGRDA.c +++ b/modules/c/nitf/shared/ENGRDA.c @@ -294,7 +294,7 @@ NITFPRIV(NITF_BOOL) ENGRDA_read(nitf_IOInterface* io, return ok; } -NITFAPI(const char**) ENGRDA_init(nitf_Error* error) +NITF_PLUGIN_FUNCTION_EXPORT(const char**) ENGRDA_init(nitf_Error* error) { if (!nitf_TREUtils_createBasicHandler(&ENGRDA_descriptionSet, &engrdaHandler, @@ -310,7 +310,7 @@ NITFAPI(const char**) ENGRDA_init(nitf_Error* error) return ident; } -NITFAPI(nitf_TREHandler*) ENGRDA_handler(nitf_Error* error) +NITF_PLUGIN_FUNCTION_EXPORT(nitf_TREHandler*) ENGRDA_handler(nitf_Error* error) { (void)error; return &engrdaHandler; diff --git a/modules/c/nitf/shared/TEST_DES.c b/modules/c/nitf/shared/TEST_DES.c index dc3a074b9..424c17958 100644 --- a/modules/c/nitf/shared/TEST_DES.c +++ b/modules/c/nitf/shared/TEST_DES.c @@ -80,7 +80,7 @@ static nitf_TREDescriptionInfo TEST_DES_descriptions[] = { static nitf_TREDescriptionSet TEST_DES_descriptionSet = { 0, TEST_DES_descriptions }; static nitf_TREHandler TEST_DESHandler; -NITFAPI(const char**) TEST_DES_init(nitf_Error* error) +NITF_PLUGIN_FUNCTION_EXPORT(const char**) TEST_DES_init(nitf_Error* error) { if (!nitf_TREUtils_createBasicHandler(&TEST_DES_descriptionSet, &TEST_DESHandler,error)) @@ -88,7 +88,7 @@ NITFAPI(const char**) TEST_DES_init(nitf_Error* error) return TEST_DES_ident; } NITFAPI(void) TEST_DES_cleanup(void){} -NITFAPI(nitf_TREHandler*) TEST_DES_handler(nitf_Error* error) { +NITF_PLUGIN_FUNCTION_EXPORT(nitf_TREHandler*) TEST_DES_handler(nitf_Error* error) { (void)error; return &TEST_DESHandler; } diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index 9a1b58079..3b1369322 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -36,14 +36,14 @@ #include "../shared/AIMIDB.c" #include "../shared/CSCRNA.c" #include "../shared/CSEXRB.c" -//#include "../shared/ENGRDA.c" +#include "../shared/ENGRDA.c" #include "../shared/HISTOA.c" #include "../shared/JITCID.c" #include "../shared/PTPRAA.c" #include "../shared/RPFHDR.c" #include "../shared/XML_DATA_CONTENT.c" -//#include "../shared/TEST_DES.c" +#include "../shared/TEST_DES.c" #define NITF_preload_TRE(Tre_) { #Tre_, Tre_##_init, Tre_##_handler } @@ -55,14 +55,14 @@ const nitf_TREPreloaded preloadedTREs[] = { NITF_preload_TRE(AIMIDB), NITF_preload_TRE(CSCRNA), NITF_preload_TRE(CSEXRB), - //NITF_preload_TRE(ENGRDA), + NITF_preload_TRE(ENGRDA), NITF_preload_TRE(HISTOA), NITF_preload_TRE(JITCID), NITF_preload_TRE(PTPRAA), NITF_preload_TRE(RPFHDR), NITF_preload_TRE(XML_DATA_CONTENT), - //NITF_preload_TRE(TEST_DES), + NITF_preload_TRE(TEST_DES), { NULL, NULL, NULL } }; From 120c8cce0dd87f9590a3d70e7f3563457f4c82ba Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 12:43:00 -0500 Subject: [PATCH 13/36] keep a few TREs as plugins for testing --- UnitTest/UnitTest.vcxproj | 6 ++++++ modules/c/nitf/source/TREs.c | 4 +--- nitro.sln | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/UnitTest/UnitTest.vcxproj b/UnitTest/UnitTest.vcxproj index 9cdfdcb9a..582a6e41c 100644 --- a/UnitTest/UnitTest.vcxproj +++ b/UnitTest/UnitTest.vcxproj @@ -258,6 +258,12 @@ {f06550ad-cfc7-40b8-8727-6c82c69a8982} + + {53f9f908-c678-4dee-9309-e71c1e03a45f} + + + {78849481-d356-4cc7-b182-31c21f857ed1} + diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index 3b1369322..c07d007ba 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -41,7 +41,6 @@ #include "../shared/JITCID.c" #include "../shared/PTPRAA.c" #include "../shared/RPFHDR.c" -#include "../shared/XML_DATA_CONTENT.c" #include "../shared/TEST_DES.c" @@ -55,12 +54,11 @@ const nitf_TREPreloaded preloadedTREs[] = { NITF_preload_TRE(AIMIDB), NITF_preload_TRE(CSCRNA), NITF_preload_TRE(CSEXRB), - NITF_preload_TRE(ENGRDA), + //NITF_preload_TRE(ENGRDA), NITF_preload_TRE(HISTOA), NITF_preload_TRE(JITCID), NITF_preload_TRE(PTPRAA), NITF_preload_TRE(RPFHDR), - NITF_preload_TRE(XML_DATA_CONTENT), NITF_preload_TRE(TEST_DES), diff --git a/nitro.sln b/nitro.sln index 3d025af7c..1e45b2f56 100644 --- a/nitro.sln +++ b/nitro.sln @@ -41,6 +41,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "coda-oss", "externals\coda- EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest", "UnitTest\UnitTest.vcxproj", "{8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ENGRDA", "modules\c\nitf\ENGRDA.vcxproj", "{53F9F908-C678-4DEE-9309-E71C1E03A45F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XML_DATA_CONTENT", "modules\c\nitf\XML_DATA_CONTENT.vcxproj", "{78849481-D356-4CC7-B182-31C21F857ED1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -75,6 +79,14 @@ Global {8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}.Debug|x64.Build.0 = Debug|x64 {8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}.Release|x64.ActiveCfg = Release|x64 {8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}.Release|x64.Build.0 = Release|x64 + {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Debug|x64.ActiveCfg = Debug|x64 + {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Debug|x64.Build.0 = Debug|x64 + {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Release|x64.ActiveCfg = Release|x64 + {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Release|x64.Build.0 = Release|x64 + {78849481-D356-4CC7-B182-31C21F857ED1}.Debug|x64.ActiveCfg = Debug|x64 + {78849481-D356-4CC7-B182-31C21F857ED1}.Debug|x64.Build.0 = Debug|x64 + {78849481-D356-4CC7-B182-31C21F857ED1}.Release|x64.ActiveCfg = Release|x64 + {78849481-D356-4CC7-B182-31C21F857ED1}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -84,6 +96,8 @@ Global {C787537A-0CAC-4D6D-A6D6-A66765A06753} = {27A2685A-E869-42A2-956D-92994F60C536} {A45CB073-25A7-411D-A7E7-589BCC8AF547} = {5C5727E7-0CFF-42B4-8F5A-D31B3BC81F21} {9997E895-5161-4DDF-8F3F-099894CB2F21} = {7D26D571-0014-4C50-BF86-612E743E64B6} + {53F9F908-C678-4DEE-9309-E71C1E03A45F} = {27A2685A-E869-42A2-956D-92994F60C536} + {78849481-D356-4CC7-B182-31C21F857ED1} = {27A2685A-E869-42A2-956D-92994F60C536} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2D7AC542-BBB6-4BAC-8BF1-7E76C714BBA4} From f649edf7b0314eb5c43acfc501cbe5ac06acebb5 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 12:56:04 -0500 Subject: [PATCH 14/36] preloaded TRE stuff needs to be in PluginHandler so that nitf_PluginRegistry_retrieveTREHandler() "just works" --- modules/c/nitf/source/PluginRegistry.c | 106 ++++++++++++++++++++++++- modules/c/nitf/source/TRE.c | 97 +--------------------- 2 files changed, 103 insertions(+), 100 deletions(-) diff --git a/modules/c/nitf/source/PluginRegistry.c b/modules/c/nitf/source/PluginRegistry.c index c96d4938d..e05bc2a84 100644 --- a/modules/c/nitf/source/PluginRegistry.c +++ b/modules/c/nitf/source/PluginRegistry.c @@ -470,7 +470,7 @@ nitf_PluginRegistry_unload(nitf_PluginRegistry* reg, nitf_Error* error) return success; } -NITFAPI(NITF_BOOL) nitf_PluginRegistry_insertPlugin_(const char* msg, +static NITF_BOOL insertPlugin_(const char* msg, nitf_PluginRegistry* reg, const char** ident, nitf_DLL* dll, nitf_Error* error) { /* If no ident, we have a set error and an invalid plugin */ @@ -521,7 +521,7 @@ nitf_PluginRegistry_loadPlugin(const char* fullName, nitf_Error* error) /* Now init the plugin!!! */ ident = doInit(dll, keyName, error); - return nitf_PluginRegistry_insertPlugin_("Successfully loaded plugin: [%s] at [%p]\n", + return insertPlugin_("Successfully loaded plugin: [%s] at [%p]\n", reg, ident, dll, error); } @@ -973,8 +973,67 @@ insertCreator(nitf_DLL* dso, * * No more talking to the DSOs directly */ -NITFPROT(nitf_TREHandler*) -nitf_PluginRegistry_retrieveTREHandler(nitf_PluginRegistry* reg, +static const nitf_TREPreloaded* findPreloadedTRE(const char* keyName) +{ + extern const nitf_TREPreloaded preloadedTREs[]; + for (size_t i = 0;; i++) + { + const char* pKeyName = preloadedTREs[i].name; + if (pKeyName == NULL) // end of list + { + return NULL; + } + if (strcmp(keyName, pKeyName) == 0) + { + return &(preloadedTREs[i]); + } + } +} + +/* + * Initialize a DSO. The init hook is retrieved and called once + * when the DSO is loaded + */ +static const char** preload_doInit(NITF_PLUGIN_INIT_FUNCTION init, const char* prefix, nitf_Error* error) +{ + /* Else, call it */ + const char** ident = (*init)(error); + if (!ident) + { + nitf_Error_initf(error, NITF_CTXT, NITF_ERR_INVALID_OBJECT, "The plugin [%s] is not retrievable", prefix); + return NULL; + } + return ident; +} + +static NRT_BOOL preloadTRE(const char* keyName, nitf_Error* error) +{ + const char** ident; + nitf_PluginRegistry* reg = nitf_PluginRegistry_getInstance(error); + + /* Construct the DLL object */ + nitf_DLL* dll = nitf_DLL_construct(error); + if (!dll) + { + return NITF_FAILURE; + } + dll->lib = NULL; // not a real DLL + dll->dsoMain = NULL; // filled in after successful findPreloadedTRE() + + const nitf_TREPreloaded* plugin = findPreloadedTRE(keyName); + if (plugin == NULL) + { + return NITF_FAILURE; + } + dll->dsoMain = (NRT_DLL_FUNCTION_PTR)plugin->handler; + + /* Now init the plugin!!! */ + ident = preload_doInit(plugin->init, keyName, error); + return insertPlugin_("Successfully pre-loaded plugin: [%s] at [%p]\n", reg, ident, dll, error); +} + +static nitf_TREHandler* +nitf_PluginRegistry_retrieveTREHandler_(nitf_PluginRegistry* reg, const char* treIdent, int* hadError, nitf_Error* error) @@ -1010,6 +1069,45 @@ nitf_PluginRegistry_retrieveTREHandler(nitf_PluginRegistry* reg, return theHandler; } +static nitf_TREHandler* retrievePreloadedTREHandler(nitf_PluginRegistry* reg, const char* treIdent, + int* hadError, nitf_Error* error) +{ + if (!preloadTRE(treIdent, error)) + { + *hadError = 1; + return NULL; + } + + // Successfully preloaded the TRE, it should now be in the hash table. + return nitf_PluginRegistry_retrieveTREHandler_(reg, treIdent, hadError, error); +} + +NITFPROT(nitf_TREHandler*) +nitf_PluginRegistry_retrieveTREHandler(nitf_PluginRegistry* reg, + const char* treIdent, + int* hadError, + nitf_Error* error) +{ + nitf_TREHandler* handler = nitf_PluginRegistry_retrieveTREHandler_(reg, treIdent, hadError, error); + + if (*hadError) + { + *hadError = 0; + return retrievePreloadedTREHandler(reg, treIdent, hadError, error); + } + + // Normally, a NULL handler is **not** an error. + if (handler == NULL) + { + int bad = 0; + nitf_TREHandler* preloadedHandler = retrievePreloadedTREHandler(reg, treIdent, &bad, error); + if (!bad) + return preloadedHandler; + } + + return handler; +} + NITFPROT(nitf_CompressionInterface*) nitf_PluginRegistry_retrieveCompInterface(const char* comp, nitf_Error* error) { diff --git a/modules/c/nitf/source/TRE.c b/modules/c/nitf/source/TRE.c index 0e84d04a3..ffcc123f1 100644 --- a/modules/c/nitf/source/TRE.c +++ b/modules/c/nitf/source/TRE.c @@ -110,101 +110,6 @@ NITFAPI(void) nitf_TRE_destruct(nitf_TRE ** tre) } NITFAPI(nitf_TREHandler*) nitf_DefaultTRE_handler(nitf_Error * error); -static const nitf_TREPreloaded* findPreloadedTRE(const char* keyName) -{ - extern const nitf_TREPreloaded preloadedTREs[]; - for (size_t i = 0;; i++) - { - const char* pKeyName = preloadedTREs[i].name; - if (pKeyName == NULL) // end of list - { - return NULL; - } - if (strcmp(keyName, pKeyName) == 0) - { - return &(preloadedTREs[i]); - } - } -} - -/* - * Initialize a DSO. The init hook is retrieved and called once - * when the DSO is loaded - */ -static const char** doInit(NITF_PLUGIN_INIT_FUNCTION init, const char* prefix, nitf_Error* error) -{ - /* Else, call it */ - const char** ident = (*init)(error); - if (!ident) - { - nitf_Error_initf(error, NITF_CTXT, NITF_ERR_INVALID_OBJECT, "The plugin [%s] is not retrievable", prefix); - return NULL; - } - return ident; -} - -static NRT_BOOL preloadTRE(const char* keyName, nitf_Error* error) -{ - const char** ident; - nitf_PluginRegistry* reg = nitf_PluginRegistry_getInstance(error); - - /* Construct the DLL object */ - nitf_DLL* dll = nitf_DLL_construct(error); - if (!dll) - { - return NITF_FAILURE; - } - dll->lib = NULL; // not a real DLL - dll->dsoMain = NULL; // filled in after successful findPreloadedTRE() - - const nitf_TREPreloaded* plugin = findPreloadedTRE(keyName); - if (plugin == NULL) - { - return NITF_FAILURE; - } - dll->dsoMain = (NRT_DLL_FUNCTION_PTR)plugin->handler; - - /* Now init the plugin!!! */ - ident = doInit(plugin->init, keyName, error); - return nitf_PluginRegistry_insertPlugin_("Successfully pre-loaded plugin: [%s] at [%p]\n", reg, ident, dll, error); -} - -static nitf_TREHandler* retrievePreloadedTREHandler(nitf_PluginRegistry* reg, const char* treIdent, - int* hadError, nitf_Error* error) -{ - if (!preloadTRE(treIdent, error)) - { - *hadError = 1; - return NULL; - } - - // Successfully preloaded the TRE, it should now be in the hash table. - return nitf_PluginRegistry_retrieveTREHandler(reg, treIdent, hadError, error); -} - -static nitf_TREHandler* retrieveTREHandler(nitf_PluginRegistry* reg, const char* treIdent, - int* hadError, nitf_Error* error) -{ - nitf_TREHandler* handler = nitf_PluginRegistry_retrieveTREHandler(reg, treIdent, hadError, error); - - if (*hadError) - { - *hadError = 0; - return retrievePreloadedTREHandler(reg, treIdent, hadError, error); - } - - // Normally, a NULL handler is **not** an error. - if (handler == NULL) - { - int bad = 0; - nitf_TREHandler* preloadedHandler = retrievePreloadedTREHandler(reg, treIdent, &bad, error); - if (!bad) - return preloadedHandler; - } - - return handler; -} - NITFAPI(nitf_TRE *) nitf_TRE_construct(const char* tag, const char* id, nitf_Error * error) @@ -222,7 +127,7 @@ NITFAPI(nitf_TRE *) nitf_TRE_construct(const char* tag, if (!id || strcmp(id, NITF_TRE_RAW) != 0) { int bad = 0; - tre->handler = retrieveTREHandler(reg, tag, &bad, error); + tre->handler = nitf_PluginRegistry_retrieveTREHandler(reg, tag, &bad, error); if (bad) return NULL; } From 398c329468e5fc3d1d74eac9fa44bc6206055e93 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 13:03:19 -0500 Subject: [PATCH 15/36] remove another multiple-defined symbols --- modules/c/nitf/shared/TEST_DES.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/c/nitf/shared/TEST_DES.c b/modules/c/nitf/shared/TEST_DES.c index 424c17958..d09588ed2 100644 --- a/modules/c/nitf/shared/TEST_DES.c +++ b/modules/c/nitf/shared/TEST_DES.c @@ -87,7 +87,7 @@ NITF_PLUGIN_FUNCTION_EXPORT(const char**) TEST_DES_init(nitf_Error* error) return NULL; return TEST_DES_ident; } -NITFAPI(void) TEST_DES_cleanup(void){} +NITF_PLUGIN_FUNCTION_EXPORT(void) TEST_DES_cleanup(void){} NITF_PLUGIN_FUNCTION_EXPORT(nitf_TREHandler*) TEST_DES_handler(nitf_Error* error) { (void)error; return &TEST_DESHandler; From f5d23fbdadb29b06c7e38d4dafd5a7dc8bbddfd2 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 13:08:38 -0500 Subject: [PATCH 16/36] assume plug-in that fails is "preloaded" --- modules/c++/nitf/unittests/test_load_plugins.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/c++/nitf/unittests/test_load_plugins.cpp b/modules/c++/nitf/unittests/test_load_plugins.cpp index 0d7b617c2..4f84931dc 100644 --- a/modules/c++/nitf/unittests/test_load_plugins.cpp +++ b/modules/c++/nitf/unittests/test_load_plugins.cpp @@ -103,9 +103,10 @@ TEST_CASE(test_load_all_TREs) { nitf::PluginRegistry::loadPlugin(tre); } - catch (const nitf::NITFException& ex) + catch (const nitf::NITFException&) { - TEST_FAIL_MSG(ex.toString()); + // assume this is a pre-loaded plugin + retrieveTREHandler(testName, tre.c_str()); } #endif // _WIN32 From ff64f82e45587583b3a1cc02f104a546385cc4f1 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 13:10:12 -0500 Subject: [PATCH 17/36] remove VCXPROJ for TREs that are preloaded --- modules/c/nitf/ACCHZB.vcxproj | 113 ---------------------------------- modules/c/nitf/ACCPOB.vcxproj | 113 ---------------------------------- modules/c/nitf/ACFTA.vcxproj | 113 ---------------------------------- modules/c/nitf/AIMIDB.vcxproj | 113 ---------------------------------- modules/c/nitf/CSCRNA.vcxproj | 113 ---------------------------------- modules/c/nitf/CSEXRB.vcxproj | 113 ---------------------------------- modules/c/nitf/HISTOA.vcxproj | 113 ---------------------------------- modules/c/nitf/JITCID.vcxproj | 113 ---------------------------------- modules/c/nitf/PTPRAA.vcxproj | 113 ---------------------------------- modules/c/nitf/RPFHDR.vcxproj | 113 ---------------------------------- 10 files changed, 1130 deletions(-) delete mode 100644 modules/c/nitf/ACCHZB.vcxproj delete mode 100644 modules/c/nitf/ACCPOB.vcxproj delete mode 100644 modules/c/nitf/ACFTA.vcxproj delete mode 100644 modules/c/nitf/AIMIDB.vcxproj delete mode 100644 modules/c/nitf/CSCRNA.vcxproj delete mode 100644 modules/c/nitf/CSEXRB.vcxproj delete mode 100644 modules/c/nitf/HISTOA.vcxproj delete mode 100644 modules/c/nitf/JITCID.vcxproj delete mode 100644 modules/c/nitf/PTPRAA.vcxproj delete mode 100644 modules/c/nitf/RPFHDR.vcxproj diff --git a/modules/c/nitf/ACCHZB.vcxproj b/modules/c/nitf/ACCHZB.vcxproj deleted file mode 100644 index f42acd267..000000000 --- a/modules/c/nitf/ACCHZB.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {53F9F908-C678-4DEE-9309-E71C1D03A45F} - nitro - 10.0 - ACCHZB - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/ACCPOB.vcxproj b/modules/c/nitf/ACCPOB.vcxproj deleted file mode 100644 index b668d9318..000000000 --- a/modules/c/nitf/ACCPOB.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {730B1E6E-2469-4F9E-B093-D0C6262453C9} - nitro - 10.0 - ACCPOB - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/ACFTA.vcxproj b/modules/c/nitf/ACFTA.vcxproj deleted file mode 100644 index e3c2731ad..000000000 --- a/modules/c/nitf/ACFTA.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {51D7B426-899E-428D-9F69-5DDAC9E403FB} - nitro - 10.0 - ACFTA - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/AIMIDB.vcxproj b/modules/c/nitf/AIMIDB.vcxproj deleted file mode 100644 index 2811c37bd..000000000 --- a/modules/c/nitf/AIMIDB.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343} - nitro - 10.0 - AIMIDB - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/CSCRNA.vcxproj b/modules/c/nitf/CSCRNA.vcxproj deleted file mode 100644 index 06e6dc8a0..000000000 --- a/modules/c/nitf/CSCRNA.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {023DE06D-3967-4406-B1B8-032118BB2552} - nitro - 10.0 - CSCRNA - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/CSEXRB.vcxproj b/modules/c/nitf/CSEXRB.vcxproj deleted file mode 100644 index 961b372ba..000000000 --- a/modules/c/nitf/CSEXRB.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E} - nitro - 10.0 - CSEXRB - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/HISTOA.vcxproj b/modules/c/nitf/HISTOA.vcxproj deleted file mode 100644 index 4341dcc23..000000000 --- a/modules/c/nitf/HISTOA.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {D749AA73-4C9A-473D-96BB-070A6D9CAA54} - nitro - 10.0 - HISTOA - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/JITCID.vcxproj b/modules/c/nitf/JITCID.vcxproj deleted file mode 100644 index c7ac658a0..000000000 --- a/modules/c/nitf/JITCID.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {D1D7FCD3-6130-4504-9DA0-9D80506BE55E} - nitro - 10.0 - JITCID - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/PTPRAA.vcxproj b/modules/c/nitf/PTPRAA.vcxproj deleted file mode 100644 index 91822c7d1..000000000 --- a/modules/c/nitf/PTPRAA.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {2BAAACA9-A5A4-412C-AE52-B16C2D107F55} - nitro - 10.0 - PTPRAA - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/RPFHDR.vcxproj b/modules/c/nitf/RPFHDR.vcxproj deleted file mode 100644 index 947f2c56f..000000000 --- a/modules/c/nitf/RPFHDR.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {CF5B4F02-364D-4117-9FB9-6C9C7938E412} - nitro - 10.0 - RPFHDR - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file From fd6829c7fb1d87ebf5176c48e22d8b3aa7adc7e6 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 13:37:22 -0500 Subject: [PATCH 18/36] don't preload ANY TREs to preserve existing behavior --- modules/c/nitf/ACCHZB.vcxproj | 113 ++++++++++++++++++++++++++++++++++ modules/c/nitf/ACCPOB.vcxproj | 113 ++++++++++++++++++++++++++++++++++ modules/c/nitf/ACFTA.vcxproj | 113 ++++++++++++++++++++++++++++++++++ modules/c/nitf/AIMIDB.vcxproj | 113 ++++++++++++++++++++++++++++++++++ modules/c/nitf/CSCRNA.vcxproj | 113 ++++++++++++++++++++++++++++++++++ modules/c/nitf/CSEXRB.vcxproj | 113 ++++++++++++++++++++++++++++++++++ modules/c/nitf/HISTOA.vcxproj | 113 ++++++++++++++++++++++++++++++++++ modules/c/nitf/JITCID.vcxproj | 113 ++++++++++++++++++++++++++++++++++ modules/c/nitf/PTPRAA.vcxproj | 113 ++++++++++++++++++++++++++++++++++ modules/c/nitf/RPFHDR.vcxproj | 113 ++++++++++++++++++++++++++++++++++ modules/c/nitf/source/TREs.c | 3 +- nitro.sln | 82 ++++++++++++++++++++++-- 12 files changed, 1208 insertions(+), 7 deletions(-) create mode 100644 modules/c/nitf/ACCHZB.vcxproj create mode 100644 modules/c/nitf/ACCPOB.vcxproj create mode 100644 modules/c/nitf/ACFTA.vcxproj create mode 100644 modules/c/nitf/AIMIDB.vcxproj create mode 100644 modules/c/nitf/CSCRNA.vcxproj create mode 100644 modules/c/nitf/CSEXRB.vcxproj create mode 100644 modules/c/nitf/HISTOA.vcxproj create mode 100644 modules/c/nitf/JITCID.vcxproj create mode 100644 modules/c/nitf/PTPRAA.vcxproj create mode 100644 modules/c/nitf/RPFHDR.vcxproj diff --git a/modules/c/nitf/ACCHZB.vcxproj b/modules/c/nitf/ACCHZB.vcxproj new file mode 100644 index 000000000..f42acd267 --- /dev/null +++ b/modules/c/nitf/ACCHZB.vcxproj @@ -0,0 +1,113 @@ + + + + + Debug + x64 + + + Release + x64 + + + + + + + + {f06550ad-cfc7-40b8-8727-6c82c69a8982} + + + + 16.0 + Win32Proj + {53F9F908-C678-4DEE-9309-E71C1D03A45F} + nitro + 10.0 + ACCHZB + + + + DynamicLibrary + true + v143 + + + DynamicLibrary + false + v143 + true + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + EnableAllWarnings + true + _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + MultiThreadedDebugDLL + true + ProgramDatabase + AdvancedVectorExtensions2 + true + + + + + true + + + + + Level3 + true + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + true + AdvancedVectorExtensions2 + + + + + true + true + true + + + + + + \ No newline at end of file diff --git a/modules/c/nitf/ACCPOB.vcxproj b/modules/c/nitf/ACCPOB.vcxproj new file mode 100644 index 000000000..b668d9318 --- /dev/null +++ b/modules/c/nitf/ACCPOB.vcxproj @@ -0,0 +1,113 @@ + + + + + Debug + x64 + + + Release + x64 + + + + + + + + {f06550ad-cfc7-40b8-8727-6c82c69a8982} + + + + 16.0 + Win32Proj + {730B1E6E-2469-4F9E-B093-D0C6262453C9} + nitro + 10.0 + ACCPOB + + + + DynamicLibrary + true + v143 + + + DynamicLibrary + false + v143 + true + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + EnableAllWarnings + true + _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + MultiThreadedDebugDLL + true + ProgramDatabase + AdvancedVectorExtensions2 + true + + + + + true + + + + + Level3 + true + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + true + AdvancedVectorExtensions2 + + + + + true + true + true + + + + + + \ No newline at end of file diff --git a/modules/c/nitf/ACFTA.vcxproj b/modules/c/nitf/ACFTA.vcxproj new file mode 100644 index 000000000..e3c2731ad --- /dev/null +++ b/modules/c/nitf/ACFTA.vcxproj @@ -0,0 +1,113 @@ + + + + + Debug + x64 + + + Release + x64 + + + + + + + + {f06550ad-cfc7-40b8-8727-6c82c69a8982} + + + + 16.0 + Win32Proj + {51D7B426-899E-428D-9F69-5DDAC9E403FB} + nitro + 10.0 + ACFTA + + + + DynamicLibrary + true + v143 + + + DynamicLibrary + false + v143 + true + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + EnableAllWarnings + true + _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + MultiThreadedDebugDLL + true + ProgramDatabase + AdvancedVectorExtensions2 + true + + + + + true + + + + + Level3 + true + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + true + AdvancedVectorExtensions2 + + + + + true + true + true + + + + + + \ No newline at end of file diff --git a/modules/c/nitf/AIMIDB.vcxproj b/modules/c/nitf/AIMIDB.vcxproj new file mode 100644 index 000000000..2811c37bd --- /dev/null +++ b/modules/c/nitf/AIMIDB.vcxproj @@ -0,0 +1,113 @@ + + + + + Debug + x64 + + + Release + x64 + + + + + + + + {f06550ad-cfc7-40b8-8727-6c82c69a8982} + + + + 16.0 + Win32Proj + {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343} + nitro + 10.0 + AIMIDB + + + + DynamicLibrary + true + v143 + + + DynamicLibrary + false + v143 + true + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + EnableAllWarnings + true + _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + MultiThreadedDebugDLL + true + ProgramDatabase + AdvancedVectorExtensions2 + true + + + + + true + + + + + Level3 + true + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + true + AdvancedVectorExtensions2 + + + + + true + true + true + + + + + + \ No newline at end of file diff --git a/modules/c/nitf/CSCRNA.vcxproj b/modules/c/nitf/CSCRNA.vcxproj new file mode 100644 index 000000000..06e6dc8a0 --- /dev/null +++ b/modules/c/nitf/CSCRNA.vcxproj @@ -0,0 +1,113 @@ + + + + + Debug + x64 + + + Release + x64 + + + + + + + + {f06550ad-cfc7-40b8-8727-6c82c69a8982} + + + + 16.0 + Win32Proj + {023DE06D-3967-4406-B1B8-032118BB2552} + nitro + 10.0 + CSCRNA + + + + DynamicLibrary + true + v143 + + + DynamicLibrary + false + v143 + true + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + EnableAllWarnings + true + _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + MultiThreadedDebugDLL + true + ProgramDatabase + AdvancedVectorExtensions2 + true + + + + + true + + + + + Level3 + true + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + true + AdvancedVectorExtensions2 + + + + + true + true + true + + + + + + \ No newline at end of file diff --git a/modules/c/nitf/CSEXRB.vcxproj b/modules/c/nitf/CSEXRB.vcxproj new file mode 100644 index 000000000..961b372ba --- /dev/null +++ b/modules/c/nitf/CSEXRB.vcxproj @@ -0,0 +1,113 @@ + + + + + Debug + x64 + + + Release + x64 + + + + + + + + {f06550ad-cfc7-40b8-8727-6c82c69a8982} + + + + 16.0 + Win32Proj + {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E} + nitro + 10.0 + CSEXRB + + + + DynamicLibrary + true + v143 + + + DynamicLibrary + false + v143 + true + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + EnableAllWarnings + true + _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + MultiThreadedDebugDLL + true + ProgramDatabase + AdvancedVectorExtensions2 + true + + + + + true + + + + + Level3 + true + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + true + AdvancedVectorExtensions2 + + + + + true + true + true + + + + + + \ No newline at end of file diff --git a/modules/c/nitf/HISTOA.vcxproj b/modules/c/nitf/HISTOA.vcxproj new file mode 100644 index 000000000..4341dcc23 --- /dev/null +++ b/modules/c/nitf/HISTOA.vcxproj @@ -0,0 +1,113 @@ + + + + + Debug + x64 + + + Release + x64 + + + + + + + + {f06550ad-cfc7-40b8-8727-6c82c69a8982} + + + + 16.0 + Win32Proj + {D749AA73-4C9A-473D-96BB-070A6D9CAA54} + nitro + 10.0 + HISTOA + + + + DynamicLibrary + true + v143 + + + DynamicLibrary + false + v143 + true + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + EnableAllWarnings + true + _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + MultiThreadedDebugDLL + true + ProgramDatabase + AdvancedVectorExtensions2 + true + + + + + true + + + + + Level3 + true + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + true + AdvancedVectorExtensions2 + + + + + true + true + true + + + + + + \ No newline at end of file diff --git a/modules/c/nitf/JITCID.vcxproj b/modules/c/nitf/JITCID.vcxproj new file mode 100644 index 000000000..c7ac658a0 --- /dev/null +++ b/modules/c/nitf/JITCID.vcxproj @@ -0,0 +1,113 @@ + + + + + Debug + x64 + + + Release + x64 + + + + + + + + {f06550ad-cfc7-40b8-8727-6c82c69a8982} + + + + 16.0 + Win32Proj + {D1D7FCD3-6130-4504-9DA0-9D80506BE55E} + nitro + 10.0 + JITCID + + + + DynamicLibrary + true + v143 + + + DynamicLibrary + false + v143 + true + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + EnableAllWarnings + true + _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + MultiThreadedDebugDLL + true + ProgramDatabase + AdvancedVectorExtensions2 + true + + + + + true + + + + + Level3 + true + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + true + AdvancedVectorExtensions2 + + + + + true + true + true + + + + + + \ No newline at end of file diff --git a/modules/c/nitf/PTPRAA.vcxproj b/modules/c/nitf/PTPRAA.vcxproj new file mode 100644 index 000000000..91822c7d1 --- /dev/null +++ b/modules/c/nitf/PTPRAA.vcxproj @@ -0,0 +1,113 @@ + + + + + Debug + x64 + + + Release + x64 + + + + + + + + {f06550ad-cfc7-40b8-8727-6c82c69a8982} + + + + 16.0 + Win32Proj + {2BAAACA9-A5A4-412C-AE52-B16C2D107F55} + nitro + 10.0 + PTPRAA + + + + DynamicLibrary + true + v143 + + + DynamicLibrary + false + v143 + true + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + EnableAllWarnings + true + _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + MultiThreadedDebugDLL + true + ProgramDatabase + AdvancedVectorExtensions2 + true + + + + + true + + + + + Level3 + true + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + true + AdvancedVectorExtensions2 + + + + + true + true + true + + + + + + \ No newline at end of file diff --git a/modules/c/nitf/RPFHDR.vcxproj b/modules/c/nitf/RPFHDR.vcxproj new file mode 100644 index 000000000..947f2c56f --- /dev/null +++ b/modules/c/nitf/RPFHDR.vcxproj @@ -0,0 +1,113 @@ + + + + + Debug + x64 + + + Release + x64 + + + + + + + + {f06550ad-cfc7-40b8-8727-6c82c69a8982} + + + + 16.0 + Win32Proj + {CF5B4F02-364D-4117-9FB9-6C9C7938E412} + nitro + 10.0 + RPFHDR + + + + DynamicLibrary + true + v143 + + + DynamicLibrary + false + v143 + true + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + EnableAllWarnings + true + _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + MultiThreadedDebugDLL + true + ProgramDatabase + AdvancedVectorExtensions2 + true + + + + + true + + + + + Level3 + true + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + true + AdvancedVectorExtensions2 + + + + + true + true + true + + + + + + \ No newline at end of file diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index c07d007ba..8cedb44e5 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -48,6 +48,7 @@ extern const nitf_TREPreloaded preloadedTREs[]; const nitf_TREPreloaded preloadedTREs[] = { +/* NITF_preload_TRE(ACCHZB), NITF_preload_TRE(ACCPOB), NITF_preload_TRE(ACFTA), @@ -61,6 +62,6 @@ const nitf_TREPreloaded preloadedTREs[] = { NITF_preload_TRE(RPFHDR), NITF_preload_TRE(TEST_DES), - +*/ { NULL, NULL, NULL } }; diff --git a/nitro.sln b/nitro.sln index 1e45b2f56..56cfb2e04 100644 --- a/nitro.sln +++ b/nitro.sln @@ -20,10 +20,26 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nitf-c++", "modules\c++\nit {A676EDF3-F231-47C8-A6E6-0FE50B50B71B} = {A676EDF3-F231-47C8-A6E6-0FE50B50B71B} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACCPOB", "modules\c\nitf\ACCPOB.vcxproj", "{730B1E6E-2469-4F9E-B093-D0C6262453C9}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACFTA", "modules\c\nitf\ACFTA.vcxproj", "{51D7B426-899E-428D-9F69-5DDAC9E403FB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AIMIDB", "modules\c\nitf\AIMIDB.vcxproj", "{12AA0752-4EE3-4E0A-85AF-0E5DEADBF343}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JITCID", "modules\c\nitf\JITCID.vcxproj", "{D1D7FCD3-6130-4504-9DA0-9D80506BE55E}" +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "c-nitf-shared", "c-nitf-shared", "{27A2685A-E869-42A2-956D-92994F60C536}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSCRNA", "modules\c\nitf\CSCRNA.vcxproj", "{023DE06D-3967-4406-B1B8-032118BB2552}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RPFHDR", "modules\c\nitf\RPFHDR.vcxproj", "{CF5B4F02-364D-4117-9FB9-6C9C7938E412}" +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "show_nitf++", "modules\c++\nitf\apps\show_nitf++\show_nitf++.vcxproj", "{839FF52C-57D1-45B6-81FD-5C7D72523EE5}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PTPRAA", "modules\c\nitf\PTPRAA.vcxproj", "{2BAAACA9-A5A4-412C-AE52-B16C2D107F55}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ENGRDA", "modules\c\nitf\ENGRDA.vcxproj", "{53F9F908-C678-4DEE-9309-E71C1E03A45F}" +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "J2KCompress", "modules\c\j2k\J2KCompress.vcxproj", "{A676EDF3-F231-47C8-A6E6-0FE50B50B71B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "J2KDecompress", "modules\c\j2k\J2KDecompress.vcxproj", "{C787537A-0CAC-4D6D-A6D6-A66765A06753}" @@ -35,13 +51,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github-workflows", ".githu .github\workflows\main.yml = .github\workflows\main.yml EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSEXRB", "modules\c\nitf\CSEXRB.vcxproj", "{0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E}" +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "externals", "externals", "{7D26D571-0014-4C50-BF86-612E743E64B6}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "coda-oss", "externals\coda-oss\modules\c++\coda-oss.vcxproj", "{9997E895-5161-4DDF-8F3F-099894CB2F21}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest", "UnitTest\UnitTest.vcxproj", "{8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ENGRDA", "modules\c\nitf\ENGRDA.vcxproj", "{53F9F908-C678-4DEE-9309-E71C1E03A45F}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACCHZB", "modules\c\nitf\ACCHZB.vcxproj", "{53F9F908-C678-4DEE-9309-E71C1D03A45F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HISTOA", "modules\c\nitf\HISTOA.vcxproj", "{D749AA73-4C9A-473D-96BB-070A6D9CAA54}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XML_DATA_CONTENT", "modules\c\nitf\XML_DATA_CONTENT.vcxproj", "{78849481-D356-4CC7-B182-31C21F857ED1}" EndProject @@ -59,10 +79,42 @@ Global {8F357A19-799E-4971-850E-3F28485C130B}.Debug|x64.Build.0 = Debug|x64 {8F357A19-799E-4971-850E-3F28485C130B}.Release|x64.ActiveCfg = Release|x64 {8F357A19-799E-4971-850E-3F28485C130B}.Release|x64.Build.0 = Release|x64 + {730B1E6E-2469-4F9E-B093-D0C6262453C9}.Debug|x64.ActiveCfg = Debug|x64 + {730B1E6E-2469-4F9E-B093-D0C6262453C9}.Debug|x64.Build.0 = Debug|x64 + {730B1E6E-2469-4F9E-B093-D0C6262453C9}.Release|x64.ActiveCfg = Release|x64 + {730B1E6E-2469-4F9E-B093-D0C6262453C9}.Release|x64.Build.0 = Release|x64 + {51D7B426-899E-428D-9F69-5DDAC9E403FB}.Debug|x64.ActiveCfg = Debug|x64 + {51D7B426-899E-428D-9F69-5DDAC9E403FB}.Debug|x64.Build.0 = Debug|x64 + {51D7B426-899E-428D-9F69-5DDAC9E403FB}.Release|x64.ActiveCfg = Release|x64 + {51D7B426-899E-428D-9F69-5DDAC9E403FB}.Release|x64.Build.0 = Release|x64 + {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343}.Debug|x64.ActiveCfg = Debug|x64 + {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343}.Debug|x64.Build.0 = Debug|x64 + {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343}.Release|x64.ActiveCfg = Release|x64 + {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343}.Release|x64.Build.0 = Release|x64 + {D1D7FCD3-6130-4504-9DA0-9D80506BE55E}.Debug|x64.ActiveCfg = Debug|x64 + {D1D7FCD3-6130-4504-9DA0-9D80506BE55E}.Debug|x64.Build.0 = Debug|x64 + {D1D7FCD3-6130-4504-9DA0-9D80506BE55E}.Release|x64.ActiveCfg = Release|x64 + {D1D7FCD3-6130-4504-9DA0-9D80506BE55E}.Release|x64.Build.0 = Release|x64 + {023DE06D-3967-4406-B1B8-032118BB2552}.Debug|x64.ActiveCfg = Debug|x64 + {023DE06D-3967-4406-B1B8-032118BB2552}.Debug|x64.Build.0 = Debug|x64 + {023DE06D-3967-4406-B1B8-032118BB2552}.Release|x64.ActiveCfg = Release|x64 + {023DE06D-3967-4406-B1B8-032118BB2552}.Release|x64.Build.0 = Release|x64 + {CF5B4F02-364D-4117-9FB9-6C9C7938E412}.Debug|x64.ActiveCfg = Debug|x64 + {CF5B4F02-364D-4117-9FB9-6C9C7938E412}.Debug|x64.Build.0 = Debug|x64 + {CF5B4F02-364D-4117-9FB9-6C9C7938E412}.Release|x64.ActiveCfg = Release|x64 + {CF5B4F02-364D-4117-9FB9-6C9C7938E412}.Release|x64.Build.0 = Release|x64 {839FF52C-57D1-45B6-81FD-5C7D72523EE5}.Debug|x64.ActiveCfg = Debug|x64 {839FF52C-57D1-45B6-81FD-5C7D72523EE5}.Debug|x64.Build.0 = Debug|x64 {839FF52C-57D1-45B6-81FD-5C7D72523EE5}.Release|x64.ActiveCfg = Release|x64 {839FF52C-57D1-45B6-81FD-5C7D72523EE5}.Release|x64.Build.0 = Release|x64 + {2BAAACA9-A5A4-412C-AE52-B16C2D107F55}.Debug|x64.ActiveCfg = Debug|x64 + {2BAAACA9-A5A4-412C-AE52-B16C2D107F55}.Debug|x64.Build.0 = Debug|x64 + {2BAAACA9-A5A4-412C-AE52-B16C2D107F55}.Release|x64.ActiveCfg = Release|x64 + {2BAAACA9-A5A4-412C-AE52-B16C2D107F55}.Release|x64.Build.0 = Release|x64 + {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Debug|x64.ActiveCfg = Debug|x64 + {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Debug|x64.Build.0 = Debug|x64 + {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Release|x64.ActiveCfg = Release|x64 + {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Release|x64.Build.0 = Release|x64 {A676EDF3-F231-47C8-A6E6-0FE50B50B71B}.Debug|x64.ActiveCfg = Debug|x64 {A676EDF3-F231-47C8-A6E6-0FE50B50B71B}.Debug|x64.Build.0 = Debug|x64 {A676EDF3-F231-47C8-A6E6-0FE50B50B71B}.Release|x64.ActiveCfg = Release|x64 @@ -71,6 +123,10 @@ Global {C787537A-0CAC-4D6D-A6D6-A66765A06753}.Debug|x64.Build.0 = Debug|x64 {C787537A-0CAC-4D6D-A6D6-A66765A06753}.Release|x64.ActiveCfg = Release|x64 {C787537A-0CAC-4D6D-A6D6-A66765A06753}.Release|x64.Build.0 = Release|x64 + {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E}.Debug|x64.ActiveCfg = Debug|x64 + {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E}.Debug|x64.Build.0 = Debug|x64 + {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E}.Release|x64.ActiveCfg = Release|x64 + {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E}.Release|x64.Build.0 = Release|x64 {9997E895-5161-4DDF-8F3F-099894CB2F21}.Debug|x64.ActiveCfg = Debug|x64 {9997E895-5161-4DDF-8F3F-099894CB2F21}.Debug|x64.Build.0 = Debug|x64 {9997E895-5161-4DDF-8F3F-099894CB2F21}.Release|x64.ActiveCfg = Release|x64 @@ -79,10 +135,14 @@ Global {8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}.Debug|x64.Build.0 = Debug|x64 {8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}.Release|x64.ActiveCfg = Release|x64 {8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}.Release|x64.Build.0 = Release|x64 - {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Debug|x64.ActiveCfg = Debug|x64 - {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Debug|x64.Build.0 = Debug|x64 - {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Release|x64.ActiveCfg = Release|x64 - {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Release|x64.Build.0 = Release|x64 + {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Debug|x64.ActiveCfg = Debug|x64 + {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Debug|x64.Build.0 = Debug|x64 + {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Release|x64.ActiveCfg = Release|x64 + {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Release|x64.Build.0 = Release|x64 + {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Debug|x64.ActiveCfg = Debug|x64 + {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Debug|x64.Build.0 = Debug|x64 + {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Release|x64.ActiveCfg = Release|x64 + {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Release|x64.Build.0 = Release|x64 {78849481-D356-4CC7-B182-31C21F857ED1}.Debug|x64.ActiveCfg = Debug|x64 {78849481-D356-4CC7-B182-31C21F857ED1}.Debug|x64.Build.0 = Debug|x64 {78849481-D356-4CC7-B182-31C21F857ED1}.Release|x64.ActiveCfg = Release|x64 @@ -92,11 +152,21 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution + {730B1E6E-2469-4F9E-B093-D0C6262453C9} = {27A2685A-E869-42A2-956D-92994F60C536} + {51D7B426-899E-428D-9F69-5DDAC9E403FB} = {27A2685A-E869-42A2-956D-92994F60C536} + {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343} = {27A2685A-E869-42A2-956D-92994F60C536} + {D1D7FCD3-6130-4504-9DA0-9D80506BE55E} = {27A2685A-E869-42A2-956D-92994F60C536} + {023DE06D-3967-4406-B1B8-032118BB2552} = {27A2685A-E869-42A2-956D-92994F60C536} + {CF5B4F02-364D-4117-9FB9-6C9C7938E412} = {27A2685A-E869-42A2-956D-92994F60C536} + {2BAAACA9-A5A4-412C-AE52-B16C2D107F55} = {27A2685A-E869-42A2-956D-92994F60C536} + {53F9F908-C678-4DEE-9309-E71C1E03A45F} = {27A2685A-E869-42A2-956D-92994F60C536} {A676EDF3-F231-47C8-A6E6-0FE50B50B71B} = {27A2685A-E869-42A2-956D-92994F60C536} {C787537A-0CAC-4D6D-A6D6-A66765A06753} = {27A2685A-E869-42A2-956D-92994F60C536} {A45CB073-25A7-411D-A7E7-589BCC8AF547} = {5C5727E7-0CFF-42B4-8F5A-D31B3BC81F21} + {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E} = {27A2685A-E869-42A2-956D-92994F60C536} {9997E895-5161-4DDF-8F3F-099894CB2F21} = {7D26D571-0014-4C50-BF86-612E743E64B6} - {53F9F908-C678-4DEE-9309-E71C1E03A45F} = {27A2685A-E869-42A2-956D-92994F60C536} + {53F9F908-C678-4DEE-9309-E71C1D03A45F} = {27A2685A-E869-42A2-956D-92994F60C536} + {D749AA73-4C9A-473D-96BB-070A6D9CAA54} = {27A2685A-E869-42A2-956D-92994F60C536} {78849481-D356-4CC7-B182-31C21F857ED1} = {27A2685A-E869-42A2-956D-92994F60C536} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution From 49dfc908ad0a31aa6a43b9c60e8335f2b0eedbd6 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 13:50:20 -0500 Subject: [PATCH 19/36] be sure all nrt_DLL fields are initialized --- modules/c/nrt/source/DLLUnix.c | 1 + modules/c/nrt/source/DLLWin32.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/c/nrt/source/DLLUnix.c b/modules/c/nrt/source/DLLUnix.c index 40c3a4215..fb68470cc 100644 --- a/modules/c/nrt/source/DLLUnix.c +++ b/modules/c/nrt/source/DLLUnix.c @@ -39,6 +39,7 @@ NRTAPI(nrt_DLL *) nrt_DLL_construct(nrt_Error * error) } dll->libname = NULL; dll->lib = NULL; + dll->dsoMain = NULL; return dll; } diff --git a/modules/c/nrt/source/DLLWin32.c b/modules/c/nrt/source/DLLWin32.c index a202d99f1..d5a59e621 100644 --- a/modules/c/nrt/source/DLLWin32.c +++ b/modules/c/nrt/source/DLLWin32.c @@ -37,6 +37,7 @@ NRTAPI(nrt_DLL *) nrt_DLL_construct(nrt_Error * error) { dll->libname = NULL; dll->lib = NULL; + dll->dsoMain = NULL; } return dll; } @@ -62,7 +63,7 @@ NRTAPI(void) nrt_DLL_destruct(nrt_DLL ** dll) NRTAPI(NRT_BOOL) nrt_DLL_isValid(nrt_DLL * dll) { - return (dll->lib != (NRT_NATIVE_DLL) NULL); + return (dll->lib != NULL) && (dll->dsoMain == NULL); } NRTAPI(NRT_BOOL) nrt_DLL_load(nrt_DLL * dll, const char *libname, From f9aaa5fcd337a44a5fa45d82a06bc1e595e3614a Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 13 Nov 2023 14:13:35 -0500 Subject: [PATCH 20/36] revert whitespace changes --- modules/c/nitf/source/TRE.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/c/nitf/source/TRE.c b/modules/c/nitf/source/TRE.c index ffcc123f1..154f9acc2 100644 --- a/modules/c/nitf/source/TRE.c +++ b/modules/c/nitf/source/TRE.c @@ -110,6 +110,7 @@ NITFAPI(void) nitf_TRE_destruct(nitf_TRE ** tre) } NITFAPI(nitf_TREHandler*) nitf_DefaultTRE_handler(nitf_Error * error); + NITFAPI(nitf_TRE *) nitf_TRE_construct(const char* tag, const char* id, nitf_Error * error) @@ -127,7 +128,9 @@ NITFAPI(nitf_TRE *) nitf_TRE_construct(const char* tag, if (!id || strcmp(id, NITF_TRE_RAW) != 0) { int bad = 0; - tre->handler = nitf_PluginRegistry_retrieveTREHandler(reg, tag, &bad, error); + tre->handler = + nitf_PluginRegistry_retrieveTREHandler(reg, tag, &bad, error); + if (bad) return NULL; } From fd4f65db407f7fae1e2584dfe189733f28ec5595 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 14 Nov 2023 14:12:09 -0500 Subject: [PATCH 21/36] added a preloaded TEST_PRELOADED_DES TRE --- modules/c/nitf/source/TREs.c | 68 ++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 3 deletions(-) diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index 8cedb44e5..76882165e 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -42,12 +42,73 @@ #include "../shared/PTPRAA.c" #include "../shared/RPFHDR.c" -#include "../shared/TEST_DES.c" + /******************************************************************************/ + /* + * Simple example DES for testing. + + This file defines a very simple Data Extension Segment. This example is + used for test of the UserSegment object and can be used aa an example + and starting point for the development of DES. + + This example defines a "standard" DE segment which means the user + header can be implemented via a TRE object and there are no out of + segment dependencies + + The DES ID will be TEST_PRELOADED_DES + + The user header will have three fields + + NITF_TEST_PRELOADED_DES_COUNT - Number of data values + NITF_TEST_PRELOADED_DES_START - Start value in ramp + NITF_TEST_PRELOADED_DES_INCREMENT - Increment between values in ramp + + The data is an 8-bit ramp defined by the three values. in testing, the + ramp will be setup to contain printable values. + */ + + /* TRE description for user header */ + +static nitf_TREDescription TEST_PRELOADED_DES_description[] = { + {NITF_BCS_N, 2, "Number of data values", "TEST_PRELOADED_DES_COUNT" }, + {NITF_BCS_N, 3, "Start value in ramp", "TEST_PRELOADED_DES_START" }, + {NITF_BCS_N, 2, "Increment between values in ramp", "TEST_PRELOADED_DES_INCREMENT" }, + {NITF_END, 0, NULL, NULL} +}; + +static const char* TEST_PRELOADED_DES_ident[] = +{ + NITF_PLUGIN_TRE_KEY, "TEST Preloaded DES", "TEST_PRELOADED_DES", NULL +}; + +static nitf_TREDescriptionInfo TEST_PRELOADED_DES_descriptions[] = { + { "TEST Preloaded DES", TEST_PRELOADED_DES_description, NITF_TRE_DESC_NO_LENGTH }, + { "TEST_PRELOADED_DES", TEST_PRELOADED_DES_description, NITF_TRE_DESC_NO_LENGTH }, + { NULL, NULL, NITF_TRE_DESC_NO_LENGTH } +}; + +static nitf_TREDescriptionSet TEST_PRELOADED_DES_descriptionSet = { 0, TEST_PRELOADED_DES_descriptions }; + +static nitf_TREHandler TEST_PRELOADED_DESHandler; +static const char** TEST_PRELOADED_DES_init(nitf_Error* error) +{ + if (!nitf_TREUtils_createBasicHandler(&TEST_PRELOADED_DES_descriptionSet, + &TEST_PRELOADED_DESHandler, error)) + return NULL; + return TEST_PRELOADED_DES_ident; +} +static nitf_TREHandler* TEST_PRELOADED_DES_handler(nitf_Error*) { + return &TEST_PRELOADED_DESHandler; +} + +/******************************************************************************/ #define NITF_preload_TRE(Tre_) { #Tre_, Tre_##_init, Tre_##_handler } extern const nitf_TREPreloaded preloadedTREs[]; const nitf_TREPreloaded preloadedTREs[] = { + // Not preloading any TREs right now: with the existing system, + // a TRE can be removed by deleting the DLL/SO. If that same TRE + // were preloaded, there would be no way to get rid of it. /* NITF_preload_TRE(ACCHZB), NITF_preload_TRE(ACCPOB), @@ -60,8 +121,9 @@ const nitf_TREPreloaded preloadedTREs[] = { NITF_preload_TRE(JITCID), NITF_preload_TRE(PTPRAA), NITF_preload_TRE(RPFHDR), - - NITF_preload_TRE(TEST_DES), */ + + NITF_preload_TRE(TEST_PRELOADED_DES), + { NULL, NULL, NULL } }; From 9cda2faa5c1d71a8ebdf35c82b78eabdda231ade Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 14 Nov 2023 14:35:49 -0500 Subject: [PATCH 22/36] the TRE id could have underscores in it, so search from the end. --- modules/c++/nitf/unittests/test_tre_mods++.cpp | 14 ++++++++++++++ modules/c/nitf/source/TREs.c | 15 ++++++--------- modules/c/nrt/source/DLLUnix.c | 2 +- modules/c/nrt/source/DLLWin32.c | 2 +- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/modules/c++/nitf/unittests/test_tre_mods++.cpp b/modules/c++/nitf/unittests/test_tre_mods++.cpp index 1c2b4a870..21ca387f4 100644 --- a/modules/c++/nitf/unittests/test_tre_mods++.cpp +++ b/modules/c++/nitf/unittests/test_tre_mods++.cpp @@ -227,6 +227,19 @@ TEST_CASE(basicIteration) TEST_ASSERT_EQ(numFields, static_cast(29)); } +TEST_CASE(use_TEST_PRELOADED_DES) +{ + nitf::TRE des("TEST_PRELOADED_DES", "TEST_PRELOADED_DES"); + + des.setField("TEST_PRELOADED_DES_COUNT", 12); + des.setField("TEST_PRELOADED_DES_START", 345); + des.setField("TEST_PRELOADED_DES_INCREMENT", 67); + + TEST_ASSERT_EQ(des.getFieldValue("TEST_PRELOADED_DES_COUNT"), 12); + TEST_ASSERT_EQ(des.getFieldValue("TEST_PRELOADED_DES_START"), 345); + TEST_ASSERT_EQ(des.getFieldValue("TEST_PRELOADED_DES_INCREMENT"), 67); +} + TEST_CASE(use_ENGRDA) { nitf::TRE engrda("ENGRDA", "ENGRDA"); @@ -404,6 +417,7 @@ TEST_MAIN( TEST_CHECK(setBinaryFields); TEST_CHECK(cloneTRE); TEST_CHECK(basicIteration); + TEST_CHECK(use_TEST_PRELOADED_DES); TEST_CHECK(use_ENGRDA); TEST_CHECK(use_ENGRDA_typed_fields); TEST_CHECK(use_typed_ENGRDA); diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index 76882165e..037014e6a 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -67,27 +67,24 @@ */ /* TRE description for user header */ - static nitf_TREDescription TEST_PRELOADED_DES_description[] = { {NITF_BCS_N, 2, "Number of data values", "TEST_PRELOADED_DES_COUNT" }, {NITF_BCS_N, 3, "Start value in ramp", "TEST_PRELOADED_DES_START" }, {NITF_BCS_N, 2, "Increment between values in ramp", "TEST_PRELOADED_DES_INCREMENT" }, {NITF_END, 0, NULL, NULL} }; - -static const char* TEST_PRELOADED_DES_ident[] = -{ - NITF_PLUGIN_TRE_KEY, "TEST Preloaded DES", "TEST_PRELOADED_DES", NULL -}; - static nitf_TREDescriptionInfo TEST_PRELOADED_DES_descriptions[] = { - { "TEST Preloaded DES", TEST_PRELOADED_DES_description, NITF_TRE_DESC_NO_LENGTH }, + { "Preloaded DES (for testing)", TEST_PRELOADED_DES_description, NITF_TRE_DESC_NO_LENGTH }, { "TEST_PRELOADED_DES", TEST_PRELOADED_DES_description, NITF_TRE_DESC_NO_LENGTH }, { NULL, NULL, NITF_TRE_DESC_NO_LENGTH } }; - static nitf_TREDescriptionSet TEST_PRELOADED_DES_descriptionSet = { 0, TEST_PRELOADED_DES_descriptions }; +static const char* TEST_PRELOADED_DES_ident[] = +{ + NITF_PLUGIN_TRE_KEY, "TEST_PRELOADED_DES", "Preloaded DES (for testing)", NULL +}; + static nitf_TREHandler TEST_PRELOADED_DESHandler; static const char** TEST_PRELOADED_DES_init(nitf_Error* error) { diff --git a/modules/c/nrt/source/DLLUnix.c b/modules/c/nrt/source/DLLUnix.c index fb68470cc..d1887e1af 100644 --- a/modules/c/nrt/source/DLLUnix.c +++ b/modules/c/nrt/source/DLLUnix.c @@ -127,7 +127,7 @@ NRTAPI(NRT_DLL_FUNCTION_PTR) nrt_DLL_retrieve(nrt_DLL * dll, // This might be a "preloaded" TRE if (dll->dsoMain) { - const char* underscore = strchr(function, '_'); + const char* underscore = strrchr(function, '_'); if ((underscore != NULL) && strcmp(underscore, "_handler") == 0) { return dll->dsoMain; diff --git a/modules/c/nrt/source/DLLWin32.c b/modules/c/nrt/source/DLLWin32.c index d5a59e621..6cf64fb97 100644 --- a/modules/c/nrt/source/DLLWin32.c +++ b/modules/c/nrt/source/DLLWin32.c @@ -137,7 +137,7 @@ NRTAPI(NRT_DLL_FUNCTION_PTR) nrt_DLL_retrieve(nrt_DLL * dll, // This might be a "preloaded" TRE if (dll->dsoMain) { - const char* underscore = strchr(function, '_'); + const char* underscore = strrchr(function, '_'); if ((underscore != NULL) && strcmp(underscore, "_handler") == 0) { return dll->dsoMain; From 3f36db7310e16c4a94291bc3c9e13738b3ba0b09 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 14 Nov 2023 14:45:07 -0500 Subject: [PATCH 23/36] preload TREs, but disable them --- .../c/nitf/include/nitf/PluginIdentifier.h | 1 + modules/c/nitf/source/PluginRegistry.c | 8 +++-- modules/c/nitf/source/TREs.c | 29 +++++++++---------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/modules/c/nitf/include/nitf/PluginIdentifier.h b/modules/c/nitf/include/nitf/PluginIdentifier.h index da1203f2c..125ccd902 100644 --- a/modules/c/nitf/include/nitf/PluginIdentifier.h +++ b/modules/c/nitf/include/nitf/PluginIdentifier.h @@ -70,6 +70,7 @@ typedef struct _nitf_TREPreloaded const char* name; NITF_PLUGIN_INIT_FUNCTION init; NITF_PLUGIN_TRE_HANDLER_FUNCTION handler; + NITF_BOOL enabled; // most preloaded TREs are disabled by default } nitf_TREPreloaded; /* diff --git a/modules/c/nitf/source/PluginRegistry.c b/modules/c/nitf/source/PluginRegistry.c index e05bc2a84..ba0243c89 100644 --- a/modules/c/nitf/source/PluginRegistry.c +++ b/modules/c/nitf/source/PluginRegistry.c @@ -983,9 +983,13 @@ static const nitf_TREPreloaded* findPreloadedTRE(const char* keyName) { return NULL; } - if (strcmp(keyName, pKeyName) == 0) + + if (preloadedTREs[i].enabled) { - return &(preloadedTREs[i]); + if (strcmp(keyName, pKeyName) == 0) + { + return &(preloadedTREs[i]); + } } } } diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index 037014e6a..6a193724d 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -99,28 +99,27 @@ static nitf_TREHandler* TEST_PRELOADED_DES_handler(nitf_Error*) { /******************************************************************************/ -#define NITF_preload_TRE(Tre_) { #Tre_, Tre_##_init, Tre_##_handler } +#define NITF_preload_TRE_(Tre_, enabled_) { #Tre_, Tre_##_init, Tre_##_handler, enabled_ } +#define NITF_preload_TRE(Tre_, enabled_) NITF_preload_TRE_(Tre_, NRT_TRUE /*enabled*/) extern const nitf_TREPreloaded preloadedTREs[]; const nitf_TREPreloaded preloadedTREs[] = { // Not preloading any TREs right now: with the existing system, // a TRE can be removed by deleting the DLL/SO. If that same TRE // were preloaded, there would be no way to get rid of it. -/* - NITF_preload_TRE(ACCHZB), - NITF_preload_TRE(ACCPOB), - NITF_preload_TRE(ACFTA), - NITF_preload_TRE(AIMIDB), - NITF_preload_TRE(CSCRNA), - NITF_preload_TRE(CSEXRB), - //NITF_preload_TRE(ENGRDA), - NITF_preload_TRE(HISTOA), - NITF_preload_TRE(JITCID), - NITF_preload_TRE(PTPRAA), - NITF_preload_TRE(RPFHDR), -*/ + NITF_preload_TRE_(ACCHZB, NRT_FALSE /*enabled*/), + NITF_preload_TRE_(ACCPOB, NRT_FALSE /*enabled*/), + NITF_preload_TRE_(ACFTA, NRT_FALSE /*enabled*/), + NITF_preload_TRE_(AIMIDB, NRT_FALSE /*enabled*/), + NITF_preload_TRE_(CSCRNA, NRT_FALSE /*enabled*/), + NITF_preload_TRE_(CSEXRB, NRT_FALSE /*enabled*/), + NITF_preload_TRE_(ENGRDA, NRT_FALSE /*enabled*/), + NITF_preload_TRE_(HISTOA, NRT_FALSE /*enabled*/), + NITF_preload_TRE_(JITCID, NRT_FALSE /*enabled*/), + NITF_preload_TRE_(PTPRAA, NRT_FALSE /*enabled*/), + NITF_preload_TRE_(RPFHDR, NRT_FALSE /*enabled*/), NITF_preload_TRE(TEST_PRELOADED_DES), - { NULL, NULL, NULL } + { NULL, NULL, NULL, NRT_FALSE } }; From dc281735cd287ee8fe7c9124a7200814e5dd4d76 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 14 Nov 2023 15:02:06 -0500 Subject: [PATCH 24/36] allow preloaded TREs to be enabled/disabled --- .../c++/nitf/unittests/test_tre_mods++.cpp | 2 ++ modules/c/nitf/include/nitf/PluginRegistry.h | 13 ++++++-- modules/c/nitf/source/PluginRegistry.c | 33 ++++++++++++++----- modules/c/nitf/source/TREs.c | 4 +-- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/modules/c++/nitf/unittests/test_tre_mods++.cpp b/modules/c++/nitf/unittests/test_tre_mods++.cpp index 21ca387f4..f5bf647b5 100644 --- a/modules/c++/nitf/unittests/test_tre_mods++.cpp +++ b/modules/c++/nitf/unittests/test_tre_mods++.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -229,6 +230,7 @@ TEST_CASE(basicIteration) TEST_CASE(use_TEST_PRELOADED_DES) { + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("TEST_PRELOADED_DES", NRT_TRUE) ); nitf::TRE des("TEST_PRELOADED_DES", "TEST_PRELOADED_DES"); des.setField("TEST_PRELOADED_DES_COUNT", 12); diff --git a/modules/c/nitf/include/nitf/PluginRegistry.h b/modules/c/nitf/include/nitf/PluginRegistry.h index 858d486fe..7e8dab5fe 100644 --- a/modules/c/nitf/include/nitf/PluginRegistry.h +++ b/modules/c/nitf/include/nitf/PluginRegistry.h @@ -165,8 +165,6 @@ NITFAPI(NITF_BOOL) nitf_PluginRegistry_loadDir(const char* dirName, nitf_Error * error); -NITFAPI(NITF_BOOL) - nitf_PluginRegistry_insertPlugin_(const char* msg, nitf_PluginRegistry* reg, const char** ident, nitf_DLL* dll, nitf_Error* error); NITFAPI(NITF_BOOL) nitf_PluginRegistry_loadPlugin(const char* fullPathName, nitf_Error* error); @@ -182,6 +180,17 @@ nitf_PluginRegistry_TREHandlerExists(const char* ident); NITFAPI(NITF_BOOL) nitf_PluginRegistry_TREHandlerExistsLog(const char* ident, FILE* log); +/*! + * Enable (or disable) a pre-loaded TRE. + * + * \param ident ID of the TRE + * + * \return true if a pre-loaded TRE handler exists, false otherwise + */ + +NITFAPI(NITF_BOOL) +nitf_PluginRegistry_PreloadedTREHandlerEnable(const char* ident, NITF_BOOL enable); + /*! * Checks if a compression handler exists for 'ident' * diff --git a/modules/c/nitf/source/PluginRegistry.c b/modules/c/nitf/source/PluginRegistry.c index ba0243c89..a56fa85b9 100644 --- a/modules/c/nitf/source/PluginRegistry.c +++ b/modules/c/nitf/source/PluginRegistry.c @@ -973,9 +973,9 @@ insertCreator(nitf_DLL* dso, * * No more talking to the DSOs directly */ -static const nitf_TREPreloaded* findPreloadedTRE(const char* keyName) +static nitf_TREPreloaded* findPreloadedTRE_(const char* keyName) { - extern const nitf_TREPreloaded preloadedTREs[]; + extern nitf_TREPreloaded preloadedTREs[]; for (size_t i = 0;; i++) { const char* pKeyName = preloadedTREs[i].name; @@ -983,16 +983,33 @@ static const nitf_TREPreloaded* findPreloadedTRE(const char* keyName) { return NULL; } - - if (preloadedTREs[i].enabled) + if (strcmp(keyName, pKeyName) == 0) { - if (strcmp(keyName, pKeyName) == 0) - { - return &(preloadedTREs[i]); - } + return &(preloadedTREs[i]); } } } +static const nitf_TREPreloaded* findPreloadedTRE(const char* keyName) +{ + const nitf_TREPreloaded* retval = findPreloadedTRE_(keyName); + if ((retval != NULL) && (retval->enabled)) + { + return retval; + } + return NULL; +} + +NITFPROT(NITF_BOOL) +nitf_PluginRegistry_PreloadedTREHandlerEnable(const char* keyName, NITF_BOOL enable) +{ + nitf_TREPreloaded* result = findPreloadedTRE_(keyName); + if (result != NULL) + { + result->enabled = enable; + return NRT_TRUE; + } + return NRT_FALSE; +} /* * Initialize a DSO. The init hook is retrieved and called once diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index 6a193724d..efb6d4e17 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -102,8 +102,8 @@ static nitf_TREHandler* TEST_PRELOADED_DES_handler(nitf_Error*) { #define NITF_preload_TRE_(Tre_, enabled_) { #Tre_, Tre_##_init, Tre_##_handler, enabled_ } #define NITF_preload_TRE(Tre_, enabled_) NITF_preload_TRE_(Tre_, NRT_TRUE /*enabled*/) -extern const nitf_TREPreloaded preloadedTREs[]; -const nitf_TREPreloaded preloadedTREs[] = { +extern nitf_TREPreloaded preloadedTREs[]; +nitf_TREPreloaded preloadedTREs[] = { // Not preloading any TREs right now: with the existing system, // a TRE can be removed by deleting the DLL/SO. If that same TRE // were preloaded, there would be no way to get rid of it. From 04fc627a5afc3c55190c060417a3d5ae5613a43e Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 14 Nov 2023 15:14:18 -0500 Subject: [PATCH 25/36] allow all TREs to be enabled (or disabled) --- UnitTest/UnitTest.cpp | 3 +++ modules/c/nitf/include/nitf/PluginRegistry.h | 2 ++ modules/c/nitf/source/PluginRegistry.c | 26 ++++++++++++++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/UnitTest/UnitTest.cpp b/UnitTest/UnitTest.cpp index bd3176e4a..698ca2ba5 100644 --- a/UnitTest/UnitTest.cpp +++ b/UnitTest/UnitTest.cpp @@ -1,11 +1,14 @@ #include "pch.h" #include "CppUnitTest.h" +#include #include // https://learn.microsoft.com/en-us/visualstudio/test/microsoft-visualstudio-testtools-cppunittestframework-api-reference?view=vs-2022 TEST_MODULE_INITIALIZE(methodName) { + nitf_PluginRegistry_PreloadedTREHandlersEnable(NRT_TRUE); + // module initialization code nitf::Test::setNitfPluginPath(); } \ No newline at end of file diff --git a/modules/c/nitf/include/nitf/PluginRegistry.h b/modules/c/nitf/include/nitf/PluginRegistry.h index 7e8dab5fe..54feddb3f 100644 --- a/modules/c/nitf/include/nitf/PluginRegistry.h +++ b/modules/c/nitf/include/nitf/PluginRegistry.h @@ -190,6 +190,8 @@ nitf_PluginRegistry_TREHandlerExistsLog(const char* ident, FILE* log); NITFAPI(NITF_BOOL) nitf_PluginRegistry_PreloadedTREHandlerEnable(const char* ident, NITF_BOOL enable); +NITFAPI(void) +nitf_PluginRegistry_PreloadedTREHandlersEnable(NITF_BOOL enable); // "Handlers", not "Handler" /*! * Checks if a compression handler exists for 'ident' diff --git a/modules/c/nitf/source/PluginRegistry.c b/modules/c/nitf/source/PluginRegistry.c index a56fa85b9..4dd56cb19 100644 --- a/modules/c/nitf/source/PluginRegistry.c +++ b/modules/c/nitf/source/PluginRegistry.c @@ -973,9 +973,15 @@ insertCreator(nitf_DLL* dso, * * No more talking to the DSOs directly */ -static nitf_TREPreloaded* findPreloadedTRE_(const char* keyName) +static nitf_TREPreloaded* getPreloadedTREs() { extern nitf_TREPreloaded preloadedTREs[]; + return preloadedTREs; +} + +static nitf_TREPreloaded* findPreloadedTRE_(const char* keyName) +{ + nitf_TREPreloaded* preloadedTREs = getPreloadedTREs(); for (size_t i = 0;; i++) { const char* pKeyName = preloadedTREs[i].name; @@ -999,7 +1005,7 @@ static const nitf_TREPreloaded* findPreloadedTRE(const char* keyName) return NULL; } -NITFPROT(NITF_BOOL) +NITFAPI(NITF_BOOL) nitf_PluginRegistry_PreloadedTREHandlerEnable(const char* keyName, NITF_BOOL enable) { nitf_TREPreloaded* result = findPreloadedTRE_(keyName); @@ -1011,6 +1017,22 @@ nitf_PluginRegistry_PreloadedTREHandlerEnable(const char* keyName, NITF_BOOL ena return NRT_FALSE; } +NITFAPI(void) +nitf_PluginRegistry_PreloadedTREHandlersEnable(NITF_BOOL enable) +{ + nitf_TREPreloaded* preloadedTREs = getPreloadedTREs(); + for (size_t i = 0;; i++) + { + const char* pKeyName = preloadedTREs[i].name; + if (pKeyName == NULL) // end of list + { + return; + } + + preloadedTREs[i].enabled = enable; + } +} + /* * Initialize a DSO. The init hook is retrieved and called once * when the DSO is loaded From 35b8e5df57788029d00ae2d0a47ebcdc8dabfb11 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 14 Nov 2023 15:48:46 -0500 Subject: [PATCH 26/36] don't need to call setNitfPluginPath() as much with preloaded TREs --- UnitTest/UnitTest.cpp | 2 +- UnitTest/UnitTest.vcxproj | 3 - modules/c++/nitf/source/UnitTests.cpp | 2 +- .../c++/nitf/unittests/test_create_nitf++.cpp | 11 +- .../nitf/unittests/test_j2k_compress_tile.cpp | 4 +- .../test_j2k_compressed_byte_provider.cpp | 5 +- modules/c/nitf/ACCHZB.vcxproj | 113 ------------------ modules/c/nitf/ACCPOB.vcxproj | 113 ------------------ modules/c/nitf/ACFTA.vcxproj | 113 ------------------ modules/c/nitf/AIMIDB.vcxproj | 113 ------------------ modules/c/nitf/CSCRNA.vcxproj | 113 ------------------ modules/c/nitf/CSEXRB.vcxproj | 113 ------------------ modules/c/nitf/ENGRDA.vcxproj | 113 ------------------ modules/c/nitf/HISTOA.vcxproj | 113 ------------------ modules/c/nitf/JITCID.vcxproj | 113 ------------------ modules/c/nitf/PTPRAA.vcxproj | 113 ------------------ modules/c/nitf/RPFHDR.vcxproj | 113 ------------------ modules/c/nitf/source/TREs.c | 5 +- nitro.sln | 77 ------------ 19 files changed, 11 insertions(+), 1341 deletions(-) delete mode 100644 modules/c/nitf/ACCHZB.vcxproj delete mode 100644 modules/c/nitf/ACCPOB.vcxproj delete mode 100644 modules/c/nitf/ACFTA.vcxproj delete mode 100644 modules/c/nitf/AIMIDB.vcxproj delete mode 100644 modules/c/nitf/CSCRNA.vcxproj delete mode 100644 modules/c/nitf/CSEXRB.vcxproj delete mode 100644 modules/c/nitf/ENGRDA.vcxproj delete mode 100644 modules/c/nitf/HISTOA.vcxproj delete mode 100644 modules/c/nitf/JITCID.vcxproj delete mode 100644 modules/c/nitf/PTPRAA.vcxproj delete mode 100644 modules/c/nitf/RPFHDR.vcxproj diff --git a/UnitTest/UnitTest.cpp b/UnitTest/UnitTest.cpp index 698ca2ba5..776d94ce6 100644 --- a/UnitTest/UnitTest.cpp +++ b/UnitTest/UnitTest.cpp @@ -10,5 +10,5 @@ TEST_MODULE_INITIALIZE(methodName) nitf_PluginRegistry_PreloadedTREHandlersEnable(NRT_TRUE); // module initialization code - nitf::Test::setNitfPluginPath(); + nitf::Test::j2kSetNitfPluginPath(); } \ No newline at end of file diff --git a/UnitTest/UnitTest.vcxproj b/UnitTest/UnitTest.vcxproj index 582a6e41c..82c3d478b 100644 --- a/UnitTest/UnitTest.vcxproj +++ b/UnitTest/UnitTest.vcxproj @@ -258,9 +258,6 @@ {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - {53f9f908-c678-4dee-9309-e71c1e03a45f} - {78849481-d356-4cc7-b182-31c21f857ed1} diff --git a/modules/c++/nitf/source/UnitTests.cpp b/modules/c++/nitf/source/UnitTests.cpp index 4b7be9066..b735cd100 100644 --- a/modules/c++/nitf/source/UnitTests.cpp +++ b/modules/c++/nitf/source/UnitTests.cpp @@ -271,7 +271,7 @@ static std::string buildPluginName(const std::string& base) void nitf::Test::setNitfPluginPath() { // The name of the plugin we know exists and will always be built, see test_load_plugins - static const auto p = getNitfPluginPath(buildPluginName("ENGRDA")); + static const auto p = getNitfPluginPath(buildPluginName("XML_DATA_CONTENT")); sys::OS().setEnv("NITF_PLUGIN_PATH", p.string(), true /*overwrite*/); } diff --git a/modules/c++/nitf/unittests/test_create_nitf++.cpp b/modules/c++/nitf/unittests/test_create_nitf++.cpp index 10bf65413..e36b44f01 100644 --- a/modules/c++/nitf/unittests/test_create_nitf++.cpp +++ b/modules/c++/nitf/unittests/test_create_nitf++.cpp @@ -235,8 +235,6 @@ static bool test_create_nitf_with_byte_provider__testRead(const std::string& pat TEST_CASE(test_create_nitf_with_byte_provider_test) { - nitf::Test::setNitfPluginPath(); - // We can't actually compress. This is just for illustration. const bool shouldCompress = false; const std::string outname("test_create.nitf"); @@ -397,8 +395,6 @@ static bool test_create_nitf__testRead(const std::string& pathname, bool isMono TEST_CASE(test_create_nitf_test) { - nitf::Test::setNitfPluginPath(); - const std::string outname("test_create.nitf"); @@ -474,8 +470,6 @@ static void RecordThread_run() TEST_CASE(test_mt_record) { - nitf::Test::setNitfPluginPath(); - constexpr int NTHR = 2; std::array thrs; @@ -500,10 +494,9 @@ TEST_CASE(test_mt_record) TEST_ASSERT_TRUE(true); } - - - TEST_MAIN( + nitf::Test::setNitfPluginPath(); + TEST_CHECK(test_create_nitf_with_byte_provider_test); TEST_CHECK(test_create_nitf_test); TEST_CHECK(test_mt_record); diff --git a/modules/c++/nitf/unittests/test_j2k_compress_tile.cpp b/modules/c++/nitf/unittests/test_j2k_compress_tile.cpp index dedefd5ce..4548f1e25 100644 --- a/modules/c++/nitf/unittests/test_j2k_compress_tile.cpp +++ b/modules/c++/nitf/unittests/test_j2k_compress_tile.cpp @@ -181,8 +181,6 @@ static bool equals(const std::vector& lhs, const std::vector make_Tester(bool setBlocking, std::optional maxRo TEST_CASE(j2k_compressed_byte_provider_maxRowsPerSegment0) { - nitf::Test::setNitfPluginPath(); { auto tester = make_Tester(true /*setBlocking*/); tester.testMultipleWritesBlocked(); @@ -605,8 +604,6 @@ TEST_CASE(j2k_compressed_byte_provider_maxRowsPerSegment0) TEST_CASE(j2k_compressed_byte_provider) { - nitf::Test::setNitfPluginPath(); - // Run tests forcing various numbers of segments // Blocking is set at 40 rows / block so can't go less than this // Actual limit is a bit higher, since j2k needs a minimum size @@ -636,6 +633,8 @@ TEST_CASE(j2k_do_nothing) } TEST_MAIN( + nitf::Test::j2kSetNitfPluginPath(); + TEST_CHECK(j2k_do_nothing); //TEST_CHECK(j2k_compressed_byte_provider_maxRowsPerSegment0); // TODO: get working with CMake //TEST_CHECK(j2k_compressed_byte_provider); // TODO: get working with CMake diff --git a/modules/c/nitf/ACCHZB.vcxproj b/modules/c/nitf/ACCHZB.vcxproj deleted file mode 100644 index f42acd267..000000000 --- a/modules/c/nitf/ACCHZB.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {53F9F908-C678-4DEE-9309-E71C1D03A45F} - nitro - 10.0 - ACCHZB - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/ACCPOB.vcxproj b/modules/c/nitf/ACCPOB.vcxproj deleted file mode 100644 index b668d9318..000000000 --- a/modules/c/nitf/ACCPOB.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {730B1E6E-2469-4F9E-B093-D0C6262453C9} - nitro - 10.0 - ACCPOB - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/ACFTA.vcxproj b/modules/c/nitf/ACFTA.vcxproj deleted file mode 100644 index e3c2731ad..000000000 --- a/modules/c/nitf/ACFTA.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {51D7B426-899E-428D-9F69-5DDAC9E403FB} - nitro - 10.0 - ACFTA - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/AIMIDB.vcxproj b/modules/c/nitf/AIMIDB.vcxproj deleted file mode 100644 index 2811c37bd..000000000 --- a/modules/c/nitf/AIMIDB.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343} - nitro - 10.0 - AIMIDB - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/CSCRNA.vcxproj b/modules/c/nitf/CSCRNA.vcxproj deleted file mode 100644 index 06e6dc8a0..000000000 --- a/modules/c/nitf/CSCRNA.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {023DE06D-3967-4406-B1B8-032118BB2552} - nitro - 10.0 - CSCRNA - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/CSEXRB.vcxproj b/modules/c/nitf/CSEXRB.vcxproj deleted file mode 100644 index 961b372ba..000000000 --- a/modules/c/nitf/CSEXRB.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E} - nitro - 10.0 - CSEXRB - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/ENGRDA.vcxproj b/modules/c/nitf/ENGRDA.vcxproj deleted file mode 100644 index a8e77e226..000000000 --- a/modules/c/nitf/ENGRDA.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {53F9F908-C678-4DEE-9309-E71C1E03A45F} - nitro - 10.0 - ENGRDA - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/HISTOA.vcxproj b/modules/c/nitf/HISTOA.vcxproj deleted file mode 100644 index 4341dcc23..000000000 --- a/modules/c/nitf/HISTOA.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {D749AA73-4C9A-473D-96BB-070A6D9CAA54} - nitro - 10.0 - HISTOA - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/JITCID.vcxproj b/modules/c/nitf/JITCID.vcxproj deleted file mode 100644 index c7ac658a0..000000000 --- a/modules/c/nitf/JITCID.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {D1D7FCD3-6130-4504-9DA0-9D80506BE55E} - nitro - 10.0 - JITCID - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/PTPRAA.vcxproj b/modules/c/nitf/PTPRAA.vcxproj deleted file mode 100644 index 91822c7d1..000000000 --- a/modules/c/nitf/PTPRAA.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {2BAAACA9-A5A4-412C-AE52-B16C2D107F55} - nitro - 10.0 - PTPRAA - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/RPFHDR.vcxproj b/modules/c/nitf/RPFHDR.vcxproj deleted file mode 100644 index 947f2c56f..000000000 --- a/modules/c/nitf/RPFHDR.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {CF5B4F02-364D-4117-9FB9-6C9C7938E412} - nitro - 10.0 - RPFHDR - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - MultiThreadedDebugDLL - true - ProgramDatabase - AdvancedVectorExtensions2 - true - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH - true - $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) - /FS %(AdditionalOptions) - true - CompileAsCpp - Guard - true - AdvancedVectorExtensions2 - - - - - true - true - true - - - - - - \ No newline at end of file diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index efb6d4e17..bacd59b5f 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -93,14 +93,15 @@ static const char** TEST_PRELOADED_DES_init(nitf_Error* error) return NULL; return TEST_PRELOADED_DES_ident; } -static nitf_TREHandler* TEST_PRELOADED_DES_handler(nitf_Error*) { +static nitf_TREHandler* TEST_PRELOADED_DES_handler(nitf_Error* error) { + (void)error; return &TEST_PRELOADED_DESHandler; } /******************************************************************************/ #define NITF_preload_TRE_(Tre_, enabled_) { #Tre_, Tre_##_init, Tre_##_handler, enabled_ } -#define NITF_preload_TRE(Tre_, enabled_) NITF_preload_TRE_(Tre_, NRT_TRUE /*enabled*/) +#define NITF_preload_TRE(Tre_) NITF_preload_TRE_(Tre_, NRT_TRUE /*enabled*/) extern nitf_TREPreloaded preloadedTREs[]; nitf_TREPreloaded preloadedTREs[] = { diff --git a/nitro.sln b/nitro.sln index 56cfb2e04..3d3fa406c 100644 --- a/nitro.sln +++ b/nitro.sln @@ -20,26 +20,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nitf-c++", "modules\c++\nit {A676EDF3-F231-47C8-A6E6-0FE50B50B71B} = {A676EDF3-F231-47C8-A6E6-0FE50B50B71B} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACCPOB", "modules\c\nitf\ACCPOB.vcxproj", "{730B1E6E-2469-4F9E-B093-D0C6262453C9}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACFTA", "modules\c\nitf\ACFTA.vcxproj", "{51D7B426-899E-428D-9F69-5DDAC9E403FB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AIMIDB", "modules\c\nitf\AIMIDB.vcxproj", "{12AA0752-4EE3-4E0A-85AF-0E5DEADBF343}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JITCID", "modules\c\nitf\JITCID.vcxproj", "{D1D7FCD3-6130-4504-9DA0-9D80506BE55E}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "c-nitf-shared", "c-nitf-shared", "{27A2685A-E869-42A2-956D-92994F60C536}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSCRNA", "modules\c\nitf\CSCRNA.vcxproj", "{023DE06D-3967-4406-B1B8-032118BB2552}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RPFHDR", "modules\c\nitf\RPFHDR.vcxproj", "{CF5B4F02-364D-4117-9FB9-6C9C7938E412}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "show_nitf++", "modules\c++\nitf\apps\show_nitf++\show_nitf++.vcxproj", "{839FF52C-57D1-45B6-81FD-5C7D72523EE5}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PTPRAA", "modules\c\nitf\PTPRAA.vcxproj", "{2BAAACA9-A5A4-412C-AE52-B16C2D107F55}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ENGRDA", "modules\c\nitf\ENGRDA.vcxproj", "{53F9F908-C678-4DEE-9309-E71C1E03A45F}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "J2KCompress", "modules\c\j2k\J2KCompress.vcxproj", "{A676EDF3-F231-47C8-A6E6-0FE50B50B71B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "J2KDecompress", "modules\c\j2k\J2KDecompress.vcxproj", "{C787537A-0CAC-4D6D-A6D6-A66765A06753}" @@ -51,18 +35,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github-workflows", ".githu .github\workflows\main.yml = .github\workflows\main.yml EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSEXRB", "modules\c\nitf\CSEXRB.vcxproj", "{0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "externals", "externals", "{7D26D571-0014-4C50-BF86-612E743E64B6}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "coda-oss", "externals\coda-oss\modules\c++\coda-oss.vcxproj", "{9997E895-5161-4DDF-8F3F-099894CB2F21}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest", "UnitTest\UnitTest.vcxproj", "{8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACCHZB", "modules\c\nitf\ACCHZB.vcxproj", "{53F9F908-C678-4DEE-9309-E71C1D03A45F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HISTOA", "modules\c\nitf\HISTOA.vcxproj", "{D749AA73-4C9A-473D-96BB-070A6D9CAA54}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XML_DATA_CONTENT", "modules\c\nitf\XML_DATA_CONTENT.vcxproj", "{78849481-D356-4CC7-B182-31C21F857ED1}" EndProject Global @@ -79,42 +57,10 @@ Global {8F357A19-799E-4971-850E-3F28485C130B}.Debug|x64.Build.0 = Debug|x64 {8F357A19-799E-4971-850E-3F28485C130B}.Release|x64.ActiveCfg = Release|x64 {8F357A19-799E-4971-850E-3F28485C130B}.Release|x64.Build.0 = Release|x64 - {730B1E6E-2469-4F9E-B093-D0C6262453C9}.Debug|x64.ActiveCfg = Debug|x64 - {730B1E6E-2469-4F9E-B093-D0C6262453C9}.Debug|x64.Build.0 = Debug|x64 - {730B1E6E-2469-4F9E-B093-D0C6262453C9}.Release|x64.ActiveCfg = Release|x64 - {730B1E6E-2469-4F9E-B093-D0C6262453C9}.Release|x64.Build.0 = Release|x64 - {51D7B426-899E-428D-9F69-5DDAC9E403FB}.Debug|x64.ActiveCfg = Debug|x64 - {51D7B426-899E-428D-9F69-5DDAC9E403FB}.Debug|x64.Build.0 = Debug|x64 - {51D7B426-899E-428D-9F69-5DDAC9E403FB}.Release|x64.ActiveCfg = Release|x64 - {51D7B426-899E-428D-9F69-5DDAC9E403FB}.Release|x64.Build.0 = Release|x64 - {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343}.Debug|x64.ActiveCfg = Debug|x64 - {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343}.Debug|x64.Build.0 = Debug|x64 - {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343}.Release|x64.ActiveCfg = Release|x64 - {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343}.Release|x64.Build.0 = Release|x64 - {D1D7FCD3-6130-4504-9DA0-9D80506BE55E}.Debug|x64.ActiveCfg = Debug|x64 - {D1D7FCD3-6130-4504-9DA0-9D80506BE55E}.Debug|x64.Build.0 = Debug|x64 - {D1D7FCD3-6130-4504-9DA0-9D80506BE55E}.Release|x64.ActiveCfg = Release|x64 - {D1D7FCD3-6130-4504-9DA0-9D80506BE55E}.Release|x64.Build.0 = Release|x64 - {023DE06D-3967-4406-B1B8-032118BB2552}.Debug|x64.ActiveCfg = Debug|x64 - {023DE06D-3967-4406-B1B8-032118BB2552}.Debug|x64.Build.0 = Debug|x64 - {023DE06D-3967-4406-B1B8-032118BB2552}.Release|x64.ActiveCfg = Release|x64 - {023DE06D-3967-4406-B1B8-032118BB2552}.Release|x64.Build.0 = Release|x64 - {CF5B4F02-364D-4117-9FB9-6C9C7938E412}.Debug|x64.ActiveCfg = Debug|x64 - {CF5B4F02-364D-4117-9FB9-6C9C7938E412}.Debug|x64.Build.0 = Debug|x64 - {CF5B4F02-364D-4117-9FB9-6C9C7938E412}.Release|x64.ActiveCfg = Release|x64 - {CF5B4F02-364D-4117-9FB9-6C9C7938E412}.Release|x64.Build.0 = Release|x64 {839FF52C-57D1-45B6-81FD-5C7D72523EE5}.Debug|x64.ActiveCfg = Debug|x64 {839FF52C-57D1-45B6-81FD-5C7D72523EE5}.Debug|x64.Build.0 = Debug|x64 {839FF52C-57D1-45B6-81FD-5C7D72523EE5}.Release|x64.ActiveCfg = Release|x64 {839FF52C-57D1-45B6-81FD-5C7D72523EE5}.Release|x64.Build.0 = Release|x64 - {2BAAACA9-A5A4-412C-AE52-B16C2D107F55}.Debug|x64.ActiveCfg = Debug|x64 - {2BAAACA9-A5A4-412C-AE52-B16C2D107F55}.Debug|x64.Build.0 = Debug|x64 - {2BAAACA9-A5A4-412C-AE52-B16C2D107F55}.Release|x64.ActiveCfg = Release|x64 - {2BAAACA9-A5A4-412C-AE52-B16C2D107F55}.Release|x64.Build.0 = Release|x64 - {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Debug|x64.ActiveCfg = Debug|x64 - {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Debug|x64.Build.0 = Debug|x64 - {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Release|x64.ActiveCfg = Release|x64 - {53F9F908-C678-4DEE-9309-E71C1E03A45F}.Release|x64.Build.0 = Release|x64 {A676EDF3-F231-47C8-A6E6-0FE50B50B71B}.Debug|x64.ActiveCfg = Debug|x64 {A676EDF3-F231-47C8-A6E6-0FE50B50B71B}.Debug|x64.Build.0 = Debug|x64 {A676EDF3-F231-47C8-A6E6-0FE50B50B71B}.Release|x64.ActiveCfg = Release|x64 @@ -123,10 +69,6 @@ Global {C787537A-0CAC-4D6D-A6D6-A66765A06753}.Debug|x64.Build.0 = Debug|x64 {C787537A-0CAC-4D6D-A6D6-A66765A06753}.Release|x64.ActiveCfg = Release|x64 {C787537A-0CAC-4D6D-A6D6-A66765A06753}.Release|x64.Build.0 = Release|x64 - {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E}.Debug|x64.ActiveCfg = Debug|x64 - {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E}.Debug|x64.Build.0 = Debug|x64 - {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E}.Release|x64.ActiveCfg = Release|x64 - {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E}.Release|x64.Build.0 = Release|x64 {9997E895-5161-4DDF-8F3F-099894CB2F21}.Debug|x64.ActiveCfg = Debug|x64 {9997E895-5161-4DDF-8F3F-099894CB2F21}.Debug|x64.Build.0 = Debug|x64 {9997E895-5161-4DDF-8F3F-099894CB2F21}.Release|x64.ActiveCfg = Release|x64 @@ -135,14 +77,6 @@ Global {8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}.Debug|x64.Build.0 = Debug|x64 {8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}.Release|x64.ActiveCfg = Release|x64 {8ACE478C-8F6F-4D42-9B43-7D75882D4BE1}.Release|x64.Build.0 = Release|x64 - {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Debug|x64.ActiveCfg = Debug|x64 - {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Debug|x64.Build.0 = Debug|x64 - {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Release|x64.ActiveCfg = Release|x64 - {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Release|x64.Build.0 = Release|x64 - {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Debug|x64.ActiveCfg = Debug|x64 - {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Debug|x64.Build.0 = Debug|x64 - {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Release|x64.ActiveCfg = Release|x64 - {D749AA73-4C9A-473D-96BB-070A6D9CAA54}.Release|x64.Build.0 = Release|x64 {78849481-D356-4CC7-B182-31C21F857ED1}.Debug|x64.ActiveCfg = Debug|x64 {78849481-D356-4CC7-B182-31C21F857ED1}.Debug|x64.Build.0 = Debug|x64 {78849481-D356-4CC7-B182-31C21F857ED1}.Release|x64.ActiveCfg = Release|x64 @@ -152,21 +86,10 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {730B1E6E-2469-4F9E-B093-D0C6262453C9} = {27A2685A-E869-42A2-956D-92994F60C536} - {51D7B426-899E-428D-9F69-5DDAC9E403FB} = {27A2685A-E869-42A2-956D-92994F60C536} - {12AA0752-4EE3-4E0A-85AF-0E5DEADBF343} = {27A2685A-E869-42A2-956D-92994F60C536} - {D1D7FCD3-6130-4504-9DA0-9D80506BE55E} = {27A2685A-E869-42A2-956D-92994F60C536} - {023DE06D-3967-4406-B1B8-032118BB2552} = {27A2685A-E869-42A2-956D-92994F60C536} - {CF5B4F02-364D-4117-9FB9-6C9C7938E412} = {27A2685A-E869-42A2-956D-92994F60C536} - {2BAAACA9-A5A4-412C-AE52-B16C2D107F55} = {27A2685A-E869-42A2-956D-92994F60C536} - {53F9F908-C678-4DEE-9309-E71C1E03A45F} = {27A2685A-E869-42A2-956D-92994F60C536} {A676EDF3-F231-47C8-A6E6-0FE50B50B71B} = {27A2685A-E869-42A2-956D-92994F60C536} {C787537A-0CAC-4D6D-A6D6-A66765A06753} = {27A2685A-E869-42A2-956D-92994F60C536} {A45CB073-25A7-411D-A7E7-589BCC8AF547} = {5C5727E7-0CFF-42B4-8F5A-D31B3BC81F21} - {0A9BDA26-092F-4A2C-BBEF-00C64BF0C65E} = {27A2685A-E869-42A2-956D-92994F60C536} {9997E895-5161-4DDF-8F3F-099894CB2F21} = {7D26D571-0014-4C50-BF86-612E743E64B6} - {53F9F908-C678-4DEE-9309-E71C1D03A45F} = {27A2685A-E869-42A2-956D-92994F60C536} - {D749AA73-4C9A-473D-96BB-070A6D9CAA54} = {27A2685A-E869-42A2-956D-92994F60C536} {78849481-D356-4CC7-B182-31C21F857ED1} = {27A2685A-E869-42A2-956D-92994F60C536} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution From 87c52939778232f6b2117ada8a5f0bd93205e361 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Wed, 15 Nov 2023 08:52:06 -0500 Subject: [PATCH 27/36] always build TEST_DES as a DLL --- .../c++/nitf/unittests/test_tre_mods++.cpp | 26 ++-- modules/c/nitf/TEST_DES.vcxproj | 113 ++++++++++++++++++ .../c/nitf/include/nitf/PluginIdentifier.h | 1 + modules/c/nitf/source/PluginRegistry.c | 7 -- modules/c/nitf/source/TREs.c | 37 +++--- nitro.sln | 7 ++ 6 files changed, 157 insertions(+), 34 deletions(-) create mode 100644 modules/c/nitf/TEST_DES.vcxproj diff --git a/modules/c++/nitf/unittests/test_tre_mods++.cpp b/modules/c++/nitf/unittests/test_tre_mods++.cpp index f5bf647b5..9c940562a 100644 --- a/modules/c++/nitf/unittests/test_tre_mods++.cpp +++ b/modules/c++/nitf/unittests/test_tre_mods++.cpp @@ -228,18 +228,24 @@ TEST_CASE(basicIteration) TEST_ASSERT_EQ(numFields, static_cast(29)); } -TEST_CASE(use_TEST_PRELOADED_DES) +static void test_des_(const std::string& testName, nitf::TRE& des, const std::string& prefix) { - TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("TEST_PRELOADED_DES", NRT_TRUE) ); - nitf::TRE des("TEST_PRELOADED_DES", "TEST_PRELOADED_DES"); + des.setField(prefix + "COUNT", 12); + des.setField(prefix + "START", 345); + des.setField(prefix + "INCREMENT", 67); - des.setField("TEST_PRELOADED_DES_COUNT", 12); - des.setField("TEST_PRELOADED_DES_START", 345); - des.setField("TEST_PRELOADED_DES_INCREMENT", 67); + TEST_ASSERT_EQ(des.getFieldValue(prefix + "COUNT"), 12); + TEST_ASSERT_EQ(des.getFieldValue(prefix + "START"), 345); + TEST_ASSERT_EQ(des.getFieldValue(prefix + "INCREMENT"), 67); +} +TEST_CASE(use_TEST_DES) +{ + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("TEST_PRELOADED_DES", NRT_TRUE) ); + nitf::TRE preloaded("TEST_PRELOADED_DES", "TEST_PRELOADED_DES"); + test_des_(testName, preloaded, "TEST_PRELOADED_DES_"); - TEST_ASSERT_EQ(des.getFieldValue("TEST_PRELOADED_DES_COUNT"), 12); - TEST_ASSERT_EQ(des.getFieldValue("TEST_PRELOADED_DES_START"), 345); - TEST_ASSERT_EQ(des.getFieldValue("TEST_PRELOADED_DES_INCREMENT"), 67); + nitf::TRE des("TEST_DES", "TEST_DES"); + test_des_(testName, des, "TEST_DES_"); } TEST_CASE(use_ENGRDA) @@ -419,7 +425,7 @@ TEST_MAIN( TEST_CHECK(setBinaryFields); TEST_CHECK(cloneTRE); TEST_CHECK(basicIteration); - TEST_CHECK(use_TEST_PRELOADED_DES); + TEST_CHECK(use_TEST_DES); TEST_CHECK(use_ENGRDA); TEST_CHECK(use_ENGRDA_typed_fields); TEST_CHECK(use_typed_ENGRDA); diff --git a/modules/c/nitf/TEST_DES.vcxproj b/modules/c/nitf/TEST_DES.vcxproj new file mode 100644 index 000000000..aa27cf8dd --- /dev/null +++ b/modules/c/nitf/TEST_DES.vcxproj @@ -0,0 +1,113 @@ + + + + + Debug + x64 + + + Release + x64 + + + + + + + + {f06550ad-cfc7-40b8-8727-6c82c69a8982} + + + + 16.0 + Win32Proj + {53F9F908-C678-4DEE-9309-E71C1D03A45F} + nitro + 10.0 + TEST_DES + + + + DynamicLibrary + true + v143 + + + DynamicLibrary + false + v143 + true + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\share\nitf\plugins\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + EnableAllWarnings + true + _DEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + MultiThreadedDebugDLL + true + ProgramDatabase + AdvancedVectorExtensions2 + true + + + + + true + + + + + Level3 + true + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions);NRT_MODULE_EXPORTS;NITRO_PCH + true + $(ProjectDir)include;$(ProjectDir)..\nrt\include;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + true + CompileAsCpp + Guard + true + AdvancedVectorExtensions2 + + + + + true + true + true + + + + + + \ No newline at end of file diff --git a/modules/c/nitf/include/nitf/PluginIdentifier.h b/modules/c/nitf/include/nitf/PluginIdentifier.h index 125ccd902..f2cead2ad 100644 --- a/modules/c/nitf/include/nitf/PluginIdentifier.h +++ b/modules/c/nitf/include/nitf/PluginIdentifier.h @@ -72,6 +72,7 @@ typedef struct _nitf_TREPreloaded NITF_PLUGIN_TRE_HANDLER_FUNCTION handler; NITF_BOOL enabled; // most preloaded TREs are disabled by default } nitf_TREPreloaded; +extern nitf_TREPreloaded preloadedTREs[]; /* \brief NITF_PLUGIN_COMPRESSION_HANDLER_FUNCTION - Function pointer for diff --git a/modules/c/nitf/source/PluginRegistry.c b/modules/c/nitf/source/PluginRegistry.c index 4dd56cb19..1a27961db 100644 --- a/modules/c/nitf/source/PluginRegistry.c +++ b/modules/c/nitf/source/PluginRegistry.c @@ -973,15 +973,9 @@ insertCreator(nitf_DLL* dso, * * No more talking to the DSOs directly */ -static nitf_TREPreloaded* getPreloadedTREs() -{ - extern nitf_TREPreloaded preloadedTREs[]; - return preloadedTREs; -} static nitf_TREPreloaded* findPreloadedTRE_(const char* keyName) { - nitf_TREPreloaded* preloadedTREs = getPreloadedTREs(); for (size_t i = 0;; i++) { const char* pKeyName = preloadedTREs[i].name; @@ -1020,7 +1014,6 @@ nitf_PluginRegistry_PreloadedTREHandlerEnable(const char* keyName, NITF_BOOL ena NITFAPI(void) nitf_PluginRegistry_PreloadedTREHandlersEnable(NITF_BOOL enable) { - nitf_TREPreloaded* preloadedTREs = getPreloadedTREs(); for (size_t i = 0;; i++) { const char* pKeyName = preloadedTREs[i].name; diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index bacd59b5f..abbe035c8 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -3,6 +3,7 @@ * ========================================================================= * * (C) Copyright 2004 - 2014, MDA Information Systems LLC + * © Copyright 2023, Maxar Technologies, Inc. * * NITRO is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -42,6 +43,9 @@ #include "../shared/PTPRAA.c" #include "../shared/RPFHDR.c" +#include "../shared/TEST_DES.c" +#include "../shared/XML_DATA_CONTENT.c" + /******************************************************************************/ /* * Simple example DES for testing. @@ -101,26 +105,25 @@ static nitf_TREHandler* TEST_PRELOADED_DES_handler(nitf_Error* error) { /******************************************************************************/ #define NITF_preload_TRE_(Tre_, enabled_) { #Tre_, Tre_##_init, Tre_##_handler, enabled_ } -#define NITF_preload_TRE(Tre_) NITF_preload_TRE_(Tre_, NRT_TRUE /*enabled*/) +#define NITF_preload_TRE(Tre_) NITF_preload_TRE_(Tre_, NRT_FALSE /*enabled*/) -extern nitf_TREPreloaded preloadedTREs[]; nitf_TREPreloaded preloadedTREs[] = { // Not preloading any TREs right now: with the existing system, // a TRE can be removed by deleting the DLL/SO. If that same TRE // were preloaded, there would be no way to get rid of it. - NITF_preload_TRE_(ACCHZB, NRT_FALSE /*enabled*/), - NITF_preload_TRE_(ACCPOB, NRT_FALSE /*enabled*/), - NITF_preload_TRE_(ACFTA, NRT_FALSE /*enabled*/), - NITF_preload_TRE_(AIMIDB, NRT_FALSE /*enabled*/), - NITF_preload_TRE_(CSCRNA, NRT_FALSE /*enabled*/), - NITF_preload_TRE_(CSEXRB, NRT_FALSE /*enabled*/), - NITF_preload_TRE_(ENGRDA, NRT_FALSE /*enabled*/), - NITF_preload_TRE_(HISTOA, NRT_FALSE /*enabled*/), - NITF_preload_TRE_(JITCID, NRT_FALSE /*enabled*/), - NITF_preload_TRE_(PTPRAA, NRT_FALSE /*enabled*/), - NITF_preload_TRE_(RPFHDR, NRT_FALSE /*enabled*/), - - NITF_preload_TRE(TEST_PRELOADED_DES), - - { NULL, NULL, NULL, NRT_FALSE } + NITF_preload_TRE(ACCHZB), + NITF_preload_TRE(ACCPOB), + NITF_preload_TRE(ACFTA), + NITF_preload_TRE(AIMIDB), + NITF_preload_TRE(CSCRNA), + NITF_preload_TRE(CSEXRB), + NITF_preload_TRE(ENGRDA), + NITF_preload_TRE(HISTOA), + NITF_preload_TRE(JITCID), + NITF_preload_TRE(PTPRAA), + NITF_preload_TRE(RPFHDR), + + NITF_preload_TRE_(TEST_PRELOADED_DES, NRT_TRUE /*enabled*/), + + { NULL, NULL, NULL, NRT_FALSE } // end of list }; diff --git a/nitro.sln b/nitro.sln index 3d3fa406c..0f6fc7c9d 100644 --- a/nitro.sln +++ b/nitro.sln @@ -43,6 +43,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest", "UnitTest\UnitTe EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XML_DATA_CONTENT", "modules\c\nitf\XML_DATA_CONTENT.vcxproj", "{78849481-D356-4CC7-B182-31C21F857ED1}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TEST_DES", "modules\c\nitf\TEST_DES.vcxproj", "{53F9F908-C678-4DEE-9309-E71C1D03A45F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -81,6 +83,10 @@ Global {78849481-D356-4CC7-B182-31C21F857ED1}.Debug|x64.Build.0 = Debug|x64 {78849481-D356-4CC7-B182-31C21F857ED1}.Release|x64.ActiveCfg = Release|x64 {78849481-D356-4CC7-B182-31C21F857ED1}.Release|x64.Build.0 = Release|x64 + {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Debug|x64.ActiveCfg = Debug|x64 + {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Debug|x64.Build.0 = Debug|x64 + {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Release|x64.ActiveCfg = Release|x64 + {53F9F908-C678-4DEE-9309-E71C1D03A45F}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -91,6 +97,7 @@ Global {A45CB073-25A7-411D-A7E7-589BCC8AF547} = {5C5727E7-0CFF-42B4-8F5A-D31B3BC81F21} {9997E895-5161-4DDF-8F3F-099894CB2F21} = {7D26D571-0014-4C50-BF86-612E743E64B6} {78849481-D356-4CC7-B182-31C21F857ED1} = {27A2685A-E869-42A2-956D-92994F60C536} + {53F9F908-C678-4DEE-9309-E71C1D03A45F} = {27A2685A-E869-42A2-956D-92994F60C536} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2D7AC542-BBB6-4BAC-8BF1-7E76C714BBA4} From ee4dd5390047cf6fe46a62f07e9154e5c9796f11 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Wed, 15 Nov 2023 09:16:02 -0500 Subject: [PATCH 28/36] strongly-typed TEST_DES TRE --- UnitTest/nitf-c++.cpp | 2 +- modules/c++/nitf-c++.vcxproj | 1 + modules/c++/nitf-c++.vcxproj.filters | 3 + modules/c++/nitf/include/nitf/TREsTyped.hpp | 120 ++++++++++++++++++ .../c++/nitf/unittests/test_tre_mods++.cpp | 22 +++- modules/c/nitf/source/TREs.c | 12 +- 6 files changed, 151 insertions(+), 9 deletions(-) create mode 100644 modules/c++/nitf/include/nitf/TREsTyped.hpp diff --git a/UnitTest/nitf-c++.cpp b/UnitTest/nitf-c++.cpp index 700258d51..92ba3fad2 100644 --- a/UnitTest/nitf-c++.cpp +++ b/UnitTest/nitf-c++.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include diff --git a/modules/c++/nitf-c++.vcxproj b/modules/c++/nitf-c++.vcxproj index 7d08f7107..f49244c4c 100644 --- a/modules/c++/nitf-c++.vcxproj +++ b/modules/c++/nitf-c++.vcxproj @@ -161,6 +161,7 @@ + diff --git a/modules/c++/nitf-c++.vcxproj.filters b/modules/c++/nitf-c++.vcxproj.filters index 7f786dc0b..e936e94cb 100644 --- a/modules/c++/nitf-c++.vcxproj.filters +++ b/modules/c++/nitf-c++.vcxproj.filters @@ -463,5 +463,8 @@ Header Files + + Header Files + \ No newline at end of file diff --git a/modules/c++/nitf/include/nitf/TREsTyped.hpp b/modules/c++/nitf/include/nitf/TREsTyped.hpp new file mode 100644 index 000000000..10b796a12 --- /dev/null +++ b/modules/c++/nitf/include/nitf/TREsTyped.hpp @@ -0,0 +1,120 @@ +/* ========================================================================= + * This file is part of NITRO + * ========================================================================= + * + * (C) Copyright 2004 - 2014, MDA Information Systems LLC + * © Copyright 2023, Maxar Technologies, Inc. + * + * NITRO is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, If not, + * see . + * + */ + +#pragma once + +#include "TREField.hpp" + + // A sample (and simple) "strongly-typed" TRE; see ENGRDA in the +// unittests for something a bit more elaborate (not included because it's incomplete). +namespace nitf +{ +namespace TREs +{ + class TEST_DES final + { + nitf::TRE tre_; + static constexpr const char* tag = "TEST_DES"; + + public: + // from TRE::getID() + /** + * Get the TRE identifier. This is NOT the tag, however it may be the + * same value as the tag. The ID is used to identify a specific + * version/incarnation of the TRE, if multiple are possible. For most TREs, + * this value will be the same as the tag. + */ + TEST_DES(const std::string& id = "") noexcept(false) + : tre_(tag, id.empty() ? tag : id.c_str()), + TEST_DES_COUNT(tre_, "TEST_DES_COUNT"), + TEST_DES_START(tre_, "TEST_DES_START"), + TEST_DES_INCREMENT(tre_, "TEST_DES_INCREMENT") + { + } + ~TEST_DES() = default; + TEST_DES(const TEST_DES&) = delete; + TEST_DES& operator=(const TEST_DES&) = delete; + TEST_DES(TEST_DES&&) = default; + TEST_DES& operator=(TEST_DES&&) = delete; + + // From TEST_DES.c + /* + static nitf_TREDescription TEST_DES_description[] = { + {NITF_BCS_N, 2, "Number of data values", "TEST_DES_COUNT" }, + {NITF_BCS_N, 3, "Start value in ramp", "TEST_DES_START" }, + {NITF_BCS_N, 2, "Increment between values in ramp", "TEST_DES_INCREMENT" }, + {NITF_END, 0, NULL, NULL} + }; + */ + nitf::TREField_BCS_N<2> TEST_DES_COUNT; + nitf::TREField_BCS_N<3> TEST_DES_START; + nitf::TREField_BCS_N<2> TEST_DES_INCREMENT; + + void updateFields() + { + tre_.updateFields(); + } + }; + + class TEST_PRELOADED_DES final + { + nitf::TRE tre_; + static constexpr const char* tag = "TEST_PRELOADED_DES"; + + public: + // from TRE::getID() + /** + * Get the TRE identifier. This is NOT the tag, however it may be the + * same value as the tag. The ID is used to identify a specific + * version/incarnation of the TRE, if multiple are possible. For most TREs, + * this value will be the same as the tag. + */ + TEST_PRELOADED_DES(const std::string& id = "") noexcept(false) : tre_(tag, id.empty() ? tag : id.c_str()), + COUNT(tre_, "COUNT"), START(tre_, "START"), INCREMENT(tre_, "INCREMENT") { } + ~TEST_PRELOADED_DES() = default; + TEST_PRELOADED_DES(const TEST_PRELOADED_DES&) = delete; + TEST_PRELOADED_DES& operator=(const TEST_PRELOADED_DES&) = delete; + TEST_PRELOADED_DES(TEST_PRELOADED_DES&&) = default; + TEST_PRELOADED_DES& operator=(TEST_PRELOADED_DES&&) = delete; + + // From TREs.c + /* + static nitf_TREDescription TEST_PRELOADED_DES_description[] = { + {NITF_BCS_N, 2, "Number of data values", "COUNT" }, + {NITF_BCS_N, 3, "Start value in ramp", "START" }, + {NITF_BCS_N, 2, "Increment between values in ramp", "INCREMENT" }, + {NITF_END, 0, NULL, NULL} + }; + */ + nitf::TREField_BCS_N<2> COUNT; + nitf::TREField_BCS_N<3> START; + nitf::TREField_BCS_N<2> INCREMENT; + + void updateFields() + { + tre_.updateFields(); + } + }; + +} // namespace TREs +} // namespace nitf \ No newline at end of file diff --git a/modules/c++/nitf/unittests/test_tre_mods++.cpp b/modules/c++/nitf/unittests/test_tre_mods++.cpp index 9c940562a..4fee6bff8 100644 --- a/modules/c++/nitf/unittests/test_tre_mods++.cpp +++ b/modules/c++/nitf/unittests/test_tre_mods++.cpp @@ -59,7 +59,7 @@ #include "nitf/TRE.hpp" #include "nitf/exports.hpp" -#include "nitf/TREField.hpp" +#include "nitf/TREsTyped.hpp" // A sample "strongly-typed" TRE. There are too many TREs (and too much unwillingness to change) to // actually hook this up. But it's kind of neat code that I don't want to lose. @@ -242,10 +242,28 @@ TEST_CASE(use_TEST_DES) { TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("TEST_PRELOADED_DES", NRT_TRUE) ); nitf::TRE preloaded("TEST_PRELOADED_DES", "TEST_PRELOADED_DES"); - test_des_(testName, preloaded, "TEST_PRELOADED_DES_"); + test_des_(testName, preloaded, ""); + + nitf::TREs::TEST_PRELOADED_DES test_preloaded_des; + test_preloaded_des.COUNT = 12; + test_preloaded_des.START = 345; + test_preloaded_des.INCREMENT = 67; + TEST_ASSERT_EQ(test_preloaded_des.COUNT, 12); + TEST_ASSERT_EQ(test_preloaded_des.START, 345); + TEST_ASSERT_EQ(test_preloaded_des.INCREMENT, 67); + + /***********************************************************/ nitf::TRE des("TEST_DES", "TEST_DES"); test_des_(testName, des, "TEST_DES_"); + + nitf::TREs::TEST_DES test_des; + test_des.TEST_DES_COUNT = 12; + test_des.TEST_DES_START = 345; + test_des.TEST_DES_INCREMENT = 67; + TEST_ASSERT_EQ(test_des.TEST_DES_COUNT, 12); + TEST_ASSERT_EQ(test_des.TEST_DES_START, 345); + TEST_ASSERT_EQ(test_des.TEST_DES_INCREMENT, 67); } TEST_CASE(use_ENGRDA) diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index abbe035c8..4e255ca19 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -62,9 +62,9 @@ The user header will have three fields - NITF_TEST_PRELOADED_DES_COUNT - Number of data values - NITF_TEST_PRELOADED_DES_START - Start value in ramp - NITF_TEST_PRELOADED_DES_INCREMENT - Increment between values in ramp + COUNT - Number of data values + START - Start value in ramp + INCREMENT - Increment between values in ramp The data is an 8-bit ramp defined by the three values. in testing, the ramp will be setup to contain printable values. @@ -72,9 +72,9 @@ /* TRE description for user header */ static nitf_TREDescription TEST_PRELOADED_DES_description[] = { - {NITF_BCS_N, 2, "Number of data values", "TEST_PRELOADED_DES_COUNT" }, - {NITF_BCS_N, 3, "Start value in ramp", "TEST_PRELOADED_DES_START" }, - {NITF_BCS_N, 2, "Increment between values in ramp", "TEST_PRELOADED_DES_INCREMENT" }, + {NITF_BCS_N, 2, "Number of data values", "COUNT" }, + {NITF_BCS_N, 3, "Start value in ramp", "START" }, + {NITF_BCS_N, 2, "Increment between values in ramp", "INCREMENT" }, {NITF_END, 0, NULL, NULL} }; static nitf_TREDescriptionInfo TEST_PRELOADED_DES_descriptions[] = { From a45b5fecfd97149b255af252dadcabc7ff6d44f4 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Wed, 15 Nov 2023 09:16:02 -0500 Subject: [PATCH 29/36] strongly-typed TEST_DES TRE --- UnitTest/nitf-c++.cpp | 2 +- modules/c++/nitf-c++.vcxproj | 1 + modules/c++/nitf-c++.vcxproj.filters | 3 + modules/c++/nitf/include/nitf/TREsTyped.hpp | 120 ++++++++++++++++++ .../c++/nitf/unittests/test_tre_mods++.cpp | 23 +++- modules/c/nitf/source/TREs.c | 12 +- 6 files changed, 152 insertions(+), 9 deletions(-) create mode 100644 modules/c++/nitf/include/nitf/TREsTyped.hpp diff --git a/UnitTest/nitf-c++.cpp b/UnitTest/nitf-c++.cpp index 700258d51..92ba3fad2 100644 --- a/UnitTest/nitf-c++.cpp +++ b/UnitTest/nitf-c++.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include diff --git a/modules/c++/nitf-c++.vcxproj b/modules/c++/nitf-c++.vcxproj index 7d08f7107..f49244c4c 100644 --- a/modules/c++/nitf-c++.vcxproj +++ b/modules/c++/nitf-c++.vcxproj @@ -161,6 +161,7 @@ + diff --git a/modules/c++/nitf-c++.vcxproj.filters b/modules/c++/nitf-c++.vcxproj.filters index 7f786dc0b..e936e94cb 100644 --- a/modules/c++/nitf-c++.vcxproj.filters +++ b/modules/c++/nitf-c++.vcxproj.filters @@ -463,5 +463,8 @@ Header Files + + Header Files + \ No newline at end of file diff --git a/modules/c++/nitf/include/nitf/TREsTyped.hpp b/modules/c++/nitf/include/nitf/TREsTyped.hpp new file mode 100644 index 000000000..10b796a12 --- /dev/null +++ b/modules/c++/nitf/include/nitf/TREsTyped.hpp @@ -0,0 +1,120 @@ +/* ========================================================================= + * This file is part of NITRO + * ========================================================================= + * + * (C) Copyright 2004 - 2014, MDA Information Systems LLC + * © Copyright 2023, Maxar Technologies, Inc. + * + * NITRO is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, If not, + * see . + * + */ + +#pragma once + +#include "TREField.hpp" + + // A sample (and simple) "strongly-typed" TRE; see ENGRDA in the +// unittests for something a bit more elaborate (not included because it's incomplete). +namespace nitf +{ +namespace TREs +{ + class TEST_DES final + { + nitf::TRE tre_; + static constexpr const char* tag = "TEST_DES"; + + public: + // from TRE::getID() + /** + * Get the TRE identifier. This is NOT the tag, however it may be the + * same value as the tag. The ID is used to identify a specific + * version/incarnation of the TRE, if multiple are possible. For most TREs, + * this value will be the same as the tag. + */ + TEST_DES(const std::string& id = "") noexcept(false) + : tre_(tag, id.empty() ? tag : id.c_str()), + TEST_DES_COUNT(tre_, "TEST_DES_COUNT"), + TEST_DES_START(tre_, "TEST_DES_START"), + TEST_DES_INCREMENT(tre_, "TEST_DES_INCREMENT") + { + } + ~TEST_DES() = default; + TEST_DES(const TEST_DES&) = delete; + TEST_DES& operator=(const TEST_DES&) = delete; + TEST_DES(TEST_DES&&) = default; + TEST_DES& operator=(TEST_DES&&) = delete; + + // From TEST_DES.c + /* + static nitf_TREDescription TEST_DES_description[] = { + {NITF_BCS_N, 2, "Number of data values", "TEST_DES_COUNT" }, + {NITF_BCS_N, 3, "Start value in ramp", "TEST_DES_START" }, + {NITF_BCS_N, 2, "Increment between values in ramp", "TEST_DES_INCREMENT" }, + {NITF_END, 0, NULL, NULL} + }; + */ + nitf::TREField_BCS_N<2> TEST_DES_COUNT; + nitf::TREField_BCS_N<3> TEST_DES_START; + nitf::TREField_BCS_N<2> TEST_DES_INCREMENT; + + void updateFields() + { + tre_.updateFields(); + } + }; + + class TEST_PRELOADED_DES final + { + nitf::TRE tre_; + static constexpr const char* tag = "TEST_PRELOADED_DES"; + + public: + // from TRE::getID() + /** + * Get the TRE identifier. This is NOT the tag, however it may be the + * same value as the tag. The ID is used to identify a specific + * version/incarnation of the TRE, if multiple are possible. For most TREs, + * this value will be the same as the tag. + */ + TEST_PRELOADED_DES(const std::string& id = "") noexcept(false) : tre_(tag, id.empty() ? tag : id.c_str()), + COUNT(tre_, "COUNT"), START(tre_, "START"), INCREMENT(tre_, "INCREMENT") { } + ~TEST_PRELOADED_DES() = default; + TEST_PRELOADED_DES(const TEST_PRELOADED_DES&) = delete; + TEST_PRELOADED_DES& operator=(const TEST_PRELOADED_DES&) = delete; + TEST_PRELOADED_DES(TEST_PRELOADED_DES&&) = default; + TEST_PRELOADED_DES& operator=(TEST_PRELOADED_DES&&) = delete; + + // From TREs.c + /* + static nitf_TREDescription TEST_PRELOADED_DES_description[] = { + {NITF_BCS_N, 2, "Number of data values", "COUNT" }, + {NITF_BCS_N, 3, "Start value in ramp", "START" }, + {NITF_BCS_N, 2, "Increment between values in ramp", "INCREMENT" }, + {NITF_END, 0, NULL, NULL} + }; + */ + nitf::TREField_BCS_N<2> COUNT; + nitf::TREField_BCS_N<3> START; + nitf::TREField_BCS_N<2> INCREMENT; + + void updateFields() + { + tre_.updateFields(); + } + }; + +} // namespace TREs +} // namespace nitf \ No newline at end of file diff --git a/modules/c++/nitf/unittests/test_tre_mods++.cpp b/modules/c++/nitf/unittests/test_tre_mods++.cpp index 9c940562a..f527776a0 100644 --- a/modules/c++/nitf/unittests/test_tre_mods++.cpp +++ b/modules/c++/nitf/unittests/test_tre_mods++.cpp @@ -59,7 +59,7 @@ #include "nitf/TRE.hpp" #include "nitf/exports.hpp" -#include "nitf/TREField.hpp" +#include "nitf/TREsTyped.hpp" // A sample "strongly-typed" TRE. There are too many TREs (and too much unwillingness to change) to // actually hook this up. But it's kind of neat code that I don't want to lose. @@ -242,10 +242,29 @@ TEST_CASE(use_TEST_DES) { TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("TEST_PRELOADED_DES", NRT_TRUE) ); nitf::TRE preloaded("TEST_PRELOADED_DES", "TEST_PRELOADED_DES"); - test_des_(testName, preloaded, "TEST_PRELOADED_DES_"); + test_des_(testName, preloaded, ""); + + nitf::TREs::TEST_PRELOADED_DES test_preloaded_des; + test_preloaded_des.COUNT = 12; + test_preloaded_des.START = 345; + test_preloaded_des.INCREMENT = 67; + TEST_ASSERT_EQ(test_preloaded_des.COUNT, 12); + TEST_ASSERT_EQ(test_preloaded_des.START, 345); + TEST_ASSERT_EQ(test_preloaded_des.INCREMENT, 67); + + /***********************************************************/ + nitf::Test::setNitfPluginPath(); nitf::TRE des("TEST_DES", "TEST_DES"); test_des_(testName, des, "TEST_DES_"); + + nitf::TREs::TEST_DES test_des; + test_des.TEST_DES_COUNT = 12; + test_des.TEST_DES_START = 345; + test_des.TEST_DES_INCREMENT = 67; + TEST_ASSERT_EQ(test_des.TEST_DES_COUNT, 12); + TEST_ASSERT_EQ(test_des.TEST_DES_START, 345); + TEST_ASSERT_EQ(test_des.TEST_DES_INCREMENT, 67); } TEST_CASE(use_ENGRDA) diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index abbe035c8..4e255ca19 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -62,9 +62,9 @@ The user header will have three fields - NITF_TEST_PRELOADED_DES_COUNT - Number of data values - NITF_TEST_PRELOADED_DES_START - Start value in ramp - NITF_TEST_PRELOADED_DES_INCREMENT - Increment between values in ramp + COUNT - Number of data values + START - Start value in ramp + INCREMENT - Increment between values in ramp The data is an 8-bit ramp defined by the three values. in testing, the ramp will be setup to contain printable values. @@ -72,9 +72,9 @@ /* TRE description for user header */ static nitf_TREDescription TEST_PRELOADED_DES_description[] = { - {NITF_BCS_N, 2, "Number of data values", "TEST_PRELOADED_DES_COUNT" }, - {NITF_BCS_N, 3, "Start value in ramp", "TEST_PRELOADED_DES_START" }, - {NITF_BCS_N, 2, "Increment between values in ramp", "TEST_PRELOADED_DES_INCREMENT" }, + {NITF_BCS_N, 2, "Number of data values", "COUNT" }, + {NITF_BCS_N, 3, "Start value in ramp", "START" }, + {NITF_BCS_N, 2, "Increment between values in ramp", "INCREMENT" }, {NITF_END, 0, NULL, NULL} }; static nitf_TREDescriptionInfo TEST_PRELOADED_DES_descriptions[] = { From 2b0178877a5a747027da79741fff15a1211d71c8 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Wed, 15 Nov 2023 10:40:10 -0500 Subject: [PATCH 30/36] set things up so a different set of preloaded handlers could be used --- modules/c++/nitf/source/UnitTests.cpp | 2 +- .../c/nitf/include/nitf/PluginIdentifier.h | 1 - modules/c/nitf/source/PluginRegistry.c | 96 ++++++++++++------- 3 files changed, 65 insertions(+), 34 deletions(-) diff --git a/modules/c++/nitf/source/UnitTests.cpp b/modules/c++/nitf/source/UnitTests.cpp index b735cd100..31c651133 100644 --- a/modules/c++/nitf/source/UnitTests.cpp +++ b/modules/c++/nitf/source/UnitTests.cpp @@ -271,7 +271,7 @@ static std::string buildPluginName(const std::string& base) void nitf::Test::setNitfPluginPath() { // The name of the plugin we know exists and will always be built, see test_load_plugins - static const auto p = getNitfPluginPath(buildPluginName("XML_DATA_CONTENT")); + static const auto p = getNitfPluginPath(buildPluginName("TEST_DES")); sys::OS().setEnv("NITF_PLUGIN_PATH", p.string(), true /*overwrite*/); } diff --git a/modules/c/nitf/include/nitf/PluginIdentifier.h b/modules/c/nitf/include/nitf/PluginIdentifier.h index f2cead2ad..125ccd902 100644 --- a/modules/c/nitf/include/nitf/PluginIdentifier.h +++ b/modules/c/nitf/include/nitf/PluginIdentifier.h @@ -72,7 +72,6 @@ typedef struct _nitf_TREPreloaded NITF_PLUGIN_TRE_HANDLER_FUNCTION handler; NITF_BOOL enabled; // most preloaded TREs are disabled by default } nitf_TREPreloaded; -extern nitf_TREPreloaded preloadedTREs[]; /* \brief NITF_PLUGIN_COMPRESSION_HANDLER_FUNCTION - Function pointer for diff --git a/modules/c/nitf/source/PluginRegistry.c b/modules/c/nitf/source/PluginRegistry.c index 1a27961db..191185c4b 100644 --- a/modules/c/nitf/source/PluginRegistry.c +++ b/modules/c/nitf/source/PluginRegistry.c @@ -20,6 +20,8 @@ * */ +#include + #include "nitf/PluginRegistry.h" NITFPRIV(nitf_PluginRegistry*) implicitConstruct(nitf_Error* error, FILE* log); @@ -967,15 +969,21 @@ insertCreator(nitf_DLL* dso, return nitf_HashTable_insert(hash, ident, (NITF_DATA*)dsoMain, error); } -/* - * Function is now greatly simplified. We only retrieve TREs from - * the hash table. If they are there, we are good, if not fail - * - * No more talking to the DSOs directly - */ - -static nitf_TREPreloaded* findPreloadedTRE_(const char* keyName) +// Somebody might want to use a different set of preloadedTREs, or we might even want multiple +// sets of preloaded TREs. There's nothing to support either of those right now, but it's easy enough +// to put the infrastructure in place to make it easy to hook-up. +extern nitf_TREPreloaded preloadedTREs[]; +static nitf_TREPreloaded* findPreloadedTRE_(nitf_TREPreloaded preloadedTREs[], const char* keyName) { + if (preloadedTREs == NULL) + { + return NULL; + } + if (keyName == NULL) + { + return NULL; + } + for (size_t i = 0;; i++) { const char* pKeyName = preloadedTREs[i].name; @@ -989,9 +997,9 @@ static nitf_TREPreloaded* findPreloadedTRE_(const char* keyName) } } } -static const nitf_TREPreloaded* findPreloadedTRE(const char* keyName) +static const nitf_TREPreloaded* findPreloadedTRE(nitf_TREPreloaded preloadedTREs[], const char* keyName) { - const nitf_TREPreloaded* retval = findPreloadedTRE_(keyName); + const nitf_TREPreloaded* retval = findPreloadedTRE_(preloadedTREs, keyName); if ((retval != NULL) && (retval->enabled)) { return retval; @@ -999,10 +1007,10 @@ static const nitf_TREPreloaded* findPreloadedTRE(const char* keyName) return NULL; } -NITFAPI(NITF_BOOL) -nitf_PluginRegistry_PreloadedTREHandlerEnable(const char* keyName, NITF_BOOL enable) +static NITF_BOOL PreloadedTREHandlerEnable(nitf_TREPreloaded preloadedTREs[], + const char* keyName, NITF_BOOL enable) { - nitf_TREPreloaded* result = findPreloadedTRE_(keyName); + nitf_TREPreloaded* result = findPreloadedTRE_(preloadedTREs, keyName); if (result != NULL) { result->enabled = enable; @@ -1010,10 +1018,19 @@ nitf_PluginRegistry_PreloadedTREHandlerEnable(const char* keyName, NITF_BOOL ena } return NRT_FALSE; } +NITFAPI(NITF_BOOL) +nitf_PluginRegistry_PreloadedTREHandlerEnable(const char* keyName, NITF_BOOL enable) +{ + return PreloadedTREHandlerEnable(preloadedTREs, keyName, enable); +} -NITFAPI(void) -nitf_PluginRegistry_PreloadedTREHandlersEnable(NITF_BOOL enable) +static void preloadedTREHandlersEnable(nitf_TREPreloaded preloadedTREs[], NITF_BOOL enable) { + if (preloadedTREs == NULL) + { + return; + } + for (size_t i = 0;; i++) { const char* pKeyName = preloadedTREs[i].name; @@ -1025,6 +1042,11 @@ nitf_PluginRegistry_PreloadedTREHandlersEnable(NITF_BOOL enable) preloadedTREs[i].enabled = enable; } } +NITFAPI(void) +nitf_PluginRegistry_PreloadedTREHandlersEnable(NITF_BOOL enable) +{ + preloadedTREHandlersEnable(preloadedTREs, enable); +} /* * Initialize a DSO. The init hook is retrieved and called once @@ -1042,7 +1064,8 @@ static const char** preload_doInit(NITF_PLUGIN_INIT_FUNCTION init, const char* p return ident; } -static NRT_BOOL preloadTRE(const char* keyName, nitf_Error* error) +static NRT_BOOL preloadTRE(nitf_TREPreloaded preloadedTREs[], + const char* keyName, nitf_Error* error) { const char** ident; nitf_PluginRegistry* reg = nitf_PluginRegistry_getInstance(error); @@ -1056,7 +1079,7 @@ static NRT_BOOL preloadTRE(const char* keyName, nitf_Error* error) dll->lib = NULL; // not a real DLL dll->dsoMain = NULL; // filled in after successful findPreloadedTRE() - const nitf_TREPreloaded* plugin = findPreloadedTRE(keyName); + const nitf_TREPreloaded* plugin = findPreloadedTRE(preloadedTREs, keyName); if (plugin == NULL) { return NITF_FAILURE; @@ -1105,10 +1128,10 @@ nitf_PluginRegistry_retrieveTREHandler_(nitf_PluginRegistry* reg, return theHandler; } -static nitf_TREHandler* retrievePreloadedTREHandler(nitf_PluginRegistry* reg, const char* treIdent, - int* hadError, nitf_Error* error) +static nitf_TREHandler* retrievePreloadedTREHandler(nitf_TREPreloaded preloadedTREs[], + nitf_PluginRegistry* reg, const char* treIdent, int* hadError, nitf_Error* error) { - if (!preloadTRE(treIdent, error)) + if (!preloadTRE(preloadedTREs, treIdent, error)) { *hadError = 1; return NULL; @@ -1118,31 +1141,40 @@ static nitf_TREHandler* retrievePreloadedTREHandler(nitf_PluginRegistry* reg, co return nitf_PluginRegistry_retrieveTREHandler_(reg, treIdent, hadError, error); } -NITFPROT(nitf_TREHandler*) -nitf_PluginRegistry_retrieveTREHandler(nitf_PluginRegistry* reg, - const char* treIdent, - int* hadError, - nitf_Error* error) +static nitf_TREHandler* retrieveTREHandler(nitf_TREPreloaded preloadedTREs[], + nitf_PluginRegistry* reg, const char* treIdent, int* hadError, nitf_Error* error) { nitf_TREHandler* handler = nitf_PluginRegistry_retrieveTREHandler_(reg, treIdent, hadError, error); - if (*hadError) { + // Got an error; try a preloaded TRE. *hadError = 0; - return retrievePreloadedTREHandler(reg, treIdent, hadError, error); + return retrievePreloadedTREHandler(preloadedTREs, reg, treIdent, hadError, error); } - // Normally, a NULL handler is **not** an error. + // Normally, a NULL handler is **not** an error ... if (handler == NULL) { - int bad = 0; - nitf_TREHandler* preloadedHandler = retrievePreloadedTREHandler(reg, treIdent, &bad, error); + // ... but, if we can use a pre-loaded TRE, go with that. + int bad = 0; // retrievePreloadedTREHandler() might cause an error + nitf_TREHandler* preloadedHandler = retrievePreloadedTREHandler(preloadedTREs, reg, treIdent, &bad, error); if (!bad) - return preloadedHandler; + { + // no error, go with the pre-loaded handler + assert(preloadedHandler != NULL); // I supposed this *could* be NULL, but why? It makes no sense to preload a default handler. + return preloadedHandler; + } } - return handler; } +NITFPROT(nitf_TREHandler*) +nitf_PluginRegistry_retrieveTREHandler(nitf_PluginRegistry* reg, + const char* treIdent, + int* hadError, + nitf_Error* error) +{ + return retrieveTREHandler(preloadedTREs, reg, treIdent, hadError, error); +} NITFPROT(nitf_CompressionInterface*) nitf_PluginRegistry_retrieveCompInterface(const char* comp, nitf_Error* error) From b58fc1c0cf1343210dd6fece56bce48ebf846d39 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Wed, 15 Nov 2023 12:32:46 -0500 Subject: [PATCH 31/36] call nitf_PluginRegistry_PreloadedTREHandlerEnable() for TREs used in unittests --- UnitTest/UnitTest.cpp | 3 +- .../c++/nitf/unittests/test_load_plugins.cpp | 2 ++ .../c++/nitf/unittests/test_tre_create++.cpp | 3 +- .../c++/nitf/unittests/test_tre_mods++.cpp | 15 +++++++--- modules/c++/nitf/unittests/test_tre_mods.cpp | 30 +++++++++++-------- 5 files changed, 32 insertions(+), 21 deletions(-) diff --git a/UnitTest/UnitTest.cpp b/UnitTest/UnitTest.cpp index 776d94ce6..96add941b 100644 --- a/UnitTest/UnitTest.cpp +++ b/UnitTest/UnitTest.cpp @@ -7,8 +7,7 @@ // https://learn.microsoft.com/en-us/visualstudio/test/microsoft-visualstudio-testtools-cppunittestframework-api-reference?view=vs-2022 TEST_MODULE_INITIALIZE(methodName) { - nitf_PluginRegistry_PreloadedTREHandlersEnable(NRT_TRUE); - // module initialization code + nitf_PluginRegistry_PreloadedTREHandlersEnable(NRT_TRUE); nitf::Test::j2kSetNitfPluginPath(); } \ No newline at end of file diff --git a/modules/c++/nitf/unittests/test_load_plugins.cpp b/modules/c++/nitf/unittests/test_load_plugins.cpp index 7faca56d2..9e59a2405 100644 --- a/modules/c++/nitf/unittests/test_load_plugins.cpp +++ b/modules/c++/nitf/unittests/test_load_plugins.cpp @@ -78,10 +78,12 @@ TEST_CASE(test_retrieveTREHandler) TEST_CASE(test_load_PTPRAA) { + TEST_ASSERT_TRUE(nitf_PluginRegistry_PreloadedTREHandlerEnable("PTPRAA", NRT_TRUE)); retrieveTREHandler(testName, "PTPRAA"); } TEST_CASE(test_load_ENGRDA) { + TEST_ASSERT_TRUE(nitf_PluginRegistry_PreloadedTREHandlerEnable("ENGRDA", NRT_TRUE)); retrieveTREHandler(testName, "ENGRDA"); } diff --git a/modules/c++/nitf/unittests/test_tre_create++.cpp b/modules/c++/nitf/unittests/test_tre_create++.cpp index bc3f884fc..883c0fd8f 100644 --- a/modules/c++/nitf/unittests/test_tre_create++.cpp +++ b/modules/c++/nitf/unittests/test_tre_create++.cpp @@ -9,6 +9,7 @@ TEST_CASE(test_tre_create_329) { // https://github.com/mdaus/nitro/issues/329 + TEST_ASSERT_TRUE(nitf_PluginRegistry_PreloadedTREHandlerEnable("HISTOA", NRT_TRUE)); nitf::TRE tre("HISTOA", "HISTOA"); // allocates fields SYSTEM .. NEVENTS tre.setField("SYSTYPE", "M1"); TEST_ASSERT_TRUE(true); @@ -39,8 +40,6 @@ TEST_CASE(test_tre_clone_329) } TEST_MAIN( - nitf::Test::setNitfPluginPath(); - TEST_CHECK(test_tre_create_329); TEST_CHECK(test_tre_clone_329); ) diff --git a/modules/c++/nitf/unittests/test_tre_mods++.cpp b/modules/c++/nitf/unittests/test_tre_mods++.cpp index f527776a0..f4accbff8 100644 --- a/modules/c++/nitf/unittests/test_tre_mods++.cpp +++ b/modules/c++/nitf/unittests/test_tre_mods++.cpp @@ -160,7 +160,7 @@ struct /*namespace*/ TREs TEST_CASE(setFields) { - // create an ACFTA TRE + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("ACFTA", NRT_TRUE) ); nitf::TRE tre("ACFTA"); // set a field @@ -179,6 +179,7 @@ TEST_CASE(setFields) TEST_CASE(setBinaryFields) { + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("RPFHDR", NRT_TRUE) ); nitf::TRE tre("RPFHDR"); const int value = 123; tre.setField("LOCSEC", value); @@ -190,6 +191,7 @@ TEST_CASE(setBinaryFields) TEST_CASE(cloneTRE) { + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("JITCID", NRT_TRUE) ); nitf::TRE tre("JITCID"); tre.setField("FILCMT", "fyi"); @@ -203,6 +205,7 @@ TEST_CASE(cloneTRE) TEST_CASE(basicIteration) { + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("ACCPOB", NRT_TRUE) ); nitf::TRE tre("ACCPOB"); // The entire TRE is one loop, and we haven't told it @@ -253,8 +256,8 @@ TEST_CASE(use_TEST_DES) TEST_ASSERT_EQ(test_preloaded_des.INCREMENT, 67); /***********************************************************/ - nitf::Test::setNitfPluginPath(); + nitf::Test::setNitfPluginPath(); nitf::TRE des("TEST_DES", "TEST_DES"); test_des_(testName, des, "TEST_DES_"); @@ -269,6 +272,7 @@ TEST_CASE(use_TEST_DES) TEST_CASE(use_ENGRDA) { + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("ENGRDA", NRT_TRUE) ); nitf::TRE engrda("ENGRDA", "ENGRDA"); engrda.setField("RESRC", "HSS"); @@ -293,6 +297,7 @@ TEST_CASE(use_ENGRDA) TEST_CASE(use_ENGRDA_typed_fields) { + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("ENGRDA", NRT_TRUE) ); nitf::TRE engrda("ENGRDA", "ENGRDA"); nitf::TREField_BCS_A<20> RESRC(engrda, "RESRC"); @@ -325,6 +330,7 @@ TEST_CASE(use_ENGRDA_typed_fields) TEST_CASE(use_typed_ENGRDA) { + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("ENGRDA", NRT_TRUE) ); TREs::ENGRDA engrda; // nitf::TRE engrda("ENGRDA", "ENGRDA"); engrda.RESRC = "HSS"; // engrda.setField("RESRC", "HSS"); @@ -373,6 +379,7 @@ TEST_CASE(use_typed_ENGRDA) TEST_CASE(use_CSEXRB_typed_fields) { + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("CSEXRB", NRT_TRUE) ); nitf::TRE tre("CSEXRB", "CSEXRB"); constexpr auto length = 12; @@ -386,6 +393,7 @@ TEST_CASE(use_CSEXRB_typed_fields) TEST_CASE(populateWhileIterating) { + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("ACCPOB", NRT_TRUE) ); nitf::TRE tre("ACCPOB"); size_t numFields = 0; for (auto it = tre.begin(); it != tre.end(); ++it) @@ -410,6 +418,7 @@ TEST_CASE(populateWhileIterating) TEST_CASE(overflowingNumericFields) { + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("CSCRNA", NRT_TRUE) ); nitf::TRE tre("CSCRNA"); // This field has a length of 9, so check that it's properly @@ -438,8 +447,6 @@ TEST_CASE(overflowingNumericFields) } TEST_MAIN( - nitf::Test::setNitfPluginPath(); - TEST_CHECK(setFields); TEST_CHECK(setBinaryFields); TEST_CHECK(cloneTRE); diff --git a/modules/c++/nitf/unittests/test_tre_mods.cpp b/modules/c++/nitf/unittests/test_tre_mods.cpp index 5bee638c7..e7246b1e1 100644 --- a/modules/c++/nitf/unittests/test_tre_mods.cpp +++ b/modules/c++/nitf/unittests/test_tre_mods.cpp @@ -26,6 +26,8 @@ TEST_CASE(testNestedMod) { + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("ACCHZB", NRT_TRUE) ); + nitf_Error error; NITF_BOOL exists; nitf_TRE* tre = nitf_TRE_construct("ACCHZB", NULL, &error); @@ -59,6 +61,8 @@ TEST_CASE(testNestedMod) TEST_CASE(testIncompleteCondMod) { + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("ACCPOB", NRT_TRUE) ); + nitf_Error error; NITF_BOOL exists; nitf_TRE* tre = nitf_TRE_construct("ACCPOB", NULL, &error); @@ -90,6 +94,7 @@ TEST_CASE(testClone) nitf_Field* clonedField = NULL; nitf_Error error; + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("JITCID", NRT_TRUE) ); nitf_TRE* tre = nitf_TRE_construct("JITCID", NULL, &error); TEST_ASSERT(tre != NULL); @@ -110,13 +115,14 @@ TEST_CASE(testClone) TEST_CASE(testBasicMod) { + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("ACFTA", NRT_TRUE) ); + /* construct a tre */ NITF_BOOL exists; nitf_Error error; - nitf_Field* field; nitf_TRE *tre = nitf_TRE_construct("ACFTA", "ACFTA_132", &error); TEST_ASSERT(tre != NULL); - field = (nitf_TRE_getField(tre, "AC_MSN_ID")); + nitf_Field* field = (nitf_TRE_getField(tre, "AC_MSN_ID")); TEST_ASSERT_EQ_STR(field->raw, " "); exists = nitf_TRE_setField(tre, "AC_MSN_ID", "fly-by", 6, &error); @@ -139,6 +145,7 @@ TEST_CASE(testBasicMod) TEST_CASE(testSize) { + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("AIMIDB", NRT_TRUE) ); nitf_Error error; int treLength; nitf_TRE* tre = nitf_TRE_construct("AIMIDB", NULL, &error); @@ -174,18 +181,17 @@ TEST_CASE(iterateUnfilled) TEST_CASE(populateThenIterate) { + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("ACCPOB", NRT_TRUE) ); nitf_Error error; - nitf_TRECursor cursor; nitf_TRE* tre = nitf_TRE_construct("ACCPOB", NULL, &error); - uint32_t numFields = 0; - TEST_ASSERT(tre != NULL); + TEST_ASSERT_NOT_NULL(tre); + uint32_t numFields = 0; nitf_TRE_setField(tre, "NUMACPO", "2", 1, &error); nitf_TRE_setField(tre, "NUMPTS[0]", "3", 1, &error); nitf_TRE_setField(tre, "NUMPTS[1]", "2", 1, &error); - cursor = nitf_TRECursor_begin(tre); - + nitf_TRECursor cursor = nitf_TRECursor_begin(tre); while (!nitf_TRECursor_isDone(&cursor)) { TEST_ASSERT(nitf_TRECursor_iterate(&cursor, &error) != 0); @@ -200,13 +206,13 @@ TEST_CASE(populateThenIterate) TEST_CASE(populateWhileIterating) { + TEST_ASSERT_TRUE( nitf_PluginRegistry_PreloadedTREHandlerEnable("ACCPOB", NRT_TRUE) ); nitf_Error error; - nitf_TRECursor cursor; nitf_TRE* tre = nitf_TRE_construct("ACCPOB", NULL, &error); - uint32_t numFields = 0; - TEST_ASSERT(tre != NULL); + TEST_ASSERT_NOT_NULL(tre); - cursor = nitf_TRECursor_begin(tre); + uint32_t numFields = 0; + nitf_TRECursor cursor = nitf_TRECursor_begin(tre); while (!nitf_TRECursor_isDone(&cursor)) { TEST_ASSERT(nitf_TRECursor_iterate(&cursor, &error) != 0); @@ -231,8 +237,6 @@ TEST_CASE(populateWhileIterating) } TEST_MAIN( - nitf::Test::setNitfPluginPath(); - TEST_CHECK(testClone); TEST_CHECK(testSize); TEST_CHECK(testBasicMod); From 8dc388fb91ec6301c609cb36518eebeec574fb92 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Wed, 15 Nov 2023 12:53:58 -0500 Subject: [PATCH 32/36] only one chance to set NITF_PLUGIN_PATH --- modules/c++/nitf/unittests/test_tre_mods++.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/c++/nitf/unittests/test_tre_mods++.cpp b/modules/c++/nitf/unittests/test_tre_mods++.cpp index f4accbff8..bb9963e03 100644 --- a/modules/c++/nitf/unittests/test_tre_mods++.cpp +++ b/modules/c++/nitf/unittests/test_tre_mods++.cpp @@ -257,7 +257,6 @@ TEST_CASE(use_TEST_DES) /***********************************************************/ - nitf::Test::setNitfPluginPath(); nitf::TRE des("TEST_DES", "TEST_DES"); test_des_(testName, des, "TEST_DES_"); @@ -447,6 +446,9 @@ TEST_CASE(overflowingNumericFields) } TEST_MAIN( + // must be set before making any NITRO calls + nitf::Test::setNitfPluginPath(); + TEST_CHECK(setFields); TEST_CHECK(setBinaryFields); TEST_CHECK(cloneTRE); From 42db3558b9765f9b32a2916bfe3a657c5d678a83 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Thu, 16 Nov 2023 10:47:08 -0500 Subject: [PATCH 33/36] allow TREs to be preloaded (enabled) outside of code via NITF_PRELOAD_TRES --- UnitTest/UnitTest.cpp | 4 +- .../c/nitf/include/nitf/PluginIdentifier.h | 2 +- modules/c/nitf/source/PluginRegistry.c | 69 ++++++++++++++++--- modules/c/nitf/source/TREs.c | 4 +- 4 files changed, 67 insertions(+), 12 deletions(-) diff --git a/UnitTest/UnitTest.cpp b/UnitTest/UnitTest.cpp index 96add941b..6c3139937 100644 --- a/UnitTest/UnitTest.cpp +++ b/UnitTest/UnitTest.cpp @@ -8,6 +8,8 @@ TEST_MODULE_INITIALIZE(methodName) { // module initialization code - nitf_PluginRegistry_PreloadedTREHandlersEnable(NRT_TRUE); + //nitf_PluginRegistry_PreloadedTREHandlersEnable(NRT_TRUE); + _putenv("NITF_PRELOAD_TRES=default"); + nitf::Test::j2kSetNitfPluginPath(); } \ No newline at end of file diff --git a/modules/c/nitf/include/nitf/PluginIdentifier.h b/modules/c/nitf/include/nitf/PluginIdentifier.h index 125ccd902..4f025bc58 100644 --- a/modules/c/nitf/include/nitf/PluginIdentifier.h +++ b/modules/c/nitf/include/nitf/PluginIdentifier.h @@ -70,7 +70,7 @@ typedef struct _nitf_TREPreloaded const char* name; NITF_PLUGIN_INIT_FUNCTION init; NITF_PLUGIN_TRE_HANDLER_FUNCTION handler; - NITF_BOOL enabled; // most preloaded TREs are disabled by default + int enabled; // most preloaded TREs are "not set" (disabled) by default } nitf_TREPreloaded; /* diff --git a/modules/c/nitf/source/PluginRegistry.c b/modules/c/nitf/source/PluginRegistry.c index e675d5360..88f142645 100644 --- a/modules/c/nitf/source/PluginRegistry.c +++ b/modules/c/nitf/source/PluginRegistry.c @@ -522,7 +522,7 @@ nitf_PluginRegistry_loadPlugin(const char* fullName, nitf_Error* error) nitf_Utils_baseName(keyName, fullName, NITF_DLL_EXTENSION); /* Now init the plugin!!! */ - ident = doInit(dll, keyName, error); + ident = doInit(dll, keyName, error); return insertPlugin_("Successfully loaded plugin: [%s] at [%p]\n", reg, ident, dll, error); } @@ -971,8 +971,60 @@ insertCreator(nitf_DLL* dso, // Somebody might want to use a different set of preloadedTREs, or we might even want multiple // sets of preloaded TREs. There's nothing to support either of those right now, but it's easy enough -// to put the infrastructure in place to make it easy to hook-up. -extern nitf_TREPreloaded defaultPreloadedTREs[]; +// to put the infrastructure in place. +static nitf_TREPreloaded* getPreloadedTREs(const char* name) +{ + // Convert a name (e.g., "default") to a set of preloaded TREs. + // Only "default" is currently supported; see TREs.c + if (strcmp(name, "default") == 0) + { + extern nitf_TREPreloaded defaultPreloadedTREs[]; + return defaultPreloadedTREs; + } + return NULL; +} + +static void enable_notset_TREs(nitf_TREPreloaded preloadedTREs[], NITF_BOOL enable) +{ + // NITF_PRELOAD_TRES is set, update all TREs which haven't been touched + for (size_t i = 0;; i++) + { + const char* pKeyName = preloadedTREs[i].name; + if (pKeyName == NULL) // end of list + { + return; + } + if (preloadedTREs[i].enabled < 0) // default is -1 "not set" + { + preloadedTREs[i].enabled = enable; + } + } +} +static nitf_TREPreloaded* getNitfPreloadedTREs(const char* name) +{ + // If NITF_PRELOAD_TRES is set to *name*", we'll preload those TREs. + // This will NOT override a call to nitf_PluginRegistry_PreloadedTREHandlersEnable(). + // By default, the `enabled` status of TREs is set to -1 "not set." + const char* nitfPreloadTREs = getenv("NITF_PRELOAD_TRES"); + if ((nitfPreloadTREs != NULL) && (strcmp(nitfPreloadTREs, name) == 0)) + { + nitf_TREPreloaded* preloadedTREs = getPreloadedTREs(name); + if (preloadedTREs != NULL) + { + enable_notset_TREs(preloadedTREs, NRT_TRUE /*enable*/); + return preloadedTREs; + } + } + + // Enviroment variable not set (or not set to *name*), return preloaded TREs as-is. + return getPreloadedTREs(name); +} +static nitf_TREPreloaded* getDefaultPreloadedTREs() +{ + static nitf_TREPreloaded* defaultPreloadedTREs = getNitfPreloadedTREs("default"); + return defaultPreloadedTREs; +} + static nitf_TREPreloaded* findPreloadedTRE_(nitf_TREPreloaded preloadedTREs[], const char* keyName) { if (preloadedTREs == NULL) @@ -1000,7 +1052,7 @@ static nitf_TREPreloaded* findPreloadedTRE_(nitf_TREPreloaded preloadedTREs[], c static const nitf_TREPreloaded* findPreloadedTRE(nitf_TREPreloaded preloadedTREs[], const char* keyName) { const nitf_TREPreloaded* retval = findPreloadedTRE_(preloadedTREs, keyName); - if ((retval != NULL) && (retval->enabled)) + if ((retval != NULL) && (retval->enabled == NRT_TRUE)) { return retval; } @@ -1021,7 +1073,7 @@ static NITF_BOOL PreloadedTREHandlerEnable(nitf_TREPreloaded preloadedTREs[], NITFAPI(NITF_BOOL) nitf_PluginRegistry_PreloadedTREHandlerEnable(const char* keyName, NITF_BOOL enable) { - return PreloadedTREHandlerEnable(defaultPreloadedTREs, keyName, enable); + return PreloadedTREHandlerEnable(getDefaultPreloadedTREs(), keyName, enable); } static void preloadedTREHandlersEnable(nitf_TREPreloaded preloadedTREs[], NITF_BOOL enable) @@ -1045,7 +1097,7 @@ static void preloadedTREHandlersEnable(nitf_TREPreloaded preloadedTREs[], NITF_B NITFAPI(void) nitf_PluginRegistry_PreloadedTREHandlersEnable(NITF_BOOL enable) { - preloadedTREHandlersEnable(defaultPreloadedTREs, enable); + preloadedTREHandlersEnable(getDefaultPreloadedTREs(), enable); } /* @@ -1067,7 +1119,6 @@ static const char** preload_doInit(NITF_PLUGIN_INIT_FUNCTION init, const char* p static NRT_BOOL preloadTRE(nitf_TREPreloaded preloadedTREs[], const char* keyName, nitf_Error* error) { - const char** ident; nitf_PluginRegistry* reg = nitf_PluginRegistry_getInstance(error); /* Construct the DLL object */ @@ -1087,7 +1138,7 @@ static NRT_BOOL preloadTRE(nitf_TREPreloaded preloadedTREs[], dll->dsoMain = (NRT_DLL_FUNCTION_PTR)plugin->handler; /* Now init the plugin!!! */ - ident = preload_doInit(plugin->init, keyName, error); + const char** ident = preload_doInit(plugin->init, keyName, error); return insertPlugin_("Successfully pre-loaded plugin: [%s] at [%p]\n", reg, ident, dll, error); } @@ -1173,7 +1224,7 @@ nitf_PluginRegistry_retrieveTREHandler(nitf_PluginRegistry* reg, int* hadError, nitf_Error* error) { - return retrieveTREHandler(defaultPreloadedTREs, reg, treIdent, hadError, error); + return retrieveTREHandler(getDefaultPreloadedTREs(), reg, treIdent, hadError, error); } NITFPROT(nitf_CompressionInterface*) diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index c8cbf1825..8ac463b98 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -105,7 +105,7 @@ static nitf_TREHandler* TEST_PRELOADED_DES_handler(nitf_Error* error) { /******************************************************************************/ #define NITF_preload_TRE_(Tre_, enabled_) { #Tre_, Tre_##_init, Tre_##_handler, enabled_ } -#define NITF_preload_TRE(Tre_) NITF_preload_TRE_(Tre_, NRT_FALSE /*enabled*/) +#define NITF_preload_TRE(Tre_) NITF_preload_TRE_(Tre_, -1 /*not set*/) nitf_TREPreloaded defaultPreloadedTREs[] = { // Not preloading any TREs right now: with the existing system, @@ -122,7 +122,9 @@ nitf_TREPreloaded defaultPreloadedTREs[] = { NITF_preload_TRE(JITCID), NITF_preload_TRE(PTPRAA), NITF_preload_TRE(RPFHDR), + NITF_preload_TRE(XML_DATA_CONTENT), + //NITF_preload_TRE(TEST_DES), // This should ALWAYS come from the DLL/SO NITF_preload_TRE_(TEST_PRELOADED_DES, NRT_TRUE /*enabled*/), { NULL, NULL, NULL, NRT_FALSE } // end of list From 88a4fdb5997d3a589cfd99610bdabd639e8416b6 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Thu, 16 Nov 2023 11:04:27 -0500 Subject: [PATCH 34/36] fix build error: limited static initialization in C --- UnitTest/UnitTest.cpp | 2 +- modules/c/nitf/source/PluginRegistry.c | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/UnitTest/UnitTest.cpp b/UnitTest/UnitTest.cpp index 6c3139937..ea4c5718f 100644 --- a/UnitTest/UnitTest.cpp +++ b/UnitTest/UnitTest.cpp @@ -9,7 +9,7 @@ TEST_MODULE_INITIALIZE(methodName) { // module initialization code //nitf_PluginRegistry_PreloadedTREHandlersEnable(NRT_TRUE); - _putenv("NITF_PRELOAD_TRES=default"); + _putenv("NITF_PRELOADED_TRE_HANDLERS_ENABLE=default"); nitf::Test::j2kSetNitfPluginPath(); } \ No newline at end of file diff --git a/modules/c/nitf/source/PluginRegistry.c b/modules/c/nitf/source/PluginRegistry.c index 88f142645..de91409a1 100644 --- a/modules/c/nitf/source/PluginRegistry.c +++ b/modules/c/nitf/source/PluginRegistry.c @@ -1002,11 +1002,11 @@ static void enable_notset_TREs(nitf_TREPreloaded preloadedTREs[], NITF_BOOL enab } static nitf_TREPreloaded* getNitfPreloadedTREs(const char* name) { - // If NITF_PRELOAD_TRES is set to *name*", we'll preload those TREs. - // This will NOT override a call to nitf_PluginRegistry_PreloadedTREHandlersEnable(). - // By default, the `enabled` status of TREs is set to -1 "not set." - const char* nitfPreloadTREs = getenv("NITF_PRELOAD_TRES"); - if ((nitfPreloadTREs != NULL) && (strcmp(nitfPreloadTREs, name) == 0)) + // If NITF_PRELOADED_TRE_HANDLERS_ENABLE is set to *name*", we'll preload those TREs. + // This will NOT override a call to nitf_PluginRegistry_PreloadedTREHandlersEnable(); + // by default, the `enabled` status of TREs is set to -1 "not set." + const char* envVar = getenv("NITF_PRELOADED_TRE_HANDLERS_ENABLE"); + if ((envVar != NULL) && (strcmp(envVar, name) == 0)) { nitf_TREPreloaded* preloadedTREs = getPreloadedTREs(name); if (preloadedTREs != NULL) @@ -1021,8 +1021,7 @@ static nitf_TREPreloaded* getNitfPreloadedTREs(const char* name) } static nitf_TREPreloaded* getDefaultPreloadedTREs() { - static nitf_TREPreloaded* defaultPreloadedTREs = getNitfPreloadedTREs("default"); - return defaultPreloadedTREs; + return getNitfPreloadedTREs("default"); } static nitf_TREPreloaded* findPreloadedTRE_(nitf_TREPreloaded preloadedTREs[], const char* keyName) From 1bc84287f23d305b43613fd88be8fd48f15e7331 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Thu, 16 Nov 2023 11:22:59 -0500 Subject: [PATCH 35/36] NRT_BOOL vs bool, C/C++ :-( --- modules/c/nitf/source/PluginRegistry.c | 19 ++++++++++++++----- modules/c/nrt/include/nrt/Types.h | 10 +++++++--- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/modules/c/nitf/source/PluginRegistry.c b/modules/c/nitf/source/PluginRegistry.c index de91409a1..992cccd7a 100644 --- a/modules/c/nitf/source/PluginRegistry.c +++ b/modules/c/nitf/source/PluginRegistry.c @@ -1051,9 +1051,14 @@ static nitf_TREPreloaded* findPreloadedTRE_(nitf_TREPreloaded preloadedTREs[], c static const nitf_TREPreloaded* findPreloadedTRE(nitf_TREPreloaded preloadedTREs[], const char* keyName) { const nitf_TREPreloaded* retval = findPreloadedTRE_(preloadedTREs, keyName); - if ((retval != NULL) && (retval->enabled == NRT_TRUE)) + if (retval != NULL) { - return retval; + if (retval->enabled < 0) + { + return NULL; // "not set" == disabled + } + const NRT_BOOL enabled = retval->enabled ? NRT_TRUE : NRT_FALSE; + return enabled ? retval : NULL; } return NULL; } @@ -1061,10 +1066,15 @@ static const nitf_TREPreloaded* findPreloadedTRE(nitf_TREPreloaded preloadedTREs static NITF_BOOL PreloadedTREHandlerEnable(nitf_TREPreloaded preloadedTREs[], const char* keyName, NITF_BOOL enable) { + if (preloadedTREs == NULL) + { + return NRT_FALSE; + } + nitf_TREPreloaded* result = findPreloadedTRE_(preloadedTREs, keyName); if (result != NULL) { - result->enabled = enable; + result->enabled = enable ? NRT_TRUE : NRT_FALSE; return NRT_TRUE; } return NRT_FALSE; @@ -1089,8 +1099,7 @@ static void preloadedTREHandlersEnable(nitf_TREPreloaded preloadedTREs[], NITF_B { return; } - - preloadedTREs[i].enabled = enable; + preloadedTREs[i].enabled = enable ? NRT_TRUE : NRT_FALSE; } } NITFAPI(void) diff --git a/modules/c/nrt/include/nrt/Types.h b/modules/c/nrt/include/nrt/Types.h index 5788684fa..58a2a2420 100644 --- a/modules/c/nrt/include/nrt/Types.h +++ b/modules/c/nrt/include/nrt/Types.h @@ -159,9 +159,13 @@ typedef int nrt_CreationFlags; #define NRT_SUCCESS (1) #define NRT_FAILURE (0) -#define NRT_TRUE (1) -#define NRT_FALSE (0) - +#ifdef __cplusplus + #define NRT_TRUE (true) + #define NRT_FALSE (false) +#else + #define NRT_TRUE (1) + #define NRT_FALSE (0) +#endif #if defined(__cplusplus) && !defined(SWIGPYTHON) // "enum class" for C++ w/o SWIG From c7c30bdc0bb427e4dddc8e0400c613ea8b768b67 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 19 Dec 2023 11:09:49 -0500 Subject: [PATCH 36/36] setup remaining TREs for pre-loading --- .../c++/nitf/unittests/test_load_plugins.cpp | 5 - modules/c/nitf/shared/ACCVTB.c | 4 +- modules/c/nitf/shared/ACFTB.c | 4 +- modules/c/nitf/shared/AIPBCA.c | 4 +- modules/c/nitf/shared/ASTORA.c | 4 +- modules/c/nitf/shared/BANDSA.c | 4 +- modules/c/nitf/shared/BANDSB.c | 4 +- modules/c/nitf/shared/BCKGDA.c | 4 +- modules/c/nitf/shared/BLOCKA.c | 4 +- modules/c/nitf/shared/BNDPLB.c | 4 +- modules/c/nitf/shared/CCINFA.c | 4 +- modules/c/nitf/shared/CLCTNA.c | 4 +- modules/c/nitf/shared/CLCTNB.c | 4 +- modules/c/nitf/shared/CMETAA.c | 4 +- modules/c/nitf/shared/CSCCGA.c | 4 +- modules/c/nitf/shared/CSDIDA.c | 4 +- modules/c/nitf/shared/CSEPHA.c | 4 +- modules/c/nitf/shared/CSEXRA.c | 4 +- modules/c/nitf/shared/CSPROA.c | 4 +- modules/c/nitf/shared/CSSFAA.c | 4 +- modules/c/nitf/shared/CSSHPA.c | 4 +- modules/c/nitf/shared/EXOPTA.c | 4 +- modules/c/nitf/shared/EXPLTA.c | 4 +- modules/c/nitf/shared/EXPLTB.c | 4 +- modules/c/nitf/shared/GEOLOB.c | 4 +- modules/c/nitf/shared/GEOPSB.c | 4 +- modules/c/nitf/shared/GRDPSB.c | 4 +- modules/c/nitf/shared/ICHIPB.c | 4 +- modules/c/nitf/shared/IMASDA.c | 4 +- modules/c/nitf/shared/IMGDTA.c | 4 +- modules/c/nitf/shared/IMRFCA.c | 4 +- modules/c/nitf/shared/IOMAPA.c | 4 +- modules/c/nitf/shared/J2KLRA.c | 4 +- modules/c/nitf/shared/MAPLOB.c | 4 +- modules/c/nitf/shared/MATESA.c | 4 +- modules/c/nitf/shared/MENSRA.c | 4 +- modules/c/nitf/shared/MENSRB.c | 4 +- modules/c/nitf/shared/MPDSRA.c | 4 +- modules/c/nitf/shared/MSDIRA.c | 4 +- modules/c/nitf/shared/MSTGTA.c | 4 +- modules/c/nitf/shared/MTIRPA.c | 4 +- modules/c/nitf/shared/MTIRPB.c | 4 +- modules/c/nitf/shared/NBLOCA.c | 4 +- modules/c/nitf/shared/OBJCTA.c | 4 +- modules/c/nitf/shared/OFFSET.c | 4 +- modules/c/nitf/shared/PATCHA.c | 4 +- modules/c/nitf/shared/PATCHB.c | 4 +- modules/c/nitf/shared/PIAEQA.c | 4 +- modules/c/nitf/shared/PIAEVA.c | 4 +- modules/c/nitf/shared/PIAIMB.c | 4 +- modules/c/nitf/shared/PIAIMC.c | 4 +- modules/c/nitf/shared/PIAPEA.c | 4 +- modules/c/nitf/shared/PIAPEB.c | 4 +- modules/c/nitf/shared/PIAPRC.c | 4 +- modules/c/nitf/shared/PIAPRD.c | 4 +- modules/c/nitf/shared/PIATGA.c | 4 +- modules/c/nitf/shared/PIATGB.c | 4 +- modules/c/nitf/shared/PIXQLA.c | 4 +- modules/c/nitf/shared/PLTFMA.c | 4 +- modules/c/nitf/shared/PRADAA.c | 4 +- modules/c/nitf/shared/PRJPSB.c | 4 +- modules/c/nitf/shared/REGPTB.c | 4 +- modules/c/nitf/shared/RPC00B.c | 4 +- modules/c/nitf/shared/RPFDES.c | 4 +- modules/c/nitf/shared/RPFIMG.c | 4 +- modules/c/nitf/shared/RSMAPA.c | 4 +- modules/c/nitf/shared/RSMDCA.c | 4 +- modules/c/nitf/shared/RSMECA.c | 4 +- modules/c/nitf/shared/RSMGGA.c | 4 +- modules/c/nitf/shared/RSMGIA.c | 4 +- modules/c/nitf/shared/RSMIDA.c | 4 +- modules/c/nitf/shared/RSMPCA.c | 4 +- modules/c/nitf/shared/RSMPIA.c | 4 +- modules/c/nitf/shared/SECTGA.c | 4 +- modules/c/nitf/shared/SENSRA.c | 4 +- modules/c/nitf/shared/SENSRB.c | 4 +- modules/c/nitf/shared/SNSPSB.c | 4 +- modules/c/nitf/shared/SNSRA.c | 4 +- modules/c/nitf/shared/SOURCB.c | 4 +- modules/c/nitf/shared/STDIDC.c | 4 +- modules/c/nitf/shared/STEROB.c | 4 +- modules/c/nitf/shared/STREOB.c | 4 +- modules/c/nitf/shared/TRGTA.c | 4 +- modules/c/nitf/shared/USE00A.c | 4 +- modules/c/nitf/source/TREs.c | 196 ++++++++++++++++-- 85 files changed, 348 insertions(+), 185 deletions(-) diff --git a/modules/c++/nitf/unittests/test_load_plugins.cpp b/modules/c++/nitf/unittests/test_load_plugins.cpp index 9e59a2405..91b497968 100644 --- a/modules/c++/nitf/unittests/test_load_plugins.cpp +++ b/modules/c++/nitf/unittests/test_load_plugins.cpp @@ -49,10 +49,6 @@ static const auto& all_TREs() { static const std::vector retval { - #if _MSC_VER && NITRO_PCH - // only build a handful in Visual Studio - "ACCHZB", "ACCPOB", "ACFTA", "AIMIDB", "CSCRNA", "CSEXRB", "ENGRDA", "HISTOA", "JITCID", "PTPRAA", "RPFHDR", - #else "ACCHZB", "BANDSB", "CSDIDA", "GEOLOB", "JITCID", "NBLOCA", "PIAPEB", "REGPTB", "RSMIDA", "STEROB", "ACCPOB", "BCKGDA", "CSEPHA", "GEOPSB", "MAPLOB", "OBJCTA", "PIAPRC", "RPC00B", "RSMPCA", "STREOB", "ACCVTB", "BLOCKA", "CSEXRA", "GRDPSB", "MATESA", "OFFSET", "PIAPRD", "RPFDES", "RSMPIA", "TEST_DES", @@ -63,7 +59,6 @@ static const auto& all_TREs() "AIPBCA", "CMETAA", "EXOPTA", "IMRFCA", "MSTGTA", "PIAIMB", "PRADAA", "RSMECA", "SNSRA", "ASTORA", "CSCCGA", "EXPLTA", "IOMAPA", "MTIRPA", "PIAIMC", "PRJPSB", "RSMGGA", "SOURCB", "BANDSA", "CSCRNA", "EXPLTB", "J2KLRA", "MTIRPB", "PIAPEA", "PTPRAA", "RSMGIA", "STDIDC", - #endif }; return retval; } diff --git a/modules/c/nitf/shared/ACCVTB.c b/modules/c/nitf/shared/ACCVTB.c index ed47e56d5..61656f12c 100644 --- a/modules/c/nitf/shared/ACCVTB.c +++ b/modules/c/nitf/shared/ACCVTB.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription ACCVTB_description[] = { {NITF_BCS_N, 2, "Number of vertical accuracy regions", "NUMACVT" }, {NITF_LOOP, 0, NULL, "NUMACVT"}, @@ -46,6 +46,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(ACCVTB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(ACCVTB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/ACFTB.c b/modules/c/nitf/shared/ACFTB.c index 0d1d335ad..f85afbf08 100644 --- a/modules/c/nitf/shared/ACFTB.c +++ b/modules/c/nitf/shared/ACFTB.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription ACFTB_description[] = { {NITF_BCS_A, 20, "Aircraft Mission ID", "AC_MSN_ID" }, {NITF_BCS_A, 10, "Aircraft Tail Number", "AC_TAIL_NO" }, {NITF_BCS_A, 12, "Acrft Takeoff Date/Time", "AC_TO" }, @@ -56,6 +56,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(ACFTB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(ACFTB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/AIPBCA.c b/modules/c/nitf/shared/AIPBCA.c index 011edb836..5663b65a0 100644 --- a/modules/c/nitf/shared/AIPBCA.c +++ b/modules/c/nitf/shared/AIPBCA.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription AIPBCA_description[] = { {NITF_BCS_N, 5, "Patch Width", "Patch_Width", }, {NITF_BCS_A, 16, "Semi-major axis (x component)", "u_hat_x" }, {NITF_BCS_A, 16, "Semi-major axis (y component)", "u_hat_y" }, @@ -78,6 +78,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(AIPBCA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(AIPBCA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/ASTORA.c b/modules/c/nitf/shared/ASTORA.c index 352d88e10..e372f9c7b 100644 --- a/modules/c/nitf/shared/ASTORA.c +++ b/modules/c/nitf/shared/ASTORA.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription ASTORA_description[] = { {NITF_BCS_N, 6, "Number of rows in full image prod.", "IMG_TOTAL_ROWS" }, {NITF_BCS_N, 6, "Number of columns in full image prod.", @@ -174,6 +174,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(ASTORA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(ASTORA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/BANDSA.c b/modules/c/nitf/shared/BANDSA.c index f5f75a3f7..f5d2e1595 100644 --- a/modules/c/nitf/shared/BANDSA.c +++ b/modules/c/nitf/shared/BANDSA.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription BANDSA_description[] = { {NITF_BCS_A, 7, "ROW_SPACING", "ROW_SPACING" }, {NITF_BCS_A, 1, "ROW_SPACING_UNITS", "ROW_SPACING_UNITS" }, {NITF_BCS_A, 7, "COL_SPACING", "COL_SPACING" }, @@ -45,6 +45,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(BANDSA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(BANDSA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/BANDSB.c b/modules/c/nitf/shared/BANDSB.c index b9e82039c..69f8711cb 100644 --- a/modules/c/nitf/shared/BANDSB.c +++ b/modules/c/nitf/shared/BANDSB.c @@ -26,7 +26,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription BANDSB_description[] = { {NITF_BCS_N, 5, "Number of Bands", "COUNT" }, {NITF_BCS_A, 24, "Data Representation", "RADIOMETRIC_QUANTITY" }, {NITF_BCS_A, 1, "Data Representation Unit", "RADIOMETRIC_QUANTITY_UNIT" }, @@ -191,7 +191,7 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(BANDSB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(BANDSB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/BCKGDA.c b/modules/c/nitf/shared/BCKGDA.c index df7a57e80..c48cb5cd9 100644 --- a/modules/c/nitf/shared/BCKGDA.c +++ b/modules/c/nitf/shared/BCKGDA.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription BCKGDA_description[] = { {NITF_BCS_N, 8, "Background Width", "BGWIDTH" }, {NITF_BCS_N, 8, "Background Height", "BGHEIGHT" }, {NITF_BCS_N, 8, "Background Red", "BGRED" }, @@ -35,6 +35,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(BCKGDA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(BCKGDA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/BLOCKA.c b/modules/c/nitf/shared/BLOCKA.c index 47404830d..d207d3281 100644 --- a/modules/c/nitf/shared/BLOCKA.c +++ b/modules/c/nitf/shared/BLOCKA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription BLOCKA_description[] = { {NITF_BCS_N, 2, "Block Number", "BLOCK_INSTANCE" }, {NITF_BCS_A, 5, "No. of Gray Pixels", "N_GRAY" }, {NITF_BCS_N, 5, "Lines", "L_LINES" }, @@ -40,6 +40,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(BLOCKA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(BLOCKA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/BNDPLB.c b/modules/c/nitf/shared/BNDPLB.c index 4405fdea3..073395c54 100644 --- a/modules/c/nitf/shared/BNDPLB.c +++ b/modules/c/nitf/shared/BNDPLB.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription BNDPLB_description[] = { {NITF_BCS_N, 4, "Number of Points in Bounding Polygon", "NUMPTS" }, {NITF_LOOP, 0, NULL, "NUMPTS"}, {NITF_BCS_N, 15, "Longitude/Easting", "LON" }, @@ -33,6 +33,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(BNDPLB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(BNDPLB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/CCINFA.c b/modules/c/nitf/shared/CCINFA.c index df154dfaf..0145c3e20 100644 --- a/modules/c/nitf/shared/CCINFA.c +++ b/modules/c/nitf/shared/CCINFA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription CCINFA_description[] = { {NITF_BCS_N, 3, "Number of defined codes", "NUMCODE" }, {NITF_LOOP, 0, NULL, "NUMCODE"}, {NITF_BCS_N, 1, "Length of the CODE field", "CODE_LEN" }, @@ -43,6 +43,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(CCINFA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(CCINFA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/CLCTNA.c b/modules/c/nitf/shared/CLCTNA.c index 633ea16ad..c5d6ebe89 100644 --- a/modules/c/nitf/shared/CLCTNA.c +++ b/modules/c/nitf/shared/CLCTNA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription CLCTNA_description[] = { {NITF_BCS_N, 4, "VERNUM", "VERNUM" }, {NITF_BCS_A, 25, "CLCTN_NAME", "CLCTN_NAME" }, {NITF_BCS_A, 255, "CLCTN_DESCRIPT", "CLCTN_DESCRIPT" }, @@ -57,6 +57,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(CLCTNA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(CLCTNA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/CLCTNB.c b/modules/c/nitf/shared/CLCTNB.c index 3a0bb037a..6b738b345 100644 --- a/modules/c/nitf/shared/CLCTNB.c +++ b/modules/c/nitf/shared/CLCTNB.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription CLCTNB_description[] = { {NITF_BCS_N, 4, "VERNUM", "VERNUM" }, {NITF_BCS_A, 25, "CLCTN_NAME", "CLCTN_NAME" }, {NITF_BCS_A, 255, "CLCTN_DESCRIPT", "CLCTN_DESCRIPT" }, @@ -61,6 +61,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(CLCTNB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(CLCTNB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/CMETAA.c b/modules/c/nitf/shared/CMETAA.c index 2168de977..811e40d6e 100644 --- a/modules/c/nitf/shared/CMETAA.c +++ b/modules/c/nitf/shared/CMETAA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription CMETAA_description[] = { {NITF_BCS_N, 2, "Number of Related TREs", "RELATED_TRES" }, {NITF_BCS_A, 120, "Related TREs", "ADDITIONAL_TRES" }, {NITF_BCS_A, 12, "Processor Version No.", "RD_PRC_NO" }, @@ -238,6 +238,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(CMETAA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(CMETAA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/CSCCGA.c b/modules/c/nitf/shared/CSCCGA.c index f3161c21f..78d7d11c1 100644 --- a/modules/c/nitf/shared/CSCCGA.c +++ b/modules/c/nitf/shared/CSCCGA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription CSCCGA_description[] = { {NITF_BCS_A, 18, "Source of Grid", "CCG_SOURCE" }, {NITF_BCS_A, 6, "Image Segment Sensor to which CCG is registered", "REG_SENSOR" }, {NITF_BCS_N, 7, "CCG Origin - Line", "ORIGIN_LINE" }, @@ -37,6 +37,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(CSCCGA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(CSCCGA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/CSDIDA.c b/modules/c/nitf/shared/CSDIDA.c index ab11b4fff..0e42f9124 100644 --- a/modules/c/nitf/shared/CSDIDA.c +++ b/modules/c/nitf/shared/CSDIDA.c @@ -26,7 +26,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription CSDIDA_description[] = { {NITF_BCS_N, 2, "Day of Dataset Collection", "DAY" }, {NITF_BCS_A, 3, "Month of Dataset Collection", "MONTH" }, {NITF_BCS_N, 4, "Year of Dataset Collection", "YEAR" }, @@ -47,7 +47,7 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(CSDIDA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(CSDIDA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/CSEPHA.c b/modules/c/nitf/shared/CSEPHA.c index e3dd2a7b9..f2fdacab6 100644 --- a/modules/c/nitf/shared/CSEPHA.c +++ b/modules/c/nitf/shared/CSEPHA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription CSEPHA_description[] = { {NITF_BCS_A, 12, "ephemeris flag", "EPHEM_FLAG" }, {NITF_BCS_N, 5, "time b/w eph vectors", "DT_EPHEM" }, {NITF_BCS_N, 8, "day of first eph vector", "DATE_EPHEM" }, @@ -39,6 +39,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(CSEPHA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(CSEPHA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/CSEXRA.c b/modules/c/nitf/shared/CSEXRA.c index 9eec1eb45..b3fd23717 100644 --- a/modules/c/nitf/shared/CSEXRA.c +++ b/modules/c/nitf/shared/CSEXRA.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription CSEXRA_description[] = { {NITF_BCS_A, 6, "Sensor", "SENSOR" }, {NITF_BCS_N, 12, "Time of the First Line of Image", "TIME_FIRST_LINE_IMAGE" }, {NITF_BCS_N, 12, "Image Duration Time", "TIME_IMAGE_DURATION" }, @@ -52,6 +52,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(CSEXRA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(CSEXRA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/CSPROA.c b/modules/c/nitf/shared/CSPROA.c index f4240bed4..e77ccf6d1 100644 --- a/modules/c/nitf/shared/CSPROA.c +++ b/modules/c/nitf/shared/CSPROA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription CSPROA_description[] = { {NITF_BCS_A, 12, "fill0", "RESERVED_0" }, {NITF_BCS_A, 12, "fill1", "RESERVED_1" }, {NITF_BCS_A, 12, "fill2", "RESERVED_2" }, @@ -39,6 +39,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(CSPROA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(CSPROA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/CSSFAA.c b/modules/c/nitf/shared/CSSFAA.c index 4e7f7e38c..3f0a40c2c 100644 --- a/modules/c/nitf/shared/CSSFAA.c +++ b/modules/c/nitf/shared/CSSFAA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription CSSFAA_description[] = { {NITF_BCS_N, 1, "number of bands", "NUM_BANDS" }, {NITF_LOOP, 0, NULL, "NUM_BANDS"}, {NITF_BCS_A, 1, "band category", "BAND_TYPE" }, @@ -45,6 +45,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(CSSFAA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(CSSFAA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/CSSHPA.c b/modules/c/nitf/shared/CSSHPA.c index cdd8fe30b..706471841 100644 --- a/modules/c/nitf/shared/CSSHPA.c +++ b/modules/c/nitf/shared/CSSHPA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription CSSHPA_description[] = { {NITF_BCS_A, 25, "Shapefile Use", "SHAPE_USE" }, {NITF_BCS_A, 10, "Type of shapes", "SHAPE_CLASS" }, {NITF_IF, 0, "eq CLOUD_SHAPES ", "SHAPE_USE"}, @@ -40,6 +40,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(CSSHPA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(CSSHPA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/EXOPTA.c b/modules/c/nitf/shared/EXOPTA.c index ea85419df..63a567210 100644 --- a/modules/c/nitf/shared/EXOPTA.c +++ b/modules/c/nitf/shared/EXOPTA.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription EXOPTA_description[] = { {NITF_BCS_A, 3, "ANGLE TO NORTH", "ANGLETONORTH" }, {NITF_BCS_A, 5, "MEAN GSD", "MEANGSD" }, {NITF_BCS_A, 1, "Reserved 1", "RESERV01" }, @@ -46,6 +46,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(EXOPTA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(EXOPTA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/EXPLTA.c b/modules/c/nitf/shared/EXPLTA.c index b7e0c9764..f7b2618a2 100644 --- a/modules/c/nitf/shared/EXPLTA.c +++ b/modules/c/nitf/shared/EXPLTA.c @@ -68,12 +68,12 @@ static nitf_TREDescription descrip_00101[] = { }; /* Define the available descriptions and the default one */ -static nitf_TREDescriptionInfo descriptions[] = { +static nitf_TREDescriptionInfo EXPLTA_descriptions[] = { { "EXPLTA_87", descrip_00087, 87 }, { "EXPLTA_101", descrip_00101, 101 }, { NULL, NULL, NITF_TRE_DESC_NO_LENGTH } }; -static nitf_TREDescriptionSet EXPLTADescriptionSet = { 0, descriptions }; +static nitf_TREDescriptionSet EXPLTADescriptionSet = { 0, EXPLTA_descriptions }; NITF_DECLARE_PLUGIN(EXPLTA) diff --git a/modules/c/nitf/shared/EXPLTB.c b/modules/c/nitf/shared/EXPLTB.c index e99a2285e..5780ce1d4 100644 --- a/modules/c/nitf/shared/EXPLTB.c +++ b/modules/c/nitf/shared/EXPLTB.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription EXPLTB_description[] = { {NITF_BCS_A, 7, "Angle to True North", "ANGLE_TO_NORTH" }, {NITF_BCS_A, 6, "Angle North Accuracy", "ANGLE_TO_NORTH_ACCY" }, {NITF_BCS_A, 7, "Squint Angle", "SQUINT_ANGLE" }, @@ -47,6 +47,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(EXPLTB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(EXPLTB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/GEOLOB.c b/modules/c/nitf/shared/GEOLOB.c index 2a04b5f5b..17107184d 100644 --- a/modules/c/nitf/shared/GEOLOB.c +++ b/modules/c/nitf/shared/GEOLOB.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription GEOLOB_description[] = { {NITF_BCS_N, 9, "Longitude density", "ARV" }, {NITF_BCS_N, 9, "Latitude density", "BRV" }, {NITF_BCS_N, 15, "Longitude of Reference Origin", "LSO" }, @@ -32,6 +32,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(GEOLOB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(GEOLOB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/GEOPSB.c b/modules/c/nitf/shared/GEOPSB.c index 076b59735..08fbf7601 100644 --- a/modules/c/nitf/shared/GEOPSB.c +++ b/modules/c/nitf/shared/GEOPSB.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription GEOPSB_description[] = { {NITF_BCS_A, 3, "Coordinate System Type", "TYP" }, {NITF_BCS_A, 3, "Coordinate Units", "UNI" }, {NITF_BCS_A, 80, "Geodetic Datum Name", "DAG" }, @@ -42,6 +42,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(GEOPSB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(GEOPSB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/GRDPSB.c b/modules/c/nitf/shared/GRDPSB.c index d23f4f372..c131467a3 100644 --- a/modules/c/nitf/shared/GRDPSB.c +++ b/modules/c/nitf/shared/GRDPSB.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription GRDPSB_description[] = { {NITF_BCS_N, 2, "Number of Location Grids", "NUM_GRDS" }, {NITF_LOOP, 0, NULL, "NUM_GRDS"}, @@ -42,6 +42,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL }, }; -NITF_DECLARE_SINGLE_PLUGIN(GRDPSB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(GRDPSB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/ICHIPB.c b/modules/c/nitf/shared/ICHIPB.c index d1f4d6c0f..3f282b6bc 100644 --- a/modules/c/nitf/shared/ICHIPB.c +++ b/modules/c/nitf/shared/ICHIPB.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription ICHIPB_description[] = { {NITF_BCS_A, 2, "Non-linear transform flag", "XFRM_FLAG" }, {NITF_BCS_A, 10, "Scale Factor Relative to RO", "SCALE_FACTOR" }, {NITF_BCS_A, 2, "Anamorphic Correction Indicator", "ANAMRPH_CORR" }, @@ -99,6 +99,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(ICHIPB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(ICHIPB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/IMASDA.c b/modules/c/nitf/shared/IMASDA.c index 4ce04defb..0e7a2c429 100644 --- a/modules/c/nitf/shared/IMASDA.c +++ b/modules/c/nitf/shared/IMASDA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD // MIL-PRF-89034, Table 68 (page 131). -static nitf_TREDescription description[] = { +static nitf_TREDescription IMASDA_description[] = { {NITF_BCS_A, 22, "Longitude Translation", "LONTR" }, {NITF_BCS_A, 22, "Latitude Translation", "LATTR" }, {NITF_BCS_A, 22, "Elevation Translation", "ELVTR" }, @@ -40,6 +40,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(IMASDA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(IMASDA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/IMGDTA.c b/modules/c/nitf/shared/IMGDTA.c index 550390ac5..750cac15c 100644 --- a/modules/c/nitf/shared/IMGDTA.c +++ b/modules/c/nitf/shared/IMGDTA.c @@ -27,7 +27,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription IMGDTA_description[] = { {NITF_BCS_N, 4, "VERNUM", "VERNUM" }, {NITF_BCS_A, 32, "FILENAME", "FILENAME" }, {NITF_BCS_A, 32, "PARENT_FNAME", "PARENT_FNAME" }, @@ -96,6 +96,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(IMGDTA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(IMGDTA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/IMRFCA.c b/modules/c/nitf/shared/IMRFCA.c index 8e0b244f3..517209ff9 100644 --- a/modules/c/nitf/shared/IMRFCA.c +++ b/modules/c/nitf/shared/IMRFCA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD // MIL-PRF-89034, Table 69 (page 131). -static nitf_TREDescription description[] = { +static nitf_TREDescription IMRFCA_description[] = { {NITF_LOOP, 0, NITF_CONST_N, "20"}, {NITF_BCS_A, 22, "X Image Numerator", "XINC" }, {NITF_ENDLOOP, 0, NULL, NULL}, @@ -41,6 +41,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(IMRFCA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(IMRFCA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/IOMAPA.c b/modules/c/nitf/shared/IOMAPA.c index 754055e18..feee71418 100644 --- a/modules/c/nitf/shared/IOMAPA.c +++ b/modules/c/nitf/shared/IOMAPA.c @@ -74,14 +74,14 @@ static nitf_TREDescription descrip_00091[] = { }; /* Define the available descriptions and the default one */ -static nitf_TREDescriptionInfo descriptions[] = { +static nitf_TREDescriptionInfo IOMAPA_descriptions[] = { { "IOMAPA_6", descrip_00006, 6 }, { "IOMAPA_8202", descrip_08202, 8202 }, { "IOMAPA_16", descrip_00016, 16 }, { "IOMAPA_91", descrip_00091, 91 }, { NULL, NULL, NITF_TRE_DESC_NO_LENGTH } }; -static nitf_TREDescriptionSet IOMAPADescriptionSet = { 0, descriptions }; +static nitf_TREDescriptionSet IOMAPADescriptionSet = { 0, IOMAPA_descriptions }; NITF_DECLARE_PLUGIN(IOMAPA) diff --git a/modules/c/nitf/shared/J2KLRA.c b/modules/c/nitf/shared/J2KLRA.c index 43fdea794..3f5a435fe 100644 --- a/modules/c/nitf/shared/J2KLRA.c +++ b/modules/c/nitf/shared/J2KLRA.c @@ -26,7 +26,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription J2KLRA_description[] = { {NITF_BCS_N, 1, "original compressed data", "ORIG" }, {NITF_BCS_N, 2, "number wavelet levels", "NLEVELS_O" }, {NITF_BCS_N, 5, "number bands", "NBANDS_O" }, @@ -55,6 +55,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(J2KLRA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(J2KLRA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/MAPLOB.c b/modules/c/nitf/shared/MAPLOB.c index 65fd8ef05..9116fd154 100644 --- a/modules/c/nitf/shared/MAPLOB.c +++ b/modules/c/nitf/shared/MAPLOB.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription MAPLOB_description[] = { {NITF_BCS_A, 3, "Length units", "UNILOA" }, {NITF_BCS_N, 5, "Easting interval", "LOD" }, {NITF_BCS_N, 5, "Northing interval", "LAD" }, @@ -33,6 +33,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(MAPLOB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(MAPLOB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/MATESA.c b/modules/c/nitf/shared/MATESA.c index abc0765ab..8bb86a973 100644 --- a/modules/c/nitf/shared/MATESA.c +++ b/modules/c/nitf/shared/MATESA.c @@ -27,7 +27,7 @@ NITF_CXX_GUARD /* From STDI-0002-1 Appendix AK: Table AK.6-5: MATESA */ -static nitf_TREDescription description[] = { +static nitf_TREDescription MATESA_description[] = { {NITF_BCS_A, 42, "Current File/Segment Source", "CUR_SOURCE" }, {NITF_BCS_A, 16, "Current File/Segment Mate Type", "CUR_MATE_TYPE" }, {NITF_BCS_N, 4, "Length of the CUR_FILE_ID field", "CUR_FILE_ID_LEN" }, @@ -46,6 +46,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL }, }; -NITF_DECLARE_SINGLE_PLUGIN(MATESA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(MATESA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/MENSRA.c b/modules/c/nitf/shared/MENSRA.c index f59ae864d..0acad0841 100644 --- a/modules/c/nitf/shared/MENSRA.c +++ b/modules/c/nitf/shared/MENSRA.c @@ -103,13 +103,13 @@ static nitf_TREDescription descrip_00185[] = { }; /* Define the available descriptions and the default one */ -static nitf_TREDescriptionInfo descriptions[] = { +static nitf_TREDescriptionInfo MENSRA_descriptions[] = { { "MENSRA_155", descrip_00155, 155 }, { "MENSRA_174", descrip_00174, 174 }, { "MENSRA_185", descrip_00185, 185 }, { NULL, NULL, NITF_TRE_DESC_NO_LENGTH } }; -static nitf_TREDescriptionSet MENSRADescriptionSet = { 0, descriptions }; +static nitf_TREDescriptionSet MENSRADescriptionSet = { 0, MENSRA_descriptions }; NITF_DECLARE_PLUGIN(MENSRA) diff --git a/modules/c/nitf/shared/MENSRB.c b/modules/c/nitf/shared/MENSRB.c index 3ff1de0ed..93299d35d 100644 --- a/modules/c/nitf/shared/MENSRB.c +++ b/modules/c/nitf/shared/MENSRB.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription MENSRB_description[] = { {NITF_BCS_A, 25, "Aircraft Location", "ACFT_LOC" }, {NITF_BCS_A, 6, "Aircraft Location Accuracy", "ACFT_LOC_ACCY" }, {NITF_BCS_A, 6, "Aircraft Altitude", "ACFT_ALT" }, @@ -55,6 +55,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(MENSRB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(MENSRB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/MPDSRA.c b/modules/c/nitf/shared/MPDSRA.c index 4f4647131..03826604a 100644 --- a/modules/c/nitf/shared/MPDSRA.c +++ b/modules/c/nitf/shared/MPDSRA.c @@ -27,7 +27,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription MPDSRA_description[] = { {NITF_BCS_A, 2, "Image Block Number", "blkno" }, {NITF_BCS_A, 2, "Commanded IPR", "cdipr" }, {NITF_BCS_N, 2, "No of Blocks in WDG", "nblkw" }, @@ -56,6 +56,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(MPDSRA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(MPDSRA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/MSDIRA.c b/modules/c/nitf/shared/MSDIRA.c index b65a97cb7..68c6c057a 100644 --- a/modules/c/nitf/shared/MSDIRA.c +++ b/modules/c/nitf/shared/MSDIRA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD // MIL-PRF-89034, Table 7 (page 46). -static nitf_TREDescription description[] = { +static nitf_TREDescription MSDIRA_description[] = { {NITF_BCS_A, 9, "Product ID", "PRODID" }, {NITF_BCS_N, 2, "Product Volume", "PRODVOL" }, {NITF_BCS_N, 2, "Product Total Volume", "PRODTOTVOLS" }, @@ -45,6 +45,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(MSDIRA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(MSDIRA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/MSTGTA.c b/modules/c/nitf/shared/MSTGTA.c index 1274cbebb..1b8bafb9c 100644 --- a/modules/c/nitf/shared/MSTGTA.c +++ b/modules/c/nitf/shared/MSTGTA.c @@ -24,7 +24,7 @@ #include NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription MSTGTA_description[] = { {NITF_BCS_A, 5, "TGT NUM", "TGTNUM" }, {NITF_BCS_A, 12, "TGT ID", "TGTID" }, {NITF_BCS_A, 15, "TGT BE", "TGTBE" }, @@ -41,6 +41,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(MSTGTA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(MSTGTA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/MTIRPA.c b/modules/c/nitf/shared/MTIRPA.c index 1bd160b41..3bab9d2d3 100644 --- a/modules/c/nitf/shared/MTIRPA.c +++ b/modules/c/nitf/shared/MTIRPA.c @@ -27,7 +27,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription MTIRPA_description[] = { {NITF_BCS_A, 2, "Destination Point", "destp" }, {NITF_BCS_A, 3, "MTI Packet ID No.", "mtpid" }, {NITF_BCS_A, 4, "Patch Number", "pchno" }, @@ -48,6 +48,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(MTIRPA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(MTIRPA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/MTIRPB.c b/modules/c/nitf/shared/MTIRPB.c index f3632c347..73b2725d0 100644 --- a/modules/c/nitf/shared/MTIRPB.c +++ b/modules/c/nitf/shared/MTIRPB.c @@ -27,7 +27,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription MTIRPB_description[] = { {NITF_BCS_A, 2, "Destination Point", "destp" }, {NITF_BCS_A, 3, "MTI Packet ID No.", "mtpid" }, {NITF_BCS_A, 4, "Patch Number", "pchno" }, @@ -54,6 +54,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(MTIRPB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(MTIRPB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/NBLOCA.c b/modules/c/nitf/shared/NBLOCA.c index a03754f63..d94f3a243 100644 --- a/modules/c/nitf/shared/NBLOCA.c +++ b/modules/c/nitf/shared/NBLOCA.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription NBLOCA_description[] = { {NITF_BINARY, 4, "First Image Frame Offset", "FRAME_1_OFFSET" }, {NITF_BINARY, 4, "Number of Blocks", "NUMBER_OF_FRAMES" }, {NITF_LOOP, 0, "- 1", "NUMBER_OF_FRAMES"}, @@ -33,6 +33,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(NBLOCA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(NBLOCA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/OBJCTA.c b/modules/c/nitf/shared/OBJCTA.c index f8d6f1a9b..394c71e01 100644 --- a/modules/c/nitf/shared/OBJCTA.c +++ b/modules/c/nitf/shared/OBJCTA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription OBJCTA_description[] = { {NITF_BCS_N, 4, "VERNUM", "VERNUM" }, {NITF_BCS_N, 3, "NUM_OBJ", "NUM_OBJ" }, {NITF_BCS_A, 10, "OBJ_REF", "OBJ_REF" }, @@ -65,6 +65,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(OBJCTA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(OBJCTA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/OFFSET.c b/modules/c/nitf/shared/OFFSET.c index 6297254be..2e118dd66 100644 --- a/modules/c/nitf/shared/OFFSET.c +++ b/modules/c/nitf/shared/OFFSET.c @@ -24,12 +24,12 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription OFFSET_description[] = { {NITF_BCS_N, 8, "Align-Scan Offset of First Pixel", "LINE" }, {NITF_BCS_N, 8, "Cross-Scan Offset of First Pixel", "SAMPLE" }, {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(OFFSET, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(OFFSET) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/PATCHA.c b/modules/c/nitf/shared/PATCHA.c index 5a098505a..0e99f6321 100644 --- a/modules/c/nitf/shared/PATCHA.c +++ b/modules/c/nitf/shared/PATCHA.c @@ -69,13 +69,13 @@ static nitf_TREDescription descrip_00115[] = { }; /* Define the available descriptions and the default one */ -static nitf_TREDescriptionInfo descriptions[] = { +static nitf_TREDescriptionInfo PATCHA_descriptions[] = { { "PATCHA_115", descrip_00115, 115 }, { "PATCHA_74", descrip_00074, 74 }, { NULL, NULL, NITF_TRE_DESC_NO_LENGTH } }; -static nitf_TREDescriptionSet PATCHADescriptionSet = { 0, descriptions }; +static nitf_TREDescriptionSet PATCHADescriptionSet = { 0, PATCHA_descriptions }; NITF_DECLARE_PLUGIN(PATCHA) diff --git a/modules/c/nitf/shared/PATCHB.c b/modules/c/nitf/shared/PATCHB.c index fc335b53d..ef1e3f3db 100644 --- a/modules/c/nitf/shared/PATCHB.c +++ b/modules/c/nitf/shared/PATCHB.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription PATCHB_description[] = { {NITF_BCS_A, 4, "Patch Number", "PAT_NO" }, {NITF_BCS_A, 1, "Last Patch of Search Scene", "LAST_PAT_FLAG" }, @@ -52,6 +52,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(PATCHB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(PATCHB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/PIAEQA.c b/modules/c/nitf/shared/PIAEQA.c index f8ae90e2d..1897b35dd 100644 --- a/modules/c/nitf/shared/PIAEQA.c +++ b/modules/c/nitf/shared/PIAEQA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription PIAEQA_description[] = { {NITF_BCS_A, 7, "Equipment Code", "EQPCODE" }, {NITF_BCS_A, 45, "Equipment Nomenclature", "EQPNOMEN" }, {NITF_BCS_A, 64, "Equipment Manufacturer", "EQPMAN" }, @@ -37,6 +37,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(PIAEQA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(PIAEQA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/PIAEVA.c b/modules/c/nitf/shared/PIAEVA.c index 2fb845d91..ecfd6ce32 100644 --- a/modules/c/nitf/shared/PIAEVA.c +++ b/modules/c/nitf/shared/PIAEVA.c @@ -25,12 +25,12 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription PIAEVA_description[] = { {NITF_BCS_A, 38, "Event Name", "EVENTNAME" }, {NITF_BCS_A, 8, "Event Type", "EVENTTYPE" }, {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(PIAEVA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(PIAEVA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/PIAIMB.c b/modules/c/nitf/shared/PIAIMB.c index bb8b6571d..a6ca4c06a 100644 --- a/modules/c/nitf/shared/PIAIMB.c +++ b/modules/c/nitf/shared/PIAIMB.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription PIAIMB_description[] = { {NITF_BCS_A, 3, "Cloud Cover", "cloud" }, {NITF_BCS_A, 1, "Standard Radiometric?", "stdrd" }, {NITF_BCS_A, 12, "Sensor Mode", "smode" }, @@ -42,6 +42,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(PIAIMB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(PIAIMB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/PIAIMC.c b/modules/c/nitf/shared/PIAIMC.c index 54cacc896..2127d510f 100644 --- a/modules/c/nitf/shared/PIAIMC.c +++ b/modules/c/nitf/shared/PIAIMC.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription PIAIMC_description[] = { {NITF_BCS_N, 3, "Cloud Cover", "CLOUDCVR" }, {NITF_BCS_A, 1, "Standard Radiometric Product", "SRP" }, {NITF_BCS_A, 12, "Sensor Mode", "SENSMODE" }, @@ -48,6 +48,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(PIAIMC, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(PIAIMC) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/PIAPEA.c b/modules/c/nitf/shared/PIAPEA.c index 48b7aedf5..b56c13822 100644 --- a/modules/c/nitf/shared/PIAPEA.c +++ b/modules/c/nitf/shared/PIAPEA.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription PIAPEA_description[] = { {NITF_BCS_A, 28, "Last Name", "LASTNME" }, {NITF_BCS_A, 28, "First Name", "FIRSTNME" }, {NITF_BCS_A, 28, "Middle Name", "MIDNME" }, @@ -33,6 +33,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(PIAPEA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(PIAPEA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/PIAPEB.c b/modules/c/nitf/shared/PIAPEB.c index e1bb1a499..fa0857b51 100644 --- a/modules/c/nitf/shared/PIAPEB.c +++ b/modules/c/nitf/shared/PIAPEB.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription PIAPEB_description[] = { {NITF_BCS_A, 28, "Last Name", "LASTNME" }, {NITF_BCS_A, 28, "First Name", "FIRSTNME" }, {NITF_BCS_A, 28, "Middle Name", "MIDNME" }, @@ -34,6 +34,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(PIAPEB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(PIAPEB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/PIAPRC.c b/modules/c/nitf/shared/PIAPRC.c index 2b70f98c1..a5246ff10 100644 --- a/modules/c/nitf/shared/PIAPRC.c +++ b/modules/c/nitf/shared/PIAPRC.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription PIAPRC_description[] = { {NITF_BCS_A, 64, "Access ID", "accid" }, {NITF_BCS_A, 32, "FM Control Number", "fmctl" }, {NITF_BCS_A, 1, "Subjective Detail", "sdet" }, @@ -76,6 +76,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(PIAPRC, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(PIAPRC) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/PIAPRD.c b/modules/c/nitf/shared/PIAPRD.c index de004d713..59f1e752b 100644 --- a/modules/c/nitf/shared/PIAPRD.c +++ b/modules/c/nitf/shared/PIAPRD.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription PIAPRD_description[] = { {NITF_BCS_A, 64, "Access ID", "ACCESSID" }, {NITF_BCS_A, 32, "FM Control Number", "FMCNTROL" }, {NITF_BCS_A, 1, "Subjective Detail", "SUBDET" }, @@ -61,6 +61,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(PIAPRD, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(PIAPRD) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/PIATGA.c b/modules/c/nitf/shared/PIATGA.c index 6084ea95a..152c38bf7 100644 --- a/modules/c/nitf/shared/PIATGA.c +++ b/modules/c/nitf/shared/PIATGA.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription PIATGA_description[] = { {NITF_BCS_A, 15, "Target UTM", "TGTUTM" }, {NITF_BCS_A, 15, "Target ID", "PIATGAID" }, {NITF_BCS_A, 2, "Country Code", "PIACTRY" }, @@ -36,6 +36,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(PIATGA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(PIATGA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/PIATGB.c b/modules/c/nitf/shared/PIATGB.c index e8d84494a..abbc09d82 100644 --- a/modules/c/nitf/shared/PIATGB.c +++ b/modules/c/nitf/shared/PIATGB.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription PIATGB_description[] = { {NITF_BCS_A, 15, "Target UTM", "TGTUTM" }, {NITF_BCS_A, 15, "Target Identification", "PIATGAID" }, {NITF_BCS_A, 2, "Country Code", "PIACTRY" }, @@ -38,6 +38,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(PIATGB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(PIATGB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/PIXQLA.c b/modules/c/nitf/shared/PIXQLA.c index 43926113d..90fad615b 100644 --- a/modules/c/nitf/shared/PIXQLA.c +++ b/modules/c/nitf/shared/PIXQLA.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription PIXQLA_description[] = { {NITF_BCS_A, 3, "Number of Associated Image Segments", "NUMAIS", }, {NITF_IF, 0, "ne ALL", "NUMAIS"}, {NITF_LOOP, 0, NULL, "NUMAIS"}, @@ -39,6 +39,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(PIXQLA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(PIXQLA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/PLTFMA.c b/modules/c/nitf/shared/PLTFMA.c index 44f0704b3..368ec9548 100644 --- a/modules/c/nitf/shared/PLTFMA.c +++ b/modules/c/nitf/shared/PLTFMA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription PLTFMA_description[] = { {NITF_BCS_N, 4, "VERNUM", "VERNUM" }, {NITF_BCS_A, 12, "P_NAME", "P_NAME" }, {NITF_BCS_A, 40, "P_DESCR", "P_DESCR" }, @@ -76,6 +76,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(PLTFMA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(PLTFMA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/PRADAA.c b/modules/c/nitf/shared/PRADAA.c index 460bc4bf8..6ee7d8e11 100644 --- a/modules/c/nitf/shared/PRADAA.c +++ b/modules/c/nitf/shared/PRADAA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD // MIL-PRF-89034, Table 9 (page 48). -static nitf_TREDescription description[] = { +static nitf_TREDescription PRADAA_description[] = { {NITF_BCS_A, 8, "DPPDB Absolute CE 90%", "PACE" }, {NITF_BCS_A, 8, "DPPDB Absolute LE 90%", "PALE" }, {NITF_BCS_A, 8, "DPPDB Support Data CE 90%", "PSDCE" }, @@ -35,6 +35,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(PRADAA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(PRADAA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/PRJPSB.c b/modules/c/nitf/shared/PRJPSB.c index 67feda8b6..e7c187b43 100644 --- a/modules/c/nitf/shared/PRJPSB.c +++ b/modules/c/nitf/shared/PRJPSB.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription PRJPSB_description[] = { {NITF_BCS_A, 80, "Projection Name", "PRN" }, {NITF_BCS_A, 2, "Projection Code", "PCO" }, {NITF_BCS_N, 1, "Number of Projection Parameters", "NUM_PRJ" }, @@ -36,6 +36,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(PRJPSB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(PRJPSB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/REGPTB.c b/modules/c/nitf/shared/REGPTB.c index 12b456990..245d4da5e 100644 --- a/modules/c/nitf/shared/REGPTB.c +++ b/modules/c/nitf/shared/REGPTB.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription REGPTB_description[] = { {NITF_BCS_N, 4, "Number of Registration Points to Follow", "NUMPTS" }, {NITF_LOOP, 0, NULL, "NUMPTS"}, @@ -38,6 +38,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(REGPTB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(REGPTB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/RPC00B.c b/modules/c/nitf/shared/RPC00B.c index 3ba2066d1..e5d09de4a 100644 --- a/modules/c/nitf/shared/RPC00B.c +++ b/modules/c/nitf/shared/RPC00B.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription RPC00B_description[] = { {NITF_BCS_N, 1, "Success", "SUCCESS" }, {NITF_BCS_A, 7, "Error - Bias", "ERR_BIAS" }, {NITF_BCS_A, 7, "Error - Random", "ERR_RAND" }, @@ -54,6 +54,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(RPC00B, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(RPC00B) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/RPFDES.c b/modules/c/nitf/shared/RPFDES.c index 59cf0243c..51b4a5a1f 100644 --- a/modules/c/nitf/shared/RPFDES.c +++ b/modules/c/nitf/shared/RPFDES.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription RPFDES_description[] = { {NITF_BINARY, 1, "location section length", "LOCLEN" }, {NITF_IF, 0, "> 0", "LOCLEN"}, {NITF_BINARY, 1, "component location table offset", "CLTOFF" }, @@ -42,6 +42,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(RPFDES, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(RPFDES) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/RPFIMG.c b/modules/c/nitf/shared/RPFIMG.c index 444c559af..a06ef2ba5 100644 --- a/modules/c/nitf/shared/RPFIMG.c +++ b/modules/c/nitf/shared/RPFIMG.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription RPFIMG_description[] = { {NITF_BINARY, 1, "location section length", "LOCLEN" }, {NITF_BINARY, 1, "component location table offset", "CLTOFF" }, {NITF_BINARY, 1, "# of section location records", "SECRECS" }, @@ -40,6 +40,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(RPFIMG, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(RPFIMG) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/RSMAPA.c b/modules/c/nitf/shared/RSMAPA.c index 5da870e3c..7211fbad7 100644 --- a/modules/c/nitf/shared/RSMAPA.c +++ b/modules/c/nitf/shared/RSMAPA.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription RSMAPA_description[] = { {NITF_BCS_A, 80, "Image Identifier", "IID" }, {NITF_BCS_A, 40, "RSM Image Support Data Edition", "EDITION" }, {NITF_BCS_A, 40, "Triangulation ID", "TID" }, @@ -117,6 +117,6 @@ static nitf_TREDescription description[] = { -NITF_DECLARE_SINGLE_PLUGIN(RSMAPA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(RSMAPA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/RSMDCA.c b/modules/c/nitf/shared/RSMDCA.c index c9a8f36fc..549552083 100644 --- a/modules/c/nitf/shared/RSMDCA.c +++ b/modules/c/nitf/shared/RSMDCA.c @@ -36,7 +36,7 @@ static int count(nitf_TRE* tre, char idx[10][10], int depth, nitf_Error* error) } -static nitf_TREDescription description[] = { +static nitf_TREDescription RSMDCA_description[] = { {NITF_BCS_A, 80, "Image Identifier", "IID" }, {NITF_BCS_A, 40, "RSM Image Support Data Edition", "EDITION" }, {NITF_BCS_A, 40, "Triangulation ID", "TID" }, @@ -139,6 +139,6 @@ static nitf_TREDescription description[] = { -NITF_DECLARE_SINGLE_PLUGIN(RSMDCA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(RSMDCA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/RSMECA.c b/modules/c/nitf/shared/RSMECA.c index 242a0212f..6848701d3 100644 --- a/modules/c/nitf/shared/RSMECA.c +++ b/modules/c/nitf/shared/RSMECA.c @@ -58,7 +58,7 @@ static int mapped(nitf_TRE* tre, char idx[10][10], int depth, nitf_Error* error) } -static nitf_TREDescription description[] = { +static nitf_TREDescription RSMECA_description[] = { {NITF_BCS_A, 80, "Image Identifier", "IID" }, {NITF_BCS_A, 40, "RSM Image Support Data Edition", "EDITION" }, {NITF_BCS_A, 40, "Triangulation ID", "TID" }, @@ -210,6 +210,6 @@ static nitf_TREDescription description[] = { -NITF_DECLARE_SINGLE_PLUGIN(RSMECA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(RSMECA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/RSMGGA.c b/modules/c/nitf/shared/RSMGGA.c index 6e3c82e8a..c00450003 100644 --- a/modules/c/nitf/shared/RSMGGA.c +++ b/modules/c/nitf/shared/RSMGGA.c @@ -44,7 +44,7 @@ static int nxptsXnypts(nitf_TRE* tre, char idx[10][10], int depth, nitf_Error* e return nxpts * nypts; } -static nitf_TREDescription description[] = { +static nitf_TREDescription RSMGGA_description[] = { {NITF_BCS_A, 80, "Image Identifier", "IID" }, {NITF_BCS_A, 40, "RSM Image Support Data Edition", "EDITION" }, @@ -104,6 +104,6 @@ static nitf_TREDescription description[] = { -NITF_DECLARE_SINGLE_PLUGIN(RSMGGA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(RSMGGA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/RSMGIA.c b/modules/c/nitf/shared/RSMGIA.c index 50a126a08..9c4a1ffc5 100644 --- a/modules/c/nitf/shared/RSMGIA.c +++ b/modules/c/nitf/shared/RSMGIA.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription RSMGIA_description[] = { {NITF_BCS_A, 80, "Image Identifier", "IID" }, {NITF_BCS_A, 40, "RSM Image Support Data Edition", "EDITION" }, @@ -71,6 +71,6 @@ static nitf_TREDescription description[] = { -NITF_DECLARE_SINGLE_PLUGIN(RSMGIA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(RSMGIA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/RSMIDA.c b/modules/c/nitf/shared/RSMIDA.c index cfe0e6e51..26e9e6cda 100644 --- a/modules/c/nitf/shared/RSMIDA.c +++ b/modules/c/nitf/shared/RSMIDA.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription RSMIDA_description[] = { {NITF_BCS_A, 80, "Image Identifier", "IID" }, {NITF_BCS_A, 40, "RSM Image Support Data Edition", "EDITION" }, {NITF_BCS_A, 40, "Image Sequence Identifier", "ISID" }, @@ -134,6 +134,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(RSMIDA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(RSMIDA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/RSMPCA.c b/modules/c/nitf/shared/RSMPCA.c index 815094815..29e180d5c 100644 --- a/modules/c/nitf/shared/RSMPCA.c +++ b/modules/c/nitf/shared/RSMPCA.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription RSMPCA_description[] = { {NITF_BCS_A, 80, "Image Identifier", "IID" }, {NITF_BCS_A, 40, "RSM Image Support Data Edition", "EDITION" }, @@ -105,6 +105,6 @@ static nitf_TREDescription description[] = { }; -NITF_DECLARE_SINGLE_PLUGIN(RSMPCA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(RSMPCA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/RSMPIA.c b/modules/c/nitf/shared/RSMPIA.c index 757d6069b..cb4062b36 100644 --- a/modules/c/nitf/shared/RSMPIA.c +++ b/modules/c/nitf/shared/RSMPIA.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription RSMPIA_description[] = { {NITF_BCS_A, 80, "Image Identifier", "IID" }, {NITF_BCS_A, 40, "RSM Image Support Data Edition", "EDITION" }, @@ -67,6 +67,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(RSMPIA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(RSMPIA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/SECTGA.c b/modules/c/nitf/shared/SECTGA.c index 5f866dd54..d6bab85ee 100644 --- a/modules/c/nitf/shared/SECTGA.c +++ b/modules/c/nitf/shared/SECTGA.c @@ -25,13 +25,13 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription SECTGA_description[] = { {NITF_BCS_A, 12, "Secondary Target ID", "SEC_ID" }, {NITF_BCS_A, 15, "Secondary Target BE No", "SEC_BE" }, {NITF_BCS_A, 1, "reserved 1", "RESVD001" }, {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(SECTGA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(SECTGA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/SENSRA.c b/modules/c/nitf/shared/SENSRA.c index e6f6e3cd6..fd3cf1324 100644 --- a/modules/c/nitf/shared/SENSRA.c +++ b/modules/c/nitf/shared/SENSRA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription SENSRA_description[] = { {NITF_BCS_N, 8, "Ref Row", "REFROW" }, {NITF_BCS_N, 8, "Ref Col", "REFCOL" }, {NITF_BCS_A, 6, "Sensor Model", "SNSMODEL" }, @@ -53,6 +53,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(SENSRA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(SENSRA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/SENSRB.c b/modules/c/nitf/shared/SENSRB.c index cae78468f..8b7b63d52 100644 --- a/modules/c/nitf/shared/SENSRB.c +++ b/modules/c/nitf/shared/SENSRB.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription SENSRB_description[] = { {NITF_BCS_A, 1, "General Data", "GENERAL_DATA"}, /* 01 */ {NITF_IF, 0, "eq Y", "GENERAL_DATA"}, {NITF_BCS_A, 25, "Sensor Name", "SENSOR"}, /* 01a */ @@ -402,6 +402,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(SENSRB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(SENSRB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/SNSPSB.c b/modules/c/nitf/shared/SNSPSB.c index 8655b96b6..51565eec7 100644 --- a/modules/c/nitf/shared/SNSPSB.c +++ b/modules/c/nitf/shared/SNSPSB.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription SNSPSB_description[] = { {NITF_BCS_N, 2, "Number of sets of sensor parameters", "NUMSNS" }, {NITF_LOOP, 0, NULL, "NUMSNS"}, {NITF_BCS_N, 2, "Number of Bounding Polygons", "NUM_BP" }, @@ -86,6 +86,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(SNSPSB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(SNSPSB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/SNSRA.c b/modules/c/nitf/shared/SNSRA.c index 35e1f8e91..41a07bb50 100644 --- a/modules/c/nitf/shared/SNSRA.c +++ b/modules/c/nitf/shared/SNSRA.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription SNSRA_description[] = { {NITF_BCS_N, 4, "VERNUM", "VERNUM" }, {NITF_BCS_A, 20, "SENNAME", "SENNAME" }, {NITF_BCS_A, 1, "SENTYPE", "SENTYPE" }, @@ -107,6 +107,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(SNSRA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(SNSRA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/SOURCB.c b/modules/c/nitf/shared/SOURCB.c index 7adae1ff2..efce785e8 100644 --- a/modules/c/nitf/shared/SOURCB.c +++ b/modules/c/nitf/shared/SOURCB.c @@ -24,7 +24,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription SOURCB_description[] = { {NITF_BCS_N, 9, "Image Segment Reciprocal Scale", "IS_SCA" }, {NITF_BCS_A, 10, "Colout Patch ID", "CPATCH" }, {NITF_BCS_N, 2, "Number of Source Descriptions", "NUM_SOUR" }, @@ -121,6 +121,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(SOURCB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(SOURCB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/STDIDC.c b/modules/c/nitf/shared/STDIDC.c index f10f64922..344f627e1 100644 --- a/modules/c/nitf/shared/STDIDC.c +++ b/modules/c/nitf/shared/STDIDC.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription STDIDC_description[] = { {NITF_BCS_A, 14, "ACQ DATE", "ACQUISITION_DATE" }, {NITF_BCS_A, 14, "MISSION", "MISSION" }, {NITF_BCS_A, 2, "PASS", "PASS" }, @@ -47,6 +47,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(STDIDC, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(STDIDC) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/STEROB.c b/modules/c/nitf/shared/STEROB.c index 068dcd912..486b1dccf 100644 --- a/modules/c/nitf/shared/STEROB.c +++ b/modules/c/nitf/shared/STEROB.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription STEROB_description[] = { {NITF_BCS_A, 60, "Standard ID", "ST_ID" }, {NITF_BCS_A, 1, "N Mates", "N_MATES" }, {NITF_BCS_A, 1, "Mate Instance", "MATE_INSTANCE" }, @@ -38,6 +38,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(STEROB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(STEROB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/STREOB.c b/modules/c/nitf/shared/STREOB.c index ef46e7761..704279440 100644 --- a/modules/c/nitf/shared/STREOB.c +++ b/modules/c/nitf/shared/STREOB.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription STREOB_description[] = { {NITF_BCS_A, 60, "Standard ID", "ST_ID" }, {NITF_BCS_A, 1, "Nunber of Stereo Mates", "N_MATES" }, {NITF_BCS_A, 1, "Mate Instance", "MATE_INSTANCE" }, @@ -38,6 +38,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(STREOB, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(STREOB) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/TRGTA.c b/modules/c/nitf/shared/TRGTA.c index dfe226611..08b4855f1 100644 --- a/modules/c/nitf/shared/TRGTA.c +++ b/modules/c/nitf/shared/TRGTA.c @@ -26,7 +26,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription TRGTA_description[] = { {NITF_BCS_N, 4, "VERNUM", "VERNUM" }, {NITF_BCS_N, 3, "NO_VALID_TGTS", "NO_VALID_TGTS" }, {NITF_BCS_N, 3, "NO_SCENE_TGTS", "NO_SCENE_TGTS" }, @@ -88,6 +88,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(TRGTA, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(TRGTA) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/shared/USE00A.c b/modules/c/nitf/shared/USE00A.c index 96e70d397..1ae9b8e39 100644 --- a/modules/c/nitf/shared/USE00A.c +++ b/modules/c/nitf/shared/USE00A.c @@ -25,7 +25,7 @@ NITF_CXX_GUARD -static nitf_TREDescription description[] = { +static nitf_TREDescription USE00A_description[] = { {NITF_BCS_N, 3, "Angle to North", "ANGLE_TO_NORTH" }, {NITF_BCS_A, 5, "Mean GSD ", "MEAN_GSD" }, {NITF_BCS_A, 1, "Reserved 1", "rsrvd01" }, @@ -53,6 +53,6 @@ static nitf_TREDescription description[] = { {NITF_END, 0, NULL, NULL} }; -NITF_DECLARE_SINGLE_PLUGIN(USE00A, description) +NITF_DECLARE_SINGLE_PLUGIN_SIMPLE(USE00A) NITF_CXX_ENDGUARD diff --git a/modules/c/nitf/source/TREs.c b/modules/c/nitf/source/TREs.c index 8ac463b98..fc32020de 100644 --- a/modules/c/nitf/source/TREs.c +++ b/modules/c/nitf/source/TREs.c @@ -33,15 +33,99 @@ #include "../shared/ACCHZB.c" #include "../shared/ACCPOB.c" +#include "../shared/ACCVTB.c" #include "../shared/ACFTA.c" +#include "../shared/ACFTB.c" +#include "../shared/AIMIDA.c" #include "../shared/AIMIDB.c" +#include "../shared/AIPBCA.c" +#include "../shared/ASTORA.c" +#include "../shared/BANDSA.c" +#include "../shared/BANDSB.c" +#include "../shared/BCKGDA.c" +#include "../shared/BLOCKA.c" +#include "../shared/BNDPLB.c" +#include "../shared/CCINFA.c" +#include "../shared/CLCTNA.c" +#include "../shared/CLCTNB.c" +#include "../shared/CMETAA.c" +#include "../shared/CSCCGA.c" #include "../shared/CSCRNA.c" +#include "../shared/CSDIDA.c" +#include "../shared/CSEPHA.c" +#include "../shared/CSEXRA.c" #include "../shared/CSEXRB.c" +#include "../shared/CSPROA.c" +#include "../shared/CSSFAA.c" +#include "../shared/CSSHPA.c" #include "../shared/ENGRDA.c" +#include "../shared/EXOPTA.c" +#include "../shared/EXPLTA.c" +#include "../shared/EXPLTB.c" +#include "../shared/GEOLOB.c" +#include "../shared/GEOPSB.c" +#include "../shared/GRDPSB.c" #include "../shared/HISTOA.c" +#include "../shared/ICHIPB.c" +#include "../shared/IMASDA.c" +#include "../shared/IMGDTA.c" +#include "../shared/IMRFCA.c" +#include "../shared/IOMAPA.c" +#include "../shared/J2KLRA.c" #include "../shared/JITCID.c" +#include "../shared/MAPLOB.c" +#include "../shared/MATESA.c" +#include "../shared/MENSRA.c" +#include "../shared/MENSRB.c" +#include "../shared/MPDSRA.c" +#include "../shared/MSDIRA.c" +#include "../shared/MSTGTA.c" +#include "../shared/MTIRPA.c" +#include "../shared/MTIRPB.c" +#include "../shared/NBLOCA.c" +#include "../shared/OBJCTA.c" +#include "../shared/OFFSET.c" +#include "../shared/PATCHA.c" +#include "../shared/PATCHB.c" +#include "../shared/PIAEQA.c" +#include "../shared/PIAEVA.c" +#include "../shared/PIAIMB.c" +#include "../shared/PIAIMC.c" +#include "../shared/PIAPEA.c" +#include "../shared/PIAPEB.c" +#include "../shared/PIAPRC.c" +#include "../shared/PIAPRD.c" +#include "../shared/PIATGA.c" +#include "../shared/PIATGB.c" +#include "../shared/PIXQLA.c" +#include "../shared/PLTFMA.c" +#include "../shared/PRADAA.c" +#include "../shared/PRJPSB.c" #include "../shared/PTPRAA.c" +#include "../shared/REGPTB.c" +#include "../shared/RPC00B.c" +#include "../shared/RPFDES.c" #include "../shared/RPFHDR.c" +#include "../shared/RPFIMG.c" +#include "../shared/RSMAPA.c" +#include "../shared/RSMDCA.c" +#include "../shared/RSMECA.c" +#include "../shared/RSMGGA.c" +#include "../shared/RSMGIA.c" +#include "../shared/RSMIDA.c" +#include "../shared/RSMPCA.c" +#include "../shared/RSMPIA.c" +#include "../shared/SECTGA.c" +#include "../shared/SENSRA.c" +#include "../shared/SENSRB.c" +#include "../shared/SNSPSB.c" +#include "../shared/SNSRA.c" +#include "../shared/SOURCB.c" +#include "../shared/STDIDC.c" +#include "../shared/STEROB.c" +#include "../shared/STREOB.c" +#include "../shared/TRGTA.c" +#include "../shared/USE00A.c" #include "../shared/TEST_DES.c" #include "../shared/XML_DATA_CONTENT.c" @@ -72,9 +156,9 @@ /* TRE description for user header */ static nitf_TREDescription TEST_PRELOADED_DES_description[] = { - {NITF_BCS_N, 2, "Number of data values", "COUNT" }, - {NITF_BCS_N, 3, "Start value in ramp", "START" }, - {NITF_BCS_N, 2, "Increment between values in ramp", "INCREMENT" }, + {NITF_BCS_N, 2, "Number of data values", "COUNT" }, + {NITF_BCS_N, 3, "Start value in ramp", "START" }, + {NITF_BCS_N, 2, "Increment between values in ramp", "INCREMENT" }, {NITF_END, 0, NULL, NULL} }; static nitf_TREDescriptionInfo TEST_PRELOADED_DES_descriptions[] = { @@ -111,17 +195,101 @@ nitf_TREPreloaded defaultPreloadedTREs[] = { // Not preloading any TREs right now: with the existing system, // a TRE can be removed by deleting the DLL/SO. If that same TRE // were preloaded, there would be no way to get rid of it. - NITF_preload_TRE(ACCHZB), - NITF_preload_TRE(ACCPOB), - NITF_preload_TRE(ACFTA), - NITF_preload_TRE(AIMIDB), - NITF_preload_TRE(CSCRNA), - NITF_preload_TRE(CSEXRB), - NITF_preload_TRE(ENGRDA), - NITF_preload_TRE(HISTOA), - NITF_preload_TRE(JITCID), - NITF_preload_TRE(PTPRAA), - NITF_preload_TRE(RPFHDR), + NITF_preload_TRE(ACCHZB), + NITF_preload_TRE(ACCPOB), + NITF_preload_TRE(ACCVTB), + NITF_preload_TRE(ACFTA), + NITF_preload_TRE(ACFTB), + NITF_preload_TRE(AIMIDA), + NITF_preload_TRE(AIMIDB), + NITF_preload_TRE(AIPBCA), + NITF_preload_TRE(ASTORA), + NITF_preload_TRE(BANDSA), + NITF_preload_TRE(BANDSB), + NITF_preload_TRE(BCKGDA), + NITF_preload_TRE(BLOCKA), + NITF_preload_TRE(BNDPLB), + NITF_preload_TRE(CCINFA), + NITF_preload_TRE(CLCTNA), + NITF_preload_TRE(CLCTNB), + NITF_preload_TRE(CMETAA), + NITF_preload_TRE(CSCCGA), + NITF_preload_TRE(CSCRNA), + NITF_preload_TRE(CSDIDA), + NITF_preload_TRE(CSEPHA), + NITF_preload_TRE(CSEXRA), + NITF_preload_TRE(CSEXRB), + NITF_preload_TRE(CSPROA), + NITF_preload_TRE(CSSFAA), + NITF_preload_TRE(CSSHPA), + NITF_preload_TRE(ENGRDA), + NITF_preload_TRE(EXOPTA), + NITF_preload_TRE(EXPLTA), + NITF_preload_TRE(EXPLTB), + NITF_preload_TRE(GEOLOB), + NITF_preload_TRE(GEOPSB), + NITF_preload_TRE(GRDPSB), + NITF_preload_TRE(HISTOA), + NITF_preload_TRE(ICHIPB), + NITF_preload_TRE(IMASDA), + NITF_preload_TRE(IMGDTA), + NITF_preload_TRE(IMRFCA), + NITF_preload_TRE(IOMAPA), + NITF_preload_TRE(J2KLRA), + NITF_preload_TRE(JITCID), + NITF_preload_TRE(MAPLOB), + NITF_preload_TRE(MATESA), + NITF_preload_TRE(MENSRA), + NITF_preload_TRE(MENSRB), + NITF_preload_TRE(MPDSRA), + NITF_preload_TRE(MSDIRA), + NITF_preload_TRE(MSTGTA), + NITF_preload_TRE(MTIRPA), + NITF_preload_TRE(MTIRPB), + NITF_preload_TRE(NBLOCA), + NITF_preload_TRE(OBJCTA), + NITF_preload_TRE(OFFSET), + NITF_preload_TRE(PATCHA), + NITF_preload_TRE(PATCHB), + NITF_preload_TRE(PIAEQA), + NITF_preload_TRE(PIAEVA), + NITF_preload_TRE(PIAIMB), + NITF_preload_TRE(PIAIMC), + NITF_preload_TRE(PIAPEA), + NITF_preload_TRE(PIAPEB), + NITF_preload_TRE(PIAPRC), + NITF_preload_TRE(PIAPRD), + NITF_preload_TRE(PIATGA), + NITF_preload_TRE(PIATGB), + NITF_preload_TRE(PIXQLA), + NITF_preload_TRE(PLTFMA), + NITF_preload_TRE(PRADAA), + NITF_preload_TRE(PRJPSB), + NITF_preload_TRE(PTPRAA), + NITF_preload_TRE(REGPTB), + NITF_preload_TRE(RPC00B), + NITF_preload_TRE(RPFDES), + NITF_preload_TRE(RPFHDR), + NITF_preload_TRE(RPFIMG), + NITF_preload_TRE(RSMAPA), + NITF_preload_TRE(RSMDCA), + NITF_preload_TRE(RSMECA), + NITF_preload_TRE(RSMGGA), + NITF_preload_TRE(RSMGIA), + NITF_preload_TRE(RSMIDA), + NITF_preload_TRE(RSMPCA), + NITF_preload_TRE(RSMPIA), + NITF_preload_TRE(SECTGA), + NITF_preload_TRE(SENSRA), + NITF_preload_TRE(SENSRB), + NITF_preload_TRE(SNSPSB), + NITF_preload_TRE(SNSRA), + NITF_preload_TRE(SOURCB), + NITF_preload_TRE(STDIDC), + NITF_preload_TRE(STEROB), + NITF_preload_TRE(STREOB), + NITF_preload_TRE(TRGTA), + NITF_preload_TRE(USE00A), NITF_preload_TRE(XML_DATA_CONTENT), //NITF_preload_TRE(TEST_DES), // This should ALWAYS come from the DLL/SO