New upstream version 2.16.0+ds
authorAaron M. Ucko <ucko@debian.org>
Fri, 26 Jul 2024 00:02:52 +0000 (20:02 -0400)
committerAaron M. Ucko <ucko@debian.org>
Fri, 26 Jul 2024 00:02:52 +0000 (20:02 -0400)
658 files changed:
c++/compilers/xcode30_prj/postbuild.sh
c++/include/algo/blast/api/blast_dbindex.hpp
c++/include/algo/blast/api/blast_exception.hpp
c++/include/algo/blast/api/blast_node.hpp
c++/include/algo/blast/api/cdd_pssm_input.hpp
c++/include/algo/blast/blastinput/blast_args.hpp
c++/include/algo/blast/core/blast_message.h
c++/include/algo/blast/core/blast_options.h
c++/include/algo/blast/dbindex/dbindex.hpp
c++/include/algo/blast/format/data4xmlformat.hpp
c++/include/algo/blast/proteinkmer/mhfile.hpp
c++/include/algo/blast/vdb/blastn_vdb_args.hpp
c++/include/algo/blast/vdb/seqsrc_vdb.h
c++/include/algo/blast/vdb/vdb2blast_util.hpp
c++/include/algo/blast/vdb/vdbblast_local.hpp
c++/include/cgi/caf_encoded.hpp [new file with mode: 0644]
c++/include/cgi/caf_plain.hpp [new file with mode: 0644]
c++/include/cgi/cgi_exception.hpp
c++/include/common/ncbi_export.h
c++/include/common/ncbi_package_ver.h
c++/include/common/ncbi_source_ver.h
c++/include/connect/impl/connect_misc.hpp
c++/include/connect/impl/ncbi_uv_nghttp2.hpp
c++/include/corelib/request_status.hpp
c++/include/misc/jsonwrapp/jsonwrapp11.hpp
c++/include/ncbi_pch.hpp
c++/include/ncbi_source_ver.h
c++/include/ncbiconf.h
c++/include/objects/general/Dbtag.hpp
c++/include/objects/seqfeat/OrgMod.hpp
c++/include/objects/seqfeat/SubSource.hpp
c++/include/objects/seqloc/Seq_id.hpp
c++/include/objects/valerr/ValidErrItem.hpp
c++/include/objects/valerr/ValidError.hpp
c++/include/objtools/align_format/align_format_util.hpp
c++/include/objtools/align_format/showalign.hpp
c++/include/objtools/blast/seqdb_reader/impl/seqdbatlas.hpp
c++/include/objtools/blast/seqdb_reader/impl/seqdbgeneral.hpp
c++/include/objtools/blast/seqdb_reader/impl/seqdbisam.hpp
c++/include/objtools/blast/seqdb_reader/impl/seqdbvol.hpp
c++/include/objtools/blast/seqdb_reader/seqdbcommon.hpp
c++/include/objtools/blast/seqdb_writer/build_db.hpp
c++/include/objtools/blast/seqdb_writer/writedb.hpp
c++/include/objtools/cleanup/capitalization_string.hpp
c++/include/objtools/cleanup/cleanup.hpp
c++/include/objtools/cleanup/cleanup_change.hpp
c++/include/objtools/cleanup/huge_file_cleanup.hpp [deleted file]
c++/include/objtools/cleanup/influenza_set.hpp [new file with mode: 0644]
c++/include/objtools/data_loaders/genbank/gbloader.hpp
c++/include/objtools/data_loaders/genbank/gbnative.hpp
c++/include/objtools/data_loaders/genbank/impl/dispatcher.hpp
c++/include/objtools/data_loaders/genbank/impl/psg_loader_impl.hpp
c++/include/objtools/data_loaders/genbank/psg_loader.hpp
c++/include/objtools/data_loaders/genbank/reader.hpp
c++/include/objtools/edit/eutils_updater.hpp
c++/include/objtools/edit/feattable_edit.hpp
c++/include/objtools/edit/huge_asn_loader.hpp
c++/include/objtools/edit/huge_asn_macro_reader.hpp [deleted file]
c++/include/objtools/edit/huge_asn_reader.hpp
c++/include/objtools/edit/huge_file.hpp
c++/include/objtools/edit/huge_file_process.hpp
c++/include/objtools/edit/pub_fix.hpp
c++/include/objtools/edit/pubmed_updater.hpp
c++/include/objtools/edit/remote_updater.hpp
c++/include/objtools/format/flat_file_config.hpp
c++/include/objtools/format/items/source_item.hpp
c++/include/objtools/pubseq_gateway/client/impl/misc.hpp
c++/include/objtools/pubseq_gateway/client/psg_client.hpp
c++/include/objtools/readers/agp_util.hpp
c++/include/objtools/readers/fasta.hpp
c++/include/objtools/readers/fasta_exception.hpp
c++/include/objtools/readers/gtf_reader.hpp
c++/include/objtools/readers/line_error.hpp
c++/include/objtools/readers/message_listener.hpp
c++/include/objtools/readers/readfeat.hpp
c++/include/sra/data_loaders/bam/impl/bamloader_impl.hpp
c++/include/util/bitset/bm.h
c++/include/util/bitset/bmblocks.h
c++/include/util/bitset/bmbmatrix.h
c++/include/util/bitset/bmbuffer.h
c++/include/util/bitset/bmconst.h
c++/include/util/bitset/bmserial.h
c++/include/util/bitset/bmsparsevec.h
c++/include/util/bitset/bmsparsevec_compr.h
c++/include/util/bitset/bmsparsevec_parallel.h
c++/include/util/bitset/bmsparsevec_serial.h
c++/include/util/bitset/bmsse4.h
c++/include/util/bitset/bmstrsparsevec.h
c++/include/util/bitset/encoding.h
c++/include/util/stream_source.hpp
c++/scripts/common/check/check_exec.sh
c++/scripts/common/check/check_exec_test.sh
c++/scripts/common/check/check_make_cfg.sh
c++/scripts/common/check/check_make_unix.sh
c++/scripts/common/check/check_make_unix_cmake.sh
c++/scripts/common/check/check_run.sh
c++/scripts/common/check/retry_db_load.sh [new file with mode: 0755]
c++/scripts/common/impl/install.sh
c++/scripts/common/impl/ncbicxx_build_info.py
c++/scripts/common/new_cmake_project.sh
c++/scripts/projects/blast/Manifest
c++/scripts/projects/blast/post_build/blast_utils.py
c++/scripts/projects/blast/post_build/macosx/build_universal_binary.sh [new file with mode: 0755]
c++/scripts/projects/blast/post_build/macosx/ncbi-blast.sh
c++/scripts/projects/blast/post_build/macosx/uninstall_ncbi_blast.zip
c++/scripts/projects/blast/post_build/macosx/uninstaller/build_uninstaller.sh [new file with mode: 0755]
c++/scripts/projects/blast/post_build/macosx/uninstaller/uninstall_ncbi_blast.applescript [new file with mode: 0644]
c++/scripts/projects/blast/post_build/make_installers.py
c++/scripts/projects/blast/post_build/rpm/ncbi-blast.spec
c++/scripts/projects/blast/project.lst
c++/scripts/projects/cobalt/post_build/blast_utils.py
c++/scripts/projects/cobalt/post_build/make_installers.py
c++/scripts/projects/datatool/ChangeLog
c++/scripts/projects/datatool/Manifest
c++/scripts/projects/datatool/components.link
c++/scripts/projects/dispatcher/ChangeLog [deleted file]
c++/scripts/projects/dispatcher/LICENSE [deleted file]
c++/scripts/projects/dispatcher/Manifest [deleted file]
c++/scripts/projects/dispatcher/README [deleted file]
c++/scripts/projects/dispatcher/project.lst [deleted file]
c++/scripts/projects/fwdaemon/ChangeLog [deleted file]
c++/scripts/projects/fwdaemon/LICENSE [deleted file]
c++/scripts/projects/fwdaemon/Manifest [deleted file]
c++/scripts/projects/fwdaemon/README [deleted file]
c++/scripts/projects/fwdaemon/project.lst [deleted file]
c++/scripts/projects/igblast/Manifest
c++/scripts/projects/igblast/post_build/blast_utils.py
c++/scripts/projects/igblast/post_build/make_installers.py
c++/scripts/projects/igblast/project.lst
c++/scripts/projects/lbsbd/ChangeLog [deleted file]
c++/scripts/projects/lbsbd/LICENSE [deleted file]
c++/scripts/projects/lbsbd/Manifest [deleted file]
c++/scripts/projects/lbsbd/README [deleted file]
c++/scripts/projects/lbsbd/project.lst [deleted file]
c++/scripts/projects/magicblast/Manifest
c++/scripts/projects/magicblast/post_build/blast_utils.py
c++/scripts/projects/magicblast/post_build/make_installers.py
c++/scripts/projects/magicblast/project.lst
c++/scripts/projects/mod_caf/ChangeLog [deleted file]
c++/scripts/projects/mod_caf/LICENSE [deleted file]
c++/scripts/projects/mod_caf/Manifest [deleted file]
c++/scripts/projects/mod_caf/README [deleted file]
c++/scripts/projects/mod_caf/project.lst [deleted file]
c++/scripts/projects/mod_loadinfo/ChangeLog [deleted file]
c++/scripts/projects/mod_loadinfo/LICENSE [deleted file]
c++/scripts/projects/mod_loadinfo/Manifest [deleted file]
c++/scripts/projects/mod_loadinfo/README [deleted file]
c++/scripts/projects/mod_loadinfo/project.lst [deleted file]
c++/scripts/projects/ncbi_applog/ChangeLog
c++/scripts/projects/ncbi_applog/Manifest
c++/scripts/projects/ncbi_cpp.lst
c++/scripts/projects/ncbi_cpp_dll.lst
c++/scripts/projects/ncbi_gbench.lst
c++/scripts/projects/ncbi_gui_base.lst
c++/scripts/projects/ncbi_mapview.lst
c++/scripts/projects/netstorage/project.lst
c++/scripts/projects/netstorage_gc/project.lst
c++/scripts/projects/project_tree_builder/ChangeLog
c++/scripts/projects/project_tree_builder/Manifest
c++/scripts/projects/project_tree_builder/components.link
c++/scripts/projects/psg_client/Manifest
c++/scripts/projects/psg_client/components.link
c++/scripts/projects/pubseq_gateway/Manifest
c++/scripts/projects/pubseq_gateway/project.lst
c++/scripts/projects/python_ncbi_dbapi/ChangeLog
c++/scripts/projects/python_ncbi_dbapi/project.lst
c++/scripts/projects/xmlwrapp/Manifest
c++/src/CMakeLists.txt
c++/src/Makefile.in
c++/src/algo/blast/api/bioseq_extract_data_priv.cpp
c++/src/algo/blast/api/blast_aux_priv.cpp
c++/src/algo/blast/api/blast_dbindex.cpp
c++/src/algo/blast/api/blast_seqalign.cpp
c++/src/algo/blast/api/blast_setup_cxx.cpp
c++/src/algo/blast/api/cdd_pssm_input.cpp
c++/src/algo/blast/api/deltablast.cpp
c++/src/algo/blast/api/effsearchspace_calc.cpp
c++/src/algo/blast/api/local_blast.cpp
c++/src/algo/blast/api/magicblast.cpp
c++/src/algo/blast/api/msa_pssm_input.cpp
c++/src/algo/blast/api/objmgr_query_data.cpp
c++/src/algo/blast/api/objmgrfree_query_data.cpp
c++/src/algo/blast/api/prelim_search_runner.hpp
c++/src/algo/blast/api/prelim_stage.cpp
c++/src/algo/blast/api/psi_pssm_input.cpp
c++/src/algo/blast/api/psiblast_impl.cpp
c++/src/algo/blast/api/remote_blast.cpp
c++/src/algo/blast/api/rpsblast_local.cpp
c++/src/algo/blast/api/seqsrc_query_factory.cpp
c++/src/algo/blast/api/setup_factory.cpp
c++/src/algo/blast/api/split_query_aux_priv.cpp
c++/src/algo/blast/api/split_query_blk.cpp
c++/src/algo/blast/api/split_query_cxx.cpp
c++/src/algo/blast/blastinput/blast_args.cpp
c++/src/algo/blast/blastinput/blast_fasta_input.cpp
c++/src/algo/blast/core/blast_aascan.c
c++/src/algo/blast/core/blast_engine.c
c++/src/algo/blast/core/blast_filter.c
c++/src/algo/blast/core/blast_hits.c
c++/src/algo/blast/core/blast_hspstream.c
c++/src/algo/blast/core/blast_kappa.c
c++/src/algo/blast/core/blast_message.c
c++/src/algo/blast/core/blast_nalookup.c
c++/src/algo/blast/core/blast_nascan.c
c++/src/algo/blast/core/blast_options.c
c++/src/algo/blast/core/blast_parameters.c
c++/src/algo/blast/core/blast_posit.c
c++/src/algo/blast/core/blast_psi_priv.c
c++/src/algo/blast/core/blast_stat.c
c++/src/algo/blast/core/blast_traceback.c
c++/src/algo/blast/core/blast_util.c
c++/src/algo/blast/core/jumper.c
c++/src/algo/blast/core/na_ungapped.c
c++/src/algo/blast/core/phi_lookup.c
c++/src/algo/blast/dbindex/dbindex_factory.cpp
c++/src/algo/blast/dbindex/dbindex_search.cpp
c++/src/algo/blast/format/blast_format.cpp
c++/src/algo/blast/format/blastfmtutil.cpp
c++/src/algo/blast/format/blastxml_format.cpp
c++/src/algo/blast/proteinkmer/blastkmer.cpp
c++/src/algo/blast/proteinkmer/blastkmerindex.cpp
c++/src/algo/blast/proteinkmer/blastkmerutils.cpp
c++/src/algo/blast/proteinkmer/kblastapi.cpp
c++/src/algo/blast/unit_tests/api/CMakeLists.blast_unit_test.app.txt
c++/src/algo/blast/unit_tests/api/data/Sample_gilist.p.gil
c++/src/algo/blast/unit_tests/api/tracebacksearch_unit_test.cpp
c++/src/algo/blast/unit_tests/api/version_reference_unit_test.cpp
c++/src/algo/blast/vdb/blastn_vdb_args.cpp
c++/src/algo/blast/vdb/common_priv.h
c++/src/algo/blast/vdb/seqsrc_vdb.c
c++/src/algo/blast/vdb/vdb2blast_util.cpp
c++/src/algo/blast/vdb/vdb_priv.c
c++/src/algo/blast/vdb/vdb_priv.h
c++/src/algo/blast/vdb/vdbblast_local.cpp
c++/src/app/blast/CMakeLists.blast_report.app.txt [deleted file]
c++/src/app/blast/CMakeLists.txt
c++/src/app/blast/Makefile.blast_report.app [deleted file]
c++/src/app/blast/Makefile.in
c++/src/app/blast/blast_app_util.cpp
c++/src/app/blast/blast_app_util.hpp
c++/src/app/blast/blast_report.cpp [deleted file]
c++/src/app/blast/blast_report.ini [deleted file]
c++/src/app/blast/blastn_app.cpp
c++/src/app/blast/blastp_app.cpp
c++/src/app/blast/blastx_app.cpp
c++/src/app/blast/tblastn_app.cpp
c++/src/app/blast/update_blastdb.pl
c++/src/app/blastdb/makeblastdb.cpp
c++/src/app/blastdb/makeprofiledb.cpp
c++/src/app/blastvdb/blast_vdb_cmd.cpp
c++/src/app/blastvdb/blastn_vdb.cpp
c++/src/app/blastvdb/tblastn_vdb.cpp
c++/src/build-system/Makefile.xcode.tmpl
c++/src/build-system/cmake/CMake.NCBIComponentsMSVC.cmake
c++/src/build-system/cmake/CMake.NCBIComponentsPackage.cmake
c++/src/build-system/cmake/CMake.NCBIComponentsUNIXex.cmake
c++/src/build-system/cmake/CMake.NCBIComponentsXCODE.cmake
c++/src/build-system/cmake/CMake.NCBIpkg.setup.cmake
c++/src/build-system/cmake/CMake.NCBIptb.cmake
c++/src/build-system/cmake/CMake.NCBIptb.datatool.cmake
c++/src/build-system/cmake/CMake.NCBIptb.definitions.cmake
c++/src/build-system/cmake/CMake.NCBIptb.grpc.cmake
c++/src/build-system/cmake/CMakeChecks.boost.cmake
c++/src/build-system/cmake/cmake-cfg-unix.sh
c++/src/build-system/cmake/cmake-cfg-vs.bat
c++/src/build-system/cmake/cmake-cfg-xcode.sh
c++/src/build-system/cmake/conanfile.MSVC.txt
c++/src/build-system/cmake/conanfile.UNIX.txt
c++/src/build-system/cmake/conanfile.XCODE.txt
c++/src/build-system/cmake/conanfile.py [new file with mode: 0644]
c++/src/build-system/cmake/toolchains/x86_64-linux-gcc-1320.cmake [new file with mode: 0644]
c++/src/build-system/config.site.ncbi
c++/src/build-system/configure
c++/src/build-system/configure.ac
c++/src/build-system/install.sh.in
c++/src/build-system/ncbi_package_version
c++/src/build-system/project_tree_builder.ini
c++/src/build-system/relocate.sh.in
c++/src/cgi/fcgi_run.cpp
c++/src/connect/connect_misc.cpp
c++/src/connect/mbedtls/aes.c
c++/src/connect/mbedtls/aesni.c
c++/src/connect/mbedtls/arc4.c
c++/src/connect/mbedtls/aria.c
c++/src/connect/mbedtls/asn1parse.c
c++/src/connect/mbedtls/asn1write.c
c++/src/connect/mbedtls/base64.c
c++/src/connect/mbedtls/bignum.c
c++/src/connect/mbedtls/bignum_internal.h [new file with mode: 0644]
c++/src/connect/mbedtls/blowfish.c
c++/src/connect/mbedtls/camellia.c
c++/src/connect/mbedtls/ccm.c
c++/src/connect/mbedtls/certs.c
c++/src/connect/mbedtls/chacha20.c
c++/src/connect/mbedtls/chachapoly.c
c++/src/connect/mbedtls/check_crypto_config.h
c++/src/connect/mbedtls/cipher.c
c++/src/connect/mbedtls/cipher_wrap.c
c++/src/connect/mbedtls/cmac.c
c++/src/connect/mbedtls/common.h
c++/src/connect/mbedtls/constant_time.c
c++/src/connect/mbedtls/constant_time_internal.h
c++/src/connect/mbedtls/constant_time_invasive.h
c++/src/connect/mbedtls/ctr_drbg.c
c++/src/connect/mbedtls/debug.c
c++/src/connect/mbedtls/des.c
c++/src/connect/mbedtls/dhm.c
c++/src/connect/mbedtls/ecdh.c
c++/src/connect/mbedtls/ecdsa.c
c++/src/connect/mbedtls/ecjpake.c
c++/src/connect/mbedtls/ecp.c
c++/src/connect/mbedtls/ecp_curves.c
c++/src/connect/mbedtls/ecp_invasive.h
c++/src/connect/mbedtls/entropy.c
c++/src/connect/mbedtls/entropy_poll.c
c++/src/connect/mbedtls/error.c
c++/src/connect/mbedtls/gcm.c
c++/src/connect/mbedtls/havege.c
c++/src/connect/mbedtls/hkdf.c
c++/src/connect/mbedtls/hmac_drbg.c
c++/src/connect/mbedtls/mbedtls/aes.h
c++/src/connect/mbedtls/mbedtls/aesni.h
c++/src/connect/mbedtls/mbedtls/arc4.h
c++/src/connect/mbedtls/mbedtls/aria.h
c++/src/connect/mbedtls/mbedtls/asn1.h
c++/src/connect/mbedtls/mbedtls/asn1write.h
c++/src/connect/mbedtls/mbedtls/base64.h
c++/src/connect/mbedtls/mbedtls/bignum.h
c++/src/connect/mbedtls/mbedtls/blowfish.h
c++/src/connect/mbedtls/mbedtls/bn_mul.h
c++/src/connect/mbedtls/mbedtls/camellia.h
c++/src/connect/mbedtls/mbedtls/ccm.h
c++/src/connect/mbedtls/mbedtls/certs.h
c++/src/connect/mbedtls/mbedtls/chacha20.h
c++/src/connect/mbedtls/mbedtls/chachapoly.h
c++/src/connect/mbedtls/mbedtls/check_config.h
c++/src/connect/mbedtls/mbedtls/cipher.h
c++/src/connect/mbedtls/mbedtls/cipher_internal.h
c++/src/connect/mbedtls/mbedtls/cmac.h
c++/src/connect/mbedtls/mbedtls/compat-1.3.h
c++/src/connect/mbedtls/mbedtls/config.h
c++/src/connect/mbedtls/mbedtls/config_psa.h
c++/src/connect/mbedtls/mbedtls/constant_time.h
c++/src/connect/mbedtls/mbedtls/ctr_drbg.h
c++/src/connect/mbedtls/mbedtls/debug.h
c++/src/connect/mbedtls/mbedtls/des.h
c++/src/connect/mbedtls/mbedtls/dhm.h
c++/src/connect/mbedtls/mbedtls/ecdh.h
c++/src/connect/mbedtls/mbedtls/ecdsa.h
c++/src/connect/mbedtls/mbedtls/ecjpake.h
c++/src/connect/mbedtls/mbedtls/ecp.h
c++/src/connect/mbedtls/mbedtls/ecp_internal.h
c++/src/connect/mbedtls/mbedtls/entropy.h
c++/src/connect/mbedtls/mbedtls/entropy_poll.h
c++/src/connect/mbedtls/mbedtls/error.h
c++/src/connect/mbedtls/mbedtls/gcm.h
c++/src/connect/mbedtls/mbedtls/havege.h
c++/src/connect/mbedtls/mbedtls/hkdf.h
c++/src/connect/mbedtls/mbedtls/hmac_drbg.h
c++/src/connect/mbedtls/mbedtls/md.h
c++/src/connect/mbedtls/mbedtls/md2.h
c++/src/connect/mbedtls/mbedtls/md4.h
c++/src/connect/mbedtls/mbedtls/md5.h
c++/src/connect/mbedtls/mbedtls/md_internal.h
c++/src/connect/mbedtls/mbedtls/memory_buffer_alloc.h
c++/src/connect/mbedtls/mbedtls/ncbicxx_rename_mbedtls.h
c++/src/connect/mbedtls/mbedtls/net.h
c++/src/connect/mbedtls/mbedtls/net_sockets.h
c++/src/connect/mbedtls/mbedtls/nist_kw.h
c++/src/connect/mbedtls/mbedtls/oid.h
c++/src/connect/mbedtls/mbedtls/padlock.h
c++/src/connect/mbedtls/mbedtls/pem.h
c++/src/connect/mbedtls/mbedtls/pk.h
c++/src/connect/mbedtls/mbedtls/pk_internal.h
c++/src/connect/mbedtls/mbedtls/pkcs11.h
c++/src/connect/mbedtls/mbedtls/pkcs12.h
c++/src/connect/mbedtls/mbedtls/pkcs5.h
c++/src/connect/mbedtls/mbedtls/platform.h
c++/src/connect/mbedtls/mbedtls/platform_time.h
c++/src/connect/mbedtls/mbedtls/platform_util.h
c++/src/connect/mbedtls/mbedtls/poly1305.h
c++/src/connect/mbedtls/mbedtls/psa_util.h
c++/src/connect/mbedtls/mbedtls/ripemd160.h
c++/src/connect/mbedtls/mbedtls/rsa.h
c++/src/connect/mbedtls/mbedtls/rsa_internal.h
c++/src/connect/mbedtls/mbedtls/sha1.h
c++/src/connect/mbedtls/mbedtls/sha256.h
c++/src/connect/mbedtls/mbedtls/sha512.h
c++/src/connect/mbedtls/mbedtls/ssl.h
c++/src/connect/mbedtls/mbedtls/ssl_cache.h
c++/src/connect/mbedtls/mbedtls/ssl_ciphersuites.h
c++/src/connect/mbedtls/mbedtls/ssl_cookie.h
c++/src/connect/mbedtls/mbedtls/ssl_internal.h
c++/src/connect/mbedtls/mbedtls/ssl_ticket.h
c++/src/connect/mbedtls/mbedtls/threading.h
c++/src/connect/mbedtls/mbedtls/timing.h
c++/src/connect/mbedtls/mbedtls/version.h
c++/src/connect/mbedtls/mbedtls/x509.h
c++/src/connect/mbedtls/mbedtls/x509_crl.h
c++/src/connect/mbedtls/mbedtls/x509_crt.h
c++/src/connect/mbedtls/mbedtls/x509_csr.h
c++/src/connect/mbedtls/mbedtls/xtea.h
c++/src/connect/mbedtls/mbedtls_md5.c
c++/src/connect/mbedtls/mbedtls_version.c
c++/src/connect/mbedtls/md.c
c++/src/connect/mbedtls/md2.c
c++/src/connect/mbedtls/md4.c
c++/src/connect/mbedtls/memory_buffer_alloc.c
c++/src/connect/mbedtls/mps_common.h
c++/src/connect/mbedtls/mps_error.h
c++/src/connect/mbedtls/mps_reader.c
c++/src/connect/mbedtls/mps_reader.h
c++/src/connect/mbedtls/mps_trace.c
c++/src/connect/mbedtls/mps_trace.h
c++/src/connect/mbedtls/net_sockets.c
c++/src/connect/mbedtls/nist_kw.c
c++/src/connect/mbedtls/oid.c
c++/src/connect/mbedtls/padlock.c
c++/src/connect/mbedtls/pem.c
c++/src/connect/mbedtls/pk.c
c++/src/connect/mbedtls/pk_wrap.c
c++/src/connect/mbedtls/pkcs11.c
c++/src/connect/mbedtls/pkcs12.c
c++/src/connect/mbedtls/pkcs5.c
c++/src/connect/mbedtls/pkparse.c
c++/src/connect/mbedtls/pkwrite.c
c++/src/connect/mbedtls/platform.c
c++/src/connect/mbedtls/platform_util.c
c++/src/connect/mbedtls/poly1305.c
c++/src/connect/mbedtls/psa/crypto.h
c++/src/connect/mbedtls/psa/crypto_builtin_composites.h
c++/src/connect/mbedtls/psa/crypto_builtin_primitives.h
c++/src/connect/mbedtls/psa/crypto_compat.h
c++/src/connect/mbedtls/psa/crypto_config.h
c++/src/connect/mbedtls/psa/crypto_driver_common.h
c++/src/connect/mbedtls/psa/crypto_driver_contexts_composites.h
c++/src/connect/mbedtls/psa/crypto_driver_contexts_primitives.h
c++/src/connect/mbedtls/psa/crypto_extra.h
c++/src/connect/mbedtls/psa/crypto_platform.h
c++/src/connect/mbedtls/psa/crypto_se_driver.h
c++/src/connect/mbedtls/psa/crypto_sizes.h
c++/src/connect/mbedtls/psa/crypto_struct.h
c++/src/connect/mbedtls/psa/crypto_types.h
c++/src/connect/mbedtls/psa/crypto_values.h
c++/src/connect/mbedtls/psa_crypto.c
c++/src/connect/mbedtls/psa_crypto_aead.c
c++/src/connect/mbedtls/psa_crypto_aead.h
c++/src/connect/mbedtls/psa_crypto_cipher.c
c++/src/connect/mbedtls/psa_crypto_cipher.h
c++/src/connect/mbedtls/psa_crypto_client.c
c++/src/connect/mbedtls/psa_crypto_core.h
c++/src/connect/mbedtls/psa_crypto_driver_wrappers.c
c++/src/connect/mbedtls/psa_crypto_driver_wrappers.h
c++/src/connect/mbedtls/psa_crypto_ecp.c
c++/src/connect/mbedtls/psa_crypto_ecp.h
c++/src/connect/mbedtls/psa_crypto_hash.c
c++/src/connect/mbedtls/psa_crypto_hash.h
c++/src/connect/mbedtls/psa_crypto_invasive.h
c++/src/connect/mbedtls/psa_crypto_its.h
c++/src/connect/mbedtls/psa_crypto_mac.c
c++/src/connect/mbedtls/psa_crypto_mac.h
c++/src/connect/mbedtls/psa_crypto_random_impl.h
c++/src/connect/mbedtls/psa_crypto_rsa.c
c++/src/connect/mbedtls/psa_crypto_rsa.h
c++/src/connect/mbedtls/psa_crypto_se.c
c++/src/connect/mbedtls/psa_crypto_se.h
c++/src/connect/mbedtls/psa_crypto_slot_management.c
c++/src/connect/mbedtls/psa_crypto_slot_management.h
c++/src/connect/mbedtls/psa_crypto_storage.c
c++/src/connect/mbedtls/psa_crypto_storage.h
c++/src/connect/mbedtls/psa_its_file.c
c++/src/connect/mbedtls/ripemd160.c
c++/src/connect/mbedtls/rsa.c
c++/src/connect/mbedtls/rsa_internal.c
c++/src/connect/mbedtls/sha1.c
c++/src/connect/mbedtls/sha256.c
c++/src/connect/mbedtls/sha512.c
c++/src/connect/mbedtls/ssl_cache.c
c++/src/connect/mbedtls/ssl_ciphersuites.c
c++/src/connect/mbedtls/ssl_cli.c
c++/src/connect/mbedtls/ssl_cookie.c
c++/src/connect/mbedtls/ssl_msg.c
c++/src/connect/mbedtls/ssl_srv.c
c++/src/connect/mbedtls/ssl_ticket.c
c++/src/connect/mbedtls/ssl_tls.c
c++/src/connect/mbedtls/ssl_tls13_keys.c
c++/src/connect/mbedtls/ssl_tls13_keys.h
c++/src/connect/mbedtls/threading.c
c++/src/connect/mbedtls/timing.c
c++/src/connect/mbedtls/version_features.c
c++/src/connect/mbedtls/x509.c
c++/src/connect/mbedtls/x509_create.c
c++/src/connect/mbedtls/x509_crl.c
c++/src/connect/mbedtls/x509_crt.c
c++/src/connect/mbedtls/x509_csr.c
c++/src/connect/mbedtls/x509write_crt.c
c++/src/connect/mbedtls/x509write_csr.c
c++/src/connect/mbedtls/xtea.c
c++/src/connect/ncbi_http2_session.cpp
c++/src/connect/ncbi_sendmail.c
c++/src/connect/ncbi_socket.c
c++/src/connect/ncbi_uv_nghttp2.cpp
c++/src/corelib/ncbi_cookies.cpp
c++/src/corelib/ncbi_system.cpp
c++/src/corelib/request_status.cpp
c++/src/dbapi/driver/dbapi_conn_factory.cpp
c++/src/objects/gbproj/ProjectItem.cpp
c++/src/objects/gbproj/gbproj.asn
c++/src/objects/general/Dbtag.cpp
c++/src/objects/general/Dbtag.inc
c++/src/objects/macro/CMakeLists.macro.asn.txt
c++/src/objects/macro/make_fsm_file.py [deleted file]
c++/src/objects/pub/Pub.cpp
c++/src/objects/remap/remap_client.cpp
c++/src/objects/seqfeat/OrgMod.cpp
c++/src/objects/seqfeat/SubSource.cpp
c++/src/objects/seqfeat/ecnum_ambiguous.inc
c++/src/objects/seqfeat/ecnum_ambiguous.txt
c++/src/objects/seqfeat/ecnum_deleted.inc
c++/src/objects/seqfeat/ecnum_replaced.inc
c++/src/objects/seqfeat/ecnum_replaced.txt
c++/src/objects/seqfeat/ecnum_specific.inc
c++/src/objects/seqfeat/ecnum_specific.txt
c++/src/objects/seqfeat/institution_codes.inc
c++/src/objects/seqfeat/institution_codes.txt
c++/src/objects/seqloc/Seq_id.cpp
c++/src/objects/seqloc/accguide.txt
c++/src/objects/seqloc/accguide2.inc
c++/src/objects/seqloc/accguide2.txt
c++/src/objects/taxon1/local_taxon.cpp
c++/src/objects/valerr/ValidErrItem.cpp
c++/src/objects/valerr/ValidError.cpp
c++/src/objects/valid/validrules.inc
c++/src/objmgr/util/create_defline.cpp
c++/src/objmgr/util/indexer.cpp
c++/src/objtools/CMakeLists.txt
c++/src/objtools/Makefile.in
c++/src/objtools/align_format/align_format_util.cpp
c++/src/objtools/align_format/showalign.cpp
c++/src/objtools/align_format/showdefline.cpp
c++/src/objtools/align_format/unit_test/data/tabular_db.pdb [new file with mode: 0644]
c++/src/objtools/align_format/unit_test/data/tabular_db.phr [new file with mode: 0644]
c++/src/objtools/align_format/unit_test/data/tabular_db.pin [new file with mode: 0644]
c++/src/objtools/align_format/unit_test/data/tabular_db.pjs [new file with mode: 0644]
c++/src/objtools/align_format/unit_test/data/tabular_db.pog [new file with mode: 0644]
c++/src/objtools/align_format/unit_test/data/tabular_db.pos [new file with mode: 0644]
c++/src/objtools/align_format/unit_test/data/tabular_db.pot [new file with mode: 0644]
c++/src/objtools/align_format/unit_test/data/tabular_db.ppd [new file with mode: 0644]
c++/src/objtools/align_format/unit_test/data/tabular_db.ppi [new file with mode: 0644]
c++/src/objtools/align_format/unit_test/data/tabular_db.psq [new file with mode: 0644]
c++/src/objtools/align_format/unit_test/data/tabular_db.ptf [new file with mode: 0644]
c++/src/objtools/align_format/unit_test/data/tabular_db.pto [new file with mode: 0644]
c++/src/objtools/align_format/unit_test/tabularinof_unit_test.cpp
c++/src/objtools/blast/blastdb_format/blastdb_dataextract.cpp
c++/src/objtools/blast/gene_info_reader/gene_info.cpp
c++/src/objtools/blast/gene_info_reader/gene_info_reader.cpp
c++/src/objtools/blast/seqdb_reader/seqdb.cpp
c++/src/objtools/blast/seqdb_reader/seqdbblob.cpp
c++/src/objtools/blast/seqdb_reader/seqdbimpl.cpp
c++/src/objtools/blast/seqdb_reader/seqdbisam.cpp
c++/src/objtools/blast/seqdb_reader/seqdblmdbset.cpp
c++/src/objtools/blast/seqdb_reader/seqdblmdbset.hpp
c++/src/objtools/blast/seqdb_reader/seqdboidlist.cpp
c++/src/objtools/blast/seqdb_reader/seqdboidlist.hpp
c++/src/objtools/blast/seqdb_reader/seqdbtax.cpp
c++/src/objtools/blast/seqdb_reader/seqdbvol.cpp
c++/src/objtools/blast/seqdb_reader/seqidlist_reader.cpp
c++/src/objtools/blast/seqdb_reader/tax4blastsqlite.cpp
c++/src/objtools/blast/seqdb_writer/build-alias-index
c++/src/objtools/blast/seqdb_writer/build_db.cpp
c++/src/objtools/blast/seqdb_writer/unit_test/writedb_unit_test.cpp
c++/src/objtools/blast/seqdb_writer/writedb.cpp
c++/src/objtools/blast/seqdb_writer/writedb_impl.cpp
c++/src/objtools/blast/seqdb_writer/writedb_impl.hpp
c++/src/objtools/cleanup/CMakeLists.cleanup.lib.txt
c++/src/objtools/cleanup/Makefile.cleanup.lib
c++/src/objtools/cleanup/autogenerated_cleanup.cpp
c++/src/objtools/cleanup/autogenerated_extended_cleanup.cpp
c++/src/objtools/cleanup/capitalization_string.cpp
c++/src/objtools/cleanup/cleanup.cpp
c++/src/objtools/cleanup/cleanup_utils.cpp
c++/src/objtools/cleanup/cleanup_utils.hpp
c++/src/objtools/cleanup/huge_file_cleanup.cpp [deleted file]
c++/src/objtools/cleanup/influenza_set.cpp
c++/src/objtools/cleanup/influenza_set.hpp [deleted file]
c++/src/objtools/cleanup/newcleanupp.cpp
c++/src/objtools/cleanup/newcleanupp.hpp
c++/src/objtools/data_loaders/blastdb/remote_blastdb_adapter.hpp
c++/src/objtools/data_loaders/genbank/dispatcher.cpp
c++/src/objtools/data_loaders/genbank/gbloader.cpp
c++/src/objtools/data_loaders/genbank/gbnative.cpp
c++/src/objtools/data_loaders/genbank/psg_loader.cpp
c++/src/objtools/data_loaders/genbank/psg_loader_impl.cpp
c++/src/objtools/data_loaders/genbank/reader.cpp
c++/src/objtools/data_loaders/genbank/reader_id2_base.cpp
c++/src/objtools/edit/CMakeLists.edit.lib.txt
c++/src/objtools/edit/Makefile.edit.lib
c++/src/objtools/edit/eutils_updater.cpp
c++/src/objtools/edit/feattable_edit.cpp
c++/src/objtools/edit/huge_asn_loader.cpp [deleted file]
c++/src/objtools/edit/huge_asn_macro_reader.cpp [deleted file]
c++/src/objtools/edit/huge_asn_reader.cpp [deleted file]
c++/src/objtools/edit/huge_file.cpp [deleted file]
c++/src/objtools/edit/huge_file_process.cpp [deleted file]
c++/src/objtools/edit/pub_fix.cpp
c++/src/objtools/edit/pub_fix_aux.hpp
c++/src/objtools/edit/remote_updater.cpp
c++/src/objtools/edit/seq_entry_edit.cpp
c++/src/objtools/eutils/efetch/PubmedArticle.cpp
c++/src/objtools/format/CMakeLists.txt
c++/src/objtools/format/Makefile.in
c++/src/objtools/format/comment_item.cpp
c++/src/objtools/format/dbsource_item.cpp
c++/src/objtools/format/feature_item.cpp
c++/src/objtools/format/flat_file_config.cpp
c++/src/objtools/format/gather_items.cpp
c++/src/objtools/format/gbseq_formatter.cpp
c++/src/objtools/format/genbank_formatter.cpp
c++/src/objtools/format/genbank_gather.cpp
c++/src/objtools/format/gene_finder.cpp
c++/src/objtools/format/genome_project_item.cpp
c++/src/objtools/format/item_formatter.cpp
c++/src/objtools/format/keywords_item.cpp
c++/src/objtools/format/qualifiers.cpp
c++/src/objtools/format/source_item.cpp
c++/src/objtools/pubseq_gateway/client/psg_client.cpp
c++/src/objtools/pubseq_gateway/client/psg_client_impl.hpp
c++/src/objtools/pubseq_gateway/client/psg_client_transport.cpp
c++/src/objtools/pubseq_gateway/client/psg_client_transport.hpp
c++/src/objtools/pubseq_gateway/client/test/test_psg_client_impl.cpp
c++/src/objtools/readers/agp_util.cpp
c++/src/objtools/readers/fasta.cpp
c++/src/objtools/readers/gff3_reader.cpp
c++/src/objtools/readers/gtf_location_merger.cpp
c++/src/objtools/readers/gtf_location_merger.hpp
c++/src/objtools/readers/gtf_reader.cpp
c++/src/objtools/readers/line_error.cpp
c++/src/objtools/readers/message_listener.cpp
c++/src/objtools/readers/mod_reader.cpp
c++/src/objtools/readers/mod_to_enum.cpp
c++/src/objtools/readers/reader_base.cpp
c++/src/objtools/readers/readfeat.cpp
c++/src/objtools/readers/source_mod_parser.cpp
c++/src/sra/data_loaders/bam/bamloader_impl.cpp
c++/src/sra/data_loaders/bam/test/test_bam_loader.cpp
c++/src/sra/data_loaders/snp/test/CMakeLists.test_snp_loader.app.txt [deleted file]
c++/src/sra/data_loaders/snp/test/CMakeLists.txt [deleted file]
c++/src/sra/data_loaders/snp/test/Makefile.in [deleted file]
c++/src/sra/data_loaders/snp/test/Makefile.test_snp_loader.app [deleted file]
c++/src/sra/data_loaders/snp/test/test_snp_loader.cpp [deleted file]
c++/src/sra/data_loaders/snp/test/test_snp_loader.ini [deleted file]
c++/src/sra/readers/bam/bgzf.cpp
c++/src/sra/readers/sra/vdbread.cpp
c++/src/sra/readers/sra/wgsread.cpp
c++/src/util/stream_source.cpp
c++/src/util/unicode.cpp
c++/src/util/unicode_plans.inl
c++/src/util/unicode_to_ascii.txt

index 7002a41d12a367d2bd298a84f7e471d9060f0bc6..d1f8ba23d60fd250198bc44609fa1d26f57f4b31 100755 (executable)
@@ -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
index a030132a1aadb997c5406a0510a43b053113053e..3190b687089adf2d0011617d88b1e5239df3cff8 100644 (file)
@@ -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();
 
index 89193ace3754a59a2eece0d60511510bec59a3a5..c6d93ea27870b454cab1054cdc05a855ed452b1a 100644 (file)
@@ -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();
         }
     }
index c6f9b01a4b68235ac9e2aa1c0f13a61a228752e1..eb8bec366b5ff23f67e1923f081c1e8229cf23a5 100644 (file)
@@ -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<CBlastNodeMsg> 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<int>(m_MsgQueue.size()); }
        int GetNodeNum() { return m_NodeNum; }
        ~CBlastNodeMailbox() { m_MsgQueue.resize(0); }
 private:
@@ -138,7 +138,7 @@ public:
        typedef map<int, double> TActiveNodes;
        typedef map<int, CRef<CBlastNodeMsg> > TFormatQueue;
        void RegisterNode(CBlastNode * node, CBlastNodeMailbox * mailbox);
-       int GetNumNodes() { return m_RegisteredNodes.size();}
+       int GetNumNodes() { return static_cast<int>(m_RegisteredNodes.size());}
        int IsFull();
        void Shutdown() { m_MaxNumNodes = -1; }
        bool Processing();
index ddc83a6967184c38db19306ee524980d965973bd..b874e222943afcf39b6003f305c4ae2637bf3d93 100644 (file)
@@ -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<unsigned int>(m_QueryData.size());}
 
     /// Get scoring matrix name
     /// @return Scoring matrix name
index 4179aee0a9fa1c7f502d9faff7602cff482e2c0b..a969aeacc30269217c1c8e7c4f69c78714102c81 100644 (file)
@@ -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<ncbi::TSeqPos>(align_format::kDfltArgNumAlignments) ;
-            m_DfltNumDescriptions = align_format::kDfltArgNumDescriptions;
+            m_DfltNumDescriptions = static_cast<TSeqPos>(align_format::kDfltArgNumDescriptions);
         }        
     };
 
index 31c260bebc060ac63f9d7e997a1b70403e2e917f..f90d3eab067952cb25826d9d11685204b347c6f0 100644 (file)
@@ -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
 }
index 50eb95d7b1d86b68a4682f9d2143213892cdd9aa..36d1baa847e7e2d9fef009bacd6b647407567984 100644 (file)
@@ -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
 
index ddcba4708bfcbb091d22d4d315618b68d9e9f9c8..02cb5a5cedc2c7cc5e596fd741736b85f54aa5fe 100644 (file)
@@ -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<TSeqNum>(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<TSeqNum>(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<TSeqNum>(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<TWord>(max_chunk_size_) : 
                         getSubjectLength( t.first )%(
-                                max_chunk_size_ - chunk_overlap_ );
+                                static_cast<TWord>(max_chunk_size_ - chunk_overlap_ ));
                 }
-                else return max_chunk_size_;
+                else return static_cast<TWord>(max_chunk_size_);
             }
             else {
-                return getSubjectLength( subjects_.size() - 2 )%(
-                        max_chunk_size_ - chunk_overlap_ );
+                return static_cast<TWord>( getSubjectLength( static_cast<TSeqNum>(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<TSeqPos>(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<TSeqNum>(subjects_.size() - 1); }
+        TSeqNum getNumChunks() const { return static_cast<TSeqNum>(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<TSeqNum>( chunks_.size() + 1 - subjects_[sid]);
         }
 
         const Uint1 * getSeqData( TSeqNum sid ) const
index c77574e5b09b23d625f7cbdcb7f55bbce87d7061..2c87b87322149316f03994634e9fd3907fc73336 100644 (file)
@@ -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<unsigned int>(m_Queries->Size()); }
 
     /// @inheritDoc
     const TMaskedQueryRegions* 
index 65bd45c61ff730f7e8b0a9700108ef58dbe21ac6..775c6bb72ed20bba1726e91bae1a9bf2c043b1e0 100644 (file)
@@ -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<uint32_t>& hits) const;
 
     /// Returns the number of hash arrays.
-    int GetNumSignatures() const {return (m_DataFileSize/(GetDataWidth()*GetNumHashes()+4));}
+    int GetNumSignatures() const {return static_cast<int>(m_DataFileSize/(GetDataWidth()*GetNumHashes()+4));}
 
 private:
 
index b59ac7088442a5069fd7674a6eca0a8e007e80cb..162db0d48a5037a9502f50de317708ed3253a1e8 100644 (file)
@@ -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
index 52d364b10dbf26e7356192b5be1dfe29e7d43d81..416efe71a4e68d1d0546222cf650ceb34e24dc91 100644 (file)
@@ -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);
 
 // ==========================================================================//
 
index 4c547a0484b50ff3a2f359fc6134a7f79f6ef923..66dbc12aa98d185f87f522e92e0202e3c204aa1a 100644 (file)
@@ -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;
+
 
 };
 
index 67b7dfe0053f18fa18ae532e31d4c1e74debdad3..7945fb631fa42cb3ad0783a307e66d28f7f730ee 100644 (file)
@@ -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<vector<string> >            &       m_chunks_for_thread;
     unsigned int                                       m_num_threads;
     Int4                                                       m_num_extensions;
+    bool                            m_include_filtered_reads;
     CRef<objects::CPssmWithParameters> m_pssm;
 
 public:
@@ -83,11 +84,13 @@ public:
         */
     CLocalVDBBlast(CRef<CBlastQueryVector> query_vector,
                   CRef<CBlastOptionsHandle> options,
-                  CLocalVDBBlast::SLocalVDBStruct      & local_vdb);
+                  CLocalVDBBlast::SLocalVDBStruct      & local_vdb,
+                  bool include_filtered_reads = false);
 
     CLocalVDBBlast(CRef<objects::CPssmWithParameters> pssm,
                    CRef<CBlastOptionsHandle> options,
-                   SLocalVDBStruct & local_vdb);
+                   SLocalVDBStruct & local_vdb,
+                   bool include_filtered_reads = false);
 
     /*
      * Run Local VDB Search
diff --git a/c++/include/cgi/caf_encoded.hpp b/c++/include/cgi/caf_encoded.hpp
new file mode 100644 (file)
index 0000000..78026e0
--- /dev/null
@@ -0,0 +1,38 @@
+#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
+*               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:  Anton Lavrentiev
+*
+* File Description:
+*   Forward header for encrypted implementation of cookie affinity interface
+*
+*/
+
+#error "Please use <cppcore/connext2/caf_encoded.hpp>"
+
+#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 (file)
index 0000000..d891d98
--- /dev/null
@@ -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 <caf.hpp>
+#include <connect/ext/ncbi_ifconf.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+/** @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 */
index e382243adac94dac31cf19760b3631bdb337db23..045e0100c2b92e444dbfcdbfa1999eda289aa0d0 100644 (file)
@@ -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,
index a9fa1a008555b287e01e5739a5de3374debf632d..e903b5738fcd8d47983b89e0e012b7db7f4b12ca 100644 (file)
@@ -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
 #  define NCBI_XOBJWRITE_EXPORTS
 #  define NCBI_XOBJUTIL_EXPORTS
 #  define NCBI_XOBJMANIP_EXPORTS
+#  define NCBI_XHUGEASN_EXPORTS
 #endif
 
 
 #  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
index c0352bdde6fae860ec78b97707c138744898f4ae..98883a7c24d929d623d5f02b97d15ece8fa121bf 100644 (file)
@@ -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                ""
 
index 5c4b594c1cba2c2900af1d3183b95a19067d3a79..bb879cfe7f4b2e2d21bfb7ff7a88726d05c1f04c 100644 (file)
@@ -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 <ncbiconf.h>
 #include <common/ncbi_build_info.h>
 
-/* #undef NCBI_PRODUCTION_VER */
+#define NCBI_PRODUCTION_VER 20231209
 #define NCBI_DEVELOPMENT_VER 20230606
 
 #if defined(NCBI_PRODUCTION_VER)
index b81f636350c6cc79339b9f445bc0182d4db846d1..dfd44dedcaf7fc5dd19e78aa4182cf73f228312f 100644 (file)
@@ -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<string> 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<unsigned short>(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<string> 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<SSocketAddress, double>;
     using TServers = vector<TServer>;
index 02b4388d80044ac4d5452e58e96bdc2e9273f257..3d7a2b575028352f9537e444f17517aa65f85942 100644 (file)
@@ -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<TR(TArgs...)> BindThis(TR (SUvNgHttp2_SessionBase::*member)(TArgs...))
     {
         return [this, member](TArgs&&... args) -> TR { return (this->*member)(forward<TArgs>(args)...); };
-    };
+    }
 
     void OnConnect(int status);
     void OnWrite(int status);
index dd3c442838b568aaddca3c8e93640949b162bbda..2d1480bf1269b428cb7db0a20e1868b5f37b48b6 100644 (file)
@@ -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.
index 9a79f9c0d956687216652e0e3c9cef45d1669174..1cef33d81f94625c418058d7d15328d4ebc97f2d 100644 (file)
@@ -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<CJson_Node::TKeyType>::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<CJson_Node::TKeyType>::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<rapidjson::kParseStopWhenDoneFlag>(ifs,walk);
+    return !rdr.Parse<rapidjson::kParseStopWhenDoneFlag>(ifs,walk).IsError();
 }
 
 inline bool CJson_Document::IsSchema(void) const {
index 922e92543dc3e52275aa5fb3fbb01b5c682a27c7..a7ba48e19a6fdbaa418513c3b3492df0d7cb149d 100644 (file)
@@ -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
index 83742b5f6e65a25c06aa8d6b6bb565b781bf7d08..5a68a4eec2ef4ae30cb7cb3947faa3b715eb593d 100644 (file)
@@ -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
index 2cb85d5a42fb9d67e734cf15d2b73449ab98e96d..759d310e1eb58acd2986f420ff9249f4462bd8c5 100644 (file)
@@ -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
index cb9b8824e23889cc54d731dac5bdd3e6e03f14cc..4c6c3d831c5becbb1598567d78235b2fc7b40fce 100644 (file)
@@ -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 {
index f08dd12cc24274e0b0a3dbbd5ef681097250f801..ce84d090eeb6e0d8f6b0d49211e1649a369abc19 100644 (file)
@@ -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<string, string, PNocase> 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);
index 46f7048c6d9fb2e907c63c36570ae95ff7c7bbea..2242c6c08628cdf3d5c2e0c14a6a2dc704dd91b2 100644 (file)
@@ -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
index e32c7576c61a4b397e2d2285c6681af5c96db126..0cbd0cd35e225d114cb7c30473a7b2125078b4f6 100644 (file)
@@ -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)
index adf99be8ac7a564fdb45b4a363f5a3f6b4ab2983..9524b02dc8b7466865bd03340f9fbb4e4de382c6 100644 (file)
@@ -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<CSeq_entry> 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<CSerialObject>        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<EDiagSev>(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;
 }
 
 
index 3e905e2a0513c0ebd2c9743d7f39380d7dbaed86..d5e37bd044eb0b54d81120423e0bc2fbf7da3ae7 100644 (file)
@@ -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<CValidErrItem> 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<CValidErrItem> 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<CValidErrItem> 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<EDiagSev, SIZE_TYPE>               TSevStats;
-    typedef CConstRef<CSerialObject>               TValidated;
-    typedef CConstRef<CSeq_entry>                  TContext;
+    typedef map<EDiagSev, SIZE_TYPE> TSevStats;
+    typedef CConstRef<CSerialObject> TValidated;
+    typedef CConstRef<CSeq_entry>    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<CValidError>               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<CValidError*>(this)->m_Stats[sev]; 
+    return const_cast<CValidError*>(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();
 }
index 55e12300a85d1b5a24fe9852d17df30ea6e14962..b5b69434498458dccd4e486f883b08a1adcc120c 100644 (file)
@@ -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<unsigned int>(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<CNcbiRegistry> m_Reg;
     static string m_Protocol;
     static bool   m_geturl_debug_flag;
-    static unique_ptr<CGeneInfoFileReader> m_GeneInfoReader;
+    
 
     /// Calculate the uniq subject query coverage range (blastn only)
     static int GetUniqSeqCoverage(objects::CSeq_align_set & alnset);
index 66de7aa7a0cde66ebb317245425a7df913e62d2d..beb5ea1f087f9dc800e37b11ab4e5ac125a3b759 100644 (file)
@@ -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<TSeqPos> feature_start;
         CRange < TSignedSeqPos > aln_range;
+        int genetic_code;                //genetice code used to this feature if applicable   
     };
     typedef list< CRef<SAlnFeatureInfo> > 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<list<CRange<TSeqPos> > >& feat_seq_range,
@@ -814,7 +818,7 @@ protected:
     void x_SetFeatureInfo(CRef<SAlnFeatureInfo> 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<objects::CAlnVec> 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
     ///
index 4da078c08422e7f21e4f8d15326e373856a16e65..65a59c80971dd3392a74a073ccb84d95202c36fd 100644 (file)
@@ -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 <corelib/ncbiapp_api.hpp>
 
 #include <objtools/blast/seqdb_reader/impl/seqdbgeneral.hpp>
-
 #include <vector>
 #include <map>
 #include <set>
@@ -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());
index 8333a6b7c014432c16dcc121b3be003770d8d9ae..fed7fb87d4e11576374cf4f4a4a7a27972d92618 100644 (file)
@@ -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<U> & v)
         i++;
     }
     
-    return i;
+    return static_cast<int>(i);
 }
 
 END_NCBI_SCOPE
index 5ed7860935cd0c7d92374c5bc57c5b825d9910a9..6d2dd308d658ee7ead4f81cc5c9620ec4fc26f6c 100644 (file)
@@ -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<T>(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<T>(x_GetNumericKey(keydatap)));
             vals.push_back(x_GetNumericData(keydatap));
             keydatap += m_TermSize;
         }
index a6194bf8c39da3b939218dbf59eb3c4b13523038..74d0a09a38b66e205e2e7a83832db92bb5da390f 100644 (file)
@@ -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;
index ef123cf419daae4bbeeb270f7b27fd3b50b10b41..48f0b7bda442355da7a0006d85d21b15606f9dab 100644 (file)
@@ -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
     {
index 863e52f860a4ede4f50392a7aa1692480c1cd155..6142226e20711552eb407e7c75274046180aea25 100644 (file)
@@ -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
index b6bf7103ac32e8ac2520dcc08660cbd0a1dbfa6b..8365ab06f084188f60b1827f41779e5094d50e76 100644 (file)
@@ -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<CBlast_def_line_set>
     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.
     ///
index 696433ff0183426cc22477d32589d9167f9056b8..8e18870134f06255fea37a7dcc7260f4158c7322 100644 (file)
@@ -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<str
 NCBI_CLEANUP_EXPORT void RemoveFieldNameFromString( const string& field_name, string& str);
 
 NCBI_CLEANUP_EXPORT void GetStateAbbreviation(string& state);
+NCBI_CLEANUP_EXPORT void GetCanadaStateAbbreviation(string& state);
 NCBI_CLEANUP_EXPORT bool FixStateAbbreviationsInCitSub(CCit_sub& sub);
 NCBI_CLEANUP_EXPORT bool FixUSAAbbreviationInAffil(CAffil& affil);
 NCBI_CLEANUP_EXPORT bool FixStateAbbreviationsInAffil(CAffil& affil);
index 16da323c8dfc668940d4b62c1d6f23901abdaed2..a4517f196c541c34b39c07cb4288b1b1bd30afe0 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef CLEANUP___CLEANUP__HPP
 #define CLEANUP___CLEANUP__HPP
 
-/*  $Id: cleanup.hpp 671837 2023-08-24 19:42:54Z ivanov $
+/*  $Id: cleanup.hpp 681442 2024-04-09 14:53:56Z ivanov $
  * ===========================================================================
  *
  *                            PUBLIC DOMAIN NOTICE
@@ -318,7 +318,6 @@ public:
     static void SetMrnaName(CSeq_feat& mrna, const string& protein_name);
     static const string& GetProteinName(const CProt_ref& prot);
     static const string& GetProteinName(const CSeq_feat& cds, CSeq_entry_Handle seh);
-    NCBI_DEPRECATED static const string& GetProteinName(const CSeq_feat& cds, CScope& scope);
 
 /// Sets MolInfo::tech for a sequence
 /// @param seq Bioseq to edit
@@ -607,6 +606,9 @@ public:
 
     static void AutodefId(CSeq_entry_Handle seh);
 
+    // for finding the correct amino acid letter given an abbreviation
+    static char ValidAminoAcid(string_view abbrev);
+
 private:
     CRef<CScope>            m_Scope;
 
index c2be70a11f82a4a9d24098f5f7e969727ba5dceb..b423a333a3e3f2a455eec034cf65887bdfb74d9e 100644 (file)
@@ -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<EChanges>    GetAllChanges() const;
-    NCBI_DEPRECATED vector<string> GetAllDescriptions() const;
     vector<string_view> 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 (file)
index 05501db..0000000
+++ /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 <corelib/ncbistd.hpp>
-#include <corelib/ncbiobj.hpp>
-#include <objtools/edit/huge_asn_reader.hpp>
-#include <objtools/edit/huge_file_process.hpp>
-#include <objtools/cleanup/cleanup_change.hpp>
-#include <objects/general/Object_id.hpp>
-#include <objects/seqfeat/Feat_id.hpp>
-
-#include <map>
-#include <set>
-
-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<CSeq_entry> 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<size_t>& segsFound);
-
-    void x_CleanupTopLevelDescriptors();
-    bool x_LooksLikeNucProtSet() const;
-    void x_AddTopLevelDescriptors(CSeq_entry& entry) const;
-    list<CRef<CSeqdesc>> m_TopLevelBiosources;
-    CRef<CSeqdesc> m_pTopLevelMolInfo;
-    const TOptions m_CleanupOptions;
-    mutable CCleanupChangeCore m_Changes;
-    using TIdToFluLabel = map<CConstRef<CSeq_id>,string,CRefLess>;
-    TIdToFluLabel m_IdToFluLabel;  
-    TIdToFluLabel::iterator x_GetFluLabel(const CConstRef<CSeq_id>& pId);
-    map<string, list<TBioseqSetInfo>> m_FluLabelToSetInfo;
-    map<TFileSize, string> m_SetPosToFluLabel;
-    set<CConstRef<CSeq_id>, CRefLess> m_HasIncompleteFeats;
-    
-    
-    struct TFeatIdInfo {
-        using TFeatIdMap = map<TFeatId, TFeatId>;
-        using TPosToFeatIds = map<CHugeAsnReader::TStreamPos, TFeatIdMap>;
-
-        set<TFeatId>  ExistingIds;
-        set<TFeatId>  NewIds;
-        set<TFeatId>  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++/include/objtools/cleanup/influenza_set.hpp b/c++/include/objtools/cleanup/influenza_set.hpp
new file mode 100644 (file)
index 0000000..f221307
--- /dev/null
@@ -0,0 +1,77 @@
+#ifndef _INFLUENZA_SET_HPP_
+#define _INFLUENZA_SET_HPP_
+
+/* $Id: influenza_set.hpp 680750 2024-03-27 13:48:22Z 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:
+ *
+ * ===========================================================================
+ */
+
+#include <corelib/ncbistd.hpp>
+#include <objmgr/bioseq_handle.hpp>
+
+BEGIN_NCBI_SCOPE
+BEGIN_SCOPE(objects)
+
+class NCBI_CLEANUP_EXPORT CInfluenzaSet : public CObject {
+public:
+    CInfluenzaSet(const string& key);
+    ~CInfluenzaSet() {}
+
+    static string GetKey(const COrg_ref& org);
+    bool OkToMakeSet() const;
+    void MakeSet();
+
+    typedef enum {
+        eNotInfluenza = 0,
+        eInfluenzaA,
+        eInfluenzaB,
+        eInfluenzaC,
+        eInfluenzaD
+    } EInfluenzaType;
+
+    static EInfluenzaType GetInfluenzaType(const string& taxname);
+    static size_t GetNumRequired(EInfluenzaType fluType);
+
+    void AddBioseq(CBioseq_Handle bsh);
+
+protected:
+    typedef vector<CBioseq_Handle> TMembers;
+    TMembers m_Members;
+    const string m_Key;
+    EInfluenzaType m_FluType;
+    size_t m_Required;
+};
+
+bool NCBI_CLEANUP_EXPORT g_FindSegs(const CBioSource& src, size_t numRequired, set<size_t>& segsFound);
+
+END_SCOPE(objects)
+END_NCBI_SCOPE
+
+#endif // _INFLUENZA_SET_HPP_
index 3dbc870f222036cd1dc06c18e08560d34d6e153e..5e82523f3d99ce2eeaafa9b61fe493c1568badca 100644 (file)
@@ -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<CReader> 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<bool> m_EnableSNP;
+    CNullable<bool> m_EnableWGS;
+    CNullable<bool> m_EnableCDD;
 
     friend class CGBDataLoader_Native;
-    unique_ptr<CReaderParams> 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 TDataLoader>
+        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<CGBDataLoader> 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;
 
index 47ce9769d0d2e5e75d4c6f59575bab20ee3dc402..00ff8a561d5626f62897dff0a4ab57b4041b7022 100644 (file)
@@ -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<CGBDataLoader_Native, const CGBLoaderParams&> TGBMaker;
-    friend class CParamLoaderMaker<CGBDataLoader_Native, const CGBLoaderParams&>;
+    friend class CGBLoaderMaker<CGBDataLoader_Native>;
 
     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<string, string> 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<CReader> TReaderManager;
index 16106874789d850364dc6025f3e0302db613e593..09c3c3fa23c962c8c0fd708d6e761625cf6fa460 100644 (file)
@@ -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<CReader>    reader);
     void InsertWriter   (TLevel       level,  CRef<CWriter>    writer);
     void InsertProcessor(CRef<CProcessor> processor);
+    bool HasReaderWithHUPIncluded() const;
 
     CWriter* GetWriter(const CReaderRequestResult& result,
                        CWriter::EType type) const;
index a94b63dc4236822bbc977abdffee58092ba4565c..da241aa07bcbcafbfc6a19e7502ad2e9097ffbd5 100644 (file)
@@ -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<CPSG_Queue> m_Queue;
+    CRef<CRequestContext> m_RequestContext;
     unique_ptr<CPSGBlobMap> m_BlobMap;
     unique_ptr<CPSGIpgTaxIdMap> m_IpgTaxIdMap;
     unique_ptr<CPSGBioseqCache> m_BioseqCache;
index d1c8859d4af698bc83e527d9c16fc62963b4b43c..a20e157a921b4b857bdf0d2de0b96c2002d99879 100644 (file)
@@ -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<CPSGDataLoader, CGBLoaderParams> TMaker;
-    friend class CParamLoaderMaker<CPSGDataLoader, CGBLoaderParams>;
+    friend class CGBLoaderMaker<CPSGDataLoader>;
 
     TRealBlobId x_GetRealBlobId(const TBlobId& blob_id) const override;
 
-    static TRegisterLoaderInfo ConvertRegInfo(const TMaker::TRegisterInfo& info);
-
     // default constructor
     CPSGDataLoader(void);
     // parametrized constructor
index 447111168b089642d809bc59eb835c12f9ea2eb3..b3627c677371e09e2c093a7fac01404964b075dd 100644 (file)
@@ -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<bool> 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<bool> 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<bool> 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;
index 340ec811c869eec8a33207d5b874321991b1512d..b65c4f7d7c231080a43bd506fc6ed04dcddc634a 100644 (file)
+/* $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 <objtools/eutils/api/eutils.hpp>
-#include <objtools/edit/pubmed_updater.hpp>
+#include <corelib/ncbiobj.hpp>
 
 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<void(CRef<CPub>&)>;
+
+class NCBI_XOBJEDIT_EXPORT CEUtilsUpdater
 {
 public:
-    CEUtilsUpdaterBase(bool bNorm);
-    TEntrezId  CitMatch(const CPub&, EPubmedError* = nullptr) override;
-    TEntrezId  CitMatch(const SCitMatch&, EPubmedError* = nullptr) override;
-    CRef<CPub> 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<CPub> GetPubmedEntry(TEntrezId pmid, EPubmedError* = nullptr);
+    CRef<CPub> 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<string>& query, std::vector<TEntrezId>& pmids);
 
-private:
+protected:
+    CRef<CPubmed_entry> x_GetPubmedEntry(TEntrezId pmid, EPubmedError*);
+    CRef<CPub>          x_GetPub(TEntrezId pmid, EPubmedError*);
+
+protected:
     CRef<CEUtils_ConnContext> m_Ctx;
-    bool                      m_bNorm;
+    ENormalize                m_Norm;
+    TPubInterceptor           m_pub_interceptor = nullptr;
 };
 
-class NCBI_XOBJEDIT_EXPORT CEUtilsUpdaterWithCache : public CEUtilsUpdaterBase
-{
-    CRef<CPub> 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<CPub> GetPubmedEntry(TEntrezId pmid, EPubmedError* = nullptr) override;
+
     void ReportStats(std::ostream&);
     void ClearCache();
 
 private:
     map<TEntrezId, CConstRef<CPub>> 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<CPub> GetPub(TEntrezId pmid, EPubmedError* = nullptr) override;
+    size_t m_num_requests = 0;
+    size_t m_cache_hits   = 0;
 };
 
 END_SCOPE(edit)
index 868bf89339a673218979064b7110886c599b9c07..368a0140595bba2a32711ec9f3870bc487645774 100644 (file)
@@ -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<CScope> mpScope;
index 4110d7e61127289c50eb3f23801509d927bc147e..bf8c21bb766339b3f59b39797fdb9ab0a8d40b99 100644 (file)
@@ -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 <corelib/ncbistd.hpp>
-#include <objmgr/data_loader.hpp>
-
-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<CHugeAsnDataLoader> 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 <objtools/huge_asn/huge_asn_loader.hpp>
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 (file)
index 34af29c..0000000
+++ /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 <corelib/ncbistd.hpp>
-#include <objtools/edit/huge_asn_reader.hpp>
-
-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_
-
-
index 8cb57f26e81c825b6246deaf7ac79a5e5715e5f6..d82f668725ff2d8749a1d8694e7f55c101e8cd1e 100644 (file)
@@ -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 <corelib/ncbistd.hpp>
-#include <corelib/ncbiutil.hpp>
-#include <objects/seqset/Seq_entry.hpp>
-#include <objects/seqset/Bioseq_set.hpp>
-#include <objects/seq/Seq_descr.hpp>
-#include <objects/submit/Submit_block.hpp>
-#include <objects/seqloc/Seq_id.hpp>
-#include <objects/seq/Seq_inst.hpp>
-#include <objects/seq/Seqdesc.hpp>
-#include <objtools/edit/huge_file.hpp>
-#include <optional>
-
-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<CSeq_entry> GetNextSeqEntry() override;
-    CConstRef<CSubmit_block> GetSubmitBlock() const override;
-    CRef<CSerialObject> ReadAny();
-
-    struct TBioseqInfo;
-    struct TBioseqSetInfo;
-    using TBioseqSetList = std::list<TBioseqSetInfo>;
-    using TBioseqList  = std::list<TBioseqInfo>;
-
-    struct TBioseqInfo
-    {
-        TFileSize m_pos;
-        TBioseqSetList::const_iterator m_parent_set;
-        TSeqPos   m_length  = -1;
-        CConstRef<CSeq_descr> m_descr;
-        std::list<CConstRef<CSeq_id>> 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<CSeq_descr> m_descr;
-        bool m_HasAnnot{false};
-        optional<int> m_Level;
-    };
-
-    using CRefLess = PPtrLess<CConstRef<CSeq_id>>;
-
-    using TBioseqIndex = std::map<CConstRef<CSeq_id>, TBioseqList::const_iterator, CRefLess>;
-    using TBioseqSetIndex = std::map<CConstRef<CSeq_id>, 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<CSeq_id> seqid) const;
-
-    enum class eAddTopEntry{ yes, no };
-    virtual CRef<CSeq_entry> LoadSeqEntry(const TBioseqSetInfo& info, eAddTopEntry add_top_entry = eAddTopEntry::yes) const;
-
-    const TBioseqInfo* FindBioseq(CConstRef<CSeq_id> seqid) const;
-    CConstRef<CSeqdesc> GetClosestDescriptor(const TBioseqInfo& info, CSeqdesc::E_Choice choice) const;
-    CConstRef<CSeqdesc> GetClosestDescriptor(const CSeq_id& id, CSeqdesc::E_Choice choice) const;
-
-    // Direct loading methods
-    CRef<CSeq_entry> LoadSeqEntry(CConstRef<CSeq_id> seqid) const;
-    CRef<CBioseq> LoadBioseq(CConstRef<CSeq_id> 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<CObjectIStream> MakeObjStream(TFileSize pos) const;
-
-    const CBioseq_set::TClass* GetTopLevelClass() const;
-protected:
-    // temporary structure for indexing
-    struct TBioseqInfoRec
-    {
-        list<CConstRef<CSeq_id>> m_ids;
-        TSeqPos          m_length  = 0;
-        CRef<CSeq_descr> 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<TBioseqInfoRec> bioseq_stack;
-        std::deque<TBioseqSetList::iterator> 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<CSeq_descr> 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<CSeq_entry>                m_top_entry;
-    std::list<CConstRef<CSeq_id>>   m_top_ids;
-    bool m_HasHugeSetAnnot{ false };
-private:
-    CConstRef<CSubmit_block>  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 <objtools/huge_asn/huge_asn_reader.hpp>
index 78983af19e04ea33f78e1e0b5d27dc617173ea19..5a5e87115d9626514669fef06669ca997eed33e8 100644 (file)
@@ -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 <corelib/ncbistd.hpp>
-#include <corelib/ncbiobj.hpp>
-#include <serial/serialdef.hpp>
-#include <util/format_guess.hpp>
-
-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<TTypeInfo>*           m_supported_types = nullptr;
-
-    std::unique_ptr<CMemoryFile>    m_memfile;
-    std::unique_ptr<std::istream>   m_stream;
-    std::unique_ptr<std::streambuf> 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<TTypeInfo>* supported_types);
-    bool IsOpen() const { return m_filesize != 0; }
-    TTypeInfo RecognizeContent(std::streampos pos);
-    TTypeInfo RecognizeContent(std::istream& istr);
-    unique_ptr<CObjectIStream> 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<CSeq_entry> GetNextSeqEntry() = 0;
-    virtual bool IsMultiSequence() const = 0;
-    virtual CConstRef<CSubmit_block> GetSubmitBlock() const = 0;
-    virtual ~IHugeAsnSource(){};
-protected:
-    IHugeAsnSource(){};
-};
-
-END_SCOPE(edit)
-END_SCOPE(objects)
-END_NCBI_SCOPE
-
-#endif // _HUGE_ASN_READER_HPP_INCLUDED_
+#include <objtools/huge_asn/huge_file.hpp>
index f3ed8047382083f51626f853cab0bd6c1c637d54..6f2c1fd19f8945266b7ca8e2742f09f8bbcb3acb 100644 (file)
@@ -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 <corelib/ncbistd.hpp>
-#include <corelib/ncbiobj.hpp>
-#include <serial/serialdef.hpp>
-
-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<TTypeInfo> g_supported_types;
-
-    /// constructors
-    CHugeFileProcess();
-    CHugeFileProcess(CHugeAsnReader* pReader);
-    CHugeFileProcess(const string& file_name, const set<TTypeInfo>* types = &g_supported_types);
-    /// destructor
-    virtual ~CHugeFileProcess(void);
-    void Open(const string& file_name, const set<TTypeInfo>* types = &g_supported_types);
-    void OpenFile(const string& file_name);
-    void OpenFile(const string& file_name, const set<TTypeInfo>* types);
-    void OpenReader();
-
-    using THandler    = std::function<void(CConstRef<CSubmit_block>, CRef<CSeq_entry>)>;
-    using THandlerIds = std::function<bool(CHugeAsnReader*, const std::list<CConstRef<CSeq_id>>&)>;
-    using THandlerBlobs   = std::function<bool(CHugeFileProcess&)>;
-    using THandlerEntries = std::function<bool(CSeq_entry_Handle& seh)>;
-
-    [[nodiscard]] bool Read(THandler handler, CRef<CSeq_id> seqid);
-    [[nodiscard]] bool Read(THandlerIds handler);
-    [[nodiscard]] bool ForEachBlob(THandlerBlobs);
-    [[nodiscard]] bool ForEachEntry(CRef<CScope> 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<CHugeFile> m_pHugeFile;
-    unique_ptr<CHugeAsnReader> 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 <objtools/huge_asn/huge_file_process.hpp>
index 811e98b3b0ad0cbbddb245848a772f4dd08ecdc3..8df269c3e2b60998c0b70069067b77a611792e9c 100644 (file)
@@ -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 <corelib/ncbistd.hpp>
 #include <corelib/ncbiobj.hpp>
 
-#include <objtools/edit/pubmed_updater.hpp>
+#include <objtools/edit/eutils_updater.hpp>
 
 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<CCit_art> FetchPubPmId(TEntrezId pmid, IPubmedUpdater*);
+    static CRef<CCit_art> 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)
index 0f7e63a4bc502469b0613de650955969713f6272..b29b689d45f971d6ef9d87ba8660b55aede69a0c 100644 (file)
@@ -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 <corelib/ncbiobj.hpp>
-
-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<void(CRef<CPub>&)>;
-
-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<CPub> 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("<pubmed_updater.hpp> is obsolete. Use <eutils_updater.hpp> instead!")
+#include "eutils_updater.hpp"
index 57791f40a439ecb83a1396d48f24a2bdae82ddce..2c0a73d106853f900229d19666b075a69619e05b 100755 (executable)
@@ -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 <corelib/ncbimisc.hpp>
 #include <functional>
+#include <objects/pub/Pub.hpp>
 #include <objtools/edit/edit_error.hpp>
-#include <objtools/edit/pubmed_updater.hpp>
+#include <objtools/edit/eutils_updater.hpp>
 #include <objects/taxon3/itaxon3.hpp>
 #include <mutex>
 
@@ -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<CTaxon3_reply> SendOrgRefList(const vector<CRef<COrg_ref>>& 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<CTaxon3_reply> SendOrgRefList(const vector<CRef<COrg_ref>>& 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<CRef<CPub>>& 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<IPubmedUpdater> m_pubmed;
+    unique_ptr<CEUtilsUpdater> 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<CCachedTaxon3_impl> m_taxClient;
     taxupdate_func_t m_taxon_update;
index e3a16500883143c111c2aa78b129c0f2ab7eefbb..9affcb352ae0ea94128d532b597ef2d84a0dc0b3 100644 (file)
@@ -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
index 0617b2892235012e8ef752e97b3e8edee313dc33..b1249a3d2360290f85479018ce39bac5ebec7f8d 100644 (file)
@@ -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
index 88498d18909db1db6eaa7cd50639d3b9e8f479e2..222069867de5f75b43cda8700d71b602b7399b26 100644 (file)
@@ -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);
 
index 96e17ea3ee0db3b2b8085ce9c53c343b9120477c..6ac3e016b908a5962ea09e595c41bf1ade40217b 100644 (file)
@@ -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<TFlags>;
+
     /// Get the user-provided context
     template<typename TUserContext>
     shared_ptr<TUserContext> 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&param1=value2&param2=value3");
@@ -149,6 +160,7 @@ private:
 
     shared_ptr<void> m_UserContext;
     CRef<CRequestContext> 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&param1=value2&param2=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
index 1592264968ed40f9226e6b68083c0ea685010d27..8442f486c55939c26d021a37929c8b82126d0e1c 100644 (file)
@@ -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
index d950e004e0d418e239c6667bc582223ff4cc363c..a10f0f8601d9ba0da051b7be98fdee1c6b7e27cd 100644 (file)
@@ -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:
index f465625a0a11b4289b3e327ef08f2bc45ec365cf..44da7142f0df3fbc8486d8a7029fef037f27aefd 100644 (file)
@@ -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
 *   Exceptions for CFastaReader.
 */
 
-#include <objtools/readers/reader_exception.hpp>
-#include <objects/seqloc/Seq_id.hpp>
+#include <corelib/ncbiexpt.hpp>
+#include <corelib/ncbiobj.hpp>
 
 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;
 };
index 3123bafcfe3cffc57442dbcc3156b88f98860410..adf147f8dc37636149ea092d74b319743f8edcbe 100644 (file)
@@ -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
 
 #include <corelib/ncbistd.hpp>
 #include <objtools/readers/gff2_reader.hpp>
+#include <set>
+#include <map>
 
 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<string>;
+  //  using MultiValue = vector<string>;
+    using MultiValue = set<string>;
+
     using MultiAttributes = map<string, MultiValue>;
 
     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<string>& 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<CSeq_feat> xFindFeatById(
         const string&);
 
@@ -287,6 +363,13 @@ protected:
         CSeq_feat&) override;
 
     unique_ptr<CGtfLocationMerger> mpLocations;
+
+private:
+    using TChildQualMap = map<string, CGtfAttributes>;
+    using TParentChildQualMap = map<string, TChildQualMap>;
+
+    map<string, string> m_TranscriptToGeneMap;
+    TParentChildQualMap m_ParentChildQualMap;
 };
 
 END_SCOPE(objects)
index fd8246fd5e8a791c3653cc0a24fd694de7881eb4..42da907fe307937234ae05578c30d1a3975eb68e 100644 (file)
@@ -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
 #include <corelib/ncbistd.hpp>
 #include <corelib/ncbimisc.hpp>
 #include <corelib/ncbiobj.hpp>
-//#include <corelib/ncbi_message.hpp>
-#include<objtools/logging/message.hpp>
+#include <objtools/logging/message.hpp>
 #include <objtools/readers/reader_exception.hpp>
-
+#include <serial/serialbase.hpp>
 
 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<unsigned int> 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 << "<message severity=\"" << NStr::XmlEncode(SeverityStr()) << "\" "
-            << "problem=\"" << NStr::XmlEncode(ProblemStr()) << "\" ";
-        if (GetCode()) {
-            string code = NStr::IntToString(GetCode());
-            if (GetSubCode()) {
-                code += "." + NStr::IntToString(GetSubCode());
-            }
-            out << "code=\"" << NStr::XmlEncode(code) << "\" ";
-        }
-        const string & seqid = SeqId();
-        if (!seqid.empty()) {
-            out << "seqid=\"" << NStr::XmlEncode(seqid) << "\" ";
-        }
-        out << "line=\"" << Line() << "\" ";
-        const string & feature = FeatureName();
-        if (!feature.empty()) {
-            out << "feature_name=\"" << NStr::XmlEncode(feature) << "\" ";
-        }
-        const string & qualname = QualifierName();
-        if (!qualname.empty()) {
-            out << "qualifier_name=\"" << NStr::XmlEncode(qualname) << "\" ";
-        }
-        const string & qualval = QualifierValue();
-        if (!qualval.empty()) {
-            out << "qualifier_value=\"" << NStr::XmlEncode(qualval) << "\" ";
-        }
-        out << ">";
-
-        // child nodes
-        ITERATE(TVecOfLines, line_it, OtherLines()) {
-            out << "<other_line>" << *line_it << "</other_line>";
-        }
-
-        out << "</message>" << 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 ILineErrorClone(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::stringErrorMessage(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 ILineErrorClone(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::stringErrorMessage(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::stringSeqId(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::stringFeatureName(void) const { return m_strFeatureName; }
+    const std::stringQualifierName(void) const { return m_strQualifierName; }
+    const std::stringQualifierValue(void) const { return m_strQualifierValue; }
 
-    const std::string &ErrorMessage(void) const { return m_strErrorMessage; }
+    const std::stringErrorMessage(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<CSerialObject> 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<CSerialObject> 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<CSerialObject> 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);
 };
 
 
index 5759af465fbdaf970c7d78332999ca3cc5f0224e..9a62b9e5f8747d940613a553d919864564509919 100644 (file)
@@ -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<const ILineError*>(&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<ILineError> > TLineErrVec;
+    // typedef std::vector< unique_ptr<ILineError> > TLineErrVec;
 
-    using TLineErrVec = vector<AutoPtr<IObjtoolsMessage>>;
+    using TLineErrVec = vector<unique_ptr<IObjtoolsMessage>>;
     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<CNcbiOstream> m_progressOstrmDestroyer;
+    unique_ptr<CNcbiOstream> 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<IObjtoolsMessage*>(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 <<count>> 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;
 };
index a2e1a4fa0607b0850bee8935a39241f2f01eb0e9..5d8fa342cf172ad378a8e57c221b0103b3a36425 100644 (file)
@@ -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(
index f36670374ad66a32397b84ed994286759a937c60..74671df324632bb05c43f48b4be2318e0cff7015 100644 (file)
@@ -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;
 };
index 4a24b82d6aa00f2054d9d5a283b2e296a0b7bf1d..547b1085e2689d178bc68d0d224da1269f060d7c 100644 (file)
@@ -4247,6 +4247,9 @@ void bvector<Alloc>::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<Alloc>::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<Alloc>::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
     }
 }
 
index c1e338dfcb3f06c460df31562175410f7c5b2b8a..efa2c446a9449013739015ec68802918aa00e72b 100644 (file)
@@ -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
     */
index 97f2d811e468398d25134a47db5b67b3ee0ee8dd..60ab7adf569f078b8b07adcc686e9ff4f7460cc0 100644 (file)
@@ -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<BV>& 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<typename BV>
 basic_bmatrix<BV>::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<typename BV>
 basic_bmatrix<BV>::basic_bmatrix(const basic_bmatrix<BV>& 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<typename BV>
 basic_bmatrix<BV>::basic_bmatrix(basic_bmatrix<BV>&& 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<BV>::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<BV>::free_rows() BMNOEXCEPT
 
 //---------------------------------------------------------------------
 
+template<typename BV>
+bool basic_bmatrix<BV>::is_same_structure(
+                        const basic_bmatrix<BV>& 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<typename BV>
 void basic_bmatrix<BV>::set_allocator_pool(allocator_pool_type* pool_ptr) BMNOEXCEPT
 {
@@ -1026,8 +1054,11 @@ template<typename BV>
 typename basic_bmatrix<BV>::bvector_type_ptr
 basic_bmatrix<BV>::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<BV>::optimize_block(block_idx_type nb,
 
 template<class Val, class BV, unsigned MAX_SIZE>
 base_sparse_vector<Val, BV, MAX_SIZE>::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<Val, BV, MAX_SIZE>::base_sparse_vector()
 template<class Val, class BV, unsigned MAX_SIZE>
 base_sparse_vector<Val, BV, MAX_SIZE>::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)
     {
index 4268492690bcbdc59ae193604068ede971e63b98..290a9ae6c55879caf94ecbebe461895c9da4d6a2 100644 (file)
@@ -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_; }
index b0459e2d7835988b28df9779ff3d676adf7370ad..8d2b311b5c1bc9da8efbe17ec611dfba9532625a 100644 (file)
@@ -244,10 +244,10 @@ template<bool T> struct _copyright
 
 #define BM_VERSION_MAJOR 7
 #define BM_VERSION_MINOR 13
-#define BM_VERSION_PATCH 3
+#define BM_VERSION_PATCH 4
 
 template<bool T> const char _copyright<T>::_p[] = 
-    "BitMagic Library. v.7.13.3 (c) 2002-2022 Anatoliy Kuznetsov.";
+    "BitMagic Library. v.7.13.4 (c) 2002-2022 Anatoliy Kuznetsov.";
 template<bool T> const unsigned _copyright<T>::_v[3] =
                     { BM_VERSION_MAJOR, BM_VERSION_MINOR, BM_VERSION_PATCH };
 
index 30ead163871138dc41ed01fd0b3f2faf9539acb7..32c059759ad334e25835a3d5f649e889519a4449 100644 (file)
@@ -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<BV, DEC>::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<BV, DEC>::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<BV, DEC>::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);
 
 }
 // ---------------------------------------------------------------------------
index 6deef2f9e51fb70ac436b754a2c538c6b9c343a8..5d46303f44c289cebfd297399543f2c45323ddcf 100644 (file)
@@ -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<class V, class SV> friend class rsc_sparse_vector;
     template<class SVect, unsigned S_FACTOR> friend class sparse_vector_scanner;
@@ -1092,7 +1102,7 @@ sparse_vector<Val, BV>::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<Val, BV>::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<Val, BV>::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<Val, BV>::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<Val, BV>::get_unsigned(
     return uv;
 }
 
+//---------------------------------------------------------------------
+
+template<class Val, class BV>
+typename sparse_vector<Val, BV>::unsigned_value_type
+sparse_vector<Val, BV>::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<class Val, class BV>
@@ -2061,7 +2098,7 @@ void sparse_vector<Val, BV>::inc_no_null(size_type idx, value_type v)
 //---------------------------------------------------------------------
 
 template<class Val, class BV>
-void sparse_vector<Val, BV>::clear_all(bool free_mem) BMNOEXCEPT
+void sparse_vector<Val, BV>::clear_all(bool free_mem, unsigned) BMNOEXCEPT
 {
     parent_type::clear_all(free_mem);
 }
index a2d2f52c42096f2fdc388871d8508ae0a8078c7b..796adf34f5c4f079410866730c8afae198470519 100644 (file)
@@ -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<Val, SV>::load_from(
     }
     else
     {
-        sv_.clear_all(true);
+        sv_.clear_all(true, 0);
         *bv_null = *bv_null_src;
         
         bm::rank_compressor<bvector_type> rank_compr; // re-used for planes
@@ -1397,7 +1409,7 @@ void rsc_sparse_vector<Val, SV>::load_from(
 template<class Val, class SV>
 void rsc_sparse_vector<Val, SV>::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<Val, SV>::get(size_type idx) const BMNOEXCEPT
 
 //---------------------------------------------------------------------
 
+template<class Val, class SV>
+typename rsc_sparse_vector<Val, SV>::unsigned_value_type
+rsc_sparse_vector<Val, SV>::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<class Val, class SV>
 bool rsc_sparse_vector<Val, SV>::try_get(
                         size_type idx, value_type& v) const BMNOEXCEPT
@@ -1633,9 +1660,9 @@ void rsc_sparse_vector<Val, SV>::optimize(bm::word_t*  temp_block,
 //---------------------------------------------------------------------
 
 template<class Val, class SV>
-void rsc_sparse_vector<Val, SV>::clear_all(bool free_mem) BMNOEXCEPT
+void rsc_sparse_vector<Val, SV>::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<Val, SV>::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;
index ec960285ea44eea000de86e19c661f358111d94f..407b4b4eba27cc91cc3bf949e791617624e8b414 100644 (file)
@@ -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<typename BV>
@@ -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<BV>& sim_model,
                     const bv_ref_vector_type& ref_vect,
index 4cc393b877ade7d285ee18408e2ffa3c324420c0..81611fdd252f9010b4f12d8168556b9d4c9c25f2 100644 (file)
@@ -1223,6 +1223,8 @@ void sparse_vector_deserializer<SV>::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<SV>::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<SV>::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<SV>::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<SV>::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));
index fd70bccdde6c40d0e68b10e482e093e29c8f87af..369e04028367dcbd55181cccbccc429ec52fbf4c 100644 (file)
@@ -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
index 92db824ca8632ce59bbd5b74b17a631b73329d38..39180f0359ae1c72f4971bc6585335b9bcf5446d 100644 (file)
@@ -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<CharType, BV, STR_SIZE>::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<CharType, BV, STR_SIZE>::str_sparse_vector(
 template<class CharType, class BV, unsigned STR_SIZE>
 str_sparse_vector<CharType, BV, STR_SIZE>::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<CharType, BV, STR_SIZE>::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<CharType, BV, STR_SIZE>::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<CharType, BV, STR_SIZE>::begin() const BMNOEXCEPT
 
 template<class CharType, class BV, unsigned STR_SIZE>
 void str_sparse_vector<CharType, BV, STR_SIZE>::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();
+    }
 }
 
 //---------------------------------------------------------------------
index 6d2274f28d898611acbcafc347604a30ce30d964..20d3b9957504e6574af0c600e0617afff4fb6da9 100644 (file)
@@ -1473,7 +1473,8 @@ void bit_in<TDecoder>::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<TDecoder>::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<TDecoder>::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<TDecoder>::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<TDecoder>::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<TDecoder>::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<TDecoder>::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<TDecoder>::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<TDecoder>::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<TDecoder>::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<TDecoder>::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<TDecoder>::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<TDecoder>::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<TDecoder>::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<class TDecoder>
 unsigned bit_in<TDecoder>::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;
 }
 
index 08bb21475b7b3cf89d01314ca77bee6c7f5cae14..18e2079eaa7f031825f21937147dbed28bb20bf0 100644 (file)
@@ -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&);
index 643bdb791f8dc3f94b494759fbbce814d32e5378..ea7ffc6d44518212a2943ef273d75e95ac81b13d 100755 (executable)
@@ -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
index aa0a8bb087d929f674535655326cf449ab79d6ba..478d41a3117360cdae886dd5d8f48e30c6ff07bb 100755 (executable)
@@ -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
index 674d6c43535f99ef4b5849de451ad9c944dd3897..ca3272ceee35a8a97e0b4027b2f2aea4bfd5191f 100755 (executable)
@@ -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
index b960f15c072392b867d81a40c654673eadc98b26..037ac86af722d0f9aa976a6090f7a671cf38b71e 100755 (executable)
@@ -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   
index b1f5c9a369a5418fd02265f651d1ff9dead9b4c3..cdb5859fbf91298cd4f12cd70e9800daa546c926 100755 (executable)
@@ -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
index fa102ec261000905dfe34baf5630a08604428e05..aac2e676dc8c030832480cb3a2f6bb369a5a1862 100755 (executable)
@@ -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 (executable)
index 0000000..7366688
--- /dev/null
@@ -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 <output_file> <command line to run>
+#
+# 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` <output_file> <command line to run>"
+   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
index 956d8ef524bd96122894ecc69ede368edeab7e6f..b24ced66e33216ce3ff172443e89d8e659ca268b 100755 (executable)
@@ -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`
index 8750cf1f2c0b7c99788e02f97bdd54e1fdb598f5..74f4b585dbe3c5c19e5fee6c0b90a3235376100d 100644 (file)
@@ -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:
index ba86a2ca3027e15d1aae9bd8f1e6503ef9272dbb..ff0f4d07cc0cec4796d830e8b59867a08229a595 100755 (executable)
@@ -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 " "
index e2141c5db3e44fbf416d22e4abfde91e752e49f8..f4b9b8f344e2be0dec62c821239533648692a78b 100644 (file)
@@ -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  <ENV>OPENMP_FLAGS='-qopenmp -qopenmp-link=static';LDFLAGS=-Wl,--as-needed</ENV>
 
 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 <ENV>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 <ENV>CC='clang -arch x86_64';CXX='clang++ -arch x86_64'</ENV>
+
 USE_COMPONENTS
index e0f02d14fc86df125ff5a86ff59e7792837b9658..bc7f0910752e21ec75d42c3adae73d82213803af 100644 (file)
@@ -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 (executable)
index 0000000..59123bb
--- /dev/null
@@ -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
+
index 04582183c4ac790aea6fdd39b9af0db6efbecc46..e96532cca480870e7250c8e23c1662f3a1cd60ce 100755 (executable)
@@ -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
 }
index 8cc32afa43e9bc954334782465a0d9366cb995fc..ee1916273ecb6b1d94557baa4ce4bce96053200f 100644 (file)
Binary files a/c++/scripts/projects/blast/post_build/macosx/uninstall_ncbi_blast.zip and b/c++/scripts/projects/blast/post_build/macosx/uninstall_ncbi_blast.zip differ
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 (executable)
index 0000000..e15ea33
--- /dev/null
@@ -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 (file)
index 0000000..0c3f43b
--- /dev/null
@@ -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
index aa2b32218394ab48dd7fb0d1bb03f711f278d3db..ec7134414d9848a106ffe034af42a59d025879c1 100755 (executable)
@@ -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)
index 83b0290f4d2ffca4d6fc7ee4a02f07bcc6d69aaa..33578706489e1031ddf5803c98c2430c62bc999a 100644 (file)
@@ -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
index cf98b9c32e5cfb1f3915b7737e039db2b0a7bb69..9392983c6a15f4273b0d33c2b25b8dbdd7be8162 100644 (file)
@@ -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$
index 2209bef518f7668879a7f47f1089802bfa13ad5f..70af361ad5f7fe2adb0e0a442dd98d5792c69af2 100644 (file)
@@ -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)
index e18ac8d250e0d675db35955143970a1e8d600766..198fb549d83bd51a8efe8769b43699c88a012ec5 100755 (executable)
@@ -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)
index 20bc5bf57e2ce36a114e4ae9904c4cfd70f552af..20f8b93506a6aa8ada878be5e31e58968296c32b 100644 (file)
@@ -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.
index fc12e94ef785cbaf0b54c6146657a88f2d8d5a6c..6615caed9eed5ee799cbb8b56e20fb0b5c575def 100644 (file)
@@ -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
 
index af651d61d70d43f47afa64200f8245f035e3425f..e3ffcdf31b205530b0fdd0885dadf0651f8479d1 100644 (file)
@@ -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 (file)
index e69de29..0000000
diff --git a/c++/scripts/projects/dispatcher/LICENSE b/c++/scripts/projects/dispatcher/LICENSE
deleted file mode 100644 (file)
index f3577c2..0000000
+++ /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 (file)
index c3e726f..0000000
+++ /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:
-# <HardwareIdentifier> : <ReleaseSuffix> : <CompilerConfigurationScriptWithKeys>
-# 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 (file)
index 6f00861..0000000
+++ /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 (file)
index f21a40e..0000000
+++ /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 (file)
index 2d08cc9..0000000
+++ /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 (file)
index f3577c2..0000000
+++ /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 (file)
index 92c5c8f..0000000
+++ /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 (file)
index f9994e3..0000000
+++ /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 (file)
index 0264715..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#define TAGS fwdaemon
-./include/corelib$
-./include/util$
-connect$
-connect/ext$
-connect/daemons$
index 090c2d6d0ffccf8739134f6d9c2a06cae6134896..0db632c9a5486117f594d137794ce73041e99e49 100644 (file)
@@ -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 <ENV>CC='clang -arch x86_64';CXX='clang++ -arch x86_64'</ENV>
+
 USE_COMPONENTS
index ef9940df955ccb936a18850c6bd79407c355efc1..de049630e9e39e197dca10a289465f368b9a3e5b 100644 (file)
@@ -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)
index df499aad0c656bf48f4f563cb9940c62ae3a9810..70be0a37736d1a485f58a2d541c7aeb347c6d8ce 100755 (executable)
@@ -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)
index 35677fe99e16a79197065f2ca999a05883b10be3..c72871e7dc2f19d464e449058775d1e80cfbc4e9 100644 (file)
@@ -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 (file)
index 81504bf..0000000
+++ /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 (file)
index f3577c2..0000000
+++ /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 (file)
index 66e10c4..0000000
+++ /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 (file)
index e69de29..0000000
diff --git a/c++/scripts/projects/lbsbd/project.lst b/c++/scripts/projects/lbsbd/project.lst
deleted file mode 100644 (file)
index cc33621..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-corelib$
-util$
-connect$
-connect/ext$
-connect/daemons$
index 9a9928438fcdad417edfb09fa8aae01a10e28c6d..4a900641011b139fbaa9ab8473cda9b9be1bccab 100644 (file)
@@ -45,6 +45,10 @@ Win64         : plain : static  64  ReleaseDLL <ENV>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 <ENV>CC='clang -arch x86_64';CXX='clang++ -arch x86_64'</ENV>
 
 USE_COMPONENTS
index 2209bef518f7668879a7f47f1089802bfa13ad5f..70af361ad5f7fe2adb0e0a442dd98d5792c69af2 100644 (file)
@@ -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)
index a0beffc9d8c47cc55604577ce1983661b8b60f49..f6bab6359322c82f24bb9ea1e1da293463874ce9 100755 (executable)
@@ -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)
index 541a9594c23b058e9f6cdb0165bebe887ad956c0..d6029d373b0436b867cc924bed95d0aabb89ed9f 100644 (file)
@@ -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 (file)
index cf92523..0000000
+++ /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 (file)
index f3577c2..0000000
+++ /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 (file)
index 832f6d3..0000000
+++ /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 (file)
index 48f82d3..0000000
+++ /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 (file)
index 00bb504..0000000
+++ /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 (file)
index 5cfe401..0000000
+++ /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 (file)
index f3577c2..0000000
+++ /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 (file)
index f740b0f..0000000
+++ /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 (file)
index 58d777a..0000000
+++ /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 (file)
index 3fe3136..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#define TAGS mod_loadinfo
-corelib$
-common$
-connect$
-connect/daemons$
-connect/daemons/mod$
index 5d3750ae57f5cf0e32a648f39f072bde412ec4ef..986149671dd151dc7b66ff71ef55e3592706cf74 100644 (file)
@@ -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() \96 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
index 0b2188ba47884c5283e586f18ca0634449748259..f97c610601f332116c0bbe6a526cbfdd48c36797 100644 (file)
@@ -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
 #
index 7ee784dcfe3f8cb61f351d2ab0cd0f4d04814869..147129187bb4f9dada538f6bed14ba7b242e24e8 100644 (file)
@@ -8,7 +8,6 @@ ctools
 db
 dbapi
 html
-internal/align_model$
 internal/ID/utils$
 internal/ID/utils/wgs$
 internal/ID/utils/wgs/format$
index f7cb82dd56ae268c40c36c88f1208dd1635dfdba..cc40e6684f51bc89b8f5006a0f3258c5ec59cb2e 100644 (file)
@@ -8,7 +8,6 @@ ctools
 db
 dbapi
 html
-internal/align_model$
 internal/ID/utils$
 internal/ID/utils/wgs$
 internal/ID/utils/wgs/format$
index 8353f5b751a6009319a413f50deb684caea43836..e2385a92cd2905f6c23eb779316d0be9a707ce45 100644 (file)
@@ -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
index c170542e784a0829fec181de5f09d9619769e1bb..49617679d3ec9aa292635b79534076d6a7158ac9 100644 (file)
@@ -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
index c8a2eac74c16e2207664a9ecc76d76c45d8b5d21..ef211e62b728aec114b5322da4ce17b12324b395 100644 (file)
@@ -11,7 +11,6 @@ dbapi
 gui
 html
 internal/algo/id_mapper
-internal/align_model
 internal/idx
 internal/idxext
 internal/ilink
index 66300dda4a239601d8fd4d8143bcc687e3f35267..e97cfdb7ef80bfc432287a419c089022193a6410 100644 (file)
@@ -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$
index 69df250d2847045f02e4a747c525a3ce9bc32e0c..9f81386eb60fa4b01a73ce59dcc6238a217562f3 100644 (file)
@@ -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$
index cae554a811cde2699c522fbb65ca568897cb3f09..d3df24eeb02f9c0630b1c39f3ccb2f1fdfb1542f 100644 (file)
@@ -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.
index 309031bd0a32ae3d00d927b2188d61c298926092..b1296c7efd9bfb6ab9cf386fa79be2f51e5a0bf8 100644 (file)
@@ -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
 
index e354cb461da5a8746435f1c219827c57478b616b..e3ffcdf31b205530b0fdd0885dadf0651f8479d1 100644 (file)
@@ -1,3 +1,3 @@
 [components]
-infrastructure  25.0
-core            25.0
+infrastructure  28.0
+core            28.0
index c2eb07d5c77ffe7ba51dcaccd8220f7216065774..bdf33f863c243615511d72624736789112bbb475 100644 (file)
@@ -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
index 78fb47801b67521c374d23605a6f4ae8fc7f78da..cdf438fd7b221b40f5b1935fab31701a0ed51d10 100644 (file)
@@ -3,5 +3,4 @@ infrastructure  28.0
 core            28.0
 misc            28.0
 objects         28.0
-objtools        28.0
 web             28.0
index 586637bb9c03c1063bcc956e12e30c1433383f77..d7eec9ae86a118b25a1adc3ebfb3526d243a0343 100644 (file)
@@ -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
index 0661b6630dd41981b5b0a96535658096b425109f..5fa45b487553405065ae39b5447ad4d9e1d8d0a0 100644 (file)
@@ -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
index 7b66da19e798353195d389cac99b427a0e101734..b7583409c1d126b7a75fb4daa260e9423d27d536 100644 (file)
@@ -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.
 
index 025985730d03b72c5b51cc82dbce48c3c2539876..e2104c0458c2e5c38e7400304986f618ab4e0107 100644 (file)
@@ -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
index dc28e62e0af4997c15d3da7617cadf6a2084318d..f74dc869034464180e5092b1be15a5d989ffc741 100644 (file)
@@ -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
 
index 5bbac74c44e5e627560e50406e9313dcdc445868..b09ad9ea79eed8cd81d6f253b25b88e7db3240df 100644 (file)
@@ -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)
index d533af8aa604909c7134dda2cdd8d68a2c41d1e6..f70eb921e8feb9ad1b4ebf25e861304274a39e20 100644 (file)
@@ -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
 ##################################################################
index baa24f5cb635d323c9435fc6e10d4d15670a4771..00bfdc69a3468e459194736ad0951d57eb91039c 100644 (file)
@@ -141,10 +141,10 @@ CBlastSeqVectorFromCSeq_data::SetCoding(objects::CSeq_data::E_Choice c)
         // FIXME: are ambiguities randomized if the encoding requested is 
         // ncbi2na?
         vector<char> tmp;
-        TSeqPos nconv = CSeqConvert::Convert(m_SequenceData, m_Encoding,
+        TSeqPos nconv = static_cast<TSeqPos>(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<TSeqPos>(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<TSeqPos>(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<TSeqPos>(m_Bioseqs.size()); 
 }
 
 CConstRef<objects::CSeq_loc> 
index cd7618162a79a7b237acf1cf7f9e6bd415ee2b88..6655561c2f38484a0f8f7dea4bb22ade78a57abc 100644 (file)
@@ -291,7 +291,7 @@ BuildBlastAncillaryData(EBlastProgramType program,
             }
         } else {
             for(size_t i = 0; i < alignments.size(); i++) {
-                CRef<CBlastAncillaryData> s(new CBlastAncillaryData(program, i,
+                CRef<CBlastAncillaryData> s(new CBlastAncillaryData(program, static_cast<int>(i),
                                                                     sbp,
                                                                     qinfo));
                 retval.push_back(s);
index b42337c34d26b99b7fe99d39f80f45945555a4a8..b0e586a226d25ed90cc1feb7b335257ecb581d47 100644 (file)
@@ -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 <algo/blast/api/blast_dbindex.hpp>
 #include <algo/blast/dbindex/dbindex.hpp>
+#include <algo/blast/dbindex/dbindex_sp.hpp>
 
 #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;
index 2659b2c37730dc5e3bda2a6c6ee6db12b17aff64..67a2d8ed375cb95e70e57b650581966b3264a4b5 100644 (file)
@@ -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<TSeqPos>(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<TSeqPos>(query.GetSeqLength(0)),
                                               seqinfo_src,
                                               true,
                                               false,
@@ -1801,7 +1801,7 @@ s_BLAST_OneSubjectResults2CSeqAlign(const BlastHSPResults* results,
             CConstRef<CSeq_loc> seqloc = query_data.GetSeq_loc(qindex);
             CRef<CSeq_id> query_id(new CSeq_id);
             SerialAssign(*query_id, *seqloc->GetId());
-            TSeqPos query_length = query_data.GetSeqLength(qindex); 
+            TSeqPos query_length = static_cast<TSeqPos>(query_data.GetSeqLength(qindex)); 
             s_AdjustNegativeSubjFrameInBlastn(kSubjStrand, prog, hsp_list);
             
            vector<string> 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<TSeqPos>(query.GetSeqLength(index)),
                                                 seqinfo_src,
                                                 is_gapped,
                                                 is_ooframe,
index 2f71d890211301ae9cf389f855f3f0b0fa9ee379..e9d58bf39896a316dce81565be71705c1000117f 100644 (file)
@@ -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<unsigned int>(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<int>(kNumFrames) * query_index;
+    const int last_ctx = static_cast<int>(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<Uint4>(masked_ranges.size()) + 1, true, eSoftSubjMasking);
             } else {
                 subj->num_seq_ranges = 0;
             }
index 591e7192a31a4da4d2175b275b789ff34c95fc80..4580a9a434270a67c32e5503e7ed7d9bbd483932 100644 (file)
@@ -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<Uint4>(m_QueryData.size());
+    m_MsaDimensions.num_seqs = static_cast<Uint4>(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<int>(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<int>(m_QueryData.size());
+    const int kNumCds = static_cast<int>(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<int>(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<int>(m_QueryData.size());
+    const int kNumCds = static_cast<int>(m_Hits.size());
     const Uint1 kGapChar = AMINOACID_TO_NCBISTDAA[(int)'-'];
     for (int i=0;i < kNumCds;i++) {
         _ASSERT(m_Msa[i]);
index 4c855dd7321398bd8c9a74001f64c8b1194c487b..9c6c4252fc641ae6b2bbd01b2c0ded243e71efde 100644 (file)
@@ -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<CSearchResultSet> CDeltaBlast::Run(void)
     
         CRef<CCddInputData> pssm_input(
                                new CCddInputData(query_seq[i],
-                                          query_lens[i],
+                                          static_cast<unsigned int>(query_lens[i]),
                                          (*m_DomainResults)[i].GetSeqAlign(),
                                          *opts.Get(),
                                          m_DomainDb->GetDatabaseName(),
index 23526df44c223e015db11f5ec03f36b87c25c97a..5ffdfb9ab2a6eb8f7858da05f823eb527cdde3ab 100644 (file)
@@ -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<Int4>(query_index));
 }
 
 Int8
index a10571dc33fb2aff9efaac75466c1f26833d2aab..4f6a53df97e291f9fb2edc48c4818eae3ec2b971 100644 (file)
@@ -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<unsigned int>(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") );    
index 83527070e7f9df970a204ae6a2056b3f06eac465..b67faa669511daf702936584497f1b9941d6b8ae 100644 (file)
@@ -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<CSeq_align> s_CreateSeqAlign(const HSPChain* chain,
     CRef<CSeq_id> 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<TSeqPos>(qdata->GetSeqLength(query_index));
 
     CRef<CSeq_id> subject_id;
     TSeqPos subj_length;
index c3972d10a9e933ad47270f469fd6a5baf0844f13..65028c8e53fbfa1958262e73ceb848456b1c5a80 100644 (file)
@@ -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<Uint4>(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<unsigned int>(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<int>(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<int>(i);j < k;j++) {
                     m_Msa->data[seq_index][j].is_aligned = false;
                 }
             }
index 1b7cb1d8efb3cad5dfc23deac800da274b99eabb..f2a538f0d30d45b4e742e20c21b0afab272078a3 100644 (file)
@@ -242,13 +242,13 @@ CObjMgr_LocalQueryData::GetNumQueries()
 CConstRef<CSeq_loc> 
 CObjMgr_LocalQueryData::GetSeq_loc(size_t index)
 {
-    return m_QuerySource->GetSeqLoc(index);
+    return m_QuerySource->GetSeqLoc(static_cast<int>(index));
 }
 
 size_t 
 CObjMgr_LocalQueryData::GetSeqLength(size_t index)
 {
-    return m_QuerySource->GetLength(index);
+    return m_QuerySource->GetLength(static_cast<int>(index));
 }
 
 
index 365d7784d2ea06b9207e44c4c2739b8d6c5fbba1..684dcca2f649799d7bcca0bc16d58aab838041ed 100644 (file)
@@ -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<int>(index));
 }
 
 /** 
index 8208a90b4bf6287a03bb011f8d7a2cb1604e1b84..9e75cc3282a0d8d48c3e813e0d6b8f8e9ea1ed1a 100644 (file)
@@ -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:
index a6e64ddc58f3d6703457eb36f88f9872d95d257a..2c103eabc965121b5608b048f792d3e50fa93dd5 100644 (file)
@@ -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<int>(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<list<CRef<CStd_seg> > >  & l
        for(int i=0; i < num_queries; i++)
        {
                CConstRef<CSeq_loc> query_loc = local_query_data->GetSeq_loc(i);
-               TSeqPos query_length = local_query_data->GetSeqLength(i);
+               TSeqPos query_length = static_cast<TSeqPos>(local_query_data->GetSeqLength(i));
                BlastHitList * hit_list = q_list_ptr[i];
                if(NULL != hit_list)
                {
index c8346c36487e5163f573d0379f3f3a4b698590f9..452c1d7e2bd284ec75c0f46871d48680f7f806b0 100644 (file)
@@ -306,14 +306,13 @@ CPsiBlastInputData::x_ExtractAlignmentData()
         double evalue = GetLowestEvalue((*itr)->GetScore(), &bit_score);
         CSeq_id* current_sid = const_cast<CSeq_id*> (&(*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);
index afbd5b0a14904c501b7d66d93260c8c33e439edc..9d07aeb2bfdcae6c1fbe8c40f1b621584b4adcbe 100644 (file)
@@ -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 
index f694bbc083cb8a7a8bff3c1352b26f0e4ad1806c..1efe5e63d484b6b97cbbd7ebc4b8dcc8d6a10a8d 100644 (file)
@@ -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<fstream> tmp_stream( CDirEntry::CreateTmpFile() );
     do{
-               n_read = CStreamUtils::Readsome(ios,incoming_buffer, read_max);
+               n_read = static_cast<int>( CStreamUtils::Readsome(ios,incoming_buffer, read_max) );
                if( n_read > 0 ){
                        l_total_bytes += n_read;
                        try{
index 0fa9f09a7a7763607aed932c181d5940acf06389..852ac55bd13b5d38f03b1db3e550e3844a40e6b8 100644 (file)
@@ -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<string> & 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<string, Int8> & a, const pair<string, Int8>
 
 static void s_MapDbToThread(vector<string> & db, unsigned int num_of_threads)
 {
-       unsigned int db_size = db.size();
+       unsigned int db_size = static_cast<unsigned int>(db.size());
        vector <pair <string, Int8> >    p;
 
        for(unsigned int i=0; i < db_size; i++)
@@ -314,7 +314,7 @@ void* CRPSThread::Main(void)
 
 CRef<CSearchResultSet> CRPSThread::RunTandemSearches(void)
 {
-       unsigned int num_of_db = m_db.size();
+       unsigned int num_of_db = static_cast<unsigned int>(m_db.size());
        vector<CRef<CSearchResultSet> > results;
 
        for(unsigned int i=0; i < num_of_db; i++)
@@ -339,7 +339,7 @@ CLocalRPSBlast::CLocalRPSBlast(CRef<CBlastQueryVector> 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<unsigned int>(m_rps_databases.size());
        if( 1 == m_num_of_dbs)
        {
                m_num_of_threads = kDisableThreadedSearch;
@@ -415,7 +415,7 @@ CRef<CSearchResultSet> 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<unsigned int>(m_rps_databases.size());
        }
        else if(m_num_of_threads < m_rps_databases.size())
        {
index 4513a755741ddf42ef11bc63a64cae2c0a9dff6a..bb6f5343aaeffa076d59acce17cc6f958989ab8a 100644 (file)
@@ -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<IQueryFactory> 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<Uint4>(subj_seqs.size()))
 {
     // Fix subject location for tblast[nx].  
     if (Blast_SubjectIsTranslated(program))
index dbcc11a1bf111c04d0f1cbd7ae363bedbb843f37..76ce87b06969617b5e57d56f104c95dc12b546b9 100644 (file)
@@ -94,7 +94,7 @@ CSetupFactory::CreateRpsStructures(const string& rps_dbname,
 static
 CRef<CPacked_seqint> s_LocalQueryData2Packed_seqint(ILocalQueryData& query_data)
 {
-    const int kNumQueries = query_data.GetNumQueries();
+    const int kNumQueries = static_cast<int>(query_data.GetNumQueries());
     if (kNumQueries == 0) {
         return CRef<CPacked_seqint>();
     }
@@ -106,7 +106,7 @@ CRef<CPacked_seqint> 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<TSeqPos>(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<ILocalQueryData> query_data,
                                          rps_info ? (*rps_info)() : 0,
                                          &blast_msg,
                                          seqsrc,
-                                         num_threads);
+                                         static_cast<Uint4>(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<Int4>(number_of_queries), writer);
 }
 
 BlastHSPWriter*
@@ -445,26 +445,16 @@ CSetupFactory::InitializeMegablastDbIndex(CRef<CBlastOptions> 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();
index 330fc97f18c8ac285bc921791d9f7e15581713fc..0a18dcf3e49caee04a51b37bbe0936ed8d149cd9 100644 (file)
@@ -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<int>(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<int>(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<int>(m_QueryIndicesPerChunk[chunk_num][pos]));
 }
 
 int
index 655b1fdc03ff3420ef31318181856c2d07b78522..7339d0028318cef26149c4b50c45b9e138224436 100644 (file)
@@ -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<Uint4>(chunk_num),
                                                   &retval);
     if (rv != 0) {
         throw runtime_error("SplitQueryBlk_GetNumQueriesForChunk");
@@ -81,7 +81,7 @@ CSplitQueryBlk::GetQueryIndices(size_t chunk_num) const
     vector<size_t> retval;
     Uint4* query_indices = NULL;
     Int2 rv = SplitQueryBlk_GetQueryIndicesForChunk(m_SplitQueryBlk,
-                                                    chunk_num,
+                                                    static_cast<Uint4>(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<Uint4>(chunk_num),
                                                      &query_contexts,
                                                      &num_contexts);
     if (rv != 0) {
@@ -119,7 +119,7 @@ CSplitQueryBlk::GetContextOffsets(size_t chunk_num) const
     vector<size_t> retval;
     Uint4* context_offsets = NULL;
     Int2 rv = SplitQueryBlk_GetContextOffsetsForChunk(m_SplitQueryBlk,
-                                                      chunk_num,
+                                                      static_cast<Uint4>(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<size_t, size_t> chunk_bounds(0, 0);
-    Int2 rv = SplitQueryBlk_GetChunkBounds(m_SplitQueryBlk, chunk_num
+    Int2 rv = SplitQueryBlk_GetChunkBounds(m_SplitQueryBlk, static_cast<Uint4>(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<unsigned int>(chunk_bounds.first), static_cast<unsigned int>(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<int>(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<Uint4>(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<Uint4>(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<Uint4>(chunk_num));
     if (rv != 0) {
         throw runtime_error("Failed to add context offset to "
                             "SplitQueryBlk");
index 989a9b3d1ad4bc2085061e0d65788c035f7a5f88..dcb3fbf180a00588ac4014b1140badaf6bcc600e 100644 (file)
@@ -159,7 +159,7 @@ CQuerySplitter::x_ComputeChunkRanges()
         }
 
         m_SplitBlk->SetChunkBounds(chunk_num, 
-                                   TChunkRange(chunk_start, chunk_end));
+                                   TChunkRange(static_cast<unsigned int>(chunk_start), static_cast<unsigned int>(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<int>(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<TChunkRange> query_ranges;
     query_ranges.reserve(kNumQueries);
-    query_ranges.push_back(TChunkRange(0, m_LocalQueryData->GetSeqLength(0)));
+    query_ranges.push_back(TChunkRange(0, static_cast<unsigned int>(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<TSeqPos>(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<Int4>(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<int>(queries[i]));   
+                int last_query_chunk = qdpc->GetLastChunk(static_cast<int>(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<Int4>(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<Int4>(kNumContexts*queries[i]+ctx));
                             } else {
                                 m_SplitBlk->AddContextToChunk(chunk_num,
-                                          kNumContexts*queries[i]+
-                                          s_AddShift(ctx, shift));
+                                          static_cast<Int4>(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<Int4>(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<Int4>(kNumContexts*queries[i]+ctx));
                         }
                     }
                 }
 
             } else if (Blast_QueryIsProtein(kProgram)) {
                 m_SplitBlk->AddContextToChunk(chunk_num, 
-                                              kNumContexts*queries[i]);
+                                              static_cast<Int4>(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<int>(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<int>(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<int>(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<int>(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<int>(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<Int4>(correction));
 #ifdef DEBUG_COMPARE_SEQUENCES
 {
     int global_offset = global_qinfo->contexts[absolute_context].query_offset +
index 8d3a5435efefc92d8d29f3f8cb95ca142530a8a7..3351c644587ae0e86f318a68e29f5292637c6f5a 100644 (file)
@@ -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<int>(CThreadable::kMinNumThreads);
     const int kMaxValue = static_cast<int>(CSystemInfo::GetCpuCount());
     const int kDfltValue = m_NumThreads != CThreadable::kMinNumThreads
-        ? std::min<int>(m_NumThreads, kMaxValue) : kMinValue;
+        ? std::min<int>(static_cast<int>(m_NumThreads), kMaxValue) : kMinValue;
 
     arg_desc.AddDefaultKey(kArgNumThreads, "int_value",
                            "Number of threads (CPUs) to use in the BLAST search",
index b7e11090dba522d8a721b10e332c624450b0e17f..21f8806dd1e8764f69a1355c70ed174c5dba8294 100644 (file)
@@ -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<CSeq_inst_Base::TLength>(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<CSeq_inst_Base::TLength>(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<ILineReader> 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<TSeqPos>(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<ILineReader> line_reader)
             empty_sequence = true;
         }
         else {
-            bioseq.SetInst().SetLength(line.length());
+            bioseq.SetInst().SetLength(static_cast<CSeq_inst_Base::TLength>(line.length()));
             bioseq.SetInst().SetSeq_data().SetIupacna(CIUPACna(line.data()));
             m_BasesAdded += line.length();
         }
index 122279313fc73ad4de00b9914e25a336eaf79f72..cdedd36cdd21809206df0aa9690d8cb235d24cc7 100644 (file)
@@ -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;
 }
index 071651c6ad4c0b2836aa1b034e64eb8d17c9176f..2a5462751e4a8b89431b4587ec1596c69b483148 100644 (file)
@@ -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
index fb24dc85cde70a14063c547ed5dc2e65f305633c..1452fbe3afd0135d93dbcada7386cba0122d557d 100644 (file)
@@ -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;
index 2f3304612dcd26df1772485f00ab0a225e80ef93..0934922ad7ec875d374473b0039edd0f90a7316c 100644 (file)
@@ -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;
 }
 
index 2704da82dfc78c7ce8f1e7c566f006e474c0bdef..4472161173240ff8605320d06cdcee8f819fcbab 100644 (file)
@@ -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));
    }
 
index 490875ed123cdc83923a3f268e3b720d09021254..a5c6fe3f098b96f94f66f61fa0b14bcc775a7e1f 100644 (file)
@@ -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);
index e7c9dab197aef14bd584d0ef16f6b2e548c5e8fe..30d646ca6e341a2d2630fc0045268aa09559a0a9 100644 (file)
@@ -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);
index 6361a4e9f84f8a54a2f6ab9cce6aa41b77d324e8..40fa9442adc35eeb074c9e596f0916e8be306d74 100644 (file)
@@ -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;
index 1af5e3ec998f6fcc8410ca598997ab21a8636413..65fe1da829826d2fd3d891bbde09780de9a5309a 100644 (file)
@@ -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 */
index 0990d0d1b17c996dc60d820c6d2ab044727242d6..380295476dde79669ad550d58803e498b6a8268e 100644 (file)
@@ -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,
index a58f6966a43cde9077a27d983edd94721ef412f5..8270e97b04e7d7020c2f937ce625b603292d61d1 100644 (file)
@@ -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;
 
index bc46f785ac32e1bf72124108ed234c7dfa81633a..4342eaf856e96dde10e0b0037db933bfdffda042 100644 (file)
@@ -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);
             }
         }
index 9be43c4da365053408ef7b34cd299cbdee5ecdf7..81b9a2de5a86fbdcdd38cd1c78d635714ab666e3 100644 (file)
@@ -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;
                 }
index d130f5b25128d16fce3801fcf2577fa8867a0dbf..7686422d780329a3f48c3b484456b752e35be7ce 100644 (file)
@@ -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);
             }
         }
     }
index 6c938d9cf5beb77874c94d8cd555b6487bf09320..135a3e98a3dab18b3f2b76e7ffe370563dc742dd 100644 (file)
@@ -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");
index 0bd632b8a54f947c4aa71ed3579857553ec4f25d..04173c22f64af3610f1338a03fc90fad19a288aa 100644 (file)
@@ -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 */
 
 
index 1ec97d1e5d5b5397fd0e1b6ef289258a07b76e36..46eeeae8092004486175d79784cf5d30690b4dd8 100644 (file)
@@ -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;
index 57322844fb0eafe72f305cd82a3c38392c3edd29..e55065247429309e1f876b4c429b623b976bb023 100644 (file)
@@ -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,
index bd18fb501d75bbc65a175dac38e6dba5864c953f..13806c8aa27f4096b61040e4a3422a7442525480 100644 (file)
@@ -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)
       {
index ca09ee5444ce32e435bf41b79d27e721572f723f..0cee2aaf6a3981c9008b8fa990e0d3b3e9a631e0 100644 (file)
@@ -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<TWord>(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<Uint4>(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<TWord>(subjects_.size());
+    TWord subject_map_size = static_cast<TWord>(  
         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<TSeqPos>((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<TWord>(seq_off), c_seq_.size(), segs ) );
     
     if( *subjects_.rbegin() == 0 ) {
-        *subjects_.rbegin() = chunks_.size();
+        *subjects_.rbegin() = static_cast<unsigned int>(chunks_.size());
     }
 
-    last_chunk_ = chunks_.size();
+    last_chunk_ = static_cast<TSeqNum>(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<TSeqPos>( 
+        (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<<lid_bits);
+        TSeqNum lid_limit = static_cast<TSeqNum>((1UL<<lid_bits));
 
         if( lid_map_.size() >= 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<TSeqNum>(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<TSeqPos>(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<TSeqPos>(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)<<offset_bits_) + off;
+    TWord result = static_cast<TWord>( ((lid_map_.rend() - iter - 1)<<offset_bits_) + off);
     return result;
 }
 
@@ -914,7 +914,7 @@ inline TWord CSubjectMap_Factory::MakeOffset(
 //-------------------------------------------------------------------------
 void CSubjectMap_Factory::Save( CNcbiOstream & os ) const
 {
-    TWord sz = sizeof( TWord )*lengths_.size();
+    TWord sz = static_cast<TWord>(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<TWord>(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<TSeqPos>(hkey_width_) - start;
     TSeqPos end_diff = stop - curr;
 
     if( start_diff <= options_.stride || end_diff <= options_.stride ) {
index 1d0c8ff3a10f4cf106d2be936f21cc406852b1f2..750cdc91fd94f519467c5e9b4dd79849fbb68f43 100644 (file)
@@ -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<TSeqPos>(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<<code_bits_) - 1));
     TTrackedSeed seed( 
-            qoff_, (TSeqPos)offset, index_impl_.hkey_width(), qoff_ );
+            qoff_, (TSeqPos)offset, (TSeqPos)index_impl_.hkey_width(), qoff_ );
     TTrackedSeeds & subj_seeds = seeds_[subject_];
     subj_seeds.EvalAndUpdate( seed );
 
@@ -1177,7 +1177,7 @@ INLINE
 void CSearch_Base< LEGACY, NHITS, derived_t >::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<unsigned int>(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<unsigned int>(min_offset_) );
         soff_ = root->soff_;
         return 1;
     }
index dd5c05d9c7110f38f6db3ad68e1b2c350087fd39..12859775ae0fb50cb57b11f8407d22c79b7d3c94 100644 (file)
@@ -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<int>(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<Uint4>(i));
                                }
                                report.AddParam(CBlastUsageReport::eSubjectsLength, total_subj_length);
                        }
index e6ef8cbd8532d3f1f1712a92828dd6ce423ce598..96c2390db2d125880a1a2b6e232dc46662b687a9 100644 (file)
@@ -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<CRange<int> > masks_v;
-    int aln_stop = query_seq.size() - 1;
+    int aln_stop = static_cast<int>(query_seq.size()) - 1;
     ITERATE(ncbi::TMaskedQueryRegions, mask_iter, mask_info) {
         if ((*mask_iter)->GetFrame() != query_frame)
             continue;
index 03af715abb5d02fb39c099a6af430ae11afcab9e..edc786d76925697187d7d8605b4dcf4f2e9c3ea6 100644 (file)
@@ -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<CRef<CHsp> >& 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<unsigned int>(min(query_seq.size(),
+                                            subject_seq.size()));
         for (unsigned int i = 0; i < kMaxOffset; ++i) {
             if (query_seq[i] == subject_seq[i]) {
                 ++num_ident;
index 6fb2695ed590af206e3219046951b945cc50276a..a14f9a0df7b49e5e151c7ae9cf145f64564ab4c8 100644 (file)
@@ -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<int>( m_KmerFiles.size());
        if (numThreads > numQuery)
                numThreads = numFiles;
 
@@ -277,7 +277,7 @@ for(int index=0; index<numFiles; index++)
                sort(final_results.begin(), final_results.end(), s_SortFinalResults);
                if (m_Opts->GetNumTargetSeqs() > 0)
                {
-                       int vec_size = final_results.size();
+                       int vec_size = static_cast<int>( 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<int>(m_QueryVector.size());
 
        CRef<CBlastKmerResultsSet> kmerResultsSet = x_SearchMultipleQueries(0, numQueries, kmerParams, a.data(), b.data(), kValues, badMers);
        
index a56f68bd5f37f2eca9ff97224b4b72906eb93e12..dce2221079a0b1b4ed3d42cc3cf03e2cf2be62f8 100644 (file)
@@ -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<size_t>(num_hashes))
                {
-                       int rem = 1 + num_hashes - hash_values.size();
+                       int rem = 1 + num_hashes - static_cast<int>(hash_values.size());
                        uint32_t hashval = 0xffffffff;  // Fill in empties
                        for (int i=0; i<rem; i++)
                                hash_values.push_back(hashval);
@@ -354,7 +354,7 @@ static void s_Get_LSH_index_hashes(vector < vector < vector <uint32_t> > >& 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<int>(seq_hash[q_oid].size());
        for (int n=0; n<num_chunks; n++)
        {
          for(int b=0;b<numBands;b++)
@@ -385,7 +385,7 @@ static void s_Get_LSH_index_hashes2(vector < vector < vector <uint32_t> > >& seq
 
        int max=4*num_k+1;
         vector<unsigned char> key(max);
-       int num_chunks=seq_hash[q_oid].size();
+       int num_chunks=static_cast<int>(seq_hash[q_oid].size());
        int temp_index=0;
        int temp_hash=0;
        for (int n=0; n<num_chunks; n++)
@@ -416,7 +416,7 @@ static void s_Get_LSH_index_hashes5(vector < vector < vector <uint32_t> > >& 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<int>(seq_hash[q_oid].size());
        int numHashMax = numHashes - numRows + 1;
        uint32_t temp_hash = 0;
        for (int n=0; n<num_chunks; n++)
@@ -484,7 +484,7 @@ CBlastKmerBuildIndex::Build(int numThreads)
                last=oid_offset;
        }
 
-       int numVols = paths.size();
+       int numVols = static_cast<int>(paths.size());
 #pragma omp parallel for num_threads(numThreads)
        for(int index=0; index<numVols; index++)
        {
@@ -690,7 +690,7 @@ CBlastKmerBuildIndex::x_BuildIndex(string& name, int start, int stop)
        else
        {
                int i=1; // i must be lower than 2*m_NumHashFct
-               int num=badMers.size();
+               int num=static_cast<int>(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<num_seqs;q_oid++)
        {
-               int num_chunks = seq_hash[q_oid].size();
+               int num_chunks = static_cast<int>(seq_hash[q_oid].size());
                for (int n=0; n<num_chunks; n++)
                {
                    vector<uint32_t> tmp_hash;
index d8b977adca0a288a4c1cf26b9ab4c13dc25a6559..43a63e1d2c02ab28c37088dac20be1901918649e 100644 (file)
@@ -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<uint32_t> BlastKmerGetKmerSetStats(const string& query_sequence, int kmerNum
         vector<Uint1> trans_table;
         BlastKmerGetCompressedTranslationTable(trans_table, alphabetChoice);
        
-       int seq_length = query_sequence.length();
+       int seq_length = static_cast<int>(query_sequence.length());
        const char* query = query_sequence.c_str();
 
        // bail out if the sequence is too short
@@ -211,7 +211,7 @@ set<uint32_t> BlastKmerGetKmerSet(const string& query_sequence, bool do_seg, TSe
         vector<Uint1> trans_table;
         BlastKmerGetCompressedTranslationTable(trans_table, alphabetChoice);
        
-       int seq_length = query_sequence.length();
+       int seq_length = static_cast<int>(query_sequence.length());
        const char* query = query_sequence.c_str();
 
        // bail out if the sequence is too short
@@ -275,7 +275,7 @@ set<uint32_t> BlastKmerGetKmerSet2(const string& query_sequence, TSeqRange& rang
         vector<Uint1> trans_table;
         BlastKmerGetCompressedTranslationTable(trans_table, alphabetChoice);
        
-       int seq_length = query_sequence.length();
+       int seq_length = static_cast<int>(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<uint32_t>& minhash1, const vector<uint32_t
 {
 
         int distance=0;
-       int num_hashes = minhash1.size();
+       int num_hashes = static_cast<int>(minhash1.size());
 
         for (int index=0; index<num_hashes; index++)
         {
@@ -423,7 +423,7 @@ bool minhash_query(const string& query,
                      int chunkSize)
 {
        bool kmersFound=false; // return value;
-       int seq_length = query.length();
+       int seq_length = static_cast<int>(query.length());
        vector<TSeqRange> 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<int>(query.length());
        vector<TSeqRange> 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<size_t>(numHashes))
         {
-            int rem = 1 + numHashes - hash_values.size();
+            int rem = 1 + numHashes - static_cast<int>(hash_values.size());
             uint32_t hashval = 0xffffffff;  // Fill in empties
             for (int i=0; i<rem; i++)
                     hash_values.push_back(hashval);
@@ -534,7 +534,7 @@ void get_LSH_hashes(vector < vector <uint32_t> >& query_hash,
                       int num_bands,
                       int rows_per_band)
 {
-       int num_chunks=query_hash.size();
+       int num_chunks=static_cast<int>(query_hash.size());
        uint32_t temp_hash=0;
        for (int n=0; n<num_chunks; n++)
        {
@@ -568,7 +568,7 @@ void get_LSH_hashes5(vector < vector <uint32_t> >& query_hash,
                       int numHashes,
                       int numRows)
 {
-       int num_chunks=query_hash.size();
+       int num_chunks=static_cast<int>(query_hash.size());
        uint32_t temp_hash=0;
        int numHashMax = numHashes - numRows + 1;
        for (int n=0; n<num_chunks; n++)
@@ -656,7 +656,7 @@ void get_LSH_hashes2(vector < vector <uint32_t> >& query_hash,
 {
        int max=4*num_k+1;
        vector<unsigned char> key(max);
-       int num_chunks=query_hash.size();
+       int num_chunks=static_cast<int>(query_hash.size());
        uint32_t temp_hash=0;
        int temp_index=0;
        for (int n=0; n<num_chunks; n++)
@@ -688,7 +688,7 @@ void get_LSH_match_from_hash(const vector< vector <uint32_t> >& query_LSH_hash,
                     vector< set<uint32_t > >& candidates)
 {
 
-       int num=query_LSH_hash.size();
+       int num=static_cast<int>(query_LSH_hash.size());
        for (int i=0; i<num; i++)
        {
                for(vector<uint32_t>::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 <uint32_t> > & query_hash, vector < vector <uint32_t> >& query_hash_hash, int compress, int version)
 {
     int hash_value=0;
-    int num_chunks=query_hash.size();
+    int num_chunks=static_cast<int>(query_hash.size());
     const uint32_t kBig=0xffffffff;
     for (int n=0; n<num_chunks; n++)
     {
@@ -752,7 +752,7 @@ void neighbor_query(const vector < vector <uint32_t> >& query_hash,
                      BlastKmerStats& kmer_stats,
                      int kmerVer)
 {
-       int num_chunks=query_hash.size();
+       int num_chunks=static_cast<int>(query_hash.size());
 
        vector< vector<uint32_t> > candidate_oids;
        candidate_oids.resize(num_chunks);
@@ -925,7 +925,7 @@ BlastKmerVerifyIndex(CRef<CSeqDB> seqdb, string &error_msg)
        int status=0;
        vector<string> kmerFiles;
        seqdb->FindVolumePaths(kmerFiles, false);
-       int numFiles = kmerFiles.size();
+       int numFiles = static_cast<int>(kmerFiles.size());
        for (int i=0; i<numFiles; i++)
        {
                try {
index a66ba304aacd4776dc451d49649224cd4e52de0d..6914695cae2d197ef03c4f960eb36334583d9691 100644 (file)
@@ -1,4 +1,4 @@
-/*  $Id: kblastapi.cpp 555442 2018-01-18 12:23:05Z madden $
+/*  $Id: kblastapi.cpp 683928 2024-06-10 12:07:11Z ivanov $
  * ===========================================================================
  *
  *                            PUBLIC DOMAIN NOTICE
@@ -62,7 +62,7 @@ USING_SCOPE(blast);
 static void 
 s_GetSequencesIntoScope(CRef<CBlastKmerResultsSet> resultSet, CRef<CScope> scope, CRef<CSeqDB> seqdb)
 {
-        int numSearches=resultSet->GetNumQueries();
+        int numSearches=static_cast<int>(resultSet->GetNumQueries());
         vector<int> oid_v;
         for (int index=0; index<numSearches; index++)
         {
@@ -115,7 +115,7 @@ CRef<CLocalDbAdapter> 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<unsigned int>(subject_infosrc->Size());
              }
          }
          for (index=0; index<local_query_data->GetNumQueries(); index++)
@@ -184,7 +184,7 @@ CRef<CSearchResultSet> CBlastKmerSearch::Run(void)
        vector< CRef<CScope> > scope_v = objmgr_qf->ExtractScopes();
        s_GetSequencesIntoScope(resultSet, scope_v[0], seqdb);
 
-       int numSearches=resultSet->GetNumQueries();
+       int numSearches=static_cast<int>(resultSet->GetNumQueries());
        CRef<CSearchResultSet> search_results(new CSearchResultSet());
        for (int index=0; index<numSearches; index++)
        {
index c8c9eb3888c78f1125a40ca06b8beb0149bdd7ab..b548e6802c5f5bfca859cf95536ee2912c5c48fc 100644 (file)
@@ -1,8 +1,8 @@
-# $Id: CMakeLists.blast_unit_test.app.txt 673806 2023-10-10 19:39:05Z ivanov $
+# $Id: CMakeLists.blast_unit_test.app.txt 683530 2024-05-30 12:54:29Z ivanov $
 
 NCBI_begin_app(blast_unit_test)
   NCBI_sources(blast_unit_test)
-  NCBI_uses_toolkit_libraries(blast xobjmgr)
+  NCBI_uses_toolkit_libraries(xblast xobjmgr xconnect)
   NCBI_set_test_assets(blast_unit_test.ini)
   NCBI_add_test()
   NCBI_project_watchers(boratyng morgulis madden camacho fongah2)
index b812543732930af12ba0d8ad3abb3bdd13e08457..518b427ca87fcb04ca8a2699fdee79fb0c504e2d 100644 (file)
@@ -1 +1 @@
-XP_558472.3
+EAL40459.3
index e7396ace9d196fd9dff07778c76bf90299c501d5..caf7ff79c58e2d14a9819ed70f3292a195485cd9 100644 (file)
@@ -1,4 +1,4 @@
-/*  $Id: tracebacksearch_unit_test.cpp 621864 2020-12-17 15:27:06Z grichenk $
+/*  $Id: tracebacksearch_unit_test.cpp 679249 2024-02-20 20:56:20Z ivanov $
  * ===========================================================================
  *
  *                            PUBLIC DOMAIN NOTICE
@@ -65,7 +65,7 @@ public:
     CRef< CStructWrapper<BlastHSPStream> >
     x_GetSampleHspStream(CRef<CBlastOptions> opts, CSeqDB & db)
     {
-        CSeq_id sid("XP_558472");
+        CSeq_id sid("EAL40459");
         
         vector<int> 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");
     }
 }
 
index 06724b1697103bc2115769df121b7e4dd8e03178..2079e04c8e279559ea03c2f22a1ef7624091e8a0 100644 (file)
@@ -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());
index e715501a77abde529d1b3063d1ce46520711cf94..b685a1109a54aec16fe500ac89fe2c1f7cf2201d 100644 (file)
@@ -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()
 {
index 512160fff2973f22729103e26a86feecdc140362..fb493484b0e888233157517463af46cc5bfd47e6 100644 (file)
@@ -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 <algo/blast/core/blast_util.h>
 #include <corelib/ncbi_limits.h>
 
+// System include, explicitly needed on FreeBSD as of VDB 3.1.1.
+#include <time.h>
+
 // VDB includes
 #include <ncbi/vdb-blast.h>
 #include <ncbi/vdb-blast-priv.h>
index 8b39eba7a3223de1ee6a9d0aeadb697e4e0863c0..2c5d375f1c3a934a6407502b4b7d1a93c4aede4f 100644 (file)
@@ -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;
index 41c87ff2e22c72a69b0c349796d773b95582908a..459be7c6c2b8e1b850d32210187aa55f2f5708a3 100644 (file)
@@ -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<string> & vdbs)
     AutoPtr<Boolean, ArrayDeleter<Boolean> > 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;
index 5df35e32f736c08deb94addfaa119ccc44ecb16b..d49852d3873255f8ea1d81657a5f5f5f00226ff1 100644 (file)
@@ -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;
index a1aa77ccb14eea2c30a4e501f339c7aa85c5d1de..b0643ca67a68f438969e8a751d42ec43127b96c7 100644 (file)
@@ -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;
 
index e1e752f01475eec688530f86041babd603f2d1fd..819362e258d6e3503ae8438fc977a0471d17c9b5 100644 (file)
@@ -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<CSearchResultSet>  s_CombineSearchSets(vector<CRef<CSearchResultSet>
 
 CRef<CSearchResultSet> s_RunLocalVDBSearch(const string & dbs,
                                                   CRef<IQueryFactory> query_factory,
-                                                                                  CRef<CBlastOptionsHandle> opt_handle, Int4 & num_extensions)
+                                                                                  CRef<CBlastOptionsHandle> opt_handle, Int4 & num_extensions,
+                                                                                  bool include_filtered_reads)
 {
        bool isCSRA = false;
        string csras = kEmptyStr;
@@ -199,8 +200,7 @@ CRef<CSearchResultSet> s_RunLocalVDBSearch(const string & dbs,
                csras = dbs.substr(k_CSRA_CHUNK.size());
        }
 
-    //CRef<CVDBBlastUtil> 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<IBlastSeqInfoSrc> seqInfoSrc = vdbUtil.GetSRASeqInfoSrc();
@@ -223,7 +223,8 @@ CRef<CSearchResultSet> s_RunLocalVDBSearch(const string & dbs,
 
 CRef<CSearchResultSet> s_RunPsiVDBSearch(const string & dbs,
                                                   CRef<CPssmWithParameters> pssm,
-                                                                                  CRef<CBlastOptionsHandle> opt_handle)
+                                                                                  CRef<CBlastOptionsHandle> opt_handle,
+                                                                                  bool include_filtered_reads)
 {
        bool isCSRA = false;
        string csras = kEmptyStr;
@@ -232,7 +233,7 @@ CRef<CSearchResultSet> s_RunPsiVDBSearch(const string & dbs,
                csras = dbs.substr(k_CSRA_CHUNK.size());
        }
 
-    CRef<CVDBBlastUtil> vdbUtil(new CVDBBlastUtil(isCSRA?csras:dbs, false, isCSRA));
+    CRef<CVDBBlastUtil> vdbUtil(new CVDBBlastUtil(isCSRA?csras:dbs, false, isCSRA, include_filtered_reads));
        CRef<CSearchResultSet> results;
     BlastSeqSrc* seqSrc = vdbUtil->GetSRASeqSrc();
     CRef<IBlastSeqInfoSrc> seqInfoSrc = vdbUtil->GetSRASeqInfoSrc();
@@ -266,11 +267,11 @@ class CVDBThread : public CThread
 public:
        CVDBThread(CRef<IQueryFactory>  query_factory,
                           vector<string> & chunks,
-                  CRef<CBlastOptions> options);
+                  CRef<CBlastOptions> options, bool include_filtered_reads);
 
        CVDBThread(CRef<CPssmWithParameters> pssm,
                       vector<string> & chunks,
-                      CRef<CBlastOptions>  options);
+                      CRef<CBlastOptions>  options, bool include_filtered_reads);
 
        void * Main(void);
 private:
@@ -282,6 +283,7 @@ private:
     CRef<IQueryFactory>                        m_query_factory;
     vector<string>                             m_chunks;
     CRef<CBlastOptionsHandle>  m_opt_handle;
+    bool                        m_include_filtered_reads;
     Int4                                               m_num_extensions;
     CRef<CPssmWithParameters>  m_pssm;
 };
@@ -289,8 +291,10 @@ private:
 /* CVDBThread */
 CVDBThread::CVDBThread(CRef<CPssmWithParameters> pssm,
                                       vector<string> & chunks,
-                                      CRef<CBlastOptions>  options):
-                                      m_chunks(chunks), m_num_extensions(0), m_pssm(pssm)
+                                      CRef<CBlastOptions>  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<CPssmWithParameters> pssm,
 
 CVDBThread::CVDBThread(CRef<IQueryFactory>  query_factory,
                                       vector<string> & chunks,
-                                      CRef<CBlastOptions>  options):
-                                      m_query_factory(query_factory), m_chunks(chunks), m_num_extensions(0)
+                                      CRef<CBlastOptions>  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<CSearchResultSet> 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<CSearchResultSet> CVDBThread::RunTandemSearches(void)
 /* CLocalVDBBlast */
 CLocalVDBBlast::CLocalVDBBlast(CRef<CBlastQueryVector> query_vector,
                                           CRef<CBlastOptionsHandle> 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<objects::CPssmWithParameters> pssm,
                                           CRef<CBlastOptionsHandle> 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<CSearchResultSet> CLocalVDBBlast::Run(void)
                        CRef<CSearchResultSet> retval;
                        if(m_pssm.Empty()){
                                CRef<IQueryFactory>     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<CSearchResultSet> CLocalVDBBlast::Run(void)
                                if(m_pssm.Empty()){
                                        Int4 num_exts = 0;
                                        CRef<IQueryFactory>     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<CSearchResultSet> 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 (file)
index ca66da5..0000000
+++ /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()
index 4d997baba64d7fc8f792691f2290673c41dfe4d4..c1de3421db63e865d7c988920a95347a8aa3fb61 100644 (file)
@@ -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 (executable)
index 4d7ea11..0000000
+++ /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
index 8ce84c652efc2914d8900352713da370e1761154..1fb223c70532b04494adbcb881be72334089b6c0 100644 (file)
@@ -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
index 5d49b264450253a0c2ba19283c5d5057ac1e9657..3570388dcff31c642edce01b0f6256ec61d5d390 100644 (file)
@@ -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");
index ced6e1f43b5ee7a4cb46bda23ddf0c18237bb5f7..a7ce4c1ad2c6c6ac245df90aeb27bf0029eefe95 100644 (file)
@@ -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<CSeqDB> 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<CSeqDB> 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 (executable)
index c025b4c..0000000
+++ /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 <ncbi_pch.hpp>
-#include <corelib/ncbiapp.hpp>
-#include <corelib/ncbistre.hpp>
-#include <serial/iterator.hpp>
-#include <algo/blast/api/version.hpp>
-#include <algo/blast/api/remote_blast.hpp>
-#include <algo/blast/blastinput/blast_input_aux.hpp>
-#include <algo/blast/format/blast_format.hpp>
-#include <algo/blast/api/objmgr_query_data.hpp>
-#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<CVersion> 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<CBlastQueryVector> x_ExtractQueries(bool query_is_protein);
-
-    /// Build the query from a PSSM
-    /// @param pssm PSSM to inspect [in]
-    CRef<CBlastSearchQuery> 
-    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<CScope> scope);
-
-    /// Our link to the NCBI BLAST service
-    CRef<CRemoteBlast> m_RmtBlast;
-
-    /// The source of CScope objects for queries
-    CRef<CBlastScopeSource> m_QueryScopeSource;
-
-    /// Tracks whether results come from an archive file.
-    bool m_LoadFromArchive;
-};
-
-void CBlastReportApp::Init()
-{
-    HideStdArgs(fHideLogfile | fHideConffile | fHideFullVersion | fHideXmlHelp | fHideDryRun);
-
-    unique_ptr<CArgDescriptions> 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<CScope> 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<CSeq_loc> seqloc(new CSeq_loc);
-    seqloc->SetWhole().Assign(*bioseq.GetFirstId());
-    return SSeqLoc(seqloc, scope);
-}
-
-CRef<CBlastSearchQuery>
-CBlastReportApp::x_BuildQueryFromPssm(const CPssmWithParameters& pssm)
-{
-    if ( !pssm.HasQuery() ) {
-        throw runtime_error("PSSM has no query");
-    }
-    CRef<CScope> 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<CBlastSearchQuery> retval;
-    retval.Reset(new CBlastSearchQuery(*ssl.seqloc, *ssl.scope));
-    _ASSERT(ssl.scope.GetPointer() == scope.GetPointer());
-    return retval;
-}
-
-CRef<CBlastQueryVector>
-CBlastReportApp::x_ExtractQueries(bool query_is_protein)
-{
-    CRef<CBlast4_queries> b4_queries = m_RmtBlast->GetQueries();
-    _ASSERT(b4_queries);
-    const size_t kNumQueries = b4_queries->GetNumQueries();
-
-    CRef<CBlastQueryVector> 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<CScope> scope = m_QueryScopeSource->NewScope();
-        ITERATE(CBlast4_queries::TSeq_loc_list, seqloc,
-                b4_queries->GetSeq_loc_list()) {
-            _ASSERT( !(*seqloc)->GetId()->IsLocal() );
-            CRef<CBlastSearchQuery> query(new CBlastSearchQuery(**seqloc,
-                                                                *scope));
-            retval->AddQuery(query);
-        }
-    } else if (b4_queries->IsBioseq_set()) {
-        CTypeConstIterator<CBioseq> itr(ConstBegin(b4_queries->GetBioseq_set(),
-                                                   eDetectLoops));
-        CRef<CScope> scope(new CScope(*CObjectManager::GetInstance()));
-        for (; itr; ++itr) {
-            SSeqLoc ssl = x_QueryBioseqToSSeqLoc(*itr, scope);
-            CRef<CBlastSearchQuery> 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<CBlastOptionsHandle> 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<CBlastQueryVector> queries = x_ExtractQueries(Blast_QueryIsProtein(p)?true:false);
-    CRef<CScope> scope = queries->GetScope(0);
-    _ASSERT(queries);
-
-    CRef<CBlastDatabaseArgs> db_args(new CBlastDatabaseArgs());  // FIXME, what about rpsblast?
-    int filtering_algorithm = -1;
-    if (m_RmtBlast->IsDbSearch())
-    {
-        CRef<CBlast4_database> db = m_RmtBlast->GetDatabases();
-        _ASSERT(db);
-        _TRACE("Fetching results for " + Blast_ProgramNameFromType(p) + " on "
-               + db->GetName());
-        filtering_algorithm = m_RmtBlast->GetDbFilteringAlgorithmId();
-        CRef<CSearchDatabase> search_db(new CSearchDatabase(db->GetName(), db->IsProtein()
-                              ? CSearchDatabase::eBlastDbIsProtein
-                              : CSearchDatabase::eBlastDbIsNucleotide));
-        db_args->SetSearchDatabase(search_db);
-    }
-    
-    CRef<CLocalDbAdapter> db_adapter;
-    InitializeSubject(db_args, opts_handle, true, db_adapter, scope);
-
-
-    CBlastFormat formatter(opts, *db_adapter,
-                           fmt_args.GetFormattedOutputChoice(),
-                           static_cast<bool>(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<CSearchResultSet> 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 (executable)
index 5d436dd..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-[Templates]
-DFL_TABLE_ROW = <tr id=\"dtr_<@dflnFrm_id@>\" ind=\"<@dfln_blast_rank@>\" class=\"<@trtp@> dflLnk\" > \
-<td class=\"l c0\"><span class=\"ind\"><@dfln_blast_rank@></span><input type=\"checkbox\" id=\"chk_<@dfln_blast_rank@>\" class=\"cb\" name=\"getSeqGi\" value=\"<@dfln_id@>\" onclick=\"configDescrLinks(event,this)\" /><label for=\"chk_<@dfln_blast_rank@>\" class=\"accsb\">Select seq <@dflnAccs@></label></td> \
-<td class=\"lim l c2\"><div class=\"lim n\"><a title=\"Go to alignment for <@full_dfln_defline@>\" class=\"deflnDesc\" hsp=\"<@dfln_hspnum@>\" len=\"<@dfln_alnLen@>\" ind=\"<@dfln_blast_rank@>\" accs=\"<@dflnAccs@>\" seqFSTA=\"<@dflnFASTA_id@>\" gi=\"<@dfln_id@>\"  seqID=\"<@dflnFrm_id@>\" id=\"deflnDesc_<@dfln_blast_rank@>\" onclick=\"DisplayAlignFromDescription(this);\" href=\"#alnHdr_<@dflnFrm_id@>\"><@dfln_defline@></a></div></td> \
-<td class=\"c3\"><@score_info@></td><td class=\"c4\"><@total_bit_string@></td><td class=\"c5\"><@percent_coverage@>%</td><td class=\"c6\"><@evalue_string@></td><td class=\"c7\"><@percent_identity@>%</td> \
-<td class=\"c1 l lim\"><@seq_info@></td></tr>
-DFL_TABLE_SCORE_INFO = <@bit_string@>
-DFL_TABLE_SEQ_INFO = <a href=\"<@dfln_url@>\" class=\"dflSeq\" target=\"lnk<@dfln_rid@>\" title=\"Show report for <@dfln_seqid@>\"><@dfln_gi@><@dfln_seqid@></a>
-
-BLAST_ALIGN_HEADER = \
-<div class=\"alnHdr cnf\" id=\"alnHdr_<@alnSeqGi@>\" seqID=\"<@alnSeqGi@>\" accs=\"<@firstSeqID@>\"> \
-<a name=\"<@alnSeqGi@>\"></a> \
-<a href=\"#dlgDwnl_<@alnSeqGi@>\" 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@>\"><span>Download</span></a> \
-<div id=\"dlgDwnl_<@alnSeqGi@>\" class=\"popDl\"> \
-<div><input type=\"radio\"  name=\"dwn_<@alnSeqGi@>\" checked=\"checked\" id=\"dwFST_<@alnSeqGi@>\" fstaDWType=\"complete\" sbFunc=\"initDownLoadFSTA\" /><label  class=\"shownInl\" for=\"dwFST_<@alnSeqGi@>\">FASTA (complete sequence)</label></div> \
-<div><input type=\"radio\"   name=\"dwn_<@alnSeqGi@>\" id=\"dwFSTAl_<@alnSeqGi@>\"  fstaDWType=\"range\" sbFunc=\"initDownLoadFSTA\" /><label  class=\"shownInl\" for=\"dwFSTAl_<@alnSeqGi@>\">FASTA (aligned sequences)</label></div> \
-<div class=\"<@dwGnbn@>\"><input type=\"radio\" name=\"dwn_<@alnSeqGi@>\"  id=\"dwGenBank_<@alnSeqGi@>\" getGi=\"<@alnSeqGi@>\" sbName=\"id\" url=\"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?rettype=gb&retmode=text\" /><label  class=\"shownInl\" for=\"dwGenBank_<@alnSeqGi@>\">GenBank (complete sequence)</label></div> \
-<div> \
-<button class=\"cfg\" id=\"dw_cont_<@alnSeqGi@>\">Continue</button> \
-<button class=\"cfg cnc\" >Cancel</button> \
-</div> \
-</div> <!-- dsDownload --> \
-<span class=\"csLinks\" id=\"csLinks_<@alnSeqGi@>\"><@alnCustomLinks@></span> \
-<@sortInfo@> \
-<span class=\"alnSeqLinks\"> \
-<a class=\"gbd toolsCtr navNext\" ref=\"ordinalpos=<@aln_ord_pos@>&currseq=<@alnSeqGi@>\" id=\"alnNxt_<@alnSeqGi@>\" onclick=\"goToNextAlign('dtr_<@alnSeqGi@>',true);\"><span>Next</span></a> \
-<a class=\"gbd toolsCtr navPrev\" ref=\"ordinalpos=<@aln_ord_pos@>&currseq=<@alnSeqGi@>\" id=\"alnPrv_<@alnSeqGi@>\" onclick=\"goToNextAlign('dtr_<@alnSeqGi@>',false);\"><span>Previous</span></a> \
-<a class=\"gbd toolsCtr navBack\" title=\"Go to definition line for <@firstSeqID@>\" id=\"alnDsc_<@alnSeqGi@>\" onclick=\"goToDefLine('dtr_<@alnSeqGi@>');\" href=\"#dtr_<@alnSeqGi@>\"><span>Descriptions</span></a> \
-</span> \
-</div> \
-<div class=\"oneSeqAln\" id=\"aln_<@alnSeqGi@>\"> \
-<div id=\"dln_<@alnSeqGi@>\"> \
-<@aln_deflines@> \
-</div> \
-<div class=\"relInf\" id=\"relInf_<@alnSeqGi@>\"><label>Related Information</label><@alnLinkOutLinks@></div> \
-<div class=\"alnAll\" id=\"alnAll_<@alnSeqGi@>\">
-
-
-BLAST_ALIGN_PARAMS = \
-<div id=\"hd_<@alnSeqGi@>_<@aln_curr_num@>\"> \
-<div class=\"dflLnk hsp\"><span class=\"alnRn\"><label>Range <@aln_curr_num@>: <@fromHSP@> to <@toHSP@></label><span class=\"<@multiHSP@>\" id=\"rng_<@alnSeqGi@>\"><@alnHSPLinks@></span></span> \
-<span id=\"hsp<@alnSeqGi@>_<@aln_curr_num@>\" class=\"alnParLinks\"> \
-<a class=\"gbd toolsCtr navNext\" <@aln_hide_next@> title=\"Go to next match #<@aln_next_num@> for <@firstSeqID@>\" onmouseover=\"scan(this)\" ref=\"ordinalpos=<@aln_curr_num@>&currseq=<@alnSeqGi@>\" onclick=\"goToNextHSP(this,true)\"><span>Next Match</span></a> \
-<a class=\"gbd toolsCtr navPrev\" <@aln_hide_prev@> title=\"Go to previous match #<@aln_prev_num@> for <@firstSeqID@>\" onmouseover=\"scan(this)\" ref=\"ordinalpos=<@aln_curr_num@>&currseq=<@alnSeqGi@>\" onclick=\"goToNextHSP(this,false)\"><span>Previous Match</span></a> \
-<a class=\"gbd toolsCtr navBack <@aln_hide_fst@>\"  href=\"#hsp<@alnSeqGi@>_1\" title=\"Go to first match for <@firstSeqID@>\"><span>First Match</span></a> \
-</span> \
-</div> \
-<@align_params@> \
-<div class=\"dflLnk aln_feat <@aln_feat_show@>\"><label>Features:</label><div><@all_aln_features@></div></div> \
-</div>
-
-ALIGN_PARAMS_NUC = \
-<table class=\"alnParams\"> \
-<caption class=\"hdnHeader\">Alignment statistics for match #<@aln_curr_num@></caption> \
-<tr> \
-<th>Score</th><th>Expect</th><th>Identities</th><th>Gaps</th><th>Strand</th><th class=\"aln_frame <@aln_frame_show@>\">Frame</th> \
-</tr> \
-<tr> \
-<td><@aln_score@> bits(<@aln_score_bits@>)</td> \
-<td><@aln_eval@><span class=\"sumN <@sumNshow@>\">(<@aln_sumN@>)</span></td> \
-<td><@aln_match@>(<@aln_ident@>%)</td> \
-<td><@aln_gaps@>(<@aln_gaps_prc@>%)</td> \
-<td><@aln_strand@></td> \
-<td class=\"aln_frame <@aln_frame_show@>\"><@aln_frame@></td> \
-</tr></table>
-
-
-ALIGN_PARAMS_PROT = \
-<table class=\"alnParams\"> \
-<caption class=\"hdnHeader\">Alignment statistics for match #<@aln_curr_num@></caption> \
-<tr> \
-<th>Score</th><th>Expect</th><th class=\"cbs_md <@aln_meth_hide@>\">Method</th><th>Identities</th><th>Positives</th><th>Gaps</th><th class=\"aln_frame <@aln_frame_show@>\">Frame</th> \
-</tr> \
-<tr> \
-<td><@aln_score@> bits(<@aln_score_bits@>)</td> \
-<td><@aln_eval@><span class=\"sumN <@sumNshow@>\">(<@aln_sumN@>)</span></td> \
-<td class=\"<@aln_meth_hide@>\"><@aln_meth@></td> \
-<td><@aln_match@>(<@aln_ident@>%)</td> \
-<td><@aln_pos@>(<@aln_pos_prc@>%)</td> \
-<td><@aln_gaps@>(<@aln_gaps_prc@>%)</td> \
-<td class=\"aln_frame <@aln_frame_show@>\"><@aln_frame@></td> \
-</tr> \
-</table>
-
-
-SORT_ALIGNS_SEQ = \
-<div class=\"seqlinks alnDflLn alnSortSeq\"><label>Sort by:</label> \
-<select id=\"sa_<@alnSeqGi@>\" onchange=\"SortHSPAlnSel(event,this)\"> \
-<option  value=\"0\">E value</option> \
-<option  value=\"1\"> Score</option> \
-<option  value=\"3\">Percent identity</option> \
-<option  value=\"2\">Query start position</option> \
-<option  value=\"4\">Subject start position</option> \
-</select> \
-</div>
-
-ALN_FEATURES = <@aln_feat_info@>
-
-ALN_FEATURES_LINK = <a href=\"<@aln_feat_url@>\"><@aln_feat@></a>
-
-ALN_DEFLINE_ROW = \
-<div class=\"dlfRow\"> \
-<@alnTitle@> \
-<div><label>Sequence ID: </label><@seq_info@><span class=\"<@frstDfl@> r\"><label>Length: </label><@alnSeqLength@><label>Number of Matches: </label><@alnHspNum@></span></div> \
-</div>
-
-ALN_DEFLINE_TITLES_LNK = <h4><a href=\"#\" class=\"jtg resArrowLinkW ui-ncbitoggler\" data-jig=\"ncbitoggler\" title=\"Sequences identical to <@firstSeqID@>\" >See <@titleNum@> more title(s)</a></h4>
-
-ALN_DEFLINE_TITLES = \
-<div class=\"ui-helper-reset\" aria-live=\"assertive\" >  \
-<div class=\"ui-ncbitoggler-slave\"> \
-<@seqTitles@> \
-</div> \
-</div>
-
-ALN_DEFLINE_SEQ_INFO = <a href=\"<@aln_url@>\" target=\"lnk<@aln_rid@>\" title=\"Show report for <@aln_seqid@>\"><@aln_gi@><@aln_seqid@></a>
-
-BLAST_ALIGN_ROWS = \
-<div id=\"ar_<@alnSeqGi@>_<@aln_curr_num@>\"> \
-<pre> \
-<@align_rows@> \
-</pre> \
-</div>
-
-BLAST_ALIGN_ROWS_LST = \
-<div id=\"ar_<@alnSeqGi@>_<@aln_curr_num@>\"> \
-<pre> \
-<@align_rows@> \
-</pre> \
-</div> \
-</div> <!-- alnAll_<@alnSeqGi@> --> \
-</div> <!-- aln_<@alnSeqGi@> --> 
-
-[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.
index 9ee6f2876e7023e238c673f6d0b63befb8f11e8a..88829b74892814383a6f83c8e5f15cd1401fe98f 100644 (file)
@@ -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());
index 2021052d10271da993d51db706f13ade8d878bec..153b9f355953b53f5a86cb52fc718a4ab6a9658a 100644 (file)
@@ -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 <algo/blast/blastinput/blastp_args.hpp>
 #include <algo/blast/api/objmgr_query_data.hpp>
 #include <algo/blast/format/blast_format.hpp>
+#include <util/profile/rtprofile.hpp>
 #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<CBlastQueryVector> query_batch(input.GetNextSeqBatch(*scope));
             CRef<IQueryFactory> queries(new CObjMgr_QueryFactory(*query_batch));
 
             SaveSearchStrategy(args, m_CmdLineArgs, queries, m_OptsHndl);
 
             CRef<CSearchResultSet> results;
-
+           BLAST_PROF_STOP( APP.LOOP.PRE );
             if (m_CmdLineArgs->ExecuteRemotely()) {
                 CRef<CRemoteBlast> 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);
index 200f6d5e63ac87ca60ac045be864d9b88d977807..65ff7ba8751c66113e10bfa7a7da94bb7aac831d 100644 (file)
@@ -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 <algo/blast/blastinput/blastx_args.hpp>
 #include <algo/blast/api/objmgr_query_data.hpp>
 #include <algo/blast/format/blast_format.hpp>
+#include <util/profile/rtprofile.hpp>
 #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<CBlastQueryVector> query_batch(input.GetNextSeqBatch(*scope));
             CRef<IQueryFactory> queries(new CObjMgr_QueryFactory(*query_batch));
 
             SaveSearchStrategy(args, m_CmdLineArgs, queries, m_OptsHndl);
 
             CRef<CSearchResultSet> results;
+           BLAST_PROF_STOP( APP.LOOP.PRE );
 
             if (m_CmdLineArgs->ExecuteRemotely()) {
                 CRef<CRemoteBlast> 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;
 }
 
index dbd44b4c7dab2eb7e0ecc346381bccc8236e5e9b..bb21c8f4e26db15a15ff1cd9040c2b603063702f 100644 (file)
@@ -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()
index 5808b1a1670877f196fb3d88f42ffbb538cba753..bdef8d2877e19afbab0b3085484820497bcbb0d5 100755 (executable)
@@ -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
index f62c92afc7444708872945879595f16c00e6eb32..a12200bb50081b033c922c13c57f2a19b39e78f8 100644 (file)
@@ -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<bool>(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"]) {
index 451e35250e815f958d33b26d837f1fc316275946..1135fe06a9217f49135ee2378d3eb1b620b070f5 100644 (file)
@@ -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
index 0061285320d254a9a3f25f90b1a0d2085eb49cca..7fdd8d997b1d74425f85444c54bd09103fb1fbaa 100644 (file)
@@ -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<CVersion> 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]);
index a5e407b1dc83f6c389d2a88d16a1721a5d3ccca7..f9be41d294cc2376efe983fa6c1f7c663f775f18 100644 (file)
@@ -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<CSearchResultSet> 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()));
index f55a2cb99f1c4ca758dcf665539dfb6808051496..7471cab80e48414658b681d502d3fa9c89e7a562 100644 (file)
@@ -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<CFormattingArgs> fmt_args(m_CmdLineArgs->GetFormattingArgs());
         CBlastFormat formatter(opt, vecDbInfo,
@@ -263,7 +264,7 @@ int CVDBTblastnApp::Run(void)
 
                // Run local Blast
                CRef<CSearchResultSet> 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<CSearchResultSet> 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)){
index 5dc99bc5c3a6302e3ba2e78da0263a5e877b88ef..38ae3201b36f4a757eaac5d437a46062206ecea6 100644 (file)
@@ -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})"
index 4e8204acd8a6ba651adf667f7a55a2ee7c956a04..b4c758c18284698225e2709c82b09d77c6782e95 100644 (file)
@@ -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)
index 8e5d68d034bc7a6c8fce82811a230f8dea486159..e33c91ee83e02662db808a78ce700f1d07456fd6 100644 (file)
@@ -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 $
 #############################################################################
 
 ##
 #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()
index 630375b8a5b42cb0851adcba6cbaa5b501c82c01..514e72eaa013b0d11f760d162a9c5e1e9ef39d19 100644 (file)
@@ -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})
index 8f9bab8ecdad378e164b9db4e4a3a87801cf139b..6f26a341cbd3446d37c8f6671d39fb4142c2adde 100644 (file)
@@ -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)
index 4a1420984b4bcbd5fc3a4333cf758325b65e4c5d..e47123a82fe5eeb5d64fc00eb50567b7e21fbbfd 100644 (file)
@@ -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("#############################################################################")
 
index 5ad36be52bc1d6281f50cdfbd145e035c3105f33..381be5c6d8f0cd5b7550d64e6070e170999fa785 100644 (file)
@@ -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")
index 0881e263150c13e83706d79ebfccc349c9ef454b..3b872bdc505b2ef2db151053d24d819b7d4b418e 100644 (file)
@@ -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 "")
index 0f40e4c2d1ff986318730fb7545c74c89fdeac32..a30064e96d5e9217241242ea16542e8cfc85598a 100644 (file)
@@ -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)
index 1be046d7c4cbc8d686caae42128f16da8e7ed4d3..d1742c40d8aca3153302c9042f89d361b0451327 100644 (file)
@@ -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()
 
 ##############################################################################
index 3ce392a45c276ee6bfa04464faeee6bbb9abe714..481d85d3520d197d98e07fe77b425dcece718ae6 100644 (file)
@@ -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)
index 902e465b18e1468c2d9d4f55676ecece9acee7fc..fb75762e515e218f5a6d803afb78977c6768137b 100755 (executable)
@@ -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
index e7b9608074a41e1570961b0c201a88ed6a5adcad..fbdcb944462ad6701f4d2dcfc7147442d4721ada 100644 (file)
@@ -1,7 +1,7 @@
 @echo off\r
 setlocal ENABLEDELAYEDEXPANSION\r
 REM #########################################################################\r
-REM  $Id: cmake-cfg-vs.bat 665658 2023-04-11 13:43:13Z gouriano $\r
+REM  $Id: cmake-cfg-vs.bat 681357 2024-04-08 18:49:00Z ivanov $\r
 REM  Configure NCBI C++ toolkit for Visual Studio using CMake build system.\r
 REM  Author: Andrei Gourianov, gouriano@ncbi\r
 REM #########################################################################\r
@@ -17,11 +17,18 @@ set prebuilds=
 REM #########################################################################\r
 set VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere"\r
 if "%CMAKE_CMD%"=="" (\r
-  for /f "tokens=* USEBACKQ" %%i IN (`%VSWHERE% -latest -property installationPath`) do (\r
-    set CMAKE_CMD=%%i\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe\r
+  where cmake >NUL 2>&1\r
+  if errorlevel 1 (\r
+    for /f "tokens=* USEBACKQ" %%i IN (`%VSWHERE% -latest -property installationPath`) do (\r
+      set CMAKE_CMD=%%i\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe\r
+    )\r
+  ) else (\r
+    set CMAKE_CMD=cmake\r
   )\r
 )\r
-if not exist "%CMAKE_CMD%" (\r
+echo CMake: "%CMAKE_CMD%"\r
+"%CMAKE_CMD%" --version\r
+if errorlevel 1 (\r
   echo ERROR: CMake is not found 1>&2\r
   exit /b 1\r
 )\r
index e809e71acd9f6c290afe3bcc3aa2d79444a4c4d0..6dfa037185b1ea6a07cf0f40cc81cb5150b291d7 100755 (executable)
@@ -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
index 5c29056d917ee8842ad8a3c69e198adfcb9989fd..c7bf19ccdeb1a2aaf177d9f32381946853110dd7 100644 (file)
@@ -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
index f5e06fc89896fd0408c36bb4bdbd0958b40e0618..48cdd6742201cac131802e6097d1e767c158fa4b 100644 (file)
@@ -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
+
index 473151bc8fb66a76253de05d7b205ae0acc6cd49..6bc23916edcfeb72b7a801eb8ebe99bf1c69c177 100644 (file)
@@ -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 (file)
index 0000000..2785e33
--- /dev/null
@@ -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 (file)
index 0000000..6aaebb2
--- /dev/null
@@ -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++")
index 56ec3e9415d902047ee4fb4827aea08a281b5de3..1380fede62c9a9f1f4258ed697751954ab02e7e6 100644 (file)
@@ -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}
         ;;
index 704ecb6dd2e507e50250faa1bac7a2063a40f2be..f3d5131a79dc86978fae6a3e1dafe8390b43366d 100755 (executable)
@@ -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"
 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 <re2/re2.h>
+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"
index 07375eee934193548e8b9002f432d259163d2d04..8b845cebaad3452d0829803870e17fdfd1b97a65 100644 (file)
@@ -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.pb.h>]],
        [[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.h>], [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.h>], [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"
index 7dcb5cf86b6774d9bccbb2be49cfc1e35f2127c5..85e45d69b9696cabf926727a4e4e23af916bd322 100644 (file)
@@ -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`
index 68e69e405ee6c7285064b68327d2111fe46aeda0..75249069675e6eb182137522df12405f18d3e2f7 100644 (file)
@@ -1 +1 @@
-2.15.0
+2.16.0
index 86408890079fb316e5dc6e628ef51b5a932b327b..805f077e6db6788c7e80ea5cbc1e8b13b3c3c7d7 100644 (file)
@@ -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]
index 25bb99a76b2110b77ec724b322c0f329a985a83b..dd267a0bc48736bf6cfd34c26430db0d12703715 100644 (file)
@@ -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
index f08cf6ef4985774e202e1d8cbe40f1c230d899a1..1bd096b06568ceea5408976edfbddd43a2624a3c 100644 (file)
@@ -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<string> names;
             env.Enumerate(names);
+            SEnvSetter env_setter;
             ITERATE(list<string>, it, names) {
                 rctx.AddPassThroughProperty(*it, env.Get(*it));
+                env_setter(*it, env.Get(*it));
             }
 
             PushDiagPostPrefix(env.Get(m_DiagPrefixEnv).c_str());
index 6c4d98d9a5015e9404c8c67ede3e1df66a4c491b..9a3c411c6b75dc0e830a611530a1239b63a0963f 100644 (file)
@@ -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<unsigned, string> m_Data;
 };
 
-SSocketAddress::SHost::SHost(const string& h) :
+SSocketAddress::SHost::SHost(const string& h, EName n) :
+    name(n == EName::eOriginal ? h : std::optional<string>()),
     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<void> GetSingleServer(const string& service_name) const
+    shared_ptr<void> 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<CServiceDiscovery::TServers>(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)
 {
 }
index f08a21f595f355ed78894c270d821dd1009fc990..836367cea74992cac1df75154d42ec384b2a98dd 100644 (file)
@@ -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
index c909f654c645ad27fa8cb5b41371e4bc023a2d9b..74bae91f5e3c0dc83a722c2ededb45c7f3adda70 100644 (file)
@@ -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
  */
 
 /*
 #if defined(MBEDTLS_AESNI_HAVE_CODE)
 
 #if MBEDTLS_AESNI_HAVE_CODE == 2
-#if !defined(_WIN32)
+#if defined(__GNUC__)
 #include <cpuid.h>
+#elif defined(_MSC_VER)
+#include <intrin.h>
+#else
+#error "`__cpuid` required by MBEDTLS_AESNI_C is not supported by the compiler"
 #endif
 #include <immintrin.h>
 #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++) {
index aa5e3a2b3a24441531f7022e650831427d1e9222..7ff747d0404896a7b7c9d7998e3828f999379d93 100644 (file)
@@ -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.
index d958ef615ddc91a8c029f2043e460eb45d8384aa..c9441057c68785bc919f08a18ab04294e942fca7 100644 (file)
@@ -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
  */
 
 /*
index 6a8cd6c54547ef77c654ce02f0ad9ee5a34b0c01..c7f7f0b33a5b8be3b60acbebf8b967a5f8dadf2c 100644 (file)
@@ -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"
index 0b487dceaabc4fdcf15a9dc3ccc279e47c3abeff..0147c49f688aed4e5bef45b9f4ed4e5d2545228f 100644 (file)
@@ -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));
index 41706106424697d5b41ce96f3848a7f4f1aa42f5..1f1a90a9374477399cfa80d365da67425443eaf3 100644 (file)
@@ -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"
index 5dca3a9177cffd48840c49d740644f1cd445170f..fadd9e9cc2a2a3bd56c68beac71766131b160eb8 100644 (file)
@@ -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 <limits.h>
 #include <string.h>
@@ -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 (file)
index 0000000..5435ebb
--- /dev/null
@@ -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 */
index f56bb65bfd1ea9de0deaef5e74b806c17207a213..d90456b961a0a2f8c3c94c325d0cf529de0e7298 100644 (file)
@@ -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.
index ce034d74fb601da1346a34de81caaebfe5074227..bd76ea874f7f2b308d5b3b9bc6c4473bdb601501 100644 (file)
@@ -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
index 2d2695e97905cb3e15979059cf502c4b685340ef..2ba21c7e71d82c0af2aeafda2aae6357bc22a9c9 100644 (file)
@@ -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 <string.h>
 
@@ -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);
index af1f98cb029606ae3dafd564da3cfeaa64f829c9..79856cd6cf905c419c35d6bfbfb8779d78d0c04e 100644 (file)
@@ -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"
 
 /* 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 */
 
 #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"                                                                 \
-    "9Qd9GeArejl1GDVh2lLV1bHt0cPtfbh5h/5zVpAVaFpqtSPMrElp50Rntn9et+JA\r\n" \
-    "7VOyboR+Iy2t/HU4WvA687k3Bppe9GwKHjHhtl//8xFKwZr3Xb5yO5JUP8AUctQq\r\n" \
-    "Nb8CLlZyuUC+52REAAthdWgsX+7dJO4yabzUcQ22Tp9JSD0hiL43BlkWYUNK3dAo\r\n" \
-    "PZlmiptjnzVTjg1MxsBSydZinWOLBV8/JQgxSPo2yD4uEfig28qbvQ2wNIn0pnAb\r\n" \
-    "GxnSAOazkongEGfvcjIIs+LZN9gXFhxcOh6kc4Q/c99B7QWETwLLkYgZ+z1a9VY9\r\n" \
-    "gEU7CwCxYCD+h9hY6FPmsK0/lC4O7aeRKpYq00rPPxs6i7phiexg6ax6yTMmArQq\r\n" \
-    "QmK3TAsJm8V/J5AWpLEV6jAFgRGymGGHnof0DXzVWZidrcZJWTNuGEX90nB3ee2w\r\n" \
-    "PXJEFWKoD3K3aFcSLdHYr3mLGxP7H9ThQai9VsycxZKS5kwvBKQ//YMrmFfwPk8x\r\n" \
-    "vTeY4KZMaUrveEel5tWZC94RSMKgxR6cyE1nBXyTQnDOGbfpNNgBKxyKbINWoOJU\r\n" \
-    "WJZAwlsQn+QzCDwpri7+sV1mS3gBE6UY7aQmnmiiaC2V3Hbphxct/en5QsfDOt1X\r\n" \
-    "JczSfpRWLlbPznZg8OQh/VgCMA58N5DjOzTIK7sJJ5r+94ZBTCpgAMbF588f0NTR\r\n" \
-    "KCe4yrxGJR7X02M4nvD4IwOlpsQ8xQxZtOSgXv4LkxvdU9XJJKWZ/XNKJeWztxSe\r\n" \
-    "Z1vdTc2YfsDBA2SEv33vxHx2g1vqtw8SjDRT2RaQSS0QuSaMJimdOX6mTOCBKk1J\r\n" \
-    "9Q5mXTrER+/LnK0jEmXsBXWA5bqqVZIyahXSx4VYZ7l7w/PHiUDtDgyRhMMKi4n2\r\n" \
-    "iQvQcWSQTjrpnlJbca1/DkpRt3YwrvJwdqb8asZU2VrNETh5x0QVefDRLFiVpif/\r\n" \
-    "tUaeAe/P1F8OkS7OIZDs1SUbv/sD2vMbhNkUoCms3/PvNtdnvgL4F0zhaDpKCmlT\r\n" \
-    "P8vx49E7v5CyRNmED9zZg4o3wmMqrQO93PtTug3Eu9oVx1zPQM1NVMyBa2+f29DL\r\n" \
-    "1nuTCeXdo9+ni45xx+jAI4DCwrRdhJ9uzZyC6962H37H6D+5naNvClFR1s6li1Gb\r\n" \
-    "nqPoiy/OBsEx9CaDGcqQBp5Wme/3XW+6z1ISOx+igwNTVCT14mHdBMbya0eIKft5\r\n" \
-    "X+GnwtgEMyCYyyWuUct8g4RzErcY9+yW9Om5Hzpx4zOuW4NPZgPDTgK+t2RSL/Yq\r\n" \
-    "rE1njrgeGYcVeG3f+OftH4s6fPbq7t1A5ZgUscbLMBqr9tK+OqygR4EgKBPsH6Cz\r\n" \
-    "L6zlv/2RV0qAHvVuDJcIDIgwY5rJtINEm32rhOeFNJwZS5MNIC1czXZx5//ugX7l\r\n" \
-    "I4sy5nbVhwSjtAk8Xg5dZbdTZ6mIrb7xqH+fdakZor1khG7bC2uIwibD3cSl2XkR\r\n" \
-    "wN48lslbHnqqagr6Xm1nNOSVl8C/6kbJEsMpLhAezfRtGwvOucoaE+WbeUNolGde\r\n" \
-    "P/eQiddSf0brnpiLJRh7qZrl9XuqYdpUqnoEdMAfotDOID8OtV7gt8a48ad8VPW2\r\n" \
+    "etQ3xgGLbuYF9vR1km03TH5fwfly1hOlix0PtfQ+t9HG065vTtSEHYc/OyHwdy79\r\n" \
+    "NCLX5RUrPh06E/XlKzMNVHAXqkwFnIwNzRLsOozeP1L7iZEZb9QMeiN5Org+btCO\r\n" \
+    "bylXPB4YirfuE7GSJalWY/pq3FQtD33zTIKmNhXfVj3sbwGI/8D9XjaKUb8PODOB\r\n" \
+    "skOalmx6RvYRvg0lmRxB3+T3wejIsrrDPweYqte9B6dVHIVG1ZmvoA6/wnKZZZeV\r\n" \
+    "sjj8OpL3OwUBrjuGSknE9Rs6kCuSCbHOYVK8VzcZmCYpie0TFnb3Sk8M6vjfW+45\r\n" \
+    "U7WUMlSAPxKH6lJDzWdwHqLvsVJwuNnaAaBXg9/8U/rzQEWuq8Ar3s8fw2Jg3F1G\r\n" \
+    "L6N5ZAEfCz3Sa0N9WKafR/RSQj+rq8Z3w4POAafhbzk249uo5K8B1Z3cQwLxeXIl\r\n" \
+    "UbRQz1TZy4oNTfQzCahYruPNyvwgTkfwAFFvbLAdaiJd2ZtLBoqYE64TYakYnvcC\r\n" \
+    "itim1bmySIKoxlMfBGFmMuF03epT0pSx701jlGzGi0l0m16NEjoVxDwo5j93SmiM\r\n" \
+    "sQdjC1lOGk2iCLkphIQqHFjFJYWjvh1UUIqWZf+ZWOOxlf4x9a1pUVj6FvtECxNB\r\n" \
+    "/mA/m4Iq4LAuVXHE1MpHeq067lJ6wWlrsb2WVmiNGfQ2AC7fMtpcPuunBVT9NV1m\r\n" \
+    "1rbDzIgLIWAzqz/cy3N8Q8vfxnrFtmNUyM191Zyq+YF14hIKWX9J1qR4LXwWAzVV\r\n" \
+    "UrC8IL4pA2mtRkW4qFsB0EmHAxO/cedDTPjVFty5WSzhNuvYZxX45HAkGIfK6d21\r\n" \
+    "7WHPhHG+zaaUTWMUVixB0IcKp6RecjYPFzBHS0YeX88Ue2cyT/90jMiQ9ssOgRrG\r\n" \
+    "ZJRJvZAc3TSCnY9sNPYoGrJPiZuCnlUj3ENNurYVy12ai0WFxwnNUZjRUhDS6hjm\r\n" \
+    "cDHD5TlI9MZ6M+Mb/Bw4Ig8HuTHOtQBYD9vhtXsG+B7H/j6cS+1umaKjrnG/kK4W\r\n" \
+    "R6YXwM2faAi+DwgjjoMXSzRqSTF8PdTIWbAXo3bc2qsXPTMBA8PEp4nb5scHZ4Ts\r\n" \
+    "EcBNp2jv0j4gBkRmGIab17cWMrlagjFy89DhqZUFwKdeZs+yJ92A5xstWxOUfpEP\r\n" \
+    "90T/bsp1G5d7WW5fl2TRJvYJNDM+djkKIh0zCkduiZ36oVM6nDdbjmXqjQXopeSD\r\n" \
+    "gtOourBRF8g99W0fW8QT+yPhP0Pkyz6EG8eQO6Zwh439xdoVwu9jUzQAPmZ0uNeR\r\n" \
+    "xTXXihYyv72z27rInjLiIPXL25K9eDVLlcSR3RyG7YYgjdQAL2VJDLcBz5jox1uQ\r\n" \
+    "0guoD5wmfu2FWLqYE7HeTYntdY53lCflwq0GHRMjrrsVpx+5VDQ6Yi47Ny9SWLcp\r\n" \
+    "fPI3iBkXuGRWupzs6N4pQdSO0dU28KfpMM5QvFoLIn67brCHEQij4dgFrCTYEyBX\r\n" \
+    "9+jiNImUFYUhAFuxvUbfZt4O/ABLIElvHLfJs1oYCmI/nWpvLFqXB5rnzPNfEi0H\r\n" \
+    "PGGe1Hj/t+CJIp/6ios3yNy2QtXO754TZH2UVu51Ykyig5PFjZVoUkbRvHQYcWfU\r\n" \
     "-----END RSA PRIVATE KEY-----\r\n"
 /* END FILE */
 
 
 /* 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 */
 
index 53f1d3916cee85b567553a6211bf57fbfb60e645..82b7b1d89f46becb9b6f162ba9eedc0554b8afba 100644 (file)
@@ -6,19 +6,7 @@
  * \author Daniel King <damaki.gh@gmail.com>
  *
  *  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"
index ceb429287b72257f00a3e5ac45ad966ad337ee8d..dd678f4c331d7d6418da2d150c69d7be578ca79a 100644 (file)
@@ -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 <string.h>
 
@@ -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);
index b72de80d0a98d6d19da5cc39a4f22499bda5f84e..0ba32bfe0dd2834f181a09f944e9f32eedea3d21 100644 (file)
@@ -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
  */
 
 /*
index 36f87c3005067a57df8b4f12f9c9865329976b15..37a2effc8f5c6e0059a2fbda78e996ceaac41dac 100644 (file)
@@ -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 <dejong@fox-it.com>
  *
  *  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 <stdlib.h>
 #include <string.h>
@@ -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;
index 737cf9776b954a2a8c55a56085d0a31b3c39eafe..5f8dde3f4a3bd5ba16690607053d21ebf4c46def 100644 (file)
@@ -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 <dejong@fox-it.com>
  *
  *  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"
index 0c07de6f2fcf9011ed82f0d2d75ef7ac3674a490..32a9a0e56682d865113ddb814fe6d52bf2af819c 100644 (file)
@@ -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
  */
 
 /*
index e162aa3cffe43d15687f899ee080f5faaa026fac..49e2c97ea049f396bc250c06883822d2ae9fd8b5 100644 (file)
@@ -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 */
index 527930129b9cdd9aef9aa960512ee23a7a594591..002ca491c6f5d8967bc81e9689f7767fda084e1c 100644 (file)
@@ -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++) {
index 402cf148b8be006e550acd50e6cb95e3220e127d..82e65cc0282693a68931d1beec60ad2b67973b11 100644 (file)
@@ -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
index c176b28ffdcec4030778747c7b0ef7a29751be2d..14e0bec5ea7a4b744b32aea408e56c2d9ecb3ada 100644 (file)
@@ -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
index 652c5cbc2806cd84048f749ff9d4722285ec8306..53987a22fff1e4bb5db099b3a7e99a1959356c40 100644 (file)
@@ -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 <limits.h>
 #include <string.h>
 
 #if defined(MBEDTLS_FS_IO)
index ab8b3524d4cf6c9302b4cad72d1c4765b71bb9c9..f2d8dced5f4b2a02bfee59c526426eb291ea4f6c 100644 (file)
@@ -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 <stdio.h>
 #include <string.h>
 
+/* 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);
 }
index 8cf346f81be43b63eb4eabf6b110e04c8ca9fdb0..afe72cec00e265bb6e23069e740202092d70a1d9 100644 (file)
@@ -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
index c6f955ee42685ae711c56870688b37ff27b87562..1a41b91a90b625e0bbf784d9441c62a9ae7eac64 100644 (file)
@@ -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
index 2007e1670cf85e23f8293a3d409e78182ad6a6e0..29a732a08fddab0ff1aa452ea4f0176e15ac60ae 100644 (file)
@@ -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
  */
 
index 42a65dcb59db5dfe6eca6265be9eabfc47423458..51aba0ed9a998e0618e13232a0630858837d10ce 100644 (file)
@@ -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) {
index 3728d1a580cb73e67a6240479a57c0b6704c7989..102c24ab2a9e3b1f50a590a80a2e22715e3196dd 100644 (file)
@@ -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) {
index 9051490b129f7b597bae7ebdbde19276e8d6c01b..cfe02b0d2c206aeaa1129ea73fedacce8d6a3cb8 100644 (file)
@@ -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) {
index 6ce4f64c1636dd62c3812237a07e60d65fb73fdf..61a1046f3a27cc4a784430c9d50e6fa1d1b452a5 100644 (file)
@@ -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)
     };
index 18815be08911870e54985d121a751a916c395987..b5a1f7ce7dff597d2736169ebf207e010b076068 100644 (file)
@@ -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);
index af78acc1bf54614c813f46cdcdb16506a8854e49..339dc0e038fc276bd35b24398a20d42006238e05 100644 (file)
@@ -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 <string.h>
 
index 3420616a06c694cd87656043ecc63bde33ac2bfb..f007f2d8d41657fb7b130ef0d28a88533acfb4e4 100644 (file)
@@ -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
index f4826c8b156a63dbdeb12365d321caccefca67e4..cb7ad57e45049e747dea0be5935436f07638c445 100644 (file)
@@ -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)
index 0c958c729ad902c17a3245c8006dcf0678452817..d3e773278fbbde887c576b396b2417791657e8d0 100644 (file)
@@ -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 <string.h>
 
@@ -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);
index c23cdad9a578f217418e84d7b3664947f1f0e9f4..3d1f6f48cef5e1e8621cf062b16f7dd4df25df85 100644 (file)
@@ -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.
index a3f071ecef4609566314458d78ffc8c86948d694..631ac24e53049bd21beea3147eabc72c4b0e7bab 100644 (file)
@@ -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"
 
index fabe00252a57513232edb77b5c5cad3c14a61f2e..ee8f8e3325389ee8a1956facbd7a2f517aa078e3 100644 (file)
@@ -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
  */
 
 /*
index fb2322a6bb9bfd79169716af092cb24b47380e9e..2623a42fed6f7b06d54be30a5d281360d2add0f9 100644 (file)
 
 /*
  *  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
index 6741dead05b462658695201b23d3da1d2100c2bc..93f067304d89f03139167509190b37b0b7639e03 100644 (file)
@@ -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
 #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
 
  * 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 */
index d116dda4e9d64567c8d1ba6eb20bd01bf3392051..1f813aa6bb6d23e6c2216500f949978c0e27777e 100644 (file)
@@ -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
index 9856a1cae7ee147af714bfc9985db8f888cdd13e..e360aa64c1e4e89f431165a5742a05d3f4030f67 100644 (file)
  */
 /*
  *  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()
index 540cdcc469472dfcba38ea1abfe51d09b05561c2..c676fd3662cd136e7c567cc68a6554c8e3536506 100644 (file)
@@ -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.
index a439268b0ea6d00235fe1a827b493c27c89c83a8..a12bf039befc9060f5027b21add16c38e1ef5ce5 100644 (file)
@@ -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.
index ec9c408f52800bc07f201f3b1706c8c07d3494f1..cc460471daf38cd7353ab8a197d68a239efa6043 100644 (file)
@@ -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
index 788ea21a8d6254795cffef171ac764416e7c3420..fb0ca15ffcc59f78979ebd6ccf536bb0e633bdc4 100644 (file)
@@ -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<sup>-2*\p rounds</sup>.
+ *                 at most 2<sup>-2*\p rounds </sup>.
  * \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
index 7936d2f8a49024cd03a031a9916e0ca9ce9bc589..7979670b7aec22bc91b38ec25dd61874fd65b7a7 100644 (file)
@@ -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
index a0bc4d061d3f9701648b9d0b78614b8c7fa0928c..fc0c3cf318969add8b5c9b3ee35c3cfb48cd4260 100644 (file)
@@ -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
 #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(                                                \
            "r6", "r7", "r8", "r9", "cc"         \
          );
 
+#endif /* Compiler is gcc */
+
 #elif (__ARM_ARCH >= 6) && \
     defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1)
 
index 05397d23166a072ed247f35b8801bcf9a5440425..be8c5152c5146e104dff12c3397aebc382cfd98a 100644 (file)
@@ -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
index f082aba054d97c3a6ed5f482269ef2fcd77b3a91..adb14cc636f9163ed6b357bb5a082d1598ee485f 100644 (file)
  */
 /*
  *  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
index 0ec6971e833068b23565c4554fafd79c2caea997..8a1f2935304faea49d5084158d3a9c4af86c5558 100644 (file)
@@ -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
index cd9f91a931718aabf536da9190e727693eb3b70a..0c0d6a1157a21cf96cfcce7dab28cf8289d06801 100644 (file)
 
 /*
  *  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
index c3f1720704668bf2fb609b603d724e1fd3b8ccba..1156d7db81bc2d3c77f3f5be9dce101662e4368d 100644 (file)
 
 /*
  *  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
index 2cb36e9e17b975e64953bee67adf904db8611a31..96081feb6a5ec538f6090bbf25131dd52c3c9bce 100644 (file)
@@ -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 <limits.h>
 #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)
index aa155d7bf811ca59eec8c9422dc94383759ecdae..db73c1b537ee9ae6b9afcd349c3aada6609e84aa 100644 (file)
@@ -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.
  *
index c77bb8cc9f176c91555a043056d3b2e90910e116..c98abab6872e9696536eeb805907f810a5838f05 100644 (file)
@@ -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
index 254995ca12ceeb80d79a77f749a704c334426b7b..89634dc92743f71449531258a3ac7e3c03bbbd95 100644 (file)
@@ -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. */
index 3a34cf6d269fcb586235733aee4e4d273bcf2213..de8f625a621801412a2772055da79f659b44178d 100644 (file)
@@ -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)
index 91b40eb3bf34bd45c51c9a6391d4453055e70c73..c7aeffcf1b4276d98a96b8fc1b105fd46221d959 100644 (file)
@@ -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
  *
  * 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.
 /**
  * \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.
  *
 //#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
  *
 /** \} 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.
 /**
  * \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.
  * 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.
 /**
  * \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
  *
  * 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.
  * 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).
 /**
  * \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).
 /**
  * \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
  */
 #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
  *
  * );
  * ```
  * 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
  *
  */
 //#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
  *
  * \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
  */
 //#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
  *
 #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
  * \{
  */
 
  * 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.
  */
  * \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:
  * 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
  */
 #define MBEDTLS_XTEA_C
 
-/** \} name SECTION: mbed TLS modules */
+/** \} name SECTION: Mbed TLS modules */
 
 /**
  * \name SECTION: General configuration options
 
 /* Platform options */
 //#define MBEDTLS_PLATFORM_STD_MEM_HDR   <stdlib.h> /**< 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 */
 //#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 */
 //#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
index 8a5c68f5c515e12306163c830a3971f46c0291be..205d30343c4b7eb42af7b55252de701348006c2c 100644 (file)
  */
 /*
  *  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 */
index 8419c991380c026b0783c1d91da3e24637d9333e..7226ae1bcd2fb01a662065fb49266e7cba1d50c0 100644 (file)
@@ -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
index 1bf427c437b7eb9136a6130fbdabc17b42208519..eb72f9ee97c4eb5a47e1b5e999e782da2e72c8a4 100644 (file)
  */
 /*
  *  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
index bcc640c6112a5d4ceabd41ecbf7917cf10808a58..c29c40eee7ab3b4077f56567d5d2cb0caa8a3f01 100644 (file)
@@ -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
index f2bc58138e8f77b3bbf371afdf49990e888f6081..031b9cf271823d29b2420403ff3fa58cdfe7575a 100644 (file)
@@ -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
index 117af93400063e9ee98d01b070d511f4c244a895..b61e4d4ef951144a030ca5de633c790dee52304d 100644 (file)
  */
 /*
  *  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
index aade25a42e0655af0b8e334c1ebf196a0750a5fb..6cc6cb92a77c33cecc47cdf9f5ee842bcab492e6 100644 (file)
  */
 /*
  *  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
index e42d114c42160da5e8b00ba14527063c5b62b9f5..34a6b13d2e537246c789db398bb041be76b6dfbd 100644 (file)
  */
 /*
  *  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.
index b9928386dcd31187ee445b84ee41369b01712237..1a9844249c70eb62b8ea2e9840f716c2d30fc75c 100644 (file)
@@ -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
index 5402e74b00acfef187ddc2a904d591d6f36a8466..33ea14d7e255e7bb2187b0468aa03468f1a266ad 100644 (file)
 
 /*
  *  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
 
 #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 <code>A = -3</code>(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 <code>(A + 2) / 4</code>,
  * 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: <code>(A + 2) / 4</code>. */
+    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: <code>(A + 2) / 4</code>. */
     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 <code>A = -3</code>.
+ * \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,
index acaaa087d6ccaea98698c091117623d7669b6d5d..f6af5cbca62393915c2797e976f01b52368a11f6 100644 (file)
@@ -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
  */
 
 /*
index 4075d2ae606a86b08e94b963e9089e9f601aa053..096bff8bcb231a6117e4b9d9c6e186265ca823b1 100644 (file)
@@ -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
index eca3b5620cc2291d5adadd0c25d65755499be204..d7147b976b05602669e8c2f365fca892ede97e1a 100644 (file)
@@ -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.
index dd3c787d6cb60773e914638c91bd4b9b6a071d7c..7a183733eeb10904b0d596f7e4af3914408c9d48 100644 (file)
@@ -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
index c04088388cdd3254c3233e37a2c45e838d5d30b7..1ad0e9e96f439adb025144161e5fda40bcc9bd6d 100644 (file)
  */
 /*
  *  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
index 7d042d1966fbad9fe44d4dcc910f5c512f479cf4..cdaf8a89ae8121c94618fbba74e0687b50739e44 100644 (file)
@@ -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
index 3118369f0dedd63b344923dcb63bf37a1aaefc14..103f329b8fa193f5634e59850b48874b82deface 100644 (file)
@@ -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
index 3ccf61c7fdbcccfb31746022eee51cd690718240..d531382f6c9170b0e5e14b2867f4946453526ffe 100644 (file)
@@ -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.
index db4d14c044e8fab335ab49d962c85fa055356385..7b4311307ce8179053770ac84f0954befb5ce42e 100644 (file)
@@ -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
index 68b0d327122d326f50a184e1b5d9092f7a90d9f1..afcf3a3ee2a6b43423127d431bd1c64a2283e759 100644 (file)
@@ -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
index fd64710a1bc8c55077a2d73def890f5d61e34a60..b827ffecb15dc4438085bc78f54dba2674c91f71 100644 (file)
@@ -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
index 04f71ee3f5aa061143ad7a5c99ce4b7da2091c7a..fdc530a16b30beb579611b439b7e1a7d275176ca 100644 (file)
@@ -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
index 9e10f2409d31fbea8dd93d5d63d28047a1c9a5c1..239fdd9ba235654f5ec62d6c6827b8139411c887 100644 (file)
@@ -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
index bc2825211370a5c7d46d075019c7024cc8afa3f9..34013b9bc436d3fc171f64b527a558fb55f6cfae 100644 (file)
@@ -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
index 70a684dfc1a0c0170a38cbc86a3f8959609c92d0..9ddb8fcb6535e80dff880a03f8d4f8f681475243 100644 (file)
  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
index 66921887da0970bd038343b473ea6b53f9f30b3f..805ce339da2e6e8962e9c3958db914ac7d6fc0f2 100644 (file)
@@ -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"
index c8bcde06986816f5708d8f5e412b8b729610c054..1a12c9c80340990651259e3d97d62703de1e3d19 100644 (file)
  */
 /*
  *  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);
 
index 8d3a4a53b1c74651f01bff031ffe9ba4a21525e7..a2479b01762e2322aa29e15a5429f4be722ff257 100644 (file)
  */
 /*
  *  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
index a64eaebef2f2879c9c29dd86eab2373aa7c9c2a5..8da1ce852aadfe6926507af67efe0693dd12d2e6 100644 (file)
@@ -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
index 01069ea7dd43b3fa8d777a8ad47781cf302448a8..0821105f1a6b39045b82c43a36d39da64f9ddcd9 100644 (file)
@@ -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
 #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 */
index fee32a3bdb0c950a2870cf401638cbcb2a3b20c7..ffe6e473dadacc6d63631be145bd9bb0aad1a20d 100644 (file)
@@ -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
index ec835513689114a0f4d3d04add842c41eaee77ef..a8c0c377e9bf7b68f83d2cb3303b9b5755d0e9d3 100644 (file)
@@ -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
index 8a0c30f5ffd33f360aec6ab3870e6d11fcb86b1e..15165acdf803e3761757e9af2e3180442dc2e697 100644 (file)
@@ -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
index 80a8a9c423c601debb8c7e26c4d16862ce904a78..25d1dd1edd245b7a4173e8f57588095e777b5c73 100644 (file)
@@ -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.
index cd1385277904b5919592aa8a6733c9ca04bfaf1b..2ad5e9c3ff238f774b1b18e0867dc68aa1235aae 100644 (file)
@@ -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 */
 
 /**
index 12dec0547fcdd981d11975168855a34793c9bb72..05bea484f17a777549708e88b77a48944bef62ed 100644 (file)
@@ -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 */
 
 /**
index cb76c28cea371aebc9a7aecff0b7b585c14b0a5a..17639542b679710ce77419769b02f6a60f67bb44 100644 (file)
  */
 /*
  *  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
index eee61d695a3c03bbe82c592d0c15bec9a3621cb6..9671c88d09ecbf991488dd2b5452971e9231a1c4 100644 (file)
@@ -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
index 55fc4311310181a2fa28730efc4f113e7a207b5a..74e2a1db6cc96843e1e3c1eea0e0570d8fce0559 100644 (file)
@@ -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)
 /**
index 7b1faa51f3210a314bf957169a6b3136a150712d..ecbd984879423a9fe00bd596246c53595a64b63e 100644 (file)
 
 /*
  *  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
index 9a1a2eae2f7c0f432aaf3c52e6a673496abbd10d..6d7e44464305734070c3692f06c0d1ba3f058c4b 100644 (file)
@@ -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
index 6d9a1a2a32de683de7fd6487d6ce81c61485699e..38318a2b880d4c0e55026a8c57aa5b16236a4099 100644 (file)
@@ -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
index f8725ffb1e34ceefaa0ccc80097f84d9f1c2fa01..1779775155f37cfae2eedb84cc34e869e68721f1 100644 (file)
  */
 /*
  *  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:
- *                 <ul><li>Derive \p P, \p Q from \p N, \p D, \p E.</li>
- *                 <li>Derive \p N, \p D from \p P, \p Q, \p E.</li></ul>
+ *                 <ul><li>Derive \c P, \c Q from \c N, \c D, \c E.</li>
+ *                 <li>Derive \c N, \c D from \c P, \c Q, \c E.</li></ul>
  *                 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
index 017018bca96ccf744e08fd44a85a62e546a5e672..286cff2582809db5be9856f1a2af54e616207657 100644 (file)
  */
 /*
  *  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
  *
  */
 
index 7a7319f26ae29f9e31bec40554ca630e93b8489f..61d81f168d72749b6ae3c4539cddc87ddf8f4d10 100644 (file)
  */
 /*
  *  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
index 00bd17d0cf8e392746a5656412f6c5249449fb16..d4c3e6468a744ea6c8bc1be8f9d6efd782d35ec7 100644 (file)
@@ -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
index 1df87f99f7a7794de17bf9eb112d604686c5b1b2..c9e01690ac70decd0f267af224a0f68d70440203 100644 (file)
@@ -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
index 26e4ec400ccd24bf6282a96f65026481d3f9fa05..9cdf3a3ebbac35cc5e08d76c3e870f9f68ebf707 100644 (file)
@@ -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
 #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
 
 /* 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,
index e358c6c7e081c6045429608f3a6166216d7c2abb..cadb30c18a06fee81030602777e12578de6b9b46 100644 (file)
@@ -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);
 
index 5300125f945cae91b834f8e5206ba9c9416e9e53..199014f5086e872bd75135f21c93deb237b468bb 100644 (file)
@@ -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
index 334c005a820b5a263ee141c976a662f49cb0f7b3..85a1b4ac144783e19632d501013d53d133c8c75f 100644 (file)
@@ -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
index ff345c1401bbbe74b55db580e8b6302e4e407920..a75cc8e5854cffb13097b67463251c0d5f707ab1 100644 (file)
@@ -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
index 401df7c8546c220d857ba771427d7bb032175a7a..ad1592357b2c573be391711578cb8e10d549b4ca 100644 (file)
@@ -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
index 25de77e7d499a08ab03095f39512ae4cc4d3d640..2a03afeef9c350c1d08a805042423e9bc31f2f87 100644 (file)
@@ -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
index 597ef75211ce99d63831172ebe141766755931be..bbc8fff7630cc8358fc5086f899adb24200e7526 100644 (file)
@@ -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
index 0ef52138fdca71c710a213b452ad0a1a695da7ee..bbe76b173929acb6bcdd0da8553d476cad2f7513 100644 (file)
@@ -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
  */
 #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")
index 8fd321a0209598f122527368829bb34037136cd5..bde998c34f9fa8e5e57a15c52ed07fb5cb0b7558 100644 (file)
@@ -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 {                                                    \
index 1405021407111a0bc8bf6ba0978204132a761d4f..9f755f8535c596c7054f4c91d8b41a7a0b92d09e 100644 (file)
@@ -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
index 466611f79782092fcb4a6a861c8c0f41973b52df..e6d6a2cc10802af077e7f7ac8e0c11dde5ff9b51 100644 (file)
@@ -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
index 5975584da263afc993f6fc4cd0280522fef7f139..97a9db44c75e3586681e57407f46a7c694758fbe 100644 (file)
@@ -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
index 9b12a1bb52f392efb2ee49d0d4f4986efdcb9440..b7242c74f03d4d9bc76b7f4561d20f640810d994 100644 (file)
@@ -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
index fb47486fe11bd12264bf324390b1a64f0652b89b..4ad24fc8b1b1b174c1d418854d283be679df2e35 100644 (file)
@@ -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.
index 4f78c9cb123e22959ffdc7fd7b66403859a2d10e..04397332bbfe8a43a793de8210c86d8c1dd5d53a 100644 (file)
@@ -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"
index 1e24ee45bc64e4c6b0d47bd07363ec5660690e87..3e4a1c10a35ee7daaf03eb5a2bd8d2cb47ea30e4 100644 (file)
@@ -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 <dejong@fox-it.com>
  *
  *  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"
index f009498c48944acbc1b0c8a07bedd3ac4ede8bad..b552d5f7e1148e044ed6e987a40626ebbabdc3a2 100644 (file)
@@ -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.
index 163afb1ddb46b869dc3c8d612c1439df635f1743..8de85fba2e68da64e2cfd699ac863ba7ab1ca1e0 100644 (file)
@@ -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.
index bdde4e0ba49cbc805e1dce0c9d0601b1ac5f8648..d6a47ba93da981cefbe29b585cc7a014cfb195ec 100644 (file)
@@ -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"
index 4a10176bd594bf4568c5c1dd1e22383fb7e60c5a..a41eb9aa67283bc2a7426f325477937b656476c1 100644 (file)
@@ -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
  */
 
 /**
index 15570d238419cac0f6a0b2c8255d00fcd3f202d6..016a84ce49e02be109444d7f0628160fc4472989 100644 (file)
@@ -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
  */
 
 /**
index 75c563add2279b24491412aaab482fb4ba98d084..36ca070e39ea89219b8ed18d0d85de2fbe58dde6 100644 (file)
@@ -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"
index bff67050374ed67f6a58c2f9cc702e8ad66f24a9..3193a5e334e329998680de0fddcd848beb1b5677 100644 (file)
@@ -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
  */
 
 /**
index ccd944f5339ca8d470f6bf277c0387990d54e946..4f580d71ca83875e305725a0601eff1feb5953e3 100644 (file)
@@ -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"
index 6f0455f038356f5d31d0632c495baf9d3e209731..b456b2ffddf51b1bad31df5f3835ea6ba215bd03 100644 (file)
@@ -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
  */
 
 /**
index bdd82ac6fe56313ac6c0c225c86eb2b19bcb5c9c..5d985ef00119bfd8f7c1a1bc3a8b60a3cb3dce4f 100644 (file)
@@ -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 <errno.h>
 
 #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;
index 5817bf4f4c281ed7476a4428bd518f0db99e3fde..5a5b995c1674949af957aed07b23149841cf18a3 100644 (file)
@@ -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 <stdint.h>
 #include <string.h>
@@ -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));
 
index 12a96503bd071bc433fae1fee68fd30ef605fb6f..7d7f1bfdaecf8be3c8cea0fefb02ea67dac9b33a 100644 (file)
@@ -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"
index 303f82c7103853ae2ca4be68181cd124466eb4e3..0b4b610f96423ce16f41fab39e37cdf94fa2f964 100644 (file)
@@ -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 */
index 3b9a3e91f2919127e19dde1472d75985a3790588..c1a47b0da47c7d331adae02bdacc6914a2bc8321 100644 (file)
@@ -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"
index d46a93461aaa49b73bf92c5ccef5c4db4fb60a54..6b5008df2aabe6ab8dade153a08647d9a015ac79 100644 (file)
@@ -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;
     }
 
index f577fccdbba77f453d82e8444eef3a04f70cba75..dd460a6a0c838f049e9b940ac7488858a6538fb2 100644 (file)
@@ -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,
index 8ba40caf91d428dc3429100de684e5da0b97a4c6..45ea4afcc69c252976a7a503ab55e0de6fb009dc 100644 (file)
@@ -6,19 +6,7 @@
  * \author Adriaan de Jong <dejong@fox-it.com>
  *
  *  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"
index 039026b23fce87600b51ea1e9b1c29d4b916597d..55de216edb177a566a4278bc921e648f9948c933 100644 (file)
@@ -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));
index 52f1a0df22be65ed3403ae09218bfac2d2abc7aa..90703c45f9d38a687d394889648a77352aebf2bc 100644 (file)
@@ -6,19 +6,7 @@
  * \author Mathias Olsson <mathias@kompetensum.com>
  *
  *  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;
     }
 
index deaff0b3102781bfb17b8a27e4d46e560eeb9908..37d501640d24b8e2843fe55d744a5351cdfe6513 100644 (file)
@@ -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;
index 0107f20b1d0dcced4bbd209bcf0c0d7410653813..534290df4e97d95064fb25e924b08e24b8b4a56c 100644 (file)
@@ -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 */
 
index c8b0328d1da2a5664cabc7123a3ecc85357b63ce..e82cbeb6c6197b3962bbd6194ce660192184861e 100644 (file)
@@ -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"
index 3783f0eb8445c201ed45d5c243e5de84e33aada2..df34167a8f93e0a924228adb1070341d55d1599e 100644 (file)
@@ -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 <time.h>
 #if !defined(_WIN32) && (defined(unix) || \
     defined(__unix) || defined(__unix__) || (defined(__APPLE__) && \
-    defined(__MACH__)))
+    defined(__MACH__)) || defined(__midipix__))
 #include <unistd.h>
 #endif /* !_WIN32 && (unix || __unix || __unix__ ||
-        * (__APPLE__ && __MACH__)) */
+        * (__APPLE__ && __MACH__)) || __midipix__ */
 
 #if !((defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L) ||     \
     (defined(_POSIX_THREAD_SAFE_FUNCTIONS) &&                     \
index 510a45a698d209c403b835fcf5e6cd85633b9200..c78110760202a216ae071527faec0111795ec8a0 100644 (file)
@@ -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"
 
index 3c1c109a94eda5a742024f1bc9b070fa805a3650..9e70d0ce9b8cae055222f392d0b49cc18b77064c 100644 (file)
@@ -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
index 63cb17342f2a7674634894c60ff0aeca32dced52..f51ee1c01f9e31463f13a32a58602f7071ca5dc3 100644 (file)
  */
 /*
  *  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
index 6989cfed69c3fbe6cadeb6a6b8de71543be2c0b3..c5f620c102217fa4cff8839df172e2b28359e6a7 100644 (file)
  */
 /*
  *  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
index 5cb225bd59b5cfbac4626adc0db207a41bf83fbf..f014633089ebc75ad97386288aecbb83e59ae648 100644 (file)
@@ -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
index f261e013e07dd206fe08a2bee999d020923ef843..167ced58deef373561c1784a72b14f5e1eca5775 100644 (file)
 #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
index 26363c6b2f3ed48b3e3122b59da935bba7367c82..cc11d3b9a2d589fa5be80d794d52c2ce305bb35a 100644 (file)
 
 /*
  *  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
index 34e6fd61c3a951453650be31306cf2bcf2a151a9..1e37682f1a8e05b3b0f3fdeb838cc3db7332b7eb 100644 (file)
  * 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
index 620a4b3a77837d9ba7998f0ccb0874af60013bad..9a6db01be42ad70e2c13e984ed75a45501a9dcad 100644 (file)
  * 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
index fa3e383f059fe3a392927ae28713bce40dfdacbb..a1b2af7a7303fd53a5f4f67f3237bce67287ab24 100644 (file)
  */
 /*
  *  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.
  */
index a173c78346630a925a191be1731311bbe3921935..ab6f1e84464a4f6a4f37fa668d2ab72a1eac5a1c 100644 (file)
  */
 /*
  *  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
index e2acb714ed37092a5bc977804bd890897b77ae0b..616850f55bf8a8c8b93565457e56afbc5319e55c 100644 (file)
 
 /*
  *  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
index 9f58c7fb5e1fe434e7788daeff2b405e578f0cdb..43f2f7b1f0b774a0a7a05eb6fa0b06b52b436495 100644 (file)
  */
 /*
  *  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
index 743c6adeec84c85c057df0c2421508670575f578..213625fd6dc3352f1200f577cb07db7153f5f6ca 100644 (file)
  * 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
index 54662a54ac7c176bc7c724e8cc613ad5e9100ea2..90cda1afc8c993cb8f3ba65e7f5999e27a591e1c 100644 (file)
  */
 /*
  *  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. */
index a6214bda987bac4e82746cbe6c5b07bd34a65942..773c01e0ef8b0c3aa14ebdbbb82daa448edbaf5e 100644 (file)
  */
 /*
  *  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
     ((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.
  *
  * 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.
  * 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)
 
  * 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)
 
  * 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)
 
  * 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)
 
  * - 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)
 
      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)
 
index bad7f469781b9d092392d9a02ff06a6e8ebbaaa9..e85e5792e2b8765cc661a9b93b0ec1e20e204124 100644 (file)
@@ -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 */
index 26ccc1cafcff36c550da71d35b282201638f6828..ed9e55ad6aee4476c081bc258a2f799f80862e13 100644 (file)
@@ -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"
index 8586c7bfad524ca8a98ef079736b0af068019d0b..e1ff0e5e7c280f3789eb83b56ddb20d53c59a00c 100644 (file)
@@ -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
index d216339e6521446a8d8a3fca748936118438b754..93a6b93f1cba22fa5b4497457eaf3b4398435e44 100644 (file)
@@ -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));
index bf43ff08ab80c0bbd6928eeb6e2faf6dd68d85bb..2478d5860765dc3f3668fcde75a0fcdae6f04c95 100644 (file)
@@ -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
index c3234275ae37a78307b3ea13bca92feddb9013e5..564463fedc1cee0adc5e3575f5e953f140cb5f03 100644 (file)
@@ -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"
index 688ea38853b5242d9737c30752fedc1d0505622d..4731064f85f3c407656a580fb86125f04a1e9dab 100644 (file)
@@ -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 */
index 6156385337e868b68d4107f61c65470100e67873..196cd2eda7d498eb86354edb288393daa4b7079d 100644 (file)
@@ -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"
index 9471099de9de6f1e30ebe019e944e3bcc85bbaa3..7e769777cfdf5b218a2292edfedeaa980ad05f99 100644 (file)
@@ -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
index ea0eb1be382beb7e61bd82387401eff34ec744ac..b00f558209cfa306441167d489b59bef51f3b7f9 100644 (file)
@@ -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"
index 7541c77492b5c6d8bcdadd3714f7b1e417fb63bd..44c4a589e226421e049edf607710c50fc6f89405 100644 (file)
@@ -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
index ef73320416e2697d40ed150452d46bc5dd7c5fe6..484c81bc996a5ebb9904c1544a7c4811aefed765 100644 (file)
@@ -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"
index 1c1b451988ba5a34bf1ef71734149768acf435c7..5c196b2ab44147cd7c2b4d9a85924f821fb7a6b3 100644 (file)
@@ -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
index 58e357e3799c5564047b2c2305210da07c76325f..a1281d14fd75e0ecfea63db2cd9c3ffaacdb7676 100644 (file)
  */
 /*
  *  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 */
index 3ceee49bea94436789ea369e93bfebd24252cb95..877063b87866c5c0ee49e88216f0e2226f1cf986 100644 (file)
@@ -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
index 07f123ee055171435931f8eb0880ead4cbc5ad56..2e722d2a91e2e60c9e1be826bfa637e812725e44 100644 (file)
@@ -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"
index 4f8024a9e3407e157edae627617ebb65a22c2119..2f614bcc6e7ec4277ca919e1184e3bc7e800f500 100644 (file)
@@ -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
index f1a2af11d989070a8598b03d985e4931a67feae8..6150fee120ffa4b39cc9bac4e1367c92f9952d3a 100644 (file)
  */
 /*
  *  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
index 853a0443c84d982836a84900e44b7122c784d4fb..cc3cecafe9e137896d40ff3c9c01d64edb2e3396 100644 (file)
@@ -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"
index 82ea4746d71d6063fdf06a1eacbaa2bbd0efc3db..f4aadda73d4b3e7483f46cfcff6e839af5f1418c 100644 (file)
@@ -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
index 7bea10ad64acaf64dd03d5c61dec1a4d2bc8da87..9628ff2899eb792e5b79c3f1e179304ac9dabe82 100644 (file)
@@ -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"
index 373852dfcc6ab8015a5e4c7220ffab46b51b5f96..14a700056c00c926dc3b8374fe10275bf3efb061 100644 (file)
@@ -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
index 2d2790208579b1e89aad5d61e619fe6115614829..b79c713abbab117811e54309ab9a54fee04b9944 100644 (file)
@@ -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"
index c8366abeb8345b3f599f9a2b4d7c1de9d09280d7..6041a3528915ac515af50c36eabb02ad826e012a 100644 (file)
@@ -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
index 688940b5f41a22195bb7be8f965c08e60bfe894f..a0e40c8937eb13ee27b9939fdb2e3d1798642cd8 100644 (file)
@@ -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"
index 04768f8a43993903d827eb47bdae173b75fe28c8..b6b5e154ad294a3204b47ff8d0eca1d5fa41341e 100644 (file)
@@ -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)
index be3c2d58a3fbfd4ce07b3d8953891ee0d4daf63b..7ac99bd3cc58bf070062fb74c9dfd795b44e93b8 100644 (file)
@@ -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"
index a2e11cdf08f7b53a7e029100c6bb6a724c3e4e18..3e8ede30510c9144e0a3ecf86a2d00bfe1ef9084 100644 (file)
@@ -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
  */
 
 /*
index f44b2c38b88ce18eb542e7d475652788248f244c..0a0c2e3880973cd8f60ee7d395ce444dbb90d9f2 100644 (file)
@@ -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 <string.h>
 
@@ -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) */
index 2ff51c34b71b35dbfdc537c5b2e455a110526040..5a9e5c34fc06c754e9ec82ae8118ace37d9a0c40 100644 (file)
@@ -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));
index 6da641427c7029136247eee7e88001eb0cc21fbe..9dd958ef4c4f7880249c298f4cb42f6cffc344c8 100644 (file)
@@ -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.
index f7090396d26278682eb0b0a4e39a8345d98e2314..74f32369bb72319e00ce60b1e47a4c1dcc594c4a 100644 (file)
@@ -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.
index f6b7c1fbf1ea1073b17c5a37f34c2a0ce501bb14..77bdc2ec234206a17bbcf0bfeeece4378f0eccb8 100644 (file)
@@ -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.
index 0f0e61077c383ec3cdd6c2a6b595544800faf0f3..21e38cd86a3a29c7aecc60f3a95a756a955f84c0 100644 (file)
@@ -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
 
index b37921a1eb78e0cb61f17fe13aa4c79898884011..7a46537809cdf40bc6d198c13394624a2e21e45f 100644 (file)
@@ -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"
index b693d53031b276ec7f0fbe8f0eec181c39610771..4fde783d3e72c007ab7f504f23dbce9031011ac6 100644 (file)
@@ -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"
index 1ac9c41760d8742ce0c706831b9a98a5dda88787..067a4916a5c1902a6e2f46096e64464b1bc021d1 100644 (file)
@@ -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
index 8a2ab7b9ba563d507f9a947f54bb81ab39954233..5e85679593171ae58bce8697220eb9917c0a9020 100644 (file)
@@ -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,
index 994661a44cfcb88587c47376d63ad37d8c1c9248..544e50e67531fa3c0c06c21cd650c8c4cc3c90ea 100644 (file)
@@ -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"
index 0789245bacd7e44d1667ce2ffacccb0a4b118a3b..f9102904660456a4355f74e1db07c651a3210f35 100644 (file)
@@ -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"
index 494de1b93e16abfa808b97e9376bb98157c0abdd..c667a2923bf7f7341982ff8e16c71fea6b1d0611 100644 (file)
@@ -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
index 675414885fbacc72160fcca9a6a31a329bc52b97..ae7bf10b6f8f8ef07c3ce4a3700ac35ddd8e38bd 100644 (file)
@@ -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"
index 4c3b252fa2d510cbd742f3bcf8250918123c52b0..ca7413261dedf652c3d9ee2358ba43d7e8f63f65 100644 (file)
@@ -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
index 0542f33f1aeccf1a927fcd88f62aa0d0a6bcf498..b03f0cc872e4098d9690be7bb617a9c120e87ff5 100644 (file)
@@ -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
  */
 
 /*
index 47e34f9227686a797c7d17e654f5bf6d50cb3e03..b1f72fe1bae8081bc0e1882e7b2a37fb74e7fd8b 100644 (file)
@@ -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 <string.h>
+
 #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");
     }
index 049a58aa21414beec96465166f59cfb54c7c8d79..6f663b12a730bfbd3a0fbaffd03eaeb2b69f5b7a 100644 (file)
@@ -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 */
index 38eb2e6607d88c7b119b9ef5666f439ec8192aeb..4233e53723b483681787f698548103381fa4d829 100644 (file)
@@ -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.
 #include <time.h>
 #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)
 
index 50db95688ff0c18681e959febab3a2f68dfc9590..4ffd3b6a8030d3a31c8c054a3af30ef066f75917 100644 (file)
@@ -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;
 }
index d5357ea4e8fb4c267bb8704ab9ea4df191d27aa0..f98c22d704ef62f1b4cc7459022ab47d3c67d04c 100644 (file)
@@ -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.
index e7fcaf462725c0f212b7a53600e79262cd897618..a3a4525b94780ebc45ea0a37a43d5ea544a4dcb9 100644 (file)
@@ -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)
index 89344d183bda1cfd14f8b5a8d66f7db08b504621..095364e5e8417cf0f3fdc1abcda1793e689a016f 100644 (file)
@@ -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.
index a8f4c286ee32f18941c0a4f5b5d60f7dcbec2468..1e16b53b3db0a9ca044622e61c3726172d2dcbe1 100644 (file)
@@ -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:
index a421fde97ebf3c602c903ddbe56d3f301345c5d1..3c3ab3a0789efb1fdc37183519aeb4a6265699c5 100644 (file)
@@ -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
index 27651cc0e53939179359899d393b848c631375c0..f4aca56c2fdd94a07b722a850ce1567123cb4f21 100644 (file)
@@ -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"
index de5e774cfba12a63719e12ca48338aa54e33765f..4902fa777ac00e9829e170ec4a9d40c412b443af 100644 (file)
@@ -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);
 
index 1fd5aa6481fccf8f779890b7b012e69368bfa2a3..387df2292ea28c3b1945d7914d65c42aa690c8d9 100644 (file)
@@ -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);
     }
index 6fd03d8a051e5f7d16aae40b4efdb181b69fa3e1..361de7f7448d62c027ca29aca903f6d517d4225e 100644 (file)
@@ -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]);
index a06ad926e4f233dd074dc226d3655457dd73d3c3..74a46d6e7d9320c51b70c1c2cd91debe36ce2c6f 100644 (file)
@@ -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);
 }
index 627b3d90cd8fdb5ac617a3f4fe64bb95671c132e..c4439528ba8a8a408c40b5b88841cf27baa61aae 100644 (file)
@@ -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;
index a35ad0679f167932b266bf6ebf439ab36c4e81e6..a060ba74a1e0127a53cce73bca1ace70168d550b 100644 (file)
@@ -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);
 }
 
 
index daf7e2f90c4ca382ac390e5c4126592e85daa543..dc381e81089bec90a48486b3652ce9c2fdc6c638 100644 (file)
@@ -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";
index ba34f63af2bd102debeef1cd965dd0db6bc083d3..a5fdc84d433d5d8a5fe1d49537ca192a6eda6c0e 100644 (file)
@@ -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<TSvrRef> tried_servers;
     bool full_retry_made = false;
     CRef<CDBPoolBalancer> balancer;
     CServiceInfo& service_info = ctx.service_info;
+    unsigned int alternatives
+        = static_cast<unsigned int>(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<unsigned int>::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);
index a63db05d7c05a54fd16be61e869fb0fa3f907c47..a8fa7c90a396ee5b1d71eef3e1d95068446912b4 100755 (executable)
@@ -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<CSeq_id&>(object));
-    } else if (object.GetThisTypeInfo() == CSeq_entry::GetTypeInfo()) {
+    } else if (type_info == CSeq_entry::GetTypeInfo()) {
         SetItem().SetEntry(dynamic_cast<CSeq_entry&>(object));
-    } else if (object.GetThisTypeInfo() == CSeq_annot::GetTypeInfo()) {
+    } else if (type_info == CSeq_annot::GetTypeInfo()) {
         SetItem().SetAnnot(dynamic_cast<CSeq_annot&>(object));
-    } else if (object.GetThisTypeInfo() == CSeq_submit::GetTypeInfo()) {
+    } else if (type_info == CSeq_submit::GetTypeInfo()) {
         SetItem().SetSubmit(dynamic_cast<CSeq_submit&>(object));
-    } else if (object.GetThisTypeInfo() == CSeq_align::GetTypeInfo()) {
+    } else if (type_info == CSeq_align::GetTypeInfo()) {
         SetItem().SetSeq_align(dynamic_cast<CSeq_align&>(object));
-    } else if (object.GetThisTypeInfo() == CSeq_align_set::GetTypeInfo()) {
+    } else if (type_info == CSeq_align_set::GetTypeInfo()) {
         SetItem().SetSeq_align_set(dynamic_cast<CSeq_align_set&>(object));
+    } else if (type_info == CHugeFileProjectItem::GetTypeInfo()) {
+        SetItem().SetHuge_file(dynamic_cast<CHugeFileProjectItem&>(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();
index 890629e1fdd51156b727a7d6f048e008ae3a655d..4e13c9c67ea9490a3656ebdc527d63d29bc316c5 100755 (executable)
@@ -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
-
index 67a6c07f36a704d054e70443ab26df11b894eef5..44babd0cdf8a9166aa822ae18f144f86ce2224c6 100644 (file)
@@ -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
index 6972a45721b1d00f80a41f638771a6ac2eef1de6..1e028cf8d91448ebb71f14c8fc978686cb8f561e 100644 (file)
   { "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/
index 3781f94640d89b74614e25364f94501cc464509a..46d2065c8d468d67745cc0ed8dcc0c0eeede5d4b 100644 (file)
@@ -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 "$<TARGET_PROPERTY:host.${compiler},LOCATION>")
+    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 (file)
index 7032066..0000000
+++ /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)
index c48984e3fb5bb1b6f0572ac05ee88a2424c619fe..5c4d3555df6af2f886b268bee2442947ea1615c8 100644 (file)
@@ -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) {
index 05b91833e5e1b17a826185c7579d6f46349869bd..3e994eb7f60a1901a162d3877c96bd4cba8235dc 100644 (file)
@@ -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
index 0a50a204fbe92342dd44e4ca42e53cea0a8bb8cd..f7754bb5ad773b63956d7070201213b99d295414 100644 (file)
@@ -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::
 
index 97252014f794aa8fe14f725dea7435a5a0b26543..e3fd669c517f8fafeae08337ac826b30ee263340 100644 (file)
@@ -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<string> 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<const char*, const char*> 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);
index 940a55693bbde453cd407e3c6ec7dda51fa33abb..1c62d2eb5391cf5627e15cd3a31ddfd66d0a8e5c 100644 (file)
@@ -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
  *
  */
 
-/* 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",
index 917e36ead66fc0ed5f28bc069df9ad023f10c65c..7cdad329d0d01d664dbcfc860b90a800a8a12285 100644 (file)
 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
index 4aa9d1c4280a098700c00768e5ec101e3b0471bf..26a195801c85ef1dd6752f970d19b872c0865dd3 100644 (file)
@@ -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
  *
  */
 
-/* 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",
index fba884543343140b8a1802683b12db4d87fdbd2d..1b114a729550aa6757a8426939b20286438e19a9 100644 (file)
@@ -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
  *
  */
 
-/* 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",
index c15bdcdf3bdd47ff7f002cd976c917a23e7bfbc8..c7eabb7393894cd607aa265d42103cc263469bf4 100644 (file)
@@ -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
 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
 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
 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
 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
 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
 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
index a3cba6f869c19994e8579eb57a9534d32e35b958..678656a70c70b37b614705e47035f4c7452c2ad3 100644 (file)
@@ -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
  *
  */
 
-/* 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",
index 704dc34d8126e31e0b25a0a4c88ec721abf3fef9..6a31bbf529f3b5857113bf064012152e2cc47e8d 100644 (file)
@@ -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
 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
 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
 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)
 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
 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
 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
 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)
 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
 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
 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
 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
 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
 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
 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
 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
 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
 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
 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
 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
 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
 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
 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
 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
 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)
 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
 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)
 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
 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
 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
 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
 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
 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
 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
 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
 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
 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
 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
 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
 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
 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)
 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
index 69d275636a55768e4dae236662bf2b5830cbd457..b11f9cce578e9a715f95b5ce580449793e456139 100644 (file)
@@ -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
  *
  */
 
-/* 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<AUS>\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<CAN>\ts\tCape Breton University\t\t\t",
 "CBU<SKOR>\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<CHN>\tc\tChina Collection of Anaerobic Microorganisms\t\t\t",
 "CN<FR>\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<USA-CA>\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<JPN>\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<BRA>\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<AUS>\ts\tMuseum Victoria\tNMM\t\t",
 "NMV<AUS>:A\ts\tMuseum Victoria, Ichthyology\tNMV:A,NMV<AUS>A\t\t",
 "NMV<AUS>:AV\ts\tMuseum Victoria, Entomology - Australian Voucher Specimens\tNMV:AV,NMV<AUS>AV\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<USA-MA>\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<CZE>\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<PRT>\ts\tUniversity of the Azores\t\t\t",
+"UAC<PRT>: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<museum>\ts\tDepartramento de Zoologia, Universidade Federal do Rio de Janeiro\t\t\t",
 "UFRJ<museum>:POR\ts\tDepartramento de Zoologia, Universidade Federal do Rio de Janeiro, Porifera collection\tUFRJ:POR,UFRJ<museum>POR\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<GBR>\ts\tUniversity Museum of Natural History\t\t\t",
 "UMO<USA-ME>\ts\tUniversity of Maine\tUMDE\t\t",
 "UMO<USA-MO>\ts\tDunn-Palmer Herbarium, University of Missouri, Museum Support Center\t\t\t",
index a37e0df7549b2d7be5579c8f475ac8faeec528de..4ba3f54410be6ee3daf90afbb6cab6ce9b09bedb 100644 (file)
@@ -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<AUT>  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<AUS>      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<CAN>       s       Cape Breton University                  
 CBU<SKOR>      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<CHN>        c       China Collection of Anaerobic Microorganisms                    
 CN<FR> 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<USA-CA>    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<JPN>       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<BRA>     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<AUS>       s       Museum Victoria NMM             
 NMV<AUS>:A     s       Museum Victoria, Ichthyology    NMV:A,NMV<AUS>A         
 NMV<AUS>:AV    s       Museum Victoria, Entomology - Australian Voucher Specimens      NMV:AV,NMV<AUS>AV               
@@ -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<USA-MA>     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<CZE>      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<PRT>       s       University of the Azores                        
+UAC<PRT>: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<herbarium>   sc      Herbario e Colecao Fitopathologica "Verlande Duarte Silveira"
 UFRJ<museum>   s       Departramento de Zoologia, Universidade Federal do Rio de Janeiro                       
 UFRJ<museum>:POR       s       Departramento de Zoologia, Universidade Federal do Rio de Janeiro, Porifera collection  UFRJ:POR,UFRJ<museum>POR                
 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<GBR>       s       University Museum of Natural History                    
 UMO<USA-ME>    s       University of Maine     UMDE            
 UMO<USA-MO>    s       Dunn-Palmer Herbarium, University of Missouri, Museum Support Center                    
index 0f2c28e0174528dcb170a91796b097c52e8ac625..7ce2c38d83e65154ba30e153a71581060668ba0d 100644 (file)
@@ -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<CTempString>& 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<CTempString>::iterator it = fasta_pieces.begin();
                 ++it;
                 _ASSERT(it != fasta_pieces.end());
@@ -2754,6 +2755,9 @@ CSeq_id::E_Choice CSeq_id::x_Init(list<CTempString>& 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;
                 }
index c480c6f7a3e6b74c2775f67bd01dcd6a4bb722da..9be8871b9c13a7d24109704ad603435b5265332b 100644 (file)
@@ -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.
index dda4a059ebe43c25fffbb530aebebfa187183d54..4d0b3c2b1ff741c5fc5b0003186fcb380af606a3 100644 (file)
@@ -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
  *
  */
 
-/* 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",
index d655c60d9bfce17dd7951f9a48c8f6e977f42c72..a6ed7f04af8645cf38f3e4b8456021b053d40397 100644 (file)
@@ -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
index e75d1e0a11fbfd4bb4c5185a7cd0645ef6445d12..e2200f00a55163f21bc793fe8def35ce713ec77e 100644 (file)
@@ -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);
index 3f93f108099355f9bc1118a65d16cb8bb3e7682f..57b1ccef1bc2b2116d8948371a5140e361744ddf 100644 (file)
@@ -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 <geo_loc_name> 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<TErrIndex> (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<TErrIndex>(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<TErrIndex> (err_int);
+    TErrIndex err = static_cast<TErrIndex>(err_int);
     if (err <= eErr_MAX) {
         TErrTypeStrsMap::const_iterator err_it = sc_ErrStrsMap.find(err);
         if (err_it != sc_ErrStrsMap.end()) {
index f43245c51036b887e33c01de80acd6bf4d89f18d..39717aff88cfe6e0644a915c22aaedc8d5d6369a 100644 (file)
@@ -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<CValidErrItem> item(new CValidErrItem(sev, ec, msg, desc, obj, acc, ver, seq_offset));
+    CRef<CValidErrItem> 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<CValidErrItem> item(new CValidErrItem(sev, ec, msg, desc, acc, ver, seq_offset));
+    CRef<CValidErrItem> 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<CValidErrItem> 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<CValidErrItem> item(new CValidErrItem(sev, ec, msg, desc, seqdesc, ctx, acc, ver, seq_offset));
+    CRef<CValidErrItem> 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();
     }
 }
index c5925fa2c2a2932548f13060e4ab2a700525f9b5..0220aff6e5cb2915c2199153860ee3e358f92212 100644 (file)
@@ -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 ::= {",
     "  {",
index 984108ded0f5bccacfbeb2666d7a24270f53278f..11ebef316cf6da968a8391945e64def7163a639d 100644 (file)
@@ -1708,7 +1708,7 @@ void CDeflineGenerator::x_SetTitleFromNM (
 )
 
 {
-    unsigned int         genes = 0, cdregions = 0, prots = 0;
+    unsigned int         genes = 0, cdregions = 0;
     CConstRef<CSeq_feat> gene(0);
     CConstRef<CSeq_feat> 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<CBioseqIndex> bsx = m_Idx->GetBioseqIndex (bsh);
+            if (bsx) {
+                CWeakRef<CBioseqIndex> 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());
index 03c0d4810971518957e7ac9920c48e2927f24aa6..3ee976c4a4f5077ecca5162a430e0871bee232aa 100644 (file)
@@ -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<CSeqMasterIndex> 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') {
index cba584e30b59b797230bea882e423167798d0ba4..cbfd0abe043c15c9c21a4f1d0ba9e7d300c3393b 100644 (file)
@@ -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
index 6d57140e628ec25f68bebf1acabbce81c6853e60..459f48523b783bdb7e03ffee335fbfe934765d7b 100644 (file)
@@ -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
index 61a63e07bee580c4ad59c90cab361c70f8ea3f22..a0da12aea3108753b99d69f83919e75ec6657073 100644 (file)
@@ -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 <objects/seqloc/Seq_loc.hpp>
 #include <objects/seq/Seq_inst.hpp>
 #include <objects/seq/Seq_descr.hpp>
-#include <objects/seq/Seqdesc.hpp> 
+#include <objects/seq/Seqdesc.hpp>
 #include <objmgr/seqdesc_ci.hpp>
 #include <objects/blastdb/defline_extra.hpp>
 #include <objects/general/User_object.hpp>
@@ -90,7 +90,7 @@ const char k_PSymbol[ePMatrixSize+1] =
 unique_ptr<CNcbiRegistry> CAlignFormatUtil::m_Reg;
 string CAlignFormatUtil::m_Protocol = "";
 bool  CAlignFormatUtil::m_geturl_debug_flag = false;
-unique_ptr<CGeneInfoFileReader> 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<CGeneInfoFileReader> CAlignFormatUtil::m_GeneInfoReader;
 ///@return true if found score, false otherwise
 ///
 template<class container> 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<TGi>& 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<TGi>(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> 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<SBlastError>& 
-                                       error_return, 
+
+void CAlignFormatUtil::BlastPrintError(list<SBlastError>&
+                                       error_return,
                                        bool error_post, CNcbiOstream& out)
 {
-   
+
     string errsevmsg[] = { "UNKNOWN","INFO","WARNING","ERROR",
                             "FATAL"};
-    
+
     NON_CONST_ITERATE(list<SBlastError>, 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<SBlastError>&
             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<string> split_line;
     NStr::Split(str, "~", split_line);
     ITERATE(vector<string>, 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<CBlast4_database_info> dbinfo = 
+    CRef<CBlast4_database_info> 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<CSeqDB> seqdb(new CSeqDB(dbname, info.is_protein 
+    CRef<CSeqDB> 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<CAlignFormatUtil::SDbInfo>& retval,
                            bool is_protein, int numSeqs, Int8 numLetters, string& tag)
 {
@@ -294,7 +294,7 @@ CAlignFormatUtil::FillScanModeBlastDbInfo(vector<CAlignFormatUtil::SDbInfo>& 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<CAlignFormatUtil::SDbInfo>& 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<CAlignFormatUtil::SDbInfo>& retval,
             }
             retval.push_back(info);
        }
-       return; 
+       return;
     }
     else{
     vector<CTempString> dbs;
@@ -379,9 +379,9 @@ CAlignFormatUtil::GetBlastDbInfo(vector<CAlignFormatUtil::SDbInfo>& retval,
 }
 
 void CAlignFormatUtil::PrintDbReport(const vector<SDbInfo>& 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<SDbInfo>& 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<SDbInfo>& 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<SDbInfo>& 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<string> s_NumGiToStringGiList(list<TGi> use_this_gi)//for backward c
 {
     const string k_GiPrefix = "gi:";
     list<string> use_this_seq;
-    ITERATE(list<TGi>, iter_gi, use_this_gi){                
+    ITERATE(list<TGi>, 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<TGi> 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<CSeq_id> 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<number; i++){
+    for(auto i=0; i<number; i++){
         out<<" ";
     }
-
 }
 
-void CAlignFormatUtil::GetScoreString(double evalue, 
-                                      double bit_score, 
-                                      double total_bit_score, 
+void CAlignFormatUtil::GetScoreString(double evalue,
+                                      double bit_score,
+                                      double total_bit_score,
                                       int raw_score,
-                                      string& evalue_str, 
+                                      string& evalue_str,
                                       string& bit_score_str,
                                       string& total_bit_score_str,
                                       string& raw_score_str)
@@ -837,11 +836,11 @@ void CAlignFormatUtil::GetScoreString(double evalue,
         value_set = true;
     }
 #endif /* CTOOLKIT_COMPATIBLE */
-    
+
     if (evalue < 1.0e-180) {
         snprintf(evalue_buf, sizeof(evalue_buf), "0.0");
     } else if (evalue < 1.0e-99) {
-        snprintf(evalue_buf, sizeof(evalue_buf), "%2.0le", evalue);        
+        snprintf(evalue_buf, sizeof(evalue_buf), "%2.0le", evalue);
 #ifdef CTOOLKIT_COMPATIBLE
         if (ctoolkit_compatible) {
             strncpy(evalue_buf, evalue_buf+1, sizeof(evalue_buf-1));
@@ -851,14 +850,14 @@ void CAlignFormatUtil::GetScoreString(double evalue,
         snprintf(evalue_buf, sizeof(evalue_buf), "%3.0le", evalue);
     } else if (evalue < 0.1) {
         snprintf(evalue_buf, sizeof(evalue_buf), "%4.3lf", evalue);
-    } else if (evalue < 1.0) { 
+    } else if (evalue < 1.0) {
         snprintf(evalue_buf, sizeof(evalue_buf), "%3.2lf", evalue);
     } else if (evalue < 10.0) {
         snprintf(evalue_buf, sizeof(evalue_buf), "%2.1lf", evalue);
-    } else { 
+    } else {
         snprintf(evalue_buf, sizeof(evalue_buf), "%2.0lf", evalue);
     }
-    
+
     if (bit_score > 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<CSeq_id> previous_id, subid; 
+    CConstRef<CSeq_id> 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<CSeq_id> previous_id, subid; 
+    CConstRef<CSeq_id> 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<CSeq_id> previous_id, subid; 
+    CConstRef<CSeq_id> 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<CSeq_align> 
-CAlignFormatUtil::CreateDensegFromDendiag(const CSeq_align& aln) 
+CRef<CSeq_align>
+CAlignFormatUtil::CreateDensegFromDendiag(const CSeq_align& aln)
 {
     CRef<CSeq_align> 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<CBlast_def_line_set> bdlRef = 
+        const CRef<CBlast_def_line_set> bdlRef =
             CSeqDB::ExtractBlastDefline(handle);
         const list< CRef< CBlast_def_line > > &bdl = (bdlRef.Empty()) ? list< CRef< CBlast_def_line > >() : bdlRef->Get();
         ITERATE(list<CRef<CBlast_def_line> >, iter_bdl, bdl) {
-            CConstRef<CSeq_id> bdl_id = 
+            CConstRef<CSeq_id> 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<CSeq_align_set> >&
 
 bool CAlignFormatUtil::
 SortHspByPercentIdentityDescending(const CRef<CSeq_align>& info1,
-                                   const CRef<CSeq_align>& info2) 
+                                   const CRef<CSeq_align>& info2)
 {
-     
+
     int score1, sum_n1, num_ident1;
     double bits1, evalue1;
     list<TGi> use_this_gi1;
-    
+
     int score2, sum_n2, num_ident2;
     double bits2, evalue2;
     list<TGi> 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<CSeq_align>& info1,
 
 bool CAlignFormatUtil::
 SortHitByScoreDescending(const CRef<CSeq_align_set>& info1,
-                         const CRef<CSeq_align_set>& info2) 
+                         const CRef<CSeq_align_set>& info2)
 {
     CRef<CSeq_align_set> i1(info1), i2(info2);
-    
+
     i1->Set().sort(SortHspByScoreDescending);
     i2->Set().sort(SortHspByScoreDescending);
-     
-     
+
+
     int score1, sum_n1, num_ident1;
     double bits1, evalue1;
     list<TGi> use_this_gi1;
-    
+
     int score2, sum_n2, num_ident2;
     double bits2, evalue2;
     list<TGi> 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<CSeq_align_set>& info1,
 
 bool CAlignFormatUtil::
 SortHitByMasterCoverageDescending(CRef<CSeq_align_set> const& info1,
-                                  CRef<CSeq_align_set> const& info2) 
+                                  CRef<CSeq_align_set> const& info2)
 {
     int cov1 = GetMasterCoverage(*info1);
     int cov2 = GetMasterCoverage(*info2);
@@ -1207,7 +1206,7 @@ SortHitByMasterCoverageDescending(CRef<CSeq_align_set> const& info1,
         int score1, sum_n1, num_ident1;
         double bits1, evalue1;
         list<TGi> use_this_gi1;
-    
+
         int score2, sum_n2, num_ident2;
         double bits2, evalue2;
         list<TGi> use_this_gi2;
@@ -1223,34 +1222,34 @@ bool CAlignFormatUtil::SortHitByMasterStartAscending(CRef<CSeq_align_set>& info1
                                                      CRef<CSeq_align_set>& 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<TGi> use_this_gi1;
-        
+
         int score2, sum_n2, num_ident2;
         double bits2, evalue2;
         list<TGi> 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<CSeq_align>& info1,
                          const CRef<CSeq_align>& info2)
 {
+
     int score1, sum_n1, num_ident1;
     double bits1, evalue1;
     list<TGi> use_this_gi1;
-    
+
     int score2, sum_n2, num_ident2;
     double bits2, evalue2;
     list<TGi> 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<CSeq_align>& info1,
-                              const CRef<CSeq_align>& info2) 
+                              const CRef<CSeq_align>& 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<TGi> use_this_gi1;
-        
+
         int score2, sum_n2, num_ident2;
         double bits2, evalue2;
         list<TGi> 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<CSeq_align>& info1,
-                               const CRef<CSeq_align>& info2) 
+                               const CRef<CSeq_align>& 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<TGi> use_this_gi1;
-        
+
         int score2, sum_n2, num_ident2;
         double bits2, evalue2;
         list<TGi> 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<CSeq_align> 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<CSeq_align> 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<CSeq_align_set>& info1,
                                double &percentIdent1,
                                double &percentIdent2)
 {
-  
+
     CRef<CSeq_align_set> 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<CSeq_align_set>& info1,
                                      const CRef<CSeq_align_set>& info2)
 {
-  
+
     CRef<CSeq_align_set> i1(info1), i2(info2);
-    
+
     //i1->Set().sort(SortHspByPercentIdentityDescending);
     //i2->Set().sort(SortHspByPercentIdentityDescending);
 
@@ -1451,22 +1450,22 @@ SortHitByPercentIdentityDescendingEx(const CRef<CSeq_align_set>& 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<CSeq_align_set> const&
     double bits, evalue;
     list<TGi> 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<CSeq_align_set>& info1, const CRef<CSeq_align_set>& info2) 
+    bool operator() (const CRef<CSeq_align_set>& info1, const CRef<CSeq_align_set>& info2)
     {
         CConstRef<CSeq_id> 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<CSeq_align_set> >& seqalign_hit_list,
 void CAlignFormatUtil::SortHit(list< CRef<CSeq_align_set> >& 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<CSeq_align_set> >& seqalign_hit_list,
         seqalign_hit_list.sort(SortHitByTotalScoreDescending);
     } else if (sort_method == 3) {
         seqalign_hit_list.sort(SortHitByPercentIdentityDescendingEx);
-    } 
+    }
 }
 
 void CAlignFormatUtil::
-SplitSeqalignByMolecularType(vector< CRef<CSeq_align_set> >& 
+SplitSeqalignByMolecularType(vector< CRef<CSeq_align_set> >&
                              target,
                              int sort_method,
                              const CSeq_align_set& source,
@@ -1573,11 +1572,11 @@ SplitSeqalignByMolecularType(vector< CRef<CSeq_align_set> >&
     CConstRef<CSeq_id> 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<CSeq_align_set> >&
                 }
                 else {
                     linkout = linkoutPrev;
-                }                        
+                }
                 if (linkout & eGenomicSeq) {
                     if (sort_method == 1) {
                         target[1]->Set().push_back(*iter);
@@ -1609,20 +1608,20 @@ SplitSeqalignByMolecularType(vector< CRef<CSeq_align_set> >&
             } 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<CSeq_align_set> >& target,
-                                        const CSeq_align_set& source) 
+                                        const CSeq_align_set& source)
 {
     CConstRef<CSeq_id> previous_id;
     CRef<CSeq_align_set> 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<CSeq_align_set> >& 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<CSeq_align_set> >& target,
         }
         previous_id = &cur_id;
     }
-    
+
 }
 
 CRef<CSeq_align_set>
@@ -1650,34 +1649,34 @@ CAlignFormatUtil::HitListToHspList(list< CRef<CSeq_align_set> >& source)
     // list<CRef<CSeq_align_set> >::iterator iter;
 
     for (list<CRef<CSeq_align_set> >::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<CSeq_align_set>  >  CAlignFormatUtil::HspListToHitMap(vector <string> seqIdList,
-                                       const CSeq_align_set& source) 
+                                       const CSeq_align_set& source)
 {
     CConstRef<CSeq_id> previous_id;
     CRef<CSeq_align_set> temp;
 
     map < string, CRef<CSeq_align_set>  > hitsMap;
-    
+
     for(size_t i = 0; i < seqIdList.size();i++) {
-        CRef<CSeq_align_set> new_aln(new CSeq_align_set);        
+        CRef<CSeq_align_set> new_aln(new CSeq_align_set);
         hitsMap.insert(map<string, CRef<CSeq_align_set> >::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<CSeq_align_set>  >  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<CSeq_align_set> &all_aln_set, string alignSeqList)
 {
     vector <string> 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<CSeq_align_set> &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<CSeq_id> 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<string, string>::
                                 value_type("service", ""));
@@ -1934,7 +1933,7 @@ BuildFormatQueryString (CCgiContext& ctx,
                                 value_type("client", ""));
     parameters_to_change.insert(map<string, string>::
                                 value_type("composition_based_statistics", ""));
-    
+
     parameters_to_change.insert(map<string, string>::
                                 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,"<img") ? "" : lnkTitle;    
+    lnkTitle = NStr::StartsWith(lnk_displ,"<img") ? "" : lnkTitle;
     string lnkTarget = NStr::StartsWith(lnk_displ,"<img") ? "" : kLinkTarget;
     url_link = CAlignFormatUtil::MapTemplate(url_link,"lnkTitle",lnkTitle);
     url_link = CAlignFormatUtil::MapTemplate(url_link,"lnkTarget",lnkTarget);
-    url_link = CAlignFormatUtil::MapTemplate(url_link,"lnk_displ",lnk_displ);        
-    url_link = CAlignFormatUtil::MapTemplate(url_link,"lnk_tl_info",lnk_tl_info);        
-    url_link = CAlignFormatUtil::MapTemplate(url_link,"label",label);    
+    url_link = CAlignFormatUtil::MapTemplate(url_link,"lnk_displ",lnk_displ);
+    url_link = CAlignFormatUtil::MapTemplate(url_link,"lnk_tl_info",lnk_tl_info);
+    url_link = CAlignFormatUtil::MapTemplate(url_link,"label",label);
     url_link = CAlignFormatUtil::MapProtocol(url_link);
     return url_link;
 }
 
-                                                                        
+
 static list<string> s_GetLinkoutUrl(int linkout,
                                     string giList,
                                     string labelList,
-                                    TGi first_gi,                                    
-                                    CAlignFormatUtil::SLinkoutInfo &linkoutInfo,                                    
+                                    TGi first_gi,
+                                    CAlignFormatUtil::SLinkoutInfo &linkoutInfo,
                                     bool textLink = true)
-                                    
+
 {
-    list<string> linkout_list;    
+    list<string> linkout_list;
     string url_link,lnk_displ,lnk_title,lnkTitleInfo;
+
     vector<string> 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<string> 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<string> 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 <accession
     if(linkout & eBioAssay && linkoutInfo.is_na && first_gi != ZERO_GI){
-        url_link = CAlignFormatUtil::GetURLFromRegistry("BIOASSAY_NUC");                        
-        lnk_displ = textLink ? "PubChem BioAssay" : kBioAssayNucImg;            
-        
+        url_link = CAlignFormatUtil::GetURLFromRegistry("BIOASSAY_NUC");
+        lnk_displ = textLink ? "PubChem BioAssay" : kBioAssayNucImg;
+
         string linkTitle = " title=\"View Bioassays involving <@label@>\"";
         //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<string> 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<string> 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<string> CAlignFormatUtil::GetLinkoutUrl(int linkout, const CBioseq::TId& ids, 
+list<string> 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<string> linkout_list;
     TGi gi = FindGi(ids);
     CRef<CSeq_id> 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<string> 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<string> 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<int, vector < CBioseq::TId > > &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 <CBioseq::TId > idList;
         idList.push_back(cur_id);
         linkout_map.insert(map<int,  vector <CBioseq::TId > >::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<CSeq_id> seqID = FindBestChoice(cur_id, CSeq_id::WorstRank);                  
-                linkout = (*linkoutdb)->GetLinkout(*seqID, mv_build_name);                
-            }                         
+                CRef<CSeq_id> seqID = FindBestChoice(cur_id, CSeq_id::WorstRank);
+                linkout = (*linkoutdb)->GetLinkout(*seqID, mv_build_name);
+                string str_id = seqID->GetSeqIdString(false);
+                CRef<CSeq_id> 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<int, vector <CBioseq::TId > > &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<int, vector <CBioseq::TId > > &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<string> &linkout_list)
-                                
-{   
+
+{
     //Identical Proteins
-          
-     CRef<CSeq_id> wid = FindBestChoice(cur_id, CSeq_id::WorstRank);     
-     if (CAlignFormatUtil::GetTextSeqID(wid)) {         
+
+     CRef<CSeq_id> 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<string> s_GetFullLinkoutUrl(CBioseq::TId& cur_id,                                             
-                                        CAlignFormatUtil::SLinkoutInfo &linkoutInfo,                                        
+static list<string> s_GetFullLinkoutUrl(CBioseq::TId& cur_id,
+                                        CAlignFormatUtil::SLinkoutInfo &linkoutInfo,
                                         map<int, vector < CBioseq::TId > >  &linkout_map,
                                         bool getIdentProteins)
-                                                 
+
 {
-    list<string> linkout_list;    
-    
+    list<string> linkout_list;
+
     vector<string> 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<CSeq_id> wid = FindBestChoice(ids, CSeq_id::WorstRank);            
-            string label = CAlignFormatUtil::GetLabel(wid,seqVersion);                        
+            CRef<CSeq_id> wid = FindBestChoice(ids, CSeq_id::WorstRank);
+            string label = CAlignFormatUtil::GetLabel(wid,seqVersion);
             if(!labelList.empty()) labelList += ",";
             labelList += label;
 
@@ -2610,79 +2615,79 @@ static list<string> 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<string> one_linkout = s_GetLinkoutUrl(linkout, 
+            list<string> one_linkout = s_GetLinkoutUrl(linkout,
                                                           giList,
-                                                          labelList,                                  
+                                                          labelList,
                                                           first_gi,
-                                                          linkoutInfo);                                 
+                                                          linkoutInfo);
             if(one_linkout.size() > 0) {
-                list<string>::iterator iter = one_linkout.begin();        
+                list<string>::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<string> CAlignFormatUtil::GetFullLinkoutUrl(const list< CRef< CBlast_def_line > > &bdl,                                             
-                                                    CAlignFormatUtil::SLinkoutInfo &linkoutInfo)                                                 
+list<string> CAlignFormatUtil::GetFullLinkoutUrl(const list< CRef< CBlast_def_line > > &bdl,
+                                                    CAlignFormatUtil::SLinkoutInfo &linkoutInfo)
 {
     list<string> linkout_list;
     map<int, vector < CBioseq::TId > >  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<string> CAlignFormatUtil::GetFullLinkoutUrl(const list< CRef< CBlast_def_line > > &bdl,                                             
+list<string> 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<string> linkout_list;
     map<int, vector < CBioseq::TId > >  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<string> 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<string> CAlignFormatUtil::GetFullLinkoutUrl(const list< CRef< CBlast_def_li
 }
 
 
-list<string> CAlignFormatUtil::GetFullLinkoutUrl(CBioseq::TId& cur_id,                                             
+list<string> CAlignFormatUtil::GetFullLinkoutUrl(CBioseq::TId& cur_id,
                                                  CAlignFormatUtil::SLinkoutInfo &linkoutInfo,
-                                                 bool getIdentProteins)                                                 
+                                                 bool getIdentProteins)
 {
     list<string> linkout_list;
     map<int, vector < CBioseq::TId > >  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<string> CAlignFormatUtil::GetFullLinkoutUrl(CBioseq::TId& cur_id,                                             
+list<string> 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<string> linkout_list;
 
-    map<int, vector < CBioseq::TId > >  linkout_map;        
+    map<int, vector < CBioseq::TId > >  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<string> 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<CRange<TSeqPos> > s_MergeRangeList(list<CRange<TSeqPos> > &source) 
+static list<CRange<TSeqPos> > s_MergeRangeList(list<CRange<TSeqPos> > &source)
 {
 
-    list<CRange<TSeqPos> > merge_list; 
+    list<CRange<TSeqPos> > merge_list;
 
     bool is_first = true;
     CRange<TSeqPos> prev_range (0, 0);
     ITERATE(list<CRange<TSeqPos> >, iter, source) {
-       
+
         if (is_first) {
             merge_list.push_back(*iter);
             is_first= false;
@@ -2828,16 +2833,16 @@ static list<CRange<TSeqPos> > s_MergeRangeList(list<CRange<TSeqPos> > &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<CRange<TSeqPos> > merge_list; 
-  
+    list<CRange<TSeqPos> > merge_list;
+
     list<CRange<TSeqPos> > temp;
     ITERATE(CSeq_align_set::Tdata, iter, alnset.Get()) {
         CRange<TSeqPos> 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<TSeqPos> CAlignFormatUtil::GetSeqAlignCoverageParams(const CSeq_align_set& alnset,int *master_covered_lenghth,bool *flip)
-                                                                                               
+
 {
 
     list<CRange<TSeqPos> > query_list;
     list<CRange<TSeqPos> > 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<CRange<TSeqPos> >, iter, query_list) {
         *master_covered_lenghth += iter->GetLength();
     }
 
     TSeqPos from = 0,to = 0;
-    ITERATE(list<CRange<TSeqPos> >, iter, subject_list) {              
+    ITERATE(list<CRange<TSeqPos> >, 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<CSeq_align_set>) &aln_set;
 
@@ -2914,53 +2919,53 @@ CAlignFormatUtil::SortSeqalignForSortableFormat(CCgiContext& ctx,
     }else {
         seqalign_vec[0] = const_cast<CSeq_align_set*>(&aln_set);
     }
-    
-                                                            
+
+
     ITERATE(vector< CRef<CSeq_align_set> >, iter, seqalign_vec){
-        list< CRef<CSeq_align_set> > one_seqalign_hit_total_list = SortOneSeqalignForSortableFormat(**iter,                                                                                                 
-                                                            nuc_to_nuc_translation,                                             
+        list< CRef<CSeq_align_set> > 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<CSeq_align_set> >
-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<CSeq_align_set> > seqalign_hit_total_list;
     list< CRef<CSeq_align_set> > 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<CSeq_align_set> >, iter2, seqalign_hit_list) { 
+    ITERATE(list< CRef<CSeq_align_set> >, iter2, seqalign_hit_list) {
         CRef<CSeq_align_set> 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<CSeq_align_set>
 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<CSeq_align_set>) &aln_set;
     }
 
 //  seqalign_vec[0] = const_cast<CSeq_align_set*>(&aln_set);
-    list< CRef<CSeq_align_set> > seqalign_hit_total_list = SortOneSeqalignForSortableFormat(aln_set,                                                                                                 
-                                                            nuc_to_nuc_translation,                                             
+    list< CRef<CSeq_align_set> > 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<CSeq_align_set> CAlignFormatUtil::FilterSeqalignByEval(CSeq_align_set& sour
     list<TGi> use_this_gi;
 
     CRef<CSeq_align_set> 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<CSeq_align_set> CAlignFormatUtil::FilterSeqalignByPercentIdent(CSeq_align_set& source_aln,
                                                                     double percentIdentLow,
-                                                                    double percentIdentHigh)                                     
+                                                                    double percentIdentHigh)
 {
     int score, sum_n, num_ident;
     double bits, evalue;
     list<TGi> use_this_gi;
 
     CRef<CSeq_align_set> 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<CSeq_align_set> CAlignFormatUtil::FilterSeqalignByScoreParams(CSeq_align_se
     list<TGi> use_this_gi;
 
     CRef<CSeq_align_set> 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<CSeq_align_set> 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<CSeq_align_set> CAlignFormatUtil::FilterSeqalignByScoreParams(CSeq_align_se
     list< CRef<CSeq_align_set> > seqalign_hit_list;
 
     HspListToHitList(seqalign_hit_list, source_aln);
-    
-    ITERATE(list< CRef<CSeq_align_set> >, iter, seqalign_hit_list) { 
+
+    ITERATE(list< CRef<CSeq_align_set> >, iter, seqalign_hit_list) {
         CRef<CSeq_align_set> temp(*iter);
         CAlignFormatUtil::SSeqAlignSetCalcParams* seqSetInfo = CAlignFormatUtil::GetSeqAlignSetCalcParamsFromASN(*temp);
-                
+
         if(s_isAlnInFilteringRange(seqSetInfo->evalue,
                                   seqSetInfo->percent_identity,
                                   seqSetInfo->percent_coverage,
@@ -3176,17 +3181,17 @@ CRef<CSeq_align_set> 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<CSeq_align_set> CAlignFormatUtil::LimitSeqalignByHsps(CSeq_align_set& source_aln,
                                                            int maxAligns,
-                                                           int maxHsps)                                                           
+                                                           int maxHsps)
 {
-    CRef<CSeq_align_set> new_aln(new CSeq_align_set);    
-    
+    CRef<CSeq_align_set> new_aln(new CSeq_align_set);
+
     CConstRef<CSeq_id> prevQueryId,prevSubjectId;
     int alignCount = 0,hspCount = 0;
     ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){
@@ -3195,35 +3200,35 @@ CRef<CSeq_align_set> 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<CSeq_align_set> CAlignFormatUtil::ExtractQuerySeqAlign(CRef<CSeq_align_set> &source_aln,
-                                                            int queryNumber) 
+                                                            int queryNumber)
 {
     if(queryNumber == 0) {
         return source_aln;
     }
-    CRef<CSeq_align_set> new_aln;    
-    
-    CConstRef<CSeq_id> prevQueryId;    
+    CRef<CSeq_align_set> new_aln;
+
+    CConstRef<CSeq_id> prevQueryId;
     int currQueryNum = 0;
 
     ITERATE(CSeq_align_set::Tdata, iter, source_aln->Get()){
@@ -3231,17 +3236,17 @@ CRef<CSeq_align_set> CAlignFormatUtil::ExtractQuerySeqAlign(CRef<CSeq_align_set>
         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<CSeq_id> 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<CSeq_id> 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 += "<a " + title + deflineInfo + "href=\"";                       
+                url_link += "<a " + title + deflineInfo + "href=\"";
             }
             url_link += url_with_parameters;
             if (!seqUrlInfo->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[] = "<a href=\"<@url@>\" target=\"lnk<@rid@>\" title=\"Show report for <@seqid@>\"><@gi@><@seqid@></a>"; 
+//static const char kGenericLinkTemplate[] = "<a href=\"<@url@>\" target=\"lnk<@rid@>\" title=\"Show report for <@seqid@>\"><@gi@><@seqid@></a>";
 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<string>  CAlignFormatUtil::GetGiLinksList(SSeqURLInfo *seqUrlInfo,
                                                bool hspRange)
 {
-    list<string> customLinksList;    
-    if (seqUrlInfo->hasTextSeqID) {                 
+    list<string> 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<string>  CAlignFormatUtil::GetSeqLinksList(SSeqURLInfo *seqUrlInfo,                                 
+list<string>  CAlignFormatUtil::GetSeqLinksList(SSeqURLInfo *seqUrlInfo,
                                                 bool hspRange)
 {
-    list<string> customLinksList = GetGiLinksList(seqUrlInfo,hspRange);  //ONLY FOR genBank seqUrlInfo->seqUrl has "report=genbank"             
+    list<string> 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
 //<a href="<@custom_url@>" class="<@custom_cls@>" title="Show <@custom_report_type@> report for <@seqid@>"><@custom_lnk_displ@></a>
 list<string>  CAlignFormatUtil::GetCustomLinksList(SSeqURLInfo *seqUrlInfo,
                                           const CSeq_id& id,
-                                          objects::CScope &scope,                                             
-                                          int customLinkTypes)                                          
-{    
+                                          objects::CScope &scope,
+                                          int customLinkTypes)
+{
     list<string> 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<string>  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<string> 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<CGeneInfo> 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<CSeq_align> 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<CSeq_id>)&subject_id)) { 
+            if (giTemp > ZERO_GI || GetTextSeqID((CConstRef<CSeq_id>)&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<TGi> use_this_gi; 
+    list<TGi> 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<SSeqAlignSetCalcParams> 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<TSeqPos>(0,0);      
+    seqSetInfo->subjRange = CRange<TSeqPos>(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<TGi> use_this_gi;   // Not used here, but needed for GetAlnScores.    
-    
-    seqSetInfo->subjRange = CAlignFormatUtil::GetSeqAlignCoverageParams(aln,&seqSetInfo->master_covered_length,&seqSetInfo->flip);     
+
+    list<TGi> 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<int>(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<TGi> use_this_gi;   // Not used here, but needed for GetAlnScores.    
-    
+
+    list<TGi> 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<class container> 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<TGi>& 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<TGi>(strGi);
                 use_this_gi.push_back(gi);
             }
-        }        
+        }
     }
     return hasScore;
 }
 
 
 void CAlignFormatUtil::GetUseThisSequence(const CSeq_align& aln,list<TGi>& use_this_gi)
-                                    
+
 {
     const string k_GiPrefix = "gi:";
 
@@ -4277,21 +4242,21 @@ void CAlignFormatUtil::GetUseThisSequence(const CSeq_align& aln,list<TGi>& 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<TGi>(strGi);
                         use_this_gi.push_back(gi);
-                    }                        
+                    }
                 }
-            }                
+            }
         }
     }
 }
@@ -4299,33 +4264,33 @@ void CAlignFormatUtil::GetUseThisSequence(const CSeq_align& aln,list<TGi>& use_t
 
 /*use_this_seq will contain gi:nnnnnn or seqid:ssssss string list*/
 void CAlignFormatUtil::GetUseThisSequence(const CSeq_align& aln,list<string>& 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<TGi> use_this_gi;
     list<string> 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<SSeqAlignSetCalcParams> 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<TSeqPos>(0,0);      
+    seqSetInfo->subjRange = CRange<TSeqPos>(0,0);
     seqSetInfo->flip = false;
 
     return seqSetInfo.release();
@@ -4389,10 +4354,10 @@ CRef<CSeq_id> CAlignFormatUtil::GetDisplayIds(const CBioseq_Handle& handle,
                                 const CSeq_id& aln_id,
                                 list<TGi>& use_this_gi,
                                 TGi& gi)
-                                           
+
 {
     TTaxId taxid = ZERO_TAX_ID;
-    CRef<CSeq_id> wid = CAlignFormatUtil::GetDisplayIds(handle, aln_id, use_this_gi, gi, taxid);    
+    CRef<CSeq_id> wid = CAlignFormatUtil::GetDisplayIds(handle, aln_id, use_this_gi, gi, taxid);
     return wid;
 }
 
@@ -4401,25 +4366,25 @@ CRef<CSeq_id> CAlignFormatUtil::GetDisplayIds(const CBioseq_Handle& handle,
                                 list<TGi>& use_this_gi,
                                 TGi& gi,
                                 TTaxId& taxid)
-                                           
+
 {
     const CRef<CBlast_def_line_set> 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<CSeq_id> wid;    
+    CRef<CSeq_id> 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<CSeq_id> 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<CSeq_id> 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<string> &use_this_seq)
 {
     bool isGi = false;
-    ITERATE(list<string>, iter_seq, use_this_seq){                        
+    ITERATE(list<string>, iter_seq, use_this_seq){
         s_UseThisSeqToTextSeqID( *iter_seq, isGi);
         break;
     }
@@ -4490,11 +4455,11 @@ bool CAlignFormatUtil::IsGiList(list<string> &use_this_seq)
 list<TGi> CAlignFormatUtil::StringGiToNumGiList(list<string> &use_this_seq)
 {
     list<TGi> use_this_gi;
-    ITERATE(list<string>, iter_seq, use_this_seq){        
+    ITERATE(list<string>, iter_seq, use_this_seq){
         bool isGi = false;
         string strGI = s_UseThisSeqToTextSeqID( *iter_seq, isGi);
-        if(isGi) use_this_gi.push_back(NStr::StringToNumeric<TGi>(strGI));        
-    }    
+        if(isGi) use_this_gi.push_back(NStr::StringToNumeric<TGi>(strGI));
+    }
     return use_this_gi;
 }
 
@@ -4503,14 +4468,14 @@ list<TGi> CAlignFormatUtil::StringGiToNumGiList(list<string> &use_this_seq)
 bool CAlignFormatUtil::MatchSeqInSeqList(TGi cur_gi, CRef<CSeq_id> &seqID, list<string> &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<string>, iter_seq, use_this_seq){        
+    ITERATE(list<string>, iter_seq, use_this_seq){
         isGi = false;
         string useThisSeq = s_UseThisSeqToTextSeqID(*iter_seq, isGi);
         if((isGi && cur_gi == NStr::StringToNumeric<TGi>((useThisSeq))) || (!isGi && curSeqID == useThisSeq)){
-            found = true;            
+            found = true;
             break;
          }
     }
@@ -4521,7 +4486,7 @@ bool CAlignFormatUtil::MatchSeqInSeqList(TGi cur_gi, CRef<CSeq_id> &seqID, list<
 
 bool CAlignFormatUtil::MatchSeqInSeqList(CConstRef<CSeq_id> &alnSeqID, list<string> &use_this_seq,vector <string> &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<CSeq_id> &alnSeqID, list<stri
     bool found = std::find(seqList.begin(), seqList.end(), curSeqID) != seqList.end();
     if(!found) {
         //match in use_this_seq list
-        ITERATE(list<string>, iter_seq, use_this_seq){                    
-            string useThisSeq = s_UseThisSeqToTextSeqID(*iter_seq, isGi);            
+        ITERATE(list<string>, 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<string> &use_this_seq, string textSeqIDToMatch)
 {
     bool has_match = false;
-   
-    ITERATE(list<string>, iter_seq, use_this_seq) {              
+
+    ITERATE(list<string>, 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<string> &use_t
     bool hasAccType = false;
     bool isGI = false;
 
-    ITERATE(list<string>, 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<string>, 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<string> &use_t
 CRef<CSeq_id> CAlignFormatUtil::GetDisplayIds(const CBioseq_Handle& handle,
                                 const CSeq_id& aln_id,
                                 list<string>& use_this_seq,
-                                TGi *gi,                                
+                                TGi *gi,
                                 TTaxId *taxid,
                                 string *textSeqID)
-                                           
+
 {
     const CRef<CBlast_def_line_set> 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<CSeq_id> wid;    
+    CRef<CSeq_id> 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<string>, iter_seq, use_this_seq){                    
+                ITERATE(list<string>, iter_seq, use_this_seq){
                     bool isGi = false;
                     string useThisSeq = s_UseThisSeqToTextSeqID( *iter_seq, isGi);
                     if((isGi && cur_gi == NStr::StringToNumeric<TGi>((useThisSeq))) || (!isGi && curSeqID == useThisSeq)){
@@ -4621,22 +4586,22 @@ CRef<CSeq_id> 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<CSeq_id> CAlignFormatUtil::GetDisplayIds(const CBioseq_Handle& handle,
 TGi CAlignFormatUtil::GetDisplayIds(const list< CRef< CBlast_def_line > > &bdl,
                                               const CSeq_id& aln_id,
                                               list<TGi>& 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<TGi>, 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<CSeq_id> s_GetSeqIdByType(const list<CRef<CSeq_id> >& ids, 
+static CRef<CSeq_id> s_GetSeqIdByType(const list<CRef<CSeq_id> >& ids,
                                       CSeq_id::E_Choice choice)
 {
     CRef<CSeq_id> 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<CSeq_id> 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<CRef<CSeq_id> > & ids, string *te
 }
 
 CRef<CSeq_align_set> CAlignFormatUtil::FilterSeqalignBySeqList(CSeq_align_set& source_aln,
-                                                               vector <string> &seqList)                                                                    
+                                                               vector <string> &seqList)
 {
-    CConstRef<CSeq_id> previous_id, subid; 
+    CConstRef<CSeq_id> previous_id, subid;
     list<string> use_this_seq;
     bool match = false;
 
     CRef<CSeq_align_set> 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;
 }
 
index a73fd1e3f5579bdae6d3b36b27311318a10b41ad..8f7b297bccdcaa9f062b2b45c8c273f992f0582f 100644 (file)
@@ -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<CGenetic_code::C_E> 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<CGenetic_code::C_E> 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<TSAlnFeatureInfoList>&
 
         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<TSAlnFeatureInfoList>&
 
         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<CScope> 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<list<CRange<TSeqPos> > > 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; row<m_AV->GetNumRows(); row++) {
-        CRef<CAlnMap::CAlnChunkVec> chunk_vec
-            = m_AV->GetAlnChunks(row, m_AV->GetSeqAlnRange(0));
-        for (int i=0; i<chunk_vec->size(); i++) {
-            CConstRef<CAlnMap::CAlnChunk> 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; row<m_AV->GetNumRows(); 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<CAlnMap::CAlnChunkVec> chunk_vec
+                = m_AV->GetAlnChunks(row, m_AV->GetSeqAlnRange(antirow));
+           for (int i=0; i<chunk_vec->size(); i++) {
+               CConstRef<CAlnMap::CAlnChunk> chunk = (*chunk_vec)[i];
+               if (chunk->IsGap()) {
+                   gap += (chunk->GetAlnRange().GetTo()
                         - chunk->GetAlnRange().GetFrom() + 1);
-            }
-        }
+               }
+           }
+       }
+    }
+    else
+    {
+       for (int row=0; row<m_AV->GetNumRows(); row++) {
+           CRef<CAlnMap::CAlnChunkVec> chunk_vec
+               = m_AV->GetAlnChunks(row, m_AV->GetSeqAlnRange(0));
+           for (int i=0; i<chunk_vec->size(); i++) {
+               CConstRef<CAlnMap::CAlnChunk> 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<SAlnFeatureInfo> 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<FeatureInfo> 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<SAlnFeatureInfo> 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<CBlast_def_line_set> 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<CGeneInfo> 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<CSeq_id> 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;
+        }        
     }
 }
 
index aabc8ea425641af94b9d6f3009ea2fd3528a782f..23ee020e267a63e483898935bdc222bd50e29907 100644 (file)
@@ -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<int>(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 (file)
index 0000000..810d64d
Binary files /dev/null and b/c++/src/objtools/align_format/unit_test/data/tabular_db.pdb differ
diff --git a/c++/src/objtools/align_format/unit_test/data/tabular_db.phr b/c++/src/objtools/align_format/unit_test/data/tabular_db.phr
new file mode 100644 (file)
index 0000000..fb09e60
Binary files /dev/null and b/c++/src/objtools/align_format/unit_test/data/tabular_db.phr differ
diff --git a/c++/src/objtools/align_format/unit_test/data/tabular_db.pin b/c++/src/objtools/align_format/unit_test/data/tabular_db.pin
new file mode 100644 (file)
index 0000000..549dac4
Binary files /dev/null and b/c++/src/objtools/align_format/unit_test/data/tabular_db.pin differ
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 (file)
index 0000000..4483054
--- /dev/null
@@ -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 (file)
index 0000000..4cb00c1
Binary files /dev/null and b/c++/src/objtools/align_format/unit_test/data/tabular_db.pog differ
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 (file)
index 0000000..cf438a6
Binary files /dev/null and b/c++/src/objtools/align_format/unit_test/data/tabular_db.pos differ
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 (file)
index 0000000..a1154da
Binary files /dev/null and b/c++/src/objtools/align_format/unit_test/data/tabular_db.pot differ
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 (file)
index 0000000..5dcd152
Binary files /dev/null and b/c++/src/objtools/align_format/unit_test/data/tabular_db.ppd differ
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 (file)
index 0000000..6df5734
Binary files /dev/null and b/c++/src/objtools/align_format/unit_test/data/tabular_db.ppi differ
diff --git a/c++/src/objtools/align_format/unit_test/data/tabular_db.psq b/c++/src/objtools/align_format/unit_test/data/tabular_db.psq
new file mode 100644 (file)
index 0000000..b4ddf4b
Binary files /dev/null and b/c++/src/objtools/align_format/unit_test/data/tabular_db.psq differ
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 (file)
index 0000000..d355335
Binary files /dev/null and b/c++/src/objtools/align_format/unit_test/data/tabular_db.ptf differ
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 (file)
index 0000000..98fd8a3
Binary files /dev/null and b/c++/src/objtools/align_format/unit_test/data/tabular_db.pto differ
index 85ab9d039070530650f0f82527a2bfbc331dd862..43835571e09d999ff29ad00eeff8044e78fd3312 100644 (file)
@@ -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<CRef<CSeq_align> > & 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<CScope> scope = tmp_data_loader.NewScope();
@@ -271,7 +271,7 @@ BOOST_AUTO_TEST_CASE(SubjectTitlesOutput) {
 
     const list<CRef<CSeq_align> > & 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<CScope> 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++) {
index cf234ad518a9606efb2574d80c94c5e143209230..9a1a9555f45323f6eb9fb3ebc9443d7b736bc7b7 100644 (file)
@@ -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<ncbi::TSeqPos>(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<ncbi::TSeqPos>(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<ncbi::TSeqPos>(seq.size()));
 }
 
 string CBlastSeqUtil::GetMasksString(const CSeqDB::TSequenceRanges & masks)
index b1106411c2a6fe31bdbd657bbcde51fd9df147bc..18d70e765d160754aac79ac81f3b24cfebe29ba7 100644 (file)
@@ -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 += "</a>";
         }
 
-        unsigned int nGeneIdSectionLength = k_strGeneIdBegin.length() +
+        unsigned int nGeneIdSectionLength = static_cast<unsigned int>(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<unsigned int>(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<unsigned int>(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<unsigned int>(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<int>(strNumPubMedLinks.length());
             if (nPMEffLength > 0)
             {
                 if (bFormatAsHTML)
index a82c259f6be84008ab8521b625a07c26a02d19c2..dc60fd7d2c32c3c2362f06830387d19aa94329d1 100644 (file)
@@ -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<int>(pMemFile->GetSize() / (sizeof(TRecordType)));
         if (nRecs > 0)
         {
             pRecs = (TRecordType*)(pMemFile->GetPtr());
index ab15869a8a200947aefea353d1dd1462c308d036..0322f26f046c5bcbf78682c3f26b1208b40b23f7 100644 (file)
@@ -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<string> extn;
     const bool is_protein(GetSequenceType() == CSeqDB::eProtein);
     SeqDB_GetFileExtensions(is_protein, extn, GetBlastDbVersion());
+    string blastdb_dirname;
 
     ITERATE(vector<string>, path, paths) {
         ITERATE(vector<string>, 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<string> 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<CBlast_db_metadata> CSeqDB::GetDBMetaData(string user_path)
        vector<string> dblist;
     NStr::Split(GetDBNameList(), " ", dblist, NStr::fSplit_Tokenize);
     NON_CONST_ITERATE(vector<string>, 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<CBlast_db_metadata> CSeqDB::GetDBMetaData(string user_path)
                set<TTaxId> 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<int>(tax_ids.size()));
                }
        }
        return m;
index 5d5b5cfbfd4f9ef396cf53ecc9ddbfeb47103429..a46c4b9cb1d7f22174f403186ab6e43ec7a364e7 100644 (file)
@@ -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<int>(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<int,4>(offsetp);
     } else if (fmt == eSizeVar) {
-        sz = x_ReadVarInt(offsetp);
+        sz = static_cast<int>( 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<int>(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<int,4>(str.size(), offsetp);
+        x_WriteIntFixed<int,4>(static_cast<int>(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<int>( 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<int>(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<int>(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<int>(m_DataHere.size());
     }
-    return m_DataRef.size();
+    return static_cast<int>(m_DataRef.size());
 }
 
 CTempString CBlastDbBlob::Str() const
index 617a435c63439db87486b77c686589d981c289dd..f7f2eff3b8a29576cf99c3bd9577efe554466a67 100644 (file)
@@ -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<int>(buffer->results.size());
     } else {
         end_chunk = begin_chunk + oid_size;
     }
@@ -2009,7 +2009,7 @@ int CSeqDBImpl::x_GetColumnId(const string   & title,
         if (found) {
             CRef<CSeqDB_ColumnEntry> obj(new CSeqDB_ColumnEntry(vol_ids));
 
-            col_id = m_ColumnInfo.size();
+            col_id = static_cast<int>(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) {
index 15b911767b3ec2f67949047e9155c59e03f3af93..edecd143414b3a60b1163503d8583e2024a4de70 100644 (file)
@@ -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<int>(acc.size() - pos) - 1;
 
             is_version = (ver_len <= 3 && ver_len >= 1);
 
index 331ac8c2f0d92003b8c04468c68a1dcc9400b052..ed3944b390674b17d22e07800aa1c6355fd64399 100644 (file)
@@ -27,6 +27,7 @@
  *
  */
 #include <ncbi_pch.hpp>
+#include <corelib/ncbifile.hpp>
 #include "seqdblmdbset.hpp"
 
 
@@ -326,7 +327,7 @@ void CSeqDBLMDBSet::TaxIdsToOids(set<TTaxId>& tax_ids, vector<blastdb::TOid>& 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<TTaxId>& tax_ids, vector<blastdb::T
                }
        }
        if(rv.size() == 0) {
-               NCBI_THROW(CSeqDBException, eTaxidErr, "Taxonomy ID(s) not found.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/).");
+               LOG_POST(Warning << "Taxonomy ID(s) not found in the " + GetDBFileNames() + " database" + (m_LMDBEntrySet.size()>1?"s":"")+ ".");
        }
 
        tax_ids.swap(rv_tax_ids);
@@ -402,4 +403,26 @@ void CSeqDBLMDBSet::GetLMDBFileNames(vector<string> & 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
index 518b8a1f05dbb58d87b6be0809200407ae7dbf64..100dcfdf95fc967079ce1adc6e9c8ee226cb3b68 100644 (file)
@@ -181,6 +181,8 @@ public:
 
     void GetLMDBFileNames(vector<string> & lmdb_list) const;
 
+    std::string  GetDBFileNames(bool with_dir_path  = false ) const;
+
 private:
     vector<CRef<CSeqDBLMDBEntry> >  m_LMDBEntrySet;
 
index 7175344baec0d6f7b8d763374e03b7dd36f18e31..38be0a6f6e2269100006de85cd2128029aa7e196 100644 (file)
@@ -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<int>(ft->GetVolumes().size());
     
     _ASSERT(vols || ft->GetNodes().size());
     
index 4a5403fc4c9e341bb2c82767db7292708655b7cd..56e2c4591222eebc43f1544fa320f8f4eb250158 100644 (file)
@@ -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<int>(bit);
         _ASSERT(size_t(next_oid) == bit);
         
         return found;
index 1087221d7bbfaca0115f55f7bfc796acd978c81c..65edce44a4084354bebea6010dc4df09d359c91f 100644 (file)
@@ -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()
index 8693097315ea65c2558484167d49455742559019..a04820d7804eeed999f855d546222ea7d6147ab0 100644 (file)
@@ -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<int>(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<int>(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<int>(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<int>(i);
         }
     }
 
index d9b443b936e80ff9888b80c7956f963611aea417..85befa8382517c10622d77434a6afd2205b84f84 100644 (file)
@@ -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<int>(list_info.num_ids);
 
 }
 
index 900cabcb5ae8fbbf40027913103af16599c7eacc..95ea3803b73d48171a21d6a224ce4f04d838a58f 100644 (file)
@@ -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
 /// @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 <ncbi_pch.hpp>
 #include <corelib/ncbitime.hpp>
 #include <objtools/blast/seqdb_reader/seqdbcommon.hpp>
index f056bf1af7b6462fabf0bb946df8103cf93e816f..dbce7d3339f1eb2e27ad92016bcbbc79b498d9f4 100755 (executable)
@@ -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
index 58f578f89421e0e2b6e7568ff9d32c5567dedd20..6e49832d191ebb4c4d29fb829313ee01da18904c 100644 (file)
@@ -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<objects::CBioseq>   bs,
                                         bool                                             add_pig)
 {
     CRef<CBlast_def_line_set> 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
 
index c2fec8987aa26a743f95d1058847769ed7046bbb..2e6b4ab7d4568959552078ce31e2b10f8a16e6c0 100644 (file)
@@ -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);
index c64013c4d7d5b6a9dee9bf885debc500b9247bb9..e695957c30d3b9b0027ebc51c8aadbeb824f9b32 100644 (file)
@@ -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<CBlast_def_line_set>
 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<string> db(1, db_name);
+    vector<string> db;    
+    NStr::Split(db_name," ",db);
     CWriteDB_CreateAliasFile(file_name, db, seq_type, gi_file_name, title,
                              alias_type);
 }
index ee9cda5e051d6289c60b478122a29f15eb98cbce..89fa996a2518a3fe293446d7ba79f5b78f641c34 100644 (file)
@@ -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<CBioseq>             & 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<CBioseq>             & 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<CBlast_def_line_set>
 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<int> > v1, v2;
     set<TTaxId> t;
+    const bool kLimitDefline = false;
 
     CConstRef<CBioseq> 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;
 
index 0e7e00019f35f3cc637771ff7e365d7fe63420ed..56fc41888658cdd4d0d9b30a6e87e3d7cd800e05 100644 (file)
@@ -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<CBlast_def_line_set>
-    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<CBlast_def_line_set> & 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
index 137ecda52d177ce6649994c7796ba57479dcfa4c..63a553bbf34a42a468adf13a619ac9a6ee75718f 100644 (file)
@@ -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)
index d4cc0aee18e974abc1c11b90342c65bec93773ae..74a1c345f1b0eba142d4c82a6d34939f68f18593 100644 (file)
@@ -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
index 4c8865c4d72598c041d6e1bb49c9cee170288332..26e0ac017fede4084fd365f71d397522eb03dc49 100644 (file)
@@ -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 )
index 7771b185de94a7a4e592f55791432c2a79388993..686ca6c0262613a3df74badeda8958faf81de1b7 100644 (file)
@@ -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() ) {
index c4f3eff4f81179ef07523a8d4a599cb524efda52..27acc134280ad2e4eb0728f9c21fcfcd02ba6916 100644 (file)
@@ -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<const char*, const char*, PCase_CStr> 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<const char*, const char*> 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;
index 06872ff3fad25268b31a64918f53d27f2924c3da..f192460d5a4d266be3c293b32cd6a6d75bdd512d 100644 (file)
@@ -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 <objtools/logging/listener.hpp>
 
-#include "influenza_set.hpp"
+#include <objtools/cleanup/influenza_set.hpp>
 
 BEGIN_NCBI_SCOPE
 BEGIN_SCOPE(objects)
@@ -297,23 +297,12 @@ vector<CCleanupChangeCore::EChanges> CCleanupChangeCore::GetAllChanges() const
     return m_Changes;
 }
 
-
-vector<string> CCleanupChangeCore::GetAllDescriptions() const
-{
-    vector<string>  result;
-    result.reserve(m_Changes.size());
-    for (auto it: m_Changes) {
-        result.push_back( string( GetDescription(it) ) );
-    }
-    return result;
-}
-
 vector<string_view> CCleanupChangeCore::GetDescriptions() const
 {
-    vector<string_view>  result;
+    vector<string_view> 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<string>& 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
index 4f1d5e7301e79909880784fe1ef21a75e5b0e536..f8835aa6cd0996d5101b9ba70492a2f63377210c 100644 (file)
@@ -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';
 }
 
 
index 50fc4fc9365ac6fc411ad613a99af24a6373cb8d..732e997d0e596ac6ab0d175ad3d6ea642bf36158 100644 (file)
@@ -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<CSeq_loc> 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<CDbtag>& dbt1, const CRef<CDbtag>& 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 (file)
index 2bb6d3a..0000000
+++ /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 <ncbi_pch.hpp>
-
-#include <objtools/edit/huge_file_process.hpp>
-#include <objtools/cleanup/huge_file_cleanup.hpp>
-#include <objtools/cleanup/cleanup_change.hpp>
-#include <objtools/cleanup/cleanup.hpp>
-#include <objtools/cleanup/fix_feature_id.hpp>
-#include <objmgr/seq_entry_handle.hpp>
-#include <objects/seqfeat/BioSource.hpp>
-#include <objects/seqfeat/Feat_id.hpp>
-#include <objects/general/Object_id.hpp>
-#include <objtools/readers/objhook_lambdas.hpp>
-#include <serial/objistr.hpp>
-#include <serial/streamiter.hpp>
-
-#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<string, CConstRef<CSeq_id>> 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<CSeqdesc>& 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<CCleanupHugeAsnReader::TFeatId,CCleanupHugeAsnReader::TFeatId>;
-
-
-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<CSeq_entry> 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<typename TMap>
-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<CSeq_descr> seqDescrs, 
-        CConstRef<CSeq_descr> setDescrs,
-        const string& fluLabel,
-        set<size_t>& 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<CSeq_id>& pId, 
-        const set<CConstRef<CSeq_id>, 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<string, set<size_t>> fluLabelToSegs;
-    CConstRef<CSeq_descr> 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<size_t>& 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<string> 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<CSeq_id>& 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<CCleanupHugeAsnReader::TFeatId>;
-
-
-static void s_FindNextOffset(const TFeatIdSet &existing_ids,
-        const TFeatIdSet &new_existing_ids,
-        const TFeatIdSet &current_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<CBioseq>();
-
-    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<CBioseq_set>();
-
-    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<CBioseq_set::EClass>::SafeCast(memberInfo.GetObjectPtr());
-                    }
-                }
-                
-                auto* pBioseqSet = CTypeConverter<CBioseq_set>::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<CSeq_feat>(), objStream,
-            [this](CObjectIStream& in, const CObjectInfo& object)
-            {
-                auto* pObject = object.GetObjectPtr();
-                object.GetTypeInfo()->DefaultReadData(in, pObject);
-
-                if (!x_IsExtendedCleanup()) {
-                    return;
-                }
-                
-                auto* pSeqFeat = CTypeConverter<CSeq_feat>::SafeCast(pObject);
-
-                if (pSeqFeat->IsSetId()) {
-                    x_RecordFeatureId(pSeqFeat->GetId());
-                }
-
-                if (pSeqFeat->IsSetIds()) {
-                    for (auto pFeatId : pSeqFeat->GetIds()) {
-                        if (pFeatId) {
-                            x_RecordFeatureId(*pFeatId);
-                        }
-                    }
-                }
-            });
-
-
-    SetLocalSkipHook(CType<CSeq_feat>(), 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<CSeq_id> 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
index 2c5b2b15454a01239e05cc112dc4ed12db3b9c52..56953e4e59c3d9cc39b540b6dc567ded4d2b016d 100644 (file)
@@ -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 <ncbi_pch.hpp>
 #include <corelib/ncbistd.hpp>
-#include "influenza_set.hpp"
+#include <objtools/cleanup/influenza_set.hpp>
 
 #include <objects/seqfeat/Org_ref.hpp>
 #include <objects/seqfeat/OrgName.hpp>
diff --git a/c++/src/objtools/cleanup/influenza_set.hpp b/c++/src/objtools/cleanup/influenza_set.hpp
deleted file mode 100644 (file)
index 4a483b4..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef _INFLUENZA_SET_HPP_
-#define _INFLUENZA_SET_HPP_
-
-/* $Id: influenza_set.hpp 661173 2023-01-05 16:38:02Z 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:  
- *
- * File Description:
- *
- * ===========================================================================
- */
-
-#include <corelib/ncbistd.hpp>
-#include <objmgr/bioseq_handle.hpp>
-
-BEGIN_NCBI_SCOPE
-BEGIN_SCOPE(objects)
-
-class CInfluenzaSet : public CObject {
-public:
-    CInfluenzaSet(const string& key);
-    ~CInfluenzaSet() {}
-
-    static string GetKey(const COrg_ref& org);
-    bool OkToMakeSet() const;
-    void MakeSet();
-
-    typedef enum {
-        eNotInfluenza = 0,
-        eInfluenzaA,
-        eInfluenzaB,
-        eInfluenzaC,
-        eInfluenzaD
-    } EInfluenzaType;
-
-    static EInfluenzaType GetInfluenzaType(const string& taxname);
-    static size_t GetNumRequired(EInfluenzaType fluType);
-
-    void AddBioseq(CBioseq_Handle bsh);
-
-protected:
-    typedef vector<CBioseq_Handle> TMembers;
-    TMembers m_Members;
-    const string m_Key;
-    EInfluenzaType m_FluType;
-    size_t m_Required;
-};
-
-bool g_FindSegs(const CBioSource& src, size_t numRequired, set<size_t>& segsFound);
-
-END_SCOPE(objects)
-END_NCBI_SCOPE
-
-#endif // _INFLUENZA_SET_HPP_
index 38b991c7209f0d28ce8500f6b9d2dd200deab110..71f2cd243d6a9859e707200424f70ec4aada4542 100644 (file)
@@ -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<CSeq_interval> 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<CSeq_interval> 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<CSeq_loc> 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<CSeq_loc> 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<CSeqFeatXref> xref(new CSeqFeatXref);
-            xref->SetData().SetGene().SetLocus(val);
-            feat.SetXref().insert(feat.SetXref().begin(), xref);
-            ChangeMade(CCleanupChange::eCopyGeneXref);
+            if (!data.IsGene()) {
+                CRef<CSeqFeatXref> 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<CUser_object> 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<CUser_object> 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<CUser_object> 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<CUser_object> 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<CUser_object> 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<CPub>(&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;
         }
     }
 }
index 1125f54f66d10ad6c978a43f549da1ab19f0c5e6..3d951e69a3b081609fce7958cbc48e417ef700c0 100644 (file)
@@ -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 );
 
index 9b0baf17c4f8eb895ebc2ed6644caa1467eaa616..8f744e6d71aafdf1b71d66134027100dcc0c6fc4 100644 (file)
@@ -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<unsigned int>(m_SeqDataVector.size() - 1);
             }
             _ASSERT((end == (begin + (int)(0x1<<idx)*kRmtSequenceSliceSize)) || 
                     ((idx+1) == m_SeqDataVector.size()));
index 48c3179df191e2cf195ff33f0e71f256e48d944e..bd3515f9a95ebf705d830305a1f720ca1a95e640 100644 (file)
@@ -1,4 +1,4 @@
-/*  $Id: dispatcher.cpp 668141 2023-05-30 15:50:28Z grichenk $
+/*  $Id: dispatcher.cpp 675188 2023-11-16 13:46:47Z ivanov $
  * ===========================================================================
  *                            PUBLIC DOMAIN NOTICE
  *               National Center for Biotechnology Information
@@ -232,6 +232,17 @@ void CReadDispatcher::CheckReaders(void) const
 }
 
 
+bool CReadDispatcher::HasReaderWithHUPIncluded() const
+{
+    for ( auto& rd : m_Readers ) {
+        if ( rd.second->HasHUPIncluded() ) {
+            return true;
+        }
+    }
+    return false;
+}
+
+
 void CReadDispatcher::ResetCaches(void)
 {
     NON_CONST_ITERATE(TReaders, rd, m_Readers) {
index bb89587d50300e7d89dbd893d3cb6650203ab49c..bf3c0108a759d9cfa4d8753a84d30a1535e4f151 100644 (file)
@@ -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 <corelib/plugin_manager_impl.hpp>
 #include <corelib/plugin_manager_store.hpp>
 
+#include <util/md5.hpp>
+
 #include <algorithm>
 
 
@@ -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 != &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.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<string> 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<bool> initialized;
+    static atomic<bool> 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(&param_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();
 }
 
 
index 15cdebc53e3158fcfbc8a82579126dbdb23a034f..ef657edd3c5e6d28852e1b9fe997f5290d722dad 100644 (file)
@@ -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<CGBDataLoader_Native> 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<string, string> 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<string, string>
 CGBDataLoader_Native::GetReaderWriterName(const TParamTree* params, const CGBLoaderParams& loader_params) const
 {
     pair<string, string> 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<string> str_list;
     NStr::Split(str, ";", str_list);
     size_t reader_count = 0;
     for ( size_t i = 0; i < str_list.size(); ++i ) {
-        CRef<CReader> reader(x_CreateReader(str_list[i], reader_params, params));
+        CRef<CReader> 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<string> 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<TReaderManager> 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);
     }
index 2495b28071f0dbb8e95c55a7a5fcc193459c9341..4efd4d1b25cf92d403d4dcdedbf78c35a05c2074 100644 (file)
@@ -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<CPSGDataLoader> 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)
 
 // ===========================================================================
index aa9cef4b6e33bf777b66efca7bee321a4c8fbd09..01d818f3a5ea8070616d5f63c47259dde2c70dc7 100644 (file)
@@ -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<CPSG_Queue>(service_name);
 
+    {{
+        m_Queue = make_shared<CPSG_Queue>(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<const CPsgBlobId&>(*chunk->GetBlobId());
     _ASSERT(x_IsLocalCDDEntryId(blob_id));
     _ASSERT(!chunk->IsLoaded());
-    
     bool failed = false;
     shared_ptr<CPSG_NamedAnnotInfo> cdd_info;
     shared_ptr<CPSG_NamedAnnotStatus> cdd_status;
@@ -2719,7 +2733,7 @@ void CPSGDataLoader_Impl::LoadChunksOnce(CDataSource* data_source,
             const CPsgBlobId& blob_id = dynamic_cast<const CPsgBlobId&>(*chunk.GetBlobId());
             shared_ptr<CPSG_Request_Blob> 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<CPSG_Reply> CPSGDataLoader_Impl::x_SendRequest(shared_ptr<CPSG_Request> request)
 {
+    if ( m_RequestContext ) {
+        request->SetRequestContext(m_RequestContext);
+    }
     return m_Queue->SendRequestAndGetReply(request, DEFAULT_DEADLINE);
 }
 
index 4f6f9509e52559fd658395fc01c222ae4b391675..d4d51e42d4cc10a0c85827de2009f2ca7a7b7764 100644 (file)
@@ -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),
index d9b27d107527dde2c1873d5aef24340c5b484c61..4eb82463ce68bcd6850be80ce3080dd8ddf74a63 100644 (file)
@@ -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:
index e9ce41f59cdd170f365ce4bae3646f82246089d0..9a36624a560b3c87c8033206cae704e3e3b547da 100644 (file)
@@ -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)
index 10cbfd3a9572eb845c6d80a160a847338b02979e..83b33890c876a74e48b271f9dca674c0b7a56cac 100644 (file)
@@ -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
index c89ca485afda84b1d58e4db325aaeab45e68c23e..d849df52601d54691f48320f0c2183b40ab15c50 100644 (file)
@@ -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<CEUtils_ConnContext>& 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<CEUtils_ConnContext>& 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<CECitMatch_Request> 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<CPub> CEUtilsUpdaterBase::x_GetPub(TEntrezId pmid, EPubmedError* perr)
+CRef<CPubmed_entry> CEUtilsUpdater::x_GetPubmedEntry(TEntrezId pmid, EPubmedError* perr)
 {
     unique_ptr<CEFetch_Request> req(
         new CEFetch_Literature_Request(CEFetch_Literature_Request::eDB_pubmed, m_Ctx)
@@ -514,6 +514,11 @@ CRef<CPub> 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<CPub> 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<CPub> 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<CPub> CEUtilsUpdaterBase::x_GetPub(TEntrezId pmid, EPubmedError* perr)
     return {};
 }
 
+CRef<CPub> CEUtilsUpdater::x_GetPub(TEntrezId pmid, EPubmedError* perr)
+{
+    CRef<CPubmed_entry> pme = x_GetPubmedEntry(pmid, perr);
+    if (pme && pme->IsSetMedent()) {
+        CRef<CPub> 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<CPub> CEUtilsUpdater::GetPub(TEntrezId pmid, EPubmedError* perr)
+{
+    CConstRef<CPub> pub = GetPubmedEntry(pmid, perr);
+    if (pub && pub->IsMedline() && pub->GetMedline().IsSetCit()) {
+        CRef<CPub> ret(new CPub);
+        ret->SetArticle().Assign(pub->GetMedline().GetCit());
+        return ret;
+    }
+    return {};
+}
+
+CRef<CPub> CEUtilsUpdater::GetPubmedEntry(TEntrezId pmid, EPubmedError* perr)
 {
     return x_GetPub(pmid, perr);
 }
 
-CRef<CPub> CEUtilsUpdaterWithCache::GetPub(TEntrezId pmid, EPubmedError* perr)
+CRef<CPub> CEUtilsUpdaterWithCache::GetPubmedEntry(TEntrezId pmid, EPubmedError* perr)
 {
     m_num_requests++;
     CConstRef<CPub> pub;
@@ -642,7 +662,7 @@ static bool ParseJson(const string& json, vector<TEntrezId>& pmids, string& msg)
     return true;
 }
 
-bool CEUtilsUpdaterBase::DoPubSearch(const vector<string>& query, vector<TEntrezId>& pmids)
+bool CEUtilsUpdater::DoPubSearch(const vector<string>& query, vector<TEntrezId>& pmids)
 {
     static const string hostname = "pubmed.ncbi.nlm.nih.gov";
     static const string path     = "/api/citmatch";
index 2d054dcda9a483c482e3f83c2dd1a698979ae0fa..0576c7f59c8ab0876e773b0dd6ad48b60987c6c5 100644 (file)
@@ -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<CSeq_feat> pOverlappingRna =
-            sequence::GetBestOverlappingFeat(
-                cds.GetLocation(),
-                CSeqFeatData::e_Rna,
-                sequence::eOverlap_CheckIntRev,
-                *mpScope);
-        if (pOverlappingRna) {
-            continue;
-        }
-        CRef<CSeq_feat> 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<CFeat_id> pFeatId(new CFeat_id);
-        pFeatId->Assign(cds.GetId());
-        CRef<CSeqFeatXref> 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<CFeat_id> pGeneId(new CFeat_id);
-            pGeneId->Assign(parentGene.GetId());
-            CRef<CSeqFeatXref> 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<CSeq_feat> pOverlappingRna =
+        sequence::GetBestOverlappingFeat(
+            cds.GetLocation(),
+            CSeqFeatData::e_Rna,
+            sequence::eOverlap_CheckIntRev,
+            *mpScope);
+    
+    if (pOverlappingRna) {
+        return;
+    }
+
+    CRef<CSeq_feat> 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<CFeat_id> pFeatId(new CFeat_id);
+    pFeatId->Assign(cds.GetId());
+    CRef<CSeqFeatXref> 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<CFeat_id> pGeneId(new CFeat_id);
+        pGeneId->Assign(parentGene.GetId());
+        CRef<CSeqFeatXref> 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 (file)
index 06d511b..0000000
+++ /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 <ncbi_pch.hpp>
-
-#include <objtools/edit/huge_asn_loader.hpp>
-#include <objtools/edit/huge_asn_reader.hpp>
-#include <objmgr/impl/tse_loadlock.hpp>
-
-#include <objects/submit/Submit_block.hpp>
-#include <objects/seqfeat/BioSource.hpp>
-#include <objects/seqfeat/Org_ref.hpp>
-
-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<CSeq_descr> 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_macro_reader.cpp b/c++/src/objtools/edit/huge_asn_macro_reader.cpp
deleted file mode 100644 (file)
index f8f3ae7..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*  $Id: huge_asn_macro_reader.cpp 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:
-*
-*
-*/
-
-#include <ncbi_pch.hpp>
-#include <objtools/edit/huge_asn_macro_reader.hpp>
-
-BEGIN_NCBI_SCOPE
-BEGIN_SCOPE(objects)
-BEGIN_SCOPE(edit)
-
-void CMacroHugeAsnReader::ResetTopEntry()
-{
-    x_ResetTopEntry();
-}
-
-
-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 (file)
index 8a730cb..0000000
+++ /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 <ncbi_pch.hpp>
-
-#include <objects/seq/Bioseq.hpp>
-#include <objects/submit/Seq_submit.hpp>
-#include <objects/seqloc/Seq_id.hpp>
-#include <objects/seq/seq_id_handle.hpp>
-#include <objects/seq/Seq_inst.hpp>
-
-#include <serial/objistr.hpp>
-#include <corelib/ncbifile.hpp>
-
-#include <objtools/edit/huge_asn_reader.hpp>
-#include <objtools/readers/objhook_lambdas.hpp>
-#include <objects/seqfeat/Feat_id.hpp>
-#include <objects/general/Object_id.hpp>
-
-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<CSeq_id> 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<CSeq_id> 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<CSeqdesc> 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<CSeqdesc> CHugeAsnReader::GetClosestDescriptor(const TBioseqInfo& info, CSeqdesc::E_Choice choice) const
-{
-    CConstRef<CSeqdesc> 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<CSeqdesc> CHugeAsnReader::GetClosestDescriptor(const CSeq_id& id, CSeqdesc::E_Choice choice) const
-{
-    CConstRef<CSeq_id> pId(&id);
-    const auto* pInfo = FindBioseq(pId);
-    if (!pInfo) {
-        return {};
-    }
-    return GetClosestDescriptor(*pInfo, choice);
-}
-
-
-CRef<CSeq_entry> CHugeAsnReader::LoadSeqEntry(CConstRef<CSeq_id> seqid) const
-{
-    auto info = FindTopObject(seqid);
-    if (info)
-        return LoadSeqEntry(*info);
-    else
-        return {};
-}
-
-CRef<CSeq_entry> 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<CBioseq> CHugeAsnReader::LoadBioseq(CConstRef<CSeq_id> 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<CObjectIStream> 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<CBioseq>();
-    CObjectTypeInfo bioseq_set_info = CType<CBioseq_set>();
-    CObjectTypeInfo seqinst_info = CType<CSeq_inst>();
-
-    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<CSubmit_block>(), 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<CBioseq>();
-
-    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<CBioseq_set>();
-
-    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<CFeat_id>(), 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<CFeat_id>(), objStream, 
-            [this](CObjectIStream& in, const CObjectInfo& object)
-    {
-        auto* pObject = object.GetObjectPtr();
-        object.GetTypeInfo()->DefaultReadData(in, pObject);
-        auto* pFeatId = CTypeConverter<CFeat_id>::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<CSerialObject> 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<CSerialObject> serial(static_cast<CSerialObject*>(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<CSeq_descr> CHugeAsnReader::x_GetTopLevelDescriptors() const
-{
-    CRef<CSeq_descr> 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<CSubmit_block> CHugeAsnReader::GetSubmitBlock() const
-{
-    return m_submit_block;
-}
-
-CRef<CSeq_entry> 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 (file)
index a964655..0000000
+++ /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 <ncbi_pch.hpp>
-
-#include <objtools/edit/huge_file.hpp>
-#include <objtools/readers/format_guess_ex.hpp>
-#include <corelib/ncbifile.hpp>
-#include <objtools/readers/reader_exception.hpp>
-
-#include <serial/objistr.hpp>
-
-BEGIN_NCBI_SCOPE
-BEGIN_SCOPE(objects)
-BEGIN_SCOPE(edit)
-
-CHugeFile::CHugeFile(){}
-CHugeFile::~CHugeFile(){}
-
-void CHugeFile::Open(const std::string& filename, const set<TTypeInfo>* 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<CMemoryFile>(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<std::ifstream> 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<CObjectIStream> CHugeFile::MakeObjStream(std::streampos pos) const
-{
-    unique_ptr<CObjectIStream> 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<std::ifstream> 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 (file)
index 6acdcc6..0000000
+++ /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 <ncbi_pch.hpp>
-
-#include <objects/seq/Seqdesc.hpp>
-#include <objects/seq/Seq_descr.hpp>
-#include <objects/submit/Seq_submit.hpp>
-#include <objects/submit/Submit_block.hpp>
-#include <objects/seqloc/Seq_id.hpp>
-
-#include <objtools/edit/huge_file.hpp>
-#include <objtools/edit/huge_asn_reader.hpp>
-#include <objtools/edit/huge_file_process.hpp>
-
-#include <objects/submit/Submit_block.hpp>
-
-#include <objects/seqset/Bioseq_set.hpp>
-#include <objects/seq/Bioseq.hpp>
-#include <objects/seqset/Seq_entry.hpp>
-
-#include <objmgr/object_manager.hpp>
-#include <objmgr/scope.hpp>
-#include <objtools/edit/huge_asn_loader.hpp>
-
-BEGIN_NCBI_SCOPE
-
-BEGIN_SCOPE(objects)
-BEGIN_SCOPE(edit)
-
-namespace
-{
-
-    class CAutoRevoker
-    {
-    public:
-        template<class TLoader>
-        CAutoRevoker(struct SRegisterLoaderInfo<TLoader>& info)
-            : m_loader{ info.GetLoader() } {}
-        ~CAutoRevoker()
-        {
-            CObjectManager::GetInstance()->RevokeDataLoader(*m_loader);
-        }
-    private:
-        CDataLoader* m_loader = nullptr;
-    };
-
-}
-
-
-const set<TTypeInfo> 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<TTypeInfo>* 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<TTypeInfo>* 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<TTypeInfo>* 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<CSeq_id> seqid)
-{
-    if (!m_pReader->GetNextBlob()) {
-        return false;
-    }
-
-    do
-    {
-        m_pReader->FlattenGenbankSet();
-        CRef<CSeq_entry> 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<CScope> 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
index faa8572eda1f6be4d3d9473fd81675d52c78cb3a..663b4d1bbb2668b351804333fc0f98f820a1eb73 100644 (file)
@@ -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<CTitle::C_E>& 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<CPub> 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<CPub>(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<CCit_art> CPubFix::FetchPubPmId(TEntrezId pmid, IPubmedUpdater* upd)
+CRef<CCit_art> CPubFix::FetchPubPmId(TEntrezId pmid, CEUtilsUpdater* upd)
 {
     CRef<CCit_art> cit_art;
     if (!upd || pmid < ZERO_ENTREZ_ID) {
@@ -1396,7 +1379,7 @@ CRef<CCit_art> 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;
index 784e152b90eab52b8af74b44872712b9c7da1df0..7304362c15f6d2fba0bc18e25bc2269934038168 100644 (file)
@@ -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);
index 31b8ce0fdda7eb0aa8058b958946067a27f8507a..de95a70d74ce5692a40dac1198cf0e0344928167 100644 (file)
@@ -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 <ncbi_pch.hpp>
 
 #include <objects/taxon3/taxon3.hpp>
 
 #include <objects/pub/Pub_equiv.hpp>
-#include <objects/pub/Pub.hpp>
 #include <objects/seq/Pubdesc.hpp>
+#include <objects/medline/Medline_entry.hpp>
 
 #include <objects/seqfeat/Org_ref.hpp>
 #include <objects/submit/Seq_submit.hpp>
@@ -52,6 +52,7 @@
 // new
 #include <objects/biblio/Auth_list.hpp>
 #include <objects/biblio/Author.hpp>
+#include <objects/biblio/Cit_art.hpp>
 #include <objects/general/Person_id.hpp>
 #include <objects/general/Name_std.hpp>
 
@@ -91,14 +92,15 @@ static bool s_IsConnectionFailure(EPubmedError errorVal)
     return false;
 }
 
-CRef<CPub> s_GetPubFrompmid(IPubmedUpdater* upd, TEntrezId id, int maxAttempts, IObjtoolsListener* pMessageListener)
+static
+CRef<CPub> s_GetPubFrompmid(CEUtilsUpdater* upd, TEntrezId id, int maxAttempts, IObjtoolsListener* pMessageListener)
 {
     CRef<CPub> 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<CRef<CPub>>& 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<CPub> 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<std::mutex> guard(m_Mutex);
 
     TTaxId taxid = org.GetTaxId();
@@ -345,31 +355,26 @@ void CRemoteUpdater::xUpdateOrgTaxname(COrg_ref& org, FLogger logger)
 
     xInitTaxCache();
 
-    CRef<COrg_ref> new_org = m_taxClient->GetOrg(org, logger);
+    CRef<COrg_ref> 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<CEUtilsUpdaterWithCache*>(m_pubmed.get());
-            if (upd) {
-                upd->ClearCache();
-            }
-            break;
-        }
-        default:
-            break;
+        auto* upd = dynamic_cast<CEUtilsUpdaterWithCache*>(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<CRef<COrg_ref>> reflist;
         reflist.push_back(it.second.org_ref);
-        CRef<CTaxon3_reply> reply = m_taxClient->SendOrgRefList(reflist, logger);
+        CRef<CTaxon3_reply> 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<CEUtilsUpdaterWithCache*>(m_pubmed.get());
-            if (upd && ! dynamic_cast<CEUtilsUpdater*>(m_pubmed.get())) {
-                upd->ReportStats(os);
-            }
-            break;
-        }
-        default:
-            break;
+        auto* upd = dynamic_cast<CEUtilsUpdaterWithCache*>(m_pubmed.get());
+        if (upd) {
+            upd->ReportStats(os);
         }
     }
 }
index e81aab23e5117932406714746fe1483f40579910..124d0d57d5dc491c8f398bd1e310f98d3d4b1f66 100644 (file)
@@ -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 <CDelta_seq> GetDeltaSeqForPosition(const unsigned pos, const CBioseq_
       return CConstRef <CDelta_seq>();
    }
 
-   size_t offset = 0;
+   unsigned offset = 0;
 
    int len = 0;
    ITERATE (list <CRef <CDelta_seq> >, 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<CDelta_seq> 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) {
index 3939519e28c85a6ad6b1c2bcbc63944734cabdba..0a036fb767c4e4d4fc12128b8ec23cb9a66eeffe 100644 (file)
@@ -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<string, int> s_PubStatusId {
+    static const unordered_map<string, EPubStatus> s_PubStatusId {
         { "received", ePubStatus_received },
         { "accepted", ePubStatus_accepted },
         { "epublish", ePubStatus_epublish },
@@ -423,12 +423,15 @@ static CRef<CImprint> s_GetImprint(const CPubmedArticle& pubmed_article)
     {
         CRef<CPubStatusDateSet> date_set(new CPubStatusDateSet());
         for (auto pub_date : pubmed_data.GetHistory().GetPubMedPubDate()) {
-            CRef<CPubStatusDate> 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<CPubStatusDate> 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<CArticleIdSet> s_GetArticleIdSet(const CArticleIdList& article_id_list, con
     for (auto article_id_it : article_id_list.GetArticleId()) {
         CRef<objects::CArticleId> 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<TEntrezId>(str_id)));
index 65d1cbeacb79ad4d9033b3a4da6aca0d98a77866..82e358a566849ff48f71b7b046d6fc2b9ec1f041 100644 (file)
@@ -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)
 
index f8f6b38f71e23a77f3c5b8f0d3e061630c77b78d..3449424f1844a22918f54c36b4ea177c3c9637f7 100644 (file)
@@ -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
index d515228253001c0004b098c70e2661f66e685716..ec085cf6478f023010326230530bf7f8b26994a1 100644 (file)
@@ -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)
index 88d416dd3fe2873d9b4f1629161d6ff778d800e6..aef5493edbcc33f7da931a85c9690ed5d409c4a2 100644 (file)
@@ -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)
index 41905eb46207241c08d3aea9674b2570d5c42a7a..5861ca00e287c2e90f73607eb12611e208ac2fc8 100644 (file)
@@ -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<CSeq_feat> 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);
 
index 256cd0e35ffe7ad04aaccc5f1e34faa6e06af971..ae006f9295f9c3ded72c9c72ce09a55762cc490b 100644 (file)
@@ -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);
index 8e60b412a6feea3601ac55ce2ec62b009c3d4ce6..643c2503755827018a99bc85cb206a650dbab255 100644 (file)
@@ -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<CSeqEntryIndex> 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<CSourceFeatureItem> sf(new CSourceFeatureItem(*fi, ctx, m_Feat_Tree));
-            srcs.push_back(sf);
-        }
-    }
-}
-
 /* moved to sequence:: (RW-1446)
 static CConstRef<CSeq_feat> 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<CSeq_loc_Mapper> 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<CSeq_loc_Mapper> 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<CSourceFeatureItem> sf(new CSourceFeatureItem(*fi, ctx, m_Feat_Tree));
+                srcs.push_back(sf);
+                continue;
+            }
+            CConstRef<CSeq_loc> feat_loc(&fi->GetLocation());
+            // Map the feat_loc if we're using a slice (the "-from" and "-to" command-line options)
+            CRange<TSeqPos> 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<CSourceFeatureItem> 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,
index 14292c3e5dbf43e674418364c5c847a7ed26c2f8..e72ed0290b17eef793dc9f61b971e534ebf685f7 100644 (file)
@@ -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
index 1ad831434db41437df770b5af474d4356503d250..dfeab53005140793eb37fe9aed2191ff30051e31 100644 (file)
@@ -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<IFlatTextOStream> 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 << ");</script>";
 
     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 <span...>, without an endline
-        text_os->AddLine("</span>", 0, IFlatTextOStream::eAddNewline_No );
+        text_os->AddLine("</span>", 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 );
index ee24285a106f79e758ee29ff44f333daf8bb5daf..a960d9d95470cd63749da79fce2e817a50b50a05 100644 (file)
@@ -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<IFlatItem> 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<IFlatItem> 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<IFlatItem> item( new CTSAItem(CTSAItem::eTLS_Projects, *first, *last, uo, ctx) );
             ItemOS() << item;
         }
index a7a2969f8358c5308369eae9d9f104c393ae1d1c..0c5cb02e30ce3898bedfaf7089cd58ab92f29ce1 100644 (file)
@@ -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;
     }
 
index a337f2acf658cb74e3fb74d052dbc91a01e8b42e..b5ad1d6ebb852fbac8c8c1a33e83a144984cb7ea 100644 (file)
@@ -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<string> 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<TFieldData::TInts> pIntsDestroyer;
 
index cecce368e386065d48ec835f658cb345cc34e494..84c6de53257ad024cee1442434df4b3184c8cfaf 100644 (file)
@@ -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<string>      TAccBin;
     typedef vector <TAccBin>    TAccBins;
     TAccBins bins;
-    TAccBin* curr_bin = NULL;
+    TAccBin* curr_bin = nullptr;
 
     // populate the bins
     CAccessionItem::TExtra_accessions::const_iterator prev = xtra.begin();
index 4ca041bdfdfe9a23c7663d3da671eda4036765fe..658cb4ebe0afb81fb051406263fccf89d8818304 100644 (file)
@@ -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&) {
         }
     }
 
index e645e224ac09f8c757f4bfca718b3de7d719691f..48a5b9c15a5cf8f51afb0dfeaa2b0f1cb4972c22 100644 (file)
@@ -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:
index 2a92cc2e62b5f4ce59fbc96e3a0b0ec842ed9d6b..ed78a49ca24ba29d92346ec2c443109c54a6a8dd 100644 (file)
@@ -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<CSeq_feat> 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<CSeqEntryIndex> idx = ctx.GetSeqEntryIndex();
-    if (! idx) return;
-    const CBioseq_Handle& bsh = ctx.GetHandle();
-    CRef<CBioseqIndex> 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<CBioSource>  src_ref;
     CConstRef<CSeq_feat>   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<CBioSource>  src_ref;
     CConstRef<CSeq_feat>   src_feat;
 
-    /*
-    if (ctx.UsingSeqEntryIndex()) {
-        x_GatherInfoIdx(ctx);
-        return;
-    }
-    */
-
     if (ctx.IsProt()) {
         const CBioseq_Handle& bsh = ctx.GetHandle();
         src_feat = sequence::GetSourceFeatForProduct(bsh);
index ca630ce62a284e90f42b9cac18153f286edb18d9..dfd2144e603f7c601ae945f372ec60053ad4b5b5 100644 (file)
@@ -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<TPSG_Queue>()),
-    m_Service(service)
+    m_Service(service.empty() ? TPSG_Service::GetDefault() : service)
 {
 }
 
@@ -764,8 +765,8 @@ const char* s_GetBioIdResolution(EPSG_BioIdResolution value)
 }
 
 
-template <typename TIterator, class TGet>
-void s_DelimitedOutput(TIterator from, TIterator to, ostream& os, const char* prefix, char delimiter, TGet get)
+template <typename TIterator, class TDelimiter, class TGet>
+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_Reply> CPSG_Queue::SImpl::SendRequestAndGetReply(shared_ptr<CPSG
     const auto request_id = user_context ? *user_context : ioc.GetNewRequestId();
     auto reply = make_shared<SPSG_Reply>(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<SPSG_Request>(move(abs_path_ref), reply, request_context->Clone(), params);
+    auto request = make_shared<SPSG_Request>(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));
index 35d72b4fca0f5f06e54a2a250851a943ffd80eeb..97c7348d197e6745c0fcf2dbcc841e4fcbec304e 100644 (file)
@@ -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<const CPSG_Request> user_request);
 
     CService m_Service;
+    CPSG_Request::TFlags m_RequestFlags = CPSG_Request::eDefaultFlags;
     SThreadSafe<SPSG_UserArgsBuilder> m_UserArgsBuilder;
 };
 
index 7f6b7a49944aabdbaa779eef684f96b841821944..c1eda7847ca579e6f00eff22bcaf7e78fc765c1c 100644 (file)
@@ -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 <corelib/request_status.hpp>
+#include <corelib/ncbi_cookies.hpp>
 
 #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<unsigned>(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<void> SPSG_Request::SContext::Set()
     return guard;
 }
 
-SPSG_Request::SPSG_Request(string p, shared_ptr<SPSG_Reply> r, CRef<CRequestContext> c, const SPSG_Params& params) :
+SPSG_Request::SPSG_Request(string p, CPSG_Request::TFlags f, shared_ptr<SPSG_Reply> r, CRef<CRequestContext> 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 <class TOnRetry, class TOnFail>
 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<SPSG_IoImpl>(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<SPSG_IoImpl>(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();
index 419378a55992e45afa65d2167bf3a3d51c88c377..0347698a80f0e6ce3f8dd58831ef60d1bb89bd5b 100644 (file)
@@ -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 <class TGet>
-    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<SPSG_Reply> reply;
     SContext context;
     SPSG_Submitter submitted_by;
     SPSG_Processor processed_by;
 
-    SPSG_Request(string p, shared_ptr<SPSG_Reply> r, CRef<CRequestContext> c, const SPSG_Params& params);
+    SPSG_Request(string p, CPSG_Request::TFlags f, shared_ptr<SPSG_Reply> r, CRef<CRequestContext> 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 <class TSession>
+struct SPSG_Requests : private unordered_map<int32_t, SPSG_TimedRequest>
+{
+    SPSG_Requests(TSession& session) : m_Session(session) {}
+
+    using unordered_map::begin;
+    using unordered_map::end;
+    using unordered_map::size;
+    using unordered_map::find;
+
+    template <class... TArgs>
+    auto emplace(TArgs&&... args)
+    {
+        m_Session.RemoveStream();
+        return unordered_map::emplace(std::forward<TArgs>(args)...);
+    }
+
+    auto erase(iterator it)
+    {
+        m_Session.AddStreams(1);
+        return unordered_map::erase(it);
+    }
+
+    auto clear()
+    {
+        m_Session.AddStreams(static_cast<int>(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<int32_t, SPSG_TimedRequest>;
-
     SPSG_Submitter::TId GetInternalId() const { return this; }
 
     bool Fail(SPSG_Processor::TId processor_id, shared_ptr<SPSG_Request> 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<SNgHttp2_Header<NGHTTP2_NV_FLAG_NO_COPY_NAME>, eSize> m_Headers;
     SPSG_AsyncQueue& m_Queue;
-    TRequests m_Requests;
+    SPSG_Requests<SPSG_IoSession> m_Requests;
 };
 
 template <class TImpl>
index 72bf954c9164ec9de7d6546bdc06d2147e98ea92..1ace18bbc75df528cee85142c00a7d705cfc2955 100644 (file)
@@ -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<SPSG_Reply>& reply, bool sleep)
 {
-    auto request = make_shared<SPSG_Request>(string(), reply, CDiagContext::GetRequestContext().Clone(), params);
+    auto request = make_shared<SPSG_Request>(string(), CPSG_Request::eDefaultFlags, reply, CDiagContext::GetRequestContext().Clone(), params);
     vector<unique_ptr<SReceiver>> receivers;
 
     auto receive_impl = [&]() {
index 23022e2ddccc2f9bf5466da5c81dbe990b648425..4284710c82dbc6af53280d8ce2c6a3dcaac48348 100644 (file)
@@ -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::TMapStrEGap> 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() );
index c30fbc74edf424a57e1cc5ed6b8fbc0b5adf6eff..9556e6a65ea0e0c3e09098b92c35436c0b48c9b5 100644 (file)
@@ -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<CSeq_entry> 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<CSeq_entry> 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<CSeq_entry> 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<string>& 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;
         }
index 660f32b31a2df5daeb08fc04182c3c00586e6bb8..6473dbc0943dfb6594aeb322883929ee89feec61 100644 (file)
@@ -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()) {
index c059f27b5d476744170eb054c1b1cfa038d158fb..31f5de198d43991013704e4dc60da1026a632d39 100644 (file)
@@ -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<CSeq_loc>
@@ -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;
         }
     }
index c1f72328280a1c52b8375fcbb6dc168e965fb8d4..5a4e6653ca9d5710e5897160e9a33b6c8ba87453 100644 (file)
@@ -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<string, RecordType>;
     static TYPEORDER_MAP msTypeOrder;
index 2245acc07a777be40f86155dd85956907e9de333..cf44dac6bb4598d29d888f927c3fa30b1c21659f 100644 (file)
@@ -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<const CGtfReadRecord&>(record);
     auto recType = gff.NormalizedType();
 
-    using TYPEHANDLER = bool (CGtfReader::*)(const CGtfReadRecord&, CSeq_annot&);
-    using HANDLERMAP = map<string, TYPEHANDLER>;
-
-    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<string>& xVals = xit->second;
+            if (xVals.empty()) {
+                result.AddValue(xit->first, "");
+            }
+            else {
+                const set<string>& yVals = yit->second;
+                set<string> 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<CSeq_feat> 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<string> ignoredAttrs = {
-        "locus_tag", "transcript_id"
+    set<string> 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<string> ignoredAttrs = {
+    set<string> 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<string> ignoredAttrs = {
+    set<string> 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<string>& 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<CSeq_feat> 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<string> 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<CSeq_feat> pParentGene;
                 if (x_GetFeatureById(parentGeneFeatId, pParentGene)) {
                     xSetAncestorXrefs(*pFeature, *pParentGene);
+
                 }
                 break;
             }
index bdffa0bafae6296cfe962f349566e257a7a70b0f..22e6634470266842f7e3e92a87cb0bf493976dcc 100644 (file)
@@ -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 <ncbi_pch.hpp>
 
@@ -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 << "<message severity=\"" << NStr::XmlEncode(SeverityStr()) << "\" "
+        << "problem=\"" << NStr::XmlEncode(ProblemStr()) << "\" ";
+    if (GetCode()) {
+        string code = NStr::IntToString(GetCode());
+        if (GetSubCode()) {
+            code += "." + NStr::IntToString(GetSubCode());
+        }
+        out << "code=\"" << NStr::XmlEncode(code) << "\" ";
+    }
+    const string& seqid = SeqId();
+    if (! seqid.empty()) {
+        out << "seqid=\"" << NStr::XmlEncode(seqid) << "\" ";
+    }
+    out << "line=\"" << Line() << "\" ";
+    const string& feature = FeatureName();
+    if (! feature.empty()) {
+        out << "feature_name=\"" << NStr::XmlEncode(feature) << "\" ";
+    }
+    const string& qualname = QualifierName();
+    if (! qualname.empty()) {
+        out << "qualifier_name=\"" << NStr::XmlEncode(qualname) << "\" ";
+    }
+    const string& qualval = QualifierValue();
+    if (! qualval.empty()) {
+        out << "qualifier_value=\"" << NStr::XmlEncode(qualval) << "\" ";
+    }
+    out << ">";
+
+    // child nodes
+    ITERATE (TVecOfLines, line_it, OtherLines()) {
+        out << "<other_line>" << *line_it << "</other_line>";
+    }
+
+    out << "</message>" << 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
+ILineErrorCLineErrorEx::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
+ILineErrorCObjReaderLineException::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<CObjReaderParseException::EErrCode>(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<CObjReaderParseException::EErrCode>(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<CException::EErrCode>(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<CException::EErrCode>(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<CSerialObject> pObject)
+{
+    m_pObject = pObject;
+}
+
+CConstRef<CSerialObject> CObjReaderLineException::GetObject() const
+{
+    return m_pObject;
+}
+
 END_SCOPE(objects)
 END_NCBI_SCOPE
-
index 22a2e0e92f47a335804837d759948e065ca53ce0..484f6524c97a77563afd37f65863a0e973e4e055 100644 (file)
 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 << "<message severity=\"INFO\" ";
 
-    if( iNumDone > 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 << "&#xD;";
                 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
-
index 7796dabd71aaab9b726ab84e281e01edb258bfa1..fa85831a9847bcb0fd8a287522ad41cc808661bd 100644 (file)
@@ -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<string, string> s_ModNameMap =
  {"db-xref", "dbxref"},
  {"pubmed", "pmid"},
  {"ft-url-mod", "ft-mod"},
- {"ft-url", "ft-map"}
+ {"ft-url", "ft-map"},
+ {"geo-loc-name", "country"}
  };
 //);
 
index 5b4765ecf6c3c070ec7a4468cbbf60ae8b9de2f3..0dc41955abad946105387a025765151ab7decb91 100644 (file)
@@ -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);
 }
 
 
index 967b239593198cadd6b2ab7a336f516fe68da59e..bcc1432729d25ccebd1e47b6e71255cb6f42523c 100644 (file)
@@ -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<CSeq_annot>& annot )
+    CRef<CSeq_annot>& /*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
index 3e565f074a12ec8efb14d4518d8daaa10eb758c5..99fd91ef0384aba4669fef451cb09a9e654b0cc8 100644 (file)
@@ -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<CSeq_feat> m_pCurrentFeat;
     bool m_need_check_strand;
     string m_real_seqid;
     CRef<CSeq_id> m_seq_id;
@@ -502,6 +505,7 @@ private:
     ILineErrorListener* m_pMessageListener;
     unordered_set<string> m_ProcessedTranscriptIds;
     unordered_set<string> 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<string> 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<unsigned>(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<CObjReaderLineException> pErr (
+    unique_ptr<CObjReaderLineException> 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<CSeq_feat> & 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<CSeq_feat>& 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<CSeq_feat>& 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<unsigned>(m_reader->GetLineNumber()) :
-                                static_cast<unsigned>(m_reader->GetLineNumber())-1;
+                                x_GetLineNumber() :
+                                x_GetLineNumber()-1;
 
         string msg = "Reference feature is empty. Skipping feature.";
 
@@ -3256,6 +3134,7 @@ CRef<CSeq_annot> 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<CSeq_annot> CFeatureTableReader_Imp::ReadSequinFeatureTable (
     // map feature types to features
     TChoiceToFeatMap choiceToFeatMap;
 
-    CRef<CSeq_feat> 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<CSeq_annot> CFeatureTableReader_Imp::ReadSequinFeatureTable (
         if( m_reader->GetLineNumber() % 10000 == 0 &&
             m_reader->GetLineNumber() > 0 )
         {
-            PutProgress(m_real_seqid, static_cast<unsigned>(m_reader->GetLineNumber()), m_pMessageListener);
+            PutProgress(m_real_seqid, x_GetLineNumber(), m_pMessageListener);
         }
 
         // skip empty lines.
@@ -3338,11 +3217,13 @@ CRef<CSeq_annot> CFeatureTableReader_Imp::ReadSequinFeatureTable (
 
         } else if ( s_LineIndicatesOrder(line) ) {
 
+            _ASSERT(m_pCurrentFeat);
+
             // put nulls between feature intervals
-            CRef<CSeq_loc> loc_with_nulls = s_LocationJoinToOrder( sfp->GetLocation() );
+            CRef<CSeq_loc> 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<CSeq_annot> 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<unsigned>(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<CSeq_annot> 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<CSeq_annot> 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<CSeq_annot> 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<unsigned int>(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<CSeq_annot> annot = ReadSequinFeatureTable(reader, flags, pMessageListener, filter);
         if (entry.IsSeq()) { // only one place to go
             entry.SetSeq().SetAnnot().push_back(annot);
             continue;
index 74f7b8c3a6b7e0ead6b0a76e39385f8845ac9cc5..cd40920009beb7ecfe775a4ed26513fac617aa75 100644 (file)
@@ -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::ESubtype>(
-            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::ESubtype>(
-            CSubSource::GetTypeInfo_enum_ESubtype(),
+            CSubSource::ENUM_METHOD_NAME(ESubtype)(),
             skip_enum_names,
-            extra_smod_to_enum_names );
+            extra_smod_to_enum_names);
     }
 
     CSafeStatic<TSModSubSrcSubtype> kSModSubSrcSubtypeMap(
@@ -994,7 +994,7 @@ void CSourceModParser::x_ApplyMods(CAutoInitDesc<CBioSource>& 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<CBioSource>& 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") ) {
index 2a16ab2e1af178fdcbfa1c0f0253a1ec7da2946a..8d40bccd2cfaa12413493eeb3cf3796c2685f57a 100644 (file)
@@ -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
 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: "<<s_CreateTime);
+        LOG_POST_X(22, Info<<"CBAMDataLoader: "
+                   "Total attach time: "<<s_AttachTime);
+    }
 }
 
 
@@ -615,7 +636,8 @@ CBamFileInfo::CBamFileInfo(const CBAMDataLoader_Impl& impl,
         }
     }
     if ( GetDebugLevel() >= 1 ) {
-        LOG_POST_X(16, "Opened BAM file "<<bam.m_BamName<<" in "<<sw.Elapsed());
+        LOG_POST_X(16, Info<<"CBAMDataLoader: "
+                   "Opened BAM file "<<bam.m_BamName<<" in "<<sw.Elapsed());
     }
 }
 
@@ -893,6 +915,10 @@ bool CBamRefSeqInfo::x_LoadRangesCov(void)
     if ( m_CovFileName.empty() ) {
         return false;
     }
+    if ( m_File->GetBamDb().UsesRawIndex() && GetPreferRawIndexOverCoverageGraphParam() ) {
+        // use more precise index information
+        return false;
+    }
     try {
         CRef<CSeq_entry> entry(new CSeq_entry);
         CRef<CSeq_annot> annot;
@@ -929,6 +955,7 @@ bool CBamRefSeqInfo::x_LoadRangesCov(void)
         CConstRef<CUser_field> outliers = params->GetFieldRef("Outliers");
         double vmul = graph->GetA();
         double vadd = graph->GetB();
+        double outliers_mul = 1./slot;
 
         size_t non_zero_count = 0;
         vector<double> 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: "<<accumulate(data_sizes.begin(), data_sizes.end(), Uint8(0)));
+        LOG_POST_X(26, Info<<"CBAMDataLoader:"
+                   " Total cov: "<<accumulate(data_sizes.begin(), data_sizes.end(), Uint8(0)));
     }
     static const TSeqPos kZeroBlocks = 8;
     static const TSeqPos kMaxChunkLength = 300*1024*1024;
@@ -1082,7 +1110,14 @@ bool CBamRefSeqInfo::x_LoadRangesEstimated(void)
                 _ASSERT(cur_data_size > 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 "<<m_Chunks.size()<<
+                               " Range "<<last_pos<<"-"<<
+                               s_GetEnd(over_ends, i-zero_count-1, bin_size)<<
+                               " size: "<<cur_data_size);
+                }
+                info.m_DataSize = cur_data_size;
                 info.m_RefSeqRange.SetFrom(last_pos);
                 info.m_RefSeqRange.SetTo(s_GetEnd(over_ends, i-zero_count-1, bin_size));
                 _ASSERT(info.m_RefSeqRange.GetLength() > 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 "<<m_Chunks.size()<<
+                               " Range "<<last_pos<<"-"<<
+                               s_GetEnd(over_ends, i-zero_count, bin_size)<<
+                               " size: "<<0);
+                }
                 info.m_RefSeqRange.SetFrom(last_pos);
                 info.m_RefSeqRange.SetTo(s_GetEnd(over_ends, i-zero_count, bin_size));
                 _ASSERT(info.m_RefSeqRange.GetLength() > 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 "<<m_Chunks.size()<<
+                               " Range "<<last_pos<<"-"<<
+                               s_GetEnd(over_ends, i, bin_size)<<
+                               " size: "<<cur_data_size);
+                }
                 CBamRefSeqChunkInfo info;
-                info.m_AlignCount = cur_data_size;
+                info.m_DataSize = cur_data_size;
                 info.m_RefSeqRange.SetFrom(last_pos);
                 info.m_RefSeqRange.SetTo(s_GetEnd(over_ends, i, bin_size));
                 _ASSERT(info.m_RefSeqRange.GetLength() > 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 "<<GetRefSeq_id()<<" in "<<sw.Elapsed());
+        LOG_POST_X(17, Info<<"CBAMDataLoader: "
+                   "Initialized BAM refseq "<<GetRefSeq_id()<<" in "<<sw.Elapsed());
     }
 }
 
@@ -1378,7 +1428,7 @@ void CBamRefSeqInfo::LoadMainChunk(CTSE_Chunk_Info& chunk_info)
 
 
 static const double k_make_graph_seconds = 7.5e-9; // 133 MB/s
-static const double k_make_align_seconds = 80e-9; // 12 MB/s
+static const double k_make_align_seconds = 250e-9; // 4 MB/s
 static const double k_make_read_seconds = 80e-9; // 12 MB/s
 
 
@@ -1410,11 +1460,21 @@ void CBamRefSeqInfo::CreateChunks(CTSE_Split_Info& split_info)
         CRange<TSeqPos> 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<CTSE_Chunk_Info> chunk(new CTSE_Chunk_Info(base_id+eChunk_align));
                     chunk->x_SetLoadBytes(Uint4(min<size_t>(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: "<<GetRefSeq_id()<<": "
                                "Align Chunk "<<chunk->GetChunkId()<<": "<<wide_range<<
-                               " with "<<m_Chunks[range_id].GetAlignCount()<<" aligns");
+                               " with "<<align_count<<" aligns");
                 }
             }
         }
@@ -1485,7 +1545,7 @@ void CBamRefSeqInfo::CreateChunks(CTSE_Split_Info& split_info)
         if ( has_pileup ) {
             CRef<CTSE_Chunk_Info> 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 "<<GetRefSeqId()<<" @ "<<
+                       chunk.GetRefSeqRange()<<": "<<
+                       count<<" repl: "<<repl_count<<" fail: "<<fail_count<<
+                       " skipped: "<<skipped<<" in "<<time);
+            s_CreateTime += time;
+            sw1.Reset();
+            sw1.Start();
+        }
         int seq_chunk_id = range_id*kChunkIdMul+eChunk_short_seq+(sub_chunk-eChunk_align);
         CRef<CTSE_Chunk_Info> seq_chunk;
         ITERATE ( vector<CSeq_id_Handle>, 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 "<<GetRefSeqId()<<" @ "<<
+                       chunk.GetRefSeqRange()<<": "<<
+                       count<<" repl: "<<repl_count<<" fail: "<<fail_count<<
+                       " skipped: "<<skipped<<" in "<<time);
+        }
     }}
     if ( GetDebugLevel() >= 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: "<<type<<"0 in "<<cigar);
+                    ERR_POST_X(4, "CBAMDataLoader: Bad CIGAR length: "<<type<<"0 in "<<cigar);
                     break;
                 }
                 if ( type == '=' ) {
@@ -2491,7 +2578,7 @@ void CBamRefSeqInfo::LoadPileupChunk(CTSE_Chunk_Info& chunk_info)
                     ss_pos += seglen;
                 }
                 else if ( type != 'P' ) {
-                    ERR_POST_X(14, "Bad CIGAR char: "<<type<<" in "<<cigar);
+                    ERR_POST_X(14, "CBAMDataLoader: Bad CIGAR char: "<<type<<" in "<<cigar);
                     break;
                 }
             }
index ce6fc3c416447e9347bf6f8ce7864c4c609d5da3..feb4d5027ba6fc3952cea43d01da9cf44cd7786e 100644 (file)
@@ -1,4 +1,4 @@
-/*  $Id: test_bam_loader.cpp 649787 2022-05-10 18:40:00Z vasilche $
+/*  $Id: test_bam_loader.cpp 675189 2023-11-16 13:46:57Z ivanov $
 * ===========================================================================
 *
 *                            PUBLIC DOMAIN NOTICE
@@ -57,6 +57,8 @@ USING_SCOPE(objects);
 
 #define PILEUP_NAME_SUFFIX " pileup graphs"
 
+#define NCBI_FTP "https://ftp-ext.ncbi.nlm.nih.gov"
+
 CRef<CObjectManager> sx_GetOM(void)
 {
     SetDiagPostLevel(eDiag_Info);
@@ -1612,9 +1614,9 @@ vector<TQuery> 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<TQuery> s_GetQueries3()
 {
     vector<TQuery> 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 (file)
index f581272..0000000
+++ /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 (file)
index c888243..0000000
+++ /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 (file)
index f1339a7..0000000
+++ /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 (file)
index a1db848..0000000
+++ /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 (file)
index d57012b..0000000
+++ /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 <ncbi_pch.hpp>
-#include <sra/data_loaders/snp/snploader.hpp>
-#include <objmgr/scope.hpp>
-#include <objmgr/bioseq_handle.hpp>
-#include <objmgr/graph_ci.hpp>
-#include <objmgr/feat_ci.hpp>
-#include <objmgr/seq_table_ci.hpp>
-#include <objects/seqtable/seqtable__.hpp>
-#include <objtools/data_loaders/genbank/gbloader.hpp>
-#include <sra/readers/ncbi_traces_path.hpp>
-
-#include <corelib/test_boost.hpp>
-
-#include <common/test_assert.h>  /* This header must go last */
-
-USING_NCBI_SCOPE;
-USING_SCOPE(objects);
-
-static string s_LoaderName;
-
-enum ESNPSource {
-    eFromGB,
-    eFromSNP
-};
-
-static
-CRef<CScope> s_MakeScope0()
-{
-    CRef<CObjectManager> om = CObjectManager::GetInstance();
-    CGBDataLoader::RegisterInObjectManager(*om);
-    CRef<CScope> scope(new CScope(*om));
-    scope->AddDefaults();
-    return scope;
-}
-
-
-static
-CRef<CScope> s_MakeScope(const string& file_name = kEmptyStr)
-{
-    CRef<CObjectManager> 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<CScope> scope(new CScope(*om));
-    scope->AddDefaults();
-    scope->AddDataLoader(s_LoaderName);
-    return scope;
-}
-
-
-static
-void s_CheckSource(const string& descr,
-                   ESNPSource source,
-                   const set<CTSE_Handle>& tse_set)
-{
-    BOOST_CHECK_EQUAL(tse_set.size(), 1u);
-    for ( auto& tse : tse_set ) {
-        LOG_POST(descr<<": blob id: "<<tse.GetBlobId());
-        if ( source == eFromGB ) {
-            BOOST_CHECK(dynamic_cast<CGBDataLoader*>(tse.GetDataLoader()));
-        }
-        else {
-            BOOST_CHECK(dynamic_cast<CSNPDataLoader*>(tse.GetDataLoader()));
-        }
-    }
-}
-
-
-static
-void s_CheckSource(const string& descr,
-                   ESNPSource source,
-                   CFeat_CI feat_it)
-{
-    set<CTSE_Handle> 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<CTSE_Handle> 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<CScope> scope,
-                   const SAnnotSelector& sel,
-                   const string& str_id,
-                   CRange<TSeqPos> range = CRange<TSeqPos>::GetWhole())
-{
-    size_t ret = 0;
-    CRef<CSeq_id> seq_id(new CSeq_id(str_id));
-    CRef<CSeq_loc> loc(new CSeq_loc);
-    if ( range == CRange<TSeqPos>::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<CScope> scope,
-                   const SAnnotSelector& sel,
-                   const string& str_id,
-                   CRange<TSeqPos> range = CRange<TSeqPos>::GetWhole())
-{
-    CRef<CSeq_id> seq_id(new CSeq_id(str_id));
-    CRef<CSeq_loc> loc(new CSeq_loc);
-    if ( range == CRange<TSeqPos>::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<TSeqPos>(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<TSeqPos>(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<TSeqPos>(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<TSeqPos>(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<TSeqPos>(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<TSeqPos>(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<TSeqPos>(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<TSeqPos>(range_from, range_to), sel);
-        BOOST_CHECK(graph_it);
-        s_CheckSource(descr, source, graph_it);
-    }
-}
-
-
-BOOST_AUTO_TEST_CASE(GBImplicitNA)
-{
-    CRef<CScope> 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<CScope> 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<CScope> 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<CScope> 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<CScope> 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<CScope> 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<CSeq_id_Handle> 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<CScope> 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<CScope> 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<CScope> 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<CScope> 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<CScope> 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 (file)
index a87b47d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-[genbank]
-#vdb_snp=1
-[genbank/id2]
-#service = ID2_SNP2
index f3e1156cd1406e661ab482fd076507c45f4db296..bdf791c6b416ed2de11e1db8af56afec84bfc058 100644 (file)
@@ -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 "<<stat.first/double(1<<20)<<" MB"
                      " speed: "<<stat.first/(stat.second*(1<<20))<<" MB/s"
index 3b96b71c69a80fdcd8eb17b6df6042acf8b39b3c..5dbcda2377528721ad7f1c7bd062c496766e27c5 100644 (file)
@@ -1,4 +1,4 @@
-/*  $Id: vdbread.cpp 673881 2023-10-12 13:17:17Z ivanov $
+/*  $Id: vdbread.cpp 681697 2024-04-12 12:53:38Z ivanov $
  * ===========================================================================
  *
  *                            PUBLIC DOMAIN NOTICE
@@ -110,6 +110,10 @@ static int s_GetDebugLevel(void)
 }
 
 
+NCBI_PARAM_DECL(bool, VDB, DISABLE_PAGEMAP_THREAD);
+NCBI_PARAM_DEF(bool, VDB, DISABLE_PAGEMAP_THREAD, false);
+
+
 
 DEFINE_SRA_REF_TRAITS(VDBManager, const);
 DEFINE_SRA_REF_TRAITS(VDatabase, const);
@@ -1002,6 +1006,9 @@ void CVDBMgr::x_Init(void)
     CVFSManager vfs_mgr(*this);
     VFSManagerLogNamesServiceErrors(vfs_mgr, false);
     s_InitLocalKNS(CKNSManager(vfs_mgr));
+    if ( NCBI_PARAM_TYPE(VDB, DISABLE_PAGEMAP_THREAD)().Get() ) {
+        VDBManagerDisablePagemapThread(*this);
+    }
 }
 
 
index b7857943f0d99f4d66ee80b9ab01a965723cd06c..b2b0f2c80ae5ec5bbc45854a053cb245a68eaf7b 100644 (file)
@@ -1,4 +1,4 @@
-/*  $Id: wgsread.cpp 669671 2023-07-07 12:52:48Z ivanov $
+/*  $Id: wgsread.cpp 682492 2024-05-01 12:45:28Z ivanov $
  * ===========================================================================
  *
  *                            PUBLIC DOMAIN NOTICE
@@ -4833,7 +4833,14 @@ NCBI_gb_state CWGSSeqIterator::GetGBState(void) const
         return NCBI_gb_state_eWGSGenBankReplaced;
     }
     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;
 }
 
 
@@ -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;
 }
 
 
index 2bcba789dd933a36be82b54e8d1e3e35dca791a0..2f5899999e8bdcde1ca885076634a8539b75b594 100644 (file)
@@ -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;
 }
 
index ace13304461f47c031417323bae7e010d21f0c78..f9e291d83f32c974571f158d9d1285ab18e2d6ee 100644 (file)
@@ -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 );
index 6cbb593f18a8881d187a46fa7cc26fcfdf31d7a2..2befe096c2e9355c21b8ae4a5ef57a362361abab 100644 (file)
@@ -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
index dea1ffa0765145fc20152a6d34222a53254ce89e..fcb3e060a4def529267277060df71a27ac26e171 100644 (file)
 0x2040
 0x2041, "insertion mark"
 0x2042
-0x2043, " rectangle"
+0x2043, "-"
 0x2044
 0x2045
 0x2046