From e69e9a2f4c6f482245434666ca15379112a6cdfe Mon Sep 17 00:00:00 2001 From: "Aaron M. Ucko" Date: Thu, 25 Jul 2024 20:02:52 -0400 Subject: [PATCH] New upstream version 2.16.0+ds --- c++/compilers/xcode30_prj/postbuild.sh | 7 +- c++/include/algo/blast/api/blast_dbindex.hpp | 6 +- .../algo/blast/api/blast_exception.hpp | 6 +- c++/include/algo/blast/api/blast_node.hpp | 6 +- c++/include/algo/blast/api/cdd_pssm_input.hpp | 4 +- .../algo/blast/blastinput/blast_args.hpp | 4 +- c++/include/algo/blast/core/blast_message.h | 6 +- c++/include/algo/blast/core/blast_options.h | 4 +- c++/include/algo/blast/dbindex/dbindex.hpp | 26 +- .../algo/blast/format/data4xmlformat.hpp | 4 +- c++/include/algo/blast/proteinkmer/mhfile.hpp | 4 +- .../algo/blast/vdb/blastn_vdb_args.hpp | 3 +- c++/include/algo/blast/vdb/seqsrc_vdb.h | 4 +- c++/include/algo/blast/vdb/vdb2blast_util.hpp | 7 +- c++/include/algo/blast/vdb/vdbblast_local.hpp | 9 +- .../cgi/caf_encoded.hpp} | 26 +- c++/include/cgi/caf_plain.hpp | 98 + c++/include/cgi/cgi_exception.hpp | 3 +- c++/include/common/ncbi_export.h | 11 +- c++/include/common/ncbi_package_ver.h | 2 +- c++/include/common/ncbi_source_ver.h | 4 +- c++/include/connect/impl/connect_misc.hpp | 17 +- c++/include/connect/impl/ncbi_uv_nghttp2.hpp | 6 +- c++/include/corelib/request_status.hpp | 3 +- c++/include/misc/jsonwrapp/jsonwrapp11.hpp | 35 +- c++/include/ncbi_pch.hpp | 2 +- c++/include/ncbi_source_ver.h | 2 +- c++/include/ncbiconf.h | 2 +- c++/include/objects/general/Dbtag.hpp | 15 +- c++/include/objects/seqfeat/OrgMod.hpp | 8 +- c++/include/objects/seqfeat/SubSource.hpp | 5 +- c++/include/objects/seqloc/Seq_id.hpp | 476 ++-- c++/include/objects/valerr/ValidErrItem.hpp | 110 +- c++/include/objects/valerr/ValidError.hpp | 213 +- .../align_format/align_format_util.hpp | 18 +- .../objtools/align_format/showalign.hpp | 19 +- .../blast/seqdb_reader/impl/seqdbatlas.hpp | 15 +- .../blast/seqdb_reader/impl/seqdbgeneral.hpp | 4 +- .../blast/seqdb_reader/impl/seqdbisam.hpp | 6 +- .../blast/seqdb_reader/impl/seqdbvol.hpp | 4 +- .../blast/seqdb_reader/seqdbcommon.hpp | 15 +- .../objtools/blast/seqdb_writer/build_db.hpp | 16 +- .../objtools/blast/seqdb_writer/writedb.hpp | 14 +- .../cleanup/capitalization_string.hpp | 3 +- c++/include/objtools/cleanup/cleanup.hpp | 6 +- .../objtools/cleanup/cleanup_change.hpp | 3 +- .../objtools/cleanup/huge_file_cleanup.hpp | 118 - .../objtools/cleanup/influenza_set.hpp | 6 +- .../data_loaders/genbank/gbloader.hpp | 58 +- .../data_loaders/genbank/gbnative.hpp | 11 +- .../data_loaders/genbank/impl/dispatcher.hpp | 3 +- .../genbank/impl/psg_loader_impl.hpp | 3 +- .../data_loaders/genbank/psg_loader.hpp | 7 +- .../objtools/data_loaders/genbank/reader.hpp | 19 +- c++/include/objtools/edit/eutils_updater.hpp | 125 +- c++/include/objtools/edit/feattable_edit.hpp | 9 +- c++/include/objtools/edit/huge_asn_loader.hpp | 89 +- .../objtools/edit/huge_asn_macro_reader.hpp | 57 - c++/include/objtools/edit/huge_asn_reader.hpp | 204 +- c++/include/objtools/edit/huge_file.hpp | 124 +- .../objtools/edit/huge_file_process.hpp | 101 +- c++/include/objtools/edit/pub_fix.hpp | 10 +- c++/include/objtools/edit/pubmed_updater.hpp | 98 +- c++/include/objtools/edit/remote_updater.hpp | 112 +- .../objtools/format/flat_file_config.hpp | 8 +- .../objtools/format/items/source_item.hpp | 3 +- .../pubseq_gateway/client/impl/misc.hpp | 5 +- .../pubseq_gateway/client/psg_client.hpp | 22 +- c++/include/objtools/readers/agp_util.hpp | 3 +- c++/include/objtools/readers/fasta.hpp | 8 +- .../objtools/readers/fasta_exception.hpp | 50 +- c++/include/objtools/readers/gtf_reader.hpp | 115 +- c++/include/objtools/readers/line_error.hpp | 546 ++-- .../objtools/readers/message_listener.hpp | 61 +- c++/include/objtools/readers/readfeat.hpp | 3 +- .../data_loaders/bam/impl/bamloader_impl.hpp | 5 +- c++/include/util/bitset/bm.h | 17 +- c++/include/util/bitset/bmblocks.h | 78 +- c++/include/util/bitset/bmbmatrix.h | 78 +- c++/include/util/bitset/bmbuffer.h | 3 +- c++/include/util/bitset/bmconst.h | 4 +- c++/include/util/bitset/bmserial.h | 18 +- c++/include/util/bitset/bmsparsevec.h | 59 +- c++/include/util/bitset/bmsparsevec_compr.h | 45 +- .../util/bitset/bmsparsevec_parallel.h | 6 +- c++/include/util/bitset/bmsparsevec_serial.h | 13 +- c++/include/util/bitset/bmsse4.h | 4 +- c++/include/util/bitset/bmstrsparsevec.h | 31 +- c++/include/util/bitset/encoding.h | 91 +- c++/include/util/stream_source.hpp | 14 +- c++/scripts/common/check/check_exec.sh | 4 +- c++/scripts/common/check/check_exec_test.sh | 4 +- c++/scripts/common/check/check_make_cfg.sh | 35 +- c++/scripts/common/check/check_make_unix.sh | 50 +- .../common/check/check_make_unix_cmake.sh | 63 +- c++/scripts/common/check/check_run.sh | 4 +- c++/scripts/common/check/retry_db_load.sh | 66 + c++/scripts/common/impl/install.sh | 2 +- c++/scripts/common/impl/ncbicxx_build_info.py | 14 +- c++/scripts/common/new_cmake_project.sh | 9 +- c++/scripts/projects/blast/Manifest | 7 +- .../projects/blast/post_build/blast_utils.py | 14 +- .../macosx/build_universal_binary.sh | 84 + .../blast/post_build/macosx/ncbi-blast.sh | 2 +- .../macosx/uninstall_ncbi_blast.zip | Bin 59921 -> 60480 bytes .../macosx/uninstaller/build_uninstaller.sh | 103 + .../uninstall_ncbi_blast.applescript | 97 + .../blast/post_build/make_installers.py | 4 +- .../blast/post_build/rpm/ncbi-blast.spec | 2 +- c++/scripts/projects/blast/project.lst | 6 +- .../projects/cobalt/post_build/blast_utils.py | 4 +- .../cobalt/post_build/make_installers.py | 4 +- c++/scripts/projects/datatool/ChangeLog | 4 + c++/scripts/projects/datatool/Manifest | 5 +- c++/scripts/projects/datatool/components.link | 4 +- c++/scripts/projects/dispatcher/ChangeLog | 0 c++/scripts/projects/dispatcher/LICENSE | 19 - c++/scripts/projects/dispatcher/Manifest | 40 - c++/scripts/projects/dispatcher/README | 1 - c++/scripts/projects/dispatcher/project.lst | 26 - c++/scripts/projects/fwdaemon/ChangeLog | 2 - c++/scripts/projects/fwdaemon/LICENSE | 19 - c++/scripts/projects/fwdaemon/Manifest | 21 - c++/scripts/projects/fwdaemon/README | 1 - c++/scripts/projects/fwdaemon/project.lst | 6 - c++/scripts/projects/igblast/Manifest | 6 +- .../igblast/post_build/blast_utils.py | 4 +- .../igblast/post_build/make_installers.py | 4 +- c++/scripts/projects/igblast/project.lst | 5 +- c++/scripts/projects/lbsbd/ChangeLog | 2 - c++/scripts/projects/lbsbd/LICENSE | 19 - c++/scripts/projects/lbsbd/Manifest | 16 - c++/scripts/projects/lbsbd/README | 0 c++/scripts/projects/lbsbd/project.lst | 5 - c++/scripts/projects/magicblast/Manifest | 6 +- .../magicblast/post_build/blast_utils.py | 4 +- .../magicblast/post_build/make_installers.py | 4 +- c++/scripts/projects/magicblast/project.lst | 5 +- c++/scripts/projects/mod_caf/ChangeLog | 2 - c++/scripts/projects/mod_caf/LICENSE | 19 - c++/scripts/projects/mod_caf/Manifest | 18 - c++/scripts/projects/mod_caf/README | 1 - c++/scripts/projects/mod_caf/project.lst | 8 - c++/scripts/projects/mod_loadinfo/ChangeLog | 2 - c++/scripts/projects/mod_loadinfo/LICENSE | 19 - c++/scripts/projects/mod_loadinfo/Manifest | 17 - c++/scripts/projects/mod_loadinfo/README | 1 - c++/scripts/projects/mod_loadinfo/project.lst | 6 - c++/scripts/projects/ncbi_applog/ChangeLog | 5 + c++/scripts/projects/ncbi_applog/Manifest | 16 +- c++/scripts/projects/ncbi_cpp.lst | 1 - c++/scripts/projects/ncbi_cpp_dll.lst | 1 - c++/scripts/projects/ncbi_gbench.lst | 6 +- c++/scripts/projects/ncbi_gui_base.lst | 1 - c++/scripts/projects/ncbi_mapview.lst | 1 - c++/scripts/projects/netstorage/project.lst | 2 + .../projects/netstorage_gc/project.lst | 10 + .../projects/project_tree_builder/ChangeLog | 5 + .../projects/project_tree_builder/Manifest | 6 +- .../project_tree_builder/components.link | 4 +- c++/scripts/projects/psg_client/Manifest | 4 +- .../projects/psg_client/components.link | 1 - c++/scripts/projects/pubseq_gateway/Manifest | 17 +- .../projects/pubseq_gateway/project.lst | 8 + .../projects/python_ncbi_dbapi/ChangeLog | 4 + .../projects/python_ncbi_dbapi/project.lst | 9 + c++/scripts/projects/xmlwrapp/Manifest | 37 +- c++/src/CMakeLists.txt | 2 +- c++/src/Makefile.in | 2 +- .../blast/api/bioseq_extract_data_priv.cpp | 12 +- c++/src/algo/blast/api/blast_aux_priv.cpp | 2 +- c++/src/algo/blast/api/blast_dbindex.cpp | 98 +- c++/src/algo/blast/api/blast_seqalign.cpp | 10 +- c++/src/algo/blast/api/blast_setup_cxx.cpp | 8 +- c++/src/algo/blast/api/cdd_pssm_input.cpp | 18 +- c++/src/algo/blast/api/deltablast.cpp | 4 +- .../algo/blast/api/effsearchspace_calc.cpp | 4 +- c++/src/algo/blast/api/local_blast.cpp | 16 +- c++/src/algo/blast/api/magicblast.cpp | 4 +- c++/src/algo/blast/api/msa_pssm_input.cpp | 8 +- c++/src/algo/blast/api/objmgr_query_data.cpp | 4 +- .../algo/blast/api/objmgrfree_query_data.cpp | 2 +- .../algo/blast/api/prelim_search_runner.hpp | 12 +- c++/src/algo/blast/api/prelim_stage.cpp | 16 +- c++/src/algo/blast/api/psi_pssm_input.cpp | 11 +- c++/src/algo/blast/api/psiblast_impl.cpp | 1 + c++/src/algo/blast/api/remote_blast.cpp | 4 +- c++/src/algo/blast/api/rpsblast_local.cpp | 14 +- .../algo/blast/api/seqsrc_query_factory.cpp | 4 +- c++/src/algo/blast/api/setup_factory.cpp | 22 +- .../algo/blast/api/split_query_aux_priv.cpp | 6 +- c++/src/algo/blast/api/split_query_blk.cpp | 20 +- c++/src/algo/blast/api/split_query_cxx.cpp | 40 +- c++/src/algo/blast/blastinput/blast_args.cpp | 4 +- .../blast/blastinput/blast_fasta_input.cpp | 10 +- c++/src/algo/blast/core/blast_aascan.c | 24 +- c++/src/algo/blast/core/blast_engine.c | 4 +- c++/src/algo/blast/core/blast_filter.c | 10 +- c++/src/algo/blast/core/blast_hits.c | 24 +- c++/src/algo/blast/core/blast_hspstream.c | 4 +- c++/src/algo/blast/core/blast_kappa.c | 10 +- c++/src/algo/blast/core/blast_message.c | 12 +- c++/src/algo/blast/core/blast_nalookup.c | 8 +- c++/src/algo/blast/core/blast_nascan.c | 18 +- c++/src/algo/blast/core/blast_options.c | 20 +- c++/src/algo/blast/core/blast_parameters.c | 4 +- c++/src/algo/blast/core/blast_posit.c | 4 +- c++/src/algo/blast/core/blast_psi_priv.c | 6 +- c++/src/algo/blast/core/blast_stat.c | 29 +- c++/src/algo/blast/core/blast_traceback.c | 13 +- c++/src/algo/blast/core/blast_util.c | 4 +- c++/src/algo/blast/core/jumper.c | 28 +- c++/src/algo/blast/core/na_ungapped.c | 18 +- c++/src/algo/blast/core/phi_lookup.c | 4 +- .../algo/blast/dbindex/dbindex_factory.cpp | 40 +- c++/src/algo/blast/dbindex/dbindex_search.cpp | 18 +- c++/src/algo/blast/format/blast_format.cpp | 4 +- c++/src/algo/blast/format/blastfmtutil.cpp | 4 +- c++/src/algo/blast/format/blastxml_format.cpp | 6 +- c++/src/algo/blast/proteinkmer/blastkmer.cpp | 8 +- .../algo/blast/proteinkmer/blastkmerindex.cpp | 16 +- .../algo/blast/proteinkmer/blastkmerutils.cpp | 30 +- c++/src/algo/blast/proteinkmer/kblastapi.cpp | 8 +- .../api/CMakeLists.blast_unit_test.app.txt | 4 +- .../unit_tests/api/data/Sample_gilist.p.gil | 2 +- .../api/tracebacksearch_unit_test.cpp | 6 +- .../api/version_reference_unit_test.cpp | 4 +- c++/src/algo/blast/vdb/blastn_vdb_args.cpp | 9 +- c++/src/algo/blast/vdb/common_priv.h | 5 +- c++/src/algo/blast/vdb/seqsrc_vdb.c | 3 +- c++/src/algo/blast/vdb/vdb2blast_util.cpp | 12 +- c++/src/algo/blast/vdb/vdb_priv.c | 4 +- c++/src/algo/blast/vdb/vdb_priv.h | 4 +- c++/src/algo/blast/vdb/vdbblast_local.cpp | 60 +- .../app/blast/CMakeLists.blast_report.app.txt | 7 - c++/src/app/blast/CMakeLists.txt | 3 +- c++/src/app/blast/Makefile.blast_report.app | 16 - c++/src/app/blast/Makefile.in | 5 +- c++/src/app/blast/blast_app_util.cpp | 8 +- c++/src/app/blast/blast_app_util.hpp | 21 +- c++/src/app/blast/blast_report.cpp | 401 --- c++/src/app/blast/blast_report.ini | 140 - c++/src/app/blast/blastn_app.cpp | 20 +- c++/src/app/blast/blastp_app.cpp | 32 +- c++/src/app/blast/blastx_app.cpp | 38 +- c++/src/app/blast/tblastn_app.cpp | 3 +- c++/src/app/blast/update_blastdb.pl | 84 +- c++/src/app/blastdb/makeblastdb.cpp | 9 +- c++/src/app/blastdb/makeprofiledb.cpp | 2 +- c++/src/app/blastvdb/blast_vdb_cmd.cpp | 19 +- c++/src/app/blastvdb/blastn_vdb.cpp | 5 +- c++/src/app/blastvdb/tblastn_vdb.cpp | 7 +- c++/src/build-system/Makefile.xcode.tmpl | 6 +- .../cmake/CMake.NCBIComponentsMSVC.cmake | 10 +- .../cmake/CMake.NCBIComponentsPackage.cmake | 197 +- .../cmake/CMake.NCBIComponentsUNIXex.cmake | 26 +- .../cmake/CMake.NCBIComponentsXCODE.cmake | 14 +- .../cmake/CMake.NCBIpkg.setup.cmake | 144 +- .../build-system/cmake/CMake.NCBIptb.cmake | 126 +- .../cmake/CMake.NCBIptb.datatool.cmake | 13 +- .../cmake/CMake.NCBIptb.definitions.cmake | 4 +- .../cmake/CMake.NCBIptb.grpc.cmake | 10 +- .../cmake/CMakeChecks.boost.cmake | 17 +- c++/src/build-system/cmake/cmake-cfg-unix.sh | 23 +- c++/src/build-system/cmake/cmake-cfg-vs.bat | 15 +- c++/src/build-system/cmake/cmake-cfg-xcode.sh | 31 +- c++/src/build-system/cmake/conanfile.MSVC.txt | 104 +- c++/src/build-system/cmake/conanfile.UNIX.txt | 102 +- .../build-system/cmake/conanfile.XCODE.txt | 98 +- c++/src/build-system/cmake/conanfile.py | 113 + .../toolchains/x86_64-linux-gcc-1320.cmake | 37 + c++/src/build-system/config.site.ncbi | 28 +- c++/src/build-system/configure | 223 +- c++/src/build-system/configure.ac | 170 +- c++/src/build-system/install.sh.in | 2 +- c++/src/build-system/ncbi_package_version | 2 +- c++/src/build-system/project_tree_builder.ini | 109 +- c++/src/build-system/relocate.sh.in | 2 +- c++/src/cgi/fcgi_run.cpp | 20 +- c++/src/connect/connect_misc.cpp | 19 +- c++/src/connect/mbedtls/aes.c | 76 +- c++/src/connect/mbedtls/aesni.c | 24 +- c++/src/connect/mbedtls/arc4.c | 14 +- c++/src/connect/mbedtls/aria.c | 14 +- c++/src/connect/mbedtls/asn1parse.c | 14 +- c++/src/connect/mbedtls/asn1write.c | 31 +- c++/src/connect/mbedtls/base64.c | 14 +- c++/src/connect/mbedtls/bignum.c | 124 +- c++/src/connect/mbedtls/bignum_internal.h | 71 + c++/src/connect/mbedtls/blowfish.c | 14 +- c++/src/connect/mbedtls/camellia.c | 14 +- c++/src/connect/mbedtls/ccm.c | 20 +- c++/src/connect/mbedtls/certs.c | 304 ++- c++/src/connect/mbedtls/chacha20.c | 14 +- c++/src/connect/mbedtls/chachapoly.c | 20 +- c++/src/connect/mbedtls/check_crypto_config.h | 14 +- c++/src/connect/mbedtls/cipher.c | 66 +- c++/src/connect/mbedtls/cipher_wrap.c | 16 +- c++/src/connect/mbedtls/cmac.c | 14 +- c++/src/connect/mbedtls/common.h | 41 +- c++/src/connect/mbedtls/constant_time.c | 66 +- .../connect/mbedtls/constant_time_internal.h | 26 +- .../connect/mbedtls/constant_time_invasive.h | 14 +- c++/src/connect/mbedtls/ctr_drbg.c | 17 +- c++/src/connect/mbedtls/debug.c | 28 +- c++/src/connect/mbedtls/des.c | 14 +- c++/src/connect/mbedtls/dhm.c | 14 +- c++/src/connect/mbedtls/ecdh.c | 16 +- c++/src/connect/mbedtls/ecdsa.c | 46 +- c++/src/connect/mbedtls/ecjpake.c | 16 +- c++/src/connect/mbedtls/ecp.c | 36 +- c++/src/connect/mbedtls/ecp_curves.c | 28 +- c++/src/connect/mbedtls/ecp_invasive.h | 18 +- c++/src/connect/mbedtls/entropy.c | 16 +- c++/src/connect/mbedtls/entropy_poll.c | 16 +- c++/src/connect/mbedtls/error.c | 16 +- c++/src/connect/mbedtls/gcm.c | 26 +- c++/src/connect/mbedtls/havege.c | 14 +- c++/src/connect/mbedtls/hkdf.c | 14 +- c++/src/connect/mbedtls/hmac_drbg.c | 14 +- c++/src/connect/mbedtls/mbedtls/aes.h | 14 +- c++/src/connect/mbedtls/mbedtls/aesni.h | 44 +- c++/src/connect/mbedtls/mbedtls/arc4.h | 14 +- c++/src/connect/mbedtls/mbedtls/aria.h | 18 +- c++/src/connect/mbedtls/mbedtls/asn1.h | 18 +- c++/src/connect/mbedtls/mbedtls/asn1write.h | 35 +- c++/src/connect/mbedtls/mbedtls/base64.h | 14 +- c++/src/connect/mbedtls/mbedtls/bignum.h | 24 +- c++/src/connect/mbedtls/mbedtls/blowfish.h | 14 +- c++/src/connect/mbedtls/mbedtls/bn_mul.h | 25 +- c++/src/connect/mbedtls/mbedtls/camellia.h | 16 +- c++/src/connect/mbedtls/mbedtls/ccm.h | 14 +- c++/src/connect/mbedtls/mbedtls/certs.h | 14 +- c++/src/connect/mbedtls/mbedtls/chacha20.h | 14 +- c++/src/connect/mbedtls/mbedtls/chachapoly.h | 14 +- .../connect/mbedtls/mbedtls/check_config.h | 16 +- c++/src/connect/mbedtls/mbedtls/cipher.h | 69 +- .../connect/mbedtls/mbedtls/cipher_internal.h | 14 +- c++/src/connect/mbedtls/mbedtls/cmac.h | 20 +- c++/src/connect/mbedtls/mbedtls/compat-1.3.h | 16 +- c++/src/connect/mbedtls/mbedtls/config.h | 284 +- c++/src/connect/mbedtls/mbedtls/config_psa.h | 46 +- .../connect/mbedtls/mbedtls/constant_time.h | 14 +- c++/src/connect/mbedtls/mbedtls/ctr_drbg.h | 14 +- c++/src/connect/mbedtls/mbedtls/debug.h | 14 +- c++/src/connect/mbedtls/mbedtls/des.h | 14 +- c++/src/connect/mbedtls/mbedtls/dhm.h | 14 +- c++/src/connect/mbedtls/mbedtls/ecdh.h | 14 +- c++/src/connect/mbedtls/mbedtls/ecdsa.h | 29 +- c++/src/connect/mbedtls/mbedtls/ecjpake.h | 14 +- c++/src/connect/mbedtls/mbedtls/ecp.h | 113 +- .../connect/mbedtls/mbedtls/ecp_internal.h | 14 +- c++/src/connect/mbedtls/mbedtls/entropy.h | 14 +- .../connect/mbedtls/mbedtls/entropy_poll.h | 16 +- c++/src/connect/mbedtls/mbedtls/error.h | 20 +- c++/src/connect/mbedtls/mbedtls/gcm.h | 14 +- c++/src/connect/mbedtls/mbedtls/havege.h | 14 +- c++/src/connect/mbedtls/mbedtls/hkdf.h | 14 +- c++/src/connect/mbedtls/mbedtls/hmac_drbg.h | 22 +- c++/src/connect/mbedtls/mbedtls/md.h | 14 +- c++/src/connect/mbedtls/mbedtls/md2.h | 14 +- c++/src/connect/mbedtls/mbedtls/md4.h | 14 +- c++/src/connect/mbedtls/mbedtls/md5.h | 14 +- c++/src/connect/mbedtls/mbedtls/md_internal.h | 14 +- .../mbedtls/mbedtls/memory_buffer_alloc.h | 14 +- .../mbedtls/mbedtls/ncbicxx_rename_mbedtls.h | 2322 +++++++++-------- c++/src/connect/mbedtls/mbedtls/net.h | 14 +- c++/src/connect/mbedtls/mbedtls/net_sockets.h | 26 +- c++/src/connect/mbedtls/mbedtls/nist_kw.h | 14 +- c++/src/connect/mbedtls/mbedtls/oid.h | 14 +- c++/src/connect/mbedtls/mbedtls/padlock.h | 22 +- c++/src/connect/mbedtls/mbedtls/pem.h | 14 +- c++/src/connect/mbedtls/mbedtls/pk.h | 18 +- c++/src/connect/mbedtls/mbedtls/pk_internal.h | 14 +- c++/src/connect/mbedtls/mbedtls/pkcs11.h | 16 +- c++/src/connect/mbedtls/mbedtls/pkcs12.h | 94 +- c++/src/connect/mbedtls/mbedtls/pkcs5.h | 84 +- c++/src/connect/mbedtls/mbedtls/platform.h | 38 +- .../connect/mbedtls/mbedtls/platform_time.h | 16 +- .../connect/mbedtls/mbedtls/platform_util.h | 20 +- c++/src/connect/mbedtls/mbedtls/poly1305.h | 14 +- c++/src/connect/mbedtls/mbedtls/psa_util.h | 14 +- c++/src/connect/mbedtls/mbedtls/ripemd160.h | 14 +- c++/src/connect/mbedtls/mbedtls/rsa.h | 35 +- .../connect/mbedtls/mbedtls/rsa_internal.h | 14 +- c++/src/connect/mbedtls/mbedtls/sha1.h | 14 +- c++/src/connect/mbedtls/mbedtls/sha256.h | 14 +- c++/src/connect/mbedtls/mbedtls/sha512.h | 14 +- c++/src/connect/mbedtls/mbedtls/ssl.h | 27 +- c++/src/connect/mbedtls/mbedtls/ssl_cache.h | 22 +- .../mbedtls/mbedtls/ssl_ciphersuites.h | 16 +- c++/src/connect/mbedtls/mbedtls/ssl_cookie.h | 14 +- .../connect/mbedtls/mbedtls/ssl_internal.h | 14 +- c++/src/connect/mbedtls/mbedtls/ssl_ticket.h | 14 +- c++/src/connect/mbedtls/mbedtls/threading.h | 18 +- c++/src/connect/mbedtls/mbedtls/timing.h | 14 +- c++/src/connect/mbedtls/mbedtls/version.h | 32 +- c++/src/connect/mbedtls/mbedtls/x509.h | 17 +- c++/src/connect/mbedtls/mbedtls/x509_crl.h | 14 +- c++/src/connect/mbedtls/mbedtls/x509_crt.h | 22 +- c++/src/connect/mbedtls/mbedtls/x509_csr.h | 16 +- c++/src/connect/mbedtls/mbedtls/xtea.h | 14 +- c++/src/connect/mbedtls/mbedtls_md5.c | 14 +- c++/src/connect/mbedtls/mbedtls_version.c | 14 +- c++/src/connect/mbedtls/md.c | 16 +- c++/src/connect/mbedtls/md2.c | 14 +- c++/src/connect/mbedtls/md4.c | 14 +- c++/src/connect/mbedtls/memory_buffer_alloc.c | 14 +- c++/src/connect/mbedtls/mps_common.h | 16 +- c++/src/connect/mbedtls/mps_error.h | 16 +- c++/src/connect/mbedtls/mps_reader.c | 16 +- c++/src/connect/mbedtls/mps_reader.h | 16 +- c++/src/connect/mbedtls/mps_trace.c | 16 +- c++/src/connect/mbedtls/mps_trace.h | 16 +- c++/src/connect/mbedtls/net_sockets.c | 35 +- c++/src/connect/mbedtls/nist_kw.c | 31 +- c++/src/connect/mbedtls/oid.c | 14 +- c++/src/connect/mbedtls/padlock.c | 18 +- c++/src/connect/mbedtls/pem.c | 14 +- c++/src/connect/mbedtls/pk.c | 19 +- c++/src/connect/mbedtls/pk_wrap.c | 32 +- c++/src/connect/mbedtls/pkcs11.c | 14 +- c++/src/connect/mbedtls/pkcs12.c | 83 +- c++/src/connect/mbedtls/pkcs5.c | 79 +- c++/src/connect/mbedtls/pkparse.c | 16 +- c++/src/connect/mbedtls/pkwrite.c | 67 +- c++/src/connect/mbedtls/platform.c | 14 +- c++/src/connect/mbedtls/platform_util.c | 18 +- c++/src/connect/mbedtls/poly1305.c | 14 +- c++/src/connect/mbedtls/psa/crypto.h | 14 +- .../mbedtls/psa/crypto_builtin_composites.h | 14 +- .../mbedtls/psa/crypto_builtin_primitives.h | 14 +- c++/src/connect/mbedtls/psa/crypto_compat.h | 16 +- c++/src/connect/mbedtls/psa/crypto_config.h | 14 +- .../mbedtls/psa/crypto_driver_common.h | 14 +- .../psa/crypto_driver_contexts_composites.h | 14 +- .../psa/crypto_driver_contexts_primitives.h | 14 +- c++/src/connect/mbedtls/psa/crypto_extra.h | 20 +- c++/src/connect/mbedtls/psa/crypto_platform.h | 14 +- .../connect/mbedtls/psa/crypto_se_driver.h | 18 +- c++/src/connect/mbedtls/psa/crypto_sizes.h | 14 +- c++/src/connect/mbedtls/psa/crypto_struct.h | 18 +- c++/src/connect/mbedtls/psa/crypto_types.h | 18 +- c++/src/connect/mbedtls/psa/crypto_values.h | 42 +- c++/src/connect/mbedtls/psa_crypto.c | 1009 +++++-- c++/src/connect/mbedtls/psa_crypto_aead.c | 14 +- c++/src/connect/mbedtls/psa_crypto_aead.h | 14 +- c++/src/connect/mbedtls/psa_crypto_cipher.c | 20 +- c++/src/connect/mbedtls/psa_crypto_cipher.h | 14 +- c++/src/connect/mbedtls/psa_crypto_client.c | 14 +- c++/src/connect/mbedtls/psa_crypto_core.h | 88 +- .../mbedtls/psa_crypto_driver_wrappers.c | 14 +- .../mbedtls/psa_crypto_driver_wrappers.h | 14 +- c++/src/connect/mbedtls/psa_crypto_ecp.c | 14 +- c++/src/connect/mbedtls/psa_crypto_ecp.h | 14 +- c++/src/connect/mbedtls/psa_crypto_hash.c | 14 +- c++/src/connect/mbedtls/psa_crypto_hash.h | 14 +- c++/src/connect/mbedtls/psa_crypto_invasive.h | 29 +- c++/src/connect/mbedtls/psa_crypto_its.h | 14 +- c++/src/connect/mbedtls/psa_crypto_mac.c | 14 +- c++/src/connect/mbedtls/psa_crypto_mac.h | 14 +- .../connect/mbedtls/psa_crypto_random_impl.h | 14 +- c++/src/connect/mbedtls/psa_crypto_rsa.c | 14 +- c++/src/connect/mbedtls/psa_crypto_rsa.h | 14 +- c++/src/connect/mbedtls/psa_crypto_se.c | 14 +- c++/src/connect/mbedtls/psa_crypto_se.h | 14 +- .../mbedtls/psa_crypto_slot_management.c | 14 +- .../mbedtls/psa_crypto_slot_management.h | 14 +- c++/src/connect/mbedtls/psa_crypto_storage.c | 14 +- c++/src/connect/mbedtls/psa_crypto_storage.h | 18 +- c++/src/connect/mbedtls/psa_its_file.c | 14 +- c++/src/connect/mbedtls/ripemd160.c | 14 +- c++/src/connect/mbedtls/rsa.c | 97 +- c++/src/connect/mbedtls/rsa_internal.c | 16 +- c++/src/connect/mbedtls/sha1.c | 14 +- c++/src/connect/mbedtls/sha256.c | 14 +- c++/src/connect/mbedtls/sha512.c | 14 +- c++/src/connect/mbedtls/ssl_cache.c | 46 +- c++/src/connect/mbedtls/ssl_ciphersuites.c | 16 +- c++/src/connect/mbedtls/ssl_cli.c | 14 +- c++/src/connect/mbedtls/ssl_cookie.c | 14 +- c++/src/connect/mbedtls/ssl_msg.c | 27 +- c++/src/connect/mbedtls/ssl_srv.c | 14 +- c++/src/connect/mbedtls/ssl_ticket.c | 14 +- c++/src/connect/mbedtls/ssl_tls.c | 85 +- c++/src/connect/mbedtls/ssl_tls13_keys.c | 14 +- c++/src/connect/mbedtls/ssl_tls13_keys.h | 14 +- c++/src/connect/mbedtls/threading.c | 14 +- c++/src/connect/mbedtls/timing.c | 37 +- c++/src/connect/mbedtls/version_features.c | 29 +- c++/src/connect/mbedtls/x509.c | 30 +- c++/src/connect/mbedtls/x509_create.c | 42 +- c++/src/connect/mbedtls/x509_crl.c | 14 +- c++/src/connect/mbedtls/x509_crt.c | 47 +- c++/src/connect/mbedtls/x509_csr.c | 14 +- c++/src/connect/mbedtls/x509write_crt.c | 34 +- c++/src/connect/mbedtls/x509write_csr.c | 16 +- c++/src/connect/mbedtls/xtea.c | 14 +- c++/src/connect/ncbi_http2_session.cpp | 7 +- c++/src/connect/ncbi_sendmail.c | 4 +- c++/src/connect/ncbi_socket.c | 8 +- c++/src/connect/ncbi_uv_nghttp2.cpp | 4 +- c++/src/corelib/ncbi_cookies.cpp | 10 +- c++/src/corelib/ncbi_system.cpp | 9 +- c++/src/corelib/request_status.cpp | 3 +- c++/src/dbapi/driver/dbapi_conn_factory.cpp | 16 +- c++/src/objects/gbproj/ProjectItem.cpp | 20 +- c++/src/objects/gbproj/gbproj.asn | 49 +- c++/src/objects/general/Dbtag.cpp | 16 +- c++/src/objects/general/Dbtag.inc | 12 + .../objects/macro/CMakeLists.macro.asn.txt | 39 +- c++/src/objects/macro/make_fsm_file.py | 29 - c++/src/objects/pub/Pub.cpp | 36 +- c++/src/objects/remap/remap_client.cpp | 6 +- c++/src/objects/seqfeat/OrgMod.cpp | 45 +- c++/src/objects/seqfeat/SubSource.cpp | 100 +- c++/src/objects/seqfeat/ecnum_ambiguous.inc | 9 +- c++/src/objects/seqfeat/ecnum_ambiguous.txt | 2 + c++/src/objects/seqfeat/ecnum_deleted.inc | 7 +- c++/src/objects/seqfeat/ecnum_replaced.inc | 15 +- c++/src/objects/seqfeat/ecnum_replaced.txt | 8 + c++/src/objects/seqfeat/ecnum_specific.inc | 76 +- c++/src/objects/seqfeat/ecnum_specific.txt | 69 +- c++/src/objects/seqfeat/institution_codes.inc | 60 +- c++/src/objects/seqfeat/institution_codes.txt | 54 +- c++/src/objects/seqloc/Seq_id.cpp | 14 +- c++/src/objects/seqloc/accguide.txt | 230 +- c++/src/objects/seqloc/accguide2.inc | 236 +- c++/src/objects/seqloc/accguide2.txt | 230 +- c++/src/objects/taxon1/local_taxon.cpp | 24 +- c++/src/objects/valerr/ValidErrItem.cpp | 196 +- c++/src/objects/valerr/ValidError.cpp | 102 +- c++/src/objects/valid/validrules.inc | 4 +- c++/src/objmgr/util/create_defline.cpp | 45 +- c++/src/objmgr/util/indexer.cpp | 7 +- c++/src/objtools/CMakeLists.txt | 5 +- c++/src/objtools/Makefile.in | 5 +- .../align_format/align_format_util.cpp | 2009 +++++++------- c++/src/objtools/align_format/showalign.cpp | 206 +- c++/src/objtools/align_format/showdefline.cpp | 4 +- .../unit_test/data/tabular_db.pdb | Bin 0 -> 32768 bytes .../unit_test/data/tabular_db.phr | Bin 0 -> 4843 bytes .../unit_test/data/tabular_db.pin | Bin 0 -> 280 bytes .../unit_test/data/tabular_db.pjs | 27 + .../unit_test/data/tabular_db.pog | Bin 0 -> 72 bytes .../unit_test/data/tabular_db.pos | Bin 0 -> 507 bytes .../unit_test/data/tabular_db.pot | Bin 0 -> 164 bytes .../unit_test/data/tabular_db.ppd | Bin 0 -> 80 bytes .../unit_test/data/tabular_db.ppi | Bin 0 -> 52 bytes .../unit_test/data/tabular_db.psq | Bin 0 -> 1355 bytes .../unit_test/data/tabular_db.ptf | Bin 0 -> 16384 bytes .../unit_test/data/tabular_db.pto | Bin 0 -> 136 bytes .../unit_test/tabularinof_unit_test.cpp | 8 +- .../blastdb_format/blastdb_dataextract.cpp | 8 +- .../blast/gene_info_reader/gene_info.cpp | 14 +- .../gene_info_reader/gene_info_reader.cpp | 4 +- c++/src/objtools/blast/seqdb_reader/seqdb.cpp | 40 +- .../objtools/blast/seqdb_reader/seqdbblob.cpp | 20 +- .../objtools/blast/seqdb_reader/seqdbimpl.cpp | 11 +- .../objtools/blast/seqdb_reader/seqdbisam.cpp | 4 +- .../blast/seqdb_reader/seqdblmdbset.cpp | 27 +- .../blast/seqdb_reader/seqdblmdbset.hpp | 2 + .../blast/seqdb_reader/seqdboidlist.cpp | 4 +- .../blast/seqdb_reader/seqdboidlist.hpp | 4 +- .../objtools/blast/seqdb_reader/seqdbtax.cpp | 14 +- .../objtools/blast/seqdb_reader/seqdbvol.cpp | 10 +- .../blast/seqdb_reader/seqidlist_reader.cpp | 2 +- .../blast/seqdb_reader/tax4blastsqlite.cpp | 6 +- .../blast/seqdb_writer/build-alias-index | 2 +- .../objtools/blast/seqdb_writer/build_db.cpp | 20 +- .../unit_test/writedb_unit_test.cpp | 8 +- .../objtools/blast/seqdb_writer/writedb.cpp | 13 +- .../blast/seqdb_writer/writedb_impl.cpp | 72 +- .../blast/seqdb_writer/writedb_impl.hpp | 23 +- .../cleanup/CMakeLists.cleanup.lib.txt | 4 +- c++/src/objtools/cleanup/Makefile.cleanup.lib | 4 +- .../cleanup/autogenerated_cleanup.cpp | 3 +- .../autogenerated_extended_cleanup.cpp | 3 +- .../cleanup/capitalization_string.cpp | 31 +- c++/src/objtools/cleanup/cleanup.cpp | 58 +- c++/src/objtools/cleanup/cleanup_utils.cpp | 29 +- c++/src/objtools/cleanup/cleanup_utils.hpp | 4 +- .../objtools/cleanup/huge_file_cleanup.cpp | 799 ------ c++/src/objtools/cleanup/influenza_set.cpp | 4 +- c++/src/objtools/cleanup/newcleanupp.cpp | 1328 +++++----- c++/src/objtools/cleanup/newcleanupp.hpp | 3 - .../blastdb/remote_blastdb_adapter.hpp | 4 +- .../data_loaders/genbank/dispatcher.cpp | 13 +- .../data_loaders/genbank/gbloader.cpp | 350 +-- .../data_loaders/genbank/gbnative.cpp | 39 +- .../data_loaders/genbank/psg_loader.cpp | 19 +- .../data_loaders/genbank/psg_loader_impl.cpp | 41 +- .../objtools/data_loaders/genbank/reader.cpp | 3 +- .../data_loaders/genbank/reader_id2_base.cpp | 10 +- c++/src/objtools/edit/CMakeLists.edit.lib.txt | 4 +- c++/src/objtools/edit/Makefile.edit.lib | 4 +- c++/src/objtools/edit/eutils_updater.cpp | 224 +- c++/src/objtools/edit/feattable_edit.cpp | 344 ++- c++/src/objtools/edit/huge_asn_loader.cpp | 254 -- c++/src/objtools/edit/huge_asn_reader.cpp | 652 ----- c++/src/objtools/edit/huge_file.cpp | 207 -- c++/src/objtools/edit/huge_file_process.cpp | 276 -- c++/src/objtools/edit/pub_fix.cpp | 41 +- c++/src/objtools/edit/pub_fix_aux.hpp | 10 +- c++/src/objtools/edit/remote_updater.cpp | 205 +- c++/src/objtools/edit/seq_entry_edit.cpp | 22 +- .../objtools/eutils/efetch/PubmedArticle.cpp | 19 +- c++/src/objtools/format/CMakeLists.txt | 3 +- c++/src/objtools/format/Makefile.in | 4 +- c++/src/objtools/format/comment_item.cpp | 5 +- c++/src/objtools/format/dbsource_item.cpp | 12 +- c++/src/objtools/format/feature_item.cpp | 31 +- c++/src/objtools/format/flat_file_config.cpp | 7 +- c++/src/objtools/format/gather_items.cpp | 112 +- c++/src/objtools/format/gbseq_formatter.cpp | 6 +- c++/src/objtools/format/genbank_formatter.cpp | 22 +- c++/src/objtools/format/genbank_gather.cpp | 20 +- c++/src/objtools/format/gene_finder.cpp | 33 +- .../objtools/format/genome_project_item.cpp | 14 +- c++/src/objtools/format/item_formatter.cpp | 6 +- c++/src/objtools/format/keywords_item.cpp | 4 +- c++/src/objtools/format/qualifiers.cpp | 4 +- c++/src/objtools/format/source_item.cpp | 48 +- .../pubseq_gateway/client/psg_client.cpp | 23 +- .../pubseq_gateway/client/psg_client_impl.hpp | 4 +- .../client/psg_client_transport.cpp | 64 +- .../client/psg_client_transport.hpp | 75 +- .../client/test/test_psg_client_impl.cpp | 4 +- c++/src/objtools/readers/agp_util.cpp | 8 +- c++/src/objtools/readers/fasta.cpp | 34 +- c++/src/objtools/readers/gff3_reader.cpp | 4 +- .../objtools/readers/gtf_location_merger.cpp | 48 +- .../objtools/readers/gtf_location_merger.hpp | 5 +- c++/src/objtools/readers/gtf_reader.cpp | 421 ++- c++/src/objtools/readers/line_error.cpp | 566 ++-- c++/src/objtools/readers/message_listener.cpp | 34 +- c++/src/objtools/readers/mod_reader.cpp | 5 +- c++/src/objtools/readers/mod_to_enum.cpp | 26 +- c++/src/objtools/readers/reader_base.cpp | 14 +- c++/src/objtools/readers/readfeat.cpp | 216 +- .../objtools/readers/source_mod_parser.cpp | 14 +- .../sra/data_loaders/bam/bamloader_impl.cpp | 127 +- .../data_loaders/bam/test/test_bam_loader.cpp | 28 +- .../test/CMakeLists.test_snp_loader.app.txt | 15 - .../sra/data_loaders/snp/test/CMakeLists.txt | 4 - c++/src/sra/data_loaders/snp/test/Makefile.in | 34 - .../snp/test/Makefile.test_snp_loader.app | 22 - .../data_loaders/snp/test/test_snp_loader.cpp | 545 ---- .../data_loaders/snp/test/test_snp_loader.ini | 4 - c++/src/sra/readers/bam/bgzf.cpp | 4 +- c++/src/sra/readers/sra/vdbread.cpp | 9 +- c++/src/sra/readers/sra/wgsread.cpp | 29 +- c++/src/util/stream_source.cpp | 43 +- c++/src/util/unicode.cpp | 4 +- c++/src/util/unicode_plans.inl | 4 +- c++/src/util/unicode_to_ascii.txt | 2 +- 656 files changed, 13500 insertions(+), 15524 deletions(-) rename c++/{src/objtools/edit/huge_asn_macro_reader.cpp => include/cgi/caf_encoded.hpp} (77%) create mode 100644 c++/include/cgi/caf_plain.hpp delete mode 100644 c++/include/objtools/cleanup/huge_file_cleanup.hpp rename c++/{src => include}/objtools/cleanup/influenza_set.hpp (90%) delete mode 100644 c++/include/objtools/edit/huge_asn_macro_reader.hpp create mode 100755 c++/scripts/common/check/retry_db_load.sh create mode 100755 c++/scripts/projects/blast/post_build/macosx/build_universal_binary.sh create mode 100755 c++/scripts/projects/blast/post_build/macosx/uninstaller/build_uninstaller.sh create mode 100644 c++/scripts/projects/blast/post_build/macosx/uninstaller/uninstall_ncbi_blast.applescript delete mode 100644 c++/scripts/projects/dispatcher/ChangeLog delete mode 100644 c++/scripts/projects/dispatcher/LICENSE delete mode 100644 c++/scripts/projects/dispatcher/Manifest delete mode 100644 c++/scripts/projects/dispatcher/README delete mode 100644 c++/scripts/projects/dispatcher/project.lst delete mode 100644 c++/scripts/projects/fwdaemon/ChangeLog delete mode 100644 c++/scripts/projects/fwdaemon/LICENSE delete mode 100644 c++/scripts/projects/fwdaemon/Manifest delete mode 100644 c++/scripts/projects/fwdaemon/README delete mode 100644 c++/scripts/projects/fwdaemon/project.lst delete mode 100644 c++/scripts/projects/lbsbd/ChangeLog delete mode 100644 c++/scripts/projects/lbsbd/LICENSE delete mode 100644 c++/scripts/projects/lbsbd/Manifest delete mode 100644 c++/scripts/projects/lbsbd/README delete mode 100644 c++/scripts/projects/lbsbd/project.lst delete mode 100644 c++/scripts/projects/mod_caf/ChangeLog delete mode 100644 c++/scripts/projects/mod_caf/LICENSE delete mode 100644 c++/scripts/projects/mod_caf/Manifest delete mode 100644 c++/scripts/projects/mod_caf/README delete mode 100644 c++/scripts/projects/mod_caf/project.lst delete mode 100644 c++/scripts/projects/mod_loadinfo/ChangeLog delete mode 100644 c++/scripts/projects/mod_loadinfo/LICENSE delete mode 100644 c++/scripts/projects/mod_loadinfo/Manifest delete mode 100644 c++/scripts/projects/mod_loadinfo/README delete mode 100644 c++/scripts/projects/mod_loadinfo/project.lst delete mode 100644 c++/src/app/blast/CMakeLists.blast_report.app.txt delete mode 100755 c++/src/app/blast/Makefile.blast_report.app delete mode 100755 c++/src/app/blast/blast_report.cpp delete mode 100755 c++/src/app/blast/blast_report.ini create mode 100644 c++/src/build-system/cmake/conanfile.py create mode 100644 c++/src/build-system/cmake/toolchains/x86_64-linux-gcc-1320.cmake create mode 100644 c++/src/connect/mbedtls/bignum_internal.h delete mode 100644 c++/src/objects/macro/make_fsm_file.py create mode 100644 c++/src/objtools/align_format/unit_test/data/tabular_db.pdb create mode 100644 c++/src/objtools/align_format/unit_test/data/tabular_db.phr create mode 100644 c++/src/objtools/align_format/unit_test/data/tabular_db.pin create mode 100644 c++/src/objtools/align_format/unit_test/data/tabular_db.pjs create mode 100644 c++/src/objtools/align_format/unit_test/data/tabular_db.pog create mode 100644 c++/src/objtools/align_format/unit_test/data/tabular_db.pos create mode 100644 c++/src/objtools/align_format/unit_test/data/tabular_db.pot create mode 100644 c++/src/objtools/align_format/unit_test/data/tabular_db.ppd create mode 100644 c++/src/objtools/align_format/unit_test/data/tabular_db.ppi create mode 100644 c++/src/objtools/align_format/unit_test/data/tabular_db.psq create mode 100644 c++/src/objtools/align_format/unit_test/data/tabular_db.ptf create mode 100644 c++/src/objtools/align_format/unit_test/data/tabular_db.pto delete mode 100644 c++/src/objtools/cleanup/huge_file_cleanup.cpp delete mode 100644 c++/src/objtools/edit/huge_asn_loader.cpp delete mode 100644 c++/src/objtools/edit/huge_asn_reader.cpp delete mode 100644 c++/src/objtools/edit/huge_file.cpp delete mode 100644 c++/src/objtools/edit/huge_file_process.cpp delete mode 100644 c++/src/sra/data_loaders/snp/test/CMakeLists.test_snp_loader.app.txt delete mode 100644 c++/src/sra/data_loaders/snp/test/CMakeLists.txt delete mode 100644 c++/src/sra/data_loaders/snp/test/Makefile.in delete mode 100644 c++/src/sra/data_loaders/snp/test/Makefile.test_snp_loader.app delete mode 100644 c++/src/sra/data_loaders/snp/test/test_snp_loader.cpp delete mode 100644 c++/src/sra/data_loaders/snp/test/test_snp_loader.ini diff --git a/c++/compilers/xcode30_prj/postbuild.sh b/c++/compilers/xcode30_prj/postbuild.sh index 7002a41d..d1f8ba23 100755 --- a/c++/compilers/xcode30_prj/postbuild.sh +++ b/c++/compilers/xcode30_prj/postbuild.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: postbuild.sh 646121 2022-03-02 16:57:04Z ucko $ +# $Id: postbuild.sh 676732 2023-12-21 15:55:08Z sadyrovr $ # =========================================================================== # # PUBLIC DOMAIN NOTICE @@ -39,14 +39,15 @@ for v in "$BUILD_TREE_ROOT"; do fi done product=$TARGET_BUILD_DIR/$FULL_PRODUCT_NAME -vdbdlib="${NCBI_VDB_LIBPATH}/vdb/vdb-versions/cxx_toolkit/3/mac/release/x86_64/lib/libncbi-vdb.3.dylib" +arch=`lipo -archs $product` +vdbdlib="${NCBI_VDB_LIBPATH}/vdb/vdb-versions/cxx_toolkit/3/mac/release/$arch/lib/libncbi-vdb.3.dylib" if test "$ACTION" = "build"; then if test "$MACH_O_TYPE" = "mh_execute" -o "$MACH_O_TYPE" = "mh_dylib"; then vdb=`otool -L $product | grep libncbi-vdb | grep dylib` if test -n "$vdb"; then ref=`echo $vdb | awk 'NR==1{print $1}'` - install_name_tool -change $ref $vdbdlib $product + install_name_tool -change $ref "$vdbdlib" $product fi fi fi diff --git a/c++/include/algo/blast/api/blast_dbindex.hpp b/c++/include/algo/blast/api/blast_dbindex.hpp index a030132a..3190b687 100644 --- a/c++/include/algo/blast/api/blast_dbindex.hpp +++ b/c++/include/algo/blast/api/blast_dbindex.hpp @@ -1,4 +1,4 @@ -/* $Id: blast_dbindex.hpp 575325 2018-11-27 18:22:00Z ucko $ +/* $Id: blast_dbindex.hpp 683528 2024-05-30 12:54:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -45,7 +45,7 @@ BEGIN_SCOPE(blast) NCBI_XBLAST_EXPORT std::string DbIndexInit( - const string & indexname, bool old_style, bool & partial ); + const string & indexname, bool old_style, bool & partial, const int word_size); NCBI_XBLAST_EXPORT void SetUpDbIndexCallbacks( void ); @@ -53,8 +53,6 @@ void SetUpDbIndexCallbacks( void ); NCBI_XBLAST_EXPORT void ClearDbIndexCallbacks( void ); -/** Get minimal word size accepted by indexing library. -*/ NCBI_XBLAST_EXPORT int MinIndexWordSize(); diff --git a/c++/include/algo/blast/api/blast_exception.hpp b/c++/include/algo/blast/api/blast_exception.hpp index 89193ace..c6d93ea2 100644 --- a/c++/include/algo/blast/api/blast_exception.hpp +++ b/c++/include/algo/blast/api/blast_exception.hpp @@ -1,4 +1,4 @@ -/* $Id: blast_exception.hpp 575325 2018-11-27 18:22:00Z ucko $ +/* $Id: blast_exception.hpp 683531 2024-05-30 12:54:42Z ivanov $ * =========================================================================== * * public DOMAIN NOTICE @@ -83,7 +83,8 @@ public: eSeqSrcInit, ///< Initialization error in BlastSeqSrc /// implementation eRpsInit, ///< Error while initializing RPS-BLAST - eSetup ///< Error while setting up BLAST + eSetup, ///< Error while setting up BLAST + eSystem ///< System exception }; /// Translate from the error code value to its string representation @@ -96,6 +97,7 @@ public: case eInvalidCharacter: return "eInvalidCharacter"; case eSeqSrcInit: return "eSeqSrcInit"; case eRpsInit: return "eRpsInit"; + case eSystem: return "eSystem"; default: return CException::GetErrCodeString(); } } diff --git a/c++/include/algo/blast/api/blast_node.hpp b/c++/include/algo/blast/api/blast_node.hpp index c6f9b01a..eb8bec36 100644 --- a/c++/include/algo/blast/api/blast_node.hpp +++ b/c++/include/algo/blast/api/blast_node.hpp @@ -1,4 +1,4 @@ -/* $Id: blast_node.hpp 628367 2021-03-30 12:39:19Z fongah2 $ +/* $Id: blast_node.hpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -73,7 +73,7 @@ public: return rv; } void UnreadMsg(CRef msg) { CFastMutexGuard guard(m_Mutex); m_MsgQueue.push_front(msg);} - int GetNumMsgs () { CFastMutexGuard guard(m_Mutex); return m_MsgQueue.size(); } + int GetNumMsgs () { CFastMutexGuard guard(m_Mutex); return static_cast(m_MsgQueue.size()); } int GetNodeNum() { return m_NodeNum; } ~CBlastNodeMailbox() { m_MsgQueue.resize(0); } private: @@ -138,7 +138,7 @@ public: typedef map TActiveNodes; typedef map > TFormatQueue; void RegisterNode(CBlastNode * node, CBlastNodeMailbox * mailbox); - int GetNumNodes() { return m_RegisteredNodes.size();} + int GetNumNodes() { return static_cast(m_RegisteredNodes.size());} int IsFull(); void Shutdown() { m_MaxNumNodes = -1; } bool Processing(); diff --git a/c++/include/algo/blast/api/cdd_pssm_input.hpp b/c++/include/algo/blast/api/cdd_pssm_input.hpp index ddc83a69..b874e222 100644 --- a/c++/include/algo/blast/api/cdd_pssm_input.hpp +++ b/c++/include/algo/blast/api/cdd_pssm_input.hpp @@ -1,7 +1,7 @@ #ifndef ALGO_BLAST_API__CDD_PSSM_INPUT__HPP #define ALGO_BLAST_API__CDD_PSSM_INPUT__HPP -/* $Id: cdd_pssm_input.hpp 389681 2013-02-20 13:16:20Z kornbluh $ +/* $Id: cdd_pssm_input.hpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -141,7 +141,7 @@ public: /// Get query length /// @return Query length /// - unsigned int GetQueryLength(void) {return m_QueryData.size();} + unsigned int GetQueryLength(void) {return static_cast(m_QueryData.size());} /// Get scoring matrix name /// @return Scoring matrix name diff --git a/c++/include/algo/blast/blastinput/blast_args.hpp b/c++/include/algo/blast/blastinput/blast_args.hpp index 4179aee0..a969aeac 100644 --- a/c++/include/algo/blast/blastinput/blast_args.hpp +++ b/c++/include/algo/blast/blastinput/blast_args.hpp @@ -1,4 +1,4 @@ -/* $Id: blast_args.hpp 673577 2023-10-04 13:18:08Z ivanov $ +/* $Id: blast_args.hpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -1105,7 +1105,7 @@ public: m_DfltNumAlignments = m_DfltNumDescriptions = 10; } else { m_DfltNumAlignments = static_cast(align_format::kDfltArgNumAlignments) ; - m_DfltNumDescriptions = align_format::kDfltArgNumDescriptions; + m_DfltNumDescriptions = static_cast(align_format::kDfltArgNumDescriptions); } }; diff --git a/c++/include/algo/blast/core/blast_message.h b/c++/include/algo/blast/core/blast_message.h index 31c260be..f90d3eab 100644 --- a/c++/include/algo/blast/core/blast_message.h +++ b/c++/include/algo/blast/core/blast_message.h @@ -1,4 +1,4 @@ -/* $Id: blast_message.h 673573 2023-10-04 13:17:42Z ivanov $ +/* $Id: blast_message.h 683531 2024-05-30 12:54:42Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -173,6 +173,10 @@ void Blast_PerrorEx(Blast_Message* *msg, /** Blast seqsrc returns BLAST_SEQSRC_ERROR */ #define BLASTERR_SEQSRC 300 +/** Database file error */ +#define BLASTERR_DB_MEMORY_MAP 400 +#define BLASTERR_DB_OPEN_FILES 401 + #ifdef __cplusplus } diff --git a/c++/include/algo/blast/core/blast_options.h b/c++/include/algo/blast/core/blast_options.h index 50eb95d7..36d1baa8 100644 --- a/c++/include/algo/blast/core/blast_options.h +++ b/c++/include/algo/blast/core/blast_options.h @@ -1,4 +1,4 @@ -/* $Id: blast_options.h 662804 2023-02-07 13:36:00Z fongah2 $ +/* $Id: blast_options.h 683527 2024-05-30 12:54:02Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -104,7 +104,7 @@ extern "C" { #define BLAST_WORD_THRESHOLD_BLASTP 11 /**< default neighboring threshold (blastp and for rpsblast at RPS-BLAST database creation time) */ -#define BLAST_WORD_THRESHOLD_BLASTP_FAST 19.3 //neighboring threshold for word size 5 (blastp/x-fast) +#define BLAST_WORD_THRESHOLD_BLASTP_FAST 20 //neighboring threshold for word size 5 (blastp/x-fast) #define BLAST_WORD_THRESHOLD_BLASTP_WD_SZ_6 21 //neighboring threshold for word size 6 #define BLAST_WORD_THRESHOLD_BLASTP_WD_SZ_7 20.25 //neighboring threshold for word size 7 diff --git a/c++/include/algo/blast/dbindex/dbindex.hpp b/c++/include/algo/blast/dbindex/dbindex.hpp index ddcba470..02cb5a5c 100644 --- a/c++/include/algo/blast/dbindex/dbindex.hpp +++ b/c++/include/algo/blast/dbindex/dbindex.hpp @@ -1,4 +1,4 @@ -/* $Id: dbindex.hpp 575325 2018-11-27 18:22:00Z ucko $ +/* $Id: dbindex.hpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -577,7 +577,7 @@ class NCBI_XBLAST_EXPORT CDbIndex : public CObject TSeqNum start = MapSubject( subj, 0 ); TSeqNum end = MapSubject( subj + 1, 0 ); - if( end == 0 ) end = start_ + results_.size() + 1; + if( end == 0 ) end = start_ + static_cast(results_.size()) + 1; for( TSeqNum chunk = start; chunk < end; ++chunk ) { if( GetResults( chunk ) != 0 ) { @@ -615,7 +615,7 @@ class NCBI_XBLAST_EXPORT CDbIndex : public CObject /** Get the number of logical sequences in the results set. @return number of sequences in the result set */ - TSeqNum NumSeq() const { return results_.size(); } + TSeqNum NumSeq() const { return static_cast(results_.size()); } private: @@ -1219,7 +1219,7 @@ class CSubjectMap @return number of chunks in the map */ TSeqNum NumSubjects() const - { return 1 + (lid_map_.size()>>2); } + { return static_cast(1 + (lid_map_.size()>>2)); } /** Get the length of the subject sequence. @@ -1275,15 +1275,15 @@ class CSubjectMap if( t.first < subjects_.size() - 1 ) { TSeqNum nc = subjects_[t.first + 1] - subjects_[t.first]; - return (t.second == nc - 1) ? max_chunk_size_ : + return (t.second == nc - 1) ? static_cast(max_chunk_size_) : getSubjectLength( t.first )%( - max_chunk_size_ - chunk_overlap_ ); + static_cast(max_chunk_size_ - chunk_overlap_ )); } - else return max_chunk_size_; + else return static_cast(max_chunk_size_); } else { - return getSubjectLength( subjects_.size() - 2 )%( - max_chunk_size_ - chunk_overlap_ ); + return static_cast( getSubjectLength( static_cast(subjects_.size() - 2) )%( + max_chunk_size_ - chunk_overlap_ ) ); } } @@ -1328,13 +1328,13 @@ class CSubjectMap { ASSERT( sid < subjects_.size() - 1 ); ASSERT( subjects_[sid] - 1 + rcid < chunks_.size() ); - TSeqPos res = rcid*(max_chunk_size_ - chunk_overlap_) + coff; + TSeqPos res = static_cast(rcid*(max_chunk_size_ - chunk_overlap_) + coff); ASSERT( res < lengths_[sid] ); return res; } - TSeqNum getNumSubjects() const { return subjects_.size() - 1; } - TSeqNum getNumChunks() const { return chunks_.size(); } + TSeqNum getNumSubjects() const { return static_cast(subjects_.size() - 1); } + TSeqNum getNumChunks() const { return static_cast(chunks_.size()); } TSeqNum getNumChunks( TSeqNum sid ) const { @@ -1342,7 +1342,7 @@ class CSubjectMap if( sid < subjects_.size() - 2 ) { return subjects_[sid + 1] - subjects_[sid]; } - else return chunks_.size() + 1 - subjects_[sid]; + else return static_cast( chunks_.size() + 1 - subjects_[sid]); } const Uint1 * getSeqData( TSeqNum sid ) const diff --git a/c++/include/algo/blast/format/data4xmlformat.hpp b/c++/include/algo/blast/format/data4xmlformat.hpp index c77574e5..2c87b873 100644 --- a/c++/include/algo/blast/format/data4xmlformat.hpp +++ b/c++/include/algo/blast/format/data4xmlformat.hpp @@ -1,4 +1,4 @@ -/* $Id: data4xmlformat.hpp 393164 2013-03-22 13:39:25Z fongah2 $ +/* $Id: data4xmlformat.hpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -166,7 +166,7 @@ public: CBlastFormattingMatrix* GetMatrix(void) const; /// @inheritDoc - unsigned int GetNumQueries(void) const { return m_Queries->Size(); } + unsigned int GetNumQueries(void) const { return static_cast(m_Queries->Size()); } /// @inheritDoc const TMaskedQueryRegions* diff --git a/c++/include/algo/blast/proteinkmer/mhfile.hpp b/c++/include/algo/blast/proteinkmer/mhfile.hpp index 65bd45c6..775c6bb7 100644 --- a/c++/include/algo/blast/proteinkmer/mhfile.hpp +++ b/c++/include/algo/blast/proteinkmer/mhfile.hpp @@ -1,4 +1,4 @@ -/* $Id: mhfile.hpp 621855 2020-12-17 15:26:40Z grichenk $ +/* $Id: mhfile.hpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -161,7 +161,7 @@ public: void GetMinHits(int oid, int& subjectOid, vector& hits) const; /// Returns the number of hash arrays. - int GetNumSignatures() const {return (m_DataFileSize/(GetDataWidth()*GetNumHashes()+4));} + int GetNumSignatures() const {return static_cast(m_DataFileSize/(GetDataWidth()*GetNumHashes()+4));} private: diff --git a/c++/include/algo/blast/vdb/blastn_vdb_args.hpp b/c++/include/algo/blast/vdb/blastn_vdb_args.hpp index b59ac708..162db0d4 100644 --- a/c++/include/algo/blast/vdb/blastn_vdb_args.hpp +++ b/c++/include/algo/blast/vdb/blastn_vdb_args.hpp @@ -1,4 +1,4 @@ -/* $Id: blastn_vdb_args.hpp 640787 2021-11-18 13:03:23Z fongah2 $ +/* $Id: blastn_vdb_args.hpp 676153 2023-12-11 14:53:51Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -41,6 +41,7 @@ BEGIN_NCBI_SCOPE BEGIN_SCOPE(blast) extern const string kArgSRASearchMode; +extern const string kArgIncludeFilteredReads; /// Argument class to collect database/subject arguments class CBlastVDatabaseArgs : public CBlastDatabaseArgs diff --git a/c++/include/algo/blast/vdb/seqsrc_vdb.h b/c++/include/algo/blast/vdb/seqsrc_vdb.h index 52d364b1..416efe71 100644 --- a/c++/include/algo/blast/vdb/seqsrc_vdb.h +++ b/c++/include/algo/blast/vdb/seqsrc_vdb.h @@ -1,7 +1,7 @@ #ifndef ALGO_BLAST_VDB___SEQSRC_VDB__H #define ALGO_BLAST_VDB___SEQSRC_VDB__H -/* $Id: seqsrc_vdb.h 640787 2021-11-18 13:03:23Z fongah2 $ +/* $Id: seqsrc_vdb.h 676153 2023-12-11 14:53:51Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -68,7 +68,7 @@ extern "C" { BlastSeqSrc* SRABlastSeqSrcInit(const char** sraRunAccessions, Uint4 numRuns, Boolean isProtein, Boolean* excluded_runs, Uint4 * status, - Boolean isCSRA); + Boolean isCSRA, Boolean include_filtered_reads); // ==========================================================================// diff --git a/c++/include/algo/blast/vdb/vdb2blast_util.hpp b/c++/include/algo/blast/vdb/vdb2blast_util.hpp index 4c547a04..66dbc12a 100644 --- a/c++/include/algo/blast/vdb/vdb2blast_util.hpp +++ b/c++/include/algo/blast/vdb/vdb2blast_util.hpp @@ -1,7 +1,7 @@ #ifndef ALGO_BLAST_VDB___VDB2BLAST_UTIL__HPP #define ALGO_BLAST_VDB___VDB2BLAST_UTIL__HPP -/* $Id: vdb2blast_util.hpp 640787 2021-11-18 13:03:23Z fongah2 $ +/* $Id: vdb2blast_util.hpp 676153 2023-12-11 14:53:51Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -74,7 +74,8 @@ public: /// @throws CException CVDBBlastUtil(const string& strAllRuns, bool bOwnSeqSrc = false, - bool bCSRA = false); + bool bCSRA = false, + bool bIncludeFilteredReads = false); /// Destructor virtual ~CVDBBlastUtil(); @@ -217,6 +218,8 @@ private: /// Pointer to a properly initialized SRA BlastSeqSrc. BlastSeqSrc* m_seqSrc; bool m_isCSRAUtil; + bool m_IncludeFilteredReads; + }; diff --git a/c++/include/algo/blast/vdb/vdbblast_local.hpp b/c++/include/algo/blast/vdb/vdbblast_local.hpp index 67b7dfe0..7945fb63 100644 --- a/c++/include/algo/blast/vdb/vdbblast_local.hpp +++ b/c++/include/algo/blast/vdb/vdbblast_local.hpp @@ -1,4 +1,4 @@ -/* $Id: vdbblast_local.hpp 640787 2021-11-18 13:03:23Z fongah2 $ +/* $Id: vdbblast_local.hpp 676153 2023-12-11 14:53:51Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -59,6 +59,7 @@ private: vector > & m_chunks_for_thread; unsigned int m_num_threads; Int4 m_num_extensions; + bool m_include_filtered_reads; CRef m_pssm; public: @@ -83,11 +84,13 @@ public: */ CLocalVDBBlast(CRef query_vector, CRef options, - CLocalVDBBlast::SLocalVDBStruct & local_vdb); + CLocalVDBBlast::SLocalVDBStruct & local_vdb, + bool include_filtered_reads = false); CLocalVDBBlast(CRef pssm, CRef options, - SLocalVDBStruct & local_vdb); + SLocalVDBStruct & local_vdb, + bool include_filtered_reads = false); /* * Run Local VDB Search diff --git a/c++/src/objtools/edit/huge_asn_macro_reader.cpp b/c++/include/cgi/caf_encoded.hpp similarity index 77% rename from c++/src/objtools/edit/huge_asn_macro_reader.cpp rename to c++/include/cgi/caf_encoded.hpp index f8f3ae7a..78026e06 100644 --- a/c++/src/objtools/edit/huge_asn_macro_reader.cpp +++ b/c++/include/cgi/caf_encoded.hpp @@ -1,4 +1,7 @@ -/* $Id: huge_asn_macro_reader.cpp 658723 2022-11-07 18:22:37Z asztalos $ +#ifndef CGI___CAF_ENCODED__HPP +#define CGI___CAF_ENCODED__HPP + +/* $Id: caf_encoded.hpp 667390 2023-05-15 16:18:37Z lavr $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -23,26 +26,13 @@ * * =========================================================================== * -* Authors: Sergiy Gotvyanskyy, Andrea Asztalos +* Author: Anton Lavrentiev * * File Description: -* +* Forward header for encrypted implementation of cookie affinity interface * */ -#include -#include - -BEGIN_NCBI_SCOPE -BEGIN_SCOPE(objects) -BEGIN_SCOPE(edit) - -void CMacroHugeAsnReader::ResetTopEntry() -{ - x_ResetTopEntry(); -} - +#error "Please use " -END_SCOPE(edit) -END_SCOPE(objects) -END_NCBI_SCOPE +#endif /* CGI___CAF_ENCODED__HPP */ diff --git a/c++/include/cgi/caf_plain.hpp b/c++/include/cgi/caf_plain.hpp new file mode 100644 index 00000000..d891d98a --- /dev/null +++ b/c++/include/cgi/caf_plain.hpp @@ -0,0 +1,98 @@ +#ifndef CGI___CAF_PLAIN__HPP +#define CGI___CAF_PLAIN__HPP + +/* $Id: caf_plain.hpp 666534 2023-04-27 03:54:21Z lavr $ +* =========================================================================== +* +* PUBLIC DOMAIN NOTICE +* National Center for Biotechnology Information +* +* This software/database is a "United States Government Work" under the +* terms of the United States Copyright Act. It was written as part of +* the author's official duties as a United States Government employee and +* thus cannot be copyrighted. This software/database is freely available +* to the public for use. The National Library of Medicine and the U.S. +* Government have not placed any restriction on its use or reproduction. +* +* Although all reasonable efforts have been taken to ensure the accuracy +* and reliability of the software and data, the NLM and the U.S. +* Government do not and cannot warrant the performance or results that +* may be obtained by using this software or data. The NLM and the U.S. +* Government disclaim all warranties, express or implied, including +* warranties of performance, merchantability or fitness for any particular +* purpose. +* +* Please cite the author in any work or product based on this material. +* +* =========================================================================== +* +* Author: Anatoliy Kuznetsov +* +* File Description: +* Non-encoded implementation of cookie affinity interface +* +*/ + +#include +#include +#include +#include + + +/** @addtogroup CookieAffinity + * + * @{ + */ + + +BEGIN_NCBI_SCOPE + + +/////////////////////////////////////////////////////// +// +// CCookieAffinity_Plain:: +// +// Cookie affinity service interface implementation with no encoding +// + +class CCookieAffinity_Plain : public CCookieAffinity +{ +public: + // Return copy of the "str", or 0 if failed. + // The returned string is to be free()'d by the caller. + virtual char* Encode(const char* str, const char* key); + + // Return IP address of the current host, or 0 if failed. + virtual char* GetHostIP(char* buf, size_t bufsize); +}; + + +/* @} */ + + +///////////////////////////////////////////////////////////////////////////// +// IMPLEMENTATION of INLINE functions +///////////////////////////////////////////////////////////////////////////// + + +inline char* CCookieAffinity_Plain::Encode(const char* str, + const char* /*key*/) +{ + size_t len = ::strlen(str); + if ( !len ) + return 0; + char* buf = (char*) ::malloc(len + 1); + ::strcpy(buf, str); + return buf; +} + + +inline char* CCookieAffinity_Plain::GetHostIP(char* buf, size_t bufsize) +{ + return NcbiGetHostIP(buf, bufsize); +} + + +END_NCBI_SCOPE + +#endif /* CGI___CAF_PLAIN__HPP */ diff --git a/c++/include/cgi/cgi_exception.hpp b/c++/include/cgi/cgi_exception.hpp index e382243a..045e0100 100644 --- a/c++/include/cgi/cgi_exception.hpp +++ b/c++/include/cgi/cgi_exception.hpp @@ -1,7 +1,7 @@ #ifndef CGI___CGI_EXCEPTION__HPP #define CGI___CGI_EXCEPTION__HPP -/* $Id: cgi_exception.hpp 597641 2019-11-25 18:03:55Z grichenk $ +/* $Id: cgi_exception.hpp 674534 2023-10-30 13:23:30Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -103,6 +103,7 @@ public: e416_RangeNotSatisfiable = CRequestStatus::e416_RangeNotSatisfiable, e417_ExpectationFailed = CRequestStatus::e417_ExpectationFailed, e422_UnprocessableEntity = CRequestStatus::e422_UnprocessableEntity, + e451_Unavailable_For_Legal_Reasons = CRequestStatus::e451_Unavailable_For_Legal_Reasons, e500_InternalServerError = CRequestStatus::e500_InternalServerError, e501_NotImplemented = CRequestStatus::e501_NotImplemented, diff --git a/c++/include/common/ncbi_export.h b/c++/include/common/ncbi_export.h index a9fa1a00..e903b573 100644 --- a/c++/include/common/ncbi_export.h +++ b/c++/include/common/ncbi_export.h @@ -1,7 +1,7 @@ #ifndef COMMON___NCBI_EXPORT__H #define COMMON___NCBI_EXPORT__H -/* $Id: ncbi_export.h 640788 2021-11-18 13:03:30Z fongah2 $ +/* $Id: ncbi_export.h 680756 2024-03-27 13:49:07Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -164,6 +164,7 @@ # define NCBI_XOBJWRITE_EXPORTS # define NCBI_XOBJUTIL_EXPORTS # define NCBI_XOBJMANIP_EXPORTS +# define NCBI_XHUGEASN_EXPORTS #endif @@ -809,6 +810,14 @@ # define NCBI_SEQEDIT_EXPORT NCBI_DLL_IMPORT #endif +/* Export specifier for library xhugeasn + * */ +#ifdef NCBI_XHUGEASN_EXPORTS +# define NCBI_XHUGEASN_EXPORT NCBI_DLL_EXPORT +#else +# define NCBI_XHUGEASN_EXPORT NCBI_DLL_IMPORT +#endif + /* Export specifier for library seqtest */ #ifdef NCBI_SEQTEST_EXPORTS diff --git a/c++/include/common/ncbi_package_ver.h b/c++/include/common/ncbi_package_ver.h index c0352bdd..98883a7c 100644 --- a/c++/include/common/ncbi_package_ver.h +++ b/c++/include/common/ncbi_package_ver.h @@ -7,7 +7,7 @@ #define NCBI_PACKAGE 1 #define NCBI_PACKAGE_NAME "blast" #define NCBI_PACKAGE_VERSION_MAJOR 2 -#define NCBI_PACKAGE_VERSION_MINOR 15 +#define NCBI_PACKAGE_VERSION_MINOR 16 #define NCBI_PACKAGE_VERSION_PATCH 0 #define NCBI_PACKAGE_CONFIG "" diff --git a/c++/include/common/ncbi_source_ver.h b/c++/include/common/ncbi_source_ver.h index 5c4b594c..bb879cfe 100644 --- a/c++/include/common/ncbi_source_ver.h +++ b/c++/include/common/ncbi_source_ver.h @@ -1,4 +1,4 @@ -/* $Id: ncbi_source_ver.h 668465 2023-06-06 04:03:02Z syncbot $ +/* $Id: ncbi_source_ver.h 676126 2023-12-09 05:03:05Z syncbot $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -27,7 +27,7 @@ #include #include -/* #undef NCBI_PRODUCTION_VER */ +#define NCBI_PRODUCTION_VER 20231209 #define NCBI_DEVELOPMENT_VER 20230606 #if defined(NCBI_PRODUCTION_VER) diff --git a/c++/include/connect/impl/connect_misc.hpp b/c++/include/connect/impl/connect_misc.hpp index b81f6363..dfd44ded 100644 --- a/c++/include/connect/impl/connect_misc.hpp +++ b/c++/include/connect/impl/connect_misc.hpp @@ -1,7 +1,7 @@ #ifndef CONNECT__IMPL__SOCKET_ADDRESS__HPP #define CONNECT__IMPL__SOCKET_ADDRESS__HPP -/* $Id: connect_misc.hpp 656696 2022-09-26 19:38:16Z sadyrovr $ +/* $Id: connect_misc.hpp 675422 2023-11-21 19:49:15Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -56,9 +56,13 @@ struct NCBI_XCONNECT_EXPORT SSocketAddress struct NCBI_XCONNECT_EXPORT SHost { + enum class EName { eResolved, eOriginal }; + + std::optional name; unsigned host; + SHost(unsigned h) : host(h) {} - SHost(const string& h); + SHost(const string& h, EName n = EName::eResolved); }; struct SPort @@ -69,15 +73,18 @@ struct NCBI_XCONNECT_EXPORT SSocketAddress SPort(CTempString p) : port(NStr::StringToNumeric(p)) {} }; - SSocketAddress(SHost h, SPort p) : host(h.host), port(p.port) {} + SSocketAddress(SHost h, SPort p) : host(h.host), port(p.port), m_Name(h.name) {} explicit operator bool() const { return host && port; } string GetHostName() const; string AsString() const { return GetHostName() + ':' + NStr::UIntToString(port); } - static SSocketAddress Parse(const string& address); + static SSocketAddress Parse(const string& address, SHost::EName name = SHost::EName::eResolved); friend ostream& operator<<(ostream& os, const SSocketAddress& address) { return os << address.AsString(); } + +private: + std::optional m_Name; }; NCBI_XCONNECT_EXPORT bool operator==(const SSocketAddress& lhs, const SSocketAddress& rhs); @@ -86,7 +93,7 @@ NCBI_XCONNECT_EXPORT bool operator< (const SSocketAddress& lhs, const SSocketAdd class NCBI_XCONNECT_EXPORT CServiceDiscovery { public: - CServiceDiscovery(const string& service_name); + CServiceDiscovery(const string& service_name, SSocketAddress::SHost::EName name = SSocketAddress::SHost::EName::eOriginal); using TServer = pair; using TServers = vector; diff --git a/c++/include/connect/impl/ncbi_uv_nghttp2.hpp b/c++/include/connect/impl/ncbi_uv_nghttp2.hpp index 02b4388d..3d7a2b57 100644 --- a/c++/include/connect/impl/ncbi_uv_nghttp2.hpp +++ b/c++/include/connect/impl/ncbi_uv_nghttp2.hpp @@ -1,7 +1,7 @@ #ifndef CONNECT__IMPL__NCBI_UV_NGHTTP2__HPP #define CONNECT__IMPL__NCBI_UV_NGHTTP2__HPP -/* $Id: ncbi_uv_nghttp2.hpp 669301 2023-06-26 18:31:29Z ivanov $ +/* $Id: ncbi_uv_nghttp2.hpp 680769 2024-03-27 13:51:03Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -91,7 +91,7 @@ private: SUvNgHttp2_Error(const char* t, TFunc f, T e, const char* w) { m_Value << t << f(e) << " (" << e << ") " << w; - }; + } stringstream m_Value; }; @@ -491,7 +491,7 @@ private: function BindThis(TR (SUvNgHttp2_SessionBase::*member)(TArgs...)) { return [this, member](TArgs&&... args) -> TR { return (this->*member)(forward(args)...); }; - }; + } void OnConnect(int status); void OnWrite(int status); diff --git a/c++/include/corelib/request_status.hpp b/c++/include/corelib/request_status.hpp index dd3c4428..2d1480bf 100644 --- a/c++/include/corelib/request_status.hpp +++ b/c++/include/corelib/request_status.hpp @@ -1,7 +1,7 @@ #ifndef CORELIB___REQUEST_STATUS__HPP #define CORELIB___REQUEST_STATUS__HPP -/* $Id: request_status.hpp 597623 2019-11-25 15:06:05Z grichenk $ +/* $Id: request_status.hpp 674533 2023-10-30 13:23:10Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -97,6 +97,7 @@ public: e416_RangeNotSatisfiable = 416, e417_ExpectationFailed = 417, e422_UnprocessableEntity = 422, + e451_Unavailable_For_Legal_Reasons = 451, /// Non-standard status code - used to indicate broken connection /// while serving normal request. diff --git a/c++/include/misc/jsonwrapp/jsonwrapp11.hpp b/c++/include/misc/jsonwrapp/jsonwrapp11.hpp index 9a79f9c0..1cef33d8 100644 --- a/c++/include/misc/jsonwrapp/jsonwrapp11.hpp +++ b/c++/include/misc/jsonwrapp/jsonwrapp11.hpp @@ -1,7 +1,7 @@ #ifndef MISC_JSONWRAPP___JSONWRAPP11__HPP #define MISC_JSONWRAPP___JSONWRAPP11__HPP -/* $Id: jsonwrapp11.hpp 671818 2023-08-24 18:17:15Z gouriano $ +/* $Id: jsonwrapp11.hpp 675766 2023-12-01 14:57:17Z gouriano $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -1081,11 +1081,11 @@ public: bool ReadBuffered(const std::string& filename); /// Test if the most recent read was successful - bool ReadSucceeded(void); + bool ReadSucceeded(void) const; /// Most recent read produced empty document // No more data in input stream - bool EndOfData(void); + bool EndOfData(void) const; /// Get most recent read error std::string GetReadError(void) const; @@ -1115,10 +1115,12 @@ public: } /// Traverse the document contents - void Walk(CJson_WalkHandler& walk) const; + /// returns TRUE if all the contents was processed + bool Walk(CJson_WalkHandler& walk) const; /// Traverse the JSON data stream contents - static void Walk(std::istream& in, CJson_WalkHandler& walk); + /// returns TRUE if all the contents was processed + static bool Walk(std::istream& in, CJson_WalkHandler& walk); /// Check that the JSON document is a valid JSON schema bool IsSchema(void) const; @@ -2294,7 +2296,7 @@ CJson_WalkHandler::GetCurrentJPath(void) const { std::vector::const_iterator n = m_name.begin(); CJson_Node::TKeyType path; for ( ++t, ++i, ++n; t != te; ++t, ++i, ++n) { - if (*t) { + if (*t && !n->empty()) { path += JSONWRAPP_TO_NCBIUTF8("/"); path += JSONWRAPP_TO_NCBIUTF8(*n); } else if (*i != size_t(-1)) { @@ -2303,7 +2305,7 @@ CJson_WalkHandler::GetCurrentJPath(void) const { path += JSONWRAPP_TO_NCBIUTF8("]"); } } - return path; + return path.empty() ? "/" : path; } inline CJson_Node::TKeyType CJson_WalkHandler::GetCurrentJPointer(void) const { @@ -2313,14 +2315,15 @@ inline CJson_Node::TKeyType CJson_WalkHandler::GetCurrentJPointer(void) const { std::vector::const_iterator n = m_name.begin(); CJson_Node::TKeyType path; for ( ++t, ++i, ++n; t != te; ++t, ++i, ++n) { - path += JSONWRAPP_TO_NCBIUTF8("/"); - if (*t) { + if (*t && !n->empty()) { + path += JSONWRAPP_TO_NCBIUTF8("/"); path += JSONWRAPP_TO_NCBIUTF8(*n); } else if (*i != size_t(-1)) { + path += JSONWRAPP_TO_NCBIUTF8("/"); path += JSONWRAPP_TO_NCBIUTF8(ncbi::NStr::NumericToString(*i)); } } - return path; + return path.empty() ? "/" : path; } inline bool CJson_WalkHandler::Read(CJson_Document& doc) { @@ -2421,10 +2424,10 @@ inline bool CJson_Document::ReadBuffered(const std::string& filename) { return !m_DocImpl.HasParseError(); } -inline bool CJson_Document::ReadSucceeded(void) { +inline bool CJson_Document::ReadSucceeded(void) const { return !m_DocImpl.HasParseError(); } -inline bool CJson_Document::EndOfData(void) { +inline bool CJson_Document::EndOfData(void) const { return m_DocImpl.GetParseError() == rapidjson::kParseErrorDocumentEmpty; } @@ -2467,17 +2470,17 @@ inline bool CJson_Document::Write(std::ostream& out, CJson_Schema& schema, return res; } -inline void CJson_Document::Walk(CJson_WalkHandler& walk) const { +inline bool CJson_Document::Walk(CJson_WalkHandler& walk) const { walk.x_SetSource(0); - m_DocImpl.Accept(walk); + return m_DocImpl.Accept(walk); } -inline void CJson_Document::Walk(std::istream& in, +inline bool CJson_Document::Walk(std::istream& in, CJson_WalkHandler& walk) { walk.x_SetSource(&in); rapidjson::IStreamWrapper ifs(in); rapidjson::Reader rdr; - rdr.Parse(ifs,walk); + return !rdr.Parse(ifs,walk).IsError(); } inline bool CJson_Document::IsSchema(void) const { diff --git a/c++/include/ncbi_pch.hpp b/c++/include/ncbi_pch.hpp index 922e9254..a7ba48e1 100644 --- a/c++/include/ncbi_pch.hpp +++ b/c++/include/ncbi_pch.hpp @@ -1,5 +1,5 @@ #if defined(NCBI_USE_PCH) && !defined(NCBI_PCH__HPP) -/* $Id: ncbi_pch.hpp 674172 2023-10-19 17:21:21Z blastadm $ +/* $Id: ncbi_pch.hpp 684489 2024-06-25 12:36:39Z blastadm $ * =========================================================================== * * PUBLIC DOMAIN NOTICE diff --git a/c++/include/ncbi_source_ver.h b/c++/include/ncbi_source_ver.h index 83742b5f..5a68a4ee 100644 --- a/c++/include/ncbi_source_ver.h +++ b/c++/include/ncbi_source_ver.h @@ -1,4 +1,4 @@ -/* $Id: ncbi_source_ver.h 674172 2023-10-19 17:21:21Z blastadm $ +/* $Id: ncbi_source_ver.h 684489 2024-06-25 12:36:39Z blastadm $ * =========================================================================== * * PUBLIC DOMAIN NOTICE diff --git a/c++/include/ncbiconf.h b/c++/include/ncbiconf.h index 2cb85d5a..759d310e 100644 --- a/c++/include/ncbiconf.h +++ b/c++/include/ncbiconf.h @@ -1,7 +1,7 @@ #ifndef FORWARDING_NCBICONF_H #define FORWARDING_NCBICONF_H -/* $Id: ncbiconf.h 674172 2023-10-19 17:21:21Z blastadm $ +/* $Id: ncbiconf.h 684489 2024-06-25 12:36:39Z blastadm $ * =========================================================================== * * PUBLIC DOMAIN NOTICE diff --git a/c++/include/objects/general/Dbtag.hpp b/c++/include/objects/general/Dbtag.hpp index cb9b8824..4c6c3d83 100644 --- a/c++/include/objects/general/Dbtag.hpp +++ b/c++/include/objects/general/Dbtag.hpp @@ -1,4 +1,4 @@ -/* $Id: Dbtag.hpp 666129 2023-04-20 19:39:18Z kans $ +/* $Id: Dbtag.hpp 683247 2024-05-21 12:43:30Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -224,7 +224,18 @@ public: eDbtagType_dbVar, eDbtagType_EnsemblRapid, eDbtagType_AllianceGenome, - eDbtagType_EchinoBase + eDbtagType_EchinoBase, + eDbtagType_AmoebaDB, + eDbtagType_CryptoDB, + eDbtagType_FungiDB, + eDbtagType_GiardiaDB, + eDbtagType_MicrosporidiaDB, + eDbtagType_PiroplasmaDB, + eDbtagType_PlasmoDB, + eDbtagType_ToxoDB, + eDbtagType_TrichDB, + eDbtagType_TriTrypDB, + eDbtagType_VEuPathDB }; enum EDbtagGroup { diff --git a/c++/include/objects/seqfeat/OrgMod.hpp b/c++/include/objects/seqfeat/OrgMod.hpp index f08dd12c..ce84d090 100644 --- a/c++/include/objects/seqfeat/OrgMod.hpp +++ b/c++/include/objects/seqfeat/OrgMod.hpp @@ -1,4 +1,4 @@ -/* $Id: OrgMod.hpp 535708 2017-05-11 10:58:04Z bollin $ +/* $Id: OrgMod.hpp 684486 2024-06-25 12:34:24Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -129,7 +129,11 @@ public: static bool IsINSDCValidTypeMaterial(const string& type_material); typedef map TInstitutionCodeMap; - private: + + // Allows instant transition when quarantine period ends. + static bool NCBI_ValidateForMultipleIsolates(void); + +private: // Prohibit copy constructor and assignment operator COrgMod(const COrgMod& value); COrgMod& operator=(const COrgMod& value); diff --git a/c++/include/objects/seqfeat/SubSource.hpp b/c++/include/objects/seqfeat/SubSource.hpp index 46f7048c..2242c6c0 100644 --- a/c++/include/objects/seqfeat/SubSource.hpp +++ b/c++/include/objects/seqfeat/SubSource.hpp @@ -1,4 +1,4 @@ -/* $Id: SubSource.hpp 650764 2022-06-02 00:17:32Z gotvyans $ +/* $Id: SubSource.hpp 678688 2024-02-08 19:25:25Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -75,6 +75,9 @@ public: void GetLabel(string* str) const; + // Allows instant transition when quarantine period ends. + static bool NCBI_UseGeoLocNameForCountry(void); + enum EVocabulary { eVocabulary_raw, // per ASN.1, except eSubtype_other <-> "note" eVocabulary_insdc // per GB/DDBJ/EMBL qualifier names diff --git a/c++/include/objects/seqloc/Seq_id.hpp b/c++/include/objects/seqloc/Seq_id.hpp index e32c7576..0cbd0cd3 100644 --- a/c++/include/objects/seqloc/Seq_id.hpp +++ b/c++/include/objects/seqloc/Seq_id.hpp @@ -1,4 +1,4 @@ -/* $Id: Seq_id.hpp 666463 2023-04-26 15:21:25Z grichenk $ +/* $Id: Seq_id.hpp 681843 2024-04-15 19:25:42Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -218,6 +218,31 @@ public: /// For IdentifyAccession (below) enum EAccessionInfo { + // E_Choice values, explicitly pulled in to help avoid warnings + // elsewhere about bitwise operations between different enum types. + eSeqId_not_set = e_not_set, + eSeqId_local = e_Local, + eSeqId_gibbsq = e_Gibbsq, + eSeqId_gibbmt = e_Gibbmt, + eSeqId_giim = e_Giim, + eSeqId_genbank = e_Genbank, + eSeqId_embl = e_Embl, + eSeqId_pir = e_Pir, + eSeqId_swissprot = e_Swissprot, + eSeqId_patent = e_Patent, + eSeqId_other = e_Other, + eSeqId_refseq = eSeqId_other, + eSeqId_general = e_General, + eSeqId_gi = e_Gi, + eSeqId_ddbj = e_Ddbj, + eSeqId_prf = e_Prf, + eSeqId_pdb = e_Pdb, + eSeqId_tpg = e_Tpg, + eSeqId_tpe = e_Tpe, + eSeqId_tpd = e_Tpd, + eSeqId_gpipe = e_Gpipe, + eSeqId_named_annot_track = e_Named_annot_track, + // Mask for Seq_id type; allow 8 bits to be safe eAcc_type_mask = 0xff, @@ -225,6 +250,7 @@ public: // albeit not necessarily applicable to all divisions). fAcc_nuc = 0x80000000, fAcc_prot = 0x40000000, + fAcc_seq = 0, fAcc_predicted = 0x20000000, // only for refseq fAcc_specials = 0x10000000, // has special cases; only used internally fAcc_master = 0x08000000, @@ -287,244 +313,250 @@ public: eAcc_tsa_vdb_master = eAcc_tsa | fAcc_master | fAcc_vdb_only, eAcc_targeted_vdb_master = eAcc_targeted | fAcc_master | fAcc_vdb_only, + // Internal macro, left defined only temporarily +#define NCBI_ACC(type, div, mol) eSeqId_##type | eAcc_##div | fAcc_##mol // Actual return values with EXAMPLE prefixes (to be followed // by digits) or IDs, grouped by Seq-id type. In most cases, // there are other prefixes with the same classification, and // if not there could be in principle. - eAcc_unknown = e_not_set | eAcc_other, + eAcc_unknown = NCBI_ACC(not_set, other, seq), // Most N accessions are GenBank ESTs, but some low-numbered // ones (now only used as secondary accessions) were assigned // haphazardly, and some are therefore ambiguous. - eAcc_ambiguous_nuc = e_not_set | eAcc_ambig | fAcc_nuc, // N0-N1 - eAcc_maybe_gb = e_not_set | eAcc_ambig_g | fAcc_nuc, - eAcc_maybe_embl = e_not_set | eAcc_ambig_e | fAcc_nuc, - eAcc_maybe_ddbj = e_not_set | eAcc_ambig_d | fAcc_nuc, - eAcc_gb_embl = e_not_set | eAcc_ambig_ge | fAcc_nuc, //N00001 - eAcc_gb_ddbj = e_not_set | eAcc_ambig_gd | fAcc_nuc, //N00006 - eAcc_embl_ddbj = e_not_set | eAcc_ambig_ed | fAcc_nuc, //N00070 - eAcc_gb_embl_ddbj = e_not_set | eAcc_ambig_ged | fAcc_nuc, //N00005 - eAcc_unreserved_nuc = e_not_set | eAcc_unreserved | fAcc_nuc, // XY - eAcc_unreserved_prot = e_not_set | eAcc_unreserved | fAcc_prot,// XYZ - - eAcc_local = e_Local | eAcc_other, - eAcc_gibbsq = e_Gibbsq | eAcc_other, - eAcc_gibbmt = e_Gibbmt | eAcc_other, - eAcc_giim = e_Giim | eAcc_other, - - eAcc_gb_other = e_Genbank | eAcc_other, - eAcc_gb_prot = e_Genbank | eAcc_other | fAcc_prot, // AAA - eAcc_gb_other_nuc = e_Genbank | eAcc_other | fAcc_nuc, // AS - eAcc_gb_est = e_Genbank | eAcc_est | fAcc_nuc, // H - eAcc_gb_dirsub = e_Genbank | eAcc_dirsub | fAcc_nuc, // U - eAcc_gb_patent = e_Genbank | eAcc_div_patent /* | fAcc_nuc */, //I - eAcc_gb_patent_prot = e_Genbank | eAcc_div_patent | fAcc_prot, // AAE - eAcc_gb_cdna = e_Genbank | eAcc_mrna | fAcc_nuc, // BC - eAcc_gsdb_dirsub = e_Genbank | eAcc_gsdb_ds | fAcc_nuc, // J - eAcc_gb_gsdb = e_Genbank | eAcc_gsdb | fAcc_nuc, // AD - eAcc_gb_backbone = e_Genbank | eAcc_backbone | fAcc_nuc, // S - eAcc_gb_tsa_nuc = e_Genbank | eAcc_tsa | fAcc_nuc, // EZ - eAcc_gb_tsa_prot = e_Genbank | eAcc_tsa | fAcc_prot, // JAA - eAcc_gb_tsam_nuc = e_Genbank | eAcc_tsa_master | fAcc_nuc, - eAcc_gb_tsam_prot = e_Genbank | eAcc_tsa_master | fAcc_prot, - eAcc_gb_tsav_nuc = e_Genbank | eAcc_tsa_vdb_only | fAcc_nuc, - eAcc_gb_tsav_prot = e_Genbank | eAcc_tsa_vdb_only | fAcc_prot, - eAcc_gb_tsavm_nuc = e_Genbank | eAcc_tsa_vdb_master | fAcc_nuc, - eAcc_gb_tsavm_prot = e_Genbank | eAcc_tsa_vdb_master | fAcc_prot, - eAcc_gb_segset = e_Genbank | eAcc_segset /* | fAcc_nuc */, // AH - eAcc_gb_gss = e_Genbank | eAcc_gss | fAcc_nuc, // B - eAcc_gb_genome = e_Genbank | eAcc_genome | fAcc_nuc, // AE - eAcc_gb_htgs = e_Genbank | eAcc_htgs | fAcc_nuc, // AC - eAcc_gb_con = e_Genbank | eAcc_con | fAcc_nuc, // CH - eAcc_gb_wgs_nuc = e_Genbank | eAcc_wgs | fAcc_nuc, // AAAA - eAcc_gb_wgs_prot = e_Genbank | eAcc_wgs | fAcc_prot, // EAA - eAcc_gb_wgsm_nuc = e_Genbank | eAcc_wgs_master | fAcc_nuc, - eAcc_gb_wgsm_prot = e_Genbank | eAcc_wgs_master | fAcc_prot, - eAcc_gb_wgsv_nuc = e_Genbank | eAcc_wgs_vdb_only | fAcc_nuc, - eAcc_gb_wgsv_prot = e_Genbank | eAcc_wgs_vdb_only | fAcc_prot, // MAA - eAcc_gb_wgsvm_nuc = e_Genbank | eAcc_wgs_vdb_master | fAcc_nuc, - eAcc_gb_wgsvm_prot = e_Genbank | eAcc_wgs_vdb_master | fAcc_prot, - eAcc_gb_chromosome = e_Genbank | eAcc_chromosome | fAcc_nuc, // CM - eAcc_gb_sts = e_Genbank | eAcc_sts | fAcc_nuc, // G - eAcc_gb_mga = e_Genbank | eAcc_mga | fAcc_nuc, // unused - eAcc_gb_optical_map = e_Genbank | eAcc_optical_map| fAcc_nuc, // MAP_ - eAcc_gb_targeted_nuc= e_Genbank | eAcc_targeted | fAcc_nuc, // KAAA - - eAcc_embl_other = e_Embl | eAcc_other, - eAcc_embl_prot = e_Embl | eAcc_other | fAcc_prot, // CAA - eAcc_embl_other_nuc = e_Embl | eAcc_other | fAcc_nuc, // AL - eAcc_embl_est = e_Embl | eAcc_est | fAcc_nuc, // F - eAcc_embl_dirsub = e_Embl | eAcc_dirsub | fAcc_nuc, // V - eAcc_embl_patent = e_Embl | eAcc_div_patent | fAcc_nuc, // A - eAcc_embl_tsa_nuc = e_Embl | eAcc_tsa | fAcc_nuc, // HAAA - eAcc_embl_tsa_prot = e_Embl | eAcc_tsa | fAcc_prot, // unused - eAcc_embl_tsam_nuc = e_Embl | eAcc_tsa_master | fAcc_nuc, - eAcc_embl_tsam_prot = e_Embl | eAcc_tsa_master | fAcc_prot, - eAcc_embl_tsav_nuc = e_Embl | eAcc_tsa_vdb_only | fAcc_nuc, - eAcc_embl_tsav_prot = e_Embl | eAcc_tsa_vdb_only | fAcc_prot, - eAcc_embl_tsavm_nuc = e_Embl | eAcc_tsa_vdb_master | fAcc_nuc, - eAcc_embl_tsavm_prot= e_Embl | eAcc_tsa_vdb_master | fAcc_prot, - eAcc_embl_gss = e_Embl | eAcc_gss | fAcc_nuc, // AJ864682 - eAcc_embl_genome = e_Embl | eAcc_genome | fAcc_nuc, // unused - eAcc_embl_htgs = e_Embl | eAcc_htgs | fAcc_nuc, // unused - eAcc_embl_con = e_Embl | eAcc_con | fAcc_nuc, // AN - eAcc_embl_wgs_nuc = e_Embl | eAcc_wgs | fAcc_nuc, // CAAA - eAcc_embl_wgs_prot = e_Embl | eAcc_wgs | fAcc_prot, // unused - eAcc_embl_wgsm_nuc = e_Embl | eAcc_wgs_master | fAcc_nuc, - eAcc_embl_wgsm_prot = e_Embl | eAcc_wgs_master | fAcc_prot, - eAcc_embl_wgsv_nuc = e_Embl | eAcc_wgs_vdb_only | fAcc_nuc, - eAcc_embl_wgsv_prot = e_Embl | eAcc_wgs_vdb_only | fAcc_prot, - eAcc_embl_wgsvm_nuc = e_Embl | eAcc_wgs_vdb_master | fAcc_nuc, - eAcc_embl_wgsvm_prot= e_Embl | eAcc_wgs_vdb_master | fAcc_prot, - eAcc_embl_mga = e_Embl | eAcc_mga | fAcc_nuc, // unused - - eAcc_pir = e_Pir | eAcc_other | fAcc_prot, - eAcc_swissprot = e_Swissprot | eAcc_other | fAcc_prot, // P - eAcc_patent = e_Patent | eAcc_div_patent, - - eAcc_refseq_prot = e_Other | eAcc_other | fAcc_prot,//NP_ - eAcc_refseq_mrna = e_Other | eAcc_mrna | fAcc_nuc, //NM_ - eAcc_refseq_ncrna = e_Other | eAcc_ncrna | fAcc_nuc, //NR_ - eAcc_refseq_unique_prot = e_Other | eAcc_unique | fAcc_prot,//WP_ - eAcc_refseq_unreserved = e_Other | eAcc_unreserved, //AA_ - eAcc_refseq_genome = e_Other | eAcc_genome | fAcc_nuc, //NS_ - eAcc_refseq_contig = e_Other | eAcc_con | fAcc_nuc, //NT_ - eAcc_refseq_wgs_nuc = e_Other | eAcc_wgs | fAcc_nuc, //NZ_ - eAcc_refseq_wgs_prot = e_Other | eAcc_wgs | fAcc_prot,//ZP_ - eAcc_refseq_wgsm_nuc = e_Other | eAcc_wgs_master | fAcc_nuc, - eAcc_refseq_wgsm_prot = e_Other | eAcc_wgs_master | fAcc_prot, - eAcc_refseq_wgsv_nuc = e_Other | eAcc_wgs_vdb_only | fAcc_nuc, - eAcc_refseq_wgsv_prot = e_Other | eAcc_wgs_vdb_only | fAcc_prot, - eAcc_refseq_wgsvm_nuc = e_Other | eAcc_wgs_vdb_master | fAcc_nuc, - eAcc_refseq_wgsvm_prot = e_Other | eAcc_wgs_vdb_master | fAcc_prot, - eAcc_refseq_chromosome = e_Other | eAcc_chromosome | fAcc_nuc, //NC_ - eAcc_refseq_genomic = e_Other | eAcc_genomic_rgn | fAcc_nuc, //NG_ - eAcc_refseq_wgs_intermed= e_Other | eAcc_wgs_intermed | fAcc_nuc, //NW_ - eAcc_refseq_wgsm_intermed=e_Other | eAcc_wgs_intermed_master | fAcc_nuc, - eAcc_refseq_wgsv_intermed - = e_Other | eAcc_wgs_intermed_vdb_only | fAcc_nuc, - eAcc_refseq_wgsvm_intermed - = e_Other | eAcc_wgs_intermed_vdb_master | fAcc_nuc, + eAcc_ambiguous_nuc = NCBI_ACC(not_set, ambig, nuc), // N0-N1 + eAcc_maybe_gb = NCBI_ACC(not_set, ambig_g, nuc), + eAcc_maybe_embl = NCBI_ACC(not_set, ambig_e, nuc), + eAcc_maybe_ddbj = NCBI_ACC(not_set, ambig_d, nuc), + eAcc_gb_embl = NCBI_ACC(not_set, ambig_ge, nuc), // N00001 + eAcc_gb_ddbj = NCBI_ACC(not_set, ambig_gd, nuc), // N00006 + eAcc_embl_ddbj = NCBI_ACC(not_set, ambig_ed, nuc), // N00070 + eAcc_gb_embl_ddbj = NCBI_ACC(not_set, ambig_ged, nuc), // N00005 + eAcc_unreserved_nuc = NCBI_ACC(not_set, unreserved, nuc), // XY + eAcc_unreserved_prot = NCBI_ACC(not_set, unreserved, prot), // XYZ + + eAcc_local = NCBI_ACC(local, other, seq), + eAcc_gibbsq = NCBI_ACC(gibbsq, other, seq), + eAcc_gibbmt = NCBI_ACC(gibbmt, other, seq), + eAcc_giim = NCBI_ACC(giim, other, seq), + + // NB: eAcc_gb_patent and eAcc_gb_segset are only *mostly* nucleotide, + // and eAcc_gb_mga is so far unused. + eAcc_gb_other = NCBI_ACC(genbank, other, seq), + eAcc_gb_prot = NCBI_ACC(genbank, other, prot), // AAA + eAcc_gb_other_nuc = NCBI_ACC(genbank, other, nuc), // AS + eAcc_gb_est = NCBI_ACC(genbank, est, nuc), // H + eAcc_gb_dirsub = NCBI_ACC(genbank, dirsub, nuc), // U + eAcc_gb_patent = NCBI_ACC(genbank, div_patent, seq), // I + eAcc_gb_patent_prot = NCBI_ACC(genbank, div_patent, prot), // AAE + eAcc_gb_cdna = NCBI_ACC(genbank, mrna, nuc), // BC + eAcc_gsdb_dirsub = NCBI_ACC(genbank, gsdb_ds, nuc), // J + eAcc_gb_gsdb = NCBI_ACC(genbank, gsdb, nuc), // AD + eAcc_gb_backbone = NCBI_ACC(genbank, backbone, nuc), // S + eAcc_gb_tsa_nuc = NCBI_ACC(genbank, tsa, nuc), // EZ + eAcc_gb_tsa_prot = NCBI_ACC(genbank, tsa, prot), // JAA + eAcc_gb_tsam_nuc = NCBI_ACC(genbank, tsa_master, nuc), + eAcc_gb_tsam_prot = NCBI_ACC(genbank, tsa_master, prot), + eAcc_gb_tsav_nuc = NCBI_ACC(genbank, tsa_vdb_only, nuc), + eAcc_gb_tsav_prot = NCBI_ACC(genbank, tsa_vdb_only, prot), + eAcc_gb_tsavm_nuc = NCBI_ACC(genbank, tsa_vdb_master, nuc), + eAcc_gb_tsavm_prot = NCBI_ACC(genbank, tsa_vdb_master, prot), + eAcc_gb_segset = NCBI_ACC(genbank, segset, seq), // AH + eAcc_gb_gss = NCBI_ACC(genbank, gss, nuc), // B + eAcc_gb_genome = NCBI_ACC(genbank, genome, nuc), // AE + eAcc_gb_htgs = NCBI_ACC(genbank, htgs, nuc), // AC + eAcc_gb_con = NCBI_ACC(genbank, con, nuc), // CH + eAcc_gb_wgs_nuc = NCBI_ACC(genbank, wgs, nuc), // AAAA + eAcc_gb_wgs_prot = NCBI_ACC(genbank, wgs, prot), // EAA + eAcc_gb_wgsm_nuc = NCBI_ACC(genbank, wgs_master, nuc), + eAcc_gb_wgsm_prot = NCBI_ACC(genbank, wgs_master, prot), + eAcc_gb_wgsv_nuc = NCBI_ACC(genbank, wgs_vdb_only, nuc), + eAcc_gb_wgsv_prot = NCBI_ACC(genbank, wgs_vdb_only, prot), + eAcc_gb_wgsvm_nuc = NCBI_ACC(genbank, wgs_vdb_master, nuc), + eAcc_gb_wgsvm_prot = NCBI_ACC(genbank, wgs_vdb_master, prot), + eAcc_gb_chromosome = NCBI_ACC(genbank, chromosome, nuc), // CM + eAcc_gb_sts = NCBI_ACC(genbank, sts, nuc), // G + eAcc_gb_mga = NCBI_ACC(genbank, mga, nuc), + eAcc_gb_optical_map = NCBI_ACC(genbank, optical_map, nuc), // MAP_ + eAcc_gb_targeted_nuc = NCBI_ACC(genbank, targeted, nuc), // KAAA + + eAcc_embl_other = NCBI_ACC(embl, other, seq), + eAcc_embl_prot = NCBI_ACC(embl, other, prot), // CAA + eAcc_embl_other_nuc = NCBI_ACC(embl, other, nuc), // AL + eAcc_embl_est = NCBI_ACC(embl, est, nuc), // F + eAcc_embl_dirsub = NCBI_ACC(embl, dirsub, nuc), // V + eAcc_embl_patent = NCBI_ACC(embl, div_patent, nuc), // A + eAcc_embl_tsa_nuc = NCBI_ACC(embl, tsa, nuc), // HAAA + eAcc_embl_tsa_prot = NCBI_ACC(embl, tsa, prot), // unused + eAcc_embl_tsam_nuc = NCBI_ACC(embl, tsa_master, nuc), + eAcc_embl_tsam_prot = NCBI_ACC(embl, tsa_master, prot), + eAcc_embl_tsav_nuc = NCBI_ACC(embl, tsa_vdb_only, nuc), + eAcc_embl_tsav_prot = NCBI_ACC(embl, tsa_vdb_only, prot), + eAcc_embl_tsavm_nuc = NCBI_ACC(embl, tsa_vdb_master, nuc), + eAcc_embl_tsavm_prot = NCBI_ACC(embl, tsa_vdb_master, prot), + eAcc_embl_gss = NCBI_ACC(embl, gss, nuc), // AJ864682 + eAcc_embl_genome = NCBI_ACC(embl, genome, nuc), // unused + eAcc_embl_htgs = NCBI_ACC(embl, htgs, nuc), // unused + eAcc_embl_con = NCBI_ACC(embl, con, nuc), // AN + eAcc_embl_wgs_nuc = NCBI_ACC(embl, wgs, nuc), // CAAA + eAcc_embl_wgs_prot = NCBI_ACC(embl, wgs, prot), // unused + eAcc_embl_wgsm_nuc = NCBI_ACC(embl, wgs_master, nuc), + eAcc_embl_wgsm_prot = NCBI_ACC(embl, wgs_master, prot), + eAcc_embl_wgsv_nuc = NCBI_ACC(embl, wgs_vdb_only, nuc), + eAcc_embl_wgsv_prot = NCBI_ACC(embl, wgs_vdb_only, prot), + eAcc_embl_wgsvm_nuc = NCBI_ACC(embl, wgs_vdb_master, nuc), + eAcc_embl_wgsvm_prot = NCBI_ACC(embl, wgs_vdb_master, prot), + eAcc_embl_mga = NCBI_ACC(embl, mga, nuc), // unused + + eAcc_pir = NCBI_ACC(pir, other, prot), + eAcc_swissprot = NCBI_ACC(swissprot, other, prot), // P + eAcc_patent = NCBI_ACC(patent, div_patent, seq), + + eAcc_refseq_prot = NCBI_ACC(refseq, other, prot),//NP_ + eAcc_refseq_mrna = NCBI_ACC(refseq, mrna, nuc), //NM_ + eAcc_refseq_ncrna = NCBI_ACC(refseq, ncrna, nuc), //NR_ + eAcc_refseq_unique_prot = NCBI_ACC(refseq, unique, prot),//WP_ + eAcc_refseq_unreserved = NCBI_ACC(refseq, unreserved, seq), //AA_ + eAcc_refseq_genome = NCBI_ACC(refseq, genome, nuc), //NS_ + eAcc_refseq_contig = NCBI_ACC(refseq, con, nuc), //NT_ + eAcc_refseq_wgs_nuc = NCBI_ACC(refseq, wgs, nuc), //NZ_ + eAcc_refseq_wgs_prot = NCBI_ACC(refseq, wgs, prot),//ZP_ + eAcc_refseq_wgsm_nuc = NCBI_ACC(refseq, wgs_master, nuc), + eAcc_refseq_wgsm_prot = NCBI_ACC(refseq, wgs_master, prot), + eAcc_refseq_wgsv_nuc = NCBI_ACC(refseq, wgs_vdb_only, nuc), + eAcc_refseq_wgsv_prot = NCBI_ACC(refseq, wgs_vdb_only, prot), + eAcc_refseq_wgsvm_nuc = NCBI_ACC(refseq, wgs_vdb_master, nuc), + eAcc_refseq_wgsvm_prot = NCBI_ACC(refseq, wgs_vdb_master, prot), + eAcc_refseq_chromosome = NCBI_ACC(refseq, chromosome, nuc), //NC_ + eAcc_refseq_genomic = NCBI_ACC(refseq, genomic_rgn, nuc), //NG_ + eAcc_refseq_wgs_intermed = NCBI_ACC(refseq, wgs_intermed, nuc), //NW_ + eAcc_refseq_wgsm_intermed = NCBI_ACC(refseq, wgs_intermed_master, + nuc), + eAcc_refseq_wgsv_intermed = NCBI_ACC(refseq, wgs_intermed_vdb_only, + nuc), + eAcc_refseq_wgsvm_intermed = NCBI_ACC(refseq, wgs_intermed_vdb_master, + nuc), eAcc_refseq_prot_predicted = eAcc_refseq_prot | fAcc_predicted, //XP_ eAcc_refseq_mrna_predicted = eAcc_refseq_mrna | fAcc_predicted, //XM_ eAcc_refseq_ncrna_predicted = eAcc_refseq_ncrna | fAcc_predicted, //XR_ eAcc_refseq_chromosome_ncbo = eAcc_refseq_chromosome | fAcc_ncbo, //WC_ eAcc_refseq_contig_ncbo = eAcc_refseq_contig | fAcc_ncbo, //WT_ - eAcc_general = e_General | eAcc_other, - eAcc_general_nuc = e_General | eAcc_other | fAcc_nuc, // TRACE_ASSM - eAcc_general_prot = e_General | eAcc_other | fAcc_prot, - - eAcc_gi = e_Gi | eAcc_other, - - eAcc_ddbj_other = e_Ddbj | eAcc_other, - eAcc_ddbj_prot = e_Ddbj | eAcc_other | fAcc_prot, // BAA - eAcc_ddbj_other_nuc = e_Ddbj | eAcc_other | fAcc_nuc, // N00028 - eAcc_ddbj_est = e_Ddbj | eAcc_est | fAcc_nuc, // C - eAcc_ddbj_dirsub = e_Ddbj | eAcc_dirsub | fAcc_nuc, // D - eAcc_ddbj_patent = e_Ddbj | eAcc_div_patent | fAcc_nuc, // E - eAcc_ddbj_mrna = e_Ddbj | eAcc_mrna | fAcc_nuc, // AK - eAcc_ddbj_tsa_nuc = e_Ddbj | eAcc_tsa | fAcc_nuc, // FX - eAcc_ddbj_tsa_prot = e_Ddbj | eAcc_tsa | fAcc_prot, // LAA - eAcc_ddbj_tsam_nuc = e_Ddbj | eAcc_tsa_master | fAcc_nuc, - eAcc_ddbj_tsam_prot = e_Ddbj | eAcc_tsa_master | fAcc_prot, - eAcc_ddbj_tsav_nuc = e_Ddbj | eAcc_tsa_vdb_only | fAcc_nuc, - eAcc_ddbj_tsav_prot = e_Ddbj | eAcc_tsa_vdb_only | fAcc_prot, - eAcc_ddbj_tsavm_nuc = e_Ddbj | eAcc_tsa_vdb_master | fAcc_nuc, - eAcc_ddbj_tsavm_prot= e_Ddbj | eAcc_tsa_vdb_master | fAcc_prot, - eAcc_ddbj_gss = e_Ddbj | eAcc_gss | fAcc_nuc, // AG - eAcc_ddbj_genome = e_Ddbj | eAcc_genome | fAcc_nuc, // AP - eAcc_ddbj_htgs = e_Ddbj | eAcc_htgs | fAcc_nuc, // unused - eAcc_ddbj_con = e_Ddbj | eAcc_con | fAcc_nuc, // BA - eAcc_ddbj_wgs_nuc = e_Ddbj | eAcc_wgs | fAcc_nuc, // BAAA - eAcc_ddbj_wgs_prot = e_Ddbj | eAcc_wgs | fAcc_prot, // GAA - eAcc_ddbj_wgsm_nuc = e_Ddbj | eAcc_wgs_master | fAcc_nuc, - eAcc_ddbj_wgsm_prot = e_Ddbj | eAcc_wgs_master | fAcc_prot, - eAcc_ddbj_wgsv_nuc = e_Ddbj | eAcc_wgs_vdb_only | fAcc_nuc, - eAcc_ddbj_wgsv_prot = e_Ddbj | eAcc_wgs_vdb_only | fAcc_prot, - eAcc_ddbj_wgsvm_nuc = e_Ddbj | eAcc_wgs_vdb_master | fAcc_nuc, - eAcc_ddbj_wgsvm_prot = e_Ddbj | eAcc_wgs_vdb_master | fAcc_prot, - eAcc_ddbj_mga = e_Ddbj | eAcc_mga | fAcc_nuc, // AAAAA - eAcc_ddbj_targeted_nuc=e_Ddbj| eAcc_targeted | fAcc_nuc, // TAAA - eAcc_ddbj_targetedm_nuc = e_Ddbj | eAcc_targeted_master | fAcc_nuc, - eAcc_ddbj_targetedv_nuc = e_Ddbj | eAcc_targeted_vdb_only | fAcc_nuc, - eAcc_ddbj_targetedvm_nuc= e_Ddbj | eAcc_targeted_vdb_master | fAcc_nuc, - - eAcc_prf = e_Prf | eAcc_other | fAcc_prot, - eAcc_pdb = e_Pdb | eAcc_other, // not necessarily protein! - - eAcc_gb_tpa_other = e_Tpg | eAcc_other, - eAcc_gb_tpa_nuc = e_Tpg | eAcc_other | fAcc_nuc, // BK - eAcc_gb_tpa_prot = e_Tpg | eAcc_other | fAcc_prot, // DAA - eAcc_gb_tpa_segset = e_Tpg | eAcc_segset | fAcc_nuc, // BL - eAcc_gb_tpa_con = e_Tpg | eAcc_con | fAcc_nuc, // GJ - eAcc_gb_tpa_wgs_nuc = e_Tpg | eAcc_wgs | fAcc_nuc, // DAAA - eAcc_gb_tpa_wgs_prot = e_Tpg | eAcc_wgs | fAcc_prot, - eAcc_gb_tpa_wgsm_nuc = e_Tpg | eAcc_wgs_master | fAcc_nuc, - eAcc_gb_tpa_wgsm_prot = e_Tpg | eAcc_wgs_master | fAcc_prot, - eAcc_gb_tpa_wgsv_nuc = e_Tpg | eAcc_wgs_vdb_only | fAcc_nuc, - eAcc_gb_tpa_wgsv_prot = e_Tpg | eAcc_wgs_vdb_only | fAcc_prot, // HAA - eAcc_gb_tpa_wgsvm_nuc = e_Tpg | eAcc_wgs_vdb_master | fAcc_nuc, - eAcc_gb_tpa_wgsvm_prot = e_Tpg | eAcc_wgs_vdb_master | fAcc_prot, - eAcc_gb_tpa_chromosome = e_Tpg | eAcc_chromosome | fAcc_nuc, // GK - - eAcc_embl_tpa_other = e_Tpe | eAcc_other, - eAcc_embl_tpa_nuc = e_Tpe | eAcc_other | fAcc_nuc, // BN - eAcc_embl_tpa_prot = e_Tpe | eAcc_other | fAcc_prot, // CAD29848 - eAcc_embl_tpa_tsa_nuc = e_Tpe | eAcc_tsa | fAcc_nuc, - eAcc_embl_tpa_tsa_prot = e_Tpe | eAcc_tsa | fAcc_prot, - eAcc_embl_tpa_tsam_nuc = e_Tpe | eAcc_tsa_master | fAcc_nuc, - eAcc_embl_tpa_tsam_prot = e_Tpe | eAcc_tsa_master | fAcc_prot, - eAcc_embl_tpa_tsav_nuc = e_Tpe | eAcc_tsa_vdb_only | fAcc_nuc, - eAcc_embl_tpa_tsav_prot = e_Tpe | eAcc_tsa_vdb_only | fAcc_prot, - eAcc_embl_tpa_tsavm_nuc = e_Tpe | eAcc_tsa_vdb_master | fAcc_nuc, - eAcc_embl_tpa_tsavm_prot = e_Tpe | eAcc_tsa_vdb_master | fAcc_prot, - eAcc_embl_tpa_wgs_nuc = e_Tpe | eAcc_wgs | fAcc_nuc, // unused - eAcc_embl_tpa_wgs_prot = e_Tpe | eAcc_wgs | fAcc_prot, // unused - eAcc_embl_tpa_wgsm_nuc = e_Tpe | eAcc_wgs_master | fAcc_nuc, - eAcc_embl_tpa_wgsm_prot = e_Tpe | eAcc_wgs_master | fAcc_prot, - eAcc_embl_tpa_wgsv_nuc = e_Tpe | eAcc_wgs_vdb_only | fAcc_nuc, - eAcc_embl_tpa_wgsv_prot = e_Tpe | eAcc_wgs_vdb_only | fAcc_prot, - eAcc_embl_tpa_wgsvm_nuc = e_Tpe | eAcc_wgs_vdb_master | fAcc_nuc, - eAcc_embl_tpa_wgsvm_prot = e_Tpe | eAcc_wgs_vdb_master | fAcc_prot, - - eAcc_ddbj_tpa_other = e_Tpd | eAcc_other, - eAcc_ddbj_tpa_nuc = e_Tpd | eAcc_other | fAcc_nuc, // BR - eAcc_ddbj_tpa_prot = e_Tpd | eAcc_other | fAcc_prot, // FAA - eAcc_ddbj_tpa_tsa_nuc = e_Tpd | eAcc_tsa | fAcc_nuc, // YAAA - eAcc_ddbj_tpa_tsa_prot = e_Tpd | eAcc_tsa | fAcc_prot, // unused - eAcc_ddbj_tpa_tsam_nuc = e_Tpd | eAcc_tsa_master | fAcc_nuc, - eAcc_ddbj_tpa_tsam_prot = e_Tpd | eAcc_tsa_master | fAcc_prot, - eAcc_ddbj_tpa_tsav_nuc = e_Tpd | eAcc_tsa_vdb_only | fAcc_nuc, - eAcc_ddbj_tpa_tsav_prot = e_Tpd | eAcc_tsa_vdb_only | fAcc_prot, - eAcc_ddbj_tpa_tsavm_nuc = e_Tpd | eAcc_tsa_vdb_master | fAcc_nuc, - eAcc_ddbj_tpa_tsavm_prot = e_Tpd | eAcc_tsa_vdb_master | fAcc_prot, - eAcc_ddbj_tpa_con = e_Tpd | eAcc_con | fAcc_nuc, // HT - eAcc_ddbj_tpa_wgs_nuc = e_Tpd | eAcc_wgs | fAcc_nuc, // EAAA - eAcc_ddbj_tpa_wgs_prot = e_Tpd | eAcc_wgs | fAcc_prot, // IAA - eAcc_ddbj_tpa_wgsm_nuc = e_Tpd | eAcc_wgs_master | fAcc_nuc, - eAcc_ddbj_tpa_wgsm_prot = e_Tpd | eAcc_wgs_master | fAcc_prot, - eAcc_ddbj_tpa_wgsv_nuc = e_Tpd | eAcc_wgs_vdb_only | fAcc_nuc, - eAcc_ddbj_tpa_wgsv_prot = e_Tpd | eAcc_wgs_vdb_only | fAcc_prot, - eAcc_ddbj_tpa_wgsvm_nuc = e_Tpd | eAcc_wgs_vdb_master | fAcc_nuc, - eAcc_ddbj_tpa_wgsvm_prot = e_Tpd | eAcc_wgs_vdb_master | fAcc_prot, - eAcc_ddbj_tpa_chromosome = e_Tpd | eAcc_chromosome | fAcc_nuc, // HU - eAcc_ddbj_tpa_targeted_nuc = e_Tpd | eAcc_targeted | fAcc_nuc, // ZAAA - eAcc_ddbj_tpa_targetedm_nuc= e_Tpd | eAcc_targeted_master | fAcc_nuc, - eAcc_ddbj_tpa_targetedv_nuc= e_Tpd | eAcc_targeted_vdb_only | fAcc_nuc, - eAcc_ddbj_tpa_targetedvm_nuc=e_Tpd | eAcc_targeted_vdb_master | fAcc_nuc, + eAcc_general = NCBI_ACC(general, other, seq), + eAcc_general_nuc = NCBI_ACC(general, other, nuc), // TRACE_ASSM + eAcc_general_prot = NCBI_ACC(general, other, prot), + + eAcc_gi = NCBI_ACC(gi, other, seq), + + eAcc_ddbj_other = NCBI_ACC(ddbj, other, seq), + eAcc_ddbj_prot = NCBI_ACC(ddbj, other, prot), // BAA + eAcc_ddbj_other_nuc = NCBI_ACC(ddbj, other, nuc),//N00028 + eAcc_ddbj_est = NCBI_ACC(ddbj, est, nuc), // C + eAcc_ddbj_dirsub = NCBI_ACC(ddbj, dirsub, nuc), // D + eAcc_ddbj_patent = NCBI_ACC(ddbj, div_patent, nuc), // E + eAcc_ddbj_mrna = NCBI_ACC(ddbj, mrna, nuc), // AK + eAcc_ddbj_tsa_nuc = NCBI_ACC(ddbj, tsa, nuc), // FX + eAcc_ddbj_tsa_prot = NCBI_ACC(ddbj, tsa, prot), // LAA + eAcc_ddbj_tsam_nuc = NCBI_ACC(ddbj, tsa_master, nuc), + eAcc_ddbj_tsam_prot = NCBI_ACC(ddbj, tsa_master, prot), + eAcc_ddbj_tsav_nuc = NCBI_ACC(ddbj, tsa_vdb_only, nuc), + eAcc_ddbj_tsav_prot = NCBI_ACC(ddbj, tsa_vdb_only, prot), + eAcc_ddbj_tsavm_nuc = NCBI_ACC(ddbj, tsa_vdb_master, nuc), + eAcc_ddbj_tsavm_prot = NCBI_ACC(ddbj, tsa_vdb_master, prot), + eAcc_ddbj_gss = NCBI_ACC(ddbj, gss, nuc), // AG + eAcc_ddbj_genome = NCBI_ACC(ddbj, genome, nuc), // AP + eAcc_ddbj_htgs = NCBI_ACC(ddbj, htgs, nuc), // {} + eAcc_ddbj_con = NCBI_ACC(ddbj, con, nuc), // BA + eAcc_ddbj_wgs_nuc = NCBI_ACC(ddbj, wgs, nuc), // BAAA + eAcc_ddbj_wgs_prot = NCBI_ACC(ddbj, wgs, prot), // GAA + eAcc_ddbj_wgsm_nuc = NCBI_ACC(ddbj, wgs_master, nuc), + eAcc_ddbj_wgsm_prot = NCBI_ACC(ddbj, wgs_master, prot), + eAcc_ddbj_wgsv_nuc = NCBI_ACC(ddbj, wgs_vdb_only, nuc), + eAcc_ddbj_wgsv_prot = NCBI_ACC(ddbj, wgs_vdb_only, prot), + eAcc_ddbj_wgsvm_nuc = NCBI_ACC(ddbj, wgs_vdb_master, nuc), + eAcc_ddbj_wgsvm_prot = NCBI_ACC(ddbj, wgs_vdb_master, prot), + eAcc_ddbj_mga = NCBI_ACC(ddbj, mga, nuc), //AAAAA + eAcc_ddbj_targeted_nuc = NCBI_ACC(ddbj, targeted, nuc), // TAAA + eAcc_ddbj_targetedm_nuc = NCBI_ACC(ddbj, targeted_master, nuc), + eAcc_ddbj_targetedv_nuc = NCBI_ACC(ddbj, targeted_vdb_only, nuc), + eAcc_ddbj_targetedvm_nuc = NCBI_ACC(ddbj, targeted_vdb_master, nuc), + + eAcc_prf = NCBI_ACC(prf, other, prot), + eAcc_pdb = NCBI_ACC(pdb, other, seq), // not necessarily protein! + + eAcc_gb_tpa_other = NCBI_ACC(tpg, other, seq), + eAcc_gb_tpa_nuc = NCBI_ACC(tpg, other, nuc), // BK + eAcc_gb_tpa_prot = NCBI_ACC(tpg, other, prot), // DAA + eAcc_gb_tpa_segset = NCBI_ACC(tpg, segset, nuc), // BL + eAcc_gb_tpa_con = NCBI_ACC(tpg, con, nuc), // GJ + eAcc_gb_tpa_wgs_nuc = NCBI_ACC(tpg, wgs, nuc), // DAAA + eAcc_gb_tpa_wgs_prot = NCBI_ACC(tpg, wgs, prot), + eAcc_gb_tpa_wgsm_nuc = NCBI_ACC(tpg, wgs_master, nuc), + eAcc_gb_tpa_wgsm_prot = NCBI_ACC(tpg, wgs_master, prot), + eAcc_gb_tpa_wgsv_nuc = NCBI_ACC(tpg, wgs_vdb_only, nuc), + eAcc_gb_tpa_wgsv_prot = NCBI_ACC(tpg, wgs_vdb_only, prot), // HAA + eAcc_gb_tpa_wgsvm_nuc = NCBI_ACC(tpg, wgs_vdb_master, nuc), + eAcc_gb_tpa_wgsvm_prot = NCBI_ACC(tpg, wgs_vdb_master, prot), + eAcc_gb_tpa_chromosome = NCBI_ACC(tpg, chromosome, nuc), // GK + + eAcc_embl_tpa_other = NCBI_ACC(tpe, other, seq), + eAcc_embl_tpa_nuc = NCBI_ACC(tpe, other, nuc), // BN + eAcc_embl_tpa_prot = NCBI_ACC(tpe, other, prot), // CAD29848 + eAcc_embl_tpa_tsa_nuc = NCBI_ACC(tpe, tsa, nuc), + eAcc_embl_tpa_tsa_prot = NCBI_ACC(tpe, tsa, prot), + eAcc_embl_tpa_tsam_nuc = NCBI_ACC(tpe, tsa_master, nuc), + eAcc_embl_tpa_tsam_prot = NCBI_ACC(tpe, tsa_master, prot), + eAcc_embl_tpa_tsav_nuc = NCBI_ACC(tpe, tsa_vdb_only, nuc), + eAcc_embl_tpa_tsav_prot = NCBI_ACC(tpe, tsa_vdb_only, prot), + eAcc_embl_tpa_tsavm_nuc = NCBI_ACC(tpe, tsa_vdb_master, nuc), + eAcc_embl_tpa_tsavm_prot = NCBI_ACC(tpe, tsa_vdb_master, prot), + eAcc_embl_tpa_wgs_nuc = NCBI_ACC(tpe, wgs, nuc), // {} + eAcc_embl_tpa_wgs_prot = NCBI_ACC(tpe, wgs, prot), // {} + eAcc_embl_tpa_wgsm_nuc = NCBI_ACC(tpe, wgs_master, nuc), + eAcc_embl_tpa_wgsm_prot = NCBI_ACC(tpe, wgs_master, prot), + eAcc_embl_tpa_wgsv_nuc = NCBI_ACC(tpe, wgs_vdb_only, nuc), + eAcc_embl_tpa_wgsv_prot = NCBI_ACC(tpe, wgs_vdb_only, prot), + eAcc_embl_tpa_wgsvm_nuc = NCBI_ACC(tpe, wgs_vdb_master, nuc), + eAcc_embl_tpa_wgsvm_prot = NCBI_ACC(tpe, wgs_vdb_master, prot), + + eAcc_ddbj_tpa_other = NCBI_ACC(tpd, other, seq), + eAcc_ddbj_tpa_nuc = NCBI_ACC(tpd, other, nuc), //BR + eAcc_ddbj_tpa_prot = NCBI_ACC(tpd, other, prot),//FAA + eAcc_ddbj_tpa_tsa_nuc = NCBI_ACC(tpd, tsa, nuc), //YAAA + eAcc_ddbj_tpa_tsa_prot = NCBI_ACC(tpd, tsa, prot),//{} + eAcc_ddbj_tpa_tsam_nuc = NCBI_ACC(tpd, tsa_master, nuc), + eAcc_ddbj_tpa_tsam_prot = NCBI_ACC(tpd, tsa_master, prot), + eAcc_ddbj_tpa_tsav_nuc = NCBI_ACC(tpd, tsa_vdb_only, nuc), + eAcc_ddbj_tpa_tsav_prot = NCBI_ACC(tpd, tsa_vdb_only, prot), + eAcc_ddbj_tpa_tsavm_nuc = NCBI_ACC(tpd, tsa_vdb_master, nuc), + eAcc_ddbj_tpa_tsavm_prot = NCBI_ACC(tpd, tsa_vdb_master, prot), + eAcc_ddbj_tpa_con = NCBI_ACC(tpd, con, nuc), //HT + eAcc_ddbj_tpa_wgs_nuc = NCBI_ACC(tpd, wgs, nuc), //EAAA + eAcc_ddbj_tpa_wgs_prot = NCBI_ACC(tpd, wgs, prot),//IAA + eAcc_ddbj_tpa_wgsm_nuc = NCBI_ACC(tpd, wgs_master, nuc), + eAcc_ddbj_tpa_wgsm_prot = NCBI_ACC(tpd, wgs_master, prot), + eAcc_ddbj_tpa_wgsv_nuc = NCBI_ACC(tpd, wgs_vdb_only, nuc), + eAcc_ddbj_tpa_wgsv_prot = NCBI_ACC(tpd, wgs_vdb_only, prot), + eAcc_ddbj_tpa_wgsvm_nuc = NCBI_ACC(tpd, wgs_vdb_master, nuc), + eAcc_ddbj_tpa_wgsvm_prot = NCBI_ACC(tpd, wgs_vdb_master, prot), + eAcc_ddbj_tpa_chromosome = NCBI_ACC(tpd, chromosome, nuc), //HU + eAcc_ddbj_tpa_targeted_nuc = NCBI_ACC(tpd, targeted, nuc), //ZAAA + eAcc_ddbj_tpa_targetedm_nuc = NCBI_ACC(tpd, targeted_master, nuc), + eAcc_ddbj_tpa_targetedv_nuc = NCBI_ACC(tpd, targeted_vdb_only, nuc), + eAcc_ddbj_tpa_targetedvm_nuc = NCBI_ACC(tpd, targeted_vdb_master, nuc), // genome pipeline, modeled after RefSeq - eAcc_gpipe_other_nuc = e_Gpipe | eAcc_other | fAcc_nuc, // GPN_ - eAcc_gpipe_prot = e_Gpipe | eAcc_other | fAcc_prot, // GPP_ - eAcc_gpipe_scaffold = e_Gpipe | eAcc_con | fAcc_nuc, // GPS_ - eAcc_gpipe_mrna = e_Gpipe | eAcc_mrna | fAcc_nuc, // GPM_ - eAcc_gpipe_chromosome = e_Gpipe | eAcc_chromosome | fAcc_nuc, // GPC_ - eAcc_gpipe_genomic = e_Gpipe | eAcc_genomic_rgn| fAcc_nuc, // GPG_ - eAcc_gpipe_ncrna = e_Gpipe | eAcc_ncrna | fAcc_nuc, // GPR_ - eAcc_gpipe_unreserved = e_Gpipe | eAcc_unreserved, // GPX_ + eAcc_gpipe_other_nuc = NCBI_ACC(gpipe, other, nuc), // GPN_ + eAcc_gpipe_prot = NCBI_ACC(gpipe, other, prot), // GPP_ + eAcc_gpipe_scaffold = NCBI_ACC(gpipe, con, nuc), // GPS_ + eAcc_gpipe_mrna = NCBI_ACC(gpipe, mrna, nuc), // GPM_ + eAcc_gpipe_chromosome = NCBI_ACC(gpipe, chromosome, nuc), // GPC_ + eAcc_gpipe_genomic = NCBI_ACC(gpipe, genomic_rgn, nuc), // GPG_ + eAcc_gpipe_ncrna = NCBI_ACC(gpipe, ncrna, nuc), // GPR_ + eAcc_gpipe_unreserved = NCBI_ACC(gpipe, unreserved, seq), // GPX_ // named annotation track; mixed nucleotides and proteins - eAcc_named_annot_track = e_Named_annot_track | eAcc_other // AT_ + eAcc_named_annot_track = NCBI_ACC(named_annot_track, other, seq) // AT_ +#undef NCBI_ACC }; static E_Choice GetAccType(EAccessionInfo info) diff --git a/c++/include/objects/valerr/ValidErrItem.hpp b/c++/include/objects/valerr/ValidErrItem.hpp index adf99be8..9524b02d 100644 --- a/c++/include/objects/valerr/ValidErrItem.hpp +++ b/c++/include/objects/valerr/ValidErrItem.hpp @@ -1,4 +1,4 @@ -/* $Id: ValidErrItem.hpp 660629 2022-12-20 23:10:05Z kans $ +/* $Id: ValidErrItem.hpp 684486 2024-06-25 12:34:24Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -162,6 +162,8 @@ enum EErrType { eErr_SEQ_INST_CircBactGenomeProblem, eErr_SEQ_INST_ContigsTooShort, eErr_SEQ_INST_InstantiatedGapMismatch, + eErr_SEQ_INST_BadSeqIdCharacter, + eErr_SEQ_INST_BadSeqIdLength, ERR_CODE_END(SEQ_INST), ERR_CODE_BEGIN(SEQ_DESCR) = 1000, @@ -352,6 +354,12 @@ enum EErrType { eErr_SEQ_DESCR_ChromosomeWithoutLocation, eErr_SEQ_DESCR_TaxonomyBlankSample, eErr_SEQ_DESCR_NonViralSegment, + eErr_SEQ_DESCR_BadGeoLocNameCode, + eErr_SEQ_DESCR_LatLonGeoLocName, + eErr_SEQ_DESCR_ReplacedGeoLocNameCode, + eErr_SEQ_DESCR_BadGeoLocNameCapitalization, + eErr_SEQ_DESCR_BadInstitutionGeoLocName, + eErr_SEQ_DESCR_MultipleIsolates, ERR_CODE_END(SEQ_DESCR), @@ -392,6 +400,8 @@ enum EErrType { eErr_GENERIC_DeltaSeqError, eErr_GENERIC_DuplicateIDs, eErr_GENERIC_MissingPubRequirement, + eErr_GENERIC_BadSubmissionAuthorName, + eErr_GENERIC_BarcodeMissingGeoLocName, ERR_CODE_END(GENERIC), ERR_CODE_BEGIN(SEQ_PKG) = 3000, @@ -804,83 +814,57 @@ class NCBI_VALERR_EXPORT CValidErrItem : public CValidErrItem_Base public: // destructor - CValidErrItem(void); - ~CValidErrItem(void); + CValidErrItem(); + ~CValidErrItem(); // severity with proper type. - EDiagSev GetSeverity (void) const; + EDiagSev GetSeverity() const; // Error code - const string GetErrCode (void) const; - static size_t GetErrCount(void); + const string GetErrCode() const; + static size_t GetErrCount(); // Error group (SEQ_FEAT, SEQ_INST etc.) - const string GetErrGroup (void) const; + const string GetErrGroup() const; // Verbose message - const string GetVerbose (void) const; + const string GetVerbose() const; // Offending object - const CSerialObject& GetObject (void) const; - bool IsSetObject (void) const; + const CSerialObject& GetObject() const; + bool IsSetObject() const; void SetObject(const CSerialObject& obj); // Convert Severity from enum to a string representation - static const string ConvertSeverity(EDiagSev sev); - static const string ConvertErrCode(unsigned int); - static const string ConvertErrGroup(unsigned int); + static const string& ConvertSeverity(EDiagSev sev); + static const string& ConvertErrCode(unsigned int); + static const string& ConvertErrGroup(unsigned int); // Convert error code from string to unsigned int static unsigned int ConvertToErrCode(const string& str); - bool IsSetContext(void) const; - const CSeq_entry& GetContext(void) const; + bool IsSetContext() const; + const CSeq_entry& GetContext() const; void SetContext(CConstRef ctx) { m_Ctx = ctx; } // use previously populated fields to construct the "standard" description void SetFeatureObjDescFromFields(); -private: - friend class CValidError; // constructor - CValidErrItem(EDiagSev sev, // severity - unsigned int ec, // error code - const string& msg, // message - const string& obj_desc, // object description - const CSerialObject& obj, // offending object - const string& acc, // accession - const int ver, // version of object. - const int seq_offset = 0); // sequence offset - - CValidErrItem(EDiagSev sev, // severity - unsigned int ec, // error code - const string& msg, // message - const string& obj_desc, // object description - const string& acc, // accession - const int ver, // version of object. - const int seq_offset = 0); // sequence offset - - CValidErrItem(EDiagSev sev, // severity - unsigned int ec, // error code - const string& msg, // message - const string& obj_desc, // object description - const CSerialObject& obj, // offending object - const string& acc, // accession - const int ver, // version of object. - const string& feature_id, // feature ID - const int seq_offset = 0); // sequence offset + CValidErrItem( + EDiagSev sev, // severity + unsigned int ec, // error code + const string& msg, // message + const string& obj_desc, // object description + const CSerialObject* obj, // offending object + const CSeq_entry* context, // desc's context. + const string& acc, // accession + const int ver, // version of object. + const int seq_offset = 0); // sequence offset - // constructor - CValidErrItem(EDiagSev sev, // severity - unsigned int ec, // error code - const string& msg, // message - const string& obj_desc, // object description - const CSerialObject& obj, // offending object - const CSeq_entry& context, // desc's context. - const string& acc, // accession - const int ver, // version of object. - const int seq_offset = 0); // sequence offset +private: +// friend class CValidError; // Prohibit default & copy constructor and assignment operator - CValidErrItem(const CValidErrItem& value); - CValidErrItem& operator=(const CValidErrItem& value); + CValidErrItem(const CValidErrItem& value) = delete; + CValidErrItem& operator=(const CValidErrItem& value) = delete; // member data values that are not serialized. CConstRef m_Object; // offending object @@ -894,13 +878,13 @@ private: // constructor inline -CValidErrItem::CValidErrItem(void) +CValidErrItem::CValidErrItem() { } inline -EDiagSev CValidErrItem::GetSeverity(void) const +EDiagSev CValidErrItem::GetSeverity() const { // convert from internal integer to external enum type. return static_cast(GetSev()); @@ -908,15 +892,15 @@ EDiagSev CValidErrItem::GetSeverity(void) const inline -bool CValidErrItem::IsSetContext(void) const -{ - return m_Ctx.NotEmpty(); +bool CValidErrItem::IsSetContext() const +{ + return m_Ctx.NotEmpty(); } inline -const CSeq_entry& CValidErrItem::GetContext(void) const -{ - return *m_Ctx; +const CSeq_entry& CValidErrItem::GetContext() const +{ + return *m_Ctx; } diff --git a/c++/include/objects/valerr/ValidError.hpp b/c++/include/objects/valerr/ValidError.hpp index 3e905e2a..d5e37bd0 100644 --- a/c++/include/objects/valerr/ValidError.hpp +++ b/c++/include/objects/valerr/ValidError.hpp @@ -1,4 +1,4 @@ -/* $Id: ValidError.hpp 657933 2022-10-20 18:09:57Z ludwigf $ +/* $Id: ValidError.hpp 682281 2024-04-25 18:00:28Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -52,74 +52,115 @@ BEGIN_objects_SCOPE // namespace ncbi::objects:: class CSeqdesc; class CSeq_entry; +class NCBI_VALERR_EXPORT IValidError +{ +public: + virtual ~IValidError() = default; + + virtual void AddValidErrItem( + EDiagSev sev, // severity + unsigned int ec, // error code + const string& msg, // specific error message + const string& desc, // offending object's description + const CSerialObject& obj, // offending object + const string& acc, // accession of object. + const int ver, // version of object. + const string& location = kEmptyStr, // formatted location of object + const int seq_offset = 0) = 0; + + virtual void AddValidErrItem( + EDiagSev sev, // severity + unsigned int ec, // error code + const string& msg, // specific error message + const string& desc, // offending object's description + const string& acc, // accession of object. + const int ver, // version of object. + const string& location = kEmptyStr, // formatted location of object + const int seq_offset = 0) = 0; + + virtual void AddValidErrItem( + EDiagSev sev, // severity + unsigned int ec, // error code + const string& msg, // specific error message + const string& desc, // offending object's description + const CSeqdesc& seqdesc, // offending object + const CSeq_entry& ctx, // place of packaging + const string& acc, // accession of object or context. + const int ver, // version of object. + const int seq_offset = 0) = 0; + + virtual void AddValidErrItem( + EDiagSev sev, // severity + unsigned int ec, // error code + const string& msg) // specific error message + = 0; + + virtual void AddValidErrItem(CRef item) = 0; +}; + ///////////////////////////////////////////////////////////////////////////// -class NCBI_VALERR_EXPORT CValidError : public CValidError_Base +class NCBI_VALERR_EXPORT CValidError : + public CValidError_Base, + public IValidError { typedef CValidError_Base Tparent; public: // constructor - CValidError(const CSerialObject* obj = NULL); + CValidError(const CSerialObject* obj = nullptr); // destructor - ~CValidError(void); - - void AddValidErrItem(EDiagSev sev, // severity - unsigned int ec, // error code - const string& msg, // specific error message - const string& desc, // offending object's description - const CSerialObject& obj, // offending object - const string& acc, // accession of object. - const int ver, // version of object. - const string& location = kEmptyStr, // formatted location of object - const int seq_offset = 0); - - void AddValidErrItem(EDiagSev sev, // severity - unsigned int ec, // error code - const string& msg, // specific error message - const string& desc, // offending object's description - const string& acc, // accession of object. - const int ver, // version of object. - const string& location = kEmptyStr, // formatted location of object - const int seq_offset = 0); - - void AddValidErrItem(EDiagSev sev, // severity - unsigned int ec, // error code - const string& msg, // specific error message - const string& desc, // offending object's description - const CSerialObject& obj, // offending object - const string& acc, // accession of object. - const int ver, // version of object. - const string& feature_id, // feature ID for object - const string& location, // formatted location of object - const int seq_offset = 0); - - void AddValidErrItem(EDiagSev sev, // severity - unsigned int ec, // error code - const string& msg, // specific error message - const string& desc, // offending object's description - const CSeqdesc& seqdesc, // offending object - const CSeq_entry& ctx, // place of packaging - const string& acc, // accession of object or context. - const int ver, // version of object. - const int seq_offset = 0); - - void AddValidErrItem(EDiagSev sev, // severity - unsigned int ec, // error code - const string& msg); // specific error message - - void AddValidErrItem(CRef item); + virtual ~CValidError(); + + void AddValidErrItem( + EDiagSev sev, // severity + unsigned int ec, // error code + const string& msg, // specific error message + const string& desc, // offending object's description + const CSerialObject& obj, // offending object + const string& acc, // accession of object. + const int ver, // version of object. + const string& location = kEmptyStr, // formatted location of object + const int seq_offset = 0) final; + + void AddValidErrItem( + EDiagSev sev, // severity + unsigned int ec, // error code + const string& msg, // specific error message + const string& desc, // offending object's description + const string& acc, // accession of object. + const int ver, // version of object. + const string& location = kEmptyStr, // formatted location of object + const int seq_offset = 0) final; + + void AddValidErrItem( + EDiagSev sev, // severity + unsigned int ec, // error code + const string& msg, // specific error message + const string& desc, // offending object's description + const CSeqdesc& seqdesc, // offending object + const CSeq_entry& ctx, // place of packaging + const string& acc, // accession of object or context. + const int ver, // version of object. + const int seq_offset = 0) final; + + void AddValidErrItem( + EDiagSev sev, // severity + unsigned int ec, // error code + const string& msg) final; // specific error message + + void AddValidErrItem(CRef item) final; // Statistics - SIZE_TYPE TotalSize(void) const; + SIZE_TYPE TotalSize() const; SIZE_TYPE Size(EDiagSev sev) const; - SIZE_TYPE InfoSize (void) const; - SIZE_TYPE WarningSize (void) const; - SIZE_TYPE ErrorSize (void) const; - SIZE_TYPE CriticalSize(void) const; - SIZE_TYPE FatalSize (void) const; + SIZE_TYPE InfoSize () const; + SIZE_TYPE WarningSize () const; + SIZE_TYPE ErrorSize () const; + SIZE_TYPE CriticalSize() const; + SIZE_TYPE FatalSize () const; // Get the validated object (Seq-entry, Seq-submit or Seq-align) - const CSerialObject* GetValidated(void) const; + const CSerialObject* GetValidated() const; // for suppressing errors by type. Suppression list // will be checked at the time that a AddValidErrItem @@ -127,15 +168,15 @@ public: void SuppressError(unsigned int ec); bool ShouldSuppress(unsigned int ec); void ClearSuppressions(); - - bool IsCatastrophic() const; + + NCBI_DEPRECATED bool IsCatastrophic() const; protected: friend class CValidError_CI; - typedef map TSevStats; - typedef CConstRef TValidated; - typedef CConstRef TContext; + typedef map TSevStats; + typedef CConstRef TValidated; + typedef CConstRef TContext; // data TSevStats m_Stats; // severity statistics @@ -144,36 +185,36 @@ protected: private: // Prohibit copy constructor & assignment operator - CValidError(const CValidError&); - CValidError& operator= (const CValidError&); - + CValidError(const CValidError&) = delete; + CValidError& operator=(const CValidError&) = delete; }; class NCBI_VALERR_EXPORT CValidError_CI { public: - CValidError_CI(void); - CValidError_CI(const CValidError& ve, - const string& errcode = kEmptyStr, - EDiagSev minsev = eDiagSevMin, - EDiagSev maxsev = eDiagSevMax); + CValidError_CI(); + CValidError_CI( + const CValidError& ve, + const string& errcode = kEmptyStr, + EDiagSev minsev = eDiagSevMin, + EDiagSev maxsev = eDiagSevMax); CValidError_CI(const CValidError_CI& iter); - virtual ~CValidError_CI(void); + virtual ~CValidError_CI(); CValidError_CI& operator=(const CValidError_CI& iter); - CValidError_CI& operator++(void); + CValidError_CI& operator++(); - bool IsValid(void) const; + bool IsValid() const; DECLARE_OPERATOR_BOOL(IsValid()); - const CValidErrItem& operator* (void) const; - const CValidErrItem* operator->(void) const; + const CValidErrItem& operator*() const; + const CValidErrItem* operator->() const; private: bool Filter(const CValidErrItem& item) const; - bool AtEnd(void) const; - void Next(void); + bool AtEnd() const; + void Next(); CConstRef m_Validator; CValidError::TErrs::const_iterator m_Current; @@ -190,55 +231,55 @@ private: // constructor inline -SIZE_TYPE CValidError::TotalSize(void) const +SIZE_TYPE CValidError::TotalSize() const { return GetErrs().size(); } inline -SIZE_TYPE CValidError::Size(EDiagSev sev) const +SIZE_TYPE CValidError::Size(EDiagSev sev) const { - return const_cast(this)->m_Stats[sev]; + return const_cast(this)->m_Stats[sev]; } inline -SIZE_TYPE CValidError::InfoSize(void) const +SIZE_TYPE CValidError::InfoSize() const { return Size(eDiag_Info); } inline -SIZE_TYPE CValidError::WarningSize(void) const +SIZE_TYPE CValidError::WarningSize() const { return Size(eDiag_Warning); } inline -SIZE_TYPE CValidError::ErrorSize(void) const +SIZE_TYPE CValidError::ErrorSize() const { return Size(eDiag_Error); } inline -SIZE_TYPE CValidError::CriticalSize(void) const +SIZE_TYPE CValidError::CriticalSize() const { return Size(eDiag_Critical); } inline -SIZE_TYPE CValidError::FatalSize(void) const +SIZE_TYPE CValidError::FatalSize() const { return Size(eDiag_Fatal); } inline -const CSerialObject* CValidError::GetValidated(void) const +const CSerialObject* CValidError::GetValidated() const { return m_Validated.GetPointerOrNull(); } diff --git a/c++/include/objtools/align_format/align_format_util.hpp b/c++/include/objtools/align_format/align_format_util.hpp index 55e12300..b5b69434 100644 --- a/c++/include/objtools/align_format/align_format_util.hpp +++ b/c++/include/objtools/align_format/align_format_util.hpp @@ -1,4 +1,4 @@ -/* $Id: align_format_util.hpp 664623 2023-03-17 12:37:00Z zaretska $ +/* $Id: align_format_util.hpp 683948 2024-06-10 12:11:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -811,7 +811,7 @@ public: ///@param out: ostream to add white space ///@param number: the number of white spaces desired /// - static void AddSpace(CNcbiOstream& out, int number); + static void AddSpace(CNcbiOstream& out, size_t number); ///Return ID for GNL label ///@param dtg: dbtag to build label from @@ -851,7 +851,7 @@ public: ///@return actual number of subject sequences static void PruneSeqalign(const objects::CSeq_align_set& source_aln, objects::CSeq_align_set& new_aln, - unsigned int num = kDfltArgNumAlignments); + unsigned int num = static_cast(kDfltArgNumAlignments)); ///Calculate number of subject sequnces in alignment limitted by num ///@param source_aln: the original alnset @@ -1375,11 +1375,11 @@ public: ///Calculate the number of spaces and add them to paramVal ///@param string: input parameter value - ///@param string: max length for the string that holds parameter + ///@param size_t: max length for the string that holds parameter ///@param int: additional fomatting after adding spaces ///@param string: the position of spaces and additional formatting ///@return:string containing paramVal and spaces place appropriately - static string AddSpaces(string paramVal, unsigned int maxParamLength, int spacesFormatFlag = eSpacePosToCenter); + static string AddSpaces(string paramVal, size_t maxParamLength, int spacesFormatFlag = eSpacePosToCenter); static string GetProtocol(void); @@ -1545,16 +1545,10 @@ public: ///@return: bool indicating if accession is WGS static bool IsWGSPattern(string &wgsAccession); - ///Get Gene symobol for gi - ///@param giForGeneLookup: gi - ///@return: string gene symbol - static string GetGeneInfo(TGi giForGeneLookup); - - static unique_ptr m_Reg; static string m_Protocol; static bool m_geturl_debug_flag; - static unique_ptr m_GeneInfoReader; + /// Calculate the uniq subject query coverage range (blastn only) static int GetUniqSeqCoverage(objects::CSeq_align_set & alnset); diff --git a/c++/include/objtools/align_format/showalign.hpp b/c++/include/objtools/align_format/showalign.hpp index 66de7aa7..beb5ea1f 100644 --- a/c++/include/objtools/align_format/showalign.hpp +++ b/c++/include/objtools/align_format/showalign.hpp @@ -1,4 +1,4 @@ -/* $Id: showalign.hpp 621514 2020-12-14 15:36:59Z grichenk $ +/* $Id: showalign.hpp 683946 2024-06-10 12:10:50Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -492,6 +492,7 @@ protected: string feature_string; list feature_start; CRange < TSignedSeqPos > aln_range; + int genetic_code; //genetice code used to this feature if applicable }; typedef list< CRef > TSAlnFeatureInfoList; @@ -744,6 +745,7 @@ protected: ///get feature info ///@param feature: where feature info to be filled + ///@param custom_genetic_code: use this code (set to -1 if you don't want to use this code) ///@param scope: scope to fectch sequence ///@param choice: which feature to get ///@param row: current row number @@ -752,7 +754,9 @@ protected: ///@param feat_seq_strand: strand to be filled corresponding to feat_seq_range ///@param fill_feat_range: to fill feat_seq_range? /// - void x_GetFeatureInfo(TSAlnFeatureInfoList& feature, objects::CScope & scope, + void x_GetFeatureInfo(TSAlnFeatureInfoList& feature, + int custom_genetic_code, + objects::CScope & scope, objects::CSeqFeatData::E_Choice choice, int row, string& sequence, list > >& feat_seq_range, @@ -814,7 +818,7 @@ protected: void x_SetFeatureInfo(CRef feat_info, const objects::CSeq_loc& seqloc, int aln_from, int aln_to, int aln_stop, char pattern_char, string pattern_id, - string& alternative_feat_str) const; + string& alternative_feat_str, int genetic_code) const; ///get insert information ///@param insert_list: list to be filled @@ -829,11 +833,7 @@ protected: objects::CAlnMap::TSeqPosList& insert_length, int line_aln_stop); - ///check if Gene info is enabled and a Gene link is present for a hit - ///@param aln_vec_info: alnvec list - /// - bool x_IsGeneInfoAvailable(SAlnInfo* aln_vec_info); - + ///get the URL of the Gene info link. ///@param gene_id: gene id to link to. ///@return: fully formatted URL of the Gene info link. @@ -892,9 +892,6 @@ protected: CNcbiOstream& out); CRef x_GetAlnVecForSeqalign(const objects::CSeq_align& align); - ///Display Gene Info - /// - string x_DisplayGeneInfo(const objects::CBioseq_Handle& bsp_handle,SAlnInfo* aln_vec_info); ///Dipslay Bl2seq TBLASTX link /// diff --git a/c++/include/objtools/blast/seqdb_reader/impl/seqdbatlas.hpp b/c++/include/objtools/blast/seqdb_reader/impl/seqdbatlas.hpp index 4da078c0..65a59c80 100644 --- a/c++/include/objtools/blast/seqdb_reader/impl/seqdbatlas.hpp +++ b/c++/include/objtools/blast/seqdb_reader/impl/seqdbatlas.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS_READERS_SEQDB__SEQDBATLAS_HPP #define OBJTOOLS_READERS_SEQDB__SEQDBATLAS_HPP -/* $Id: seqdbatlas.hpp 630682 2021-05-06 15:39:49Z fongah2 $ +/* $Id: seqdbatlas.hpp 683533 2024-05-30 12:54:51Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -50,7 +50,6 @@ #include #include - #include #include #include @@ -719,10 +718,14 @@ public: m_MappedFile = m_Atlas.GetMemoryFile(m_Filename); m_Mapped = true; } - catch (const std::exception&) { - NCBI_THROW(CSeqDBException, - eFileErr, - "Cannot memory map " + m_Filename + ". Number of files opened: " + NStr::IntToString(m_Atlas.GetOpenedFilseCount())); + catch (const std::exception& e) { + string err_msg = e.what(); + if (err_msg.find("Too many open files") == std::string::npos ) { + NCBI_THROW(CSeqDBException, eFileErr, e.what()); + } + else { + NCBI_THROW(CSeqDBException, eOpenFileErr, e.what()); + } } m_DataPtr = (char *)(m_MappedFile->GetPtr()); diff --git a/c++/include/objtools/blast/seqdb_reader/impl/seqdbgeneral.hpp b/c++/include/objtools/blast/seqdb_reader/impl/seqdbgeneral.hpp index 8333a6b7..fed7fb87 100644 --- a/c++/include/objtools/blast/seqdb_reader/impl/seqdbgeneral.hpp +++ b/c++/include/objtools/blast/seqdb_reader/impl/seqdbgeneral.hpp @@ -1,7 +1,7 @@ #ifndef CORELIB__SEQDB__SEQDBGENERAL_HPP #define CORELIB__SEQDB__SEQDBGENERAL_HPP -/* $Id: seqdbgeneral.hpp 624923 2021-02-05 18:10:16Z fongah2 $ +/* $Id: seqdbgeneral.hpp 683929 2024-06-10 12:07:52Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -1279,7 +1279,7 @@ int SeqDB_VectorAssign(const T & data, vector & v) i++; } - return i; + return static_cast(i); } END_NCBI_SCOPE diff --git a/c++/include/objtools/blast/seqdb_reader/impl/seqdbisam.hpp b/c++/include/objtools/blast/seqdb_reader/impl/seqdbisam.hpp index 5ed78609..6d2dd308 100644 --- a/c++/include/objtools/blast/seqdb_reader/impl/seqdbisam.hpp +++ b/c++/include/objtools/blast/seqdb_reader/impl/seqdbisam.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS_READERS_SEQDB__SEQDBISAM_HPP #define OBJTOOLS_READERS_SEQDB__SEQDBISAM_HPP -/* $Id: seqdbisam.hpp 626985 2021-03-08 13:57:13Z fongah2 $ +/* $Id: seqdbisam.hpp 683929 2024-06-10 12:07:52Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -505,7 +505,7 @@ private: for (int index=0; index < m_NumSamples; ++index) { - keys.push_back(x_GetNumericKey(keydatap)); + keys.push_back(static_cast(x_GetNumericKey(keydatap))); // vals.push_back(x_GetNumericData(keydatap)); offs.push_back(index * m_PageSize * m_TermSize); keydatap += m_TermSize; @@ -527,7 +527,7 @@ private: for (int index=0; index < num_keys; ++index) { - keys.push_back(x_GetNumericKey(keydatap)); + keys.push_back(static_cast(x_GetNumericKey(keydatap))); vals.push_back(x_GetNumericData(keydatap)); keydatap += m_TermSize; } diff --git a/c++/include/objtools/blast/seqdb_reader/impl/seqdbvol.hpp b/c++/include/objtools/blast/seqdb_reader/impl/seqdbvol.hpp index a6194bf8..74d0a09a 100644 --- a/c++/include/objtools/blast/seqdb_reader/impl/seqdbvol.hpp +++ b/c++/include/objtools/blast/seqdb_reader/impl/seqdbvol.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS_READERS_SEQDB__SEQDBVOL_HPP #define OBJTOOLS_READERS_SEQDB__SEQDBVOL_HPP -/* $Id: seqdbvol.hpp 651939 2022-06-28 12:33:29Z fongah2 $ +/* $Id: seqdbvol.hpp 679614 2024-02-28 18:46:23Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -947,7 +947,7 @@ private: if (! have_user) { if (m_UserGiList.NotEmpty() && m_UserGiList->HasIdFilters()) { have_user |= x_ListIncludesId(*m_UserGiList, id); - } else if (m_NegativeList.NotEmpty() && m_NegativeList->GetNumTaxIds() == 0 && m_NegativeList->GetNumPigs() == 0 ) { + } else if (m_NegativeList.NotEmpty() && m_NegativeList->HasIdFilters() ) { have_user |= x_ListIncludesId(*m_NegativeList, id); } else { have_user = true; diff --git a/c++/include/objtools/blast/seqdb_reader/seqdbcommon.hpp b/c++/include/objtools/blast/seqdb_reader/seqdbcommon.hpp index ef123cf4..48f0b7bd 100644 --- a/c++/include/objtools/blast/seqdb_reader/seqdbcommon.hpp +++ b/c++/include/objtools/blast/seqdb_reader/seqdbcommon.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS_BLAST_SEQDB_READER___SEQDBCOMMON__HPP #define OBJTOOLS_BLAST_SEQDB_READER___SEQDBCOMMON__HPP -/* $Id: seqdbcommon.hpp 651939 2022-06-28 12:33:29Z fongah2 $ +/* $Id: seqdbcommon.hpp 683533 2024-05-30 12:54:51Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -87,7 +87,10 @@ public: eVersionErr, /// No Tax Id Found - eTaxidErr + eTaxidErr, + + /// Too many open files + eOpenFileErr }; /// Get a message describing the situation leading to the throw. @@ -96,7 +99,10 @@ public: switch ( GetErrCode() ) { case eArgErr: return "eArgErr"; case eFileErr: return "eFileErr"; + case eMemErr: return "eMemErr"; case eVersionErr: return "eVersionErr"; + case eTaxidErr: return "eTaxidErr"; + case eOpenFileErr: return "eOpenFileErr"; default: return CException::GetErrCodeString(); } } @@ -962,6 +968,11 @@ public: return size; } + bool HasIdFilters() const + { + return (GetNumGis() || GetNumSis() || GetNumTis()); + } + /// Return false if there are elements present. bool Empty() const { diff --git a/c++/include/objtools/blast/seqdb_writer/build_db.hpp b/c++/include/objtools/blast/seqdb_writer/build_db.hpp index 863e52f8..6142226e 100644 --- a/c++/include/objtools/blast/seqdb_writer/build_db.hpp +++ b/c++/include/objtools/blast/seqdb_writer/build_db.hpp @@ -1,4 +1,4 @@ -/* $Id: build_db.hpp 649164 2022-04-28 11:08:55Z fongah2 $ +/* $Id: build_db.hpp 675078 2023-11-14 13:36:47Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -153,6 +153,9 @@ public: /// @param long_seqids if true, requires long sequence ids /// (database|accession) when parsing fasta sequences [in] /// @param dbver version of BLAST database to generate [in] + /// @param scan_bioseq_4_cfastareader_usrobj [in] + /// If true, scan the Bioseq objects for a CFastaReader-created User-object + /// containing a defline CBuildDatabase(const string & dbname, const string & title, bool is_protein, @@ -162,7 +165,8 @@ public: bool long_seqids = false, EBlastDbVersion dbver = eBDB_Version4, bool limit_defline = false, - Uint8 oid_masks = EOidMaskType::fNone); + Uint8 oid_masks = EOidMaskType::fNone, + bool scan_bioseq_4_cfastareader_usrobj = true); // Note -- should deprecate (or just remove) the following one: // - sparse does nothing @@ -185,6 +189,9 @@ public: /// @param indexing index fields to add to database. [in] /// @param long_seqids if true, requires long sequence ids /// (database|accession) when parsing fasta sequences [in] + /// @param scan_bioseq_4_cfastareader_usrobj [in] + /// If true, scan the Bioseq objects for a CFastaReader-created User-object + /// containing a defline CBuildDatabase(const string & dbname, const string & title, bool is_protein, @@ -195,7 +202,8 @@ public: bool long_seqids = false, EBlastDbVersion dbver = eBDB_Version4, bool limit_defline = false, - Uint8 oid_masks = EOidMaskType::fNone); + Uint8 oid_masks = EOidMaskType::fNone, + bool scan_bioseq_4_cfastareader_usrobj = true); ~CBuildDatabase(); @@ -659,6 +667,8 @@ private: bool m_SkipLargeGis; string m_OutputDbName; + + bool m_ScanBioseq4CFastaReaderUsrObjct; }; END_NCBI_SCOPE diff --git a/c++/include/objtools/blast/seqdb_writer/writedb.hpp b/c++/include/objtools/blast/seqdb_writer/writedb.hpp index b6bf7103..8365ab06 100644 --- a/c++/include/objtools/blast/seqdb_writer/writedb.hpp +++ b/c++/include/objtools/blast/seqdb_writer/writedb.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS_BLAST_SEQDB_WRITER___WRITEDB__HPP #define OBJTOOLS_BLAST_SEQDB_WRITER___WRITEDB__HPP -/* $Id: writedb.hpp 651607 2022-06-21 14:07:14Z fongah2 $ +/* $Id: writedb.hpp 675078 2023-11-14 13:36:47Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -152,6 +152,9 @@ public: /// If true, generate GI-based mask files [in] /// @param dbver /// version of BLAST database to generate [in] + /// @param scan_bioseq_4_cfastareader_usrobj [in] + /// If true, scan the Bioseq objects for a CFastaReader-created User-object + /// containing a defline CWriteDB(const string & dbname, ESeqType seqtype, const string & title, @@ -161,7 +164,8 @@ public: bool use_gi_mask = false, EBlastDbVersion dbver = eBDB_Version4, bool limit_defline = false, - Uint8 oid_masks = EOidMaskType::fNone); + Uint8 oid_masks = EOidMaskType::fNone, + bool scan_bioseq_4_cfastareader_usrobj = false); /// Destructor. /// @@ -356,10 +360,14 @@ public: /// @param bs The bioseq from which to extract a defline set. [in] /// @param parse_ids If seqid should be parsed [in] /// @param long_ids It true, use long sequence ids (database|accession) [in] + /// @param scan_bioseq_4_cfastareader_usrobj [in] + /// If true, scan the Bioseq objects for a CFastaReader-created User-object + /// containing a defline /// @return A set of deflines for this CBioseq. static CRef ExtractBioseqDeflines(const CBioseq & bs, bool parse_ids=true, - bool long_ids=false); + bool long_ids=false, + bool scan_bioseq_4_cfastareader_usrobj=false); /// Set letters that should not be used in sequences. /// diff --git a/c++/include/objtools/cleanup/capitalization_string.hpp b/c++/include/objtools/cleanup/capitalization_string.hpp index 696433ff..8e188701 100644 --- a/c++/include/objtools/cleanup/capitalization_string.hpp +++ b/c++/include/objtools/cleanup/capitalization_string.hpp @@ -1,6 +1,6 @@ #ifndef _CAPITALIZATION_INSTRINGS_HPP_ #define _CAPITALIZATION_INSTRINGS_HPP_ -/* $Id: capitalization_string.hpp 582960 2019-03-21 19:22:51Z asztalos $ +/* $Id: capitalization_string.hpp 681618 2024-04-11 12:27:43Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -58,6 +58,7 @@ NCBI_CLEANUP_EXPORT void FindOrgNames(objects::CSeq_entry_Handle seh, vector m_Scope; diff --git a/c++/include/objtools/cleanup/cleanup_change.hpp b/c++/include/objtools/cleanup/cleanup_change.hpp index c2be70a1..b423a333 100644 --- a/c++/include/objtools/cleanup/cleanup_change.hpp +++ b/c++/include/objtools/cleanup/cleanup_change.hpp @@ -1,7 +1,7 @@ #ifndef CLEANUP___CLEANUP_CHANGE__HPP #define CLEANUP___CLEANUP_CHANGE__HPP -/* $Id: cleanup_change.hpp 658644 2022-11-04 14:08:42Z gotvyans $ +/* $Id: cleanup_change.hpp 674909 2023-11-08 12:38:04Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -178,7 +178,6 @@ public: operator bool() const { return !m_Changes.empty(); } vector GetAllChanges() const; - NCBI_DEPRECATED vector GetAllDescriptions() const; vector GetDescriptions() const; static string_view GetDescription(EChanges e); diff --git a/c++/include/objtools/cleanup/huge_file_cleanup.hpp b/c++/include/objtools/cleanup/huge_file_cleanup.hpp deleted file mode 100644 index 05501db0..00000000 --- a/c++/include/objtools/cleanup/huge_file_cleanup.hpp +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef HUGE_FILE_CLEANUP_HPP -#define HUGE_FILE_CLEANUP_HPP - -/* $Id: huge_file_cleanup.hpp 664176 2023-03-08 20:23:24Z foleyjp $ - * =========================================================================== - * - * PUBLIC DOMAIN NOTICE - * National Center for Biotechnology Information - * - * This software/database is a "United States Government Work" under the - * terms of the United States Copyright Act. It was written as part of - * the author's official duties as a United States Government employee and - * thus cannot be copyrighted. This software/database is freely available - * to the public for use. The National Library of Medicine and the U.S. - * Government have not placed any restriction on its use or reproduction. - * - * Although all reasonable efforts have been taken to ensure the accuracy - * and reliability of the software and data, the NLM and the U.S. - * Government do not and cannot warrant the performance or results that - * may be obtained by using this software or data. The NLM and the U.S. - * Government disclaim all warranties, express or implied, including - * warranties of performance, merchantability or fitness for any particular - * purpose. - * - * Please cite the author in any work or product based on this material. - * - * =========================================================================== - * - * Author: Justin Foley - * File Description: - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -BEGIN_NCBI_SCOPE -BEGIN_SCOPE(objects) - -class CFeat_id; - -class NCBI_CLEANUP_EXPORT CCleanupHugeAsnReader : - public edit::CHugeAsnReader -{ -public: - enum EOptions { - eExtendedCleanup = 1, - eNoNcbiUserObjects = 1<<1, - eEnableSmallGenomeSets = 1<<2, - }; - - using TOptions = int; - - CCleanupHugeAsnReader(TOptions options); - virtual ~CCleanupHugeAsnReader() = default; - using TParent = edit::CHugeAsnReader; - - void FlattenGenbankSet() override; - CRef LoadSeqEntry(const TBioseqSetInfo& info, - eAddTopEntry add_top_entry = eAddTopEntry::yes) const override; - const CCleanupChangeCore& GetChanges() const; - - using TFeatId = CFeat_id::TLocal::TId; -private: - bool x_IsExtendedCleanup() const; - void x_SetHooks(CObjectIStream& objStream, TContext& context) override; - void x_SetBioseqHooks(CObjectIStream& objStream, TContext& context) override; - void x_SetBioseqSetHooks(CObjectIStream& objStream, TContext& context) override; - void x_SetSeqFeatHooks(CObjectIStream& objStream, TContext& context); - - void x_RecordFeatureId(const CFeat_id& featId); - - void x_CreateSmallGenomeSets(); - void x_PruneIfFeatsIncomplete(); - void x_PruneAndReorderTopIds(); - void x_PruneIfSegsMissing(const string& fluLabel, const set& segsFound); - - void x_CleanupTopLevelDescriptors(); - bool x_LooksLikeNucProtSet() const; - void x_AddTopLevelDescriptors(CSeq_entry& entry) const; - list> m_TopLevelBiosources; - CRef m_pTopLevelMolInfo; - const TOptions m_CleanupOptions; - mutable CCleanupChangeCore m_Changes; - using TIdToFluLabel = map,string,CRefLess>; - TIdToFluLabel m_IdToFluLabel; - TIdToFluLabel::iterator x_GetFluLabel(const CConstRef& pId); - map> m_FluLabelToSetInfo; - map m_SetPosToFluLabel; - set, CRefLess> m_HasIncompleteFeats; - - - struct TFeatIdInfo { - using TFeatIdMap = map; - using TPosToFeatIds = map; - - set ExistingIds; - set NewIds; - set NewExistingIds; - TFeatIdMap RemappedIds; - TFeatId IdOffset{0}; - TPosToFeatIds PosToIdMap; - }; - - TFeatIdInfo m_FeatIdInfo; -}; - -END_SCOPE(object) -END_NCBI_SCOPE - -#endif /// HUGE_FILE_CLEANUP diff --git a/c++/src/objtools/cleanup/influenza_set.hpp b/c++/include/objtools/cleanup/influenza_set.hpp similarity index 90% rename from c++/src/objtools/cleanup/influenza_set.hpp rename to c++/include/objtools/cleanup/influenza_set.hpp index 4a483b48..f221307e 100644 --- a/c++/src/objtools/cleanup/influenza_set.hpp +++ b/c++/include/objtools/cleanup/influenza_set.hpp @@ -1,7 +1,7 @@ #ifndef _INFLUENZA_SET_HPP_ #define _INFLUENZA_SET_HPP_ -/* $Id: influenza_set.hpp 661173 2023-01-05 16:38:02Z foleyjp $ +/* $Id: influenza_set.hpp 680750 2024-03-27 13:48:22Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -39,7 +39,7 @@ BEGIN_NCBI_SCOPE BEGIN_SCOPE(objects) -class CInfluenzaSet : public CObject { +class NCBI_CLEANUP_EXPORT CInfluenzaSet : public CObject { public: CInfluenzaSet(const string& key); ~CInfluenzaSet() {} @@ -69,7 +69,7 @@ protected: size_t m_Required; }; -bool g_FindSegs(const CBioSource& src, size_t numRequired, set& segsFound); +bool NCBI_CLEANUP_EXPORT g_FindSegs(const CBioSource& src, size_t numRequired, set& segsFound); END_SCOPE(objects) END_NCBI_SCOPE diff --git a/c++/include/objtools/data_loaders/genbank/gbloader.hpp b/c++/include/objtools/data_loaders/genbank/gbloader.hpp index 3dbc870f..5e82523f 100644 --- a/c++/include/objtools/data_loaders/genbank/gbloader.hpp +++ b/c++/include/objtools/data_loaders/genbank/gbloader.hpp @@ -1,7 +1,7 @@ #ifndef GBLOADER__HPP_INCLUDED #define GBLOADER__HPP_INCLUDED -/* $Id: gbloader.hpp 673835 2023-10-11 14:57:07Z ivanov $ +/* $Id: gbloader.hpp 675419 2023-11-21 19:45:39Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -70,7 +70,6 @@ class CReader; class CSeqref; class CReadDispatcher; class CGBInfoManager; -class CReaderParams; // Parameter names used by loader factory @@ -159,8 +158,7 @@ public: const string& web_cookie = NcbiEmptyString) { m_HasHUPIncluded = include_hup; - if (include_hup && !web_cookie.empty()) - m_WebCookie = web_cookie; + m_WebCookie = web_cookie; } bool HasHUPIncluded(void) const { @@ -182,6 +180,13 @@ public: m_PSGServiceName = service_name; } + bool GetUsePSG() const; + void SetUsePSG(bool use_psg = true) + { + m_UsePSG = use_psg; + m_UsePSGInitialized = true; + } + bool GetPSGNoSplit(void) const { return m_PSGNoSplit; @@ -211,14 +216,18 @@ private: CRef m_ReaderPtr; const TParamTree* m_ParamTree; EPreopenConnection m_Preopen; + mutable bool m_UsePSGInitialized; // can be changed in GetUsePSG() + mutable bool m_UsePSG; + bool m_PSGNoSplit; bool m_HasHUPIncluded; string m_WebCookie; string m_LoaderName; string m_PSGServiceName; - bool m_PSGNoSplit; + CNullable m_EnableSNP; + CNullable m_EnableWGS; + CNullable m_EnableCDD; friend class CGBDataLoader_Native; - unique_ptr m_ReaderParams; }; class NCBI_XLOADER_GENBANK_EXPORT CGBDataLoader : public CDataLoader @@ -271,13 +280,15 @@ public: EIncludeHUP include_hup, CObjectManager::EIsDefault is_default = CObjectManager::eNonDefault, CObjectManager::TPriority priority = CObjectManager::kPriority_NotSet); + static string GetLoaderNameFromArgs(EIncludeHUP include_hup); static TRegisterLoaderInfo RegisterInObjectManager( CObjectManager& om, EIncludeHUP include_hup, const string& web_cookie, CObjectManager::EIsDefault is_default = CObjectManager::eNonDefault, CObjectManager::TPriority priority = CObjectManager::kPriority_NotSet); - static string GetLoaderNameFromArgs(EIncludeHUP include_hup); + static string GetLoaderNameFromArgs(EIncludeHUP include_hup, + const string& web_cookie); // GBLoader with HUP data included. // The reader can be either pubseqos or pubseqos2. @@ -288,6 +299,8 @@ public: EIncludeHUP include_hup, CObjectManager::EIsDefault is_default = CObjectManager::eNonDefault, CObjectManager::TPriority priority = CObjectManager::kPriority_NotSet); + static string GetLoaderNameFromArgs(const string& reader_name, // pubseqos or pubseqos2 + EIncludeHUP include_hup); static TRegisterLoaderInfo RegisterInObjectManager( CObjectManager& om, const string& reader_name, // pubseqos or pubseqos2 @@ -296,7 +309,8 @@ public: CObjectManager::EIsDefault is_default = CObjectManager::eNonDefault, CObjectManager::TPriority priority = CObjectManager::kPriority_NotSet); static string GetLoaderNameFromArgs(const string& reader_name, // pubseqos or pubseqos2 - EIncludeHUP include_hup); + EIncludeHUP include_hup, + const string& web_cookie); // Setup loader using param tree. If tree is null or failed to find params, // use environment or select default reader. @@ -420,10 +434,36 @@ public: virtual bool GetTrackSplitSeq() const override; protected: + template + class CGBLoaderMaker : public CLoaderMaker_Base + { + public: + CGBLoaderMaker(const CGBLoaderParams& params) + : m_Params(params) + { + m_Name = CGBDataLoader::GetLoaderNameFromArgs(params); + } + + virtual ~CGBLoaderMaker(void) {} + + virtual CDataLoader* CreateLoader(void) const + { + return new TDataLoader(m_Name, m_Params); + } + typedef SRegisterLoaderInfo TRegisterInfo; + TRegisterInfo GetRegisterInfo(void) + { + TRegisterInfo info; + info.Set(m_RegisterInfo.GetLoader(), m_RegisterInfo.IsCreated()); + return info; + } + protected: + CGBLoaderParams m_Params; + }; CGBDataLoader(const string& loader_name, const CGBLoaderParams& params); - static void SetLoaderMethod(CGBLoaderParams& params); + static string x_GetLoaderMethod(const TParamTree* params); TExpirationTimeout m_IdExpirationTimeout; diff --git a/c++/include/objtools/data_loaders/genbank/gbnative.hpp b/c++/include/objtools/data_loaders/genbank/gbnative.hpp index 47ce9769..00ff8a56 100644 --- a/c++/include/objtools/data_loaders/genbank/gbnative.hpp +++ b/c++/include/objtools/data_loaders/genbank/gbnative.hpp @@ -1,7 +1,7 @@ #ifndef GBNATIVE__HPP_INCLUDED #define GBNATIVE__HPP_INCLUDED -/* $Id: gbnative.hpp 673828 2023-10-11 14:56:18Z ivanov $ +/* $Id: gbnative.hpp 675419 2023-11-21 19:45:39Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -225,13 +225,10 @@ protected: private: friend class CGBDataLoader; - typedef CParamLoaderMaker TGBMaker; - friend class CParamLoaderMaker; + friend class CGBLoaderMaker; TRealBlobId x_GetRealBlobId(const TBlobId& blob_id) const override; - static TRegisterLoaderInfo ConvertRegInfo(const TGBMaker::TRegisterInfo& info); - CGBDataLoader_Native(const string& loader_name, const CGBLoaderParams& params); @@ -252,10 +249,10 @@ private: pair GetReaderWriterName(const TParamTree* params, const CGBLoaderParams& loader_params) const; bool x_CreateReaders(const string& str, const TParamTree* params, - const CReaderParams& reader_params, + const CGBLoaderParams& gb_params, CGBLoaderParams::EPreopenConnection preopen); void x_CreateWriters(const string& str, const TParamTree* params); - CReader* x_CreateReader(const string& names, const CReaderParams& reader_params, const TParamTree* params = 0); + CReader* x_CreateReader(const string& names, const CGBLoaderParams& gb_params, const TParamTree* params = 0); CWriter* x_CreateWriter(const string& names, const TParamTree* params = 0); typedef CPluginManager TReaderManager; diff --git a/c++/include/objtools/data_loaders/genbank/impl/dispatcher.hpp b/c++/include/objtools/data_loaders/genbank/impl/dispatcher.hpp index 16106874..09c3c3fa 100644 --- a/c++/include/objtools/data_loaders/genbank/impl/dispatcher.hpp +++ b/c++/include/objtools/data_loaders/genbank/impl/dispatcher.hpp @@ -2,7 +2,7 @@ #define DISPATCHER__HPP_INCLUDED /* */ -/* $Id: dispatcher.hpp 610970 2020-06-26 12:56:46Z grichenk $ +/* $Id: dispatcher.hpp 675188 2023-11-16 13:46:47Z ivanov $ * =========================================================================== * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information @@ -74,6 +74,7 @@ public: void InsertReader (TLevel level, CRef reader); void InsertWriter (TLevel level, CRef writer); void InsertProcessor(CRef processor); + bool HasReaderWithHUPIncluded() const; CWriter* GetWriter(const CReaderRequestResult& result, CWriter::EType type) const; diff --git a/c++/include/objtools/data_loaders/genbank/impl/psg_loader_impl.hpp b/c++/include/objtools/data_loaders/genbank/impl/psg_loader_impl.hpp index a94b63dc..da241aa0 100644 --- a/c++/include/objtools/data_loaders/genbank/impl/psg_loader_impl.hpp +++ b/c++/include/objtools/data_loaders/genbank/impl/psg_loader_impl.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS_DATA_LOADERS_PSG___PSG_LOADER_IMPL__HPP #define OBJTOOLS_DATA_LOADERS_PSG___PSG_LOADER_IMPL__HPP -/* $Id: psg_loader_impl.hpp 669328 2023-06-27 13:18:16Z ivanov $ +/* $Id: psg_loader_impl.hpp 675200 2023-11-16 13:48:27Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -266,6 +266,7 @@ private: CPSG_Request_Biodata::EIncludeData m_TSERequestModeBulk = CPSG_Request_Biodata::eWholeTSE; bool m_AddWGSMasterDescr = true; shared_ptr m_Queue; + CRef m_RequestContext; unique_ptr m_BlobMap; unique_ptr m_IpgTaxIdMap; unique_ptr m_BioseqCache; diff --git a/c++/include/objtools/data_loaders/genbank/psg_loader.hpp b/c++/include/objtools/data_loaders/genbank/psg_loader.hpp index d1c8859d..a20e157a 100644 --- a/c++/include/objtools/data_loaders/genbank/psg_loader.hpp +++ b/c++/include/objtools/data_loaders/genbank/psg_loader.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS_DATA_LOADERS_PSG___PSG_LOADER__HPP #define OBJTOOLS_DATA_LOADERS_PSG___PSG_LOADER__HPP -/* $Id: psg_loader.hpp 673827 2023-10-11 14:56:08Z ivanov $ +/* $Id: psg_loader.hpp 675419 2023-11-21 19:45:39Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -157,13 +157,10 @@ public: static void SetSNP_Scale_Limit(CSeq_id::ESNPScaleLimit value); private: - typedef CParamLoaderMaker TMaker; - friend class CParamLoaderMaker; + friend class CGBLoaderMaker; TRealBlobId x_GetRealBlobId(const TBlobId& blob_id) const override; - static TRegisterLoaderInfo ConvertRegInfo(const TMaker::TRegisterInfo& info); - // default constructor CPSGDataLoader(void); // parametrized constructor diff --git a/c++/include/objtools/data_loaders/genbank/reader.hpp b/c++/include/objtools/data_loaders/genbank/reader.hpp index 44711116..b3627c67 100644 --- a/c++/include/objtools/data_loaders/genbank/reader.hpp +++ b/c++/include/objtools/data_loaders/genbank/reader.hpp @@ -1,6 +1,6 @@ #ifndef READER__HPP_INCLUDED #define READER__HPP_INCLUDED -/* $Id: reader.hpp 673829 2023-10-11 14:56:26Z ivanov $ +/* $Id: reader.hpp 675198 2023-11-16 13:48:10Z ivanov $ * =========================================================================== * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information @@ -50,22 +50,22 @@ class CReaderAllocatedConnection; struct SAnnotSelector; -class NCBI_XREADER_EXPORT CReaderParams +class CReaderParams { public: - CReaderParams(void) {} - ~CReaderParams(void) {} - bool IsSetEnableSNP(void) const { return !m_EnableSNP.IsNull(); } bool GetEnableSNP(void) const { return m_EnableSNP.GetValue(); } + void SetEnableSNP(CNullable enable) { m_EnableSNP = enable; } void SetEnableSNP(bool enable) { m_EnableSNP = enable; } bool IsSetEnableWGS(void) const { return !m_EnableWGS.IsNull(); } bool GetEnableWGS(void) const { return m_EnableWGS.GetValue(); } + void SetEnableWGS(CNullable enable) { m_EnableWGS = enable; } void SetEnableWGS(bool enable) { m_EnableWGS = enable; } bool IsSetEnableCDD(void) const { return !m_EnableCDD.IsNull(); } bool GetEnableCDD(void) const { return m_EnableCDD.GetValue(); } + void SetEnableCDD(CNullable enable) { m_EnableCDD = enable; } void SetEnableCDD(bool enable) { m_EnableCDD = enable; } private: @@ -300,6 +300,10 @@ public: virtual void SetIncludeHUP(bool include_hup = true, const string& web_cookie = NcbiEmptyString); + bool HasHUPIncluded() const + { + return m_IncludeHUP; + } virtual void SetParams(const CReaderParams& params); @@ -352,6 +356,10 @@ protected: // report failed or stale connection void x_ReportDisconnect(const char* reader, const char* server, TConn conn, bool failed) const; + void x_SetIncludeHUP(bool include_hup) + { + m_IncludeHUP = include_hup; + } private: friend class CReaderAllocatedConnection; @@ -367,6 +375,7 @@ private: // parameters TConn m_MaxConnections; bool m_PreopenConnection; + bool m_IncludeHUP; // current state TConn m_NextNewConnection; diff --git a/c++/include/objtools/edit/eutils_updater.hpp b/c++/include/objtools/edit/eutils_updater.hpp index 340ec811..b65c4f7d 100644 --- a/c++/include/objtools/edit/eutils_updater.hpp +++ b/c++/include/objtools/edit/eutils_updater.hpp @@ -1,51 +1,132 @@ +/* $Id: eutils_updater.hpp 676881 2023-12-27 15:10:07Z sadyrovr $ + * =========================================================================== + * + * PUBLIC DOMAIN NOTICE + * National Center for Biotechnology Information + * + * This software/database is a "United States Government Work" under the + * terms of the United States Copyright Act. It was written as part of + * the author's official duties as a United States Government employee and + * thus cannot be copyrighted. This software/database is freely available + * to the public for use. The National Library of Medicine and the U.S. + * Government have not placed any restriction on its use or reproduction. + * + * Although all reasonable efforts have been taken to ensure the accuracy + * and reliability of the software and data, the NLM and the U.S. + * Government do not and cannot warrant the performance or results that + * may be obtained by using this software or data. The NLM and the U.S. + * Government disclaim all warranties, express or implied, including + * warranties of performance, merchantability or fitness for any particular + * purpose. + * + * Please cite the author in any work or product based on this material. + * + * =========================================================================== + * + * Author: Vitaly Stakhovsky, NCBI + * + * File Description: + * Pubmed Updater based on EUtils + * + * =========================================================================== + */ + #ifndef _EUTILS_UPDATER_HPP_ #define _EUTILS_UPDATER_HPP_ #include -#include +#include BEGIN_NCBI_SCOPE BEGIN_SCOPE(objects) +class CPub; +class CCit_art; +class CPubmed_entry; BEGIN_SCOPE(edit) -class NCBI_XOBJEDIT_EXPORT CEUtilsUpdaterBase : public IPubmedUpdater +enum class EPubmedError { + ok, + not_found, + operational_error, + citation_not_found, + citation_ambiguous, + cannot_connect_pmdb, + cannot_connect_searchbackend_pmdb, +}; + +NCBI_XOBJEDIT_EXPORT +CNcbiOstream& operator<<(CNcbiOstream&, EPubmedError); + +struct NCBI_XOBJEDIT_EXPORT SCitMatch { + string Journal; + string Volume; + string Page; + string Year; + string Author; + string Issue; + string Title; + bool InPress = false; + bool Option1 = false; + + void FillFromArticle(const CCit_art&); +}; + +using TPubInterceptor = std::function&)>; + +class NCBI_XOBJEDIT_EXPORT CEUtilsUpdater { public: - CEUtilsUpdaterBase(bool bNorm); - TEntrezId CitMatch(const CPub&, EPubmedError* = nullptr) override; - TEntrezId CitMatch(const SCitMatch&, EPubmedError* = nullptr) override; - CRef x_GetPub(TEntrezId pmid, EPubmedError*); + enum class ENormalize { Off, On }; + +public: + CEUtilsUpdater(ENormalize = ENormalize::Off); + virtual ~CEUtilsUpdater() {} + + virtual bool Init() { return true; } + virtual void Fini() {} + virtual TEntrezId CitMatch(const CPub&, EPubmedError* = nullptr); + virtual TEntrezId CitMatch(const SCitMatch&, EPubmedError* = nullptr); + virtual CRef GetPubmedEntry(TEntrezId pmid, EPubmedError* = nullptr); + CRef GetPub(TEntrezId pmid, EPubmedError* = nullptr); + + TPubInterceptor SetPubInterceptor(TPubInterceptor f) + { + TPubInterceptor old = m_pub_interceptor; + m_pub_interceptor = f; + return old; + } // Hydra replacement using citmatch api; RW-1918,RW-1999 static bool DoPubSearch(const std::vector& query, std::vector& pmids); -private: +protected: + CRef x_GetPubmedEntry(TEntrezId pmid, EPubmedError*); + CRef x_GetPub(TEntrezId pmid, EPubmedError*); + +protected: CRef m_Ctx; - bool m_bNorm; + ENormalize m_Norm; + TPubInterceptor m_pub_interceptor = nullptr; }; -class NCBI_XOBJEDIT_EXPORT CEUtilsUpdaterWithCache : public CEUtilsUpdaterBase -{ - CRef GetPub(TEntrezId pmid, EPubmedError* = nullptr) override; +using IPubmedUpdater = CEUtilsUpdater; +class NCBI_XOBJEDIT_EXPORT CEUtilsUpdaterWithCache : public CEUtilsUpdater +{ public: - CEUtilsUpdaterWithCache(bool bNorm = false) : - CEUtilsUpdaterBase(bNorm) {} + CEUtilsUpdaterWithCache(ENormalize norm = ENormalize::Off) : + CEUtilsUpdater(norm) {} + + CRef GetPubmedEntry(TEntrezId pmid, EPubmedError* = nullptr) override; + void ReportStats(std::ostream&); void ClearCache(); private: map> m_cache; - size_t m_num_requests = 0; - size_t m_cache_hits = 0; -}; -class NCBI_XOBJEDIT_EXPORT CEUtilsUpdater : public CEUtilsUpdaterWithCache -{ -public: - CEUtilsUpdater(bool bNorm = false) : - CEUtilsUpdaterWithCache(bNorm) {} - CRef GetPub(TEntrezId pmid, EPubmedError* = nullptr) override; + size_t m_num_requests = 0; + size_t m_cache_hits = 0; }; END_SCOPE(edit) diff --git a/c++/include/objtools/edit/feattable_edit.hpp b/c++/include/objtools/edit/feattable_edit.hpp index 868bf893..368a0140 100644 --- a/c++/include/objtools/edit/feattable_edit.hpp +++ b/c++/include/objtools/edit/feattable_edit.hpp @@ -1,4 +1,4 @@ -/* $Id: feattable_edit.hpp 636221 2021-08-18 14:17:15Z ludwigf $ +/* $Id: feattable_edit.hpp 677912 2024-01-25 14:13:06Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -204,7 +204,12 @@ protected: void xRenameFeatureId( const CObject_id&, FeatMap&); - +private: + void xGenerateMissingMrnaForCds(const CMappedFeat& cds); + void xGenerateMissingGeneForFeat(const CMappedFeat& feat); + void xGenerateMissingGeneForFeats(const SAnnotSelector& sel, + const CGff3LocationMerger* =nullptr); +protected: CSeq_annot& mAnnot; unsigned int mSequenceSize; CRef mpScope; diff --git a/c++/include/objtools/edit/huge_asn_loader.hpp b/c++/include/objtools/edit/huge_asn_loader.hpp index 4110d7e6..bf8c21bb 100644 --- a/c++/include/objtools/edit/huge_asn_loader.hpp +++ b/c++/include/objtools/edit/huge_asn_loader.hpp @@ -1,88 +1,3 @@ -/* $Id: huge_asn_loader.hpp 661268 2023-01-07 18:04:49Z gotvyans $ -* =========================================================================== -* -* PUBLIC DOMAIN NOTICE -* National Center for Biotechnology Information -* -* This software/database is a "United States Government Work" under the -* terms of the United States Copyright Act. It was written as part of -* the author's official duties as a United States Government employee and -* thus cannot be copyrighted. This software/database is freely available -* to the public for use. The National Library of Medicine and the U.S. -* Government have not placed any restriction on its use or reproduction. -* -* Although all reasonable efforts have been taken to ensure the accuracy -* and reliability of the software and data, the NLM and the U.S. -* Government do not and cannot warrant the performance or results that -* may be obtained by using this software or data. The NLM and the U.S. -* Government disclaim all warranties, express or implied, including -* warranties of performance, merchantability or fitness for any particular -* purpose. -* -* Please cite the author in any work or product based on this material. -* -* =========================================================================== -* -* Authors: Sergiy Gotvyanskyy -* -* File Description: -* -* +/* $Id: huge_asn_loader.hpp 680752 2024-03-27 13:48:44Z ivanov $ */ - -#ifndef _HUGE_ASN_DATALOADER_HPP_INCLUDED_ -#define _HUGE_ASN_DATALOADER_HPP_INCLUDED_ - -#include -#include - -BEGIN_NCBI_SCOPE - -BEGIN_SCOPE(objects) - -namespace edit -{ - class CHugeAsnReader; - class CHugeFile; -} - -BEGIN_SCOPE(edit) - -class NCBI_XOBJEDIT_EXPORT CHugeAsnDataLoader: public CDataLoader -{ -public: - typedef SRegisterLoaderInfo TRegisterLoaderInfo; - CHugeAsnDataLoader(const string& name, CHugeAsnReader* reader); - ~CHugeAsnDataLoader(); - - static TRegisterLoaderInfo RegisterInObjectManager( - CObjectManager& om, - const string& loader_name, - CHugeAsnReader* reader, - CObjectManager::EIsDefault is_default = CObjectManager::eNonDefault, - CObjectManager::TPriority priority = CObjectManager::kPriority_Default); - - TTSE_LockSet GetRecords(const CSeq_id_Handle& idh, EChoice choice) override; - TBlobId GetBlobId(const CSeq_id_Handle& idh) override; - TTSE_Lock GetBlobById(const TBlobId& blob_id) override; - TSeqPos GetSequenceLength(const CSeq_id_Handle& idh) override; - void GetIds(const CSeq_id_Handle& idh, CDataLoader::TIds& ids) override; - CSeq_inst::TMol GetSequenceType(const CSeq_id_Handle& idh) override; - STypeFound GetSequenceTypeFound(const CSeq_id_Handle& idh) override; - TTaxId GetTaxId(const CSeq_id_Handle& idh) override; - - bool CanGetBlobById(void) const override - { - return true; - } - -private: - CHugeAsnReader* m_reader = nullptr; - bool m_owning = false; -}; - -END_SCOPE(edit) -END_SCOPE(objects) -END_NCBI_SCOPE - -#endif // _HUGE_ASN_DATALOADER_HPP_INCLUDED_ +#include diff --git a/c++/include/objtools/edit/huge_asn_macro_reader.hpp b/c++/include/objtools/edit/huge_asn_macro_reader.hpp deleted file mode 100644 index 34af29c2..00000000 --- a/c++/include/objtools/edit/huge_asn_macro_reader.hpp +++ /dev/null @@ -1,57 +0,0 @@ -/* $Id: huge_asn_macro_reader.hpp 658723 2022-11-07 18:22:37Z asztalos $ -* =========================================================================== -* -* PUBLIC DOMAIN NOTICE -* National Center for Biotechnology Information -* -* This software/database is a "United States Government Work" under the -* terms of the United States Copyright Act. It was written as part of -* the author's official duties as a United States Government employee and -* thus cannot be copyrighted. This software/database is freely available -* to the public for use. The National Library of Medicine and the U.S. -* Government have not placed any restriction on its use or reproduction. -* -* Although all reasonable efforts have been taken to ensure the accuracy -* and reliability of the software and data, the NLM and the U.S. -* Government do not and cannot warrant the performance or results that -* may be obtained by using this software or data. The NLM and the U.S. -* Government disclaim all warranties, express or implied, including -* warranties of performance, merchantability or fitness for any particular -* purpose. -* -* Please cite the author in any work or product based on this material. -* -* =========================================================================== -* -* Authors: Sergiy Gotvyanskyy, Andrea Asztalos -* -* File Description: -* Reader used in huge file mode in gbenchmacro cmd line tool -* -*/ - -#ifndef _HUGE_ASN_MACRO_READER_HPP_INCLUDED_ -#define _HUGE_ASN_MACRO_READER_HPP_INCLUDED_ - -#include -#include - -BEGIN_NCBI_SCOPE -BEGIN_SCOPE(objects) -BEGIN_SCOPE(edit) - - -class NCBI_XOBJEDIT_EXPORT CMacroHugeAsnReader : public CHugeAsnReader -{ -public: - void ResetTopEntry(); -}; - - -END_SCOPE(edit) -END_SCOPE(objects) -END_NCBI_SCOPE - -#endif // _HUGE_ASN_MACRO_READER_HPP_INCLUDED_ - - diff --git a/c++/include/objtools/edit/huge_asn_reader.hpp b/c++/include/objtools/edit/huge_asn_reader.hpp index 8cb57f26..d82f6687 100644 --- a/c++/include/objtools/edit/huge_asn_reader.hpp +++ b/c++/include/objtools/edit/huge_asn_reader.hpp @@ -1,203 +1,3 @@ -/* $Id: huge_asn_reader.hpp 663759 2023-02-28 18:53:36Z foleyjp $ -* =========================================================================== -* -* PUBLIC DOMAIN NOTICE -* National Center for Biotechnology Information -* -* This software/database is a "United States Government Work" under the -* terms of the United States Copyright Act. It was written as part of -* the author's official duties as a United States Government employee and -* thus cannot be copyrighted. This software/database is freely available -* to the public for use. The National Library of Medicine and the U.S. -* Government have not placed any restriction on its use or reproduction. -* -* Although all reasonable efforts have been taken to ensure the accuracy -* and reliability of the software and data, the NLM and the U.S. -* Government do not and cannot warrant the performance or results that -* may be obtained by using this software or data. The NLM and the U.S. -* Government disclaim all warranties, express or implied, including -* warranties of performance, merchantability or fitness for any particular -* purpose. -* -* Please cite the author in any work or product based on this material. -* -* =========================================================================== -* -* Authors: Sergiy Gotvyanskyy -* -* File Description: -* -* +/* $Id: huge_asn_reader.hpp 680752 2024-03-27 13:48:44Z ivanov $ */ - -#ifndef _HUGE_ASN_READER_HPP_INCLUDED_ -#define _HUGE_ASN_READER_HPP_INCLUDED_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -BEGIN_NCBI_SCOPE - -class CObjectIStream; - -BEGIN_SCOPE(objects) - -class CBioseq; -class CSeq_submit; -class CSeqdesc; - -BEGIN_SCOPE(edit) - - -class NCBI_XOBJEDIT_EXPORT CHugeAsnReader: public IHugeAsnSource -{ -public: - using TFileSize = std::streamoff; - - CHugeAsnReader(); - CHugeAsnReader(CHugeFile* file, ILineErrorListener * pMessageListener); - virtual ~CHugeAsnReader(); - - void Open(CHugeFile* file, ILineErrorListener * pMessageListener) override; - bool GetNextBlob() override; - CRef GetNextSeqEntry() override; - CConstRef GetSubmitBlock() const override; - CRef ReadAny(); - - struct TBioseqInfo; - struct TBioseqSetInfo; - using TBioseqSetList = std::list; - using TBioseqList = std::list; - - struct TBioseqInfo - { - TFileSize m_pos; - TBioseqSetList::const_iterator m_parent_set; - TSeqPos m_length = -1; - CConstRef m_descr; - std::list> m_ids; - CSeq_inst::TMol m_mol = CSeq_inst::eMol_not_set; - CSeq_inst::TRepr m_repr = CSeq_inst::eRepr_not_set; - }; - - struct TBioseqSetInfo - { - TFileSize m_pos; - TBioseqSetList::const_iterator m_parent_set; - CBioseq_set::TClass m_class = CBioseq_set::eClass_not_set; - CConstRef m_descr; - bool m_HasAnnot{false}; - optional m_Level; - }; - - using CRefLess = PPtrLess>; - - using TBioseqIndex = std::map, TBioseqList::const_iterator, CRefLess>; - using TBioseqSetIndex = std::map, TBioseqSetList::const_iterator, CRefLess>; - - auto& GetBioseqs() const { return m_bioseq_list; }; - auto& GetBiosets() const { return m_bioseq_set_list; }; - auto GetFormat() const { return m_file->m_format; }; - auto GetMaxLocalId() const { return m_max_local_id; }; - - // These metods are for CDataLoader, each top object is a 'blob' - const TBioseqSetInfo* FindTopObject(CConstRef seqid) const; - - enum class eAddTopEntry{ yes, no }; - virtual CRef LoadSeqEntry(const TBioseqSetInfo& info, eAddTopEntry add_top_entry = eAddTopEntry::yes) const; - - const TBioseqInfo* FindBioseq(CConstRef seqid) const; - CConstRef GetClosestDescriptor(const TBioseqInfo& info, CSeqdesc::E_Choice choice) const; - CConstRef GetClosestDescriptor(const CSeq_id& id, CSeqdesc::E_Choice choice) const; - - // Direct loading methods - CRef LoadSeqEntry(CConstRef seqid) const; - CRef LoadBioseq(CConstRef seqid) const; - - bool IsMultiSequence() const override; - bool HasHugeSetAnnot() const { return m_HasHugeSetAnnot; } - static bool IsHugeSet(CBioseq_set::TClass setClass); - - - virtual void FlattenGenbankSet(); - auto& GetTopEntry() const { return m_top_entry; } - auto& GetFlattenedIndex() const { return m_FlattenedIndex; } - auto& GetTopIds() const { return m_top_ids; } - unique_ptr MakeObjStream(TFileSize pos) const; - - const CBioseq_set::TClass* GetTopLevelClass() const; -protected: - // temporary structure for indexing - struct TBioseqInfoRec - { - list> m_ids; - TSeqPos m_length = 0; - CRef m_descr; - CSeq_inst::TMol m_mol = CSeq_inst::eMol_not_set; - CSeq_inst::TRepr m_repr = CSeq_inst::eRepr_not_set; - }; - - struct TContext - { - std::deque bioseq_stack; - std::deque bioseq_set_stack; - }; - - virtual void x_SetHooks(CObjectIStream& objStream, TContext& context); - virtual void x_SetFeatIdHooks(CObjectIStream& objStream, TContext& context); - virtual void x_SetBioseqHooks(CObjectIStream& objStream, TContext& context); - virtual void x_SetBioseqSetHooks(CObjectIStream& objStream, TContext& context); - - void x_ResetTopEntry(); - using TStreamPos = streampos; - TStreamPos GetCurrentPos() const; - - -private: - void x_ResetIndex(); - void x_IndexNextAsn1(); - void x_ThrowDuplicateId( - const TBioseqSetInfo& existingInfo,const TBioseqSetInfo& newInfo, const CSeq_id& duplicateId); - - CRef x_GetTopLevelDescriptors() const; - bool x_HasNestedGenbankSets() const; - - - ILineErrorListener * mp_MessageListener = nullptr; - TStreamPos m_current_pos = 0; // points to current blob in concatenated ASN.1 file - CHugeFile* m_file = nullptr; - -// global lists, readonly after indexing -protected: - TBioseqList m_bioseq_list; - TStreamPos m_next_pos = 0; // points to next unprocessed blob in concatenated ASN.1 file - int m_max_local_id = 0; - TBioseqSetList m_bioseq_set_list; - CRef m_top_entry; - std::list> m_top_ids; - bool m_HasHugeSetAnnot{ false }; -private: - CConstRef m_submit_block; - -// flattenization structures, readonly after flattenization, accept m_Current - TBioseqIndex m_bioseq_index; - TBioseqSetIndex m_FlattenedIndex; - TBioseqSetList m_FlattenedSets; - TBioseqSetList::const_iterator m_Current; - const CBioseq_set::TClass* m_pTopLevelClass { nullptr }; -}; - -END_SCOPE(edit) -END_SCOPE(objects) -END_NCBI_SCOPE - -#endif // _HUGE_ASN_READER_HPP_INCLUDED_ +#include diff --git a/c++/include/objtools/edit/huge_file.hpp b/c++/include/objtools/edit/huge_file.hpp index 78983af1..5a5e8711 100644 --- a/c++/include/objtools/edit/huge_file.hpp +++ b/c++/include/objtools/edit/huge_file.hpp @@ -1,123 +1,3 @@ -/* $Id: huge_file.hpp 671844 2023-08-24 20:01:10Z ivanov $ -* =========================================================================== -* -* PUBLIC DOMAIN NOTICE -* National Center for Biotechnology Information -* -* This software/database is a "United States Government Work" under the -* terms of the United States Copyright Act. It was written as part of -* the author's official duties as a United States Government employee and -* thus cannot be copyrighted. This software/database is freely available -* to the public for use. The National Library of Medicine and the U.S. -* Government have not placed any restriction on its use or reproduction. -* -* Although all reasonable efforts have been taken to ensure the accuracy -* and reliability of the software and data, the NLM and the U.S. -* Government do not and cannot warrant the performance or results that -* may be obtained by using this software or data. The NLM and the U.S. -* Government disclaim all warranties, express or implied, including -* warranties of performance, merchantability or fitness for any particular -* purpose. -* -* Please cite the author in any work or product based on this material. -* -* =========================================================================== -* -* Authors: Sergiy Gotvyanskyy -* -* File Description: -* -* +/* $Id: huge_file.hpp 680752 2024-03-27 13:48:44Z ivanov $ */ - -#ifndef _HUGE_FILE_HPP_INCLUDED_ -#define _HUGE_FILE_HPP_INCLUDED_ - -#include -#include -#include -#include - -BEGIN_NCBI_SCOPE - -class CMemoryFile; -class CObjectIStream; - -BEGIN_SCOPE(objects) - -class CSeq_entry; -class CSeq_submit; -class CSubmit_block; -class ILineErrorListener; - -BEGIN_SCOPE(edit) - -class NCBI_XOBJEDIT_EXPORT CHugeFile -{ -public: - CHugeFile(); - virtual ~CHugeFile(); - const set* m_supported_types = nullptr; - - std::unique_ptr m_memfile; - std::unique_ptr m_stream; - std::unique_ptr m_streambuf; - std::string m_filename; - const char* m_memory = nullptr; - std::streampos m_filesize = 0; - - ESerialDataFormat m_serial_format = eSerial_None; - CFormatGuess::EFormat m_format = CFormatGuess::eUnknown; - TTypeInfo m_content = nullptr; - - class CMemoryStreamBuf: public std::streambuf - { - public: - CMemoryStreamBuf(const char* ptr, size_t size) - { - setg((char*)ptr, (char*)ptr, (char*)ptr+size); - } - }; - - void Reset(); - void Open(const std::string& filename, const set* supported_types); - bool IsOpen() const { return m_filesize != 0; } - TTypeInfo RecognizeContent(std::streampos pos); - TTypeInfo RecognizeContent(std::istream& istr); - unique_ptr MakeObjStream(std::streampos pos = 0) const; - -private: - bool x_TryOpenStreamFile(const string& filename, std::streampos filesize); - bool x_TryOpenMemoryFile(const string& filename, std::streampos filesize); -}; - -class NCBI_XOBJEDIT_EXPORT CHugeFileException : public CException -{ -public: - enum EErrCode - { - eDuplicateSeqIds, - eDuplicateFeatureIds, - }; - //virtual const char* GetErrCodeString(void) const override; - NCBI_EXCEPTION_DEFAULT(CHugeFileException,CException); -}; - -class NCBI_XOBJEDIT_EXPORT IHugeAsnSource -{ -public: - virtual void Open(CHugeFile* file, ILineErrorListener * pMessageListener) = 0; - virtual bool GetNextBlob() = 0; - virtual CRef GetNextSeqEntry() = 0; - virtual bool IsMultiSequence() const = 0; - virtual CConstRef GetSubmitBlock() const = 0; - virtual ~IHugeAsnSource(){}; -protected: - IHugeAsnSource(){}; -}; - -END_SCOPE(edit) -END_SCOPE(objects) -END_NCBI_SCOPE - -#endif // _HUGE_ASN_READER_HPP_INCLUDED_ +#include diff --git a/c++/include/objtools/edit/huge_file_process.hpp b/c++/include/objtools/edit/huge_file_process.hpp index f3ed8047..6f2c1fd1 100644 --- a/c++/include/objtools/edit/huge_file_process.hpp +++ b/c++/include/objtools/edit/huge_file_process.hpp @@ -1,98 +1,3 @@ -#ifndef HUGE_FILE_PROCESS_HPP -#define HUGE_FILE_PROCESS_HPP - -/* $Id: huge_file_process.hpp 661438 2023-01-11 15:47:11Z gotvyans $ - * =========================================================================== - * - * PUBLIC DOMAIN NOTICE - * National Center for Biotechnology Information - * - * This software/database is a "United States Government Work" under the - * terms of the United States Copyright Act. It was written as part of - * the author's official duties as a United States Government employee and - * thus cannot be copyrighted. This software/database is freely available - * to the public for use. The National Library of Medicine and the U.S. - * Government have not placed any restriction on its use or reproduction. - * - * Although all reasonable efforts have been taken to ensure the accuracy - * and reliability of the software and data, the NLM and the U.S. - * Government do not and cannot warrant the performance or results that - * may be obtained by using this software or data. The NLM and the U.S. - * Government disclaim all warranties, express or implied, including - * warranties of performance, merchantability or fitness for any particular - * purpose. - * - * Please cite the author in any work or product based on this material. - * - * =========================================================================== - * - * Author: Mati Shomrat - * File Description: - * Utility class for processing Genbank release files. - */ - -#include -#include -#include - -BEGIN_NCBI_SCOPE - -/// forward declarations -class CObjectIStream; -BEGIN_SCOPE(objects) - -class CScope; -class CSeq_entry_Handle; -class CBioseq_Handle; -class CSubmit_block; -class CSeq_entry; -class CSeq_id; - -BEGIN_SCOPE(edit) -class CHugeFile; -class CHugeAsnReader; - -class NCBI_XOBJEDIT_EXPORT CHugeFileProcess -{ -public: - - static const set g_supported_types; - - /// constructors - CHugeFileProcess(); - CHugeFileProcess(CHugeAsnReader* pReader); - CHugeFileProcess(const string& file_name, const set* types = &g_supported_types); - /// destructor - virtual ~CHugeFileProcess(void); - void Open(const string& file_name, const set* types = &g_supported_types); - void OpenFile(const string& file_name); - void OpenFile(const string& file_name, const set* types); - void OpenReader(); - - using THandler = std::function, CRef)>; - using THandlerIds = std::function>&)>; - using THandlerBlobs = std::function; - using THandlerEntries = std::function; - - [[nodiscard]] bool Read(THandler handler, CRef seqid); - [[nodiscard]] bool Read(THandlerIds handler); - [[nodiscard]] bool ForEachBlob(THandlerBlobs); - [[nodiscard]] bool ForEachEntry(CRef scope, THandlerEntries handler); - [[nodiscard]] bool ReadNextBlob(); - static CSeq_entry_Handle GetTopLevelEntry(CBioseq_Handle beh); - - CHugeAsnReader& GetReader() { return *m_pReader; } - CHugeFile& GetFile() { return *m_pHugeFile; } - const CHugeFile& GetConstFile() const { return *m_pHugeFile; } - static bool IsSupported(TTypeInfo info); - -private: - unique_ptr m_pHugeFile; - unique_ptr m_pReader; -}; - -END_SCOPE(edit) -END_SCOPE(object) -END_NCBI_SCOPE - -#endif /// NEW_GB_RELEASE_FILE__HPP +/* $Id: huge_file_process.hpp 680752 2024-03-27 13:48:44Z ivanov $ +*/ +#include diff --git a/c++/include/objtools/edit/pub_fix.hpp b/c++/include/objtools/edit/pub_fix.hpp index 811e98b3..8df269c3 100644 --- a/c++/include/objtools/edit/pub_fix.hpp +++ b/c++/include/objtools/edit/pub_fix.hpp @@ -1,7 +1,7 @@ #ifndef _PUB_FIX_HPP_ #define _PUB_FIX_HPP_ -/* $Id: pub_fix.hpp 644550 2022-01-28 20:22:33Z stakhovv $ +/* $Id: pub_fix.hpp 676568 2023-12-18 19:55:19Z sadyrovr $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -36,7 +36,7 @@ #include #include -#include +#include BEGIN_NCBI_SCOPE @@ -135,7 +135,7 @@ class NCBI_XOBJEDIT_EXPORT CPubFix { public: - CPubFix(bool always_lookup, bool replace_cit, bool merge_ids, IMessageListener* err_log, IPubmedUpdater* upd) : + CPubFix(bool always_lookup, bool replace_cit, bool merge_ids, IMessageListener* err_log, CEUtilsUpdater* upd) : m_always_lookup(always_lookup), m_replace_cit(replace_cit), m_merge_ids(merge_ids), @@ -149,7 +149,7 @@ public: void FixPubEquiv(CPub_equiv& pub_equiv); const CAuthListValidator& GetValidator() const { return m_authlist_validator; }; - static CRef FetchPubPmId(TEntrezId pmid, IPubmedUpdater*); + static CRef FetchPubPmId(TEntrezId pmid, CEUtilsUpdater*); static string GetErrorId(int code, int subcode); private: @@ -159,7 +159,7 @@ private: IMessageListener* m_err_log; CAuthListValidator m_authlist_validator; - IPubmedUpdater* m_upd; + CEUtilsUpdater* m_upd; }; END_SCOPE(edit) diff --git a/c++/include/objtools/edit/pubmed_updater.hpp b/c++/include/objtools/edit/pubmed_updater.hpp index 0f7e63a4..b29b689d 100644 --- a/c++/include/objtools/edit/pubmed_updater.hpp +++ b/c++/include/objtools/edit/pubmed_updater.hpp @@ -1,96 +1,2 @@ -/* $Id: pubmed_updater.hpp 672329 2023-09-05 18:18:20Z ivanov $ - * =========================================================================== - * - * PUBLIC DOMAIN NOTICE - * National Center for Biotechnology Information - * - * This software/database is a "United States Government Work" under the - * terms of the United States Copyright Act. It was written as part of - * the author's official duties as a United States Government employee and - * thus cannot be copyrighted. This software/database is freely available - * to the public for use. The National Library of Medicine and the U.S. - * Government have not placed any restriction on its use or reproduction. - * - * Although all reasonable efforts have been taken to ensure the accuracy - * and reliability of the software and data, the NLM and the U.S. - * Government do not and cannot warrant the performance or results that - * may be obtained by using this software or data. The NLM and the U.S. - * Government disclaim all warranties, express or implied, including - * warranties of performance, merchantability or fitness for any particular - * purpose. - * - * Please cite the author in any work or product based on this material. - * - * =========================================================================== - * - * Author: - * - * File Description: - * - * =========================================================================== - */ - -#ifndef _PUBMED_UPDATER_HPP_ -#define _PUBMED_UPDATER_HPP_ - -#include - -BEGIN_NCBI_SCOPE -BEGIN_SCOPE(objects) - -class CPub; - -BEGIN_SCOPE(edit) - -enum class EPubmedError { - ok, - not_found, - operational_error, - citation_not_found, - citation_ambiguous, - cannot_connect_pmdb, - cannot_connect_searchbackend_pmdb, -}; - -NCBI_XOBJEDIT_EXPORT -CNcbiOstream& operator<<(CNcbiOstream& os, EPubmedError err); - -struct NCBI_XOBJEDIT_EXPORT SCitMatch { - string Journal; - string Volume; - string Page; - string Year; - string Author; - string Issue; - string Title; - bool InPress = false; - bool Option1 = false; -}; - -using TPubInterceptor = std::function&)>; - -class NCBI_XOBJEDIT_EXPORT IPubmedUpdater -{ -public: - virtual ~IPubmedUpdater() {} - virtual bool Init() { return true; } - virtual void Fini() {} - virtual TEntrezId CitMatch(const CPub&, EPubmedError* = nullptr) = 0; - virtual TEntrezId CitMatch(const SCitMatch&, EPubmedError* = nullptr) = 0; - virtual CRef GetPub(TEntrezId pmid, EPubmedError* = nullptr) = 0; - - void SetPubInterceptor(TPubInterceptor f) - { - m_pub_interceptor = f; - } - static void Normalize(CPub&); - -protected: - TPubInterceptor m_pub_interceptor = nullptr; -}; - -END_SCOPE(edit) -END_SCOPE(objects) -END_NCBI_SCOPE - -#endif // _PUBMED_UPDATER_HPP_ +#pragma message(" is obsolete. Use instead!") +#include "eutils_updater.hpp" diff --git a/c++/include/objtools/edit/remote_updater.hpp b/c++/include/objtools/edit/remote_updater.hpp index 57791f40..2c0a73d1 100755 --- a/c++/include/objtools/edit/remote_updater.hpp +++ b/c++/include/objtools/edit/remote_updater.hpp @@ -1,44 +1,45 @@ -/* $Id: remote_updater.hpp 669945 2023-07-13 19:23:06Z ivanov $ -* =========================================================================== -* -* PUBLIC DOMAIN NOTICE -* National Center for Biotechnology Information -* -* This software/database is a "United States Government Work" under the -* terms of the United States Copyright Act. It was written as part of -* the author's official duties as a United States Government employee and -* thus cannot be copyrighted. This software/database is freely available -* to the public for use. The National Library of Medicine and the U.S. -* Government have not placed any restriction on its use or reproduction. -* -* Although all reasonable efforts have been taken to ensure the accuracy -* and reliability of the software and data, the NLM and the U.S. -* Government do not and cannot warrant the performance or results that -* may be obtained by using this software or data. The NLM and the U.S. -* Government disclaim all warranties, express or implied, including -* warranties of performance, merchantability or fitness for any particular -* purpose. -* -* Please cite the author in any work or product based on this material. -* -* =========================================================================== -* -* Authors: Sergiy Gotvyanskyy, NCBI -* Colleen Bolin, NCBI -* -* File Description: -* Front-end class for making remote request to MLA and taxon -* -* =========================================================================== -*/ +/* $Id: remote_updater.hpp 677028 2024-01-03 14:08:01Z ivanov $ + * =========================================================================== + * + * PUBLIC DOMAIN NOTICE + * National Center for Biotechnology Information + * + * This software/database is a "United States Government Work" under the + * terms of the United States Copyright Act. It was written as part of + * the author's official duties as a United States Government employee and + * thus cannot be copyrighted. This software/database is freely available + * to the public for use. The National Library of Medicine and the U.S. + * Government have not placed any restriction on its use or reproduction. + * + * Although all reasonable efforts have been taken to ensure the accuracy + * and reliability of the software and data, the NLM and the U.S. + * Government do not and cannot warrant the performance or results that + * may be obtained by using this software or data. The NLM and the U.S. + * Government disclaim all warranties, express or implied, including + * warranties of performance, merchantability or fitness for any particular + * purpose. + * + * Please cite the author in any work or product based on this material. + * + * =========================================================================== + * + * Authors: Sergiy Gotvyanskyy, NCBI + * Colleen Bolin, NCBI + * + * File Description: + * Front-end class for making remote request to MLA and taxon + * + * =========================================================================== + */ #ifndef __REMOTE_UPDATER_HPP_INCLUDED__ #define __REMOTE_UPDATER_HPP_INCLUDED__ #include #include +#include #include -#include +#include #include #include @@ -55,7 +56,6 @@ class CSeq_descr; class COrg_ref; class CAuth_list; class IObjtoolsListener; -class CPub; class CPubdesc; class CTaxon3_reply; @@ -63,9 +63,7 @@ BEGIN_SCOPE(edit) enum class EPubmedSource { - eNone, eEUtils, - eMLA, // deprecated; same as eEUtils }; class CCachedTaxon3_impl; @@ -99,19 +97,35 @@ public: // With this constructor, failure to retrieve // a publication for a PMID is logged with the supplied message listener. // If no message listener is supplied, an exception is thrown. - CRemoteUpdater(IObjtoolsListener* pMessageListener, EPubmedSource = EPubmedSource::eEUtils, bool bNormalize = false); - CRemoteUpdater(FLogger logger, EPubmedSource = EPubmedSource::eEUtils, bool bNormalize = false); + CRemoteUpdater(IObjtoolsListener* pMessageListener, CEUtilsUpdater::ENormalize = CEUtilsUpdater::ENormalize::Off); + // NCBI_DEPRECATED + CRemoteUpdater(FLogger logger, CEUtilsUpdater::ENormalize norm = CEUtilsUpdater::ENormalize::Off); + NCBI_DEPRECATED + CRemoteUpdater(IObjtoolsListener* pMessageListener, EPubmedSource, CEUtilsUpdater::ENormalize norm = CEUtilsUpdater::ENormalize::Off) : + CRemoteUpdater(pMessageListener, norm) + { + } + NCBI_DEPRECATED + CRemoteUpdater(FLogger logger, EPubmedSource, CEUtilsUpdater::ENormalize norm = CEUtilsUpdater::ENormalize::Off) : + CRemoteUpdater(logger, norm) + { + } ~CRemoteUpdater(); void UpdatePubReferences(CSerialObject& obj); void UpdatePubReferences(CSeq_entry_EditHandle& obj); void SetMaxMlaAttempts(int max); - CConstRef SendOrgRefList(const vector>& list); + // Specify flavor of updated CPub: CMedline_entry or CCit_art + void SetPubReturnType(CPub::E_Choice t) + { + if (t == CPub::e_Medline || t == CPub::e_Article) { + m_pm_pub_type = t; + } else { + throw std::invalid_argument("invalid CPub choice"); + } + } - // These methods are deprecated, please use CRemoteUpdater constructor to specify logger - NCBI_DEPRECATED void UpdateOrgFromTaxon(FLogger f_logger, CSeq_entry& entry); - NCBI_DEPRECATED void UpdateOrgFromTaxon(FLogger f_logger, CSeq_entry_EditHandle& obj); - NCBI_DEPRECATED void UpdateOrgFromTaxon(FLogger f_logger, CSeqdesc& obj); + CConstRef SendOrgRefList(const vector>& list); void UpdateOrgFromTaxon(CSeq_entry& entry); void UpdateOrgFromTaxon(CSeqdesc& desc); @@ -123,7 +137,7 @@ public: static void PostProcessPubs(CSeq_entry& obj); static void PostProcessPubs(CPubdesc& pubdesc); - void SetPubmedClient(IPubmedUpdater*); + void SetPubmedClient(CEUtilsUpdater*); // Use either shared singleton or individual instances NCBI_DEPRECATED static CRemoteUpdater& GetInstance(); void ReportStats(std::ostream& str); @@ -138,7 +152,7 @@ public: private: void xUpdatePubReferences(CSeq_entry& entry); void xUpdatePubReferences(CSeq_descr& descr); - void xUpdateOrgTaxname(COrg_ref& org, FLogger logger); + void xUpdateOrgTaxname(COrg_ref& org); bool xUpdatePubPMID(list>& pubs, TEntrezId id); bool xSetFromConfig(); void xInitTaxCache(); @@ -146,12 +160,12 @@ private: IObjtoolsListener* m_pMessageListener = nullptr; FLogger m_logger = nullptr; // wrapper for compatibility between IObjtoolsListener and old FLogger - EPubmedSource m_pm_source = EPubmedSource::eNone; string m_pm_url; - unique_ptr m_pubmed; + unique_ptr m_pubmed; bool m_pm_use_cache = true; - bool m_pm_normalize = false; + CEUtilsUpdater::ENormalize m_pm_normalize = CEUtilsUpdater::ENormalize::Off; TPubInterceptor m_pm_interceptor = nullptr; + CPub::E_Choice m_pm_pub_type = CPub::e_Article; unique_ptr m_taxClient; taxupdate_func_t m_taxon_update; diff --git a/c++/include/objtools/format/flat_file_config.hpp b/c++/include/objtools/format/flat_file_config.hpp index e3a16500..9affcb35 100644 --- a/c++/include/objtools/format/flat_file_config.hpp +++ b/c++/include/objtools/format/flat_file_config.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS_FORMAT___FLAT_FILE_CONFIG__HPP #define OBJTOOLS_FORMAT___FLAT_FILE_CONFIG__HPP -/* $Id: flat_file_config.hpp 665626 2023-04-10 15:10:28Z kans $ +/* $Id: flat_file_config.hpp 676886 2023-12-27 15:10:53Z sadyrovr $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -203,7 +203,8 @@ public: fShowDeflineModifiers = 1 << 17, fDoNotUseAutoDef = 1 << 18, fOldTpaDisplay = 1 << 19, - fDisableDefaultIndex = 1 << 20 + fDisableDefaultIndex = 1 << 20, + fGeoLocNameCountry = 1 << 21 }; enum EView { @@ -634,6 +635,7 @@ public: bool DoNotUseAutoDef (void) const; bool OldTpaDisplay (void) const; bool DisableDefaultIndex (void) const; + bool GeoLocNameCountry (void) const; // setters void SetCustom(const TCustom& custom) { m_Custom = custom; } @@ -656,6 +658,7 @@ public: CFlatFileConfig& SetDoNotUseAutoDef (bool val = true); CFlatFileConfig& SetOldTpaDisplay (bool val = true); CFlatFileConfig& SetDisableDefaultIndex (bool val = true); + CFlatFileConfig& SetGeoLocNameCountry (bool val = true); // adjust mode dependant flags for RefSeq void SetRefSeqConventions(void); @@ -863,6 +866,7 @@ CUSTOM_ARG_IMP(ShowDeflineModifiers) CUSTOM_ARG_IMP(DoNotUseAutoDef) CUSTOM_ARG_IMP(OldTpaDisplay) CUSTOM_ARG_IMP(DisableDefaultIndex) +CUSTOM_ARG_IMP(GeoLocNameCountry) #undef FLAG_ARG_IMP #undef FLAG_ARG_GET diff --git a/c++/include/objtools/format/items/source_item.hpp b/c++/include/objtools/format/items/source_item.hpp index 0617b289..b1249a3d 100644 --- a/c++/include/objtools/format/items/source_item.hpp +++ b/c++/include/objtools/format/items/source_item.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS_FORMAT_ITEMS___SOURCE_ITEM__HPP #define OBJTOOLS_FORMAT_ITEMS___SOURCE_ITEM__HPP -/* $Id: source_item.hpp 665891 2023-04-17 14:20:00Z gotvyans $ +/* $Id: source_item.hpp 675921 2023-12-05 13:47:36Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -78,7 +78,6 @@ public: EItem GetItemType() const override; private: void x_GatherInfo(CBioseqContext& ctx) override; - void x_GatherInfoIdx(CBioseqContext& ctx); void x_GatherInfo(CBioseqContext& ctx, const CBioSource& bsrc, const CSerialObject& obj); // Populate the object based on the source of the data diff --git a/c++/include/objtools/pubseq_gateway/client/impl/misc.hpp b/c++/include/objtools/pubseq_gateway/client/impl/misc.hpp index 88498d18..22206986 100644 --- a/c++/include/objtools/pubseq_gateway/client/impl/misc.hpp +++ b/c++/include/objtools/pubseq_gateway/client/impl/misc.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS__PUBSEQ_GATEWAY__CLIENT__IMPL__MISC__HPP #define OBJTOOLS__PUBSEQ_GATEWAY__CLIENT__IMPL__MISC__HPP -/* $Id: misc.hpp 672386 2023-09-06 18:53:41Z ivanov $ +/* $Id: misc.hpp 675367 2023-11-20 16:22:48Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -340,6 +340,9 @@ typedef NCBI_PARAM_TYPE(PSG, https) TPSG_Https; NCBI_PARAM_DECL(double, PSG, no_servers_retry_delay); typedef NCBI_PARAM_TYPE(PSG, no_servers_retry_delay) TPSG_NoServersRetryDelay; +NCBI_PARAM_DECL(string, PSG, service); +using TPSG_Service = NCBI_PARAM_TYPE(PSG, service); + NCBI_PARAM_DECL(string, PSG, auth_token_name); using TPSG_AuthTokenName = PSG_PARAM_VALUE_TYPE(PSG, auth_token_name); diff --git a/c++/include/objtools/pubseq_gateway/client/psg_client.hpp b/c++/include/objtools/pubseq_gateway/client/psg_client.hpp index 96e17ea3..6ac3e016 100644 --- a/c++/include/objtools/pubseq_gateway/client/psg_client.hpp +++ b/c++/include/objtools/pubseq_gateway/client/psg_client.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS__PUBSEQ_GATEWAY__PSG_CLIENT_HPP #define OBJTOOLS__PUBSEQ_GATEWAY__PSG_CLIENT_HPP -/* $Id: psg_client.hpp 666909 2023-05-03 21:33:24Z sadyrovr $ +/* $Id: psg_client.hpp 675367 2023-11-20 16:22:48Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -107,6 +107,14 @@ public: eIpgResolve, }; + enum EFlags { + fExcludeHUP = (0 << 0), + fIncludeHUP = (1 << 0), + eDefaultFlags = fExcludeHUP + }; + DECLARE_SAFE_FLAGS_TYPE(EFlags, TFlags); + using TOptionalFlags = CNullable; + /// Get the user-provided context template shared_ptr GetUserContext() const @@ -124,6 +132,9 @@ public: // Get request ID string GetId() const { return x_GetId(); } + /// Set flags + void SetFlags(TOptionalFlags flags) { m_Flags = move(flags); } + /// Set arbitrary URL arguments to add to this request. /// @code /// request->SetUserArgs("param1=value1¶m1=value2¶m2=value3"); @@ -149,6 +160,7 @@ private: shared_ptr m_UserContext; CRef m_RequestContext; + TOptionalFlags m_Flags; SPSG_UserArgs m_UserArgs; friend class CPSG_Queue; @@ -985,6 +997,7 @@ public: eCanceled, eTimeout, eError, + eUnauthorized, eUnknown, }; @@ -1121,6 +1134,7 @@ public: /// @param service /// Either a name of service (which can be resolved into a set of PSG /// servers) or a single fixed PSG server (in format "host:port") + /// or empty value to use one from configuration file/environment/default. CPSG_Queue(const string& service); ~CPSG_Queue(); @@ -1195,6 +1209,10 @@ public: bool RejectsRequests() const; + /// Set request flags + void SetRequestFlags(CPSG_Request::TFlags request_flags); + + /// Set arbitrary URL arguments to add to every request. /// @code /// queue.SetUserArgs("param1=value1¶m1=value2¶m2=value3"); @@ -1268,6 +1286,7 @@ public: /// @param service /// Either a name of service (which can be resolved into a set of PSG /// servers) or a single fixed PSG server (in format "host:port") + /// or empty value to use one from configuration file/environment/default. /// @param item_complete /// Mandatory user callback to call when an item is complete (i.e. not eInProgress) /// @param reply_complete @@ -1327,6 +1346,7 @@ inline bool CPSG_EventLoop::Run(CDeadline deadline) } +DECLARE_SAFE_FLAGS(CPSG_Request::EFlags); DECLARE_SAFE_FLAGS(CPSG_Request_Resolve::EIncludeInfo); END_NCBI_SCOPE diff --git a/c++/include/objtools/readers/agp_util.hpp b/c++/include/objtools/readers/agp_util.hpp index 15922649..8442f486 100644 --- a/c++/include/objtools/readers/agp_util.hpp +++ b/c++/include/objtools/readers/agp_util.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS_READERS___AGP_UTIL__HPP #define OBJTOOLS_READERS___AGP_UTIL__HPP -/* $Id: agp_util.hpp 670811 2023-08-01 15:20:36Z ivanov $ +/* $Id: agp_util.hpp 678441 2024-02-05 19:56:54Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -184,6 +184,7 @@ public: eGapShort_arm , eGapHeterochromatin, eGapTelomere , + eGapUnknown , eGapCount, eGapYes_count=eGapContamination+1 diff --git a/c++/include/objtools/readers/fasta.hpp b/c++/include/objtools/readers/fasta.hpp index d950e004..a10f0f86 100644 --- a/c++/include/objtools/readers/fasta.hpp +++ b/c++/include/objtools/readers/fasta.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS_READERS___FASTA__HPP #define OBJTOOLS_READERS___FASTA__HPP -/* $Id: fasta.hpp 673190 2023-09-25 14:08:51Z ivanov $ +/* $Id: fasta.hpp 680777 2024-03-27 13:52:05Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -505,11 +505,9 @@ TSeqPos CFastaReader::GetCurrentPos(EPosType pos_type) TSeqPos pos = m_CurrentPos; switch (pos_type) { case ePosWithGapsAndSegs: - pos += m_SegmentBase; - // FALL THROUGH!! + return pos + m_SegmentBase + m_TotalGapLength; case ePosWithGaps: - pos += m_TotalGapLength; - // FALL THROUGH!! + return pos + m_TotalGapLength; case eRawPos: return pos; default: diff --git a/c++/include/objtools/readers/fasta_exception.hpp b/c++/include/objtools/readers/fasta_exception.hpp index f465625a..44da7142 100644 --- a/c++/include/objtools/readers/fasta_exception.hpp +++ b/c++/include/objtools/readers/fasta_exception.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS_READERS___FASTA_EXCEPTION__HPP #define OBJTOOLS_READERS___FASTA_EXCEPTION__HPP -/* $Id: fasta_exception.hpp 671848 2023-08-24 20:01:29Z ivanov $ +/* $Id: fasta_exception.hpp 680775 2024-03-27 13:51:53Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -32,19 +32,29 @@ * Exceptions for CFastaReader. */ -#include -#include +#include +#include BEGIN_NCBI_SCOPE BEGIN_SCOPE(objects) -class CBadResiduesException : public CObjReaderException +class CSeq_id; + +class CBadResiduesException : public CException { public: enum EErrCode { - eBadResidues + eBadResidues, + eInvalid = -1 }; + EErrCode GetErrCode(void) const + { + return typeid(*this) == typeid(CBadResiduesException) ? + (EErrCode) this->x_GetErrCode() : + (EErrCode) CException::eInvalid; + } + virtual const char* GetErrCodeString(void) const override { switch (GetErrCode()) { @@ -85,27 +95,21 @@ public: TBadIndexMap m_BadIndexMap; }; - virtual void ReportExtra(ostream& out) const override; - - CBadResiduesException(const CDiagCompileInfo& info, + void ReportExtra(ostream& out) const override; + CBadResiduesException( + const CDiagCompileInfo &info, const CException* prev_exception, - EErrCode err_code, const string& message, + EErrCode err_code, + const string& message, const SBadResiduePositions& badResiduePositions, - EDiagSev /*severity*/ = eDiag_Error) THROWS_NONE - : CObjReaderException(info, prev_exception, - (CObjReaderException::EErrCode) err_code, - message), m_BadResiduePositions(badResiduePositions) + EDiagSev severity = eDiag_Error) + : CException(info, prev_exception, (CException::EErrCode) err_code, message, severity, 0), + m_BadResiduePositions(badResiduePositions) {} - virtual const CException* x_Clone(void) const override - { - return new CBadResiduesException(*this); - } - + CBadResiduesException() = delete; CBadResiduesException(const CBadResiduesException&) = default; - -public: // Returns the bad residues found, which might not be complete // if we bailed out early. const SBadResiduePositions& GetBadResiduePositions(void) const THROWS_NONE @@ -118,6 +122,12 @@ public: return m_BadResiduePositions.m_BadIndexMap.empty(); } +protected: + const CException* x_Clone(void) const override + { + return new CBadResiduesException(*this); + } + private: SBadResiduePositions m_BadResiduePositions; }; diff --git a/c++/include/objtools/readers/gtf_reader.hpp b/c++/include/objtools/readers/gtf_reader.hpp index 3123bafc..adf147f8 100644 --- a/c++/include/objtools/readers/gtf_reader.hpp +++ b/c++/include/objtools/readers/gtf_reader.hpp @@ -1,4 +1,4 @@ - /* $Id: gtf_reader.hpp 630386 2021-05-01 20:54:52Z stakhovv $ + /* $Id: gtf_reader.hpp 674645 2023-11-01 12:38:20Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -35,19 +35,26 @@ #include #include +#include +#include BEGIN_NCBI_SCOPE BEGIN_SCOPE(objects) // namespace ncbi::objects:: class CGtfLocationMerger; +class CGtfAttributes; + +CGtfAttributes g_GetIntersection(const CGtfAttributes& x, const CGtfAttributes& y); // ============================================================================ class CGtfAttributes // ============================================================================ { public: - using MultiValue = vector; + // using MultiValue = vector; + using MultiValue = set; + using MultiAttributes = map; const MultiAttributes& @@ -63,7 +70,7 @@ public: MultiValue values; GetValues(key, values); if (values.size() == 1) { - return values.front(); + return *(values.begin()); } return ""; } @@ -77,14 +84,15 @@ public: if (it == mAttributes.end()) { return false; } + if (value.empty()) { + return true; + } + const auto& values = it->second; if (values.empty()) { return false; } - if (value.empty()) { - return true; - } - return (find(values.begin(), values.end(), value) != values.end()); + return (values.find(value) != values.end()); }; void @@ -92,14 +100,15 @@ public: const string& key, MultiValue& values) const { - const MultiValue empty; - values = empty; - auto it = mAttributes.find(key); - if (it != mAttributes.end()) { + if (auto it = mAttributes.find(key); it != mAttributes.end()) { values = it->second; } + else { + values.clear(); + } }; + void AddValue( const string& key, @@ -107,18 +116,44 @@ public: { auto kit = mAttributes.find(key); if (kit == mAttributes.end()) { - kit = mAttributes.insert(make_pair(key, MultiValue())).first; - } - auto vit = find(kit->second.begin(), kit->second.end(), value); - if (vit == kit->second.end()) { - kit->second.push_back(value); + kit = mAttributes.emplace(key, MultiValue()).first; } + kit->second.insert(value); }; + void + Remove(const string& key) + { + auto it = mAttributes.find(key); + if (it == mAttributes.end()) { + return; + } + mAttributes.erase(it); + } + + void + RemoveValue(const string& key, const string& value) + { + auto it = mAttributes.find(key); + if (it == mAttributes.end()) { + return; + } + + auto& values = it->second; + if (auto vit = values.find(value); vit != values.end()) { + values.erase(vit); + if (values.empty()) { + mAttributes.erase(it); + } + } + } + + friend CGtfAttributes g_GetIntersection(const CGtfAttributes& x, const CGtfAttributes& y); protected: MultiAttributes mAttributes; }; + // ============================================================================ class CGtfReadRecord // ============================================================================ @@ -160,6 +195,11 @@ public: return GeneKey() + "_" + transcriptId; } + string TranscriptId() const + { + return mAttributes.ValueOf("transcript_id"); + } + protected: bool xAssignAttributesFromGff( const string&, @@ -216,6 +256,13 @@ protected: const CGtfReadRecord&, CSeq_annot&); +private: + bool xUpdateAnnotParent( + const CGtfReadRecord& record, + const string& parentType, + CSeq_annot& annot); + +protected: void xPostProcessAnnot( CSeq_annot&) override; @@ -240,6 +287,14 @@ protected: const CGtfReadRecord& record, CSeq_feat&); +private: + bool xFeatureSetQualifiers( + const CGtfReadRecord& record, + const set& ignoredAttrs, + CSeq_feat&); + +protected: + bool xCreateParentCds( const CGtfReadRecord&, CSeq_annot&); @@ -268,7 +323,28 @@ protected: bool xFeatureTrimQualifiers( const CGtfReadRecord&, CSeq_feat&); +private: + bool xFeatureTrimQualifiers( + const CGtfAttributes& attributes, + CSeq_feat&); + + bool xFeatureTrimQualifiers( + const CGtfAttributes& prevAttributes, + const CGtfAttributes& currentAttributes, + CSeq_feat&); + + + void xCheckForGeneIdConflict( + const CGtfReadRecord& record); + + void xPropagateQualToParent( + const CGtfReadRecord& record, + const string& qualName, + CSeq_feat& parent); + + +protected: CRef xFindFeatById( const string&); @@ -287,6 +363,13 @@ protected: CSeq_feat&) override; unique_ptr mpLocations; + +private: + using TChildQualMap = map; + using TParentChildQualMap = map; + + map m_TranscriptToGeneMap; + TParentChildQualMap m_ParentChildQualMap; }; END_SCOPE(objects) diff --git a/c++/include/objtools/readers/line_error.hpp b/c++/include/objtools/readers/line_error.hpp index fd8246fd..42da907f 100644 --- a/c++/include/objtools/readers/line_error.hpp +++ b/c++/include/objtools/readers/line_error.hpp @@ -1,4 +1,4 @@ -/* $Id: line_error.hpp 673184 2023-09-25 14:08:03Z ivanov $ +/* $Id: line_error.hpp 684363 2024-06-20 19:34:09Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -36,10 +36,9 @@ #include #include #include -//#include -#include +#include #include - +#include BEGIN_NCBI_SCOPE @@ -93,7 +92,7 @@ public: eProblem_InconsistentQualifiers, // qualifiers should match across features, but don't eProblem_DuplicateIDs, - //vcf specific + // vcf specific eProblem_BadInfoLine, eProblem_BadFormatLine, eProblem_BadFilterLine, @@ -108,258 +107,50 @@ public: /// This is here because the copy constructor may be protected /// eventually. - virtual ILineError *Clone(void) const { - /// throw instead of making it pure virtual for backward - /// compatibility. - NCBI_USER_THROW("not implemented: ILineError::Clone"); - } + virtual ILineError* Clone(void) const = 0; virtual ~ILineError(void) noexcept {} virtual EProblem Problem(void) const = 0; - virtual const std::string & - SeqId(void) const = 0; + virtual const string& SeqId(void) const = 0; - virtual unsigned int - Line(void) const =0; + virtual unsigned int Line(void) const = 0; typedef vector TVecOfLines; - virtual const TVecOfLines & - OtherLines(void) const = 0; - virtual const std::string & - FeatureName(void) const = 0; + virtual const TVecOfLines& OtherLines(void) const = 0; - virtual const std::string & - QualifierName(void) const = 0; + virtual const string& FeatureName(void) const = 0; - virtual const std::string & - QualifierValue(void) const = 0; + virtual const string& QualifierName(void) const = 0; + + virtual const string& QualifierValue(void) const = 0; // combines the other fields to print a reasonable error message - virtual std::string - Message(void) const - { - CNcbiOstrstream result; - result << "On SeqId '" << SeqId() << "', line " << Line() << ", severity " << SeverityStr() << ": '" - << ProblemStr() << "'"; - if( ! FeatureName().empty() ) { - result << ", with feature name '" << FeatureName() << "'"; - } - if( ! QualifierName().empty() ) { - result << ", with qualifier name '" << QualifierName() << "'"; - } - if( ! QualifierValue().empty() ) { - result << ", with qualifier value '" << QualifierValue() << "'"; - } - if( ! OtherLines().empty() ) { - result << ", with other possibly relevant line(s):"; - ITERATE( TVecOfLines, line_it, OtherLines() ) { - result << ' ' << *line_it; - } - } - return (string)CNcbiOstrstreamToString(result); - } + virtual string Message() const; + string SeverityStr() const; - std::string - SeverityStr(void) const - { - return CNcbiDiag::SeverityName(Severity()); - }; + virtual const string& ErrorMessage() const; - virtual const std::string& - ErrorMessage(void) const { - static string empty(""); - return empty; - } + virtual string ProblemStr() const; - virtual std::string - ProblemStr(void) const - { - return ProblemStr(Problem()); - } + static string ProblemStr(EProblem eProblem); - static - std::string - ProblemStr(EProblem eProblem) - { - switch(eProblem) { - case eProblem_Unset: - return "Unset"; - case eProblem_UnrecognizedFeatureName: - return "Unrecognized feature name"; - case eProblem_UnrecognizedQualifierName: - return "Unrecognized qualifier name"; - case eProblem_NumericQualifierValueHasExtraTrailingCharacters: - return "Numeric qualifier value has extra trailing characters after the number"; - case eProblem_NumericQualifierValueIsNotANumber: - return "Numeric qualifier value should be a number"; - case eProblem_FeatureNameNotAllowed: - return "Feature name not allowed"; - case eProblem_NoFeatureProvidedOnIntervals: - return "No feature provided on intervals"; - case eProblem_QualifierWithoutFeature: - return "No feature provided for qualifiers"; - case eProblem_FeatureBadStartAndOrStop: - return "Feature bad start and/or stop"; - case eProblem_GeneralParsingError: - return "General parsing error"; - case eProblem_BadFeatureInterval: - return "Bad feature interval"; - case eProblem_QualifierBadValue: - return "Qualifier had bad value"; - case eProblem_BadScoreValue: - return "Invalid score value"; - case eProblem_MissingContext: - return "Value ignored due to missing context"; - case eProblem_BadTrackLine: - return "Bad track line: Expected \"track key1=value1 key2=value2 ...\""; - case eProblem_InternalPartialsInFeatLocation: - return "Feature's location has internal partials"; - case eProblem_FeatMustBeInXrefdGene: - return "Feature has xref to a gene, but that gene does NOT contain the feature."; - case eProblem_CreatedGeneFromMultipleFeats: - return "Feature is trying to create a gene that conflicts with the gene created by another feature."; - case eProblem_UnrecognizedSquareBracketCommand: - return "Unrecognized square bracket command"; - case eProblem_TooLong: - return "Feature is too long"; - case eProblem_UnexpectedNucResidues: - return "Nucleotide residues unexpectedly found in feature"; - case eProblem_UnexpectedAminoAcids: - return "Amino acid residues unexpectedly found in feature"; - case eProblem_TooManyAmbiguousResidues: - return "Too many ambiguous residues"; - case eProblem_InvalidResidue: - return "Invalid residue(s)"; - case eProblem_ModifierFoundButNoneExpected: - return "Modifiers were found where none were expected"; - case eProblem_ExtraModifierFound: - return "Extraneous modifiers found"; - case eProblem_ExpectedModifierMissing: - return "Expected modifier missing"; - case eProblem_Missing: - return "Feature is missing"; - case eProblem_NonPositiveLength: - return "Feature's length must be greater than zero."; - case eProblem_ParsingModifiers: - return "Could not parse modifiers."; - case eProblem_ContradictoryModifiers: - return "Multiple different values for modifier"; - case eProblem_InvalidLengthAutoCorrected: - return "Feature had invalid length, but this was automatically corrected."; - case eProblem_IgnoredResidue: - return "An invalid residue has been ignored"; - case eProblem_InvalidQualifier: - return "Invalid qualifier for feature"; - - case eProblem_BadInfoLine: - return "Broken ##INFO line"; - case eProblem_BadFormatLine: - return "Broken ##FORMAT line"; - case eProblem_BadFilterLine: - return "Broken ##FILTER line"; - - case eProblem_ProgressInfo: - return "Just a progress info message (no error)"; - default: - return "Unknown problem"; - } - } - - virtual void Write( - CNcbiOstream& out ) const - { - - out << " " << SeverityStr() << ":" << endl; - out << "Problem: " << ProblemStr() << endl; - if (GetCode()) { - out << "Code: " << GetCode(); - if (GetSubCode()) { - out << "." << GetSubCode(); - } - out << endl; - } - const string & seqid = SeqId(); - if (!seqid.empty()) { - out << "SeqId: " << seqid << endl; - } - if (Line()) { - out << "Line: " << Line() << endl; - } - const string & feature = FeatureName(); - if (!feature.empty()) { - out << "FeatureName: " << feature << endl; - } - const string & qualname = QualifierName(); - if (!qualname.empty()) { - out << "QualifierName: " << qualname << endl; - } - const string & qualval = QualifierValue(); - if (!qualval.empty()) { - out << "QualifierValue: " << qualval << endl; - } - const TVecOfLines & vecOfLines = OtherLines(); - if( ! vecOfLines.empty() ) { - out << "OtherLines:"; - ITERATE(TVecOfLines, line_it, vecOfLines) { - out << ' ' << *line_it; - } - out << endl; - } - out << endl; - }; + virtual void Write(CNcbiOstream& out) const; // dump the XML on one line since some tools assume that - virtual void WriteAsXML( - CNcbiOstream& out ) const - { - out << ""; - - // child nodes - ITERATE(TVecOfLines, line_it, OtherLines()) { - out << "" << *line_it << ""; - } - - out << "" << endl; - }; + virtual void WriteAsXML(CNcbiOstream& out) const; // IMessage methods - default implementations or wrappers for ILineError // methods (for backward compatibility). - virtual string GetText(void) const { return Message(); } - virtual EDiagSev GetSeverity(void) const { return Severity(); } - virtual int GetCode(void) const { return 0; } - virtual int GetSubCode(void) const { return 0; } - virtual void Dump(CNcbiOstream& out) const { Write(out); } + virtual string GetText(void) const { return Message(); } + virtual EDiagSev GetSeverity(void) const { return Severity(); } + virtual int GetCode(void) const { return 0; } + virtual int GetSubCode(void) const { return 0; } + virtual void Dump(CNcbiOstream& out) const { Write(out); } virtual std::string Compose(void) const { return Message(); @@ -373,29 +164,28 @@ public: }; // ============================================================================ -class NCBI_XOBJUTIL_EXPORT CLineError: -// ============================================================================ +class NCBI_XOBJUTIL_EXPORT CLineError : + // ============================================================================ public ILineError { public: - /// Use this because the constructor is protected. /// /// @returns /// Caller is responsible for the return value. static CLineError* Create( - EProblem eProblem, - EDiagSev eSeverity, + EProblem eProblem, + EDiagSev eSeverity, const std::string& strSeqId, - unsigned int uLine, - const std::string & strFeatureName = string(""), - const std::string & strQualifierName = string(""), - const std::string & strQualifierValue = string(""), - const std::string & strErrorMessage = string(""), - const TVecOfLines & vecOfOtherLines = TVecOfLines() ); + unsigned int uLine, + const std::string& strFeatureName = string(""), + const std::string& strQualifierName = string(""), + const std::string& strQualifierValue = string(""), + const std::string& strErrorMessage = string(""), + const TVecOfLines& vecOfOtherLines = TVecOfLines()); /// Use this because copy ctor is protected. - virtual ILineError *Clone(void) const; + virtual ILineError* Clone(void) const; virtual ~CLineError(void) noexcept {} @@ -407,13 +197,15 @@ public: unsigned int uLine) { m_uLine = uLine; }; void PatchErrorMessage( - const string& errorMessage) { + const string& errorMessage) + { m_strErrorMessage = errorMessage; }; // "OtherLines" not set in ctor because it's // use should be somewhat rare - void AddOtherLine(unsigned int uOtherLine) { + void AddOtherLine(unsigned int uOtherLine) + { m_vecOfOtherLines.push_back(uOtherLine); } @@ -423,91 +215,89 @@ public: virtual EDiagSev Severity(void) const { return m_eSeverity; } - const std::string & + const std::string& SeqId(void) const { return m_strSeqId; } unsigned int Line(void) const { return m_uLine; } - const TVecOfLines & + const TVecOfLines& OtherLines(void) const { return m_vecOfOtherLines; } - const std::string & + const std::string& FeatureName(void) const { return m_strFeatureName; } - const std::string & + const std::string& QualifierName(void) const { return m_strQualifierName; } - const std::string & + const std::string& QualifierValue(void) const { return m_strQualifierValue; } virtual std::string ProblemStr(void) const { - if (const auto& msg = ErrorMessage(); !msg.empty()) { + if (const auto& msg = ErrorMessage(); ! msg.empty()) { return msg; } return ILineError::ProblemStr(Problem()); } - const std::string &ErrorMessage(void) const { return m_strErrorMessage; } + const std::string& ErrorMessage(void) const { return m_strErrorMessage; } protected: - - EProblem m_eProblem; - EDiagSev m_eSeverity; - std::string m_strSeqId; + EProblem m_eProblem; + EDiagSev m_eSeverity; + std::string m_strSeqId; unsigned int m_uLine; - std::string m_strFeatureName; - std::string m_strQualifierName; - std::string m_strQualifierValue; - std::string m_strErrorMessage; - TVecOfLines m_vecOfOtherLines; + std::string m_strFeatureName; + std::string m_strQualifierName; + std::string m_strQualifierValue; + std::string m_strErrorMessage; + TVecOfLines m_vecOfOtherLines; /// protected instead of public. Please use the Create function instead. CLineError( - EProblem eProblem, - EDiagSev eSeverity, + EProblem eProblem, + EDiagSev eSeverity, const std::string& strSeqId, - unsigned int uLine, - const std::string & strFeatureName, - const std::string & strQualifierName, - const std::string & strQualifierValue, - const std::string & strErrorMessage, - const TVecOfLines & m_vecOfOtherLine); + unsigned int uLine, + const std::string& strFeatureName, + const std::string& strQualifierName, + const std::string& strQualifierValue, + const std::string& strErrorMessage, + const TVecOfLines& m_vecOfOtherLine); /// protected instead of public. Please use the Throw function to throw /// this exception and try to avoid using the copy constructor at all. - CLineError(const CLineError & rhs ); + CLineError(const CLineError& rhs); }; // ============================================================================ -class NCBI_XOBJUTIL_EXPORT CLineErrorEx: -// ============================================================================ +class NCBI_XOBJUTIL_EXPORT CLineErrorEx : + // ============================================================================ public ILineError { public: - /// Use this because the constructor is protected. /// /// @returns /// Caller is responsible for the return value. static CLineErrorEx* Create( - EProblem eProblem, - EDiagSev eSeverity, - int code, - int subcode, + EProblem eProblem, + EDiagSev eSeverity, + int code, + int subcode, const std::string& strSeqId, - unsigned int uLine, - const std::string & strErrorMessage = string(""), - const std::string & strFeatureName = string(""), - const std::string & strQualifierName = string(""), - const std::string & strQualifierValue = string(""), - const TVecOfLines & vecOfOtherLines = TVecOfLines() ); + unsigned int uLine, + const std::string& strErrorMessage = string(""), + const std::string& strFeatureName = string(""), + const std::string& strQualifierName = string(""), + const std::string& strQualifierValue = string(""), + const TVecOfLines& vecOfOtherLines = TVecOfLines()); /// Use this because copy ctor is protected. - virtual ILineError *Clone(void) const override; + virtual ILineError* Clone(void) const override; virtual ~CLineErrorEx(void) {} @@ -520,7 +310,8 @@ public: // "OtherLines" not set in ctor because it's // use should be somewhat rare - void AddOtherLine(unsigned int uOtherLine) { + void AddOtherLine(unsigned int uOtherLine) + { m_vecOfOtherLines.push_back(uOtherLine); } @@ -530,90 +321,86 @@ public: virtual EDiagSev Severity(void) const override { return m_eSeverity; } - const std::string & + const std::string& SeqId(void) const override { return m_strSeqId; } unsigned int Line(void) const override { return m_uLine; } - const TVecOfLines & + const TVecOfLines& OtherLines(void) const override { return m_vecOfOtherLines; } - const std::string & + const std::string& FeatureName(void) const override { return m_strFeatureName; } - const std::string & + const std::string& QualifierName(void) const override { return m_strQualifierName; } - const std::string & + const std::string& QualifierValue(void) const override { return m_strQualifierValue; } virtual std::string ProblemStr(void) const override { - if (m_eProblem == ILineError::eProblem_GeneralParsingError && - !ErrorMessage().empty()) { + if (m_eProblem == ILineError::eProblem_GeneralParsingError && + ! ErrorMessage().empty()) { return ErrorMessage(); } return ILineError::ProblemStr(Problem()); } - const std::string &ErrorMessage(void) const override { return m_strErrorMessage; } + const std::string& ErrorMessage(void) const override { return m_strErrorMessage; } virtual string Message(void) const override { - return (m_strErrorMessage.empty() ? - ILineError::Message() : - m_strErrorMessage); + return (m_strErrorMessage.empty() ? ILineError::Message() : m_strErrorMessage); } virtual int GetCode(void) const override { return m_Code; }; virtual int GetSubCode(void) const override { return m_Subcode; } protected: - - EProblem m_eProblem; - EDiagSev m_eSeverity; - int m_Code; - int m_Subcode; - std::string m_strSeqId; + EProblem m_eProblem; + EDiagSev m_eSeverity; + int m_Code; + int m_Subcode; + std::string m_strSeqId; unsigned int m_uLine; - std::string m_strFeatureName; - std::string m_strQualifierName; - std::string m_strQualifierValue; - std::string m_strErrorMessage; - TVecOfLines m_vecOfOtherLines; + std::string m_strFeatureName; + std::string m_strQualifierName; + std::string m_strQualifierValue; + std::string m_strErrorMessage; + TVecOfLines m_vecOfOtherLines; /// protected instead of public. Please use the Create function instead. CLineErrorEx( - EProblem eProblem, - EDiagSev eSeverity, - int code, - int subcode, + EProblem eProblem, + EDiagSev eSeverity, + int code, + int subcode, const std::string& strSeqId, - unsigned int uLine, - const std::string & strErrorMessage, - const std::string & strFeatureName, - const std::string & strQualifierName, - const std::string & strQualifierValue, - const TVecOfLines & m_vecOfOtherLine); + unsigned int uLine, + const std::string& strErrorMessage, + const std::string& strFeatureName, + const std::string& strQualifierName, + const std::string& strQualifierValue, + const TVecOfLines& m_vecOfOtherLine); /// protected instead of public. Please use the Throw function to throw /// this exception and try to avoid using the copy constructor at all. - CLineErrorEx(const CLineErrorEx & rhs); + CLineErrorEx(const CLineErrorEx& rhs); }; - // ============================================================================ class NCBI_XOBJUTIL_EXPORT CObjReaderLineException -// ============================================================================ + // ============================================================================ // must inherit from ILineError first due to the way CObject detects // whether or not it's on the heap. - : public ILineError, public CObjReaderParseException + : public ILineError, + public CObjReaderParseException { public: - using CObjReaderParseException::EErrCode; /// Please use this instead of the constructor because the ctor @@ -622,46 +409,45 @@ public: /// @returns /// Caller is responsible for the return value. static CObjReaderLineException* Create( - EDiagSev eSeverity, - unsigned int uLine, - const std::string &strMessage, - EProblem eProblem = eProblem_GeneralParsingError, - const std::string& strSeqId = string(""), - const std::string & strFeatureName = string(""), - const std::string & strQualifierName = string(""), - const std::string & strQualifierValue = string(""), - CObjReaderLineException::EErrCode eErrCode = eFormat, - const TVecOfLines & vecOfOtherLines = TVecOfLines() - ); - - /// Use instead of copy constructor, which is protected. - virtual ILineError *Clone(void) const; - - // Copy constructor is protected, so please use + EDiagSev eSeverity, + unsigned int uLine, + const std::string& strMessage, + EProblem eProblem = eProblem_GeneralParsingError, + const std::string& strSeqId = string(""), + const std::string& strFeatureName = string(""), + const std::string& strQualifierName = string(""), + const std::string& strQualifierValue = string(""), + CObjReaderLineException::EErrCode eErrCode = eFormat, + const TVecOfLines& vecOfOtherLines = TVecOfLines()); + + /// Use instead of copy constructor, which is private. + virtual ILineError* Clone(void) const; + + // Copy constructor is private, so please use /// this function to throw this object. NCBI_NORETURN void Throw(void) const; - ~CObjReaderLineException(void) noexcept { } + ~CObjReaderLineException(void) noexcept {} TErrCode GetErrCode(void) const { - return (TErrCode) this->x_GetErrCode(); + return (TErrCode)this->x_GetErrCode(); } - EProblem Problem(void) const { return m_eProblem; } - const std::string &SeqId(void) const { return m_strSeqId; } - EDiagSev Severity(void) const { return CObjReaderParseException::GetSeverity(); } - unsigned int Line(void) const { return m_uLineNumber; } - const TVecOfLines & OtherLines(void) const { return m_vecOfOtherLines; } - const std::string &FeatureName(void) const { return m_strFeatureName; } - const std::string &QualifierName(void) const { return m_strQualifierName; } - const std::string &QualifierValue(void) const { return m_strQualifierValue; } + EProblem Problem(void) const { return m_eProblem; } + const std::string& SeqId(void) const { return m_strSeqId; } + EDiagSev Severity(void) const { return CObjReaderParseException::GetSeverity(); } + unsigned int Line(void) const { return m_uLineNumber; } + const TVecOfLines& OtherLines(void) const { return m_vecOfOtherLines; } + const std::string& FeatureName(void) const { return m_strFeatureName; } + const std::string& QualifierName(void) const { return m_strQualifierName; } + const std::string& QualifierValue(void) const { return m_strQualifierValue; } - const std::string &ErrorMessage(void) const { return m_strErrorMessage; } + const std::string& ErrorMessage(void) const { return m_strErrorMessage; } std::string ProblemStr() const; - std::string Message() const { return ( GetMsg().empty() ? ILineError::Message() : GetMsg()); } + std::string Message() const { return (GetMsg().empty() ? ILineError::Message() : GetMsg()); } // // Cludge alert: The line number may not be known at the time the exception @@ -670,41 +456,45 @@ public: // void SetLineNumber( - unsigned int uLineNumber ) { m_uLineNumber = uLineNumber; } + unsigned int uLineNumber) { m_uLineNumber = uLineNumber; } // "OtherLines" not set in ctor because it's // use should be somewhat rare - void AddOtherLine(unsigned int uOtherLine) { + void AddOtherLine(unsigned int uOtherLine) + { m_vecOfOtherLines.push_back(uOtherLine); } -protected: + void SetObject(CRef pObject); - EProblem m_eProblem; - std::string m_strSeqId; - unsigned int m_uLineNumber; - std::string m_strFeatureName; - std::string m_strQualifierName; - std::string m_strQualifierValue; - std::string m_strErrorMessage; - TVecOfLines m_vecOfOtherLines; + CConstRef GetObject() const; - /// protected instead of public. Please use the Create function instead. +private: + EProblem m_eProblem; + std::string m_strSeqId; + unsigned int m_uLineNumber; + std::string m_strFeatureName; + std::string m_strQualifierName; + std::string m_strQualifierValue; + std::string m_strErrorMessage; + TVecOfLines m_vecOfOtherLines; + CRef m_pObject; + + /// private instead of public. Please use the Create function instead. CObjReaderLineException( - EDiagSev eSeverity, - unsigned int uLine, - const std::string &strMessage, - EProblem eProblem = eProblem_GeneralParsingError, - const std::string& strSeqId = string(""), - const std::string & strFeatureName = string(""), - const std::string & strQualifierName = string(""), - const std::string & strQualifierValue = string(""), - CObjReaderLineException::EErrCode eErrCode = eFormat, - const TVecOfLines & vecOfOtherLines = TVecOfLines() - ); - - /// Protected, so use Clone or Throw instead. - CObjReaderLineException(const CObjReaderLineException & rhs ); + EDiagSev eSeverity, + unsigned int uLine, + const std::string& strMessage, + EProblem eProblem = eProblem_GeneralParsingError, + const std::string& strSeqId = string(""), + const std::string& strFeatureName = string(""), + const std::string& strQualifierName = string(""), + const std::string& strQualifierValue = string(""), + CObjReaderLineException::EErrCode eErrCode = eFormat, + const TVecOfLines& vecOfOtherLines = TVecOfLines()); + + /// Private, so use Clone or Throw instead. + CObjReaderLineException(const CObjReaderLineException& rhs); }; diff --git a/c++/include/objtools/readers/message_listener.hpp b/c++/include/objtools/readers/message_listener.hpp index 5759af46..9a62b9e5 100644 --- a/c++/include/objtools/readers/message_listener.hpp +++ b/c++/include/objtools/readers/message_listener.hpp @@ -1,4 +1,4 @@ -/* $Id: message_listener.hpp 669180 2023-06-22 16:27:32Z ivanov $ +/* $Id: message_listener.hpp 684363 2024-06-20 19:34:09Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -45,7 +45,6 @@ BEGIN_SCOPE(objects) // namespace ncbi::objects:: // ============================================================================ class ILineErrorListener : public CObject, public IObjtoolsListener -// ============================================================================ { public: ~ILineErrorListener() override {} @@ -56,7 +55,8 @@ public: /// virtual bool PutError(const ILineError&) = 0; - bool PutMessage(const IObjtoolsMessage& message) override { + bool PutMessage(const IObjtoolsMessage& message) override + { const ILineError* le = dynamic_cast(&message); if (! le) return true; @@ -103,21 +103,12 @@ public: }; -// Compatibility declaration, avoid using objects::IMessageListener - -// use ncbi::IMessageListener or objects::ILineErrorListener instead. -class IMessageListener : public ILineErrorListener -{ -public: - ~IMessageListener() override {} -}; - - -// ============================================================================ -class NCBI_XOBJREAD_EXPORT CMessageListenerBase : public objects::IMessageListener // ============================================================================ +class NCBI_XOBJREAD_EXPORT CMessageListenerBase : public ILineErrorListener { public: - CMessageListenerBase() : m_pProgressOstrm(nullptr) {} + CMessageListenerBase() : + m_pProgressOstrm(nullptr) {} ~CMessageListenerBase() override {} public: @@ -201,9 +192,9 @@ private: // private so later we can change the structure if // necessary (e.g. to have indexing and such to speed up // level-counting) - // typedef std::vector< AutoPtr > TLineErrVec; + // typedef std::vector< unique_ptr > TLineErrVec; - using TLineErrVec = vector>; + using TLineErrVec = vector>; TLineErrVec m_Errors; @@ -213,7 +204,7 @@ private: // do not read this pointer. It's just used to make // sure m_pProgressOstrm is destroyed if we own it. - AutoPtr m_progressOstrmDestroyer; + unique_ptr m_progressOstrmDestroyer; protected: // Child classes should use this to store errors @@ -225,16 +216,13 @@ protected: void StoreMessage(const IObjtoolsMessage& message) { - m_Errors.emplace_back(dynamic_cast(message.Clone())); + m_Errors.emplace_back(message.Clone()); } }; // ============================================================================ -class CMessageListenerLenient : -// // Accept everything. -// ============================================================================ - public CMessageListenerBase +class CMessageListenerLenient : public CMessageListenerBase { public: CMessageListenerLenient() {} @@ -253,11 +241,8 @@ public: }; // ============================================================================ -class CMessageListenerStrict : -// // Don't accept any errors, at all. -// ============================================================================ - public CMessageListenerBase +class CMessageListenerStrict : public CMessageListenerBase { public: CMessageListenerStrict() {} @@ -276,11 +261,8 @@ public: }; // =========================================================================== -class CMessageListenerCount : -// // Accept up to <> errors, any level. -// =========================================================================== - public CMessageListenerBase +class CMessageListenerCount : public CMessageListenerBase { public: CMessageListenerCount( @@ -304,11 +286,8 @@ protected: }; // =========================================================================== -class CMessageListenerLevel : -// // Accept evrything up to a certain level. -// =========================================================================== - public CMessageListenerBase +class CMessageListenerLevel : public CMessageListenerBase { public: CMessageListenerLevel(int iLevel) : @@ -331,11 +310,8 @@ protected: }; // =========================================================================== -class CMessageListenerWithLog : -// // Accept everything, and besides storing all errors, post them. -// =========================================================================== - public CMessageListenerBase +class CMessageListenerWithLog : public CMessageListenerBase { public: CMessageListenerWithLog(const CDiagCompileInfo& info) : @@ -357,14 +333,13 @@ private: // =========================================================================== -class NCBI_XOBJREAD_EXPORT CGPipeMessageListener : -// =========================================================================== - public CMessageListenerBase +class NCBI_XOBJREAD_EXPORT CGPipeMessageListener : public CMessageListenerBase { public: - CGPipeMessageListener(bool ignoreBadModValue=false); + CGPipeMessageListener(bool ignoreBadModValue = false); bool PutError(const ILineError& err) override final; + private: bool m_IgnoreBadModValue; }; diff --git a/c++/include/objtools/readers/readfeat.hpp b/c++/include/objtools/readers/readfeat.hpp index a2e1a4fa..5d8fa342 100644 --- a/c++/include/objtools/readers/readfeat.hpp +++ b/c++/include/objtools/readers/readfeat.hpp @@ -74,7 +74,8 @@ public: fLeaveProteinIds = (1<<7), ///< = 0x80 (Leave all protein_id as a qualifiers) fAllIdsAsLocal = (1<<8), ///< = 0x100 (Do not attempt to parse accessions) fPreferGenbankId = (1<<9), ///< = 0x200 (Prefer Genbank accession ids) - fSuppressBadKeyWarning = (1<<10), ///<= 0x400 (Suppress 'bad key' errors; Not recommended.) + fSuppressBadKeyWarning = (1<<10), ///< = 0x400 (Suppress 'bad key' errors; Not recommended.) + fIncludeObjectInMsg = (1<<11), ///< = 0x800 (Include reference to feature object in message). }; using TFlags = long; ///< binary OR of EFlags static void AddStringFlags( diff --git a/c++/include/sra/data_loaders/bam/impl/bamloader_impl.hpp b/c++/include/sra/data_loaders/bam/impl/bamloader_impl.hpp index f3667037..74671df3 100644 --- a/c++/include/sra/data_loaders/bam/impl/bamloader_impl.hpp +++ b/c++/include/sra/data_loaders/bam/impl/bamloader_impl.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS_DATA_LOADERS_BAM___BAMLOADER_IMPL__HPP #define OBJTOOLS_DATA_LOADERS_BAM___BAMLOADER_IMPL__HPP -/* $Id: bamloader_impl.hpp 646084 2022-03-01 20:02:52Z vasilche $ +/* $Id: bamloader_impl.hpp 674300 2023-10-23 19:56:38Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -68,7 +68,7 @@ class CBamRefSeqChunkInfo { public: CBamRefSeqChunkInfo(void) - : m_AlignCount(0), m_MaxRefSeqFrom(0) + : m_AlignCount(0), m_DataSize(0), m_MaxRefSeqFrom(0) { } @@ -115,6 +115,7 @@ protected: friend class CBamRefSeqInfo; Uint8 m_AlignCount; // 0 - graph only + Uint8 m_DataSize; TRange m_RefSeqRange; TSeqPos m_MaxRefSeqFrom; }; diff --git a/c++/include/util/bitset/bm.h b/c++/include/util/bitset/bm.h index 4a24b82d..547b1085 100644 --- a/c++/include/util/bitset/bm.h +++ b/c++/include/util/bitset/bm.h @@ -4247,6 +4247,9 @@ void bvector::import(const size_type* ids, size_type size_in, { BM_ASSERT(!is_ro()); + if (!size_in) + return; + size_type n, start(0), stop(size_in); block_idx_type nblock; @@ -4263,6 +4266,10 @@ void bvector::import(const size_type* ids, size_type size_in, import_block(ids, nblock, 0, stop); return; } + // multi-block import, do top block space reservation + unsigned i, j; + bm::get_block_coord(nblock_end, i, j); + blockman_.reserve_top_blocks(i+1); } break; default: @@ -4380,8 +4387,16 @@ void bvector::import_block(const size_type* ids, #else bm::set_block_bits_u32(blk, ids, start, stop); #endif + if (new_blocks_strat_ == BM_GAP) // optimization required + { + BM_DECLARE_TEMP_BLOCK(temp_blk); + unsigned i0, j0; + bm::get_block_coord(nblock, i0, j0); + blockman_.optimize_block(i0, j0, blk, temp_blk, opt_compress, 0); + } + if (nblock == bm::set_total_blocks-1) - blk[bm::set_block_size-1] &= ~(1u<<31); + blk[bm::set_block_size-1] &= ~(1u<<31); // clear the "impossible" last just in case } } diff --git a/c++/include/util/bitset/bmblocks.h b/c++/include/util/bitset/bmblocks.h index c1e338df..efa2c446 100644 --- a/c++/include/util/bitset/bmblocks.h +++ b/c++/include/util/bitset/bmblocks.h @@ -1423,22 +1423,48 @@ public: unsigned threashold = this->glen(bm::gap_max_level)-4; if (gap_count < threashold) // compressable - { - unsigned len; - bm::gap_word_t tmp_gap_buf[bm::gap_equiv_len * 2]; - - len = bm::bit_to_gap(tmp_gap_buf, block, threashold); - BM_ASSERT(len); - int level = bm::gap_calc_level(len, this->glen()); - BM_ASSERT(level >= 0); - bm::gap_word_t* gap_blk = - allocate_gap_block(unsigned(level), tmp_gap_buf); - top_blocks_[i][j] = (bm::word_t*)BMPTR_SETBIT0(gap_blk); - return_tempblock(block); - } + optimize_gap_convert_bit_block(i, j, block, threashold); } } + /** + Full Optimize bit-block at i-j position (no checks) + */ + void optimize_bit_block_nocheck(unsigned i, unsigned j) + { + bm::word_t* block = get_block_ptr(i, j); + + BM_ASSERT(IS_VALID_ADDR(block)); + BM_ASSERT(!BM_IS_GAP(block)); + + unsigned gap_count = bm::bit_block_calc_change(block); + if (gap_count == 1) // solid block + { + top_blocks_[i][j] = (*block) ? FULL_BLOCK_FAKE_ADDR : 0; + return_tempblock(block); + return; + } + unsigned threashold = this->glen(bm::gap_max_level)-4; + if (gap_count < threashold) // compressable + optimize_gap_convert_bit_block(i, j, block, threashold); + } + + void optimize_gap_convert_bit_block(unsigned i, unsigned j, + bm::word_t* block, + unsigned threashold) + { + unsigned len; + bm::gap_word_t tmp_gap_buf[bm::gap_equiv_len * 2]; + + len = bm::bit_to_gap(tmp_gap_buf, block, threashold); + BM_ASSERT(len); + int level = bm::gap_calc_level(len, this->glen()); + BM_ASSERT(level >= 0); + bm::gap_word_t* gap_blk = + allocate_gap_block(unsigned(level), tmp_gap_buf); + top_blocks_[i][j] = (bm::word_t*)BMPTR_SETBIT0(gap_blk); + return_tempblock(block); + } /** @@ -1932,6 +1958,32 @@ public: top_block_size_ = top_blocks; return top_block_size_; } + + /** + \brief shrink unused top blocks array (via reallocation) + */ + void shrink_top_blocks() + { + if (!top_blocks_) + return; + unsigned tb_cnt = top_block_size() - 1; + for ( ; tb_cnt; --tb_cnt) + { + if (top_blocks_[tb_cnt]) + break; + } // for + if (++tb_cnt < top_block_size_) // shrink is possible + { + BM_ASSERT(tb_cnt <= top_block_size_); + bm::word_t*** new_blocks = + (bm::word_t***)alloc_.alloc_ptr(tb_cnt); + ::memcpy(&new_blocks[0], &top_blocks_[0], + tb_cnt * sizeof(top_blocks_[0])); + alloc_.free_ptr(top_blocks_, top_block_size_); + top_blocks_ = new_blocks; + top_block_size_ = tb_cnt; + } + } /** \brief Returns reference on the allocator */ diff --git a/c++/include/util/bitset/bmbmatrix.h b/c++/include/util/bitset/bmbmatrix.h index 97f2d811..60ab7adf 100644 --- a/c++/include/util/bitset/bmbmatrix.h +++ b/c++/include/util/bitset/bmbmatrix.h @@ -71,6 +71,7 @@ public: ///@{ basic_bmatrix(size_type rsize, + bool is_dynamic = true, allocation_policy_type ap = allocation_policy_type(), size_type bv_max_size = bm::id_max, const allocator_type& alloc = allocator_type()); @@ -305,6 +306,14 @@ public: */ void bit_and_rows(const bvector_type& bv); + /// Return if matrix is dynamic resizable + bool is_dynamic() const BMNOEXCEPT { return is_dynamic_; } + + + /// Debugging function to check if two matrixes have the same rows created + /// @return true - if the same + /// + bool is_same_structure(const basic_bmatrix& bbm) const BMNOEXCEPT; ///@} @@ -323,11 +332,12 @@ protected: size_type bv_size_; allocator_type alloc_; allocation_policy_type ap_; - allocator_pool_type* pool_; + allocator_pool_type* pool_ = 0; - bvector_type_ptr* bv_rows_; - size_type rsize_; - size_type null_idx_; ///< Index of the NULL row + bvector_type_ptr* bv_rows_ = 0; + size_type rsize_ = 0; + bool is_dynamic_ = true; ///< if rsize is dynamic (variable length) + size_type null_idx_ = 0; ///< Index of the NULL row }; /** @@ -369,6 +379,7 @@ public: base_sparse_vector(); base_sparse_vector(bm::null_support null_able, + bool is_dynamic, allocation_policy_type ap = allocation_policy_type(), size_type bv_max_size = bm::id_max, const allocator_type& alloc = allocator_type()); @@ -705,18 +716,16 @@ protected: template basic_bmatrix::basic_bmatrix(size_type rsize, + bool is_dynamic, allocation_policy_type ap, size_type bv_max_size, const allocator_type& alloc) : bv_size_(bv_max_size), alloc_(alloc), - ap_(ap), - pool_(0), - bv_rows_(0), - rsize_(0), - null_idx_(0) + ap_(ap) { allocate_rows(rsize); + is_dynamic_ = is_dynamic; } //--------------------------------------------------------------------- @@ -733,13 +742,10 @@ template basic_bmatrix::basic_bmatrix(const basic_bmatrix& bbm) : bv_size_(bbm.bv_size_), alloc_(bbm.alloc_), - ap_(bbm.ap_), - pool_(0), - bv_rows_(0), - rsize_(0), - null_idx_(0) + ap_(bbm.ap_) { copy_from(bbm); + is_dynamic_ = bbm.is_dynamic_; } //--------------------------------------------------------------------- @@ -748,13 +754,10 @@ template basic_bmatrix::basic_bmatrix(basic_bmatrix&& bbm) BMNOEXCEPT : bv_size_(bbm.bv_size_), alloc_(bbm.alloc_), - ap_(bbm.ap_), - pool_(0), - bv_rows_(0), - rsize_(0), - null_idx_(0) + ap_(bbm.ap_) { swap(bbm); + is_dynamic_ = bbm.is_dynamic_; } //--------------------------------------------------------------------- @@ -898,6 +901,7 @@ void basic_bmatrix::allocate_rows(size_type rsize) bv_rows_[rsize-1] = bv_rows_[null_idx_]; bv_rows_[null_idx_] = 0; null_idx_ = rsize-1; + BM_ASSERT(rsize & 1u); } } } @@ -933,6 +937,30 @@ void basic_bmatrix::free_rows() BMNOEXCEPT //--------------------------------------------------------------------- +template +bool basic_bmatrix::is_same_structure( + const basic_bmatrix& bbm) const BMNOEXCEPT +{ + BM_ASSERT(this != &bbm); + + if (rsize_ != bbm.rsize_) + return false; + if (null_idx_ != bbm.null_idx_) + return false; + for (size_type i = 0; i < rsize_; ++i) + { + const bvector_type* bv = bv_rows_[i]; + const bvector_type* bv_arg = bbm.bv_rows_[i]; + if (bool(bv) != bool(bv_arg)) + return false; + } // for i + + + return true; +} + +//--------------------------------------------------------------------- + template void basic_bmatrix::set_allocator_pool(allocator_pool_type* pool_ptr) BMNOEXCEPT { @@ -1026,8 +1054,11 @@ template typename basic_bmatrix::bvector_type_ptr basic_bmatrix::construct_row(size_type row) { - if (row >= rsize_) - allocate_rows(row + 8); + if (is_dynamic()) + { + if (row >= rsize_) + allocate_rows(rsize_ + 8); + } BM_ASSERT(row < rsize_); bvector_type_ptr bv = bv_rows_[row]; if (!bv) @@ -1592,7 +1623,7 @@ void basic_bmatrix::optimize_block(block_idx_type nb, template base_sparse_vector::base_sparse_vector() -: bmatr_(sv_slices, allocation_policy_type(), bm::id_max, allocator_type()) +: bmatr_(sv_slices, true, allocation_policy_type(), bm::id_max, allocator_type()) {} //--------------------------------------------------------------------- @@ -1600,10 +1631,11 @@ base_sparse_vector::base_sparse_vector() template base_sparse_vector::base_sparse_vector( bm::null_support null_able, + bool is_dynamic, allocation_policy_type ap, size_type bv_max_size, const allocator_type& alloc) -: bmatr_(sv_slices, ap, bv_max_size, alloc) +: bmatr_(sv_slices, is_dynamic, ap, bv_max_size, alloc) { if (null_able == bm::use_null) { diff --git a/c++/include/util/bitset/bmbuffer.h b/c++/include/util/bitset/bmbuffer.h index 42684926..290a9ae6 100644 --- a/c++/include/util/bitset/bmbuffer.h +++ b/c++/include/util/bitset/bmbuffer.h @@ -215,7 +215,7 @@ public: /// adjust current size (no need to reallocate) void resize_no_check(size_t new_size) BMNOEXCEPT { - BM_ASSERT(new_size < capacity_ || !new_size); + BM_ASSERT(new_size <= capacity_ || !new_size); this->size_ = new_size; } @@ -750,6 +750,7 @@ public: void free() BMNOEXCEPT { buffer_.free_buffer(); + rows_ = 0; cols_ = 0; } size_type rows() const BMNOEXCEPT { return rows_; } diff --git a/c++/include/util/bitset/bmconst.h b/c++/include/util/bitset/bmconst.h index b0459e2d..8d2b311b 100644 --- a/c++/include/util/bitset/bmconst.h +++ b/c++/include/util/bitset/bmconst.h @@ -244,10 +244,10 @@ template struct _copyright #define BM_VERSION_MAJOR 7 #define BM_VERSION_MINOR 13 -#define BM_VERSION_PATCH 3 +#define BM_VERSION_PATCH 4 template const char _copyright::_p[] = - "BitMagic Library. v.7.13.3 (c) 2002-2022 Anatoliy Kuznetsov."; + "BitMagic Library. v.7.13.4 (c) 2002-2022 Anatoliy Kuznetsov."; template const unsigned _copyright::_v[3] = { BM_VERSION_MAJOR, BM_VERSION_MINOR, BM_VERSION_PATCH }; diff --git a/c++/include/util/bitset/bmserial.h b/c++/include/util/bitset/bmserial.h index 30ead163..32c05975 100644 --- a/c++/include/util/bitset/bmserial.h +++ b/c++/include/util/bitset/bmserial.h @@ -621,10 +621,8 @@ public: /** reset range deserialization and reference vectors @sa set_range() */ - void reset() BMNOEXCEPT - { - unset_range(); set_ref_vectors(0); - } + void reset() BMNOEXCEPT { unset_range(); set_ref_vectors(0); } + protected: typedef typename BV::blocks_manager_type blocks_manager_type; @@ -689,7 +687,6 @@ protected: block_idx_type x_nb_; unsigned xor_chain_size_; bm::match_pair xor_chain_[64]; -// bool x_ref_gap_; // Range deserialization settings // @@ -4128,12 +4125,15 @@ size_t deserializer::deserialize(bvector_type& bv, { blocks_manager_type& bman = bv.get_blocks_manager(); if (!bman.is_init()) - bman.init_tree(); + { + auto bc = bman.compute_top_block_size(bm::id_max-1); + bman.init_tree(bc); + } bm::word_t* temp_block = temp_block_; bm::strategy strat = bv.get_new_blocks_strat(); - bv.set_new_blocks_strat(BM_GAP); + //bv.set_new_blocks_strat(BM_GAP); typename bvector_type::mem_pool_guard mp_guard_bv; mp_guard_bv.assign_if_not_set(pool_, bv); @@ -4580,6 +4580,8 @@ size_t deserializer::deserialize(bvector_type& bv, bv.set_new_blocks_strat(strat); + bman.shrink_top_blocks(); // reduce top blocks to necessary size + return dec.size(); } @@ -4727,7 +4729,7 @@ void deserializer::xor_decode(blocks_manager_type& bman) if (nb_from == x_nb_ || nb_to == x_nb_) return; } - bman.optimize_bit_block(i0, j0, BV::opt_compress); + bman.optimize_bit_block_nocheck(i0, j0); } // --------------------------------------------------------------------------- diff --git a/c++/include/util/bitset/bmsparsevec.h b/c++/include/util/bitset/bmsparsevec.h index 6deef2f9..5d46303f 100644 --- a/c++/include/util/bitset/bmsparsevec.h +++ b/c++/include/util/bitset/bmsparsevec.h @@ -417,7 +417,7 @@ public: { if (this != &sv) { - clear_all(true); + clear_all(true, 0); swap(sv); } return *this; @@ -554,6 +554,13 @@ public: void clear(const bvector_type& bv_idx) { this->bit_sub_rows(bv_idx, false); } + /** Get raw unsigned value first N bits + \param idx - element index in the vector + \param N_bits - number of bits to be extracted (should be > 0) + @return unsigned value for + */ + unsigned_value_type get_unsigned_bits(size_type idx, + size_type N_bits) const BMNOEXCEPT; ///@} @@ -692,11 +699,13 @@ public: /*! @name Clear */ ///@{ - /*! \brief resize to zero, free memory */ - void clear_all(bool free_mem) BMNOEXCEPT; + /*! \brief resize to zero, free memory + @param free_mem - true - indicates the need to free underlying memory in bit-vectors + */ + void clear_all(bool free_mem, unsigned ) BMNOEXCEPT; /*! \brief resize to zero, free memory */ - void clear() BMNOEXCEPT { clear_all(true); } + void clear() BMNOEXCEPT { clear_all(true, 0); } /*! \brief clear range (assign bit 0 for all planes) @@ -1070,9 +1079,10 @@ protected: static void u2s_translate(value_type* arr, size_type sz) BMNOEXCEPT; - // get raw unsigned value + /// get raw unsigned value unsigned_value_type get_unsigned(size_type idx) const BMNOEXCEPT; + protected: template friend class rsc_sparse_vector; template friend class sparse_vector_scanner; @@ -1092,7 +1102,7 @@ sparse_vector::sparse_vector( allocation_policy_type ap, size_type bv_max_size, const allocator_type& alloc) -: parent_type(null_able, ap, bv_max_size, alloc) +: parent_type(null_able, false, ap, bv_max_size, alloc) {} //--------------------------------------------------------------------- @@ -1370,10 +1380,9 @@ sparse_vector::gather(value_type* arr, return size; } ::memset(arr, 0, sizeof(value_type)*size); - for (size_type i = 0; i < size;) { - bool sorted_block = true; + bool sorted_block = true; // initial assumption // look ahead for the depth of the same block // (speculate more than one index lookup per block) @@ -1385,7 +1394,7 @@ sparse_vector::gather(value_type* arr, { case BM_UNKNOWN: { - sorted_block = true; // initial assumption + // check if sorted, it pays off to verify size_type idx_prev = idx[r]; for (; (r < size) && (nb == (idx[r] >> bm::set_block_shift)); ++r) { @@ -1777,7 +1786,7 @@ sparse_vector::get_unsigned( BM_ASSERT(i < bm::id_max); unsigned_value_type uv = 0; - unsigned eff_planes = this->effective_slices(); + const unsigned eff_planes = this->effective_slices(); BM_ASSERT(eff_planes <= (sizeof(value_type) * 8)); unsigned_value_type smask = this->slice_mask_; @@ -1793,6 +1802,34 @@ sparse_vector::get_unsigned( return uv; } +//--------------------------------------------------------------------- + +template +typename sparse_vector::unsigned_value_type +sparse_vector::get_unsigned_bits(size_type idx, + size_type N_bits) const BMNOEXCEPT +{ + BM_ASSERT(idx < bm::id_max); + const unsigned eff_planes = this->effective_slices(); + BM_ASSERT(eff_planes <= (sizeof(value_type) * 8)); + if (N_bits > eff_planes) + N_bits = eff_planes; + unsigned_value_type uv = 0; + + for (unsigned j = 0; j < N_bits; ++j) + { + const bvector_type* bv = this->bmatr_.get_row(j); + if (bv) + { + bool b = bv->test(idx); + if (b) + uv |= unsigned_value_type(1) << j; + } + } // for j + return uv; +} + + //--------------------------------------------------------------------- template @@ -2061,7 +2098,7 @@ void sparse_vector::inc_no_null(size_type idx, value_type v) //--------------------------------------------------------------------- template -void sparse_vector::clear_all(bool free_mem) BMNOEXCEPT +void sparse_vector::clear_all(bool free_mem, unsigned) BMNOEXCEPT { parent_type::clear_all(free_mem); } diff --git a/c++/include/util/bitset/bmsparsevec_compr.h b/c++/include/util/bitset/bmsparsevec_compr.h index a2d2f52c..796adf34 100644 --- a/c++/include/util/bitset/bmsparsevec_compr.h +++ b/c++/include/util/bitset/bmsparsevec_compr.h @@ -353,7 +353,7 @@ public: { if (this != &csv) { - clear_all(true); + clear_all(true, 0); sv_.swap(csv.sv_); size_ = csv.size_; max_id_ = csv.max_id_; in_sync_ = csv.in_sync_; if (in_sync_) @@ -429,6 +429,15 @@ public: */ value_type get(size_type idx) const BMNOEXCEPT; + /** Get raw unsigned value first N bits + \param idx - element index in the vector + \param N_bits - number of bits to be extracted (should be > 0) + @return unsigned value for + */ + unsigned_value_type get_unsigned_bits(size_type idx, + size_type N_bits) const BMNOEXCEPT; + + /** \brief get specified element with NOT NULL check \param idx - element index @@ -723,12 +732,12 @@ public: /*! \brief resize to zero, free memory @param free_mem - free bit vector slices if true */ - void clear_all(bool free_mem) BMNOEXCEPT; + void clear_all(bool free_mem, unsigned) BMNOEXCEPT; /*! \brief resize to zero, free memory @param free_mem - free bit vector slices if true */ - void clear() BMNOEXCEPT { clear_all(true); } + void clear() BMNOEXCEPT { clear_all(true, 0); } /*! @brief Calculates memory statistics. @@ -828,7 +837,10 @@ public: bvector_type_ptr get_create_slice(unsigned i) { return sv_.get_create_slice(i); } - + + bvector_type_ptr slice(unsigned i) + { return sv_.slice(i); } + /*! Number of effective bit-slices in the value type */ @@ -1370,7 +1382,7 @@ void rsc_sparse_vector::load_from( } else { - sv_.clear_all(true); + sv_.clear_all(true, 0); *bv_null = *bv_null_src; bm::rank_compressor rank_compr; // re-used for planes @@ -1397,7 +1409,7 @@ void rsc_sparse_vector::load_from( template void rsc_sparse_vector::load_to(sparse_vector_type& sv) const { - sv.clear_all(true); + sv.clear_all(true, 0); const bvector_type* bv_null_src = this->get_null_bvector(); if (!bv_null_src) @@ -1576,6 +1588,21 @@ rsc_sparse_vector::get(size_type idx) const BMNOEXCEPT //--------------------------------------------------------------------- +template +typename rsc_sparse_vector::unsigned_value_type +rsc_sparse_vector::get_unsigned_bits(size_type idx, + size_type N_bits) const BMNOEXCEPT +{ + size_type sv_idx; + bool found = resolve(idx, &sv_idx); + if (!found) + return unsigned_value_type(0); + BM_ASSERT(!is_null(idx)); + return sv_.get_unsigned_bits(--sv_idx, N_bits); +} + +//--------------------------------------------------------------------- + template bool rsc_sparse_vector::try_get( size_type idx, value_type& v) const BMNOEXCEPT @@ -1633,9 +1660,9 @@ void rsc_sparse_vector::optimize(bm::word_t* temp_block, //--------------------------------------------------------------------- template -void rsc_sparse_vector::clear_all(bool free_mem) BMNOEXCEPT +void rsc_sparse_vector::clear_all(bool free_mem, unsigned) BMNOEXCEPT { - sv_.clear_all(free_mem); + sv_.clear_all(free_mem, 0); in_sync_ = false; max_id_ = size_ = 0; } @@ -1920,7 +1947,7 @@ void rsc_sparse_vector::copy_range( bool range_valid = csv.resolve_range(left, right, &sv_left, &sv_right); if (!range_valid) { - sv_.clear_all(true); sv_.resize(size_); + sv_.clear_all(true, 0); sv_.resize(size_); bvector_type* bv_null = sv_.get_null_bvect(); bv_null->copy_range(*arg_bv_null, 0, right); return; diff --git a/c++/include/util/bitset/bmsparsevec_parallel.h b/c++/include/util/bitset/bmsparsevec_parallel.h index ec960285..407b4b4e 100644 --- a/c++/include/util/bitset/bmsparsevec_parallel.h +++ b/c++/include/util/bitset/bmsparsevec_parallel.h @@ -95,7 +95,8 @@ public: }; /** - Parallel plan builder for the XOR filter scanner + Parallel plan builder for the XOR filter scanner. + Parallelization principle here is based on makig a task per 64K bit block (task per NP) @ingroup bmtasks */ template @@ -114,6 +115,9 @@ public: typedef typename parent_type::task_vector_type task_vector_type; }; + /** + Construct task batch for parallel execution. (Every task is a lambda). + */ void build_plan(task_batch& batch, bm::xor_sim_model& sim_model, const bv_ref_vector_type& ref_vect, diff --git a/c++/include/util/bitset/bmsparsevec_serial.h b/c++/include/util/bitset/bmsparsevec_serial.h index 4cc393b8..81611fdd 100644 --- a/c++/include/util/bitset/bmsparsevec_serial.h +++ b/c++/include/util/bitset/bmsparsevec_serial.h @@ -1223,6 +1223,8 @@ void sparse_vector_deserializer::deserialize(SV& sv, const unsigned char* buf, bool clear_sv) { + BM_ASSERT(buf); + idx_range_set_ = false; deserialize_sv(sv, buf, 0, clear_sv); } @@ -1237,10 +1239,13 @@ void sparse_vector_deserializer::deserialize_structure(SV& sv, unsigned char matr_s_ser = 0; unsigned planes = load_header(dec, sv, matr_s_ser); - if (planes == 0) + if (!planes) return; load_planes_off_table(buf, dec, planes); // read the offset vector of bit-planes + + sv.get_bmatrix().allocate_rows(planes); + for (unsigned i = 0; i < planes; ++i) { if (!off_vect_[i]) // empty vector @@ -1260,7 +1265,7 @@ void sparse_vector_deserializer::deserialize_range(SV& sv, bool clear_sv) { if (clear_sv) - sv.clear_all(true); + sv.clear_all(true, 1); idx_range_set_ = true; idx_range_from_ = from; idx_range_to_ = to; @@ -1331,7 +1336,7 @@ void sparse_vector_deserializer::deserialize_sv(SV& sv, bool clear_sv) { if (clear_sv) - sv.clear_all(true); + sv.clear_all(true, 1); // free memory, keep remap matrix remap_buf_ptr_ = 0; bm::decoder dec(buf); // TODO: implement correct processing of byte-order @@ -1567,7 +1572,7 @@ int sparse_vector_deserializer::load_null_plane(SV& sv, // the NULL vector just to get to the offset of remap table const unsigned char* bv_buf_ptr = buf + offset; // seek to position - bvector_type* bv = sv.get_create_slice(unsigned(i)); + bvector_type* bv = sv.slice(unsigned(i)); if (!bv_ref_ptr_) bv_ref_.add(bv, unsigned(i)); diff --git a/c++/include/util/bitset/bmsse4.h b/c++/include/util/bitset/bmsse4.h index fd70bccd..369e0402 100644 --- a/c++/include/util/bitset/bmsse4.h +++ b/c++/include/util/bitset/bmsse4.h @@ -1574,8 +1574,8 @@ unsigned sse42_idx_arr_block_lookup(const unsigned* idx, unsigned size, __m128i nbA = _mm_srli_epi32(idxA, bm::set_block_shift); // idx[k] >> bm::set_block_shift __m128i nbB = _mm_srli_epi32(idxB, bm::set_block_shift); - if (!_mm_test_all_ones(_mm_cmpeq_epi32(nbM, nbA)) | - !_mm_test_all_ones(_mm_cmpeq_epi32 (nbM, nbB))) + if (!_mm_test_all_ones(_mm_and_si128(_mm_cmpeq_epi32(nbM, nbA), + _mm_cmpeq_epi32(nbM, nbB)))) break; } // for k diff --git a/c++/include/util/bitset/bmstrsparsevec.h b/c++/include/util/bitset/bmstrsparsevec.h index 92db824c..39180f03 100644 --- a/c++/include/util/bitset/bmstrsparsevec.h +++ b/c++/include/util/bitset/bmstrsparsevec.h @@ -817,11 +817,18 @@ public: /*! @name Clear */ ///@{ - /*! \brief resize to zero, free memory */ - void clear_all(bool free_mem) BMNOEXCEPT; + /*! \brief resize to zero, free memory + @param free_mem - true - free all bit-vectors memory, + false - set bit-vecor to zero (memory remains reserved) + @param remap - 0 - set to no-remap (default), 1 - keep remap substitution matrix for possible re-use + (if remap() was ever called on this vector with the datawith same frequency profiles) + Note that feeding the data with disimilar frequency profile would cause undefined behavior. + @sa remap + */ + void clear_all(bool free_mem, unsigned remap=0) BMNOEXCEPT; - /*! \brief resize to zero, free memory */ - void clear() BMNOEXCEPT { clear_all(true); } + /*! \brief resize to zero, free memory, reset remapping */ + void clear() BMNOEXCEPT { clear_all(true, 0); } /*! \brief clear range (assign bit 0 for all planes) @@ -1602,7 +1609,7 @@ str_sparse_vector::str_sparse_vector( allocation_policy_type ap, size_type bv_max_size, const allocator_type& alloc) -: parent_type(null_able, ap, bv_max_size, alloc), +: parent_type(null_able, true, ap, bv_max_size, alloc), remap_flags_(0) { static_assert(STR_SIZE > 1, @@ -1629,7 +1636,7 @@ str_sparse_vector::str_sparse_vector( template str_sparse_vector::str_sparse_vector( const str_sparse_vector& str_sv, bm::remap_setup remap_mode) -: parent_type(str_sv.get_null_support()), +: parent_type(str_sv.get_null_support(), true), remap_flags_(str_sv.remap_flags_), remap_matrix1_(str_sv.remap_matrix1_), remap_matrix2_(str_sv.remap_matrix2_) @@ -2271,6 +2278,9 @@ bool str_sparse_vector::remap_tosv( const value_type* BMRESTRICT str, const slice_octet_matrix_type& BMRESTRICT octet_remap_matrix2) BMNOEXCEPT { + if (!octet_remap_matrix2.rows()) + return false; + const unsigned char* remap_row = octet_remap_matrix2.row(0); for (unsigned i = 0; i < buf_size; ++i, remap_row += 256) { @@ -2280,7 +2290,6 @@ bool str_sparse_vector::remap_tosv( sv_str[i] = ch; break; } -// const unsigned char* remap_row = octet_remap_matrix2.row(i); unsigned char remap_value = remap_row[unsigned(ch)]; sv_str[i] = CharType(remap_value); if (!remap_value) // unknown dictionary element @@ -2588,9 +2597,15 @@ str_sparse_vector::begin() const BMNOEXCEPT template void str_sparse_vector::clear_all( - bool free_mem) BMNOEXCEPT + bool free_mem, unsigned remap) BMNOEXCEPT { parent_type::clear_all(free_mem); + if (remap_flags_ && (remap == 0)) + { + remap_flags_ = 0; + remap_matrix1_.free(); + remap_matrix2_.free(); + } } //--------------------------------------------------------------------- diff --git a/c++/include/util/bitset/encoding.h b/c++/include/util/bitset/encoding.h index 6d2274f2..20d3b995 100644 --- a/c++/include/util/bitset/encoding.h +++ b/c++/include/util/bitset/encoding.h @@ -1473,7 +1473,8 @@ void bit_in::bic_decode_u16_rg(bm::gap_word_t* arr, unsigned sz, bm::gap_word_t lo, bm::gap_word_t hi) BMNOEXCEPT { - for (;sz;) + BM_ASSERT(sz); + do // for (;sz;) { BM_ASSERT(lo <= hi); @@ -1499,13 +1500,14 @@ void bit_in::bic_decode_u16_rg(bm::gap_word_t* arr, unsigned sz, BM_ASSERT(mid_idx < 65536); arr[mid_idx] = bm::gap_word_t(val); - if (sz == 1) + if (sz <= 1) return; + bic_decode_u16_rg(arr, mid_idx, lo, bm::gap_word_t(val - 1)); arr += mid_idx + 1; sz -= mid_idx + 1; lo = bm::gap_word_t(val + 1); - } // for sz + } while (sz); // for sz } // ---------------------------------------------------------------------- @@ -1516,15 +1518,12 @@ void bit_in::bic_decode_u32_cm(bm::word_t* arr, unsigned sz, bm::word_t hi) BMNOEXCEPT { BM_ASSERT(sz); - do //for (;sz;) + do { BM_ASSERT(lo <= hi); - - unsigned val; - // read the interpolated value // x = read(r)+ lo + mid, where r = (hi - lo - sz + 1); - val = hi - lo - sz + 1; + unsigned val = hi - lo - sz + 1; if (val) { unsigned logv = bm::bit_scan_reverse32(val+1); @@ -1543,7 +1542,8 @@ void bit_in::bic_decode_u32_cm(bm::word_t* arr, unsigned sz, unsigned mid_idx = sz >> 1; val += lo + mid_idx; arr[mid_idx] = val; - if (sz == 1) + + if (sz <= 1) return; bic_decode_u32_cm(arr, mid_idx, lo, val-1); @@ -1563,16 +1563,12 @@ void bit_in::bic_decode_u16_cm(bm::gap_word_t* arr, unsigned sz, bm::gap_word_t hi) BMNOEXCEPT { BM_ASSERT(sz); - //for (;sz;) do { BM_ASSERT(lo <= hi); - - unsigned val; - // read the interpolated value // x = read(r)+ lo + mid, where r = (hi - lo - sz + 1); - val = hi - lo - sz + 1; + unsigned val = hi - lo - sz + 1; if (val) { unsigned logv = bm::bit_scan_reverse32(val+1); @@ -1590,7 +1586,8 @@ void bit_in::bic_decode_u16_cm(bm::gap_word_t* arr, unsigned sz, unsigned mid_idx = sz >> 1; val += lo + mid_idx; arr[mid_idx] = bm::gap_word_t(val); - if (sz == 1) + + if (sz <= 1) return; bic_decode_u16_cm(arr, mid_idx, lo, bm::gap_word_t(val-1)); @@ -1609,19 +1606,17 @@ void bit_in::bic_decode_u16_cm_bitset(bm::word_t* block, unsigned sz, bm::gap_word_t lo, bm::gap_word_t hi) BMNOEXCEPT { - for (;sz;) + BM_ASSERT(sz); + do { BM_ASSERT(lo <= hi); - - unsigned val; - // read the interpolated value // x = read(r)+ lo + mid, where r = (hi - lo - sz + 1); - val = hi - lo - sz + 1; + unsigned val = hi - lo - sz + 1; if (val) { unsigned logv = bm::bit_scan_reverse32(val+1); - + unsigned c = unsigned((1ull << (logv + 1)) - val - 1); int64_t half_c = c >> 1; // c / 2; int64_t half_r = val >> 1; // r / 2; @@ -1632,7 +1627,7 @@ void bit_in::bic_decode_u16_cm_bitset(bm::word_t* block, unsigned sz, if (val <= lo1 || val >= hi1) val += (get_bit() << logv); } - + unsigned mid_idx = sz >> 1; val += lo + mid_idx; @@ -1642,15 +1637,15 @@ void bit_in::bic_decode_u16_cm_bitset(bm::word_t* block, unsigned sz, block[nword] |= (1u << (val & bm::set_word_mask)); } - if (sz == 1) + if (sz <= 1) return; - + bic_decode_u16_cm_bitset(block, mid_idx, lo, bm::gap_word_t(val-1)); // tail recursive call: // bic_decode_u32_cm(block, sz - mid_idx - 1, val + 1, hi); - sz -= ++mid_idx;// +1; + sz -= ++mid_idx; lo = bm::gap_word_t(val + 1); - } // for sz + } while (sz); } // ---------------------------------------------------------------------- @@ -1660,7 +1655,8 @@ void bit_in::bic_decode_u16_cm_dry(unsigned sz, bm::gap_word_t lo, bm::gap_word_t hi) BMNOEXCEPT { - for (;sz;) + BM_ASSERT(sz); + do { BM_ASSERT(lo <= hi); @@ -1681,7 +1677,7 @@ void bit_in::bic_decode_u16_cm_dry(unsigned sz, int64_t hi1 = half_r + half_c + 1; r = get_bits(logv); if (r <= lo1 || r >= hi1) - r += (get_bits(1) << logv); + r += (get_bit() << logv); } val = r; } @@ -1689,15 +1685,15 @@ void bit_in::bic_decode_u16_cm_dry(unsigned sz, unsigned mid_idx = sz >> 1; val += lo + mid_idx; - if (sz == 1) + if (sz <= 1) return; bic_decode_u16_cm_dry(mid_idx, lo, bm::gap_word_t(val-1)); // tail recursive call: // bic_decode_u32_cm_dry(sz - mid_idx - 1, val + 1, hi); - sz -= mid_idx + 1; + sz -= mid_idx + 1; lo = bm::gap_word_t(val + 1); - } // for sz + } while (sz); // for sz } @@ -1708,7 +1704,8 @@ void bit_in::bic_decode_u16_rg_bitset(bm::word_t* block, unsigned sz, bm::gap_word_t lo, bm::gap_word_t hi) BMNOEXCEPT { - for (;sz;) + BM_ASSERT(sz); + do //for (;sz;) { BM_ASSERT(lo <= hi); @@ -1745,7 +1742,7 @@ void bit_in::bic_decode_u16_rg_bitset(bm::word_t* block, unsigned sz, //bic_decode_u16_bitset(block, sz - mid_idx - 1, bm::gap_word_t(val + 1), hi); sz -= mid_idx + 1; lo = bm::gap_word_t(val + 1); - } // for sz + } while(sz); // for sz } // ---------------------------------------------------------------------- @@ -1916,28 +1913,20 @@ ret: template unsigned bit_in::get_bit() BMNOEXCEPT { - const unsigned maskFF = ~0u; - unsigned value = 0; - unsigned free_bits = unsigned((sizeof(accum_) * 8) - used_bits_); - if (1 <= free_bits) + const unsigned mask = (~0u) >> (32 - 1); // 100000... + unsigned value = accum_ & mask; + if (unsigned free_bits = unsigned(32u - used_bits_); free_bits) { - take_accum: - value = accum_ & (maskFF >> (32 - 1)); - accum_ >>= 1; - used_bits_ += 1; - return value; + accum_ >>= 1; ++used_bits_; } - if (used_bits_ == (sizeof(accum_) * 8)) + else { - accum_ = src_.get_32(); - used_bits_ = 0; - goto take_accum; + BM_ASSERT(used_bits_ == (sizeof(accum_) * 8)); + unsigned a = src_.get_32(); + value = a & mask; + used_bits_ = 1; + accum_ = (a >> 1); } - value = accum_; - accum_ = src_.get_32(); - used_bits_ = 1 - free_bits; - value |= ((accum_ & (maskFF >> (32 - used_bits_))) << free_bits); - accum_ >>= used_bits_; return value; } diff --git a/c++/include/util/stream_source.hpp b/c++/include/util/stream_source.hpp index 08bb2147..18e2079e 100644 --- a/c++/include/util/stream_source.hpp +++ b/c++/include/util/stream_source.hpp @@ -1,7 +1,7 @@ #ifndef UTIL___STREAM_SOURCE__HPP #define UTIL___STREAM_SOURCE__HPP -/* $Id: stream_source.hpp 534859 2017-05-03 12:47:35Z ivanov $ +/* $Id: stream_source.hpp 680708 2024-03-26 13:05:01Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -189,7 +189,7 @@ public: /// /// If these conditions aren't met, throws an exception. /// - virtual CInputStreamSource& operator++(); + CInputStreamSource& operator++(); /// Determine if there are any more streams to be processed /// @@ -213,6 +213,9 @@ public: /// the current file index size_t GetCurrentStreamIndex(size_t* count = nullptr) const; + /// Jump to specified file in input list + CInputStreamSource& JumpToFile(unsigned index); + protected: CArgs m_Args; string m_Prefix; @@ -224,6 +227,13 @@ protected: size_t m_CurrIndex; string m_CurrFile; + void x_Reset(); + + void x_OpenOwnedStream(CNcbiIstream *is); + + // Advance to the next stream, if there is any. + virtual void x_OpenNextFile(); + private: /// forbidden CInputStreamSource(const CInputStreamSource&); diff --git a/c++/scripts/common/check/check_exec.sh b/c++/scripts/common/check/check_exec.sh index 643bdb79..ea7ffc6d 100755 --- a/c++/scripts/common/check/check_exec.sh +++ b/c++/scripts/common/check/check_exec.sh @@ -1,6 +1,6 @@ #! /bin/sh -# $Id: check_exec.sh 487998 2015-12-23 18:21:14Z ivanov $ +# $Id: check_exec.sh 676064 2023-12-07 19:04:25Z ivanov $ # Author: Vladimir Ivanov, NCBI # ########################################################################### @@ -40,7 +40,7 @@ echo $$ > check_exec.pid # Reinforce timeout # Note, we cannot set it to $timeout for MT-test, because # CPU time count for each thread and sum. -ulimit -t `expr $timeout \* 3` > /dev/null 2>&1 +ulimit -t `expr $timeout \* 25` > /dev/null 2>&1 # Use different kill on Unix and Cygwin case `uname -s` in diff --git a/c++/scripts/common/check/check_exec_test.sh b/c++/scripts/common/check/check_exec_test.sh index aa0a8bb0..478d41a3 100755 --- a/c++/scripts/common/check/check_exec_test.sh +++ b/c++/scripts/common/check/check_exec_test.sh @@ -1,6 +1,6 @@ #! /bin/sh -# $Id: check_exec_test.sh 658859 2022-11-09 16:45:22Z vakatov $ +# $Id: check_exec_test.sh 676064 2023-12-07 19:04:25Z ivanov $ # Author: Vladimir Ivanov, NCBI # ########################################################################### @@ -46,7 +46,7 @@ trap "rm -f $tmp $timestamp_file" 0 1 2 15 # Reinforce timeout # Note, we cannot set it to $timeout for MT-test, because # CPU time count for each thread and sum. -ulimit -t `expr $timeout \* 3` > /dev/null 2>&1 || true +ulimit -t `expr $timeout \* 25` > /dev/null 2>&1 || true # Use different kill on Unix and Cygwin case `uname -s` in diff --git a/c++/scripts/common/check/check_make_cfg.sh b/c++/scripts/common/check/check_make_cfg.sh index 674d6c43..ca3272ce 100755 --- a/c++/scripts/common/check/check_make_cfg.sh +++ b/c++/scripts/common/check/check_make_cfg.sh @@ -1,6 +1,6 @@ #! /bin/sh -# $Id: check_make_cfg.sh 651895 2022-06-27 17:39:46Z ivanov $ +# $Id: check_make_cfg.sh 677891 2024-01-24 19:09:24Z ivanov $ # Author: Vladimir Ivanov, NCBI # ########################################################################### @@ -579,7 +579,7 @@ RunTest() { exec_time=\`echo "\$exec_time" | tr '\n\r' '%%'\` echo \$exec_time | grep 'real [0-9]\|Maximum execution .* is exceeded' > /dev/null 2>&1 if test \$? -eq 0; then - exec_time=\`echo \$exec_time | sed -e 's/^%*//' -e 's/%*$//' -e 's/%%/%/g' -e 's/%/, /g' -e 's/[ ] */ /g'\` + exec_time=\`echo \$exec_time | tr -d '\n\r' | sed -e 's/^%*//' -e 's/%*$//' -e 's/%%/%/g' -e 's/%/, /g' -e 's/[ ] */ /g'\` else exec_time='unparsable timing stats' fi @@ -670,20 +670,43 @@ RunTest() { # Always load test results for automated builds on a 'run' command. if \$is_run && \$is_db_load; then - echo "\$x_path_app:" >> "\$build_dir/test_stat_load.log" 2>&1 + stat_out="\$build_dir/test_stat_load.tmp.\$x_app" + retry="${x_check_scripts_dir}/retry_db_load.sh" + echo "======================================================================" >> \$stat_out 2>&1 + echo "[\$build_tree/\$build_cfg] \$x_name" >> \$stat_out 2>&1 + echo "======================================================================" >> \$stat_out 2>&1 + echo >> \$stat_out 2>&1 if test -n "\$saved_phid"; then NCBI_LOG_HIT_ID=\$saved_phid export NCBI_LOG_HIT_ID fi case "$x_compiler" in MSVC ) - test_stat_load "\$(cygpath -w "\$x_test_rep")" "\$(cygpath -w "\$x_test_out")" "\$(cygpath -w "\$x_boost_rep")" "\$(cygpath -w "\$top_srcdir/build_info")" >> "\$build_dir/test_stat_load.log" 2>&1 + # To avoid problems with retry script: + # - convert Cygwin paths to Windows paths + # - convert back slashes to forward slashes + args="" + for arg in "\$(cygpath -w "\$x_test_rep")" "\$(cygpath -w "\$x_test_out")" "\$(cygpath -w "\$x_boost_rep")" "\$(cygpath -w "\$top_srcdir/build_info")"; do + args="\$args \$arg" + done + args=\`echo \$args | tr '\\\\\' '/'\` + \$retry \$stat_out test_stat_load \$args ;; XCODE ) - $NCBI/bin/_production/CPPCORE/test_stat_load "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" >> "\$build_dir/test_stat_load.log" 2>&1 + \$retry \$stat_out $NCBI/bin/_production/CPPCORE/test_stat_load "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" ;; esac - echo >> "\$build_dir/test_stat_load.log" 2>&1 + case \$? in + 0 ) + echo "OK: [\$build_tree/\$build_cfg] \$x_name" >> \$stat_out 2>&1 ;; + 4 ) + echo "TO: Error loading results for [\$build_tree/\$build_cfg] \$x_name" >> \$stat_out 2>&1 ;; + * ) + echo "ERR: Error loading results for [\$build_tree/\$build_cfg] \$x_name" >> \$stat_out 2>&1 ;; + esac + echo >> \$stat_out 2>&1 + cat \$stat_out >> "\$build_dir/test_stat_load.log" 2>&1 + rm -f \$stat_out > /dev/null 2>&1 fi if test \$is_run -a -n "\$saved_phid"; then rm -f \$saved_phid* > /dev/null 2>&1 diff --git a/c++/scripts/common/check/check_make_unix.sh b/c++/scripts/common/check/check_make_unix.sh index b960f15c..037ac86a 100755 --- a/c++/scripts/common/check/check_make_unix.sh +++ b/c++/scripts/common/check/check_make_unix.sh @@ -1,6 +1,6 @@ #! /bin/sh -# $Id: check_make_unix.sh 666773 2023-05-01 18:05:45Z ivanov $ +# $Id: check_make_unix.sh 680027 2024-03-08 18:23:04Z ivanov $ # Author: Vladimir Ivanov, NCBI # ########################################################################### @@ -505,15 +505,15 @@ is_max_debug=false if test -f "$x_conf_dir/status/MaxDebug.enabled"; then is_max_debug=true fi -if test "\$NCBI_CHECK_SETLIMITS" != "0" -a ! \$is_max_debug; then +if test "\$NCBI_CHECK_SETLIMITS" != "0" -a \$is_max_debug = false; then ulimit -c 1000000 ulimit -n 8192 if [ \$cygwin = false ]; then if test "\$NCBI_CHECK_TOOLS" = "regular"; then - ulimit -v 48000000 + ulimit -v 110000000 else # Increase memory limits if run under check tool - ulimit -v 64000000 + ulimit -v 150000000 fi fi fi @@ -734,7 +734,7 @@ EOF_launch exec_time=\`\$build_dir/sysdep.sh tl 7 \$x_log | tr '\n\r' '%%' | tr -d '\000-\037' | tr -d '\176-\377'\` echo \$exec_time | egrep 'real [0-9]|Maximum execution .* is exceeded' > /dev/null 2>&1 if test \$? -eq 0; then - exec_time=\`echo \$exec_time | \\ + exec_time=\`echo \$exec_time | tr -d '\n\r' | \\ sed -e 's/%%/%/g' \\ -e 's/%$//' \\ -e 's/%/, /g' \\ @@ -883,25 +883,47 @@ EOF_launch # Always load test results for automated builds on a 'run' command. if \$is_run && \$is_db_load; then - echo "======================================================================" >> "\$build_dir/test_stat_load.log" 2>&1 - echo "[\$x_work_dir_tail] \$x_name" >> "\$build_dir/test_stat_load.log" 2>&1 - echo "" >> "\$build_dir/test_stat_load.log" 2>&1 + stat_out="./test_stat_load.tmp.\$x_app" + retry="\${script_dir}/common/check/retry_db_load.sh" + echo "======================================================================" >> \$stat_out 2>&1 + echo "[\$x_work_dir_tail] \$x_name" >> \$stat_out 2>&1 + echo "======================================================================" >> \$stat_out 2>&1 + echo >> \$stat_out 2>&1 if test -n "\$saved_phid"; then NCBI_LOG_HIT_ID=\$saved_phid export NCBI_LOG_HIT_ID fi case \`uname -s\` in CYGWIN* ) - test_stat_load "\$(cygpath -w "\$x_test_rep")" "\$(cygpath -w "\$x_test_out")" "\$(cygpath -w "\$x_boost_rep")" "\$(cygpath -w "\$top_srcdir/build_info")" >> "$x_build_dir/test_stat_load.log" 2>&1 ;; + # To avoid problems with retry script: + # - convert Cygwin paths to Windows paths + # - convert back slashes to forward slashes + args="" + for arg in "\$(cygpath -w "\$x_test_rep")" "\$(cygpath -w "\$x_test_out")" "\$(cygpath -w "\$x_boost_rep")" "\$(cygpath -w "\$top_srcdir/build_info")"; do + args="\$args \$arg" + done + args=\`echo \$args | tr '\\\\\' '/'\` + \$retry \$stat_out test_stat_load \$args + ;; IRIX* ) - test_stat_load.sh "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" >> "$x_build_dir/test_stat_load.log" 2>&1 ;; + \$retry \$stat_out test_stat_load.sh "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" ;; * ) - test_stat_load "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" >> "$x_build_dir/test_stat_load.log" 2>&1 ;; - esac - echo >> "$x_build_dir/test_stat_load.log" 2>&1 + \$retry \$stat_out test_stat_load "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" ;; + esac + case \$? in + 0 ) + echo "OK: [\$x_work_dir_tail] \$x_name" >> \$stat_out 2>&1 ;; + 4 ) + echo "TO: Error loading results for [\$x_work_dir_tail] \$x_name" >> \$stat_out 2>&1 ;; + * ) + echo "ERR: Error loading results for [\$x_work_dir_tail] \$x_name" >> \$stat_out 2>&1 ;; + esac + echo >> \$stat_out 2>&1 + cat \$stat_out >> "\$build_dir/test_stat_load.log" 2>&1 + rm -f \$stat_out > /dev/null 2>&1 fi if test \$is_run -a -n "\$saved_phid"; then - rm -f \$saved_phid* > /dev/null 2>&1 + rm -f \$saved_phid* > /dev/null 2>&1 fi done # Run test under all specified check tools diff --git a/c++/scripts/common/check/check_make_unix_cmake.sh b/c++/scripts/common/check/check_make_unix_cmake.sh index b1f5c9a3..cdb5859f 100755 --- a/c++/scripts/common/check/check_make_unix_cmake.sh +++ b/c++/scripts/common/check/check_make_unix_cmake.sh @@ -1,6 +1,6 @@ #! /bin/sh -# $Id: check_make_unix_cmake.sh 670428 2023-07-25 12:16:14Z ivanov $ +# $Id: check_make_unix_cmake.sh 680027 2024-03-08 18:23:04Z ivanov $ # Author: Vladimir Ivanov, NCBI # ########################################################################### @@ -529,15 +529,15 @@ is_max_debug=false if test -f "\${conf_dir}/status/MaxDebug.enabled"; then is_max_debug=true fi -if test "\$NCBI_CHECK_SETLIMITS" != "0" -a ! \$is_max_debug; then +if test "\$NCBI_CHECK_SETLIMITS" != "0" -a \$is_max_debug = false; then ulimit -c 1000000 ulimit -n 8192 if [ \$cygwin = false ]; then if test "\$NCBI_CHECK_TOOLS" = "regular"; then - ulimit -v 48000000 + ulimit -v 110000000 else # Increase memory limits if run under check tool - ulimit -v 64000000 + ulimit -v 150000000 fi fi fi @@ -840,7 +840,7 @@ EOF_launch exec_time=\`\${checkroot}/sysdep.sh tl 7 \$x_log | tr '\n\r' '%%' | tr -d '\000-\037' | tr -d '\176-\377'\` echo \$exec_time | egrep 'real [0-9]|Maximum execution .* is exceeded' > /dev/null 2>&1 if test \$? -eq 0; then - exec_time=\`echo \$exec_time | \\ + exec_time=\`echo \$exec_time | tr -d '\n\r' | \\ sed -e 's/%%/%/g' \\ -e 's/%$//' \\ -e 's/%/, /g' \\ @@ -968,21 +968,46 @@ EOF_launch if \$is_run && \$is_db_load; then while ! mkdir "\$checkdir/~test_stat_load.lock" 2>/dev/null do - sleep 1 + sleep 1 done - if test -n "\$saved_phid"; then - NCBI_LOG_HIT_ID=\$saved_phid - export NCBI_LOG_HIT_ID - fi - case \`uname -s\` in - CYGWIN* ) - test_stat_load "\$(cygpath -w "\$x_test_rep")" "\$(cygpath -w "\$x_test_out")" "\$(cygpath -w "\$x_boost_rep")" "\$(cygpath -w "\$top_srcdir/build_info")" >> "\${checkdir}/test_stat_load.log" 2>&1 ;; - IRIX* ) - test_stat_load.sh "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" >> "\${checkdir}/test_stat_load.log" 2>&1 ;; - * ) - test_stat_load "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" >> "\${checkdir}/test_stat_load.log" 2>&1 ;; + stat_out="\${checkdir}/test_stat_load.tmp.\$x_name" + retry="\${script_dir}/common/check/retry_db_load.sh" + echo "======================================================================" >> \$stat_out 2>&1 + echo "[\$x_work_dir_tail] \$x_name" >> \$stat_out 2>&1 + echo "======================================================================" >> \$stat_out 2>&1 + echo >> \$stat_out 2>&1 + if test -n "\$saved_phid"; then + NCBI_LOG_HIT_ID=\$saved_phid + export NCBI_LOG_HIT_ID + fi + case \`uname -s\` in + CYGWIN* ) + # To avoid problems with retry script: + # - convert Cygwin paths to Windows paths + # - convert back slashes to forward slashes + args="" + for arg in "\$(cygpath -w "\$x_test_rep")" "\$(cygpath -w "\$x_test_out")" "\$(cygpath -w "\$x_boost_rep")" "\$(cygpath -w "\$top_srcdir/build_info")"; do + args="\$args \$arg" + done + args=\`echo \$args | tr '\\\\\' '/'\` + \$retry \$stat_out test_stat_load \$args + ;; + IRIX* ) + \$retry \$stat_out test_stat_load.sh "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" ;; + * ) + \$retry \$stat_out test_stat_load "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" ;; + esac + case \$? in + 0 ) + echo "OK: [\$x_work_dir_tail] \$x_name" >> \$stat_out 2>&1 ;; + 4 ) + echo "TO: Error loading results for [\$x_work_dir_tail] \$x_name" >> \$stat_out 2>&1 ;; + * ) + echo "ERR: Error loading results for [\$x_work_dir_tail] \$x_name" >> \$stat_out 2>&1 ;; esac - echo >> "\${checkdir}/test_stat_load.log" 2>&1 + echo >> \$stat_out 2>&1 + cat \$stat_out >> "\${checkdir}/test_stat_load.log" 2>&1 + rm -f \$stat_out > /dev/null 2>&1 rm -rf "\$checkdir/~test_stat_load.lock" fi if test \$is_run -a -n "\$saved_phid"; then @@ -1161,7 +1186,6 @@ AddJob() a_run=\`ls \${checkdir}/*.in_progress 2>/dev/null\` a_run=\`echo \$a_run | wc -w | sed -e 's/ //g'\` if test "\${a_run}" -ne "\${a_run}"; then -echo "error: 1 a_run = \$a_run" a_run=0 fi @@ -1170,7 +1194,6 @@ echo "error: 1 a_run = \$a_run" a_run=\`ls \${checkdir}/*.in_progress 2>/dev/null\` a_run=\`echo \$a_run | wc -w | sed -e 's/ //g'\` if test "\${a_run}" -ne "\${a_run}"; then -echo "error: 2 a_run = \$a_run" break fi if test "\${a_run}" -le 0; then diff --git a/c++/scripts/common/check/check_run.sh b/c++/scripts/common/check/check_run.sh index fa102ec2..aac2e676 100755 --- a/c++/scripts/common/check/check_run.sh +++ b/c++/scripts/common/check/check_run.sh @@ -1,6 +1,6 @@ #! /bin/sh -# $Id: check_run.sh 565074 2018-06-06 15:06:53Z ivanov $ +# $Id: check_run.sh 677875 2024-01-24 18:52:55Z ivanov $ # Author: Vladimir Ivanov, NCBI # ########################################################################### @@ -95,7 +95,7 @@ result=$? if test -n "$NCBI_AUTOMATED_BUILD" -a -z "$TEAMCITY_VERSION"; then # Report test_stat_load errors if any if [ -f "$build_dir/test_stat_load.log" ]; then - grep "test_stat_load Error" $build_dir/test_stat_load.log > /tmp/$$.mail_stat + grep "ERR: " $build_dir/test_stat_load.log > /tmp/$$.mail_stat if [ $? -eq 0 ] ; then cat <<-EOF >> /tmp/$$.mail_stat diff --git a/c++/scripts/common/check/retry_db_load.sh b/c++/scripts/common/check/retry_db_load.sh new file mode 100755 index 00000000..73666880 --- /dev/null +++ b/c++/scripts/common/check/retry_db_load.sh @@ -0,0 +1,66 @@ +#! /bin/sh +# $Id: retry_db_load.sh 677889 2024-01-24 19:09:08Z ivanov $ +# +# Author: Vladimir Ivanov +# +# Helper to load test results to a Database and retry if necessary +# to avoid possible lock/timeout issues. +# +# USAGE: +# retry_db_load.sh +# +# Exit codes: +# 0 - success +# 4 - timeout +# * - error (any other codes except 0 and 4) + + +#---------------- Arguments ---------------- + +script="$0" + +if [ "$#" -le 2 ]; then + echo "USAGE: `basename $script` " + exit 1 +fi + +out=$1 +shift +cmdline=$* + +#---------------- Configuration ---------------- + +# Maximum number of attempts +max_attempts=3 + +#---------------- Main ------------------------- + +attempt=1 +status=0 + +while [ "$attempt" -le "$max_attempts" ] +do + # Run build + (eval $cmdline) >> $out 2>&1 + if [ $? -eq 0 ] ; then + # Success + exit 0 + fi + status=1 + + tryagain=false + grep "Server connection timed out" $out > /dev/null 2>&1 && tryagain=true + + # Stop on any other error + $tryagain || exit $status + + # Try again + attempt=`expr $attempt + 1` + if [ "$attempt" -le "$max_attempts" ]; then + echo >> $out + echo "retrying..." >> $out + fi + status=4 +done + +exit $status diff --git a/c++/scripts/common/impl/install.sh b/c++/scripts/common/impl/install.sh index 956d8ef5..b24ced66 100755 --- a/c++/scripts/common/impl/install.sh +++ b/c++/scripts/common/impl/install.sh @@ -16,7 +16,7 @@ echo "[`date`]" -svn_location=`echo '$URL: https://svn.ncbi.nlm.nih.gov/repos/toolkit/release/blast/2.15.0/c++/scripts/common/impl/install.sh $' | sed "s%\\$[U]RL: *\\([^$][^$]*\\) \\$.*%\\1%"` +svn_location=`echo '$URL: https://svn.ncbi.nlm.nih.gov/repos/toolkit/release/blast/2.16.0/c++/scripts/common/impl/install.sh $' | sed "s%\\$[U]RL: *\\([^$][^$]*\\) \\$.*%\\1%"` svn_revision=`echo '$Revision: 631931 $' | sed "s%\\$[R]evision: *\\([^$][^$]*\\) \\$.*%\\1%"` script_name=`basename $0` diff --git a/c++/scripts/common/impl/ncbicxx_build_info.py b/c++/scripts/common/impl/ncbicxx_build_info.py index 8750cf1f..74f4b585 100644 --- a/c++/scripts/common/impl/ncbicxx_build_info.py +++ b/c++/scripts/common/impl/ncbicxx_build_info.py @@ -1,4 +1,4 @@ -# $Id: ncbicxx_build_info.py 662641 2023-02-03 14:13:00Z ucko $ +# $Id: ncbicxx_build_info.py 675074 2023-11-14 13:33:27Z ivanov $ import ast from datetime import date, datetime, timedelta, timezone from distutils.sysconfig import parse_makefile, expand_makefile_vars @@ -268,7 +268,7 @@ class Collector(object): def get_vcs_info(self, srcdir, rest = (), fallback = None): if os.path.isdir(os.path.join(srcdir, '.svn')): return self.get_svn_info(srcdir, rest) - elif os.path.isdir(os.path.join(srcdir, '.git')): + elif os.path.exists(os.path.join(srcdir, '.git')): return self.get_git_info(srcdir, rest) elif len(rest) == 0 and os.path.isdir(os.path.join(srcdir, 'CVS')): return self.get_cvs_info(srcdir) @@ -306,11 +306,11 @@ class Collector(object): break if 'vcs_path' not in info: # Maybe controlled by git after all, in a hybrid layout? - if os.path.isdir(os.path.join(srcdir, '.git')): + if os.path.exists(os.path.join(srcdir, '.git')): return self.get_git_info(srcdir, rest) while srcdir != '/': (srcdir, child) = os.path.split(srcdir) - if os.path.isdir(os.path.join(srcdir, '.git')): + if os.path.exists(os.path.join(srcdir, '.git')): return self.get_git_info(srcdir, (child,) + rest) return None return info @@ -333,10 +333,8 @@ class Collector(object): universal_newlines = True, cwd = srcdir) as remote: for l in remote.stdout: - (k, v) = l.strip().split(': ', 1) - if k == 'Fetch URL': - url = v - break + if 'Fetch URL: ' in l: + url = l.strip()[11:] except subprocess.CalledProcessError: pass if url is None: diff --git a/c++/scripts/common/new_cmake_project.sh b/c++/scripts/common/new_cmake_project.sh index ba86a2ca..ff0f4d07 100755 --- a/c++/scripts/common/new_cmake_project.sh +++ b/c++/scripts/common/new_cmake_project.sh @@ -1,6 +1,6 @@ #!/bin/sh ############################################################################# -# $Id: new_cmake_project.sh 638038 2021-09-22 19:38:26Z gouriano $ +# $Id: new_cmake_project.sh 674846 2023-11-06 19:12:27Z ivanov $ # Create new CMake project which uses prebuilt NCBI C++ toolkit from a sample # Author: Andrei Gourianov, gouriano@ncbi ############################################################################# @@ -43,9 +43,9 @@ if test -z "$1"; then echo echo The following project types are available: svn list -R $repository/$rep_src/$rep_sample | while IFS= read -r line; do - if [[ $line =~ .*/$ ]]; then + case "$line" in */ ) count=`echo $line | tr -cd '/' | wc -c` - if [[ $count -eq 2 ]]; then + if [ $count -eq 2 ]; then prj=${line%?} case "$prj" in app/alnmgr) echo " app/alnmgr an application that uses Alignment Manager";; @@ -77,7 +77,8 @@ if test -z "$1"; then *) echo " $prj";; esac fi - fi + ;; + esac done fi echo " " diff --git a/c++/scripts/projects/blast/Manifest b/c++/scripts/projects/blast/Manifest index e2141c5d..f4b9b8f3 100644 --- a/c++/scripts/projects/blast/Manifest +++ b/c++/scripts/projects/blast/Manifest @@ -1,7 +1,7 @@ # # Filename: Manifest # -# $Id: Manifest 665494 2023-04-05 16:11:45Z camacho $ +# $Id: Manifest 679535 2024-02-27 20:05:14Z satskyse $ # # Author: Christiam Camacho # @@ -50,6 +50,7 @@ DEFAULT_CONFIGURE_FLAGS: --without-debug --with-strip --with-openmp --with-mt -- #Linux64-Centos : icc : ICC.sh 1900 --with-static --without-dll --with-bin-release --with-strip --without-debug --without-pcre --with-mt --with-openmp --with-flat-makefile --with-experimental=Int8GI --without-gnutls --without-gcrypt --with-vdb=/panfs/traces01.be-md.ncbi.nlm.nih.gov/trace_software/vdb --with-static-vdb OPENMP_FLAGS='-qopenmp -qopenmp-link=static';LDFLAGS=-Wl,--as-needed Linux64-Centos : gcc : GCC.sh --with-static --without-dll --with-bin-release --with-strip --without-debug --without-pcre --with-mt --with-openmp --with-flat-makefile --with-experimental=Int8GI --without-gnutls --without-gcrypt --with-vdb=/panfs/traces01.be-md.ncbi.nlm.nih.gov/trace_software/vdb --with-static-vdb +Linux64-Alma : gcc : GCC.sh --with-static --without-dll --with-bin-release --with-strip --without-debug --without-pcre --with-mt --with-openmp --with-flat-makefile --with-experimental=Int8GI --without-gnutls --without-gcrypt --with-vdb=/panfs/traces01.be-md.ncbi.nlm.nih.gov/trace_software/vdb --with-static-vdb # #DEFAULT_CONFIGURATIONS: Linux64-Centos:icc @@ -62,4 +63,8 @@ Win64 : plain : static 64 ReleaseDLL NCBI_CONFIG____ENABLEDUSERREQU #IntelMAC : clang : Clang.sh --with-bin-release --without-debug --without-pcre --with-mt --with-openmp --with-flat-makefile --with-ncbi-public --with-experimental=Int8GI --without-vdb --without-gnutls --without-gcrypt IntelMAC : clang : Clang.sh --without-dll --with-bin-release --without-debug --without-pcre --with-mt --without-openmp --with-flat-makefile --with-ncbi-public --with-experimental=Int8GI --without-gnutls --without-gcrypt --with-vdb=/net/snowman/vol/projects/trace_software/vdb/vdb-versions/cxx_toolkit/2 --with-static-vdb --without-lzo --without-zstd +ArmMAC : clang : Clang.sh --without-dll --with-bin-release --without-debug --without-pcre --with-mt --without-openmp --with-flat-makefile --with-ncbi-public --with-experimental=Int8GI --without-gnutls --without-gcrypt --with-vdb=/net/snowman/vol/projects/trace_software/vdb/vdb-versions/cxx_toolkit/3 --with-static-vdb --without-lzo --without-zstd + +ArmMAC : clang-x86 : ../../configure --host=x86_64-apple-darwin21 --without-dll --with-bin-release --without-debug --without-pcre --with-mt --without-openmp --with-flat-makefile --with-ncbi-public --with-experimental=Int8GI --without-gnutls --without-gcrypt --with-vdb=/net/snowman/vol/projects/trace_software/vdb/vdb-versions/cxx_toolkit/3 --with-static-vdb --without-lzo --without-zstd CC='clang -arch x86_64';CXX='clang++ -arch x86_64' + USE_COMPONENTS diff --git a/c++/scripts/projects/blast/post_build/blast_utils.py b/c++/scripts/projects/blast/post_build/blast_utils.py index e0f02d14..bc7f0910 100644 --- a/c++/scripts/projects/blast/post_build/blast_utils.py +++ b/c++/scripts/projects/blast/post_build/blast_utils.py @@ -89,7 +89,9 @@ def create_new_tarball_name(platform, program, version): retval += "-ia32-linux" elif platform.startswith("Linux64"): retval += "-x64-linux" - elif platform.startswith("IntelMAC"): + elif platform == "ArmMAC:clang": + retval += "-aarch64-macosx" + elif platform == "ArmMAC:clang-x86": retval += "-x64-macosx" elif platform == "SunOSSparc": retval += "-sparc64-solaris" @@ -102,7 +104,9 @@ def create_new_tarball_name(platform, program, version): def determine_platform(): """ Determines the platform (as defined in prepare_release) for the current - hostname + host, i.e.: the output of the one-liner below + + python3 -mplatform 'print platform.platform()' """ p = platform.platform().lower() @@ -122,7 +126,9 @@ def determine_platform(): return "Win64" else: return "Win32" - elif p.find("darwin") != -1 or p.find("macos") != -1: - return "IntelMAC" + elif p.find("darwin") != -1 or (p.find("macos") != -1 and p.find("x86_64") == -1): + return "ArmMAC:clang" + elif p.find("darwin") != -1 or (p.find("macos") != -1 and p.find("x86_64") != -1): + return "ArmMAC:clang-x86" else: raise RuntimeError("Unknown platform: " + p) diff --git a/c++/scripts/projects/blast/post_build/macosx/build_universal_binary.sh b/c++/scripts/projects/blast/post_build/macosx/build_universal_binary.sh new file mode 100755 index 00000000..59123bb2 --- /dev/null +++ b/c++/scripts/projects/blast/post_build/macosx/build_universal_binary.sh @@ -0,0 +1,84 @@ +#!/bin/bash -x + +RELEASE=$1 +ARM_PATH="arm" +x86_PATH="x86" +UNIVERSAL_PATH="universal" +RELEASE_TAG="ncbi-blast-${RELEASE}+" + +if [ -d "$ARM_PATH" ]; then + rm -rf $ARM_PATH +fi +if [ -d "$x86_PATH" ]; then +rm -rf $x86_PATH +fi + +if [ -d "$UNIVERSAL_PATH" ]; then +rm -rf $UNIVERSAL_PATH +fi + +mkdir $ARM_PATH +mkdir $x86_PATH +mkdir $UNIVERSAL_PATH + +x86_package="${RELEASE_TAG}-x64-macosx.tar.gz" +cp $RELEASE/$x86_package $x86_PATH/ +tar -vxf $x86_PATH/$x86_package -C $x86_PATH/ + +arm_package="${RELEASE_TAG}-aarch64-macosx.tar.gz" +cp $RELEASE/$arm_package $ARM_PATH/ +tar -vxf $ARM_PATH/$arm_package -C $ARM_PATH/ + +cp $RELEASE/$arm_package $UNIVERSAL_PATH/ +tar -vxf $UNIVERSAL_PATH/$arm_package -C $UNIVERSAL_PATH/ + +blast_programs=("blast_formatter" +"blast_formatter_vdb" +"blast_vdb_cmd" +"blastdb_aliastool" +"blastdbcheck" +"blastdbcmd" +"blastn" +"blastn_vdb" +"blastp" +"blastx" +"convert2blastmask" +"deltablast" +"dustmasker" +"makeblastdb" +"makembindex" +"makeprofiledb" +"psiblast" +"rpsblast" +"rpstblastn" +"segmasker" +"tblastn" +"tblastn_vdb" +"tblastx" +"windowmasker") + +for program in "${blast_programs[@]}" +do +rm $UNIVERSAL_PATH/${RELEASE_TAG}/bin/$program +done + +for program in "${blast_programs[@]}" +do +lipo -create $ARM_PATH/${RELEASE_TAG}/bin/$program $x86_PATH/${RELEASE_TAG}/bin/$program -output $UNIVERSAL_PATH/${RELEASE_TAG}/bin/$program +done + +rm -rf $ARM_PATH +rm -rf $x86_PATH +POST_BUILD_DIR="blast/post_build/macosx" +$POST_BUILD_DIR/ncbi-blast.sh universal/${RELEASE_TAG} $POST_BUILD_DIR $RELEASE +cd $UNIVERSAL_PATH +mv ${RELEASE_TAG}/installer/${RELEASE_TAG}.dmg ./${RELEASE_TAG}-universal.dmg +rm -rf ${RELEASE_TAG}/install +tar czf ${RELEASE_TAG}-universal-macosx.tar.gz $RELEASE_TAG + +rm -rf $RELEASE_TAG +rm $arm_package +/sbin/md5 -r ${RELEASE_TAG}-universal-macosx.tar.gz > ${RELEASE_TAG}-universal-macosx.tar.gz.md5 +/sbin/md5 -r ${RELEASE_TAG}-universal.dmg > ${RELEASE_TAG}-universal.dmg.md5 + + diff --git a/c++/scripts/projects/blast/post_build/macosx/ncbi-blast.sh b/c++/scripts/projects/blast/post_build/macosx/ncbi-blast.sh index 04582183..e96532cc 100755 --- a/c++/scripts/projects/blast/post_build/macosx/ncbi-blast.sh +++ b/c++/scripts/projects/blast/post_build/macosx/ncbi-blast.sh @@ -99,7 +99,7 @@ create_disk_image() du -shc $PRODUCT # For diagnostics # Note: if this command fails, it could be because the -size argument is no # longer large enough, adjust accordingly - /usr/bin/hdiutil create $PRODUCT.dmg -srcfolder $PRODUCT -verbose -size 300m + /usr/bin/hdiutil create $PRODUCT.dmg -srcfolder $PRODUCT -verbose -size 500m mkdir $INSTALLDIR/installer mv $PRODUCT.dmg $INSTALLDIR/installer } diff --git a/c++/scripts/projects/blast/post_build/macosx/uninstall_ncbi_blast.zip b/c++/scripts/projects/blast/post_build/macosx/uninstall_ncbi_blast.zip index 8cc32afa43e9bc954334782465a0d9366cb995fc..ee1916273ecb6b1d94557baa4ce4bce96053200f 100644 GIT binary patch literal 60480 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 z

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�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 diff --git a/c++/scripts/projects/blast/post_build/macosx/uninstaller/build_uninstaller.sh b/c++/scripts/projects/blast/post_build/macosx/uninstaller/build_uninstaller.sh new file mode 100755 index 00000000..e15ea338 --- /dev/null +++ b/c++/scripts/projects/blast/post_build/macosx/uninstaller/build_uninstaller.sh @@ -0,0 +1,103 @@ +#!/bin/sh +# +# $Id: build_uninstaller.sh 683372 2024-05-24 16:08:21Z merezhuk $ +# * =========================================================================== +# * +# * PUBLIC DOMAIN NOTICE +# * National Center for Biotechnology Information +# * +# * This software/database is a "United States Government Work" under the +# * terms of the United States Copyright Act. It was written as part of +# * the author's official duties as a United States Government employee and +# * thus cannot be copyrighted. This software/database is freely available +# * to the public for use. The National Library of Medicine and the U.S. +# * Government have not placed any restriction on its use or reproduction. +# * +# * Although all reasonable efforts have been taken to ensure the accuracy +# * and reliability of the software and data, the NLM and the U.S. +# * Government do not and cannot warrant the performance or results that +# * may be obtained by using this software or data. The NLM and the U.S. +# * Government disclaim all warranties, express or implied, including +# * warranties of performance, merchantability or fitness for any particular +# * purpose. +# * +# * Please cite the author in any work or product based on this material. +# * +# * =========================================================================== +# * +# * Authors: Yury Merezhuk +# * +# + +ASCRIPT=uninstall_ncbi_blast.applescript +APP_NAME=uninstall_ncbi_blast.app +ZIP_NAME=uninstall_ncbi_blast.zip +OSACOMPILE="/usr/bin/osacompile" + +# +# Check re requisites +# +if [ ! -f ${ASCRIPT} ] ; then + echo "Error: missing ${ASCRIPT}" + exit 1 +fi + +if [ ! -x ${OSACOMPILE} ] ; then + echo "Error: missing AppleScript compiler ${OSACOMPILE}" + exit 2 +fi +if [ X`which zip` = X ] ; then + echo "Error: missing zip utility." + exit 22 +fi +if [ X`which unzip` = X ] ; then + echo "Error: missing unzip utility." + exit 23 +fi +if [ X`which awk` = X ] ; then + echo "Error: missing awk utility." + exit 23 +fi + + +# Some clean ups +if [ -f ${ZIP_NAME} ] ; then + tm_mark=`date +%s` + mv ${ZIP_NAME} ${ZIP_NAME}.${tm_mark} + if [ ! -f ${ZIP_NAME}.${tm_mark} ] ; then + echo "Error: Can't move old ${ZIP_NAME} to ${ZIP_NAME}.${tm_mark}" + exit 3 + else + echo "Info: old ${ZIP_NAME} renamed to ${ZIP_NAME}.${tm_mark}" + fi +fi + +if [ -d ${APP_NAME} ] ; then + rm -rf ${APP_NAME} +fi + +# ..... Compile new version +${OSACOMPILE} -o ${APP_NAME} ${ASCRIPT} +if [ ! -d ${APP_NAME} ] ; then + echo "Error: Can't compile ${ASCRIPT} to Application" + exit 4 +fi +echo "Info:" +echo "Info: Application ${APP_NAME} created" +find uninstall_ncbi_blast.app | awk '{ print "Info: "$0}' +# .... create zip archive +zip -q -r ${ZIP_NAME} ${APP_NAME} +if [ ! -f ${ZIP_NAME} ] ; then + echo "Error: Can't create zip archive from ${APP_NAME}" + exit 5 +fi +echo "Info:" +echo "Info: Zip archive ${ZIP_NAME} created" +unzip -l uninstall_ncbi_blast.zip | awk '{ print "Info: "$0}' +echo "Info: Done." + + + + + + diff --git a/c++/scripts/projects/blast/post_build/macosx/uninstaller/uninstall_ncbi_blast.applescript b/c++/scripts/projects/blast/post_build/macosx/uninstaller/uninstall_ncbi_blast.applescript new file mode 100644 index 00000000..0c3f43b9 --- /dev/null +++ b/c++/scripts/projects/blast/post_build/macosx/uninstaller/uninstall_ncbi_blast.applescript @@ -0,0 +1,97 @@ +-- $Id: uninstall_ncbi_blast.applescript 683376 2024-05-24 16:10:57Z merezhuk $ +-- * =========================================================================== +-- * +-- * PUBLIC DOMAIN NOTICE +-- * National Center for Biotechnology Information +-- * +-- * This software/database is a "United States Government Work" under the +-- * terms of the United States Copyright Act. It was written as part of +-- * the author's official duties as a United States Government employee and +-- * thus cannot be copyrighted. This software/database is freely available +-- * to the public for use. The National Library of Medicine and the U.S. +-- * Government have not placed any restriction on its use or reproduction. +-- * +-- * Although all reasonable efforts have been taken to ensure the accuracy +-- * and reliability of the software and data, the NLM and the U.S. +-- * Government do not and cannot warrant the performance or results that +-- * may be obtained by using this software or data. The NLM and the U.S. +-- * Government disclaim all warranties, express or implied, including +-- * warranties of performance, merchantability or fitness for any particular +-- * purpose. +-- * +-- * Please cite the author in any work or product based on this material. +-- * +-- * =========================================================================== +-- * +-- * Authors: Yury Merezhuk +-- +-- This is AppleScript file to uninstall BLAST+ package. +-- +property svn_date : "$Revision: 683376 $" + +on run + set blast_folder to POSIX file "/usr/local/ncbi/blast" -- DEFAULT. Not used. + set blast_path to POSIX file "/etc/paths.d/ncbi_blast" -- DEFAULT + + if not DasExist(blast_path) then + return + end if + -- Discover actual BLAST+ binaries location by reading PATH settings + set blast_bin_path to (read file blast_path) + set blast_user_folder to POSIX file findAndReplaceInText(blast_bin_path, "/bin" & linefeed, "") + -- log "DEBUG: READ: blast_bin_path: " & blast_bin_path + + -- Ask user to actually uninstall BLAST+ binaries? + set theAlertText to "Attention" + set theAlertMessage to "Proceed to uninstall BLAST+ binaries " & linefeed & "from " & POSIX file blast_user_folder & " ?" & linefeed & linefeed & linefeed & linefeed & linefeed & svn_date + set user_choice to button returned of (display alert theAlertText message theAlertMessage as critical buttons {"Don't Continue", "Continue"} default button "Continue" cancel button "Don't Continue") + if user_choice is "Don't Continue" then return + + -- log "DO UNINSTALL." + -- log "blast_folder (default): " & blast_folder + -- log "blast_user_folder (from path): " & blast_user_folder + + + + + -- Check if anything to delete... + if DasExist(blast_user_folder) then + -- Actual deletion. + try + -- Actual delete operation + tell application "Finder" + delete (files of folder blast_user_folder) & (folders of folder blast_user_folder) & (delete blast_user_folder) & (delete blast_path) + -- log blast_user_folder + end tell + on error e number n + -- display dialog "Uninstallation error code: " & n & " : " & e + end try + display dialog "BLAST+ binaries uninstalled and moved to Trash" + end if + + + +end run + +-- Utility function check file/folder existance via resolving alias +-- https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_fundamentals.html#//apple_ref/doc/uid/TP40000983-CH218-SW28 +on DasExist(checked_file_folder) + try + alias checked_file_folder + return true + on error + return false + end try +end DasExist + +-- Utility function: string find/replace +-- https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/ManipulateText.html +-- +on findAndReplaceInText(theText, theSearchString, theReplacementString) + set AppleScript's text item delimiters to theSearchString + set theTextItems to every text item of theText + set AppleScript's text item delimiters to theReplacementString + set theText to theTextItems as string + set AppleScript's text item delimiters to "" + return theText +end findAndReplaceInText diff --git a/c++/scripts/projects/blast/post_build/make_installers.py b/c++/scripts/projects/blast/post_build/make_installers.py index aa2b3221..ec713441 100755 --- a/c++/scripts/projects/blast/post_build/make_installers.py +++ b/c++/scripts/projects/blast/post_build/make_installers.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """Driver program for post-build processing""" -# $Id: make_installers.py 667857 2023-05-22 20:23:21Z camacho $ +# $Id: make_installers.py 677959 2024-01-25 20:27:47Z camacho $ # # Author: Christiam Camacho # @@ -54,7 +54,7 @@ def main(): #IGNORE:R0911 if platform == "FreeBSD32" or platform.startswith("SunOS") or \ platform.startswith("Linux32"): return do_nothing(platform) - if platform.startswith("IntelMAC"): + if platform.startswith("ArmMAC"): return mac_post_build(installdir, blast_version) print("Unknown OS identifier:" + platform, file=sys.stderr) diff --git a/c++/scripts/projects/blast/post_build/rpm/ncbi-blast.spec b/c++/scripts/projects/blast/post_build/rpm/ncbi-blast.spec index 83b0290f..33578706 100644 --- a/c++/scripts/projects/blast/post_build/rpm/ncbi-blast.spec +++ b/c++/scripts/projects/blast/post_build/rpm/ncbi-blast.spec @@ -1,6 +1,6 @@ Name: ncbi-blast Version: BLAST_VERSION+ -Release: 3 +Release: 1 Source0: %{name}-%{version}.tgz Summary: NCBI BLAST finds regions of similarity between biological sequences. Exclusiveos: linux diff --git a/c++/scripts/projects/blast/project.lst b/c++/scripts/projects/blast/project.lst index cf98b9c3..9392983c 100644 --- a/c++/scripts/projects/blast/project.lst +++ b/c++/scripts/projects/blast/project.lst @@ -37,10 +37,7 @@ util$ util/tables$ util/creaders$ util/checksum -util/compress$ -util/compress/bzip2$ -util/compress/zlib$ -util/compress/api +util/compress util/regexp util/xregexp util/sequtil$ @@ -109,6 +106,7 @@ objtools/simple$ sra$ sra/data_loaders -sra/data_loaders/wgs/test +-sra/data_loaders/snp/test sra/readers$ sra/readers/sra/impl$ sra/readers/bam$ diff --git a/c++/scripts/projects/cobalt/post_build/blast_utils.py b/c++/scripts/projects/cobalt/post_build/blast_utils.py index 2209bef5..70af361a 100644 --- a/c++/scripts/projects/cobalt/post_build/blast_utils.py +++ b/c++/scripts/projects/cobalt/post_build/blast_utils.py @@ -89,7 +89,7 @@ def create_new_tarball_name(platform, program, version): retval += "-ia32-linux" elif platform.startswith("Linux64"): retval += "-x64-linux" - elif platform.startswith("IntelMAC"): + elif platform.startswith("ArmMAC"): retval += "-x64-macosx" elif platform == "SunOSSparc": retval += "-sparc64-solaris" @@ -123,6 +123,6 @@ def determine_platform(): else: return "Win32" elif p.find("darwin") != -1: - return "IntelMAC" + return "ArmMAC" else: raise RuntimeError("Unknown platform: " + p) diff --git a/c++/scripts/projects/cobalt/post_build/make_installers.py b/c++/scripts/projects/cobalt/post_build/make_installers.py index e18ac8d2..198fb549 100755 --- a/c++/scripts/projects/cobalt/post_build/make_installers.py +++ b/c++/scripts/projects/cobalt/post_build/make_installers.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """Driver program for post-build processing""" -# $Id: make_installers.py 544372 2017-08-22 17:51:41Z boratyng $ +# $Id: make_installers.py 677967 2024-01-25 20:34:59Z camacho $ # # Author: Christiam Camacho # @@ -41,7 +41,7 @@ def main(): #IGNORE:R0911 if platform == "FreeBSD32" or platform.startswith("SunOS") or \ platform.startswith("Linux32"): return do_nothing(platform) - if platform.startswith("IntelMAC"): + if platform.startswith("ArmMAC"): return mac_post_build(installdir, blast_version) print("Unknown OS identifier:" + platform, file=sys.stderr) diff --git a/c++/scripts/projects/datatool/ChangeLog b/c++/scripts/projects/datatool/ChangeLog index 20bc5bf5..20f8b935 100644 --- a/c++/scripts/projects/datatool/ChangeLog +++ b/c++/scripts/projects/datatool/ChangeLog @@ -208,3 +208,7 @@ Added generation of gitignore. February 24, 2023, CXX-12875 version 2.23.1 Corrected list of generated files, added RPC client ones. + +April 15, 2024, CXX-13563 +version 2.24.0 +Dropped generation of empty union. diff --git a/c++/scripts/projects/datatool/Manifest b/c++/scripts/projects/datatool/Manifest index fc12e94e..6615caed 100644 --- a/c++/scripts/projects/datatool/Manifest +++ b/c++/scripts/projects/datatool/Manifest @@ -1,7 +1,7 @@ # # Filename: Manifest # -# $Id: Manifest 649757 2022-05-10 14:01:12Z gouriano $ +# $Id: Manifest 681808 2024-04-15 17:33:26Z gouriano $ # # Author: Sergey Satskiy # @@ -31,7 +31,8 @@ Linux64-Ubuntu : plain : GCC.sh --without-debug --without-mt --with-stati FreeBSD64 : plain : Clang.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --without-ncbi-c --without-downloaded-vdb -IntelMAC : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --without-ncbi-c --without-downloaded-vdb +#IntelMAC : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --without-ncbi-c --without-downloaded-vdb +ArmMAC : plain : Clang.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --without-ncbi-c --without-downloaded-vdb Win64_19 : static-64 : static 64 ReleaseMT diff --git a/c++/scripts/projects/datatool/components.link b/c++/scripts/projects/datatool/components.link index af651d61..e3ffcdf3 100644 --- a/c++/scripts/projects/datatool/components.link +++ b/c++/scripts/projects/datatool/components.link @@ -1,3 +1,3 @@ [components] -infrastructure 27.0 -core 27.0 +infrastructure 28.0 +core 28.0 diff --git a/c++/scripts/projects/dispatcher/ChangeLog b/c++/scripts/projects/dispatcher/ChangeLog deleted file mode 100644 index e69de29b..00000000 diff --git a/c++/scripts/projects/dispatcher/LICENSE b/c++/scripts/projects/dispatcher/LICENSE deleted file mode 100644 index f3577c23..00000000 --- a/c++/scripts/projects/dispatcher/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ - PUBLIC DOMAIN NOTICE - National Center for Biotechnology Information - - This software/database is a "United States Government Work" under the - terms of the United States Copyright Act. It was written as part of - the author's official duties as a United States Government employee and - thus cannot be copyrighted. This software/database is freely available - to the public for use. The National Library of Medicine and the U.S. - Government have not placed any restriction on its use or reproduction. - - Although all reasonable efforts have been taken to ensure the accuracy - and reliability of the software and data, the NLM and the U.S. - Government do not and cannot warrant the performance or results that - may be obtained by using this software or data. The NLM and the U.S. - Government disclaim all warranties, express or implied, including - warranties of performance, merchantability or fitness for any particular - purpose. - - Please cite the author in any work or product based on this material. diff --git a/c++/scripts/projects/dispatcher/Manifest b/c++/scripts/projects/dispatcher/Manifest deleted file mode 100644 index c3e726f8..00000000 --- a/c++/scripts/projects/dispatcher/Manifest +++ /dev/null @@ -1,40 +0,0 @@ -# $Id: Manifest 620990 2020-12-03 17:40:24Z lavr $ -# -# Author: Sergey Satskiy -# -# Purpose: This file holds all the supported configurations of a package. -# It is used by release configurator. -# - -APP: lbsmd lbsmc lbsm_feedback -APP: launcherd fwdaemon servnsd dispd.cgi -APP: ncbi_dblb_cli - -LIB: libconnect.a libconnext.a libmghbn.a liblbsmdapi.a - -DEFAULT_CONFIGURATIONS: Linux64-Centos:GCC - -COPY: $bindir/test_mghbn $installdir/bin/ncbi_mghbn -COPY: $bindir/test_ncbi_dblb $installdir/bin/ncbi_dblb -COPY: $srcdir/src/connect/daemons/mod/*mod* $installdir/src/ -COPY: $srcdir/include/connect/*.h $installdir/include/connect/ -COPY: $srcdir/include/connect/ext/*.h $installdir/include/connect/ext/ -COPY: $srcdir/include/connect/daemons/*.h $installdir/include/connect/daemons/ -COPY: $srcdir/include/internal/signon3/id.h $installdir/include/internal/signon3/ - -POSTBUILD: [ "$platform" != "Cygwin64" ] || { cp -vp /bin/cyg{check,runsrv}.exe $installdir/bin/; } -POSTBUILD: [ "$platform" != "Cygwin64" ] || { cp -vp /bin/cyg{bz2-1,iconv-2,intl-8,win1,z}.dll $installdir/bin/; } -POSTBUILD: [ "$platform" != "Cygwin64" ] || { cp -vp /usr/{bin/ipcs,bin/true,sbin/cygserver}.exe $installdir/bin/; } - -# Each line describes a single configuration -# The format is as follows: -# : : -# Configuration script is relative to c++/compilers/unix/ . -# Release configurator assumes that this script will eventually call standard configure script and pass all options -# to it. So some standard options may be added by release configurator, such as --build-root-sfx, --with-projects, -# --with-distcc, --with-action etc. -Linux64-Centos : ICC : ICC.sh --without-debug --without-mt --with-static --without-runpath --with-local-lbsm --without-gnutls --without-vdb --without-serial --with-flat-makefile -Linux64-Centos : GCC : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-local-lbsm --without-gnutls --without-vdb --without-serial --with-flat-makefile -FreeBSD64 : Clang : Clang.sh --without-debug --without-mt --with-static --without-runpath --with-local-lbsm --without-gnutls --without-vdb --without-serial --with-flat-makefile -IntelMAC : GCC : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-local-lbsm --without-gnutls --without-vdb --without-serial --with-flat-makefile -Cygwin64 : GCC : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-local-lbsm --without-gnutls --without-vdb --without-serial --without-flat-makefile --with-bin-release --with-connext --with-ncbi-crypt --without-krb5 LDFLAGS=-static-libgcc diff --git a/c++/scripts/projects/dispatcher/README b/c++/scripts/projects/dispatcher/README deleted file mode 100644 index 6f00861d..00000000 --- a/c++/scripts/projects/dispatcher/README +++ /dev/null @@ -1 +0,0 @@ -https://ncbi.github.io/cxx-toolkit/pages/ch_app#ch_app.Load_Balancing diff --git a/c++/scripts/projects/dispatcher/project.lst b/c++/scripts/projects/dispatcher/project.lst deleted file mode 100644 index f21a40e2..00000000 --- a/c++/scripts/projects/dispatcher/project.lst +++ /dev/null @@ -1,26 +0,0 @@ -./include/corelib/impl$ -./include/common$ -./include/util$ -corelib$ -connect$ -connect/ext -connect/mbedtls -connect/daemons$ -connect/daemons/mod$ -internal/signon3$ update-only -app$ -app/dblb -dbapi$ -dbapi/driver$ -dbapi/driver/impl$ -dbapi/driver/util$ -dbapi/driver/odbc/unix_odbc$ update-only -dbapi/driver/ctlib$ -dbapi/driver/ftds100$ -dbapi/driver/ftds100/impl -dbapi/driver/ftds100/ctlib$ -dbapi/driver/ftds100/freetds --dbapi/driver/ftds100/ctlib/samples -dbapi/driver/ftds-default -dbapi/simple$ -util diff --git a/c++/scripts/projects/fwdaemon/ChangeLog b/c++/scripts/projects/fwdaemon/ChangeLog deleted file mode 100644 index 2d08cc9b..00000000 --- a/c++/scripts/projects/fwdaemon/ChangeLog +++ /dev/null @@ -1,2 +0,0 @@ -Apr 12, 2011 -prepare_release framework configuration initialised for the project diff --git a/c++/scripts/projects/fwdaemon/LICENSE b/c++/scripts/projects/fwdaemon/LICENSE deleted file mode 100644 index f3577c23..00000000 --- a/c++/scripts/projects/fwdaemon/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ - PUBLIC DOMAIN NOTICE - National Center for Biotechnology Information - - This software/database is a "United States Government Work" under the - terms of the United States Copyright Act. It was written as part of - the author's official duties as a United States Government employee and - thus cannot be copyrighted. This software/database is freely available - to the public for use. The National Library of Medicine and the U.S. - Government have not placed any restriction on its use or reproduction. - - Although all reasonable efforts have been taken to ensure the accuracy - and reliability of the software and data, the NLM and the U.S. - Government do not and cannot warrant the performance or results that - may be obtained by using this software or data. The NLM and the U.S. - Government disclaim all warranties, express or implied, including - warranties of performance, merchantability or fitness for any particular - purpose. - - Please cite the author in any work or product based on this material. diff --git a/c++/scripts/projects/fwdaemon/Manifest b/c++/scripts/projects/fwdaemon/Manifest deleted file mode 100644 index 92c5c8fa..00000000 --- a/c++/scripts/projects/fwdaemon/Manifest +++ /dev/null @@ -1,21 +0,0 @@ -# -# Filename: Manifest -# -# $Id: Manifest 562491 2018-04-23 15:59:02Z fukanchi $ -# -# Author: Alexey Rafanovich -# -# Purpose: This file holds all the supported configurations of a package -# It is used by release configurator. -# - -APP: fwdaemon - -COPY: $srcdir/src/connect/daemons/fwdaemon_conn_stats.py $installdir/ -COPY: $srcdir/src/connect/daemons/fwdaemon_fallback_cmp.py $installdir/ -COPY: $srcdir/src/connect/daemons/fwdaemon_high_load_analysis.py $installdir/ -COPY: $srcdir/src/connect/daemons/fwdaemon_purge_abusers.py $installdir/ - -DEFAULT_CONFIGURATIONS: Linux64-Centos:GCC - -Linux64-Centos : GCC : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-local-lbsm --without-gnutls --without-vdb --without-serial --with-flat-makefile diff --git a/c++/scripts/projects/fwdaemon/README b/c++/scripts/projects/fwdaemon/README deleted file mode 100644 index f9994e3c..00000000 --- a/c++/scripts/projects/fwdaemon/README +++ /dev/null @@ -1 +0,0 @@ -http://www.ncbi.nlm.nih.gov/toolkit/doc/book/ch_app/#ch_app.Firewall_Daemon_FWDa diff --git a/c++/scripts/projects/fwdaemon/project.lst b/c++/scripts/projects/fwdaemon/project.lst deleted file mode 100644 index 02647158..00000000 --- a/c++/scripts/projects/fwdaemon/project.lst +++ /dev/null @@ -1,6 +0,0 @@ -#define TAGS fwdaemon -./include/corelib$ -./include/util$ -connect$ -connect/ext$ -connect/daemons$ diff --git a/c++/scripts/projects/igblast/Manifest b/c++/scripts/projects/igblast/Manifest index 090c2d6d..0db632c9 100644 --- a/c++/scripts/projects/igblast/Manifest +++ b/c++/scripts/projects/igblast/Manifest @@ -1,7 +1,7 @@ # # Filename: Manifest # -# $Id: Manifest 665694 2023-04-11 20:01:33Z jianye $ +# $Id: Manifest 679124 2024-02-16 20:40:08Z camacho $ # # Author: Christiam Camacho # @@ -53,4 +53,8 @@ Win64 : plain : static 64 ReleaseDLL IntelMAC : clang : Clang.sh --without-dll --with-bin-release --without-debug --without-pcre --without-openmp --with-mt --with-flat-makefile --with-ncbi-public --with-vdb=/net/snowman/vol/projects/trace_software/vdb/vdb-versions/cxx_toolkit/2 --with-static-vdb --without-gnutls --without-gcrypt --with-libuv=/netopt/ncbi_tools/libuv-1.35.0 --with-nghttp2=/netopt/ncbi_tools/nghttp2-1.40.0 --without-python --without-lzo --without-zstd +ArmMAC : clang : Clang.sh --without-dll --with-bin-release --without-debug --without-pcre --without-openmp --with-mt --with-flat-makefile --with-ncbi-public --with-vdb=/net/snowman/vol/projects/trace_software/vdb/vdb-versions/cxx_toolkit/3 --with-static-vdb --without-gnutls --without-gcrypt --with-libuv=/netopt/ncbi_tools/libuv-1.35.0 --with-nghttp2=/netopt/ncbi_tools/nghttp2-1.40.0 --without-python --without-lzo --without-zstd + +ArmMAC : clang-x86 : ../../configure --host=x86_64-apple-darwin21 --without-dll --with-bin-release --without-debug --without-pcre --without-openmp --with-mt --with-flat-makefile --with-ncbi-public --with-vdb=/net/snowman/vol/projects/trace_software/vdb/vdb-versions/cxx_toolkit/3 --with-static-vdb --without-gnutls --without-gcrypt --with-libuv=/netopt/ncbi_tools/libuv-1.35.0 --with-nghttp2=/netopt/ncbi_tools/nghttp2-1.40.0 --without-python --without-lzo --without-zstd CC='clang -arch x86_64';CXX='clang++ -arch x86_64' + USE_COMPONENTS diff --git a/c++/scripts/projects/igblast/post_build/blast_utils.py b/c++/scripts/projects/igblast/post_build/blast_utils.py index ef9940df..de049630 100644 --- a/c++/scripts/projects/igblast/post_build/blast_utils.py +++ b/c++/scripts/projects/igblast/post_build/blast_utils.py @@ -89,7 +89,7 @@ def create_new_tarball_name(platform, program, version): retval += "-ia32-linux" elif platform.startswith("Linux64"): retval += "-x64-linux" - elif platform.startswith("IntelMAC"): + elif platform.startswith("ArmMAC"): retval += "-x64-macosx" elif platform == "SunOSSparc": retval += "-sparc64-solaris" @@ -123,6 +123,6 @@ def determine_platform(): else: return "Win32" elif p.find("darwin") != -1: - return "IntelMAC" + return "ArmMAC" else: raise RuntimeError("Unknown platform: " + p) diff --git a/c++/scripts/projects/igblast/post_build/make_installers.py b/c++/scripts/projects/igblast/post_build/make_installers.py index df499aad..70be0a37 100755 --- a/c++/scripts/projects/igblast/post_build/make_installers.py +++ b/c++/scripts/projects/igblast/post_build/make_installers.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """Driver program for post-build processing""" -# $Id: make_installers.py 667857 2023-05-22 20:23:21Z camacho $ +# $Id: make_installers.py 677969 2024-01-25 20:35:09Z camacho $ # # Author: Christiam Camacho # @@ -55,7 +55,7 @@ def main(): #IGNORE:R0911 if platform == "FreeBSD32" or platform.startswith("SunOS") or \ platform.startswith("Linux32"): return do_nothing(platform) - if platform.startswith("IntelMAC"): + if platform.startswith("ArmMAC"): return mac_post_build(installdir, blast_version) print("Unknown OS identifier:" + platform, file=sys.stderr) diff --git a/c++/scripts/projects/igblast/project.lst b/c++/scripts/projects/igblast/project.lst index 35677fe9..c72871e7 100644 --- a/c++/scripts/projects/igblast/project.lst +++ b/c++/scripts/projects/igblast/project.lst @@ -35,10 +35,7 @@ util$ util/creaders$ util/tables$ util/checksum -util/compress$ -util/compress/bzip2$ -util/compress/zlib$ -util/compress/api +util/compress util/regexp util/xregexp util/sequtil$ diff --git a/c++/scripts/projects/lbsbd/ChangeLog b/c++/scripts/projects/lbsbd/ChangeLog deleted file mode 100644 index 81504bf2..00000000 --- a/c++/scripts/projects/lbsbd/ChangeLog +++ /dev/null @@ -1,2 +0,0 @@ -Sep 11, 2011 -prepare_release framework configuration initialised for the project diff --git a/c++/scripts/projects/lbsbd/LICENSE b/c++/scripts/projects/lbsbd/LICENSE deleted file mode 100644 index f3577c23..00000000 --- a/c++/scripts/projects/lbsbd/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ - PUBLIC DOMAIN NOTICE - National Center for Biotechnology Information - - This software/database is a "United States Government Work" under the - terms of the United States Copyright Act. It was written as part of - the author's official duties as a United States Government employee and - thus cannot be copyrighted. This software/database is freely available - to the public for use. The National Library of Medicine and the U.S. - Government have not placed any restriction on its use or reproduction. - - Although all reasonable efforts have been taken to ensure the accuracy - and reliability of the software and data, the NLM and the U.S. - Government do not and cannot warrant the performance or results that - may be obtained by using this software or data. The NLM and the U.S. - Government disclaim all warranties, express or implied, including - warranties of performance, merchantability or fitness for any particular - purpose. - - Please cite the author in any work or product based on this material. diff --git a/c++/scripts/projects/lbsbd/Manifest b/c++/scripts/projects/lbsbd/Manifest deleted file mode 100644 index 66e10c4e..00000000 --- a/c++/scripts/projects/lbsbd/Manifest +++ /dev/null @@ -1,16 +0,0 @@ -# -# Filename: Manifest -# -# $Id -# -# Author: Alexey Rafanovich -# -# Purpose: This file holds all the supported configurations of a package -# It is used by release configurator. -# - -APP: lbsbd - -DEFAULT_CONFIGURATIONS: Linux64-Centos:GCC - -Linux64-Centos : GCC : GCC.sh 4.4.2 --without-debug --without-mt --with-static --without-version --without-serial --without-runpath --with-flat-makefile diff --git a/c++/scripts/projects/lbsbd/README b/c++/scripts/projects/lbsbd/README deleted file mode 100644 index e69de29b..00000000 diff --git a/c++/scripts/projects/lbsbd/project.lst b/c++/scripts/projects/lbsbd/project.lst deleted file mode 100644 index cc33621b..00000000 --- a/c++/scripts/projects/lbsbd/project.lst +++ /dev/null @@ -1,5 +0,0 @@ -corelib$ -util$ -connect$ -connect/ext$ -connect/daemons$ diff --git a/c++/scripts/projects/magicblast/Manifest b/c++/scripts/projects/magicblast/Manifest index 9a992843..4a900641 100644 --- a/c++/scripts/projects/magicblast/Manifest +++ b/c++/scripts/projects/magicblast/Manifest @@ -45,6 +45,10 @@ Win64 : plain : static 64 ReleaseDLL NCBI_CONFIG____ENABLEDUSERRE #IntelMAC : gcc : GCC.sh --with-bin-release --without-debug --without-pcre --with-mt --with-openmp --with-flat-makefile --with-ncbi-public --with-vdb=/net/traces01.be-md.ncbi.nlm.nih.gov/trace_software/vdb --with-static-vdb #IntelMAC : clang : Clang.sh --with-bin-release --without-debug --without-pcre --with-mt --with-openmp --with-flat-makefile --with-ncbi-public --with-vdb=/net/traces01.be-md.ncbi.nlm.nih.gov/trace_software/vdb --with-static-vdb --without-gnutls --without-gcrypt -IntelMAC : clang : Clang.sh --without-dll --with-bin-release --without-debug --without-pcre --with-mt --without-openmp --with-flat-makefile --with-ncbi-public --with-vdb=/net/traces01.be-md.ncbi.nlm.nih.gov/trace_software/vdb --with-static-vdb --without-gnutls --without-gcrypt --without-lzo --without-zstd +IntelMAC : clang : Clang.sh --without-dll --with-bin-release --without-debug --without-pcre --with-mt --without-openmp --with-flat-makefile --with-ncbi-public --with-vdb=/net/traces01.be-md.ncbi.nlm.nih.gov/trace_software/vdb --with-static-vdb --without-gnutls --without-gcrypt --without-lzo --without-zstd + +ArmMAC : clang : Clang.sh --without-dll --with-bin-release --without-debug --without-pcre --with-mt --without-openmp --with-flat-makefile --with-ncbi-public --with-vdb=/net/snowman/vol/projects/trace_software/vdb/vdb-versions/cxx_toolkit/3 --with-static-vdb --without-gnutls --without-gcrypt --without-lzo --without-zstd + +ArmMAC : clang-x86 : ../../configure --host=x86_64-apple-darwin21 --without-dll --with-bin-release --without-debug --without-pcre --with-mt --without-openmp --with-flat-makefile --with-ncbi-public --with-vdb=/net/snowman/vol/projects/trace_software/vdb/vdb-versions/cxx_toolkit/3 --with-static-vdb --without-gnutls --without-gcrypt --without-lzo --without-zstd CC='clang -arch x86_64';CXX='clang++ -arch x86_64' USE_COMPONENTS diff --git a/c++/scripts/projects/magicblast/post_build/blast_utils.py b/c++/scripts/projects/magicblast/post_build/blast_utils.py index 2209bef5..70af361a 100644 --- a/c++/scripts/projects/magicblast/post_build/blast_utils.py +++ b/c++/scripts/projects/magicblast/post_build/blast_utils.py @@ -89,7 +89,7 @@ def create_new_tarball_name(platform, program, version): retval += "-ia32-linux" elif platform.startswith("Linux64"): retval += "-x64-linux" - elif platform.startswith("IntelMAC"): + elif platform.startswith("ArmMAC"): retval += "-x64-macosx" elif platform == "SunOSSparc": retval += "-sparc64-solaris" @@ -123,6 +123,6 @@ def determine_platform(): else: return "Win32" elif p.find("darwin") != -1: - return "IntelMAC" + return "ArmMAC" else: raise RuntimeError("Unknown platform: " + p) diff --git a/c++/scripts/projects/magicblast/post_build/make_installers.py b/c++/scripts/projects/magicblast/post_build/make_installers.py index a0beffc9..f6bab635 100755 --- a/c++/scripts/projects/magicblast/post_build/make_installers.py +++ b/c++/scripts/projects/magicblast/post_build/make_installers.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """Driver program for post-build processing""" -# $Id: make_installers.py 667857 2023-05-22 20:23:21Z camacho $ +# $Id: make_installers.py 677968 2024-01-25 20:35:05Z camacho $ # # Author: Christiam Camacho # @@ -56,7 +56,7 @@ def main(): #IGNORE:R0911 if platform == "FreeBSD32" or platform.startswith("SunOS") or \ platform.startswith("Linux32"): return do_nothing(platform) - if platform.startswith("IntelMAC"): + if platform.startswith("ArmMAC"): return mac_post_build(installdir, blast_version) print("Unknown OS identifier:" + platform, file=sys.stderr) diff --git a/c++/scripts/projects/magicblast/project.lst b/c++/scripts/projects/magicblast/project.lst index 541a9594..d6029d37 100644 --- a/c++/scripts/projects/magicblast/project.lst +++ b/c++/scripts/projects/magicblast/project.lst @@ -38,10 +38,7 @@ util$ util/creaders$ util/tables$ util/checksum -util/compress$ -util/compress/bzip2$ -util/compress/zlib$ -util/compress/api +util/compress util/regexp util/xregexp util/sequtil$ diff --git a/c++/scripts/projects/mod_caf/ChangeLog b/c++/scripts/projects/mod_caf/ChangeLog deleted file mode 100644 index cf925235..00000000 --- a/c++/scripts/projects/mod_caf/ChangeLog +++ /dev/null @@ -1,2 +0,0 @@ -Feb 23, 2018 -PrepareRelease framework initialised diff --git a/c++/scripts/projects/mod_caf/LICENSE b/c++/scripts/projects/mod_caf/LICENSE deleted file mode 100644 index f3577c23..00000000 --- a/c++/scripts/projects/mod_caf/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ - PUBLIC DOMAIN NOTICE - National Center for Biotechnology Information - - This software/database is a "United States Government Work" under the - terms of the United States Copyright Act. It was written as part of - the author's official duties as a United States Government employee and - thus cannot be copyrighted. This software/database is freely available - to the public for use. The National Library of Medicine and the U.S. - Government have not placed any restriction on its use or reproduction. - - Although all reasonable efforts have been taken to ensure the accuracy - and reliability of the software and data, the NLM and the U.S. - Government do not and cannot warrant the performance or results that - may be obtained by using this software or data. The NLM and the U.S. - Government disclaim all warranties, express or implied, including - warranties of performance, merchantability or fitness for any particular - purpose. - - Please cite the author in any work or product based on this material. diff --git a/c++/scripts/projects/mod_caf/Manifest b/c++/scripts/projects/mod_caf/Manifest deleted file mode 100644 index 832f6d34..00000000 --- a/c++/scripts/projects/mod_caf/Manifest +++ /dev/null @@ -1,18 +0,0 @@ -# -# Filename: Manifest -# -# $Id: Manifest 581233 2019-02-26 20:58:29Z fukanchi $ -# -# Author: Sergey Fukanchik, NCBI -# -# Purpose: This file holds all the supported configurations of a package -# It is used by release configurator. -# - -APP: test_lbsmdapi -LIB: libconnect.a libconnext.a liblbsmdapi.a libmghbn.a -SRC: src/connect/daemons/mod/mod_caf.c src/connect/daemons/mod/README.mod_caf - -Linux64-Centos : gcc : GCC.sh --without-debug --with-mt --with-64 --with-static --without-runpath --with-local-lbsm --without-gnutls --without-vdb --with-flat-makefile -Linux64-Centos : gcc-dbg : GCC.sh --with-debug --with-mt --with-64 --with-static --without-runpath --with-local-lbsm --without-gnutls --without-vdb --with-flat-makefile - diff --git a/c++/scripts/projects/mod_caf/README b/c++/scripts/projects/mod_caf/README deleted file mode 100644 index 48f82d3c..00000000 --- a/c++/scripts/projects/mod_caf/README +++ /dev/null @@ -1 +0,0 @@ -MOD_CAF diff --git a/c++/scripts/projects/mod_caf/project.lst b/c++/scripts/projects/mod_caf/project.lst deleted file mode 100644 index 00bb5040..00000000 --- a/c++/scripts/projects/mod_caf/project.lst +++ /dev/null @@ -1,8 +0,0 @@ -#define TAGS mod_caf -common$ -corelib$ update-only -connect$ -connect/ext$ -connect/daemons$ -connect/daemons/mod$ -internal/signon3$ update-only diff --git a/c++/scripts/projects/mod_loadinfo/ChangeLog b/c++/scripts/projects/mod_loadinfo/ChangeLog deleted file mode 100644 index 5cfe401c..00000000 --- a/c++/scripts/projects/mod_loadinfo/ChangeLog +++ /dev/null @@ -1,2 +0,0 @@ -Mar 07, 2012 -PrepareRelease framework initialised diff --git a/c++/scripts/projects/mod_loadinfo/LICENSE b/c++/scripts/projects/mod_loadinfo/LICENSE deleted file mode 100644 index f3577c23..00000000 --- a/c++/scripts/projects/mod_loadinfo/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ - PUBLIC DOMAIN NOTICE - National Center for Biotechnology Information - - This software/database is a "United States Government Work" under the - terms of the United States Copyright Act. It was written as part of - the author's official duties as a United States Government employee and - thus cannot be copyrighted. This software/database is freely available - to the public for use. The National Library of Medicine and the U.S. - Government have not placed any restriction on its use or reproduction. - - Although all reasonable efforts have been taken to ensure the accuracy - and reliability of the software and data, the NLM and the U.S. - Government do not and cannot warrant the performance or results that - may be obtained by using this software or data. The NLM and the U.S. - Government disclaim all warranties, express or implied, including - warranties of performance, merchantability or fitness for any particular - purpose. - - Please cite the author in any work or product based on this material. diff --git a/c++/scripts/projects/mod_loadinfo/Manifest b/c++/scripts/projects/mod_loadinfo/Manifest deleted file mode 100644 index f740b0f2..00000000 --- a/c++/scripts/projects/mod_loadinfo/Manifest +++ /dev/null @@ -1,17 +0,0 @@ -# -# Filename: Manifest -# -# $Id: Manifest 359988 2012-04-18 20:21:17Z rafanovi $ -# -# Author: Alexey Rafanovich -# -# Purpose: This file holds all the supported configurations of a package -# It is used by release configurator. -# - -APP: test_lbsmdapi -LIB: libconnect.a liblbsmdapi.a - -POSTBUILD: $srcdir/src/connect/daemons/mod/pull_prepare_release.sh `readlink -f $srcdir` `readlink -f $installdir` - -Linux64-Centos : gcc : GCC.sh --without-debug --with-mt --with-64 --with-static --without-runpath --with-flat-makefile diff --git a/c++/scripts/projects/mod_loadinfo/README b/c++/scripts/projects/mod_loadinfo/README deleted file mode 100644 index 58d777ac..00000000 --- a/c++/scripts/projects/mod_loadinfo/README +++ /dev/null @@ -1 +0,0 @@ -MOD_LOADINFO diff --git a/c++/scripts/projects/mod_loadinfo/project.lst b/c++/scripts/projects/mod_loadinfo/project.lst deleted file mode 100644 index 3fe31363..00000000 --- a/c++/scripts/projects/mod_loadinfo/project.lst +++ /dev/null @@ -1,6 +0,0 @@ -#define TAGS mod_loadinfo -corelib$ -common$ -connect$ -connect/daemons$ -connect/daemons/mod$ diff --git a/c++/scripts/projects/ncbi_applog/ChangeLog b/c++/scripts/projects/ncbi_applog/ChangeLog index 5d3750ae..98614967 100644 --- a/c++/scripts/projects/ncbi_applog/ChangeLog +++ b/c++/scripts/projects/ncbi_applog/ChangeLog @@ -1,3 +1,8 @@ +1.4.5 (03/29/2024) + Technical release, no any functionality changes + - Add Linux64-Alma and ArmMAC platforms, build with --with-bin-release. JIRA:CXX-13509 + - Build on Mac with --without-pcre. + 1.4.4 (09/29/2022) - NcbiLogP_Raw2() – improve choosing correct file handle for a "file" destination. CXX-12534 - Add a guard on a local file reopening and disable logging on a critical errors. CXX-12534 diff --git a/c++/scripts/projects/ncbi_applog/Manifest b/c++/scripts/projects/ncbi_applog/Manifest index 0b2188ba..f97c6106 100644 --- a/c++/scripts/projects/ncbi_applog/Manifest +++ b/c++/scripts/projects/ncbi_applog/Manifest @@ -1,7 +1,7 @@ # # Filename: Manifest # -# $Id: Manifest 653415 2022-07-27 17:43:38Z ivanov $ +# $Id: Manifest 680940 2024-03-29 17:52:22Z ivanov $ # # Author: Alexey Rafanovich # @@ -28,12 +28,14 @@ POSTBUILD: cp $srcdir/src/misc/clog/app/ncbi_applog_run_app.sh $installdir/bin # to it. So some standard options may be added by release configurator, such as --build-root-sfx, --with-projects, # --with-distcc, --with-action etc. -Linux64-Centos : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile -FreeBSD64 : plain : Clang.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile -IntelMAC : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile -Win64_19 : plain : static 64 ReleaseMT -Linux64-Ubuntu : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile -Linux64-Ubuntu-Public : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile +Linux64-Centos : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --with-bin-release +Linux64-Ubuntu : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --with-bin-release +Linux64-Ubuntu-Public : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --with-bin-release +Linux64-Alma : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --with-bin-release +FreeBSD64 : plain : Clang.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --with-bin-release +IntelMAC : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --with-bin-release --without-pcre +ArmMAC : plain : Clang.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --with-bin-release --without-pcre +Win64_19 : plain : static 64 ReleaseMT #USE_COMPONENTS # diff --git a/c++/scripts/projects/ncbi_cpp.lst b/c++/scripts/projects/ncbi_cpp.lst index 7ee784dc..14712918 100644 --- a/c++/scripts/projects/ncbi_cpp.lst +++ b/c++/scripts/projects/ncbi_cpp.lst @@ -8,7 +8,6 @@ ctools db dbapi html -internal/align_model$ internal/ID/utils$ internal/ID/utils/wgs$ internal/ID/utils/wgs/format$ diff --git a/c++/scripts/projects/ncbi_cpp_dll.lst b/c++/scripts/projects/ncbi_cpp_dll.lst index f7cb82dd..cc40e668 100644 --- a/c++/scripts/projects/ncbi_cpp_dll.lst +++ b/c++/scripts/projects/ncbi_cpp_dll.lst @@ -8,7 +8,6 @@ ctools db dbapi html -internal/align_model$ internal/ID/utils$ internal/ID/utils/wgs$ internal/ID/utils/wgs/format$ diff --git a/c++/scripts/projects/ncbi_gbench.lst b/c++/scripts/projects/ncbi_gbench.lst index 8353f5b7..e2385a92 100644 --- a/c++/scripts/projects/ncbi_gbench.lst +++ b/c++/scripts/projects/ncbi_gbench.lst @@ -21,8 +21,4 @@ misc/third_party -internal/gbench/app/treeview -internal/gbench/app/uud -internal/gbench/app/data_crawler --dbapi/driver/ftds100/freetds/ctlib/unittests --dbapi/driver/ftds100/freetds/dblib/unittests --dbapi/driver/ftds100/freetds/odbc/unittests --dbapi/driver/ftds100/freetds/tds/unittests --dbapi/driver/ftds100/freetds/replacements/unittests +-dbapi/driver/ftds.*/freetds/.*/unittests diff --git a/c++/scripts/projects/ncbi_gui_base.lst b/c++/scripts/projects/ncbi_gui_base.lst index c170542e..49617679 100644 --- a/c++/scripts/projects/ncbi_gui_base.lst +++ b/c++/scripts/projects/ncbi_gui_base.lst @@ -13,7 +13,6 @@ gui html internal/objects/alndb_query$ internal/grpcapi/ncbi/grpcapi/dbsnp -internal/align_model$ internal/contigdb$ internal/blast internal/asn_cache diff --git a/c++/scripts/projects/ncbi_mapview.lst b/c++/scripts/projects/ncbi_mapview.lst index c8a2eac7..ef211e62 100644 --- a/c++/scripts/projects/ncbi_mapview.lst +++ b/c++/scripts/projects/ncbi_mapview.lst @@ -11,7 +11,6 @@ dbapi gui html internal/algo/id_mapper -internal/align_model internal/idx internal/idxext internal/ilink diff --git a/c++/scripts/projects/netstorage/project.lst b/c++/scripts/projects/netstorage/project.lst index 66300dda..e97cfdb7 100644 --- a/c++/scripts/projects/netstorage/project.lst +++ b/c++/scripts/projects/netstorage/project.lst @@ -31,5 +31,7 @@ dbapi/driver/odbc/unix_odbc$ update-only dbapi/driver/ctlib$ dbapi/driver/ftds100 -dbapi/driver/ftds100/ctlib/samples +dbapi/driver/ftds14 +-dbapi/driver/ftds14/ctlib/samples dbapi/driver/ftds-default dbapi/simple$ diff --git a/c++/scripts/projects/netstorage_gc/project.lst b/c++/scripts/projects/netstorage_gc/project.lst index 69df250d..9f81386e 100644 --- a/c++/scripts/projects/netstorage_gc/project.lst +++ b/c++/scripts/projects/netstorage_gc/project.lst @@ -35,5 +35,15 @@ dbapi/driver/ftds100/freetds/ctlib$ dbapi/driver/ftds100/ctlib$ dbapi/driver/ftds100/impl update-only dbapi/driver/ftds100/freetds/replacements$ +dbapi/driver/ftds14$ +dbapi/driver/ftds14/freetds$ +dbapi/driver/ftds14/freetds/freetds update-only +dbapi/driver/ftds14/freetds/replacements update-only +dbapi/driver/ftds14/freetds/utils update-only +dbapi/driver/ftds14/freetds/tds$ +dbapi/driver/ftds14/freetds/ctlib$ +dbapi/driver/ftds14/ctlib$ +dbapi/driver/ftds14/impl update-only +dbapi/driver/ftds14/freetds/replacements$ dbapi/driver/ftds-default dbapi/simple$ diff --git a/c++/scripts/projects/project_tree_builder/ChangeLog b/c++/scripts/projects/project_tree_builder/ChangeLog index cae554a8..d3df24ee 100644 --- a/c++/scripts/projects/project_tree_builder/ChangeLog +++ b/c++/scripts/projects/project_tree_builder/ChangeLog @@ -402,3 +402,8 @@ Fixed definition of POST-BUILD step on XCode. March 30, 2022 version 4.12.2, CXX-12418 Extended features_and_packages lists to include all potentially required packages. + +November 30, 2023 +version 4.12.3, CXX-13323 +Ehanced support of Git and Subversion revision information. +Support PTB extensions in XCode metamakefile. diff --git a/c++/scripts/projects/project_tree_builder/Manifest b/c++/scripts/projects/project_tree_builder/Manifest index 309031bd..b1296c7e 100644 --- a/c++/scripts/projects/project_tree_builder/Manifest +++ b/c++/scripts/projects/project_tree_builder/Manifest @@ -1,7 +1,7 @@ # # Filename: Manifest # -# $Id: Manifest 638081 2021-09-23 12:45:49Z gouriano $ +# $Id: Manifest 675712 2023-11-30 16:53:27Z gouriano $ # # Author: Sergey Satskiy # @@ -29,11 +29,11 @@ Linux64-Ubuntu : plain : GCC.sh --without-pcre --without-libdw --wi FreeBSD64 : plain : Clang.sh --without-pcre --without-libdw --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --without-ncbi-c --without-pcre --without-downloaded-vdb -IntelMAC : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --without-ncbi-c --without-downloaded-vdb +IntelMAC : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --without-ncbi-c --without-downloaded-vdb --without-pcre Win64_19 : static-64 : static 64 ReleaseMT -XCode : plain : Xcode.sh 30 --without-debug --without-ncbi-c +XCode : plain : Xcode.sh 30 --without-debug --without-ncbi-c --without-pcre USE_COMPONENTS diff --git a/c++/scripts/projects/project_tree_builder/components.link b/c++/scripts/projects/project_tree_builder/components.link index e354cb46..e3ffcdf3 100644 --- a/c++/scripts/projects/project_tree_builder/components.link +++ b/c++/scripts/projects/project_tree_builder/components.link @@ -1,3 +1,3 @@ [components] -infrastructure 25.0 -core 25.0 +infrastructure 28.0 +core 28.0 diff --git a/c++/scripts/projects/psg_client/Manifest b/c++/scripts/projects/psg_client/Manifest index c2eb07d5..bdf33f86 100644 --- a/c++/scripts/projects/psg_client/Manifest +++ b/c++/scripts/projects/psg_client/Manifest @@ -1,7 +1,7 @@ # # Filename: Manifest # -# $Id: Manifest 672663 2023-09-12 18:18:22Z satskyse $ +# $Id: Manifest 677455 2024-01-16 17:19:32Z sadyrovr $ # # Author: Rafael Sadyrov # @@ -36,5 +36,7 @@ Linux64-Centos : Release : GCC.sh --without-debug --with-optimization -- Linux64-Centos : Debug : GCC.sh --with-debug --with-mt --without-bdb --without-runpath Linux64-Ubuntu : Release : GCC.sh --without-debug --with-optimization --with-symbols --with-mt --without-bdb --without-runpath Linux64-Ubuntu : Debug : GCC.sh --with-debug --with-mt --without-bdb --without-runpath +FreeBSD64 : Release : Clang.sh --without-debug --with-optimization --with-symbols --with-mt --without-bdb --without-runpath +FreeBSD64 : Debug : Clang.sh --with-debug --with-mt --without-bdb --without-runpath USE_COMPONENTS diff --git a/c++/scripts/projects/psg_client/components.link b/c++/scripts/projects/psg_client/components.link index 78fb4780..cdf438fd 100644 --- a/c++/scripts/projects/psg_client/components.link +++ b/c++/scripts/projects/psg_client/components.link @@ -3,5 +3,4 @@ infrastructure 28.0 core 28.0 misc 28.0 objects 28.0 -objtools 28.0 web 28.0 diff --git a/c++/scripts/projects/pubseq_gateway/Manifest b/c++/scripts/projects/pubseq_gateway/Manifest index 586637bb..d7eec9ae 100644 --- a/c++/scripts/projects/pubseq_gateway/Manifest +++ b/c++/scripts/projects/pubseq_gateway/Manifest @@ -1,7 +1,7 @@ # # Filename: Manifest # -# $Id: Manifest 673591 2023-10-04 16:56:27Z satskyse $ +# $Id: Manifest 682003 2024-04-18 20:54:51Z satskyse $ # # Author: Sergey Satskiy # @@ -26,14 +26,17 @@ DEFAULT_CONFIGURATIONS: Linux64-Centos:O2g # Release configurator assumes that this script will eventually call standard configure script and pass all options # to it. So some standard options may be added by release configurator, such as --build-root-sfx, --with-projects, # --with-distcc, --with-action etc. -Linux64-Centos : Release : GCC.sh 7.3.0 --without-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.16.0+uv1.42 --with-h2o=$NCBI/h2o-2.2.6-ncbi2 --with-lmdb=$NCBI/lmdb-0.9.24 -Linux64-Centos : Debug : GCC.sh 7.3.0 --with-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.16.0+uv1.42 --with-h2o=$NCBI/h2o-2.2.6-ncbi2 --with-lmdb=$NCBI/lmdb-0.9.24 -Linux64-Centos : O2g : GCC.sh 7.3.0 --without-debug --with-symbols --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.16.0+uv1.42 --with-h2o=$NCBI/h2o-2.2.6-ncbi2 --with-lmdb=$NCBI/lmdb-0.9.24 +Linux64-Centos : Release : GCC.sh 7.3.0 --without-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1 --with-h2o=$NCBI/h2o-2.2.6-ncbi3 --with-lmdb=$NCBI/lmdb-0.9.24 +Linux64-Centos : Debug : GCC.sh 7.3.0 --with-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1 --with-h2o=$NCBI/h2o-2.2.6-ncbi3 --with-lmdb=$NCBI/lmdb-0.9.24 +Linux64-Centos : O2g : GCC.sh 7.3.0 --without-debug --with-symbols --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1 --with-h2o=$NCBI/h2o-2.2.6-ncbi3 --with-lmdb=$NCBI/lmdb-0.9.24 -Linux64-Centos : O2gNoH2OPatch : GCC.sh 7.3.0 --without-debug --with-symbols --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.16.0+uv1.42 --with-h2o=$NCBI/h2o-2.2.6+uv1.42 --with-lmdb=$NCBI/lmdb-0.9.24 +Linux64-Centos : O2gNoH2OPatch : GCC.sh 7.3.0 --without-debug --with-symbols --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1 --with-h2o=$NCBI/h2o-2.2.6+uv1.42 --with-lmdb=$NCBI/lmdb-0.9.24 # --with-max-debug builds with a GCC sanitizer -Linux64-Centos : MaxDebug : GCC.sh 7.3.0 --with-max-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.16.0+uv1.42 --with-h2o=$NCBI/h2o-2.2.6-ncbi2 --with-lmdb=$NCBI/lmdb-0.9.24 -Linux64-Centos : MaxDebugNoH2OPatch : GCC.sh 7.3.0 --with-max-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.16.0+uv1.42 --with-h2o=$NCBI/h2o-2.2.6+uv1.42 --with-lmdb=$NCBI/lmdb-0.9.24 +Linux64-Centos : MaxDebug : GCC.sh 7.3.0 --with-max-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1 --with-h2o=$NCBI/h2o-2.2.6-ncbi3 --with-lmdb=$NCBI/lmdb-0.9.24 +Linux64-Centos : MaxDebugNoH2OPatch : GCC.sh 7.3.0 --with-max-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1 --with-h2o=$NCBI/h2o-2.2.6+uv1.42 --with-lmdb=$NCBI/lmdb-0.9.24 +Linux64-Alma : O2g : GCC.sh 7.3.0 --without-debug --with-symbols --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1+a8 --with-h2o=$NCBI/h2o-2.2.6-ncbi3+a8 --with-libssh2=$NCBI/libssh2-1.11.0 --with-lmdb=$NCBI/lmdb-0.9.24 +Linux64-Alma : O2gWithH2oAssert : GCC.sh 7.3.0 --without-debug --with-symbols --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1+a8 --with-h2o=$NCBI/h2o-2.2.6-ncbi3+a8/GCC730-DebugMT64 --with-libssh2=$NCBI/libssh2-1.11.0 --with-lmdb=$NCBI/lmdb-0.9.24 +Linux64-Alma : MaxDebug : GCC.sh 7.3.0 --with-max-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1+a8 --with-h2o=$NCBI/h2o-2.2.6-ncbi3+a8 --with-libssh2=$NCBI/libssh2-1.11.0 --with-lmdb=$NCBI/lmdb-0.9.24 # USE_COMPONENTS diff --git a/c++/scripts/projects/pubseq_gateway/project.lst b/c++/scripts/projects/pubseq_gateway/project.lst index 0661b663..5fa45b48 100644 --- a/c++/scripts/projects/pubseq_gateway/project.lst +++ b/c++/scripts/projects/pubseq_gateway/project.lst @@ -13,6 +13,7 @@ dbapi check dll misc$ +misc/xmlwrapp misc/third_party misc/third_party_static @@ -35,6 +36,7 @@ objtools/pubseq_gateway/impl objtools/pubseq_gateway/cache objtools/pubseq_gateway/protobuf objtools/pubseq_gateway/ipg +objtools/pubseq_gateway/myncbi objtools/cdd objtools/readers/sra objtools/logging @@ -91,9 +93,15 @@ util/bitset$ util/cache$ util/sequtil$ util/xregexp +util/regexp$ +util/regexp/testdata$ util/compress util/checksum +cgi +-cgi/demo +-cgi/test + sra$ sra/readers$ sra/readers/sra diff --git a/c++/scripts/projects/python_ncbi_dbapi/ChangeLog b/c++/scripts/projects/python_ncbi_dbapi/ChangeLog index 7b66da19..b7583409 100644 --- a/c++/scripts/projects/python_ncbi_dbapi/ChangeLog +++ b/c++/scripts/projects/python_ncbi_dbapi/ChangeLog @@ -1,3 +1,7 @@ +Version 1.25.4 (2023-10-27): +* Implement a set_logger extension. (This module historically always used + the root logger directly, and still does by default.) + Version 1.25.3 (2023-10-03): * Avoid prematurely freeing logging-related Python objects. diff --git a/c++/scripts/projects/python_ncbi_dbapi/project.lst b/c++/scripts/projects/python_ncbi_dbapi/project.lst index 02598573..e2104c04 100644 --- a/c++/scripts/projects/python_ncbi_dbapi/project.lst +++ b/c++/scripts/projects/python_ncbi_dbapi/project.lst @@ -22,6 +22,15 @@ dbapi/driver/ftds100/freetds/tds$ dbapi/driver/ftds100/freetds/replacements$ dbapi/driver/ftds100/freetds/ctlib$ dbapi/driver/ftds100/ctlib$ +dbapi/driver/ftds14$ +dbapi/driver/ftds14/impl$ update-only +dbapi/driver/ftds14/freetds$ +dbapi/driver/ftds14/freetds/freetds$ update-only +dbapi/driver/ftds14/freetds/replacements$ +dbapi/driver/ftds14/freetds/utils$ +dbapi/driver/ftds14/freetds/tds$ +dbapi/driver/ftds14/freetds/ctlib$ +dbapi/driver/ftds14/ctlib$ dbapi/driver/ftds-default$ dbapi/lang_bind$ dbapi/lang_bind/python diff --git a/c++/scripts/projects/xmlwrapp/Manifest b/c++/scripts/projects/xmlwrapp/Manifest index dc28e62e..f74dc869 100644 --- a/c++/scripts/projects/xmlwrapp/Manifest +++ b/c++/scripts/projects/xmlwrapp/Manifest @@ -1,7 +1,7 @@ # # Filename: Manifest # -# $Id: Manifest 669486 2023-06-30 18:02:16Z satskyse $ +# $Id: Manifest 679388 2024-02-23 19:03:37Z satskyse $ # # Author: Sergey Satskiy # @@ -16,7 +16,7 @@ APP: test_xslt tree_parsing xml_generation xslt_transformation LIB: libxmlwrapp.a SRC: src/misc/xmlwrapp/dtd.cpp -DEFAULT_CONFIGURATIONS: Linux64-Centos:plain-GCC +#DEFAULT_CONFIGURATIONS: Linux64-Centos:plain-GCC DEFAULT_CONFIGURE_FLAGS: --without-debug --with-mt # Each line describes a single configuration @@ -27,26 +27,29 @@ DEFAULT_CONFIGURE_FLAGS: --without-debug --with-mt # to it. So some standard options may be added by release configurator, such as --build-root-sfx, --with-projects, # --with-distcc, --with-action etc. -FreeBSD64 : plain : Clang.sh --without-debug --with-mt --without-runpath --with-flat-makefile +# FreeBSD64 : plain : Clang.sh --without-debug --with-mt --without-runpath --with-flat-makefile -Linux64-Centos : plain-GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile -Linux64-Centos : GCC-nomt : GCC.sh --without-debug --without-mt --without-runpath --with-flat-makefile -Linux64-Centos : ICC-17 : ICC.sh 17.0 --without-debug --with-mt --without-runpath --with-flat-makefile -Linux64-Centos : plain-ICC : ICC.sh --without-debug --with-mt --without-runpath --with-flat-makefile +# Linux64-Centos : plain-GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile +# Linux64-Centos : GCC-nomt : GCC.sh --without-debug --without-mt --without-runpath --with-flat-makefile +# Linux64-Centos : ICC-17 : ICC.sh 17.0 --without-debug --with-mt --without-runpath --with-flat-makefile +# Linux64-Centos : plain-ICC : ICC.sh --without-debug --with-mt --without-runpath --with-flat-makefile Linux64-Centos : Release : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile +Linux64-Alma : Release : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile -Linux64-Ubuntu : plain-GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile -Linux64-Ubuntu-Public : plain-GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile +# Linux64-Ubuntu : plain-GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile +# Linux64-Ubuntu-Public : plain-GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile -Cygwin64 : GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile +# Cygwin64 : GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile -Win64_17 : 17-debug-64 : static 64 DebugDLL -Win64_17 : 17-static-64 : static 64 ReleaseDLL -Win64_19 : 19-static-64 : static 64 ReleaseDLL +# Win64_17 : 17-debug-64 : static 64 DebugDLL +# Win64_17 : 17-static-64 : static 64 ReleaseDLL +# Win64_19 : 19-static-64 : static 64 ReleaseDLL -IntelMAC : clang : Clang.sh --without-debug --with-mt --without-runpath --with-flat-makefile --with-3psw=system:netopt --without-ncbi-public -IntelMAC : plain : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile --with-3psw=system:netopt --without-ncbi-public -IntelMAC : GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile -XCode : plain : Xcode.sh 30 +#IntelMAC : clang : Clang.sh --without-debug --with-mt --without-runpath --with-flat-makefile --with-3psw=system:netopt --without-ncbi-public +#IntelMAC : plain : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile --with-3psw=system:netopt --without-ncbi-public +#IntelMAC : GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile +#XCode : plain : Xcode.sh 30 + +ArmMAC : clang : Clang.sh --without-debug --with-mt --without-runpath --with-flat-makefile --with-3psw=system:netopt --without-ncbi-public diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 5bbac74c..b09ad9ea 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -1,5 +1,5 @@ ############################################################################# -# $Id: CMakeLists.txt 674172 2023-10-19 17:21:21Z blastadm $ +# $Id: CMakeLists.txt 684489 2024-06-25 12:36:39Z blastadm $ ############################################################################# cmake_minimum_required(VERSION 3.15) diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index d533af8a..f70eb921 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in 674172 2023-10-19 17:21:21Z blastadm $ +# $Id: Makefile.in 684489 2024-06-25 12:36:39Z blastadm $ # Master (top-level) makefile for all NCBI C++ projects ################################################################## diff --git a/c++/src/algo/blast/api/bioseq_extract_data_priv.cpp b/c++/src/algo/blast/api/bioseq_extract_data_priv.cpp index baa24f5c..00bfdc69 100644 --- a/c++/src/algo/blast/api/bioseq_extract_data_priv.cpp +++ b/c++/src/algo/blast/api/bioseq_extract_data_priv.cpp @@ -141,10 +141,10 @@ CBlastSeqVectorFromCSeq_data::SetCoding(objects::CSeq_data::E_Choice c) // FIXME: are ambiguities randomized if the encoding requested is // ncbi2na? vector tmp; - TSeqPos nconv = CSeqConvert::Convert(m_SequenceData, m_Encoding, + TSeqPos nconv = static_cast(CSeqConvert::Convert(m_SequenceData, m_Encoding, 0, size(), tmp, - x_Encoding_CSeq_data2CSeqUtil(c)); + x_Encoding_CSeq_data2CSeqUtil(c))); _ASSERT(nconv == tmp.size()); nconv += 0; // to eliminate compiler warning m_Encoding = x_Encoding_CSeq_data2CSeqUtil(c); @@ -155,7 +155,7 @@ CBlastSeqVectorFromCSeq_data::SetCoding(objects::CSeq_data::E_Choice c) inline TSeqPos CBlastSeqVectorFromCSeq_data::x_Size() const { - return m_SequenceData.size(); + return static_cast(m_SequenceData.size()); } inline Uint1 @@ -200,8 +200,8 @@ CBlastSeqVectorFromCSeq_data::x_SetMinusStrand() void CBlastSeqVectorFromCSeq_data::x_ComplementData() { - TSeqPos nconv = CSeqManip::ReverseComplement(m_SequenceData, - m_Encoding, 0, size()); + TSeqPos nconv = static_cast(CSeqManip::ReverseComplement(m_SequenceData, + m_Encoding, 0, size())); _ASSERT(nconv == size()); nconv += 0; // eliminate compiler warning } @@ -259,7 +259,7 @@ CBlastQuerySourceBioseqSet::GetStrand(int /*index*/) const TSeqPos CBlastQuerySourceBioseqSet::Size() const { - return m_Bioseqs.size(); + return static_cast(m_Bioseqs.size()); } CConstRef diff --git a/c++/src/algo/blast/api/blast_aux_priv.cpp b/c++/src/algo/blast/api/blast_aux_priv.cpp index cd761816..6655561c 100644 --- a/c++/src/algo/blast/api/blast_aux_priv.cpp +++ b/c++/src/algo/blast/api/blast_aux_priv.cpp @@ -291,7 +291,7 @@ BuildBlastAncillaryData(EBlastProgramType program, } } else { for(size_t i = 0; i < alignments.size(); i++) { - CRef s(new CBlastAncillaryData(program, i, + CRef s(new CBlastAncillaryData(program, static_cast(i), sbp, qinfo)); retval.push_back(s); diff --git a/c++/src/algo/blast/api/blast_dbindex.cpp b/c++/src/algo/blast/api/blast_dbindex.cpp index b42337c3..b0e586a2 100644 --- a/c++/src/algo/blast/api/blast_dbindex.cpp +++ b/c++/src/algo/blast/api/blast_dbindex.cpp @@ -1,4 +1,4 @@ -/* $Id: blast_dbindex.cpp 536746 2017-05-23 12:44:32Z madden $ +/* $Id: blast_dbindex.cpp 683949 2024-06-10 12:11:15Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -45,6 +45,7 @@ #include #include +#include #include "algo/blast/core/mb_indexed_lookup.h" @@ -91,10 +92,6 @@ BEGIN_SCOPE( blast ) USING_SCOPE( ncbi::objects ); USING_SCOPE( ncbi::blastdbindex ); -/// Get the minimum acceptable word size to use with indexed search. -/// @return the minimum acceptable word size -int MinIndexWordSize() { return 16; } - /** No-op callback for setting concurrency state. @sa DbIndexSetUsingThreadsFnType() */ @@ -202,6 +199,8 @@ public: CDbIndex::TSeqNum oid, CDbIndex::TSeqNum chunk, BlastInitHitList * init_hitlist ) const = 0; + + virtual int MinIndexWordSize() = 0; }; //------------------------------------------------------------------------------ @@ -270,6 +269,8 @@ public: /** Not used */ virtual void EndSearchIndication( Int4 ) {} + virtual int MinIndexWordSize(); + private: /** Invoke the seed search procedure on each of the loaded indices. @@ -453,6 +454,8 @@ private: */ void AddIndexInfo( const std::string & vol_name, bool & idx_not_resolved ); + virtual int MinIndexWordSize(); + /** Find a volume containing the given subject ordinal id. */ TVolList::const_iterator FindVolume( SIZE_TYPE oid ) const { @@ -920,6 +923,23 @@ unsigned long CIndexedDb_New::GetResults( } } +static int s_GetMinimumSupportedWordSizeByIndex(const string& fname) +{ + CMemoryFile index_map(fname); + SIndexHeader header = ReadIndexHeader< false >(index_map.GetPtr()); + int rv = header.hkey_width_ + header.stride_ -1; + ERR_POST(Info << "Minimal supported word size in " << fname << " is " << rv); + return rv; +} + +int CIndexedDb_New::MinIndexWordSize() +{ + int rv = 0; + if (volumes_.size() > 0){ + rv = s_GetMinimumSupportedWordSizeByIndex(volumes_[0].name); + } + return rv; +} //------------------------------------------------------------------------------ CIndexedDb_Old::CIndexedDb_Old( const string & indexnames ) { @@ -1063,12 +1083,46 @@ unsigned long CIndexedDb_Old::GetResults( return 0; } } - +/// Get the minimum acceptable word size to use with indexed search. +/// @return the minimum acceptable word size +int CIndexedDb_Old::MinIndexWordSize() +{ + int rv = 0; + if (index_names_.size() > 0){ + rv = s_GetMinimumSupportedWordSizeByIndex(index_names_[0]); + } + return rv; +} //------------------------------------------------------------------------------ + +std::string s_CheckMinWordSize(int word_size) +{ + string rv = kEmptyStr; + if (CIndexedDb::Index_Set_Instance != 0 ) { + try { + int min_ws = CIndexedDb::Index_Set_Instance->MinIndexWordSize() ; + if (word_size < min_ws) { + CIndexedDb::Index_Set_Instance.Reset(); + rv = "MegaBLAST database index requires word size greater than "; + rv += NStr::IntToString(min_ws); + rv += "."; + } + } + catch (CException & e) { + rv = "Failed to read index MegaBLAST db min word size."; + } + + } + else { + rv = "Empty index db instance"; + } + return rv; +} + std::string DbIndexInit( - const string & indexname, bool old_style, bool & partial ) + const string & indexname, bool old_style, bool & partial, const int word_size ) { - std::string result; + std::string result=kEmptyStr; partial = false; if( !old_style ) { @@ -1084,8 +1138,7 @@ std::string DbIndexInit( if( partial ) { ERR_POST( Info << "some volumes are not resolved" ); } - - return ""; + return s_CheckMinWordSize(word_size); } else return "index allocation error"; } @@ -1095,22 +1148,23 @@ std::string DbIndexInit( } } + try{ - ERR_POST( Info << "trying to load old style index at " - << indexname ); - CIndexedDb::Index_Set_Instance.Reset( - new CIndexedDb_Old( indexname ) ); - - if( CIndexedDb::Index_Set_Instance != 0 ) { - ERR_POST( Info << "old style index loaded" ); - return ""; - } - else return "index allocation error"; + ERR_POST( Info << "trying to load old style index at " + << indexname ); + CIndexedDb::Index_Set_Instance.Reset( + new CIndexedDb_Old( indexname ) ); + + if( CIndexedDb::Index_Set_Instance != 0 ) { + ERR_POST( Info << "old style index loaded" ); + return s_CheckMinWordSize(word_size); + } + else return "index allocation error"; } catch( CException & e ) { ERR_POST( Info << "old style index failed to load" ); - result += "\n"; - result += e.what(); + result += "\n"; + result += e.what(); } return result; diff --git a/c++/src/algo/blast/api/blast_seqalign.cpp b/c++/src/algo/blast/api/blast_seqalign.cpp index 2659b2c3..67a2d8ed 100644 --- a/c++/src/algo/blast/api/blast_seqalign.cpp +++ b/c++/src/algo/blast/api/blast_seqalign.cpp @@ -1,4 +1,4 @@ -/* $Id: blast_seqalign.cpp 580355 2019-02-13 17:24:26Z boratyng $ +/* $Id: blast_seqalign.cpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -1679,7 +1679,7 @@ PhiBlastResults2SeqAlign_OMF(const BlastHSPResults * results, BlastHitList2SeqAlign_OMF(hit_list, prog, *query.GetSeq_loc(0), - query.GetSeqLength(0), + static_cast(query.GetSeqLength(0)), seqinfo_src, true, false, @@ -1694,7 +1694,7 @@ PhiBlastResults2SeqAlign_OMF(const BlastHSPResults * results, BlastHitList2SeqAlign_OMF(NULL, prog, *query.GetSeq_loc(0), - query.GetSeqLength(0), + static_cast(query.GetSeqLength(0)), seqinfo_src, true, false, @@ -1801,7 +1801,7 @@ s_BLAST_OneSubjectResults2CSeqAlign(const BlastHSPResults* results, CConstRef seqloc = query_data.GetSeq_loc(qindex); CRef query_id(new CSeq_id); SerialAssign(*query_id, *seqloc->GetId()); - TSeqPos query_length = query_data.GetSeqLength(qindex); + TSeqPos query_length = static_cast(query_data.GetSeqLength(qindex)); s_AdjustNegativeSubjFrameInBlastn(kSubjStrand, prog, hsp_list); vector seqid_list; @@ -1964,7 +1964,7 @@ s_BlastResults2SeqAlignDatabaseSearch_OMF(const BlastHSPResults * results, seq_aligns(BlastHitList2SeqAlign_OMF(hit_list, prog, *query.GetSeq_loc(index), - query.GetSeqLength(index), + static_cast(query.GetSeqLength(index)), seqinfo_src, is_gapped, is_ooframe, diff --git a/c++/src/algo/blast/api/blast_setup_cxx.cpp b/c++/src/algo/blast/api/blast_setup_cxx.cpp index 2f71d890..e9d58bf3 100644 --- a/c++/src/algo/blast/api/blast_setup_cxx.cpp +++ b/c++/src/algo/blast/api/blast_setup_cxx.cpp @@ -192,7 +192,7 @@ SetupQueryInfo_OMF(const IBlastQuerySource& queries, if (translate) { for (unsigned int i = 0; i < kNumContexts; i++) { unsigned int prot_length = - BLAST_GetTranslatedProteinLength(length, i); + static_cast(BLAST_GetTranslatedProteinLength(length, i)); max_length = MAX(max_length, prot_length); min_length = MIN(min_length, prot_length); @@ -405,8 +405,8 @@ s_RestrictSeqLocs_Multiframe(CBlastQueryFilteredFrames & frame_to_bsl, const TFrameSet& frames = frame_to_bsl.ListFrames(); const size_t kNumFrames = frame_to_bsl.GetNumFrames(); _ASSERT(kNumFrames != 0); - const int first_ctx = kNumFrames * query_index; - const int last_ctx = kNumFrames * (query_index + 1); + const int first_ctx = static_cast(kNumFrames) * query_index; + const int last_ctx = static_cast(kNumFrames) * (query_index + 1); ITERATE(TFrameSet, iter, frames) { int seqloc_frame = *iter; @@ -823,7 +823,7 @@ SetupSubjects_OMF(IBlastQuerySource& subjects, /// TODO bl2seq only use soft masking? subj->length = length; BlastSeqBlkSetSeqRanges(subj, (SSeqRange*) masked_ranges.get_data(), - masked_ranges.size() + 1, true, eSoftSubjMasking); + static_cast(masked_ranges.size()) + 1, true, eSoftSubjMasking); } else { subj->num_seq_ranges = 0; } diff --git a/c++/src/algo/blast/api/cdd_pssm_input.cpp b/c++/src/algo/blast/api/cdd_pssm_input.cpp index 591e7192..4580a9a4 100644 --- a/c++/src/algo/blast/api/cdd_pssm_input.cpp +++ b/c++/src/algo/blast/api/cdd_pssm_input.cpp @@ -1,4 +1,4 @@ -/* $Id: cdd_pssm_input.cpp 500404 2016-05-04 14:59:01Z camacho $ +/* $Id: cdd_pssm_input.cpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -127,8 +127,8 @@ void CCddInputData::Process(void) x_RemoveMultipleCdHits(); // this is required by PSSM engine code - m_MsaDimensions.query_length = m_QueryData.size(); - m_MsaDimensions.num_seqs = m_Hits.size(); + m_MsaDimensions.query_length = static_cast(m_QueryData.size()); + m_MsaDimensions.num_seqs = static_cast(m_Hits.size()); m_CddData.dimensions = &m_MsaDimensions; x_FillHitsData(); @@ -187,7 +187,7 @@ void CCddInputData::x_RemoveMultipleCdHits(void) // for each kept hit with the same subject accession as it and better // e-value - for (int i=new_hits.size() - 1;i >= 0 + for (int i=static_cast(new_hits.size()) - 1;i >= 0 && (*it)->m_SubjectId->Match(*new_hits[i]->m_SubjectId);i--) { const CHit* kept_hit = new_hits[i]; @@ -239,8 +239,8 @@ void CCddInputData::x_FillHitsData(void) void CCddInputData::x_CreateMsa(void) { - const int kQueryLength = m_QueryData.size(); - const int kNumCds = m_Hits.size(); + const int kQueryLength = static_cast(m_QueryData.size()); + const int kNumCds = static_cast(m_Hits.size()); // initialize msa map PSICdMsaCell cell; @@ -276,7 +276,7 @@ void CCddInputData::x_CreateMsa(void) m_Msa[hit_idx][q_from + i].data = &(*it)->m_MsaData[i]; } } - m_Hits[hit_idx]->m_MsaIdx = hit_idx; + m_Hits[hit_idx]->m_MsaIdx = static_cast(hit_idx); } m_CddData.msa = m_Msa; @@ -286,8 +286,8 @@ void CCddInputData::x_CreateMsa(void) bool CCddInputData::x_ValidateMsa(void) const { _ASSERT(m_Msa); - const int kQueryLength = m_QueryData.size(); - const int kNumCds = m_Hits.size(); + const int kQueryLength = static_cast(m_QueryData.size()); + const int kNumCds = static_cast(m_Hits.size()); const Uint1 kGapChar = AMINOACID_TO_NCBISTDAA[(int)'-']; for (int i=0;i < kNumCds;i++) { _ASSERT(m_Msa[i]); diff --git a/c++/src/algo/blast/api/deltablast.cpp b/c++/src/algo/blast/api/deltablast.cpp index 4c855dd7..9c6c4252 100644 --- a/c++/src/algo/blast/api/deltablast.cpp +++ b/c++/src/algo/blast/api/deltablast.cpp @@ -1,4 +1,4 @@ -/* $Id: deltablast.cpp 500404 2016-05-04 14:59:01Z camacho $ +/* $Id: deltablast.cpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -115,7 +115,7 @@ CRef CDeltaBlast::Run(void) CRef pssm_input( new CCddInputData(query_seq[i], - query_lens[i], + static_cast(query_lens[i]), (*m_DomainResults)[i].GetSeqAlign(), *opts.Get(), m_DomainDb->GetDatabaseName(), diff --git a/c++/src/algo/blast/api/effsearchspace_calc.cpp b/c++/src/algo/blast/api/effsearchspace_calc.cpp index 23526df4..5ffdfb9a 100644 --- a/c++/src/algo/blast/api/effsearchspace_calc.cpp +++ b/c++/src/algo/blast/api/effsearchspace_calc.cpp @@ -1,4 +1,4 @@ -/* $Id: effsearchspace_calc.cpp 621913 2020-12-17 15:27:59Z grichenk $ +/* $Id: effsearchspace_calc.cpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -133,7 +133,7 @@ Int8 CEffectiveSearchSpaceCalculator::GetEffSearchSpace(size_t query_index) const { _ASSERT((Int4)query_index < m_QueryInfo->num_queries); - return BlastQueryInfoGetEffSearchSpace(m_QueryInfo, m_Program, query_index); + return BlastQueryInfoGetEffSearchSpace(m_QueryInfo, m_Program, static_cast(query_index)); } Int8 diff --git a/c++/src/algo/blast/api/local_blast.cpp b/c++/src/algo/blast/api/local_blast.cpp index a10571dc..4f6a53df 100644 --- a/c++/src/algo/blast/api/local_blast.cpp +++ b/c++/src/algo/blast/api/local_blast.cpp @@ -190,7 +190,7 @@ CLocalBlast::Run() res_type = eSequenceComparison; IBlastSeqInfoSrc * subject_infosrc = m_LocalDbAdapter->MakeSeqInfoSrc(); if(subject_infosrc != NULL) { - num_subjects = subject_infosrc->Size(); + num_subjects = static_cast(subject_infosrc->Size()); } } TSearchMessages msg_vec; @@ -235,8 +235,20 @@ CLocalBlast::Run() if(e.GetErrCode() == CBlastException::eCoreBlastError) { throw; } - }catch (...) { } + catch (CSeqDBException & e) { + if (e.GetErrCode() == CSeqDBException::eOpenFileErr) { + string err_msg = BlastErrorCode2String(BLASTERR_DB_OPEN_FILES); + NCBI_THROW(CBlastException, eCoreBlastError, err_msg); + } + else { + string err_msg = BlastErrorCode2String(BLASTERR_DB_MEMORY_MAP); + NCBI_THROW(CBlastException, eCoreBlastError, err_msg); + } + } + catch (std::exception & e) { + NCBI_THROW(CBlastException, eSystem, e.what()); + } //_ASSERT(m_InternalData); BLAST_PROF_MARK2( m_batch_num_str + string("_BLAST.PRE.STOP") ); diff --git a/c++/src/algo/blast/api/magicblast.cpp b/c++/src/algo/blast/api/magicblast.cpp index 83527070..b67faa66 100644 --- a/c++/src/algo/blast/api/magicblast.cpp +++ b/c++/src/algo/blast/api/magicblast.cpp @@ -1,4 +1,4 @@ -/* $Id: magicblast.cpp 644901 2022-02-04 13:49:46Z boratyng $ +/* $Id: magicblast.cpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -346,7 +346,7 @@ static CRef s_CreateSeqAlign(const HSPChain* chain, CRef query_id(new CSeq_id); SerialAssign(*query_id, CSeq_loc_CI(*query_loc).GetSeq_id()); _ASSERT(query_id); - TSeqPos query_length = qdata->GetSeqLength(query_index); + TSeqPos query_length = static_cast(qdata->GetSeqLength(query_index)); CRef subject_id; TSeqPos subj_length; diff --git a/c++/src/algo/blast/api/msa_pssm_input.cpp b/c++/src/algo/blast/api/msa_pssm_input.cpp index c3972d10..65028c8e 100644 --- a/c++/src/algo/blast/api/msa_pssm_input.cpp +++ b/c++/src/algo/blast/api/msa_pssm_input.cpp @@ -95,7 +95,7 @@ CPsiBlastInputClustalW::CPsiBlastInputClustalW _ASSERT(m_Query); _ASSERT(m_MsaDimensions.query_length); // query is included in m_AsciiMsa, so decrement it by 1 - m_MsaDimensions.num_seqs = m_AsciiMsa.size() - 1; + m_MsaDimensions.num_seqs = static_cast(m_AsciiMsa.size() - 1); m_Msa = NULL; @@ -287,7 +287,7 @@ CPsiBlastInputClustalW::x_ExtractQueryFromMsa(unsigned int msa_master_idx/*=0*/) kNumGaps++; } } - const unsigned int kQueryLength = kQuery.size() - kNumGaps; + const unsigned int kQueryLength = static_cast(kQuery.size() - kNumGaps); m_MsaDimensions.query_length = kQueryLength; m_Query.reset(new Uint1[kQueryLength]); @@ -372,14 +372,14 @@ CPsiBlastInputClustalW::x_ExtractAlignmentData() i++; } - int k = i + 1; + int k = static_cast(i) + 1; while (k < m_Msa->dimensions->query_length && m_Msa->data[seq_index][k].letter == kGapResidue) { k++; } if (k - i >= kLongGapLen) { - for (int j=i;j < k;j++) { + for (int j=static_cast(i);j < k;j++) { m_Msa->data[seq_index][j].is_aligned = false; } } diff --git a/c++/src/algo/blast/api/objmgr_query_data.cpp b/c++/src/algo/blast/api/objmgr_query_data.cpp index 1b7cb1d8..f2a538f0 100644 --- a/c++/src/algo/blast/api/objmgr_query_data.cpp +++ b/c++/src/algo/blast/api/objmgr_query_data.cpp @@ -242,13 +242,13 @@ CObjMgr_LocalQueryData::GetNumQueries() CConstRef CObjMgr_LocalQueryData::GetSeq_loc(size_t index) { - return m_QuerySource->GetSeqLoc(index); + return m_QuerySource->GetSeqLoc(static_cast(index)); } size_t CObjMgr_LocalQueryData::GetSeqLength(size_t index) { - return m_QuerySource->GetLength(index); + return m_QuerySource->GetLength(static_cast(index)); } diff --git a/c++/src/algo/blast/api/objmgrfree_query_data.cpp b/c++/src/algo/blast/api/objmgrfree_query_data.cpp index 365d7784..684dcca2 100644 --- a/c++/src/algo/blast/api/objmgrfree_query_data.cpp +++ b/c++/src/algo/blast/api/objmgrfree_query_data.cpp @@ -148,7 +148,7 @@ CObjMgrFree_LocalQueryData::GetSeq_loc(size_t index) size_t CObjMgrFree_LocalQueryData::GetSeqLength(size_t index) { - return m_QuerySource->GetLength(index); + return m_QuerySource->GetLength(static_cast(index)); } /** diff --git a/c++/src/algo/blast/api/prelim_search_runner.hpp b/c++/src/algo/blast/api/prelim_search_runner.hpp index 8208a90b..9e75cc32 100644 --- a/c++/src/algo/blast/api/prelim_search_runner.hpp +++ b/c++/src/algo/blast/api/prelim_search_runner.hpp @@ -1,4 +1,4 @@ -/* $Id: prelim_search_runner.hpp 514950 2016-09-27 14:52:47Z rackerst $ +/* $Id: prelim_search_runner.hpp 683531 2024-05-30 12:54:42Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -136,8 +136,18 @@ protected: } virtual void* Main(void) { + try { return (void*) ((intptr_t) CPrelimSearchRunner(m_InternalData, m_OptsMemento)()); + } + catch (CSeqDBException & e) { + if (e.GetErrCode() == CSeqDBException::eOpenFileErr) { + return (void*) BLASTERR_DB_OPEN_FILES; + } + else { + return (void*) BLASTERR_DB_MEMORY_MAP; + } + } } private: diff --git a/c++/src/algo/blast/api/prelim_stage.cpp b/c++/src/algo/blast/api/prelim_stage.cpp index a6e64ddc..2c103eab 100644 --- a/c++/src/algo/blast/api/prelim_stage.cpp +++ b/c++/src/algo/blast/api/prelim_stage.cpp @@ -151,7 +151,7 @@ CBlastPrelimSearch::x_LaunchMultiThreadedSearch(SInternalData& internal_data) // -RMH- This appears to be a problem right now. When used...this // can cause all the work to go to a single thread! (-MN- This is fixed in SB-768) BlastSeqSrcSetNumberOfThreads(m_InternalData->m_SeqSrc->GetPointer(), - GetNumberOfThreads()); + static_cast(GetNumberOfThreads())); // Create the threads ... NON_CONST_ITERATE(TBlastThreads, thread, the_threads) { @@ -188,8 +188,16 @@ CBlastPrelimSearch::x_LaunchMultiThreadedSearch(SInternalData& internal_data) BlastSeqSrcSetNumberOfThreads(m_InternalData->m_SeqSrc->GetPointer(), 0); if (retv) { - NCBI_THROW(CBlastException, eCoreBlastError, - BlastErrorCode2String((Int2)retv)); + Int2 err_code = (Int2) retv; + if (err_code == BLASTERR_DB_MEMORY_MAP) { + NCBI_THROW(CSeqDBException, eFileErr, BlastErrorCode2String(err_code)); + } + else if (err_code == BLASTERR_DB_OPEN_FILES) { + NCBI_THROW(CSeqDBException, eOpenFileErr, BlastErrorCode2String(err_code)); + } + else { + NCBI_THROW(CBlastException, eCoreBlastError, BlastErrorCode2String(err_code)); + } } return 0; } @@ -436,7 +444,7 @@ bool CBlastPrelimSearch::x_BuildStdSegList( vector > > & l for(int i=0; i < num_queries; i++) { CConstRef query_loc = local_query_data->GetSeq_loc(i); - TSeqPos query_length = local_query_data->GetSeqLength(i); + TSeqPos query_length = static_cast(local_query_data->GetSeqLength(i)); BlastHitList * hit_list = q_list_ptr[i]; if(NULL != hit_list) { diff --git a/c++/src/algo/blast/api/psi_pssm_input.cpp b/c++/src/algo/blast/api/psi_pssm_input.cpp index c8346c36..452c1d7e 100644 --- a/c++/src/algo/blast/api/psi_pssm_input.cpp +++ b/c++/src/algo/blast/api/psi_pssm_input.cpp @@ -306,14 +306,13 @@ CPsiBlastInputData::x_ExtractAlignmentData() double evalue = GetLowestEvalue((*itr)->GetScore(), &bit_score); CSeq_id* current_sid = const_cast (&(*itr)->GetSeq_id(1)); - // Increment msa_index (if appropriate) after all CDense_seg for a given target - // sequence have been processed. - if (last_sid && !current_sid->Match(*last_sid)) { - msa_index++; - } - // ... below the e-value inclusion threshold if (evalue < m_Opts.inclusion_ethresh) { + // Increment msa_index (if appropriate) after all CDense_seg for a + // given target sequence have been processed. + if (last_sid && !current_sid->Match(*last_sid)) { + msa_index++; + } _ASSERT(msa_index < GetNumAlignedSequences() + 1); const CDense_seg& seg = (*itr)->GetSegs().GetDenseg(); x_ProcessDenseg(seg, msa_index, evalue, bit_score); diff --git a/c++/src/algo/blast/api/psiblast_impl.cpp b/c++/src/algo/blast/api/psiblast_impl.cpp index afbd5b0a..9d07aeb2 100644 --- a/c++/src/algo/blast/api/psiblast_impl.cpp +++ b/c++/src/algo/blast/api/psiblast_impl.cpp @@ -146,6 +146,7 @@ CPsiBlastImpl::Run() seqinfo_src, search_messages); tback.SetResultType(m_ResultType); + tback.SetNumberOfThreads(GetNumberOfThreads()); m_Results = tback.Run(); // Save the K&A values be as they might have been modified in the diff --git a/c++/src/algo/blast/api/remote_blast.cpp b/c++/src/algo/blast/api/remote_blast.cpp index f694bbc0..1efe5e63 100644 --- a/c++/src/algo/blast/api/remote_blast.cpp +++ b/c++/src/algo/blast/api/remote_blast.cpp @@ -1,4 +1,4 @@ -/* $Id: remote_blast.cpp 640514 2021-11-12 13:02:32Z fongah2 $ +/* $Id: remote_blast.cpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -2507,7 +2507,7 @@ CRemoteBlast::x_GetSearchResultsHTTP(void) unique_ptr tmp_stream( CDirEntry::CreateTmpFile() ); do{ - n_read = CStreamUtils::Readsome(ios,incoming_buffer, read_max); + n_read = static_cast( CStreamUtils::Readsome(ios,incoming_buffer, read_max) ); if( n_read > 0 ){ l_total_bytes += n_read; try{ diff --git a/c++/src/algo/blast/api/rpsblast_local.cpp b/c++/src/algo/blast/api/rpsblast_local.cpp index 0fa9f09a..852ac55b 100644 --- a/c++/src/algo/blast/api/rpsblast_local.cpp +++ b/c++/src/algo/blast/api/rpsblast_local.cpp @@ -1,4 +1,4 @@ -/* $Id: rpsblast_local.cpp 657772 2022-10-17 14:43:47Z fongah2 $ +/* $Id: rpsblast_local.cpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -52,13 +52,13 @@ static const size_t delimiter_len = sizeof(delimiter) - 1; // exclude \0 static void s_ConvertConcatStringToVectorOfString(const string & s, vector & v) { - int pos_start = 0; + size_t pos_start = 0; while(1) { size_t pos_find = s.find(delimiter, pos_start); if(pos_find == string::npos) break; - TSeqPos length = pos_find - pos_start; + size_t length = pos_find - pos_start; v.push_back(s.substr(pos_start, length)); pos_start = pos_find + delimiter_len; } @@ -206,7 +206,7 @@ static bool s_SortDbSize(const pair & a, const pair static void s_MapDbToThread(vector & db, unsigned int num_of_threads) { - unsigned int db_size = db.size(); + unsigned int db_size = static_cast(db.size()); vector > p; for(unsigned int i=0; i < db_size; i++) @@ -314,7 +314,7 @@ void* CRPSThread::Main(void) CRef CRPSThread::RunTandemSearches(void) { - unsigned int num_of_db = m_db.size(); + unsigned int num_of_db = static_cast(m_db.size()); vector > results; for(unsigned int i=0; i < num_of_db; i++) @@ -339,7 +339,7 @@ CLocalRPSBlast::CLocalRPSBlast(CRef query_vector, m_num_of_dbs(0) { CSeqDB::FindVolumePaths(db, CSeqDB::eProtein, m_rps_databases, NULL, true, true); - m_num_of_dbs = m_rps_databases.size(); + m_num_of_dbs = static_cast(m_rps_databases.size()); if( 1 == m_num_of_dbs) { m_num_of_threads = kDisableThreadedSearch; @@ -415,7 +415,7 @@ CRef CLocalRPSBlast::RunThreadedSearch(void) (m_num_of_threads > m_rps_databases.size())) { //Default num of thread : a thread for each db - m_num_of_threads = m_rps_databases.size(); + m_num_of_threads = static_cast(m_rps_databases.size()); } else if(m_num_of_threads < m_rps_databases.size()) { diff --git a/c++/src/algo/blast/api/seqsrc_query_factory.cpp b/c++/src/algo/blast/api/seqsrc_query_factory.cpp index 4513a755..bb6f5343 100644 --- a/c++/src/algo/blast/api/seqsrc_query_factory.cpp +++ b/c++/src/algo/blast/api/seqsrc_query_factory.cpp @@ -1,4 +1,4 @@ -/* $Id: seqsrc_query_factory.cpp 351200 2012-01-26 19:01:24Z maning $ +/* $Id: seqsrc_query_factory.cpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -106,7 +106,7 @@ CQueryFactoryInfo::CQueryFactoryInfo(CRef query_factory, CQueryFactoryInfo::CQueryFactoryInfo(const TSeqLocVector& subj_seqs, EBlastProgramType program) : m_IsProt(Blast_SubjectIsProtein(program) ? true : false), m_MaxLength(0), - m_MinLength(1), m_AvgLength(0), m_QuerySource(0), m_NumSeqs(subj_seqs.size()) + m_MinLength(1), m_AvgLength(0), m_QuerySource(0), m_NumSeqs(static_cast(subj_seqs.size())) { // Fix subject location for tblast[nx]. if (Blast_SubjectIsTranslated(program)) diff --git a/c++/src/algo/blast/api/setup_factory.cpp b/c++/src/algo/blast/api/setup_factory.cpp index dbcc11a1..76ce87b0 100644 --- a/c++/src/algo/blast/api/setup_factory.cpp +++ b/c++/src/algo/blast/api/setup_factory.cpp @@ -94,7 +94,7 @@ CSetupFactory::CreateRpsStructures(const string& rps_dbname, static CRef s_LocalQueryData2Packed_seqint(ILocalQueryData& query_data) { - const int kNumQueries = query_data.GetNumQueries(); + const int kNumQueries = static_cast(query_data.GetNumQueries()); if (kNumQueries == 0) { return CRef(); } @@ -106,7 +106,7 @@ CRef s_LocalQueryData2Packed_seqint(ILocalQueryData& query_data) retval->AddInterval(query_data.GetSeq_loc(i)->GetInt()); } else if (id.NotEmpty()) { TSeqPos len = 0; - try { len = query_data.GetSeqLength(i); } + try { len = static_cast(query_data.GetSeqLength(i)); } catch (...) { /* exception means that it's an invalid seqid, so we do * nothing, the error message should be captured elsewhere */ @@ -220,7 +220,7 @@ CSetupFactory::CreateLookupTable(CRef query_data, rps_info ? (*rps_info)() : 0, &blast_msg, seqsrc, - num_threads); + static_cast(num_threads)); if (status != 0) { TSearchMessages search_messages; Blast_Message2TSearchMessages(blast_msg.Get(), @@ -290,7 +290,7 @@ CSetupFactory::CreateHspStream(const CBlastOptionsMemento* opts_memento, _ASSERT(opts_memento); return BlastHSPStreamNew(opts_memento->m_ProgramType, opts_memento->m_ExtnOpts, TRUE, - number_of_queries, writer); + static_cast(number_of_queries), writer); } BlastHSPWriter* @@ -445,26 +445,16 @@ CSetupFactory::InitializeMegablastDbIndex(CRef options) errstr = "Database indexing is not available for discontiguous "; errstr += "searches."; } - else if( options->GetWordSize() < MinIndexWordSize() ) { - errstr = "MegaBLAST database index requires word size greater than "; - errstr += NStr::IntToString(MinIndexWordSize() - 1); - errstr += "."; - } else { errstr = DbIndexInit( options->GetIndexName(), - options->GetIsOldStyleMBIndex(), partial ); + options->GetIsOldStyleMBIndex(), partial, options->GetWordSize() ); } if( errstr != "" ) { - if( options->GetForceIndex() ) { - NCBI_THROW( CIndexedDbException, eIndexInitError, errstr ); - } - else { - ERR_POST_EX(1, 1, Info << errstr << " Database index will not be used." ); + ERR_POST_EX(1, 1, Warning << errstr << " Database index will not be used." ); options->SetUseIndex( false ); return; - } } options->SetMBIndexLoaded(); diff --git a/c++/src/algo/blast/api/split_query_aux_priv.cpp b/c++/src/algo/blast/api/split_query_aux_priv.cpp index 330fc97f..0a18dcf3 100644 --- a/c++/src/algo/blast/api/split_query_aux_priv.cpp +++ b/c++/src/algo/blast/api/split_query_aux_priv.cpp @@ -259,7 +259,7 @@ CContextTranslator::GetContextInChunk(size_t chunk_num, if (itr == context_indices.end()) { return kInvalidContext; } - return itr - context_indices.begin(); + return static_cast(itr - context_indices.begin()); // FIXED } int @@ -347,7 +347,7 @@ CQueryDataPerChunk::GetQueryLength(size_t chunk_num, int context_in_chunk) const _ASSERT(chunk_num < m_QueryIndicesPerChunk.size()); size_t pos = x_ContextInChunkToQueryIndex(context_in_chunk); _ASSERT(pos < m_QueryIndicesPerChunk[chunk_num].size()); - return GetQueryLength(m_QueryIndicesPerChunk[chunk_num][pos]); + return GetQueryLength(static_cast(m_QueryIndicesPerChunk[chunk_num][pos])); } size_t @@ -364,7 +364,7 @@ CQueryDataPerChunk::GetLastChunk(size_t chunk_num, int context_in_chunk) _ASSERT(chunk_num < m_QueryIndicesPerChunk.size()); size_t pos = x_ContextInChunkToQueryIndex(context_in_chunk); _ASSERT(pos < m_QueryIndicesPerChunk[chunk_num].size()); - return GetLastChunk(m_QueryIndicesPerChunk[chunk_num][pos]); + return GetLastChunk(static_cast(m_QueryIndicesPerChunk[chunk_num][pos])); } int diff --git a/c++/src/algo/blast/api/split_query_blk.cpp b/c++/src/algo/blast/api/split_query_blk.cpp index 655b1fdc..7339d002 100644 --- a/c++/src/algo/blast/api/split_query_blk.cpp +++ b/c++/src/algo/blast/api/split_query_blk.cpp @@ -67,7 +67,7 @@ CSplitQueryBlk::GetNumQueriesForChunk(size_t chunk_num) const { size_t retval = 0; Int2 rv = SplitQueryBlk_GetNumQueriesForChunk(m_SplitQueryBlk, - chunk_num, + static_cast(chunk_num), &retval); if (rv != 0) { throw runtime_error("SplitQueryBlk_GetNumQueriesForChunk"); @@ -81,7 +81,7 @@ CSplitQueryBlk::GetQueryIndices(size_t chunk_num) const vector retval; Uint4* query_indices = NULL; Int2 rv = SplitQueryBlk_GetQueryIndicesForChunk(m_SplitQueryBlk, - chunk_num, + static_cast(chunk_num), &query_indices); if (rv != 0) { throw runtime_error("SplitQueryBlk_GetQueryIndicesForChunk"); @@ -100,7 +100,7 @@ CSplitQueryBlk::GetQueryContexts(size_t chunk_num) const Int4* query_contexts = NULL; Uint4 num_contexts = 0; Int2 rv = SplitQueryBlk_GetQueryContextsForChunk(m_SplitQueryBlk, - chunk_num, + static_cast(chunk_num), &query_contexts, &num_contexts); if (rv != 0) { @@ -119,7 +119,7 @@ CSplitQueryBlk::GetContextOffsets(size_t chunk_num) const vector retval; Uint4* context_offsets = NULL; Int2 rv = SplitQueryBlk_GetContextOffsetsForChunk(m_SplitQueryBlk, - chunk_num, + static_cast(chunk_num), &context_offsets); if (rv != 0) { throw runtime_error("SplitQueryBlk_GetContextOffsetsForChunk"); @@ -136,13 +136,13 @@ CSplitQueryBlk::GetChunkBounds(size_t chunk_num) const { TChunkRange retval; pair chunk_bounds(0, 0); - Int2 rv = SplitQueryBlk_GetChunkBounds(m_SplitQueryBlk, chunk_num, + Int2 rv = SplitQueryBlk_GetChunkBounds(m_SplitQueryBlk, static_cast(chunk_num), &chunk_bounds.first, &chunk_bounds.second); if (rv != 0) { throw runtime_error("SplitQueryBlk_GetChunkBounds"); } - retval.SetOpen(chunk_bounds.first, chunk_bounds.second); + retval.SetOpen(static_cast(chunk_bounds.first), static_cast(chunk_bounds.second)); // FIXED return retval; } @@ -151,7 +151,7 @@ CSplitQueryBlk::SetChunkBounds(size_t chunk_num, const TChunkRange& chunk_range) { Int2 rv = SplitQueryBlk_SetChunkBounds(m_SplitQueryBlk, - chunk_num, + static_cast(chunk_num), chunk_range.GetFrom(), chunk_range.GetToOpen()); if (rv != 0) { @@ -163,7 +163,7 @@ void CSplitQueryBlk::AddQueryToChunk(size_t chunk_num, Int4 query_index) { Int2 rv = SplitQueryBlk_AddQueryToChunk(m_SplitQueryBlk, query_index, - chunk_num); + static_cast(chunk_num)); if (rv != 0) { throw runtime_error("Failed to add query to SplitQueryBlk"); } @@ -173,7 +173,7 @@ void CSplitQueryBlk::AddContextToChunk(size_t chunk_num, Int4 context_index) { Int2 rv = SplitQueryBlk_AddContextToChunk(m_SplitQueryBlk, - context_index, chunk_num); + context_index, static_cast(chunk_num)); if (rv != 0) { throw runtime_error("Failed to add context to SplitQueryBlk"); } @@ -183,7 +183,7 @@ void CSplitQueryBlk::AddContextOffsetToChunk(size_t chunk_num, Int4 context_offset) { Int2 rv = SplitQueryBlk_AddContextOffsetToChunk(m_SplitQueryBlk, - context_offset, chunk_num); + context_offset, static_cast(chunk_num)); if (rv != 0) { throw runtime_error("Failed to add context offset to " "SplitQueryBlk"); diff --git a/c++/src/algo/blast/api/split_query_cxx.cpp b/c++/src/algo/blast/api/split_query_cxx.cpp index 989a9b3d..dcb3fbf1 100644 --- a/c++/src/algo/blast/api/split_query_cxx.cpp +++ b/c++/src/algo/blast/api/split_query_cxx.cpp @@ -159,7 +159,7 @@ CQuerySplitter::x_ComputeChunkRanges() } m_SplitBlk->SetChunkBounds(chunk_num, - TChunkRange(chunk_start, chunk_end)); + TChunkRange(static_cast(chunk_start), static_cast(chunk_end))); _TRACE("Chunk " << chunk_num << ": ranges from " << chunk_start << " to " << chunk_end); @@ -213,19 +213,19 @@ s_SetSplitQuerySeqInterval(const TChunkRange& chunk, void CQuerySplitter::x_ComputeQueryIndicesForChunks() { - const int kNumQueries = m_LocalQueryData->GetNumQueries(); + const int kNumQueries = static_cast(m_LocalQueryData->GetNumQueries()); const EBlastProgramType kProgram = m_Options->GetProgramType(); const ENa_strand kStrandOption = m_Options->GetStrandOption(); // Build vector of query ranges along the concatenated query vector query_ranges; query_ranges.reserve(kNumQueries); - query_ranges.push_back(TChunkRange(0, m_LocalQueryData->GetSeqLength(0))); + query_ranges.push_back(TChunkRange(0, static_cast(m_LocalQueryData->GetSeqLength(0)))); // FIXED _TRACE("Query 0: " << query_ranges.back().GetFrom() << "-" << query_ranges.back().GetToOpen()); for (int i = 1; i < kNumQueries; i++) { TSeqPos query_start = query_ranges[i-1].GetTo() + 1; - TSeqPos query_end = query_start + m_LocalQueryData->GetSeqLength(i); + TSeqPos query_end = query_start + static_cast(m_LocalQueryData->GetSeqLength(i)); query_ranges.push_back(TChunkRange(query_start, query_end)); _TRACE("Query " << i << ": " << query_ranges.back().GetFrom() << "-" << query_ranges.back().GetToOpen()); @@ -244,7 +244,7 @@ CQuerySplitter::x_ComputeQueryIndicesForChunks() if ( !chunk.IntersectingWith(query_range) ) { continue; } - m_SplitBlk->AddQueryToChunk(chunk_num, qindex); + m_SplitBlk->AddQueryToChunk(chunk_num, static_cast(qindex)); if (m_SplitQueriesInChunk[chunk_num].Empty()) { m_SplitQueriesInChunk[chunk_num].Reset(new CBlastQueryVector); } @@ -357,8 +357,8 @@ CQuerySplitter::x_ComputeQueryContextsForChunks() BlastSetup_GetStrand(*sl, kProgram, kStrandOption); if (Blast_QueryIsTranslated(kProgram)) { - size_t qlength = qdpc->GetQueryLength(queries[i]); - int last_query_chunk = qdpc->GetLastChunk(queries[i]); + size_t qlength = qdpc->GetQueryLength(static_cast(queries[i])); + int last_query_chunk = qdpc->GetLastChunk(static_cast(queries[i])); _ASSERT(last_query_chunk != -1); int shift = s_GetShiftForTranslatedNegStrand(qlength); @@ -370,7 +370,7 @@ CQuerySplitter::x_ComputeQueryContextsForChunks() kInvalidContext); } else { m_SplitBlk->AddContextToChunk(chunk_num, - kNumContexts*queries[i]+ctx); + static_cast(kNumContexts*queries[i]+ctx)); } } else { // handle the negative strand if (kStrand == eNa_strand_plus) { @@ -380,11 +380,11 @@ CQuerySplitter::x_ComputeQueryContextsForChunks() if (chunk_num == (size_t)last_query_chunk) { // last chunk doesn't have shift m_SplitBlk->AddContextToChunk(chunk_num, - kNumContexts*queries[i]+ctx); + static_cast(kNumContexts*queries[i]+ctx)); } else { m_SplitBlk->AddContextToChunk(chunk_num, - kNumContexts*queries[i]+ - s_AddShift(ctx, shift)); + static_cast(kNumContexts*queries[i]+ + s_AddShift(ctx, shift))); } } } @@ -399,7 +399,7 @@ CQuerySplitter::x_ComputeQueryContextsForChunks() kInvalidContext); } else { m_SplitBlk->AddContextToChunk(chunk_num, - kNumContexts*queries[i]+ctx); + static_cast(kNumContexts*queries[i]+ctx)); } } else { // handle the negative strand if (kStrand == eNa_strand_plus) { @@ -407,14 +407,14 @@ CQuerySplitter::x_ComputeQueryContextsForChunks() kInvalidContext); } else { m_SplitBlk->AddContextToChunk(chunk_num, - kNumContexts*queries[i]+ctx); + static_cast(kNumContexts*queries[i]+ctx)); } } } } else if (Blast_QueryIsProtein(kProgram)) { m_SplitBlk->AddContextToChunk(chunk_num, - kNumContexts*queries[i]); + static_cast(kNumContexts*queries[i])); } else { abort(); } @@ -629,7 +629,7 @@ CQuerySplitter::x_ComputeContextOffsets_NonTranslatedQueries() if (s_IsPlusStrand(chunk_qinfo[chunk_num], ctx)) { - for (int c = chunk_num; c != starting_chunk; c--) { + for (int c = static_cast(chunk_num); c != starting_chunk; c--) { size_t prev_len = s_GetAbsoluteContextLength(chunk_qinfo, c - 1, ctx_translator, @@ -645,7 +645,7 @@ CQuerySplitter::x_ComputeContextOffsets_NonTranslatedQueries() size_t subtrahend = 0; - for (int c = chunk_num; c >= starting_chunk && c >= 0; c--) { + for (int c = static_cast(chunk_num); c >= starting_chunk && c >= 0; c--) { size_t prev_len = s_GetAbsoluteContextLength(chunk_qinfo, c - 1, ctx_translator, @@ -663,7 +663,7 @@ CQuerySplitter::x_ComputeContextOffsets_NonTranslatedQueries() } _ASSERT((chunk_qinfo[chunk_num]->contexts[ctx].is_valid)); - m_SplitBlk->AddContextOffsetToChunk(chunk_num, correction); + m_SplitBlk->AddContextOffsetToChunk(chunk_num, static_cast(correction)); #ifdef DEBUG_COMPARE_SEQUENCES { int global_offset = global_qinfo->contexts[absolute_context].query_offset + @@ -798,7 +798,7 @@ CQuerySplitter::x_ComputeContextOffsets_TranslatedQueries() if (s_IsPlusStrand(chunk_qinfo[chunk_num], ctx)) { - for (int c = chunk_num; c != starting_chunk; c--) { + for (int c = static_cast(chunk_num); c != starting_chunk; c--) { size_t prev_len = s_GetAbsoluteContextLength(chunk_qinfo, c - 1, ctx_translator, @@ -814,7 +814,7 @@ CQuerySplitter::x_ComputeContextOffsets_TranslatedQueries() size_t subtrahend = 0; - for (int c = chunk_num; c >= starting_chunk && c >= 0; c--) { + for (int c = static_cast(chunk_num); c >= starting_chunk && c >= 0; c--) { size_t prev_len = s_GetAbsoluteContextLength(chunk_qinfo, c - 1, ctx_translator, @@ -833,7 +833,7 @@ CQuerySplitter::x_ComputeContextOffsets_TranslatedQueries() error_check: _ASSERT((chunk_qinfo[chunk_num]->contexts[ctx].is_valid)); - m_SplitBlk->AddContextOffsetToChunk(chunk_num, correction); + m_SplitBlk->AddContextOffsetToChunk(chunk_num, static_cast(correction)); #ifdef DEBUG_COMPARE_SEQUENCES { int global_offset = global_qinfo->contexts[absolute_context].query_offset + diff --git a/c++/src/algo/blast/blastinput/blast_args.cpp b/c++/src/algo/blast/blastinput/blast_args.cpp index 8d3a5435..3351c644 100644 --- a/c++/src/algo/blast/blastinput/blast_args.cpp +++ b/c++/src/algo/blast/blastinput/blast_args.cpp @@ -1,4 +1,4 @@ -/* $Id: blast_args.cpp 674166 2023-10-19 17:00:39Z ivanov $ +/* $Id: blast_args.cpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -3132,7 +3132,7 @@ CMTArgs::SetArgumentDescriptions(CArgDescriptions& arg_desc) const int kMinValue = static_cast(CThreadable::kMinNumThreads); const int kMaxValue = static_cast(CSystemInfo::GetCpuCount()); const int kDfltValue = m_NumThreads != CThreadable::kMinNumThreads - ? std::min(m_NumThreads, kMaxValue) : kMinValue; + ? std::min(static_cast(m_NumThreads), kMaxValue) : kMinValue; arg_desc.AddDefaultKey(kArgNumThreads, "int_value", "Number of threads (CPUs) to use in the BLAST search", diff --git a/c++/src/algo/blast/blastinput/blast_fasta_input.cpp b/c++/src/algo/blast/blastinput/blast_fasta_input.cpp index b7e11090..21f8806d 100644 --- a/c++/src/algo/blast/blastinput/blast_fasta_input.cpp +++ b/c++/src/algo/blast/blastinput/blast_fasta_input.cpp @@ -1,4 +1,4 @@ -/* $Id: blast_fasta_input.cpp 654211 2022-08-10 13:45:37Z boratyng $ +/* $Id: blast_fasta_input.cpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -764,7 +764,7 @@ CShortReadFastaInputSource::x_ReadFastc(CBioseq_set& bioseq_set) } bioseq.SetInst().SetMol(CSeq_inst::eMol_na); bioseq.SetInst().SetRepr(CSeq_inst::eRepr_raw); - bioseq.SetInst().SetLength(first_len); + bioseq.SetInst().SetLength(static_cast(first_len)); first[first_len] = 0; bioseq.SetInst().SetSeq_data().SetIupacna(CIUPACna(first)); bioseq.SetDescr().Set().push_back(seqdesc_first); @@ -790,7 +790,7 @@ CShortReadFastaInputSource::x_ReadFastc(CBioseq_set& bioseq_set) } bioseq.SetInst().SetMol(CSeq_inst::eMol_na); bioseq.SetInst().SetRepr(CSeq_inst::eRepr_raw); - bioseq.SetInst().SetLength(second_len); + bioseq.SetInst().SetLength(static_cast(second_len)); second[second_len] = 0; bioseq.SetInst().SetSeq_data().SetIupacna(CIUPACna(second)); bioseq.SetDescr().Set().push_back(seqdesc_last); @@ -825,7 +825,7 @@ CShortReadFastaInputSource::x_ReadFastaOneSeq(CRef line_reader) // increase the sequence buffer if necessary if (start + line.length() + 1 > m_SeqBuffLen) { string tmp; - m_SeqBuffLen = 2 * (start + line.length() + 1); + m_SeqBuffLen = static_cast(2 * (start + line.length() + 1)); tmp.resize(m_SeqBuffLen); memcpy(&tmp[0], &m_Sequence[0], start); m_Sequence.swap(tmp); @@ -935,7 +935,7 @@ CShortReadFastaInputSource::x_ReadFastqOneSeq(CRef line_reader) empty_sequence = true; } else { - bioseq.SetInst().SetLength(line.length()); + bioseq.SetInst().SetLength(static_cast(line.length())); bioseq.SetInst().SetSeq_data().SetIupacna(CIUPACna(line.data())); m_BasesAdded += line.length(); } diff --git a/c++/src/algo/blast/core/blast_aascan.c b/c++/src/algo/blast/core/blast_aascan.c index 12227931..cdedd36c 100644 --- a/c++/src/algo/blast/core/blast_aascan.c +++ b/c++/src/algo/blast/core/blast_aascan.c @@ -1,4 +1,4 @@ -/* $Id: blast_aascan.c 663684 2023-02-27 15:47:41Z fongah2 $ +/* $Id: blast_aascan.c 683930 2024-06-10 12:07:59Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -107,7 +107,7 @@ static Int4 s_BlastAaScanSubject(const LookupTableWrap * lookup_wrap, /* copy the hits. */ { Int4 i; - Int4 s_off = s - subject->sequence; + Int4 s_off = (Int4)(s - subject->sequence); for (i = 0; i < numhits; i++) { offset_pairs[i + totalhits].qs_offsets.q_off = src[i]; offset_pairs[i + totalhits].qs_offsets.s_off = s_off; @@ -118,12 +118,12 @@ static Int4 s_BlastAaScanSubject(const LookupTableWrap * lookup_wrap, } else /* not enough space in the destination array; return early */ { - s_range[1] = s - subject->sequence; + s_range[1] = (Int4)(s - subject->sequence); return totalhits; } } } /* end for */ - s_range[1] = s - subject->sequence; + s_range[1] = (Int4)(s - subject->sequence); } /* end while */ /* if we get here, we fell off the end of the sequence */ @@ -193,7 +193,7 @@ static Int4 s_BlastSmallAaScanSubject(const LookupTableWrap * lookup_wrap, /* copy the hits. */ { Int4 i; - Int4 s_off = s - subject->sequence; + Int4 s_off = (Int4)(s - subject->sequence); for (i = 0; i < numhits; i++) { offset_pairs[i + totalhits].qs_offsets.q_off = src[i]; offset_pairs[i + totalhits].qs_offsets.s_off = s_off; @@ -204,12 +204,12 @@ static Int4 s_BlastSmallAaScanSubject(const LookupTableWrap * lookup_wrap, } else /* not enough space in the destination array; return early */ { - s_range[1] = s - subject->sequence; + s_range[1] = (Int4)(s - subject->sequence); return totalhits; } } } /* end for */ - s_range[1] = s - subject->sequence; + s_range[1] = (Int4)(s - subject->sequence); } /* end while */ /* if we get here, we fell off the end of the sequence */ @@ -329,7 +329,7 @@ static Int4 s_BlastCompressedAaScanSubject( /* if there are hits */ if (PV_TEST(pv, index, pv_array_bts)) { - Int4 s_off = s - subject->sequence; + Int4 s_off = (Int4)(s - subject->sequence); CompressedLookupBackboneCell* backbone_cell = lookup->backbone + index; @@ -400,13 +400,13 @@ static Int4 s_BlastCompressedAaScanSubject( else /* not enough space in the destination array */ { - s_range[1] = s - subject->sequence; + s_range[1] = (Int4)(s - subject->sequence); return totalhits; } } } } /* end for */ - s_range[1] = s - subject->sequence; + s_range[1] = (Int4)(s - subject->sequence); } /* end while */ /* if we get here, we fell off the end of the sequence */ @@ -512,7 +512,7 @@ Int4 BlastRPSScanSubject(const LookupTableWrap * lookup_wrap, Int4 *src; Int4 i; Uint4 q_off; - Uint4 s_off = s - abs_start; + Uint4 s_off = (Uint4)(s - abs_start); if (numhits <= RPS_HITS_PER_CELL) { for (i = 0; i < numhits; i++) { q_off = cell->entries[i] - table_correction; @@ -545,7 +545,7 @@ Int4 BlastRPSScanSubject(const LookupTableWrap * lookup_wrap, } /* if we get here, we fell off the end of the sequence */ - *offset = s - abs_start; + *offset = (Int4)(s - abs_start); return totalhits; } diff --git a/c++/src/algo/blast/core/blast_engine.c b/c++/src/algo/blast/core/blast_engine.c index 071651c6..2a546275 100644 --- a/c++/src/algo/blast/core/blast_engine.c +++ b/c++/src/algo/blast/core/blast_engine.c @@ -1,4 +1,4 @@ -/* $Id: blast_engine.c 672916 2023-09-18 17:55:28Z ivanov $ +/* $Id: blast_engine.c 683952 2024-06-10 12:29:05Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -79,7 +79,7 @@ #define CONV_NUCL2PROT_COORDINATES(length) (length) / CODON_LENGTH NCBI_XBLAST_EXPORT const int kBlastMajorVersion = 2; -NCBI_XBLAST_EXPORT const int kBlastMinorVersion = 15; +NCBI_XBLAST_EXPORT const int kBlastMinorVersion = 16; NCBI_XBLAST_EXPORT const int kBlastPatchVersion = 0; /** Structure to be passed to s_BlastSearchEngineCore, containing pointers diff --git a/c++/src/algo/blast/core/blast_filter.c b/c++/src/algo/blast/core/blast_filter.c index fb24dc85..1452fbe3 100644 --- a/c++/src/algo/blast/core/blast_filter.c +++ b/c++/src/algo/blast/core/blast_filter.c @@ -1,4 +1,4 @@ -/* $Id: blast_filter.c 533522 2017-04-17 15:50:34Z boratyng $ +/* $Id: blast_filter.c 683930 2024-06-10 12:07:59Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -195,15 +195,15 @@ s_ParseDustOptions(const char *ptr, int* level, int* window, int* linker) switch(arg) { case 0: sscanf(buffer, "%ld", &tmplong); - level_pri = tmplong; + level_pri = (int)tmplong; break; case 1: sscanf(buffer, "%ld", &tmplong); - window_pri = tmplong; + window_pri = (int)tmplong; break; case 2: sscanf(buffer, "%ld", &tmplong); - linker_pri = tmplong; + linker_pri = (int)tmplong; break; default: break; @@ -307,7 +307,7 @@ s_SafeStrCat(char** dest, unsigned int* dest_size, const char* string2append) size_t target_size = MAX(string2append_length, dest_length) * 2; *dest = (char*)realloc((void*)*dest, target_size); if (*dest) { - (*dest_size) = target_size; + (*dest_size) = (unsigned int)target_size; } else { sfree(*dest); return 0; diff --git a/c++/src/algo/blast/core/blast_hits.c b/c++/src/algo/blast/core/blast_hits.c index 2f330461..0934922a 100644 --- a/c++/src/algo/blast/core/blast_hits.c +++ b/c++/src/algo/blast/core/blast_hits.c @@ -1,4 +1,4 @@ -/* $Id: blast_hits.c 594743 2019-10-09 11:00:47Z fongah2 $ +/* $Id: blast_hits.c 683930 2024-06-10 12:07:59Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -452,10 +452,10 @@ s_UpdateReevaluatedHSP(BlastHSP* hsp, Boolean gapped, if (hsp->score >= cutoff_score) { /* Update all HSP offsets. */ - hsp->query.offset = best_q_start - query_start; - hsp->query.end = hsp->query.offset + best_q_end - best_q_start; - hsp->subject.offset = best_s_start - subject_start; - hsp->subject.end = hsp->subject.offset + best_s_end - best_s_start; + hsp->query.offset = (Int4)(best_q_start - query_start); + hsp->query.end = (Int4)(hsp->query.offset + best_q_end - best_q_start); + hsp->subject.offset = (Int4)(best_s_start - subject_start); + hsp->subject.end = (Int4)(hsp->subject.offset + best_s_end - best_s_start); if (gapped) { int last_num=hsp->gap_info->size - 1; @@ -616,8 +616,8 @@ Boolean Blast_HSPReevaluateWithAmbiguitiesGapped(BlastHSP* hsp, ASSERT(esp->op_type[best_start_esp_index] == eGapAlignSub); ASSERT(esp->op_type[best_end_esp_index] == eGapAlignSub); - qp = best_q_start - q; - sp = best_s_start - s; + qp = (Int4)(best_q_start - q); + sp = (Int4)(best_s_start - s); ext = 0; while(qp > 0 && sp > 0 && (q[--qp] == s[--sp]) && q[qp]<4) ext++; best_q_start -= ext; @@ -626,8 +626,8 @@ Boolean Blast_HSPReevaluateWithAmbiguitiesGapped(BlastHSP* hsp, if (best_end_esp_index == best_start_esp_index) best_end_esp_num += ext; score += ext * score_params->reward; - qp = best_q_end - q; - sp = best_s_end - s; + qp = (Int4)(best_q_end - q); + sp = (Int4)(best_s_end - s); ext = 0; while(qp < qlen && sp < slen && q[qp]<4 && (q[qp++] == s[sp++])) ext++; best_q_end += ext; @@ -2017,6 +2017,7 @@ Int2 Blast_HSPListReapByQueryCoverage(BlastHSPList* hsp_list, BlastHSP** hsp_array; Int4 hsp_cnt = 0; Int4 index; + Boolean removed = FALSE; if ((hsp_list == NULL) || (hsp_list->hspcnt == 0) || (hit_options->query_cov_hsp_perc == 0)) return 0; @@ -2028,6 +2029,7 @@ Int2 Blast_HSPListReapByQueryCoverage(BlastHSPList* hsp_list, if ( Blast_HSPQueryCoverageTest(hsp, hit_options->query_cov_hsp_perc, query_info->contexts[hsp->context].query_length)) { hsp_array[index] = Blast_HSPFree(hsp_array[index]); + removed = TRUE; } else { if (index > hsp_cnt) hsp_array[hsp_cnt] = hsp_array[index]; @@ -2037,6 +2039,10 @@ Int2 Blast_HSPListReapByQueryCoverage(BlastHSPList* hsp_list, hsp_list->hspcnt = hsp_cnt; + if (removed) { + hsp_list->best_evalue = s_BlastGetBestEvalue(hsp_list); + } + return 0; } diff --git a/c++/src/algo/blast/core/blast_hspstream.c b/c++/src/algo/blast/core/blast_hspstream.c index 2704da82..44721611 100644 --- a/c++/src/algo/blast/core/blast_hspstream.c +++ b/c++/src/algo/blast/core/blast_hspstream.c @@ -1,4 +1,4 @@ -/* $Id: blast_hspstream.c 594743 2019-10-09 11:00:47Z fongah2 $ +/* $Id: blast_hspstream.c 683930 2024-06-10 12:07:59Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -519,7 +519,7 @@ fprintf(stderr, "No hits to query %d\n", global_query); Blast_HitListMerge(results1->hitlist_array + i, results2->hitlist_array + global_query, contexts_per_query, split_points, - SplitQueryBlk_GetChunkOverlapSize(squery_blk), + (Int4)SplitQueryBlk_GetChunkOverlapSize(squery_blk), SplitQueryBlk_AllowGap(squery_blk)); } diff --git a/c++/src/algo/blast/core/blast_kappa.c b/c++/src/algo/blast/core/blast_kappa.c index 490875ed..a5c6fe3f 100644 --- a/c++/src/algo/blast/core/blast_kappa.c +++ b/c++/src/algo/blast/core/blast_kappa.c @@ -1,4 +1,4 @@ -/* $Id: blast_kappa.c 663873 2023-03-02 15:07:26Z madden $ +/* $Id: blast_kappa.c 683930 2024-06-10 12:07:59Z ivanov $ * ========================================================================== * * PUBLIC DOMAIN NOTICE @@ -108,7 +108,7 @@ s_HSPListNormalizeScores(BlastHSPList * hsp_list, for(hsp_index = 0; hsp_index < hsp_list->hspcnt; hsp_index++) { BlastHSP * hsp = hsp_list->hsp_array[hsp_index]; - hsp->score = BLAST_Nint(((double) hsp->score) / scoreDivisor); + hsp->score = (Int4)BLAST_Nint(((double) hsp->score) / scoreDivisor); /* Compute the bit score using the newly computed scaled score. */ hsp->bit_score = (hsp->score*lambda*scoreDivisor - logK)/NCBIMATH_LN2; } @@ -2128,8 +2128,8 @@ s_RescaleSearch(BlastScoreBlk* sbp, } } - sp->gap_open = BLAST_Nint(sp->gap_open * scale_factor); - sp->gap_extend = BLAST_Nint(sp->gap_extend * scale_factor); + sp->gap_open = (Int4)BLAST_Nint(sp->gap_open * scale_factor); + sp->gap_extend = (Int4)BLAST_Nint(sp->gap_extend * scale_factor); sp->scale_factor = scale_factor; } @@ -2203,7 +2203,7 @@ s_MatrixInfoInit(Blast_MatrixInfo * self, const char * matrixName) { int status = 0; /* return status */ - int lenName; /* length of matrixName as a string */ + size_t lenName; /* length of matrixName as a string */ /* copy the matrix name (strdup is not standard C) */ lenName = strlen(matrixName); diff --git a/c++/src/algo/blast/core/blast_message.c b/c++/src/algo/blast/core/blast_message.c index e7c9dab1..30d646ca 100644 --- a/c++/src/algo/blast/core/blast_message.c +++ b/c++/src/algo/blast/core/blast_message.c @@ -1,4 +1,4 @@ -/* $Id: blast_message.c 673573 2023-10-04 13:17:42Z ivanov $ +/* $Id: blast_message.c 683534 2024-05-30 12:54:55Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -224,6 +224,16 @@ Blast_PerrorEx(Blast_Message* *msg, new_msg->severity = eBlastSevFatal; new_msg->context = context; break; + case BLASTERR_DB_MEMORY_MAP : + new_msg->message = strdup("Database memory map file error"); + new_msg->severity = eBlastSevFatal; + new_msg->context = context; + break; + case BLASTERR_DB_OPEN_FILES : + new_msg->message = strdup("Too many open files, please raise the open file limit"); + new_msg->severity = eBlastSevFatal; + new_msg->context = context; + break; /* No error, just free the structure */ case 0: new_msg = Blast_MessageFree(new_msg); diff --git a/c++/src/algo/blast/core/blast_nalookup.c b/c++/src/algo/blast/core/blast_nalookup.c index 6361a4e9..40fa9442 100644 --- a/c++/src/algo/blast/core/blast_nalookup.c +++ b/c++/src/algo/blast/core/blast_nalookup.c @@ -1,4 +1,4 @@ -/* $Id: blast_nalookup.c 573109 2018-10-23 14:18:55Z boratyng $ +/* $Id: blast_nalookup.c 683930 2024-06-10 12:07:59Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -1273,7 +1273,7 @@ Int2 BlastMBLookupTableNew(BLAST_SequenceBlk* query, BlastSeqLoc* location, if (mb_lt->lut_word_length <= 12) { if (mb_lt->hashsize <= 8 * kTargetPVSize) - pv_size = mb_lt->hashsize >> PV_ARRAY_BTS; + pv_size = (Int4)(mb_lt->hashsize >> PV_ARRAY_BTS); else pv_size = kTargetPVSize / PV_ARRAY_BYTES; } @@ -1516,7 +1516,7 @@ BlastSparseUint1ArrayNew(Uint4* bitfield, Int8 len) } retval->bitfield = bitfield; - retval->length = len >> PV_ARRAY_BTS; + retval->length = (Uint4)(len >> PV_ARRAY_BTS); retval->counts = calloc(retval->length, sizeof(Int4)); if (!retval->counts) { BlastSparseUint1ArrayFree(retval); @@ -1545,7 +1545,7 @@ static Int4 BlastSparseUint1ArrayGetIndex(BlastSparseUint1Array* array, Int8 index) { /* index into bitfield */ - Int4 idx = index >> PV_ARRAY_BTS; + Int4 idx = (Int4)(index >> PV_ARRAY_BTS); /* bit number within a bitfield cell (mod 32) */ Int4 bit_number = index & PV_ARRAY_MASK; diff --git a/c++/src/algo/blast/core/blast_nascan.c b/c++/src/algo/blast/core/blast_nascan.c index 1af5e3ec..65fe1da8 100644 --- a/c++/src/algo/blast/core/blast_nascan.c +++ b/c++/src/algo/blast/core/blast_nascan.c @@ -1,4 +1,4 @@ -/* $Id: blast_nascan.c 505619 2016-06-27 18:51:47Z boratyng $ +/* $Id: blast_nascan.c 683930 2024-06-10 12:07:59Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -125,10 +125,10 @@ static Int4 s_BlastNaScanSubject_8_4(const LookupTableWrap * lookup_wrap, s_BlastLookupRetrieve(lookup, index, offset_pairs + total_hits, - (s - abs_start) * COMPRESSION_RATIO); + (Int4)((s - abs_start) * COMPRESSION_RATIO)); total_hits += num_hits; } - scan_range[0] = (s - abs_start) * COMPRESSION_RATIO; + scan_range[0] = (Int4)((s - abs_start) * COMPRESSION_RATIO); return total_hits; } @@ -203,10 +203,10 @@ static Int4 s_BlastNaScanSubject_Any(const LookupTableWrap * lookup_wrap, s_BlastLookupRetrieve(lookup, index, offset_pairs + total_hits, - (s - abs_start) * COMPRESSION_RATIO); + (Int4)((s - abs_start) * COMPRESSION_RATIO)); total_hits += num_hits; } - scan_range[0] = (s - abs_start) * COMPRESSION_RATIO; + scan_range[0] = (Int4)((s - abs_start) * COMPRESSION_RATIO); } else { /* when the stride is not a multiple of 4, extra bases may occur both before and after every word read from the subject @@ -485,14 +485,14 @@ static Int4 s_BlastSmallNaScanSubject_Any(const LookupTableWrap * lookup_wrap, if (total_hits > max_hits) break; - s_off = (s - abs_start) * COMPRESSION_RATIO; + s_off = (Int4)((s - abs_start) * COMPRESSION_RATIO); total_hits += s_BlastSmallNaRetrieveHits(offset_pairs, index, s_off, total_hits, overflow); } } - scan_range[0] = (s - abs_start) * COMPRESSION_RATIO; + scan_range[0] = (Int4)((s - abs_start) * COMPRESSION_RATIO); } else { /* when the stride is not a multiple of 4, extra bases may occur both before and after every word read from the subject @@ -1528,14 +1528,14 @@ static Int4 s_MBScanSubject_Any(const LookupTableWrap* lookup_wrap, if (s_BlastMBLookupHasHits(mb_lt, index)) { if (total_hits >= max_hits) break; - s_off = (s - abs_start)*COMPRESSION_RATIO; + s_off = (Int4)((s - abs_start)*COMPRESSION_RATIO); total_hits += s_BlastMBLookupRetrieve(mb_lt, index, offset_pairs + total_hits, s_off); } } - scan_range[0] = (s - abs_start)*COMPRESSION_RATIO; + scan_range[0] = (Int4)((s - abs_start)*COMPRESSION_RATIO); } else if (lut_word_length == 16 && scan_step == 1) { /* scan for lookup table width 16 and stride 1 */ diff --git a/c++/src/algo/blast/core/blast_options.c b/c++/src/algo/blast/core/blast_options.c index 0990d0d1..38029547 100644 --- a/c++/src/algo/blast/core/blast_options.c +++ b/c++/src/algo/blast/core/blast_options.c @@ -1,4 +1,4 @@ -/* $Id: blast_options.c 662032 2023-01-24 15:56:52Z boratyng $ +/* $Id: blast_options.c 683940 2024-06-10 12:09:42Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -1324,8 +1324,16 @@ LookupTableOptionsValidate(EBlastProgramType program_number, Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext, "Word-size must be 4 or greater for nucleotide comparison"); return BLASTERR_OPTION_VALUE_INVALID; + } else if (program_number == eBlastTypeBlastn && + options->word_size > DBSEQ_CHUNK_OVERLAP) { + char buffer[256]; + int bytes_written = snprintf(buffer, DIM(buffer), + "Word-size must be less than or equal to %d", DBSEQ_CHUNK_OVERLAP); + ASSERT(bytes_written < DIM(buffer)); + Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext, buffer); + return BLASTERR_OPTION_VALUE_INVALID; } else if (program_number != eBlastTypeBlastn && - program_number != eBlastTypeMapping && options->word_size > 5) + program_number != eBlastTypeMapping && options->word_size > 4) { if (program_number == eBlastTypeBlastp || program_number == eBlastTypeTblastn || @@ -1339,6 +1347,14 @@ LookupTableOptionsValidate(EBlastProgramType program_number, return BLASTERR_OPTION_VALUE_INVALID; } } + else if (program_number == eBlastTypePsiBlast && + options->word_size > 4) { + Blast_MessageWrite(blast_msg, eBlastSevError, + kBlastMessageNoContext, + "Word-size must be less " + "than 5 for psiblast"); + return BLASTERR_OPTION_VALUE_INVALID; + } else { Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext, diff --git a/c++/src/algo/blast/core/blast_parameters.c b/c++/src/algo/blast/core/blast_parameters.c index a58f6966..8270e97b 100644 --- a/c++/src/algo/blast/core/blast_parameters.c +++ b/c++/src/algo/blast/core/blast_parameters.c @@ -1,4 +1,4 @@ -/* $Id: blast_parameters.c 573108 2018-10-23 14:05:07Z boratyng $ +/* $Id: blast_parameters.c 683930 2024-06-10 12:07:59Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -1031,7 +1031,7 @@ CalculateLinkHSPCutoffs(EBlastProgramType program, BlastQueryInfo* query_info, /* Subtract off the expected score. */ - expected_length = BLAST_Nint(log(kbp->K*((double) query_length)* + expected_length = (Int4)BLAST_Nint(log(kbp->K*((double) query_length)* ((double) subject_length))/(kbp->H)); query_length = query_length - expected_length; diff --git a/c++/src/algo/blast/core/blast_posit.c b/c++/src/algo/blast/core/blast_posit.c index bc46f785..4342eaf8 100644 --- a/c++/src/algo/blast/core/blast_posit.c +++ b/c++/src/algo/blast/core/blast_posit.c @@ -361,7 +361,7 @@ impalaScaleMatrix(Kappa_compactSearchItems* compactSearch, for (c = 0; c < dim1; c++) { for (a = 0; a < dim2; a++) { if (BLAST_SCORE_MIN != private_matrix[c][a]) { - matrix[c][a] = BLAST_Nint((double) private_matrix[c][a] * + matrix[c][a] = (int)BLAST_Nint((double) private_matrix[c][a] * factor / kPSIScaleFactor); } } @@ -378,7 +378,7 @@ impalaScaleMatrix(Kappa_compactSearchItems* compactSearch, for (a = 0; a < dim2; a++) { if (BLAST_SCORE_MIN != private_matrix[c][a]) { private_matrix[c][a] = - BLAST_Nint((double) private_matrix[c][a] * factor * + (int)BLAST_Nint((double) private_matrix[c][a] * factor * scalefactor); } } diff --git a/c++/src/algo/blast/core/blast_psi_priv.c b/c++/src/algo/blast/core/blast_psi_priv.c index 9be43c4d..81b9a2de 100644 --- a/c++/src/algo/blast/core/blast_psi_priv.c +++ b/c++/src/algo/blast/core/blast_psi_priv.c @@ -2457,7 +2457,7 @@ _PSIConvertFreqRatiosToPSSM(_PSIInternalPssmData* internal_pssm, kPSIScaleFactor * freq_ratios->bit_scale_factor * log(freq_ratios->data[kResidue][j])/NCBIMATH_LN2; - internal_pssm->scaled_pssm[i][j] = BLAST_Nint(tmp); + internal_pssm->scaled_pssm[i][j] = (int)BLAST_Nint(tmp); } else { internal_pssm->scaled_pssm[i][j] = BLAST_SCORE_MIN; } @@ -2518,7 +2518,7 @@ _PSIScaleMatrix(const Uint1* query, for (j = 0; j < internal_pssm->nrows; j++) { if (scaled_pssm[i][j] != BLAST_SCORE_MIN) { pssm[i][j] = - BLAST_Nint(factor*scaled_pssm[i][j]/kPSIScaleFactor); + (int)BLAST_Nint(factor*scaled_pssm[i][j]/kPSIScaleFactor); } else { pssm[i][j] = BLAST_SCORE_MIN; } @@ -2573,7 +2573,7 @@ _PSIScaleMatrix(const Uint1* query, for (j = 0; j < internal_pssm->nrows; j++) { if (scaled_pssm[i][j] != BLAST_SCORE_MIN) { pssm[i][j] = - BLAST_Nint(factor*scaled_pssm[i][j]/kPSIScaleFactor); + (int)BLAST_Nint(factor*scaled_pssm[i][j]/kPSIScaleFactor); } else { pssm[i][j] = BLAST_SCORE_MIN; } diff --git a/c++/src/algo/blast/core/blast_stat.c b/c++/src/algo/blast/core/blast_stat.c index d130f5b2..7686422d 100644 --- a/c++/src/algo/blast/core/blast_stat.c +++ b/c++/src/algo/blast/core/blast_stat.c @@ -1,4 +1,4 @@ -/* $Id: blast_stat.c 633542 2021-06-21 19:27:23Z grichenk $ +/* $Id: blast_stat.c 683930 2024-06-10 12:07:59Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -737,7 +737,7 @@ SBlastScoreMatrixFree(SBlastScoreMatrix* matrix) if (matrix->data) { matrix->data = (int**) _PSIDeallocateMatrix((void**) matrix->data, - matrix->ncols); + (unsigned int)matrix->ncols); } /* Deallocate the matrix frequencies which is used by the @@ -766,7 +766,7 @@ SBlastScoreMatrixNew(size_t ncols, size_t nrows) return SBlastScoreMatrixFree(retval); } - retval->data = (int**) _PSIAllocateMatrix(ncols, nrows, sizeof(int)); + retval->data = (int**) _PSIAllocateMatrix((unsigned int)ncols, (unsigned int)nrows, sizeof(int)); if ( !retval->data ) { return SBlastScoreMatrixFree(retval); } @@ -792,7 +792,7 @@ SPsiBlastScoreMatrixFree(SPsiBlastScoreMatrix* matrix) if (matrix->freq_ratios) { matrix->freq_ratios = (double**) _PSIDeallocateMatrix((void**) matrix->freq_ratios, - matrix->pssm->ncols); + (unsigned int)matrix->pssm->ncols); } matrix->pssm = SBlastScoreMatrixFree(matrix->pssm); @@ -817,7 +817,7 @@ SPsiBlastScoreMatrixNew(size_t ncols) return SPsiBlastScoreMatrixFree(retval); } - retval->freq_ratios = (double**) _PSIAllocateMatrix(ncols, BLASTAA_SIZE, + retval->freq_ratios = (double**) _PSIAllocateMatrix((unsigned int)ncols, BLASTAA_SIZE, sizeof(double)); if ( !retval->freq_ratios ) { return SPsiBlastScoreMatrixFree(retval); @@ -1104,7 +1104,7 @@ Int2 BlastScoreBlkNuclMatrixCreate(BlastScoreBlk* sbp) if (BLASTNA_TO_NCBI4NA[index1] & BLASTNA_TO_NCBI4NA[index2]) { /* round up for positive scores, down for negatives. */ matrix[index1][index2] = - BLAST_Nint( (double) ((degeneracy[index2]-1)*penalty + + (Int4)BLAST_Nint( (double) ((degeneracy[index2]-1)*penalty + reward)/ (double) degeneracy[index2]); if (index1 != index2) { @@ -1635,15 +1635,16 @@ Blast_ScoreBlkMatrixFill(BlastScoreBlk* sbp, GET_MATRIX_PATH get_path) FILE *fp = NULL; char* full_matrix_path = NULL; - int path_len = strlen(matrix_path); - int buflen = path_len + strlen(sbp->name); + size_t path_len = strlen(matrix_path); + size_t buflen = path_len + strlen(sbp->name); full_matrix_path = (char*) malloc((buflen + 1) * sizeof(char)); if (!full_matrix_path) { return -1; } - strncpy(full_matrix_path, matrix_path, buflen); - strncat(full_matrix_path, sbp->name, buflen - path_len); + strncpy(full_matrix_path, matrix_path, path_len); + strncpy(full_matrix_path + path_len, sbp->name, buflen - path_len); + full_matrix_path[buflen] = '\0'; sfree(matrix_path); @@ -3899,7 +3900,7 @@ Blast_KarlinBlkNuclGappedCalc(Blast_KarlinBlk* kbp, Int4 gap_open, } else if (error_return) { char buffer[8192]; int i=0; - int len=0; + size_t len=0; /* Unsupported gap costs combination. */ sprintf(buffer, "Gap existence and extension values %ld and %ld " "are not supported for substitution scores %ld and %ld\n", @@ -4695,7 +4696,7 @@ RPSRescalePssm(double scalingFactor, Int4 rps_query_length, Blast_FillResidueProbability(rps_query_seq, rps_query_length, resProb); - alphabet_size = sbp->psi_matrix->pssm->nrows; + alphabet_size = (Int4)sbp->psi_matrix->pssm->nrows; RPSFillScores(posMatrix, db_seq_length, resProb, scoreArray, return_sfp, BLAST_SCORE_RANGE_MAX, alphabet_size); @@ -4728,7 +4729,7 @@ RPSRescalePssm(double scalingFactor, Int4 rps_query_length, } else { temp = ((double)(posMatrix[index][inner_index])) * finalLambda; - returnMatrix[index][inner_index] = BLAST_Nint(temp); + returnMatrix[index][inner_index] = (Int4)BLAST_Nint(temp); } } for (; inner_index < BLASTAA_SIZE; inner_index++) { @@ -4914,7 +4915,7 @@ static Int2 s_BuildCompressedScoreMatrix(BlastScoreBlk *sbp, } val = (val < 1e-8) ? min_freq : log(val); - scores[q][s] = BLAST_Nint(val * matrix_scale_factor); + scores[q][s] = (Int4)BLAST_Nint(val * matrix_scale_factor); } } } diff --git a/c++/src/algo/blast/core/blast_traceback.c b/c++/src/algo/blast/core/blast_traceback.c index 6c938d9c..135a3e98 100644 --- a/c++/src/algo/blast/core/blast_traceback.c +++ b/c++/src/algo/blast/core/blast_traceback.c @@ -1,4 +1,4 @@ -/* $Id: blast_traceback.c 638265 2021-09-27 15:55:19Z fongah2 $ +/* $Id: blast_traceback.c 683930 2024-06-10 12:07:59Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -1760,16 +1760,17 @@ BLAST_ComputeTraceback_MT(EBlastProgramType program_number, } // -RMH-: end of change + if(hit_params->options->query_cov_hsp_perc > 0 || hit_params->options->max_hsps_per_subject > 0 || + (hit_params->options->hsp_filt_opt != NULL && hit_params->options->hsp_filt_opt->subject_besthit_opts != NULL)) { + s_FilterBlastResults(results, hit_params->options, query_info, program_number); + } + /* Re-sort the hit lists according to their best e-values, because they could have changed. Only do this for a database search. */ if (BlastSeqSrcGetTotLen(seq_src) > 0) { Blast_HSPResultsSortByEvalue(results); } - if(hit_params->options->query_cov_hsp_perc > 0 || hit_params->options->max_hsps_per_subject > 0 || - (hit_params->options->hsp_filt_opt != NULL && hit_params->options->hsp_filt_opt->subject_besthit_opts != NULL)) { - s_FilterBlastResults(results, hit_params->options, query_info, program_number); - } /* Eliminate extra hits from results, if preliminary hit list size is larger than the final hit list size */ @@ -1818,7 +1819,7 @@ Blast_RunTracebackSearchWithInterrupt(EBlastProgramType program, TInterruptFnPtr interrupt_search, SBlastProgress* progress_info, size_t num_threads) { - const int N_T = ((num_threads == 0) ? 1 : num_threads); + const int N_T = ((num_threads == 0) ? 1 : (int)num_threads); Int2 status = 0; SThreadLocalDataArray* thread_data = SThreadLocalDataArrayNew(N_T); char * ADAPTIVE_CBS_ENV = getenv("ADAPTIVE_CBS"); diff --git a/c++/src/algo/blast/core/blast_util.c b/c++/src/algo/blast/core/blast_util.c index 0bd632b8..04173c22 100644 --- a/c++/src/algo/blast/core/blast_util.c +++ b/c++/src/algo/blast/core/blast_util.c @@ -1,4 +1,4 @@ -/* $Id: blast_util.c 635339 2021-08-02 13:25:26Z fongah2 $ +/* $Id: blast_util.c 683930 2024-06-10 12:07:59Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -799,7 +799,7 @@ BLAST_TranslateCompressedSequence(Uint1* translation, Int4 length, *prot_seq = NULLB; - return (prot_seq - prot_seq_start); + return (Int4)(prot_seq - prot_seq_start); } /* BlastTranslateUnambiguousSequence */ diff --git a/c++/src/algo/blast/core/jumper.c b/c++/src/algo/blast/core/jumper.c index 1ec97d1e..46eeeae8 100644 --- a/c++/src/algo/blast/core/jumper.c +++ b/c++/src/algo/blast/core/jumper.c @@ -1,4 +1,4 @@ -/* $Id: jumper.c 597903 2019-12-02 11:11:04Z boratyng $ +/* $Id: jumper.c 683930 2024-06-10 12:07:59Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -865,7 +865,7 @@ next_jp: /* save the length of the ungapped extension */ if (is_ungapped && jp->dcp != jp->dcq) { - *ungapped_ext_len = cp - query - 1; + *ungapped_ext_len = (Int4)(cp - query - 1); is_ungapped = FALSE; } @@ -900,7 +900,7 @@ next_jp: } } - *query_ext_len = cpstop - query; + *query_ext_len = (Int4)(cpstop - query); *subject_ext_len = cqstop; if (is_ungapped) { @@ -1075,7 +1075,7 @@ next_jp: /* save the length of the ungapped extension */ if (is_ungapped && jp->dcp != jp->dcq) { - *ungapped_ext_len = cp - query - 1; + *ungapped_ext_len = (Int4)(cp - query - 1); is_ungapped = FALSE; } @@ -1108,7 +1108,7 @@ next_jp: s_TrimExtension(edit_script, -mismatch_score, &cp, &cq, num_identical, TRUE); - *query_ext_len = cp - query; + *query_ext_len = (Int4)(cp - query); *subject_ext_len = cq; if (is_ungapped) { @@ -1321,7 +1321,7 @@ next_jp: /* save the length of the ungapped extension */ if (is_ungapped && jp->dcp != jp->dcq) { - *ungapped_ext_len = cp - query - 1; + *ungapped_ext_len = (Int4)(cp - query - 1); is_ungapped = FALSE; } @@ -1368,7 +1368,7 @@ next_jp: *best_num_identical = num_identical; } - *query_ext_len = cpstop - query; + *query_ext_len = (Int4)(cpstop - query); *subject_ext_len = cqstop; edit_script->num_ops = num_ops; @@ -1542,7 +1542,7 @@ next_jp: GapPrelimEditBlockAdd(edit_script, eGapAlignSub, new_matches); } - *query_ext_len = cp - query; + *query_ext_len = (Int4)(cp - query); *subject_ext_len = cq; return score; @@ -1699,7 +1699,7 @@ next_jp: /* save the length of the ungapped extension */ if (is_ungapped && jp->dcp != jp->dcq) { - *ungapped_ext_len = cp - query - 1; + *ungapped_ext_len = (Int4)(cp - query - 1); is_ungapped = FALSE; } @@ -1732,7 +1732,7 @@ next_jp: s_TrimExtension(edit_script, -mismatch_score, &cp, &cq, num_identical, TRUE); - *query_ext_len = cp - query; + *query_ext_len = (Int4)(cp - query); *subject_ext_len = cq; if (is_ungapped) { @@ -1907,7 +1907,7 @@ next_jp: } } - *query_ext_len = query + query_offset - cpstop; + *query_ext_len = (Int4)(query + query_offset - cpstop); *subject_ext_len = subject_offset - cqstop; return best_score; @@ -2098,7 +2098,7 @@ next_jp: s_TrimExtension(edit_script, -mismatch_score, &cp, &cq, num_identical, FALSE); - *query_ext_len = query + query_offset - cp; + *query_ext_len = (Int4)(query + query_offset - cp); *subject_ext_len = subject_offset - cq; /* return extension score */ @@ -2342,7 +2342,7 @@ next_jp: *best_num_identical = num_identical; } - *query_ext_len = query + query_offset - cpstop; + *query_ext_len = (Int4)(query + query_offset - cpstop); *subject_ext_len = subject_offset - cqstop; edit_script->num_ops = num_ops; @@ -2502,7 +2502,7 @@ next_jp: GapPrelimEditBlockAdd(edit_script, eGapAlignSub, new_matches); } - *query_ext_len = query + query_offset - cp; + *query_ext_len = (int)(query + query_offset - cp); *subject_ext_len = subject_offset - cq; return score; diff --git a/c++/src/algo/blast/core/na_ungapped.c b/c++/src/algo/blast/core/na_ungapped.c index 57322844..e5506524 100644 --- a/c++/src/algo/blast/core/na_ungapped.c +++ b/c++/src/algo/blast/core/na_ungapped.c @@ -1,4 +1,4 @@ -/* $Id: na_ungapped.c 544985 2017-08-30 14:21:34Z boratyng $ +/* $Id: na_ungapped.c 683930 2024-06-10 12:07:59Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -203,7 +203,7 @@ s_NuclUngappedExtendExact(BLAST_SequenceBlk * query, } } - ungapped_data->q_start = q_beg - query->sequence; + ungapped_data->q_start = (Int4)(q_beg - query->sequence); ungapped_data->s_start = s_off - (q_off - ungapped_data->q_start); if (q_avail < s_avail) { @@ -238,7 +238,7 @@ s_NuclUngappedExtendExact(BLAST_SequenceBlk * query, base--; } - ungapped_data->length = q_end - q_beg; + ungapped_data->length = (Int4)(q_end - q_beg); ungapped_data->score = score; } @@ -306,7 +306,7 @@ s_NuclUngappedExtend(BLAST_SequenceBlk * query, /* record the start point of the extension */ - ungapped_data->q_start = new_q - q_start; + ungapped_data->q_start = (Int4)(new_q - q_start); ungapped_data->s_start = s_ext - (q_ext - ungapped_data->q_start); /* the right extension begins at the first bases not examined by the @@ -343,9 +343,9 @@ s_NuclUngappedExtend(BLAST_SequenceBlk * query, /* record the length and score of the extension. Make sure the alignment extends at least to s_match_end */ ungapped_data->score = score; - ungapped_data->length = MAX(s_match_end - ungapped_data->s_start, + ungapped_data->length = (Int4)( MAX(s_match_end - ungapped_data->s_start, (new_q - q_start) - - ungapped_data->q_start + 1); + ungapped_data->q_start + 1) ); } } @@ -1735,7 +1735,7 @@ Int2 MB_IndexedWordFinder( } ASSERT(get_results); - word_size = get_results(/*lookup_wrap->lut, */oid, chunk, init_hitlist); + word_size = (Uint4) get_results(/*lookup_wrap->lut, */oid, chunk, init_hitlist); if( word_size > 0 && word_params->ungapped_extension ) { hash = ir_hash_create(); @@ -1778,7 +1778,7 @@ Int2 MB_IndexedWordFinder( } } - init_hitlist->total = new_hsp - init_hitlist->init_hsp_array; + init_hitlist->total = (Int4)(new_hsp - init_hitlist->init_hsp_array); hash = ir_hash_destroy( hash ); } @@ -2202,7 +2202,7 @@ Int2 ShortRead_IndexedWordFinder( } ASSERT(get_results); - word_size = get_results(oid, chunk, init_hitlist); + word_size = (Uint4)get_results(oid, chunk, init_hitlist); if (*hsp_list == NULL) { *hsp_list = Blast_HSPListNew(BlastHspNumMax(TRUE, diff --git a/c++/src/algo/blast/core/phi_lookup.c b/c++/src/algo/blast/core/phi_lookup.c index bd18fb50..13806c8a 100644 --- a/c++/src/algo/blast/core/phi_lookup.c +++ b/c++/src/algo/blast/core/phi_lookup.c @@ -1,4 +1,4 @@ -/* $Id: phi_lookup.c 668432 2023-06-05 16:30:10Z fongah2 $ +/* $Id: phi_lookup.c 683930 2024-06-10 12:07:59Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -436,7 +436,7 @@ SPHIPatternSearchBlkNew(char* pattern_in, Boolean is_dna, BlastScoreBlk* sbp, currentWildcardProduct = 1; currentSetMask = 0; - pattern_length = strlen(pattern_in); + pattern_length = (int)strlen(pattern_in); if (pattern_length >= PHI_MAX_PATTERN_LENGTH) { if (error_msg) { diff --git a/c++/src/algo/blast/dbindex/dbindex_factory.cpp b/c++/src/algo/blast/dbindex/dbindex_factory.cpp index ca09ee54..0cee2aaf 100644 --- a/c++/src/algo/blast/dbindex/dbindex_factory.cpp +++ b/c++/src/algo/blast/dbindex/dbindex_factory.cpp @@ -1,4 +1,4 @@ -/* $Id: dbindex_factory.cpp 621859 2020-12-17 15:26:54Z grichenk $ +/* $Id: dbindex_factory.cpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -323,7 +323,7 @@ class CSubjectMap_Factory_TBase : public CSubjectMap_Factory_Base /** Get the total memory usage by the subject map in bytes. @return memory usage by this instance */ - TWord total() const { return seq_store_.size(); } + TWord total() const { return static_cast(seq_store_.size()); } /** Append the next chunk of the input sequence currently being processed to the subject map. @@ -656,7 +656,7 @@ string CSubjectMap_Factory_Base::extractSeqVector( TSeqData & sd ) objects::CBioseq_Handle bsh = seh.GetSeq(); c_seq_ = bsh.GetSeqVector( objects::CBioseq_Handle::eCoding_Iupac ); string idstr = objects::sequence::GetTitle( bsh ); - Uint4 pos = idstr.find_first_of( " \t" ); + Uint4 pos = static_cast(idstr.find_first_of( " \t" )); idstr = idstr.substr( 0, pos ); return idstr; } @@ -688,10 +688,10 @@ string CSubjectMap_Factory_Base::NewSequenceInit( //------------------------------------------------------------------------- void CSubjectMap_Factory_TBase::Save( CNcbiOstream & os ) const { - TWord tmp = subjects_.size(); - TWord subject_map_size = + TWord tmp = static_cast(subjects_.size()); + TWord subject_map_size = static_cast( tmp*sizeof( TWord ) + - chunks_.size()*sizeof( TWord ); + chunks_.size()*sizeof( TWord )); WriteWord( os, subject_map_size ); for( TSubjects::const_iterator cit = subjects_.begin(); @@ -714,7 +714,7 @@ void CSubjectMap_Factory_TBase::Save( CNcbiOstream & os ) const bool CSubjectMap_Factory_TBase::AddSequenceChunk( TSeqStore::size_type seq_off ) { - TSeqPos chunk_start = (chunk_size_ - chunk_overlap_)*(c_chunk_++); + TSeqPos chunk_start = static_cast((chunk_size_ - chunk_overlap_)*(c_chunk_++)); if( chunk_start >= c_seq_.size() ) { --c_chunk_; @@ -767,13 +767,13 @@ bool CSubjectMap_Factory_TBase::AddSequenceChunk( } chunks_.push_back( - TSeqInfo( seq_off, c_seq_.size(), segs ) ); + TSeqInfo( static_cast(seq_off), c_seq_.size(), segs ) ); if( *subjects_.rbegin() == 0 ) { - *subjects_.rbegin() = chunks_.size(); + *subjects_.rbegin() = static_cast(chunks_.size()); } - last_chunk_ = chunks_.size(); + last_chunk_ = static_cast(chunks_.size()); return true; } @@ -815,8 +815,8 @@ bool CSubjectMap_Factory::AddSequenceChunk( bool & overflow ) { overflow = false; bool starting = (this->c_chunk_ == 0); - TSeqPos chunk_start = - (this->chunk_size_ - this->chunk_overlap_)*this->c_chunk_; + TSeqPos chunk_start =static_cast( + (this->chunk_size_ - this->chunk_overlap_)*this->c_chunk_); TBase::TSeqStore::size_type seq_off = starting ? this->seq_store_.size() : this->chunks_.rbegin()->seq_start_ @@ -833,7 +833,7 @@ bool CSubjectMap_Factory::AddSequenceChunk( bool & overflow ) if( lid_map_.empty() || cur_lid_len_ + chunk_len > length_limit ) { Uint1 lid_bits = 8*sizeof( TWord ) - offset_bits_; - TSeqNum lid_limit = (1UL<((1UL<= lid_limit ) { overflow = true; @@ -846,7 +846,7 @@ bool CSubjectMap_Factory::AddSequenceChunk( bool & overflow ) cur_lid_len_ = 0; } - lid_map_.rbegin()->end_ = this->chunks_.size(); + lid_map_.rbegin()->end_ = static_cast(this->chunks_.size()); cur_lid_len_ += chunk_len; lid_map_.rbegin()->seq_end_ = lid_map_.rbegin()->seq_start_ + cur_lid_len_; @@ -879,7 +879,7 @@ bool CSubjectMap_Factory::AddSequenceChunk( bool & overflow ) inline bool CSubjectMap_Factory::CheckOffset( const Uint1 * seq, TSeqPos off ) const { - TSeqPos soff = seq - &(this->seq_store_[0]); + TSeqPos soff = static_cast(seq - &(this->seq_store_[0])); TLIdMap::const_reverse_iterator iter = lid_map_.rbegin(); while( iter != lid_map_.rend() && iter->seq_start_ > soff ) ++iter; ASSERT( iter->seq_start_ <= soff ); @@ -891,14 +891,14 @@ inline bool CSubjectMap_Factory::CheckOffset( inline TWord CSubjectMap_Factory::MakeOffset( const Uint1 * seq, TSeqPos off ) const { - TSeqPos soff = seq - &(this->seq_store_[0]); + TSeqPos soff = static_cast(seq - &(this->seq_store_[0])); TLIdMap::const_reverse_iterator iter = lid_map_.rbegin(); while( iter != lid_map_.rend() && iter->seq_start_ > soff ) ++iter; ASSERT( iter->seq_start_ <= soff ); off += (soff - iter->seq_start_)*CR; off /= stride_; off += min_offset_; - TWord result = ((lid_map_.rend() - iter - 1)<( ((lid_map_.rend() - iter - 1)<(sizeof( TWord )*lengths_.size()); WriteWord( os, sz ); WriteWord( os, (TWord)offset_bits_ ); @@ -923,7 +923,7 @@ void CSubjectMap_Factory::Save( CNcbiOstream & os ) const WriteWord( os, (TWord)(*it) ); } - sz = 4*sizeof( TWord )*lid_map_.size(); + sz = static_cast(4*sizeof( TWord )*lid_map_.size()); WriteWord( os, sz ); for( TLIdMap::const_iterator it = lid_map_.begin(); @@ -1451,7 +1451,7 @@ void COffsetData_Factory::EncodeAndAddOffset( TWord nmer, TSeqPos start, TSeqPos stop, TSeqPos curr, TWord offset ) { - TSeqPos start_diff = curr + 2 - hkey_width_ - start; + TSeqPos start_diff = curr + 2 - static_cast(hkey_width_) - start; TSeqPos end_diff = stop - curr; if( start_diff <= options_.stride || end_diff <= options_.stride ) { diff --git a/c++/src/algo/blast/dbindex/dbindex_search.cpp b/c++/src/algo/blast/dbindex/dbindex_search.cpp index 1d0c8ff3..750cdc91 100644 --- a/c++/src/algo/blast/dbindex/dbindex_search.cpp +++ b/c++/src/algo/blast/dbindex/dbindex_search.cpp @@ -1,4 +1,4 @@ -/* $Id: dbindex_search.cpp 171056 2009-09-21 13:50:13Z morgulis $ +/* $Id: dbindex_search.cpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -1009,7 +1009,7 @@ void CSearch_Base< LEGACY, NHITS, derived_t >::ExtendLeft( qstart += qstart_; nmax = nmax < options_.word_size - hkey_width ? - nmax : options_.word_size - hkey_width; + nmax : static_cast(options_.word_size - hkey_width); while( nmax > 0 && incomplete > 0 && qpos > qstart ) { Uint1 sbyte = (((*spos)>>(2*(CR - incomplete--)))&0x3); @@ -1019,9 +1019,9 @@ void CSearch_Base< LEGACY, NHITS, derived_t >::ExtendLeft( } nmax = (nmax < (TSeqPos)(qpos - qstart)) - ? nmax : qpos - qstart; + ? nmax : (TSeqPos)(qpos - qstart); nmax = (nmax < (TSeqPos)(CR*(spos - sstart))) - ? nmax : CR*(spos - sstart); + ? nmax : (TSeqPos)(CR*(spos - sstart)); --spos; while( nmax >= CR ) { @@ -1091,7 +1091,7 @@ void CSearch_Base< LEGACY, NHITS, derived_t >::ExtendRight( nmax = (nmax < (TSeqPos)(qend - qpos)) ? nmax : (TSeqPos)(qend - qpos); nmax = (nmax <= (send - spos)*CR) ? - nmax : (send - spos)*CR; + nmax : (TSeqPos)((send - spos)*CR); while( nmax >= CR ) { Uint1 sbyte = *spos++; @@ -1145,7 +1145,7 @@ void CSearch_Base< LEGACY, NHITS, derived_t >::ProcessBoundaryOffset( TSeqPos nmaxleft = (TSeqPos)(bounds>>code_bits_); TSeqPos nmaxright = (TSeqPos)(bounds&((1<::ProcessOffset( TWord offset ) { TTrackedSeed seed( - qoff_, (TSeqPos)offset, index_impl_.hkey_width(), qoff_ ); + qoff_, (TSeqPos)offset, (TSeqPos)index_impl_.hkey_width(), qoff_ ); TTrackedSeeds & subj_seeds = seeds_[subject_]; if( subj_seeds.EvalAndUpdate( seed ) ) { @@ -1207,12 +1207,12 @@ unsigned long CSearch_Base< LEGACY, NHITS, derived_t >::ProcessRoot( if( root->soff_ < min_offset_ ) { TSeqPos boundary = (root++)->soff_; - ProcessBoundaryOffset( root->soff_ - min_offset_, boundary ); + ProcessBoundaryOffset( root->soff_ - static_cast(min_offset_), boundary ); // root->soff_ - CDbIndex::MIN_OFFSET, boundary ); soff_ = root->soff_; return 2; }else { - ProcessOffset( root->soff_ - min_offset_ ); + ProcessOffset( root->soff_ - static_cast(min_offset_) ); soff_ = root->soff_; return 1; } diff --git a/c++/src/algo/blast/format/blast_format.cpp b/c++/src/algo/blast/format/blast_format.cpp index dd5c05d9..12859775 100644 --- a/c++/src/algo/blast/format/blast_format.cpp +++ b/c++/src/algo/blast/format/blast_format.cpp @@ -133,7 +133,7 @@ CBlastFormat::CBlastFormat(const blast::CBlastOptions& options, { BlastSeqSrc* seqsrc = db_adapter.MakeSeqSrc(); num_seqs=BlastSeqSrcGetNumSeqs(seqsrc); - total_length=BlastSeqSrcGetTotLen(seqsrc); + total_length=static_cast(BlastSeqSrcGetTotLen(seqsrc)); } CBlastFormatUtil::FillScanModeBlastDbInfo(m_DbInfo, m_DbIsAA, num_seqs, total_length, m_SubjectTag); @@ -2488,7 +2488,7 @@ void CBlastFormat::LogBlastSearchInfo(CBlastUsageReport & report) report.AddParam(CBlastUsageReport::eNumSubjects, (int) m_SeqInfoSrc->Size()); int total_subj_length = 0; for (size_t i = 0; i < m_SeqInfoSrc->Size(); i++) { - total_subj_length += m_SeqInfoSrc->GetLength(i); + total_subj_length += (int)m_SeqInfoSrc->GetLength(static_cast(i)); } report.AddParam(CBlastUsageReport::eSubjectsLength, total_subj_length); } diff --git a/c++/src/algo/blast/format/blastfmtutil.cpp b/c++/src/algo/blast/format/blastfmtutil.cpp index e6ef8cbd..96c2390d 100644 --- a/c++/src/algo/blast/format/blastfmtutil.cpp +++ b/c++/src/algo/blast/format/blastfmtutil.cpp @@ -1,4 +1,4 @@ -/* $Id: blastfmtutil.cpp 621897 2020-12-17 15:27:43Z grichenk $ +/* $Id: blastfmtutil.cpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -457,7 +457,7 @@ s_MaskQuerySeq(CAlnVec& alnvec, string& query_seq, } vector > masks_v; - int aln_stop = query_seq.size() - 1; + int aln_stop = static_cast(query_seq.size()) - 1; ITERATE(ncbi::TMaskedQueryRegions, mask_iter, mask_info) { if ((*mask_iter)->GetFrame() != query_frame) continue; diff --git a/c++/src/algo/blast/format/blastxml_format.cpp b/c++/src/algo/blast/format/blastxml_format.cpp index 03af715a..edc786d7 100644 --- a/c++/src/algo/blast/format/blastxml_format.cpp +++ b/c++/src/algo/blast/format/blastxml_format.cpp @@ -1,4 +1,4 @@ -/* $Id: blastxml_format.cpp 621898 2020-12-17 15:27:43Z grichenk $ +/* $Id: blastxml_format.cpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -310,8 +310,8 @@ s_SeqAlignSetToXMLHsps(list >& xhsp_list, // because of a bug, one of the sequence strings may be truncated, hence // it is necessary to take a minimum here. // FIXME: Should an exception be thrown instead? - const unsigned int kMaxOffset = min(query_seq.size(), - subject_seq.size()); + const unsigned int kMaxOffset = static_cast(min(query_seq.size(), + subject_seq.size())); for (unsigned int i = 0; i < kMaxOffset; ++i) { if (query_seq[i] == subject_seq[i]) { ++num_ident; diff --git a/c++/src/algo/blast/proteinkmer/blastkmer.cpp b/c++/src/algo/blast/proteinkmer/blastkmer.cpp index 6fb2695e..a14f9a0d 100644 --- a/c++/src/algo/blast/proteinkmer/blastkmer.cpp +++ b/c++/src/algo/blast/proteinkmer/blastkmer.cpp @@ -1,4 +1,4 @@ -/* $Id: blastkmer.cpp 536161 2017-05-16 14:36:47Z madden $ +/* $Id: blastkmer.cpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -181,7 +181,7 @@ CBlastKmer::x_SearchMultipleQueries(int firstQuery, int numQuery, const SBlastKm { TQueryMessages errs; int numThreads = (int) GetNumberOfThreads(); - int numFiles = m_KmerFiles.size(); + int numFiles = static_cast( m_KmerFiles.size()); if (numThreads > numQuery) numThreads = numFiles; @@ -277,7 +277,7 @@ for(int index=0; indexGetNumTargetSeqs() > 0) { - int vec_size = final_results.size(); + int vec_size = static_cast( final_results.size() ); int num_matches = m_Opts->GetNumTargetSeqs(); if (vec_size > num_matches) final_results.erase(final_results.begin()+num_matches, final_results.end()); @@ -370,7 +370,7 @@ CBlastKmer::Run() { if (kmerVer > 2) kmerParams.chunkSize = mhfile.GetChunkSize(); - int numQueries = m_QueryVector.size(); + int numQueries = static_cast(m_QueryVector.size()); CRef kmerResultsSet = x_SearchMultipleQueries(0, numQueries, kmerParams, a.data(), b.data(), kValues, badMers); diff --git a/c++/src/algo/blast/proteinkmer/blastkmerindex.cpp b/c++/src/algo/blast/proteinkmer/blastkmerindex.cpp index a56f68bd..dce22210 100644 --- a/c++/src/algo/blast/proteinkmer/blastkmerindex.cpp +++ b/c++/src/algo/blast/proteinkmer/blastkmerindex.cpp @@ -1,4 +1,4 @@ -/* $Id: blastkmerindex.cpp 556010 2018-01-25 12:50:23Z madden $ +/* $Id: blastkmerindex.cpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -307,7 +307,7 @@ void s_MinhashSequences2(uint32_t q_oid, } // end each kmer if (hash_values.size() < static_cast(num_hashes)) { - int rem = 1 + num_hashes - hash_values.size(); + int rem = 1 + num_hashes - static_cast(hash_values.size()); uint32_t hashval = 0xffffffff; // Fill in empties for (int i=0; i > >& seq_ int q_oid, int numBands, int numRows, int& total_chunks, uint8_t* uniqueHash) { - int num_chunks = seq_hash[q_oid].size(); + int num_chunks = static_cast(seq_hash[q_oid].size()); for (int n=0; n > >& seq int max=4*num_k+1; vector key(max); - int num_chunks=seq_hash[q_oid].size(); + int num_chunks=static_cast(seq_hash[q_oid].size()); int temp_index=0; int temp_hash=0; for (int n=0; n > >& seq int q_oid, int numHashes, int numRows, int& total_chunks, uint8_t* uniqueHash) { - int num_chunks = seq_hash[q_oid].size(); + int num_chunks = static_cast(seq_hash[q_oid].size()); int numHashMax = numHashes - numRows + 1; uint32_t temp_hash = 0; for (int n=0; n(paths.size()); #pragma omp parallel for num_threads(numThreads) for(int index=0; index(badMers.size()); if (num > (2*m_NumHashFct-1)) num = 2*m_NumHashFct-1; index_file.write((char *) &(num), 4); @@ -766,7 +766,7 @@ CBlastKmerBuildIndex::x_WriteDataFile(vector < vector < vector < uint32_t > > > width = 4; for(int q_oid=0;q_oid(seq_hash[q_oid].size()); for (int n=0; n tmp_hash; diff --git a/c++/src/algo/blast/proteinkmer/blastkmerutils.cpp b/c++/src/algo/blast/proteinkmer/blastkmerutils.cpp index d8b977ad..43a63e1d 100644 --- a/c++/src/algo/blast/proteinkmer/blastkmerutils.cpp +++ b/c++/src/algo/blast/proteinkmer/blastkmerutils.cpp @@ -1,4 +1,4 @@ -/* $Id: blastkmerutils.cpp 662402 2023-01-30 14:32:39Z madden $ +/* $Id: blastkmerutils.cpp 683928 2024-06-10 12:07:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -137,7 +137,7 @@ set BlastKmerGetKmerSetStats(const string& query_sequence, int kmerNum vector trans_table; BlastKmerGetCompressedTranslationTable(trans_table, alphabetChoice); - int seq_length = query_sequence.length(); + int seq_length = static_cast(query_sequence.length()); const char* query = query_sequence.c_str(); // bail out if the sequence is too short @@ -211,7 +211,7 @@ set BlastKmerGetKmerSet(const string& query_sequence, bool do_seg, TSe vector trans_table; BlastKmerGetCompressedTranslationTable(trans_table, alphabetChoice); - int seq_length = query_sequence.length(); + int seq_length = static_cast(query_sequence.length()); const char* query = query_sequence.c_str(); // bail out if the sequence is too short @@ -275,7 +275,7 @@ set BlastKmerGetKmerSet2(const string& query_sequence, TSeqRange& rang vector trans_table; BlastKmerGetCompressedTranslationTable(trans_table, alphabetChoice); - int seq_length = query_sequence.length(); + int seq_length = static_cast(query_sequence.length()); const char* query = query_sequence.c_str(); // bail out if the sequence is too short @@ -400,7 +400,7 @@ int BlastKmerGetDistance(const vector& minhash1, const vector(minhash1.size()); for (int index=0; index(query.length()); vector range_v; int chunk_num = BlastKmerBreakUpSequence(seq_length, range_v, chunkSize); seq_hash.resize(chunk_num); @@ -485,7 +485,7 @@ bool minhash_query2(const string& query, int chunkSize) { bool kmersFound=false; // return value; - int seq_length = query.length(); + int seq_length = static_cast(query.length()); vector range_v; int chunk_num = BlastKmerBreakUpSequence(seq_length, range_v, chunkSize); seq_hash.resize(chunk_num); @@ -514,7 +514,7 @@ bool minhash_query2(const string& query, if (hash_values.size() < static_cast(numHashes)) { - int rem = 1 + numHashes - hash_values.size(); + int rem = 1 + numHashes - static_cast(hash_values.size()); uint32_t hashval = 0xffffffff; // Fill in empties for (int i=0; i >& query_hash, int num_bands, int rows_per_band) { - int num_chunks=query_hash.size(); + int num_chunks=static_cast(query_hash.size()); uint32_t temp_hash=0; for (int n=0; n >& query_hash, int numHashes, int numRows) { - int num_chunks=query_hash.size(); + int num_chunks=static_cast(query_hash.size()); uint32_t temp_hash=0; int numHashMax = numHashes - numRows + 1; for (int n=0; n >& query_hash, { int max=4*num_k+1; vector key(max); - int num_chunks=query_hash.size(); + int num_chunks=static_cast(query_hash.size()); uint32_t temp_hash=0; int temp_index=0; for (int n=0; n >& query_LSH_hash, vector< set >& candidates) { - int num=query_LSH_hash.size(); + int num=static_cast(query_LSH_hash.size()); for (int i=0; i::const_iterator iter=query_LSH_hash[i].begin(); iter != query_LSH_hash[i].end(); ++iter) @@ -706,7 +706,7 @@ void s_HashHashQuery(const vector < vector > & query_hash, vector < vector >& query_hash_hash, int compress, int version) { int hash_value=0; - int num_chunks=query_hash.size(); + int num_chunks=static_cast(query_hash.size()); const uint32_t kBig=0xffffffff; for (int n=0; n >& query_hash, BlastKmerStats& kmer_stats, int kmerVer) { - int num_chunks=query_hash.size(); + int num_chunks=static_cast(query_hash.size()); vector< vector > candidate_oids; candidate_oids.resize(num_chunks); @@ -925,7 +925,7 @@ BlastKmerVerifyIndex(CRef seqdb, string &error_msg) int status=0; vector kmerFiles; seqdb->FindVolumePaths(kmerFiles, false); - int numFiles = kmerFiles.size(); + int numFiles = static_cast(kmerFiles.size()); for (int i=0; i resultSet, CRef scope, CRef seqdb) { - int numSearches=resultSet->GetNumQueries(); + int numSearches=static_cast(resultSet->GetNumQueries()); vector oid_v; for (int index=0; index dbAdapter, TSearchMessages& msg_vec) res_type = eSequenceComparison; IBlastSeqInfoSrc * subject_infosrc = dbAdapter->MakeSeqInfoSrc(); if(subject_infosrc != NULL) { - num_subjects = subject_infosrc->Size(); + num_subjects = static_cast(subject_infosrc->Size()); } } for (index=0; indexGetNumQueries(); index++) @@ -184,7 +184,7 @@ CRef CBlastKmerSearch::Run(void) vector< CRef > scope_v = objmgr_qf->ExtractScopes(); s_GetSequencesIntoScope(resultSet, scope_v[0], seqdb); - int numSearches=resultSet->GetNumQueries(); + int numSearches=static_cast(resultSet->GetNumQueries()); CRef search_results(new CSearchResultSet()); for (int index=0; index > x_GetSampleHspStream(CRef opts, CSeqDB & db) { - CSeq_id sid("XP_558472"); + CSeq_id sid("EAL40459"); vector OIDS; db.SeqidToOids(sid, OIDS); @@ -416,7 +416,7 @@ BOOST_AUTO_TEST_CASE(TracebackEntrez) { BOOST_REQUIRE_EQUAL((int)use_these.size(), 1); if ( CSeq_id::PreferAccessionOverGi() ) { - BOOST_REQUIRE(*(use_these.begin()) == "seqid:XP_558472.3"); + BOOST_REQUIRE(*(use_these.begin()) == "seqid:EAL40459.3"); } } diff --git a/c++/src/algo/blast/unit_tests/api/version_reference_unit_test.cpp b/c++/src/algo/blast/unit_tests/api/version_reference_unit_test.cpp index 06724b16..2079e04c 100644 --- a/c++/src/algo/blast/unit_tests/api/version_reference_unit_test.cpp +++ b/c++/src/algo/blast/unit_tests/api/version_reference_unit_test.cpp @@ -1,4 +1,4 @@ -/* $Id: version_reference_unit_test.cpp 673803 2023-10-10 19:38:36Z ivanov $ +/* $Id: version_reference_unit_test.cpp 683952 2024-06-10 12:29:05Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_SUITE(version_reference) BOOST_AUTO_TEST_CASE(testVersion) { const int kMajor = 2; - const int kMinor = 15; + const int kMinor = 16; const int kPatch = 0; blast::CBlastVersion v; BOOST_REQUIRE_EQUAL(kMajor, v.GetMajor()); diff --git a/c++/src/algo/blast/vdb/blastn_vdb_args.cpp b/c++/src/algo/blast/vdb/blastn_vdb_args.cpp index e715501a..b685a110 100644 --- a/c++/src/algo/blast/vdb/blastn_vdb_args.cpp +++ b/c++/src/algo/blast/vdb/blastn_vdb_args.cpp @@ -1,4 +1,4 @@ -/* $Id: blastn_vdb_args.cpp 664744 2023-03-21 13:02:48Z fongah2 $ +/* $Id: blastn_vdb_args.cpp 676153 2023-12-11 14:53:51Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -43,6 +43,7 @@ BEGIN_SCOPE(blast) USING_SCOPE(objects); const string kArgSRASearchMode("sra_mode"); +const string kArgIncludeFilteredReads("include_filtered_reads"); void CBlastVDatabaseArgs::SetArgumentDescriptions(CArgDescriptions& arg_desc) @@ -77,10 +78,10 @@ CSRASearchModeArgs::SetArgumentDescriptions(CArgDescriptions& arg_desc) "2 = both unaligned reads and aligned reference seqs n"); arg_desc.AddDefaultKey(kArgSRASearchMode, "SRA_search_mode", kSRASearchMode, CArgDescriptions::eInteger, "0"); -} - - + string kIncludeFilteredReads = string ("Include filtered reads\n"); + arg_desc.AddFlag(kArgIncludeFilteredReads, kIncludeFilteredReads, true); +} CBlastnVdbAppArgs::CBlastnVdbAppArgs() { diff --git a/c++/src/algo/blast/vdb/common_priv.h b/c++/src/algo/blast/vdb/common_priv.h index 512160ff..fb493484 100644 --- a/c++/src/algo/blast/vdb/common_priv.h +++ b/c++/src/algo/blast/vdb/common_priv.h @@ -1,7 +1,7 @@ #ifndef SRASRC_COMMON_PRIV__H #define SRASRC_COMMON_PRIV__H -/* $Id: common_priv.h 633841 2021-06-28 13:54:08Z fongah2 $ +/* $Id: common_priv.h 683738 2024-06-04 12:01:08Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -91,6 +91,9 @@ #include #include +// System include, explicitly needed on FreeBSD as of VDB 3.1.1. +#include + // VDB includes #include #include diff --git a/c++/src/algo/blast/vdb/seqsrc_vdb.c b/c++/src/algo/blast/vdb/seqsrc_vdb.c index 8b39eba7..2c5d375f 100644 --- a/c++/src/algo/blast/vdb/seqsrc_vdb.c +++ b/c++/src/algo/blast/vdb/seqsrc_vdb.c @@ -545,7 +545,7 @@ s_VDBSRC_SrcNew(BlastSeqSrc* seqSrc, void* args) BlastSeqSrc* SRABlastSeqSrcInit(const char** vdbRunAccessions, Uint4 numRuns, Boolean isProtein, Boolean * excluded_runs, - Uint4* status, Boolean isCSRA) + Uint4* status, Boolean isCSRA, Boolean include_filtered_reads) { BlastSeqSrcNewInfo bssNewInfo; BlastSeqSrc* seqSrc = NULL; @@ -557,6 +557,7 @@ SRABlastSeqSrcInit(const char** vdbRunAccessions, Uint4 numRuns, vdbArgs.isRunExcluded = excluded_runs; vdbArgs.status = 0; vdbArgs.isCSRA = isCSRA; + vdbArgs.includeFilteredReads = include_filtered_reads; bssNewInfo.constructor = &s_VDBSRC_SrcNew; bssNewInfo.ctor_argument = (void*)&vdbArgs; diff --git a/c++/src/algo/blast/vdb/vdb2blast_util.cpp b/c++/src/algo/blast/vdb/vdb2blast_util.cpp index 41c87ff2..459be7c6 100644 --- a/c++/src/algo/blast/vdb/vdb2blast_util.cpp +++ b/c++/src/algo/blast/vdb/vdb2blast_util.cpp @@ -1,4 +1,4 @@ -/* $Id: vdb2blast_util.cpp 673574 2023-10-04 13:17:50Z ivanov $ +/* $Id: vdb2blast_util.cpp 676153 2023-12-11 14:53:51Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -236,7 +236,7 @@ CVDBBlastUtil::x_MakeVDBSeqSrc() Uint4 rc; // Construct the BlastSeqSrc object BlastSeqSrc* seqSrc = - SRABlastSeqSrcInit((const char**)vdbRunAccessions, numRuns, false, isRunExcluded, &rc, m_isCSRAUtil); + SRABlastSeqSrcInit((const char**)vdbRunAccessions, numRuns, false, isRunExcluded, &rc, m_isCSRAUtil, m_IncludeFilteredReads); string excluded_runs= kEmptyStr; // Clean up @@ -279,8 +279,10 @@ CVDBBlastUtil::x_MakeVDBSeqSrc() CVDBBlastUtil::CVDBBlastUtil(const string& strAllRuns, bool bOwnSeqSrc, - bool bCSRA): - m_bOwnSeqSrc(bOwnSeqSrc), m_strAllRuns(strAllRuns), m_isCSRAUtil(bCSRA) + bool bCSRA, + bool bIncludeFilteredReads): + m_bOwnSeqSrc(bOwnSeqSrc), m_strAllRuns(strAllRuns), m_isCSRAUtil(bCSRA), + m_IncludeFilteredReads(bIncludeFilteredReads) { m_seqSrc = x_MakeVDBSeqSrc(); if( VDBSRC_OVERFLOW_RV == BlastSeqSrcGetNumSeqs(m_seqSrc)) { @@ -709,7 +711,7 @@ void CVDBBlastUtil::CheckVDBs(const vector & vdbs) AutoPtr > isRunExcluded(new Boolean[numRuns]); Uint4 rc; // Construct the BlastSeqSrc object - SRABlastSeqSrcInit((const char**)vdbRunAccessions, numRuns, false, isRunExcluded.get(), &rc, false); + SRABlastSeqSrcInit((const char**)vdbRunAccessions, numRuns, false, isRunExcluded.get(), &rc, false, false); // Clean up string cannot_open= kEmptyStr; diff --git a/c++/src/algo/blast/vdb/vdb_priv.c b/c++/src/algo/blast/vdb/vdb_priv.c index 5df35e32..d49852d3 100644 --- a/c++/src/algo/blast/vdb/vdb_priv.c +++ b/c++/src/algo/blast/vdb/vdb_priv.c @@ -1,4 +1,4 @@ -/* $Id: vdb_priv.c 634347 2021-07-09 11:58:07Z fongah2 $ +/* $Id: vdb_priv.c 676153 2023-12-11 14:53:51Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -214,6 +214,8 @@ VDBSRC_InitData(TVDBData* vdbData, return; } + status = VdbBlastRunSetIgnoreReadFilter( vdbData->runSet, vdbArgs->includeFilteredReads); + { char tmp[1]; uint32_t tmp_s = 0; diff --git a/c++/src/algo/blast/vdb/vdb_priv.h b/c++/src/algo/blast/vdb/vdb_priv.h index a1aa77cc..b0643ca6 100644 --- a/c++/src/algo/blast/vdb/vdb_priv.h +++ b/c++/src/algo/blast/vdb/vdb_priv.h @@ -1,7 +1,7 @@ #ifndef VDBSRC_SRADB_PRIV__H #define VDBSRC_SRADB_PRIV__H -/* $Id: vdb_priv.h 633841 2021-06-28 13:54:08Z fongah2 $ +/* $Id: vdb_priv.h 676153 2023-12-11 14:53:51Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -128,6 +128,8 @@ struct SVDBSRC_NewArgs // Make a seqsrc for CSRA if set to true Boolean isCSRA; + + Boolean includeFilteredReads; }; typedef struct SVDBSRC_NewArgs TVDBNewArgs; diff --git a/c++/src/algo/blast/vdb/vdbblast_local.cpp b/c++/src/algo/blast/vdb/vdbblast_local.cpp index e1e752f0..819362e2 100644 --- a/c++/src/algo/blast/vdb/vdbblast_local.cpp +++ b/c++/src/algo/blast/vdb/vdbblast_local.cpp @@ -1,4 +1,4 @@ -/* $Id: vdbblast_local.cpp 673574 2023-10-04 13:17:50Z ivanov $ +/* $Id: vdbblast_local.cpp 676153 2023-12-11 14:53:51Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -190,7 +190,8 @@ static CRef s_CombineSearchSets(vector CRef s_RunLocalVDBSearch(const string & dbs, CRef query_factory, - CRef opt_handle, Int4 & num_extensions) + CRef opt_handle, Int4 & num_extensions, + bool include_filtered_reads) { bool isCSRA = false; string csras = kEmptyStr; @@ -199,8 +200,7 @@ CRef s_RunLocalVDBSearch(const string & dbs, csras = dbs.substr(k_CSRA_CHUNK.size()); } - //CRef vdbUtil(new CVDBBlastUtil(isCSRA?csras:dbs, true, isCSRA)); - CVDBBlastUtil vdbUtil(isCSRA?csras:dbs, true, isCSRA); + CVDBBlastUtil vdbUtil(isCSRA?csras:dbs, true, isCSRA, include_filtered_reads); BlastSeqSrc* seqSrc = vdbUtil.GetSRASeqSrc(); CRef seqInfoSrc = vdbUtil.GetSRASeqInfoSrc(); @@ -223,7 +223,8 @@ CRef s_RunLocalVDBSearch(const string & dbs, CRef s_RunPsiVDBSearch(const string & dbs, CRef pssm, - CRef opt_handle) + CRef opt_handle, + bool include_filtered_reads) { bool isCSRA = false; string csras = kEmptyStr; @@ -232,7 +233,7 @@ CRef s_RunPsiVDBSearch(const string & dbs, csras = dbs.substr(k_CSRA_CHUNK.size()); } - CRef vdbUtil(new CVDBBlastUtil(isCSRA?csras:dbs, false, isCSRA)); + CRef vdbUtil(new CVDBBlastUtil(isCSRA?csras:dbs, false, isCSRA, include_filtered_reads)); CRef results; BlastSeqSrc* seqSrc = vdbUtil->GetSRASeqSrc(); CRef seqInfoSrc = vdbUtil->GetSRASeqInfoSrc(); @@ -266,11 +267,11 @@ class CVDBThread : public CThread public: CVDBThread(CRef query_factory, vector & chunks, - CRef options); + CRef options, bool include_filtered_reads); CVDBThread(CRef pssm, vector & chunks, - CRef options); + CRef options, bool include_filtered_reads); void * Main(void); private: @@ -282,6 +283,7 @@ private: CRef m_query_factory; vector m_chunks; CRef m_opt_handle; + bool m_include_filtered_reads; Int4 m_num_extensions; CRef m_pssm; }; @@ -289,8 +291,10 @@ private: /* CVDBThread */ CVDBThread::CVDBThread(CRef pssm, vector & chunks, - CRef options): - m_chunks(chunks), m_num_extensions(0), m_pssm(pssm) + CRef options, + bool include_filtered_reads): + m_chunks(chunks), m_include_filtered_reads(include_filtered_reads), + m_num_extensions(0), m_pssm(pssm) { m_opt_handle.Reset(new CPSIBlastOptionsHandle(options)); @@ -299,8 +303,10 @@ CVDBThread::CVDBThread(CRef pssm, CVDBThread::CVDBThread(CRef query_factory, vector & chunks, - CRef options): - m_query_factory(query_factory), m_chunks(chunks), m_num_extensions(0) + CRef options, + bool include_filtered_reads): + m_query_factory(query_factory), m_chunks(chunks), + m_include_filtered_reads(include_filtered_reads), m_num_extensions(0) { if(options->GetProgramType() == eBlastTypeBlastn) @@ -316,10 +322,10 @@ void* CVDBThread::Main(void) if(m_chunks.size() == 1) { if(m_pssm.Empty()) { result->thread_result_set = s_RunLocalVDBSearch(m_chunks[0], m_query_factory, - m_opt_handle, m_num_extensions); + m_opt_handle, m_num_extensions, m_include_filtered_reads); } else { - result->thread_result_set = s_RunPsiVDBSearch(m_chunks[0], m_pssm, m_opt_handle); + result->thread_result_set = s_RunPsiVDBSearch(m_chunks[0], m_pssm, m_opt_handle, m_include_filtered_reads); } } else { @@ -340,10 +346,10 @@ CRef CVDBThread::RunTandemSearches(void) Int4 num_exts = 0; if(m_pssm.Empty()){ results.push_back(s_RunLocalVDBSearch(m_chunks[i], m_query_factory, - m_opt_handle, num_exts)); + m_opt_handle, num_exts, m_include_filtered_reads)); } else { - results.push_back(s_RunPsiVDBSearch(m_chunks[i], m_pssm, m_opt_handle)); + results.push_back(s_RunPsiVDBSearch(m_chunks[i], m_pssm, m_opt_handle, m_include_filtered_reads)); } m_num_extensions +=num_exts; } @@ -358,27 +364,31 @@ CRef CVDBThread::RunTandemSearches(void) /* CLocalVDBBlast */ CLocalVDBBlast::CLocalVDBBlast(CRef query_vector, CRef options, - SLocalVDBStruct & local_vdb): + SLocalVDBStruct & local_vdb, + bool include_filtered_reads): m_query_vector(query_vector), m_opt_handle(options), m_total_num_seqs(local_vdb.total_num_seqs), m_total_length(local_vdb.total_length), m_chunks_for_thread(local_vdb.chunks_for_thread), m_num_threads(local_vdb.chunks_for_thread.size()), - m_num_extensions(0) + m_num_extensions(0), + m_include_filtered_reads(include_filtered_reads) { } /* CLocalVDBBlast */ CLocalVDBBlast::CLocalVDBBlast(CRef pssm, CRef options, - SLocalVDBStruct & local_vdb): + SLocalVDBStruct & local_vdb, + bool include_filtered_reads): m_opt_handle(options), m_total_num_seqs(local_vdb.total_num_seqs), m_total_length(local_vdb.total_length), m_chunks_for_thread(local_vdb.chunks_for_thread), m_num_threads(local_vdb.chunks_for_thread.size()), m_num_extensions(0), + m_include_filtered_reads(include_filtered_reads), m_pssm(pssm) { } @@ -704,10 +714,10 @@ CRef CLocalVDBBlast::Run(void) CRef retval; if(m_pssm.Empty()){ CRef queries(new CObjMgr_QueryFactory(*m_query_vector)); - retval = s_RunLocalVDBSearch(chunks[0], queries, m_opt_handle, m_num_extensions); + retval = s_RunLocalVDBSearch(chunks[0], queries, m_opt_handle, m_num_extensions, m_include_filtered_reads); } else { - retval = s_RunPsiVDBSearch(chunks[0], m_pssm, m_opt_handle); + retval = s_RunPsiVDBSearch(chunks[0], m_pssm, m_opt_handle, m_include_filtered_reads); } m_opt_handle->SetOptions().SetHitlistSize(hls); s_TrimResults(*retval, hls); @@ -721,11 +731,11 @@ CRef CLocalVDBBlast::Run(void) if(m_pssm.Empty()){ Int4 num_exts = 0; CRef queries(new CObjMgr_QueryFactory(*m_query_vector)); - results.push_back(s_RunLocalVDBSearch(chunks[i], queries, m_opt_handle, num_exts)); + results.push_back(s_RunLocalVDBSearch(chunks[i], queries, m_opt_handle, num_exts, m_include_filtered_reads)); m_num_extensions += num_exts; } else { - results.push_back(s_RunPsiVDBSearch(chunks[i], m_pssm, m_opt_handle)); + results.push_back(s_RunPsiVDBSearch(chunks[i], m_pssm, m_opt_handle, m_include_filtered_reads)); } } @@ -809,10 +819,10 @@ CRef CLocalVDBBlast::RunThreadedSearch(void) { // CThread destructor is protected, all threads destory themselves when terminated if (isPSI) { - thread[t] = (new CVDBThread(pssm[t], m_chunks_for_thread[t], m_opt_handle->SetOptions().Clone())); + thread[t] = (new CVDBThread(pssm[t], m_chunks_for_thread[t], m_opt_handle->SetOptions().Clone(), m_include_filtered_reads)); } else { - thread[t] = (new CVDBThread(query_factory[t], m_chunks_for_thread[t], m_opt_handle->SetOptions().Clone())); + thread[t] = (new CVDBThread(query_factory[t], m_chunks_for_thread[t], m_opt_handle->SetOptions().Clone(), m_include_filtered_reads)); } thread[t]->Run(); } diff --git a/c++/src/app/blast/CMakeLists.blast_report.app.txt b/c++/src/app/blast/CMakeLists.blast_report.app.txt deleted file mode 100644 index ca66da55..00000000 --- a/c++/src/app/blast/CMakeLists.blast_report.app.txt +++ /dev/null @@ -1,7 +0,0 @@ -# $Id: CMakeLists.blast_report.app.txt 622501 2020-12-24 15:12:25Z ivanov $ - -NCBI_begin_app(blast_report) - NCBI_sources(blast_report) - NCBI_uses_toolkit_libraries(blast_app_util) - NCBI_add_definitions(NCBI_MODULE=BLASTFORMAT) -NCBI_end_app() diff --git a/c++/src/app/blast/CMakeLists.txt b/c++/src/app/blast/CMakeLists.txt index 4d997bab..c1de3421 100644 --- a/c++/src/app/blast/CMakeLists.txt +++ b/c++/src/app/blast/CMakeLists.txt @@ -1,4 +1,4 @@ -# $Id: CMakeLists.txt 622501 2020-12-24 15:12:25Z ivanov $ +# $Id: CMakeLists.txt 683932 2024-06-10 12:08:12Z ivanov $ NCBI_add_library(blast_app_util) NCBI_add_app( @@ -11,7 +11,6 @@ NCBI_add_app( rpsblast rpstblastn blast_formatter - blast_report deltablast seedtop ) diff --git a/c++/src/app/blast/Makefile.blast_report.app b/c++/src/app/blast/Makefile.blast_report.app deleted file mode 100755 index 4d7ea11d..00000000 --- a/c++/src/app/blast/Makefile.blast_report.app +++ /dev/null @@ -1,16 +0,0 @@ -WATCHERS = camacho madden fongah2 - -APP = blast_report -SRC = blast_report -LIB_ = $(BLAST_INPUT_LIBS) $(BLAST_LIBS) xregexp $(PCRE_LIB) $(OBJMGR_LIBS) -LIB = blast_app_util $(LIB_:%=%$(STATIC)) - -# De-universalize Mac builds to work around a PPC toolchain limitation -CFLAGS = $(FAST_CFLAGS:ppc=i386) -CXXFLAGS = $(FAST_CXXFLAGS:ppc=i386) -LDFLAGS = $(FAST_LDFLAGS:ppc=i386) - -CPPFLAGS = -DNCBI_MODULE=BLASTFORMAT $(ORIG_CPPFLAGS) $(BLAST_THIRD_PARTY_INCLUDE) -LIBS = $(GENBANK_THIRD_PARTY_LIBS) $(BLAST_THIRD_PARTY_LIBS) $(CMPRS_LIBS) $(DL_LIBS) $(NETWORK_LIBS) $(ORIG_LIBS) - -REQUIRES = objects -Cygwin diff --git a/c++/src/app/blast/Makefile.in b/c++/src/app/blast/Makefile.in index 8ce84c65..1fb223c7 100644 --- a/c++/src/app/blast/Makefile.in +++ b/c++/src/app/blast/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in 590894 2019-08-07 14:59:53Z camacho $ +# $Id: Makefile.in 683932 2024-06-10 12:08:12Z ivanov $ # Meta-makefile("APP" project) ################################# @@ -17,7 +17,6 @@ psiblast \ rpsblast \ rpstblastn \ blast_formatter \ -blast_report \ deltablast \ seedtop @@ -52,8 +51,6 @@ igblastp: lib ${MAKE} ${MFLAGS} -f Makefile.igblastp_app blast_formatter: lib ${MAKE} ${MFLAGS} -f Makefile.blast_formatter_app -blast_report: lib - ${MAKE} ${MFLAGS} -f Makefile.blast_report_app seedtop: lib ${MAKE} ${MFLAGS} -f Makefile.seedtop_app deltablast: lib diff --git a/c++/src/app/blast/blast_app_util.cpp b/c++/src/app/blast/blast_app_util.cpp index 5d49b264..3570388d 100644 --- a/c++/src/app/blast/blast_app_util.cpp +++ b/c++/src/app/blast/blast_app_util.cpp @@ -1,4 +1,4 @@ -/* $Id: blast_app_util.cpp 673578 2023-10-04 13:18:18Z ivanov $ +/* $Id: blast_app_util.cpp 683535 2024-05-30 12:54:58Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -770,7 +770,11 @@ void BlastFormatter_PreFetchSequenceData(const blast::CSearchResultSet& results, s_ExtractSeqidsAndRanges(results, ids, ranges); _TRACE("Prefetching " << ids.size() << " sequence lengths"); LoadSequencesToScope(ids, ranges, scope); - } catch (CException& e) { + } + catch(CSeqDBException & ) { + throw; + } + catch (CException& e) { if(s_IsUsingRemoteBlastDbDataLoader()) { ERR_POST(Warning << "Error fetching sequence data from BLAST databases at NCBI, " "please try again later"); diff --git a/c++/src/app/blast/blast_app_util.hpp b/c++/src/app/blast/blast_app_util.hpp index ced6e1f4..a7ce4c1a 100644 --- a/c++/src/app/blast/blast_app_util.hpp +++ b/c++/src/app/blast/blast_app_util.hpp @@ -1,4 +1,4 @@ -/* $Id: blast_app_util.hpp 673578 2023-10-04 13:18:18Z ivanov $ +/* $Id: blast_app_util.hpp 683535 2024-05-30 12:54:58Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -143,6 +143,8 @@ InitializeQueryDataLoaderConfiguration(bool query_is_protein, /// object) string RegisterOMDataLoader(CRef db_handle); + + /// Command line binary exit code: success #define BLAST_EXIT_SUCCESS 0 /// Command line binary exit code: error in input query/options @@ -181,8 +183,21 @@ string RegisterOMDataLoader(CRef db_handle); exit_code = BLAST_INPUT_ERROR; \ } \ catch (const CSeqDBException& e) { \ - LOG_POST(Error << "BLAST Database error: " << e.GetMsg()); \ - exit_code = BLAST_DATABASE_ERROR; \ + if (e.GetErrCode() == CSeqDBException::eOpenFileErr) { \ + string err_msg = \ + "Too many open files, please raise the open file limit"; \ + LOG_POST(Error << "BLAST Database error: " << err_msg); \ + exit_code = BLAST_ENGINE_ERROR; \ + } \ + else if (e.GetErrCode() == CSeqDBException::eFileErr){ \ + string err_msg = "Database memory map file error"; \ + LOG_POST(Error << "BLAST Database error: " << err_msg); \ + exit_code = BLAST_ENGINE_ERROR; \ + } \ + else { \ + LOG_POST(Error << "BLAST Database error: " << e.GetMsg()); \ + exit_code = BLAST_DATABASE_ERROR; \ + } \ } \ catch (const blastdbindex::CDbIndex_Exception& e) { \ LOG_POST(Error << "Indexed BLAST database error: " << e.GetMsg()); \ diff --git a/c++/src/app/blast/blast_report.cpp b/c++/src/app/blast/blast_report.cpp deleted file mode 100755 index c025b4c8..00000000 --- a/c++/src/app/blast/blast_report.cpp +++ /dev/null @@ -1,401 +0,0 @@ -/* $Id: blast_report.cpp 622260 2020-12-22 16:37:19Z grichenk $ - * =========================================================================== - * - * PUBLIC DOMAIN NOTICE - * National Center for Biotechnology Information - * - * This software/database is a "United States Government Work" under the - * terms of the United States Copyright Act. It was written as part of - * the author's official duties as a United States Government employee and - * thus cannot be copyrighted. This software/database is freely available - * to the public for use. The National Library of Medicine and the U.S. - * Government have not placed any restriction on its use or reproduction. - * - * Although all reasonable efforts have been taken to ensure the accuracy - * and reliability of the software and data, the NLM and the U.S. - * Government do not and cannot warrant the performance or results that - * may be obtained by using this software or data. The NLM and the U.S. - * Government disclaim all warranties, express or implied, including - * warranties of performance, merchantability or fitness for any particular - * purpose. - * - * Please cite the author in any work or product based on this material. - * - * =========================================================================== - * - * Author: Irena Zaretskaya - * - */ - -/** @file blast_report.cpp - * Stand-alone command line HTML report for BLAST. Uses tempalates for descriptions and alignments. Outputs metadata as json - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "blast_app_util.hpp" - - -#ifndef SKIP_DOXYGEN_PROCESSING -USING_NCBI_SCOPE; -USING_SCOPE(blast); -#endif - - -#define EXIT_CODE__FORMAT_SUCCESS 0 -#define EXIT_CODE__NO_RESULTS_FOUND 1 -#define EXIT_CODE__INVALID_INPUT_FORMAT 2 -#define EXIT_CODE__BLAST_ARCHIVE_ERROR 3 -#define EXIT_CODE__CANNOT_ACCESS_FILE 4 -#define EXIT_CODE__QUERY_INDEX_INVALID 5 -#define EXIT_CODE__NETWORK_CONNECTION_ERROR 5 - -class CBlastReportApp : public CNcbiApplication -{ -public: - /** @inheritDoc */ - CBlastReportApp() { - CRef version(new CVersion()); - version->SetVersionInfo(new CBlastVersion()); - SetFullVersion(version); - m_LoadFromArchive = false; - } -private: - /** @inheritDoc */ - virtual void Init(); - /** @inheritDoc */ - virtual int Run(); - - /// Prints the BLAST formatted output - int PrintFormattedOutput(void); - - /// Extracts the queries to be formatted - /// @param query_is_protein Are the queries protein sequences? [in] - CRef x_ExtractQueries(bool query_is_protein); - - /// Build the query from a PSSM - /// @param pssm PSSM to inspect [in] - CRef - x_BuildQueryFromPssm(const CPssmWithParameters& pssm); - - /// Package a scope and Seq-loc into a SSeqLoc from a Bioseq - /// @param bioseq Bioseq to inspect [in] - /// @param scope Scope object to add the sequence data to [in|out] - SSeqLoc x_QueryBioseqToSSeqLoc(const CBioseq& bioseq, CRef scope); - - /// Our link to the NCBI BLAST service - CRef m_RmtBlast; - - /// The source of CScope objects for queries - CRef m_QueryScopeSource; - - /// Tracks whether results come from an archive file. - bool m_LoadFromArchive; -}; - -void CBlastReportApp::Init() -{ - HideStdArgs(fHideLogfile | fHideConffile | fHideFullVersion | fHideXmlHelp | fHideDryRun); - - unique_ptr arg_desc(new CArgDescriptions); - - arg_desc->SetUsageContext(GetArguments().GetProgramBasename(), - "Stand-alone BLAST formatter client, version " - + CBlastVersion().Print()); - - arg_desc->SetCurrentGroup("Input options"); - - - // add input file for seq-align here? - arg_desc->AddKey(kArgArchive, "ArchiveFile", "File containing BLAST Archive format in ASN.1 (i.e.: output format 11)", - CArgDescriptions::eInputFile); - - arg_desc->AddDefaultKey(kArgAlignSeqList, "alignseqlist", "List of comma separated seqids to display", CArgDescriptions::eString, ""); - arg_desc->AddDefaultKey(kArgMetadata, "searchmetadata", "Search Metadata indicator", CArgDescriptions::eBoolean,"f"); - arg_desc->AddDefaultKey(kArgQueryIndex, "queryindex", "Query Index", CArgDescriptions::eInteger, "0"); - - - CFormattingArgs fmt_args; - fmt_args.SetArgumentDescriptions(*arg_desc); - - arg_desc->SetCurrentGroup("Output configuration options"); - arg_desc->AddDefaultKey(kArgOutput, "output_file", "Output file name", - CArgDescriptions::eOutputFile, "-"); - - arg_desc->SetCurrentGroup("Miscellaneous options"); - arg_desc->AddFlag(kArgParseDeflines, - "Should the query and subject defline(s) be parsed?", true); - arg_desc->SetCurrentGroup(""); - - CDebugArgs debug_args; - debug_args.SetArgumentDescriptions(*arg_desc); - - SetupArgDescriptions(arg_desc.release()); -} - -SSeqLoc -CBlastReportApp::x_QueryBioseqToSSeqLoc(const CBioseq& bioseq, - CRef scope) -{ - static bool first_time = true; - _ASSERT(scope); - - if ( !HasRawSequenceData(bioseq) && first_time ) { - _ASSERT(m_QueryScopeSource); - m_QueryScopeSource->AddDataLoaders(scope); - first_time = false; - } - else { - scope->AddBioseq(bioseq); - } - CRef seqloc(new CSeq_loc); - seqloc->SetWhole().Assign(*bioseq.GetFirstId()); - return SSeqLoc(seqloc, scope); -} - -CRef -CBlastReportApp::x_BuildQueryFromPssm(const CPssmWithParameters& pssm) -{ - if ( !pssm.HasQuery() ) { - throw runtime_error("PSSM has no query"); - } - CRef scope(new CScope(*CObjectManager::GetInstance())); - const CSeq_entry& seq_entry = pssm.GetQuery(); - if ( !seq_entry.IsSeq() ) { - throw runtime_error("Cannot have multiple queries in a PSSM"); - } - SSeqLoc ssl = x_QueryBioseqToSSeqLoc(seq_entry.GetSeq(), scope); - CRef retval; - retval.Reset(new CBlastSearchQuery(*ssl.seqloc, *ssl.scope)); - _ASSERT(ssl.scope.GetPointer() == scope.GetPointer()); - return retval; -} - -CRef -CBlastReportApp::x_ExtractQueries(bool query_is_protein) -{ - CRef b4_queries = m_RmtBlast->GetQueries(); - _ASSERT(b4_queries); - const size_t kNumQueries = b4_queries->GetNumQueries(); - - CRef retval(new CBlastQueryVector); - - SDataLoaderConfig dlconfig(query_is_protein, SDataLoaderConfig::eUseNoDataLoaders); - dlconfig.OptimizeForWholeLargeSequenceRetrieval(false); - m_QueryScopeSource.Reset(new CBlastScopeSource(dlconfig)); - - if (b4_queries->IsPssm()) { - retval->AddQuery(x_BuildQueryFromPssm(b4_queries->GetPssm())); - } else if (b4_queries->IsSeq_loc_list()) { - CRef scope = m_QueryScopeSource->NewScope(); - ITERATE(CBlast4_queries::TSeq_loc_list, seqloc, - b4_queries->GetSeq_loc_list()) { - _ASSERT( !(*seqloc)->GetId()->IsLocal() ); - CRef query(new CBlastSearchQuery(**seqloc, - *scope)); - retval->AddQuery(query); - } - } else if (b4_queries->IsBioseq_set()) { - CTypeConstIterator itr(ConstBegin(b4_queries->GetBioseq_set(), - eDetectLoops)); - CRef scope(new CScope(*CObjectManager::GetInstance())); - for (; itr; ++itr) { - SSeqLoc ssl = x_QueryBioseqToSSeqLoc(*itr, scope); - CRef query(new CBlastSearchQuery(*ssl.seqloc, - *ssl.scope)); - retval->AddQuery(query); - } - } - - (void)kNumQueries; // eliminate compiler warning; - _ASSERT(kNumQueries == retval->size()); - return retval; -} - -static int s_GetError(string errorName, string defaultMessage, int defaultErrCode, string &errorMsg,string blastArchName = "") -{ - CNcbiApplication* app = CNcbiApplication::Instance(); - string message = defaultMessage; - int status = 0; - if (app) { - const CNcbiRegistry& registry = app->GetConfig(); - string errorCode; - string errorInfo = registry.Get("Errors", errorName); - if(!errorInfo.empty()) { - NStr::SplitInTwo(errorInfo, ":", errorCode, message); - status = NStr::StringToInt(errorCode,NStr::fConvErr_NoThrow); - message = NStr::Replace(message,"#filename",blastArchName); - } - } - if(!status || message.empty()) { - errorMsg = defaultMessage; - status = defaultErrCode; - } - else { - errorMsg = message; - } - return status; -} - - - -int CBlastReportApp::PrintFormattedOutput(void) -{ - int retval = EXIT_CODE__FORMAT_SUCCESS; - const CArgs& args = GetArgs(); - - - CNcbiOstream& out = args[kArgOutput].AsOutputFile(); - CFormattingArgs fmt_args; - - string alignSeqList = args[kArgAlignSeqList].HasValue() ? args[kArgAlignSeqList].AsString() : kEmptyStr; - bool searchMetadata = args[kArgMetadata].HasValue() ? args[kArgMetadata].AsBoolean() : false; - unsigned int queryIndex = args[kArgQueryIndex].HasValue() ? args[kArgQueryIndex].AsInteger() : 0; - - - - CRef opts_handle = m_RmtBlast->GetSearchOptions(); - CBlastOptions& opts = opts_handle->SetOptions(); - fmt_args.ExtractAlgorithmOptions(args, opts); - {{ - CDebugArgs debug_args; - debug_args.ExtractAlgorithmOptions(args, opts); - if (debug_args.ProduceDebugOutput()) { - opts.DebugDumpText(NcbiCerr, "BLAST options", 1); - } - }} - - - const EBlastProgramType p = opts.GetProgramType(); - - CRef queries = x_ExtractQueries(Blast_QueryIsProtein(p)?true:false); - CRef scope = queries->GetScope(0); - _ASSERT(queries); - - CRef db_args(new CBlastDatabaseArgs()); // FIXME, what about rpsblast? - int filtering_algorithm = -1; - if (m_RmtBlast->IsDbSearch()) - { - CRef db = m_RmtBlast->GetDatabases(); - _ASSERT(db); - _TRACE("Fetching results for " + Blast_ProgramNameFromType(p) + " on " - + db->GetName()); - filtering_algorithm = m_RmtBlast->GetDbFilteringAlgorithmId(); - CRef search_db(new CSearchDatabase(db->GetName(), db->IsProtein() - ? CSearchDatabase::eBlastDbIsProtein - : CSearchDatabase::eBlastDbIsNucleotide)); - db_args->SetSearchDatabase(search_db); - } - - CRef db_adapter; - InitializeSubject(db_args, opts_handle, true, db_adapter, scope); - - - CBlastFormat formatter(opts, *db_adapter, - fmt_args.GetFormattedOutputChoice(), - static_cast(args[kArgParseDeflines]), - out, - fmt_args.GetNumDescriptions(), - fmt_args.GetNumAlignments(), - *scope, - opts.GetMatrixName(), - fmt_args.ShowGis(), - fmt_args.DisplayHtmlOutput(), - opts.GetQueryGeneticCode(), - opts.GetDbGeneticCode(), - opts.GetSumStatisticsMode(), - false, - filtering_algorithm); - - formatter.SetLineLength(fmt_args.GetLineLength()); - formatter.SetAlignSeqList(alignSeqList); - - CRef results = m_RmtBlast->GetResultSet(); - - - try { - if(queryIndex > results->GetNumQueries() - 1) { - string msg; - retval = s_GetError("InvalidQueryIndex", "Invalid query index.", EXIT_CODE__QUERY_INDEX_INVALID, msg); - NCBI_THROW(CInputException, eInvalidInput,msg); - } - - bool hasAlignments = (*results)[queryIndex].HasAlignments(); - //BlastFormatter_PreFetchSequenceData(*results, scope, fmt_args.GetFormattedOutputChoice());//*****Do we need to do this here??? - CBlastFormat::DisplayOption displayOption; - if(searchMetadata) { - displayOption = CBlastFormat::eMetadata; - } - else if(!alignSeqList.empty()){ - displayOption = CBlastFormat::eAlignments; - } - else { - displayOption = CBlastFormat::eDescriptions; - } - if(hasAlignments || displayOption == CBlastFormat::eMetadata) { - formatter.PrintReport((*results)[queryIndex], displayOption); - } - if(!hasAlignments) { - retval = EXIT_CODE__NO_RESULTS_FOUND; - } - }catch (const CException & e) { - cerr << e.GetMsg() << endl; - } - - return retval; -} - - - -int CBlastReportApp::Run(void) -{ - int status = EXIT_CODE__FORMAT_SUCCESS; - const CArgs& args = GetArgs(); - string msg; - try { - SetDiagPostLevel(eDiag_Warning); - if (args[kArgArchive].HasValue()) { - CNcbiIstream& istr = args[kArgArchive].AsInputFile(); - m_RmtBlast.Reset(new CRemoteBlast(istr)); - if (m_RmtBlast->LoadFromArchive()) { - if(!m_RmtBlast->IsErrMsgArchive()) { - status = PrintFormattedOutput(); - return status; - } - else { - status = s_GetError("NetConError", "Network connection error", EXIT_CODE__NETWORK_CONNECTION_ERROR, msg); - } - } - } - } - catch (const CSerialException&) { - status = s_GetError("InvailInputFormat", "Invalid input format for BLAST Archive.", EXIT_CODE__INVALID_INPUT_FORMAT, msg); - } - catch (const CException& e) { - if (e.GetErrCode() == CBlastException::eInvalidArgument) { - status = s_GetError("ErrorBlastArchive", "Error processing BLAST Archive.", EXIT_CODE__BLAST_ARCHIVE_ERROR, msg); - } - else { - status = s_GetError("ErrorAccessingFile", e.GetMsg(), EXIT_CODE__CANNOT_ACCESS_FILE, msg,args[kArgArchive].AsString()); - } - } - - //cerr << "****retval:" << status << endl; - cerr << msg << endl; - return status; -} - - -#ifndef SKIP_DOXYGEN_PROCESSING -int main(int argc, const char* argv[] /*, const char* envp[]*/) -{ - return CBlastReportApp().AppMain(argc, argv); -} -#endif /* SKIP_DOXYGEN_PROCESSING */ diff --git a/c++/src/app/blast/blast_report.ini b/c++/src/app/blast/blast_report.ini deleted file mode 100755 index 5d436dd1..00000000 --- a/c++/src/app/blast/blast_report.ini +++ /dev/null @@ -1,140 +0,0 @@ -[Templates] -DFL_TABLE_ROW = \" ind=\"<@dfln_blast_rank@>\" class=\"<@trtp@> dflLnk\" > \ -<@dfln_blast_rank@>\" class=\"cb\" name=\"getSeqGi\" value=\"<@dfln_id@>\" onclick=\"configDescrLinks(event,this)\" /> \ -

\ -<@score_info@><@total_bit_string@><@percent_coverage@>%<@evalue_string@><@percent_identity@>% \ -<@seq_info@> -DFL_TABLE_SCORE_INFO = <@bit_string@> -DFL_TABLE_SEQ_INFO = \" class=\"dflSeq\" target=\"lnk<@dfln_rid@>\" title=\"Show report for <@dfln_seqid@>\"><@dfln_gi@><@dfln_seqid@> - -BLAST_ALIGN_HEADER = \ -
\" seqID=\"<@alnSeqGi@>\" accs=\"<@firstSeqID@>\"> \ -\"> \ -\" data-jig=\"ncbipopper\" class=\"toolsCtr dnld dialog\" data-jigconfig=\"hasArrow:'true',arrowDirection:'top',closeEvent: 'click', openEvent: 'click', destPosition: 'top center', triggerPosition: 'bottom right'\" id=\"alnDwnld_<@alnSeqGi@>\" title=\"Download information for <@firstSeqID@>\">Download \ -
\" class=\"popDl\"> \ -
\" checked=\"checked\" id=\"dwFST_<@alnSeqGi@>\" fstaDWType=\"complete\" sbFunc=\"initDownLoadFSTA\" />
\ -
\" id=\"dwFSTAl_<@alnSeqGi@>\" fstaDWType=\"range\" sbFunc=\"initDownLoadFSTA\" />
\ -
\">\" id=\"dwGenBank_<@alnSeqGi@>\" getGi=\"<@alnSeqGi@>\" sbName=\"id\" url=\"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?rettype=gb&retmode=text\" />
\ -
\ - \ - \ -
\ -
\ -\"><@alnCustomLinks@> \ -<@sortInfo@> \ - \ -&currseq=<@alnSeqGi@>\" id=\"alnNxt_<@alnSeqGi@>\" onclick=\"goToNextAlign('dtr_<@alnSeqGi@>',true);\">Next \ -&currseq=<@alnSeqGi@>\" id=\"alnPrv_<@alnSeqGi@>\" onclick=\"goToNextAlign('dtr_<@alnSeqGi@>',false);\">Previous \ -\" id=\"alnDsc_<@alnSeqGi@>\" onclick=\"goToDefLine('dtr_<@alnSeqGi@>');\" href=\"#dtr_<@alnSeqGi@>\">Descriptions \ - \ -
\ -
\"> \ -
\"> \ -<@aln_deflines@> \ -
\ -
\"><@alnLinkOutLinks@>
\ -
\"> - - -BLAST_ALIGN_PARAMS = \ - - -ALIGN_PARAMS_NUC = \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ -
Alignment statistics for match #<@aln_curr_num@>
ScoreExpectIdentitiesGapsStrand\">Frame
<@aln_score@> bits(<@aln_score_bits@>)<@aln_eval@>\">(<@aln_sumN@>)<@aln_match@>(<@aln_ident@>%)<@aln_gaps@>(<@aln_gaps_prc@>%)<@aln_strand@>\"><@aln_frame@>
- - -ALIGN_PARAMS_PROT = \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ -
Alignment statistics for match #<@aln_curr_num@>
ScoreExpect\">MethodIdentitiesPositivesGaps\">Frame
<@aln_score@> bits(<@aln_score_bits@>)<@aln_eval@>\">(<@aln_sumN@>)\"><@aln_meth@><@aln_match@>(<@aln_ident@>%)<@aln_pos@>(<@aln_pos_prc@>%)<@aln_gaps@>(<@aln_gaps_prc@>%)\"><@aln_frame@>
- - -SORT_ALIGNS_SEQ = \ - - -ALN_FEATURES = <@aln_feat_info@> - -ALN_FEATURES_LINK = \"><@aln_feat@> - -ALN_DEFLINE_ROW = \ -
\ -<@alnTitle@> \ -
<@seq_info@> r\"><@alnSeqLength@><@alnHspNum@>
\ -
- -ALN_DEFLINE_TITLES_LNK =

\" >See <@titleNum@> more title(s)

- -ALN_DEFLINE_TITLES = \ -
\ -
\ -<@seqTitles@> \ -
\ -
- -ALN_DEFLINE_SEQ_INFO = \" target=\"lnk<@aln_rid@>\" title=\"Show report for <@aln_seqid@>\"><@aln_gi@><@aln_seqid@> - -BLAST_ALIGN_ROWS = \ -
_<@aln_curr_num@>\"> \ -
 \
-<@align_rows@> \
-
\ -
- -BLAST_ALIGN_ROWS_LST = \ -
_<@aln_curr_num@>\"> \ -
 \
-<@align_rows@> \
-
\ -
\ -
\ -
- -[Errors] -NoResultsFound=1:No results found. -InvailInputFormat=2:Invalid input format for BLAST Archive. -ErrorBlastArchive=3:Error processing BLAST Archive. -ErrorAccessingFile=4:Error accesing blast archive #filename. -InvalidQueryIndex=5:Invalid query index. -NetConError=6:Network connection error. diff --git a/c++/src/app/blast/blastn_app.cpp b/c++/src/app/blast/blastn_app.cpp index 9ee6f287..88829b74 100644 --- a/c++/src/app/blast/blastn_app.cpp +++ b/c++/src/app/blast/blastn_app.cpp @@ -1,4 +1,4 @@ -/* $Id: blastn_app.cpp 673579 2023-10-04 13:18:26Z ivanov $ +/* $Id: blastn_app.cpp 683938 2024-06-10 12:09:24Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -117,6 +117,9 @@ int CBlastnApp::Run(void) { int status = BLAST_EXIT_SUCCESS; const CArgs& args = GetArgs(); + BLAST_PROF_ADD2( PROGRAM, blastn ) ; + BLAST_PROF_ADD( THREADS , (int)m_CmdLineArgs->GetNumThreads() ); + BLAST_PROF_ADD( MT_MODE , (int)m_CmdLineArgs->GetMTMode() ); //Check to see if search should split by queries try { SetDiagPostLevel(eDiag_Warning); @@ -177,7 +180,6 @@ int CBlastnApp::x_RunMTBySplitDB() { BLAST_PROF_START( APP.MAIN ); BLAST_PROF_START( APP.PRE ); - BLAST_PROF_ADD2( PROGRAM, blastn ) ; int status = BLAST_EXIT_SUCCESS; int batch_num = 0; @@ -260,7 +262,7 @@ int CBlastnApp::x_RunMTBySplitDB() int batch_size = m_CmdLineArgs->GetQueryBatchSize(); if (batch_size) { input.SetBatchSize(batch_size); - BLAST_PROF_ADD( BATCH_SIZE, (int)batch_size ); + //BLAST_PROF_ADD( BATCH_SIZE, (int)batch_size ); } else { Int8 total_len = formatter.GetDbTotalLength(); if (total_len > 0) { @@ -268,8 +270,9 @@ int CBlastnApp::x_RunMTBySplitDB() mixer.SetTargetHits(total_len / 3000); } input.SetBatchSize(mixer.GetBatchSize()); - BLAST_PROF_ADD( BATCH_SIZE, (int)mixer.GetBatchSize() ); + //BLAST_PROF_ADD( BATCH_SIZE, (int)mixer.GetBatchSize() ); } + BLAST_PROF_ADD( BATCH_SIZE, (int)input.GetBatchSize() ); BLAST_PROF_STOP( APP.PRE ); for (; !input.End(); formatter.ResetScopeHistory(), QueryBatchCleanup() ) { BLAST_PROF_START( APP.LOOP.PRE ); @@ -332,7 +335,6 @@ int CBlastnApp::x_RunMTBySplitDB() m_UsageReport.AddParam(CBlastUsageReport::eNumThreads, (int) m_CmdLineArgs->GetNumThreads()); m_UsageReport.AddParam(CBlastUsageReport::eExitStatus, status); BLAST_PROF_STOP( APP.MAIN ); - BLAST_PROF_ADD( THREADS , (int)m_CmdLineArgs->GetNumThreads() ); BLAST_PROF_ADD( BATCHES , (int)batch_num ); BLAST_PROF_ADD( EXIT_STATUS , (int)status ); BLAST_PROF_REPORT ; @@ -342,9 +344,8 @@ int CBlastnApp::x_RunMTBySplitDB() int CBlastnApp::x_RunMTBySplitQuery() { BLAST_PROF_START( APP.MAIN ); - BLAST_PROF_START( APP.PRE ); - BLAST_PROF_ADD2( PROGRAM, blastn ) ; int status = BLAST_EXIT_SUCCESS; + int chunk_num = 0; try { const CArgs& args = GetArgs(); @@ -359,7 +360,6 @@ int CBlastnApp::x_RunMTBySplitQuery() LogBlastOptions(m_UsageReport, m_OptsHndl->GetOptions()); LogCmdOptions(m_UsageReport, *m_CmdLineArgs); - int chunk_num = 0; int batch_size = GetMTByQueriesBatchSize(m_OptsHndl->GetOptions().GetProgram(), kMaxNumOfThreads); INFO_POST("Batch Size: " << batch_size); CBlastNodeInputReader input(m_CmdLineArgs->GetInputStream(), batch_size, 2000); @@ -393,9 +393,9 @@ int CBlastnApp::x_RunMTBySplitQuery() const CArgs & a = GetArgs(); PrintErrorArchive(a, m_Bah.GetMessages()); } - BLAST_PROF_STOP( APP.MAIN ); - BLAST_PROF_ADD( THREADS , (int)m_CmdLineArgs->GetNumThreads() ); + BLAST_PROF_STOP( APP.MAIN ); BLAST_PROF_ADD( EXIT_STATUS , (int)status ); + BLAST_PROF_ADD( BATCHES , (int)chunk_num ); BLAST_PROF_REPORT ; m_UsageReport.AddParam(CBlastUsageReport::eTask, m_CmdLineArgs->GetTask()); m_UsageReport.AddParam(CBlastUsageReport::eNumThreads, (int) m_CmdLineArgs->GetNumThreads()); diff --git a/c++/src/app/blast/blastp_app.cpp b/c++/src/app/blast/blastp_app.cpp index 2021052d..153b9f35 100644 --- a/c++/src/app/blast/blastp_app.cpp +++ b/c++/src/app/blast/blastp_app.cpp @@ -1,4 +1,4 @@ -/* $Id: blastp_app.cpp 673580 2023-10-04 13:18:34Z ivanov $ +/* $Id: blastp_app.cpp 683938 2024-06-10 12:09:24Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -39,6 +39,7 @@ #include #include #include +#include #include "blast_app_util.hpp" #include "blastp_node.hpp" @@ -114,6 +115,9 @@ static void s_GetMT1Cutoffs(const int word_size, Int8 & max_db_size, Int8 & min_ int CBlastpApp::Run(void) { int status = BLAST_EXIT_SUCCESS; + BLAST_PROF_ADD2( PROGRAM, blastp ) ; + BLAST_PROF_ADD( THREADS , (int)m_CmdLineArgs->GetNumThreads() ); + BLAST_PROF_ADD( MT_MODE , (int)m_CmdLineArgs->GetMTMode() ); const CArgs& args = GetArgs(); //Check to see if search should split by queries @@ -176,8 +180,10 @@ int CBlastpApp::Run(void) int CBlastpApp::x_RunMTBySplitDB() { - + BLAST_PROF_START( APP.MAIN ); + BLAST_PROF_START( APP.PRE ); int status = BLAST_EXIT_SUCCESS; + int batch_num = 0; try { @@ -246,16 +252,17 @@ int CBlastpApp::x_RunMTBySplitDB() } formatter.PrintProlog(); + BLAST_PROF_ADD( BATCH_SIZE, (int)input.GetBatchSize() ); /*** Process the input ***/ for (; !input.End(); formatter.ResetScopeHistory(), QueryBatchCleanup()) { - + BLAST_PROF_START( APP.LOOP.PRE ); CRef query_batch(input.GetNextSeqBatch(*scope)); CRef queries(new CObjMgr_QueryFactory(*query_batch)); SaveSearchStrategy(args, m_CmdLineArgs, queries, m_OptsHndl); CRef results; - + BLAST_PROF_STOP( APP.LOOP.PRE ); if (m_CmdLineArgs->ExecuteRemotely()) { CRef rmt_blast = InitializeRemoteBlast(queries, db_args, m_OptsHndl, @@ -263,11 +270,13 @@ int CBlastpApp::x_RunMTBySplitDB() m_CmdLineArgs->GetClientId()); results = rmt_blast->GetResultSet(); } else { + BLAST_PROF_START( APP.LOOP.BLAST ); CLocalBlast lcl_blast(queries, m_OptsHndl, db_adapter); lcl_blast.SetNumberOfThreads(m_CmdLineArgs->GetNumThreads()); results = lcl_blast.Run(); + BLAST_PROF_STOP( APP.LOOP.BLAST ); } - + BLAST_PROF_START( APP.LOOP.FMT ); if (fmt_args->ArchiveFormatRequested(args)) { formatter.WriteArchive(*queries, *m_OptsHndl, *results, 0, m_Bah.GetMessages()); m_Bah.ResetMessages(); @@ -278,8 +287,11 @@ int CBlastpApp::x_RunMTBySplitDB() formatter.PrintOneResultSet(**result, query_batch); } } + BLAST_PROF_STOP( APP.LOOP.FMT ); + batch_num++; } + BLAST_PROF_START( APP.POST ); formatter.PrintEpilog(opt); if (m_CmdLineArgs->ProduceDebugOutput()) { @@ -288,6 +300,7 @@ int CBlastpApp::x_RunMTBySplitDB() LogQueryInfo(m_UsageReport, input); formatter.LogBlastSearchInfo(m_UsageReport); + BLAST_PROF_STOP( APP.POST ); } CATCH_ALL(status) if(!m_Bah.GetMessages().empty()) { const CArgs & a = GetArgs(); @@ -297,11 +310,16 @@ int CBlastpApp::x_RunMTBySplitDB() m_UsageReport.AddParam(CBlastUsageReport::eTask, m_CmdLineArgs->GetTask()); m_UsageReport.AddParam(CBlastUsageReport::eNumThreads, (int) m_CmdLineArgs->GetNumThreads()); m_UsageReport.AddParam(CBlastUsageReport::eExitStatus, status); + BLAST_PROF_STOP( APP.MAIN ); + BLAST_PROF_ADD( BATCHES , (int)batch_num ); + BLAST_PROF_ADD( EXIT_STATUS , (int)status ); + BLAST_PROF_REPORT ; return status; } int CBlastpApp::x_RunMTBySplitQuery() { + BLAST_PROF_START( APP.MAIN ); int status = BLAST_EXIT_SUCCESS; try { @@ -320,6 +338,7 @@ int CBlastpApp::x_RunMTBySplitQuery() int chunk_num = 0; int batch_size = GetMTByQueriesBatchSize(m_OptsHndl->GetOptions().GetProgram(), kMaxNumOfThreads); INFO_POST("Batch Size: " << batch_size); + BLAST_PROF_ADD( BATCH_SIZE, (int)batch_size ); CBlastNodeInputReader input(m_CmdLineArgs->GetInputStream(), batch_size, 2000); while (master_node.Processing()) { if (!input.AtEOF()) { @@ -351,6 +370,9 @@ int CBlastpApp::x_RunMTBySplitQuery() const CArgs & a = GetArgs(); PrintErrorArchive(a, m_Bah.GetMessages()); } + BLAST_PROF_STOP( APP.MAIN ); + BLAST_PROF_ADD( EXIT_STATUS , (int)status ); + BLAST_PROF_REPORT ; m_UsageReport.AddParam(CBlastUsageReport::eTask, m_CmdLineArgs->GetTask()); m_UsageReport.AddParam(CBlastUsageReport::eNumThreads, (int) m_CmdLineArgs->GetNumThreads()); m_UsageReport.AddParam(CBlastUsageReport::eExitStatus, status); diff --git a/c++/src/app/blast/blastx_app.cpp b/c++/src/app/blast/blastx_app.cpp index 200f6d5e..65ff7ba8 100644 --- a/c++/src/app/blast/blastx_app.cpp +++ b/c++/src/app/blast/blastx_app.cpp @@ -1,4 +1,4 @@ -/* $Id: blastx_app.cpp 673581 2023-10-04 13:18:42Z ivanov $ +/* $Id: blastx_app.cpp 683938 2024-06-10 12:09:24Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -39,6 +39,7 @@ #include #include #include +#include #include "blast_app_util.hpp" #include "blastx_node.hpp" @@ -117,6 +118,9 @@ static void s_GetMT1Cutoffs(const int word_size, Int8 & max_db_size, Int8 & min_ int CBlastxApp::Run(void) { int status = BLAST_EXIT_SUCCESS; + BLAST_PROF_ADD2( PROGRAM, blastx ) ; + BLAST_PROF_ADD( THREADS , (int)m_CmdLineArgs->GetNumThreads() ); + BLAST_PROF_ADD( MT_MODE , (int)m_CmdLineArgs->GetMTMode() ); const CArgs& args = GetArgs(); //Check to see if search should split by queries try { @@ -173,12 +177,15 @@ int CBlastxApp::Run(void) if(!m_Bah.GetMessages().empty()) { PrintErrorArchive(args, m_Bah.GetMessages()); } + return status; } int CBlastxApp::x_RunMTBySplitDB() { - + BLAST_PROF_START( APP.MAIN ); + BLAST_PROF_START( APP.PRE ); int status = BLAST_EXIT_SUCCESS; + int batch_num = 0; try { @@ -246,15 +253,18 @@ int CBlastxApp::x_RunMTBySplitDB() } formatter.PrintProlog(); + BLAST_PROF_STOP( APP.PRE ); + BLAST_PROF_ADD( BATCH_SIZE, (int)input.GetBatchSize() ); /*** Process the input ***/ for (; !input.End(); formatter.ResetScopeHistory(), QueryBatchCleanup()) { - + BLAST_PROF_START( APP.LOOP.PRE ); CRef query_batch(input.GetNextSeqBatch(*scope)); CRef queries(new CObjMgr_QueryFactory(*query_batch)); SaveSearchStrategy(args, m_CmdLineArgs, queries, m_OptsHndl); CRef results; + BLAST_PROF_STOP( APP.LOOP.PRE ); if (m_CmdLineArgs->ExecuteRemotely()) { CRef rmt_blast = @@ -263,11 +273,13 @@ int CBlastxApp::x_RunMTBySplitDB() m_CmdLineArgs->GetClientId()); results = rmt_blast->GetResultSet(); } else { + BLAST_PROF_START( APP.LOOP.BLAST ); CLocalBlast lcl_blast(queries, m_OptsHndl, db_adapter); lcl_blast.SetNumberOfThreads(m_CmdLineArgs->GetNumThreads()); results = lcl_blast.Run(); + BLAST_PROF_STOP( APP.LOOP.BLAST ); } - + BLAST_PROF_START( APP.LOOP.FMT ); if (fmt_args->ArchiveFormatRequested(args)) { formatter.WriteArchive(*queries, *m_OptsHndl, *results, 0, m_Bah.GetMessages()); m_Bah.ResetMessages(); @@ -278,8 +290,10 @@ int CBlastxApp::x_RunMTBySplitDB() formatter.PrintOneResultSet(**result, query_batch); } } + BLAST_PROF_STOP( APP.LOOP.FMT ); + batch_num++; } - + BLAST_PROF_START( APP.POST ); formatter.PrintEpilog(opt); if (m_CmdLineArgs->ProduceDebugOutput()) { @@ -288,6 +302,7 @@ int CBlastxApp::x_RunMTBySplitDB() LogQueryInfo(m_UsageReport, input); formatter.LogBlastSearchInfo(m_UsageReport); + BLAST_PROF_STOP( APP.POST ); } CATCH_ALL(status) if(!m_Bah.GetMessages().empty()) { const CArgs & a = GetArgs(); @@ -297,12 +312,18 @@ int CBlastxApp::x_RunMTBySplitDB() m_UsageReport.AddParam(CBlastUsageReport::eTask, m_CmdLineArgs->GetTask()); m_UsageReport.AddParam(CBlastUsageReport::eNumThreads, (int) m_CmdLineArgs->GetNumThreads()); m_UsageReport.AddParam(CBlastUsageReport::eExitStatus, status); + BLAST_PROF_STOP( APP.MAIN ); + BLAST_PROF_ADD( BATCHES , (int)batch_num ); + BLAST_PROF_ADD( EXIT_STATUS , (int)status ); + BLAST_PROF_REPORT ; return status; } int CBlastxApp::x_RunMTBySplitQuery() { int status = BLAST_EXIT_SUCCESS; + int chunk_num = 0; // logically this is also batch number + BLAST_PROF_START( APP.MAIN ); try { const CArgs& args = GetArgs(); @@ -317,9 +338,9 @@ int CBlastxApp::x_RunMTBySplitQuery() LogBlastOptions(m_UsageReport, m_OptsHndl->GetOptions()); LogCmdOptions(m_UsageReport, *m_CmdLineArgs); - int chunk_num = 0; int batch_size = GetMTByQueriesBatchSize(m_OptsHndl->GetOptions().GetProgram(), kMaxNumOfThreads, m_CmdLineArgs->GetTask()); INFO_POST("Batch Size: " << batch_size); + BLAST_PROF_ADD( BATCH_SIZE, (int)batch_size ); CBlastNodeInputReader input(m_CmdLineArgs->GetInputStream(), batch_size, 2000); while (master_node.Processing()) { if (!input.AtEOF()) { @@ -353,7 +374,10 @@ int CBlastxApp::x_RunMTBySplitQuery() m_UsageReport.AddParam(CBlastUsageReport::eTask, m_CmdLineArgs->GetTask()); m_UsageReport.AddParam(CBlastUsageReport::eNumThreads, (int) m_CmdLineArgs->GetNumThreads()); m_UsageReport.AddParam(CBlastUsageReport::eExitStatus, status); - + BLAST_PROF_STOP( APP.MAIN ); + BLAST_PROF_ADD( BATCHES , (int)chunk_num ); + BLAST_PROF_ADD( EXIT_STATUS , (int)status ); + BLAST_PROF_REPORT ; return status; } diff --git a/c++/src/app/blast/tblastn_app.cpp b/c++/src/app/blast/tblastn_app.cpp index dbd44b4c..bb21c8f4 100644 --- a/c++/src/app/blast/tblastn_app.cpp +++ b/c++/src/app/blast/tblastn_app.cpp @@ -1,4 +1,4 @@ -/* $Id: tblastn_app.cpp 673771 2023-10-10 14:47:13Z ivanov $ +/* $Id: tblastn_app.cpp 676160 2023-12-11 14:55:50Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -170,6 +170,7 @@ int CTblastnApp::Run(void) if(!m_Bah.GetMessages().empty()) { PrintErrorArchive(args, m_Bah.GetMessages()); } + return status; } int CTblastnApp::x_RunMTBySplitDB() diff --git a/c++/src/app/blast/update_blastdb.pl b/c++/src/app/blast/update_blastdb.pl index 5808b1a1..bdef8d28 100755 --- a/c++/src/app/blast/update_blastdb.pl +++ b/c++/src/app/blast/update_blastdb.pl @@ -1,5 +1,5 @@ #!/usr/bin/env perl -# $Id: update_blastdb.pl 672917 2023-09-18 17:55:38Z ivanov $ +# $Id: update_blastdb.pl 681901 2024-04-17 13:16:37Z ivanov $ # =========================================================================== # # PUBLIC DOMAIN NOTICE @@ -59,10 +59,6 @@ use constant GCS_URL => "https://storage.googleapis.com"; use constant GCP_URL => "http://metadata.google.internal/computeMetadata/v1/instance/id"; use constant GCP_BUCKET => "blast-db"; -# TODO: deprecate this in the next release 2.14.x -#use constant BLASTDB_MANIFEST => "blastdb-manifest.json"; -use constant BLASTDB_MANIFEST_VERSION => "1.0"; - use constant BLASTDB_METADATA => "blastdb-metadata-1-1.json"; use constant BLASTDB_METADATA_VERSION => "1.1"; @@ -72,7 +68,6 @@ my $opt_quiet = 0; my $opt_force_download = 0; my $opt_help = 0; my $opt_passive = 1; -my $opt_blastdb_ver = undef; my $opt_timeout = 120; my $opt_showall = undef; my $opt_show_version = 0; @@ -89,7 +84,6 @@ my $result = GetOptions("verbose+" => \$opt_verbose, "timeout=i" => \$opt_timeout, "showall:s" => \$opt_showall, "version" => \$opt_show_version, - "blastdb_version:i" => \$opt_blastdb_ver, "decompress" => \$opt_decompress, "source=s" => \$opt_source, "gcp-project=s" => \$opt_gcp_prj, @@ -107,12 +101,6 @@ if (length($opt_passive) and ($opt_passive !~ /1|no/i)) { pod2usage({-exitval => 0, -verbose => 2}) unless (scalar @ARGV or defined($opt_showall) or $opt_show_version); -if (defined $opt_blastdb_ver) { - pod2usage({-exitval => 1, -verbose => 0, - -msg => "Invalid BLAST database version: $opt_blastdb_ver. Supported values: 4, 5"}) - unless ($opt_blastdb_ver == 4 or $opt_blastdb_ver == 5); -} - pod2usage({-exitval => 1, -verbose => 0, -msg => "Invalid number of threads"}) if ($opt_nt < 0); my $max_num_cores = &get_num_cores(); @@ -131,7 +119,7 @@ my $exit_code = 0; $|++; if ($opt_show_version) { - my $revision = '$Revision: 672917 $'; + my $revision = '$Revision: 681901 $'; $revision =~ s/\$Revision: | \$//g; print "$0 version $revision\n"; exit($exit_code); @@ -200,6 +188,9 @@ sub validate_metadata_file my $url = shift; my $metadata = decode_json($json); if (ref($metadata) eq 'HASH') { + # This code branch detects the manifest version below + # We switched to manifest version 1.1 on 2022-07-28, for the BLAST+ 2.14.0 release + use constant BLASTDB_MANIFEST_VERSION => "1.0"; unless (exists($$metadata{version}) and ($$metadata{version} eq BLASTDB_MANIFEST_VERSION)) { print STDERR "ERROR: Invalid version in manifest file $url, please report to blast-help\@ncbi.nlm.nih.gov\n"; exit(EXIT_FAILURE); @@ -281,7 +272,6 @@ sub get_files_from_json_metadata_1_1($$) } if ($location ne "NCBI") { - die "Only BLASTDB version 5 is supported at GCP and AWS\n" if (defined $opt_blastdb_ver and $opt_blastdb_ver != 5); my $latest_dir = &get_latest_dir($location); my ($json, $url) = &get_blastdb_metadata($location, $latest_dir); unless (length($json)) { @@ -408,16 +398,9 @@ sub connect_to_ftp $ftp->login(USER, PASSWORD) or die "Failed to login to " . NCBI_FTP . ": $!\n"; my $ftp_path = BLAST_DB_DIR; - $ftp_path .= "/v$opt_blastdb_ver" if (defined $opt_blastdb_ver); $ftp->cwd($ftp_path); $ftp->binary(); - if ($opt_verbose) { - if (defined $opt_blastdb_ver) { - print "Connected to $location; downloading BLASTDBv$opt_blastdb_ver\n"; - } else { - print "Connected to $location\n"; - } - } + print "Connected to $location\n" if ($opt_verbose); return $ftp; } @@ -447,18 +430,23 @@ sub get_last_modified_date_from_ncbi_ftp use Time::Local; my %month2int = (Jan=>0, Feb=>1, Mar=>2, Apr=>3, May=>4, Jun=>5, Jul=>6, Aug=>8, Sep=>8, Oct=>9, Nov=>10, Dec=>11); - my $cmd = "$curl --user " . USER . ":" . PASSWORD . " -sI $file | grep ^Last-Modified"; - chomp(my $date_str = `$cmd`); - if ($date_str =~ /Last-Modified:\s+\w+, (\d+) (\w+) (\d+) (\d+):(\d+):(\d+) GMT/) { - # Sample output: Wed, 07 Dec 2022 10:37:08 GMT - my $mday = int($1); - my $mon = $month2int{$2}; - my $year = int($3) - 1900; - my $hour = int($4); - my $min = int($5); - my $sec = int($6); - $retval = Time::Local::timegm($sec, $min, $hour, $mday, $mon, $year); - print "$file $retval\n" if DEBUG; + my $cmd = "$curl --user " . USER . ":" . PASSWORD . " -sI $file"; + if (open(my $fh, "-|", $cmd)) { + while (<$fh>) { + if (/Last-Modified:\s+\w+, (\d+) (\w+) (\d+) (\d+):(\d+):(\d+) GMT/) { + # Sample output: Wed, 07 Dec 2022 10:37:08 GMT + my $mday = int($1); + my $mon = $month2int{$2}; + my $year = int($3) - 1900; + my $hour = int($4); + my $min = int($5); + my $sec = int($6); + $retval = Time::Local::timegm($sec, $min, $hour, $mday, $mon, $year); + print "$file $retval\n" if DEBUG; + last; + } + } + close($fh); } } return $retval; @@ -602,6 +590,7 @@ sub download($$) download_file: if ($opt_force_download or $update_available) { print "Downloading $file..." if $opt_verbose; + my $rv = 0; if (defined($ftp)) { # Download errors will be checked later when reading checksum files $ftp->get($file); @@ -610,19 +599,24 @@ download_file: my $cmd = "$curl --user " . USER . ":" . PASSWORD . " -sSR "; $cmd .= "--remote-name-all $file $file.md5"; print "$cmd\n" if $opt_verbose > 3; - system($cmd); + $rv = system($cmd); + } + my ($rmt_digest, $lcl_digest) = (0)x2; + if ($rv == 0) { + $rmt_digest = &read_md5_file($checksum_file); + $lcl_digest = &compute_md5_checksum($file); } - my $rmt_digest = &read_md5_file($checksum_file); - my $lcl_digest = &compute_md5_checksum($file); print "\nRMT $file Digest $rmt_digest" if (DEBUG); print "\nLCL $file Digest $lcl_digest\n" if (DEBUG); - if ($lcl_digest ne $rmt_digest) { + if ($rv != 0 or ($lcl_digest ne $rmt_digest)) { unlink &rm_protocol($file), &rm_protocol($checksum_file); if (++$attempts >= MAX_DOWNLOAD_ATTEMPTS) { - print STDERR "too many failures, aborting download!\n"; - return EXIT_FAILURE; + print STDERR "too many failures, aborting download! Please try again later or use the --source aws option\n"; + unlink $file, "$file.md5"; + return -1; } else { - print "corrupt download, trying again.\n"; + print "corrupt $file or $file.md5 download, trying again.\n"; + sleep(exponential_delay($attempts)); goto download_file; } } @@ -951,6 +945,12 @@ sub get_curl_path return undef; } +sub exponential_delay { + my $attempt = shift; + my $delay = 2 ** $attempt; + return $delay; +} + __END__ =head1 NAME diff --git a/c++/src/app/blastdb/makeblastdb.cpp b/c++/src/app/blastdb/makeblastdb.cpp index f62c92af..a12200bb 100644 --- a/c++/src/app/blastdb/makeblastdb.cpp +++ b/c++/src/app/blastdb/makeblastdb.cpp @@ -1,4 +1,4 @@ -/* $Id: makeblastdb.cpp 665224 2023-03-30 19:46:21Z camacho $ +/* $Id: makeblastdb.cpp 675077 2023-11-14 13:36:01Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -1075,6 +1075,10 @@ void CMakeBlastDBApp::x_BuildDatabase() GetEnvironment().Get("NCBI_MAKEBLASTDB_SKIP_UNVERIFIED_BIOSEQS"); m_SkipUnver = (env_skip.empty() == false); + const string dont_scan_bioseq = + GetEnvironment().Get("NCBI_MAKEBLASTDB_DONT_SCAN_BIOSEQ_FOR_CFASTAREADER_USER_OBJECTS"); + const bool scan_bioseq_4_cfastareader_usrobj = static_cast(dont_scan_bioseq.empty()); + const CArgs & args = GetArgs(); // Get arguments to the CBuildDatabase constructor. @@ -1173,7 +1177,8 @@ void CMakeBlastDBApp::x_BuildDatabase() long_seqids, dbver, limit_defline, - oid_masks)); + oid_masks, + scan_bioseq_4_cfastareader_usrobj)); #if _BLAST_DEBUG if (args["verbose"]) { diff --git a/c++/src/app/blastdb/makeprofiledb.cpp b/c++/src/app/blastdb/makeprofiledb.cpp index 451e3525..1135fe06 100644 --- a/c++/src/app/blastdb/makeprofiledb.cpp +++ b/c++/src/app/blastdb/makeprofiledb.cpp @@ -1,4 +1,4 @@ -/* $Id: makeprofiledb.cpp 672589 2023-09-11 18:09:51Z ivanov $ +/* $Id: makeprofiledb.cpp 684432 2024-06-24 12:29:18Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE diff --git a/c++/src/app/blastvdb/blast_vdb_cmd.cpp b/c++/src/app/blastvdb/blast_vdb_cmd.cpp index 00612853..7fdd8d99 100644 --- a/c++/src/app/blastvdb/blast_vdb_cmd.cpp +++ b/c++/src/app/blastvdb/blast_vdb_cmd.cpp @@ -1,4 +1,4 @@ -/* $Id: blast_vdb_cmd.cpp 673575 2023-10-04 13:17:52Z ivanov $ +/* $Id: blast_vdb_cmd.cpp 676156 2023-12-11 14:55:17Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -89,12 +89,13 @@ private: string m_allDbs; string m_origDbs; bool m_isRef; + bool m_includeFilteredReads; CBlastUsageReport m_UsageReport; CStopWatch m_StopWatch; }; -CBlastVdbCmdApp::CBlastVdbCmdApp(): m_allDbs(kEmptyStr), m_origDbs(kEmptyStr), m_isRef(false) { +CBlastVdbCmdApp::CBlastVdbCmdApp(): m_allDbs(kEmptyStr), m_origDbs(kEmptyStr), m_isRef(false), m_includeFilteredReads(false) { CRef version(new CVersion()); version->SetVersionInfo(new CBlastVersion()); SetFullVersion(version); @@ -473,6 +474,10 @@ CBlastVdbCmdApp::x_InitApplicationData() else { m_isRef = false; } + + if (args["include_filtered_reads"]) { + m_includeFilteredReads = true; + } } void @@ -499,14 +504,14 @@ CBlastVdbCmdApp::x_GetVDBBlastUtil(bool isCSRA) CStopWatch sw; sw.Start(); - util.Reset(new CVDBBlastUtil(csra_list, true, true)); + util.Reset(new CVDBBlastUtil(csra_list, true, true, m_includeFilteredReads)); sw.Stop(); LOG_POST(Info << "PERF: blast_vdb library csra initialization: " << x_FormatRuntime(sw)); } else { CStopWatch sw; sw.Start(); - util.Reset(new CVDBBlastUtil(m_allDbs, true, false)); + util.Reset(new CVDBBlastUtil(m_allDbs, true, false, m_includeFilteredReads)); sw.Stop(); LOG_POST(Info << "PERF: blast_vdb library initialization: " << x_FormatRuntime(sw)); } @@ -682,6 +687,9 @@ void CBlastVdbCmdApp::Init() arg_desc->SetConstraint("line_length", new CArgAllowValuesGreaterThanOrEqual(1)); + arg_desc->AddFlag("include_filtered_reads", "Include Filtered reads", true); + arg_desc->SetDependency("include_filtered_reads", CArgDescriptions::eExcludes, "info"); + const char* exclusions[] = { "entry", "entry_batch"}; for (size_t i = 0; i < sizeof(exclusions)/sizeof(*exclusions); i++) { arg_desc->SetDependency(exclusions[i], CArgDescriptions::eExcludes, "info"); @@ -692,10 +700,11 @@ void CBlastVdbCmdApp::Init() "Dump reference seqs", true); arg_desc->SetDependency("ref", CArgDescriptions::eExcludes, "info"); arg_desc->SetDependency("ref", CArgDescriptions::eExcludes, "entry_batch"); + arg_desc->SetDependency("ref", CArgDescriptions::eExcludes, "include_filtered_reads"); arg_desc->AddFlag("paths", "Get top level paths", true); arg_desc->AddFlag("paths_all", "Get all vdb and alias paths", true); - const char* exclude_paths[] = { "scan_uncompressed", "scan_compressed", "info", "entry", "entry_batch"}; + const char* exclude_paths[] = { "scan_uncompressed", "scan_compressed", "info", "entry", "entry_batch", "include_filtered_reads"}; for (size_t i = 0; i < sizeof(exclude_paths)/sizeof(*exclude_paths); i++) { arg_desc->SetDependency("paths", CArgDescriptions::eExcludes, exclude_paths[i]); arg_desc->SetDependency("paths_all", CArgDescriptions::eExcludes, exclude_paths[i]); diff --git a/c++/src/app/blastvdb/blastn_vdb.cpp b/c++/src/app/blastvdb/blastn_vdb.cpp index a5e407b1..f9be41d2 100644 --- a/c++/src/app/blastvdb/blastn_vdb.cpp +++ b/c++/src/app/blastvdb/blastn_vdb.cpp @@ -1,4 +1,4 @@ -/* $Id: blastn_vdb.cpp 639448 2021-10-20 14:21:45Z fongah2 $ +/* $Id: blastn_vdb.cpp 676154 2023-12-11 14:54:09Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -263,6 +263,7 @@ int CVDBBlastnApp::Run(void) } input.SetBatchSize(mixer.GetBatchSize()); } + bool bIncludeFilteredReads = args[kArgIncludeFilteredReads].AsBoolean(); // Process the input for (; !input.End(); formatter.ResetScopeHistory()) { @@ -272,7 +273,7 @@ int CVDBBlastnApp::Run(void) // Run local Blast CRef results; - CLocalVDBBlast local_vdb_blast(query_batch, optsHandle, m_localVDBStruct); + CLocalVDBBlast local_vdb_blast(query_batch, optsHandle, m_localVDBStruct, bIncludeFilteredReads); results = local_vdb_blast.Run(); if (!batch_size) input.SetBatchSize(mixer.GetBatchSize(local_vdb_blast.GetNumExtensions())); diff --git a/c++/src/app/blastvdb/tblastn_vdb.cpp b/c++/src/app/blastvdb/tblastn_vdb.cpp index f55a2cb9..7471cab8 100644 --- a/c++/src/app/blastvdb/tblastn_vdb.cpp +++ b/c++/src/app/blastvdb/tblastn_vdb.cpp @@ -1,4 +1,4 @@ -/* $Id: tblastn_vdb.cpp 641931 2021-12-09 16:48:25Z fongah2 $ +/* $Id: tblastn_vdb.cpp 676154 2023-12-11 14:54:09Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -218,6 +218,7 @@ int CVDBTblastnApp::Run(void) vector< CBlastFormatUtil::SDbInfo > vecDbInfo(1); x_FillVDBInfo(vecDbInfo[0]); + bool bIncludeFilteredReads = args[kArgIncludeFilteredReads].AsBoolean(); // Get the formatting options and initialize the formatter CRef fmt_args(m_CmdLineArgs->GetFormattingArgs()); CBlastFormat formatter(opt, vecDbInfo, @@ -263,7 +264,7 @@ int CVDBTblastnApp::Run(void) // Run local Blast CRef results; - CLocalVDBBlast local_vdb_blast(query_batch, optsHandle, m_localVDBStruct); + CLocalVDBBlast local_vdb_blast(query_batch, optsHandle, m_localVDBStruct, bIncludeFilteredReads); results = local_vdb_blast.Run(); @@ -298,7 +299,7 @@ int CVDBTblastnApp::Run(void) SaveSearchStrategy(args, m_CmdLineArgs, queries, optsHandle, pssm); CRef results; - CLocalVDBBlast local_vdb_blast(pssm, optsHandle, m_localVDBStruct); + CLocalVDBBlast local_vdb_blast(pssm, optsHandle, m_localVDBStruct, bIncludeFilteredReads); results = local_vdb_blast.Run(); if (fmt_args->ArchiveFormatRequested(args)){ diff --git a/c++/src/build-system/Makefile.xcode.tmpl b/c++/src/build-system/Makefile.xcode.tmpl index 5dc99bc5..38ae3201 100644 --- a/c++/src/build-system/Makefile.xcode.tmpl +++ b/c++/src/build-system/Makefile.xcode.tmpl @@ -1,11 +1,13 @@ -# $Id: Makefile.xcode.tmpl 613154 2020-08-03 15:33:16Z ucko $ +# $Id: Makefile.xcode.tmpl 676065 2023-12-07 19:04:33Z ivanov $ # Makefile template for Xcode ####################################################################### include ./Makefile.mk DEVSDK = /Developer/SDKs -SDKDIR = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform +CDPMP = /Contents/Developer/Platforms/MacOSX.platform +XCODES = $(wildcard /Applications/Utilities/Xcode* /Applications/Xcode*) +SDKDIR = $(lastword $(XCODES))$(CDPMP) # SDK = $(firstword $(wildcard $(DEVSDK)/*.sdk) $(wildcard $(SDKDIR)/*.sdk)) SDK = $(SDKDIR)$(DEVSDK)/MacOSX.sdk ifneq "" "$(wildcard ${SDK})" diff --git a/c++/src/build-system/cmake/CMake.NCBIComponentsMSVC.cmake b/c++/src/build-system/cmake/CMake.NCBIComponentsMSVC.cmake index 4e8204ac..b4c758c1 100644 --- a/c++/src/build-system/cmake/CMake.NCBIComponentsMSVC.cmake +++ b/c++/src/build-system/cmake/CMake.NCBIComponentsMSVC.cmake @@ -1,5 +1,5 @@ ############################################################################# -# $Id: CMake.NCBIComponentsMSVC.cmake 673293 2023-09-27 13:33:37Z ivanov $ +# $Id: CMake.NCBIComponentsMSVC.cmake 683737 2024-06-04 12:00:41Z ivanov $ ############################################################################# ## @@ -54,7 +54,7 @@ set(NCBI_ThirdParty_Z ${NCBI_ThirdPartyBasePath}/z/${NCBI_ThirdPartyCom set(NCBI_ThirdParty_BZ2 ${NCBI_ThirdPartyBasePath}/bzip2/${NCBI_ThirdPartyCompiler}/1.0.6 CACHE PATH "BZ2 root") set(NCBI_ThirdParty_LZO ${NCBI_ThirdPartyBasePath}/lzo/${NCBI_ThirdPartyCompiler}/2.10 CACHE PATH "LZO root") set(NCBI_ThirdParty_ZSTD ${NCBI_ThirdPartyBasePath}/zstd/${NCBI_ThirdPartyCompiler}/1.5.2 CACHE PATH "ZSTD root") -set(NCBI_ThirdParty_BerkeleyDB ${NCBI_ThirdPartyBasePath}/berkeleydb/${NCBI_ThirdPartyCompiler}/4.6.21.NC CACHE PATH "BerkeleyDB root") +set(NCBI_ThirdParty_BerkeleyDB ${NCBI_ThirdPartyBasePath}/berkeleydb/${NCBI_ThirdPartyCompiler}/5.3.28-ncbi1 CACHE PATH "BerkeleyDB root") set(NCBI_ThirdParty_LMDB ${NCBI_ThirdPartyBasePath}/lmdb/${NCBI_ThirdPartyCompiler}/0.9.24 CACHE PATH "LMDB root") set(NCBI_ThirdParty_JPEG ${NCBI_ThirdPartyBasePath}/jpeg/${NCBI_ThirdPartyCompiler}/9c CACHE PATH "JPEG root") set(NCBI_ThirdParty_PNG ${NCBI_ThirdPartyBasePath}/png/${NCBI_ThirdPartyCompiler}/1.6.34 CACHE PATH "PNG root") @@ -71,9 +71,9 @@ set(NCBI_ThirdParty_FTGL ${NCBI_ThirdPartyBasePath}/ftgl/${NCBI_ThirdParty set(NCBI_ThirdParty_GLEW ${NCBI_ThirdPartyBasePath}/glew/${NCBI_ThirdPartyCompiler}/1.5.8 CACHE PATH "GLEW root") set(NCBI_ThirdParty_FreeType ${NCBI_ThirdPartyBasePath}/freetype/${NCBI_ThirdPartyCompiler}/2.4.10 CACHE PATH "FreeType root") if(NOT noUNICODE IN_LIST NCBI_PTBCFG_PROJECT_FEATURES AND NOT -UNICODE IN_LIST NCBI_PTBCFG_PROJECT_FEATURES) - set(NCBI_ThirdParty_wxWidgets ${NCBI_ThirdPartyBasePath}/wxwidgets/${NCBI_ThirdPartyCompiler}/3.1.3-ncbi1u CACHE PATH "wxWidgets root") + set(NCBI_ThirdParty_wxWidgets ${NCBI_ThirdPartyBasePath}/wxwidgets/${NCBI_ThirdPartyCompiler}/3.2.1-ncbi1u CACHE PATH "wxWidgets root") else() - set(NCBI_ThirdParty_wxWidgets ${NCBI_ThirdPartyBasePath}/wxwidgets/${NCBI_ThirdPartyCompiler}/3.1.3-ncbi1 CACHE PATH "wxWidgets root") + set(NCBI_ThirdParty_wxWidgets ${NCBI_ThirdPartyBasePath}/wxwidgets/${NCBI_ThirdPartyCompiler}/3.2.1-ncbi1 CACHE PATH "wxWidgets root") endif() set(NCBI_ThirdParty_NGHTTP2 ${NCBI_ThirdPartyBasePath}/nghttp2/${NCBI_ThirdPartyCompiler}/1.40.0 CACHE PATH "NGHTTP2 root") set(NCBI_ThirdParty_GL2PS ${NCBI_ThirdPartyBasePath}/gl2ps/${NCBI_ThirdPartyCompiler}/1.4.0 CACHE PATH "GL2PS root") @@ -81,7 +81,7 @@ set(NCBI_ThirdParty_GL2PS ${NCBI_ThirdPartyBasePath}/gl2ps/${NCBI_ThirdPart set(NCBI_ThirdParty_Sybase ${NCBI_ThirdPartyBasePath}/sybase/${NCBI_ThirdPartyCompiler}/15.5 CACHE PATH "Sybase root") set(NCBI_ThirdParty_SybaseLocalPath "" CACHE PATH "SybaseLocalPath") -set(NCBI_ThirdParty_VDB ${NCBI_ThirdParty_VDBROOT}/vdb-versions/3.0.7 CACHE PATH "VDB root") +set(NCBI_ThirdParty_VDB ${NCBI_ThirdParty_VDBROOT}/vdb-versions/3.1.1 CACHE PATH "VDB root") set(NCBI_ThirdParty_VDB_ARCH_INC x86_64) if("${NCBI_ThirdPartyCompiler}" STREQUAL "vs2019.64") set(NCBI_ThirdParty_VDB_ARCH x86_64/v142) diff --git a/c++/src/build-system/cmake/CMake.NCBIComponentsPackage.cmake b/c++/src/build-system/cmake/CMake.NCBIComponentsPackage.cmake index 8e5d68d0..e33c91ee 100644 --- a/c++/src/build-system/cmake/CMake.NCBIComponentsPackage.cmake +++ b/c++/src/build-system/cmake/CMake.NCBIComponentsPackage.cmake @@ -1,5 +1,5 @@ ############################################################################# -# $Id: CMake.NCBIComponentsPackage.cmake 670436 2023-07-25 12:17:17Z ivanov $ +# $Id: CMake.NCBIComponentsPackage.cmake 678115 2024-01-29 16:10:11Z ivanov $ ############################################################################# ## @@ -18,13 +18,18 @@ #set(NCBI_TRACE_ALLCOMPONENTS ON) #set(NCBI_TRACE_COMPONENT_BZ2 ON) -if(NCBI_PTBCFG_USECONAN AND COMMAND conan_define_targets) +if(COMMAND conan_define_targets) set(__silent ${CONAN_CMAKE_SILENT_OUTPUT}) set(CONAN_CMAKE_SILENT_OUTPUT TRUE) conan_define_targets() set(CONAN_CMAKE_SILENT_OUTPUT ${__silent}) endif() list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) +list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) +if(EXISTS "${CMAKE_BINARY_DIR}/${NCBI_DIRNAME_CONANGEN}") + list(APPEND CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}/${NCBI_DIRNAME_CONANGEN}") + list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}/${NCBI_DIRNAME_CONANGEN}") +endif() include(CheckIncludeFile) include(CheckSymbolExists) @@ -120,9 +125,9 @@ if(OFF) endif() endif() else() - NCBIcomponent_find_package(${DC_NAME} ${DC_FIND}) + NCBIcomponent_find_package(${DC_NAME} ${DC_FIND} NO_CMAKE_SYSTEM_PATH) if(NOT NCBI_COMPONENT_${DC_NAME}_FOUND) - NCBIcomponent_find_package(${DC_NAME} ${DC_FIND} NO_CMAKE_SYSTEM_PATH) + NCBIcomponent_find_package(${DC_NAME} ${DC_FIND}) endif() endif() if(NCBI_COMPONENT_${DC_NAME}_FOUND) @@ -140,6 +145,8 @@ endif() set(NCBI_COMPONENT_${DC_NAME}_INCLUDE ${_include} PARENT_SCOPE) set(NCBI_COMPONENT_${DC_NAME}_LIBS ${_all_libs} PARENT_SCOPE) set(NCBI_COMPONENT_${DC_NAME}_DEFINES ${NCBI_COMPONENT_${DC_NAME}_DEFINES} PARENT_SCOPE) + + set_property(GLOBAL APPEND PROPERTY NCBI_PTBPROP_ADJUST_PACKAGE_IMPORTS ${_all_libs}) endif() endif() endif() @@ -168,6 +175,131 @@ endif() endif() endfunction() +############################################################################# +function(NCBI_map_imported_config) + get_property(_all GLOBAL PROPERTY NCBI_PTBPROP_ADJUST_PACKAGE_IMPORTS) + list(REMOVE_DUPLICATES _all) + + set(_todo ${_all}) + set(_done) + while(NOT "${_todo}" STREQUAL "") + set(_next) + foreach(_lib IN LISTS _todo) + if(NOT ${_lib} IN_LIST _done) + NCBI_map_one_import( ${_lib} INTERFACE_COMPILE_DEFINITIONS _out1) + NCBI_map_one_import( ${_lib} INTERFACE_INCLUDE_DIRECTORIES _out2) + set(_out3) + NCBI_map_one_import( ${_lib} INTERFACE_LINK_LIBRARIES _out3) + list(APPEND _next ${_out3}) + endif() + endforeach() + list(APPEND _done ${_todo}) + set(_todo ${_next}) + list(REMOVE_DUPLICATES _todo) + endwhile() +endfunction() + +############################################################################# +function(NCBI_map_one_import _lib _property _todo) + get_property(_props TARGET ${_lib} PROPERTY ${_property}) + if("${_props}" STREQUAL "") + return() + endif() + set(_other) + set(_CONFIG "CONFIG:") + set(_LIBS FALSE) + if(${_property} STREQUAL INTERFACE_LINK_LIBRARIES) + set(_LIBS TRUE) + endif() + string(FIND "${_props}" ${_CONFIG} _pos) + if(${_pos} LESS 0) + foreach(_i IN LISTS _props) + if(TARGET ${_i}) + list(APPEND _other ${_i}) + endif() + set(${_todo} ${_other} PARENT_SCOPE) + endforeach() + + foreach(_cfg IN LISTS NCBI_CONFIGURATION_TYPES) + NCBI_util_Cfg_ToStd(${_cfg} _map_cfg) + string(TOUPPER ${_cfg} _cfg) + string(TOUPPER ${_map_cfg} _map_cfg) + if(NOT "${_cfg}" STREQUAL "${_map_cfg}") + get_property(_loc TARGET ${_lib} PROPERTY IMPORTED_LOCATION_${_map_cfg}) + if(NOT "${_loc}" STREQUAL "") + set_property(TARGET ${_lib} PROPERTY IMPORTED_LOCATION_${_cfg} ${_loc}) + endif() + endif() + endforeach() + return() + endif() + set(_append) + foreach(_cfg IN LISTS NCBI_CONFIGURATION_TYPES) + NCBI_util_Cfg_ToStd(${_cfg} _map_cfg) + string(FIND "${_props}" ${_CONFIG}${_cfg} _pos) + if(${_pos} GREATER 0) + continue() + endif() + list(LENGTH _props _count) + set(_index 0) + while(TRUE) + set(_new) + while(${_index} LESS ${_count}) + list(GET _props ${_index} _i) + if(NOT "${_new}" STREQUAL "") + string(FIND "${_i}" ${_CONFIG} _pos) + if(${_pos} GREATER 0) + break() + else() + list(APPEND _new ${_i}) + endif() + endif() + string(FIND "${_i}" ${_CONFIG}${_map_cfg} _pos) + if(${_pos} GREATER 0) + string(REPLACE ${_CONFIG}${_map_cfg} ${_CONFIG}${_cfg} _new "${_i}") + endif() + math(EXPR _index "${_index} + 1") + endwhile() + if("${_new}" STREQUAL "") + break() + endif() + if(NOT _LIBS) + list(APPEND _append ${_new}) + continue() + endif() + set(_checked) + foreach(_i IN LISTS _new) + if(TARGET ${_i}) + list(APPEND _other ${_i}) + else() + string(FIND "${_i}" "${_CONFIG}" _pos) + if(${_pos} GREATER 0) + string(REPLACE ${_CONFIG}${_cfg} "" _j "${_i}") + string(REPLACE "$<$<>:" "" _j "${_j}") + else() + set(_j ${_i}) + endif() + string(REPLACE ">" "" _j "${_j}") + if(TARGET "${_j}") + list(APPEND _other ${_j}) + elseif(NOT "${_j}" STREQUAL "") + endif() + endif() + list(APPEND _checked ${_i}) + endforeach() + list(APPEND _append ${_checked}) + endwhile() + endforeach() + if(NOT "${_append}" STREQUAL "") + list(APPEND _props ${_append}) + set_property(TARGET ${_lib} PROPERTY ${_property} ${_props}) + endif() + if (_LIBS AND NOT "${_other}" STREQUAL "") + list(REMOVE_DUPLICATES _other) + set(${_todo} ${_other} PARENT_SCOPE) + endif() +endfunction() + ############################################################################# function(NCBI_verify_targets _file) if(NOT EXISTS ${_file}) @@ -238,10 +370,37 @@ function(NCBI_verify_targets _file) endforeach() endfunction() +############################################################################## +macro(NCBI_util_disable_find_use_path) + if(DEFINED CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH) + set(NCBI_FIND_USE_SYSTEM_ENVIRONMENT_PATH ${CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH}) + endif() + set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH FALSE) + if(DEFINED CMAKE_FIND_USE_CMAKE_SYSTEM_PATH) + set(NCBI_FIND_USE_CMAKE_SYSTEM_PATH ${CMAKE_FIND_USE_CMAKE_SYSTEM_PATH}) + endif() + set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH FALSE) +endmacro() + +macro(NCBI_util_enable_find_use_path) + if(DEFINED NCBI_FIND_USE_SYSTEM_ENVIRONMENT_PATH) + set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ${NCBI_FIND_USE_SYSTEM_ENVIRONMENT_PATH}) + unset(NCBI_FIND_USE_SYSTEM_ENVIRONMENT_PATH) + else() + unset(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH) + endif() + if(DEFINED NCBI_FIND_USE_CMAKE_SYSTEM_PATH) + set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH ${NCBI_FIND_USE_CMAKE_SYSTEM_PATH}) + unset(NCBI_FIND_USE_CMAKE_SYSTEM_PATH) + else() + unset(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH) + endif() +endmacro() + ############################################################################# ############################################################################# -if(NCBI_PTBCFG_USECONAN AND NOT COMMAND conan_define_targets) +if(NOT COMMAND conan_define_targets) NCBI_define_Pkgcomponent(NAME OpenSSL PACKAGE openssl FIND OpenSSL) endif() @@ -328,6 +487,9 @@ endif() ############################################################################# # Boost include(${NCBI_TREE_CMAKECFG}/CMakeChecks.boost.cmake) +if(NCBI_COMPONENT_Boost_FOUND) + set_property(GLOBAL APPEND PROPERTY NCBI_PTBPROP_ADJUST_PACKAGE_IMPORTS ${NCBI_COMPONENT_Boost_LIBS}) +endif() ############################################################################# # JPEG @@ -373,14 +535,25 @@ NCBI_define_Pkgcomponent(NAME XML PACKAGE libxml2 REQUIRES zlib;libiconv FIND Li ############################################################################# # XSLT NCBI_define_Pkgcomponent(NAME XSLT PACKAGE libxslt REQUIRES libxml2;zlib;libiconv FIND LibXslt) -if(NOT DEFINED NCBI_XSLTPROCTOOL AND DEFINED CONAN_BIN_DIRS_LIBXSLT) - set(NCBI_XSLTPROCTOOL "${CONAN_BIN_DIRS_LIBXSLT}/xsltproc${CMAKE_EXECUTABLE_SUFFIX}") - set(NCBI_REQUIRE_XSLTPROCTOOL_FOUND YES) +if(NOT DEFINED NCBI_XSLTPROCTOOL) + if(DEFINED CONAN_BIN_DIRS_LIBXSLT) + set(NCBI_XSLTPROCTOOL "${CONAN_BIN_DIRS_LIBXSLT}/xsltproc${CMAKE_EXECUTABLE_SUFFIX}") + endif() + if(EXISTS "${NCBI_XSLTPROCTOOL}") + set(NCBI_REQUIRE_XSLTPROCTOOL_FOUND YES) + endif() +endif() +if(NCBI_TRACE_COMPONENT_XSLT OR NCBI_TRACE_ALLCOMPONENTS) + message("NCBI_XSLTPROCTOOL = ${NCBI_XSLTPROCTOOL}") endif() ############################################################################# # EXSLT NCBI_define_Pkgcomponent(NAME EXSLT PACKAGE libxslt REQUIRES libxml2;zlib;libiconv FIND LibXslt) +if(NCBI_COMPONENT_EXSLT_FOUND AND TARGET LibXslt::LibExslt) + set(NCBI_COMPONENT_EXSLT_LIBS LibXslt::LibExslt ${NCBI_COMPONENT_EXSLT_LIBS}) + set_property(GLOBAL APPEND PROPERTY NCBI_PTBPROP_ADJUST_PACKAGE_IMPORTS LibXslt::LibExslt) +endif() ############################################################################# # UV @@ -392,6 +565,7 @@ NCBI_define_Pkgcomponent(NAME NGHTTP2 PACKAGE libnghttp2 REQUIRES zlib FIND libn ############################################################################## # GRPC/PROTOBUF +NCBI_util_disable_find_use_path() NCBI_define_Pkgcomponent(NAME PROTOBUF PACKAGE protobuf REQUIRES zlib FIND Protobuf) if(NOT DEFINED NCBI_PROTOC_APP) if(DEFINED CONAN_BIN_DIRS_PROTOBUF) @@ -415,6 +589,7 @@ endif() if(NCBI_TRACE_COMPONENT_GRPC OR NCBI_TRACE_ALLCOMPONENTS) message("NCBI_GRPC_PLUGIN = ${NCBI_GRPC_PLUGIN}") endif() +NCBI_util_enable_find_use_path() ############################################################################# # CASSANDRA @@ -438,3 +613,9 @@ endif() ############################################################################# # JAEGER NCBI_define_Pkgcomponent(NAME JAEGER PACKAGE jaegertracing FIND jaegertracing) + +############################################################################# +# this must be the last operation in this file +if(NCBI_PTBCFG_USECONAN OR NCBI_PTBCFG_HASCONAN) + NCBI_map_imported_config() +endif() diff --git a/c++/src/build-system/cmake/CMake.NCBIComponentsUNIXex.cmake b/c++/src/build-system/cmake/CMake.NCBIComponentsUNIXex.cmake index 630375b8..514e72ea 100644 --- a/c++/src/build-system/cmake/CMake.NCBIComponentsUNIXex.cmake +++ b/c++/src/build-system/cmake/CMake.NCBIComponentsUNIXex.cmake @@ -1,5 +1,5 @@ ############################################################################# -# $Id: CMake.NCBIComponentsUNIXex.cmake 673307 2023-09-27 18:37:26Z ivanov $ +# $Id: CMake.NCBIComponentsUNIXex.cmake 682842 2024-05-10 11:27:04Z ivanov $ ############################################################################# ## @@ -48,7 +48,7 @@ endif() set(NCBI_ThirdParty_FASTCGI_SHLIB ${NCBI_ThirdParty_FASTCGI}) set(NCBI_ThirdParty_FASTCGIPP ${NCBI_TOOLS_ROOT}/fastcgi++-3.1~a1+20210601 CACHE PATH "FASTCGIPP root") set(NCBI_ThirdParty_SQLITE3 ${NCBI_TOOLS_ROOT}/sqlite-3.26.0-ncbi1 CACHE PATH "SQLITE3 root") -set(NCBI_ThirdParty_BerkeleyDB ${NCBI_TOOLS_ROOT}/BerkeleyDB-4.6.21.1 CACHE PATH "BerkeleyDB root") +set(NCBI_ThirdParty_BerkeleyDB ${NCBI_TOOLS_ROOT}/BerkeleyDB-5.3.28-ncbi1 CACHE PATH "BerkeleyDB root") set(NCBI_ThirdParty_SybaseNetPath "/opt/sybase/clients/16.0-64bit" CACHE PATH "SybaseNetPath") set(NCBI_ThirdParty_SybaseLocalPath "" CACHE PATH "SybaseLocalPath") set(NCBI_ThirdParty_PYTHON_VERSION "3.9") @@ -81,20 +81,28 @@ set(NCBI_ThirdParty_GPG ${NCBI_TOOLS_ROOT}/libgpg-error-1.6 CACHE PATH set(NCBI_ThirdParty_GCRYPT ${NCBI_TOOLS_ROOT}/libgcrypt-1.4.3 CACHE PATH "GCRYPT root") set(NCBI_ThirdParty_MSGSL ${NCBI_TOOLS_ROOT}/msgsl-0.0.20171114-1c95f94 CACHE PATH "MSGSL root") set(NCBI_ThirdParty_SGE "/netmnt/gridengine/current/drmaa" CACHE PATH "SGE root") -set(NCBI_ThirdParty_MONGOCXX ${NCBI_TOOLS_ROOT}/mongodb-3.6.3 CACHE PATH "MONGOCXX root") -set(NCBI_ThirdParty_MONGOC ${NCBI_TOOLS_ROOT}/mongo-c-driver-1.17.5 CACHE PATH "MONGOC root") +set(NCBI_ThirdParty_MONGOCXX ${NCBI_TOOLS_ROOT}/mongodb-3.7.0 CACHE PATH "MONGOCXX root") +set(NCBI_ThirdParty_MONGOC ${NCBI_TOOLS_ROOT}/mongo-c-driver-1.23.2 CACHE PATH "MONGOC root") set(NCBI_ThirdParty_LEVELDB ${NCBI_TOOLS_ROOT}/leveldb-1.21 CACHE PATH "LEVELDB root") set(NCBI_ThirdParty_ROCKSDB ${NCBI_TOOLS_ROOT}/rocksdb-8.3.2 CACHE PATH "ROCKSDB root") set(NCBI_ThirdParty_wxWidgets ${NCBI_TOOLS_ROOT}/wxWidgets-3.2.1-ncbi1 CACHE PATH "wxWidgets root") set(NCBI_ThirdParty_GLPK "/usr/local/glpk/4.45" CACHE PATH "GLPK root") -set(NCBI_ThirdParty_UV ${NCBI_TOOLS_ROOT}/libuv-1.35.0 CACHE PATH "UV root") +if(APPLE) + set(NCBI_ThirdParty_UV ${NCBI_TOOLS_ROOT}/libuv-1.44.2 CACHE PATH "UV root") +else() + set(NCBI_ThirdParty_UV ${NCBI_TOOLS_ROOT}/libuv-1.35.0 CACHE PATH "UV root") +endif() set(NCBI_ThirdParty_NGHTTP2 ${NCBI_TOOLS_ROOT}/nghttp2-1.40.0 CACHE PATH "NGHTTP2 root") set(NCBI_ThirdParty_GL2PS ${NCBI_TOOLS_ROOT}/gl2ps-1.4.0 CACHE PATH "GL2PS root") set(NCBI_ThirdParty_GMOCK ${NCBI_TOOLS_ROOT}/googletest-1.8.1 CACHE PATH "GMOCK root") set(NCBI_ThirdParty_GTEST ${NCBI_TOOLS_ROOT}/googletest-1.8.1 CACHE PATH "GTEST root") set(NCBI_ThirdParty_CASSANDRA ${NCBI_TOOLS_ROOT}/datastax-cpp-driver-2.15.1 CACHE PATH "CASSANDRA root") set(NCBI_ThirdParty_H2O ${NCBI_TOOLS_ROOT}/h2o-2.2.6 CACHE PATH "H2O root") -set(NCBI_ThirdParty_GMP ${NCBI_TOOLS_ROOT}/gmp-6.0.0a CACHE PATH "GMP root") +if(APPLE) + set(NCBI_ThirdParty_GMP ${NCBI_TOOLS_ROOT}/gmp-6.3.0 CACHE PATH "GMP root") +else() + set(NCBI_ThirdParty_GMP ${NCBI_TOOLS_ROOT}/gmp-6.0.0a CACHE PATH "GMP root") +endif() set(NCBI_ThirdParty_NETTLE ${NCBI_TOOLS_ROOT}/nettle-3.1.1 CACHE PATH "NETTLE root") set(NCBI_ThirdParty_GNUTLS ${NCBI_TOOLS_ROOT}/gnutls-3.4.0 CACHE PATH "GNUTLS root") set(NCBI_ThirdParty_NCBICRYPT ${NCBI_TOOLS_ROOT}/ncbicrypt-20230516 CACHE PATH "NCBICRYPT root") @@ -139,7 +147,7 @@ NCBIcomponent_report(full-blastdb) ############################################################################# # NCBI_C if(NOT NCBI_COMPONENT_NCBI_C_DISABLED) - set(NCBI_C_ROOT "${NCBI_TOOLS_ROOT}/ncbi") + set(NCBI_C_ROOT "${NCBI_TOOLS_ROOT}/c++.by-date/production/20231209/C_TOOLKIT") get_directory_property(_foo_defs COMPILE_DEFINITIONS) if("${_foo_defs}" MATCHES NCBI_INT4_GI) @@ -204,7 +212,7 @@ NCBIcomponent_report(NCBI_C) NCBI_define_Xcomponent(NAME BACKWARD) if(NCBI_COMPONENT_BACKWARD_FOUND) set(HAVE_LIBBACKWARD_CPP YES) - if(NOT NCBI_PTBCFG_USECONAN AND NOT NCBI_PTBCFG_PACKAGING AND NOT NCBI_PTBCFG_PACKAGED) + if(NOT NCBI_PTBCFG_USECONAN AND NOT NCBI_PTBCFG_HASCONAN AND NOT NCBI_PTBCFG_PACKAGING AND NOT NCBI_PTBCFG_PACKAGED) NCBI_find_system_library(LIBDW_LIBS dw) if (LIBDW_LIBS) set(HAVE_LIBDW 1) @@ -613,7 +621,7 @@ NCBI_define_Xcomponent(NAME GRPC MODULE grpc++ LIB NCBIcomponent_report(GRPC) if(NCBI_COMPONENT_GRPC_FOUND) set(NCBI_COMPONENT_GRPC_LIBS ${NCBI_COMPONENT_GRPC_LIBS} ${NCBI_COMPONENT_Boring_LIBS}) - if(NOT NCBI_PTBCFG_USECONAN AND NOT NCBI_PTBCFG_PACKAGING AND NOT NCBI_PTBCFG_PACKAGED AND + if(NOT NCBI_PTBCFG_USECONAN AND NOT NCBI_PTBCFG_HASCONAN AND NOT NCBI_PTBCFG_PACKAGING AND NOT NCBI_PTBCFG_PACKAGED AND "${NCBI_COMPONENT_GRPC_VERSION}" STRLESS "1.17.0") NCBI_define_Xcomponent(NAME CGRPC MODULE grpc LIB grpc) set(NCBI_COMPONENT_GRPC_LIBS ${NCBI_COMPONENT_GRPC_LIBS} ${NCBI_COMPONENT_CGRPC_LIBS}) diff --git a/c++/src/build-system/cmake/CMake.NCBIComponentsXCODE.cmake b/c++/src/build-system/cmake/CMake.NCBIComponentsXCODE.cmake index 8f9bab8e..6f26a341 100644 --- a/c++/src/build-system/cmake/CMake.NCBIComponentsXCODE.cmake +++ b/c++/src/build-system/cmake/CMake.NCBIComponentsXCODE.cmake @@ -1,5 +1,5 @@ ############################################################################# -# $Id: CMake.NCBIComponentsXCODE.cmake 673293 2023-09-27 13:33:37Z ivanov $ +# $Id: CMake.NCBIComponentsXCODE.cmake 679530 2024-02-27 18:29:22Z ivanov $ ############################################################################# ## @@ -31,13 +31,13 @@ set(NCBI_OPT_ROOT /opt/X11) # prebuilt libraries set(NCBI_ThirdParty_BACKWARD ${NCBI_TOOLS_ROOT}/backward-cpp-1.6-ncbi1 CACHE PATH "BACKWARD root") -set(NCBI_ThirdParty_LMDB ${NCBI_TOOLS_ROOT}/lmdb-0.9.18 CACHE PATH "LMDB root") +set(NCBI_ThirdParty_LMDB ${NCBI_TOOLS_ROOT}/lmdb-0.9.24 CACHE PATH "LMDB root") set(NCBI_ThirdParty_LZO ${NCBI_TOOLS_ROOT}/lzo-2.05 CACHE PATH "LZO root") set(NCBI_ThirdParty_ZSTD ${NCBI_TOOLS_ROOT}/zstd-1.5.2 CACHE PATH "ZSTD root") set(NCBI_ThirdParty_SQLITE3 ${NCBI_TOOLS_ROOT}/sqlite-3.26.0-ncbi1 CACHE PATH "SQLITE2 root") set(NCBI_ThirdParty_Boost_VERSION "1.76.0") set(NCBI_ThirdParty_Boost ${NCBI_TOOLS_ROOT}/boost-${NCBI_ThirdParty_Boost_VERSION}-ncbi1 CACHE PATH "Boost root") -set(NCBI_ThirdParty_BerkeleyDB ${NCBI_TOOLS_ROOT}/BerkeleyDB CACHE PATH "BerkeleyDB root") +set(NCBI_ThirdParty_BerkeleyDB ${NCBI_TOOLS_ROOT}/BerkeleyDB-5.3.28-ncbi1 CACHE PATH "BerkeleyDB root") set(NCBI_ThirdParty_FASTCGI ${NCBI_TOOLS_ROOT}/fcgi-2.4.0 CACHE PATH "FASTCGI root") set(NCBI_ThirdParty_FASTCGI_SHLIB ${NCBI_ThirdParty_FASTCGI}) set(NCBI_ThirdParty_PYTHON_VERSION 3.9 CACHE STRING "PYTHON version") @@ -56,10 +56,10 @@ set(NCBI_ThirdParty_GRPC ${NCBI_TOOLS_ROOT}/grpc-1.36.4-ncbi1 CACHE PATH "G set(NCBI_ThirdParty_Boring ${NCBI_ThirdParty_GRPC}) set(NCBI_ThirdParty_PROTOBUF ${NCBI_TOOLS_ROOT}/grpc-1.36.4-ncbi1 CACHE PATH "PROTOBUF root") set(NCBI_ThirdParty_wxWidgets ${NCBI_TOOLS_ROOT}/wxWidgets-3.2.1-ncbi1 CACHE PATH "wxWidgets root") -set(NCBI_ThirdParty_UV ${NCBI_TOOLS_ROOT}/libuv-1.35.0 CACHE PATH "UV root") +set(NCBI_ThirdParty_UV ${NCBI_TOOLS_ROOT}/libuv-1.44.2 CACHE PATH "UV root") set(NCBI_ThirdParty_NGHTTP2 ${NCBI_TOOLS_ROOT}/nghttp2-1.40.0 CACHE PATH "NGHTTP2 root") set(NCBI_ThirdParty_GL2PS ${NCBI_TOOLS_ROOT}/gl2ps-1.4.0 CACHE PATH "GL2PS root") -set(NCBI_ThirdParty_GMP ${NCBI_TOOLS_ROOT}/gmp-6.0.0a CACHE PATH "GMP root") +set(NCBI_ThirdParty_GMP ${NCBI_TOOLS_ROOT}/gmp-6.3.0 CACHE PATH "GMP root") set(NCBI_ThirdParty_NETTLE ${NCBI_TOOLS_ROOT}/nettle-3.1.1 CACHE PATH "NETTLE root") set(NCBI_ThirdParty_GNUTLS ${NCBI_TOOLS_ROOT}/gnutls-3.4.0 CACHE PATH "GNUTLS root") set(NCBI_ThirdParty_NCBICRYPT ${NCBI_TOOLS_ROOT}/ncbicrypt-20230516 CACHE PATH "NCBICRYPT root") @@ -101,7 +101,7 @@ NCBIcomponent_report(full-blastdb) ############################################################################# # NCBI_C if(NOT NCBI_COMPONENT_NCBI_C_DISABLED) - set(NCBI_C_ROOT "${NCBI_TOOLS_ROOT}/ncbi") + set(NCBI_C_ROOT "${NCBI_TOOLS_ROOT}/c++.by-date/production/20231209/C_TOOLKIT") get_directory_property(_foo_defs COMPILE_DEFINITIONS) if("${_foo_defs}" MATCHES NCBI_INT4_GI) @@ -157,7 +157,7 @@ NCBIcomponent_report(NCBI_C) NCBI_define_Xcomponent(NAME BACKWARD) if(NCBI_COMPONENT_BACKWARD_FOUND) set(HAVE_LIBBACKWARD_CPP YES) - if(NOT NCBI_PTBCFG_USECONAN AND NOT NCBI_PTBCFG_PACKAGING AND NOT NCBI_PTBCFG_PACKAGED) + if(NOT NCBI_PTBCFG_USECONAN AND NOT NCBI_PTBCFG_HASCONAN AND NOT NCBI_PTBCFG_PACKAGING AND NOT NCBI_PTBCFG_PACKAGED) NCBI_find_system_library(LIBDW_LIBS NAMES dw) if (LIBDW_LIBS) set(HAVE_LIBDW 1) diff --git a/c++/src/build-system/cmake/CMake.NCBIpkg.setup.cmake b/c++/src/build-system/cmake/CMake.NCBIpkg.setup.cmake index 4a142098..e47123a8 100644 --- a/c++/src/build-system/cmake/CMake.NCBIpkg.setup.cmake +++ b/c++/src/build-system/cmake/CMake.NCBIpkg.setup.cmake @@ -1,5 +1,5 @@ ############################################################################# -# $Id: CMake.NCBIpkg.setup.cmake 659871 2022-12-06 14:41:46Z gouriano $ +# $Id: CMake.NCBIpkg.setup.cmake 678145 2024-01-29 16:14:02Z ivanov $ ############################################################################# ############################################################################# ## @@ -10,7 +10,6 @@ if(NCBI_PTBCFG_PACKAGING) - set(CONAN_CMAKE_CXX_STANDARD 17) foreach(_sub IN LISTS CMAKE_BINARY_DIR CMAKE_MODULE_PATH) if (EXISTS "${_sub}/conanbuildinfo.cmake") include(${_sub}/conanbuildinfo.cmake) @@ -19,59 +18,138 @@ if(NCBI_PTBCFG_PACKAGING) endif() endforeach() elseif(NCBI_PTBCFG_USECONAN) - if(EXISTS "${CMAKE_BINARY_DIR}/conanfile.txt") - file(REMOVE "${CMAKE_BINARY_DIR}/conanfile.txt") + message("#############################################################################") + message("Installing Conan packages") + find_program(NCBI_CONAN_APP conan${CMAKE_EXECUTABLE_SUFFIX}) + if(NCBI_CONAN_APP) + execute_process( + COMMAND ${NCBI_CONAN_APP} version + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + RESULT_VARIABLE NCBI_CONAN_VERSION + OUTPUT_QUIET ERROR_QUIET + ) + if(NCBI_CONAN_VERSION EQUAL 0) + set(NCBI_CONAN_VERSION 2) + else() + set(NCBI_CONAN_VERSION 1) + endif() + message("Conan v${NCBI_CONAN_VERSION}.x: ${NCBI_CONAN_APP}") + else() + message(FATAL_ERROR "Conan not found") + endif() + + execute_process( + COMMAND ${NCBI_CONAN_APP} remote list + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + OUTPUT_VARIABLE _remotes + ) + string(REPLACE "\n" ";" _remotes "${_remotes}") + set(_ncbi_found NO) + foreach(_rem IN LISTS _remotes) + string(FIND "${_rem}" "ncbi.nlm.nih.gov" _pos) + if(${_pos} GREATER 0) + set(_ncbi_found YES) + break() + endif() + endforeach() + + set(_conanfile "${CMAKE_BINARY_DIR}/conanfile.txt") + if(EXISTS ${_conanfile}) + file(REMOVE ${_conanfile}) endif() if (MSVC) file(COPY "${CMAKE_CURRENT_LIST_DIR}/conanfile.MSVC.txt" DESTINATION "${CMAKE_BINARY_DIR}") - file(RENAME "${CMAKE_BINARY_DIR}/conanfile.MSVC.txt" "${CMAKE_BINARY_DIR}/conanfile.txt") + file(RENAME "${CMAKE_BINARY_DIR}/conanfile.MSVC.txt" ${_conanfile}) elseif (APPLE) file(COPY "${CMAKE_CURRENT_LIST_DIR}/conanfile.XCODE.txt" DESTINATION "${CMAKE_BINARY_DIR}") - file(RENAME "${CMAKE_BINARY_DIR}/conanfile.XCODE.txt" "${CMAKE_BINARY_DIR}/conanfile.txt") + file(RENAME "${CMAKE_BINARY_DIR}/conanfile.XCODE.txt" ${_conanfile}) else() file(COPY "${CMAKE_CURRENT_LIST_DIR}/conanfile.UNIX.txt" DESTINATION "${CMAKE_BINARY_DIR}") - file(RENAME "${CMAKE_BINARY_DIR}/conanfile.UNIX.txt" "${CMAKE_BINARY_DIR}/conanfile.txt") - endif() - message("#############################################################################") - message("Installing Conan packages") - find_program(NCBI_CONAN_APP conan${CMAKE_EXECUTABLE_SUFFIX}) - if(NCBI_CONAN_APP) - message("Conan: ${NCBI_CONAN_APP}") - else() - message(FATAL_ERROR "Conan not found") + file(RENAME "${CMAKE_BINARY_DIR}/conanfile.UNIX.txt" ${_conanfile}) endif() + file(STRINGS ${_conanfile} _list) + set(_requires) + set(_ncbi_internal NO) + foreach( _item IN LISTS _list) + if("${_item}" STREQUAL "#internal{") + set(_ncbi_internal YES) + continue() + endif() + if(_ncbi_internal AND "${_item}" STREQUAL "#}") + set(_ncbi_internal NO) + continue() + endif() + if(NOT _ncbi_internal OR _ncbi_found) + list(APPEND _requires "${_item}\n") + endif() + endforeach() + file(WRITE ${_conanfile} ${_requires}) + find_program(NCBI_CMAKE_APP cmake${CMAKE_EXECUTABLE_SUFFIX}) message("CMake: ${NCBI_CMAKE_APP}") - set(_cmd install . --build missing -pr:b default) + if(NCBI_CONAN_VERSION EQUAL 1) + set(_cmd install ${CMAKE_BINARY_DIR} --build missing -pr:b default -if ${CMAKE_BINARY_DIR}/${NCBI_DIRNAME_CONANGEN}) + else() + set(_cmd install ${CMAKE_BINARY_DIR} --build missing -pr:b default -of ${CMAKE_BINARY_DIR}/${NCBI_DIRNAME_CONANGEN}) + endif() if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Intel") set(_cmd ${_cmd} -s compiler.libcxx=libstdc++11) endif() + if(StaticComponents IN_LIST NCBI_PTBCFG_PROJECT_FEATURES OR (MSVC AND NOT BUILD_SHARED_LIBS)) + set(_cmd ${_cmd} -o *:shared=False) + else() + set(_cmd ${_cmd} -o *:shared=True) + if(NOT NCBI_CONAN_VERSION EQUAL 1 AND EXISTS ${_conanfile}) + file(STRINGS ${_conanfile} _options) + foreach(_opt IN LISTS _options) + string(FIND "${_opt}" "#" _p1) + string(FIND "${_opt}" ":shared" _p2) + if(${_p2} GREATER 0 AND ${_p1} LESS 0) + string(REPLACE " " "" _p2 "${_p2}") + set(_cmd ${_cmd} -o ${_opt}) + endif() + endforeach() + endif() + endif() + + string(REPLACE "," ";" NCBI_PTBCFG_CONAN_ARGS "${NCBI_PTBCFG_CONAN_ARGS}") + string(REPLACE " " ";" NCBI_PTBCFG_CONAN_ARGS "${NCBI_PTBCFG_CONAN_ARGS}") + set(_cmd ${_cmd} ${NCBI_PTBCFG_CONAN_ARGS}) set(_types) - if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "") + if (NOT "${NCBI_PTBCFG_CONFIGURATION_TYPES}" STREQUAL "") + set(_types ${NCBI_PTBCFG_CONFIGURATION_TYPES}) + elseif (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "") set(_types ${CMAKE_BUILD_TYPE}) elseif (NOT "${CMAKE_CONFIGURATION_TYPES}" STREQUAL "") set(_types ${CMAKE_CONFIGURATION_TYPES}) endif() - list(LENGTH _types _count) - if("${_count}" EQUAL 1) - NCBI_util_Cfg_ToStd(${_types} _type) - set(_cmd ${_cmd} -s build_type=${_type}) - endif() + set(_configs) + foreach(_t IN LISTS _types) + NCBI_util_Cfg_ToStd(${_t} _cfg) + if(NCBI_CONAN_VERSION EQUAL 1 OR NOT MSVC) + set(_cmd${_cfg} ${_cmd} -s build_type=${_cfg}) +#invoke Conan install so that it will generate files for the debug configuration, pointing at the release one +#set(_cmd${_cfg} ${_cmd} -s &:build_type=${_cfg} -s build_type=Release) + else() + set(_cmd${_cfg} ${_cmd} -s build_type=${_cfg} -s compiler.runtime_type=${_cfg}) + endif() + list(APPEND _configs ${_cfg}) + endforeach() + list(REMOVE_DUPLICATES _configs) - string(REPLACE "," ";" NCBI_PTBCFG_CONAN_ARGS "${NCBI_PTBCFG_CONAN_ARGS}") - string(REPLACE " " ";" NCBI_PTBCFG_CONAN_ARGS "${NCBI_PTBCFG_CONAN_ARGS}") - set(_cmd ${_cmd} ${NCBI_PTBCFG_CONAN_ARGS}) + foreach(_cfg IN LISTS _configs) + execute_process( + COMMAND ${NCBI_CONAN_APP} ${_cmd${_cfg}} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + RESULT_VARIABLE CONAN_INSTALL_RESULT + ) + if(NOT CONAN_INSTALL_RESULT EQUAL "0") + message(FATAL_ERROR "Conan setup failed: error = ${CONAN_INSTALL_RESULT}") + endif() + endforeach() - execute_process( - COMMAND ${NCBI_CONAN_APP} ${_cmd} - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" - RESULT_VARIABLE CONAN_INSTALL_RESULT - ) - if(NOT CONAN_INSTALL_RESULT EQUAL "0") - message(FATAL_ERROR "Conan setup failed: error = ${CONAN_INSTALL_RESULT}") - endif() message("Done with installing Conan packages") message("#############################################################################") diff --git a/c++/src/build-system/cmake/CMake.NCBIptb.cmake b/c++/src/build-system/cmake/CMake.NCBIptb.cmake index 5ad36be5..381be5c6 100644 --- a/c++/src/build-system/cmake/CMake.NCBIptb.cmake +++ b/c++/src/build-system/cmake/CMake.NCBIptb.cmake @@ -1,5 +1,5 @@ ############################################################################# -# $Id: CMake.NCBIptb.cmake 665767 2023-04-13 13:32:21Z gouriano $ +# $Id: CMake.NCBIptb.cmake 675541 2023-11-27 19:51:05Z ivanov $ ############################################################################# # # PUBLIC DOMAIN NOTICE @@ -32,6 +32,7 @@ ## NCBI_add_subdirectory( list of subdirectories) ## NCBI_add_library( list of libraries) ## NCBI_add_app( list of apps) +## NCBI_module( name) - declare root dir of git submodule ##--------------------------------------------------------------------------- ## the following calls in CMakeLists.txt affect all projects in current dir and all subdirs ## NCBI_headers( list of headers) @@ -237,6 +238,36 @@ function(NCBI_add_app) unset(NCBI_PROJECT_expected) endfunction() +############################################################################# +macro(NCBI_module _name) + if(NOT NCBI_PTBMODE_COLLECT_DEPS) + set(NCBI_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + set(NCBI_TREE_ROOT ${CMAKE_CURRENT_LIST_DIR}) + set(NCBI_SRC_ROOT ${NCBI_TREE_ROOT}/${NCBI_DIRNAME_SRC}) + set(NCBI_INC_ROOT ${NCBI_TREE_ROOT}/${NCBI_DIRNAME_INCLUDE}) + if (NOT EXISTS "${NCBI_SRC_ROOT}") + message("WARNING: Module ${_name} does not have ${NCBI_DIRNAME_SRC} directory (${NCBI_CURRENT_SOURCE_DIR})") + set(NCBI_SRC_ROOT ${NCBI_TREE_ROOT}) + endif() + if (NOT EXISTS "${NCBI_INC_ROOT}") + message("WARNING: Module ${_name} does not have ${NCBI_DIRNAME_INCLUDE} directory (${NCBI_CURRENT_SOURCE_DIR})") + set(NCBI_INC_ROOT ${NCBI_TREE_ROOT}) + endif() + + NCBI_declare_module_src_root(${_name} ${NCBI_SRC_ROOT}) + if(NOT NCBI_PTBMODE_COLLECT_DEPS) + include_directories(${NCBI_INC_ROOT}) + endif() +endmacro() + +function(NCBI_declare_module_src_root _name _dir) + get_property(_module_src_roots GLOBAL PROPERTY NCBI_PTBPROP_MODULE_SRC_ROOTS) + list(APPEND _module_src_roots ${_dir}) + list(REMOVE_DUPLICATES _module_src_roots) + set_property(GLOBAL PROPERTY NCBI_PTBPROP_MODULE_SRC_ROOTS ${_module_src_roots}) +endfunction() + ############################################################################# function(NCBI_add_target) if(NCBI_PTBMODE_PARTS) @@ -788,6 +819,7 @@ macro(NCBI_internal_analyze_tree) get_property(_allprojects GLOBAL PROPERTY NCBI_PTBPROP_ALL_PROJECTS) get_property(_allowedprojects GLOBAL PROPERTY NCBI_PTBPROP_ALLOWED_PROJECTS) + set_property(GLOBAL PROPERTY NCBI_PTBPROP_INTERFACE_DEPS "") if(OFF) message("NCBI_PTBPROP_ALL_PROJECTS: ${_allprojects}") @@ -1242,14 +1274,19 @@ function(NCBI_internal_collect_dataspec) set(NCBITMP_PROJECT_HEADERS ${NCBITMP_PROJECT_HEADERS} ${_incfiles} PARENT_SCOPE) source_group("${_prefix}DataSpec Files" FILES ${_specfiles}) set(NCBITMP_PROJECT_DATASPEC ${NCBITMP_PROJECT_DATASPEC} ${_specfiles} PARENT_SCOPE) + + if(NOT NCBI_PTBMODE_COLLECT_DEPS) + set(NCBITMP_PROJECT_SPECFILES ${_specfiles}) + NCBI_internal_add_dataspec() + endif() endfunction() ############################################################################## function(NCBI_internal_add_dataspec) - if (NOT DEFINED NCBITMP_PROJECT_DATASPEC) + if (NOT DEFINED NCBITMP_PROJECT_SPECFILES) return() endif() - foreach(_dataspec IN LISTS NCBITMP_PROJECT_DATASPEC) + foreach(_dataspec IN LISTS NCBITMP_PROJECT_SPECFILES) get_filename_component(_ext ${_dataspec} EXT) set(_input GENERATE DATASPEC ${_dataspec} REQUIRES ${NCBITMP_REQUIRE} ${NCBITMP_COMPONENTS} RETURN _output) string(TOLOWER ${_ext} _ext) @@ -1490,23 +1527,42 @@ function(NCBI_internal_collect_parts _result) set(_hostproject ${NCBI_PROJECT}) set(_hostdir ${NCBI_CURRENT_SOURCE_DIR}) set(_fnresult ${_result}) + if(NCBI_VERBOSE_ALLPROJECTS OR NCBI_VERBOSE_PROJECT_${NCBI_PROJECT}) + message("${NCBI_PROJECT} parts: ${NCBI_${_hostproject}_PARTS}") + endif() # verify that all parts can be found - foreach(_part IN LISTS NCBI_${_hostproject}_PARTS) - set(_filepath ${NCBI_SRC_ROOT}/${_part}) - get_filename_component(_path ${_filepath} DIRECTORY) - if(NOT EXISTS ${_path}/CMakeLists.txt) - if(NCBI_VERBOSE_ALLPROJECTS OR NCBI_VERBOSE_PROJECT_${NCBI_PROJECT}) - message("WARNING: Project part ${_part} not found: ${NCBI_PROJECT} (${NCBI_CURRENT_SOURCE_DIR}): ") + get_property(_module_src_roots GLOBAL PROPERTY NCBI_PTBPROP_MODULE_SRC_ROOTS) + set(_all_found FALSE) + foreach(_root IN LISTS NCBI_SRC_ROOT _module_src_roots) + set(_all_found TRUE) + foreach(_part IN LISTS NCBI_${_hostproject}_PARTS) + set(_filepath ${_root}/${_part}) + get_filename_component(_path ${_filepath} DIRECTORY) + if(NOT EXISTS ${_path}/CMakeLists.txt) + if(NCBI_VERBOSE_ALLPROJECTS OR NCBI_VERBOSE_PROJECT_${NCBI_PROJECT}) + message("${NCBI_PROJECT}: WARNING: Project part ${_part} not found in ${_path} (${NCBI_CURRENT_SOURCE_DIR})") + endif() + set(_all_found FALSE) + break() + else() + if(NCBI_VERBOSE_ALLPROJECTS OR NCBI_VERBOSE_PROJECT_${NCBI_PROJECT}) + message("${NCBI_PROJECT}: Project part ${_part} found in ${_path} (${NCBI_CURRENT_SOURCE_DIR})") + endif() endif() - set(${_fnresult} FALSE PARENT_SCOPE) - return() + endforeach() + if(_all_found) + set(NCBI_TREE_ROOT ${_root}/..) + set(NCBI_SRC_ROOT ${_root}) + set(NCBI_INC_ROOT ${_root}/../include) + break() endif() endforeach() + if(NOT _all_found) + set(${_fnresult} FALSE PARENT_SCOPE) + return() + endif() set(NCBI_PTBMODE_PARTS ON) - if(NCBI_VERBOSE_ALLPROJECTS OR NCBI_VERBOSE_PROJECT_${NCBI_PROJECT}) - message("${NCBI_PROJECT} parts: ${NCBI_${_hostproject}_PARTS}") - endif() foreach(_part IN LISTS NCBI_${_hostproject}_PARTS) set(_filepath ${NCBI_SRC_ROOT}/${_part}) get_filename_component(_path ${_filepath} DIRECTORY) @@ -1524,6 +1580,14 @@ function(NCBI_internal_collect_parts _result) file(RELATIVE_PATH _relpath ${NCBI_SRC_ROOT} ${_path}) string(REPLACE "/" ";" _dirlist ${_relpath}) + if(${NCBI_SRC_ROOT} IN_LIST _module_src_roots) + foreach( _dir IN ITEMS ${NCBI_TREE_ROOT} ${NCBI_SRC_ROOT}) + set(NCBI_CURRENT_SOURCE_DIR ${_dir}) + if(EXISTS ${NCBI_CURRENT_SOURCE_DIR}/CMakeLists.txt) + include(${NCBI_CURRENT_SOURCE_DIR}/CMakeLists.txt) + endif() + endforeach() + endif() set(NCBI_CURRENT_SOURCE_DIR ${NCBI_SRC_ROOT}) foreach(_dir IN LISTS _dirlist) set(NCBI_CURRENT_SOURCE_DIR ${NCBI_CURRENT_SOURCE_DIR}/${_dir}) @@ -1596,6 +1660,11 @@ function(NCBI_internal_process_interface_libraries _lib) if (NOT TARGET ${_lib}) return() endif() + get_property(_collected GLOBAL PROPERTY NCBI_PTBPROP_INTERFACE_DEPS) + if( ${_lib} IN_LIST _collected) + return() + endif() + set_property(GLOBAL PROPERTY NCBI_PTBPROP_INTERFACE_DEPS ${_collected} ${_lib}) get_target_property(_deps ${_lib} INTERFACE_LINK_LIBRARIES) if ( NOT "${_deps}" STREQUAL "") set(_value "") @@ -1857,6 +1926,7 @@ function(NCBI_internal_process_project_filters _result) else() set(_src_root ${NCBI_SRC_ROOT}) endif() + get_property(_module_src_roots GLOBAL PROPERTY NCBI_PTBPROP_MODULE_SRC_ROOTS) foreach(_dir IN LISTS NCBI_PTBCFG_PROJECT_LIST) if("${_dir}" STREQUAL "") continue() @@ -1866,19 +1936,22 @@ function(NCBI_internal_process_project_filters _result) continue() endif() NCBI_util_parse_sign( ${_dir} _value _negate) - if(_negate) - NCBI_util_match_path(${NCBI_CURRENT_SOURCE_DIR} ${_src_root}/${_value} _match) - if(_match) - set(${_result} FALSE PARENT_SCOPE) - return() - endif() - else() - set(_hasp TRUE) - NCBI_util_match_path(${NCBI_CURRENT_SOURCE_DIR} ${_src_root}/${_value} _match) - if(_match) - set(_is_good TRUE) + foreach(_root IN LISTS _src_root _module_src_roots) + if(_negate) + NCBI_util_match_path(${NCBI_CURRENT_SOURCE_DIR} ${_root}/${_value} _match) + if(_match) + set(${_result} FALSE PARENT_SCOPE) + return() + endif() + else() + set(_hasp TRUE) + NCBI_util_match_path(${NCBI_CURRENT_SOURCE_DIR} ${_root}/${_value} _match) + if(_match) + set(_is_good TRUE) + break() + endif() endif() - endif() + endforeach() endforeach() if (NOT _is_good AND _hasp) set(${_result} FALSE PARENT_SCOPE) @@ -2370,7 +2443,6 @@ endif() return() endif() NCBI_internal_add_resources() - NCBI_internal_add_dataspec() if(NCBI_PTBCFG_CREATE_GENERATESRC) if ( NOT "${NCBITMP_REQUIRE_NOTFOUND}" STREQUAL "") if ("${ARGC}" GREATER "0") diff --git a/c++/src/build-system/cmake/CMake.NCBIptb.datatool.cmake b/c++/src/build-system/cmake/CMake.NCBIptb.datatool.cmake index 0881e263..3b872bdc 100644 --- a/c++/src/build-system/cmake/CMake.NCBIptb.datatool.cmake +++ b/c++/src/build-system/cmake/CMake.NCBIptb.datatool.cmake @@ -1,5 +1,5 @@ ############################################################################# -# $Id: CMake.NCBIptb.datatool.cmake 672354 2023-09-06 13:38:32Z ivanov $ +# $Id: CMake.NCBIptb.datatool.cmake 675541 2023-11-27 19:51:05Z ivanov $ ############################################################################# ############################################################################# ## @@ -101,15 +101,20 @@ function(NCBI_internal_process_dataspec _variable _access _value) endif() endif() set(_opm) + set(_dir) if(DEFINED NCBI_EXTERNAL_TREE_ROOT) if(NCBI_PTBCFG_PACKAGED) - set(_opm -opm "${NCBI_EXTERNAL_TREE_ROOT}/res/specs") + set(_dir "${NCBI_EXTERNAL_TREE_ROOT}/res/specs") else() - set(_opm -opm "${NCBI_EXTERNAL_TREE_ROOT}/${NCBI_DIRNAME_SRC}") + set(_dir "${NCBI_EXTERNAL_TREE_ROOT}/${NCBI_DIRNAME_SRC}") endif() else() - set(_opm -opm "${NCBITK_SRC_ROOT}") + set(_dir "${NCBITK_SRC_ROOT}") endif() + if(NOT "${_dir}" STREQUAL "${NCBI_SRC_ROOT}") + set(_dir "${NCBI_SRC_ROOT},${_dir}") + endif() + set(_opm -opm "${_dir}") NCBI_util_get_value(PCH _fpch) if (NOT "${_fpch}" STREQUAL "") diff --git a/c++/src/build-system/cmake/CMake.NCBIptb.definitions.cmake b/c++/src/build-system/cmake/CMake.NCBIptb.definitions.cmake index 0f40e4c2..a30064e9 100644 --- a/c++/src/build-system/cmake/CMake.NCBIptb.definitions.cmake +++ b/c++/src/build-system/cmake/CMake.NCBIptb.definitions.cmake @@ -1,5 +1,5 @@ ############################################################################# -# $Id: CMake.NCBIptb.definitions.cmake 668418 2023-06-05 14:00:32Z gouriano $ +# $Id: CMake.NCBIptb.definitions.cmake 678115 2024-01-29 16:10:11Z ivanov $ ############################################################################# ############################################################################# ## @@ -60,6 +60,7 @@ set(NCBI_DIRNAME_SCRIPTS scripts) set(NCBI_DIRNAME_COMMON_SCRIPTS scripts/common) set(NCBI_DIRNAME_BUILDCFG ${NCBI_DIRNAME_SRC}/build-system) set(NCBI_DIRNAME_CMAKECFG ${NCBI_DIRNAME_SRC}/build-system/cmake) +set(NCBI_DIRNAME_CONANGEN generators) set(NCBI_TREE_ROOT ${CMAKE_SOURCE_DIR}) if(EXISTS "${CMAKE_SOURCE_DIR}/corelib/CMakeLists.corelib.lib.txt") @@ -122,7 +123,6 @@ set(build_root ${CMAKE_BINARY_DIR}) set(builddir ${CMAKE_BINARY_DIR}) set(includedir0 ${NCBI_INC_ROOT}) set(includedir ${NCBI_INC_ROOT}) -set(incdir ${CMAKE_BINARY_DIR}/${NCBI_DIRNAME_CFGINC}) set(incinternal ${NCBI_INC_ROOT}/${NCBI_DIRNAME_INTERNAL}) set(NCBI_DIRNAME_BUILD build) diff --git a/c++/src/build-system/cmake/CMake.NCBIptb.grpc.cmake b/c++/src/build-system/cmake/CMake.NCBIptb.grpc.cmake index 1be046d7..d1742c40 100644 --- a/c++/src/build-system/cmake/CMake.NCBIptb.grpc.cmake +++ b/c++/src/build-system/cmake/CMake.NCBIptb.grpc.cmake @@ -1,5 +1,5 @@ ############################################################################# -# $Id: CMake.NCBIptb.grpc.cmake 662255 2023-01-26 16:33:13Z gouriano $ +# $Id: CMake.NCBIptb.grpc.cmake 676274 2023-12-13 15:30:34Z ivanov $ ############################################################################# ############################################################################# ## @@ -145,8 +145,12 @@ function(NCBI_internal_process_proto_dataspec _variable _access _value) endif() endif() endif() - NCBI_util_gitignore(${_pb_srcfiles} ${_gr_srcfiles}) - NCBI_util_gitignore(${_pb_incfiles} ${_gr_incfiles}) + if (NOT "${_pb_srcfiles}" STREQUAL "") + NCBI_util_gitignore(${_pb_srcfiles} ${_gr_srcfiles}) + endif() + if (NOT "${_pb_incfiles}" STREQUAL "") + NCBI_util_gitignore(${_pb_incfiles} ${_gr_incfiles}) + endif() endfunction() ############################################################################## diff --git a/c++/src/build-system/cmake/CMakeChecks.boost.cmake b/c++/src/build-system/cmake/CMakeChecks.boost.cmake index 3ce392a4..481d85d3 100644 --- a/c++/src/build-system/cmake/CMakeChecks.boost.cmake +++ b/c++/src/build-system/cmake/CMakeChecks.boost.cmake @@ -26,9 +26,19 @@ if(EXISTS "${NCBI_ThirdParty_Boost}" endif() endif() if(NOT Boost_FOUND) - find_package(Boost OPTIONAL_COMPONENTS ${Boost_REQUESTED_COMPONENTS}) + find_package(Boost OPTIONAL_COMPONENTS ${Boost_REQUESTED_COMPONENTS} NO_CMAKE_SYSTEM_PATH) + if(NOT Boost_FOUND) + find_package(Boost OPTIONAL_COMPONENTS ${Boost_REQUESTED_COMPONENTS}) + endif() endif() +foreach(_inc IN ITEMS _RELEASE _DEBUG) + if (EXISTS ${Boost_INCLUDE_DIRS${_inc}}) + set(_boost_inc ${Boost_INCLUDE_DIRS${_inc}}) + break() + endif() +endforeach() + if(OFF AND Boost_FOUND) add_definitions(-DBOOST_LOG_DYN_LINK) @@ -51,6 +61,11 @@ if (EXISTS ${Boost_INCLUDE_DIRS}) set(NCBI_COMPONENT_Boost.Test.Included_FOUND YES) set(NCBI_COMPONENT_Boost.Test.Included_INCLUDE ${Boost_INCLUDE_DIRS}) set(NCBI_COMPONENT_Boost.Test.Included_DEFINES BOOST_TEST_NO_LIB) +elseif (EXISTS ${_boost_inc}) + message(STATUS "Found Boost.Test.Included: ${_boost_inc}") + set(NCBI_COMPONENT_Boost.Test.Included_FOUND YES) + set(NCBI_COMPONENT_Boost.Test.Included_INCLUDE ${_boost_inc}) + set(NCBI_COMPONENT_Boost.Test.Included_DEFINES BOOST_TEST_NO_LIB) elseif(EXISTS ${NCBI_ThirdParty_Boost}/include) message(STATUS "Found Boost.Test.Included: ${NCBI_ThirdParty_Boost}") set(NCBI_COMPONENT_Boost.Test.Included_FOUND YES) diff --git a/c++/src/build-system/cmake/cmake-cfg-unix.sh b/c++/src/build-system/cmake/cmake-cfg-unix.sh index 902e465b..fb75762e 100755 --- a/c++/src/build-system/cmake/cmake-cfg-unix.sh +++ b/c++/src/build-system/cmake/cmake-cfg-unix.sh @@ -1,6 +1,6 @@ #!/bin/sh ############################################################################# -# $Id: cmake-cfg-unix.sh 670429 2023-07-25 12:16:21Z ivanov $ +# $Id: cmake-cfg-unix.sh 681359 2024-04-08 18:49:39Z ivanov $ # Configure NCBI C++ toolkit using CMake build system. # Author: Andrei Gourianov, gouriano@ncbi ############################################################################# @@ -16,14 +16,17 @@ prebuilds="" host_os=`uname` if test -z "${CMAKE_CMD}" -a $host_os = "Darwin"; then - for i in /usr/local/bin/cmake /Applications/CMake.app/Contents/bin/cmake \ - /sw/bin/cmake - do - if test -x $i; then - CMAKE_CMD=$i - break - fi - done + CMAKE_CMD=`which cmake 2>/dev/null` + if test $? -ne 0; then + for i in /usr/local/bin/cmake /opt/homebrew/bin/cmake \ + /Applications/CMake.app/Contents/bin/cmake /sw/bin/cmake + do + if test -x $i && $i --version >/dev/null 2>&1; then + CMAKE_CMD=$i + break + fi + done + fi fi if [ -z "${CMAKE_CMD}" ]; then CMAKE_CMD=`which cmake 2>/dev/null` @@ -32,6 +35,8 @@ if [ -z "${CMAKE_CMD}" ]; then exit 1 fi fi +echo CMake: ${CMAKE_CMD} +${CMAKE_CMD} --version ############################################################################# # defaults diff --git a/c++/src/build-system/cmake/cmake-cfg-vs.bat b/c++/src/build-system/cmake/cmake-cfg-vs.bat index e7b96080..fbdcb944 100644 --- a/c++/src/build-system/cmake/cmake-cfg-vs.bat +++ b/c++/src/build-system/cmake/cmake-cfg-vs.bat @@ -1,7 +1,7 @@ @echo off setlocal ENABLEDELAYEDEXPANSION REM ######################################################################### -REM $Id: cmake-cfg-vs.bat 665658 2023-04-11 13:43:13Z gouriano $ +REM $Id: cmake-cfg-vs.bat 681357 2024-04-08 18:49:00Z ivanov $ REM Configure NCBI C++ toolkit for Visual Studio using CMake build system. REM Author: Andrei Gourianov, gouriano@ncbi REM ######################################################################### @@ -17,11 +17,18 @@ set prebuilds= REM ######################################################################### set VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere" if "%CMAKE_CMD%"=="" ( - for /f "tokens=* USEBACKQ" %%i IN (`%VSWHERE% -latest -property installationPath`) do ( - set CMAKE_CMD=%%i\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe + where cmake >NUL 2>&1 + if errorlevel 1 ( + for /f "tokens=* USEBACKQ" %%i IN (`%VSWHERE% -latest -property installationPath`) do ( + set CMAKE_CMD=%%i\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe + ) + ) else ( + set CMAKE_CMD=cmake ) ) -if not exist "%CMAKE_CMD%" ( +echo CMake: "%CMAKE_CMD%" +"%CMAKE_CMD%" --version +if errorlevel 1 ( echo ERROR: CMake is not found 1>&2 exit /b 1 ) diff --git a/c++/src/build-system/cmake/cmake-cfg-xcode.sh b/c++/src/build-system/cmake/cmake-cfg-xcode.sh index e809e71a..6dfa0371 100755 --- a/c++/src/build-system/cmake/cmake-cfg-xcode.sh +++ b/c++/src/build-system/cmake/cmake-cfg-xcode.sh @@ -1,6 +1,6 @@ #!/bin/sh ############################################################################# -# $Id: cmake-cfg-xcode.sh 665969 2023-04-18 15:34:17Z ucko $ +# $Id: cmake-cfg-xcode.sh 681359 2024-04-08 18:49:39Z ivanov $ # Configure NCBI C++ toolkit for XCode using CMake build system. # Author: Andrei Gourianov, gouriano@ncbi ############################################################################# @@ -13,26 +13,29 @@ extension="cmake_configure_ext.sh" ############################################################################# -CMAKE_PREDEFINED_LOC="/usr/local/bin/cmake /Applications/CMake.app/Contents/bin/cmake /sw/bin/cmake" +CMAKE_PREDEFINED_LOC="/usr/local/bin/cmake /opt/homebrew/bin/cmake" +CMAKE_PREDEFINED_LOC="$CMAKE_PREDEFINED_LOC /Applications/CMake.app/Contents/bin/cmake" +CMAKE_PREDEFINED_LOC="$CMAKE_PREDEFINED_LOC /sw/bin/cmake" if [ -z "${CMAKE_CMD}" ]; then - for i in $CMAKE_PREDEFINED_LOC - do - if test -x $i; then - CMAKE_CMD=$i - break - fi - done + CMAKE_CMD=`which cmake 2>/dev/null` + if test $? -ne 0; then + for i in $CMAKE_PREDEFINED_LOC + do + if test -x $i && $i --version >/dev/null 2>&1; then + CMAKE_CMD=$i + break + fi + done + fi fi -if test ! -x $CMAKE_CMD; then +if test ! -x "${CMAKE_CMD}"; then CMAKE_CMD=`which cmake 2>/dev/null` if test $? -ne 0; then echo ERROR: CMake is not found 1>&2 exit 1 fi fi -echo FOUND CMake: $CMAKE_CMD -$CMAKE_CMD --version ############################################################################# @@ -257,12 +260,12 @@ CMAKE_ARGS="$CMAKE_ARGS -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS" if [ -z "$BUILD_ROOT" ]; then if [ -z "$BUILD_TYPE" ]; then BUILD_ROOT=CMake-${CC_NAME}${CC_VERSION} - if [ "$BUILD_SHARED_LIBS" == "ON" ]; then + if [ "$BUILD_SHARED_LIBS" = "ON" ]; then BUILD_ROOT="$BUILD_ROOT"-DLL fi else BUILD_ROOT=CMake-${CC_NAME}${CC_VERSION}-${BUILD_TYPE} - if [ "$BUILD_SHARED_LIBS" == "ON" ]; then + if [ "$BUILD_SHARED_LIBS" = "ON" ]; then BUILD_ROOT="$BUILD_ROOT"DLL fi fi diff --git a/c++/src/build-system/cmake/conanfile.MSVC.txt b/c++/src/build-system/cmake/conanfile.MSVC.txt index 5c29056d..c7bf19cc 100644 --- a/c++/src/build-system/cmake/conanfile.MSVC.txt +++ b/c++/src/build-system/cmake/conanfile.MSVC.txt @@ -1,8 +1,7 @@ -# $Id: conanfile.MSVC.txt 672961 2023-09-19 13:00:23Z ivanov $ +# $Id: conanfile.MSVC.txt 680579 2024-03-21 18:00:09Z ivanov $ # NCBI C++ Toolkit requirements for Conan/MSVC [requires] -libdb/5.3.28 boost/1.82.0 bzip2/1.0.8 #cassandra-cpp-driver/2.15.3 @@ -18,61 +17,68 @@ libpng/1.6.39 #protobuf/3.21.4 sqlite3/3.42.0 libtiff/4.5.0 -libxml2/2.11.4 +libxml2/2.11.6 libxslt/1.1.34 -libuv/1.45.0 +libuv/1.46.0 zlib/1.2.13 zstd/1.5.5 openssl/1.1.1s -ncbi-vdb/3.0.7 +#internal{ +libdb/5.3.28 +ncbi-vdb/3.1.0 ncbicrypt/20230516 +#} [options] -#ncbi-vdb:shared = True +abseil/*:shared=False +grpc/*:shared=False +protobuf/*:shared=False +boost/*:shared=False +libxml2/*:shared=False +pcre/*:shared=False +ncbicrypt/*:shared=False # -grpc:cpp_plugin = True -grpc:csharp_plugin = False -grpc:node_plugin = False -grpc:objective_c_plugin = False -grpc:php_plugin = False -grpc:python_plugin = False -grpc:ruby_plugin = False +grpc/*:cpp_plugin = True +grpc/*:csharp_plugin = False +grpc/*:node_plugin = False +grpc/*:objective_c_plugin = False +grpc/*:php_plugin = False +grpc/*:python_plugin = False +grpc/*:ruby_plugin = False # -#boost:header_only = True -boost:header_only = False -#boost:without_atomic = True -#boost:without_chrono = True -#boost:without_container = True -#boost:without_context = True -boost:without_contract = True -boost:without_coroutine = True -#boost:without_date_time = True -#boost:without_exception = True -boost:without_fiber = True -#boost:without_filesystem = True -boost:without_graph = True -boost:without_graph_parallel = True -#boost:without_iostreams = True -boost:without_json = True -boost:without_locale = True -boost:without_log = True -boost:without_math = True -boost:without_mpi = True -boost:without_nowide = True -boost:without_program_options = True -boost:without_python = True -#boost:without_random = True -#boost:without_regex = True -#boost:without_serialization = True -boost:without_stacktrace = True -#boost:without_system = True -#boost:without_test = True -#boost:without_thread = True -#boost:without_timer = True -boost:without_type_erasure = True -boost:without_wave = True +#boost/*:header_only = True +boost/*:header_only = False +#boost/*:without_atomic = True +#boost/*:without_chrono = True +#boost/*:without_container = True +#boost/*:without_context = True +boost/*:without_contract = True +boost/*:without_coroutine = True +#boost/*:without_date_time = True +#boost/*:without_exception = True +boost/*:without_fiber = True +#boost/*:without_filesystem = True +boost/*:without_graph = True +boost/*:without_graph_parallel = True +#boost/*:without_iostreams = True +boost/*:without_json = True +boost/*:without_locale = True +boost/*:without_log = True +boost/*:without_math = True +boost/*:without_mpi = True +boost/*:without_nowide = True +boost/*:without_program_options = True +boost/*:without_python = True +#boost/*:without_random = True +#boost/*:without_regex = True +#boost/*:without_serialization = True +boost/*:without_stacktrace = True +#boost/*:without_system = True +#boost/*:without_test = True +#boost/*:without_thread = True +#boost/*:without_timer = True +boost/*:without_type_erasure = True +boost/*:without_wave = True [generators] -#cmake -cmake_find_package -#cmake_find_package_multi +CMakeDeps diff --git a/c++/src/build-system/cmake/conanfile.UNIX.txt b/c++/src/build-system/cmake/conanfile.UNIX.txt index f5e06fc8..48cdd674 100644 --- a/c++/src/build-system/cmake/conanfile.UNIX.txt +++ b/c++/src/build-system/cmake/conanfile.UNIX.txt @@ -1,5 +1,5 @@ -# $Id: conanfile.UNIX.txt 672961 2023-09-19 13:00:23Z ivanov $ +# $Id: conanfile.UNIX.txt 680579 2024-03-21 18:00:09Z ivanov $ # NCBI C++ Toolkit requirements for Conan/UNIX [requires] @@ -21,62 +21,68 @@ libpng/1.6.39 #protobuf/3.21.4 sqlite3/3.42.0 libtiff/4.5.0 -libxml2/2.11.4 +libxml2/2.11.6 libxslt/1.1.34 -libuv/1.45.0 +libuv/1.46.0 zlib/1.2.13 zstd/1.5.5 openssl/1.1.1s -xz_utils/5.4.2 +#internal{ ncbi-fastcgi/2.4.2 -ncbi-vdb/3.0.7 +ncbi-vdb/3.1.0 ncbicrypt/20230516 +#} [options] -libunwind:minidebuginfo=False +libunwind/*:minidebuginfo=False +abseil/*:shared=False +grpc/*:shared=False +protobuf/*:shared=False +ncbicrypt/*:shared=False # -grpc:cpp_plugin = True -grpc:csharp_plugin = False -grpc:node_plugin = False -grpc:objective_c_plugin = False -grpc:php_plugin = False -grpc:python_plugin = False -grpc:ruby_plugin = False +grpc/*:cpp_plugin = True +grpc/*:csharp_plugin = False +grpc/*:node_plugin = False +grpc/*:objective_c_plugin = False +grpc/*:php_plugin = False +grpc/*:python_plugin = False +grpc/*:ruby_plugin = False # -#boost:header_only = True -boost:header_only = False -#boost:without_atomic = True -#boost:without_chrono = True -#boost:without_container = True -#boost:without_context = True -boost:without_contract = True -boost:without_coroutine = True -#boost:without_date_time = True -#boost:without_exception = True -boost:without_fiber = True -#boost:without_filesystem = True -boost:without_graph = True -boost:without_graph_parallel = True -#boost:without_iostreams = True -boost:without_json = True -boost:without_locale = True -boost:without_log = True -boost:without_math = True -boost:without_mpi = True -boost:without_nowide = True -boost:without_program_options = True -boost:without_python = True -#boost:without_random = True -#boost:without_regex = True -#boost:without_serialization = True -boost:without_stacktrace = True -#boost:without_system = True -#boost:without_test = True -#boost:without_thread = True -#boost:without_timer = True -boost:without_type_erasure = True -boost:without_wave = True +#boost/*:header_only = True +boost/*:header_only = False +#boost/*:without_atomic = True +#boost/*:without_chrono = True +#boost/*:without_container = True +#boost/*:without_context = True +boost/*:without_contract = True +boost/*:without_coroutine = True +#boost/*:without_date_time = True +#boost/*:without_exception = True +boost/*:without_fiber = True +#boost/*:without_filesystem = True +boost/*:without_graph = True +boost/*:without_graph_parallel = True +#boost/*:without_iostreams = True +boost/*:without_json = True +boost/*:without_locale = True +boost/*:without_log = True +boost/*:without_math = True +boost/*:without_mpi = True +boost/*:without_nowide = True +boost/*:without_program_options = True +boost/*:without_python = True +#boost/*:without_random = True +#boost/*:without_regex = True +#boost/*:without_serialization = True +boost/*:without_stacktrace = True +#boost/*:without_system = True +#boost/*:without_test = True +#boost/*:without_thread = True +#boost/*:without_timer = True +boost/*:without_type_erasure = True +boost/*:without_wave = True [generators] -#cmake -cmake_find_package +CMakeDeps +#cmake_find_package + diff --git a/c++/src/build-system/cmake/conanfile.XCODE.txt b/c++/src/build-system/cmake/conanfile.XCODE.txt index 473151bc..6bc23916 100644 --- a/c++/src/build-system/cmake/conanfile.XCODE.txt +++ b/c++/src/build-system/cmake/conanfile.XCODE.txt @@ -1,4 +1,4 @@ -# $Id: conanfile.XCODE.txt 672961 2023-09-19 13:00:23Z ivanov $ +# $Id: conanfile.XCODE.txt 680579 2024-03-21 18:00:09Z ivanov $ # NCBI C++ Toolkit requirements for Conan/MacOS [requires] @@ -18,59 +18,65 @@ libpng/1.6.39 #protobuf/3.21.4 sqlite3/3.42.0 libtiff/4.5.0 -libxml2/2.11.4 +libxml2/2.11.6 libxslt/1.1.34 -libuv/1.45.0 +libuv/1.46.0 zlib/1.2.13 zstd/1.5.5 openssl/1.1.1s -ncbi-vdb/3.0.7 +#internal{ +ncbi-vdb/3.1.0 ncbicrypt/20230516 +#} [options] +abseil/*:shared=False +grpc/*:shared=False +protobuf/*:shared=False +ncbicrypt/*:shared=False # -grpc:cpp_plugin = True -grpc:csharp_plugin = False -grpc:node_plugin = False -grpc:objective_c_plugin = False -grpc:php_plugin = False -grpc:python_plugin = False -grpc:ruby_plugin = False +grpc/*:cpp_plugin = True +grpc/*:csharp_plugin = False +grpc/*:node_plugin = False +grpc/*:objective_c_plugin = False +grpc/*:php_plugin = False +grpc/*:python_plugin = False +grpc/*:ruby_plugin = False # -#boost:header_only = True -boost:header_only = False -#boost:without_atomic = True -#boost:without_chrono = True -#boost:without_container = True -#boost:without_context = True -boost:without_contract = True -boost:without_coroutine = True -#boost:without_date_time = True -#boost:without_exception = True -boost:without_fiber = True -#boost:without_filesystem = True -boost:without_graph = True -boost:without_graph_parallel = True -#boost:without_iostreams = True -boost:without_json = True -boost:without_locale = True -boost:without_log = True -boost:without_math = True -boost:without_mpi = True -boost:without_nowide = True -boost:without_program_options = True -boost:without_python = True -#boost:without_random = True -#boost:without_regex = True -#boost:without_serialization = True -boost:without_stacktrace = True -#boost:without_system = True -#boost:without_test = True -#boost:without_thread = True -#boost:without_timer = True -boost:without_type_erasure = True -boost:without_wave = True +#boost/*:header_only = True +boost/*:header_only = False +#boost/*:without_atomic = True +#boost/*:without_chrono = True +#boost/*:without_container = True +#boost/*:without_context = True +boost/*:without_contract = True +boost/*:without_coroutine = True +#boost/*:without_date_time = True +#boost/*:without_exception = True +boost/*:without_fiber = True +#boost/*:without_filesystem = True +boost/*:without_graph = True +boost/*:without_graph_parallel = True +#boost/*:without_iostreams = True +boost/*:without_json = True +boost/*:without_locale = True +boost/*:without_log = True +boost/*:without_math = True +boost/*:without_mpi = True +boost/*:without_nowide = True +boost/*:without_program_options = True +boost/*:without_python = True +#boost/*:without_random = True +#boost/*:without_regex = True +#boost/*:without_serialization = True +boost/*:without_stacktrace = True +#boost/*:without_system = True +#boost/*:without_test = True +#boost/*:without_thread = True +#boost/*:without_timer = True +boost/*:without_type_erasure = True +boost/*:without_wave = True [generators] -#cmake -cmake_find_package +CMakeDeps +#cmake_find_package diff --git a/c++/src/build-system/cmake/conanfile.py b/c++/src/build-system/cmake/conanfile.py new file mode 100644 index 00000000..2785e33d --- /dev/null +++ b/c++/src/build-system/cmake/conanfile.py @@ -0,0 +1,113 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration, ConanException +from conan.tools.build import check_min_cppstd +import subprocess + +class NCBIToolkitWithConanRecipe(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps" + + @property + def _min_cppstd(self): + return 17 + + def configure(self): + self.options["abseil/*"].shared = False + self.options["grpc/*"].shared = False + self.options["protobuf/*"].shared = False + self.options["boost/*"].shared = False + self.options["libxml2/*"].shared = False + self.options["pcre/*"].shared = False + self.options["ncbicrypt/*"].shared = False +# + self.options["grpc/*"].cpp_plugin = True + self.options["grpc/*"].csharp_plugin = False + self.options["grpc/*"].node_plugin = False + self.options["grpc/*"].objective_c_plugin = False + self.options["grpc/*"].php_plugin = False + self.options["grpc/*"].python_plugin = False + self.options["grpc/*"].ruby_plugin = False +# +#boost/*:header_only = True + self.options["boost/*"].header_only = False +#boost/*:without_atomic = True +#boost/*:without_chrono = True +#boost/*:without_container = True +#boost/*:without_context = True + self.options["boost/*"].without_contract = True + self.options["boost/*"].without_coroutine = True +#boost/*:without_date_time = True +#boost/*:without_exception = True + self.options["boost/*"].without_fiber = True +#boost/*:without_filesystem = True + self.options["boost/*"].without_graph = True + self.options["boost/*"].without_graph_parallel = True +#boost/*:without_iostreams = True + self.options["boost/*"].without_json = True + self.options["boost/*"].without_locale = True + self.options["boost/*"].without_log = True + self.options["boost/*"].without_math = True + self.options["boost/*"].without_mpi = True + self.options["boost/*"].without_nowide = True + self.options["boost/*"].without_program_options = True + self.options["boost/*"].without_python = True +#boost/*:without_random = True +#boost/*:without_regex = True +#boost/*:without_serialization = True + self.options["boost/*"].without_stacktrace = True +#boost/*:without_system = True +#boost/*:without_test = True +#boost/*:without_thread = True +#boost/*:without_timer = True + self.options["boost/*"].without_type_erasure = True + self.options["boost/*"].without_wave = True + + def requirements(self): + res = subprocess.run(["conan", "remote", "list"], + stdout = subprocess.PIPE, universal_newlines = True, encoding="utf-8") + pos = res.stdout.find("ncbi.nlm.nih.gov") + NCBIfound = pos > 0 + if NCBIfound: + print("NCBI artifactory is found") + else: + print("NCBI artifactory is not found") + + if self.settings.os == "Linux": + self.requires("backward-cpp/1.6") + self.requires("boost/1.82.0") + self.requires("bzip2/1.0.8") + if self.settings.os == "Linux": + self.requires("cassandra-cpp-driver/2.15.3") + self.requires("giflib/5.2.1") + self.requires("grpc/1.50.1") + if self.settings.os == "Linux" or NCBIfound: + self.requires("libdb/5.3.28") + self.requires("libjpeg/9e") + self.requires("libnghttp2/1.54.0") + self.requires("libpng/1.6.39") + self.requires("libtiff/4.5.0") + if self.settings.os == "Linux": + self.requires("libunwind/1.8.0") + self.requires("libuv/1.46.0") + self.requires("libxml2/2.11.6") + self.requires("libxslt/1.1.34") + self.requires("lmdb/0.9.29") + self.requires("lzo/2.10") + self.requires("openssl/1.1.1s") + self.requires("pcre/8.45") + self.requires("sqlite3/3.42.0") + self.requires("zlib/[>=1.2.11 <2]") + self.requires("zstd/1.5.5") + + if NCBIfound: + self.requires("ncbicrypt/20230516") + if self.settings.os == "Linux": + self.requires("ncbi-fastcgi/2.4.2") + self.requires("ncbi-vdb/3.1.0") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + if self.settings.os not in ["Linux", "Macos", "Windows"]: + raise ConanInvalidConfiguration("This operating system is not supported") + diff --git a/c++/src/build-system/cmake/toolchains/x86_64-linux-gcc-1320.cmake b/c++/src/build-system/cmake/toolchains/x86_64-linux-gcc-1320.cmake new file mode 100644 index 00000000..6aaebb28 --- /dev/null +++ b/c++/src/build-system/cmake/toolchains/x86_64-linux-gcc-1320.cmake @@ -0,0 +1,37 @@ +############################################################################# +# $Id: x86_64-linux-gcc-1320.cmake 676943 2023-12-29 20:11:12Z sadyrovr $ +############################################################################# +############################################################################# +## +## NCBI CMake wrapper +## GCC 13.2.0 toolchain + +set(NCBI_PTBCFG_FLAGS_DEFINED YES) +include_guard(GLOBAL) + +set(CMAKE_C_COMPILER "/opt/ncbi/gcc/13.2.0/bin/gcc") +set(CMAKE_CXX_COMPILER "/opt/ncbi/gcc/13.2.0/bin/g++") + +set(CMAKE_C_FLAGS_INIT "-gdwarf-4 -Wall -Wno-format-y2k") +set(CMAKE_C_FLAGS_DEBUG "-ggdb3 -O0") +set(CMAKE_C_FLAGS_RELEASE "-ggdb1 -O3") +set(CMAKE_C_FLAGS_RELWITHDEBINFO "-ggdb3 -O3") + +set(CMAKE_CXX_FLAGS_INIT "-gdwarf-4 -Wall -Wno-format-y2k") +set(CMAKE_CXX_FLAGS_DEBUG "-ggdb3 -O0") +set(CMAKE_CXX_FLAGS_RELEASE "-ggdb1 -O3") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-ggdb3 -O3") + +set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--enable-new-dtags -Wl,--as-needed") +set(CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,--no-undefined -Wl,--as-needed") + +#---------------------------------------------------------------------------- +set(NCBI_COMPILER_FLAGS_SSE "-msse4.2") + +set(NCBI_COMPILER_FLAGS_COVERAGE "--coverage") +set(NCBI_LINKER_FLAGS_COVERAGE "--coverage") + +set(NCBI_COMPILER_FLAGS_MAXDEBUG "-fsanitize=address -fstack-check") +set(NCBI_LINKER_FLAGS_MAXDEBUG "-fsanitize=address") + +set(NCBI_LINKER_FLAGS_STATICCOMPONENTS "-static-libgcc -static-libstdc++") diff --git a/c++/src/build-system/config.site.ncbi b/c++/src/build-system/config.site.ncbi index 56ec3e94..1380fede 100644 --- a/c++/src/build-system/config.site.ncbi +++ b/c++/src/build-system/config.site.ncbi @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: config.site.ncbi 672960 2023-09-19 12:44:45Z ivanov $ +# $Id: config.site.ncbi 683737 2024-06-04 12:00:41Z ivanov $ # Note default paths to third-party libraries, whose location and even # presence varies somewhat from platform to platform. @@ -172,11 +172,7 @@ esac : ${BACKWARD_CPP_PATH=$NCBI/backward-cpp-1.6-ncbi1} -case "$ncbi_platform" in - FreeBSD* ) : ${BERKELEYDB_PATH=$NCBI/BerkeleyDB-4.6.21.1} ;; - Linux* ) : ${BERKELEYDB_PATH=$NCBI/BerkeleyDB-4.6.21.1} ;; - *MAC ) : ${BERKELEYDB_PATH=$NCBI/BerkeleyDB-4.5.20} ;; -esac +: ${BERKELEYDB_PATH=$NCBI/BerkeleyDB-5.3.28-ncbi1} : ${BOOST_PATH=$NCBI/boost-1.76.0-ncbi1} @@ -184,7 +180,7 @@ esac : ${CEREAL_PATH=$NCBI/cereal-1.3.0} -: ${CPPKAFKA_PATH=$NCBI/cppkafka-0.3.1+boost-1.76} +: ${CPPKAFKA_PATH=$NCBI/cppkafka-0.3.1+rdkafka-2.3.0} : ${CRC32C_PATH=$NCBI/crc32c-1.1.2} @@ -224,7 +220,7 @@ esac case "$ncbi_platform" in Linux64 ) : ${GMP_PATH=$NCBI/gmp-6.0.0a} ;; - *MAC ) : ${GMP_PATH=$NCBI/gmp-6.0.0a} ;; + *MAC ) : ${GMP_PATH=$NCBI/gmp-6.3.0} ;; esac # NB: now used only when explicitly configured --with-gnutls @@ -259,7 +255,7 @@ esac : ${LEVELDB_PATH=$NCBI/leveldb-1.21} -: ${LIBRDKAFKA_PATH=$NCBI/librdkafka-1.5.0} +: ${LIBRDKAFKA_PATH=$NCBI/librdkafka-2.3.0} : ${LIBSSH2_PATH=$NCBI/libssh2-1.7.0} @@ -287,13 +283,13 @@ case "$ncbi_platform" in * ) : ${LZO_PATH=$NCBI/lzo-2.05} ;; esac -: ${MBEDTLS_PATH=$NCBI/mbedtls-2.28.3} +: ${MBEDTLS_PATH=$NCBI/mbedtls-2.28.8} : ${MIMETIC_PATH=$NCBI/mimetic-0.9.8-ncbi1} : ${MONGODB_PATH=$NCBI/mongodb-1.1.2} -: ${MONGODB3_PATH=$NCBI/mongodb-3.6.3} +: ${MONGODB3_PATH=$NCBI/mongodb-3.7.0} : ${MSGSL_PATH=$NCBI/msgsl-0.0.20171114-1c95f94} @@ -307,7 +303,7 @@ case "$ncbi_platform" in esac # C Toolkit (path overridden in stable components to avoid version skew) -: ${NCBI_C_PATH=$NCBI} +: ${NCBI_C_PATH=$NCBI/c++.by-date/production/20231209/C_TOOLKIT} : ${NCBICRYPT_PATH=$NCBI/ncbicrypt-20230516} @@ -319,7 +315,7 @@ esac : ${NGHTTP2_PATH=$NCBI/nghttp2-1.40.0} net_ngs_base=/net/snowman/vol/projects/trace_software/ngs/ngs-versions -: ${NGS_PATH=$net_ngs_base/3.0.7} +: ${NGS_PATH=$net_ngs_base/3.1.1} : ${NLOHMANN_JSON_PATH=$NCBI/nlohmann-json-3.9.1} @@ -380,15 +376,15 @@ case "$ncbi_platform" in # with_vdb=$local_vdb_base/cxx_toolkit/3 with_vdb=$net_vdb_base/cxx_toolkit/3-rc else - : ${VDB_PATH=$local_vdb_base/3.0.7} + : ${VDB_PATH=$local_vdb_base/3.1.1} fi : ${with_downloaded_vdb=no} ;; - IntelMAC ) + *MAC ) if [ "x$with_vdb" = 'xrc' ]; then with_vdb=$net_vdb_base/cxx_toolkit/3-rc else - : ${VDB_PATH=$net_vdb_base/3.0.7} + : ${VDB_PATH=$net_vdb_base/3.1.1} fi : ${with_downloaded_vdb=no} ;; diff --git a/c++/src/build-system/configure b/c++/src/build-system/configure index 704ecb6d..f3d5131a 100755 --- a/c++/src/build-system/configure +++ b/c++/src/build-system/configure @@ -27743,9 +27743,9 @@ $as_echo "$as_me: WARNING: $message" >&2;} ;; case "$host_os:$host_cpu:$bit64_sfx" in darwin*:*86*:64 ) vdb_libpath=mac/$vdb_mode/x86_64/lib ;; darwin*:*86*:* ) vdb_libpath=mac/$vdb_mode/fat86/lib ;; - darwin*:arm* ) vdb_libpath=mac/$vdb_mode/aarch64/lib ;; + darwin*:arm* ) vdb_libpath=mac/$vdb_mode/arm64/lib ;; linux*:*86*:64 ) vdb_libpath=linux/$vdb_mode/x86_64/lib ;; - linux*:aarch64* ) vdb_libpath=linux/$vdb_mode/aarch64/lib ;; + linux*:aarch64* ) vdb_libpath=linux/$vdb_mode/arm64/lib ;; * ) if test -n "$with_vdb"; then as_fn_error $? "--with-vdb explicitly specified, @@ -27898,6 +27898,7 @@ if test "$with_ngs" != "no" ; then case "$host_cpu:$bit64_sfx" in *86*:64 ) extra_inc="-I$NGS_PATH/include/ngs/unix/x86_64" ;; *86*:* ) extra_inc="-I$NGS_PATH/include/ngs/unix/fat86" ;; + a*:64 ) extra_inc="-I$NGS_PATH/include/ngs/unix/arm64" ;; * ) extra_inc='' ;; esac NGS_INCLUDE="$NGS_INCLUDE $extra_inc" @@ -34079,7 +34080,7 @@ if test -n "$D_SFX"; then if ls $PROTOBUF_PATH/lib*/libprotobuf$D_SFX.* >/dev/null 2>&1; then PROTOBUF_SFX=$D_SFX else - for ext in .a .so .dylib; do + for ext in a so dylib; do path=`$CXX -B$PROTOBUF_PATH/ -print-file-name=libprotobuf$D_SFX.$ext \ 2>/dev/null` case "$path" in @@ -34088,6 +34089,64 @@ if test -n "$D_SFX"; then done fi fi +pb_pc=pkg-config +if test -n "$PROTOBUF_PATH"; then + for d in "$PROTOBUF_PATH/lib$bit64_sfx" "$PROTOBUF_PATH/lib"; do + if test -d "$d/pkgconfig"; then + pb_pc="env PKG_CONFIG_PATH=$d/pkgconfig pkg-config" + break + fi + done +fi +if $pb_pc protobuf --modversion 2>/dev/null; then + # Avoid a hang observed with pkg-config 0.27.1 (as on CentOS 7) + # and post-2022 Abseil versions. + case "`$pb_pc --version`:`$pb_pc protobuf --modversion`" in + 0.2[89]* | 0.[3-9][0-9]* | 0.[1-9][0-9][0-9]* | [1-9]* \ + | *:20[01]* | *:202[0-2]* ) + pb_sed="s/\$/ /; s/\(-lprotobuf\) /\1$PROTOBUF_SFX /; s/ \$//" + PROTOBUF_CONFIG_LIBS="`$pb_pc protobuf --libs | sed -e \"$pb_sed\"`" + ;; + * ) + pb_pc= + ;; + esac +else + pb_pc= +fi +if test -z "$pb_pc"; then + PROTOBUF_CONFIG_LIBS=-lprotobuf$PROTOBUF_SFX + for l in absl_log_internal_check_op absl_leak_check absl_die_if_null \ + absl_log_internal_conditions absl_log_internal_message \ + absl_examine_stack absl_log_internal_format \ + absl_log_internal_proto absl_log_internal_nullguard \ + absl_log_internal_log_sink_set absl_log_sink absl_log_entry \ + absl_flags absl_flags_internal absl_flags_marshalling \ + absl_flags_reflection absl_flags_private_handle_accessor \ + absl_flags_commandlineflag absl_flags_commandlineflag_internal \ + absl_flags_config absl_flags_program_name absl_log_initialize \ + absl_log_globals absl_log_internal_globals absl_raw_hash_set \ + absl_hash absl_city absl_low_level_hash absl_hashtablez_sampler \ + absl_statusor absl_status absl_cord absl_cordz_info \ + absl_cord_internal absl_cordz_functions absl_exponential_biased \ + absl_cordz_handle absl_crc_cord_state absl_crc32c \ + absl_crc_internal absl_crc_cpu_detect absl_bad_optional_access \ + absl_str_format_internal absl_strerror absl_synchronization \ + absl_graphcycles_internal absl_kernel_timeout_internal \ + absl_stacktrace absl_symbolize absl_debugging_internal \ + absl_demangle_internal absl_malloc_internal absl_time \ + absl_civil_time absl_time_zone absl_bad_variant_access \ + utf8_validity utf8_range absl_strings absl_string_view \ + absl_strings_internal absl_base absl_spinlock_wait absl_int128 \ + absl_throw_delegate absl_raw_logging_internal absl_log_severity + do + if test -f $PROTOBUF_PATH/lib${bit64_sfx}/lib$l.a \ + -o -f $PROTOBUF_PATH/lib/lib$l.a; then + PROTOBUF_CONFIG_LIBS="$PROTOBUF_CONFIG_LIBS -l$l" + fi + done +fi + if test "$with_protobuf" != "no"; then case "$PROTOBUF_PATH:$with_protobuf" in *:yes | *: | $with_protobuf* ) ;; @@ -34163,10 +34222,10 @@ if test "$with_protobuf" != "no"; then PROTOBUF_LIBPATH="${ncbi_rp_L_flags}${ncbi_rp_R_flags}" fi fi - PROTOBUF_LIBS="$PROTOBUF_LIBPATH -lprotobuf$PROTOBUF_SFX " + PROTOBUF_LIBS="$PROTOBUF_LIBPATH -lprotobuf$PROTOBUF_SFX $PROTOBUF_CONFIG_LIBS" else PROTOBUF_INCLUDE="" - PROTOBUF_LIBS="-lprotobuf$PROTOBUF_SFX " + PROTOBUF_LIBS="-lprotobuf$PROTOBUF_SFX $PROTOBUF_CONFIG_LIBS" in_path= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libprotobuf$PROTOBUF_SFX$in_path" >&5 @@ -34278,26 +34337,56 @@ grpc_pc=pkg-config if test -n "$GRPC_PATH"; then for d in "$GRPC_PATH/lib$bit64_sfx" "$GRPC_PATH/lib"; do if test -d "$d/pkgconfig"; then - grpc_pc="env PKG_CONFIG_PATH=$d/pkgconfig pkg-config" + if test -n "$pb_pc" -a "$GRPC_PATH" != "$PROTOBUF_PATH"; then + grpc_pc="`echo $pb_pc | sed -e \"s,=,=$d:,\"`" + else + grpc_pc="env PKG_CONFIG_PATH=$d/pkgconfig pkg-config" + fi break fi done fi -if $grpc_pc grpc++ --exists 2>/dev/null; then - GRPC_SED=sed +if test -n "$pb_pc" && $grpc_pc grpc++ --exists 2>/dev/null; then + grpc_b_flags=`$grpc_pc grpc++ --libs-only-L | sed -e 's/^/ /; s/ -L/ -B/'` + if test \! -f "`$CXX $grpc_b_flags -print-file-name=libgrpc++.so \ + 2>/dev/null`" \ + -a \! -f "`$CXX $grpc_b_flags -print-file-name=libgrpc++.dylib \ + 2>/dev/null`"; then + grpc_pc="$grpc_pc --static" + fi + GRPC_SED="sed -e \"$pb_sed\"" if test -f "$GRPC_PATH/lib/libboringssl.a"; then - GRPC_SED="sed -e s/-lssl/-lboringssl/g -e s/-lcrypto/-lboringcrypto/g" + GRPC_SED="$GRPC_SED -e s/-lssl/-lboringssl/g" + GRPC_SED="$GRPC_SED -e s/-lcrypto/-lboringcrypto/g" fi if test -f /usr/lib/libssl.dylib -a \ x"`$grpc_pc grpc++ --variable=prefix`" != x/sw; then GRPC_SED="$GRPC_SED -e s,-L/sw/lib,," fi - if test "$GRPC_SED" = sed; then - GRPC_SED=cat - fi - GRPC_CONFIG_LIBS="`$grpc_pc grpc++ grpc --libs | $GRPC_SED`" -else - GRPC_CONFIG_LIBS= + GRPC_CONFIG_LIBS="`$grpc_pc grpc++ grpc protobuf --libs | eval $GRPC_SED`" +else + grpc_pc= + GRPC_CONFIG_LIBS="-lgrpc -lgpr" + if test "$PROTOBUF_PATH" != "$GRPC_PATH"; then + GRPC_CONFIG_LIBS="$GRPC_CONFIG_LIBS $PROTOBUF_LIBPATH" + fi + for l in address_sorting upb upb_textformat_lib upb_json_lib \ + upb_collections_lib utf8_range_lib absl_random_distributions \ + absl_random_seed_sequences absl_random_internal_pool_urbg \ + absl_random_internal_randen absl_random_internal_randen_hwaes \ + absl_random_internal_randen_hwaes_impl \ + absl_random_internal_randen_slow absl_random_internal_platform \ + absl_random_internal_seed_material absl_random_seed_gen_exception + do + if test -f $GRPC_PATH/lib${bit64_sfx}/lib$l.a \ + -o -f $GRPC_PATH/lib/lib$l.a \ + -o -f $PROTOBUF_PATH/lib${bit64_sfx}/lib$l.a \ + -o -f $PROTOBUF_PATH/lib/lib$l.a; then + GRPC_CONFIG_LIBS="$GRPC_CONFIG_LIBS -l$l" + fi + done + GRPC_CONFIG_LIBS="$GRPC_CONFIG_LIBS $PROTOBUF_CONFIG_LIBS" + if test -n "$GRPC_PATH"; then in_path=" in $GRPC_PATH" CPPFLAGS="-I$GRPC_PATH/include $orig_CPPFLAGS" @@ -34329,6 +34418,37 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext + if test -n "$GRPC_PATH"; then + LIBS="$PROTOBUF_LIBPATH -L$GRPC_PATH/lib$bit64_sfx -L$GRPC_PATH/lib -lre2" + LIBS="$LIBS $orig_LIBS" + else + LIBS="-lre2 $orig_LIBS" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libre2$in_path" >&5 +$as_echo_n "checking for libre2$in_path... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +re2::RE2 rx("foo"); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + RE2_LIBS=-lre2; { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + RE2_LIBS=; { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + GRPC_CONFIG_LIBS="$GRPC_CONFIG_LIBS $CARES_LIBS $RE2_LIBS" + if test -f "$GRPC_PATH/lib/libboringssl.a"; then GRPC_LDEP="-lboringssl -lboringcrypto" else @@ -34472,62 +34592,27 @@ $as_echo "#define HAVE_LIBGRPC 1" >>confdefs.h if test -n "$GRPC_LIBS"; then - if test -n "$GRPC_CONFIG_LIBS"; then - GRPC_LIBS="$GRPC_CONFIG_LIBS $PROTOBUF_LIBS $GRPC_LDEP" - GRPC_UNSECURE_LIBS="`$grpc_pc grpc++_unsecure grpc_unsecure --libs`" - for x in address_sorting upb cares; do - case " $GRPC_LIBS ::: $GRPC_UNSECURE_LIBS " in - *:::*" -l$x "* ) ;; - *" -l$x "* ) GRPC_UNSECURE_LIBS="$GRPC_UNSECURE_LIBS -l$x" ;; + if test -n "$grpc_pc"; then + GRPC_UNSECURE_LIBS="`$grpc_pc grpc++_unsecure grpc_unsecure protobuf \ + --libs`" + else + GRPC_LIBS="$GRPC_LIBPATH -lgrpc++ $GRPC_CONFIG_LIBS $GRPC_LDEP" + GRPC_UNSECURE_LIBS= + sep= + for x in $GRPC_LIBS; do + case "$x" in + -lgrpc* ) + GRPC_UNSECURE_LIBS="$GRPC_UNSECURE_LIBS$sep${x}_unsecure" + sep=' ' + ;; + -lboring* | -lssl | -lcrypto ) + ;; + * ) + GRPC_UNSECURE_LIBS="$GRPC_UNSECURE_LIBS $x" + sep=' ' + ;; esac done - GRPC_UNSECURE_LIBS="$GRPC_UNSECURE_LIBS $PROTOBUF_LIBS $GRPC_LDEP" - else - LDFLAGS="$orig_LDFLAGS $GRPC_LIBPATH" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for address_sorting_rfc_6724_sort in -laddress_sorting" >&5 -$as_echo_n "checking for address_sorting_rfc_6724_sort in -laddress_sorting... " >&6; } -if ${ac_cv_lib_address_sorting_address_sorting_rfc_6724_sort+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-laddress_sorting $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char address_sorting_rfc_6724_sort (); -int -main () -{ -return address_sorting_rfc_6724_sort (); - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - ac_cv_lib_address_sorting_address_sorting_rfc_6724_sort=yes -else - ac_cv_lib_address_sorting_address_sorting_rfc_6724_sort=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_address_sorting_address_sorting_rfc_6724_sort" >&5 -$as_echo "$ac_cv_lib_address_sorting_address_sorting_rfc_6724_sort" >&6; } -if test "x$ac_cv_lib_address_sorting_address_sorting_rfc_6724_sort" = x""yes; then : - GRPC_LIBS="$GRPC_LIBS -laddress_sorting" -fi - - LDFLAGS=$orig_LDFLAGS - GRPC_UNSECURE_LIBS=`echo $GRPC_LIBS \ - | sed -e 's/\(-lgrpc+*\)/\1_unsecure/g'` - GRPC_LIBS="$GRPC_LIBS $GRPC_LDEP" fi GRPC_REFLECTION_LIBS="$WHOLE_ARCHIVE $NO_AS_NEEDED $GRPC_LIBPATH" GRPC_REFLECTION_LIBS="$GRPC_REFLECTION_LIBS -lgrpc++_reflection" diff --git a/c++/src/build-system/configure.ac b/c++/src/build-system/configure.ac index 07375eee..8b845ceb 100644 --- a/c++/src/build-system/configure.ac +++ b/c++/src/build-system/configure.ac @@ -1,5 +1,5 @@ ############################################################################# -# $Id: configure.ac 671133 2023-08-08 19:52:02Z ivanov $ +# $Id: configure.ac 679451 2024-02-26 14:44:28Z ivanov $ # Derived from configure.in version 1.173. # ========================================================================== # @@ -7767,9 +7767,9 @@ if test "$with_vdb" != "no" ; then case "$host_os:$host_cpu:$bit64_sfx" in darwin*:*86*:64 ) vdb_libpath=mac/$vdb_mode/x86_64/lib ;; darwin*:*86*:* ) vdb_libpath=mac/$vdb_mode/fat86/lib ;; - darwin*:arm* ) vdb_libpath=mac/$vdb_mode/aarch64/lib ;; + darwin*:arm* ) vdb_libpath=mac/$vdb_mode/arm64/lib ;; linux*:*86*:64 ) vdb_libpath=linux/$vdb_mode/x86_64/lib ;; - linux*:aarch64* ) vdb_libpath=linux/$vdb_mode/aarch64/lib ;; + linux*:aarch64* ) vdb_libpath=linux/$vdb_mode/arm64/lib ;; * ) if test -n "$with_vdb"; then AC_MSG_ERROR([--with-vdb explicitly specified, @@ -7862,6 +7862,7 @@ if test "$with_ngs" != "no" ; then case "$host_cpu:$bit64_sfx" in *86*:64 ) extra_inc="-I$NGS_PATH/include/ngs/unix/x86_64" ;; *86*:* ) extra_inc="-I$NGS_PATH/include/ngs/unix/fat86" ;; + a*:64 ) extra_inc="-I$NGS_PATH/include/ngs/unix/arm64" ;; * ) extra_inc='' ;; esac NGS_INCLUDE="$NGS_INCLUDE $extra_inc" @@ -8769,7 +8770,7 @@ if test -n "$D_SFX"; then if ls $PROTOBUF_PATH/lib*/libprotobuf$D_SFX.* >/dev/null 2>&1; then PROTOBUF_SFX=$D_SFX else - for ext in .a .so .dylib; do + for ext in a so dylib; do path=`$CXX -B$PROTOBUF_PATH/ -print-file-name=libprotobuf$D_SFX.$ext \ 2>/dev/null` case "$path" in @@ -8778,10 +8779,68 @@ if test -n "$D_SFX"; then done fi fi +pb_pc=pkg-config +if test -n "$PROTOBUF_PATH"; then + for d in "$PROTOBUF_PATH/lib$bit64_sfx" "$PROTOBUF_PATH/lib"; do + if test -d "$d/pkgconfig"; then + pb_pc="env PKG_CONFIG_PATH=$d/pkgconfig pkg-config" + break + fi + done +fi +if $pb_pc protobuf --modversion 2>/dev/null; then + # Avoid a hang observed with pkg-config 0.27.1 (as on CentOS 7) + # and post-2022 Abseil versions. + case "`$pb_pc --version`:`$pb_pc protobuf --modversion`" in + 0.2[[89]]* | 0.[[3-9]][[0-9]]* | 0.[[1-9]][[0-9]][[0-9]]* | [[1-9]]* \ + | *:20[[01]]* | *:202[[0-2]]* ) + pb_sed="s/\$/ /; s/\(-lprotobuf\) /\1$PROTOBUF_SFX /; s/ \$//" + PROTOBUF_CONFIG_LIBS="`$pb_pc protobuf --libs | sed -e \"$pb_sed\"`" + ;; + * ) + pb_pc= + ;; + esac +else + pb_pc= +fi +if test -z "$pb_pc"; then + PROTOBUF_CONFIG_LIBS=-lprotobuf$PROTOBUF_SFX + for l in absl_log_internal_check_op absl_leak_check absl_die_if_null \ + absl_log_internal_conditions absl_log_internal_message \ + absl_examine_stack absl_log_internal_format \ + absl_log_internal_proto absl_log_internal_nullguard \ + absl_log_internal_log_sink_set absl_log_sink absl_log_entry \ + absl_flags absl_flags_internal absl_flags_marshalling \ + absl_flags_reflection absl_flags_private_handle_accessor \ + absl_flags_commandlineflag absl_flags_commandlineflag_internal \ + absl_flags_config absl_flags_program_name absl_log_initialize \ + absl_log_globals absl_log_internal_globals absl_raw_hash_set \ + absl_hash absl_city absl_low_level_hash absl_hashtablez_sampler \ + absl_statusor absl_status absl_cord absl_cordz_info \ + absl_cord_internal absl_cordz_functions absl_exponential_biased \ + absl_cordz_handle absl_crc_cord_state absl_crc32c \ + absl_crc_internal absl_crc_cpu_detect absl_bad_optional_access \ + absl_str_format_internal absl_strerror absl_synchronization \ + absl_graphcycles_internal absl_kernel_timeout_internal \ + absl_stacktrace absl_symbolize absl_debugging_internal \ + absl_demangle_internal absl_malloc_internal absl_time \ + absl_civil_time absl_time_zone absl_bad_variant_access \ + utf8_validity utf8_range absl_strings absl_string_view \ + absl_strings_internal absl_base absl_spinlock_wait absl_int128 \ + absl_throw_delegate absl_raw_logging_internal absl_log_severity + do + if test -f $PROTOBUF_PATH/lib${bit64_sfx}/lib$l.a \ + -o -f $PROTOBUF_PATH/lib/lib$l.a; then + PROTOBUF_CONFIG_LIBS="$PROTOBUF_CONFIG_LIBS -l$l" + fi + done +fi + NCBI_CHECK_THIRD_PARTY_LIB_EX(protobuf, PROTOBUF, [protobuf$PROTOBUF_SFX], [AC_LANG_PROGRAM([[@%:@include ]], [[google::protobuf::Type t;]])], - [], [$Z_LIBS]) + [$PROTOBUF_CONFIG_LIBS], [$Z_LIBS]) if test -n "$PROTOBUF_LIBS"; then AC_PATH_PROG(PROTOC, protoc, [], [$PROTOBUF_PATH/bin:$PATH]) if test ! -x "$PROTOC"; then @@ -8797,26 +8856,56 @@ grpc_pc=pkg-config if test -n "$GRPC_PATH"; then for d in "$GRPC_PATH/lib$bit64_sfx" "$GRPC_PATH/lib"; do if test -d "$d/pkgconfig"; then - grpc_pc="env PKG_CONFIG_PATH=$d/pkgconfig pkg-config" + if test -n "$pb_pc" -a "$GRPC_PATH" != "$PROTOBUF_PATH"; then + grpc_pc="`echo $pb_pc | sed -e \"s,=,=$d:,\"`" + else + grpc_pc="env PKG_CONFIG_PATH=$d/pkgconfig pkg-config" + fi break fi done fi -if $grpc_pc grpc++ --exists 2>/dev/null; then - GRPC_SED=sed +if test -n "$pb_pc" && $grpc_pc grpc++ --exists 2>/dev/null; then + grpc_b_flags=`$grpc_pc grpc++ --libs-only-L | sed -e 's/^/ /; s/ -L/ -B/'` + if test \! -f "`$CXX $grpc_b_flags -print-file-name=libgrpc++.so \ + 2>/dev/null`" \ + -a \! -f "`$CXX $grpc_b_flags -print-file-name=libgrpc++.dylib \ + 2>/dev/null`"; then + grpc_pc="$grpc_pc --static" + fi + GRPC_SED="sed -e \"$pb_sed\"" if test -f "$GRPC_PATH/lib/libboringssl.a"; then - GRPC_SED="sed -e s/-lssl/-lboringssl/g -e s/-lcrypto/-lboringcrypto/g" + GRPC_SED="$GRPC_SED -e s/-lssl/-lboringssl/g" + GRPC_SED="$GRPC_SED -e s/-lcrypto/-lboringcrypto/g" fi if test -f /usr/lib/libssl.dylib -a \ x"`$grpc_pc grpc++ --variable=prefix`" != x/sw; then GRPC_SED="$GRPC_SED -e s,-L/sw/lib,," fi - if test "$GRPC_SED" = sed; then - GRPC_SED=cat - fi - GRPC_CONFIG_LIBS="`$grpc_pc grpc++ grpc --libs | $GRPC_SED`" + GRPC_CONFIG_LIBS="`$grpc_pc grpc++ grpc protobuf --libs | eval $GRPC_SED`" else - GRPC_CONFIG_LIBS= + grpc_pc= + GRPC_CONFIG_LIBS="-lgrpc -lgpr" + if test "$PROTOBUF_PATH" != "$GRPC_PATH"; then + GRPC_CONFIG_LIBS="$GRPC_CONFIG_LIBS $PROTOBUF_LIBPATH" + fi + for l in address_sorting upb upb_textformat_lib upb_json_lib \ + upb_collections_lib utf8_range_lib absl_random_distributions \ + absl_random_seed_sequences absl_random_internal_pool_urbg \ + absl_random_internal_randen absl_random_internal_randen_hwaes \ + absl_random_internal_randen_hwaes_impl \ + absl_random_internal_randen_slow absl_random_internal_platform \ + absl_random_internal_seed_material absl_random_seed_gen_exception + do + if test -f $GRPC_PATH/lib${bit64_sfx}/lib$l.a \ + -o -f $GRPC_PATH/lib/lib$l.a \ + -o -f $PROTOBUF_PATH/lib${bit64_sfx}/lib$l.a \ + -o -f $PROTOBUF_PATH/lib/lib$l.a; then + GRPC_CONFIG_LIBS="$GRPC_CONFIG_LIBS -l$l" + fi + done + GRPC_CONFIG_LIBS="$GRPC_CONFIG_LIBS $PROTOBUF_CONFIG_LIBS" + if test -n "$GRPC_PATH"; then in_path=" in $GRPC_PATH" CPPFLAGS="-I$GRPC_PATH/include $orig_CPPFLAGS" @@ -8830,7 +8919,21 @@ else [AC_LANG_PROGRAM([@%:@include ], [ares_library_init(0);])], [CARES_LIBS=-lcares; AC_MSG_RESULT([yes])], [CARES_LIBS=; AC_MSG_RESULT([no])]) - + + if test -n "$GRPC_PATH"; then + LIBS="$PROTOBUF_LIBPATH -L$GRPC_PATH/lib$bit64_sfx -L$GRPC_PATH/lib -lre2" + LIBS="$LIBS $orig_LIBS" + else + LIBS="-lre2 $orig_LIBS" + fi + AC_MSG_CHECKING([for libre2$in_path]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([@%:@include ], [re2::RE2 rx("foo");])], + [RE2_LIBS=-lre2; AC_MSG_RESULT([yes])], + [RE2_LIBS=; AC_MSG_RESULT([no])]) + + GRPC_CONFIG_LIBS="$GRPC_CONFIG_LIBS $CARES_LIBS $RE2_LIBS" + if test -f "$GRPC_PATH/lib/libboringssl.a"; then GRPC_LDEP="-lboringssl -lboringcrypto" else @@ -8850,25 +8953,28 @@ NCBI_CHECK_THIRD_PARTY_LIB_EX(grpc, GRPC, grpc++, [${GRPC_CONFIG_LIBS--lgrpc -lgpr $CARES_LIBS $GRPC_LDEP}], [$PROTOBUF_LIBS $Z_LIBS], [$PROTOBUF_INCLUDE]) if test -n "$GRPC_LIBS"; then - if test -n "$GRPC_CONFIG_LIBS"; then - GRPC_LIBS="$GRPC_CONFIG_LIBS $PROTOBUF_LIBS $GRPC_LDEP" - GRPC_UNSECURE_LIBS="`$grpc_pc grpc++_unsecure grpc_unsecure --libs`" - for x in address_sorting upb cares; do - case " $GRPC_LIBS ::: $GRPC_UNSECURE_LIBS " in - *:::*" -l$x "* ) ;; - *" -l$x "* ) GRPC_UNSECURE_LIBS="$GRPC_UNSECURE_LIBS -l$x" ;; + if test -n "$grpc_pc"; then + GRPC_UNSECURE_LIBS="`$grpc_pc grpc++_unsecure grpc_unsecure protobuf \ + --libs`" + else + GRPC_LIBS="$GRPC_LIBPATH -lgrpc++ $GRPC_CONFIG_LIBS $GRPC_LDEP" + GRPC_UNSECURE_LIBS= + sep= + for x in $GRPC_LIBS; do + case "$x" in + -lgrpc* ) + GRPC_UNSECURE_LIBS="$GRPC_UNSECURE_LIBS$sep${x}_unsecure" + sep=' ' + ;; + -lboring* | -lssl | -lcrypto ) + ;; + * ) + GRPC_UNSECURE_LIBS="$GRPC_UNSECURE_LIBS $x" + sep=' ' + ;; esac done - GRPC_UNSECURE_LIBS="$GRPC_UNSECURE_LIBS $PROTOBUF_LIBS $GRPC_LDEP" - else - LDFLAGS="$orig_LDFLAGS $GRPC_LIBPATH" - AC_CHECK_LIB(address_sorting, address_sorting_rfc_6724_sort, - [GRPC_LIBS="$GRPC_LIBS -laddress_sorting"], []) - LDFLAGS=$orig_LDFLAGS - GRPC_UNSECURE_LIBS=`echo $GRPC_LIBS \ - | sed -e 's/\(-lgrpc+*\)/\1_unsecure/g'` - GRPC_LIBS="$GRPC_LIBS $GRPC_LDEP" - fi + fi GRPC_REFLECTION_LIBS="$WHOLE_ARCHIVE $NO_AS_NEEDED $GRPC_LIBPATH" GRPC_REFLECTION_LIBS="$GRPC_REFLECTION_LIBS -lgrpc++_reflection" GRPC_REFLECTION_LIBS="$GRPC_REFLECTION_LIBS $NO_WHOLE_ARCHIVE $AS_NEEDED" diff --git a/c++/src/build-system/install.sh.in b/c++/src/build-system/install.sh.in index 7dcb5cf8..85e45d69 100644 --- a/c++/src/build-system/install.sh.in +++ b/c++/src/build-system/install.sh.in @@ -17,7 +17,7 @@ echo "[`date`]" -svn_location=`echo '$HeadURL: https://svn.ncbi.nlm.nih.gov/repos/toolkit/release/blast/2.15.0/c++/src/build-system/install.sh.in $' | sed "s%\\$[H]eadURL: *\\([^$][^$]*\\) \\$.*%\\1%"` +svn_location=`echo '$HeadURL: https://svn.ncbi.nlm.nih.gov/repos/toolkit/release/blast/2.16.0/c++/src/build-system/install.sh.in $' | sed "s%\\$[H]eadURL: *\\([^$][^$]*\\) \\$.*%\\1%"` svn_revision=`echo '$Revision: 541872 $' | sed "s%\\$[R]evision: *\\([^$][^$]*\\) \\$.*%\\1%"` script_name=`basename $0` diff --git a/c++/src/build-system/ncbi_package_version b/c++/src/build-system/ncbi_package_version index 68e69e40..75249069 100644 --- a/c++/src/build-system/ncbi_package_version +++ b/c++/src/build-system/ncbi_package_version @@ -1 +1 @@ -2.15.0 +2.16.0 diff --git a/c++/src/build-system/project_tree_builder.ini b/c++/src/build-system/project_tree_builder.ini index 86408890..805f077e 100644 --- a/c++/src/build-system/project_tree_builder.ini +++ b/c++/src/build-system/project_tree_builder.ini @@ -1,4 +1,4 @@ -# $Id: project_tree_builder.ini 673725 2023-10-06 19:33:24Z ivanov $ +# $Id: project_tree_builder.ini 683737 2024-06-04 12:00:41Z ivanov $ ############################################################################### @@ -212,7 +212,7 @@ ThirdPartyLibsToInstall = BerkeleyDB \ # Macros # Macros used here should be defined either in this section, or in compiler specific section. -ThirdParty_BerkeleyDB = $(ThirdPartyBasePath)\\berkeleydb\\$(msvc_3rd)\\4.6.21.NC +ThirdParty_BerkeleyDB = $(ThirdPartyBasePath)\\berkeleydb\\$(msvc_3rd)\\5.3.28-ncbi1 ThirdParty_Boost = $(ThirdPartyBasePath)\\boost\\$(msvc_3rd)\\1.76.0-ncbi1 ThirdParty_BZ2 = $(ThirdPartyBasePath)\\bzip2\\$(msvc_3rd)\\1.0.6 ThirdParty_fastcgi = $(ThirdPartyBasePath)\\fastcgi\\$(msvc_3rd)\\2.4.1 @@ -251,7 +251,7 @@ ThirdParty_XSLT = $(ThirdPartyBasePath)\\xslt\\$(msvc_3rd)\\1.1.26 ThirdParty_Z = $(ThirdPartyBasePath)\\z\\$(msvc_3rd)\\1.2.11 ThirdParty_ZSTD = $(ThirdPartyBasePath)\\zstd\\$(msvc_3rd)\\1.5.2 ThirdParty_SQLServer = C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\180\\SDK -ThirdParty_VDB = $(ThirdPartyVDBBasePath)\\vdb\\vdb-versions\\3.0.7 +ThirdParty_VDB = $(ThirdPartyVDBBasePath)\\vdb\\vdb-versions\\3.1.1 PYTHON_PATH = $(ThirdPartyAppsBasePath)\\Python_3.11\\$(msvc_3rd) @@ -476,7 +476,7 @@ NotProvidedRequests = MSWin MSVC KCC ICC VisualAge CompaqCompiler WorkShop MIPSp DefinesPath = common/config/ncbiconf_xcode_site.h -ThirdParty_BerkeleyDB = $(XCode_ThirdPartyBasePath)/BerkeleyDB +ThirdParty_BerkeleyDB = $(XCode_ThirdPartyBasePath)/BerkeleyDB-5.3.28-ncbi1 ThirdParty_Boost = $(XCode_ThirdPartyBasePath)/boost-1.76.0-ncbi1 ThirdParty_JPEG = $(XCode_ThirdPartyBasePath)/safe-sw ThirdParty_PNG = /opt/X11 @@ -488,14 +488,14 @@ ThirdParty_GL2PS = $(XCode_ThirdPartyBasePath)/gl2ps-1.4.0 ThirdParty_wxWidgets = $(XCode_ThirdPartyBasePath)/wxWidgets-3.2.1-ncbi1 ThirdParty_FreeType = /opt/X11 ThirdParty_FTGL = $(XCode_ThirdPartyBasePath)/ftgl-2.1.3-rc5 -ThirdParty_VDB = $(XCode_ThirdPartyVDBBasePath)/vdb/vdb-versions/3.0.7 -ThirdParty_GMP = $(Xcode_ThirdPartyBasePath)/gmp-6.0.0a +ThirdParty_VDB = $(XCode_ThirdPartyVDBBasePath)/vdb/vdb-versions/3.1.1 +ThirdParty_GMP = $(Xcode_ThirdPartyBasePath)/gmp-6.3.0 ThirdParty_Nettle = $(Xcode_ThirdPartyBasePath)/nettle-3.1.1 ThirdParty_GNUTLS = $(Xcode_ThirdPartyBasePath)/gnutls-3.4.0 ThirdParty_LMDB = $(Xcode_ThirdPartyBasePath)/lmdb-0.9.24 ThirdParty_GRPC = $(Xcode_ThirdPartyBasePath)/grpc-1.36.4-ncbi1 ThirdParty_NGHTTP2 = $(Xcode_ThirdPartyBasePath)/nghttp2-1.40.0 -ThirdParty_UV = $(Xcode_ThirdPartyBasePath)/libuv-1.35.0 +ThirdParty_UV = $(Xcode_ThirdPartyBasePath)/libuv-1.44.2 ThirdParty_ncbicrypt = $(Xcode_ThirdPartyBasePath)/ncbicrypt-20230516 # LIBXML_INCLUDE = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2 @@ -540,6 +540,7 @@ Configurations = DebugDLL,DebugMT,ReleaseDLL,ReleaseMT DllConfigurations = DebugDLL ReleaseDLL DllBuildDefine = NCBI_DLL_BUILD msvc_prj = xcode30_prj +sfx64 = 64 vdb_arch = arm64 vdb_arch_inc = arm64 x86_only = /x86_only @@ -881,17 +882,17 @@ LIBPATH = $(ThirdParty_wxWidgets)u\\lib_dll\\releasedll [wxWidgets.xcode] LIB = -lwx_osx_cocoa_gl-3.2 -lwx_osx_cocoa_richtext-3.2 -lwx_osx_cocoa_aui-3.2 -lwx_osx_cocoa_propgrid-3.2 -lwx_osx_cocoa_xrc-3.2 -lwx_osx_cocoa_qa-3.2 -lwx_osx_cocoa_html-3.2 -lwx_osx_cocoa_adv-3.2 -lwx_osx_cocoa_core-3.2 -lwx_base_xml-3.2 -lwx_base_net-3.2 -lwx_base-3.2 -framework Cocoa [wxWidgets.xcode.debug.DebugMT] -INCLUDE = $(x86_only)$(ThirdParty_wxWidgets)/Clang-Debug$(sfx64)MT/lib/wx/include/osx_cocoa-ansi-3.2 $(x86_only)$(ThirdParty_wxWidgets)/include/wx-3.2 -LIBPATH = $(x86_only)$(ThirdParty_wxWidgets)/Clang-Debug$(sfx64)MT/lib +INCLUDE = $(ThirdParty_wxWidgets)/Clang-Debug$(sfx64)MT/lib/wx/include/osx_cocoa-ansi-3.2 $(ThirdParty_wxWidgets)/include/wx-3.2 +LIBPATH = $(ThirdParty_wxWidgets)/Clang-Debug$(sfx64)MT/lib [wxWidgets.xcode.debug.DebugDLL] -INCLUDE = $(x86_only)$(ThirdParty_wxWidgets)/Clang-Debug$(sfx64)/lib/wx/include/osx_cocoa-ansi-3.2 $(x86_only)$(ThirdParty_wxWidgets)/include/wx-3.2 -LIBPATH = $(x86_only)$(ThirdParty_wxWidgets)/Clang-Debug$(sfx64)/lib +INCLUDE = $(ThirdParty_wxWidgets)/Clang-Debug$(sfx64)/lib/wx/include/osx_cocoa-ansi-3.2 $(ThirdParty_wxWidgets)/include/wx-3.2 +LIBPATH = $(ThirdParty_wxWidgets)/Clang-Debug$(sfx64)/lib [wxWidgets.xcode.release.ReleaseMT] -INCLUDE = $(x86_only)$(ThirdParty_wxWidgets)/Clang-Release$(sfx64)MT/lib/wx/include/osx_cocoa-ansi-3.2 $(x86_only)$(ThirdParty_wxWidgets)/include/wx-3.2 -LIBPATH = $(x86_only)$(ThirdParty_wxWidgets)/Clang-Release$(sfx64)MT/lib +INCLUDE = $(ThirdParty_wxWidgets)/Clang-Release$(sfx64)MT/lib/wx/include/osx_cocoa-ansi-3.2 $(ThirdParty_wxWidgets)/include/wx-3.2 +LIBPATH = $(ThirdParty_wxWidgets)/Clang-Release$(sfx64)MT/lib [wxWidgets.xcode.release.ReleaseDLL] -INCLUDE = $(x86_only)$(ThirdParty_wxWidgets)/Clang-Release$(sfx64)/lib/wx/include/osx_cocoa-ansi-3.2 $(x86_only)$(ThirdParty_wxWidgets)/include/wx-3.2 -LIBPATH = $(x86_only)$(ThirdParty_wxWidgets)/Clang-Release$(sfx64)/lib +INCLUDE = $(ThirdParty_wxWidgets)/Clang-Release$(sfx64)/lib/wx/include/osx_cocoa-ansi-3.2 $(ThirdParty_wxWidgets)/include/wx-3.2 +LIBPATH = $(ThirdParty_wxWidgets)/Clang-Release$(sfx64)/lib [wxWidgets.xcode.debug] DEFINES = __WXDEBUG__,__WXMAC__,__WXOSX__,__WXOSX_COCOA__ @@ -976,9 +977,9 @@ LIBPATH = $(ThirdParty_GLEW)\\lib_dll\\releasedll DEFINES = GLEW_MX [GLEW.xcode] -INCLUDE = $(x86_only)$(ThirdParty_GLEW)/include +INCLUDE = $(ThirdParty_GLEW)/include LIB = -lGLEW -LIBPATH = $(x86_only)$(ThirdParty_GLEW)/lib$(sfx64) +LIBPATH = $(ThirdParty_GLEW)/lib$(sfx64) DEFINES = GLEW_MX [HAVE_LIBGLEW] @@ -1029,21 +1030,21 @@ Component=GL2PS #[GNUTLS.xcode] #Component = Nettle -#INCLUDE = $(x86_only)$(ThirdParty_GNUTLS)/include +#INCLUDE = $(ThirdParty_GNUTLS)/include #LIB = -lgnutls -#LIBPATH = $(x86_only)$(ThirdParty_GNUTLS)/lib$(sfx64) +#LIBPATH = $(ThirdParty_GNUTLS)/lib$(sfx64) [Nettle.xcode] Component = GMP -INCLUDE = $(x86_only)$(ThirdParty_Nettle)/include +INCLUDE = $(ThirdParty_Nettle)/include LIB = -lnettle -lhogweed -LIBPATH = $(x86_only)$(ThirdParty_Nettle)/lib$(sfx64) +LIBPATH = $(ThirdParty_Nettle)/lib$(sfx64) [GMP.xcode] -INCLUDE = $(x86_only)$(ThirdParty_GMP)/Release$(sfx64)/include +INCLUDE = $(ThirdParty_GMP)/Release$(sfx64)/include LIB = -lgmp -LIBPATH = $(x86_only)$(ThirdParty_GMP)/lib$(sfx64) +LIBPATH = $(ThirdParty_GMP)/lib$(sfx64) [HAVE_LIBGNUTLS] Component=GNUTLS @@ -1192,9 +1193,9 @@ LIBPATH = $(ThirdParty_LZO)\\lib_static\\releasemt LIBPATH = $(ThirdParty_LZO)\\lib_static\\releasedll [LZO.xcode] -INCLUDE = $(x86_only)$(ThirdParty_LZO)/include +INCLUDE = $(ThirdParty_LZO)/include LIB = -llzo2 -LIBPATH = $(x86_only)$(ThirdParty_LZO)/lib$(sfx64) +LIBPATH = $(ThirdParty_LZO)/lib$(sfx64) [HAVE_LIBLZO] Component=LZO @@ -1219,9 +1220,9 @@ LIBPATH = $(ThirdParty_LMDB)\\lib_static\\releasemt LIBPATH = $(ThirdParty_LMDB)\\lib_static\\releasedll [LMDB.xcode] -INCLUDE = $(x86_only)$(ThirdParty_LMDB)/include +INCLUDE = $(ThirdParty_LMDB)/include LIB = -llmdb -LIBPATH = $(x86_only)$(ThirdParty_LMDB)/lib$(sfx64) +LIBPATH = $(ThirdParty_LMDB)/lib$(sfx64) MACRO = LMDB_INCLUDE LMDB_STATIC_LIBS LMDB_LIBS [HAVE_LIBLMDB] @@ -1340,12 +1341,12 @@ LIBPATH = $(ThirdParty_ncbicrypt)\\lib_static\\releasemt [NCBICRYPT.release.ReleaseDLL] LIBPATH = $(ThirdParty_ncbicrypt)\\lib_static\\releasedll [NCBICRYPT.xcode] -INCLUDE = $(x86_only)$(ThirdParty_ncbicrypt)/include +INCLUDE = $(ThirdParty_ncbicrypt)/include LIB = -lncbicrypt [NCBICRYPT.xcode.debug] -LIBPATH = $(x86_only)$(ThirdParty_ncbicrypt)/Debug64/lib +LIBPATH = $(ThirdParty_ncbicrypt)/Debug64/lib [NCBICRYPT.xcode.release] -LIBPATH = $(x86_only)$(ThirdParty_ncbicrypt)/Release64/lib +LIBPATH = $(ThirdParty_ncbicrypt)/Release64/lib [HAVE_LIBNCBICRYPT] Component=NCBICRYPT @@ -1366,8 +1367,8 @@ LIBPATH = $(ThirdParty_NGHTTP2)\\lib_dll\\debugdll LIBPATH = $(ThirdParty_NGHTTP2)\\lib_dll\\releasedll [NGHTTP2.xcode] -INCLUDE = $(x86_only)$(ThirdParty_NGHTTP2)/include -LIBPATH = $(x86_only)$(ThirdParty_NGHTTP2)/lib +INCLUDE = $(ThirdParty_NGHTTP2)/include +LIBPATH = $(ThirdParty_NGHTTP2)/lib LIB = -lnghttp2 [HAVE_LIBNGHTTP2] @@ -1566,14 +1567,10 @@ Component=OpenGL [BerkeleyDB] INCLUDE = $(ThirdParty_BerkeleyDB)\\include LIB = libdb.lib -CONFS = DebugMT DebugDLL ReleaseMT ReleaseDLL +CONFS = DebugDLL ReleaseDLL MACRO = BERKELEYDB_INCLUDE BERKELEYDB_STATIC_LIBS BERKELEYDB_LIBS -[BerkeleyDB.debug.DebugMT] -LIBPATH = $(ThirdParty_BerkeleyDB)\\lib_static\\debugmt [BerkeleyDB.static.debug.DebugDLL] LIBPATH = $(ThirdParty_BerkeleyDB)\\lib_static\\debugdll -[BerkeleyDB.release.ReleaseMT] -LIBPATH = $(ThirdParty_BerkeleyDB)\\lib_static\\releasemt [BerkeleyDB.static.release.ReleaseDLL] LIBPATH = $(ThirdParty_BerkeleyDB)\\lib_static\\releasedll [BerkeleyDB.dll.debug.DebugDLL] @@ -1582,11 +1579,11 @@ LIBPATH = $(ThirdParty_BerkeleyDB)\\lib_dll\\debugdll LIBPATH = $(ThirdParty_BerkeleyDB)\\lib_dll\\releasedll [BerkeleyDB.xcode] -INCLUDE = $(x86_only)$(ThirdParty_BerkeleyDB)/include +INCLUDE = $(ThirdParty_BerkeleyDB)/include LIB = -ldb CONFS = Debug DebugMT DebugDLL Release ReleaseMT ReleaseDLL MACRO = BERKELEYDB_INCLUDE BERKELEYDB_STATIC_LIBS BERKELEYDB_LIBS -LIBPATH = $(x86_only)$(ThirdParty_BerkeleyDB)/lib$(sfx64) +LIBPATH = $(ThirdParty_BerkeleyDB)/lib$(sfx64) #---------------------------------------------------------------------------- @@ -1674,8 +1671,8 @@ LIBPATH = $(ThirdParty_UV)\\lib_dll\\debugdll LIBPATH = $(ThirdParty_UV)\\lib_dll\\releasedll [LIBUV.xcode] -INCLUDE = $(x86_only)$(ThirdParty_UV)/include -LIBPATH = $(x86_only)$(ThirdParty_UV)/lib +INCLUDE = $(ThirdParty_UV)/include +LIBPATH = $(ThirdParty_UV)/lib LIB = -luv [HAVE_LIBUV] @@ -1859,7 +1856,7 @@ LIBPATH = $(ThirdParty_Boost)\\lib_static\\releasemt LIBPATH = $(ThirdParty_Boost)\\lib_static\\releasedll [Boost.Test.xcode] -INCLUDE = $(x86_only)$(ThirdParty_Boost)/include +INCLUDE = $(ThirdParty_Boost)/include LIB = -lboost_unit_test_framework-clang-darwin CONFS = Debug DebugMT DebugDLL Release ReleaseMT ReleaseDLL LIBPATH = $(ThirdParty_Boost)/lib @@ -1912,7 +1909,7 @@ LIBPATH = $(ThirdParty_Boost)\\lib_static\\releasemt LIBPATH = $(ThirdParty_Boost)\\lib_static\\releasedll [Boost.Thread.xcode] -INCLUDE = $(x86_only)$(ThirdParty_Boost)/include +INCLUDE = $(ThirdParty_Boost)/include CONFS = DebugMT DebugDLL ReleaseMT ReleaseDLL @@ -1986,12 +1983,12 @@ LIBPATH = $(ThirdParty_FTGL)\\lib_static\\releasemt LIBPATH = $(ThirdParty_FTGL)\\lib_static\\releasedll [FTGL.xcode] -INCLUDE = $(x86_only)$(ThirdParty_FTGL)/include +INCLUDE = $(ThirdParty_FTGL)/include LIB = -lftgl [FTGL.xcode.debug] -LIBPATH = $(x86_only)$(ThirdParty_FTGL)/Debug$(sfx64)/lib +LIBPATH = $(ThirdParty_FTGL)/Debug$(sfx64)/lib [FTGL.xcode.release] -LIBPATH = $(x86_only)$(ThirdParty_FTGL)/Release$(sfx64)/lib +LIBPATH = $(ThirdParty_FTGL)/Release$(sfx64)/lib [HAVE_LIBFTGL] Component=FTGL @@ -2168,14 +2165,14 @@ LIB = libprotobufd.lib LIBPATH = $(ThirdParty_GRPC)\\lib\\ReleaseDLL LIB = libprotobuf.lib [PROTOBUF.xcode] -INCLUDE = $(x86_only)$(ThirdParty_GRPC)/include +INCLUDE = $(ThirdParty_GRPC)/include [PROTOBUF.xcode.debug] -INCLUDE = $(x86_only)$(ThirdParty_GRPC)/Debug/include -LIBPATH = $(x86_only)$(ThirdParty_GRPC)/Debug/lib +INCLUDE = $(ThirdParty_GRPC)/Debug/include +LIBPATH = $(ThirdParty_GRPC)/Debug/lib LIB = -lprotobufd [PROTOBUF.xcode.release] -INCLUDE = $(x86_only)$(ThirdParty_GRPC)/Release/include -LIBPATH = $(x86_only)$(ThirdParty_GRPC)/Release/lib +INCLUDE = $(ThirdParty_GRPC)/Release/include +LIBPATH = $(ThirdParty_GRPC)/Release/lib LIB = -lprotobuf [HAVE_LIBPROTOBUF] @@ -2204,14 +2201,14 @@ LIB = grpc++.lib grpc.lib gpr.lib address_sorting.lib cares.lib libprotobufd LIBPATH = $(ThirdParty_GRPC)\\lib\\ReleaseDLL LIB = grpc++.lib grpc.lib gpr.lib address_sorting.lib cares.lib libprotobuf.lib libprotoc.lib upb.lib boringcrypto.lib boringssl.lib re2.lib absl_bad_any_cast_impl.lib absl_bad_optional_access.lib absl_bad_variant_access.lib absl_base.lib absl_city.lib absl_civil_time.lib absl_cord.lib absl_debugging_internal.lib absl_demangle_internal.lib absl_examine_stack.lib absl_exponential_biased.lib absl_failure_signal_handler.lib absl_flags.lib absl_flags_commandlineflag.lib absl_flags_commandlineflag_internal.lib absl_flags_config.lib absl_flags_internal.lib absl_flags_marshalling.lib absl_flags_parse.lib absl_flags_private_handle_accessor.lib absl_flags_program_name.lib absl_flags_reflection.lib absl_flags_usage.lib absl_flags_usage_internal.lib absl_graphcycles_internal.lib absl_hash.lib absl_hashtablez_sampler.lib absl_int128.lib absl_leak_check.lib absl_leak_check_disable.lib absl_log_severity.lib absl_malloc_internal.lib absl_periodic_sampler.lib absl_random_distributions.lib absl_random_internal_distribution_test_util.lib absl_random_internal_platform.lib absl_random_internal_pool_urbg.lib absl_random_internal_randen.lib absl_random_internal_randen_hwaes.lib absl_random_internal_randen_hwaes_impl.lib absl_random_internal_randen_slow.lib absl_random_internal_seed_material.lib absl_random_seed_gen_exception.lib absl_random_seed_sequences.lib absl_raw_hash_set.lib absl_raw_logging_internal.lib absl_scoped_set_env.lib absl_spinlock_wait.lib absl_stacktrace.lib absl_status.lib absl_statusor.lib absl_str_format_internal.lib absl_strerror.lib absl_strings.lib absl_strings_internal.lib absl_symbolize.lib absl_synchronization.lib absl_throw_delegate.lib absl_time.lib absl_time_zone.lib [GRPC.xcode] -INCLUDE = $(x86_only)$(ThirdParty_GRPC)/include +INCLUDE = $(ThirdParty_GRPC)/include [GRPC.xcode.debug] -INCLUDE = $(x86_only)$(ThirdParty_GRPC)/Debug/include -LIBPATH = $(x86_only)$(ThirdParty_GRPC)/Debug/lib +INCLUDE = $(ThirdParty_GRPC)/Debug/include +LIBPATH = $(ThirdParty_GRPC)/Debug/lib LIB = -lgrpc++ -lgrpc -lgpr -laddress_sorting -lupb -lcares -lprotobufd -labsl_raw_hash_set -labsl_hashtablez_sampler -labsl_exponential_biased -labsl_hash -labsl_city -labsl_statusor -labsl_bad_variant_access -labsl_status -labsl_cord -labsl_str_format_internal -labsl_synchronization -labsl_graphcycles_internal -labsl_symbolize -labsl_demangle_internal -labsl_stacktrace -labsl_debugging_internal -labsl_malloc_internal -labsl_time -labsl_time_zone -labsl_civil_time -labsl_strings -labsl_strings_internal -labsl_throw_delegate -labsl_int128 -labsl_base -labsl_spinlock_wait -labsl_bad_optional_access -labsl_raw_logging_internal -labsl_log_severity -lre2 -lboringssl -lboringcrypto -lz [GRPC.xcode.release] -INCLUDE = $(x86_only)$(ThirdParty_GRPC)/Release/include -LIBPATH = $(x86_only)$(ThirdParty_GRPC)/Release/lib +INCLUDE = $(ThirdParty_GRPC)/Release/include +LIBPATH = $(ThirdParty_GRPC)/Release/lib LIB = -lgrpc++ -lgrpc -lgpr -laddress_sorting -lupb -lcares -lprotobuf -labsl_raw_hash_set -labsl_hashtablez_sampler -labsl_exponential_biased -labsl_hash -labsl_city -labsl_statusor -labsl_bad_variant_access -labsl_status -labsl_cord -labsl_str_format_internal -labsl_synchronization -labsl_graphcycles_internal -labsl_symbolize -labsl_demangle_internal -labsl_stacktrace -labsl_debugging_internal -labsl_malloc_internal -labsl_time -labsl_time_zone -labsl_civil_time -labsl_strings -labsl_strings_internal -labsl_throw_delegate -labsl_int128 -labsl_base -labsl_spinlock_wait -labsl_bad_optional_access -labsl_raw_logging_internal -labsl_log_severity -lre2 -lboringssl -lboringcrypto -lz [HAVE_LIBGRPC] diff --git a/c++/src/build-system/relocate.sh.in b/c++/src/build-system/relocate.sh.in index 25bb99a7..dd267a0b 100644 --- a/c++/src/build-system/relocate.sh.in +++ b/c++/src/build-system/relocate.sh.in @@ -1,6 +1,6 @@ @script_shell@ -# $Id: relocate.sh.in 674173 2023-10-19 17:21:40Z blastadm $ +# $Id: relocate.sh.in 684490 2024-06-25 12:36:54Z blastadm $ # Author: Denis Vakatov, NCBI # # Adjust paths to this build tree and the relevant source tree diff --git a/c++/src/cgi/fcgi_run.cpp b/c++/src/cgi/fcgi_run.cpp index f08cf6ef..1bd096b0 100644 --- a/c++/src/cgi/fcgi_run.cpp +++ b/c++/src/cgi/fcgi_run.cpp @@ -1,4 +1,4 @@ -/* $Id: fcgi_run.cpp 668162 2023-05-30 19:17:34Z sadyrovr $ +/* $Id: fcgi_run.cpp 675130 2023-11-15 13:51:04Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -162,6 +162,22 @@ extern "C" void SignalHandler(int) } +struct SEnvSetter : private CNcbiEnvironment +{ + SEnvSetter() + { + Unset("HTTP_COOKIE"); + } + + void operator()(const string& name, const string& value) + { + if (name == "HTTP_COOKIE") { + Set(name, value); + } + } +}; + + bool CCgiApplication::x_RunFastCGI(int* result, unsigned int def_iter) { // Reset the result (which is in fact an error counter here) @@ -357,8 +373,10 @@ bool CCgiApplication::x_RunFastCGI(int* result, unsigned int def_iter) CRequestContext& rctx = CDiagContext::GetRequestContext(); list names; env.Enumerate(names); + SEnvSetter env_setter; ITERATE(list, it, names) { rctx.AddPassThroughProperty(*it, env.Get(*it)); + env_setter(*it, env.Get(*it)); } PushDiagPostPrefix(env.Get(m_DiagPrefixEnv).c_str()); diff --git a/c++/src/connect/connect_misc.cpp b/c++/src/connect/connect_misc.cpp index 6c4d98d9..9a3c411c 100644 --- a/c++/src/connect/connect_misc.cpp +++ b/c++/src/connect/connect_misc.cpp @@ -1,4 +1,4 @@ -/* $Id: connect_misc.cpp 651028 2022-06-08 15:27:50Z sadyrovr $ +/* $Id: connect_misc.cpp 675422 2023-11-21 19:49:15Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -86,22 +86,23 @@ private: map m_Data; }; -SSocketAddress::SHost::SHost(const string& h) : +SSocketAddress::SHost::SHost(const string& h, EName n) : + name(n == EName::eOriginal ? h : std::optional()), host(SSocketAddressImpl::GetInstance().GetHost(h)) { } string SSocketAddress::GetHostName() const { - return SSocketAddressImpl::GetInstance().GetName(host); + return m_Name ? m_Name.value() : SSocketAddressImpl::GetInstance().GetName(host); } -SSocketAddress SSocketAddress::Parse(const string& address) +SSocketAddress SSocketAddress::Parse(const string& address, SHost::EName name) { string host, port; if (NStr::SplitInTwo(address, ":", host, port)) { - return { host, port }; + return { { host, name }, port }; } return { 0, 0 }; @@ -123,9 +124,9 @@ bool operator< (const SSocketAddress& lhs, const SSocketAddress& rhs) struct SServiceDiscoveryImpl : protected CConnIniter { // Do not make static (see above) - shared_ptr GetSingleServer(const string& service_name) const + shared_ptr GetSingleServer(const string& service_name, SSocketAddress::SHost::EName name) const { - if (auto address = SSocketAddress::Parse(service_name)) { + if (auto address = SSocketAddress::Parse(service_name, name)) { CServiceDiscovery::TServer server(move(address), 1.0); return make_shared(1, move(server)); } @@ -134,9 +135,9 @@ struct SServiceDiscoveryImpl : protected CConnIniter } }; -CServiceDiscovery::CServiceDiscovery(const string& service_name) : +CServiceDiscovery::CServiceDiscovery(const string& service_name, SSocketAddress::SHost::EName name) : m_ServiceName(service_name), - m_Data(SServiceDiscoveryImpl().GetSingleServer(m_ServiceName)), + m_Data(SServiceDiscoveryImpl().GetSingleServer(m_ServiceName, name)), m_IsSingleServer(m_Data) { } diff --git a/c++/src/connect/mbedtls/aes.c b/c++/src/connect/mbedtls/aes.c index f08a21f5..836367ce 100644 --- a/c++/src/connect/mbedtls/aes.c +++ b/c++/src/connect/mbedtls/aes.c @@ -2,24 +2,12 @@ * FIPS-197 compliant AES implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The AES block cipher was designed by Vincent Rijmen and Joan Daemen. * - * http://csrc.nist.gov/encryption/aes/rijndael/Rijndael.pdf + * https://csrc.nist.gov/csrc/media/projects/cryptographic-standards-and-guidelines/documents/aes-development/rijndael-ammended.pdf * http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf */ @@ -50,7 +38,7 @@ #define AES_VALIDATE(cond) \ MBEDTLS_INTERNAL_VALIDATE(cond) -#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86) +#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE) static int aes_padlock_ace = -1; #endif @@ -58,6 +46,8 @@ static int aes_padlock_ace = -1; /* * Forward S-box */ +#if !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT) || \ + !defined(MBEDTLS_AES_SETKEY_DEC_ALT) static const unsigned char FSb[256] = { 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, @@ -93,6 +83,8 @@ static const unsigned char FSb[256] = 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16 }; +#endif /* !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT) || \ + !defined(MBEDTLS_AES_SETKEY_DEC_ALT) */ /* * Forward tables @@ -164,6 +156,7 @@ static const unsigned char FSb[256] = V(C3, 41, 41, 82), V(B0, 99, 99, 29), V(77, 2D, 2D, 5A), V(11, 0F, 0F, 1E), \ V(CB, B0, B0, 7B), V(FC, 54, 54, A8), V(D6, BB, BB, 6D), V(3A, 16, 16, 2C) +#if !defined(MBEDTLS_AES_ENCRYPT_ALT) #define V(a, b, c, d) 0x##a##b##c##d static const uint32_t FT0[256] = { FT }; #undef V @@ -184,8 +177,11 @@ static const uint32_t FT3[256] = { FT }; #endif /* !MBEDTLS_AES_FEWER_TABLES */ +#endif /* !defined(MBEDTLS_AES_ENCRYPT_ALT) */ + #undef FT +#if !defined(MBEDTLS_AES_DECRYPT_ALT) /* * Reverse S-box */ @@ -224,6 +220,7 @@ static const unsigned char RSb[256] = 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D }; +#endif /* defined(MBEDTLS_AES_DECRYPT_ALT)) */ /* * Reverse tables @@ -295,6 +292,8 @@ static const unsigned char RSb[256] = V(71, 01, A8, 39), V(DE, B3, 0C, 08), V(9C, E4, B4, D8), V(90, C1, 56, 64), \ V(61, 84, CB, 7B), V(70, B6, 32, D5), V(74, 5C, 6C, 48), V(42, 57, B8, D0) +#if !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT) + #define V(a, b, c, d) 0x##a##b##c##d static const uint32_t RT0[256] = { RT }; #undef V @@ -315,46 +314,62 @@ static const uint32_t RT3[256] = { RT }; #endif /* !MBEDTLS_AES_FEWER_TABLES */ +#endif /* !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT) */ + #undef RT +#if !defined(MBEDTLS_AES_SETKEY_ENC_ALT) /* * Round constants */ -static const uint32_t RCON[10] = +static const uint32_t round_constants[10] = { 0x00000001, 0x00000002, 0x00000004, 0x00000008, 0x00000010, 0x00000020, 0x00000040, 0x00000080, 0x0000001B, 0x00000036 }; +#endif /* !defined(MBEDTLS_AES_SETKEY_ENC_ALT) */ #else /* MBEDTLS_AES_ROM_TABLES */ /* * Forward S-box & tables */ +#if !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT) || \ + !defined(MBEDTLS_AES_SETKEY_DEC_ALT) static unsigned char FSb[256]; +#endif /* !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT) || \ + !defined(MBEDTLS_AES_SETKEY_DEC_ALT) */ +#if !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT) static uint32_t FT0[256]; #if !defined(MBEDTLS_AES_FEWER_TABLES) static uint32_t FT1[256]; static uint32_t FT2[256]; static uint32_t FT3[256]; #endif /* !MBEDTLS_AES_FEWER_TABLES */ +#endif /* !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT) */ /* * Reverse S-box & tables */ +#if !(defined(MBEDTLS_AES_SETKEY_ENC_ALT) && defined(MBEDTLS_AES_DECRYPT_ALT)) static unsigned char RSb[256]; +#endif /* !(defined(MBEDTLS_AES_SETKEY_ENC_ALT) && defined(MBEDTLS_AES_DECRYPT_ALT)) */ + +#if !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT) static uint32_t RT0[256]; #if !defined(MBEDTLS_AES_FEWER_TABLES) static uint32_t RT1[256]; static uint32_t RT2[256]; static uint32_t RT3[256]; #endif /* !MBEDTLS_AES_FEWER_TABLES */ +#endif /* !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT) */ +#if !defined(MBEDTLS_AES_SETKEY_ENC_ALT) /* * Round constants */ -static uint32_t RCON[10]; +static uint32_t round_constants[10]; /* * Tables generation code @@ -384,7 +399,7 @@ static void aes_gen_tables(void) * calculate the round constants */ for (i = 0, x = 1; i < 10; i++) { - RCON[i] = (uint32_t) x; + round_constants[i] = (uint32_t) x; x = MBEDTLS_BYTE_0(XTIME(x)); } @@ -428,6 +443,7 @@ static void aes_gen_tables(void) x = RSb[i]; +#if !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT) RT0[i] = ((uint32_t) MUL(0x0E, x)) ^ ((uint32_t) MUL(0x09, x) << 8) ^ ((uint32_t) MUL(0x0D, x) << 16) ^ @@ -438,9 +454,12 @@ static void aes_gen_tables(void) RT2[i] = ROTL8(RT1[i]); RT3[i] = ROTL8(RT2[i]); #endif /* !MBEDTLS_AES_FEWER_TABLES */ +#endif /* !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT) */ } } +#endif /* !defined(MBEDTLS_AES_SETKEY_ENC_ALT) */ + #undef ROTL8 #endif /* MBEDTLS_AES_ROM_TABLES */ @@ -517,16 +536,19 @@ void mbedtls_aes_xts_free(mbedtls_aes_xts_context *ctx) * Note that the offset is in units of elements of buf, i.e. 32-bit words, * i.e. an offset of 1 means 4 bytes and so on. */ -#if (defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86)) || \ +#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE) || \ (defined(MBEDTLS_AESNI_C) && MBEDTLS_AESNI_HAVE_CODE == 2) #define MAY_NEED_TO_ALIGN #endif + +#if defined(MAY_NEED_TO_ALIGN) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT) || \ + !defined(MBEDTLS_AES_SETKEY_ENC_ALT) static unsigned mbedtls_aes_rk_offset(uint32_t *buf) { #if defined(MAY_NEED_TO_ALIGN) int align_16_bytes = 0; -#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86) +#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE) if (aes_padlock_ace == -1) { aes_padlock_ace = mbedtls_padlock_has_support(MBEDTLS_PADLOCK_ACE); } @@ -557,6 +579,8 @@ static unsigned mbedtls_aes_rk_offset(uint32_t *buf) return 0; } +#endif /* defined(MAY_NEED_TO_ALIGN) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT) || \ + !defined(MBEDTLS_AES_SETKEY_ENC_ALT) */ /* * AES key schedule (encryption) @@ -601,7 +625,7 @@ int mbedtls_aes_setkey_enc(mbedtls_aes_context *ctx, const unsigned char *key, case 10: for (i = 0; i < 10; i++, RK += 4) { - RK[4] = RK[0] ^ RCON[i] ^ + RK[4] = RK[0] ^ round_constants[i] ^ ((uint32_t) FSb[MBEDTLS_BYTE_1(RK[3])]) ^ ((uint32_t) FSb[MBEDTLS_BYTE_2(RK[3])] << 8) ^ ((uint32_t) FSb[MBEDTLS_BYTE_3(RK[3])] << 16) ^ @@ -616,7 +640,7 @@ int mbedtls_aes_setkey_enc(mbedtls_aes_context *ctx, const unsigned char *key, case 12: for (i = 0; i < 8; i++, RK += 6) { - RK[6] = RK[0] ^ RCON[i] ^ + RK[6] = RK[0] ^ round_constants[i] ^ ((uint32_t) FSb[MBEDTLS_BYTE_1(RK[5])]) ^ ((uint32_t) FSb[MBEDTLS_BYTE_2(RK[5])] << 8) ^ ((uint32_t) FSb[MBEDTLS_BYTE_3(RK[5])] << 16) ^ @@ -633,7 +657,7 @@ int mbedtls_aes_setkey_enc(mbedtls_aes_context *ctx, const unsigned char *key, case 14: for (i = 0; i < 7; i++, RK += 8) { - RK[8] = RK[0] ^ RCON[i] ^ + RK[8] = RK[0] ^ round_constants[i] ^ ((uint32_t) FSb[MBEDTLS_BYTE_1(RK[7])]) ^ ((uint32_t) FSb[MBEDTLS_BYTE_2(RK[7])] << 8) ^ ((uint32_t) FSb[MBEDTLS_BYTE_3(RK[7])] << 16) ^ @@ -1040,7 +1064,7 @@ int mbedtls_aes_crypt_ecb(mbedtls_aes_context *ctx, } #endif -#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86) +#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE) if (aes_padlock_ace) { return mbedtls_padlock_xcryptecb(ctx, mode, input, output); } @@ -1079,7 +1103,7 @@ int mbedtls_aes_crypt_cbc(mbedtls_aes_context *ctx, return MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH; } -#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86) +#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE) if (aes_padlock_ace) { if (mbedtls_padlock_xcryptcbc(ctx, mode, length, iv, input, output) == 0) { return 0; @@ -1839,7 +1863,7 @@ int mbedtls_aes_self_test(int verbose) #if defined(MBEDTLS_AES_ALT) mbedtls_printf(" AES note: alternative implementation.\n"); #else /* MBEDTLS_AES_ALT */ -#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86) +#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE) if (mbedtls_padlock_has_support(MBEDTLS_PADLOCK_ACE)) { mbedtls_printf(" AES note: using VIA Padlock.\n"); } else diff --git a/c++/src/connect/mbedtls/aesni.c b/c++/src/connect/mbedtls/aesni.c index c909f654..74bae91f 100644 --- a/c++/src/connect/mbedtls/aesni.c +++ b/c++/src/connect/mbedtls/aesni.c @@ -2,19 +2,7 @@ * AES-NI support functions * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* @@ -39,8 +27,12 @@ #if defined(MBEDTLS_AESNI_HAVE_CODE) #if MBEDTLS_AESNI_HAVE_CODE == 2 -#if !defined(_WIN32) +#if defined(__GNUC__) #include +#elif defined(_MSC_VER) +#include +#else +#error "`__cpuid` required by MBEDTLS_AESNI_C is not supported by the compiler" #endif #include #endif @@ -55,7 +47,7 @@ int mbedtls_aesni_has_support(unsigned int what) if (!done) { #if MBEDTLS_AESNI_HAVE_CODE == 2 - static unsigned info[4] = { 0, 0, 0, 0 }; + static int info[4] = { 0, 0, 0, 0 }; #if defined(_MSC_VER) __cpuid(info, 1); #else @@ -189,7 +181,7 @@ void mbedtls_aesni_gcm_mult(unsigned char c[16], const unsigned char a[16], const unsigned char b[16]) { - __m128i aa, bb, cc, dd; + __m128i aa = { 0 }, bb = { 0 }, cc, dd; /* The inputs are in big-endian order, so byte-reverse them */ for (size_t i = 0; i < 16; i++) { diff --git a/c++/src/connect/mbedtls/arc4.c b/c++/src/connect/mbedtls/arc4.c index aa5e3a2b..7ff747d0 100644 --- a/c++/src/connect/mbedtls/arc4.c +++ b/c++/src/connect/mbedtls/arc4.c @@ -2,19 +2,7 @@ * An implementation of the ARCFOUR algorithm * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The ARCFOUR algorithm was publicly disclosed on 94/09. diff --git a/c++/src/connect/mbedtls/aria.c b/c++/src/connect/mbedtls/aria.c index d958ef61..c9441057 100644 --- a/c++/src/connect/mbedtls/aria.c +++ b/c++/src/connect/mbedtls/aria.c @@ -2,19 +2,7 @@ * ARIA implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* diff --git a/c++/src/connect/mbedtls/asn1parse.c b/c++/src/connect/mbedtls/asn1parse.c index 6a8cd6c5..c7f7f0b3 100644 --- a/c++/src/connect/mbedtls/asn1parse.c +++ b/c++/src/connect/mbedtls/asn1parse.c @@ -2,19 +2,7 @@ * Generic ASN.1 parsing * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/asn1write.c b/c++/src/connect/mbedtls/asn1write.c index 0b487dce..0147c49f 100644 --- a/c++/src/connect/mbedtls/asn1write.c +++ b/c++/src/connect/mbedtls/asn1write.c @@ -2,19 +2,7 @@ * ASN.1 buffer writing functionality * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" @@ -194,14 +182,23 @@ int mbedtls_asn1_write_oid(unsigned char **p, unsigned char *start, int mbedtls_asn1_write_algorithm_identifier(unsigned char **p, unsigned char *start, const char *oid, size_t oid_len, size_t par_len) +{ + return mbedtls_asn1_write_algorithm_identifier_ext(p, start, oid, oid_len, par_len, 1); +} + +int mbedtls_asn1_write_algorithm_identifier_ext(unsigned char **p, unsigned char *start, + const char *oid, size_t oid_len, + size_t par_len, int has_par) { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; size_t len = 0; - if (par_len == 0) { - MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_null(p, start)); - } else { - len += par_len; + if (has_par) { + if (par_len == 0) { + MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_null(p, start)); + } else { + len += par_len; + } } MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_oid(p, start, oid, oid_len)); diff --git a/c++/src/connect/mbedtls/base64.c b/c++/src/connect/mbedtls/base64.c index 41706106..1f1a90a9 100644 --- a/c++/src/connect/mbedtls/base64.c +++ b/c++/src/connect/mbedtls/base64.c @@ -2,19 +2,7 @@ * RFC 1521 base64 encoding/decoding * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/bignum.c b/c++/src/connect/mbedtls/bignum.c index 5dca3a91..fadd9e9c 100644 --- a/c++/src/connect/mbedtls/bignum.c +++ b/c++/src/connect/mbedtls/bignum.c @@ -2,19 +2,7 @@ * Multi-precision integer library * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* @@ -42,6 +30,7 @@ #include "mbedtls/platform_util.h" #include "mbedtls/error.h" #include "constant_time_internal.h" +#include "bignum_internal.h" #include #include @@ -1919,48 +1908,24 @@ int mbedtls_mpi_mod_int(mbedtls_mpi_uint *r, const mbedtls_mpi *A, mbedtls_mpi_s /* * Fast Montgomery initialization (thanks to Tom St Denis) */ -static void mpi_montg_init(mbedtls_mpi_uint *mm, const mbedtls_mpi *N) +mbedtls_mpi_uint mbedtls_mpi_montmul_init(const mbedtls_mpi_uint *N) { - mbedtls_mpi_uint x, m0 = N->p[0]; - unsigned int i; + mbedtls_mpi_uint x = N[0]; - x = m0; - x += ((m0 + 2) & 4) << 1; + x += ((N[0] + 2) & 4) << 1; - for (i = biL; i >= 8; i /= 2) { - x *= (2 - (m0 * x)); + for (unsigned int i = biL; i >= 8; i /= 2) { + x *= (2 - (N[0] * x)); } - *mm = ~x + 1; + return ~x + 1; } -/** Montgomery multiplication: A = A * B * R^-1 mod N (HAC 14.36) - * - * \param[in,out] A One of the numbers to multiply. - * It must have at least as many limbs as N - * (A->n >= N->n), and any limbs beyond n are ignored. - * On successful completion, A contains the result of - * the multiplication A * B * R^-1 mod N where - * R = (2^ciL)^n. - * \param[in] B One of the numbers to multiply. - * It must be nonzero and must not have more limbs than N - * (B->n <= N->n). - * \param[in] N The modulo. N must be odd. - * \param mm The value calculated by `mpi_montg_init(&mm, N)`. - * This is -N^-1 mod 2^ciL. - * \param[in,out] T A bignum for temporary storage. - * It must be at least twice the limb size of N plus 2 - * (T->n >= 2 * (N->n + 1)). - * Its initial content is unused and - * its final content is indeterminate. - * Note that unlike the usual convention in the library - * for `const mbedtls_mpi*`, the content of T can change. - */ -static void mpi_montmul(mbedtls_mpi *A, - const mbedtls_mpi *B, - const mbedtls_mpi *N, - mbedtls_mpi_uint mm, - const mbedtls_mpi *T) +void mbedtls_mpi_montmul(mbedtls_mpi *A, + const mbedtls_mpi *B, + const mbedtls_mpi *N, + mbedtls_mpi_uint mm, + const mbedtls_mpi *T) { size_t i, n, m; mbedtls_mpi_uint u0, u1, *d; @@ -2008,7 +1973,8 @@ static void mpi_montmul(mbedtls_mpi *A, /* * Montgomery reduction: A = A * R^-1 mod N * - * See mpi_montmul() regarding constraints and guarantees on the parameters. + * See mbedtls_mpi_montmul() regarding constraints and guarantees on the + * parameters. */ static void mpi_montred(mbedtls_mpi *A, const mbedtls_mpi *N, mbedtls_mpi_uint mm, const mbedtls_mpi *T) @@ -2019,7 +1985,7 @@ static void mpi_montred(mbedtls_mpi *A, const mbedtls_mpi *N, U.n = U.s = (int) z; U.p = &z; - mpi_montmul(A, &U, N, mm, T); + mbedtls_mpi_montmul(A, &U, N, mm, T); } /** @@ -2051,6 +2017,20 @@ cleanup: return ret; } +int mbedtls_mpi_get_mont_r2_unsafe(mbedtls_mpi *X, + const mbedtls_mpi *N) +{ + int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; + + MBEDTLS_MPI_CHK(mbedtls_mpi_lset(X, 1)); + MBEDTLS_MPI_CHK(mbedtls_mpi_shift_l(X, N->n * 2 * biL)); + MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(X, X, N)); + MBEDTLS_MPI_CHK(mbedtls_mpi_shrink(X, N->n)); + +cleanup: + return ret; +} + /* * Sliding-window exponentiation: X = A^E mod N (HAC 14.85) */ @@ -2088,7 +2068,7 @@ int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A, /* * Init temps and window size */ - mpi_montg_init(&mm, N); + mm = mbedtls_mpi_montmul_init(N->p); mbedtls_mpi_init(&RR); mbedtls_mpi_init(&T); mbedtls_mpi_init(&Apos); mbedtls_mpi_init(&WW); @@ -2121,8 +2101,9 @@ int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A, * and squarings. Firstly, when multiplying by an element of the window * W[i], we do a constant-trace table lookup to obfuscate i. This leaves * squarings as having a different memory access patterns from other - * multiplications. So secondly, we put the accumulator X in the table as - * well, and also do a constant-trace table lookup to multiply by X. + * multiplications. So secondly, we put the accumulator in the table as + * well, and also do a constant-trace table lookup to multiply by the + * accumulator which is W[x_index]. * * This way, all multiplications take the form of a lookup-and-multiply. * The number of lookup-and-multiply operations inside each iteration of @@ -2135,19 +2116,16 @@ int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A, * observe both memory accesses and branches. However, branch prediction * exploitation typically requires many traces of execution over the same * data, which is defeated by randomized blinding. - * - * To achieve this, we make a copy of X and we use the table entry in each - * calculation from this point on. */ const size_t x_index = 0; mbedtls_mpi_init(&W[x_index]); - mbedtls_mpi_copy(&W[x_index], X); j = N->n + 1; - /* All W[i] and X must have at least N->n limbs for the mpi_montmul() - * and mpi_montred() calls later. Here we ensure that W[1] and X are - * large enough, and later we'll grow other W[i] to the same length. - * They must not be shrunk midway through this function! + /* All W[i] including the accumulator must have at least N->n limbs for + * the mbedtls_mpi_montmul() and mpi_montred() calls later. Here we ensure + * that W[1] and the accumulator W[x_index] are large enough. later we'll + * grow other W[i] to the same length. They must not be shrunk midway + * through this function! */ MBEDTLS_MPI_CHK(mbedtls_mpi_grow(&W[x_index], j)); MBEDTLS_MPI_CHK(mbedtls_mpi_grow(&W[1], j)); @@ -2167,9 +2145,7 @@ int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A, * If 1st call, pre-compute R^2 mod N */ if (prec_RR == NULL || prec_RR->p == NULL) { - MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&RR, 1)); - MBEDTLS_MPI_CHK(mbedtls_mpi_shift_l(&RR, N->n * 2 * biL)); - MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&RR, &RR, N)); + mbedtls_mpi_get_mont_r2_unsafe(&RR, N); if (prec_RR != NULL) { memcpy(prec_RR, &RR, sizeof(mbedtls_mpi)); @@ -2185,7 +2161,7 @@ int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A, MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&W[1], A, N)); /* This should be a no-op because W[1] is already that large before * mbedtls_mpi_mod_mpi(), but it's necessary to avoid an overflow - * in mpi_montmul() below, so let's make sure. */ + * in mbedtls_mpi_montmul() below, so let's make sure. */ MBEDTLS_MPI_CHK(mbedtls_mpi_grow(&W[1], N->n + 1)); } else { MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&W[1], A)); @@ -2193,7 +2169,7 @@ int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A, /* Note that this is safe because W[1] always has at least N->n limbs * (it grew above and was preserved by mbedtls_mpi_copy()). */ - mpi_montmul(&W[1], &RR, N, mm, &T); + mbedtls_mpi_montmul(&W[1], &RR, N, mm, &T); /* * W[x_index] = R^2 * R^-1 mod N = R mod N @@ -2219,7 +2195,7 @@ int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A, MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&W[j], &W[1])); for (i = 0; i < window_bitsize - 1; i++) { - mpi_montmul(&W[j], &W[j], N, mm, &T); + mbedtls_mpi_montmul(&W[j], &W[j], N, mm, &T); } /* @@ -2229,7 +2205,7 @@ int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A, MBEDTLS_MPI_CHK(mbedtls_mpi_grow(&W[i], N->n + 1)); MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&W[i], &W[i - 1])); - mpi_montmul(&W[i], &W[1], N, mm, &T); + mbedtls_mpi_montmul(&W[i], &W[1], N, mm, &T); } } @@ -2265,7 +2241,7 @@ int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A, * out of window, square W[x_index] */ MBEDTLS_MPI_CHK(mpi_select(&WW, W, w_table_used_size, x_index)); - mpi_montmul(&W[x_index], &WW, N, mm, &T); + mbedtls_mpi_montmul(&W[x_index], &WW, N, mm, &T); continue; } @@ -2284,7 +2260,7 @@ int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A, for (i = 0; i < window_bitsize; i++) { MBEDTLS_MPI_CHK(mpi_select(&WW, W, w_table_used_size, x_index)); - mpi_montmul(&W[x_index], &WW, N, mm, &T); + mbedtls_mpi_montmul(&W[x_index], &WW, N, mm, &T); } /* @@ -2292,7 +2268,7 @@ int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A, */ MBEDTLS_MPI_CHK(mpi_select(&WW, W, w_table_used_size, exponent_bits_in_window)); - mpi_montmul(&W[x_index], &WW, N, mm, &T); + mbedtls_mpi_montmul(&W[x_index], &WW, N, mm, &T); state--; nbits = 0; @@ -2305,13 +2281,13 @@ int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A, */ for (i = 0; i < nbits; i++) { MBEDTLS_MPI_CHK(mpi_select(&WW, W, w_table_used_size, x_index)); - mpi_montmul(&W[x_index], &WW, N, mm, &T); + mbedtls_mpi_montmul(&W[x_index], &WW, N, mm, &T); exponent_bits_in_window <<= 1; if ((exponent_bits_in_window & ((size_t) 1 << window_bitsize)) != 0) { MBEDTLS_MPI_CHK(mpi_select(&WW, W, w_table_used_size, 1)); - mpi_montmul(&W[x_index], &WW, N, mm, &T); + mbedtls_mpi_montmul(&W[x_index], &WW, N, mm, &T); } } @@ -2328,7 +2304,7 @@ int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A, /* * Load the result in the output variable. */ - mbedtls_mpi_copy(X, &W[x_index]); + MBEDTLS_MPI_CHK(mbedtls_mpi_copy(X, &W[x_index])); cleanup: diff --git a/c++/src/connect/mbedtls/bignum_internal.h b/c++/src/connect/mbedtls/bignum_internal.h new file mode 100644 index 00000000..5435ebb4 --- /dev/null +++ b/c++/src/connect/mbedtls/bignum_internal.h @@ -0,0 +1,71 @@ +/** + * Low level bignum functions + * + * Copyright The Mbed TLS Contributors + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + */ + +#ifndef MBEDTLS_BIGNUM_INTERNAL_H +#define MBEDTLS_BIGNUM_INTERNAL_H + +#include "mbedtls/bignum.h" + +/** + * \brief Calculate the square of the Montgomery constant. (Needed + * for conversion and operations in Montgomery form.) + * + * \param[out] X A pointer to the result of the calculation of + * the square of the Montgomery constant: + * 2^{2*n*biL} mod N. + * \param[in] N Little-endian presentation of the modulus, which must be odd. + * + * \return 0 if successful. + * \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if there is not enough space + * to store the value of Montgomery constant squared. + * \return #MBEDTLS_ERR_MPI_DIVISION_BY_ZERO if \p N modulus is zero. + * \return #MBEDTLS_ERR_MPI_NEGATIVE_VALUE if \p N modulus is negative. + */ +int mbedtls_mpi_get_mont_r2_unsafe(mbedtls_mpi *X, + const mbedtls_mpi *N); + +/** + * \brief Calculate initialisation value for fast Montgomery modular + * multiplication + * + * \param[in] N Little-endian presentation of the modulus. This must have + * at least one limb. + * + * \return The initialisation value for fast Montgomery modular multiplication + */ +mbedtls_mpi_uint mbedtls_mpi_montmul_init(const mbedtls_mpi_uint *N); + +/** Montgomery multiplication: A = A * B * R^-1 mod N (HAC 14.36) + * + * \param[in,out] A One of the numbers to multiply. + * It must have at least as many limbs as N + * (A->n >= N->n), and any limbs beyond n are ignored. + * On successful completion, A contains the result of + * the multiplication A * B * R^-1 mod N where + * R = (2^ciL)^n. + * \param[in] B One of the numbers to multiply. + * It must be nonzero and must not have more limbs than N + * (B->n <= N->n). + * \param[in] N The modulo. N must be odd. + * \param mm The value calculated by + * `mbedtls_mpi_montg_init(&mm, N)`. + * This is -N^-1 mod 2^ciL. + * \param[in,out] T A bignum for temporary storage. + * It must be at least twice the limb size of N plus 2 + * (T->n >= 2 * (N->n + 1)). + * Its initial content is unused and + * its final content is indeterminate. + * Note that unlike the usual convention in the library + * for `const mbedtls_mpi*`, the content of T can change. + */ +void mbedtls_mpi_montmul(mbedtls_mpi *A, + const mbedtls_mpi *B, + const mbedtls_mpi *N, + mbedtls_mpi_uint mm, + const mbedtls_mpi *T); + +#endif /* MBEDTLS_BIGNUM_INTERNAL_H */ diff --git a/c++/src/connect/mbedtls/blowfish.c b/c++/src/connect/mbedtls/blowfish.c index f56bb65b..d90456b9 100644 --- a/c++/src/connect/mbedtls/blowfish.c +++ b/c++/src/connect/mbedtls/blowfish.c @@ -2,19 +2,7 @@ * Blowfish implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The Blowfish block cipher was designed by Bruce Schneier in 1993. diff --git a/c++/src/connect/mbedtls/camellia.c b/c++/src/connect/mbedtls/camellia.c index ce034d74..bd76ea87 100644 --- a/c++/src/connect/mbedtls/camellia.c +++ b/c++/src/connect/mbedtls/camellia.c @@ -2,19 +2,7 @@ * Camellia implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The Camellia block cipher was designed by NTT and Mitsubishi Electric diff --git a/c++/src/connect/mbedtls/ccm.c b/c++/src/connect/mbedtls/ccm.c index 2d2695e9..2ba21c7e 100644 --- a/c++/src/connect/mbedtls/ccm.c +++ b/c++/src/connect/mbedtls/ccm.c @@ -2,19 +2,7 @@ * NIST SP800-38C compliant CCM implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* @@ -33,6 +21,7 @@ #include "mbedtls/ccm.h" #include "mbedtls/platform_util.h" #include "mbedtls/error.h" +#include "mbedtls/constant_time.h" #include @@ -362,7 +351,6 @@ int mbedtls_ccm_star_auth_decrypt(mbedtls_ccm_context *ctx, size_t length, { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; unsigned char check_tag[16]; - unsigned char i; int diff; CCM_VALIDATE_RET(ctx != NULL); @@ -379,9 +367,7 @@ int mbedtls_ccm_star_auth_decrypt(mbedtls_ccm_context *ctx, size_t length, } /* Check tag in "constant-time" */ - for (diff = 0, i = 0; i < tag_len; i++) { - diff |= tag[i] ^ check_tag[i]; - } + diff = mbedtls_ct_memcmp(tag, check_tag, tag_len); if (diff != 0) { mbedtls_platform_zeroize(output, length); diff --git a/c++/src/connect/mbedtls/certs.c b/c++/src/connect/mbedtls/certs.c index af1f98cb..79856cd6 100644 --- a/c++/src/connect/mbedtls/certs.c +++ b/c++/src/connect/mbedtls/certs.c @@ -2,19 +2,7 @@ * X.509 test certificates * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" @@ -38,69 +26,69 @@ /* This is taken from tests/data_files/test-ca2.crt */ /* BEGIN FILE string macro TEST_CA_CRT_EC_PEM tests/data_files/test-ca2.crt */ -#define TEST_CA_CRT_EC_PEM \ - "-----BEGIN CERTIFICATE-----\r\n" \ - "MIICBDCCAYigAwIBAgIJAMFD4n5iQ8zoMAwGCCqGSM49BAMCBQAwPjELMAkGA1UE\r\n" \ - "BhMCTkwxETAPBgNVBAoMCFBvbGFyU1NMMRwwGgYDVQQDDBNQb2xhcnNzbCBUZXN0\r\n" \ - "IEVDIENBMB4XDTE5MDIxMDE0NDQwMFoXDTI5MDIxMDE0NDQwMFowPjELMAkGA1UE\r\n" \ - "BhMCTkwxETAPBgNVBAoMCFBvbGFyU1NMMRwwGgYDVQQDDBNQb2xhcnNzbCBUZXN0\r\n" \ - "IEVDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEw9orNEE3WC+HVv78ibopQ0tO\r\n" \ - "4G7DDldTMzlY1FK0kZU5CyPfXxckYkj8GpUpziwth8KIUoCv1mqrId240xxuWLjK\r\n" \ - "6LJpjvNBrSnDtF91p0dv1RkpVWmaUzsgtGYWYDMeo1AwTjAMBgNVHRMEBTADAQH/\r\n" \ - "MB0GA1UdDgQWBBSdbSAkSQE/K8t4tRm8fiTJ2/s2fDAfBgNVHSMEGDAWgBSdbSAk\r\n" \ - "SQE/K8t4tRm8fiTJ2/s2fDAMBggqhkjOPQQDAgUAA2gAMGUCMFHKrjAPpHB0BN1a\r\n" \ - "LH8TwcJ3vh0AxeKZj30mRdOKBmg/jLS3rU3g8VQBHpn8sOTTBwIxANxPO5AerimZ\r\n" \ - "hCjMe0d4CTHf1gFZMF70+IqEP+o5VHsIp2Cqvflb0VGWFC5l9a4cQg==\r\n" \ +#define TEST_CA_CRT_EC_PEM \ + "-----BEGIN CERTIFICATE-----\r\n" \ + "MIICBDCCAYigAwIBAgIJAMFD4n5iQ8zoMAwGCCqGSM49BAMCBQAwPjELMAkGA1UE\r\n" \ + "BhMCTkwxETAPBgNVBAoMCFBvbGFyU1NMMRwwGgYDVQQDDBNQb2xhcnNzbCBUZXN0\r\n" \ + "IEVDIENBMB4XDTE5MDIxMDE0NDQwMFoXDTI5MDIxMDE0NDQwMFowPjELMAkGA1UE\r\n" \ + "BhMCTkwxETAPBgNVBAoMCFBvbGFyU1NMMRwwGgYDVQQDDBNQb2xhcnNzbCBUZXN0\r\n" \ + "IEVDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEw9orNEE3WC+HVv78ibopQ0tO\r\n" \ + "4G7DDldTMzlY1FK0kZU5CyPfXxckYkj8GpUpziwth8KIUoCv1mqrId240xxuWLjK\r\n" \ + "6LJpjvNBrSnDtF91p0dv1RkpVWmaUzsgtGYWYDMeo1AwTjAMBgNVHRMEBTADAQH/\r\n" \ + "MB0GA1UdDgQWBBSdbSAkSQE/K8t4tRm8fiTJ2/s2fDAfBgNVHSMEGDAWgBSdbSAk\r\n" \ + "SQE/K8t4tRm8fiTJ2/s2fDAMBggqhkjOPQQDAgUAA2gAMGUCMFHKrjAPpHB0BN1a\r\n" \ + "LH8TwcJ3vh0AxeKZj30mRdOKBmg/jLS3rU3g8VQBHpn8sOTTBwIxANxPO5AerimZ\r\n" \ + "hCjMe0d4CTHf1gFZMF70+IqEP+o5VHsIp2Cqvflb0VGWFC5l9a4cQg==\r\n" \ "-----END CERTIFICATE-----\r\n" /* END FILE */ /* This is generated from tests/data_files/test-ca2.crt.der using `xxd -i`. */ /* BEGIN FILE binary macro TEST_CA_CRT_EC_DER tests/data_files/test-ca2.crt.der */ -#define TEST_CA_CRT_EC_DER { \ - 0x30, 0x82, 0x02, 0x04, 0x30, 0x82, 0x01, 0x88, 0xa0, 0x03, 0x02, 0x01, \ - 0x02, 0x02, 0x09, 0x00, 0xc1, 0x43, 0xe2, 0x7e, 0x62, 0x43, 0xcc, 0xe8, \ - 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, \ - 0x05, 0x00, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, \ - 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, \ - 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, \ - 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x13, 0x50, \ - 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, 0x54, 0x65, 0x73, 0x74, \ - 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x39, \ - 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, 0x30, 0x5a, 0x17, \ - 0x0d, 0x32, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, \ - 0x30, 0x5a, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, \ - 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, \ - 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, \ - 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x13, 0x50, \ - 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, 0x54, 0x65, 0x73, 0x74, \ - 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x30, 0x76, 0x30, 0x10, 0x06, 0x07, \ - 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, 0x2b, 0x81, 0x04, \ - 0x00, 0x22, 0x03, 0x62, 0x00, 0x04, 0xc3, 0xda, 0x2b, 0x34, 0x41, 0x37, \ - 0x58, 0x2f, 0x87, 0x56, 0xfe, 0xfc, 0x89, 0xba, 0x29, 0x43, 0x4b, 0x4e, \ - 0xe0, 0x6e, 0xc3, 0x0e, 0x57, 0x53, 0x33, 0x39, 0x58, 0xd4, 0x52, 0xb4, \ - 0x91, 0x95, 0x39, 0x0b, 0x23, 0xdf, 0x5f, 0x17, 0x24, 0x62, 0x48, 0xfc, \ - 0x1a, 0x95, 0x29, 0xce, 0x2c, 0x2d, 0x87, 0xc2, 0x88, 0x52, 0x80, 0xaf, \ - 0xd6, 0x6a, 0xab, 0x21, 0xdd, 0xb8, 0xd3, 0x1c, 0x6e, 0x58, 0xb8, 0xca, \ - 0xe8, 0xb2, 0x69, 0x8e, 0xf3, 0x41, 0xad, 0x29, 0xc3, 0xb4, 0x5f, 0x75, \ - 0xa7, 0x47, 0x6f, 0xd5, 0x19, 0x29, 0x55, 0x69, 0x9a, 0x53, 0x3b, 0x20, \ - 0xb4, 0x66, 0x16, 0x60, 0x33, 0x1e, 0xa3, 0x50, 0x30, 0x4e, 0x30, 0x0c, \ - 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, \ - 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x9d, \ - 0x6d, 0x20, 0x24, 0x49, 0x01, 0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc, \ - 0x7e, 0x24, 0xc9, 0xdb, 0xfb, 0x36, 0x7c, 0x30, 0x1f, 0x06, 0x03, 0x55, \ - 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x9d, 0x6d, 0x20, 0x24, \ - 0x49, 0x01, 0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc, 0x7e, 0x24, 0xc9, \ - 0xdb, 0xfb, 0x36, 0x7c, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, \ - 0x3d, 0x04, 0x03, 0x02, 0x05, 0x00, 0x03, 0x68, 0x00, 0x30, 0x65, 0x02, \ - 0x30, 0x51, 0xca, 0xae, 0x30, 0x0f, 0xa4, 0x70, 0x74, 0x04, 0xdd, 0x5a, \ - 0x2c, 0x7f, 0x13, 0xc1, 0xc2, 0x77, 0xbe, 0x1d, 0x00, 0xc5, 0xe2, 0x99, \ - 0x8f, 0x7d, 0x26, 0x45, 0xd3, 0x8a, 0x06, 0x68, 0x3f, 0x8c, 0xb4, 0xb7, \ - 0xad, 0x4d, 0xe0, 0xf1, 0x54, 0x01, 0x1e, 0x99, 0xfc, 0xb0, 0xe4, 0xd3, \ - 0x07, 0x02, 0x31, 0x00, 0xdc, 0x4f, 0x3b, 0x90, 0x1e, 0xae, 0x29, 0x99, \ - 0x84, 0x28, 0xcc, 0x7b, 0x47, 0x78, 0x09, 0x31, 0xdf, 0xd6, 0x01, 0x59, \ - 0x30, 0x5e, 0xf4, 0xf8, 0x8a, 0x84, 0x3f, 0xea, 0x39, 0x54, 0x7b, 0x08, \ - 0xa7, 0x60, 0xaa, 0xbd, 0xf9, 0x5b, 0xd1, 0x51, 0x96, 0x14, 0x2e, 0x65, \ - 0xf5, 0xae, 0x1c, 0x42 \ +#define TEST_CA_CRT_EC_DER { \ + 0x30, 0x82, 0x02, 0x04, 0x30, 0x82, 0x01, 0x88, 0xa0, 0x03, 0x02, 0x01, \ + 0x02, 0x02, 0x09, 0x00, 0xc1, 0x43, 0xe2, 0x7e, 0x62, 0x43, 0xcc, 0xe8, \ + 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, \ + 0x05, 0x00, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, \ + 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, \ + 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, \ + 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x13, 0x50, \ + 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, 0x54, 0x65, 0x73, 0x74, \ + 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x39, \ + 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, 0x30, 0x5a, 0x17, \ + 0x0d, 0x32, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, \ + 0x30, 0x5a, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, \ + 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, \ + 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, \ + 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x13, 0x50, \ + 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, 0x54, 0x65, 0x73, 0x74, \ + 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x30, 0x76, 0x30, 0x10, 0x06, 0x07, \ + 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, 0x2b, 0x81, 0x04, \ + 0x00, 0x22, 0x03, 0x62, 0x00, 0x04, 0xc3, 0xda, 0x2b, 0x34, 0x41, 0x37, \ + 0x58, 0x2f, 0x87, 0x56, 0xfe, 0xfc, 0x89, 0xba, 0x29, 0x43, 0x4b, 0x4e, \ + 0xe0, 0x6e, 0xc3, 0x0e, 0x57, 0x53, 0x33, 0x39, 0x58, 0xd4, 0x52, 0xb4, \ + 0x91, 0x95, 0x39, 0x0b, 0x23, 0xdf, 0x5f, 0x17, 0x24, 0x62, 0x48, 0xfc, \ + 0x1a, 0x95, 0x29, 0xce, 0x2c, 0x2d, 0x87, 0xc2, 0x88, 0x52, 0x80, 0xaf, \ + 0xd6, 0x6a, 0xab, 0x21, 0xdd, 0xb8, 0xd3, 0x1c, 0x6e, 0x58, 0xb8, 0xca, \ + 0xe8, 0xb2, 0x69, 0x8e, 0xf3, 0x41, 0xad, 0x29, 0xc3, 0xb4, 0x5f, 0x75, \ + 0xa7, 0x47, 0x6f, 0xd5, 0x19, 0x29, 0x55, 0x69, 0x9a, 0x53, 0x3b, 0x20, \ + 0xb4, 0x66, 0x16, 0x60, 0x33, 0x1e, 0xa3, 0x50, 0x30, 0x4e, 0x30, 0x0c, \ + 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, \ + 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x9d, \ + 0x6d, 0x20, 0x24, 0x49, 0x01, 0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc, \ + 0x7e, 0x24, 0xc9, 0xdb, 0xfb, 0x36, 0x7c, 0x30, 0x1f, 0x06, 0x03, 0x55, \ + 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x9d, 0x6d, 0x20, 0x24, \ + 0x49, 0x01, 0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc, 0x7e, 0x24, 0xc9, \ + 0xdb, 0xfb, 0x36, 0x7c, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, \ + 0x3d, 0x04, 0x03, 0x02, 0x05, 0x00, 0x03, 0x68, 0x00, 0x30, 0x65, 0x02, \ + 0x30, 0x51, 0xca, 0xae, 0x30, 0x0f, 0xa4, 0x70, 0x74, 0x04, 0xdd, 0x5a, \ + 0x2c, 0x7f, 0x13, 0xc1, 0xc2, 0x77, 0xbe, 0x1d, 0x00, 0xc5, 0xe2, 0x99, \ + 0x8f, 0x7d, 0x26, 0x45, 0xd3, 0x8a, 0x06, 0x68, 0x3f, 0x8c, 0xb4, 0xb7, \ + 0xad, 0x4d, 0xe0, 0xf1, 0x54, 0x01, 0x1e, 0x99, 0xfc, 0xb0, 0xe4, 0xd3, \ + 0x07, 0x02, 0x31, 0x00, 0xdc, 0x4f, 0x3b, 0x90, 0x1e, 0xae, 0x29, 0x99, \ + 0x84, 0x28, 0xcc, 0x7b, 0x47, 0x78, 0x09, 0x31, 0xdf, 0xd6, 0x01, 0x59, \ + 0x30, 0x5e, 0xf4, 0xf8, 0x8a, 0x84, 0x3f, 0xea, 0x39, 0x54, 0x7b, 0x08, \ + 0xa7, 0x60, 0xaa, 0xbd, 0xf9, 0x5b, 0xd1, 0x51, 0x96, 0x14, 0x2e, 0x65, \ + 0xf5, 0xae, 0x1c, 0x42 \ } /* END FILE */ @@ -348,33 +336,33 @@ #define TEST_CA_KEY_RSA_PEM \ "-----BEGIN RSA PRIVATE KEY-----\r\n" \ "Proc-Type: 4,ENCRYPTED\r\n" \ - "DEK-Info: DES-EDE3-CBC,A8A95B05D5B7206B\r\n" \ + "AES-128-CBC,781840E6B804AE83D2AF71127C4CE314\r\n" \ "\r\n" \ - "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\r\n" \ "-----END RSA PRIVATE KEY-----\r\n" /* END FILE */ @@ -501,72 +489,72 @@ /* This is taken from tests/data_files/server5.crt. */ /* BEGIN FILE string macro TEST_SRV_CRT_EC_PEM tests/data_files/server5.crt */ -#define TEST_SRV_CRT_EC_PEM \ - "-----BEGIN CERTIFICATE-----\r\n" \ - "MIICHzCCAaWgAwIBAgIBCTAKBggqhkjOPQQDAjA+MQswCQYDVQQGEwJOTDERMA8G\r\n" \ - "A1UEChMIUG9sYXJTU0wxHDAaBgNVBAMTE1BvbGFyc3NsIFRlc3QgRUMgQ0EwHhcN\r\n" \ - "MTMwOTI0MTU1MjA0WhcNMjMwOTIyMTU1MjA0WjA0MQswCQYDVQQGEwJOTDERMA8G\r\n" \ - "A1UEChMIUG9sYXJTU0wxEjAQBgNVBAMTCWxvY2FsaG9zdDBZMBMGByqGSM49AgEG\r\n" \ - "CCqGSM49AwEHA0IABDfMVtl2CR5acj7HWS3/IG7ufPkGkXTQrRS192giWWKSTuUA\r\n" \ - "2CMR/+ov0jRdXRa9iojCa3cNVc2KKg76Aci07f+jgZ0wgZowCQYDVR0TBAIwADAd\r\n" \ - "BgNVHQ4EFgQUUGGlj9QH2deCAQzlZX+MY0anE74wbgYDVR0jBGcwZYAUnW0gJEkB\r\n" \ - "PyvLeLUZvH4kydv7NnyhQqRAMD4xCzAJBgNVBAYTAk5MMREwDwYDVQQKEwhQb2xh\r\n" \ - "clNTTDEcMBoGA1UEAxMTUG9sYXJzc2wgVGVzdCBFQyBDQYIJAMFD4n5iQ8zoMAoG\r\n" \ - "CCqGSM49BAMCA2gAMGUCMQCaLFzXptui5WQN8LlO3ddh1hMxx6tzgLvT03MTVK2S\r\n" \ - "C12r0Lz3ri/moSEpNZWqPjkCMCE2f53GXcYLqyfyJR078c/xNSUU5+Xxl7VZ414V\r\n" \ - "fGa5kHvHARBPc8YAIVIqDvHH1Q==\r\n" \ +#define TEST_SRV_CRT_EC_PEM \ + "-----BEGIN CERTIFICATE-----\r\n" \ + "MIICHzCCAaWgAwIBAgIBCTAKBggqhkjOPQQDAjA+MQswCQYDVQQGEwJOTDERMA8G\r\n" \ + "A1UECgwIUG9sYXJTU0wxHDAaBgNVBAMME1BvbGFyc3NsIFRlc3QgRUMgQ0EwHhcN\r\n" \ + "MjMwNjE1MDMzNDE4WhcNMzMwNjEyMDMzNDE4WjA0MQswCQYDVQQGEwJOTDERMA8G\r\n" \ + "A1UECgwIUG9sYXJTU0wxEjAQBgNVBAMMCWxvY2FsaG9zdDBZMBMGByqGSM49AgEG\r\n" \ + "CCqGSM49AwEHA0IABDfMVtl2CR5acj7HWS3/IG7ufPkGkXTQrRS192giWWKSTuUA\r\n" \ + "2CMR/+ov0jRdXRa9iojCa3cNVc2KKg76Aci07f+jgZ0wgZowCQYDVR0TBAIwADAd\r\n" \ + "BgNVHQ4EFgQUUGGlj9QH2deCAQzlZX+MY0anE74wbgYDVR0jBGcwZYAUnW0gJEkB\r\n" \ + "PyvLeLUZvH4kydv7NnyhQqRAMD4xCzAJBgNVBAYTAk5MMREwDwYDVQQKDAhQb2xh\r\n" \ + "clNTTDEcMBoGA1UEAwwTUG9sYXJzc2wgVGVzdCBFQyBDQYIJAMFD4n5iQ8zoMAoG\r\n" \ + "CCqGSM49BAMCA2gAMGUCMAHFbGEzx8dZaUlIltT5s1QO9FvKmvFer4uRY3ntEy9S\r\n" \ + "k7DCCozM86WWLjfzbJ78bwIxAJYRPF1CzNEiXPHb9O46ZPHKo2S5x//g/54RowAK\r\n" \ + "uZz+hKPuMi6YY6cIm81jfeaSZQ==\r\n" \ "-----END CERTIFICATE-----\r\n" /* END FILE */ /* This is generated from tests/data_files/server5.crt.der using `xxd -i`. */ /* BEGIN FILE binary macro TEST_SRV_CRT_EC_DER tests/data_files/server5.crt.der */ -#define TEST_SRV_CRT_EC_DER { \ - 0x30, 0x82, 0x02, 0x1f, 0x30, 0x82, 0x01, 0xa5, 0xa0, 0x03, 0x02, 0x01, \ - 0x02, 0x02, 0x01, 0x09, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, \ - 0x3d, 0x04, 0x03, 0x02, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \ - 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, \ - 0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, \ - 0x53, 0x4c, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, \ - 0x13, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, 0x54, 0x65, \ - 0x73, 0x74, 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, \ - 0x31, 0x33, 0x30, 0x39, 0x32, 0x34, 0x31, 0x35, 0x35, 0x32, 0x30, 0x34, \ - 0x5a, 0x17, 0x0d, 0x32, 0x33, 0x30, 0x39, 0x32, 0x32, 0x31, 0x35, 0x35, \ - 0x32, 0x30, 0x34, 0x5a, 0x30, 0x34, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \ - 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, \ - 0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, \ - 0x53, 0x4c, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, \ - 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x30, 0x59, \ - 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, \ - 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, \ - 0x04, 0x37, 0xcc, 0x56, 0xd9, 0x76, 0x09, 0x1e, 0x5a, 0x72, 0x3e, 0xc7, \ - 0x59, 0x2d, 0xff, 0x20, 0x6e, 0xee, 0x7c, 0xf9, 0x06, 0x91, 0x74, 0xd0, \ - 0xad, 0x14, 0xb5, 0xf7, 0x68, 0x22, 0x59, 0x62, 0x92, 0x4e, 0xe5, 0x00, \ - 0xd8, 0x23, 0x11, 0xff, 0xea, 0x2f, 0xd2, 0x34, 0x5d, 0x5d, 0x16, 0xbd, \ - 0x8a, 0x88, 0xc2, 0x6b, 0x77, 0x0d, 0x55, 0xcd, 0x8a, 0x2a, 0x0e, 0xfa, \ - 0x01, 0xc8, 0xb4, 0xed, 0xff, 0xa3, 0x81, 0x9d, 0x30, 0x81, 0x9a, 0x30, \ - 0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1d, \ - 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x50, 0x61, 0xa5, \ - 0x8f, 0xd4, 0x07, 0xd9, 0xd7, 0x82, 0x01, 0x0c, 0xe5, 0x65, 0x7f, 0x8c, \ - 0x63, 0x46, 0xa7, 0x13, 0xbe, 0x30, 0x6e, 0x06, 0x03, 0x55, 0x1d, 0x23, \ - 0x04, 0x67, 0x30, 0x65, 0x80, 0x14, 0x9d, 0x6d, 0x20, 0x24, 0x49, 0x01, \ - 0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc, 0x7e, 0x24, 0xc9, 0xdb, 0xfb, \ - 0x36, 0x7c, 0xa1, 0x42, 0xa4, 0x40, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, \ - 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, \ - 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x50, 0x6f, 0x6c, 0x61, \ - 0x72, 0x53, 0x53, 0x4c, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, \ - 0x03, 0x13, 0x13, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, \ - 0x54, 0x65, 0x73, 0x74, 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x82, 0x09, \ - 0x00, 0xc1, 0x43, 0xe2, 0x7e, 0x62, 0x43, 0xcc, 0xe8, 0x30, 0x0a, 0x06, \ - 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x68, 0x00, \ - 0x30, 0x65, 0x02, 0x31, 0x00, 0x9a, 0x2c, 0x5c, 0xd7, 0xa6, 0xdb, 0xa2, \ - 0xe5, 0x64, 0x0d, 0xf0, 0xb9, 0x4e, 0xdd, 0xd7, 0x61, 0xd6, 0x13, 0x31, \ - 0xc7, 0xab, 0x73, 0x80, 0xbb, 0xd3, 0xd3, 0x73, 0x13, 0x54, 0xad, 0x92, \ - 0x0b, 0x5d, 0xab, 0xd0, 0xbc, 0xf7, 0xae, 0x2f, 0xe6, 0xa1, 0x21, 0x29, \ - 0x35, 0x95, 0xaa, 0x3e, 0x39, 0x02, 0x30, 0x21, 0x36, 0x7f, 0x9d, 0xc6, \ - 0x5d, 0xc6, 0x0b, 0xab, 0x27, 0xf2, 0x25, 0x1d, 0x3b, 0xf1, 0xcf, 0xf1, \ - 0x35, 0x25, 0x14, 0xe7, 0xe5, 0xf1, 0x97, 0xb5, 0x59, 0xe3, 0x5e, 0x15, \ - 0x7c, 0x66, 0xb9, 0x90, 0x7b, 0xc7, 0x01, 0x10, 0x4f, 0x73, 0xc6, 0x00, \ - 0x21, 0x52, 0x2a, 0x0e, 0xf1, 0xc7, 0xd5 \ +#define TEST_SRV_CRT_EC_DER { \ + 0x30, 0x82, 0x02, 0x1f, 0x30, 0x82, 0x01, 0xa5, 0xa0, 0x03, 0x02, 0x01, \ + 0x02, 0x02, 0x01, 0x09, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, \ + 0x3d, 0x04, 0x03, 0x02, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \ + 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, \ + 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, \ + 0x53, 0x4c, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, \ + 0x13, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, 0x54, 0x65, \ + 0x73, 0x74, 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, \ + 0x32, 0x33, 0x30, 0x36, 0x31, 0x35, 0x30, 0x33, 0x33, 0x34, 0x31, 0x38, \ + 0x5a, 0x17, 0x0d, 0x33, 0x33, 0x30, 0x36, 0x31, 0x32, 0x30, 0x33, 0x33, \ + 0x34, 0x31, 0x38, 0x5a, 0x30, 0x34, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \ + 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, \ + 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, \ + 0x53, 0x4c, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, \ + 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x30, 0x59, \ + 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, \ + 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, \ + 0x04, 0x37, 0xcc, 0x56, 0xd9, 0x76, 0x09, 0x1e, 0x5a, 0x72, 0x3e, 0xc7, \ + 0x59, 0x2d, 0xff, 0x20, 0x6e, 0xee, 0x7c, 0xf9, 0x06, 0x91, 0x74, 0xd0, \ + 0xad, 0x14, 0xb5, 0xf7, 0x68, 0x22, 0x59, 0x62, 0x92, 0x4e, 0xe5, 0x00, \ + 0xd8, 0x23, 0x11, 0xff, 0xea, 0x2f, 0xd2, 0x34, 0x5d, 0x5d, 0x16, 0xbd, \ + 0x8a, 0x88, 0xc2, 0x6b, 0x77, 0x0d, 0x55, 0xcd, 0x8a, 0x2a, 0x0e, 0xfa, \ + 0x01, 0xc8, 0xb4, 0xed, 0xff, 0xa3, 0x81, 0x9d, 0x30, 0x81, 0x9a, 0x30, \ + 0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1d, \ + 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x50, 0x61, 0xa5, \ + 0x8f, 0xd4, 0x07, 0xd9, 0xd7, 0x82, 0x01, 0x0c, 0xe5, 0x65, 0x7f, 0x8c, \ + 0x63, 0x46, 0xa7, 0x13, 0xbe, 0x30, 0x6e, 0x06, 0x03, 0x55, 0x1d, 0x23, \ + 0x04, 0x67, 0x30, 0x65, 0x80, 0x14, 0x9d, 0x6d, 0x20, 0x24, 0x49, 0x01, \ + 0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc, 0x7e, 0x24, 0xc9, 0xdb, 0xfb, \ + 0x36, 0x7c, 0xa1, 0x42, 0xa4, 0x40, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, \ + 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, \ + 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, \ + 0x72, 0x53, 0x53, 0x4c, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, \ + 0x03, 0x0c, 0x13, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, \ + 0x54, 0x65, 0x73, 0x74, 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x82, 0x09, \ + 0x00, 0xc1, 0x43, 0xe2, 0x7e, 0x62, 0x43, 0xcc, 0xe8, 0x30, 0x0a, 0x06, \ + 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x68, 0x00, \ + 0x30, 0x65, 0x02, 0x30, 0x01, 0xc5, 0x6c, 0x61, 0x33, 0xc7, 0xc7, 0x59, \ + 0x69, 0x49, 0x48, 0x96, 0xd4, 0xf9, 0xb3, 0x54, 0x0e, 0xf4, 0x5b, 0xca, \ + 0x9a, 0xf1, 0x5e, 0xaf, 0x8b, 0x91, 0x63, 0x79, 0xed, 0x13, 0x2f, 0x52, \ + 0x93, 0xb0, 0xc2, 0x0a, 0x8c, 0xcc, 0xf3, 0xa5, 0x96, 0x2e, 0x37, 0xf3, \ + 0x6c, 0x9e, 0xfc, 0x6f, 0x02, 0x31, 0x00, 0x96, 0x11, 0x3c, 0x5d, 0x42, \ + 0xcc, 0xd1, 0x22, 0x5c, 0xf1, 0xdb, 0xf4, 0xee, 0x3a, 0x64, 0xf1, 0xca, \ + 0xa3, 0x64, 0xb9, 0xc7, 0xff, 0xe0, 0xff, 0x9e, 0x11, 0xa3, 0x00, 0x0a, \ + 0xb9, 0x9c, 0xfe, 0x84, 0xa3, 0xee, 0x32, 0x2e, 0x98, 0x63, 0xa7, 0x08, \ + 0x9b, 0xcd, 0x63, 0x7d, 0xe6, 0x92, 0x65 \ } /* END FILE */ diff --git a/c++/src/connect/mbedtls/chacha20.c b/c++/src/connect/mbedtls/chacha20.c index 53f1d391..82b7b1d8 100644 --- a/c++/src/connect/mbedtls/chacha20.c +++ b/c++/src/connect/mbedtls/chacha20.c @@ -6,19 +6,7 @@ * \author Daniel King * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/chachapoly.c b/c++/src/connect/mbedtls/chachapoly.c index ceb42928..dd678f4c 100644 --- a/c++/src/connect/mbedtls/chachapoly.c +++ b/c++/src/connect/mbedtls/chachapoly.c @@ -4,19 +4,7 @@ * \brief ChaCha20-Poly1305 AEAD construction based on RFC 7539. * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" @@ -25,6 +13,7 @@ #include "mbedtls/chachapoly.h" #include "mbedtls/platform_util.h" #include "mbedtls/error.h" +#include "mbedtls/constant_time.h" #include @@ -337,7 +326,6 @@ int mbedtls_chachapoly_auth_decrypt(mbedtls_chachapoly_context *ctx, { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; unsigned char check_tag[16]; - size_t i; int diff; CHACHAPOLY_VALIDATE_RET(ctx != NULL); CHACHAPOLY_VALIDATE_RET(nonce != NULL); @@ -353,9 +341,7 @@ int mbedtls_chachapoly_auth_decrypt(mbedtls_chachapoly_context *ctx, } /* Check tag in "constant-time" */ - for (diff = 0, i = 0; i < sizeof(check_tag); i++) { - diff |= tag[i] ^ check_tag[i]; - } + diff = mbedtls_ct_memcmp(tag, check_tag, sizeof(check_tag)); if (diff != 0) { mbedtls_platform_zeroize(output, length); diff --git a/c++/src/connect/mbedtls/check_crypto_config.h b/c++/src/connect/mbedtls/check_crypto_config.h index b72de80d..0ba32bfe 100644 --- a/c++/src/connect/mbedtls/check_crypto_config.h +++ b/c++/src/connect/mbedtls/check_crypto_config.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* diff --git a/c++/src/connect/mbedtls/cipher.c b/c++/src/connect/mbedtls/cipher.c index 36f87c30..37a2effc 100644 --- a/c++/src/connect/mbedtls/cipher.c +++ b/c++/src/connect/mbedtls/cipher.c @@ -1,24 +1,12 @@ /** * \file cipher.c * - * \brief Generic cipher wrapper for mbed TLS + * \brief Generic cipher wrapper for Mbed TLS * * \author Adriaan de Jong * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" @@ -30,6 +18,7 @@ #include "mbedtls/platform_util.h" #include "mbedtls/error.h" #include "mbedtls/constant_time.h" +#include "constant_time_internal.h" #include #include @@ -748,17 +737,17 @@ static int get_pkcs_padding(unsigned char *input, size_t input_len, *data_len = input_len - padding_len; /* Avoid logical || since it results in a branch */ - bad |= padding_len > input_len; - bad |= padding_len == 0; + bad |= ~mbedtls_ct_size_mask_ge(input_len, padding_len); + bad |= mbedtls_ct_size_bool_eq(padding_len, 0); /* The number of bytes checked must be independent of padding_len, * so pick input_len, which is usually 8 or 16 (one block) */ pad_idx = input_len - padding_len; for (i = 0; i < input_len; i++) { - bad |= (input[i] ^ padding_len) * (i >= pad_idx); + size_t mask = mbedtls_ct_size_mask_ge(i, pad_idx); + bad |= (input[i] ^ padding_len) & mask; } - - return MBEDTLS_ERR_CIPHER_INVALID_PADDING * (bad != 0); + return -(int) mbedtls_ct_uint_if(bad, -MBEDTLS_ERR_CIPHER_INVALID_PADDING, 0); } #endif /* MBEDTLS_CIPHER_PADDING_PKCS7 */ @@ -781,24 +770,29 @@ static void add_one_and_zeros_padding(unsigned char *output, static int get_one_and_zeros_padding(unsigned char *input, size_t input_len, size_t *data_len) { - size_t i; - unsigned char done = 0, prev_done, bad; + unsigned int bad = 1; if (NULL == input || NULL == data_len) { return MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA; } - bad = 0x80; *data_len = 0; - for (i = input_len; i > 0; i--) { - prev_done = done; - done |= (input[i - 1] != 0); - *data_len |= (i - 1) * (done != prev_done); - bad ^= input[i - 1] * (done != prev_done); - } + size_t in_padding = ~0; + + for (ptrdiff_t i = (ptrdiff_t) (input_len) - 1; i >= 0; i--) { + size_t is_nonzero = mbedtls_ct_uint_mask(input[i]); + + size_t hit_first_nonzero = is_nonzero & in_padding; - return MBEDTLS_ERR_CIPHER_INVALID_PADDING * (bad != 0); + *data_len = (*data_len & ~hit_first_nonzero) | ((size_t) i & hit_first_nonzero); + + bad = mbedtls_ct_uint_if((unsigned int) hit_first_nonzero, + !mbedtls_ct_size_bool_eq(input[i], 0x80), bad); + + in_padding = in_padding & ~is_nonzero; + } + return -(int) mbedtls_ct_uint_if(bad, -MBEDTLS_ERR_CIPHER_INVALID_PADDING, 0); } #endif /* MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS */ @@ -832,16 +826,17 @@ static int get_zeros_and_len_padding(unsigned char *input, size_t input_len, *data_len = input_len - padding_len; /* Avoid logical || since it results in a branch */ - bad |= padding_len > input_len; - bad |= padding_len == 0; + bad |= mbedtls_ct_size_mask_ge(padding_len, input_len + 1); + bad |= mbedtls_ct_size_bool_eq(padding_len, 0); /* The number of bytes checked must be independent of padding_len */ pad_idx = input_len - padding_len; for (i = 0; i < input_len - 1; i++) { - bad |= input[i] * (i >= pad_idx); + size_t mask = mbedtls_ct_size_mask_ge(i, pad_idx); + bad |= input[i] & mask; } - return MBEDTLS_ERR_CIPHER_INVALID_PADDING * (bad != 0); + return -(int) mbedtls_ct_uint_if(bad, -MBEDTLS_ERR_CIPHER_INVALID_PADDING, 0); } #endif /* MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN */ @@ -872,8 +867,9 @@ static int get_zeros_padding(unsigned char *input, size_t input_len, *data_len = 0; for (i = input_len; i > 0; i--) { prev_done = done; - done |= (input[i-1] != 0); - *data_len |= i * (done != prev_done); + done |= !mbedtls_ct_size_bool_eq(input[i-1], 0); + size_t mask = mbedtls_ct_size_mask(done ^ prev_done); + *data_len |= i & mask; } return 0; diff --git a/c++/src/connect/mbedtls/cipher_wrap.c b/c++/src/connect/mbedtls/cipher_wrap.c index 737cf977..5f8dde3f 100644 --- a/c++/src/connect/mbedtls/cipher_wrap.c +++ b/c++/src/connect/mbedtls/cipher_wrap.c @@ -1,24 +1,12 @@ /** * \file cipher_wrap.c * - * \brief Generic cipher wrapper for mbed TLS + * \brief Generic cipher wrapper for Mbed TLS * * \author Adriaan de Jong * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/cmac.c b/c++/src/connect/mbedtls/cmac.c index 0c07de6f..32a9a0e5 100644 --- a/c++/src/connect/mbedtls/cmac.c +++ b/c++/src/connect/mbedtls/cmac.c @@ -4,19 +4,7 @@ * \brief NIST SP800-38B compliant CMAC implementation for AES and 3DES * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* diff --git a/c++/src/connect/mbedtls/common.h b/c++/src/connect/mbedtls/common.h index e162aa3c..49e2c97e 100644 --- a/c++/src/connect/mbedtls/common.h +++ b/c++/src/connect/mbedtls/common.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_LIBRARY_COMMON_H @@ -362,4 +350,31 @@ static inline const unsigned char *mbedtls_buffer_offset_const( #define MBEDTLS_STATIC_ASSERT(expr, msg) #endif +/* Suppress compiler warnings for unused functions and variables. */ +#if !defined(MBEDTLS_MAYBE_UNUSED) && defined(__has_attribute) +# if __has_attribute(unused) +# define MBEDTLS_MAYBE_UNUSED __attribute__((unused)) +# endif +#endif +#if !defined(MBEDTLS_MAYBE_UNUSED) && defined(__GNUC__) +# define MBEDTLS_MAYBE_UNUSED __attribute__((unused)) +#endif +#if !defined(MBEDTLS_MAYBE_UNUSED) && defined(__IAR_SYSTEMS_ICC__) && defined(__VER__) +/* IAR does support __attribute__((unused)), but only if the -e flag (extended language support) + * is given; the pragma always works. + * Unfortunately the pragma affects the rest of the file where it is used, but this is harmless. + * Check for version 5.2 or later - this pragma may be supported by earlier versions, but I wasn't + * able to find documentation). + */ +# if (__VER__ >= 5020000) +# define MBEDTLS_MAYBE_UNUSED _Pragma("diag_suppress=Pe177") +# endif +#endif +#if !defined(MBEDTLS_MAYBE_UNUSED) && defined(_MSC_VER) +# define MBEDTLS_MAYBE_UNUSED __pragma(warning(suppress:4189)) +#endif +#if !defined(MBEDTLS_MAYBE_UNUSED) +# define MBEDTLS_MAYBE_UNUSED +#endif + #endif /* MBEDTLS_LIBRARY_COMMON_H */ diff --git a/c++/src/connect/mbedtls/constant_time.c b/c++/src/connect/mbedtls/constant_time.c index 52793012..002ca491 100644 --- a/c++/src/connect/mbedtls/constant_time.c +++ b/c++/src/connect/mbedtls/constant_time.c @@ -2,19 +2,7 @@ * Constant-time functions * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* @@ -80,7 +68,8 @@ unsigned mbedtls_ct_uint_mask(unsigned value) #endif } -#if defined(MBEDTLS_SSL_SOME_MODES_USE_MAC) +#if defined(MBEDTLS_SSL_SOME_MODES_USE_MAC) || defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) || \ + defined(MBEDTLS_NIST_KW_C) || defined(MBEDTLS_CIPHER_MODE_CBC) size_t mbedtls_ct_size_mask(size_t value) { @@ -96,7 +85,8 @@ size_t mbedtls_ct_size_mask(size_t value) #endif } -#endif /* MBEDTLS_SSL_SOME_MODES_USE_MAC */ +#endif /* defined(MBEDTLS_SSL_SOME_MODES_USE_MAC) || defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) || + defined(MBEDTLS_NIST_KW_C) || defined(MBEDTLS_CIPHER_MODE_CBC) */ #if defined(MBEDTLS_BIGNUM_C) @@ -116,7 +106,8 @@ mbedtls_mpi_uint mbedtls_ct_mpi_uint_mask(mbedtls_mpi_uint value) #endif /* MBEDTLS_BIGNUM_C */ -#if defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) +#if defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) || defined(MBEDTLS_NIST_KW_C) || \ + defined(MBEDTLS_CIPHER_MODE_CBC) /** Constant-flow mask generation for "less than" comparison: * - if \p x < \p y, return all-bits 1, that is (size_t) -1 @@ -151,7 +142,8 @@ size_t mbedtls_ct_size_mask_ge(size_t x, return ~mbedtls_ct_size_mask_lt(x, y); } -#endif /* MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC */ +#endif /* defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) || defined(MBEDTLS_NIST_KW_C) || + defined(MBEDTLS_CIPHER_MODE_CBC) */ #if defined(MBEDTLS_BASE64_C) @@ -263,40 +255,6 @@ unsigned mbedtls_ct_uint_if(unsigned condition, #if defined(MBEDTLS_BIGNUM_C) -/** Select between two sign values without branches. - * - * This is functionally equivalent to `condition ? if1 : if0` but uses only bit - * operations in order to avoid branches. - * - * \note if1 and if0 must be either 1 or -1, otherwise the result - * is undefined. - * - * \param condition Condition to test; must be either 0 or 1. - * \param if1 The first sign; must be either +1 or -1. - * \param if0 The second sign; must be either +1 or -1. - * - * \return \c if1 if \p condition is nonzero, otherwise \c if0. - * */ -static int mbedtls_ct_cond_select_sign(unsigned char condition, - int if1, - int if0) -{ - /* In order to avoid questions about what we can reasonably assume about - * the representations of signed integers, move everything to unsigned - * by taking advantage of the fact that if1 and if0 are either +1 or -1. */ - unsigned uif1 = if1 + 1; - unsigned uif0 = if0 + 1; - - /* condition was 0 or 1, mask is 0 or 2 as are uif1 and uif0 */ - const unsigned mask = condition << 1; - - /* select uif1 or uif0 */ - unsigned ur = (uif0 & ~mask) | (uif1 & mask); - - /* ur is now 0 or 2, convert back to -1 or +1 */ - return (int) ur - 1; -} - void mbedtls_ct_mpi_uint_cond_assign(size_t n, mbedtls_mpi_uint *dest, const mbedtls_mpi_uint *src, @@ -559,7 +517,7 @@ int mbedtls_mpi_safe_cond_assign(mbedtls_mpi *X, MBEDTLS_MPI_CHK(mbedtls_mpi_grow(X, Y->n)); - X->s = mbedtls_ct_cond_select_sign(assign, Y->s, X->s); + X->s = (int) mbedtls_ct_uint_if(assign, Y->s, X->s); mbedtls_ct_mpi_uint_cond_assign(Y->n, X->p, Y->p, assign); @@ -599,8 +557,8 @@ int mbedtls_mpi_safe_cond_swap(mbedtls_mpi *X, MBEDTLS_MPI_CHK(mbedtls_mpi_grow(Y, X->n)); s = X->s; - X->s = mbedtls_ct_cond_select_sign(swap, Y->s, X->s); - Y->s = mbedtls_ct_cond_select_sign(swap, s, Y->s); + X->s = (int) mbedtls_ct_uint_if(swap, Y->s, X->s); + Y->s = (int) mbedtls_ct_uint_if(swap, s, Y->s); for (i = 0; i < X->n; i++) { diff --git a/c++/src/connect/mbedtls/constant_time_internal.h b/c++/src/connect/mbedtls/constant_time_internal.h index 402cf148..82e65cc0 100644 --- a/c++/src/connect/mbedtls/constant_time_internal.h +++ b/c++/src/connect/mbedtls/constant_time_internal.h @@ -2,19 +2,7 @@ * Constant-time functions * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_CONSTANT_TIME_INTERNAL_H @@ -45,7 +33,8 @@ */ unsigned mbedtls_ct_uint_mask(unsigned value); -#if defined(MBEDTLS_SSL_SOME_MODES_USE_MAC) +#if defined(MBEDTLS_SSL_SOME_MODES_USE_MAC) || defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) || \ + defined(MBEDTLS_NIST_KW_C) || defined(MBEDTLS_CIPHER_MODE_CBC) /** Turn a value into a mask: * - if \p value == 0, return the all-bits 0 mask, aka 0 @@ -60,7 +49,8 @@ unsigned mbedtls_ct_uint_mask(unsigned value); */ size_t mbedtls_ct_size_mask(size_t value); -#endif /* MBEDTLS_SSL_SOME_MODES_USE_MAC */ +#endif /* defined(MBEDTLS_SSL_SOME_MODES_USE_MAC) || defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) || + defined(MBEDTLS_NIST_KW_C) || defined(MBEDTLS_CIPHER_MODE_CBC) */ #if defined(MBEDTLS_BIGNUM_C) @@ -79,7 +69,8 @@ mbedtls_mpi_uint mbedtls_ct_mpi_uint_mask(mbedtls_mpi_uint value); #endif /* MBEDTLS_BIGNUM_C */ -#if defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) +#if defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) || defined(MBEDTLS_NIST_KW_C) || \ + defined(MBEDTLS_CIPHER_MODE_CBC) /** Constant-flow mask generation for "greater or equal" comparison: * - if \p x >= \p y, return all-bits 1, that is (size_t) -1 @@ -97,7 +88,8 @@ mbedtls_mpi_uint mbedtls_ct_mpi_uint_mask(mbedtls_mpi_uint value); size_t mbedtls_ct_size_mask_ge(size_t x, size_t y); -#endif /* MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC */ +#endif /* defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) || defined(MBEDTLS_NIST_KW_C) || + defined(MBEDTLS_CIPHER_MODE_CBC) */ /** Constant-flow boolean "equal" comparison: * return x == y diff --git a/c++/src/connect/mbedtls/constant_time_invasive.h b/c++/src/connect/mbedtls/constant_time_invasive.h index c176b28f..14e0bec5 100644 --- a/c++/src/connect/mbedtls/constant_time_invasive.h +++ b/c++/src/connect/mbedtls/constant_time_invasive.h @@ -9,19 +9,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_CONSTANT_TIME_INVASIVE_H diff --git a/c++/src/connect/mbedtls/ctr_drbg.c b/c++/src/connect/mbedtls/ctr_drbg.c index 652c5cbc..53987a22 100644 --- a/c++/src/connect/mbedtls/ctr_drbg.c +++ b/c++/src/connect/mbedtls/ctr_drbg.c @@ -2,24 +2,12 @@ * CTR_DRBG implementation based on AES-256 (NIST SP 800-90) * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The NIST SP 800-90 DRBGs are described in the following publication. * - * http://csrc.nist.gov/publications/nistpubs/800-90/SP800-90revised_March2007.pdf + * https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-90r.pdf */ #include "common.h" @@ -30,6 +18,7 @@ #include "mbedtls/platform_util.h" #include "mbedtls/error.h" +#include #include #if defined(MBEDTLS_FS_IO) diff --git a/c++/src/connect/mbedtls/debug.c b/c++/src/connect/mbedtls/debug.c index ab8b3524..f2d8dced 100644 --- a/c++/src/connect/mbedtls/debug.c +++ b/c++/src/connect/mbedtls/debug.c @@ -2,19 +2,7 @@ * Debugging routines * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" @@ -30,6 +18,7 @@ #include #include +/* DEBUG_BUF_SIZE must be at least 2 */ #define DEBUG_BUF_SIZE 512 static int debug_threshold = 0; @@ -69,6 +58,8 @@ void mbedtls_debug_print_msg(const mbedtls_ssl_context *ssl, int level, char str[DEBUG_BUF_SIZE]; int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; + MBEDTLS_STATIC_ASSERT(DEBUG_BUF_SIZE >= 2, "DEBUG_BUF_SIZE too small"); + if (NULL == ssl || NULL == ssl->conf || NULL == ssl->conf->f_dbg || @@ -80,10 +71,15 @@ void mbedtls_debug_print_msg(const mbedtls_ssl_context *ssl, int level, ret = mbedtls_vsnprintf(str, DEBUG_BUF_SIZE, format, argp); va_end(argp); - if (ret >= 0 && ret < DEBUG_BUF_SIZE - 1) { - str[ret] = '\n'; - str[ret + 1] = '\0'; + if (ret < 0) { + ret = 0; + } else { + if (ret >= DEBUG_BUF_SIZE - 1) { + ret = DEBUG_BUF_SIZE - 2; + } } + str[ret] = '\n'; + str[ret + 1] = '\0'; debug_send_line(ssl, level, file, line, str); } diff --git a/c++/src/connect/mbedtls/des.c b/c++/src/connect/mbedtls/des.c index 8cf346f8..afe72cec 100644 --- a/c++/src/connect/mbedtls/des.c +++ b/c++/src/connect/mbedtls/des.c @@ -2,19 +2,7 @@ * FIPS-46-3 compliant Triple-DES implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * DES, on which TDES is based, was originally designed by Horst Feistel diff --git a/c++/src/connect/mbedtls/dhm.c b/c++/src/connect/mbedtls/dhm.c index c6f955ee..1a41b91a 100644 --- a/c++/src/connect/mbedtls/dhm.c +++ b/c++/src/connect/mbedtls/dhm.c @@ -2,19 +2,7 @@ * Diffie-Hellman-Merkle key exchange * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The following sources were referenced in the design of this implementation diff --git a/c++/src/connect/mbedtls/ecdh.c b/c++/src/connect/mbedtls/ecdh.c index 2007e167..29a732a0 100644 --- a/c++/src/connect/mbedtls/ecdh.c +++ b/c++/src/connect/mbedtls/ecdh.c @@ -2,25 +2,13 @@ * Elliptic curve Diffie-Hellman * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * References: * - * SEC1 http://www.secg.org/index.php?action=secg,docs_secg + * SEC1 https://www.secg.org/sec1-v2.pdf * RFC 4492 */ diff --git a/c++/src/connect/mbedtls/ecdsa.c b/c++/src/connect/mbedtls/ecdsa.c index 42a65dcb..51aba0ed 100644 --- a/c++/src/connect/mbedtls/ecdsa.c +++ b/c++/src/connect/mbedtls/ecdsa.c @@ -2,25 +2,13 @@ * Elliptic curve DSA * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * References: * - * SEC1 http://www.secg.org/index.php?action=secg,docs_secg + * SEC1 https://www.secg.org/sec1-v2.pdf */ #include "common.h" @@ -240,6 +228,19 @@ cleanup: } #endif /* ECDSA_DETERMINISTIC || !ECDSA_SIGN_ALT || !ECDSA_VERIFY_ALT */ +int mbedtls_ecdsa_can_do(mbedtls_ecp_group_id gid) +{ + switch (gid) { +#ifdef MBEDTLS_ECP_DP_CURVE25519_ENABLED + case MBEDTLS_ECP_DP_CURVE25519: return 0; +#endif +#ifdef MBEDTLS_ECP_DP_CURVE448_ENABLED + case MBEDTLS_ECP_DP_CURVE448: return 0; +#endif + default: return 1; + } +} + #if !defined(MBEDTLS_ECDSA_SIGN_ALT) /* * Compute ECDSA signature of a hashed message (SEC1 4.1.3) @@ -366,7 +367,7 @@ modn: #if defined(MBEDTLS_ECP_RESTARTABLE) if (rs_ctx != NULL && rs_ctx->sig != NULL) { - mbedtls_mpi_copy(r, pr); + MBEDTLS_MPI_CHK(mbedtls_mpi_copy(r, pr)); } #endif @@ -379,19 +380,6 @@ cleanup: return ret; } -int mbedtls_ecdsa_can_do(mbedtls_ecp_group_id gid) -{ - switch (gid) { -#ifdef MBEDTLS_ECP_DP_CURVE25519_ENABLED - case MBEDTLS_ECP_DP_CURVE25519: return 0; -#endif -#ifdef MBEDTLS_ECP_DP_CURVE448_ENABLED - case MBEDTLS_ECP_DP_CURVE448: return 0; -#endif - default: return 1; - } -} - /* * Compute ECDSA signature of a hashed message */ @@ -457,7 +445,7 @@ static int ecdsa_sign_det_restartable(mbedtls_ecp_group *grp, MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(d, data, grp_len)); MBEDTLS_MPI_CHK(derive_mpi(grp, &h, buf, blen)); MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&h, data + grp_len, grp_len)); - mbedtls_hmac_drbg_seed_buf(p_rng, md_info, data, 2 * grp_len); + MBEDTLS_MPI_CHK(mbedtls_hmac_drbg_seed_buf(p_rng, md_info, data, 2 * grp_len)); #if defined(MBEDTLS_ECP_RESTARTABLE) if (rs_ctx != NULL && rs_ctx->det != NULL) { diff --git a/c++/src/connect/mbedtls/ecjpake.c b/c++/src/connect/mbedtls/ecjpake.c index 3728d1a5..102c24ab 100644 --- a/c++/src/connect/mbedtls/ecjpake.c +++ b/c++/src/connect/mbedtls/ecjpake.c @@ -2,19 +2,7 @@ * Elliptic curve J-PAKE * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* @@ -1060,7 +1048,7 @@ int mbedtls_ecjpake_self_test(int verbose) #if !defined(MBEDTLS_ECJPAKE_ALT) /* 'reference handshake' tests can only be run against implementations * for which we have 100% control over how the random ephemeral keys - * are generated. This is only the case for the internal mbed TLS + * are generated. This is only the case for the internal Mbed TLS * implementation, so these tests are skipped in case the internal * implementation is swapped out for an alternative one. */ if (verbose != 0) { diff --git a/c++/src/connect/mbedtls/ecp.c b/c++/src/connect/mbedtls/ecp.c index 9051490b..cfe02b0d 100644 --- a/c++/src/connect/mbedtls/ecp.c +++ b/c++/src/connect/mbedtls/ecp.c @@ -2,31 +2,21 @@ * Elliptic curves over GF(p): generic functions * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * References: * - * SEC1 http://www.secg.org/index.php?action=secg,docs_secg + * SEC1 https://www.secg.org/sec1-v2.pdf * GECC = Guide to Elliptic Curve Cryptography - Hankerson, Menezes, Vanstone * FIPS 186-3 http://csrc.nist.gov/publications/fips/fips186-3/fips_186-3.pdf * RFC 4492 for the related TLS structures and constants + * - https://www.rfc-editor.org/rfc/rfc4492 * RFC 7748 for the Curve448 and Curve25519 curve definitions + * - https://www.rfc-editor.org/rfc/rfc7748 * - * [Curve25519] http://cr.yp.to/ecdh/curve25519-20060209.pdf + * [Curve25519] https://cr.yp.to/ecdh/curve25519-20060209.pdf * * [2] CORON, Jean-S'ebastien. Resistance against differential power analysis * for elliptic curve cryptosystems. In : Cryptographic Hardware and @@ -164,7 +154,7 @@ static int ecp_drbg_seed(ecp_drbg_context *ctx, unsigned char secret_bytes[MBEDTLS_ECP_MAX_BYTES]; /* The list starts with strong hashes */ const mbedtls_md_type_t md_type = - (const mbedtls_md_type_t) (mbedtls_md_list()[0]); + (mbedtls_md_type_t) (mbedtls_md_list()[0]); const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type(md_type); if (secret_len > MBEDTLS_ECP_MAX_BYTES) { @@ -937,7 +927,7 @@ int mbedtls_ecp_point_read_binary(const mbedtls_ecp_group *grp, size_t plen; ECP_VALIDATE_RET(grp != NULL); ECP_VALIDATE_RET(pt != NULL); - ECP_VALIDATE_RET(buf != NULL); + ECP_VALIDATE_RET(ilen == 0 || buf != NULL); if (ilen < 1) { return MBEDTLS_ERR_ECP_BAD_INPUT_DATA; @@ -1006,7 +996,7 @@ int mbedtls_ecp_tls_read_point(const mbedtls_ecp_group *grp, ECP_VALIDATE_RET(grp != NULL); ECP_VALIDATE_RET(pt != NULL); ECP_VALIDATE_RET(buf != NULL); - ECP_VALIDATE_RET(*buf != NULL); + ECP_VALIDATE_RET(buf_len == 0 || *buf != NULL); /* * We must have at least two bytes (1 for length, at least one for data) @@ -1078,7 +1068,7 @@ int mbedtls_ecp_tls_read_group(mbedtls_ecp_group *grp, mbedtls_ecp_group_id grp_id; ECP_VALIDATE_RET(grp != NULL); ECP_VALIDATE_RET(buf != NULL); - ECP_VALIDATE_RET(*buf != NULL); + ECP_VALIDATE_RET(len == 0 || *buf != NULL); if ((ret = mbedtls_ecp_tls_read_group_id(&grp_id, buf, len)) != 0) { return ret; @@ -1098,7 +1088,7 @@ int mbedtls_ecp_tls_read_group_id(mbedtls_ecp_group_id *grp, const mbedtls_ecp_curve_info *curve_info; ECP_VALIDATE_RET(grp != NULL); ECP_VALIDATE_RET(buf != NULL); - ECP_VALIDATE_RET(*buf != NULL); + ECP_VALIDATE_RET(len == 0 || *buf != NULL); /* * We expect at least three bytes (see below) @@ -2591,6 +2581,7 @@ static int ecp_mul_mxz(mbedtls_ecp_group *grp, mbedtls_ecp_point *R, void *p_rng) { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; + int have_rng = 1; size_t i; unsigned char b; mbedtls_ecp_point RP; @@ -2624,7 +2615,6 @@ static int ecp_mul_mxz(mbedtls_ecp_group *grp, mbedtls_ecp_point *R, MOD_ADD(RP.X); /* Randomize coordinates of the starting point */ - int have_rng = 1; #if defined(MBEDTLS_ECP_NO_INTERNAL_RNG) if (f_rng == NULL) { have_rng = 0; @@ -3368,10 +3358,10 @@ cleanup: int mbedtls_ecp_write_key(mbedtls_ecp_keypair *key, unsigned char *buf, size_t buflen) { - int ret = MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE; + int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; ECP_VALIDATE_RET(key != NULL); - ECP_VALIDATE_RET(buf != NULL); + ECP_VALIDATE_RET(buflen == 0 || buf != NULL); #if defined(MBEDTLS_ECP_MONTGOMERY_ENABLED) if (mbedtls_ecp_get_type(&key->grp) == MBEDTLS_ECP_TYPE_MONTGOMERY) { diff --git a/c++/src/connect/mbedtls/ecp_curves.c b/c++/src/connect/mbedtls/ecp_curves.c index 6ce4f64c..61a1046f 100644 --- a/c++/src/connect/mbedtls/ecp_curves.c +++ b/c++/src/connect/mbedtls/ecp_curves.c @@ -2,19 +2,7 @@ * Elliptic curves over GF(p): curve-specific data and functions * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" @@ -547,10 +535,10 @@ static inline void ecp_mpi_load(mbedtls_mpi *X, const mbedtls_mpi_uint *p, size_ */ static inline void ecp_mpi_set1(mbedtls_mpi *X) { - static mbedtls_mpi_uint one[] = { 1 }; + static const mbedtls_mpi_uint one[] = { 1 }; X->s = 1; X->n = 1; - X->p = one; + X->p = (mbedtls_mpi_uint *) one; /* X->p will not be modified so the cast is safe */ } /* @@ -1360,7 +1348,7 @@ cleanup: */ #define P_KOBLITZ_MAX (256 / 8 / sizeof(mbedtls_mpi_uint)) // Max limbs in P #define P_KOBLITZ_R (8 / sizeof(mbedtls_mpi_uint)) // Limbs in R -static inline int ecp_mod_koblitz(mbedtls_mpi *N, mbedtls_mpi_uint *Rp, size_t p_limbs, +static inline int ecp_mod_koblitz(mbedtls_mpi *N, const mbedtls_mpi_uint *Rp, size_t p_limbs, size_t adjust, size_t shift, mbedtls_mpi_uint mask) { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; @@ -1374,7 +1362,7 @@ static inline int ecp_mod_koblitz(mbedtls_mpi *N, mbedtls_mpi_uint *Rp, size_t p /* Init R */ R.s = 1; - R.p = Rp; + R.p = (mbedtls_mpi_uint *) Rp; /* R.p will not be modified so the cast is safe */ R.n = P_KOBLITZ_R; /* Common setup for M */ @@ -1445,7 +1433,7 @@ cleanup: */ static int ecp_mod_p192k1(mbedtls_mpi *N) { - static mbedtls_mpi_uint Rp[] = { + static const mbedtls_mpi_uint Rp[] = { MBEDTLS_BYTES_TO_T_UINT_8(0xC9, 0x11, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00) }; @@ -1462,7 +1450,7 @@ static int ecp_mod_p192k1(mbedtls_mpi *N) */ static int ecp_mod_p224k1(mbedtls_mpi *N) { - static mbedtls_mpi_uint Rp[] = { + static const mbedtls_mpi_uint Rp[] = { MBEDTLS_BYTES_TO_T_UINT_8(0x93, 0x1A, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00) }; @@ -1484,7 +1472,7 @@ static int ecp_mod_p224k1(mbedtls_mpi *N) */ static int ecp_mod_p256k1(mbedtls_mpi *N) { - static mbedtls_mpi_uint Rp[] = { + static const mbedtls_mpi_uint Rp[] = { MBEDTLS_BYTES_TO_T_UINT_8(0xD1, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00) }; diff --git a/c++/src/connect/mbedtls/ecp_invasive.h b/c++/src/connect/mbedtls/ecp_invasive.h index 18815be0..b5a1f7ce 100644 --- a/c++/src/connect/mbedtls/ecp_invasive.h +++ b/c++/src/connect/mbedtls/ecp_invasive.h @@ -9,19 +9,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_ECP_INVASIVE_H #define MBEDTLS_ECP_INVASIVE_H @@ -61,7 +49,7 @@ void mbedtls_ecp_fix_negative(mbedtls_mpi *N, signed char c, size_t bits); * This is the bit-size of the key minus 1: * 254 for Curve25519 or 447 for Curve448. * \param d The randomly generated key. This is a number of size - * exactly \p n_bits + 1 bits, with the least significant bits + * exactly \p high_bit + 1 bits, with the least significant bits * masked as specified in [Curve25519] and in [RFC7748] §5. * \param f_rng The RNG function. * \param p_rng The RNG context to be passed to \p f_rng. @@ -69,7 +57,7 @@ void mbedtls_ecp_fix_negative(mbedtls_mpi *N, signed char c, size_t bits); * \return \c 0 on success. * \return \c MBEDTLS_ERR_ECP_xxx or MBEDTLS_ERR_MPI_xxx on failure. */ -int mbedtls_ecp_gen_privkey_mx(size_t n_bits, +int mbedtls_ecp_gen_privkey_mx(size_t high_bit, mbedtls_mpi *d, int (*f_rng)(void *, unsigned char *, size_t), void *p_rng); diff --git a/c++/src/connect/mbedtls/entropy.c b/c++/src/connect/mbedtls/entropy.c index af78acc1..339dc0e0 100644 --- a/c++/src/connect/mbedtls/entropy.c +++ b/c++/src/connect/mbedtls/entropy.c @@ -2,19 +2,7 @@ * Entropy accumulator implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" @@ -31,6 +19,8 @@ #include "mbedtls/entropy_poll.h" #include "mbedtls/platform_util.h" #include "mbedtls/error.h" +#include "mbedtls/sha256.h" +#include "mbedtls/sha512.h" #include diff --git a/c++/src/connect/mbedtls/entropy_poll.c b/c++/src/connect/mbedtls/entropy_poll.c index 3420616a..f007f2d8 100644 --- a/c++/src/connect/mbedtls/entropy_poll.c +++ b/c++/src/connect/mbedtls/entropy_poll.c @@ -2,22 +2,10 @@ * Platform-specific and custom entropy polling functions * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ -#if defined(__linux__) && !defined(_GNU_SOURCE) +#if defined(__linux__) || defined(__midipix__) && !defined(_GNU_SOURCE) /* Ensure that syscall() is available even when compiling with -std=c99 */ #define _GNU_SOURCE #endif diff --git a/c++/src/connect/mbedtls/error.c b/c++/src/connect/mbedtls/error.c index f4826c8b..cb7ad57e 100644 --- a/c++/src/connect/mbedtls/error.c +++ b/c++/src/connect/mbedtls/error.c @@ -2,19 +2,7 @@ * Error message information * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" @@ -518,6 +506,8 @@ const char *mbedtls_high_level_strerr(int error_code) return( "SSL - A cryptographic operation is in progress. Try again later" ); case -(MBEDTLS_ERR_SSL_BAD_CONFIG): return( "SSL - Invalid value in SSL config" ); + case -(MBEDTLS_ERR_SSL_CACHE_ENTRY_NOT_FOUND): + return( "SSL - Cache entry not found" ); #endif /* MBEDTLS_SSL_TLS_C */ #if defined(MBEDTLS_X509_USE_C) || defined(MBEDTLS_X509_CREATE_C) diff --git a/c++/src/connect/mbedtls/gcm.c b/c++/src/connect/mbedtls/gcm.c index 0c958c72..d3e77327 100644 --- a/c++/src/connect/mbedtls/gcm.c +++ b/c++/src/connect/mbedtls/gcm.c @@ -2,19 +2,7 @@ * NIST SP800-38D compliant GCM implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* @@ -35,6 +23,7 @@ #include "mbedtls/platform.h" #include "mbedtls/platform_util.h" #include "mbedtls/error.h" +#include "mbedtls/constant_time.h" #include @@ -252,7 +241,7 @@ int mbedtls_gcm_starts(mbedtls_gcm_context *ctx, uint64_t iv_bits; GCM_VALIDATE_RET(ctx != NULL); - GCM_VALIDATE_RET(iv != NULL); + GCM_VALIDATE_RET(iv_len == 0 || iv != NULL); GCM_VALIDATE_RET(add_len == 0 || add != NULL); /* IV and AD are limited to 2^64 bits, so 2^61 bytes */ @@ -444,7 +433,7 @@ int mbedtls_gcm_crypt_and_tag(mbedtls_gcm_context *ctx, int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; GCM_VALIDATE_RET(ctx != NULL); - GCM_VALIDATE_RET(iv != NULL); + GCM_VALIDATE_RET(iv_len == 0 || iv != NULL); GCM_VALIDATE_RET(add_len == 0 || add != NULL); GCM_VALIDATE_RET(length == 0 || input != NULL); GCM_VALIDATE_RET(length == 0 || output != NULL); @@ -478,11 +467,10 @@ int mbedtls_gcm_auth_decrypt(mbedtls_gcm_context *ctx, { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; unsigned char check_tag[16]; - size_t i; int diff; GCM_VALIDATE_RET(ctx != NULL); - GCM_VALIDATE_RET(iv != NULL); + GCM_VALIDATE_RET(iv_len == 0 || iv != NULL); GCM_VALIDATE_RET(add_len == 0 || add != NULL); GCM_VALIDATE_RET(tag != NULL); GCM_VALIDATE_RET(length == 0 || input != NULL); @@ -495,9 +483,7 @@ int mbedtls_gcm_auth_decrypt(mbedtls_gcm_context *ctx, } /* Check tag in "constant-time" */ - for (diff = 0, i = 0; i < tag_len; i++) { - diff |= tag[i] ^ check_tag[i]; - } + diff = mbedtls_ct_memcmp(tag, check_tag, tag_len); if (diff != 0) { mbedtls_platform_zeroize(output, length); diff --git a/c++/src/connect/mbedtls/havege.c b/c++/src/connect/mbedtls/havege.c index c23cdad9..3d1f6f48 100644 --- a/c++/src/connect/mbedtls/havege.c +++ b/c++/src/connect/mbedtls/havege.c @@ -2,19 +2,7 @@ * \brief HAVEGE: HArdware Volatile Entropy Gathering and Expansion * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The HAVEGE RNG was designed by Andre Seznec in 2002. diff --git a/c++/src/connect/mbedtls/hkdf.c b/c++/src/connect/mbedtls/hkdf.c index a3f071ec..631ac24e 100644 --- a/c++/src/connect/mbedtls/hkdf.c +++ b/c++/src/connect/mbedtls/hkdf.c @@ -2,19 +2,7 @@ * HKDF implementation -- RFC 5869 * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/hmac_drbg.c b/c++/src/connect/mbedtls/hmac_drbg.c index fabe0025..ee8f8e33 100644 --- a/c++/src/connect/mbedtls/hmac_drbg.c +++ b/c++/src/connect/mbedtls/hmac_drbg.c @@ -2,19 +2,7 @@ * HMAC_DRBG implementation (NIST SP 800-90) * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* diff --git a/c++/src/connect/mbedtls/mbedtls/aes.h b/c++/src/connect/mbedtls/mbedtls/aes.h index fb2322a6..2623a42f 100644 --- a/c++/src/connect/mbedtls/mbedtls/aes.h +++ b/c++/src/connect/mbedtls/mbedtls/aes.h @@ -22,19 +22,7 @@ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_AES_H diff --git a/c++/src/connect/mbedtls/mbedtls/aesni.h b/c++/src/connect/mbedtls/mbedtls/aesni.h index 6741dead..93f06730 100644 --- a/c++/src/connect/mbedtls/mbedtls/aesni.h +++ b/c++/src/connect/mbedtls/mbedtls/aesni.h @@ -8,19 +8,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_AESNI_H #define MBEDTLS_AESNI_H @@ -36,16 +24,20 @@ #define MBEDTLS_AESNI_AES 0x02000000u #define MBEDTLS_AESNI_CLMUL 0x00000002u -/* Can we do AESNI with inline assembly? - * (Only implemented with gas syntax, only for 64-bit.) - */ -#if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && \ - (defined(__amd64__) || defined(__x86_64__)) && \ - !defined(MBEDTLS_HAVE_X86_64) +#if !defined(MBEDTLS_HAVE_X86_64) && \ + (defined(__amd64__) || defined(__x86_64__) || \ + defined(_M_X64) || defined(_M_AMD64)) && \ + !defined(_M_ARM64EC) #define MBEDTLS_HAVE_X86_64 #endif -#if defined(MBEDTLS_AESNI_C) +#if !defined(MBEDTLS_HAVE_X86) && \ + (defined(__i386__) || defined(_M_IX86)) +#define MBEDTLS_HAVE_X86 +#endif + +#if defined(MBEDTLS_AESNI_C) && \ + (defined(MBEDTLS_HAVE_X86_64) || defined(MBEDTLS_HAVE_X86)) /* Can we do AESNI with intrinsics? * (Only implemented with certain compilers, only for certain targets.) @@ -54,7 +46,7 @@ * macros that may change in future releases. */ #undef MBEDTLS_AESNI_HAVE_INTRINSICS -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(__clang__) /* Visual Studio supports AESNI intrinsics since VS 2008 SP1. We only support * VS 2013 and up for other reasons anyway, so no need to check the version. */ #define MBEDTLS_AESNI_HAVE_INTRINSICS @@ -62,7 +54,7 @@ /* GCC-like compilers: currently, we only support intrinsics if the requisite * target flag is enabled when building the library (e.g. `gcc -mpclmul -msse2` * or `clang -maes -mpclmul`). */ -#if defined(__GNUC__) && defined(__AES__) && defined(__PCLMUL__) +#if (defined(__GNUC__) || defined(__clang__)) && defined(__AES__) && defined(__PCLMUL__) #define MBEDTLS_AESNI_HAVE_INTRINSICS #endif @@ -72,7 +64,11 @@ * favor the assembly-based implementation if it's available. We intend to * revise this in a later release of Mbed TLS 3.x. In the long run, we will * likely remove the assembly implementation. */ -#if defined(MBEDTLS_HAVE_X86_64) +#if defined(MBEDTLS_HAVE_ASM) && \ + defined(__GNUC__) && defined(MBEDTLS_HAVE_X86_64) +/* Can we do AESNI with inline assembly? + * (Only implemented with gas syntax, only for 64-bit.) + */ #define MBEDTLS_AESNI_HAVE_CODE 1 // via assembly #elif defined(MBEDTLS_AESNI_HAVE_INTRINSICS) #define MBEDTLS_AESNI_HAVE_CODE 2 // via intrinsics @@ -168,6 +164,6 @@ int mbedtls_aesni_setkey_enc(unsigned char *rk, #endif #endif /* MBEDTLS_AESNI_HAVE_CODE */ -#endif /* MBEDTLS_AESNI_C */ +#endif /* MBEDTLS_AESNI_C && (MBEDTLS_HAVE_X86_64 || MBEDTLS_HAVE_X86) */ #endif /* MBEDTLS_AESNI_H */ diff --git a/c++/src/connect/mbedtls/mbedtls/arc4.h b/c++/src/connect/mbedtls/mbedtls/arc4.h index d116dda4..1f813aa6 100644 --- a/c++/src/connect/mbedtls/mbedtls/arc4.h +++ b/c++/src/connect/mbedtls/mbedtls/arc4.h @@ -8,19 +8,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * */ #ifndef MBEDTLS_ARC4_H diff --git a/c++/src/connect/mbedtls/mbedtls/aria.h b/c++/src/connect/mbedtls/mbedtls/aria.h index 9856a1ca..e360aa64 100644 --- a/c++/src/connect/mbedtls/mbedtls/aria.h +++ b/c++/src/connect/mbedtls/mbedtls/aria.h @@ -11,19 +11,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_ARIA_H @@ -274,10 +262,6 @@ int mbedtls_aria_crypt_cfb128(mbedtls_aria_context *ctx, * \brief This function performs an ARIA-CTR encryption or decryption * operation. * - * This function performs the operation defined in the \p mode - * parameter (encrypt/decrypt), on the input data buffer - * defined in the \p input parameter. - * * Due to the nature of CTR, you must use the same key schedule * for both encryption and decryption operations. Therefore, you * must use the context initialized with mbedtls_aria_setkey_enc() diff --git a/c++/src/connect/mbedtls/mbedtls/asn1.h b/c++/src/connect/mbedtls/mbedtls/asn1.h index 540cdcc4..c676fd36 100644 --- a/c++/src/connect/mbedtls/mbedtls/asn1.h +++ b/c++/src/connect/mbedtls/mbedtls/asn1.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_ASN1_H #define MBEDTLS_ASN1_H @@ -453,7 +441,7 @@ void mbedtls_asn1_sequence_free(mbedtls_asn1_sequence *seq); * on a successful invocation. * \param end The end of the ASN.1 SEQUENCE container. * \param tag_must_mask A mask to be applied to the ASN.1 tags found within - * the SEQUENCE before comparing to \p tag_must_value. + * the SEQUENCE before comparing to \p tag_must_val. * \param tag_must_val The required value of each ASN.1 tag found in the * SEQUENCE, after masking with \p tag_must_mask. * Mismatching tags lead to an error. @@ -462,7 +450,7 @@ void mbedtls_asn1_sequence_free(mbedtls_asn1_sequence *seq); * while a value of \c 0xFF for \p tag_must_mask means * that \p tag_must_val is the only allowed tag. * \param tag_may_mask A mask to be applied to the ASN.1 tags found within - * the SEQUENCE before comparing to \p tag_may_value. + * the SEQUENCE before comparing to \p tag_may_val. * \param tag_may_val The desired value of each ASN.1 tag found in the * SEQUENCE, after masking with \p tag_may_mask. * Mismatching tags will be silently ignored. diff --git a/c++/src/connect/mbedtls/mbedtls/asn1write.h b/c++/src/connect/mbedtls/mbedtls/asn1write.h index a439268b..a12bf039 100644 --- a/c++/src/connect/mbedtls/mbedtls/asn1write.h +++ b/c++/src/connect/mbedtls/mbedtls/asn1write.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_ASN1_WRITE_H #define MBEDTLS_ASN1_WRITE_H @@ -158,6 +146,27 @@ int mbedtls_asn1_write_algorithm_identifier(unsigned char **p, const char *oid, size_t oid_len, size_t par_len); +/** + * \brief Write an AlgorithmIdentifier sequence in ASN.1 format. + * + * \note This function works backwards in data buffer. + * + * \param p The reference to the current position pointer. + * \param start The start of the buffer, for bounds-checking. + * \param oid The OID of the algorithm to write. + * \param oid_len The length of the algorithm's OID. + * \param par_len The length of the parameters, which must be already written. + * \param has_par If there are any parameters. If 0, par_len must be 0. If 1 + * and \p par_len is 0, NULL parameters are added. + * + * \return The number of bytes written to \p p on success. + * \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure. + */ +int mbedtls_asn1_write_algorithm_identifier_ext(unsigned char **p, + unsigned char *start, + const char *oid, size_t oid_len, + size_t par_len, int has_par); + /** * \brief Write a boolean tag (#MBEDTLS_ASN1_BOOLEAN) and value * in ASN.1 format. diff --git a/c++/src/connect/mbedtls/mbedtls/base64.h b/c++/src/connect/mbedtls/mbedtls/base64.h index ec9c408f..cc460471 100644 --- a/c++/src/connect/mbedtls/mbedtls/base64.h +++ b/c++/src/connect/mbedtls/mbedtls/base64.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_BASE64_H #define MBEDTLS_BASE64_H diff --git a/c++/src/connect/mbedtls/mbedtls/bignum.h b/c++/src/connect/mbedtls/mbedtls/bignum.h index 788ea21a..fb0ca15f 100644 --- a/c++/src/connect/mbedtls/mbedtls/bignum.h +++ b/c++/src/connect/mbedtls/mbedtls/bignum.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_BIGNUM_H #define MBEDTLS_BIGNUM_H @@ -533,7 +521,7 @@ int mbedtls_mpi_write_file(const char *p, const mbedtls_mpi *X, * \param X The destination MPI. This must point to an initialized MPI. * \param buf The input buffer. This must be a readable buffer of length * \p buflen Bytes. - * \param buflen The length of the input buffer \p p in Bytes. + * \param buflen The length of the input buffer \p buf in Bytes. * * \return \c 0 if successful. * \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed. @@ -548,7 +536,7 @@ int mbedtls_mpi_read_binary(mbedtls_mpi *X, const unsigned char *buf, * \param X The destination MPI. This must point to an initialized MPI. * \param buf The input buffer. This must be a readable buffer of length * \p buflen Bytes. - * \param buflen The length of the input buffer \p p in Bytes. + * \param buflen The length of the input buffer \p buf in Bytes. * * \return \c 0 if successful. * \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed. @@ -986,8 +974,8 @@ int mbedtls_mpi_gcd(mbedtls_mpi *G, const mbedtls_mpi *A, * \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if a memory allocation failed. * \return #MBEDTLS_ERR_MPI_BAD_INPUT_DATA if \p N is less than * or equal to one. - * \return #MBEDTLS_ERR_MPI_NOT_ACCEPTABLE if \p has no modular inverse - * with respect to \p N. + * \return #MBEDTLS_ERR_MPI_NOT_ACCEPTABLE if \p A has no modular + * inverse with respect to \p N. */ int mbedtls_mpi_inv_mod(mbedtls_mpi *X, const mbedtls_mpi *A, const mbedtls_mpi *N); @@ -1039,7 +1027,7 @@ MBEDTLS_DEPRECATED int mbedtls_mpi_is_prime(const mbedtls_mpi *X, * This must point to an initialized MPI. * \param rounds The number of bases to perform the Miller-Rabin primality * test for. The probability of returning 0 on a composite is - * at most 2-2*\p rounds. + * at most 2-2*\p rounds . * \param f_rng The RNG function to use. This must not be \c NULL. * \param p_rng The RNG parameter to be passed to \p f_rng. * This may be \c NULL if \p f_rng doesn't use diff --git a/c++/src/connect/mbedtls/mbedtls/blowfish.h b/c++/src/connect/mbedtls/mbedtls/blowfish.h index 7936d2f8..7979670b 100644 --- a/c++/src/connect/mbedtls/mbedtls/blowfish.h +++ b/c++/src/connect/mbedtls/mbedtls/blowfish.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_BLOWFISH_H #define MBEDTLS_BLOWFISH_H diff --git a/c++/src/connect/mbedtls/mbedtls/bn_mul.h b/c++/src/connect/mbedtls/mbedtls/bn_mul.h index a0bc4d06..fc0c3cf3 100644 --- a/c++/src/connect/mbedtls/mbedtls/bn_mul.h +++ b/c++/src/connect/mbedtls/mbedtls/bn_mul.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * Multiply source vector [s] with b, add result @@ -677,6 +665,15 @@ #if defined(__arm__) && !defined(MULADDC_CANNOT_USE_R7) #if defined(__thumb__) && !defined(__thumb2__) +#if !defined(__ARMCC_VERSION) && !defined(__clang__) \ + && !defined(__llvm__) && !defined(__INTEL_COMPILER) +/* + * Thumb 1 ISA. This code path has only been tested successfully on gcc; + * it does not compile on clang or armclang. + * + * Other compilers which define __GNUC__ may not work. The above macro + * attempts to exclude these untested compilers. + */ #define MULADDC_INIT \ asm( \ @@ -731,6 +728,8 @@ "r6", "r7", "r8", "r9", "cc" \ ); +#endif /* Compiler is gcc */ + #elif (__ARM_ARCH >= 6) && \ defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1) diff --git a/c++/src/connect/mbedtls/mbedtls/camellia.h b/c++/src/connect/mbedtls/mbedtls/camellia.h index 05397d23..be8c5152 100644 --- a/c++/src/connect/mbedtls/mbedtls/camellia.h +++ b/c++/src/connect/mbedtls/mbedtls/camellia.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_CAMELLIA_H #define MBEDTLS_CAMELLIA_H @@ -231,7 +219,7 @@ int mbedtls_camellia_crypt_cfb128(mbedtls_camellia_context *ctx, * *note Due to the nature of CTR mode, you should use the same * key for both encryption and decryption. In particular, calls * to this function should be preceded by a key-schedule via - * mbedtls_camellia_setkey_enc() regardless of whether \p mode + * mbedtls_camellia_setkey_enc() regardless of whether the mode * is #MBEDTLS_CAMELLIA_ENCRYPT or #MBEDTLS_CAMELLIA_DECRYPT. * * \warning You must never reuse a nonce value with the same key. Doing so diff --git a/c++/src/connect/mbedtls/mbedtls/ccm.h b/c++/src/connect/mbedtls/mbedtls/ccm.h index f082aba0..adb14cc6 100644 --- a/c++/src/connect/mbedtls/mbedtls/ccm.h +++ b/c++/src/connect/mbedtls/mbedtls/ccm.h @@ -29,19 +29,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_CCM_H diff --git a/c++/src/connect/mbedtls/mbedtls/certs.h b/c++/src/connect/mbedtls/mbedtls/certs.h index 0ec6971e..8a1f2935 100644 --- a/c++/src/connect/mbedtls/mbedtls/certs.h +++ b/c++/src/connect/mbedtls/mbedtls/certs.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_CERTS_H #define MBEDTLS_CERTS_H diff --git a/c++/src/connect/mbedtls/mbedtls/chacha20.h b/c++/src/connect/mbedtls/mbedtls/chacha20.h index cd9f91a9..0c0d6a11 100644 --- a/c++/src/connect/mbedtls/mbedtls/chacha20.h +++ b/c++/src/connect/mbedtls/mbedtls/chacha20.h @@ -14,19 +14,7 @@ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_CHACHA20_H diff --git a/c++/src/connect/mbedtls/mbedtls/chachapoly.h b/c++/src/connect/mbedtls/mbedtls/chachapoly.h index c3f17207..1156d7db 100644 --- a/c++/src/connect/mbedtls/mbedtls/chachapoly.h +++ b/c++/src/connect/mbedtls/mbedtls/chachapoly.h @@ -14,19 +14,7 @@ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_CHACHAPOLY_H diff --git a/c++/src/connect/mbedtls/mbedtls/check_config.h b/c++/src/connect/mbedtls/mbedtls/check_config.h index 2cb36e9e..96081feb 100644 --- a/c++/src/connect/mbedtls/mbedtls/check_config.h +++ b/c++/src/connect/mbedtls/mbedtls/check_config.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* @@ -35,7 +23,7 @@ */ #include #if CHAR_BIT != 8 -#error "mbed TLS requires a platform with 8-bit chars" +#error "Mbed TLS requires a platform with 8-bit chars" #endif #if defined(_WIN32) diff --git a/c++/src/connect/mbedtls/mbedtls/cipher.h b/c++/src/connect/mbedtls/mbedtls/cipher.h index aa155d7b..db73c1b5 100644 --- a/c++/src/connect/mbedtls/mbedtls/cipher.h +++ b/c++/src/connect/mbedtls/mbedtls/cipher.h @@ -9,19 +9,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_CIPHER_H @@ -427,7 +415,7 @@ const mbedtls_cipher_info_t *mbedtls_cipher_info_from_values(const mbedtls_ciphe const mbedtls_cipher_mode_t mode); /** - * \brief This function initializes a \p cipher_context as NONE. + * \brief This function initializes a \p ctx as NONE. * * \param ctx The context to be initialized. This must not be \c NULL. */ @@ -446,10 +434,29 @@ void mbedtls_cipher_free(mbedtls_cipher_context_t *ctx); /** - * \brief This function initializes a cipher context for + * \brief This function prepares a cipher context for * use with the given cipher primitive. * - * \param ctx The context to initialize. This must be initialized. + * \warning In CBC mode, if mbedtls_cipher_set_padding_mode() is not called: + * - If MBEDTLS_CIPHER_PADDING_PKCS7 is enabled, the + * context will use PKCS7 padding. + * - Otherwise the context uses no padding and the input + * must be a whole number of blocks. + * + * \note After calling this function, you should call + * mbedtls_cipher_setkey() and, if the mode uses padding, + * mbedtls_cipher_set_padding_mode(), then for each + * message to encrypt or decrypt with this key, either: + * - mbedtls_cipher_crypt() for one-shot processing with + * non-AEAD modes; + * - mbedtls_cipher_auth_encrypt_ext() or + * mbedtls_cipher_auth_decrypt_ext() for one-shot + * processing with AEAD modes or NIST_KW; + * - for multi-part processing, see the documentation of + * mbedtls_cipher_reset(). + * + * \param ctx The context to prepare. This must be initialized by + * a call to mbedtls_cipher_init() first. * \param cipher_info The cipher to use. * * \return \c 0 on success. @@ -602,7 +609,7 @@ static inline const char *mbedtls_cipher_get_name( * \param ctx The context of the cipher. This must be initialized. * * \return The key length of the cipher in bits. - * \return #MBEDTLS_KEY_LENGTH_NONE if ctx \p has not been + * \return #MBEDTLS_KEY_LENGTH_NONE if \p ctx has not been * initialized. */ static inline int mbedtls_cipher_get_key_bitlen( @@ -663,8 +670,6 @@ int mbedtls_cipher_setkey(mbedtls_cipher_context_t *ctx, * \brief This function sets the padding mode, for cipher modes * that use padding. * - * The default passing mode is PKCS7 padding. - * * \param ctx The generic cipher context. This must be initialized and * bound to a cipher information structure. * \param mode The padding mode. @@ -704,7 +709,29 @@ int mbedtls_cipher_set_iv(mbedtls_cipher_context_t *ctx, /** * \brief This function resets the cipher state. * - * \param ctx The generic cipher context. This must be initialized. + * \note With non-AEAD ciphers, the order of calls for each message + * is as follows: + * 1. mbedtls_cipher_set_iv() if the mode uses an IV/nonce. + * 2. mbedtls_cipher_reset() + * 3. mbedtls_cipher_update() one or more times + * 4. mbedtls_cipher_finish() + * . + * This sequence can be repeated to encrypt or decrypt multiple + * messages with the same key. + * + * \note With AEAD ciphers, the order of calls for each message + * is as follows: + * 1. mbedtls_cipher_set_iv() if the mode uses an IV/nonce. + * 2. mbedtls_cipher_reset() + * 3. mbedtls_cipher_update_ad() + * 4. mbedtls_cipher_update() one or more times + * 5. mbedtls_cipher_check_tag() (for decryption) or + * mbedtls_cipher_write_tag() (for encryption). + * . + * This sequence can be repeated to encrypt or decrypt multiple + * messages with the same key. + * + * \param ctx The generic cipher context. This must be bound to a key. * * \return \c 0 on success. * \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on @@ -779,7 +806,7 @@ int mbedtls_cipher_update(mbedtls_cipher_context_t *ctx, * \param ctx The generic cipher context. This must be initialized and * bound to a key. * \param output The buffer to write data to. This needs to be a writable - * buffer of at least \p block_size Bytes. + * buffer of at least block_size Bytes. * \param olen The length of the data written to the \p output buffer. * This may not be \c NULL. * diff --git a/c++/src/connect/mbedtls/mbedtls/cipher_internal.h b/c++/src/connect/mbedtls/mbedtls/cipher_internal.h index c77bb8cc..c98abab6 100644 --- a/c++/src/connect/mbedtls/mbedtls/cipher_internal.h +++ b/c++/src/connect/mbedtls/mbedtls/cipher_internal.h @@ -7,19 +7,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_CIPHER_WRAP_H #define MBEDTLS_CIPHER_WRAP_H diff --git a/c++/src/connect/mbedtls/mbedtls/cmac.h b/c++/src/connect/mbedtls/mbedtls/cmac.h index 254995ca..89634dc9 100644 --- a/c++/src/connect/mbedtls/mbedtls/cmac.h +++ b/c++/src/connect/mbedtls/mbedtls/cmac.h @@ -8,19 +8,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_CMAC_H @@ -45,7 +33,11 @@ extern "C" { #define MBEDTLS_AES_BLOCK_SIZE 16 #define MBEDTLS_DES3_BLOCK_SIZE 8 -#if defined(MBEDTLS_AES_C) + +/* Although the CMAC module does not support ARIA or CAMELLIA, we adjust the value of + * MBEDTLS_CIPHER_BLKSIZE_MAX to reflect these ciphers. + * This is done to avoid confusion, given the general-purpose name of the macro. */ +#if defined(MBEDTLS_AES_C) || defined(MBEDTLS_ARIA_C) || defined(MBEDTLS_CAMELLIA_C) #define MBEDTLS_CIPHER_BLKSIZE_MAX 16 /**< The longest block used by CMAC is that of AES. */ #else #define MBEDTLS_CIPHER_BLKSIZE_MAX 8 /**< The longest block used by CMAC is that of 3DES. */ diff --git a/c++/src/connect/mbedtls/mbedtls/compat-1.3.h b/c++/src/connect/mbedtls/mbedtls/compat-1.3.h index 3a34cf6d..de8f625a 100644 --- a/c++/src/connect/mbedtls/mbedtls/compat-1.3.h +++ b/c++/src/connect/mbedtls/mbedtls/compat-1.3.h @@ -1,26 +1,14 @@ /** * \file compat-1.3.h * - * \brief Compatibility definitions for using mbed TLS with client code written + * \brief Compatibility definitions for using Mbed TLS with client code written * for the PolarSSL naming conventions. * * \deprecated Use the new names directly instead */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #if !defined(MBEDTLS_CONFIG_FILE) diff --git a/c++/src/connect/mbedtls/mbedtls/config.h b/c++/src/connect/mbedtls/mbedtls/config.h index 91b40eb3..c7aeffcf 100644 --- a/c++/src/connect/mbedtls/mbedtls/config.h +++ b/c++/src/connect/mbedtls/mbedtls/config.h @@ -9,19 +9,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_CONFIG_H @@ -167,19 +155,51 @@ * * Enable the memory allocation layer. * - * By default mbed TLS uses the system-provided calloc() and free(). + * By default Mbed TLS uses the system-provided calloc() and free(). * This allows different allocators (self-implemented or provided) to be * provided to the platform abstraction layer. * - * Enabling MBEDTLS_PLATFORM_MEMORY without the + * Enabling #MBEDTLS_PLATFORM_MEMORY without the * MBEDTLS_PLATFORM_{FREE,CALLOC}_MACROs will provide * "mbedtls_platform_set_calloc_free()" allowing you to set an alternative calloc() and * free() function pointer at runtime. * - * Enabling MBEDTLS_PLATFORM_MEMORY and specifying + * Enabling #MBEDTLS_PLATFORM_MEMORY and specifying * MBEDTLS_PLATFORM_{CALLOC,FREE}_MACROs will allow you to specify the * alternate function at compile time. * + * An overview of how the value of mbedtls_calloc is determined: + * + * - if !MBEDTLS_PLATFORM_MEMORY + * - mbedtls_calloc = calloc + * - if MBEDTLS_PLATFORM_MEMORY + * - if (MBEDTLS_PLATFORM_CALLOC_MACRO && MBEDTLS_PLATFORM_FREE_MACRO): + * - mbedtls_calloc = MBEDTLS_PLATFORM_CALLOC_MACRO + * - if !(MBEDTLS_PLATFORM_CALLOC_MACRO && MBEDTLS_PLATFORM_FREE_MACRO): + * - Dynamic setup via mbedtls_platform_set_calloc_free is now possible with a default value MBEDTLS_PLATFORM_STD_CALLOC. + * - How is MBEDTLS_PLATFORM_STD_CALLOC handled? + * - if MBEDTLS_PLATFORM_NO_STD_FUNCTIONS: + * - MBEDTLS_PLATFORM_STD_CALLOC is not set to anything; + * - MBEDTLS_PLATFORM_STD_MEM_HDR can be included if present; + * - if !MBEDTLS_PLATFORM_NO_STD_FUNCTIONS: + * - if MBEDTLS_PLATFORM_STD_CALLOC is present: + * - User-defined MBEDTLS_PLATFORM_STD_CALLOC is respected; + * - if !MBEDTLS_PLATFORM_STD_CALLOC: + * - MBEDTLS_PLATFORM_STD_CALLOC = calloc + * + * - At this point the presence of MBEDTLS_PLATFORM_STD_CALLOC is checked. + * - if !MBEDTLS_PLATFORM_STD_CALLOC + * - MBEDTLS_PLATFORM_STD_CALLOC = uninitialized_calloc + * + * - mbedtls_calloc = MBEDTLS_PLATFORM_STD_CALLOC. + * + * Defining MBEDTLS_PLATFORM_CALLOC_MACRO and #MBEDTLS_PLATFORM_STD_CALLOC at the same time is not possible. + * MBEDTLS_PLATFORM_CALLOC_MACRO and MBEDTLS_PLATFORM_FREE_MACRO must both be defined or undefined at the same time. + * #MBEDTLS_PLATFORM_STD_CALLOC and #MBEDTLS_PLATFORM_STD_FREE do not have to be defined at the same time, as, if they are used, + * dynamic setup of these functions is possible. See the tree above to see how are they handled in all cases. + * An uninitialized #MBEDTLS_PLATFORM_STD_CALLOC always fails, returning a null pointer. + * An uninitialized #MBEDTLS_PLATFORM_STD_FREE does not do anything. + * * Requires: MBEDTLS_PLATFORM_C * * Enable this layer to allow use of alternative memory allocators. @@ -208,10 +228,10 @@ /** * \def MBEDTLS_PLATFORM_EXIT_ALT * - * MBEDTLS_PLATFORM_XXX_ALT: Uncomment a macro to let mbed TLS support the + * MBEDTLS_PLATFORM_XXX_ALT: Uncomment a macro to let Mbed TLS support the * function in the platform abstraction layer. * - * Example: In case you uncomment MBEDTLS_PLATFORM_PRINTF_ALT, mbed TLS will + * Example: In case you uncomment MBEDTLS_PLATFORM_PRINTF_ALT, Mbed TLS will * provide a function "mbedtls_platform_set_printf()" that allows you to set an * alternative printf function pointer. * @@ -237,6 +257,45 @@ //#define MBEDTLS_PLATFORM_NV_SEED_ALT //#define MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT +/** + * Uncomment the macro to let Mbed TLS use your alternate implementation of + * mbedtls_platform_gmtime_r(). This replaces the default implementation in + * platform_util.c. + * + * gmtime() is not a thread-safe function as defined in the C standard. The + * library will try to use safer implementations of this function, such as + * gmtime_r() when available. However, if Mbed TLS cannot identify the target + * system, the implementation of mbedtls_platform_gmtime_r() will default to + * using the standard gmtime(). In this case, calls from the library to + * gmtime() will be guarded by the global mutex mbedtls_threading_gmtime_mutex + * if MBEDTLS_THREADING_C is enabled. We recommend that calls from outside the + * library are also guarded with this mutex to avoid race conditions. However, + * if the macro MBEDTLS_PLATFORM_GMTIME_R_ALT is defined, Mbed TLS will + * unconditionally use the implementation for mbedtls_platform_gmtime_r() + * supplied at compile time. + */ +//#define MBEDTLS_PLATFORM_GMTIME_R_ALT + +/** + * Uncomment the macro to let Mbed TLS use your alternate implementation of + * mbedtls_platform_zeroize(). This replaces the default implementation in + * platform_util.c. + * + * mbedtls_platform_zeroize() is a widely used function across the library to + * zero a block of memory. The implementation is expected to be secure in the + * sense that it has been written to prevent the compiler from removing calls + * to mbedtls_platform_zeroize() as part of redundant code elimination + * optimizations. However, it is difficult to guarantee that calls to + * mbedtls_platform_zeroize() will not be optimized by the compiler as older + * versions of the C language standards do not provide a secure implementation + * of memset(). Therefore, MBEDTLS_PLATFORM_ZEROIZE_ALT enables users to + * configure their own implementation of mbedtls_platform_zeroize(), for + * example by using directives specific to their compiler, features from newer + * C standards (e.g using memset_s() in C11) or calling a secure memset() from + * their system (e.g explicit_bzero() in BSD). + */ +//#define MBEDTLS_PLATFORM_ZEROIZE_ALT + /** * \def MBEDTLS_DEPRECATED_WARNING * @@ -336,7 +395,7 @@ /** \} name SECTION: System support */ /** - * \name SECTION: mbed TLS feature support + * \name SECTION: Mbed TLS feature support * * This section sets support for features that are or are not needed * within the modules that are enabled. @@ -359,7 +418,7 @@ /** * \def MBEDTLS_AES_ALT * - * MBEDTLS__MODULE_NAME__ALT: Uncomment a macro to let mbed TLS use your + * MBEDTLS__MODULE_NAME__ALT: Uncomment a macro to let Mbed TLS use your * alternate core implementation of a symmetric crypto, an arithmetic or hash * module (e.g. platform specific assembly optimized implementations). Keep * in mind that the function prototypes should remain the same. @@ -367,7 +426,7 @@ * This replaces the whole module. If you only want to replace one of the * functions, use one of the MBEDTLS__FUNCTION_NAME__ALT flags. * - * Example: In case you uncomment MBEDTLS_AES_ALT, mbed TLS will no longer + * Example: In case you uncomment MBEDTLS_AES_ALT, Mbed TLS will no longer * provide the "struct mbedtls_aes_context" definition and omit the base * function declarations and implementations. "aes_alt.h" will be included from * "aes.h" to include the new function definitions. @@ -420,14 +479,14 @@ /** * \def MBEDTLS_MD2_PROCESS_ALT * - * MBEDTLS__FUNCTION_NAME__ALT: Uncomment a macro to let mbed TLS use you + * MBEDTLS__FUNCTION_NAME__ALT: Uncomment a macro to let Mbed TLS use you * alternate core implementation of symmetric crypto or hash function. Keep in * mind that function prototypes should remain the same. * - * This replaces only one function. The header file from mbed TLS is still + * This replaces only one function. The header file from Mbed TLS is still * used, in contrast to the MBEDTLS__MODULE_NAME__ALT flags. * - * Example: In case you uncomment MBEDTLS_SHA256_PROCESS_ALT, mbed TLS will + * Example: In case you uncomment MBEDTLS_SHA256_PROCESS_ALT, Mbed TLS will * no longer provide the mbedtls_sha1_process() function, but it will still provide * the other function (using your mbedtls_sha1_process() function) and the definition * of mbedtls_sha1_context, so your implementation of mbedtls_sha1_process must be compatible @@ -487,11 +546,11 @@ * * Expose a part of the internal interface of the Elliptic Curve Point module. * - * MBEDTLS_ECP__FUNCTION_NAME__ALT: Uncomment a macro to let mbed TLS use your + * MBEDTLS_ECP__FUNCTION_NAME__ALT: Uncomment a macro to let Mbed TLS use your * alternative core implementation of elliptic curve arithmetic. Keep in mind * that function prototypes should remain the same. * - * This partially replaces one function. The header file from mbed TLS is still + * This partially replaces one function. The header file from Mbed TLS is still * used, in contrast to the MBEDTLS_ECP_ALT flag. The original implementation * is still present and it is used for group structures not supported by the * alternative. @@ -515,11 +574,11 @@ * implement optimized set up and tear down instructions. * * Example: In case you set MBEDTLS_ECP_INTERNAL_ALT and - * MBEDTLS_ECP_DOUBLE_JAC_ALT, mbed TLS will still provide the ecp_double_jac() + * MBEDTLS_ECP_DOUBLE_JAC_ALT, Mbed TLS will still provide the ecp_double_jac() * function, but will use your mbedtls_internal_ecp_double_jac() if the group * for the operation is supported by your implementation (i.e. your * mbedtls_internal_ecp_grp_capable() function returns 1 for this group). If the - * group is not supported by your implementation, then the original mbed TLS + * group is not supported by your implementation, then the original Mbed TLS * implementation of ecp_double_jac() is used instead, unless this fallback * behaviour is disabled by setting MBEDTLS_ECP_NO_FALLBACK (in which case * ecp_double_jac() will return MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE). @@ -550,7 +609,7 @@ /** * \def MBEDTLS_TEST_NULL_ENTROPY * - * Enables testing and use of mbed TLS without any configured entropy sources. + * Enables testing and use of Mbed TLS without any configured entropy sources. * This permits use of the library on platforms before an entropy source has * been integrated (see for example the MBEDTLS_ENTROPY_HARDWARE_ALT or the * MBEDTLS_ENTROPY_NV_SEED switches). @@ -567,7 +626,7 @@ /** * \def MBEDTLS_ENTROPY_HARDWARE_ALT * - * Uncomment this macro to let mbed TLS use your own implementation of a + * Uncomment this macro to let Mbed TLS use your own implementation of a * hardware entropy collector. * * Your function must be called \c mbedtls_hardware_poll(), have the same @@ -793,6 +852,18 @@ */ #define MBEDTLS_REMOVE_3DES_CIPHERSUITES +/** + * Enable the verified implementations of ECDH primitives from Project Everest + * (currently only Curve25519). This feature changes the layout of ECDH + * contexts and therefore is a compatibility break for applications that access + * fields of a mbedtls_ecdh_context structure directly. See also + * MBEDTLS_ECDH_LEGACY_CONTEXT in include/mbedtls/ecdh.h. + * + * The Everest code is provided under the Apache 2.0 license only; therefore enabling this + * option is not compatible with taking the library under the GPL v2.0-or-later license. + */ +//#define MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED + /** * \def MBEDTLS_ECP_DP_SECP192R1_ENABLED * @@ -1465,8 +1536,8 @@ * ); * ``` * The \c context value is initialized to 0 before the first call. - * The function must fill the \c output buffer with \p output_size bytes - * of random data and set \c *output_length to \p output_size. + * The function must fill the \c output buffer with \c output_size bytes + * of random data and set \c *output_length to \c output_size. * * Requires: MBEDTLS_PSA_CRYPTO_C * @@ -1506,6 +1577,26 @@ */ //#define MBEDTLS_PSA_INJECT_ENTROPY +/** + * \def MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS + * + * Assume all buffers passed to PSA functions are owned exclusively by the + * PSA function and are not stored in shared memory. + * + * This option may be enabled if all buffers passed to any PSA function reside + * in memory that is accessible only to the PSA function during its execution. + * + * This option MUST be disabled whenever buffer arguments are in memory shared + * with an untrusted party, for example where arguments to PSA calls are passed + * across a trust boundary. + * + * \note Enabling this option reduces memory usage and code size. + * + * \note Enabling this option causes overlap of input and output buffers + * not to be supported by PSA functions. + */ +//#define MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS + /** * \def MBEDTLS_RSA_NO_CRT * @@ -1566,7 +1657,7 @@ * \def MBEDTLS_SSL_ALL_ALERT_MESSAGES * * Enable sending of alert messages in case of encountered errors as per RFC. - * If you choose not to send the alert messages, mbed TLS can still communicate + * If you choose not to send the alert messages, Mbed TLS can still communicate * with other servers, only debugging of failures is harder. * * The advantage of not sending alert messages, is that no information is given @@ -2092,6 +2183,23 @@ */ //#define MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH +/** + * Allow SHA-1 in the default TLS configuration for TLS 1.2 handshake + * signature and ciphersuite selection. Without this build-time option, SHA-1 + * support must be activated explicitly through mbedtls_ssl_conf_sig_hashes. + * The use of SHA-1 in TLS <= 1.1 and in HMAC-SHA-1 is always allowed by + * default. At the time of writing, there is no practical attack on the use + * of SHA-1 in handshake signatures, hence this option is turned on by default + * to preserve compatibility with existing peers, but the general + * warning applies nonetheless: + * + * \warning SHA-1 is considered a weak message digest and its use constitutes + * a security risk. If possible, we recommend avoiding dependencies + * on it, and considering stronger message digests instead. + * + */ +//#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE + /** * \def MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN * @@ -2343,12 +2451,12 @@ #if defined(HAVE_LIBZ) && 0 # define MBEDTLS_ZLIB_SUPPORT #endif -/** \} name SECTION: mbed TLS feature support */ +/** \} name SECTION: Mbed TLS feature support */ /** - * \name SECTION: mbed TLS modules + * \name SECTION: Mbed TLS modules * - * This section enables or disables entire modules in mbed TLS + * This section enables or disables entire modules in Mbed TLS * \{ */ @@ -3069,7 +3177,7 @@ * Module: library/memory_buffer_alloc.c * * Requires: MBEDTLS_PLATFORM_C - * MBEDTLS_PLATFORM_MEMORY (to use it within mbed TLS) + * MBEDTLS_PLATFORM_MEMORY (to use it within Mbed TLS) * * Enable this module to enable the buffer memory allocator. */ @@ -3509,7 +3617,7 @@ * \def MBEDTLS_THREADING_C * * Enable the threading abstraction layer. - * By default mbed TLS assumes it is used in a non-threaded environment or that + * By default Mbed TLS assumes it is used in a non-threaded environment or that * contexts are not shared between threads. If you do intend to use contexts * between threads, you will need to enable this layer to prevent race * conditions. See also our Knowledge Base article about threading: @@ -3523,7 +3631,7 @@ * You will have to enable either MBEDTLS_THREADING_ALT or * MBEDTLS_THREADING_PTHREAD. * - * Enable this layer to allow use of mutexes within mbed TLS + * Enable this layer to allow use of mutexes within Mbed TLS */ #if defined(MBEDTLS_THREADING_ALT) || defined(MBEDTLS_THREADING_PTHREAD) # define MBEDTLS_THREADING_C @@ -3677,7 +3785,7 @@ */ #define MBEDTLS_XTEA_C -/** \} name SECTION: mbed TLS modules */ +/** \} name SECTION: Mbed TLS modules */ /** * \name SECTION: General configuration options @@ -3811,8 +3919,29 @@ /* Platform options */ //#define MBEDTLS_PLATFORM_STD_MEM_HDR /**< Header to include if MBEDTLS_PLATFORM_NO_STD_FUNCTIONS is defined. Don't define if no header is needed. */ -//#define MBEDTLS_PLATFORM_STD_CALLOC calloc /**< Default allocator to use, can be undefined */ -//#define MBEDTLS_PLATFORM_STD_FREE free /**< Default free to use, can be undefined */ + +/** \def MBEDTLS_PLATFORM_STD_CALLOC + * + * Default allocator to use, can be undefined. + * It must initialize the allocated buffer memory to zeroes. + * The size of the buffer is the product of the two parameters. + * The calloc function returns either a null pointer or a pointer to the allocated space. + * If the product is 0, the function may either return NULL or a valid pointer to an array of size 0 which is a valid input to the deallocation function. + * An uninitialized #MBEDTLS_PLATFORM_STD_CALLOC always fails, returning a null pointer. + * See the description of #MBEDTLS_PLATFORM_MEMORY for more details. + * The corresponding deallocation function is #MBEDTLS_PLATFORM_STD_FREE. + */ +//#define MBEDTLS_PLATFORM_STD_CALLOC calloc + +/** \def MBEDTLS_PLATFORM_STD_FREE + * + * Default free to use, can be undefined. + * NULL is a valid parameter, and the function must do nothing. + * A non-null parameter will always be a pointer previously returned by #MBEDTLS_PLATFORM_STD_CALLOC and not yet freed. + * An uninitialized #MBEDTLS_PLATFORM_STD_FREE does not do anything. + * See the description of #MBEDTLS_PLATFORM_MEMORY for more details (same principles as for MBEDTLS_PLATFORM_STD_CALLOC apply). + */ +//#define MBEDTLS_PLATFORM_STD_FREE free //#define MBEDTLS_PLATFORM_STD_EXIT exit /**< Default exit to use, can be undefined */ //#define MBEDTLS_PLATFORM_STD_TIME time /**< Default time to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */ //#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf /**< Default fprintf to use, can be undefined */ @@ -3825,10 +3954,10 @@ //#define MBEDTLS_PLATFORM_STD_NV_SEED_WRITE mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */ //#define MBEDTLS_PLATFORM_STD_NV_SEED_FILE "seedfile" /**< Seed file to read/write with default implementation */ -/* To Use Function Macros MBEDTLS_PLATFORM_C must be enabled */ +/* To use the following function macros, MBEDTLS_PLATFORM_C must be enabled. */ /* MBEDTLS_PLATFORM_XXX_MACRO and MBEDTLS_PLATFORM_XXX_ALT cannot both be defined */ -//#define MBEDTLS_PLATFORM_CALLOC_MACRO calloc /**< Default allocator macro to use, can be undefined */ -//#define MBEDTLS_PLATFORM_FREE_MACRO free /**< Default free macro to use, can be undefined */ +//#define MBEDTLS_PLATFORM_CALLOC_MACRO calloc /**< Default allocator macro to use, can be undefined. See MBEDTLS_PLATFORM_STD_CALLOC for requirements. */ +//#define MBEDTLS_PLATFORM_FREE_MACRO free /**< Default free macro to use, can be undefined. See MBEDTLS_PLATFORM_STD_FREE for requirements. */ //#define MBEDTLS_PLATFORM_EXIT_MACRO exit /**< Default exit macro to use, can be undefined */ //#define MBEDTLS_PLATFORM_TIME_MACRO time /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */ //#define MBEDTLS_PLATFORM_TIME_TYPE_MACRO time_t /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */ @@ -4101,71 +4230,6 @@ //#define MBEDTLS_X509_MAX_INTERMEDIATE_CA 8 /**< Maximum number of intermediate CAs in a verification chain. */ //#define MBEDTLS_X509_MAX_FILE_PATH_LEN 512 /**< Maximum length of a path/filename string in bytes including the null terminator character ('\0'). */ -/** - * Allow SHA-1 in the default TLS configuration for TLS 1.2 handshake - * signature and ciphersuite selection. Without this build-time option, SHA-1 - * support must be activated explicitly through mbedtls_ssl_conf_sig_hashes. - * The use of SHA-1 in TLS <= 1.1 and in HMAC-SHA-1 is always allowed by - * default. At the time of writing, there is no practical attack on the use - * of SHA-1 in handshake signatures, hence this option is turned on by default - * to preserve compatibility with existing peers, but the general - * warning applies nonetheless: - * - * \warning SHA-1 is considered a weak message digest and its use constitutes - * a security risk. If possible, we recommend avoiding dependencies - * on it, and considering stronger message digests instead. - * - */ -//#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE - -/** - * Uncomment the macro to let mbed TLS use your alternate implementation of - * mbedtls_platform_zeroize(). This replaces the default implementation in - * platform_util.c. - * - * mbedtls_platform_zeroize() is a widely used function across the library to - * zero a block of memory. The implementation is expected to be secure in the - * sense that it has been written to prevent the compiler from removing calls - * to mbedtls_platform_zeroize() as part of redundant code elimination - * optimizations. However, it is difficult to guarantee that calls to - * mbedtls_platform_zeroize() will not be optimized by the compiler as older - * versions of the C language standards do not provide a secure implementation - * of memset(). Therefore, MBEDTLS_PLATFORM_ZEROIZE_ALT enables users to - * configure their own implementation of mbedtls_platform_zeroize(), for - * example by using directives specific to their compiler, features from newer - * C standards (e.g using memset_s() in C11) or calling a secure memset() from - * their system (e.g explicit_bzero() in BSD). - */ -//#define MBEDTLS_PLATFORM_ZEROIZE_ALT - -/** - * Uncomment the macro to let Mbed TLS use your alternate implementation of - * mbedtls_platform_gmtime_r(). This replaces the default implementation in - * platform_util.c. - * - * gmtime() is not a thread-safe function as defined in the C standard. The - * library will try to use safer implementations of this function, such as - * gmtime_r() when available. However, if Mbed TLS cannot identify the target - * system, the implementation of mbedtls_platform_gmtime_r() will default to - * using the standard gmtime(). In this case, calls from the library to - * gmtime() will be guarded by the global mutex mbedtls_threading_gmtime_mutex - * if MBEDTLS_THREADING_C is enabled. We recommend that calls from outside the - * library are also guarded with this mutex to avoid race conditions. However, - * if the macro MBEDTLS_PLATFORM_GMTIME_R_ALT is defined, Mbed TLS will - * unconditionally use the implementation for mbedtls_platform_gmtime_r() - * supplied at compile time. - */ -//#define MBEDTLS_PLATFORM_GMTIME_R_ALT - -/** - * Enable the verified implementations of ECDH primitives from Project Everest - * (currently only Curve25519). This feature changes the layout of ECDH - * contexts and therefore is a compatibility break for applications that access - * fields of a mbedtls_ecdh_context structure directly. See also - * MBEDTLS_ECDH_LEGACY_CONTEXT in include/mbedtls/ecdh.h. - */ -//#define MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED - /** \} name SECTION: Module configuration options */ /* Target and application specific configurations diff --git a/c++/src/connect/mbedtls/mbedtls/config_psa.h b/c++/src/connect/mbedtls/mbedtls/config_psa.h index 8a5c68f5..205d3034 100644 --- a/c++/src/connect/mbedtls/mbedtls/config_psa.h +++ b/c++/src/connect/mbedtls/mbedtls/config_psa.h @@ -12,19 +12,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_CONFIG_PSA_H @@ -110,6 +98,10 @@ extern "C" { #if defined(PSA_WANT_ALG_HKDF) #if !defined(MBEDTLS_PSA_ACCEL_ALG_HKDF) +/* + * The PSA implementation has its own implementation of HKDF, separate from + * hkdf.c. No need to enable MBEDTLS_HKDF_C here. + */ #define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1 #define MBEDTLS_PSA_BUILTIN_ALG_HKDF 1 #endif /* !MBEDTLS_PSA_ACCEL_ALG_HKDF */ @@ -617,7 +609,7 @@ extern "C" { #if defined(MBEDTLS_MD_C) #define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1 #define PSA_WANT_ALG_HMAC 1 -#define PSA_WANT_KEY_TYPE_HMAC +#define PSA_WANT_KEY_TYPE_HMAC 1 #define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PRF 1 #define PSA_WANT_ALG_TLS12_PRF 1 #define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS 1 @@ -755,69 +747,69 @@ extern "C" { #if defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) #define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_256 1 -#define PSA_WANT_ECC_BRAINPOOL_P_R1_256 +#define PSA_WANT_ECC_BRAINPOOL_P_R1_256 1 #endif #if defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) #define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_384 1 -#define PSA_WANT_ECC_BRAINPOOL_P_R1_384 +#define PSA_WANT_ECC_BRAINPOOL_P_R1_384 1 #endif #if defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) #define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_512 1 -#define PSA_WANT_ECC_BRAINPOOL_P_R1_512 +#define PSA_WANT_ECC_BRAINPOOL_P_R1_512 1 #endif #if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) #define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_255 1 -#define PSA_WANT_ECC_MONTGOMERY_255 +#define PSA_WANT_ECC_MONTGOMERY_255 1 #endif /* Curve448 is not yet supported via the PSA API (https://github.com/Mbed-TLS/mbedtls/issues/4249) */ #if 0 && defined(MBEDTLS_ECP_DP_CURVE448_ENABLED) #define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_448 1 -#define PSA_WANT_ECC_MONTGOMERY_448 +#define PSA_WANT_ECC_MONTGOMERY_448 1 #endif #if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_192 1 -#define PSA_WANT_ECC_SECP_R1_192 +#define PSA_WANT_ECC_SECP_R1_192 1 #endif #if defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_224 1 -#define PSA_WANT_ECC_SECP_R1_224 +#define PSA_WANT_ECC_SECP_R1_224 1 #endif #if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_256 1 -#define PSA_WANT_ECC_SECP_R1_256 +#define PSA_WANT_ECC_SECP_R1_256 1 #endif #if defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_384 1 -#define PSA_WANT_ECC_SECP_R1_384 +#define PSA_WANT_ECC_SECP_R1_384 1 #endif #if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) #define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_521 1 -#define PSA_WANT_ECC_SECP_R1_521 +#define PSA_WANT_ECC_SECP_R1_521 1 #endif #if defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) #define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_192 1 -#define PSA_WANT_ECC_SECP_K1_192 +#define PSA_WANT_ECC_SECP_K1_192 1 #endif /* SECP224K1 is buggy via the PSA API (https://github.com/Mbed-TLS/mbedtls/issues/3541) */ #if 0 && defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) #define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_224 1 -#define PSA_WANT_ECC_SECP_K1_224 +#define PSA_WANT_ECC_SECP_K1_224 1 #endif #if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) #define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_256 1 -#define PSA_WANT_ECC_SECP_K1_256 +#define PSA_WANT_ECC_SECP_K1_256 1 #endif #endif /* MBEDTLS_PSA_CRYPTO_CONFIG */ diff --git a/c++/src/connect/mbedtls/mbedtls/constant_time.h b/c++/src/connect/mbedtls/mbedtls/constant_time.h index 8419c991..7226ae1b 100644 --- a/c++/src/connect/mbedtls/mbedtls/constant_time.h +++ b/c++/src/connect/mbedtls/mbedtls/constant_time.h @@ -2,19 +2,7 @@ * Constant-time functions * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_CONSTANT_TIME_H diff --git a/c++/src/connect/mbedtls/mbedtls/ctr_drbg.h b/c++/src/connect/mbedtls/mbedtls/ctr_drbg.h index 1bf427c4..eb72f9ee 100644 --- a/c++/src/connect/mbedtls/mbedtls/ctr_drbg.h +++ b/c++/src/connect/mbedtls/mbedtls/ctr_drbg.h @@ -23,19 +23,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_CTR_DRBG_H diff --git a/c++/src/connect/mbedtls/mbedtls/debug.h b/c++/src/connect/mbedtls/mbedtls/debug.h index bcc640c6..c29c40ee 100644 --- a/c++/src/connect/mbedtls/mbedtls/debug.h +++ b/c++/src/connect/mbedtls/mbedtls/debug.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_DEBUG_H #define MBEDTLS_DEBUG_H diff --git a/c++/src/connect/mbedtls/mbedtls/des.h b/c++/src/connect/mbedtls/mbedtls/des.h index f2bc5813..031b9cf2 100644 --- a/c++/src/connect/mbedtls/mbedtls/des.h +++ b/c++/src/connect/mbedtls/mbedtls/des.h @@ -9,19 +9,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * */ #ifndef MBEDTLS_DES_H diff --git a/c++/src/connect/mbedtls/mbedtls/dhm.h b/c++/src/connect/mbedtls/mbedtls/dhm.h index 117af934..b61e4d4e 100644 --- a/c++/src/connect/mbedtls/mbedtls/dhm.h +++ b/c++/src/connect/mbedtls/mbedtls/dhm.h @@ -45,19 +45,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_DHM_H diff --git a/c++/src/connect/mbedtls/mbedtls/ecdh.h b/c++/src/connect/mbedtls/mbedtls/ecdh.h index aade25a4..6cc6cb92 100644 --- a/c++/src/connect/mbedtls/mbedtls/ecdh.h +++ b/c++/src/connect/mbedtls/mbedtls/ecdh.h @@ -14,19 +14,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_ECDH_H diff --git a/c++/src/connect/mbedtls/mbedtls/ecdsa.h b/c++/src/connect/mbedtls/mbedtls/ecdsa.h index e42d114c..34a6b13d 100644 --- a/c++/src/connect/mbedtls/mbedtls/ecdsa.h +++ b/c++/src/connect/mbedtls/mbedtls/ecdsa.h @@ -12,19 +12,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_ECDSA_H @@ -266,8 +254,9 @@ int mbedtls_ecdsa_sign_det(mbedtls_ecp_group *grp, mbedtls_mpi *r, * \param md_alg The hash algorithm used to hash the original data. * \param f_rng_blind The RNG function used for blinding. This must not be * \c NULL. - * \param p_rng_blind The RNG context to be passed to \p f_rng. This may be - * \c NULL if \p f_rng doesn't need a context parameter. + * \param p_rng_blind The RNG context to be passed to \p f_rng_blind. This + * may be \c NULL if \p f_rng_blind doesn't need + * a context parameter. * * \return \c 0 on success. * \return An \c MBEDTLS_ERR_ECP_XXX or \c MBEDTLS_MPI_XXX @@ -344,7 +333,7 @@ int mbedtls_ecdsa_verify(mbedtls_ecp_group *grp, * via mbedtls_ecdsa_genkey() or mbedtls_ecdsa_from_keypair(). * \param md_alg The message digest that was used to hash the message. * \param hash The message hash to be signed. This must be a readable - * buffer of length \p blen Bytes. + * buffer of length \p hlen Bytes. * \param hlen The length of the hash \p hash in Bytes. * \param sig The buffer to which to write the signature. This must be a * writable buffer of length at least twice as large as the @@ -386,7 +375,7 @@ int mbedtls_ecdsa_write_signature(mbedtls_ecdsa_context *ctx, * via mbedtls_ecdsa_genkey() or mbedtls_ecdsa_from_keypair(). * \param md_alg The message digest that was used to hash the message. * \param hash The message hash to be signed. This must be a readable - * buffer of length \p blen Bytes. + * buffer of length \p hlen Bytes. * \param hlen The length of the hash \p hash in Bytes. * \param sig The buffer to which to write the signature. This must be a * writable buffer of length at least twice as large as the @@ -453,7 +442,7 @@ int mbedtls_ecdsa_write_signature_restartable(mbedtls_ecdsa_context *ctx, * and have a group and private key bound to it, for example * via mbedtls_ecdsa_genkey() or mbedtls_ecdsa_from_keypair(). * \param hash The message hash to be signed. This must be a readable - * buffer of length \p blen Bytes. + * buffer of length \p hlen Bytes. * \param hlen The length of the hash \p hash in Bytes. * \param sig The buffer to which to write the signature. This must be a * writable buffer of length at least twice as large as the @@ -490,7 +479,7 @@ int mbedtls_ecdsa_write_signature_det(mbedtls_ecdsa_context *ctx, * \param ctx The ECDSA context to use. This must be initialized * and have a group and public key bound to it. * \param hash The message hash that was signed. This must be a readable - * buffer of length \p size Bytes. + * buffer of length \p hlen Bytes. * \param hlen The size of the hash \p hash. * \param sig The signature to read and verify. This must be a readable * buffer of length \p slen Bytes. @@ -520,7 +509,7 @@ int mbedtls_ecdsa_read_signature(mbedtls_ecdsa_context *ctx, * \param ctx The ECDSA context to use. This must be initialized * and have a group and public key bound to it. * \param hash The message hash that was signed. This must be a readable - * buffer of length \p size Bytes. + * buffer of length \p hlen Bytes. * \param hlen The size of the hash \p hash. * \param sig The signature to read and verify. This must be a readable * buffer of length \p slen Bytes. diff --git a/c++/src/connect/mbedtls/mbedtls/ecjpake.h b/c++/src/connect/mbedtls/mbedtls/ecjpake.h index b9928386..1a984424 100644 --- a/c++/src/connect/mbedtls/mbedtls/ecjpake.h +++ b/c++/src/connect/mbedtls/mbedtls/ecjpake.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_ECJPAKE_H #define MBEDTLS_ECJPAKE_H diff --git a/c++/src/connect/mbedtls/mbedtls/ecp.h b/c++/src/connect/mbedtls/mbedtls/ecp.h index 5402e74b..33ea14d7 100644 --- a/c++/src/connect/mbedtls/mbedtls/ecp.h +++ b/c++/src/connect/mbedtls/mbedtls/ecp.h @@ -16,19 +16,7 @@ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_ECP_H @@ -42,6 +30,11 @@ #include "mbedtls/bignum.h" +#if (defined(__ARMCC_VERSION) || defined(_MSC_VER)) && \ + !defined(inline) && !defined(__cplusplus) +#define inline __inline +#endif + /* * ECP error codes */ @@ -214,7 +207,7 @@ mbedtls_ecp_point; #if !defined(MBEDTLS_ECP_ALT) /* - * default mbed TLS elliptic curve arithmetic implementation + * default Mbed TLS elliptic curve arithmetic implementation * * (in case MBEDTLS_ECP_ALT is defined then the developer has to provide an * alternative implementation for the whole module and it will replace this @@ -236,6 +229,27 @@ mbedtls_ecp_point; * odd prime as mbedtls_ecp_mul() requires an odd number, and * mbedtls_ecdsa_sign() requires that it is prime for blinding purposes. * + * The default implementation only initializes \p A without setting it to the + * authentic value for curves with A = -3(SECP256R1, etc), in which + * case you need to load \p A by yourself when using domain parameters directly, + * for example: + * \code + * mbedtls_mpi_init(&A); + * mbedtls_ecp_group_init(&grp); + * CHECK_RETURN(mbedtls_ecp_group_load(&grp, grp_id)); + * if (mbedtls_ecp_group_a_is_minus_3(&grp)) { + * CHECK_RETURN(mbedtls_mpi_sub_int(&A, &grp.P, 3)); + * } else { + * CHECK_RETURN(mbedtls_mpi_copy(&A, &grp.A)); + * } + * + * do_something_with_a(&A); + * + * cleanup: + * mbedtls_mpi_free(&A); + * mbedtls_ecp_group_free(&grp); + * \endcode + * * For Montgomery curves, we do not store \p A, but (A + 2) / 4, * which is the quantity used in the formulas. Additionally, \p nbits is * not the size of \p N but the required size for private keys. @@ -256,8 +270,11 @@ mbedtls_ecp_point; typedef struct mbedtls_ecp_group { mbedtls_ecp_group_id id; /*!< An internal group identifier. */ mbedtls_mpi P; /*!< The prime modulus of the base field. */ - mbedtls_mpi A; /*!< For Short Weierstrass: \p A in the equation. For - Montgomery curves: (A + 2) / 4. */ + mbedtls_mpi A; /*!< For Short Weierstrass: \p A in the equation. Note that + \p A is not set to the authentic value in some cases. + Refer to detailed description of ::mbedtls_ecp_group if + using domain parameters in the structure. + For Montgomery curves: (A + 2) / 4. */ mbedtls_mpi B; /*!< For Short Weierstrass: \p B in the equation. For Montgomery curves: unused. */ mbedtls_ecp_point G; /*!< The generator of the subgroup used. */ @@ -989,6 +1006,26 @@ int mbedtls_ecp_mul_restartable(mbedtls_ecp_group *grp, mbedtls_ecp_point *R, mbedtls_ecp_restart_ctx *rs_ctx); #if defined(MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED) +/** + * \brief This function checks if domain parameter A of the curve is + * \c -3. + * + * \note This function is only defined for short Weierstrass curves. + * It may not be included in builds without any short + * Weierstrass curve. + * + * \param grp The ECP group to use. + * This must be initialized and have group parameters + * set, for example through mbedtls_ecp_group_load(). + * + * \return \c 1 if A = -3. + * \return \c 0 Otherwise. + */ +static inline int mbedtls_ecp_group_a_is_minus_3(const mbedtls_ecp_group *grp) +{ + return grp->A.p == NULL; +} + /** * \brief This function performs multiplication and addition of two * points by integers: \p R = \p m * \p P + \p n * \p Q @@ -1081,7 +1118,7 @@ int mbedtls_ecp_muladd_restartable( * * It only checks that the point is non-zero, has * valid coordinates and lies on the curve. It does not verify - * that it is indeed a multiple of \p G. This additional + * that it is indeed a multiple of \c G. This additional * check is computationally more expensive, is not required * by standards, and should not be necessary if the group * used has a small cofactor. In particular, it is useless for @@ -1106,7 +1143,7 @@ int mbedtls_ecp_check_pubkey(const mbedtls_ecp_group *grp, const mbedtls_ecp_point *pt); /** - * \brief This function checks that an \p mbedtls_mpi is a + * \brief This function checks that an \c mbedtls_mpi is a * valid private key for this curve. * * \note This function uses bare components rather than an @@ -1228,6 +1265,8 @@ int mbedtls_ecp_gen_key(mbedtls_ecp_group_id grp_id, mbedtls_ecp_keypair *key, /** * \brief This function reads an elliptic curve private key. * + * \note This function does not support Curve448 yet. + * * \param grp_id The ECP group identifier. * \param key The destination key. * \param buf The buffer containing the binary representation of the @@ -1249,17 +1288,43 @@ int mbedtls_ecp_read_key(mbedtls_ecp_group_id grp_id, mbedtls_ecp_keypair *key, /** * \brief This function exports an elliptic curve private key. * + * \note Note that although this function accepts an output + * buffer that is smaller or larger than the key, most key + * import interfaces require the output to have exactly + * key's nominal length. It is generally simplest to + * pass the key's nominal length as \c buflen, after + * checking that the output buffer is large enough. + * See the description of the \p buflen parameter for + * how to calculate the nominal length. + * + * \note If the private key was not set in \p key, + * the output is unspecified. Future versions + * may return an error in that case. + * + * \note This function does not support Curve448 yet. + * * \param key The private key. * \param buf The output buffer for containing the binary representation - * of the key. (Big endian integer for Weierstrass curves, byte - * string for Montgomery curves.) + * of the key. + * For Weierstrass curves, this is the big-endian + * representation, padded with null bytes at the beginning + * to reach \p buflen bytes. + * For Montgomery curves, this is the standard byte string + * representation (which is little-endian), padded with + * null bytes at the end to reach \p buflen bytes. * \param buflen The total length of the buffer in bytes. + * The length of the output is + * (`grp->nbits` + 7) / 8 bytes + * where `grp->nbits` is the private key size in bits. + * For Weierstrass keys, if the output buffer is smaller, + * leading zeros are trimmed to fit if possible. For + * Montgomery keys, the output buffer must always be large + * enough for the nominal length. * * \return \c 0 on success. - * \return #MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL if the \p key - representation is larger than the available space in \p buf. - * \return #MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if the operation for - * the group is not implemented. + * \return #MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL or + * #MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL if the \p key + * representation is larger than the available space in \p buf. * \return Another negative error code on different kinds of failure. */ int mbedtls_ecp_write_key(mbedtls_ecp_keypair *key, diff --git a/c++/src/connect/mbedtls/mbedtls/ecp_internal.h b/c++/src/connect/mbedtls/mbedtls/ecp_internal.h index acaaa087..f6af5cbc 100644 --- a/c++/src/connect/mbedtls/mbedtls/ecp_internal.h +++ b/c++/src/connect/mbedtls/mbedtls/ecp_internal.h @@ -6,19 +6,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* diff --git a/c++/src/connect/mbedtls/mbedtls/entropy.h b/c++/src/connect/mbedtls/mbedtls/entropy.h index 4075d2ae..096bff8b 100644 --- a/c++/src/connect/mbedtls/mbedtls/entropy.h +++ b/c++/src/connect/mbedtls/mbedtls/entropy.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_ENTROPY_H #define MBEDTLS_ENTROPY_H diff --git a/c++/src/connect/mbedtls/mbedtls/entropy_poll.h b/c++/src/connect/mbedtls/mbedtls/entropy_poll.h index eca3b562..d7147b97 100644 --- a/c++/src/connect/mbedtls/mbedtls/entropy_poll.h +++ b/c++/src/connect/mbedtls/mbedtls/entropy_poll.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_ENTROPY_POLL_H #define MBEDTLS_ENTROPY_POLL_H @@ -82,7 +70,7 @@ int mbedtls_hardclock_poll(void *data, /** * \brief Entropy poll callback for a hardware source * - * \warning This is not provided by mbed TLS! + * \warning This is not provided by Mbed TLS! * See \c MBEDTLS_ENTROPY_HARDWARE_ALT in config.h. * * \note This must accept NULL as its first argument. diff --git a/c++/src/connect/mbedtls/mbedtls/error.h b/c++/src/connect/mbedtls/mbedtls/error.h index dd3c787d..7a183733 100644 --- a/c++/src/connect/mbedtls/mbedtls/error.h +++ b/c++/src/connect/mbedtls/mbedtls/error.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_ERROR_H #define MBEDTLS_ERROR_H @@ -171,9 +159,9 @@ static inline int mbedtls_error_add(int high, int low, } /** - * \brief Translate a mbed TLS error code into a string representation, - * Result is truncated if necessary and always includes a terminating - * null byte. + * \brief Translate an Mbed TLS error code into a string representation. + * The result is truncated if necessary and always includes a + * terminating null byte. * * \param errnum error code * \param buffer buffer to place representation in diff --git a/c++/src/connect/mbedtls/mbedtls/gcm.h b/c++/src/connect/mbedtls/mbedtls/gcm.h index c0408838..1ad0e9e9 100644 --- a/c++/src/connect/mbedtls/mbedtls/gcm.h +++ b/c++/src/connect/mbedtls/mbedtls/gcm.h @@ -13,19 +13,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_GCM_H diff --git a/c++/src/connect/mbedtls/mbedtls/havege.h b/c++/src/connect/mbedtls/mbedtls/havege.h index 7d042d19..cdaf8a89 100644 --- a/c++/src/connect/mbedtls/mbedtls/havege.h +++ b/c++/src/connect/mbedtls/mbedtls/havege.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_HAVEGE_H #define MBEDTLS_HAVEGE_H diff --git a/c++/src/connect/mbedtls/mbedtls/hkdf.h b/c++/src/connect/mbedtls/mbedtls/hkdf.h index 3118369f..103f329b 100644 --- a/c++/src/connect/mbedtls/mbedtls/hkdf.h +++ b/c++/src/connect/mbedtls/mbedtls/hkdf.h @@ -8,19 +8,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_HKDF_H #define MBEDTLS_HKDF_H diff --git a/c++/src/connect/mbedtls/mbedtls/hmac_drbg.h b/c++/src/connect/mbedtls/mbedtls/hmac_drbg.h index 3ccf61c7..d531382f 100644 --- a/c++/src/connect/mbedtls/mbedtls/hmac_drbg.h +++ b/c++/src/connect/mbedtls/mbedtls/hmac_drbg.h @@ -9,19 +9,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_HMAC_DRBG_H #define MBEDTLS_HMAC_DRBG_H @@ -186,8 +174,8 @@ void mbedtls_hmac_drbg_init(mbedtls_hmac_drbg_context *ctx); * \param len The length of the personalization string. * This must be at most #MBEDTLS_HMAC_DRBG_MAX_INPUT * and also at most - * #MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT - \p entropy_len * 3 / 2 - * where \p entropy_len is the entropy length + * #MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT - \c entropy_len * 3 / 2 + * where \c entropy_len is the entropy length * described above. * * \return \c 0 if successful. @@ -316,8 +304,8 @@ int mbedtls_hmac_drbg_update_ret(mbedtls_hmac_drbg_context *ctx, * \param len The length of the additional data. * This must be at most #MBEDTLS_HMAC_DRBG_MAX_INPUT * and also at most - * #MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT - \p entropy_len - * where \p entropy_len is the entropy length + * #MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT - \c entropy_len + * where \c entropy_len is the entropy length * (see mbedtls_hmac_drbg_set_entropy_len()). * * \return \c 0 if successful. diff --git a/c++/src/connect/mbedtls/mbedtls/md.h b/c++/src/connect/mbedtls/mbedtls/md.h index db4d14c0..7b431130 100644 --- a/c++/src/connect/mbedtls/mbedtls/md.h +++ b/c++/src/connect/mbedtls/mbedtls/md.h @@ -7,19 +7,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_MD_H diff --git a/c++/src/connect/mbedtls/mbedtls/md2.h b/c++/src/connect/mbedtls/mbedtls/md2.h index 68b0d327..afcf3a3e 100644 --- a/c++/src/connect/mbedtls/mbedtls/md2.h +++ b/c++/src/connect/mbedtls/mbedtls/md2.h @@ -9,19 +9,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * */ #ifndef MBEDTLS_MD2_H diff --git a/c++/src/connect/mbedtls/mbedtls/md4.h b/c++/src/connect/mbedtls/mbedtls/md4.h index fd64710a..b827ffec 100644 --- a/c++/src/connect/mbedtls/mbedtls/md4.h +++ b/c++/src/connect/mbedtls/mbedtls/md4.h @@ -9,19 +9,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * */ #ifndef MBEDTLS_MD4_H diff --git a/c++/src/connect/mbedtls/mbedtls/md5.h b/c++/src/connect/mbedtls/mbedtls/md5.h index 04f71ee3..fdc530a1 100644 --- a/c++/src/connect/mbedtls/mbedtls/md5.h +++ b/c++/src/connect/mbedtls/mbedtls/md5.h @@ -9,19 +9,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_MD5_H #define MBEDTLS_MD5_H diff --git a/c++/src/connect/mbedtls/mbedtls/md_internal.h b/c++/src/connect/mbedtls/mbedtls/md_internal.h index 9e10f240..239fdd9b 100644 --- a/c++/src/connect/mbedtls/mbedtls/md_internal.h +++ b/c++/src/connect/mbedtls/mbedtls/md_internal.h @@ -9,19 +9,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_MD_WRAP_H #define MBEDTLS_MD_WRAP_H diff --git a/c++/src/connect/mbedtls/mbedtls/memory_buffer_alloc.h b/c++/src/connect/mbedtls/mbedtls/memory_buffer_alloc.h index bc282521..34013b9b 100644 --- a/c++/src/connect/mbedtls/mbedtls/memory_buffer_alloc.h +++ b/c++/src/connect/mbedtls/mbedtls/memory_buffer_alloc.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_MEMORY_BUFFER_ALLOC_H #define MBEDTLS_MEMORY_BUFFER_ALLOC_H diff --git a/c++/src/connect/mbedtls/mbedtls/ncbicxx_rename_mbedtls.h b/c++/src/connect/mbedtls/mbedtls/ncbicxx_rename_mbedtls.h index 70a684df..9ddb8fcb 100644 --- a/c++/src/connect/mbedtls/mbedtls/ncbicxx_rename_mbedtls.h +++ b/c++/src/connect/mbedtls/mbedtls/ncbicxx_rename_mbedtls.h @@ -2,2305 +2,2325 @@ for x in connect/mbedtls/?*.o; do echo ${x##*mbedtls?} $x; done | sort | \ while read _ x; do nm -g --defined-only $x | sed -e 's,_ncbicxx_.*,,' | \ sort -k3; done | \ - awk '/ / { s=substr($3, 1); print "#define", s " \\\n " s "_ncbicxx_2_28_3" }' + awk '/ / { s=substr($3, 1); print "#define", s " \\\n " s "_ncbicxx_2_28_8" }' */ #define mbedtls_aes_crypt_cbc \ - mbedtls_aes_crypt_cbc_ncbicxx_2_28_3 + mbedtls_aes_crypt_cbc_ncbicxx_2_28_8 #define mbedtls_aes_crypt_cfb128 \ - mbedtls_aes_crypt_cfb128_ncbicxx_2_28_3 + mbedtls_aes_crypt_cfb128_ncbicxx_2_28_8 #define mbedtls_aes_crypt_cfb8 \ - mbedtls_aes_crypt_cfb8_ncbicxx_2_28_3 + mbedtls_aes_crypt_cfb8_ncbicxx_2_28_8 #define mbedtls_aes_crypt_ctr \ - mbedtls_aes_crypt_ctr_ncbicxx_2_28_3 + mbedtls_aes_crypt_ctr_ncbicxx_2_28_8 #define mbedtls_aes_crypt_ecb \ - mbedtls_aes_crypt_ecb_ncbicxx_2_28_3 + mbedtls_aes_crypt_ecb_ncbicxx_2_28_8 #define mbedtls_aes_crypt_ofb \ - mbedtls_aes_crypt_ofb_ncbicxx_2_28_3 + mbedtls_aes_crypt_ofb_ncbicxx_2_28_8 #define mbedtls_aes_crypt_xts \ - mbedtls_aes_crypt_xts_ncbicxx_2_28_3 + mbedtls_aes_crypt_xts_ncbicxx_2_28_8 #define mbedtls_aes_decrypt \ - mbedtls_aes_decrypt_ncbicxx_2_28_3 + mbedtls_aes_decrypt_ncbicxx_2_28_8 #define mbedtls_aes_encrypt \ - mbedtls_aes_encrypt_ncbicxx_2_28_3 + mbedtls_aes_encrypt_ncbicxx_2_28_8 #define mbedtls_aes_free \ - mbedtls_aes_free_ncbicxx_2_28_3 + mbedtls_aes_free_ncbicxx_2_28_8 #define mbedtls_aes_init \ - mbedtls_aes_init_ncbicxx_2_28_3 + mbedtls_aes_init_ncbicxx_2_28_8 #define mbedtls_aes_setkey_dec \ - mbedtls_aes_setkey_dec_ncbicxx_2_28_3 + mbedtls_aes_setkey_dec_ncbicxx_2_28_8 #define mbedtls_aes_setkey_enc \ - mbedtls_aes_setkey_enc_ncbicxx_2_28_3 + mbedtls_aes_setkey_enc_ncbicxx_2_28_8 #define mbedtls_aes_xts_free \ - mbedtls_aes_xts_free_ncbicxx_2_28_3 + mbedtls_aes_xts_free_ncbicxx_2_28_8 #define mbedtls_aes_xts_init \ - mbedtls_aes_xts_init_ncbicxx_2_28_3 + mbedtls_aes_xts_init_ncbicxx_2_28_8 #define mbedtls_aes_xts_setkey_dec \ - mbedtls_aes_xts_setkey_dec_ncbicxx_2_28_3 + mbedtls_aes_xts_setkey_dec_ncbicxx_2_28_8 #define mbedtls_aes_xts_setkey_enc \ - mbedtls_aes_xts_setkey_enc_ncbicxx_2_28_3 + mbedtls_aes_xts_setkey_enc_ncbicxx_2_28_8 #define mbedtls_internal_aes_decrypt \ - mbedtls_internal_aes_decrypt_ncbicxx_2_28_3 + mbedtls_internal_aes_decrypt_ncbicxx_2_28_8 #define mbedtls_internal_aes_encrypt \ - mbedtls_internal_aes_encrypt_ncbicxx_2_28_3 + mbedtls_internal_aes_encrypt_ncbicxx_2_28_8 #define mbedtls_aesni_crypt_ecb \ - mbedtls_aesni_crypt_ecb_ncbicxx_2_28_3 + mbedtls_aesni_crypt_ecb_ncbicxx_2_28_8 #define mbedtls_aesni_gcm_mult \ - mbedtls_aesni_gcm_mult_ncbicxx_2_28_3 + mbedtls_aesni_gcm_mult_ncbicxx_2_28_8 #define mbedtls_aesni_has_support \ - mbedtls_aesni_has_support_ncbicxx_2_28_3 + mbedtls_aesni_has_support_ncbicxx_2_28_8 #define mbedtls_aesni_inverse_key \ - mbedtls_aesni_inverse_key_ncbicxx_2_28_3 + mbedtls_aesni_inverse_key_ncbicxx_2_28_8 #define mbedtls_aesni_setkey_enc \ - mbedtls_aesni_setkey_enc_ncbicxx_2_28_3 + mbedtls_aesni_setkey_enc_ncbicxx_2_28_8 #define mbedtls_arc4_crypt \ - mbedtls_arc4_crypt_ncbicxx_2_28_3 + mbedtls_arc4_crypt_ncbicxx_2_28_8 #define mbedtls_arc4_free \ - mbedtls_arc4_free_ncbicxx_2_28_3 + mbedtls_arc4_free_ncbicxx_2_28_8 #define mbedtls_arc4_init \ - mbedtls_arc4_init_ncbicxx_2_28_3 + mbedtls_arc4_init_ncbicxx_2_28_8 #define mbedtls_arc4_setup \ - mbedtls_arc4_setup_ncbicxx_2_28_3 + mbedtls_arc4_setup_ncbicxx_2_28_8 #define mbedtls_asn1_find_named_data \ - mbedtls_asn1_find_named_data_ncbicxx_2_28_3 + mbedtls_asn1_find_named_data_ncbicxx_2_28_8 #define mbedtls_asn1_free_named_data \ - mbedtls_asn1_free_named_data_ncbicxx_2_28_3 + mbedtls_asn1_free_named_data_ncbicxx_2_28_8 #define mbedtls_asn1_free_named_data_list \ - mbedtls_asn1_free_named_data_list_ncbicxx_2_28_3 + mbedtls_asn1_free_named_data_list_ncbicxx_2_28_8 #define mbedtls_asn1_get_alg \ - mbedtls_asn1_get_alg_ncbicxx_2_28_3 + mbedtls_asn1_get_alg_ncbicxx_2_28_8 #define mbedtls_asn1_get_alg_null \ - mbedtls_asn1_get_alg_null_ncbicxx_2_28_3 + mbedtls_asn1_get_alg_null_ncbicxx_2_28_8 #define mbedtls_asn1_get_bitstring \ - mbedtls_asn1_get_bitstring_ncbicxx_2_28_3 + mbedtls_asn1_get_bitstring_ncbicxx_2_28_8 #define mbedtls_asn1_get_bitstring_null \ - mbedtls_asn1_get_bitstring_null_ncbicxx_2_28_3 + mbedtls_asn1_get_bitstring_null_ncbicxx_2_28_8 #define mbedtls_asn1_get_bool \ - mbedtls_asn1_get_bool_ncbicxx_2_28_3 + mbedtls_asn1_get_bool_ncbicxx_2_28_8 #define mbedtls_asn1_get_enum \ - mbedtls_asn1_get_enum_ncbicxx_2_28_3 + mbedtls_asn1_get_enum_ncbicxx_2_28_8 #define mbedtls_asn1_get_int \ - mbedtls_asn1_get_int_ncbicxx_2_28_3 + mbedtls_asn1_get_int_ncbicxx_2_28_8 #define mbedtls_asn1_get_len \ - mbedtls_asn1_get_len_ncbicxx_2_28_3 + mbedtls_asn1_get_len_ncbicxx_2_28_8 #define mbedtls_asn1_get_mpi \ - mbedtls_asn1_get_mpi_ncbicxx_2_28_3 + mbedtls_asn1_get_mpi_ncbicxx_2_28_8 #define mbedtls_asn1_get_sequence_of \ - mbedtls_asn1_get_sequence_of_ncbicxx_2_28_3 + mbedtls_asn1_get_sequence_of_ncbicxx_2_28_8 #define mbedtls_asn1_get_tag \ - mbedtls_asn1_get_tag_ncbicxx_2_28_3 + mbedtls_asn1_get_tag_ncbicxx_2_28_8 #define mbedtls_asn1_sequence_free \ - mbedtls_asn1_sequence_free_ncbicxx_2_28_3 + mbedtls_asn1_sequence_free_ncbicxx_2_28_8 #define mbedtls_asn1_traverse_sequence_of \ - mbedtls_asn1_traverse_sequence_of_ncbicxx_2_28_3 + mbedtls_asn1_traverse_sequence_of_ncbicxx_2_28_8 #define mbedtls_asn1_store_named_data \ - mbedtls_asn1_store_named_data_ncbicxx_2_28_3 + mbedtls_asn1_store_named_data_ncbicxx_2_28_8 #define mbedtls_asn1_write_algorithm_identifier \ - mbedtls_asn1_write_algorithm_identifier_ncbicxx_2_28_3 + mbedtls_asn1_write_algorithm_identifier_ncbicxx_2_28_8 +#define mbedtls_asn1_write_algorithm_identifier_ext \ + mbedtls_asn1_write_algorithm_identifier_ext_ncbicxx_2_28_8 #define mbedtls_asn1_write_bitstring \ - mbedtls_asn1_write_bitstring_ncbicxx_2_28_3 + mbedtls_asn1_write_bitstring_ncbicxx_2_28_8 #define mbedtls_asn1_write_bool \ - mbedtls_asn1_write_bool_ncbicxx_2_28_3 + mbedtls_asn1_write_bool_ncbicxx_2_28_8 #define mbedtls_asn1_write_enum \ - mbedtls_asn1_write_enum_ncbicxx_2_28_3 + mbedtls_asn1_write_enum_ncbicxx_2_28_8 #define mbedtls_asn1_write_ia5_string \ - mbedtls_asn1_write_ia5_string_ncbicxx_2_28_3 + mbedtls_asn1_write_ia5_string_ncbicxx_2_28_8 #define mbedtls_asn1_write_int \ - mbedtls_asn1_write_int_ncbicxx_2_28_3 + mbedtls_asn1_write_int_ncbicxx_2_28_8 #define mbedtls_asn1_write_len \ - mbedtls_asn1_write_len_ncbicxx_2_28_3 + mbedtls_asn1_write_len_ncbicxx_2_28_8 #define mbedtls_asn1_write_mpi \ - mbedtls_asn1_write_mpi_ncbicxx_2_28_3 + mbedtls_asn1_write_mpi_ncbicxx_2_28_8 #define mbedtls_asn1_write_named_bitstring \ - mbedtls_asn1_write_named_bitstring_ncbicxx_2_28_3 + mbedtls_asn1_write_named_bitstring_ncbicxx_2_28_8 #define mbedtls_asn1_write_null \ - mbedtls_asn1_write_null_ncbicxx_2_28_3 + mbedtls_asn1_write_null_ncbicxx_2_28_8 #define mbedtls_asn1_write_octet_string \ - mbedtls_asn1_write_octet_string_ncbicxx_2_28_3 + mbedtls_asn1_write_octet_string_ncbicxx_2_28_8 #define mbedtls_asn1_write_oid \ - mbedtls_asn1_write_oid_ncbicxx_2_28_3 + mbedtls_asn1_write_oid_ncbicxx_2_28_8 #define mbedtls_asn1_write_printable_string \ - mbedtls_asn1_write_printable_string_ncbicxx_2_28_3 + mbedtls_asn1_write_printable_string_ncbicxx_2_28_8 #define mbedtls_asn1_write_raw_buffer \ - mbedtls_asn1_write_raw_buffer_ncbicxx_2_28_3 + mbedtls_asn1_write_raw_buffer_ncbicxx_2_28_8 #define mbedtls_asn1_write_tag \ - mbedtls_asn1_write_tag_ncbicxx_2_28_3 + mbedtls_asn1_write_tag_ncbicxx_2_28_8 #define mbedtls_asn1_write_tagged_string \ - mbedtls_asn1_write_tagged_string_ncbicxx_2_28_3 + mbedtls_asn1_write_tagged_string_ncbicxx_2_28_8 #define mbedtls_asn1_write_utf8_string \ - mbedtls_asn1_write_utf8_string_ncbicxx_2_28_3 + mbedtls_asn1_write_utf8_string_ncbicxx_2_28_8 #define mbedtls_base64_decode \ - mbedtls_base64_decode_ncbicxx_2_28_3 + mbedtls_base64_decode_ncbicxx_2_28_8 #define mbedtls_base64_encode \ - mbedtls_base64_encode_ncbicxx_2_28_3 + mbedtls_base64_encode_ncbicxx_2_28_8 #define mbedtls_mpi_add_abs \ - mbedtls_mpi_add_abs_ncbicxx_2_28_3 + mbedtls_mpi_add_abs_ncbicxx_2_28_8 #define mbedtls_mpi_add_int \ - mbedtls_mpi_add_int_ncbicxx_2_28_3 + mbedtls_mpi_add_int_ncbicxx_2_28_8 #define mbedtls_mpi_add_mpi \ - mbedtls_mpi_add_mpi_ncbicxx_2_28_3 + mbedtls_mpi_add_mpi_ncbicxx_2_28_8 #define mbedtls_mpi_bitlen \ - mbedtls_mpi_bitlen_ncbicxx_2_28_3 + mbedtls_mpi_bitlen_ncbicxx_2_28_8 #define mbedtls_mpi_cmp_abs \ - mbedtls_mpi_cmp_abs_ncbicxx_2_28_3 + mbedtls_mpi_cmp_abs_ncbicxx_2_28_8 #define mbedtls_mpi_cmp_int \ - mbedtls_mpi_cmp_int_ncbicxx_2_28_3 + mbedtls_mpi_cmp_int_ncbicxx_2_28_8 #define mbedtls_mpi_cmp_mpi \ - mbedtls_mpi_cmp_mpi_ncbicxx_2_28_3 + mbedtls_mpi_cmp_mpi_ncbicxx_2_28_8 #define mbedtls_mpi_copy \ - mbedtls_mpi_copy_ncbicxx_2_28_3 + mbedtls_mpi_copy_ncbicxx_2_28_8 #define mbedtls_mpi_div_int \ - mbedtls_mpi_div_int_ncbicxx_2_28_3 + mbedtls_mpi_div_int_ncbicxx_2_28_8 #define mbedtls_mpi_div_mpi \ - mbedtls_mpi_div_mpi_ncbicxx_2_28_3 + mbedtls_mpi_div_mpi_ncbicxx_2_28_8 #define mbedtls_mpi_exp_mod \ - mbedtls_mpi_exp_mod_ncbicxx_2_28_3 + mbedtls_mpi_exp_mod_ncbicxx_2_28_8 #define mbedtls_mpi_fill_random \ - mbedtls_mpi_fill_random_ncbicxx_2_28_3 + mbedtls_mpi_fill_random_ncbicxx_2_28_8 #define mbedtls_mpi_free \ - mbedtls_mpi_free_ncbicxx_2_28_3 + mbedtls_mpi_free_ncbicxx_2_28_8 #define mbedtls_mpi_gcd \ - mbedtls_mpi_gcd_ncbicxx_2_28_3 + mbedtls_mpi_gcd_ncbicxx_2_28_8 #define mbedtls_mpi_gen_prime \ - mbedtls_mpi_gen_prime_ncbicxx_2_28_3 + mbedtls_mpi_gen_prime_ncbicxx_2_28_8 #define mbedtls_mpi_get_bit \ - mbedtls_mpi_get_bit_ncbicxx_2_28_3 + mbedtls_mpi_get_bit_ncbicxx_2_28_8 +#define mbedtls_mpi_get_mont_r2_unsafe \ + mbedtls_mpi_get_mont_r2_unsafe_ncbicxx_2_28_8 #define mbedtls_mpi_grow \ - mbedtls_mpi_grow_ncbicxx_2_28_3 + mbedtls_mpi_grow_ncbicxx_2_28_8 #define mbedtls_mpi_init \ - mbedtls_mpi_init_ncbicxx_2_28_3 + mbedtls_mpi_init_ncbicxx_2_28_8 #define mbedtls_mpi_inv_mod \ - mbedtls_mpi_inv_mod_ncbicxx_2_28_3 + mbedtls_mpi_inv_mod_ncbicxx_2_28_8 #define mbedtls_mpi_is_prime \ - mbedtls_mpi_is_prime_ncbicxx_2_28_3 + mbedtls_mpi_is_prime_ncbicxx_2_28_8 #define mbedtls_mpi_is_prime_ext \ - mbedtls_mpi_is_prime_ext_ncbicxx_2_28_3 + mbedtls_mpi_is_prime_ext_ncbicxx_2_28_8 #define mbedtls_mpi_lsb \ - mbedtls_mpi_lsb_ncbicxx_2_28_3 + mbedtls_mpi_lsb_ncbicxx_2_28_8 #define mbedtls_mpi_lset \ - mbedtls_mpi_lset_ncbicxx_2_28_3 + mbedtls_mpi_lset_ncbicxx_2_28_8 #define mbedtls_mpi_mod_int \ - mbedtls_mpi_mod_int_ncbicxx_2_28_3 + mbedtls_mpi_mod_int_ncbicxx_2_28_8 #define mbedtls_mpi_mod_mpi \ - mbedtls_mpi_mod_mpi_ncbicxx_2_28_3 + mbedtls_mpi_mod_mpi_ncbicxx_2_28_8 +#define mbedtls_mpi_montmul \ + mbedtls_mpi_montmul_ncbicxx_2_28_8 +#define mbedtls_mpi_montmul_init \ + mbedtls_mpi_montmul_init_ncbicxx_2_28_8 #define mbedtls_mpi_mul_int \ - mbedtls_mpi_mul_int_ncbicxx_2_28_3 + mbedtls_mpi_mul_int_ncbicxx_2_28_8 #define mbedtls_mpi_mul_mpi \ - mbedtls_mpi_mul_mpi_ncbicxx_2_28_3 + mbedtls_mpi_mul_mpi_ncbicxx_2_28_8 #define mbedtls_mpi_random \ - mbedtls_mpi_random_ncbicxx_2_28_3 + mbedtls_mpi_random_ncbicxx_2_28_8 #define mbedtls_mpi_read_binary \ - mbedtls_mpi_read_binary_ncbicxx_2_28_3 + mbedtls_mpi_read_binary_ncbicxx_2_28_8 #define mbedtls_mpi_read_binary_le \ - mbedtls_mpi_read_binary_le_ncbicxx_2_28_3 + mbedtls_mpi_read_binary_le_ncbicxx_2_28_8 #define mbedtls_mpi_read_file \ - mbedtls_mpi_read_file_ncbicxx_2_28_3 + mbedtls_mpi_read_file_ncbicxx_2_28_8 #define mbedtls_mpi_read_string \ - mbedtls_mpi_read_string_ncbicxx_2_28_3 + mbedtls_mpi_read_string_ncbicxx_2_28_8 #define mbedtls_mpi_set_bit \ - mbedtls_mpi_set_bit_ncbicxx_2_28_3 + mbedtls_mpi_set_bit_ncbicxx_2_28_8 #define mbedtls_mpi_shift_l \ - mbedtls_mpi_shift_l_ncbicxx_2_28_3 + mbedtls_mpi_shift_l_ncbicxx_2_28_8 #define mbedtls_mpi_shift_r \ - mbedtls_mpi_shift_r_ncbicxx_2_28_3 + mbedtls_mpi_shift_r_ncbicxx_2_28_8 #define mbedtls_mpi_shrink \ - mbedtls_mpi_shrink_ncbicxx_2_28_3 + mbedtls_mpi_shrink_ncbicxx_2_28_8 #define mbedtls_mpi_size \ - mbedtls_mpi_size_ncbicxx_2_28_3 + mbedtls_mpi_size_ncbicxx_2_28_8 #define mbedtls_mpi_sub_abs \ - mbedtls_mpi_sub_abs_ncbicxx_2_28_3 + mbedtls_mpi_sub_abs_ncbicxx_2_28_8 #define mbedtls_mpi_sub_int \ - mbedtls_mpi_sub_int_ncbicxx_2_28_3 + mbedtls_mpi_sub_int_ncbicxx_2_28_8 #define mbedtls_mpi_sub_mpi \ - mbedtls_mpi_sub_mpi_ncbicxx_2_28_3 + mbedtls_mpi_sub_mpi_ncbicxx_2_28_8 #define mbedtls_mpi_swap \ - mbedtls_mpi_swap_ncbicxx_2_28_3 + mbedtls_mpi_swap_ncbicxx_2_28_8 #define mbedtls_mpi_write_binary \ - mbedtls_mpi_write_binary_ncbicxx_2_28_3 + mbedtls_mpi_write_binary_ncbicxx_2_28_8 #define mbedtls_mpi_write_binary_le \ - mbedtls_mpi_write_binary_le_ncbicxx_2_28_3 + mbedtls_mpi_write_binary_le_ncbicxx_2_28_8 #define mbedtls_mpi_write_file \ - mbedtls_mpi_write_file_ncbicxx_2_28_3 + mbedtls_mpi_write_file_ncbicxx_2_28_8 #define mbedtls_mpi_write_string \ - mbedtls_mpi_write_string_ncbicxx_2_28_3 + mbedtls_mpi_write_string_ncbicxx_2_28_8 #define mbedtls_blowfish_crypt_cbc \ - mbedtls_blowfish_crypt_cbc_ncbicxx_2_28_3 + mbedtls_blowfish_crypt_cbc_ncbicxx_2_28_8 #define mbedtls_blowfish_crypt_cfb64 \ - mbedtls_blowfish_crypt_cfb64_ncbicxx_2_28_3 + mbedtls_blowfish_crypt_cfb64_ncbicxx_2_28_8 #define mbedtls_blowfish_crypt_ctr \ - mbedtls_blowfish_crypt_ctr_ncbicxx_2_28_3 + mbedtls_blowfish_crypt_ctr_ncbicxx_2_28_8 #define mbedtls_blowfish_crypt_ecb \ - mbedtls_blowfish_crypt_ecb_ncbicxx_2_28_3 + mbedtls_blowfish_crypt_ecb_ncbicxx_2_28_8 #define mbedtls_blowfish_free \ - mbedtls_blowfish_free_ncbicxx_2_28_3 + mbedtls_blowfish_free_ncbicxx_2_28_8 #define mbedtls_blowfish_init \ - mbedtls_blowfish_init_ncbicxx_2_28_3 + mbedtls_blowfish_init_ncbicxx_2_28_8 #define mbedtls_blowfish_setkey \ - mbedtls_blowfish_setkey_ncbicxx_2_28_3 + mbedtls_blowfish_setkey_ncbicxx_2_28_8 #define mbedtls_camellia_crypt_cbc \ - mbedtls_camellia_crypt_cbc_ncbicxx_2_28_3 + mbedtls_camellia_crypt_cbc_ncbicxx_2_28_8 #define mbedtls_camellia_crypt_cfb128 \ - mbedtls_camellia_crypt_cfb128_ncbicxx_2_28_3 + mbedtls_camellia_crypt_cfb128_ncbicxx_2_28_8 #define mbedtls_camellia_crypt_ctr \ - mbedtls_camellia_crypt_ctr_ncbicxx_2_28_3 + mbedtls_camellia_crypt_ctr_ncbicxx_2_28_8 #define mbedtls_camellia_crypt_ecb \ - mbedtls_camellia_crypt_ecb_ncbicxx_2_28_3 + mbedtls_camellia_crypt_ecb_ncbicxx_2_28_8 #define mbedtls_camellia_free \ - mbedtls_camellia_free_ncbicxx_2_28_3 + mbedtls_camellia_free_ncbicxx_2_28_8 #define mbedtls_camellia_init \ - mbedtls_camellia_init_ncbicxx_2_28_3 + mbedtls_camellia_init_ncbicxx_2_28_8 #define mbedtls_camellia_setkey_dec \ - mbedtls_camellia_setkey_dec_ncbicxx_2_28_3 + mbedtls_camellia_setkey_dec_ncbicxx_2_28_8 #define mbedtls_camellia_setkey_enc \ - mbedtls_camellia_setkey_enc_ncbicxx_2_28_3 + mbedtls_camellia_setkey_enc_ncbicxx_2_28_8 #define mbedtls_ccm_auth_decrypt \ - mbedtls_ccm_auth_decrypt_ncbicxx_2_28_3 + mbedtls_ccm_auth_decrypt_ncbicxx_2_28_8 #define mbedtls_ccm_encrypt_and_tag \ - mbedtls_ccm_encrypt_and_tag_ncbicxx_2_28_3 + mbedtls_ccm_encrypt_and_tag_ncbicxx_2_28_8 #define mbedtls_ccm_free \ - mbedtls_ccm_free_ncbicxx_2_28_3 + mbedtls_ccm_free_ncbicxx_2_28_8 #define mbedtls_ccm_init \ - mbedtls_ccm_init_ncbicxx_2_28_3 + mbedtls_ccm_init_ncbicxx_2_28_8 #define mbedtls_ccm_setkey \ - mbedtls_ccm_setkey_ncbicxx_2_28_3 + mbedtls_ccm_setkey_ncbicxx_2_28_8 #define mbedtls_ccm_star_auth_decrypt \ - mbedtls_ccm_star_auth_decrypt_ncbicxx_2_28_3 + mbedtls_ccm_star_auth_decrypt_ncbicxx_2_28_8 #define mbedtls_ccm_star_encrypt_and_tag \ - mbedtls_ccm_star_encrypt_and_tag_ncbicxx_2_28_3 + mbedtls_ccm_star_encrypt_and_tag_ncbicxx_2_28_8 #define mbedtls_test_ca_crt \ - mbedtls_test_ca_crt_ncbicxx_2_28_3 + mbedtls_test_ca_crt_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_ec \ - mbedtls_test_ca_crt_ec_ncbicxx_2_28_3 + mbedtls_test_ca_crt_ec_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_ec_der \ - mbedtls_test_ca_crt_ec_der_ncbicxx_2_28_3 + mbedtls_test_ca_crt_ec_der_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_ec_der_len \ - mbedtls_test_ca_crt_ec_der_len_ncbicxx_2_28_3 + mbedtls_test_ca_crt_ec_der_len_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_ec_len \ - mbedtls_test_ca_crt_ec_len_ncbicxx_2_28_3 + mbedtls_test_ca_crt_ec_len_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_ec_pem \ - mbedtls_test_ca_crt_ec_pem_ncbicxx_2_28_3 + mbedtls_test_ca_crt_ec_pem_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_ec_pem_len \ - mbedtls_test_ca_crt_ec_pem_len_ncbicxx_2_28_3 + mbedtls_test_ca_crt_ec_pem_len_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_len \ - mbedtls_test_ca_crt_len_ncbicxx_2_28_3 + mbedtls_test_ca_crt_len_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_rsa \ - mbedtls_test_ca_crt_rsa_ncbicxx_2_28_3 + mbedtls_test_ca_crt_rsa_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_rsa_len \ - mbedtls_test_ca_crt_rsa_len_ncbicxx_2_28_3 + mbedtls_test_ca_crt_rsa_len_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_rsa_sha1 \ - mbedtls_test_ca_crt_rsa_sha1_ncbicxx_2_28_3 + mbedtls_test_ca_crt_rsa_sha1_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_rsa_sha1_der \ - mbedtls_test_ca_crt_rsa_sha1_der_ncbicxx_2_28_3 + mbedtls_test_ca_crt_rsa_sha1_der_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_rsa_sha1_der_len \ - mbedtls_test_ca_crt_rsa_sha1_der_len_ncbicxx_2_28_3 + mbedtls_test_ca_crt_rsa_sha1_der_len_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_rsa_sha1_len \ - mbedtls_test_ca_crt_rsa_sha1_len_ncbicxx_2_28_3 + mbedtls_test_ca_crt_rsa_sha1_len_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_rsa_sha1_pem \ - mbedtls_test_ca_crt_rsa_sha1_pem_ncbicxx_2_28_3 + mbedtls_test_ca_crt_rsa_sha1_pem_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_rsa_sha1_pem_len \ - mbedtls_test_ca_crt_rsa_sha1_pem_len_ncbicxx_2_28_3 + mbedtls_test_ca_crt_rsa_sha1_pem_len_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_rsa_sha256 \ - mbedtls_test_ca_crt_rsa_sha256_ncbicxx_2_28_3 + mbedtls_test_ca_crt_rsa_sha256_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_rsa_sha256_der \ - mbedtls_test_ca_crt_rsa_sha256_der_ncbicxx_2_28_3 + mbedtls_test_ca_crt_rsa_sha256_der_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_rsa_sha256_der_len \ - mbedtls_test_ca_crt_rsa_sha256_der_len_ncbicxx_2_28_3 + mbedtls_test_ca_crt_rsa_sha256_der_len_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_rsa_sha256_len \ - mbedtls_test_ca_crt_rsa_sha256_len_ncbicxx_2_28_3 + mbedtls_test_ca_crt_rsa_sha256_len_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_rsa_sha256_pem \ - mbedtls_test_ca_crt_rsa_sha256_pem_ncbicxx_2_28_3 + mbedtls_test_ca_crt_rsa_sha256_pem_ncbicxx_2_28_8 #define mbedtls_test_ca_crt_rsa_sha256_pem_len \ - mbedtls_test_ca_crt_rsa_sha256_pem_len_ncbicxx_2_28_3 + mbedtls_test_ca_crt_rsa_sha256_pem_len_ncbicxx_2_28_8 #define mbedtls_test_ca_key \ - mbedtls_test_ca_key_ncbicxx_2_28_3 + mbedtls_test_ca_key_ncbicxx_2_28_8 #define mbedtls_test_ca_key_ec \ - mbedtls_test_ca_key_ec_ncbicxx_2_28_3 + mbedtls_test_ca_key_ec_ncbicxx_2_28_8 #define mbedtls_test_ca_key_ec_der \ - mbedtls_test_ca_key_ec_der_ncbicxx_2_28_3 + mbedtls_test_ca_key_ec_der_ncbicxx_2_28_8 #define mbedtls_test_ca_key_ec_der_len \ - mbedtls_test_ca_key_ec_der_len_ncbicxx_2_28_3 + mbedtls_test_ca_key_ec_der_len_ncbicxx_2_28_8 #define mbedtls_test_ca_key_ec_len \ - mbedtls_test_ca_key_ec_len_ncbicxx_2_28_3 + mbedtls_test_ca_key_ec_len_ncbicxx_2_28_8 #define mbedtls_test_ca_key_ec_pem \ - mbedtls_test_ca_key_ec_pem_ncbicxx_2_28_3 + mbedtls_test_ca_key_ec_pem_ncbicxx_2_28_8 #define mbedtls_test_ca_key_ec_pem_len \ - mbedtls_test_ca_key_ec_pem_len_ncbicxx_2_28_3 + mbedtls_test_ca_key_ec_pem_len_ncbicxx_2_28_8 #define mbedtls_test_ca_key_len \ - mbedtls_test_ca_key_len_ncbicxx_2_28_3 + mbedtls_test_ca_key_len_ncbicxx_2_28_8 #define mbedtls_test_ca_key_rsa \ - mbedtls_test_ca_key_rsa_ncbicxx_2_28_3 + mbedtls_test_ca_key_rsa_ncbicxx_2_28_8 #define mbedtls_test_ca_key_rsa_der \ - mbedtls_test_ca_key_rsa_der_ncbicxx_2_28_3 + mbedtls_test_ca_key_rsa_der_ncbicxx_2_28_8 #define mbedtls_test_ca_key_rsa_der_len \ - mbedtls_test_ca_key_rsa_der_len_ncbicxx_2_28_3 + mbedtls_test_ca_key_rsa_der_len_ncbicxx_2_28_8 #define mbedtls_test_ca_key_rsa_len \ - mbedtls_test_ca_key_rsa_len_ncbicxx_2_28_3 + mbedtls_test_ca_key_rsa_len_ncbicxx_2_28_8 #define mbedtls_test_ca_key_rsa_pem \ - mbedtls_test_ca_key_rsa_pem_ncbicxx_2_28_3 + mbedtls_test_ca_key_rsa_pem_ncbicxx_2_28_8 #define mbedtls_test_ca_key_rsa_pem_len \ - mbedtls_test_ca_key_rsa_pem_len_ncbicxx_2_28_3 + mbedtls_test_ca_key_rsa_pem_len_ncbicxx_2_28_8 #define mbedtls_test_ca_pwd \ - mbedtls_test_ca_pwd_ncbicxx_2_28_3 + mbedtls_test_ca_pwd_ncbicxx_2_28_8 #define mbedtls_test_ca_pwd_ec \ - mbedtls_test_ca_pwd_ec_ncbicxx_2_28_3 + mbedtls_test_ca_pwd_ec_ncbicxx_2_28_8 #define mbedtls_test_ca_pwd_ec_der_len \ - mbedtls_test_ca_pwd_ec_der_len_ncbicxx_2_28_3 + mbedtls_test_ca_pwd_ec_der_len_ncbicxx_2_28_8 #define mbedtls_test_ca_pwd_ec_len \ - mbedtls_test_ca_pwd_ec_len_ncbicxx_2_28_3 + mbedtls_test_ca_pwd_ec_len_ncbicxx_2_28_8 #define mbedtls_test_ca_pwd_ec_pem \ - mbedtls_test_ca_pwd_ec_pem_ncbicxx_2_28_3 + mbedtls_test_ca_pwd_ec_pem_ncbicxx_2_28_8 #define mbedtls_test_ca_pwd_ec_pem_len \ - mbedtls_test_ca_pwd_ec_pem_len_ncbicxx_2_28_3 + mbedtls_test_ca_pwd_ec_pem_len_ncbicxx_2_28_8 #define mbedtls_test_ca_pwd_len \ - mbedtls_test_ca_pwd_len_ncbicxx_2_28_3 + mbedtls_test_ca_pwd_len_ncbicxx_2_28_8 #define mbedtls_test_ca_pwd_rsa \ - mbedtls_test_ca_pwd_rsa_ncbicxx_2_28_3 + mbedtls_test_ca_pwd_rsa_ncbicxx_2_28_8 #define mbedtls_test_ca_pwd_rsa_der_len \ - mbedtls_test_ca_pwd_rsa_der_len_ncbicxx_2_28_3 + mbedtls_test_ca_pwd_rsa_der_len_ncbicxx_2_28_8 #define mbedtls_test_ca_pwd_rsa_len \ - mbedtls_test_ca_pwd_rsa_len_ncbicxx_2_28_3 + mbedtls_test_ca_pwd_rsa_len_ncbicxx_2_28_8 #define mbedtls_test_ca_pwd_rsa_pem \ - mbedtls_test_ca_pwd_rsa_pem_ncbicxx_2_28_3 + mbedtls_test_ca_pwd_rsa_pem_ncbicxx_2_28_8 #define mbedtls_test_ca_pwd_rsa_pem_len \ - mbedtls_test_ca_pwd_rsa_pem_len_ncbicxx_2_28_3 + mbedtls_test_ca_pwd_rsa_pem_len_ncbicxx_2_28_8 #define mbedtls_test_cas \ - mbedtls_test_cas_ncbicxx_2_28_3 + mbedtls_test_cas_ncbicxx_2_28_8 #define mbedtls_test_cas_der \ - mbedtls_test_cas_der_ncbicxx_2_28_3 + mbedtls_test_cas_der_ncbicxx_2_28_8 #define mbedtls_test_cas_der_len \ - mbedtls_test_cas_der_len_ncbicxx_2_28_3 + mbedtls_test_cas_der_len_ncbicxx_2_28_8 #define mbedtls_test_cas_len \ - mbedtls_test_cas_len_ncbicxx_2_28_3 + mbedtls_test_cas_len_ncbicxx_2_28_8 #define mbedtls_test_cas_pem \ - mbedtls_test_cas_pem_ncbicxx_2_28_3 + mbedtls_test_cas_pem_ncbicxx_2_28_8 #define mbedtls_test_cas_pem_len \ - mbedtls_test_cas_pem_len_ncbicxx_2_28_3 + mbedtls_test_cas_pem_len_ncbicxx_2_28_8 #define mbedtls_test_cli_crt \ - mbedtls_test_cli_crt_ncbicxx_2_28_3 + mbedtls_test_cli_crt_ncbicxx_2_28_8 #define mbedtls_test_cli_crt_ec \ - mbedtls_test_cli_crt_ec_ncbicxx_2_28_3 + mbedtls_test_cli_crt_ec_ncbicxx_2_28_8 #define mbedtls_test_cli_crt_ec_der \ - mbedtls_test_cli_crt_ec_der_ncbicxx_2_28_3 + mbedtls_test_cli_crt_ec_der_ncbicxx_2_28_8 #define mbedtls_test_cli_crt_ec_der_len \ - mbedtls_test_cli_crt_ec_der_len_ncbicxx_2_28_3 + mbedtls_test_cli_crt_ec_der_len_ncbicxx_2_28_8 #define mbedtls_test_cli_crt_ec_len \ - mbedtls_test_cli_crt_ec_len_ncbicxx_2_28_3 + mbedtls_test_cli_crt_ec_len_ncbicxx_2_28_8 #define mbedtls_test_cli_crt_ec_pem \ - mbedtls_test_cli_crt_ec_pem_ncbicxx_2_28_3 + mbedtls_test_cli_crt_ec_pem_ncbicxx_2_28_8 #define mbedtls_test_cli_crt_ec_pem_len \ - mbedtls_test_cli_crt_ec_pem_len_ncbicxx_2_28_3 + mbedtls_test_cli_crt_ec_pem_len_ncbicxx_2_28_8 #define mbedtls_test_cli_crt_len \ - mbedtls_test_cli_crt_len_ncbicxx_2_28_3 + mbedtls_test_cli_crt_len_ncbicxx_2_28_8 #define mbedtls_test_cli_crt_rsa \ - mbedtls_test_cli_crt_rsa_ncbicxx_2_28_3 + mbedtls_test_cli_crt_rsa_ncbicxx_2_28_8 #define mbedtls_test_cli_crt_rsa_der \ - mbedtls_test_cli_crt_rsa_der_ncbicxx_2_28_3 + mbedtls_test_cli_crt_rsa_der_ncbicxx_2_28_8 #define mbedtls_test_cli_crt_rsa_der_len \ - mbedtls_test_cli_crt_rsa_der_len_ncbicxx_2_28_3 + mbedtls_test_cli_crt_rsa_der_len_ncbicxx_2_28_8 #define mbedtls_test_cli_crt_rsa_len \ - mbedtls_test_cli_crt_rsa_len_ncbicxx_2_28_3 + mbedtls_test_cli_crt_rsa_len_ncbicxx_2_28_8 #define mbedtls_test_cli_crt_rsa_pem \ - mbedtls_test_cli_crt_rsa_pem_ncbicxx_2_28_3 + mbedtls_test_cli_crt_rsa_pem_ncbicxx_2_28_8 #define mbedtls_test_cli_crt_rsa_pem_len \ - mbedtls_test_cli_crt_rsa_pem_len_ncbicxx_2_28_3 + mbedtls_test_cli_crt_rsa_pem_len_ncbicxx_2_28_8 #define mbedtls_test_cli_key \ - mbedtls_test_cli_key_ncbicxx_2_28_3 + mbedtls_test_cli_key_ncbicxx_2_28_8 #define mbedtls_test_cli_key_ec \ - mbedtls_test_cli_key_ec_ncbicxx_2_28_3 + mbedtls_test_cli_key_ec_ncbicxx_2_28_8 #define mbedtls_test_cli_key_ec_der \ - mbedtls_test_cli_key_ec_der_ncbicxx_2_28_3 + mbedtls_test_cli_key_ec_der_ncbicxx_2_28_8 #define mbedtls_test_cli_key_ec_der_len \ - mbedtls_test_cli_key_ec_der_len_ncbicxx_2_28_3 + mbedtls_test_cli_key_ec_der_len_ncbicxx_2_28_8 #define mbedtls_test_cli_key_ec_len \ - mbedtls_test_cli_key_ec_len_ncbicxx_2_28_3 + mbedtls_test_cli_key_ec_len_ncbicxx_2_28_8 #define mbedtls_test_cli_key_ec_pem \ - mbedtls_test_cli_key_ec_pem_ncbicxx_2_28_3 + mbedtls_test_cli_key_ec_pem_ncbicxx_2_28_8 #define mbedtls_test_cli_key_ec_pem_len \ - mbedtls_test_cli_key_ec_pem_len_ncbicxx_2_28_3 + mbedtls_test_cli_key_ec_pem_len_ncbicxx_2_28_8 #define mbedtls_test_cli_key_len \ - mbedtls_test_cli_key_len_ncbicxx_2_28_3 + mbedtls_test_cli_key_len_ncbicxx_2_28_8 #define mbedtls_test_cli_key_rsa \ - mbedtls_test_cli_key_rsa_ncbicxx_2_28_3 + mbedtls_test_cli_key_rsa_ncbicxx_2_28_8 #define mbedtls_test_cli_key_rsa_der \ - mbedtls_test_cli_key_rsa_der_ncbicxx_2_28_3 + mbedtls_test_cli_key_rsa_der_ncbicxx_2_28_8 #define mbedtls_test_cli_key_rsa_der_len \ - mbedtls_test_cli_key_rsa_der_len_ncbicxx_2_28_3 + mbedtls_test_cli_key_rsa_der_len_ncbicxx_2_28_8 #define mbedtls_test_cli_key_rsa_len \ - mbedtls_test_cli_key_rsa_len_ncbicxx_2_28_3 + mbedtls_test_cli_key_rsa_len_ncbicxx_2_28_8 #define mbedtls_test_cli_key_rsa_pem \ - mbedtls_test_cli_key_rsa_pem_ncbicxx_2_28_3 + mbedtls_test_cli_key_rsa_pem_ncbicxx_2_28_8 #define mbedtls_test_cli_key_rsa_pem_len \ - mbedtls_test_cli_key_rsa_pem_len_ncbicxx_2_28_3 + mbedtls_test_cli_key_rsa_pem_len_ncbicxx_2_28_8 #define mbedtls_test_cli_pwd \ - mbedtls_test_cli_pwd_ncbicxx_2_28_3 + mbedtls_test_cli_pwd_ncbicxx_2_28_8 #define mbedtls_test_cli_pwd_ec \ - mbedtls_test_cli_pwd_ec_ncbicxx_2_28_3 + mbedtls_test_cli_pwd_ec_ncbicxx_2_28_8 #define mbedtls_test_cli_pwd_ec_len \ - mbedtls_test_cli_pwd_ec_len_ncbicxx_2_28_3 + mbedtls_test_cli_pwd_ec_len_ncbicxx_2_28_8 #define mbedtls_test_cli_pwd_ec_pem \ - mbedtls_test_cli_pwd_ec_pem_ncbicxx_2_28_3 + mbedtls_test_cli_pwd_ec_pem_ncbicxx_2_28_8 #define mbedtls_test_cli_pwd_ec_pem_len \ - mbedtls_test_cli_pwd_ec_pem_len_ncbicxx_2_28_3 + mbedtls_test_cli_pwd_ec_pem_len_ncbicxx_2_28_8 #define mbedtls_test_cli_pwd_len \ - mbedtls_test_cli_pwd_len_ncbicxx_2_28_3 + mbedtls_test_cli_pwd_len_ncbicxx_2_28_8 #define mbedtls_test_cli_pwd_rsa \ - mbedtls_test_cli_pwd_rsa_ncbicxx_2_28_3 + mbedtls_test_cli_pwd_rsa_ncbicxx_2_28_8 #define mbedtls_test_cli_pwd_rsa_len \ - mbedtls_test_cli_pwd_rsa_len_ncbicxx_2_28_3 + mbedtls_test_cli_pwd_rsa_len_ncbicxx_2_28_8 #define mbedtls_test_cli_pwd_rsa_pem \ - mbedtls_test_cli_pwd_rsa_pem_ncbicxx_2_28_3 + mbedtls_test_cli_pwd_rsa_pem_ncbicxx_2_28_8 #define mbedtls_test_cli_pwd_rsa_pem_len \ - mbedtls_test_cli_pwd_rsa_pem_len_ncbicxx_2_28_3 + mbedtls_test_cli_pwd_rsa_pem_len_ncbicxx_2_28_8 #define mbedtls_test_srv_crt \ - mbedtls_test_srv_crt_ncbicxx_2_28_3 + mbedtls_test_srv_crt_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_ec \ - mbedtls_test_srv_crt_ec_ncbicxx_2_28_3 + mbedtls_test_srv_crt_ec_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_ec_der \ - mbedtls_test_srv_crt_ec_der_ncbicxx_2_28_3 + mbedtls_test_srv_crt_ec_der_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_ec_der_len \ - mbedtls_test_srv_crt_ec_der_len_ncbicxx_2_28_3 + mbedtls_test_srv_crt_ec_der_len_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_ec_len \ - mbedtls_test_srv_crt_ec_len_ncbicxx_2_28_3 + mbedtls_test_srv_crt_ec_len_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_ec_pem \ - mbedtls_test_srv_crt_ec_pem_ncbicxx_2_28_3 + mbedtls_test_srv_crt_ec_pem_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_ec_pem_len \ - mbedtls_test_srv_crt_ec_pem_len_ncbicxx_2_28_3 + mbedtls_test_srv_crt_ec_pem_len_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_len \ - mbedtls_test_srv_crt_len_ncbicxx_2_28_3 + mbedtls_test_srv_crt_len_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_rsa \ - mbedtls_test_srv_crt_rsa_ncbicxx_2_28_3 + mbedtls_test_srv_crt_rsa_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_rsa_len \ - mbedtls_test_srv_crt_rsa_len_ncbicxx_2_28_3 + mbedtls_test_srv_crt_rsa_len_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_rsa_sha1 \ - mbedtls_test_srv_crt_rsa_sha1_ncbicxx_2_28_3 + mbedtls_test_srv_crt_rsa_sha1_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_rsa_sha1_der \ - mbedtls_test_srv_crt_rsa_sha1_der_ncbicxx_2_28_3 + mbedtls_test_srv_crt_rsa_sha1_der_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_rsa_sha1_der_len \ - mbedtls_test_srv_crt_rsa_sha1_der_len_ncbicxx_2_28_3 + mbedtls_test_srv_crt_rsa_sha1_der_len_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_rsa_sha1_len \ - mbedtls_test_srv_crt_rsa_sha1_len_ncbicxx_2_28_3 + mbedtls_test_srv_crt_rsa_sha1_len_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_rsa_sha1_pem \ - mbedtls_test_srv_crt_rsa_sha1_pem_ncbicxx_2_28_3 + mbedtls_test_srv_crt_rsa_sha1_pem_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_rsa_sha1_pem_len \ - mbedtls_test_srv_crt_rsa_sha1_pem_len_ncbicxx_2_28_3 + mbedtls_test_srv_crt_rsa_sha1_pem_len_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_rsa_sha256 \ - mbedtls_test_srv_crt_rsa_sha256_ncbicxx_2_28_3 + mbedtls_test_srv_crt_rsa_sha256_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_rsa_sha256_der \ - mbedtls_test_srv_crt_rsa_sha256_der_ncbicxx_2_28_3 + mbedtls_test_srv_crt_rsa_sha256_der_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_rsa_sha256_der_len \ - mbedtls_test_srv_crt_rsa_sha256_der_len_ncbicxx_2_28_3 + mbedtls_test_srv_crt_rsa_sha256_der_len_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_rsa_sha256_len \ - mbedtls_test_srv_crt_rsa_sha256_len_ncbicxx_2_28_3 + mbedtls_test_srv_crt_rsa_sha256_len_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_rsa_sha256_pem \ - mbedtls_test_srv_crt_rsa_sha256_pem_ncbicxx_2_28_3 + mbedtls_test_srv_crt_rsa_sha256_pem_ncbicxx_2_28_8 #define mbedtls_test_srv_crt_rsa_sha256_pem_len \ - mbedtls_test_srv_crt_rsa_sha256_pem_len_ncbicxx_2_28_3 + mbedtls_test_srv_crt_rsa_sha256_pem_len_ncbicxx_2_28_8 #define mbedtls_test_srv_key \ - mbedtls_test_srv_key_ncbicxx_2_28_3 + mbedtls_test_srv_key_ncbicxx_2_28_8 #define mbedtls_test_srv_key_ec \ - mbedtls_test_srv_key_ec_ncbicxx_2_28_3 + mbedtls_test_srv_key_ec_ncbicxx_2_28_8 #define mbedtls_test_srv_key_ec_der \ - mbedtls_test_srv_key_ec_der_ncbicxx_2_28_3 + mbedtls_test_srv_key_ec_der_ncbicxx_2_28_8 #define mbedtls_test_srv_key_ec_der_len \ - mbedtls_test_srv_key_ec_der_len_ncbicxx_2_28_3 + mbedtls_test_srv_key_ec_der_len_ncbicxx_2_28_8 #define mbedtls_test_srv_key_ec_len \ - mbedtls_test_srv_key_ec_len_ncbicxx_2_28_3 + mbedtls_test_srv_key_ec_len_ncbicxx_2_28_8 #define mbedtls_test_srv_key_ec_pem \ - mbedtls_test_srv_key_ec_pem_ncbicxx_2_28_3 + mbedtls_test_srv_key_ec_pem_ncbicxx_2_28_8 #define mbedtls_test_srv_key_ec_pem_len \ - mbedtls_test_srv_key_ec_pem_len_ncbicxx_2_28_3 + mbedtls_test_srv_key_ec_pem_len_ncbicxx_2_28_8 #define mbedtls_test_srv_key_len \ - mbedtls_test_srv_key_len_ncbicxx_2_28_3 + mbedtls_test_srv_key_len_ncbicxx_2_28_8 #define mbedtls_test_srv_key_rsa \ - mbedtls_test_srv_key_rsa_ncbicxx_2_28_3 + mbedtls_test_srv_key_rsa_ncbicxx_2_28_8 #define mbedtls_test_srv_key_rsa_der \ - mbedtls_test_srv_key_rsa_der_ncbicxx_2_28_3 + mbedtls_test_srv_key_rsa_der_ncbicxx_2_28_8 #define mbedtls_test_srv_key_rsa_der_len \ - mbedtls_test_srv_key_rsa_der_len_ncbicxx_2_28_3 + mbedtls_test_srv_key_rsa_der_len_ncbicxx_2_28_8 #define mbedtls_test_srv_key_rsa_len \ - mbedtls_test_srv_key_rsa_len_ncbicxx_2_28_3 + mbedtls_test_srv_key_rsa_len_ncbicxx_2_28_8 #define mbedtls_test_srv_key_rsa_pem \ - mbedtls_test_srv_key_rsa_pem_ncbicxx_2_28_3 + mbedtls_test_srv_key_rsa_pem_ncbicxx_2_28_8 #define mbedtls_test_srv_key_rsa_pem_len \ - mbedtls_test_srv_key_rsa_pem_len_ncbicxx_2_28_3 + mbedtls_test_srv_key_rsa_pem_len_ncbicxx_2_28_8 #define mbedtls_test_srv_pwd \ - mbedtls_test_srv_pwd_ncbicxx_2_28_3 + mbedtls_test_srv_pwd_ncbicxx_2_28_8 #define mbedtls_test_srv_pwd_ec \ - mbedtls_test_srv_pwd_ec_ncbicxx_2_28_3 + mbedtls_test_srv_pwd_ec_ncbicxx_2_28_8 #define mbedtls_test_srv_pwd_ec_der_len \ - mbedtls_test_srv_pwd_ec_der_len_ncbicxx_2_28_3 + mbedtls_test_srv_pwd_ec_der_len_ncbicxx_2_28_8 #define mbedtls_test_srv_pwd_ec_len \ - mbedtls_test_srv_pwd_ec_len_ncbicxx_2_28_3 + mbedtls_test_srv_pwd_ec_len_ncbicxx_2_28_8 #define mbedtls_test_srv_pwd_ec_pem \ - mbedtls_test_srv_pwd_ec_pem_ncbicxx_2_28_3 + mbedtls_test_srv_pwd_ec_pem_ncbicxx_2_28_8 #define mbedtls_test_srv_pwd_ec_pem_len \ - mbedtls_test_srv_pwd_ec_pem_len_ncbicxx_2_28_3 + mbedtls_test_srv_pwd_ec_pem_len_ncbicxx_2_28_8 #define mbedtls_test_srv_pwd_len \ - mbedtls_test_srv_pwd_len_ncbicxx_2_28_3 + mbedtls_test_srv_pwd_len_ncbicxx_2_28_8 #define mbedtls_test_srv_pwd_rsa \ - mbedtls_test_srv_pwd_rsa_ncbicxx_2_28_3 + mbedtls_test_srv_pwd_rsa_ncbicxx_2_28_8 #define mbedtls_test_srv_pwd_rsa_der_len \ - mbedtls_test_srv_pwd_rsa_der_len_ncbicxx_2_28_3 + mbedtls_test_srv_pwd_rsa_der_len_ncbicxx_2_28_8 #define mbedtls_test_srv_pwd_rsa_len \ - mbedtls_test_srv_pwd_rsa_len_ncbicxx_2_28_3 + mbedtls_test_srv_pwd_rsa_len_ncbicxx_2_28_8 #define mbedtls_test_srv_pwd_rsa_pem \ - mbedtls_test_srv_pwd_rsa_pem_ncbicxx_2_28_3 + mbedtls_test_srv_pwd_rsa_pem_ncbicxx_2_28_8 #define mbedtls_test_srv_pwd_rsa_pem_len \ - mbedtls_test_srv_pwd_rsa_pem_len_ncbicxx_2_28_3 + mbedtls_test_srv_pwd_rsa_pem_len_ncbicxx_2_28_8 #define mbedtls_chacha20_crypt \ - mbedtls_chacha20_crypt_ncbicxx_2_28_3 + mbedtls_chacha20_crypt_ncbicxx_2_28_8 #define mbedtls_chacha20_free \ - mbedtls_chacha20_free_ncbicxx_2_28_3 + mbedtls_chacha20_free_ncbicxx_2_28_8 #define mbedtls_chacha20_init \ - mbedtls_chacha20_init_ncbicxx_2_28_3 + mbedtls_chacha20_init_ncbicxx_2_28_8 #define mbedtls_chacha20_setkey \ - mbedtls_chacha20_setkey_ncbicxx_2_28_3 + mbedtls_chacha20_setkey_ncbicxx_2_28_8 #define mbedtls_chacha20_starts \ - mbedtls_chacha20_starts_ncbicxx_2_28_3 + mbedtls_chacha20_starts_ncbicxx_2_28_8 #define mbedtls_chacha20_update \ - mbedtls_chacha20_update_ncbicxx_2_28_3 + mbedtls_chacha20_update_ncbicxx_2_28_8 #define mbedtls_chachapoly_auth_decrypt \ - mbedtls_chachapoly_auth_decrypt_ncbicxx_2_28_3 + mbedtls_chachapoly_auth_decrypt_ncbicxx_2_28_8 #define mbedtls_chachapoly_encrypt_and_tag \ - mbedtls_chachapoly_encrypt_and_tag_ncbicxx_2_28_3 + mbedtls_chachapoly_encrypt_and_tag_ncbicxx_2_28_8 #define mbedtls_chachapoly_finish \ - mbedtls_chachapoly_finish_ncbicxx_2_28_3 + mbedtls_chachapoly_finish_ncbicxx_2_28_8 #define mbedtls_chachapoly_free \ - mbedtls_chachapoly_free_ncbicxx_2_28_3 + mbedtls_chachapoly_free_ncbicxx_2_28_8 #define mbedtls_chachapoly_init \ - mbedtls_chachapoly_init_ncbicxx_2_28_3 + mbedtls_chachapoly_init_ncbicxx_2_28_8 #define mbedtls_chachapoly_setkey \ - mbedtls_chachapoly_setkey_ncbicxx_2_28_3 + mbedtls_chachapoly_setkey_ncbicxx_2_28_8 #define mbedtls_chachapoly_starts \ - mbedtls_chachapoly_starts_ncbicxx_2_28_3 + mbedtls_chachapoly_starts_ncbicxx_2_28_8 #define mbedtls_chachapoly_update \ - mbedtls_chachapoly_update_ncbicxx_2_28_3 + mbedtls_chachapoly_update_ncbicxx_2_28_8 #define mbedtls_chachapoly_update_aad \ - mbedtls_chachapoly_update_aad_ncbicxx_2_28_3 + mbedtls_chachapoly_update_aad_ncbicxx_2_28_8 #define mbedtls_cipher_auth_decrypt \ - mbedtls_cipher_auth_decrypt_ncbicxx_2_28_3 + mbedtls_cipher_auth_decrypt_ncbicxx_2_28_8 #define mbedtls_cipher_auth_decrypt_ext \ - mbedtls_cipher_auth_decrypt_ext_ncbicxx_2_28_3 + mbedtls_cipher_auth_decrypt_ext_ncbicxx_2_28_8 #define mbedtls_cipher_auth_encrypt \ - mbedtls_cipher_auth_encrypt_ncbicxx_2_28_3 + mbedtls_cipher_auth_encrypt_ncbicxx_2_28_8 #define mbedtls_cipher_auth_encrypt_ext \ - mbedtls_cipher_auth_encrypt_ext_ncbicxx_2_28_3 + mbedtls_cipher_auth_encrypt_ext_ncbicxx_2_28_8 #define mbedtls_cipher_check_tag \ - mbedtls_cipher_check_tag_ncbicxx_2_28_3 + mbedtls_cipher_check_tag_ncbicxx_2_28_8 #define mbedtls_cipher_crypt \ - mbedtls_cipher_crypt_ncbicxx_2_28_3 + mbedtls_cipher_crypt_ncbicxx_2_28_8 #define mbedtls_cipher_finish \ - mbedtls_cipher_finish_ncbicxx_2_28_3 + mbedtls_cipher_finish_ncbicxx_2_28_8 #define mbedtls_cipher_free \ - mbedtls_cipher_free_ncbicxx_2_28_3 + mbedtls_cipher_free_ncbicxx_2_28_8 #define mbedtls_cipher_info_from_string \ - mbedtls_cipher_info_from_string_ncbicxx_2_28_3 + mbedtls_cipher_info_from_string_ncbicxx_2_28_8 #define mbedtls_cipher_info_from_type \ - mbedtls_cipher_info_from_type_ncbicxx_2_28_3 + mbedtls_cipher_info_from_type_ncbicxx_2_28_8 #define mbedtls_cipher_info_from_values \ - mbedtls_cipher_info_from_values_ncbicxx_2_28_3 + mbedtls_cipher_info_from_values_ncbicxx_2_28_8 #define mbedtls_cipher_init \ - mbedtls_cipher_init_ncbicxx_2_28_3 + mbedtls_cipher_init_ncbicxx_2_28_8 #define mbedtls_cipher_list \ - mbedtls_cipher_list_ncbicxx_2_28_3 + mbedtls_cipher_list_ncbicxx_2_28_8 #define mbedtls_cipher_reset \ - mbedtls_cipher_reset_ncbicxx_2_28_3 + mbedtls_cipher_reset_ncbicxx_2_28_8 #define mbedtls_cipher_set_iv \ - mbedtls_cipher_set_iv_ncbicxx_2_28_3 + mbedtls_cipher_set_iv_ncbicxx_2_28_8 #define mbedtls_cipher_set_padding_mode \ - mbedtls_cipher_set_padding_mode_ncbicxx_2_28_3 + mbedtls_cipher_set_padding_mode_ncbicxx_2_28_8 #define mbedtls_cipher_setkey \ - mbedtls_cipher_setkey_ncbicxx_2_28_3 + mbedtls_cipher_setkey_ncbicxx_2_28_8 #define mbedtls_cipher_setup \ - mbedtls_cipher_setup_ncbicxx_2_28_3 + mbedtls_cipher_setup_ncbicxx_2_28_8 #define mbedtls_cipher_update \ - mbedtls_cipher_update_ncbicxx_2_28_3 + mbedtls_cipher_update_ncbicxx_2_28_8 #define mbedtls_cipher_update_ad \ - mbedtls_cipher_update_ad_ncbicxx_2_28_3 + mbedtls_cipher_update_ad_ncbicxx_2_28_8 #define mbedtls_cipher_write_tag \ - mbedtls_cipher_write_tag_ncbicxx_2_28_3 + mbedtls_cipher_write_tag_ncbicxx_2_28_8 #define mbedtls_cipher_definitions \ - mbedtls_cipher_definitions_ncbicxx_2_28_3 + mbedtls_cipher_definitions_ncbicxx_2_28_8 #define mbedtls_cipher_supported \ - mbedtls_cipher_supported_ncbicxx_2_28_3 + mbedtls_cipher_supported_ncbicxx_2_28_8 #define mbedtls_ct_base64_dec_value \ - mbedtls_ct_base64_dec_value_ncbicxx_2_28_3 + mbedtls_ct_base64_dec_value_ncbicxx_2_28_8 #define mbedtls_ct_base64_enc_char \ - mbedtls_ct_base64_enc_char_ncbicxx_2_28_3 + mbedtls_ct_base64_enc_char_ncbicxx_2_28_8 #define mbedtls_ct_hmac \ - mbedtls_ct_hmac_ncbicxx_2_28_3 + mbedtls_ct_hmac_ncbicxx_2_28_8 #define mbedtls_ct_memcmp \ - mbedtls_ct_memcmp_ncbicxx_2_28_3 + mbedtls_ct_memcmp_ncbicxx_2_28_8 #define mbedtls_ct_memcpy_if_eq \ - mbedtls_ct_memcpy_if_eq_ncbicxx_2_28_3 + mbedtls_ct_memcpy_if_eq_ncbicxx_2_28_8 #define mbedtls_ct_memcpy_offset \ - mbedtls_ct_memcpy_offset_ncbicxx_2_28_3 + mbedtls_ct_memcpy_offset_ncbicxx_2_28_8 #define mbedtls_ct_mpi_uint_cond_assign \ - mbedtls_ct_mpi_uint_cond_assign_ncbicxx_2_28_3 + mbedtls_ct_mpi_uint_cond_assign_ncbicxx_2_28_8 #define mbedtls_ct_mpi_uint_lt \ - mbedtls_ct_mpi_uint_lt_ncbicxx_2_28_3 + mbedtls_ct_mpi_uint_lt_ncbicxx_2_28_8 #define mbedtls_ct_mpi_uint_mask \ - mbedtls_ct_mpi_uint_mask_ncbicxx_2_28_3 + mbedtls_ct_mpi_uint_mask_ncbicxx_2_28_8 #define mbedtls_ct_rsaes_pkcs1_v15_unpadding \ - mbedtls_ct_rsaes_pkcs1_v15_unpadding_ncbicxx_2_28_3 + mbedtls_ct_rsaes_pkcs1_v15_unpadding_ncbicxx_2_28_8 #define mbedtls_ct_size_bool_eq \ - mbedtls_ct_size_bool_eq_ncbicxx_2_28_3 + mbedtls_ct_size_bool_eq_ncbicxx_2_28_8 #define mbedtls_ct_size_mask \ - mbedtls_ct_size_mask_ncbicxx_2_28_3 + mbedtls_ct_size_mask_ncbicxx_2_28_8 #define mbedtls_ct_size_mask_ge \ - mbedtls_ct_size_mask_ge_ncbicxx_2_28_3 + mbedtls_ct_size_mask_ge_ncbicxx_2_28_8 #define mbedtls_ct_uint_if \ - mbedtls_ct_uint_if_ncbicxx_2_28_3 + mbedtls_ct_uint_if_ncbicxx_2_28_8 #define mbedtls_ct_uint_mask \ - mbedtls_ct_uint_mask_ncbicxx_2_28_3 + mbedtls_ct_uint_mask_ncbicxx_2_28_8 #define mbedtls_mpi_lt_mpi_ct \ - mbedtls_mpi_lt_mpi_ct_ncbicxx_2_28_3 + mbedtls_mpi_lt_mpi_ct_ncbicxx_2_28_8 #define mbedtls_mpi_safe_cond_assign \ - mbedtls_mpi_safe_cond_assign_ncbicxx_2_28_3 + mbedtls_mpi_safe_cond_assign_ncbicxx_2_28_8 #define mbedtls_mpi_safe_cond_swap \ - mbedtls_mpi_safe_cond_swap_ncbicxx_2_28_3 + mbedtls_mpi_safe_cond_swap_ncbicxx_2_28_8 #define mbedtls_ctr_drbg_free \ - mbedtls_ctr_drbg_free_ncbicxx_2_28_3 + mbedtls_ctr_drbg_free_ncbicxx_2_28_8 #define mbedtls_ctr_drbg_init \ - mbedtls_ctr_drbg_init_ncbicxx_2_28_3 + mbedtls_ctr_drbg_init_ncbicxx_2_28_8 #define mbedtls_ctr_drbg_random \ - mbedtls_ctr_drbg_random_ncbicxx_2_28_3 + mbedtls_ctr_drbg_random_ncbicxx_2_28_8 #define mbedtls_ctr_drbg_random_with_add \ - mbedtls_ctr_drbg_random_with_add_ncbicxx_2_28_3 + mbedtls_ctr_drbg_random_with_add_ncbicxx_2_28_8 #define mbedtls_ctr_drbg_reseed \ - mbedtls_ctr_drbg_reseed_ncbicxx_2_28_3 + mbedtls_ctr_drbg_reseed_ncbicxx_2_28_8 #define mbedtls_ctr_drbg_seed \ - mbedtls_ctr_drbg_seed_ncbicxx_2_28_3 + mbedtls_ctr_drbg_seed_ncbicxx_2_28_8 #define mbedtls_ctr_drbg_set_entropy_len \ - mbedtls_ctr_drbg_set_entropy_len_ncbicxx_2_28_3 + mbedtls_ctr_drbg_set_entropy_len_ncbicxx_2_28_8 #define mbedtls_ctr_drbg_set_nonce_len \ - mbedtls_ctr_drbg_set_nonce_len_ncbicxx_2_28_3 + mbedtls_ctr_drbg_set_nonce_len_ncbicxx_2_28_8 #define mbedtls_ctr_drbg_set_prediction_resistance \ - mbedtls_ctr_drbg_set_prediction_resistance_ncbicxx_2_28_3 + mbedtls_ctr_drbg_set_prediction_resistance_ncbicxx_2_28_8 #define mbedtls_ctr_drbg_set_reseed_interval \ - mbedtls_ctr_drbg_set_reseed_interval_ncbicxx_2_28_3 + mbedtls_ctr_drbg_set_reseed_interval_ncbicxx_2_28_8 #define mbedtls_ctr_drbg_update \ - mbedtls_ctr_drbg_update_ncbicxx_2_28_3 + mbedtls_ctr_drbg_update_ncbicxx_2_28_8 #define mbedtls_ctr_drbg_update_ret \ - mbedtls_ctr_drbg_update_ret_ncbicxx_2_28_3 + mbedtls_ctr_drbg_update_ret_ncbicxx_2_28_8 #define mbedtls_ctr_drbg_update_seed_file \ - mbedtls_ctr_drbg_update_seed_file_ncbicxx_2_28_3 + mbedtls_ctr_drbg_update_seed_file_ncbicxx_2_28_8 #define mbedtls_ctr_drbg_write_seed_file \ - mbedtls_ctr_drbg_write_seed_file_ncbicxx_2_28_3 + mbedtls_ctr_drbg_write_seed_file_ncbicxx_2_28_8 #define mbedtls_debug_print_buf \ - mbedtls_debug_print_buf_ncbicxx_2_28_3 + mbedtls_debug_print_buf_ncbicxx_2_28_8 #define mbedtls_debug_print_crt \ - mbedtls_debug_print_crt_ncbicxx_2_28_3 + mbedtls_debug_print_crt_ncbicxx_2_28_8 #define mbedtls_debug_print_ecp \ - mbedtls_debug_print_ecp_ncbicxx_2_28_3 + mbedtls_debug_print_ecp_ncbicxx_2_28_8 #define mbedtls_debug_print_mpi \ - mbedtls_debug_print_mpi_ncbicxx_2_28_3 + mbedtls_debug_print_mpi_ncbicxx_2_28_8 #define mbedtls_debug_print_msg \ - mbedtls_debug_print_msg_ncbicxx_2_28_3 + mbedtls_debug_print_msg_ncbicxx_2_28_8 #define mbedtls_debug_print_ret \ - mbedtls_debug_print_ret_ncbicxx_2_28_3 + mbedtls_debug_print_ret_ncbicxx_2_28_8 #define mbedtls_debug_printf_ecdh \ - mbedtls_debug_printf_ecdh_ncbicxx_2_28_3 + mbedtls_debug_printf_ecdh_ncbicxx_2_28_8 #define mbedtls_debug_set_threshold \ - mbedtls_debug_set_threshold_ncbicxx_2_28_3 + mbedtls_debug_set_threshold_ncbicxx_2_28_8 #define mbedtls_des3_crypt_cbc \ - mbedtls_des3_crypt_cbc_ncbicxx_2_28_3 + mbedtls_des3_crypt_cbc_ncbicxx_2_28_8 #define mbedtls_des3_crypt_ecb \ - mbedtls_des3_crypt_ecb_ncbicxx_2_28_3 + mbedtls_des3_crypt_ecb_ncbicxx_2_28_8 #define mbedtls_des3_free \ - mbedtls_des3_free_ncbicxx_2_28_3 + mbedtls_des3_free_ncbicxx_2_28_8 #define mbedtls_des3_init \ - mbedtls_des3_init_ncbicxx_2_28_3 + mbedtls_des3_init_ncbicxx_2_28_8 #define mbedtls_des3_set2key_dec \ - mbedtls_des3_set2key_dec_ncbicxx_2_28_3 + mbedtls_des3_set2key_dec_ncbicxx_2_28_8 #define mbedtls_des3_set2key_enc \ - mbedtls_des3_set2key_enc_ncbicxx_2_28_3 + mbedtls_des3_set2key_enc_ncbicxx_2_28_8 #define mbedtls_des3_set3key_dec \ - mbedtls_des3_set3key_dec_ncbicxx_2_28_3 + mbedtls_des3_set3key_dec_ncbicxx_2_28_8 #define mbedtls_des3_set3key_enc \ - mbedtls_des3_set3key_enc_ncbicxx_2_28_3 + mbedtls_des3_set3key_enc_ncbicxx_2_28_8 #define mbedtls_des_crypt_cbc \ - mbedtls_des_crypt_cbc_ncbicxx_2_28_3 + mbedtls_des_crypt_cbc_ncbicxx_2_28_8 #define mbedtls_des_crypt_ecb \ - mbedtls_des_crypt_ecb_ncbicxx_2_28_3 + mbedtls_des_crypt_ecb_ncbicxx_2_28_8 #define mbedtls_des_free \ - mbedtls_des_free_ncbicxx_2_28_3 + mbedtls_des_free_ncbicxx_2_28_8 #define mbedtls_des_init \ - mbedtls_des_init_ncbicxx_2_28_3 + mbedtls_des_init_ncbicxx_2_28_8 #define mbedtls_des_key_check_key_parity \ - mbedtls_des_key_check_key_parity_ncbicxx_2_28_3 + mbedtls_des_key_check_key_parity_ncbicxx_2_28_8 #define mbedtls_des_key_check_weak \ - mbedtls_des_key_check_weak_ncbicxx_2_28_3 + mbedtls_des_key_check_weak_ncbicxx_2_28_8 #define mbedtls_des_key_set_parity \ - mbedtls_des_key_set_parity_ncbicxx_2_28_3 + mbedtls_des_key_set_parity_ncbicxx_2_28_8 #define mbedtls_des_setkey \ - mbedtls_des_setkey_ncbicxx_2_28_3 + mbedtls_des_setkey_ncbicxx_2_28_8 #define mbedtls_des_setkey_dec \ - mbedtls_des_setkey_dec_ncbicxx_2_28_3 + mbedtls_des_setkey_dec_ncbicxx_2_28_8 #define mbedtls_des_setkey_enc \ - mbedtls_des_setkey_enc_ncbicxx_2_28_3 + mbedtls_des_setkey_enc_ncbicxx_2_28_8 #define mbedtls_dhm_calc_secret \ - mbedtls_dhm_calc_secret_ncbicxx_2_28_3 + mbedtls_dhm_calc_secret_ncbicxx_2_28_8 #define mbedtls_dhm_free \ - mbedtls_dhm_free_ncbicxx_2_28_3 + mbedtls_dhm_free_ncbicxx_2_28_8 #define mbedtls_dhm_init \ - mbedtls_dhm_init_ncbicxx_2_28_3 + mbedtls_dhm_init_ncbicxx_2_28_8 #define mbedtls_dhm_make_params \ - mbedtls_dhm_make_params_ncbicxx_2_28_3 + mbedtls_dhm_make_params_ncbicxx_2_28_8 #define mbedtls_dhm_make_public \ - mbedtls_dhm_make_public_ncbicxx_2_28_3 + mbedtls_dhm_make_public_ncbicxx_2_28_8 #define mbedtls_dhm_parse_dhm \ - mbedtls_dhm_parse_dhm_ncbicxx_2_28_3 + mbedtls_dhm_parse_dhm_ncbicxx_2_28_8 #define mbedtls_dhm_parse_dhmfile \ - mbedtls_dhm_parse_dhmfile_ncbicxx_2_28_3 + mbedtls_dhm_parse_dhmfile_ncbicxx_2_28_8 #define mbedtls_dhm_read_params \ - mbedtls_dhm_read_params_ncbicxx_2_28_3 + mbedtls_dhm_read_params_ncbicxx_2_28_8 #define mbedtls_dhm_read_public \ - mbedtls_dhm_read_public_ncbicxx_2_28_3 + mbedtls_dhm_read_public_ncbicxx_2_28_8 #define mbedtls_dhm_set_group \ - mbedtls_dhm_set_group_ncbicxx_2_28_3 + mbedtls_dhm_set_group_ncbicxx_2_28_8 #define mbedtls_ecdh_calc_secret \ - mbedtls_ecdh_calc_secret_ncbicxx_2_28_3 + mbedtls_ecdh_calc_secret_ncbicxx_2_28_8 #define mbedtls_ecdh_can_do \ - mbedtls_ecdh_can_do_ncbicxx_2_28_3 + mbedtls_ecdh_can_do_ncbicxx_2_28_8 #define mbedtls_ecdh_compute_shared \ - mbedtls_ecdh_compute_shared_ncbicxx_2_28_3 + mbedtls_ecdh_compute_shared_ncbicxx_2_28_8 #define mbedtls_ecdh_free \ - mbedtls_ecdh_free_ncbicxx_2_28_3 + mbedtls_ecdh_free_ncbicxx_2_28_8 #define mbedtls_ecdh_gen_public \ - mbedtls_ecdh_gen_public_ncbicxx_2_28_3 + mbedtls_ecdh_gen_public_ncbicxx_2_28_8 #define mbedtls_ecdh_get_params \ - mbedtls_ecdh_get_params_ncbicxx_2_28_3 + mbedtls_ecdh_get_params_ncbicxx_2_28_8 #define mbedtls_ecdh_init \ - mbedtls_ecdh_init_ncbicxx_2_28_3 + mbedtls_ecdh_init_ncbicxx_2_28_8 #define mbedtls_ecdh_make_params \ - mbedtls_ecdh_make_params_ncbicxx_2_28_3 + mbedtls_ecdh_make_params_ncbicxx_2_28_8 #define mbedtls_ecdh_make_public \ - mbedtls_ecdh_make_public_ncbicxx_2_28_3 + mbedtls_ecdh_make_public_ncbicxx_2_28_8 #define mbedtls_ecdh_read_params \ - mbedtls_ecdh_read_params_ncbicxx_2_28_3 + mbedtls_ecdh_read_params_ncbicxx_2_28_8 #define mbedtls_ecdh_read_public \ - mbedtls_ecdh_read_public_ncbicxx_2_28_3 + mbedtls_ecdh_read_public_ncbicxx_2_28_8 #define mbedtls_ecdh_setup \ - mbedtls_ecdh_setup_ncbicxx_2_28_3 + mbedtls_ecdh_setup_ncbicxx_2_28_8 #define mbedtls_ecdsa_can_do \ - mbedtls_ecdsa_can_do_ncbicxx_2_28_3 + mbedtls_ecdsa_can_do_ncbicxx_2_28_8 #define mbedtls_ecdsa_free \ - mbedtls_ecdsa_free_ncbicxx_2_28_3 + mbedtls_ecdsa_free_ncbicxx_2_28_8 #define mbedtls_ecdsa_from_keypair \ - mbedtls_ecdsa_from_keypair_ncbicxx_2_28_3 + mbedtls_ecdsa_from_keypair_ncbicxx_2_28_8 #define mbedtls_ecdsa_genkey \ - mbedtls_ecdsa_genkey_ncbicxx_2_28_3 + mbedtls_ecdsa_genkey_ncbicxx_2_28_8 #define mbedtls_ecdsa_init \ - mbedtls_ecdsa_init_ncbicxx_2_28_3 + mbedtls_ecdsa_init_ncbicxx_2_28_8 #define mbedtls_ecdsa_read_signature \ - mbedtls_ecdsa_read_signature_ncbicxx_2_28_3 + mbedtls_ecdsa_read_signature_ncbicxx_2_28_8 #define mbedtls_ecdsa_read_signature_restartable \ - mbedtls_ecdsa_read_signature_restartable_ncbicxx_2_28_3 + mbedtls_ecdsa_read_signature_restartable_ncbicxx_2_28_8 #define mbedtls_ecdsa_sign \ - mbedtls_ecdsa_sign_ncbicxx_2_28_3 + mbedtls_ecdsa_sign_ncbicxx_2_28_8 #define mbedtls_ecdsa_sign_det \ - mbedtls_ecdsa_sign_det_ncbicxx_2_28_3 + mbedtls_ecdsa_sign_det_ncbicxx_2_28_8 #define mbedtls_ecdsa_sign_det_ext \ - mbedtls_ecdsa_sign_det_ext_ncbicxx_2_28_3 + mbedtls_ecdsa_sign_det_ext_ncbicxx_2_28_8 #define mbedtls_ecdsa_verify \ - mbedtls_ecdsa_verify_ncbicxx_2_28_3 + mbedtls_ecdsa_verify_ncbicxx_2_28_8 #define mbedtls_ecdsa_write_signature \ - mbedtls_ecdsa_write_signature_ncbicxx_2_28_3 + mbedtls_ecdsa_write_signature_ncbicxx_2_28_8 #define mbedtls_ecdsa_write_signature_det \ - mbedtls_ecdsa_write_signature_det_ncbicxx_2_28_3 + mbedtls_ecdsa_write_signature_det_ncbicxx_2_28_8 #define mbedtls_ecdsa_write_signature_restartable \ - mbedtls_ecdsa_write_signature_restartable_ncbicxx_2_28_3 + mbedtls_ecdsa_write_signature_restartable_ncbicxx_2_28_8 #define mbedtls_ecp_check_privkey \ - mbedtls_ecp_check_privkey_ncbicxx_2_28_3 + mbedtls_ecp_check_privkey_ncbicxx_2_28_8 #define mbedtls_ecp_check_pub_priv \ - mbedtls_ecp_check_pub_priv_ncbicxx_2_28_3 + mbedtls_ecp_check_pub_priv_ncbicxx_2_28_8 #define mbedtls_ecp_check_pubkey \ - mbedtls_ecp_check_pubkey_ncbicxx_2_28_3 + mbedtls_ecp_check_pubkey_ncbicxx_2_28_8 #define mbedtls_ecp_copy \ - mbedtls_ecp_copy_ncbicxx_2_28_3 + mbedtls_ecp_copy_ncbicxx_2_28_8 #define mbedtls_ecp_curve_info_from_grp_id \ - mbedtls_ecp_curve_info_from_grp_id_ncbicxx_2_28_3 + mbedtls_ecp_curve_info_from_grp_id_ncbicxx_2_28_8 #define mbedtls_ecp_curve_info_from_name \ - mbedtls_ecp_curve_info_from_name_ncbicxx_2_28_3 + mbedtls_ecp_curve_info_from_name_ncbicxx_2_28_8 #define mbedtls_ecp_curve_info_from_tls_id \ - mbedtls_ecp_curve_info_from_tls_id_ncbicxx_2_28_3 + mbedtls_ecp_curve_info_from_tls_id_ncbicxx_2_28_8 #define mbedtls_ecp_curve_list \ - mbedtls_ecp_curve_list_ncbicxx_2_28_3 + mbedtls_ecp_curve_list_ncbicxx_2_28_8 #define mbedtls_ecp_gen_key \ - mbedtls_ecp_gen_key_ncbicxx_2_28_3 + mbedtls_ecp_gen_key_ncbicxx_2_28_8 #define mbedtls_ecp_gen_keypair \ - mbedtls_ecp_gen_keypair_ncbicxx_2_28_3 + mbedtls_ecp_gen_keypair_ncbicxx_2_28_8 #define mbedtls_ecp_gen_keypair_base \ - mbedtls_ecp_gen_keypair_base_ncbicxx_2_28_3 + mbedtls_ecp_gen_keypair_base_ncbicxx_2_28_8 #define mbedtls_ecp_gen_privkey \ - mbedtls_ecp_gen_privkey_ncbicxx_2_28_3 + mbedtls_ecp_gen_privkey_ncbicxx_2_28_8 #define mbedtls_ecp_get_type \ - mbedtls_ecp_get_type_ncbicxx_2_28_3 + mbedtls_ecp_get_type_ncbicxx_2_28_8 #define mbedtls_ecp_group_copy \ - mbedtls_ecp_group_copy_ncbicxx_2_28_3 + mbedtls_ecp_group_copy_ncbicxx_2_28_8 #define mbedtls_ecp_group_free \ - mbedtls_ecp_group_free_ncbicxx_2_28_3 + mbedtls_ecp_group_free_ncbicxx_2_28_8 #define mbedtls_ecp_group_init \ - mbedtls_ecp_group_init_ncbicxx_2_28_3 + mbedtls_ecp_group_init_ncbicxx_2_28_8 #define mbedtls_ecp_grp_id_list \ - mbedtls_ecp_grp_id_list_ncbicxx_2_28_3 + mbedtls_ecp_grp_id_list_ncbicxx_2_28_8 #define mbedtls_ecp_is_zero \ - mbedtls_ecp_is_zero_ncbicxx_2_28_3 + mbedtls_ecp_is_zero_ncbicxx_2_28_8 #define mbedtls_ecp_keypair_free \ - mbedtls_ecp_keypair_free_ncbicxx_2_28_3 + mbedtls_ecp_keypair_free_ncbicxx_2_28_8 #define mbedtls_ecp_keypair_init \ - mbedtls_ecp_keypair_init_ncbicxx_2_28_3 + mbedtls_ecp_keypair_init_ncbicxx_2_28_8 #define mbedtls_ecp_mul \ - mbedtls_ecp_mul_ncbicxx_2_28_3 + mbedtls_ecp_mul_ncbicxx_2_28_8 #define mbedtls_ecp_mul_restartable \ - mbedtls_ecp_mul_restartable_ncbicxx_2_28_3 + mbedtls_ecp_mul_restartable_ncbicxx_2_28_8 #define mbedtls_ecp_muladd \ - mbedtls_ecp_muladd_ncbicxx_2_28_3 + mbedtls_ecp_muladd_ncbicxx_2_28_8 #define mbedtls_ecp_muladd_restartable \ - mbedtls_ecp_muladd_restartable_ncbicxx_2_28_3 + mbedtls_ecp_muladd_restartable_ncbicxx_2_28_8 #define mbedtls_ecp_point_cmp \ - mbedtls_ecp_point_cmp_ncbicxx_2_28_3 + mbedtls_ecp_point_cmp_ncbicxx_2_28_8 #define mbedtls_ecp_point_free \ - mbedtls_ecp_point_free_ncbicxx_2_28_3 + mbedtls_ecp_point_free_ncbicxx_2_28_8 #define mbedtls_ecp_point_init \ - mbedtls_ecp_point_init_ncbicxx_2_28_3 + mbedtls_ecp_point_init_ncbicxx_2_28_8 #define mbedtls_ecp_point_read_binary \ - mbedtls_ecp_point_read_binary_ncbicxx_2_28_3 + mbedtls_ecp_point_read_binary_ncbicxx_2_28_8 #define mbedtls_ecp_point_read_string \ - mbedtls_ecp_point_read_string_ncbicxx_2_28_3 + mbedtls_ecp_point_read_string_ncbicxx_2_28_8 #define mbedtls_ecp_point_write_binary \ - mbedtls_ecp_point_write_binary_ncbicxx_2_28_3 + mbedtls_ecp_point_write_binary_ncbicxx_2_28_8 #define mbedtls_ecp_read_key \ - mbedtls_ecp_read_key_ncbicxx_2_28_3 + mbedtls_ecp_read_key_ncbicxx_2_28_8 #define mbedtls_ecp_set_zero \ - mbedtls_ecp_set_zero_ncbicxx_2_28_3 + mbedtls_ecp_set_zero_ncbicxx_2_28_8 #define mbedtls_ecp_tls_read_group \ - mbedtls_ecp_tls_read_group_ncbicxx_2_28_3 + mbedtls_ecp_tls_read_group_ncbicxx_2_28_8 #define mbedtls_ecp_tls_read_group_id \ - mbedtls_ecp_tls_read_group_id_ncbicxx_2_28_3 + mbedtls_ecp_tls_read_group_id_ncbicxx_2_28_8 #define mbedtls_ecp_tls_read_point \ - mbedtls_ecp_tls_read_point_ncbicxx_2_28_3 + mbedtls_ecp_tls_read_point_ncbicxx_2_28_8 #define mbedtls_ecp_tls_write_group \ - mbedtls_ecp_tls_write_group_ncbicxx_2_28_3 + mbedtls_ecp_tls_write_group_ncbicxx_2_28_8 #define mbedtls_ecp_tls_write_point \ - mbedtls_ecp_tls_write_point_ncbicxx_2_28_3 + mbedtls_ecp_tls_write_point_ncbicxx_2_28_8 #define mbedtls_ecp_write_key \ - mbedtls_ecp_write_key_ncbicxx_2_28_3 + mbedtls_ecp_write_key_ncbicxx_2_28_8 #define mbedtls_ecp_group_load \ - mbedtls_ecp_group_load_ncbicxx_2_28_3 + mbedtls_ecp_group_load_ncbicxx_2_28_8 #define mbedtls_entropy_add_source \ - mbedtls_entropy_add_source_ncbicxx_2_28_3 + mbedtls_entropy_add_source_ncbicxx_2_28_8 #define mbedtls_entropy_free \ - mbedtls_entropy_free_ncbicxx_2_28_3 + mbedtls_entropy_free_ncbicxx_2_28_8 #define mbedtls_entropy_func \ - mbedtls_entropy_func_ncbicxx_2_28_3 + mbedtls_entropy_func_ncbicxx_2_28_8 #define mbedtls_entropy_gather \ - mbedtls_entropy_gather_ncbicxx_2_28_3 + mbedtls_entropy_gather_ncbicxx_2_28_8 #define mbedtls_entropy_init \ - mbedtls_entropy_init_ncbicxx_2_28_3 + mbedtls_entropy_init_ncbicxx_2_28_8 #define mbedtls_entropy_update_manual \ - mbedtls_entropy_update_manual_ncbicxx_2_28_3 + mbedtls_entropy_update_manual_ncbicxx_2_28_8 #define mbedtls_entropy_update_seed_file \ - mbedtls_entropy_update_seed_file_ncbicxx_2_28_3 + mbedtls_entropy_update_seed_file_ncbicxx_2_28_8 #define mbedtls_entropy_write_seed_file \ - mbedtls_entropy_write_seed_file_ncbicxx_2_28_3 + mbedtls_entropy_write_seed_file_ncbicxx_2_28_8 #define mbedtls_hardclock_poll \ - mbedtls_hardclock_poll_ncbicxx_2_28_3 + mbedtls_hardclock_poll_ncbicxx_2_28_8 #define mbedtls_platform_entropy_poll \ - mbedtls_platform_entropy_poll_ncbicxx_2_28_3 + mbedtls_platform_entropy_poll_ncbicxx_2_28_8 #define mbedtls_high_level_strerr \ - mbedtls_high_level_strerr_ncbicxx_2_28_3 + mbedtls_high_level_strerr_ncbicxx_2_28_8 #define mbedtls_low_level_strerr \ - mbedtls_low_level_strerr_ncbicxx_2_28_3 + mbedtls_low_level_strerr_ncbicxx_2_28_8 #define mbedtls_strerror \ - mbedtls_strerror_ncbicxx_2_28_3 + mbedtls_strerror_ncbicxx_2_28_8 #define mbedtls_gcm_auth_decrypt \ - mbedtls_gcm_auth_decrypt_ncbicxx_2_28_3 + mbedtls_gcm_auth_decrypt_ncbicxx_2_28_8 #define mbedtls_gcm_crypt_and_tag \ - mbedtls_gcm_crypt_and_tag_ncbicxx_2_28_3 + mbedtls_gcm_crypt_and_tag_ncbicxx_2_28_8 #define mbedtls_gcm_finish \ - mbedtls_gcm_finish_ncbicxx_2_28_3 + mbedtls_gcm_finish_ncbicxx_2_28_8 #define mbedtls_gcm_free \ - mbedtls_gcm_free_ncbicxx_2_28_3 + mbedtls_gcm_free_ncbicxx_2_28_8 #define mbedtls_gcm_init \ - mbedtls_gcm_init_ncbicxx_2_28_3 + mbedtls_gcm_init_ncbicxx_2_28_8 #define mbedtls_gcm_setkey \ - mbedtls_gcm_setkey_ncbicxx_2_28_3 + mbedtls_gcm_setkey_ncbicxx_2_28_8 #define mbedtls_gcm_starts \ - mbedtls_gcm_starts_ncbicxx_2_28_3 + mbedtls_gcm_starts_ncbicxx_2_28_8 #define mbedtls_gcm_update \ - mbedtls_gcm_update_ncbicxx_2_28_3 + mbedtls_gcm_update_ncbicxx_2_28_8 #define mbedtls_hkdf \ - mbedtls_hkdf_ncbicxx_2_28_3 + mbedtls_hkdf_ncbicxx_2_28_8 #define mbedtls_hkdf_expand \ - mbedtls_hkdf_expand_ncbicxx_2_28_3 + mbedtls_hkdf_expand_ncbicxx_2_28_8 #define mbedtls_hkdf_extract \ - mbedtls_hkdf_extract_ncbicxx_2_28_3 + mbedtls_hkdf_extract_ncbicxx_2_28_8 #define mbedtls_hmac_drbg_free \ - mbedtls_hmac_drbg_free_ncbicxx_2_28_3 + mbedtls_hmac_drbg_free_ncbicxx_2_28_8 #define mbedtls_hmac_drbg_init \ - mbedtls_hmac_drbg_init_ncbicxx_2_28_3 + mbedtls_hmac_drbg_init_ncbicxx_2_28_8 #define mbedtls_hmac_drbg_random \ - mbedtls_hmac_drbg_random_ncbicxx_2_28_3 + mbedtls_hmac_drbg_random_ncbicxx_2_28_8 #define mbedtls_hmac_drbg_random_with_add \ - mbedtls_hmac_drbg_random_with_add_ncbicxx_2_28_3 + mbedtls_hmac_drbg_random_with_add_ncbicxx_2_28_8 #define mbedtls_hmac_drbg_reseed \ - mbedtls_hmac_drbg_reseed_ncbicxx_2_28_3 + mbedtls_hmac_drbg_reseed_ncbicxx_2_28_8 #define mbedtls_hmac_drbg_seed \ - mbedtls_hmac_drbg_seed_ncbicxx_2_28_3 + mbedtls_hmac_drbg_seed_ncbicxx_2_28_8 #define mbedtls_hmac_drbg_seed_buf \ - mbedtls_hmac_drbg_seed_buf_ncbicxx_2_28_3 + mbedtls_hmac_drbg_seed_buf_ncbicxx_2_28_8 #define mbedtls_hmac_drbg_set_entropy_len \ - mbedtls_hmac_drbg_set_entropy_len_ncbicxx_2_28_3 + mbedtls_hmac_drbg_set_entropy_len_ncbicxx_2_28_8 #define mbedtls_hmac_drbg_set_prediction_resistance \ - mbedtls_hmac_drbg_set_prediction_resistance_ncbicxx_2_28_3 + mbedtls_hmac_drbg_set_prediction_resistance_ncbicxx_2_28_8 #define mbedtls_hmac_drbg_set_reseed_interval \ - mbedtls_hmac_drbg_set_reseed_interval_ncbicxx_2_28_3 + mbedtls_hmac_drbg_set_reseed_interval_ncbicxx_2_28_8 #define mbedtls_hmac_drbg_update \ - mbedtls_hmac_drbg_update_ncbicxx_2_28_3 + mbedtls_hmac_drbg_update_ncbicxx_2_28_8 #define mbedtls_hmac_drbg_update_ret \ - mbedtls_hmac_drbg_update_ret_ncbicxx_2_28_3 + mbedtls_hmac_drbg_update_ret_ncbicxx_2_28_8 #define mbedtls_hmac_drbg_update_seed_file \ - mbedtls_hmac_drbg_update_seed_file_ncbicxx_2_28_3 + mbedtls_hmac_drbg_update_seed_file_ncbicxx_2_28_8 #define mbedtls_hmac_drbg_write_seed_file \ - mbedtls_hmac_drbg_write_seed_file_ncbicxx_2_28_3 + mbedtls_hmac_drbg_write_seed_file_ncbicxx_2_28_8 #define mbedtls_md \ - mbedtls_md_ncbicxx_2_28_3 + mbedtls_md_ncbicxx_2_28_8 #define mbedtls_md5_info \ - mbedtls_md5_info_ncbicxx_2_28_3 + mbedtls_md5_info_ncbicxx_2_28_8 #define mbedtls_md_clone \ - mbedtls_md_clone_ncbicxx_2_28_3 + mbedtls_md_clone_ncbicxx_2_28_8 #define mbedtls_md_file \ - mbedtls_md_file_ncbicxx_2_28_3 + mbedtls_md_file_ncbicxx_2_28_8 #define mbedtls_md_finish \ - mbedtls_md_finish_ncbicxx_2_28_3 + mbedtls_md_finish_ncbicxx_2_28_8 #define mbedtls_md_free \ - mbedtls_md_free_ncbicxx_2_28_3 + mbedtls_md_free_ncbicxx_2_28_8 #define mbedtls_md_get_name \ - mbedtls_md_get_name_ncbicxx_2_28_3 + mbedtls_md_get_name_ncbicxx_2_28_8 #define mbedtls_md_get_size \ - mbedtls_md_get_size_ncbicxx_2_28_3 + mbedtls_md_get_size_ncbicxx_2_28_8 #define mbedtls_md_get_type \ - mbedtls_md_get_type_ncbicxx_2_28_3 + mbedtls_md_get_type_ncbicxx_2_28_8 #define mbedtls_md_hmac \ - mbedtls_md_hmac_ncbicxx_2_28_3 + mbedtls_md_hmac_ncbicxx_2_28_8 #define mbedtls_md_hmac_finish \ - mbedtls_md_hmac_finish_ncbicxx_2_28_3 + mbedtls_md_hmac_finish_ncbicxx_2_28_8 #define mbedtls_md_hmac_reset \ - mbedtls_md_hmac_reset_ncbicxx_2_28_3 + mbedtls_md_hmac_reset_ncbicxx_2_28_8 #define mbedtls_md_hmac_starts \ - mbedtls_md_hmac_starts_ncbicxx_2_28_3 + mbedtls_md_hmac_starts_ncbicxx_2_28_8 #define mbedtls_md_hmac_update \ - mbedtls_md_hmac_update_ncbicxx_2_28_3 + mbedtls_md_hmac_update_ncbicxx_2_28_8 #define mbedtls_md_info_from_string \ - mbedtls_md_info_from_string_ncbicxx_2_28_3 + mbedtls_md_info_from_string_ncbicxx_2_28_8 #define mbedtls_md_info_from_type \ - mbedtls_md_info_from_type_ncbicxx_2_28_3 + mbedtls_md_info_from_type_ncbicxx_2_28_8 #define mbedtls_md_init \ - mbedtls_md_init_ncbicxx_2_28_3 + mbedtls_md_init_ncbicxx_2_28_8 #define mbedtls_md_init_ctx \ - mbedtls_md_init_ctx_ncbicxx_2_28_3 + mbedtls_md_init_ctx_ncbicxx_2_28_8 #define mbedtls_md_list \ - mbedtls_md_list_ncbicxx_2_28_3 + mbedtls_md_list_ncbicxx_2_28_8 #define mbedtls_md_process \ - mbedtls_md_process_ncbicxx_2_28_3 + mbedtls_md_process_ncbicxx_2_28_8 #define mbedtls_md_setup \ - mbedtls_md_setup_ncbicxx_2_28_3 + mbedtls_md_setup_ncbicxx_2_28_8 #define mbedtls_md_starts \ - mbedtls_md_starts_ncbicxx_2_28_3 + mbedtls_md_starts_ncbicxx_2_28_8 #define mbedtls_md_update \ - mbedtls_md_update_ncbicxx_2_28_3 + mbedtls_md_update_ncbicxx_2_28_8 #define mbedtls_ripemd160_info \ - mbedtls_ripemd160_info_ncbicxx_2_28_3 + mbedtls_ripemd160_info_ncbicxx_2_28_8 #define mbedtls_sha1_info \ - mbedtls_sha1_info_ncbicxx_2_28_3 + mbedtls_sha1_info_ncbicxx_2_28_8 #define mbedtls_sha224_info \ - mbedtls_sha224_info_ncbicxx_2_28_3 + mbedtls_sha224_info_ncbicxx_2_28_8 #define mbedtls_sha256_info \ - mbedtls_sha256_info_ncbicxx_2_28_3 + mbedtls_sha256_info_ncbicxx_2_28_8 #define mbedtls_sha384_info \ - mbedtls_sha384_info_ncbicxx_2_28_3 + mbedtls_sha384_info_ncbicxx_2_28_8 #define mbedtls_sha512_info \ - mbedtls_sha512_info_ncbicxx_2_28_3 + mbedtls_sha512_info_ncbicxx_2_28_8 #define mbedtls_internal_md5_process \ - mbedtls_internal_md5_process_ncbicxx_2_28_3 + mbedtls_internal_md5_process_ncbicxx_2_28_8 #define mbedtls_md5 \ - mbedtls_md5_ncbicxx_2_28_3 + mbedtls_md5_ncbicxx_2_28_8 #define mbedtls_md5_clone \ - mbedtls_md5_clone_ncbicxx_2_28_3 + mbedtls_md5_clone_ncbicxx_2_28_8 #define mbedtls_md5_finish \ - mbedtls_md5_finish_ncbicxx_2_28_3 + mbedtls_md5_finish_ncbicxx_2_28_8 #define mbedtls_md5_finish_ret \ - mbedtls_md5_finish_ret_ncbicxx_2_28_3 + mbedtls_md5_finish_ret_ncbicxx_2_28_8 #define mbedtls_md5_free \ - mbedtls_md5_free_ncbicxx_2_28_3 + mbedtls_md5_free_ncbicxx_2_28_8 #define mbedtls_md5_init \ - mbedtls_md5_init_ncbicxx_2_28_3 + mbedtls_md5_init_ncbicxx_2_28_8 #define mbedtls_md5_process \ - mbedtls_md5_process_ncbicxx_2_28_3 + mbedtls_md5_process_ncbicxx_2_28_8 #define mbedtls_md5_ret \ - mbedtls_md5_ret_ncbicxx_2_28_3 + mbedtls_md5_ret_ncbicxx_2_28_8 #define mbedtls_md5_starts \ - mbedtls_md5_starts_ncbicxx_2_28_3 + mbedtls_md5_starts_ncbicxx_2_28_8 #define mbedtls_md5_starts_ret \ - mbedtls_md5_starts_ret_ncbicxx_2_28_3 + mbedtls_md5_starts_ret_ncbicxx_2_28_8 #define mbedtls_md5_update \ - mbedtls_md5_update_ncbicxx_2_28_3 + mbedtls_md5_update_ncbicxx_2_28_8 #define mbedtls_md5_update_ret \ - mbedtls_md5_update_ret_ncbicxx_2_28_3 + mbedtls_md5_update_ret_ncbicxx_2_28_8 #define mbedtls_net_accept \ - mbedtls_net_accept_ncbicxx_2_28_3 + mbedtls_net_accept_ncbicxx_2_28_8 #define mbedtls_net_bind \ - mbedtls_net_bind_ncbicxx_2_28_3 + mbedtls_net_bind_ncbicxx_2_28_8 #define mbedtls_net_close \ - mbedtls_net_close_ncbicxx_2_28_3 + mbedtls_net_close_ncbicxx_2_28_8 #define mbedtls_net_connect \ - mbedtls_net_connect_ncbicxx_2_28_3 + mbedtls_net_connect_ncbicxx_2_28_8 #define mbedtls_net_free \ - mbedtls_net_free_ncbicxx_2_28_3 + mbedtls_net_free_ncbicxx_2_28_8 #define mbedtls_net_init \ - mbedtls_net_init_ncbicxx_2_28_3 + mbedtls_net_init_ncbicxx_2_28_8 #define mbedtls_net_poll \ - mbedtls_net_poll_ncbicxx_2_28_3 + mbedtls_net_poll_ncbicxx_2_28_8 #define mbedtls_net_recv \ - mbedtls_net_recv_ncbicxx_2_28_3 + mbedtls_net_recv_ncbicxx_2_28_8 #define mbedtls_net_recv_timeout \ - mbedtls_net_recv_timeout_ncbicxx_2_28_3 + mbedtls_net_recv_timeout_ncbicxx_2_28_8 #define mbedtls_net_send \ - mbedtls_net_send_ncbicxx_2_28_3 + mbedtls_net_send_ncbicxx_2_28_8 #define mbedtls_net_set_block \ - mbedtls_net_set_block_ncbicxx_2_28_3 + mbedtls_net_set_block_ncbicxx_2_28_8 #define mbedtls_net_set_nonblock \ - mbedtls_net_set_nonblock_ncbicxx_2_28_3 + mbedtls_net_set_nonblock_ncbicxx_2_28_8 #define mbedtls_net_usleep \ - mbedtls_net_usleep_ncbicxx_2_28_3 + mbedtls_net_usleep_ncbicxx_2_28_8 #define mbedtls_oid_get_attr_short_name \ - mbedtls_oid_get_attr_short_name_ncbicxx_2_28_3 + mbedtls_oid_get_attr_short_name_ncbicxx_2_28_8 #define mbedtls_oid_get_certificate_policies \ - mbedtls_oid_get_certificate_policies_ncbicxx_2_28_3 + mbedtls_oid_get_certificate_policies_ncbicxx_2_28_8 #define mbedtls_oid_get_cipher_alg \ - mbedtls_oid_get_cipher_alg_ncbicxx_2_28_3 + mbedtls_oid_get_cipher_alg_ncbicxx_2_28_8 #define mbedtls_oid_get_ec_grp \ - mbedtls_oid_get_ec_grp_ncbicxx_2_28_3 + mbedtls_oid_get_ec_grp_ncbicxx_2_28_8 #define mbedtls_oid_get_extended_key_usage \ - mbedtls_oid_get_extended_key_usage_ncbicxx_2_28_3 + mbedtls_oid_get_extended_key_usage_ncbicxx_2_28_8 #define mbedtls_oid_get_md_alg \ - mbedtls_oid_get_md_alg_ncbicxx_2_28_3 + mbedtls_oid_get_md_alg_ncbicxx_2_28_8 #define mbedtls_oid_get_md_hmac \ - mbedtls_oid_get_md_hmac_ncbicxx_2_28_3 + mbedtls_oid_get_md_hmac_ncbicxx_2_28_8 #define mbedtls_oid_get_numeric_string \ - mbedtls_oid_get_numeric_string_ncbicxx_2_28_3 + mbedtls_oid_get_numeric_string_ncbicxx_2_28_8 #define mbedtls_oid_get_oid_by_ec_grp \ - mbedtls_oid_get_oid_by_ec_grp_ncbicxx_2_28_3 + mbedtls_oid_get_oid_by_ec_grp_ncbicxx_2_28_8 #define mbedtls_oid_get_oid_by_md \ - mbedtls_oid_get_oid_by_md_ncbicxx_2_28_3 + mbedtls_oid_get_oid_by_md_ncbicxx_2_28_8 #define mbedtls_oid_get_oid_by_pk_alg \ - mbedtls_oid_get_oid_by_pk_alg_ncbicxx_2_28_3 + mbedtls_oid_get_oid_by_pk_alg_ncbicxx_2_28_8 #define mbedtls_oid_get_oid_by_sig_alg \ - mbedtls_oid_get_oid_by_sig_alg_ncbicxx_2_28_3 + mbedtls_oid_get_oid_by_sig_alg_ncbicxx_2_28_8 #define mbedtls_oid_get_pk_alg \ - mbedtls_oid_get_pk_alg_ncbicxx_2_28_3 + mbedtls_oid_get_pk_alg_ncbicxx_2_28_8 #define mbedtls_oid_get_pkcs12_pbe_alg \ - mbedtls_oid_get_pkcs12_pbe_alg_ncbicxx_2_28_3 + mbedtls_oid_get_pkcs12_pbe_alg_ncbicxx_2_28_8 #define mbedtls_oid_get_sig_alg \ - mbedtls_oid_get_sig_alg_ncbicxx_2_28_3 + mbedtls_oid_get_sig_alg_ncbicxx_2_28_8 #define mbedtls_oid_get_sig_alg_desc \ - mbedtls_oid_get_sig_alg_desc_ncbicxx_2_28_3 + mbedtls_oid_get_sig_alg_desc_ncbicxx_2_28_8 #define mbedtls_oid_get_x509_ext_type \ - mbedtls_oid_get_x509_ext_type_ncbicxx_2_28_3 + mbedtls_oid_get_x509_ext_type_ncbicxx_2_28_8 #define mbedtls_pem_free \ - mbedtls_pem_free_ncbicxx_2_28_3 + mbedtls_pem_free_ncbicxx_2_28_8 #define mbedtls_pem_init \ - mbedtls_pem_init_ncbicxx_2_28_3 + mbedtls_pem_init_ncbicxx_2_28_8 #define mbedtls_pem_read_buffer \ - mbedtls_pem_read_buffer_ncbicxx_2_28_3 + mbedtls_pem_read_buffer_ncbicxx_2_28_8 #define mbedtls_pem_write_buffer \ - mbedtls_pem_write_buffer_ncbicxx_2_28_3 + mbedtls_pem_write_buffer_ncbicxx_2_28_8 #define mbedtls_pk_can_do \ - mbedtls_pk_can_do_ncbicxx_2_28_3 + mbedtls_pk_can_do_ncbicxx_2_28_8 #define mbedtls_pk_check_pair \ - mbedtls_pk_check_pair_ncbicxx_2_28_3 + mbedtls_pk_check_pair_ncbicxx_2_28_8 #define mbedtls_pk_debug \ - mbedtls_pk_debug_ncbicxx_2_28_3 + mbedtls_pk_debug_ncbicxx_2_28_8 #define mbedtls_pk_decrypt \ - mbedtls_pk_decrypt_ncbicxx_2_28_3 + mbedtls_pk_decrypt_ncbicxx_2_28_8 #define mbedtls_pk_encrypt \ - mbedtls_pk_encrypt_ncbicxx_2_28_3 + mbedtls_pk_encrypt_ncbicxx_2_28_8 #define mbedtls_pk_free \ - mbedtls_pk_free_ncbicxx_2_28_3 + mbedtls_pk_free_ncbicxx_2_28_8 #define mbedtls_pk_get_bitlen \ - mbedtls_pk_get_bitlen_ncbicxx_2_28_3 + mbedtls_pk_get_bitlen_ncbicxx_2_28_8 #define mbedtls_pk_get_name \ - mbedtls_pk_get_name_ncbicxx_2_28_3 + mbedtls_pk_get_name_ncbicxx_2_28_8 #define mbedtls_pk_get_type \ - mbedtls_pk_get_type_ncbicxx_2_28_3 + mbedtls_pk_get_type_ncbicxx_2_28_8 #define mbedtls_pk_info_from_type \ - mbedtls_pk_info_from_type_ncbicxx_2_28_3 + mbedtls_pk_info_from_type_ncbicxx_2_28_8 #define mbedtls_pk_init \ - mbedtls_pk_init_ncbicxx_2_28_3 + mbedtls_pk_init_ncbicxx_2_28_8 #define mbedtls_pk_setup \ - mbedtls_pk_setup_ncbicxx_2_28_3 + mbedtls_pk_setup_ncbicxx_2_28_8 #define mbedtls_pk_setup_rsa_alt \ - mbedtls_pk_setup_rsa_alt_ncbicxx_2_28_3 + mbedtls_pk_setup_rsa_alt_ncbicxx_2_28_8 #define mbedtls_pk_sign \ - mbedtls_pk_sign_ncbicxx_2_28_3 + mbedtls_pk_sign_ncbicxx_2_28_8 #define mbedtls_pk_sign_restartable \ - mbedtls_pk_sign_restartable_ncbicxx_2_28_3 + mbedtls_pk_sign_restartable_ncbicxx_2_28_8 #define mbedtls_pk_verify \ - mbedtls_pk_verify_ncbicxx_2_28_3 + mbedtls_pk_verify_ncbicxx_2_28_8 #define mbedtls_pk_verify_ext \ - mbedtls_pk_verify_ext_ncbicxx_2_28_3 + mbedtls_pk_verify_ext_ncbicxx_2_28_8 #define mbedtls_pk_verify_restartable \ - mbedtls_pk_verify_restartable_ncbicxx_2_28_3 + mbedtls_pk_verify_restartable_ncbicxx_2_28_8 #define mbedtls_ecdsa_info \ - mbedtls_ecdsa_info_ncbicxx_2_28_3 + mbedtls_ecdsa_info_ncbicxx_2_28_8 #define mbedtls_eckey_info \ - mbedtls_eckey_info_ncbicxx_2_28_3 + mbedtls_eckey_info_ncbicxx_2_28_8 #define mbedtls_eckeydh_info \ - mbedtls_eckeydh_info_ncbicxx_2_28_3 + mbedtls_eckeydh_info_ncbicxx_2_28_8 #define mbedtls_rsa_alt_info \ - mbedtls_rsa_alt_info_ncbicxx_2_28_3 + mbedtls_rsa_alt_info_ncbicxx_2_28_8 #define mbedtls_rsa_info \ - mbedtls_rsa_info_ncbicxx_2_28_3 + mbedtls_rsa_info_ncbicxx_2_28_8 #define mbedtls_pkcs12_derivation \ - mbedtls_pkcs12_derivation_ncbicxx_2_28_3 + mbedtls_pkcs12_derivation_ncbicxx_2_28_8 #define mbedtls_pkcs12_pbe \ - mbedtls_pkcs12_pbe_ncbicxx_2_28_3 + mbedtls_pkcs12_pbe_ncbicxx_2_28_8 +#define mbedtls_pkcs12_pbe_ext \ + mbedtls_pkcs12_pbe_ext_ncbicxx_2_28_8 #define mbedtls_pkcs12_pbe_sha1_rc4_128 \ - mbedtls_pkcs12_pbe_sha1_rc4_128_ncbicxx_2_28_3 + mbedtls_pkcs12_pbe_sha1_rc4_128_ncbicxx_2_28_8 #define mbedtls_pkcs5_pbes2 \ - mbedtls_pkcs5_pbes2_ncbicxx_2_28_3 + mbedtls_pkcs5_pbes2_ncbicxx_2_28_8 +#define mbedtls_pkcs5_pbes2_ext \ + mbedtls_pkcs5_pbes2_ext_ncbicxx_2_28_8 #define mbedtls_pkcs5_pbkdf2_hmac \ - mbedtls_pkcs5_pbkdf2_hmac_ncbicxx_2_28_3 + mbedtls_pkcs5_pbkdf2_hmac_ncbicxx_2_28_8 #define mbedtls_pk_load_file \ - mbedtls_pk_load_file_ncbicxx_2_28_3 + mbedtls_pk_load_file_ncbicxx_2_28_8 #define mbedtls_pk_parse_key \ - mbedtls_pk_parse_key_ncbicxx_2_28_3 + mbedtls_pk_parse_key_ncbicxx_2_28_8 #define mbedtls_pk_parse_keyfile \ - mbedtls_pk_parse_keyfile_ncbicxx_2_28_3 + mbedtls_pk_parse_keyfile_ncbicxx_2_28_8 #define mbedtls_pk_parse_public_key \ - mbedtls_pk_parse_public_key_ncbicxx_2_28_3 + mbedtls_pk_parse_public_key_ncbicxx_2_28_8 #define mbedtls_pk_parse_public_keyfile \ - mbedtls_pk_parse_public_keyfile_ncbicxx_2_28_3 + mbedtls_pk_parse_public_keyfile_ncbicxx_2_28_8 #define mbedtls_pk_parse_subpubkey \ - mbedtls_pk_parse_subpubkey_ncbicxx_2_28_3 + mbedtls_pk_parse_subpubkey_ncbicxx_2_28_8 #define mbedtls_pk_write_key_der \ - mbedtls_pk_write_key_der_ncbicxx_2_28_3 + mbedtls_pk_write_key_der_ncbicxx_2_28_8 #define mbedtls_pk_write_key_pem \ - mbedtls_pk_write_key_pem_ncbicxx_2_28_3 + mbedtls_pk_write_key_pem_ncbicxx_2_28_8 #define mbedtls_pk_write_pubkey \ - mbedtls_pk_write_pubkey_ncbicxx_2_28_3 + mbedtls_pk_write_pubkey_ncbicxx_2_28_8 #define mbedtls_pk_write_pubkey_der \ - mbedtls_pk_write_pubkey_der_ncbicxx_2_28_3 + mbedtls_pk_write_pubkey_der_ncbicxx_2_28_8 #define mbedtls_pk_write_pubkey_pem \ - mbedtls_pk_write_pubkey_pem_ncbicxx_2_28_3 + mbedtls_pk_write_pubkey_pem_ncbicxx_2_28_8 #define mbedtls_platform_setup \ - mbedtls_platform_setup_ncbicxx_2_28_3 + mbedtls_platform_setup_ncbicxx_2_28_8 #define mbedtls_platform_set_snprintf \ - mbedtls_platform_set_snprintf_ncbicxx_2_28_3 + mbedtls_platform_set_snprintf_ncbicxx_2_28_8 #define mbedtls_platform_set_vsnprintf \ - mbedtls_platform_set_vsnprintf_ncbicxx_2_28_3 + mbedtls_platform_set_vsnprintf_ncbicxx_2_28_8 #define mbedtls_platform_teardown \ - mbedtls_platform_teardown_ncbicxx_2_28_3 + mbedtls_platform_teardown_ncbicxx_2_28_8 #define mbedtls_snprintf \ - mbedtls_snprintf_ncbicxx_2_28_3 + mbedtls_snprintf_ncbicxx_2_28_8 #define mbedtls_vsnprintf \ - mbedtls_vsnprintf_ncbicxx_2_28_3 + mbedtls_vsnprintf_ncbicxx_2_28_8 #define mbedtls_platform_gmtime_r \ - mbedtls_platform_gmtime_r_ncbicxx_2_28_3 + mbedtls_platform_gmtime_r_ncbicxx_2_28_8 #define mbedtls_platform_zeroize \ - mbedtls_platform_zeroize_ncbicxx_2_28_3 + mbedtls_platform_zeroize_ncbicxx_2_28_8 #define mbedtls_poly1305_finish \ - mbedtls_poly1305_finish_ncbicxx_2_28_3 + mbedtls_poly1305_finish_ncbicxx_2_28_8 #define mbedtls_poly1305_free \ - mbedtls_poly1305_free_ncbicxx_2_28_3 + mbedtls_poly1305_free_ncbicxx_2_28_8 #define mbedtls_poly1305_init \ - mbedtls_poly1305_init_ncbicxx_2_28_3 + mbedtls_poly1305_init_ncbicxx_2_28_8 #define mbedtls_poly1305_mac \ - mbedtls_poly1305_mac_ncbicxx_2_28_3 + mbedtls_poly1305_mac_ncbicxx_2_28_8 #define mbedtls_poly1305_starts \ - mbedtls_poly1305_starts_ncbicxx_2_28_3 + mbedtls_poly1305_starts_ncbicxx_2_28_8 #define mbedtls_poly1305_update \ - mbedtls_poly1305_update_ncbicxx_2_28_3 + mbedtls_poly1305_update_ncbicxx_2_28_8 #define mbedtls_ecc_group_of_psa \ - mbedtls_ecc_group_of_psa_ncbicxx_2_28_3 + mbedtls_ecc_group_of_psa_ncbicxx_2_28_8 #define mbedtls_psa_crypto_configure_entropy_sources \ - mbedtls_psa_crypto_configure_entropy_sources_ncbicxx_2_28_3 + mbedtls_psa_crypto_configure_entropy_sources_ncbicxx_2_28_8 #define mbedtls_psa_crypto_free \ - mbedtls_psa_crypto_free_ncbicxx_2_28_3 + mbedtls_psa_crypto_free_ncbicxx_2_28_8 #define mbedtls_psa_random_state \ - mbedtls_psa_random_state_ncbicxx_2_28_3 + mbedtls_psa_random_state_ncbicxx_2_28_8 #define mbedtls_to_psa_error \ - mbedtls_to_psa_error_ncbicxx_2_28_3 + mbedtls_to_psa_error_ncbicxx_2_28_8 #define psa_aead_decrypt \ - psa_aead_decrypt_ncbicxx_2_28_3 + psa_aead_decrypt_ncbicxx_2_28_8 #define psa_aead_encrypt \ - psa_aead_encrypt_ncbicxx_2_28_3 + psa_aead_encrypt_ncbicxx_2_28_8 #define psa_allocate_buffer_to_slot \ - psa_allocate_buffer_to_slot_ncbicxx_2_28_3 + psa_allocate_buffer_to_slot_ncbicxx_2_28_8 #define psa_asymmetric_decrypt \ - psa_asymmetric_decrypt_ncbicxx_2_28_3 + psa_asymmetric_decrypt_ncbicxx_2_28_8 #define psa_asymmetric_encrypt \ - psa_asymmetric_encrypt_ncbicxx_2_28_3 + psa_asymmetric_encrypt_ncbicxx_2_28_8 #define psa_cipher_abort \ - psa_cipher_abort_ncbicxx_2_28_3 + psa_cipher_abort_ncbicxx_2_28_8 #define psa_cipher_decrypt \ - psa_cipher_decrypt_ncbicxx_2_28_3 + psa_cipher_decrypt_ncbicxx_2_28_8 #define psa_cipher_decrypt_setup \ - psa_cipher_decrypt_setup_ncbicxx_2_28_3 + psa_cipher_decrypt_setup_ncbicxx_2_28_8 #define psa_cipher_encrypt \ - psa_cipher_encrypt_ncbicxx_2_28_3 + psa_cipher_encrypt_ncbicxx_2_28_8 #define psa_cipher_encrypt_setup \ - psa_cipher_encrypt_setup_ncbicxx_2_28_3 + psa_cipher_encrypt_setup_ncbicxx_2_28_8 #define psa_cipher_finish \ - psa_cipher_finish_ncbicxx_2_28_3 + psa_cipher_finish_ncbicxx_2_28_8 #define psa_cipher_generate_iv \ - psa_cipher_generate_iv_ncbicxx_2_28_3 + psa_cipher_generate_iv_ncbicxx_2_28_8 #define psa_cipher_set_iv \ - psa_cipher_set_iv_ncbicxx_2_28_3 + psa_cipher_set_iv_ncbicxx_2_28_8 #define psa_cipher_update \ - psa_cipher_update_ncbicxx_2_28_3 + psa_cipher_update_ncbicxx_2_28_8 #define psa_copy_key \ - psa_copy_key_ncbicxx_2_28_3 + psa_copy_key_ncbicxx_2_28_8 #define psa_copy_key_material_into_slot \ - psa_copy_key_material_into_slot_ncbicxx_2_28_3 + psa_copy_key_material_into_slot_ncbicxx_2_28_8 #define psa_crypto_init \ - psa_crypto_init_ncbicxx_2_28_3 + psa_crypto_init_ncbicxx_2_28_8 +#define psa_crypto_local_input_alloc \ + psa_crypto_local_input_alloc_ncbicxx_2_28_8 +#define psa_crypto_local_input_free \ + psa_crypto_local_input_free_ncbicxx_2_28_8 +#define psa_crypto_local_output_alloc \ + psa_crypto_local_output_alloc_ncbicxx_2_28_8 +#define psa_crypto_local_output_free \ + psa_crypto_local_output_free_ncbicxx_2_28_8 #define psa_destroy_key \ - psa_destroy_key_ncbicxx_2_28_3 + psa_destroy_key_ncbicxx_2_28_8 #define psa_export_key \ - psa_export_key_ncbicxx_2_28_3 + psa_export_key_ncbicxx_2_28_8 #define psa_export_key_internal \ - psa_export_key_internal_ncbicxx_2_28_3 + psa_export_key_internal_ncbicxx_2_28_8 #define psa_export_public_key \ - psa_export_public_key_ncbicxx_2_28_3 + psa_export_public_key_ncbicxx_2_28_8 #define psa_export_public_key_internal \ - psa_export_public_key_internal_ncbicxx_2_28_3 + psa_export_public_key_internal_ncbicxx_2_28_8 #define psa_generate_key \ - psa_generate_key_ncbicxx_2_28_3 + psa_generate_key_ncbicxx_2_28_8 #define psa_generate_key_internal \ - psa_generate_key_internal_ncbicxx_2_28_3 + psa_generate_key_internal_ncbicxx_2_28_8 #define psa_generate_random \ - psa_generate_random_ncbicxx_2_28_3 + psa_generate_random_ncbicxx_2_28_8 #define psa_get_key_attributes \ - psa_get_key_attributes_ncbicxx_2_28_3 + psa_get_key_attributes_ncbicxx_2_28_8 #define psa_hash_abort \ - psa_hash_abort_ncbicxx_2_28_3 + psa_hash_abort_ncbicxx_2_28_8 #define psa_hash_clone \ - psa_hash_clone_ncbicxx_2_28_3 + psa_hash_clone_ncbicxx_2_28_8 #define psa_hash_compare \ - psa_hash_compare_ncbicxx_2_28_3 + psa_hash_compare_ncbicxx_2_28_8 #define psa_hash_compute \ - psa_hash_compute_ncbicxx_2_28_3 + psa_hash_compute_ncbicxx_2_28_8 #define psa_hash_finish \ - psa_hash_finish_ncbicxx_2_28_3 + psa_hash_finish_ncbicxx_2_28_8 #define psa_hash_setup \ - psa_hash_setup_ncbicxx_2_28_3 + psa_hash_setup_ncbicxx_2_28_8 #define psa_hash_update \ - psa_hash_update_ncbicxx_2_28_3 + psa_hash_update_ncbicxx_2_28_8 #define psa_hash_verify \ - psa_hash_verify_ncbicxx_2_28_3 + psa_hash_verify_ncbicxx_2_28_8 #define psa_import_key \ - psa_import_key_ncbicxx_2_28_3 + psa_import_key_ncbicxx_2_28_8 #define psa_import_key_into_slot \ - psa_import_key_into_slot_ncbicxx_2_28_3 + psa_import_key_into_slot_ncbicxx_2_28_8 #define psa_key_derivation_abort \ - psa_key_derivation_abort_ncbicxx_2_28_3 + psa_key_derivation_abort_ncbicxx_2_28_8 #define psa_key_derivation_get_capacity \ - psa_key_derivation_get_capacity_ncbicxx_2_28_3 + psa_key_derivation_get_capacity_ncbicxx_2_28_8 #define psa_key_derivation_input_bytes \ - psa_key_derivation_input_bytes_ncbicxx_2_28_3 + psa_key_derivation_input_bytes_ncbicxx_2_28_8 #define psa_key_derivation_input_key \ - psa_key_derivation_input_key_ncbicxx_2_28_3 + psa_key_derivation_input_key_ncbicxx_2_28_8 #define psa_key_derivation_key_agreement \ - psa_key_derivation_key_agreement_ncbicxx_2_28_3 + psa_key_derivation_key_agreement_ncbicxx_2_28_8 #define psa_key_derivation_output_bytes \ - psa_key_derivation_output_bytes_ncbicxx_2_28_3 + psa_key_derivation_output_bytes_ncbicxx_2_28_8 #define psa_key_derivation_output_key \ - psa_key_derivation_output_key_ncbicxx_2_28_3 + psa_key_derivation_output_key_ncbicxx_2_28_8 #define psa_key_derivation_set_capacity \ - psa_key_derivation_set_capacity_ncbicxx_2_28_3 + psa_key_derivation_set_capacity_ncbicxx_2_28_8 #define psa_key_derivation_setup \ - psa_key_derivation_setup_ncbicxx_2_28_3 + psa_key_derivation_setup_ncbicxx_2_28_8 #define psa_mac_abort \ - psa_mac_abort_ncbicxx_2_28_3 + psa_mac_abort_ncbicxx_2_28_8 #define psa_mac_compute \ - psa_mac_compute_ncbicxx_2_28_3 + psa_mac_compute_ncbicxx_2_28_8 #define psa_mac_sign_finish \ - psa_mac_sign_finish_ncbicxx_2_28_3 + psa_mac_sign_finish_ncbicxx_2_28_8 #define psa_mac_sign_setup \ - psa_mac_sign_setup_ncbicxx_2_28_3 + psa_mac_sign_setup_ncbicxx_2_28_8 #define psa_mac_update \ - psa_mac_update_ncbicxx_2_28_3 + psa_mac_update_ncbicxx_2_28_8 #define psa_mac_verify \ - psa_mac_verify_ncbicxx_2_28_3 + psa_mac_verify_ncbicxx_2_28_8 #define psa_mac_verify_finish \ - psa_mac_verify_finish_ncbicxx_2_28_3 + psa_mac_verify_finish_ncbicxx_2_28_8 #define psa_mac_verify_setup \ - psa_mac_verify_setup_ncbicxx_2_28_3 + psa_mac_verify_setup_ncbicxx_2_28_8 #define psa_raw_key_agreement \ - psa_raw_key_agreement_ncbicxx_2_28_3 + psa_raw_key_agreement_ncbicxx_2_28_8 #define psa_remove_key_data_from_memory \ - psa_remove_key_data_from_memory_ncbicxx_2_28_3 + psa_remove_key_data_from_memory_ncbicxx_2_28_8 #define psa_sign_hash \ - psa_sign_hash_ncbicxx_2_28_3 + psa_sign_hash_ncbicxx_2_28_8 #define psa_sign_hash_builtin \ - psa_sign_hash_builtin_ncbicxx_2_28_3 + psa_sign_hash_builtin_ncbicxx_2_28_8 #define psa_sign_message \ - psa_sign_message_ncbicxx_2_28_3 + psa_sign_message_ncbicxx_2_28_8 #define psa_sign_message_builtin \ - psa_sign_message_builtin_ncbicxx_2_28_3 + psa_sign_message_builtin_ncbicxx_2_28_8 #define psa_verify_hash \ - psa_verify_hash_ncbicxx_2_28_3 + psa_verify_hash_ncbicxx_2_28_8 #define psa_verify_hash_builtin \ - psa_verify_hash_builtin_ncbicxx_2_28_3 + psa_verify_hash_builtin_ncbicxx_2_28_8 #define psa_verify_message \ - psa_verify_message_ncbicxx_2_28_3 + psa_verify_message_ncbicxx_2_28_8 #define psa_verify_message_builtin \ - psa_verify_message_builtin_ncbicxx_2_28_3 + psa_verify_message_builtin_ncbicxx_2_28_8 #define psa_wipe_key_slot \ - psa_wipe_key_slot_ncbicxx_2_28_3 + psa_wipe_key_slot_ncbicxx_2_28_8 #define mbedtls_psa_aead_decrypt \ - mbedtls_psa_aead_decrypt_ncbicxx_2_28_3 + mbedtls_psa_aead_decrypt_ncbicxx_2_28_8 #define mbedtls_psa_aead_encrypt \ - mbedtls_psa_aead_encrypt_ncbicxx_2_28_3 + mbedtls_psa_aead_encrypt_ncbicxx_2_28_8 #define mbedtls_cipher_info_from_psa \ - mbedtls_cipher_info_from_psa_ncbicxx_2_28_3 + mbedtls_cipher_info_from_psa_ncbicxx_2_28_8 #define mbedtls_psa_cipher_abort \ - mbedtls_psa_cipher_abort_ncbicxx_2_28_3 + mbedtls_psa_cipher_abort_ncbicxx_2_28_8 #define mbedtls_psa_cipher_decrypt \ - mbedtls_psa_cipher_decrypt_ncbicxx_2_28_3 + mbedtls_psa_cipher_decrypt_ncbicxx_2_28_8 #define mbedtls_psa_cipher_decrypt_setup \ - mbedtls_psa_cipher_decrypt_setup_ncbicxx_2_28_3 + mbedtls_psa_cipher_decrypt_setup_ncbicxx_2_28_8 #define mbedtls_psa_cipher_encrypt \ - mbedtls_psa_cipher_encrypt_ncbicxx_2_28_3 + mbedtls_psa_cipher_encrypt_ncbicxx_2_28_8 #define mbedtls_psa_cipher_encrypt_setup \ - mbedtls_psa_cipher_encrypt_setup_ncbicxx_2_28_3 + mbedtls_psa_cipher_encrypt_setup_ncbicxx_2_28_8 #define mbedtls_psa_cipher_finish \ - mbedtls_psa_cipher_finish_ncbicxx_2_28_3 + mbedtls_psa_cipher_finish_ncbicxx_2_28_8 #define mbedtls_psa_cipher_set_iv \ - mbedtls_psa_cipher_set_iv_ncbicxx_2_28_3 + mbedtls_psa_cipher_set_iv_ncbicxx_2_28_8 #define mbedtls_psa_cipher_update \ - mbedtls_psa_cipher_update_ncbicxx_2_28_3 + mbedtls_psa_cipher_update_ncbicxx_2_28_8 #define psa_get_key_domain_parameters \ - psa_get_key_domain_parameters_ncbicxx_2_28_3 + psa_get_key_domain_parameters_ncbicxx_2_28_8 #define psa_reset_key_attributes \ - psa_reset_key_attributes_ncbicxx_2_28_3 + psa_reset_key_attributes_ncbicxx_2_28_8 #define psa_set_key_domain_parameters \ - psa_set_key_domain_parameters_ncbicxx_2_28_3 + psa_set_key_domain_parameters_ncbicxx_2_28_8 #define psa_driver_wrapper_aead_decrypt \ - psa_driver_wrapper_aead_decrypt_ncbicxx_2_28_3 + psa_driver_wrapper_aead_decrypt_ncbicxx_2_28_8 #define psa_driver_wrapper_aead_encrypt \ - psa_driver_wrapper_aead_encrypt_ncbicxx_2_28_3 + psa_driver_wrapper_aead_encrypt_ncbicxx_2_28_8 #define psa_driver_wrapper_cipher_abort \ - psa_driver_wrapper_cipher_abort_ncbicxx_2_28_3 + psa_driver_wrapper_cipher_abort_ncbicxx_2_28_8 #define psa_driver_wrapper_cipher_decrypt \ - psa_driver_wrapper_cipher_decrypt_ncbicxx_2_28_3 + psa_driver_wrapper_cipher_decrypt_ncbicxx_2_28_8 #define psa_driver_wrapper_cipher_decrypt_setup \ - psa_driver_wrapper_cipher_decrypt_setup_ncbicxx_2_28_3 + psa_driver_wrapper_cipher_decrypt_setup_ncbicxx_2_28_8 #define psa_driver_wrapper_cipher_encrypt \ - psa_driver_wrapper_cipher_encrypt_ncbicxx_2_28_3 + psa_driver_wrapper_cipher_encrypt_ncbicxx_2_28_8 #define psa_driver_wrapper_cipher_encrypt_setup \ - psa_driver_wrapper_cipher_encrypt_setup_ncbicxx_2_28_3 + psa_driver_wrapper_cipher_encrypt_setup_ncbicxx_2_28_8 #define psa_driver_wrapper_cipher_finish \ - psa_driver_wrapper_cipher_finish_ncbicxx_2_28_3 + psa_driver_wrapper_cipher_finish_ncbicxx_2_28_8 #define psa_driver_wrapper_cipher_set_iv \ - psa_driver_wrapper_cipher_set_iv_ncbicxx_2_28_3 + psa_driver_wrapper_cipher_set_iv_ncbicxx_2_28_8 #define psa_driver_wrapper_cipher_update \ - psa_driver_wrapper_cipher_update_ncbicxx_2_28_3 + psa_driver_wrapper_cipher_update_ncbicxx_2_28_8 #define psa_driver_wrapper_export_key \ - psa_driver_wrapper_export_key_ncbicxx_2_28_3 + psa_driver_wrapper_export_key_ncbicxx_2_28_8 #define psa_driver_wrapper_export_public_key \ - psa_driver_wrapper_export_public_key_ncbicxx_2_28_3 + psa_driver_wrapper_export_public_key_ncbicxx_2_28_8 #define psa_driver_wrapper_free \ - psa_driver_wrapper_free_ncbicxx_2_28_3 + psa_driver_wrapper_free_ncbicxx_2_28_8 #define psa_driver_wrapper_generate_key \ - psa_driver_wrapper_generate_key_ncbicxx_2_28_3 + psa_driver_wrapper_generate_key_ncbicxx_2_28_8 #define psa_driver_wrapper_get_builtin_key \ - psa_driver_wrapper_get_builtin_key_ncbicxx_2_28_3 + psa_driver_wrapper_get_builtin_key_ncbicxx_2_28_8 #define psa_driver_wrapper_get_key_buffer_size \ - psa_driver_wrapper_get_key_buffer_size_ncbicxx_2_28_3 + psa_driver_wrapper_get_key_buffer_size_ncbicxx_2_28_8 #define psa_driver_wrapper_hash_abort \ - psa_driver_wrapper_hash_abort_ncbicxx_2_28_3 + psa_driver_wrapper_hash_abort_ncbicxx_2_28_8 #define psa_driver_wrapper_hash_clone \ - psa_driver_wrapper_hash_clone_ncbicxx_2_28_3 + psa_driver_wrapper_hash_clone_ncbicxx_2_28_8 #define psa_driver_wrapper_hash_compute \ - psa_driver_wrapper_hash_compute_ncbicxx_2_28_3 + psa_driver_wrapper_hash_compute_ncbicxx_2_28_8 #define psa_driver_wrapper_hash_finish \ - psa_driver_wrapper_hash_finish_ncbicxx_2_28_3 + psa_driver_wrapper_hash_finish_ncbicxx_2_28_8 #define psa_driver_wrapper_hash_setup \ - psa_driver_wrapper_hash_setup_ncbicxx_2_28_3 + psa_driver_wrapper_hash_setup_ncbicxx_2_28_8 #define psa_driver_wrapper_hash_update \ - psa_driver_wrapper_hash_update_ncbicxx_2_28_3 + psa_driver_wrapper_hash_update_ncbicxx_2_28_8 #define psa_driver_wrapper_import_key \ - psa_driver_wrapper_import_key_ncbicxx_2_28_3 + psa_driver_wrapper_import_key_ncbicxx_2_28_8 #define psa_driver_wrapper_init \ - psa_driver_wrapper_init_ncbicxx_2_28_3 + psa_driver_wrapper_init_ncbicxx_2_28_8 #define psa_driver_wrapper_mac_abort \ - psa_driver_wrapper_mac_abort_ncbicxx_2_28_3 + psa_driver_wrapper_mac_abort_ncbicxx_2_28_8 #define psa_driver_wrapper_mac_compute \ - psa_driver_wrapper_mac_compute_ncbicxx_2_28_3 + psa_driver_wrapper_mac_compute_ncbicxx_2_28_8 #define psa_driver_wrapper_mac_sign_finish \ - psa_driver_wrapper_mac_sign_finish_ncbicxx_2_28_3 + psa_driver_wrapper_mac_sign_finish_ncbicxx_2_28_8 #define psa_driver_wrapper_mac_sign_setup \ - psa_driver_wrapper_mac_sign_setup_ncbicxx_2_28_3 + psa_driver_wrapper_mac_sign_setup_ncbicxx_2_28_8 #define psa_driver_wrapper_mac_update \ - psa_driver_wrapper_mac_update_ncbicxx_2_28_3 + psa_driver_wrapper_mac_update_ncbicxx_2_28_8 #define psa_driver_wrapper_mac_verify_finish \ - psa_driver_wrapper_mac_verify_finish_ncbicxx_2_28_3 + psa_driver_wrapper_mac_verify_finish_ncbicxx_2_28_8 #define psa_driver_wrapper_mac_verify_setup \ - psa_driver_wrapper_mac_verify_setup_ncbicxx_2_28_3 + psa_driver_wrapper_mac_verify_setup_ncbicxx_2_28_8 #define psa_driver_wrapper_sign_hash \ - psa_driver_wrapper_sign_hash_ncbicxx_2_28_3 + psa_driver_wrapper_sign_hash_ncbicxx_2_28_8 #define psa_driver_wrapper_sign_message \ - psa_driver_wrapper_sign_message_ncbicxx_2_28_3 + psa_driver_wrapper_sign_message_ncbicxx_2_28_8 #define psa_driver_wrapper_verify_hash \ - psa_driver_wrapper_verify_hash_ncbicxx_2_28_3 + psa_driver_wrapper_verify_hash_ncbicxx_2_28_8 #define psa_driver_wrapper_verify_message \ - psa_driver_wrapper_verify_message_ncbicxx_2_28_3 + psa_driver_wrapper_verify_message_ncbicxx_2_28_8 #define mbedtls_psa_ecdsa_sign_hash \ - mbedtls_psa_ecdsa_sign_hash_ncbicxx_2_28_3 + mbedtls_psa_ecdsa_sign_hash_ncbicxx_2_28_8 #define mbedtls_psa_ecdsa_verify_hash \ - mbedtls_psa_ecdsa_verify_hash_ncbicxx_2_28_3 + mbedtls_psa_ecdsa_verify_hash_ncbicxx_2_28_8 #define mbedtls_psa_ecp_export_key \ - mbedtls_psa_ecp_export_key_ncbicxx_2_28_3 + mbedtls_psa_ecp_export_key_ncbicxx_2_28_8 #define mbedtls_psa_ecp_export_public_key \ - mbedtls_psa_ecp_export_public_key_ncbicxx_2_28_3 + mbedtls_psa_ecp_export_public_key_ncbicxx_2_28_8 #define mbedtls_psa_ecp_generate_key \ - mbedtls_psa_ecp_generate_key_ncbicxx_2_28_3 + mbedtls_psa_ecp_generate_key_ncbicxx_2_28_8 #define mbedtls_psa_ecp_import_key \ - mbedtls_psa_ecp_import_key_ncbicxx_2_28_3 + mbedtls_psa_ecp_import_key_ncbicxx_2_28_8 #define mbedtls_psa_ecp_load_representation \ - mbedtls_psa_ecp_load_representation_ncbicxx_2_28_3 + mbedtls_psa_ecp_load_representation_ncbicxx_2_28_8 #define mbedtls_md_info_from_psa \ - mbedtls_md_info_from_psa_ncbicxx_2_28_3 + mbedtls_md_info_from_psa_ncbicxx_2_28_8 #define mbedtls_psa_hash_abort \ - mbedtls_psa_hash_abort_ncbicxx_2_28_3 + mbedtls_psa_hash_abort_ncbicxx_2_28_8 #define mbedtls_psa_hash_clone \ - mbedtls_psa_hash_clone_ncbicxx_2_28_3 + mbedtls_psa_hash_clone_ncbicxx_2_28_8 #define mbedtls_psa_hash_compute \ - mbedtls_psa_hash_compute_ncbicxx_2_28_3 + mbedtls_psa_hash_compute_ncbicxx_2_28_8 #define mbedtls_psa_hash_finish \ - mbedtls_psa_hash_finish_ncbicxx_2_28_3 + mbedtls_psa_hash_finish_ncbicxx_2_28_8 #define mbedtls_psa_hash_setup \ - mbedtls_psa_hash_setup_ncbicxx_2_28_3 + mbedtls_psa_hash_setup_ncbicxx_2_28_8 #define mbedtls_psa_hash_update \ - mbedtls_psa_hash_update_ncbicxx_2_28_3 + mbedtls_psa_hash_update_ncbicxx_2_28_8 #define mbedtls_psa_mac_abort \ - mbedtls_psa_mac_abort_ncbicxx_2_28_3 + mbedtls_psa_mac_abort_ncbicxx_2_28_8 #define mbedtls_psa_mac_compute \ - mbedtls_psa_mac_compute_ncbicxx_2_28_3 + mbedtls_psa_mac_compute_ncbicxx_2_28_8 #define mbedtls_psa_mac_sign_finish \ - mbedtls_psa_mac_sign_finish_ncbicxx_2_28_3 + mbedtls_psa_mac_sign_finish_ncbicxx_2_28_8 #define mbedtls_psa_mac_sign_setup \ - mbedtls_psa_mac_sign_setup_ncbicxx_2_28_3 + mbedtls_psa_mac_sign_setup_ncbicxx_2_28_8 #define mbedtls_psa_mac_update \ - mbedtls_psa_mac_update_ncbicxx_2_28_3 + mbedtls_psa_mac_update_ncbicxx_2_28_8 #define mbedtls_psa_mac_verify_finish \ - mbedtls_psa_mac_verify_finish_ncbicxx_2_28_3 + mbedtls_psa_mac_verify_finish_ncbicxx_2_28_8 #define mbedtls_psa_mac_verify_setup \ - mbedtls_psa_mac_verify_setup_ncbicxx_2_28_3 + mbedtls_psa_mac_verify_setup_ncbicxx_2_28_8 #define mbedtls_psa_rsa_export_key \ - mbedtls_psa_rsa_export_key_ncbicxx_2_28_3 + mbedtls_psa_rsa_export_key_ncbicxx_2_28_8 #define mbedtls_psa_rsa_export_public_key \ - mbedtls_psa_rsa_export_public_key_ncbicxx_2_28_3 + mbedtls_psa_rsa_export_public_key_ncbicxx_2_28_8 #define mbedtls_psa_rsa_generate_key \ - mbedtls_psa_rsa_generate_key_ncbicxx_2_28_3 + mbedtls_psa_rsa_generate_key_ncbicxx_2_28_8 #define mbedtls_psa_rsa_import_key \ - mbedtls_psa_rsa_import_key_ncbicxx_2_28_3 + mbedtls_psa_rsa_import_key_ncbicxx_2_28_8 #define mbedtls_psa_rsa_load_representation \ - mbedtls_psa_rsa_load_representation_ncbicxx_2_28_3 + mbedtls_psa_rsa_load_representation_ncbicxx_2_28_8 #define mbedtls_psa_rsa_sign_hash \ - mbedtls_psa_rsa_sign_hash_ncbicxx_2_28_3 + mbedtls_psa_rsa_sign_hash_ncbicxx_2_28_8 #define mbedtls_psa_rsa_verify_hash \ - mbedtls_psa_rsa_verify_hash_ncbicxx_2_28_3 + mbedtls_psa_rsa_verify_hash_ncbicxx_2_28_8 #define mbedtls_psa_get_stats \ - mbedtls_psa_get_stats_ncbicxx_2_28_3 + mbedtls_psa_get_stats_ncbicxx_2_28_8 #define psa_close_key \ - psa_close_key_ncbicxx_2_28_3 + psa_close_key_ncbicxx_2_28_8 #define psa_get_and_lock_key_slot \ - psa_get_and_lock_key_slot_ncbicxx_2_28_3 + psa_get_and_lock_key_slot_ncbicxx_2_28_8 #define psa_get_empty_key_slot \ - psa_get_empty_key_slot_ncbicxx_2_28_3 + psa_get_empty_key_slot_ncbicxx_2_28_8 #define psa_initialize_key_slots \ - psa_initialize_key_slots_ncbicxx_2_28_3 + psa_initialize_key_slots_ncbicxx_2_28_8 #define psa_is_valid_key_id \ - psa_is_valid_key_id_ncbicxx_2_28_3 + psa_is_valid_key_id_ncbicxx_2_28_8 #define psa_open_key \ - psa_open_key_ncbicxx_2_28_3 + psa_open_key_ncbicxx_2_28_8 #define psa_purge_key \ - psa_purge_key_ncbicxx_2_28_3 + psa_purge_key_ncbicxx_2_28_8 #define psa_unlock_key_slot \ - psa_unlock_key_slot_ncbicxx_2_28_3 + psa_unlock_key_slot_ncbicxx_2_28_8 #define psa_validate_key_location \ - psa_validate_key_location_ncbicxx_2_28_3 + psa_validate_key_location_ncbicxx_2_28_8 #define psa_validate_key_persistence \ - psa_validate_key_persistence_ncbicxx_2_28_3 + psa_validate_key_persistence_ncbicxx_2_28_8 #define psa_wipe_all_key_slots \ - psa_wipe_all_key_slots_ncbicxx_2_28_3 + psa_wipe_all_key_slots_ncbicxx_2_28_8 #define psa_destroy_persistent_key \ - psa_destroy_persistent_key_ncbicxx_2_28_3 + psa_destroy_persistent_key_ncbicxx_2_28_8 #define psa_format_key_data_for_storage \ - psa_format_key_data_for_storage_ncbicxx_2_28_3 + psa_format_key_data_for_storage_ncbicxx_2_28_8 #define psa_free_persistent_key_data \ - psa_free_persistent_key_data_ncbicxx_2_28_3 + psa_free_persistent_key_data_ncbicxx_2_28_8 #define psa_is_key_present_in_storage \ - psa_is_key_present_in_storage_ncbicxx_2_28_3 + psa_is_key_present_in_storage_ncbicxx_2_28_8 #define psa_load_persistent_key \ - psa_load_persistent_key_ncbicxx_2_28_3 + psa_load_persistent_key_ncbicxx_2_28_8 #define psa_parse_key_data_from_storage \ - psa_parse_key_data_from_storage_ncbicxx_2_28_3 + psa_parse_key_data_from_storage_ncbicxx_2_28_8 #define psa_save_persistent_key \ - psa_save_persistent_key_ncbicxx_2_28_3 + psa_save_persistent_key_ncbicxx_2_28_8 #define psa_its_get \ - psa_its_get_ncbicxx_2_28_3 + psa_its_get_ncbicxx_2_28_8 #define psa_its_get_info \ - psa_its_get_info_ncbicxx_2_28_3 + psa_its_get_info_ncbicxx_2_28_8 #define psa_its_remove \ - psa_its_remove_ncbicxx_2_28_3 + psa_its_remove_ncbicxx_2_28_8 #define psa_its_set \ - psa_its_set_ncbicxx_2_28_3 + psa_its_set_ncbicxx_2_28_8 #define mbedtls_internal_ripemd160_process \ - mbedtls_internal_ripemd160_process_ncbicxx_2_28_3 + mbedtls_internal_ripemd160_process_ncbicxx_2_28_8 #define mbedtls_ripemd160 \ - mbedtls_ripemd160_ncbicxx_2_28_3 + mbedtls_ripemd160_ncbicxx_2_28_8 #define mbedtls_ripemd160_clone \ - mbedtls_ripemd160_clone_ncbicxx_2_28_3 + mbedtls_ripemd160_clone_ncbicxx_2_28_8 #define mbedtls_ripemd160_finish \ - mbedtls_ripemd160_finish_ncbicxx_2_28_3 + mbedtls_ripemd160_finish_ncbicxx_2_28_8 #define mbedtls_ripemd160_finish_ret \ - mbedtls_ripemd160_finish_ret_ncbicxx_2_28_3 + mbedtls_ripemd160_finish_ret_ncbicxx_2_28_8 #define mbedtls_ripemd160_free \ - mbedtls_ripemd160_free_ncbicxx_2_28_3 + mbedtls_ripemd160_free_ncbicxx_2_28_8 #define mbedtls_ripemd160_init \ - mbedtls_ripemd160_init_ncbicxx_2_28_3 + mbedtls_ripemd160_init_ncbicxx_2_28_8 #define mbedtls_ripemd160_process \ - mbedtls_ripemd160_process_ncbicxx_2_28_3 + mbedtls_ripemd160_process_ncbicxx_2_28_8 #define mbedtls_ripemd160_ret \ - mbedtls_ripemd160_ret_ncbicxx_2_28_3 + mbedtls_ripemd160_ret_ncbicxx_2_28_8 #define mbedtls_ripemd160_starts \ - mbedtls_ripemd160_starts_ncbicxx_2_28_3 + mbedtls_ripemd160_starts_ncbicxx_2_28_8 #define mbedtls_ripemd160_starts_ret \ - mbedtls_ripemd160_starts_ret_ncbicxx_2_28_3 + mbedtls_ripemd160_starts_ret_ncbicxx_2_28_8 #define mbedtls_ripemd160_update \ - mbedtls_ripemd160_update_ncbicxx_2_28_3 + mbedtls_ripemd160_update_ncbicxx_2_28_8 #define mbedtls_ripemd160_update_ret \ - mbedtls_ripemd160_update_ret_ncbicxx_2_28_3 + mbedtls_ripemd160_update_ret_ncbicxx_2_28_8 #define mbedtls_rsa_check_privkey \ - mbedtls_rsa_check_privkey_ncbicxx_2_28_3 + mbedtls_rsa_check_privkey_ncbicxx_2_28_8 #define mbedtls_rsa_check_pub_priv \ - mbedtls_rsa_check_pub_priv_ncbicxx_2_28_3 + mbedtls_rsa_check_pub_priv_ncbicxx_2_28_8 #define mbedtls_rsa_check_pubkey \ - mbedtls_rsa_check_pubkey_ncbicxx_2_28_3 + mbedtls_rsa_check_pubkey_ncbicxx_2_28_8 #define mbedtls_rsa_complete \ - mbedtls_rsa_complete_ncbicxx_2_28_3 + mbedtls_rsa_complete_ncbicxx_2_28_8 #define mbedtls_rsa_copy \ - mbedtls_rsa_copy_ncbicxx_2_28_3 + mbedtls_rsa_copy_ncbicxx_2_28_8 #define mbedtls_rsa_export \ - mbedtls_rsa_export_ncbicxx_2_28_3 + mbedtls_rsa_export_ncbicxx_2_28_8 #define mbedtls_rsa_export_crt \ - mbedtls_rsa_export_crt_ncbicxx_2_28_3 + mbedtls_rsa_export_crt_ncbicxx_2_28_8 #define mbedtls_rsa_export_raw \ - mbedtls_rsa_export_raw_ncbicxx_2_28_3 + mbedtls_rsa_export_raw_ncbicxx_2_28_8 #define mbedtls_rsa_free \ - mbedtls_rsa_free_ncbicxx_2_28_3 + mbedtls_rsa_free_ncbicxx_2_28_8 #define mbedtls_rsa_gen_key \ - mbedtls_rsa_gen_key_ncbicxx_2_28_3 + mbedtls_rsa_gen_key_ncbicxx_2_28_8 #define mbedtls_rsa_get_len \ - mbedtls_rsa_get_len_ncbicxx_2_28_3 + mbedtls_rsa_get_len_ncbicxx_2_28_8 #define mbedtls_rsa_import \ - mbedtls_rsa_import_ncbicxx_2_28_3 + mbedtls_rsa_import_ncbicxx_2_28_8 #define mbedtls_rsa_import_raw \ - mbedtls_rsa_import_raw_ncbicxx_2_28_3 + mbedtls_rsa_import_raw_ncbicxx_2_28_8 #define mbedtls_rsa_init \ - mbedtls_rsa_init_ncbicxx_2_28_3 + mbedtls_rsa_init_ncbicxx_2_28_8 #define mbedtls_rsa_pkcs1_decrypt \ - mbedtls_rsa_pkcs1_decrypt_ncbicxx_2_28_3 + mbedtls_rsa_pkcs1_decrypt_ncbicxx_2_28_8 #define mbedtls_rsa_pkcs1_encrypt \ - mbedtls_rsa_pkcs1_encrypt_ncbicxx_2_28_3 + mbedtls_rsa_pkcs1_encrypt_ncbicxx_2_28_8 #define mbedtls_rsa_pkcs1_sign \ - mbedtls_rsa_pkcs1_sign_ncbicxx_2_28_3 + mbedtls_rsa_pkcs1_sign_ncbicxx_2_28_8 #define mbedtls_rsa_pkcs1_verify \ - mbedtls_rsa_pkcs1_verify_ncbicxx_2_28_3 + mbedtls_rsa_pkcs1_verify_ncbicxx_2_28_8 #define mbedtls_rsa_private \ - mbedtls_rsa_private_ncbicxx_2_28_3 + mbedtls_rsa_private_ncbicxx_2_28_8 #define mbedtls_rsa_public \ - mbedtls_rsa_public_ncbicxx_2_28_3 + mbedtls_rsa_public_ncbicxx_2_28_8 #define mbedtls_rsa_rsaes_oaep_decrypt \ - mbedtls_rsa_rsaes_oaep_decrypt_ncbicxx_2_28_3 + mbedtls_rsa_rsaes_oaep_decrypt_ncbicxx_2_28_8 #define mbedtls_rsa_rsaes_oaep_encrypt \ - mbedtls_rsa_rsaes_oaep_encrypt_ncbicxx_2_28_3 + mbedtls_rsa_rsaes_oaep_encrypt_ncbicxx_2_28_8 #define mbedtls_rsa_rsaes_pkcs1_v15_decrypt \ - mbedtls_rsa_rsaes_pkcs1_v15_decrypt_ncbicxx_2_28_3 + mbedtls_rsa_rsaes_pkcs1_v15_decrypt_ncbicxx_2_28_8 #define mbedtls_rsa_rsaes_pkcs1_v15_encrypt \ - mbedtls_rsa_rsaes_pkcs1_v15_encrypt_ncbicxx_2_28_3 + mbedtls_rsa_rsaes_pkcs1_v15_encrypt_ncbicxx_2_28_8 #define mbedtls_rsa_rsassa_pkcs1_v15_sign \ - mbedtls_rsa_rsassa_pkcs1_v15_sign_ncbicxx_2_28_3 + mbedtls_rsa_rsassa_pkcs1_v15_sign_ncbicxx_2_28_8 #define mbedtls_rsa_rsassa_pkcs1_v15_verify \ - mbedtls_rsa_rsassa_pkcs1_v15_verify_ncbicxx_2_28_3 + mbedtls_rsa_rsassa_pkcs1_v15_verify_ncbicxx_2_28_8 #define mbedtls_rsa_rsassa_pss_sign \ - mbedtls_rsa_rsassa_pss_sign_ncbicxx_2_28_3 + mbedtls_rsa_rsassa_pss_sign_ncbicxx_2_28_8 #define mbedtls_rsa_rsassa_pss_sign_ext \ - mbedtls_rsa_rsassa_pss_sign_ext_ncbicxx_2_28_3 + mbedtls_rsa_rsassa_pss_sign_ext_ncbicxx_2_28_8 #define mbedtls_rsa_rsassa_pss_verify \ - mbedtls_rsa_rsassa_pss_verify_ncbicxx_2_28_3 + mbedtls_rsa_rsassa_pss_verify_ncbicxx_2_28_8 #define mbedtls_rsa_rsassa_pss_verify_ext \ - mbedtls_rsa_rsassa_pss_verify_ext_ncbicxx_2_28_3 + mbedtls_rsa_rsassa_pss_verify_ext_ncbicxx_2_28_8 #define mbedtls_rsa_set_padding \ - mbedtls_rsa_set_padding_ncbicxx_2_28_3 + mbedtls_rsa_set_padding_ncbicxx_2_28_8 #define mbedtls_rsa_deduce_crt \ - mbedtls_rsa_deduce_crt_ncbicxx_2_28_3 + mbedtls_rsa_deduce_crt_ncbicxx_2_28_8 #define mbedtls_rsa_deduce_primes \ - mbedtls_rsa_deduce_primes_ncbicxx_2_28_3 + mbedtls_rsa_deduce_primes_ncbicxx_2_28_8 #define mbedtls_rsa_deduce_private_exponent \ - mbedtls_rsa_deduce_private_exponent_ncbicxx_2_28_3 + mbedtls_rsa_deduce_private_exponent_ncbicxx_2_28_8 #define mbedtls_rsa_validate_crt \ - mbedtls_rsa_validate_crt_ncbicxx_2_28_3 + mbedtls_rsa_validate_crt_ncbicxx_2_28_8 #define mbedtls_rsa_validate_params \ - mbedtls_rsa_validate_params_ncbicxx_2_28_3 + mbedtls_rsa_validate_params_ncbicxx_2_28_8 #define mbedtls_internal_sha1_process \ - mbedtls_internal_sha1_process_ncbicxx_2_28_3 + mbedtls_internal_sha1_process_ncbicxx_2_28_8 #define mbedtls_sha1 \ - mbedtls_sha1_ncbicxx_2_28_3 + mbedtls_sha1_ncbicxx_2_28_8 #define mbedtls_sha1_clone \ - mbedtls_sha1_clone_ncbicxx_2_28_3 + mbedtls_sha1_clone_ncbicxx_2_28_8 #define mbedtls_sha1_finish \ - mbedtls_sha1_finish_ncbicxx_2_28_3 + mbedtls_sha1_finish_ncbicxx_2_28_8 #define mbedtls_sha1_finish_ret \ - mbedtls_sha1_finish_ret_ncbicxx_2_28_3 + mbedtls_sha1_finish_ret_ncbicxx_2_28_8 #define mbedtls_sha1_free \ - mbedtls_sha1_free_ncbicxx_2_28_3 + mbedtls_sha1_free_ncbicxx_2_28_8 #define mbedtls_sha1_init \ - mbedtls_sha1_init_ncbicxx_2_28_3 + mbedtls_sha1_init_ncbicxx_2_28_8 #define mbedtls_sha1_process \ - mbedtls_sha1_process_ncbicxx_2_28_3 + mbedtls_sha1_process_ncbicxx_2_28_8 #define mbedtls_sha1_ret \ - mbedtls_sha1_ret_ncbicxx_2_28_3 + mbedtls_sha1_ret_ncbicxx_2_28_8 #define mbedtls_sha1_starts \ - mbedtls_sha1_starts_ncbicxx_2_28_3 + mbedtls_sha1_starts_ncbicxx_2_28_8 #define mbedtls_sha1_starts_ret \ - mbedtls_sha1_starts_ret_ncbicxx_2_28_3 + mbedtls_sha1_starts_ret_ncbicxx_2_28_8 #define mbedtls_sha1_update \ - mbedtls_sha1_update_ncbicxx_2_28_3 + mbedtls_sha1_update_ncbicxx_2_28_8 #define mbedtls_sha1_update_ret \ - mbedtls_sha1_update_ret_ncbicxx_2_28_3 + mbedtls_sha1_update_ret_ncbicxx_2_28_8 #define mbedtls_internal_sha256_process \ - mbedtls_internal_sha256_process_ncbicxx_2_28_3 + mbedtls_internal_sha256_process_ncbicxx_2_28_8 #define mbedtls_sha256 \ - mbedtls_sha256_ncbicxx_2_28_3 + mbedtls_sha256_ncbicxx_2_28_8 #define mbedtls_sha256_clone \ - mbedtls_sha256_clone_ncbicxx_2_28_3 + mbedtls_sha256_clone_ncbicxx_2_28_8 #define mbedtls_sha256_finish \ - mbedtls_sha256_finish_ncbicxx_2_28_3 + mbedtls_sha256_finish_ncbicxx_2_28_8 #define mbedtls_sha256_finish_ret \ - mbedtls_sha256_finish_ret_ncbicxx_2_28_3 + mbedtls_sha256_finish_ret_ncbicxx_2_28_8 #define mbedtls_sha256_free \ - mbedtls_sha256_free_ncbicxx_2_28_3 + mbedtls_sha256_free_ncbicxx_2_28_8 #define mbedtls_sha256_init \ - mbedtls_sha256_init_ncbicxx_2_28_3 + mbedtls_sha256_init_ncbicxx_2_28_8 #define mbedtls_sha256_process \ - mbedtls_sha256_process_ncbicxx_2_28_3 + mbedtls_sha256_process_ncbicxx_2_28_8 #define mbedtls_sha256_ret \ - mbedtls_sha256_ret_ncbicxx_2_28_3 + mbedtls_sha256_ret_ncbicxx_2_28_8 #define mbedtls_sha256_starts \ - mbedtls_sha256_starts_ncbicxx_2_28_3 + mbedtls_sha256_starts_ncbicxx_2_28_8 #define mbedtls_sha256_starts_ret \ - mbedtls_sha256_starts_ret_ncbicxx_2_28_3 + mbedtls_sha256_starts_ret_ncbicxx_2_28_8 #define mbedtls_sha256_update \ - mbedtls_sha256_update_ncbicxx_2_28_3 + mbedtls_sha256_update_ncbicxx_2_28_8 #define mbedtls_sha256_update_ret \ - mbedtls_sha256_update_ret_ncbicxx_2_28_3 + mbedtls_sha256_update_ret_ncbicxx_2_28_8 #define mbedtls_internal_sha512_process \ - mbedtls_internal_sha512_process_ncbicxx_2_28_3 + mbedtls_internal_sha512_process_ncbicxx_2_28_8 #define mbedtls_sha512 \ - mbedtls_sha512_ncbicxx_2_28_3 + mbedtls_sha512_ncbicxx_2_28_8 #define mbedtls_sha512_clone \ - mbedtls_sha512_clone_ncbicxx_2_28_3 + mbedtls_sha512_clone_ncbicxx_2_28_8 #define mbedtls_sha512_finish \ - mbedtls_sha512_finish_ncbicxx_2_28_3 + mbedtls_sha512_finish_ncbicxx_2_28_8 #define mbedtls_sha512_finish_ret \ - mbedtls_sha512_finish_ret_ncbicxx_2_28_3 + mbedtls_sha512_finish_ret_ncbicxx_2_28_8 #define mbedtls_sha512_free \ - mbedtls_sha512_free_ncbicxx_2_28_3 + mbedtls_sha512_free_ncbicxx_2_28_8 #define mbedtls_sha512_init \ - mbedtls_sha512_init_ncbicxx_2_28_3 + mbedtls_sha512_init_ncbicxx_2_28_8 #define mbedtls_sha512_process \ - mbedtls_sha512_process_ncbicxx_2_28_3 + mbedtls_sha512_process_ncbicxx_2_28_8 #define mbedtls_sha512_ret \ - mbedtls_sha512_ret_ncbicxx_2_28_3 + mbedtls_sha512_ret_ncbicxx_2_28_8 #define mbedtls_sha512_starts \ - mbedtls_sha512_starts_ncbicxx_2_28_3 + mbedtls_sha512_starts_ncbicxx_2_28_8 #define mbedtls_sha512_starts_ret \ - mbedtls_sha512_starts_ret_ncbicxx_2_28_3 + mbedtls_sha512_starts_ret_ncbicxx_2_28_8 #define mbedtls_sha512_update \ - mbedtls_sha512_update_ncbicxx_2_28_3 + mbedtls_sha512_update_ncbicxx_2_28_8 #define mbedtls_sha512_update_ret \ - mbedtls_sha512_update_ret_ncbicxx_2_28_3 + mbedtls_sha512_update_ret_ncbicxx_2_28_8 #define mbedtls_ssl_cache_free \ - mbedtls_ssl_cache_free_ncbicxx_2_28_3 + mbedtls_ssl_cache_free_ncbicxx_2_28_8 #define mbedtls_ssl_cache_get \ - mbedtls_ssl_cache_get_ncbicxx_2_28_3 + mbedtls_ssl_cache_get_ncbicxx_2_28_8 #define mbedtls_ssl_cache_init \ - mbedtls_ssl_cache_init_ncbicxx_2_28_3 + mbedtls_ssl_cache_init_ncbicxx_2_28_8 #define mbedtls_ssl_cache_set \ - mbedtls_ssl_cache_set_ncbicxx_2_28_3 + mbedtls_ssl_cache_set_ncbicxx_2_28_8 #define mbedtls_ssl_cache_set_max_entries \ - mbedtls_ssl_cache_set_max_entries_ncbicxx_2_28_3 + mbedtls_ssl_cache_set_max_entries_ncbicxx_2_28_8 #define mbedtls_ssl_cache_set_timeout \ - mbedtls_ssl_cache_set_timeout_ncbicxx_2_28_3 + mbedtls_ssl_cache_set_timeout_ncbicxx_2_28_8 #define mbedtls_ssl_ciphersuite_from_id \ - mbedtls_ssl_ciphersuite_from_id_ncbicxx_2_28_3 + mbedtls_ssl_ciphersuite_from_id_ncbicxx_2_28_8 #define mbedtls_ssl_ciphersuite_from_string \ - mbedtls_ssl_ciphersuite_from_string_ncbicxx_2_28_3 + mbedtls_ssl_ciphersuite_from_string_ncbicxx_2_28_8 #define mbedtls_ssl_ciphersuite_uses_ec \ - mbedtls_ssl_ciphersuite_uses_ec_ncbicxx_2_28_3 + mbedtls_ssl_ciphersuite_uses_ec_ncbicxx_2_28_8 #define mbedtls_ssl_ciphersuite_uses_psk \ - mbedtls_ssl_ciphersuite_uses_psk_ncbicxx_2_28_3 + mbedtls_ssl_ciphersuite_uses_psk_ncbicxx_2_28_8 #define mbedtls_ssl_get_ciphersuite_id \ - mbedtls_ssl_get_ciphersuite_id_ncbicxx_2_28_3 + mbedtls_ssl_get_ciphersuite_id_ncbicxx_2_28_8 #define mbedtls_ssl_get_ciphersuite_name \ - mbedtls_ssl_get_ciphersuite_name_ncbicxx_2_28_3 + mbedtls_ssl_get_ciphersuite_name_ncbicxx_2_28_8 #define mbedtls_ssl_get_ciphersuite_sig_alg \ - mbedtls_ssl_get_ciphersuite_sig_alg_ncbicxx_2_28_3 + mbedtls_ssl_get_ciphersuite_sig_alg_ncbicxx_2_28_8 #define mbedtls_ssl_get_ciphersuite_sig_pk_alg \ - mbedtls_ssl_get_ciphersuite_sig_pk_alg_ncbicxx_2_28_3 + mbedtls_ssl_get_ciphersuite_sig_pk_alg_ncbicxx_2_28_8 #define mbedtls_ssl_list_ciphersuites \ - mbedtls_ssl_list_ciphersuites_ncbicxx_2_28_3 + mbedtls_ssl_list_ciphersuites_ncbicxx_2_28_8 #define mbedtls_ssl_handshake_client_step \ - mbedtls_ssl_handshake_client_step_ncbicxx_2_28_3 + mbedtls_ssl_handshake_client_step_ncbicxx_2_28_8 #define mbedtls_ssl_cookie_check \ - mbedtls_ssl_cookie_check_ncbicxx_2_28_3 + mbedtls_ssl_cookie_check_ncbicxx_2_28_8 #define mbedtls_ssl_cookie_free \ - mbedtls_ssl_cookie_free_ncbicxx_2_28_3 + mbedtls_ssl_cookie_free_ncbicxx_2_28_8 #define mbedtls_ssl_cookie_init \ - mbedtls_ssl_cookie_init_ncbicxx_2_28_3 + mbedtls_ssl_cookie_init_ncbicxx_2_28_8 #define mbedtls_ssl_cookie_set_timeout \ - mbedtls_ssl_cookie_set_timeout_ncbicxx_2_28_3 + mbedtls_ssl_cookie_set_timeout_ncbicxx_2_28_8 #define mbedtls_ssl_cookie_setup \ - mbedtls_ssl_cookie_setup_ncbicxx_2_28_3 + mbedtls_ssl_cookie_setup_ncbicxx_2_28_8 #define mbedtls_ssl_cookie_write \ - mbedtls_ssl_cookie_write_ncbicxx_2_28_3 + mbedtls_ssl_cookie_write_ncbicxx_2_28_8 #define mbedtls_ssl_buffering_free \ - mbedtls_ssl_buffering_free_ncbicxx_2_28_3 + mbedtls_ssl_buffering_free_ncbicxx_2_28_8 #define mbedtls_ssl_check_pending \ - mbedtls_ssl_check_pending_ncbicxx_2_28_3 + mbedtls_ssl_check_pending_ncbicxx_2_28_8 #define mbedtls_ssl_check_record \ - mbedtls_ssl_check_record_ncbicxx_2_28_3 + mbedtls_ssl_check_record_ncbicxx_2_28_8 #define mbedtls_ssl_check_timer \ - mbedtls_ssl_check_timer_ncbicxx_2_28_3 + mbedtls_ssl_check_timer_ncbicxx_2_28_8 #define mbedtls_ssl_close_notify \ - mbedtls_ssl_close_notify_ncbicxx_2_28_3 + mbedtls_ssl_close_notify_ncbicxx_2_28_8 #define mbedtls_ssl_decrypt_buf \ - mbedtls_ssl_decrypt_buf_ncbicxx_2_28_3 + mbedtls_ssl_decrypt_buf_ncbicxx_2_28_8 #define mbedtls_ssl_dtls_replay_check \ - mbedtls_ssl_dtls_replay_check_ncbicxx_2_28_3 + mbedtls_ssl_dtls_replay_check_ncbicxx_2_28_8 #define mbedtls_ssl_dtls_replay_reset \ - mbedtls_ssl_dtls_replay_reset_ncbicxx_2_28_3 + mbedtls_ssl_dtls_replay_reset_ncbicxx_2_28_8 #define mbedtls_ssl_dtls_replay_update \ - mbedtls_ssl_dtls_replay_update_ncbicxx_2_28_3 + mbedtls_ssl_dtls_replay_update_ncbicxx_2_28_8 #define mbedtls_ssl_encrypt_buf \ - mbedtls_ssl_encrypt_buf_ncbicxx_2_28_3 + mbedtls_ssl_encrypt_buf_ncbicxx_2_28_8 #define mbedtls_ssl_fetch_input \ - mbedtls_ssl_fetch_input_ncbicxx_2_28_3 + mbedtls_ssl_fetch_input_ncbicxx_2_28_8 #define mbedtls_ssl_flight_free \ - mbedtls_ssl_flight_free_ncbicxx_2_28_3 + mbedtls_ssl_flight_free_ncbicxx_2_28_8 #define mbedtls_ssl_flight_transmit \ - mbedtls_ssl_flight_transmit_ncbicxx_2_28_3 + mbedtls_ssl_flight_transmit_ncbicxx_2_28_8 #define mbedtls_ssl_flush_output \ - mbedtls_ssl_flush_output_ncbicxx_2_28_3 + mbedtls_ssl_flush_output_ncbicxx_2_28_8 #define mbedtls_ssl_get_bytes_avail \ - mbedtls_ssl_get_bytes_avail_ncbicxx_2_28_3 + mbedtls_ssl_get_bytes_avail_ncbicxx_2_28_8 #define mbedtls_ssl_get_record_expansion \ - mbedtls_ssl_get_record_expansion_ncbicxx_2_28_3 + mbedtls_ssl_get_record_expansion_ncbicxx_2_28_8 #define mbedtls_ssl_handle_message_type \ - mbedtls_ssl_handle_message_type_ncbicxx_2_28_3 + mbedtls_ssl_handle_message_type_ncbicxx_2_28_8 #define mbedtls_ssl_parse_change_cipher_spec \ - mbedtls_ssl_parse_change_cipher_spec_ncbicxx_2_28_3 + mbedtls_ssl_parse_change_cipher_spec_ncbicxx_2_28_8 #define mbedtls_ssl_prepare_handshake_record \ - mbedtls_ssl_prepare_handshake_record_ncbicxx_2_28_3 + mbedtls_ssl_prepare_handshake_record_ncbicxx_2_28_8 #define mbedtls_ssl_read \ - mbedtls_ssl_read_ncbicxx_2_28_3 + mbedtls_ssl_read_ncbicxx_2_28_8 #define mbedtls_ssl_read_record \ - mbedtls_ssl_read_record_ncbicxx_2_28_3 + mbedtls_ssl_read_record_ncbicxx_2_28_8 #define mbedtls_ssl_read_version \ - mbedtls_ssl_read_version_ncbicxx_2_28_3 + mbedtls_ssl_read_version_ncbicxx_2_28_8 #define mbedtls_ssl_recv_flight_completed \ - mbedtls_ssl_recv_flight_completed_ncbicxx_2_28_3 + mbedtls_ssl_recv_flight_completed_ncbicxx_2_28_8 #define mbedtls_ssl_resend \ - mbedtls_ssl_resend_ncbicxx_2_28_3 + mbedtls_ssl_resend_ncbicxx_2_28_8 #define mbedtls_ssl_reset_in_out_pointers \ - mbedtls_ssl_reset_in_out_pointers_ncbicxx_2_28_3 + mbedtls_ssl_reset_in_out_pointers_ncbicxx_2_28_8 #define mbedtls_ssl_send_alert_message \ - mbedtls_ssl_send_alert_message_ncbicxx_2_28_3 + mbedtls_ssl_send_alert_message_ncbicxx_2_28_8 #define mbedtls_ssl_send_fatal_handshake_failure \ - mbedtls_ssl_send_fatal_handshake_failure_ncbicxx_2_28_3 + mbedtls_ssl_send_fatal_handshake_failure_ncbicxx_2_28_8 #define mbedtls_ssl_send_flight_completed \ - mbedtls_ssl_send_flight_completed_ncbicxx_2_28_3 + mbedtls_ssl_send_flight_completed_ncbicxx_2_28_8 #define mbedtls_ssl_set_timer \ - mbedtls_ssl_set_timer_ncbicxx_2_28_3 + mbedtls_ssl_set_timer_ncbicxx_2_28_8 #define mbedtls_ssl_transform_free \ - mbedtls_ssl_transform_free_ncbicxx_2_28_3 + mbedtls_ssl_transform_free_ncbicxx_2_28_8 #define mbedtls_ssl_update_handshake_status \ - mbedtls_ssl_update_handshake_status_ncbicxx_2_28_3 + mbedtls_ssl_update_handshake_status_ncbicxx_2_28_8 #define mbedtls_ssl_update_in_pointers \ - mbedtls_ssl_update_in_pointers_ncbicxx_2_28_3 + mbedtls_ssl_update_in_pointers_ncbicxx_2_28_8 #define mbedtls_ssl_update_out_pointers \ - mbedtls_ssl_update_out_pointers_ncbicxx_2_28_3 + mbedtls_ssl_update_out_pointers_ncbicxx_2_28_8 #define mbedtls_ssl_write \ - mbedtls_ssl_write_ncbicxx_2_28_3 + mbedtls_ssl_write_ncbicxx_2_28_8 #define mbedtls_ssl_write_change_cipher_spec \ - mbedtls_ssl_write_change_cipher_spec_ncbicxx_2_28_3 + mbedtls_ssl_write_change_cipher_spec_ncbicxx_2_28_8 #define mbedtls_ssl_write_handshake_msg \ - mbedtls_ssl_write_handshake_msg_ncbicxx_2_28_3 + mbedtls_ssl_write_handshake_msg_ncbicxx_2_28_8 #define mbedtls_ssl_write_record \ - mbedtls_ssl_write_record_ncbicxx_2_28_3 + mbedtls_ssl_write_record_ncbicxx_2_28_8 #define mbedtls_ssl_write_version \ - mbedtls_ssl_write_version_ncbicxx_2_28_3 + mbedtls_ssl_write_version_ncbicxx_2_28_8 #define mbedtls_ssl_conf_dtls_cookies \ - mbedtls_ssl_conf_dtls_cookies_ncbicxx_2_28_3 + mbedtls_ssl_conf_dtls_cookies_ncbicxx_2_28_8 #define mbedtls_ssl_handshake_server_step \ - mbedtls_ssl_handshake_server_step_ncbicxx_2_28_3 + mbedtls_ssl_handshake_server_step_ncbicxx_2_28_8 #define mbedtls_ssl_set_client_transport_id \ - mbedtls_ssl_set_client_transport_id_ncbicxx_2_28_3 + mbedtls_ssl_set_client_transport_id_ncbicxx_2_28_8 #define mbedtls_ssl_ticket_free \ - mbedtls_ssl_ticket_free_ncbicxx_2_28_3 + mbedtls_ssl_ticket_free_ncbicxx_2_28_8 #define mbedtls_ssl_ticket_init \ - mbedtls_ssl_ticket_init_ncbicxx_2_28_3 + mbedtls_ssl_ticket_init_ncbicxx_2_28_8 #define mbedtls_ssl_ticket_parse \ - mbedtls_ssl_ticket_parse_ncbicxx_2_28_3 + mbedtls_ssl_ticket_parse_ncbicxx_2_28_8 #define mbedtls_ssl_ticket_setup \ - mbedtls_ssl_ticket_setup_ncbicxx_2_28_3 + mbedtls_ssl_ticket_setup_ncbicxx_2_28_8 #define mbedtls_ssl_ticket_write \ - mbedtls_ssl_ticket_write_ncbicxx_2_28_3 + mbedtls_ssl_ticket_write_ncbicxx_2_28_8 #define mbedtls_ssl_check_cert_usage \ - mbedtls_ssl_check_cert_usage_ncbicxx_2_28_3 + mbedtls_ssl_check_cert_usage_ncbicxx_2_28_8 #define mbedtls_ssl_check_curve \ - mbedtls_ssl_check_curve_ncbicxx_2_28_3 + mbedtls_ssl_check_curve_ncbicxx_2_28_8 #define mbedtls_ssl_check_curve_tls_id \ - mbedtls_ssl_check_curve_tls_id_ncbicxx_2_28_3 + mbedtls_ssl_check_curve_tls_id_ncbicxx_2_28_8 #define mbedtls_ssl_check_sig_hash \ - mbedtls_ssl_check_sig_hash_ncbicxx_2_28_3 + mbedtls_ssl_check_sig_hash_ncbicxx_2_28_8 #define mbedtls_ssl_conf_alpn_protocols \ - mbedtls_ssl_conf_alpn_protocols_ncbicxx_2_28_3 + mbedtls_ssl_conf_alpn_protocols_ncbicxx_2_28_8 #define mbedtls_ssl_conf_arc4_support \ - mbedtls_ssl_conf_arc4_support_ncbicxx_2_28_3 + mbedtls_ssl_conf_arc4_support_ncbicxx_2_28_8 #define mbedtls_ssl_conf_authmode \ - mbedtls_ssl_conf_authmode_ncbicxx_2_28_3 + mbedtls_ssl_conf_authmode_ncbicxx_2_28_8 #define mbedtls_ssl_conf_ca_chain \ - mbedtls_ssl_conf_ca_chain_ncbicxx_2_28_3 + mbedtls_ssl_conf_ca_chain_ncbicxx_2_28_8 #define mbedtls_ssl_conf_cert_profile \ - mbedtls_ssl_conf_cert_profile_ncbicxx_2_28_3 + mbedtls_ssl_conf_cert_profile_ncbicxx_2_28_8 #define mbedtls_ssl_conf_cert_req_ca_list \ - mbedtls_ssl_conf_cert_req_ca_list_ncbicxx_2_28_3 + mbedtls_ssl_conf_cert_req_ca_list_ncbicxx_2_28_8 #define mbedtls_ssl_conf_ciphersuites \ - mbedtls_ssl_conf_ciphersuites_ncbicxx_2_28_3 + mbedtls_ssl_conf_ciphersuites_ncbicxx_2_28_8 #define mbedtls_ssl_conf_ciphersuites_for_version \ - mbedtls_ssl_conf_ciphersuites_for_version_ncbicxx_2_28_3 + mbedtls_ssl_conf_ciphersuites_for_version_ncbicxx_2_28_8 #define mbedtls_ssl_conf_curves \ - mbedtls_ssl_conf_curves_ncbicxx_2_28_3 + mbedtls_ssl_conf_curves_ncbicxx_2_28_8 #define mbedtls_ssl_conf_dbg \ - mbedtls_ssl_conf_dbg_ncbicxx_2_28_3 + mbedtls_ssl_conf_dbg_ncbicxx_2_28_8 #define mbedtls_ssl_conf_dh_param \ - mbedtls_ssl_conf_dh_param_ncbicxx_2_28_3 + mbedtls_ssl_conf_dh_param_ncbicxx_2_28_8 #define mbedtls_ssl_conf_dh_param_bin \ - mbedtls_ssl_conf_dh_param_bin_ncbicxx_2_28_3 + mbedtls_ssl_conf_dh_param_bin_ncbicxx_2_28_8 #define mbedtls_ssl_conf_dh_param_ctx \ - mbedtls_ssl_conf_dh_param_ctx_ncbicxx_2_28_3 + mbedtls_ssl_conf_dh_param_ctx_ncbicxx_2_28_8 #define mbedtls_ssl_conf_dhm_min_bitlen \ - mbedtls_ssl_conf_dhm_min_bitlen_ncbicxx_2_28_3 + mbedtls_ssl_conf_dhm_min_bitlen_ncbicxx_2_28_8 #define mbedtls_ssl_conf_dtls_anti_replay \ - mbedtls_ssl_conf_dtls_anti_replay_ncbicxx_2_28_3 + mbedtls_ssl_conf_dtls_anti_replay_ncbicxx_2_28_8 #define mbedtls_ssl_conf_dtls_badmac_limit \ - mbedtls_ssl_conf_dtls_badmac_limit_ncbicxx_2_28_3 + mbedtls_ssl_conf_dtls_badmac_limit_ncbicxx_2_28_8 #define mbedtls_ssl_conf_encrypt_then_mac \ - mbedtls_ssl_conf_encrypt_then_mac_ncbicxx_2_28_3 + mbedtls_ssl_conf_encrypt_then_mac_ncbicxx_2_28_8 #define mbedtls_ssl_conf_endpoint \ - mbedtls_ssl_conf_endpoint_ncbicxx_2_28_3 + mbedtls_ssl_conf_endpoint_ncbicxx_2_28_8 #define mbedtls_ssl_conf_export_keys_cb \ - mbedtls_ssl_conf_export_keys_cb_ncbicxx_2_28_3 + mbedtls_ssl_conf_export_keys_cb_ncbicxx_2_28_8 #define mbedtls_ssl_conf_export_keys_ext_cb \ - mbedtls_ssl_conf_export_keys_ext_cb_ncbicxx_2_28_3 + mbedtls_ssl_conf_export_keys_ext_cb_ncbicxx_2_28_8 #define mbedtls_ssl_conf_extended_master_secret \ - mbedtls_ssl_conf_extended_master_secret_ncbicxx_2_28_3 + mbedtls_ssl_conf_extended_master_secret_ncbicxx_2_28_8 #define mbedtls_ssl_conf_fallback \ - mbedtls_ssl_conf_fallback_ncbicxx_2_28_3 + mbedtls_ssl_conf_fallback_ncbicxx_2_28_8 #define mbedtls_ssl_conf_handshake_timeout \ - mbedtls_ssl_conf_handshake_timeout_ncbicxx_2_28_3 + mbedtls_ssl_conf_handshake_timeout_ncbicxx_2_28_8 #define mbedtls_ssl_conf_legacy_renegotiation \ - mbedtls_ssl_conf_legacy_renegotiation_ncbicxx_2_28_3 + mbedtls_ssl_conf_legacy_renegotiation_ncbicxx_2_28_8 #define mbedtls_ssl_conf_max_frag_len \ - mbedtls_ssl_conf_max_frag_len_ncbicxx_2_28_3 + mbedtls_ssl_conf_max_frag_len_ncbicxx_2_28_8 #define mbedtls_ssl_conf_max_version \ - mbedtls_ssl_conf_max_version_ncbicxx_2_28_3 + mbedtls_ssl_conf_max_version_ncbicxx_2_28_8 #define mbedtls_ssl_conf_min_version \ - mbedtls_ssl_conf_min_version_ncbicxx_2_28_3 + mbedtls_ssl_conf_min_version_ncbicxx_2_28_8 #define mbedtls_ssl_conf_own_cert \ - mbedtls_ssl_conf_own_cert_ncbicxx_2_28_3 + mbedtls_ssl_conf_own_cert_ncbicxx_2_28_8 #define mbedtls_ssl_conf_psk \ - mbedtls_ssl_conf_psk_ncbicxx_2_28_3 + mbedtls_ssl_conf_psk_ncbicxx_2_28_8 #define mbedtls_ssl_conf_psk_cb \ - mbedtls_ssl_conf_psk_cb_ncbicxx_2_28_3 + mbedtls_ssl_conf_psk_cb_ncbicxx_2_28_8 #define mbedtls_ssl_conf_read_timeout \ - mbedtls_ssl_conf_read_timeout_ncbicxx_2_28_3 + mbedtls_ssl_conf_read_timeout_ncbicxx_2_28_8 #define mbedtls_ssl_conf_renegotiation \ - mbedtls_ssl_conf_renegotiation_ncbicxx_2_28_3 + mbedtls_ssl_conf_renegotiation_ncbicxx_2_28_8 #define mbedtls_ssl_conf_renegotiation_enforced \ - mbedtls_ssl_conf_renegotiation_enforced_ncbicxx_2_28_3 + mbedtls_ssl_conf_renegotiation_enforced_ncbicxx_2_28_8 #define mbedtls_ssl_conf_renegotiation_period \ - mbedtls_ssl_conf_renegotiation_period_ncbicxx_2_28_3 + mbedtls_ssl_conf_renegotiation_period_ncbicxx_2_28_8 #define mbedtls_ssl_conf_rng \ - mbedtls_ssl_conf_rng_ncbicxx_2_28_3 + mbedtls_ssl_conf_rng_ncbicxx_2_28_8 #define mbedtls_ssl_conf_session_cache \ - mbedtls_ssl_conf_session_cache_ncbicxx_2_28_3 + mbedtls_ssl_conf_session_cache_ncbicxx_2_28_8 #define mbedtls_ssl_conf_session_tickets \ - mbedtls_ssl_conf_session_tickets_ncbicxx_2_28_3 + mbedtls_ssl_conf_session_tickets_ncbicxx_2_28_8 #define mbedtls_ssl_conf_session_tickets_cb \ - mbedtls_ssl_conf_session_tickets_cb_ncbicxx_2_28_3 + mbedtls_ssl_conf_session_tickets_cb_ncbicxx_2_28_8 #define mbedtls_ssl_conf_sig_hashes \ - mbedtls_ssl_conf_sig_hashes_ncbicxx_2_28_3 + mbedtls_ssl_conf_sig_hashes_ncbicxx_2_28_8 #define mbedtls_ssl_conf_sni \ - mbedtls_ssl_conf_sni_ncbicxx_2_28_3 + mbedtls_ssl_conf_sni_ncbicxx_2_28_8 #define mbedtls_ssl_conf_transport \ - mbedtls_ssl_conf_transport_ncbicxx_2_28_3 + mbedtls_ssl_conf_transport_ncbicxx_2_28_8 #define mbedtls_ssl_conf_truncated_hmac \ - mbedtls_ssl_conf_truncated_hmac_ncbicxx_2_28_3 + mbedtls_ssl_conf_truncated_hmac_ncbicxx_2_28_8 #define mbedtls_ssl_conf_verify \ - mbedtls_ssl_conf_verify_ncbicxx_2_28_3 + mbedtls_ssl_conf_verify_ncbicxx_2_28_8 #define mbedtls_ssl_config_defaults \ - mbedtls_ssl_config_defaults_ncbicxx_2_28_3 + mbedtls_ssl_config_defaults_ncbicxx_2_28_8 #define mbedtls_ssl_config_free \ - mbedtls_ssl_config_free_ncbicxx_2_28_3 + mbedtls_ssl_config_free_ncbicxx_2_28_8 #define mbedtls_ssl_config_init \ - mbedtls_ssl_config_init_ncbicxx_2_28_3 + mbedtls_ssl_config_init_ncbicxx_2_28_8 #define mbedtls_ssl_context_load \ - mbedtls_ssl_context_load_ncbicxx_2_28_3 + mbedtls_ssl_context_load_ncbicxx_2_28_8 #define mbedtls_ssl_context_save \ - mbedtls_ssl_context_save_ncbicxx_2_28_3 + mbedtls_ssl_context_save_ncbicxx_2_28_8 #define mbedtls_ssl_derive_keys \ - mbedtls_ssl_derive_keys_ncbicxx_2_28_3 + mbedtls_ssl_derive_keys_ncbicxx_2_28_8 #define mbedtls_ssl_free \ - mbedtls_ssl_free_ncbicxx_2_28_3 + mbedtls_ssl_free_ncbicxx_2_28_8 #define mbedtls_ssl_get_alpn_protocol \ - mbedtls_ssl_get_alpn_protocol_ncbicxx_2_28_3 + mbedtls_ssl_get_alpn_protocol_ncbicxx_2_28_8 #define mbedtls_ssl_get_ciphersuite \ - mbedtls_ssl_get_ciphersuite_ncbicxx_2_28_3 + mbedtls_ssl_get_ciphersuite_ncbicxx_2_28_8 #define mbedtls_ssl_get_current_mtu \ - mbedtls_ssl_get_current_mtu_ncbicxx_2_28_3 + mbedtls_ssl_get_current_mtu_ncbicxx_2_28_8 #define mbedtls_ssl_get_input_max_frag_len \ - mbedtls_ssl_get_input_max_frag_len_ncbicxx_2_28_3 + mbedtls_ssl_get_input_max_frag_len_ncbicxx_2_28_8 #define mbedtls_ssl_get_key_exchange_md_ssl_tls \ - mbedtls_ssl_get_key_exchange_md_ssl_tls_ncbicxx_2_28_3 + mbedtls_ssl_get_key_exchange_md_ssl_tls_ncbicxx_2_28_8 #define mbedtls_ssl_get_key_exchange_md_tls1_2 \ - mbedtls_ssl_get_key_exchange_md_tls1_2_ncbicxx_2_28_3 + mbedtls_ssl_get_key_exchange_md_tls1_2_ncbicxx_2_28_8 #define mbedtls_ssl_get_max_frag_len \ - mbedtls_ssl_get_max_frag_len_ncbicxx_2_28_3 + mbedtls_ssl_get_max_frag_len_ncbicxx_2_28_8 #define mbedtls_ssl_get_max_out_record_payload \ - mbedtls_ssl_get_max_out_record_payload_ncbicxx_2_28_3 + mbedtls_ssl_get_max_out_record_payload_ncbicxx_2_28_8 #define mbedtls_ssl_get_output_max_frag_len \ - mbedtls_ssl_get_output_max_frag_len_ncbicxx_2_28_3 + mbedtls_ssl_get_output_max_frag_len_ncbicxx_2_28_8 #define mbedtls_ssl_get_peer_cert \ - mbedtls_ssl_get_peer_cert_ncbicxx_2_28_3 + mbedtls_ssl_get_peer_cert_ncbicxx_2_28_8 #define mbedtls_ssl_get_session \ - mbedtls_ssl_get_session_ncbicxx_2_28_3 + mbedtls_ssl_get_session_ncbicxx_2_28_8 #define mbedtls_ssl_get_session_pointer \ - mbedtls_ssl_get_session_pointer_ncbicxx_2_28_3 + mbedtls_ssl_get_session_pointer_ncbicxx_2_28_8 #define mbedtls_ssl_get_verify_result \ - mbedtls_ssl_get_verify_result_ncbicxx_2_28_3 + mbedtls_ssl_get_verify_result_ncbicxx_2_28_8 #define mbedtls_ssl_get_version \ - mbedtls_ssl_get_version_ncbicxx_2_28_3 + mbedtls_ssl_get_version_ncbicxx_2_28_8 #define mbedtls_ssl_handshake \ - mbedtls_ssl_handshake_ncbicxx_2_28_3 + mbedtls_ssl_handshake_ncbicxx_2_28_8 #define mbedtls_ssl_handshake_free \ - mbedtls_ssl_handshake_free_ncbicxx_2_28_3 + mbedtls_ssl_handshake_free_ncbicxx_2_28_8 #define mbedtls_ssl_handshake_step \ - mbedtls_ssl_handshake_step_ncbicxx_2_28_3 + mbedtls_ssl_handshake_step_ncbicxx_2_28_8 #define mbedtls_ssl_handshake_wrapup \ - mbedtls_ssl_handshake_wrapup_ncbicxx_2_28_3 + mbedtls_ssl_handshake_wrapup_ncbicxx_2_28_8 #define mbedtls_ssl_handshake_wrapup_free_hs_transform \ - mbedtls_ssl_handshake_wrapup_free_hs_transform_ncbicxx_2_28_3 + mbedtls_ssl_handshake_wrapup_free_hs_transform_ncbicxx_2_28_8 #define mbedtls_ssl_hash_from_md_alg \ - mbedtls_ssl_hash_from_md_alg_ncbicxx_2_28_3 + mbedtls_ssl_hash_from_md_alg_ncbicxx_2_28_8 #define mbedtls_ssl_init \ - mbedtls_ssl_init_ncbicxx_2_28_3 + mbedtls_ssl_init_ncbicxx_2_28_8 #define mbedtls_ssl_md_alg_from_hash \ - mbedtls_ssl_md_alg_from_hash_ncbicxx_2_28_3 + mbedtls_ssl_md_alg_from_hash_ncbicxx_2_28_8 #define mbedtls_ssl_optimize_checksum \ - mbedtls_ssl_optimize_checksum_ncbicxx_2_28_3 + mbedtls_ssl_optimize_checksum_ncbicxx_2_28_8 #define mbedtls_ssl_parse_certificate \ - mbedtls_ssl_parse_certificate_ncbicxx_2_28_3 + mbedtls_ssl_parse_certificate_ncbicxx_2_28_8 #define mbedtls_ssl_parse_finished \ - mbedtls_ssl_parse_finished_ncbicxx_2_28_3 + mbedtls_ssl_parse_finished_ncbicxx_2_28_8 #define mbedtls_ssl_pk_alg_from_sig \ - mbedtls_ssl_pk_alg_from_sig_ncbicxx_2_28_3 + mbedtls_ssl_pk_alg_from_sig_ncbicxx_2_28_8 #define mbedtls_ssl_psk_derive_premaster \ - mbedtls_ssl_psk_derive_premaster_ncbicxx_2_28_3 + mbedtls_ssl_psk_derive_premaster_ncbicxx_2_28_8 #define mbedtls_ssl_renegotiate \ - mbedtls_ssl_renegotiate_ncbicxx_2_28_3 + mbedtls_ssl_renegotiate_ncbicxx_2_28_8 #define mbedtls_ssl_resend_hello_request \ - mbedtls_ssl_resend_hello_request_ncbicxx_2_28_3 + mbedtls_ssl_resend_hello_request_ncbicxx_2_28_8 #define mbedtls_ssl_reset_checksum \ - mbedtls_ssl_reset_checksum_ncbicxx_2_28_3 + mbedtls_ssl_reset_checksum_ncbicxx_2_28_8 #define mbedtls_ssl_session_copy \ - mbedtls_ssl_session_copy_ncbicxx_2_28_3 + mbedtls_ssl_session_copy_ncbicxx_2_28_8 #define mbedtls_ssl_session_free \ - mbedtls_ssl_session_free_ncbicxx_2_28_3 + mbedtls_ssl_session_free_ncbicxx_2_28_8 #define mbedtls_ssl_session_init \ - mbedtls_ssl_session_init_ncbicxx_2_28_3 + mbedtls_ssl_session_init_ncbicxx_2_28_8 #define mbedtls_ssl_session_load \ - mbedtls_ssl_session_load_ncbicxx_2_28_3 + mbedtls_ssl_session_load_ncbicxx_2_28_8 #define mbedtls_ssl_session_reset \ - mbedtls_ssl_session_reset_ncbicxx_2_28_3 + mbedtls_ssl_session_reset_ncbicxx_2_28_8 #define mbedtls_ssl_session_reset_int \ - mbedtls_ssl_session_reset_int_ncbicxx_2_28_3 + mbedtls_ssl_session_reset_int_ncbicxx_2_28_8 #define mbedtls_ssl_session_save \ - mbedtls_ssl_session_save_ncbicxx_2_28_3 + mbedtls_ssl_session_save_ncbicxx_2_28_8 #define mbedtls_ssl_set_bio \ - mbedtls_ssl_set_bio_ncbicxx_2_28_3 + mbedtls_ssl_set_bio_ncbicxx_2_28_8 #define mbedtls_ssl_set_calc_verify_md \ - mbedtls_ssl_set_calc_verify_md_ncbicxx_2_28_3 + mbedtls_ssl_set_calc_verify_md_ncbicxx_2_28_8 #define mbedtls_ssl_set_datagram_packing \ - mbedtls_ssl_set_datagram_packing_ncbicxx_2_28_3 + mbedtls_ssl_set_datagram_packing_ncbicxx_2_28_8 #define mbedtls_ssl_set_hostname \ - mbedtls_ssl_set_hostname_ncbicxx_2_28_3 + mbedtls_ssl_set_hostname_ncbicxx_2_28_8 #define mbedtls_ssl_set_hs_authmode \ - mbedtls_ssl_set_hs_authmode_ncbicxx_2_28_3 + mbedtls_ssl_set_hs_authmode_ncbicxx_2_28_8 #define mbedtls_ssl_set_hs_ca_chain \ - mbedtls_ssl_set_hs_ca_chain_ncbicxx_2_28_3 + mbedtls_ssl_set_hs_ca_chain_ncbicxx_2_28_8 #define mbedtls_ssl_set_hs_own_cert \ - mbedtls_ssl_set_hs_own_cert_ncbicxx_2_28_3 + mbedtls_ssl_set_hs_own_cert_ncbicxx_2_28_8 #define mbedtls_ssl_set_hs_psk \ - mbedtls_ssl_set_hs_psk_ncbicxx_2_28_3 + mbedtls_ssl_set_hs_psk_ncbicxx_2_28_8 #define mbedtls_ssl_set_mtu \ - mbedtls_ssl_set_mtu_ncbicxx_2_28_3 + mbedtls_ssl_set_mtu_ncbicxx_2_28_8 #define mbedtls_ssl_set_session \ - mbedtls_ssl_set_session_ncbicxx_2_28_3 + mbedtls_ssl_set_session_ncbicxx_2_28_8 #define mbedtls_ssl_set_timer_cb \ - mbedtls_ssl_set_timer_cb_ncbicxx_2_28_3 + mbedtls_ssl_set_timer_cb_ncbicxx_2_28_8 #define mbedtls_ssl_set_verify \ - mbedtls_ssl_set_verify_ncbicxx_2_28_3 + mbedtls_ssl_set_verify_ncbicxx_2_28_8 #define mbedtls_ssl_setup \ - mbedtls_ssl_setup_ncbicxx_2_28_3 + mbedtls_ssl_setup_ncbicxx_2_28_8 #define mbedtls_ssl_sig_from_pk \ - mbedtls_ssl_sig_from_pk_ncbicxx_2_28_3 + mbedtls_ssl_sig_from_pk_ncbicxx_2_28_8 #define mbedtls_ssl_sig_from_pk_alg \ - mbedtls_ssl_sig_from_pk_alg_ncbicxx_2_28_3 + mbedtls_ssl_sig_from_pk_alg_ncbicxx_2_28_8 #define mbedtls_ssl_sig_hash_set_add \ - mbedtls_ssl_sig_hash_set_add_ncbicxx_2_28_3 + mbedtls_ssl_sig_hash_set_add_ncbicxx_2_28_8 #define mbedtls_ssl_sig_hash_set_const_hash \ - mbedtls_ssl_sig_hash_set_const_hash_ncbicxx_2_28_3 + mbedtls_ssl_sig_hash_set_const_hash_ncbicxx_2_28_8 #define mbedtls_ssl_sig_hash_set_find \ - mbedtls_ssl_sig_hash_set_find_ncbicxx_2_28_3 + mbedtls_ssl_sig_hash_set_find_ncbicxx_2_28_8 #define mbedtls_ssl_start_renegotiation \ - mbedtls_ssl_start_renegotiation_ncbicxx_2_28_3 + mbedtls_ssl_start_renegotiation_ncbicxx_2_28_8 #define mbedtls_ssl_tls_prf \ - mbedtls_ssl_tls_prf_ncbicxx_2_28_3 + mbedtls_ssl_tls_prf_ncbicxx_2_28_8 #define mbedtls_ssl_transform_init \ - mbedtls_ssl_transform_init_ncbicxx_2_28_3 + mbedtls_ssl_transform_init_ncbicxx_2_28_8 #define mbedtls_ssl_write_certificate \ - mbedtls_ssl_write_certificate_ncbicxx_2_28_3 + mbedtls_ssl_write_certificate_ncbicxx_2_28_8 #define mbedtls_ssl_write_finished \ - mbedtls_ssl_write_finished_ncbicxx_2_28_3 + mbedtls_ssl_write_finished_ncbicxx_2_28_8 #define mbedtls_mutex_free \ - mbedtls_mutex_free_ncbicxx_2_28_3 + mbedtls_mutex_free_ncbicxx_2_28_8 #define mbedtls_mutex_init \ - mbedtls_mutex_init_ncbicxx_2_28_3 + mbedtls_mutex_init_ncbicxx_2_28_8 #define mbedtls_mutex_lock \ - mbedtls_mutex_lock_ncbicxx_2_28_3 + mbedtls_mutex_lock_ncbicxx_2_28_8 #define mbedtls_mutex_unlock \ - mbedtls_mutex_unlock_ncbicxx_2_28_3 + mbedtls_mutex_unlock_ncbicxx_2_28_8 #define mbedtls_threading_free_alt \ - mbedtls_threading_free_alt_ncbicxx_2_28_3 + mbedtls_threading_free_alt_ncbicxx_2_28_8 #define mbedtls_threading_readdir_mutex \ - mbedtls_threading_readdir_mutex_ncbicxx_2_28_3 + mbedtls_threading_readdir_mutex_ncbicxx_2_28_8 #define mbedtls_threading_set_alt \ - mbedtls_threading_set_alt_ncbicxx_2_28_3 + mbedtls_threading_set_alt_ncbicxx_2_28_8 #define mbedtls_set_alarm \ - mbedtls_set_alarm_ncbicxx_2_28_3 + mbedtls_set_alarm_ncbicxx_2_28_8 #define mbedtls_timing_alarmed \ - mbedtls_timing_alarmed_ncbicxx_2_28_3 + mbedtls_timing_alarmed_ncbicxx_2_28_8 #define mbedtls_timing_get_delay \ - mbedtls_timing_get_delay_ncbicxx_2_28_3 + mbedtls_timing_get_delay_ncbicxx_2_28_8 #define mbedtls_timing_get_timer \ - mbedtls_timing_get_timer_ncbicxx_2_28_3 + mbedtls_timing_get_timer_ncbicxx_2_28_8 #define mbedtls_timing_hardclock \ - mbedtls_timing_hardclock_ncbicxx_2_28_3 + mbedtls_timing_hardclock_ncbicxx_2_28_8 #define mbedtls_timing_set_delay \ - mbedtls_timing_set_delay_ncbicxx_2_28_3 + mbedtls_timing_set_delay_ncbicxx_2_28_8 #define mbedtls_version_get_number \ - mbedtls_version_get_number_ncbicxx_2_28_3 + mbedtls_version_get_number_ncbicxx_2_28_8 #define mbedtls_version_get_string \ - mbedtls_version_get_string_ncbicxx_2_28_3 + mbedtls_version_get_string_ncbicxx_2_28_8 #define mbedtls_version_get_string_full \ - mbedtls_version_get_string_full_ncbicxx_2_28_3 + mbedtls_version_get_string_full_ncbicxx_2_28_8 #define mbedtls_version_check_feature \ - mbedtls_version_check_feature_ncbicxx_2_28_3 + mbedtls_version_check_feature_ncbicxx_2_28_8 #define mbedtls_x509_dn_gets \ - mbedtls_x509_dn_gets_ncbicxx_2_28_3 + mbedtls_x509_dn_gets_ncbicxx_2_28_8 #define mbedtls_x509_get_alg \ - mbedtls_x509_get_alg_ncbicxx_2_28_3 + mbedtls_x509_get_alg_ncbicxx_2_28_8 #define mbedtls_x509_get_alg_null \ - mbedtls_x509_get_alg_null_ncbicxx_2_28_3 + mbedtls_x509_get_alg_null_ncbicxx_2_28_8 #define mbedtls_x509_get_ext \ - mbedtls_x509_get_ext_ncbicxx_2_28_3 + mbedtls_x509_get_ext_ncbicxx_2_28_8 #define mbedtls_x509_get_name \ - mbedtls_x509_get_name_ncbicxx_2_28_3 + mbedtls_x509_get_name_ncbicxx_2_28_8 #define mbedtls_x509_get_rsassa_pss_params \ - mbedtls_x509_get_rsassa_pss_params_ncbicxx_2_28_3 + mbedtls_x509_get_rsassa_pss_params_ncbicxx_2_28_8 #define mbedtls_x509_get_serial \ - mbedtls_x509_get_serial_ncbicxx_2_28_3 + mbedtls_x509_get_serial_ncbicxx_2_28_8 #define mbedtls_x509_get_sig \ - mbedtls_x509_get_sig_ncbicxx_2_28_3 + mbedtls_x509_get_sig_ncbicxx_2_28_8 #define mbedtls_x509_get_sig_alg \ - mbedtls_x509_get_sig_alg_ncbicxx_2_28_3 + mbedtls_x509_get_sig_alg_ncbicxx_2_28_8 #define mbedtls_x509_get_time \ - mbedtls_x509_get_time_ncbicxx_2_28_3 + mbedtls_x509_get_time_ncbicxx_2_28_8 #define mbedtls_x509_key_size_helper \ - mbedtls_x509_key_size_helper_ncbicxx_2_28_3 + mbedtls_x509_key_size_helper_ncbicxx_2_28_8 #define mbedtls_x509_serial_gets \ - mbedtls_x509_serial_gets_ncbicxx_2_28_3 + mbedtls_x509_serial_gets_ncbicxx_2_28_8 #define mbedtls_x509_sig_alg_gets \ - mbedtls_x509_sig_alg_gets_ncbicxx_2_28_3 + mbedtls_x509_sig_alg_gets_ncbicxx_2_28_8 #define mbedtls_x509_time_is_future \ - mbedtls_x509_time_is_future_ncbicxx_2_28_3 + mbedtls_x509_time_is_future_ncbicxx_2_28_8 #define mbedtls_x509_time_is_past \ - mbedtls_x509_time_is_past_ncbicxx_2_28_3 + mbedtls_x509_time_is_past_ncbicxx_2_28_8 #define mbedtls_x509_set_extension \ - mbedtls_x509_set_extension_ncbicxx_2_28_3 + mbedtls_x509_set_extension_ncbicxx_2_28_8 #define mbedtls_x509_string_to_names \ - mbedtls_x509_string_to_names_ncbicxx_2_28_3 + mbedtls_x509_string_to_names_ncbicxx_2_28_8 #define mbedtls_x509_write_extensions \ - mbedtls_x509_write_extensions_ncbicxx_2_28_3 + mbedtls_x509_write_extensions_ncbicxx_2_28_8 #define mbedtls_x509_write_names \ - mbedtls_x509_write_names_ncbicxx_2_28_3 + mbedtls_x509_write_names_ncbicxx_2_28_8 #define mbedtls_x509_write_sig \ - mbedtls_x509_write_sig_ncbicxx_2_28_3 + mbedtls_x509_write_sig_ncbicxx_2_28_8 #define mbedtls_x509_crl_free \ - mbedtls_x509_crl_free_ncbicxx_2_28_3 + mbedtls_x509_crl_free_ncbicxx_2_28_8 #define mbedtls_x509_crl_info \ - mbedtls_x509_crl_info_ncbicxx_2_28_3 + mbedtls_x509_crl_info_ncbicxx_2_28_8 #define mbedtls_x509_crl_init \ - mbedtls_x509_crl_init_ncbicxx_2_28_3 + mbedtls_x509_crl_init_ncbicxx_2_28_8 #define mbedtls_x509_crl_parse \ - mbedtls_x509_crl_parse_ncbicxx_2_28_3 + mbedtls_x509_crl_parse_ncbicxx_2_28_8 #define mbedtls_x509_crl_parse_der \ - mbedtls_x509_crl_parse_der_ncbicxx_2_28_3 + mbedtls_x509_crl_parse_der_ncbicxx_2_28_8 #define mbedtls_x509_crl_parse_file \ - mbedtls_x509_crl_parse_file_ncbicxx_2_28_3 + mbedtls_x509_crl_parse_file_ncbicxx_2_28_8 #define mbedtls_x509_crt_check_extended_key_usage \ - mbedtls_x509_crt_check_extended_key_usage_ncbicxx_2_28_3 + mbedtls_x509_crt_check_extended_key_usage_ncbicxx_2_28_8 #define mbedtls_x509_crt_check_key_usage \ - mbedtls_x509_crt_check_key_usage_ncbicxx_2_28_3 + mbedtls_x509_crt_check_key_usage_ncbicxx_2_28_8 #define mbedtls_x509_crt_free \ - mbedtls_x509_crt_free_ncbicxx_2_28_3 + mbedtls_x509_crt_free_ncbicxx_2_28_8 #define mbedtls_x509_crt_info \ - mbedtls_x509_crt_info_ncbicxx_2_28_3 + mbedtls_x509_crt_info_ncbicxx_2_28_8 #define mbedtls_x509_crt_init \ - mbedtls_x509_crt_init_ncbicxx_2_28_3 + mbedtls_x509_crt_init_ncbicxx_2_28_8 #define mbedtls_x509_crt_is_revoked \ - mbedtls_x509_crt_is_revoked_ncbicxx_2_28_3 + mbedtls_x509_crt_is_revoked_ncbicxx_2_28_8 #define mbedtls_x509_crt_parse \ - mbedtls_x509_crt_parse_ncbicxx_2_28_3 + mbedtls_x509_crt_parse_ncbicxx_2_28_8 #define mbedtls_x509_crt_parse_der \ - mbedtls_x509_crt_parse_der_ncbicxx_2_28_3 + mbedtls_x509_crt_parse_der_ncbicxx_2_28_8 #define mbedtls_x509_crt_parse_der_nocopy \ - mbedtls_x509_crt_parse_der_nocopy_ncbicxx_2_28_3 + mbedtls_x509_crt_parse_der_nocopy_ncbicxx_2_28_8 #define mbedtls_x509_crt_parse_der_with_ext_cb \ - mbedtls_x509_crt_parse_der_with_ext_cb_ncbicxx_2_28_3 + mbedtls_x509_crt_parse_der_with_ext_cb_ncbicxx_2_28_8 #define mbedtls_x509_crt_parse_file \ - mbedtls_x509_crt_parse_file_ncbicxx_2_28_3 + mbedtls_x509_crt_parse_file_ncbicxx_2_28_8 #define mbedtls_x509_crt_parse_path \ - mbedtls_x509_crt_parse_path_ncbicxx_2_28_3 + mbedtls_x509_crt_parse_path_ncbicxx_2_28_8 #define mbedtls_x509_crt_profile_default \ - mbedtls_x509_crt_profile_default_ncbicxx_2_28_3 + mbedtls_x509_crt_profile_default_ncbicxx_2_28_8 #define mbedtls_x509_crt_profile_next \ - mbedtls_x509_crt_profile_next_ncbicxx_2_28_3 + mbedtls_x509_crt_profile_next_ncbicxx_2_28_8 #define mbedtls_x509_crt_profile_suiteb \ - mbedtls_x509_crt_profile_suiteb_ncbicxx_2_28_3 + mbedtls_x509_crt_profile_suiteb_ncbicxx_2_28_8 #define mbedtls_x509_crt_verify \ - mbedtls_x509_crt_verify_ncbicxx_2_28_3 + mbedtls_x509_crt_verify_ncbicxx_2_28_8 #define mbedtls_x509_crt_verify_info \ - mbedtls_x509_crt_verify_info_ncbicxx_2_28_3 + mbedtls_x509_crt_verify_info_ncbicxx_2_28_8 #define mbedtls_x509_crt_verify_restartable \ - mbedtls_x509_crt_verify_restartable_ncbicxx_2_28_3 + mbedtls_x509_crt_verify_restartable_ncbicxx_2_28_8 #define mbedtls_x509_crt_verify_with_profile \ - mbedtls_x509_crt_verify_with_profile_ncbicxx_2_28_3 + mbedtls_x509_crt_verify_with_profile_ncbicxx_2_28_8 #define mbedtls_x509_parse_subject_alt_name \ - mbedtls_x509_parse_subject_alt_name_ncbicxx_2_28_3 + mbedtls_x509_parse_subject_alt_name_ncbicxx_2_28_8 #define mbedtls_x509_csr_free \ - mbedtls_x509_csr_free_ncbicxx_2_28_3 + mbedtls_x509_csr_free_ncbicxx_2_28_8 #define mbedtls_x509_csr_info \ - mbedtls_x509_csr_info_ncbicxx_2_28_3 + mbedtls_x509_csr_info_ncbicxx_2_28_8 #define mbedtls_x509_csr_init \ - mbedtls_x509_csr_init_ncbicxx_2_28_3 + mbedtls_x509_csr_init_ncbicxx_2_28_8 #define mbedtls_x509_csr_parse \ - mbedtls_x509_csr_parse_ncbicxx_2_28_3 + mbedtls_x509_csr_parse_ncbicxx_2_28_8 #define mbedtls_x509_csr_parse_der \ - mbedtls_x509_csr_parse_der_ncbicxx_2_28_3 + mbedtls_x509_csr_parse_der_ncbicxx_2_28_8 #define mbedtls_x509_csr_parse_file \ - mbedtls_x509_csr_parse_file_ncbicxx_2_28_3 + mbedtls_x509_csr_parse_file_ncbicxx_2_28_8 #define mbedtls_x509write_crt_der \ - mbedtls_x509write_crt_der_ncbicxx_2_28_3 + mbedtls_x509write_crt_der_ncbicxx_2_28_8 #define mbedtls_x509write_crt_free \ - mbedtls_x509write_crt_free_ncbicxx_2_28_3 + mbedtls_x509write_crt_free_ncbicxx_2_28_8 #define mbedtls_x509write_crt_init \ - mbedtls_x509write_crt_init_ncbicxx_2_28_3 + mbedtls_x509write_crt_init_ncbicxx_2_28_8 #define mbedtls_x509write_crt_pem \ - mbedtls_x509write_crt_pem_ncbicxx_2_28_3 + mbedtls_x509write_crt_pem_ncbicxx_2_28_8 #define mbedtls_x509write_crt_set_authority_key_identifier \ - mbedtls_x509write_crt_set_authority_key_identifier_ncbicxx_2_28_3 + mbedtls_x509write_crt_set_authority_key_identifier_ncbicxx_2_28_8 #define mbedtls_x509write_crt_set_basic_constraints \ - mbedtls_x509write_crt_set_basic_constraints_ncbicxx_2_28_3 + mbedtls_x509write_crt_set_basic_constraints_ncbicxx_2_28_8 #define mbedtls_x509write_crt_set_extension \ - mbedtls_x509write_crt_set_extension_ncbicxx_2_28_3 + mbedtls_x509write_crt_set_extension_ncbicxx_2_28_8 #define mbedtls_x509write_crt_set_issuer_key \ - mbedtls_x509write_crt_set_issuer_key_ncbicxx_2_28_3 + mbedtls_x509write_crt_set_issuer_key_ncbicxx_2_28_8 #define mbedtls_x509write_crt_set_issuer_name \ - mbedtls_x509write_crt_set_issuer_name_ncbicxx_2_28_3 + mbedtls_x509write_crt_set_issuer_name_ncbicxx_2_28_8 #define mbedtls_x509write_crt_set_key_usage \ - mbedtls_x509write_crt_set_key_usage_ncbicxx_2_28_3 + mbedtls_x509write_crt_set_key_usage_ncbicxx_2_28_8 #define mbedtls_x509write_crt_set_md_alg \ - mbedtls_x509write_crt_set_md_alg_ncbicxx_2_28_3 + mbedtls_x509write_crt_set_md_alg_ncbicxx_2_28_8 #define mbedtls_x509write_crt_set_ns_cert_type \ - mbedtls_x509write_crt_set_ns_cert_type_ncbicxx_2_28_3 + mbedtls_x509write_crt_set_ns_cert_type_ncbicxx_2_28_8 #define mbedtls_x509write_crt_set_serial \ - mbedtls_x509write_crt_set_serial_ncbicxx_2_28_3 + mbedtls_x509write_crt_set_serial_ncbicxx_2_28_8 #define mbedtls_x509write_crt_set_subject_key \ - mbedtls_x509write_crt_set_subject_key_ncbicxx_2_28_3 + mbedtls_x509write_crt_set_subject_key_ncbicxx_2_28_8 #define mbedtls_x509write_crt_set_subject_key_identifier \ - mbedtls_x509write_crt_set_subject_key_identifier_ncbicxx_2_28_3 + mbedtls_x509write_crt_set_subject_key_identifier_ncbicxx_2_28_8 #define mbedtls_x509write_crt_set_subject_name \ - mbedtls_x509write_crt_set_subject_name_ncbicxx_2_28_3 + mbedtls_x509write_crt_set_subject_name_ncbicxx_2_28_8 #define mbedtls_x509write_crt_set_validity \ - mbedtls_x509write_crt_set_validity_ncbicxx_2_28_3 + mbedtls_x509write_crt_set_validity_ncbicxx_2_28_8 #define mbedtls_x509write_crt_set_version \ - mbedtls_x509write_crt_set_version_ncbicxx_2_28_3 + mbedtls_x509write_crt_set_version_ncbicxx_2_28_8 #define mbedtls_x509write_csr_der \ - mbedtls_x509write_csr_der_ncbicxx_2_28_3 + mbedtls_x509write_csr_der_ncbicxx_2_28_8 #define mbedtls_x509write_csr_free \ - mbedtls_x509write_csr_free_ncbicxx_2_28_3 + mbedtls_x509write_csr_free_ncbicxx_2_28_8 #define mbedtls_x509write_csr_init \ - mbedtls_x509write_csr_init_ncbicxx_2_28_3 + mbedtls_x509write_csr_init_ncbicxx_2_28_8 #define mbedtls_x509write_csr_pem \ - mbedtls_x509write_csr_pem_ncbicxx_2_28_3 + mbedtls_x509write_csr_pem_ncbicxx_2_28_8 #define mbedtls_x509write_csr_set_extension \ - mbedtls_x509write_csr_set_extension_ncbicxx_2_28_3 + mbedtls_x509write_csr_set_extension_ncbicxx_2_28_8 #define mbedtls_x509write_csr_set_key \ - mbedtls_x509write_csr_set_key_ncbicxx_2_28_3 + mbedtls_x509write_csr_set_key_ncbicxx_2_28_8 #define mbedtls_x509write_csr_set_key_usage \ - mbedtls_x509write_csr_set_key_usage_ncbicxx_2_28_3 + mbedtls_x509write_csr_set_key_usage_ncbicxx_2_28_8 #define mbedtls_x509write_csr_set_md_alg \ - mbedtls_x509write_csr_set_md_alg_ncbicxx_2_28_3 + mbedtls_x509write_csr_set_md_alg_ncbicxx_2_28_8 #define mbedtls_x509write_csr_set_ns_cert_type \ - mbedtls_x509write_csr_set_ns_cert_type_ncbicxx_2_28_3 + mbedtls_x509write_csr_set_ns_cert_type_ncbicxx_2_28_8 #define mbedtls_x509write_csr_set_subject_name \ - mbedtls_x509write_csr_set_subject_name_ncbicxx_2_28_3 + mbedtls_x509write_csr_set_subject_name_ncbicxx_2_28_8 #define mbedtls_xtea_crypt_cbc \ - mbedtls_xtea_crypt_cbc_ncbicxx_2_28_3 + mbedtls_xtea_crypt_cbc_ncbicxx_2_28_8 #define mbedtls_xtea_crypt_ecb \ - mbedtls_xtea_crypt_ecb_ncbicxx_2_28_3 + mbedtls_xtea_crypt_ecb_ncbicxx_2_28_8 #define mbedtls_xtea_free \ - mbedtls_xtea_free_ncbicxx_2_28_3 + mbedtls_xtea_free_ncbicxx_2_28_8 #define mbedtls_xtea_init \ - mbedtls_xtea_init_ncbicxx_2_28_3 + mbedtls_xtea_init_ncbicxx_2_28_8 #define mbedtls_xtea_setup \ - mbedtls_xtea_setup_ncbicxx_2_28_3 + mbedtls_xtea_setup_ncbicxx_2_28_8 diff --git a/c++/src/connect/mbedtls/mbedtls/net.h b/c++/src/connect/mbedtls/mbedtls/net.h index 66921887..805ce339 100644 --- a/c++/src/connect/mbedtls/mbedtls/net.h +++ b/c++/src/connect/mbedtls/mbedtls/net.h @@ -7,19 +7,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #if !defined(MBEDTLS_CONFIG_FILE) #include "mbedtls/config.h" diff --git a/c++/src/connect/mbedtls/mbedtls/net_sockets.h b/c++/src/connect/mbedtls/mbedtls/net_sockets.h index c8bcde06..1a12c9c8 100644 --- a/c++/src/connect/mbedtls/mbedtls/net_sockets.h +++ b/c++/src/connect/mbedtls/mbedtls/net_sockets.h @@ -21,19 +21,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_NET_SOCKETS_H #define MBEDTLS_NET_SOCKETS_H @@ -152,7 +140,7 @@ int mbedtls_net_bind(mbedtls_net_context *ctx, const char *bind_ip, const char * * \param client_ctx Will contain the connected client socket * \param client_ip Will contain the client IP address, can be NULL * \param buf_size Size of the client_ip buffer - * \param ip_len Will receive the size of the client IP written, + * \param cip_len Will receive the size of the client IP written, * can be NULL if client_ip is null * * \return 0 if successful, or @@ -165,7 +153,7 @@ int mbedtls_net_bind(mbedtls_net_context *ctx, const char *bind_ip, const char * */ int mbedtls_net_accept(mbedtls_net_context *bind_ctx, mbedtls_net_context *client_ctx, - void *client_ip, size_t buf_size, size_t *ip_len); + void *client_ip, size_t buf_size, size_t *cip_len); /** * \brief Check and wait for the context to be ready for read/write @@ -283,6 +271,10 @@ int mbedtls_net_recv_timeout(void *ctx, unsigned char *buf, size_t len, * \brief Closes down the connection and free associated data * * \param ctx The context to close + * + * \note This function frees and clears data associated with the + * context but does not free the memory pointed to by \p ctx. + * This memory is the responsibility of the caller. */ void mbedtls_net_close(mbedtls_net_context *ctx); @@ -290,6 +282,10 @@ void mbedtls_net_close(mbedtls_net_context *ctx); * \brief Gracefully shutdown the connection and free associated data * * \param ctx The context to free + * + * \note This function frees and clears data associated with the + * context but does not free the memory pointed to by \p ctx. + * This memory is the responsibility of the caller. */ void mbedtls_net_free(mbedtls_net_context *ctx); diff --git a/c++/src/connect/mbedtls/mbedtls/nist_kw.h b/c++/src/connect/mbedtls/mbedtls/nist_kw.h index 8d3a4a53..a2479b01 100644 --- a/c++/src/connect/mbedtls/mbedtls/nist_kw.h +++ b/c++/src/connect/mbedtls/mbedtls/nist_kw.h @@ -17,19 +17,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_NIST_KW_H diff --git a/c++/src/connect/mbedtls/mbedtls/oid.h b/c++/src/connect/mbedtls/mbedtls/oid.h index a64eaebe..8da1ce85 100644 --- a/c++/src/connect/mbedtls/mbedtls/oid.h +++ b/c++/src/connect/mbedtls/mbedtls/oid.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_OID_H #define MBEDTLS_OID_H diff --git a/c++/src/connect/mbedtls/mbedtls/padlock.h b/c++/src/connect/mbedtls/mbedtls/padlock.h index 01069ea7..0821105f 100644 --- a/c++/src/connect/mbedtls/mbedtls/padlock.h +++ b/c++/src/connect/mbedtls/mbedtls/padlock.h @@ -9,19 +9,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_PADLOCK_H #define MBEDTLS_PADLOCK_H @@ -44,9 +32,12 @@ #endif /* Some versions of ASan result in errors about not enough registers */ -#if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && defined(__i386__) && \ +#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_ASM) && \ + defined(__GNUC__) && defined(__i386__) && \ !defined(MBEDTLS_HAVE_ASAN) +#define MBEDTLS_VIA_PADLOCK_HAVE_CODE + #ifndef MBEDTLS_HAVE_X86 #define MBEDTLS_HAVE_X86 #endif @@ -120,6 +111,7 @@ int mbedtls_padlock_xcryptcbc(mbedtls_aes_context *ctx, } #endif -#endif /* HAVE_X86 */ +#endif /* MBEDTLS_PADLOCK_C && MBEDTLS_HAVE_ASM && + __GNUC__ && __i386__ && !MBEDTLS_HAVE_ASAN */ #endif /* padlock.h */ diff --git a/c++/src/connect/mbedtls/mbedtls/pem.h b/c++/src/connect/mbedtls/mbedtls/pem.h index fee32a3b..ffe6e473 100644 --- a/c++/src/connect/mbedtls/mbedtls/pem.h +++ b/c++/src/connect/mbedtls/mbedtls/pem.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_PEM_H #define MBEDTLS_PEM_H diff --git a/c++/src/connect/mbedtls/mbedtls/pk.h b/c++/src/connect/mbedtls/mbedtls/pk.h index ec835513..a8c0c377 100644 --- a/c++/src/connect/mbedtls/mbedtls/pk.h +++ b/c++/src/connect/mbedtls/mbedtls/pk.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_PK_H @@ -395,7 +383,7 @@ int mbedtls_pk_can_do(const mbedtls_pk_context *ctx, mbedtls_pk_type_t type); * * \return 0 on success (signature is valid), * #MBEDTLS_ERR_PK_SIG_LEN_MISMATCH if there is a valid - * signature in sig but its length is less than \p siglen, + * signature in \p sig but its length is less than \p sig_len, * or a specific error code. * * \note For RSA keys, the default padding type is PKCS#1 v1.5. @@ -459,7 +447,7 @@ int mbedtls_pk_verify_restartable(mbedtls_pk_context *ctx, * #MBEDTLS_ERR_PK_TYPE_MISMATCH if the PK context can't be * used for this type of signatures, * #MBEDTLS_ERR_PK_SIG_LEN_MISMATCH if there is a valid - * signature in sig but its length is less than \p siglen, + * signature in \p sig but its length is less than \p sig_len, * or a specific error code. * * \note If hash_len is 0, then the length associated with md_alg diff --git a/c++/src/connect/mbedtls/mbedtls/pk_internal.h b/c++/src/connect/mbedtls/mbedtls/pk_internal.h index 8a0c30f5..15165acd 100644 --- a/c++/src/connect/mbedtls/mbedtls/pk_internal.h +++ b/c++/src/connect/mbedtls/mbedtls/pk_internal.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_PK_WRAP_H diff --git a/c++/src/connect/mbedtls/mbedtls/pkcs11.h b/c++/src/connect/mbedtls/mbedtls/pkcs11.h index 80a8a9c4..25d1dd1e 100644 --- a/c++/src/connect/mbedtls/mbedtls/pkcs11.h +++ b/c++/src/connect/mbedtls/mbedtls/pkcs11.h @@ -7,19 +7,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_PKCS11_H #define MBEDTLS_PKCS11_H @@ -71,7 +59,7 @@ typedef struct mbedtls_pkcs11_context { MBEDTLS_DEPRECATED void mbedtls_pkcs11_init(mbedtls_pkcs11_context *ctx); /** - * Fill in a mbed TLS certificate, based on the given PKCS11 helper certificate. + * Fill in a Mbed TLS certificate, based on the given PKCS11 helper certificate. * * \deprecated This function is deprecated and will be removed in a * future version of the library. diff --git a/c++/src/connect/mbedtls/mbedtls/pkcs12.h b/c++/src/connect/mbedtls/mbedtls/pkcs12.h index cd138527..2ad5e9c3 100644 --- a/c++/src/connect/mbedtls/mbedtls/pkcs12.h +++ b/c++/src/connect/mbedtls/mbedtls/pkcs12.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_PKCS12_H #define MBEDTLS_PKCS12_H @@ -79,6 +67,21 @@ int mbedtls_pkcs12_pbe_sha1_rc4_128(mbedtls_asn1_buf *pbe_params, int mode, * \brief PKCS12 Password Based function (encryption / decryption) * for cipher-based and mbedtls_md-based PBE's * + * \note When encrypting, #MBEDTLS_CIPHER_PADDING_PKCS7 must + * be enabled at compile time. + * + * \warning When decrypting: + * - if #MBEDTLS_CIPHER_PADDING_PKCS7 is enabled at compile + * time, this function validates the CBC padding and returns + * #MBEDTLS_ERR_PKCS12_PASSWORD_MISMATCH if the padding is + * invalid. Note that this can help active adversaries + * attempting to brute-forcing the password. Note also that + * there is no guarantee that an invalid password will be + * detected (the chances of a valid padding with a random + * password are about 1/255). + * - if #MBEDTLS_CIPHER_PADDING_PKCS7 is disabled at compile + * time, this function does not validate the CBC padding. + * * \param pbe_params an ASN1 buffer containing the pkcs-12 PbeParams structure * \param mode either #MBEDTLS_PKCS12_PBE_ENCRYPT or * #MBEDTLS_PKCS12_PBE_DECRYPT @@ -87,18 +90,77 @@ int mbedtls_pkcs12_pbe_sha1_rc4_128(mbedtls_asn1_buf *pbe_params, int mode, * \param pwd Latin1-encoded password used. This may only be \c NULL when * \p pwdlen is 0. No null terminator should be used. * \param pwdlen length of the password (may be 0) - * \param input the input data + * \param data the input data * \param len data length - * \param output the output buffer + * \param output Output buffer. + * On success, it contains the encrypted or decrypted data, + * possibly followed by the CBC padding. + * On failure, the content is indeterminate. + * For decryption, there must be enough room for \p len + * bytes. + * For encryption, there must be enough room for + * \p len + 1 bytes, rounded up to the block size of + * the block cipher identified by \p pbe_params. * * \return 0 if successful, or a MBEDTLS_ERR_XXX code */ int mbedtls_pkcs12_pbe(mbedtls_asn1_buf *pbe_params, int mode, mbedtls_cipher_type_t cipher_type, mbedtls_md_type_t md_type, const unsigned char *pwd, size_t pwdlen, - const unsigned char *input, size_t len, + const unsigned char *data, size_t len, unsigned char *output); +#if defined(MBEDTLS_CIPHER_PADDING_PKCS7) + +/** + * \brief PKCS12 Password Based function (encryption / decryption) + * for cipher-based and mbedtls_md-based PBE's + * + * + * \warning When decrypting: + * - This function validates the CBC padding and returns + * #MBEDTLS_ERR_PKCS12_PASSWORD_MISMATCH if the padding is + * invalid. Note that this can help active adversaries + * attempting to brute-forcing the password. Note also that + * there is no guarantee that an invalid password will be + * detected (the chances of a valid padding with a random + * password are about 1/255). + * + * \param pbe_params an ASN1 buffer containing the pkcs-12 PbeParams structure + * \param mode either #MBEDTLS_PKCS12_PBE_ENCRYPT or + * #MBEDTLS_PKCS12_PBE_DECRYPT + * \param cipher_type the cipher used + * \param md_type the mbedtls_md used + * \param pwd Latin1-encoded password used. This may only be \c NULL when + * \p pwdlen is 0. No null terminator should be used. + * \param pwdlen length of the password (may be 0) + * \param data the input data + * \param len data length + * \param output Output buffer. + * On success, it contains the encrypted or decrypted data, + * possibly followed by the CBC padding. + * On failure, the content is indeterminate. + * For decryption, there must be enough room for \p len + * bytes. + * For encryption, there must be enough room for + * \p len + 1 bytes, rounded up to the block size of + * the block cipher identified by \p pbe_params. + * \param output_size size of output buffer. + * This must be big enough to accommodate for output plus + * padding data. + * \param output_len On success, length of actual data written to the output buffer. + * + * \return 0 if successful, or a MBEDTLS_ERR_XXX code + */ +int mbedtls_pkcs12_pbe_ext(mbedtls_asn1_buf *pbe_params, int mode, + mbedtls_cipher_type_t cipher_type, mbedtls_md_type_t md_type, + const unsigned char *pwd, size_t pwdlen, + const unsigned char *data, size_t len, + unsigned char *output, size_t output_size, + size_t *output_len); + +#endif /* MBEDTLS_CIPHER_PADDING_PKCS7 */ + #endif /* MBEDTLS_ASN1_PARSE_C */ /** diff --git a/c++/src/connect/mbedtls/mbedtls/pkcs5.h b/c++/src/connect/mbedtls/mbedtls/pkcs5.h index 12dec054..05bea484 100644 --- a/c++/src/connect/mbedtls/mbedtls/pkcs5.h +++ b/c++/src/connect/mbedtls/mbedtls/pkcs5.h @@ -7,19 +7,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_PKCS5_H #define MBEDTLS_PKCS5_H @@ -57,13 +45,36 @@ extern "C" { /** * \brief PKCS#5 PBES2 function * + * \note When encrypting, #MBEDTLS_CIPHER_PADDING_PKCS7 must + * be enabled at compile time. + * + * \warning When decrypting: + * - if #MBEDTLS_CIPHER_PADDING_PKCS7 is enabled at compile + * time, this function validates the CBC padding and returns + * #MBEDTLS_ERR_PKCS5_PASSWORD_MISMATCH if the padding is + * invalid. Note that this can help active adversaries + * attempting to brute-forcing the password. Note also that + * there is no guarantee that an invalid password will be + * detected (the chances of a valid padding with a random + * password are about 1/255). + * - if #MBEDTLS_CIPHER_PADDING_PKCS7 is disabled at compile + * time, this function does not validate the CBC padding. + * * \param pbe_params the ASN.1 algorithm parameters - * \param mode either MBEDTLS_PKCS5_DECRYPT or MBEDTLS_PKCS5_ENCRYPT + * \param mode either #MBEDTLS_PKCS5_DECRYPT or #MBEDTLS_PKCS5_ENCRYPT * \param pwd password to use when generating key * \param pwdlen length of password * \param data data to process * \param datalen length of data - * \param output output buffer + * \param output Output buffer. + * On success, it contains the encrypted or decrypted data, + * possibly followed by the CBC padding. + * On failure, the content is indeterminate. + * For decryption, there must be enough room for \p datalen + * bytes. + * For encryption, there must be enough room for + * \p datalen + 1 bytes, rounded up to the block size of + * the block cipher identified by \p pbe_params. * * \returns 0 on success, or a MBEDTLS_ERR_XXX code if verification fails. */ @@ -72,6 +83,49 @@ int mbedtls_pkcs5_pbes2(const mbedtls_asn1_buf *pbe_params, int mode, const unsigned char *data, size_t datalen, unsigned char *output); +#if defined(MBEDTLS_CIPHER_PADDING_PKCS7) + +/** + * \brief PKCS#5 PBES2 function + * + * \warning When decrypting: + * - This function validates the CBC padding and returns + * #MBEDTLS_ERR_PKCS5_PASSWORD_MISMATCH if the padding is + * invalid. Note that this can help active adversaries + * attempting to brute-forcing the password. Note also that + * there is no guarantee that an invalid password will be + * detected (the chances of a valid padding with a random + * password are about 1/255). + * + * \param pbe_params the ASN.1 algorithm parameters + * \param mode either #MBEDTLS_PKCS5_DECRYPT or #MBEDTLS_PKCS5_ENCRYPT + * \param pwd password to use when generating key + * \param pwdlen length of password + * \param data data to process + * \param datalen length of data + * \param output Output buffer. + * On success, it contains the decrypted data. + * On failure, the content is indetermidate. + * For decryption, there must be enough room for \p datalen + * bytes. + * For encryption, there must be enough room for + * \p datalen + 1 bytes, rounded up to the block size of + * the block cipher identified by \p pbe_params. + * \param output_size size of output buffer. + * This must be big enough to accommodate for output plus + * padding data. + * \param output_len On success, length of actual data written to the output buffer. + * + * \returns 0 on success, or a MBEDTLS_ERR_XXX code if parsing or decryption fails. + */ +int mbedtls_pkcs5_pbes2_ext(const mbedtls_asn1_buf *pbe_params, int mode, + const unsigned char *pwd, size_t pwdlen, + const unsigned char *data, size_t datalen, + unsigned char *output, size_t output_size, + size_t *output_len); + +#endif /* MBEDTLS_CIPHER_PADDING_PKCS7 */ + #endif /* MBEDTLS_ASN1_PARSE_C */ /** diff --git a/c++/src/connect/mbedtls/mbedtls/platform.h b/c++/src/connect/mbedtls/mbedtls/platform.h index cb76c28c..17639542 100644 --- a/c++/src/connect/mbedtls/mbedtls/platform.h +++ b/c++/src/connect/mbedtls/mbedtls/platform.h @@ -21,19 +21,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_PLATFORM_H #define MBEDTLS_PLATFORM_H @@ -135,15 +123,28 @@ extern "C" { #endif #endif /* MBEDTLS_PLATFORM_NO_STD_FUNCTIONS */ +/* Enable certain documented defines only when generating doxygen to avoid + * an "unrecognized define" error. */ +#if defined(__DOXYGEN__) && !defined(MBEDTLS_PLATFORM_STD_CALLOC) +#define MBEDTLS_PLATFORM_STD_CALLOC +#endif + +#if defined(__DOXYGEN__) && !defined(MBEDTLS_PLATFORM_STD_FREE) +#define MBEDTLS_PLATFORM_STD_FREE +#endif /** \} name SECTION: Module settings */ /* * The function pointers for calloc and free. + * Please see MBEDTLS_PLATFORM_STD_CALLOC and MBEDTLS_PLATFORM_STD_FREE + * in mbedtls_config.h for more information about behaviour and requirements. */ #if defined(MBEDTLS_PLATFORM_MEMORY) #if defined(MBEDTLS_PLATFORM_FREE_MACRO) && \ defined(MBEDTLS_PLATFORM_CALLOC_MACRO) +#undef mbedtls_free +#undef mbedtls_calloc #define mbedtls_free MBEDTLS_PLATFORM_FREE_MACRO #define mbedtls_calloc MBEDTLS_PLATFORM_CALLOC_MACRO #else @@ -165,6 +166,8 @@ int mbedtls_platform_set_calloc_free(void *(*calloc_func)(size_t, size_t), void (*free_func)(void *)); #endif /* MBEDTLS_PLATFORM_FREE_MACRO && MBEDTLS_PLATFORM_CALLOC_MACRO */ #else /* !MBEDTLS_PLATFORM_MEMORY */ +#undef mbedtls_free +#undef mbedtls_calloc #define mbedtls_free free #define mbedtls_calloc calloc #endif /* MBEDTLS_PLATFORM_MEMORY && !MBEDTLS_PLATFORM_{FREE,CALLOC}_MACRO */ @@ -189,6 +192,7 @@ extern int (*mbedtls_fprintf)(FILE *stream, const char *format, ...); int mbedtls_platform_set_fprintf(int (*fprintf_func)(FILE *stream, const char *, ...)); #else +#undef mbedtls_fprintf #if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO) #define mbedtls_fprintf MBEDTLS_PLATFORM_FPRINTF_MACRO #else @@ -213,6 +217,7 @@ extern int (*mbedtls_printf)(const char *format, ...); */ int mbedtls_platform_set_printf(int (*printf_func)(const char *, ...)); #else /* !MBEDTLS_PLATFORM_PRINTF_ALT */ +#undef mbedtls_printf #if defined(MBEDTLS_PLATFORM_PRINTF_MACRO) #define mbedtls_printf MBEDTLS_PLATFORM_PRINTF_MACRO #else @@ -248,9 +253,7 @@ extern int (*mbedtls_snprintf)(char *s, size_t n, const char *format, ...); int mbedtls_platform_set_snprintf(int (*snprintf_func)(char *s, size_t n, const char *format, ...)); #else /* MBEDTLS_PLATFORM_SNPRINTF_ALT */ -#if defined(mbedtls_snprintf) #undef mbedtls_snprintf -#endif #if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO) #define mbedtls_snprintf MBEDTLS_PLATFORM_SNPRINTF_MACRO #else @@ -287,9 +290,7 @@ extern int (*mbedtls_vsnprintf)(char *s, size_t n, const char *format, va_list a int mbedtls_platform_set_vsnprintf(int (*vsnprintf_func)(char *s, size_t n, const char *format, va_list arg)); #else /* MBEDTLS_PLATFORM_VSNPRINTF_ALT */ -#if defined(mbedtls_vsnprintf) #undef mbedtls_vsnprintf -#endif #if defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO) #define mbedtls_vsnprintf MBEDTLS_PLATFORM_VSNPRINTF_MACRO #else @@ -314,6 +315,7 @@ extern void (*mbedtls_exit)(int status); */ int mbedtls_platform_set_exit(void (*exit_func)(int status)); #else +#undef mbedtls_exit #if defined(MBEDTLS_PLATFORM_EXIT_MACRO) #define mbedtls_exit MBEDTLS_PLATFORM_EXIT_MACRO #else @@ -366,6 +368,8 @@ int mbedtls_platform_set_nv_seed( int (*nv_seed_write_func)(unsigned char *buf, size_t buf_len) ); #else +#undef mbedtls_nv_seed_read +#undef mbedtls_nv_seed_write #if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO) && \ defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO) #define mbedtls_nv_seed_read MBEDTLS_PLATFORM_NV_SEED_READ_MACRO diff --git a/c++/src/connect/mbedtls/mbedtls/platform_time.h b/c++/src/connect/mbedtls/mbedtls/platform_time.h index eee61d69..9671c88d 100644 --- a/c++/src/connect/mbedtls/mbedtls/platform_time.h +++ b/c++/src/connect/mbedtls/mbedtls/platform_time.h @@ -1,23 +1,11 @@ /** * \file platform_time.h * - * \brief mbed TLS Platform time abstraction + * \brief Mbed TLS Platform time abstraction */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_PLATFORM_TIME_H #define MBEDTLS_PLATFORM_TIME_H diff --git a/c++/src/connect/mbedtls/mbedtls/platform_util.h b/c++/src/connect/mbedtls/mbedtls/platform_util.h index 55fc4311..74e2a1db 100644 --- a/c++/src/connect/mbedtls/mbedtls/platform_util.h +++ b/c++/src/connect/mbedtls/mbedtls/platform_util.h @@ -6,19 +6,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_PLATFORM_UTIL_H #define MBEDTLS_PLATFORM_UTIL_H @@ -221,6 +209,11 @@ MBEDTLS_DEPRECATED typedef int mbedtls_deprecated_numeric_constant_t; #define MBEDTLS_IGNORE_RETURN(result) ((void) !(result)) #endif +/* If the following macro is defined, the library is being built by the test + * framework, and the framework is going to provide a replacement + * mbedtls_platform_zeroize() using a preprocessor macro, so the function + * declaration should be omitted. */ +#if !defined(MBEDTLS_TEST_DEFINES_ZEROIZE) //no-check-names /** * \brief Securely zeroize a buffer * @@ -244,6 +237,7 @@ MBEDTLS_DEPRECATED typedef int mbedtls_deprecated_numeric_constant_t; * */ void mbedtls_platform_zeroize(void *buf, size_t len); +#endif #if defined(MBEDTLS_HAVE_TIME_DATE) /** diff --git a/c++/src/connect/mbedtls/mbedtls/poly1305.h b/c++/src/connect/mbedtls/mbedtls/poly1305.h index 7b1faa51..ecbd9848 100644 --- a/c++/src/connect/mbedtls/mbedtls/poly1305.h +++ b/c++/src/connect/mbedtls/mbedtls/poly1305.h @@ -14,19 +14,7 @@ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_POLY1305_H diff --git a/c++/src/connect/mbedtls/mbedtls/psa_util.h b/c++/src/connect/mbedtls/mbedtls/psa_util.h index 9a1a2eae..6d7e4446 100644 --- a/c++/src/connect/mbedtls/mbedtls/psa_util.h +++ b/c++/src/connect/mbedtls/mbedtls/psa_util.h @@ -8,19 +8,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_PSA_UTIL_H diff --git a/c++/src/connect/mbedtls/mbedtls/ripemd160.h b/c++/src/connect/mbedtls/mbedtls/ripemd160.h index 6d9a1a2a..38318a2b 100644 --- a/c++/src/connect/mbedtls/mbedtls/ripemd160.h +++ b/c++/src/connect/mbedtls/mbedtls/ripemd160.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_RIPEMD160_H #define MBEDTLS_RIPEMD160_H diff --git a/c++/src/connect/mbedtls/mbedtls/rsa.h b/c++/src/connect/mbedtls/mbedtls/rsa.h index f8725ffb..17797751 100644 --- a/c++/src/connect/mbedtls/mbedtls/rsa.h +++ b/c++/src/connect/mbedtls/mbedtls/rsa.h @@ -11,19 +11,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_RSA_H #define MBEDTLS_RSA_H @@ -260,15 +248,15 @@ int mbedtls_rsa_import_raw(mbedtls_rsa_context *ctx, * \brief This function completes an RSA context from * a set of imported core parameters. * - * To setup an RSA public key, precisely \p N and \p E + * To setup an RSA public key, precisely \c N and \c E * must have been imported. * * To setup an RSA private key, sufficient information must * be present for the other parameters to be derivable. * * The default implementation supports the following: - *
  • Derive \p P, \p Q from \p N, \p D, \p E.
  • - *
  • Derive \p N, \p D from \p P, \p Q, \p E.
+ *
  • Derive \c P, \c Q from \c N, \c D, \c E.
  • + *
  • Derive \c N, \c D from \c P, \c Q, \c E.
* Alternative implementations need not support these. * * If this function runs successfully, it guarantees that @@ -537,7 +525,7 @@ int mbedtls_rsa_check_pub_priv(const mbedtls_rsa_context *pub, * \note This function does not handle message padding. * * \note Make sure to set \p input[0] = 0 or ensure that - * input is smaller than \p N. + * input is smaller than \c N. * * \return \c 0 on success. * \return An \c MBEDTLS_ERR_RSA_XXX error code on failure. @@ -724,6 +712,10 @@ int mbedtls_rsa_rsaes_oaep_encrypt(mbedtls_rsa_context *ctx, * It is the generic wrapper for performing a PKCS#1 decryption * operation using the \p mode from the context. * + * \warning When \p ctx->padding is set to #MBEDTLS_RSA_PKCS_V15, + * mbedtls_rsa_rsaes_pkcs1_v15_decrypt() is called, which is an + * inherently dangerous function (CWE-242). + * * \note The output buffer length \c output_max_len should be * as large as the size \p ctx->len of \p ctx->N (for example, * 128 Bytes if RSA-1024 is used) to be able to hold an @@ -773,6 +765,11 @@ int mbedtls_rsa_pkcs1_decrypt(mbedtls_rsa_context *ctx, * \brief This function performs a PKCS#1 v1.5 decryption * operation (RSAES-PKCS1-v1_5-DECRYPT). * + * \warning This is an inherently dangerous function (CWE-242). Unless + * it is used in a side channel free and safe way (eg. + * implementing the TLS protocol as per 7.4.7.1 of RFC 5246), + * the calling code is vulnerable. + * * \note The output buffer length \c output_max_len should be * as large as the size \p ctx->len of \p ctx->N, for example, * 128 Bytes if RSA-1024 is used, to be able to hold an @@ -1109,8 +1106,8 @@ int mbedtls_rsa_rsassa_pss_sign(mbedtls_rsa_context *ctx, * verification using the mode from the context. * * \note For PKCS#1 v2.1 encoding, see comments on - * mbedtls_rsa_rsassa_pss_verify() about \p md_alg and - * \p hash_id. + * mbedtls_rsa_rsassa_pss_verify() about \c md_alg and + * \c hash_id. * * \deprecated It is deprecated and discouraged to call this function * in #MBEDTLS_RSA_PRIVATE mode. Future versions of the library diff --git a/c++/src/connect/mbedtls/mbedtls/rsa_internal.h b/c++/src/connect/mbedtls/mbedtls/rsa_internal.h index 017018bc..286cff25 100644 --- a/c++/src/connect/mbedtls/mbedtls/rsa_internal.h +++ b/c++/src/connect/mbedtls/mbedtls/rsa_internal.h @@ -36,19 +36,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * */ diff --git a/c++/src/connect/mbedtls/mbedtls/sha1.h b/c++/src/connect/mbedtls/mbedtls/sha1.h index 7a7319f2..61d81f16 100644 --- a/c++/src/connect/mbedtls/mbedtls/sha1.h +++ b/c++/src/connect/mbedtls/mbedtls/sha1.h @@ -12,19 +12,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_SHA1_H #define MBEDTLS_SHA1_H diff --git a/c++/src/connect/mbedtls/mbedtls/sha256.h b/c++/src/connect/mbedtls/mbedtls/sha256.h index 00bd17d0..d4c3e646 100644 --- a/c++/src/connect/mbedtls/mbedtls/sha256.h +++ b/c++/src/connect/mbedtls/mbedtls/sha256.h @@ -8,19 +8,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_SHA256_H #define MBEDTLS_SHA256_H diff --git a/c++/src/connect/mbedtls/mbedtls/sha512.h b/c++/src/connect/mbedtls/mbedtls/sha512.h index 1df87f99..c9e01690 100644 --- a/c++/src/connect/mbedtls/mbedtls/sha512.h +++ b/c++/src/connect/mbedtls/mbedtls/sha512.h @@ -7,19 +7,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_SHA512_H #define MBEDTLS_SHA512_H diff --git a/c++/src/connect/mbedtls/mbedtls/ssl.h b/c++/src/connect/mbedtls/mbedtls/ssl.h index 26e4ec40..9cdf3a3e 100644 --- a/c++/src/connect/mbedtls/mbedtls/ssl.h +++ b/c++/src/connect/mbedtls/mbedtls/ssl.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_SSL_H #define MBEDTLS_SSL_H @@ -193,6 +181,8 @@ #define MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS -0x7000 /** Invalid value in SSL config */ #define MBEDTLS_ERR_SSL_BAD_CONFIG -0x5E80 +/** Cache entry not found */ +#define MBEDTLS_ERR_SSL_CACHE_ENTRY_NOT_FOUND -0x5E00 /* * Various constants @@ -494,6 +484,7 @@ /* Dummy type used only for its size */ union mbedtls_ssl_premaster_secret { + unsigned char dummy; /* Make the union non-empty even with SSL disabled */ #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) unsigned char _pms_rsa[48]; /* RFC 5246 8.1.1 */ #endif @@ -1746,10 +1737,10 @@ void mbedtls_ssl_set_bio(mbedtls_ssl_context *ssl, * \param own_cid The address of the readable buffer holding the CID we want * the peer to use when sending encrypted messages to us. * This may be \c NULL if \p own_cid_len is \c 0. - * This parameter is unused if \p enabled is set to + * This parameter is unused if \p enable is set to * MBEDTLS_SSL_CID_DISABLED. * \param own_cid_len The length of \p own_cid. - * This parameter is unused if \p enabled is set to + * This parameter is unused if \p enable is set to * MBEDTLS_SSL_CID_DISABLED. * * \note The value of \p own_cid_len must match the value of the @@ -2573,8 +2564,8 @@ int mbedtls_ssl_session_load(mbedtls_ssl_session *session, * * \param session The session structure to be saved. * \param buf The buffer to write the serialized data to. It must be a - * writeable buffer of at least \p len bytes, or may be \c - * NULL if \p len is \c 0. + * writeable buffer of at least \p buf_len bytes, or may be \c + * NULL if \p buf_len is \c 0. * \param buf_len The number of bytes available for writing in \p buf. * \param olen The size in bytes of the data that has been or would have * been written. It must point to a valid \c size_t. @@ -2659,7 +2650,7 @@ void mbedtls_ssl_conf_ciphersuites(mbedtls_ssl_config *conf, * record headers. * * \return \c 0 on success. - * \return #MBEDTLS_ERR_SSL_BAD_INPUT_DATA if \p own_cid_len + * \return #MBEDTLS_ERR_SSL_BAD_INPUT_DATA if \p len * is too large. */ int mbedtls_ssl_conf_cid(mbedtls_ssl_config *conf, size_t len, diff --git a/c++/src/connect/mbedtls/mbedtls/ssl_cache.h b/c++/src/connect/mbedtls/mbedtls/ssl_cache.h index e358c6c7..cadb30c1 100644 --- a/c++/src/connect/mbedtls/mbedtls/ssl_cache.h +++ b/c++/src/connect/mbedtls/mbedtls/ssl_cache.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_SSL_CACHE_H #define MBEDTLS_SSL_CACHE_H @@ -99,6 +87,11 @@ void mbedtls_ssl_cache_init(mbedtls_ssl_cache_context *cache); * * \param data SSL cache context * \param session session to retrieve entry for + * + * \return \c 0 on success. + * \return #MBEDTLS_ERR_SSL_CACHE_ENTRY_NOT_FOUND if there is + * no cache entry with specified session ID found, or + * any other negative error code for other failures. */ int mbedtls_ssl_cache_get(void *data, mbedtls_ssl_session *session); @@ -108,6 +101,9 @@ int mbedtls_ssl_cache_get(void *data, mbedtls_ssl_session *session); * * \param data SSL cache context * \param session session to store entry for + * + * \return \c 0 on success. + * \return A negative error code on failure. */ int mbedtls_ssl_cache_set(void *data, const mbedtls_ssl_session *session); diff --git a/c++/src/connect/mbedtls/mbedtls/ssl_ciphersuites.h b/c++/src/connect/mbedtls/mbedtls/ssl_ciphersuites.h index 5300125f..199014f5 100644 --- a/c++/src/connect/mbedtls/mbedtls/ssl_ciphersuites.h +++ b/c++/src/connect/mbedtls/mbedtls/ssl_ciphersuites.h @@ -1,23 +1,11 @@ /** * \file ssl_ciphersuites.h * - * \brief SSL Ciphersuites for mbed TLS + * \brief SSL Ciphersuites for Mbed TLS */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_SSL_CIPHERSUITES_H #define MBEDTLS_SSL_CIPHERSUITES_H diff --git a/c++/src/connect/mbedtls/mbedtls/ssl_cookie.h b/c++/src/connect/mbedtls/mbedtls/ssl_cookie.h index 334c005a..85a1b4ac 100644 --- a/c++/src/connect/mbedtls/mbedtls/ssl_cookie.h +++ b/c++/src/connect/mbedtls/mbedtls/ssl_cookie.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_SSL_COOKIE_H #define MBEDTLS_SSL_COOKIE_H diff --git a/c++/src/connect/mbedtls/mbedtls/ssl_internal.h b/c++/src/connect/mbedtls/mbedtls/ssl_internal.h index ff345c14..a75cc8e5 100644 --- a/c++/src/connect/mbedtls/mbedtls/ssl_internal.h +++ b/c++/src/connect/mbedtls/mbedtls/ssl_internal.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_SSL_INTERNAL_H #define MBEDTLS_SSL_INTERNAL_H diff --git a/c++/src/connect/mbedtls/mbedtls/ssl_ticket.h b/c++/src/connect/mbedtls/mbedtls/ssl_ticket.h index 401df7c8..ad159235 100644 --- a/c++/src/connect/mbedtls/mbedtls/ssl_ticket.h +++ b/c++/src/connect/mbedtls/mbedtls/ssl_ticket.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_SSL_TICKET_H #define MBEDTLS_SSL_TICKET_H diff --git a/c++/src/connect/mbedtls/mbedtls/threading.h b/c++/src/connect/mbedtls/mbedtls/threading.h index 25de77e7..2a03afee 100644 --- a/c++/src/connect/mbedtls/mbedtls/threading.h +++ b/c++/src/connect/mbedtls/mbedtls/threading.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_THREADING_H #define MBEDTLS_THREADING_H @@ -63,9 +51,9 @@ typedef struct mbedtls_threading_mutex_t { * \brief Set your alternate threading implementation function * pointers and initialize global mutexes. If used, this * function must be called once in the main thread before any - * other mbed TLS function is called, and + * other Mbed TLS function is called, and * mbedtls_threading_free_alt() must be called once in the main - * thread after all other mbed TLS functions. + * thread after all other Mbed TLS functions. * * \note mutex_init() and mutex_free() don't return a status code. * If mutex_init() fails, it should leave its argument (the diff --git a/c++/src/connect/mbedtls/mbedtls/timing.h b/c++/src/connect/mbedtls/mbedtls/timing.h index 597ef752..bbc8fff7 100644 --- a/c++/src/connect/mbedtls/mbedtls/timing.h +++ b/c++/src/connect/mbedtls/mbedtls/timing.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_TIMING_H #define MBEDTLS_TIMING_H diff --git a/c++/src/connect/mbedtls/mbedtls/version.h b/c++/src/connect/mbedtls/mbedtls/version.h index 0ef52138..bbe76b17 100644 --- a/c++/src/connect/mbedtls/mbedtls/version.h +++ b/c++/src/connect/mbedtls/mbedtls/version.h @@ -5,23 +5,11 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * This set of compile-time defines and run-time variables can be used to - * determine the version number of the mbed TLS library used. + * determine the version number of the Mbed TLS library used. */ #ifndef MBEDTLS_VERSION_H #define MBEDTLS_VERSION_H @@ -38,16 +26,16 @@ */ #define MBEDTLS_VERSION_MAJOR 2 #define MBEDTLS_VERSION_MINOR 28 -#define MBEDTLS_VERSION_PATCH 3 +#define MBEDTLS_VERSION_PATCH 8 /** * The single version number has the following structure: * MMNNPP00 * Major version | Minor version | Patch version */ -#define MBEDTLS_VERSION_NUMBER 0x021C0300 -#define MBEDTLS_VERSION_STRING "2.28.3" -#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.28.3" +#define MBEDTLS_VERSION_NUMBER 0x021C0800 +#define MBEDTLS_VERSION_STRING "2.28.8" +#define MBEDTLS_VERSION_STRING_FULL "Mbed TLS 2.28.8" #if defined(MBEDTLS_VERSION_C) @@ -72,9 +60,9 @@ unsigned int mbedtls_version_get_number(void); void mbedtls_version_get_string(char *string); /** - * Get the full version string ("mbed TLS x.y.z"). + * Get the full version string ("Mbed TLS x.y.z"). * - * \param string The string that will receive the value. The mbed TLS version + * \param string The string that will receive the value. The Mbed TLS version * string will use 18 bytes AT MOST including a terminating * null byte. * (So the buffer should be at least 18 bytes to receive this @@ -84,12 +72,12 @@ void mbedtls_version_get_string_full(char *string); /** * \brief Check if support for a feature was compiled into this - * mbed TLS binary. This allows you to see at runtime if the + * Mbed TLS binary. This allows you to see at runtime if the * library was for instance compiled with or without * Multi-threading support. * * \note only checks against defines in the sections "System - * support", "mbed TLS modules" and "mbed TLS feature + * support", "Mbed TLS modules" and "Mbed TLS feature * support" in config.h * * \param feature The string for the define to check (e.g. "MBEDTLS_AES_C") diff --git a/c++/src/connect/mbedtls/mbedtls/x509.h b/c++/src/connect/mbedtls/mbedtls/x509.h index 8fd321a0..bde998c3 100644 --- a/c++/src/connect/mbedtls/mbedtls/x509.h +++ b/c++/src/connect/mbedtls/mbedtls/x509.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_X509_H #define MBEDTLS_X509_H @@ -361,7 +349,8 @@ int mbedtls_x509_write_names(unsigned char **p, unsigned char *start, mbedtls_asn1_named_data *first); int mbedtls_x509_write_sig(unsigned char **p, unsigned char *start, const char *oid, size_t oid_len, - unsigned char *sig, size_t size); + unsigned char *sig, size_t size, + mbedtls_pk_type_t pk_alg); #define MBEDTLS_X509_SAFE_SNPRINTF \ do { \ diff --git a/c++/src/connect/mbedtls/mbedtls/x509_crl.h b/c++/src/connect/mbedtls/mbedtls/x509_crl.h index 14050214..9f755f85 100644 --- a/c++/src/connect/mbedtls/mbedtls/x509_crl.h +++ b/c++/src/connect/mbedtls/mbedtls/x509_crl.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_X509_CRL_H #define MBEDTLS_X509_CRL_H diff --git a/c++/src/connect/mbedtls/mbedtls/x509_crt.h b/c++/src/connect/mbedtls/mbedtls/x509_crt.h index 466611f7..e6d6a2cc 100644 --- a/c++/src/connect/mbedtls/mbedtls/x509_crt.h +++ b/c++/src/connect/mbedtls/mbedtls/x509_crt.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_X509_CRT_H #define MBEDTLS_X509_CRT_H @@ -509,7 +497,7 @@ int mbedtls_x509_crt_parse_path(mbedtls_x509_crt *chain, const char *path); * \param san_buf The buffer holding the raw data item of the subject * alternative name. * \param san The target structure to populate with the parsed presentation - * of the subject alternative name encoded in \p san_raw. + * of the subject alternative name encoded in \p san_buf. * * \note Only "dnsName" and "otherName" of type hardware_module_name * as defined in RFC 4180 is supported. @@ -517,7 +505,7 @@ int mbedtls_x509_crt_parse_path(mbedtls_x509_crt *chain, const char *path); * \note This function should be called on a single raw data of * subject alternative name. For example, after successful * certificate parsing, one must iterate on every item in the - * \p crt->subject_alt_names sequence, and pass it to + * \c crt->subject_alt_names sequence, and pass it to * this function. * * \warning The target structure contains pointers to the raw data of the @@ -914,7 +902,7 @@ int mbedtls_x509write_crt_set_validity(mbedtls_x509write_cert *ctx, const char * * \brief Set the issuer name for a Certificate * Issuer names should contain a comma-separated list * of OID types and values: - * e.g. "C=UK,O=ARM,CN=mbed TLS CA" + * e.g. "C=UK,O=ARM,CN=Mbed TLS CA" * * \param ctx CRT context to use * \param issuer_name issuer name to set @@ -929,7 +917,7 @@ int mbedtls_x509write_crt_set_issuer_name(mbedtls_x509write_cert *ctx, * \brief Set the subject name for a Certificate * Subject names should contain a comma-separated list * of OID types and values: - * e.g. "C=UK,O=ARM,CN=mbed TLS Server 1" + * e.g. "C=UK,O=ARM,CN=Mbed TLS Server 1" * * \param ctx CRT context to use * \param subject_name subject name to set diff --git a/c++/src/connect/mbedtls/mbedtls/x509_csr.h b/c++/src/connect/mbedtls/mbedtls/x509_csr.h index 5975584d..97a9db44 100644 --- a/c++/src/connect/mbedtls/mbedtls/x509_csr.h +++ b/c++/src/connect/mbedtls/mbedtls/x509_csr.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_X509_CSR_H #define MBEDTLS_X509_CSR_H @@ -171,7 +159,7 @@ void mbedtls_x509write_csr_init(mbedtls_x509write_csr *ctx); * \brief Set the subject name for a CSR * Subject names should contain a comma-separated list * of OID types and values: - * e.g. "C=UK,O=ARM,CN=mbed TLS Server 1" + * e.g. "C=UK,O=ARM,CN=Mbed TLS Server 1" * * \param ctx CSR context to use * \param subject_name subject name to set diff --git a/c++/src/connect/mbedtls/mbedtls/xtea.h b/c++/src/connect/mbedtls/mbedtls/xtea.h index 9b12a1bb..b7242c74 100644 --- a/c++/src/connect/mbedtls/mbedtls/xtea.h +++ b/c++/src/connect/mbedtls/mbedtls/xtea.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_XTEA_H #define MBEDTLS_XTEA_H diff --git a/c++/src/connect/mbedtls/mbedtls_md5.c b/c++/src/connect/mbedtls/mbedtls_md5.c index fb47486f..4ad24fc8 100644 --- a/c++/src/connect/mbedtls/mbedtls_md5.c +++ b/c++/src/connect/mbedtls/mbedtls_md5.c @@ -2,19 +2,7 @@ * RFC 1321 compliant MD5 implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The MD5 algorithm was designed by Ron Rivest in 1991. diff --git a/c++/src/connect/mbedtls/mbedtls_version.c b/c++/src/connect/mbedtls/mbedtls_version.c index 4f78c9cb..04397332 100644 --- a/c++/src/connect/mbedtls/mbedtls_version.c +++ b/c++/src/connect/mbedtls/mbedtls_version.c @@ -2,19 +2,7 @@ * Version information * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/md.c b/c++/src/connect/mbedtls/md.c index 1e24ee45..3e4a1c10 100644 --- a/c++/src/connect/mbedtls/md.c +++ b/c++/src/connect/mbedtls/md.c @@ -1,24 +1,12 @@ /** * \file md.c * - * \brief Generic message digest wrapper for mbed TLS + * \brief Generic message digest wrapper for Mbed TLS * * \author Adriaan de Jong * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/md2.c b/c++/src/connect/mbedtls/md2.c index f009498c..b552d5f7 100644 --- a/c++/src/connect/mbedtls/md2.c +++ b/c++/src/connect/mbedtls/md2.c @@ -2,19 +2,7 @@ * RFC 1115/1319 compliant MD2 implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The MD2 algorithm was designed by Ron Rivest in 1989. diff --git a/c++/src/connect/mbedtls/md4.c b/c++/src/connect/mbedtls/md4.c index 163afb1d..8de85fba 100644 --- a/c++/src/connect/mbedtls/md4.c +++ b/c++/src/connect/mbedtls/md4.c @@ -2,19 +2,7 @@ * RFC 1186/1320 compliant MD4 implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The MD4 algorithm was designed by Ron Rivest in 1990. diff --git a/c++/src/connect/mbedtls/memory_buffer_alloc.c b/c++/src/connect/mbedtls/memory_buffer_alloc.c index bdde4e0b..d6a47ba9 100644 --- a/c++/src/connect/mbedtls/memory_buffer_alloc.c +++ b/c++/src/connect/mbedtls/memory_buffer_alloc.c @@ -2,19 +2,7 @@ * Buffer-based memory allocator * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/mps_common.h b/c++/src/connect/mbedtls/mps_common.h index 4a10176b..a41eb9aa 100644 --- a/c++/src/connect/mbedtls/mps_common.h +++ b/c++/src/connect/mbedtls/mps_common.h @@ -1,20 +1,6 @@ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This file is part of mbed TLS (https://tls.mbed.org) + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /** diff --git a/c++/src/connect/mbedtls/mps_error.h b/c++/src/connect/mbedtls/mps_error.h index 15570d23..016a84ce 100644 --- a/c++/src/connect/mbedtls/mps_error.h +++ b/c++/src/connect/mbedtls/mps_error.h @@ -1,20 +1,6 @@ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This file is part of mbed TLS (https://tls.mbed.org) + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /** diff --git a/c++/src/connect/mbedtls/mps_reader.c b/c++/src/connect/mbedtls/mps_reader.c index 75c563ad..36ca070e 100644 --- a/c++/src/connect/mbedtls/mps_reader.c +++ b/c++/src/connect/mbedtls/mps_reader.c @@ -2,21 +2,7 @@ * Message Processing Stack, Reader implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This file is part of Mbed TLS (https://tls.mbed.org) + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/mps_reader.h b/c++/src/connect/mbedtls/mps_reader.h index bff67050..3193a5e3 100644 --- a/c++/src/connect/mbedtls/mps_reader.h +++ b/c++/src/connect/mbedtls/mps_reader.h @@ -1,20 +1,6 @@ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This file is part of mbed TLS (https://tls.mbed.org) + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /** diff --git a/c++/src/connect/mbedtls/mps_trace.c b/c++/src/connect/mbedtls/mps_trace.c index ccd944f5..4f580d71 100644 --- a/c++/src/connect/mbedtls/mps_trace.c +++ b/c++/src/connect/mbedtls/mps_trace.c @@ -2,21 +2,7 @@ * Message Processing Stack, Trace module * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This file is part of Mbed TLS (https://tls.mbed.org) + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/mps_trace.h b/c++/src/connect/mbedtls/mps_trace.h index 6f0455f0..b456b2ff 100644 --- a/c++/src/connect/mbedtls/mps_trace.h +++ b/c++/src/connect/mbedtls/mps_trace.h @@ -1,20 +1,6 @@ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This file is part of mbed TLS (https://tls.mbed.org) + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /** diff --git a/c++/src/connect/mbedtls/net_sockets.c b/c++/src/connect/mbedtls/net_sockets.c index bdd82ac6..5d985ef0 100644 --- a/c++/src/connect/mbedtls/net_sockets.c +++ b/c++/src/connect/mbedtls/net_sockets.c @@ -2,19 +2,7 @@ * TCP/IP or UDP/IP networking functions * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* Enable definition of getaddrinfo() even when compiling with -std=c99. Must @@ -90,6 +78,7 @@ static int wsa_init_done = 0; #include #define IS_EINTR(ret) ((ret) == EINTR) +#define SOCKET int #endif /* ( _WIN32 || _WIN32_WCE ) && !EFIX64 && !EFI32 */ @@ -332,7 +321,7 @@ static int net_would_block(const mbedtls_net_context *ctx) */ int mbedtls_net_accept(mbedtls_net_context *bind_ctx, mbedtls_net_context *client_ctx, - void *client_ip, size_t buf_size, size_t *ip_len) + void *client_ip, size_t buf_size, size_t *cip_len) { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; int type; @@ -415,22 +404,22 @@ int mbedtls_net_accept(mbedtls_net_context *bind_ctx, if (client_ip != NULL) { if (client_addr.ss_family == AF_INET) { struct sockaddr_in *addr4 = (struct sockaddr_in *) &client_addr; - *ip_len = sizeof(addr4->sin_addr.s_addr); + *cip_len = sizeof(addr4->sin_addr.s_addr); - if (buf_size < *ip_len) { + if (buf_size < *cip_len) { return MBEDTLS_ERR_NET_BUFFER_TOO_SMALL; } - memcpy(client_ip, &addr4->sin_addr.s_addr, *ip_len); + memcpy(client_ip, &addr4->sin_addr.s_addr, *cip_len); } else { struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *) &client_addr; - *ip_len = sizeof(addr6->sin6_addr.s6_addr); + *cip_len = sizeof(addr6->sin6_addr.s6_addr); - if (buf_size < *ip_len) { + if (buf_size < *cip_len) { return MBEDTLS_ERR_NET_BUFFER_TOO_SMALL; } - memcpy(client_ip, &addr6->sin6_addr.s6_addr, *ip_len); + memcpy(client_ip, &addr6->sin6_addr.s6_addr, *cip_len); } } @@ -494,13 +483,13 @@ int mbedtls_net_poll(mbedtls_net_context *ctx, uint32_t rw, uint32_t timeout) FD_ZERO(&read_fds); if (rw & MBEDTLS_NET_POLL_READ) { rw &= ~MBEDTLS_NET_POLL_READ; - FD_SET(fd, &read_fds); + FD_SET((SOCKET) fd, &read_fds); } FD_ZERO(&write_fds); if (rw & MBEDTLS_NET_POLL_WRITE) { rw &= ~MBEDTLS_NET_POLL_WRITE; - FD_SET(fd, &write_fds); + FD_SET((SOCKET) fd, &write_fds); } if (rw != 0) { @@ -608,7 +597,7 @@ int mbedtls_net_recv_timeout(void *ctx, unsigned char *buf, } FD_ZERO(&read_fds); - FD_SET(fd, &read_fds); + FD_SET((SOCKET) fd, &read_fds); tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; diff --git a/c++/src/connect/mbedtls/nist_kw.c b/c++/src/connect/mbedtls/nist_kw.c index 5817bf4f..5a5b995c 100644 --- a/c++/src/connect/mbedtls/nist_kw.c +++ b/c++/src/connect/mbedtls/nist_kw.c @@ -3,19 +3,7 @@ * only * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * Definition of Key Wrapping: @@ -35,6 +23,7 @@ #include "mbedtls/platform_util.h" #include "mbedtls/error.h" #include "mbedtls/constant_time.h" +#include "constant_time_internal.h" #include #include @@ -335,7 +324,7 @@ int mbedtls_nist_kw_unwrap(mbedtls_nist_kw_context *ctx, int ret = 0; size_t i, olen; unsigned char A[KW_SEMIBLOCK_LENGTH]; - unsigned char diff, bad_padding = 0; + unsigned char diff; *out_len = 0; if (out_size < in_len - KW_SEMIBLOCK_LENGTH) { @@ -420,18 +409,13 @@ int mbedtls_nist_kw_unwrap(mbedtls_nist_kw_context *ctx, * larger than 8, because of the type wrap around. */ padlen = in_len - KW_SEMIBLOCK_LENGTH - Plen; - if (padlen > 7) { - padlen &= 7; - ret = MBEDTLS_ERR_CIPHER_AUTH_FAILED; - } + ret = -(int) mbedtls_ct_uint_if(padlen & ~7, -MBEDTLS_ERR_CIPHER_AUTH_FAILED, -ret); + padlen &= 7; /* Check padding in "constant-time" */ for (diff = 0, i = 0; i < KW_SEMIBLOCK_LENGTH; i++) { - if (i >= KW_SEMIBLOCK_LENGTH - padlen) { - diff |= output[*out_len - KW_SEMIBLOCK_LENGTH + i]; - } else { - bad_padding |= output[*out_len - KW_SEMIBLOCK_LENGTH + i]; - } + size_t mask = mbedtls_ct_size_mask_ge(i, KW_SEMIBLOCK_LENGTH - padlen); + diff |= (unsigned char) (mask & output[*out_len - KW_SEMIBLOCK_LENGTH + i]); } if (diff != 0) { @@ -454,7 +438,6 @@ cleanup: *out_len = 0; } - mbedtls_platform_zeroize(&bad_padding, sizeof(bad_padding)); mbedtls_platform_zeroize(&diff, sizeof(diff)); mbedtls_platform_zeroize(A, sizeof(A)); diff --git a/c++/src/connect/mbedtls/oid.c b/c++/src/connect/mbedtls/oid.c index 12a96503..7d7f1bfd 100644 --- a/c++/src/connect/mbedtls/oid.c +++ b/c++/src/connect/mbedtls/oid.c @@ -4,19 +4,7 @@ * \brief Object Identifier (OID) database * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/padlock.c b/c++/src/connect/mbedtls/padlock.c index 303f82c7..0b4b610f 100644 --- a/c++/src/connect/mbedtls/padlock.c +++ b/c++/src/connect/mbedtls/padlock.c @@ -2,19 +2,7 @@ * VIA PadLock support functions * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * This implementation is based on the VIA PadLock Programming Guide: @@ -37,7 +25,7 @@ #endif /* *INDENT-ON* */ -#if defined(MBEDTLS_HAVE_X86) +#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE) /* * PadLock detection routine @@ -161,6 +149,6 @@ int mbedtls_padlock_xcryptcbc(mbedtls_aes_context *ctx, return 0; } -#endif /* MBEDTLS_HAVE_X86 */ +#endif /* MBEDTLS_VIA_PADLOCK_HAVE_CODE */ #endif /* MBEDTLS_PADLOCK_C */ diff --git a/c++/src/connect/mbedtls/pem.c b/c++/src/connect/mbedtls/pem.c index 3b9a3e91..c1a47b0d 100644 --- a/c++/src/connect/mbedtls/pem.c +++ b/c++/src/connect/mbedtls/pem.c @@ -2,19 +2,7 @@ * Privacy Enhanced Mail (PEM) decoding * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/pk.c b/c++/src/connect/mbedtls/pk.c index d46a9346..6b5008df 100644 --- a/c++/src/connect/mbedtls/pk.c +++ b/c++/src/connect/mbedtls/pk.c @@ -2,19 +2,7 @@ * Public Key abstraction layer * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" @@ -646,6 +634,7 @@ int mbedtls_pk_wrap_as_opaque(mbedtls_pk_context *pk, psa_key_type_t key_type; size_t bits; int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; + psa_status_t status; /* export the private key material in the format PSA wants */ if (mbedtls_pk_get_type(pk) != MBEDTLS_PK_ECKEY) { @@ -668,7 +657,9 @@ int mbedtls_pk_wrap_as_opaque(mbedtls_pk_context *pk, psa_set_key_algorithm(&attributes, PSA_ALG_ECDSA(hash_alg)); /* import private key into PSA */ - if (PSA_SUCCESS != psa_import_key(&attributes, d, d_len, key)) { + status = psa_import_key(&attributes, d, d_len, key); + mbedtls_platform_zeroize(d, sizeof(d)); + if (status != PSA_SUCCESS) { return MBEDTLS_ERR_PK_HW_ACCEL_FAILED; } diff --git a/c++/src/connect/mbedtls/pk_wrap.c b/c++/src/connect/mbedtls/pk_wrap.c index f577fccd..dd460a6a 100644 --- a/c++/src/connect/mbedtls/pk_wrap.c +++ b/c++/src/connect/mbedtls/pk_wrap.c @@ -2,19 +2,7 @@ * Public Key abstraction layer: wrapper functions * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" @@ -65,7 +53,23 @@ static int rsa_can_do(mbedtls_pk_type_t type) static size_t rsa_get_bitlen(const void *ctx) { const mbedtls_rsa_context *rsa = (const mbedtls_rsa_context *) ctx; - return 8 * mbedtls_rsa_get_len(rsa); + /* Unfortunately, the rsa.h interface does not have a direct way + * to access the bit-length that works with MBEDTLS_RSA_ALT. + * So we have to do a little work here. + */ + mbedtls_mpi N; + mbedtls_mpi_init(&N); + int ret = mbedtls_rsa_export(rsa, &N, NULL, NULL, NULL, NULL); + /* If the export fails for some reason (e.g. the RSA_ALT implementation + * does not support export, or there is not enough memory), + * we have no way of returning an error from this function. + * As a fallback, return the byte-length converted in bits, which is + * the correct value if the modulus size is a multiple of 8 bits, which + * is very often the case in practice. */ + size_t bitlen = (ret == 0 ? mbedtls_mpi_bitlen(&N) : + 8 * mbedtls_rsa_get_len(rsa)); + mbedtls_mpi_free(&N); + return bitlen; } static int rsa_verify_wrap(void *ctx, mbedtls_md_type_t md_alg, diff --git a/c++/src/connect/mbedtls/pkcs11.c b/c++/src/connect/mbedtls/pkcs11.c index 8ba40caf..45ea4afc 100644 --- a/c++/src/connect/mbedtls/pkcs11.c +++ b/c++/src/connect/mbedtls/pkcs11.c @@ -6,19 +6,7 @@ * \author Adriaan de Jong * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "mbedtls/pkcs11.h" diff --git a/c++/src/connect/mbedtls/pkcs12.c b/c++/src/connect/mbedtls/pkcs12.c index 039026b2..55de216e 100644 --- a/c++/src/connect/mbedtls/pkcs12.c +++ b/c++/src/connect/mbedtls/pkcs12.c @@ -2,19 +2,7 @@ * PKCS#12 Personal Information Exchange Syntax * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The PKCS #12 Personal Information Exchange Syntax Standard v1.1 @@ -172,18 +160,46 @@ exit: #endif /* MBEDTLS_ARC4_C */ } +#if !defined(MBEDTLS_CIPHER_PADDING_PKCS7) +int mbedtls_pkcs12_pbe_ext(mbedtls_asn1_buf *pbe_params, int mode, + mbedtls_cipher_type_t cipher_type, mbedtls_md_type_t md_type, + const unsigned char *pwd, size_t pwdlen, + const unsigned char *data, size_t len, + unsigned char *output, size_t output_size, + size_t *output_len); +#endif + int mbedtls_pkcs12_pbe(mbedtls_asn1_buf *pbe_params, int mode, mbedtls_cipher_type_t cipher_type, mbedtls_md_type_t md_type, const unsigned char *pwd, size_t pwdlen, const unsigned char *data, size_t len, unsigned char *output) +{ + size_t output_len = 0; + + /* We assume caller of the function is providing a big enough output buffer + * so we pass output_size as SIZE_MAX to pass checks, However, no guarantees + * for the output size actually being correct. + */ + return mbedtls_pkcs12_pbe_ext(pbe_params, mode, cipher_type, md_type, + pwd, pwdlen, data, len, output, SIZE_MAX, + &output_len); +} + +int mbedtls_pkcs12_pbe_ext(mbedtls_asn1_buf *pbe_params, int mode, + mbedtls_cipher_type_t cipher_type, mbedtls_md_type_t md_type, + const unsigned char *pwd, size_t pwdlen, + const unsigned char *data, size_t len, + unsigned char *output, size_t output_size, + size_t *output_len) { int ret, keylen = 0; unsigned char key[32]; unsigned char iv[16]; const mbedtls_cipher_info_t *cipher_info; mbedtls_cipher_context_t cipher_ctx; - size_t olen = 0; + size_t finish_olen = 0; + unsigned int padlen = 0; if (pwd == NULL && pwdlen != 0) { return MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA; @@ -196,6 +212,19 @@ int mbedtls_pkcs12_pbe(mbedtls_asn1_buf *pbe_params, int mode, keylen = cipher_info->key_bitlen / 8; + if (mode == MBEDTLS_PKCS12_PBE_DECRYPT) { + if (output_size < len) { + return MBEDTLS_ERR_ASN1_BUF_TOO_SMALL; + } + } + + if (mode == MBEDTLS_PKCS12_PBE_ENCRYPT) { + padlen = cipher_info->block_size - (len % cipher_info->block_size); + if (output_size < (len + padlen)) { + return MBEDTLS_ERR_ASN1_BUF_TOO_SMALL; + } + } + if ((ret = pkcs12_pbe_derive_key_iv(pbe_params, md_type, pwd, pwdlen, key, keylen, iv, cipher_info->iv_size)) != 0) { @@ -214,6 +243,26 @@ int mbedtls_pkcs12_pbe(mbedtls_asn1_buf *pbe_params, int mode, goto exit; } +#if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING) + { + /* PKCS12 uses CBC with PKCS7 padding */ + mbedtls_cipher_padding_t padding = MBEDTLS_PADDING_PKCS7; +#if !defined(MBEDTLS_CIPHER_PADDING_PKCS7) + /* For historical reasons, when decrypting, this function works when + * decrypting even when support for PKCS7 padding is disabled. In this + * case, it ignores the padding, and so will never report a + * password mismatch. + */ + if (mode == MBEDTLS_PKCS12_PBE_DECRYPT) { + padding = MBEDTLS_PADDING_NONE; + } +#endif + if ((ret = mbedtls_cipher_set_padding_mode(&cipher_ctx, padding)) != 0) { + goto exit; + } + } +#endif /* MBEDTLS_CIPHER_MODE_WITH_PADDING */ + if ((ret = mbedtls_cipher_set_iv(&cipher_ctx, iv, cipher_info->iv_size)) != 0) { goto exit; } @@ -223,14 +272,16 @@ int mbedtls_pkcs12_pbe(mbedtls_asn1_buf *pbe_params, int mode, } if ((ret = mbedtls_cipher_update(&cipher_ctx, data, len, - output, &olen)) != 0) { + output, output_len)) != 0) { goto exit; } - if ((ret = mbedtls_cipher_finish(&cipher_ctx, output + olen, &olen)) != 0) { + if ((ret = mbedtls_cipher_finish(&cipher_ctx, output + (*output_len), &finish_olen)) != 0) { ret = MBEDTLS_ERR_PKCS12_PASSWORD_MISMATCH; } + *output_len += finish_olen; + exit: mbedtls_platform_zeroize(key, sizeof(key)); mbedtls_platform_zeroize(iv, sizeof(iv)); diff --git a/c++/src/connect/mbedtls/pkcs5.c b/c++/src/connect/mbedtls/pkcs5.c index 52f1a0df..90703c45 100644 --- a/c++/src/connect/mbedtls/pkcs5.c +++ b/c++/src/connect/mbedtls/pkcs5.c @@ -6,19 +6,7 @@ * \author Mathias Olsson * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * PKCS#5 includes PBKDF2 and more @@ -44,6 +32,7 @@ #include "mbedtls/platform.h" + #if defined(MBEDTLS_ASN1_PARSE_C) static int pkcs5_parse_pbkdf2_params(const mbedtls_asn1_buf *params, mbedtls_asn1_buf *salt, int *iterations, @@ -109,10 +98,34 @@ static int pkcs5_parse_pbkdf2_params(const mbedtls_asn1_buf *params, return 0; } +#if !defined(MBEDTLS_CIPHER_PADDING_PKCS7) +int mbedtls_pkcs5_pbes2_ext(const mbedtls_asn1_buf *pbe_params, int mode, + const unsigned char *pwd, size_t pwdlen, + const unsigned char *data, size_t datalen, + unsigned char *output, size_t output_size, + size_t *output_len); +#endif + int mbedtls_pkcs5_pbes2(const mbedtls_asn1_buf *pbe_params, int mode, const unsigned char *pwd, size_t pwdlen, const unsigned char *data, size_t datalen, unsigned char *output) +{ + size_t output_len = 0; + + /* We assume caller of the function is providing a big enough output buffer + * so we pass output_size as SIZE_MAX to pass checks, However, no guarantees + * for the output size actually being correct. + */ + return mbedtls_pkcs5_pbes2_ext(pbe_params, mode, pwd, pwdlen, data, + datalen, output, SIZE_MAX, &output_len); +} + +int mbedtls_pkcs5_pbes2_ext(const mbedtls_asn1_buf *pbe_params, int mode, + const unsigned char *pwd, size_t pwdlen, + const unsigned char *data, size_t datalen, + unsigned char *output, size_t output_size, + size_t *output_len) { int ret, iterations = 0, keylen = 0; unsigned char *p, *end; @@ -120,12 +133,12 @@ int mbedtls_pkcs5_pbes2(const mbedtls_asn1_buf *pbe_params, int mode, mbedtls_asn1_buf salt; mbedtls_md_type_t md_type = MBEDTLS_MD_SHA1; unsigned char key[32], iv[32]; - size_t olen = 0; const mbedtls_md_info_t *md_info; const mbedtls_cipher_info_t *cipher_info; mbedtls_md_context_t md_ctx; mbedtls_cipher_type_t cipher_alg; mbedtls_cipher_context_t cipher_ctx; + unsigned int padlen = 0; p = pbe_params->p; end = p + pbe_params->len; @@ -188,7 +201,21 @@ int mbedtls_pkcs5_pbes2(const mbedtls_asn1_buf *pbe_params, int mode, return MBEDTLS_ERR_PKCS5_INVALID_FORMAT; } + if (mode == MBEDTLS_PKCS5_DECRYPT) { + if (output_size < datalen) { + return MBEDTLS_ERR_ASN1_BUF_TOO_SMALL; + } + } + + if (mode == MBEDTLS_PKCS5_ENCRYPT) { + padlen = cipher_info->block_size - (datalen % cipher_info->block_size); + if (output_size < (datalen + padlen)) { + return MBEDTLS_ERR_ASN1_BUF_TOO_SMALL; + } + } + mbedtls_md_init(&md_ctx); + mbedtls_cipher_init(&cipher_ctx); memcpy(iv, enc_scheme_params.p, enc_scheme_params.len); @@ -211,8 +238,30 @@ int mbedtls_pkcs5_pbes2(const mbedtls_asn1_buf *pbe_params, int mode, goto exit; } +#if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING) + { + /* PKCS5 uses CBC with PKCS7 padding (which is the same as + * "PKCS5 padding" except that it's typically only called PKCS5 + * with 64-bit-block ciphers). + */ + mbedtls_cipher_padding_t padding = MBEDTLS_PADDING_PKCS7; +#if !defined(MBEDTLS_CIPHER_PADDING_PKCS7) + /* For historical reasons, when decrypting, this function works when + * decrypting even when support for PKCS7 padding is disabled. In this + * case, it ignores the padding, and so will never report a + * password mismatch. + */ + if (mode == MBEDTLS_DECRYPT) { + padding = MBEDTLS_PADDING_NONE; + } +#endif + if ((ret = mbedtls_cipher_set_padding_mode(&cipher_ctx, padding)) != 0) { + goto exit; + } + } +#endif /* MBEDTLS_CIPHER_MODE_WITH_PADDING */ if ((ret = mbedtls_cipher_crypt(&cipher_ctx, iv, enc_scheme_params.len, - data, datalen, output, &olen)) != 0) { + data, datalen, output, output_len)) != 0) { ret = MBEDTLS_ERR_PKCS5_PASSWORD_MISMATCH; } diff --git a/c++/src/connect/mbedtls/pkparse.c b/c++/src/connect/mbedtls/pkparse.c index deaff0b3..37d50164 100644 --- a/c++/src/connect/mbedtls/pkparse.c +++ b/c++/src/connect/mbedtls/pkparse.c @@ -2,19 +2,7 @@ * Public Key layer for parsing key files and structures * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" @@ -1235,6 +1223,8 @@ int mbedtls_pk_parse_key(mbedtls_pk_context *pk, mbedtls_pem_context pem; #endif + (void) pk_info; + PK_VALIDATE_RET(pk != NULL); if (keylen == 0) { return MBEDTLS_ERR_PK_KEY_INVALID_FORMAT; diff --git a/c++/src/connect/mbedtls/pkwrite.c b/c++/src/connect/mbedtls/pkwrite.c index 0107f20b..534290df 100644 --- a/c++/src/connect/mbedtls/pkwrite.c +++ b/c++/src/connect/mbedtls/pkwrite.c @@ -2,19 +2,7 @@ * Public Key layer for writing key files and structures * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" @@ -178,6 +166,11 @@ int mbedtls_pk_write_pubkey(unsigned char **p, unsigned char *start, int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; size_t len = 0; + (void) p; + (void) start; + (void) key; + (void) ret; + PK_VALIDATE_RET(p != NULL); PK_VALIDATE_RET(*p != NULL); PK_VALIDATE_RET(start != NULL); @@ -313,6 +306,10 @@ int mbedtls_pk_write_key_der(mbedtls_pk_context *key, unsigned char *buf, size_t unsigned char *c; size_t len = 0; + (void) ret; + (void) c; + (void) key; + PK_VALIDATE_RET(key != NULL); if (size == 0) { return MBEDTLS_ERR_ASN1_BUF_TOO_SMALL; @@ -562,38 +559,49 @@ end_of_export: int mbedtls_pk_write_pubkey_pem(mbedtls_pk_context *key, unsigned char *buf, size_t size) { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; - unsigned char output_buf[PUB_DER_MAX_BYTES]; + unsigned char *output_buf = NULL; + output_buf = mbedtls_calloc(1, PUB_DER_MAX_BYTES); + if (output_buf == NULL) { + return MBEDTLS_ERR_PK_ALLOC_FAILED; + } size_t olen = 0; PK_VALIDATE_RET(key != NULL); PK_VALIDATE_RET(buf != NULL || size == 0); if ((ret = mbedtls_pk_write_pubkey_der(key, output_buf, - sizeof(output_buf))) < 0) { - return ret; + PUB_DER_MAX_BYTES)) < 0) { + goto cleanup; } if ((ret = mbedtls_pem_write_buffer(PEM_BEGIN_PUBLIC_KEY, PEM_END_PUBLIC_KEY, - output_buf + sizeof(output_buf) - ret, + output_buf + PUB_DER_MAX_BYTES - ret, ret, buf, size, &olen)) != 0) { - return ret; + goto cleanup; } - return 0; + ret = 0; +cleanup: + mbedtls_free(output_buf); + return ret; } int mbedtls_pk_write_key_pem(mbedtls_pk_context *key, unsigned char *buf, size_t size) { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; - unsigned char output_buf[PRV_DER_MAX_BYTES]; + unsigned char *output_buf = NULL; + output_buf = mbedtls_calloc(1, PRV_DER_MAX_BYTES); + if (output_buf == NULL) { + return MBEDTLS_ERR_PK_ALLOC_FAILED; + } const char *begin, *end; size_t olen = 0; PK_VALIDATE_RET(key != NULL); PK_VALIDATE_RET(buf != NULL || size == 0); - if ((ret = mbedtls_pk_write_key_der(key, output_buf, sizeof(output_buf))) < 0) { - return ret; + if ((ret = mbedtls_pk_write_key_der(key, output_buf, PRV_DER_MAX_BYTES)) < 0) { + goto cleanup; } #if defined(MBEDTLS_RSA_C) @@ -608,15 +616,22 @@ int mbedtls_pk_write_key_pem(mbedtls_pk_context *key, unsigned char *buf, size_t end = PEM_END_PRIVATE_KEY_EC; } else #endif - return MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE; + { + ret = MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE; + goto cleanup; + } if ((ret = mbedtls_pem_write_buffer(begin, end, - output_buf + sizeof(output_buf) - ret, + output_buf + PRV_DER_MAX_BYTES - ret, ret, buf, size, &olen)) != 0) { - return ret; + goto cleanup; } - return 0; + ret = 0; +cleanup: + mbedtls_platform_zeroize(output_buf, PRV_DER_MAX_BYTES); + mbedtls_free(output_buf); + return ret; } #endif /* MBEDTLS_PEM_WRITE_C */ diff --git a/c++/src/connect/mbedtls/platform.c b/c++/src/connect/mbedtls/platform.c index c8b0328d..e82cbeb6 100644 --- a/c++/src/connect/mbedtls/platform.c +++ b/c++/src/connect/mbedtls/platform.c @@ -2,19 +2,7 @@ * Platform abstraction layer * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/platform_util.c b/c++/src/connect/mbedtls/platform_util.c index 3783f0eb..df34167a 100644 --- a/c++/src/connect/mbedtls/platform_util.c +++ b/c++/src/connect/mbedtls/platform_util.c @@ -3,19 +3,7 @@ * library. * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* @@ -78,10 +66,10 @@ void mbedtls_platform_zeroize(void *buf, size_t len) #include #if !defined(_WIN32) && (defined(unix) || \ defined(__unix) || defined(__unix__) || (defined(__APPLE__) && \ - defined(__MACH__))) + defined(__MACH__)) || defined(__midipix__)) #include #endif /* !_WIN32 && (unix || __unix || __unix__ || - * (__APPLE__ && __MACH__)) */ + * (__APPLE__ && __MACH__)) || __midipix__ */ #if !((defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L) || \ (defined(_POSIX_THREAD_SAFE_FUNCTIONS) && \ diff --git a/c++/src/connect/mbedtls/poly1305.c b/c++/src/connect/mbedtls/poly1305.c index 510a45a6..c7811076 100644 --- a/c++/src/connect/mbedtls/poly1305.c +++ b/c++/src/connect/mbedtls/poly1305.c @@ -4,19 +4,7 @@ * \brief Poly1305 authentication algorithm. * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/psa/crypto.h b/c++/src/connect/mbedtls/psa/crypto.h index 3c1c109a..9e70d0ce 100644 --- a/c++/src/connect/mbedtls/psa/crypto.h +++ b/c++/src/connect/mbedtls/psa/crypto.h @@ -4,19 +4,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_H diff --git a/c++/src/connect/mbedtls/psa/crypto_builtin_composites.h b/c++/src/connect/mbedtls/psa/crypto_builtin_composites.h index 63cb1734..f51ee1c0 100644 --- a/c++/src/connect/mbedtls/psa/crypto_builtin_composites.h +++ b/c++/src/connect/mbedtls/psa/crypto_builtin_composites.h @@ -15,19 +15,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_BUILTIN_COMPOSITES_H diff --git a/c++/src/connect/mbedtls/psa/crypto_builtin_primitives.h b/c++/src/connect/mbedtls/psa/crypto_builtin_primitives.h index 6989cfed..c5f620c1 100644 --- a/c++/src/connect/mbedtls/psa/crypto_builtin_primitives.h +++ b/c++/src/connect/mbedtls/psa/crypto_builtin_primitives.h @@ -15,19 +15,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_BUILTIN_PRIMITIVES_H diff --git a/c++/src/connect/mbedtls/psa/crypto_compat.h b/c++/src/connect/mbedtls/psa/crypto_compat.h index 5cb225bd..f0146330 100644 --- a/c++/src/connect/mbedtls/psa/crypto_compat.h +++ b/c++/src/connect/mbedtls/psa/crypto_compat.h @@ -5,26 +5,14 @@ * * This header declares alternative names for macro and functions. * New application code should not use these names. - * These names may be removed in a future version of Mbed Crypto. + * These names may be removed in a future version of Mbed TLS. * * \note This file may not be included directly. Applications must * include psa/crypto.h. */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_COMPAT_H diff --git a/c++/src/connect/mbedtls/psa/crypto_config.h b/c++/src/connect/mbedtls/psa/crypto_config.h index f261e013..167ced58 100644 --- a/c++/src/connect/mbedtls/psa/crypto_config.h +++ b/c++/src/connect/mbedtls/psa/crypto_config.h @@ -32,19 +32,7 @@ #endif /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_CONFIG_H diff --git a/c++/src/connect/mbedtls/psa/crypto_driver_common.h b/c++/src/connect/mbedtls/psa/crypto_driver_common.h index 26363c6b..cc11d3b9 100644 --- a/c++/src/connect/mbedtls/psa/crypto_driver_common.h +++ b/c++/src/connect/mbedtls/psa/crypto_driver_common.h @@ -17,19 +17,7 @@ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_DRIVER_COMMON_H #define PSA_CRYPTO_DRIVER_COMMON_H diff --git a/c++/src/connect/mbedtls/psa/crypto_driver_contexts_composites.h b/c++/src/connect/mbedtls/psa/crypto_driver_contexts_composites.h index 34e6fd61..1e37682f 100644 --- a/c++/src/connect/mbedtls/psa/crypto_driver_contexts_composites.h +++ b/c++/src/connect/mbedtls/psa/crypto_driver_contexts_composites.h @@ -16,19 +16,7 @@ * to define the implementation-defined types of PSA multi-part state objects. */ /* Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H diff --git a/c++/src/connect/mbedtls/psa/crypto_driver_contexts_primitives.h b/c++/src/connect/mbedtls/psa/crypto_driver_contexts_primitives.h index 620a4b3a..9a6db01b 100644 --- a/c++/src/connect/mbedtls/psa/crypto_driver_contexts_primitives.h +++ b/c++/src/connect/mbedtls/psa/crypto_driver_contexts_primitives.h @@ -15,19 +15,7 @@ * to define the implementation-defined types of PSA multi-part state objects. */ /* Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H diff --git a/c++/src/connect/mbedtls/psa/crypto_extra.h b/c++/src/connect/mbedtls/psa/crypto_extra.h index fa3e383f..a1b2af7a 100644 --- a/c++/src/connect/mbedtls/psa/crypto_extra.h +++ b/c++/src/connect/mbedtls/psa/crypto_extra.h @@ -10,19 +10,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_EXTRA_H @@ -107,7 +95,7 @@ static inline psa_algorithm_t psa_get_key_enrollment_algorithm( * indicates the slot number that contains it. * \retval #PSA_ERROR_NOT_PERMITTED * The caller is not permitted to query the slot number. - * Mbed Crypto currently does not return this error. + * Mbed TLS currently does not return this error. * \retval #PSA_ERROR_INVALID_ARGUMENT * The key is not located in a secure element. */ @@ -219,7 +207,7 @@ void mbedtls_psa_crypto_free(void); * resource consumption related to the PSA keystore. * * \note The content of this structure is not part of the stable API and ABI - * of Mbed Crypto and may change arbitrarily from version to version. + * of Mbed TLS and may change arbitrarily from version to version. */ typedef struct mbedtls_psa_stats_s { /** Number of slots containing key material for a volatile key. */ @@ -248,7 +236,7 @@ typedef struct mbedtls_psa_stats_s { /** \brief Get statistics about * resource consumption related to the PSA keystore. * - * \note When Mbed Crypto is built as part of a service, with isolation + * \note When Mbed TLS is built as part of a service, with isolation * between the application and the keystore, the service may or * may not expose this function. */ diff --git a/c++/src/connect/mbedtls/psa/crypto_platform.h b/c++/src/connect/mbedtls/psa/crypto_platform.h index a173c783..ab6f1e84 100644 --- a/c++/src/connect/mbedtls/psa/crypto_platform.h +++ b/c++/src/connect/mbedtls/psa/crypto_platform.h @@ -15,19 +15,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_PLATFORM_H diff --git a/c++/src/connect/mbedtls/psa/crypto_se_driver.h b/c++/src/connect/mbedtls/psa/crypto_se_driver.h index e2acb714..616850f5 100644 --- a/c++/src/connect/mbedtls/psa/crypto_se_driver.h +++ b/c++/src/connect/mbedtls/psa/crypto_se_driver.h @@ -17,19 +17,7 @@ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_SE_DRIVER_H #define PSA_CRYPTO_SE_DRIVER_H @@ -137,7 +125,7 @@ typedef psa_status_t (*psa_drv_se_init_t)(psa_drv_se_context_t *drv_context, psa_key_location_t location); #if defined(__DOXYGEN_ONLY__) || !defined(MBEDTLS_PSA_CRYPTO_SE_C) -/* Mbed Crypto with secure element support enabled defines this type in +/* Mbed TLS with secure element support enabled defines this type in * crypto_types.h because it is also visible to applications through an * implementation-specific extension. * For the PSA Cryptography specification, this type is only visible @@ -836,7 +824,7 @@ typedef enum { * and #PSA_ERROR_DOES_NOT_EXIST if the driver can determine that there * is no key with the specified slot number. * - * This is an Mbed Crypto extension. + * This is an Mbed TLS extension. */ PSA_KEY_CREATION_REGISTER, #endif diff --git a/c++/src/connect/mbedtls/psa/crypto_sizes.h b/c++/src/connect/mbedtls/psa/crypto_sizes.h index 9f58c7fb..43f2f7b1 100644 --- a/c++/src/connect/mbedtls/psa/crypto_sizes.h +++ b/c++/src/connect/mbedtls/psa/crypto_sizes.h @@ -22,19 +22,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_SIZES_H diff --git a/c++/src/connect/mbedtls/psa/crypto_struct.h b/c++/src/connect/mbedtls/psa/crypto_struct.h index 743c6ade..213625fd 100644 --- a/c++/src/connect/mbedtls/psa/crypto_struct.h +++ b/c++/src/connect/mbedtls/psa/crypto_struct.h @@ -35,27 +35,15 @@ * GCC and Clang initialize the whole structure to 0 (at the time of writing), * but MSVC and CompCert don't. * - * In Mbed Crypto, multipart operation structures live independently from - * the key. This allows Mbed Crypto to free the key objects when destroying + * In Mbed TLS, multipart operation structures live independently from + * the key. This allows Mbed TLS to free the key objects when destroying * a key slot. If a multipart operation needs to remember the key after * the setup function returns, the operation structure needs to contain a * copy of the key. */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_STRUCT_H diff --git a/c++/src/connect/mbedtls/psa/crypto_types.h b/c++/src/connect/mbedtls/psa/crypto_types.h index 54662a54..90cda1af 100644 --- a/c++/src/connect/mbedtls/psa/crypto_types.h +++ b/c++/src/connect/mbedtls/psa/crypto_types.h @@ -15,19 +15,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_TYPES_H @@ -295,7 +283,7 @@ typedef uint32_t psa_key_id_t; typedef psa_key_id_t mbedtls_svc_key_id_t; #else /* MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER */ -/* Implementation-specific: The Mbed Cryptography library can be built as +/* Implementation-specific: The Mbed TLS library can be built as * part of a multi-client service that exposes the PSA Cryptography API in each * client and encodes the client identity in the key identifier argument of * functions such as psa_open_key(). @@ -437,7 +425,7 @@ typedef struct psa_key_attributes_s psa_key_attributes_t; #ifndef __DOXYGEN_ONLY__ #if defined(MBEDTLS_PSA_CRYPTO_SE_C) -/* Mbed Crypto defines this type in crypto_types.h because it is also +/* Mbed TLS defines this type in crypto_types.h because it is also * visible to applications through an implementation-specific extension. * For the PSA Cryptography specification, this type is only visible * via crypto_se_driver.h. */ diff --git a/c++/src/connect/mbedtls/psa/crypto_values.h b/c++/src/connect/mbedtls/psa/crypto_values.h index a6214bda..773c01e0 100644 --- a/c++/src/connect/mbedtls/psa/crypto_values.h +++ b/c++/src/connect/mbedtls/psa/crypto_values.h @@ -21,19 +21,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_VALUES_H @@ -412,7 +400,7 @@ ((type) | PSA_KEY_TYPE_CATEGORY_FLAG_PAIR) /** The public key type corresponding to a key pair type. * - * You may also pass a key pair type as \p type, it will be left unchanged. + * You may also pass a public key type as \p type, it will be left unchanged. * * \param type A public key type or key pair type. * @@ -553,19 +541,23 @@ * They are defined in _Standards for Efficient Cryptography_, * _SEC 2: Recommended Elliptic Curve Domain Parameters_. * https://www.secg.org/sec2-v2.pdf + * + * \note For secp224k1, the bit-size is 225 (size of a private value). + * + * \note Mbed TLS only supports secp192k1 and secp256k1. */ #define PSA_ECC_FAMILY_SECP_K1 ((psa_ecc_family_t) 0x17) /** SEC random curves over prime fields. * * This family comprises the following curves: - * secp192k1, secp224r1, secp256r1, secp384r1, secp521r1. + * secp192r1, secp224r1, secp256r1, secp384r1, secp521r1. * They are defined in _Standards for Efficient Cryptography_, * _SEC 2: Recommended Elliptic Curve Domain Parameters_. * https://www.secg.org/sec2-v2.pdf */ #define PSA_ECC_FAMILY_SECP_R1 ((psa_ecc_family_t) 0x12) -/* SECP160R2 (SEC2 v1, obsolete) */ +/* SECP160R2 (SEC2 v1, obsolete, not supported in Mbed TLS) */ #define PSA_ECC_FAMILY_SECP_R2 ((psa_ecc_family_t) 0x1b) /** SEC Koblitz curves over binary fields. @@ -575,6 +567,8 @@ * They are defined in _Standards for Efficient Cryptography_, * _SEC 2: Recommended Elliptic Curve Domain Parameters_. * https://www.secg.org/sec2-v2.pdf + * + * \note Mbed TLS does not support any curve in this family. */ #define PSA_ECC_FAMILY_SECT_K1 ((psa_ecc_family_t) 0x27) @@ -585,6 +579,8 @@ * They are defined in _Standards for Efficient Cryptography_, * _SEC 2: Recommended Elliptic Curve Domain Parameters_. * https://www.secg.org/sec2-v2.pdf + * + * \note Mbed TLS does not support any curve in this family. */ #define PSA_ECC_FAMILY_SECT_R1 ((psa_ecc_family_t) 0x22) @@ -595,6 +591,8 @@ * It is defined in _Standards for Efficient Cryptography_, * _SEC 2: Recommended Elliptic Curve Domain Parameters_. * https://www.secg.org/sec2-v2.pdf + * + * \note Mbed TLS does not support any curve in this family. */ #define PSA_ECC_FAMILY_SECT_R2 ((psa_ecc_family_t) 0x2b) @@ -604,6 +602,9 @@ * brainpoolP160r1, brainpoolP192r1, brainpoolP224r1, brainpoolP256r1, * brainpoolP320r1, brainpoolP384r1, brainpoolP512r1. * It is defined in RFC 5639. + * + * \note Mbed TLS only supports the 256-bit, 384-bit and 512-bit curves + * in this family. */ #define PSA_ECC_FAMILY_BRAINPOOL_P_R1 ((psa_ecc_family_t) 0x30) @@ -632,6 +633,8 @@ * - 448-bit: Edwards448, the twisted Edwards curve birationally equivalent * to Curve448. * Hamburg, _Ed448-Goldilocks, a new elliptic curve_, NIST ECC Workshop, 2015. + * + * \note Mbed TLS does not support Edwards curves yet. */ #define PSA_ECC_FAMILY_TWISTED_EDWARDS ((psa_ecc_family_t) 0x42) @@ -1671,6 +1674,13 @@ 0) /** RSA PKCS#1 v1.5 encryption. + * + * \warning Calling psa_asymmetric_decrypt() with this algorithm as a + * parameter is considered an inherently dangerous function + * (CWE-242). Unless it is used in a side channel free and safe + * way (eg. implementing the TLS protocol as per 7.4.7.1 of + * RFC 5246), the calling code is vulnerable. + * */ #define PSA_ALG_RSA_PKCS1V15_CRYPT ((psa_algorithm_t) 0x07000200) diff --git a/c++/src/connect/mbedtls/psa_crypto.c b/c++/src/connect/mbedtls/psa_crypto.c index bad7f469..e85e5792 100644 --- a/c++/src/connect/mbedtls/psa_crypto.c +++ b/c++/src/connect/mbedtls/psa_crypto.c @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" @@ -118,6 +106,117 @@ mbedtls_psa_drbg_context_t *const mbedtls_psa_random_state = if (global_data.initialized == 0) \ return PSA_ERROR_BAD_STATE; +#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) + +/* Declare a local copy of an input buffer and a variable that will be used + * to store a pointer to the start of the buffer. + * + * Note: This macro must be called before any operations which may jump to + * the exit label, so that the local input copy object is safe to be freed. + * + * Assumptions: + * - input is the name of a pointer to the buffer to be copied + * - The name LOCAL_INPUT_COPY_OF_input is unused in the current scope + * - input_copy_name is a name that is unused in the current scope + */ +#define LOCAL_INPUT_DECLARE(input, input_copy_name) \ + psa_crypto_local_input_t LOCAL_INPUT_COPY_OF_##input = PSA_CRYPTO_LOCAL_INPUT_INIT; \ + const uint8_t *input_copy_name = NULL; + +/* Allocate a copy of the buffer input and set the pointer input_copy to + * point to the start of the copy. + * + * Assumptions: + * - psa_status_t status exists + * - An exit label is declared + * - input is the name of a pointer to the buffer to be copied + * - LOCAL_INPUT_DECLARE(input, input_copy) has previously been called + */ +#define LOCAL_INPUT_ALLOC(input, length, input_copy) \ + status = psa_crypto_local_input_alloc(input, length, \ + &LOCAL_INPUT_COPY_OF_##input); \ + if (status != PSA_SUCCESS) { \ + goto exit; \ + } \ + input_copy = LOCAL_INPUT_COPY_OF_##input.buffer; + +/* Free the local input copy allocated previously by LOCAL_INPUT_ALLOC() + * + * Assumptions: + * - input_copy is the name of the input copy pointer set by LOCAL_INPUT_ALLOC() + * - input is the name of the original buffer that was copied + */ +#define LOCAL_INPUT_FREE(input, input_copy) \ + input_copy = NULL; \ + psa_crypto_local_input_free(&LOCAL_INPUT_COPY_OF_##input); + +/* Declare a local copy of an output buffer and a variable that will be used + * to store a pointer to the start of the buffer. + * + * Note: This macro must be called before any operations which may jump to + * the exit label, so that the local output copy object is safe to be freed. + * + * Assumptions: + * - output is the name of a pointer to the buffer to be copied + * - The name LOCAL_OUTPUT_COPY_OF_output is unused in the current scope + * - output_copy_name is a name that is unused in the current scope + */ +#define LOCAL_OUTPUT_DECLARE(output, output_copy_name) \ + psa_crypto_local_output_t LOCAL_OUTPUT_COPY_OF_##output = PSA_CRYPTO_LOCAL_OUTPUT_INIT; \ + uint8_t *output_copy_name = NULL; + +/* Allocate a copy of the buffer output and set the pointer output_copy to + * point to the start of the copy. + * + * Assumptions: + * - psa_status_t status exists + * - An exit label is declared + * - output is the name of a pointer to the buffer to be copied + * - LOCAL_OUTPUT_DECLARE(output, output_copy) has previously been called + */ +#define LOCAL_OUTPUT_ALLOC(output, length, output_copy) \ + status = psa_crypto_local_output_alloc(output, length, \ + &LOCAL_OUTPUT_COPY_OF_##output); \ + if (status != PSA_SUCCESS) { \ + goto exit; \ + } \ + output_copy = LOCAL_OUTPUT_COPY_OF_##output.buffer; + +/* Free the local output copy allocated previously by LOCAL_OUTPUT_ALLOC() + * after first copying back its contents to the original buffer. + * + * Assumptions: + * - psa_status_t status exists + * - output_copy is the name of the output copy pointer set by LOCAL_OUTPUT_ALLOC() + * - output is the name of the original buffer that was copied + */ +#define LOCAL_OUTPUT_FREE(output, output_copy) \ + output_copy = NULL; \ + do { \ + psa_status_t local_output_status; \ + local_output_status = psa_crypto_local_output_free(&LOCAL_OUTPUT_COPY_OF_##output); \ + if (local_output_status != PSA_SUCCESS) { \ + /* Since this error case is an internal error, it's more serious than \ + * any existing error code and so it's fine to overwrite the existing \ + * status. */ \ + status = local_output_status; \ + } \ + } while (0) +#else /* !MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS */ +#define LOCAL_INPUT_DECLARE(input, input_copy_name) \ + const uint8_t *input_copy_name = NULL; +#define LOCAL_INPUT_ALLOC(input, length, input_copy) \ + input_copy = input; +#define LOCAL_INPUT_FREE(input, input_copy) \ + input_copy = NULL; +#define LOCAL_OUTPUT_DECLARE(output, output_copy_name) \ + uint8_t *output_copy_name = NULL; +#define LOCAL_OUTPUT_ALLOC(output, length, output_copy) \ + output_copy = output; +#define LOCAL_OUTPUT_FREE(output, output_copy) \ + output_copy = NULL; +#endif /* !MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS */ + psa_status_t mbedtls_to_psa_error(int ret) { /* Mbed TLS error codes can combine a high-level error code and a @@ -1367,14 +1466,14 @@ psa_status_t psa_export_key_internal( } psa_status_t psa_export_key(mbedtls_svc_key_id_t key, - uint8_t *data, + uint8_t *data_external, size_t data_size, size_t *data_length) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED; psa_key_slot_t *slot; - + LOCAL_OUTPUT_DECLARE(data_external, data); /* Reject a zero-length output buffer now, since this can never be a * valid key representation. This way we know that data must be a valid * pointer and we can do things like memset(data, ..., data_size). */ @@ -1398,6 +1497,8 @@ psa_status_t psa_export_key(mbedtls_svc_key_id_t key, return status; } + LOCAL_OUTPUT_ALLOC(data_external, data_size, data); + psa_key_attributes_t attributes = { .core = slot->attr }; @@ -1405,8 +1506,12 @@ psa_status_t psa_export_key(mbedtls_svc_key_id_t key, slot->key.data, slot->key.bytes, data, data_size, data_length); +#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) +exit: +#endif unlock_status = psa_unlock_key_slot(slot); + LOCAL_OUTPUT_FREE(data_external, data); return (status == PSA_SUCCESS) ? unlock_status : status; } @@ -1466,13 +1571,15 @@ psa_status_t psa_export_public_key_internal( } psa_status_t psa_export_public_key(mbedtls_svc_key_id_t key, - uint8_t *data, + uint8_t *data_external, size_t data_size, size_t *data_length) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED; + psa_key_attributes_t attributes; psa_key_slot_t *slot; + LOCAL_OUTPUT_DECLARE(data_external, data); /* Reject a zero-length output buffer now, since this can never be a * valid key representation. This way we know that data must be a valid @@ -1493,12 +1600,14 @@ psa_status_t psa_export_public_key(mbedtls_svc_key_id_t key, return status; } + LOCAL_OUTPUT_ALLOC(data_external, data_size, data); + if (!PSA_KEY_TYPE_IS_ASYMMETRIC(slot->attr.type)) { status = PSA_ERROR_INVALID_ARGUMENT; goto exit; } - psa_key_attributes_t attributes = { + attributes = (psa_key_attributes_t) { .core = slot->attr }; status = psa_driver_wrapper_export_public_key( @@ -1508,6 +1617,7 @@ psa_status_t psa_export_public_key(mbedtls_svc_key_id_t key, exit: unlock_status = psa_unlock_key_slot(slot); + LOCAL_OUTPUT_FREE(data_external, data); return (status == PSA_SUCCESS) ? unlock_status : status; } @@ -1946,11 +2056,12 @@ rsa_exit: } psa_status_t psa_import_key(const psa_key_attributes_t *attributes, - const uint8_t *data, + const uint8_t *data_external, size_t data_length, mbedtls_svc_key_id_t *key) { psa_status_t status; + LOCAL_INPUT_DECLARE(data_external, data); psa_key_slot_t *slot = NULL; psa_se_drv_table_entry_t *driver = NULL; size_t bits; @@ -1964,6 +2075,8 @@ psa_status_t psa_import_key(const psa_key_attributes_t *attributes, return PSA_ERROR_INVALID_ARGUMENT; } + LOCAL_INPUT_ALLOC(data_external, data_length, data); + status = psa_start_key_creation(PSA_KEY_CREATION_IMPORT, attributes, &slot, &driver); if (status != PSA_SUCCESS) { @@ -2005,6 +2118,7 @@ psa_status_t psa_import_key(const psa_key_attributes_t *attributes, status = psa_finish_key_creation(slot, driver, key); exit: + LOCAL_INPUT_FREE(data_external, data); if (status != PSA_SUCCESS) { psa_fail_key_creation(slot, driver); } @@ -2189,10 +2303,11 @@ exit: } psa_status_t psa_hash_update(psa_hash_operation_t *operation, - const uint8_t *input, + const uint8_t *input_external, size_t input_length) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; + LOCAL_INPUT_DECLARE(input_external, input); if (operation->id == 0) { status = PSA_ERROR_BAD_STATE; @@ -2205,6 +2320,7 @@ psa_status_t psa_hash_update(psa_hash_operation_t *operation, return PSA_SUCCESS; } + LOCAL_INPUT_ALLOC(input_external, input_length, input); status = psa_driver_wrapper_hash_update(operation, input, input_length); exit: @@ -2212,32 +2328,57 @@ exit: psa_hash_abort(operation); } + LOCAL_INPUT_FREE(input_external, input); return status; } -psa_status_t psa_hash_finish(psa_hash_operation_t *operation, - uint8_t *hash, - size_t hash_size, - size_t *hash_length) +static psa_status_t psa_hash_finish_internal(psa_hash_operation_t *operation, + uint8_t *hash, + size_t hash_size, + size_t *hash_length) { + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; + *hash_length = 0; if (operation->id == 0) { return PSA_ERROR_BAD_STATE; } - psa_status_t status = psa_driver_wrapper_hash_finish( + status = psa_driver_wrapper_hash_finish( operation, hash, hash_size, hash_length); psa_hash_abort(operation); + + return status; +} + +psa_status_t psa_hash_finish(psa_hash_operation_t *operation, + uint8_t *hash_external, + size_t hash_size, + size_t *hash_length) +{ + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; + LOCAL_OUTPUT_DECLARE(hash_external, hash); + + LOCAL_OUTPUT_ALLOC(hash_external, hash_size, hash); + status = psa_hash_finish_internal(operation, hash, hash_size, hash_length); + +#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) +exit: +#endif + LOCAL_OUTPUT_FREE(hash_external, hash); return status; } psa_status_t psa_hash_verify(psa_hash_operation_t *operation, - const uint8_t *hash, + const uint8_t *hash_external, size_t hash_length) { uint8_t actual_hash[PSA_HASH_MAX_SIZE]; size_t actual_hash_length; - psa_status_t status = psa_hash_finish( + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; + LOCAL_INPUT_DECLARE(hash_external, hash); + + status = psa_hash_finish_internal( operation, actual_hash, sizeof(actual_hash), &actual_hash_length); @@ -2251,6 +2392,7 @@ psa_status_t psa_hash_verify(psa_hash_operation_t *operation, goto exit; } + LOCAL_INPUT_ALLOC(hash_external, hash_length, hash); if (mbedtls_psa_safer_memcmp(hash, actual_hash, actual_hash_length) != 0) { status = PSA_ERROR_INVALID_SIGNATURE; } @@ -2260,36 +2402,55 @@ exit: if (status != PSA_SUCCESS) { psa_hash_abort(operation); } - + LOCAL_INPUT_FREE(hash_external, hash); return status; } psa_status_t psa_hash_compute(psa_algorithm_t alg, - const uint8_t *input, size_t input_length, - uint8_t *hash, size_t hash_size, + const uint8_t *input_external, size_t input_length, + uint8_t *hash_external, size_t hash_size, size_t *hash_length) { + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; + LOCAL_INPUT_DECLARE(input_external, input); + LOCAL_OUTPUT_DECLARE(hash_external, hash); + *hash_length = 0; if (!PSA_ALG_IS_HASH(alg)) { return PSA_ERROR_INVALID_ARGUMENT; } - return psa_driver_wrapper_hash_compute(alg, input, input_length, - hash, hash_size, hash_length); + LOCAL_INPUT_ALLOC(input_external, input_length, input); + LOCAL_OUTPUT_ALLOC(hash_external, hash_size, hash); + status = psa_driver_wrapper_hash_compute(alg, input, input_length, + hash, hash_size, hash_length); + +#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) +exit: +#endif + LOCAL_INPUT_FREE(input_external, input); + LOCAL_OUTPUT_FREE(hash_external, hash); + return status; } psa_status_t psa_hash_compare(psa_algorithm_t alg, - const uint8_t *input, size_t input_length, - const uint8_t *hash, size_t hash_length) + const uint8_t *input_external, size_t input_length, + const uint8_t *hash_external, size_t hash_length) { uint8_t actual_hash[PSA_HASH_MAX_SIZE]; size_t actual_hash_length; + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; + + LOCAL_INPUT_DECLARE(input_external, input); + LOCAL_INPUT_DECLARE(hash_external, hash); if (!PSA_ALG_IS_HASH(alg)) { - return PSA_ERROR_INVALID_ARGUMENT; + status = PSA_ERROR_INVALID_ARGUMENT; + return status; } - psa_status_t status = psa_driver_wrapper_hash_compute( + LOCAL_INPUT_ALLOC(input_external, input_length, input); + status = psa_driver_wrapper_hash_compute( alg, input, input_length, actual_hash, sizeof(actual_hash), &actual_hash_length); @@ -2300,12 +2461,18 @@ psa_status_t psa_hash_compare(psa_algorithm_t alg, status = PSA_ERROR_INVALID_SIGNATURE; goto exit; } + + LOCAL_INPUT_ALLOC(hash_external, hash_length, hash); if (mbedtls_psa_safer_memcmp(hash, actual_hash, actual_hash_length) != 0) { status = PSA_ERROR_INVALID_SIGNATURE; } exit: mbedtls_platform_zeroize(actual_hash, sizeof(actual_hash)); + + LOCAL_INPUT_FREE(input_external, input); + LOCAL_INPUT_FREE(hash_external, hash); + return status; } @@ -2406,6 +2573,7 @@ static psa_status_t psa_mac_setup(psa_mac_operation_t *operation, { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED; + psa_key_attributes_t attributes; psa_key_slot_t *slot = NULL; /* A context must be freshly initialized before it can be set up. */ @@ -2423,7 +2591,7 @@ static psa_status_t psa_mac_setup(psa_mac_operation_t *operation, goto exit; } - psa_key_attributes_t attributes = { + attributes = (psa_key_attributes_t) { .core = slot->attr }; @@ -2474,35 +2642,48 @@ psa_status_t psa_mac_verify_setup(psa_mac_operation_t *operation, } psa_status_t psa_mac_update(psa_mac_operation_t *operation, - const uint8_t *input, + const uint8_t *input_external, size_t input_length) { + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; + LOCAL_INPUT_DECLARE(input_external, input); + if (operation->id == 0) { - return PSA_ERROR_BAD_STATE; + status = PSA_ERROR_BAD_STATE; + return status; } /* Don't require hash implementations to behave correctly on a * zero-length input, which may have an invalid pointer. */ if (input_length == 0) { - return PSA_SUCCESS; + status = PSA_SUCCESS; + return status; } - psa_status_t status = psa_driver_wrapper_mac_update(operation, - input, input_length); + LOCAL_INPUT_ALLOC(input_external, input_length, input); + status = psa_driver_wrapper_mac_update(operation, input, input_length); + if (status != PSA_SUCCESS) { psa_mac_abort(operation); } +#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) +exit: +#endif + LOCAL_INPUT_FREE(input_external, input); + return status; } psa_status_t psa_mac_sign_finish(psa_mac_operation_t *operation, - uint8_t *mac, + uint8_t *mac_external, size_t mac_size, size_t *mac_length) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_status_t abort_status = PSA_ERROR_CORRUPTION_DETECTED; + LOCAL_OUTPUT_DECLARE(mac_external, mac); + LOCAL_OUTPUT_ALLOC(mac_external, mac_size, mac); if (operation->id == 0) { status = PSA_ERROR_BAD_STATE; @@ -2542,22 +2723,24 @@ exit: operation->mac_size = 0; } - if (mac_size > operation->mac_size) { + if ((mac != NULL) && (mac_size > operation->mac_size)) { memset(&mac[operation->mac_size], '!', mac_size - operation->mac_size); } abort_status = psa_mac_abort(operation); + LOCAL_OUTPUT_FREE(mac_external, mac); return status == PSA_SUCCESS ? abort_status : status; } psa_status_t psa_mac_verify_finish(psa_mac_operation_t *operation, - const uint8_t *mac, + const uint8_t *mac_external, size_t mac_length) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_status_t abort_status = PSA_ERROR_CORRUPTION_DETECTED; + LOCAL_INPUT_DECLARE(mac_external, mac); if (operation->id == 0) { status = PSA_ERROR_BAD_STATE; @@ -2574,11 +2757,13 @@ psa_status_t psa_mac_verify_finish(psa_mac_operation_t *operation, goto exit; } + LOCAL_INPUT_ALLOC(mac_external, mac_length, mac); status = psa_driver_wrapper_mac_verify_finish(operation, mac, mac_length); exit: abort_status = psa_mac_abort(operation); + LOCAL_INPUT_FREE(mac_external, mac); return status == PSA_SUCCESS ? abort_status : status; } @@ -2594,6 +2779,7 @@ static psa_status_t psa_mac_compute_internal(mbedtls_svc_key_id_t key, { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED; + psa_key_attributes_t attributes; psa_key_slot_t *slot; uint8_t operation_mac_size = 0; @@ -2606,7 +2792,7 @@ static psa_status_t psa_mac_compute_internal(mbedtls_svc_key_id_t key, goto exit; } - psa_key_attributes_t attributes = { + attributes = (psa_key_attributes_t) { .core = slot->attr }; @@ -2650,28 +2836,45 @@ exit: psa_status_t psa_mac_compute(mbedtls_svc_key_id_t key, psa_algorithm_t alg, - const uint8_t *input, + const uint8_t *input_external, size_t input_length, - uint8_t *mac, + uint8_t *mac_external, size_t mac_size, size_t *mac_length) { - return psa_mac_compute_internal(key, alg, - input, input_length, - mac, mac_size, mac_length, 1); + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; + LOCAL_INPUT_DECLARE(input_external, input); + LOCAL_OUTPUT_DECLARE(mac_external, mac); + + LOCAL_INPUT_ALLOC(input_external, input_length, input); + LOCAL_OUTPUT_ALLOC(mac_external, mac_size, mac); + status = psa_mac_compute_internal(key, alg, + input, input_length, + mac, mac_size, mac_length, 1); + +#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) +exit: +#endif + LOCAL_INPUT_FREE(input_external, input); + LOCAL_OUTPUT_FREE(mac_external, mac); + + return status; } psa_status_t psa_mac_verify(mbedtls_svc_key_id_t key, psa_algorithm_t alg, - const uint8_t *input, + const uint8_t *input_external, size_t input_length, - const uint8_t *mac, + const uint8_t *mac_external, size_t mac_length) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; uint8_t actual_mac[PSA_MAC_MAX_SIZE]; size_t actual_mac_length; + LOCAL_INPUT_DECLARE(input_external, input); + LOCAL_INPUT_DECLARE(mac_external, mac); + LOCAL_INPUT_ALLOC(input_external, input_length, input); status = psa_mac_compute_internal(key, alg, input, input_length, actual_mac, sizeof(actual_mac), @@ -2684,6 +2887,8 @@ psa_status_t psa_mac_verify(mbedtls_svc_key_id_t key, status = PSA_ERROR_INVALID_SIGNATURE; goto exit; } + + LOCAL_INPUT_ALLOC(mac_external, mac_length, mac); if (mbedtls_psa_safer_memcmp(mac, actual_mac, actual_mac_length) != 0) { status = PSA_ERROR_INVALID_SIGNATURE; goto exit; @@ -2691,6 +2896,8 @@ psa_status_t psa_mac_verify(mbedtls_svc_key_id_t key, exit: mbedtls_platform_zeroize(actual_mac, sizeof(actual_mac)); + LOCAL_INPUT_FREE(input_external, input); + LOCAL_INPUT_FREE(mac_external, mac); return status; } @@ -2732,6 +2939,7 @@ static psa_status_t psa_sign_internal(mbedtls_svc_key_id_t key, { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED; + psa_key_attributes_t attributes; psa_key_slot_t *slot; *signature_length = 0; @@ -2764,7 +2972,7 @@ static psa_status_t psa_sign_internal(mbedtls_svc_key_id_t key, goto exit; } - psa_key_attributes_t attributes = { + attributes = (psa_key_attributes_t) { .core = slot->attr }; @@ -2887,15 +3095,27 @@ psa_status_t psa_sign_message_builtin( psa_status_t psa_sign_message(mbedtls_svc_key_id_t key, psa_algorithm_t alg, - const uint8_t *input, + const uint8_t *input_external, size_t input_length, - uint8_t *signature, + uint8_t *signature_external, size_t signature_size, size_t *signature_length) { - return psa_sign_internal( - key, 1, alg, input, input_length, - signature, signature_size, signature_length); + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; + LOCAL_INPUT_DECLARE(input_external, input); + LOCAL_OUTPUT_DECLARE(signature_external, signature); + + LOCAL_INPUT_ALLOC(input_external, input_length, input); + LOCAL_OUTPUT_ALLOC(signature_external, signature_size, signature); + status = psa_sign_internal(key, 1, alg, input, input_length, signature, + signature_size, signature_length); + +#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) +exit: +#endif + LOCAL_INPUT_FREE(input_external, input); + LOCAL_OUTPUT_FREE(signature_external, signature); + return status; } psa_status_t psa_verify_message_builtin( @@ -2934,14 +3154,27 @@ psa_status_t psa_verify_message_builtin( psa_status_t psa_verify_message(mbedtls_svc_key_id_t key, psa_algorithm_t alg, - const uint8_t *input, + const uint8_t *input_external, size_t input_length, - const uint8_t *signature, + const uint8_t *signature_external, size_t signature_length) { - return psa_verify_internal( - key, 1, alg, input, input_length, - signature, signature_length); + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; + LOCAL_INPUT_DECLARE(input_external, input); + LOCAL_INPUT_DECLARE(signature_external, signature); + + LOCAL_INPUT_ALLOC(input_external, input_length, input); + LOCAL_INPUT_ALLOC(signature_external, signature_length, signature); + status = psa_verify_internal(key, 1, alg, input, input_length, signature, + signature_length); + +#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) +exit: +#endif + LOCAL_INPUT_FREE(input_external, input); + LOCAL_INPUT_FREE(signature_external, signature); + + return status; } psa_status_t psa_sign_hash_builtin( @@ -2994,15 +3227,28 @@ psa_status_t psa_sign_hash_builtin( psa_status_t psa_sign_hash(mbedtls_svc_key_id_t key, psa_algorithm_t alg, - const uint8_t *hash, + const uint8_t *hash_external, size_t hash_length, - uint8_t *signature, + uint8_t *signature_external, size_t signature_size, size_t *signature_length) { - return psa_sign_internal( - key, 0, alg, hash, hash_length, - signature, signature_size, signature_length); + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; + LOCAL_INPUT_DECLARE(hash_external, hash); + LOCAL_OUTPUT_DECLARE(signature_external, signature); + + LOCAL_INPUT_ALLOC(hash_external, hash_length, hash); + LOCAL_OUTPUT_ALLOC(signature_external, signature_size, signature); + status = psa_sign_internal(key, 0, alg, hash, hash_length, signature, + signature_size, signature_length); + +#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) +exit: +#endif + LOCAL_INPUT_FREE(hash_external, hash); + LOCAL_OUTPUT_FREE(signature_external, signature); + + return status; } psa_status_t psa_verify_hash_builtin( @@ -3054,14 +3300,27 @@ psa_status_t psa_verify_hash_builtin( psa_status_t psa_verify_hash(mbedtls_svc_key_id_t key, psa_algorithm_t alg, - const uint8_t *hash, + const uint8_t *hash_external, size_t hash_length, - const uint8_t *signature, + const uint8_t *signature_external, size_t signature_length) { - return psa_verify_internal( - key, 0, alg, hash, hash_length, - signature, signature_length); + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; + LOCAL_INPUT_DECLARE(hash_external, hash); + LOCAL_INPUT_DECLARE(signature_external, signature); + + LOCAL_INPUT_ALLOC(hash_external, hash_length, hash); + LOCAL_INPUT_ALLOC(signature_external, signature_length, signature); + status = psa_verify_internal(key, 0, alg, hash, hash_length, signature, + signature_length); + +#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) +exit: +#endif + LOCAL_INPUT_FREE(hash_external, hash); + LOCAL_INPUT_FREE(signature_external, signature); + + return status; } #if defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP) @@ -3077,17 +3336,20 @@ static void psa_rsa_oaep_set_padding_mode(psa_algorithm_t alg, psa_status_t psa_asymmetric_encrypt(mbedtls_svc_key_id_t key, psa_algorithm_t alg, - const uint8_t *input, + const uint8_t *input_external, size_t input_length, - const uint8_t *salt, + const uint8_t *salt_external, size_t salt_length, - uint8_t *output, + uint8_t *output_external, size_t output_size, size_t *output_length) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED; psa_key_slot_t *slot; + LOCAL_INPUT_DECLARE(input_external, input); + LOCAL_INPUT_DECLARE(salt_external, salt); + LOCAL_OUTPUT_DECLARE(output_external, output); (void) input; (void) input_length; @@ -3130,6 +3392,9 @@ psa_status_t psa_asymmetric_encrypt(mbedtls_svc_key_id_t key, } #endif /* defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT) || * defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP) */ + LOCAL_INPUT_ALLOC(input_external, input_length, input); + LOCAL_INPUT_ALLOC(salt_external, salt_length, salt); + LOCAL_OUTPUT_ALLOC(output_external, output_size, output); if (alg == PSA_ALG_RSA_PKCS1V15_CRYPT) { #if defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT) status = mbedtls_to_psa_error( @@ -3180,22 +3445,29 @@ rsa_exit: exit: unlock_status = psa_unlock_key_slot(slot); + LOCAL_INPUT_FREE(input_external, input); + LOCAL_INPUT_FREE(salt_external, salt); + LOCAL_OUTPUT_FREE(output_external, output); + return (status == PSA_SUCCESS) ? unlock_status : status; } psa_status_t psa_asymmetric_decrypt(mbedtls_svc_key_id_t key, psa_algorithm_t alg, - const uint8_t *input, + const uint8_t *input_external, size_t input_length, - const uint8_t *salt, + const uint8_t *salt_external, size_t salt_length, - uint8_t *output, + uint8_t *output_external, size_t output_size, size_t *output_length) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED; psa_key_slot_t *slot; + LOCAL_INPUT_DECLARE(input_external, input); + LOCAL_INPUT_DECLARE(salt_external, salt); + LOCAL_OUTPUT_DECLARE(output_external, output); (void) input; (void) input_length; @@ -3237,7 +3509,9 @@ psa_status_t psa_asymmetric_decrypt(mbedtls_svc_key_id_t key, } #endif /* defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT) || * defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP) */ - + LOCAL_INPUT_ALLOC(input_external, input_length, input); + LOCAL_INPUT_ALLOC(salt_external, salt_length, salt); + LOCAL_OUTPUT_ALLOC(output_external, output_size, output); if (alg == PSA_ALG_RSA_PKCS1V15_CRYPT) { #if defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT) status = mbedtls_to_psa_error( @@ -3287,9 +3561,59 @@ rsa_exit: exit: unlock_status = psa_unlock_key_slot(slot); + LOCAL_INPUT_FREE(input_external, input); + LOCAL_INPUT_FREE(salt_external, salt); + LOCAL_OUTPUT_FREE(output_external, output); + return (status == PSA_SUCCESS) ? unlock_status : status; } +static psa_status_t psa_generate_random_internal(uint8_t *output, + size_t output_size) +{ + GUARD_MODULE_INITIALIZED; + + psa_status_t status; + +#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) + + size_t output_length = 0; + status = mbedtls_psa_external_get_random(&global_data.rng, + output, output_size, + &output_length); + if (status != PSA_SUCCESS) { + goto exit; + } + /* Breaking up a request into smaller chunks is currently not supported + * for the external RNG interface. */ + if (output_length != output_size) { + status = PSA_ERROR_INSUFFICIENT_ENTROPY; + goto exit; + } + status = PSA_SUCCESS; + +#else /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */ + + while (output_size > 0) { + size_t request_size = + (output_size > MBEDTLS_PSA_RANDOM_MAX_REQUEST ? + MBEDTLS_PSA_RANDOM_MAX_REQUEST : + output_size); + int ret = mbedtls_psa_get_random(MBEDTLS_PSA_RANDOM_STATE, + output, request_size); + if (ret != 0) { + status = mbedtls_to_psa_error(ret); + goto exit; + } + output_size -= request_size; + output += request_size; + } + status = PSA_SUCCESS; +#endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */ + +exit: + return status; +} /****************************************************************/ @@ -3303,6 +3627,7 @@ static psa_status_t psa_cipher_setup(psa_cipher_operation_t *operation, { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED; + psa_key_attributes_t attributes; psa_key_slot_t *slot = NULL; psa_key_usage_t usage = (cipher_operation == MBEDTLS_ENCRYPT ? PSA_KEY_USAGE_ENCRYPT : @@ -3338,7 +3663,7 @@ static psa_status_t psa_cipher_setup(psa_cipher_operation_t *operation, } operation->default_iv_length = PSA_CIPHER_IV_LENGTH(slot->attr.type, alg); - psa_key_attributes_t attributes = { + attributes = (psa_key_attributes_t) { .core = slot->attr }; @@ -3382,13 +3707,14 @@ psa_status_t psa_cipher_decrypt_setup(psa_cipher_operation_t *operation, } psa_status_t psa_cipher_generate_iv(psa_cipher_operation_t *operation, - uint8_t *iv, + uint8_t *iv_external, size_t iv_size, size_t *iv_length) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; - uint8_t local_iv[PSA_CIPHER_IV_MAX_SIZE]; - size_t default_iv_length; + size_t default_iv_length = 0; + + LOCAL_OUTPUT_DECLARE(iv_external, iv); if (operation->id == 0) { status = PSA_ERROR_BAD_STATE; @@ -3411,33 +3737,40 @@ psa_status_t psa_cipher_generate_iv(psa_cipher_operation_t *operation, goto exit; } - status = psa_generate_random(local_iv, default_iv_length); + LOCAL_OUTPUT_ALLOC(iv_external, default_iv_length, iv); + + status = psa_generate_random_internal(iv, default_iv_length); if (status != PSA_SUCCESS) { goto exit; } status = psa_driver_wrapper_cipher_set_iv(operation, - local_iv, default_iv_length); + iv, default_iv_length); exit: if (status == PSA_SUCCESS) { - memcpy(iv, local_iv, default_iv_length); *iv_length = default_iv_length; operation->iv_set = 1; } else { *iv_length = 0; psa_cipher_abort(operation); + if (iv != NULL) { + mbedtls_platform_zeroize(iv, default_iv_length); + } } + LOCAL_OUTPUT_FREE(iv_external, iv); return status; } psa_status_t psa_cipher_set_iv(psa_cipher_operation_t *operation, - const uint8_t *iv, + const uint8_t *iv_external, size_t iv_length) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; + LOCAL_INPUT_DECLARE(iv_external, iv); + if (operation->id == 0) { status = PSA_ERROR_BAD_STATE; goto exit; @@ -3453,6 +3786,8 @@ psa_status_t psa_cipher_set_iv(psa_cipher_operation_t *operation, goto exit; } + LOCAL_INPUT_ALLOC(iv_external, iv_length, iv); + status = psa_driver_wrapper_cipher_set_iv(operation, iv, iv_length); @@ -3463,18 +3798,24 @@ exit: } else { psa_cipher_abort(operation); } + + LOCAL_INPUT_FREE(iv_external, iv); + return status; } psa_status_t psa_cipher_update(psa_cipher_operation_t *operation, - const uint8_t *input, + const uint8_t *input_external, size_t input_length, - uint8_t *output, + uint8_t *output_external, size_t output_size, size_t *output_length) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; + LOCAL_INPUT_DECLARE(input_external, input); + LOCAL_OUTPUT_DECLARE(output_external, output); + if (operation->id == 0) { status = PSA_ERROR_BAD_STATE; goto exit; @@ -3485,6 +3826,9 @@ psa_status_t psa_cipher_update(psa_cipher_operation_t *operation, goto exit; } + LOCAL_INPUT_ALLOC(input_external, input_length, input); + LOCAL_OUTPUT_ALLOC(output_external, output_size, output); + status = psa_driver_wrapper_cipher_update(operation, input, input_length, @@ -3497,16 +3841,21 @@ exit: psa_cipher_abort(operation); } + LOCAL_INPUT_FREE(input_external, input); + LOCAL_OUTPUT_FREE(output_external, output); + return status; } psa_status_t psa_cipher_finish(psa_cipher_operation_t *operation, - uint8_t *output, + uint8_t *output_external, size_t output_size, size_t *output_length) { psa_status_t status = PSA_ERROR_GENERIC_ERROR; + LOCAL_OUTPUT_DECLARE(output_external, output); + if (operation->id == 0) { status = PSA_ERROR_BAD_STATE; goto exit; @@ -3517,6 +3866,8 @@ psa_status_t psa_cipher_finish(psa_cipher_operation_t *operation, goto exit; } + LOCAL_OUTPUT_ALLOC(output_external, output_size, output); + status = psa_driver_wrapper_cipher_finish(operation, output, output_size, @@ -3524,13 +3875,15 @@ psa_status_t psa_cipher_finish(psa_cipher_operation_t *operation, exit: if (status == PSA_SUCCESS) { - return psa_cipher_abort(operation); + status = psa_cipher_abort(operation); } else { *output_length = 0; (void) psa_cipher_abort(operation); - - return status; } + + LOCAL_OUTPUT_FREE(output_external, output); + + return status; } psa_status_t psa_cipher_abort(psa_cipher_operation_t *operation) @@ -3553,18 +3906,22 @@ psa_status_t psa_cipher_abort(psa_cipher_operation_t *operation) psa_status_t psa_cipher_encrypt(mbedtls_svc_key_id_t key, psa_algorithm_t alg, - const uint8_t *input, + const uint8_t *input_external, size_t input_length, - uint8_t *output, + uint8_t *output_external, size_t output_size, size_t *output_length) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED; + psa_key_attributes_t attributes; psa_key_slot_t *slot = NULL; uint8_t local_iv[PSA_CIPHER_IV_MAX_SIZE]; size_t default_iv_length = 0; + LOCAL_INPUT_DECLARE(input_external, input); + LOCAL_OUTPUT_DECLARE(output_external, output); + if (!PSA_ALG_IS_CIPHER(alg)) { status = PSA_ERROR_INVALID_ARGUMENT; goto exit; @@ -3577,7 +3934,7 @@ psa_status_t psa_cipher_encrypt(mbedtls_svc_key_id_t key, goto exit; } - psa_key_attributes_t attributes = { + attributes = (psa_key_attributes_t) { .core = slot->attr }; @@ -3593,12 +3950,15 @@ psa_status_t psa_cipher_encrypt(mbedtls_svc_key_id_t key, goto exit; } - status = psa_generate_random(local_iv, default_iv_length); + status = psa_generate_random_internal(local_iv, default_iv_length); if (status != PSA_SUCCESS) { goto exit; } } + LOCAL_INPUT_ALLOC(input_external, input_length, input); + LOCAL_OUTPUT_ALLOC(output_external, output_size, output); + status = psa_driver_wrapper_cipher_encrypt( &attributes, slot->key.data, slot->key.bytes, alg, local_iv, default_iv_length, input, input_length, @@ -3620,21 +3980,28 @@ exit: *output_length = 0; } + LOCAL_INPUT_FREE(input_external, input); + LOCAL_OUTPUT_FREE(output_external, output); + return status; } psa_status_t psa_cipher_decrypt(mbedtls_svc_key_id_t key, psa_algorithm_t alg, - const uint8_t *input, + const uint8_t *input_external, size_t input_length, - uint8_t *output, + uint8_t *output_external, size_t output_size, size_t *output_length) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED; + psa_key_attributes_t attributes; psa_key_slot_t *slot = NULL; + LOCAL_INPUT_DECLARE(input_external, input); + LOCAL_OUTPUT_DECLARE(output_external, output); + if (!PSA_ALG_IS_CIPHER(alg)) { status = PSA_ERROR_INVALID_ARGUMENT; goto exit; @@ -3647,7 +4014,7 @@ psa_status_t psa_cipher_decrypt(mbedtls_svc_key_id_t key, goto exit; } - psa_key_attributes_t attributes = { + attributes = (psa_key_attributes_t) { .core = slot->attr }; @@ -3656,6 +4023,9 @@ psa_status_t psa_cipher_decrypt(mbedtls_svc_key_id_t key, goto exit; } + LOCAL_INPUT_ALLOC(input_external, input_length, input); + LOCAL_OUTPUT_ALLOC(output_external, output_size, output); + status = psa_driver_wrapper_cipher_decrypt( &attributes, slot->key.data, slot->key.bytes, alg, input, input_length, @@ -3671,6 +4041,9 @@ exit: *output_length = 0; } + LOCAL_INPUT_FREE(input_external, input); + LOCAL_OUTPUT_FREE(output_external, output); + return status; } @@ -3681,19 +4054,24 @@ exit: psa_status_t psa_aead_encrypt(mbedtls_svc_key_id_t key, psa_algorithm_t alg, - const uint8_t *nonce, + const uint8_t *nonce_external, size_t nonce_length, - const uint8_t *additional_data, + const uint8_t *additional_data_external, size_t additional_data_length, - const uint8_t *plaintext, + const uint8_t *plaintext_external, size_t plaintext_length, - uint8_t *ciphertext, + uint8_t *ciphertext_external, size_t ciphertext_size, size_t *ciphertext_length) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_key_slot_t *slot; + LOCAL_INPUT_DECLARE(nonce_external, nonce); + LOCAL_INPUT_DECLARE(additional_data_external, additional_data); + LOCAL_INPUT_DECLARE(plaintext_external, plaintext); + LOCAL_OUTPUT_DECLARE(ciphertext_external, ciphertext); + *ciphertext_length = 0; if (!PSA_ALG_IS_AEAD(alg) || PSA_ALG_IS_WILDCARD(alg)) { @@ -3710,6 +4088,11 @@ psa_status_t psa_aead_encrypt(mbedtls_svc_key_id_t key, .core = slot->attr }; + LOCAL_INPUT_ALLOC(nonce_external, nonce_length, nonce); + LOCAL_INPUT_ALLOC(additional_data_external, additional_data_length, additional_data); + LOCAL_INPUT_ALLOC(plaintext_external, plaintext_length, plaintext); + LOCAL_OUTPUT_ALLOC(ciphertext_external, ciphertext_size, ciphertext); + status = psa_driver_wrapper_aead_encrypt( &attributes, slot->key.data, slot->key.bytes, alg, @@ -3722,6 +4105,15 @@ psa_status_t psa_aead_encrypt(mbedtls_svc_key_id_t key, memset(ciphertext, 0, ciphertext_size); } +/* Exit label is only used for buffer copying, prevent unused warnings. */ +#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) +exit: +#endif + LOCAL_INPUT_FREE(nonce_external, nonce); + LOCAL_INPUT_FREE(additional_data_external, additional_data); + LOCAL_INPUT_FREE(plaintext_external, plaintext); + LOCAL_OUTPUT_FREE(ciphertext_external, ciphertext); + psa_unlock_key_slot(slot); return status; @@ -3729,19 +4121,24 @@ psa_status_t psa_aead_encrypt(mbedtls_svc_key_id_t key, psa_status_t psa_aead_decrypt(mbedtls_svc_key_id_t key, psa_algorithm_t alg, - const uint8_t *nonce, + const uint8_t *nonce_external, size_t nonce_length, - const uint8_t *additional_data, + const uint8_t *additional_data_external, size_t additional_data_length, - const uint8_t *ciphertext, + const uint8_t *ciphertext_external, size_t ciphertext_length, - uint8_t *plaintext, + uint8_t *plaintext_external, size_t plaintext_size, size_t *plaintext_length) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_key_slot_t *slot; + LOCAL_INPUT_DECLARE(nonce_external, nonce); + LOCAL_INPUT_DECLARE(additional_data_external, additional_data); + LOCAL_INPUT_DECLARE(ciphertext_external, ciphertext); + LOCAL_OUTPUT_DECLARE(plaintext_external, plaintext); + *plaintext_length = 0; if (!PSA_ALG_IS_AEAD(alg) || PSA_ALG_IS_WILDCARD(alg)) { @@ -3758,6 +4155,12 @@ psa_status_t psa_aead_decrypt(mbedtls_svc_key_id_t key, .core = slot->attr }; + LOCAL_INPUT_ALLOC(nonce_external, nonce_length, nonce); + LOCAL_INPUT_ALLOC(additional_data_external, additional_data_length, + additional_data); + LOCAL_INPUT_ALLOC(ciphertext_external, ciphertext_length, ciphertext); + LOCAL_OUTPUT_ALLOC(plaintext_external, plaintext_size, plaintext); + status = psa_driver_wrapper_aead_decrypt( &attributes, slot->key.data, slot->key.bytes, alg, @@ -3770,6 +4173,15 @@ psa_status_t psa_aead_decrypt(mbedtls_svc_key_id_t key, memset(plaintext, 0, plaintext_size); } +/* Exit label is only used for buffer copying, prevent unused warnings. */ +#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) +exit: +#endif + LOCAL_INPUT_FREE(nonce_external, nonce); + LOCAL_INPUT_FREE(additional_data_external, additional_data); + LOCAL_INPUT_FREE(ciphertext_external, ciphertext); + LOCAL_OUTPUT_FREE(plaintext_external, plaintext); + psa_unlock_key_slot(slot); return status; @@ -4163,10 +4575,12 @@ static psa_status_t psa_key_derivation_tls12_prf_read( psa_status_t psa_key_derivation_output_bytes( psa_key_derivation_operation_t *operation, - uint8_t *output, + uint8_t *output_external, size_t output_length) { psa_status_t status; + LOCAL_OUTPUT_DECLARE(output_external, output); + psa_algorithm_t kdf_alg = psa_key_derivation_get_kdf_alg(operation); if (operation->alg == 0) { @@ -4174,13 +4588,6 @@ psa_status_t psa_key_derivation_output_bytes( return PSA_ERROR_BAD_STATE; } - if (output_length > operation->capacity) { - operation->capacity = 0; - /* Go through the error path to wipe all confidential data now - * that the operation object is useless. */ - status = PSA_ERROR_INSUFFICIENT_DATA; - goto exit; - } if (output_length == 0 && operation->capacity == 0) { /* Edge case: this is a finished operation, and 0 bytes * were requested. The right error in this case could @@ -4190,6 +4597,15 @@ psa_status_t psa_key_derivation_output_bytes( * output_length > 0. */ return PSA_ERROR_INSUFFICIENT_DATA; } + + LOCAL_OUTPUT_ALLOC(output_external, output_length, output); + if (output_length > operation->capacity) { + operation->capacity = 0; + /* Go through the error path to wipe all confidential data now + * that the operation object is useless. */ + status = PSA_ERROR_INSUFFICIENT_DATA; + goto exit; + } operation->capacity -= output_length; #if defined(MBEDTLS_PSA_BUILTIN_ALG_HKDF) @@ -4211,7 +4627,10 @@ psa_status_t psa_key_derivation_output_bytes( * MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS */ { (void) kdf_alg; - return PSA_ERROR_BAD_STATE; + status = PSA_ERROR_BAD_STATE; + LOCAL_OUTPUT_FREE(output_external, output); + + return status; } exit: @@ -4223,8 +4642,12 @@ exit: psa_algorithm_t alg = operation->alg; psa_key_derivation_abort(operation); operation->alg = alg; - memset(output, '!', output_length); + if (output != NULL) { + memset(output, '!', output_length); + } } + + LOCAL_OUTPUT_FREE(output_external, output); return status; } @@ -4251,6 +4674,7 @@ static psa_status_t psa_generate_derived_key_internal( uint8_t *data = NULL; size_t bytes = PSA_BITS_TO_BYTES(bits); psa_status_t status; + psa_key_attributes_t attributes; if (!key_type_is_raw_bytes(slot->attr.type)) { return PSA_ERROR_INVALID_ARGUMENT; @@ -4279,7 +4703,7 @@ static psa_status_t psa_generate_derived_key_internal( } slot->attr.bits = (psa_key_bits_t) bits; - psa_key_attributes_t attributes = { + attributes = (psa_key_attributes_t) { .core = slot->attr }; @@ -4379,21 +4803,10 @@ static psa_status_t psa_hash_try_support(psa_algorithm_t alg) return status; } -static psa_status_t psa_key_derivation_setup_kdf( +static psa_status_t psa_key_derivation_set_maximum_capacity( psa_key_derivation_operation_t *operation, psa_algorithm_t kdf_alg) { - /* Make sure that operation->ctx is properly zero-initialised. (Macro - * initialisers for this union leave some bytes unspecified.) */ - memset(&operation->ctx, 0, sizeof(operation->ctx)); - - /* Make sure that kdf_alg is a supported key derivation algorithm. */ - if (!is_kdf_alg_supported(kdf_alg)) { - return PSA_ERROR_NOT_SUPPORTED; - } - - /* All currently supported key derivation algorithms are based on a - * hash algorithm. */ psa_algorithm_t hash_alg = PSA_ALG_HKDF_GET_HASH(kdf_alg); size_t hash_size = PSA_HASH_LENGTH(hash_alg); if (hash_size == 0) { @@ -4408,14 +4821,48 @@ static psa_status_t psa_key_derivation_setup_kdf( return status; } - if ((PSA_ALG_IS_TLS12_PRF(kdf_alg) || - PSA_ALG_IS_TLS12_PSK_TO_MS(kdf_alg)) && - !(hash_alg == PSA_ALG_SHA_256 || hash_alg == PSA_ALG_SHA_384)) { +#if defined(PSA_WANT_ALG_HKDF) + if (PSA_ALG_IS_HKDF(kdf_alg)) { + operation->capacity = 255 * hash_size; + } else +#endif +#if defined(PSA_WANT_ALG_TLS12_PRF) + if (PSA_ALG_IS_TLS12_PRF(kdf_alg) && + (hash_alg == PSA_ALG_SHA_256 || hash_alg == PSA_ALG_SHA_384)) { + operation->capacity = SIZE_MAX; + } else +#endif +#if defined(PSA_WANT_ALG_TLS12_PSK_TO_MS) + if (PSA_ALG_IS_TLS12_PSK_TO_MS(kdf_alg) && + (hash_alg == PSA_ALG_SHA_256 || hash_alg == PSA_ALG_SHA_384)) { + /* Master Secret is always 48 bytes + * https://datatracker.ietf.org/doc/html/rfc5246.html#section-8.1 */ + operation->capacity = 48U; + } else +#endif + { + (void) hash_size; + status = PSA_ERROR_NOT_SUPPORTED; + } + return status; +} + + +static psa_status_t psa_key_derivation_setup_kdf( + psa_key_derivation_operation_t *operation, + psa_algorithm_t kdf_alg) +{ + /* Make sure that operation->ctx is properly zero-initialised. (Macro + * initialisers for this union leave some bytes unspecified.) */ + memset(&operation->ctx, 0, sizeof(operation->ctx)); + /* Make sure that kdf_alg is a supported key derivation algorithm. */ + if (!is_kdf_alg_supported(kdf_alg)) { return PSA_ERROR_NOT_SUPPORTED; } - operation->capacity = 255 * hash_size; - return PSA_SUCCESS; + psa_status_t status = psa_key_derivation_set_maximum_capacity(operation, + kdf_alg); + return status; } static psa_status_t psa_key_agreement_try_support(psa_algorithm_t alg) @@ -4774,12 +5221,22 @@ exit: psa_status_t psa_key_derivation_input_bytes( psa_key_derivation_operation_t *operation, psa_key_derivation_step_t step, - const uint8_t *data, + const uint8_t *data_external, size_t data_length) { - return psa_key_derivation_input_internal(operation, step, - PSA_KEY_TYPE_NONE, - data, data_length); + psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; + LOCAL_INPUT_DECLARE(data_external, data); + + LOCAL_INPUT_ALLOC(data_external, data_length, data); + + status = psa_key_derivation_input_internal(operation, step, + PSA_KEY_TYPE_NONE, + data, data_length); +#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) +exit: +#endif + LOCAL_INPUT_FREE(data_external, data); + return status; } psa_status_t psa_key_derivation_input_key( @@ -4891,14 +5348,16 @@ static psa_status_t psa_key_agreement_raw_internal(psa_algorithm_t alg, size_t shared_secret_size, size_t *shared_secret_length) { + mbedtls_ecp_keypair *ecp = NULL; + psa_status_t status; + switch (alg) { #if defined(MBEDTLS_PSA_BUILTIN_ALG_ECDH) case PSA_ALG_ECDH: if (!PSA_KEY_TYPE_IS_ECC_KEY_PAIR(private_key->attr.type)) { return PSA_ERROR_INVALID_ARGUMENT; } - mbedtls_ecp_keypair *ecp = NULL; - psa_status_t status = mbedtls_psa_ecp_load_representation( + status = mbedtls_psa_ecp_load_representation( private_key->attr.type, private_key->attr.bits, private_key->key.data, @@ -4916,6 +5375,8 @@ static psa_status_t psa_key_agreement_raw_internal(psa_algorithm_t alg, return status; #endif /* MBEDTLS_PSA_BUILTIN_ALG_ECDH */ default: + (void) ecp; + (void) status; (void) private_key; (void) peer_key; (void) peer_key_length; @@ -4967,12 +5428,13 @@ exit: psa_status_t psa_key_derivation_key_agreement(psa_key_derivation_operation_t *operation, psa_key_derivation_step_t step, mbedtls_svc_key_id_t private_key, - const uint8_t *peer_key, + const uint8_t *peer_key_external, size_t peer_key_length) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED; psa_key_slot_t *slot; + LOCAL_INPUT_DECLARE(peer_key_external, peer_key); if (!PSA_ALG_IS_KEY_AGREEMENT(operation->alg)) { return PSA_ERROR_INVALID_ARGUMENT; @@ -4982,9 +5444,15 @@ psa_status_t psa_key_derivation_key_agreement(psa_key_derivation_operation_t *op if (status != PSA_SUCCESS) { return status; } + + LOCAL_INPUT_ALLOC(peer_key_external, peer_key_length, peer_key); status = psa_key_agreement_internal(operation, step, slot, peer_key, peer_key_length); + +#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) +exit: +#endif if (status != PSA_SUCCESS) { psa_key_derivation_abort(operation); } else { @@ -4997,20 +5465,25 @@ psa_status_t psa_key_derivation_key_agreement(psa_key_derivation_operation_t *op unlock_status = psa_unlock_key_slot(slot); + LOCAL_INPUT_FREE(peer_key_external, peer_key); return (status == PSA_SUCCESS) ? unlock_status : status; } psa_status_t psa_raw_key_agreement(psa_algorithm_t alg, mbedtls_svc_key_id_t private_key, - const uint8_t *peer_key, + const uint8_t *peer_key_external, size_t peer_key_length, - uint8_t *output, + uint8_t *output_external, size_t output_size, size_t *output_length) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED; psa_key_slot_t *slot = NULL; + size_t expected_length; + LOCAL_INPUT_DECLARE(peer_key_external, peer_key); + LOCAL_OUTPUT_DECLARE(output_external, output); + LOCAL_OUTPUT_ALLOC(output_external, output_size, output); if (!PSA_ALG_IS_KEY_AGREEMENT(alg)) { status = PSA_ERROR_INVALID_ARGUMENT; @@ -5030,20 +5503,23 @@ psa_status_t psa_raw_key_agreement(psa_algorithm_t alg, * PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE() is exact so the point is moot. * If FFDH is implemented, PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE() can easily * be exact for it as well. */ - size_t expected_length = + expected_length = PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE(slot->attr.type, slot->attr.bits); if (output_size < expected_length) { status = PSA_ERROR_BUFFER_TOO_SMALL; goto exit; } + LOCAL_INPUT_ALLOC(peer_key_external, peer_key_length, peer_key); status = psa_key_agreement_raw_internal(alg, slot, peer_key, peer_key_length, output, output_size, output_length); exit: - if (status != PSA_SUCCESS) { + /* Check for successful allocation of output, + * with an unsuccessful status. */ + if (output != NULL && status != PSA_SUCCESS) { /* If an error happens and is not handled properly, the output * may be used as a key to protect sensitive data. Arrange for such * a key to be random, which is likely to result in decryption or @@ -5051,21 +5527,31 @@ exit: * some constant data such as zeros, which would result in the data * being protected with a reproducible, easily knowable key. */ - psa_generate_random(output, output_size); + psa_generate_random_internal(output, output_size); *output_length = output_size; } + if (output == NULL) { + /* output allocation failed. */ + *output_length = 0; + } + unlock_status = psa_unlock_key_slot(slot); + LOCAL_INPUT_FREE(peer_key_external, peer_key); + LOCAL_OUTPUT_FREE(output_external, output); return (status == PSA_SUCCESS) ? unlock_status : status; } - /****************************************************************/ /* Random generation */ /****************************************************************/ +#if defined(MBEDTLS_PSA_INJECT_ENTROPY) +#include "mbedtls/entropy_poll.h" +#endif + /** Initialize the PSA random generator. */ static void mbedtls_psa_random_init(mbedtls_psa_random_context_t *rng) @@ -5126,44 +5612,21 @@ static psa_status_t mbedtls_psa_random_seed(mbedtls_psa_random_context_t *rng) #endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */ } -psa_status_t psa_generate_random(uint8_t *output, +psa_status_t psa_generate_random(uint8_t *output_external, size_t output_size) { - GUARD_MODULE_INITIALIZED; - -#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) + psa_status_t status; - size_t output_length = 0; - psa_status_t status = mbedtls_psa_external_get_random(&global_data.rng, - output, output_size, - &output_length); - if (status != PSA_SUCCESS) { - return status; - } - /* Breaking up a request into smaller chunks is currently not supported - * for the external RNG interface. */ - if (output_length != output_size) { - return PSA_ERROR_INSUFFICIENT_ENTROPY; - } - return PSA_SUCCESS; + LOCAL_OUTPUT_DECLARE(output_external, output); + LOCAL_OUTPUT_ALLOC(output_external, output_size, output); -#else /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */ + status = psa_generate_random_internal(output, output_size); - while (output_size > 0) { - size_t request_size = - (output_size > MBEDTLS_PSA_RANDOM_MAX_REQUEST ? - MBEDTLS_PSA_RANDOM_MAX_REQUEST : - output_size); - int ret = mbedtls_psa_get_random(MBEDTLS_PSA_RANDOM_STATE, - output, request_size); - if (ret != 0) { - return mbedtls_to_psa_error(ret); - } - output_size -= request_size; - output += request_size; - } - return PSA_SUCCESS; -#endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */ +#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) +exit: +#endif + LOCAL_OUTPUT_FREE(output_external, output); + return status; } /* Wrapper function allowing the classic API to use the PSA RNG. @@ -5200,8 +5663,6 @@ int mbedtls_psa_get_random(void *p_rng, #endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */ #if defined(MBEDTLS_PSA_INJECT_ENTROPY) -#include "mbedtls/entropy_poll.h" - psa_status_t mbedtls_psa_inject_entropy(const uint8_t *seed, size_t seed_size) { @@ -5508,4 +5969,182 @@ exit: return status; } +/* Memory copying test hooks. These are called before input copy, after input + * copy, before output copy and after output copy, respectively. + * They are used by memory-poisoning tests to temporarily unpoison buffers + * while they are copied. */ +#if defined(MBEDTLS_TEST_HOOKS) +void (*psa_input_pre_copy_hook)(const uint8_t *input, size_t input_len) = NULL; +void (*psa_input_post_copy_hook)(const uint8_t *input, size_t input_len) = NULL; +void (*psa_output_pre_copy_hook)(const uint8_t *output, size_t output_len) = NULL; +void (*psa_output_post_copy_hook)(const uint8_t *output, size_t output_len) = NULL; +#endif + +/** Copy from an input buffer to a local copy. + * + * \param[in] input Pointer to input buffer. + * \param[in] input_len Length of the input buffer. + * \param[out] input_copy Pointer to a local copy in which to store the input data. + * \param[out] input_copy_len Length of the local copy buffer. + * \return #PSA_SUCCESS, if the buffer was successfully + * copied. + * \return #PSA_ERROR_CORRUPTION_DETECTED, if the local + * copy is too small to hold contents of the + * input buffer. + */ +MBEDTLS_STATIC_TESTABLE +psa_status_t psa_crypto_copy_input(const uint8_t *input, size_t input_len, + uint8_t *input_copy, size_t input_copy_len) +{ + if (input_len > input_copy_len) { + return PSA_ERROR_CORRUPTION_DETECTED; + } + +#if defined(MBEDTLS_TEST_HOOKS) + if (psa_input_pre_copy_hook != NULL) { + psa_input_pre_copy_hook(input, input_len); + } +#endif + + if (input_len > 0) { + memcpy(input_copy, input, input_len); + } + +#if defined(MBEDTLS_TEST_HOOKS) + if (psa_input_post_copy_hook != NULL) { + psa_input_post_copy_hook(input, input_len); + } +#endif + + return PSA_SUCCESS; +} + +/** Copy from a local output buffer into a user-supplied one. + * + * \param[in] output_copy Pointer to a local buffer containing the output. + * \param[in] output_copy_len Length of the local buffer. + * \param[out] output Pointer to user-supplied output buffer. + * \param[out] output_len Length of the user-supplied output buffer. + * \return #PSA_SUCCESS, if the buffer was successfully + * copied. + * \return #PSA_ERROR_BUFFER_TOO_SMALL, if the + * user-supplied output buffer is too small to + * hold the contents of the local buffer. + */ +MBEDTLS_STATIC_TESTABLE +psa_status_t psa_crypto_copy_output(const uint8_t *output_copy, size_t output_copy_len, + uint8_t *output, size_t output_len) +{ + if (output_len < output_copy_len) { + return PSA_ERROR_BUFFER_TOO_SMALL; + } + +#if defined(MBEDTLS_TEST_HOOKS) + if (psa_output_pre_copy_hook != NULL) { + psa_output_pre_copy_hook(output, output_len); + } +#endif + + if (output_copy_len > 0) { + memcpy(output, output_copy, output_copy_len); + } + +#if defined(MBEDTLS_TEST_HOOKS) + if (psa_output_post_copy_hook != NULL) { + psa_output_post_copy_hook(output, output_len); + } +#endif + + return PSA_SUCCESS; +} + +psa_status_t psa_crypto_local_input_alloc(const uint8_t *input, size_t input_len, + psa_crypto_local_input_t *local_input) +{ + psa_status_t status; + + *local_input = PSA_CRYPTO_LOCAL_INPUT_INIT; + + if (input_len == 0) { + return PSA_SUCCESS; + } + + local_input->buffer = mbedtls_calloc(input_len, 1); + if (local_input->buffer == NULL) { + /* Since we dealt with the zero-length case above, we know that + * a NULL return value means a failure of allocation. */ + return PSA_ERROR_INSUFFICIENT_MEMORY; + } + /* From now on, we must free local_input->buffer on error. */ + + local_input->length = input_len; + + status = psa_crypto_copy_input(input, input_len, + local_input->buffer, local_input->length); + if (status != PSA_SUCCESS) { + goto error; + } + + return PSA_SUCCESS; + +error: + mbedtls_free(local_input->buffer); + local_input->buffer = NULL; + local_input->length = 0; + return status; +} + +void psa_crypto_local_input_free(psa_crypto_local_input_t *local_input) +{ + mbedtls_free(local_input->buffer); + local_input->buffer = NULL; + local_input->length = 0; +} + +psa_status_t psa_crypto_local_output_alloc(uint8_t *output, size_t output_len, + psa_crypto_local_output_t *local_output) +{ + *local_output = PSA_CRYPTO_LOCAL_OUTPUT_INIT; + + if (output_len == 0) { + return PSA_SUCCESS; + } + local_output->buffer = mbedtls_calloc(output_len, 1); + if (local_output->buffer == NULL) { + /* Since we dealt with the zero-length case above, we know that + * a NULL return value means a failure of allocation. */ + return PSA_ERROR_INSUFFICIENT_MEMORY; + } + local_output->length = output_len; + local_output->original = output; + + return PSA_SUCCESS; +} + +psa_status_t psa_crypto_local_output_free(psa_crypto_local_output_t *local_output) +{ + psa_status_t status; + + if (local_output->buffer == NULL) { + local_output->length = 0; + return PSA_SUCCESS; + } + if (local_output->original == NULL) { + /* We have an internal copy but nothing to copy back to. */ + return PSA_ERROR_CORRUPTION_DETECTED; + } + + status = psa_crypto_copy_output(local_output->buffer, local_output->length, + local_output->original, local_output->length); + if (status != PSA_SUCCESS) { + return status; + } + + mbedtls_free(local_output->buffer); + local_output->buffer = NULL; + local_output->length = 0; + + return PSA_SUCCESS; +} + #endif /* MBEDTLS_PSA_CRYPTO_C */ diff --git a/c++/src/connect/mbedtls/psa_crypto_aead.c b/c++/src/connect/mbedtls/psa_crypto_aead.c index 26ccc1ca..ed9e55ad 100644 --- a/c++/src/connect/mbedtls/psa_crypto_aead.c +++ b/c++/src/connect/mbedtls/psa_crypto_aead.c @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/psa_crypto_aead.h b/c++/src/connect/mbedtls/psa_crypto_aead.h index 8586c7bf..e1ff0e5e 100644 --- a/c++/src/connect/mbedtls/psa_crypto_aead.h +++ b/c++/src/connect/mbedtls/psa_crypto_aead.h @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_AEAD_H diff --git a/c++/src/connect/mbedtls/psa_crypto_cipher.c b/c++/src/connect/mbedtls/psa_crypto_cipher.c index d216339e..93a6b93f 100644 --- a/c++/src/connect/mbedtls/psa_crypto_cipher.c +++ b/c++/src/connect/mbedtls/psa_crypto_cipher.c @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" @@ -414,7 +402,11 @@ psa_status_t mbedtls_psa_cipher_update( output_length); } else #endif /* MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING */ - { + if (input_length == 0) { + /* There is no input, nothing to be done */ + *output_length = 0; + status = PSA_SUCCESS; + } else { status = mbedtls_to_psa_error( mbedtls_cipher_update(&operation->ctx.cipher, input, input_length, output, output_length)); diff --git a/c++/src/connect/mbedtls/psa_crypto_cipher.h b/c++/src/connect/mbedtls/psa_crypto_cipher.h index bf43ff08..2478d586 100644 --- a/c++/src/connect/mbedtls/psa_crypto_cipher.h +++ b/c++/src/connect/mbedtls/psa_crypto_cipher.h @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_CIPHER_H diff --git a/c++/src/connect/mbedtls/psa_crypto_client.c b/c++/src/connect/mbedtls/psa_crypto_client.c index c3234275..564463fe 100644 --- a/c++/src/connect/mbedtls/psa_crypto_client.c +++ b/c++/src/connect/mbedtls/psa_crypto_client.c @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/psa_crypto_core.h b/c++/src/connect/mbedtls/psa_crypto_core.h index 688ea388..4731064f 100644 --- a/c++/src/connect/mbedtls/psa_crypto_core.h +++ b/c++/src/connect/mbedtls/psa_crypto_core.h @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_CORE_H @@ -238,12 +226,12 @@ psa_status_t psa_copy_key_material_into_slot(psa_key_slot_t *slot, const uint8_t *data, size_t data_length); -/** Convert an mbed TLS error code to a PSA error code +/** Convert an Mbed TLS error code to a PSA error code * * \note This function is provided solely for the convenience of * Mbed TLS and may be removed at any time without notice. * - * \param ret An mbed TLS-thrown error code + * \param ret An Mbed TLS-thrown error code * * \return The corresponding PSA error code */ @@ -515,4 +503,74 @@ psa_status_t psa_verify_hash_builtin( psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, const uint8_t *signature, size_t signature_length); +typedef struct psa_crypto_local_input_s { + uint8_t *buffer; + size_t length; +} psa_crypto_local_input_t; + +#define PSA_CRYPTO_LOCAL_INPUT_INIT ((psa_crypto_local_input_t) { NULL, 0 }) + +/** Allocate a local copy of an input buffer and copy the contents into it. + * + * \param[in] input Pointer to input buffer. + * \param[in] input_len Length of the input buffer. + * \param[out] local_input Pointer to a psa_crypto_local_input_t struct + * containing a local input copy. + * \return #PSA_SUCCESS, if the buffer was successfully + * copied. + * \return #PSA_ERROR_INSUFFICIENT_MEMORY, if a copy of + * the buffer cannot be allocated. + */ +psa_status_t psa_crypto_local_input_alloc(const uint8_t *input, size_t input_len, + psa_crypto_local_input_t *local_input); + +/** Free a local copy of an input buffer. + * + * \param[in] local_input Pointer to a psa_crypto_local_input_t struct + * populated by a previous call to + * psa_crypto_local_input_alloc(). + */ +void psa_crypto_local_input_free(psa_crypto_local_input_t *local_input); + +typedef struct psa_crypto_local_output_s { + uint8_t *original; + uint8_t *buffer; + size_t length; +} psa_crypto_local_output_t; + +#define PSA_CRYPTO_LOCAL_OUTPUT_INIT ((psa_crypto_local_output_t) { NULL, NULL, 0 }) + +/** Allocate a local copy of an output buffer. + * + * \note This does not copy any data from the original + * output buffer but only allocates a buffer + * whose contents will be copied back to the + * original in a future call to + * psa_crypto_local_output_free(). + * + * \param[in] output Pointer to output buffer. + * \param[in] output_len Length of the output buffer. + * \param[out] local_output Pointer to a psa_crypto_local_output_t struct to + * populate with the local output copy. + * \return #PSA_SUCCESS, if the buffer was successfully + * copied. + * \return #PSA_ERROR_INSUFFICIENT_MEMORY, if a copy of + * the buffer cannot be allocated. + */ +psa_status_t psa_crypto_local_output_alloc(uint8_t *output, size_t output_len, + psa_crypto_local_output_t *local_output); + +/** Copy from a local copy of an output buffer back to the original, then + * free the local copy. + * + * \param[in] local_output Pointer to a psa_crypto_local_output_t struct + * populated by a previous call to + * psa_crypto_local_output_alloc(). + * \return #PSA_SUCCESS, if the local output was + * successfully copied back to the original. + * \return #PSA_ERROR_CORRUPTION_DETECTED, if the output + * could not be copied back to the original. + */ +psa_status_t psa_crypto_local_output_free(psa_crypto_local_output_t *local_output); + #endif /* PSA_CRYPTO_CORE_H */ diff --git a/c++/src/connect/mbedtls/psa_crypto_driver_wrappers.c b/c++/src/connect/mbedtls/psa_crypto_driver_wrappers.c index 61563853..196cd2ed 100644 --- a/c++/src/connect/mbedtls/psa_crypto_driver_wrappers.c +++ b/c++/src/connect/mbedtls/psa_crypto_driver_wrappers.c @@ -4,19 +4,7 @@ * Warning: This file will be auto-generated in the future. */ /* Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "psa_crypto_aead.h" diff --git a/c++/src/connect/mbedtls/psa_crypto_driver_wrappers.h b/c++/src/connect/mbedtls/psa_crypto_driver_wrappers.h index 9471099d..7e769777 100644 --- a/c++/src/connect/mbedtls/psa_crypto_driver_wrappers.h +++ b/c++/src/connect/mbedtls/psa_crypto_driver_wrappers.h @@ -4,19 +4,7 @@ * Warning: This file will be auto-generated in the future. */ /* Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_DRIVER_WRAPPERS_H diff --git a/c++/src/connect/mbedtls/psa_crypto_ecp.c b/c++/src/connect/mbedtls/psa_crypto_ecp.c index ea0eb1be..b00f5582 100644 --- a/c++/src/connect/mbedtls/psa_crypto_ecp.c +++ b/c++/src/connect/mbedtls/psa_crypto_ecp.c @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/psa_crypto_ecp.h b/c++/src/connect/mbedtls/psa_crypto_ecp.h index 7541c774..44c4a589 100644 --- a/c++/src/connect/mbedtls/psa_crypto_ecp.h +++ b/c++/src/connect/mbedtls/psa_crypto_ecp.h @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_ECP_H diff --git a/c++/src/connect/mbedtls/psa_crypto_hash.c b/c++/src/connect/mbedtls/psa_crypto_hash.c index ef733204..484c81bc 100644 --- a/c++/src/connect/mbedtls/psa_crypto_hash.c +++ b/c++/src/connect/mbedtls/psa_crypto_hash.c @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/psa_crypto_hash.h b/c++/src/connect/mbedtls/psa_crypto_hash.h index 1c1b4519..5c196b2a 100644 --- a/c++/src/connect/mbedtls/psa_crypto_hash.h +++ b/c++/src/connect/mbedtls/psa_crypto_hash.h @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_HASH_H diff --git a/c++/src/connect/mbedtls/psa_crypto_invasive.h b/c++/src/connect/mbedtls/psa_crypto_invasive.h index 58e357e3..a1281d14 100644 --- a/c++/src/connect/mbedtls/psa_crypto_invasive.h +++ b/c++/src/connect/mbedtls/psa_crypto_invasive.h @@ -10,19 +10,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_INVASIVE_H @@ -81,6 +69,21 @@ psa_status_t mbedtls_psa_crypto_configure_entropy_sources( psa_status_t psa_mac_key_can_do( psa_algorithm_t algorithm, psa_key_type_t key_type); + +psa_status_t psa_crypto_copy_input(const uint8_t *input, size_t input_len, + uint8_t *input_copy, size_t input_copy_len); + +psa_status_t psa_crypto_copy_output(const uint8_t *output_copy, size_t output_copy_len, + uint8_t *output, size_t output_len); + +/* + * Test hooks to use for memory unpoisoning/poisoning in copy functions. + */ +extern void (*psa_input_pre_copy_hook)(const uint8_t *input, size_t input_len); +extern void (*psa_input_post_copy_hook)(const uint8_t *input, size_t input_len); +extern void (*psa_output_pre_copy_hook)(const uint8_t *output, size_t output_len); +extern void (*psa_output_post_copy_hook)(const uint8_t *output, size_t output_len); + #endif /* MBEDTLS_TEST_HOOKS && MBEDTLS_PSA_CRYPTO_C */ #endif /* PSA_CRYPTO_INVASIVE_H */ diff --git a/c++/src/connect/mbedtls/psa_crypto_its.h b/c++/src/connect/mbedtls/psa_crypto_its.h index 3ceee49b..877063b8 100644 --- a/c++/src/connect/mbedtls/psa_crypto_its.h +++ b/c++/src/connect/mbedtls/psa_crypto_its.h @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_ITS_H diff --git a/c++/src/connect/mbedtls/psa_crypto_mac.c b/c++/src/connect/mbedtls/psa_crypto_mac.c index 07f123ee..2e722d2a 100644 --- a/c++/src/connect/mbedtls/psa_crypto_mac.c +++ b/c++/src/connect/mbedtls/psa_crypto_mac.c @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/psa_crypto_mac.h b/c++/src/connect/mbedtls/psa_crypto_mac.h index 4f8024a9..2f614bcc 100644 --- a/c++/src/connect/mbedtls/psa_crypto_mac.h +++ b/c++/src/connect/mbedtls/psa_crypto_mac.h @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_MAC_H diff --git a/c++/src/connect/mbedtls/psa_crypto_random_impl.h b/c++/src/connect/mbedtls/psa_crypto_random_impl.h index f1a2af11..6150fee1 100644 --- a/c++/src/connect/mbedtls/psa_crypto_random_impl.h +++ b/c++/src/connect/mbedtls/psa_crypto_random_impl.h @@ -12,19 +12,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_RANDOM_IMPL_H diff --git a/c++/src/connect/mbedtls/psa_crypto_rsa.c b/c++/src/connect/mbedtls/psa_crypto_rsa.c index 853a0443..cc3cecaf 100644 --- a/c++/src/connect/mbedtls/psa_crypto_rsa.c +++ b/c++/src/connect/mbedtls/psa_crypto_rsa.c @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/psa_crypto_rsa.h b/c++/src/connect/mbedtls/psa_crypto_rsa.h index 82ea4746..f4aadda7 100644 --- a/c++/src/connect/mbedtls/psa_crypto_rsa.h +++ b/c++/src/connect/mbedtls/psa_crypto_rsa.h @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_RSA_H diff --git a/c++/src/connect/mbedtls/psa_crypto_se.c b/c++/src/connect/mbedtls/psa_crypto_se.c index 7bea10ad..9628ff28 100644 --- a/c++/src/connect/mbedtls/psa_crypto_se.c +++ b/c++/src/connect/mbedtls/psa_crypto_se.c @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/psa_crypto_se.h b/c++/src/connect/mbedtls/psa_crypto_se.h index 373852df..14a70005 100644 --- a/c++/src/connect/mbedtls/psa_crypto_se.h +++ b/c++/src/connect/mbedtls/psa_crypto_se.h @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_SE_H diff --git a/c++/src/connect/mbedtls/psa_crypto_slot_management.c b/c++/src/connect/mbedtls/psa_crypto_slot_management.c index 2d279020..b79c713a 100644 --- a/c++/src/connect/mbedtls/psa_crypto_slot_management.c +++ b/c++/src/connect/mbedtls/psa_crypto_slot_management.c @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/psa_crypto_slot_management.h b/c++/src/connect/mbedtls/psa_crypto_slot_management.h index c8366abe..6041a352 100644 --- a/c++/src/connect/mbedtls/psa_crypto_slot_management.h +++ b/c++/src/connect/mbedtls/psa_crypto_slot_management.h @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_SLOT_MANAGEMENT_H diff --git a/c++/src/connect/mbedtls/psa_crypto_storage.c b/c++/src/connect/mbedtls/psa_crypto_storage.c index 688940b5..a0e40c89 100644 --- a/c++/src/connect/mbedtls/psa_crypto_storage.c +++ b/c++/src/connect/mbedtls/psa_crypto_storage.c @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/psa_crypto_storage.h b/c++/src/connect/mbedtls/psa_crypto_storage.h index 04768f8a..b6b5e154 100644 --- a/c++/src/connect/mbedtls/psa_crypto_storage.h +++ b/c++/src/connect/mbedtls/psa_crypto_storage.h @@ -5,19 +5,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef PSA_CRYPTO_STORAGE_H @@ -39,7 +27,7 @@ extern "C" { /* Sanity check: a file size must fit in 32 bits. Allow a generous * 64kB of metadata. */ #if PSA_CRYPTO_MAX_STORAGE_SIZE > 0xffff0000 -#error PSA_CRYPTO_MAX_STORAGE_SIZE > 0xffff0000 +#error "PSA_CRYPTO_MAX_STORAGE_SIZE > 0xffff0000" #endif /** The maximum permitted persistent slot number. @@ -202,7 +190,7 @@ psa_status_t psa_parse_key_data_from_storage(const uint8_t *storage_data, #if defined(MBEDTLS_PSA_CRYPTO_SE_C) /** This symbol is defined if transaction support is required. */ -#define PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS +#define PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS 1 #endif #if defined(PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS) diff --git a/c++/src/connect/mbedtls/psa_its_file.c b/c++/src/connect/mbedtls/psa_its_file.c index be3c2d58..7ac99bd3 100644 --- a/c++/src/connect/mbedtls/psa_its_file.c +++ b/c++/src/connect/mbedtls/psa_its_file.c @@ -3,19 +3,7 @@ */ /* * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/ripemd160.c b/c++/src/connect/mbedtls/ripemd160.c index a2e11cdf..3e8ede30 100644 --- a/c++/src/connect/mbedtls/ripemd160.c +++ b/c++/src/connect/mbedtls/ripemd160.c @@ -2,19 +2,7 @@ * RIPE MD-160 implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* diff --git a/c++/src/connect/mbedtls/rsa.c b/c++/src/connect/mbedtls/rsa.c index f44b2c38..0a0c2e38 100644 --- a/c++/src/connect/mbedtls/rsa.c +++ b/c++/src/connect/mbedtls/rsa.c @@ -2,19 +2,7 @@ * The RSA public-key cryptosystem * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* @@ -46,6 +34,7 @@ #include "mbedtls/error.h" #include "constant_time_internal.h" #include "mbedtls/constant_time.h" +#include "bignum_internal.h" #include @@ -816,6 +805,46 @@ cleanup: return ret; } +/* + * Unblind + * T = T * Vf mod N + */ +static int rsa_unblind(mbedtls_mpi *T, mbedtls_mpi *Vf, const mbedtls_mpi *N) +{ + int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; + const size_t nlimbs = N->n; + const size_t tlimbs = 2 * (nlimbs + 1); + + mbedtls_mpi_uint mm = mbedtls_mpi_montmul_init(N->p); + + mbedtls_mpi RR, M_T; + + mbedtls_mpi_init(&RR); + mbedtls_mpi_init(&M_T); + + MBEDTLS_MPI_CHK(mbedtls_mpi_get_mont_r2_unsafe(&RR, N)); + MBEDTLS_MPI_CHK(mbedtls_mpi_grow(&M_T, tlimbs)); + + MBEDTLS_MPI_CHK(mbedtls_mpi_grow(T, nlimbs)); + MBEDTLS_MPI_CHK(mbedtls_mpi_grow(Vf, nlimbs)); + + /* T = T * Vf mod N + * Reminder: montmul(A, B, N) = A * B * R^-1 mod N + * Usually both operands are multiplied by R mod N beforehand, yielding a + * result that's also * R mod N (aka "in the Montgomery domain"). Here we + * only multiply one operand by R mod N, so the result is directly what we + * want - no need to call `mpi_montred()` on it. */ + mbedtls_mpi_montmul(T, &RR, N, mm, &M_T); + mbedtls_mpi_montmul(T, Vf, N, mm, &M_T); + +cleanup: + + mbedtls_mpi_free(&RR); + mbedtls_mpi_free(&M_T); + + return ret; +} + /* * Exponent blinding supposed to prevent side-channel attacks using multiple * traces of measurements to recover the RSA key. The more collisions are there, @@ -879,7 +908,7 @@ int mbedtls_rsa_private(mbedtls_rsa_context *ctx, /* Temporaries holding the initial input and the double * checked result; should be the same in the end. */ - mbedtls_mpi I, C; + mbedtls_mpi input_blinded, check_result_blinded; RSA_VALIDATE_RET(ctx != NULL); RSA_VALIDATE_RET(input != NULL); @@ -916,8 +945,8 @@ int mbedtls_rsa_private(mbedtls_rsa_context *ctx, mbedtls_mpi_init(&TP); mbedtls_mpi_init(&TQ); #endif - mbedtls_mpi_init(&I); - mbedtls_mpi_init(&C); + mbedtls_mpi_init(&input_blinded); + mbedtls_mpi_init(&check_result_blinded); /* End of MPI initialization */ @@ -927,8 +956,6 @@ int mbedtls_rsa_private(mbedtls_rsa_context *ctx, goto cleanup; } - MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&I, &T)); - if (f_rng != NULL) { /* * Blinding @@ -980,6 +1007,9 @@ int mbedtls_rsa_private(mbedtls_rsa_context *ctx, #endif /* MBEDTLS_RSA_NO_CRT */ } + /* Make a copy of the input (after blinding if there was any) */ + MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&input_blinded, &T)); + #if defined(MBEDTLS_RSA_NO_CRT) MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&T, &T, D, &ctx->N, &ctx->RN)); #else @@ -1007,21 +1037,20 @@ int mbedtls_rsa_private(mbedtls_rsa_context *ctx, MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(&T, &TQ, &TP)); #endif /* MBEDTLS_RSA_NO_CRT */ + /* Verify the result to prevent glitching attacks. */ + MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&check_result_blinded, &T, &ctx->E, + &ctx->N, &ctx->RN)); + if (mbedtls_mpi_cmp_mpi(&check_result_blinded, &input_blinded) != 0) { + ret = MBEDTLS_ERR_RSA_VERIFY_FAILED; + goto cleanup; + } + if (f_rng != NULL) { /* * Unblind * T = T * Vf mod N */ - MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&T, &T, &ctx->Vf)); - MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&T, &T, &ctx->N)); - } - - /* Verify the result to prevent glitching attacks. */ - MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&C, &T, &ctx->E, - &ctx->N, &ctx->RN)); - if (mbedtls_mpi_cmp_mpi(&C, &I) != 0) { - ret = MBEDTLS_ERR_RSA_VERIFY_FAILED; - goto cleanup; + MBEDTLS_MPI_CHK(rsa_unblind(&T, &ctx->Vf, &ctx->N)); } olen = ctx->len; @@ -1053,8 +1082,8 @@ cleanup: mbedtls_mpi_free(&TP); mbedtls_mpi_free(&TQ); #endif - mbedtls_mpi_free(&C); - mbedtls_mpi_free(&I); + mbedtls_mpi_free(&check_result_blinded); + mbedtls_mpi_free(&input_blinded); if (ret != 0 && ret >= -0x007f) { return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_RSA_PRIVATE_FAILED, ret); @@ -1351,7 +1380,8 @@ int mbedtls_rsa_rsaes_oaep_decrypt(mbedtls_rsa_context *ctx, { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; size_t ilen, i, pad_len; - unsigned char *p, bad, pad_done; + unsigned char *p, pad_done; + int bad; unsigned char buf[MBEDTLS_MPI_MAX_SIZE]; unsigned char lhash[MBEDTLS_MD_MAX_SIZE]; unsigned int hlen; @@ -1439,9 +1469,8 @@ int mbedtls_rsa_rsaes_oaep_decrypt(mbedtls_rsa_context *ctx, p += hlen; /* Skip seed */ /* Check lHash */ - for (i = 0; i < hlen; i++) { - bad |= lhash[i] ^ *p++; - } + bad |= mbedtls_ct_memcmp(lhash, p, hlen); + p += hlen; /* Get zero-padding len, but always read till end of buffer * (minus one, for the 01 byte) */ diff --git a/c++/src/connect/mbedtls/rsa_internal.c b/c++/src/connect/mbedtls/rsa_internal.c index 2ff51c34..5a9e5c34 100644 --- a/c++/src/connect/mbedtls/rsa_internal.c +++ b/c++/src/connect/mbedtls/rsa_internal.c @@ -2,19 +2,7 @@ * Helper functions for the RSA module * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later * */ @@ -126,7 +114,7 @@ int mbedtls_rsa_deduce_primes(mbedtls_mpi const *N, } for (; attempt < num_primes; ++attempt) { - mbedtls_mpi_lset(&K, primes[attempt]); + MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&K, primes[attempt])); /* Check if gcd(K,N) = 1 */ MBEDTLS_MPI_CHK(mbedtls_mpi_gcd(P, &K, N)); diff --git a/c++/src/connect/mbedtls/sha1.c b/c++/src/connect/mbedtls/sha1.c index 6da64142..9dd958ef 100644 --- a/c++/src/connect/mbedtls/sha1.c +++ b/c++/src/connect/mbedtls/sha1.c @@ -2,19 +2,7 @@ * FIPS-180-1 compliant SHA-1 implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The SHA-1 standard was published by NIST in 1993. diff --git a/c++/src/connect/mbedtls/sha256.c b/c++/src/connect/mbedtls/sha256.c index f7090396..74f32369 100644 --- a/c++/src/connect/mbedtls/sha256.c +++ b/c++/src/connect/mbedtls/sha256.c @@ -2,19 +2,7 @@ * FIPS-180-2 compliant SHA-256 implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The SHA-256 Secure Hash Standard was published by NIST in 2002. diff --git a/c++/src/connect/mbedtls/sha512.c b/c++/src/connect/mbedtls/sha512.c index f6b7c1fb..77bdc2ec 100644 --- a/c++/src/connect/mbedtls/sha512.c +++ b/c++/src/connect/mbedtls/sha512.c @@ -2,19 +2,7 @@ * FIPS-180-2 compliant SHA-384/512 implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The SHA-512 Secure Hash Standard was published by NIST in 2002. diff --git a/c++/src/connect/mbedtls/ssl_cache.c b/c++/src/connect/mbedtls/ssl_cache.c index 0f0e6107..21e38cd8 100644 --- a/c++/src/connect/mbedtls/ssl_cache.c +++ b/c++/src/connect/mbedtls/ssl_cache.c @@ -2,19 +2,7 @@ * SSL session cache implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * These session callbacks use a simple chained list @@ -26,6 +14,7 @@ #if defined(MBEDTLS_SSL_CACHE_C) #include "mbedtls/platform.h" +#include "mbedtls/error.h" #include "mbedtls/ssl_cache.h" #include "mbedtls/ssl_internal.h" @@ -46,7 +35,7 @@ void mbedtls_ssl_cache_init(mbedtls_ssl_cache_context *cache) int mbedtls_ssl_cache_get(void *data, mbedtls_ssl_session *session) { - int ret = 1; + int ret = MBEDTLS_ERR_SSL_CACHE_ENTRY_NOT_FOUND; #if defined(MBEDTLS_HAVE_TIME) mbedtls_time_t t = mbedtls_time(NULL); #endif @@ -54,8 +43,8 @@ int mbedtls_ssl_cache_get(void *data, mbedtls_ssl_session *session) mbedtls_ssl_cache_entry *cur, *entry; #if defined(MBEDTLS_THREADING_C) - if (mbedtls_mutex_lock(&cache->mutex) != 0) { - return 1; + if ((ret = mbedtls_mutex_lock(&cache->mutex)) != 0) { + return ret; } #endif @@ -81,7 +70,6 @@ int mbedtls_ssl_cache_get(void *data, mbedtls_ssl_session *session) ret = mbedtls_ssl_session_copy(session, &entry->session); if (ret != 0) { - ret = 1; goto exit; } @@ -97,16 +85,15 @@ int mbedtls_ssl_cache_get(void *data, mbedtls_ssl_session *session) if ((session->peer_cert = mbedtls_calloc(1, sizeof(mbedtls_x509_crt))) == NULL) { - ret = 1; + ret = MBEDTLS_ERR_SSL_ALLOC_FAILED; goto exit; } mbedtls_x509_crt_init(session->peer_cert); - if (mbedtls_x509_crt_parse(session->peer_cert, entry->peer_cert.p, - entry->peer_cert.len) != 0) { + if ((ret = mbedtls_x509_crt_parse(session->peer_cert, entry->peer_cert.p, + entry->peer_cert.len)) != 0) { mbedtls_free(session->peer_cert); session->peer_cert = NULL; - ret = 1; goto exit; } } @@ -119,7 +106,7 @@ int mbedtls_ssl_cache_get(void *data, mbedtls_ssl_session *session) exit: #if defined(MBEDTLS_THREADING_C) if (mbedtls_mutex_unlock(&cache->mutex) != 0) { - ret = 1; + ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR; } #endif @@ -128,7 +115,7 @@ exit: int mbedtls_ssl_cache_set(void *data, const mbedtls_ssl_session *session) { - int ret = 1; + int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; #if defined(MBEDTLS_HAVE_TIME) mbedtls_time_t t = mbedtls_time(NULL), oldest = 0; mbedtls_ssl_cache_entry *old = NULL; @@ -179,7 +166,9 @@ int mbedtls_ssl_cache_set(void *data, const mbedtls_ssl_session *session) */ if (count >= cache->max_entries) { if (old == NULL) { - ret = 1; + /* This should only happen on an ill-configured cache + * with max_entries == 0. */ + ret = MBEDTLS_ERR_SSL_INTERNAL_ERROR; goto exit; } @@ -192,7 +181,7 @@ int mbedtls_ssl_cache_set(void *data, const mbedtls_ssl_session *session) */ if (count >= cache->max_entries) { if (cache->chain == NULL) { - ret = 1; + ret = MBEDTLS_ERR_SSL_INTERNAL_ERROR; goto exit; } @@ -208,7 +197,7 @@ int mbedtls_ssl_cache_set(void *data, const mbedtls_ssl_session *session) */ cur = mbedtls_calloc(1, sizeof(mbedtls_ssl_cache_entry)); if (cur == NULL) { - ret = 1; + ret = MBEDTLS_ERR_SSL_ALLOC_FAILED; goto exit; } @@ -242,7 +231,6 @@ int mbedtls_ssl_cache_set(void *data, const mbedtls_ssl_session *session) * field anymore in the first place, and we're done after this call. */ ret = mbedtls_ssl_session_copy(&cur->session, session); if (ret != 0) { - ret = 1; goto exit; } @@ -253,7 +241,7 @@ int mbedtls_ssl_cache_set(void *data, const mbedtls_ssl_session *session) cur->peer_cert.p = mbedtls_calloc(1, cur->session.peer_cert->raw.len); if (cur->peer_cert.p == NULL) { - ret = 1; + ret = MBEDTLS_ERR_SSL_ALLOC_FAILED; goto exit; } @@ -273,7 +261,7 @@ int mbedtls_ssl_cache_set(void *data, const mbedtls_ssl_session *session) exit: #if defined(MBEDTLS_THREADING_C) if (mbedtls_mutex_unlock(&cache->mutex) != 0) { - ret = 1; + ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR; } #endif diff --git a/c++/src/connect/mbedtls/ssl_ciphersuites.c b/c++/src/connect/mbedtls/ssl_ciphersuites.c index b37921a1..7a465378 100644 --- a/c++/src/connect/mbedtls/ssl_ciphersuites.c +++ b/c++/src/connect/mbedtls/ssl_ciphersuites.c @@ -1,22 +1,10 @@ /** * \file ssl_ciphersuites.c * - * \brief SSL ciphersuites for mbed TLS + * \brief SSL ciphersuites for Mbed TLS * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/ssl_cli.c b/c++/src/connect/mbedtls/ssl_cli.c index b693d530..4fde783d 100644 --- a/c++/src/connect/mbedtls/ssl_cli.c +++ b/c++/src/connect/mbedtls/ssl_cli.c @@ -2,19 +2,7 @@ * SSLv3/TLSv1 client-side functions * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/ssl_cookie.c b/c++/src/connect/mbedtls/ssl_cookie.c index 1ac9c417..067a4916 100644 --- a/c++/src/connect/mbedtls/ssl_cookie.c +++ b/c++/src/connect/mbedtls/ssl_cookie.c @@ -2,19 +2,7 @@ * DTLS cookie callbacks implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * These session callbacks use a simple chained list diff --git a/c++/src/connect/mbedtls/ssl_msg.c b/c++/src/connect/mbedtls/ssl_msg.c index 8a2ab7b9..5e856795 100644 --- a/c++/src/connect/mbedtls/ssl_msg.c +++ b/c++/src/connect/mbedtls/ssl_msg.c @@ -3,19 +3,7 @@ * (record layer + retransmission state machine) * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The SSL 3.0 specification was drafted by Netscape in 1996, @@ -1149,6 +1137,14 @@ int mbedtls_ssl_decrypt_buf(mbedtls_ssl_context const *ssl, #if defined(MBEDTLS_ARC4_C) || defined(MBEDTLS_CIPHER_NULL_CIPHER) if (mode == MBEDTLS_MODE_STREAM) { + if (rec->data_len < transform->maclen) { + MBEDTLS_SSL_DEBUG_MSG(1, + ("Record too short for MAC:" + " %" MBEDTLS_PRINTF_SIZET " < %" MBEDTLS_PRINTF_SIZET, + rec->data_len, transform->maclen)); + return MBEDTLS_ERR_SSL_INVALID_MAC; + } + padlen = 0; if ((ret = mbedtls_cipher_crypt(&transform->cipher_ctx_dec, transform->iv_dec, @@ -1561,7 +1557,7 @@ hmac_failed_etm_enabled: unsigned char mac_expect[MBEDTLS_SSL_MAC_ADD] = { 0 }; unsigned char mac_peer[MBEDTLS_SSL_MAC_ADD] = { 0 }; - /* If the initial value of padlen was such that + /* For CBC+MAC, If the initial value of padlen was such that * data_len < maclen + padlen + 1, then padlen * got reset to 1, and the initial check * data_len >= minlen + maclen + 1 @@ -1573,6 +1569,9 @@ hmac_failed_etm_enabled: * subtracted either padlen + 1 (if the padding was correct) * or 0 (if the padding was incorrect) since then, * hence data_len >= maclen in any case. + * + * For stream ciphers, we checked above that + * data_len >= maclen. */ rec->data_len -= transform->maclen; ssl_extract_add_data_from_record(add_data, &add_data_len, rec, diff --git a/c++/src/connect/mbedtls/ssl_srv.c b/c++/src/connect/mbedtls/ssl_srv.c index 994661a4..544e50e6 100644 --- a/c++/src/connect/mbedtls/ssl_srv.c +++ b/c++/src/connect/mbedtls/ssl_srv.c @@ -2,19 +2,7 @@ * SSLv3/TLSv1 server-side functions * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/ssl_ticket.c b/c++/src/connect/mbedtls/ssl_ticket.c index 0789245b..f9102904 100644 --- a/c++/src/connect/mbedtls/ssl_ticket.c +++ b/c++/src/connect/mbedtls/ssl_ticket.c @@ -2,19 +2,7 @@ * TLS server tickets callbacks implementation * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/ssl_tls.c b/c++/src/connect/mbedtls/ssl_tls.c index 494de1b9..c667a292 100644 --- a/c++/src/connect/mbedtls/ssl_tls.c +++ b/c++/src/connect/mbedtls/ssl_tls.c @@ -2,19 +2,7 @@ * SSLv3/TLSv1 shared functions * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The SSL 3.0 specification was drafted by Netscape in 1996, @@ -1004,8 +992,7 @@ static int ssl_populate_transform(mbedtls_ssl_transform *transform, !defined(MBEDTLS_SSL_EXPORT_KEYS) && \ !defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \ !defined(MBEDTLS_DEBUG_C) - ssl = NULL; /* make sure we don't use it except for those cases */ - (void) ssl; + (void) ssl; /* ssl is unused except for those cases */ #endif /* @@ -5217,6 +5204,12 @@ const mbedtls_ssl_session *mbedtls_ssl_get_session_pointer(const mbedtls_ssl_con #define SSL_SERIALIZED_SESSION_CONFIG_CRT 0 #endif /* MBEDTLS_X509_CRT_PARSE_C */ +#if defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE) +#define SSL_SERIALIZED_SESSION_CONFIG_KEEP_PEER_CRT 1 +#else +#define SSL_SERIALIZED_SESSION_CONFIG_KEEP_PEER_CRT 0 +#endif /* MBEDTLS_SSL_SESSION_TICKETS */ + #if defined(MBEDTLS_SSL_CLI_C) && defined(MBEDTLS_SSL_SESSION_TICKETS) #define SSL_SERIALIZED_SESSION_CONFIG_CLIENT_TICKET 1 #else @@ -5254,6 +5247,7 @@ const mbedtls_ssl_session *mbedtls_ssl_get_session_pointer(const mbedtls_ssl_con #define SSL_SERIALIZED_SESSION_CONFIG_TRUNC_HMAC_BIT 4 #define SSL_SERIALIZED_SESSION_CONFIG_ETM_BIT 5 #define SSL_SERIALIZED_SESSION_CONFIG_TICKET_BIT 6 +#define SSL_SERIALIZED_SESSION_CONFIG_KEEP_PEER_CRT_BIT 7 #define SSL_SERIALIZED_SESSION_CONFIG_BITFLAG \ ((uint16_t) ( \ @@ -5265,9 +5259,11 @@ const mbedtls_ssl_session *mbedtls_ssl_get_session_pointer(const mbedtls_ssl_con (SSL_SERIALIZED_SESSION_CONFIG_TRUNC_HMAC << \ SSL_SERIALIZED_SESSION_CONFIG_TRUNC_HMAC_BIT) | \ (SSL_SERIALIZED_SESSION_CONFIG_ETM << SSL_SERIALIZED_SESSION_CONFIG_ETM_BIT) | \ - (SSL_SERIALIZED_SESSION_CONFIG_TICKET << SSL_SERIALIZED_SESSION_CONFIG_TICKET_BIT))) + (SSL_SERIALIZED_SESSION_CONFIG_TICKET << SSL_SERIALIZED_SESSION_CONFIG_TICKET_BIT) | \ + (SSL_SERIALIZED_SESSION_CONFIG_KEEP_PEER_CRT << \ + SSL_SERIALIZED_SESSION_CONFIG_KEEP_PEER_CRT_BIT))) -static unsigned char ssl_serialized_session_header[] = { +static const unsigned char ssl_serialized_session_header[] = { MBEDTLS_VERSION_MAJOR, MBEDTLS_VERSION_MINOR, MBEDTLS_VERSION_PATCH, @@ -5291,19 +5287,36 @@ static unsigned char ssl_serialized_session_header[] = { * // the setting of those compile-time * // configuration options which influence * // the structure of mbedtls_ssl_session. - * uint64 start_time; - * uint8 ciphersuite[2]; // defined by the standard - * uint8 compression; // 0 or 1 - * uint8 session_id_len; // at most 32 - * opaque session_id[32]; - * opaque master[48]; // fixed length in the standard - * uint32 verify_result; - * opaque peer_cert<0..2^24-1>; // length 0 means no peer cert - * opaque ticket<0..2^24-1>; // length 0 means no ticket - * uint32 ticket_lifetime; - * uint8 mfl_code; // up to 255 according to standard - * uint8 trunc_hmac; // 0 or 1 - * uint8 encrypt_then_mac; // 0 or 1 + * #if defined(MBEDTLS_HAVE_TIME) + * uint64 start_time; + * #endif + * uint8 ciphersuite[2]; // defined by the standard + * uint8 compression; // 0 or 1 + * uint8 session_id_len; // at most 32 + * opaque session_id[32]; + * opaque master[48]; // fixed length in the standard + * uint32 verify_result; + * #if defined(MBEDTLS_X509_CRT_PARSE_C) + * #if defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE) + * opaque peer_cert<0..2^24-1>; // length 0 means no peer cert + * #else + * uint8 peer_cert_digest_type; + * opaque peer_cert_digest<0..2^8-1> + * #endif + * #endif + * #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C) + * opaque ticket<0..2^24-1>; // length 0 means no ticket + * uint32 ticket_lifetime; + * #endif + * #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) + * uint8 mfl_code; // up to 255 according to standard + * #endif + * #if defined(MBEDTLS_SSL_TRUNCATED_HMAC) + * uint8 trunc_hmac; // 0 or 1 + * #endif + * #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) + * uint8 encrypt_then_mac; // 0 or 1 + * #endif * * The order is the same as in the definition of the structure, except * verify_result is put before peer_cert so that all mandatory fields come @@ -6136,7 +6149,7 @@ void mbedtls_ssl_session_free(mbedtls_ssl_session *session) (SSL_SERIALIZED_CONTEXT_CONFIG_ALPN << SSL_SERIALIZED_CONTEXT_CONFIG_ALPN_BIT) | \ 0u)) -static unsigned char ssl_serialized_context_header[] = { +static const unsigned char ssl_serialized_context_header[] = { MBEDTLS_VERSION_MAJOR, MBEDTLS_VERSION_MINOR, MBEDTLS_VERSION_PATCH, @@ -6667,7 +6680,7 @@ static int ssl_context_load(mbedtls_ssl_context *ssl, /* alpn_chosen should point to an item in the configured list */ for (cur = ssl->conf->alpn_list; *cur != NULL; cur++) { if (strlen(*cur) == alpn_len && - memcmp(p, cur, alpn_len) == 0) { + memcmp(p, *cur, alpn_len) == 0) { ssl->alpn_chosen = *cur; break; } @@ -6834,7 +6847,7 @@ void mbedtls_ssl_config_init(mbedtls_ssl_config *conf) } #if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) -static int ssl_preset_default_hashes[] = { +static const int ssl_preset_default_hashes[] = { #if defined(MBEDTLS_SHA512_C) MBEDTLS_MD_SHA512, #endif @@ -6852,14 +6865,14 @@ static int ssl_preset_default_hashes[] = { }; #endif -static int ssl_preset_suiteb_ciphersuites[] = { +static const int ssl_preset_suiteb_ciphersuites[] = { MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, 0 }; #if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) -static int ssl_preset_suiteb_hashes[] = { +static const int ssl_preset_suiteb_hashes[] = { MBEDTLS_MD_SHA256, MBEDTLS_MD_SHA384, MBEDTLS_MD_NONE @@ -6867,7 +6880,7 @@ static int ssl_preset_suiteb_hashes[] = { #endif #if defined(MBEDTLS_ECP_C) -static mbedtls_ecp_group_id ssl_preset_suiteb_curves[] = { +static const mbedtls_ecp_group_id ssl_preset_suiteb_curves[] = { #if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) MBEDTLS_ECP_DP_SECP256R1, #endif diff --git a/c++/src/connect/mbedtls/ssl_tls13_keys.c b/c++/src/connect/mbedtls/ssl_tls13_keys.c index 67541488..ae7bf10b 100644 --- a/c++/src/connect/mbedtls/ssl_tls13_keys.c +++ b/c++/src/connect/mbedtls/ssl_tls13_keys.c @@ -2,19 +2,7 @@ * TLS 1.3 key schedule * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 ( the "License" ); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/mbedtls/ssl_tls13_keys.h b/c++/src/connect/mbedtls/ssl_tls13_keys.h index 4c3b252f..ca741326 100644 --- a/c++/src/connect/mbedtls/ssl_tls13_keys.h +++ b/c++/src/connect/mbedtls/ssl_tls13_keys.h @@ -2,19 +2,7 @@ * TLS 1.3 key schedule * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 ( the "License" ); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #if !defined(MBEDTLS_SSL_TLS1_3_KEYS_H) #define MBEDTLS_SSL_TLS1_3_KEYS_H diff --git a/c++/src/connect/mbedtls/threading.c b/c++/src/connect/mbedtls/threading.c index 0542f33f..b03f0cc8 100644 --- a/c++/src/connect/mbedtls/threading.c +++ b/c++/src/connect/mbedtls/threading.c @@ -2,19 +2,7 @@ * Threading abstraction layer * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* diff --git a/c++/src/connect/mbedtls/timing.c b/c++/src/connect/mbedtls/timing.c index 47e34f92..b1f72fe1 100644 --- a/c++/src/connect/mbedtls/timing.c +++ b/c++/src/connect/mbedtls/timing.c @@ -2,21 +2,11 @@ * Portable interface to the CPU cycle counter * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ +#include + #include "common.h" #include "mbedtls/platform.h" @@ -231,17 +221,20 @@ volatile int mbedtls_timing_alarmed = 0; unsigned long mbedtls_timing_get_timer(struct mbedtls_timing_hr_time *val, int reset) { - struct _hr_time *t = (struct _hr_time *) val; + struct _hr_time t; if (reset) { - QueryPerformanceCounter(&t->start); + QueryPerformanceCounter(&t.start); + memcpy(val, &t, sizeof(struct _hr_time)); return 0; } else { unsigned long delta; LARGE_INTEGER now, hfreq; + /* We can't safely cast val because it may not be aligned, so use memcpy */ + memcpy(&t, val, sizeof(struct _hr_time)); QueryPerformanceCounter(&now); QueryPerformanceFrequency(&hfreq); - delta = (unsigned long) ((now.QuadPart - t->start.QuadPart) * 1000ul + delta = (unsigned long) ((now.QuadPart - t.start.QuadPart) * 1000ul / hfreq.QuadPart); return delta; } @@ -277,17 +270,20 @@ void mbedtls_set_alarm(int seconds) unsigned long mbedtls_timing_get_timer(struct mbedtls_timing_hr_time *val, int reset) { - struct _hr_time *t = (struct _hr_time *) val; + struct _hr_time t; if (reset) { - gettimeofday(&t->start, NULL); + gettimeofday(&t.start, NULL); + memcpy(val, &t, sizeof(struct _hr_time)); return 0; } else { unsigned long delta; struct timeval now; + /* We can't safely cast val because it may not be aligned, so use memcpy */ + memcpy(&t, val, sizeof(struct _hr_time)); gettimeofday(&now, NULL); - delta = (now.tv_sec - t->start.tv_sec) * 1000ul - + (now.tv_usec - t->start.tv_usec) / 1000; + delta = (now.tv_sec - t.start.tv_sec) * 1000ul + + (now.tv_usec - t.start.tv_usec) / 1000; return delta; } } @@ -405,6 +401,7 @@ int mbedtls_timing_self_test(int verbose) uint32_t a = 0, b = 0; mbedtls_timing_delay_context ctx; + memset(&ctx, 0, sizeof(ctx)); if (verbose != 0) { mbedtls_printf(" TIMING tests note: will take some time!\n"); } diff --git a/c++/src/connect/mbedtls/version_features.c b/c++/src/connect/mbedtls/version_features.c index 049a58aa..6f663b12 100644 --- a/c++/src/connect/mbedtls/version_features.c +++ b/c++/src/connect/mbedtls/version_features.c @@ -2,19 +2,7 @@ * Version feature information * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" @@ -75,6 +63,12 @@ static const char * const features[] = { #if defined(MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT) "MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT", #endif /* MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT */ +#if defined(MBEDTLS_PLATFORM_GMTIME_R_ALT) + "MBEDTLS_PLATFORM_GMTIME_R_ALT", +#endif /* MBEDTLS_PLATFORM_GMTIME_R_ALT */ +#if defined(MBEDTLS_PLATFORM_ZEROIZE_ALT) + "MBEDTLS_PLATFORM_ZEROIZE_ALT", +#endif /* MBEDTLS_PLATFORM_ZEROIZE_ALT */ #if defined(MBEDTLS_DEPRECATED_WARNING) "MBEDTLS_DEPRECATED_WARNING", #endif /* MBEDTLS_DEPRECATED_WARNING */ @@ -312,6 +306,9 @@ static const char * const features[] = { #if defined(MBEDTLS_REMOVE_3DES_CIPHERSUITES) "MBEDTLS_REMOVE_3DES_CIPHERSUITES", #endif /* MBEDTLS_REMOVE_3DES_CIPHERSUITES */ +#if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED) + "MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED", +#endif /* MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED */ #if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) "MBEDTLS_ECP_DP_SECP192R1_ENABLED", #endif /* MBEDTLS_ECP_DP_SECP192R1_ENABLED */ @@ -459,6 +456,9 @@ static const char * const features[] = { #if defined(MBEDTLS_PSA_INJECT_ENTROPY) "MBEDTLS_PSA_INJECT_ENTROPY", #endif /* MBEDTLS_PSA_INJECT_ENTROPY */ +#if defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) + "MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS", +#endif /* MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS */ #if defined(MBEDTLS_RSA_NO_CRT) "MBEDTLS_RSA_NO_CRT", #endif /* MBEDTLS_RSA_NO_CRT */ @@ -576,6 +576,9 @@ static const char * const features[] = { #if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH) "MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH", #endif /* MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH */ +#if defined(MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE) + "MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE", +#endif /* MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE */ #if defined(MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN) "MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN", #endif /* MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN */ diff --git a/c++/src/connect/mbedtls/x509.c b/c++/src/connect/mbedtls/x509.c index 38eb2e66..4233e537 100644 --- a/c++/src/connect/mbedtls/x509.c +++ b/c++/src/connect/mbedtls/x509.c @@ -2,19 +2,7 @@ * X.509 common functions for parsing and verification * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The ITU-T X.509 standard defines a certificate format for PKI. @@ -53,13 +41,17 @@ #include #endif -#define CHECK(code) if ((ret = (code)) != 0) { return ret; } +#define CHECK(code) \ + do { \ + if ((ret = (code)) != 0) { \ + return ret; \ + } \ + } while (0) + #define CHECK_RANGE(min, max, val) \ - do \ - { \ - if ((val) < (min) || (val) > (max)) \ - { \ - return ret; \ + do { \ + if ((val) < (min) || (val) > (max)) { \ + return ret; \ } \ } while (0) diff --git a/c++/src/connect/mbedtls/x509_create.c b/c++/src/connect/mbedtls/x509_create.c index 50db9568..4ffd3b6a 100644 --- a/c++/src/connect/mbedtls/x509_create.c +++ b/c++/src/connect/mbedtls/x509_create.c @@ -2,19 +2,7 @@ * X.509 base functions for creating certificates / CSRs * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" @@ -125,7 +113,7 @@ static const x509_attr_descriptor_t *x509_attr_descr_from_name(const char *name, int mbedtls_x509_string_to_names(mbedtls_asn1_named_data **head, const char *name) { - int ret = 0; + int ret = MBEDTLS_ERR_X509_INVALID_NAME; const char *s = name, *c = s; const char *end = s + strlen(s); const char *oid = NULL; @@ -177,6 +165,9 @@ int mbedtls_x509_string_to_names(mbedtls_asn1_named_data **head, const char *nam s = c + 1; in_tag = 1; + + /* Successfully parsed one name, update ret to success */ + ret = 0; } if (!in_tag && s != c + 1) { @@ -204,6 +195,10 @@ int mbedtls_x509_set_extension(mbedtls_asn1_named_data **head, const char *oid, { mbedtls_asn1_named_data *cur; + if (val_len > (SIZE_MAX - 1)) { + return MBEDTLS_ERR_X509_BAD_INPUT_DATA; + } + if ((cur = mbedtls_asn1_store_named_data(head, oid, oid_len, NULL, val_len + 1)) == NULL) { return MBEDTLS_ERR_X509_ALLOC_FAILED; @@ -282,9 +277,11 @@ int mbedtls_x509_write_names(unsigned char **p, unsigned char *start, int mbedtls_x509_write_sig(unsigned char **p, unsigned char *start, const char *oid, size_t oid_len, - unsigned char *sig, size_t size) + unsigned char *sig, size_t size, + mbedtls_pk_type_t pk_alg) { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; + int write_null_par; size_t len = 0; if (*p < start || (size_t) (*p - start) < size) { @@ -307,8 +304,19 @@ int mbedtls_x509_write_sig(unsigned char **p, unsigned char *start, // Write OID // - MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_algorithm_identifier(p, start, oid, - oid_len, 0)); + if (pk_alg == MBEDTLS_PK_ECDSA) { + /* + * The AlgorithmIdentifier's parameters field must be absent for DSA/ECDSA signature + * algorithms, see https://www.rfc-editor.org/rfc/rfc5480#page-17 and + * https://www.rfc-editor.org/rfc/rfc5758#section-3. + */ + write_null_par = 0; + } else { + write_null_par = 1; + } + MBEDTLS_ASN1_CHK_ADD(len, + mbedtls_asn1_write_algorithm_identifier_ext(p, start, oid, oid_len, + 0, write_null_par)); return (int) len; } diff --git a/c++/src/connect/mbedtls/x509_crl.c b/c++/src/connect/mbedtls/x509_crl.c index d5357ea4..f98c22d7 100644 --- a/c++/src/connect/mbedtls/x509_crl.c +++ b/c++/src/connect/mbedtls/x509_crl.c @@ -2,19 +2,7 @@ * X.509 Certificate Revocation List (CRL) parsing * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The ITU-T X.509 standard defines a certificate format for PKI. diff --git a/c++/src/connect/mbedtls/x509_crt.c b/c++/src/connect/mbedtls/x509_crt.c index e7fcaf46..a3a4525b 100644 --- a/c++/src/connect/mbedtls/x509_crt.c +++ b/c++/src/connect/mbedtls/x509_crt.c @@ -2,19 +2,7 @@ * X.509 certificate parsing and verification * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The ITU-T X.509 standard defines a certificate format for PKI. @@ -1741,6 +1729,7 @@ static int x509_get_other_name(const mbedtls_x509_buf *subject_alt_name, if (MBEDTLS_OID_CMP(MBEDTLS_OID_ON_HW_MODULE_NAME, &cur_oid) != 0) { return MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE; } + other_name->type_id = cur_oid; p += len; if ((ret = mbedtls_asn1_get_tag(&p, end, &len, @@ -1829,7 +1818,7 @@ static int x509_info_subject_alt_name(char **buf, size_t *size, MBEDTLS_X509_SAFE_SNPRINTF; if (MBEDTLS_OID_CMP(MBEDTLS_OID_ON_HW_MODULE_NAME, - &other_name->value.hardware_module_name.oid) != 0) { + &other_name->type_id) == 0) { ret = mbedtls_snprintf(p, n, "\n%s hardware module name :", prefix); MBEDTLS_X509_SAFE_SNPRINTF; ret = @@ -1944,16 +1933,19 @@ int mbedtls_x509_parse_subject_alt_name(const mbedtls_x509_buf *san_buf, return 0; } -#define PRINT_ITEM(i) \ - { \ - ret = mbedtls_snprintf(p, n, "%s" i, sep); \ - MBEDTLS_X509_SAFE_SNPRINTF; \ - sep = ", "; \ - } +#define PRINT_ITEM(i) \ + do { \ + ret = mbedtls_snprintf(p, n, "%s" i, sep); \ + MBEDTLS_X509_SAFE_SNPRINTF; \ + sep = ", "; \ + } while (0) -#define CERT_TYPE(type, name) \ - if (ns_cert_type & (type)) \ - PRINT_ITEM(name); +#define CERT_TYPE(type, name) \ + do { \ + if (ns_cert_type & (type)) { \ + PRINT_ITEM(name); \ + } \ + } while (0) static int x509_info_cert_type(char **buf, size_t *size, unsigned char ns_cert_type) @@ -1978,9 +1970,12 @@ static int x509_info_cert_type(char **buf, size_t *size, return 0; } -#define KEY_USAGE(code, name) \ - if (key_usage & (code)) \ - PRINT_ITEM(name); +#define KEY_USAGE(code, name) \ + do { \ + if (key_usage & (code)) { \ + PRINT_ITEM(name); \ + } \ + } while (0) static int x509_info_key_usage(char **buf, size_t *size, unsigned int key_usage) diff --git a/c++/src/connect/mbedtls/x509_csr.c b/c++/src/connect/mbedtls/x509_csr.c index 89344d18..095364e5 100644 --- a/c++/src/connect/mbedtls/x509_csr.c +++ b/c++/src/connect/mbedtls/x509_csr.c @@ -2,19 +2,7 @@ * X.509 Certificate Signing Request (CSR) parsing * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * The ITU-T X.509 standard defines a certificate format for PKI. diff --git a/c++/src/connect/mbedtls/x509write_crt.c b/c++/src/connect/mbedtls/x509write_crt.c index a8f4c286..1e16b53b 100644 --- a/c++/src/connect/mbedtls/x509write_crt.c +++ b/c++/src/connect/mbedtls/x509write_crt.c @@ -2,19 +2,7 @@ * X.509 certificate writing * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * References: @@ -342,6 +330,7 @@ int mbedtls_x509write_crt_der(mbedtls_x509write_cert *ctx, size_t sub_len = 0, pub_len = 0, sig_and_oid_len = 0, sig_len; size_t len = 0; mbedtls_pk_type_t pk_alg; + int write_sig_null_par; /* * Prepare data to be signed at the end of the target buffer @@ -433,9 +422,20 @@ int mbedtls_x509write_crt_der(mbedtls_x509write_cert *ctx, /* * Signature ::= AlgorithmIdentifier */ + if (pk_alg == MBEDTLS_PK_ECDSA) { + /* + * The AlgorithmIdentifier's parameters field must be absent for DSA/ECDSA signature + * algorithms, see https://www.rfc-editor.org/rfc/rfc5480#page-17 and + * https://www.rfc-editor.org/rfc/rfc5758#section-3. + */ + write_sig_null_par = 0; + } else { + write_sig_null_par = 1; + } MBEDTLS_ASN1_CHK_ADD(len, - mbedtls_asn1_write_algorithm_identifier(&c, buf, - sig_oid, strlen(sig_oid), 0)); + mbedtls_asn1_write_algorithm_identifier_ext(&c, buf, + sig_oid, strlen(sig_oid), + 0, write_sig_null_par)); /* * Serial ::= INTEGER @@ -492,8 +492,8 @@ int mbedtls_x509write_crt_der(mbedtls_x509write_cert *ctx, * into the CRT buffer. */ c2 = buf + size; MBEDTLS_ASN1_CHK_ADD(sig_and_oid_len, mbedtls_x509_write_sig(&c2, c, - sig_oid, sig_oid_len, sig, - sig_len)); + sig_oid, sig_oid_len, + sig, sig_len, pk_alg)); /* * Memory layout after this step: diff --git a/c++/src/connect/mbedtls/x509write_csr.c b/c++/src/connect/mbedtls/x509write_csr.c index a421fde9..3c3ab3a0 100644 --- a/c++/src/connect/mbedtls/x509write_csr.c +++ b/c++/src/connect/mbedtls/x509write_csr.c @@ -2,19 +2,7 @@ * X.509 Certificate Signing Request writing * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ /* * References: @@ -265,7 +253,7 @@ static int x509write_csr_der_internal(mbedtls_x509write_csr *ctx, c2 = buf + size; MBEDTLS_ASN1_CHK_ADD(sig_and_oid_len, mbedtls_x509_write_sig(&c2, buf + len, sig_oid, sig_oid_len, - sig, sig_len)); + sig, sig_len, pk_alg)); /* * Compact the space between the CSR data and signature by moving the diff --git a/c++/src/connect/mbedtls/xtea.c b/c++/src/connect/mbedtls/xtea.c index 27651cc0..f4aca56c 100644 --- a/c++/src/connect/mbedtls/xtea.c +++ b/c++/src/connect/mbedtls/xtea.c @@ -2,19 +2,7 @@ * A 32-bit implementation of the XTEA algorithm * * Copyright The Mbed TLS Contributors - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #include "common.h" diff --git a/c++/src/connect/ncbi_http2_session.cpp b/c++/src/connect/ncbi_http2_session.cpp index de5e774c..4902fa77 100644 --- a/c++/src/connect/ncbi_http2_session.cpp +++ b/c++/src/connect/ncbi_http2_session.cpp @@ -1,4 +1,4 @@ -/* $Id: ncbi_http2_session.cpp 658918 2022-11-10 20:03:42Z sadyrovr $ +/* $Id: ncbi_http2_session.cpp 674396 2023-10-25 18:31:34Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -512,6 +512,8 @@ SH2S_IoCoordinator::~SH2S_IoCoordinator() void SH2S_IoCoordinator::Process(TH2S_RequestQueue& request_queue) { + m_Loop.Run(UV_RUN_NOWAIT); + // Retrieve all events from the queue for (;;) { auto queue_locked = request_queue.GetLock(); @@ -611,7 +613,8 @@ SH2S_Session* SH2S_IoCoordinator::NewSession(const SH2S_Request::SStart& request } } - SH2S_Session::TAddrNCred addr_n_cred(SSocketAddress(url.GetHost(), port), request.cred); + SSocketAddress::SHost host(url.GetHost(), SSocketAddress::SHost::EName::eOriginal); + SH2S_Session::TAddrNCred addr_n_cred(SSocketAddress(move(host), port), request.cred); auto https = scheme == "https" || (scheme.empty() && (port == "443")); auto range = m_Sessions.equal_range(addr_n_cred); diff --git a/c++/src/connect/ncbi_sendmail.c b/c++/src/connect/ncbi_sendmail.c index 1fd5aa64..387df229 100644 --- a/c++/src/connect/ncbi_sendmail.c +++ b/c++/src/connect/ncbi_sendmail.c @@ -1,4 +1,4 @@ -/* $Id: ncbi_sendmail.c 630439 2021-05-03 16:17:14Z lavr $ +/* $Id: ncbi_sendmail.c 681783 2024-04-15 14:14:32Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -495,7 +495,7 @@ extern const char* CORE_SendMailEx(const char* to, if ((status = SOCK_CreateEx(info->mx_host, info->mx_port, &info->mx_timeout, &sock, 0, 0, log)) != eIO_Success) { - sprintf(buffer, "%s:%hu (%s)", info->mx_host, info->mx_port, + sprintf(buffer, "%.512s:%hu (%s)", info->mx_host, info->mx_port, IO_StatusStr(status)); SENDMAIL_RETURN2(8, "Cannot connect to sendmail", buffer); } diff --git a/c++/src/connect/ncbi_socket.c b/c++/src/connect/ncbi_socket.c index 6fd03d8a..361de7f7 100644 --- a/c++/src/connect/ncbi_socket.c +++ b/c++/src/connect/ncbi_socket.c @@ -1,4 +1,4 @@ -/* $Id: ncbi_socket.c 662580 2023-02-02 16:22:28Z lavr $ +/* $Id: ncbi_socket.c 681785 2024-04-15 14:15:09Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -2040,6 +2040,7 @@ static EIO_Status s_Select_(size_t n, if ((fd = sock->sock) == SOCK_INVALID) { polls[i].revent = eIO_Close; ++ready; + continue; } # if !defined(NCBI_OS_MSWIN) && defined(FD_SETSIZE) assert(fd < FD_SETSIZE); @@ -6239,7 +6240,7 @@ extern EIO_Status TRIGGER_Create(TRIGGER* trigger, ESwitch log) if (err) { CORE_LOGF_ERRNO_X(143, eLOG_Warning, err, ("TRIGGER#%u[?]: [TRIGGER::Create] " - " Failed to dup(%d) to higher fd(%d+))", + " Failed to dup(%d) to higher fd(%d+)", x_id, fd[1], FD_SETSIZE)); err = 0; } @@ -6277,12 +6278,13 @@ extern EIO_Status TRIGGER_Create(TRIGGER* trigger, ESwitch log) if (!s_SetCloexec(fd[1], 1/*true*/)) err = errno; # endif /*!FD_SETSIZE*/ +# endif /*!HAVE_PIPE2*/ + if (err && err != -1) { CORE_LOGF_ERRNO_X(30, eLOG_Warning, err, ("TRIGGER#%u[?]: [TRIGGER::Create] " " Failed to set close-on-exec", x_id)); } -# endif /*!HAVE_PIPE2*/ if (!(*trigger = (TRIGGER) calloc(1, sizeof(**trigger)))) { close(fd[0]); diff --git a/c++/src/connect/ncbi_uv_nghttp2.cpp b/c++/src/connect/ncbi_uv_nghttp2.cpp index a06ad926..74a46d6e 100644 --- a/c++/src/connect/ncbi_uv_nghttp2.cpp +++ b/c++/src/connect/ncbi_uv_nghttp2.cpp @@ -1,4 +1,4 @@ -/* $Id: ncbi_uv_nghttp2.cpp 663964 2023-03-03 20:32:27Z ucko $ +/* $Id: ncbi_uv_nghttp2.cpp 674396 2023-10-25 18:31:34Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -787,7 +787,6 @@ int SUvNgHttp2_TlsImpl::Init() break; } - m_WriteBuffer.clear(); auto rv = mbedtls_ssl_session_reset(&m_Ssl); if (rv < 0) { @@ -877,6 +876,7 @@ int SUvNgHttp2_TlsImpl::Close() case eReady: break; } + m_WriteBuffer.clear(); m_State = eClosed; return mbedtls_ssl_close_notify(&m_Ssl); } diff --git a/c++/src/corelib/ncbi_cookies.cpp b/c++/src/corelib/ncbi_cookies.cpp index 627b3d90..c4439528 100644 --- a/c++/src/corelib/ncbi_cookies.cpp +++ b/c++/src/corelib/ncbi_cookies.cpp @@ -1,4 +1,4 @@ -/* $Id: ncbi_cookies.cpp 620642 2020-11-25 17:54:32Z lavr $ +/* $Id: ncbi_cookies.cpp 675127 2023-11-15 13:50:38Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -494,14 +494,14 @@ bool CHttpCookie::Parse(const CTempString& str) return false; } m_Value = NStr::TruncateSpaces(nv.substr(pos + 1)); - if ( !IsValidValue(m_Value, eField_Value, &err_msg) ) { - ERR_POST_X(3, Info << err_msg); - return false; - } // Remove dquotes if any. if (m_Value.size() > 2 && m_Value[0] == '"' && m_Value[m_Value.size() - 1] == '"') { m_Value = m_Value.substr(1, m_Value.size() - 2); } + if ( !IsValidValue(m_Value, eField_Value, &err_msg) ) { + ERR_POST_X(3, Info << err_msg); + return false; + } if ( attr_str.empty() ) { return true; diff --git a/c++/src/corelib/ncbi_system.cpp b/c++/src/corelib/ncbi_system.cpp index a35ad067..a060ba74 100644 --- a/c++/src/corelib/ncbi_system.cpp +++ b/c++/src/corelib/ncbi_system.cpp @@ -1,4 +1,4 @@ -/* $Id: ncbi_system.cpp 671042 2023-08-07 17:29:25Z ivanov $ +/* $Id: ncbi_system.cpp 681784 2024-04-15 14:14:58Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -270,7 +270,12 @@ static bool s_SetExitHandler(TLimitsPrintHandler handler, static void s_NewHandler(void) { s_ExitCode = eLEC_Memory; - exit(-1); + // _exit() does not go over atexit() chain, so just call registered + // handler directly. + if (s_ExitHandlerIsSet) { + s_ExitHandler(); + } + _exit(-1); } diff --git a/c++/src/corelib/request_status.cpp b/c++/src/corelib/request_status.cpp index daf7e2f9..dc381e81 100644 --- a/c++/src/corelib/request_status.cpp +++ b/c++/src/corelib/request_status.cpp @@ -1,4 +1,4 @@ -/* $Id: request_status.cpp 597623 2019-11-25 15:06:05Z grichenk $ +/* $Id: request_status.cpp 674533 2023-10-30 13:23:10Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -81,6 +81,7 @@ string CRequestStatus::GetStdStatusMessage(ECode code) case e416_RangeNotSatisfiable: return "Requested Range Not Satisfiable"; case e417_ExpectationFailed: return "Expectation Failed"; case e422_UnprocessableEntity: return "Unprocessable Entity"; + case e451_Unavailable_For_Legal_Reasons: return "Unavailable For Legal Reasons"; case e499_BrokenConnection: return "Broken Connection"; case e500_InternalServerError: return "Internal Server Error"; case e501_NotImplemented: return "Not Implemented"; diff --git a/c++/src/dbapi/driver/dbapi_conn_factory.cpp b/c++/src/dbapi/driver/dbapi_conn_factory.cpp index ba34f63a..a5fdc84d 100644 --- a/c++/src/dbapi/driver/dbapi_conn_factory.cpp +++ b/c++/src/dbapi/driver/dbapi_conn_factory.cpp @@ -1,4 +1,4 @@ -/* $Id: dbapi_conn_factory.cpp 673289 2023-09-27 13:33:09Z ivanov $ +/* $Id: dbapi_conn_factory.cpp 682489 2024-05-01 12:40:05Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -381,11 +381,18 @@ CDBConnectionFactory::DispatchServerName( Uint2 cur_port = 0; // Try to connect up to a given number of alternative servers ... - unsigned int alternatives = GetMaxNumOfServerAlternatives(); + unsigned int max_alternatives = GetMaxNumOfServerAlternatives(); list tried_servers; bool full_retry_made = false; CRef balancer; CServiceInfo& service_info = ctx.service_info; + unsigned int alternatives + = static_cast(service_info.GetOptions().size()); + if (alternatives < 1) { + alternatives = min(2U, max_alternatives); + } else { + alternatives = min(alternatives * 2U, max_alternatives); + } if ( !do_not_dispatch && !service_name.empty() ) { balancer.Reset(new CDBPoolBalancer @@ -722,7 +729,10 @@ CDBConnectionFactory::WorkWithSingleServer(const string& validator_name, const string& server) { CRuntimeData& rt_data = GetRuntimeData(validator_name); - TSvrRef svr(new CDBServer(server, 0, 0, numeric_limits::max())); + TSvrRef svr; + if ( !server.empty() ) { + svr.Reset(new CDBServer(server, 0, 0, kMax_UInt)); + } auto& service_info = rt_data.GetServiceInfo(service_name); IDBServiceInfo::TGuard guard(service_info); service_info.SetDispatchedServer(svr); diff --git a/c++/src/objects/gbproj/ProjectItem.cpp b/c++/src/objects/gbproj/ProjectItem.cpp index a63db05d..a8fa7c90 100755 --- a/c++/src/objects/gbproj/ProjectItem.cpp +++ b/c++/src/objects/gbproj/ProjectItem.cpp @@ -1,4 +1,4 @@ -/* $Id: ProjectItem.cpp 431215 2014-04-02 14:55:10Z katargir $ +/* $Id: ProjectItem.cpp 682696 2024-05-07 12:38:17Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -134,18 +134,21 @@ void CProjectItem::SetModifiedDate(const CDate& date) void CProjectItem::SetObject(CSerialObject& object) { - if (object.GetThisTypeInfo() == CSeq_id::GetTypeInfo()) { + const auto type_info = object.GetThisTypeInfo(); + if (type_info == CSeq_id::GetTypeInfo()) { SetItem().SetId(dynamic_cast(object)); - } else if (object.GetThisTypeInfo() == CSeq_entry::GetTypeInfo()) { + } else if (type_info == CSeq_entry::GetTypeInfo()) { SetItem().SetEntry(dynamic_cast(object)); - } else if (object.GetThisTypeInfo() == CSeq_annot::GetTypeInfo()) { + } else if (type_info == CSeq_annot::GetTypeInfo()) { SetItem().SetAnnot(dynamic_cast(object)); - } else if (object.GetThisTypeInfo() == CSeq_submit::GetTypeInfo()) { + } else if (type_info == CSeq_submit::GetTypeInfo()) { SetItem().SetSubmit(dynamic_cast(object)); - } else if (object.GetThisTypeInfo() == CSeq_align::GetTypeInfo()) { + } else if (type_info == CSeq_align::GetTypeInfo()) { SetItem().SetSeq_align(dynamic_cast(object)); - } else if (object.GetThisTypeInfo() == CSeq_align_set::GetTypeInfo()) { + } else if (type_info == CSeq_align_set::GetTypeInfo()) { SetItem().SetSeq_align_set(dynamic_cast(object)); + } else if (type_info == CHugeFileProjectItem::GetTypeInfo()) { + SetItem().SetHuge_file(dynamic_cast(object)); } else { SetItem().SetOther().Set(object); } @@ -174,6 +177,9 @@ const CSerialObject* CProjectItem::GetObject() const case TItem::e_Seq_align_set: return &GetItem().GetSeq_align_set(); + case TItem::e_Huge_file: + return &GetItem().GetHuge_file(); + //TODO ePlugin, ePmid and eTaxid are not supported case TItem::e_Other: return GetItem().GetOther().GetObject(); diff --git a/c++/src/objects/gbproj/gbproj.asn b/c++/src/objects/gbproj/gbproj.asn index 890629e1..4e13c9c6 100755 --- a/c++/src/objects/gbproj/gbproj.asn +++ b/c++/src/objects/gbproj/gbproj.asn @@ -53,7 +53,7 @@ GBProject-ver2 ::= SEQUENCE { -- This is deprecated. DO NOT USE THIS FIELD. -- The original spec is: orig-message PluginMessage OPTIONAL. -- It is intended to be removed, but a complete - -- removal will cause order shift for the rest of + -- removal will cause order shift for the rest of -- fields in this choice, and cause deserialization -- failure for existing ASN file since this filed is -- in the middle of the spec. @@ -70,13 +70,13 @@ GBProject-ver2 ::= SEQUENCE { -- arbitrary annotations annot SET OF ProjectAnnot OPTIONAL, - + -- a set of data sources including data loader and data loaders SET OF LoaderDescriptor OPTIONAL, --- set of views, associated with project views SET OF ViewDescriptor OPTIONAL, - + -- set of view-specific settings view-settings SET OF User-object OPTIONAL } @@ -86,16 +86,16 @@ ViewDataLink ::= SEQUENCE { --- if both are absent - link goes to project --- if both present - fingerprinted object inside project item --- if only project-item-id present - link goes to project item - + --- project item id project-item-id INTEGER OPTIONAL, - + --- fingerprint of object to show in view fingerprint CHOICE { crc32 INTEGER, md5 OCTET STRING } OPTIONAL, - + type VisibleString } @@ -103,18 +103,18 @@ ViewDescriptor ::= SEQUENCE { --- data for view opening data CHOICE { --- link to retrieve data - link ViewDataLink, - + link ViewDataLink, + --- virtual project item, if link cannot be created item ProjectItem - }, - + }, + --- plugin name of saved view view-plugin VisibleString, - + --- view id view-id INTEGER, - + --- optional settings, requered to open view view-memento ViewMemento OPTIONAL } @@ -164,7 +164,7 @@ ProjectItem ::= SEQUENCE { -- This is deprecated. DO NOT USE THIS FIELD. -- The original spec is: plugin PluginMessage. -- It is intended to be removed, but a complete - -- removal will cause order shift for the rest of + -- removal will cause order shift for the rest of -- fields in this choice, and cause deserialization -- failure for existing ASN files since this filed is -- in the middle of the spec. @@ -172,12 +172,15 @@ ProjectItem ::= SEQUENCE { -- arbitrary object (use with care!) other AbstractProjectItem, - + -- PubMed ID pmid SET OF INTEGER, -- Taxonomy ID - taxid SET OF INTEGER + taxid SET OF INTEGER, + + -- Huge File Item + huge-file HugeFileProjectItem }, --name of the plugin that can handle External Data for the project @@ -192,6 +195,17 @@ AbstractProjectItem ::= SEQUENCE { data OCTET STRING } +HugeFileProjectItem ::= SEQUENCE { + -- absolute path to the input file + file VisibleString, + + -- absolute path to the temporary output file + tmp-file VisibleString, + + -- loader id to register in OM + loader-id VisibleString +} + ProjectHistoryItem ::= SEQUENCE { -- ID of ProjectItem referenced @@ -246,7 +260,7 @@ ProjectAnnot ::= SEQUENCE { LoaderDescriptor ::= SEQUENCE { - -- data loader label + -- data loader label label VisibleString, -- loader data source type @@ -254,7 +268,7 @@ LoaderDescriptor ::= SEQUENCE { -- data, depends on loader type data User-object, - + -- flag: is this data loader enabled? enabled BOOLEAN DEFAULT TRUE, @@ -264,4 +278,3 @@ LoaderDescriptor ::= SEQUENCE { END - diff --git a/c++/src/objects/general/Dbtag.cpp b/c++/src/objects/general/Dbtag.cpp index 67a6c07f..44babd0c 100644 --- a/c++/src/objects/general/Dbtag.cpp +++ b/c++/src/objects/general/Dbtag.cpp @@ -1,4 +1,4 @@ -/* $Id: Dbtag.cpp 670946 2023-08-04 12:25:02Z ivanov $ +/* $Id: Dbtag.cpp 683247 2024-05-21 12:43:30Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -454,7 +454,7 @@ MAKE_CONST_MAP(sc_UrlMap, CDbtag::EDbtagType, string, { CDbtag::eDbtagType_UniSTS, "https://www.ncbi.nlm.nih.gov/probe?term=" }, { CDbtag::eDbtagType_VBASE2, "http://www.vbase2.org/vgene.php?id=" }, // https not available tested 7/13/2016 { CDbtag::eDbtagType_VBRC, "http://vbrc.org/query.asp?web_view=curation&web_id=" }, // https not available tested 7/13/2016 - { CDbtag::eDbtagType_VectorBase, "https://www.vectorbase.org/Genome/BRCGene/?feature=" }, + { CDbtag::eDbtagType_VectorBase, "https://vectorbase.org/gene/" }, { CDbtag::eDbtagType_Vega, "http://vega.archive.ensembl.org/id/" }, { CDbtag::eDbtagType_WorfDB, "http://worfdb.dfci.harvard.edu/search.pl?form=1&search=" }, { CDbtag::eDbtagType_WormBase, "https://www.wormbase.org/search/gene/" }, @@ -505,6 +505,18 @@ MAKE_CONST_MAP(sc_UrlMap, CDbtag::EDbtagType, string, { CDbtag::eDbtagType_Ensembl, "https://www.ensembl.org/id/" }, // url seems incorrect, includes msg user has been redirected and "Error 404 Page not found" tested 7/13/2016 { CDbtag::eDbtagType_PseudoCAP, "http://www.pseudomonas.com/primarySequenceFeature/list?c1=name&e1=1&v1=" }, // url not found tested 7/13/2016 { CDbtag::eDbtagType_PseudoCap, "http://www.pseudomonas.com/primarySequenceFeature/list?c1=name&e1=1&v1=" }, // url not found tested 7/13/2016 + + { CDbtag::eDbtagType_AmoebaDB, "https://amoebadb.org/amoeba/app/record/gene/" }, + { CDbtag::eDbtagType_CryptoDB, "https://cryptodb.org/cryptodb/app/record/gene/" }, + { CDbtag::eDbtagType_FungiDB, "https://fungidb.org/fungidb/app/record/gene/" }, + { CDbtag::eDbtagType_GiardiaDB, "https://giardiadb.org/giardiadb/app/record/gene/" }, + { CDbtag::eDbtagType_MicrosporidiaDB, "https://microsporidiadb.org/micro/app/record/gene/" }, + { CDbtag::eDbtagType_PiroplasmaDB, "https://piroplasmadb.org/piro/app/record/gene/" }, + { CDbtag::eDbtagType_PlasmoDB, "https://plasmodb.org/plasmo/app/record/gene/" }, + { CDbtag::eDbtagType_ToxoDB, "https://toxodb.org/toxo/app/record/gene/" }, + { CDbtag::eDbtagType_TrichDB, "https://trichdb.org/trichdb/app/record/gene/" }, + { CDbtag::eDbtagType_TriTrypDB, "https://tritrypdb.org/tritrypdb/app/record/gene/" }, + { CDbtag::eDbtagType_VEuPathDB, "https://veupathdb.org/gene/" }, }) string CDbtag::GetUrl(void) const diff --git a/c++/src/objects/general/Dbtag.inc b/c++/src/objects/general/Dbtag.inc index 6972a457..1e028cf8 100644 --- a/c++/src/objects/general/Dbtag.inc +++ b/c++/src/objects/general/Dbtag.inc @@ -162,6 +162,18 @@ { "SRA", { CDbtag::fProbe, CDbtag::eDbtagType_SRA } }, { "Trace", { CDbtag::fProbe, CDbtag::eDbtagType_Trace } }, + { "AmoebaDB", { CDbtag::fGenBank, CDbtag::eDbtagType_AmoebaDB } }, + { "CryptoDB", { CDbtag::fGenBank, CDbtag::eDbtagType_CryptoDB } }, + { "FungiDB", { CDbtag::fGenBank, CDbtag::eDbtagType_FungiDB } }, + { "GiardiaDB", { CDbtag::fGenBank, CDbtag::eDbtagType_GiardiaDB } }, + { "MicrosporidiaDB", { CDbtag::fGenBank, CDbtag::eDbtagType_MicrosporidiaDB } }, + { "PiroplasmaDB", { CDbtag::fGenBank, CDbtag::eDbtagType_PiroplasmaDB } }, + { "PlasmoDB", { CDbtag::fGenBank, CDbtag::eDbtagType_PlasmoDB } }, + { "ToxoDB", { CDbtag::fGenBank, CDbtag::eDbtagType_ToxoDB } }, + { "TrichDB", { CDbtag::fGenBank, CDbtag::eDbtagType_TrichDB } }, + { "TriTrypDB", { CDbtag::fGenBank, CDbtag::eDbtagType_TriTrypDB } }, + { "VEuPathDB", { CDbtag::fGenBank, CDbtag::eDbtagType_VEuPathDB } }, + // Note from RW-1843: INSDC documentation contains outdated information // It requires ENSEMBL and PseudoCap, but actially Ensembl and PseudoCAP are correct // https://www.insdc.org/submitting-standards/dbxref-qualifier-vocabulary/ diff --git a/c++/src/objects/macro/CMakeLists.macro.asn.txt b/c++/src/objects/macro/CMakeLists.macro.asn.txt index 3781f946..46d2065c 100644 --- a/c++/src/objects/macro/CMakeLists.macro.asn.txt +++ b/c++/src/objects/macro/CMakeLists.macro.asn.txt @@ -1,21 +1,25 @@ -# $Id: CMakeLists.macro.asn.txt 662048 2023-01-24 18:45:51Z gotvyans $ +# $Id: CMakeLists.macro.asn.txt 680773 2024-03-27 13:51:41Z ivanov $ NCBI_begin_lib(macro) NCBI_dataspecs(macro.asn) NCBI_uses_toolkit_libraries(seq) NCBI_project_watchers(stakhovv kans) - if (NOT CMAKE_CROSSCOMPILING AND NCBI_FSM_COMPILER_ENABLED AND NCBI_PYTHON_EXECUTABLE) + if (NCBI_FSM_COMPILER_ENABLED) NCBI_custom_target_dependencies(macro_fsm_files) endif() NCBI_end_lib() -if (NOT CMAKE_CROSSCOMPILING AND NCBI_FSM_COMPILER_ENABLED AND NCBI_PYTHON_EXECUTABLE) +if (NCBI_FSM_COMPILER_ENABLED) NCBI_begin_custom_target(macro_fsm_files) NCBI_custom_target_definition(define_macro_fsm_files_target) - NCBI_custom_target_dependencies(multipattern) + if (TARGET host.multipattern) + NCBI_custom_target_dependencies(host.multipattern) + else() + NCBI_custom_target_dependencies(multipattern) + endif() NCBI_end_custom_target() endif() @@ -33,16 +37,21 @@ function(define_multipatern_inc_target up_target current_list_file compiler modu cmake_path(GET current_list_file PARENT_PATH _source_dir) - set (_compiler ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${compiler}${CMAKE_EXECUTABLE_SUFFIX}) + if (TARGET host.${compiler}) + set (_compiler "$") + else() + set (_compiler ${compiler}) + endif() set(_target_dir ${_source_dir}) - set(_make_fsm_file ${NCBI_SRC_ROOT}/objects/macro/make_fsm_file.py) - #set(_make_fsm_file ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/make_fsm_file.py) + file(RELATIVE_PATH _rel_path ${NCBI_SRC_ROOT} ${_source_dir}) + # intermediate location at inc folder + set(_target_dir_int ${NCBI_CFGINC_ROOT}/${_rel_path}) add_custom_target(${up_target} COMMENT "Generate FSM files" - SOURCES ${_make_fsm_file} + SOURCES ${current_list_file} ${CMAKE_CURRENT_FUNCTION_LIST_FILE} ) foreach(_module ${modules}) @@ -56,11 +65,11 @@ function(define_multipatern_inc_target up_target current_list_file compiler modu add_custom_command( OUTPUT ${_target_dir}/${_inc_file} - COMMAND ${NCBI_PYTHON_EXECUTABLE} ${_make_fsm_file} ${_inc_file} ${_compiler} -i ${_prt_file} ${more_args} + COMMAND ${CMAKE_COMMAND} -E make_directory ${_target_dir_int} + COMMAND ${_compiler} -o ${_target_dir_int}/${_inc_file} -i ${_prt_file} ${more_args} WORKING_DIRECTORY ${_source_dir} - COMMENT "Running make_fsm_file.py for ${_prt_file}" - DEPENDS ${current_list_file} ${_source_dir}/${_prt_file} ${_make_fsm_file} ${_compiler} - # ${CMAKE_CURRENT_FUNCTION_LIST_FILE} + COMMENT "Running ${compiler} for ${_prt_file}" + DEPENDS ${current_list_file} ${_source_dir}/${_prt_file} ${_compiler} ${CMAKE_CURRENT_FUNCTION_LIST_FILE} ) add_custom_target( @@ -70,10 +79,4 @@ function(define_multipatern_inc_target up_target current_list_file compiler modu add_dependencies(${up_target} ${_target}) endforeach() - unset(_inc_file) - unset(_prt_file) - unset(_target) - unset(_target_dir) - unset(_source_dir) - unset(_compiler) endfunction() diff --git a/c++/src/objects/macro/make_fsm_file.py b/c++/src/objects/macro/make_fsm_file.py deleted file mode 100644 index 70320668..00000000 --- a/c++/src/objects/macro/make_fsm_file.py +++ /dev/null @@ -1,29 +0,0 @@ -import os -import sys -import re -import subprocess -from subprocess import Popen, PIPE - -def MakeIncFile(outfile, cmd_args): - - returncode=1 - _produced=None - _original=None - if os.path.exists(outfile): - with open(outfile, "rb") as _outfile: - _original=_outfile.read() - - proc = subprocess.run(cmd_args, stdout=PIPE) - returncode = proc.returncode - - if returncode == 0: - _produced = proc.stdout - if _original != _produced: - with open(outfile, "wb") as _outfile: - _outfile.write(_produced) - - return returncode - -if __name__ == "__main__": - returncode = MakeIncFile(sys.argv[1], sys.argv[2:]) - sys.exit(returncode) diff --git a/c++/src/objects/pub/Pub.cpp b/c++/src/objects/pub/Pub.cpp index c48984e3..5c4d3555 100644 --- a/c++/src/objects/pub/Pub.cpp +++ b/c++/src/objects/pub/Pub.cpp @@ -1,4 +1,4 @@ -/* $Id: Pub.cpp 607097 2020-04-30 12:32:13Z grichenk $ +/* $Id: Pub.cpp 677027 2024-01-03 14:07:59Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -149,13 +149,15 @@ bool CPub::GetLabel(string* label, } -bool CPub::IsSetAuthors(void) const +bool CPub::IsSetAuthors() const { switch (Which()) { case CPub::e_Gen : return (GetGen().IsSetAuthors()); case CPub::e_Sub : return (GetSub().IsSetAuthors()); + case CPub::e_Medline : + return (GetMedline().IsSetCit() && GetMedline().GetCit().IsSetAuthors()); case CPub::e_Article : return (GetArticle().IsSetAuthors()); case CPub::e_Book : @@ -168,18 +170,20 @@ bool CPub::IsSetAuthors(void) const return (GetMan().IsSetCit() && GetMan().GetCit().IsSetAuthors()); default : break; - } - - return false; + } + + return false; } -const CAuth_list& CPub::GetAuthors (void) const +const CAuth_list& CPub::GetAuthors() const { - switch (Which()) { + switch (Which()) { case CPub::e_Gen : return (GetGen().GetAuthors()); case CPub::e_Sub : return (GetSub().GetAuthors()); + case CPub::e_Medline : + return (GetMedline().GetCit().GetAuthors()); case CPub::e_Article : return (GetArticle().GetAuthors()); case CPub::e_Book : @@ -194,16 +198,18 @@ const CAuth_list& CPub::GetAuthors (void) const NCBI_THROW(CSerialException, eNotImplemented, "CPub::GetAuthors: unsupported entry type " + SelectionName(Which())); - } + } } -CAuth_list& CPub::SetAuthors (void) +CAuth_list& CPub::SetAuthors() { - switch (Which()) { + switch (Which()) { case CPub::e_Gen : return (SetGen().SetAuthors()); case CPub::e_Sub : return (SetSub().SetAuthors()); + case CPub::e_Medline : + return (SetMedline().SetCit().SetAuthors()); case CPub::e_Article : return (SetArticle().SetAuthors()); case CPub::e_Book : @@ -218,7 +224,7 @@ CAuth_list& CPub::SetAuthors (void) NCBI_THROW(CSerialException, eNotImplemented, "CPub::SetAuthors: unsupported entry type " + SelectionName(Which())); - } + } } void CPub::GetTitles( @@ -355,9 +361,9 @@ typedef struct { } SPubMatchInfo; -string s_GetTitleString(const CTitle::C_E& title) +string s_GetTitleString(const CTitle::C_E& title) { - string str = ""; + string str; switch (title.Which()) { case CTitle::C_E::e_Name: @@ -399,8 +405,8 @@ string s_GetTitleString(const CTitle::C_E& title) bool s_TitleMatch(const CTitle& title1, const CTitle& title2, CTitle::C_E::E_Choice title_type) { - string compare1 = ""; - string compare2 = ""; + string compare1; + string compare2; ITERATE(CTitle::Tdata, it, title1.Get()) { if ((*it)->Which() == title_type) { diff --git a/c++/src/objects/remap/remap_client.cpp b/c++/src/objects/remap/remap_client.cpp index 05b91833..3e994eb7 100644 --- a/c++/src/objects/remap/remap_client.cpp +++ b/c++/src/objects/remap/remap_client.cpp @@ -1,4 +1,4 @@ -/* $Id: remap_client.cpp 369026 2012-07-16 12:24:38Z ivanov $ +/* $Id: remap_client.cpp 677880 2024-01-24 19:07:34Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -51,9 +51,7 @@ BEGIN_NCBI_SCOPE BEGIN_objects_SCOPE // namespace ncbi::objects:: -const char* CRemapClient::kDefaultUrl = - "http://intrawebdev.be-md.ncbi.nlm.nih.gov:6224/" - "staff/jcherry/remap/remap_server.cgi"; +const char* CRemapClient::kDefaultUrl = "http://intrawebdev8/staff/jcherry/remap/remap_server.cgi"; // destructor diff --git a/c++/src/objects/seqfeat/OrgMod.cpp b/c++/src/objects/seqfeat/OrgMod.cpp index 0a50a204..f7754bb5 100644 --- a/c++/src/objects/seqfeat/OrgMod.cpp +++ b/c++/src/objects/seqfeat/OrgMod.cpp @@ -1,4 +1,4 @@ -/* $Id: OrgMod.cpp 664355 2023-03-13 16:05:25Z foleyjp $ +/* $Id: OrgMod.cpp 684486 2024-06-25 12:34:24Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -820,6 +820,15 @@ const char* sm_BadStrainValues[] = { "yes", "no", "-", + "bacteria", + "sp.", + "sp", + "strain", + "environmental", + "soil", + "clinical isolate", + "NA", + "whole organism", "microbial" }; @@ -1221,6 +1230,40 @@ bool COrgMod::IsINSDCValidTypeMaterial(const string& type_material) } +static bool s_init_LookForMultipleIsolates(void) +{ + if (! CNcbiApplication::Instance()) { + return false; + } + + const CNcbiEnvironment& env = CNcbiApplication::Instance()->GetEnvironment(); + string fromEnv = env.Get("NCBI_VALIDATE_FOR_MULTIPLE_ISOLATES"); + NStr::ToLower(fromEnv); + if (fromEnv == "true") { + return true; + } else if (fromEnv == "false") { + return false; + } + + const CNcbiRegistry& reg = CNcbiApplication::Instance()->GetConfig(); + string fromConfig = reg.GetString("OrgMod", "ValidateForMultipleIsolates", "off"); + NStr::ToLower(fromConfig); + if (fromConfig == "1" || fromConfig == "on" || fromConfig == "true" || fromConfig == "yes") { + return true; + } + + // RW-2259 enable by default + return true; +} + + +bool COrgMod::NCBI_ValidateForMultipleIsolates(void) +{ + static bool value = s_init_LookForMultipleIsolates(); + return value; +} + + END_objects_SCOPE // namespace ncbi::objects:: diff --git a/c++/src/objects/seqfeat/SubSource.cpp b/c++/src/objects/seqfeat/SubSource.cpp index 97252014..e3fd669c 100644 --- a/c++/src/objects/seqfeat/SubSource.cpp +++ b/c++/src/objects/seqfeat/SubSource.cpp @@ -1,4 +1,4 @@ -/* $Id: SubSource.cpp 665075 2023-03-27 19:11:29Z kans $ +/* $Id: SubSource.cpp 684484 2024-06-25 12:34:14Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -64,6 +64,40 @@ CSubSource::~CSubSource(void) { } + +static bool s_init_UseGeoLocNameForCountry(void) +{ + if (! CNcbiApplication::Instance()) { + return false; + } + + const CNcbiEnvironment& env = CNcbiApplication::Instance()->GetEnvironment(); + string fromEnv = env.Get("NCBI_GEO_LOC_NAME_FOR_COUNTRY"); + NStr::ToLower(fromEnv); + if (fromEnv == "true") { + return true; + } else if (fromEnv == "false") { + return false; + } + + const CNcbiRegistry& reg = CNcbiApplication::Instance()->GetConfig(); + string fromConfig = reg.GetString("OrgSubSource", "UseGeoLocNameForCountry", "off"); + NStr::ToLower(fromConfig); + if (fromConfig == "1" || fromConfig == "on" || fromConfig == "true" || fromConfig == "yes") { + return true; + } + + return false; +} + + +bool CSubSource::NCBI_UseGeoLocNameForCountry(void) +{ + static bool value = s_init_UseGeoLocNameForCountry(); + return value; +} + + void CSubSource::GetLabel(string* str) const { *str += '/'; @@ -920,11 +954,56 @@ bool s_ChooseMonthAndDay(const string& token1, const string& token2, bool month_ } +// RW-2286 +static string RepairSingleDigitMonth (const string& orig_date) +{ + if (orig_date.find_first_not_of(" ,-/=_.0123456789") != NPOS) { + return orig_date; + } + + // multi-delimiter extraction logic adapted from example in: + // https://stackoverflow.com/questions/7621727/split-a-string-into-words-by-multiple-delimiters + + string delims = " ,-/=_."; + size_t prev = 0; + size_t next = orig_date.find_first_of(delims, prev); + vector tokens; + + while (next != string::npos) { + if (next > prev) { + string str = orig_date.substr(prev, next - prev); + if (str.length() == 1) { + // pad single digit with leading zero + str = "0" + str; + } + tokens.push_back(str); + } + prev = next + 1; + next = orig_date.find_first_of(delims, prev); + } + + if (prev < orig_date.length()) { + string str = orig_date.substr(prev, string::npos); + if (str.length() == 1) { + // pad last component single digit with leading zero + str = "0" + str; + } + tokens.push_back(str); + } + + string result = NStr::Join(tokens, "-"); + + return result; +} + + string CSubSource::FixDateFormat (const string& test, bool month_first, bool& month_ambiguous) { string orig_date = test; NStr::TruncateSpacesInPlace(orig_date); + orig_date = RepairSingleDigitMonth(orig_date); + if (IsISOFormatDate(orig_date)) { return orig_date; } else if (x_IsFixableIsoDate(orig_date)) { @@ -3008,7 +3087,7 @@ static const char* const s_Countries[] = { "Cuba", "Curacao", "Cyprus", - "Czech Republic", + "Czechia", "Democratic Republic of the Congo", "Denmark", "Djibouti", @@ -3232,6 +3311,7 @@ static const char* const s_Former_Countries[] = { "Belgian Congo", "British Guiana", "Burma", + "Czech Republic", "Czechoslovakia", "East Timor", "Korea", @@ -3452,7 +3532,7 @@ static const SStaticPair s_map_country_name_fixes[] = {"CXR", "Christmas Island"}, {"CYM", "Cayman Islands"}, {"CYP", "Cyprus"}, -{"CZE", "Czech Republic"}, +{"CZE", "Czechia"}, {"Cape Verde Islands", "Cape Verde"}, {"DEU", "Germany"}, {"DJI", "Djibouti"}, @@ -4478,7 +4558,7 @@ CCountries::EStateCleanup s_DoUSAStateCleanup ( string& country ) { // has multiple components // int max = components.size() - 1; - for ( int j = 0; j < components.size(); j++ ) { + for ( size_t j = 0; j < components.size(); j++ ) { bool modified = false; if ( s_IsState ( components[j], modified )) { /* @@ -4637,6 +4717,18 @@ string CCountries::NewFixCountry (const string& test, bool us_territories) } } + // JIRA:RW-2243 Micronesia is the only entry with a comma, special case test here + string micronesia = "Micronesia, Federated States of"; + if (NStr::EqualNocase(test, micronesia)) { + if (! NStr::EqualCase(test, micronesia)) { + return micronesia; + } + } + // JIRA:RW-2243 also special case to convert old Micronesia name to new name + if (NStr::EqualNocase(test, "Micronesia")) { + return micronesia; + } + string input = test; if (NStr::StartsWith(input, "\"") && NStr::EndsWith(input, "\"")) { input = input.substr(1, input.length() - 2); diff --git a/c++/src/objects/seqfeat/ecnum_ambiguous.inc b/c++/src/objects/seqfeat/ecnum_ambiguous.inc index 940a5569..1c62d2eb 100644 --- a/c++/src/objects/seqfeat/ecnum_ambiguous.inc +++ b/c++/src/objects/seqfeat/ecnum_ambiguous.inc @@ -1,4 +1,4 @@ -/* $Id: ecnum_ambiguous.inc 672959 2023-09-19 12:44:26Z ivanov $ +/* $Id: ecnum_ambiguous.inc 683836 2024-06-06 12:08:40Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -30,10 +30,9 @@ * */ -/* time_t value corresponding to Thu Sep 14 15:30:29 EDT 2023 -; formally +/* time_t value corresponding to Sat Jun 1 12:48:23 EDT 2024; formally * expressed as unsigned long so output can stand fully on its own. */ -static const unsigned long kECNum_ambiguous_Timestamp = 1694719829UL; +static const unsigned long kECNum_ambiguous_Timestamp = 1717260503UL; static const char* const kECNum_ambiguous[] = { "1.-.-.-\tOxidoreductases", "1.n.n.n\tOxidoreductases", @@ -595,6 +594,8 @@ static const char* const kECNum_ambiguous[] = { "3.4.24.n\tMetalloendopeptidases", "3.4.25.-\tThreonine endopeptidases", "3.4.25.n\tThreonine endopeptidases", + "3.4.26.-\tGlutamic endopeptidases", + "3.4.26.n\tGlutamic endopeptidases", "3.4.99.-\tEndopeptidases of unknown catalytic mechanism", "3.4.99.n\tEndopeptidases of unknown catalytic mechanism", "3.5.-.-\tActing on carbon-nitrogen bonds, other than peptide bonds", diff --git a/c++/src/objects/seqfeat/ecnum_ambiguous.txt b/c++/src/objects/seqfeat/ecnum_ambiguous.txt index 917e36ea..7cdad329 100644 --- a/c++/src/objects/seqfeat/ecnum_ambiguous.txt +++ b/c++/src/objects/seqfeat/ecnum_ambiguous.txt @@ -558,6 +558,8 @@ 3.4.24.n Metalloendopeptidases 3.4.25.- Threonine endopeptidases 3.4.25.n Threonine endopeptidases +3.4.26.- Glutamic endopeptidases +3.4.26.n Glutamic endopeptidases 3.4.99.- Endopeptidases of unknown catalytic mechanism 3.4.99.n Endopeptidases of unknown catalytic mechanism 3.5.-.- Acting on carbon-nitrogen bonds, other than peptide bonds diff --git a/c++/src/objects/seqfeat/ecnum_deleted.inc b/c++/src/objects/seqfeat/ecnum_deleted.inc index 4aa9d1c4..26a19580 100644 --- a/c++/src/objects/seqfeat/ecnum_deleted.inc +++ b/c++/src/objects/seqfeat/ecnum_deleted.inc @@ -1,4 +1,4 @@ -/* $Id: ecnum_deleted.inc 672959 2023-09-19 12:44:26Z ivanov $ +/* $Id: ecnum_deleted.inc 683836 2024-06-06 12:08:40Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -30,10 +30,9 @@ * */ -/* time_t value corresponding to Thu Sep 14 15:30:29 EDT 2023 -; formally +/* time_t value corresponding to Sat Jun 1 12:48:23 EDT 2024; formally * expressed as unsigned long so output can stand fully on its own. */ -static const unsigned long kECNum_deleted_Timestamp = 1694719829UL; +static const unsigned long kECNum_deleted_Timestamp = 1717260503UL; static const char* const kECNum_deleted[] = { "1.1.1.74", "1.1.1.128", diff --git a/c++/src/objects/seqfeat/ecnum_replaced.inc b/c++/src/objects/seqfeat/ecnum_replaced.inc index fba88454..1b114a72 100644 --- a/c++/src/objects/seqfeat/ecnum_replaced.inc +++ b/c++/src/objects/seqfeat/ecnum_replaced.inc @@ -1,4 +1,4 @@ -/* $Id: ecnum_replaced.inc 672959 2023-09-19 12:44:26Z ivanov $ +/* $Id: ecnum_replaced.inc 683836 2024-06-06 12:08:40Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -30,12 +30,13 @@ * */ -/* time_t value corresponding to Thu Sep 14 15:30:29 EDT 2023 -; formally +/* time_t value corresponding to Sat Jun 1 12:48:23 EDT 2024; formally * expressed as unsigned long so output can stand fully on its own. */ -static const unsigned long kECNum_replaced_Timestamp = 1694719829UL; +static const unsigned long kECNum_replaced_Timestamp = 1717260503UL; static const char* const kECNum_replaced[] = { "1.1.1.5\t1.1.1.303\t1.1.1.304", + "1.1.1.32\t1.1.1.1", + "1.1.1.33\t1.1.1.2", "1.1.1.63\t1.1.1.239", "1.1.1.68\t1.5.1.20", "1.1.1.70\t1.2.1.3", @@ -192,6 +193,7 @@ static const char* const kECNum_replaced[] = { "1.5.99.9\t1.5.98.1", "1.5.99.10\t1.5.8.1", "1.5.99.11\t1.5.98.2", + "1.6.1.2\t7.1.1.1", "1.6.1.5\t7.1.1.1", "1.6.2.1\t1.6.99.3", "1.6.4.1\t1.8.1.6", @@ -247,6 +249,7 @@ static const char* const kECNum_replaced[] = { "1.8.6.1\t2.5.1.18", "1.8.99.3\t1.8.99.5", "1.8.99.4\t1.8.4.8", + "1.8.99.5\t1.8.1.22", "1.9.3.1\t7.1.1.9", "1.9.3.2\t1.7.2.1", "1.9.99.1\t1.9.98.1", @@ -456,6 +459,7 @@ static const char* const kECNum_replaced[] = { "1.14.14.4\t1.14.15.7", "1.14.14.6\t1.14.13.111", "1.14.14.7\t1.14.19.9", + "1.14.14.140\t1.14.14.162", "1.14.14.n1\t1.14.99.46", "1.14.15.2\t1.14.14.108", "1.14.15.12\t1.14.14.46", @@ -625,6 +629,7 @@ static const char* const kECNum_replaced[] = { "2.4.1.112\t2.4.1.186", "2.4.1.119\t2.4.99.18", "2.4.1.124\t2.4.1.87", + "2.4.1.129\t2.4.99.28", "2.4.1.130\t2.4.1.258\t2.4.1.259\t2.4.1.260\t2.4.1.261", "2.4.1.151\t2.4.1.87", "2.4.1.157\t2.4.1.336\t2.4.1.337", @@ -763,6 +768,7 @@ static const char* const kECNum_replaced[] = { "2.7.8.n1\t2.4.2.53", "2.7.8.n2\t2.7.8.33", "2.7.8.n3\t2.7.8.48", + "2.7.11.27\t2.7.11.31", "2.7.11.n1\t2.7.11.32", "2.7.11.n2\t2.7.11.33", "2.8.1.n1\t2.8.1.11", @@ -814,6 +820,7 @@ static const char* const kECNum_replaced[] = { "3.1.7.4\t4.2.1.133\t4.2.3.141", "3.1.7.7\t4.2.3.194", "3.1.7.8\t2.5.1.153", + "3.1.8.2\t3.8.2.2", "3.1.11.7\t3.6.1.71", "3.1.11.8\t3.6.1.70", "3.1.12.2\t3.6.1.72", diff --git a/c++/src/objects/seqfeat/ecnum_replaced.txt b/c++/src/objects/seqfeat/ecnum_replaced.txt index c15bdcdf..c7eabb73 100644 --- a/c++/src/objects/seqfeat/ecnum_replaced.txt +++ b/c++/src/objects/seqfeat/ecnum_replaced.txt @@ -1,4 +1,6 @@ 1.1.1.5 1.1.1.303 1.1.1.304 +1.1.1.32 1.1.1.1 +1.1.1.33 1.1.1.2 1.1.1.63 1.1.1.239 1.1.1.68 1.5.1.20 1.1.1.70 1.2.1.3 @@ -155,6 +157,7 @@ 1.5.99.9 1.5.98.1 1.5.99.10 1.5.8.1 1.5.99.11 1.5.98.2 +1.6.1.2 7.1.1.1 1.6.1.5 7.1.1.1 1.6.2.1 1.6.99.3 1.6.4.1 1.8.1.6 @@ -210,6 +213,7 @@ 1.8.6.1 2.5.1.18 1.8.99.3 1.8.99.5 1.8.99.4 1.8.4.8 +1.8.99.5 1.8.1.22 1.9.3.1 7.1.1.9 1.9.3.2 1.7.2.1 1.9.99.1 1.9.98.1 @@ -419,6 +423,7 @@ 1.14.14.4 1.14.15.7 1.14.14.6 1.14.13.111 1.14.14.7 1.14.19.9 +1.14.14.140 1.14.14.162 1.14.14.n1 1.14.99.46 1.14.15.2 1.14.14.108 1.14.15.12 1.14.14.46 @@ -588,6 +593,7 @@ 2.4.1.112 2.4.1.186 2.4.1.119 2.4.99.18 2.4.1.124 2.4.1.87 +2.4.1.129 2.4.99.28 2.4.1.130 2.4.1.258 2.4.1.259 2.4.1.260 2.4.1.261 2.4.1.151 2.4.1.87 2.4.1.157 2.4.1.336 2.4.1.337 @@ -726,6 +732,7 @@ 2.7.8.n1 2.4.2.53 2.7.8.n2 2.7.8.33 2.7.8.n3 2.7.8.48 +2.7.11.27 2.7.11.31 2.7.11.n1 2.7.11.32 2.7.11.n2 2.7.11.33 2.8.1.n1 2.8.1.11 @@ -777,6 +784,7 @@ 3.1.7.4 4.2.1.133 4.2.3.141 3.1.7.7 4.2.3.194 3.1.7.8 2.5.1.153 +3.1.8.2 3.8.2.2 3.1.11.7 3.6.1.71 3.1.11.8 3.6.1.70 3.1.12.2 3.6.1.72 diff --git a/c++/src/objects/seqfeat/ecnum_specific.inc b/c++/src/objects/seqfeat/ecnum_specific.inc index a3cba6f8..678656a7 100644 --- a/c++/src/objects/seqfeat/ecnum_specific.inc +++ b/c++/src/objects/seqfeat/ecnum_specific.inc @@ -1,4 +1,4 @@ -/* $Id: ecnum_specific.inc 672959 2023-09-19 12:44:26Z ivanov $ +/* $Id: ecnum_specific.inc 683836 2024-06-06 12:08:40Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -30,10 +30,9 @@ * */ -/* time_t value corresponding to Thu Sep 14 15:30:29 EDT 2023 -; formally +/* time_t value corresponding to Sat Jun 1 12:48:23 EDT 2024; formally * expressed as unsigned long so output can stand fully on its own. */ -static const unsigned long kECNum_specific_Timestamp = 1694719829UL; +static const unsigned long kECNum_specific_Timestamp = 1717260503UL; static const char* const kECNum_specific[] = { "1.1.1.1\talcohol dehydrogenase", "1.1.1.2\talcohol dehydrogenase (NADP(+))", @@ -65,8 +64,6 @@ static const char* const kECNum_specific[] = { "1.1.1.29\tglycerate dehydrogenase", "1.1.1.30\t3-hydroxybutyrate dehydrogenase", "1.1.1.31\t3-hydroxyisobutyrate dehydrogenase", - "1.1.1.32\tmevaldate reductase", - "1.1.1.33\tmevaldate reductase (NADPH)", "1.1.1.34\thydroxymethylglutaryl-CoA reductase (NADPH)", "1.1.1.35\t3-hydroxyacyl-CoA dehydrogenase", "1.1.1.36\tacetoacetyl-CoA reductase", @@ -243,7 +240,7 @@ static const char* const kECNum_specific[] = { "1.1.1.223\tisopiperitenol dehydrogenase", "1.1.1.224\tmannose-6-phosphate 6-reductase", "1.1.1.225\tchlordecone reductase", - "1.1.1.226\t4-hydroxycyclohexanecarboxylate dehydrogenase", + "1.1.1.226\ttrans-4-hydroxycyclohexanecarboxylate dehydrogenase", "1.1.1.227\t(-)-borneol dehydrogenase", "1.1.1.228\t(+)-sabinol dehydrogenase", "1.1.1.229\tdiethyl 2-methyl-3-oxosuccinate reductase", @@ -619,7 +616,7 @@ static const char* const kECNum_specific[] = { "1.2.1.79\tsuccinate-semialdehyde dehydrogenase (NADP(+))", "1.2.1.80\tlong-chain acyl-[acyl-carrier-protein] reductase", "1.2.1.81\tsulfoacetaldehyde dehydrogenase (acylating)", - "1.2.1.82\tbeta-apo-4'-carotenal oxygenase", + "1.2.1.82\tbeta-apo-4'-carotenal dehydrogenase", "1.2.1.83\t3-succinoylsemialdehyde-pyridine dehydrogenase", "1.2.1.84\talcohol-forming fatty acyl-CoA reductase", "1.2.1.85\t2-hydroxymuconate-6-semialdehyde dehydrogenase", @@ -789,6 +786,7 @@ static const char* const kECNum_specific[] = { "1.3.1.123\t7-epi-iridoid synthase", "1.3.1.124\t2,4-dienoyl-CoA reductase [(3E)-enoyl-CoA-producing]", "1.3.1.125\tacrylate reductase", + "1.3.1.126\t2-epi-5-epi-valiolone dehydrogenase", "1.3.1.n3\tcurcumin reductase", "1.3.2.3\tL-galactonolactone dehydrogenase", "1.3.2.4\tfumarate reductase (cytochrome)", @@ -902,7 +900,7 @@ static const char* const kECNum_specific[] = { "1.4.1.28\tsecondary-alkyl amine dehydrogenase [NAD(P)(+)]", "1.4.2.1\tglycine dehydrogenase (cytochrome)", "1.4.2.2\tnicotine dehydrogenase", - "1.4.2.3\tTEMPLATE: pseudooxynicotine oxidase", + "1.4.2.3\tpseudooxynicotine oxidase", "1.4.3.1\tD-aspartate oxidase", "1.4.3.2\tL-amino-acid oxidase", "1.4.3.3\tD-amino-acid oxidase", @@ -1018,7 +1016,7 @@ static const char* const kECNum_specific[] = { "1.5.98.2\t5,10-methylenetetrahydromethanopterin reductase", "1.5.98.3\tcoenzyme F420:methanophenazine dehydrogenase", "1.5.99.3\tL-pipecolate dehydrogenase", - "1.5.99.4\tnicotine hydroxylase", + "1.5.99.4\tnicotine 6-hydroxylase", "1.5.99.5\tmethylglutamate dehydrogenase", "1.5.99.6\tspermidine dehydrogenase", "1.5.99.12\tcytokinin dehydrogenase", @@ -1026,7 +1024,6 @@ static const char* const kECNum_specific[] = { "1.5.99.14\t6-hydroxypseudooxynicotine dehydrogenase", "1.5.99.15\tdihydromethanopterin reductase (acceptor)", "1.6.1.1\tNAD(P)(+) transhydrogenase (Si-specific)", - "1.6.1.2\tNAD(P)(+) transhydrogenase (Re/Si-specific)", "1.6.1.3\tNAD(P)(+) transhydrogenase", "1.6.1.4\tNAD(P)(+) transhydrogenase (ferredoxin)", "1.6.2.2\tcytochrome-b5 reductase", @@ -1102,6 +1099,7 @@ static const char* const kECNum_specific[] = { "1.8.1.19\tsulfide dehydrogenase", "1.8.1.20\t4,4'-dithiodibutanoate disulfide reductase", "1.8.1.21\tdissimilatory dimethyldisulfide reductase", + "1.8.1.22\tTEMPLATE: dissimilatory sulfite reductase", "1.8.2.1\tsulfite dehydrogenase (cytochrome)", "1.8.2.2\tthiosulfate dehydrogenase", "1.8.2.3\tsulfide-cytochrome-c reductase (flavocytochrome c)", @@ -1139,6 +1137,7 @@ static const char* const kECNum_specific[] = { "1.8.5.7\tglutathionyl-hydroquinone reductase", "1.8.5.8\teukaryotic sulfide quinone oxidoreductase", "1.8.5.9\tprotein dithiol:quinone oxidoreductase DsbB", + "1.8.5.10\t[DsrC]-trisulfide reductase", "1.8.7.1\tassimilatory sulfite reductase (ferredoxin)", "1.8.7.2\tferredoxin:thioredoxin reductase", "1.8.7.3\tferredoxin:CoB-CoM heterodisulfide reductase", @@ -1150,7 +1149,6 @@ static const char* const kECNum_specific[] = { "1.8.98.6\tformate:CoB-CoM heterodisulfide,ferredoxin reductase", "1.8.98.7\tcysteine-type anaerobic sulfatase-maturating enzyme", "1.8.99.2\tadenylyl-sulfate reductase", - "1.8.99.5\tdissimilatory sulfite reductase", "1.9.6.1\tnitrate reductase (cytochrome)", "1.9.98.1\tiron--cytochrome-c reductase", "1.10.1.1\ttrans-acenaphthene-1,2-diol dehydrogenase", @@ -1678,7 +1676,6 @@ static const char* const kECNum_specific[] = { "1.14.14.137\t(+)-abscisic acid 8'-hydroxylase", "1.14.14.138\tlithocholate 6beta-hydroxylase", "1.14.14.139\t5beta-cholestane-3alpha,7alpha-diol 12alpha-hydroxylase", - "1.14.14.140\tlicodione synthase", "1.14.14.141\tpsoralen synthase", "1.14.14.142\t8-dimethylallylnaringenin 2'-hydroxylase", "1.14.14.143\t(+)-menthofuran synthase", @@ -2242,7 +2239,7 @@ static const char* const kECNum_specific[] = { "2.1.1.240\ttrans-resveratrol di-O-methyltransferase", "2.1.1.241\t2,4,7-trihydroxy-1,4-benzoxazin-3-one-glucoside 7-O-methyltransferase", "2.1.1.242\t16S rRNA (guanine(1516)-N(2))-methyltransferase", - "2.1.1.243\t2-ketoarginine methyltransferase", + "2.1.1.243\t5-guanidino-2-oxopentanoate (3R)-methyltransferase", "2.1.1.244\tprotein N-terminal methyltransferase", "2.1.1.245\t5-methyltetrahydrosarcinapterin:corrinoid/iron-sulfur protein Co-methyltransferase", "2.1.1.246\t[methyl-Co(III) methanol-specific corrinoid protein]:coenzyme M methyltransferase", @@ -2297,7 +2294,7 @@ static const char* const kECNum_specific[] = { "2.1.1.295\t2-methyl-6-phytyl-1,4-hydroquinone methyltransferase", "2.1.1.296\tmethyltransferase cap2", "2.1.1.297\tpeptide chain release factor N(5)-glutamine methyltransferase", - "2.1.1.298\tribosomal protein L3 N(5)-glutamine methyltransferase", + "2.1.1.298\tribosomal protein uL3 N(5)-glutamine methyltransferase", "2.1.1.299\tprotein N-terminal monomethyltransferase", "2.1.1.300\tpavine N-methyltransferase", "2.1.1.301\tcypemycin N-terminal methyltransferase", @@ -2386,6 +2383,10 @@ static const char* const kECNum_specific[] = { "2.1.1.385\t[methyl-Co(III) methoxylated-aromatic-compound-specific corrinoid protein]--tetrahydrofolate methyltransferase", "2.1.1.386\tsmall RNA 2'-O-methyltransferase", "2.1.1.387\t5-dehydro-6-demethoxy-6-hydroxyfumagillol O-methyltransferase", + "2.1.1.388\tproline betaine--corrinoid protein Co-methyltransferase", + "2.1.1.389\t[methyl-Co(III) quaternary-amine-specific corrinoid protein]--tetrahydrofolate methyltransferase", + "2.1.1.390\tgentamicin X2 methyltransferase", + "2.1.1.391\tdemethylgadusol O-methyltransferase", "2.1.1.n1\tresorcinol O-methyltransferase", "2.1.1.n4\tthiocyanate methyltransferase", "2.1.1.n7\t5-pentadecatrienyl resorcinol O-methyltransferase", @@ -2688,8 +2689,8 @@ static const char* const kECNum_specific[] = { "2.3.1.263\t2-amino-4-oxopentanoate thiolase", "2.3.1.264\tbeta-lysine N(6)-acetyltransferase", "2.3.1.265\tphosphatidylinositol dimannoside acyltransferase", - "2.3.1.266\t[ribosomal protein S18]-alanine N-acetyltransferase", - "2.3.1.267\t[ribosomal protein S5]-alanine N-acetyltransferase", + "2.3.1.266\t[ribosomal protein bS18]-alanine N-acetyltransferase", + "2.3.1.267\t[ribosomal protein uS5]-alanine N-acetyltransferase", "2.3.1.268\tethanol O-acetyltransferase", "2.3.1.269\tapolipoprotein N-acyltransferase", "2.3.1.270\tlyso-ornithine lipid O-acyltransferase", @@ -2734,6 +2735,8 @@ static const char* const kECNum_specific[] = { "2.3.1.309\t[beta-tubulin]-L-lysine N-acetyltransferase", "2.3.1.310\tbenzoylsuccinyl-CoA thiolase", "2.3.1.311\ttRNA carboxymethyluridine synthase", + "2.3.1.312\tD-glutamate N-acetyltransferase", + "2.3.1.313\tNAD-dependent lipoamidase", "2.3.1.n4\t1-acyl-sn-glycerol-3-phosphate acyltransferase", "2.3.1.n5\tglycerol-3-phosphate acyltransferase (acyl-[acyl-carrier-protein]-transferring)", "2.3.1.n6\t1-acylglycerophosphoserine O-acyltransferase", @@ -2774,6 +2777,7 @@ static const char* const kECNum_specific[] = { "2.3.2.34\tE2 NEDD8-conjugating enzyme", "2.3.2.35\tcapsaicin synthase", "2.3.2.36\tRING-type E3 ubiquitin transferase (cysteine targeting)", + "2.3.2.37\tergosteryl-3beta-O-L-aspartate synthase", "2.3.3.1\tcitrate (Si)-synthase", "2.3.3.2\tdecylcitrate synthase", "2.3.3.3\tcitrate (Re)-synthase", @@ -2795,6 +2799,7 @@ static const char* const kECNum_specific[] = { "2.3.3.19\t2-phosphonomethylmalate synthase", "2.3.3.20\tacyl-CoA:acyl-CoA alkyltransferase", "2.3.3.21\t(R)-citramalate synthase", + "2.3.3.22\t3-carboxymethyl-3-hydroxy-acyl-[ACP] synthase", "2.4.1.1\tglycogen phosphorylase", "2.4.1.2\tdextrin dextranase", "2.4.1.4\tamylosucrase", @@ -2900,7 +2905,6 @@ static const char* const kECNum_specific[] = { "2.4.1.126\thydroxycinnamate 4-beta-glucosyltransferase", "2.4.1.127\tmonoterpenol beta-glucosyltransferase", "2.4.1.128\tscopoletin glucosyltransferase", - "2.4.1.129\tpeptidoglycan glycosyltransferase", "2.4.1.131\tGDP-Man:Man3GlcNAc2-PP-dolichol alpha-1,2-mannosyltransferase", "2.4.1.132\tGDP-Man:Man1GlcNAc2-PP-dolichol alpha-1,3-mannosyltransferase", "2.4.1.133\txylosylprotein 4-beta-galactosyltransferase", @@ -3152,6 +3156,7 @@ static const char* const kECNum_specific[] = { "2.4.1.390\t4,3-alpha-glucanotransferase", "2.4.1.391\tbeta-1,2-glucosyltransferase", "2.4.1.392\t3-O-beta-D-glucopyranosyl-beta-D-glucuronide phosphorylase", + "2.4.1.393\tMMP alpha-(1->4)-mannosyltransferase", "2.4.1.n2\tloliose synthase", "2.4.2.1\tpurine-nucleoside phosphorylase", "2.4.2.2\tpyrimidine-nucleoside phosphorylase", @@ -3237,6 +3242,9 @@ static const char* const kECNum_specific[] = { "2.4.99.23\tlipopolysaccharide heptosyltransferase I", "2.4.99.24\tlipopolysaccharide heptosyltransferase II", "2.4.99.25\tlipopolysaccharide heptosyltransferase III", + "2.4.99.26\tO-antigen ligase", + "2.4.99.27\tO-antigen polymerase Wzy", + "2.4.99.28\tpeptidoglycan glycosyltransferase", "2.5.1.1\tdimethylallyltranstransferase", "2.5.1.2\tthiamine pyridinylase", "2.5.1.3\tthiamine phosphate synthase", @@ -3381,6 +3389,7 @@ static const char* const kECNum_specific[] = { "2.5.1.154\tcorrinoid adenosyltransferase EutT", "2.5.1.155\tphosphoglycerol geranylfarnesyltransferase", "2.5.1.156\tgeranylfarnesylglycerol-phosphate geranylfarnesyltransferase", + "2.5.1.157\trRNA small subunit aminocarboxypropyltransferase", "2.5.1.n9\theptaprenylglyceryl phosphate synthase", "2.6.1.1\taspartate transaminase", "2.6.1.2\talanine transaminase", @@ -3945,7 +3954,6 @@ static const char* const kECNum_specific[] = { "2.7.11.24\tmitogen-activated protein kinase", "2.7.11.25\tmitogen-activated protein kinase kinase kinase", "2.7.11.26\t[tau protein] kinase", - "2.7.11.27\t[acetyl-CoA carboxylase] kinase", "2.7.11.28\ttropomyosin kinase", "2.7.11.29\t[low-density-lipoprotein receptor] kinase", "2.7.11.30\treceptor protein serine/threonine kinase", @@ -3953,6 +3961,7 @@ static const char* const kECNum_specific[] = { "2.7.11.32\t[pyruvate, phosphate dikinase] kinase", "2.7.11.33\t[pyruvate, water dikinase] kinase", "2.7.11.34\tNEK6-subfamily protein kinase", + "2.7.11.35\tCRIK-subfamily protein kinase", "2.7.12.1\tdual-specificity kinase", "2.7.12.2\tmitogen-activated protein kinase kinase", "2.7.13.1\tprotein-histidine pros-kinase", @@ -4045,7 +4054,7 @@ static const char* const kECNum_specific[] = { "2.8.4.1\tcoenzyme-B sulfoethylthiotransferase", "2.8.4.2\tarsenate-mycothiol transferase", "2.8.4.3\ttRNA-2-methylthio-N(6)-dimethylallyladenosine synthase", - "2.8.4.4\t[ribosomal protein S12] (aspartate(89)-C(3))-methylthiotransferase", + "2.8.4.4\t[ribosomal protein uS12] (aspartate(89)-C(3))-methylthiotransferase", "2.8.4.5\ttRNA (N(6)-L-threonylcarbamoyladenosine(37)-C(2))-methylthiotransferase", "2.8.4.6\tS-methyl-1-thioxylulose 5-phosphate methylthiotransferase", "2.8.5.1\tS-sulfo-L-cysteine synthase (3-phospho-L-serine-dependent)", @@ -4166,6 +4175,7 @@ static const char* const kECNum_specific[] = { "3.1.1.117\t(4-O-methyl)-D-glucuronate--lignin esterase", "3.1.1.118\tphospholipid sn-1 acylhydrolase", "3.1.1.120\tL-fucono-1,5-lactonase", + "3.1.1.121\tergosteryl-3beta-O-L-aspartate hydrolase", "3.1.1.n2\tprotein-S-isoprenylcysteine alpha-carbonyl methylesterase", "3.1.2.1\tacetyl-CoA hydrolase", "3.1.2.2\tpalmitoyl-CoA hydrolase", @@ -4364,7 +4374,6 @@ static const char* const kECNum_specific[] = { "3.1.7.12\t(+)-kolavelool synthase", "3.1.7.13\tneryl diphosphate diphosphatase", "3.1.8.1\taryldialkylphosphatase", - "3.1.8.2\tdiisopropyl-fluorophosphatase", "3.1.11.1\texodeoxyribonuclease I", "3.1.11.2\texodeoxyribonuclease III", "3.1.11.3\texodeoxyribonuclease (lambda-induced)", @@ -4611,6 +4620,7 @@ static const char* const kECNum_specific[] = { "3.2.1.217\texo-acting protein-alpha-N-acetylgalactosaminidase", "3.2.1.218\talpha-3'-ketoglucosidase", "3.2.1.219\tpalatinase", + "3.2.1.220\tipecoside beta-D-glucosidase", "3.2.1.n1\tblood group B branched chain alpha-1,3-galactosidase", "3.2.1.n2\tblood group B linear chain alpha-1,3-galactosidase", "3.2.1.n3\tDictyostelium lysozyme A", @@ -4681,6 +4691,7 @@ static const char* const kECNum_specific[] = { "3.4.11.24\taminopeptidase S", "3.4.11.25\tbeta-peptidyl aminopeptidase", "3.4.11.26\tintermediate cleaving peptidase 55", + "3.4.11.27\tarchaeal arginyl aminopeptidase", "3.4.13.4\tXaa-Arg dipeptidase", "3.4.13.5\tXaa-methyl-His dipeptidase", "3.4.13.7\tGlu-Glu dipeptidase", @@ -5031,6 +5042,7 @@ static const char* const kECNum_specific[] = { "3.4.24.89\tPro-Pro endopeptidase", "3.4.25.1\tproteasome endopeptidase complex", "3.4.25.2\tHslU--HslV peptidase", + "3.4.26.1\tintramembrane prenyl-peptidase Rce1", "3.5.1.1\tasparaginase", "3.5.1.2\tglutaminase", "3.5.1.3\tomega-amidase", @@ -5161,6 +5173,7 @@ static const char* const kECNum_specific[] = { "3.5.1.135\tN(4)-acetylcytidine amidohydrolase", "3.5.1.136\tN,N'-diacetylchitobiose non-reducing end deacetylase", "3.5.1.137\tN-methylcarbamate hydrolase", + "3.5.1.138\tlipoamidase", "3.5.1.n3\t4-deoxy-4-formamido-L-arabinose-phosphoundecaprenol deformylase", "3.5.2.1\tbarbiturase", "3.5.2.2\tdihydropyrimidinase", @@ -5376,6 +5389,7 @@ static const char* const kECNum_specific[] = { "3.8.1.9\t(R)-2-haloacid dehalogenase", "3.8.1.10\t2-haloacid dehalogenase (configuration-inverting)", "3.8.1.11\t2-haloacid dehalogenase (configuration-retaining)", + "3.8.2.2\tdiisopropyl-fluorophosphatase", "3.9.1.1\tphosphoamidase", "3.9.1.2\tprotein arginine phosphatase", "3.9.1.3\tphosphohistidine phosphatase", @@ -5509,6 +5523,9 @@ static const char* const kECNum_specific[] = { "4.1.1.121\t3-oxoisoapionate-4-phosphate decarboxylase", "4.1.1.122\tL-cysteate decarboxylase", "4.1.1.123\tphenyl-phosphate phosphatase/carboxylase", + "4.1.1.124\tmalonyl-[acp] decarboxylase", + "4.1.1.125\t4-carboxy-3-alkylbut-2-enoyl-[ACP] decarboxylase", + "4.1.1.126\tanhydromevalonate phosphate decarboxylase", "4.1.2.2\tketotetrose-phosphate aldolase", "4.1.2.4\tdeoxyribose-phosphate aldolase", "4.1.2.5\tL-threonine aldolase", @@ -5561,6 +5578,7 @@ static const char* const kECNum_specific[] = { "4.1.2.61\tferuloyl-CoA hydratase/lyase", "4.1.2.62\t5-deoxyribulose 1-phosphate aldolase", "4.1.2.63\t2-hydroxyacyl-CoA lyase", + "4.1.2.64\t2-dehydro-3-deoxy-L-fuconate aldolase", "4.1.3.1\tisocitrate lyase", "4.1.3.3\tN-acetylneuraminate lyase", "4.1.3.4\thydroxymethylglutaryl-CoA lyase", @@ -5606,6 +5624,7 @@ static const char* const kECNum_specific[] = { "4.1.99.25\tL-tryptophan isonitrile synthase", "4.1.99.26\t3-amino-5-[(4-hydroxyphenyl)methyl]-4,4-dimethylpyrrolidin-2-one synthase", "4.1.99.27\tcyclopenase", + "4.1.99.28\t3'-dehydrocarminate deglycosidase", "4.2.1.1\tcarbonic anhydrase", "4.2.1.2\tfumarate hydratase", "4.2.1.3\taconitate hydratase", @@ -5763,6 +5782,8 @@ static const char* const kECNum_specific[] = { "4.2.1.178\tdifructose-dianhydride-III synthase", "4.2.1.179\tdifructose-anhydride-I synthase", "4.2.1.180\t(E)-benzylidenesuccinyl-CoA hydratase", + "4.2.1.181\t3-carboxymethyl-3-hydroxy-acyl-[ACP] dehydratase", + "4.2.1.182\tphosphomevalonate dehydratase", "4.2.2.1\thyaluronate lyase", "4.2.2.2\tpectate lyase", "4.2.2.3\tmannuronate-specific alginate lyase", @@ -6002,6 +6023,14 @@ static const char* const kECNum_specific[] = { "4.2.3.209\t(R)-axinyssene synthase", "4.2.3.210\tlydicene synthase", "4.2.3.211\t(+)-exo-beta-bergamotene synthase", + "4.2.3.212\t(+)-delta-cadinol synthase", + "4.2.3.213\tcolleterpenol synthase", + "4.2.3.214\tdolasta-1(15),8-diene synthase", + "4.2.3.215\tdelta-araneosene synthase", + "4.2.3.216\tsomaliensene A synthase", + "4.2.3.217\tsomaliensene B synthase", + "4.2.3.218\tvariediene synthase", + "4.2.3.219\t(2E)-alpha-cericerene synthase", "4.2.99.12\tcarboxymethyloxysuccinate lyase", "4.2.99.18\tDNA-(apurinic or apyrimidinic site) lyase", "4.2.99.20\t2-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carboxylate synthase", @@ -6009,6 +6038,7 @@ static const char* const kECNum_specific[] = { "4.2.99.22\ttuliposide A-converting enzyme", "4.2.99.23\ttuliposide B-converting enzyme", "4.2.99.24\tthebaine synthase", + "4.2.99.25\tunsaturated pyranuronate lyase", "4.3.1.1\taspartate ammonia-lyase", "4.3.1.2\tmethylaspartate ammonia-lyase", "4.3.1.3\thistidine ammonia-lyase", @@ -6036,6 +6066,7 @@ static const char* const kECNum_specific[] = { "4.3.1.30\tdTDP-4-amino-4,6-dideoxy-D-glucose ammonia-lyase", "4.3.1.31\tL-tryptophan ammonia lyase", "4.3.1.32\t7,8-didemethyl-8-hydroxy-5-deazariboflavin synthase", + "4.3.1.33\t(R)-1-hydroxy-2-aminoethylphosphonate ammonia-lyase", "4.3.2.1\targininosuccinate lyase", "4.3.2.2\tadenylosuccinate lyase", "4.3.2.3\tureidoglycolate lyase", @@ -6160,6 +6191,7 @@ static const char* const kECNum_specific[] = { "5.1.1.22\t4-hydroxyproline betaine 2-epimerase", "5.1.1.23\tUDP-N-acetyl-alpha-D-muramoyl-L-alanyl-L-glutamate epimerase", "5.1.1.24\thistidine racemase", + "5.1.1.25\tN-acetyl-D-glutamate racemase", "5.1.2.1\tlactate racemase", "5.1.2.2\tmandelate racemase", "5.1.2.3\t3-hydroxybutyryl-CoA epimerase", @@ -6693,6 +6725,7 @@ static const char* const kECNum_specific[] = { "6.6.1.1\tmagnesium chelatase", "6.6.1.2\tcobaltochelatase", "6.7.1.1\t3-amino-2-hydroxy-4-methoxybenzoate diazotase", + "6.7.1.2\t3-aminoavenalumate diazotase", "7.1.1.1\tproton-translocating NAD(P)(+) transhydrogenase", "7.1.1.2\tNADH:ubiquinone reductase (H(+)-translocating)", "7.1.1.3\tubiquinol oxidase (H(+)-transporting)", @@ -6773,6 +6806,7 @@ static const char* const kECNum_specific[] = { "7.5.2.11\tABC-type D-galactose transporter", "7.5.2.12\tABC-type L-arabinose transporter", "7.5.2.13\tABC-type D-xylose/L-arabinose transporter", + "7.5.2.14\tABC-type homopolymeric O-antigen exporter", "7.6.2.1\tP-type phospholipid transporter", "7.6.2.2\tABC-type xenobiotic transporter", "7.6.2.3\tABC-type glutathione-S-conjugate transporter", diff --git a/c++/src/objects/seqfeat/ecnum_specific.txt b/c++/src/objects/seqfeat/ecnum_specific.txt index 704dc34d..6a31bbf5 100644 --- a/c++/src/objects/seqfeat/ecnum_specific.txt +++ b/c++/src/objects/seqfeat/ecnum_specific.txt @@ -28,8 +28,6 @@ 1.1.1.29 glycerate dehydrogenase 1.1.1.30 3-hydroxybutyrate dehydrogenase 1.1.1.31 3-hydroxyisobutyrate dehydrogenase -1.1.1.32 mevaldate reductase -1.1.1.33 mevaldate reductase (NADPH) 1.1.1.34 hydroxymethylglutaryl-CoA reductase (NADPH) 1.1.1.35 3-hydroxyacyl-CoA dehydrogenase 1.1.1.36 acetoacetyl-CoA reductase @@ -206,7 +204,7 @@ 1.1.1.223 isopiperitenol dehydrogenase 1.1.1.224 mannose-6-phosphate 6-reductase 1.1.1.225 chlordecone reductase -1.1.1.226 4-hydroxycyclohexanecarboxylate dehydrogenase +1.1.1.226 trans-4-hydroxycyclohexanecarboxylate dehydrogenase 1.1.1.227 (-)-borneol dehydrogenase 1.1.1.228 (+)-sabinol dehydrogenase 1.1.1.229 diethyl 2-methyl-3-oxosuccinate reductase @@ -582,7 +580,7 @@ 1.2.1.79 succinate-semialdehyde dehydrogenase (NADP(+)) 1.2.1.80 long-chain acyl-[acyl-carrier-protein] reductase 1.2.1.81 sulfoacetaldehyde dehydrogenase (acylating) -1.2.1.82 beta-apo-4'-carotenal oxygenase +1.2.1.82 beta-apo-4'-carotenal dehydrogenase 1.2.1.83 3-succinoylsemialdehyde-pyridine dehydrogenase 1.2.1.84 alcohol-forming fatty acyl-CoA reductase 1.2.1.85 2-hydroxymuconate-6-semialdehyde dehydrogenase @@ -752,6 +750,7 @@ 1.3.1.123 7-epi-iridoid synthase 1.3.1.124 2,4-dienoyl-CoA reductase [(3E)-enoyl-CoA-producing] 1.3.1.125 acrylate reductase +1.3.1.126 2-epi-5-epi-valiolone dehydrogenase 1.3.1.n3 curcumin reductase 1.3.2.3 L-galactonolactone dehydrogenase 1.3.2.4 fumarate reductase (cytochrome) @@ -865,7 +864,7 @@ 1.4.1.28 secondary-alkyl amine dehydrogenase [NAD(P)(+)] 1.4.2.1 glycine dehydrogenase (cytochrome) 1.4.2.2 nicotine dehydrogenase -1.4.2.3 TEMPLATE: pseudooxynicotine oxidase +1.4.2.3 pseudooxynicotine oxidase 1.4.3.1 D-aspartate oxidase 1.4.3.2 L-amino-acid oxidase 1.4.3.3 D-amino-acid oxidase @@ -981,7 +980,7 @@ 1.5.98.2 5,10-methylenetetrahydromethanopterin reductase 1.5.98.3 coenzyme F420:methanophenazine dehydrogenase 1.5.99.3 L-pipecolate dehydrogenase -1.5.99.4 nicotine hydroxylase +1.5.99.4 nicotine 6-hydroxylase 1.5.99.5 methylglutamate dehydrogenase 1.5.99.6 spermidine dehydrogenase 1.5.99.12 cytokinin dehydrogenase @@ -989,7 +988,6 @@ 1.5.99.14 6-hydroxypseudooxynicotine dehydrogenase 1.5.99.15 dihydromethanopterin reductase (acceptor) 1.6.1.1 NAD(P)(+) transhydrogenase (Si-specific) -1.6.1.2 NAD(P)(+) transhydrogenase (Re/Si-specific) 1.6.1.3 NAD(P)(+) transhydrogenase 1.6.1.4 NAD(P)(+) transhydrogenase (ferredoxin) 1.6.2.2 cytochrome-b5 reductase @@ -1065,6 +1063,7 @@ 1.8.1.19 sulfide dehydrogenase 1.8.1.20 4,4'-dithiodibutanoate disulfide reductase 1.8.1.21 dissimilatory dimethyldisulfide reductase +1.8.1.22 TEMPLATE: dissimilatory sulfite reductase 1.8.2.1 sulfite dehydrogenase (cytochrome) 1.8.2.2 thiosulfate dehydrogenase 1.8.2.3 sulfide-cytochrome-c reductase (flavocytochrome c) @@ -1102,6 +1101,7 @@ 1.8.5.7 glutathionyl-hydroquinone reductase 1.8.5.8 eukaryotic sulfide quinone oxidoreductase 1.8.5.9 protein dithiol:quinone oxidoreductase DsbB +1.8.5.10 [DsrC]-trisulfide reductase 1.8.7.1 assimilatory sulfite reductase (ferredoxin) 1.8.7.2 ferredoxin:thioredoxin reductase 1.8.7.3 ferredoxin:CoB-CoM heterodisulfide reductase @@ -1113,7 +1113,6 @@ 1.8.98.6 formate:CoB-CoM heterodisulfide,ferredoxin reductase 1.8.98.7 cysteine-type anaerobic sulfatase-maturating enzyme 1.8.99.2 adenylyl-sulfate reductase -1.8.99.5 dissimilatory sulfite reductase 1.9.6.1 nitrate reductase (cytochrome) 1.9.98.1 iron--cytochrome-c reductase 1.10.1.1 trans-acenaphthene-1,2-diol dehydrogenase @@ -1641,7 +1640,6 @@ 1.14.14.137 (+)-abscisic acid 8'-hydroxylase 1.14.14.138 lithocholate 6beta-hydroxylase 1.14.14.139 5beta-cholestane-3alpha,7alpha-diol 12alpha-hydroxylase -1.14.14.140 licodione synthase 1.14.14.141 psoralen synthase 1.14.14.142 8-dimethylallylnaringenin 2'-hydroxylase 1.14.14.143 (+)-menthofuran synthase @@ -2205,7 +2203,7 @@ 2.1.1.240 trans-resveratrol di-O-methyltransferase 2.1.1.241 2,4,7-trihydroxy-1,4-benzoxazin-3-one-glucoside 7-O-methyltransferase 2.1.1.242 16S rRNA (guanine(1516)-N(2))-methyltransferase -2.1.1.243 2-ketoarginine methyltransferase +2.1.1.243 5-guanidino-2-oxopentanoate (3R)-methyltransferase 2.1.1.244 protein N-terminal methyltransferase 2.1.1.245 5-methyltetrahydrosarcinapterin:corrinoid/iron-sulfur protein Co-methyltransferase 2.1.1.246 [methyl-Co(III) methanol-specific corrinoid protein]:coenzyme M methyltransferase @@ -2260,7 +2258,7 @@ 2.1.1.295 2-methyl-6-phytyl-1,4-hydroquinone methyltransferase 2.1.1.296 methyltransferase cap2 2.1.1.297 peptide chain release factor N(5)-glutamine methyltransferase -2.1.1.298 ribosomal protein L3 N(5)-glutamine methyltransferase +2.1.1.298 ribosomal protein uL3 N(5)-glutamine methyltransferase 2.1.1.299 protein N-terminal monomethyltransferase 2.1.1.300 pavine N-methyltransferase 2.1.1.301 cypemycin N-terminal methyltransferase @@ -2349,6 +2347,10 @@ 2.1.1.385 [methyl-Co(III) methoxylated-aromatic-compound-specific corrinoid protein]--tetrahydrofolate methyltransferase 2.1.1.386 small RNA 2'-O-methyltransferase 2.1.1.387 5-dehydro-6-demethoxy-6-hydroxyfumagillol O-methyltransferase +2.1.1.388 proline betaine--corrinoid protein Co-methyltransferase +2.1.1.389 [methyl-Co(III) quaternary-amine-specific corrinoid protein]--tetrahydrofolate methyltransferase +2.1.1.390 gentamicin X2 methyltransferase +2.1.1.391 demethylgadusol O-methyltransferase 2.1.1.n1 resorcinol O-methyltransferase 2.1.1.n4 thiocyanate methyltransferase 2.1.1.n7 5-pentadecatrienyl resorcinol O-methyltransferase @@ -2651,8 +2653,8 @@ 2.3.1.263 2-amino-4-oxopentanoate thiolase 2.3.1.264 beta-lysine N(6)-acetyltransferase 2.3.1.265 phosphatidylinositol dimannoside acyltransferase -2.3.1.266 [ribosomal protein S18]-alanine N-acetyltransferase -2.3.1.267 [ribosomal protein S5]-alanine N-acetyltransferase +2.3.1.266 [ribosomal protein bS18]-alanine N-acetyltransferase +2.3.1.267 [ribosomal protein uS5]-alanine N-acetyltransferase 2.3.1.268 ethanol O-acetyltransferase 2.3.1.269 apolipoprotein N-acyltransferase 2.3.1.270 lyso-ornithine lipid O-acyltransferase @@ -2697,6 +2699,8 @@ 2.3.1.309 [beta-tubulin]-L-lysine N-acetyltransferase 2.3.1.310 benzoylsuccinyl-CoA thiolase 2.3.1.311 tRNA carboxymethyluridine synthase +2.3.1.312 D-glutamate N-acetyltransferase +2.3.1.313 NAD-dependent lipoamidase 2.3.1.n4 1-acyl-sn-glycerol-3-phosphate acyltransferase 2.3.1.n5 glycerol-3-phosphate acyltransferase (acyl-[acyl-carrier-protein]-transferring) 2.3.1.n6 1-acylglycerophosphoserine O-acyltransferase @@ -2737,6 +2741,7 @@ 2.3.2.34 E2 NEDD8-conjugating enzyme 2.3.2.35 capsaicin synthase 2.3.2.36 RING-type E3 ubiquitin transferase (cysteine targeting) +2.3.2.37 ergosteryl-3beta-O-L-aspartate synthase 2.3.3.1 citrate (Si)-synthase 2.3.3.2 decylcitrate synthase 2.3.3.3 citrate (Re)-synthase @@ -2758,6 +2763,7 @@ 2.3.3.19 2-phosphonomethylmalate synthase 2.3.3.20 acyl-CoA:acyl-CoA alkyltransferase 2.3.3.21 (R)-citramalate synthase +2.3.3.22 3-carboxymethyl-3-hydroxy-acyl-[ACP] synthase 2.4.1.1 glycogen phosphorylase 2.4.1.2 dextrin dextranase 2.4.1.4 amylosucrase @@ -2863,7 +2869,6 @@ 2.4.1.126 hydroxycinnamate 4-beta-glucosyltransferase 2.4.1.127 monoterpenol beta-glucosyltransferase 2.4.1.128 scopoletin glucosyltransferase -2.4.1.129 peptidoglycan glycosyltransferase 2.4.1.131 GDP-Man:Man3GlcNAc2-PP-dolichol alpha-1,2-mannosyltransferase 2.4.1.132 GDP-Man:Man1GlcNAc2-PP-dolichol alpha-1,3-mannosyltransferase 2.4.1.133 xylosylprotein 4-beta-galactosyltransferase @@ -3115,6 +3120,7 @@ 2.4.1.390 4,3-alpha-glucanotransferase 2.4.1.391 beta-1,2-glucosyltransferase 2.4.1.392 3-O-beta-D-glucopyranosyl-beta-D-glucuronide phosphorylase +2.4.1.393 MMP alpha-(1->4)-mannosyltransferase 2.4.1.n2 loliose synthase 2.4.2.1 purine-nucleoside phosphorylase 2.4.2.2 pyrimidine-nucleoside phosphorylase @@ -3200,6 +3206,9 @@ 2.4.99.23 lipopolysaccharide heptosyltransferase I 2.4.99.24 lipopolysaccharide heptosyltransferase II 2.4.99.25 lipopolysaccharide heptosyltransferase III +2.4.99.26 O-antigen ligase +2.4.99.27 O-antigen polymerase Wzy +2.4.99.28 peptidoglycan glycosyltransferase 2.5.1.1 dimethylallyltranstransferase 2.5.1.2 thiamine pyridinylase 2.5.1.3 thiamine phosphate synthase @@ -3344,6 +3353,7 @@ 2.5.1.154 corrinoid adenosyltransferase EutT 2.5.1.155 phosphoglycerol geranylfarnesyltransferase 2.5.1.156 geranylfarnesylglycerol-phosphate geranylfarnesyltransferase +2.5.1.157 rRNA small subunit aminocarboxypropyltransferase 2.5.1.n9 heptaprenylglyceryl phosphate synthase 2.6.1.1 aspartate transaminase 2.6.1.2 alanine transaminase @@ -3908,7 +3918,6 @@ 2.7.11.24 mitogen-activated protein kinase 2.7.11.25 mitogen-activated protein kinase kinase kinase 2.7.11.26 [tau protein] kinase -2.7.11.27 [acetyl-CoA carboxylase] kinase 2.7.11.28 tropomyosin kinase 2.7.11.29 [low-density-lipoprotein receptor] kinase 2.7.11.30 receptor protein serine/threonine kinase @@ -3916,6 +3925,7 @@ 2.7.11.32 [pyruvate, phosphate dikinase] kinase 2.7.11.33 [pyruvate, water dikinase] kinase 2.7.11.34 NEK6-subfamily protein kinase +2.7.11.35 CRIK-subfamily protein kinase 2.7.12.1 dual-specificity kinase 2.7.12.2 mitogen-activated protein kinase kinase 2.7.13.1 protein-histidine pros-kinase @@ -4008,7 +4018,7 @@ 2.8.4.1 coenzyme-B sulfoethylthiotransferase 2.8.4.2 arsenate-mycothiol transferase 2.8.4.3 tRNA-2-methylthio-N(6)-dimethylallyladenosine synthase -2.8.4.4 [ribosomal protein S12] (aspartate(89)-C(3))-methylthiotransferase +2.8.4.4 [ribosomal protein uS12] (aspartate(89)-C(3))-methylthiotransferase 2.8.4.5 tRNA (N(6)-L-threonylcarbamoyladenosine(37)-C(2))-methylthiotransferase 2.8.4.6 S-methyl-1-thioxylulose 5-phosphate methylthiotransferase 2.8.5.1 S-sulfo-L-cysteine synthase (3-phospho-L-serine-dependent) @@ -4129,6 +4139,7 @@ 3.1.1.117 (4-O-methyl)-D-glucuronate--lignin esterase 3.1.1.118 phospholipid sn-1 acylhydrolase 3.1.1.120 L-fucono-1,5-lactonase +3.1.1.121 ergosteryl-3beta-O-L-aspartate hydrolase 3.1.1.n2 protein-S-isoprenylcysteine alpha-carbonyl methylesterase 3.1.2.1 acetyl-CoA hydrolase 3.1.2.2 palmitoyl-CoA hydrolase @@ -4327,7 +4338,6 @@ 3.1.7.12 (+)-kolavelool synthase 3.1.7.13 neryl diphosphate diphosphatase 3.1.8.1 aryldialkylphosphatase -3.1.8.2 diisopropyl-fluorophosphatase 3.1.11.1 exodeoxyribonuclease I 3.1.11.2 exodeoxyribonuclease III 3.1.11.3 exodeoxyribonuclease (lambda-induced) @@ -4574,6 +4584,7 @@ 3.2.1.217 exo-acting protein-alpha-N-acetylgalactosaminidase 3.2.1.218 alpha-3'-ketoglucosidase 3.2.1.219 palatinase +3.2.1.220 ipecoside beta-D-glucosidase 3.2.1.n1 blood group B branched chain alpha-1,3-galactosidase 3.2.1.n2 blood group B linear chain alpha-1,3-galactosidase 3.2.1.n3 Dictyostelium lysozyme A @@ -4644,6 +4655,7 @@ 3.4.11.24 aminopeptidase S 3.4.11.25 beta-peptidyl aminopeptidase 3.4.11.26 intermediate cleaving peptidase 55 +3.4.11.27 archaeal arginyl aminopeptidase 3.4.13.4 Xaa-Arg dipeptidase 3.4.13.5 Xaa-methyl-His dipeptidase 3.4.13.7 Glu-Glu dipeptidase @@ -4994,6 +5006,7 @@ 3.4.24.89 Pro-Pro endopeptidase 3.4.25.1 proteasome endopeptidase complex 3.4.25.2 HslU--HslV peptidase +3.4.26.1 intramembrane prenyl-peptidase Rce1 3.5.1.1 asparaginase 3.5.1.2 glutaminase 3.5.1.3 omega-amidase @@ -5124,6 +5137,7 @@ 3.5.1.135 N(4)-acetylcytidine amidohydrolase 3.5.1.136 N,N'-diacetylchitobiose non-reducing end deacetylase 3.5.1.137 N-methylcarbamate hydrolase +3.5.1.138 lipoamidase 3.5.1.n3 4-deoxy-4-formamido-L-arabinose-phosphoundecaprenol deformylase 3.5.2.1 barbiturase 3.5.2.2 dihydropyrimidinase @@ -5339,6 +5353,7 @@ 3.8.1.9 (R)-2-haloacid dehalogenase 3.8.1.10 2-haloacid dehalogenase (configuration-inverting) 3.8.1.11 2-haloacid dehalogenase (configuration-retaining) +3.8.2.2 diisopropyl-fluorophosphatase 3.9.1.1 phosphoamidase 3.9.1.2 protein arginine phosphatase 3.9.1.3 phosphohistidine phosphatase @@ -5472,6 +5487,9 @@ 4.1.1.121 3-oxoisoapionate-4-phosphate decarboxylase 4.1.1.122 L-cysteate decarboxylase 4.1.1.123 phenyl-phosphate phosphatase/carboxylase +4.1.1.124 malonyl-[acp] decarboxylase +4.1.1.125 4-carboxy-3-alkylbut-2-enoyl-[ACP] decarboxylase +4.1.1.126 anhydromevalonate phosphate decarboxylase 4.1.2.2 ketotetrose-phosphate aldolase 4.1.2.4 deoxyribose-phosphate aldolase 4.1.2.5 L-threonine aldolase @@ -5524,6 +5542,7 @@ 4.1.2.61 feruloyl-CoA hydratase/lyase 4.1.2.62 5-deoxyribulose 1-phosphate aldolase 4.1.2.63 2-hydroxyacyl-CoA lyase +4.1.2.64 2-dehydro-3-deoxy-L-fuconate aldolase 4.1.3.1 isocitrate lyase 4.1.3.3 N-acetylneuraminate lyase 4.1.3.4 hydroxymethylglutaryl-CoA lyase @@ -5569,6 +5588,7 @@ 4.1.99.25 L-tryptophan isonitrile synthase 4.1.99.26 3-amino-5-[(4-hydroxyphenyl)methyl]-4,4-dimethylpyrrolidin-2-one synthase 4.1.99.27 cyclopenase +4.1.99.28 3'-dehydrocarminate deglycosidase 4.2.1.1 carbonic anhydrase 4.2.1.2 fumarate hydratase 4.2.1.3 aconitate hydratase @@ -5726,6 +5746,8 @@ 4.2.1.178 difructose-dianhydride-III synthase 4.2.1.179 difructose-anhydride-I synthase 4.2.1.180 (E)-benzylidenesuccinyl-CoA hydratase +4.2.1.181 3-carboxymethyl-3-hydroxy-acyl-[ACP] dehydratase +4.2.1.182 phosphomevalonate dehydratase 4.2.2.1 hyaluronate lyase 4.2.2.2 pectate lyase 4.2.2.3 mannuronate-specific alginate lyase @@ -5965,6 +5987,14 @@ 4.2.3.209 (R)-axinyssene synthase 4.2.3.210 lydicene synthase 4.2.3.211 (+)-exo-beta-bergamotene synthase +4.2.3.212 (+)-delta-cadinol synthase +4.2.3.213 colleterpenol synthase +4.2.3.214 dolasta-1(15),8-diene synthase +4.2.3.215 delta-araneosene synthase +4.2.3.216 somaliensene A synthase +4.2.3.217 somaliensene B synthase +4.2.3.218 variediene synthase +4.2.3.219 (2E)-alpha-cericerene synthase 4.2.99.12 carboxymethyloxysuccinate lyase 4.2.99.18 DNA-(apurinic or apyrimidinic site) lyase 4.2.99.20 2-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carboxylate synthase @@ -5972,6 +6002,7 @@ 4.2.99.22 tuliposide A-converting enzyme 4.2.99.23 tuliposide B-converting enzyme 4.2.99.24 thebaine synthase +4.2.99.25 unsaturated pyranuronate lyase 4.3.1.1 aspartate ammonia-lyase 4.3.1.2 methylaspartate ammonia-lyase 4.3.1.3 histidine ammonia-lyase @@ -5999,6 +6030,7 @@ 4.3.1.30 dTDP-4-amino-4,6-dideoxy-D-glucose ammonia-lyase 4.3.1.31 L-tryptophan ammonia lyase 4.3.1.32 7,8-didemethyl-8-hydroxy-5-deazariboflavin synthase +4.3.1.33 (R)-1-hydroxy-2-aminoethylphosphonate ammonia-lyase 4.3.2.1 argininosuccinate lyase 4.3.2.2 adenylosuccinate lyase 4.3.2.3 ureidoglycolate lyase @@ -6123,6 +6155,7 @@ 5.1.1.22 4-hydroxyproline betaine 2-epimerase 5.1.1.23 UDP-N-acetyl-alpha-D-muramoyl-L-alanyl-L-glutamate epimerase 5.1.1.24 histidine racemase +5.1.1.25 N-acetyl-D-glutamate racemase 5.1.2.1 lactate racemase 5.1.2.2 mandelate racemase 5.1.2.3 3-hydroxybutyryl-CoA epimerase @@ -6656,6 +6689,7 @@ 6.6.1.1 magnesium chelatase 6.6.1.2 cobaltochelatase 6.7.1.1 3-amino-2-hydroxy-4-methoxybenzoate diazotase +6.7.1.2 3-aminoavenalumate diazotase 7.1.1.1 proton-translocating NAD(P)(+) transhydrogenase 7.1.1.2 NADH:ubiquinone reductase (H(+)-translocating) 7.1.1.3 ubiquinol oxidase (H(+)-transporting) @@ -6736,6 +6770,7 @@ 7.5.2.11 ABC-type D-galactose transporter 7.5.2.12 ABC-type L-arabinose transporter 7.5.2.13 ABC-type D-xylose/L-arabinose transporter +7.5.2.14 ABC-type homopolymeric O-antigen exporter 7.6.2.1 P-type phospholipid transporter 7.6.2.2 ABC-type xenobiotic transporter 7.6.2.3 ABC-type glutathione-S-conjugate transporter diff --git a/c++/src/objects/seqfeat/institution_codes.inc b/c++/src/objects/seqfeat/institution_codes.inc index 69d27563..b11f9cce 100644 --- a/c++/src/objects/seqfeat/institution_codes.inc +++ b/c++/src/objects/seqfeat/institution_codes.inc @@ -1,4 +1,4 @@ -/* $Id: institution_codes.inc 673294 2023-09-27 13:33:46Z ivanov $ +/* $Id: institution_codes.inc 684362 2024-06-20 19:32:14Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -30,11 +30,11 @@ * */ -/* time_t value corresponding to Tue Sep 26 05:12:02 EDT 2023; formally +/* time_t value corresponding to Thu Jun 13 05:33:04 EDT 2024; formally * expressed as unsigned long so output can stand fully on its own. */ -static const unsigned long kInstitutionCollectionCodeList_Timestamp = 1695719522UL; +static const unsigned long kInstitutionCollectionCodeList_Timestamp = 1718271184UL; static const char* const kInstitutionCollectionCodeList[] = { -"# $Id: institution_codes.inc 673294 2023-09-27 13:33:46Z ivanov $", +"# $Id: institution_codes.inc 684362 2024-06-20 19:32:14Z ivanov $", "A\ts\tArnold Arboretum, Harvard University\t\t\t", "AA\ts\tMinistry of Science, Academy of Sciences\t\t\t", "AAAG\ts\tAlan and Anita Gillogly\t\t\t", @@ -316,6 +316,7 @@ static const char* const kInstitutionCollectionCodeList[] = { "ANWC\ts\tAustralian National Wildlife Collection\t\t\t", "AO\ts\tMuseo Regionale di Scienze Naturali della Valle d'Aosta\t\t\t", "AORI\ts\tAtmosphere and Ocean Research Institute\t\t\t", +"AP\ts\tThe Firefly Museum of Toyota Town\t\t\t", "APCC\tc\tAntarctic Protistan Culture Collection (Woods Hole Oceanographic Institution)\t\t\t", "APCR\ts\tArkansas Tech University, Biological Sciences Department\t\t\t", "APEI\ts\tAgriculture Canada Research Station\t\t\t", @@ -406,13 +407,13 @@ static const char* const kInstitutionCollectionCodeList[] = { "ASYA\tc\tIstanbul Medeniyet University Antarctic Microalgae Culture Collection\t\t\t", "ATA\ts\tAtatuerk UEniversitesi\t\t\t", "ATB\ts\tAging Tissue Bank\t\t\t", -"ATCC\tcb\tAmerican Type Culture Collection\t\thttps://www.atcc.org/Products/All/&spec;.aspx\t", +"ATCC\tscb\tAmerican Type Culture Collection\t\thttps://www.atcc.org/Products/All/&spec;.aspx\t", "ATCH\ts\tChinese Academy of Tropical Agricultural Sciences\t\t\t", "ATH\ts\tGoulandris Natural History Museum\t\t\t", "ATHU\ts\tNational and Kapodistrian University of Athens, Biology Department\t\t\t", "ATHUM\tsc\tATHUM Culture Collection of Fungi\t\t\t", +"ATSC\tb\tAustralian Tree Seed Centre\t\t\t", "ATSC\tb\tAustralian Tree Seed Centre\t\thttps://www.csiro.au/en/about/facilities-collections/collections/atsc\t", -"ATSC\tb\tAustralian Tree Seed Centre\t\t\t", "ATU\tc\tDepartment of of Biotechnology University of Tokyo\t\t\t", "AU\ts\tXiamen University, Biology Department\t\t\t", "AUA\ts\tAuburn University, Biological Sciences Department\t\t\t", @@ -521,6 +522,7 @@ static const char* const kInstitutionCollectionCodeList[] = { "BBS\ts\tUniversity of Suriname\t\t\t", "BBSL\ts\tBee Biology and Systematics Laboratory\t\t\t", "BBSUK\ts\tNational Museum and Gallery, Department of Biodiversity and Systematic Biology\t\t\t", +"BC\ts\tBiospelological Collection\t\t\t", "BC\ts\tInstitut Botanic de Barcelona\t\t\t", "BCAC\tsc\tBashkortostan Collection of Algae and Cyanobacteria\t\t\t", "BCB\ts\tUniversitat Autonoma de Barcelona, Unitat de Botanica\t\t\t", @@ -655,6 +657,7 @@ static const char* const kInstitutionCollectionCodeList[] = { "BIE\ts\tInstituto di Entomologia\t\t\t", "BIEL\ts\tUniversitaet Bielefeld, Abteilung OEkologie\t\t\t", "BIGU\ts\tUniversidad de San Carlos de Guatemala, Departamento de Botanica\t\t\t", +"BIHM\ts\tBihoro Museum\t\t\t", "BIL\ts\tForest Research Institute, Natural Forest Department\t\t\t", "BILAS\ts\tInstitute of Botany\t\t\t", "BIM\ts\tBirmingham Natural History and Microscopical Society\t\t\t", @@ -1037,6 +1040,7 @@ static const char* const kInstitutionCollectionCodeList[] = { "CBRA\ts\tCraveri Civic Museum of Natural History\t\t\t", "CBS\tsc\tWesterdijk Fungal Biodiversity Institute\t\thttps://wi.knaw.nl/page/fungal_display/name/CBS%20\t", "CBSIZA\ts\tCaspian Biological Station Institute of Zoology\t\t\t", +"CBSS\ts\tCroatian Biospeleological Society\t\t\t", "CBTCCCAS\tc\tThe Cell Bank of Type Culture Collection of Chinese Academy of Sciences\t\t\t", "CBU\ts\tCape Breton University\t\t\t", "CBU\ts\tChungbuk National University, School of Life Science\t\t\t", @@ -1423,6 +1427,7 @@ static const char* const kInstitutionCollectionCodeList[] = { "CMUT\ts\tChiang Mai University\t\t\t", "CMV\ts\tCentre Marie-Victorin\t\t\t", "CMW\tc\tForestry and Agricultural Biotechnology Institute, University of Pretoria, Pretoria\t\t\t", +"CMW-IA\tc\tCulture collection of Innovation Africa at the University of Pretoria\t\t\t", "CMY\ts\tR. G. Kar Medical College, Botany Department\t\t\t", "CN\tc\tChina Collection of Anaerobic Microorganisms\t\t\t", "CN\ts\tUniversite de Caen\t\t\t", @@ -1557,7 +1562,11 @@ static const char* const kInstitutionCollectionCodeList[] = { "CRCA\ts\tInstituto dos Cereais\t\t\t", "CRCM\ts\tWashington State University, Charles R. Conner Museum\t\t\t", "CRCM:Bird\ts\tWashington State University, Charles R. Conner Museum, bird collection\t\t\t", -"CRCM:Mammal\ts\tWashington State University, Charles R. Conner Museum, Mammal Collection\t\t\t", +"CRCM:Fish\ts\tFish collection\t\t\t", +"CRCM:Herp\ts\tHerpetology Collection\t\t\t", +"CRCM:Mamm\ts\tWashington State University, Charles R. Conner Museum, Mammal Collection\t\t\t", +"CRCM:Paleo\ts\tFossil Collection (Misc Vertebrates)\t\t\t", +"CRCM:Teach\ts\tTeaching Collection (Misc Vertebrates)\t\t\t", "CRD\ts\tInstituto Politecnico Nacional, Coleccion Cientifica de Fauna Silvestre (Mexico)\t\t\t", "CRE\ts\tUniversity of Southern California\t\t\t", "CREA-AA\tc\tConsiglio per la ricerca in agricoltura e lanalisi delleconomia agraria - Centro di Ricerca Agricoltura e Ambiente\tCRA-CIN\t\t", @@ -3390,7 +3399,7 @@ static const char* const kInstitutionCollectionCodeList[] = { "IIES\ts\tInstituto Investigaciones Entomologicas Salta\t\t\t", "IITA\tb\tInternational Institute of Tropical Agriculture\t\t\t", "IJ\ts\tInstitute of Jamaica\t\t\t", -"IJFM\tc\tInstituto ?Jaime Ferran? de Microbiologia Consejo Superior de Investigaciones Cientificas\t\t\t", +"IJFM\tc\tInstituto 'Jaime Ferran' de Microbiologia Consejo Superior de Investigaciones Cientificas\t\t\t", "IJSM\ts\tInstitute of Jamaica, Natural History Museum\t\t\t", "IK\ts\tZoological Institute, Ukrainian Academy of Sciences\t\t\t", "ILCA\ts\tInternational Livestock Research Institute\t\t\t", @@ -4076,8 +4085,10 @@ static const char* const kInstitutionCollectionCodeList[] = { "KUO\ts\tKuopio Natural History Museum\t\t\t", "KURS\ts\tKursk State University, Department of Botany\t\t\t", "KUS\ts\tKorea University, Biology Department\t\t\t", +"KUST\ts\tKohat University of Science and Technology\t\t\t", "KUU\ts\tUniversity of Science and Technology\t\t\t", "KUW\ts\tKakatiya University\t\t\t", +"KUZ\ts\tKuzbas Botanical Garden\t\t\t", "KUZ\ts\tZoological Collection of the Kyoto University\t\t\t", "KUZC\ts\tKyushu University, Zoological Collection\t\t\t", "KVCH\ts\tKivach Nature Reserve\t\t\t", @@ -4220,6 +4231,7 @@ static const char* const kInstitutionCollectionCodeList[] = { "LGBH\ts\tLoughborough Public Library\t\t\t", "LGC\ts\tLaboratorio de Genetica da Conservacao\t\t\t", "LGCC\ts\tLouis G. Gentner [deceased]\t\t\t", +"LGE\ts\tLaboratorio de Genetica Evolutiva\t\t\t", "LGEMA\ts\tLaboratorio de Genetica e Evolucao Molecular de Aves, Universidade de Sao Paulo\t\t\t", "LGHF\ts\tUniversite de Liege\t\t\t", "LGICT\ts\tLaboratoire de Geologie de l'Institut Catholique de Toulouse\t\t\t", @@ -4364,7 +4376,7 @@ static const char* const kInstitutionCollectionCodeList[] = { "LSP\ts\tLake Superior Provincial Park\t\t\t", "LSR\ts\tLeicestershire Museums Service\t\t\t", "LSRFC\ts\tLeicestershire Flora Committee\t\t\t", -"LSSC\ts\tLake Superior State College\t\t\t", +"LSSU\ts\tLake Superior State University\t\t\t", "LSTM\tc\tDepartment of Parasitology\t\t\t", "LSU\ts\tLouisiana State University, Biological Sciences Department\tLSUM\t\t", "LSUA\ts\tLouisiana State University of Alexandria\t\t\t", @@ -5215,6 +5227,8 @@ static const char* const kInstitutionCollectionCodeList[] = { "MURU\ts\tMurdoch University\t\t\t", "MUS\ts\tMuskingum College, Biology Department\t\t\t", "MUSA\ts\tUniversidad Nacional de San Agustin, Museo de Historia Natural (Peru)\t\t\t", +"MUSENUV\ts\tMuseum of Entomology of the University of Valle in Cali\t\t\t", +"MUSENUV:Anopheles\ts\tMuseum of Entomology of the University of Valle in Cali\t\t\t", "MUSK\ts\tMuskegon Community College, Life Science Department\t\t\t", "MUSM\ts\tMuseo de Historia Natural de la Universidad Nacional Mayor de San Marcos en Lima\t\t\t", "MUSN\ts\tMuseo Universitario di Storia Naturale e della Strumentazione Scientifica\t\t\t", @@ -5266,6 +5280,7 @@ static const char* const kInstitutionCollectionCodeList[] = { "MZAH\ts\tM.Zaman Aquatic Herbarium Rajshahi University\t\t\t", "MZB\ts\tMuseum Zoologicum Bogoriense\t\t\t", "MZB:Amp\ts\tMuseum Zoologicum Bogoriense, Amphibian Collection\t\t\t", +"MZB:Cru\ts\tMuseum Zoologicum Bogoriense, Crustacean Collection\t\t\t", "MZB:Lace\ts\tMuseum Zoologicum Bogoriense, Lizard Collection\t\t\t", "MZB:Ornith\ts\tMuseum Zoologicum Bogoriense, Ornithology Collection\t\t\t", "MZBL\ts\tMuseo de Zoologica\t\t\t", @@ -5279,6 +5294,7 @@ static const char* const kInstitutionCollectionCodeList[] = { "MZH\ts\tZoolgical Museum, Finnish Museum of Natural History\t\t\t", "MZKI\tc\tMicrobial Culture Collection of National Institute of Chemistry\t\t\t", "MZL\ts\tMusee cantonal de zoologie\tMZLS\t\t", +"MZLL\ts\tMuseo di Zoologia \"Lidia Liaci\"\t\t\t", "MZLU\ts\tLund University Museum\t\t\t", "MZMU\ts\tDepartmental Museum of Zoology, Mizoram University\t\t\t", "MZN\ts\tMusee Zoologie\t\t\t", @@ -5535,7 +5551,7 @@ static const char* const kInstitutionCollectionCodeList[] = { "NIAID\tc\tNational Institute of Allergy and Infectious Diseases\t\t\t", "NIAS\tsb\tNational Institute of Agrobiological Sciences\t\t\t", "NIBH\tc\tNational Institute of Bioscience and Human-Technology\t\t\t", -"NIBR\tscb\tNational Institute of Biological Resources\tNNIBR\t\t", +"NIBR\tscb\tNakdonggang National Institute of Biologicul Resources\t\t\t", "NIBSC\tb\tNational Institute for Biological Standards and Control\t\t\t", "NICC\ts\tNational Insect Collection\t\t\t", "NICD\ts\tMalaria Research Center\t\t\t", @@ -5671,7 +5687,10 @@ static const char* const kInstitutionCollectionCodeList[] = { "NMTT\ts\tNational Museum and Art Gallery, Port-of-Spain\t\t\t", "NMU\ts\tNorthern Michigan University Museum of Zoology\t\t\t", "NMU:Bird\ts\tNorthern Michigan University Museum of Zoology, NMU Bird Collection\t\t\t", +"NMU:Herb\ts\tNorthern Michigan University Museum of Zoology, NMU Herbarium collection\t\t\t", +"NMU:Herp\ts\tNorthern Michigan University Museum of Zoology, NMU Herpetology Collection\t\t\t", "NMU:Mamm\ts\tNorthern Michigan University Museum of Zoology, NMU Mammal Collection\t\t\t", +"NMU:Para\ts\tNorthern Michigan University Museum of Zoology, NMU Parasite collection\t\t\t", "NMV\ts\tMuseum Victoria\tNMM\t\t", "NMV:A\ts\tMuseum Victoria, Ichthyology\tNMV:A,NMVA\t\t", "NMV:AV\ts\tMuseum Victoria, Entomology - Australian Voucher Specimens\tNMV:AV,NMVAV\t\t", @@ -5797,6 +5816,7 @@ static const char* const kInstitutionCollectionCodeList[] = { "NSWGS\ts\tGeological Survey of New South Wales\t\t\t", "NSYU\ts\tNational Sun Yat-sen University\t\t\t", "NT\ts\tDepartment of Natural Resources, Environment and the Arts\tDNA\t\t", +"NTCC\tc\tNational Type Culture Collection\t\t\t", "NTCCI\tc\tCulture Collection, Microbiology and Cell Biology Laboratory\t\t\t", "NTDPIF\ts\tNorthern Territory Department of Primary Industry and Fisheries\t\t\t", "NTLN\ts\tCounty Record Office, County Archives Department\t\t\t", @@ -6369,9 +6389,8 @@ static const char* const kInstitutionCollectionCodeList[] = { "QIMR\ts\tQueensland Institute of Medical Research\t\t\t", "QK\ts\tFowler Herbarium Queen's University\t\t\t", "QL\ts\tQinling National Botanical Garden\t\t\t", -"QM\ts\tQueensland Museum\tQMB\t\t", -"QM\ts\tU.S. Army Natick Research and Development Center\t\t\t", -"QMB\ts\tQueensland Museum, Brisbane\tQM\t\t", +"QM\ts\tQueensland Museum\t\t\t", +"QMB\ts\tQueensland Museum, Brisbane\t\t\t", "QMC\ts\tQueen Mary College\t\t\t", "QMEX\ts\tUniversidad Autonoma de Queretaro, Centro Universitario\t\t\t", "QMOR\ts\tCollection Entomologique Ouellet-Robert\t\t\t", @@ -6502,6 +6521,7 @@ static const char* const kInstitutionCollectionCodeList[] = { "RIBM\tc\tResearch Institute for Brewing and Malting\t\t\t", "RICK\ts\tBrigham Young University - Idaho\t\t\t", "RICP\tc\tCrop Research Institute\t\t\t", +"RIEAFO\ts\tResearch Institute of Environment, Agriculture and Fisheries, Osaka Prefecture\t\t\t", "RIFAV\tb\tResearch Institute for Fruits and Vegetables\t\t\t", "RIFFL\ts\tResearch Institute of Freshwater Fisheries\t\t\t", "RIFY\tc\tInstitute of Enology and Viticulture, Yamanashi University\t\t\t", @@ -6970,7 +6990,7 @@ static const char* const kInstitutionCollectionCodeList[] = { "SJFM\ts\tFairbanks Museum and Planetarium\t\t\t", "SJNM\ts\tSan Juan College\t\t\t", "SJPC\ts\tSergei J. Paramonov personal collection -- destroyed\t\t\t", -"SJRP\ts\tUNESP, Campus Sao Jose Rio Preto, Departamento Zoologia e Botanica\t\t\t", +"SJRP\tsc\tUNESP, Campus Sao Jose Rio Preto, Departamento Zoologia e Botanica\t\t\t", "SJSC\ts\tSan Jose State University, J. Gordon Edwards Museum of Entomology\t\t\t", "SJSU\ts\tSan Jose State University, Biological Sciences Department\t\t\t", "SJUBC\ts\tSaint John's University, Biology Collections\t\t\t", @@ -7531,6 +7551,7 @@ static const char* const kInstitutionCollectionCodeList[] = { "THIB\ts\tNicholls State University, Department of Biological Sciences\t\t\t", "THIM\ts\tNational Biodiversity Centre\t\t\t", "THL\ts\tGrierson Museum\t\t\t", +"THM\ts\tToyota Hotaru Museum\t\t\t", "THO\ts\tRobert Dick Museum Library\t\t\t", "THRI\ts\tSequoia and Kings Canyon National Parks\t\t\t", "THS\ts\tTsumura Laboratory\t\t\t", @@ -7662,7 +7683,7 @@ static const char* const kInstitutionCollectionCodeList[] = { "TSNIGRI\ts\tTsentralny Nauchno-Issledovatelskii Geolgo-Razvedochni Muzei(Chernyshev?s Central Museum of Geological Exploration)\t\t\t", "TSSMC\ts\tTeton Science School\t\t\t", "TSTN\ts\tTroston Hall\t\t\t", -"TSU\ts\tMiye University\t\t\t", +"TSU\ts\tMie University\t\t\t", "TSY\tc\tLaboratory of Mycology, Division of Microbiology\t\t\t", "TTC\ts\tTexas Tech University, Biological Sciences Department\t\t\t", "TTCC\ts\tTexas Tech University\t\t\t", @@ -7740,6 +7761,8 @@ static const char* const kInstitutionCollectionCodeList[] = { "UABCS\ts\tUniversidad Nacional Autonoma de Baja California Sur (Mexico)\t\t\t", "UABD\ts\tUniversity of Alabama\t\t\t", "UAC\ts\tUniversity of Calgary, Department of Biological Sciences\t\t\t", +"UAC\ts\tUniversity of the Azores\t\t\t", +"UAC:DTP\ts\tDalberto Teixeira Pombo Arthropod Collection, University of the Azores\t\t\t", "UACC\ts\tUniveridad Autonoma de Chapingo\t\t\t", "UACCC\tc\tUniversity of Alabama Chytrid Culture Collection\tUA-SEC\t\t", "UADBA\ts\tUniversite d?Antananarivo, Departement de Biologie Animale\t\t\t", @@ -7920,8 +7943,8 @@ static const char* const kInstitutionCollectionCodeList[] = { "UFRJ\ts\tDepartramento de Zoologia, Universidade Federal do Rio de Janeiro\t\t\t", "UFRJ:POR\ts\tDepartramento de Zoologia, Universidade Federal do Rio de Janeiro, Porifera collection\tUFRJ:POR,UFRJPOR\t\t", "UFRJIM\tc\tDepartamento de Microbiologia Medica\t\t\t", -"UFRN \ts\tUniversidade Federal do Rio Grande do Norte\tUFRN\t\t", -"UFRN :Fungos\ts\tUniversidade Federal do Rio Grande do Norte , Fungal collection\tUFRN :FungosFungos\t\t", +"UFRN \ts\tUniversidade Federal do Rio Grande do Norte\t\t\t", +"UFRN:Fungos\ts\tUniversidade Federal do Rio Grande do Norte, Fungal collection\tUFRN :FungosFungos\t\t", "UFROH\ts\tUniversidad de La Frontera\t\t\t", "UFRPE\ts\tUniversidade Federal Rural de Pernambuco\t\t\t", "UFRR\ts\tUniversidade Federal de Roraima\t\t\t", @@ -7989,6 +8012,7 @@ static const char* const kInstitutionCollectionCodeList[] = { "ULV\ts\tUniversidad Central de Las Villas\t\t\t", "UM\ts\tUman National University of Horticulture\t\t\t", "UMA\ts\tUniversity of Massachusetts, Museum of Zoology\t\t\t", +"UMACI\ts\tUniversidade da Madeira Colecoes de Insectos\t\t\t", "UMAN\ts\tUniversity of Manitoba, Zoological Collection\t\t\t", "UMB\ts\tUbersee-Museums\tUMBB\t\t", "UMBB\ts\tUbersee-Museum, University of Bremen\tUMB\t\t", @@ -8029,6 +8053,8 @@ static const char* const kInstitutionCollectionCodeList[] = { "UMNH:Bird\ts\tUtah Museum of Natural History, Birds collection\t\t\t", "UMNH:HERP\ts\tUtah Museum of Natural History, Herpetology collection\t\t\t", "UMNH:Mamm\ts\tUtah Museum of Natural History, Mammal collection\t\t\t", +"UMNH:UT (Botany)\ts\tUtah Natural History Museum\t\t\t", +"UMNH:UT-M (Mycology)\ts\tUtah Natural History Museum\t\t\t", "UMO\ts\tUniversity Museum of Natural History\t\t\t", "UMO\ts\tUniversity of Maine\tUMDE\t\t", "UMO\ts\tDunn-Palmer Herbarium, University of Missouri, Museum Support Center\t\t\t", diff --git a/c++/src/objects/seqfeat/institution_codes.txt b/c++/src/objects/seqfeat/institution_codes.txt index a37e0df7..4ba3f544 100644 --- a/c++/src/objects/seqfeat/institution_codes.txt +++ b/c++/src/objects/seqfeat/institution_codes.txt @@ -1,4 +1,4 @@ -# $Id: institution_codes.txt 673294 2023-09-27 13:33:46Z ivanov $ +# $Id: institution_codes.txt 684362 2024-06-20 19:32:14Z ivanov $ A s Arnold Arboretum, Harvard University AA s Ministry of Science, Academy of Sciences AAAG s Alan and Anita Gillogly @@ -280,6 +280,7 @@ ANVL s Association des Naturalistes de la Vallee du Loing et du Massif de Fontai ANWC s Australian National Wildlife Collection AO s Museo Regionale di Scienze Naturali della Valle d'Aosta AORI s Atmosphere and Ocean Research Institute +AP s The Firefly Museum of Toyota Town APCC c Antarctic Protistan Culture Collection (Woods Hole Oceanographic Institution) APCR s Arkansas Tech University, Biological Sciences Department APEI s Agriculture Canada Research Station @@ -370,13 +371,13 @@ ASW c Culture Collection of Algae at the University of Vienna ASYA c Istanbul Medeniyet University Antarctic Microalgae Culture Collection ATA s Atatuerk UEniversitesi ATB s Aging Tissue Bank -ATCC cb American Type Culture Collection https://www.atcc.org/Products/All/&spec;.aspx +ATCC scb American Type Culture Collection https://www.atcc.org/Products/All/&spec;.aspx ATCH s Chinese Academy of Tropical Agricultural Sciences ATH s Goulandris Natural History Museum ATHU s National and Kapodistrian University of Athens, Biology Department ATHUM sc ATHUM Culture Collection of Fungi +ATSC b Australian Tree Seed Centre ATSC b Australian Tree Seed Centre https://www.csiro.au/en/about/facilities-collections/collections/atsc -ATSC b Australian Tree Seed Centre ATU c Department of of Biotechnology University of Tokyo AU s Xiamen University, Biology Department AUA s Auburn University, Biological Sciences Department @@ -485,6 +486,7 @@ BBPP c Bacteriology Branch, Plant Pathology and Microbiology Division, Departmen BBS s University of Suriname BBSL s Bee Biology and Systematics Laboratory BBSUK s National Museum and Gallery, Department of Biodiversity and Systematic Biology +BC s Biospelological Collection BC s Institut Botanic de Barcelona BCAC sc Bashkortostan Collection of Algae and Cyanobacteria BCB s Universitat Autonoma de Barcelona, Unitat de Botanica @@ -619,6 +621,7 @@ BIDA s Boise State University BIE s Instituto di Entomologia BIEL s Universitaet Bielefeld, Abteilung OEkologie BIGU s Universidad de San Carlos de Guatemala, Departamento de Botanica +BIHM s Bihoro Museum BIL s Forest Research Institute, Natural Forest Department BILAS s Institute of Botany BIM s Birmingham Natural History and Microscopical Society @@ -1001,6 +1004,7 @@ CBPM s Fundacao Oswaldo Cruz - FIOCRUZ (Oswaldo Cruz Foundation) CBRA s Craveri Civic Museum of Natural History CBS sc Westerdijk Fungal Biodiversity Institute https://wi.knaw.nl/page/fungal_display/name/CBS%20 CBSIZA s Caspian Biological Station Institute of Zoology +CBSS s Croatian Biospeleological Society CBTCCCAS c The Cell Bank of Type Culture Collection of Chinese Academy of Sciences CBU s Cape Breton University CBU s Chungbuk National University, School of Life Science @@ -1387,6 +1391,7 @@ CMUH s Central Mindanao University CMUT s Chiang Mai University CMV s Centre Marie-Victorin CMW c Forestry and Agricultural Biotechnology Institute, University of Pretoria, Pretoria +CMW-IA c Culture collection of Innovation Africa at the University of Pretoria CMY s R. G. Kar Medical College, Botany Department CN c China Collection of Anaerobic Microorganisms CN s Universite de Caen @@ -1521,7 +1526,11 @@ CRC c Chlamydomonas Resource Center CRCA s Instituto dos Cereais CRCM s Washington State University, Charles R. Conner Museum CRCM:Bird s Washington State University, Charles R. Conner Museum, bird collection -CRCM:Mammal s Washington State University, Charles R. Conner Museum, Mammal Collection +CRCM:Fish s Fish collection +CRCM:Herp s Herpetology Collection +CRCM:Mamm s Washington State University, Charles R. Conner Museum, Mammal Collection +CRCM:Paleo s Fossil Collection (Misc Vertebrates) +CRCM:Teach s Teaching Collection (Misc Vertebrates) CRD s Instituto Politecnico Nacional, Coleccion Cientifica de Fauna Silvestre (Mexico) CRE s University of Southern California CREA-AA c Consiglio per la ricerca in agricoltura e lanalisi delleconomia agraria - Centro di Ricerca Agricoltura e Ambiente CRA-CIN @@ -3354,7 +3363,7 @@ IID c Laboratory Culture Collection IIES s Instituto Investigaciones Entomologicas Salta IITA b International Institute of Tropical Agriculture IJ s Institute of Jamaica -IJFM c Instituto ?Jaime Ferran? de Microbiologia Consejo Superior de Investigaciones Cientificas +IJFM c Instituto 'Jaime Ferran' de Microbiologia Consejo Superior de Investigaciones Cientificas IJSM s Institute of Jamaica, Natural History Museum IK s Zoological Institute, Ukrainian Academy of Sciences ILCA s International Livestock Research Institute @@ -4040,8 +4049,10 @@ KUNE s Kunming Institute of Ecology, Academia Sinica KUO s Kuopio Natural History Museum KURS s Kursk State University, Department of Botany KUS s Korea University, Biology Department +KUST s Kohat University of Science and Technology KUU s University of Science and Technology KUW s Kakatiya University +KUZ s Kuzbas Botanical Garden KUZ s Zoological Collection of the Kyoto University KUZC s Kyushu University, Zoological Collection KVCH s Kivach Nature Reserve @@ -4184,6 +4195,7 @@ LGBG s Lewis Ginter Botanical Garden LGBH s Loughborough Public Library LGC s Laboratorio de Genetica da Conservacao LGCC s Louis G. Gentner [deceased] +LGE s Laboratorio de Genetica Evolutiva LGEMA s Laboratorio de Genetica e Evolucao Molecular de Aves, Universidade de Sao Paulo LGHF s Universite de Liege LGICT s Laboratoire de Geologie de l'Institut Catholique de Toulouse @@ -4328,7 +4340,7 @@ LSN s Lord Wandsworth College Natural History Museum LSP s Lake Superior Provincial Park LSR s Leicestershire Museums Service LSRFC s Leicestershire Flora Committee -LSSC s Lake Superior State College +LSSU s Lake Superior State University LSTM c Department of Parasitology LSU s Louisiana State University, Biological Sciences Department LSUM LSUA s Louisiana State University of Alexandria @@ -5179,6 +5191,8 @@ MURD s Murdoch University MURU s Murdoch University MUS s Muskingum College, Biology Department MUSA s Universidad Nacional de San Agustin, Museo de Historia Natural (Peru) +MUSENUV s Museum of Entomology of the University of Valle in Cali +MUSENUV:Anopheles s Museum of Entomology of the University of Valle in Cali MUSK s Muskegon Community College, Life Science Department MUSM s Museo de Historia Natural de la Universidad Nacional Mayor de San Marcos en Lima MUSN s Museo Universitario di Storia Naturale e della Strumentazione Scientifica @@ -5230,6 +5244,7 @@ MZAF s Museo Zoologico dell'Accademia dei Fisiocritici MZAH s M.Zaman Aquatic Herbarium Rajshahi University MZB s Museum Zoologicum Bogoriense MZB:Amp s Museum Zoologicum Bogoriense, Amphibian Collection +MZB:Cru s Museum Zoologicum Bogoriense, Crustacean Collection MZB:Lace s Museum Zoologicum Bogoriense, Lizard Collection MZB:Ornith s Museum Zoologicum Bogoriense, Ornithology Collection MZBL s Museo de Zoologica @@ -5243,6 +5258,7 @@ MZGZ s Museum Zoologia del Giardino Zoologico MZH s Zoolgical Museum, Finnish Museum of Natural History MZKI c Microbial Culture Collection of National Institute of Chemistry MZL s Musee cantonal de zoologie MZLS +MZLL s Museo di Zoologia "Lidia Liaci" MZLU s Lund University Museum MZMU s Departmental Museum of Zoology, Mizoram University MZN s Musee Zoologie @@ -5499,7 +5515,7 @@ NIAH c National Institute of Animal Health NIAID c National Institute of Allergy and Infectious Diseases NIAS sb National Institute of Agrobiological Sciences NIBH c National Institute of Bioscience and Human-Technology -NIBR scb National Institute of Biological Resources NNIBR +NIBR scb Nakdonggang National Institute of Biologicul Resources NIBSC b National Institute for Biological Standards and Control NICC s National Insect Collection NICD s Malaria Research Center @@ -5635,7 +5651,10 @@ NMTC s Inner Mongolia Normal University, Biology Department NMTT s National Museum and Art Gallery, Port-of-Spain NMU s Northern Michigan University Museum of Zoology NMU:Bird s Northern Michigan University Museum of Zoology, NMU Bird Collection +NMU:Herb s Northern Michigan University Museum of Zoology, NMU Herbarium collection +NMU:Herp s Northern Michigan University Museum of Zoology, NMU Herpetology Collection NMU:Mamm s Northern Michigan University Museum of Zoology, NMU Mammal Collection +NMU:Para s Northern Michigan University Museum of Zoology, NMU Parasite collection NMV s Museum Victoria NMM NMV:A s Museum Victoria, Ichthyology NMV:A,NMVA NMV:AV s Museum Victoria, Entomology - Australian Voucher Specimens NMV:AV,NMVAV @@ -5761,6 +5780,7 @@ NSWF s State Forests of New South Wales NSWGS s Geological Survey of New South Wales NSYU s National Sun Yat-sen University NT s Department of Natural Resources, Environment and the Arts DNA +NTCC c National Type Culture Collection NTCCI c Culture Collection, Microbiology and Cell Biology Laboratory NTDPIF s Northern Territory Department of Primary Industry and Fisheries NTLN s County Record Office, County Archives Department @@ -6333,9 +6353,8 @@ QIBX s Qinghai Institute of Biology QIMR s Queensland Institute of Medical Research QK s Fowler Herbarium Queen's University QL s Qinling National Botanical Garden -QM s Queensland Museum QMB -QM s U.S. Army Natick Research and Development Center -QMB s Queensland Museum, Brisbane QM +QM s Queensland Museum +QMB s Queensland Museum, Brisbane QMC s Queen Mary College QMEX s Universidad Autonoma de Queretaro, Centro Universitario QMOR s Collection Entomologique Ouellet-Robert @@ -6466,6 +6485,7 @@ RIB c National Research Institute of Brewing, Tax Administration Agency RIBM c Research Institute for Brewing and Malting RICK s Brigham Young University - Idaho RICP c Crop Research Institute +RIEAFO s Research Institute of Environment, Agriculture and Fisheries, Osaka Prefecture RIFAV b Research Institute for Fruits and Vegetables RIFFL s Research Institute of Freshwater Fisheries RIFY c Institute of Enology and Viticulture, Yamanashi University @@ -6934,7 +6954,7 @@ SJER s United States Forest Service, San Joaquin Experimental Range SJFM s Fairbanks Museum and Planetarium SJNM s San Juan College SJPC s Sergei J. Paramonov personal collection -- destroyed -SJRP s UNESP, Campus Sao Jose Rio Preto, Departamento Zoologia e Botanica +SJRP sc UNESP, Campus Sao Jose Rio Preto, Departamento Zoologia e Botanica SJSC s San Jose State University, J. Gordon Edwards Museum of Entomology SJSU s San Jose State University, Biological Sciences Department SJUBC s Saint John's University, Biology Collections @@ -7495,6 +7515,7 @@ THDC s Thomas H. Davies THIB s Nicholls State University, Department of Biological Sciences THIM s National Biodiversity Centre THL s Grierson Museum +THM s Toyota Hotaru Museum THO s Robert Dick Museum Library THRI s Sequoia and Kings Canyon National Parks THS s Tsumura Laboratory @@ -7626,7 +7647,7 @@ TSMHN s Teylers Strichtina Museum TSNIGRI s Tsentralny Nauchno-Issledovatelskii Geolgo-Razvedochni Muzei(Chernyshev?s Central Museum of Geological Exploration) TSSMC s Teton Science School TSTN s Troston Hall -TSU s Miye University +TSU s Mie University TSY c Laboratory of Mycology, Division of Microbiology TTC s Texas Tech University, Biological Sciences Department TTCC s Texas Tech University @@ -7704,6 +7725,8 @@ UABC s Universidad Autonoma de Baja California UABCS s Universidad Nacional Autonoma de Baja California Sur (Mexico) UABD s University of Alabama UAC s University of Calgary, Department of Biological Sciences +UAC s University of the Azores +UAC:DTP s Dalberto Teixeira Pombo Arthropod Collection, University of the Azores UACC s Univeridad Autonoma de Chapingo UACCC c University of Alabama Chytrid Culture Collection UA-SEC UADBA s Universite d?Antananarivo, Departement de Biologie Animale @@ -7884,8 +7907,8 @@ UFRJ sc Herbario e Colecao Fitopathologica "Verlande Duarte Silveira" UFRJ s Departramento de Zoologia, Universidade Federal do Rio de Janeiro UFRJ:POR s Departramento de Zoologia, Universidade Federal do Rio de Janeiro, Porifera collection UFRJ:POR,UFRJPOR UFRJIM c Departamento de Microbiologia Medica -UFRN s Universidade Federal do Rio Grande do Norte UFRN -UFRN :Fungos s Universidade Federal do Rio Grande do Norte , Fungal collection UFRN :FungosFungos +UFRN s Universidade Federal do Rio Grande do Norte +UFRN:Fungos s Universidade Federal do Rio Grande do Norte, Fungal collection UFRN :FungosFungos UFROH s Universidad de La Frontera UFRPE s Universidade Federal Rural de Pernambuco UFRR s Universidade Federal de Roraima @@ -7953,6 +7976,7 @@ ULT s Al-Faateh University, Botany Department ULV s Universidad Central de Las Villas UM s Uman National University of Horticulture UMA s University of Massachusetts, Museum of Zoology +UMACI s Universidade da Madeira Colecoes de Insectos UMAN s University of Manitoba, Zoological Collection UMB s Ubersee-Museums UMBB UMBB s Ubersee-Museum, University of Bremen UMB @@ -7993,6 +8017,8 @@ UMNH s Utah Museum of Natural History UMNH:Bird s Utah Museum of Natural History, Birds collection UMNH:HERP s Utah Museum of Natural History, Herpetology collection UMNH:Mamm s Utah Museum of Natural History, Mammal collection +UMNH:UT (Botany) s Utah Natural History Museum +UMNH:UT-M (Mycology) s Utah Natural History Museum UMO s University Museum of Natural History UMO s University of Maine UMDE UMO s Dunn-Palmer Herbarium, University of Missouri, Museum Support Center diff --git a/c++/src/objects/seqloc/Seq_id.cpp b/c++/src/objects/seqloc/Seq_id.cpp index 0f2c28e0..7ce2c38d 100644 --- a/c++/src/objects/seqloc/Seq_id.cpp +++ b/c++/src/objects/seqloc/Seq_id.cpp @@ -1,4 +1,4 @@ -/* $Id: Seq_id.cpp 666463 2023-04-26 15:21:25Z grichenk $ +/* $Id: Seq_id.cpp 681844 2024-04-15 19:26:05Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -1835,7 +1835,8 @@ CSeq_id::EAccessionInfo CSeq_id::IdentifyAccession(TParseFlags flags) const E_Choice type = Which(); switch (type) { case e_Pir: case e_Swissprot: case e_Prf: // but *NOT* e_Pdb - return (EAccessionInfo)(type | fAcc_prot); // always just protein + // always just protein + return (EAccessionInfo)((EAccessionInfo)type | fAcc_prot); case e_Genbank: case e_Embl: case e_Ddbj: case e_Tpg: case e_Tpe: case e_Tpd: @@ -2744,9 +2745,9 @@ CSeq_id::E_Choice CSeq_id::x_Init(list& fasta_pieces, || fasta_pieces.front().size() == 3) && ((next_type = WhichInverseSeqId(fasta_pieces.front())) != e_not_set)) { - // Likely mid-string optional-field omission; - // conservatively treat as such only if unable to - // parse the following piece as an ID type, though. + // Likely mid-string optional-field omission; look ahead + // more to see whether the piece works better as a field + // or a tag. list::iterator it = fasta_pieces.begin(); ++it; _ASSERT(it != fasta_pieces.end()); @@ -2754,6 +2755,9 @@ CSeq_id::E_Choice CSeq_id::x_Init(list& fasta_pieces, if ((it->size() == 2 || it->size() == 3) && (next_type_2 = WhichInverseSeqId(*it)) != e_not_set) { next_type = next_type_2; + } else if (it->find_first_not_of(" \t\n") == NPOS + && ++it == fasta_pieces.end()) { + next_type = e_not_set; } else { break; } diff --git a/c++/src/objects/seqloc/accguide.txt b/c++/src/objects/seqloc/accguide.txt index c480c6f7..9be8871b 100644 --- a/c++/src/objects/seqloc/accguide.txt +++ b/c++/src/objects/seqloc/accguide.txt @@ -1,4 +1,4 @@ -# $Id: accguide.txt 673909 2023-10-12 19:49:33Z ivanov $ +# $Id: accguide.txt 684361 2024-06-20 19:31:00Z ivanov $ version 1 # of file format # three-letter-prefix protein accessions (traditionally with five digits) @@ -40,7 +40,7 @@ version 1 # of file format 3+9 H?? gb_tpa_prot 3+11 H?? gb_tpa_prot 3+5 I?? ddbj_tpa_prot # fallback to placate older clients -3+5 I?? ddbj_tpa_wgs_prot +3+5 I?? ddbj_tpa_tsa_prot 3+7 I?? ddbj_tpa_prot 3+9 I?? ddbj_tpa_prot 3+11 I?? ddbj_tpa_prot @@ -104,6 +104,10 @@ version 1 # of file format 3+7 W?? gb_prot 3+9 W?? gb_prot 3+11 W?? gb_prot +3+5 X?? gb_prot +3+7 X?? gb_prot +3+9 X?? gb_prot +3+11 X?? gb_prot 3+5 ??? unreserved_prot 3+7 ??? unreserved_prot 3+9 ??? unreserved_prot @@ -1486,7 +1490,7 @@ version 1 # of file format 2+6 OS gb_patent 2+8 OS gb_other_nuc 2+10 OS gb_other_nuc -2+6 OT gb_other_nuc +2+6 OT gb_patent 2+8 OT gb_other_nuc 2+10 OT gb_other_nuc 2+6 O? embl_other_nuc @@ -1507,22 +1511,22 @@ version 1 # of file format 2+6 PE ddbj_patent # from Korea 2+8 PE ddbj_other_nuc 2+10 PE ddbj_other_nuc -2+6 PF ddbj_other_nuc +2+6 PF ddbj_patent # from Korea 2+8 PF ddbj_other_nuc 2+10 PF ddbj_other_nuc -2+6 PG ddbj_other_nuc +2+6 PG ddbj_patent 2+8 PG ddbj_other_nuc 2+10 PG ddbj_other_nuc -2+6 PH ddbj_other_nuc +2+6 PH ddbj_patent 2+8 PH ddbj_other_nuc 2+10 PH ddbj_other_nuc -2+6 PI ddbj_other_nuc +2+6 PI ddbj_patent 2+8 PI ddbj_other_nuc 2+10 PI ddbj_other_nuc -2+6 PJ ddbj_other_nuc +2+6 PJ ddbj_patent 2+8 PJ ddbj_other_nuc 2+10 PJ ddbj_other_nuc -2+6 PK ddbj_other_nuc +2+6 PK ddbj_patent 2+8 PK ddbj_other_nuc 2+10 PK ddbj_other_nuc 2+6 PL ddbj_other_nuc @@ -1537,6 +1541,21 @@ version 1 # of file format 2+6 PO ddbj_other_nuc 2+8 PO ddbj_other_nuc 2+10 PO ddbj_other_nuc +2+6 PP gb_dirsub +2+8 PP gb_other_nuc +2+10 PP gb_other_nuc +2+6 PQ gb_dirsub +2+8 PQ gb_other_nuc +2+10 PQ gb_other_nuc +2+6 PR gb_patent +2+8 PR gb_other_nuc +2+10 PR gb_other_nuc +2+6 PS gb_con +2+8 PS gb_other_nuc +2+10 PS gb_other_nuc +2+6 PT gb_patent +2+8 PT gb_other_nuc +2+10 PT gb_other_nuc 2+6 PW unreserved_nuc # deliberately skipped 2+8 PW unreserved_nuc # deliberately skipped 2+10 PW unreserved_nuc # deliberately skipped @@ -1573,6 +1592,21 @@ version 1 # of file format 2+6 QJ gb_other_nuc 2+8 QJ gb_other_nuc 2+10 QJ gb_other_nuc +2+6 QK embl_patent +2+8 QK embl_other_nuc +2+10 QK embl_other_nuc +2+6 QL embl_patent +2+8 QL embl_other_nuc +2+10 QL embl_other_nuc +2+6 QM embl_patent +2+8 QM embl_other_nuc +2+10 QM embl_other_nuc +2+6 QN embl_patent +2+8 QN embl_other_nuc +2+10 QN embl_other_nuc +2+6 QO embl_patent +2+8 QO embl_other_nuc +2+10 QO embl_other_nuc 2+6 TI unreserved_nuc # deliberately skipped 2+8 TI unreserved_nuc # deliberately skipped 2+10 TI unreserved_nuc # deliberately skipped @@ -6115,6 +6149,184 @@ special CAUPSY000000000-CAUTMV999999999 embl_tpa_wgs_nuc # 6+9 special CAUTMX000000000-CAUTMX999999999 embl_tpa_wgs_nuc # 6+9 special CAUTNA000000000-CAUTOK999999999 embl_tpa_wgs_nuc # 6+9 special CAUTOM000000000-CAUVWA999999999 embl_tpa_wgs_nuc # 6+9 +special CAWVRH000000000-CAWWDE999999999 embl_tpa_wgs_nuc # 6+9 +special CAWZYP000000000-CAWZYZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXAAG000000000-CAXACN999999999 embl_tpa_wgs_nuc # 6+9 +special CAXAFD000000000-CAXAJU999999999 embl_tpa_wgs_nuc # 6+9 +special CAXASQ000000000-CAXAUW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXAUY000000000-CAXAXI999999999 embl_tpa_wgs_nuc # 6+9 +special CAXAXL000000000-CAXAYR999999999 embl_tpa_wgs_nuc # 6+9 +special CAXAYT000000000-CAXBOQ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXBOS000000000-CAXBSW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXBUO000000000-CAXCFA999999999 embl_tpa_wgs_nuc # 6+9 +special CAXCFC000000000-CAXCFE999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDIY000000000-CAXDKL999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDKN000000000-CAXDLL999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDLN000000000-CAXDMO999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDMQ000000000-CAXDMR999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDMV000000000-CAXDNN999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDNQ000000000-CAXDOD999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDOI000000000-CAXDOJ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDOL000000000-CAXDOO999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDOT000000000-CAXDPF999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDPH000000000-CAXDPJ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDPL000000000-CAXDPM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDPR000000000-CAXDPU999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDPW000000000-CAXDPX999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDPZ000000000-CAXDPZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDQB000000000-CAXDQE999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDQG000000000-CAXDQG999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDQJ000000000-CAXDQT999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDQW000000000-CAXDQY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDRB000000000-CAXDRB999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDRE000000000-CAXDRE999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDRG000000000-CAXDRG999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDRI000000000-CAXDRU999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDRW000000000-CAXDRX999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDRZ000000000-CAXDSE999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDSG000000000-CAXDSK999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDSM000000000-CAXDTH999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDTJ000000000-CAXDTM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDTO000000000-CAXDTO999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDTW000000000-CAXDTW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEFG000000000-CAXEFJ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEGS000000000-CAXEKY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXELA000000000-CAXEMQ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEMS000000000-CAXENB999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEND000000000-CAXENO999999999 embl_tpa_wgs_nuc # 6+9 +special CAXENQ000000000-CAXEOK999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEOM000000000-CAXEOS999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEOU000000000-CAXEQM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEQO000000000-CAXEQW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEQY000000000-CAXERD999999999 embl_tpa_wgs_nuc # 6+9 +special CAXERF000000000-CAXERI999999999 embl_tpa_wgs_nuc # 6+9 +special CAXERK000000000-CAXERM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXERO000000000-CAXERS999999999 embl_tpa_wgs_nuc # 6+9 +special CAXERU000000000-CAXERW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXERY000000000-CAXESF999999999 embl_tpa_wgs_nuc # 6+9 +special CAXESH000000000-CAXESR999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEST000000000-CAXETH999999999 embl_tpa_wgs_nuc # 6+9 +special CAXETJ000000000-CAXETW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXETY000000000-CAXEUB999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEUD000000000-CAXEUI999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEUK000000000-CAXEUM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEUP000000000-CAXEVZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEWB000000000-CAXEWG999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEWI000000000-CAXEWO999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEWQ000000000-CAXEWR999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEWT000000000-CAXEYF999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEYH000000000-CAXEYH999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEYJ000000000-CAXEYL999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEYN000000000-CAXEYQ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEYS000000000-CAXEYS999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEYU000000000-CAXEYX999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEYZ000000000-CAXEYZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEZB000000000-CAXEZC999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEZE000000000-CAXEZM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEZO000000000-CAXEZW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEZY000000000-CAXEZY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFAA000000000-CAXFAB999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFAD000000000-CAXFAF999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFAH000000000-CAXFAM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFAO000000000-CAXFAV999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFAX000000000-CAXFAX999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFBA000000000-CAXFBA999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFBD000000000-CAXFBD999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFBF000000000-CAXFBG999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFBJ000000000-CAXFBS999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFBU000000000-CAXFBW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFBZ000000000-CAXFCX999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFCZ000000000-CAXFDS999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFDU000000000-CAXFDX999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFDZ000000000-CAXFEA999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFEO000000000-CAXFEO999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFER000000000-CAXFER999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFEW000000000-CAXFEW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFEY000000000-CAXFEY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFFB000000000-CAXFFB999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFFD000000000-CAXFFF999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFFL000000000-CAXFFL999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFFS000000000-CAXFFS999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFFU000000000-CAXFFZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFGC000000000-CAXFGE999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFGG000000000-CAXFGG999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFGI000000000-CAXFGK999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFGM000000000-CAXFGM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFGO000000000-CAXFGT999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFGX000000000-CAXFGY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFHB000000000-CAXFHC999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFHF000000000-CAXFHF999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFIC000000000-CAXFIC999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFIF000000000-CAXFIH999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFIJ000000000-CAXFIK999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFIQ000000000-CAXFIU999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFIY000000000-CAXFJG999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFJI000000000-CAXFJI999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFJL000000000-CAXFJP999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFJR000000000-CAXFJR999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFJT000000000-CAXFJW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFJY000000000-CAXFJZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFKB000000000-CAXFKB999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFKD000000000-CAXFKE999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFKJ000000000-CAXFKJ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFKM000000000-CAXFKN999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFKT000000000-CAXFKT999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFKV000000000-CAXFKV999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFKX000000000-CAXFKZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFLB000000000-CAXFLC999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFLE000000000-CAXFLI999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFLK000000000-CAXFLK999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFLM000000000-CAXFLM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFLO000000000-CAXFLQ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFLS000000000-CAXFLT999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFLV000000000-CAXFLV999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFLY000000000-CAXFLY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFMB000000000-CAXFMB999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFMD000000000-CAXFMD999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFMI000000000-CAXFMI999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFMN000000000-CAXFMN999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFMP000000000-CAXFMP999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFMS000000000-CAXFMW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFMY000000000-CAXFNA999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFNC000000000-CAXFND999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFNF000000000-CAXFNM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFNO000000000-CAXFNO999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFNQ000000000-CAXFNR999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFNT000000000-CAXFNT999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFNW000000000-CAXFNZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFOB000000000-CAXFOX999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFOZ000000000-CAXFPB999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFPD000000000-CAXFPD999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFPF000000000-CAXFPG999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFPI000000000-CAXFPM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFPO000000000-CAXFPW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFPY000000000-CAXFPY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFQA000000000-CAXFQA999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFQC000000000-CAXFQE999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFQG000000000-CAXFQN999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFQP000000000-CAXFQP999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFQR000000000-CAXFQR999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFQT000000000-CAXFQT999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFQV000000000-CAXFQV999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFQY000000000-CAXFQY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFRA000000000-CAXFRA999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFRE000000000-CAXFRG999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFRJ000000000-CAXFRK999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFRQ000000000-CAXFRQ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFRS000000000-CAXFRS999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFRX000000000-CAXFRY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFSC000000000-CAXFSD999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFSJ000000000-CAXFSJ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFSR000000000-CAXFSW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFSY000000000-CAXFTK999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFTM000000000-CAXFTW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFZX000000000-CAXFZZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXGAB000000000-CAXGCZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXGHC000000000-CAXGYU999999999 embl_tpa_wgs_nuc # 6+9 +special CAXGZH000000000-CAXHBE999999999 embl_tpa_wgs_nuc # 6+9 +special CAXHBG000000000-CAXHHX999999999 embl_tpa_wgs_nuc # 6+9 +special CAXHYR000000000-CAXIDP999999999 embl_tpa_wgs_nuc # 6+9 +special CAXIEU000000000-CAXIEV999999999 embl_tpa_wgs_nuc # 6+9 # Some "EMBL" 8- and 10-character protein accessions are really third-party # annotations. diff --git a/c++/src/objects/seqloc/accguide2.inc b/c++/src/objects/seqloc/accguide2.inc index dda4a059..4d0b3c2b 100644 --- a/c++/src/objects/seqloc/accguide2.inc +++ b/c++/src/objects/seqloc/accguide2.inc @@ -1,4 +1,4 @@ -/* $Id: accguide2.inc 673909 2023-10-12 19:49:33Z ivanov $ +/* $Id: accguide2.inc 684361 2024-06-20 19:31:00Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -30,11 +30,11 @@ * */ -/* time_t value corresponding to Thu Oct 12 11:42:06 EDT 2023; formally +/* time_t value corresponding to Wed Jun 12 13:27:59 EDT 2024; formally * expressed as unsigned long so output can stand fully on its own. */ -static const unsigned long kBuiltInGuide_Timestamp = 1697125326UL; +static const unsigned long kBuiltInGuide_Timestamp = 1718213279UL; static const char* const kBuiltInGuide[] = { - "# $Id: accguide2.inc 673909 2023-10-12 19:49:33Z ivanov $", + "# $Id: accguide2.inc 684361 2024-06-20 19:31:00Z ivanov $", "version 2 # of file format", "", "# three-letter-prefix protein accessions (traditionally with five digits)", @@ -72,7 +72,7 @@ static const char* const kBuiltInGuide[] = { "3+7 H?? gb_tpa_wgsv_prot", "3+9 H?? gb_tpa_prot", "3+11 H?? gb_tpa_prot", - "3+5 I?? ddbj_tpa_wgs_prot", + "3+5 I?? ddbj_tpa_tsa_prot", "3+7 I?? ddbj_tpa_prot", "3+9 I?? ddbj_tpa_prot", "3+11 I?? ddbj_tpa_prot", @@ -132,6 +132,10 @@ static const char* const kBuiltInGuide[] = { "3+7 W?? gb_prot", "3+9 W?? gb_prot", "3+11 W?? gb_prot", + "3+5 X?? gb_prot", + "3+7 X?? gb_prot", + "3+9 X?? gb_prot", + "3+11 X?? gb_prot", "3+5 ??? unreserved_prot", "3+7 ??? unreserved_prot", "3+9 ??? unreserved_prot", @@ -1361,7 +1365,7 @@ static const char* const kBuiltInGuide[] = { "2+6 OS gb_patent", "2+8 OS gb_other_nuc", "2+10 OS gb_other_nuc", - "2+6 OT gb_other_nuc", + "2+6 OT gb_patent", "2+8 OT gb_other_nuc", "2+10 OT gb_other_nuc", "2+6 O? embl_other_nuc", @@ -1382,22 +1386,22 @@ static const char* const kBuiltInGuide[] = { "2+6 PE ddbj_patent # from Korea", "2+8 PE ddbj_other_nuc", "2+10 PE ddbj_other_nuc", - "2+6 PF ddbj_other_nuc", + "2+6 PF ddbj_patent # from Korea", "2+8 PF ddbj_other_nuc", "2+10 PF ddbj_other_nuc", - "2+6 PG ddbj_other_nuc", + "2+6 PG ddbj_patent", "2+8 PG ddbj_other_nuc", "2+10 PG ddbj_other_nuc", - "2+6 PH ddbj_other_nuc", + "2+6 PH ddbj_patent", "2+8 PH ddbj_other_nuc", "2+10 PH ddbj_other_nuc", - "2+6 PI ddbj_other_nuc", + "2+6 PI ddbj_patent", "2+8 PI ddbj_other_nuc", "2+10 PI ddbj_other_nuc", - "2+6 PJ ddbj_other_nuc", + "2+6 PJ ddbj_patent", "2+8 PJ ddbj_other_nuc", "2+10 PJ ddbj_other_nuc", - "2+6 PK ddbj_other_nuc", + "2+6 PK ddbj_patent", "2+8 PK ddbj_other_nuc", "2+10 PK ddbj_other_nuc", "2+6 PL ddbj_other_nuc", @@ -1412,6 +1416,21 @@ static const char* const kBuiltInGuide[] = { "2+6 PO ddbj_other_nuc", "2+8 PO ddbj_other_nuc", "2+10 PO ddbj_other_nuc", + "2+6 PP gb_dirsub", + "2+8 PP gb_other_nuc", + "2+10 PP gb_other_nuc", + "2+6 PQ gb_dirsub", + "2+8 PQ gb_other_nuc", + "2+10 PQ gb_other_nuc", + "2+6 PR gb_patent", + "2+8 PR gb_other_nuc", + "2+10 PR gb_other_nuc", + "2+6 PS gb_con", + "2+8 PS gb_other_nuc", + "2+10 PS gb_other_nuc", + "2+6 PT gb_patent", + "2+8 PT gb_other_nuc", + "2+10 PT gb_other_nuc", "2+6 PW unreserved_nuc # deliberately skipped", "2+8 PW unreserved_nuc # deliberately skipped", "2+10 PW unreserved_nuc # deliberately skipped", @@ -1448,6 +1467,21 @@ static const char* const kBuiltInGuide[] = { "2+6 QJ gb_other_nuc", "2+8 QJ gb_other_nuc", "2+10 QJ gb_other_nuc", + "2+6 QK embl_patent", + "2+8 QK embl_other_nuc", + "2+10 QK embl_other_nuc", + "2+6 QL embl_patent", + "2+8 QL embl_other_nuc", + "2+10 QL embl_other_nuc", + "2+6 QM embl_patent", + "2+8 QM embl_other_nuc", + "2+10 QM embl_other_nuc", + "2+6 QN embl_patent", + "2+8 QN embl_other_nuc", + "2+10 QN embl_other_nuc", + "2+6 QO embl_patent", + "2+8 QO embl_other_nuc", + "2+10 QO embl_other_nuc", "2+6 TI unreserved_nuc # deliberately skipped", "2+8 TI unreserved_nuc # deliberately skipped", "2+10 TI unreserved_nuc # deliberately skipped", @@ -4753,6 +4787,184 @@ static const char* const kBuiltInGuide[] = { ": 000000000-999999999", "special CAUTNA000000000-CAUTOK999999999 embl_tpa_wgs_nuc # 6+9", "special CAUTOM000000000-CAUVWA999999999 embl_tpa_wgs_nuc # 6+9", + "special CAWVRH000000000-CAWWDE999999999 embl_tpa_wgs_nuc # 6+9", + "special CAWZYP000000000-CAWZYZ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXAAG000000000-CAXACN999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXAFD000000000-CAXAJU999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXASQ000000000-CAXAUW999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXAUY000000000-CAXAXI999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXAXL000000000-CAXAYR999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXAYT000000000-CAXBOQ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXBOS000000000-CAXBSW999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXBUO000000000-CAXCFA999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXCFC000000000-CAXCFE999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDIY000000000-CAXDKL999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDKN000000000-CAXDLL999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDLN000000000-CAXDMO999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDMQ000000000-CAXDMR999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDMV000000000-CAXDNN999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDNQ000000000-CAXDOD999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDOI000000000-CAXDOJ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDOL000000000-CAXDOO999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDOT000000000-CAXDPF999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDPH000000000-CAXDPJ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDPL000000000-CAXDPM999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDPR000000000-CAXDPU999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDPW000000000-CAXDPX999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDPZ000000000-CAXDPZ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDQB000000000-CAXDQE999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDQG000000000-CAXDQG999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDQJ000000000-CAXDQT999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDQW000000000-CAXDQY999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDRB000000000-CAXDRB999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDRE000000000-CAXDRE999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDRG000000000-CAXDRG999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDRI000000000-CAXDRU999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDRW000000000-CAXDRX999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDRZ000000000-CAXDSE999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDSG000000000-CAXDSK999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDSM000000000-CAXDTH999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDTJ000000000-CAXDTM999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDTO000000000-CAXDTO999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXDTW000000000-CAXDTW999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEFG000000000-CAXEFJ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEGS000000000-CAXEKY999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXELA000000000-CAXEMQ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEMS000000000-CAXENB999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEND000000000-CAXENO999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXENQ000000000-CAXEOK999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEOM000000000-CAXEOS999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEOU000000000-CAXEQM999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEQO000000000-CAXEQW999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEQY000000000-CAXERD999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXERF000000000-CAXERI999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXERK000000000-CAXERM999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXERO000000000-CAXERS999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXERU000000000-CAXERW999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXERY000000000-CAXESF999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXESH000000000-CAXESR999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEST000000000-CAXETH999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXETJ000000000-CAXETW999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXETY000000000-CAXEUB999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEUD000000000-CAXEUI999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEUK000000000-CAXEUM999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEUP000000000-CAXEVZ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEWB000000000-CAXEWG999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEWI000000000-CAXEWO999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEWQ000000000-CAXEWR999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEWT000000000-CAXEYF999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEYH000000000-CAXEYH999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEYJ000000000-CAXEYL999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEYN000000000-CAXEYQ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEYS000000000-CAXEYS999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEYU000000000-CAXEYX999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEYZ000000000-CAXEYZ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEZB000000000-CAXEZC999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEZE000000000-CAXEZM999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEZO000000000-CAXEZW999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXEZY000000000-CAXEZY999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFAA000000000-CAXFAB999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFAD000000000-CAXFAF999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFAH000000000-CAXFAM999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFAO000000000-CAXFAV999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFAX000000000-CAXFAX999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFBA000000000-CAXFBA999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFBD000000000-CAXFBD999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFBF000000000-CAXFBG999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFBJ000000000-CAXFBS999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFBU000000000-CAXFBW999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFBZ000000000-CAXFCX999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFCZ000000000-CAXFDS999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFDU000000000-CAXFDX999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFDZ000000000-CAXFEA999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFEO000000000-CAXFEO999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFER000000000-CAXFER999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFEW000000000-CAXFEW999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFEY000000000-CAXFEY999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFFB000000000-CAXFFB999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFFD000000000-CAXFFF999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFFL000000000-CAXFFL999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFFS000000000-CAXFFS999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFFU000000000-CAXFFZ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFGC000000000-CAXFGE999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFGG000000000-CAXFGG999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFGI000000000-CAXFGK999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFGM000000000-CAXFGM999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFGO000000000-CAXFGT999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFGX000000000-CAXFGY999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFHB000000000-CAXFHC999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFHF000000000-CAXFHF999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFIC000000000-CAXFIC999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFIF000000000-CAXFIH999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFIJ000000000-CAXFIK999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFIQ000000000-CAXFIU999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFIY000000000-CAXFJG999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFJI000000000-CAXFJI999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFJL000000000-CAXFJP999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFJR000000000-CAXFJR999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFJT000000000-CAXFJW999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFJY000000000-CAXFJZ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFKB000000000-CAXFKB999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFKD000000000-CAXFKE999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFKJ000000000-CAXFKJ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFKM000000000-CAXFKN999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFKT000000000-CAXFKT999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFKV000000000-CAXFKV999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFKX000000000-CAXFKZ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFLB000000000-CAXFLC999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFLE000000000-CAXFLI999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFLK000000000-CAXFLK999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFLM000000000-CAXFLM999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFLO000000000-CAXFLQ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFLS000000000-CAXFLT999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFLV000000000-CAXFLV999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFLY000000000-CAXFLY999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFMB000000000-CAXFMB999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFMD000000000-CAXFMD999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFMI000000000-CAXFMI999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFMN000000000-CAXFMN999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFMP000000000-CAXFMP999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFMS000000000-CAXFMW999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFMY000000000-CAXFNA999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFNC000000000-CAXFND999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFNF000000000-CAXFNM999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFNO000000000-CAXFNO999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFNQ000000000-CAXFNR999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFNT000000000-CAXFNT999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFNW000000000-CAXFNZ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFOB000000000-CAXFOX999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFOZ000000000-CAXFPB999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFPD000000000-CAXFPD999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFPF000000000-CAXFPG999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFPI000000000-CAXFPM999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFPO000000000-CAXFPW999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFPY000000000-CAXFPY999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFQA000000000-CAXFQA999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFQC000000000-CAXFQE999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFQG000000000-CAXFQN999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFQP000000000-CAXFQP999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFQR000000000-CAXFQR999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFQT000000000-CAXFQT999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFQV000000000-CAXFQV999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFQY000000000-CAXFQY999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFRA000000000-CAXFRA999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFRE000000000-CAXFRG999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFRJ000000000-CAXFRK999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFRQ000000000-CAXFRQ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFRS000000000-CAXFRS999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFRX000000000-CAXFRY999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFSC000000000-CAXFSD999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFSJ000000000-CAXFSJ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFSR000000000-CAXFSW999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFSY000000000-CAXFTK999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFTM000000000-CAXFTW999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXFZX000000000-CAXFZZ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXGAB000000000-CAXGCZ999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXGHC000000000-CAXGYU999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXGZH000000000-CAXHBE999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXHBG000000000-CAXHHX999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXHYR000000000-CAXIDP999999999 embl_tpa_wgs_nuc # 6+9", + "special CAXIEU000000000-CAXIEV999999999 embl_tpa_wgs_nuc # 6+9", "", "# Some \"EMBL\" TPA nucleotide accessions are really third-party annotations.", "special2 HBHG+8 embl_tpa_tsa_nuc", diff --git a/c++/src/objects/seqloc/accguide2.txt b/c++/src/objects/seqloc/accguide2.txt index d655c60d..a6ed7f04 100644 --- a/c++/src/objects/seqloc/accguide2.txt +++ b/c++/src/objects/seqloc/accguide2.txt @@ -1,4 +1,4 @@ -# $Id: accguide2.txt 673909 2023-10-12 19:49:33Z ivanov $ +# $Id: accguide2.txt 684361 2024-06-20 19:31:00Z ivanov $ version 2 # of file format # three-letter-prefix protein accessions (traditionally with five digits) @@ -36,7 +36,7 @@ version 2 # of file format 3+7 H?? gb_tpa_wgsv_prot 3+9 H?? gb_tpa_prot 3+11 H?? gb_tpa_prot -3+5 I?? ddbj_tpa_wgs_prot +3+5 I?? ddbj_tpa_tsa_prot 3+7 I?? ddbj_tpa_prot 3+9 I?? ddbj_tpa_prot 3+11 I?? ddbj_tpa_prot @@ -96,6 +96,10 @@ version 2 # of file format 3+7 W?? gb_prot 3+9 W?? gb_prot 3+11 W?? gb_prot +3+5 X?? gb_prot +3+7 X?? gb_prot +3+9 X?? gb_prot +3+11 X?? gb_prot 3+5 ??? unreserved_prot 3+7 ??? unreserved_prot 3+9 ??? unreserved_prot @@ -1325,7 +1329,7 @@ version 2 # of file format 2+6 OS gb_patent 2+8 OS gb_other_nuc 2+10 OS gb_other_nuc -2+6 OT gb_other_nuc +2+6 OT gb_patent 2+8 OT gb_other_nuc 2+10 OT gb_other_nuc 2+6 O? embl_other_nuc @@ -1346,22 +1350,22 @@ version 2 # of file format 2+6 PE ddbj_patent # from Korea 2+8 PE ddbj_other_nuc 2+10 PE ddbj_other_nuc -2+6 PF ddbj_other_nuc +2+6 PF ddbj_patent # from Korea 2+8 PF ddbj_other_nuc 2+10 PF ddbj_other_nuc -2+6 PG ddbj_other_nuc +2+6 PG ddbj_patent 2+8 PG ddbj_other_nuc 2+10 PG ddbj_other_nuc -2+6 PH ddbj_other_nuc +2+6 PH ddbj_patent 2+8 PH ddbj_other_nuc 2+10 PH ddbj_other_nuc -2+6 PI ddbj_other_nuc +2+6 PI ddbj_patent 2+8 PI ddbj_other_nuc 2+10 PI ddbj_other_nuc -2+6 PJ ddbj_other_nuc +2+6 PJ ddbj_patent 2+8 PJ ddbj_other_nuc 2+10 PJ ddbj_other_nuc -2+6 PK ddbj_other_nuc +2+6 PK ddbj_patent 2+8 PK ddbj_other_nuc 2+10 PK ddbj_other_nuc 2+6 PL ddbj_other_nuc @@ -1376,6 +1380,21 @@ version 2 # of file format 2+6 PO ddbj_other_nuc 2+8 PO ddbj_other_nuc 2+10 PO ddbj_other_nuc +2+6 PP gb_dirsub +2+8 PP gb_other_nuc +2+10 PP gb_other_nuc +2+6 PQ gb_dirsub +2+8 PQ gb_other_nuc +2+10 PQ gb_other_nuc +2+6 PR gb_patent +2+8 PR gb_other_nuc +2+10 PR gb_other_nuc +2+6 PS gb_con +2+8 PS gb_other_nuc +2+10 PS gb_other_nuc +2+6 PT gb_patent +2+8 PT gb_other_nuc +2+10 PT gb_other_nuc 2+6 PW unreserved_nuc # deliberately skipped 2+8 PW unreserved_nuc # deliberately skipped 2+10 PW unreserved_nuc # deliberately skipped @@ -1412,6 +1431,21 @@ version 2 # of file format 2+6 QJ gb_other_nuc 2+8 QJ gb_other_nuc 2+10 QJ gb_other_nuc +2+6 QK embl_patent +2+8 QK embl_other_nuc +2+10 QK embl_other_nuc +2+6 QL embl_patent +2+8 QL embl_other_nuc +2+10 QL embl_other_nuc +2+6 QM embl_patent +2+8 QM embl_other_nuc +2+10 QM embl_other_nuc +2+6 QN embl_patent +2+8 QN embl_other_nuc +2+10 QN embl_other_nuc +2+6 QO embl_patent +2+8 QO embl_other_nuc +2+10 QO embl_other_nuc 2+6 TI unreserved_nuc # deliberately skipped 2+8 TI unreserved_nuc # deliberately skipped 2+10 TI unreserved_nuc # deliberately skipped @@ -4717,6 +4751,184 @@ special2 CAUTMX+9 embl_tpa_wgs_nuc : 000000000-999999999 special CAUTNA000000000-CAUTOK999999999 embl_tpa_wgs_nuc # 6+9 special CAUTOM000000000-CAUVWA999999999 embl_tpa_wgs_nuc # 6+9 +special CAWVRH000000000-CAWWDE999999999 embl_tpa_wgs_nuc # 6+9 +special CAWZYP000000000-CAWZYZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXAAG000000000-CAXACN999999999 embl_tpa_wgs_nuc # 6+9 +special CAXAFD000000000-CAXAJU999999999 embl_tpa_wgs_nuc # 6+9 +special CAXASQ000000000-CAXAUW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXAUY000000000-CAXAXI999999999 embl_tpa_wgs_nuc # 6+9 +special CAXAXL000000000-CAXAYR999999999 embl_tpa_wgs_nuc # 6+9 +special CAXAYT000000000-CAXBOQ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXBOS000000000-CAXBSW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXBUO000000000-CAXCFA999999999 embl_tpa_wgs_nuc # 6+9 +special CAXCFC000000000-CAXCFE999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDIY000000000-CAXDKL999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDKN000000000-CAXDLL999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDLN000000000-CAXDMO999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDMQ000000000-CAXDMR999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDMV000000000-CAXDNN999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDNQ000000000-CAXDOD999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDOI000000000-CAXDOJ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDOL000000000-CAXDOO999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDOT000000000-CAXDPF999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDPH000000000-CAXDPJ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDPL000000000-CAXDPM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDPR000000000-CAXDPU999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDPW000000000-CAXDPX999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDPZ000000000-CAXDPZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDQB000000000-CAXDQE999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDQG000000000-CAXDQG999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDQJ000000000-CAXDQT999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDQW000000000-CAXDQY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDRB000000000-CAXDRB999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDRE000000000-CAXDRE999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDRG000000000-CAXDRG999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDRI000000000-CAXDRU999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDRW000000000-CAXDRX999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDRZ000000000-CAXDSE999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDSG000000000-CAXDSK999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDSM000000000-CAXDTH999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDTJ000000000-CAXDTM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDTO000000000-CAXDTO999999999 embl_tpa_wgs_nuc # 6+9 +special CAXDTW000000000-CAXDTW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEFG000000000-CAXEFJ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEGS000000000-CAXEKY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXELA000000000-CAXEMQ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEMS000000000-CAXENB999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEND000000000-CAXENO999999999 embl_tpa_wgs_nuc # 6+9 +special CAXENQ000000000-CAXEOK999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEOM000000000-CAXEOS999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEOU000000000-CAXEQM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEQO000000000-CAXEQW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEQY000000000-CAXERD999999999 embl_tpa_wgs_nuc # 6+9 +special CAXERF000000000-CAXERI999999999 embl_tpa_wgs_nuc # 6+9 +special CAXERK000000000-CAXERM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXERO000000000-CAXERS999999999 embl_tpa_wgs_nuc # 6+9 +special CAXERU000000000-CAXERW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXERY000000000-CAXESF999999999 embl_tpa_wgs_nuc # 6+9 +special CAXESH000000000-CAXESR999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEST000000000-CAXETH999999999 embl_tpa_wgs_nuc # 6+9 +special CAXETJ000000000-CAXETW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXETY000000000-CAXEUB999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEUD000000000-CAXEUI999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEUK000000000-CAXEUM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEUP000000000-CAXEVZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEWB000000000-CAXEWG999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEWI000000000-CAXEWO999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEWQ000000000-CAXEWR999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEWT000000000-CAXEYF999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEYH000000000-CAXEYH999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEYJ000000000-CAXEYL999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEYN000000000-CAXEYQ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEYS000000000-CAXEYS999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEYU000000000-CAXEYX999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEYZ000000000-CAXEYZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEZB000000000-CAXEZC999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEZE000000000-CAXEZM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEZO000000000-CAXEZW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXEZY000000000-CAXEZY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFAA000000000-CAXFAB999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFAD000000000-CAXFAF999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFAH000000000-CAXFAM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFAO000000000-CAXFAV999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFAX000000000-CAXFAX999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFBA000000000-CAXFBA999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFBD000000000-CAXFBD999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFBF000000000-CAXFBG999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFBJ000000000-CAXFBS999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFBU000000000-CAXFBW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFBZ000000000-CAXFCX999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFCZ000000000-CAXFDS999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFDU000000000-CAXFDX999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFDZ000000000-CAXFEA999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFEO000000000-CAXFEO999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFER000000000-CAXFER999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFEW000000000-CAXFEW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFEY000000000-CAXFEY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFFB000000000-CAXFFB999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFFD000000000-CAXFFF999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFFL000000000-CAXFFL999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFFS000000000-CAXFFS999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFFU000000000-CAXFFZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFGC000000000-CAXFGE999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFGG000000000-CAXFGG999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFGI000000000-CAXFGK999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFGM000000000-CAXFGM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFGO000000000-CAXFGT999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFGX000000000-CAXFGY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFHB000000000-CAXFHC999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFHF000000000-CAXFHF999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFIC000000000-CAXFIC999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFIF000000000-CAXFIH999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFIJ000000000-CAXFIK999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFIQ000000000-CAXFIU999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFIY000000000-CAXFJG999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFJI000000000-CAXFJI999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFJL000000000-CAXFJP999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFJR000000000-CAXFJR999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFJT000000000-CAXFJW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFJY000000000-CAXFJZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFKB000000000-CAXFKB999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFKD000000000-CAXFKE999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFKJ000000000-CAXFKJ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFKM000000000-CAXFKN999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFKT000000000-CAXFKT999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFKV000000000-CAXFKV999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFKX000000000-CAXFKZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFLB000000000-CAXFLC999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFLE000000000-CAXFLI999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFLK000000000-CAXFLK999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFLM000000000-CAXFLM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFLO000000000-CAXFLQ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFLS000000000-CAXFLT999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFLV000000000-CAXFLV999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFLY000000000-CAXFLY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFMB000000000-CAXFMB999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFMD000000000-CAXFMD999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFMI000000000-CAXFMI999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFMN000000000-CAXFMN999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFMP000000000-CAXFMP999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFMS000000000-CAXFMW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFMY000000000-CAXFNA999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFNC000000000-CAXFND999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFNF000000000-CAXFNM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFNO000000000-CAXFNO999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFNQ000000000-CAXFNR999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFNT000000000-CAXFNT999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFNW000000000-CAXFNZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFOB000000000-CAXFOX999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFOZ000000000-CAXFPB999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFPD000000000-CAXFPD999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFPF000000000-CAXFPG999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFPI000000000-CAXFPM999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFPO000000000-CAXFPW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFPY000000000-CAXFPY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFQA000000000-CAXFQA999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFQC000000000-CAXFQE999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFQG000000000-CAXFQN999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFQP000000000-CAXFQP999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFQR000000000-CAXFQR999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFQT000000000-CAXFQT999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFQV000000000-CAXFQV999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFQY000000000-CAXFQY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFRA000000000-CAXFRA999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFRE000000000-CAXFRG999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFRJ000000000-CAXFRK999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFRQ000000000-CAXFRQ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFRS000000000-CAXFRS999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFRX000000000-CAXFRY999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFSC000000000-CAXFSD999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFSJ000000000-CAXFSJ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFSR000000000-CAXFSW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFSY000000000-CAXFTK999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFTM000000000-CAXFTW999999999 embl_tpa_wgs_nuc # 6+9 +special CAXFZX000000000-CAXFZZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXGAB000000000-CAXGCZ999999999 embl_tpa_wgs_nuc # 6+9 +special CAXGHC000000000-CAXGYU999999999 embl_tpa_wgs_nuc # 6+9 +special CAXGZH000000000-CAXHBE999999999 embl_tpa_wgs_nuc # 6+9 +special CAXHBG000000000-CAXHHX999999999 embl_tpa_wgs_nuc # 6+9 +special CAXHYR000000000-CAXIDP999999999 embl_tpa_wgs_nuc # 6+9 +special CAXIEU000000000-CAXIEV999999999 embl_tpa_wgs_nuc # 6+9 # Some "EMBL" TPA nucleotide accessions are really third-party annotations. special2 HBHG+8 embl_tpa_tsa_nuc diff --git a/c++/src/objects/taxon1/local_taxon.cpp b/c++/src/objects/taxon1/local_taxon.cpp index e75d1e0a..e2200f00 100644 --- a/c++/src/objects/taxon1/local_taxon.cpp +++ b/c++/src/objects/taxon1/local_taxon.cpp @@ -1,4 +1,4 @@ -/* $Id: local_taxon.cpp 663139 2023-02-13 20:02:01Z mozese2 $ +/* $Id: local_taxon.cpp 684231 2024-06-17 12:05:48Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -130,9 +130,12 @@ string CLocalTaxon::GetRank(TTaxid taxid) x_Cache(taxid); return m_Nodes.find(taxid)->second.rank; } else { - TTaxRank rank_id = m_TaxonConn->GetTreeIterator(taxid)->GetNode()->GetRank(); string rank_name; - m_TaxonConn->GetRankName(rank_id, rank_name); + auto node = m_TaxonConn->GetTreeIterator(taxid)->GetNode(); + if (node) { + TTaxRank rank_id = node->GetRank(); + m_TaxonConn->GetRankName(rank_id, rank_name); + } return rank_name; } } @@ -262,9 +265,14 @@ CLocalTaxon::TTaxid CLocalTaxon::GetAncestorByRank(TTaxid taxid, const string &r } } return ZERO_TAX_ID; - } else { - return m_TaxonConn->GetAncestorByRank(taxid, rank.c_str()); + } else if (m_fallback) { + if (!m_TaxonConn.get()) { + m_TaxonConn.reset(new CTaxon1); + m_TaxonConn->Init(); + } + return m_TaxonConn->GetAncestorByRank(taxid, rank.c_str()); } +NCBI_THROW(CException, eUnknown, "CLocalTaxon: neither local nor remote connections available"); } CLocalTaxon::TTaxid CLocalTaxon::GetTaxIdByOrgRef(const COrg_ref &inp_orgRef) @@ -312,7 +320,11 @@ CLocalTaxon::TTaxid CLocalTaxon::Join(TTaxid taxid1, TTaxid taxid2) TLineage::const_iterator it1 = lineage1.begin(), it2 = lineage2.begin(); for (; it1 != lineage1.end() && it2 != lineage2.end() && *it1 == *it2; - ++it1, ++it2); + ++it1, ++it2) { + } + if (it1 == lineage1.end()) { + return 0; + } return *--it1; } else { return m_TaxonConn->Join(taxid1, taxid2); diff --git a/c++/src/objects/valerr/ValidErrItem.cpp b/c++/src/objects/valerr/ValidErrItem.cpp index 3f93f108..57b1ccef 100644 --- a/c++/src/objects/valerr/ValidErrItem.cpp +++ b/c++/src/objects/valerr/ValidErrItem.cpp @@ -1,4 +1,4 @@ -/* $Id: ValidErrItem.cpp 660629 2022-12-20 23:10:05Z kans $ +/* $Id: ValidErrItem.cpp 684486 2024-06-25 12:34:24Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -369,6 +369,12 @@ static const TErrTypStrs sc_ErrStrs[] = { { eErr_SEQ_INST_InstantiatedGapMismatch, { "InstantiatedGapMismatch", "Gap misc_feature does not match gap in delta Bioseq" } } , + { eErr_SEQ_INST_BadSeqIdCharacter, + { "BadSeqIdCharacter", + "An illegal character is present in the sequence identifier." } }, + { eErr_SEQ_INST_BadSeqIdLength, + { "BadSeqIdLength", + "A sequence identifier field is longer than the allowed maximum length." } }, /* SEQ_DESCR */ @@ -974,6 +980,24 @@ static const TErrTypStrs sc_ErrStrs[] = { { eErr_SEQ_DESCR_NonViralSegment, { "NonViralSegment", "Non-viral taxonomy should not have segment qualifier" } }, + { eErr_SEQ_DESCR_BadGeoLocNameCode, + { "BadGeoLocNameCode", + "The geo_loc_name code (up to the first colon) is not on the approved list of countries." } }, + { eErr_SEQ_DESCR_LatLonGeoLocName, + { "LatLonGeoLocName", + "The lat_lon coordinate does not map to the indicated geo_loc_name." } }, + { eErr_SEQ_DESCR_ReplacedGeoLocNameCode, + { "ReplacedGeoLocNameCode", + "The geo_loc_name code (up to the first colon) is no longer on the approved list of countries." } }, + { eErr_SEQ_DESCR_BadGeoLocNameCapitalization, + { "BadGeoLocNameCapitalization", + "The geo_loc_name code does not use the correct capitalization." } }, + { eErr_SEQ_DESCR_BadInstitutionGeoLocName, + { "BadInstitutionGeoLocName", + "The institution (or institution: collection) code should not have a modifier." } }, + { eErr_SEQ_DESCR_MultipleIsolates, + { "MultipleIsolates", + "A Biosource should only have one isolate value" } } , /* SEQ_GENERIC */ @@ -1092,6 +1116,12 @@ static const TErrTypStrs sc_ErrStrs[] = { { eErr_GENERIC_MissingPubRequirement, { "MissingPubRequirement", "The publication is missing essential information, such as title or authors." } }, + { eErr_GENERIC_BadSubmissionAuthorName, + { "BadSubmissionAuthorName", +"A submission author name field is invalid." } }, + { eErr_GENERIC_BarcodeMissingGeoLocName, + { "BarcodeMissingGeoLocName", + "Barcode sequence is missing geo_loc_name." } }, /* SEQ_PKG */ @@ -2418,16 +2448,16 @@ DEFINE_STATIC_ARRAY_MAP_WITH_COPY(TErrTypeStrsMap, sc_ErrStrsMap, sc_ErrStrs); #undef END -CValidErrItem::CValidErrItem -(EDiagSev sev, - unsigned int ec, - const string& msg, - const string& desc, - const CSerialObject& obj, - const string& acc, - const int ver, - const int seq_offset) - : m_Object(&obj) +CValidErrItem::CValidErrItem( + EDiagSev sev, + unsigned int ec, + const string& msg, + const string& desc, + const CSerialObject* obj, + const CSeq_entry* ctx, + const string& acc, + const int ver, + const int seq_offset) { SetSev(sev); SetErrIndex(ec); @@ -2443,94 +2473,12 @@ CValidErrItem::CValidErrItem SetVersion(ver); SetErrorName(ConvertErrCode(ec)); SetErrorGroup(ConvertErrGroup(ec)); -} - -CValidErrItem::CValidErrItem -(EDiagSev sev, - unsigned int ec, - const string& msg, - const string& desc, - const string& acc, - const int ver, - const int seq_offset) -{ - SetSev(sev); - SetErrIndex(ec); - SetMsg(msg); - SetObjDesc(desc); - SetAccession(acc); - SetSeqOffset(seq_offset); - if (ver > 0) { - SetAccnver(acc + "." + NStr::IntToString(ver)); - } else { - SetAccnver(acc); + if (obj) { + SetObject(*obj); } - SetVersion(ver); - SetErrorName(ConvertErrCode(ec)); - SetErrorGroup(ConvertErrGroup(ec)); -} - - - - - - -CValidErrItem::CValidErrItem -(EDiagSev sev, - unsigned int ec, - const string& msg, - const string& desc, - const CSerialObject& obj, - const string& acc, - const int ver, - const string& feature_id, - const int seq_offset) - : m_Object(&obj) -{ - SetSev(sev); - SetErrIndex(ec); - SetMsg(msg); - SetObjDesc(desc); - SetAccession(acc); - SetFeatureId(feature_id); - SetSeqOffset(seq_offset); - if (ver > 0) { - SetAccnver(acc + "." + NStr::IntToString(ver)); - } else { - SetAccnver(acc); + if (ctx) { + m_Ctx.Reset(ctx); } - SetVersion(ver); - SetErrorName(ConvertErrCode(ec)); - SetErrorGroup(ConvertErrGroup(ec)); -} - -CValidErrItem::CValidErrItem -(EDiagSev sev, - unsigned int ec, - const string& msg, - const string& desc, - const CSerialObject& obj, - const CSeq_entry& ctx, - const string& acc, - const int ver, - const int seq_offset) - : m_Object(&obj), - m_Ctx(&ctx) -{ - SetSev(sev); - SetErrIndex(ec); - SetMsg(msg); - SetObjDesc(desc); - SetAccession(acc); - SetSeqOffset(seq_offset); - if (ver > 0) { - SetAccnver(acc + "." + NStr::IntToString(ver)); - } else { - SetAccnver(acc); - } - SetVersion(ver); - SetErrorName(ConvertErrCode(ec)); - SetErrorGroup(ConvertErrGroup(ec)); } @@ -2567,38 +2515,38 @@ void CValidErrItem::SetFeatureObjDescFromFields() // destructor -CValidErrItem::~CValidErrItem(void) +CValidErrItem::~CValidErrItem() { } -const string CValidErrItem::GetErrCode(void) const +const string CValidErrItem::GetErrCode() const { return ConvertErrCode(GetErrIndex()); } -size_t CValidErrItem::GetErrCount(void) +size_t CValidErrItem::GetErrCount() { return sc_ErrStrsMap.size(); } -const string CValidErrItem::ConvertErrGroup(unsigned int err_int) +const string& CValidErrItem::ConvertErrGroup(unsigned int err_int) { - static const char* kSeqInst = "SEQ_INST"; - static const char* kSeqDescr = "SEQ_DESCR"; - static const char* kGeneric = "GENERIC"; - static const char* kSeqPkg = "SEQ_PKG"; - static const char* kSeqFeat = "SEQ_FEAT"; - static const char* kSeqAlign = "SEQ_ALIGN"; - static const char* kSeqGraph = "SEQ_GRAPH"; - static const char* kSeqAnnot = "SEQ_ANNOT"; - static const char* kInternal = "INTERNAL"; - static const char* kUnknown = "UNKNOWN"; - - TErrIndex errIndex = static_cast (err_int); - + static const string kSeqInst = "SEQ_INST"; + static const string kSeqDescr = "SEQ_DESCR"; + static const string kGeneric = "GENERIC"; + static const string kSeqPkg = "SEQ_PKG"; + static const string kSeqFeat = "SEQ_FEAT"; + static const string kSeqAlign = "SEQ_ALIGN"; + static const string kSeqGraph = "SEQ_GRAPH"; + static const string kSeqAnnot = "SEQ_ANNOT"; + static const string kInternal = "INTERNAL"; + static const string kUnknown = "UNKNOWN"; + + TErrIndex errIndex = static_cast(err_int); + #define IS_IN(x) (errIndex > ERR_CODE_BEGIN(x)) && (errIndex < ERR_CODE_END(x)) if ((errIndex < eErr_MAX) && (errIndex > 0)) { @@ -2628,13 +2576,13 @@ const string CValidErrItem::ConvertErrGroup(unsigned int err_int) return kUnknown; } -const string CValidErrItem::GetErrGroup(void) const +const string CValidErrItem::GetErrGroup() const { return ConvertErrGroup(GetErrIndex()); } -const string CValidErrItem::GetVerbose(void) const +const string CValidErrItem::GetVerbose() const { TErrIndex err = GetErrIndex(); if (err <= eErr_MAX) { @@ -2643,19 +2591,19 @@ const string CValidErrItem::GetVerbose(void) const return err_it->second.second; } } - return sc_ErrStrsMap.find(eErr_UNKNOWN)->second.second ; + return sc_ErrStrsMap.find(eErr_UNKNOWN)->second.second; } -const CSerialObject& CValidErrItem::GetObject(void) const +const CSerialObject& CValidErrItem::GetObject() const { return *m_Object; } -bool CValidErrItem::IsSetObject(void) const +bool CValidErrItem::IsSetObject() const { - return m_Object.NotEmpty(); + return m_Object.NotEmpty(); } @@ -2665,9 +2613,9 @@ void CValidErrItem::SetObject(const CSerialObject& obj) } -const string CValidErrItem::ConvertSeverity(EDiagSev sev) +const string& CValidErrItem::ConvertSeverity(EDiagSev sev) { - static const char* str_sev[] = { + static const string str_sev[eDiagSevMax + 1] = { "Info", "Warning", "Error", "Critical", "Fatal", "Trace" }; @@ -2675,9 +2623,9 @@ const string CValidErrItem::ConvertSeverity(EDiagSev sev) } -const string CValidErrItem::ConvertErrCode(unsigned int err_int) +const string& CValidErrItem::ConvertErrCode(unsigned int err_int) { - TErrIndex err = static_cast (err_int); + TErrIndex err = static_cast(err_int); if (err <= eErr_MAX) { TErrTypeStrsMap::const_iterator err_it = sc_ErrStrsMap.find(err); if (err_it != sc_ErrStrsMap.end()) { diff --git a/c++/src/objects/valerr/ValidError.cpp b/c++/src/objects/valerr/ValidError.cpp index f43245c5..39717aff 100644 --- a/c++/src/objects/valerr/ValidError.cpp +++ b/c++/src/objects/valerr/ValidError.cpp @@ -1,4 +1,4 @@ -/* $Id: ValidError.cpp 657933 2022-10-20 18:09:57Z ludwigf $ +/* $Id: ValidError.cpp 676047 2023-12-07 14:47:50Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -55,21 +55,21 @@ CValidError::CValidError(const CSerialObject* obj) : { } -void CValidError::AddValidErrItem -(EDiagSev sev, - unsigned int ec, - const string& msg, - const string& desc, - const CSerialObject& obj, - const string& acc, - const int ver, - const string& location, - const int seq_offset) +void CValidError::AddValidErrItem( + EDiagSev sev, + unsigned int ec, + const string& msg, + const string& desc, + const CSerialObject& obj, + const string& acc, + const int ver, + const string& location, + const int seq_offset) { if (ShouldSuppress(ec)) { return; } - CRef item(new CValidErrItem(sev, ec, msg, desc, obj, acc, ver, seq_offset)); + CRef item(new CValidErrItem(sev, ec, msg, desc, &obj, nullptr, acc, ver, seq_offset)); if (!NStr::IsBlank(location)) { item->SetLocation(location); } @@ -77,20 +77,20 @@ void CValidError::AddValidErrItem m_Stats[item->GetSeverity()]++; } -void CValidError::AddValidErrItem -(EDiagSev sev, - unsigned int ec, - const string& msg, - const string& desc, - const string& acc, - const int ver, - const string& location, - const int seq_offset) +void CValidError::AddValidErrItem( + EDiagSev sev, + unsigned int ec, + const string& msg, + const string& desc, + const string& acc, + const int ver, + const string& location, + const int seq_offset) { if (ShouldSuppress(ec)) { return; } - CRef item(new CValidErrItem(sev, ec, msg, desc, acc, ver, seq_offset)); + CRef item(new CValidErrItem(sev, ec, msg, desc, nullptr, nullptr, acc, ver, seq_offset)); if (!NStr::IsBlank(location)) { item->SetLocation(location); } @@ -99,45 +99,21 @@ void CValidError::AddValidErrItem } -void CValidError::AddValidErrItem -(EDiagSev sev, - unsigned int ec, - const string& msg, - const string& desc, - const CSerialObject& obj, - const string& acc, - const int ver, - const string& feature_id, - const string& location, - const int seq_offset) +void CValidError::AddValidErrItem( + EDiagSev sev, + unsigned int ec, + const string& msg, + const string& desc, + const CSeqdesc& seqdesc, + const CSeq_entry& ctx, + const string& acc, + const int ver, + const int seq_offset) { if (ShouldSuppress(ec)) { return; } - CRef item(new CValidErrItem(sev, ec, msg, desc, obj, acc, ver, feature_id, seq_offset)); - if (!NStr::IsBlank(location)) { - item->SetLocation(location); - } - SetErrs().push_back(item); - m_Stats[item->GetSeverity()]++; -} - - -void CValidError::AddValidErrItem -(EDiagSev sev, - unsigned int ec, - const string& msg, - const string& desc, - const CSeqdesc& seqdesc, - const CSeq_entry& ctx, - const string& acc, - const int ver, - const int seq_offset) -{ - if (ShouldSuppress(ec)) { - return; - } - CRef item(new CValidErrItem(sev, ec, msg, desc, seqdesc, ctx, acc, ver, seq_offset)); + CRef item(new CValidErrItem(sev, ec, msg, desc, &seqdesc, &ctx, acc, ver, seq_offset)); SetErrs().push_back(item); m_Stats[item->GetSeverity()]++; } @@ -239,18 +215,18 @@ CValidError_CI::CValidError_CI(void) : } -CValidError_CI::CValidError_CI -(const CValidError& ve, - const string& errcode, - EDiagSev minsev, - EDiagSev maxsev) : +CValidError_CI::CValidError_CI( + const CValidError& ve, + const string& errcode, + EDiagSev minsev, + EDiagSev maxsev) : m_Validator(&ve), m_Current(ve.GetErrs().begin()), m_ErrCodeFilter(errcode), m_MinSeverity(minsev), m_MaxSeverity(maxsev) { - if ( IsValid() && !Filter(**m_Current) ) { + if (IsValid() && ! Filter(**m_Current)) { Next(); } } diff --git a/c++/src/objects/valid/validrules.inc b/c++/src/objects/valid/validrules.inc index c5925fa2..0220aff6 100644 --- a/c++/src/objects/valid/validrules.inc +++ b/c++/src/objects/valid/validrules.inc @@ -1,4 +1,4 @@ -/* $Id: validrules.inc 672959 2023-09-19 12:44:26Z ivanov $ +/* $Id: validrules.inc 679583 2024-02-28 13:21:31Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -33,7 +33,7 @@ /* time_t value corresponding to Tue Feb 14 13:22:03 EST 2023 ; formally * expressed as unsigned long so output can stand fully on its own. */ -static const unsigned long s_Defaultvalidrules_Timestamp = 1694719829UL; +static const unsigned long s_Defaultvalidrules_Timestamp = 1709047163UL; static const char* const s_Defaultvalidrules[] = { "Comment-set ::= {", " {", diff --git a/c++/src/objmgr/util/create_defline.cpp b/c++/src/objmgr/util/create_defline.cpp index 984108de..11ebef31 100644 --- a/c++/src/objmgr/util/create_defline.cpp +++ b/c++/src/objmgr/util/create_defline.cpp @@ -1708,7 +1708,7 @@ void CDeflineGenerator::x_SetTitleFromNM ( ) { - unsigned int genes = 0, cdregions = 0, prots = 0; + unsigned int genes = 0, cdregions = 0; CConstRef gene(0); CConstRef cdregion(0); @@ -1720,7 +1720,6 @@ void CDeflineGenerator::x_SetTitleFromNM ( SAnnotSelector sel; sel.SetFeatType(CSeqFeatData::e_Gene); sel.IncludeFeatType(CSeqFeatData::e_Cdregion); - sel.IncludeFeatType(CSeqFeatData::e_Prot); sel.SetResolveTSE(); FOR_SELECTED_SEQFEAT_ON_BIOSEQ_HANDLE (feat_it, bsh, sel) { @@ -1734,9 +1733,6 @@ void CDeflineGenerator::x_SetTitleFromNM ( ++cdregions; cdregion.Reset(&sft); break; - case CSeqFeatData::e_Prot: - ++prots; - break; default: break; } @@ -2218,8 +2214,8 @@ void CDeflineGenerator::x_SetTitleFromProteinIdx ( m_MainTitle.erase (pos + 1); } - int offset = 0; - int delta = 0; + size_t offset = 0; + size_t delta = 0; string comma; string isoform; if (NStr::StartsWith (m_MainTitle, "hypothetical protein")) { @@ -2820,7 +2816,23 @@ void CDeflineGenerator::x_SetPrefix ( prefix = "TPA_inf: "; } else if (m_TPAReasm) { prefix = "TPA_asm: "; - } else { + } else if (m_Idx && m_IsAA) { + CRef bsx = m_Idx->GetBioseqIndex (bsh); + if (bsx) { + CWeakRef bsxp = bsx->GetBioseqForProduct(); + auto nucx = bsxp.Lock(); + if (nucx) { + if (nucx->IsTPAExp()) { + prefix = "TPA_exp: "; + } else if (nucx->IsTPAInf()) { + prefix = "TPA_inf: "; + } else if (nucx->IsTPAReasm()) { + prefix = "TPA_asm: "; + } + } + } + } + if (prefix.empty()) { prefix = "TPA: "; } } else if (m_IsTSA) { @@ -3078,11 +3090,11 @@ static size_t s_TitleEndsInOrganism ( ) { - size_t pos; - int len1, len2, idx; + size_t pos, idx; + size_t len1, len2; - len1 = (int) title.length(); - len2 = (int) taxname.length(); + len1 = title.length(); + len2 = taxname.length(); idx = len1 - len2 - 3; if (len1 > len2 + 4 && title [idx] == ' ' && title [idx + 1] == '[' && title [len1 - 1] == ']') { @@ -3417,6 +3429,7 @@ static const char* s_tpaPrefixList [] = { "MAG ", "MAG:", "MULTISPECIES:", + "TLS:", "TPA:", "TPA_exp:", "TPA_inf:", @@ -3733,7 +3746,11 @@ string CDeflineGenerator::x_GetModifiers(const CBioseq_Handle & bsh) joiner.Add("plastid_name", subname); break; case CSubSource::eSubtype_country: - joiner.Add("country", subname); + if (CSubSource::NCBI_UseGeoLocNameForCountry()) { + joiner.Add("geo_loc_name", subname); + } else { + joiner.Add("country", subname); + } break; case CSubSource::eSubtype_segment: joiner.Add("segment", subname); @@ -4029,7 +4046,7 @@ string CDeflineGenerator::GenerateDefline ( } // remove TPA or TSA prefix, will rely on other data in record to set - for (int i = 0; i < sizeof (s_tpaPrefixList) / sizeof (const char*); i++) { + for (size_t i = 0; i < sizeof (s_tpaPrefixList) / sizeof (const char*); i++) { string str = s_tpaPrefixList [i]; if (NStr::StartsWith (m_MainTitle, str, NStr::eNocase)) { m_MainTitle.erase (0, str.length()); diff --git a/c++/src/objmgr/util/indexer.cpp b/c++/src/objmgr/util/indexer.cpp index 03c0d481..3ee976c4 100644 --- a/c++/src/objmgr/util/indexer.cpp +++ b/c++/src/objmgr/util/indexer.cpp @@ -1990,7 +1990,8 @@ void CBioseqIndex::x_DefaultSelector(SAnnotSelector& sel, CSeqEntryIndex::EPolic if ( cddOK ) { sel.IncludeNamedAnnotAccession("CDD"); } else { - sel.ExcludeNamedAnnotAccession("CDD"); + sel.ExcludeNamedAnnotAccession("CDD"); // This does not actually help to stop loading CDDs. + sel.ExcludeNamedAnnots("CDD"); // This prevents annot-iterator from loading CDDs. } CWeakRef idx = GetSeqMasterIndex(); @@ -3695,7 +3696,7 @@ static const char* const mixedTags[] = { static int SkipMixedContent ( const char* ptr ) { - for (int i = 0; i < sizeof (mixedTags); i++) { + for (size_t i = 0; i < sizeof (mixedTags); i++) { const char* tag = mixedTags[i]; const char* tmp = ptr; int len = 0; @@ -3772,7 +3773,7 @@ void CWordPairIndexer::PopulateWordPairIndex (string str) } // convert non-alphanumeric punctuation to space - for (int i = 0; i < str.length(); i++) { + for (size_t i = 0; i < str.length(); i++) { char ch = str[i]; if (ch >= 'A' && ch <= 'Z') { } else if (ch >= 'a' && ch <= 'z') { diff --git a/c++/src/objtools/CMakeLists.txt b/c++/src/objtools/CMakeLists.txt index cba584e3..cbfd0abe 100644 --- a/c++/src/objtools/CMakeLists.txt +++ b/c++/src/objtools/CMakeLists.txt @@ -1,8 +1,9 @@ -# $Id: CMakeLists.txt 621735 2020-12-16 15:47:41Z ivanov $ +# $Id: CMakeLists.txt 680762 2024-03-27 13:50:01Z ivanov $ NCBI_add_subdirectory( unit_test_util readers blast lds2 data_loaders simple - alnmgr cddalignview test manip cleanup format edit validator + alnmgr cddalignview test manip cleanup format edit + huge_asn validator asniotest align seqmasks_io eutils align_format snputil uudutil variation writers pubseq_gateway logging import flatfile diff --git a/c++/src/objtools/Makefile.in b/c++/src/objtools/Makefile.in index 6d57140e..459f4852 100644 --- a/c++/src/objtools/Makefile.in +++ b/c++/src/objtools/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in 623638 2021-01-14 22:08:07Z foleyjp $ +# $Id: Makefile.in 680762 2024-03-27 13:50:01Z ivanov $ # Meta-makefile("objtools" project) ################################# @@ -7,7 +7,8 @@ REQUIRES = objects SUB_PROJ = logging unit_test_util readers blast lds2 pubseq_gateway \ data_loaders simple \ - alnmgr cddalignview test manip eutils edit cleanup format validator \ + alnmgr cddalignview test manip eutils edit cleanup format \ + huge_asn validator \ asniotest align seqmasks_io \ align_format snputil uudutil variation writers \ import flatfile diff --git a/c++/src/objtools/align_format/align_format_util.cpp b/c++/src/objtools/align_format/align_format_util.cpp index 61a63e07..a0da12ae 100644 --- a/c++/src/objtools/align_format/align_format_util.cpp +++ b/c++/src/objtools/align_format/align_format_util.cpp @@ -1,4 +1,4 @@ -/* $Id: align_format_util.cpp 672590 2023-09-11 18:10:05Z ivanov $ +/* $Id: align_format_util.cpp 683948 2024-06-10 12:11:11Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -56,7 +56,7 @@ #include #include #include -#include +#include #include #include #include @@ -90,7 +90,7 @@ const char k_PSymbol[ePMatrixSize+1] = unique_ptr CAlignFormatUtil::m_Reg; string CAlignFormatUtil::m_Protocol = ""; bool CAlignFormatUtil::m_geturl_debug_flag = false; -unique_ptr CAlignFormatUtil::m_GeneInfoReader; + ///Get blast score information ///@param scoreList: score container to extract score info from ///@param score: place to extract the raw score to @@ -102,11 +102,11 @@ unique_ptr CAlignFormatUtil::m_GeneInfoReader; ///@return true if found score, false otherwise /// template bool -s_GetBlastScore(const container& scoreList, - int& score, - double& bits, - double& evalue, - int& sum_n, +s_GetBlastScore(const container& scoreList, + int& score, + double& bits, + double& evalue, + int& sum_n, int& num_ident, list& use_this_gi, int& comp_adj_method) @@ -114,7 +114,7 @@ s_GetBlastScore(const container& scoreList, const string k_GiPrefix = "gi:"; bool hasScore = false; ITERATE (typename container, iter, scoreList) { - const CObject_id& id=(*iter)->GetId(); + const CObject_id& id=(*iter)->GetId(); if (id.IsStr()) { if (id.GetStr()=="score"){ score = (*iter)->GetValue().GetInt(); @@ -127,18 +127,18 @@ s_GetBlastScore(const container& scoreList, Uint4 gi_v = (Uint4)((*iter)->GetValue().GetInt()); use_this_gi.push_back(GI_FROM(Uint4, gi_v)); } else if (id.GetStr()=="sum_n"){ - sum_n = (*iter)->GetValue().GetInt(); + sum_n = (*iter)->GetValue().GetInt(); } else if (id.GetStr()=="num_ident"){ num_ident = (*iter)->GetValue().GetInt(); } else if (id.GetStr()=="comp_adjustment_method") { comp_adj_method = (*iter)->GetValue().GetInt(); - } + } else if(NStr::StartsWith(id.GetStr(),k_GiPrefix)) { //will be used when switch to 64bit GIs string strGi = NStr::Replace(id.GetStr(),k_GiPrefix,""); TGi gi = NStr::StringToNumeric(strGi); use_this_gi.push_back(gi); } - } + } } return hasScore; @@ -151,8 +151,8 @@ s_GetBlastScore(const container& scoreList, ///@param line_len: length of each line desired ///@param out: stream to ouput /// -void CAlignFormatUtil::x_WrapOutputLine(string str, size_t line_len, - CNcbiOstream& out, bool html) +void CAlignFormatUtil::x_WrapOutputLine(string str, size_t line_len, + CNcbiOstream& out, bool html) { list string_l; NStr::TWrapFlags flags = NStr::fWrap_FlatFile; @@ -169,21 +169,21 @@ void CAlignFormatUtil::x_WrapOutputLine(string str, size_t line_len, iter++; } } - -void CAlignFormatUtil::BlastPrintError(list& - error_return, + +void CAlignFormatUtil::BlastPrintError(list& + error_return, bool error_post, CNcbiOstream& out) { - + string errsevmsg[] = { "UNKNOWN","INFO","WARNING","ERROR", "FATAL"}; - + NON_CONST_ITERATE(list, iter, error_return) { - + if(iter->level > 5){ iter->level = eDiag_Info; } - + if(iter->level == 4){ iter->level = eDiag_Fatal; } else{ @@ -194,14 +194,14 @@ void CAlignFormatUtil::BlastPrintError(list& ERR_POST_EX(iter->level, 0, iter->message); } out << errsevmsg[iter->level] << ": " << iter->message << "\n"; - + } } void CAlignFormatUtil::PrintTildeSepLines(string str, size_t line_len, CNcbiOstream& out) { - + vector split_line; NStr::Split(str, "~", split_line); ITERATE(vector, iter, split_line) { @@ -214,7 +214,7 @@ void CAlignFormatUtil::PrintTildeSepLines(string str, size_t line_len, /// @param info structure to fill [in|out] /// @return true if successfully filled, false otherwise (and a warning is /// printed out) -static bool s_FillDbInfoRemotely(const string& dbname, +static bool s_FillDbInfoRemotely(const string& dbname, CAlignFormatUtil::SDbInfo& info) { static CBlastServices rmt_blast_services; @@ -222,7 +222,7 @@ static bool s_FillDbInfoRemotely(const string& dbname, blastdb->SetName(dbname); blastdb->SetType() = info.is_protein ? eBlast4_residue_type_protein : eBlast4_residue_type_nucleotide; - CRef dbinfo = + CRef dbinfo = rmt_blast_services.GetDatabaseInfo(blastdb); info.name = dbname; @@ -249,10 +249,10 @@ static bool s_FillDbInfoRemotely(const string& dbname, /// printed out) static bool s_FillDbInfoLocally(const string& dbname, - CAlignFormatUtil::SDbInfo& info, + CAlignFormatUtil::SDbInfo& info, int dbfilt_algorithm) { - CRef seqdb(new CSeqDB(dbname, info.is_protein + CRef seqdb(new CSeqDB(dbname, info.is_protein ? CSeqDB::eProtein : CSeqDB::eNucleotide)); if ( !seqdb ) { return false; @@ -276,14 +276,14 @@ s_FillDbInfoLocally(const string& dbname, (!defined(NCBI_COMPILER_MIPSPRO)) ) string filtering_algorithm; seqdb->GetMaskAlgorithmDetails(dbfilt_algorithm, - filtering_algorithm, - info.filt_algorithm_name, + filtering_algorithm, + info.filt_algorithm_name, info.filt_algorithm_options); #endif return true; } -void +void CAlignFormatUtil::FillScanModeBlastDbInfo(vector& retval, bool is_protein, int numSeqs, Int8 numLetters, string& tag) { @@ -294,7 +294,7 @@ CAlignFormatUtil::FillScanModeBlastDbInfo(vector& ret info.definition = string("User specified sequence set."); else { - info.definition = string("User specified sequence set ") + + info.definition = string("User specified sequence set ") + string("(Input: ") + tag + string(")."); } info.number_seqs = numSeqs; @@ -326,7 +326,7 @@ CAlignFormatUtil::GetBlastDbInfo(vector& retval, for(size_t ndx=0 ; ndx < all_db_info.size(); ndx++){ CAlignFormatUtil::SDbInfo info; objects::CBlast4_database_info &dbinfo = *all_db_info[ndx]; - info.name = dbinfo.GetDatabase().GetName(); + info.name = dbinfo.GetDatabase().GetName(); info.definition = dbinfo.GetDescription(); if (info.definition.empty()) info.definition = info.name; @@ -345,7 +345,7 @@ CAlignFormatUtil::GetBlastDbInfo(vector& retval, } retval.push_back(info); } - return; + return; } else{ vector dbs; @@ -379,9 +379,9 @@ CAlignFormatUtil::GetBlastDbInfo(vector& retval, } void CAlignFormatUtil::PrintDbReport(const vector& dbinfo_list, - size_t line_length, + size_t line_length, CNcbiOstream& out, - bool top) + bool top) { if (top) { const CAlignFormatUtil::SDbInfo* dbinfo = &(dbinfo_list.front()); @@ -406,9 +406,9 @@ void CAlignFormatUtil::PrintDbReport(const vector& dbinfo_list, out << endl; } CAlignFormatUtil::AddSpace(out, 11); - out << NStr::Int8ToString(tot_num_seqs, NStr::fWithCommas) << + out << NStr::Int8ToString(tot_num_seqs, NStr::fWithCommas) << " sequences; " << - NStr::Int8ToString(tot_length, NStr::fWithCommas) << + NStr::Int8ToString(tot_length, NStr::fWithCommas) << " total letters\n\n"; return; } @@ -428,21 +428,21 @@ void CAlignFormatUtil::PrintDbReport(const vector& dbinfo_list, out << " Posted date: "; out << dbinfo->date << "\n"; - - out << " Number of letters in database: "; - out << NStr::Int8ToString(dbinfo->total_length, + + out << " Number of letters in database: "; + out << NStr::Int8ToString(dbinfo->total_length, NStr::fWithCommas) << "\n"; out << " Number of sequences in database: "; - out << NStr::IntToString(dbinfo->number_seqs, + out << NStr::IntToString(dbinfo->number_seqs, NStr::fWithCommas) << "\n"; - + } else { out << " Subset of the database(s) listed below" << "\n"; - out << " Number of letters searched: "; - out << NStr::Int8ToString(dbinfo->total_length, + out << " Number of letters searched: "; + out << NStr::Int8ToString(dbinfo->total_length, NStr::fWithCommas) << "\n"; out << " Number of sequences searched: "; - out << NStr::IntToString(dbinfo->number_seqs, + out << NStr::IntToString(dbinfo->number_seqs, NStr::fWithCommas) << "\n"; } out << "\n"; @@ -450,14 +450,14 @@ void CAlignFormatUtil::PrintDbReport(const vector& dbinfo_list, } -void CAlignFormatUtil::PrintKAParameters(double lambda, double k, double h, - size_t line_len, - CNcbiOstream& out, bool gapped, +void CAlignFormatUtil::PrintKAParameters(double lambda, double k, double h, + size_t line_len, + CNcbiOstream& out, bool gapped, const Blast_GumbelBlk *gbp) { char buffer[256]; - if (gapped) { + if (gapped) { out << "Gapped" << "\n"; } out << "Lambda K H"; @@ -557,11 +557,11 @@ CAlignFormatUtil::GetSeqDescrString(const CBioseq& cbs) return all_descr_str; } -void CAlignFormatUtil::AcknowledgeBlastQuery(const CBioseq& cbs, +void CAlignFormatUtil::AcknowledgeBlastQuery(const CBioseq& cbs, size_t line_len, CNcbiOstream& out, bool believe_query, - bool html, + bool html, bool tabular /* = false */, const string& rid /* = kEmptyStr*/) { @@ -571,12 +571,12 @@ void CAlignFormatUtil::AcknowledgeBlastQuery(const CBioseq& cbs, label, tabular, rid); } -void -CAlignFormatUtil::AcknowledgeBlastSubject(const CBioseq& cbs, +void +CAlignFormatUtil::AcknowledgeBlastSubject(const CBioseq& cbs, size_t line_len, CNcbiOstream& out, bool believe_query, - bool html, + bool html, bool tabular /* = false */) { const string label("Subject"); @@ -585,12 +585,12 @@ CAlignFormatUtil::AcknowledgeBlastSubject(const CBioseq& cbs, label, tabular, kEmptyStr); } -void -CAlignFormatUtil::x_AcknowledgeBlastSequence(const CBioseq& cbs, +void +CAlignFormatUtil::x_AcknowledgeBlastSequence(const CBioseq& cbs, size_t line_len, CNcbiOstream& out, bool believe_query, - bool html, + bool html, const string& label, bool tabular /* = false */, const string& rid /* = kEmptyStr*/) @@ -603,7 +603,7 @@ CAlignFormatUtil::x_AcknowledgeBlastSequence(const CBioseq& cbs, } else { out << label << "= "; } - + string all_id_str = GetSeqIdString(cbs, believe_query); all_id_str += " "; all_id_str = NStr::TruncateSpaces(all_id_str + GetSeqDescrString(cbs)); @@ -653,10 +653,10 @@ void CAlignFormatUtil::PrintPhiInfo(int num_patterns, out << "pattern probability=" << prob << "\n"; } - + void CAlignFormatUtil::GetAlnScores(const CSeq_align& aln, - int& score, - double& bits, + int& score, + double& bits, double& evalue, int& sum_n, int& num_ident, @@ -664,13 +664,13 @@ void CAlignFormatUtil::GetAlnScores(const CSeq_align& aln, { int comp_adj_method = 0; // dummy variable - CAlignFormatUtil::GetAlnScores(aln, score, bits, evalue, sum_n, + CAlignFormatUtil::GetAlnScores(aln, score, bits, evalue, sum_n, num_ident, use_this_gi, comp_adj_method); } void CAlignFormatUtil::GetAlnScores(const CSeq_align& aln, - int& score, - double& bits, + int& score, + double& bits, double& evalue, int& sum_n, int& num_ident, @@ -678,14 +678,14 @@ void CAlignFormatUtil::GetAlnScores(const CSeq_align& aln, { int comp_adj_method = 0; // dummy variable - CAlignFormatUtil::GetAlnScores(aln, score, bits, evalue, sum_n, + CAlignFormatUtil::GetAlnScores(aln, score, bits, evalue, sum_n, num_ident, use_this_seq, comp_adj_method); } void CAlignFormatUtil::GetAlnScores(const CSeq_align& aln, - int& score, - double& bits, + int& score, + double& bits, double& evalue, int& sum_n, int& num_ident, @@ -699,25 +699,25 @@ void CAlignFormatUtil::GetAlnScores(const CSeq_align& aln, sum_n = -1; num_ident = -1; comp_adj_method = 0; - + //look for scores at seqalign level first - hasScore = s_GetBlastScore(aln.GetScore(), score, bits, evalue, + hasScore = s_GetBlastScore(aln.GetScore(), score, bits, evalue, sum_n, num_ident, use_this_gi, comp_adj_method); - + //look at the seg level if(!hasScore){ const CSeq_align::TSegs& seg = aln.GetSegs(); if(seg.Which() == CSeq_align::C_Segs::e_Std){ - s_GetBlastScore(seg.GetStd().front()->GetScores(), + s_GetBlastScore(seg.GetStd().front()->GetScores(), score, bits, evalue, sum_n, num_ident, use_this_gi, comp_adj_method); } else if (seg.Which() == CSeq_align::C_Segs::e_Dendiag){ - s_GetBlastScore(seg.GetDendiag().front()->GetScores(), + s_GetBlastScore(seg.GetDendiag().front()->GetScores(), score, bits, evalue, sum_n, num_ident, use_this_gi, comp_adj_method); } else if (seg.Which() == CSeq_align::C_Segs::e_Denseg){ - s_GetBlastScore(seg.GetDenseg().GetScores(), + s_GetBlastScore(seg.GetDenseg().GetScores(), score, bits, evalue, sum_n, num_ident, use_this_gi, comp_adj_method); } - } + } if(use_this_gi.size() == 0) { GetUseThisSequence(aln,use_this_gi); } @@ -728,16 +728,16 @@ static list s_NumGiToStringGiList(list use_this_gi)//for backward c { const string k_GiPrefix = "gi:"; list use_this_seq; - ITERATE(list, iter_gi, use_this_gi){ + ITERATE(list, iter_gi, use_this_gi){ string strSeq = k_GiPrefix + NStr::NumericToString(*iter_gi); - use_this_seq.push_back(strSeq); - } + use_this_seq.push_back(strSeq); + } return use_this_seq; } void CAlignFormatUtil::GetAlnScores(const CSeq_align& aln, - int& score, - double& bits, + int& score, + double& bits, double& evalue, int& sum_n, int& num_ident, @@ -754,23 +754,23 @@ void CAlignFormatUtil::GetAlnScores(const CSeq_align& aln, list use_this_gi; //look for scores at seqalign level first - hasScore = s_GetBlastScore(aln.GetScore(), score, bits, evalue, + hasScore = s_GetBlastScore(aln.GetScore(), score, bits, evalue, sum_n, num_ident, use_this_gi, comp_adj_method); - + //look at the seg level if(!hasScore){ const CSeq_align::TSegs& seg = aln.GetSegs(); if(seg.Which() == CSeq_align::C_Segs::e_Std){ - s_GetBlastScore(seg.GetStd().front()->GetScores(), + s_GetBlastScore(seg.GetStd().front()->GetScores(), score, bits, evalue, sum_n, num_ident, use_this_gi, comp_adj_method); } else if (seg.Which() == CSeq_align::C_Segs::e_Dendiag){ - s_GetBlastScore(seg.GetDendiag().front()->GetScores(), + s_GetBlastScore(seg.GetDendiag().front()->GetScores(), score, bits, evalue, sum_n, num_ident, use_this_gi, comp_adj_method); } else if (seg.Which() == CSeq_align::C_Segs::e_Denseg){ - s_GetBlastScore(seg.GetDenseg().GetScores(), + s_GetBlastScore(seg.GetDenseg().GetScores(), score, bits, evalue, sum_n, num_ident, use_this_gi, comp_adj_method); } - } + } if(use_this_gi.size() == 0) { GetUseThisSequence(aln,use_this_seq); } @@ -797,27 +797,26 @@ string CAlignFormatUtil::GetLabel(CConstRef id,bool with_version) if (id->Which() == CSeq_id::e_General){ const CDbtag& dtg = id->GetGeneral(); retval = CAlignFormatUtil::GetGnlID(dtg); - } + } if (retval == "") retval = id->GetSeqIdString(with_version); return retval; } -void CAlignFormatUtil::AddSpace(CNcbiOstream& out, int number) +void CAlignFormatUtil::AddSpace(CNcbiOstream& out, size_t number) { - for(int i=0; i 99999){ snprintf(bit_score_buf, sizeof(bit_score_buf), "%5.3le", bit_score); } else if (bit_score > 99.9){ @@ -869,7 +868,7 @@ void CAlignFormatUtil::GetScoreString(double evalue, bit_score); } if (total_bit_score > 99999){ - snprintf(total_bit_score_buf, sizeof(total_bit_score_buf), "%5.3le", + snprintf(total_bit_score_buf, sizeof(total_bit_score_buf), "%5.3le", total_bit_score); } else if (total_bit_score > 99.9){ snprintf(total_bit_score_buf, sizeof(total_bit_score_buf), "%3.0ld", @@ -887,14 +886,14 @@ void CAlignFormatUtil::GetScoreString(double evalue, } -void CAlignFormatUtil::PruneSeqalign(const CSeq_align_set& source_aln, +void CAlignFormatUtil::PruneSeqalign(const CSeq_align_set& source_aln, CSeq_align_set& new_aln, unsigned int number) { - CConstRef previous_id, subid; + CConstRef previous_id, subid; bool is_first_aln = true; - unsigned int num_align = 0; - ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){ + unsigned int num_align = 0; + ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){ if ((*iter)->GetSegs().IsDisc()) { ++num_align; @@ -911,18 +910,18 @@ void CAlignFormatUtil::PruneSeqalign(const CSeq_align_set& source_aln, is_first_aln = false; previous_id = subid; } - new_aln.Set().push_back(*iter); + new_aln.Set().push_back(*iter); } } -unsigned int CAlignFormatUtil::GetSubjectsNumber(const CSeq_align_set& source_aln, +unsigned int CAlignFormatUtil::GetSubjectsNumber(const CSeq_align_set& source_aln, unsigned int number) { - CConstRef previous_id, subid; + CConstRef previous_id, subid; bool is_first_aln = true; - unsigned int num_align = 0; - ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){ + unsigned int num_align = 0; + ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){ if ((*iter)->GetSegs().IsDisc()) { ++num_align; @@ -938,21 +937,21 @@ unsigned int CAlignFormatUtil::GetSubjectsNumber(const CSeq_align_set& source_al is_first_aln = false; previous_id = subid; - } + } } return num_align; } -void CAlignFormatUtil::PruneSeqalignAll(const CSeq_align_set& source_aln, +void CAlignFormatUtil::PruneSeqalignAll(const CSeq_align_set& source_aln, CSeq_align_set& new_aln, unsigned int number) { - CConstRef previous_id, subid; + CConstRef previous_id, subid; bool is_first_aln = true; unsigned int num_align = 0; bool finishCurrent = false; - ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){ + ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){ if ((*iter)->GetSegs().IsDisc()) { ++num_align; } else { @@ -972,8 +971,8 @@ void CAlignFormatUtil::PruneSeqalignAll(const CSeq_align_set& source_aln, } -void -CAlignFormatUtil::GetAlignLengths(CAlnVec& salv, int& align_length, +void +CAlignFormatUtil::GetAlignLengths(CAlnVec& salv, int& align_length, int& num_gaps, int& num_gap_opens) { num_gaps = num_gap_opens = align_length = 0; @@ -997,12 +996,12 @@ CAlignFormatUtil::GetAlignLengths(CAlnVec& salv, int& align_length, } } -void +void CAlignFormatUtil::ExtractSeqalignSetFromDiscSegs(CSeq_align_set& target, const CSeq_align_set& source) { if (source.IsSet() && source.CanGet()) { - + for(CSeq_align_set::Tdata::const_iterator iter = source.Get().begin(); iter != source.Get().end(); iter++) { if((*iter)->IsSetSegs()){ @@ -1010,7 +1009,7 @@ CAlignFormatUtil::ExtractSeqalignSetFromDiscSegs(CSeq_align_set& target, if(seg.IsDisc()){ const CSeq_align_set& set = seg.GetDisc(); for(CSeq_align_set::Tdata::const_iterator iter2 = - set.Get().begin(); iter2 != set.Get().end(); + set.Get().begin(); iter2 != set.Get().end(); iter2 ++) { target.Set().push_back(*iter2); } @@ -1022,14 +1021,14 @@ CAlignFormatUtil::ExtractSeqalignSetFromDiscSegs(CSeq_align_set& target, } } -CRef -CAlignFormatUtil::CreateDensegFromDendiag(const CSeq_align& aln) +CRef +CAlignFormatUtil::CreateDensegFromDendiag(const CSeq_align& aln) { CRef sa(new CSeq_align); if ( !aln.GetSegs().IsDendiag()) { NCBI_THROW(CException, eUnknown, "Input Seq-align should be Dendiag!"); } - + if(aln.IsSetType()){ sa->SetType(aln.GetType()); } @@ -1042,13 +1041,13 @@ CAlignFormatUtil::CreateDensegFromDendiag(const CSeq_align& aln) if(aln.IsSetBounds()){ sa->SetBounds() = aln.GetBounds(); } - + CDense_seg& ds = sa->SetSegs().SetDenseg(); - + int counter = 0; ds.SetNumseg() = 0; ITERATE (CSeq_align::C_Segs::TDendiag, iter, aln.GetSegs().GetDendiag()){ - + if(counter == 0){//assume all dendiag segments have same dim and ids if((*iter)->IsSetDim()){ ds.SetDim((*iter)->GetDim()); @@ -1079,7 +1078,7 @@ CAlignFormatUtil::CreateDensegFromDendiag(const CSeq_align& aln) } counter ++; } - + return sa; } @@ -1088,26 +1087,26 @@ TTaxId CAlignFormatUtil::GetTaxidForSeqid(const CSeq_id& id, CScope& scope) TTaxId taxid = ZERO_TAX_ID; try{ const CBioseq_Handle& handle = scope.GetBioseqHandle(id); - const CRef bdlRef = + const CRef bdlRef = CSeqDB::ExtractBlastDefline(handle); const list< CRef< CBlast_def_line > > &bdl = (bdlRef.Empty()) ? list< CRef< CBlast_def_line > >() : bdlRef->Get(); ITERATE(list >, iter_bdl, bdl) { - CConstRef bdl_id = + CConstRef bdl_id = GetSeq_idByType((*iter_bdl)->GetSeqid(), id.Which()); - if(bdl_id && bdl_id->Match(id) && + if(bdl_id && bdl_id->Match(id) && (*iter_bdl)->IsSetTaxid() && (*iter_bdl)->CanGetTaxid()){ taxid = (*iter_bdl)->GetTaxid(); break; } } } catch (CException&) { - + } return taxid; } -int CAlignFormatUtil::GetFrame (int start, ENa_strand strand, - const CBioseq_Handle& handle) +int CAlignFormatUtil::GetFrame (int start, ENa_strand strand, + const CBioseq_Handle& handle) { int frame = 0; if (strand == eNa_strand_plus) { @@ -1115,7 +1114,7 @@ int CAlignFormatUtil::GetFrame (int start, ENa_strand strand, } else if (strand == eNa_strand_minus) { frame = -(((int)handle.GetBioseqLength() - start - 1) % 3 + 1); - + } return frame; } @@ -1135,34 +1134,34 @@ SortHitByPercentIdentityDescending(list< CRef >& bool CAlignFormatUtil:: SortHspByPercentIdentityDescending(const CRef& info1, - const CRef& info2) + const CRef& info2) { - + int score1, sum_n1, num_ident1; double bits1, evalue1; list use_this_gi1; - + int score2, sum_n2, num_ident2; double bits2, evalue2; list use_this_gi2; - - + + GetAlnScores(*info1, score1, bits1, evalue1, sum_n1, num_ident1, use_this_gi1); GetAlnScores(*info2, score2, bits2, evalue2, sum_n2, num_ident2, use_this_gi2); int length1 = GetAlignmentLength(*info1, kTranslation); int length2 = GetAlignmentLength(*info2, kTranslation); bool retval = false; - - + + if(length1 > 0 && length2 > 0 && num_ident1 > 0 &&num_ident2 > 0 ) { if (((double)num_ident1)/length1 == ((double)num_ident2)/length2) { - + retval = evalue1 < evalue2; - + } else { retval = ((double)num_ident1)/length1 >= ((double)num_ident2)/length2; - + } } else { retval = evalue1 < evalue2; @@ -1172,22 +1171,22 @@ SortHspByPercentIdentityDescending(const CRef& info1, bool CAlignFormatUtil:: SortHitByScoreDescending(const CRef& info1, - const CRef& info2) + const CRef& info2) { CRef i1(info1), i2(info2); - + i1->Set().sort(SortHspByScoreDescending); i2->Set().sort(SortHspByScoreDescending); - - + + int score1, sum_n1, num_ident1; double bits1, evalue1; list use_this_gi1; - + int score2, sum_n2, num_ident2; double bits2, evalue2; list use_this_gi2; - + GetAlnScores(*(info1->Get().front()), score1, bits1, evalue1, sum_n1, num_ident1, use_this_gi1); GetAlnScores(*(info2->Get().front()), score2, bits2, evalue2, sum_n2, num_ident2, use_this_gi2); return bits1 > bits2; @@ -1195,7 +1194,7 @@ SortHitByScoreDescending(const CRef& info1, bool CAlignFormatUtil:: SortHitByMasterCoverageDescending(CRef const& info1, - CRef const& info2) + CRef const& info2) { int cov1 = GetMasterCoverage(*info1); int cov2 = GetMasterCoverage(*info2); @@ -1207,7 +1206,7 @@ SortHitByMasterCoverageDescending(CRef const& info1, int score1, sum_n1, num_ident1; double bits1, evalue1; list use_this_gi1; - + int score2, sum_n2, num_ident2; double bits2, evalue2; list use_this_gi2; @@ -1223,34 +1222,34 @@ bool CAlignFormatUtil::SortHitByMasterStartAscending(CRef& info1 CRef& info2) { int start1 = 0, start2 = 0; - - + + info1->Set().sort(SortHspByMasterStartAscending); info2->Set().sort(SortHspByMasterStartAscending); - - + + start1 = min(info1->Get().front()->GetSeqStart(0), info1->Get().front()->GetSeqStop(0)); start2 = min(info2->Get().front()->GetSeqStart(0), info2->Get().front()->GetSeqStop(0)); - + if (start1 == start2) { //same start then arrange by bits score int score1, sum_n1, num_ident1; double bits1, evalue1; list use_this_gi1; - + int score2, sum_n2, num_ident2; double bits2, evalue2; list use_this_gi2; - - + + GetAlnScores(*(info1->Get().front()), score1, bits1, evalue1, sum_n1, num_ident1, use_this_gi1); GetAlnScores(*(info1->Get().front()), score2, bits2, evalue2, sum_n2, num_ident2, use_this_gi2); return evalue1 < evalue2; - + } else { - return start1 < start2; + return start1 < start2; } } @@ -1259,89 +1258,89 @@ bool CAlignFormatUtil:: SortHspByScoreDescending(const CRef& info1, const CRef& info2) { - + int score1, sum_n1, num_ident1; double bits1, evalue1; list use_this_gi1; - + int score2, sum_n2, num_ident2; double bits2, evalue2; list use_this_gi2; - - + + GetAlnScores(*info1, score1, bits1, evalue1, sum_n1, num_ident1, use_this_gi1); GetAlnScores(*info2, score2, bits2, evalue2, sum_n2, num_ident2, use_this_gi2); return bits1 > bits2; - -} + +} bool CAlignFormatUtil:: SortHspByMasterStartAscending(const CRef& info1, - const CRef& info2) + const CRef& info2) { int start1 = 0, start2 = 0; - + start1 = min(info1->GetSeqStart(0), info1->GetSeqStop(0)); start2 = min(info2->GetSeqStart(0), info2->GetSeqStop(0)) ; - + if (start1 == start2) { //same start then arrange by bits score int score1, sum_n1, num_ident1; double bits1, evalue1; list use_this_gi1; - + int score2, sum_n2, num_ident2; double bits2, evalue2; list use_this_gi2; - - + + GetAlnScores(*info1, score1, bits1, evalue1, sum_n1, num_ident1, use_this_gi1); GetAlnScores(*info2, score2, bits2, evalue2, sum_n2, num_ident2, use_this_gi2); return evalue1 < evalue2; - + } else { - - return start1 < start2; - } + + return start1 < start2; + } } bool CAlignFormatUtil:: SortHspBySubjectStartAscending(const CRef& info1, - const CRef& info2) + const CRef& info2) { int start1 = 0, start2 = 0; - + start1 = min(info1->GetSeqStart(1), info1->GetSeqStop(1)); start2 = min(info2->GetSeqStart(1), info2->GetSeqStop(1)) ; - + if (start1 == start2) { //same start then arrange by bits score int score1, sum_n1, num_ident1; double bits1, evalue1; list use_this_gi1; - + int score2, sum_n2, num_ident2; double bits2, evalue2; list use_this_gi2; - - + + GetAlnScores(*info1, score1, bits1, evalue1, sum_n1, num_ident1, use_this_gi1); GetAlnScores(*info2, score2, bits2, evalue2, sum_n2, num_ident2, use_this_gi2); return evalue1 < evalue2; - + } else { - - return start1 < start2; - } + + return start1 < start2; + } } int CAlignFormatUtil::GetAlignmentLength(const CSeq_align& aln, bool do_translation) { - + CRef final_aln; - + // Convert Std-seg and Dense-diag alignments to Dense-seg. - // Std-segs are produced only for translated searches; Dense-diags only for + // Std-segs are produced only for translated searches; Dense-diags only for // ungapped, not translated searches. if (aln.GetSegs().IsStd()) { @@ -1352,15 +1351,15 @@ int CAlignFormatUtil::GetAlignmentLength(const CSeq_align& aln, bool do_translat final_aln = denseg_aln->CreateTranslatedDensegFromNADenseg(); } else { final_aln = denseg_aln; - + } } else if (aln.GetSegs().IsDendiag()) { final_aln = CreateDensegFromDendiag(aln); - } + } const CDense_seg& ds = (final_aln ? final_aln->GetSegs().GetDenseg() : aln.GetSegs().GetDenseg()); - + CAlnMap alnmap(ds); return alnmap.GetAlnStop() + 1; } @@ -1370,9 +1369,9 @@ double CAlignFormatUtil::GetPercentIdentity(const CSeq_align& aln, bool do_translation) { double identity = 0; CRef final_aln; - + // Convert Std-seg and Dense-diag alignments to Dense-seg. - // Std-segs are produced only for translated searches; Dense-diags only for + // Std-segs are produced only for translated searches; Dense-diags only for // ungapped, not translated searches. if (aln.GetSegs().IsStd()) { @@ -1383,15 +1382,15 @@ double CAlignFormatUtil::GetPercentIdentity(const CSeq_align& aln, final_aln = denseg_aln->CreateTranslatedDensegFromNADenseg(); } else { final_aln = denseg_aln; - + } } else if (aln.GetSegs().IsDendiag()) { final_aln = CreateDensegFromDendiag(aln); - } + } const CDense_seg& ds = (final_aln ? final_aln->GetSegs().GetDenseg() : aln.GetSegs().GetDenseg()); - + CAlnVec alnvec(ds, scope); string query, subject; @@ -1400,14 +1399,14 @@ double CAlignFormatUtil::GetPercentIdentity(const CSeq_align& aln, alnvec.GetWholeAlnSeqString(1, subject); int num_ident = 0; - int length = min(query.size(), subject.size()); + int length = (int)min(query.size(), subject.size()); for (int i = 0; i < length; ++i) { if (query[i] == subject[i]) { ++num_ident; } } - + if (length > 0) { identity = ((double)num_ident)/length; } @@ -1421,17 +1420,17 @@ static void s_CalcAlnPercentIdent(const CRef& info1, double &percentIdent1, double &percentIdent2) { - + CRef i1(info1), i2(info2); percentIdent1 = -1; percentIdent2 = -1; i1->Set().sort(CAlignFormatUtil::SortHspByPercentIdentityDescending); i2->Set().sort(CAlignFormatUtil::SortHspByPercentIdentityDescending); - + percentIdent1 = CAlignFormatUtil::GetSeqAlignSetCalcPercentIdent(*info1, kTranslation); percentIdent2 = CAlignFormatUtil::GetSeqAlignSetCalcPercentIdent(*info2, kTranslation); - return; + return; } @@ -1439,9 +1438,9 @@ bool CAlignFormatUtil:: SortHitByPercentIdentityDescendingEx(const CRef& info1, const CRef& info2) { - + CRef i1(info1), i2(info2); - + //i1->Set().sort(SortHspByPercentIdentityDescending); //i2->Set().sort(SortHspByPercentIdentityDescending); @@ -1451,22 +1450,22 @@ SortHitByPercentIdentityDescendingEx(const CRef& info1, double evalue1 = seqSetInfo1->evalue; double evalue2 = seqSetInfo2->evalue; double percentIdent1 = seqSetInfo1->percent_identity; - double percentIdent2 = seqSetInfo2->percent_identity; - + double percentIdent2 = seqSetInfo2->percent_identity; + bool retval = false; if(percentIdent1 < 0 || percentIdent2 < 0) { s_CalcAlnPercentIdent(info1, info2,percentIdent1,percentIdent2); } if(percentIdent1 > 0 &&percentIdent2 > 0) { - if (percentIdent1 == percentIdent2) { + if (percentIdent1 == percentIdent2) { retval = evalue1 < evalue2; - + } else { - retval = percentIdent1 >= percentIdent2; + retval = percentIdent1 >= percentIdent2; } } else { retval = evalue1 < evalue2; - } + } return retval; } @@ -1477,26 +1476,26 @@ bool CAlignFormatUtil::SortHitByTotalScoreDescending(CRef const& double bits, evalue; list use_this_gi; double total_bits1 = 0, total_bits2 = 0; - - ITERATE(CSeq_align_set::Tdata, iter, info1->Get()) { + + ITERATE(CSeq_align_set::Tdata, iter, info1->Get()) { CAlignFormatUtil::GetAlnScores(**iter, score1, bits, evalue, sum_n, num_ident, use_this_gi); total_bits1 += bits; } - - ITERATE(CSeq_align_set::Tdata, iter, info2->Get()) { + + ITERATE(CSeq_align_set::Tdata, iter, info2->Get()) { CAlignFormatUtil::GetAlnScores(**iter, score2, bits, evalue, sum_n, num_ident, use_this_gi); total_bits2 += bits; - } - - + } + + return total_bits1 >= total_bits2; - + } #ifndef NCBI_COMPILER_WORKSHOP -/** Class to sort by linkout bit +/** Class to sort by linkout bit * @note this code doesn't compile under the Solaris' WorkShop, and because * this feature is only used inside NCBI (LinkoutDB), we disable this code. */ @@ -1507,18 +1506,18 @@ public: const string& mv_build_name) : m_LinkoutDB(linkoutdb), m_MapViewerBuildName(mv_build_name) {} - bool operator() (const CRef& info1, const CRef& info2) + bool operator() (const CRef& info1, const CRef& info2) { CConstRef id1, id2; id1 = &(info1->Get().front()->GetSeq_id(1)); id2 = &(info2->Get().front()->GetSeq_id(1)); int linkout1 = 0, linkout2 = 0; - linkout1 = m_LinkoutDB - ? m_LinkoutDB->GetLinkout(*id1, m_MapViewerBuildName) + linkout1 = m_LinkoutDB + ? m_LinkoutDB->GetLinkout(*id1, m_MapViewerBuildName) : 0; - linkout2 = m_LinkoutDB - ? m_LinkoutDB->GetLinkout(*id2, m_MapViewerBuildName) + linkout2 = m_LinkoutDB + ? m_LinkoutDB->GetLinkout(*id2, m_MapViewerBuildName) : 0; return (linkout1 & eGenomicSeq) <= (linkout2 & eGenomicSeq); @@ -1544,11 +1543,11 @@ SortHitByMolecularType(list< CRef >& seqalign_hit_list, void CAlignFormatUtil::SortHit(list< CRef >& seqalign_hit_list, bool do_translation, CScope& scope, int sort_method, ILinkoutDB* linkoutdb, - const string& mv_build_name) + const string& mv_build_name) { - kScope = &scope; + kScope = &scope; kTranslation = do_translation; - + if (sort_method == 1) { #ifndef NCBI_COMPILER_WORKSHOP seqalign_hit_list.sort(CSortHitByMolecularTypeEx(linkoutdb, @@ -1558,11 +1557,11 @@ void CAlignFormatUtil::SortHit(list< CRef >& seqalign_hit_list, seqalign_hit_list.sort(SortHitByTotalScoreDescending); } else if (sort_method == 3) { seqalign_hit_list.sort(SortHitByPercentIdentityDescendingEx); - } + } } void CAlignFormatUtil:: -SplitSeqalignByMolecularType(vector< CRef >& +SplitSeqalignByMolecularType(vector< CRef >& target, int sort_method, const CSeq_align_set& source, @@ -1573,11 +1572,11 @@ SplitSeqalignByMolecularType(vector< CRef >& CConstRef prevSubjectId; int count = 0; int linkoutPrev = 0; - ITERATE(CSeq_align_set::Tdata, iter, source.Get()) { - - const CSeq_id& id = (*iter)->GetSeq_id(1); + ITERATE(CSeq_align_set::Tdata, iter, source.Get()) { + + const CSeq_id& id = (*iter)->GetSeq_id(1); try { - const CBioseq_Handle& handle = scope.GetBioseqHandle(id); + const CBioseq_Handle& handle = scope.GetBioseqHandle(id); if (handle) { int linkout; if(prevSubjectId.Empty() || !id.Match(*prevSubjectId)){ @@ -1588,7 +1587,7 @@ SplitSeqalignByMolecularType(vector< CRef >& } else { linkout = linkoutPrev; - } + } if (linkout & eGenomicSeq) { if (sort_method == 1) { target[1]->Set().push_back(*iter); @@ -1609,20 +1608,20 @@ SplitSeqalignByMolecularType(vector< CRef >& } else { target[0]->Set().push_back(*iter); } - + } catch (const CException&){ target[0]->Set().push_back(*iter); //no bioseq found, leave untouched - } - } + } + } } void CAlignFormatUtil::HspListToHitList(list< CRef >& target, - const CSeq_align_set& source) + const CSeq_align_set& source) { CConstRef previous_id; CRef temp; - ITERATE(CSeq_align_set::Tdata, iter, source.Get()) { + ITERATE(CSeq_align_set::Tdata, iter, source.Get()) { const CSeq_id& cur_id = (*iter)->GetSeq_id(1); if(previous_id.Empty()) { temp = new CSeq_align_set; @@ -1630,7 +1629,7 @@ void CAlignFormatUtil::HspListToHitList(list< CRef >& target, target.push_back(temp); } else if (cur_id.Match(*previous_id)){ temp->Set().push_back(*iter); - + } else { temp = new CSeq_align_set; temp->Set().push_back(*iter); @@ -1638,7 +1637,7 @@ void CAlignFormatUtil::HspListToHitList(list< CRef >& target, } previous_id = &cur_id; } - + } CRef @@ -1650,34 +1649,34 @@ CAlignFormatUtil::HitListToHspList(list< CRef >& source) // list >::iterator iter; for (list >::iterator iter = source.begin(); iter != source.end(); iter ++) { - ITERATE(CSeq_align_set::Tdata, iter2, (*iter)->Get()) { - align_set->Set().push_back(*iter2); - } + ITERATE(CSeq_align_set::Tdata, iter2, (*iter)->Get()) { + align_set->Set().push_back(*iter2); + } } return align_set; } map < string, CRef > CAlignFormatUtil::HspListToHitMap(vector seqIdList, - const CSeq_align_set& source) + const CSeq_align_set& source) { CConstRef previous_id; CRef temp; map < string, CRef > hitsMap; - + for(size_t i = 0; i < seqIdList.size();i++) { - CRef new_aln(new CSeq_align_set); + CRef new_aln(new CSeq_align_set); hitsMap.insert(map >::value_type(seqIdList[i],new_aln)); } size_t count = 0; - ITERATE(CSeq_align_set::Tdata, iter, source.Get()) { + ITERATE(CSeq_align_set::Tdata, iter, source.Get()) { const CSeq_id& cur_id = (*iter)->GetSeq_id(1); if(previous_id.Empty() || !cur_id.Match(*previous_id)) { - if(count >= seqIdList.size()) { + if(count >= seqIdList.size()) { break; } string idString = NStr::TruncateSpaces(cur_id.AsFastaString()); - if(hitsMap.find(idString) != hitsMap.end()) { + if(hitsMap.find(idString) != hitsMap.end()) { temp = new CSeq_align_set; temp->Set().push_back(*iter); hitsMap[idString] = temp; @@ -1686,21 +1685,21 @@ map < string, CRef > CAlignFormatUtil::HspListToHitMap(vector else { temp.Reset(); } - } + } else if (cur_id.Match(*previous_id)){ if(!temp.Empty()) { - temp->Set().push_back(*iter); + temp->Set().push_back(*iter); } - } + } previous_id = &cur_id; - } - return hitsMap; + } + return hitsMap; } void CAlignFormatUtil::ExtractSeqAlignForSeqList(CRef &all_aln_set, string alignSeqList) { vector seqIds; - NStr::Split(alignSeqList,",",seqIds); + NStr::Split(alignSeqList,",",seqIds); //SEQ_ALN_SET from ALIGNDB contains seq_aligns in random order //The followimg will create a map that contains seq-aln_set per gi from ALIGN_SEQ_LIST @@ -1713,10 +1712,10 @@ void CAlignFormatUtil::ExtractSeqAlignForSeqList(CRef &all_aln_s if(hitsMap.find(seqIds[i]) != hitsMap.end()) { orderedSet.push_back(hitsMap[seqIds[i]]); } - } + } //This should contain seq align set in the order of gis in the list - all_aln_set = CAlignFormatUtil::HitListToHspList(orderedSet); -} + all_aln_set = CAlignFormatUtil::HitListToHspList(orderedSet); +} static bool s_GetSRASeqMetadata(const CBioseq::TId& ids,string &strRun, string &strSpotId,string &strReadIndex) { @@ -1752,7 +1751,7 @@ static bool s_GetSRASeqMetadata(const CBioseq::TId& ids,string &strRun, string & strRun = vecInfo[0]; strSpotId = vecInfo[1]; - strReadIndex = vecInfo[2]; + strReadIndex = vecInfo[2]; success = true; } } @@ -1765,13 +1764,13 @@ string CAlignFormatUtil::BuildSRAUrl(const CBioseq::TId& ids, string user_url) string strRun, strSpotId,strReadIndex; string link = NcbiEmptyString; - if(s_GetSRASeqMetadata(ids,strRun,strSpotId,strReadIndex)) + if(s_GetSRASeqMetadata(ids,strRun,strSpotId,strReadIndex)) { // Generate the SRA link to the identified spot link += user_url; link += "?run=" + strRun; link += "." + strSpotId; - link += "." + strReadIndex; + link += "." + strReadIndex; } return link; } @@ -1787,7 +1786,7 @@ string s_GetBestIDForURL(CBioseq::TId& ids) if(!id_general.Empty() && id_general->AsFastaString().find("gnl|BL_ORD_ID") != string::npos){ return gnl; } - + const CSeq_id* bestid = NULL; if (id_general.Empty()){ bestid = id_other; @@ -1797,7 +1796,7 @@ string s_GetBestIDForURL(CBioseq::TId& ids) } else { bestid = id_general; } - + if (bestid && bestid->Which() != CSeq_id::e_Gi){ gnl = NStr::URLEncode(bestid->AsFastaString()); } @@ -1808,24 +1807,24 @@ string CAlignFormatUtil::BuildUserUrl(const CBioseq::TId& ids, TTaxId taxid, string user_url, string database, bool db_is_na, string rid, int query_number, bool for_alignment) { - - string link = NcbiEmptyString; + + string link = NcbiEmptyString; CConstRef id_general = GetSeq_idByType(ids, CSeq_id::e_General); - - if(!id_general.Empty() + + if(!id_general.Empty() && id_general->AsFastaString().find("gnl|BL_ORD_ID") != string::npos){ /* We do need to make security protected link to BLAST gnl */ return NcbiEmptyString; } - TGi gi = FindGi(ids); + TGi gi = FindGi(ids); string bestID = s_GetBestIDForURL((CBioseq::TId &)ids); - + bool nodb_path = false; /* dumpgnl.cgi need to use path */ if (user_url.find("dumpgnl.cgi") ==string::npos){ nodb_path = true; - } + } int length = (int)database.size(); string str; char *chptr, *dbtmp; @@ -1836,15 +1835,15 @@ string CAlignFormatUtil::BuildUserUrl(const CBioseq::TId& ids, TTaxId taxid, int i, j; dbtmp = new char[sizeof(char)*length + 2]; /* aditional space and NULL */ memset(dbtmp, '\0', sizeof(char)*length + 2); - for(i = 0; i < length; i++) { + for(i = 0; i < length; i++) { if(i > 0) { strcat(dbtmp, " "); //space between db - } + } if(isspace((unsigned char) dbname[i]) || dbname[i] == ',') {/* Rolling spaces */ continue; } j = 0; - while (!isspace((unsigned char) dbname[i]) && j < 256 && i < length) { + while (!isspace((unsigned char) dbname[i]) && j < 256 && i < length) { tmpbuff[j] = dbname[i]; j++; i++; if(dbname[i] == ',') { /* Comma is valid delimiter */ @@ -1852,25 +1851,25 @@ string CAlignFormatUtil::BuildUserUrl(const CBioseq::TId& ids, TTaxId taxid, } } tmpbuff[j] = '\0'; - if((chptr = strrchr(tmpbuff, '/')) != NULL) { + if((chptr = strrchr(tmpbuff, '/')) != NULL) { strcat(dbtmp, (char*)(chptr+1)); } else { strcat(dbtmp, tmpbuff); } - + } } else { dbtmp = dbname; } - + char gnl[256]; if (!bestID.empty()){ strcpy(gnl, bestID.c_str()); - + } else { gnl[0] = '\0'; } - + str = NStr::URLEncode(dbtmp == NULL ? (char*) "nr" : dbtmp); if (user_url.find("?") == string::npos){ @@ -1881,7 +1880,7 @@ string CAlignFormatUtil::BuildUserUrl(const CBioseq::TId& ids, TTaxId taxid, } link += user_url + "db=" + str + "&na=" + (db_is_na? "1" : "0"); } - + if (gnl[0] != '\0'){ str = gnl; link += "&gnl="; @@ -1897,7 +1896,7 @@ string CAlignFormatUtil::BuildUserUrl(const CBioseq::TId& ids, TTaxId taxid, if (rid != NcbiEmptyString){ link += "&RID=" + rid; } - + if (query_number > 0){ link += "&QUERY_NUMBER=" + NStr::IntToString(query_number); } @@ -1908,7 +1907,7 @@ string CAlignFormatUtil::BuildUserUrl(const CBioseq::TId& ids, TTaxId taxid, else link += "&log$=nucltop"; } - + if(nodb_path){ delete [] dbtmp; } @@ -1916,11 +1915,11 @@ string CAlignFormatUtil::BuildUserUrl(const CBioseq::TId& ids, TTaxId taxid, return link; } void CAlignFormatUtil:: -BuildFormatQueryString (CCgiContext& ctx, +BuildFormatQueryString (CCgiContext& ctx, map< string, string>& parameters_to_change, - string& cgi_query) + string& cgi_query) { - + //add parameters to exclude parameters_to_change.insert(map:: value_type("service", "")); @@ -1934,7 +1933,7 @@ BuildFormatQueryString (CCgiContext& ctx, value_type("client", "")); parameters_to_change.insert(map:: value_type("composition_based_statistics", "")); - + parameters_to_change.insert(map:: value_type("auto_format", "")); cgi_query = NcbiEmptyString; @@ -1943,17 +1942,17 @@ BuildFormatQueryString (CCgiContext& ctx, for(TCgiEntriesI it=cgi_entry.begin(); it!=cgi_entry.end(); ++it) { string parameter = it->first; - if (parameter != NcbiEmptyString) { + if (parameter != NcbiEmptyString) { if (parameters_to_change.count(NStr::ToLower(parameter)) > 0 || parameters_to_change.count(NStr::ToUpper(parameter)) > 0) { if(parameters_to_change[NStr::ToLower(parameter)] != - NcbiEmptyString && + NcbiEmptyString && parameters_to_change[NStr::ToUpper(parameter)] != NcbiEmptyString) { if (!is_first) { cgi_query += "&"; } - cgi_query += + cgi_query += it->first + "=" + parameters_to_change[it->first]; is_first = false; } @@ -1964,17 +1963,17 @@ BuildFormatQueryString (CCgiContext& ctx, cgi_query += it->first + "=" + it->second; is_first = false; } - - } + + } } } void CAlignFormatUtil::BuildFormatQueryString(CCgiContext& ctx, string& cgi_query) { - + string format_type = ctx.GetRequestValue("FORMAT_TYPE").GetValue(); - string ridstr = ctx.GetRequestValue("RID").GetValue(); - string align_view = ctx.GetRequestValue("ALIGNMENT_VIEW").GetValue(); - + string ridstr = ctx.GetRequestValue("RID").GetValue(); + string align_view = ctx.GetRequestValue("ALIGNMENT_VIEW").GetValue(); + cgi_query += "RID=" + ridstr; cgi_query += "&FORMAT_TYPE=" + format_type; cgi_query += "&ALIGNMENT_VIEW=" + align_view; @@ -1983,68 +1982,68 @@ void CAlignFormatUtil::BuildFormatQueryString(CCgiContext& ctx, string& cgi_quer cgi_query += "&FORMAT_OBJECT=" + ctx.GetRequestValue("FORMAT_OBJECT").GetValue(); cgi_query += "&RUN_PSIBLAST=" + ctx.GetRequestValue("RUN_PSIBLAST").GetValue(); cgi_query += "&I_THRESH=" + ctx.GetRequestValue("I_THRESH").GetValue(); - + cgi_query += "&DESCRIPTIONS=" + ctx.GetRequestValue("DESCRIPTIONS").GetValue(); - + cgi_query += "&ALIGNMENTS=" + ctx.GetRequestValue("ALIGNMENTS").GetValue(); - + cgi_query += "&NUM_OVERVIEW=" + ctx.GetRequestValue("NUM_OVERVIEW").GetValue(); - + cgi_query += "&NCBI_GI=" + ctx.GetRequestValue("NCBI_GI").GetValue(); - + cgi_query += "&SHOW_OVERVIEW=" + ctx.GetRequestValue("SHOW_OVERVIEW").GetValue(); - + cgi_query += "&SHOW_LINKOUT=" + ctx.GetRequestValue("SHOW_LINKOUT").GetValue(); - + cgi_query += "&GET_SEQUENCE=" + ctx.GetRequestValue("GET_SEQUENCE").GetValue(); - + cgi_query += "&MASK_CHAR=" + ctx.GetRequestValue("MASK_CHAR").GetValue(); cgi_query += "&MASK_COLOR=" + ctx.GetRequestValue("MASK_COLOR").GetValue(); - + cgi_query += "&SHOW_CDS_FEATURE=" + ctx.GetRequestValue("SHOW_CDS_FEATURE").GetValue(); if (ctx.GetRequestValue("FORMAT_EQ_TEXT").GetValue() != NcbiEmptyString) { cgi_query += "&FORMAT_EQ_TEXT=" + NStr::URLEncode(NStr::TruncateSpaces(ctx. GetRequestValue("FORMAT_EQ_TEXT"). - GetValue())); + GetValue())); } if (ctx.GetRequestValue("FORMAT_EQ_OP").GetValue() != NcbiEmptyString) { cgi_query += "&FORMAT_EQ_OP=" + NStr::URLEncode(NStr::TruncateSpaces(ctx. GetRequestValue("FORMAT_EQ_OP"). - GetValue())); + GetValue())); } if (ctx.GetRequestValue("FORMAT_EQ_MENU").GetValue() != NcbiEmptyString) { cgi_query += "&FORMAT_EQ_MENU=" + NStr::URLEncode(NStr::TruncateSpaces(ctx. GetRequestValue("FORMAT_EQ_MENU"). - GetValue())); + GetValue())); } cgi_query += "&EXPECT_LOW=" + ctx.GetRequestValue("EXPECT_LOW").GetValue(); cgi_query += "&EXPECT_HIGH=" + ctx.GetRequestValue("EXPECT_HIGH").GetValue(); cgi_query += "&BL2SEQ_LINK=" + ctx.GetRequestValue("BL2SEQ_LINK").GetValue(); - + } -bool CAlignFormatUtil::IsMixedDatabase(const CSeq_align_set& alnset, +bool CAlignFormatUtil::IsMixedDatabase(const CSeq_align_set& alnset, CScope& scope, ILinkoutDB* linkoutdb, - const string& mv_build_name) + const string& mv_build_name) { bool is_mixed = false; bool is_first = true; int prev_database = 0; - ITERATE(CSeq_align_set::Tdata, iter, alnset.Get()) { - + ITERATE(CSeq_align_set::Tdata, iter, alnset.Get()) { + const CSeq_id& id = (*iter)->GetSeq_id(1); - int linkout = linkoutdb - ? linkoutdb->GetLinkout(id, mv_build_name) + int linkout = linkoutdb + ? linkoutdb->GetLinkout(id, mv_build_name) : 0; int cur_database = (linkout & eGenomicSeq); if (!is_first && cur_database != prev_database) { @@ -2054,7 +2053,7 @@ bool CAlignFormatUtil::IsMixedDatabase(const CSeq_align_set& alnset, prev_database = cur_database; is_first = false; } - + return is_mixed; } @@ -2064,7 +2063,7 @@ bool CAlignFormatUtil::IsMixedDatabase(CCgiContext& ctx) { bool formatAsMixedDbs = false; string mixedDbs = ctx.GetRequestValue("MIXED_DATABASE").GetValue(); - if(!mixedDbs.empty()) { + if(!mixedDbs.empty()) { mixedDbs = NStr::ToLower(mixedDbs); formatAsMixedDbs = (mixedDbs == "on" || mixedDbs == "true" || mixedDbs == "yes") ? true : false; } @@ -2072,9 +2071,9 @@ bool CAlignFormatUtil::IsMixedDatabase(CCgiContext& ctx) } static string s_MapLinkoutGenParam(string &url_link_tmpl, - const string& rid, - string giList, - bool for_alignment, + const string& rid, + string giList, + bool for_alignment, int cur_align, string &label, string &lnk_displ, @@ -2083,131 +2082,130 @@ static string s_MapLinkoutGenParam(string &url_link_tmpl, { const string kLinkTitle=" title=\"View <@lnk_tl_info@> for <@label@>\" "; const string kLinkTarget="target=\"lnk" + rid + "\""; - string lnkTitle = (lnk_title.empty()) ? kLinkTitle : lnk_title; + string lnkTitle = (lnk_title.empty()) ? kLinkTitle : lnk_title; string url_link = CAlignFormatUtil::MapTemplate(url_link_tmpl,"gi",giList); url_link = CAlignFormatUtil::MapTemplate(url_link,"rid",rid); url_link = CAlignFormatUtil::MapTemplate(url_link,"log",for_alignment? "align" : "top"); url_link = CAlignFormatUtil::MapTemplate(url_link,"blast_rank",NStr::IntToString(cur_align)); - lnkTitle = NStr::StartsWith(lnk_displ," s_GetLinkoutUrl(int linkout, string giList, string labelList, - TGi first_gi, - CAlignFormatUtil::SLinkoutInfo &linkoutInfo, + TGi first_gi, + CAlignFormatUtil::SLinkoutInfo &linkoutInfo, bool textLink = true) - + { - list linkout_list; + list linkout_list; string url_link,lnk_displ,lnk_title,lnkTitleInfo; - + vector accs; - NStr::Split(labelList,",",accs); + NStr::Split(labelList,",",accs); string firstAcc = (accs.size() > 0)? accs[0] : labelList; if (linkout & eUnigene) { - url_link = CAlignFormatUtil::GetURLFromRegistry("UNIGEN"); + url_link = CAlignFormatUtil::GetURLFromRegistry("UNIGEN"); lnk_displ = textLink ? "UniGene" : kUnigeneImg; - + string termParam = NStr::Find(labelList,",") == NPOS ? kGeneTerm : ""; //kGeneTerm if only one seqid url_link = CAlignFormatUtil::MapTemplate(url_link,"termParam",termParam); - lnkTitleInfo = "UniGene cluster"; + lnkTitleInfo = "UniGene cluster"; string uid = !linkoutInfo.is_na ? "[Protein Accession]" : "[Nucleotide Accession]"; url_link = CAlignFormatUtil::MapTemplate(url_link,"uid",uid); url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,lnkTitleInfo); - + if(textLink) { url_link = CAlignFormatUtil::MapTemplate(kUnigeneDispl,"lnk",url_link); - } + } url_link = CAlignFormatUtil::MapProtocol(url_link); linkout_list.push_back(url_link); } if (linkout & eStructure){ - CSeq_id seqID(firstAcc); + CSeq_id seqID(firstAcc); string struct_link = CAlignFormatUtil::GetURLFromRegistry( "STRUCTURE_URL"); - url_link = struct_link.empty() ? kStructureUrl : struct_link; + url_link = struct_link.empty() ? kStructureUrl : struct_link; string linkTitle; if(seqID.Which() == CSeq_id::e_Pdb) { - lnk_displ = textLink ? "Structure" : kStructureImg; - linkTitle = " title=\"View 3D structure <@label@>\""; + lnk_displ = textLink ? "Structure" : kStructureImg; + linkTitle = " title=\"View 3D structure <@label@>\""; } else { url_link = kStructureAlphaFoldUrl; - lnk_displ = textLink ? "AlphaFold Structure" : kStructureImg; - linkTitle = " title=\"View AlphaFold 3D structure <@label@>\""; + lnk_displ = textLink ? "AlphaFold Structure" : kStructureImg; + linkTitle = " title=\"View AlphaFold 3D structure <@label@>\""; } - - - + + + string molID,chainID; NStr::SplitInTwo(firstAcc,"_",molID,chainID); url_link = CAlignFormatUtil::MapTemplate(url_link,"molid",molID); url_link = CAlignFormatUtil::MapTemplate(url_link,"queryID",linkoutInfo.queryID); - url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,firstAcc,lnk_displ,"",linkTitle); + url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,firstAcc,lnk_displ,"",linkTitle); if(textLink) { url_link = CAlignFormatUtil::MapTemplate(kStructureDispl,"lnk",url_link); - } + } url_link = CAlignFormatUtil::MapProtocol(url_link); linkout_list.push_back(url_link); - } + } if (linkout & eGeo){ - url_link = CAlignFormatUtil::GetURLFromRegistry("GEO"); - lnk_displ = textLink ? "GEO Profiles" : kGeoImg; - + url_link = CAlignFormatUtil::GetURLFromRegistry("GEO"); + lnk_displ = textLink ? "GEO Profiles" : kGeoImg; + lnkTitleInfo = "Expression profiles"; - //gilist contains comma separated gis + //gilist contains comma separated gis url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,lnkTitleInfo); - - + + if(textLink) { url_link = CAlignFormatUtil::MapTemplate(kGeoDispl,"lnk",url_link); - } + } url_link = CAlignFormatUtil::MapProtocol(url_link); linkout_list.push_back(url_link); } if(linkout & eGene){ - url_link = CAlignFormatUtil::GetURLFromRegistry("GENE"); - if(textLink) { - string geneSym = CAlignFormatUtil::GetGeneInfo(first_gi); - lnk_displ = "Gene"; - lnkTitleInfo = "gene " + geneSym; + url_link = CAlignFormatUtil::GetURLFromRegistry("GENE"); + if(textLink) { + lnk_displ = "Gene"; + lnkTitleInfo = "gene information"; } else { lnk_displ = kGeneImg; } string termParam = NStr::Find(labelList,",") == NPOS ? kGeneTerm : ""; //kGeneTerm if only one seqid url_link = CAlignFormatUtil::MapTemplate(url_link,"termParam",termParam); - + string uid = !linkoutInfo.is_na ? "[Protein Accession]" : "[Nucleotide Accession]"; - url_link = CAlignFormatUtil::MapTemplate(url_link,"uid",uid); - + url_link = CAlignFormatUtil::MapTemplate(url_link,"uid",uid); + url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,lnkTitleInfo); - + if(textLink) { url_link = CAlignFormatUtil::MapTemplate(kGeneDispl,"lnk",url_link); - } + } url_link = CAlignFormatUtil::MapProtocol(url_link); - linkout_list.push_back(url_link); + linkout_list.push_back(url_link); } if((linkout & eGenomicSeq) && first_gi != ZERO_GI){ //only for advanced view -> textlink = true if(textLink) { - url_link = kMapviewBlastHitParams; + url_link = kMapviewBlastHitParams; lnk_displ = "Map Viewer"; - + lnkTitleInfo = "BLAST hits on the " + linkoutInfo.taxName + " genome"; url_link = CAlignFormatUtil::MapTemplate(url_link,"gnl",NStr::URLEncode(linkoutInfo.gnl)); @@ -2217,14 +2215,14 @@ static list s_GetLinkoutUrl(int linkout, url_link = CAlignFormatUtil::MapTemplate(url_link,"user_url",user_url); string taxIDStr = (linkoutInfo.taxid > ZERO_TAX_ID) ? NStr::NumericToString(linkoutInfo.taxid) : ""; - url_link = CAlignFormatUtil::MapTemplate(url_link,"taxid",taxIDStr); - + url_link = CAlignFormatUtil::MapTemplate(url_link,"taxid",taxIDStr); + string queryNumStr = (linkoutInfo.query_number > 0) ? NStr::IntToString(linkoutInfo.query_number) : ""; url_link = CAlignFormatUtil::MapTemplate(url_link,"query_number",queryNumStr); //gi,term - - string giStr = (first_gi > ZERO_GI)? NStr::NumericToString(first_gi) : ""; - url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giStr,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,lnkTitleInfo); - + + string giStr = (first_gi > ZERO_GI)? NStr::NumericToString(first_gi) : ""; + url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giStr,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,lnkTitleInfo); + if(textLink) { url_link = CAlignFormatUtil::MapTemplate(kMapviwerDispl,"lnk",url_link); } @@ -2232,69 +2230,69 @@ static list s_GetLinkoutUrl(int linkout, linkout_list.push_back(url_link); } } - else if((linkout & eMapviewer) && first_gi != ZERO_GI){ + else if((linkout & eMapviewer) && first_gi != ZERO_GI){ url_link = kMapviwerUrl; - lnk_displ = textLink ? "Map Viewer" : kMapviwerImg; - - string linkTitle = " title=\"View <@label@> aligned to the " + linkoutInfo.taxName + " genome\""; + lnk_displ = textLink ? "Map Viewer" : kMapviwerImg; + + string linkTitle = " title=\"View <@label@> aligned to the " + linkoutInfo.taxName + " genome\""; url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,"",linkTitle); - + if(textLink) { url_link = CAlignFormatUtil::MapTemplate(kMapviwerDispl,"lnk",url_link); } url_link = CAlignFormatUtil::MapProtocol(url_link); - linkout_list.push_back(url_link); + linkout_list.push_back(url_link); } //View Bioassays involving \""; //gilist contains comma separated gis, change it to the following giList = NStr::Replace(giList,",","[RNATargetGI] OR "); url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,"",linkTitle); - + if(textLink) { url_link = CAlignFormatUtil::MapTemplate(kBioAssayDispl,"lnk",url_link); } url_link = CAlignFormatUtil::MapProtocol(url_link); - linkout_list.push_back(url_link); + linkout_list.push_back(url_link); } else if (linkout & eBioAssay && !linkoutInfo.is_na && first_gi != ZERO_GI) { - url_link = CAlignFormatUtil::GetURLFromRegistry("BIOASSAY_PROT"); + url_link = CAlignFormatUtil::GetURLFromRegistry("BIOASSAY_PROT"); lnk_displ = textLink ? "PubChem BioAssay" : kBioAssayProtImg; - + lnkTitleInfo ="Bioassay data"; string linkTitle = " title=\"View Bioassays involving <@label@>\""; //gilist contains comma separated gis, change it to the following giList = NStr::Replace(giList,",","[PigGI] OR "); url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,"",linkTitle); - + if(textLink) { url_link = CAlignFormatUtil::MapTemplate(kBioAssayDispl,"lnk",url_link); } url_link = CAlignFormatUtil::MapProtocol(url_link); - linkout_list.push_back(url_link); + linkout_list.push_back(url_link); } if(linkout & eReprMicrobialGenomes){ - url_link = CAlignFormatUtil::GetURLFromRegistry("REPR_MICROBIAL_GENOMES"); - lnk_displ = textLink ? "Genome" : kReprMicrobialGenomesImg; - + url_link = CAlignFormatUtil::GetURLFromRegistry("REPR_MICROBIAL_GENOMES"); + lnk_displ = textLink ? "Genome" : kReprMicrobialGenomesImg; + lnkTitleInfo = "genomic information"; - //gilist contains comma separated gis + //gilist contains comma separated gis string uid = !linkoutInfo.is_na ? "Protein Accession" : "Nucleotide Accession"; url_link = CAlignFormatUtil::MapTemplate(url_link,"uid",uid); url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,lnkTitleInfo); - + if(textLink) { url_link = CAlignFormatUtil::MapTemplate(kReprMicrobialGenomesDispl,"lnk",url_link); } url_link = CAlignFormatUtil::MapProtocol(url_link); - linkout_list.push_back(url_link); - } + linkout_list.push_back(url_link); + } if((linkout & eGenomeDataViewer) || (linkout & eTranscript)){ - string urlTag; + string urlTag; lnk_displ = textLink ? "Genome Data Viewer" : kGenomeDataViewerImg; if(linkout & eTranscript) { urlTag = "GENOME_DATA_VIEWER_TRANSCR"; @@ -2302,14 +2300,14 @@ static list s_GetLinkoutUrl(int linkout, } else { urlTag = linkoutInfo.is_na ? "GENOME_DATA_VIEWER_NUC" : "GENOME_DATA_VIEWER_PROT"; - lnkTitleInfo = linkoutInfo.is_na ? + lnkTitleInfo = linkoutInfo.is_na ? "title=\"View BLAST hits for <@label@> within a genomic context in NCBI's Genome Data Viewer (GDV)- genome browser for RefSeq annotated assemblies. See other genomic features annotated at the same location as hits and browse to other regions.\"" : "title=\"View the annotation of the protein <@label@> within a genomic context in NCBI's Genome Data Viewer (GDV)- genome browser for RefSeq annotated assemblies. See other genomic features annotated at the same location as the protein annotation and browse to other regions.\""; } url_link = CAlignFormatUtil::GetURLFromRegistry(urlTag); url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,firstAcc,lnk_displ,"",lnkTitleInfo); - + url_link = CAlignFormatUtil::MapTemplate(url_link,"queryID",linkoutInfo.queryID); TSeqPos seqFrom = linkoutInfo.subjRange.GetFrom(); @@ -2324,29 +2322,29 @@ static list s_GetLinkoutUrl(int linkout, if(textLink) { url_link = CAlignFormatUtil::MapTemplate(kGenomeDataViewerDispl,"lnk",url_link); } - url_link = CAlignFormatUtil::MapProtocol(url_link); - linkout_list.push_back(url_link); - } + url_link = CAlignFormatUtil::MapProtocol(url_link); + linkout_list.push_back(url_link); + } return linkout_list; } ///Get list of linkouts for one sequence -list CAlignFormatUtil::GetLinkoutUrl(int linkout, const CBioseq::TId& ids, +list CAlignFormatUtil::GetLinkoutUrl(int linkout, const CBioseq::TId& ids, const string& rid, - const string& cdd_rid, + const string& cdd_rid, const string& entrez_term, - bool is_na, + bool is_na, TGi first_gi, bool structure_linkout_as_group, bool for_alignment, int cur_align, string preComputedResID) - + { list linkout_list; TGi gi = FindGi(ids); CRef wid = FindBestChoice(ids, CSeq_id::WorstRank); string label; - wid->GetLabel(&label, CSeq_id::eContent); + wid->GetLabel(&label, CSeq_id::eContent); string giString = NStr::NumericToString(gi); first_gi = (first_gi == ZERO_GI) ? gi : first_gi; @@ -2354,9 +2352,9 @@ list CAlignFormatUtil::GetLinkoutUrl(int linkout, const CBioseq::TId& id SLinkoutInfo linkoutInfo; linkoutInfo.Init(rid, - cdd_rid, + cdd_rid, entrez_term, - is_na, + is_na, "", //database 0, //query_number "", //user_url @@ -2367,13 +2365,13 @@ list CAlignFormatUtil::GetLinkoutUrl(int linkout, const CBioseq::TId& id linkoutInfo.cur_align = cur_align; linkoutInfo.taxid = ZERO_TAX_ID; - - linkout_list = s_GetLinkoutUrl(linkout, + + linkout_list = s_GetLinkoutUrl(linkout, giString, - label, + label, first_gi, linkoutInfo, - false); //textlink + false); //textlink return linkout_list; } @@ -2383,10 +2381,10 @@ static int s_LinkLetterToType(string linkLetter) int linkType = 0; if(linkLetter == "U") { linkType = eUnigene; - } + } else if(linkLetter == "S") { linkType = eStructure; - } + } else if(linkLetter == "E") { linkType = eGeo; } @@ -2404,14 +2402,14 @@ static int s_LinkLetterToType(string linkLetter) } else if(linkLetter == "R") { linkType = eReprMicrobialGenomes; - } + } else if(linkLetter == "V") { linkType = eGenomeDataViewer; - } + } else if(linkLetter == "T") { linkType = eTranscript; - } - + } + return linkType; } @@ -2419,109 +2417,116 @@ static int s_LinkLetterToType(string linkLetter) static void s_AddLinkoutInfo(map > &linkout_map,int linkout,CBioseq::TId &cur_id) { if(linkout_map.count(linkout) > 0){ - linkout_map[linkout].push_back(cur_id); - } - else { + linkout_map[linkout].push_back(cur_id); + } + else { vector idList; idList.push_back(cur_id); linkout_map.insert(map >::value_type(linkout,idList)); } } -int CAlignFormatUtil::GetSeqLinkoutInfo(CBioseq::TId& cur_id, - ILinkoutDB **linkoutdb, - const string& mv_build_name, +int CAlignFormatUtil::GetSeqLinkoutInfo(CBioseq::TId& cur_id, + ILinkoutDB **linkoutdb, + const string& mv_build_name, TGi gi) { int linkout = 0; if(*linkoutdb) { if(gi == INVALID_GI) { - gi = FindGi(cur_id); - } - try { + gi = FindGi(cur_id); + } + try { if(gi > ZERO_GI) { linkout = (*linkoutdb)->GetLinkout(gi, mv_build_name); } else if(GetTextSeqID(cur_id)){ - CRef seqID = FindBestChoice(cur_id, CSeq_id::WorstRank); - linkout = (*linkoutdb)->GetLinkout(*seqID, mv_build_name); - } + CRef seqID = FindBestChoice(cur_id, CSeq_id::WorstRank); + linkout = (*linkoutdb)->GetLinkout(*seqID, mv_build_name); + string str_id = seqID->GetSeqIdString(false); + CRef seqIDNew(new CSeq_id(str_id)); + int linkoutWithoutVersion = (*linkoutdb)->GetLinkout(*seqIDNew, mv_build_name); + if(linkoutWithoutVersion && (linkoutWithoutVersion | eStructure)) { + linkout = linkout | linkoutWithoutVersion; + } + } } - catch (const CException & e) { - ERR_POST("Problem with linkoutdb: " + e.GetMsg()); + catch (const CException & e) { + ERR_POST("Problem with linkoutdb: " + e.GetMsg()); + cerr << "[BLAST FORMATTER EXCEPTION] Problem with linkoutdb: " << e.GetMsg() << endl; *linkoutdb = NULL; - } + } } return linkout; } -void +void CAlignFormatUtil::GetBdlLinkoutInfo(CBioseq::TId& cur_id, map > &linkout_map, - ILinkoutDB* linkoutdb, + ILinkoutDB* linkoutdb, const string& mv_build_name) { if(!linkoutdb) return; - - int linkout = GetSeqLinkoutInfo(cur_id, - &linkoutdb, - mv_build_name); - + + int linkout = GetSeqLinkoutInfo(cur_id, + &linkoutdb, + mv_build_name); + if(linkout & eGene){ - s_AddLinkoutInfo(linkout_map,eGene,cur_id); + s_AddLinkoutInfo(linkout_map,eGene,cur_id); } if (linkout & eUnigene) { s_AddLinkoutInfo(linkout_map,eUnigene,cur_id); } if (linkout & eGeo){ - s_AddLinkoutInfo(linkout_map,eGeo,cur_id); - } + s_AddLinkoutInfo(linkout_map,eGeo,cur_id); + } if (linkout & eStructure){ - s_AddLinkoutInfo(linkout_map,eStructure,cur_id); - } + s_AddLinkoutInfo(linkout_map,eStructure,cur_id); + } //eGenomicSeq and eMapviewer cannot combine together - if((linkout & eGenomicSeq) && (linkout & eMapviewer)){ - s_AddLinkoutInfo(linkout_map,eGenomicSeq,cur_id); - } - else if(linkout & eMapviewer){ - s_AddLinkoutInfo(linkout_map,eMapviewer,cur_id); - } - if(linkout & eBioAssay){ - s_AddLinkoutInfo(linkout_map,eBioAssay,cur_id); - } - if(linkout & eReprMicrobialGenomes){ - s_AddLinkoutInfo(linkout_map,eReprMicrobialGenomes,cur_id); - } - - if(linkout & eGenomeDataViewer){ - s_AddLinkoutInfo(linkout_map,eGenomeDataViewer,cur_id); - } - if(linkout & eTranscript){ - s_AddLinkoutInfo(linkout_map,eTranscript,cur_id); - } - -} - -void + if((linkout & eGenomicSeq) && (linkout & eMapviewer)){ + s_AddLinkoutInfo(linkout_map,eGenomicSeq,cur_id); + } + else if(linkout & eMapviewer){ + s_AddLinkoutInfo(linkout_map,eMapviewer,cur_id); + } + if(linkout & eBioAssay){ + s_AddLinkoutInfo(linkout_map,eBioAssay,cur_id); + } + if(linkout & eReprMicrobialGenomes){ + s_AddLinkoutInfo(linkout_map,eReprMicrobialGenomes,cur_id); + } + + if(linkout & eGenomeDataViewer){ + s_AddLinkoutInfo(linkout_map,eGenomeDataViewer,cur_id); + } + if(linkout & eTranscript){ + s_AddLinkoutInfo(linkout_map,eTranscript,cur_id); + } + +} + +void CAlignFormatUtil::GetBdlLinkoutInfo(const list< CRef< CBlast_def_line > > &bdl, map > &linkout_map, - ILinkoutDB* linkoutdb, + ILinkoutDB* linkoutdb, const string& mv_build_name) { const int kMaxDeflineNum = 10; int num = 0; for(list< CRef< CBlast_def_line > >::const_iterator iter = bdl.begin(); - iter != bdl.end(); iter++){ - CBioseq::TId& cur_id = (CBioseq::TId &)(*iter)->GetSeqid(); + iter != bdl.end(); iter++){ + CBioseq::TId& cur_id = (CBioseq::TId &)(*iter)->GetSeqid(); GetBdlLinkoutInfo(cur_id, linkout_map, - linkoutdb, - mv_build_name); + linkoutdb, + mv_build_name); num++; if(num > kMaxDeflineNum) break; - } + } } static string s_GetTaxName(TTaxId taxid) @@ -2531,32 +2536,32 @@ static string s_GetTaxName(TTaxId taxid) if(taxid != ZERO_TAX_ID) { SSeqDBTaxInfo info; CSeqDB::GetTaxInfo(taxid, info); - taxName = info.common_name; + taxName = info.common_name; } } catch (CException&) { - + } return taxName; } -void s_AddOtherRelatedInfoLinks(CBioseq::TId& cur_id, - const string& rid, - bool is_na, - bool for_alignment, +void s_AddOtherRelatedInfoLinks(CBioseq::TId& cur_id, + const string& rid, + bool is_na, + bool for_alignment, int cur_align, list &linkout_list) - -{ + +{ //Identical Proteins - - CRef wid = FindBestChoice(cur_id, CSeq_id::WorstRank); - if (CAlignFormatUtil::GetTextSeqID(wid)) { + + CRef wid = FindBestChoice(cur_id, CSeq_id::WorstRank); + if (CAlignFormatUtil::GetTextSeqID(wid)) { string label; - wid->GetLabel(&label, CSeq_id::eContent); + wid->GetLabel(&label, CSeq_id::eContent); string url_link = kIdenticalProteinsUrl; string lnk_displ = "Identical Proteins"; - url_link = s_MapLinkoutGenParam(url_link,rid,NStr::NumericToString(ZERO_GI),for_alignment, cur_align,label,lnk_displ); + url_link = s_MapLinkoutGenParam(url_link,rid,NStr::NumericToString(ZERO_GI),for_alignment, cur_align,label,lnk_displ); url_link = CAlignFormatUtil::MapTemplate(kIdenticalProteinsDispl,"lnk",url_link); url_link = CAlignFormatUtil::MapTemplate(url_link,"label",label); linkout_list.push_back(url_link); @@ -2566,40 +2571,40 @@ void s_AddOtherRelatedInfoLinks(CBioseq::TId& cur_id, //reset:taxname,gnl -static list s_GetFullLinkoutUrl(CBioseq::TId& cur_id, - CAlignFormatUtil::SLinkoutInfo &linkoutInfo, +static list s_GetFullLinkoutUrl(CBioseq::TId& cur_id, + CAlignFormatUtil::SLinkoutInfo &linkoutInfo, map > &linkout_map, bool getIdentProteins) - + { - list linkout_list; - + list linkout_list; + vector linkLetters; - NStr::Split(linkoutInfo.linkoutOrder,",",linkLetters); //linkoutOrder = "G,U,M,V,E,S,B,R,T" + NStr::Split(linkoutInfo.linkoutOrder,",",linkLetters); //linkoutOrder = "G,U,M,V,E,S,B,R,T" for(size_t i = 0; i < linkLetters.size(); i++) { TGi first_gi = ZERO_GI; vector < CBioseq::TId > idList; - int linkout = s_LinkLetterToType(linkLetters[i]); + int linkout = s_LinkLetterToType(linkLetters[i]); linkoutInfo.taxName.clear(); - if(linkout & (eMapviewer | eGenomicSeq)) { - linkout = (linkout_map[eGenomicSeq].size() != 0) ? eGenomicSeq : eMapviewer; + if(linkout & (eMapviewer | eGenomicSeq)) { + linkout = (linkout_map[eGenomicSeq].size() != 0) ? eGenomicSeq : eMapviewer; linkoutInfo.taxName = s_GetTaxName(linkoutInfo.taxid); } if(linkout_map.find(linkout) != linkout_map.end()) { - idList = linkout_map[linkout]; - } + idList = linkout_map[linkout]; + } bool disableLink = (linkout == 0 || idList.size() == 0 || ( (linkout & eStructure) && (linkoutInfo.cdd_rid == "" || linkoutInfo.cdd_rid == "0"))); - string giList,labelList; - int seqVersion = ((linkout & eGenomeDataViewer) || (linkout & eTranscript)) ? true : false; + string giList,labelList; + int seqVersion = ((linkout & eGenomeDataViewer) || (linkout & eTranscript)) ? true : false; for (size_t i = 0; i < idList.size(); i++) { const CBioseq::TId& ids = idList[i]; TGi gi = FindGi(ids); if (first_gi == ZERO_GI) first_gi = gi; - CRef wid = FindBestChoice(ids, CSeq_id::WorstRank); - string label = CAlignFormatUtil::GetLabel(wid,seqVersion); + CRef wid = FindBestChoice(ids, CSeq_id::WorstRank); + string label = CAlignFormatUtil::GetLabel(wid,seqVersion); if(!labelList.empty()) labelList += ","; labelList += label; @@ -2610,79 +2615,79 @@ static list s_GetFullLinkoutUrl(CBioseq::TId& cur_id, } linkoutInfo.gnl.clear(); - if(!disableLink && linkout == eGenomicSeq) { + if(!disableLink && linkout == eGenomicSeq) { linkoutInfo.gnl = s_GetBestIDForURL(cur_id); } - + if(!disableLink) {// //The following list will contain only one entry for single linkout value - list one_linkout = s_GetLinkoutUrl(linkout, + list one_linkout = s_GetLinkoutUrl(linkout, giList, - labelList, + labelList, first_gi, - linkoutInfo); + linkoutInfo); if(one_linkout.size() > 0) { - list::iterator iter = one_linkout.begin(); + list::iterator iter = one_linkout.begin(); linkout_list.push_back(*iter); } } } if(getIdentProteins) { - s_AddOtherRelatedInfoLinks(cur_id,linkoutInfo.rid,linkoutInfo.is_na,linkoutInfo.for_alignment,linkoutInfo.cur_align,linkout_list); + s_AddOtherRelatedInfoLinks(cur_id,linkoutInfo.rid,linkoutInfo.is_na,linkoutInfo.for_alignment,linkoutInfo.cur_align,linkout_list); } return linkout_list; } -list CAlignFormatUtil::GetFullLinkoutUrl(const list< CRef< CBlast_def_line > > &bdl, - CAlignFormatUtil::SLinkoutInfo &linkoutInfo) +list CAlignFormatUtil::GetFullLinkoutUrl(const list< CRef< CBlast_def_line > > &bdl, + CAlignFormatUtil::SLinkoutInfo &linkoutInfo) { list linkout_list; map > linkout_map; - if(bdl.size() > 0) { + if(bdl.size() > 0) { GetBdlLinkoutInfo(bdl,linkout_map, linkoutInfo.linkoutdb, linkoutInfo.mv_build_name); - list< CRef< CBlast_def_line > >::const_iterator iter = bdl.begin(); - CBioseq::TId& cur_id = (CBioseq::TId &)(*iter)->GetSeqid(); - linkout_list = s_GetFullLinkoutUrl(cur_id, - linkoutInfo, + list< CRef< CBlast_def_line > >::const_iterator iter = bdl.begin(); + CBioseq::TId& cur_id = (CBioseq::TId &)(*iter)->GetSeqid(); + linkout_list = s_GetFullLinkoutUrl(cur_id, + linkoutInfo, linkout_map, - !linkoutInfo.is_na && bdl.size() > 1); + !linkoutInfo.is_na && bdl.size() > 1); } return linkout_list; } -list CAlignFormatUtil::GetFullLinkoutUrl(const list< CRef< CBlast_def_line > > &bdl, +list CAlignFormatUtil::GetFullLinkoutUrl(const list< CRef< CBlast_def_line > > &bdl, const string& rid, - const string& cdd_rid, + const string& cdd_rid, const string& entrez_term, - bool is_na, + bool is_na, bool structure_linkout_as_group, - bool for_alignment, + bool for_alignment, int cur_align, string& linkoutOrder, TTaxId taxid, string &database, - int query_number, + int query_number, string &user_url, string &preComputedResID, ILinkoutDB* linkoutdb, const string& mv_build_name) - + { list linkout_list; map > linkout_map; - if(bdl.size() > 0) { + if(bdl.size() > 0) { GetBdlLinkoutInfo(bdl,linkout_map, linkoutdb, mv_build_name); - list< CRef< CBlast_def_line > >::const_iterator iter = bdl.begin(); - CBioseq::TId& cur_id = (CBioseq::TId &)(*iter)->GetSeqid(); + list< CRef< CBlast_def_line > >::const_iterator iter = bdl.begin(); + CBioseq::TId& cur_id = (CBioseq::TId &)(*iter)->GetSeqid(); SLinkoutInfo linkoutInfo; linkoutInfo.Init(rid, - cdd_rid, + cdd_rid, entrez_term, - is_na, + is_na, database, - query_number, + query_number, user_url, preComputedResID, linkoutOrder, @@ -2692,8 +2697,8 @@ list CAlignFormatUtil::GetFullLinkoutUrl(const list< CRef< CBlast_def_li linkoutInfo.cur_align = cur_align; linkoutInfo.taxid = taxid; - linkout_list = s_GetFullLinkoutUrl(cur_id, - linkoutInfo, + linkout_list = s_GetFullLinkoutUrl(cur_id, + linkoutInfo, linkout_map, !is_na && bdl.size() > 1); } @@ -2701,51 +2706,51 @@ list CAlignFormatUtil::GetFullLinkoutUrl(const list< CRef< CBlast_def_li } -list CAlignFormatUtil::GetFullLinkoutUrl(CBioseq::TId& cur_id, +list CAlignFormatUtil::GetFullLinkoutUrl(CBioseq::TId& cur_id, CAlignFormatUtil::SLinkoutInfo &linkoutInfo, - bool getIdentProteins) + bool getIdentProteins) { list linkout_list; map > linkout_map; - + GetBdlLinkoutInfo(cur_id,linkout_map, linkoutInfo.linkoutdb, linkoutInfo.mv_build_name); - linkout_list = s_GetFullLinkoutUrl(cur_id, - linkoutInfo, + linkout_list = s_GetFullLinkoutUrl(cur_id, + linkoutInfo, linkout_map, - getIdentProteins); + getIdentProteins); return linkout_list; } -list CAlignFormatUtil::GetFullLinkoutUrl(CBioseq::TId& cur_id, +list CAlignFormatUtil::GetFullLinkoutUrl(CBioseq::TId& cur_id, const string& rid, - const string& cdd_rid, + const string& cdd_rid, const string& entrez_term, - bool is_na, + bool is_na, bool structure_linkout_as_group, - bool for_alignment, + bool for_alignment, int cur_align, string& linkoutOrder, TTaxId taxid, string &database, - int query_number, + int query_number, string &user_url, string &preComputedResID, ILinkoutDB* linkoutdb, const string& mv_build_name, bool getIdentProteins) - + { list linkout_list; - map > linkout_map; + map > linkout_map; GetBdlLinkoutInfo(cur_id,linkout_map, linkoutdb, mv_build_name); SLinkoutInfo linkoutInfo; linkoutInfo.Init(rid, - cdd_rid, + cdd_rid, entrez_term, - is_na, + is_na, database, - query_number, + query_number, user_url, preComputedResID, linkoutOrder, @@ -2755,8 +2760,8 @@ list CAlignFormatUtil::GetFullLinkoutUrl(CBioseq::TId& cur_id, linkoutInfo.cur_align = cur_align; linkoutInfo.taxid = taxid; - linkout_list = s_GetFullLinkoutUrl(cur_id, - linkoutInfo, + linkout_list = s_GetFullLinkoutUrl(cur_id, + linkoutInfo, linkout_map, getIdentProteins); return linkout_list; @@ -2791,12 +2796,12 @@ static bool s_ProcessAlignSet(const CSeq_align_set& alnset, subject_range.Set(subject_range.GetTo(), subject_range.GetFrom()); } subject_list.push_back(subject_range); - + oppositeStrands = (!isFirst) ? (*iter)->GetSeqStrand(0) != (*iter)->GetSeqStrand(1) : oppositeStrands; isFirst = true; } - - query_list.sort(FromRangeAscendingSort); + + query_list.sort(FromRangeAscendingSort); subject_list.sort(FromRangeAscendingSort); return oppositeStrands; } @@ -2804,15 +2809,15 @@ static bool s_ProcessAlignSet(const CSeq_align_set& alnset, //0 for query, 1 for subject -static list > s_MergeRangeList(list > &source) +static list > s_MergeRangeList(list > &source) { - list > merge_list; + list > merge_list; bool is_first = true; CRange prev_range (0, 0); ITERATE(list >, iter, source) { - + if (is_first) { merge_list.push_back(*iter); is_first= false; @@ -2828,16 +2833,16 @@ static list > s_MergeRangeList(list > &source) prev_range = *iter; } } - + } - return merge_list; + return merge_list; } -int CAlignFormatUtil::GetMasterCoverage(const CSeq_align_set& alnset) +int CAlignFormatUtil::GetMasterCoverage(const CSeq_align_set& alnset) { - list > merge_list; - + list > merge_list; + list > temp; ITERATE(CSeq_align_set::Tdata, iter, alnset.Get()) { CRange seq_range = (*iter)->GetSeqRange(0); @@ -2847,7 +2852,7 @@ int CAlignFormatUtil::GetMasterCoverage(const CSeq_align_set& alnset) } temp.push_back(seq_range); } - + temp.sort(FromRangeAscendingSort); merge_list = s_MergeRangeList(temp); @@ -2859,27 +2864,27 @@ int CAlignFormatUtil::GetMasterCoverage(const CSeq_align_set& alnset) return master_covered_lenghth; } - + CRange CAlignFormatUtil::GetSeqAlignCoverageParams(const CSeq_align_set& alnset,int *master_covered_lenghth,bool *flip) - + { list > query_list; list > subject_list; *flip = s_ProcessAlignSet(alnset,query_list,subject_list); - query_list = s_MergeRangeList(query_list); - subject_list = s_MergeRangeList(subject_list); + query_list = s_MergeRangeList(query_list); + subject_list = s_MergeRangeList(subject_list); + - *master_covered_lenghth = 0; ITERATE(list >, iter, query_list) { *master_covered_lenghth += iter->GetLength(); } TSeqPos from = 0,to = 0; - ITERATE(list >, iter, subject_list) { + ITERATE(list >, iter, subject_list) { from = (from == 0) ? iter->GetFrom() : min(from,iter->GetFrom()); to = max(to,iter->GetTo()); } @@ -2898,8 +2903,8 @@ CAlignFormatUtil::SortSeqalignForSortableFormat(CCgiContext& ctx, int hsp_sort, ILinkoutDB* linkoutdb, const string& mv_build_name) { - - + + if (db_sort == 0 && hit_sort < 1 && hsp_sort < 1) return (CRef) &aln_set; @@ -2914,53 +2919,53 @@ CAlignFormatUtil::SortSeqalignForSortableFormat(CCgiContext& ctx, }else { seqalign_vec[0] = const_cast(&aln_set); } - - + + ITERATE(vector< CRef >, iter, seqalign_vec){ - list< CRef > one_seqalign_hit_total_list = SortOneSeqalignForSortableFormat(**iter, - nuc_to_nuc_translation, + list< CRef > one_seqalign_hit_total_list = SortOneSeqalignForSortableFormat(**iter, + nuc_to_nuc_translation, hit_sort, hsp_sort); seqalign_hit_total_list.splice(seqalign_hit_total_list.end(),one_seqalign_hit_total_list); - + } - + return HitListToHspList(seqalign_hit_total_list); } list< CRef > -CAlignFormatUtil::SortOneSeqalignForSortableFormat(const CSeq_align_set& source, - bool nuc_to_nuc_translation, +CAlignFormatUtil::SortOneSeqalignForSortableFormat(const CSeq_align_set& source, + bool nuc_to_nuc_translation, int hit_sort, - int hsp_sort) -{ + int hsp_sort) +{ list< CRef > seqalign_hit_total_list; list< CRef > seqalign_hit_list; HspListToHitList(seqalign_hit_list, source); - + if (hit_sort == eTotalScore) { seqalign_hit_list.sort(SortHitByTotalScoreDescending); } else if (hit_sort == eHighestScore) { seqalign_hit_list.sort(CAlignFormatUtil::SortHitByScoreDescending); - } else if (hit_sort == ePercentIdentity) { - SortHitByPercentIdentityDescending(seqalign_hit_list, + } else if (hit_sort == ePercentIdentity) { + SortHitByPercentIdentityDescending(seqalign_hit_list, nuc_to_nuc_translation); } else if (hit_sort == eQueryCoverage) { seqalign_hit_list.sort(SortHitByMasterCoverageDescending); } - ITERATE(list< CRef >, iter2, seqalign_hit_list) { + ITERATE(list< CRef >, iter2, seqalign_hit_list) { CRef temp(*iter2); if (hsp_sort == eQueryStart) { temp->Set().sort(SortHspByMasterStartAscending); } else if (hsp_sort == eHspPercentIdentity) { - temp->Set().sort(SortHspByPercentIdentityDescending); + temp->Set().sort(SortHspByPercentIdentityDescending); } else if (hsp_sort == eScore) { - temp->Set().sort(SortHspByScoreDescending); + temp->Set().sort(SortHspByScoreDescending); } else if (hsp_sort == eSubjectStart) { temp->Set().sort(SortHspBySubjectStartAscending); - - } + + } seqalign_hit_total_list.push_back(temp); } return seqalign_hit_total_list; @@ -2968,17 +2973,17 @@ CAlignFormatUtil::SortOneSeqalignForSortableFormat(const CSeq_align_set& source, CRef CAlignFormatUtil::SortSeqalignForSortableFormat(CSeq_align_set& aln_set, - bool nuc_to_nuc_translation, + bool nuc_to_nuc_translation, int hit_sort, int hsp_sort) { - if (hit_sort <= eEvalue && hsp_sort <= eHspEvalue) { + if (hit_sort <= eEvalue && hsp_sort <= eHspEvalue) { return (CRef) &aln_set; } // seqalign_vec[0] = const_cast(&aln_set); - list< CRef > seqalign_hit_total_list = SortOneSeqalignForSortableFormat(aln_set, - nuc_to_nuc_translation, + list< CRef > seqalign_hit_total_list = SortOneSeqalignForSortableFormat(aln_set, + nuc_to_nuc_translation, hit_sort, hsp_sort); return HitListToHspList(seqalign_hit_total_list); @@ -2994,24 +2999,24 @@ CRef CAlignFormatUtil::FilterSeqalignByEval(CSeq_align_set& sour list use_this_gi; CRef new_aln(new CSeq_align_set); - - ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){ + + ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){ CAlignFormatUtil::GetAlnScores(**iter, score, bits, evalue, sum_n, num_ident, use_this_gi); //Add the next three lines to re-calculte seq align evalue to the obe that is displayed on the screen //string evalue_buf, bit_score_buf, total_bit_buf, raw_score_buf; //CAlignFormatUtil::GetScoreString(evalue, bits, 0, 0, evalue_buf, bit_score_buf, total_bit_buf, raw_score_buf); - //evalue = NStr::StringToDouble(evalue_buf); - if(evalue >= evalueLow && evalue <= evalueHigh) { + //evalue = NStr::StringToDouble(evalue_buf); + if(evalue >= evalueLow && evalue <= evalueHigh) { new_aln->Set().push_back(*iter); } - } + } return new_aln; } /// Returns percent match for an alignment. -/// Normally we round up the value, unless that means that an +/// Normally we round up the value, unless that means that an /// alignment with mismatches would be 100%. In that case /// it becomes 99%. ///@param numerator: numerator in percent identity calculation. @@ -3032,32 +3037,32 @@ double CAlignFormatUtil::GetPercentIdentity(int numerator, int denominator) if (numerator == denominator) return 100; else { - double retval =100*(double)numerator/(double)denominator; + double retval =100*(double)numerator/(double)denominator; return retval; } } CRef CAlignFormatUtil::FilterSeqalignByPercentIdent(CSeq_align_set& source_aln, double percentIdentLow, - double percentIdentHigh) + double percentIdentHigh) { int score, sum_n, num_ident; double bits, evalue; list use_this_gi; CRef new_aln(new CSeq_align_set); - - ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){ + + ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){ CAlignFormatUtil::GetAlnScores(**iter, score, bits, evalue, - sum_n, num_ident, use_this_gi); - int seqAlnLength = GetAlignmentLength(**iter, kTranslation); + sum_n, num_ident, use_this_gi); + int seqAlnLength = GetAlignmentLength(**iter, kTranslation); if(seqAlnLength > 0 && num_ident > 0) { - double alnPercentIdent = GetPercentIdentity(num_ident, seqAlnLength); - if(alnPercentIdent >= percentIdentLow && alnPercentIdent <= percentIdentHigh) { + double alnPercentIdent = GetPercentIdentity(num_ident, seqAlnLength); + if(alnPercentIdent >= percentIdentLow && alnPercentIdent <= percentIdentHigh) { new_aln->Set().push_back(*iter); - } + } } - } + } return new_aln; } @@ -3072,8 +3077,8 @@ CRef CAlignFormatUtil::FilterSeqalignByScoreParams(CSeq_align_se list use_this_gi; CRef new_aln(new CSeq_align_set); - - ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){ + + ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){ CAlignFormatUtil::GetAlnScores(**iter, score, bits, evalue, sum_n, num_ident, use_this_gi); //Add the next three lines to re-calculte seq align evalue to the one that is displayed on the screen @@ -3088,13 +3093,13 @@ CRef CAlignFormatUtil::FilterSeqalignByScoreParams(CSeq_align_se new_aln->Set().push_back(*iter); } } - } + } return new_aln; } static double adjustPercentIdentToDisplayValue(double value) { - char buffer[512]; + char buffer[512]; sprintf(buffer, "%.*f", 2, value); double newVal = NStr::StringToDouble(buffer); return newVal; @@ -3110,7 +3115,7 @@ static bool s_isAlnInFilteringRange(double evalue, int queryCoverLow, int queryCoverHigh) { - + bool isInRange = false; //Adjust percent identity and evalue to display values @@ -3127,24 +3132,24 @@ static bool s_isAlnInFilteringRange(double evalue, } else if(evalueLow >= 0 && percentIdentLow >= 0) { isInRange = (evalue >= evalueLow && evalue <= evalueHigh) && - (percentIdent >= percentIdentLow && percentIdent <= percentIdentHigh); + (percentIdent >= percentIdentLow && percentIdent <= percentIdentHigh); } else if(evalueLow >= 0 && queryCoverLow >= 0) { isInRange = (evalue >= evalueLow && evalue <= evalueHigh) && - (queryCover >= queryCoverLow && queryCover <= queryCoverHigh); + (queryCover >= queryCoverLow && queryCover <= queryCoverHigh); } else if(queryCoverLow >= 0 && percentIdentLow >= 0) { isInRange = (queryCover >= queryCoverLow && queryCover <= queryCoverHigh) && - (percentIdent >= percentIdentLow && percentIdent <= percentIdentHigh); + (percentIdent >= percentIdentLow && percentIdent <= percentIdentHigh); } else if(evalueLow >= 0) { - isInRange = (evalue >= evalueLow && evalue <= evalueHigh); + isInRange = (evalue >= evalueLow && evalue <= evalueHigh); } else if(percentIdentLow >= 0) { - isInRange = (percentIdent >= percentIdentLow && percentIdent <= percentIdentHigh); + isInRange = (percentIdent >= percentIdentLow && percentIdent <= percentIdentHigh); } else if(queryCoverLow >= 0) { - isInRange = (queryCover >= queryCoverLow && queryCover <= queryCoverHigh); + isInRange = (queryCover >= queryCoverLow && queryCover <= queryCoverHigh); } return isInRange; } @@ -3161,11 +3166,11 @@ CRef CAlignFormatUtil::FilterSeqalignByScoreParams(CSeq_align_se list< CRef > seqalign_hit_list; HspListToHitList(seqalign_hit_list, source_aln); - - ITERATE(list< CRef >, iter, seqalign_hit_list) { + + ITERATE(list< CRef >, iter, seqalign_hit_list) { CRef temp(*iter); CAlignFormatUtil::SSeqAlignSetCalcParams* seqSetInfo = CAlignFormatUtil::GetSeqAlignSetCalcParamsFromASN(*temp); - + if(s_isAlnInFilteringRange(seqSetInfo->evalue, seqSetInfo->percent_identity, seqSetInfo->percent_coverage, @@ -3176,17 +3181,17 @@ CRef CAlignFormatUtil::FilterSeqalignByScoreParams(CSeq_align_se queryCoverLow, queryCoverHigh)) { seqalign_hit_total_list.push_back(temp); - } + } } - return HitListToHspList(seqalign_hit_total_list); + return HitListToHspList(seqalign_hit_total_list); } CRef CAlignFormatUtil::LimitSeqalignByHsps(CSeq_align_set& source_aln, int maxAligns, - int maxHsps) + int maxHsps) { - CRef new_aln(new CSeq_align_set); - + CRef new_aln(new CSeq_align_set); + CConstRef prevQueryId,prevSubjectId; int alignCount = 0,hspCount = 0; ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){ @@ -3195,35 +3200,35 @@ CRef CAlignFormatUtil::LimitSeqalignByHsps(CSeq_align_set& sourc if (hspCount >= maxHsps) { break; } - alignCount = 0; - prevQueryId = &newQueryId; - } - if (alignCount < maxAligns) { + alignCount = 0; + prevQueryId = &newQueryId; + } + if (alignCount < maxAligns) { const CSeq_id& newSubjectId = (*iter)->GetSeq_id(1); // Increment alignments count if subject sequence is different - if(prevSubjectId.Empty() || !newSubjectId.Match(*prevSubjectId)){ + if(prevSubjectId.Empty() || !newSubjectId.Match(*prevSubjectId)){ ++alignCount; prevSubjectId = &newSubjectId; } - // Increment HSP count if the alignments limit is not reached - ++hspCount; + // Increment HSP count if the alignments limit is not reached + ++hspCount; new_aln->Set().push_back(*iter); } - + } return new_aln; } CRef CAlignFormatUtil::ExtractQuerySeqAlign(CRef &source_aln, - int queryNumber) + int queryNumber) { if(queryNumber == 0) { return source_aln; } - CRef new_aln; - - CConstRef prevQueryId; + CRef new_aln; + + CConstRef prevQueryId; int currQueryNum = 0; ITERATE(CSeq_align_set::Tdata, iter, source_aln->Get()){ @@ -3231,17 +3236,17 @@ CRef CAlignFormatUtil::ExtractQuerySeqAlign(CRef if(prevQueryId.Empty() || !newQueryId.Match(*prevQueryId)){ currQueryNum++; prevQueryId = &newQueryId; - } + } //Record seq aligns corresponding to queryNumber if(currQueryNum == queryNumber) { if(new_aln.Empty()) { - new_aln.Reset(new CSeq_align_set); + new_aln.Reset(new CSeq_align_set); } - new_aln->Set().push_back(*iter); - } + new_aln->Set().push_back(*iter); + } else if(currQueryNum > queryNumber) { break; - } + } } return new_aln; } @@ -3258,25 +3263,25 @@ void CAlignFormatUtil::InitConfig() string l_fmtcfg_env; if( NULL != getenv("NCBI") ) l_ncbi_env = getenv("NCBI"); if( NULL != getenv("FMTCFG") ) l_fmtcfg_env = getenv("FMTCFG"); - // config file name: value of FMTCFG or default ( .ncbirc ) - if( l_fmtcfg_env.empty() ) + // config file name: value of FMTCFG or default ( .ncbirc ) + if( l_fmtcfg_env.empty() ) l_cfg_file_name = ".ncbirc"; - else + else l_cfg_file_name = l_fmtcfg_env; // checkinf existance of configuration file CFile l_fchecker( l_cfg_file_name ); cfgExists = l_fchecker.Exists(); if( (!cfgExists) && (!l_ncbi_env.empty()) ) { - if( l_ncbi_env.rfind("/") != (l_ncbi_env.length() -1 )) + if( l_ncbi_env.rfind("/") != (l_ncbi_env.length() -1 )) l_ncbi_env.append("/"); l_cfg_file_name = l_ncbi_env + l_cfg_file_name; CFile l_fchecker2( l_cfg_file_name ); - cfgExists = l_fchecker2.Exists(); - } + cfgExists = l_fchecker2.Exists(); + } if(cfgExists) { CNcbiIfstream l_ConfigFile(l_cfg_file_name.c_str() ); m_Reg.reset(new CNcbiRegistry(l_ConfigFile)); - if( l_dbg ) fprintf(stderr,"REGISTRY: %s\n",l_cfg_file_name.c_str()); + if( l_dbg ) fprintf(stderr,"REGISTRY: %s\n",l_cfg_file_name.c_str()); } } return; @@ -3285,45 +3290,45 @@ void CAlignFormatUtil::InitConfig() // // get given url from registry file or return corresponding kNAME // value as default to preserve compatibility. -// +// // algoritm: -// 1) config file name is ".ncbirc" unless FMTCFG specifies another name -// 2) try to read local configuration file before +// 1) config file name is ".ncbirc" unless FMTCFG specifies another name +// 2) try to read local configuration file before // checking location specified by the NCBI environment. // 3) if index != -1, use it as trailing version number for a key name, // ABCD_V0. try to read ABCD key if version variant doesn't exist. // 4) use INCLUDE_BASE_DIR key to specify base for all include files. // 5) treat "_FORMAT" key as filename first and string in second. -// in case of existances of filename, read it starting from +// in case of existances of filename, read it starting from // location specified by INCLUDE_BASE_DIR key string CAlignFormatUtil::GetURLFromRegistry( const string url_name, int index){ string result_url; - string l_key, l_host_port, l_format; + string l_key, l_host_port, l_format; string l_secion_name = "BLASTFMTUTIL"; string l_fmt_suffix = "_FORMAT"; string l_host_port_suffix = "_HOST_PORT"; string l_subst_pattern; - + if( !m_Reg ) { - InitConfig(); + InitConfig(); } if( !m_Reg ) return GetURLDefault(url_name,index); // can't read .ncbrc file string l_base_dir = m_Reg->Get(l_secion_name, "INCLUDE_BASE_DIR"); if( !l_base_dir.empty() && ( l_base_dir.rfind("/") != (l_base_dir.length()-1)) ) { l_base_dir.append("/"); } - + string default_host_port; - string l_key_ndx; - if( index >=0) { + string l_key_ndx; + if( index >=0) { l_key_ndx = url_name + l_host_port_suffix + "_" + NStr::IntToString( index ); - l_subst_pattern="<@"+l_key_ndx+"@>"; + l_subst_pattern="<@"+l_key_ndx+"@>"; l_host_port = m_Reg->Get(l_secion_name, l_key_ndx); // try indexed } // next is initialization for non version/array type of settings if( l_host_port.empty()){ // not indexed or index wasn't found - l_key = url_name + l_host_port_suffix; l_subst_pattern="<@"+l_key+"@>"; + l_key = url_name + l_host_port_suffix; l_subst_pattern="<@"+l_key+"@>"; l_host_port = m_Reg->Get(l_secion_name, l_key); } if( l_host_port.empty()) return GetURLDefault(url_name,index); @@ -3341,9 +3346,9 @@ string CAlignFormatUtil::GetURLFromRegistry( const string url_name, int index){ string l_format_file = l_base_dir + l_format; CFile l_fchecker( l_format_file ); bool file_name_mode = l_fchecker.Exists(); - if( file_name_mode ) { // read whole content of the file to string buffer + if( file_name_mode ) { // read whole content of the file to string buffer string l_inc_file_name = l_format_file; - CNcbiIfstream l_file (l_inc_file_name.c_str(), ios::in|ios::binary|ios::ate); + CNcbiIfstream l_file (l_inc_file_name.c_str(), ios::in|ios::binary|ios::ate); CT_POS_TYPE l_inc_size = l_file.tellg(); // size_t l_buf_sz = (size_t) l_inc_size; char *l_mem = new char [ (size_t) l_inc_size + 1]; @@ -3353,7 +3358,7 @@ string CAlignFormatUtil::GetURLFromRegistry( const string url_name, int index){ l_file.close(); l_format.erase(); l_format.reserve( (size_t)l_inc_size + 1 ); l_format = l_mem; - delete [] l_mem; + delete [] l_mem; } result_url = NStr::Replace(l_format,l_subst_pattern,l_host_port); @@ -3376,7 +3381,7 @@ string CAlignFormatUtil::GetURLDefault( const string url_name, int index) { } string error_msg = "CAlignFormatUtil::GetURLDefault:no_defualt_for"+url_name; - if( index != -1 ) error_msg += "_index_"+ NStr::IntToString( index ); + if( index != -1 ) error_msg += "_index_"+ NStr::IntToString( index ); return error_msg; } @@ -3390,7 +3395,7 @@ CAlignFormatUtil::GetAsciiProteinMatrix(const char* matrix_name, return; } - const SNCBIPackedScoreMatrix* packed_mtx = + const SNCBIPackedScoreMatrix* packed_mtx = NCBISM_GetStandardMatrix(matrix_name); if (packed_mtx == NULL) { return; @@ -3399,7 +3404,7 @@ CAlignFormatUtil::GetAsciiProteinMatrix(const char* matrix_name, SNCBIFullScoreMatrix mtx; NCBISM_Unpack(packed_mtx, &mtx); - + for(int i = 0; i < ePMatrixSize; ++i){ for(int j = 0; j < ePMatrixSize; ++j){ retval((size_t)k_PSymbol[i], (size_t)k_PSymbol[j]) = @@ -3409,7 +3414,7 @@ CAlignFormatUtil::GetAsciiProteinMatrix(const char* matrix_name, for(int i = 0; i < ePMatrixSize; ++i) { retval((size_t)k_PSymbol[i], '*') = retval('*',(size_t)k_PSymbol[i]) = -4; } - retval('*', '*') = 1; + retval('*', '*') = 1; // this is to count Selenocysteine to Cysteine matches as positive retval('U', 'U') = retval('C', 'C'); retval('U', 'C') = retval('C', 'C'); @@ -3436,24 +3441,22 @@ string CAlignFormatUtil::MapTemplate(string inpString,string tmplParamName,strin string CAlignFormatUtil::MapSpaceTemplate(string inpString,string tmplParamName,string templParamVal, unsigned int maxParamValLength, int spacesFormatFlag) { templParamVal = AddSpaces(templParamVal, maxParamValLength, spacesFormatFlag); - string outString = MapTemplate(inpString,tmplParamName,templParamVal); + string outString = MapTemplate(inpString,tmplParamName,templParamVal); return outString; } -string CAlignFormatUtil::AddSpaces(string paramVal, unsigned int maxParamValLength, int spacesFormatFlag) +string CAlignFormatUtil::AddSpaces(string paramVal, size_t maxParamValLength, int spacesFormatFlag) { //if(!spacePos.empty()) { - string spaceString; + string spaceString; if(maxParamValLength >= paramVal.size()) { - unsigned int numSpaces = maxParamValLength - paramVal.size() + 1; + size_t numSpaces = maxParamValLength - paramVal.size() + 1; if(spacesFormatFlag & eSpacePosToCenter) { numSpaces = numSpaces/2; } - for(size_t i=0; i < numSpaces ; i++){ - spaceString += " "; - } + spaceString.assign(numSpaces,' '); } else { paramVal = paramVal.substr(0, maxParamValLength - 3) + "..."; @@ -3461,7 +3464,7 @@ string CAlignFormatUtil::AddSpaces(string paramVal, unsigned int maxParamValLeng } if(spacesFormatFlag & eSpacePosAtLineEnd) { paramVal = paramVal + spaceString; - } + } else if(spacesFormatFlag & eSpacePosToCenter) { paramVal = spaceString + paramVal + spaceString; } @@ -3469,9 +3472,9 @@ string CAlignFormatUtil::AddSpaces(string paramVal, unsigned int maxParamValLeng paramVal = spaceString + paramVal; } if(spacesFormatFlag & eAddEOLAtLineStart) paramVal = "\n" + paramVal; - if(spacesFormatFlag & eAddEOLAtLineEnd) paramVal = paramVal + "\n"; + if(spacesFormatFlag & eAddEOLAtLineEnd) paramVal = paramVal + "\n"; //} - + return paramVal; } @@ -3486,7 +3489,7 @@ string CAlignFormatUtil::GetProtocol() if(config_reg.HasEntry("BLASTFMTUTIL","PROTOCOL")) { httpProt = config_reg.Get("BLASTFMTUTIL","PROTOCOL"); } - } + } return httpProt; } @@ -3500,8 +3503,8 @@ string CAlignFormatUtil::MapProtocol(string url_link) if(m_Protocol.empty()){ if(!m_Reg) { InitConfig(); - } - m_Protocol = (m_Reg && m_Reg->HasEntry("BLASTFMTUTIL","PROTOCOL")) ? m_Protocol = m_Reg->Get("BLASTFMTUTIL","PROTOCOL") : "https:"; + } + m_Protocol = (m_Reg && m_Reg->HasEntry("BLASTFMTUTIL","PROTOCOL")) ? m_Protocol = m_Reg->Get("BLASTFMTUTIL","PROTOCOL") : "https:"; } url_link = CAlignFormatUtil::MapTemplate(url_link,"protocol",m_Protocol); return url_link; @@ -3510,10 +3513,10 @@ string CAlignFormatUtil::MapProtocol(string url_link) static string s_MapCommonUrlParams(string urlTemplate, CAlignFormatUtil::SSeqURLInfo *seqUrlInfo) { string db,logstr_moltype; - if(seqUrlInfo->isDbNa) { + if(seqUrlInfo->isDbNa) { db = "nucleotide"; logstr_moltype = "nucl"; - } else { + } else { db = "protein"; logstr_moltype ="prot"; } @@ -3522,8 +3525,8 @@ static string s_MapCommonUrlParams(string urlTemplate, CAlignFormatUtil::SSeqURL url_link = CAlignFormatUtil::MapTemplate(url_link,"gi", GI_TO(TIntId, seqUrlInfo->gi)); url_link = CAlignFormatUtil::MapTemplate(url_link,"log",logstr_moltype + logstr_location); url_link = CAlignFormatUtil::MapTemplate(url_link,"blast_rank",seqUrlInfo->blast_rank); - url_link = CAlignFormatUtil::MapTemplate(url_link,"rid",seqUrlInfo->rid); - url_link = CAlignFormatUtil::MapTemplate(url_link,"acc",seqUrlInfo->accession); + url_link = CAlignFormatUtil::MapTemplate(url_link,"rid",seqUrlInfo->rid); + url_link = CAlignFormatUtil::MapTemplate(url_link,"acc",seqUrlInfo->accession); url_link = CAlignFormatUtil::MapProtocol(url_link); return url_link; } @@ -3534,7 +3537,7 @@ static string s_MapURLLink(string urlTemplate, CAlignFormatUtil::SSeqURLInfo *se string url_link = urlTemplate; if (seqUrlInfo->user_url.find("sra.cgi") != string::npos) { string strRun, strSpotId,strReadIndex; - if(s_GetSRASeqMetadata(ids,strRun,strSpotId,strReadIndex)) { + if(s_GetSRASeqMetadata(ids,strRun,strSpotId,strReadIndex)) { url_link = CAlignFormatUtil::MapTemplate(url_link,"run",strRun); url_link = CAlignFormatUtil::MapTemplate(url_link,"spotid",strSpotId); url_link = CAlignFormatUtil::MapTemplate(url_link,"readindex",strReadIndex); @@ -3549,7 +3552,7 @@ static string s_MapURLLink(string urlTemplate, CAlignFormatUtil::SSeqURLInfo *se bool CAlignFormatUtil::IsWGSPattern(string &wgsAccession) { - //const string kWgsAccessionPattern = "^[A-Z]{4}[0-9]{8,10}(\.[0-9]+){0,1}$"; //example AUXO013124042 or AUXO013124042.1 + //const string kWgsAccessionPattern = "^[A-Z]{4}[0-9]{8,10}(\.[0-9]+){0,1}$"; //example AUXO013124042 or AUXO013124042.1 const unsigned int kWgsProjLength = 4; const unsigned int kWgsProjIDLengthMin = 8; const unsigned int kWgsProjIDLengthMax = 10; @@ -3559,12 +3562,12 @@ bool CAlignFormatUtil::IsWGSPattern(string &wgsAccession) return false; } - if(NStr::Find(wgsAccession, ".") != NPOS) { //Accession has version AUXO013124042.1 + if(NStr::Find(wgsAccession, ".") != NPOS) { //Accession has version AUXO013124042.1 string version; - NStr::SplitInTwo(wgsAccession,".",wgsAccession,version); + NStr::SplitInTwo(wgsAccession,".",wgsAccession,version); } - string wgsProj = wgsAccession.substr(0,kWgsProjLength); + string wgsProj = wgsAccession.substr(0,kWgsProjLength); for (size_t i = 0; i < wgsProj.length(); i ++){ if(!isalpha(wgsProj[i]&0xff)) { isWGS = false; @@ -3587,24 +3590,24 @@ bool CAlignFormatUtil::IsWGSPattern(string &wgsAccession) } return isWGS; } - + bool CAlignFormatUtil::IsWGSAccession(string &wgsAccession, string &wgsProjName) -{ - const unsigned int kWgsProgNameLength = 6; +{ + const unsigned int kWgsProgNameLength = 6; bool isWGS = IsWGSPattern(wgsAccession); if(isWGS) { - wgsProjName = wgsAccession.substr(0,kWgsProgNameLength); + wgsProjName = wgsAccession.substr(0,kWgsProgNameLength); } return isWGS; } - + string CAlignFormatUtil::GetIDUrlGen(SSeqURLInfo *seqUrlInfo,const CBioseq::TId* ids) { string url_link = NcbiEmptyString; CConstRef wid = FindBestChoice(*ids, CSeq_id::WorstRank); - + bool hasTextSeqID = GetTextSeqID(*ids); string title = "title=\"Show report for " + seqUrlInfo->accession + "\" "; @@ -3615,53 +3618,53 @@ string CAlignFormatUtil::GetIDUrlGen(SSeqURLInfo *seqUrlInfo,const CBioseq::TId* if (!(wid->Which() == CSeq_id::e_Local || wid->Which() == CSeq_id::e_General)){ isWGS = CAlignFormatUtil::IsWGSAccession(wgsAccession, wgsProj); } - if(isWGS && seqUrlInfo->useTemplates) { - string wgsUrl = CAlignFormatUtil::GetURLFromRegistry("WGS"); + if(isWGS && seqUrlInfo->useTemplates) { + string wgsUrl = CAlignFormatUtil::GetURLFromRegistry("WGS"); url_link = s_MapCommonUrlParams(wgsUrl, seqUrlInfo); - url_link = CAlignFormatUtil::MapTemplate(url_link,"wgsproj",wgsProj); - url_link = CAlignFormatUtil::MapTemplate(url_link,"wgsacc", wgsAccession); - } - else if (hasTextSeqID) { + url_link = CAlignFormatUtil::MapTemplate(url_link,"wgsproj",wgsProj); + url_link = CAlignFormatUtil::MapTemplate(url_link,"wgsacc", wgsAccession); + } + else if (hasTextSeqID) { string entrezTag = (seqUrlInfo->useTemplates) ? "ENTREZ_TM" : "ENTREZ"; string l_EntrezUrl = CAlignFormatUtil::GetURLFromRegistry(entrezTag); url_link = s_MapCommonUrlParams(l_EntrezUrl, seqUrlInfo); - - if(!seqUrlInfo->useTemplates) { - url_link = CAlignFormatUtil::MapTemplate(url_link,"acc",seqUrlInfo->accession); + + if(!seqUrlInfo->useTemplates) { + url_link = CAlignFormatUtil::MapTemplate(url_link,"acc",seqUrlInfo->accession); temp_class_info = (!seqUrlInfo->defline.empty())? CAlignFormatUtil::MapTemplate(temp_class_info,"defline",NStr::JavaScriptEncode(seqUrlInfo->defline)):temp_class_info; url_link = CAlignFormatUtil::MapTemplate(url_link,"cssInf",(seqUrlInfo->addCssInfo) ? temp_class_info.c_str() : ""); - url_link = CAlignFormatUtil::MapTemplate(url_link,"target",seqUrlInfo->new_win ? "TARGET=\"EntrezView\"" : ""); - } - - } else {//seqid general, dbtag specified + url_link = CAlignFormatUtil::MapTemplate(url_link,"target",seqUrlInfo->new_win ? "TARGET=\"EntrezView\"" : ""); + } + + } else {//seqid general, dbtag specified if(wid->Which() == CSeq_id::e_General){ const CDbtag& dtg = wid->GetGeneral(); const string& dbname = dtg.GetDb(); if(NStr::CompareNocase(dbname, "TI") == 0){ - string actual_id = CAlignFormatUtil::GetGnlID(dtg); + string actual_id = CAlignFormatUtil::GetGnlID(dtg); if(seqUrlInfo->useTemplates) { - string l_TraceUrl = CAlignFormatUtil::GetURLFromRegistry("TRACE_CGI"); + string l_TraceUrl = CAlignFormatUtil::GetURLFromRegistry("TRACE_CGI"); url_link = l_TraceUrl + (string)"?cmd=retrieve&dopt=fasta&val=" + actual_id + "&RID=" + seqUrlInfo->rid; } - else { - url_link = CAlignFormatUtil::MapTemplate(kTraceUrl,"val",actual_id); + else { + url_link = CAlignFormatUtil::MapTemplate(kTraceUrl,"val",actual_id); temp_class_info = (!seqUrlInfo->defline.empty())? CAlignFormatUtil::MapTemplate(temp_class_info,"defline",seqUrlInfo->defline):temp_class_info; url_link = CAlignFormatUtil::MapTemplate(url_link,"cssInf",(seqUrlInfo->addCssInfo) ? temp_class_info.c_str() : ""); - url_link = CAlignFormatUtil::MapTemplate(url_link,"rid",seqUrlInfo->rid); - } + url_link = CAlignFormatUtil::MapTemplate(url_link,"rid",seqUrlInfo->rid); + } } } else if (wid->Which() == CSeq_id::e_Local){ - + string url_holder = CAlignFormatUtil::GetURLFromRegistry("LOCAL_ID"); - + string user_url; if (m_Reg) { user_url = (seqUrlInfo->addCssInfo) ? m_Reg->Get("LOCAL_ID","TOOL_URL_ALIGN") : m_Reg->Get("LOCAL_ID","TOOL_URL"); } string id_string; wid->GetLabel(&id_string, CSeq_id::eContent); - url_link = CAlignFormatUtil::MapTemplate(user_url,"seq_id", NStr::URLEncode(id_string)); - url_link = CAlignFormatUtil::MapTemplate(url_link,"db_name", NStr::URLEncode(seqUrlInfo->database)); + url_link = CAlignFormatUtil::MapTemplate(user_url,"seq_id", NStr::URLEncode(id_string)); + url_link = CAlignFormatUtil::MapTemplate(url_link,"db_name", NStr::URLEncode(seqUrlInfo->database)); url_link = CAlignFormatUtil::MapTemplate(url_link,"taxid", TAX_ID_TO(int, seqUrlInfo->taxid)); temp_class_info = (!seqUrlInfo->defline.empty())? CAlignFormatUtil::MapTemplate(temp_class_info,"defline",seqUrlInfo->defline):temp_class_info; url_link = CAlignFormatUtil::MapTemplate(url_link,"cssInf",(seqUrlInfo->addCssInfo) ? temp_class_info.c_str() : ""); @@ -3678,7 +3681,7 @@ string CAlignFormatUtil::GetIDUrlGen(SSeqURLInfo *seqUrlInfo,const CSeq_id& id,o { const CBioseq_Handle& handle = scope.GetBioseqHandle(id); const CBioseq::TId* ids = &handle.GetBioseqCore()->GetId(); - + string url_link = GetIDUrlGen(seqUrlInfo,ids); return url_link; } @@ -3687,23 +3690,23 @@ string CAlignFormatUtil::GetIDUrl(SSeqURLInfo *seqUrlInfo,const CBioseq::TId* id { string url_link = NcbiEmptyString; CConstRef wid = FindBestChoice(*ids, CSeq_id::WorstRank); - + string title = "title=\"Show report for " + seqUrlInfo->accession + "\" "; - if (seqUrlInfo->user_url != NcbiEmptyString && - !((seqUrlInfo->user_url.find("dumpgnl.cgi") != string::npos && seqUrlInfo->gi > ZERO_GI) || + if (seqUrlInfo->user_url != NcbiEmptyString && + !((seqUrlInfo->user_url.find("dumpgnl.cgi") != string::npos && seqUrlInfo->gi > ZERO_GI) || (seqUrlInfo->user_url.find("maps.cgi") != string::npos))) { - + string url_with_parameters,toolURLParams; if(m_Reg && !seqUrlInfo->blastType.empty() && seqUrlInfo->blastType != "newblast") { - toolURLParams = m_Reg->Get(seqUrlInfo->blastType, "TOOL_URL_PARAMS"); - } - if(!toolURLParams.empty()) { + toolURLParams = m_Reg->Get(seqUrlInfo->blastType, "TOOL_URL_PARAMS"); + } + if(!toolURLParams.empty()) { string urlLinkTemplate = seqUrlInfo->user_url + toolURLParams; - url_with_parameters = s_MapURLLink(urlLinkTemplate, seqUrlInfo, *ids); + url_with_parameters = s_MapURLLink(urlLinkTemplate, seqUrlInfo, *ids); } - else { - if (seqUrlInfo->user_url.find("sra.cgi") != string::npos) { + else { + if (seqUrlInfo->user_url.find("sra.cgi") != string::npos) { url_with_parameters = CAlignFormatUtil::BuildSRAUrl(*ids, seqUrlInfo->user_url); } else { @@ -3713,21 +3716,21 @@ string CAlignFormatUtil::GetIDUrl(SSeqURLInfo *seqUrlInfo,const CBioseq::TId* id seqUrlInfo->queryNumber, seqUrlInfo->isAlignLink); } - } + } if (url_with_parameters != NcbiEmptyString) { if (!seqUrlInfo->useTemplates) { string deflineInfo; if(seqUrlInfo->addCssInfo) { deflineInfo = (!seqUrlInfo->defline.empty())? CAlignFormatUtil::MapTemplate(kClassInfo,"defline",seqUrlInfo->defline):kClassInfo; } - url_link += "useTemplates) url_link += "\">"; - } - } - else { - //use entrez or dbtag specified + } + } + else { + //use entrez or dbtag specified url_link = GetIDUrlGen(seqUrlInfo,ids); } seqUrlInfo->seqUrl = url_link; @@ -3739,22 +3742,22 @@ string CAlignFormatUtil::GetIDUrl(SSeqURLInfo *seqUrlInfo,const CSeq_id& id,obje { const CBioseq_Handle& handle = scope.GetBioseqHandle(id); const CBioseq::TId* ids = &handle.GetBioseqCore()->GetId(); - - + + seqUrlInfo->blastType = NStr::TruncateSpaces(NStr::ToLower(seqUrlInfo->blastType)); - + if(seqUrlInfo->taxid == INVALID_TAX_ID) { //taxid is not set seqUrlInfo->taxid = ZERO_TAX_ID; - if ((seqUrlInfo->advancedView || seqUrlInfo->blastType == "mapview" || seqUrlInfo->blastType == "mapview_prev") || + if ((seqUrlInfo->advancedView || seqUrlInfo->blastType == "mapview" || seqUrlInfo->blastType == "mapview_prev") || seqUrlInfo->blastType == "gsfasta" || seqUrlInfo->blastType == "gsfasta_prev") { - seqUrlInfo->taxid = GetTaxidForSeqid(id, scope); + seqUrlInfo->taxid = GetTaxidForSeqid(id, scope); } } string url_link = GetIDUrl(seqUrlInfo,ids); return url_link; } -//static const char kGenericLinkTemplate[] = "\" target=\"lnk<@rid@>\" title=\"Show report for <@seqid@>\"><@gi@><@seqid@>"; +//static const char kGenericLinkTemplate[] = "\" target=\"lnk<@rid@>\" title=\"Show report for <@seqid@>\"><@gi@><@seqid@>"; string CAlignFormatUtil::GetFullIDLink(SSeqURLInfo *seqUrlInfo,const CBioseq::TId* ids) { string seqLink; @@ -3765,24 +3768,24 @@ string CAlignFormatUtil::GetFullIDLink(SSeqURLInfo *seqUrlInfo,const CBioseq::TI seqLink = CAlignFormatUtil::MapTemplate(seqLink,"rid",seqUrlInfo->rid); seqLink = CAlignFormatUtil::MapTemplate(seqLink,"seqid",seqUrlInfo->accession); seqLink = CAlignFormatUtil::MapTemplate(seqLink,"gi", GI_TO(TIntId, seqUrlInfo->gi)); - seqLink = CAlignFormatUtil::MapTemplate(seqLink,"target","EntrezView"); + seqLink = CAlignFormatUtil::MapTemplate(seqLink,"target","EntrezView"); if(seqUrlInfo->addCssInfo) { - seqLink = CAlignFormatUtil::MapTemplate(seqLink,"defline",NStr::JavaScriptEncode(seqUrlInfo->defline)); - } - } + seqLink = CAlignFormatUtil::MapTemplate(seqLink,"defline",NStr::JavaScriptEncode(seqUrlInfo->defline)); + } + } return seqLink; } static string s_MapCustomLink(string linkUrl,string reportType,string accession, string linkText, string linktrg, string linkTitle = kCustomLinkTitle,string linkCls = "") { - string link = CAlignFormatUtil::MapTemplate(kCustomLinkTemplate,"custom_url",linkUrl); + string link = CAlignFormatUtil::MapTemplate(kCustomLinkTemplate,"custom_url",linkUrl); link = CAlignFormatUtil::MapProtocol(link); - link = CAlignFormatUtil::MapTemplate(link,"custom_title",linkTitle); - link = CAlignFormatUtil::MapTemplate(link,"custom_report_type",reportType); - link = CAlignFormatUtil::MapTemplate(link,"seqid",accession); - link = CAlignFormatUtil::MapTemplate(link,"custom_lnk_displ",linkText); + link = CAlignFormatUtil::MapTemplate(link,"custom_title",linkTitle); + link = CAlignFormatUtil::MapTemplate(link,"custom_report_type",reportType); + link = CAlignFormatUtil::MapTemplate(link,"seqid",accession); + link = CAlignFormatUtil::MapTemplate(link,"custom_lnk_displ",linkText); link = CAlignFormatUtil::MapTemplate(link,"custom_cls",linkCls); - link = CAlignFormatUtil::MapTemplate(link,"custom_trg",linktrg); + link = CAlignFormatUtil::MapTemplate(link,"custom_trg",linktrg); return link; } @@ -3791,14 +3794,14 @@ static string s_MapCustomLink(string linkUrl,string reportType,string accession, list CAlignFormatUtil::GetGiLinksList(SSeqURLInfo *seqUrlInfo, bool hspRange) { - list customLinksList; - if (seqUrlInfo->hasTextSeqID) { + list customLinksList; + if (seqUrlInfo->hasTextSeqID) { //First show links to GenBank and FASTA string linkUrl,link,linkTiltle = kCustomLinkTitle; - + linkUrl = seqUrlInfo->seqUrl; if(NStr::Find(linkUrl, "report=genbank") == NPOS) { //Geo case - linkUrl = s_MapCommonUrlParams(kEntrezTMUrl, seqUrlInfo); + linkUrl = s_MapCommonUrlParams(kEntrezTMUrl, seqUrlInfo); } string linkText = (seqUrlInfo->isDbNa) ? "GenBank" : "GenPept"; if(hspRange) { @@ -3816,45 +3819,45 @@ string CAlignFormatUtil::GetGraphiscLink(SSeqURLInfo *seqUrlInfo, { //seqviewer string dbtype = (seqUrlInfo->isDbNa) ? "nuccore" : "protein"; - string seqViewUrl = (seqUrlInfo->gi > ZERO_GI)?kSeqViewerUrl:kSeqViewerUrlNonGi; + string seqViewUrl = (seqUrlInfo->gi > ZERO_GI)?kSeqViewerUrl:kSeqViewerUrlNonGi; string linkUrl = CAlignFormatUtil::MapTemplate(seqViewUrl,"rid",seqUrlInfo->rid); string seqViewerParams; if(m_Reg && !seqUrlInfo->blastType.empty() && seqUrlInfo->blastType != "newblast") { - seqViewerParams = m_Reg->Get(seqUrlInfo->blastType, "SEQVIEW_PARAMS"); + seqViewerParams = m_Reg->Get(seqUrlInfo->blastType, "SEQVIEW_PARAMS"); } seqViewerParams = seqViewerParams.empty() ? kSeqViewerParams : seqViewerParams; linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"seqViewerParams",seqViewerParams); - - linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"dbtype",dbtype); + + linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"dbtype",dbtype); linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"gi", GI_TO(TIntId, seqUrlInfo->gi)); - string linkTitle = "Show alignment to <@seqid@> in <@custom_report_type@>"; + string linkTitle = "Show alignment to <@seqid@> in <@custom_report_type@>"; string link_loc; if(!hspRange) { int addToRange = (int) ((seqUrlInfo->seqRange.GetTo() - seqUrlInfo->seqRange.GetFrom()) * 0.05);//add 5% to each side - linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"from",max(0,(int)seqUrlInfo->seqRange.GetFrom() - addToRange)); - linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"to",seqUrlInfo->seqRange.GetTo() + addToRange); + linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"from",max(0,(int)seqUrlInfo->seqRange.GetFrom() - addToRange)); + linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"to",seqUrlInfo->seqRange.GetTo() + addToRange); link_loc = "fromSubj"; - //linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"flip",NStr::BoolToString(seqUrlInfo->flip)); + //linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"flip",NStr::BoolToString(seqUrlInfo->flip)); } else { link_loc = "fromHSP"; linkTitle += " for <@fromHSP@> to <@toHSP@> range"; - } + } linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"link_loc",link_loc); string title = (seqUrlInfo->isDbNa) ? "Nucleotide Graphics" : "Protein Graphics"; - - string link = s_MapCustomLink(linkUrl,title,seqUrlInfo->accession, "Graphics","lnk" + seqUrlInfo->rid,linkTitle,"spr"); - + + string link = s_MapCustomLink(linkUrl,title,seqUrlInfo->accession, "Graphics","lnk" + seqUrlInfo->rid,linkTitle,"spr"); + return link; } -list CAlignFormatUtil::GetSeqLinksList(SSeqURLInfo *seqUrlInfo, +list CAlignFormatUtil::GetSeqLinksList(SSeqURLInfo *seqUrlInfo, bool hspRange) { - list customLinksList = GetGiLinksList(seqUrlInfo,hspRange); //ONLY FOR genBank seqUrlInfo->seqUrl has "report=genbank" + list customLinksList = GetGiLinksList(seqUrlInfo,hspRange); //ONLY FOR genBank seqUrlInfo->seqUrl has "report=genbank" string graphicLink = GetGraphiscLink(seqUrlInfo,hspRange); if(!graphicLink.empty()) { customLinksList.push_back(graphicLink); @@ -3867,20 +3870,20 @@ int CAlignFormatUtil::SetCustomLinksTypes(SSeqURLInfo *seqUrlInfo, int customLin int customLinkTypes = customLinkTypesInp; if ( seqUrlInfo->gi > ZERO_GI) { customLinkTypes +=eLinkTypeGenLinks; - } + } //else if(NStr::StartsWith(seqUrlInfo->accession,"ti:")) {//seqUrlInfo->seqUrl has "trace.cgi" - else if(NStr::Find(seqUrlInfo->seqUrl,"trace.cgi") != NPOS ){ + else if(NStr::Find(seqUrlInfo->seqUrl,"trace.cgi") != NPOS ){ customLinkTypes +=eLinkTypeTraceLinks; - } - else if(seqUrlInfo->blastType == "sra") {//seqUrlInfo->seqUrl has sra.cgi - customLinkTypes +=eLinkTypeSRALinks; - } - else if(seqUrlInfo->blastType == "snp") {//seqUrlInfo->seqUrl has snp_ref.cgi - customLinkTypes +=eLinkTypeSNPLinks; - } + } + else if(seqUrlInfo->blastType == "sra") {//seqUrlInfo->seqUrl has sra.cgi + customLinkTypes +=eLinkTypeSRALinks; + } + else if(seqUrlInfo->blastType == "snp") {//seqUrlInfo->seqUrl has snp_ref.cgi + customLinkTypes +=eLinkTypeSNPLinks; + } else if(seqUrlInfo->blastType == "gsfasta") {//seqUrlInfo->seqUrl has GSfasta.cgi customLinkTypes +=eLinkTypeGSFastaLinks; - } + } return customLinkTypes; } @@ -3889,47 +3892,47 @@ int CAlignFormatUtil::SetCustomLinksTypes(SSeqURLInfo *seqUrlInfo, int customLin //<@custom_lnk_displ@> list CAlignFormatUtil::GetCustomLinksList(SSeqURLInfo *seqUrlInfo, const CSeq_id& id, - objects::CScope &scope, - int customLinkTypes) -{ + objects::CScope &scope, + int customLinkTypes) +{ list customLinksList; string linkUrl,link; customLinkTypes = SetCustomLinksTypes(seqUrlInfo, customLinkTypes); - //First show links to GenBank and FASTA, then to Graphics + //First show links to GenBank and FASTA, then to Graphics customLinksList = GetSeqLinksList(seqUrlInfo); - if(customLinkTypes & eLinkTypeTraceLinks) { + if(customLinkTypes & eLinkTypeTraceLinks) { linkUrl = seqUrlInfo->seqUrl; link = s_MapCustomLink(linkUrl,"Trace Archive FASTA",seqUrlInfo->accession, "FASTA","lnk" + seqUrlInfo->rid); customLinksList.push_back(link); linkUrl = NStr::Replace(seqUrlInfo->seqUrl,"fasta","trace"); - link = s_MapCustomLink(linkUrl,"Trace Archive Trace",seqUrlInfo->accession, "Trace","lnk" + seqUrlInfo->rid); + link = s_MapCustomLink(linkUrl,"Trace Archive Trace",seqUrlInfo->accession, "Trace","lnk" + seqUrlInfo->rid); customLinksList.push_back(link); linkUrl = NStr::Replace(seqUrlInfo->seqUrl,"fasta","quality"); - link = s_MapCustomLink(linkUrl,"Trace Archive Quality",seqUrlInfo->accession, "Quality","lnk" + seqUrlInfo->rid); + link = s_MapCustomLink(linkUrl,"Trace Archive Quality",seqUrlInfo->accession, "Quality","lnk" + seqUrlInfo->rid); customLinksList.push_back(link); linkUrl = NStr::Replace(seqUrlInfo->seqUrl,"fasta","info"); - link = s_MapCustomLink(linkUrl,"Trace Archive Info",seqUrlInfo->accession, "Info","lnk" + seqUrlInfo->rid); + link = s_MapCustomLink(linkUrl,"Trace Archive Info",seqUrlInfo->accession, "Info","lnk" + seqUrlInfo->rid); customLinksList.push_back(link); - } - else if(customLinkTypes & eLinkTypeSRALinks) { + } + else if(customLinkTypes & eLinkTypeSRALinks) { linkUrl = seqUrlInfo->seqUrl; link = s_MapCustomLink(linkUrl,"SRA",seqUrlInfo->accession, "SRA","lnk" + seqUrlInfo->rid); customLinksList.push_back(link); - } - else if(customLinkTypes & eLinkTypeSNPLinks) { + } + else if(customLinkTypes & eLinkTypeSNPLinks) { linkUrl = seqUrlInfo->seqUrl; link = s_MapCustomLink(linkUrl,"SNP",seqUrlInfo->accession, "SNP","lnk" + seqUrlInfo->rid); customLinksList.push_back(link); - + //SNP accession=rs35885954 string rs = NStr::Replace(seqUrlInfo->accession,"rs",""); linkUrl = seqUrlInfo->resourcesUrl + rs + "?report=FLT"; - + link = s_MapCustomLink(linkUrl,"Flatfile",seqUrlInfo->accession, "Flatfile","lnk" + seqUrlInfo->rid); customLinksList.push_back(link); @@ -3941,38 +3944,38 @@ list CAlignFormatUtil::GetCustomLinksList(SSeqURLInfo *seqUrlInfo, linkUrl = NStr::Replace(linkUrl,"fasta","docsum"); link = s_MapCustomLink(linkUrl,"Graphic summary ",seqUrlInfo->accession, "Graphic summary ","lnk" + seqUrlInfo->rid); customLinksList.push_back(link); - } - else if(customLinkTypes & eLinkTypeGSFastaLinks) { + } + else if(customLinkTypes & eLinkTypeGSFastaLinks) { linkUrl = seqUrlInfo->seqUrl; link = s_MapCustomLink(linkUrl,"GSFASTA",seqUrlInfo->accession, "GSFASTA","lnk" + seqUrlInfo->rid); customLinksList.push_back(link); - } - return customLinksList; + } + return customLinksList; } string CAlignFormatUtil::GetAlignedRegionsURL(SSeqURLInfo *seqUrlInfo, const CSeq_id& id, - objects::CScope &scope) + objects::CScope &scope) { const CBioseq_Handle& handle = scope.GetBioseqHandle(id); - const CBioseq::TId* ids = &handle.GetBioseqCore()->GetId(); + const CBioseq::TId* ids = &handle.GetBioseqCore()->GetId(); string linkUrl,link; - - - linkUrl = CAlignFormatUtil::BuildUserUrl(*ids, + + + linkUrl = CAlignFormatUtil::BuildUserUrl(*ids, ZERO_TAX_ID, kDownloadUrl, seqUrlInfo->database, - seqUrlInfo->isDbNa, + seqUrlInfo->isDbNa, seqUrlInfo->rid, seqUrlInfo->queryNumber, true); if(!linkUrl.empty()) { - linkUrl += "&segs="+ seqUrlInfo->segs; - } - - return linkUrl; + linkUrl += "&segs="+ seqUrlInfo->segs; + } + + return linkUrl; } @@ -3980,82 +3983,44 @@ string CAlignFormatUtil::GetAlignedRegionsURL(SSeqURLInfo *seqUrlInfo, string CAlignFormatUtil::GetFASTALinkURL(SSeqURLInfo *seqUrlInfo, const CSeq_id& id, objects::CScope &scope) - + { string linkUrl; int customLinkTypes = SetCustomLinksTypes(seqUrlInfo, CAlignFormatUtil::eLinkTypeDefault); - + if( (customLinkTypes & eLinkTypeGenLinks) || (customLinkTypes & eLinkTypeTraceLinks)){ - linkUrl = seqUrlInfo->seqUrl; + linkUrl = seqUrlInfo->seqUrl; linkUrl = NStr::Replace(linkUrl,"genbank","fasta"); - } - else if(customLinkTypes & eLinkTypeSNPLinks) { - linkUrl = seqUrlInfo->seqUrl; + } + else if(customLinkTypes & eLinkTypeSNPLinks) { + linkUrl = seqUrlInfo->seqUrl; vector parts; //SNP accession=dbSNP:rs35885954 - NStr::Split(seqUrlInfo->accession,":rs",parts,NStr::fSplit_MergeDelimiters); + NStr::Split(seqUrlInfo->accession,":rs",parts,NStr::fSplit_MergeDelimiters); string rs; if(parts.size() > 1) { rs = parts[1]; } - linkUrl = seqUrlInfo->resourcesUrl + rs + "?report=fasta"; - } - return linkUrl; -} - -string CAlignFormatUtil::GetGeneInfo(TGi giForGeneLookup) -{ - string geneSym; - try - { - CNcbiEnvironment env; - if (env.Get(GENE_INFO_PATH_ENV_VARIABLE) != kEmptyStr) - { - - if (m_GeneInfoReader.get() == 0) - { - m_GeneInfoReader.reset(new CGeneInfoFileReader(false)); - } - - - CGeneInfoFileReader::TGeneInfoList infoList; - m_GeneInfoReader->GetGeneInfoForGi(giForGeneLookup,infoList); - - CGeneInfoFileReader::TGeneInfoList::const_iterator itInfo = infoList.begin(); - for (; itInfo != infoList.end(); itInfo++) - { - CRef info = *itInfo; - geneSym = info->GetSymbol(); - break;//??? - } - } - } - catch (CException& e) - { - geneSym = "(Gene info extraction error: " + e.GetMsg() + ")"; - } - catch (...) - { - geneSym = "(Gene info extraction error)"; + linkUrl = seqUrlInfo->resourcesUrl + rs + "?report=fasta"; } - return geneSym; + return linkUrl; } - -CAlignFormatUtil::DbType CAlignFormatUtil::GetDbType(const CSeq_align_set& actual_aln_list, CScope & scope) + +CAlignFormatUtil::DbType CAlignFormatUtil::GetDbType(const CSeq_align_set& actual_aln_list, CScope & scope) { - //determine if the database has gi by looking at the 1st hit. + //determine if the database has gi by looking at the 1st hit. //Could be wrong but simple for now DbType type = eDbTypeNotSet; CRef first_aln = actual_aln_list.Get().front(); const CSeq_id& subject_id = first_aln->GetSeq_id(1); - + if (subject_id.Which() != CSeq_id::e_Local){ const CBioseq_Handle& handleTemp = scope.GetBioseqHandle(subject_id); if(handleTemp){ TGi giTemp = FindGi(handleTemp.GetBioseqCore()->GetId()); - if (giTemp > ZERO_GI || GetTextSeqID((CConstRef)&subject_id)) { + if (giTemp > ZERO_GI || GetTextSeqID((CConstRef)&subject_id)) { type = eDbGi; } else if (subject_id.Which() == CSeq_id::e_General){ const CDbtag& dtg = subject_id.GetGeneral(); @@ -4069,19 +4034,19 @@ CAlignFormatUtil::DbType CAlignFormatUtil::GetDbType(const CSeq_align_set& actua return type; } -CAlignFormatUtil::SSeqAlignSetCalcParams* +CAlignFormatUtil::SSeqAlignSetCalcParams* CAlignFormatUtil::GetSeqAlignCalcParams(const CSeq_align& aln) -{ +{ int score = 0; double bits = 0; double evalue = 0; int sum_n = 0; int num_ident = 0; - list use_this_gi; + list use_this_gi; use_this_gi.clear(); - //Gets scores directly from seq align - GetAlnScores(aln, score, bits, evalue, sum_n, + //Gets scores directly from seq align + GetAlnScores(aln, score, bits, evalue, sum_n, num_ident, use_this_gi); unique_ptr seqSetInfo(new SSeqAlignSetCalcParams); @@ -4093,15 +4058,15 @@ CAlignFormatUtil::GetSeqAlignCalcParams(const CSeq_align& aln) seqSetInfo->evalue = evalue; seqSetInfo->match = num_ident; seqSetInfo->id = &(aln.GetSeq_id(1)); - seqSetInfo->subjRange = CRange(0,0); + seqSetInfo->subjRange = CRange(0,0); seqSetInfo->flip = false; - + return seqSetInfo.release(); } -CAlignFormatUtil::SSeqAlignSetCalcParams* +CAlignFormatUtil::SSeqAlignSetCalcParams* CAlignFormatUtil::GetSeqAlignSetCalcParams(const CSeq_align_set& aln,int queryLength, bool do_translation) { int score = 0; @@ -4114,7 +4079,7 @@ CAlignFormatUtil::GetSeqAlignSetCalcParams(const CSeq_align_set& aln,int queryLe if(aln.Get().empty()) return seqSetInfo; - seqSetInfo = GetSeqAlignCalcParams(*(aln.Get().front())); + seqSetInfo = GetSeqAlignCalcParams(*(aln.Get().front())); double total_bits = 0; double highest_bits = 0; @@ -4123,24 +4088,24 @@ CAlignFormatUtil::GetSeqAlignSetCalcParams(const CSeq_align_set& aln,int queryLe int highest_ident = 0; //int highest_identity = 0; double totalLen = 0; - - list use_this_gi; // Not used here, but needed for GetAlnScores. - - seqSetInfo->subjRange = CAlignFormatUtil::GetSeqAlignCoverageParams(aln,&seqSetInfo->master_covered_length,&seqSetInfo->flip); + + list use_this_gi; // Not used here, but needed for GetAlnScores. + + seqSetInfo->subjRange = CAlignFormatUtil::GetSeqAlignCoverageParams(aln,&seqSetInfo->master_covered_length,&seqSetInfo->flip); seqSetInfo->percent_coverage = 100*seqSetInfo->master_covered_length/queryLength; ITERATE(CSeq_align_set::Tdata, iter, aln.Get()) { int align_length = CAlignFormatUtil::GetAlignmentLength(**iter, do_translation); totalLen += align_length; - - CAlignFormatUtil::GetAlnScores(**iter, score, bits, evalue, sum_n, - num_ident, use_this_gi); + + CAlignFormatUtil::GetAlnScores(**iter, score, bits, evalue, sum_n, + num_ident, use_this_gi); use_this_gi.clear(); - + total_bits += bits; - + /// IMPORTANT: based on WB-1175, the trigger for setting the highest identity -/// is not the highest identity value, but the identity value of +/// is not the highest identity value, but the identity value of /// the alignment with the highest score! /// /// if (100*num_ident/align_length > highest_identity) { -- this condition is disabled @@ -4150,20 +4115,20 @@ CAlignFormatUtil::GetSeqAlignSetCalcParams(const CSeq_align_set& aln,int queryLe highest_ident = num_ident; /// highest_identity = 100*num_ident/align_length; } - + if (bits > highest_bits) { highest_bits = bits; lowest_evalue = evalue; - } + } } - seqSetInfo->match = highest_ident; - seqSetInfo->align_length = highest_length; + seqSetInfo->match = highest_ident; + seqSetInfo->align_length = highest_length; seqSetInfo->percent_identity = CAlignFormatUtil::GetPercentIdentity(seqSetInfo->match, seqSetInfo->align_length); - + seqSetInfo->total_bit_score = total_bits; - seqSetInfo->bit_score = highest_bits; - seqSetInfo->evalue = lowest_evalue; - seqSetInfo->hspNum = aln.Size(); + seqSetInfo->bit_score = highest_bits; + seqSetInfo->evalue = lowest_evalue; + seqSetInfo->hspNum = static_cast(aln.Size()); seqSetInfo->totalLen = (Int8)totalLen; return seqSetInfo; @@ -4176,25 +4141,25 @@ double CAlignFormatUtil::GetSeqAlignSetCalcPercentIdent(const CSeq_align_set& al double evalue = 0; int sum_n = 0; int num_ident = 0; - - if(aln.Get().empty()) + + if(aln.Get().empty()) return -1; double highest_bits = 0; int highest_length = 1; int highest_ident = 0; - - list use_this_gi; // Not used here, but needed for GetAlnScores. - + + list use_this_gi; // Not used here, but needed for GetAlnScores. + ITERATE(CSeq_align_set::Tdata, iter, aln.Get()) { int align_length = CAlignFormatUtil::GetAlignmentLength(**iter, do_translation); - - CAlignFormatUtil::GetAlnScores(**iter, score, bits, evalue, sum_n, - num_ident, use_this_gi); - - + + CAlignFormatUtil::GetAlnScores(**iter, score, bits, evalue, sum_n, + num_ident, use_this_gi); + + /// IMPORTANT: based on WB-1175, the trigger for setting the highest identity -/// is not the highest identity value, but the identity value of +/// is not the highest identity value, but the identity value of /// the alignment with the highest score! /// /// if (100*num_ident/align_length > highest_identity) { -- this condition is disabled @@ -4204,49 +4169,49 @@ double CAlignFormatUtil::GetSeqAlignSetCalcPercentIdent(const CSeq_align_set& al highest_ident = num_ident; /// highest_identity = 100*num_ident/align_length; highest_bits = bits; - } + } } - - double percent_identity = CAlignFormatUtil::GetPercentIdentity(highest_ident, highest_length); + + double percent_identity = CAlignFormatUtil::GetPercentIdentity(highest_ident, highest_length); return percent_identity; } template bool -s_GetBlastScore(const container& scoreList, +s_GetBlastScore(const container& scoreList, double& evalue, - double& bitScore, - double& totalBitScore, + double& bitScore, + double& totalBitScore, int& percentCoverage, double& percentIdent, int& hspNum, double& totalLen, int &rawScore, - int& sum_n, + int& sum_n, list& use_this_gi) { const string k_GiPrefix = "gi:"; bool hasScore = false; - + ITERATE (typename container, iter, scoreList) { - const CObject_id& id=(*iter)->GetId(); + const CObject_id& id=(*iter)->GetId(); if (id.IsStr()) { hasScore = true; if (id.GetStr()=="seq_evalue") { evalue = (*iter)->GetValue().GetReal(); } else if (id.GetStr()=="seq_bit_score"){ - bitScore = (*iter)->GetValue().GetReal(); + bitScore = (*iter)->GetValue().GetReal(); } else if (id.GetStr()=="seq_total_bit_score"){ - totalBitScore = (*iter)->GetValue().GetReal(); + totalBitScore = (*iter)->GetValue().GetReal(); } else if (id.GetStr()=="seq_percent_coverage"){ - percentCoverage = (*iter)->GetValue().GetInt(); + percentCoverage = (*iter)->GetValue().GetInt(); } else if (id.GetStr()=="seq_percent_identity" && (*iter)->GetValue().IsInt()){ - percentIdent = (*iter)->GetValue().GetInt(); + percentIdent = (*iter)->GetValue().GetInt(); } else if (id.GetStr()=="seq_percent_identity" && (*iter)->GetValue().IsReal()){ percentIdent = (*iter)->GetValue().GetReal(); } else if (id.GetStr()=="seq_hspnum"){ - hspNum = (*iter)->GetValue().GetInt(); + hspNum = (*iter)->GetValue().GetInt(); } else if (id.GetStr()=="seq_align_totlen"){ totalLen = (*iter)->GetValue().GetReal(); } else if (id.GetStr()=="score"){ @@ -4255,21 +4220,21 @@ s_GetBlastScore(const container& scoreList, Uint4 gi_v = (Uint4) ((*iter)->GetValue().GetInt()); use_this_gi.push_back(GI_FROM(Uint4, gi_v)); } else if (id.GetStr()=="sum_n"){ - sum_n = (*iter)->GetValue().GetInt(); + sum_n = (*iter)->GetValue().GetInt(); } else if(NStr::StartsWith(id.GetStr(),k_GiPrefix)) { //will be used when switch to 64bit GIs string strGi = NStr::Replace(id.GetStr(),k_GiPrefix,""); TGi gi = NStr::StringToNumeric(strGi); use_this_gi.push_back(gi); } - } + } } return hasScore; } void CAlignFormatUtil::GetUseThisSequence(const CSeq_align& aln,list& use_this_gi) - + { const string k_GiPrefix = "gi:"; @@ -4277,21 +4242,21 @@ void CAlignFormatUtil::GetUseThisSequence(const CSeq_align& aln,list& use_t const CUser_object &user = *(aln.GetExt().front()); if (user.IsSetType() && user.GetType().IsStr() && user.GetType().GetStr() == "use_this_seqid" && user.IsSetData()) { - const CUser_object::TData& fields = user.GetData(); + const CUser_object::TData& fields = user.GetData(); for (CUser_object::TData::const_iterator fit = fields.begin(); fit != fields.end(); ++fit) { - const CUser_field& field = **fit; + const CUser_field& field = **fit; - if (field.IsSetLabel() && field.GetLabel().IsStr() && field.GetLabel().GetStr() == "SEQIDS" && + if (field.IsSetLabel() && field.GetLabel().IsStr() && field.GetLabel().GetStr() == "SEQIDS" && field.IsSetData() && field.GetData().IsStrs()) { - const CUser_field::C_Data::TStrs& strs = field.GetData().GetStrs(); + const CUser_field::C_Data::TStrs& strs = field.GetData().GetStrs(); ITERATE(CUser_field::TData::TStrs, acc_iter, strs) { if(NStr::StartsWith(*acc_iter,k_GiPrefix)) { //will be used when switch to 64bit GIs string strGi = NStr::Replace(*acc_iter,k_GiPrefix,""); TGi gi = NStr::StringToNumeric(strGi); use_this_gi.push_back(gi); - } + } } - } + } } } } @@ -4299,33 +4264,33 @@ void CAlignFormatUtil::GetUseThisSequence(const CSeq_align& aln,list& use_t /*use_this_seq will contain gi:nnnnnn or seqid:ssssss string list*/ void CAlignFormatUtil::GetUseThisSequence(const CSeq_align& aln,list& use_this_seq) - + { if(!aln.CanGetExt() || aln.GetExt().size() == 0) return; const CUser_object &user = *(aln.GetExt().front()); if (user.IsSetType() && user.GetType().IsStr() && user.GetType().GetStr() == "use_this_seqid" && user.IsSetData()) { - const CUser_object::TData& fields = user.GetData(); + const CUser_object::TData& fields = user.GetData(); for (CUser_object::TData::const_iterator fit = fields.begin(); fit != fields.end(); ++fit) { - const CUser_field& field = **fit; + const CUser_field& field = **fit; - if (field.IsSetLabel() && field.GetLabel().IsStr() && field.GetLabel().GetStr() == "SEQIDS" && + if (field.IsSetLabel() && field.GetLabel().IsStr() && field.GetLabel().GetStr() == "SEQIDS" && field.IsSetData() && field.GetData().IsStrs()) { - const CUser_field::C_Data::TStrs& strs = field.GetData().GetStrs(); + const CUser_field::C_Data::TStrs& strs = field.GetData().GetStrs(); ITERATE(CUser_field::TData::TStrs, acc_iter, strs) { use_this_seq.push_back(*acc_iter); } - } + } } } } -CAlignFormatUtil::SSeqAlignSetCalcParams* +CAlignFormatUtil::SSeqAlignSetCalcParams* CAlignFormatUtil::GetSeqAlignSetCalcParamsFromASN(const CSeq_align_set& alnSet) { - bool hasScore = false; + bool hasScore = false; double evalue = -1; double bitScore = -1; double totalBitScore = -1; @@ -4337,21 +4302,21 @@ CAlignFormatUtil::GetSeqAlignSetCalcParamsFromASN(const CSeq_align_set& alnSet) int sum_n = -1; list use_this_gi; list use_this_seq; - - const CSeq_align& aln = *(alnSet.Get().front()); - hasScore = s_GetBlastScore(aln.GetScore(),evalue,bitScore, totalBitScore,percentCoverage,percentIdent,hspNum,totalLen,rawScore,sum_n,use_this_gi); - + const CSeq_align& aln = *(alnSet.Get().front()); + + hasScore = s_GetBlastScore(aln.GetScore(),evalue,bitScore, totalBitScore,percentCoverage,percentIdent,hspNum,totalLen,rawScore,sum_n,use_this_gi); + if(!hasScore){ const CSeq_align::TSegs& seg = aln.GetSegs(); if(seg.Which() == CSeq_align::C_Segs::e_Std){ - s_GetBlastScore(seg.GetStd().front()->GetScores(), + s_GetBlastScore(seg.GetStd().front()->GetScores(), evalue,bitScore, totalBitScore,percentCoverage,percentIdent,hspNum,totalLen,rawScore,sum_n,use_this_gi); } else if (seg.Which() == CSeq_align::C_Segs::e_Dendiag){ - s_GetBlastScore(seg.GetDendiag().front()->GetScores(), + s_GetBlastScore(seg.GetDendiag().front()->GetScores(), evalue,bitScore, totalBitScore,percentCoverage,percentIdent,hspNum,totalLen,rawScore,sum_n,use_this_gi); } else if (seg.Which() == CSeq_align::C_Segs::e_Denseg){ - s_GetBlastScore(seg.GetDenseg().GetScores(), + s_GetBlastScore(seg.GetDenseg().GetScores(), evalue,bitScore, totalBitScore,percentCoverage,percentIdent,hspNum,totalLen,rawScore,sum_n,use_this_gi); } } @@ -4365,12 +4330,12 @@ CAlignFormatUtil::GetSeqAlignSetCalcParamsFromASN(const CSeq_align_set& alnSet) unique_ptr seqSetInfo(new SSeqAlignSetCalcParams); - seqSetInfo->evalue = evalue; - seqSetInfo->bit_score = bitScore; + seqSetInfo->evalue = evalue; + seqSetInfo->bit_score = bitScore; seqSetInfo->total_bit_score = totalBitScore; seqSetInfo->percent_coverage = percentCoverage; - seqSetInfo->percent_identity = percentIdent; - seqSetInfo->hspNum = hspNum; + seqSetInfo->percent_identity = percentIdent; + seqSetInfo->hspNum = hspNum; seqSetInfo->totalLen = (Int8)totalLen; seqSetInfo->sum_n = sum_n == -1 ? 1:sum_n ; @@ -4379,7 +4344,7 @@ CAlignFormatUtil::GetSeqAlignSetCalcParamsFromASN(const CSeq_align_set& alnSet) seqSetInfo->use_this_seq = use_this_seq; seqSetInfo->raw_score = rawScore;//not used - seqSetInfo->subjRange = CRange(0,0); + seqSetInfo->subjRange = CRange(0,0); seqSetInfo->flip = false; return seqSetInfo.release(); @@ -4389,10 +4354,10 @@ CRef CAlignFormatUtil::GetDisplayIds(const CBioseq_Handle& handle, const CSeq_id& aln_id, list& use_this_gi, TGi& gi) - + { TTaxId taxid = ZERO_TAX_ID; - CRef wid = CAlignFormatUtil::GetDisplayIds(handle, aln_id, use_this_gi, gi, taxid); + CRef wid = CAlignFormatUtil::GetDisplayIds(handle, aln_id, use_this_gi, gi, taxid); return wid; } @@ -4401,25 +4366,25 @@ CRef CAlignFormatUtil::GetDisplayIds(const CBioseq_Handle& handle, list& use_this_gi, TGi& gi, TTaxId& taxid) - + { const CRef bdlRef = CSeqDB::ExtractBlastDefline(handle); const list< CRef< CBlast_def_line > > &bdl = (bdlRef.Empty()) ? list< CRef< CBlast_def_line > >() : bdlRef->Get(); - + const CBioseq::TId* ids = &handle.GetBioseqCore()->GetId(); - CRef wid; + CRef wid; gi = ZERO_GI; taxid = ZERO_TAX_ID; if(bdl.empty()){ - wid = FindBestChoice(*ids, CSeq_id::WorstRank); - gi = FindGi(*ids); - } else { + wid = FindBestChoice(*ids, CSeq_id::WorstRank); + gi = FindGi(*ids); + } else { bool found = false; for(list< CRef< CBlast_def_line > >::const_iterator iter = bdl.begin(); iter != bdl.end(); iter++){ const CBioseq::TId* cur_id = &((*iter)->GetSeqid()); - TGi cur_gi = FindGi(*cur_id); + TGi cur_gi = FindGi(*cur_id); wid = FindBestChoice(*cur_id, CSeq_id::WorstRank); if ((*iter)->IsSetTaxid() && (*iter)->CanGetTaxid()){ taxid = (*iter)->GetTaxid(); @@ -4433,20 +4398,20 @@ CRef CAlignFormatUtil::GetDisplayIds(const CBioseq_Handle& handle, } } else { ITERATE(CBioseq::TId, iter_id, *cur_id) { - if ((*iter_id)->Match(aln_id) - || (aln_id.IsGeneral() && aln_id.GetGeneral().CanGetDb() && + if ((*iter_id)->Match(aln_id) + || (aln_id.IsGeneral() && aln_id.GetGeneral().CanGetDb() && (*iter_id)->IsGeneral() && (*iter_id)->GetGeneral().CanGetDb() && aln_id.GetGeneral().GetDb() == (*iter_id)->GetGeneral().GetDb())) { found = true; } } } - if(found){ - gi = cur_gi; + if(found){ + gi = cur_gi; break; } } - } + } return wid; } @@ -4456,17 +4421,17 @@ CRef CAlignFormatUtil::GetDisplayIds(const CBioseq_Handle& handle, static string s_UseThisSeqToTextSeqID(string use_this_seqid, bool &isGi) { const string k_GiPrefix = "gi:"; - const string k_SeqIDPrefix = "seqid:"; + const string k_SeqIDPrefix = "seqid:"; isGi = false; string textSeqid; - if(NStr::StartsWith(use_this_seqid,k_GiPrefix)) { + if(NStr::StartsWith(use_this_seqid,k_GiPrefix)) { textSeqid = NStr::Replace(use_this_seqid,k_GiPrefix,""); isGi = true; } - else if(NStr::StartsWith(use_this_seqid,k_SeqIDPrefix)) { - textSeqid = NStr::Replace(use_this_seqid,k_SeqIDPrefix,""); + else if(NStr::StartsWith(use_this_seqid,k_SeqIDPrefix)) { + textSeqid = NStr::Replace(use_this_seqid,k_SeqIDPrefix,""); } - else {//assume no prefix - gi + else {//assume no prefix - gi if(NStr::StringToInt8(use_this_seqid,NStr::fConvErr_NoThrow)) { isGi = true; } @@ -4480,7 +4445,7 @@ static string s_UseThisSeqToTextSeqID(string use_this_seqid, bool &isGi) bool CAlignFormatUtil::IsGiList(list &use_this_seq) { bool isGi = false; - ITERATE(list, iter_seq, use_this_seq){ + ITERATE(list, iter_seq, use_this_seq){ s_UseThisSeqToTextSeqID( *iter_seq, isGi); break; } @@ -4490,11 +4455,11 @@ bool CAlignFormatUtil::IsGiList(list &use_this_seq) list CAlignFormatUtil::StringGiToNumGiList(list &use_this_seq) { list use_this_gi; - ITERATE(list, iter_seq, use_this_seq){ + ITERATE(list, iter_seq, use_this_seq){ bool isGi = false; string strGI = s_UseThisSeqToTextSeqID( *iter_seq, isGi); - if(isGi) use_this_gi.push_back(NStr::StringToNumeric(strGI)); - } + if(isGi) use_this_gi.push_back(NStr::StringToNumeric(strGI)); + } return use_this_gi; } @@ -4503,14 +4468,14 @@ list CAlignFormatUtil::StringGiToNumGiList(list &use_this_seq) bool CAlignFormatUtil::MatchSeqInSeqList(TGi cur_gi, CRef &seqID, list &use_this_seq,bool *isGiList) { bool found = false; - bool isGi = false; + bool isGi = false; string curSeqID = CAlignFormatUtil::GetLabel(seqID,true); //uses GetSeqIdString(true) - ITERATE(list, iter_seq, use_this_seq){ + ITERATE(list, iter_seq, use_this_seq){ isGi = false; string useThisSeq = s_UseThisSeqToTextSeqID(*iter_seq, isGi); if((isGi && cur_gi == NStr::StringToNumeric((useThisSeq))) || (!isGi && curSeqID == useThisSeq)){ - found = true; + found = true; break; } } @@ -4521,7 +4486,7 @@ bool CAlignFormatUtil::MatchSeqInSeqList(TGi cur_gi, CRef &seqID, list< bool CAlignFormatUtil::MatchSeqInSeqList(CConstRef &alnSeqID, list &use_this_seq,vector &seqList) { - bool isGi = false; + bool isGi = false; string curSeqID; if(alnSeqID->IsGi()) { curSeqID = NStr::NumericToString(alnSeqID->GetGi()); @@ -4533,24 +4498,24 @@ bool CAlignFormatUtil::MatchSeqInSeqList(CConstRef &alnSeqID, list, iter_seq, use_this_seq){ - string useThisSeq = s_UseThisSeqToTextSeqID(*iter_seq, isGi); + ITERATE(list, iter_seq, use_this_seq){ + string useThisSeq = s_UseThisSeqToTextSeqID(*iter_seq, isGi); found = std::find(seqList.begin(), seqList.end(), useThisSeq) != seqList.end(); - if(found){ + if(found){ break; } } - } + } return found; } bool CAlignFormatUtil::MatchSeqInUseThisSeqList(list &use_this_seq, string textSeqIDToMatch) { bool has_match = false; - - ITERATE(list, iter_seq, use_this_seq) { + + ITERATE(list, iter_seq, use_this_seq) { bool isGi; - string useThisSeq = s_UseThisSeqToTextSeqID(*iter_seq, isGi); + string useThisSeq = s_UseThisSeqToTextSeqID(*iter_seq, isGi); if(useThisSeq == textSeqIDToMatch) { has_match = true; break; @@ -4565,16 +4530,16 @@ bool CAlignFormatUtil::RemoveSeqsOfAccessionTypeFromSeqInUse(list &use_t bool hasAccType = false; bool isGI = false; - ITERATE(list, iter_seq, use_this_seq) { - string useThisSeq = s_UseThisSeqToTextSeqID(*iter_seq, isGI); - CSeq_id::EAccessionInfo useThisSeqAccType = CSeq_id::IdentifyAccession (useThisSeq); - if(useThisSeqAccType != accessionType) { - new_use_this_seq.push_back(useThisSeq); - } + ITERATE(list, iter_seq, use_this_seq) { + string useThisSeq = s_UseThisSeqToTextSeqID(*iter_seq, isGI); + CSeq_id::EAccessionInfo useThisSeqAccType = CSeq_id::IdentifyAccession (useThisSeq); + if(useThisSeqAccType != accessionType) { + new_use_this_seq.push_back(useThisSeq); + } else { hasAccType = true; - } - } + } + } use_this_seq = new_use_this_seq; return hasAccType; } @@ -4582,36 +4547,36 @@ bool CAlignFormatUtil::RemoveSeqsOfAccessionTypeFromSeqInUse(list &use_t CRef CAlignFormatUtil::GetDisplayIds(const CBioseq_Handle& handle, const CSeq_id& aln_id, list& use_this_seq, - TGi *gi, + TGi *gi, TTaxId *taxid, string *textSeqID) - + { const CRef bdlRef = CSeqDB::ExtractBlastDefline(handle); const list< CRef< CBlast_def_line > > &bdl = (bdlRef.Empty()) ? list< CRef< CBlast_def_line > >() : bdlRef->Get(); - + const CBioseq::TId* ids = &handle.GetBioseqCore()->GetId(); - CRef wid; + CRef wid; if(gi) *gi = ZERO_GI; if(taxid) *taxid = ZERO_TAX_ID; if(bdl.empty()){ - wid = FindBestChoice(*ids, CSeq_id::WorstRank); - if(gi) *gi = FindGi(*ids); + wid = FindBestChoice(*ids, CSeq_id::WorstRank); + if(gi) *gi = FindGi(*ids); if(textSeqID) *textSeqID = GetLabel(wid,true);//uses GetSeqIdString(true) - } else { + } else { bool found = false; for(list< CRef< CBlast_def_line > >::const_iterator iter = bdl.begin(); iter != bdl.end(); iter++){ const CBioseq::TId* cur_id = &((*iter)->GetSeqid()); - TGi cur_gi = FindGi(*cur_id); + TGi cur_gi = FindGi(*cur_id); wid = FindBestChoice(*cur_id, CSeq_id::WorstRank); string curSeqID = GetLabel(wid,true);//uses GetSeqIdString(true) if (taxid && (*iter)->IsSetTaxid() && (*iter)->CanGetTaxid()){ *taxid = (*iter)->GetTaxid(); } if (!use_this_seq.empty()) { - ITERATE(list, iter_seq, use_this_seq){ + ITERATE(list, iter_seq, use_this_seq){ bool isGi = false; string useThisSeq = s_UseThisSeqToTextSeqID( *iter_seq, isGi); if((isGi && cur_gi == NStr::StringToNumeric((useThisSeq))) || (!isGi && curSeqID == useThisSeq)){ @@ -4621,22 +4586,22 @@ CRef CAlignFormatUtil::GetDisplayIds(const CBioseq_Handle& handle, } } else { ITERATE(CBioseq::TId, iter_id, *cur_id) { - if ((*iter_id)->Match(aln_id) - || (aln_id.IsGeneral() && aln_id.GetGeneral().CanGetDb() && + if ((*iter_id)->Match(aln_id) + || (aln_id.IsGeneral() && aln_id.GetGeneral().CanGetDb() && (*iter_id)->IsGeneral() && (*iter_id)->GetGeneral().CanGetDb() && aln_id.GetGeneral().GetDb() == (*iter_id)->GetGeneral().GetDb())) { found = true; } } } - if(found){ - if(gi) *gi = cur_gi; + if(found){ + if(gi) *gi = cur_gi; if(textSeqID) *textSeqID = curSeqID; break; } } } - + return wid; } @@ -4644,17 +4609,17 @@ CRef CAlignFormatUtil::GetDisplayIds(const CBioseq_Handle& handle, TGi CAlignFormatUtil::GetDisplayIds(const list< CRef< CBlast_def_line > > &bdl, const CSeq_id& aln_id, list& use_this_gi) - - + + { TGi gi = ZERO_GI; - - if(!bdl.empty()){ + + if(!bdl.empty()){ bool found = false; for(list< CRef< CBlast_def_line > >::const_iterator iter = bdl.begin(); iter != bdl.end(); iter++){ const CBioseq::TId* cur_id = &((*iter)->GetSeqid()); - TGi cur_gi = FindGi(*cur_id); + TGi cur_gi = FindGi(*cur_id); if (!use_this_gi.empty()) { ITERATE(list, iter_gi, use_this_gi){ if(cur_gi == *iter_gi){ @@ -4664,20 +4629,20 @@ TGi CAlignFormatUtil::GetDisplayIds(const list< CRef< CBlast_def_line > > &bdl, } } else { ITERATE(CBioseq::TId, iter_id, *cur_id) { - if ((*iter_id)->Match(aln_id) - || (aln_id.IsGeneral() && aln_id.GetGeneral().CanGetDb() && + if ((*iter_id)->Match(aln_id) + || (aln_id.IsGeneral() && aln_id.GetGeneral().CanGetDb() && (*iter_id)->IsGeneral() && (*iter_id)->GetGeneral().CanGetDb() && aln_id.GetGeneral().GetDb() == (*iter_id)->GetGeneral().GetDb())) { found = true; } } } - if(found){ - gi = cur_gi; + if(found){ + gi = cur_gi; break; } } - } + } return gi; } @@ -4756,19 +4721,19 @@ int CAlignFormatUtil::GetUniqSeqCoverage(CSeq_align_set & alnset) ///@param choice: id of choice ///@return: the id with specified type /// -static CRef s_GetSeqIdByType(const list >& ids, +static CRef s_GetSeqIdByType(const list >& ids, CSeq_id::E_Choice choice) { CRef cid; - - for (CBioseq::TId::const_iterator iter = ids.begin(); iter != ids.end(); + + for (CBioseq::TId::const_iterator iter = ids.begin(); iter != ids.end(); iter ++){ if ((*iter)->Which() == choice){ cid = *iter; break; } } - + return cid; } @@ -4798,7 +4763,7 @@ string CAlignFormatUtil::GetTitle(const CBioseq_Handle & bh) string CAlignFormatUtil::GetBareId(const CSeq_id& id) { - string retval; + string retval; if (id.IsGi() || id.IsPrf() || id.IsPir()) { retval = id.AsFastaString(); @@ -4814,7 +4779,7 @@ string CAlignFormatUtil::GetBareId(const CSeq_id& id) bool CAlignFormatUtil::GetTextSeqID(CConstRef seqID, string *textSeqID) { bool hasTextSeqID = true; - + const CTextseq_id* text_id = seqID->GetTextseq_Id(); //returns non zero if e_Genbank,e_Embl,e_Ddbj,e_Pir,e_Swissprot,case e_Other,e_Prf,case e_Tpg,e_Tpe,case e_Tpd,case e_Gpipe, e_Named_annot_track if(!text_id) { //check for pdb and pat @@ -4851,26 +4816,26 @@ bool CAlignFormatUtil::GetTextSeqID(const list > & ids, string *te } CRef CAlignFormatUtil::FilterSeqalignBySeqList(CSeq_align_set& source_aln, - vector &seqList) + vector &seqList) { - CConstRef previous_id, subid; + CConstRef previous_id, subid; list use_this_seq; bool match = false; CRef new_aln(new CSeq_align_set); - ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){ + ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){ subid = &((*iter)->GetSeq_id(1)); - if(previous_id.Empty() || !subid->Match(*previous_id)){ + if(previous_id.Empty() || !subid->Match(*previous_id)){ use_this_seq.clear(); - CAlignFormatUtil::GetUseThisSequence(**iter,use_this_seq); - match = MatchSeqInSeqList(subid, use_this_seq,seqList); + CAlignFormatUtil::GetUseThisSequence(**iter,use_this_seq); + match = MatchSeqInSeqList(subid, use_this_seq,seqList); } - previous_id = subid; + previous_id = subid; if(match) { new_aln->Set().push_back(*iter); } - } + } return new_aln; } diff --git a/c++/src/objtools/align_format/showalign.cpp b/c++/src/objtools/align_format/showalign.cpp index a73fd1e3..8f7b297b 100644 --- a/c++/src/objtools/align_format/showalign.cpp +++ b/c++/src/objtools/align_format/showalign.cpp @@ -1,4 +1,4 @@ -/* $Id: showalign.cpp 664020 2023-03-06 18:09:11Z jianye $ +/* $Id: showalign.cpp 683951 2024-06-10 12:11:41Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -692,16 +692,17 @@ static string s_GetCdsSequence(int genetic_code, CFeat_CI& feat, feat_strand))); } } - CGenetic_code gc; - CRef ce(new CGenetic_code::C_E); - ce->Select(CGenetic_code::C_E::e_Id); - ce->SetId(genetic_code); - gc.Set().push_back(ce); - isolated_loc.SetPartialStart(true, eExtreme_Biological); - isolated_loc.SetPartialStop (true, eExtreme_Biological); - CSeqTranslator::Translate(isolated_loc, handle.GetScope(), - raw_cdr_product, &gc); - + if (genetic_code > 0) { + CGenetic_code gc; + CRef ce(new CGenetic_code::C_E); + ce->Select(CGenetic_code::C_E::e_Id); + ce->SetId(genetic_code); + gc.Set().push_back(ce); + isolated_loc.SetPartialStart(true, eExtreme_Biological); + isolated_loc.SetPartialStop (true, eExtreme_Biological); + CSeqTranslator::Translate(isolated_loc, handle.GetScope(), + raw_cdr_product, &gc); + } } return raw_cdr_product; } @@ -1131,7 +1132,7 @@ void CDisplaySeqalign::x_AddTranslationForLocalSeq(vector& x_SetFeatureInfo(master_featInfo, *master_loc, 0, m_AV->GetAlnStop(), m_AV->GetAlnStop(), ' ', - " ", master_feat); + " ", master_feat, -1); retval[0].push_back(master_featInfo); @@ -1158,7 +1159,7 @@ void CDisplaySeqalign::x_AddTranslationForLocalSeq(vector& x_SetFeatureInfo(subject_featInfo, *subject_loc, 0, m_AV->GetAlnStop(), m_AV->GetAlnStop(), ' ', - " ", subject_feat); + " ", subject_feat, -1); retval[1].push_back(subject_featInfo); @@ -1332,7 +1333,7 @@ CDisplaySeqalign::SAlnRowInfo *CDisplaySeqalign::x_PrepareRowData(void) if(m_AlignOption & eShowCdsFeature){ TGi master_gi = FindGi(m_AV->GetBioseqHandle(0). GetBioseqCore()->GetId()); - x_GetFeatureInfo(bioseqFeature[row], *m_featScope, + x_GetFeatureInfo(bioseqFeature[row], -1, *m_featScope, CSeqFeatData::e_Cdregion, row, sequence[row], feat_seq_range, feat_seq_strand, row == 1 && !(master_gi > ZERO_GI) ? true : false); @@ -1343,15 +1344,23 @@ CDisplaySeqalign::SAlnRowInfo *CDisplaySeqalign::x_PrepareRowData(void) CRef master_scope_with_feat = s_MakeNewMasterSeq(feat_seq_range, feat_seq_strand, m_AV->GetBioseqHandle(0)); + int custom_genetic_code = -1; + NON_CONST_ITERATE(CDisplaySeqalign::TSAlnFeatureInfoList, iter_feat, bioseqFeature[1]) { + if ((*iter_feat)->genetic_code > 0) { + custom_genetic_code = (*iter_feat)->genetic_code; + break; + } + } + //make feature string for master bioseq list > > temp_holder; - x_GetFeatureInfo(bioseqFeature[0], *master_scope_with_feat, + x_GetFeatureInfo(bioseqFeature[0], custom_genetic_code, *master_scope_with_feat, CSeqFeatData::e_Cdregion, 0, sequence[0], temp_holder, feat_seq_strand, false); } } if(m_AlignOption & eShowGeneFeature){ - x_GetFeatureInfo(bioseqFeature[row], *m_featScope, + x_GetFeatureInfo(bioseqFeature[row], -1, *m_featScope, CSeqFeatData::e_Gene, row, sequence[row], feat_seq_range, feat_seq_strand, false); } @@ -2163,6 +2172,7 @@ int CDisplaySeqalign::x_GetLinkout(const objects::CSeq_id & id) } catch (const CException & e) { ERR_POST("Problem with linkoutdb: " + e.GetMsg()); + cerr << "[BLAST FORMATTER EXCEPTION] Problem with linkoutdb: " << e.GetMsg() << endl; m_AlignOption &= ~eLinkout; //Remove linkout bit for the rest of sequences linkout = 0; } @@ -2567,26 +2577,48 @@ void CDisplaySeqalign::x_OutputSeq(string& sequence, const CSeq_id& id, } } - int CDisplaySeqalign::x_GetNumGaps() { int gap = 0; - for (int row=0; rowGetNumRows(); row++) { - CRef chunk_vec - = m_AV->GetAlnChunks(row, m_AV->GetSeqAlnRange(0)); - for (int i=0; isize(); i++) { - CConstRef chunk = (*chunk_vec)[i]; - if (chunk->IsGap()) { - gap += (chunk->GetAlnRange().GetTo() + if (m_SeqalignSetRef->Get().front()->CanGetType() && + m_SeqalignSetRef->Get().front()->GetType() == CSeq_align_Base::eType_global) + { + for (int row=0; rowGetNumRows(); row++) { + // The row/antirow dance makes sure that we count gaps at the end of a global alignment. + // Only two rows for a global (NW) alignment + int antirow=1; + if (row == 1) + antirow = 0; + CRef chunk_vec + = m_AV->GetAlnChunks(row, m_AV->GetSeqAlnRange(antirow)); + for (int i=0; isize(); i++) { + CConstRef chunk = (*chunk_vec)[i]; + if (chunk->IsGap()) { + gap += (chunk->GetAlnRange().GetTo() - chunk->GetAlnRange().GetFrom() + 1); - } - } + } + } + } + } + else + { + for (int row=0; rowGetNumRows(); row++) { + CRef chunk_vec + = m_AV->GetAlnChunks(row, m_AV->GetSeqAlnRange(0)); + for (int i=0; isize(); i++) { + CConstRef chunk = (*chunk_vec)[i]; + if (chunk->IsGap()) { + gap += (chunk->GetAlnRange().GetTo() + - chunk->GetAlnRange().GetFrom() + 1); + } + } + } } return gap; } - void CDisplaySeqalign::x_GetFeatureInfo(TSAlnFeatureInfoList& feature, + int custom_genetic_code, CScope& scope, CSeqFeatData::E_Choice choice, int row, string& sequence, @@ -2686,6 +2718,7 @@ void CDisplaySeqalign::x_GetFeatureInfo(TSAlnFeatureInfoList& feature, actual_feat_seq_stop = max(feat_seq_range.GetFrom(), seq_stop); } + int genetic_code = -1; //the feature alignment positions feat_aln_from = m_AV->GetAlnPosFromSeqPos(row, actual_feat_seq_start); @@ -2698,11 +2731,14 @@ void CDisplaySeqalign::x_GetFeatureInfo(TSAlnFeatureInfoList& feature, } else if(choice == CSeqFeatData::e_Cdregion){ string raw_cdr_product = - s_GetCdsSequence(m_SlaveGeneticCode, feat, scope, + s_GetCdsSequence(custom_genetic_code > 0? custom_genetic_code:m_SlaveGeneticCode, feat, scope, isolated_range, handle, feat_strand, featId, other_seqloc_length%3 == 0 ? 0 : 3 - other_seqloc_length%3, mix_loc); + if (feat->IsSetData() && feat->GetData().IsCdregion() && feat->GetData().GetCdregion().IsSetCode()) { + genetic_code = feat->GetData().GetCdregion().GetCode().GetId(); + } if(raw_cdr_product == NcbiEmptyString){ continue; } @@ -2902,7 +2938,7 @@ void CDisplaySeqalign::x_GetFeatureInfo(TSAlnFeatureInfoList& feature, if(featInfo){ x_SetFeatureInfo(featInfo, *loc_ref, feat_aln_from, feat_aln_to, aln_stop, - feat_char, featId, alternativeFeatStr); + feat_char, featId, alternativeFeatStr, genetic_code); feature.push_back(featInfo); } } @@ -2915,13 +2951,14 @@ void CDisplaySeqalign::x_SetFeatureInfo(CRef feat_info, const CSeq_loc& seqloc, int aln_from, int aln_to, int aln_stop, char pattern_char, string pattern_id, - string& alternative_feat_str) const + string& alternative_feat_str, + int genetic_code) const { CRef feat(new FeatureInfo); feat->seqloc = &seqloc; feat->feature_char = pattern_char; feat->feature_id = pattern_id; - + if(alternative_feat_str != NcbiEmptyString){ feat_info->feature_string = alternative_feat_str; } else { @@ -2932,7 +2969,7 @@ void CDisplaySeqalign::x_SetFeatureInfo(CRef feat_info, } feat_info->feature_string = line; } - + feat_info->genetic_code = genetic_code; feat_info->aln_range.Set(aln_from, aln_to); feat_info->feature = feat; } @@ -3292,37 +3329,6 @@ CDisplaySeqalign::PrepareBlastUngappedSeqalignEx2(CSeq_align_set& alnset) } -bool CDisplaySeqalign::x_IsGeneInfoAvailable(SAlnInfo* aln_vec_info) -{ - const CBioseq_Handle& bsp_handle = - aln_vec_info->alnvec->GetBioseqHandle(1); - if (bsp_handle && - (m_AlignOption&eHtml) && - (m_AlignOption&eLinkout) && - (m_AlignOption&eShowGeneInfo)) - { - CNcbiEnvironment env; - if (env.Get(GENE_INFO_PATH_ENV_VARIABLE) == kEmptyStr) - { - return false; - } - - const CRef bdlRef - = CSeqDB::ExtractBlastDefline(bsp_handle); - const list< CRef< CBlast_def_line > > &bdl = (bdlRef.Empty()) ? list< CRef< CBlast_def_line > >() : bdlRef->Get(); - - ITERATE(CBlast_def_line_set::Tdata, iter, bdl) - { - int linkout = x_GetLinkout(*(*iter)->GetSeqid().front()); - if (linkout & eGene) - { - return true; - } - } - } - return false; -} - string CDisplaySeqalign::x_GetGeneLinkUrl(int gene_id) { @@ -3340,49 +3346,6 @@ string CDisplaySeqalign::x_GetGeneLinkUrl(int gene_id) -string CDisplaySeqalign::x_DisplayGeneInfo(const CBioseq_Handle& bsp_handle,SAlnInfo* aln_vec_info) -{ - CNcbiOstrstream out; - try - { - if (x_IsGeneInfoAvailable(aln_vec_info)) - { - if (m_GeneInfoReader.get() == 0) - { - m_GeneInfoReader.reset(new CGeneInfoFileReader(false)); - } - - TGi giForGeneLookup = FindGi(bsp_handle.GetBioseqCore()->GetId()); - - CGeneInfoFileReader::TGeneInfoList infoList; - m_GeneInfoReader->GetGeneInfoForGi(giForGeneLookup,infoList); - - CGeneInfoFileReader::TGeneInfoList::const_iterator - itInfo = infoList.begin(); - if (itInfo != infoList.end()) - out << "\n"; - for (; itInfo != infoList.end(); itInfo++) - { - CRef info = *itInfo; - string strUrl = x_GetGeneLinkUrl(info->GetGeneId()); - string strInfo; - info->ToString(strInfo, true, strUrl); - out << strInfo << "\n"; - } - } - } - catch (CException& e) - { - out << "(Gene info extraction error: " - << e.GetMsg() << ")" << "\n"; - } - catch (...) - { - out << "(Gene info extraction error)" << "\n"; - } - string formattedString = CNcbiOstrstreamToString(out); - return formattedString; -} void CDisplaySeqalign::x_DisplayAlignSortInfo(CNcbiOstream& out,string id_label) { @@ -3658,10 +3621,7 @@ void CDisplaySeqalign::x_ShowAlnvecInfo(CNcbiOstream& out, if(!(m_AlignOption & eShowNoDeflineInfo)){ //1. Display defline(s),Gene info string deflines = x_PrintDefLine(bsp_handle, aln_vec_info); - out<< deflines; - //2. Format Gene info - string geneInfo = x_DisplayGeneInfo(bsp_handle,aln_vec_info); - out<< geneInfo; + out<< deflines; } if((m_AlignOption&eHtml) && (m_AlignOption&eShowBlastInfo) @@ -3959,10 +3919,7 @@ void CDisplaySeqalign::x_ShowAlnvecInfoTemplate(CNcbiOstream& out, if(show_defline) { const CBioseq_Handle& bsp_handle=m_AV->GetBioseqHandle(1); //1. Display defline(s),Gene info - string alignHeader = x_FormatDefLinesHeader(bsp_handle, aln_vec_info); - /**2. Format Gene info - string geneInfo = x_DisplayGeneInfo(bsp_handle,aln_vec_info); - alignHeader = CAlignFormatUtil::MapTemplate(alignHeader,"aln_gene_info",geneInfo); **/ + string alignHeader = x_FormatDefLinesHeader(bsp_handle, aln_vec_info); if(sortOneAln.empty()) { out<< alignHeader; @@ -4421,7 +4378,7 @@ CDisplaySeqalign::x_GetQueryFeatureList(int row_num, int aln_stop, if (alnTo - alnFrom >= 0){ x_SetFeatureInfo(featInfo, *((*iter)->seqloc), alnFrom, alnTo, aln_stop, (*iter)->feature_char, - (*iter)->feature_id, tempFeat); + (*iter)->feature_id, tempFeat, -1); retval[i].push_back(featInfo); } } @@ -4520,7 +4477,7 @@ void CDisplaySeqalign::x_GetDomainInfo(int row_num, int aln_stop, (CSeq_loc::TPoint) aln_stop)); x_SetFeatureInfo(featInfo, *(seqloc), 0, aln_stop, aln_stop, ' ', - " ", final_domain); + " ", final_domain, -1); retval[0].push_back(featInfo); } } @@ -4622,7 +4579,8 @@ void CDisplaySeqalign::x_PreProcessSeqAlign(CSeq_align_set &actual_aln_list) || (m_AlignOption & eHtml && m_AlignOption & eShowBlastInfo)))) { /*need to construct segs for dumpgnl and get sub-sequence for long sequences*/ - + + string idString, prevIdString,prevIdStringWithVersion,idStringWithVersion; for (CSeq_align_set::Tdata::const_iterator iter = actual_aln_list.Get().begin(); iter != actual_aln_list.Get().end() @@ -4630,10 +4588,16 @@ void CDisplaySeqalign::x_PreProcessSeqAlign(CSeq_align_set &actual_aln_list) CConstRef subid; subid = &((*iter)->GetSeq_id(1)); - string idString = subid->GetSeqIdString(); - - x_CalcUrlLinksParams(**iter,idString,toolUrl);//sets m_AlnLinksParams->segs,hspNum, subjRange - } + + idString = subid->GetSeqIdString(); + idStringWithVersion = subid->GetSeqIdString(true); + if(!prevIdString.empty() && !prevIdStringWithVersion.empty() && prevIdString == idString && prevIdStringWithVersion != idStringWithVersion) { + continue; + } + x_CalcUrlLinksParams(**iter,idString,toolUrl);//sets m_AlnLinksParams->segs,hspNum, subjRange + prevIdStringWithVersion = idStringWithVersion; + prevIdString = idString; + } } } diff --git a/c++/src/objtools/align_format/showdefline.cpp b/c++/src/objtools/align_format/showdefline.cpp index aabc8ea4..23ee020e 100644 --- a/c++/src/objtools/align_format/showdefline.cpp +++ b/c++/src/objtools/align_format/showdefline.cpp @@ -1,4 +1,4 @@ -/* $Id: showdefline.cpp 648700 2022-04-20 14:14:52Z zaretska $ +/* $Id: showdefline.cpp 683931 2024-06-10 12:08:07Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -691,7 +691,7 @@ void CShowBlastDefline::x_InitDefline(void) } subid = &((*iter)->GetSeq_id(1)); if(is_first_aln || (!is_first_aln && !subid->Match(*previous_id))) { - SScoreInfo* sci = x_GetScoreInfo(**iter, num_align); + SScoreInfo* sci = x_GetScoreInfo(**iter, static_cast(num_align)); if(sci){ m_ScoreList.push_back(sci); if(m_MaxScoreLen < sci->bit_string.size()){ diff --git a/c++/src/objtools/align_format/unit_test/data/tabular_db.pdb b/c++/src/objtools/align_format/unit_test/data/tabular_db.pdb new file mode 100644 index 0000000000000000000000000000000000000000..810d64dbc7aaf413e5386c2d7985883394e70703 GIT binary patch literal 32768 zcmeI5zi%8x6vqeWxNP>#F&*Dr2;#O~;JK>!!4EbEb|0 z1V8`;KmY_l00ck)1V8`;KmY_l;MEbJdHIXX{}0dmx7oBOwN885V(0m`Y?-EK{SMCv z4-fzW5C8!X009sH0T2KI5C8!X0D;2@*!eeObL$UZ7uB}}kUtOR4 z5Kzzm_xK*>|3~!rqT3(<0w4eaAOHd&00JNY0w4eaAV384d|!X6Uj*#?_tYwcH`oGS zz!Lxj3ws~{0w4eaAOHd&00JNY0w4eaAYcgC_4jL6uEbj#SCx9|IqUZqO<3EM&Gq~L z%liLGN96o}m#w;c{4xKP|HAL^+x!;4!Pof;Kg-|d^L#&i8vYjE3x5cA!=3Pp@KU%C zz8lVm`@z%TQE)f-KG+Rz2Ajbr!BQZCH-mPt=l||M@PG7o{cV5UKkp0ww7>8D;XU+z z@@{)Kz0bXomwRt{E$>hFk$czu&i&TibXWC41q%oz2!H?xfB*=900@A0h%Ab_WhYX9wN6K93+W+Sl{u0q zD~qhmI+22ABbpY{O@zorRuoYuIx!nzETm6Gh)$&LrA_6~5rT9b5$7TmMG|)+^*C=c z!dghz5hCxFX<6o-NWHJC8DTA?n}|#Xq?x2kZTU45VJxKEh;Ew1LeeFRjnEd-ClMko zyT$bJP;^Dstu3?1L!?<=M6skxZJ8X#Lb}P3q-oNPBwac1>5&@?=`Q znv*k8NmHIxS!R(Ws{ZpBd1{q3J3 zEYA~pnKs$G4V|*Nth#t1&kH%G#?|ahR2sYV94wb{uFe6 zsKlW5Oi~fcQ8oEV&srs|_7w6QjVm1R3$9Ascrq^y0N~$*2O?%Jpp2z>3TYkik zjz)_sjm;f|ec$Tu*+bMPfot?!$Mguc(ZF*9i#Vv~_FdaOK;2Exf{#77PkiJM+YN{j z`nw!=410YG-^ZiHr*}H<^1LL=Qcd7F?(V2uDsk!S%Tc+!^i#CV!w1!9{p;wlTKe$2 zpOfE;sjkmUg+tF`B1wXx)fG))Ayv2^@Yzh)LdU^<%S_z@?lD6nK;8Aw4=fv_K^V9m z34OF5dhXaQ(ec173k|)csH((kB8#B>{4b|H!ErqNF~sP#S-i21hc7|oHMjM_#!Mmr6x-v zuQB4@J0MQj9`wLNJq*v?HEf&20`WqA2C%FsYeeox&Kaq`S-C+OdMF|F1m_5 zkP2)cVDv&GA~i|aj{<1|QrLeHbs4K;(t8Q%V~rc_wtj-JyztvtC#Iw*y;Ke)XBu7;9U0;Ijahtn;TKnD3{=LcSnoS8+}C` zA~KkCh;p<%6@@e{gxoWuZqpkE(5QkaHRA&E9E&Cb?NoQ7PNj)jO;(vzUEx04q#&7A zb*cL4VL}^=^Sl(P>o?a`wN4W-h6?xadqyOlLENv2uTs#WXcURV$(-O7L8!6&Pevj#Il=vN>nM{GYIhLqq5`2f z4@x{pDK%c!YRtOKs#QLUkQQkH4(NmlK_dGEq$?TcXst>sTb-g>{rD3am`SZxr`)l8 z9)=>9q%iH9tVOfq(=*@u|-d@!;O%j>2 zLgf|tRoV&uC(DX(e#@y>uN9m--_>Kad2$0fkgV`^_UtxkgOlfztPNL8n*I^teP?~(7&>C0oNUM>gELL<~PtF?s%$p0C6pcpX z!YE*`IVqaW=7mwfUUO2ct*u=c1?)8^MXS}iFbddfPKtKBePI-^*Q^xJhR%DAdkFWG z{4$_o2r66`;qt^9)+Q=^GW+KfBWiJbb%p11uH6iasRYh78;bMHhV1`XbF5XQgrKZ+JsmQ&e8MdH~AqQ>YUB7{p}DVt=K=w>$TZcg99H?S1n!iTW7 zvs8QlTPNHHKV}$am~RHaJb;1F%bgfQY@l>zVFn9yz76pk5@4(Wg@Bys+ k0INs9dLsNvZ+~Yad`fyId;>Gj!XGgEBJ+pBm%QZiA3D}RiU0rr literal 0 HcmV?d00001 diff --git a/c++/src/objtools/align_format/unit_test/data/tabular_db.pjs b/c++/src/objtools/align_format/unit_test/data/tabular_db.pjs new file mode 100644 index 00000000..44830544 --- /dev/null +++ b/c++/src/objtools/align_format/unit_test/data/tabular_db.pjs @@ -0,0 +1,27 @@ +{ + "version": "1.2", + "dbname": "tabular_db", + "dbtype": "Protein", + "db-version": 5, + "description": "All non-redundant GenBank CDS translations+PDB+SwissProt+PIR+PRF excluding environmental samples from WGS projects", + "number-of-letters": 1344, + "number-of-sequences": 10, + "last-updated": "2023-12-05T16:42:00", + "number-of-volumes": 1, + "number-of-taxids": 15, + "bytes-total": 56641, + "bytes-to-cache": 1635, + "files": [ + "tabular_db.pdb", + "tabular_db.phr", + "tabular_db.pin", + "tabular_db.pog", + "tabular_db.pos", + "tabular_db.pot", + "tabular_db.ppd", + "tabular_db.ppi", + "tabular_db.psq", + "tabular_db.ptf", + "tabular_db.pto" + ] +} diff --git a/c++/src/objtools/align_format/unit_test/data/tabular_db.pog b/c++/src/objtools/align_format/unit_test/data/tabular_db.pog new file mode 100644 index 0000000000000000000000000000000000000000..4cb00c1b9389b5af9645e451145f53d1c9a4e9d5 GIT binary patch literal 72 XcmZQzU|?i`02Uy{1!cpj|3m@+G_)t^ literal 0 HcmV?d00001 diff --git a/c++/src/objtools/align_format/unit_test/data/tabular_db.pos b/c++/src/objtools/align_format/unit_test/data/tabular_db.pos new file mode 100644 index 0000000000000000000000000000000000000000..cf438a6cb2553affd2a36fce769f91252568d9f7 GIT binary patch literal 507 zcmYLFyG{c!5QHX*4n)CkAf0x->&KSPBnXOLpxhnWl@T1^Y!JmS^1usuCp@N?UzYCr>vA50zNG5K?)07D$+P$2y}3EUZ2I)IK%N~J;f@<1u>XV<9yV?;A*PgUf*}k z^)SR;6*nvAg5F|v`_LL;Vs+l8kYdEM+Yi#8U_;Q%Gg{n@Q=HN8c%KIJofwzmR_&@a zfvwKUHLV90pJX-!i|DmT3I$qPy{o5X6d{uW{8Nic=Wa{ODaM#d(=?g1ZJSBgb(!>i kpUE%`$u=0>K#gZ>ZNL_SE@r+#k+f_bumCu&vQ*OKf3Im_+W-In literal 0 HcmV?d00001 diff --git a/c++/src/objtools/align_format/unit_test/data/tabular_db.pot b/c++/src/objtools/align_format/unit_test/data/tabular_db.pot new file mode 100644 index 0000000000000000000000000000000000000000..a1154da642f5881183a9e864bc775d52b3bfe975 GIT binary patch literal 164 zcmd;LfB*28Qc8+6SPoEUo literal 0 HcmV?d00001 diff --git a/c++/src/objtools/align_format/unit_test/data/tabular_db.ppd b/c++/src/objtools/align_format/unit_test/data/tabular_db.ppd new file mode 100644 index 0000000000000000000000000000000000000000..5dcd152271d0d1fc005b335bd6a00f16abd8e1bf GIT binary patch literal 80 zcmZQzVBEvNz`()4wQL=bW@q63{Rl`iGyDx%0HoO%t2Z46(hN*0Y2iSMk?8@W9f-@$ V(q0avSp*aqdVn-1kUkBhSph(F4A%ev literal 0 HcmV?d00001 diff --git a/c++/src/objtools/align_format/unit_test/data/tabular_db.ppi b/c++/src/objtools/align_format/unit_test/data/tabular_db.ppi new file mode 100644 index 0000000000000000000000000000000000000000..6df57341c553067fe80bd66254081c3a0e5aec84 GIT binary patch literal 52 icmZQzU|?i`fB+!H1;ju;Ob9B&z_kDR>yiY!0#LR2yDAQNaIhmbXiL^9>l_=NYDXKO5vG#_vt}Lhrt8oV^q58^k zAy=r~$}@2y+DC~F$WG*nz7zeKxLR_*C;B}xzf1HF6D`pzvDYkYZxgZfp6F-dDRJvC z`Rm5~^Ahcp=u*c^$MZO@ZR|XbFWA@=yRfnUns^PB|BA{2_9fWvdApAf_jsU+PgJM- ljcTh7Z&2Ag_jtLVe{?S!6&|S0Yqs5E<$Aie7pm_t^%EBUHuwMl literal 0 HcmV?d00001 diff --git a/c++/src/objtools/align_format/unit_test/data/tabular_db.ptf b/c++/src/objtools/align_format/unit_test/data/tabular_db.ptf new file mode 100644 index 0000000000000000000000000000000000000000..d355335d95c1aeb10e94b60cbe204f186edd4eb1 GIT binary patch literal 16384 zcmeI&KTE?v9LDjdwL=lfRdH}rK|xT8h(p1pql2K6lY@m?a8j^CCv|Yp_aLJ91_Vco zbf~Yuf`10V%|UQ;v7q^Prryw{hz{Qya+l|l%P*hpNF>{`;ozz9cAc_O(4RjKhNn3x zTMS2C51(=CdQr!uz5d5DJLVZ8fB*srAb zr{h=Xi+h{*{${Lz00IagfB*srAbR5x{FXXp_?009ILKmY** z5I_I{1Q0;rKM2hFMWi*LYN@tap4+Nab~dU(UBgPgq9>!MV!OS!-`i~;tdv*F%bAw9 zZYIoc1mR@TRlx_&B-p`r4=VDT}g{hwtOTNo$O#wDmdB4t`zL+ jgJx^KnUtoY=sSBHmByUx!OupVtl?)lC%f&B1HbzMjE_i7 literal 0 HcmV?d00001 diff --git a/c++/src/objtools/align_format/unit_test/data/tabular_db.pto b/c++/src/objtools/align_format/unit_test/data/tabular_db.pto new file mode 100644 index 0000000000000000000000000000000000000000..98fd8a32677982c8dd71ad075b173e78753036e1 GIT binary patch literal 136 zcmZ9FNeTck3;FGo2jZoHLC}a95h=Dfq6rTDvEM6OrK6ObY>F$~$793)_T6Lq E0T+}2SO5S3 literal 0 HcmV?d00001 diff --git a/c++/src/objtools/align_format/unit_test/tabularinof_unit_test.cpp b/c++/src/objtools/align_format/unit_test/tabularinof_unit_test.cpp index 85ab9d03..43835571 100644 --- a/c++/src/objtools/align_format/unit_test/tabularinof_unit_test.cpp +++ b/c++/src/objtools/align_format/unit_test/tabularinof_unit_test.cpp @@ -1,4 +1,4 @@ -/* $Id: tabularinof_unit_test.cpp 672591 2023-09-11 18:10:14Z ivanov $ +/* $Id: tabularinof_unit_test.cpp 676159 2023-12-11 14:55:46Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -214,7 +214,7 @@ BOOST_AUTO_TEST_CASE(TaxonomyOutput) { const list > & seqalign_list = sa->Get(); - const string kDbName("nr"); + const string kDbName("data/tabular_db"); const CBlastDbDataLoader::EDbType kDbType(CBlastDbDataLoader::eProtein); TestUtil::CBlastOM tmp_data_loader(kDbName, kDbType, CBlastOM::eLocal); CRef scope = tmp_data_loader.NewScope(); @@ -271,7 +271,7 @@ BOOST_AUTO_TEST_CASE(SubjectTitlesOutput) { const list > & seqalign_list = sa->Get(); - const string kDbName("nr"); + const string kDbName("data/tabular_db"); const CBlastDbDataLoader::EDbType kDbType(CBlastDbDataLoader::eProtein); TestUtil::CBlastOM tmp_data_loader(kDbName, kDbType, CBlastOM::eLocal); CRef scope = tmp_data_loader.NewScope(); @@ -317,7 +317,7 @@ BOOST_AUTO_TEST_CASE(SubjectTitlesOutput) { const string ref[5] = { "O19910,NP_045082,phycocyanin alpha subunit [Cyanidium caldarium]<>RecName: Full=C-phycocyanin alpha subunit [Cyanidium caldarium]", "O19910,AAB01593,cpcA [Cyanidium caldarium]", - "O19910,P00306,RecName: Full=C-phycocyanin alpha chain [Galdieria sulphuraria]<>C-phycocyanin alpha chain [validated] - red alga (Cyanidium caldarium) [Cyanidium caldarium]<>phycocyanin alpha subunits [Cyanidium caldarium]<>Structure Of Phycocyanin From Cyanidium Caldarium At 1.65a Resolution [Cyanidium caldarium]", + "O19910,P00306,RecName: Full=C-phycocyanin alpha chain [Galdieria sulphuraria]<>C-phycocyanin alpha chain [validated] - red alga (Cyanidium caldarium) [Cyanidium caldarium]<>phycocyanin alpha subunits [Cyanidium caldarium]<>Chain A, Phycocyanin [Cyanidium caldarium]", "O19910,YP_009051179,phycocyanin alpha subunit [Galdieria sulphuraria]<>[pt] C-phycocyanin alpha chain [Galdieria sulphuraria]<>Chain A, C-phycocyanin alpha chain [unidentified]<>Chain A, C-phycocyanin alpha chain [Galdieria sulphuraria]<>phycocyanin alpha subunit [Galdieria sulphuraria]<>[pt] C-phycocyanin alpha chain [Galdieria sulphuraria]", "O19910,YP_009297463,phycocyanin alpha subunit [Erythrotrichia carnea]<>phycocyanin alpha subunit [Erythrotrichia carnea]"}; for(unsigned int i=0; i < 5; i++) { diff --git a/c++/src/objtools/blast/blastdb_format/blastdb_dataextract.cpp b/c++/src/objtools/blast/blastdb_format/blastdb_dataextract.cpp index cf234ad5..9a1a9555 100644 --- a/c++/src/objtools/blast/blastdb_format/blastdb_dataextract.cpp +++ b/c++/src/objtools/blast/blastdb_format/blastdb_dataextract.cpp @@ -1,4 +1,4 @@ -/* $Id: blastdb_dataextract.cpp 636490 2021-08-25 14:16:34Z fongah2 $ +/* $Id: blastdb_dataextract.cpp 683929 2024-06-10 12:07:52Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -578,7 +578,7 @@ string CBlastDBExtractor::ExtractSeqData() { } if (m_Strand == eNa_strand_minus) { CSeqManip::ReverseComplement(seq, CSeqUtil::e_Iupacna, - 0, seq.size()); + 0, static_cast(seq.size())); } } catch (CSeqDBException& e) { //FIXME: change the enumeration when it's availble @@ -598,7 +598,7 @@ string CBlastDBExtractor::ExtractSeqLen() { string CBlastDBExtractor::ExtractHash() { string seq; m_BlastDb.GetSequenceAsString(m_Oid, seq); - return NStr::IntToString(CBlastSeqUtil::GetSeqHash(seq.c_str(), seq.size())); + return NStr::IntToString(CBlastSeqUtil::GetSeqHash(seq.c_str(), static_cast(seq.size()))); } #define CTRL_A "\001" @@ -1071,7 +1071,7 @@ void CBlastSeqUtil::ApplySeqMask(string & seq, const CSeqDB::TSequenceRanges & m void CBlastSeqUtil::GetReverseStrandSeq(string & seq) { - CSeqManip::ReverseComplement(seq, CSeqUtil::e_Iupacna, 0, seq.size()); + CSeqManip::ReverseComplement(seq, CSeqUtil::e_Iupacna, 0, static_cast(seq.size())); } string CBlastSeqUtil::GetMasksString(const CSeqDB::TSequenceRanges & masks) diff --git a/c++/src/objtools/blast/gene_info_reader/gene_info.cpp b/c++/src/objtools/blast/gene_info_reader/gene_info.cpp index b1106411..18d70e76 100644 --- a/c++/src/objtools/blast/gene_info_reader/gene_info.cpp +++ b/c++/src/objtools/blast/gene_info_reader/gene_info.cpp @@ -1,4 +1,4 @@ -/* $Id: gene_info.cpp 523368 2017-01-03 13:12:11Z madden $ +/* $Id: gene_info.cpp 683929 2024-06-10 12:07:52Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -156,9 +156,9 @@ void CGeneInfo::ToString(string& strGeneInfo, strGeneIdSection += ""; } - unsigned int nGeneIdSectionLength = k_strGeneIdBegin.length() + + unsigned int nGeneIdSectionLength = static_cast(k_strGeneIdBegin.length() + strGeneId.length() + 1 + - strGeneSymbol.length(); + strGeneSymbol.length()); x_Append(strGeneInfo, nCurLineEffLength, strGeneIdSection, nGeneIdSectionLength, nMaxLineLength); @@ -167,7 +167,7 @@ void CGeneInfo::ToString(string& strGeneInfo, string strSeparator = "|"; x_Append(strGeneInfo, nCurLineEffLength, - strSeparator, strSeparator.length(), + strSeparator, static_cast(strSeparator.length()), nMaxLineLength); // Append Gene description. It can be pretty long, split it into @@ -179,7 +179,7 @@ void CGeneInfo::ToString(string& strGeneInfo, { string strCurWord = strDescrWords[iWord]; x_Append(strGeneInfo, nCurLineEffLength, - strCurWord, strCurWord.length(), + strCurWord, static_cast(strCurWord.length()), nMaxLineLength); } @@ -187,7 +187,7 @@ void CGeneInfo::ToString(string& strGeneInfo, string strOrgName = "[" + GetOrganismName() + "]"; x_Append(strGeneInfo, nCurLineEffLength, - strOrgName, strOrgName.length(), + strOrgName, static_cast(strOrgName.length()), nMaxLineLength); // Append the estimated number of pubmed links (if requested) @@ -233,7 +233,7 @@ void CGeneInfo::ToString(string& strGeneInfo, } } - int nPMEffLength = strNumPubMedLinks.length(); + int nPMEffLength = static_cast(strNumPubMedLinks.length()); if (nPMEffLength > 0) { if (bFormatAsHTML) diff --git a/c++/src/objtools/blast/gene_info_reader/gene_info_reader.cpp b/c++/src/objtools/blast/gene_info_reader/gene_info_reader.cpp index a82c259f..dc60fd7d 100644 --- a/c++/src/objtools/blast/gene_info_reader/gene_info_reader.cpp +++ b/c++/src/objtools/blast/gene_info_reader/gene_info_reader.cpp @@ -1,4 +1,4 @@ -/* $Id: gene_info_reader.cpp 628650 2021-04-05 12:32:17Z grichenk $ +/* $Id: gene_info_reader.cpp 683929 2024-06-10 12:07:52Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -240,7 +240,7 @@ static bool s_GetMemFilePtrAndLength(CMemoryFile* pMemFile, { if (pMemFile != 0) { - nRecs = pMemFile->GetSize() / (sizeof(TRecordType)); + nRecs = static_cast(pMemFile->GetSize() / (sizeof(TRecordType))); if (nRecs > 0) { pRecs = (TRecordType*)(pMemFile->GetPtr()); diff --git a/c++/src/objtools/blast/seqdb_reader/seqdb.cpp b/c++/src/objtools/blast/seqdb_reader/seqdb.cpp index ab15869a..0322f26f 100644 --- a/c++/src/objtools/blast/seqdb_reader/seqdb.cpp +++ b/c++/src/objtools/blast/seqdb_reader/seqdb.cpp @@ -1,4 +1,4 @@ -/* $Id: seqdb.cpp 654652 2022-08-18 16:44:30Z fongah2 $ +/* $Id: seqdb.cpp 683929 2024-06-10 12:07:52Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -1472,6 +1472,7 @@ Int8 CSeqDB::GetDiskUsage() const vector extn; const bool is_protein(GetSequenceType() == CSeqDB::eProtein); SeqDB_GetFileExtensions(is_protein, extn, GetBlastDbVersion()); + string blastdb_dirname; ITERATE(vector, path, paths) { ITERATE(vector, ext, extn) { @@ -1480,6 +1481,37 @@ Int8 CSeqDB::GetDiskUsage() const Int8 length = file.GetLength(); if (length != -1) { retval += length; + LOG_POST(Trace << "File " << file.GetPath() << " " << length << " bytes"); + blastdb_dirname = file.GetDir(); + } else { + ERR_POST(Error << "Error retrieving file size for " + << file.GetPath()); + } + } + } + } + // For multi-volume databases, take into account files that apply to the + // entire BLASTDB + if (paths.size() > 1) { + _ASSERT( !blastdb_dirname.empty() ); + auto dbname = GetDBNameList(); + vector dblist; + NStr::Split(dbname, " ", dblist, NStr::fSplit_Tokenize); + if (dblist.size() > 1) { + CNcbiOstrstream oss; + oss << "Cannot compute disk usage for multiple BLASTDBs (i.e.: '" + << dbname << "') at once. Please try again using one BLASTDB " + << "at a time."; + NCBI_THROW(CSeqDBException, eArgErr, CNcbiOstrstreamToString(oss)); + } + + for (const auto& ext: extn) { + CFile file(CDirEntry::MakePath(blastdb_dirname, dbname, ext)); + if (file.Exists()) { + Int8 length = file.GetLength(); + if (length != -1) { + retval += length; + LOG_POST(Trace << "File " << file.GetPath() << " " << length << " bytes"); } else { ERR_POST(Error << "Error retrieving file size for " << file.GetPath()); @@ -1680,8 +1712,8 @@ CRef CSeqDB::GetDBMetaData(string user_path) vector dblist; NStr::Split(GetDBNameList(), " ", dblist, NStr::fSplit_Tokenize); NON_CONST_ITERATE(vector, itr, dblist) { - int off = (*itr).find_last_of(CFile::GetPathSeparator()); - if (off != -1) { + size_t off = (*itr).find_last_of(CFile::GetPathSeparator()); + if (off != string::npos ) { (*itr).erase(0, off+1); } } @@ -1711,7 +1743,7 @@ CRef CSeqDB::GetDBMetaData(string user_path) set tax_ids; GetDBTaxIds(tax_ids); if((tax_ids.size() > 1) || ((tax_ids.size() == 1) && (0 != *tax_ids.begin()))){ - m->SetNumber_of_taxids(tax_ids.size()); + m->SetNumber_of_taxids(static_cast(tax_ids.size())); } } return m; diff --git a/c++/src/objtools/blast/seqdb_reader/seqdbblob.cpp b/c++/src/objtools/blast/seqdb_reader/seqdbblob.cpp index 5d5b5cfb..a46c4b9c 100644 --- a/c++/src/objtools/blast/seqdb_reader/seqdbblob.cpp +++ b/c++/src/objtools/blast/seqdb_reader/seqdbblob.cpp @@ -1,4 +1,4 @@ -/* $Id: seqdbblob.cpp 500404 2016-05-04 14:59:01Z camacho $ +/* $Id: seqdbblob.cpp 683929 2024-06-10 12:07:52Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -103,7 +103,7 @@ Int8 CBlastDbBlob::x_ReadVarInt(int * offsetp) const } else { // end rv = (rv << 6) | (ch & 0x3F); - *offsetp = i+1; + *offsetp = static_cast(i+1); return (ch & 0x40) ? -rv : rv; } @@ -173,7 +173,7 @@ CTempString CBlastDbBlob::x_ReadString(EStringFormat fmt, int * offsetp) const if (fmt == eSize4) { sz = x_ReadIntFixed(offsetp); } else if (fmt == eSizeVar) { - sz = x_ReadVarInt(offsetp); + sz = static_cast( x_ReadVarInt(offsetp)); } const char * datap = ""; @@ -184,7 +184,7 @@ CTempString CBlastDbBlob::x_ReadString(EStringFormat fmt, int * offsetp) const for(size_t i = *offsetp; i < ts.size(); i++) { if (ts[i] == (char)0) { - zoffset = i; + zoffset = static_cast(i); break; } } @@ -395,12 +395,12 @@ int CBlastDbBlob::x_WriteString(CTempString str, EStringFormat fmt, int * offset int start_off = offsetp ? *offsetp : m_WriteOffset; if (fmt == eSize4) { - x_WriteIntFixed(str.size(), offsetp); + x_WriteIntFixed(static_cast(str.size()), offsetp); } else if (fmt == eSizeVar) { x_WriteVarInt(str.size(), offsetp); } - x_WriteRaw(str.data(), str.size(), offsetp); + x_WriteRaw(str.data(),static_cast( str.size()), offsetp); if (fmt == eNUL) { char buf = 0; @@ -481,7 +481,7 @@ void CBlastDbBlob::x_Copy(int total) _ASSERT(! m_DataHere.size()); if (total < (int)m_DataRef.size()) { - total = m_DataRef.size(); + total = static_cast(m_DataRef.size()); } m_Owner = true; @@ -499,7 +499,7 @@ void CBlastDbBlob::x_Reserve(int need) if (! m_Owner) { x_Copy(need); } else { - int cur_cap = m_DataHere.capacity(); + int cur_cap = static_cast(m_DataHere.capacity()); if (cur_cap < need) { // Skip the first few reallocations. @@ -518,9 +518,9 @@ void CBlastDbBlob::x_Reserve(int need) int CBlastDbBlob::Size() const { if (m_Owner) { - return m_DataHere.size(); + return static_cast(m_DataHere.size()); } - return m_DataRef.size(); + return static_cast(m_DataRef.size()); } CTempString CBlastDbBlob::Str() const diff --git a/c++/src/objtools/blast/seqdb_reader/seqdbimpl.cpp b/c++/src/objtools/blast/seqdb_reader/seqdbimpl.cpp index 617a435c..f7f2eff3 100644 --- a/c++/src/objtools/blast/seqdb_reader/seqdbimpl.cpp +++ b/c++/src/objtools/blast/seqdb_reader/seqdbimpl.cpp @@ -1,4 +1,4 @@ -/* $Id: seqdbimpl.cpp 654652 2022-08-18 16:44:30Z fongah2 $ +/* $Id: seqdbimpl.cpp 683929 2024-06-10 12:07:52Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -340,7 +340,7 @@ CSeqDBImpl::GetNextOIDChunk(int & begin_chunk, // out if (m_NumThreads) { SSeqResBuffer * buffer = m_CachedSeqs[cacheID]; x_FillSeqBuffer(buffer, begin_chunk); - end_chunk = begin_chunk + buffer->results.size(); + end_chunk = begin_chunk + static_cast(buffer->results.size()); } else { end_chunk = begin_chunk + oid_size; } @@ -2009,7 +2009,7 @@ int CSeqDBImpl::x_GetColumnId(const string & title, if (found) { CRef obj(new CSeqDB_ColumnEntry(vol_ids)); - col_id = m_ColumnInfo.size(); + col_id = static_cast(m_ColumnInfo.size()); m_ColumnInfo.push_back(obj); } else { col_id = kColumnNotFound; @@ -2584,11 +2584,6 @@ void CSeqDBImpl::SetNumberOfThreads(int num_threads, bool force_mt) m_CachedSeqs.push_back(new SSeqResBuffer()); } - for(int vol_idx = 0; vol_idx < m_VolSet.GetNumVols(); vol_idx++) { - m_VolSet.GetVol(vol_idx)->OpenSeqFile(locked); - } - //m_Atlas.SetSliceSize(); - } else if (num_threads < m_NumThreads) { for (int thread = num_threads; thread < m_NumThreads; ++thread) { diff --git a/c++/src/objtools/blast/seqdb_reader/seqdbisam.cpp b/c++/src/objtools/blast/seqdb_reader/seqdbisam.cpp index 15b91176..edecd143 100644 --- a/c++/src/objtools/blast/seqdb_reader/seqdbisam.cpp +++ b/c++/src/objtools/blast/seqdb_reader/seqdbisam.cpp @@ -1,4 +1,4 @@ -/* $Id: seqdbisam.cpp 626985 2021-03-08 13:57:13Z fongah2 $ +/* $Id: seqdbisam.cpp 683929 2024-06-10 12:07:52Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -1304,7 +1304,7 @@ void CSeqDBIsam::StringToOids(const string & acc, bool is_version = false; if (pos != string::npos) { - int ver_len = acc.size() - pos - 1; + int ver_len = static_cast(acc.size() - pos) - 1; is_version = (ver_len <= 3 && ver_len >= 1); diff --git a/c++/src/objtools/blast/seqdb_reader/seqdblmdbset.cpp b/c++/src/objtools/blast/seqdb_reader/seqdblmdbset.cpp index 331ac8c2..ed3944b3 100644 --- a/c++/src/objtools/blast/seqdb_reader/seqdblmdbset.cpp +++ b/c++/src/objtools/blast/seqdb_reader/seqdblmdbset.cpp @@ -27,6 +27,7 @@ * */ #include +#include #include "seqdblmdbset.hpp" @@ -326,7 +327,7 @@ void CSeqDBLMDBSet::TaxIdsToOids(set& tax_ids, vector& rv } } if(rv.size() == 0) { - NCBI_THROW(CSeqDBException, eTaxidErr, "Taxonomy ID(s) not found. This could be because the ID(s) provided are not at or below the species level. Please use get_species_taxids.sh to get taxids for nodes higher than species (see https://www.ncbi.nlm.nih.gov/books/NBK546209/)."); + NCBI_THROW(CSeqDBException, eTaxidErr, "Taxonomy ID(s) not found in the " + GetDBFileNames() + " database" + (m_LMDBEntrySet.size()>1?"s":"")+ "."); } tax_ids.swap(rv_tax_ids); } @@ -346,7 +347,7 @@ void CSeqDBLMDBSet::NegativeTaxIdsToOids(set& tax_ids, vector1?"s":"")+ "."); } tax_ids.swap(rv_tax_ids); @@ -402,4 +403,26 @@ void CSeqDBLMDBSet::GetLMDBFileNames(vector & lmdb_list) const lmdb_list.push_back(m_LMDBEntrySet[i]->GetLMDBFileName()); } } +// get list of LMDB files for each BLAST DB w/o extentions. +// This is basically approximation for a list of opened databases after resolving aliases. +// default: with_dir_path == false. return w/o leading pathes. +string CSeqDBLMDBSet::GetDBFileNames( bool with_dir_path ) const +{ + string actual_db_list; + for(unsigned int i=0; i < m_LMDBEntrySet.size(); i++) { + string full_name = m_LMDBEntrySet[i]->GetLMDBFileName(); + string short_name , dir_part, out_name; + CDirEntry::SplitPath( full_name, &dir_part , &short_name , 0 ); + // + if( with_dir_path ) { + out_name = dir_part + short_name ; + } + else { + out_name = short_name; + } + if( !actual_db_list.empty() ) actual_db_list.append(" "); + actual_db_list.append( out_name ) ; + } + return actual_db_list ; +} END_NCBI_SCOPE diff --git a/c++/src/objtools/blast/seqdb_reader/seqdblmdbset.hpp b/c++/src/objtools/blast/seqdb_reader/seqdblmdbset.hpp index 518b8a1f..100dcfdf 100644 --- a/c++/src/objtools/blast/seqdb_reader/seqdblmdbset.hpp +++ b/c++/src/objtools/blast/seqdb_reader/seqdblmdbset.hpp @@ -181,6 +181,8 @@ public: void GetLMDBFileNames(vector & lmdb_list) const; + std::string GetDBFileNames(bool with_dir_path = false ) const; + private: vector > m_LMDBEntrySet; diff --git a/c++/src/objtools/blast/seqdb_reader/seqdboidlist.cpp b/c++/src/objtools/blast/seqdb_reader/seqdboidlist.cpp index 7175344b..38be0a6f 100644 --- a/c++/src/objtools/blast/seqdb_reader/seqdboidlist.cpp +++ b/c++/src/objtools/blast/seqdb_reader/seqdboidlist.cpp @@ -1,4 +1,4 @@ -/* $Id: seqdboidlist.cpp 651939 2022-06-28 12:33:29Z fongah2 $ +/* $Id: seqdboidlist.cpp 683929 2024-06-10 12:07:52Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -138,7 +138,7 @@ CSeqDBOIDList::x_ComputeFilters(const CSeqDB_FilterTree & filters, // Step 1: Compute the bitmap representing the filtering done by // all subnodes. This is a "union". - int vols = ft->GetVolumes().size(); + int vols = static_cast(ft->GetVolumes().size()); _ASSERT(vols || ft->GetNodes().size()); diff --git a/c++/src/objtools/blast/seqdb_reader/seqdboidlist.hpp b/c++/src/objtools/blast/seqdb_reader/seqdboidlist.hpp index 4a5403fc..56e2c459 100644 --- a/c++/src/objtools/blast/seqdb_reader/seqdboidlist.hpp +++ b/c++/src/objtools/blast/seqdb_reader/seqdboidlist.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS_READERS_SEQDB__SEQDBOIDLIST_HPP #define OBJTOOLS_READERS_SEQDB__SEQDBOIDLIST_HPP -/* $Id: seqdboidlist.hpp 578711 2019-01-24 15:40:06Z fongah2 $ +/* $Id: seqdboidlist.hpp 683929 2024-06-10 12:07:52Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -123,7 +123,7 @@ public: size_t bit = next_oid; bool found = m_AllBits->CheckOrFindBit(bit); - next_oid = bit; + next_oid = static_cast(bit); _ASSERT(size_t(next_oid) == bit); return found; diff --git a/c++/src/objtools/blast/seqdb_reader/seqdbtax.cpp b/c++/src/objtools/blast/seqdb_reader/seqdbtax.cpp index 1087221d..65edce44 100644 --- a/c++/src/objtools/blast/seqdb_reader/seqdbtax.cpp +++ b/c++/src/objtools/blast/seqdb_reader/seqdbtax.cpp @@ -1,4 +1,4 @@ -/* $Id: seqdbtax.cpp 621548 2020-12-14 18:07:01Z grichenk $ +/* $Id: seqdbtax.cpp 683533 2024-05-30 12:54:51Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -129,6 +129,7 @@ CTaxDBFileInfo::CTaxDBFileInfo() m_DataFileSize(0), m_MissingDB(false) { + try { // It is reasonable for this database to not exist. m_IndexFN = SeqDB_ResolveDbPath("taxdb.bti"); @@ -202,7 +203,16 @@ CTaxDBFileInfo::CTaxDBFileInfo() m_DataPtr = (char *) (m_DataFileMap->GetPtr()); m_DataFileSize = m_DataFileMap->GetSize(); m_IndexPtr = (CSeqDBTaxId*) magic_num_ptr; - + } + catch (const std::exception& e) { + string err_msg = e.what(); + if (err_msg.find("Too many open files") == std::string::npos ) { + NCBI_THROW(CSeqDBException, eFileErr, e.what()); + } + else { + NCBI_THROW(CSeqDBException, eOpenFileErr, e.what()); + } + } } CTaxDBFileInfo::~CTaxDBFileInfo() diff --git a/c++/src/objtools/blast/seqdb_reader/seqdbvol.cpp b/c++/src/objtools/blast/seqdb_reader/seqdbvol.cpp index 86930973..a04820d7 100644 --- a/c++/src/objtools/blast/seqdb_reader/seqdbvol.cpp +++ b/c++/src/objtools/blast/seqdb_reader/seqdbvol.cpp @@ -1,4 +1,4 @@ -/* $Id: seqdbvol.cpp 651939 2022-06-28 12:33:29Z fongah2 $ +/* $Id: seqdbvol.cpp 683929 2024-06-10 12:07:52Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -93,7 +93,7 @@ CSeqDBVol::CSeqDBVol(CSeqDBAtlas & atlas, { if (user_list) { m_UserGiList.Reset(user_list); - m_OidMaskType = m_UserGiList->GetMaskOpts(); + m_OidMaskType = static_cast(m_UserGiList->GetMaskOpts()); } if (neg_list) { m_NegativeList.Reset(neg_list); @@ -1538,7 +1538,7 @@ int CSeqDBVol::GetAmbigPartialSeq(int oid, } - int num_ranges = partial_ranges->size(); + int num_ranges = static_cast(partial_ranges->size()); if ((*partial_ranges)[num_ranges - 1].second > base_length) { NCBI_THROW(CSeqDBException, eFileErr, "Error: region beyond sequence range."); } @@ -1713,7 +1713,7 @@ void SeqDB_UnpackAmbiguities(const CTempString & sequence, const char * seq_buffer = sequence.data(); - int whole_bytes = sequence.length() - 1; + int whole_bytes = static_cast(sequence.length()) - 1; int remainder = sequence[whole_bytes] & 3; int base_length = (whole_bytes * 4) + remainder; @@ -3384,7 +3384,7 @@ int CSeqDBVol::GetColumnId(const string & title, for(size_t i = 0; i < m_Columns.size(); i++) { if (m_Columns[i]->GetTitle() == title) { - return i; + return static_cast(i); } } diff --git a/c++/src/objtools/blast/seqdb_reader/seqidlist_reader.cpp b/c++/src/objtools/blast/seqdb_reader/seqidlist_reader.cpp index d9b443b9..85befa83 100644 --- a/c++/src/objtools/blast/seqdb_reader/seqidlist_reader.cpp +++ b/c++/src/objtools/blast/seqdb_reader/seqidlist_reader.cpp @@ -125,7 +125,7 @@ int CBlastSeqidlistFile::GetSeqidlistInfo(const string & filename, SBlastSeqIdLi CMemoryFile in(file); CSeqidlistRead list(in); list.GetListInfo(list_info); - return list_info.num_ids; + return static_cast(list_info.num_ids); } diff --git a/c++/src/objtools/blast/seqdb_reader/tax4blastsqlite.cpp b/c++/src/objtools/blast/seqdb_reader/tax4blastsqlite.cpp index 900cabcb..95ea3803 100644 --- a/c++/src/objtools/blast/seqdb_reader/tax4blastsqlite.cpp +++ b/c++/src/objtools/blast/seqdb_reader/tax4blastsqlite.cpp @@ -1,4 +1,4 @@ -/* $Id: tax4blastsqlite.cpp 673642 2023-10-05 19:23:19Z ivanov $ +/* $Id: tax4blastsqlite.cpp 683950 2024-06-10 12:11:31Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -28,10 +28,6 @@ /// @author Christiam Camacho /// Implementation for the CTaxonomy4BlastSQLite class -#ifndef SKIP_DOXYGEN_PROCESSING -static char const rcsid[] = "$Id: tax4blastsqlite.cpp 673642 2023-10-05 19:23:19Z ivanov $"; -#endif /* SKIP_DOXYGEN_PROCESSING */ - #include #include #include diff --git a/c++/src/objtools/blast/seqdb_writer/build-alias-index b/c++/src/objtools/blast/seqdb_writer/build-alias-index index f056bf1a..dbce7d33 100755 --- a/c++/src/objtools/blast/seqdb_writer/build-alias-index +++ b/c++/src/objtools/blast/seqdb_writer/build-alias-index @@ -3,7 +3,7 @@ # subdirectory # Author: Kevin Bealer # Original date: 10/21/2005 -# $URL: https://svn.ncbi.nlm.nih.gov/repos/toolkit/release/blast/2.15.0/c++/src/objtools/blast/seqdb_writer/build-alias-index $ +# $URL: https://svn.ncbi.nlm.nih.gov/repos/toolkit/release/blast/2.16.0/c++/src/objtools/blast/seqdb_writer/build-alias-index $ INDEX_NAME=index.alx OUTNAME=index.alx.new diff --git a/c++/src/objtools/blast/seqdb_writer/build_db.cpp b/c++/src/objtools/blast/seqdb_writer/build_db.cpp index 58f578f8..6e49832d 100644 --- a/c++/src/objtools/blast/seqdb_writer/build_db.cpp +++ b/c++/src/objtools/blast/seqdb_writer/build_db.cpp @@ -1,4 +1,4 @@ -/* $Id: build_db.cpp 662402 2023-01-30 14:32:39Z madden $ +/* $Id: build_db.cpp 675078 2023-11-14 13:36:47Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -471,7 +471,8 @@ bool CBuildDatabase::x_EditAndAddBioseq(CConstRef bs, bool add_pig) { CRef headers = - CWriteDB::ExtractBioseqDeflines(*bs, m_ParseIDs, m_LongIDs); + CWriteDB::ExtractBioseqDeflines(*bs, m_ParseIDs, m_LongIDs, + m_ScanBioseq4CFastaReaderUsrObjct); x_EditHeaders(headers); @@ -1078,7 +1079,8 @@ CBuildDatabase::CBuildDatabase(const string & dbname, bool long_seqids, EBlastDbVersion dbver, bool limit_defline, - Uint8 oid_masks) + Uint8 oid_masks, + bool scan_bioseq_4_cfastareader_usrobj) : m_IsProtein (is_protein), m_KeepLinks (false), m_KeepMbits (false), @@ -1094,7 +1096,8 @@ CBuildDatabase::CBuildDatabase(const string & dbname, m_FoundMatchingMasks(false), m_SkipCopyingGis(false), m_SkipLargeGis(true), - m_OutputDbName(kEmptyStr) + m_OutputDbName(kEmptyStr), + m_ScanBioseq4CFastaReaderUsrObjct(scan_bioseq_4_cfastareader_usrobj) { CreateDirectories(dbname); const string output_dbname = CDirEntry::CreateAbsolutePath(dbname); @@ -1140,7 +1143,8 @@ CBuildDatabase::CBuildDatabase(const string & dbname, bool long_seqids, EBlastDbVersion dbver, bool limit_defline, - Uint8 oid_masks) + Uint8 oid_masks, + bool scan_bioseq_4_cfastareader_usrobj) : m_IsProtein (is_protein), m_KeepLinks (false), m_KeepMbits (false), @@ -1155,7 +1159,8 @@ CBuildDatabase::CBuildDatabase(const string & dbname, m_LongIDs (long_seqids), m_FoundMatchingMasks(false), m_SkipCopyingGis(false), - m_SkipLargeGis(true) + m_SkipLargeGis(true), + m_ScanBioseq4CFastaReaderUsrObjct(scan_bioseq_4_cfastareader_usrobj) { CreateDirectories(dbname); const string output_dbname = CDirEntry::CreateAbsolutePath(dbname); @@ -1187,7 +1192,8 @@ CBuildDatabase::CBuildDatabase(const string & dbname, use_gi_mask, dbver, limit_defline, - oid_masks)); + oid_masks, + scan_bioseq_4_cfastareader_usrobj)); // Standard 1 GB limit diff --git a/c++/src/objtools/blast/seqdb_writer/unit_test/writedb_unit_test.cpp b/c++/src/objtools/blast/seqdb_writer/unit_test/writedb_unit_test.cpp index c2fec898..2e6b4ab7 100644 --- a/c++/src/objtools/blast/seqdb_writer/unit_test/writedb_unit_test.cpp +++ b/c++/src/objtools/blast/seqdb_writer/unit_test/writedb_unit_test.cpp @@ -1,4 +1,4 @@ -/* $Id: writedb_unit_test.cpp 627687 2021-03-17 14:25:53Z fongah2 $ +/* $Id: writedb_unit_test.cpp 675078 2023-11-14 13:36:47Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -1584,14 +1584,10 @@ BOOST_AUTO_TEST_CASE(FastaReaderBioseq) // Prefer BOOST_REQUIRE_EQUAL(a, b) over BOOST_REQUIRE(a == b). // The former will print the non-equal values for you, the latter // does not. - BOOST_REQUIRE_EQUAL(bdls->Get().size(), 2); + BOOST_REQUIRE_EQUAL(bdls->Get().size(), 1); BOOST_REQUIRE_EQUAL(bdls->Get().front()->GetTitle(), T1); BOOST_REQUIRE_EQUAL(bdls->Get().front()->GetSeqid().size(), 1); BOOST_REQUIRE_EQUAL(bdls->Get().front()->GetSeqid().front()->AsFastaString(), I1); - - BOOST_REQUIRE_EQUAL(bdls->Get().back()->GetTitle(), T2); - BOOST_REQUIRE_EQUAL(bdls->Get().back()->GetSeqid().size(), 1); - BOOST_REQUIRE_EQUAL(bdls->Get().back()->GetSeqid().front()->AsFastaString(), I2); } s_WrapUpFiles(files); diff --git a/c++/src/objtools/blast/seqdb_writer/writedb.cpp b/c++/src/objtools/blast/seqdb_writer/writedb.cpp index c64013c4..e695957c 100644 --- a/c++/src/objtools/blast/seqdb_writer/writedb.cpp +++ b/c++/src/objtools/blast/seqdb_writer/writedb.cpp @@ -1,4 +1,4 @@ -/* $Id: writedb.cpp 651876 2022-06-27 15:12:50Z fongah2 $ +/* $Id: writedb.cpp 683943 2024-06-10 12:10:21Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -55,7 +55,8 @@ CWriteDB::CWriteDB(const string & dbname, bool use_gi_mask, EBlastDbVersion dbver, bool limit_defline, - Uint8 oid_masks) + Uint8 oid_masks, + bool scan_bioseq_4_cfastareader_usrobj) : m_Impl(0) { m_Impl = new CWriteDB_Impl(dbname, @@ -126,9 +127,10 @@ void CWriteDB::SetMaxVolumeLetters(Uint8 sz) CRef CWriteDB::ExtractBioseqDeflines(const CBioseq & bs, bool parse_ids, - bool long_ids) + bool long_ids, + bool scan_bioseq_4_cfastareader_usrobj) { - return CWriteDB_Impl::ExtractBioseqDeflines(bs, parse_ids, long_ids); + return CWriteDB_Impl::ExtractBioseqDeflines(bs, parse_ids, long_ids, scan_bioseq_4_cfastareader_usrobj); } void CWriteDB::SetMaskedLetters(const string & masked) @@ -332,7 +334,8 @@ void CWriteDB_CreateAliasFile(const string& file_name, const string& title, EAliasFileFilterType alias_type /*= eGiList*/) { - vector db(1, db_name); + vector db; + NStr::Split(db_name," ",db); CWriteDB_CreateAliasFile(file_name, db, seq_type, gi_file_name, title, alias_type); } diff --git a/c++/src/objtools/blast/seqdb_writer/writedb_impl.cpp b/c++/src/objtools/blast/seqdb_writer/writedb_impl.cpp index ee9cda5e..89fa996a 100644 --- a/c++/src/objtools/blast/seqdb_writer/writedb_impl.cpp +++ b/c++/src/objtools/blast/seqdb_writer/writedb_impl.cpp @@ -1,4 +1,4 @@ -/* $Id: writedb_impl.cpp 649164 2022-04-28 11:08:55Z fongah2 $ +/* $Id: writedb_impl.cpp 675078 2023-11-14 13:36:47Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -62,7 +62,8 @@ CWriteDB_Impl::CWriteDB_Impl(const string & dbname, bool use_gi_mask, EBlastDbVersion dbver, bool limit_defline, - Uint8 oid_masks) + Uint8 oid_masks, + bool scan_bioseq_4_cfastareader_usrobj) : m_Dbname (dbname), m_Protein (protein), m_Title (title), @@ -81,7 +82,8 @@ CWriteDB_Impl::CWriteDB_Impl(const string & dbname, m_LongSeqId (long_ids), m_LmdbOid (0), m_limitDefline (protein? limit_defline: false), - m_OidMasks (oid_masks) + m_OidMasks (oid_masks), + m_ScanBioseq4CFastaReaderUsrObjct(scan_bioseq_4_cfastareader_usrobj) { CTime now(CTime::eCurrent); @@ -770,7 +772,8 @@ CWriteDB_Impl::x_ExtractDeflines(CConstRef & bioseq, int OID, bool parse_ids, bool long_ids, - bool limit_defline) + bool limit_defline, + bool scan_bioseq_4_cfastareader_usrobj) { bool use_bin = (deflines.Empty() && pig == 0); @@ -805,7 +808,8 @@ CWriteDB_Impl::x_ExtractDeflines(CConstRef & bioseq, pig, false, parse_ids, - long_ids); + long_ids, + scan_bioseq_4_cfastareader_usrobj); } catch ( const CSeqIdException&e ) { //LOG_POST(Info << "x_GetFastaReaderDeflines " << e.GetMsg() ); } @@ -912,7 +916,8 @@ void CWriteDB_Impl::x_CookHeader() OID, m_ParseIDs, m_LongSeqId, - m_limitDefline); + m_limitDefline, + m_ScanBioseq4CFastaReaderUsrObjct); x_CookIds(); } @@ -1567,7 +1572,8 @@ void CWriteDB_Impl::SetMaxVolumeLetters(Uint8 sz) CRef CWriteDB_Impl::ExtractBioseqDeflines(const CBioseq & bs, bool parse_ids, - bool long_seqids) + bool long_seqids, + bool scan_bioseq_4_cfastareader_usrobj) { // Get information @@ -1575,10 +1581,11 @@ CWriteDB_Impl::ExtractBioseqDeflines(const CBioseq & bs, bool parse_ids, string binary_header; vector< vector > v1, v2; set t; + const bool kLimitDefline = false; CConstRef bsref(& bs); x_ExtractDeflines(bsref, deflines, binary_header, v2, v2, 0, t, -1, parse_ids, - long_seqids); + long_seqids, kLimitDefline, scan_bioseq_4_cfastareader_usrobj); // Convert to return type @@ -1716,7 +1723,8 @@ x_GetFastaReaderDeflines(const CBioseq & bioseq, int pig, bool accept_gt, bool parse_ids, - bool long_seqids) + bool long_seqids, + bool scan_bioseq_4_cfastareader_usrobj) { if (! bioseq.CanGetDescr()) { return; @@ -1726,33 +1734,35 @@ x_GetFastaReaderDeflines(const CBioseq & bioseq, // Scan the CBioseq for the CFastaReader user object. - ITERATE(list< CRef< CSeqdesc > >, iter, bioseq.GetDescr().Get()) { - const CSeqdesc & desc = **iter; + if (scan_bioseq_4_cfastareader_usrobj) { + ITERATE(list< CRef< CSeqdesc > >, iter, bioseq.GetDescr().Get()) { + const CSeqdesc & desc = **iter; + + if (desc.IsUser() && + desc.GetUser().CanGetType() && + desc.GetUser().GetType().IsStr() && + desc.GetUser().GetType().GetStr() == "CFastaReader" && + desc.GetUser().CanGetData()) { + + const vector< CRef< CUser_field > > & D = desc.GetUser().GetData(); + + ITERATE(vector< CRef< CUser_field > >, iter, D) { + const CUser_field & f = **iter; - if (desc.IsUser() && - desc.GetUser().CanGetType() && - desc.GetUser().GetType().IsStr() && - desc.GetUser().GetType().GetStr() == "CFastaReader" && - desc.GetUser().CanGetData()) { - - const vector< CRef< CUser_field > > & D = desc.GetUser().GetData(); - - ITERATE(vector< CRef< CUser_field > >, iter, D) { - const CUser_field & f = **iter; - - if (f.CanGetLabel() && - f.GetLabel().IsStr() && - f.GetLabel().GetStr() == "DefLine" && - f.CanGetData() && - f.GetData().IsStr()) { - fasta = NStr::Replace(f.GetData().GetStr(), "\\t", TAB_REPLACEMENT); - fasta = NStr::ParseEscapes(fasta); - break; + if (f.CanGetLabel() && + f.GetLabel().IsStr() && + f.GetLabel().GetStr() == "DefLine" && + f.CanGetData() && + f.GetData().IsStr()) { + fasta = NStr::Replace(f.GetData().GetStr(), "\\t", TAB_REPLACEMENT); + fasta = NStr::ParseEscapes(fasta); + break; + } } } } - } + } if (fasta.empty()) return; diff --git a/c++/src/objtools/blast/seqdb_writer/writedb_impl.hpp b/c++/src/objtools/blast/seqdb_writer/writedb_impl.hpp index 0e7e0001..56fc4188 100644 --- a/c++/src/objtools/blast/seqdb_writer/writedb_impl.hpp +++ b/c++/src/objtools/blast/seqdb_writer/writedb_impl.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS_WRITERS_WRITEDB__WRITEDB_IMPL_HPP #define OBJTOOLS_WRITERS_WRITEDB__WRITEDB_IMPL_HPP -/* $Id: writedb_impl.hpp 649924 2022-05-12 15:50:24Z fongah2 $ +/* $Id: writedb_impl.hpp 675078 2023-11-14 13:36:47Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -76,6 +76,9 @@ public: /// @param long_ids If true, assume long sequence ids (database|accession) /// when parsing strings ids /// @param use_gi_mask If true generate GI-based mask files. + /// @param scan_bioseq_4_cfastareader_usrobj [in] + /// If true, scan the Bioseq objects for a CFastaReader-created User-object + /// containing a defline CWriteDB_Impl(const string & dbname, bool protein, const string & title, @@ -85,7 +88,8 @@ public: bool use_gi_mask, EBlastDbVersion dbver = eBDB_Version4, bool limit_defline = false, - Uint8 oid_masks = EOidMaskType::fNone); + Uint8 oid_masks = EOidMaskType::fNone, + bool scan_bioseq_4_cfastareader_usrobj = false); /// Destructor. ~CWriteDB_Impl(); @@ -221,9 +225,13 @@ public: /// @param bs Bioseq from which to construct the defline set. /// @param parse_ids If we should parse seq_ids. /// @param long_seqids If true use long sequence ids (database|accession) + /// @param scan_bioseq_4_cfastareader_usrobj [in] + /// If true, scan the Bioseq objects for a CFastaReader-created User-object + /// containing a defline /// @return The blast defline set. static CRef - ExtractBioseqDeflines(const CBioseq & bs, bool parse_ids, bool long_seqids); + ExtractBioseqDeflines(const CBioseq & bs, bool parse_ids, bool long_seqids, + bool scan_bioseq_4_cfastareader_usrobj = false); /// Set bases that should not be used in sequences. /// @@ -489,6 +497,7 @@ private: /// @param parse_ids Whether seq_id should not be parsed. [in] /// @param long_seqids If true, use long sequence ids (database|accession) /// [in] + /// @param scan_bioseq_4_cfastareader_usrobj if true, scan the Bioseq objects for a [in] static void x_GetFastaReaderDeflines(const CBioseq & bioseq, CConstRef & deflines, @@ -497,7 +506,8 @@ private: int pig, bool accept_gt, bool parse_ids, - bool long_seqids); + bool long_seqids, + bool scan_bioseq_4_cfastareader_usrobj = false); /// Returns true if we have unwritten sequence data. bool x_HaveSequence() const; @@ -535,7 +545,8 @@ private: int OID=-1, bool parse_ids=true, bool long_seqid=false, - bool limit_defline = false); + bool limit_defline = false, + bool scan_bioseq_4_cfastareader_usrobj = false); /// Compute the hash of a (raw) sequence. /// @@ -645,6 +656,8 @@ private: bool m_limitDefline; Uint8 m_OidMasks; + + bool m_ScanBioseq4CFastaReaderUsrObjct; }; END_NCBI_SCOPE diff --git a/c++/src/objtools/cleanup/CMakeLists.cleanup.lib.txt b/c++/src/objtools/cleanup/CMakeLists.cleanup.lib.txt index 137ecda5..63a553bb 100644 --- a/c++/src/objtools/cleanup/CMakeLists.cleanup.lib.txt +++ b/c++/src/objtools/cleanup/CMakeLists.cleanup.lib.txt @@ -1,11 +1,11 @@ -# $Id: CMakeLists.cleanup.lib.txt 660856 2022-12-28 16:24:42Z foleyjp $ +# $Id: CMakeLists.cleanup.lib.txt 680750 2024-03-27 13:48:22Z ivanov $ NCBI_begin_lib(xcleanup) NCBI_sources( autogenerated_cleanup autogenerated_extended_cleanup cleanup cleanup_utils gene_qual_normalization cleanup_user_object cleanup_author cleanup_pub newcleanupp capitalization_string fix_feature_id - cleanup_message huge_file_cleanup influenza_set + cleanup_message influenza_set ) NCBI_uses_toolkit_libraries(xobjedit) NCBI_project_watchers(stakhovv kans) diff --git a/c++/src/objtools/cleanup/Makefile.cleanup.lib b/c++/src/objtools/cleanup/Makefile.cleanup.lib index d4cc0aee..74a1c345 100644 --- a/c++/src/objtools/cleanup/Makefile.cleanup.lib +++ b/c++/src/objtools/cleanup/Makefile.cleanup.lib @@ -1,4 +1,4 @@ -# $Id: Makefile.cleanup.lib 660856 2022-12-28 16:24:42Z foleyjp $ +# $Id: Makefile.cleanup.lib 680750 2024-03-27 13:48:22Z ivanov $ # Build library "xcleanup" ############################### @@ -9,7 +9,7 @@ ASN_DEP = submit taxon3 valid SRC = autogenerated_cleanup autogenerated_extended_cleanup cleanup \ cleanup_utils gene_qual_normalization cleanup_user_object cleanup_author \ cleanup_pub newcleanupp capitalization_string fix_feature_id \ - cleanup_message huge_file_cleanup influenza_set + cleanup_message influenza_set DLL_LIB = $(OBJEDIT_LIBS) xregexp $(PCRE_LIB) LIB = xcleanup diff --git a/c++/src/objtools/cleanup/autogenerated_cleanup.cpp b/c++/src/objtools/cleanup/autogenerated_cleanup.cpp index 4c8865c4..26e0ac01 100644 --- a/c++/src/objtools/cleanup/autogenerated_cleanup.cpp +++ b/c++/src/objtools/cleanup/autogenerated_cleanup.cpp @@ -1,4 +1,4 @@ -/* $Id: autogenerated_cleanup.cpp 671826 2023-08-24 19:41:26Z ivanov $ +/* $Id: autogenerated_cleanup.cpp 675103 2023-11-14 19:31:19Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -2253,7 +2253,6 @@ void CAutogeneratedCleanup::x_BasicCleanupDescComment( std::string & arg0 ) m_NewCleanup.x_DecodeXMLMarkChanged( arg0 ); m_NewCleanup.x_CleanupStringJunkMarkChanged( arg0 ); m_NewCleanup.x_RemoveSpacesBetweenTildesMarkChanged( arg0 ); - m_NewCleanup.X_CommentTildeFixes( arg0 ); } // end of x_BasicCleanupDescComment void CAutogeneratedCleanup::x_BasicCleanupEMBLBlock( CEMBL_block & arg0 ) diff --git a/c++/src/objtools/cleanup/autogenerated_extended_cleanup.cpp b/c++/src/objtools/cleanup/autogenerated_extended_cleanup.cpp index 7771b185..686ca6c0 100644 --- a/c++/src/objtools/cleanup/autogenerated_extended_cleanup.cpp +++ b/c++/src/objtools/cleanup/autogenerated_extended_cleanup.cpp @@ -1,4 +1,4 @@ -/* $Id: autogenerated_extended_cleanup.cpp 671840 2023-08-24 20:00:40Z ivanov $ +/* $Id: autogenerated_extended_cleanup.cpp 675103 2023-11-14 19:31:19Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -196,7 +196,6 @@ void CAutogeneratedExtendedCleanup::ExtendedCleanupSeqFeat( CSeq_feat & arg0_raw m_NewCleanup.CdRegionEC( arg0 ); m_NewCleanup.MoveDbxrefs( arg0 ); m_NewCleanup.MoveStandardName( arg0 ); - m_NewCleanup.CreatePubFromFeat( arg0 ); m_NewCleanup.ResynchProteinPartials( arg0 ); m_NewCleanup.x_MoveSeqfeatOrgToSourceOrg( arg0 ); if( arg0.IsSetData() ) { diff --git a/c++/src/objtools/cleanup/capitalization_string.cpp b/c++/src/objtools/cleanup/capitalization_string.cpp index c4f3eff4..27acc134 100644 --- a/c++/src/objtools/cleanup/capitalization_string.cpp +++ b/c++/src/objtools/cleanup/capitalization_string.cpp @@ -1,4 +1,4 @@ -/* $Id: capitalization_string.cpp 663485 2023-02-22 15:30:43Z asztalos $ +/* $Id: capitalization_string.cpp 681619 2024-04-11 12:27:56Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -238,6 +238,24 @@ static const string mouse_strain_fixes[] = { typedef CStaticPairArrayMap TCStringPairsMap; DEFINE_STATIC_ARRAY_MAP(TCStringPairsMap,k_state_abbrev, map_state_to_abbrev); +MAKE_CONST_MAP(Canada_map_state_to_abbrev, ct::tagStrNocase, ct::tagStrNocase, +{ + { "alberta", "AB"}, + { "british columbia", "BC"}, + { "manitoba", "MB"}, + { "new brunswick", "NB"}, + { "newfoundland and labrador", "NL"}, + { "northwest territories", "NT"}, + { "nova scotia", "NS"}, + { "nunavut", "NU"}, + { "ontario", "ON"}, + { "prince edward island", "PE"}, + { "quebec", "QC"}, + { "saskatchewan", "SK"}, + { "yukon", "YT"} +}); + + static const SStaticPair set_short_words[] = { {"\\bA\\b", "a" }, @@ -779,6 +797,17 @@ void GetStateAbbreviation(string& state) NStr::ToUpper(state); } +void GetCanadaStateAbbreviation(string& state) +{ + NStr::ReplaceInPlace(state, " ", " "); + NStr::TruncateSpacesInPlace(state); + auto found = Canada_map_state_to_abbrev.find(state); + if (found != Canada_map_state_to_abbrev.end()) + state = found->second; + else + NStr::ToUpper(state); +} + bool FixStateAbbreviationsInCitSub(CCit_sub& sub) { bool modified = false; diff --git a/c++/src/objtools/cleanup/cleanup.cpp b/c++/src/objtools/cleanup/cleanup.cpp index 06872ff3..f192460d 100644 --- a/c++/src/objtools/cleanup/cleanup.cpp +++ b/c++/src/objtools/cleanup/cleanup.cpp @@ -1,4 +1,4 @@ -/* $Id: cleanup.cpp 671837 2023-08-24 19:42:54Z ivanov $ +/* $Id: cleanup.cpp 681442 2024-04-09 14:53:56Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -74,7 +74,7 @@ #include -#include "influenza_set.hpp" +#include BEGIN_NCBI_SCOPE BEGIN_SCOPE(objects) @@ -297,23 +297,12 @@ vector CCleanupChangeCore::GetAllChanges() const return m_Changes; } - -vector CCleanupChangeCore::GetAllDescriptions() const -{ - vector result; - result.reserve(m_Changes.size()); - for (auto it: m_Changes) { - result.push_back( string( GetDescription(it) ) ); - } - return result; -} - vector CCleanupChangeCore::GetDescriptions() const { - vector result; + vector result; result.reserve(m_Changes.size()); - for (auto it: m_Changes) { - result.push_back( GetDescription(it) ); + for (auto it : m_Changes) { + result.push_back(GetDescription(it)); } return result; } @@ -1521,22 +1510,6 @@ const string& CCleanup::GetProteinName(const CSeq_feat& cds, CSeq_entry_Handle s } -const string& CCleanup::GetProteinName(const CSeq_feat& cds, CScope& scope) -{ - if (cds.IsSetProduct()) { - CBioseq_Handle prot = scope.GetBioseqHandle(cds.GetProduct()); - if (prot) { - CFeat_CI f(prot, CSeqFeatData::eSubtype_prot); - if (f) { - return GetProteinName(f->GetData().GetProt()); - } - } - } - - return s_GetProteinNameFromXrefOrQual(cds); -} - - bool CCleanup::SetCDSPartialsByFrameAndTranslation(CSeq_feat& cds, CScope& scope) { bool any_change = false; @@ -3214,7 +3187,7 @@ vector& unpublished_labels) } if (need_label && NStr::IsBlank(label)) { // create unique label - (*it)->GetLabel(&label, CPub::eContent, true); + (*it)->GetLabel(&label, CPub::eContent, CPub::fLabel_Unique); string auth_str; s_GetAuthorsString(&auth_str, pd); label += "; "; @@ -4168,7 +4141,7 @@ bool CCleanup::DecodeXMLMarkChanged(std::string & str) { "#8710", "delta" }, { "#64257", "fi" }, { "#64258", "fl" }, - { "#65292", "," } + { "#65292", "," }, }; // Collisions should be rare enough that the CFastMutex is @@ -4180,13 +4153,10 @@ bool CCleanup::DecodeXMLMarkChanged(std::string & str) // the searcher at the same time. static CFastMutex searcher_mtx; CFastMutexGuard searcher_mtx_guard( searcher_mtx ); - if( ! searcher.IsPrimed() ) { - for( int idx = 0; - idx < sizeof(transformations)/sizeof(transformations[0]); - ++idx ) - { + if (! searcher.IsPrimed()) { + for (unsigned idx = 0; idx < ArraySize(transformations); ++idx) { // match type is index into transformations array - searcher.AddWord( transformations[idx].src_word, idx ); + searcher.AddWord(transformations[idx].src_word, idx); } searcher.Prime(); } @@ -4493,7 +4463,7 @@ bool CCleanup::ParseCodeBreak(const CSeq_feat& feat, len++; } if (len != 0) { - protein_letter = ValidAminoAcid(str.substr(aa_pos, len)); + protein_letter = x_ValidAminoAcid(str.substr(aa_pos, len)); } } @@ -5000,5 +4970,11 @@ void CCleanup::AutodefId(CSeq_entry_Handle seh) CAutoDef::RegenerateSequenceDefLines(seh); } + +char CCleanup::ValidAminoAcid(string_view abbrev) +{ + return x_ValidAminoAcid(abbrev); +} + END_SCOPE(objects) END_NCBI_SCOPE diff --git a/c++/src/objtools/cleanup/cleanup_utils.cpp b/c++/src/objtools/cleanup/cleanup_utils.cpp index 4f1d5e73..f8835aa6 100644 --- a/c++/src/objtools/cleanup/cleanup_utils.cpp +++ b/c++/src/objtools/cleanup/cleanup_utils.cpp @@ -1,4 +1,4 @@ -/* $Id: cleanup_utils.cpp 642578 2021-12-22 19:48:06Z stakhovv $ +/* $Id: cleanup_utils.cpp 681442 2024-04-09 14:53:56Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -156,7 +156,7 @@ bool CleanVisStringJunk( string &str, bool allow_ellipses ) // while we're at it, also check if the junk contains a tilde and/or period bool isPeriod = false; bool isTilde = false; - int start_of_junk_pos = str.length() - 1; + int start_of_junk_pos = (int)str.length() - 1; for( ; start_of_junk_pos >= 0 ; --start_of_junk_pos ) { const char ch = str[start_of_junk_pos]; if (ch <= ' ' || ch == '.' || ch == ',' || ch == '~' || ch == ';') { @@ -184,7 +184,7 @@ bool CleanVisStringJunk( string &str, bool allow_ellipses ) // holds the suffix to add after we remove the junk const char * suffix = ""; // by default, just remove junk - const int chars_in_junk = ( str.length() - start_of_junk_pos ); + const int chars_in_junk = ( (int)str.length() - start_of_junk_pos ); _ASSERT( chars_in_junk >= 1 ); // allow one period at end if (isPeriod) { @@ -340,7 +340,6 @@ bool Asn2gnbkCompressSpaces(string& val) curr = *in; in++; - next = 0; two_chars = curr; while (curr != '\0') { @@ -630,27 +629,25 @@ static ProteinAbbrevData abbreviation_list[] = // or three-letter abbreviation. // Use X if the abbreviation is not found. -char ValidAminoAcid (const string& abbrev) +char x_ValidAminoAcid(string_view abbrev) { - char ch = 'X'; - - for (unsigned int k = 0; k < sizeof(abbreviation_list) / sizeof (ProteinAbbrevData); k++) { - if (NStr::EqualNocase (abbrev, abbreviation_list[k].abbreviation)) { - ch = abbreviation_list[k].letter; - break; + if (abbrev.length() >= 3) { + for (unsigned k = 0; k < ArraySize(abbreviation_list); ++k) { + if (NStr::EqualNocase(abbrev, abbreviation_list[k].abbreviation)) { + return abbreviation_list[k].letter; + } } } if (abbrev.length() == 1) { - for (unsigned int k = 0; k < sizeof(abbreviation_list) / sizeof (ProteinAbbrevData); k++) { - if (abbrev.c_str()[0] == abbreviation_list[k].letter) { - ch = abbreviation_list[k].letter; - break; + for (unsigned k = 0; k < ArraySize(abbreviation_list); ++k) { + if (abbrev[0] == abbreviation_list[k].letter) { + return abbreviation_list[k].letter; } } } - return ch; + return 'X'; } diff --git a/c++/src/objtools/cleanup/cleanup_utils.hpp b/c++/src/objtools/cleanup/cleanup_utils.hpp index 50fc4fc9..732e997d 100644 --- a/c++/src/objtools/cleanup/cleanup_utils.hpp +++ b/c++/src/objtools/cleanup/cleanup_utils.hpp @@ -1,7 +1,7 @@ #ifndef OBJECTS_GENERAL___CLEANUP_UTILS__HPP #define OBJECTS_GENERAL___CLEANUP_UTILS__HPP -/* $Id: cleanup_utils.hpp 630406 2021-05-02 16:29:58Z stakhovv $ +/* $Id: cleanup_utils.hpp 681442 2024-04-09 14:53:56Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -378,7 +378,7 @@ if ((o).IsSet##x()) { \ CRef ReadLocFromText(const string& text, const CSeq_id *id, CScope *scope); // for finding the correct amino acid letter given an abbreviation -char NCBI_CLEANUP_EXPORT ValidAminoAcid (const string& abbrev); +char x_ValidAminoAcid(string_view abbrev); // for sorting and uniquing dbtags bool s_DbtagCompare (const CRef& dbt1, const CRef& dbt2); diff --git a/c++/src/objtools/cleanup/huge_file_cleanup.cpp b/c++/src/objtools/cleanup/huge_file_cleanup.cpp deleted file mode 100644 index 2bb6d3ac..00000000 --- a/c++/src/objtools/cleanup/huge_file_cleanup.cpp +++ /dev/null @@ -1,799 +0,0 @@ -/* $Id: huge_file_cleanup.cpp 664176 2023-03-08 20:23:24Z foleyjp $ -* =========================================================================== -* -* PUBLIC DOMAIN NOTICE -* National Center for Biotechnology Information -* -* This software/database is a "United States Government Work" under the -* terms of the United States Copyright Act. It was written as part of -* the author's official duties as a United States Government employee and -* thus cannot be copyrighted. This software/database is freely available -* to the public for use. The National Library of Medicine and the U.S. -* Government have not placed any restriction on its use or reproduction. -* -* Although all reasonable efforts have been taken to ensure the accuracy -* and reliability of the software and data, the NLM and the U.S. -* Government do not and cannot warrant the performance or results that -* may be obtained by using this software or data. The NLM and the U.S. -* Government disclaim all warranties, express or implied, including -* warranties of performance, merchantability or fitness for any particular -* purpose. -* -* Please cite the author in any work or product based on this material. -* -* =========================================================================== -* -* Author: Justin Foley -* File Description: -* -*/ -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "newcleanupp.hpp" -#include "influenza_set.hpp" - -BEGIN_NCBI_SCOPE - -BEGIN_SCOPE(objects) -USING_SCOPE(edit); - - -CCleanupHugeAsnReader::CCleanupHugeAsnReader(TOptions options) -: m_CleanupOptions(options) {} - - -const CCleanupChangeCore& CCleanupHugeAsnReader::GetChanges() const -{ - return m_Changes; -} - - -void CCleanupHugeAsnReader::FlattenGenbankSet() -{ - auto& biosets = m_bioseq_set_list; - if (biosets.size()>1) { - auto firstTrueBioset = next(biosets.begin()); - if (firstTrueBioset->m_class == CBioseq_set::eClass_not_set) { - if (x_LooksLikeNucProtSet()) { - firstTrueBioset->m_class = CBioseq_set::eClass_nuc_prot; - } - else { - firstTrueBioset->m_class = CBioseq_set::eClass_genbank; - } - m_Changes.SetChanged(CCleanupChange::eChangeBioseqSetClass); - } - } - TParent::FlattenGenbankSet(); - x_CleanupTopLevelDescriptors(); - - if (m_CleanupOptions & eEnableSmallGenomeSets) { - x_CreateSmallGenomeSets(); - x_PruneAndReorderTopIds(); - } -} - -void CCleanupHugeAsnReader::x_PruneAndReorderTopIds() -{ // Needed when wrapping influenza sequences in small-genome sets - map> smallGenomeLabelToId; - - auto it = m_top_ids.begin(); - while (it != m_top_ids.end()) { - if (auto mit = x_GetFluLabel(*it); - mit != m_IdToFluLabel.end()) { - if (smallGenomeLabelToId.find(mit->second) - == smallGenomeLabelToId.end()) { - smallGenomeLabelToId.emplace(mit->second, *it); - } - it = m_top_ids.erase(it); - continue; - } - ++it; - } - - for (auto entry : smallGenomeLabelToId) { - m_top_ids.push_back(entry.second); - } -} - - -bool CCleanupHugeAsnReader::x_LooksLikeNucProtSet() const -{ - int numNucs{0}; - int numProts{0}; - for (const auto& bioseq : GetBioseqs()) { - if (CSeq_inst::IsNa(bioseq.m_mol)) { - ++numNucs; - if (numNucs>1) { - return false; - } - } - else if (CSeq_inst::IsAa(bioseq.m_mol)) { - ++numProts; - } - } - if (numProts==0) { - return false; - } - - _ASSERT(m_bioseq_set_list.size()>1); - // check for invalid subsets - auto it = next(m_bioseq_set_list.begin(),2); - while (it != m_bioseq_set_list.end()) { - if (it->m_class != CBioseq_set::eClass_segset && - it->m_class != CBioseq_set::eClass_parts) { - return false; - } - ++it; - } - return true; -} - - -bool CCleanupHugeAsnReader::x_IsExtendedCleanup() const -{ - return (m_CleanupOptions & eExtendedCleanup); -} - - -void CCleanupHugeAsnReader::x_CleanupTopLevelDescriptors() -{ - - m_TopLevelBiosources.clear(); - m_pTopLevelMolInfo.Reset(); - - - if (!m_top_entry || - !m_top_entry->IsSetDescr() || - !m_top_entry->GetDescr().IsSet()) { - return; - } - - CCleanup cleanup; - m_Changes += *cleanup.BasicCleanup(m_top_entry->SetDescr()); - - if (!x_IsExtendedCleanup()) { - return; - } - - auto& descriptors = m_top_entry->SetDescr().Set(); - auto it = descriptors.begin(); - while (it != descriptors.end()) { - if (it->Empty()) { - it = descriptors.erase(it); - } - else if ((*it)->IsSource()) { - m_TopLevelBiosources.push_back(*it); - it = descriptors.erase(it); - m_Changes.SetChanged(CCleanupChange::eAddDescriptor); - m_Changes.SetChanged(CCleanupChange::eRemoveDescriptor); - } - else if ((*it)->IsMolinfo()) { - if (!m_pTopLevelMolInfo) { - m_pTopLevelMolInfo.Reset(&(**it)); - } - it = descriptors.erase(it); - m_Changes.SetChanged(CCleanupChange::eRemoveDescriptor); - } else { - ++it; - } - } - - if (!(m_CleanupOptions & eNoNcbiUserObjects)) { - CNewCleanup_imp::AddNcbiCleanupObject(m_top_entry->SetDescr()); - m_Changes.SetChanged(CCleanupChange::eAddNcbiCleanupObject); - } - - - if (descriptors.empty()) { - m_top_entry->SetSet().ResetDescr(); - } - else if (CCleanup::NormalizeDescriptorOrder(m_top_entry->SetDescr())) { - m_Changes.SetChanged(CCleanupChange::eMoveDescriptor); - } -} - - -void CCleanupHugeAsnReader::x_AddTopLevelDescriptors(CSeq_entry& entry) const -{ - if ((!x_IsExtendedCleanup()) || - (m_TopLevelBiosources.empty() && m_pTopLevelMolInfo.Empty())) { - return; - } - - bool addMolInfo = false; - if (m_pTopLevelMolInfo && - entry.IsSetDescr() && - entry.GetDescr().IsSet()) { - const auto& descriptors = entry.GetDescr().Get(); - auto it = find_if(descriptors.begin(), descriptors.end(), - [](const CRef& pDesc) { - return (pDesc && pDesc->IsMolinfo()); - }); - if (it == descriptors.end()) { - addMolInfo = true; - } - } - - for (auto pSource : m_TopLevelBiosources) { - entry.SetDescr().Set().push_back(pSource); - } - - if (addMolInfo) { - entry.SetDescr().Set().push_back(m_pTopLevelMolInfo); - m_Changes.SetChanged(CCleanupChange::eAddDescriptor); - } -} - - -using TFeatIdMap = map; - - -static void s_UpdateFeatureId(CFeat_id& featId, const TFeatIdMap& idMap) -{ - if (!featId.IsLocal() || !featId.GetLocal().IsId()) { - return; - } - const auto id = featId.GetLocal().GetId(); - if (auto it=idMap.find(id); it != idMap.end()) { - featId.SetLocal().SetId() = it->second; - } -} - - -static void s_UpdateFeatureIds(CSeq_feat& feat, const TFeatIdMap& idMap) -{ - if (feat.IsSetId()) { - s_UpdateFeatureId(feat.SetId(), idMap); - } - - if (feat.IsSetIds()) { - for (auto pFeatId : feat.SetIds()) { - if (pFeatId) { - s_UpdateFeatureId(*pFeatId, idMap); - } - } - } - - if (feat.IsSetXref()) { - for (auto pXref : feat.SetXref()) { - if (pXref && pXref->IsSetId()) { - s_UpdateFeatureId(pXref->SetId(), idMap); - } - } - } -} - - -static void s_UpdateFeatureIds(CSeq_annot& annot, const TFeatIdMap& idMap) -{ - if (!annot.IsFtable()) { - return; - } - - for (auto pSeqFeat : annot.SetData().SetFtable()) { - if (pSeqFeat) { - s_UpdateFeatureIds(*pSeqFeat, idMap); - } - } -} - - -static void s_UpdateFeatureIds(CBioseq& bioseq, const TFeatIdMap& idMap) { - if (!bioseq.IsSetAnnot()) { - return; - } - - for (auto pAnnot : bioseq.SetAnnot()) { - if (pAnnot) { - s_UpdateFeatureIds(*pAnnot, idMap); - } - } -} - - -static void s_UpdateFeatureIds(CBioseq_set& bioseqSet, const TFeatIdMap& idMap) -{ - if (bioseqSet.IsSetAnnot()) { - for (auto pAnnot : bioseqSet.SetAnnot()) { - if (pAnnot) { - s_UpdateFeatureIds(*pAnnot, idMap); - } - } - } - - if (bioseqSet.IsSetSeq_set()) { - for (auto pSubEntry : bioseqSet.SetSeq_set()) { - if (pSubEntry) { - if (pSubEntry->IsSeq()) { - s_UpdateFeatureIds(pSubEntry->SetSeq(), idMap); - } - else { - s_UpdateFeatureIds(pSubEntry->SetSet(), idMap); - } - } - } - } -} - - - -static void s_UpdateFeatureIds(CSeq_entry& entry, const TFeatIdMap& idMap) -{ - if (entry.IsSeq()) { - s_UpdateFeatureIds(entry.SetSeq(), idMap); - } - else { - s_UpdateFeatureIds(entry.SetSet(), idMap); - } -} - - -CRef CCleanupHugeAsnReader::LoadSeqEntry( - const TBioseqSetInfo& info, - eAddTopEntry add_top_entry) const -{ - if (m_CleanupOptions & eEnableSmallGenomeSets) { - auto it = m_SetPosToFluLabel.find(info.m_pos); - if (it != m_SetPosToFluLabel.end()) { - auto pSmallGenomeEntry = Ref(new CSeq_entry()); - pSmallGenomeEntry->SetSet().SetClass() = CBioseq_set::eClass_small_genome_set; - for (const auto& setInfo : m_FluLabelToSetInfo.at(it->second)) { - auto pSubEntry = TParent::LoadSeqEntry(setInfo, eAddTopEntry::no); - - if (x_IsExtendedCleanup()) { - if (auto posIt = m_FeatIdInfo.PosToIdMap.find(setInfo.m_pos); - posIt != m_FeatIdInfo.PosToIdMap.end()) { - s_UpdateFeatureIds(*pSubEntry, posIt->second); - } - } - pSmallGenomeEntry->SetSet().SetSeq_set().push_back(pSubEntry); - } - if (add_top_entry == eAddTopEntry::yes) { - x_AddTopLevelDescriptors(*pSmallGenomeEntry); - } - return pSmallGenomeEntry; - } - } - - auto pEntry = TParent::LoadSeqEntry(info, eAddTopEntry::no); - if (add_top_entry == eAddTopEntry::yes) { - x_AddTopLevelDescriptors(*pEntry); - } - - if (x_IsExtendedCleanup()) { - if (auto posIt = m_FeatIdInfo.PosToIdMap.find(info.m_pos); - posIt != m_FeatIdInfo.PosToIdMap.end()) { - s_UpdateFeatureIds(*pEntry, posIt->second); - } - } - - - return pEntry; -} - - -static string s_GetInfluenzaLabel(const CSeq_descr& descr) -{ - if (descr.IsSet()) { - for (const auto& pDesc : descr.Get()) { - if (pDesc->IsSource()) { - const auto& source = pDesc->GetSource(); - if (source.IsSetOrg()) { - auto key = CInfluenzaSet::GetKey(source.GetOrg()); - if (!NStr::IsBlank(key)) { - return key; - } - } - } - } - } - return ""; -} - - -template -static void s_RemoveEntriesWithVal(const string& val, TMap& mapToVal) -{ - if (mapToVal.empty()) { - return; - } - - auto it = mapToVal.begin(); - while (it != mapToVal.end()) { - if (it->second == val) { - it = mapToVal.erase(it); - } else { - ++it; - } - } -} - - -static bool s_CheckForSegments(CConstRef seqDescrs, - CConstRef setDescrs, - const string& fluLabel, - set& segments) -{ - if (NStr::IsBlank(fluLabel)) { - return false; - } - auto fluType = CInfluenzaSet::GetInfluenzaType(fluLabel); - if (fluType == CInfluenzaSet::eNotInfluenza) { - return false; - } - - auto numRequired = CInfluenzaSet::GetNumRequired(fluType); - - if (seqDescrs && seqDescrs->IsSet()) { - for (auto pDesc : seqDescrs->Get()) { - if (pDesc->IsSource()) { - return g_FindSegs(pDesc->GetSource(), numRequired, segments); - } - } - } - - if (setDescrs && setDescrs->IsSet()) { - for (auto pDesc : setDescrs->Get()) { - if (pDesc->IsSource()) { - return g_FindSegs(pDesc->GetSource(), numRequired, segments); - } - } - } - return false; -} - - -static bool s_IdInSet(const CConstRef& pId, - const set, CHugeAsnReader::CRefLess>& idSet) -{ - auto it = idSet.lower_bound(pId); - if (it != idSet.end()) { - if ((*it)->CompareOrdered(*pId) == 0 || - (*it)->Compare(*pId) == CSeq_id::E_SIC::e_YES) { - return true; - } - } - return false; -} - - -void CCleanupHugeAsnReader::x_CreateSmallGenomeSets() -{ - map> fluLabelToSegs; - CConstRef pNpSetDescr; - for (const auto& bioseqInfo : GetBioseqs()) { - if (!CSeq_inst::IsNa(bioseqInfo.m_mol)) { - continue; - } - auto parent = bioseqInfo.m_parent_set; - if (parent->m_class == CBioseq_set::eClass_nuc_prot) { - pNpSetDescr = parent->m_descr; - parent = parent->m_parent_set; - } - if (!IsHugeSet(parent->m_class)) { - continue; - } - string fluLabel; - if (bioseqInfo.m_descr) { - fluLabel = s_GetInfluenzaLabel(*(bioseqInfo.m_descr)); - if (NStr::IsBlank(fluLabel) && pNpSetDescr) { - fluLabel = s_GetInfluenzaLabel(*pNpSetDescr); - } - } - if (!NStr::IsBlank(fluLabel)) { - bool makeSmallGenomeSet = - s_CheckForSegments(bioseqInfo.m_descr, pNpSetDescr, fluLabel, fluLabelToSegs[fluLabel]); - - if (makeSmallGenomeSet) { - const auto& setInfo = *FindTopObject(bioseqInfo.m_ids.front()); - m_FluLabelToSetInfo[fluLabel].push_back(setInfo); - m_SetPosToFluLabel[setInfo.m_pos] = fluLabel; - for (auto pId : bioseqInfo.m_ids) { - m_IdToFluLabel[pId] = fluLabel; - } - } - } - } - - // Prune if there are missing segments - for (const auto& entry : fluLabelToSegs) { - const auto& fluLabel = entry.first; - const auto& segsFound = entry.second; - x_PruneIfSegsMissing(fluLabel, segsFound); - }; - x_PruneIfFeatsIncomplete(); -} - - - -void CCleanupHugeAsnReader::x_PruneIfSegsMissing(const string& fluLabel, const set& segsFound) -{ - if (auto it = m_FluLabelToSetInfo.find(fluLabel); it != m_FluLabelToSetInfo.end()) { - auto fluType = CInfluenzaSet::GetInfluenzaType(fluLabel); - auto numRequired = CInfluenzaSet::GetNumRequired(fluType); - if (segsFound.size() != numRequired) { - m_FluLabelToSetInfo.erase(it); - s_RemoveEntriesWithVal(fluLabel, m_SetPosToFluLabel); - s_RemoveEntriesWithVal(fluLabel, m_IdToFluLabel); - } - } -} - - -void CCleanupHugeAsnReader::x_PruneIfFeatsIncomplete() -{ - // Prune if any of the sequences has incomplete cdregion or gene feats - auto it = m_IdToFluLabel.begin(); - set fluLabelsToRemove; - while (it != m_IdToFluLabel.end()) { - if (s_IdInSet(it->first, m_HasIncompleteFeats)) { - auto fluLabel = it->second; - fluLabelsToRemove.insert(fluLabel); - s_RemoveEntriesWithVal(fluLabel, m_SetPosToFluLabel); - if (auto fluLabelIt = m_FluLabelToSetInfo.find(fluLabel); fluLabelIt != m_FluLabelToSetInfo.end()) { - m_FluLabelToSetInfo.erase(fluLabelIt); - } - it = m_IdToFluLabel.erase(it); - } - else { - ++it; - } - } - - for (const auto& fluLabel : fluLabelsToRemove) { - s_RemoveEntriesWithVal(fluLabel, m_IdToFluLabel); - } -} - - - -CCleanupHugeAsnReader::TIdToFluLabel::iterator -CCleanupHugeAsnReader::x_GetFluLabel(const CConstRef& pId) -{ - auto it = m_IdToFluLabel.lower_bound(pId); - if (it != m_IdToFluLabel.end()) { - if (it->first->CompareOrdered(*pId) == 0 || - it->first->Compare(*pId) == CSeq_id::E_SIC::e_YES) { - return it; - } - } - return m_IdToFluLabel.end(); -} - - -using TFeatIdSet = set; - - -static void s_FindNextOffset(const TFeatIdSet &existing_ids, - const TFeatIdSet &new_existing_ids, - const TFeatIdSet ¤t_ids, - CCleanupHugeAsnReader::TFeatId &offset) -{ - do - { - ++offset; - } while(existing_ids.find(offset) != existing_ids.end() || - new_existing_ids.find(offset) != new_existing_ids.end() || - current_ids.find(offset) != current_ids.end()); -} - - -void CCleanupHugeAsnReader::x_RecordFeatureId(const CFeat_id& featId) -{ - if (!featId.IsLocal() || !featId.GetLocal().IsId()) { - return; - } - - const auto id = featId.GetLocal().GetId(); - - if (m_FeatIdInfo.ExistingIds.find(id) != m_FeatIdInfo.ExistingIds.end() || - m_FeatIdInfo.NewIds.find(id) != m_FeatIdInfo.NewIds.end()) { - auto it = m_FeatIdInfo.RemappedIds.find(id); - if (it != m_FeatIdInfo.RemappedIds.end()) { - m_FeatIdInfo.IdOffset = it->second; - } - else { - s_FindNextOffset(m_FeatIdInfo.ExistingIds, m_FeatIdInfo.NewExistingIds, m_FeatIdInfo.NewIds, m_FeatIdInfo.IdOffset); - m_FeatIdInfo.RemappedIds.emplace(id, m_FeatIdInfo.IdOffset); - } - m_FeatIdInfo.NewIds.insert(m_FeatIdInfo.IdOffset); - } - else { - m_FeatIdInfo.NewExistingIds.insert(id); - } -} - - -void CCleanupHugeAsnReader::x_SetBioseqHooks(CObjectIStream& objStream, TContext& context) -{ - CObjectTypeInfo bioseq_info = CType(); - - SetLocalSkipHook(bioseq_info, objStream, - [this, &context](CObjectIStream& in, const CObjectTypeInfo& type) - { - auto pos = in.GetStreamPos() + m_next_pos; - context.bioseq_stack.push_back({}); - - auto parent = context.bioseq_set_stack.back(); - const bool hasGenbankParent = (parent->m_class == CBioseq_set::eClass_genbank); - if (hasGenbankParent) { - m_FeatIdInfo.NewIds.clear(); - m_FeatIdInfo.NewExistingIds.clear(); - m_FeatIdInfo.RemappedIds.clear(); - } - - type.GetTypeInfo()->DefaultSkipData(in); - - auto& bioseqinfo = context.bioseq_stack.back(); - m_bioseq_list.push_back({pos, parent, bioseqinfo.m_length, bioseqinfo.m_descr, bioseqinfo.m_ids, bioseqinfo.m_mol, bioseqinfo.m_repr}); - context.bioseq_stack.pop_back(); - - if (x_IsExtendedCleanup() && hasGenbankParent) { - m_FeatIdInfo.ExistingIds.insert(m_FeatIdInfo.NewExistingIds.begin(), m_FeatIdInfo.NewExistingIds.end()); - m_FeatIdInfo.ExistingIds.insert(m_FeatIdInfo.NewIds.begin(), m_FeatIdInfo.NewIds.end()); - if (!m_FeatIdInfo.RemappedIds.empty()) { - m_FeatIdInfo.PosToIdMap.emplace(pos, m_FeatIdInfo.RemappedIds); - } - } - - }); -} - - -void CCleanupHugeAsnReader::x_SetBioseqSetHooks(CObjectIStream& objStream, TContext& context) -{ - CObjectTypeInfo bioseq_set_info = CType(); - - SetLocalSkipHook(bioseq_set_info, objStream, - [this, &context](CObjectIStream& in, const CObjectTypeInfo& type) - { - auto pos = in.GetStreamPos() + m_next_pos; - auto parent = context.bioseq_set_stack.back(); - const bool hasGenbankParent = (parent->m_class == CBioseq_set::eClass_genbank); - if (hasGenbankParent) { - m_FeatIdInfo.NewIds.clear(); - m_FeatIdInfo.NewExistingIds.clear(); - m_FeatIdInfo.RemappedIds.clear(); - } - - m_bioseq_set_list.push_back({pos, parent}); - - auto last = prev(m_bioseq_set_list.end()); - - context.bioseq_set_stack.push_back(last); - - CObjectInfo objectInfo(type.GetTypeInfo()); - for (CIStreamClassMemberIterator it(in, type.GetTypeInfo()); it; ++it) { - it.ReadClassMember(objectInfo); - if ((*it).GetAlias() == "class") { - auto memIdx = (*it).GetMemberIndex(); - CObjectInfo memberInfo = CObjectInfoMI(objectInfo, memIdx).GetMember(); - last->m_class = *CTypeConverter::SafeCast(memberInfo.GetObjectPtr()); - } - } - - auto* pBioseqSet = CTypeConverter::SafeCast(objectInfo.GetObjectPtr()); - - if (pBioseqSet->IsSetLevel()) { - last->m_Level = pBioseqSet->GetLevel(); - } - - if (pBioseqSet->IsSetDescr()) { - last->m_descr.Reset(&(pBioseqSet->GetDescr())); - } - - if (IsHugeSet(last->m_class) && - last->m_HasAnnot) { - m_HasHugeSetAnnot = true; - } - - context.bioseq_set_stack.pop_back(); - - if (x_IsExtendedCleanup() && hasGenbankParent) { - m_FeatIdInfo.ExistingIds.insert(m_FeatIdInfo.NewExistingIds.begin(), m_FeatIdInfo.NewExistingIds.end()); - m_FeatIdInfo.ExistingIds.insert(m_FeatIdInfo.NewIds.begin(), m_FeatIdInfo.NewIds.end()); - if (!m_FeatIdInfo.RemappedIds.empty()) { - m_FeatIdInfo.PosToIdMap.emplace(pos, m_FeatIdInfo.RemappedIds); - } - } - }); -} - - -void CCleanupHugeAsnReader::x_SetSeqFeatHooks(CObjectIStream& objStream, TContext& context) -{ - - SetLocalReadHook(CType(), objStream, - [this](CObjectIStream& in, const CObjectInfo& object) - { - auto* pObject = object.GetObjectPtr(); - object.GetTypeInfo()->DefaultReadData(in, pObject); - - if (!x_IsExtendedCleanup()) { - return; - } - - auto* pSeqFeat = CTypeConverter::SafeCast(pObject); - - if (pSeqFeat->IsSetId()) { - x_RecordFeatureId(pSeqFeat->GetId()); - } - - if (pSeqFeat->IsSetIds()) { - for (auto pFeatId : pSeqFeat->GetIds()) { - if (pFeatId) { - x_RecordFeatureId(*pFeatId); - } - } - } - }); - - - SetLocalSkipHook(CType(), objStream, - [this](CObjectIStream& in, const CObjectTypeInfo& type) - { - auto pSeqFeat = Ref(new CSeq_feat()); - type.GetTypeInfo()->DefaultReadData(in, pSeqFeat); - - if (x_IsExtendedCleanup()) { - if (pSeqFeat->IsSetId()) { - x_RecordFeatureId(pSeqFeat->GetId()); - } - - if (pSeqFeat->IsSetIds()) { - for (auto pFeatId : pSeqFeat->GetIds()) { - if (pFeatId) { - x_RecordFeatureId(*pFeatId); - } - } - } - } - - - if (!(m_CleanupOptions & eEnableSmallGenomeSets)) { - return; - } - - if (pSeqFeat->IsSetData() && - (pSeqFeat->GetData().IsCdregion() || - pSeqFeat->GetData().IsGene())) { - if (pSeqFeat->GetLocation().IsPartialStart(eExtreme_Biological) || - pSeqFeat->GetLocation().IsPartialStop(eExtreme_Biological)) { - const auto* pSeqId = pSeqFeat->GetLocation().GetId(); - if (pSeqId) { - CConstRef pConstId(pSeqId); - m_HasIncompleteFeats.insert(pConstId); - } - } - } - }); - - -} - - - - -void CCleanupHugeAsnReader::x_SetHooks(CObjectIStream& objStream, TContext& context) -{ - TParent::x_SetHooks(objStream, context); - - x_SetSeqFeatHooks(objStream, context); -} - - -END_SCOPE(objects) -END_NCBI_SCOPE diff --git a/c++/src/objtools/cleanup/influenza_set.cpp b/c++/src/objtools/cleanup/influenza_set.cpp index 2c5b2b15..56953e4e 100644 --- a/c++/src/objtools/cleanup/influenza_set.cpp +++ b/c++/src/objtools/cleanup/influenza_set.cpp @@ -1,4 +1,4 @@ -/* $Id: influenza_set.cpp 661577 2023-01-13 18:43:15Z foleyjp $ +/* $Id: influenza_set.cpp 680750 2024-03-27 13:48:22Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -30,7 +30,7 @@ */ #include #include -#include "influenza_set.hpp" +#include #include #include diff --git a/c++/src/objtools/cleanup/newcleanupp.cpp b/c++/src/objtools/cleanup/newcleanupp.cpp index 38b991c7..71f2cd24 100644 --- a/c++/src/objtools/cleanup/newcleanupp.cpp +++ b/c++/src/objtools/cleanup/newcleanupp.cpp @@ -1,35 +1,35 @@ /* -* =========================================================================== -* -* PUBLIC DOMAIN NOTICE -* National Center for Biotechnology Information -* -* This software/database is a "United States Government Work" under the -* terms of the United States Copyright Act. It was written as part of -* the author's official duties as a United States Government employee and -* thus cannot be copyrighted. This software/database is freely available -* to the public for use. The National Library of Medicine and the U.S. -* Government have not placed any restriction on its use or reproduction. -* -* Although all reasonable efforts have been taken to ensure the accuracy -* and reliability of the software and data, the NLM and the U.S. -* Government do not and cannot warrant the performance or results that -* may be obtained by using this software or data. The NLM and the U.S. -* Government disclaim all warranties, express or implied, including -* warranties of performance, merchantability or fitness for any particular -* purpose. -* -* Please cite the author in any work or product based on this material. -* -* =========================================================================== -* -* Author: Robert Smith, Jonathan Kans, Michael Kornbluh -* -* File Description: -* Basic and Extended Cleanup of CSeq_entries, etc. -* -* =========================================================================== -*/ + * =========================================================================== + * + * PUBLIC DOMAIN NOTICE + * National Center for Biotechnology Information + * + * This software/database is a "United States Government Work" under the + * terms of the United States Copyright Act. It was written as part of + * the author's official duties as a United States Government employee and + * thus cannot be copyrighted. This software/database is freely available + * to the public for use. The National Library of Medicine and the U.S. + * Government have not placed any restriction on its use or reproduction. + * + * Although all reasonable efforts have been taken to ensure the accuracy + * and reliability of the software and data, the NLM and the U.S. + * Government do not and cannot warrant the performance or results that + * may be obtained by using this software or data. The NLM and the U.S. + * Government disclaim all warranties, express or implied, including + * warranties of performance, merchantability or fitness for any particular + * purpose. + * + * Please cite the author in any work or product based on this material. + * + * =========================================================================== + * + * Author: Robert Smith, Jonathan Kans, Michael Kornbluh + * + * File Description: + * Basic and Extended Cleanup of CSeq_entries, etc. + * + * =========================================================================== + */ // All this functionality is packed into this one file for ease of // searching. If it gets big enough, it will be broken up in the future. @@ -86,8 +86,8 @@ BEGIN_SCOPE(objects) // we prefer our own version #define CompressSpaces x_CompressSpaces -namespace { - +namespace +{ // a CRegexp that has lock and unlock methods, // and also inherits from CObject class CRegexpWithLock : public CObject, public CRegexp { @@ -419,8 +419,6 @@ void CNewCleanup_imp::BasicCleanup(CSeqdesc& desc) } - - // Implementation methods void CNewCleanup_imp::SetGeneticCode ( @@ -464,21 +462,21 @@ void CNewCleanup_imp::EnteringEntry ( // for cleanup Seq-entry and Seq-submit, set scope and parentize. // We use exceptions for AddTopLevelSeqEntry because we need to detect // if we've already processed the given Seq-entry. - {{ - CSeq_entry_Handle seh = - m_Scope->GetSeq_entryHandle(se, CScope::eMissing_Null); - if (seh) { + { + CSeq_entry_Handle seh = + m_Scope->GetSeq_entryHandle(se, CScope::eMissing_Null); + if (seh) { #if 0 - // all code paths in this function must result - // in m_SeqEntryInfoStack getting a "push" - m_SeqEntryInfoStack.push( m_SeqEntryInfoStack.top() ); + // all code paths in this function must result + // in m_SeqEntryInfoStack getting a "push" + m_SeqEntryInfoStack.push( m_SeqEntryInfoStack.top() ); #endif - return; - } + return; + } - m_Scope->AddTopLevelSeqEntry (se); - se.Parentize(); - }} + m_Scope->AddTopLevelSeqEntry(se); + se.Parentize(); + } #if 0 // a few differences based on sequence identifier type @@ -489,42 +487,42 @@ void CNewCleanup_imp::EnteringEntry ( FOR_EACH_SEQID_ON_BIOSEQ (sid_itr, bs) { const CSeq_id& sid = **sid_itr; SWITCH_ON_SEQID_CHOICE (sid) { - case NCBI_SEQID(Genbank): - case NCBI_SEQID(Tpg): - { - const CTextseq_id& tsid = *GET_FIELD (sid, Textseq_Id); - if (FIELD_IS_SET (tsid, Accession)) { - const string& acc = GET_FIELD (tsid, Accession); - if (acc.length() == 6) { - seqEntryInfo.m_StripSerial = false; - } + case NCBI_SEQID(Genbank): + case NCBI_SEQID(Tpg): + { + const CTextseq_id& tsid = *GET_FIELD (sid, Textseq_Id); + if (FIELD_IS_SET (tsid, Accession)) { + const string& acc = GET_FIELD (tsid, Accession); + if (acc.length() == 6) { + seqEntryInfo.m_StripSerial = false; } } - break; - case NCBI_SEQID(Embl): - case NCBI_SEQID(Ddbj): - seqEntryInfo.m_StripSerial = false; - seqEntryInfo.m_IsEmblOrDdbj = true; - break; - case NCBI_SEQID(not_set): - case NCBI_SEQID(Local): - case NCBI_SEQID(Other): - case NCBI_SEQID(General): - break; - case NCBI_SEQID(Gibbsq): - case NCBI_SEQID(Gibbmt): - case NCBI_SEQID(Pir): - case NCBI_SEQID(Swissprot): - case NCBI_SEQID(Patent): - case NCBI_SEQID(Prf): - case NCBI_SEQID(Pdb): - case NCBI_SEQID(Gpipe): - case NCBI_SEQID(Tpe): - case NCBI_SEQID(Tpd): - seqEntryInfo.m_StripSerial = false; - break; - default: - break; + } + break; + case NCBI_SEQID(Embl): + case NCBI_SEQID(Ddbj): + seqEntryInfo.m_StripSerial = false; + seqEntryInfo.m_IsEmblOrDdbj = true; + break; + case NCBI_SEQID(not_set): + case NCBI_SEQID(Local): + case NCBI_SEQID(Other): + case NCBI_SEQID(General): + break; + case NCBI_SEQID(Gibbsq): + case NCBI_SEQID(Gibbmt): + case NCBI_SEQID(Pir): + case NCBI_SEQID(Swissprot): + case NCBI_SEQID(Patent): + case NCBI_SEQID(Prf): + case NCBI_SEQID(Pdb): + case NCBI_SEQID(Gpipe): + case NCBI_SEQID(Tpe): + case NCBI_SEQID(Tpd): + seqEntryInfo.m_StripSerial = false; + break; + default: + break; } } } @@ -533,10 +531,7 @@ void CNewCleanup_imp::EnteringEntry ( #endif } -void CNewCleanup_imp::LeavingEntry ( - CSeq_entry& se -) - +void CNewCleanup_imp::LeavingEntry(CSeq_entry&) { #if 0 m_SeqEntryInfoStack.pop(); @@ -560,30 +555,6 @@ void CNewCleanup_imp::x_RemoveSpacesBetweenTildesMarkChanged( std::string & str } } -void CNewCleanup_imp::X_CommentTildeFixes(std::string & str) -{ -/* -#ifndef NCBI_OS_MSWIN - string orig = str; - NStr::ReplaceInPlace(str, "based on SOLiD3 (Applied Biosystems)~~", "based on SOLiD3 (Applied Biosystems)", false, false); - NStr::ReplaceInPlace(str, "Biological resourse center, NITE (NRBC)~~", "Biological resourse center, NITE (NRBC)", false, false); - NStr::ReplaceInPlace(str, "developmental01.html~~", "developmental01.html", false, false); - NStr::ReplaceInPlace(str, "http://bionano.toyo.ac.jp/~~", "http://bionano.toyo.ac.jp/", false, false); - NStr::ReplaceInPlace(str, "http://dictycdb1.biol.tsukuba.ac.jp/acytodb/~~", "http://dictycdb1.biol.tsukuba.ac.jp/acytodb/", false, false); - NStr::ReplaceInPlace(str, "http://egg.umh.es~~", "http://egg.umh.es", false, false); - NStr::ReplaceInPlace(str, "http://www.aist.go.jp/~~", "http://www.aist.go.jp/", false, false); - NStr::ReplaceInPlace(str, "http://www.bio.nite.go.jp/~~", "http://www.bio.nite.go.jp/", false, false); - NStr::ReplaceInPlace(str, "http://www.bio.nite.go.jp/ngac/e/~~", "http://www.bio.nite.go.jp/ngac/e/", false, false); - NStr::ReplaceInPlace(str, "http://www.brs.kyushu-u.ac.jp/~fcmic/~~", "http://www.brs.kyushu-u.ac.jp/~fcmic/", false, false); - NStr::ReplaceInPlace(str, "http://www.miyazaki-u.ac.jp/ir/english/index.html~~", "http://www.miyazaki-u.ac.jp/ir/english/index.html", false, false); - NStr::ReplaceInPlace(str, "URL:http://www.bio.nite.go.jp/ngac/e/~~", "URL:http://www.bio.nite.go.jp/ngac/e/", false, false); - if (!NStr::Equal(orig, str)) { - ChangeMade(CCleanupChange::eTrimSpaces); - } -#endif //NCBI_OS_MSWIN -*/ -} - void CNewCleanup_imp::x_TruncateSpacesMarkChanged( std::string & str ) { const size_t old_str_size = str.length(); @@ -638,12 +609,12 @@ static void s_ScanWhilePossibleNPSet(const CBioseq_set& bioseqSet, if (pSubEntry->IsSeq()) { s_IncrementSeqCount(pSubEntry->GetSeq(), num_nucs, num_prots); } else { - const auto& bioseqSet = pSubEntry->GetSet(); - if (!s_IsValidNPSubset(bioseqSet)) { + const auto& bioseqSet2 = pSubEntry->GetSet(); + if (! s_IsValidNPSubset(bioseqSet2)) { hasInvalidSubset = true; return; } - s_ScanWhilePossibleNPSet(bioseqSet, num_nucs, num_prots, hasInvalidSubset); + s_ScanWhilePossibleNPSet(bioseqSet2, num_nucs, num_prots, hasInvalidSubset); } if (num_nucs > 1) { return; @@ -908,46 +879,46 @@ const string &s_GenomeToPlastidName( const CBioSource& biosrc ) { SWITCH_ON_BIOSOURCE_GENOME (biosrc) { case NCBI_GENOME(apicoplast): - { - const static string apicoplast("apicoplast"); - return apicoplast; - } + { + const static string apicoplast("apicoplast"); + return apicoplast; + } break; case NCBI_GENOME(chloroplast): - { - const static string chloroplast("chloroplast"); - return chloroplast; - } + { + const static string chloroplast("chloroplast"); + return chloroplast; + } break; case NCBI_GENOME(chromoplast): - { - const static string chromoplast("chromoplast"); - return chromoplast; - } + { + const static string chromoplast("chromoplast"); + return chromoplast; + } break; case NCBI_GENOME(kinetoplast): - { - const static string kinetoplast("kinetoplast"); - return kinetoplast; - } + { + const static string kinetoplast("kinetoplast"); + return kinetoplast; + } break; case NCBI_GENOME(leucoplast): - { - const static string leucoplast("leucoplast"); - return leucoplast; - } + { + const static string leucoplast("leucoplast"); + return leucoplast; + } break; case NCBI_GENOME(plastid): - { - const static string plastid("plastid"); - return plastid; - } + { + const static string plastid("plastid"); + return plastid; + } break; case NCBI_GENOME(proplastid): - { - const static string proplastid("proplastid"); - return proplastid; - } + { + const static string proplastid("proplastid"); + return proplastid; + } break; default: return kEmptyStr; @@ -985,24 +956,24 @@ SIZE_TYPE s_MatchingParenPos( const string &str, SIZE_TYPE open_paren_pos ) SIZE_TYPE pos = open_paren_pos + 1; for( ; pos < str.length(); ++pos ) { switch( str[pos] ) { - case '(': - // nesting deeper - ++level; - break; - case ')': - // closed a level of nesting - --level; - if( 0 == level ) { - // reached the top: we're closing the initial paren, - // so we return our position - return pos; - } - break; - default: - // ignore other characters. - // maybe in the future we'll handle ignoring parens in quotes or - // things like that. - break; + case '(': + // nesting deeper + ++level; + break; + case ')': + // closed a level of nesting + --level; + if( 0 == level ) { + // reached the top: we're closing the initial paren, + // so we return our position + return pos; + } + break; + default: + // ignore other characters. + // maybe in the future we'll handle ignoring parens in quotes or + // things like that. + break; } } return NPOS; @@ -1869,8 +1840,6 @@ void CNewCleanup_imp::x_PostBiosource( CBioSource& biosrc ) } - - static bool s_DbtagIsBad ( CDbtag& dbt ) @@ -2238,10 +2207,10 @@ void CNewCleanup_imp::DbtagBC ( CObject_id& oid = GET_MUTABLE (dbtag, Tag); if (FIELD_IS (oid, Id)) { - const string& db = dbtag.GetDb(); - if (NStr::EqualNocase (db, "HGNC") || NStr::EqualNocase (db, "VGNC") || NStr::EqualNocase (db, "MGI") ) { + const string& db2 = dbtag.GetDb(); + if (NStr::EqualNocase(db2, "HGNC") || NStr::EqualNocase(db2, "VGNC") || NStr::EqualNocase(db2, "MGI") ) { int val = dbtag.GetTag().GetId(); - string str = db + ":" + NStr::IntToString(val); + string str = db2 + ":" + NStr::IntToString(val); dbtag.SetTag().SetStr(str); ChangeMade(CCleanupChange::eChangeDbxrefs); } @@ -2344,7 +2313,7 @@ void CNewCleanup_imp::PubdescBC ( if (pubdesc.IsSetPub()) { for (auto p : pubdesc.SetPub().Set()) { string new_label; - p->GetLabel(&new_label, CPub::eContent, true); + p->GetLabel(&new_label, CPub::eContent, CPub::fLabel_Unique); m_PubToNewPubLabelMap[p] = new_label; } } @@ -2404,7 +2373,7 @@ void CNewCleanup_imp::PubSetBC( CPub_set &pub_set ) TCitSet cit_set; for (auto cit_it : pub_set.GetPub()) { string label; - cit_it->GetLabel(&label, CPub::eContent, CPub::fLabel_Unique, CPub::eLabel_V1 ); + cit_it->GetLabel(&label, CPub::eContent, CPub::fLabel_Unique, CPub::eLabel_V1); // the following line may fail due to dups // (that's okay; it lets us automatically remove dups) cit_set.insert( TCit(label, cit_it) ); @@ -2656,89 +2625,83 @@ void CNewCleanup_imp::SeqLocBC( CSeq_loc &loc ) case CSeq_loc::e_Int : x_SeqIntervalBC( GET_MUTABLE(loc, Int) ); break; - case CSeq_loc::e_Packed_int : - { - CSeq_loc::TPacked_int::Tdata& ints = loc.SetPacked_int().Set(); - NON_CONST_ITERATE(CSeq_loc::TPacked_int::Tdata, interval_it, ints) { - x_SeqIntervalBC(**interval_it); - } - if (ints.size() == 1) { - CRef int_ref = ints.front(); - loc.SetInt(*int_ref); - ChangeMade(CCleanupChange::eChangeSeqloc); - } - } - break; - case CSeq_loc::e_Pnt : - { - CSeq_loc::TPnt& pnt = loc.SetPnt(); - - if (pnt.IsSetStrand()) { - if (pnt.GetStrand() == eNa_strand_unknown) { - pnt.SetStrand(eNa_strand_plus); - ChangeMade(CCleanupChange::eChangeStrand); - } - } - else { + case CSeq_loc::e_Packed_int: { + CSeq_loc::TPacked_int::Tdata& ints = loc.SetPacked_int().Set(); + NON_CONST_ITERATE(CSeq_loc::TPacked_int::Tdata, interval_it, ints) { + x_SeqIntervalBC(**interval_it); + } + if (ints.size() == 1) { + CRef int_ref = ints.front(); + loc.SetInt(*int_ref); + ChangeMade(CCleanupChange::eChangeSeqloc); + } + } break; + case CSeq_loc::e_Pnt: { + CSeq_loc::TPnt& pnt = loc.SetPnt(); + + if (pnt.IsSetStrand()) { + if (pnt.GetStrand() == eNa_strand_unknown) { pnt.SetStrand(eNa_strand_plus); ChangeMade(CCleanupChange::eChangeStrand); } + } + else { + pnt.SetStrand(eNa_strand_plus); + ChangeMade(CCleanupChange::eChangeStrand); + } - // normalize Seq-point fuzz tl to tr and decrement position - if (pnt.IsSetFuzz() && pnt.GetFuzz().IsLim() && - pnt.GetFuzz().GetLim() == CInt_fuzz::eLim_tl) { - TSeqPos pos = pnt.GetPoint(); - if (pos > 0) { - pnt.SetFuzz().SetLim(CInt_fuzz::eLim_tr); - pnt.SetPoint(pos - 1); - ChangeMade(CCleanupChange::eChangeSeqloc); - } + // normalize Seq-point fuzz tl to tr and decrement position + if (pnt.IsSetFuzz() && pnt.GetFuzz().IsLim() && + pnt.GetFuzz().GetLim() == CInt_fuzz::eLim_tl) { + TSeqPos pos = pnt.GetPoint(); + if (pos > 0) { + pnt.SetFuzz().SetLim(CInt_fuzz::eLim_tr); + pnt.SetPoint(pos - 1); + ChangeMade(CCleanupChange::eChangeSeqloc); } } - break; - case CSeq_loc::e_Mix : - { - typedef CSeq_loc::TMix::Tdata TMixList; - // delete Null type Seq-locs from beginning and end of Mix list. - - // deleting from beginning: - TMixList& sl_list = loc.SetMix().Set(); - TMixList::iterator sl_it = sl_list.begin(); - while (sl_it != sl_list.end()) { - if ((*sl_it)->IsNull()) { - sl_it = sl_list.erase(sl_it); - ChangeMade(CCleanupChange::eChangeSeqloc); - } else { - break; - } + } break; + case CSeq_loc::e_Mix: { + typedef CSeq_loc::TMix::Tdata TMixList; + // delete Null type Seq-locs from beginning and end of Mix list. + + // deleting from beginning: + TMixList& sl_list = loc.SetMix().Set(); + TMixList::iterator sl_it = sl_list.begin(); + while (sl_it != sl_list.end()) { + if ((*sl_it)->IsNull()) { + sl_it = sl_list.erase(sl_it); + ChangeMade(CCleanupChange::eChangeSeqloc); + } else { + break; } + } - // deleting from end: - if( sl_list.size() > 0 ) { - sl_it = sl_list.end(); - while (sl_it != sl_list.begin()) { - --sl_it; - if ( ! (*sl_it)->IsNull()) { - break; - } - } - ++sl_it; - if (sl_it != sl_list.end()) { - sl_list.erase(sl_it, sl_list.end()); - ChangeMade(CCleanupChange::eChangeSeqloc); + // deleting from end: + if( sl_list.size() > 0 ) { + sl_it = sl_list.end(); + while (sl_it != sl_list.begin()) { + --sl_it; + if ( ! (*sl_it)->IsNull()) { + break; } } - - if (sl_list.size() == 0) { - loc.SetNull(); - ChangeMade(CCleanupChange::eChangeSeqloc); - } else if (sl_list.size() == 1) { - CRef only_sl = sl_list.front(); - loc.Assign(*only_sl); + ++sl_it; + if (sl_it != sl_list.end()) { + sl_list.erase(sl_it, sl_list.end()); ChangeMade(CCleanupChange::eChangeSeqloc); } } - break; + + if (sl_list.size() == 0) { + loc.SetNull(); + ChangeMade(CCleanupChange::eChangeSeqloc); + } else if (sl_list.size() == 1) { + CRef only_sl = sl_list.front(); + loc.Assign(*only_sl); + ChangeMade(CCleanupChange::eChangeSeqloc); + } + } break; default: break; } @@ -2759,7 +2722,6 @@ void CNewCleanup_imp::SeqLocBC( CSeq_loc &loc ) ChangeMade(CCleanupChange::eChangeStrand); } } - } void CNewCleanup_imp::ConvertSeqLocWholeToInt( CSeq_loc &loc ) @@ -3020,108 +2982,108 @@ const char *s_FindKeyFromFeatDefType( const CSeq_feat &feat ) const CSeqFeatData& fdata = feat.GetData(); switch (fdata.Which()) { - case NCBI_SEQFEAT(Gene): - return "Gene"; - case NCBI_SEQFEAT(Org): - return "Org"; - case NCBI_SEQFEAT(Cdregion): - return "CDS"; - case NCBI_SEQFEAT(Prot): - if(fdata.GetProt().IsSetProcessed() ) { - switch( feat.GetData().GetProt().GetProcessed() ) { - case NCBI_PROTREF(not_set): - return "Protein"; - case NCBI_PROTREF(preprotein): - return "proprotein"; - case NCBI_PROTREF(mature): - return "mat_peptide"; - case NCBI_PROTREF(signal_peptide): - return "sig_peptide"; - case NCBI_PROTREF(transit_peptide): - return "transit_peptide"; - case NCBI_PROTREF(propeptide): - return "propeptide"; - default: - return kFeatBad; - } + case NCBI_SEQFEAT(Gene): + return "Gene"; + case NCBI_SEQFEAT(Org): + return "Org"; + case NCBI_SEQFEAT(Cdregion): + return "CDS"; + case NCBI_SEQFEAT(Prot): + if(fdata.GetProt().IsSetProcessed() ) { + switch( feat.GetData().GetProt().GetProcessed() ) { + case NCBI_PROTREF(not_set): + return "Protein"; + case NCBI_PROTREF(preprotein): + return "proprotein"; + case NCBI_PROTREF(mature): + return "mat_peptide"; + case NCBI_PROTREF(signal_peptide): + return "sig_peptide"; + case NCBI_PROTREF(transit_peptide): + return "transit_peptide"; + case NCBI_PROTREF(propeptide): + return "propeptide"; + default: + return kFeatBad; } - return "Protein"; - case NCBI_SEQFEAT(Rna): - if(fdata.GetRna().IsSetType() ) { - const auto& rna = fdata.GetRna(); - switch (rna.GetType() ) - { - case NCBI_RNAREF(unknown): - return "misc_RNA"; // unknownrna mapped to otherrna - case NCBI_RNAREF(premsg): - return "precursor_RNA"; - case NCBI_RNAREF(mRNA): - return "mRNA"; - case NCBI_RNAREF(tRNA): - return "tRNA"; - case NCBI_RNAREF(rRNA): - return "rRNA"; - case NCBI_RNAREF(snRNA): - return "snRNA"; - case NCBI_RNAREF(scRNA): - return "scRNA"; - case NCBI_RNAREF(snoRNA): - return "snoRNA"; - case NCBI_RNAREF(ncRNA): - return "ncRNA"; - case NCBI_RNAREF(tmRNA): - return "tmRNA"; - case NCBI_RNAREF(miscRNA): - return "misc_RNA"; - case NCBI_RNAREF(other): - if ( FIELD_IS_SET_AND_IS(rna, Ext, Name) ) { - const string &name = rna.GetExt().GetName(); - if ( NStr::EqualNocase(name, "misc_RNA")) return "misc_RNA"; - if ( NStr::EqualNocase(name, "ncRNA") ) return "ncRNA"; - if ( NStr::EqualNocase(name, "tmRNA") ) return "tmRNA"; - } - return "misc_RNA"; - default: - return kFeatBad; - } - } - return kFeatBad; - case NCBI_SEQFEAT(Pub): - return "Cit"; - case NCBI_SEQFEAT(Seq): - return "Xref"; - case NCBI_SEQFEAT(Imp): - return s_FindImpFeatType( fdata.GetImp() ); - case NCBI_SEQFEAT(Region): - return "Region"; - case NCBI_SEQFEAT(Comment): - return "Comment"; - case NCBI_SEQFEAT(Bond): - return "Bond"; - case NCBI_SEQFEAT(Site): - return "Site"; - case NCBI_SEQFEAT(Rsite): - return "Rsite"; - case NCBI_SEQFEAT(User): - return "User"; - case NCBI_SEQFEAT(Txinit): - return "TxInit"; - case NCBI_SEQFEAT(Num): - return "Num"; - case NCBI_SEQFEAT(Psec_str): - return "SecStr"; - case NCBI_SEQFEAT(Non_std_residue): - return "NonStdRes"; - case NCBI_SEQFEAT(Het): - return "Het"; - case NCBI_SEQFEAT(Biosrc): - return "Src"; - case NCBI_SEQFEAT(Clone): - return "CloneRef"; - case NCBI_SEQFEAT(Variation): - return "VariationRef"; - default: - return kFeatBad; + } + return "Protein"; + case NCBI_SEQFEAT(Rna): + if(fdata.GetRna().IsSetType() ) { + const auto& rna = fdata.GetRna(); + switch (rna.GetType() ) + { + case NCBI_RNAREF(unknown): + return "misc_RNA"; // unknownrna mapped to otherrna + case NCBI_RNAREF(premsg): + return "precursor_RNA"; + case NCBI_RNAREF(mRNA): + return "mRNA"; + case NCBI_RNAREF(tRNA): + return "tRNA"; + case NCBI_RNAREF(rRNA): + return "rRNA"; + case NCBI_RNAREF(snRNA): + return "snRNA"; + case NCBI_RNAREF(scRNA): + return "scRNA"; + case NCBI_RNAREF(snoRNA): + return "snoRNA"; + case NCBI_RNAREF(ncRNA): + return "ncRNA"; + case NCBI_RNAREF(tmRNA): + return "tmRNA"; + case NCBI_RNAREF(miscRNA): + return "misc_RNA"; + case NCBI_RNAREF(other): + if ( FIELD_IS_SET_AND_IS(rna, Ext, Name) ) { + const string &name = rna.GetExt().GetName(); + if ( NStr::EqualNocase(name, "misc_RNA")) return "misc_RNA"; + if ( NStr::EqualNocase(name, "ncRNA") ) return "ncRNA"; + if ( NStr::EqualNocase(name, "tmRNA") ) return "tmRNA"; + } + return "misc_RNA"; + default: + return kFeatBad; + } + } + return kFeatBad; + case NCBI_SEQFEAT(Pub): + return "Cit"; + case NCBI_SEQFEAT(Seq): + return "Xref"; + case NCBI_SEQFEAT(Imp): + return s_FindImpFeatType( fdata.GetImp() ); + case NCBI_SEQFEAT(Region): + return "Region"; + case NCBI_SEQFEAT(Comment): + return "Comment"; + case NCBI_SEQFEAT(Bond): + return "Bond"; + case NCBI_SEQFEAT(Site): + return "Site"; + case NCBI_SEQFEAT(Rsite): + return "Rsite"; + case NCBI_SEQFEAT(User): + return "User"; + case NCBI_SEQFEAT(Txinit): + return "TxInit"; + case NCBI_SEQFEAT(Num): + return "Num"; + case NCBI_SEQFEAT(Psec_str): + return "SecStr"; + case NCBI_SEQFEAT(Non_std_residue): + return "NonStdRes"; + case NCBI_SEQFEAT(Het): + return "Het"; + case NCBI_SEQFEAT(Biosrc): + return "Src"; + case NCBI_SEQFEAT(Clone): + return "CloneRef"; + case NCBI_SEQFEAT(Variation): + return "VariationRef"; + default: + return kFeatBad; } return kFeatBad; } @@ -3304,10 +3266,21 @@ CNewCleanup_imp::EAction CNewCleanup_imp::GBQualSeqFeatBC(CGb_qual& gb_qual, CSe return eAction_Erase; // mark qual for deletion } else if (NStr::EqualNocase(qual, "gene")) { if (!NStr::IsBlank(val)) { - CRef xref(new CSeqFeatXref); - xref->SetData().SetGene().SetLocus(val); - feat.SetXref().insert(feat.SetXref().begin(), xref); - ChangeMade(CCleanupChange::eCopyGeneXref); + if (!data.IsGene()) { + CRef xref(new CSeqFeatXref); + xref->SetData().SetGene().SetLocus(val); + feat.SetXref().insert(feat.SetXref().begin(), xref); + ChangeMade(CCleanupChange::eCopyGeneXref); + } else { + auto& gene = data.SetGene(); + if (gene.IsSetDesc() && !NStr::IsBlank(gene.GetDesc())) { + gene.SetDesc() += "; "; + } else { + gene.SetDesc(kEmptyStr); + } + gene.SetDesc() += "gene=" + val; + ChangeMade(CCleanupChange::eChangeQualifiers); + } return eAction_Erase; // mark qual for deletion } } else if (NStr::EqualNocase(qual, "codon_start")) { @@ -3528,9 +3501,9 @@ static bool s_IsCompoundRptTypeValue( static void s_ExpandThisQual( - CSeq_feat::TQual& quals, // the list of CGb_qual's. + CSeq_feat::TQual& /*quals*/, // the list of CGb_qual's. CSeq_feat::TQual::iterator& it, // points to the one qual we might expand. - CSeq_feat::TQual& new_quals ) // new quals that will need to be inserted + CSeq_feat::TQual& new_quals) // new quals that will need to be inserted // // Rules for "rpt_type" qualifiers (as of 2006-03-07): // @@ -3634,7 +3607,13 @@ CNewCleanup_imp::x_GeneGBQualBC( CGene_ref& gene, const CGb_qual& gb_qual ) } bool change_made = false; - if (NStr::EqualNocase(qual, "map")) { + if (NStr::EqualNocase(qual, "gene")) { + if (!gene.IsSetLocus()) { + change_made = true; + gene.SetLocus(val); + } + } + else if (NStr::EqualNocase(qual, "map")) { if (! gene.IsSetMaploc() ) { change_made = true; gene.SetMaploc(val); @@ -3655,11 +3634,13 @@ CNewCleanup_imp::x_GeneGBQualBC( CGene_ref& gene, const CGb_qual& gb_qual ) change_made = true; gene.SetSyn().push_back(val); } + if (change_made) { ChangeMade(CCleanupChange::eChangeQualifiers); + return eAction_Erase; } - return ( change_made ? eAction_Erase : eAction_Nothing ); + return eAction_Nothing; } CNewCleanup_imp::EAction @@ -4244,7 +4225,7 @@ CNewCleanup_imp::x_HandleTrnaProductGBQual(CSeq_feat& feat, CRNA_ref& rna, const } -CNewCleanup_imp::EAction CNewCleanup_imp::x_HandleStandardNameRnaGBQual(CSeq_feat& feat, CRNA_ref& rna, const string& standard_name) +CNewCleanup_imp::EAction CNewCleanup_imp::x_HandleStandardNameRnaGBQual(CSeq_feat&, CRNA_ref&, const string&) { return eAction_Nothing; } @@ -4732,32 +4713,27 @@ void CNewCleanup_imp::x_BothStrandBC( CSeq_loc &loc ) case CSeq_loc::e_Int : x_BothStrandBC( GET_MUTABLE(loc, Int) ); break; - case CSeq_loc::e_Packed_int : - { - CSeq_loc::TPacked_int::Tdata& ints = loc.SetPacked_int().Set(); - NON_CONST_ITERATE(CSeq_loc::TPacked_int::Tdata, interval_it, ints) { - x_BothStrandBC(**interval_it); - } - } - break; - case CSeq_loc::e_Pnt : - { - CSeq_loc::TPnt& pnt = loc.SetPnt(); - - // change both and both-rev to plus and minus, respectively - if (pnt.CanGetStrand()) { - ENa_strand strand = pnt.GetStrand(); - if (strand == eNa_strand_both) { - pnt.SetStrand(eNa_strand_plus); - ChangeMade(CCleanupChange::eChangeStrand); - } else if (strand == eNa_strand_both_rev) { - pnt.SetStrand(eNa_strand_minus); - ChangeMade(CCleanupChange::eChangeStrand); - } + case CSeq_loc::e_Packed_int: { + CSeq_loc::TPacked_int::Tdata& ints = loc.SetPacked_int().Set(); + NON_CONST_ITERATE(CSeq_loc::TPacked_int::Tdata, interval_it, ints) { + x_BothStrandBC(**interval_it); + } + } break; + case CSeq_loc::e_Pnt: { + CSeq_loc::TPnt& pnt = loc.SetPnt(); + + // change both and both-rev to plus and minus, respectively + if (pnt.CanGetStrand()) { + ENa_strand strand = pnt.GetStrand(); + if (strand == eNa_strand_both) { + pnt.SetStrand(eNa_strand_plus); + ChangeMade(CCleanupChange::eChangeStrand); + } else if (strand == eNa_strand_both_rev) { + pnt.SetStrand(eNa_strand_minus); + ChangeMade(CCleanupChange::eChangeStrand); } } - break; - + } break; default: break; } @@ -5859,7 +5835,7 @@ void CNewCleanup_imp::x_RemoveFlankingQuotes( string &val ) } // holds the first and last pos that we will keep // (have to use "ints" since might be negative) - int first_pos = 0; + size_t first_pos = 0; size_t last_pos = ( val.length() - 1 ); // move inwards until there are no more quotes to trim @@ -6494,27 +6470,27 @@ CConstRef s_FindUserObjectTypeRecursive_helper( const CUser_field { if( FIELD_IS_SET(field, Data) ) { switch( GET_FIELD(field, Data).Which() ) { - case CUser_field::C_Data::e_Object: - return s_FindUserObjectTypeRecursive( GET_FIELD(field, Data).GetObject(), sought_type_label ); - break; - case CUser_field::C_Data::e_Fields: - ITERATE( CUser_field::C_Data::TFields, field_iter, GET_FIELD(field, Data).GetFields() ) { - CConstRef result = s_FindUserObjectTypeRecursive_helper( **field_iter, sought_type_label ); - if( result ) { - return result; - } + case CUser_field::C_Data::e_Object: + return s_FindUserObjectTypeRecursive( GET_FIELD(field, Data).GetObject(), sought_type_label ); + break; + case CUser_field::C_Data::e_Fields: + ITERATE( CUser_field::C_Data::TFields, field_iter, GET_FIELD(field, Data).GetFields() ) { + CConstRef result = s_FindUserObjectTypeRecursive_helper( **field_iter, sought_type_label ); + if( result ) { + return result; } - break; - case CUser_field::C_Data::e_Objects: - ITERATE( CUser_field::C_Data::TObjects, obj_iter, GET_FIELD(field, Data).GetObjects() ) { - CConstRef result = s_FindUserObjectTypeRecursive( **obj_iter, sought_type_label ); - if( result ) { - return result; - } + } + break; + case CUser_field::C_Data::e_Objects: + ITERATE( CUser_field::C_Data::TObjects, obj_iter, GET_FIELD(field, Data).GetObjects() ) { + CConstRef result = s_FindUserObjectTypeRecursive( **obj_iter, sought_type_label ); + if( result ) { + return result; } - break; - default: - break; + } + break; + default: + break; } } @@ -6595,12 +6571,11 @@ void CNewCleanup_imp::GeneFeatBC ( while (xr_itr != seq_feat.SetXref().end()) { CSeqFeatXref& sfx = **xr_itr; if (sfx.IsSetData() && sfx.GetData().IsGene()) { - CGene_ref& gene_ref = sfx.SetData().SetGene(); - if (s_CopyDbToFeat(gene_ref, seq_feat)) { + CGene_ref& gene_ref2 = sfx.SetData().SetGene(); + if (s_CopyDbToFeat(gene_ref2, seq_feat)) { ChangeMade(CCleanupChange::eChangeDbxrefs); } - - if (s_IsEmptyGeneRef(gene_ref)) { + if (s_IsEmptyGeneRef(gene_ref2)) { xr_itr = seq_feat.SetXref().erase(xr_itr); ChangeMade(CCleanupChange::eChangeDbxrefs); continue; @@ -7214,147 +7189,131 @@ void CNewCleanup_imp::RnarefBC ( CRNA_ref::C_Ext& ext = GET_MUTABLE (rr, Ext); const TRNAREF_EXT chs = ext.Which(); switch (chs) { - case NCBI_RNAEXT(Name): - { - string& name = GET_MUTABLE (ext, Name); - if (NStr::IsBlank (name)) { - RESET_FIELD (rr, Ext); - ChangeMade(CCleanupChange::eChangeRNAref); - break; - } - - static const string rRNA = " rRNA"; - static const string rRNA2 = "_rRNA"; - static const string kRibosomal_Rna = " ribosomal RNA"; - static const string kRibosomal_r_Rna = " ribosomal rRNA"; - - if (rr.IsSetType()) { - switch (rr.GetType()) { - case CRNA_ref::eType_rRNA: - {{ - size_t len = name.length(); - if (len >= rRNA.length() ) { - if( NStr::EndsWith(name, rRNA, NStr::eNocase) || NStr::EndsWith(name, rRNA2, NStr::eNocase) ) { - if( NStr::EndsWith(name, kRibosomal_r_Rna, NStr::eNocase) ) { - name.replace(len - kRibosomal_r_Rna.length(), name.size(), kRibosomal_Rna); - } else { - name.replace(len - rRNA.length(), name.size(), kRibosomal_Rna); - } - ChangeMade(CCleanupChange::eChangeQualifiers); - } - } + case NCBI_RNAEXT(Name): { + string& name = GET_MUTABLE (ext, Name); + if (NStr::IsBlank (name)) { + RESET_FIELD (rr, Ext); + ChangeMade(CCleanupChange::eChangeRNAref); + break; + } - x_RRNANameBC( name ); + static const string rRNA = " rRNA"; + static const string rRNA2 = "_rRNA"; + static const string kRibosomal_Rna = " ribosomal RNA"; + static const string kRibosomal_r_Rna = " ribosomal rRNA"; - break; - }} - case CRNA_ref::eType_other: - case CRNA_ref::eType_miscRNA: - {{ - x_TranslateITSNameAndFlag(name); - - // convert to RNA-gen - string name_copy; // copy because name is about to be destroyed - name_copy.swap( name ); - ext.SetGen().SetProduct( name_copy ); - ChangeMade(CCleanupChange::eChangeRNAref); - }} - break; - default: - break; + if (rr.IsSetType()) { + switch (rr.GetType()) { + case CRNA_ref::eType_rRNA: + { + size_t len = name.length(); + if (len >= rRNA.length() ) { + if( NStr::EndsWith(name, rRNA, NStr::eNocase) || NStr::EndsWith(name, rRNA2, NStr::eNocase) ) { + if( NStr::EndsWith(name, kRibosomal_r_Rna, NStr::eNocase) ) { + name.replace(len - kRibosomal_r_Rna.length(), name.size(), kRibosomal_Rna); + } else { + name.replace(len - rRNA.length(), name.size(), kRibosomal_Rna); + } + ChangeMade(CCleanupChange::eChangeQualifiers); } } + + x_RRNANameBC( name ); } - break; - case NCBI_RNAEXT(TRNA): + break; + case CRNA_ref::eType_other: + case CRNA_ref::eType_miscRNA: { - CTrna_ext& tRNA = GET_MUTABLE (ext, TRNA); - if (FIELD_IS_SET (tRNA, Aa)) { - const CTrna_ext::C_Aa& aa = GET_FIELD (tRNA, Aa); - if (aa.Which() == CTrna_ext::C_Aa::e_not_set) { - RESET_FIELD (tRNA, Aa); - ChangeMade(CCleanupChange::eChangeRNAref); - } - } + x_TranslateITSNameAndFlag(name); - if (! CODON_ON_TRNAEXT_IS_SORTED(tRNA, s_CodonCompare)) { - SORT_CODON_ON_TRNAEXT(tRNA, s_CodonCompare); - ChangeMade(CCleanupChange::eChange_tRna); - } + // convert to RNA-gen + string name_copy; // copy because name is about to be destroyed + name_copy.swap( name ); + ext.SetGen().SetProduct( name_copy ); + ChangeMade(CCleanupChange::eChangeRNAref); + } + break; + default: + break; + } + } + } break; + case NCBI_RNAEXT(TRNA): { + CTrna_ext& tRNA = GET_MUTABLE (ext, TRNA); + if (FIELD_IS_SET (tRNA, Aa)) { + const CTrna_ext::C_Aa& aa = GET_FIELD (tRNA, Aa); + if (aa.Which() == CTrna_ext::C_Aa::e_not_set) { + RESET_FIELD (tRNA, Aa); + ChangeMade(CCleanupChange::eChangeRNAref); + } + } - if( ! CODON_ON_TRNAEXT_IS_UNIQUE(tRNA, s_CodonEqual) ) { - UNIQUE_CODON_ON_TRNAEXT(tRNA, s_CodonEqual); - ChangeMade(CCleanupChange::eChange_tRna); - } + if (! CODON_ON_TRNAEXT_IS_SORTED(tRNA, s_CodonCompare)) { + SORT_CODON_ON_TRNAEXT(tRNA, s_CodonCompare); + ChangeMade(CCleanupChange::eChange_tRna); + } - REMOVE_IF_EMPTY_CODON_ON_TRNAEXT(tRNA); + if( ! CODON_ON_TRNAEXT_IS_UNIQUE(tRNA, s_CodonEqual) ) { + UNIQUE_CODON_ON_TRNAEXT(tRNA, s_CodonEqual); + ChangeMade(CCleanupChange::eChange_tRna); + } - } - break; - case NCBI_RNAEXT(Gen): - { - RnarefGenBC(rr); - } - break; - default: - break; + REMOVE_IF_EMPTY_CODON_ON_TRNAEXT(tRNA); + } break; + case NCBI_RNAEXT(Gen): { + RnarefGenBC(rr); + } break; + default: + break; } } if (FIELD_IS_SET (rr, Type)) { TRNAREF_TYPE typ = GET_FIELD (rr, Type); switch (typ) { - case NCBI_RNAREF(mRNA): - { - } - break; - case NCBI_RNAREF(tRNA): - { - } - break; - case NCBI_RNAREF(rRNA): - { - } - break; - case NCBI_RNAREF(other): - { - if (FIELD_IS_SET (rr, Ext)) { - CRNA_ref::C_Ext& ext = GET_MUTABLE (rr, Ext); - const TRNAREF_EXT chs = ext.Which(); - if (chs == NCBI_RNAEXT(Name)) { - string& str = GET_MUTABLE (ext, Name); - if ( str.empty() || NStr::EqualNocase (str, "misc_RNA")) { - SET_FIELD( rr, Type, NCBI_RNAREF(miscRNA) ); - RESET_FIELD(rr, Ext); - ChangeMade(CCleanupChange::eChangeRNAref); - } else if (NStr::EqualNocase (str, "ncRNA")) { - SET_FIELD( rr, Type, NCBI_RNAREF(ncRNA) ); - RESET_FIELD(rr, Ext); - ChangeMade(CCleanupChange::eChangeRNAref); - } else if (NStr::EqualNocase (str, "tmRNA")) { - SET_FIELD( rr, Type, NCBI_RNAREF(tmRNA) ); - RESET_FIELD(rr, Ext); - ChangeMade(CCleanupChange::eChangeRNAref); - } else if (s_IsNcrnaName (str)) { - SET_FIELD( rr, Type, NCBI_RNAREF(ncRNA) ); - const string new_class = str; - SET_FIELD( rr.SetExt().SetGen(), Class, new_class ); - ChangeMade(CCleanupChange::eChangeRNAref); - } else { - SET_FIELD( rr, Type, NCBI_RNAREF(miscRNA) ); - const string new_product = str; - SET_FIELD( rr.SetExt().SetGen(), Product, new_product ); - ChangeMade(CCleanupChange::eChangeRNAref); - } - } + case NCBI_RNAREF(mRNA): + break; + case NCBI_RNAREF(tRNA): + break; + case NCBI_RNAREF(rRNA): + break; + case NCBI_RNAREF(other): { + if (FIELD_IS_SET (rr, Ext)) { + CRNA_ref::C_Ext& ext = GET_MUTABLE (rr, Ext); + const TRNAREF_EXT chs = ext.Which(); + if (chs == NCBI_RNAEXT(Name)) { + string& str = GET_MUTABLE (ext, Name); + if ( str.empty() || NStr::EqualNocase (str, "misc_RNA")) { + SET_FIELD( rr, Type, NCBI_RNAREF(miscRNA) ); + RESET_FIELD(rr, Ext); + ChangeMade(CCleanupChange::eChangeRNAref); + } else if (NStr::EqualNocase (str, "ncRNA")) { + SET_FIELD( rr, Type, NCBI_RNAREF(ncRNA) ); + RESET_FIELD(rr, Ext); + ChangeMade(CCleanupChange::eChangeRNAref); + } else if (NStr::EqualNocase (str, "tmRNA")) { + SET_FIELD( rr, Type, NCBI_RNAREF(tmRNA) ); + RESET_FIELD(rr, Ext); + ChangeMade(CCleanupChange::eChangeRNAref); + } else if (s_IsNcrnaName (str)) { + SET_FIELD( rr, Type, NCBI_RNAREF(ncRNA) ); + const string new_class = str; + SET_FIELD( rr.SetExt().SetGen(), Class, new_class ); + ChangeMade(CCleanupChange::eChangeRNAref); } else { SET_FIELD( rr, Type, NCBI_RNAREF(miscRNA) ); + const string new_product = str; + SET_FIELD( rr.SetExt().SetGen(), Product, new_product ); ChangeMade(CCleanupChange::eChangeRNAref); } } - break; - default: - break; + } else { + SET_FIELD( rr, Type, NCBI_RNAREF(miscRNA) ); + ChangeMade(CCleanupChange::eChangeRNAref); + } + } break; + default: + break; } } } @@ -7601,9 +7560,7 @@ bool s_FixncRNA(CSeq_feat& feat) switch (rna_type) { case CRNA_ref::eType_snRNA: case CRNA_ref::eType_scRNA: - case CRNA_ref::eType_snoRNA: - {{ - + case CRNA_ref::eType_snoRNA: { string rna_type_name = CRNA_ref::GetRnaTypeName(rna_type); if (rna.IsSetExt() && rna.GetExt().IsName() && !NStr::EqualNocase(rna.GetExt().GetName(), rna_type_name)) @@ -7614,8 +7571,7 @@ bool s_FixncRNA(CSeq_feat& feat) rna.SetType(CRNA_ref::eType_ncRNA); rna.SetExt().SetGen().SetClass(rna_type_name); any_change = true; - break; - }} + } break; default: break; } @@ -8333,7 +8289,7 @@ void s_CopyProtXrefToProtFeat( CProt_ref &prot_ref, CProt_ref &cds_prot_ref ) } } -void CNewCleanup_imp::x_MoveCdregionXrefsToProt (CCdregion& cds, CSeq_feat& seqfeat) +void CNewCleanup_imp::x_MoveCdregionXrefsToProt (CCdregion&, CSeq_feat& seqfeat) { if( !seqfeat.IsSetXref() || ! seqfeat.IsSetProduct() ) { return; @@ -8712,16 +8668,14 @@ void CNewCleanup_imp::x_NotePubdescOrAnnotPubs_RecursionHelper( case NCBI_PUB(Pmid): pmid = ENTREZ_ID_TO(int, pub.GetPmid().Get()); break; - case NCBI_PUB(Gen): - { - const CCit_gen &gen = pub.GetGen(); - if( gen.IsSetCit() || gen.IsSetJournal() || gen.IsSetDate() || gen.IsSetSerial_number() ) { - m_PubdescCitGenLabelVec.push_back( kEmptyStr ); - string &label = m_PubdescCitGenLabelVec.back(); - pub.GetLabel( &label, CPub::eContent, true ); - } - } - break; + case NCBI_PUB(Gen): { + const CCit_gen &gen = pub.GetGen(); + if( gen.IsSetCit() || gen.IsSetJournal() || gen.IsSetDate() || gen.IsSetSerial_number() ) { + m_PubdescCitGenLabelVec.push_back( kEmptyStr ); + string& label = m_PubdescCitGenLabelVec.back(); + pub.GetLabel(&label, CPub::eContent, CPub::fLabel_Unique); + } + } break; case NCBI_PUB(Equiv): x_NotePubdescOrAnnotPubs_RecursionHelper( pub.GetEquiv(), muid, pmid ); break; @@ -8734,7 +8688,7 @@ void CNewCleanup_imp::x_NotePubdescOrAnnotPubs_RecursionHelper( void CNewCleanup_imp::x_RememberPubOldLabel( CPub &pub ) { string old_label; - pub.GetLabel( &old_label, CPub::eContent, true); + pub.GetLabel(&old_label, CPub::eContent, CPub::fLabel_Unique); m_OldLabelToPubMap.insert( TOldLabelToPubMap::value_type(old_label, CRef(&pub)) ); } @@ -9572,42 +9526,42 @@ void CNewCleanup_imp::x_CleanupGenbankBlock( CSeq_descr & seq_descr ) CMolInfo::TBiomol s_BiomolFromGIBBMolType(EGIBB_mol mol) { switch (mol) { - case eGIBB_mol_genomic: - return CMolInfo::eBiomol_genomic; - break; - case eGIBB_mol_genomic_mRNA: - return CMolInfo::eBiomol_genomic_mRNA; - break; - case eGIBB_mol_mRNA: - return CMolInfo::eBiomol_mRNA; - break; - case eGIBB_mol_other: - return CMolInfo::eBiomol_other; - break; - case eGIBB_mol_other_genetic: - return CMolInfo::eBiomol_other_genetic; - break; - case eGIBB_mol_peptide: - return CMolInfo::eBiomol_peptide; - break; - case eGIBB_mol_pre_mRNA: - return CMolInfo::eBiomol_pre_RNA; - break; - case eGIBB_mol_rRNA: - return CMolInfo::eBiomol_rRNA; - break; - case eGIBB_mol_scRNA: - return CMolInfo::eBiomol_scRNA; - break; - case eGIBB_mol_snRNA: - return CMolInfo::eBiomol_snRNA; - break; - case eGIBB_mol_tRNA: - return CMolInfo::eBiomol_tmRNA; - break; - case eGIBB_mol_unknown: - return CMolInfo::eBiomol_unknown; - break; + case eGIBB_mol_genomic: + return CMolInfo::eBiomol_genomic; + break; + case eGIBB_mol_genomic_mRNA: + return CMolInfo::eBiomol_genomic_mRNA; + break; + case eGIBB_mol_mRNA: + return CMolInfo::eBiomol_mRNA; + break; + case eGIBB_mol_other: + return CMolInfo::eBiomol_other; + break; + case eGIBB_mol_other_genetic: + return CMolInfo::eBiomol_other_genetic; + break; + case eGIBB_mol_peptide: + return CMolInfo::eBiomol_peptide; + break; + case eGIBB_mol_pre_mRNA: + return CMolInfo::eBiomol_pre_RNA; + break; + case eGIBB_mol_rRNA: + return CMolInfo::eBiomol_rRNA; + break; + case eGIBB_mol_scRNA: + return CMolInfo::eBiomol_scRNA; + break; + case eGIBB_mol_snRNA: + return CMolInfo::eBiomol_snRNA; + break; + case eGIBB_mol_tRNA: + return CMolInfo::eBiomol_tmRNA; + break; + case eGIBB_mol_unknown: + return CMolInfo::eBiomol_unknown; + break; } return CMolInfo::eBiomol_unknown; } @@ -9617,28 +9571,27 @@ CMolInfo::TTech s_TechFromGIBBMethod(EGIBB_method method) { switch (method) { - case eGIBB_method_concept_trans: - return CMolInfo::eTech_concept_trans; - break; - case eGIBB_method_seq_pept: - return CMolInfo::eTech_seq_pept; - break; - case eGIBB_method_both: - return CMolInfo::eTech_both; - break; - case eGIBB_method_seq_pept_overlap: - return CMolInfo::eTech_seq_pept_overlap; - break; - case eGIBB_method_seq_pept_homol: - return CMolInfo::eTech_seq_pept; - break; - case eGIBB_method_concept_trans_a: - return CMolInfo::eTech_concept_trans_a; - break; - case eGIBB_method_other: - return CMolInfo::eTech_other; - break; - + case eGIBB_method_concept_trans: + return CMolInfo::eTech_concept_trans; + break; + case eGIBB_method_seq_pept: + return CMolInfo::eTech_seq_pept; + break; + case eGIBB_method_both: + return CMolInfo::eTech_both; + break; + case eGIBB_method_seq_pept_overlap: + return CMolInfo::eTech_seq_pept_overlap; + break; + case eGIBB_method_seq_pept_homol: + return CMolInfo::eTech_seq_pept; + break; + case eGIBB_method_concept_trans_a: + return CMolInfo::eTech_concept_trans_a; + break; + case eGIBB_method_other: + return CMolInfo::eTech_other; + break; } return CMolInfo::eTech_other; } @@ -9648,36 +9601,36 @@ bool SetMolinfoFromGIBBMod(CMolInfo& mi, EGIBB_mod mod) { bool changed = false; switch (mod) { - case eGIBB_mod_partial: - mi.SetCompleteness(CMolInfo::eCompleteness_partial); - changed = true; - break; - case eGIBB_mod_complete: - mi.SetCompleteness(CMolInfo::eCompleteness_complete); - changed = true; - break; - case eGIBB_mod_no_left: - mi.SetCompleteness(CMolInfo::eCompleteness_no_left); - changed = true; - break; - case eGIBB_mod_no_right: - mi.SetCompleteness(CMolInfo::eCompleteness_no_right); - changed = true; - break; - case eGIBB_mod_est: - mi.SetTech(CMolInfo::eTech_est); - changed = true; - break; - case eGIBB_mod_sts: - mi.SetCompleteness(CMolInfo::eTech_sts); - changed = true; - break; - case eGIBB_mod_survey: - mi.SetCompleteness(CMolInfo::eTech_survey); - changed = true; - break; - default: - break; + case eGIBB_mod_partial: + mi.SetCompleteness(CMolInfo::eCompleteness_partial); + changed = true; + break; + case eGIBB_mod_complete: + mi.SetCompleteness(CMolInfo::eCompleteness_complete); + changed = true; + break; + case eGIBB_mod_no_left: + mi.SetCompleteness(CMolInfo::eCompleteness_no_left); + changed = true; + break; + case eGIBB_mod_no_right: + mi.SetCompleteness(CMolInfo::eCompleteness_no_right); + changed = true; + break; + case eGIBB_mod_est: + mi.SetTech(CMolInfo::eTech_est); + changed = true; + break; + case eGIBB_mod_sts: + mi.SetCompleteness(CMolInfo::eTech_sts); + changed = true; + break; + case eGIBB_mod_survey: + mi.SetCompleteness(CMolInfo::eTech_survey); + changed = true; + break; + default: + break; } return changed; } @@ -9751,14 +9704,14 @@ void CNewCleanup_imp::x_RemoveOldDescriptors( CSeq_descr & seq_descr ) { EDIT_EACH_SEQDESC_ON_SEQDESCR( d, seq_descr ) { switch ((*d)->Which()) { - case CSeqdesc::e_Mol_type: - case CSeqdesc::e_Method: - case CSeqdesc::e_Org: - ERASE_SEQDESC_ON_SEQDESCR(d, seq_descr); -ChangeMade(CCleanupChange::eRemoveDescriptor); -break; - default: - break; + case CSeqdesc::e_Mol_type: + case CSeqdesc::e_Method: + case CSeqdesc::e_Org: + ERASE_SEQDESC_ON_SEQDESCR(d, seq_descr); + ChangeMade(CCleanupChange::eRemoveDescriptor); + break; + default: + break; } } } @@ -10150,18 +10103,18 @@ bool CNewCleanup_imp::x_IsPubContentBad(const CPubdesc& pub, bool strict) const auto& titles = jour.GetTitle().Get(); for (auto title : titles) { switch (title->Which()) { - CHECK_TITLE(Name) - CHECK_TITLE(Tsub) - CHECK_TITLE(Trans) - CHECK_TITLE(Jta) - CHECK_TITLE(Iso_jta) - CHECK_TITLE(Ml_jta) - CHECK_TITLE(Coden) - CHECK_TITLE(Issn) - CHECK_TITLE(Abr) - CHECK_TITLE(Isbn) - default: - break; + CHECK_TITLE(Name) + CHECK_TITLE(Tsub) + CHECK_TITLE(Trans) + CHECK_TITLE(Jta) + CHECK_TITLE(Iso_jta) + CHECK_TITLE(Ml_jta) + CHECK_TITLE(Coden) + CHECK_TITLE(Issn) + CHECK_TITLE(Abr) + CHECK_TITLE(Isbn) + default: + break; } } } @@ -10223,22 +10176,22 @@ bool CNewCleanup_imp::x_ShouldRemoveEmptyFeature(const CSeq_feat& feat) return false; } switch (feat.GetData().Which()) { - case CSeqFeatData::e_Gene: - is_empty = x_ShouldRemoveEmptyGene(feat.GetData().GetGene(), feat); - break; - case CSeqFeatData::e_Prot: - is_empty = x_ShouldRemoveEmptyProt(feat.GetData().GetProt()); - break; - case CSeqFeatData::e_Pub: - is_empty = x_ShouldRemoveEmptyPub(feat.GetData().GetPub()); - break; - case CSeqFeatData::e_Comment: - if (!feat.IsSetComment() || NStr::IsBlank(feat.GetComment())) { - is_empty = true; - } - break; - default: - break; + case CSeqFeatData::e_Gene: + is_empty = x_ShouldRemoveEmptyGene(feat.GetData().GetGene(), feat); + break; + case CSeqFeatData::e_Prot: + is_empty = x_ShouldRemoveEmptyProt(feat.GetData().GetProt()); + break; + case CSeqFeatData::e_Pub: + is_empty = x_ShouldRemoveEmptyPub(feat.GetData().GetPub()); + break; + case CSeqFeatData::e_Comment: + if (!feat.IsSetComment() || NStr::IsBlank(feat.GetComment())) { + is_empty = true; + } + break; + default: + break; } return is_empty; } @@ -10607,25 +10560,25 @@ void CNewCleanup_imp::x_BioseqSetEC( CBioseq_set & bioseq_set ) switch( GET_FIELD_OR_DEFAULT( bioseq_set, Class, NCBI_BIOSEQSETCLASS(not_set)) ) { - case CBioseq_set::eClass_nuc_prot: - x_BioseqSetNucProtEC( bioseq_set ); - break; - case CBioseq_set::eClass_genbank: - x_BioseqSetGenBankEC(bioseq_set); - x_RemovePopPhyMolInfo(bioseq_set); - break; - case CBioseq_set::eClass_mut_set: - case CBioseq_set::eClass_pop_set: - case CBioseq_set::eClass_phy_set: - case CBioseq_set::eClass_eco_set: - case CBioseq_set::eClass_wgs_set: - case CBioseq_set::eClass_small_genome_set: - x_RemovePopPhyBioSource(bioseq_set); - x_RemovePopPhyMolInfo(bioseq_set); - break; - default: - // no special logic for other bioseq-set classes - break; + case CBioseq_set::eClass_nuc_prot: + x_BioseqSetNucProtEC( bioseq_set ); + break; + case CBioseq_set::eClass_genbank: + x_BioseqSetGenBankEC(bioseq_set); + x_RemovePopPhyMolInfo(bioseq_set); + break; + case CBioseq_set::eClass_mut_set: + case CBioseq_set::eClass_pop_set: + case CBioseq_set::eClass_phy_set: + case CBioseq_set::eClass_eco_set: + case CBioseq_set::eClass_wgs_set: + case CBioseq_set::eClass_small_genome_set: + x_RemovePopPhyBioSource(bioseq_set); + x_RemovePopPhyMolInfo(bioseq_set); + break; + default: + // no special logic for other bioseq-set classes + break; } } @@ -11351,11 +11304,11 @@ void CNewCleanup_imp::x_MoveNpPub(CBioseq_set& set) if (seh && s_HasRefSeqPGAPStructuredComment(seh)) { continue; } - auto& set = (*it)->SetSet(); - auto& dset = set.SetDescr(); - x_MoveNpPub(set, dset); + auto& set2 = (*it)->SetSet(); + auto& dset = set2.SetDescr(); + x_MoveNpPub(set2, dset); if (dset.Set().empty()) { - set.ResetDescr(); + set2.ResetDescr(); } } } @@ -11951,11 +11904,6 @@ void CNewCleanup_imp::MoveStandardName(CSeq_feat& sf) } -void CNewCleanup_imp::CreatePubFromFeat(CSeq_feat& feat) -{ -} - - void CNewCleanup_imp::ResynchProteinPartials ( CSeq_feat& feat ) { if (!feat.IsSetData()) { @@ -12457,8 +12405,6 @@ void CNewCleanup_imp::SetGlobalFlags(const CSeq_submit& ss) //LCOV_EXCL_STOP - - void CNewCleanup_imp::SetGlobalFlags(const CSeq_entry& se, bool reset) { if (reset) { @@ -12499,12 +12445,12 @@ void CNewCleanup_imp::SetGlobalFlags(const CBioseq& bs, bool reset) ITERATE(CBioseq::TId, id, bs.GetId()) { const CSeq_id& sid = **id; switch (sid.Which()) { - case NCBI_SEQID(Embl): - case NCBI_SEQID(Ddbj): - m_IsEmblOrDdbj = true; - break; - default: - break; + case NCBI_SEQID(Embl): + case NCBI_SEQID(Ddbj): + m_IsEmblOrDdbj = true; + break; + default: + break; } } } diff --git a/c++/src/objtools/cleanup/newcleanupp.hpp b/c++/src/objtools/cleanup/newcleanupp.hpp index 1125f54f..3d951e69 100644 --- a/c++/src/objtools/cleanup/newcleanupp.hpp +++ b/c++/src/objtools/cleanup/newcleanupp.hpp @@ -319,7 +319,6 @@ private: void MoveDbxrefs(CSeq_feat& sf); void MoveStandardName(CSeq_feat& sf); - void CreatePubFromFeat(CSeq_feat& sf); void ResynchProteinPartials ( CSeq_feat& feat ); void ResynchPeptidePartials( CBioseq& seq ); void x_SetPartialsForProtein(CBioseq& prot, bool partial5, bool partial3, bool feat_partial); @@ -463,13 +462,11 @@ private: // string cleanup funcs void x_CleanupStringMarkChanged( std::string &str ); void x_CleanupStringJunkMarkChanged( std::string &str ); - void x_CleanupVisStringMarkChanged( std::string &str ); void x_ConvertDoubleQuotesMarkChanged( std::string &str ); bool x_CompressSpaces( string &str ); void x_CompressStringSpacesMarkChanged( std::string &str ); void x_StripSpacesMarkChanged( std::string& str ); void x_RemoveSpacesBetweenTildesMarkChanged( std::string & str ); - void X_CommentTildeFixes( std::string & str ); void x_TruncateSpacesMarkChanged( std::string & str ); void x_TrimInternalSemicolonsMarkChanged( std::string & str ); diff --git a/c++/src/objtools/data_loaders/blastdb/remote_blastdb_adapter.hpp b/c++/src/objtools/data_loaders/blastdb/remote_blastdb_adapter.hpp index 9b0baf17..8f744e6d 100644 --- a/c++/src/objtools/data_loaders/blastdb/remote_blastdb_adapter.hpp +++ b/c++/src/objtools/data_loaders/blastdb/remote_blastdb_adapter.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS_DATA_LOADERS_BLASTDB___REMOTE_BLASTDB_ADAPTER__HPP #define OBJTOOLS_DATA_LOADERS_BLASTDB___REMOTE_BLASTDB_ADAPTER__HPP -/* $Id: remote_blastdb_adapter.hpp 468783 2015-05-28 13:00:08Z vasilche $ +/* $Id: remote_blastdb_adapter.hpp 683929 2024-06-10 12:07:52Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -111,7 +111,7 @@ public: if (((end-begin) % kRmtSequenceSliceSize) == 0) { idx = ilog2( (end-begin)/kRmtSequenceSliceSize ); } else { - idx = m_SeqDataVector.size() - 1; + idx = static_cast(m_SeqDataVector.size() - 1); } _ASSERT((end == (begin + (int)(0x1<HasHUPIncluded() ) { + return true; + } + } + return false; +} + + void CReadDispatcher::ResetCaches(void) { NON_CONST_ITERATE(TReaders, rd, m_Readers) { diff --git a/c++/src/objtools/data_loaders/genbank/gbloader.cpp b/c++/src/objtools/data_loaders/genbank/gbloader.cpp index bb89587d..bf3c0108 100644 --- a/c++/src/objtools/data_loaders/genbank/gbloader.cpp +++ b/c++/src/objtools/data_loaders/genbank/gbloader.cpp @@ -1,4 +1,4 @@ -/* $Id: gbloader.cpp 674108 2023-10-18 18:11:17Z ivanov $ +/* $Id: gbloader.cpp 676925 2023-12-28 20:33:26Z sadyrovr $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -68,6 +68,8 @@ #include #include +#include + #include @@ -89,99 +91,46 @@ CGBLoaderParams::CGBLoaderParams(void) : m_ReaderPtr(0), m_ParamTree(0), m_Preopen(ePreopenByConfig), - m_HasHUPIncluded(false), + m_UsePSGInitialized(false), + m_UsePSG(false), m_PSGNoSplit(false), - m_ReaderParams(new CReaderParams) - + m_HasHUPIncluded(false) { } CGBLoaderParams::CGBLoaderParams(const string& reader_name) - : m_ReaderName(reader_name), - m_ReaderPtr(0), - m_ParamTree(0), - m_Preopen(ePreopenByConfig), - m_HasHUPIncluded(false), - m_PSGNoSplit(false), - m_ReaderParams(new CReaderParams) + : CGBLoaderParams() { + m_ReaderName = reader_name; } CGBLoaderParams::CGBLoaderParams(CReader* reader_ptr) - : m_ReaderPtr(reader_ptr), - m_ParamTree(0), - m_Preopen(ePreopenByConfig), - m_HasHUPIncluded(false), - m_PSGNoSplit(false), - m_ReaderParams(new CReaderParams) + : CGBLoaderParams() { + m_ReaderPtr = reader_ptr; } CGBLoaderParams::CGBLoaderParams(const TParamTree* param_tree) - : m_ReaderPtr(0), - m_ParamTree(param_tree), - m_Preopen(ePreopenByConfig), - m_HasHUPIncluded(false), - m_PSGNoSplit(false), - m_ReaderParams(new CReaderParams) + : CGBLoaderParams() { + m_ParamTree = param_tree; } CGBLoaderParams::CGBLoaderParams(EPreopenConnection preopen) - : m_ReaderPtr(0), - m_ParamTree(0), - m_Preopen(preopen), - m_HasHUPIncluded(false), - m_PSGNoSplit(false), - m_ReaderParams(new CReaderParams) + : CGBLoaderParams() { + m_Preopen = preopen; } -CGBLoaderParams::~CGBLoaderParams(void) -{ -} +CGBLoaderParams::~CGBLoaderParams(void) = default; - -CGBLoaderParams::CGBLoaderParams(const CGBLoaderParams& params) - : m_ReaderName(params.m_ReaderName), - m_WriterName(params.m_WriterName), - m_LoaderMethod(params.m_LoaderMethod), - m_ReaderPtr(params.m_ReaderPtr), - m_ParamTree(params.m_ParamTree), - m_Preopen(params.m_Preopen), - m_HasHUPIncluded(params.m_HasHUPIncluded), - m_WebCookie(params.m_WebCookie), - m_LoaderName(params.m_LoaderName), - m_PSGServiceName(params.m_PSGServiceName), - m_PSGNoSplit(params.m_PSGNoSplit), - m_ReaderParams(new CReaderParams(*params.m_ReaderParams)) -{ -} - - -CGBLoaderParams& CGBLoaderParams::operator=(const CGBLoaderParams& params) -{ - if ( this != ¶ms ) { - m_ReaderName = params.m_ReaderName; - m_WriterName = params.m_WriterName; - m_LoaderMethod = params.m_LoaderMethod; - m_ReaderPtr = params.m_ReaderPtr; - m_ParamTree = params.m_ParamTree; - m_Preopen = params.m_Preopen; - m_HasHUPIncluded = params.m_HasHUPIncluded; - m_WebCookie = params.m_WebCookie; - m_LoaderName = params.m_LoaderName; - m_PSGServiceName = params.m_PSGServiceName; - m_PSGNoSplit = params.m_PSGNoSplit; - m_ReaderParams.reset(new CReaderParams(*params.m_ReaderParams)); - } - return *this; -} +CGBLoaderParams::CGBLoaderParams(const CGBLoaderParams&) = default; +CGBLoaderParams& CGBLoaderParams::operator=(const CGBLoaderParams&) = default; void CGBLoaderParams::SetReaderPtr(CReader* reader_ptr) @@ -204,47 +153,47 @@ void CGBLoaderParams::SetParamTree(const TPluginManagerParamTree* param_tree) bool CGBLoaderParams::IsSetEnableSNP(void) const { - return m_ReaderParams->IsSetEnableSNP(); + return !m_EnableSNP.IsNull(); } bool CGBLoaderParams::GetEnableSNP(void) const { - return m_ReaderParams->GetEnableSNP(); + return m_EnableSNP.GetValue(); } void CGBLoaderParams::SetEnableSNP(bool enable) { - m_ReaderParams->SetEnableSNP(enable); + m_EnableSNP = enable; } bool CGBLoaderParams::IsSetEnableWGS(void) const { - return m_ReaderParams->IsSetEnableWGS(); + return !m_EnableWGS.IsNull(); } bool CGBLoaderParams::GetEnableWGS(void) const { - return m_ReaderParams->GetEnableWGS(); + return m_EnableWGS.GetValue(); } void CGBLoaderParams::SetEnableWGS(bool enable) { - m_ReaderParams->SetEnableWGS(enable); + m_EnableWGS = enable; } bool CGBLoaderParams::IsSetEnableCDD(void) const { - return m_ReaderParams->IsSetEnableCDD(); + return !m_EnableCDD.IsNull(); } bool CGBLoaderParams::GetEnableCDD(void) const { - return m_ReaderParams->GetEnableCDD(); + return m_EnableCDD.GetValue(); } void CGBLoaderParams::SetEnableCDD(bool enable) { - m_ReaderParams->SetEnableCDD(enable); + m_EnableCDD = enable; } @@ -252,6 +201,120 @@ NCBI_PARAM_DEF_EX(string, GENBANK, LOADER_METHOD, "", eParam_NoThread, GENBANK_LOADER_METHOD); typedef NCBI_PARAM_TYPE(GENBANK, LOADER_METHOD) TGenbankLoaderMethod; +#define NCBI_GBLOADER_PARAM_LOADER_PSG = "loader_psg" +#define NCBI_PSG_READER_NAME "psg" + + +string CGBDataLoader::x_GetLoaderMethod(const TParamTree* params) +{ + string method = GetParam(params, NCBI_GBLOADER_PARAM_LOADER_METHOD); + if ( method.empty() ) { + // try config first + method = TGenbankLoaderMethod::GetDefault(); + } + return method; +} + + +static bool s_CheckPSGMethod(const string& loader_method) +{ + bool use_psg = false; + if ( NStr::FindNoCase(loader_method, NCBI_PSG_READER_NAME) != NPOS ) { + vector str_list; + NStr::Split(loader_method, ";", str_list); + for (auto s : str_list) { + if ( NStr::EqualNocase(s, NCBI_PSG_READER_NAME) ) { +#ifdef HAVE_PSG_LOADER + if (str_list.size() == 1) { + use_psg = true; + break; + } + // PSG method can not be combined with any other methods. + NCBI_THROW(CLoaderException, eBadConfig, + "'PSG' loader method can not be combined with other methods: '" + loader_method + "'"); +#else + // PSG method is not available + NCBI_THROW(CLoaderException, eBadConfig, + "'PSG' loader method is not available: '" + loader_method + "'"); +#endif + } + } + } + return use_psg; +} + + +static bool s_GetDefaultUsePSG() +{ + static atomic initialized; + static atomic loader_psg; + if ( !initialized.load(memory_order_acquire) ) { + bool new_value = false; +#ifdef HAVE_PSG_LOADER + if ( TGenbankLoaderPsg::GetDefault() ) { + new_value = true; + } +#endif + if ( !new_value ) { + new_value = s_CheckPSGMethod(TGenbankLoaderMethod::GetDefault()); + } + loader_psg.store(new_value, memory_order_relaxed); + initialized.store(true, memory_order_release); + } + return loader_psg.load(memory_order_relaxed); +} + + +static bool s_GetDefaultUsePSG(const CGBLoaderParams::TParamTree* param_tree) +{ + if ( param_tree ) { + if ( const CGBLoaderParams::TParamTree* gb_params = CGBDataLoader::GetLoaderParams(param_tree) ) { +#ifdef HAVE_LOADER_PSG + auto loader_psg_param = CGBDataLoader::GetParam(gb_params, NCBI_GBLOADER_PARAM_LOADER_PSG); + if ( !loader_psg_param.empty() ) { + try { + return NStr::StringToBool(loader_psg_param); + } + catch (CStringException& ex) { + NCBI_THROW_FMT(CConfigException, eInvalidParameter, + "Cannot init GenBank loader, incorrect parameter format: " + << NCBI_GBLOADER_PARAM_LOADER_PSG << " : " << loader_psg_param + << ". " << ex.what()); + } + } +#endif + string loader_method = CGBDataLoader::GetParam(gb_params, NCBI_GBLOADER_PARAM_LOADER_METHOD); + if ( !loader_method.empty() ) { + return s_CheckPSGMethod(loader_method); + } + } + } + return s_GetDefaultUsePSG(); +} + + +bool CGBLoaderParams::GetUsePSG() const +{ + if ( m_UsePSGInitialized ) { + return m_UsePSG; + } + + string loader_method = GetLoaderMethod(); + if (loader_method.empty()) { + loader_method = GetReaderName(); + } + if (loader_method.empty()) { + // use default settings from config + m_UsePSG = s_GetDefaultUsePSG(GetParamTree()); + } + else { + m_UsePSG = s_CheckPSGMethod(loader_method); + } + m_UsePSGInitialized = true; + return m_UsePSG; +} + +/* void CGBDataLoader::SetLoaderMethod(CGBLoaderParams& params) { string loader_method = params.GetLoaderMethod(); @@ -298,7 +361,7 @@ void CGBDataLoader::SetLoaderMethod(CGBLoaderParams& params) "'PSG' loader method can not be combined with other methods: '" + loader_method + "'"); } } - +*/ CGBDataLoader::TRegisterLoaderInfo CGBDataLoader::RegisterInObjectManager( CObjectManager& om, @@ -307,19 +370,7 @@ CGBDataLoader::TRegisterLoaderInfo CGBDataLoader::RegisterInObjectManager( CObjectManager::TPriority priority) { CGBLoaderParams params(reader_ptr); - SetLoaderMethod(params); - - if (TGenbankLoaderPsg::GetDefault()) { -#if defined(HAVE_PSG_LOADER) - return CPSGDataLoader::RegisterInObjectManager(om, params, is_default, priority); -#else - ERR_POST_X(3, Critical << "PSG Loader is requested but not available"); - TRegisterLoaderInfo info; - info.Set(nullptr, false); - return info; -#endif - } - return CGBDataLoader_Native::RegisterInObjectManager(om, params, is_default, priority); + return RegisterInObjectManager(om, params, is_default, priority); } @@ -336,19 +387,7 @@ CGBDataLoader::TRegisterLoaderInfo CGBDataLoader::RegisterInObjectManager( CObjectManager::TPriority priority) { CGBLoaderParams params(reader_name); - SetLoaderMethod(params); - - if (TGenbankLoaderPsg::GetDefault()) { -#if defined(HAVE_PSG_LOADER) - return CPSGDataLoader::RegisterInObjectManager(om, params, is_default, priority); -#else - ERR_POST_X(3, Critical << "PSG Loader is requested but not available"); - TRegisterLoaderInfo info; - info.Set(nullptr, false); - return info; -#endif - } - return CGBDataLoader_Native::RegisterInObjectManager(om, params, is_default, priority); + return RegisterInObjectManager(om, params, is_default, priority); } @@ -368,6 +407,10 @@ CGBDataLoader::TRegisterLoaderInfo CGBDataLoader::RegisterInObjectManager( priority); } +string CGBDataLoader::GetLoaderNameFromArgs(EIncludeHUP include_hup) +{ + return GBLOADER_HUP_NAME; +} CGBDataLoader::TRegisterLoaderInfo CGBDataLoader::RegisterInObjectManager( CObjectManager& om, @@ -376,27 +419,18 @@ CGBDataLoader::TRegisterLoaderInfo CGBDataLoader::RegisterInObjectManager( CObjectManager::EIsDefault is_default, CObjectManager::TPriority priority) { - CGBLoaderParams params("PUBSEQOS2:PUBSEQOS"); + CGBLoaderParams params; params.SetHUPIncluded(true, web_cookie); - SetLoaderMethod(params); - - if (TGenbankLoaderPsg::GetDefault()) { -#if defined(HAVE_PSG_LOADER) - return CPSGDataLoader::RegisterInObjectManager(om, params, is_default, priority); -#else - ERR_POST_X(3, Critical << "PSG Loader is requested but not available"); - TRegisterLoaderInfo info; - info.Set(nullptr, false); - return info; -#endif - } - return CGBDataLoader_Native::RegisterInObjectManager(om, params, is_default, priority); + return RegisterInObjectManager(om, params, is_default, priority); } -string CGBDataLoader::GetLoaderNameFromArgs(EIncludeHUP /*include_hup*/) +string CGBDataLoader::GetLoaderNameFromArgs(EIncludeHUP include_hup, + const string& web_cookie) { - return GBLOADER_HUP_NAME; + CGBLoaderParams params; + params.SetHUPIncluded(true, web_cookie); + return GetLoaderNameFromArgs(params); } CGBDataLoader::TRegisterLoaderInfo CGBDataLoader::RegisterInObjectManager( @@ -410,6 +444,13 @@ CGBDataLoader::TRegisterLoaderInfo CGBDataLoader::RegisterInObjectManager( is_default, priority); } +string CGBDataLoader::GetLoaderNameFromArgs(const string& reader_name, + EIncludeHUP include_hup) +{ + return GBLOADER_HUP_NAME; +} + + CGBDataLoader::TRegisterLoaderInfo CGBDataLoader::RegisterInObjectManager( CObjectManager& om, const string& reader_name, @@ -420,26 +461,17 @@ CGBDataLoader::TRegisterLoaderInfo CGBDataLoader::RegisterInObjectManager( { CGBLoaderParams params(reader_name); params.SetHUPIncluded(true, web_cookie); - SetLoaderMethod(params); - - if (TGenbankLoaderPsg::GetDefault()) { -#if defined(HAVE_PSG_LOADER) - return CPSGDataLoader::RegisterInObjectManager(om, params, is_default, priority); -#else - ERR_POST_X(3, Critical << "PSG Loader is requested but not available"); - TRegisterLoaderInfo info; - info.Set(nullptr, false); - return info; -#endif - } - return CGBDataLoader_Native::RegisterInObjectManager(om, params, is_default, priority); + return RegisterInObjectManager(om, params, is_default, priority); } -string CGBDataLoader::GetLoaderNameFromArgs(const string& /*reader_name*/, - EIncludeHUP /*include_hup*/) +string CGBDataLoader::GetLoaderNameFromArgs(const string& reader_name, + EIncludeHUP include_hup, + const string& web_cookie) { - return GBLOADER_HUP_NAME; + CGBLoaderParams params(reader_name); + params.SetHUPIncluded(true, web_cookie); + return GetLoaderNameFromArgs(params); } @@ -450,23 +482,11 @@ CGBDataLoader::TRegisterLoaderInfo CGBDataLoader::RegisterInObjectManager( CObjectManager::TPriority priority) { CGBLoaderParams params(¶m_tree); - SetLoaderMethod(params); - - if (TGenbankLoaderPsg::GetDefault()) { -#if defined(HAVE_PSG_LOADER) - return CPSGDataLoader::RegisterInObjectManager(om, params, is_default, priority); -#else - ERR_POST_X(3, Critical << "PSG Loader is requested but not available"); - TRegisterLoaderInfo info; - info.Set(nullptr, false); - return info; -#endif - } - return CGBDataLoader_Native::RegisterInObjectManager(om, params, is_default, priority); + return RegisterInObjectManager(om, params, is_default, priority); } -string CGBDataLoader::GetLoaderNameFromArgs(const TParamTree& /* params */) +string CGBDataLoader::GetLoaderNameFromArgs(const TParamTree& param_tree) { return GBLOADER_NAME; } @@ -478,12 +498,9 @@ CGBDataLoader::TRegisterLoaderInfo CGBDataLoader::RegisterInObjectManager( CObjectManager::EIsDefault is_default, CObjectManager::TPriority priority) { - CGBLoaderParams params_nc(params); - SetLoaderMethod(params_nc); - - if (TGenbankLoaderPsg::GetDefault()) { + if ( params.GetUsePSG() ) { #if defined(HAVE_PSG_LOADER) - return CPSGDataLoader::RegisterInObjectManager(om, params_nc, is_default, priority); + return CPSGDataLoader::RegisterInObjectManager(om, params, is_default, priority); #else ERR_POST_X(3, Critical << "PSG Loader is requested but not available"); TRegisterLoaderInfo info; @@ -491,7 +508,7 @@ CGBDataLoader::TRegisterLoaderInfo CGBDataLoader::RegisterInObjectManager( return info; #endif } - return CGBDataLoader_Native::RegisterInObjectManager(om, params_nc, is_default, priority); + return CGBDataLoader_Native::RegisterInObjectManager(om, params, is_default, priority); } @@ -502,10 +519,14 @@ string CGBDataLoader::GetLoaderNameFromArgs(const CGBLoaderParams& params) } if (params.HasHUPIncluded()) { const string& web_cookie = params.GetWebCookie(); - if (web_cookie.empty()) + if (web_cookie.empty()) { return GBLOADER_HUP_NAME; - else - return GBLOADER_HUP_NAME + string("-") + web_cookie; + } + else { + CMD5 md5; + md5.Update(web_cookie.data(), web_cookie.size()); + return GBLOADER_HUP_NAME + string("-") + md5.GetHexSum(); + } } else { return GBLOADER_NAME; } @@ -515,7 +536,8 @@ string CGBDataLoader::GetLoaderNameFromArgs(const CGBLoaderParams& params) CGBDataLoader::CGBDataLoader(const string& loader_name, const CGBLoaderParams& params) : CDataLoader(loader_name), - m_HasHUPIncluded(params.HasHUPIncluded()) + m_HasHUPIncluded(params.HasHUPIncluded()), + m_WebCookie(params.GetWebCookie()) { } @@ -658,7 +680,7 @@ CDataLoader::TBlobId CGBDataLoader::GetBlobIdFromSatSatKey(int sat, int sub_sat) const { #if defined(HAVE_PSG_LOADER) - if (TGenbankLoaderPsg::GetDefault()) { + if ( IsUsingPSGLoader() ) { string str = NStr::NumericToString(sat)+'.'+NStr::NumericToString(sat_key); if ( sub_sat != CSeqref::eSubSat_main ) { str += '.'+NStr::NumericToString(sub_sat); @@ -711,11 +733,7 @@ CGBDataLoader::GetRealBlobId(const CTSE_Info& tse_info) const bool CGBDataLoader::IsUsingPSGLoader(void) { -#if defined(HAVE_PSG_LOADER) - return TGenbankLoaderPsg::GetDefault(); -#else - return false; -#endif + return s_GetDefaultUsePSG(); } diff --git a/c++/src/objtools/data_loaders/genbank/gbnative.cpp b/c++/src/objtools/data_loaders/genbank/gbnative.cpp index 15cdebc5..ef657edd 100644 --- a/c++/src/objtools/data_loaders/genbank/gbnative.cpp +++ b/c++/src/objtools/data_loaders/genbank/gbnative.cpp @@ -1,4 +1,4 @@ -/* $Id: gbnative.cpp 673835 2023-10-11 14:57:07Z ivanov $ +/* $Id: gbnative.cpp 675419 2023-11-21 19:45:39Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -98,6 +98,7 @@ static const char* const DEFAULT_DRV_ORDER = "id2:pubseqos"; #else static const char* const DEFAULT_DRV_ORDER = "id2"; #endif +static const char* const DEFAULT_HUP_DRV_ORDER = "pubseqos2:pubseqos"; #define GBLOADER_NAME "GBLOADER" #define GBLOADER_HUP_NAME "GBLOADER-HUP" @@ -143,23 +144,15 @@ private: }; -CGBDataLoader::TRegisterLoaderInfo CGBDataLoader_Native::ConvertRegInfo(const TGBMaker::TRegisterInfo& info) -{ - TRegisterLoaderInfo ret; - ret.Set(info.GetLoader(), info.IsCreated()); - return ret; -} - - CGBDataLoader::TRegisterLoaderInfo CGBDataLoader_Native::RegisterInObjectManager( CObjectManager& om, const CGBLoaderParams& params, CObjectManager::EIsDefault is_default, CObjectManager::TPriority priority) { - TGBMaker maker(params); + CGBLoaderMaker maker(params); CDataLoader::RegisterInObjectManager(om, maker, is_default, priority); - return ConvertRegInfo(maker.GetRegisterInfo()); + return maker.GetRegisterInfo(); } @@ -342,7 +335,7 @@ void CGBDataLoader_Native::x_CreateDriver(const CGBLoaderParams& params) if ( NStr::StartsWith(reader_name, "pubseqos") ) m_WebCookie = params.GetWebCookie(); - if ( x_CreateReaders(reader_name, gb_params, *params.m_ReaderParams, preopen) ) { + if ( x_CreateReaders(reader_name, gb_params, params, preopen) ) { if ( reader_name == "cache" || NStr::StartsWith(reader_name, "cache;") ) { x_CreateWriters("cache", gb_params); @@ -351,7 +344,7 @@ void CGBDataLoader_Native::x_CreateDriver(const CGBLoaderParams& params) } else { pair rw_name = GetReaderWriterName(gb_params, params); - if ( x_CreateReaders(rw_name.first, gb_params, *params.m_ReaderParams, preopen) ) { + if ( x_CreateReaders(rw_name.first, gb_params, params, preopen) ) { x_CreateWriters(rw_name.second, gb_params); } } @@ -362,6 +355,11 @@ pair CGBDataLoader_Native::GetReaderWriterName(const TParamTree* params, const CGBLoaderParams& loader_params) const { pair ret; + if ( HasHUPIncluded() ) { + // use default HUP readers + ret.first = DEFAULT_HUP_DRV_ORDER; + return ret; + } ret.first = GetParam(params, NCBI_GBLOADER_PARAM_READER_NAME); if ( ret.first.empty() ) { ret.first = TGenbankReaderName::GetDefault(); @@ -375,6 +373,9 @@ CGBDataLoader_Native::GetReaderWriterName(const TParamTree* params, const CGBLoa } if ( ret.first.empty() || ret.second.empty() ) { string method = loader_params.GetLoaderMethod(); + if ( method.empty() ) { + method = x_GetLoaderMethod(params); + } if ( method.empty() ) { // fall back default reader list method = DEFAULT_DRV_ORDER; @@ -395,14 +396,14 @@ CGBDataLoader_Native::GetReaderWriterName(const TParamTree* params, const CGBLoa bool CGBDataLoader_Native::x_CreateReaders(const string& str, const TParamTree* params, - const CReaderParams& reader_params, + const CGBLoaderParams& gb_params, CGBLoaderParams::EPreopenConnection preopen) { vector str_list; NStr::Split(str, ";", str_list); size_t reader_count = 0; for ( size_t i = 0; i < str_list.size(); ++i ) { - CRef reader(x_CreateReader(str_list[i], reader_params, params)); + CRef reader(x_CreateReader(str_list[i], gb_params, params)); if( reader ) { if ( HasHUPIncluded() ) { reader->SetIncludeHUP(true, m_WebCookie); @@ -428,7 +429,7 @@ void CGBDataLoader_Native::x_CreateWriters(const string& str, vector str_list; NStr::Split(str, ";", str_list); for ( size_t i = 0; i < str_list.size(); ++i ) { - if ( HasHUPIncluded() ) { + if ( HasHUPIncluded() || m_Dispatcher->HasReaderWithHUPIncluded() ) { NCBI_THROW(CObjMgrException, eRegisterError, "HUP GBLoader cannot have cache"); } @@ -488,7 +489,7 @@ static bool s_ForceDriver(const string& name) CReader* CGBDataLoader_Native::x_CreateReader(const string& name, - const CReaderParams& reader_params, + const CGBLoaderParams& gb_params, const TParamTree* params) { CRef manager = x_GetReaderManager(); @@ -501,6 +502,10 @@ CReader* CGBDataLoader_Native::x_CreateReader(const string& name, } } else { + CReaderParams reader_params; + reader_params.SetEnableWGS(gb_params.m_EnableWGS); + reader_params.SetEnableSNP(gb_params.m_EnableSNP); + reader_params.SetEnableCDD(gb_params.m_EnableCDD); ret->SetParams(reader_params); ret->InitializeCache(m_CacheManager, params); } diff --git a/c++/src/objtools/data_loaders/genbank/psg_loader.cpp b/c++/src/objtools/data_loaders/genbank/psg_loader.cpp index 2495b280..4efd4d1b 100644 --- a/c++/src/objtools/data_loaders/genbank/psg_loader.cpp +++ b/c++/src/objtools/data_loaders/genbank/psg_loader.cpp @@ -1,4 +1,4 @@ -/* $Id: psg_loader.cpp 673827 2023-10-11 14:56:08Z ivanov $ +/* $Id: psg_loader.cpp 675419 2023-11-21 19:45:39Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -172,10 +172,7 @@ CPSGDataLoader::TRegisterLoaderInfo CPSGDataLoader::RegisterInObjectManager( CObjectManager::EIsDefault is_default, CObjectManager::TPriority priority) { - CGBLoaderParams params; - TMaker maker(params); - CDataLoader::RegisterInObjectManager(om, maker, is_default, priority); - return ConvertRegInfo(maker.GetRegisterInfo()); + return RegisterInObjectManager(om, CGBLoaderParams(), is_default, priority); } @@ -185,9 +182,9 @@ CPSGDataLoader::TRegisterLoaderInfo CPSGDataLoader::RegisterInObjectManager( CObjectManager::EIsDefault is_default, CObjectManager::TPriority priority) { - TMaker maker(params); + CGBLoaderMaker maker(params); CDataLoader::RegisterInObjectManager(om, maker, is_default, priority); - return ConvertRegInfo(maker.GetRegisterInfo()); + return maker.GetRegisterInfo(); } @@ -527,14 +524,6 @@ CPSGDataLoader::x_GetRealBlobId(const TBlobId& blob_id) const } -CGBDataLoader::TRegisterLoaderInfo CPSGDataLoader::ConvertRegInfo(const TMaker::TRegisterInfo& info) -{ - TRegisterLoaderInfo ret; - ret.Set(info.GetLoader(), info.IsCreated()); - return ret; -} - - END_SCOPE(objects) // =========================================================================== diff --git a/c++/src/objtools/data_loaders/genbank/psg_loader_impl.cpp b/c++/src/objtools/data_loaders/genbank/psg_loader_impl.cpp index aa9cef4b..01d818f3 100644 --- a/c++/src/objtools/data_loaders/genbank/psg_loader_impl.cpp +++ b/c++/src/objtools/data_loaders/genbank/psg_loader_impl.cpp @@ -1,4 +1,4 @@ -/* $Id: psg_loader_impl.cpp 673835 2023-10-11 14:57:07Z ivanov $ +/* $Id: psg_loader_impl.cpp 681383 2024-04-09 12:29:10Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -841,6 +841,11 @@ bool CPSG_Task::CheckReplyStatus(void) m_Status = eCompleted; return false; } + if ( status == EPSG_Status::eForbidden ) { + m_GotForbidden = true; + m_Status = eCompleted; + return false; + } m_Status = eFailed; return false; } @@ -1137,10 +1142,18 @@ CPSGDataLoader_Impl::CPSGDataLoader_Impl(const CGBLoaderParams& params) m_BioseqCache.reset(new CPSGBioseqCache(m_CacheLifespan, cache_max_size)); m_AnnotCache.reset(new CPSGAnnotCache(m_CacheLifespan, cache_max_size)); m_BlobMap.reset(new CPSGBlobMap(m_CacheLifespan, cache_max_size)); - m_Queue = make_shared(service_name); + {{ + m_Queue = make_shared(service_name); + m_Queue->SetRequestFlags(params.HasHUPIncluded()? CPSG_Request::fIncludeHUP: CPSG_Request::fExcludeHUP); + if ( !params.GetWebCookie().empty() ) { + m_RequestContext = new CRequestContext(); + m_RequestContext->SetProperty("auth_token", params.GetWebCookie()); + } + }} + + m_CDDInfoCache.reset(new CPSGCDDInfoCache(m_CacheLifespan, cache_max_size)); if (TPSG_PrefetchCDD::GetDefault()) { - m_CDDInfoCache.reset(new CPSGCDDInfoCache(m_CacheLifespan, cache_max_size)); m_CDDPrefetchTask.Reset(new CPSG_PrefetchCDD_Task(*this)); m_ThreadPool->AddTask(m_CDDPrefetchTask); } @@ -1170,6 +1183,9 @@ CPSGDataLoader_Impl::~CPSGDataLoader_Impl(void) if (m_CDDPrefetchTask) { m_CDDPrefetchTask->Cancel(); } + // Make sure thread pool is destroyed before any tasks (e.g. CDD prefetch) + // and stops them all before the loader is destroyed. + m_ThreadPool.reset(); } @@ -1527,7 +1543,6 @@ CPSGDataLoader_Impl::GetRecordsOnce(CDataSource* data_source, else { locks.insert(tse_lock); if (m_CDDPrefetchTask) { - _ASSERT(m_CDDInfoCache); auto bioseq_info = m_BioseqCache->Get(idh); if (bioseq_info) { auto cdd_ids = x_GetCDDIds(bioseq_info->ids); @@ -2617,7 +2632,6 @@ CPSGDataLoader_Impl::x_MakeLoadLocalCDDEntryRequest(CDataSource* data_source, const CPsgBlobId& blob_id = dynamic_cast(*chunk->GetBlobId()); _ASSERT(x_IsLocalCDDEntryId(blob_id)); _ASSERT(!chunk->IsLoaded()); - bool failed = false; shared_ptr cdd_info; shared_ptr cdd_status; @@ -2719,7 +2733,7 @@ void CPSGDataLoader_Impl::LoadChunksOnce(CDataSource* data_source, const CPsgBlobId& blob_id = dynamic_cast(*chunk.GetBlobId()); shared_ptr request; if ( x_IsLocalCDDEntryId(blob_id) ) { - if (m_CDDInfoCache && m_CDDInfoCache->Find(blob_id.ToPsgId())) { + if (m_CDDInfoCache->Find(blob_id.ToPsgId())) { x_CreateEmptyLocalCDDEntry(data_source, *it); continue; } @@ -3061,7 +3075,6 @@ CDataLoader::TTSE_LockSet CPSGDataLoader_Impl::GetAnnotRecordsNAOnce( void CPSGDataLoader_Impl::PrefetchCDD(const TIds& ids) { if (ids.empty()) return; - _ASSERT(m_CDDInfoCache); _ASSERT(m_CDDPrefetchTask); SCDDIds cdd_ids = x_GetCDDIds(ids); @@ -3169,12 +3182,10 @@ void CPSGDataLoader_Impl::GetCDDAnnotsOnce(CDataSource* data_source, const TIds& ids = id_sets[i]; cdd_ids[i] = x_GetCDDIds(ids); // Skip if it's known that the bioseq has no CDDs. - if (m_CDDInfoCache) { - if (cdd_ids[i].gi && m_CDDInfoCache->Find(x_MakeLocalCDDEntryId(cdd_ids[i]))) { - // no CDDs for this Seq-id - loaded[i] = true; - continue; - } + if (cdd_ids[i].gi && m_CDDInfoCache->Find(x_MakeLocalCDDEntryId(cdd_ids[i]))) { + // no CDDs for this Seq-id + loaded[i] = true; + continue; } // Check if there's a loaded CDD blob. for (auto& id : ids) { @@ -3226,6 +3237,7 @@ void CPSGDataLoader_Impl::GetCDDAnnotsOnce(CDataSource* data_source, auto idx = task->m_Idx; if (!task->m_AnnotInfo || !task->m_BlobInfo || !task->m_BlobData) { // no CDDs + m_CDDInfoCache->Add(x_MakeLocalCDDEntryId(cdd_ids[idx]), true); loaded[idx] = true; continue; } @@ -3428,6 +3440,9 @@ void CPSGDataLoader_Impl::GetSequenceTypesOnce(const TIds& ids, TLoaded& loaded, shared_ptr CPSGDataLoader_Impl::x_SendRequest(shared_ptr request) { + if ( m_RequestContext ) { + request->SetRequestContext(m_RequestContext); + } return m_Queue->SendRequestAndGetReply(request, DEFAULT_DEADLINE); } diff --git a/c++/src/objtools/data_loaders/genbank/reader.cpp b/c++/src/objtools/data_loaders/genbank/reader.cpp index 4f6f9509..d4d51e42 100644 --- a/c++/src/objtools/data_loaders/genbank/reader.cpp +++ b/c++/src/objtools/data_loaders/genbank/reader.cpp @@ -1,4 +1,4 @@ -/* $Id: reader.cpp 673828 2023-10-11 14:56:18Z ivanov $ +/* $Id: reader.cpp 675188 2023-11-16 13:46:47Z ivanov $ * =========================================================================== * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information @@ -112,6 +112,7 @@ CReader::CReader(void) : m_Dispatcher(0), m_MaxConnections(0), m_PreopenConnection(DEFAULT_PREOPEN), + m_IncludeHUP(false), m_NextNewConnection(0), m_NumFreeConnections(0, 1000), m_MaximumRetryCount(3), diff --git a/c++/src/objtools/data_loaders/genbank/reader_id2_base.cpp b/c++/src/objtools/data_loaders/genbank/reader_id2_base.cpp index d9b27d10..4eb82463 100644 --- a/c++/src/objtools/data_loaders/genbank/reader_id2_base.cpp +++ b/c++/src/objtools/data_loaders/genbank/reader_id2_base.cpp @@ -1,4 +1,4 @@ -/* $Id: reader_id2_base.cpp 673828 2023-10-11 14:56:18Z ivanov $ +/* $Id: reader_id2_base.cpp 675193 2023-11-16 13:47:29Z ivanov $ * =========================================================================== * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information @@ -2308,7 +2308,7 @@ CId2ReaderBase::x_GetError(CReaderRequestResult& result, error_flags |= fError_no_data; break; case CID2_Error::eSeverity_restricted_data: - error_flags |= fError_no_data; + error_flags |= fError_restricted | fError_no_data; break; case CID2_Error::eSeverity_unsupported_command: m_AvoidRequest |= fAvoidRequest_nested_get_blob_info; @@ -2343,6 +2343,12 @@ CId2ReaderBase::x_GetMessageError(const CID2_Error& error) fError_suppressed_perm, "superceded"); // temp? sx_CheckErrorFlag(error, error_flags, fError_suppressed_temp, "superseded"); // perm? + sx_CheckErrorFlag(error, error_flags, + fError_restricted, + "Unknown satellite number 20 for bioseq info"); + if ( error_flags & fError_restricted ) { + error_flags |= fError_no_data; + } } break; case CID2_Error::eSeverity_failed_command: diff --git a/c++/src/objtools/edit/CMakeLists.edit.lib.txt b/c++/src/objtools/edit/CMakeLists.edit.lib.txt index e9ce41f5..9a36624a 100644 --- a/c++/src/objtools/edit/CMakeLists.edit.lib.txt +++ b/c++/src/objtools/edit/CMakeLists.edit.lib.txt @@ -1,4 +1,4 @@ -# $Id: CMakeLists.edit.lib.txt 672328 2023-09-05 18:18:13Z ivanov $ +# $Id: CMakeLists.edit.lib.txt 680757 2024-03-27 13:49:14Z ivanov $ NCBI_begin_lib(xobjedit) NCBI_sources( @@ -11,8 +11,6 @@ NCBI_begin_lib(xobjedit) parse_text_options publication_edit gap_trim external_annots feature_propagate text_object_description seq_edit pub_fix - huge_asn_reader huge_file huge_file_process huge_asn_loader - huge_asn_macro_reader ) NCBI_uses_toolkit_libraries(eutils efetch esearch esummary taxon3 valid xobjread xobjutil xlogging) NCBI_project_watchers(stakhovv gotvyans foleyjp choi) diff --git a/c++/src/objtools/edit/Makefile.edit.lib b/c++/src/objtools/edit/Makefile.edit.lib index 10cbfd3a..83b33890 100644 --- a/c++/src/objtools/edit/Makefile.edit.lib +++ b/c++/src/objtools/edit/Makefile.edit.lib @@ -1,4 +1,4 @@ -# $Id: Makefile.edit.lib 672330 2023-09-05 18:18:28Z ivanov $ +# $Id: Makefile.edit.lib 680757 2024-03-27 13:49:14Z ivanov $ # Build library "xobjedit" ############################### @@ -12,8 +12,6 @@ SRC = gene_utils seq_entry_edit promote autodef_with_tax \ parse_text_options publication_edit gap_trim \ external_annots feature_propagate text_object_description \ seq_edit pub_fix \ - huge_asn_reader huge_file huge_file_process huge_asn_loader \ - huge_asn_macro_reader LIB = xobjedit diff --git a/c++/src/objtools/edit/eutils_updater.cpp b/c++/src/objtools/edit/eutils_updater.cpp index c89ca485..d849df52 100644 --- a/c++/src/objtools/edit/eutils_updater.cpp +++ b/c++/src/objtools/edit/eutils_updater.cpp @@ -1,4 +1,4 @@ -/* $Id: eutils_updater.cpp 672327 2023-09-05 18:18:06Z ivanov $ +/* $Id: eutils_updater.cpp 676570 2023-12-18 19:55:37Z sadyrovr $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -116,105 +116,105 @@ inline eCitMatchFlags constexpr operator|(eCitMatchFlags a, eCitMatchFlags b) } -class CECitMatch_Request : public CESearch_Request +static string GetFirstAuthor(const CAuth_list& authors) { -public: - CECitMatch_Request(CRef& ctx) : - CESearch_Request("pubmed", ctx) - { - } - - static string GetFirstAuthor(const CAuth_list& authors) - { - if (authors.IsSetNames()) { - const auto& N(authors.GetNames()); - if (N.IsMl()) { - if (! N.GetMl().empty()) { - return N.GetMl().front(); - } - } else if (N.IsStd()) { - // convert to ML - if (! N.GetStd().empty()) { - const CAuthor& first_author(*N.GetStd().front()); - if (first_author.IsSetName()) { - const CPerson_id& person(first_author.GetName()); - if (person.IsName()) { - const CName_std& name_std(person.GetName()); - if (name_std.IsSetLast()) { - string name(name_std.GetLast()); - if (name_std.IsSetInitials()) { - name += ' '; - for (char c : name_std.GetInitials()) { - if (isalpha(c)) { - if (islower(c)) { - c = toupper(c); - } - name += c; + if (authors.IsSetNames()) { + const auto& N(authors.GetNames()); + if (N.IsMl()) { + if (! N.GetMl().empty()) { + return N.GetMl().front(); + } + } else if (N.IsStd()) { + // convert to ML + if (! N.GetStd().empty()) { + const CAuthor& first_author(*N.GetStd().front()); + if (first_author.IsSetName()) { + const CPerson_id& person(first_author.GetName()); + if (person.IsName()) { + const CName_std& name_std(person.GetName()); + if (name_std.IsSetLast()) { + string name(name_std.GetLast()); + if (name_std.IsSetInitials()) { + name += ' '; + for (char c : name_std.GetInitials()) { + if (isalpha(c)) { + if (islower(c)) { + c = toupper(c); } + name += c; } } - return name; } + return name; } } } } } - - return {}; } - static void FillFromArticle(SCitMatch& cm, const CCit_art& A) - { - if (A.IsSetAuthors()) { - cm.Author = GetFirstAuthor(A.GetAuthors()); - } + return {}; +} - if (A.IsSetFrom() && A.GetFrom().IsJournal()) { - const CCit_jour& J = A.GetFrom().GetJournal(); - if (J.IsSetTitle()) { - const CTitle& T = J.GetTitle(); - if (T.IsSet() && ! T.Get().empty()) { - cm.Journal = T.GetTitle(); - } +void SCitMatch::FillFromArticle(const CCit_art& A) +{ + if (A.IsSetAuthors()) { + this->Author = GetFirstAuthor(A.GetAuthors()); + } + + if (A.IsSetFrom() && A.GetFrom().IsJournal()) { + const CCit_jour& J = A.GetFrom().GetJournal(); + if (J.IsSetTitle()) { + const CTitle& T = J.GetTitle(); + if (T.IsSet() && ! T.Get().empty()) { + this->Journal = T.GetTitle(); } - if (J.IsSetImp()) { - const CImprint& I = J.GetImp(); - if (I.IsSetDate()) { - const CDate& D = I.GetDate(); - if (D.IsStd()) { - auto year = D.GetStd().GetYear(); - if (year > 0) { - cm.Year = to_string(year); - } - } - } - if (I.IsSetVolume()) { - cm.Volume = I.GetVolume(); - } - if (I.IsSetPages()) { - cm.Page = I.GetPages(); - auto pos = cm.Page.find('-'); - if (pos != string::npos) { - cm.Page.resize(pos); + } + if (J.IsSetImp()) { + const CImprint& I = J.GetImp(); + if (I.IsSetDate()) { + const CDate& D = I.GetDate(); + if (D.IsStd()) { + auto year = D.GetStd().GetYear(); + if (year > 0) { + this->Year = to_string(year); } } - if (I.IsSetIssue()) { - cm.Issue = I.GetIssue(); - } - if (I.IsSetPrepub()) { - cm.InPress = (I.GetPrepub() == CImprint::ePrepub_in_press); + } + if (I.IsSetVolume()) { + this->Volume = I.GetVolume(); + } + if (I.IsSetPages()) { + this->Page = I.GetPages(); + auto pos = this->Page.find('-'); + if (pos != string::npos) { + this->Page.resize(pos); } } + if (I.IsSetIssue()) { + this->Issue = I.GetIssue(); + } + if (I.IsSetPrepub()) { + this->InPress = (I.GetPrepub() == CImprint::ePrepub_in_press); + } } + } - if (A.IsSetTitle()) { - const CTitle& T = A.GetTitle(); - if (T.IsSet() && ! T.Get().empty()) { - cm.Title = T.GetTitle(); - } + if (A.IsSetTitle()) { + const CTitle& T = A.GetTitle(); + if (T.IsSet() && ! T.Get().empty()) { + this->Title = T.GetTitle(); } } +} + +class CECitMatch_Request : public CESearch_Request +{ +public: + CECitMatch_Request(CRef& ctx) : + CESearch_Request("pubmed", ctx) + { + } static void NormalizeJournal(string& s) { @@ -350,16 +350,16 @@ public: }; -CEUtilsUpdaterBase::CEUtilsUpdaterBase(bool bNorm) : - m_Ctx(new CEUtils_ConnContext), m_bNorm(bNorm) +CEUtilsUpdater::CEUtilsUpdater(ENormalize norm) : + m_Ctx(new CEUtils_ConnContext), m_Norm(norm) { } -TEntrezId CEUtilsUpdaterBase::CitMatch(const CPub& pub, EPubmedError* perr) +TEntrezId CEUtilsUpdater::CitMatch(const CPub& pub, EPubmedError* perr) { if (pub.IsArticle()) { SCitMatch cm; - CECitMatch_Request::FillFromArticle(cm, pub.GetArticle()); + cm.FillFromArticle(pub.GetArticle()); return CitMatch(cm, perr); } else { if (perr) { @@ -369,7 +369,7 @@ TEntrezId CEUtilsUpdaterBase::CitMatch(const CPub& pub, EPubmedError* perr) } } -TEntrezId CEUtilsUpdaterBase::CitMatch(const SCitMatch& cm, EPubmedError* perr) +TEntrezId CEUtilsUpdater::CitMatch(const SCitMatch& cm, EPubmedError* perr) { unique_ptr req(new CECitMatch_Request(m_Ctx)); req->SetField("title"); @@ -421,10 +421,10 @@ TEntrezId CEUtilsUpdaterBase::CitMatch(const SCitMatch& cm, EPubmedError* perr) } -void IPubmedUpdater::Normalize(CPub& pub) +static void Normalize(CPub& pub) { - if (pub.IsArticle()) { - CCit_art& A = pub.SetArticle(); + if (pub.IsMedline() && pub.GetMedline().IsSetCit()) { + CCit_art& A = pub.SetMedline().SetCit(); #if 0 // Ensure period at title end; RW-1946 if (A.IsSetTitle() && ! A.GetTitle().Get().empty()) { @@ -499,7 +499,7 @@ void IPubmedUpdater::Normalize(CPub& pub) } } -CRef CEUtilsUpdaterBase::x_GetPub(TEntrezId pmid, EPubmedError* perr) +CRef CEUtilsUpdater::x_GetPubmedEntry(TEntrezId pmid, EPubmedError* perr) { unique_ptr req( new CEFetch_Literature_Request(CEFetch_Literature_Request::eDB_pubmed, m_Ctx) @@ -514,6 +514,11 @@ CRef CEUtilsUpdaterBase::x_GetPub(TEntrezId pmid, EPubmedError* perr) req->Read(&content); try { CNcbiIstrstream(content) >> MSerial_Xml >> pas; + } catch (const CSerialException&) { + if (perr) { + *perr = EPubmedError::operational_error; + } + return {}; } catch (...) { if (perr) { *perr = EPubmedError::citation_not_found; @@ -533,19 +538,7 @@ CRef CEUtilsUpdaterBase::x_GetPub(TEntrezId pmid, EPubmedError* perr) const eutils::CPubmedBookArticle& article = ppf.GetPubmedBookArticle(); pme.Reset(article.ToPubmed_entry()); } - - if (pme && pme->IsSetMedent()) { - const CMedline_entry& mle = pme->GetMedent(); - if (mle.IsSetCit()) { - CRef pub(new CPub); - pub->SetArticle().Assign(mle.GetCit()); - if (m_bNorm) - Normalize(*pub); - if (m_pub_interceptor) - m_pub_interceptor(pub); - return pub; - } - } + return pme; } if (perr) { @@ -554,13 +547,40 @@ CRef CEUtilsUpdaterBase::x_GetPub(TEntrezId pmid, EPubmedError* perr) return {}; } +CRef CEUtilsUpdater::x_GetPub(TEntrezId pmid, EPubmedError* perr) +{ + CRef pme = x_GetPubmedEntry(pmid, perr); + if (pme && pme->IsSetMedent()) { + CRef pub(new CPub); + pub->SetMedline().Assign(pme->GetMedent()); + if (m_Norm == ENormalize::On) { + Normalize(*pub); + } + if (m_pub_interceptor) { + m_pub_interceptor(pub); + } + return pub; + } + return {}; +} CRef CEUtilsUpdater::GetPub(TEntrezId pmid, EPubmedError* perr) +{ + CConstRef pub = GetPubmedEntry(pmid, perr); + if (pub && pub->IsMedline() && pub->GetMedline().IsSetCit()) { + CRef ret(new CPub); + ret->SetArticle().Assign(pub->GetMedline().GetCit()); + return ret; + } + return {}; +} + +CRef CEUtilsUpdater::GetPubmedEntry(TEntrezId pmid, EPubmedError* perr) { return x_GetPub(pmid, perr); } -CRef CEUtilsUpdaterWithCache::GetPub(TEntrezId pmid, EPubmedError* perr) +CRef CEUtilsUpdaterWithCache::GetPubmedEntry(TEntrezId pmid, EPubmedError* perr) { m_num_requests++; CConstRef pub; @@ -642,7 +662,7 @@ static bool ParseJson(const string& json, vector& pmids, string& msg) return true; } -bool CEUtilsUpdaterBase::DoPubSearch(const vector& query, vector& pmids) +bool CEUtilsUpdater::DoPubSearch(const vector& query, vector& pmids) { static const string hostname = "pubmed.ncbi.nlm.nih.gov"; static const string path = "/api/citmatch"; diff --git a/c++/src/objtools/edit/feattable_edit.cpp b/c++/src/objtools/edit/feattable_edit.cpp index 2d054dcd..0576c7f5 100644 --- a/c++/src/objtools/edit/feattable_edit.cpp +++ b/c++/src/objtools/edit/feattable_edit.cpp @@ -1,4 +1,4 @@ -/* $Id: feattable_edit.cpp 645555 2022-02-17 15:02:17Z ludwigf $ +/* $Id: feattable_edit.cpp 677913 2024-01-25 14:13:17Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -176,59 +176,71 @@ void CFeatTableEdit::GenerateMissingMrnaForCds() sel.IncludeFeatSubtype(CSeqFeatData::eSubtype_cdregion); CFeat_CI it(mHandle, sel); for (; it; ++it) { - const CSeq_feat& cds = it->GetOriginalFeature(); - CConstRef pOverlappingRna = - sequence::GetBestOverlappingFeat( - cds.GetLocation(), - CSeqFeatData::e_Rna, - sequence::eOverlap_CheckIntRev, - *mpScope); - if (pOverlappingRna) { - continue; - } - CRef pRna(new CSeq_feat); - pRna->SetData().SetRna().SetType(CRNA_ref::eType_mRNA); - pRna->SetLocation().Assign(cds.GetLocation()); - pRna->SetLocation().SetPartialStart(false, eExtreme_Positional); - pRna->SetLocation().SetPartialStop(false, eExtreme_Positional); - pRna->ResetPartial(); - //product name - pRna->SetData().SetRna().SetExt().SetName( - sGetCdsProductName(cds, *mpScope)); - - //find proper name for rna - string rnaId(xNextFeatId()); - pRna->SetId().SetLocal().SetStr(rnaId); - - //add rna xref to cds - CSeq_feat_EditHandle feh(mpScope->GetObjectHandle(cds)); - feh.AddFeatXref(rnaId); - - //add cds xref to rna - CRef pFeatId(new CFeat_id); - pFeatId->Assign(cds.GetId()); - CRef pRnaXref(new CSeqFeatXref); - pRnaXref->SetId(*pFeatId); - pRna->SetXref().push_back(pRnaXref); + xGenerateMissingMrnaForCds(*it); + } +} - CMappedFeat parentGene = feature::GetBestGeneForFeat(*it, &mTree); - if (parentGene) { - //if gene exists, add gene xref to rna - CSeq_feat_EditHandle geh(mpScope->GetObjectHandle( - parentGene.GetOriginalFeature())); - geh.AddFeatXref(rnaId); - //if gene exists, add rna xref to gene - CRef pGeneId(new CFeat_id); - pGeneId->Assign(parentGene.GetId()); - CRef pRnaXref(new CSeqFeatXref); - pRnaXref->SetId(*pGeneId); - pRna->SetXref().push_back(pRnaXref); - } - //add new rna to feature table - mEditHandle.AddFeat(*pRna); - mTree.AddFeature(mpScope->GetObjectHandle(*pRna)); +// ------------------------------------------------------------------------- +void CFeatTableEdit::xGenerateMissingMrnaForCds(const CMappedFeat& mappedCds) +// ------------------------------------------------------------------------- +{ + + const CSeq_feat& cds = mappedCds.GetOriginalFeature(); + CConstRef pOverlappingRna = + sequence::GetBestOverlappingFeat( + cds.GetLocation(), + CSeqFeatData::e_Rna, + sequence::eOverlap_CheckIntRev, + *mpScope); + + if (pOverlappingRna) { + return; + } + + CRef pRna(new CSeq_feat); + pRna->SetData().SetRna().SetType(CRNA_ref::eType_mRNA); + pRna->SetLocation().Assign(cds.GetLocation()); + pRna->SetLocation().SetPartialStart(false, eExtreme_Positional); + pRna->SetLocation().SetPartialStop(false, eExtreme_Positional); + pRna->ResetPartial(); + + //product name + pRna->SetData().SetRna().SetExt().SetName( + sGetCdsProductName(cds, *mpScope)); + + //find proper name for rna + string rnaId(xNextFeatId()); + pRna->SetId().SetLocal().SetStr(rnaId); + + //add rna xref to cds + CSeq_feat_EditHandle feh(mpScope->GetObjectHandle(cds)); + feh.AddFeatXref(rnaId); + + //add cds xref to rna + CRef pFeatId(new CFeat_id); + pFeatId->Assign(cds.GetId()); + CRef pRnaXref(new CSeqFeatXref); + pRnaXref->SetId(*pFeatId); + pRna->SetXref().push_back(pRnaXref); + + CMappedFeat parentGene = feature::GetBestGeneForFeat(mappedCds, &mTree); + if (parentGene) { + //if gene exists, add gene xref to rna + CSeq_feat_EditHandle geh(mpScope->GetObjectHandle( + parentGene.GetOriginalFeature())); + geh.AddFeatXref(rnaId); + //if gene exists, add rna xref to gene + CRef pGeneId(new CFeat_id); + pGeneId->Assign(parentGene.GetId()); + CRef pRnaXref(new CSeqFeatXref); + pRnaXref->SetId(*pGeneId); + pRna->SetXref().push_back(pRnaXref); } + + //add new rna to feature table + mEditHandle.AddFeat(*pRna); + mTree.AddFeature(mpScope->GetObjectHandle(*pRna)); } // ------------------------------------------------------------------------- @@ -498,90 +510,98 @@ static string s_GetTranscriptIdFromMrna(const CMappedFeat& mrna) return transcript_id; } +static bool s_IsGenbankId(const string& id) +{ + return NStr::StartsWith(id, "gb|"); +} + +static bool s_IsGeneralId(const string& id) +{ + return NStr::StartsWith(id, "gnl|"); +} // --------------------------------------------------------------------------- void CFeatTableEdit::xAddTranscriptAndProteinIdsToCdsAndParentMrna(CMappedFeat& cds) // --------------------------------------------------------------------------- { CMappedFeat mrna = feature::GetBestMrnaForCds(cds, &mTree); - string protein_id = cds.GetNamedQual("protein_id"); - const bool no_protein_id_qual = NStr::IsBlank(protein_id); - if (no_protein_id_qual) { // no protein_id qual on CDS - check mRNA and ID qual + + string proteinId = cds.GetNamedQual("protein_id"); + const bool noProteinIdQual = NStr::IsBlank(proteinId); + if (noProteinIdQual) { // no protein_id qual on CDS - check mRNA and ID qual if (mrna) { - protein_id = mrna.GetNamedQual("protein_id"); + proteinId = mrna.GetNamedQual("protein_id"); } - if (NStr::IsBlank(protein_id)) { - protein_id = cds.GetNamedQual("ID"); + if (NStr::IsBlank(proteinId)) { + proteinId = cds.GetNamedQual("ID"); } } - bool is_genbank_protein = NStr::StartsWith(protein_id, "gb|"); - string transcript_id = cds.GetNamedQual("transcript_id"); - const bool no_transcript_id_qual = NStr::IsBlank(transcript_id); - if (no_transcript_id_qual) { // no transcript_id qual on CDS - check mRNA - if (mrna) { - transcript_id = s_GetTranscriptIdFromMrna(mrna); - } + const bool isGenbankProtein = s_IsGenbankId(proteinId); + + string transcriptId = cds.GetNamedQual("transcript_id"); + const bool noTranscriptIdQual = NStr::IsBlank(transcriptId); + if (noTranscriptIdQual && mrna) { // no transcript_id qual on CDS - check mRNA + transcriptId = s_GetTranscriptIdFromMrna(mrna); } - bool is_genbank_transcript = NStr::StartsWith(transcript_id, "gb|"); + + const bool isGenbankTranscript = s_IsGenbankId(transcriptId); - if ((is_genbank_protein || NStr::StartsWith(protein_id, "gnl|")) && - (is_genbank_transcript || NStr::StartsWith(transcript_id, "gnl|"))) { + if ((isGenbankProtein || s_IsGeneralId(proteinId)) && + (isGenbankTranscript || s_IsGeneralId(transcriptId))) { // No further processing of ids is required - simply assign to features - if (no_protein_id_qual) { - // protein_id from ID qualifier or mRNA => need to add protein_id qual to CDS - xFeatureSetQualifier(cds, "protein_id", protein_id); - } - - if (no_transcript_id_qual) { - // transcript_id from mRNA => need to add transcript_id qual to CDS - xFeatureSetQualifier(cds, "transcript_id", transcript_id); + if (noProteinIdQual) { + // proteinId from ID qualifier or mRNA => need to add protein_id qual to CDS + xFeatureSetQualifier(cds, "protein_id", proteinId); } if (mrna) { - xAddTranscriptAndProteinIdsToMrna(transcript_id, protein_id, mrna); + if (noTranscriptIdQual) { + // transcript_id from mRNA => need to add transcript_id qual to CDS + xFeatureSetQualifier(cds, "transcript_id", transcriptId); + } + xAddTranscriptAndProteinIdsToMrna(transcriptId, proteinId, mrna); } return; } // else need to generate and/or process ids before we add them to features - bool has_protein_id = !NStr::IsBlank(protein_id); - bool has_transcript_id = !NStr::IsBlank(transcript_id); + bool hasProteinId = !NStr::IsBlank(proteinId); + bool hasTranscriptId = !NStr::IsBlank(transcriptId); - if (has_protein_id && has_transcript_id) { - if (!is_genbank_protein && (transcript_id == protein_id)) { - protein_id = "cds." + protein_id; + if (hasProteinId && hasTranscriptId) { + if (!isGenbankProtein && (transcriptId == proteinId)) { + proteinId = "cds." + proteinId; } } else { - if (has_protein_id && !is_genbank_protein) { - transcript_id = "mrna." + protein_id; - has_transcript_id = true; + if (hasProteinId && !isGenbankProtein) { + transcriptId = "mrna." + proteinId; + hasTranscriptId = true; } - else if (has_transcript_id && !is_genbank_transcript) { - protein_id = "cds." + transcript_id; - has_protein_id = true; + else if (hasTranscriptId && !isGenbankTranscript) { + proteinId = "cds." + transcriptId; + hasProteinId = true; } - // Generate new transcript_id and protein_id if necessary - if (!has_transcript_id) { - transcript_id = xNextTranscriptId(cds); + // Generate new transcriptId and proteinId if necessary + if (!hasTranscriptId && mrna) { + transcriptId = xNextTranscriptId(cds); } - if (!has_protein_id) { - protein_id = xNextProteinId(cds); + if (!hasProteinId) { + proteinId = xNextProteinId(cds); } } - xConvertToGeneralIds(cds, transcript_id, protein_id); + xConvertToGeneralIds(cds, transcriptId, proteinId); if (mrna) { - xAddTranscriptAndProteinIdsToMrna(transcript_id, protein_id, mrna); + xAddTranscriptAndProteinIdsToMrna(transcriptId, proteinId, mrna); + xFeatureSetQualifier(cds, "transcript_id", transcriptId); } - - xFeatureSetQualifier(cds, "transcript_id", transcript_id); - xFeatureSetQualifier(cds, "protein_id", protein_id); + xFeatureSetQualifier(cds, "protein_id", proteinId); } @@ -646,53 +666,51 @@ void CFeatTableEdit::xAddTranscriptAndProteinIdsToUnmatchedMrna(CMappedFeat& mrn return; } - string transcript_id = mrna.GetNamedQual("transcript_id"); - bool no_transcript_id_qual = NStr::IsBlank(transcript_id); - if (no_transcript_id_qual) { - transcript_id = mrna.GetNamedQual("ID"); + string transcriptId = mrna.GetNamedQual("transcript_id"); + bool noTranscriptIdQual = NStr::IsBlank(transcriptId); + if (noTranscriptIdQual) { + transcriptId = mrna.GetNamedQual("ID"); } - const bool is_genbank_transcript = NStr::StartsWith(transcript_id, "gb|"); + const bool isGenbankTranscript = s_IsGenbankId(transcriptId); - string protein_id = mrna.GetNamedQual("protein_id"); - const bool is_genbank_protein = NStr::StartsWith(protein_id, "gb|"); + string proteinId = mrna.GetNamedQual("protein_id"); + const bool isGenbankProtein = s_IsGenbankId(proteinId); - if ((is_genbank_protein || - NStr::StartsWith(protein_id, "gnl|")) && - (is_genbank_transcript || - NStr::StartsWith(transcript_id, "gnl|"))) { - if (no_transcript_id_qual) { - xFeatureSetQualifier(mrna, "transcript_id", transcript_id); + if ((isGenbankProtein || s_IsGeneralId(proteinId)) && + (isGenbankTranscript || s_IsGeneralId(transcriptId))) { + if (noTranscriptIdQual) { + xFeatureSetQualifier(mrna, "transcript_id", transcriptId); } return; } - if (!NStr::IsBlank(protein_id) && - !NStr::IsBlank(transcript_id)) { - if ((transcript_id == protein_id) && - !is_genbank_transcript) { - protein_id = "cds." + protein_id; + if (!NStr::IsBlank(proteinId) && + !NStr::IsBlank(transcriptId)) { + if ((transcriptId == proteinId) && + !isGenbankTranscript) { + proteinId = "cds." + proteinId; } } - else - if (!is_genbank_protein && !NStr::IsBlank(protein_id)) { - transcript_id = "mrna." + protein_id; + else { // Empty proteinId and/or transcriptId + if (!isGenbankProtein && !NStr::IsBlank(proteinId)) { + transcriptId = "mrna." + proteinId; } - else - if (!is_genbank_transcript && !NStr::IsBlank(transcript_id)) { - protein_id = "cds." + transcript_id; - } + else if (!isGenbankTranscript && !NStr::IsBlank(transcriptId)) { + proteinId = "cds." + transcriptId; + } + } - if (NStr::IsBlank(protein_id)) { - protein_id = xNextProteinId(mrna); + if (NStr::IsBlank(proteinId)) { + proteinId = xNextProteinId(mrna); } - if (NStr::IsBlank(transcript_id)) { - transcript_id = xNextTranscriptId(mrna); + if (NStr::IsBlank(transcriptId)) { + transcriptId = xNextTranscriptId(mrna); } - xConvertToGeneralIds(mrna, transcript_id, protein_id); + xConvertToGeneralIds(mrna, transcriptId, proteinId); - xFeatureSetQualifier(mrna, "transcript_id", transcript_id); - xFeatureSetQualifier(mrna, "protein_id", protein_id); + xFeatureSetQualifier(mrna, "transcript_id", transcriptId); + xFeatureSetQualifier(mrna, "protein_id", proteinId); mProcessedMrnas.insert(mrna); } @@ -769,6 +787,16 @@ void CFeatTableEdit::xGenerateMissingGeneForChoice( { SAnnotSelector sel; sel.IncludeFeatType(choice); + xGenerateMissingGeneForFeats(sel, pMerger); +} + + +// --------------------------------------------------------------------------- +void CFeatTableEdit::xGenerateMissingGeneForFeats( + const SAnnotSelector& sel, + const CGff3LocationMerger* pMerger) +// --------------------------------------------------------------------------- +{ CFeat_CI it(mHandle, sel); for (; it; ++it) { CMappedFeat mf = *it; @@ -782,24 +810,26 @@ void CFeatTableEdit::xGenerateMissingGeneForChoice( } +// --------------------------------------------------------------------------- +void CFeatTableEdit::xGenerateMissingGeneForFeat( + const CMappedFeat& feat) +// --------------------------------------------------------------------------- +{ + if (xCreateMissingParentGene(feat, mSequenceSize)) { + xAdjustExistingParentGene(feat); + } +} + + // --------------------------------------------------------------------------- void CFeatTableEdit::xGenerateMissingGeneForSubtype( CSeqFeatData::ESubtype subType, const CGff3LocationMerger* pMerger) - // --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- { SAnnotSelector sel; sel.IncludeFeatSubtype(subType); - CFeat_CI it(mHandle, sel); - for (; it; ++it) { - CMappedFeat mf = *it; - auto seqId = mf.GetLocationId().AsString(); - auto sequenceSize = - (pMerger ? pMerger->GetSequenceSize(seqId) : mSequenceSize); - if (xCreateMissingParentGene(mf, sequenceSize)) { - xAdjustExistingParentGene(mf); - } - } + xGenerateMissingGeneForFeats(sel, pMerger); } // ---------------------------------------------------------------------------- @@ -1397,7 +1427,7 @@ void CFeatTableEdit::GenerateMissingParentFeatures( if (forEukaryote) { GenerateMissingParentFeaturesForEukaryote(pMerger); } - else { + else { GenerateMissingParentFeaturesForProkaryote(pMerger); } mTree = feature::CFeatTree(mHandle); @@ -1407,11 +1437,35 @@ void CFeatTableEdit::GenerateMissingParentFeatures( // ---------------------------------------------------------------------------- void CFeatTableEdit::GenerateMissingParentFeaturesForEukaryote( const CGff3LocationMerger* pMerger) - // ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- { - GenerateMissingMrnaForCds(); - xGenerateMissingGeneForChoice( - CSeqFeatData::e_Rna, nullptr); //sequence not circular for eukaryote + { + SAnnotSelector sel; + sel.IncludeFeatSubtype(CSeqFeatData::eSubtype_cdregion); + for (CFeat_CI it(mHandle, sel); it; ++it) { + if (auto parent = mTree.GetParent(*it); parent) { + auto subtype = parent.GetOriginalFeature().GetData().GetSubtype(); + if (subtype == CSeqFeatData::eSubtype_mRNA || + subtype == CSeqFeatData::eSubtype_V_segment || + subtype == CSeqFeatData::eSubtype_D_segment || + subtype == CSeqFeatData::eSubtype_J_segment || + subtype == CSeqFeatData::eSubtype_C_region) { + continue; + } + } + xGenerateMissingMrnaForCds(*it); + } + } + + { + SAnnotSelector sel; + sel.IncludeFeatType(CSeqFeatData::e_Rna); + sel.IncludeFeatSubtype(CSeqFeatData::eSubtype_V_segment); + sel.IncludeFeatSubtype(CSeqFeatData::eSubtype_D_segment); + sel.IncludeFeatSubtype(CSeqFeatData::eSubtype_J_segment); + sel.IncludeFeatSubtype(CSeqFeatData::eSubtype_C_region); + xGenerateMissingGeneForFeats(sel, nullptr); //sequence not circular for eukaryote + } } diff --git a/c++/src/objtools/edit/huge_asn_loader.cpp b/c++/src/objtools/edit/huge_asn_loader.cpp deleted file mode 100644 index 06d511bf..00000000 --- a/c++/src/objtools/edit/huge_asn_loader.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/* $Id: huge_asn_loader.cpp 651793 2022-06-24 19:29:43Z gotvyans $ -* =========================================================================== -* -* PUBLIC DOMAIN NOTICE -* National Center for Biotechnology Information -* -* This software/database is a "United States Government Work" under the -* terms of the United States Copyright Act. It was written as part of -* the author's official duties as a United States Government employee and -* thus cannot be copyrighted. This software/database is freely available -* to the public for use. The National Library of Medicine and the U.S. -* Government have not placed any restriction on its use or reproduction. -* -* Although all reasonable efforts have been taken to ensure the accuracy -* and reliability of the software and data, the NLM and the U.S. -* Government do not and cannot warrant the performance or results that -* may be obtained by using this software or data. The NLM and the U.S. -* Government disclaim all warranties, express or implied, including -* warranties of performance, merchantability or fitness for any particular -* purpose. -* -* Please cite the author in any work or product based on this material. -* -* =========================================================================== -* -* Authors: Sergiy Gotvyanskyy -* -* File Description: -* -* -*/ - -#include - -#include -#include -#include - -#include -#include -#include - -BEGIN_NCBI_SCOPE -BEGIN_SCOPE(objects) -BEGIN_SCOPE(edit) - -namespace -{ - -class CLoaderMakerWithReader : public CLoaderMaker_Base -{ -public: - CLoaderMakerWithReader(const string& name, CHugeAsnReader* reader): - m_reader(reader) - { - m_Name = name; - } - - virtual CDataLoader* CreateLoader(void) const - { - return new CHugeAsnDataLoader(m_Name, m_reader); - } - - typedef CHugeAsnDataLoader::TRegisterLoaderInfo TRegisterInfo; - TRegisterInfo GetRegisterInfo(void) - { - TRegisterInfo info; - info.Set(m_RegisterInfo.GetLoader(), m_RegisterInfo.IsCreated()); - return info; - } -private: - CHugeAsnReader* m_reader = nullptr; -}; - -} // anonymous namespace - -CHugeAsnDataLoader::CHugeAsnDataLoader(const string& name, CHugeAsnReader* reader): - CDataLoader(name), - m_reader{reader} -{ -} - - -CHugeAsnDataLoader::~CHugeAsnDataLoader() -{ - if (m_owning) - { - delete m_reader; - } -} - -#ifdef _DEBUG -//#define DEBUG_HUGE_ASN_LOADER -#endif - -#ifdef DEBUG_HUGE_ASN_LOADER -static thread_local std::string loading_ids; -#endif - -CDataLoader::TBlobId CHugeAsnDataLoader::GetBlobId(const CSeq_id_Handle& idh) -{ -#ifdef DEBUG_HUGE_ASN_LOADER - loading_ids = idh.AsString(); -#endif - auto info = m_reader->FindTopObject(idh.GetSeqId()); - if (info) { - TBlobId blob_id = new CBlobIdPtr(info); - return blob_id; - } -#ifdef DEBUG_HUGE_ASN_LOADER - cerr << MSerial_AsnText << "Seq id not found: " << loading_ids << "\n"; -#endif - return {}; -} - -CDataLoader::TTSE_Lock CHugeAsnDataLoader::GetBlobById(const TBlobId& blob_id) -{ - // Load data, get the lock - CTSE_LoadLock lock = GetDataSource()->GetTSE_LoadLock(blob_id); - if ( !lock.IsLoaded() ) { - auto id = (const CBlobIdPtr*)&*blob_id; - auto info_ptr = id->GetValue(); - const CHugeAsnReader::TBioseqSetInfo* info = (const CHugeAsnReader::TBioseqSetInfo*)info_ptr; - auto entry = m_reader->LoadSeqEntry(*info); -#ifdef DEBUG_HUGE_ASN_LOADER - cerr << MSerial_AsnText << "Loaded: " << loading_ids << "\n"; -#endif - CTSE_Info& tse_info = *lock; - tse_info.SetSeq_entry(*entry); - lock.SetLoaded(); - } - return lock; -} - -CDataLoader::TTSE_LockSet -CHugeAsnDataLoader::GetRecords(const CSeq_id_Handle& idh, EChoice /*choice*/) -{ - TTSE_LockSet locks; - TBlobId blob_id = GetBlobId(idh); - if ( blob_id ) { - TTSE_Lock lock = GetBlobById(blob_id); - if ( lock ) { - locks.insert(lock); - } - } - return locks; -} - -CHugeAsnDataLoader::TRegisterLoaderInfo CHugeAsnDataLoader::RegisterInObjectManager( - CObjectManager& om, - const string& loader_name, - CHugeAsnReader* reader, - CObjectManager::EIsDefault is_default, - CObjectManager::TPriority priority) -{ - CLoaderMakerWithReader maker(loader_name, reader); - CDataLoader::RegisterInObjectManager(om, maker, is_default, priority); - return maker.GetRegisterInfo(); -} - -TSeqPos CHugeAsnDataLoader::GetSequenceLength(const CSeq_id_Handle& idh) -{ - auto info = m_reader->FindBioseq(idh.GetSeqId()); - return info? info->m_length : kInvalidSeqPos; -} - -CSeq_inst::TMol CHugeAsnDataLoader::GetSequenceType(const CSeq_id_Handle& idh) -{ - auto info = m_reader->FindBioseq(idh.GetSeqId()); - if (info == nullptr) - NCBI_THROW(CLoaderException, eNotFound, - "CHugeAsnDataLoader::GetSequenceType() sequence not found"); - - if (info->m_mol == CSeq_inst::eMol_not_set) - NCBI_THROW(CLoaderException, eNoData, - "CHugeAsnDataLoader::GetSequenceType() type not set"); - - return info->m_mol; -} - -CDataLoader::STypeFound CHugeAsnDataLoader::GetSequenceTypeFound(const CSeq_id_Handle& idh) -{ - auto info = m_reader->FindBioseq(idh.GetSeqId()); - STypeFound ret; - if (info) { - ret.sequence_found = true; - ret.type = info->m_mol; - } - return ret; -} - -void CHugeAsnDataLoader::GetIds(const CSeq_id_Handle& idh, CDataLoader::TIds& ids) -{ - //cerr << "CHugeAsnDataLoader::GetIds invoked\n"; - auto info = m_reader->FindBioseq(idh.GetSeqId()); - if (info) - { - for (auto id: info->m_ids) - { - auto newidh = CSeq_id_Handle::GetHandle(*id); - if (std::find(begin(ids), end(ids), newidh) == ids.end()) - { - ids.push_back(newidh); - } - } - } -} - -namespace -{ - TTaxId x_FindTaxId(const CHugeAsnReader::TBioseqSetList& cont, CHugeAsnReader::TBioseqSetList::const_iterator parent, CConstRef descr) - { - if (descr) - { - for (auto d: descr->Get()) - { - const COrg_ref* org_ref = nullptr; - switch(d->Which()) - { - case CSeqdesc::e_Source: - if (d->GetSource().IsSetOrg()) - org_ref = &d->GetSource().GetOrg(); - break; - case CSeqdesc::e_Org: - org_ref = &d->GetOrg(); - break; - default: - break; - } - if (org_ref) - return org_ref->GetTaxId(); - } - } - if (parent != cont.end()) - return x_FindTaxId(cont, parent->m_parent_set, parent->m_descr); - - return ZERO_TAX_ID; - } -} - -TTaxId CHugeAsnDataLoader::GetTaxId(const CSeq_id_Handle& idh) -{ - auto info = m_reader->FindBioseq(idh.GetSeqId()); - if (info) - { - auto taxid = x_FindTaxId(m_reader->GetBiosets(), info->m_parent_set, info->m_descr); - return taxid; - } - return INVALID_TAX_ID; -} - -END_SCOPE(edit) -END_SCOPE(objects) -END_NCBI_SCOPE diff --git a/c++/src/objtools/edit/huge_asn_reader.cpp b/c++/src/objtools/edit/huge_asn_reader.cpp deleted file mode 100644 index 8a730cb0..00000000 --- a/c++/src/objtools/edit/huge_asn_reader.cpp +++ /dev/null @@ -1,652 +0,0 @@ -/* $Id: huge_asn_reader.cpp 663836 2023-03-01 16:53:54Z foleyjp $ -* =========================================================================== -* -* PUBLIC DOMAIN NOTICE -* National Center for Biotechnology Information -* -* This software/database is a "United States Government Work" under the -* terms of the United States Copyright Act. It was written as part of -* the author's official duties as a United States Government employee and -* thus cannot be copyrighted. This software/database is freely available -* to the public for use. The National Library of Medicine and the U.S. -* Government have not placed any restriction on its use or reproduction. -* -* Although all reasonable efforts have been taken to ensure the accuracy -* and reliability of the software and data, the NLM and the U.S. -* Government do not and cannot warrant the performance or results that -* may be obtained by using this software or data. The NLM and the U.S. -* Government disclaim all warranties, express or implied, including -* warranties of performance, merchantability or fitness for any particular -* purpose. -* -* Please cite the author in any work or product based on this material. -* -* =========================================================================== -* -* Authors: Sergiy Gotvyanskyy -* -* File Description: -* -* -*/ - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -BEGIN_NCBI_SCOPE -BEGIN_SCOPE(objects) -BEGIN_SCOPE(edit) - - -CHugeAsnReader::~CHugeAsnReader() -{ -} - -CHugeAsnReader::CHugeAsnReader() -{ -} - -CHugeAsnReader::CHugeAsnReader(CHugeFile* file, ILineErrorListener * pMessageListener) -{ - Open(file, pMessageListener); -} - -void CHugeAsnReader::x_ResetIndex() -{ - m_max_local_id = 0; - m_bioseq_list.clear(); - m_bioseq_set_list.clear(); - m_submit_block.Reset(); - -// flattenization structures, readonly after flattenization, accept m_Current - m_bioseq_index.clear(); - m_FlattenedIndex.clear(); - m_FlattenedSets.clear(); - m_top_ids.clear(); - m_top_entry.Reset(); - m_Current = m_FlattenedSets.end(); - -} - - -bool CHugeAsnReader::IsHugeSet(CBioseq_set::TClass setClass) -{ - return (setClass == CBioseq_set::eClass_genbank || - // setClass == CBioseq_set::eClass_wgs_set || - setClass == CBioseq_set::eClass_not_set); -} - - -void CHugeAsnReader::Open(CHugeFile* file, ILineErrorListener * pMessageListener) -{ - x_ResetIndex(); - - m_file = file; - mp_MessageListener = pMessageListener; -} - -bool CHugeAsnReader::IsMultiSequence() const -{ - return m_FlattenedSets.size()>1; - //return m_bioseq_index.size()>1; -} - -const CHugeAsnReader::TBioseqSetInfo* CHugeAsnReader::FindTopObject(CConstRef seqid) const -{ - auto it = m_FlattenedIndex.lower_bound(seqid); - if (it == m_FlattenedIndex.end()) - return nullptr; - if (it->first->CompareOrdered(*seqid) == 0) - return &*it->second; - if (it->first->Compare(*seqid) != CSeq_id::E_SIC::e_YES) - return nullptr; - - return &*it->second; -} - -const CHugeAsnReader::TBioseqInfo* CHugeAsnReader::FindBioseq(CConstRef seqid) const -{ - auto it = m_bioseq_index.lower_bound(seqid); - if (it == m_bioseq_index.end()) - return nullptr; - if (it->first->CompareOrdered(*seqid) == 0) - return &*it->second; - if (it->first->Compare(*seqid) != CSeq_id::E_SIC::e_YES) - return nullptr; - - return &*it->second; -} - - - -static CConstRef s_GetDescriptor(const CSeq_descr& descr, CSeqdesc::E_Choice choice) -{ - if (descr.IsSet()) { - for (auto pDesc : descr.Get()) { - if (pDesc && (pDesc->Which() == choice)) { - return pDesc; - } - } - } - - return {}; -} - - -CConstRef CHugeAsnReader::GetClosestDescriptor(const TBioseqInfo& info, CSeqdesc::E_Choice choice) const -{ - CConstRef result; - - if (info.m_descr) { - result = s_GetDescriptor(*info.m_descr, choice); - if (result) { - return result; - } - } - - auto parentSet = info.m_parent_set; - while (parentSet != end(m_bioseq_set_list)) { - if (parentSet->m_descr) { - result = s_GetDescriptor(*parentSet->m_descr, choice); - if (result) { - return result; - } - } - parentSet = parentSet->m_parent_set; - } - - return result; -} - - -CConstRef CHugeAsnReader::GetClosestDescriptor(const CSeq_id& id, CSeqdesc::E_Choice choice) const -{ - CConstRef pId(&id); - const auto* pInfo = FindBioseq(pId); - if (!pInfo) { - return {}; - } - return GetClosestDescriptor(*pInfo, choice); -} - - -CRef CHugeAsnReader::LoadSeqEntry(CConstRef seqid) const -{ - auto info = FindTopObject(seqid); - if (info) - return LoadSeqEntry(*info); - else - return {}; -} - -CRef CHugeAsnReader::LoadSeqEntry(const TBioseqSetInfo& info, eAddTopEntry add_top_entry) const -{ - auto entry = Ref(new CSeq_entry); - auto obj_stream = m_file->MakeObjStream(info.m_pos); - if (info.m_class == CBioseq_set::eClass_not_set) - { - obj_stream->Read(&entry->SetSeq(), CBioseq::GetTypeInfo(), CObjectIStream::eNoFileHeader); - } else { - obj_stream->Read(&entry->SetSet(), CBioseq_set::GetTypeInfo(), CObjectIStream::eNoFileHeader); - } - - if (add_top_entry == eAddTopEntry::yes && m_top_entry) { - auto pNewEntry = Ref(new CSeq_entry()); - pNewEntry->Assign(*m_top_entry); - pNewEntry->SetSet().SetSeq_set().push_back(entry); - return pNewEntry; - } - - return entry; -} - -CRef CHugeAsnReader::LoadBioseq(CConstRef seqid) const -{ - auto it = m_bioseq_index.lower_bound(seqid); - if (it == m_bioseq_index.end()) - return {}; - if (it->first->Compare(*seqid) != CSeq_id::E_SIC::e_YES) - return {}; - - auto obj_stream = m_file->MakeObjStream(it->second->m_pos); - auto bioseq = Ref(new CBioseq); - obj_stream->Read(bioseq, CBioseq::GetTypeInfo(), CObjectIStream::eNoFileHeader); - return bioseq; -} - -unique_ptr CHugeAsnReader::MakeObjStream(TFileSize pos) const -{ - return m_file->MakeObjStream(pos); -} - -bool CHugeAsnReader::GetNextBlob() -{ - if (m_next_pos >= m_file->m_filesize) - return false; - - x_IndexNextAsn1(); - return true; -} - -void CHugeAsnReader::x_SetHooks(CObjectIStream& objStream, CHugeAsnReader::TContext& context) -{ - CObjectTypeInfo bioseq_info = CType(); - CObjectTypeInfo bioseq_set_info = CType(); - CObjectTypeInfo seqinst_info = CType(); - - auto bioseq_id_mi = bioseq_info.FindMember("id"); - //auto bioseqset_class_mi = bioseq_set_info.FindMember("class"); - //auto bioseqset_descr_mi = bioseq_set_info.FindMember("descr"); - auto bioseqset_seqset_mi = bioseq_set_info.FindMember("seq-set"); - auto bioseqset_annot_mi = bioseq_set_info.FindMember("annot"); - auto seqinst_len_mi = seqinst_info.FindMember("length"); - auto seqinst_mol_mi = seqinst_info.FindMember("mol"); - auto seqinst_repr_mi = seqinst_info.FindMember("repr"); - auto bioseq_descr_mi = bioseq_info.FindMember("descr"); - - - SetLocalSkipHook(bioseq_id_mi, objStream, - [&context](CObjectIStream& in, const CObjectTypeInfoMI& member) - { - in.ReadObject(&context.bioseq_stack.back().m_ids, (*member).GetTypeInfo()); - }); - - SetLocalSkipHook(bioseq_descr_mi, objStream, - [&context](CObjectIStream& in, const CObjectTypeInfoMI& member) - { - auto descr = Ref(new CSeq_descr); - in.ReadObject(&descr, (*member).GetTypeInfo()); - context.bioseq_stack.back().m_descr = descr; - }); - - SetLocalSkipHook(seqinst_len_mi, objStream, - [&context](CObjectIStream& in, const CObjectTypeInfoMI& member) - { - in.ReadObject(&context.bioseq_stack.back().m_length, (*member).GetTypeInfo()); - }); - - SetLocalSkipHook(seqinst_mol_mi, objStream, - [&context](CObjectIStream& in, const CObjectTypeInfoMI& member) - { - in.ReadObject(&context.bioseq_stack.back().m_mol, (*member).GetTypeInfo()); - }); - - - SetLocalSkipHook(seqinst_repr_mi, objStream, - [&context](CObjectIStream& in, const CObjectTypeInfoMI& member) - { - in.ReadObject(&context.bioseq_stack.back().m_repr, (*member).GetTypeInfo()); - }); - - - x_SetFeatIdHooks(objStream, context); - - SetLocalReadHook(bioseqset_seqset_mi, objStream, - [](CObjectIStream& in, const CObjectInfoMI& member) - { - (*member).GetTypeInfo()->DefaultSkipData(in); - }); - - - SetLocalReadHook(bioseqset_annot_mi, objStream, - [&context](CObjectIStream& in, const CObjectInfoMI& member) - { - context.bioseq_set_stack.back()->m_HasAnnot = true; - (*member).GetTypeInfo()->DefaultSkipData(in); - }); - - x_SetBioseqSetHooks(objStream, context); - - x_SetBioseqHooks(objStream, context); - - SetLocalSkipHook(CType(), objStream, - [this](CObjectIStream& in, const CObjectTypeInfo& /*type*/) - { - auto submit_block = Ref(new CSubmit_block); - in.Read(submit_block, CSubmit_block::GetTypeInfo(), CObjectIStream::eNoFileHeader); - m_submit_block = submit_block; - }); - -} - -void CHugeAsnReader::x_SetBioseqHooks(CObjectIStream& objStream, CHugeAsnReader::TContext& context) -{ - CObjectTypeInfo bioseq_info = CType(); - - SetLocalSkipHook(bioseq_info, objStream, - [this, &context](CObjectIStream& in, const CObjectTypeInfo& type) - { - auto pos = in.GetStreamPos() + m_next_pos; - - context.bioseq_stack.push_back({}); - auto parent = context.bioseq_set_stack.back(); - - type.GetTypeInfo()->DefaultSkipData(in); - - auto& bioseqinfo = context.bioseq_stack.back(); - m_bioseq_list.push_back({pos, parent, bioseqinfo.m_length, bioseqinfo.m_descr, bioseqinfo.m_ids, bioseqinfo.m_mol, bioseqinfo.m_repr}); - context.bioseq_stack.pop_back(); - }); -} - - -void CHugeAsnReader::x_SetBioseqSetHooks(CObjectIStream& objStream, CHugeAsnReader::TContext& context) -{ - CObjectTypeInfo bioseq_set_info = CType(); - - SetLocalSkipHook(bioseq_set_info, objStream, - [this, &context](CObjectIStream& in, const CObjectTypeInfo& type) - { - auto pos = in.GetStreamPos() + m_next_pos; - auto parent = context.bioseq_set_stack.back(); - m_bioseq_set_list.push_back({pos, parent}); - - auto last = prev(m_bioseq_set_list.end()); - - context.bioseq_set_stack.push_back(last); - auto pBioseqSet = Ref(new CBioseq_set()); - type.GetTypeInfo()->DefaultReadData(in, pBioseqSet); - - if (pBioseqSet->IsSetLevel()) { - last->m_Level = pBioseqSet->GetLevel(); - } - - last->m_class = pBioseqSet->GetClass(); - if (pBioseqSet->IsSetDescr()) { - last->m_descr.Reset(&(pBioseqSet->GetDescr())); - } - - if (IsHugeSet(last->m_class) && - last->m_HasAnnot) { - m_HasHugeSetAnnot = true; - } - - context.bioseq_set_stack.pop_back(); - }); -} - - -void CHugeAsnReader::x_SetFeatIdHooks(CObjectIStream& objStream, CHugeAsnReader::TContext& context) -{ - SetLocalSkipHook(CType(), objStream, - [this, &context](CObjectIStream& in, const CObjectTypeInfo& type) - { - auto pFeatId = Ref(new CFeat_id()); - type.GetTypeInfo()->DefaultReadData(in, pFeatId); - if (pFeatId->IsLocal() && pFeatId->GetLocal().IsId()) - { - m_max_local_id = std::max(m_max_local_id, pFeatId->GetLocal().GetId()); - } - }); - - SetLocalReadHook(CType(), objStream, - [this](CObjectIStream& in, const CObjectInfo& object) - { - auto* pObject = object.GetObjectPtr(); - object.GetTypeInfo()->DefaultReadData(in, pObject); - auto* pFeatId = CTypeConverter::SafeCast(pObject); - if (pFeatId->IsLocal() && pFeatId->GetLocal().IsId()) - { - m_max_local_id = std::max(m_max_local_id, pFeatId->GetLocal().GetId()); - } - }); -} - -void CHugeAsnReader::x_ResetTopEntry() -{ - m_top_entry.Reset(); -} - -void CHugeAsnReader::x_IndexNextAsn1() -{ - x_ResetIndex(); - m_current_pos = m_next_pos; - auto object_type = m_file->RecognizeContent(m_current_pos); - - auto obj_stream = m_file->MakeObjStream(m_current_pos); - - TContext context; - x_SetHooks(*obj_stream, context); - - m_HasHugeSetAnnot = false; - // Ensure there is at least one bioseq_set_info object exists - obj_stream->SkipFileHeader(object_type); - m_bioseq_set_list.push_back({ 0, m_bioseq_set_list.end() }); - context.bioseq_set_stack.push_back(m_bioseq_set_list.begin()); - obj_stream->Skip(object_type, CObjectIStream::eNoFileHeader); - obj_stream->EndOfData(); // force to SkipWhiteSpace - m_next_pos += obj_stream->GetStreamPos(); -} - -CRef CHugeAsnReader::ReadAny() -{ - if (m_current_pos >= m_file->m_filesize) - return {}; - - x_ResetIndex(); - auto object_type = m_file->RecognizeContent(m_current_pos); - if (object_type == nullptr || !object_type->IsCObject()) - return {}; - - auto obj_stream = m_file->MakeObjStream(m_current_pos); - - auto obj_info = obj_stream->Read(object_type); - CRef serial(static_cast(obj_info.GetObjectPtr())); - obj_stream->EndOfData(); // force to SkipWhiteSpace - m_current_pos += obj_stream->GetStreamPos(); - //_ASSERT(m_current_pos == m_next_pos); - - return serial; -} - - -CHugeAsnReader::TStreamPos CHugeAsnReader::GetCurrentPos() const -{ - return m_current_pos; -} - - -void CHugeAsnReader::x_ThrowDuplicateId( - const TBioseqSetInfo& existingInfo, - const TBioseqSetInfo& newInfo, - const CSeq_id& duplicateId) -{ - auto filename = m_file->m_filename; - auto existingPos = existingInfo.m_pos; - auto newPos = newInfo.m_pos; - - auto existingFilePos = NStr::UInt8ToString(existingPos); - auto newFilePos = NStr::UInt8ToString(newPos); - if (!filename.empty()) { - existingFilePos = filename + ":" + existingFilePos; - newFilePos = filename + ":" + newFilePos; - } - string msg = "duplicate Bioseq id " + objects::GetLabel(duplicateId) + - " present in the set starting at " + existingFilePos; - if (newPos != existingPos) { - msg += " and the set starting at " + newFilePos; - } - NCBI_THROW(CHugeFileException, eDuplicateSeqIds, msg); -} - - -const CBioseq_set::TClass* CHugeAsnReader::GetTopLevelClass() const -{ - return m_pTopLevelClass; -} - -CRef CHugeAsnReader::x_GetTopLevelDescriptors() const -{ - CRef pDescriptors; - if (GetBiosets().size() < 2) { - return pDescriptors; - } - - auto top = next(GetBiosets().begin()); - if (top->m_descr) { - pDescriptors = Ref(new CSeq_descr()); - pDescriptors->Assign(*top->m_descr); - } - - for (auto it = next(top); it != end(GetBiosets()); ++it) { - if (!IsHugeSet(it->m_class)) { - break; - } - - if (it->m_descr) { - if (!pDescriptors) { - pDescriptors = Ref(new CSeq_descr()); - pDescriptors->Assign(*it->m_descr); - } - else { - for (auto pDesc : it->m_descr->Get()) { - pDescriptors->Set().push_back(pDesc); - } - } - } - } - return pDescriptors; -} - -bool CHugeAsnReader::x_HasNestedGenbankSets() const -{ - if (GetBiosets().size() <= 2) { - return false; - } - auto it = next(GetBiosets().begin()); - return (it->m_class == CBioseq_set::eClass_genbank && - next(it)->m_class == CBioseq_set::eClass_genbank); -} - -void CHugeAsnReader::FlattenGenbankSet() -{ - m_pTopLevelClass = nullptr; - m_FlattenedSets.clear(); - m_top_ids.clear(); - m_FlattenedIndex.clear(); - - // single bioseq not contained in set - if (m_bioseq_list.size() == 1 && m_bioseq_set_list.size() == 1) { - m_bioseq_set_list.begin()->m_pos = m_bioseq_list.begin()->m_pos; - } - - - for (auto it = m_bioseq_list.begin(); it!= m_bioseq_list.end(); ++it) - { - auto rec = *it; - auto parent = rec.m_parent_set; - - if (auto _class = parent->m_class; IsHugeSet(_class)) - { // create fake bioseq_set - m_FlattenedSets.push_back({rec.m_pos, m_bioseq_set_list.cend(), objects::CBioseq_set::eClass_not_set}); - m_top_ids.push_back(rec.m_ids.front()); - } else { - - auto grandParent = parent->m_parent_set; - while (!IsHugeSet(grandParent->m_class)) { - parent = grandParent; - grandParent = grandParent->m_parent_set; - } - if (m_FlattenedSets.empty() || (m_FlattenedSets.back().m_pos != parent->m_pos)) { - m_FlattenedSets.push_back(*parent); - m_top_ids.push_back(rec.m_ids.front()); - } - } - auto last = --m_FlattenedSets.end(); - for (auto id: rec.m_ids) { - auto existingIndex = m_FlattenedIndex.find(id); - if (existingIndex != m_FlattenedIndex.end()) { - x_ThrowDuplicateId(*(existingIndex->second), *last, *id); - } - m_FlattenedIndex[id] = last; - m_bioseq_index[id] = it; - } - } - - if (GetBiosets().size()>1) - { - auto top = next(GetBiosets().begin()); - if (m_FlattenedSets.size() == 1) { - // exposing the whole top entry - if (x_HasNestedGenbankSets()) { - auto pDescriptors = x_GetTopLevelDescriptors(); - auto pTopEntry = Ref(new CSeq_entry()); - if (top->m_Level) { - pTopEntry->SetSet().SetLevel() = top->m_Level.value(); - } - pTopEntry->SetSet().SetClass() = top->m_class; - if (pDescriptors) { - pTopEntry->SetSet().SetDescr().Assign(*pDescriptors); - } - m_top_entry = pTopEntry; - } - else if (GetSubmitBlock() || - top->m_Level || - top->m_descr || - !IsHugeSet(top->m_class)) { - m_FlattenedSets.clear(); - m_FlattenedSets.push_back(*top); - for (auto& it : m_FlattenedIndex) { - it.second = m_FlattenedSets.begin(); - } - } - } - else { // m_FlattenedSets.size() > 1) - auto pDescriptors = x_GetTopLevelDescriptors(); - if (pDescriptors || top->m_Level) { - auto top_entry = Ref(new CSeq_entry()); - if (top->m_Level) { - top_entry->SetSet().SetLevel() = top->m_Level.value(); - } - top_entry->SetSet().SetClass() = top->m_class; - if (pDescriptors) { - top_entry->SetSet().SetDescr().Assign(*pDescriptors); - } - m_top_entry = top_entry; - } - } - - m_pTopLevelClass = &(next(GetBiosets().begin())->m_class); - } - - m_Current = m_FlattenedSets.begin(); -} - -CConstRef CHugeAsnReader::GetSubmitBlock() const -{ - return m_submit_block; -} - -CRef CHugeAsnReader::GetNextSeqEntry() -{ - if (m_Current == end(m_FlattenedSets)) { - m_FlattenedSets.clear(); - m_Current = m_FlattenedSets.end(); - return {}; - } - - const auto addTopEntry = - (m_FlattenedSets.size() == 1 && - x_HasNestedGenbankSets()) ? - eAddTopEntry::yes : - eAddTopEntry::no; - - return LoadSeqEntry(*m_Current++, addTopEntry); -} - -END_SCOPE(edit) -END_SCOPE(objects) -END_NCBI_SCOPE diff --git a/c++/src/objtools/edit/huge_file.cpp b/c++/src/objtools/edit/huge_file.cpp deleted file mode 100644 index a9646557..00000000 --- a/c++/src/objtools/edit/huge_file.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* $Id: huge_file.cpp 671844 2023-08-24 20:01:10Z ivanov $ -* =========================================================================== -* -* PUBLIC DOMAIN NOTICE -* National Center for Biotechnology Information -* -* This software/database is a "United States Government Work" under the -* terms of the United States Copyright Act. It was written as part of -* the author's official duties as a United States Government employee and -* thus cannot be copyrighted. This software/database is freely available -* to the public for use. The National Library of Medicine and the U.S. -* Government have not placed any restriction on its use or reproduction. -* -* Although all reasonable efforts have been taken to ensure the accuracy -* and reliability of the software and data, the NLM and the U.S. -* Government do not and cannot warrant the performance or results that -* may be obtained by using this software or data. The NLM and the U.S. -* Government disclaim all warranties, express or implied, including -* warranties of performance, merchantability or fitness for any particular -* purpose. -* -* Please cite the author in any work or product based on this material. -* -* =========================================================================== -* -* Authors: Sergiy Gotvyanskyy -* -* File Description: -* -* -*/ - -#include - -#include -#include -#include -#include - -#include - -BEGIN_NCBI_SCOPE -BEGIN_SCOPE(objects) -BEGIN_SCOPE(edit) - -CHugeFile::CHugeFile(){} -CHugeFile::~CHugeFile(){} - -void CHugeFile::Open(const std::string& filename, const set* supported_types) -{ - auto filesize = CFile(filename).GetLength(); - if (filesize > 0) { - if (x_TryOpenMemoryFile(filename, filesize) || - x_TryOpenStreamFile(filename, filesize)) { - m_supported_types = supported_types; - m_content = RecognizeContent(*m_stream); - } - } - if (m_filesize <= 0) - NCBI_THROW(CFileException, eNotExists, "Cannot open " + filename); -} - -bool CHugeFile::x_TryOpenMemoryFile(const string& filename, std::streampos filesize) -{ - try - { - auto memfile = std::make_unique(filename, - CMemoryFile_Base::eMMP_Read, - CMemoryFile_Base::eMMS_Private); - - m_filesize = memfile->GetFileSize(); - m_filename = filename; - m_memory = (const char*)memfile->Map(0, 0); - - if (m_filesize == 0 || m_memory == 0) - return false; - - m_memfile = std::move(memfile); - - m_streambuf.reset(new CMemoryStreamBuf(m_memory, m_filesize)); - m_stream.reset(new std::istream(m_streambuf.get())); - - return true; - } - catch(const CFileException& e) - { - if (e.GetErrCode() == CFileException::eMemoryMap && - NStr::StartsWith(e.GetMsg(), "To be memory mapped the file must exist")) - return false; - else - throw; - } - -} - -bool CHugeFile::x_TryOpenStreamFile(const string& filename, std::streampos filesize) -{ - std::unique_ptr stream{new std::ifstream(filename, ios::binary)}; - if (!stream->is_open()) - return false; - - m_filesize = filesize; - - //stream->seekg(m_filesize-1); - //stream->seekg(0); - - m_stream = std::move(stream); - m_filename = filename; - return true; -} - -TTypeInfo CHugeFile::RecognizeContent(std::streampos pos) -{ - if (!m_memory && !m_stream) { - return nullptr; - } - if (m_memory) { - CMemoryStreamBuf strbuf(m_memory + pos, m_filesize - pos); - std::istream istr(&strbuf); - return RecognizeContent(istr); - } - m_stream->seekg(pos); - return RecognizeContent(*m_stream); -} - -TTypeInfo CHugeFile::RecognizeContent(std::istream& istr) -{ - CFileContentInfo content_info; - - CFormatGuessEx FG(istr); - FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eBinaryASN); - FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eTextASN); - FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eFasta); - FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eGff3); - - // See RW-1892, sometimes compressed files are wrongly - // guessed as binary ASN.1 - FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eZip); - FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eGZip); - FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eBZip2); - FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eLzo); - FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eZstd); - - FG.GetFormatHints().DisableAllNonpreferred(); - if (m_supported_types) - FG.SetRecognizedGenbankTypes(*m_supported_types); - - m_format = FG.GuessFormatAndContent(content_info); - - switch (m_format) - { - case CFormatGuess::eBinaryASN: - m_serial_format = eSerial_AsnBinary; - break; - case CFormatGuess::eTextASN: - m_serial_format = eSerial_AsnText; - break; - case CFormatGuess::eFasta: - case CFormatGuess::eGff3: - case CFormatGuess::eZip: - case CFormatGuess::eGZip: - case CFormatGuess::eBZip2: - case CFormatGuess::eLzo: - case CFormatGuess::eZstd: - return nullptr; - break; - default: - NCBI_THROW2(CObjReaderParseException, eFormat, "File format not supported", 0); - } - - TTypeInfo object_type = nullptr; - - if (m_supported_types) - if (m_supported_types->find(content_info.mInfoGenbank.mTypeInfo) != m_supported_types->end()) - object_type = content_info.mInfoGenbank.mTypeInfo; - - if (object_type == nullptr) - NCBI_THROW2(CObjReaderParseException, eFormat, "Object type not supported", 0); - - return object_type; -} - -unique_ptr CHugeFile::MakeObjStream(std::streampos pos) const -{ - unique_ptr str; - - if (m_memory) { - auto chunk = Ref(new CMemoryChunk(m_memory+pos, m_filesize-pos, {}, CMemoryChunk::eNoCopyData)); - CMemoryByteSource source(chunk); - str.reset(CObjectIStream::Create( m_serial_format, source )); - //str->SetDelayBufferParsingPolicy(CObjectIStream::eDelayBufferPolicyNeverParse); - str->SetDelayBufferParsingPolicy(CObjectIStream::eDelayBufferPolicyAlwaysParse); - } else { - std::unique_ptr stream{new std::ifstream(m_filename, ios::binary)}; - stream->seekg(pos); - str.reset(CObjectIStream::Open(m_serial_format, *stream.release(), eTakeOwnership)); - } - - str->UseMemoryPool(); - - return str; -} - - -END_SCOPE(edit) -END_SCOPE(objects) -END_NCBI_SCOPE diff --git a/c++/src/objtools/edit/huge_file_process.cpp b/c++/src/objtools/edit/huge_file_process.cpp deleted file mode 100644 index 6acdcc6a..00000000 --- a/c++/src/objtools/edit/huge_file_process.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/* $Id: huge_file_process.cpp 661267 2023-01-07 17:40:49Z gotvyans $ -* =========================================================================== -* -* PUBLIC DOMAIN NOTICE -* National Center for Biotechnology Information -* -* This software/database is a "United States Government Work" under the -* terms of the United States Copyright Act. It was written as part of -* the author's official duties as a United States Government employee and -* thus cannot be copyrighted. This software/database is freely available -* to the public for use. The National Library of Medicine and the U.S. -* Government have not placed any restriction on its use or reproduction. -* -* Although all reasonable efforts have been taken to ensure the accuracy -* and reliability of the software and data, the NLM and the U.S. -* Government do not and cannot warrant the performance or results that -* may be obtained by using this software or data. The NLM and the U.S. -* Government disclaim all warranties, express or implied, including -* warranties of performance, merchantability or fitness for any particular -* purpose. -* -* Please cite the author in any work or product based on this material. -* -* =========================================================================== -* -* Author: Sergiy Gotvyanskyy -* File Description: -* Utility class for processing ASN.1 files using Huge Files approach -* -*/ -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include -#include - -BEGIN_NCBI_SCOPE - -BEGIN_SCOPE(objects) -BEGIN_SCOPE(edit) - -namespace -{ - - class CAutoRevoker - { - public: - template - CAutoRevoker(struct SRegisterLoaderInfo& info) - : m_loader{ info.GetLoader() } {} - ~CAutoRevoker() - { - CObjectManager::GetInstance()->RevokeDataLoader(*m_loader); - } - private: - CDataLoader* m_loader = nullptr; - }; - -} - - -const set CHugeFileProcess::g_supported_types = -{ - CBioseq_set::GetTypeInfo(), - CBioseq::GetTypeInfo(), - CSeq_entry::GetTypeInfo(), - CSeq_submit::GetTypeInfo(), -}; - - -CHugeFileProcess::CHugeFileProcess(): - m_pHugeFile { new CHugeFile }, - m_pReader{ new CHugeAsnReader } -{} - - -CHugeFileProcess::CHugeFileProcess(CHugeAsnReader* pReader): - m_pHugeFile { new CHugeFile }, - m_pReader { pReader } -{} - -CHugeFileProcess::CHugeFileProcess(const string& file_name, const set* types) -: CHugeFileProcess() -{ - Open(file_name, types); -} - -bool CHugeFileProcess::IsSupported(TTypeInfo info) -{ - return g_supported_types.find(info) != g_supported_types.end(); -} - -void CHugeFileProcess::Open(const string& file_name, const set* types) -{ - OpenFile(file_name, types); - OpenReader(); -} - -void CHugeFileProcess::OpenFile(const string& file_name) -{ - m_pHugeFile->Open(file_name, &g_supported_types); -} - -void CHugeFileProcess::OpenFile(const string& file_name, const set* types) -{ - m_pHugeFile->Open(file_name, types); -} - -void CHugeFileProcess::OpenReader() -{ - m_pReader->Open(m_pHugeFile.get(), nullptr); -} - -CHugeFileProcess::~CHugeFileProcess() -{ -} - -bool CHugeFileProcess::Read(THandler handler, CRef seqid) -{ - if (!m_pReader->GetNextBlob()) { - return false; - } - - do - { - m_pReader->FlattenGenbankSet(); - CRef entry; - do - { - entry.Reset(); - - if (seqid.Empty()) - entry = m_pReader->GetNextSeqEntry(); - else - { - auto seq = m_pReader->LoadBioseq(seqid); - if (seq.NotEmpty()) - { - entry = Ref(new CSeq_entry); - entry->SetSeq(*seq); - if (auto pTopEntry = m_pReader->GetTopEntry(); pTopEntry) { - auto pNewEntry = Ref(new CSeq_entry()); - pNewEntry->Assign(*pTopEntry); - pNewEntry->SetSet().SetSeq_set().push_back(entry); - entry = pNewEntry; - } - } - } - - if (entry) - { - handler(m_pReader->GetSubmitBlock(), entry); - } - } - while ( entry && seqid.Empty()); - } while (m_pReader->GetNextBlob()); - - return true; -} - -bool CHugeFileProcess::Read(THandlerIds handler) -{ - while (m_pReader->GetNextBlob()) { - m_pReader->FlattenGenbankSet(); - bool processed = handler(m_pReader.get(), m_pReader->GetTopIds()); - if (!processed) - return false; - } - - return true; -} - -bool CHugeFileProcess::ReadNextBlob() -{ - if (m_pReader->GetNextBlob()) { - m_pReader->FlattenGenbankSet(); - return true; - } - - return false; -} - - -bool CHugeFileProcess::ForEachBlob(THandlerBlobs handler) -{ - while (m_pReader->GetNextBlob()) { - m_pReader->FlattenGenbankSet(); - bool processed = handler(*this); - if (!processed) - return false; - } - - return true; -} - -bool CHugeFileProcess::ForEachEntry(CRef scope, THandlerEntries handler) -{ - if (!handler) - return false; - - string loader_name = CDirEntry::CreateAbsolutePath(GetFile().m_filename); - auto info = CHugeAsnDataLoader::RegisterInObjectManager( - *CObjectManager::GetInstance(), loader_name, &GetReader(), CObjectManager::eNonDefault, 1); //CObjectManager::kPriority_Local); - - CAutoRevoker autorevoker(info); - - if (!scope) - scope = Ref(new CScope(*CObjectManager::GetInstance())); - - scope->AddDataLoader(loader_name); - - try - { - for (auto id: GetReader().GetTopIds()) - { - { - auto beh = scope->GetBioseqHandle(*id); - auto parent = beh.GetTopLevelEntry(); - handler(parent); - } - scope->ResetHistory(); - } - } - catch(const std::exception& e) - { - scope->RemoveDataLoader(loader_name); - throw; - } - scope->RemoveDataLoader(loader_name); - - return true; -} - - -CSeq_entry_Handle CHugeFileProcess::GetTopLevelEntry(CBioseq_Handle beh) -{ - CSeq_entry_Handle parent = beh.GetParentEntry(); - while(parent) - { - if (parent.IsTopLevelEntry()) - break; - - if (auto temp = parent.GetParentEntry(); temp) { - if (temp.IsSet() && temp.GetSet().IsSetClass() && - CHugeAsnReader::IsHugeSet(temp.GetSet().GetClass())) { - break; - } - - parent = temp; - } - else - break; - } - - return parent; -} - -END_SCOPE(edit) -END_SCOPE(objects) -END_NCBI_SCOPE diff --git a/c++/src/objtools/edit/pub_fix.cpp b/c++/src/objtools/edit/pub_fix.cpp index faa8572e..663b4d1b 100644 --- a/c++/src/objtools/edit/pub_fix.cpp +++ b/c++/src/objtools/edit/pub_fix.cpp @@ -1,4 +1,4 @@ -/* $Id: pub_fix.cpp 670328 2023-07-21 18:17:03Z sadyrovr $ +/* $Id: pub_fix.cpp 676568 2023-12-18 19:55:19Z sadyrovr $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -150,7 +150,7 @@ namespace fix_pub // MedlineToISO(tmp) // converts a MEDLINE citation to ISO/GenBank style -void MedlineToISO(CCit_art& cit_art, IPubmedUpdater* upd) +void MedlineToISO(CCit_art& cit_art) { if (cit_art.IsSetAuthors()) { cit_art.SetAuthors().ConvertMlToStd(true); @@ -161,23 +161,6 @@ void MedlineToISO(CCit_art& cit_art, IPubmedUpdater* upd) // from a journal - get iso_jta CCit_jour& journal = cit_art.SetFrom().SetJournal(); - -#if 0 - if (journal.IsSetTitle() && journal.GetTitle().IsSet() && upd) { - auto& titles = journal.SetTitle().Set(); - auto is_jta = [](const CRef& title) -> bool { return title->IsIso_jta(); }; - if (find_if(titles.begin(), titles.end(), is_jta) == titles.end()) { - // no iso_jta - CTitle::C_E& first_title = *titles.front(); - const string& title_str = journal.SetTitle().GetTitle(first_title); - const string new_title = upd->GetTitle(title_str); - if (!new_title.empty()) { - first_title.SetIso_jta(new_title); - } - } - } -#endif - if (journal.IsSetImp()) { // remove Eng language if (journal.GetImp().IsSetLanguage() && journal.GetImp().GetLanguage() == "Eng") @@ -189,7 +172,7 @@ void MedlineToISO(CCit_art& cit_art, IPubmedUpdater* upd) // splits a medline entry into 2 pubs (1 muid, 1 Cit-art) // converts Cit-art to ISO/GenBank style // deletes original medline entry -void SplitMedlineEntry(CPub_equiv::Tdata& medlines, IPubmedUpdater* upd) +void SplitMedlineEntry(CPub_equiv::Tdata& medlines) { if (medlines.size() != 1) { return; @@ -211,7 +194,7 @@ void SplitMedlineEntry(CPub_equiv::Tdata& medlines, IPubmedUpdater* upd) if (medline.IsSetCit()) { cit_art.Reset(new CPub); cit_art->SetArticle(medline.SetCit()); - MedlineToISO(cit_art->SetArticle(), upd); + MedlineToISO(cit_art->SetArticle()); } medlines.clear(); @@ -1116,7 +1099,7 @@ void CPubFix::FixPubEquiv(CPub_equiv& pub_equiv) medlines.resize(1); } - SplitMedlineEntry(medlines, m_upd); + SplitMedlineEntry(medlines); pub_list.splice(pub_list.end(), medlines); } @@ -1257,7 +1240,7 @@ void CPubFix::FixPubEquiv(CPub_equiv& pub_equiv) pmids.front()->SetPmid().Set(pmid); pub_list.splice(pub_list.end(), pmids); - MedlineToISO(*cit_art, m_upd); + MedlineToISO(*cit_art); pub_list.splice(pub_list.end(), cit_arts); } @@ -1283,7 +1266,7 @@ void CPubFix::FixPubEquiv(CPub_equiv& pub_equiv) pub_list.splice(pub_list.end(), pmids); if (m_replace_cit) { - MedlineToISO(*new_cit_art, m_upd); + MedlineToISO(*new_cit_art); CRef cit_pub(new CPub); cit_pub->SetArticle(*new_cit_art); pub_list.push_back(cit_pub); @@ -1315,7 +1298,7 @@ void CPubFix::FixPub(CPub& pub) pub_equiv->Set().push_back(CRef(new CPub)); pub_equiv->Set().front()->Assign(pub); - SplitMedlineEntry(pub_equiv->Set(), m_upd); + SplitMedlineEntry(pub_equiv->Set()); pub.SetEquiv().Assign(*pub_equiv); } break; @@ -1358,13 +1341,13 @@ void CPubFix::FixPub(CPub& pub) } else { PrintPub(cit_art, false, true, ENTREZ_ID_TO(long, pmid), m_err_log); - MedlineToISO(cit_art, m_upd); + MedlineToISO(cit_art); } } } else { PrintPub(cit_art, false, false, ENTREZ_ID_TO(long, pmid), m_err_log); - MedlineToISO(cit_art, m_upd); + MedlineToISO(cit_art); } } } @@ -1378,7 +1361,7 @@ void CPubFix::FixPub(CPub& pub) } } -CRef CPubFix::FetchPubPmId(TEntrezId pmid, IPubmedUpdater* upd) +CRef CPubFix::FetchPubPmId(TEntrezId pmid, CEUtilsUpdater* upd) { CRef cit_art; if (!upd || pmid < ZERO_ENTREZ_ID) { @@ -1396,7 +1379,7 @@ CRef CPubFix::FetchPubPmId(TEntrezId pmid, IPubmedUpdater* upd) cit_art.Reset(new CCit_art); cit_art->Assign(pub->GetArticle()); - MedlineToISO(*cit_art, upd); + MedlineToISO(*cit_art); } return cit_art; diff --git a/c++/src/objtools/edit/pub_fix_aux.hpp b/c++/src/objtools/edit/pub_fix_aux.hpp index 784e152b..7304362c 100644 --- a/c++/src/objtools/edit/pub_fix_aux.hpp +++ b/c++/src/objtools/edit/pub_fix_aux.hpp @@ -1,7 +1,7 @@ #ifndef OBJECTS_GENERAL___CLEANUP_FIX_PUB_AUX__HPP #define OBJECTS_GENERAL___CLEANUP_FIX_PUB_AUX__HPP -/* $Id: pub_fix_aux.hpp 644476 2022-01-27 13:49:04Z stakhovv $ +/* $Id: pub_fix_aux.hpp 676324 2023-12-14 14:04:33Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -50,8 +50,6 @@ class CCit_art; BEGIN_SCOPE(edit) -class IPubmedUpdater; - namespace fix_pub { @@ -99,8 +97,10 @@ enum EFixPubAuthListError }; -NCBI_XOBJEDIT_EXPORT void MedlineToISO(CCit_art& cit_art, IPubmedUpdater* = nullptr); -NCBI_XOBJEDIT_EXPORT void SplitMedlineEntry(CPub_equiv::Tdata& medlines, IPubmedUpdater* = nullptr); +NCBI_XOBJEDIT_EXPORT void MedlineToISO(CCit_art& cit_art); +NCBI_DEPRECATED inline void MedlineToISO(CCit_art& cit_art, void*) { MedlineToISO(cit_art); } +NCBI_XOBJEDIT_EXPORT void SplitMedlineEntry(CPub_equiv::Tdata& medlines); +NCBI_DEPRECATED inline void SplitMedlineEntry(CPub_equiv::Tdata& medlines, void*) { SplitMedlineEntry(medlines); } NCBI_XOBJEDIT_EXPORT bool IsInpress(const CCit_art& cit_art); NCBI_XOBJEDIT_EXPORT bool NeedToPropagateInJournal(const CCit_art& cit_art); NCBI_XOBJEDIT_EXPORT bool MULooksLikeISSN(const string& str); diff --git a/c++/src/objtools/edit/remote_updater.cpp b/c++/src/objtools/edit/remote_updater.cpp index 31b8ce0f..de95a70d 100644 --- a/c++/src/objtools/edit/remote_updater.cpp +++ b/c++/src/objtools/edit/remote_updater.cpp @@ -1,43 +1,43 @@ -/* $Id: remote_updater.cpp 672327 2023-09-05 18:18:06Z ivanov $ -* =========================================================================== -* -* PUBLIC DOMAIN NOTICE -* National Center for Biotechnology Information -* -* This software/database is a "United States Government Work" under the -* terms of the United States Copyright Act. It was written as part of -* the author's official duties as a United States Government employee and -* thus cannot be copyrighted. This software/database is freely available -* to the public for use. The National Library of Medicine and the U.S. -* Government have not placed any restriction on its use or reproduction. -* -* Although all reasonable efforts have been taken to ensure the accuracy -* and reliability of the software and data, the NLM and the U.S. -* Government do not and cannot warrant the performance or results that -* may be obtained by using this software or data. The NLM and the U.S. -* Government disclaim all warranties, express or implied, including -* warranties of performance, merchantability or fitness for any particular -* purpose. -* -* Please cite the author in any work or product based on this material. -* -* =========================================================================== -* -* Authors: Sergiy Gotvyanskyy, NCBI -* Colleen Bolin, NCBI -* -* File Description: -* Front-end class for making remote request to MLA and taxon -* -* =========================================================================== -*/ +/* $Id: remote_updater.cpp 677028 2024-01-03 14:08:01Z ivanov $ + * =========================================================================== + * + * PUBLIC DOMAIN NOTICE + * National Center for Biotechnology Information + * + * This software/database is a "United States Government Work" under the + * terms of the United States Copyright Act. It was written as part of + * the author's official duties as a United States Government employee and + * thus cannot be copyrighted. This software/database is freely available + * to the public for use. The National Library of Medicine and the U.S. + * Government have not placed any restriction on its use or reproduction. + * + * Although all reasonable efforts have been taken to ensure the accuracy + * and reliability of the software and data, the NLM and the U.S. + * Government do not and cannot warrant the performance or results that + * may be obtained by using this software or data. The NLM and the U.S. + * Government disclaim all warranties, express or implied, including + * warranties of performance, merchantability or fitness for any particular + * purpose. + * + * Please cite the author in any work or product based on this material. + * + * =========================================================================== + * + * Authors: Sergiy Gotvyanskyy, NCBI + * Colleen Bolin, NCBI + * + * File Description: + * Front-end class for making remote request to MLA and taxon + * + * =========================================================================== + */ #include #include #include -#include #include +#include #include #include @@ -52,6 +52,7 @@ // new #include #include +#include #include #include @@ -91,14 +92,15 @@ static bool s_IsConnectionFailure(EPubmedError errorVal) return false; } -CRef s_GetPubFrompmid(IPubmedUpdater* upd, TEntrezId id, int maxAttempts, IObjtoolsListener* pMessageListener) +static +CRef s_GetPubFrompmid(CEUtilsUpdater* upd, TEntrezId id, int maxAttempts, IObjtoolsListener* pMessageListener) { CRef result; int maxCount = max(1, maxAttempts); for (int count = 0; count < maxCount; ++count) { EPubmedError errorVal; - result = upd->GetPub(id, &errorVal); + result = upd->GetPubmedEntry(id, &errorVal); if (result) { return result; } @@ -232,8 +234,23 @@ protected: bool CRemoteUpdater::xUpdatePubPMID(list>& arr, TEntrezId id) { - auto new_pub = s_GetPubFrompmid(m_pubmed.get(), id, m_MaxMlaAttempts, m_pMessageListener); - if (! new_pub) { + auto pub = s_GetPubFrompmid(m_pubmed.get(), id, m_MaxMlaAttempts, m_pMessageListener); + if (! (pub && pub->IsMedline())) { + return false; + } + + CRef new_pub(new CPub); + switch (m_pm_pub_type) { + case CPub::e_Article: + if (! pub->GetMedline().IsSetCit()) { + return false; + } + new_pub->SetArticle().Assign(pub->GetMedline().GetCit()); + break; + case CPub::e_Medline: + new_pub->SetMedline().Assign(pub->GetMedline()); + break; + default: return false; } @@ -280,13 +297,6 @@ bool CRemoteUpdater::xSetFromConfig() if (cfg.HasEntry("RemotePubmedUpdate")) { const string sect = "RemotePubmedUpdate"; - string s = cfg.Get(sect, "Source"); - NStr::ToLower(s); - if (s == "eutils") { - m_pm_source = EPubmedSource::eEUtils; - } else if (s == "none") { - m_pm_source = EPubmedSource::eNone; - } if (cfg.HasEntry(sect, "URL")) { m_pm_url = cfg.GetString(sect, "URL", {}); @@ -315,12 +325,12 @@ bool CRemoteUpdater::xSetFromConfig() return false; } -void CRemoteUpdater::UpdateOrgFromTaxon(FLogger logger, CSeqdesc& desc) +void CRemoteUpdater::UpdateOrgFromTaxon(CSeqdesc& desc) { if (desc.IsOrg()) { - xUpdateOrgTaxname(desc.SetOrg(), logger); + xUpdateOrgTaxname(desc.SetOrg()); } else if (desc.IsSource() && desc.GetSource().IsSetOrg()) { - xUpdateOrgTaxname(desc.SetSource().SetOrg(), logger); + xUpdateOrgTaxname(desc.SetSource().SetOrg()); } } @@ -335,8 +345,8 @@ void CRemoteUpdater::xInitTaxCache() } } -void CRemoteUpdater::xUpdateOrgTaxname(COrg_ref& org, FLogger logger) -{ // logger parameter is deprecated and should be removed soon +void CRemoteUpdater::xUpdateOrgTaxname(COrg_ref& org) +{ std::lock_guard guard(m_Mutex); TTaxId taxid = org.GetTaxId(); @@ -345,31 +355,26 @@ void CRemoteUpdater::xUpdateOrgTaxname(COrg_ref& org, FLogger logger) xInitTaxCache(); - CRef new_org = m_taxClient->GetOrg(org, logger); + CRef new_org = m_taxClient->GetOrg(org, m_logger); if (new_org.NotEmpty()) { org.Assign(*new_org); } } -void CRemoteUpdater::UpdateOrgFromTaxon(CSeqdesc& desc) -{ - UpdateOrgFromTaxon(m_logger, desc); -} - CRemoteUpdater& CRemoteUpdater::GetInstance() { static CRemoteUpdater instance{ (IObjtoolsListener*)nullptr }; return instance; } -CRemoteUpdater::CRemoteUpdater(FLogger logger, EPubmedSource pms, bool bNormalize) : - m_logger{ logger }, m_pm_source(pms), m_pm_normalize(bNormalize) +CRemoteUpdater::CRemoteUpdater(FLogger logger, CEUtilsUpdater::ENormalize norm) : + m_logger{ logger }, m_pm_normalize(norm) { xSetFromConfig(); } -CRemoteUpdater::CRemoteUpdater(IObjtoolsListener* pMessageListener, EPubmedSource pms, bool bNormalize) : - m_pMessageListener(pMessageListener), m_pm_source(pms), m_pm_normalize(bNormalize) +CRemoteUpdater::CRemoteUpdater(IObjtoolsListener* pMessageListener, CEUtilsUpdater::ENormalize norm) : + m_pMessageListener(pMessageListener), m_pm_normalize(norm) { if (m_pMessageListener) { m_logger = [this](const string& error_message) { @@ -392,17 +397,9 @@ void CRemoteUpdater::ClearCache() } if (m_pm_use_cache && m_pubmed) { - switch (m_pm_source) { - case EPubmedSource::eMLA: - case EPubmedSource::eEUtils: { - auto* upd = dynamic_cast(m_pubmed.get()); - if (upd) { - upd->ClearCache(); - } - break; - } - default: - break; + auto* upd = dynamic_cast(m_pubmed.get()); + if (upd) { + upd->ClearCache(); } } } @@ -460,22 +457,16 @@ void CRemoteUpdater::xUpdatePubReferences(CSeq_descr& seq_descr) auto& arr = pDesc->SetPub().SetPub().Set(); if (! m_pubmed) { - switch (m_pm_source) { - case EPubmedSource::eNone: - break; - default: - case EPubmedSource::eEUtils: - if (m_pm_use_cache) { - m_pubmed.reset(new CEUtilsUpdaterWithCache(m_pm_normalize)); - } else { - m_pubmed.reset(new CEUtilsUpdater(m_pm_normalize)); - } - if (! m_pm_url.empty()) { - CEUtils_Request::SetBaseURL(m_pm_url); - } - if (m_pm_interceptor) - m_pubmed->SetPubInterceptor(m_pm_interceptor); - break; + if (m_pm_use_cache) { + m_pubmed.reset(new CEUtilsUpdaterWithCache(m_pm_normalize)); + } else { + m_pubmed.reset(new CEUtilsUpdater(m_pm_normalize)); + } + if (! m_pm_url.empty()) { + CEUtils_Request::SetBaseURL(m_pm_url); + } + if (m_pm_interceptor) { + m_pubmed->SetPubInterceptor(m_pm_interceptor); } } @@ -485,9 +476,9 @@ void CRemoteUpdater::xUpdatePubReferences(CSeq_descr& seq_descr) continue; } - for (const auto& pPubEquiv : arr) { - if (pPubEquiv->IsArticle()) { - id = m_pubmed->CitMatch(*pPubEquiv); + for (const auto& pPub : arr) { + if (pPub->IsArticle()) { + id = m_pubmed->CitMatch(*pPub); if (id > ZERO_ENTREZ_ID && xUpdatePubPMID(arr, id)) { break; } @@ -549,7 +540,7 @@ namespace } } -void CRemoteUpdater::UpdateOrgFromTaxon(FLogger logger, CSeq_entry& entry) +void CRemoteUpdater::UpdateOrgFromTaxon(CSeq_entry& entry) { TOrgMap org_to_update; @@ -570,7 +561,7 @@ void CRemoteUpdater::UpdateOrgFromTaxon(FLogger logger, CSeq_entry& entry) for (auto& it : org_to_update) { vector> reflist; reflist.push_back(it.second.org_ref); - CRef reply = m_taxClient->SendOrgRefList(reflist, logger); + CRef reply = m_taxClient->SendOrgRefList(reflist, m_logger); if (reply.NotNull()) { auto& reply_it = reply->SetReply().front(); @@ -581,20 +572,6 @@ void CRemoteUpdater::UpdateOrgFromTaxon(FLogger logger, CSeq_entry& entry) } } -void CRemoteUpdater::UpdateOrgFromTaxon(CSeq_entry& entry) -{ - UpdateOrgFromTaxon(m_logger, entry); -} - -void CRemoteUpdater::UpdateOrgFromTaxon(FLogger logger, CSeq_entry_EditHandle& obj) -{ - for (CBioseq_CI bioseq_it(obj); bioseq_it; ++bioseq_it) { - for (CSeqdesc_CI desc_it(bioseq_it->GetEditHandle()); desc_it; ++desc_it) { - UpdateOrgFromTaxon(logger, (CSeqdesc&)*desc_it); - } - } -} - void CRemoteUpdater::ConvertToStandardAuthors(CAuth_list& auth_list) { @@ -661,7 +638,7 @@ void CRemoteUpdater::PostProcessPubs(CSeq_entry_EditHandle& obj) } } -void CRemoteUpdater::SetPubmedClient(IPubmedUpdater* pubmedUpdater) +void CRemoteUpdater::SetPubmedClient(CEUtilsUpdater* pubmedUpdater) { m_pubmed.reset(pubmedUpdater); } @@ -685,17 +662,9 @@ void CRemoteUpdater::ReportStats(std::ostream& os) } if (m_pm_use_cache && m_pubmed) { - switch (m_pm_source) { - case EPubmedSource::eMLA: - case EPubmedSource::eEUtils: { - auto* upd = dynamic_cast(m_pubmed.get()); - if (upd && ! dynamic_cast(m_pubmed.get())) { - upd->ReportStats(os); - } - break; - } - default: - break; + auto* upd = dynamic_cast(m_pubmed.get()); + if (upd) { + upd->ReportStats(os); } } } diff --git a/c++/src/objtools/edit/seq_entry_edit.cpp b/c++/src/objtools/edit/seq_entry_edit.cpp index e81aab23..124d0d57 100644 --- a/c++/src/objtools/edit/seq_entry_edit.cpp +++ b/c++/src/objtools/edit/seq_entry_edit.cpp @@ -1,4 +1,4 @@ -/* $Id: seq_entry_edit.cpp 664960 2023-03-24 14:16:03Z stakhovv $ +/* $Id: seq_entry_edit.cpp 675913 2023-12-05 13:22:18Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -203,7 +203,7 @@ CConstRef GetDeltaSeqForPosition(const unsigned pos, const CBioseq_ return CConstRef (); } - size_t offset = 0; + unsigned offset = 0; int len = 0; ITERATE (list >, it, seq_hl.GetInst_Ext().GetDelta().Get()) { @@ -1140,7 +1140,7 @@ static bool s_DivvyUpAlignments_ProcessAnnot_Denseg( // figure out what input entry each row belongs to const CDense_seg::TIds & ids = align.GetSegs().GetDenseg().GetIds(); - for( size_t iRow = 0; iRow < ids.size(); ++iRow ) { + for(unsigned iRow = 0; iRow < ids.size(); ++iRow) { CBioseq_Handle id_bioseq = scope.GetBioseqHandle(*ids[iRow]); CSeq_entry_Handle id_bioseq_entry = ( id_bioseq ? @@ -1749,7 +1749,7 @@ void s_AddLiteral(CSeq_inst& inst, const string& element) { CRef ds(new CDelta_seq()); ds->SetLiteral().SetSeq_data().SetIupacna().Set(element); - ds->SetLiteral().SetLength(element.length()); + ds->SetLiteral().SetLength(TSeqPos(element.length())); inst.SetExt().SetDelta().Set().push_back(ds); } @@ -2182,7 +2182,6 @@ void TrimSequenceAndAnnotation(CBioseq_Handle bsh, // Modify the copy of the feature bool isPartialStart = false; bool isPartialStop = false; - auto cds_range = copy_feat->GetLocation().GetTotalRange(); TrimSeqFeat(copy_feat, sorted_cuts, bFeatureDeleted, bFeatureTrimmed, isPartialStart, isPartialStop); if (bFeatureDeleted) { @@ -3082,16 +3081,13 @@ void TrimSeqAlign(CBioseq_Handle bsh, TSignedSeqPos seg_start = denseg.GetStarts()[index]; if (seg_start < 0) { // This indicates a gap, no change needed - } - else if (seg_start < cut_from) { + } else if (TSeqPos(seg_start) < cut_from) { // This is before the cut, no change needed - } - else if (seg_start >= cut_from && - seg_start + denseg.GetLens()[curseg] <= cut_from + cut_len) { + } else if (TSeqPos(seg_start) >= cut_from && + TSeqPos(seg_start) + denseg.GetLens()[curseg] <= cut_from + cut_len) { // This is in the gap, indicate it with a -1 align->SetSegs().SetDenseg().SetStarts()[index] = -1; - } - else { + } else { // This is after the cut - subtract the cut_len align->SetSegs().SetDenseg().SetStarts()[index] -= cut_len; } @@ -3228,11 +3224,9 @@ void AdjustCdregionFrame(TSeqPos original_nuc_len, // Get partialness and strand of location before cutting bool bIsPartialStart = false; CSeq_loc::TStrand eStrand = eNa_strand_unknown; - TRange cds_range; if (cds->CanGetLocation()) { bIsPartialStart = cds->GetLocation().IsPartialStart(eExtreme_Biological); eStrand = cds->GetLocation().GetStrand(); - cds_range = cds->GetLocation().GetTotalRange(); } for (TCuts::size_type ii = 0; ii < sorted_cuts.size(); ++ii) { diff --git a/c++/src/objtools/eutils/efetch/PubmedArticle.cpp b/c++/src/objtools/eutils/efetch/PubmedArticle.cpp index 3939519e..0a036fb7 100644 --- a/c++/src/objtools/eutils/efetch/PubmedArticle.cpp +++ b/c++/src/objtools/eutils/efetch/PubmedArticle.cpp @@ -1,4 +1,4 @@ -/* $Id: PubmedArticle.cpp 668898 2023-06-14 17:38:50Z ivanov $ +/* $Id: PubmedArticle.cpp 680684 2024-03-25 17:18:44Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -346,9 +346,9 @@ static bool s_SetCommentCorrection( } -static int s_GetPublicationStatusId(const string& publication_status) +static EPubStatus s_GetPublicationStatusId(const string& publication_status) { - static const unordered_map s_PubStatusId { + static const unordered_map s_PubStatusId { { "received", ePubStatus_received }, { "accepted", ePubStatus_accepted }, { "epublish", ePubStatus_epublish }, @@ -423,12 +423,15 @@ static CRef s_GetImprint(const CPubmedArticle& pubmed_article) { CRef date_set(new CPubStatusDateSet()); for (auto pub_date : pubmed_data.GetHistory().GetPubMedPubDate()) { - CRef pub_stat_date(new CPubStatusDate()); string pub_status = CPubMedPubDate::C_Attlist::GetTypeInfo_enum_EAttlist_PubStatus()-> FindName(pub_date->GetAttlist().GetPubStatus(), false); - pub_stat_date->SetPubstatus(s_GetPublicationStatusId(pub_status)); - pub_stat_date->SetDate(*s_GetDateFromPubMedPubDate(*pub_date)); - date_set->Set().push_back(pub_stat_date); + EPubStatus eps = s_GetPublicationStatusId(pub_status); + if (eps != ePubStatus_other) { + CRef pub_stat_date(new CPubStatusDate()); + pub_stat_date->SetPubstatus(eps); + pub_stat_date->SetDate(*s_GetDateFromPubMedPubDate(*pub_date)); + date_set->Set().push_back(pub_stat_date); + } } imprint->SetHistory(*date_set); } @@ -913,7 +916,7 @@ CRef s_GetArticleIdSet(const CArticleIdList& article_id_list, con for (auto article_id_it : article_id_list.GetArticleId()) { CRef id(new objects::CArticleId()); try { - const string& str_id = article_id_it->GetArticleId(); + const string& str_id = utf8_to_string(article_id_it->GetArticleId()); switch (s_GetArticleIdTypeId(*article_id_it)) { case objects::CArticleId::e_Pubmed: id->SetPubmed(CPubMedId(NStr::StringToNumeric(str_id))); diff --git a/c++/src/objtools/format/CMakeLists.txt b/c++/src/objtools/format/CMakeLists.txt index 65d1cbea..82e358a5 100644 --- a/c++/src/objtools/format/CMakeLists.txt +++ b/c++/src/objtools/format/CMakeLists.txt @@ -1,4 +1,5 @@ -# $Id: CMakeLists.txt 621735 2020-12-16 15:47:41Z ivanov $ +# $Id: CMakeLists.txt 676228 2023-12-12 19:07:25Z ivanov $ NCBI_add_library(xformat) +NCBI_add_subdirectory(test) diff --git a/c++/src/objtools/format/Makefile.in b/c++/src/objtools/format/Makefile.in index f8f6b38f..3449424f 100644 --- a/c++/src/objtools/format/Makefile.in +++ b/c++/src/objtools/format/Makefile.in @@ -1,9 +1,11 @@ -# $Id: Makefile.in 31805 2003-12-17 20:00:52Z shomrat $ +# $Id: Makefile.in 676228 2023-12-12 19:07:25Z ivanov $ # Meta-makefile (flat-file generator) ################################## LIB_PROJ = xformat +SUB_PROJ = test + srcdir = @srcdir@ include @builddir@/Makefile.meta diff --git a/c++/src/objtools/format/comment_item.cpp b/c++/src/objtools/format/comment_item.cpp index d5152282..ec085cf6 100644 --- a/c++/src/objtools/format/comment_item.cpp +++ b/c++/src/objtools/format/comment_item.cpp @@ -1,4 +1,4 @@ -/* $Id: comment_item.cpp 671848 2023-08-24 20:01:29Z ivanov $ +/* $Id: comment_item.cpp 675914 2023-12-05 13:22:31Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -613,7 +613,6 @@ CCommentItem::TRefTrackStatus CCommentItem::GetRefTrackStatus return retval; } - string CCommentItem::GetStringForRefTrack(const CBioseqContext& ctx, const CUser_object& uo, const CBioseq_Handle& bsh, EGenomeBuildComment eGenomeBuildComment ) @@ -819,6 +818,7 @@ string CCommentItem::GetStringForRefTrack(const CBioseqContext& ctx, const CUser return CNcbiOstrstreamToString(oss); } +// LCOV_EXCL_START string CCommentItem::GetStringForRefSeqGenome(const CUser_object& uo) { if ( ! FIELD_IS_SET_AND_IS(uo, Type, Str) || @@ -886,6 +886,7 @@ string CCommentItem::GetStringForRefSeqGenome(const CUser_object& uo) return CNcbiOstrstreamToString(result_oss); } +// LCOV_EXCL_STOP string CCommentItem::GetStringForWGS(CBioseqContext& ctx) diff --git a/c++/src/objtools/format/dbsource_item.cpp b/c++/src/objtools/format/dbsource_item.cpp index 88d416dd..aef5493e 100644 --- a/c++/src/objtools/format/dbsource_item.cpp +++ b/c++/src/objtools/format/dbsource_item.cpp @@ -1,4 +1,4 @@ -/* $Id: dbsource_item.cpp 665431 2023-04-04 17:43:43Z stakhovv $ +/* $Id: dbsource_item.cpp 675915 2023-12-05 13:22:40Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -148,20 +148,23 @@ void CDBSourceItem::x_GatherInfo(CBioseqContext& ctx) } switch (idh.Which()) { +// LCOV_EXCL_START case CSeq_id::e_Pir: m_DBSource.push_back(x_FormatDBSourceID(idh)); x_AddPIRBlock(ctx); break; +// LCOV_EXCL_STOP case CSeq_id::e_Swissprot: m_DBSource.push_back(x_FormatDBSourceID(idh)); x_AddSPBlock(ctx); break; - +// LCOV_EXCL_START case CSeq_id::e_Prf: m_DBSource.push_back(x_FormatDBSourceID(idh)); x_AddPRFBlock(ctx); break; +// LCOV_EXCL_STOP case CSeq_id::e_Pdb: m_DBSource.push_back(x_FormatDBSourceID(idh)); @@ -249,6 +252,7 @@ void CDBSourceItem::x_GatherInfo(CBioseqContext& ctx) } } +// LCOV_EXCL_START void CDBSourceItem::x_AddPIRBlock(CBioseqContext& ctx) { // In this function, the newlines seem weird because the C toolkit @@ -343,6 +347,7 @@ void CDBSourceItem::x_AddPIRBlock(CBioseqContext& ctx) m_DBSource.front() += "\n"; } } +// LCOV_EXCL_STOP static void s_FormatDate(const CDate& date, string& str) { @@ -470,7 +475,7 @@ void CDBSourceItem::x_AddSPBlock(CBioseqContext& ctx) } } - +// LCOV_EXCL_START void CDBSourceItem::x_AddPRFBlock(CBioseqContext& ctx) { CSeqdesc_CI dsc(ctx.GetHandle(), CSeqdesc::e_Prf); @@ -503,6 +508,7 @@ void CDBSourceItem::x_AddPRFBlock(CBioseqContext& ctx) *it += (&*it == &m_DBSource.back() ? '.' : ';'); } } +// LCOV_EXCL_STOP void CDBSourceItem::x_AddPDBBlock(CBioseqContext& ctx) diff --git a/c++/src/objtools/format/feature_item.cpp b/c++/src/objtools/format/feature_item.cpp index 41905eb4..5861ca00 100644 --- a/c++/src/objtools/format/feature_item.cpp +++ b/c++/src/objtools/format/feature_item.cpp @@ -1,4 +1,4 @@ -/* $Id: feature_item.cpp 670941 2023-08-04 12:24:26Z ivanov $ +/* $Id: feature_item.cpp 679820 2024-03-04 18:32:45Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -970,26 +970,6 @@ static bool s_IsValidRefSeqExceptionText(const string& text) return sc_LegalRefSeqExceptText.find(text.c_str()) != sc_LegalRefSeqExceptText.end(); } -bool s_GetGbValue( CConstRef feat, const string& key, string& value ) -{ - if ( ! feat->IsSetQual() ) { - return false; - } - const CSeq_feat_Base::TQual & qual = feat->GetQual(); // must store reference since ITERATE macro evaluates 3rd arg multiple times - ITERATE( CSeq_feat::TQual, it, qual ) { - if (!(*it)->IsSetQual() || !(*it)->IsSetVal()) { - continue; - } - if ( (*it)->GetQual() != key ) { - continue; - } - value = (*it)->GetVal(); - return true; - } - return false; -} - - // -- FeatureItemBase CFeatureItemBase::CFeatureItemBase @@ -3315,7 +3295,7 @@ void CFeatureItem::x_AddQualsPsecStr( CSeqFeatData_Base::TPsec_str sec_str_type = data.GetPsec_str(); - string sec_str_as_str = CSeqFeatData_Base::GetTypeInfo_enum_EPsec_str()->FindName( sec_str_type, true ); + string sec_str_as_str = CSeqFeatData_Base::ENUM_METHOD_NAME(EPsec_str)()->FindName(sec_str_type, true); x_AddQual( eFQ_sec_str_type, new CFlatStringQVal( sec_str_as_str ) ); } @@ -6467,7 +6447,6 @@ void CSourceFeatureItem::x_AddQuals(const CBioSource& src, CBioseqContext& ctx) } } - void CSourceFeatureItem::x_FormatQuals(CFlatFeature& ff) const { ff.SetQuals().reserve(m_Quals.Size()); @@ -6538,7 +6517,11 @@ void CSourceFeatureItem::x_FormatQuals(CFlatFeature& ff) const DO_QUAL(transposon_name); DO_QUAL(insertion_seq_name); - DO_QUAL(country); + if ( GetContext()->Config().GeoLocNameCountry() || CSubSource::NCBI_UseGeoLocNameForCountry() ) { + x_FormatQual(eSQ_country, "geo_loc_name", qvec); + } else { + DO_QUAL(country); + } DO_QUAL(focus); diff --git a/c++/src/objtools/format/flat_file_config.cpp b/c++/src/objtools/format/flat_file_config.cpp index 256cd0e3..ae006f92 100644 --- a/c++/src/objtools/format/flat_file_config.cpp +++ b/c++/src/objtools/format/flat_file_config.cpp @@ -1,4 +1,4 @@ -/* $Id: flat_file_config.cpp 672289 2023-09-04 17:05:57Z sadyrovr $ +/* $Id: flat_file_config.cpp 677118 2024-01-04 20:46:50Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -600,7 +600,8 @@ void CFlatFileConfig::AddArgumentDescriptions(CArgDescriptions& args) DENT "ShowDeflineModifiers (131072) - show definition line modifiers\n" DENT "DoNotUseAutoDef (262144) - suppress automatic defline generator\n" DENT "OldTpaDisplay (542288) - old TPA display with PRIMARY block\n" - DENT "DisableDefaultIndex (1048576) - disable SeqEntry indexer", + DENT "DisableDefaultIndex (1048576) - disable SeqEntry indexer\n" + DENT "GeoLocNameCountry (2097152) - use geo_loc_name instead of country", CArgDescriptions::eString, ""); #undef DENT @@ -951,6 +952,7 @@ CFlatFileConfig::TCustom x_GetCustom(const CArgs& args) DOFLG(ShowDeflineModifiers), DOFLG(DoNotUseAutoDef), DOFLG(DisableDefaultIndex), + DOFLG(GeoLocNameCountry), #undef DOFLG }; @@ -987,6 +989,7 @@ CFlatFileConfig::TCustom x_GetCustom(const CArgs& args) DOFLG(ShowDeflineModifiers), DOFLG(DoNotUseAutoDef), DOFLG(DisableDefaultIndex), + DOFLG(GeoLocNameCountry), #undef DOFLG }; static const size_t kArraySize = ArraySize(kDescrTable); diff --git a/c++/src/objtools/format/gather_items.cpp b/c++/src/objtools/format/gather_items.cpp index 8e60b412..643c2503 100644 --- a/c++/src/objtools/format/gather_items.cpp +++ b/c++/src/objtools/format/gather_items.cpp @@ -1,4 +1,4 @@ -/* $Id: gather_items.cpp 672583 2023-09-11 17:39:40Z ivanov $ +/* $Id: gather_items.cpp 681899 2024-04-17 12:39:26Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -446,11 +446,10 @@ void CFlatGatherer::x_GatherBioseq( ( !cfg.IsFormatFTable() || cfg.ShowFtablePeptides() ) ) { x_DoMultipleSections(seq); } else { - // display as a single bioseq (single section) - m_Current.Reset(new CBioseqContext(prev_seq, seq, next_seq, *m_Context, 0, + m_Current.Reset(new CBioseqContext(prev_seq, seq, next_seq, *m_Context, nullptr, (topLevelSeqEntryContext ? &*topLevelSeqEntryContext : nullptr))); - if ( m_Context->UsingSeqEntryIndex() && ! cfg.DisableReferenceCache() ) { + if (m_Context->UsingSeqEntryIndex() && ! cfg.DisableReferenceCache()) { CRef idx = m_Context->GetSeqEntryIndex(); if (idx) { if (! idx->DistributedReferences()) { @@ -1019,7 +1018,9 @@ void CFlatGatherer::x_GatherComments(void) const */ x_HistoryComments(ctx); +// LCOV_EXCL_START x_RefSeqGenomeComments(ctx); +// LCOV_EXCL_STOP x_WGSComment(ctx); x_TSAComment(ctx); x_TLSComment(ctx); @@ -1464,6 +1465,7 @@ void CFlatGatherer::x_HistoryComments(CBioseqContext& ctx) const } } +// LCOV_EXCL_START void CFlatGatherer::x_RefSeqGenomeComments(CBioseqContext& ctx) const { for (CSeqdesc_CI it(ctx.GetHandle(), CSeqdesc::e_User); it; ++it) { @@ -1476,6 +1478,7 @@ void CFlatGatherer::x_RefSeqGenomeComments(CBioseqContext& ctx) const } } } +// LCOV_EXCL_STOP void CFlatGatherer::x_WGSComment(CBioseqContext& ctx) const @@ -1963,29 +1966,6 @@ void CFlatGatherer::x_CollectSourceDescriptors } -void CFlatGatherer::x_CollectSourceFeatures -(const CBioseq_Handle& bh, - const TRange& range, - CBioseqContext& ctx, - TSourceFeatSet& srcs) const -{ - SAnnotSelector as; - as.SetFeatType(CSeqFeatData::e_Biosrc) - .SetOverlapIntervals() - .SetResolveDepth(1) // in case segmented - .SetNoMapping(false) - .SetLimitTSE(ctx.GetHandle().GetTopLevelEntry()); - - for ( CFeat_CI fi(bh, range, as); fi; ++fi ) { - TSeqPos start = fi->GetLocation().GetTotalRange().GetFrom(); - TSeqPos stop = fi->GetLocation().GetTotalRange().GetTo(); - if ( start >= range.GetFrom() && stop <= range.GetTo() ) { - CRef sf(new CSourceFeatureItem(*fi, ctx, m_Feat_Tree)); - srcs.push_back(sf); - } - } -} - /* moved to sequence:: (RW-1446) static CConstRef x_GetSourceFeatFromCDS ( const CBioseq_Handle& bsh @@ -3080,6 +3060,36 @@ void CFlatGatherer::x_GatherFeaturesOnWholeLocationIdx s_SetGapIdxData (gap_data, gaps); } + CScope::TBioseqHandles cdd_handles; + CScope::TCDD_Entries cdd_entries; + bool load_cdd = false; + if (!ctx.Config().HideCDDFeatures()) { + switch (ctx.Config().GetPolicy()) { + case CFlatFileConfig::ePolicy_External: + load_cdd = true; + break; + case CFlatFileConfig::ePolicy_Adaptive: + load_cdd = ctx.Config().ShowCDDFeatures(); + break; + case CFlatFileConfig::ePolicy_Web: + load_cdd = hdl.GetBioseqLength() <= 1000000 && ctx.Config().ShowCDDFeatures(); + break; + default: + load_cdd = false; + break; + } + } + if (load_cdd) { + SAnnotSelector sel; + sel.SetFeatType(CSeqFeatData::e_Cdregion); + CScope::TIds cdd_ids; + for (CFeat_CI cds_it(hdl, sel); cds_it; ++cds_it) { + cdd_ids.push_back(cds_it->GetProductId()); + } + cdd_handles = hdl.GetScope().GetBioseqHandles(cdd_ids); + cdd_entries = hdl.GetScope().GetCDDAnnots(cdd_handles); + } + bsx->IterateFeatures([this, &ctx, &prev_feat, &loc_len, &item, &out, &slice_mapper, gaps, &gap_data, showGapsOfSizeZero, bsx](CFeatureIndex& sfx) { try { @@ -3525,6 +3535,54 @@ CRef s_MakeSliceMapper(const CSeq_loc& loc, CBioseqContext& ctx } +void CFlatGatherer::x_CollectSourceFeatures +(const CBioseq_Handle& bh, + const TRange& range, + CBioseqContext& ctx, + TSourceFeatSet& srcs) const +{ + SAnnotSelector as; + as.SetFeatType(CSeqFeatData::e_Biosrc) + .SetOverlapIntervals() + .SetResolveDepth(1) // in case segmented + .SetNoMapping(false) + .SetLimitTSE(ctx.GetHandle().GetTopLevelEntry()); + + bool isWhole = ctx.GetLocation().IsWhole(); + + CSeq_loc loc; + if (ctx.GetMasterLocation()) { + loc.Assign(*ctx.GetMasterLocation()); + } else { + loc.Assign(*ctx.GetHandle().GetRangeSeq_loc(0, 0)); + } + CScope& scope = ctx.GetScope(); + CRef slice_mapper = s_MakeSliceMapper(loc, ctx); + + for ( CFeat_CI fi(bh, range, as); fi; ++fi ) { + TSeqPos start = fi->GetLocation().GetTotalRange().GetFrom(); + TSeqPos stop = fi->GetLocation().GetTotalRange().GetTo(); + TSeqPos from = range.GetFrom(); + TSeqPos to = range.GetTo(); + if ( to >= start && from <= stop ) { + if (isWhole) { + CRef sf(new CSourceFeatureItem(*fi, ctx, m_Feat_Tree)); + srcs.push_back(sf); + continue; + } + CConstRef feat_loc(&fi->GetLocation()); + // Map the feat_loc if we're using a slice (the "-from" and "-to" command-line options) + CRange range = loc.GetTotalRange(); + const CSeq_feat& ft = fi->GetMappedFeature(); + CMappedFeat mapped_feat = s_GetTrimmedMappedFeat(ft, range, scope); + feat_loc.Reset( slice_mapper->Map( mapped_feat.GetLocation() ) ); + feat_loc = s_NormalizeNullsBetween( feat_loc ); + CRef sf(new CSourceFeatureItem(*fi, ctx, m_Feat_Tree, feat_loc.GetPointer())); + srcs.push_back(sf); + } + } +} + void CFlatGatherer::x_GatherFeaturesOnRangeIdx (const CSeq_loc& loc, SAnnotSelector& sel, diff --git a/c++/src/objtools/format/gbseq_formatter.cpp b/c++/src/objtools/format/gbseq_formatter.cpp index 14292c3e..e72ed029 100644 --- a/c++/src/objtools/format/gbseq_formatter.cpp +++ b/c++/src/objtools/format/gbseq_formatter.cpp @@ -1,4 +1,4 @@ -/* $Id: gbseq_formatter.cpp 670941 2023-08-04 12:24:26Z ivanov $ +/* $Id: gbseq_formatter.cpp 679820 2024-03-04 18:32:45Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -326,7 +326,7 @@ CGBSeq::TStrandedness s_GBSeqStrandedness( // it's text name gives us something to work with const CEnumeratedTypeValues * pBiomolEnumInfo = - CMolInfo::GetTypeInfo_enum_EBiomol(); + CMolInfo::ENUM_METHOD_NAME(EBiomol)(); if( pBiomolEnumInfo ) { CEnumeratedTypeValues::TValueToName::const_iterator find_iter = pBiomolEnumInfo->ValueToName().find(eBiomol); @@ -374,7 +374,7 @@ CGBSeq::TMoltype s_GBSeqMoltype(CMolInfo::TBiomol biomol) // For the remaining cases, if the biomol string contains "RNA", // return "RNA", otherwise return "DNA". string biomol_str = - CMolInfo::GetTypeInfo_enum_EBiomol()->FindName(biomol,true); + CMolInfo::ENUM_METHOD_NAME(EBiomol)()->FindName(biomol, true); if (biomol_str.find("RNA") != NPOS) return "RNA"; else diff --git a/c++/src/objtools/format/genbank_formatter.cpp b/c++/src/objtools/format/genbank_formatter.cpp index 1ad83143..dfeab530 100644 --- a/c++/src/objtools/format/genbank_formatter.cpp +++ b/c++/src/objtools/format/genbank_formatter.cpp @@ -1,4 +1,4 @@ -/* $Id: genbank_formatter.cpp 673822 2023-10-11 13:08:55Z ivanov $ +/* $Id: genbank_formatter.cpp 683835 2024-06-06 12:08:29Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -320,12 +320,12 @@ void CGenbankFormatter::EndSection else { l.push_back("//"); } - text_os.AddParagraph(l, nullptr); + text_os.AddParagraph(l); if( bHtml && cfg.IsModeEntrez() ) { text_os.AddLine( s_get_anchor_html("slash", end_item.GetContext()), - 0, IFlatTextOStream::eAddNewline_No ); + nullptr, IFlatTextOStream::eAddNewline_No); } text_os.Flush(); @@ -614,8 +614,8 @@ void CGenbankFormatter::FormatHtmlAnchor( CRef p_text_os; IFlatTextOStream& text_os = s_WrapOstreamIfCallbackExists(p_text_os, html_anchor, orig_text_os); - text_os.AddLine( s_get_anchor_html(html_anchor.GetLabelCore(), html_anchor.GetContext()), - 0, IFlatTextOStream::eAddNewline_No ); + text_os.AddLine(s_get_anchor_html(html_anchor.GetLabelCore(), html_anchor.GetContext()), + nullptr, IFlatTextOStream::eAddNewline_No); } /////////////////////////////////////////////////////////////////////////// @@ -1269,7 +1269,7 @@ CGenbankFormatter::x_GetFeatureSpanAndScriptStart( pre_feature_html << ");"; string temp = CNcbiOstrstreamToString(pre_feature_html); - text_os.AddLine(temp, 0, IFlatTextOStream::eAddNewline_No); + text_os.AddLine(temp, nullptr, IFlatTextOStream::eAddNewline_No); } /////////////////////////////////////////////////////////////////////////// @@ -1426,7 +1426,7 @@ void CGenbankFormatter::FormatFeatHeader Wrap(l, "FEATURES", "Location/Qualifiers", eFeatHead); - text_os.AddParagraph(l, nullptr); + text_os.AddParagraph(l); text_os.Flush(); } @@ -1686,9 +1686,9 @@ void CGenbankFormatter::FormatFeature x_SmartWrapQuals(f, *feat, *text_os); - if( bHtml && f.GetContext()->Config().IsModeEntrez() && f.GetContext()->Config().ShowSeqSpans() ) { + if (bHtml && f.GetContext()->Config().IsModeEntrez() && f.GetContext()->Config().ShowSeqSpans()) { // close the , without an endline - text_os->AddLine("", 0, IFlatTextOStream::eAddNewline_No ); + text_os->AddLine("", nullptr, IFlatTextOStream::eAddNewline_No); } text_os->Flush(); @@ -1995,7 +1995,7 @@ void CGenbankFormatter::FormatSequence // normal case: print entire sequence, including all the N's in any gap. try { s_FormatRegularSequencePiece( seq, text_os, iter, total, base_count ); - } catch (CSeqVectorException) { + } catch (CSeqVectorException&) { } } else { // special case: instead of showing the N's in a gap right away, we have the @@ -2036,7 +2036,7 @@ void CGenbankFormatter::FormatSequence TSeqPos fake_total = distance_until_next_significant_gap; try { s_FormatRegularSequencePiece( seq, text_os, iter, fake_total, base_count); - } catch (CSeqVectorException) { + } catch (CSeqVectorException&) { } const TSeqPos amount_to_subtract_from_total = ( distance_until_next_significant_gap - fake_total ); diff --git a/c++/src/objtools/format/genbank_gather.cpp b/c++/src/objtools/format/genbank_gather.cpp index ee24285a..a960d9d9 100644 --- a/c++/src/objtools/format/genbank_gather.cpp +++ b/c++/src/objtools/format/genbank_gather.cpp @@ -1,4 +1,4 @@ -/* $Id: genbank_gather.cpp 642614 2021-12-23 15:35:42Z stakhovv $ +/* $Id: genbank_gather.cpp 678686 2024-02-08 19:25:16Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -258,8 +258,8 @@ void CGenbankGatherer::x_GatherWGS(void) const { CBioseqContext& ctx = *m_Current; - const string* first = 0; - const string* last = 0; + const string* first = nullptr; + const string* last = nullptr; bool bFirstWgsItem = true; for (CSeqdesc_CI desc(ctx.GetHandle(), CSeqdesc::e_User); desc; ++desc) { @@ -296,7 +296,7 @@ void CGenbankGatherer::x_GatherWGS(void) const } } - if ( (first != 0) && (last != 0) ) { + if (first && last) { if( bFirstWgsItem ) { CConstRef anchor_item( new CHtmlAnchorItem(ctx, "wgs" ) ); ItemOS() << anchor_item; @@ -312,8 +312,8 @@ void CGenbankGatherer::x_GatherTSA(void) const { CBioseqContext& ctx = *m_Current; - const string* first = 0; - const string* last = 0; + const string* first = nullptr; + const string* last = nullptr; for (CSeqdesc_CI desc(ctx.GetHandle(), CSeqdesc::e_User); desc; ++desc) { const CUser_object& uo = desc->GetUser(); @@ -347,7 +347,7 @@ void CGenbankGatherer::x_GatherTSA(void) const } } - if ( (first != 0) && (last != 0) ) { + if (first && last) { CConstRef item( new CTSAItem(tsa_type, *first, *last, uo, ctx) ); ItemOS() << item; } @@ -358,8 +358,8 @@ void CGenbankGatherer::x_GatherTLS(void) const { CBioseqContext& ctx = *m_Current; - const string* first = 0; - const string* last = 0; + const string* first = nullptr; + const string* last = nullptr; for (CSeqdesc_CI desc(ctx.GetHandle(), CSeqdesc::e_User); desc; ++desc) { const CUser_object& uo = desc->GetUser(); @@ -385,7 +385,7 @@ void CGenbankGatherer::x_GatherTLS(void) const } } - if ( (first != 0) && (last != 0) ) { + if (first && last) { CConstRef item( new CTSAItem(CTSAItem::eTLS_Projects, *first, *last, uo, ctx) ); ItemOS() << item; } diff --git a/c++/src/objtools/format/gene_finder.cpp b/c++/src/objtools/format/gene_finder.cpp index a7a2969f..0c5cb02e 100644 --- a/c++/src/objtools/format/gene_finder.cpp +++ b/c++/src/objtools/format/gene_finder.cpp @@ -1,4 +1,4 @@ -/* $Id: gene_finder.cpp 642614 2021-12-23 15:35:42Z stakhovv $ +/* $Id: gene_finder.cpp 678686 2024-02-08 19:25:16Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -57,7 +57,7 @@ CGeneFinder::CGeneSearchPlugin::CGeneSearchPlugin( { ITERATE( CSeq_loc, loc_iter, location ) { const CSeq_id *seq_id = loc_iter.GetRangeAsSeq_loc()->GetId(); - if( seq_id != NULL ) { + if (seq_id) { m_BioseqHandle = m_Scope->GetBioseqHandle( *seq_id ); if( m_BioseqHandle ) { break; @@ -153,9 +153,9 @@ void CGeneFinder::CGeneSearchPlugin::processMainLoop( SAnnotSelector::EOverlapType annot_overlap_type ) { // check if given candidate feat matches the filter - if( m_Filtering_gene_xref != NULL && + if (m_Filtering_gene_xref && feat.GetOriginalFeature().IsSetData() && - feat.GetOriginalFeature().GetData().IsGene() ) + feat.GetOriginalFeature().GetData().IsGene()) { if( ! GeneMatchesXref( &feat.GetOriginalFeature().GetData().GetGene(), &*m_Filtering_gene_xref ) ) { shouldContinueToNextIteration = true; @@ -284,7 +284,7 @@ void CGeneFinder::GetAssociatedGeneInfo( // ---------------------------------------------------------------------------- { out_s_feat.Reset(); - out_g_ref = NULL; + out_g_ref = nullptr; // guard against suppressed gene xrefs out_suppression_check_gene_ref = GetSuppressionCheckGeneRef(in_feat); @@ -311,7 +311,7 @@ void CGeneFinder::GetAssociatedGeneInfo( } if( xref_label.empty() ) { - xref_g_ref = NULL; + xref_g_ref = nullptr; } bool also_look_at_parent_CDS = false; @@ -345,7 +345,7 @@ void CGeneFinder::GetAssociatedGeneInfo( } // always use xref_g_ref directly if it's set, but CDS's xref isn't (e.g. NP_041400) - if( also_look_at_parent_CDS && NULL != xref_g_ref ) { + if (also_look_at_parent_CDS && xref_g_ref) { out_g_ref = xref_g_ref; out_s_feat.ReleaseOrNull(); return; @@ -397,7 +397,7 @@ void CGeneFinder::GetAssociatedGeneInfo( out_s_feat.Reset(); if( ! pParentDecidingGeneRef->IsSuppressed() ) { out_g_ref = pParentDecidingGeneRef; - xref_g_ref = NULL; // TODO: is it right to ignore mat_peptide gene xrefs? + xref_g_ref = nullptr; // TODO: is it right to ignore mat_peptide gene xrefs? } } else if( ownGeneIsOkay ) { // do nothing; it's already set @@ -420,7 +420,7 @@ void CGeneFinder::GetAssociatedGeneInfo( } // end: if( also_look_at_parent_CDS ) } - if ( in_feat && NULL == xref_g_ref ) { + if (in_feat && ! xref_g_ref) { if (out_s_feat) { out_g_ref = &( out_s_feat->GetData().GetGene() ); } @@ -436,9 +436,8 @@ void CGeneFinder::GetAssociatedGeneInfo( } // find a gene match using the xref (e.g. match by locus or whatever) - if( NULL != xref_g_ref && ! GeneMatchesXref( out_g_ref, xref_g_ref ) ) - { - out_g_ref = NULL; + if (xref_g_ref && ! GeneMatchesXref(out_g_ref, xref_g_ref)) { + out_g_ref = nullptr; out_s_feat.Reset(); CSeq_feat_Handle feat = ResolveGeneXref( xref_g_ref, ctx.GetTopLevelEntry() ); @@ -452,7 +451,7 @@ void CGeneFinder::GetAssociatedGeneInfo( // we found no match for the gene, but we can fall back on the xref // itself (e.g. K03223.1) - if( NULL == out_g_ref ) { + if (! out_g_ref) { out_g_ref = xref_g_ref; } } @@ -473,7 +472,7 @@ CSeq_feat_Handle CGeneFinder::ResolveGeneXref( }; CSeq_feat_Handle feat; - if( xref_g_ref == NULL ) { + if (! xref_g_ref) { return feat; } @@ -699,11 +698,11 @@ CGeneFinder::GetFeatViaSubsetThenExtremesIfPossible_Helper( needToAddGbLoaderBack = true; } catch(...) { // we couldn't remove the GBLOADER temporarily, so we make a temporary substitute CScope - scope = NULL; + scope = nullptr; } } - if (scope == NULL) { + if (! scope) { // TODO: check if this call is fast temp_scope.Reset(new CScope(*CObjectManager::GetInstance())); temp_scope->AddDefaults(); @@ -811,7 +810,7 @@ bool CGeneFinder::GeneMatchesXref( const CGene_ref * other_ref, const CGene_ref * xref ) { - if( NULL == other_ref || NULL == xref ) { + if (! other_ref || ! xref) { return false; } diff --git a/c++/src/objtools/format/genome_project_item.cpp b/c++/src/objtools/format/genome_project_item.cpp index a337f2ac..b5ad1d6e 100644 --- a/c++/src/objtools/format/genome_project_item.cpp +++ b/c++/src/objtools/format/genome_project_item.cpp @@ -1,4 +1,4 @@ -/* $Id: genome_project_item.cpp 642614 2021-12-23 15:35:42Z stakhovv $ +/* $Id: genome_project_item.cpp 678686 2024-02-08 19:25:16Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -193,8 +193,8 @@ void CGenomeProjectItem::x_GatherInfo(CBioseqContext& ctx) { const bool bHtml = ctx.Config().DoHTML(); - const CUser_object *genome_projects_user_obje = NULL; - const CUser_object *dblink_user_obj = NULL; + const CUser_object* genome_projects_user_obje = nullptr; + const CUser_object* dblink_user_obj = nullptr; // extract all the useful user objects for (CSeqdesc_CI desc(ctx.GetHandle(), CSeqdesc::e_User); desc; ++desc) { @@ -218,7 +218,7 @@ void CGenomeProjectItem::x_GatherInfo(CBioseqContext& ctx) } // process GenomeProjectsDB - if( genome_projects_user_obje != NULL ) { + if (genome_projects_user_obje) { ITERATE (CUser_object::TData, uf_it, genome_projects_user_obje->GetData()) { const CUser_field& field = **uf_it; if ( field.IsSetLabel() && field.GetLabel().IsStr() ) { @@ -246,7 +246,7 @@ void CGenomeProjectItem::x_GatherInfo(CBioseqContext& ctx) // ( we have these temporary vectors because we can't push straight to m_DBLinkLines // because we have to sort them in case they're out of order in the ASN.1 ) vector dblinkLines; - if( dblink_user_obj != NULL ) { + if (dblink_user_obj) { ITERATE (CUser_object::TData, uf_it, dblink_user_obj->GetData()) { const CUser_field& field = **uf_it; if ( field.IsSetLabel() && field.GetLabel().IsStr() && field.CanGetData() ) { @@ -267,7 +267,7 @@ void CGenomeProjectItem::x_GatherInfo(CBioseqContext& ctx) if( dbLinkLabelInfo.allow_text && (field_data.IsStrs() || field_data.IsStr()) ) { - const TFieldData::TStrs * pStrs = NULL; + const TFieldData::TStrs* pStrs = nullptr; // unique_ptr just used to destroy the pStrs if it's // dynamically created. @@ -300,7 +300,7 @@ void CGenomeProjectItem::x_GatherInfo(CBioseqContext& ctx) (field_data.IsInts() || field_data.IsInt()) ) { - const TFieldData::TInts * pInts = NULL; + const TFieldData::TInts* pInts = nullptr; // destroys pInts if it's dynamically created unique_ptr pIntsDestroyer; diff --git a/c++/src/objtools/format/item_formatter.cpp b/c++/src/objtools/format/item_formatter.cpp index cecce368..84c6de53 100644 --- a/c++/src/objtools/format/item_formatter.cpp +++ b/c++/src/objtools/format/item_formatter.cpp @@ -1,4 +1,4 @@ -/* $Id: item_formatter.cpp 665414 2023-04-04 12:08:46Z stakhovv $ +/* $Id: item_formatter.cpp 678686 2024-02-08 19:25:16Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -104,7 +104,7 @@ CFlatItemFormatter* CFlatItemFormatter::New(CFlatFileConfig::TFormat format) "This format is currently not supported"); } - return 0; + return nullptr; } void CFlatItemFormatter::SetContext(CFlatFileContext& ctx) @@ -174,7 +174,7 @@ static void s_FormatSecondaryAccessions typedef vector TAccBin; typedef vector TAccBins; TAccBins bins; - TAccBin* curr_bin = NULL; + TAccBin* curr_bin = nullptr; // populate the bins CAccessionItem::TExtra_accessions::const_iterator prev = xtra.begin(); diff --git a/c++/src/objtools/format/keywords_item.cpp b/c++/src/objtools/format/keywords_item.cpp index 4ca041bd..658cb4eb 100644 --- a/c++/src/objtools/format/keywords_item.cpp +++ b/c++/src/objtools/format/keywords_item.cpp @@ -1,4 +1,4 @@ -/* $Id: keywords_item.cpp 665431 2023-04-04 17:43:43Z stakhovv $ +/* $Id: keywords_item.cpp 683835 2024-06-06 12:08:29Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -342,7 +342,7 @@ void CKeywordsItem::x_GatherInfo(CBioseqContext& ctx) FOR_EACH_STRING_IN_LIST ( s_itr, keywords ) { x_AddKeyword(*s_itr); } - } catch (CException) { + } catch (CException&) { } } diff --git a/c++/src/objtools/format/qualifiers.cpp b/c++/src/objtools/format/qualifiers.cpp index e645e224..48a5b9c1 100644 --- a/c++/src/objtools/format/qualifiers.cpp +++ b/c++/src/objtools/format/qualifiers.cpp @@ -1,4 +1,4 @@ -/* $Id: qualifiers.cpp 670941 2023-08-04 12:24:26Z ivanov $ +/* $Id: qualifiers.cpp 679820 2024-03-04 18:32:45Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -953,7 +953,7 @@ void CFlatOrganelleQVal::Format(TFlatQuals& q, const CTempString& name, CBioseqContext&, IFlatQVal::TFlags) const { const string& organelle - = CBioSource::GetTypeInfo_enum_EGenome()->FindName(m_Value, true); + = CBioSource::ENUM_METHOD_NAME(EGenome)()->FindName(m_Value, true); switch (m_Value) { case CBioSource::eGenome_chloroplast: diff --git a/c++/src/objtools/format/source_item.cpp b/c++/src/objtools/format/source_item.cpp index 2a92cc2e..ed78a49c 100644 --- a/c++/src/objtools/format/source_item.cpp +++ b/c++/src/objtools/format/source_item.cpp @@ -1,4 +1,4 @@ -/* $Id: source_item.cpp 665431 2023-04-04 17:43:43Z stakhovv $ +/* $Id: source_item.cpp 680678 2024-03-25 17:17:55Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -144,6 +144,7 @@ static CConstRef x_GetSourceFeatFromCDS ( } */ +/* static const char * legal_organelles[] = { "chloroplast", "chromoplast", @@ -158,36 +159,7 @@ static const char * legal_organelles[] = { "hydrogenosome", "chromatophore" }; - -void CSourceItem::x_GatherInfoIdx(CBioseqContext& ctx) -{ - CRef idx = ctx.GetSeqEntryIndex(); - if (! idx) return; - const CBioseq_Handle& bsh = ctx.GetHandle(); - CRef bsx = idx->GetBioseqIndex (bsh); - if (! bsx) return; - - m_Taxname = &bsx->GetTaxname(); - m_Common = &bsx->GetCommon(); - m_Taxid = bsx->GetTaxid(); - m_UsingAnamorph = bsx->IsUsingAnamorph(); - - const string& lineage = bsx->GetLineage(); - if (lineage.empty()) { - m_Lineage = scm_Unclassified; - } else { - m_Lineage = bsx->GetLineage(); - } - - const string* orgnlle = &bsx->GetOrganelle(); - for (int i = 0; i < sizeof (legal_organelles) / sizeof (const char*); i++) { - CTempString str = legal_organelles [i]; - if (NStr::CompareNocase (*orgnlle, str) == 0) { - m_Organelle = orgnlle; - return; - } - } -} +*/ void CSourceItem::x_GatherInfo(CBioseqContext& ctx) { @@ -196,13 +168,6 @@ void CSourceItem::x_GatherInfo(CBioseqContext& ctx) CConstRef src_ref; CConstRef src_feat; - /* - if (ctx.UsingSeqEntryIndex()) { - x_GatherInfoIdx(ctx); - return; - } - */ - if (ctx.IsProt()) { const CBioseq_Handle& bsh = ctx.GetHandle(); src_feat = sequence::GetSourceFeatForProduct(bsh); @@ -247,13 +212,6 @@ void CSourceItem::x_GatherInfo(CBioseqContext& ctx, const CBioSource& bsrc, cons CConstRef src_ref; CConstRef src_feat; - /* - if (ctx.UsingSeqEntryIndex()) { - x_GatherInfoIdx(ctx); - return; - } - */ - if (ctx.IsProt()) { const CBioseq_Handle& bsh = ctx.GetHandle(); src_feat = sequence::GetSourceFeatForProduct(bsh); diff --git a/c++/src/objtools/pubseq_gateway/client/psg_client.cpp b/c++/src/objtools/pubseq_gateway/client/psg_client.cpp index ca630ce6..dfd2144e 100644 --- a/c++/src/objtools/pubseq_gateway/client/psg_client.cpp +++ b/c++/src/objtools/pubseq_gateway/client/psg_client.cpp @@ -1,4 +1,4 @@ -/* $Id: psg_client.cpp 666909 2023-05-03 21:33:24Z sadyrovr $ +/* $Id: psg_client.cpp 677218 2024-01-08 18:27:46Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -390,6 +390,7 @@ CPSG_Processor::EProgressStatus s_GetProgressStatus(const SPSG_Args& args) if (progress == "canceled") return CPSG_Processor::eCanceled; if (progress == "timeout") return CPSG_Processor::eTimeout; if (progress == "error") return CPSG_Processor::eError; + if (progress == "unauthorized") return CPSG_Processor::eUnauthorized; // Should not happen, new server? return CPSG_Processor::eUnknown; @@ -682,7 +683,7 @@ const SPSG_UserArgs& SPSG_UserArgsBuilder::s_GetIniArgs() CPSG_Queue::SImpl::SImpl(const string& service) : queue(make_shared()), - m_Service(service) + m_Service(service.empty() ? TPSG_Service::GetDefault() : service) { } @@ -764,8 +765,8 @@ const char* s_GetBioIdResolution(EPSG_BioIdResolution value) } -template -void s_DelimitedOutput(TIterator from, TIterator to, ostream& os, const char* prefix, char delimiter, TGet get) +template +void s_DelimitedOutput(TIterator from, TIterator to, ostream& os, const char* prefix, TDelimiter delimiter, TGet get) { if (from != to) { os << prefix << get(*from++); @@ -859,8 +860,8 @@ void CPSG_Request_NamedAnnotInfo::x_GetAbsPathRef(ostream& os) const os << "/ID/get_na?" << *bio_id++; - s_DelimitedOutput(bio_id, m_BioIds.end(), os, "&seq_ids=", ' ', s_GetFastaString); - s_DelimitedOutput(m_AnnotNames, os, "&names=", ',', [](const auto& name) { return name; }); + s_DelimitedOutput(bio_id, m_BioIds.end(), os, "&seq_ids=", "%20", s_GetFastaString); + s_DelimitedOutput(m_AnnotNames, os, "&names=", ',', [](const auto& name) { return NStr::URLEncode(name, NStr::eUrlEnc_URIQueryValue); }); if (const auto tse = s_GetTSE(m_IncludeData)) os << "&tse=" << tse; @@ -931,11 +932,12 @@ shared_ptr CPSG_Queue::SImpl::SendRequestAndGetReply(shared_ptr(move(request_id), params, queue, stats); auto abs_path_ref = x_GetAbsPathRef(user_request); + const auto request_flags = r->m_Flags.IsNull() ? m_RequestFlags : r->m_Flags.GetValue(); const auto& request_context = user_request->m_RequestContext; _ASSERT(request_context); - auto request = make_shared(move(abs_path_ref), reply, request_context->Clone(), params); + auto request = make_shared(move(abs_path_ref), request_flags, reply, request_context->Clone(), params); if (ioc.AddRequest(request, queue->Stopped(), deadline)) { if (stats) stats->IncCounter(SPSG_Stats::eRequest, user_request->GetType()); @@ -1465,6 +1467,13 @@ bool CPSG_Queue::RejectsRequests() const } +void CPSG_Queue::SetRequestFlags(CPSG_Request::TFlags request_flags) +{ + _ASSERT(m_Impl); + m_Impl->SetRequestFlags(request_flags); +} + + void CPSG_Queue::SetUserArgs(SPSG_UserArgs user_args) { m_Impl->SetUserArgs(move(user_args)); diff --git a/c++/src/objtools/pubseq_gateway/client/psg_client_impl.hpp b/c++/src/objtools/pubseq_gateway/client/psg_client_impl.hpp index 35d72b4f..97c7348d 100644 --- a/c++/src/objtools/pubseq_gateway/client/psg_client_impl.hpp +++ b/c++/src/objtools/pubseq_gateway/client/psg_client_impl.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS__PUBSEQ_GATEWAY__PSG_CLIENT_IMPL_HPP #define OBJTOOLS__PUBSEQ_GATEWAY__PSG_CLIENT_IMPL_HPP -/* $Id: psg_client_impl.hpp 643926 2022-01-19 20:28:40Z sadyrovr $ +/* $Id: psg_client_impl.hpp 675129 2023-11-15 13:50:52Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -124,6 +124,7 @@ struct CPSG_Queue::SImpl bool WaitForEvents(CDeadline deadline); bool RejectsRequests() const { return m_Service.ioc.RejectsRequests(); } + void SetRequestFlags(CPSG_Request::TFlags request_flags) { m_RequestFlags = request_flags; } void SetUserArgs(SPSG_UserArgs user_args) { m_UserArgsBuilder.GetLock()->SetQueueArgs(move(user_args)); } static TApiLock GetApiLock() { return CService::GetMap(); } @@ -150,6 +151,7 @@ private: string x_GetAbsPathRef(shared_ptr user_request); CService m_Service; + CPSG_Request::TFlags m_RequestFlags = CPSG_Request::eDefaultFlags; SThreadSafe m_UserArgsBuilder; }; diff --git a/c++/src/objtools/pubseq_gateway/client/psg_client_transport.cpp b/c++/src/objtools/pubseq_gateway/client/psg_client_transport.cpp index 7f6b7a49..c1eda784 100644 --- a/c++/src/objtools/pubseq_gateway/client/psg_client_transport.cpp +++ b/c++/src/objtools/pubseq_gateway/client/psg_client_transport.cpp @@ -1,4 +1,4 @@ -/* $Id: psg_client_transport.cpp 672389 2023-09-06 18:54:00Z ivanov $ +/* $Id: psg_client_transport.cpp 684281 2024-06-18 13:28:36Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -51,6 +51,7 @@ #define __STDC_FORMAT_MACROS #include +#include #include "psg_client_transport.hpp" @@ -80,6 +81,7 @@ NCBI_PARAM_DEF(bool, PSG, https, false); NCBI_PARAM_DEF(double, PSG, no_servers_retry_delay, 1.0); NCBI_PARAM_DEF(bool, PSG, stats, false); NCBI_PARAM_DEF(double, PSG, stats_period, 0.0); +NCBI_PARAM_DEF_EX(string, PSG, service, "PSG2", eParam_Default, NCBI_PSG_SERVICE); NCBI_PARAM_DEF_EX(string, PSG, auth_token_name, "WebCubbyUser", eParam_Default, NCBI_PSG_AUTH_TOKEN_NAME); NCBI_PARAM_DEF_EX(string, PSG, auth_token, "", eParam_Default, NCBI_PSG_AUTH_TOKEN); @@ -171,6 +173,24 @@ unsigned SPSG_Params::s_GetCompetitiveAfter(double io_timer_period, double timeo return static_cast(timeout / io_timer_period); } +string SPSG_Params::GetAuthToken() +{ + string rv = TPSG_AuthToken(TPSG_AuthToken::eGetDefault); + + if (rv.empty()) { + CHttpCookies cookies; + cookies.Add(CHttpCookies::eHeader_Cookie, CNcbiEnvironment().Get("HTTP_COOKIE"), nullptr); + + for (const auto& cookie : cookies) { + if (cookie.GetName() == auth_token_name.Get()) { + return NStr::URLDecode(cookie.GetValue()); + } + } + } + + return rv; +} + void SDebugPrintout::Print(SSocketAddress address, const string& path, const string& sid, const string& phid, const string& ip, SUv_Tcp::TPort port) { ostringstream os; @@ -603,7 +623,10 @@ EPSG_Status SPSG_Reply::SState::FromRequestStatus(int status) switch (status) { case CRequestStatus::e200_Ok: return EPSG_Status::eSuccess; case CRequestStatus::e202_Accepted: return EPSG_Status::eSuccess; + case CRequestStatus::e401_Unauthorized: return EPSG_Status::eForbidden; case CRequestStatus::e403_Forbidden: return EPSG_Status::eForbidden; + case CRequestStatus::e407_ProxyAuthRequired: return EPSG_Status::eForbidden; + case CRequestStatus::e451_Unavailable_For_Legal_Reasons: return EPSG_Status::eForbidden; case CRequestStatus::e404_NotFound: return EPSG_Status::eNotFound; default: return EPSG_Status::eError; } @@ -708,8 +731,9 @@ shared_ptr SPSG_Request::SContext::Set() return guard; } -SPSG_Request::SPSG_Request(string p, shared_ptr r, CRef c, const SPSG_Params& params) : +SPSG_Request::SPSG_Request(string p, CPSG_Request::TFlags f, shared_ptr r, CRef c, const SPSG_Params& params) : full_path(move(p)), + flags(f), reply(r), context(c), m_State(&SPSG_Request::StatePrefix), @@ -1029,7 +1053,8 @@ SPSG_IoSession::SPSG_IoSession(SPSG_Server& s, const SPSG_Params& params, SPSG_A { "cookie" }, { "x-forwarded-for" } }}, - m_Queue(queue) + m_Queue(queue), + m_Requests(*this) { } @@ -1107,11 +1132,6 @@ int SPSG_IoSession::OnStreamClose(nghttp2_session*, int32_t stream_id, uint32_t { PSG_IO_SESSION_TRACE(this << '/' << stream_id << " closed: " << error_code); - if (!server.available_streams++) { - PSG_IO_TRACE("Server '" << server.address << "' became available"); - m_Queue.SignalAll(); - } - if (auto it = m_Requests.find(stream_id); it != m_Requests.end()) { if (auto [processor_id, req] = it->second.Get(); req) { auto context_guard = req->context.Set(); @@ -1133,7 +1153,7 @@ int SPSG_IoSession::OnStreamClose(nghttp2_session*, int32_t stream_id, uint32_t } } - EraseAndMoveToNext(it); + m_Requests.erase(it); } return 0; @@ -1178,7 +1198,7 @@ bool SPSG_IoSession::ProcessRequest(SPSG_TimedRequest timed_req, SPSG_Processor: const auto& path = req->full_path; const auto& session_id = context.GetSessionID(); const auto& sub_hit_id = context.GetNextSubHitID(); - const auto& cookie = m_Params.GetCookie([&]() { return context.GetProperty("auth_token"); }); + const auto& cookie = m_Params.GetCookie(req->flags, [&]() { return context.GetProperty("auth_token"); }); const auto& client_ip = context.GetClientIP(); auto headers_size = m_Headers.size(); @@ -1206,10 +1226,6 @@ bool SPSG_IoSession::ProcessRequest(SPSG_TimedRequest timed_req, SPSG_Processor: return false; } - if (!--server.available_streams) { - PSG_IO_TRACE("Server '" << server.address << "' reached request limit"); - } - req->submitted_by.Set(GetInternalId()); req->reply->debug_printout << server.address << path << session_id << sub_hit_id << client_ip << m_Tcp.GetLocalPort() << endl; PSG_IO_SESSION_TRACE(this << '/' << stream_id << " submitted"); @@ -1217,16 +1233,6 @@ bool SPSG_IoSession::ProcessRequest(SPSG_TimedRequest timed_req, SPSG_Processor: return Send(); } -void SPSG_IoSession::EraseAndMoveToNext(TRequests::iterator& it) -{ - if (IsFull()) { - // Continue processing of requests in the IO thread queue on next UV loop iteration - m_Queue.Signal(); - } - - it = m_Requests.erase(it); -} - template bool SPSG_TimedRequest::CheckExpiration(const SPSG_Params& params, const SUvNgHttp2_Error& error, TOnRetry on_retry, TOnFail on_fail) { @@ -1265,7 +1271,7 @@ void SPSG_IoSession::CheckRequestExpiration() for (auto it = m_Requests.begin(); it != m_Requests.end(); ) { if (it->second.CheckExpiration(m_Params, error, on_retry, on_fail)) { - EraseAndMoveToNext(it); + it = m_Requests.erase(it); } else { ++it; } @@ -1860,8 +1866,12 @@ SPSG_IoCoordinator::SPSG_IoCoordinator(CServiceDiscovery service) : const auto io_timer_period = SecondsToMs(params.io_timer_period); for (unsigned i = 0; i < TPSG_NumIo::GetDefault(); i++) { - // This timing cannot be changed without changes in SPSG_IoSession::CheckRequestExpiration - m_Io.emplace_back(new SPSG_Thread(m_StartBarrier, m_StopBarrier, io_timer_period, io_timer_period, params, m_Servers, m_Queues.emplace_back(m_Queues))); + try { + // This timing cannot be changed without changes in SPSG_IoSession::CheckRequestExpiration + m_Io.emplace_back(new SPSG_Thread(m_StartBarrier, m_StopBarrier, io_timer_period, io_timer_period, params, m_Servers, m_Queues.emplace_back(m_Queues))); + } catch (const std::system_error& e) { + ERR_POST(Fatal << "Failed to create I/O threads: " << e.what()); + } } m_StartBarrier.Wait(); diff --git a/c++/src/objtools/pubseq_gateway/client/psg_client_transport.hpp b/c++/src/objtools/pubseq_gateway/client/psg_client_transport.hpp index 419378a5..0347698a 100644 --- a/c++/src/objtools/pubseq_gateway/client/psg_client_transport.hpp +++ b/c++/src/objtools/pubseq_gateway/client/psg_client_transport.hpp @@ -1,7 +1,7 @@ #ifndef OBJTOOLS__PUBSEQ_GATEWAY__PSG_CLIENT_TRANSPORT__HPP #define OBJTOOLS__PUBSEQ_GATEWAY__PSG_CLIENT_TRANSPORT__HPP -/* $Id: psg_client_transport.hpp 673212 2023-09-25 19:39:06Z ivanov $ +/* $Id: psg_client_transport.hpp 676359 2023-12-14 18:25:59Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -211,7 +211,7 @@ struct SPSG_Params TPSG_RefusedStreamRetries refused_stream_retries; TPSG_UserRequestIds user_request_ids; TPSG_AuthTokenName auth_token_name; - TPSG_AuthToken auth_token; + string auth_token; TPSG_PsgClientMode client_mode; SPSG_Params() : @@ -226,20 +226,23 @@ struct SPSG_Params refused_stream_retries(TPSG_RefusedStreamRetries::eGetDefault), user_request_ids(TPSG_UserRequestIds::eGetDefault), auth_token_name(TPSG_AuthTokenName::eGetDefault), - auth_token(TPSG_AuthToken::eGetDefault), + auth_token(GetAuthToken()), client_mode(TPSG_PsgClientMode::eGetDefault) {} template - string GetCookie(TGet get) + string GetCookie(const CPSG_Request::TFlags& request_flags, TGet get) { - auto rv = auth_token.Get().empty() ? get() : auth_token.Get(); - return rv.empty() ? rv : auth_token_name.Get() + '=' + NStr::Quote(rv); + if (auto include_hup = request_flags & CPSG_Request::fIncludeHUP; !include_hup) return {}; + auto rv = auth_token.empty() ? get() : auth_token; + return rv.empty() ? rv : auth_token_name.Get() + '=' + NStr::URLEncode(rv); } private: static unsigned s_GetRequestTimeout(double io_timer_period); static unsigned s_GetCompetitiveAfter(double io_timer_period, double timeout); + + string GetAuthToken(); }; struct SDebugPrintout @@ -493,12 +496,13 @@ struct SPSG_Request }; const string full_path; + CPSG_Request::TFlags flags; shared_ptr reply; SContext context; SPSG_Submitter submitted_by; SPSG_Processor processed_by; - SPSG_Request(string p, shared_ptr r, CRef c, const SPSG_Params& params); + SPSG_Request(string p, CPSG_Request::TFlags f, shared_ptr r, CRef c, const SPSG_Params& params); enum EStateResult { eContinue, eStop, eRetry }; EStateResult OnReplyData(SPSG_Processor::TId processor_id, const char* data, size_t len) @@ -725,6 +729,39 @@ struct SPSG_Server {} }; +template +struct SPSG_Requests : private unordered_map +{ + SPSG_Requests(TSession& session) : m_Session(session) {} + + using unordered_map::begin; + using unordered_map::end; + using unordered_map::size; + using unordered_map::find; + + template + auto emplace(TArgs&&... args) + { + m_Session.RemoveStream(); + return unordered_map::emplace(std::forward(args)...); + } + + auto erase(iterator it) + { + m_Session.AddStreams(1); + return unordered_map::erase(it); + } + + auto clear() + { + m_Session.AddStreams(static_cast(size())); + return unordered_map::clear(); + } + +private: + TSession& m_Session; +}; + struct SPSG_IoSession : SUvNgHttp2_SessionBase { SPSG_Server& server; @@ -737,6 +774,24 @@ struct SPSG_IoSession : SUvNgHttp2_SessionBase void CheckRequestExpiration(); bool IsFull() const { return m_Session.GetMaxStreams() <= m_Requests.size(); } + void RemoveStream() + { + if (!--server.available_streams) { + PSG_IO_TRACE("Server '" << server.address << "' reached request limit"); + } + } + + void AddStreams(int v) + { + if (auto before = server.available_streams.fetch_add(v); (before <= 0) && (before + v > 0) ) { + PSG_IO_TRACE("Server '" << server.address << "' became available"); + m_Queue.SignalAll(); + + } else if (IsFull()) { + m_Queue.Signal(); + } + } + protected: int OnData(nghttp2_session* session, uint8_t flags, int32_t stream_id, const uint8_t* data, size_t len); int OnStreamClose(nghttp2_session* session, int32_t stream_id, uint32_t error_code); @@ -746,8 +801,6 @@ protected: private: enum EHeaders { eMethod, eScheme, eAuthority, ePath, eUserAgent, eSessionID, eSubHitID, eCookie, eClientIP, eSize }; - using TRequests = unordered_map; - SPSG_Submitter::TId GetInternalId() const { return this; } bool Fail(SPSG_Processor::TId processor_id, shared_ptr req, const SUvNgHttp2_Error& error, bool refused_stream = false); @@ -762,14 +815,12 @@ private: return Fail(processor_id, req, error, refused_stream); } - void EraseAndMoveToNext(TRequests::iterator& it); - void OnReset(SUvNgHttp2_Error error) override; SPSG_Params m_Params; array, eSize> m_Headers; SPSG_AsyncQueue& m_Queue; - TRequests m_Requests; + SPSG_Requests m_Requests; }; template diff --git a/c++/src/objtools/pubseq_gateway/client/test/test_psg_client_impl.cpp b/c++/src/objtools/pubseq_gateway/client/test/test_psg_client_impl.cpp index 72bf954c..1ace18bb 100644 --- a/c++/src/objtools/pubseq_gateway/client/test/test_psg_client_impl.cpp +++ b/c++/src/objtools/pubseq_gateway/client/test/test_psg_client_impl.cpp @@ -1,4 +1,4 @@ -/* $Id: test_psg_client_impl.cpp 666067 2023-04-19 19:01:05Z sadyrovr $ +/* $Id: test_psg_client_impl.cpp 675129 2023-11-15 13:50:52Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -439,7 +439,7 @@ void SFixture::MtReading() void SFixture::Receive(const SPSG_Params& params, shared_ptr& reply, bool sleep) { - auto request = make_shared(string(), reply, CDiagContext::GetRequestContext().Clone(), params); + auto request = make_shared(string(), CPSG_Request::eDefaultFlags, reply, CDiagContext::GetRequestContext().Clone(), params); vector> receivers; auto receive_impl = [&]() { diff --git a/c++/src/objtools/readers/agp_util.cpp b/c++/src/objtools/readers/agp_util.cpp index 23022e2d..4284710c 100644 --- a/c++/src/objtools/readers/agp_util.cpp +++ b/c++/src/objtools/readers/agp_util.cpp @@ -1,4 +1,4 @@ -/* $Id: agp_util.cpp 671757 2023-08-23 17:41:37Z ivanov $ +/* $Id: agp_util.cpp 678856 2024-02-12 19:15:03Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -356,7 +356,8 @@ const CAgpRow::TStr CAgpRow::gap_types[CAgpRow::eGapCount] = { "centromere", "short_arm", "heterochromatin", - "telomere" + "telomere", + "unknown" }; CSafeStatic CAgpRow::gap_type_codes( @@ -704,7 +705,8 @@ int CAgpRow::ParseGapCols(bool log_errors) gap_type != eGapRepeat && gap_type != eGapFragment && gap_type != eGapScaffold && - gap_type != eGapContamination + gap_type != eGapContamination && + gap_type != eGapUnknown ) { if(log_errors) m_AgpErr->Msg(CAgpErr::E_InvalidLinkage, " \"yes\" for gap_type "+GetGapType() ); diff --git a/c++/src/objtools/readers/fasta.cpp b/c++/src/objtools/readers/fasta.cpp index c30fbc74..9556e6a6 100644 --- a/c++/src/objtools/readers/fasta.cpp +++ b/c++/src/objtools/readers/fasta.cpp @@ -1,4 +1,4 @@ -/* $Id: fasta.cpp 673190 2023-09-25 14:08:51Z ivanov $ +/* $Id: fasta.cpp 680777 2024-03-27 13:52:05Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -407,7 +407,7 @@ CRef CFastaReader::ReadOneSeq(ILineErrorListener * pMessageListener) line = strmodified; } ParseDataLine(line, pMessageListener); - } catch(CBadResiduesException & e) { + } catch(const CBadResiduesException & e) { // we have to catch this exception so we can build up // information on all lines, not just the first line // with a bad residue @@ -453,7 +453,7 @@ CRef CFastaReader::ReadSet(int max_seqs, ILineErrorListener * pMessa } if (entry2.NotEmpty()) entry->SetSet().SetSeq_set().push_back(entry2); - } catch (CObjReaderParseException& e) { + } catch (const CObjReaderParseException& e) { if (e.GetErrCode() == CObjReaderParseException::eEOF) { break; } else { @@ -997,7 +997,7 @@ void CFastaReader::ParseDataLine( if( ! bad_pos_vec.empty() ) { if (TestFlag(fValidate)) { - NCBI_THROW2(CBadResiduesException, eBadResidues, + NCBI_THROW2(CBadResiduesException, eBadResidues, "CFastaReader: There are invalid " + x_NucOrProt() + "residue(s) in input sequence", CBadResiduesException::SBadResiduePositions( m_BestID, bad_pos_vec, bad_pos_line_num ) ); } else { @@ -1185,7 +1185,7 @@ bool CFastaReader::ParseGapLine( // string to value maps const CEnumeratedTypeValues::TNameToValue & linkage_evidence_to_value_map = - CLinkage_evidence::GetTypeInfo_enum_EType()->NameToValue(); + CLinkage_evidence::ENUM_METHOD_NAME(EType)()->NameToValue(); // remember if there is a gap-type conflict bool bConflictingGapTypes = false; @@ -1726,7 +1726,7 @@ CRef CFastaReader::x_ReadSeqsToAlign(TIds& ids, _ASSERT(lengths.size() == size_t(m_Row) + 1); // redundant if there was a trailing gap, but that should be okay m_Starts[lengths[m_Row]][m_Row] = CFastaAlignmentBuilder::kNoPos; - } catch (CObjReaderParseException&) { + } catch (const CObjReaderParseException&) { if (GetLineReader().AtEOF()) { break; } else { @@ -1963,7 +1963,7 @@ void ScanFastaFile(IFastaEntryScan* scanner, if (se->IsSeq()) { scanner->EntryFound(se, pos); } - } catch (CObjReaderParseException&) { + } catch (const CObjReaderParseException&) { if ( !lr->AtEOF() ) { throw; } @@ -2008,7 +2008,7 @@ void CFastaReader::SetPostponedMods(const list& postponed_mods) } -const CFastaReader::TPostponedModMap& +const CFastaReader::TPostponedModMap& CFastaReader::GetPostponedModMap() const { return m_PostponedModMap; @@ -2046,7 +2046,7 @@ void CFastaReader::x_ApplyMods( void CFastaReader::x_AddMods( TSeqPos line_number, - CBioseq& bioseq, + CBioseq& bioseq, string& processed_title, ILineErrorListener* pMessageListener) { @@ -2060,12 +2060,12 @@ void CFastaReader::x_AddMods( const auto* pFirstID = bioseq.GetFirstId(); _ASSERT(pFirstID); const auto idString = pFirstID->AsFastaString(); - + x_CheckForPostponedMods(idString, line_number, mods); if (mods.empty()) { return; } - + CDefaultModErrorReporter errorReporter(idString, line_number, pMessageListener); @@ -2086,9 +2086,9 @@ void CFastaReader::x_AddMods( } -void CFastaReader::x_CheckForPostponedMods(const string& idString, +void CFastaReader::x_CheckForPostponedMods(const string& idString, TSeqPos line_number, - CModHandler::TModList& mods) + CModHandler::TModList& mods) { if (mods.empty() || m_PostponedMods.empty()) { return; @@ -2099,14 +2099,14 @@ void CFastaReader::x_CheckForPostponedMods(const string& idString, if (m_PostponedMods.find(CModHandler::GetCanonicalName(it->GetName())) != m_PostponedMods.end()) { - if (auto mit = m_PostponedModMap.find(idString); + if (auto mit = m_PostponedModMap.find(idString); mit != m_PostponedModMap.end()) { - mit->second.second.push_back(*it); - } + mit->second.second.push_back(*it); + } else { m_PostponedModMap[idString] = {line_number, {*it}}; } - it = mods.erase(it); + it = mods.erase(it); } else { ++it; } diff --git a/c++/src/objtools/readers/gff3_reader.cpp b/c++/src/objtools/readers/gff3_reader.cpp index 660f32b3..6473dbc0 100644 --- a/c++/src/objtools/readers/gff3_reader.cpp +++ b/c++/src/objtools/readers/gff3_reader.cpp @@ -1,4 +1,4 @@ -/* $Id: gff3_reader.cpp 671730 2023-08-23 12:19:53Z ivanov $ +/* $Id: gff3_reader.cpp 681542 2024-04-10 12:47:48Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -1043,6 +1043,7 @@ void CGff3Reader::xPostProcessAnnot( return; } + /* for (const auto& it: mPendingExons) { CReaderMessage warning( eDiag_Warning, @@ -1050,6 +1051,7 @@ void CGff3Reader::xPostProcessAnnot( "Bad data line: Record references non-existent Parent=" + it.first); m_pMessageHandler->Report(warning); } + */ //location fixup: for (auto itLocation: mpLocations->LocationMap()) { diff --git a/c++/src/objtools/readers/gtf_location_merger.cpp b/c++/src/objtools/readers/gtf_location_merger.cpp index c059f27b..31f5de19 100644 --- a/c++/src/objtools/readers/gtf_location_merger.cpp +++ b/c++/src/objtools/readers/gtf_location_merger.cpp @@ -1,5 +1,5 @@ /* - * $Id: gtf_location_merger.cpp 633918 2021-06-29 11:52:57Z ludwigf $ + * $Id: gtf_location_merger.cpp 674645 2023-11-01 12:38:20Z ivanov $ * * =========================================================================== * @@ -131,14 +131,6 @@ CGtfLocationRecord::Contains( return ((mStart <= other.mStart) && (mStop >= other.mStop)); } -// ---------------------------------------------------------------------------- -bool -CGtfLocationRecord::IsContainedBy( - const CGtfLocationRecord& other) const -// ---------------------------------------------------------------------------- -{ - return other.Contains(*this); -} // ---------------------------------------------------------------------------- CRef @@ -220,6 +212,20 @@ CGtfLocationMerger::AddRecord( AddRecordForId(GetFeatureIdFor(record), record); } +static bool s_IsTranscriptType(int recType) +{ + switch (recType) { + case CGtfLocationRecord::TYPE_5utr: + case CGtfLocationRecord::TYPE_initial: + case CGtfLocationRecord::TYPE_exon: + case CGtfLocationRecord::TYPE_terminal: + case CGtfLocationRecord::TYPE_3utr: + return true; + } + return false; +} + + // ============================================================================ void CGtfLocationMerger::AddRecordForId( @@ -233,21 +239,25 @@ CGtfLocationMerger::AddRecordForId( } CGtfLocationRecord location(record, mFlags, mIdResolver); - auto& existingRecords = existingEntry->second; - for (auto& record: existingRecords) { - if (record.Contains(location)) { - if (location.mType == CGtfLocationRecord::TYPE_start_codon) { - record.mType = CGtfLocationRecord::TYPE_start_codon; - record.mPartNum = location.mPartNum; + + for (auto& existingRecord: existingEntry->second) { + if (existingRecord.Contains(location)) { + if (!s_IsTranscriptType(existingRecord.mType)) { + if (location.mType == CGtfLocationRecord::TYPE_start_codon || + s_IsTranscriptType(location.mType)) { + existingRecord.mType = location.mType; + existingRecord.mPartNum = location.mPartNum; + } } return; } - if (record.IsContainedBy(location)) { - if (record.mType == CGtfLocationRecord::TYPE_start_codon) { + if (location.Contains(existingRecord)) { + if (!s_IsTranscriptType(location.mType) && + existingRecord.mType == CGtfLocationRecord::TYPE_start_codon) { location.mType = CGtfLocationRecord::TYPE_start_codon; - location.mPartNum = record.mPartNum; + location.mPartNum = existingRecord.mPartNum; } - record = location; + existingRecord = location; return; } } diff --git a/c++/src/objtools/readers/gtf_location_merger.hpp b/c++/src/objtools/readers/gtf_location_merger.hpp index c1f72328..5a4e6653 100644 --- a/c++/src/objtools/readers/gtf_location_merger.hpp +++ b/c++/src/objtools/readers/gtf_location_merger.hpp @@ -1,5 +1,5 @@ /* - * $Id: gtf_location_merger.hpp 630386 2021-05-01 20:54:52Z stakhovv $ + * $Id: gtf_location_merger.hpp 674645 2023-11-01 12:38:20Z ivanov $ * * =========================================================================== * @@ -85,9 +85,6 @@ public: bool Contains( const CGtfLocationRecord&) const; - bool - IsContainedBy( - const CGtfLocationRecord&) const; using TYPEORDER_MAP = map; static TYPEORDER_MAP msTypeOrder; diff --git a/c++/src/objtools/readers/gtf_reader.cpp b/c++/src/objtools/readers/gtf_reader.cpp index 2245acc0..cf44dac6 100644 --- a/c++/src/objtools/readers/gtf_reader.cpp +++ b/c++/src/objtools/readers/gtf_reader.cpp @@ -1,4 +1,4 @@ -/* $Id: gtf_reader.cpp 631353 2021-05-17 14:36:08Z ludwigf $ +/* $Id: gtf_reader.cpp 675533 2023-11-27 18:59:21Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -180,6 +180,18 @@ CGtfReader::xProcessData( } } + +static bool s_IsTranscriptType(const string& recType) +{ + return (recType == "exon" || recType == "5utr" || recType == "3utr"); +} + +static bool s_IsCDSType(const string& recType) +{ + return (recType == "cds" || recType == "start_codon" || recType == "stop_codon"); +} + + // ---------------------------------------------------------------------------- bool CGtfReader::xUpdateAnnotFeature( const CGff2Record& record, @@ -190,32 +202,17 @@ bool CGtfReader::xUpdateAnnotFeature( const CGtfReadRecord& gff = dynamic_cast(record); auto recType = gff.NormalizedType(); - using TYPEHANDLER = bool (CGtfReader::*)(const CGtfReadRecord&, CSeq_annot&); - using HANDLERMAP = map; - - HANDLERMAP typeHandlers = { - {"cds", &CGtfReader::xUpdateAnnotCds}, - {"start_codon", &CGtfReader::xUpdateAnnotCds}, - {"stop_codon", &CGtfReader::xUpdateAnnotCds}, - {"5utr", &CGtfReader::xUpdateAnnotTranscript}, - {"3utr", &CGtfReader::xUpdateAnnotTranscript}, - {"exon", &CGtfReader::xUpdateAnnotTranscript}, - {"initial", &CGtfReader::xUpdateAnnotTranscript}, - {"internal", &CGtfReader::xUpdateAnnotTranscript}, - {"terminal", &CGtfReader::xUpdateAnnotTranscript}, - {"single", &CGtfReader::xUpdateAnnotTranscript}, - }; - // - // Handle officially recognized GTF types: - // - HANDLERMAP::iterator it = typeHandlers.find(recType); - if (it != typeHandlers.end()) { - TYPEHANDLER handler = it->second; - return (this->*handler)(gff, annot); + if (s_IsCDSType(recType)) { // Only attempt to create/update the transcript if xUpdateAnnotCds() succeeds + return (xUpdateAnnotCds(gff, annot) && + xUpdateAnnotTranscript(gff, annot)); + } + + if (s_IsTranscriptType(recType)) + { + return xUpdateAnnotTranscript(gff, annot); } - // // Every other type is not officially sanctioned GTF, and per spec we are // supposed to ignore it. In the spirit of being lenient on input we may // try to salvage some of it anyway. @@ -229,6 +226,49 @@ bool CGtfReader::xUpdateAnnotFeature( return true; } + +CGtfAttributes g_GetIntersection(const CGtfAttributes& x, const CGtfAttributes& y) +{ + CGtfAttributes result; + const auto& xAttributes = x.Get(); + const auto& yAttributes = y.Get(); + + auto xit = xAttributes.begin(); + auto yit = yAttributes.begin(); + while (xit != xAttributes.end() && yit != yAttributes.end()) { + if (xit->first < yit->first) { + ++xit; + } else if (yit->first < xit->first) { + ++yit; + } + else { // xit->first == yit->first + const set& xVals = xit->second; + if (xVals.empty()) { + result.AddValue(xit->first, ""); + } + else { + const set& yVals = yit->second; + set commonVals; + set_intersection(begin(xVals), end(xVals), + begin(yVals), end(yVals), + inserter(commonVals, commonVals.begin())); + if (!commonVals.empty()) { + for (const auto& val : commonVals) { + result.AddValue(xit->first, val); + } + } + } + ++xit; + ++yit; + } + + } + + + return result; +} + + // ---------------------------------------------------------------------------- bool CGtfReader::xUpdateAnnotCds( const CGtfReadRecord& gff, @@ -238,60 +278,103 @@ bool CGtfReader::xUpdateAnnotCds( auto featId = mpLocations->GetFeatureIdFor(gff, "cds"); mpLocations->AddRecordForId(featId, gff) ; return (xFindFeatById(featId) || xCreateParentCds(gff, annot)); - } +} + // ---------------------------------------------------------------------------- -bool CGtfReader::xUpdateAnnotTranscript( - const CGtfReadRecord& gff, - CSeq_annot& annot ) +void CGtfReader::xPropagateQualToParent( + const CGtfReadRecord& record, + const string& qualName, + CSeq_feat& parent) +// ---------------------------------------------------------------------------- +{ + CGtfAttributes::MultiValue values; + record.GtfAttributes().GetValues(qualName, values); + if (!values.empty()) { + xFeatureAddQualifiers(qualName, values, parent); + } +} + + +// ---------------------------------------------------------------------------- +bool CGtfReader::xUpdateAnnotParent( + const CGtfReadRecord& record, + const string& parentType, + CSeq_annot& annot) // ---------------------------------------------------------------------------- { + + auto recType = record.NormalizedType(); // // If there is no gene feature to go with this CDS then make one. Otherwise, // make sure the existing gene feature includes the location of the CDS. // - auto geneFeatId = mpLocations->GetFeatureIdFor(gff, "gene"); - CRef< CSeq_feat > pGene = xFindFeatById(geneFeatId); - if (!pGene) { - if (!xCreateParentGene(gff, annot)) { - return false; + auto parentFeatId = mpLocations->GetFeatureIdFor(record, parentType); + auto pParent = xFindFeatById(parentFeatId); + if (!pParent) { + if (parentType == "gene") { + if (!xCreateParentGene(record, annot)) { + return false; + } + } + else { + if (!xCreateParentMrna(record, annot)) { + return false; + } } - mpLocations->AddRecordForId(geneFeatId, gff); + + m_ParentChildQualMap[parentFeatId].emplace(recType, record.GtfAttributes()); + mpLocations->AddRecordForId(parentFeatId, record); } else { - mpLocations->AddRecordForId(geneFeatId, gff); - if (!xFeatureTrimQualifiers(gff, *pGene)) { - return false; - } - } + mpLocations->AddRecordForId(parentFeatId, record); - // - // If there is no mRNA feature with this gene_id|transcript_id then make one. - // Otherwise, fix up the location of the existing one. - // - auto transcriptFeatId = mpLocations->GetFeatureIdFor(gff, "transcript"); - CRef pMrna = xFindFeatById(transcriptFeatId); - if (!pMrna) { - // - // Create a brand new CDS feature: - // - if (!xCreateParentMrna(gff, annot)) { - return false; - } - mpLocations->AddRecordForId(transcriptFeatId, gff); - } - else { - // - // Update an already existing CDS features: - // - mpLocations->AddRecordForId(transcriptFeatId, gff); - if (!xFeatureTrimQualifiers(gff, *pMrna)) { - return false; - } + if (auto parentIt = m_ParentChildQualMap.find(parentFeatId); + parentIt != m_ParentChildQualMap.end()) { + if (auto childIt = parentIt->second.find(recType); + childIt != parentIt->second.end()) { + + auto& childAttributes = childIt->second; + if (!xFeatureTrimQualifiers(childAttributes, record.GtfAttributes(), *pParent)) { + return false; + } + auto accumulatedAttributes = g_GetIntersection(childAttributes, record.GtfAttributes()); + childAttributes = accumulatedAttributes; + } else { // First feature + parentIt->second.emplace(recType, record.GtfAttributes()); + + if (parentType == "gene") { + if (s_IsCDSType(recType)) { + xPropagateQualToParent(record, "gene_id", *pParent); + } else if (!xFeatureSetQualifiersGene(record, *pParent)) { + return false; + } + } else { + if (s_IsCDSType(recType)) { + xPropagateQualToParent(record, "gene_id", *pParent); + xPropagateQualToParent(record, "transcript_id", *pParent); + } else if (!xFeatureSetQualifiersRna(record, *pParent)) { + return false; + } + } + } + } } return true; } +// ---------------------------------------------------------------------------- +bool CGtfReader::xUpdateAnnotTranscript( + const CGtfReadRecord& gff, + CSeq_annot& annot ) +// ---------------------------------------------------------------------------- +{ + if (!xUpdateAnnotParent(gff, "gene", annot)) { + return false; + } + return xUpdateAnnotParent(gff, "transcript", annot); +} + // ---------------------------------------------------------------------------- bool CGtfReader::xCreateFeatureId( const CGtfReadRecord& record, @@ -330,7 +413,9 @@ bool CGtfReader::xCreateParentGene( if (!xCreateFeatureId(gff, "gene", *pFeature)) { return false; } - if ( !xFeatureSetQualifiersGene(gff, *pFeature)) { + if (gff.NormalizedType() == "cds") { + xPropagateQualToParent(gff, "gene_id", *pFeature); + } else if (!xFeatureSetQualifiersGene(gff, *pFeature)) { return false; } @@ -342,104 +427,81 @@ bool CGtfReader::xCreateParentGene( return true; } + // ---------------------------------------------------------------------------- bool CGtfReader::xFeatureSetQualifiersGene( const CGtfReadRecord& record, CSeq_feat& feature ) // ---------------------------------------------------------------------------- { - list ignoredAttrs = { - "locus_tag", "transcript_id" + set ignoredAttrs = { + "locus_tag", "transcript_id", "gene" }; - // - // Create GB qualifiers for the record attributes: - // - - const auto& attrs = record.GtfAttributes().Get(); - auto it = attrs.begin(); - for (/*NOOP*/; it != attrs.end(); ++it) { - auto cit = std::find(ignoredAttrs.begin(), ignoredAttrs.end(), it->first); - if (cit != ignoredAttrs.end()) { - continue; - } - // special case some well-known attributes - if (xProcessQualifierSpecialCase(it->first, it->second, feature)) { - continue; - } - - // turn everything else into a qualifier - xFeatureAddQualifiers(it->first, it->second, feature); - } - return true; + return xFeatureSetQualifiers(record, ignoredAttrs, feature); } + // ---------------------------------------------------------------------------- bool CGtfReader::xFeatureSetQualifiersRna( const CGtfReadRecord& record, CSeq_feat& feature ) // ---------------------------------------------------------------------------- { - list ignoredAttrs = { + set ignoredAttrs = { "locus_tag" }; - const auto& attrs = record.GtfAttributes().Get(); - auto it = attrs.begin(); - for (/*NOOP*/; it != attrs.end(); ++it) { - auto cit = std::find(ignoredAttrs.begin(), ignoredAttrs.end(), it->first); - if (cit != ignoredAttrs.end()) { - continue; - } - // special case some well-known attributes - if (xProcessQualifierSpecialCase(it->first, it->second, feature)) { - continue; - } - - // turn everything else into a qualifier - xFeatureAddQualifiers(it->first, it->second, feature); - } - return true; + return xFeatureSetQualifiers(record, ignoredAttrs, feature); } + // ---------------------------------------------------------------------------- bool CGtfReader::xFeatureSetQualifiersCds( const CGtfReadRecord& record, CSeq_feat& feature ) // ---------------------------------------------------------------------------- { - list ignoredAttrs = { + set ignoredAttrs = { "locus_tag" }; + return xFeatureSetQualifiers(record, ignoredAttrs, feature); +} - const auto& attrs = record.GtfAttributes().Get(); - auto it = attrs.begin(); - for (/*NOOP*/; it != attrs.end(); ++it) { - auto cit = std::find(ignoredAttrs.begin(), ignoredAttrs.end(), it->first); - if (cit != ignoredAttrs.end()) { + +// ---------------------------------------------------------------------------- +bool CGtfReader::xFeatureSetQualifiers( + const CGtfReadRecord& record, + const set& ignoredAttrs, + CSeq_feat& feature ) +// ---------------------------------------------------------------------------- +{ + // + // Create GB qualifiers for the record attributes: + // + for (const auto& attribute : record.GtfAttributes().Get()) { + const auto& name = attribute.first; + if (ignoredAttrs.find(name) != ignoredAttrs.end()) { continue; } + const auto& vals = attribute.second; // special case some well-known attributes - if (xProcessQualifierSpecialCase(it->first, it->second, feature)) { + if (xProcessQualifierSpecialCase(name, vals, feature)) { continue; } // turn everything else into a qualifier - xFeatureAddQualifiers(it->first, it->second, feature); + xFeatureAddQualifiers(name, vals, feature); } return true; } + // ----------------------------------------------------------------------------- bool CGtfReader::xCreateParentCds( const CGtfReadRecord& gff, CSeq_annot& annot ) // ----------------------------------------------------------------------------- { - auto featId = mpLocations->GetFeatureIdFor(gff, "cds"); - if (m_MapIdToFeature.find(featId) != m_MapIdToFeature.end()) { - return true; - } - CRef pFeature(new CSeq_feat); if (!xFeatureSetDataCds(gff, *pFeature)) { @@ -451,10 +513,41 @@ bool CGtfReader::xCreateParentCds( if (!xFeatureSetQualifiersCds(gff, *pFeature)) { return false; } + + auto featId = mpLocations->GetFeatureIdFor(gff, "cds"); + + xCheckForGeneIdConflict(gff); + m_MapIdToFeature[featId] = pFeature; return xAddFeatureToAnnot(pFeature, annot); } + +void CGtfReader::xCheckForGeneIdConflict( + const CGtfReadRecord& gff) +{ + auto transcriptId = gff.TranscriptId(); + if (!transcriptId.empty()) { + if (auto geneId = gff.GeneKey(); !geneId.empty()) { + if (auto it = m_TranscriptToGeneMap.find(transcriptId); it != m_TranscriptToGeneMap.end()) { + if (it->second != geneId) { + string msg = "Gene id '" + geneId + "' for transcript '" + transcriptId + + "' conflicts with previously-assigned '" + it->second + "'"; + CReaderMessage error( + eDiag_Error, + m_uLineNumber, + msg); + m_pMessageHandler->Report(error); + } + } + else { + m_TranscriptToGeneMap.emplace(transcriptId, geneId); + } + } + } +} + + // ----------------------------------------------------------------------------- bool CGtfReader::xCreateParentMrna( const CGtfReadRecord& gff, @@ -474,7 +567,11 @@ bool CGtfReader::xCreateParentMrna( if (!xCreateFeatureId(gff, "mrna", *pFeature)) { return false; } - if ( ! xFeatureSetQualifiersRna( gff, *pFeature ) ) { + + if (gff.NormalizedType() == "cds") { + xPropagateQualToParent(gff, "gene_id", *pFeature); + xPropagateQualToParent(gff, "transcript_id", *pFeature); + } else if (!xFeatureSetQualifiersRna( gff, *pFeature ) ) { return false; } @@ -513,6 +610,11 @@ bool CGtfReader::xFeatureSetDataGene( if (!locusTag.empty()) { gene.SetLocus_tag(locusTag); } + string locus = attributes.ValueOf("gene"); + + if (!locus.empty()) { + gene.SetLocus(locus); + } return true; } @@ -592,37 +694,76 @@ bool CGtfReader::xFeatureTrimQualifiers( CSeq_feat& feature ) // ---------------------------------------------------------------------------- { - typedef CSeq_feat::TQual TQual; + return xFeatureTrimQualifiers(record.GtfAttributes(), feature); +} + + +bool CGtfReader::xFeatureTrimQualifiers( + const CGtfAttributes& attributes, + CSeq_feat& feature ) + // ---------------------------------------------------------------------------- +{ //task: // for each attribute of the new piece check if we already got a feature // qualifier // if so, and with the same value, then the qualifier is allowed to live // otherwise it is subfeature specific and hence removed from the feature - TQual& quals = feature.SetQual(); - for (TQual::iterator it = quals.begin(); it != quals.end(); /**/) { + auto& quals = feature.SetQual(); + for (auto it = quals.begin(); it != quals.end(); /**/) { const string& qualKey = (*it)->GetQual(); - if (NStr::StartsWith(qualKey, "gff_")) { - it++; - continue; - } - if (qualKey == "locus_tag") { - it++; + + if (NStr::StartsWith(qualKey, "gff_") || + qualKey == "locus_tag" || + qualKey == "old_locus_tag" || + qualKey == "product" || + qualKey == "protein_id") { + ++it; continue; } - if (qualKey == "old_locus_tag") { - it++; + + const string& qualVal = (*it)->GetVal(); + if (!attributes.HasValue(qualKey, qualVal)) { + //superfluous qualifier- squish + it = quals.erase(it); continue; } - if (qualKey == "product") { - it++; + it++; + } + return true; +} + + +bool CGtfReader::xFeatureTrimQualifiers( + const CGtfAttributes& prevAttributes, + const CGtfAttributes& attributes, + CSeq_feat& feature ) + // ---------------------------------------------------------------------------- +{ + //task: + // for each attribute of the new piece check if we already got a feature + // qualifier + // if so, and with the same value, then the qualifier is allowed to live + // otherwise it is subfeature specific and hence removed from the feature + auto& quals = feature.SetQual(); + for (auto it = quals.begin(); it != quals.end(); /**/) { + const string& qualKey = (*it)->GetQual(); + + if (NStr::StartsWith(qualKey, "gff_") || + qualKey == "locus_tag" || + qualKey == "old_locus_tag" || + qualKey == "product" || + qualKey == "protein_id") { + ++it; continue; } - if (qualKey == "protein_id") { - it++; + + const string& qualVal = (*it)->GetVal(); + if (!prevAttributes.HasValue(qualKey, qualVal)) { + ++it; continue; } - const string& qualVal = (*it)->GetVal(); - if (!record.GtfAttributes().HasValue(qualKey, qualVal)) { + + if (!attributes.HasValue(qualKey, qualVal)) { //superfluous qualifier- squish it = quals.erase(it); continue; @@ -632,6 +773,8 @@ bool CGtfReader::xFeatureTrimQualifiers( return true; } + + // ---------------------------------------------------------------------------- bool CGtfReader::xProcessQualifierSpecialCase( const string& key, @@ -684,8 +827,17 @@ void CGtfReader::xFeatureAddQualifiers( CSeq_feat& feature) // ---------------------------------------------------------------------------- { + set existingVals; + for (const auto& pQual : feature.GetQual()) { + if (pQual->GetQual() == key) { + existingVals.insert(pQual->GetVal()); + } + } + for (auto value: values) { - feature.AddQualifier(key, value); + if (existingVals.find(value) == existingVals.end()) { + feature.AddQualifier(key, value); + } } }; @@ -752,6 +904,7 @@ void CGtfReader::xPostProcessAnnot( CRef pParentGene; if (x_GetFeatureById(parentGeneFeatId, pParentGene)) { xSetAncestorXrefs(*pFeature, *pParentGene); + } break; } diff --git a/c++/src/objtools/readers/line_error.cpp b/c++/src/objtools/readers/line_error.cpp index bdffa0ba..22e66344 100644 --- a/c++/src/objtools/readers/line_error.cpp +++ b/c++/src/objtools/readers/line_error.cpp @@ -1,35 +1,35 @@ -/* $Id: line_error.cpp 630386 2021-05-01 20:54:52Z stakhovv $ -* =========================================================================== -* -* PUBLIC DOMAIN NOTICE -* National Center for Biotechnology Information -* -* This software/database is a "United States Government Work" under the -* terms of the United States Copyright Act. It was written as part of -* the author's official duties as a United States Government employee and -* thus cannot be copyrighted. This software/database is freely available -* to the public for use. The National Library of Medicine and the U.S. -* Government have not placed any restriction on its use or reproduction. -* -* Although all reasonable efforts have been taken to ensure the accuracy -* and reliability of the software and data, the NLM and the U.S. -* Government do not and cannot warrant the performance or results that -* may be obtained by using this software or data. The NLM and the U.S. -* Government disclaim all warranties, express or implied, including -* warranties of performance, merchantability or fitness for any particular -* purpose. -* -* Please cite the author in any work or product based on this material. -* -* =========================================================================== -* -* Authors: Aaron Ucko, NCBI -* -* File Description: -* Basic reader interface -* -* =========================================================================== -*/ +/* $Id: line_error.cpp 684363 2024-06-20 19:34:09Z ivanov $ + * =========================================================================== + * + * PUBLIC DOMAIN NOTICE + * National Center for Biotechnology Information + * + * This software/database is a "United States Government Work" under the + * terms of the United States Copyright Act. It was written as part of + * the author's official duties as a United States Government employee and + * thus cannot be copyrighted. This software/database is freely available + * to the public for use. The National Library of Medicine and the U.S. + * Government have not placed any restriction on its use or reproduction. + * + * Although all reasonable efforts have been taken to ensure the accuracy + * and reliability of the software and data, the NLM and the U.S. + * Government do not and cannot warrant the performance or results that + * may be obtained by using this software or data. The NLM and the U.S. + * Government disclaim all warranties, express or implied, including + * warranties of performance, merchantability or fitness for any particular + * purpose. + * + * Please cite the author in any work or product based on this material. + * + * =========================================================================== + * + * Authors: Aaron Ucko, NCBI + * + * File Description: + * Basic reader interface + * + * =========================================================================== + */ #include @@ -40,98 +40,324 @@ BEGIN_SCOPE(objects) // static CLineError* CLineError::Create( - EProblem eProblem, - EDiagSev eSeverity, - const std::string& strSeqId, - unsigned int uLine, - const std::string & strFeatureName, - const std::string & strQualifierName, - const std::string & strQualifierValue, - const std::string & strErrorMessage, - const TVecOfLines & vecOfOtherLines) + EProblem eProblem, + EDiagSev eSeverity, + const std::string& strSeqId, + unsigned int uLine, + const std::string& strFeatureName, + const std::string& strQualifierName, + const std::string& strQualifierValue, + const std::string& strErrorMessage, + const TVecOfLines& vecOfOtherLines) { // this triggers a deprecated-call warning, which should disappear // once the constructors become protected instead of deprecated. return new CLineError( - eProblem, - eSeverity, - strSeqId, - uLine, - strFeatureName, - strQualifierName, - strQualifierValue, - strErrorMessage, - vecOfOtherLines); + eProblem, + eSeverity, + strSeqId, + uLine, + strFeatureName, + strQualifierName, + strQualifierValue, + strErrorMessage, + vecOfOtherLines); } -void -CLineError::Throw(void) const { +void CLineError::Throw(void) const +{ // this triggers a deprecated-call warning, which should disappear // once the constructors become protected instead of deprecated. throw *this; } CLineError::CLineError( - EProblem eProblem, - EDiagSev eSeverity, + EProblem eProblem, + EDiagSev eSeverity, const std::string& strSeqId, - unsigned int uLine, - const std::string & strFeatureName, - const std::string & strQualifierName, - const std::string & strQualifierValue, - const std::string & strErrorMessage, - const TVecOfLines & vecOfOtherLines ) - : m_eProblem(eProblem), m_eSeverity( eSeverity ), m_strSeqId(strSeqId), m_uLine( uLine ), - m_strFeatureName(strFeatureName), m_strQualifierName(strQualifierName), - m_strQualifierValue(strQualifierValue), m_strErrorMessage(strErrorMessage), + unsigned int uLine, + const std::string& strFeatureName, + const std::string& strQualifierName, + const std::string& strQualifierValue, + const std::string& strErrorMessage, + const TVecOfLines& vecOfOtherLines) : + m_eProblem(eProblem), + m_eSeverity(eSeverity), + m_strSeqId(strSeqId), + m_uLine(uLine), + m_strFeatureName(strFeatureName), + m_strQualifierName(strQualifierName), + m_strQualifierValue(strQualifierValue), + m_strErrorMessage(strErrorMessage), m_vecOfOtherLines(vecOfOtherLines) -{ } +{ +} -CLineError::CLineError(const CLineError & rhs ) : -m_eProblem(rhs.m_eProblem), m_eSeverity(rhs.m_eSeverity ), m_strSeqId(rhs.m_strSeqId), m_uLine(rhs.m_uLine ), - m_strFeatureName(rhs.m_strFeatureName), m_strQualifierName(rhs.m_strQualifierName), - m_strQualifierValue(rhs.m_strQualifierValue), m_strErrorMessage(rhs.m_strErrorMessage), +CLineError::CLineError(const CLineError& rhs) : + m_eProblem(rhs.m_eProblem), + m_eSeverity(rhs.m_eSeverity), + m_strSeqId(rhs.m_strSeqId), + m_uLine(rhs.m_uLine), + m_strFeatureName(rhs.m_strFeatureName), + m_strQualifierName(rhs.m_strQualifierName), + m_strQualifierValue(rhs.m_strQualifierValue), + m_strErrorMessage(rhs.m_strErrorMessage), m_vecOfOtherLines(rhs.m_vecOfOtherLines) -{ } +{ +} + -ILineError *CLineError::Clone(void) const +string ILineError::Message() const { - return new CLineError(*this); + CNcbiOstrstream result; + result << "On SeqId '" << SeqId() << "', line " << Line() << ", severity " << SeverityStr() << ": '" + << ProblemStr() << "'"; + if (! FeatureName().empty()) { + result << ", with feature name '" << FeatureName() << "'"; + } + if (! QualifierName().empty()) { + result << ", with qualifier name '" << QualifierName() << "'"; + } + if (! QualifierValue().empty()) { + result << ", with qualifier value '" << QualifierValue() << "'"; + } + if (! OtherLines().empty()) { + result << ", with other possibly relevant line(s):"; + ITERATE (TVecOfLines, line_it, OtherLines()) { + result << ' ' << *line_it; + } + } + return (string)CNcbiOstrstreamToString(result); +} + + +string ILineError::SeverityStr() const +{ + return CNcbiDiag::SeverityName(Severity()); +} + + +const string& ILineError::ErrorMessage() const +{ + return kEmptyStr; +} + + +string ILineError::ProblemStr() const +{ + return ProblemStr(Problem()); } +std::string +ILineError::ProblemStr(EProblem eProblem) +{ + switch (eProblem) { + case eProblem_Unset: + return "Unset"; + case eProblem_UnrecognizedFeatureName: + return "Unrecognized feature name"; + case eProblem_UnrecognizedQualifierName: + return "Unrecognized qualifier name"; + case eProblem_NumericQualifierValueHasExtraTrailingCharacters: + return "Numeric qualifier value has extra trailing characters after the number"; + case eProblem_NumericQualifierValueIsNotANumber: + return "Numeric qualifier value should be a number"; + case eProblem_FeatureNameNotAllowed: + return "Feature name not allowed"; + case eProblem_NoFeatureProvidedOnIntervals: + return "No feature provided on intervals"; + case eProblem_QualifierWithoutFeature: + return "No feature provided for qualifiers"; + case eProblem_FeatureBadStartAndOrStop: + return "Feature bad start and/or stop"; + case eProblem_GeneralParsingError: + return "General parsing error"; + case eProblem_BadFeatureInterval: + return "Bad feature interval"; + case eProblem_QualifierBadValue: + return "Qualifier had bad value"; + case eProblem_BadScoreValue: + return "Invalid score value"; + case eProblem_MissingContext: + return "Value ignored due to missing context"; + case eProblem_BadTrackLine: + return "Bad track line: Expected \"track key1=value1 key2=value2 ...\""; + case eProblem_InternalPartialsInFeatLocation: + return "Feature's location has internal partials"; + case eProblem_FeatMustBeInXrefdGene: + return "Feature has xref to a gene, but that gene does NOT contain the feature."; + case eProblem_CreatedGeneFromMultipleFeats: + return "Feature is trying to create a gene that conflicts with the gene created by another feature."; + case eProblem_UnrecognizedSquareBracketCommand: + return "Unrecognized square bracket command"; + case eProblem_TooLong: + return "Feature is too long"; + case eProblem_UnexpectedNucResidues: + return "Nucleotide residues unexpectedly found in feature"; + case eProblem_UnexpectedAminoAcids: + return "Amino acid residues unexpectedly found in feature"; + case eProblem_TooManyAmbiguousResidues: + return "Too many ambiguous residues"; + case eProblem_InvalidResidue: + return "Invalid residue(s)"; + case eProblem_ModifierFoundButNoneExpected: + return "Modifiers were found where none were expected"; + case eProblem_ExtraModifierFound: + return "Extraneous modifiers found"; + case eProblem_ExpectedModifierMissing: + return "Expected modifier missing"; + case eProblem_Missing: + return "Feature is missing"; + case eProblem_NonPositiveLength: + return "Feature's length must be greater than zero."; + case eProblem_ParsingModifiers: + return "Could not parse modifiers."; + case eProblem_ContradictoryModifiers: + return "Multiple different values for modifier"; + case eProblem_InvalidLengthAutoCorrected: + return "Feature had invalid length, but this was automatically corrected."; + case eProblem_IgnoredResidue: + return "An invalid residue has been ignored"; + case eProblem_InvalidQualifier: + return "Invalid qualifier for feature"; + + case eProblem_BadInfoLine: + return "Broken ##INFO line"; + case eProblem_BadFormatLine: + return "Broken ##FORMAT line"; + case eProblem_BadFilterLine: + return "Broken ##FILTER line"; + + case eProblem_ProgressInfo: + return "Just a progress info message (no error)"; + default: + return "Unknown problem"; + } +} + + +void ILineError::Write( + CNcbiOstream& out) const +{ + + out << " " << SeverityStr() << ":" << endl; + out << "Problem: " << ProblemStr() << endl; + if (GetCode()) { + out << "Code: " << GetCode(); + if (GetSubCode()) { + out << "." << GetSubCode(); + } + out << endl; + } + const string& seqid = SeqId(); + if (! seqid.empty()) { + out << "SeqId: " << seqid << endl; + } + if (Line()) { + out << "Line: " << Line() << endl; + } + const string& feature = FeatureName(); + if (! feature.empty()) { + out << "FeatureName: " << feature << endl; + } + const string& qualname = QualifierName(); + if (! qualname.empty()) { + out << "QualifierName: " << qualname << endl; + } + const string& qualval = QualifierValue(); + if (! qualval.empty()) { + out << "QualifierValue: " << qualval << endl; + } + const TVecOfLines& vecOfLines = OtherLines(); + if (! vecOfLines.empty()) { + out << "OtherLines:"; + ITERATE (TVecOfLines, line_it, vecOfLines) { + out << ' ' << *line_it; + } + out << endl; + } + out << endl; +} + + +void ILineError::WriteAsXML( + CNcbiOstream& out) const +{ + out << ""; + + // child nodes + ITERATE (TVecOfLines, line_it, OtherLines()) { + out << "" << *line_it << ""; + } + + out << "" << endl; +} + + +ILineError* CLineError::Clone() const +{ + return new CLineError(*this); +} + CLineErrorEx* CLineErrorEx::Create( - EProblem eProblem, - EDiagSev eSeverity, - int code, - int subcode, - const std::string& strSeqId, - unsigned int uLine, - const std::string & strErrorMessage, - const std::string & strFeatureName, - const std::string & strQualifierName, - const std::string & strQualifierValue, - const TVecOfLines & vecOfOtherLines) + EProblem eProblem, + EDiagSev eSeverity, + int code, + int subcode, + const std::string& strSeqId, + unsigned int uLine, + const std::string& strErrorMessage, + const std::string& strFeatureName, + const std::string& strQualifierName, + const std::string& strQualifierValue, + const TVecOfLines& vecOfOtherLines) { // this triggers a deprecated-call warning, which should disappear // once the constructors become protected instead of deprecated. return new CLineErrorEx( - eProblem, - eSeverity, - code, - subcode, - strSeqId, - uLine, - strErrorMessage, - strFeatureName, - strQualifierName, - strQualifierValue, - vecOfOtherLines); + eProblem, + eSeverity, + code, + subcode, + strSeqId, + uLine, + strErrorMessage, + strFeatureName, + strQualifierName, + strQualifierValue, + vecOfOtherLines); } -void -CLineErrorEx::Throw(void) const { +void CLineErrorEx::Throw(void) const +{ // this triggers a deprecated-call warning, which should disappear // once the constructors become protected instead of deprecated. throw *this; @@ -139,28 +365,33 @@ CLineErrorEx::Throw(void) const { CLineErrorEx::CLineErrorEx( - EProblem eProblem, - EDiagSev eSeverity, - int code, - int subcode, + EProblem eProblem, + EDiagSev eSeverity, + int code, + int subcode, const std::string& strSeqId, - unsigned int uLine, - const std::string & strErrorMessage, - const std::string & strFeatureName, - const std::string & strQualifierName, - const std::string & strQualifierValue, - const TVecOfLines & vecOfOtherLines ) - : m_eProblem(eProblem), m_eSeverity( eSeverity ), - m_Code(code), m_Subcode(subcode), - m_strSeqId(strSeqId), m_uLine( uLine ), - m_strFeatureName(strFeatureName), m_strQualifierName(strQualifierName), + unsigned int uLine, + const std::string& strErrorMessage, + const std::string& strFeatureName, + const std::string& strQualifierName, + const std::string& strQualifierValue, + const TVecOfLines& vecOfOtherLines) : + m_eProblem(eProblem), + m_eSeverity(eSeverity), + m_Code(code), + m_Subcode(subcode), + m_strSeqId(strSeqId), + m_uLine(uLine), + m_strFeatureName(strFeatureName), + m_strQualifierName(strQualifierName), m_strQualifierValue(strQualifierValue), m_strErrorMessage(strErrorMessage), m_vecOfOtherLines(vecOfOtherLines) -{ } +{ +} -CLineErrorEx::CLineErrorEx(const CLineErrorEx & rhs ) : +CLineErrorEx::CLineErrorEx(const CLineErrorEx& rhs) : CLineErrorEx(rhs.m_eProblem, rhs.m_eSeverity, rhs.m_Code, @@ -172,89 +403,85 @@ CLineErrorEx::CLineErrorEx(const CLineErrorEx & rhs ) : rhs.m_strQualifierName, rhs.m_strQualifierValue, rhs.m_vecOfOtherLines) -{} - -/* -m_eProblem(rhs.m_eProblem), m_eSeverity(rhs.m_eSeverity ), m_strSeqId(rhs.m_strSeqId), m_uLine(rhs.m_uLine ), - m_strFeatureName(rhs.m_strFeatureName), m_strQualifierName(rhs.m_strQualifierName), - m_strQualifierValue(rhs.m_strQualifierValue), m_strErrorMessage(rhs.m_strErrorMessage), - m_vecOfOtherLines(rhs.m_vecOfOtherLines) -{ } +{ +} -*/ -ILineError *CLineErrorEx::Clone(void) const +ILineError* CLineErrorEx::Clone(void) const { return new CLineErrorEx(*this); } - -CObjReaderLineException * - CObjReaderLineException::Create( - EDiagSev eSeverity, - unsigned int uLine, - const std::string &strMessage, - EProblem eProblem, - const std::string& strSeqId, - const std::string & strFeatureName, - const std::string & strQualifierName, - const std::string & strQualifierValue, +CObjReaderLineException* +CObjReaderLineException::Create( + EDiagSev eSeverity, + unsigned int uLine, + const std::string& strMessage, + EProblem eProblem, + const std::string& strSeqId, + const std::string& strFeatureName, + const std::string& strQualifierName, + const std::string& strQualifierValue, CObjReaderLineException::EErrCode eErrCode, - const TVecOfLines & vecOfOtherLines - ) + const TVecOfLines& vecOfOtherLines) { // this triggers a deprecated-call warning, which should disappear // once the constructors become protected instead of deprecated. return new CObjReaderLineException( - eSeverity, uLine, strMessage, eProblem, - strSeqId, strFeatureName, strQualifierName, strQualifierValue, - eErrCode, vecOfOtherLines ); + eSeverity, uLine, strMessage, eProblem, strSeqId, strFeatureName, strQualifierName, strQualifierValue, eErrCode, vecOfOtherLines); } -ILineError *CObjReaderLineException::Clone(void) const +ILineError* CObjReaderLineException::Clone(void) const { return new CObjReaderLineException(*this); } -void -CObjReaderLineException::Throw(void) const { +void CObjReaderLineException::Throw(void) const +{ // this triggers a deprecated-call warning, which should disappear // once the constructors become protected instead of deprecated. throw *this; } CObjReaderLineException::CObjReaderLineException( - EDiagSev eSeverity, - unsigned int uLine, - const std::string &strMessage, - EProblem eProblem, - const std::string& strSeqId, - const std::string & strFeatureName, - const std::string & strQualifierName, - const std::string & strQualifierValue, + EDiagSev eSeverity, + unsigned int uLine, + const std::string& strMessage, + EProblem eProblem, + const std::string& strSeqId, + const std::string& strFeatureName, + const std::string& strQualifierName, + const std::string& strQualifierValue, CObjReaderLineException::EErrCode eErrCode, - const TVecOfLines & vecOfOtherLines - ) - : CObjReaderParseException( DIAG_COMPILE_INFO, 0, static_cast(CException::eInvalid), strMessage, uLine, - eDiag_Info ), - m_eProblem(eProblem), m_strSeqId(strSeqId), m_uLineNumber(uLine), - m_strFeatureName(strFeatureName), m_strQualifierName(strQualifierName), - m_strQualifierValue(strQualifierValue), m_strErrorMessage(strMessage), + const TVecOfLines& vecOfOtherLines) : + CObjReaderParseException(DIAG_COMPILE_INFO, 0, static_cast(CException::eInvalid), strMessage, uLine, eDiag_Info), + m_eProblem(eProblem), + m_strSeqId(strSeqId), + m_uLineNumber(uLine), + m_strFeatureName(strFeatureName), + m_strQualifierName(strQualifierName), + m_strQualifierValue(strQualifierValue), + m_strErrorMessage(strMessage), m_vecOfOtherLines(vecOfOtherLines) { - SetSeverity( eSeverity ); + SetSeverity(eSeverity); x_InitErrCode(static_cast(eErrCode)); } -CObjReaderLineException::CObjReaderLineException(const CObjReaderLineException & rhs ) : -CObjReaderParseException( rhs ), - m_eProblem(rhs.Problem()), m_strSeqId(rhs.SeqId()), m_uLineNumber(rhs.Line()), - m_strFeatureName(rhs.FeatureName()), m_strQualifierName(rhs.QualifierName()), - m_strQualifierValue(rhs.QualifierValue()), m_strErrorMessage(rhs.ErrorMessage()), - m_vecOfOtherLines(rhs.m_vecOfOtherLines) +CObjReaderLineException::CObjReaderLineException(const CObjReaderLineException& rhs) : + CObjReaderParseException(rhs), + m_eProblem(rhs.Problem()), + m_strSeqId(rhs.SeqId()), + m_uLineNumber(rhs.Line()), + m_strFeatureName(rhs.FeatureName()), + m_strQualifierName(rhs.QualifierName()), + m_strQualifierValue(rhs.QualifierValue()), + m_strErrorMessage(rhs.ErrorMessage()), + m_vecOfOtherLines(rhs.m_vecOfOtherLines), + m_pObject(rhs.m_pObject) { - SetSeverity( rhs.Severity() ); + SetSeverity(rhs.Severity()); x_InitErrCode(static_cast(rhs.x_GetErrCode())); } @@ -262,12 +489,21 @@ CObjReaderParseException( rhs ), std::string CObjReaderLineException::ProblemStr() const { - if (!m_strErrorMessage.empty()) { + if (! m_strErrorMessage.empty()) { return m_strErrorMessage; } return ILineError::ProblemStr(); } +void CObjReaderLineException::SetObject(CRef pObject) +{ + m_pObject = pObject; +} + +CConstRef CObjReaderLineException::GetObject() const +{ + return m_pObject; +} + END_SCOPE(objects) END_NCBI_SCOPE - diff --git a/c++/src/objtools/readers/message_listener.cpp b/c++/src/objtools/readers/message_listener.cpp index 22a2e0e9..484f6524 100644 --- a/c++/src/objtools/readers/message_listener.cpp +++ b/c++/src/objtools/readers/message_listener.cpp @@ -38,45 +38,44 @@ BEGIN_NCBI_SCOPE BEGIN_SCOPE(objects) // namespace ncbi::objects:: -void -CMessageListenerBase::PutProgress( - const string & sMessage, - const Uint8 iNumDone, - const Uint8 iNumTotal) +void CMessageListenerBase::PutProgress( + const string& sMessage, + const Uint8 iNumDone, + const Uint8 iNumTotal) { // NB: Some other classes rely on the message fitting in one line. // NB: New attributes or inner elements could be added to the resulting // message at any time, so make no assumptions. - if( ! m_pProgressOstrm ) { + if (! m_pProgressOstrm) { // no stream to write to return; } *m_pProgressOstrm << " 0 ) { + if (iNumDone > 0) { *m_pProgressOstrm << "num_done=\"" << iNumDone << "\" "; } - if( iNumTotal > 0 ) { + if (iNumTotal > 0) { *m_pProgressOstrm << "num_total=\"" << iNumTotal << "\" "; } - if( sMessage.empty() ) { - *m_pProgressOstrm << " />"; + if (sMessage.empty()) { + *m_pProgressOstrm << " />"; } else { - *m_pProgressOstrm << " >"; + *m_pProgressOstrm << " >"; string sXMLEncodedMessage = NStr::XmlEncode(sMessage); // some functionality relies on progress messages fitting into // one line, so we escape newlines (just in case) while // we write it. - ITERATE( string, msg_it, sXMLEncodedMessage ) { + ITERATE (string, msg_it, sXMLEncodedMessage) { const char ch = *msg_it; - switch(ch) { + switch (ch) { case '\r': *m_pProgressOstrm << " "; break; @@ -96,11 +95,12 @@ CMessageListenerBase::PutProgress( } -CGPipeMessageListener::CGPipeMessageListener(bool ignoreBadModValue) - : m_IgnoreBadModValue(ignoreBadModValue) {} +CGPipeMessageListener::CGPipeMessageListener(bool ignoreBadModValue) : + m_IgnoreBadModValue(ignoreBadModValue) {} -bool CGPipeMessageListener::PutError(const ILineError& error) { +bool CGPipeMessageListener::PutError(const ILineError& error) +{ const auto severity = error.GetSeverity(); @@ -119,7 +119,5 @@ bool CGPipeMessageListener::PutError(const ILineError& error) { } - END_SCOPE(objects) END_NCBI_SCOPE - diff --git a/c++/src/objtools/readers/mod_reader.cpp b/c++/src/objtools/readers/mod_reader.cpp index 7796dabd..fa85831a 100644 --- a/c++/src/objtools/readers/mod_reader.cpp +++ b/c++/src/objtools/readers/mod_reader.cpp @@ -1,4 +1,4 @@ -/* $Id: mod_reader.cpp 671755 2023-08-23 17:41:23Z ivanov $ +/* $Id: mod_reader.cpp 676196 2023-12-11 21:07:17Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -94,7 +94,8 @@ static const unordered_map s_ModNameMap = {"db-xref", "dbxref"}, {"pubmed", "pmid"}, {"ft-url-mod", "ft-mod"}, - {"ft-url", "ft-map"} + {"ft-url", "ft-map"}, + {"geo-loc-name", "country"} }; //); diff --git a/c++/src/objtools/readers/mod_to_enum.cpp b/c++/src/objtools/readers/mod_to_enum.cpp index 5b4765ec..0dc41955 100644 --- a/c++/src/objtools/readers/mod_to_enum.cpp +++ b/c++/src/objtools/readers/mod_to_enum.cpp @@ -1,4 +1,4 @@ -/* $Id: mod_to_enum.cpp 630386 2021-05-01 20:54:52Z stakhovv $ +/* $Id: mod_to_enum.cpp 679820 2024-03-04 18:32:45Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -117,7 +117,7 @@ g_InitModNameOrgSubtypeMap(void) {"host",COrgMod::eSubtype_nat_host}, {"specific-host", COrgMod::eSubtype_nat_host}}; return s_InitModStringToEnumMap( - *COrgMod::GetTypeInfo_enum_ESubtype(), + *COrgMod::ENUM_METHOD_NAME(ESubtype)(), kDeprecatedOrgSubtypes, extra_smod_to_enum_names ); @@ -146,9 +146,9 @@ g_InitModNameSubSrcSubtypeMap(void) { "note", CSubSource::eSubtype_other }, { "notes", CSubSource::eSubtype_other }}; return s_InitModStringToEnumMap( - *CSubSource::GetTypeInfo_enum_ESubtype(), - skip_enum_names, - extra_smod_to_enum_names); + *CSubSource::ENUM_METHOD_NAME(ESubtype)(), + skip_enum_names, + extra_smod_to_enum_names); } @@ -164,10 +164,10 @@ g_InitModNameGenomeMap(void) { "insertion sequence", CBioSource::eGenome_insertion_seq}}; return s_InitModStringToEnumMap( - *CBioSource::GetTypeInfo_enum_EGenome(), - skip_enum_names, - extra_smod_to_enum_names, - g_GetNormalizedModVal); + *CBioSource::ENUM_METHOD_NAME(EGenome)(), + skip_enum_names, + extra_smod_to_enum_names, + g_GetNormalizedModVal); } @@ -181,10 +181,10 @@ g_InitModNameOriginMap(void) { "mutant", CBioSource::eOrigin_mut}}; return s_InitModStringToEnumMap( - *CBioSource::GetTypeInfo_enum_EOrigin(), - skip_enum_names, - extra_smod_to_enum_names, - g_GetNormalizedModVal); + *CBioSource::ENUM_METHOD_NAME(EOrigin)(), + skip_enum_names, + extra_smod_to_enum_names, + g_GetNormalizedModVal); } diff --git a/c++/src/objtools/readers/reader_base.cpp b/c++/src/objtools/readers/reader_base.cpp index 967b2395..bcc14327 100644 --- a/c++/src/objtools/readers/reader_base.cpp +++ b/c++/src/objtools/readers/reader_base.cpp @@ -1,4 +1,4 @@ -/* $Id: reader_base.cpp 650647 2022-05-31 15:10:29Z ludwigf $ +/* $Id: reader_base.cpp 680777 2024-03-27 13:52:05Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -327,8 +327,8 @@ CReaderBase::xGetData( // ---------------------------------------------------------------------------- void CReaderBase::xProcessData( - const TReaderData& readerData, - CSeq_annot& annot) + const TReaderData& /*readerData*/, + CSeq_annot& /*annot*/) // ---------------------------------------------------------------------------- { } @@ -471,8 +471,8 @@ CReaderBase::xAddStringFlagsWithMap( baseFlags |= flagEntry->second; } }; - - + + // ---------------------------------------------------------------------------- void CReaderBase::xSetBrowserRegion( const string& strRaw, @@ -593,7 +593,7 @@ bool CReaderBase::xParseTrackLine( // ---------------------------------------------------------------------------- bool CReaderBase::xParseComment( const CTempString& record, - CRef& annot ) + CRef& /*annot*/ ) // ---------------------------------------------------------------------------- { if (NStr::StartsWith(record, "#")) { @@ -664,7 +664,7 @@ bool CReaderBase::xIsReportingProgress() const // ---------------------------------------------------------------------------- void CReaderBase::xReportProgress( - ILineErrorListener* pProgress) + ILineErrorListener* /*pProgress*/) // ---------------------------------------------------------------------------- { if (!xIsReportingProgress()) { // progress reports disabled diff --git a/c++/src/objtools/readers/readfeat.cpp b/c++/src/objtools/readers/readfeat.cpp index 3e565f07..99fd91ef 100644 --- a/c++/src/objtools/readers/readfeat.cpp +++ b/c++/src/objtools/readers/readfeat.cpp @@ -341,6 +341,8 @@ public: private: + unsigned int x_GetLineNumber() const; + // Prohibit copy constructor and assignment operator CFeatureTableReader_Imp(const CFeatureTableReader_Imp& value); CFeatureTableReader_Imp& operator=(const CFeatureTableReader_Imp& value); @@ -494,6 +496,7 @@ private: void x_UpdatePointStrand(CSeq_feat& feat, CSeq_interval::TStrand strand) const; void x_GetPointStrand(const CSeq_feat& feat, CSeq_interval::TStrand& strand) const; + CRef m_pCurrentFeat; bool m_need_check_strand; string m_real_seqid; CRef m_seq_id; @@ -502,6 +505,7 @@ private: ILineErrorListener* m_pMessageListener; unordered_set m_ProcessedTranscriptIds; unordered_set m_ProcessedProteinIds; + TFlags m_Flags{0}; }; @@ -687,6 +691,7 @@ static const TSubSrcKey subsrc_key_to_subtype [] = { { "fwd_primer_name", CSubSource::eSubtype_fwd_primer_name }, { "fwd_primer_seq", CSubSource::eSubtype_fwd_primer_seq }, { "genotype", CSubSource::eSubtype_genotype }, + { "geo_loc_name", CSubSource::eSubtype_country }, { "germline", CSubSource::eSubtype_germline }, { "haplotype", CSubSource::eSubtype_haplotype }, { "identified_by", CSubSource::eSubtype_identified_by }, @@ -1036,139 +1041,6 @@ bool CFeatureTableReader_Imp::x_ParseFeatureTableLine ( return true; } -/* -bool CFeatureTableReader_Imp::x_ParseFeatureTableLine ( - const CTempString& line, - Int4* startP, - Int4* stopP, - bool* partial5P, - bool* partial3P, - bool* ispointP, - bool* isminusP, - string& featP, - string& qualP, - string& valP, - Int4 offset -) - -{ - SIZE_TYPE numtkns; - bool isminus = false; - bool ispoint = false; - size_t len; - bool partial5 = false; - bool partial3 = false; - Int4 startv = -1; - Int4 stopv = -1; - Int4 swp; - string start, stop, feat, qual, val, stnd; - vector tkns; - - - if (line.empty ()) return false; - - if (NStr::StartsWith (line, '[')) return false; - - tkns.clear (); - x_TokenizeLenient(line, tkns); - numtkns = tkns.size (); - - if (numtkns > 0) { - start = NStr::TruncateSpaces(tkns[0]); - } - if (numtkns > 1) { - stop = NStr::TruncateSpaces(tkns[1]); - } - if (numtkns > 2) { - feat = NStr::TruncateSpaces(tkns[2]); - } - if (numtkns > 3) { - qual = NStr::TruncateSpaces(tkns[3]); - } - if (numtkns > 4) { - val = NStr::TruncateSpaces(tkns[4]); - // trim enclosing double-quotes - if( val.length() >= 2 && val[0] == '"' && val[val.length()-1] == '"' ) { - val = val.substr(1, val.length() - 2); - } - } - if (numtkns > 5) { - stnd = NStr::TruncateSpaces(tkns[5]); - } - - bool has_start = false; - if (! start.empty ()) { - if (start [0] == '<') { - partial5 = true; - start.erase (0, 1); - } - len = start.length (); - if (len > 1 && start [len - 1] == '^') { - ispoint = true; - start [len - 1] = '\0'; - } - startv = x_StringToLongNoThrow(start, feat, qual, - ILineError::eProblem_BadFeatureInterval); - has_start = true; - } - - bool has_stop = false; - if (! stop.empty ()) { - if (stop [0] == '>') { - partial3 = true; - stop.erase (0, 1); - } - stopv = x_StringToLongNoThrow (stop, feat, qual, - ILineError::eProblem_BadFeatureInterval); - has_stop = true; - } - - if ( startv <= 0 || stopv <= 0 ) { - startv = -1; - stopv = -1; - } else { - startv--; - stopv--; - if (! stnd.empty ()) { - if (stnd == "minus" || stnd == "-" || stnd == "complement") { - if (start < stop) { - swp = startv; - startv = stopv; - stopv = swp; - } - isminus = true; - } - } - } - - if (startv >= 0) { - startv += offset; - } - if (stopv >= 0) { - stopv += offset; - } - - if ((has_start && startv < 0) || (has_stop && stopv < 0)) { - x_ProcessMsg( - ILineError::eProblem_FeatureBadStartAndOrStop, - eDiag_Error, - feat); - } - - *startP = ( startv < 0 ? -1 : startv); - *stopP = ( stopv < 0 ? -1 : stopv); - - *partial5P = partial5; - *partial3P = partial3; - *ispointP = ispoint; - *isminusP = isminus; - featP = feat; - qualP = qual; - valP = val; - - return true; -} -*/ void CFeatureTableReader_Imp::x_TokenizeStrict( const CTempString &line, @@ -3048,7 +2920,7 @@ void CFeatureTableReader_Imp::x_ProcessMsg( const string& strErrorMessage, const ILineError::TVecOfLines & vecOfOtherLines) { - x_ProcessMsg(m_reader ? static_cast(m_reader->GetLineNumber()) : m_LineNumber, + x_ProcessMsg(m_reader ? x_GetLineNumber() : m_LineNumber, eProblem, eSeverity, strFeatureName, @@ -3074,12 +2946,17 @@ void CFeatureTableReader_Imp::x_ProcessMsg( return; } - AutoPtr pErr ( + unique_ptr pErr ( CObjReaderLineException::Create( eSeverity, line_num, strErrorMessage, eProblem, m_real_seqid, strFeatureName, strQualifierName, strQualifierValue)); - ITERATE( ILineError::TVecOfLines, line_it, vecOfOtherLines ) { - pErr->AddOtherLine(*line_it); + + if (m_pCurrentFeat && (m_Flags & CFeature_table_reader::fIncludeObjectInMsg)) { + pErr->SetObject(m_pCurrentFeat); + } + + for (auto line : vecOfOtherLines) { + pErr->AddOtherLine(line); } if (!m_pMessageListener->PutError(*pErr)) { @@ -3108,8 +2985,7 @@ void CFeatureTableReader_Imp::PutProgress( void CFeatureTableReader_Imp::x_ResetFeat(CRef & sfp, bool & curr_feat_intervals_done) { m_need_check_strand = false; - sfp.Reset(new CSeq_feat); - //sfp->ResetLocation(); + sfp.Reset(new CSeq_feat()); curr_feat_intervals_done = false; } @@ -3160,7 +3036,6 @@ void CFeatureTableReader_Imp::x_FinishFeature(CRef& feat, TFtable& ftable) { if ( !feat || - feat.Empty() || !feat->IsSetData() || (feat->GetData().Which() == CSeqFeatData::e_not_set) ) { @@ -3168,12 +3043,15 @@ void CFeatureTableReader_Imp::x_FinishFeature(CRef& feat, } // Check for missing publication - RW-626 - if (feat->GetData().GetSubtype() == CSeqFeatData::eSubtype_pub && - (!feat->SetData().SetPub().IsSetPub() || - feat->SetData().SetPub().GetPub().Get().empty())) { + const auto& featData = feat->GetData(); + if (featData.GetSubtype() == CSeqFeatData::eSubtype_pub && + (!featData.GetPub().IsSetPub() || + !featData.GetPub().GetPub().IsSet() || + featData.GetPub().GetPub().Get().empty())) { + const int line_number = m_reader->AtEOF() ? - static_cast(m_reader->GetLineNumber()) : - static_cast(m_reader->GetLineNumber())-1; + x_GetLineNumber() : + x_GetLineNumber()-1; string msg = "Reference feature is empty. Skipping feature."; @@ -3256,6 +3134,7 @@ CRef CFeatureTableReader_Imp::ReadSequinFeatureTable ( ITableFilter *filter ) { + m_Flags = flags; string feat, qual, qual_value; string curr_feat_name; // Int4 start, stop; @@ -3281,7 +3160,7 @@ CRef CFeatureTableReader_Imp::ReadSequinFeatureTable ( // map feature types to features TChoiceToFeatMap choiceToFeatMap; - CRef sfp; + m_pCurrentFeat.Reset(); // This is true once this feature should not // have any more intervals. // This allows us to catch errors like the following: @@ -3308,7 +3187,7 @@ CRef CFeatureTableReader_Imp::ReadSequinFeatureTable ( if( m_reader->GetLineNumber() % 10000 == 0 && m_reader->GetLineNumber() > 0 ) { - PutProgress(m_real_seqid, static_cast(m_reader->GetLineNumber()), m_pMessageListener); + PutProgress(m_real_seqid, x_GetLineNumber(), m_pMessageListener); } // skip empty lines. @@ -3338,11 +3217,13 @@ CRef CFeatureTableReader_Imp::ReadSequinFeatureTable ( } else if ( s_LineIndicatesOrder(line) ) { + _ASSERT(m_pCurrentFeat); + // put nulls between feature intervals - CRef loc_with_nulls = s_LocationJoinToOrder( sfp->GetLocation() ); + CRef loc_with_nulls = s_LocationJoinToOrder( m_pCurrentFeat->GetLocation() ); // loc_with_nulls is unset if no change was needed if( loc_with_nulls ) { - sfp->SetLocation( *loc_with_nulls ); + m_pCurrentFeat->SetLocation( *loc_with_nulls ); } } else if (x_ParseFeatureTableLine (line, loc_info, feat, qual, qual_value, offset)) { @@ -3354,28 +3235,28 @@ CRef CFeatureTableReader_Imp::ReadSequinFeatureTable ( // process start - stop - feature line - x_FinishFeature(sfp, ftable); - x_ResetFeat( sfp, curr_feat_intervals_done ); + x_FinishFeature(m_pCurrentFeat, ftable); + x_ResetFeat(m_pCurrentFeat, curr_feat_intervals_done ); - if (x_SetupSeqFeat (sfp, feat, flags, filter)) { + if (x_SetupSeqFeat (m_pCurrentFeat, feat, flags, filter)) { // figure out type of feat, and store in map for later use CSeqFeatData::E_Choice eChoice = CSeqFeatData::e_not_set; - if( sfp->CanGetData() ) { - eChoice = sfp->GetData().Which(); + if( m_pCurrentFeat->CanGetData() ) { + eChoice = m_pCurrentFeat->GetData().Which(); } choiceToFeatMap.insert( TChoiceToFeatMap::value_type( eChoice, - SFeatAndLineNum(sfp, static_cast(m_reader->GetLineNumber())))); + SFeatAndLineNum(m_pCurrentFeat, x_GetLineNumber()))); // if new feature is a CDS, remember it for later lookups if( eChoice == CSeqFeatData::e_Cdregion ) { - best_CDS_finder.AddFeat( *sfp ); + best_CDS_finder.AddFeat( *m_pCurrentFeat ); } // and add first interval - x_AddIntervalToFeature (curr_feat_name, sfp, loc_info); + x_AddIntervalToFeature (curr_feat_name, m_pCurrentFeat, loc_info); ignore_until_next_feature_key = false; @@ -3406,10 +3287,10 @@ CRef CFeatureTableReader_Imp::ReadSequinFeatureTable ( x_ProcessMsg(ILineError::eProblem_NoFeatureProvidedOnIntervals, eDiag_Error); // this feature is in bad shape, so we ignore the rest of it ignore_until_next_feature_key = true; - x_ResetFeat(sfp, curr_feat_intervals_done); - } else if (sfp && sfp->IsSetLocation() && sfp->GetLocation().IsMix()) { + x_ResetFeat(m_pCurrentFeat, curr_feat_intervals_done); + } else if (m_pCurrentFeat && m_pCurrentFeat->IsSetLocation() && m_pCurrentFeat->GetLocation().IsMix()) { // process start - stop multiple interval line - x_AddIntervalToFeature (curr_feat_name, sfp, loc_info); + x_AddIntervalToFeature (curr_feat_name, m_pCurrentFeat, loc_info); // start, stop, partial5, partial3, ispoint, isminus); } else { if (!(flags & CFeature_table_reader::fSuppressBadKeyWarning)) { @@ -3420,7 +3301,7 @@ CRef CFeatureTableReader_Imp::ReadSequinFeatureTable ( } else if (!NStr::IsBlank(qual)) { curr_feat_intervals_done = true; - x_ProcessQualifier(qual, qual_value, curr_feat_name, sfp, flags); + x_ProcessQualifier(qual, qual_value, curr_feat_name, m_pCurrentFeat, flags); } else if (!feat.empty()) { @@ -3440,8 +3321,8 @@ CRef CFeatureTableReader_Imp::ReadSequinFeatureTable ( } // make sure last feature is finished - x_FinishFeature(sfp, ftable); - x_ResetFeat( sfp, curr_feat_intervals_done ); + x_FinishFeature(m_pCurrentFeat, ftable); + x_ResetFeat(m_pCurrentFeat, curr_feat_intervals_done ); if ((flags & CFeature_table_reader::fCreateGenesFromCDSs) != 0 || (flags & CFeature_table_reader::fCDSsMustBeInTheirGenes) != 0 ) @@ -3576,6 +3457,14 @@ bool CFeatureTableReader_Imp::ParseInitialFeatureLine ( } +unsigned int CFeatureTableReader_Imp::x_GetLineNumber() const +{ + return m_reader ? + static_cast(m_reader->GetLineNumber()) : + 0; +} + + // public access functions CFeature_table_reader::CFeature_table_reader( @@ -3784,7 +3673,6 @@ void CFeature_table_reader::ReadSequinFeatureTables( CFeatureTableReader_Imp ftable_reader(&reader, 0, pMessageListener); while ( !reader.AtEOF() ) { auto annot = x_ReadFeatureTable(ftable_reader, flags, filter); - //CRef annot = ReadSequinFeatureTable(reader, flags, pMessageListener, filter); if (entry.IsSeq()) { // only one place to go entry.SetSeq().SetAnnot().push_back(annot); continue; diff --git a/c++/src/objtools/readers/source_mod_parser.cpp b/c++/src/objtools/readers/source_mod_parser.cpp index 74f7b8c3..cd409200 100644 --- a/c++/src/objtools/readers/source_mod_parser.cpp +++ b/c++/src/objtools/readers/source_mod_parser.cpp @@ -1,4 +1,4 @@ -/* $Id: source_mod_parser.cpp 673184 2023-09-25 14:08:03Z ivanov $ +/* $Id: source_mod_parser.cpp 679820 2024-03-04 18:32:45Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -249,7 +249,7 @@ namespace }; return s_InitSmodToEnumMap( - COrgMod::GetTypeInfo_enum_ESubtype(), + COrgMod::ENUM_METHOD_NAME(ESubtype)(), kDeprecatedOrgSubtypes, extra_smod_to_enum_names ); @@ -284,9 +284,9 @@ namespace { "latitude-longitude", CSubSource::eSubtype_lat_lon }, }; return s_InitSmodToEnumMap( - CSubSource::GetTypeInfo_enum_ESubtype(), + CSubSource::ENUM_METHOD_NAME(ESubtype)(), skip_enum_names, - extra_smod_to_enum_names ); + extra_smod_to_enum_names); } CSafeStatic kSModSubSrcSubtypeMap( @@ -994,7 +994,7 @@ void CSourceModParser::x_ApplyMods(CAutoInitDesc& bsrc, bsrc->SetGenome(CBioSource::eGenome_insertion_seq); } else { try { - bsrc->SetGenome(CBioSource::GetTypeInfo_enum_EGenome() + bsrc->SetGenome(CBioSource::ENUM_METHOD_NAME(EGenome)() ->FindValue(mod->value)); } catch (CSerialException&) { x_HandleBadModValue(*mod); @@ -1011,7 +1011,7 @@ void CSourceModParser::x_ApplyMods(CAutoInitDesc& bsrc, } else if( NStr::EqualNocase(mod->value, "mutant") ) { bsrc->SetOrigin( CBioSource::eOrigin_mut ); } else { - bsrc->SetOrigin(CBioSource::GetTypeInfo_enum_EOrigin() + bsrc->SetOrigin(CBioSource::ENUM_METHOD_NAME(EOrigin)() ->FindValue(mod->value)); } } catch (CSerialException&) { @@ -1791,7 +1791,7 @@ CSourceModParser::GetModAllowedValues(const string &mod) } else if( key_equal(mod, "origin") ) { set_valid_values.insert("natural mutant"); set_valid_values.insert("mutant"); - ITERATE( CEnumeratedTypeValues::TValues, enum_iter, CBioSource::GetTypeInfo_enum_EOrigin()->GetValues() ) { + ITERATE(CEnumeratedTypeValues::TValues, enum_iter, CBioSource::ENUM_METHOD_NAME(EOrigin)()->GetValues()) { set_valid_values.insert( enum_iter->first ); } } else if( key_equal(mod, "tech") ) { diff --git a/c++/src/sra/data_loaders/bam/bamloader_impl.cpp b/c++/src/sra/data_loaders/bam/bamloader_impl.cpp index 2a16ab2e..8d40bccd 100644 --- a/c++/src/sra/data_loaders/bam/bamloader_impl.cpp +++ b/c++/src/sra/data_loaders/bam/bamloader_impl.cpp @@ -1,4 +1,4 @@ -/* $Id: bamloader_impl.cpp 648594 2022-04-18 21:11:33Z vasilche $ +/* $Id: bamloader_impl.cpp 674300 2023-10-23 19:56:38Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -64,17 +64,18 @@ BEGIN_NCBI_SCOPE #define NCBI_USE_ERRCODE_X BAMLoader -NCBI_DEFINE_ERR_SUBCODE_X(18); +NCBI_DEFINE_ERR_SUBCODE_X(30); BEGIN_SCOPE(objects) class CDataLoader; static const int kTSEId = 1; -static const size_t kChunkSize = 500; +static const Uint8 kSingleAlignBytes = 60; // estimated size of a single alignment in bytes //static const size_t kGraphScale = 1000; //static const size_t kGraphPoints = 20; -static const size_t kChunkDataSize = 250000; +static const size_t kChunkDataSize = 250000; // target chunk size in bytes +static const size_t kChunkSize = kChunkDataSize/kSingleAlignBytes; // target chunk align count static const int kMainChunkId = CTSE_Chunk_Info::kDelayedMain_ChunkId; //#define SKIP_TOO_LONG_ALIGNMENTS @@ -208,6 +209,16 @@ static inline bool GetEstimatedCoverageGraphParam(void) } +NCBI_PARAM_DECL(bool, BAM_LOADER, PREFER_RAW_INDEX_OVER_COVERAGE_GRAPH); +NCBI_PARAM_DEF_EX(bool, BAM_LOADER, PREFER_RAW_INDEX_OVER_COVERAGE_GRAPH, false, + eParam_NoThread, BAM_LOADER_PREFER_RAW_INDEX_OVER_COVERAGE_GRAPH); + +static bool GetPreferRawIndexOverCoverageGraphParam(void) +{ + return NCBI_PARAM_TYPE(BAM_LOADER, PREFER_RAW_INDEX_OVER_COVERAGE_GRAPH)::GetDefault(); +} + + NCBI_PARAM_DECL(bool, BAM_LOADER, PREOPEN); NCBI_PARAM_DEF(bool, BAM_LOADER, PREOPEN, false); @@ -352,8 +363,18 @@ CBAMDataLoader_Impl::CBAMDataLoader_Impl( } +static double s_CreateTime = 0; +static double s_AttachTime = 0; + + CBAMDataLoader_Impl::~CBAMDataLoader_Impl(void) { + if ( GetDebugLevel() >= 4 ) { + LOG_POST_X(21, Info<<"CBAMDataLoader: " + "Total create time: "<= 1 ) { - LOG_POST_X(16, "Opened BAM file "<GetBamDb().UsesRawIndex() && GetPreferRawIndexOverCoverageGraphParam() ) { + // use more precise index information + return false; + } try { CRef entry(new CSeq_entry); CRef annot; @@ -929,6 +955,7 @@ bool CBamRefSeqInfo::x_LoadRangesCov(void) CConstRef outliers = params->GetFieldRef("Outliers"); double vmul = graph->GetA(); double vadd = graph->GetB(); + double outliers_mul = 1./slot; size_t non_zero_count = 0; vector cov(cnt); @@ -944,7 +971,7 @@ bool CBamRefSeqInfo::x_LoadRangesCov(void) continue; } if ( vg > vmax ) { - v = GetIdField(*outliers, i).GetData().GetReal(); + v = GetIdField(*outliers, i).GetData().GetReal()*outliers_mul; } else { v = vmul*vg+vadd; @@ -965,7 +992,7 @@ bool CBamRefSeqInfo::x_LoadRangesCov(void) continue; } if ( vg > vmax ) { - v = GetIdField(*outliers, i).GetData().GetReal(); + v = GetIdField(*outliers, i).GetData().GetReal()*outliers_mul; } else { v = vmul*vg+vadd; @@ -1059,7 +1086,8 @@ bool CBamRefSeqInfo::x_LoadRangesEstimated(void) TSeqPos bin_count = TSeqPos(data_sizes.size()); TSeqPos bin_size = raw_db.GetIndex().GetMinBinSize(); if ( GetDebugLevel() >= 2 ) { - LOG_POST("Total cov: "< 0); TSeqPos non_zero_end = pos - zero_count*bin_size; CBamRefSeqChunkInfo info; - info.m_AlignCount = cur_data_size; + if ( GetDebugLevel() >= 3 ) { + LOG_POST_X(23, Info << "CBAMDataLoader:" + " Chunk "< 0); @@ -1099,7 +1134,14 @@ bool CBamRefSeqInfo::x_LoadRangesEstimated(void) _ASSERT(last_pos == pos-zero_count*bin_size); _ASSERT(cur_data_size == 0); CBamRefSeqChunkInfo info; - info.m_AlignCount = 0; + info.m_DataSize = 0; + if ( GetDebugLevel() >= 3 ) { + LOG_POST_X(24, Info << "CBAMDataLoader:" + " Chunk "< 0); @@ -1121,8 +1163,15 @@ bool CBamRefSeqInfo::x_LoadRangesEstimated(void) { _ASSERT(last_pos <= pos); _ASSERT(cur_data_size > 0); + if ( GetDebugLevel() >= 3 ) { + LOG_POST_X(25, Info << "CBAMDataLoader:" + " Chunk "< 0); @@ -1358,7 +1407,8 @@ void CBamRefSeqInfo::LoadMainSplit(CTSE_LoadLock& load_lock) whole_range); split_info.AddChunk(*chunk); if ( GetDebugLevel() >= 1 ) { - LOG_POST_X(17, "Initialized BAM refseq "< wide_range = m_Chunks[range_id].GetAlignRange(); int base_id = int(range_id*kChunkIdMul); - if ( m_Chunks[range_id].GetAlignCount() ) { + auto align_count = m_Chunks[range_id].GetAlignCount(); + auto data_size = m_Chunks[range_id].m_DataSize; + if ( align_count == 0 && data_size != 0 ) { + align_count = data_size / kSingleAlignBytes + 1; + } + else if ( data_size == 0 && align_count != 0 ) { + data_size = align_count * kSingleAlignBytes; + } + if ( align_count ) { if ( raw_db ) { - if ( m_Chunks[range_id].GetAlignCount() < 2*kChunkDataSize ) { + if ( align_count < 2*kChunkDataSize ) { // add single chunk for in-range and overlapping aligns - Uint8 bytes = m_Chunks[range_id].GetAlignCount(); + Uint8 bytes = CBamFileRangeSet(raw_db->GetIndex(), refseq_index, range, + CBamIndex::kLevel0, CBamIndex::kMaxLevel, + CBamIndex::eSearchByStart).GetFileSize(); CRef chunk(new CTSE_Chunk_Info(base_id+eChunk_align)); chunk->x_SetLoadBytes(Uint4(min(bytes, kMax_UI4))); //chunk->x_SetLoadSeconds(bytes*align_seconds); @@ -1477,7 +1537,7 @@ void CBamRefSeqInfo::CreateChunks(CTSE_Split_Info& split_info) if ( GetDebugLevel() >= 2 ) { LOG_POST_X(12, Info << "CBAMDataLoader: "<GetChunkId()<<": "< chunk(new CTSE_Chunk_Info(base_id+eChunk_pileup_graph)); if ( raw_db ) { - Uint8 bytes = m_Chunks[range_id].GetAlignCount(); + Uint8 bytes = data_size; if ( !bytes ) { // empty sequence span might load tails of previous alignmnets // get actual data size of the tails @@ -1599,6 +1659,7 @@ void CBamRefSeqInfo::LoadChunk(CTSE_Chunk_Info& chunk_info) void CBamRefSeqInfo::LoadAlignChunk(CTSE_Chunk_Info& chunk_info) { CStopWatch sw; + CStopWatch sw1; if ( GetDebugLevel() >= 3 ) { sw.Start(); } @@ -1660,8 +1721,14 @@ void CBamRefSeqInfo::LoadAlignChunk(CTSE_Chunk_Info& chunk_info) annot = ait.GetSeq_annot(m_File->GetAnnotName()); align_list = &annot->SetData().SetAlign(); } + if ( GetDebugLevel() >= 4 ) { + sw1.Start(); + } align_list->push_back(ait.GetMatchAlign()); short_ids.push_back(CSeq_id_Handle::GetHandle(*ait.GetShortSeq_id())); + if ( GetDebugLevel() >= 4 ) { + sw1.Stop(); + } } if ( annot ) { chunk_info.x_LoadAnnot(place, *annot); @@ -1669,6 +1736,17 @@ void CBamRefSeqInfo::LoadAlignChunk(CTSE_Chunk_Info& chunk_info) } {{ CMutexGuard guard(m_Seq2ChunkMutex); + if ( GetDebugLevel() >= 4 ) { + double time = sw1.Elapsed(); + LOG_POST_X(19, Info<<"CBAMDataLoader: " + "Created alignments "< seq_chunk; ITERATE ( vector, it, short_ids ) { @@ -1687,6 +1765,15 @@ void CBamRefSeqInfo::LoadAlignChunk(CTSE_Chunk_Info& chunk_info) seq_chunk->x_AddBioseqPlace(kTSEId); split_info.AddChunk(*seq_chunk); } + if ( GetDebugLevel() >= 4 ) { + double time = sw1.Elapsed(); + s_AttachTime += time; + LOG_POST_X(20, Info<<"CBAMDataLoader: " + "Attached alignments "<= 3 ) { LOG_POST_X(7, Info<<"CBAMDataLoader: " @@ -2453,7 +2540,7 @@ void CBamRefSeqInfo::LoadPileupChunk(CTSE_Chunk_Info& chunk_info) } } if ( seglen == 0 ) { - ERR_POST_X(4, "Bad CIGAR length: "< sx_GetOM(void) { SetDiagPostLevel(eDiag_Info); @@ -1612,9 +1614,9 @@ vector s_GetQueries2full() } // CM000663.2 from -// https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_gb_accs.bam +// NCBI_FTP /toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_gb_accs.bam // BK006938.2 from -// https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_gb_accs.bam +// NCBI_FTP /toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_gb_accs.bam vector s_GetQueries3() { vector queries; @@ -1952,8 +1954,8 @@ BOOST_AUTO_TEST_CASE(FetchSeqMT3) const size_t BAM_COUNT = 2; string bam_name[BAM_COUNT] = { - "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_gb_accs.bam", - "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_gb_accs.bam" + NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_gb_accs.bam", + NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_gb_accs.bam" }; string annot_name[BAM_COUNT] = { "grch38_wgsim_gb_accs", @@ -2134,14 +2136,14 @@ BOOST_AUTO_TEST_CASE(CheckBAMUserAgent) const size_t BAM_COUNT = 8; string bam_name[BAM_COUNT] = { - "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_gb_accs.bam", - "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_mixed.bam", - "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_rs_accs.bam", - "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_short.bam", - "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_gb_accs.bam", - "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_mixed.bam", - "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_rs_accs.bam", - "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_short.bam" + NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_gb_accs.bam", + NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_mixed.bam", + NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_rs_accs.bam", + NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_short.bam", + NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_gb_accs.bam", + NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_mixed.bam", + NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_rs_accs.bam", + NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_short.bam" }; string annot_name[BAM_COUNT] = { "grch38_wgsim_gb_accs", diff --git a/c++/src/sra/data_loaders/snp/test/CMakeLists.test_snp_loader.app.txt b/c++/src/sra/data_loaders/snp/test/CMakeLists.test_snp_loader.app.txt deleted file mode 100644 index f5812728..00000000 --- a/c++/src/sra/data_loaders/snp/test/CMakeLists.test_snp_loader.app.txt +++ /dev/null @@ -1,15 +0,0 @@ -# $Id: CMakeLists.test_snp_loader.app.txt 621843 2020-12-17 14:02:27Z ivanov $ - -NCBI_begin_app(test_snp_loader) - NCBI_sources(test_snp_loader) - NCBI_requires(Boost.Test.Included) - NCBI_uses_toolkit_libraries(ncbi_xloader_snp ncbi_xloader_genbank) - - NCBI_set_test_requires(in-house-resources) - NCBI_set_test_assets(test_snp_loader.ini) - NCBI_add_test() - - NCBI_project_watchers(vasilche) - -NCBI_end_app() - diff --git a/c++/src/sra/data_loaders/snp/test/CMakeLists.txt b/c++/src/sra/data_loaders/snp/test/CMakeLists.txt deleted file mode 100644 index c8882435..00000000 --- a/c++/src/sra/data_loaders/snp/test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# $Id: CMakeLists.txt 621843 2020-12-17 14:02:27Z ivanov $ - -NCBI_add_app(test_snp_loader) - diff --git a/c++/src/sra/data_loaders/snp/test/Makefile.in b/c++/src/sra/data_loaders/snp/test/Makefile.in deleted file mode 100644 index f1339a79..00000000 --- a/c++/src/sra/data_loaders/snp/test/Makefile.in +++ /dev/null @@ -1,34 +0,0 @@ -# $Id: Makefile.in 502540 2016-05-25 15:49:46Z vasilche $ - -# Example meta-makefile; uncomment and fill out whichever of these -# apply. (Built in the following order.) - -## User projects (totally custom makefiles). *USR_PROJ settings are for -## internal tasks such as source generation, whereas *UNIX_PROJ are for -## targets that are interesting enough in their own right to warrant -## explicit coverage in Makefile.flat. -# USR_PROJ = -# UNIX_USR_PROJ = -# UNIX_PROJ = -# EXPENDABLE_USR_PROJ = -# EXPENDABLE_UNIX_PROJ = - -## Libraries to be built as usual. -# ASN_PROJ = -# DTD_PROJ = -# XSD_PROJ = -# LIB_PROJ = -# WSDL_PROJ = -# EXPENDABLE_LIB_PROJ = - -## Applications to be built as usual. -APP_PROJ = test_snp_loader -# EXPENDABLE_APP_PROJ = - -## Subdirectories to traverse. -# SUB_PROJ = -# POTENTIAL_SUB_PROJ = -# EXPENDABLE_SUB_PROJ = - -srcdir = @srcdir@ -include @builddir@/Makefile.meta diff --git a/c++/src/sra/data_loaders/snp/test/Makefile.test_snp_loader.app b/c++/src/sra/data_loaders/snp/test/Makefile.test_snp_loader.app deleted file mode 100644 index a1db848d..00000000 --- a/c++/src/sra/data_loaders/snp/test/Makefile.test_snp_loader.app +++ /dev/null @@ -1,22 +0,0 @@ -# $Id: Makefile.test_snp_loader.app 625148 2021-02-09 14:54:06Z ucko $ - - -APP = test_snp_loader -SRC = test_snp_loader - -REQUIRES = Boost.Test.Included $(GRPC_OPT) - -CPPFLAGS = $(ORIG_CPPFLAGS) $(BOOST_INCLUDE) - -LIB = ncbi_xloader_snp $(SRAREAD_LIBS) dbsnp_ptis grpc_integration test_boost $(OBJMGR_LIBS) $(CMPRS_LIB) - -LIBS = $(GENBANK_THIRD_PARTY_LIBS) $(SRA_SDK_SYSLIBS) $(GRPC_LIBS) \ - $(CMPRS_LIBS) $(NETWORK_LIBS) $(ORIG_LIBS) - -POST_LINK = $(VDB_POST_LINK) - -CHECK_COPY = test_snp_loader.ini -CHECK_CMD = test_snp_loader -CHECK_REQUIRES = in-house-resources - -WATCHERS = vasilche diff --git a/c++/src/sra/data_loaders/snp/test/test_snp_loader.cpp b/c++/src/sra/data_loaders/snp/test/test_snp_loader.cpp deleted file mode 100644 index d57012bc..00000000 --- a/c++/src/sra/data_loaders/snp/test/test_snp_loader.cpp +++ /dev/null @@ -1,545 +0,0 @@ -/* $Id: test_snp_loader.cpp 649791 2022-05-10 18:53:18Z vasilche $ -* =========================================================================== -* -* PUBLIC DOMAIN NOTICE -* National Center for Biotechnology Information -* -* This software/database is a "United States Government Work" under the -* terms of the United States Copyright Act. It was written as part of -* the author's official duties as a United States Government employee and -* thus cannot be copyrighted. This software/database is freely available -* to the public for use. The National Library of Medicine and the U.S. -* Government have not placed any restriction on its use or reproduction. -* -* Although all reasonable efforts have been taken to ensure the accuracy -* and reliability of the software and data, the NLM and the U.S. -* Government do not and cannot warrant the performance or results that -* may be obtained by using this software or data. The NLM and the U.S. -* Government disclaim all warranties, express or implied, including -* warranties of performance, merchantability or fitness for any particular -* purpose. -* -* Please cite the author in any work or product based on this material. -* -* =========================================================================== -* -* Author: Eugene Vasilchenko -* -* File Description: -* Unit tests for SNP data loader -* -* =========================================================================== -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include /* This header must go last */ - -USING_NCBI_SCOPE; -USING_SCOPE(objects); - -static string s_LoaderName; - -enum ESNPSource { - eFromGB, - eFromSNP -}; - -static -CRef s_MakeScope0() -{ - CRef om = CObjectManager::GetInstance(); - CGBDataLoader::RegisterInObjectManager(*om); - CRef scope(new CScope(*om)); - scope->AddDefaults(); - return scope; -} - - -static -CRef s_MakeScope(const string& file_name = kEmptyStr) -{ - CRef om = CObjectManager::GetInstance(); - CGBDataLoader::RegisterInObjectManager(*om); - if ( !s_LoaderName.empty() ) { - om->RevokeDataLoader(s_LoaderName); - s_LoaderName.erase(); - } - if ( file_name.empty() ) { - s_LoaderName = - CSNPDataLoader::RegisterInObjectManager(*om) - .GetLoader()->GetName(); - BOOST_CHECK_EQUAL(s_LoaderName, CSNPDataLoader::GetLoaderNameFromArgs()); - } - else { - s_LoaderName = - CSNPDataLoader::RegisterInObjectManager(*om, file_name) - .GetLoader()->GetName(); - BOOST_CHECK_EQUAL(s_LoaderName, CSNPDataLoader::GetLoaderNameFromArgs(file_name)); - } - CRef scope(new CScope(*om)); - scope->AddDefaults(); - scope->AddDataLoader(s_LoaderName); - return scope; -} - - -static -void s_CheckSource(const string& descr, - ESNPSource source, - const set& tse_set) -{ - BOOST_CHECK_EQUAL(tse_set.size(), 1u); - for ( auto& tse : tse_set ) { - LOG_POST(descr<<": blob id: "<(tse.GetDataLoader())); - } - else { - BOOST_CHECK(dynamic_cast(tse.GetDataLoader())); - } - } -} - - -static -void s_CheckSource(const string& descr, - ESNPSource source, - CFeat_CI feat_it) -{ - set tse_set; - for ( ; feat_it; ++feat_it ) { - tse_set.insert(feat_it.GetAnnot().GetTSE_Handle()); - } - s_CheckSource(descr, source, tse_set); -} - - -static -void s_CheckSource(const string& descr, - ESNPSource source, - CGraph_CI graph_it) -{ - set tse_set; - for ( ; graph_it; ++graph_it ) { - tse_set.insert(graph_it.GetAnnot().GetTSE_Handle()); - } - s_CheckSource(descr, source, tse_set); -} - - -static -size_t s_CheckFeat(CRef scope, - const SAnnotSelector& sel, - const string& str_id, - CRange range = CRange::GetWhole()) -{ - size_t ret = 0; - CRef seq_id(new CSeq_id(str_id)); - CRef loc(new CSeq_loc); - if ( range == CRange::GetWhole() ) { - loc->SetWhole(*seq_id); - } - else { - CSeq_interval& interval = loc->SetInt(); - interval.SetId(*seq_id); - interval.SetFrom(range.GetFrom()); - interval.SetTo(range.GetTo()); - } - { - CFeat_CI it(*scope, *loc, sel); - ret += it.GetSize(); - BOOST_CHECK(it); - } - - CBioseq_Handle bh = scope->GetBioseqHandle(*seq_id); - BOOST_REQUIRE(bh); - { - CFeat_CI it(bh, range, sel); - ret += it.GetSize(); - BOOST_CHECK(it); - } - return ret; -} - - -static -void s_CheckNoFeat(CRef scope, - const SAnnotSelector& sel, - const string& str_id, - CRange range = CRange::GetWhole()) -{ - CRef seq_id(new CSeq_id(str_id)); - CRef loc(new CSeq_loc); - if ( range == CRange::GetWhole() ) { - loc->SetWhole(*seq_id); - } - else { - CSeq_interval& interval = loc->SetInt(); - interval.SetId(*seq_id); - interval.SetFrom(range.GetFrom()); - interval.SetTo(range.GetTo()); - } - { - CFeat_CI it(*scope, *loc, sel); - BOOST_CHECK(!it); - } - - CBioseq_Handle bh = scope->GetBioseqHandle(*seq_id); - BOOST_REQUIRE(bh); - { - CFeat_CI it(bh, range, sel); - BOOST_CHECK(!it); - } -} - - -static -void s_TestNoNA(const string& descr, - const string& na_acc, - CBioseq_Handle bh, TSeqPos range_from, TSeqPos range_to) -{ - if ( 1 ) { - SAnnotSelector sel(CSeqFeatData::eSubtype_variation); - sel.AddNamedAnnots(na_acc); - sel.IncludeNamedAnnotAccession(na_acc); - CFeat_CI feat_it(bh, CRange(range_from, range_to), sel); - if ( feat_it ) { - s_CheckSource(descr, eFromGB, feat_it); - } - } - if ( 1 ) { - SAnnotSelector sel; - sel.AddNamedAnnots(na_acc); - sel.IncludeNamedAnnotAccession(na_acc); - CGraph_CI graph_it(bh, CRange(range_from, range_to), sel); - if ( graph_it ) { - s_CheckSource(descr, eFromGB, graph_it); - } - } -} - - -static -void s_TestNA(const string& descr, - ESNPSource source, - const string& na_acc, - CBioseq_Handle bh, TSeqPos range_from, TSeqPos range_to, - size_t snp_count) -{ - if ( 1 ) { // check features - SAnnotSelector sel(CSeqFeatData::eSubtype_variation); - sel.AddNamedAnnots(na_acc); - sel.IncludeNamedAnnotAccession(na_acc); - CFeat_CI feat_it(bh, CRange(range_from, range_to), sel); - BOOST_CHECK(feat_it); - BOOST_CHECK_EQUAL(feat_it.GetSize(), snp_count); - s_CheckSource(descr, source, feat_it); - } - if ( 1 ) { // check coverage graphs - SAnnotSelector sel; - string graph_na_acc = CombineWithZoomLevel(na_acc, 100); - sel.AddNamedAnnots(graph_na_acc); - sel.IncludeNamedAnnotAccession(graph_na_acc); - CGraph_CI graph_it(bh, CRange(range_from, range_to), sel); - BOOST_CHECK(graph_it); - s_CheckSource(descr, source, graph_it); - } - if ( 1 ) { // check overview graphs - SAnnotSelector sel; - string graph_na_acc = CombineWithZoomLevel(na_acc, 5000); - sel.AddNamedAnnots(graph_na_acc); - sel.IncludeNamedAnnotAccession(graph_na_acc); - CGraph_CI graph_it(bh, CRange(range_from, range_to), sel); - BOOST_CHECK(graph_it); - s_CheckSource(descr, source, graph_it); - } -} - - -static -void s_TestPTIS(const string& descr, - ESNPSource source, - CBioseq_Handle bh, TSeqPos range_from, TSeqPos range_to, - size_t snp_count) -{ - if ( 1 ) { // check features - SAnnotSelector sel(CSeqFeatData::eSubtype_variation); - sel.IncludeNamedAnnotAccession("SNP"); - sel.AddNamedAnnots("SNP"); - CFeat_CI feat_it(bh, CRange(range_from, range_to), sel); - BOOST_CHECK(feat_it); - BOOST_CHECK_GE(feat_it.GetSize(), snp_count); - BOOST_CHECK_LT(feat_it.GetSize(), snp_count*2); - s_CheckSource(descr, source, feat_it); - } - if ( 1 ) { // check coverage graphs - SAnnotSelector sel; - string graph_na_acc = CombineWithZoomLevel("SNP", 100); - sel.AddNamedAnnots(graph_na_acc); - sel.IncludeNamedAnnotAccession(graph_na_acc); - CGraph_CI graph_it(bh, CRange(range_from, range_to), sel); - BOOST_CHECK(graph_it); - s_CheckSource(descr, source, graph_it); - } - if ( 1 ) { // check overview graphs - SAnnotSelector sel; - sel.AddNamedAnnots("SNP"); - sel.IncludeNamedAnnotAccession("SNP"); - CGraph_CI graph_it(bh, CRange(range_from, range_to), sel); - BOOST_CHECK(graph_it); - s_CheckSource(descr, source, graph_it); - } -} - - -BOOST_AUTO_TEST_CASE(GBImplicitNA) -{ - CRef scope = s_MakeScope0(); - string na_acc = "NA000124713.8#1"; - string na_acc2 = "NA000193272.4#17"; - string seq_id = "NC_000001.11"; - TSeqPos range_from = 0; - TSeqPos range_to = 100000; - size_t snp_count = 8894; - size_t snp_count2 = 16587; - - CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id)); - BOOST_REQUIRE(bh); - - s_TestNA("GBImplicitNA 1", eFromGB, na_acc, bh, range_from, range_to, snp_count); - s_TestNA("GBImplicitNA 2", eFromGB, na_acc2, bh, range_from, range_to, snp_count2); -} - - -BOOST_AUTO_TEST_CASE(GBImplicitSNP) -{ - CRef scope = s_MakeScope0(); - string seq_id = "NC_000001.11"; - TSeqPos range_from = 0; - TSeqPos range_to = 100000; - size_t snp_count = 17889; - - string seq_id2 = "NC_000007"; - TSeqPos range_from2 = 1000000; - TSeqPos range_to2 = 1100000; - size_t snp_count2 = 34431; - - CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id)); - BOOST_REQUIRE(bh); - CBioseq_Handle bh2 = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id2)); - BOOST_REQUIRE(bh2); - - s_TestPTIS("GBImplicitSNP 1", eFromGB, bh, range_from, range_to, snp_count); - s_TestPTIS("GBImplicitSNP 2", eFromGB, bh2, range_from2, range_to2, snp_count2); -} - - -BOOST_AUTO_TEST_CASE(SNPExplicitNA) -{ - string na_acc = "NA000124713.8#1"; - string na_acc2 = "NA000193272.4#17"; - CRef scope = s_MakeScope(na_acc); - string seq_id = "NC_000001.11"; - TSeqPos range_from = 0; - TSeqPos range_to = 100000; - size_t snp_count = 8894; - - CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id)); - BOOST_REQUIRE(bh); - - s_TestNA("SNPExplicitNA 1", eFromSNP, na_acc, bh, range_from, range_to, snp_count); - s_TestNoNA("SNPExplicitNA 2", na_acc2, bh, range_from, range_to); -} - - -BOOST_AUTO_TEST_CASE(SNPImplicitNA) -{ - CRef scope = s_MakeScope(); - string na_acc = "NA000124713.8#1"; - string na_acc2 = "NA000193272.4#17"; - string seq_id = "NC_000001.11"; - TSeqPos range_from = 0; - TSeqPos range_to = 100000; - size_t snp_count = 8894; - size_t snp_count2 = 16587; - - CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id)); - BOOST_REQUIRE(bh); - - s_TestNA("SNPImplicitNA 1", eFromSNP, na_acc, bh, range_from, range_to, snp_count); - s_TestNA("SNPImplicitNA 2", eFromSNP, na_acc2, bh, range_from, range_to, snp_count2); -} - - -BOOST_AUTO_TEST_CASE(SNPImplicitSNP) -{ - CRef scope = s_MakeScope(); - string seq_id = "NC_000001.11"; - TSeqPos range_from = 0; - TSeqPos range_to = 100000; - size_t snp_count = 29766; // new PTIS version - NA000305581.1#17 - // old was NA000193272.8#17 and had 23474 SNPs in this case - // old was NA000193272.7#17 and had 17889 SNPs in this case - - string seq_id2 = "NC_000007"; - TSeqPos range_from2 = 1000000; - TSeqPos range_to2 = 1100000; - size_t snp_count2 = 49002; // new PTIS version - NA000305581.1#17 - // old was NA000193272.8#17 and had 44657 SNPs in this case - // old was NA000193272.7#17 and had 34431 SNPs in this case - - CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id)); - BOOST_REQUIRE(bh); - CBioseq_Handle bh2 = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id2)); - BOOST_REQUIRE(bh2); - - s_TestPTIS("SNPImplicitSNP 1", eFromSNP, bh, range_from, range_to, snp_count); - s_TestPTIS("SNPImplicitSNP 2", eFromSNP, bh2, range_from2, range_to2, snp_count2); -} - - -BOOST_AUTO_TEST_CASE(CheckExtSNPEditChangeId) -{ - LOG_POST("Checking ExtAnnot SNP for sequence with changed ids"); - string id = "NM_004006.2"; - string dummy_id = "lcl|dummy"; - - SAnnotSelector sel(CSeqFeatData::eSubtype_variation); - sel.SetResolveAll().SetAdaptiveDepth(); - sel.IncludeNamedAnnotAccession("SNP"); - sel.AddNamedAnnots("SNP"); - CRef scope = s_MakeScope(); - scope->SetKeepExternalAnnotsForEdit(); - CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(id)); - BOOST_REQUIRE(bh); - CBioseq_EditHandle bhe = bh.GetEditHandle(); - BOOST_REQUIRE(bh); - BOOST_REQUIRE(bhe); - size_t count = s_CheckFeat(scope, sel, id); - vector ids = bhe.GetId(); - bhe.ResetId(); - bhe.AddId(CSeq_id_Handle::GetHandle(dummy_id)); - s_CheckNoFeat(scope, sel, dummy_id); - for ( auto idh : ids ) { - bhe.AddId(idh); - } - BOOST_CHECK_EQUAL(s_CheckFeat(scope, sel, dummy_id), count); -} - - -BOOST_AUTO_TEST_CASE(GBImplicitNA64) -{ - CRef scope = s_MakeScope0(); - string na_acc = "NA000306983.1#1"; - string seq_id = "2500000194"; - TSeqPos range_from = 0; - TSeqPos range_to = 100000; - size_t snp_count = 1; - - CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id)); - BOOST_REQUIRE(bh); - - s_TestNA("GBImplicitNA 1", eFromGB, na_acc, bh, range_from, range_to, snp_count); -} - - -BOOST_AUTO_TEST_CASE(GBImplicitSNP64) -{ - CRef scope = s_MakeScope0(); - string seq_id = "2500000194"; - TSeqPos range_from = 0; - TSeqPos range_to = 100000; - size_t snp_count = 1; - - string seq_id2 = "CM029356.1"; - TSeqPos range_from2 = 0; - TSeqPos range_to2 = 100000; - size_t snp_count2 = 1; - - CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id)); - BOOST_REQUIRE(bh); - CBioseq_Handle bh2 = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id2)); - BOOST_REQUIRE(bh2); - - s_TestPTIS("GBImplicitSNP 1", eFromGB, bh, range_from, range_to, snp_count); - s_TestPTIS("GBImplicitSNP 2", eFromGB, bh2, range_from2, range_to2, snp_count2); -} - - -BOOST_AUTO_TEST_CASE(SNPExplicitNA64) -{ - string na_acc = "NA000306983.1#1"; - string na_acc2 = "NA000306983.1#3"; - CRef scope = s_MakeScope(na_acc); - string seq_id = "2500000194"; - TSeqPos range_from = 0; - TSeqPos range_to = 100000; - size_t snp_count = 1; - - CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id)); - BOOST_REQUIRE(bh); - - s_TestNA("SNPExplicitNA 1", eFromSNP, na_acc, bh, range_from, range_to, snp_count); - s_TestNoNA("SNPExplicitNA 2", na_acc2, bh, range_from, range_to); -} - - -BOOST_AUTO_TEST_CASE(SNPImplicitNA64) -{ - CRef scope = s_MakeScope(); - string na_acc = "NA000306983.1#1"; - string na_acc2 = "NA000306983.1#3"; - string seq_id = "2500000194"; - TSeqPos range_from = 0; - TSeqPos range_to = 100000; - size_t snp_count = 1; - - CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id)); - BOOST_REQUIRE(bh); - - s_TestNA("SNPImplicitNA 1", eFromSNP, na_acc, bh, range_from, range_to, snp_count); - s_TestNoNA("SNPImplicitNA 2", na_acc2, bh, range_from, range_to); -} - - -BOOST_AUTO_TEST_CASE(SNPImplicitSNP64) -{ - CRef scope = s_MakeScope(); - string seq_id = "2500000194"; - TSeqPos range_from = 0; - TSeqPos range_to = 100000; - size_t snp_count = 1; - - CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id)); - BOOST_REQUIRE(bh); - - s_TestPTIS("SNPImplicitSNP 1", eFromSNP, bh, range_from, range_to, snp_count); -} - - -NCBITEST_INIT_TREE() -{ - if ( !CSNPDataLoader::IsUsingPTIS() ) { - NCBITEST_DISABLE(SNPImplicitSNP); - NCBITEST_DISABLE(SNPImplicitSNP64); - } -#if defined(NCBI_INT4_GI) || 1 - NCBITEST_DISABLE(GBImplicitNA64); - NCBITEST_DISABLE(GBImplicitSNP64); - NCBITEST_DISABLE(SNPExplicitNA64); - NCBITEST_DISABLE(SNPImplicitNA64); - NCBITEST_DISABLE(SNPImplicitSNP64); -#endif -} diff --git a/c++/src/sra/data_loaders/snp/test/test_snp_loader.ini b/c++/src/sra/data_loaders/snp/test/test_snp_loader.ini deleted file mode 100644 index a87b47de..00000000 --- a/c++/src/sra/data_loaders/snp/test/test_snp_loader.ini +++ /dev/null @@ -1,4 +0,0 @@ -[genbank] -#vdb_snp=1 -[genbank/id2] -#service = ID2_SNP2 diff --git a/c++/src/sra/readers/bam/bgzf.cpp b/c++/src/sra/readers/bam/bgzf.cpp index f3e1156c..bdf791c6 100644 --- a/c++/src/sra/readers/bam/bgzf.cpp +++ b/c++/src/sra/readers/bam/bgzf.cpp @@ -1,4 +1,4 @@ -/* $Id: bgzf.cpp 668513 2023-06-06 20:11:40Z vasilche $ +/* $Id: bgzf.cpp 674299 2023-10-23 19:56:29Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -372,7 +372,7 @@ CBGZFFile::CBGZFFile(const string& file_name) CBGZFFile::~CBGZFFile() { if ( s_GetDebug() >= 1 ) { - auto stat = GetReadStatistics(); + auto stat = GetUncompressStatistics(); if ( stat.first ) { LOG_POST("BGZF: Total decompressed "<m_GB_STATE? *m_Cur->GB_STATE(m_CurrId): m_Db->GetProjectGBState(); + NCBI_gb_state state = 0; + if ( m_Cur->m_GB_STATE ) { + state = *m_Cur->GB_STATE(m_CurrId); + } + if ( !state ) { + state = m_Db->GetProjectGBState(); + } + return state; } @@ -6507,7 +6514,14 @@ NCBI_gb_state CWGSScaffoldIterator::GetGBState(void) const x_CheckValid("CWGSScaffoldIterator::GetGBState"); CVDBMgr::CRequestContextUpdater ctx_updater; - return m_Cur->m_GB_STATE? *m_Cur->GB_STATE(m_CurrId): m_Db->GetProjectGBState(); + NCBI_gb_state state = 0; + if ( m_Cur->m_GB_STATE ) { + state = *m_Cur->GB_STATE(m_CurrId); + } + if ( !state ) { + state = m_Db->GetProjectGBState(); + } + return state; } @@ -7327,7 +7341,14 @@ NCBI_gb_state CWGSProteinIterator::GetGBState(void) const x_CheckValid("CWGSProteinIterator::GetGBState"); x_Cur(); CVDBMgr::CRequestContextUpdater ctx_updater; - return m_Cur->m_GB_STATE? *m_Cur->GB_STATE(m_CurrId): m_Db->GetProjectGBState(); + NCBI_gb_state state = 0; + if ( m_Cur->m_GB_STATE ) { + state = *m_Cur->GB_STATE(m_CurrId); + } + if ( !state ) { + state = m_Db->GetProjectGBState(); + } + return state; } diff --git a/c++/src/util/stream_source.cpp b/c++/src/util/stream_source.cpp index 2bcba789..2f589999 100644 --- a/c++/src/util/stream_source.cpp +++ b/c++/src/util/stream_source.cpp @@ -1,4 +1,4 @@ -/* $Id: stream_source.cpp 542800 2017-08-02 18:30:15Z lavr $ +/* $Id: stream_source.cpp 680708 2024-03-26 13:05:01Z ivanov $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -314,7 +314,7 @@ CNcbiIstream& CInputStreamSource::operator*() } -CInputStreamSource& CInputStreamSource::operator++() +void CInputStreamSource::x_Reset() { // The next stream can be held in either of two places. Clear both. @@ -349,19 +349,40 @@ CInputStreamSource& CInputStreamSource::operator++() // but someday might apply to others, so clear it here rather than // inside the above conditionals. m_CurrFile.erase(); +} - // Advance to the next stream, if there is any. +void CInputStreamSource::x_OpenNextFile() +{ if (m_CurrIndex < m_Files.size()) { m_CurrFile = m_Files[m_CurrIndex++]; - m_IstrOwned.reset(new CNcbiIfstream(m_CurrFile.c_str())); - if (m_IstrOwned->fail()) { - // Do not provide to clients with streams that are already - // known not to be good (fail, meaning badbit or failbit). - string msg("CInputStreamSource::operator++(): " - "File is not accessible: "); - NCBI_THROW(CException, eUnknown, msg + m_CurrFile); - } + x_OpenOwnedStream(new CNcbiIfstream(m_CurrFile.c_str())); + } +} + +void CInputStreamSource::x_OpenOwnedStream(CNcbiIstream *is) +{ + if (is->fail()) { + // Do not provide to clients with streams that are already + // known not to be good (fail, meaning badbit or failbit). + string msg("CInputStreamSource: File is not accessible: "); + NCBI_THROW(CException, eUnknown, msg + m_CurrFile); } + m_IstrOwned.reset(is); +} + +CInputStreamSource& CInputStreamSource::operator++() +{ + x_Reset(); + x_OpenNextFile(); + return *this; +} + +CInputStreamSource& CInputStreamSource::JumpToFile(unsigned index) +{ + x_Reset(); + + m_CurrIndex = index; + x_OpenNextFile(); return *this; } diff --git a/c++/src/util/unicode.cpp b/c++/src/util/unicode.cpp index ace13304..f9e291d8 100644 --- a/c++/src/util/unicode.cpp +++ b/c++/src/util/unicode.cpp @@ -1,4 +1,4 @@ -/* $Id: unicode.cpp 619576 2020-11-06 16:13:14Z gouriano $ +/* $Id: unicode.cpp 675397 2023-11-20 22:22:17Z ivanov $ * ========================================================================== * * PUBLIC DOMAIN NOTICE @@ -531,7 +531,7 @@ string UTF8ToAsciiString( const char* src, if (result) { *result = eConvertedFine; } - if ( !src ) return 0; + if ( !src ) return kEmptyStr; string dst; size_t srcPos = 0; size_t srcLen = strlen( src ); diff --git a/c++/src/util/unicode_plans.inl b/c++/src/util/unicode_plans.inl index 6cbb593f..2befe096 100644 --- a/c++/src/util/unicode_plans.inl +++ b/c++/src/util/unicode_plans.inl @@ -1,4 +1,4 @@ -/* $Id: unicode_plans.inl 663165 2023-02-14 15:12:45Z grichenk $ +/* $Id: unicode_plans.inl 677938 2024-01-25 18:09:49Z ivanov $ * ========================================================================== * * PUBLIC DOMAIN NOTICE @@ -1656,7 +1656,7 @@ static TUnicodePlan s_Plan_20h = { { 0, eString }, // U+2040 { "insertion mark", eString }, // old dictionary U+2041 { 0, eString }, // U+2042 - { " rectangle", eString }, // old dictionary U+2043 + { "-", eString }, // old dictionary U+2043 { 0, eString }, // U+2044 { 0, eString }, // U+2045 { 0, eString }, // U+2046 diff --git a/c++/src/util/unicode_to_ascii.txt b/c++/src/util/unicode_to_ascii.txt index dea1ffa0..fcb3e060 100644 --- a/c++/src/util/unicode_to_ascii.txt +++ b/c++/src/util/unicode_to_ascii.txt @@ -1607,7 +1607,7 @@ 0x2040 0x2041, "insertion mark" 0x2042 -0x2043, " rectangle" +0x2043, "-" 0x2044 0x2045 0x2046 -- 2.30.2