You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(10) |
Sep
|
Oct
|
Nov
|
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(1) |
Feb
(2) |
Mar
(3) |
Apr
(2) |
May
(10) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
2008 |
Jan
(6) |
Feb
(4) |
Mar
(5) |
Apr
(2) |
May
(1) |
Jun
(1) |
Jul
(4) |
Aug
(6) |
Sep
(2) |
Oct
(9) |
Nov
(1) |
Dec
(4) |
2009 |
Jan
(9) |
Feb
(2) |
Mar
(2) |
Apr
(2) |
May
(6) |
Jun
(18) |
Jul
(33) |
Aug
(39) |
Sep
(33) |
Oct
(24) |
Nov
(23) |
Dec
(22) |
2010 |
Jan
(29) |
Feb
(32) |
Mar
(51) |
Apr
(17) |
May
(31) |
Jun
(21) |
Jul
(32) |
Aug
(28) |
Sep
(35) |
Oct
(27) |
Nov
(11) |
Dec
(13) |
2011 |
Jan
(14) |
Feb
(13) |
Mar
(27) |
Apr
(27) |
May
(28) |
Jun
(20) |
Jul
(43) |
Aug
(52) |
Sep
(66) |
Oct
(61) |
Nov
(11) |
Dec
(8) |
2012 |
Jan
(20) |
Feb
(30) |
Mar
(38) |
Apr
(21) |
May
(33) |
Jun
(21) |
Jul
(25) |
Aug
(9) |
Sep
(24) |
Oct
(42) |
Nov
(27) |
Dec
(41) |
2013 |
Jan
(20) |
Feb
(35) |
Mar
(156) |
Apr
(298) |
May
(258) |
Jun
(201) |
Jul
(105) |
Aug
(60) |
Sep
(193) |
Oct
(245) |
Nov
(280) |
Dec
(194) |
2014 |
Jan
(63) |
Feb
(202) |
Mar
(200) |
Apr
(23) |
May
(53) |
Jun
(105) |
Jul
(18) |
Aug
(26) |
Sep
(110) |
Oct
(187) |
Nov
(97) |
Dec
(74) |
2015 |
Jan
(45) |
Feb
(55) |
Mar
(116) |
Apr
(116) |
May
(193) |
Jun
(164) |
Jul
(50) |
Aug
(111) |
Sep
(98) |
Oct
(71) |
Nov
(103) |
Dec
(63) |
2016 |
Jan
(33) |
Feb
(101) |
Mar
(182) |
Apr
(139) |
May
(140) |
Jun
(103) |
Jul
(165) |
Aug
(286) |
Sep
(208) |
Oct
(127) |
Nov
(97) |
Dec
(54) |
2017 |
Jan
(64) |
Feb
(335) |
Mar
(202) |
Apr
(212) |
May
(139) |
Jun
(127) |
Jul
(294) |
Aug
(154) |
Sep
(170) |
Oct
(152) |
Nov
(156) |
Dec
(62) |
2018 |
Jan
(168) |
Feb
(237) |
Mar
(196) |
Apr
(174) |
May
(174) |
Jun
(161) |
Jul
(127) |
Aug
(88) |
Sep
(149) |
Oct
(66) |
Nov
(52) |
Dec
(135) |
2019 |
Jan
(146) |
Feb
(126) |
Mar
(104) |
Apr
(58) |
May
(60) |
Jun
(28) |
Jul
(197) |
Aug
(129) |
Sep
(141) |
Oct
(148) |
Nov
(63) |
Dec
(100) |
2020 |
Jan
(74) |
Feb
(37) |
Mar
(59) |
Apr
(154) |
May
(194) |
Jun
(133) |
Jul
(313) |
Aug
(197) |
Sep
(49) |
Oct
(162) |
Nov
(143) |
Dec
(57) |
2021 |
Jan
(120) |
Feb
(107) |
Mar
(314) |
Apr
(157) |
May
(524) |
Jun
(169) |
Jul
(72) |
Aug
(133) |
Sep
(135) |
Oct
(146) |
Nov
(198) |
Dec
(325) |
2022 |
Jan
(409) |
Feb
(249) |
Mar
(138) |
Apr
(95) |
May
(102) |
Jun
(221) |
Jul
(66) |
Aug
(120) |
Sep
(192) |
Oct
(131) |
Nov
(53) |
Dec
(171) |
2023 |
Jan
(357) |
Feb
(82) |
Mar
(168) |
Apr
(218) |
May
(196) |
Jun
(86) |
Jul
(115) |
Aug
(49) |
Sep
(190) |
Oct
(102) |
Nov
(45) |
Dec
(76) |
2024 |
Jan
(86) |
Feb
(50) |
Mar
(324) |
Apr
(209) |
May
(197) |
Jun
(232) |
Jul
(194) |
Aug
(247) |
Sep
(219) |
Oct
(266) |
Nov
(328) |
Dec
(304) |
2025 |
Jan
(191) |
Feb
(115) |
Mar
(137) |
Apr
(32) |
May
(126) |
Jun
(403) |
Jul
(72) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sv...@op...> - 2025-02-15 17:54:24
|
Author: manx Date: Sat Feb 15 18:54:09 2025 New Revision: 22921 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22921 Log: [Var] FLAC: Update to v1.5.0 (2025-02-11). Modified: trunk/OpenMPT/build/premake/ext-flac.lua trunk/OpenMPT/include/flac/AUTHORS trunk/OpenMPT/include/flac/COPYING.Xiph trunk/OpenMPT/include/flac/OpenMPT.txt trunk/OpenMPT/include/flac/include/FLAC/all.h trunk/OpenMPT/include/flac/include/FLAC/assert.h trunk/OpenMPT/include/flac/include/FLAC/callback.h trunk/OpenMPT/include/flac/include/FLAC/export.h trunk/OpenMPT/include/flac/include/FLAC/format.h trunk/OpenMPT/include/flac/include/FLAC/metadata.h trunk/OpenMPT/include/flac/include/FLAC/ordinals.h trunk/OpenMPT/include/flac/include/FLAC/stream_decoder.h trunk/OpenMPT/include/flac/include/FLAC/stream_encoder.h trunk/OpenMPT/include/flac/include/share/alloc.h trunk/OpenMPT/include/flac/include/share/compat.h trunk/OpenMPT/include/flac/include/share/endswap.h trunk/OpenMPT/include/flac/include/share/macros.h trunk/OpenMPT/include/flac/include/share/private.h trunk/OpenMPT/include/flac/include/share/safe_str.h trunk/OpenMPT/include/flac/include/share/win_utf8_io.h trunk/OpenMPT/include/flac/src/libFLAC/bitmath.c trunk/OpenMPT/include/flac/src/libFLAC/bitreader.c trunk/OpenMPT/include/flac/src/libFLAC/bitwriter.c trunk/OpenMPT/include/flac/src/libFLAC/cpu.c trunk/OpenMPT/include/flac/src/libFLAC/crc.c trunk/OpenMPT/include/flac/src/libFLAC/fixed.c trunk/OpenMPT/include/flac/src/libFLAC/fixed_intrin_avx2.c trunk/OpenMPT/include/flac/src/libFLAC/fixed_intrin_sse2.c trunk/OpenMPT/include/flac/src/libFLAC/fixed_intrin_sse42.c trunk/OpenMPT/include/flac/src/libFLAC/fixed_intrin_ssse3.c trunk/OpenMPT/include/flac/src/libFLAC/float.c trunk/OpenMPT/include/flac/src/libFLAC/format.c trunk/OpenMPT/include/flac/src/libFLAC/include/private/all.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/bitmath.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/bitreader.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/bitwriter.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/cpu.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/crc.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/fixed.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/float.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/format.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/lpc.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/macros.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/memory.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/metadata.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/ogg_decoder_aspect.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/ogg_encoder_aspect.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/ogg_helper.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/ogg_mapping.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/stream_encoder.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/stream_encoder_framing.h trunk/OpenMPT/include/flac/src/libFLAC/include/private/window.h trunk/OpenMPT/include/flac/src/libFLAC/include/protected/all.h trunk/OpenMPT/include/flac/src/libFLAC/include/protected/stream_decoder.h trunk/OpenMPT/include/flac/src/libFLAC/include/protected/stream_encoder.h trunk/OpenMPT/include/flac/src/libFLAC/lpc.c trunk/OpenMPT/include/flac/src/libFLAC/lpc_intrin_avx2.c trunk/OpenMPT/include/flac/src/libFLAC/lpc_intrin_fma.c trunk/OpenMPT/include/flac/src/libFLAC/lpc_intrin_neon.c trunk/OpenMPT/include/flac/src/libFLAC/lpc_intrin_sse2.c trunk/OpenMPT/include/flac/src/libFLAC/lpc_intrin_sse41.c trunk/OpenMPT/include/flac/src/libFLAC/md5.c trunk/OpenMPT/include/flac/src/libFLAC/memory.c trunk/OpenMPT/include/flac/src/libFLAC/metadata_iterators.c trunk/OpenMPT/include/flac/src/libFLAC/metadata_object.c trunk/OpenMPT/include/flac/src/libFLAC/ogg_decoder_aspect.c trunk/OpenMPT/include/flac/src/libFLAC/ogg_encoder_aspect.c trunk/OpenMPT/include/flac/src/libFLAC/ogg_helper.c trunk/OpenMPT/include/flac/src/libFLAC/ogg_mapping.c trunk/OpenMPT/include/flac/src/libFLAC/stream_decoder.c trunk/OpenMPT/include/flac/src/libFLAC/stream_encoder.c trunk/OpenMPT/include/flac/src/libFLAC/stream_encoder_framing.c trunk/OpenMPT/include/flac/src/libFLAC/stream_encoder_intrin_avx2.c trunk/OpenMPT/include/flac/src/libFLAC/stream_encoder_intrin_sse2.c trunk/OpenMPT/include/flac/src/libFLAC/stream_encoder_intrin_ssse3.c trunk/OpenMPT/include/flac/src/libFLAC/version.rc trunk/OpenMPT/include/flac/src/libFLAC/window.c trunk/OpenMPT/include/flac/src/share/win_utf8_io/win_utf8_io.c Modified: trunk/OpenMPT/build/premake/ext-flac.lua ============================================================================== --- trunk/OpenMPT/build/premake/ext-flac.lua Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/build/premake/ext-flac.lua Sat Feb 15 18:54:09 2025 (r22921) @@ -115,7 +115,7 @@ filter {} defines { "FLAC__HAS_OGG=1" } links { "ogg" } - defines { "PACKAGE_VERSION=\"1.4.3\"" } + defines { "PACKAGE_VERSION=\"1.5.0\"" } filter {} filter { "kind:StaticLib" } defines { "FLAC__NO_DLL" } Modified: trunk/OpenMPT/include/flac/AUTHORS ============================================================================== --- trunk/OpenMPT/include/flac/AUTHORS Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/AUTHORS Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* FLAC - Free Lossless Audio Codec * Copyright (C) 2001-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * This file is part the FLAC project. FLAC is comprised of several * components distributed under different licenses. The codec libraries Modified: trunk/OpenMPT/include/flac/COPYING.Xiph ============================================================================== --- trunk/OpenMPT/include/flac/COPYING.Xiph Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/COPYING.Xiph Sat Feb 15 18:54:09 2025 (r22921) @@ -1,5 +1,5 @@ Copyright (C) 2000-2009 Josh Coalson -Copyright (C) 2011-2023 Xiph.Org Foundation +Copyright (C) 2011-2025 Xiph.Org Foundation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/OpenMPT.txt ============================================================================== --- trunk/OpenMPT/include/flac/OpenMPT.txt Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/OpenMPT.txt Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,5 @@ -flac 1.4.3. +flac 1.5.0 (2025-02-11). The FLAC package has been left pretty much untouched, except for a few changes: - * https://github.com/xiph/flac/pull/638 has been applied. * In `include/share/compat.h`, the Windows XP compatibility warning has been disabled. * All modifications have been marked with "/* OpenMPT */". Modified: trunk/OpenMPT/include/flac/include/FLAC/all.h ============================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/all.h Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/include/FLAC/all.h Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -436,6 +436,56 @@ * */ +/** \defgroup porting_1_4_3_to_1_5_0 Porting from FLAC 1.4.3 to 1.5.0 + * \ingroup porting + * + * \brief + * This module describes porting from FLAC 1.4.3 to FLAC 1.5.0. + * + * \section porting_1_4_3_to_1_5_0_summary Summary + * + * Between FLAC 1.4.3 and FLAC 1.5.0, there have been changes to + * existing C functions and enums: + * - the functions FLAC__metadata_get_streaminfo, + * FLAC__metadata_get_tags and FLAC__metadata_get_cuesheet can now + * read from Ogg FLAC files + * - when encoding Ogg FLAC files, the 'samples' argument of the + * write callback no longer always returns 0. + * - two error statuses have been added to the + * FLAC__StreamDecoderErrorStatus enum + * - one status is added to FLAC__StreamDecoderState, which is only + * used when the new decoding of chained streams functionality is + * enabled + * - one status is added to FLAC__StreamDecoderReadStatus, which is + * only used when the new decoding of chained streams functionality + * is enabled + * - the function + * FLAC__metadata_chain_write_with_callbacks_and_tempfile can now + * be used regardless of whether a tempfile is actually needed, + * which is useful when writing to a new file is desired anyway + * + * Furthermore, there have been the following additions: + * - the functions FLAC__stream_decoder_set_decode_chained_stream, + * FLAC__stream_decoder_get_decode_chained_stream, + * FLAC__stream_decoder_finish_link, + * FLAC__stream_decoder_skip_single_link, + * FLAC__stream_decoder_process_until_end_of_link and + * FLAC__stream_decoder_get_link_lengths have been added + * to support decoding of chained streams + * - the function FLAC__metadata_chain_write_new_file has been added, + * which is useful to combine copying of a file with changing its + * metadata + * - the function FLAC__stream_decoder_find_total_samples was added, + * which seeks to the end of a file to find the total number of + * samples + * - the function FLAC__stream_encoder_set_num_threads and + * FLAC__stream_encoder_get_num_threads have been added, which + * can be used to enable multithreading in the encoder + * + * For the C++ API, changes are the same, but in C++ nomenclature + * + */ + /** \defgroup flac FLAC C API * * The FLAC C API is the interface to libFLAC, a set of structures Modified: trunk/OpenMPT/include/flac/include/FLAC/assert.h ============================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/assert.h Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/include/FLAC/assert.h Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2001-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/include/FLAC/callback.h ============================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/callback.h Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/include/FLAC/callback.h Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2004-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/include/FLAC/export.h ============================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/export.h Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/include/FLAC/export.h Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -95,9 +95,9 @@ /** These \#defines will mirror the libtool-based library version number, see * http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning */ -#define FLAC_API_VERSION_CURRENT 13 +#define FLAC_API_VERSION_CURRENT 14 #define FLAC_API_VERSION_REVISION 0 /**< see above */ -#define FLAC_API_VERSION_AGE 1 /**< see above */ +#define FLAC_API_VERSION_AGE 0 /**< see above */ #ifdef __cplusplus extern "C" { Modified: trunk/OpenMPT/include/flac/include/FLAC/format.h ============================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/format.h Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/include/FLAC/format.h Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/include/FLAC/metadata.h ============================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/metadata.h Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/include/FLAC/metadata.h Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2001-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -62,9 +62,9 @@ * This module provides functions for creating and manipulating FLAC * metadata blocks in memory, and three progressively more powerful * interfaces for traversing and editing metadata in native FLAC files. - * Note that currently only the Chain interface (level 2) supports Ogg - * FLAC files, and it is read-only i.e. no writing back changed - * metadata to file. + * Note that currently only the Chain interface (level 2) and some + * functions in level 0 supports Ogg FLAC files, and they are + * read-only i.e. no writing back changed metadata to file. * * There are three metadata interfaces of increasing complexity: * @@ -144,10 +144,11 @@ * \{ */ -/** Read the STREAMINFO metadata block of the given FLAC file. This function - * will try to skip any ID3v2 tag at the head of the file. +/** Read the STREAMINFO metadata block of the given FLAC or Ogg FLAC + * file. This function will try to skip any ID3v2 tag at the head + * of the file. * - * \param filename The path to the FLAC file to read. + * \param filename The path to the FLAC or Ogg FLAC file to read. * \param streaminfo A pointer to space for the STREAMINFO block. Since * FLAC__StreamMetadata is a simple structure with no * memory allocation involved, you pass the address of @@ -163,10 +164,11 @@ */ FLAC_API FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetadata *streaminfo); -/** Read the VORBIS_COMMENT metadata block of the given FLAC file. This - * function will try to skip any ID3v2 tag at the head of the file. +/** Read the VORBIS_COMMENT metadata block of the given FLAC or Ogg FLAC + * file. This function will try to skip any ID3v2 tag at the head + * of the file. * - * \param filename The path to the FLAC file to read. + * \param filename The path to the FLAC or Ogg FLAC file to read. * \param tags The address where the returned pointer will be * stored. The \a tags object must be deleted by * the caller using FLAC__metadata_object_delete(). @@ -182,10 +184,11 @@ */ FLAC_API FLAC__bool FLAC__metadata_get_tags(const char *filename, FLAC__StreamMetadata **tags); -/** Read the CUESHEET metadata block of the given FLAC file. This - * function will try to skip any ID3v2 tag at the head of the file. +/** Read the CUESHEET metadata block of the given FLAC or Ogg FLAC + * file. This function will try to skip any ID3v2 tag at the head + * of the file. * - * \param filename The path to the FLAC file to read. + * \param filename The path to the FLAC or Ogg FLAC file to read. * \param cuesheet The address where the returned pointer will be * stored. The \a cuesheet object must be deleted by * the caller using FLAC__metadata_object_delete(). @@ -207,7 +210,8 @@ * function takes a number of parameters that act as constraints to * the search. The PICTURE block with the largest area matching all * the constraints will be returned, or \a *picture will be set to - * \c NULL if there was no such block. + * \c NULL if there was no such block. This function does not + * currently support reading from Ogg FLAC files. * * \param filename The path to the FLAC file to read. * \param picture The address where the returned pointer will be @@ -784,9 +788,6 @@ /**< FLAC__metadata_chain_write_with_callbacks() was called when the * chain write requires a tempfile; use * FLAC__metadata_chain_write_with_callbacks_and_tempfile() instead. - * Or, FLAC__metadata_chain_write_with_callbacks_and_tempfile() was - * called when the chain write does not require a tempfile; use - * FLAC__metadata_chain_write_with_callbacks() instead. * Always check FLAC__metadata_chain_check_if_tempfile_needed() * before writing via callbacks. */ @@ -923,11 +924,11 @@ * edited metadata back to the FLAC file does not require rewriting the * entire file. If rewriting is required, then a temporary workfile is * required. When writing metadata using callbacks, you must check - * this function to know whether to call - * FLAC__metadata_chain_write_with_callbacks() or - * FLAC__metadata_chain_write_with_callbacks_and_tempfile(). When - * writing with FLAC__metadata_chain_write(), the temporary file is - * handled internally. + * this function to know whether + * FLAC__metadata_chain_write_with_callbacks() can be used or + * FLAC__metadata_chain_write_with_callbacks_and_tempfile() is + * necessary. When writing with FLAC__metadata_chain_write(), the + * temporary file is handled internally. * * \param chain A pointer to an existing chain. * \param use_padding @@ -990,6 +991,28 @@ */ FLAC_API FLAC__bool FLAC__metadata_chain_write(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__bool preserve_file_stats); +/** Write all metadata out to a new FLAC file. + * + * This function works similar to FLAC__metadata_chain_write(), but is + * useful if writing to a new file is desired. This is more efficient + * than copying the file before changing it. + * + * For this write function to be used, the chain must have been read with + * FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg(), not + * FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_with_callbacks(). + * See also FLAC__metadata_chain_write_with_callbacks_and_tempfile() + * + * \param chain A pointer to an existing chain. + * \param use_padding See FLAC__metadata_chain_write() + * \param filename The filename of the new file. + * \assert + * \code chain != NULL \endcode + * \retval FLAC__bool + * \c true if the write succeeded, else \c false. On failure, + * check the status with FLAC__metadata_chain_status(). + */ +FLAC_API FLAC__bool FLAC__metadata_chain_write_new_file(FLAC__Metadata_Chain *chain, const char *filename, FLAC__bool use_padding); + /** Write all metadata out to a FLAC stream via callbacks. * * (See FLAC__metadata_chain_write() for the details on how padding is @@ -1031,7 +1054,8 @@ * FLAC file to edit, and a temporary handle to which the new FLAC * file will be written. It is the caller's job to move this temporary * FLAC file on top of the original FLAC file to complete the metadata - * edit. + * edit. This version of the write-with-callbacks function can also be + * used if writing to a new file is desired anyway. * * The \a handle must be open for reading and be seekable. The * equivalent minimum stdio fopen() file mode is \c "r" (or \c "rb" @@ -1046,8 +1070,6 @@ * For this write function to be used, the chain must have been read with * FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_with_callbacks(), * not FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg(). - * Also, FLAC__metadata_chain_check_if_tempfile_needed() must have returned - * \c true. * * \param chain A pointer to an existing chain. * \param use_padding See FLAC__metadata_chain_write() Modified: trunk/OpenMPT/include/flac/include/FLAC/ordinals.h ============================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/ordinals.h Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/include/FLAC/ordinals.h Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/include/FLAC/stream_decoder.h ============================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/stream_decoder.h Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/include/FLAC/stream_decoder.h Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -235,12 +235,20 @@ * state and can no longer be used. */ - FLAC__STREAM_DECODER_UNINITIALIZED + FLAC__STREAM_DECODER_UNINITIALIZED, /**< The decoder is in the uninitialized state; one of the * FLAC__stream_decoder_init_*() functions must be called before samples * can be processed. */ + FLAC__STREAM_DECODER_END_OF_LINK + /**< The decoder has reached the end of an Ogg FLAC chain link and a new + * link follows; FLAC__stream_decoder_finish_link() has to be called to + * progress. This state is only returned when decoding of chained + * streams is enabled with + * FLAC__stream_decoder_set_decode_chained_stream() + */ + } FLAC__StreamDecoderState; /** Maps a FLAC__StreamDecoderState to a C string. @@ -307,9 +315,14 @@ * of \c 0. */ - FLAC__STREAM_DECODER_READ_STATUS_ABORT + FLAC__STREAM_DECODER_READ_STATUS_ABORT, /**< An unrecoverable error occurred. The decoder will return from the process call. */ + FLAC__STREAM_DECODER_READ_STATUS_END_OF_LINK + /**< The read was attempted while at the end of the link. The semantics + * are the same as for FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM. + */ + } FLAC__StreamDecoderReadStatus; /** Maps a FLAC__StreamDecoderReadStatus to a C string. @@ -442,9 +455,21 @@ FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM, /**< The decoder encountered reserved fields in use in the stream. */ - FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA + FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA, /**< The decoder encountered a corrupted metadata block. */ + FLAC__STREAM_DECODER_ERROR_STATUS_OUT_OF_BOUNDS, + /**< The decoder encountered a otherwise valid frame in which + * the decoded samples exceeded the range offered by the stated + * bit depth. */ + + FLAC__STREAM_DECODER_ERROR_STATUS_MISSING_FRAME + /**< Two adjacent frames had frame numbers increasing by more than + * 1 or sample numbers increasing by more than the blocksize, + * indicating that one or more frame/frames was missing between + * them. The decoder will sent out one or more ´fake' constant + * subframes to fill up the gap. */ + } FLAC__StreamDecoderErrorStatus; /** Maps a FLAC__StreamDecoderErrorStatus to a C string. @@ -782,6 +807,33 @@ */ FLAC_API FLAC__bool FLAC__stream_decoder_set_ogg_serial_number(FLAC__StreamDecoder *decoder, long serial_number); +/** Set the "decode chained stream" flag. If set to \c false, the + * decoder will stop decoding when it encounters the end-of-stream + * of the first link in the chain. If set to \c true, decoding will + * continue: at the start of each link, FLAC__stream_decoder_get_state + * will return FLAC__STREAM_DECODER_SEARCH_FOR_METADATA. + * + * This function was made to decode chained Ogg streams, but it should + * be possible to chain regular FLAC files through the read callback + * by using FLAC__STREAM_DECODER_READ_STATUS_END_OF_LINK + * appropriately. + * + * Note that when this flag is set to true, the serial number set + * with FLAC__stream_decoder_set_ogg_serial_number is ignored. + * + * \note + * This function has no effect with native FLAC decoding. + * + * \default \c false + * \param decoder A decoder instance to set. + * \param allow Whether to allow chained streams. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_set_decode_chained_stream(FLAC__StreamDecoder* decoder, FLAC__bool value); + /** Set the "MD5 signature checking" flag. If \c true, the decoder will * compute the MD5 signature of the unencoded audio data while decoding * and compare it to the signature from the STREAMINFO block, if it @@ -814,7 +866,7 @@ * \code decoder != NULL \endcode * \a type is valid * \retval FLAC__bool - * \c false if the decoder is already initialized, else \c true. + * \c false if type is invalid, else \c true. */ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetadataType type); @@ -829,7 +881,7 @@ * \code decoder != NULL \endcode * \code id != NULL \endcode * \retval FLAC__bool - * \c false if the decoder is already initialized, else \c true. + * \c false when memory allocation fails, else \c true. */ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]); @@ -841,7 +893,7 @@ * \assert * \code decoder != NULL \endcode * \retval FLAC__bool - * \c false if the decoder is already initialized, else \c true. + * \c always \c true. */ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder); @@ -855,7 +907,7 @@ * \code decoder != NULL \endcode * \a type is valid * \retval FLAC__bool - * \c false if the decoder is already initialized, else \c true. + * \c false if type is invalid, else \c true. */ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetadataType type); @@ -870,7 +922,7 @@ * \code decoder != NULL \endcode * \code id != NULL \endcode * \retval FLAC__bool - * \c false if the decoder is already initialized, else \c true. + * \c false if memory allocation fails, else \c true. */ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]); @@ -882,7 +934,7 @@ * \assert * \code decoder != NULL \endcode * \retval FLAC__bool - * \c false if the decoder is already initialized, else \c true. + * \c always \c true. */ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder); @@ -906,6 +958,17 @@ */ FLAC_API const char *FLAC__stream_decoder_get_resolved_state_string(const FLAC__StreamDecoder *decoder); +/** Get the "decode chained stream" flag as described in + * \code FLAC__stream_decoder_set_decode_chained_stream \endcode. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_get_decode_chained_stream(const FLAC__StreamDecoder* decoder); + /** Get the "MD5 signature checking" flag. * This is the value of the setting, not whether or not the decoder is * currently checking the MD5 (remember, it can be turned off automatically @@ -932,6 +995,32 @@ */ FLAC_API FLAC__uint64 FLAC__stream_decoder_get_total_samples(const FLAC__StreamDecoder *decoder); +/** Seek to the end of the file being decoded to find the total number + * of samples. This will return a number of samples even if + * FLAC__stream_decoder_get_total_samples() returns 0. It can also + * be used to find the total number of samples of a chained stream, + * as it returns the total number of samples in all chain links + * combined. See FLAC__stream_decoder_set_decode_chained_stream() + * + * For this function to work, the stream must be seekable. Also, as + * seeking can fail, this function returns 0 when it was unable to + * find the total number of samples. Use + * FLAC__stream_decoder_get_state() in that case to find out whether + * the decoder is still valid. + * + * The state in which the decoder is left after calling this function + * is undefined and might change in the future. Use + * FLAC__stream_decoder_reset() to return the decoder to a defined + * state. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval uint32_t + * See above. + */ +FLAC_API FLAC__uint64 FLAC__stream_decoder_find_total_samples(FLAC__StreamDecoder *decoder); + /** Get the current number of channels in the stream being decoded. * Will only be valid after decoding has started and will contain the * value from the most recently decoded frame header. @@ -1023,6 +1112,43 @@ */ FLAC_API const void *FLAC__stream_decoder_get_client_data(FLAC__StreamDecoder *decoder); +#define FLAC__STREAM_DECODER_GET_LINK_LENGTHS_INVALID -1 +#define FLAC__STREAM_DECODER_GET_LINK_LENGTHS_NOT_INDEXED -2 +#define FLAC__STREAM_DECODER_GET_LINK_LENGTHS_MEMORY_ALLOCATION_ERROR -3 + +/** Get the link lengths in samples in a chained stream + * + * After either processing the whole file or using + * FLAC__stream_decoder_find_total_samples, this function + * returns an array with link lengths in samples. If it fails, + * it returns a negative number as error code, currently either + * FLAC__STREAM_DECODER_GET_LINK_LENGTHS_INVALID if the current + * decoder is not in a valid state or not processing a chained + * stream, FLAC__STREAM_DECODER_GET_LINK_LENGTHS_NOT_INDEXED if + * the stream hasn't been indexed yet, and + * FLAC__STREAM_DECODER_GET_LINK_LENGTHS_MEMORY_ALLOCATION_ERROR + * if allocating memory failed. + * + * If the function succeeds, the return value is the number of + * links. The link_lengths parameter is a FLAC__uint64 pointer + * which is allocated by the call, and must be freed by the user. + * If a null pointer is passed, the function only returns the + * number of links, not their lengths. The length of the returned + * array is equal to the number of links and thus to the return + * value of the function. + * + * \param decoder A decoder instance to query. + * \param link_lengths Address at which to return the link lengths + * array. + * \assert + * \code decoder != NULL \endcode + * \retval int32_t + * \c the number of links if successful, zero or a negative + * number if unsuccessful + */ + +FLAC_API int32_t FLAC__stream_decoder_get_link_lengths(FLAC__StreamDecoder *decoder, FLAC__uint64 **link_lengths); + /** Initialize the decoder instance to decode native FLAC streams. * * This flavor of initialization sets up the decoder to decode from a @@ -1394,6 +1520,23 @@ */ FLAC_API FLAC__bool FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder); +/** Finish the decoding process of the current link. + * Checks MD5 for current link and start processing of the next link. This + * function should only be used when the decoder state is + * FLAC__STREAM_DECODER_END_OF_LINK. After calling this function, the state + * is set to FLAC__STREAM_DECODER_SEARCH_FOR_METADATA. + * + * \param decoder An uninitialized decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if MD5 checking is on AND a STREAMINFO block was available + * AND the MD5 signature in the STREAMINFO block was non-zero AND the + * signature does not match the one computed by the decoder; else + * \c true. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_finish_link(FLAC__StreamDecoder *decoder); + /** Flush the stream input. * The decoder's input buffer will be cleared and the state set to * \c FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC. This will also turn @@ -1495,6 +1638,31 @@ */ FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder); +/** Decode until the end of the Ogg chain link. + * This version instructs the decoder to decode from the current + * position and continue until the end of link or until the + * callbacks return a fatal error. This function should not be + * used without enabling decoding of chained streams with + * FLAC__stream_decoder_set_decode_chained_stream() + * + * To start processing the next link after calling this function, + * call FLAC__stream_decoder_finish_link() + * + * As the decoder needs more input it will call the read callback. + * As each metadata block and frame is decoded, the metadata or write + * callback will be called with the decoded metadata or frame. + * + * \param decoder An initialized decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if any fatal read, write, or memory allocation error + * occurred (meaning decoding must stop), else \c true; for more + * information about the decoder, check the decoder state with + * FLAC__stream_decoder_get_state(). + */ +FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_link(FLAC__StreamDecoder *decoder); + /** Decode until the end of the stream. * This version instructs the decoder to decode from the current position * and continue until the end of stream (the read callback returns @@ -1557,6 +1725,34 @@ */ FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_frame(FLAC__StreamDecoder *decoder); +/** Skip one Ogg chain link. + * This version instructs the decoder to 'skip' the current ogg chain + * link. This function should not be used without enabling decoding + * of chained streams with + * FLAC__stream_decoder_set_decode_chained_stream() + * + * When the location ot the next link is already known (for example, + * because there has already been a seek in the stream) this function + * will seek to the end of the link and start processing, but when it + * is not, it will do various seeks (when possible) to find the end + * of the link. If seeking is not possible (or the tell and length + * callback do not work) it will simply read forward instead of + * seeking, much like a muted (but faster) version of + * FLAC__stream_decoder_process_until_end_of_link(). + * + * \param decoder An initialized decoder instance not in a metadata + * state. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if any fatal read, write, or memory allocation error + * occurred (meaning decoding must stop), or when decoding a format + * that does not support chaining, else \c true; for more + * information about the decoder, check the decoder state with + * FLAC__stream_decoder_get_state(). + */ +FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_link(FLAC__StreamDecoder *decoder); + /** Flush the input and seek to an absolute sample. * Decoding will resume at the given sample. Note that because of * this, the next write callback may contain a partial block. The @@ -1566,6 +1762,14 @@ * with FLAC__stream_decoder_flush() or reset with * FLAC__stream_decoder_reset() before decoding can continue. * + * When seeking in a chained stream with decoding of such streams + * enabled with FLAC__stream_decoder_set_decode_chained_stream(), + * this function seeks in the whole stream, over all links. When + * a seek to another link is performed, the decoder will also + * return metadata blocks of that link. If this is not desired, + * use FLAC__stream_decoder_set_metadata_ignore_all() before + * seeking. + * * \param decoder A decoder instance. * \param sample The target sample number to seek to. * \assert Modified: trunk/OpenMPT/include/flac/include/FLAC/stream_encoder.h ============================================================================== --- trunk/OpenMPT/include/flac/include/FLAC/stream_encoder.h Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/include/FLAC/stream_encoder.h Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -288,6 +288,11 @@ extern FLAC_API const char * const FLAC__StreamEncoderStateString[]; +#define FLAC__STREAM_ENCODER_SET_NUM_THREADS_OK 0 +#define FLAC__STREAM_ENCODER_SET_NUM_THREADS_NOT_COMPILED_WITH_MULTITHREADING_ENABLED 1 +#define FLAC__STREAM_ENCODER_SET_NUM_THREADS_ALREADY_INITIALIZED 2 +#define FLAC__STREAM_ENCODER_SET_NUM_THREADS_TOO_MANY_THREADS 3 + /** Possible return values for the FLAC__stream_encoder_init_*() functions. */ typedef enum { @@ -533,11 +538,17 @@ * callback is being called to write metadata. * * \note - * Unlike when writing to native FLAC, when writing to Ogg FLAC the - * write callback will be called twice when writing each audio - * frame; once for the page header, and once for the page body. - * When writing the page header, the \a samples argument to the - * write callback will be \c 0. + * Unlike when writing to native FLAC, when writing to Ogg FLAC the write + * callback will be called at least twice when writing each audio frame; once + * for the page header and once for the page body, possibly repeating this + * pair of calls several times in a batch with the same value of + * \a current_frame. When writing the page header, as well as in all but the + * first page body write of the batch, the \a samples argument to the write + * callback will be \c 0. For the write callback call containing the first + * page body, the \a samples argument is the number of samples contained in + * all newly added complete packets (not pages). This means that in case a + * packet is split over two pages, they are counted in the samples argument + * of the page on which the packet is completed. * * \note In general, FLAC__StreamEncoder functions which change the * state should not be called on the \a encoder while in the callback. @@ -1102,6 +1113,52 @@ */ FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, uint32_t value); +/** Set the maximum number of threads to use during encoding. + * Set to a value different than 1 to enable multithreaded encoding. + * + * Note that enabling multithreading encoding (i.e., setting a value + * different than 1) results in the behaviour of + * FLAC__stream_encoder_finish(), FLAC__stream_encoder_process(), + * FLAC__stream_encoder_process_interleaved() subtly changing. + * For example, calling one of the process functions with enough + * samples to fill a block might not always result in a call to + * the write callback with a frame coding these samples. Instead, + * blocks with samples are distributed among worker threads, + * meaning that the first few calls to those functions will + * return very quickly, while later calls might block if all + * threads are occupied. Also, certain calls to the process + * functions will results in several calls to the write callback, + * while subsequent calls might again return very quickly with no + * calls to the write callback. + * + * Also, a call to FLAC__stream_encoder_finish() blocks while + * waiting for all threads to finish, and therefore might take much + * longer than when not multithreading and result in multiple calls + * to the write callback. + * + * Calls to the write callback are guaranteed to be in the correct + * order. + * + * Currently, passing a value of 0 is synonymous with a value of 1, + * but this might change in the future. + * + * \default \c 1 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval uint32_t + * - \c FLAC__STREAM_ENCODER_SET_NUM_THREADS_OK if the number of threads was set correctly, + * - \c FLAC__STREAM_ENCODER_SET_NUM_THREADS_NOT_COMPILED_WITH_MULTITHREADING_ENABLED when + * multithreading was not enabled at compilation, + * - \c FLAC__STREAM_ENCODER_SET_NUM_THREADS_ALREADY_INITIALIZED when the encoder was + * already initialized, + * - \c FLAC__STREAM_ENCODER_SET_NUM_THREADS_TOO_MANY_THREADS when + * the number of threads was larger than the maximum allowed number of threads (currently + * 128). + */ +FLAC_API uint32_t FLAC__stream_encoder_set_num_threads(FLAC__StreamEncoder *encoder, uint32_t value); + /** Deprecated. Setting this value has no effect. * * \default \c 0 @@ -1435,6 +1492,16 @@ */ FLAC_API uint32_t FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder); +/** Get maximum number of threads setting. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval uint32_t + * See FLAC__stream_encoder_set_num_threads(). + */ +FLAC_API uint32_t FLAC__stream_encoder_get_num_threads(const FLAC__StreamEncoder *encoder); + /** Get the Rice parameter search distance setting. * * \param encoder An encoder instance to query. Modified: trunk/OpenMPT/include/flac/include/share/alloc.h ============================================================================== --- trunk/OpenMPT/include/flac/include/share/alloc.h Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/include/share/alloc.h Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* alloc - Convenience routines for safely allocating memory * Copyright (C) 2007-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -64,15 +64,19 @@ #endif #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -extern int alloc_check_threshold, alloc_check_counter; -static inline int alloc_check() { +extern int alloc_check_threshold, alloc_check_counter, alloc_check_keep_failing; + +static inline int alloc_check(void) { if(alloc_check_threshold == INT32_MAX) return 0; else if(alloc_check_counter++ == alloc_check_threshold) return 1; - else + else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold)) + return 1; + else { return 0; + } } #endif Modified: trunk/OpenMPT/include/flac/include/share/compat.h ============================================================================== --- trunk/OpenMPT/include/flac/include/share/compat.h Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/include/share/compat.h Sat Feb 15 18:54:09 2025 (r22921) @@ -1,5 +1,5 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2012-2023 Xiph.Org Foundation + * Copyright (C) 2012-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -63,8 +63,15 @@ #endif #endif #else +#ifndef HAVE_FSEEKO +#define fseeko fseek +#define ftello ftell +#define FLAC__off_t long +#define FLAC__OFF_T_MAX LONG_MAX +#else #define FLAC__off_t off_t -#define FLAC__OFF_T_MAX OFF_T_MAX +#define FLAC__OFF_T_MAX (sizeof(off_t) == sizeof(int64_t) ? INT64_MAX : sizeof(off_t) == sizeof(int32_t) ? INT32_MAX : -999999) +#endif #endif Modified: trunk/OpenMPT/include/flac/include/share/endswap.h ============================================================================== --- trunk/OpenMPT/include/flac/include/share/endswap.h Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/include/share/endswap.h Sat Feb 15 18:54:09 2025 (r22921) @@ -1,5 +1,5 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2012-2023 Xiph.Org Foundation + * Copyright (C) 2012-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/include/share/macros.h ============================================================================== --- trunk/OpenMPT/include/flac/include/share/macros.h Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/include/share/macros.h Sat Feb 15 18:54:09 2025 (r22921) @@ -1,5 +1,5 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2013-2023 Xiph.Org Foundation + * Copyright (C) 2013-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/include/share/private.h ============================================================================== --- trunk/OpenMPT/include/flac/include/share/private.h Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/include/share/private.h Sat Feb 15 18:54:09 2025 (r22921) @@ -1,5 +1,5 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2013-2023 Xiph.Org Foundation + * Copyright (C) 2013-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/include/share/safe_str.h ============================================================================== --- trunk/OpenMPT/include/flac/include/share/safe_str.h Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/include/share/safe_str.h Sat Feb 15 18:54:09 2025 (r22921) @@ -1,5 +1,5 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2013-2023 Xiph.Org Foundation + * Copyright (C) 2013-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/include/share/win_utf8_io.h ============================================================================== --- trunk/OpenMPT/include/flac/include/share/win_utf8_io.h Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/include/share/win_utf8_io.h Sat Feb 15 18:54:09 2025 (r22921) @@ -1,5 +1,5 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2013-2023 Xiph.Org Foundation + * Copyright (C) 2013-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/src/libFLAC/bitmath.c ============================================================================== --- trunk/OpenMPT/include/flac/src/libFLAC/bitmath.c Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/src/libFLAC/bitmath.c Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2001-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -71,3 +71,45 @@ v = (v < 0) ? (-(v+1)) : v; return FLAC__bitmath_ilog2_wide(v)+2; } + +/* An example of what FLAC__bitmath_extra_mulbits_unsigned() computes: + * + * extra_mulbits_unsigned( 0) = 0 + * extra_mulbits_unsigned( 1) = 0 + * extra_mulbits_unsigned( 2) = 1 + * extra_mulbits_unsigned( 3) = 2 + * extra_mulbits_unsigned( 4) = 2 + * extra_mulbits_unsigned( 5) = 3 + * extra_mulbits_unsigned( 6) = 3 + * extra_mulbits_unsigned( 7) = 3 + * extra_mulbits_unsigned( 8) = 3 + * extra_mulbits_unsigned( 9) = 4 + * extra_mulbits_unsigned(10) = 4 + * extra_mulbits_unsigned(11) = 4 + * extra_mulbits_unsigned(12) = 4 + * extra_mulbits_unsigned(13) = 4 + * extra_mulbits_unsigned(14) = 4 + * extra_mulbits_unsigned(15) = 4 + * extra_mulbits_unsigned(16) = 4 + * extra_mulbits_unsigned(17) = 5 + * extra_mulbits_unsigned(18) = 5 + * + * The intent of this is to calculate how many extra bits multiplication + * by a certain number requires. So, if a signal fits in a certain number + * of bits (for example 16) than multiplying by a number (for example 1024) + * grows that storage requirement (to 26 in this example). In effect this is + * is the log2 rounded up. + */ +uint32_t FLAC__bitmath_extra_mulbits_unsigned(FLAC__uint32 v) +{ + uint32_t ilog2; + if(v == 0) + return 0; + ilog2 = FLAC__bitmath_ilog2(v); + if(((v >> ilog2) << ilog2) == v) + /* v is power of 2 */ + return ilog2; + else + /* v is not a power of 2, return one higher */ + return ilog2 + 1; +} Modified: trunk/OpenMPT/include/flac/src/libFLAC/bitreader.c ============================================================================== --- trunk/OpenMPT/include/flac/src/libFLAC/bitreader.c Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/src/libFLAC/bitreader.c Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -939,23 +939,23 @@ v = x; i = 0; } - else if(x & 0xC0 && !(x & 0x20)) { /* 110xxxxx */ + else if((x & 0xE0) == 0xC0) { /* 110xxxxx */ v = x & 0x1F; i = 1; } - else if(x & 0xE0 && !(x & 0x10)) { /* 1110xxxx */ + else if((x & 0xF0) == 0xE0) { /* 1110xxxx */ v = x & 0x0F; i = 2; } - else if(x & 0xF0 && !(x & 0x08)) { /* 11110xxx */ + else if((x & 0xF8) == 0xF0) { /* 11110xxx */ v = x & 0x07; i = 3; } - else if(x & 0xF8 && !(x & 0x04)) { /* 111110xx */ + else if((x & 0xFC) == 0xF8) { /* 111110xx */ v = x & 0x03; i = 4; } - else if(x & 0xFC && !(x & 0x02)) { /* 1111110x */ + else if((x & 0xFE) == 0xFC) { /* 1111110x */ v = x & 0x01; i = 5; } @@ -994,27 +994,27 @@ v = x; i = 0; } - else if(x & 0xC0 && !(x & 0x20)) { /* 110xxxxx */ + else if((x & 0xE0) == 0xC0) { /* 110xxxxx */ v = x & 0x1F; i = 1; } - else if(x & 0xE0 && !(x & 0x10)) { /* 1110xxxx */ + else if((x & 0xF0) == 0xE0) { /* 1110xxxx */ v = x & 0x0F; i = 2; } - else if(x & 0xF0 && !(x & 0x08)) { /* 11110xxx */ + else if((x & 0xF8) == 0xF0) { /* 11110xxx */ v = x & 0x07; i = 3; } - else if(x & 0xF8 && !(x & 0x04)) { /* 111110xx */ + else if((x & 0xFC) == 0xF8) { /* 111110xx */ v = x & 0x03; i = 4; } - else if(x & 0xFC && !(x & 0x02)) { /* 1111110x */ + else if((x & 0xFE) == 0xFC) { /* 1111110x */ v = x & 0x01; i = 5; } - else if(x & 0xFE && !(x & 0x01)) { /* 11111110 */ + else if(x == 0xFE) { /* 11111110 */ v = 0; i = 6; } Modified: trunk/OpenMPT/include/flac/src/libFLAC/bitwriter.c ============================================================================== --- trunk/OpenMPT/include/flac/src/libFLAC/bitwriter.c Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/src/libFLAC/bitwriter.c Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -89,8 +89,8 @@ * next one. */ static const uint32_t FLAC__BITWRITER_DEFAULT_CAPACITY = 32768u / sizeof(bwword); /* size in words */ -/* When growing, increment 4K at a time */ -static const uint32_t FLAC__BITWRITER_DEFAULT_INCREMENT = 4096u / sizeof(bwword); /* size in words */ +/* When growing, increment with 1/4th at a time */ +static const uint32_t FLAC__BITWRITER_DEFAULT_GROW_FRACTION = 2; /* means grow by >> 2 (1/4th) of current size */ #define FLAC__WORDS_TO_BITS(words) ((words) * FLAC__BITS_PER_WORD) #define FLAC__TOTAL_BITS(bw) (FLAC__WORDS_TO_BITS((bw)->words) + (bw)->bits) @@ -131,11 +131,11 @@ * To prevent chrashing, give up */ return false; - /* round up capacity increase to the nearest FLAC__BITWRITER_DEFAULT_INCREMENT */ - if((new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT) - new_capacity += FLAC__BITWRITER_DEFAULT_INCREMENT - ((new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT); + /* As reallocation can be quite expensive, grow exponentially */ + if((new_capacity - bw->capacity) < (bw->capacity >> FLAC__BITWRITER_DEFAULT_GROW_FRACTION)) + new_capacity = bw->capacity + (bw->capacity >> FLAC__BITWRITER_DEFAULT_GROW_FRACTION); + /* make sure we got everything right */ - FLAC__ASSERT(0 == (new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT); FLAC__ASSERT(new_capacity > bw->capacity); FLAC__ASSERT(new_capacity >= bw->words + ((bw->bits + bits_to_add + FLAC__BITS_PER_WORD - 1) / FLAC__BITS_PER_WORD)); Modified: trunk/OpenMPT/include/flac/src/libFLAC/cpu.c ============================================================================== --- trunk/OpenMPT/include/flac/src/libFLAC/cpu.c Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/src/libFLAC/cpu.c Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2001-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -45,14 +45,6 @@ #include <cpuid.h> /* for __get_cpuid() and __get_cpuid_max() */ #endif -#ifndef NDEBUG -#include <stdio.h> -#define dfprintf fprintf -#else -/* This is bad practice, it should be a static void empty function */ -#define dfprintf(file, format, ...) -#endif - #if defined(HAVE_SYS_AUXV_H) #include <sys/auxv.h> #endif @@ -190,36 +182,12 @@ info->x86.bmi2 = (flags_ebx & FLAC__CPUINFO_X86_CPUID_BMI2 ) ? true : false; } -#if defined FLAC__CPU_IA32 - dfprintf(stderr, "CPU info (IA-32):\n"); -#else - dfprintf(stderr, "CPU info (x86-64):\n"); -#endif - dfprintf(stderr, " CMOV ....... %c\n", info->x86.cmov ? 'Y' : 'n'); - dfprintf(stderr, " MMX ........ %c\n", info->x86.mmx ? 'Y' : 'n'); - dfprintf(stderr, " SSE ........ %c\n", info->x86.sse ? 'Y' : 'n'); - dfprintf(stderr, " SSE2 ....... %c\n", info->x86.sse2 ? 'Y' : 'n'); - dfprintf(stderr, " SSE3 ....... %c\n", info->x86.sse3 ? 'Y' : 'n'); - dfprintf(stderr, " SSSE3 ...... %c\n", info->x86.ssse3 ? 'Y' : 'n'); - dfprintf(stderr, " SSE41 ...... %c\n", info->x86.sse41 ? 'Y' : 'n'); - dfprintf(stderr, " SSE42 ...... %c\n", info->x86.sse42 ? 'Y' : 'n'); - - if (FLAC__AVX_SUPPORTED) { - dfprintf(stderr, " AVX ........ %c\n", info->x86.avx ? 'Y' : 'n'); - dfprintf(stderr, " FMA ........ %c\n", info->x86.fma ? 'Y' : 'n'); - dfprintf(stderr, " AVX2 ....... %c\n", info->x86.avx2 ? 'Y' : 'n'); - dfprintf(stderr, " BMI2 ....... %c\n", info->x86.bmi2 ? 'Y' : 'n'); - } - /* * now have to check for OS support of AVX instructions */ if (FLAC__AVX_SUPPORTED && info->x86.avx && x86_osxsave && (cpu_xgetbv_x86() & 0x6) == 0x6) { os_avx = true; } - if (os_avx) { - dfprintf(stderr, " AVX OS sup . %c\n", info->x86.avx ? 'Y' : 'n'); - } if (!os_avx) { /* no OS AVX support */ info->x86.avx = false; Modified: trunk/OpenMPT/include/flac/src/libFLAC/crc.c ============================================================================== --- trunk/OpenMPT/include/flac/src/libFLAC/crc.c Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/src/libFLAC/crc.c Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: trunk/OpenMPT/include/flac/src/libFLAC/fixed.c ============================================================================== --- trunk/OpenMPT/include/flac/src/libFLAC/fixed.c Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/src/libFLAC/fixed.c Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -357,7 +357,7 @@ if(order_##macro_order##_is_valid && total_error_##macro_order < smallest_error) { \ order = macro_order; \ smallest_error = total_error_##macro_order ; \ - residual_bits_per_sample[ macro_order ] = (float)((total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double)data_len) / M_LN2 : 0.0); \ + residual_bits_per_sample[ macro_order ] = (float)((total_error_##macro_order > 0) ? log(M_LN2 * (double)total_error_##macro_order / (double)data_len) / M_LN2 : 0.0); \ } \ else \ residual_bits_per_sample[ macro_order ] = 34.0f; Modified: trunk/OpenMPT/include/flac/src/libFLAC/fixed_intrin_avx2.c ============================================================================== --- trunk/OpenMPT/include/flac/src/libFLAC/fixed_intrin_avx2.c Sat Feb 15 18:31:44 2025 (r22920) +++ trunk/OpenMPT/include/flac/src/libFLAC/fixed_intrin_avx2.c Sat Feb 15 18:54:09 2025 (r22921) @@ -1,6 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2023 Xiph.Org Foundation + * Copyright (C) 2011-2025 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -178,7 +178,7 @@ order = macro_order; \ smallest_error = total_error_##macro_order ; \ } \ - residual_bits_per_sample[ macro_order ] = (float)((total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double)data_len) / M_LN2 : 0.0); \ + residual_bits_per_sample[ macro_order ] = (float)((total_error_##macro_order > 0) ? log(M_LN2 * (double)total_error_##macro_order / (double)data_len) / M_LN2 : 0.0); \ } \ else \ residual_bits_per_sample[ macro_order ] = 34.0f; Modified: trunk/OpenMPT/include/flac/src/libFLAC/fixed_intrin_sse2.c ============================================================================== --- trunk/OpenMPT/include/flac/src/libFLAC/fixed_intrin_sse2.c Sat Feb 15 18:31:44 2025 (r2292... [truncated message content] |
From: <sv...@op...> - 2025-02-15 17:31:56
|
Author: manx Date: Sat Feb 15 18:31:44 2025 New Revision: 22920 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22920 Log: [Mod] build: Makefile: Use standard PAX tar format if possible. [Mod] build: Autotools: Use standard PAX tar format if possible. Modified: trunk/OpenMPT/Makefile trunk/OpenMPT/build/autotools/autoconfiscate.sh Modified: trunk/OpenMPT/Makefile ============================================================================== --- trunk/OpenMPT/Makefile Sat Feb 15 18:29:50 2025 (r22919) +++ trunk/OpenMPT/Makefile Sat Feb 15 18:31:44 2025 (r22920) @@ -373,6 +373,21 @@ endif +# tar + +ifeq ($(findstring Darwin,$(UNAME_S)),Darwin) +TAR_C=tar -c --format pax -f +else ifeq ($(findstring OpenBSD,$(UNAME_S)),OpenBSD) +TAR_C=tar -c -F pax -N +else ifeq ($(findstring BSD,$(UNAME_S)),BSD) +TAR_C=tar -c --format pax --numeric-owner --uname "" --gname "" --uid 0 --gid 0 +else +# GNU +TAR_C=tar -c --format=pax --numeric-owner --owner=0 --group=0 +#TAR_C=tar -c +endif + + # early build setup BINDIR_MADE:=$(shell $(MKDIR_P) bin) @@ -1930,7 +1945,7 @@ cd bin/$(FLAVOUR_DIR)dist-tar/ && rm -rf libopenmpt cd bin/$(FLAVOUR_DIR)dist-tar/ && mkdir -p libopenmpt/src.makefile/$(DIST_LIBOPENMPT_TARBALL_VERSION)/ cd bin/$(FLAVOUR_DIR)dist-tar/ && cp libopenmpt-$(DIST_LIBOPENMPT_VERSION).makefile.tar.gz libopenmpt/src.makefile/$(DIST_LIBOPENMPT_TARBALL_VERSION)/ - cd bin/$(FLAVOUR_DIR)dist-tar/ && tar cv --numeric-owner --owner=0 --group=0 -f ../dist-tar.tar libopenmpt + cd bin/$(FLAVOUR_DIR)dist-tar/ && $(TAR_C) -v -f ../dist-tar.tar libopenmpt .PHONY: dist-zip dist-zip: bin/$(FLAVOUR_DIR)dist-zip.tar @@ -1940,7 +1955,7 @@ cd bin/$(FLAVOUR_DIR)dist-zip/ && rm -rf libopenmpt cd bin/$(FLAVOUR_DIR)dist-zip/ && mkdir -p libopenmpt/src.msvc/$(DIST_LIBOPENMPT_TARBALL_VERSION)/ cd bin/$(FLAVOUR_DIR)dist-zip/ && cp libopenmpt-$(DIST_LIBOPENMPT_VERSION).msvc.zip libopenmpt/src.msvc/$(DIST_LIBOPENMPT_TARBALL_VERSION)/ - cd bin/$(FLAVOUR_DIR)dist-zip/ && tar cv --numeric-owner --owner=0 --group=0 -f ../dist-zip.tar libopenmpt + cd bin/$(FLAVOUR_DIR)dist-zip/ && $(TAR_C) -v -f ../dist-zip.tar libopenmpt .PHONY: dist-doc dist-doc: bin/$(FLAVOUR_DIR)dist-doc.tar @@ -1950,7 +1965,7 @@ cd bin/$(FLAVOUR_DIR)dist-doc/ && rm -rf libopenmpt cd bin/$(FLAVOUR_DIR)dist-doc/ && mkdir -p libopenmpt/doc/$(DIST_LIBOPENMPT_TARBALL_VERSION)/ cd bin/$(FLAVOUR_DIR)dist-doc/ && cp libopenmpt-$(DIST_LIBOPENMPT_VERSION).doc.tar.gz libopenmpt/doc/$(DIST_LIBOPENMPT_TARBALL_VERSION)/ - cd bin/$(FLAVOUR_DIR)dist-doc/ && tar cv --numeric-owner --owner=0 --group=0 -f ../dist-doc.tar libopenmpt + cd bin/$(FLAVOUR_DIR)dist-doc/ && $(TAR_C) -v -f ../dist-doc.tar libopenmpt .PHONY: dist-js dist-js: bin/$(FLAVOUR_DIR)dist-js.tar @@ -1960,7 +1975,7 @@ cd bin/$(FLAVOUR_DIR)dist-js/ && rm -rf libopenmpt cd bin/$(FLAVOUR_DIR)dist-js/ && mkdir -p libopenmpt/dev.js/$(DIST_LIBOPENMPT_TARBALL_VERSION)/ cd bin/$(FLAVOUR_DIR)dist-js/ && cp libopenmpt-$(DIST_LIBOPENMPT_VERSION).dev.js.tar.gz libopenmpt/dev.js/$(DIST_LIBOPENMPT_TARBALL_VERSION)/ - cd bin/$(FLAVOUR_DIR)dist-js/ && tar cv --numeric-owner --owner=0 --group=0 -f ../dist-js.tar libopenmpt + cd bin/$(FLAVOUR_DIR)dist-js/ && $(TAR_C) -v -f ../dist-js.tar libopenmpt .PHONY: dist-dos dist-dos: bin/$(FLAVOUR_DIR)dist-dos.tar @@ -1970,7 +1985,7 @@ cd bin/$(FLAVOUR_DIR)dist-dos/ && rm -rf libopenmpt cd bin/$(FLAVOUR_DIR)dist-dos/ && mkdir -p libopenmpt/bin.dos/$(DIST_LIBOPENMPT_TARBALL_VERSION)/ cd bin/$(FLAVOUR_DIR)dist-dos/ && cp libopenmpt-$(DIST_LIBOPENMPT_VERSION).bin.dos.zip libopenmpt/bin.dos/$(DIST_LIBOPENMPT_TARBALL_VERSION)/ - cd bin/$(FLAVOUR_DIR)dist-dos/ && tar cv --numeric-owner --owner=0 --group=0 -f ../dist-dos.tar libopenmpt + cd bin/$(FLAVOUR_DIR)dist-dos/ && $(TAR_C) -v -f ../dist-dos.tar libopenmpt .PHONY: dist-retro-win98 dist-retro-win98: bin/$(FLAVOUR_DIR)dist-retro-win98.tar @@ -1980,7 +1995,7 @@ cd bin/$(FLAVOUR_DIR)dist-retro-win98/ && rm -rf libopenmpt cd bin/$(FLAVOUR_DIR)dist-retro-win98/ && mkdir -p libopenmpt/bin.retro.win98/$(DIST_LIBOPENMPT_TARBALL_VERSION)/ cd bin/$(FLAVOUR_DIR)dist-retro-win98/ && cp libopenmpt-$(DIST_LIBOPENMPT_VERSION).bin.retro.win98.zip libopenmpt/bin.retro.win98/$(DIST_LIBOPENMPT_TARBALL_VERSION)/ - cd bin/$(FLAVOUR_DIR)dist-retro-win98/ && tar cv --numeric-owner --owner=0 --group=0 -f ../dist-retro-win98.tar libopenmpt + cd bin/$(FLAVOUR_DIR)dist-retro-win98/ && $(TAR_C) -v -f ../dist-retro-win98.tar libopenmpt .PHONY: dist-retro-win95 dist-retro-win95: bin/$(FLAVOUR_DIR)dist-retro-win95.tar @@ -1990,7 +2005,7 @@ cd bin/$(FLAVOUR_DIR)dist-retro-win95/ && rm -rf libopenmpt cd bin/$(FLAVOUR_DIR)dist-retro-win95/ && mkdir -p libopenmpt/bin.retro.win95/$(DIST_LIBOPENMPT_TARBALL_VERSION)/ cd bin/$(FLAVOUR_DIR)dist-retro-win95/ && cp libopenmpt-$(DIST_LIBOPENMPT_VERSION).bin.retro.win95.zip libopenmpt/bin.retro.win95/$(DIST_LIBOPENMPT_TARBALL_VERSION)/ - cd bin/$(FLAVOUR_DIR)dist-retro-win95/ && tar cv --numeric-owner --owner=0 --group=0 -f ../dist-retro-win95.tar libopenmpt + cd bin/$(FLAVOUR_DIR)dist-retro-win95/ && $(TAR_C) -v -f ../dist-retro-win95.tar libopenmpt .PHONY: bin/$(FLAVOUR_DIR)dist.mk bin/$(FLAVOUR_DIR)dist.mk: @@ -2022,7 +2037,7 @@ rm -rf bin/$(FLAVOUR_DIR)dist-doc/libopenmpt-$(DIST_LIBOPENMPT_VERSION).doc mkdir -p bin/$(FLAVOUR_DIR)dist-doc/libopenmpt-$(DIST_LIBOPENMPT_VERSION).doc cp -Rv bin/$(FLAVOUR_DIR)docs/html bin/$(FLAVOUR_DIR)dist-doc/libopenmpt-$(DIST_LIBOPENMPT_VERSION).doc/docs - cd bin/$(FLAVOUR_DIR)dist-doc/ && tar cv --numeric-owner --owner=0 --group=0 libopenmpt-$(DIST_LIBOPENMPT_VERSION).doc > libopenmpt-$(DIST_LIBOPENMPT_VERSION).doc.tar + cd bin/$(FLAVOUR_DIR)dist-doc/ && $(TAR_C) -v libopenmpt-$(DIST_LIBOPENMPT_VERSION).doc > libopenmpt-$(DIST_LIBOPENMPT_VERSION).doc.tar .PHONY: bin/$(FLAVOUR_DIR)dist-tar/libopenmpt-$(DIST_LIBOPENMPT_VERSION).makefile.tar bin/$(FLAVOUR_DIR)dist-tar/libopenmpt-$(DIST_LIBOPENMPT_VERSION).makefile.tar: bin/$(FLAVOUR_DIR)dist.mk bin/$(FLAVOUR_DIR)svn_version_dist.h @@ -2113,7 +2128,7 @@ svn export ./include/stb_vorbis bin/$(FLAVOUR_DIR)dist-tar/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/include/stb_vorbis cp bin/$(FLAVOUR_DIR)dist.mk bin/$(FLAVOUR_DIR)dist-tar/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/build/dist.mk cp bin/$(FLAVOUR_DIR)svn_version_dist.h bin/$(FLAVOUR_DIR)dist-tar/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/build/svn_version/svn_version.h - cd bin/$(FLAVOUR_DIR)dist-tar/ && tar cv --numeric-owner --owner=0 --group=0 libopenmpt-$(DIST_LIBOPENMPT_VERSION) > libopenmpt-$(DIST_LIBOPENMPT_VERSION).makefile.tar + cd bin/$(FLAVOUR_DIR)dist-tar/ && $(TAR_C) -v libopenmpt-$(DIST_LIBOPENMPT_VERSION) > libopenmpt-$(DIST_LIBOPENMPT_VERSION).makefile.tar .PHONY: bin/$(FLAVOUR_DIR)dist-zip/libopenmpt-$(DIST_LIBOPENMPT_VERSION).msvc.zip bin/$(FLAVOUR_DIR)dist-zip/libopenmpt-$(DIST_LIBOPENMPT_VERSION).msvc.zip: bin/$(FLAVOUR_DIR)dist.mk bin/$(FLAVOUR_DIR)svn_version_dist.h @@ -2253,7 +2268,7 @@ cp bin/$(FLAVOUR_DIR)stage/wasm/libopenmpt.wasm bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)wasm/libopenmpt.wasm mkdir -p bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)js cp bin/$(FLAVOUR_DIR)stage/js/libopenmpt.js bin/$(FLAVOUR_DIR)dist-js/libopenmpt-$(DIST_LIBOPENMPT_VERSION)/bin/$(FLAVOUR_DIR)js/libopenmpt.js - cd bin/$(FLAVOUR_DIR)dist-js/ && tar cv --numeric-owner --owner=0 --group=0 libopenmpt-$(DIST_LIBOPENMPT_VERSION) > libopenmpt-$(DIST_LIBOPENMPT_VERSION).dev.js.tar + cd bin/$(FLAVOUR_DIR)dist-js/ && $(TAR_C) -v libopenmpt-$(DIST_LIBOPENMPT_VERSION) > libopenmpt-$(DIST_LIBOPENMPT_VERSION).dev.js.tar .PHONY: bin/$(FLAVOUR_DIR)dist-dos/libopenmpt-$(DIST_LIBOPENMPT_VERSION).bin.dos.zip bin/$(FLAVOUR_DIR)dist-dos/libopenmpt-$(DIST_LIBOPENMPT_VERSION).bin.dos.zip: Modified: trunk/OpenMPT/build/autotools/autoconfiscate.sh ============================================================================== --- trunk/OpenMPT/build/autotools/autoconfiscate.sh Sat Feb 15 18:29:50 2025 (r22919) +++ trunk/OpenMPT/build/autotools/autoconfiscate.sh Sat Feb 15 18:31:44 2025 (r22920) @@ -294,16 +294,16 @@ case $TAR_FLAVOUR in mac) - tar -cv -f ../dist-autotools.tar libopenmpt + tar -cv --format pax -f ../dist-autotools.tar libopenmpt ;; bsd) - tar -cv -N -f ../dist-autotools.tar libopenmpt + tar -cv -F pax -N -f ../dist-autotools.tar libopenmpt ;; libarchive) - tar -cv --numeric-owner --uname "" --gname "" --uid 0 --gid 0 -f ../dist-autotools.tar libopenmpt + tar -cv --format pax --numeric-owner --uname "" --gname "" --uid 0 --gid 0 -f ../dist-autotools.tar libopenmpt ;; gnu) - tar -cv --numeric-owner --owner=0 --group=0 -f ../dist-autotools.tar libopenmpt + tar -cv --format=pax --numeric-owner --owner=0 --group=0 -f ../dist-autotools.tar libopenmpt ;; *) tar -cv -f ../dist-autotools.tar libopenmpt |
From: <sv...@op...> - 2025-02-15 17:30:05
|
Author: manx Date: Sat Feb 15 18:29:50 2025 New Revision: 22919 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22919 Log: [Mod] OpenMPT: Version is now 1.32.00.41 Modified: trunk/OpenMPT/common/versionNumber.h Modified: trunk/OpenMPT/common/versionNumber.h ============================================================================== --- trunk/OpenMPT/common/versionNumber.h Sat Feb 15 18:17:45 2025 (r22918) +++ trunk/OpenMPT/common/versionNumber.h Sat Feb 15 18:29:50 2025 (r22919) @@ -16,4 +16,4 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 32 #define VER_MINOR 00 -#define VER_MINORMINOR 40 +#define VER_MINORMINOR 41 |
From: <sv...@op...> - 2025-02-15 17:17:52
|
Author: manx Date: Sat Feb 15 18:17:45 2025 New Revision: 22918 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22918 Log: [Var] python: Update to v3.13.2. See r22917. Modified: branches/OpenMPT-1.31/build/download_externals.cmd Modified: branches/OpenMPT-1.31/build/download_externals.cmd ============================================================================== --- branches/OpenMPT-1.31/build/download_externals.cmd Sat Feb 15 18:16:36 2025 (r22917) +++ branches/OpenMPT-1.31/build/download_externals.cmd Sat Feb 15 18:17:45 2025 (r22918) @@ -44,7 +44,7 @@ call build\scriptlib\download.cmd %MPT_DOWNLOAD% x%1 "https://web.archive.org/web/20200918004813id_/http://download.microsoft.com/download/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe" "build\externals\htmlhelp.exe" d91371244ea98c691b4674ee266c4a2496a296800c176adae069d21f5c52c0763b21cc7859cfffa865b89e50171a2c99a6d14620c32f7d72c0ef04045348f856 3509072 || goto error -call build\scriptlib\download.cmd %MPT_DOWNLOAD% x%1 "https://www.python.org/ftp/python/3.13.1/python-3.13.1-embed-amd64.zip" "build\externals\python-3.13.1-embed-amd64.zip" a78713e292c9ee920bb8f44f33176e54d8807c70c343528cba2e11f22fba43082293df81d31aa0e6ed7e9a206568e28884e45ed68beaf36a0746d2bee0be6d90 10847803 || goto error +call build\scriptlib\download.cmd %MPT_DOWNLOAD% x%1 "https://www.python.org/ftp/python/3.13.2/python-3.13.2-embed-amd64.zip" "build\externals\python-3.13.2-embed-amd64.zip" a87d1d8e74efd79de42459ab18761406d398a246cddba4832f748bc3bfe3d9b8945ff4d0a29e95c770ca9a13d120c924b7ea514af6db5905e5821ace2ec53723 10854852 || goto error call build\scriptlib\download.cmd %MPT_DOWNLOAD% x%1 "https://netcologne.dl.sourceforge.net/project/innounp/innounp/innounp%%%%200.50/innounp050.rar" "build\externals\innounp050.rar" dbbc809308267a866db9d6b751fdeda6d179e1a65d8ddb14bb51984431ae91493f9a76105e1789b245732043a2c696c869ed10964b48cf59f81e55bd52f85330 141621 || goto error @@ -73,7 +73,7 @@ call build\scriptlib\unpack.cmd "include\winamp" "build\externals\WA5.55_SDK.exe" "." || goto error call build\scriptlib\unpack.cmd "include\xmplay" "build\externals\xmp-sdk.zip" "." || goto error -call build\scriptlib\unpack.cmd "build\tools\python3" "build\externals\python-3.13.1-embed-amd64.zip" "." || goto error +call build\scriptlib\unpack.cmd "build\tools\python3" "build\externals\python-3.13.2-embed-amd64.zip" "." || goto error call :killdir "build\tools\innounp" || goto error call :killdir "build\tools\innosetup" || goto error |
From: <sv...@op...> - 2025-02-15 17:16:43
|
Author: manx Date: Sat Feb 15 18:16:36 2025 New Revision: 22917 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22917 Log: [Var] python: Update to v3.13.2. Modified: trunk/OpenMPT/build/download_externals.cmd trunk/OpenMPT/build/download_externals.txt Modified: trunk/OpenMPT/build/download_externals.cmd ============================================================================== --- trunk/OpenMPT/build/download_externals.cmd Sat Feb 15 18:15:31 2025 (r22916) +++ trunk/OpenMPT/build/download_externals.cmd Sat Feb 15 18:16:36 2025 (r22917) @@ -47,7 +47,7 @@ call build\scriptlib\unpack.cmd "include\winamp" "build\externals\WA5.55_SDK.exe" "." || goto error call build\scriptlib\unpack.cmd "include\xmplay" "build\externals\xmp-sdk.zip" "." || goto error -call build\scriptlib\unpack.cmd "build\tools\python3" "build\externals\python-3.13.1-embed-amd64.zip" "." || goto error +call build\scriptlib\unpack.cmd "build\tools\python3" "build\externals\python-3.13.2-embed-amd64.zip" "." || goto error call :killdir "build\tools\innosetup" || goto error Modified: trunk/OpenMPT/build/download_externals.txt ============================================================================== --- trunk/OpenMPT/build/download_externals.txt Sat Feb 15 18:15:31 2025 (r22916) +++ trunk/OpenMPT/build/download_externals.txt Sat Feb 15 18:16:36 2025 (r22917) @@ -4,7 +4,7 @@ "build/externals/WA5.55_SDK.exe" 336166 394375db8a16bf155b5de9376f6290488ab339e503dbdfdc4e2f5bede967799e625c559cca363bc988324f1a8e86e5fd28a9f697422abd7bb3dcde4a766607b5 "https://download.nullsoft.com/winamp/plugin-dev/WA5.55_SDK.exe" "http://download.nullsoft.com/winamp/plugin-dev/WA5.55_SDK.exe" "https://web.archive.org/web/20131217072017id_/http://download.nullsoft.com/winamp/plugin-dev/WA5.55_SDK.exe" "build/externals/xmp-sdk.zip" 322903 67b96c6e6aa794e9de4f446d23f969e3591457196fd100c5475f5df52308de861a0c411db54fcb2bf46a12e9136ddda9d2974a5167432a979a701ef2c4679ef9 "https://www.un4seen.com/files/xmp-sdk.zip" "build/externals/htmlhelp.exe" 3509072 d91371244ea98c691b4674ee266c4a2496a296800c176adae069d21f5c52c0763b21cc7859cfffa865b89e50171a2c99a6d14620c32f7d72c0ef04045348f856 "https://web.archive.org/web/20200918004813id_/https://download.microsoft.com/download/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe" "https://web.archive.org/web/20200918004813id_/http://download.microsoft.com/download/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe" -"build/externals/python-3.13.1-embed-amd64.zip" 10847803 a78713e292c9ee920bb8f44f33176e54d8807c70c343528cba2e11f22fba43082293df81d31aa0e6ed7e9a206568e28884e45ed68beaf36a0746d2bee0be6d90 "https://www.python.org/ftp/python/3.13.1/python-3.13.1-embed-amd64.zip" +"build/externals/python-3.13.2-embed-amd64.zip" 10854852 a87d1d8e74efd79de42459ab18761406d398a246cddba4832f748bc3bfe3d9b8945ff4d0a29e95c770ca9a13d120c924b7ea514af6db5905e5821ace2ec53723 "https://www.python.org/ftp/python/3.13.2/python-3.13.2-embed-amd64.zip" "build/externals/innounp050.rar" 141621 dbbc809308267a866db9d6b751fdeda6d179e1a65d8ddb14bb51984431ae91493f9a76105e1789b245732043a2c696c869ed10964b48cf59f81e55bd52f85330 "https://netcologne.dl.sourceforge.net/project/innounp/innounp/innounp 0.50/innounp050.rar" "https://deac-fra.dl.sourceforge.net/project/innounp/innounp/innounp 0.50/innounp050.rar" "build/externals/innosetup-6.4.1.exe" 6236000 5dfc9999e2feafa28754baaf80cf73ac96414228b94a1132a919554a822c892810197305d9355885b9ac408c214691cd45279fc2df3a891fbebc4f8eb86bac87 "https://files.jrsoftware.org/is/6/innosetup-6.4.1.exe" "https://files.innosetup.nl/innosetup-6.4.1.exe" "build/externals/isetup-5.5.8-unicode.exe" 2342456 da7e27d85caec85b4194c7b1412c5a64c0ae12f22d903b94f2f4ee9ea0cb99c91b2d1dbb49262eefae8129e6b91f5c46f26f353011076e77e75f9c955fc5e1cb "https://files.jrsoftware.org/is/5/isetup-5.5.8-unicode.exe" "https://web.archive.org/web/20230523165634id_/https://files.jrsoftware.org/is/5/isetup-5.5.8-unicode.exe" |
From: <sv...@op...> - 2025-02-15 17:15:38
|
Author: manx Date: Sat Feb 15 18:15:31 2025 New Revision: 22916 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22916 Log: [Var] InnoSetup: Update to 6.4.1. Modified: trunk/OpenMPT/build/download_externals.cmd Modified: trunk/OpenMPT/build/download_externals.cmd ============================================================================== --- trunk/OpenMPT/build/download_externals.cmd Sat Feb 15 18:11:05 2025 (r22915) +++ trunk/OpenMPT/build/download_externals.cmd Sat Feb 15 18:15:31 2025 (r22916) @@ -52,7 +52,7 @@ call :killdir "build\tools\innosetup" || goto error mkdir "build\tools\innosetup" || goto error -"build\externals\innosetup-6.3.3.exe" /PORTABLE=1 /CURRENTUSER /DIR="%CD%\build\tools\innosetup\{app}" /LOG="%CD%\build\tools\innosetup\setup.log" /SILENT || goto error +"build\externals\innosetup-6.4.1.exe" /PORTABLE=1 /CURRENTUSER /DIR="%CD%\build\tools\innosetup\{app}" /LOG="%CD%\build\tools\innosetup\setup.log" /SILENT || goto error call :killdir "build\tools\innounp" || goto error call :killdir "build\tools\innosetup5" || goto error |
From: <sv...@op...> - 2025-02-15 17:11:18
|
Author: manx Date: Sat Feb 15 18:11:05 2025 New Revision: 22915 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22915 Log: [Var] InnoSetup: Update to 6.4.1. Modified: trunk/OpenMPT/build/download_externals.txt Modified: trunk/OpenMPT/build/download_externals.txt ============================================================================== --- trunk/OpenMPT/build/download_externals.txt Sat Feb 15 18:02:03 2025 (r22914) +++ trunk/OpenMPT/build/download_externals.txt Sat Feb 15 18:11:05 2025 (r22915) @@ -6,7 +6,7 @@ "build/externals/htmlhelp.exe" 3509072 d91371244ea98c691b4674ee266c4a2496a296800c176adae069d21f5c52c0763b21cc7859cfffa865b89e50171a2c99a6d14620c32f7d72c0ef04045348f856 "https://web.archive.org/web/20200918004813id_/https://download.microsoft.com/download/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe" "https://web.archive.org/web/20200918004813id_/http://download.microsoft.com/download/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe" "build/externals/python-3.13.1-embed-amd64.zip" 10847803 a78713e292c9ee920bb8f44f33176e54d8807c70c343528cba2e11f22fba43082293df81d31aa0e6ed7e9a206568e28884e45ed68beaf36a0746d2bee0be6d90 "https://www.python.org/ftp/python/3.13.1/python-3.13.1-embed-amd64.zip" "build/externals/innounp050.rar" 141621 dbbc809308267a866db9d6b751fdeda6d179e1a65d8ddb14bb51984431ae91493f9a76105e1789b245732043a2c696c869ed10964b48cf59f81e55bd52f85330 "https://netcologne.dl.sourceforge.net/project/innounp/innounp/innounp 0.50/innounp050.rar" "https://deac-fra.dl.sourceforge.net/project/innounp/innounp/innounp 0.50/innounp050.rar" -"build/externals/innosetup-6.3.3.exe" 5634744 785e7cdad84da42ddfc94f8e20b7150a92fbca1904cfa4d7e23f68b874fba134e9c91a1fb5a8291e7e334f57c1063061d3e8496a2d9e7c4d9415ea9f12a3522e "https://files.jrsoftware.org/is/6/innosetup-6.3.3.exe" "https://files.innosetup.nl/innosetup-6.3.3.exe" +"build/externals/innosetup-6.4.1.exe" 6236000 5dfc9999e2feafa28754baaf80cf73ac96414228b94a1132a919554a822c892810197305d9355885b9ac408c214691cd45279fc2df3a891fbebc4f8eb86bac87 "https://files.jrsoftware.org/is/6/innosetup-6.4.1.exe" "https://files.innosetup.nl/innosetup-6.4.1.exe" "build/externals/isetup-5.5.8-unicode.exe" 2342456 da7e27d85caec85b4194c7b1412c5a64c0ae12f22d903b94f2f4ee9ea0cb99c91b2d1dbb49262eefae8129e6b91f5c46f26f353011076e77e75f9c955fc5e1cb "https://files.jrsoftware.org/is/5/isetup-5.5.8-unicode.exe" "https://web.archive.org/web/20230523165634id_/https://files.jrsoftware.org/is/5/isetup-5.5.8-unicode.exe" "build/externals/example_songs_ompt_1_30.7z" 4881392 bfecf7f97fd71bd52bcfb38307ccb98c751e6a0fa0c1f31208b22b9392f03ea3da8f9271327df2de4fc2e463e0c13c6a24107fbe18caf8f446b7e7cf93073fa5 "https://download.openmpt.org/resources/modules/example_songs_ompt_1_30.7z" "build/externals/allegro-4.2.3.1-hg.8+r8500.zip" 3872466 46cd8d4d7138b795dbc66994e953d0abc578c6d3c00615e3580237458529d33d7ad9d269a9778918d4b3719d75750d5cca74ff6bf38ad357a766472799ee9e7b "https://lib.openmpt.org/files/libopenmpt/contrib/allegro/allegro-4.2.3.1-hg.8+r8500.zip" "https://mercury.sexy/members/manx/liballegro-4.2/allegro-4.2.3.1-hg.8+r8500.zip" |
From: <sv...@op...> - 2025-02-15 17:02:15
|
Author: manx Date: Sat Feb 15 18:02:03 2025 New Revision: 22914 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22914 Log: [Mod] libopenmpt: Bump patch version. Modified: branches/OpenMPT-1.29/libopenmpt/dox/changelog.md Modified: branches/OpenMPT-1.29/libopenmpt/dox/changelog.md ============================================================================== --- branches/OpenMPT-1.29/libopenmpt/dox/changelog.md Sat Feb 15 18:01:47 2025 (r22913) +++ branches/OpenMPT-1.29/libopenmpt/dox/changelog.md Sat Feb 15 18:02:03 2025 (r22914) @@ -7,6 +7,8 @@ ### libopenmpt 0.5.37-pre + * pugixml: Update to v1.15 (2025-01-10). + ### libopenmpt 0.5.36 (2025-01-06) * `module::get_current_estimated_bpm` could return infinity when rows per beat |
From: <sv...@op...> - 2025-02-15 17:01:59
|
Author: manx Date: Sat Feb 15 18:01:47 2025 New Revision: 22913 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22913 Log: [Mod] libopenmpt: Bump patch version. Modified: branches/OpenMPT-1.30/libopenmpt/dox/changelog.md Modified: branches/OpenMPT-1.30/libopenmpt/dox/changelog.md ============================================================================== --- branches/OpenMPT-1.30/libopenmpt/dox/changelog.md Sat Feb 15 18:01:18 2025 (r22912) +++ branches/OpenMPT-1.30/libopenmpt/dox/changelog.md Sat Feb 15 18:01:47 2025 (r22913) @@ -7,6 +7,8 @@ ### libopenmpt 0.6.23-pre + * pugixml: Update to v1.15 (2025-01-10). + ### libopenmpt 0.6.22 (2025-01-06) * [**Bug**] Work-around broken user locale support on Cygwin. |
From: <sv...@op...> - 2025-02-15 17:01:30
|
Author: manx Date: Sat Feb 15 18:01:18 2025 New Revision: 22912 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22912 Log: [Mod] libopenmpt: Bump patch version. Modified: branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Modified: branches/OpenMPT-1.31/doc/libopenmpt/changelog.md ============================================================================== --- branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Sat Feb 15 17:59:31 2025 (r22911) +++ branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Sat Feb 15 18:01:18 2025 (r22912) @@ -7,6 +7,8 @@ ### libopenmpt 0.7.14-pre + * pugixml: Update to v1.15 (2025-01-10). + ### libopenmpt 0.7.13 (2025-01-06) * [**Bug**] Work-around broken user locale support on Cygwin. |
From: <sv...@op...> - 2025-02-15 16:59:46
|
Author: manx Date: Sat Feb 15 17:59:31 2025 New Revision: 22911 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22911 Log: Merged revision(s) 22908 from trunk/OpenMPT: [Var] pugixml: Update to v1.15 (2025-01-10). ........ Modified: branches/OpenMPT-1.29/ (props changed) branches/OpenMPT-1.29/include/pugixml/LICENSE.md branches/OpenMPT-1.29/include/pugixml/OpenMPT.txt branches/OpenMPT-1.29/include/pugixml/readme.txt branches/OpenMPT-1.29/include/pugixml/src/pugiconfig.hpp branches/OpenMPT-1.29/include/pugixml/src/pugixml.cpp branches/OpenMPT-1.29/include/pugixml/src/pugixml.hpp Modified: branches/OpenMPT-1.29/include/pugixml/LICENSE.md ============================================================================== --- branches/OpenMPT-1.29/include/pugixml/LICENSE.md Sat Feb 15 17:59:08 2025 (r22910) +++ branches/OpenMPT-1.29/include/pugixml/LICENSE.md Sat Feb 15 17:59:31 2025 (r22911) @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2006-2023 Arseny Kapoulkine +Copyright (c) 2006-2025 Arseny Kapoulkine Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation Modified: branches/OpenMPT-1.29/include/pugixml/OpenMPT.txt ============================================================================== --- branches/OpenMPT-1.29/include/pugixml/OpenMPT.txt Sat Feb 15 17:59:08 2025 (r22910) +++ branches/OpenMPT-1.29/include/pugixml/OpenMPT.txt Sat Feb 15 17:59:31 2025 (r22911) @@ -1,2 +1,2 @@ -Directory contents based on pugixml 1.14. +pugixml v1.15 (2025-01-10). The docs and scripts folders have been omitted. Modified: branches/OpenMPT-1.29/include/pugixml/readme.txt ============================================================================== --- branches/OpenMPT-1.29/include/pugixml/readme.txt Sat Feb 15 17:59:08 2025 (r22910) +++ branches/OpenMPT-1.29/include/pugixml/readme.txt Sat Feb 15 17:59:31 2025 (r22911) @@ -1,6 +1,6 @@ -pugixml 1.14 - an XML processing library +pugixml 1.15 - an XML processing library -Copyright (C) 2006-2023, by Arseny Kapoulkine (ars...@gm...) +Copyright (C) 2006-2025, by Arseny Kapoulkine (ars...@gm...) Report bugs and download new versions at https://pugixml.org/ This is the distribution of pugixml, which is a C++ XML processing library, @@ -26,7 +26,7 @@ This library is distributed under the MIT License: -Copyright (c) 2006-2023 Arseny Kapoulkine +Copyright (c) 2006-2025 Arseny Kapoulkine Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation Modified: branches/OpenMPT-1.29/include/pugixml/src/pugiconfig.hpp ============================================================================== --- branches/OpenMPT-1.29/include/pugixml/src/pugiconfig.hpp Sat Feb 15 17:59:08 2025 (r22910) +++ branches/OpenMPT-1.29/include/pugixml/src/pugiconfig.hpp Sat Feb 15 17:59:31 2025 (r22911) @@ -1,7 +1,7 @@ /** - * pugixml parser - version 1.14 + * pugixml parser - version 1.15 * -------------------------------------------------------- - * Copyright (C) 2006-2023, by Arseny Kapoulkine (ars...@gm...) + * Copyright (C) 2006-2025, by Arseny Kapoulkine (ars...@gm...) * Report bugs and download new versions at https://pugixml.org/ * * This library is distributed under the MIT License. See notice at the end @@ -46,13 +46,16 @@ // Uncomment this to switch to header-only version // #define PUGIXML_HEADER_ONLY -// Uncomment this to enable long long support +// Uncomment this to enable long long support (usually enabled automatically) // #define PUGIXML_HAS_LONG_LONG +// Uncomment this to enable support for std::string_view (usually enabled automatically) +// #define PUGIXML_HAS_STRING_VIEW + #endif /** - * Copyright (c) 2006-2023 Arseny Kapoulkine + * Copyright (c) 2006-2025 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation Modified: branches/OpenMPT-1.29/include/pugixml/src/pugixml.cpp ============================================================================== --- branches/OpenMPT-1.29/include/pugixml/src/pugixml.cpp Sat Feb 15 17:59:08 2025 (r22910) +++ branches/OpenMPT-1.29/include/pugixml/src/pugixml.cpp Sat Feb 15 17:59:31 2025 (r22911) @@ -1,7 +1,7 @@ /** - * pugixml parser - version 1.14 + * pugixml parser - version 1.15 * -------------------------------------------------------- - * Copyright (C) 2006-2023, by Arseny Kapoulkine (ars...@gm...) + * Copyright (C) 2006-2025, by Arseny Kapoulkine (ars...@gm...) * Report bugs and download new versions at https://pugixml.org/ * * This library is distributed under the MIT License. See notice at the end @@ -53,6 +53,11 @@ # pragma warning(disable: 4996) // this function or variable may be unsafe #endif +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // NULL as null pointer constant +#endif + #if defined(_MSC_VER) && defined(__c2__) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wdeprecated" // this function or variable may be unsafe @@ -247,6 +252,24 @@ #endif } +#ifdef PUGIXML_HAS_STRING_VIEW + // Check if the null-terminated dst string is equal to the entire contents of srcview + PUGI_IMPL_FN bool stringview_equal(string_view_t srcview, const char_t* dst) + { + // std::basic_string_view::compare(const char*) has the right behavior, but it performs an + // extra traversal of dst to compute its length. + assert(dst); + const char_t* src = srcview.data(); + size_t srclen = srcview.size(); + + while (srclen && *dst && *src == *dst) + { + --srclen; ++dst; ++src; + } + return srclen == 0 && *dst == 0; + } +#endif + // Compare lhs with [rhs_begin, rhs_end) PUGI_IMPL_FN bool strequalrange(const char_t* lhs, const char_t* rhs, size_t count) { @@ -293,7 +316,7 @@ T* release() { T* result = data; - data = 0; + data = NULL; return result; } }; @@ -304,7 +327,7 @@ class compact_hash_table { public: - compact_hash_table(): _items(0), _capacity(0), _count(0) + compact_hash_table(): _items(NULL), _capacity(0), _count(0) { } @@ -313,7 +336,7 @@ if (_items) { xml_memory::deallocate(_items); - _items = 0; + _items = NULL; _capacity = 0; _count = 0; } @@ -321,11 +344,11 @@ void* find(const void* key) { - if (_capacity == 0) return 0; + if (_capacity == 0) return NULL; item_t* item = get_item(key); assert(item); - assert(item->key == key || (item->key == 0 && item->value == 0)); + assert(item->key == key || (item->key == NULL && item->value == NULL)); return item->value; } @@ -337,7 +360,7 @@ item_t* item = get_item(key); assert(item); - if (item->key == 0) + if (item->key == NULL) { _count++; item->key = key; @@ -380,7 +403,7 @@ { item_t& probe_item = _items[bucket]; - if (probe_item.key == key || probe_item.key == 0) + if (probe_item.key == key || probe_item.key == NULL) return &probe_item; // hash collision, quadratic probing @@ -388,7 +411,7 @@ } assert(false && "Hash table is full"); // unreachable - return 0; + return NULL; } static PUGI_IMPL_UNSIGNED_OVERFLOW unsigned int hash(const void* key) @@ -476,16 +499,16 @@ { xml_memory_page* result = static_cast<xml_memory_page*>(memory); - result->allocator = 0; - result->prev = 0; - result->next = 0; + result->allocator = NULL; + result->prev = NULL; + result->next = NULL; result->busy_size = 0; result->freed_size = 0; #ifdef PUGIXML_COMPACT - result->compact_string_base = 0; - result->compact_shared_parent = 0; - result->compact_page_marker = 0; + result->compact_string_base = NULL; + result->compact_shared_parent = NULL; + result->compact_page_marker = NULL; #endif return result; @@ -525,7 +548,7 @@ xml_allocator(xml_memory_page* root): _root(root), _busy_size(root->busy_size) { #ifdef PUGIXML_COMPACT - _hash = 0; + _hash = NULL; #endif } @@ -535,7 +558,7 @@ // allocate block with some alignment, leaving memory for worst-case padding void* memory = xml_memory::allocate(size); - if (!memory) return 0; + if (!memory) return NULL; // prepare page structure xml_memory_page* page = xml_memory_page::construct(memory); @@ -572,7 +595,7 @@ void* allocate_object(size_t size, xml_memory_page*& out_page) { void* result = allocate_memory(size + sizeof(uint32_t), out_page); - if (!result) return 0; + if (!result) return NULL; // adjust for marker ptrdiff_t offset = static_cast<char*>(result) - reinterpret_cast<char*>(out_page->compact_page_marker); @@ -618,7 +641,7 @@ if (page->freed_size == page->busy_size) { - if (page->next == 0) + if (page->next == NULL) { assert(_root == page); @@ -628,9 +651,9 @@ #ifdef PUGIXML_COMPACT // reset compact state to maximize efficiency - page->compact_string_base = 0; - page->compact_shared_parent = 0; - page->compact_page_marker = 0; + page->compact_string_base = NULL; + page->compact_shared_parent = NULL; + page->compact_page_marker = NULL; #endif _busy_size = 0; @@ -665,7 +688,7 @@ xml_memory_page* page; xml_memory_string_header* header = static_cast<xml_memory_string_header*>(allocate_memory(full_size, page)); - if (!header) return 0; + if (!header) return NULL; // setup header ptrdiff_t page_offset = reinterpret_cast<char*>(header) - reinterpret_cast<char*>(page) - sizeof(xml_memory_page); @@ -727,7 +750,7 @@ xml_memory_page* page = allocate_page(size <= large_allocation_threshold ? xml_memory_page_size : size); out_page = page; - if (!page) return 0; + if (!page) return NULL; if (size <= large_allocation_threshold) { @@ -874,7 +897,7 @@ return compact_get_value<header_offset, T>(this); } else - return 0; + return NULL; } T* operator->() const @@ -917,7 +940,7 @@ { xml_memory_page* page = compact_get_page(this, header_offset); - if (PUGI_IMPL_UNLIKELY(page->compact_shared_parent == 0)) + if (PUGI_IMPL_UNLIKELY(page->compact_shared_parent == NULL)) page->compact_shared_parent = value; if (page->compact_shared_parent == value) @@ -954,7 +977,7 @@ return compact_get_value<header_offset, T>(this); } else - return 0; + return NULL; } T* operator->() const @@ -984,7 +1007,7 @@ { xml_memory_page* page = compact_get_page(this, header_offset); - if (PUGI_IMPL_UNLIKELY(page->compact_string_base == 0)) + if (PUGI_IMPL_UNLIKELY(page->compact_string_base == NULL)) page->compact_string_base = value; ptrdiff_t offset = value - page->compact_string_base; @@ -1050,7 +1073,7 @@ } } else - return 0; + return NULL; } private: @@ -1109,7 +1132,7 @@ { struct xml_attribute_struct { - xml_attribute_struct(impl::xml_memory_page* page): name(0), value(0), prev_attribute_c(0), next_attribute(0) + xml_attribute_struct(impl::xml_memory_page* page): name(NULL), value(NULL), prev_attribute_c(NULL), next_attribute(NULL) { header = PUGI_IMPL_GETHEADER_IMPL(this, page, 0); } @@ -1125,7 +1148,7 @@ struct xml_node_struct { - xml_node_struct(impl::xml_memory_page* page, xml_node_type type): name(0), value(0), parent(0), first_child(0), prev_sibling_c(0), next_sibling(0), first_attribute(0) + xml_node_struct(impl::xml_memory_page* page, xml_node_type type): name(NULL), value(NULL), parent(NULL), first_child(NULL), prev_sibling_c(NULL), next_sibling(NULL), first_attribute(NULL) { header = PUGI_IMPL_GETHEADER_IMPL(this, page, type); } @@ -1156,7 +1179,7 @@ struct xml_document_struct: public xml_node_struct, public xml_allocator { - xml_document_struct(xml_memory_page* page): xml_node_struct(page, node_document), xml_allocator(page), buffer(0), extra_buffers(0) + xml_document_struct(xml_memory_page* page): xml_node_struct(page, node_document), xml_allocator(page), buffer(NULL), extra_buffers(NULL) { } @@ -1190,7 +1213,7 @@ { xml_memory_page* page; void* memory = alloc.allocate_object(sizeof(xml_attribute_struct), page); - if (!memory) return 0; + if (!memory) return NULL; return new (memory) xml_attribute_struct(page); } @@ -1199,7 +1222,7 @@ { xml_memory_page* page; void* memory = alloc.allocate_object(sizeof(xml_node_struct), page); - if (!memory) return 0; + if (!memory) return NULL; return new (memory) xml_node_struct(page, type); } @@ -1338,9 +1361,9 @@ else parent->first_child = next; - node->parent = 0; - node->prev_sibling_c = 0; - node->next_sibling = 0; + node->parent = NULL; + node->prev_sibling_c = NULL; + node->next_sibling = NULL; } inline void append_attribute(xml_attribute_struct* attr, xml_node_struct* node) @@ -1421,16 +1444,16 @@ else node->first_attribute = next; - attr->prev_attribute_c = 0; - attr->next_attribute = 0; + attr->prev_attribute_c = NULL; + attr->next_attribute = NULL; } PUGI_IMPL_FN_NO_INLINE xml_node_struct* append_new_node(xml_node_struct* node, xml_allocator& alloc, xml_node_type type = node_element) { - if (!alloc.reserve()) return 0; + if (!alloc.reserve()) return NULL; xml_node_struct* child = allocate_node(alloc, type); - if (!child) return 0; + if (!child) return NULL; append_node(child, node); @@ -1439,10 +1462,10 @@ PUGI_IMPL_FN_NO_INLINE xml_attribute_struct* append_new_attribute(xml_node_struct* node, xml_allocator& alloc) { - if (!alloc.reserve()) return 0; + if (!alloc.reserve()) return NULL; xml_attribute_struct* attr = allocate_attribute(alloc); - if (!attr) return 0; + if (!attr) return NULL; append_attribute(attr, node); @@ -1569,8 +1592,8 @@ static value_type high(value_type result, uint32_t ch) { - uint32_t msh = static_cast<uint32_t>(ch - 0x10000) >> 10; - uint32_t lsh = static_cast<uint32_t>(ch - 0x10000) & 0x3ff; + uint32_t msh = (ch - 0x10000U) >> 10; + uint32_t lsh = (ch - 0x10000U) & 0x3ff; result[0] = static_cast<uint16_t>(0xD800 + msh); result[1] = static_cast<uint16_t>(0xDC00 + lsh); @@ -2024,7 +2047,7 @@ if (d0 == 0x3c && d1 == 0) return encoding_utf16_le; // no known BOM detected; parse declaration - const uint8_t* enc = 0; + const uint8_t* enc = NULL; size_t enc_length = 0; if (d0 == 0x3c && d1 == 0x3f && d2 == 0x78 && d3 == 0x6d && parse_declaration_encoding(data, size, enc, enc_length)) @@ -2395,7 +2418,7 @@ if (header & header_mask) alloc->deallocate_string(dest); // mark the string as not allocated - dest = 0; + dest = NULL; header &= ~header_mask; return true; @@ -2438,7 +2461,7 @@ char_t* end; size_t size; - gap(): end(0), size(0) + gap(): end(NULL), size(0) { } @@ -2450,7 +2473,7 @@ { // Move [old_gap_end, new_gap_start) to [old_gap_start, ...) assert(s >= end); - memmove(end - size, end, reinterpret_cast<char*>(s) - reinterpret_cast<char*>(end)); + memmove(end - size, end, (s - end) * sizeof(char_t)); } s += count; // end of current gap @@ -2467,7 +2490,7 @@ { // Move [old_gap_end, current_pos) to [old_gap_start, ...) assert(s >= end); - memmove(end - size, end, reinterpret_cast<char*>(s) - reinterpret_cast<char*>(end)); + memmove(end - size, end, (s - end) * sizeof(char_t)); return s - size; } @@ -2625,7 +2648,7 @@ #define PUGI_IMPL_SCANWHILE(X) { while (X) ++s; } #define PUGI_IMPL_SCANWHILE_UNROLL(X) { for (;;) { char_t ss = s[0]; if (PUGI_IMPL_UNLIKELY(!(X))) { break; } ss = s[1]; if (PUGI_IMPL_UNLIKELY(!(X))) { s += 1; break; } ss = s[2]; if (PUGI_IMPL_UNLIKELY(!(X))) { s += 2; break; } ss = s[3]; if (PUGI_IMPL_UNLIKELY(!(X))) { s += 3; break; } s += 4; } } #define PUGI_IMPL_ENDSEG() { ch = *s; *s = 0; ++s; } - #define PUGI_IMPL_THROW_ERROR(err, m) return error_offset = m, error_status = err, static_cast<char_t*>(0) + #define PUGI_IMPL_THROW_ERROR(err, m) return error_offset = m, error_status = err, static_cast<char_t*>(NULL) #define PUGI_IMPL_CHECK_ERROR(err, m) { if (*s == 0) PUGI_IMPL_THROW_ERROR(err, m); } PUGI_IMPL_FN char_t* strconv_comment(char_t* s, char_t endch) @@ -2650,7 +2673,7 @@ } else if (*s == 0) { - return 0; + return NULL; } else ++s; } @@ -2678,7 +2701,7 @@ } else if (*s == 0) { - return 0; + return NULL; } else ++s; } @@ -2751,7 +2774,7 @@ case 5: return strconv_pcdata_impl<opt_true, opt_false, opt_true>::parse; case 6: return strconv_pcdata_impl<opt_true, opt_true, opt_false>::parse; case 7: return strconv_pcdata_impl<opt_true, opt_true, opt_true>::parse; - default: assert(false); return 0; // unreachable + default: assert(false); return NULL; // unreachable } } @@ -2805,7 +2828,7 @@ } else if (!*s) { - return 0; + return NULL; } else ++s; } @@ -2841,7 +2864,7 @@ } else if (!*s) { - return 0; + return NULL; } else ++s; } @@ -2873,7 +2896,7 @@ } else if (!*s) { - return 0; + return NULL; } else ++s; } @@ -2899,7 +2922,7 @@ } else if (!*s) { - return 0; + return NULL; } else ++s; } @@ -2928,7 +2951,7 @@ case 13: return strconv_attribute_impl<opt_true>::parse_wnorm; case 14: return strconv_attribute_impl<opt_false>::parse_wnorm; case 15: return strconv_attribute_impl<opt_true>::parse_wnorm; - default: assert(false); return 0; // unreachable + default: assert(false); return NULL; // unreachable } } @@ -2947,7 +2970,7 @@ char_t* error_offset; xml_parse_status error_status; - xml_parser(xml_allocator* alloc_): alloc(alloc_), error_offset(0), error_status(status_ok) + xml_parser(xml_allocator* alloc_): alloc(alloc_), error_offset(NULL), error_status(status_ok) { } @@ -3559,7 +3582,7 @@ return make_parse_result(PUGI_IMPL_OPTSET(parse_fragment) ? status_ok : status_no_document_element); // get last child of the root before parsing - xml_node_struct* last_root_child = root->first_child ? root->first_child->prev_sibling_c + 0 : 0; + xml_node_struct* last_root_child = root->first_child ? root->first_child->prev_sibling_c + 0 : NULL; // create parser on stack xml_parser parser(static_cast<xml_allocator*>(xmldoc)); @@ -4476,7 +4499,7 @@ PUGI_IMPL_FN void node_copy_tree(xml_node_struct* dn, xml_node_struct* sn) { xml_allocator& alloc = get_allocator(dn); - xml_allocator* shared_alloc = (&alloc == &get_allocator(sn)) ? &alloc : 0; + xml_allocator* shared_alloc = (&alloc == &get_allocator(sn)) ? &alloc : NULL; node_copy_contents(dn, sn, shared_alloc); @@ -4530,7 +4553,7 @@ PUGI_IMPL_FN void node_copy_attribute(xml_attribute_struct* da, xml_attribute_struct* sa) { xml_allocator& alloc = get_allocator(da); - xml_allocator* shared_alloc = (&alloc == &get_allocator(sa)) ? &alloc : 0; + xml_allocator* shared_alloc = (&alloc == &get_allocator(sa)) ? &alloc : NULL; node_copy_string(da->name, da->header, xml_memory_page_name_allocated_mask, sa->name, sa->header, shared_alloc); node_copy_string(da->value, da->header, xml_memory_page_value_allocated_mask, sa->value, sa->header, shared_alloc); @@ -4639,18 +4662,18 @@ PUGI_IMPL_FN double get_value_double(const char_t* value) { #ifdef PUGIXML_WCHAR_MODE - return wcstod(value, 0); + return wcstod(value, NULL); #else - return strtod(value, 0); + return strtod(value, NULL); #endif } PUGI_IMPL_FN float get_value_float(const char_t* value) { #ifdef PUGIXML_WCHAR_MODE - return static_cast<float>(wcstod(value, 0)); + return static_cast<float>(wcstod(value, NULL)); #else - return static_cast<float>(strtod(value, 0)); + return static_cast<float>(strtod(value, NULL)); #endif } @@ -4755,10 +4778,10 @@ xml_encoding buffer_encoding = impl::get_buffer_encoding(encoding, contents, size); // if convert_buffer below throws bad_alloc, we still need to deallocate contents if we own it - auto_deleter<void> contents_guard(own ? contents : 0, xml_memory::deallocate); + auto_deleter<void> contents_guard(own ? contents : NULL, xml_memory::deallocate); // get private buffer - char_t* buffer = 0; + char_t* buffer = NULL; size_t length = 0; // coverity[var_deref_model] @@ -4785,6 +4808,20 @@ return res; } + template <typename T> PUGI_IMPL_FN xml_parse_status convert_file_size(T length, size_t& out_result) + { + // check for I/O errors + if (length < 0) return status_io_error; + + // check for overflow + size_t result = static_cast<size_t>(length); + + if (static_cast<T>(result) != length) return status_out_of_memory; + + out_result = result; + return status_ok; + } + // we need to get length of entire file to load it in memory; the only (relatively) sane way to do it is via seek/tell trick PUGI_IMPL_FN xml_parse_status get_file_size(FILE* file, size_t& out_result) { @@ -4796,43 +4833,31 @@ // anything that's not a regular file doesn't have a coherent length if (!S_ISREG(st.st_mode)) return status_io_error; - typedef off_t length_type; - length_type length = st.st_size; + xml_parse_status status = convert_file_size(st.st_size, out_result); #elif defined(PUGI_IMPL_MSVC_CRT_VERSION) && PUGI_IMPL_MSVC_CRT_VERSION >= 1400 // there are 64-bit versions of fseek/ftell, let's use them - typedef __int64 length_type; - _fseeki64(file, 0, SEEK_END); - length_type length = _ftelli64(file); + __int64 length = _ftelli64(file); _fseeki64(file, 0, SEEK_SET); + + xml_parse_status status = convert_file_size(length, out_result); #elif defined(__MINGW32__) && !defined(__NO_MINGW_LFS) && (!defined(__STRICT_ANSI__) || defined(__MINGW64_VERSION_MAJOR)) // there are 64-bit versions of fseek/ftell, let's use them - typedef off64_t length_type; - fseeko64(file, 0, SEEK_END); - length_type length = ftello64(file); + off64_t length = ftello64(file); fseeko64(file, 0, SEEK_SET); + + xml_parse_status status = convert_file_size(length, out_result); #else // if this is a 32-bit OS, long is enough; if this is a unix system, long is 64-bit, which is enough; otherwise we can't do anything anyway. - typedef long length_type; - fseek(file, 0, SEEK_END); - length_type length = ftell(file); + long length = ftell(file); fseek(file, 0, SEEK_SET); - #endif - - // check for I/O errors - if (length < 0) return status_io_error; - - // check for overflow - size_t result = static_cast<size_t>(length); - if (static_cast<length_type>(result) != length) return status_out_of_memory; - - // finalize - out_result = result; + xml_parse_status status = convert_file_size(length, out_result); + #endif - return status_ok; + return status; } // This function assumes that buffer has extra sizeof(char_t) writable bytes after size @@ -4900,7 +4925,7 @@ static xml_stream_chunk* create() { void* memory = xml_memory::allocate(sizeof(xml_stream_chunk)); - if (!memory) return 0; + if (!memory) return NULL; return new (memory) xml_stream_chunk(); } @@ -4918,7 +4943,7 @@ } } - xml_stream_chunk(): next(0), size(0) + xml_stream_chunk(): next(NULL), size(0) { } @@ -4930,11 +4955,11 @@ template <typename T> PUGI_IMPL_FN xml_parse_status load_stream_data_noseek(std::basic_istream<T>& stream, void** out_buffer, size_t* out_size) { - auto_deleter<xml_stream_chunk<T> > chunks(0, xml_stream_chunk<T>::destroy); + auto_deleter<xml_stream_chunk<T> > chunks(NULL, xml_stream_chunk<T>::destroy); // read file to a chunk list size_t total = 0; - xml_stream_chunk<T>* last = 0; + xml_stream_chunk<T>* last = NULL; while (!stream.eof()) { @@ -5020,7 +5045,7 @@ template <typename T> PUGI_IMPL_FN xml_parse_result load_stream_impl(xml_document_struct* doc, std::basic_istream<T>& stream, unsigned int options, xml_encoding encoding, char_t** out_buffer) { - void* buffer = 0; + void* buffer = NULL; size_t size = 0; xml_parse_status status = status_ok; @@ -5047,9 +5072,17 @@ #if defined(PUGI_IMPL_MSVC_CRT_VERSION) || defined(__BORLANDC__) || (defined(__MINGW32__) && (!defined(__STRICT_ANSI__) || defined(__MINGW64_VERSION_MAJOR))) PUGI_IMPL_FN FILE* open_file_wide(const wchar_t* path, const wchar_t* mode) { +#ifdef PUGIXML_NO_STL + // ensure these symbols are consistently referenced to avoid 'unreferenced function' warnings + // note that generally these functions are used in STL builds, but PUGIXML_NO_STL leaves the only usage in convert_path_heap + (void)&as_utf8_begin; + (void)&as_utf8_end; + (void)&strlength_wide; +#endif + #if defined(PUGI_IMPL_MSVC_CRT_VERSION) && PUGI_IMPL_MSVC_CRT_VERSION >= 1400 - FILE* file = 0; - return _wfopen_s(&file, path, mode) == 0 ? file : 0; + FILE* file = NULL; + return _wfopen_s(&file, path, mode) == 0 ? file : NULL; #else return _wfopen(path, mode); #endif @@ -5065,7 +5098,7 @@ // allocate resulting string char* result = static_cast<char*>(xml_memory::allocate(size + 1)); - if (!result) return 0; + if (!result) return NULL; // second pass: convert to utf8 as_utf8_end(result, size, str, length); @@ -5080,7 +5113,7 @@ { // there is no standard function to open wide paths, so our best bet is to try utf8 path char* path_utf8 = convert_path_heap(path); - if (!path_utf8) return 0; + if (!path_utf8) return NULL; // convert mode to ASCII (we mirror _wfopen interface) char mode_ascii[4] = {0}; @@ -5099,8 +5132,8 @@ PUGI_IMPL_FN FILE* open_file(const char* path, const char* mode) { #if defined(PUGI_IMPL_MSVC_CRT_VERSION) && PUGI_IMPL_MSVC_CRT_VERSION >= 1400 - FILE* file = 0; - return fopen_s(&file, path, mode) == 0 ? file : 0; + FILE* file = NULL; + return fopen_s(&file, path, mode) == 0 ? file : NULL; #else return fopen(path, mode); #endif @@ -5123,7 +5156,7 @@ name_null_sentry(xml_node_struct* node_): node(node_), name(node_->name) { - node->name = 0; + node->name = NULL; } ~name_null_sentry() @@ -5150,11 +5183,11 @@ } #ifndef PUGIXML_NO_STL - PUGI_IMPL_FN xml_writer_stream::xml_writer_stream(std::basic_ostream<char, std::char_traits<char> >& stream): narrow_stream(&stream), wide_stream(0) + PUGI_IMPL_FN xml_writer_stream::xml_writer_stream(std::basic_ostream<char>& stream): narrow_stream(&stream), wide_stream(NULL) { } - PUGI_IMPL_FN xml_writer_stream::xml_writer_stream(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream): narrow_stream(0), wide_stream(&stream) + PUGI_IMPL_FN xml_writer_stream::xml_writer_stream(std::basic_ostream<wchar_t>& stream): narrow_stream(NULL), wide_stream(&stream) { } @@ -5198,7 +5231,7 @@ return true; } - PUGI_IMPL_FN xml_attribute::xml_attribute(): _attr(0) + PUGI_IMPL_FN xml_attribute::xml_attribute(): _attr(NULL) { } @@ -5212,7 +5245,7 @@ PUGI_IMPL_FN xml_attribute::operator xml_attribute::unspecified_bool_type() const { - return _attr ? unspecified_bool_xml_attribute : 0; + return _attr ? unspecified_bool_xml_attribute : NULL; } PUGI_IMPL_FN bool xml_attribute::operator!() const @@ -5342,7 +5375,7 @@ PUGI_IMPL_FN size_t xml_attribute::hash_value() const { - return static_cast<size_t>(reinterpret_cast<uintptr_t>(_attr) / sizeof(xml_attribute_struct)); + return reinterpret_cast<uintptr_t>(_attr) / sizeof(xml_attribute_struct); } PUGI_IMPL_FN xml_attribute_struct* xml_attribute::internal_object() const @@ -5398,6 +5431,14 @@ return *this; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_attribute& xml_attribute::operator=(string_view_t rhs) + { + set_value(rhs); + return *this; + } +#endif + #ifdef PUGIXML_HAS_LONG_LONG PUGI_IMPL_FN xml_attribute& xml_attribute::operator=(long long rhs) { @@ -5426,6 +5467,15 @@ return impl::strcpy_insitu(_attr->name, _attr->header, impl::xml_memory_page_name_allocated_mask, rhs, size); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_attribute::set_name(string_view_t rhs) + { + if (!_attr) return false; + + return impl::strcpy_insitu(_attr->name, _attr->header, impl::xml_memory_page_name_allocated_mask, rhs.data(), rhs.size()); + } +#endif + PUGI_IMPL_FN bool xml_attribute::set_value(const char_t* rhs) { if (!_attr) return false; @@ -5440,6 +5490,15 @@ return impl::strcpy_insitu(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs, size); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_attribute::set_value(string_view_t rhs) + { + if (!_attr) return false; + + return impl::strcpy_insitu(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs.data(), rhs.size()); + } +#endif + PUGI_IMPL_FN bool xml_attribute::set_value(int rhs) { if (!_attr) return false; @@ -5531,7 +5590,7 @@ } #endif - PUGI_IMPL_FN xml_node::xml_node(): _root(0) + PUGI_IMPL_FN xml_node::xml_node(): _root(NULL) { } @@ -5545,7 +5604,7 @@ PUGI_IMPL_FN xml_node::operator xml_node::unspecified_bool_type() const { - return _root ? unspecified_bool_xml_node : 0; + return _root ? unspecified_bool_xml_node : NULL; } PUGI_IMPL_FN bool xml_node::operator!() const @@ -5555,22 +5614,22 @@ PUGI_IMPL_FN xml_node::iterator xml_node::begin() const { - return iterator(_root ? _root->first_child + 0 : 0, _root); + return iterator(_root ? _root->first_child + 0 : NULL, _root); } PUGI_IMPL_FN xml_node::iterator xml_node::end() const { - return iterator(0, _root); + return iterator(NULL, _root); } PUGI_IMPL_FN xml_node::attribute_iterator xml_node::attributes_begin() const { - return attribute_iterator(_root ? _root->first_attribute + 0 : 0, _root); + return attribute_iterator(_root ? _root->first_attribute + 0 : NULL, _root); } PUGI_IMPL_FN xml_node::attribute_iterator xml_node::attributes_end() const { - return attribute_iterator(0, _root); + return attribute_iterator(NULL, _root); } PUGI_IMPL_FN xml_object_range<xml_node_iterator> xml_node::children() const @@ -5580,7 +5639,7 @@ PUGI_IMPL_FN xml_object_range<xml_named_node_iterator> xml_node::children(const char_t* name_) const { - return xml_object_range<xml_named_node_iterator>(xml_named_node_iterator(child(name_)._root, _root, name_), xml_named_node_iterator(0, _root, name_)); + return xml_object_range<xml_named_node_iterator>(xml_named_node_iterator(child(name_)._root, _root, name_), xml_named_node_iterator(NULL, _root, name_)); } PUGI_IMPL_FN xml_object_range<xml_attribute_iterator> xml_node::attributes() const @@ -5703,6 +5762,64 @@ return xml_node(); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_node xml_node::child(string_view_t name_) const + { + if (!_root) return xml_node(); + + for (xml_node_struct* i = _root->first_child; i; i = i->next_sibling) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + return xml_node(i); + } + + return xml_node(); + } + + PUGI_IMPL_FN xml_attribute xml_node::attribute(string_view_t name_) const + { + if (!_root) return xml_attribute(); + + for (xml_attribute_struct* i = _root->first_attribute; i; i = i->next_attribute) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + return xml_attribute(i); + } + + return xml_attribute(); + } + + PUGI_IMPL_FN xml_node xml_node::next_sibling(string_view_t name_) const + { + if (!_root) return xml_node(); + + for (xml_node_struct* i = _root->next_sibling; i; i = i->next_sibling) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + return xml_node(i); + } + + return xml_node(); + } + + PUGI_IMPL_FN xml_node xml_node::previous_sibling(string_view_t name_) const + { + if (!_root) return xml_node(); + + for (xml_node_struct* i = _root->prev_sibling_c; i->next_sibling; i = i->prev_sibling_c) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + return xml_node(i); + } + + return xml_node(); + } +#endif + PUGI_IMPL_FN xml_attribute xml_node::attribute(const char_t* name_, xml_attribute& hint_) const { xml_attribute_struct* hint = hint_._attr; @@ -5742,6 +5859,47 @@ return xml_attribute(); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_attribute xml_node::attribute(string_view_t name_, xml_attribute& hint_) const + { + xml_attribute_struct* hint = hint_._attr; + + // if hint is not an attribute of node, behavior is not defined + assert(!hint || (_root && impl::is_attribute_of(hint, _root))); + + if (!_root) return xml_attribute(); + + // optimistically search from hint up until the end + for (xml_attribute_struct* i = hint; i; i = i->next_attribute) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + { + // update hint to maximize efficiency of searching for consecutive attributes + hint_._attr = i->next_attribute; + + return xml_attribute(i); + } + } + + // wrap around and search from the first attribute until the hint + // 'j' null pointer check is technically redundant, but it prevents a crash in case the assertion above fails + for (xml_attribute_struct* j = _root->first_attribute; j && j != hint; j = j->next_attribute) + { + const char_t* jname = j->name; + if (jname && impl::stringview_equal(name_, jname)) + { + // update hint to maximize efficiency of searching for consecutive attributes + hint_._attr = j->next_attribute; + + return xml_attribute(j); + } + } + + return xml_attribute(); + } +#endif + PUGI_IMPL_FN xml_node xml_node::previous_sibling() const { if (!_root) return xml_node(); @@ -5833,6 +5991,18 @@ return impl::strcpy_insitu(_root->name, _root->header, impl::xml_memory_page_name_allocated_mask, rhs, size); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_node::set_name(string_view_t rhs) + { + xml_node_type type_ = _root ? PUGI_IMPL_NODETYPE(_root) : node_null; + + if (type_ != node_element && type_ != node_pi && type_ != node_declaration) + return false; + + return impl::strcpy_insitu(_root->name, _root->header, impl::xml_memory_page_name_allocated_mask, rhs.data(), rhs.size()); + } +#endif + PUGI_IMPL_FN bool xml_node::set_value(const char_t* rhs) { xml_node_type type_ = _root ? PUGI_IMPL_NODETYPE(_root) : node_null; @@ -5853,6 +6023,18 @@ return impl::strcpy_insitu(_root->value, _root->header, impl::xml_memory_page_value_allocated_mask, rhs, size); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_node::set_value(string_view_t rhs) + { + xml_node_type type_ = _root ? PUGI_IMPL_NODETYPE(_root) : node_null; + + if (type_ != node_pcdata && type_ != node_cdata && type_ != node_comment && type_ != node_pi && type_ != node_doctype) + return false; + + return impl::strcpy_insitu(_root->value, _root->header, impl::xml_memory_page_value_allocated_mask, rhs.data(), rhs.size()); + } +#endif + PUGI_IMPL_FN xml_attribute xml_node::append_attribute(const char_t* name_) { if (!impl::allow_insert_attribute(type())) return xml_attribute(); @@ -5923,6 +6105,78 @@ return a; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_attribute xml_node::append_attribute(string_view_t name_) + { + if (!impl::allow_insert_attribute(type())) return xml_attribute(); + + impl::xml_allocator& alloc = impl::get_allocator(_root); + if (!alloc.reserve()) return xml_attribute(); + + xml_attribute a(impl::allocate_attribute(alloc)); + if (!a) return xml_attribute(); + + impl::append_attribute(a._attr, _root); + + a.set_name(name_); + + return a; + } + + PUGI_IMPL_FN xml_attribute xml_node::prepend_attribute(string_view_t name_) + { + if (!impl::allow_insert_attribute(type())) return xml_attribute(); + + impl::xml_allocator& alloc = impl::get_allocator(_root); + if (!alloc.reserve()) return xml_attribute(); + + xml_attribute a(impl::allocate_attribute(alloc)); + if (!a) return xml_attribute(); + + impl::prepend_attribute(a._attr, _root); + + a.set_name(name_); + + return a; + } + + PUGI_IMPL_FN xml_attribute xml_node::insert_attribute_after(string_view_t name_, const xml_attribute& attr) + { + if (!impl::allow_insert_attribute(type())) return xml_attribute(); + if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute(); + + impl::xml_allocator& alloc = impl::get_allocator(_root); + if (!alloc.reserve()) return xml_attribute(); + + xml_attribute a(impl::allocate_attribute(alloc)); + if (!a) return xml_attribute(); + + impl::insert_attribute_after(a._attr, attr._attr, _root); + + a.set_name(name_); + + return a; + } + + PUGI_IMPL_FN xml_attribute xml_node::insert_attribute_before(string_view_t name_, const xml_attribute& attr) + { + if (!impl::allow_insert_attribute(type())) return xml_attribute(); + if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute(); + + impl::xml_allocator& alloc = impl::get_allocator(_root); + if (!alloc.reserve()) return xml_attribute(); + + xml_attribute a(impl::allocate_attribute(alloc)); + if (!a) return xml_attribute(); + + impl::insert_attribute_before(a._attr, attr._attr, _root); + + a.set_name(name_); + + return a; + } +#endif + PUGI_IMPL_FN xml_attribute xml_node::append_copy(const xml_attribute& proto) { if (!proto) return xml_attribute(); @@ -6099,6 +6353,44 @@ return result; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_node xml_node::append_child(string_view_t name_) + { + xml_node result = append_child(node_element); + + result.set_name(name_); + + return result; + } + + PUGI_IMPL_FN xml_node xml_node::prepend_child(string_view_t name_) + { + xml_node result = prepend_child(node_element); + + result.set_name(name_); + + return result; + } + + PUGI_IMPL_FN xml_node xml_node::insert_child_after(string_view_t name_, const xml_node& node) + { + xml_node result = insert_child_after(node_element, node); + + result.set_name(name_); + + return result; + } + + PUGI_IMPL_FN xml_node xml_node::insert_child_before(string_view_t name_, const xml_node& node) + { + xml_node result = insert_child_before(node_element, node); + + result.set_name(name_); + + return result; + } +#endif + PUGI_IMPL_FN xml_node xml_node::append_copy(const xml_node& proto) { xml_node_type type_ = proto.type(); @@ -6242,6 +6534,13 @@ return remove_attribute(attribute(name_)); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_node::remove_attribute(string_view_t name_) + { + return remove_attribute(attribute(name_)); + } +#endif + PUGI_IMPL_FN bool xml_node::remove_attribute(const xml_attribute& a) { if (!_root || !a._attr) return false; @@ -6272,7 +6571,7 @@ attr = next; } - _root->first_attribute = 0; + _root->first_attribute = NULL; return true; } @@ -6282,6 +6581,13 @@ return remove_child(child(name_)); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_node::remove_child(string_view_t name_) + { + return remove_child(child(name_)); + } +#endif + PUGI_IMPL_FN bool xml_node::remove_child(const xml_node& n) { if (!_root || !n._root || n._root->parent != _root) return false; @@ -6311,7 +6617,7 @@ cur = next; } - _root->first_child = 0; + _root->first_child = NULL; return true; } @@ -6331,7 +6637,7 @@ doc->header |= impl::xml_memory_page_contents_shared_mask; // get extra buffer element (we'll store the document fragment buffer there so that we can deallocate it later) - impl::xml_memory_page* page = 0; + impl::xml_memory_page* page = NULL; impl::xml_extra_buffer* extra = static_cast<impl::xml_extra_buffer*>(doc->allocate_memory(sizeof(impl::xml_extra_buffer) + sizeof(void*), page)); (void)page; @@ -6344,7 +6650,7 @@ #endif // add extra buffer to the list - extra->buffer = 0; + extra->buffer = NULL; extra->next = doc->extra_buffers; doc->extra_buffers = extra; @@ -6484,7 +6790,7 @@ xml_node arg_begin(_root); if (!walker.begin(arg_begin)) return false; - xml_node_struct* cur = _root ? _root->first_child + 0 : 0; + xml_node_struct* cur = _root ? _root->first_child + 0 : NULL; if (cur) { @@ -6526,7 +6832,7 @@ PUGI_IMPL_FN size_t xml_node::hash_value() const { - return static_cast<size_t>(reinterpret_cast<uintptr_t>(_root) / sizeof(xml_node_struct)); + return reinterpret_cast<uintptr_t>(_root) / sizeof(xml_node_struct); } PUGI_IMPL_FN xml_node_struct* xml_node::internal_object() const @@ -6546,14 +6852,14 @@ } #ifndef PUGIXML_NO_STL - PUGI_IMPL_FN void xml_node::print(std::basic_ostream<char, std::char_traits<char> >& stream, const char_t* indent, unsigned int flags, xml_encoding encoding, unsigned int depth) const + PUGI_IMPL_FN void xml_node::print(std::basic_ostream<char>& stream, const char_t* indent, unsigned int flags, xml_encoding encoding, unsigned int depth) const { xml_writer_stream writer(stream); print(writer, indent, flags, encoding, depth); } - PUGI_IMPL_FN void xml_node::print(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream, const char_t* indent, unsigned int flags, unsigned int depth) const + PUGI_IMPL_FN void xml_node::print(std::basic_ostream<wchar_t>& stream, const char_t* indent, unsigned int flags, unsigned int depth) const { xml_writer_stream writer(stream); @@ -6620,7 +6926,7 @@ if (impl::is_text_node(node)) return node; - return 0; + return NULL; } PUGI_IMPL_FN xml_node_struct* xml_text::_data_new() @@ -6631,7 +6937,7 @@ return xml_node(_root).append_child(node_pcdata).internal_object(); } - PUGI_IMPL_FN xml_text::xml_text(): _root(0) + PUGI_IMPL_FN xml_text::xml_text(): _root(NULL) { } @@ -6641,7 +6947,7 @@ PUGI_IMPL_FN xml_text::operator xml_text::unspecified_bool_type() const { - return _data() ? unspecified_bool_xml_text : 0; + return _data() ? unspecified_bool_xml_text : NULL; } PUGI_IMPL_FN bool xml_text::operator!() const @@ -6651,7 +6957,7 @@ PUGI_IMPL_FN bool xml_text::empty() const { - return _data() == 0; + return _data() == NULL; } PUGI_IMPL_FN const char_t* xml_text::get() const @@ -6742,6 +7048,15 @@ return dn ? impl::strcpy_insitu(dn->value, dn->header, impl::xml_memory_page_value_allocated_mask, rhs, size) : false; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_text::set(string_view_t rhs) + { + xml_node_struct* dn = _data_new(); + + return dn ? impl::strcpy_insitu(dn->value, dn->header, impl::xml_memory_page_value_allocated_mask, rhs.data(), rhs.size()) : false; + } +#endif + PUGI_IMPL_FN bool xml_text::set(int rhs) { xml_node_struct* dn = _data_new(); @@ -6869,6 +7184,14 @@ return *this; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_text& xml_text::operator=(string_view_t rhs) + { + set(rhs); + return *this; + } +#endif + #ifdef PUGIXML_HAS_LONG_LONG PUGI_IMPL_FN xml_text& xml_text::operator=(long long rhs) { @@ -6931,7 +7254,7 @@ PUGI_IMPL_FN xml_node* xml_node_iterator::operator->() const { assert(_wrap._root); - return const_cast<xml_node*>(&_wrap); // BCC5 workaround + return &_wrap; } PUGI_IMPL_FN xml_node_iterator& xml_node_iterator::operator++() @@ -6992,7 +7315,7 @@ PUGI_IMPL_FN xml_attribute* xml_attribute_iterator::operator->() const { assert(_wrap._attr); - return const_cast<xml_attribute*>(&_wrap); // BCC5 workaround + return &_wrap; } PUGI_IMPL_FN xml_attribute_iterator& xml_attribute_iterator::operator++() @@ -7022,7 +7345,7 @@ return temp; } - PUGI_IMPL_FN xml_named_node_iterator::xml_named_node_iterator(): _name(0) + PUGI_IMPL_FN xml_named_node_iterator::xml_named_node_iterator(): _name(NULL) { } @@ -7053,7 +7376,7 @@ PUGI_IMPL_FN xml_node* xml_named_node_iterator::operator->() const { assert(_wrap._root); - return const_cast<xml_node*>(&_wrap); // BCC5 workaround + return &_wrap; } PUGI_IMPL_FN xml_named_node_iterator& xml_named_node_iterator::operator++() @@ -7132,7 +7455,7 @@ } } - PUGI_IMPL_FN xml_document::xml_document(): _buffer(0) + PUGI_IMPL_FN xml_document::xml_document(): _buffer(NULL) { _create(); } @@ -7143,7 +7466,7 @@ } #ifdef PUGIXML_HAS_MOVE - PUGI_IMPL_FN xml_document::xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT: _buffer(0) + PUGI_IMPL_FN xml_document::xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT: _buffer(NULL) { _create(); _move(rhs); @@ -7225,7 +7548,7 @@ if (_buffer) { impl::xml_memory::deallocate(_buffer); - _buffer = 0; + _buffer = NULL; } // destroy extra buffers (note: no need to destroy linked list nodes, they're allocated using document allocator) @@ -7253,7 +7576,7 @@ static_cast<impl::xml_document_struct*>(_root)->hash.clear(); #endif - _root = 0; + _root = NULL; } #ifdef PUGIXML_HAS_MOVE @@ -7308,7 +7631,7 @@ doc->_hash = &doc->hash; // make sure we don't access other hash up until the end when we reinitialize other document - other->_hash = 0; + other->_hash = NULL; #endif // move page structure @@ -7326,7 +7649,7 @@ page->prev = doc_page; doc_page->next = page; - other_page->next = 0; + other_page->next = NULL; } // make sure pages point to the correct document state @@ -7363,19 +7686,19 @@ // reset other document new (other) impl::xml_document_struct(PUGI_IMPL_GETPAGE(other)); - rhs._buffer = 0; + rhs._buffer = NULL; } #endif #ifndef PUGIXML_NO_STL - PUGI_IMPL_FN xml_parse_result xml_document::load(std::basic_istream<char, std::char_traits<char> >& stream, unsigned int options, xml_encoding encoding) + PUGI_IMPL_FN xml_parse_result xml_document::load(std::basic_istream<char>& stream, unsigned int options, xml_encoding encoding) { reset(); return impl::load_stream_impl(static_cast<impl::xml_document_struct*>(_root), stream, options, encoding, &_buffer); } - PUGI_IMPL_FN xml_parse_result xml_document::load(std::basic_istream<wchar_t, std::char_traits<wchar_t> >& stream, unsigned int options) + PUGI_IMPL_FN xml_parse_result xml_document::load(std::basic_istream<wchar_t>& stream, unsigned int options) { reset(); @@ -7445,7 +7768,7 @@ { impl::xml_buffered_writer buffered_writer(writer, encoding); - if ((flags & format_write_bom) && encoding != encoding_latin1) + if ((flags & format_write_bom) && buffered_writer.encoding != encoding_latin1) { // BOM always represents the codepoint U+FEFF, so just write it in native encoding #ifdef PUGIXML_WCHAR_MODE @@ -7459,7 +7782,7 @@ if (!(flags & format_no_declaration) && !impl::has_declaration(_root)) { buffered_writer.write_string(PUGIXML_TEXT("<?xml version=\"1.0\"")); - if (encoding == encoding_latin1) buffered_writer.write_string(PUGIXML_TEXT(" encoding=\"ISO-8859-1\"")); + if (buffered_writer.encoding == encoding_latin1) buffered_writer.write_string(PUGIXML_TEXT(" encoding=\"ISO-8859-1\"")); buffered_writer.write('?', '>'); if (!(flags & format_raw)) buffered_writer.write('\n'); } @@ -7470,14 +7793,14 @@ } #ifndef PUGIXML_NO_STL - PUGI_IMPL_FN void xml_document::save(std::basic_ostream<char, std::char_traits<char> >& stream, const char_t* indent, unsigned int flags, xml_encoding encoding) const + PUGI_IMPL_FN void xml_document::save(std::basic_ostream<char>& stream, const char_t* indent, unsigned int flags, xml_encoding encoding) const { xml_writer_stream writer(stream); save(writer, indent, flags, encoding); } - PUGI_IMPL_FN void xml_document::save(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream, const char_t* indent, unsigned int flags) const + PUGI_IMPL_FN void xml_document::save(std::basic_ostream<wchar_t>& stream, const char_t* indent, unsigned int flags) const { xml_writer_stream writer(stream); @@ -7790,7 +8113,7 @@ for (size_t probe = 0; probe <= hashmod; ++probe) { - if (table[bucket] == 0) + if (table[bucket] == NULL) { table[bucket] = key; return true; @@ -7838,7 +8161,7 @@ size_t _root_size; bool* _error; - xpath_allocator(xpath_memory_block* root, bool* error = 0): _root(root), _root_size(0), _error(error) + xpath_allocator(xpath_memory_block* root, bool* error = NULL): _root(root), _root_size(0), _error(error) { } @@ -7866,7 +8189,7 @@ if (!block) { if (_error) *_error = true; - return 0; + return NULL; } block->next = _root; @@ -7886,7 +8209,7 @@ new_size = (new_size + xpath_memory_block_alignment - 1) & ~(xpath_memory_block_alignment - 1); // we can only reallocate the last object - assert(ptr == 0 || static_cast<char*>(ptr) + old_size == &_root->data[0] + _root_size); + assert(ptr == NULL || static_cast<char*>(ptr) + old_size == &_root->data[0] + _root_size); // try to reallocate the object inplace if (ptr && _root_size - old_size + new_size <= _root->capacity) @@ -7897,7 +8220,7 @@ // allocate a new block void* result = allocate(new_size); - if (!result) return 0; + if (!result) return NULL; // we have a new block if (ptr) @@ -7992,7 +8315,7 @@ xpath_stack_data(): result(blocks + 0, &oom), temp(blocks + 1, &oom), oom(false) { - blocks[0].next = blocks[1].next = 0; + blocks[0].next = blocks[1].next = NULL; blocks[0].capacity = blocks[1].capacity = sizeof(blocks[0].data); stack.result = &result; @@ -8018,7 +8341,7 @@ static char_t* duplicate_string(const char_t* string, size_t length, xpath_allocator* alloc) { char_t* result = static_cast<char_t*>(alloc->allocate((length + 1) * sizeof(char_t))); - if (!result) return 0; + if (!result) return NULL; memcpy(result, string, length * sizeof(char_t)); result[length] = 0; @@ -8078,7 +8401,7 @@ size_t result_length = target_length + source_length; // allocate new buffer - char_t* result = static_cast<char_t*>(alloc->reallocate(_uses_heap ? const_cast<char_t*>(_buffer) : 0, (target_length + 1) * sizeof(char_t), (result_length + 1) * sizeof(char_t))); + char_t* result = static_cast<char_t*>(alloc->reallocate(_uses_heap ? const_cast<char_t*>(_buffer) : NULL, (target_length + 1) * sizeof(char_t), (result_length + 1) * sizeof(char_t))); if (!result) return; // append first string to the new buffer in case there was no reallocation @@ -8113,7 +8436,7 @@ size_t length_ = strlength(_buffer); const char_t* data_ = duplicate_string(_buffer, length_, alloc); - if (!data_) return 0; + if (!data_) return NULL; _buffer = data_; _uses_heap = true; @@ -8322,7 +8645,7 @@ if (node->value && (node->header & impl::xml_memory_page_value_allocated_or_shared_mask) == 0) return node->value; } - return 0; + return NULL; } xml_attribute_struct* attr = xnode.attribute().internal_object(); @@ -8335,10 +8658,10 @@ if ((attr->header & impl::xml_memory_page_value_allocated_or_shared_mask) == 0) return attr->value; } - return 0; + return NULL; } - return 0; + return NULL; } struct document_order_comparator @@ -8451,7 +8774,7 @@ if (v == 0) return PUGIXML_TEXT("0"); if (v != v) return PUGIXML_TEXT("NaN"); if (v * 2 == v) return value > 0 ? PUGIXML_TEXT("Infinity") : PUGIXML_TEXT("-Infinity"); - return 0; + return NULL; #endif } @@ -8616,9 +8939,9 @@ // parse string #ifdef PUGIXML_WCHAR_MODE - return wcstod(string, 0); + return wcstod(string, NULL); #else - return strtod(string, 0); + return strtod(string, NULL); #endif } @@ -8680,7 +9003,7 @@ { const char_t* pos = find_char(name, ':'); - prefix = pos ? name : 0; + prefix = pos ? name : NULL; prefix_length = pos ? static_cast<size_t>(pos - name) : 0; } @@ -8798,7 +9121,7 @@ unsigned int tc = static_cast<unsigned int>(*to); if (fc >= 128 || tc >= 128) - return 0; + return NULL; // code=128 means "skip character" if (!table[fc]) @@ -8813,7 +9136,7 @@ table[i] = static_cast<unsigned char>(i); void* result = alloc->allocate(sizeof(table)); - if (!result) return 0; + if (!result) return NULL; memcpy(result, table, sizeof(table)); @@ -8877,7 +9200,7 @@ struct xpath_variable_string: xpath_variable { - xpath_variable_string(): xpath_variable(xpath_type_string), value(0) + xpath_variable_string(): xpath_variable(xpath_type_string), value(NULL) { } @@ -8924,11 +9247,11 @@ template <typename T> PUGI_IMPL_FN T* new_xpath_variable(const char_t* name) { size_t length = strlength(name); - if (length == 0) return 0; // empty variable names are invalid + if (length == 0) return NULL; // empty variable names are invalid // $$ we can't use offsetof(T, name) because T is non-POD, so we just allocate additional length characters void* memory = xml_memory::allocate(sizeof(T) + length * sizeof(char_t)); - if (!memory) return 0; + if (!memory) return NULL; T* result = new (memory) T(); @@ -8954,7 +9277,7 @@ return new_xpath_variable<xpath_variable_boolean>(name); default: - return 0; + return NULL; } } @@ -9107,7 +9430,7 @@ xpath_node* _eos; public: - xpath_node_set_raw(): _type(xpath_node_set::type_unsorted), _begin(0), _end(0), _eos(0) + xpath_node_set_raw(): _type(xpath_node_set::type_unsorted), _begin(NULL), _end(NULL), _eos(NULL) { } @@ -9299,7 +9622,7 @@ const char_t* begin; const char_t* end; - xpath_lexer_string(): begin(0), end(0) + xpath_lexer_string(): begin(NULL), end(NULL) { } @@ -10487,40 +10810,40 @@ public: xpath_ast_node(ast_type_t type, xpath_value_type rettype_, const char_t* value): - _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(0), _right(0), _next(0) + _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(NULL), _right(NULL), _next(NULL) { assert(type == ast_string_constant); _data.string = value; } xpath_ast_node(ast_type_t type, xpath_value_type rettype_, double value): - _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(0), _right(0), _next(0) + _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(NULL), _right(NULL), _next(NULL) { assert(type == ast_number_constant); _data.number = value; } xpath_ast_node(ast_type_t type, xpath_value_type rettype_, xpath_variable* value): - _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(0), _right(0), _next(0) + _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(NULL), _right(NULL), _next(NULL) { assert(type == ast_variable); _data.variable = value; } - xpath_ast_node(ast_type_t type, xpath_value_type rettype_, xpath_ast_node* left = 0, xpath_ast_node* right = 0): - _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(left), _right(right), _next(0) + xpath_ast_node(ast_type_t type, xpath_value_type rettype_, xpath_ast_node* left = NULL, xpath_ast_node* right = NULL): + _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(left), _right(right), _next(NULL) { } xpath_ast_node(ast_type_t type, xpath_ast_node* left, axis_t axis, nodetest_t test, const char_t* contents): - _type(static_cast<char>(type)), _rettype(xpath_type_node_set), _axis(static_cast<char>(axis)), _test(static_cast<char>(test)), _left(left), _right(0), _next(0) + _type(static_cast<char>(type)), _rettype(xpath_type_node_set), _axis(static_cast<char>(axis)), _test(static_cast<char>(test)), _left(left), _right(NULL), _next(NULL) { assert(type == ast_step); _data.nodetest = contents; } xpath_ast_node(ast_type_t type, xpath_ast_node* left, xpath_ast_node* right, predicate_t test): - _type(static_cast<char>(type)), _rettype(xpath_type_node_set), _axis(0), _test(static_cast<char>(test)), _left(left), _right(right), _next(0) + _type(static_cast<char>(type)), _rettype(xpath_type_node_set), _axis(0), _test(static_cast<char>(test)), _left(left), _right(right), _next(NULL) { assert(type == ast_filter || type == ast_predicate); } @@ -10580,7 +10903,7 @@ xpath_string lr = _left->eval_string(c, stack); xpath_string rr = _right->eval_string(c, stack); - return find_substring(lr.c_str(), rr.c_str()) != 0; + return find_substring(lr.c_str(), rr.c_str()) != NULL; } case ast_func_boolean: @@ -11389,7 +11712,7 @@ _result->error = message; _result->offset = _lexer.current_pos() - _query; - return 0; + return NULL; } xpath_ast_node* error_oom() @@ -11397,7 +11720,7 @@ assert(_alloc->_error); *_alloc->_error = true; - return 0; + return NULL; } xpath_ast_node* error_rec() @@ -11413,37 +11736,37 @@ xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, const char_t* value) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, rettype, value) : 0; + return memory ? new (memory) xpath_ast_node(type, rettype, value) : NULL; } xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, double value) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, rettype, value) : 0; + return memory ? new (memory) xpath_ast_node(type, rettype, value) : NULL; } xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, xpath_variable* value) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, rettype, value) : 0; + return memory ? new (memory) xpath_ast_node(type, rettype, value) : NULL; } - xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, xpath_ast_node* left = 0, xpath_ast_node* right = 0) + xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, xpath_ast_node* left = NULL, xpath_ast_node* right = NULL) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, rettype, left, right) : 0; + return memory ? new (memory) xpath_ast_node(type, rettype, left, right) : NULL; } xpath_ast_node* alloc_node(ast_type_t type, xpath_ast_node* left, axis_t axis, nodetest_t test, const char_t* contents) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, left, axis, test, contents) : 0; + return memory ? new (memory) xpath_ast_node(type, left, axis, test, contents) : NULL; } xpath_ast_node* alloc_node(ast_type_t type, xpath_ast_node* left, xpath_ast_node* right, predicate_t test) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, left, right, test) : 0; + return memory ? new (memory) xpath_ast_node(type, left, right, test) : NULL; } const char_t* alloc_string(const xpath_lexer_string& value) @@ -11454,7 +11777,7 @@ size_t length = static_cast<size_t>(value.end - value.begin); char_t* c = static_cast<char_t*>(_alloc->allocate((length + 1) * sizeof(char_t))); - if (!c) return 0; + if (!c) return NULL; memcpy(c, value.begin, length * sizeof(char_t)); c[length] = 0; @@ -11697,7 +12020,7 @@ if (!_variables) return error("Unknown variable: variable set is not provided"); - xpath_variable* var = 0; + xpath_variable* var = NULL; if (!get_variable_scratch(_scratch, _variables, name.begin, name.end, &var)) return error_oom(); @@ -11714,7 +12037,7 @@ _lexer.next(); xpath_ast_node* n = parse_expression(); - if (!n) return 0; + if (!n) return NULL; if (_lexer.current() != lex_close_brace) return error("Expected ')' to match an opening '('"); @@ -11727,7 +12050,7 @@ case lex_quoted_string: { const char_t* value = alloc_string(_lexer.contents()); - if (!value) return 0; + if (!value) return NULL; _lexer.next(); @@ -11748,13 +12071,13 @@ case lex_string: { - xpath_ast_node* args[2] = {0}; + xpath_ast_node* args[2] = {NULL}; ... [truncated message content] |
From: <sv...@op...> - 2025-02-15 16:59:18
|
Author: manx Date: Sat Feb 15 17:59:08 2025 New Revision: 22910 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22910 Log: Merged revision(s) 22908 from trunk/OpenMPT: [Var] pugixml: Update to v1.15 (2025-01-10). ........ Modified: branches/OpenMPT-1.30/ (props changed) branches/OpenMPT-1.30/include/pugixml/LICENSE.md branches/OpenMPT-1.30/include/pugixml/OpenMPT.txt branches/OpenMPT-1.30/include/pugixml/readme.txt branches/OpenMPT-1.30/include/pugixml/src/pugiconfig.hpp branches/OpenMPT-1.30/include/pugixml/src/pugixml.cpp branches/OpenMPT-1.30/include/pugixml/src/pugixml.hpp Modified: branches/OpenMPT-1.30/include/pugixml/LICENSE.md ============================================================================== --- branches/OpenMPT-1.30/include/pugixml/LICENSE.md Sat Feb 15 17:58:46 2025 (r22909) +++ branches/OpenMPT-1.30/include/pugixml/LICENSE.md Sat Feb 15 17:59:08 2025 (r22910) @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2006-2023 Arseny Kapoulkine +Copyright (c) 2006-2025 Arseny Kapoulkine Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation Modified: branches/OpenMPT-1.30/include/pugixml/OpenMPT.txt ============================================================================== --- branches/OpenMPT-1.30/include/pugixml/OpenMPT.txt Sat Feb 15 17:58:46 2025 (r22909) +++ branches/OpenMPT-1.30/include/pugixml/OpenMPT.txt Sat Feb 15 17:59:08 2025 (r22910) @@ -1,2 +1,2 @@ -Directory contents based on pugixml 1.14. +pugixml v1.15 (2025-01-10). The docs and scripts folders have been omitted. Modified: branches/OpenMPT-1.30/include/pugixml/readme.txt ============================================================================== --- branches/OpenMPT-1.30/include/pugixml/readme.txt Sat Feb 15 17:58:46 2025 (r22909) +++ branches/OpenMPT-1.30/include/pugixml/readme.txt Sat Feb 15 17:59:08 2025 (r22910) @@ -1,6 +1,6 @@ -pugixml 1.14 - an XML processing library +pugixml 1.15 - an XML processing library -Copyright (C) 2006-2023, by Arseny Kapoulkine (ars...@gm...) +Copyright (C) 2006-2025, by Arseny Kapoulkine (ars...@gm...) Report bugs and download new versions at https://pugixml.org/ This is the distribution of pugixml, which is a C++ XML processing library, @@ -26,7 +26,7 @@ This library is distributed under the MIT License: -Copyright (c) 2006-2023 Arseny Kapoulkine +Copyright (c) 2006-2025 Arseny Kapoulkine Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation Modified: branches/OpenMPT-1.30/include/pugixml/src/pugiconfig.hpp ============================================================================== --- branches/OpenMPT-1.30/include/pugixml/src/pugiconfig.hpp Sat Feb 15 17:58:46 2025 (r22909) +++ branches/OpenMPT-1.30/include/pugixml/src/pugiconfig.hpp Sat Feb 15 17:59:08 2025 (r22910) @@ -1,7 +1,7 @@ /** - * pugixml parser - version 1.14 + * pugixml parser - version 1.15 * -------------------------------------------------------- - * Copyright (C) 2006-2023, by Arseny Kapoulkine (ars...@gm...) + * Copyright (C) 2006-2025, by Arseny Kapoulkine (ars...@gm...) * Report bugs and download new versions at https://pugixml.org/ * * This library is distributed under the MIT License. See notice at the end @@ -46,13 +46,16 @@ // Uncomment this to switch to header-only version // #define PUGIXML_HEADER_ONLY -// Uncomment this to enable long long support +// Uncomment this to enable long long support (usually enabled automatically) // #define PUGIXML_HAS_LONG_LONG +// Uncomment this to enable support for std::string_view (usually enabled automatically) +// #define PUGIXML_HAS_STRING_VIEW + #endif /** - * Copyright (c) 2006-2023 Arseny Kapoulkine + * Copyright (c) 2006-2025 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation Modified: branches/OpenMPT-1.30/include/pugixml/src/pugixml.cpp ============================================================================== --- branches/OpenMPT-1.30/include/pugixml/src/pugixml.cpp Sat Feb 15 17:58:46 2025 (r22909) +++ branches/OpenMPT-1.30/include/pugixml/src/pugixml.cpp Sat Feb 15 17:59:08 2025 (r22910) @@ -1,7 +1,7 @@ /** - * pugixml parser - version 1.14 + * pugixml parser - version 1.15 * -------------------------------------------------------- - * Copyright (C) 2006-2023, by Arseny Kapoulkine (ars...@gm...) + * Copyright (C) 2006-2025, by Arseny Kapoulkine (ars...@gm...) * Report bugs and download new versions at https://pugixml.org/ * * This library is distributed under the MIT License. See notice at the end @@ -53,6 +53,11 @@ # pragma warning(disable: 4996) // this function or variable may be unsafe #endif +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // NULL as null pointer constant +#endif + #if defined(_MSC_VER) && defined(__c2__) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wdeprecated" // this function or variable may be unsafe @@ -247,6 +252,24 @@ #endif } +#ifdef PUGIXML_HAS_STRING_VIEW + // Check if the null-terminated dst string is equal to the entire contents of srcview + PUGI_IMPL_FN bool stringview_equal(string_view_t srcview, const char_t* dst) + { + // std::basic_string_view::compare(const char*) has the right behavior, but it performs an + // extra traversal of dst to compute its length. + assert(dst); + const char_t* src = srcview.data(); + size_t srclen = srcview.size(); + + while (srclen && *dst && *src == *dst) + { + --srclen; ++dst; ++src; + } + return srclen == 0 && *dst == 0; + } +#endif + // Compare lhs with [rhs_begin, rhs_end) PUGI_IMPL_FN bool strequalrange(const char_t* lhs, const char_t* rhs, size_t count) { @@ -293,7 +316,7 @@ T* release() { T* result = data; - data = 0; + data = NULL; return result; } }; @@ -304,7 +327,7 @@ class compact_hash_table { public: - compact_hash_table(): _items(0), _capacity(0), _count(0) + compact_hash_table(): _items(NULL), _capacity(0), _count(0) { } @@ -313,7 +336,7 @@ if (_items) { xml_memory::deallocate(_items); - _items = 0; + _items = NULL; _capacity = 0; _count = 0; } @@ -321,11 +344,11 @@ void* find(const void* key) { - if (_capacity == 0) return 0; + if (_capacity == 0) return NULL; item_t* item = get_item(key); assert(item); - assert(item->key == key || (item->key == 0 && item->value == 0)); + assert(item->key == key || (item->key == NULL && item->value == NULL)); return item->value; } @@ -337,7 +360,7 @@ item_t* item = get_item(key); assert(item); - if (item->key == 0) + if (item->key == NULL) { _count++; item->key = key; @@ -380,7 +403,7 @@ { item_t& probe_item = _items[bucket]; - if (probe_item.key == key || probe_item.key == 0) + if (probe_item.key == key || probe_item.key == NULL) return &probe_item; // hash collision, quadratic probing @@ -388,7 +411,7 @@ } assert(false && "Hash table is full"); // unreachable - return 0; + return NULL; } static PUGI_IMPL_UNSIGNED_OVERFLOW unsigned int hash(const void* key) @@ -476,16 +499,16 @@ { xml_memory_page* result = static_cast<xml_memory_page*>(memory); - result->allocator = 0; - result->prev = 0; - result->next = 0; + result->allocator = NULL; + result->prev = NULL; + result->next = NULL; result->busy_size = 0; result->freed_size = 0; #ifdef PUGIXML_COMPACT - result->compact_string_base = 0; - result->compact_shared_parent = 0; - result->compact_page_marker = 0; + result->compact_string_base = NULL; + result->compact_shared_parent = NULL; + result->compact_page_marker = NULL; #endif return result; @@ -525,7 +548,7 @@ xml_allocator(xml_memory_page* root): _root(root), _busy_size(root->busy_size) { #ifdef PUGIXML_COMPACT - _hash = 0; + _hash = NULL; #endif } @@ -535,7 +558,7 @@ // allocate block with some alignment, leaving memory for worst-case padding void* memory = xml_memory::allocate(size); - if (!memory) return 0; + if (!memory) return NULL; // prepare page structure xml_memory_page* page = xml_memory_page::construct(memory); @@ -572,7 +595,7 @@ void* allocate_object(size_t size, xml_memory_page*& out_page) { void* result = allocate_memory(size + sizeof(uint32_t), out_page); - if (!result) return 0; + if (!result) return NULL; // adjust for marker ptrdiff_t offset = static_cast<char*>(result) - reinterpret_cast<char*>(out_page->compact_page_marker); @@ -618,7 +641,7 @@ if (page->freed_size == page->busy_size) { - if (page->next == 0) + if (page->next == NULL) { assert(_root == page); @@ -628,9 +651,9 @@ #ifdef PUGIXML_COMPACT // reset compact state to maximize efficiency - page->compact_string_base = 0; - page->compact_shared_parent = 0; - page->compact_page_marker = 0; + page->compact_string_base = NULL; + page->compact_shared_parent = NULL; + page->compact_page_marker = NULL; #endif _busy_size = 0; @@ -665,7 +688,7 @@ xml_memory_page* page; xml_memory_string_header* header = static_cast<xml_memory_string_header*>(allocate_memory(full_size, page)); - if (!header) return 0; + if (!header) return NULL; // setup header ptrdiff_t page_offset = reinterpret_cast<char*>(header) - reinterpret_cast<char*>(page) - sizeof(xml_memory_page); @@ -727,7 +750,7 @@ xml_memory_page* page = allocate_page(size <= large_allocation_threshold ? xml_memory_page_size : size); out_page = page; - if (!page) return 0; + if (!page) return NULL; if (size <= large_allocation_threshold) { @@ -874,7 +897,7 @@ return compact_get_value<header_offset, T>(this); } else - return 0; + return NULL; } T* operator->() const @@ -917,7 +940,7 @@ { xml_memory_page* page = compact_get_page(this, header_offset); - if (PUGI_IMPL_UNLIKELY(page->compact_shared_parent == 0)) + if (PUGI_IMPL_UNLIKELY(page->compact_shared_parent == NULL)) page->compact_shared_parent = value; if (page->compact_shared_parent == value) @@ -954,7 +977,7 @@ return compact_get_value<header_offset, T>(this); } else - return 0; + return NULL; } T* operator->() const @@ -984,7 +1007,7 @@ { xml_memory_page* page = compact_get_page(this, header_offset); - if (PUGI_IMPL_UNLIKELY(page->compact_string_base == 0)) + if (PUGI_IMPL_UNLIKELY(page->compact_string_base == NULL)) page->compact_string_base = value; ptrdiff_t offset = value - page->compact_string_base; @@ -1050,7 +1073,7 @@ } } else - return 0; + return NULL; } private: @@ -1109,7 +1132,7 @@ { struct xml_attribute_struct { - xml_attribute_struct(impl::xml_memory_page* page): name(0), value(0), prev_attribute_c(0), next_attribute(0) + xml_attribute_struct(impl::xml_memory_page* page): name(NULL), value(NULL), prev_attribute_c(NULL), next_attribute(NULL) { header = PUGI_IMPL_GETHEADER_IMPL(this, page, 0); } @@ -1125,7 +1148,7 @@ struct xml_node_struct { - xml_node_struct(impl::xml_memory_page* page, xml_node_type type): name(0), value(0), parent(0), first_child(0), prev_sibling_c(0), next_sibling(0), first_attribute(0) + xml_node_struct(impl::xml_memory_page* page, xml_node_type type): name(NULL), value(NULL), parent(NULL), first_child(NULL), prev_sibling_c(NULL), next_sibling(NULL), first_attribute(NULL) { header = PUGI_IMPL_GETHEADER_IMPL(this, page, type); } @@ -1156,7 +1179,7 @@ struct xml_document_struct: public xml_node_struct, public xml_allocator { - xml_document_struct(xml_memory_page* page): xml_node_struct(page, node_document), xml_allocator(page), buffer(0), extra_buffers(0) + xml_document_struct(xml_memory_page* page): xml_node_struct(page, node_document), xml_allocator(page), buffer(NULL), extra_buffers(NULL) { } @@ -1190,7 +1213,7 @@ { xml_memory_page* page; void* memory = alloc.allocate_object(sizeof(xml_attribute_struct), page); - if (!memory) return 0; + if (!memory) return NULL; return new (memory) xml_attribute_struct(page); } @@ -1199,7 +1222,7 @@ { xml_memory_page* page; void* memory = alloc.allocate_object(sizeof(xml_node_struct), page); - if (!memory) return 0; + if (!memory) return NULL; return new (memory) xml_node_struct(page, type); } @@ -1338,9 +1361,9 @@ else parent->first_child = next; - node->parent = 0; - node->prev_sibling_c = 0; - node->next_sibling = 0; + node->parent = NULL; + node->prev_sibling_c = NULL; + node->next_sibling = NULL; } inline void append_attribute(xml_attribute_struct* attr, xml_node_struct* node) @@ -1421,16 +1444,16 @@ else node->first_attribute = next; - attr->prev_attribute_c = 0; - attr->next_attribute = 0; + attr->prev_attribute_c = NULL; + attr->next_attribute = NULL; } PUGI_IMPL_FN_NO_INLINE xml_node_struct* append_new_node(xml_node_struct* node, xml_allocator& alloc, xml_node_type type = node_element) { - if (!alloc.reserve()) return 0; + if (!alloc.reserve()) return NULL; xml_node_struct* child = allocate_node(alloc, type); - if (!child) return 0; + if (!child) return NULL; append_node(child, node); @@ -1439,10 +1462,10 @@ PUGI_IMPL_FN_NO_INLINE xml_attribute_struct* append_new_attribute(xml_node_struct* node, xml_allocator& alloc) { - if (!alloc.reserve()) return 0; + if (!alloc.reserve()) return NULL; xml_attribute_struct* attr = allocate_attribute(alloc); - if (!attr) return 0; + if (!attr) return NULL; append_attribute(attr, node); @@ -1569,8 +1592,8 @@ static value_type high(value_type result, uint32_t ch) { - uint32_t msh = static_cast<uint32_t>(ch - 0x10000) >> 10; - uint32_t lsh = static_cast<uint32_t>(ch - 0x10000) & 0x3ff; + uint32_t msh = (ch - 0x10000U) >> 10; + uint32_t lsh = (ch - 0x10000U) & 0x3ff; result[0] = static_cast<uint16_t>(0xD800 + msh); result[1] = static_cast<uint16_t>(0xDC00 + lsh); @@ -2024,7 +2047,7 @@ if (d0 == 0x3c && d1 == 0) return encoding_utf16_le; // no known BOM detected; parse declaration - const uint8_t* enc = 0; + const uint8_t* enc = NULL; size_t enc_length = 0; if (d0 == 0x3c && d1 == 0x3f && d2 == 0x78 && d3 == 0x6d && parse_declaration_encoding(data, size, enc, enc_length)) @@ -2395,7 +2418,7 @@ if (header & header_mask) alloc->deallocate_string(dest); // mark the string as not allocated - dest = 0; + dest = NULL; header &= ~header_mask; return true; @@ -2438,7 +2461,7 @@ char_t* end; size_t size; - gap(): end(0), size(0) + gap(): end(NULL), size(0) { } @@ -2450,7 +2473,7 @@ { // Move [old_gap_end, new_gap_start) to [old_gap_start, ...) assert(s >= end); - memmove(end - size, end, reinterpret_cast<char*>(s) - reinterpret_cast<char*>(end)); + memmove(end - size, end, (s - end) * sizeof(char_t)); } s += count; // end of current gap @@ -2467,7 +2490,7 @@ { // Move [old_gap_end, current_pos) to [old_gap_start, ...) assert(s >= end); - memmove(end - size, end, reinterpret_cast<char*>(s) - reinterpret_cast<char*>(end)); + memmove(end - size, end, (s - end) * sizeof(char_t)); return s - size; } @@ -2625,7 +2648,7 @@ #define PUGI_IMPL_SCANWHILE(X) { while (X) ++s; } #define PUGI_IMPL_SCANWHILE_UNROLL(X) { for (;;) { char_t ss = s[0]; if (PUGI_IMPL_UNLIKELY(!(X))) { break; } ss = s[1]; if (PUGI_IMPL_UNLIKELY(!(X))) { s += 1; break; } ss = s[2]; if (PUGI_IMPL_UNLIKELY(!(X))) { s += 2; break; } ss = s[3]; if (PUGI_IMPL_UNLIKELY(!(X))) { s += 3; break; } s += 4; } } #define PUGI_IMPL_ENDSEG() { ch = *s; *s = 0; ++s; } - #define PUGI_IMPL_THROW_ERROR(err, m) return error_offset = m, error_status = err, static_cast<char_t*>(0) + #define PUGI_IMPL_THROW_ERROR(err, m) return error_offset = m, error_status = err, static_cast<char_t*>(NULL) #define PUGI_IMPL_CHECK_ERROR(err, m) { if (*s == 0) PUGI_IMPL_THROW_ERROR(err, m); } PUGI_IMPL_FN char_t* strconv_comment(char_t* s, char_t endch) @@ -2650,7 +2673,7 @@ } else if (*s == 0) { - return 0; + return NULL; } else ++s; } @@ -2678,7 +2701,7 @@ } else if (*s == 0) { - return 0; + return NULL; } else ++s; } @@ -2751,7 +2774,7 @@ case 5: return strconv_pcdata_impl<opt_true, opt_false, opt_true>::parse; case 6: return strconv_pcdata_impl<opt_true, opt_true, opt_false>::parse; case 7: return strconv_pcdata_impl<opt_true, opt_true, opt_true>::parse; - default: assert(false); return 0; // unreachable + default: assert(false); return NULL; // unreachable } } @@ -2805,7 +2828,7 @@ } else if (!*s) { - return 0; + return NULL; } else ++s; } @@ -2841,7 +2864,7 @@ } else if (!*s) { - return 0; + return NULL; } else ++s; } @@ -2873,7 +2896,7 @@ } else if (!*s) { - return 0; + return NULL; } else ++s; } @@ -2899,7 +2922,7 @@ } else if (!*s) { - return 0; + return NULL; } else ++s; } @@ -2928,7 +2951,7 @@ case 13: return strconv_attribute_impl<opt_true>::parse_wnorm; case 14: return strconv_attribute_impl<opt_false>::parse_wnorm; case 15: return strconv_attribute_impl<opt_true>::parse_wnorm; - default: assert(false); return 0; // unreachable + default: assert(false); return NULL; // unreachable } } @@ -2947,7 +2970,7 @@ char_t* error_offset; xml_parse_status error_status; - xml_parser(xml_allocator* alloc_): alloc(alloc_), error_offset(0), error_status(status_ok) + xml_parser(xml_allocator* alloc_): alloc(alloc_), error_offset(NULL), error_status(status_ok) { } @@ -3559,7 +3582,7 @@ return make_parse_result(PUGI_IMPL_OPTSET(parse_fragment) ? status_ok : status_no_document_element); // get last child of the root before parsing - xml_node_struct* last_root_child = root->first_child ? root->first_child->prev_sibling_c + 0 : 0; + xml_node_struct* last_root_child = root->first_child ? root->first_child->prev_sibling_c + 0 : NULL; // create parser on stack xml_parser parser(static_cast<xml_allocator*>(xmldoc)); @@ -4476,7 +4499,7 @@ PUGI_IMPL_FN void node_copy_tree(xml_node_struct* dn, xml_node_struct* sn) { xml_allocator& alloc = get_allocator(dn); - xml_allocator* shared_alloc = (&alloc == &get_allocator(sn)) ? &alloc : 0; + xml_allocator* shared_alloc = (&alloc == &get_allocator(sn)) ? &alloc : NULL; node_copy_contents(dn, sn, shared_alloc); @@ -4530,7 +4553,7 @@ PUGI_IMPL_FN void node_copy_attribute(xml_attribute_struct* da, xml_attribute_struct* sa) { xml_allocator& alloc = get_allocator(da); - xml_allocator* shared_alloc = (&alloc == &get_allocator(sa)) ? &alloc : 0; + xml_allocator* shared_alloc = (&alloc == &get_allocator(sa)) ? &alloc : NULL; node_copy_string(da->name, da->header, xml_memory_page_name_allocated_mask, sa->name, sa->header, shared_alloc); node_copy_string(da->value, da->header, xml_memory_page_value_allocated_mask, sa->value, sa->header, shared_alloc); @@ -4639,18 +4662,18 @@ PUGI_IMPL_FN double get_value_double(const char_t* value) { #ifdef PUGIXML_WCHAR_MODE - return wcstod(value, 0); + return wcstod(value, NULL); #else - return strtod(value, 0); + return strtod(value, NULL); #endif } PUGI_IMPL_FN float get_value_float(const char_t* value) { #ifdef PUGIXML_WCHAR_MODE - return static_cast<float>(wcstod(value, 0)); + return static_cast<float>(wcstod(value, NULL)); #else - return static_cast<float>(strtod(value, 0)); + return static_cast<float>(strtod(value, NULL)); #endif } @@ -4755,10 +4778,10 @@ xml_encoding buffer_encoding = impl::get_buffer_encoding(encoding, contents, size); // if convert_buffer below throws bad_alloc, we still need to deallocate contents if we own it - auto_deleter<void> contents_guard(own ? contents : 0, xml_memory::deallocate); + auto_deleter<void> contents_guard(own ? contents : NULL, xml_memory::deallocate); // get private buffer - char_t* buffer = 0; + char_t* buffer = NULL; size_t length = 0; // coverity[var_deref_model] @@ -4785,6 +4808,20 @@ return res; } + template <typename T> PUGI_IMPL_FN xml_parse_status convert_file_size(T length, size_t& out_result) + { + // check for I/O errors + if (length < 0) return status_io_error; + + // check for overflow + size_t result = static_cast<size_t>(length); + + if (static_cast<T>(result) != length) return status_out_of_memory; + + out_result = result; + return status_ok; + } + // we need to get length of entire file to load it in memory; the only (relatively) sane way to do it is via seek/tell trick PUGI_IMPL_FN xml_parse_status get_file_size(FILE* file, size_t& out_result) { @@ -4796,43 +4833,31 @@ // anything that's not a regular file doesn't have a coherent length if (!S_ISREG(st.st_mode)) return status_io_error; - typedef off_t length_type; - length_type length = st.st_size; + xml_parse_status status = convert_file_size(st.st_size, out_result); #elif defined(PUGI_IMPL_MSVC_CRT_VERSION) && PUGI_IMPL_MSVC_CRT_VERSION >= 1400 // there are 64-bit versions of fseek/ftell, let's use them - typedef __int64 length_type; - _fseeki64(file, 0, SEEK_END); - length_type length = _ftelli64(file); + __int64 length = _ftelli64(file); _fseeki64(file, 0, SEEK_SET); + + xml_parse_status status = convert_file_size(length, out_result); #elif defined(__MINGW32__) && !defined(__NO_MINGW_LFS) && (!defined(__STRICT_ANSI__) || defined(__MINGW64_VERSION_MAJOR)) // there are 64-bit versions of fseek/ftell, let's use them - typedef off64_t length_type; - fseeko64(file, 0, SEEK_END); - length_type length = ftello64(file); + off64_t length = ftello64(file); fseeko64(file, 0, SEEK_SET); + + xml_parse_status status = convert_file_size(length, out_result); #else // if this is a 32-bit OS, long is enough; if this is a unix system, long is 64-bit, which is enough; otherwise we can't do anything anyway. - typedef long length_type; - fseek(file, 0, SEEK_END); - length_type length = ftell(file); + long length = ftell(file); fseek(file, 0, SEEK_SET); - #endif - - // check for I/O errors - if (length < 0) return status_io_error; - - // check for overflow - size_t result = static_cast<size_t>(length); - if (static_cast<length_type>(result) != length) return status_out_of_memory; - - // finalize - out_result = result; + xml_parse_status status = convert_file_size(length, out_result); + #endif - return status_ok; + return status; } // This function assumes that buffer has extra sizeof(char_t) writable bytes after size @@ -4900,7 +4925,7 @@ static xml_stream_chunk* create() { void* memory = xml_memory::allocate(sizeof(xml_stream_chunk)); - if (!memory) return 0; + if (!memory) return NULL; return new (memory) xml_stream_chunk(); } @@ -4918,7 +4943,7 @@ } } - xml_stream_chunk(): next(0), size(0) + xml_stream_chunk(): next(NULL), size(0) { } @@ -4930,11 +4955,11 @@ template <typename T> PUGI_IMPL_FN xml_parse_status load_stream_data_noseek(std::basic_istream<T>& stream, void** out_buffer, size_t* out_size) { - auto_deleter<xml_stream_chunk<T> > chunks(0, xml_stream_chunk<T>::destroy); + auto_deleter<xml_stream_chunk<T> > chunks(NULL, xml_stream_chunk<T>::destroy); // read file to a chunk list size_t total = 0; - xml_stream_chunk<T>* last = 0; + xml_stream_chunk<T>* last = NULL; while (!stream.eof()) { @@ -5020,7 +5045,7 @@ template <typename T> PUGI_IMPL_FN xml_parse_result load_stream_impl(xml_document_struct* doc, std::basic_istream<T>& stream, unsigned int options, xml_encoding encoding, char_t** out_buffer) { - void* buffer = 0; + void* buffer = NULL; size_t size = 0; xml_parse_status status = status_ok; @@ -5047,9 +5072,17 @@ #if defined(PUGI_IMPL_MSVC_CRT_VERSION) || defined(__BORLANDC__) || (defined(__MINGW32__) && (!defined(__STRICT_ANSI__) || defined(__MINGW64_VERSION_MAJOR))) PUGI_IMPL_FN FILE* open_file_wide(const wchar_t* path, const wchar_t* mode) { +#ifdef PUGIXML_NO_STL + // ensure these symbols are consistently referenced to avoid 'unreferenced function' warnings + // note that generally these functions are used in STL builds, but PUGIXML_NO_STL leaves the only usage in convert_path_heap + (void)&as_utf8_begin; + (void)&as_utf8_end; + (void)&strlength_wide; +#endif + #if defined(PUGI_IMPL_MSVC_CRT_VERSION) && PUGI_IMPL_MSVC_CRT_VERSION >= 1400 - FILE* file = 0; - return _wfopen_s(&file, path, mode) == 0 ? file : 0; + FILE* file = NULL; + return _wfopen_s(&file, path, mode) == 0 ? file : NULL; #else return _wfopen(path, mode); #endif @@ -5065,7 +5098,7 @@ // allocate resulting string char* result = static_cast<char*>(xml_memory::allocate(size + 1)); - if (!result) return 0; + if (!result) return NULL; // second pass: convert to utf8 as_utf8_end(result, size, str, length); @@ -5080,7 +5113,7 @@ { // there is no standard function to open wide paths, so our best bet is to try utf8 path char* path_utf8 = convert_path_heap(path); - if (!path_utf8) return 0; + if (!path_utf8) return NULL; // convert mode to ASCII (we mirror _wfopen interface) char mode_ascii[4] = {0}; @@ -5099,8 +5132,8 @@ PUGI_IMPL_FN FILE* open_file(const char* path, const char* mode) { #if defined(PUGI_IMPL_MSVC_CRT_VERSION) && PUGI_IMPL_MSVC_CRT_VERSION >= 1400 - FILE* file = 0; - return fopen_s(&file, path, mode) == 0 ? file : 0; + FILE* file = NULL; + return fopen_s(&file, path, mode) == 0 ? file : NULL; #else return fopen(path, mode); #endif @@ -5123,7 +5156,7 @@ name_null_sentry(xml_node_struct* node_): node(node_), name(node_->name) { - node->name = 0; + node->name = NULL; } ~name_null_sentry() @@ -5150,11 +5183,11 @@ } #ifndef PUGIXML_NO_STL - PUGI_IMPL_FN xml_writer_stream::xml_writer_stream(std::basic_ostream<char, std::char_traits<char> >& stream): narrow_stream(&stream), wide_stream(0) + PUGI_IMPL_FN xml_writer_stream::xml_writer_stream(std::basic_ostream<char>& stream): narrow_stream(&stream), wide_stream(NULL) { } - PUGI_IMPL_FN xml_writer_stream::xml_writer_stream(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream): narrow_stream(0), wide_stream(&stream) + PUGI_IMPL_FN xml_writer_stream::xml_writer_stream(std::basic_ostream<wchar_t>& stream): narrow_stream(NULL), wide_stream(&stream) { } @@ -5198,7 +5231,7 @@ return true; } - PUGI_IMPL_FN xml_attribute::xml_attribute(): _attr(0) + PUGI_IMPL_FN xml_attribute::xml_attribute(): _attr(NULL) { } @@ -5212,7 +5245,7 @@ PUGI_IMPL_FN xml_attribute::operator xml_attribute::unspecified_bool_type() const { - return _attr ? unspecified_bool_xml_attribute : 0; + return _attr ? unspecified_bool_xml_attribute : NULL; } PUGI_IMPL_FN bool xml_attribute::operator!() const @@ -5342,7 +5375,7 @@ PUGI_IMPL_FN size_t xml_attribute::hash_value() const { - return static_cast<size_t>(reinterpret_cast<uintptr_t>(_attr) / sizeof(xml_attribute_struct)); + return reinterpret_cast<uintptr_t>(_attr) / sizeof(xml_attribute_struct); } PUGI_IMPL_FN xml_attribute_struct* xml_attribute::internal_object() const @@ -5398,6 +5431,14 @@ return *this; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_attribute& xml_attribute::operator=(string_view_t rhs) + { + set_value(rhs); + return *this; + } +#endif + #ifdef PUGIXML_HAS_LONG_LONG PUGI_IMPL_FN xml_attribute& xml_attribute::operator=(long long rhs) { @@ -5426,6 +5467,15 @@ return impl::strcpy_insitu(_attr->name, _attr->header, impl::xml_memory_page_name_allocated_mask, rhs, size); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_attribute::set_name(string_view_t rhs) + { + if (!_attr) return false; + + return impl::strcpy_insitu(_attr->name, _attr->header, impl::xml_memory_page_name_allocated_mask, rhs.data(), rhs.size()); + } +#endif + PUGI_IMPL_FN bool xml_attribute::set_value(const char_t* rhs) { if (!_attr) return false; @@ -5440,6 +5490,15 @@ return impl::strcpy_insitu(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs, size); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_attribute::set_value(string_view_t rhs) + { + if (!_attr) return false; + + return impl::strcpy_insitu(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs.data(), rhs.size()); + } +#endif + PUGI_IMPL_FN bool xml_attribute::set_value(int rhs) { if (!_attr) return false; @@ -5531,7 +5590,7 @@ } #endif - PUGI_IMPL_FN xml_node::xml_node(): _root(0) + PUGI_IMPL_FN xml_node::xml_node(): _root(NULL) { } @@ -5545,7 +5604,7 @@ PUGI_IMPL_FN xml_node::operator xml_node::unspecified_bool_type() const { - return _root ? unspecified_bool_xml_node : 0; + return _root ? unspecified_bool_xml_node : NULL; } PUGI_IMPL_FN bool xml_node::operator!() const @@ -5555,22 +5614,22 @@ PUGI_IMPL_FN xml_node::iterator xml_node::begin() const { - return iterator(_root ? _root->first_child + 0 : 0, _root); + return iterator(_root ? _root->first_child + 0 : NULL, _root); } PUGI_IMPL_FN xml_node::iterator xml_node::end() const { - return iterator(0, _root); + return iterator(NULL, _root); } PUGI_IMPL_FN xml_node::attribute_iterator xml_node::attributes_begin() const { - return attribute_iterator(_root ? _root->first_attribute + 0 : 0, _root); + return attribute_iterator(_root ? _root->first_attribute + 0 : NULL, _root); } PUGI_IMPL_FN xml_node::attribute_iterator xml_node::attributes_end() const { - return attribute_iterator(0, _root); + return attribute_iterator(NULL, _root); } PUGI_IMPL_FN xml_object_range<xml_node_iterator> xml_node::children() const @@ -5580,7 +5639,7 @@ PUGI_IMPL_FN xml_object_range<xml_named_node_iterator> xml_node::children(const char_t* name_) const { - return xml_object_range<xml_named_node_iterator>(xml_named_node_iterator(child(name_)._root, _root, name_), xml_named_node_iterator(0, _root, name_)); + return xml_object_range<xml_named_node_iterator>(xml_named_node_iterator(child(name_)._root, _root, name_), xml_named_node_iterator(NULL, _root, name_)); } PUGI_IMPL_FN xml_object_range<xml_attribute_iterator> xml_node::attributes() const @@ -5703,6 +5762,64 @@ return xml_node(); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_node xml_node::child(string_view_t name_) const + { + if (!_root) return xml_node(); + + for (xml_node_struct* i = _root->first_child; i; i = i->next_sibling) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + return xml_node(i); + } + + return xml_node(); + } + + PUGI_IMPL_FN xml_attribute xml_node::attribute(string_view_t name_) const + { + if (!_root) return xml_attribute(); + + for (xml_attribute_struct* i = _root->first_attribute; i; i = i->next_attribute) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + return xml_attribute(i); + } + + return xml_attribute(); + } + + PUGI_IMPL_FN xml_node xml_node::next_sibling(string_view_t name_) const + { + if (!_root) return xml_node(); + + for (xml_node_struct* i = _root->next_sibling; i; i = i->next_sibling) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + return xml_node(i); + } + + return xml_node(); + } + + PUGI_IMPL_FN xml_node xml_node::previous_sibling(string_view_t name_) const + { + if (!_root) return xml_node(); + + for (xml_node_struct* i = _root->prev_sibling_c; i->next_sibling; i = i->prev_sibling_c) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + return xml_node(i); + } + + return xml_node(); + } +#endif + PUGI_IMPL_FN xml_attribute xml_node::attribute(const char_t* name_, xml_attribute& hint_) const { xml_attribute_struct* hint = hint_._attr; @@ -5742,6 +5859,47 @@ return xml_attribute(); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_attribute xml_node::attribute(string_view_t name_, xml_attribute& hint_) const + { + xml_attribute_struct* hint = hint_._attr; + + // if hint is not an attribute of node, behavior is not defined + assert(!hint || (_root && impl::is_attribute_of(hint, _root))); + + if (!_root) return xml_attribute(); + + // optimistically search from hint up until the end + for (xml_attribute_struct* i = hint; i; i = i->next_attribute) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + { + // update hint to maximize efficiency of searching for consecutive attributes + hint_._attr = i->next_attribute; + + return xml_attribute(i); + } + } + + // wrap around and search from the first attribute until the hint + // 'j' null pointer check is technically redundant, but it prevents a crash in case the assertion above fails + for (xml_attribute_struct* j = _root->first_attribute; j && j != hint; j = j->next_attribute) + { + const char_t* jname = j->name; + if (jname && impl::stringview_equal(name_, jname)) + { + // update hint to maximize efficiency of searching for consecutive attributes + hint_._attr = j->next_attribute; + + return xml_attribute(j); + } + } + + return xml_attribute(); + } +#endif + PUGI_IMPL_FN xml_node xml_node::previous_sibling() const { if (!_root) return xml_node(); @@ -5833,6 +5991,18 @@ return impl::strcpy_insitu(_root->name, _root->header, impl::xml_memory_page_name_allocated_mask, rhs, size); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_node::set_name(string_view_t rhs) + { + xml_node_type type_ = _root ? PUGI_IMPL_NODETYPE(_root) : node_null; + + if (type_ != node_element && type_ != node_pi && type_ != node_declaration) + return false; + + return impl::strcpy_insitu(_root->name, _root->header, impl::xml_memory_page_name_allocated_mask, rhs.data(), rhs.size()); + } +#endif + PUGI_IMPL_FN bool xml_node::set_value(const char_t* rhs) { xml_node_type type_ = _root ? PUGI_IMPL_NODETYPE(_root) : node_null; @@ -5853,6 +6023,18 @@ return impl::strcpy_insitu(_root->value, _root->header, impl::xml_memory_page_value_allocated_mask, rhs, size); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_node::set_value(string_view_t rhs) + { + xml_node_type type_ = _root ? PUGI_IMPL_NODETYPE(_root) : node_null; + + if (type_ != node_pcdata && type_ != node_cdata && type_ != node_comment && type_ != node_pi && type_ != node_doctype) + return false; + + return impl::strcpy_insitu(_root->value, _root->header, impl::xml_memory_page_value_allocated_mask, rhs.data(), rhs.size()); + } +#endif + PUGI_IMPL_FN xml_attribute xml_node::append_attribute(const char_t* name_) { if (!impl::allow_insert_attribute(type())) return xml_attribute(); @@ -5923,6 +6105,78 @@ return a; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_attribute xml_node::append_attribute(string_view_t name_) + { + if (!impl::allow_insert_attribute(type())) return xml_attribute(); + + impl::xml_allocator& alloc = impl::get_allocator(_root); + if (!alloc.reserve()) return xml_attribute(); + + xml_attribute a(impl::allocate_attribute(alloc)); + if (!a) return xml_attribute(); + + impl::append_attribute(a._attr, _root); + + a.set_name(name_); + + return a; + } + + PUGI_IMPL_FN xml_attribute xml_node::prepend_attribute(string_view_t name_) + { + if (!impl::allow_insert_attribute(type())) return xml_attribute(); + + impl::xml_allocator& alloc = impl::get_allocator(_root); + if (!alloc.reserve()) return xml_attribute(); + + xml_attribute a(impl::allocate_attribute(alloc)); + if (!a) return xml_attribute(); + + impl::prepend_attribute(a._attr, _root); + + a.set_name(name_); + + return a; + } + + PUGI_IMPL_FN xml_attribute xml_node::insert_attribute_after(string_view_t name_, const xml_attribute& attr) + { + if (!impl::allow_insert_attribute(type())) return xml_attribute(); + if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute(); + + impl::xml_allocator& alloc = impl::get_allocator(_root); + if (!alloc.reserve()) return xml_attribute(); + + xml_attribute a(impl::allocate_attribute(alloc)); + if (!a) return xml_attribute(); + + impl::insert_attribute_after(a._attr, attr._attr, _root); + + a.set_name(name_); + + return a; + } + + PUGI_IMPL_FN xml_attribute xml_node::insert_attribute_before(string_view_t name_, const xml_attribute& attr) + { + if (!impl::allow_insert_attribute(type())) return xml_attribute(); + if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute(); + + impl::xml_allocator& alloc = impl::get_allocator(_root); + if (!alloc.reserve()) return xml_attribute(); + + xml_attribute a(impl::allocate_attribute(alloc)); + if (!a) return xml_attribute(); + + impl::insert_attribute_before(a._attr, attr._attr, _root); + + a.set_name(name_); + + return a; + } +#endif + PUGI_IMPL_FN xml_attribute xml_node::append_copy(const xml_attribute& proto) { if (!proto) return xml_attribute(); @@ -6099,6 +6353,44 @@ return result; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_node xml_node::append_child(string_view_t name_) + { + xml_node result = append_child(node_element); + + result.set_name(name_); + + return result; + } + + PUGI_IMPL_FN xml_node xml_node::prepend_child(string_view_t name_) + { + xml_node result = prepend_child(node_element); + + result.set_name(name_); + + return result; + } + + PUGI_IMPL_FN xml_node xml_node::insert_child_after(string_view_t name_, const xml_node& node) + { + xml_node result = insert_child_after(node_element, node); + + result.set_name(name_); + + return result; + } + + PUGI_IMPL_FN xml_node xml_node::insert_child_before(string_view_t name_, const xml_node& node) + { + xml_node result = insert_child_before(node_element, node); + + result.set_name(name_); + + return result; + } +#endif + PUGI_IMPL_FN xml_node xml_node::append_copy(const xml_node& proto) { xml_node_type type_ = proto.type(); @@ -6242,6 +6534,13 @@ return remove_attribute(attribute(name_)); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_node::remove_attribute(string_view_t name_) + { + return remove_attribute(attribute(name_)); + } +#endif + PUGI_IMPL_FN bool xml_node::remove_attribute(const xml_attribute& a) { if (!_root || !a._attr) return false; @@ -6272,7 +6571,7 @@ attr = next; } - _root->first_attribute = 0; + _root->first_attribute = NULL; return true; } @@ -6282,6 +6581,13 @@ return remove_child(child(name_)); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_node::remove_child(string_view_t name_) + { + return remove_child(child(name_)); + } +#endif + PUGI_IMPL_FN bool xml_node::remove_child(const xml_node& n) { if (!_root || !n._root || n._root->parent != _root) return false; @@ -6311,7 +6617,7 @@ cur = next; } - _root->first_child = 0; + _root->first_child = NULL; return true; } @@ -6331,7 +6637,7 @@ doc->header |= impl::xml_memory_page_contents_shared_mask; // get extra buffer element (we'll store the document fragment buffer there so that we can deallocate it later) - impl::xml_memory_page* page = 0; + impl::xml_memory_page* page = NULL; impl::xml_extra_buffer* extra = static_cast<impl::xml_extra_buffer*>(doc->allocate_memory(sizeof(impl::xml_extra_buffer) + sizeof(void*), page)); (void)page; @@ -6344,7 +6650,7 @@ #endif // add extra buffer to the list - extra->buffer = 0; + extra->buffer = NULL; extra->next = doc->extra_buffers; doc->extra_buffers = extra; @@ -6484,7 +6790,7 @@ xml_node arg_begin(_root); if (!walker.begin(arg_begin)) return false; - xml_node_struct* cur = _root ? _root->first_child + 0 : 0; + xml_node_struct* cur = _root ? _root->first_child + 0 : NULL; if (cur) { @@ -6526,7 +6832,7 @@ PUGI_IMPL_FN size_t xml_node::hash_value() const { - return static_cast<size_t>(reinterpret_cast<uintptr_t>(_root) / sizeof(xml_node_struct)); + return reinterpret_cast<uintptr_t>(_root) / sizeof(xml_node_struct); } PUGI_IMPL_FN xml_node_struct* xml_node::internal_object() const @@ -6546,14 +6852,14 @@ } #ifndef PUGIXML_NO_STL - PUGI_IMPL_FN void xml_node::print(std::basic_ostream<char, std::char_traits<char> >& stream, const char_t* indent, unsigned int flags, xml_encoding encoding, unsigned int depth) const + PUGI_IMPL_FN void xml_node::print(std::basic_ostream<char>& stream, const char_t* indent, unsigned int flags, xml_encoding encoding, unsigned int depth) const { xml_writer_stream writer(stream); print(writer, indent, flags, encoding, depth); } - PUGI_IMPL_FN void xml_node::print(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream, const char_t* indent, unsigned int flags, unsigned int depth) const + PUGI_IMPL_FN void xml_node::print(std::basic_ostream<wchar_t>& stream, const char_t* indent, unsigned int flags, unsigned int depth) const { xml_writer_stream writer(stream); @@ -6620,7 +6926,7 @@ if (impl::is_text_node(node)) return node; - return 0; + return NULL; } PUGI_IMPL_FN xml_node_struct* xml_text::_data_new() @@ -6631,7 +6937,7 @@ return xml_node(_root).append_child(node_pcdata).internal_object(); } - PUGI_IMPL_FN xml_text::xml_text(): _root(0) + PUGI_IMPL_FN xml_text::xml_text(): _root(NULL) { } @@ -6641,7 +6947,7 @@ PUGI_IMPL_FN xml_text::operator xml_text::unspecified_bool_type() const { - return _data() ? unspecified_bool_xml_text : 0; + return _data() ? unspecified_bool_xml_text : NULL; } PUGI_IMPL_FN bool xml_text::operator!() const @@ -6651,7 +6957,7 @@ PUGI_IMPL_FN bool xml_text::empty() const { - return _data() == 0; + return _data() == NULL; } PUGI_IMPL_FN const char_t* xml_text::get() const @@ -6742,6 +7048,15 @@ return dn ? impl::strcpy_insitu(dn->value, dn->header, impl::xml_memory_page_value_allocated_mask, rhs, size) : false; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_text::set(string_view_t rhs) + { + xml_node_struct* dn = _data_new(); + + return dn ? impl::strcpy_insitu(dn->value, dn->header, impl::xml_memory_page_value_allocated_mask, rhs.data(), rhs.size()) : false; + } +#endif + PUGI_IMPL_FN bool xml_text::set(int rhs) { xml_node_struct* dn = _data_new(); @@ -6869,6 +7184,14 @@ return *this; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_text& xml_text::operator=(string_view_t rhs) + { + set(rhs); + return *this; + } +#endif + #ifdef PUGIXML_HAS_LONG_LONG PUGI_IMPL_FN xml_text& xml_text::operator=(long long rhs) { @@ -6931,7 +7254,7 @@ PUGI_IMPL_FN xml_node* xml_node_iterator::operator->() const { assert(_wrap._root); - return const_cast<xml_node*>(&_wrap); // BCC5 workaround + return &_wrap; } PUGI_IMPL_FN xml_node_iterator& xml_node_iterator::operator++() @@ -6992,7 +7315,7 @@ PUGI_IMPL_FN xml_attribute* xml_attribute_iterator::operator->() const { assert(_wrap._attr); - return const_cast<xml_attribute*>(&_wrap); // BCC5 workaround + return &_wrap; } PUGI_IMPL_FN xml_attribute_iterator& xml_attribute_iterator::operator++() @@ -7022,7 +7345,7 @@ return temp; } - PUGI_IMPL_FN xml_named_node_iterator::xml_named_node_iterator(): _name(0) + PUGI_IMPL_FN xml_named_node_iterator::xml_named_node_iterator(): _name(NULL) { } @@ -7053,7 +7376,7 @@ PUGI_IMPL_FN xml_node* xml_named_node_iterator::operator->() const { assert(_wrap._root); - return const_cast<xml_node*>(&_wrap); // BCC5 workaround + return &_wrap; } PUGI_IMPL_FN xml_named_node_iterator& xml_named_node_iterator::operator++() @@ -7132,7 +7455,7 @@ } } - PUGI_IMPL_FN xml_document::xml_document(): _buffer(0) + PUGI_IMPL_FN xml_document::xml_document(): _buffer(NULL) { _create(); } @@ -7143,7 +7466,7 @@ } #ifdef PUGIXML_HAS_MOVE - PUGI_IMPL_FN xml_document::xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT: _buffer(0) + PUGI_IMPL_FN xml_document::xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT: _buffer(NULL) { _create(); _move(rhs); @@ -7225,7 +7548,7 @@ if (_buffer) { impl::xml_memory::deallocate(_buffer); - _buffer = 0; + _buffer = NULL; } // destroy extra buffers (note: no need to destroy linked list nodes, they're allocated using document allocator) @@ -7253,7 +7576,7 @@ static_cast<impl::xml_document_struct*>(_root)->hash.clear(); #endif - _root = 0; + _root = NULL; } #ifdef PUGIXML_HAS_MOVE @@ -7308,7 +7631,7 @@ doc->_hash = &doc->hash; // make sure we don't access other hash up until the end when we reinitialize other document - other->_hash = 0; + other->_hash = NULL; #endif // move page structure @@ -7326,7 +7649,7 @@ page->prev = doc_page; doc_page->next = page; - other_page->next = 0; + other_page->next = NULL; } // make sure pages point to the correct document state @@ -7363,19 +7686,19 @@ // reset other document new (other) impl::xml_document_struct(PUGI_IMPL_GETPAGE(other)); - rhs._buffer = 0; + rhs._buffer = NULL; } #endif #ifndef PUGIXML_NO_STL - PUGI_IMPL_FN xml_parse_result xml_document::load(std::basic_istream<char, std::char_traits<char> >& stream, unsigned int options, xml_encoding encoding) + PUGI_IMPL_FN xml_parse_result xml_document::load(std::basic_istream<char>& stream, unsigned int options, xml_encoding encoding) { reset(); return impl::load_stream_impl(static_cast<impl::xml_document_struct*>(_root), stream, options, encoding, &_buffer); } - PUGI_IMPL_FN xml_parse_result xml_document::load(std::basic_istream<wchar_t, std::char_traits<wchar_t> >& stream, unsigned int options) + PUGI_IMPL_FN xml_parse_result xml_document::load(std::basic_istream<wchar_t>& stream, unsigned int options) { reset(); @@ -7445,7 +7768,7 @@ { impl::xml_buffered_writer buffered_writer(writer, encoding); - if ((flags & format_write_bom) && encoding != encoding_latin1) + if ((flags & format_write_bom) && buffered_writer.encoding != encoding_latin1) { // BOM always represents the codepoint U+FEFF, so just write it in native encoding #ifdef PUGIXML_WCHAR_MODE @@ -7459,7 +7782,7 @@ if (!(flags & format_no_declaration) && !impl::has_declaration(_root)) { buffered_writer.write_string(PUGIXML_TEXT("<?xml version=\"1.0\"")); - if (encoding == encoding_latin1) buffered_writer.write_string(PUGIXML_TEXT(" encoding=\"ISO-8859-1\"")); + if (buffered_writer.encoding == encoding_latin1) buffered_writer.write_string(PUGIXML_TEXT(" encoding=\"ISO-8859-1\"")); buffered_writer.write('?', '>'); if (!(flags & format_raw)) buffered_writer.write('\n'); } @@ -7470,14 +7793,14 @@ } #ifndef PUGIXML_NO_STL - PUGI_IMPL_FN void xml_document::save(std::basic_ostream<char, std::char_traits<char> >& stream, const char_t* indent, unsigned int flags, xml_encoding encoding) const + PUGI_IMPL_FN void xml_document::save(std::basic_ostream<char>& stream, const char_t* indent, unsigned int flags, xml_encoding encoding) const { xml_writer_stream writer(stream); save(writer, indent, flags, encoding); } - PUGI_IMPL_FN void xml_document::save(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream, const char_t* indent, unsigned int flags) const + PUGI_IMPL_FN void xml_document::save(std::basic_ostream<wchar_t>& stream, const char_t* indent, unsigned int flags) const { xml_writer_stream writer(stream); @@ -7790,7 +8113,7 @@ for (size_t probe = 0; probe <= hashmod; ++probe) { - if (table[bucket] == 0) + if (table[bucket] == NULL) { table[bucket] = key; return true; @@ -7838,7 +8161,7 @@ size_t _root_size; bool* _error; - xpath_allocator(xpath_memory_block* root, bool* error = 0): _root(root), _root_size(0), _error(error) + xpath_allocator(xpath_memory_block* root, bool* error = NULL): _root(root), _root_size(0), _error(error) { } @@ -7866,7 +8189,7 @@ if (!block) { if (_error) *_error = true; - return 0; + return NULL; } block->next = _root; @@ -7886,7 +8209,7 @@ new_size = (new_size + xpath_memory_block_alignment - 1) & ~(xpath_memory_block_alignment - 1); // we can only reallocate the last object - assert(ptr == 0 || static_cast<char*>(ptr) + old_size == &_root->data[0] + _root_size); + assert(ptr == NULL || static_cast<char*>(ptr) + old_size == &_root->data[0] + _root_size); // try to reallocate the object inplace if (ptr && _root_size - old_size + new_size <= _root->capacity) @@ -7897,7 +8220,7 @@ // allocate a new block void* result = allocate(new_size); - if (!result) return 0; + if (!result) return NULL; // we have a new block if (ptr) @@ -7992,7 +8315,7 @@ xpath_stack_data(): result(blocks + 0, &oom), temp(blocks + 1, &oom), oom(false) { - blocks[0].next = blocks[1].next = 0; + blocks[0].next = blocks[1].next = NULL; blocks[0].capacity = blocks[1].capacity = sizeof(blocks[0].data); stack.result = &result; @@ -8018,7 +8341,7 @@ static char_t* duplicate_string(const char_t* string, size_t length, xpath_allocator* alloc) { char_t* result = static_cast<char_t*>(alloc->allocate((length + 1) * sizeof(char_t))); - if (!result) return 0; + if (!result) return NULL; memcpy(result, string, length * sizeof(char_t)); result[length] = 0; @@ -8078,7 +8401,7 @@ size_t result_length = target_length + source_length; // allocate new buffer - char_t* result = static_cast<char_t*>(alloc->reallocate(_uses_heap ? const_cast<char_t*>(_buffer) : 0, (target_length + 1) * sizeof(char_t), (result_length + 1) * sizeof(char_t))); + char_t* result = static_cast<char_t*>(alloc->reallocate(_uses_heap ? const_cast<char_t*>(_buffer) : NULL, (target_length + 1) * sizeof(char_t), (result_length + 1) * sizeof(char_t))); if (!result) return; // append first string to the new buffer in case there was no reallocation @@ -8113,7 +8436,7 @@ size_t length_ = strlength(_buffer); const char_t* data_ = duplicate_string(_buffer, length_, alloc); - if (!data_) return 0; + if (!data_) return NULL; _buffer = data_; _uses_heap = true; @@ -8322,7 +8645,7 @@ if (node->value && (node->header & impl::xml_memory_page_value_allocated_or_shared_mask) == 0) return node->value; } - return 0; + return NULL; } xml_attribute_struct* attr = xnode.attribute().internal_object(); @@ -8335,10 +8658,10 @@ if ((attr->header & impl::xml_memory_page_value_allocated_or_shared_mask) == 0) return attr->value; } - return 0; + return NULL; } - return 0; + return NULL; } struct document_order_comparator @@ -8451,7 +8774,7 @@ if (v == 0) return PUGIXML_TEXT("0"); if (v != v) return PUGIXML_TEXT("NaN"); if (v * 2 == v) return value > 0 ? PUGIXML_TEXT("Infinity") : PUGIXML_TEXT("-Infinity"); - return 0; + return NULL; #endif } @@ -8616,9 +8939,9 @@ // parse string #ifdef PUGIXML_WCHAR_MODE - return wcstod(string, 0); + return wcstod(string, NULL); #else - return strtod(string, 0); + return strtod(string, NULL); #endif } @@ -8680,7 +9003,7 @@ { const char_t* pos = find_char(name, ':'); - prefix = pos ? name : 0; + prefix = pos ? name : NULL; prefix_length = pos ? static_cast<size_t>(pos - name) : 0; } @@ -8798,7 +9121,7 @@ unsigned int tc = static_cast<unsigned int>(*to); if (fc >= 128 || tc >= 128) - return 0; + return NULL; // code=128 means "skip character" if (!table[fc]) @@ -8813,7 +9136,7 @@ table[i] = static_cast<unsigned char>(i); void* result = alloc->allocate(sizeof(table)); - if (!result) return 0; + if (!result) return NULL; memcpy(result, table, sizeof(table)); @@ -8877,7 +9200,7 @@ struct xpath_variable_string: xpath_variable { - xpath_variable_string(): xpath_variable(xpath_type_string), value(0) + xpath_variable_string(): xpath_variable(xpath_type_string), value(NULL) { } @@ -8924,11 +9247,11 @@ template <typename T> PUGI_IMPL_FN T* new_xpath_variable(const char_t* name) { size_t length = strlength(name); - if (length == 0) return 0; // empty variable names are invalid + if (length == 0) return NULL; // empty variable names are invalid // $$ we can't use offsetof(T, name) because T is non-POD, so we just allocate additional length characters void* memory = xml_memory::allocate(sizeof(T) + length * sizeof(char_t)); - if (!memory) return 0; + if (!memory) return NULL; T* result = new (memory) T(); @@ -8954,7 +9277,7 @@ return new_xpath_variable<xpath_variable_boolean>(name); default: - return 0; + return NULL; } } @@ -9107,7 +9430,7 @@ xpath_node* _eos; public: - xpath_node_set_raw(): _type(xpath_node_set::type_unsorted), _begin(0), _end(0), _eos(0) + xpath_node_set_raw(): _type(xpath_node_set::type_unsorted), _begin(NULL), _end(NULL), _eos(NULL) { } @@ -9299,7 +9622,7 @@ const char_t* begin; const char_t* end; - xpath_lexer_string(): begin(0), end(0) + xpath_lexer_string(): begin(NULL), end(NULL) { } @@ -10487,40 +10810,40 @@ public: xpath_ast_node(ast_type_t type, xpath_value_type rettype_, const char_t* value): - _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(0), _right(0), _next(0) + _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(NULL), _right(NULL), _next(NULL) { assert(type == ast_string_constant); _data.string = value; } xpath_ast_node(ast_type_t type, xpath_value_type rettype_, double value): - _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(0), _right(0), _next(0) + _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(NULL), _right(NULL), _next(NULL) { assert(type == ast_number_constant); _data.number = value; } xpath_ast_node(ast_type_t type, xpath_value_type rettype_, xpath_variable* value): - _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(0), _right(0), _next(0) + _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(NULL), _right(NULL), _next(NULL) { assert(type == ast_variable); _data.variable = value; } - xpath_ast_node(ast_type_t type, xpath_value_type rettype_, xpath_ast_node* left = 0, xpath_ast_node* right = 0): - _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(left), _right(right), _next(0) + xpath_ast_node(ast_type_t type, xpath_value_type rettype_, xpath_ast_node* left = NULL, xpath_ast_node* right = NULL): + _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(left), _right(right), _next(NULL) { } xpath_ast_node(ast_type_t type, xpath_ast_node* left, axis_t axis, nodetest_t test, const char_t* contents): - _type(static_cast<char>(type)), _rettype(xpath_type_node_set), _axis(static_cast<char>(axis)), _test(static_cast<char>(test)), _left(left), _right(0), _next(0) + _type(static_cast<char>(type)), _rettype(xpath_type_node_set), _axis(static_cast<char>(axis)), _test(static_cast<char>(test)), _left(left), _right(NULL), _next(NULL) { assert(type == ast_step); _data.nodetest = contents; } xpath_ast_node(ast_type_t type, xpath_ast_node* left, xpath_ast_node* right, predicate_t test): - _type(static_cast<char>(type)), _rettype(xpath_type_node_set), _axis(0), _test(static_cast<char>(test)), _left(left), _right(right), _next(0) + _type(static_cast<char>(type)), _rettype(xpath_type_node_set), _axis(0), _test(static_cast<char>(test)), _left(left), _right(right), _next(NULL) { assert(type == ast_filter || type == ast_predicate); } @@ -10580,7 +10903,7 @@ xpath_string lr = _left->eval_string(c, stack); xpath_string rr = _right->eval_string(c, stack); - return find_substring(lr.c_str(), rr.c_str()) != 0; + return find_substring(lr.c_str(), rr.c_str()) != NULL; } case ast_func_boolean: @@ -11389,7 +11712,7 @@ _result->error = message; _result->offset = _lexer.current_pos() - _query; - return 0; + return NULL; } xpath_ast_node* error_oom() @@ -11397,7 +11720,7 @@ assert(_alloc->_error); *_alloc->_error = true; - return 0; + return NULL; } xpath_ast_node* error_rec() @@ -11413,37 +11736,37 @@ xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, const char_t* value) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, rettype, value) : 0; + return memory ? new (memory) xpath_ast_node(type, rettype, value) : NULL; } xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, double value) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, rettype, value) : 0; + return memory ? new (memory) xpath_ast_node(type, rettype, value) : NULL; } xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, xpath_variable* value) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, rettype, value) : 0; + return memory ? new (memory) xpath_ast_node(type, rettype, value) : NULL; } - xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, xpath_ast_node* left = 0, xpath_ast_node* right = 0) + xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, xpath_ast_node* left = NULL, xpath_ast_node* right = NULL) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, rettype, left, right) : 0; + return memory ? new (memory) xpath_ast_node(type, rettype, left, right) : NULL; } xpath_ast_node* alloc_node(ast_type_t type, xpath_ast_node* left, axis_t axis, nodetest_t test, const char_t* contents) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, left, axis, test, contents) : 0; + return memory ? new (memory) xpath_ast_node(type, left, axis, test, contents) : NULL; } xpath_ast_node* alloc_node(ast_type_t type, xpath_ast_node* left, xpath_ast_node* right, predicate_t test) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, left, right, test) : 0; + return memory ? new (memory) xpath_ast_node(type, left, right, test) : NULL; } const char_t* alloc_string(const xpath_lexer_string& value) @@ -11454,7 +11777,7 @@ size_t length = static_cast<size_t>(value.end - value.begin); char_t* c = static_cast<char_t*>(_alloc->allocate((length + 1) * sizeof(char_t))); - if (!c) return 0; + if (!c) return NULL; memcpy(c, value.begin, length * sizeof(char_t)); c[length] = 0; @@ -11697,7 +12020,7 @@ if (!_variables) return error("Unknown variable: variable set is not provided"); - xpath_variable* var = 0; + xpath_variable* var = NULL; if (!get_variable_scratch(_scratch, _variables, name.begin, name.end, &var)) return error_oom(); @@ -11714,7 +12037,7 @@ _lexer.next(); xpath_ast_node* n = parse_expression(); - if (!n) return 0; + if (!n) return NULL; if (_lexer.current() != lex_close_brace) return error("Expected ')' to match an opening '('"); @@ -11727,7 +12050,7 @@ case lex_quoted_string: { const char_t* value = alloc_string(_lexer.contents()); - if (!value) return 0; + if (!value) return NULL; _lexer.next(); @@ -11748,13 +12071,13 @@ case lex_string: { - xpath_ast_node* args[2] = {0}; + xpath_ast_node* args[2] = {NULL}; ... [truncated message content] |
From: <sv...@op...> - 2025-02-15 16:59:00
|
Author: manx Date: Sat Feb 15 17:58:46 2025 New Revision: 22909 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22909 Log: Merged revision(s) 22908 from trunk/OpenMPT: [Var] pugixml: Update to v1.15 (2025-01-10). ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/include/pugixml/LICENSE.md branches/OpenMPT-1.31/include/pugixml/OpenMPT.txt branches/OpenMPT-1.31/include/pugixml/readme.txt branches/OpenMPT-1.31/include/pugixml/src/pugiconfig.hpp branches/OpenMPT-1.31/include/pugixml/src/pugixml.cpp branches/OpenMPT-1.31/include/pugixml/src/pugixml.hpp Modified: branches/OpenMPT-1.31/include/pugixml/LICENSE.md ============================================================================== --- branches/OpenMPT-1.31/include/pugixml/LICENSE.md Sat Feb 15 17:58:18 2025 (r22908) +++ branches/OpenMPT-1.31/include/pugixml/LICENSE.md Sat Feb 15 17:58:46 2025 (r22909) @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2006-2023 Arseny Kapoulkine +Copyright (c) 2006-2025 Arseny Kapoulkine Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation Modified: branches/OpenMPT-1.31/include/pugixml/OpenMPT.txt ============================================================================== --- branches/OpenMPT-1.31/include/pugixml/OpenMPT.txt Sat Feb 15 17:58:18 2025 (r22908) +++ branches/OpenMPT-1.31/include/pugixml/OpenMPT.txt Sat Feb 15 17:58:46 2025 (r22909) @@ -1,2 +1,2 @@ -Directory contents based on pugixml 1.14. +pugixml v1.15 (2025-01-10). The docs and scripts folders have been omitted. Modified: branches/OpenMPT-1.31/include/pugixml/readme.txt ============================================================================== --- branches/OpenMPT-1.31/include/pugixml/readme.txt Sat Feb 15 17:58:18 2025 (r22908) +++ branches/OpenMPT-1.31/include/pugixml/readme.txt Sat Feb 15 17:58:46 2025 (r22909) @@ -1,6 +1,6 @@ -pugixml 1.14 - an XML processing library +pugixml 1.15 - an XML processing library -Copyright (C) 2006-2023, by Arseny Kapoulkine (ars...@gm...) +Copyright (C) 2006-2025, by Arseny Kapoulkine (ars...@gm...) Report bugs and download new versions at https://pugixml.org/ This is the distribution of pugixml, which is a C++ XML processing library, @@ -26,7 +26,7 @@ This library is distributed under the MIT License: -Copyright (c) 2006-2023 Arseny Kapoulkine +Copyright (c) 2006-2025 Arseny Kapoulkine Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation Modified: branches/OpenMPT-1.31/include/pugixml/src/pugiconfig.hpp ============================================================================== --- branches/OpenMPT-1.31/include/pugixml/src/pugiconfig.hpp Sat Feb 15 17:58:18 2025 (r22908) +++ branches/OpenMPT-1.31/include/pugixml/src/pugiconfig.hpp Sat Feb 15 17:58:46 2025 (r22909) @@ -1,7 +1,7 @@ /** - * pugixml parser - version 1.14 + * pugixml parser - version 1.15 * -------------------------------------------------------- - * Copyright (C) 2006-2023, by Arseny Kapoulkine (ars...@gm...) + * Copyright (C) 2006-2025, by Arseny Kapoulkine (ars...@gm...) * Report bugs and download new versions at https://pugixml.org/ * * This library is distributed under the MIT License. See notice at the end @@ -46,13 +46,16 @@ // Uncomment this to switch to header-only version // #define PUGIXML_HEADER_ONLY -// Uncomment this to enable long long support +// Uncomment this to enable long long support (usually enabled automatically) // #define PUGIXML_HAS_LONG_LONG +// Uncomment this to enable support for std::string_view (usually enabled automatically) +// #define PUGIXML_HAS_STRING_VIEW + #endif /** - * Copyright (c) 2006-2023 Arseny Kapoulkine + * Copyright (c) 2006-2025 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation Modified: branches/OpenMPT-1.31/include/pugixml/src/pugixml.cpp ============================================================================== --- branches/OpenMPT-1.31/include/pugixml/src/pugixml.cpp Sat Feb 15 17:58:18 2025 (r22908) +++ branches/OpenMPT-1.31/include/pugixml/src/pugixml.cpp Sat Feb 15 17:58:46 2025 (r22909) @@ -1,7 +1,7 @@ /** - * pugixml parser - version 1.14 + * pugixml parser - version 1.15 * -------------------------------------------------------- - * Copyright (C) 2006-2023, by Arseny Kapoulkine (ars...@gm...) + * Copyright (C) 2006-2025, by Arseny Kapoulkine (ars...@gm...) * Report bugs and download new versions at https://pugixml.org/ * * This library is distributed under the MIT License. See notice at the end @@ -53,6 +53,11 @@ # pragma warning(disable: 4996) // this function or variable may be unsafe #endif +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // NULL as null pointer constant +#endif + #if defined(_MSC_VER) && defined(__c2__) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wdeprecated" // this function or variable may be unsafe @@ -247,6 +252,24 @@ #endif } +#ifdef PUGIXML_HAS_STRING_VIEW + // Check if the null-terminated dst string is equal to the entire contents of srcview + PUGI_IMPL_FN bool stringview_equal(string_view_t srcview, const char_t* dst) + { + // std::basic_string_view::compare(const char*) has the right behavior, but it performs an + // extra traversal of dst to compute its length. + assert(dst); + const char_t* src = srcview.data(); + size_t srclen = srcview.size(); + + while (srclen && *dst && *src == *dst) + { + --srclen; ++dst; ++src; + } + return srclen == 0 && *dst == 0; + } +#endif + // Compare lhs with [rhs_begin, rhs_end) PUGI_IMPL_FN bool strequalrange(const char_t* lhs, const char_t* rhs, size_t count) { @@ -293,7 +316,7 @@ T* release() { T* result = data; - data = 0; + data = NULL; return result; } }; @@ -304,7 +327,7 @@ class compact_hash_table { public: - compact_hash_table(): _items(0), _capacity(0), _count(0) + compact_hash_table(): _items(NULL), _capacity(0), _count(0) { } @@ -313,7 +336,7 @@ if (_items) { xml_memory::deallocate(_items); - _items = 0; + _items = NULL; _capacity = 0; _count = 0; } @@ -321,11 +344,11 @@ void* find(const void* key) { - if (_capacity == 0) return 0; + if (_capacity == 0) return NULL; item_t* item = get_item(key); assert(item); - assert(item->key == key || (item->key == 0 && item->value == 0)); + assert(item->key == key || (item->key == NULL && item->value == NULL)); return item->value; } @@ -337,7 +360,7 @@ item_t* item = get_item(key); assert(item); - if (item->key == 0) + if (item->key == NULL) { _count++; item->key = key; @@ -380,7 +403,7 @@ { item_t& probe_item = _items[bucket]; - if (probe_item.key == key || probe_item.key == 0) + if (probe_item.key == key || probe_item.key == NULL) return &probe_item; // hash collision, quadratic probing @@ -388,7 +411,7 @@ } assert(false && "Hash table is full"); // unreachable - return 0; + return NULL; } static PUGI_IMPL_UNSIGNED_OVERFLOW unsigned int hash(const void* key) @@ -476,16 +499,16 @@ { xml_memory_page* result = static_cast<xml_memory_page*>(memory); - result->allocator = 0; - result->prev = 0; - result->next = 0; + result->allocator = NULL; + result->prev = NULL; + result->next = NULL; result->busy_size = 0; result->freed_size = 0; #ifdef PUGIXML_COMPACT - result->compact_string_base = 0; - result->compact_shared_parent = 0; - result->compact_page_marker = 0; + result->compact_string_base = NULL; + result->compact_shared_parent = NULL; + result->compact_page_marker = NULL; #endif return result; @@ -525,7 +548,7 @@ xml_allocator(xml_memory_page* root): _root(root), _busy_size(root->busy_size) { #ifdef PUGIXML_COMPACT - _hash = 0; + _hash = NULL; #endif } @@ -535,7 +558,7 @@ // allocate block with some alignment, leaving memory for worst-case padding void* memory = xml_memory::allocate(size); - if (!memory) return 0; + if (!memory) return NULL; // prepare page structure xml_memory_page* page = xml_memory_page::construct(memory); @@ -572,7 +595,7 @@ void* allocate_object(size_t size, xml_memory_page*& out_page) { void* result = allocate_memory(size + sizeof(uint32_t), out_page); - if (!result) return 0; + if (!result) return NULL; // adjust for marker ptrdiff_t offset = static_cast<char*>(result) - reinterpret_cast<char*>(out_page->compact_page_marker); @@ -618,7 +641,7 @@ if (page->freed_size == page->busy_size) { - if (page->next == 0) + if (page->next == NULL) { assert(_root == page); @@ -628,9 +651,9 @@ #ifdef PUGIXML_COMPACT // reset compact state to maximize efficiency - page->compact_string_base = 0; - page->compact_shared_parent = 0; - page->compact_page_marker = 0; + page->compact_string_base = NULL; + page->compact_shared_parent = NULL; + page->compact_page_marker = NULL; #endif _busy_size = 0; @@ -665,7 +688,7 @@ xml_memory_page* page; xml_memory_string_header* header = static_cast<xml_memory_string_header*>(allocate_memory(full_size, page)); - if (!header) return 0; + if (!header) return NULL; // setup header ptrdiff_t page_offset = reinterpret_cast<char*>(header) - reinterpret_cast<char*>(page) - sizeof(xml_memory_page); @@ -727,7 +750,7 @@ xml_memory_page* page = allocate_page(size <= large_allocation_threshold ? xml_memory_page_size : size); out_page = page; - if (!page) return 0; + if (!page) return NULL; if (size <= large_allocation_threshold) { @@ -874,7 +897,7 @@ return compact_get_value<header_offset, T>(this); } else - return 0; + return NULL; } T* operator->() const @@ -917,7 +940,7 @@ { xml_memory_page* page = compact_get_page(this, header_offset); - if (PUGI_IMPL_UNLIKELY(page->compact_shared_parent == 0)) + if (PUGI_IMPL_UNLIKELY(page->compact_shared_parent == NULL)) page->compact_shared_parent = value; if (page->compact_shared_parent == value) @@ -954,7 +977,7 @@ return compact_get_value<header_offset, T>(this); } else - return 0; + return NULL; } T* operator->() const @@ -984,7 +1007,7 @@ { xml_memory_page* page = compact_get_page(this, header_offset); - if (PUGI_IMPL_UNLIKELY(page->compact_string_base == 0)) + if (PUGI_IMPL_UNLIKELY(page->compact_string_base == NULL)) page->compact_string_base = value; ptrdiff_t offset = value - page->compact_string_base; @@ -1050,7 +1073,7 @@ } } else - return 0; + return NULL; } private: @@ -1109,7 +1132,7 @@ { struct xml_attribute_struct { - xml_attribute_struct(impl::xml_memory_page* page): name(0), value(0), prev_attribute_c(0), next_attribute(0) + xml_attribute_struct(impl::xml_memory_page* page): name(NULL), value(NULL), prev_attribute_c(NULL), next_attribute(NULL) { header = PUGI_IMPL_GETHEADER_IMPL(this, page, 0); } @@ -1125,7 +1148,7 @@ struct xml_node_struct { - xml_node_struct(impl::xml_memory_page* page, xml_node_type type): name(0), value(0), parent(0), first_child(0), prev_sibling_c(0), next_sibling(0), first_attribute(0) + xml_node_struct(impl::xml_memory_page* page, xml_node_type type): name(NULL), value(NULL), parent(NULL), first_child(NULL), prev_sibling_c(NULL), next_sibling(NULL), first_attribute(NULL) { header = PUGI_IMPL_GETHEADER_IMPL(this, page, type); } @@ -1156,7 +1179,7 @@ struct xml_document_struct: public xml_node_struct, public xml_allocator { - xml_document_struct(xml_memory_page* page): xml_node_struct(page, node_document), xml_allocator(page), buffer(0), extra_buffers(0) + xml_document_struct(xml_memory_page* page): xml_node_struct(page, node_document), xml_allocator(page), buffer(NULL), extra_buffers(NULL) { } @@ -1190,7 +1213,7 @@ { xml_memory_page* page; void* memory = alloc.allocate_object(sizeof(xml_attribute_struct), page); - if (!memory) return 0; + if (!memory) return NULL; return new (memory) xml_attribute_struct(page); } @@ -1199,7 +1222,7 @@ { xml_memory_page* page; void* memory = alloc.allocate_object(sizeof(xml_node_struct), page); - if (!memory) return 0; + if (!memory) return NULL; return new (memory) xml_node_struct(page, type); } @@ -1338,9 +1361,9 @@ else parent->first_child = next; - node->parent = 0; - node->prev_sibling_c = 0; - node->next_sibling = 0; + node->parent = NULL; + node->prev_sibling_c = NULL; + node->next_sibling = NULL; } inline void append_attribute(xml_attribute_struct* attr, xml_node_struct* node) @@ -1421,16 +1444,16 @@ else node->first_attribute = next; - attr->prev_attribute_c = 0; - attr->next_attribute = 0; + attr->prev_attribute_c = NULL; + attr->next_attribute = NULL; } PUGI_IMPL_FN_NO_INLINE xml_node_struct* append_new_node(xml_node_struct* node, xml_allocator& alloc, xml_node_type type = node_element) { - if (!alloc.reserve()) return 0; + if (!alloc.reserve()) return NULL; xml_node_struct* child = allocate_node(alloc, type); - if (!child) return 0; + if (!child) return NULL; append_node(child, node); @@ -1439,10 +1462,10 @@ PUGI_IMPL_FN_NO_INLINE xml_attribute_struct* append_new_attribute(xml_node_struct* node, xml_allocator& alloc) { - if (!alloc.reserve()) return 0; + if (!alloc.reserve()) return NULL; xml_attribute_struct* attr = allocate_attribute(alloc); - if (!attr) return 0; + if (!attr) return NULL; append_attribute(attr, node); @@ -1569,8 +1592,8 @@ static value_type high(value_type result, uint32_t ch) { - uint32_t msh = static_cast<uint32_t>(ch - 0x10000) >> 10; - uint32_t lsh = static_cast<uint32_t>(ch - 0x10000) & 0x3ff; + uint32_t msh = (ch - 0x10000U) >> 10; + uint32_t lsh = (ch - 0x10000U) & 0x3ff; result[0] = static_cast<uint16_t>(0xD800 + msh); result[1] = static_cast<uint16_t>(0xDC00 + lsh); @@ -2024,7 +2047,7 @@ if (d0 == 0x3c && d1 == 0) return encoding_utf16_le; // no known BOM detected; parse declaration - const uint8_t* enc = 0; + const uint8_t* enc = NULL; size_t enc_length = 0; if (d0 == 0x3c && d1 == 0x3f && d2 == 0x78 && d3 == 0x6d && parse_declaration_encoding(data, size, enc, enc_length)) @@ -2395,7 +2418,7 @@ if (header & header_mask) alloc->deallocate_string(dest); // mark the string as not allocated - dest = 0; + dest = NULL; header &= ~header_mask; return true; @@ -2438,7 +2461,7 @@ char_t* end; size_t size; - gap(): end(0), size(0) + gap(): end(NULL), size(0) { } @@ -2450,7 +2473,7 @@ { // Move [old_gap_end, new_gap_start) to [old_gap_start, ...) assert(s >= end); - memmove(end - size, end, reinterpret_cast<char*>(s) - reinterpret_cast<char*>(end)); + memmove(end - size, end, (s - end) * sizeof(char_t)); } s += count; // end of current gap @@ -2467,7 +2490,7 @@ { // Move [old_gap_end, current_pos) to [old_gap_start, ...) assert(s >= end); - memmove(end - size, end, reinterpret_cast<char*>(s) - reinterpret_cast<char*>(end)); + memmove(end - size, end, (s - end) * sizeof(char_t)); return s - size; } @@ -2625,7 +2648,7 @@ #define PUGI_IMPL_SCANWHILE(X) { while (X) ++s; } #define PUGI_IMPL_SCANWHILE_UNROLL(X) { for (;;) { char_t ss = s[0]; if (PUGI_IMPL_UNLIKELY(!(X))) { break; } ss = s[1]; if (PUGI_IMPL_UNLIKELY(!(X))) { s += 1; break; } ss = s[2]; if (PUGI_IMPL_UNLIKELY(!(X))) { s += 2; break; } ss = s[3]; if (PUGI_IMPL_UNLIKELY(!(X))) { s += 3; break; } s += 4; } } #define PUGI_IMPL_ENDSEG() { ch = *s; *s = 0; ++s; } - #define PUGI_IMPL_THROW_ERROR(err, m) return error_offset = m, error_status = err, static_cast<char_t*>(0) + #define PUGI_IMPL_THROW_ERROR(err, m) return error_offset = m, error_status = err, static_cast<char_t*>(NULL) #define PUGI_IMPL_CHECK_ERROR(err, m) { if (*s == 0) PUGI_IMPL_THROW_ERROR(err, m); } PUGI_IMPL_FN char_t* strconv_comment(char_t* s, char_t endch) @@ -2650,7 +2673,7 @@ } else if (*s == 0) { - return 0; + return NULL; } else ++s; } @@ -2678,7 +2701,7 @@ } else if (*s == 0) { - return 0; + return NULL; } else ++s; } @@ -2751,7 +2774,7 @@ case 5: return strconv_pcdata_impl<opt_true, opt_false, opt_true>::parse; case 6: return strconv_pcdata_impl<opt_true, opt_true, opt_false>::parse; case 7: return strconv_pcdata_impl<opt_true, opt_true, opt_true>::parse; - default: assert(false); return 0; // unreachable + default: assert(false); return NULL; // unreachable } } @@ -2805,7 +2828,7 @@ } else if (!*s) { - return 0; + return NULL; } else ++s; } @@ -2841,7 +2864,7 @@ } else if (!*s) { - return 0; + return NULL; } else ++s; } @@ -2873,7 +2896,7 @@ } else if (!*s) { - return 0; + return NULL; } else ++s; } @@ -2899,7 +2922,7 @@ } else if (!*s) { - return 0; + return NULL; } else ++s; } @@ -2928,7 +2951,7 @@ case 13: return strconv_attribute_impl<opt_true>::parse_wnorm; case 14: return strconv_attribute_impl<opt_false>::parse_wnorm; case 15: return strconv_attribute_impl<opt_true>::parse_wnorm; - default: assert(false); return 0; // unreachable + default: assert(false); return NULL; // unreachable } } @@ -2947,7 +2970,7 @@ char_t* error_offset; xml_parse_status error_status; - xml_parser(xml_allocator* alloc_): alloc(alloc_), error_offset(0), error_status(status_ok) + xml_parser(xml_allocator* alloc_): alloc(alloc_), error_offset(NULL), error_status(status_ok) { } @@ -3559,7 +3582,7 @@ return make_parse_result(PUGI_IMPL_OPTSET(parse_fragment) ? status_ok : status_no_document_element); // get last child of the root before parsing - xml_node_struct* last_root_child = root->first_child ? root->first_child->prev_sibling_c + 0 : 0; + xml_node_struct* last_root_child = root->first_child ? root->first_child->prev_sibling_c + 0 : NULL; // create parser on stack xml_parser parser(static_cast<xml_allocator*>(xmldoc)); @@ -4476,7 +4499,7 @@ PUGI_IMPL_FN void node_copy_tree(xml_node_struct* dn, xml_node_struct* sn) { xml_allocator& alloc = get_allocator(dn); - xml_allocator* shared_alloc = (&alloc == &get_allocator(sn)) ? &alloc : 0; + xml_allocator* shared_alloc = (&alloc == &get_allocator(sn)) ? &alloc : NULL; node_copy_contents(dn, sn, shared_alloc); @@ -4530,7 +4553,7 @@ PUGI_IMPL_FN void node_copy_attribute(xml_attribute_struct* da, xml_attribute_struct* sa) { xml_allocator& alloc = get_allocator(da); - xml_allocator* shared_alloc = (&alloc == &get_allocator(sa)) ? &alloc : 0; + xml_allocator* shared_alloc = (&alloc == &get_allocator(sa)) ? &alloc : NULL; node_copy_string(da->name, da->header, xml_memory_page_name_allocated_mask, sa->name, sa->header, shared_alloc); node_copy_string(da->value, da->header, xml_memory_page_value_allocated_mask, sa->value, sa->header, shared_alloc); @@ -4639,18 +4662,18 @@ PUGI_IMPL_FN double get_value_double(const char_t* value) { #ifdef PUGIXML_WCHAR_MODE - return wcstod(value, 0); + return wcstod(value, NULL); #else - return strtod(value, 0); + return strtod(value, NULL); #endif } PUGI_IMPL_FN float get_value_float(const char_t* value) { #ifdef PUGIXML_WCHAR_MODE - return static_cast<float>(wcstod(value, 0)); + return static_cast<float>(wcstod(value, NULL)); #else - return static_cast<float>(strtod(value, 0)); + return static_cast<float>(strtod(value, NULL)); #endif } @@ -4755,10 +4778,10 @@ xml_encoding buffer_encoding = impl::get_buffer_encoding(encoding, contents, size); // if convert_buffer below throws bad_alloc, we still need to deallocate contents if we own it - auto_deleter<void> contents_guard(own ? contents : 0, xml_memory::deallocate); + auto_deleter<void> contents_guard(own ? contents : NULL, xml_memory::deallocate); // get private buffer - char_t* buffer = 0; + char_t* buffer = NULL; size_t length = 0; // coverity[var_deref_model] @@ -4785,6 +4808,20 @@ return res; } + template <typename T> PUGI_IMPL_FN xml_parse_status convert_file_size(T length, size_t& out_result) + { + // check for I/O errors + if (length < 0) return status_io_error; + + // check for overflow + size_t result = static_cast<size_t>(length); + + if (static_cast<T>(result) != length) return status_out_of_memory; + + out_result = result; + return status_ok; + } + // we need to get length of entire file to load it in memory; the only (relatively) sane way to do it is via seek/tell trick PUGI_IMPL_FN xml_parse_status get_file_size(FILE* file, size_t& out_result) { @@ -4796,43 +4833,31 @@ // anything that's not a regular file doesn't have a coherent length if (!S_ISREG(st.st_mode)) return status_io_error; - typedef off_t length_type; - length_type length = st.st_size; + xml_parse_status status = convert_file_size(st.st_size, out_result); #elif defined(PUGI_IMPL_MSVC_CRT_VERSION) && PUGI_IMPL_MSVC_CRT_VERSION >= 1400 // there are 64-bit versions of fseek/ftell, let's use them - typedef __int64 length_type; - _fseeki64(file, 0, SEEK_END); - length_type length = _ftelli64(file); + __int64 length = _ftelli64(file); _fseeki64(file, 0, SEEK_SET); + + xml_parse_status status = convert_file_size(length, out_result); #elif defined(__MINGW32__) && !defined(__NO_MINGW_LFS) && (!defined(__STRICT_ANSI__) || defined(__MINGW64_VERSION_MAJOR)) // there are 64-bit versions of fseek/ftell, let's use them - typedef off64_t length_type; - fseeko64(file, 0, SEEK_END); - length_type length = ftello64(file); + off64_t length = ftello64(file); fseeko64(file, 0, SEEK_SET); + + xml_parse_status status = convert_file_size(length, out_result); #else // if this is a 32-bit OS, long is enough; if this is a unix system, long is 64-bit, which is enough; otherwise we can't do anything anyway. - typedef long length_type; - fseek(file, 0, SEEK_END); - length_type length = ftell(file); + long length = ftell(file); fseek(file, 0, SEEK_SET); - #endif - - // check for I/O errors - if (length < 0) return status_io_error; - - // check for overflow - size_t result = static_cast<size_t>(length); - if (static_cast<length_type>(result) != length) return status_out_of_memory; - - // finalize - out_result = result; + xml_parse_status status = convert_file_size(length, out_result); + #endif - return status_ok; + return status; } // This function assumes that buffer has extra sizeof(char_t) writable bytes after size @@ -4900,7 +4925,7 @@ static xml_stream_chunk* create() { void* memory = xml_memory::allocate(sizeof(xml_stream_chunk)); - if (!memory) return 0; + if (!memory) return NULL; return new (memory) xml_stream_chunk(); } @@ -4918,7 +4943,7 @@ } } - xml_stream_chunk(): next(0), size(0) + xml_stream_chunk(): next(NULL), size(0) { } @@ -4930,11 +4955,11 @@ template <typename T> PUGI_IMPL_FN xml_parse_status load_stream_data_noseek(std::basic_istream<T>& stream, void** out_buffer, size_t* out_size) { - auto_deleter<xml_stream_chunk<T> > chunks(0, xml_stream_chunk<T>::destroy); + auto_deleter<xml_stream_chunk<T> > chunks(NULL, xml_stream_chunk<T>::destroy); // read file to a chunk list size_t total = 0; - xml_stream_chunk<T>* last = 0; + xml_stream_chunk<T>* last = NULL; while (!stream.eof()) { @@ -5020,7 +5045,7 @@ template <typename T> PUGI_IMPL_FN xml_parse_result load_stream_impl(xml_document_struct* doc, std::basic_istream<T>& stream, unsigned int options, xml_encoding encoding, char_t** out_buffer) { - void* buffer = 0; + void* buffer = NULL; size_t size = 0; xml_parse_status status = status_ok; @@ -5047,9 +5072,17 @@ #if defined(PUGI_IMPL_MSVC_CRT_VERSION) || defined(__BORLANDC__) || (defined(__MINGW32__) && (!defined(__STRICT_ANSI__) || defined(__MINGW64_VERSION_MAJOR))) PUGI_IMPL_FN FILE* open_file_wide(const wchar_t* path, const wchar_t* mode) { +#ifdef PUGIXML_NO_STL + // ensure these symbols are consistently referenced to avoid 'unreferenced function' warnings + // note that generally these functions are used in STL builds, but PUGIXML_NO_STL leaves the only usage in convert_path_heap + (void)&as_utf8_begin; + (void)&as_utf8_end; + (void)&strlength_wide; +#endif + #if defined(PUGI_IMPL_MSVC_CRT_VERSION) && PUGI_IMPL_MSVC_CRT_VERSION >= 1400 - FILE* file = 0; - return _wfopen_s(&file, path, mode) == 0 ? file : 0; + FILE* file = NULL; + return _wfopen_s(&file, path, mode) == 0 ? file : NULL; #else return _wfopen(path, mode); #endif @@ -5065,7 +5098,7 @@ // allocate resulting string char* result = static_cast<char*>(xml_memory::allocate(size + 1)); - if (!result) return 0; + if (!result) return NULL; // second pass: convert to utf8 as_utf8_end(result, size, str, length); @@ -5080,7 +5113,7 @@ { // there is no standard function to open wide paths, so our best bet is to try utf8 path char* path_utf8 = convert_path_heap(path); - if (!path_utf8) return 0; + if (!path_utf8) return NULL; // convert mode to ASCII (we mirror _wfopen interface) char mode_ascii[4] = {0}; @@ -5099,8 +5132,8 @@ PUGI_IMPL_FN FILE* open_file(const char* path, const char* mode) { #if defined(PUGI_IMPL_MSVC_CRT_VERSION) && PUGI_IMPL_MSVC_CRT_VERSION >= 1400 - FILE* file = 0; - return fopen_s(&file, path, mode) == 0 ? file : 0; + FILE* file = NULL; + return fopen_s(&file, path, mode) == 0 ? file : NULL; #else return fopen(path, mode); #endif @@ -5123,7 +5156,7 @@ name_null_sentry(xml_node_struct* node_): node(node_), name(node_->name) { - node->name = 0; + node->name = NULL; } ~name_null_sentry() @@ -5150,11 +5183,11 @@ } #ifndef PUGIXML_NO_STL - PUGI_IMPL_FN xml_writer_stream::xml_writer_stream(std::basic_ostream<char, std::char_traits<char> >& stream): narrow_stream(&stream), wide_stream(0) + PUGI_IMPL_FN xml_writer_stream::xml_writer_stream(std::basic_ostream<char>& stream): narrow_stream(&stream), wide_stream(NULL) { } - PUGI_IMPL_FN xml_writer_stream::xml_writer_stream(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream): narrow_stream(0), wide_stream(&stream) + PUGI_IMPL_FN xml_writer_stream::xml_writer_stream(std::basic_ostream<wchar_t>& stream): narrow_stream(NULL), wide_stream(&stream) { } @@ -5198,7 +5231,7 @@ return true; } - PUGI_IMPL_FN xml_attribute::xml_attribute(): _attr(0) + PUGI_IMPL_FN xml_attribute::xml_attribute(): _attr(NULL) { } @@ -5212,7 +5245,7 @@ PUGI_IMPL_FN xml_attribute::operator xml_attribute::unspecified_bool_type() const { - return _attr ? unspecified_bool_xml_attribute : 0; + return _attr ? unspecified_bool_xml_attribute : NULL; } PUGI_IMPL_FN bool xml_attribute::operator!() const @@ -5342,7 +5375,7 @@ PUGI_IMPL_FN size_t xml_attribute::hash_value() const { - return static_cast<size_t>(reinterpret_cast<uintptr_t>(_attr) / sizeof(xml_attribute_struct)); + return reinterpret_cast<uintptr_t>(_attr) / sizeof(xml_attribute_struct); } PUGI_IMPL_FN xml_attribute_struct* xml_attribute::internal_object() const @@ -5398,6 +5431,14 @@ return *this; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_attribute& xml_attribute::operator=(string_view_t rhs) + { + set_value(rhs); + return *this; + } +#endif + #ifdef PUGIXML_HAS_LONG_LONG PUGI_IMPL_FN xml_attribute& xml_attribute::operator=(long long rhs) { @@ -5426,6 +5467,15 @@ return impl::strcpy_insitu(_attr->name, _attr->header, impl::xml_memory_page_name_allocated_mask, rhs, size); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_attribute::set_name(string_view_t rhs) + { + if (!_attr) return false; + + return impl::strcpy_insitu(_attr->name, _attr->header, impl::xml_memory_page_name_allocated_mask, rhs.data(), rhs.size()); + } +#endif + PUGI_IMPL_FN bool xml_attribute::set_value(const char_t* rhs) { if (!_attr) return false; @@ -5440,6 +5490,15 @@ return impl::strcpy_insitu(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs, size); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_attribute::set_value(string_view_t rhs) + { + if (!_attr) return false; + + return impl::strcpy_insitu(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs.data(), rhs.size()); + } +#endif + PUGI_IMPL_FN bool xml_attribute::set_value(int rhs) { if (!_attr) return false; @@ -5531,7 +5590,7 @@ } #endif - PUGI_IMPL_FN xml_node::xml_node(): _root(0) + PUGI_IMPL_FN xml_node::xml_node(): _root(NULL) { } @@ -5545,7 +5604,7 @@ PUGI_IMPL_FN xml_node::operator xml_node::unspecified_bool_type() const { - return _root ? unspecified_bool_xml_node : 0; + return _root ? unspecified_bool_xml_node : NULL; } PUGI_IMPL_FN bool xml_node::operator!() const @@ -5555,22 +5614,22 @@ PUGI_IMPL_FN xml_node::iterator xml_node::begin() const { - return iterator(_root ? _root->first_child + 0 : 0, _root); + return iterator(_root ? _root->first_child + 0 : NULL, _root); } PUGI_IMPL_FN xml_node::iterator xml_node::end() const { - return iterator(0, _root); + return iterator(NULL, _root); } PUGI_IMPL_FN xml_node::attribute_iterator xml_node::attributes_begin() const { - return attribute_iterator(_root ? _root->first_attribute + 0 : 0, _root); + return attribute_iterator(_root ? _root->first_attribute + 0 : NULL, _root); } PUGI_IMPL_FN xml_node::attribute_iterator xml_node::attributes_end() const { - return attribute_iterator(0, _root); + return attribute_iterator(NULL, _root); } PUGI_IMPL_FN xml_object_range<xml_node_iterator> xml_node::children() const @@ -5580,7 +5639,7 @@ PUGI_IMPL_FN xml_object_range<xml_named_node_iterator> xml_node::children(const char_t* name_) const { - return xml_object_range<xml_named_node_iterator>(xml_named_node_iterator(child(name_)._root, _root, name_), xml_named_node_iterator(0, _root, name_)); + return xml_object_range<xml_named_node_iterator>(xml_named_node_iterator(child(name_)._root, _root, name_), xml_named_node_iterator(NULL, _root, name_)); } PUGI_IMPL_FN xml_object_range<xml_attribute_iterator> xml_node::attributes() const @@ -5703,6 +5762,64 @@ return xml_node(); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_node xml_node::child(string_view_t name_) const + { + if (!_root) return xml_node(); + + for (xml_node_struct* i = _root->first_child; i; i = i->next_sibling) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + return xml_node(i); + } + + return xml_node(); + } + + PUGI_IMPL_FN xml_attribute xml_node::attribute(string_view_t name_) const + { + if (!_root) return xml_attribute(); + + for (xml_attribute_struct* i = _root->first_attribute; i; i = i->next_attribute) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + return xml_attribute(i); + } + + return xml_attribute(); + } + + PUGI_IMPL_FN xml_node xml_node::next_sibling(string_view_t name_) const + { + if (!_root) return xml_node(); + + for (xml_node_struct* i = _root->next_sibling; i; i = i->next_sibling) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + return xml_node(i); + } + + return xml_node(); + } + + PUGI_IMPL_FN xml_node xml_node::previous_sibling(string_view_t name_) const + { + if (!_root) return xml_node(); + + for (xml_node_struct* i = _root->prev_sibling_c; i->next_sibling; i = i->prev_sibling_c) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + return xml_node(i); + } + + return xml_node(); + } +#endif + PUGI_IMPL_FN xml_attribute xml_node::attribute(const char_t* name_, xml_attribute& hint_) const { xml_attribute_struct* hint = hint_._attr; @@ -5742,6 +5859,47 @@ return xml_attribute(); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_attribute xml_node::attribute(string_view_t name_, xml_attribute& hint_) const + { + xml_attribute_struct* hint = hint_._attr; + + // if hint is not an attribute of node, behavior is not defined + assert(!hint || (_root && impl::is_attribute_of(hint, _root))); + + if (!_root) return xml_attribute(); + + // optimistically search from hint up until the end + for (xml_attribute_struct* i = hint; i; i = i->next_attribute) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + { + // update hint to maximize efficiency of searching for consecutive attributes + hint_._attr = i->next_attribute; + + return xml_attribute(i); + } + } + + // wrap around and search from the first attribute until the hint + // 'j' null pointer check is technically redundant, but it prevents a crash in case the assertion above fails + for (xml_attribute_struct* j = _root->first_attribute; j && j != hint; j = j->next_attribute) + { + const char_t* jname = j->name; + if (jname && impl::stringview_equal(name_, jname)) + { + // update hint to maximize efficiency of searching for consecutive attributes + hint_._attr = j->next_attribute; + + return xml_attribute(j); + } + } + + return xml_attribute(); + } +#endif + PUGI_IMPL_FN xml_node xml_node::previous_sibling() const { if (!_root) return xml_node(); @@ -5833,6 +5991,18 @@ return impl::strcpy_insitu(_root->name, _root->header, impl::xml_memory_page_name_allocated_mask, rhs, size); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_node::set_name(string_view_t rhs) + { + xml_node_type type_ = _root ? PUGI_IMPL_NODETYPE(_root) : node_null; + + if (type_ != node_element && type_ != node_pi && type_ != node_declaration) + return false; + + return impl::strcpy_insitu(_root->name, _root->header, impl::xml_memory_page_name_allocated_mask, rhs.data(), rhs.size()); + } +#endif + PUGI_IMPL_FN bool xml_node::set_value(const char_t* rhs) { xml_node_type type_ = _root ? PUGI_IMPL_NODETYPE(_root) : node_null; @@ -5853,6 +6023,18 @@ return impl::strcpy_insitu(_root->value, _root->header, impl::xml_memory_page_value_allocated_mask, rhs, size); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_node::set_value(string_view_t rhs) + { + xml_node_type type_ = _root ? PUGI_IMPL_NODETYPE(_root) : node_null; + + if (type_ != node_pcdata && type_ != node_cdata && type_ != node_comment && type_ != node_pi && type_ != node_doctype) + return false; + + return impl::strcpy_insitu(_root->value, _root->header, impl::xml_memory_page_value_allocated_mask, rhs.data(), rhs.size()); + } +#endif + PUGI_IMPL_FN xml_attribute xml_node::append_attribute(const char_t* name_) { if (!impl::allow_insert_attribute(type())) return xml_attribute(); @@ -5923,6 +6105,78 @@ return a; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_attribute xml_node::append_attribute(string_view_t name_) + { + if (!impl::allow_insert_attribute(type())) return xml_attribute(); + + impl::xml_allocator& alloc = impl::get_allocator(_root); + if (!alloc.reserve()) return xml_attribute(); + + xml_attribute a(impl::allocate_attribute(alloc)); + if (!a) return xml_attribute(); + + impl::append_attribute(a._attr, _root); + + a.set_name(name_); + + return a; + } + + PUGI_IMPL_FN xml_attribute xml_node::prepend_attribute(string_view_t name_) + { + if (!impl::allow_insert_attribute(type())) return xml_attribute(); + + impl::xml_allocator& alloc = impl::get_allocator(_root); + if (!alloc.reserve()) return xml_attribute(); + + xml_attribute a(impl::allocate_attribute(alloc)); + if (!a) return xml_attribute(); + + impl::prepend_attribute(a._attr, _root); + + a.set_name(name_); + + return a; + } + + PUGI_IMPL_FN xml_attribute xml_node::insert_attribute_after(string_view_t name_, const xml_attribute& attr) + { + if (!impl::allow_insert_attribute(type())) return xml_attribute(); + if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute(); + + impl::xml_allocator& alloc = impl::get_allocator(_root); + if (!alloc.reserve()) return xml_attribute(); + + xml_attribute a(impl::allocate_attribute(alloc)); + if (!a) return xml_attribute(); + + impl::insert_attribute_after(a._attr, attr._attr, _root); + + a.set_name(name_); + + return a; + } + + PUGI_IMPL_FN xml_attribute xml_node::insert_attribute_before(string_view_t name_, const xml_attribute& attr) + { + if (!impl::allow_insert_attribute(type())) return xml_attribute(); + if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute(); + + impl::xml_allocator& alloc = impl::get_allocator(_root); + if (!alloc.reserve()) return xml_attribute(); + + xml_attribute a(impl::allocate_attribute(alloc)); + if (!a) return xml_attribute(); + + impl::insert_attribute_before(a._attr, attr._attr, _root); + + a.set_name(name_); + + return a; + } +#endif + PUGI_IMPL_FN xml_attribute xml_node::append_copy(const xml_attribute& proto) { if (!proto) return xml_attribute(); @@ -6099,6 +6353,44 @@ return result; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_node xml_node::append_child(string_view_t name_) + { + xml_node result = append_child(node_element); + + result.set_name(name_); + + return result; + } + + PUGI_IMPL_FN xml_node xml_node::prepend_child(string_view_t name_) + { + xml_node result = prepend_child(node_element); + + result.set_name(name_); + + return result; + } + + PUGI_IMPL_FN xml_node xml_node::insert_child_after(string_view_t name_, const xml_node& node) + { + xml_node result = insert_child_after(node_element, node); + + result.set_name(name_); + + return result; + } + + PUGI_IMPL_FN xml_node xml_node::insert_child_before(string_view_t name_, const xml_node& node) + { + xml_node result = insert_child_before(node_element, node); + + result.set_name(name_); + + return result; + } +#endif + PUGI_IMPL_FN xml_node xml_node::append_copy(const xml_node& proto) { xml_node_type type_ = proto.type(); @@ -6242,6 +6534,13 @@ return remove_attribute(attribute(name_)); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_node::remove_attribute(string_view_t name_) + { + return remove_attribute(attribute(name_)); + } +#endif + PUGI_IMPL_FN bool xml_node::remove_attribute(const xml_attribute& a) { if (!_root || !a._attr) return false; @@ -6272,7 +6571,7 @@ attr = next; } - _root->first_attribute = 0; + _root->first_attribute = NULL; return true; } @@ -6282,6 +6581,13 @@ return remove_child(child(name_)); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_node::remove_child(string_view_t name_) + { + return remove_child(child(name_)); + } +#endif + PUGI_IMPL_FN bool xml_node::remove_child(const xml_node& n) { if (!_root || !n._root || n._root->parent != _root) return false; @@ -6311,7 +6617,7 @@ cur = next; } - _root->first_child = 0; + _root->first_child = NULL; return true; } @@ -6331,7 +6637,7 @@ doc->header |= impl::xml_memory_page_contents_shared_mask; // get extra buffer element (we'll store the document fragment buffer there so that we can deallocate it later) - impl::xml_memory_page* page = 0; + impl::xml_memory_page* page = NULL; impl::xml_extra_buffer* extra = static_cast<impl::xml_extra_buffer*>(doc->allocate_memory(sizeof(impl::xml_extra_buffer) + sizeof(void*), page)); (void)page; @@ -6344,7 +6650,7 @@ #endif // add extra buffer to the list - extra->buffer = 0; + extra->buffer = NULL; extra->next = doc->extra_buffers; doc->extra_buffers = extra; @@ -6484,7 +6790,7 @@ xml_node arg_begin(_root); if (!walker.begin(arg_begin)) return false; - xml_node_struct* cur = _root ? _root->first_child + 0 : 0; + xml_node_struct* cur = _root ? _root->first_child + 0 : NULL; if (cur) { @@ -6526,7 +6832,7 @@ PUGI_IMPL_FN size_t xml_node::hash_value() const { - return static_cast<size_t>(reinterpret_cast<uintptr_t>(_root) / sizeof(xml_node_struct)); + return reinterpret_cast<uintptr_t>(_root) / sizeof(xml_node_struct); } PUGI_IMPL_FN xml_node_struct* xml_node::internal_object() const @@ -6546,14 +6852,14 @@ } #ifndef PUGIXML_NO_STL - PUGI_IMPL_FN void xml_node::print(std::basic_ostream<char, std::char_traits<char> >& stream, const char_t* indent, unsigned int flags, xml_encoding encoding, unsigned int depth) const + PUGI_IMPL_FN void xml_node::print(std::basic_ostream<char>& stream, const char_t* indent, unsigned int flags, xml_encoding encoding, unsigned int depth) const { xml_writer_stream writer(stream); print(writer, indent, flags, encoding, depth); } - PUGI_IMPL_FN void xml_node::print(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream, const char_t* indent, unsigned int flags, unsigned int depth) const + PUGI_IMPL_FN void xml_node::print(std::basic_ostream<wchar_t>& stream, const char_t* indent, unsigned int flags, unsigned int depth) const { xml_writer_stream writer(stream); @@ -6620,7 +6926,7 @@ if (impl::is_text_node(node)) return node; - return 0; + return NULL; } PUGI_IMPL_FN xml_node_struct* xml_text::_data_new() @@ -6631,7 +6937,7 @@ return xml_node(_root).append_child(node_pcdata).internal_object(); } - PUGI_IMPL_FN xml_text::xml_text(): _root(0) + PUGI_IMPL_FN xml_text::xml_text(): _root(NULL) { } @@ -6641,7 +6947,7 @@ PUGI_IMPL_FN xml_text::operator xml_text::unspecified_bool_type() const { - return _data() ? unspecified_bool_xml_text : 0; + return _data() ? unspecified_bool_xml_text : NULL; } PUGI_IMPL_FN bool xml_text::operator!() const @@ -6651,7 +6957,7 @@ PUGI_IMPL_FN bool xml_text::empty() const { - return _data() == 0; + return _data() == NULL; } PUGI_IMPL_FN const char_t* xml_text::get() const @@ -6742,6 +7048,15 @@ return dn ? impl::strcpy_insitu(dn->value, dn->header, impl::xml_memory_page_value_allocated_mask, rhs, size) : false; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_text::set(string_view_t rhs) + { + xml_node_struct* dn = _data_new(); + + return dn ? impl::strcpy_insitu(dn->value, dn->header, impl::xml_memory_page_value_allocated_mask, rhs.data(), rhs.size()) : false; + } +#endif + PUGI_IMPL_FN bool xml_text::set(int rhs) { xml_node_struct* dn = _data_new(); @@ -6869,6 +7184,14 @@ return *this; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_text& xml_text::operator=(string_view_t rhs) + { + set(rhs); + return *this; + } +#endif + #ifdef PUGIXML_HAS_LONG_LONG PUGI_IMPL_FN xml_text& xml_text::operator=(long long rhs) { @@ -6931,7 +7254,7 @@ PUGI_IMPL_FN xml_node* xml_node_iterator::operator->() const { assert(_wrap._root); - return const_cast<xml_node*>(&_wrap); // BCC5 workaround + return &_wrap; } PUGI_IMPL_FN xml_node_iterator& xml_node_iterator::operator++() @@ -6992,7 +7315,7 @@ PUGI_IMPL_FN xml_attribute* xml_attribute_iterator::operator->() const { assert(_wrap._attr); - return const_cast<xml_attribute*>(&_wrap); // BCC5 workaround + return &_wrap; } PUGI_IMPL_FN xml_attribute_iterator& xml_attribute_iterator::operator++() @@ -7022,7 +7345,7 @@ return temp; } - PUGI_IMPL_FN xml_named_node_iterator::xml_named_node_iterator(): _name(0) + PUGI_IMPL_FN xml_named_node_iterator::xml_named_node_iterator(): _name(NULL) { } @@ -7053,7 +7376,7 @@ PUGI_IMPL_FN xml_node* xml_named_node_iterator::operator->() const { assert(_wrap._root); - return const_cast<xml_node*>(&_wrap); // BCC5 workaround + return &_wrap; } PUGI_IMPL_FN xml_named_node_iterator& xml_named_node_iterator::operator++() @@ -7132,7 +7455,7 @@ } } - PUGI_IMPL_FN xml_document::xml_document(): _buffer(0) + PUGI_IMPL_FN xml_document::xml_document(): _buffer(NULL) { _create(); } @@ -7143,7 +7466,7 @@ } #ifdef PUGIXML_HAS_MOVE - PUGI_IMPL_FN xml_document::xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT: _buffer(0) + PUGI_IMPL_FN xml_document::xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT: _buffer(NULL) { _create(); _move(rhs); @@ -7225,7 +7548,7 @@ if (_buffer) { impl::xml_memory::deallocate(_buffer); - _buffer = 0; + _buffer = NULL; } // destroy extra buffers (note: no need to destroy linked list nodes, they're allocated using document allocator) @@ -7253,7 +7576,7 @@ static_cast<impl::xml_document_struct*>(_root)->hash.clear(); #endif - _root = 0; + _root = NULL; } #ifdef PUGIXML_HAS_MOVE @@ -7308,7 +7631,7 @@ doc->_hash = &doc->hash; // make sure we don't access other hash up until the end when we reinitialize other document - other->_hash = 0; + other->_hash = NULL; #endif // move page structure @@ -7326,7 +7649,7 @@ page->prev = doc_page; doc_page->next = page; - other_page->next = 0; + other_page->next = NULL; } // make sure pages point to the correct document state @@ -7363,19 +7686,19 @@ // reset other document new (other) impl::xml_document_struct(PUGI_IMPL_GETPAGE(other)); - rhs._buffer = 0; + rhs._buffer = NULL; } #endif #ifndef PUGIXML_NO_STL - PUGI_IMPL_FN xml_parse_result xml_document::load(std::basic_istream<char, std::char_traits<char> >& stream, unsigned int options, xml_encoding encoding) + PUGI_IMPL_FN xml_parse_result xml_document::load(std::basic_istream<char>& stream, unsigned int options, xml_encoding encoding) { reset(); return impl::load_stream_impl(static_cast<impl::xml_document_struct*>(_root), stream, options, encoding, &_buffer); } - PUGI_IMPL_FN xml_parse_result xml_document::load(std::basic_istream<wchar_t, std::char_traits<wchar_t> >& stream, unsigned int options) + PUGI_IMPL_FN xml_parse_result xml_document::load(std::basic_istream<wchar_t>& stream, unsigned int options) { reset(); @@ -7445,7 +7768,7 @@ { impl::xml_buffered_writer buffered_writer(writer, encoding); - if ((flags & format_write_bom) && encoding != encoding_latin1) + if ((flags & format_write_bom) && buffered_writer.encoding != encoding_latin1) { // BOM always represents the codepoint U+FEFF, so just write it in native encoding #ifdef PUGIXML_WCHAR_MODE @@ -7459,7 +7782,7 @@ if (!(flags & format_no_declaration) && !impl::has_declaration(_root)) { buffered_writer.write_string(PUGIXML_TEXT("<?xml version=\"1.0\"")); - if (encoding == encoding_latin1) buffered_writer.write_string(PUGIXML_TEXT(" encoding=\"ISO-8859-1\"")); + if (buffered_writer.encoding == encoding_latin1) buffered_writer.write_string(PUGIXML_TEXT(" encoding=\"ISO-8859-1\"")); buffered_writer.write('?', '>'); if (!(flags & format_raw)) buffered_writer.write('\n'); } @@ -7470,14 +7793,14 @@ } #ifndef PUGIXML_NO_STL - PUGI_IMPL_FN void xml_document::save(std::basic_ostream<char, std::char_traits<char> >& stream, const char_t* indent, unsigned int flags, xml_encoding encoding) const + PUGI_IMPL_FN void xml_document::save(std::basic_ostream<char>& stream, const char_t* indent, unsigned int flags, xml_encoding encoding) const { xml_writer_stream writer(stream); save(writer, indent, flags, encoding); } - PUGI_IMPL_FN void xml_document::save(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream, const char_t* indent, unsigned int flags) const + PUGI_IMPL_FN void xml_document::save(std::basic_ostream<wchar_t>& stream, const char_t* indent, unsigned int flags) const { xml_writer_stream writer(stream); @@ -7790,7 +8113,7 @@ for (size_t probe = 0; probe <= hashmod; ++probe) { - if (table[bucket] == 0) + if (table[bucket] == NULL) { table[bucket] = key; return true; @@ -7838,7 +8161,7 @@ size_t _root_size; bool* _error; - xpath_allocator(xpath_memory_block* root, bool* error = 0): _root(root), _root_size(0), _error(error) + xpath_allocator(xpath_memory_block* root, bool* error = NULL): _root(root), _root_size(0), _error(error) { } @@ -7866,7 +8189,7 @@ if (!block) { if (_error) *_error = true; - return 0; + return NULL; } block->next = _root; @@ -7886,7 +8209,7 @@ new_size = (new_size + xpath_memory_block_alignment - 1) & ~(xpath_memory_block_alignment - 1); // we can only reallocate the last object - assert(ptr == 0 || static_cast<char*>(ptr) + old_size == &_root->data[0] + _root_size); + assert(ptr == NULL || static_cast<char*>(ptr) + old_size == &_root->data[0] + _root_size); // try to reallocate the object inplace if (ptr && _root_size - old_size + new_size <= _root->capacity) @@ -7897,7 +8220,7 @@ // allocate a new block void* result = allocate(new_size); - if (!result) return 0; + if (!result) return NULL; // we have a new block if (ptr) @@ -7992,7 +8315,7 @@ xpath_stack_data(): result(blocks + 0, &oom), temp(blocks + 1, &oom), oom(false) { - blocks[0].next = blocks[1].next = 0; + blocks[0].next = blocks[1].next = NULL; blocks[0].capacity = blocks[1].capacity = sizeof(blocks[0].data); stack.result = &result; @@ -8018,7 +8341,7 @@ static char_t* duplicate_string(const char_t* string, size_t length, xpath_allocator* alloc) { char_t* result = static_cast<char_t*>(alloc->allocate((length + 1) * sizeof(char_t))); - if (!result) return 0; + if (!result) return NULL; memcpy(result, string, length * sizeof(char_t)); result[length] = 0; @@ -8078,7 +8401,7 @@ size_t result_length = target_length + source_length; // allocate new buffer - char_t* result = static_cast<char_t*>(alloc->reallocate(_uses_heap ? const_cast<char_t*>(_buffer) : 0, (target_length + 1) * sizeof(char_t), (result_length + 1) * sizeof(char_t))); + char_t* result = static_cast<char_t*>(alloc->reallocate(_uses_heap ? const_cast<char_t*>(_buffer) : NULL, (target_length + 1) * sizeof(char_t), (result_length + 1) * sizeof(char_t))); if (!result) return; // append first string to the new buffer in case there was no reallocation @@ -8113,7 +8436,7 @@ size_t length_ = strlength(_buffer); const char_t* data_ = duplicate_string(_buffer, length_, alloc); - if (!data_) return 0; + if (!data_) return NULL; _buffer = data_; _uses_heap = true; @@ -8322,7 +8645,7 @@ if (node->value && (node->header & impl::xml_memory_page_value_allocated_or_shared_mask) == 0) return node->value; } - return 0; + return NULL; } xml_attribute_struct* attr = xnode.attribute().internal_object(); @@ -8335,10 +8658,10 @@ if ((attr->header & impl::xml_memory_page_value_allocated_or_shared_mask) == 0) return attr->value; } - return 0; + return NULL; } - return 0; + return NULL; } struct document_order_comparator @@ -8451,7 +8774,7 @@ if (v == 0) return PUGIXML_TEXT("0"); if (v != v) return PUGIXML_TEXT("NaN"); if (v * 2 == v) return value > 0 ? PUGIXML_TEXT("Infinity") : PUGIXML_TEXT("-Infinity"); - return 0; + return NULL; #endif } @@ -8616,9 +8939,9 @@ // parse string #ifdef PUGIXML_WCHAR_MODE - return wcstod(string, 0); + return wcstod(string, NULL); #else - return strtod(string, 0); + return strtod(string, NULL); #endif } @@ -8680,7 +9003,7 @@ { const char_t* pos = find_char(name, ':'); - prefix = pos ? name : 0; + prefix = pos ? name : NULL; prefix_length = pos ? static_cast<size_t>(pos - name) : 0; } @@ -8798,7 +9121,7 @@ unsigned int tc = static_cast<unsigned int>(*to); if (fc >= 128 || tc >= 128) - return 0; + return NULL; // code=128 means "skip character" if (!table[fc]) @@ -8813,7 +9136,7 @@ table[i] = static_cast<unsigned char>(i); void* result = alloc->allocate(sizeof(table)); - if (!result) return 0; + if (!result) return NULL; memcpy(result, table, sizeof(table)); @@ -8877,7 +9200,7 @@ struct xpath_variable_string: xpath_variable { - xpath_variable_string(): xpath_variable(xpath_type_string), value(0) + xpath_variable_string(): xpath_variable(xpath_type_string), value(NULL) { } @@ -8924,11 +9247,11 @@ template <typename T> PUGI_IMPL_FN T* new_xpath_variable(const char_t* name) { size_t length = strlength(name); - if (length == 0) return 0; // empty variable names are invalid + if (length == 0) return NULL; // empty variable names are invalid // $$ we can't use offsetof(T, name) because T is non-POD, so we just allocate additional length characters void* memory = xml_memory::allocate(sizeof(T) + length * sizeof(char_t)); - if (!memory) return 0; + if (!memory) return NULL; T* result = new (memory) T(); @@ -8954,7 +9277,7 @@ return new_xpath_variable<xpath_variable_boolean>(name); default: - return 0; + return NULL; } } @@ -9107,7 +9430,7 @@ xpath_node* _eos; public: - xpath_node_set_raw(): _type(xpath_node_set::type_unsorted), _begin(0), _end(0), _eos(0) + xpath_node_set_raw(): _type(xpath_node_set::type_unsorted), _begin(NULL), _end(NULL), _eos(NULL) { } @@ -9299,7 +9622,7 @@ const char_t* begin; const char_t* end; - xpath_lexer_string(): begin(0), end(0) + xpath_lexer_string(): begin(NULL), end(NULL) { } @@ -10487,40 +10810,40 @@ public: xpath_ast_node(ast_type_t type, xpath_value_type rettype_, const char_t* value): - _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(0), _right(0), _next(0) + _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(NULL), _right(NULL), _next(NULL) { assert(type == ast_string_constant); _data.string = value; } xpath_ast_node(ast_type_t type, xpath_value_type rettype_, double value): - _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(0), _right(0), _next(0) + _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(NULL), _right(NULL), _next(NULL) { assert(type == ast_number_constant); _data.number = value; } xpath_ast_node(ast_type_t type, xpath_value_type rettype_, xpath_variable* value): - _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(0), _right(0), _next(0) + _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(NULL), _right(NULL), _next(NULL) { assert(type == ast_variable); _data.variable = value; } - xpath_ast_node(ast_type_t type, xpath_value_type rettype_, xpath_ast_node* left = 0, xpath_ast_node* right = 0): - _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(left), _right(right), _next(0) + xpath_ast_node(ast_type_t type, xpath_value_type rettype_, xpath_ast_node* left = NULL, xpath_ast_node* right = NULL): + _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(left), _right(right), _next(NULL) { } xpath_ast_node(ast_type_t type, xpath_ast_node* left, axis_t axis, nodetest_t test, const char_t* contents): - _type(static_cast<char>(type)), _rettype(xpath_type_node_set), _axis(static_cast<char>(axis)), _test(static_cast<char>(test)), _left(left), _right(0), _next(0) + _type(static_cast<char>(type)), _rettype(xpath_type_node_set), _axis(static_cast<char>(axis)), _test(static_cast<char>(test)), _left(left), _right(NULL), _next(NULL) { assert(type == ast_step); _data.nodetest = contents; } xpath_ast_node(ast_type_t type, xpath_ast_node* left, xpath_ast_node* right, predicate_t test): - _type(static_cast<char>(type)), _rettype(xpath_type_node_set), _axis(0), _test(static_cast<char>(test)), _left(left), _right(right), _next(0) + _type(static_cast<char>(type)), _rettype(xpath_type_node_set), _axis(0), _test(static_cast<char>(test)), _left(left), _right(right), _next(NULL) { assert(type == ast_filter || type == ast_predicate); } @@ -10580,7 +10903,7 @@ xpath_string lr = _left->eval_string(c, stack); xpath_string rr = _right->eval_string(c, stack); - return find_substring(lr.c_str(), rr.c_str()) != 0; + return find_substring(lr.c_str(), rr.c_str()) != NULL; } case ast_func_boolean: @@ -11389,7 +11712,7 @@ _result->error = message; _result->offset = _lexer.current_pos() - _query; - return 0; + return NULL; } xpath_ast_node* error_oom() @@ -11397,7 +11720,7 @@ assert(_alloc->_error); *_alloc->_error = true; - return 0; + return NULL; } xpath_ast_node* error_rec() @@ -11413,37 +11736,37 @@ xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, const char_t* value) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, rettype, value) : 0; + return memory ? new (memory) xpath_ast_node(type, rettype, value) : NULL; } xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, double value) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, rettype, value) : 0; + return memory ? new (memory) xpath_ast_node(type, rettype, value) : NULL; } xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, xpath_variable* value) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, rettype, value) : 0; + return memory ? new (memory) xpath_ast_node(type, rettype, value) : NULL; } - xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, xpath_ast_node* left = 0, xpath_ast_node* right = 0) + xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, xpath_ast_node* left = NULL, xpath_ast_node* right = NULL) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, rettype, left, right) : 0; + return memory ? new (memory) xpath_ast_node(type, rettype, left, right) : NULL; } xpath_ast_node* alloc_node(ast_type_t type, xpath_ast_node* left, axis_t axis, nodetest_t test, const char_t* contents) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, left, axis, test, contents) : 0; + return memory ? new (memory) xpath_ast_node(type, left, axis, test, contents) : NULL; } xpath_ast_node* alloc_node(ast_type_t type, xpath_ast_node* left, xpath_ast_node* right, predicate_t test) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, left, right, test) : 0; + return memory ? new (memory) xpath_ast_node(type, left, right, test) : NULL; } const char_t* alloc_string(const xpath_lexer_string& value) @@ -11454,7 +11777,7 @@ size_t length = static_cast<size_t>(value.end - value.begin); char_t* c = static_cast<char_t*>(_alloc->allocate((length + 1) * sizeof(char_t))); - if (!c) return 0; + if (!c) return NULL; memcpy(c, value.begin, length * sizeof(char_t)); c[length] = 0; @@ -11697,7 +12020,7 @@ if (!_variables) return error("Unknown variable: variable set is not provided"); - xpath_variable* var = 0; + xpath_variable* var = NULL; if (!get_variable_scratch(_scratch, _variables, name.begin, name.end, &var)) return error_oom(); @@ -11714,7 +12037,7 @@ _lexer.next(); xpath_ast_node* n = parse_expression(); - if (!n) return 0; + if (!n) return NULL; if (_lexer.current() != lex_close_brace) return error("Expected ')' to match an opening '('"); @@ -11727,7 +12050,7 @@ case lex_quoted_string: { const char_t* value = alloc_string(_lexer.contents()); - if (!value) return 0; + if (!value) return NULL; _lexer.next(); @@ -11748,13 +12071,13 @@ case lex_string: { - xpath_ast_node* args[2] = {0}; + xpath_ast_node* args[2] = {NULL}; ... [truncated message content] |
From: <sv...@op...> - 2025-02-15 16:58:27
|
Author: manx Date: Sat Feb 15 17:58:18 2025 New Revision: 22908 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22908 Log: [Var] pugixml: Update to v1.15 (2025-01-10). Modified: trunk/OpenMPT/include/pugixml/LICENSE.md trunk/OpenMPT/include/pugixml/OpenMPT.txt trunk/OpenMPT/include/pugixml/readme.txt trunk/OpenMPT/include/pugixml/src/pugiconfig.hpp trunk/OpenMPT/include/pugixml/src/pugixml.cpp trunk/OpenMPT/include/pugixml/src/pugixml.hpp Modified: trunk/OpenMPT/include/pugixml/LICENSE.md ============================================================================== --- trunk/OpenMPT/include/pugixml/LICENSE.md Sat Feb 15 17:52:38 2025 (r22907) +++ trunk/OpenMPT/include/pugixml/LICENSE.md Sat Feb 15 17:58:18 2025 (r22908) @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2006-2023 Arseny Kapoulkine +Copyright (c) 2006-2025 Arseny Kapoulkine Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation Modified: trunk/OpenMPT/include/pugixml/OpenMPT.txt ============================================================================== --- trunk/OpenMPT/include/pugixml/OpenMPT.txt Sat Feb 15 17:52:38 2025 (r22907) +++ trunk/OpenMPT/include/pugixml/OpenMPT.txt Sat Feb 15 17:58:18 2025 (r22908) @@ -1,2 +1,2 @@ -Directory contents based on pugixml 1.14. +pugixml v1.15 (2025-01-10). The docs and scripts folders have been omitted. Modified: trunk/OpenMPT/include/pugixml/readme.txt ============================================================================== --- trunk/OpenMPT/include/pugixml/readme.txt Sat Feb 15 17:52:38 2025 (r22907) +++ trunk/OpenMPT/include/pugixml/readme.txt Sat Feb 15 17:58:18 2025 (r22908) @@ -1,6 +1,6 @@ -pugixml 1.14 - an XML processing library +pugixml 1.15 - an XML processing library -Copyright (C) 2006-2023, by Arseny Kapoulkine (ars...@gm...) +Copyright (C) 2006-2025, by Arseny Kapoulkine (ars...@gm...) Report bugs and download new versions at https://pugixml.org/ This is the distribution of pugixml, which is a C++ XML processing library, @@ -26,7 +26,7 @@ This library is distributed under the MIT License: -Copyright (c) 2006-2023 Arseny Kapoulkine +Copyright (c) 2006-2025 Arseny Kapoulkine Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation Modified: trunk/OpenMPT/include/pugixml/src/pugiconfig.hpp ============================================================================== --- trunk/OpenMPT/include/pugixml/src/pugiconfig.hpp Sat Feb 15 17:52:38 2025 (r22907) +++ trunk/OpenMPT/include/pugixml/src/pugiconfig.hpp Sat Feb 15 17:58:18 2025 (r22908) @@ -1,7 +1,7 @@ /** - * pugixml parser - version 1.14 + * pugixml parser - version 1.15 * -------------------------------------------------------- - * Copyright (C) 2006-2023, by Arseny Kapoulkine (ars...@gm...) + * Copyright (C) 2006-2025, by Arseny Kapoulkine (ars...@gm...) * Report bugs and download new versions at https://pugixml.org/ * * This library is distributed under the MIT License. See notice at the end @@ -46,13 +46,16 @@ // Uncomment this to switch to header-only version // #define PUGIXML_HEADER_ONLY -// Uncomment this to enable long long support +// Uncomment this to enable long long support (usually enabled automatically) // #define PUGIXML_HAS_LONG_LONG +// Uncomment this to enable support for std::string_view (usually enabled automatically) +// #define PUGIXML_HAS_STRING_VIEW + #endif /** - * Copyright (c) 2006-2023 Arseny Kapoulkine + * Copyright (c) 2006-2025 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation Modified: trunk/OpenMPT/include/pugixml/src/pugixml.cpp ============================================================================== --- trunk/OpenMPT/include/pugixml/src/pugixml.cpp Sat Feb 15 17:52:38 2025 (r22907) +++ trunk/OpenMPT/include/pugixml/src/pugixml.cpp Sat Feb 15 17:58:18 2025 (r22908) @@ -1,7 +1,7 @@ /** - * pugixml parser - version 1.14 + * pugixml parser - version 1.15 * -------------------------------------------------------- - * Copyright (C) 2006-2023, by Arseny Kapoulkine (ars...@gm...) + * Copyright (C) 2006-2025, by Arseny Kapoulkine (ars...@gm...) * Report bugs and download new versions at https://pugixml.org/ * * This library is distributed under the MIT License. See notice at the end @@ -53,6 +53,11 @@ # pragma warning(disable: 4996) // this function or variable may be unsafe #endif +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // NULL as null pointer constant +#endif + #if defined(_MSC_VER) && defined(__c2__) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wdeprecated" // this function or variable may be unsafe @@ -247,6 +252,24 @@ #endif } +#ifdef PUGIXML_HAS_STRING_VIEW + // Check if the null-terminated dst string is equal to the entire contents of srcview + PUGI_IMPL_FN bool stringview_equal(string_view_t srcview, const char_t* dst) + { + // std::basic_string_view::compare(const char*) has the right behavior, but it performs an + // extra traversal of dst to compute its length. + assert(dst); + const char_t* src = srcview.data(); + size_t srclen = srcview.size(); + + while (srclen && *dst && *src == *dst) + { + --srclen; ++dst; ++src; + } + return srclen == 0 && *dst == 0; + } +#endif + // Compare lhs with [rhs_begin, rhs_end) PUGI_IMPL_FN bool strequalrange(const char_t* lhs, const char_t* rhs, size_t count) { @@ -293,7 +316,7 @@ T* release() { T* result = data; - data = 0; + data = NULL; return result; } }; @@ -304,7 +327,7 @@ class compact_hash_table { public: - compact_hash_table(): _items(0), _capacity(0), _count(0) + compact_hash_table(): _items(NULL), _capacity(0), _count(0) { } @@ -313,7 +336,7 @@ if (_items) { xml_memory::deallocate(_items); - _items = 0; + _items = NULL; _capacity = 0; _count = 0; } @@ -321,11 +344,11 @@ void* find(const void* key) { - if (_capacity == 0) return 0; + if (_capacity == 0) return NULL; item_t* item = get_item(key); assert(item); - assert(item->key == key || (item->key == 0 && item->value == 0)); + assert(item->key == key || (item->key == NULL && item->value == NULL)); return item->value; } @@ -337,7 +360,7 @@ item_t* item = get_item(key); assert(item); - if (item->key == 0) + if (item->key == NULL) { _count++; item->key = key; @@ -380,7 +403,7 @@ { item_t& probe_item = _items[bucket]; - if (probe_item.key == key || probe_item.key == 0) + if (probe_item.key == key || probe_item.key == NULL) return &probe_item; // hash collision, quadratic probing @@ -388,7 +411,7 @@ } assert(false && "Hash table is full"); // unreachable - return 0; + return NULL; } static PUGI_IMPL_UNSIGNED_OVERFLOW unsigned int hash(const void* key) @@ -476,16 +499,16 @@ { xml_memory_page* result = static_cast<xml_memory_page*>(memory); - result->allocator = 0; - result->prev = 0; - result->next = 0; + result->allocator = NULL; + result->prev = NULL; + result->next = NULL; result->busy_size = 0; result->freed_size = 0; #ifdef PUGIXML_COMPACT - result->compact_string_base = 0; - result->compact_shared_parent = 0; - result->compact_page_marker = 0; + result->compact_string_base = NULL; + result->compact_shared_parent = NULL; + result->compact_page_marker = NULL; #endif return result; @@ -525,7 +548,7 @@ xml_allocator(xml_memory_page* root): _root(root), _busy_size(root->busy_size) { #ifdef PUGIXML_COMPACT - _hash = 0; + _hash = NULL; #endif } @@ -535,7 +558,7 @@ // allocate block with some alignment, leaving memory for worst-case padding void* memory = xml_memory::allocate(size); - if (!memory) return 0; + if (!memory) return NULL; // prepare page structure xml_memory_page* page = xml_memory_page::construct(memory); @@ -572,7 +595,7 @@ void* allocate_object(size_t size, xml_memory_page*& out_page) { void* result = allocate_memory(size + sizeof(uint32_t), out_page); - if (!result) return 0; + if (!result) return NULL; // adjust for marker ptrdiff_t offset = static_cast<char*>(result) - reinterpret_cast<char*>(out_page->compact_page_marker); @@ -618,7 +641,7 @@ if (page->freed_size == page->busy_size) { - if (page->next == 0) + if (page->next == NULL) { assert(_root == page); @@ -628,9 +651,9 @@ #ifdef PUGIXML_COMPACT // reset compact state to maximize efficiency - page->compact_string_base = 0; - page->compact_shared_parent = 0; - page->compact_page_marker = 0; + page->compact_string_base = NULL; + page->compact_shared_parent = NULL; + page->compact_page_marker = NULL; #endif _busy_size = 0; @@ -665,7 +688,7 @@ xml_memory_page* page; xml_memory_string_header* header = static_cast<xml_memory_string_header*>(allocate_memory(full_size, page)); - if (!header) return 0; + if (!header) return NULL; // setup header ptrdiff_t page_offset = reinterpret_cast<char*>(header) - reinterpret_cast<char*>(page) - sizeof(xml_memory_page); @@ -727,7 +750,7 @@ xml_memory_page* page = allocate_page(size <= large_allocation_threshold ? xml_memory_page_size : size); out_page = page; - if (!page) return 0; + if (!page) return NULL; if (size <= large_allocation_threshold) { @@ -874,7 +897,7 @@ return compact_get_value<header_offset, T>(this); } else - return 0; + return NULL; } T* operator->() const @@ -917,7 +940,7 @@ { xml_memory_page* page = compact_get_page(this, header_offset); - if (PUGI_IMPL_UNLIKELY(page->compact_shared_parent == 0)) + if (PUGI_IMPL_UNLIKELY(page->compact_shared_parent == NULL)) page->compact_shared_parent = value; if (page->compact_shared_parent == value) @@ -954,7 +977,7 @@ return compact_get_value<header_offset, T>(this); } else - return 0; + return NULL; } T* operator->() const @@ -984,7 +1007,7 @@ { xml_memory_page* page = compact_get_page(this, header_offset); - if (PUGI_IMPL_UNLIKELY(page->compact_string_base == 0)) + if (PUGI_IMPL_UNLIKELY(page->compact_string_base == NULL)) page->compact_string_base = value; ptrdiff_t offset = value - page->compact_string_base; @@ -1050,7 +1073,7 @@ } } else - return 0; + return NULL; } private: @@ -1109,7 +1132,7 @@ { struct xml_attribute_struct { - xml_attribute_struct(impl::xml_memory_page* page): name(0), value(0), prev_attribute_c(0), next_attribute(0) + xml_attribute_struct(impl::xml_memory_page* page): name(NULL), value(NULL), prev_attribute_c(NULL), next_attribute(NULL) { header = PUGI_IMPL_GETHEADER_IMPL(this, page, 0); } @@ -1125,7 +1148,7 @@ struct xml_node_struct { - xml_node_struct(impl::xml_memory_page* page, xml_node_type type): name(0), value(0), parent(0), first_child(0), prev_sibling_c(0), next_sibling(0), first_attribute(0) + xml_node_struct(impl::xml_memory_page* page, xml_node_type type): name(NULL), value(NULL), parent(NULL), first_child(NULL), prev_sibling_c(NULL), next_sibling(NULL), first_attribute(NULL) { header = PUGI_IMPL_GETHEADER_IMPL(this, page, type); } @@ -1156,7 +1179,7 @@ struct xml_document_struct: public xml_node_struct, public xml_allocator { - xml_document_struct(xml_memory_page* page): xml_node_struct(page, node_document), xml_allocator(page), buffer(0), extra_buffers(0) + xml_document_struct(xml_memory_page* page): xml_node_struct(page, node_document), xml_allocator(page), buffer(NULL), extra_buffers(NULL) { } @@ -1190,7 +1213,7 @@ { xml_memory_page* page; void* memory = alloc.allocate_object(sizeof(xml_attribute_struct), page); - if (!memory) return 0; + if (!memory) return NULL; return new (memory) xml_attribute_struct(page); } @@ -1199,7 +1222,7 @@ { xml_memory_page* page; void* memory = alloc.allocate_object(sizeof(xml_node_struct), page); - if (!memory) return 0; + if (!memory) return NULL; return new (memory) xml_node_struct(page, type); } @@ -1338,9 +1361,9 @@ else parent->first_child = next; - node->parent = 0; - node->prev_sibling_c = 0; - node->next_sibling = 0; + node->parent = NULL; + node->prev_sibling_c = NULL; + node->next_sibling = NULL; } inline void append_attribute(xml_attribute_struct* attr, xml_node_struct* node) @@ -1421,16 +1444,16 @@ else node->first_attribute = next; - attr->prev_attribute_c = 0; - attr->next_attribute = 0; + attr->prev_attribute_c = NULL; + attr->next_attribute = NULL; } PUGI_IMPL_FN_NO_INLINE xml_node_struct* append_new_node(xml_node_struct* node, xml_allocator& alloc, xml_node_type type = node_element) { - if (!alloc.reserve()) return 0; + if (!alloc.reserve()) return NULL; xml_node_struct* child = allocate_node(alloc, type); - if (!child) return 0; + if (!child) return NULL; append_node(child, node); @@ -1439,10 +1462,10 @@ PUGI_IMPL_FN_NO_INLINE xml_attribute_struct* append_new_attribute(xml_node_struct* node, xml_allocator& alloc) { - if (!alloc.reserve()) return 0; + if (!alloc.reserve()) return NULL; xml_attribute_struct* attr = allocate_attribute(alloc); - if (!attr) return 0; + if (!attr) return NULL; append_attribute(attr, node); @@ -1569,8 +1592,8 @@ static value_type high(value_type result, uint32_t ch) { - uint32_t msh = static_cast<uint32_t>(ch - 0x10000) >> 10; - uint32_t lsh = static_cast<uint32_t>(ch - 0x10000) & 0x3ff; + uint32_t msh = (ch - 0x10000U) >> 10; + uint32_t lsh = (ch - 0x10000U) & 0x3ff; result[0] = static_cast<uint16_t>(0xD800 + msh); result[1] = static_cast<uint16_t>(0xDC00 + lsh); @@ -2024,7 +2047,7 @@ if (d0 == 0x3c && d1 == 0) return encoding_utf16_le; // no known BOM detected; parse declaration - const uint8_t* enc = 0; + const uint8_t* enc = NULL; size_t enc_length = 0; if (d0 == 0x3c && d1 == 0x3f && d2 == 0x78 && d3 == 0x6d && parse_declaration_encoding(data, size, enc, enc_length)) @@ -2395,7 +2418,7 @@ if (header & header_mask) alloc->deallocate_string(dest); // mark the string as not allocated - dest = 0; + dest = NULL; header &= ~header_mask; return true; @@ -2438,7 +2461,7 @@ char_t* end; size_t size; - gap(): end(0), size(0) + gap(): end(NULL), size(0) { } @@ -2450,7 +2473,7 @@ { // Move [old_gap_end, new_gap_start) to [old_gap_start, ...) assert(s >= end); - memmove(end - size, end, reinterpret_cast<char*>(s) - reinterpret_cast<char*>(end)); + memmove(end - size, end, (s - end) * sizeof(char_t)); } s += count; // end of current gap @@ -2467,7 +2490,7 @@ { // Move [old_gap_end, current_pos) to [old_gap_start, ...) assert(s >= end); - memmove(end - size, end, reinterpret_cast<char*>(s) - reinterpret_cast<char*>(end)); + memmove(end - size, end, (s - end) * sizeof(char_t)); return s - size; } @@ -2625,7 +2648,7 @@ #define PUGI_IMPL_SCANWHILE(X) { while (X) ++s; } #define PUGI_IMPL_SCANWHILE_UNROLL(X) { for (;;) { char_t ss = s[0]; if (PUGI_IMPL_UNLIKELY(!(X))) { break; } ss = s[1]; if (PUGI_IMPL_UNLIKELY(!(X))) { s += 1; break; } ss = s[2]; if (PUGI_IMPL_UNLIKELY(!(X))) { s += 2; break; } ss = s[3]; if (PUGI_IMPL_UNLIKELY(!(X))) { s += 3; break; } s += 4; } } #define PUGI_IMPL_ENDSEG() { ch = *s; *s = 0; ++s; } - #define PUGI_IMPL_THROW_ERROR(err, m) return error_offset = m, error_status = err, static_cast<char_t*>(0) + #define PUGI_IMPL_THROW_ERROR(err, m) return error_offset = m, error_status = err, static_cast<char_t*>(NULL) #define PUGI_IMPL_CHECK_ERROR(err, m) { if (*s == 0) PUGI_IMPL_THROW_ERROR(err, m); } PUGI_IMPL_FN char_t* strconv_comment(char_t* s, char_t endch) @@ -2650,7 +2673,7 @@ } else if (*s == 0) { - return 0; + return NULL; } else ++s; } @@ -2678,7 +2701,7 @@ } else if (*s == 0) { - return 0; + return NULL; } else ++s; } @@ -2751,7 +2774,7 @@ case 5: return strconv_pcdata_impl<opt_true, opt_false, opt_true>::parse; case 6: return strconv_pcdata_impl<opt_true, opt_true, opt_false>::parse; case 7: return strconv_pcdata_impl<opt_true, opt_true, opt_true>::parse; - default: assert(false); return 0; // unreachable + default: assert(false); return NULL; // unreachable } } @@ -2805,7 +2828,7 @@ } else if (!*s) { - return 0; + return NULL; } else ++s; } @@ -2841,7 +2864,7 @@ } else if (!*s) { - return 0; + return NULL; } else ++s; } @@ -2873,7 +2896,7 @@ } else if (!*s) { - return 0; + return NULL; } else ++s; } @@ -2899,7 +2922,7 @@ } else if (!*s) { - return 0; + return NULL; } else ++s; } @@ -2928,7 +2951,7 @@ case 13: return strconv_attribute_impl<opt_true>::parse_wnorm; case 14: return strconv_attribute_impl<opt_false>::parse_wnorm; case 15: return strconv_attribute_impl<opt_true>::parse_wnorm; - default: assert(false); return 0; // unreachable + default: assert(false); return NULL; // unreachable } } @@ -2947,7 +2970,7 @@ char_t* error_offset; xml_parse_status error_status; - xml_parser(xml_allocator* alloc_): alloc(alloc_), error_offset(0), error_status(status_ok) + xml_parser(xml_allocator* alloc_): alloc(alloc_), error_offset(NULL), error_status(status_ok) { } @@ -3559,7 +3582,7 @@ return make_parse_result(PUGI_IMPL_OPTSET(parse_fragment) ? status_ok : status_no_document_element); // get last child of the root before parsing - xml_node_struct* last_root_child = root->first_child ? root->first_child->prev_sibling_c + 0 : 0; + xml_node_struct* last_root_child = root->first_child ? root->first_child->prev_sibling_c + 0 : NULL; // create parser on stack xml_parser parser(static_cast<xml_allocator*>(xmldoc)); @@ -4476,7 +4499,7 @@ PUGI_IMPL_FN void node_copy_tree(xml_node_struct* dn, xml_node_struct* sn) { xml_allocator& alloc = get_allocator(dn); - xml_allocator* shared_alloc = (&alloc == &get_allocator(sn)) ? &alloc : 0; + xml_allocator* shared_alloc = (&alloc == &get_allocator(sn)) ? &alloc : NULL; node_copy_contents(dn, sn, shared_alloc); @@ -4530,7 +4553,7 @@ PUGI_IMPL_FN void node_copy_attribute(xml_attribute_struct* da, xml_attribute_struct* sa) { xml_allocator& alloc = get_allocator(da); - xml_allocator* shared_alloc = (&alloc == &get_allocator(sa)) ? &alloc : 0; + xml_allocator* shared_alloc = (&alloc == &get_allocator(sa)) ? &alloc : NULL; node_copy_string(da->name, da->header, xml_memory_page_name_allocated_mask, sa->name, sa->header, shared_alloc); node_copy_string(da->value, da->header, xml_memory_page_value_allocated_mask, sa->value, sa->header, shared_alloc); @@ -4639,18 +4662,18 @@ PUGI_IMPL_FN double get_value_double(const char_t* value) { #ifdef PUGIXML_WCHAR_MODE - return wcstod(value, 0); + return wcstod(value, NULL); #else - return strtod(value, 0); + return strtod(value, NULL); #endif } PUGI_IMPL_FN float get_value_float(const char_t* value) { #ifdef PUGIXML_WCHAR_MODE - return static_cast<float>(wcstod(value, 0)); + return static_cast<float>(wcstod(value, NULL)); #else - return static_cast<float>(strtod(value, 0)); + return static_cast<float>(strtod(value, NULL)); #endif } @@ -4755,10 +4778,10 @@ xml_encoding buffer_encoding = impl::get_buffer_encoding(encoding, contents, size); // if convert_buffer below throws bad_alloc, we still need to deallocate contents if we own it - auto_deleter<void> contents_guard(own ? contents : 0, xml_memory::deallocate); + auto_deleter<void> contents_guard(own ? contents : NULL, xml_memory::deallocate); // get private buffer - char_t* buffer = 0; + char_t* buffer = NULL; size_t length = 0; // coverity[var_deref_model] @@ -4785,6 +4808,20 @@ return res; } + template <typename T> PUGI_IMPL_FN xml_parse_status convert_file_size(T length, size_t& out_result) + { + // check for I/O errors + if (length < 0) return status_io_error; + + // check for overflow + size_t result = static_cast<size_t>(length); + + if (static_cast<T>(result) != length) return status_out_of_memory; + + out_result = result; + return status_ok; + } + // we need to get length of entire file to load it in memory; the only (relatively) sane way to do it is via seek/tell trick PUGI_IMPL_FN xml_parse_status get_file_size(FILE* file, size_t& out_result) { @@ -4796,43 +4833,31 @@ // anything that's not a regular file doesn't have a coherent length if (!S_ISREG(st.st_mode)) return status_io_error; - typedef off_t length_type; - length_type length = st.st_size; + xml_parse_status status = convert_file_size(st.st_size, out_result); #elif defined(PUGI_IMPL_MSVC_CRT_VERSION) && PUGI_IMPL_MSVC_CRT_VERSION >= 1400 // there are 64-bit versions of fseek/ftell, let's use them - typedef __int64 length_type; - _fseeki64(file, 0, SEEK_END); - length_type length = _ftelli64(file); + __int64 length = _ftelli64(file); _fseeki64(file, 0, SEEK_SET); + + xml_parse_status status = convert_file_size(length, out_result); #elif defined(__MINGW32__) && !defined(__NO_MINGW_LFS) && (!defined(__STRICT_ANSI__) || defined(__MINGW64_VERSION_MAJOR)) // there are 64-bit versions of fseek/ftell, let's use them - typedef off64_t length_type; - fseeko64(file, 0, SEEK_END); - length_type length = ftello64(file); + off64_t length = ftello64(file); fseeko64(file, 0, SEEK_SET); + + xml_parse_status status = convert_file_size(length, out_result); #else // if this is a 32-bit OS, long is enough; if this is a unix system, long is 64-bit, which is enough; otherwise we can't do anything anyway. - typedef long length_type; - fseek(file, 0, SEEK_END); - length_type length = ftell(file); + long length = ftell(file); fseek(file, 0, SEEK_SET); - #endif - - // check for I/O errors - if (length < 0) return status_io_error; - - // check for overflow - size_t result = static_cast<size_t>(length); - if (static_cast<length_type>(result) != length) return status_out_of_memory; - - // finalize - out_result = result; + xml_parse_status status = convert_file_size(length, out_result); + #endif - return status_ok; + return status; } // This function assumes that buffer has extra sizeof(char_t) writable bytes after size @@ -4900,7 +4925,7 @@ static xml_stream_chunk* create() { void* memory = xml_memory::allocate(sizeof(xml_stream_chunk)); - if (!memory) return 0; + if (!memory) return NULL; return new (memory) xml_stream_chunk(); } @@ -4918,7 +4943,7 @@ } } - xml_stream_chunk(): next(0), size(0) + xml_stream_chunk(): next(NULL), size(0) { } @@ -4930,11 +4955,11 @@ template <typename T> PUGI_IMPL_FN xml_parse_status load_stream_data_noseek(std::basic_istream<T>& stream, void** out_buffer, size_t* out_size) { - auto_deleter<xml_stream_chunk<T> > chunks(0, xml_stream_chunk<T>::destroy); + auto_deleter<xml_stream_chunk<T> > chunks(NULL, xml_stream_chunk<T>::destroy); // read file to a chunk list size_t total = 0; - xml_stream_chunk<T>* last = 0; + xml_stream_chunk<T>* last = NULL; while (!stream.eof()) { @@ -5020,7 +5045,7 @@ template <typename T> PUGI_IMPL_FN xml_parse_result load_stream_impl(xml_document_struct* doc, std::basic_istream<T>& stream, unsigned int options, xml_encoding encoding, char_t** out_buffer) { - void* buffer = 0; + void* buffer = NULL; size_t size = 0; xml_parse_status status = status_ok; @@ -5047,9 +5072,17 @@ #if defined(PUGI_IMPL_MSVC_CRT_VERSION) || defined(__BORLANDC__) || (defined(__MINGW32__) && (!defined(__STRICT_ANSI__) || defined(__MINGW64_VERSION_MAJOR))) PUGI_IMPL_FN FILE* open_file_wide(const wchar_t* path, const wchar_t* mode) { +#ifdef PUGIXML_NO_STL + // ensure these symbols are consistently referenced to avoid 'unreferenced function' warnings + // note that generally these functions are used in STL builds, but PUGIXML_NO_STL leaves the only usage in convert_path_heap + (void)&as_utf8_begin; + (void)&as_utf8_end; + (void)&strlength_wide; +#endif + #if defined(PUGI_IMPL_MSVC_CRT_VERSION) && PUGI_IMPL_MSVC_CRT_VERSION >= 1400 - FILE* file = 0; - return _wfopen_s(&file, path, mode) == 0 ? file : 0; + FILE* file = NULL; + return _wfopen_s(&file, path, mode) == 0 ? file : NULL; #else return _wfopen(path, mode); #endif @@ -5065,7 +5098,7 @@ // allocate resulting string char* result = static_cast<char*>(xml_memory::allocate(size + 1)); - if (!result) return 0; + if (!result) return NULL; // second pass: convert to utf8 as_utf8_end(result, size, str, length); @@ -5080,7 +5113,7 @@ { // there is no standard function to open wide paths, so our best bet is to try utf8 path char* path_utf8 = convert_path_heap(path); - if (!path_utf8) return 0; + if (!path_utf8) return NULL; // convert mode to ASCII (we mirror _wfopen interface) char mode_ascii[4] = {0}; @@ -5099,8 +5132,8 @@ PUGI_IMPL_FN FILE* open_file(const char* path, const char* mode) { #if defined(PUGI_IMPL_MSVC_CRT_VERSION) && PUGI_IMPL_MSVC_CRT_VERSION >= 1400 - FILE* file = 0; - return fopen_s(&file, path, mode) == 0 ? file : 0; + FILE* file = NULL; + return fopen_s(&file, path, mode) == 0 ? file : NULL; #else return fopen(path, mode); #endif @@ -5123,7 +5156,7 @@ name_null_sentry(xml_node_struct* node_): node(node_), name(node_->name) { - node->name = 0; + node->name = NULL; } ~name_null_sentry() @@ -5150,11 +5183,11 @@ } #ifndef PUGIXML_NO_STL - PUGI_IMPL_FN xml_writer_stream::xml_writer_stream(std::basic_ostream<char, std::char_traits<char> >& stream): narrow_stream(&stream), wide_stream(0) + PUGI_IMPL_FN xml_writer_stream::xml_writer_stream(std::basic_ostream<char>& stream): narrow_stream(&stream), wide_stream(NULL) { } - PUGI_IMPL_FN xml_writer_stream::xml_writer_stream(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream): narrow_stream(0), wide_stream(&stream) + PUGI_IMPL_FN xml_writer_stream::xml_writer_stream(std::basic_ostream<wchar_t>& stream): narrow_stream(NULL), wide_stream(&stream) { } @@ -5198,7 +5231,7 @@ return true; } - PUGI_IMPL_FN xml_attribute::xml_attribute(): _attr(0) + PUGI_IMPL_FN xml_attribute::xml_attribute(): _attr(NULL) { } @@ -5212,7 +5245,7 @@ PUGI_IMPL_FN xml_attribute::operator xml_attribute::unspecified_bool_type() const { - return _attr ? unspecified_bool_xml_attribute : 0; + return _attr ? unspecified_bool_xml_attribute : NULL; } PUGI_IMPL_FN bool xml_attribute::operator!() const @@ -5342,7 +5375,7 @@ PUGI_IMPL_FN size_t xml_attribute::hash_value() const { - return static_cast<size_t>(reinterpret_cast<uintptr_t>(_attr) / sizeof(xml_attribute_struct)); + return reinterpret_cast<uintptr_t>(_attr) / sizeof(xml_attribute_struct); } PUGI_IMPL_FN xml_attribute_struct* xml_attribute::internal_object() const @@ -5398,6 +5431,14 @@ return *this; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_attribute& xml_attribute::operator=(string_view_t rhs) + { + set_value(rhs); + return *this; + } +#endif + #ifdef PUGIXML_HAS_LONG_LONG PUGI_IMPL_FN xml_attribute& xml_attribute::operator=(long long rhs) { @@ -5426,6 +5467,15 @@ return impl::strcpy_insitu(_attr->name, _attr->header, impl::xml_memory_page_name_allocated_mask, rhs, size); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_attribute::set_name(string_view_t rhs) + { + if (!_attr) return false; + + return impl::strcpy_insitu(_attr->name, _attr->header, impl::xml_memory_page_name_allocated_mask, rhs.data(), rhs.size()); + } +#endif + PUGI_IMPL_FN bool xml_attribute::set_value(const char_t* rhs) { if (!_attr) return false; @@ -5440,6 +5490,15 @@ return impl::strcpy_insitu(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs, size); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_attribute::set_value(string_view_t rhs) + { + if (!_attr) return false; + + return impl::strcpy_insitu(_attr->value, _attr->header, impl::xml_memory_page_value_allocated_mask, rhs.data(), rhs.size()); + } +#endif + PUGI_IMPL_FN bool xml_attribute::set_value(int rhs) { if (!_attr) return false; @@ -5531,7 +5590,7 @@ } #endif - PUGI_IMPL_FN xml_node::xml_node(): _root(0) + PUGI_IMPL_FN xml_node::xml_node(): _root(NULL) { } @@ -5545,7 +5604,7 @@ PUGI_IMPL_FN xml_node::operator xml_node::unspecified_bool_type() const { - return _root ? unspecified_bool_xml_node : 0; + return _root ? unspecified_bool_xml_node : NULL; } PUGI_IMPL_FN bool xml_node::operator!() const @@ -5555,22 +5614,22 @@ PUGI_IMPL_FN xml_node::iterator xml_node::begin() const { - return iterator(_root ? _root->first_child + 0 : 0, _root); + return iterator(_root ? _root->first_child + 0 : NULL, _root); } PUGI_IMPL_FN xml_node::iterator xml_node::end() const { - return iterator(0, _root); + return iterator(NULL, _root); } PUGI_IMPL_FN xml_node::attribute_iterator xml_node::attributes_begin() const { - return attribute_iterator(_root ? _root->first_attribute + 0 : 0, _root); + return attribute_iterator(_root ? _root->first_attribute + 0 : NULL, _root); } PUGI_IMPL_FN xml_node::attribute_iterator xml_node::attributes_end() const { - return attribute_iterator(0, _root); + return attribute_iterator(NULL, _root); } PUGI_IMPL_FN xml_object_range<xml_node_iterator> xml_node::children() const @@ -5580,7 +5639,7 @@ PUGI_IMPL_FN xml_object_range<xml_named_node_iterator> xml_node::children(const char_t* name_) const { - return xml_object_range<xml_named_node_iterator>(xml_named_node_iterator(child(name_)._root, _root, name_), xml_named_node_iterator(0, _root, name_)); + return xml_object_range<xml_named_node_iterator>(xml_named_node_iterator(child(name_)._root, _root, name_), xml_named_node_iterator(NULL, _root, name_)); } PUGI_IMPL_FN xml_object_range<xml_attribute_iterator> xml_node::attributes() const @@ -5703,6 +5762,64 @@ return xml_node(); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_node xml_node::child(string_view_t name_) const + { + if (!_root) return xml_node(); + + for (xml_node_struct* i = _root->first_child; i; i = i->next_sibling) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + return xml_node(i); + } + + return xml_node(); + } + + PUGI_IMPL_FN xml_attribute xml_node::attribute(string_view_t name_) const + { + if (!_root) return xml_attribute(); + + for (xml_attribute_struct* i = _root->first_attribute; i; i = i->next_attribute) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + return xml_attribute(i); + } + + return xml_attribute(); + } + + PUGI_IMPL_FN xml_node xml_node::next_sibling(string_view_t name_) const + { + if (!_root) return xml_node(); + + for (xml_node_struct* i = _root->next_sibling; i; i = i->next_sibling) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + return xml_node(i); + } + + return xml_node(); + } + + PUGI_IMPL_FN xml_node xml_node::previous_sibling(string_view_t name_) const + { + if (!_root) return xml_node(); + + for (xml_node_struct* i = _root->prev_sibling_c; i->next_sibling; i = i->prev_sibling_c) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + return xml_node(i); + } + + return xml_node(); + } +#endif + PUGI_IMPL_FN xml_attribute xml_node::attribute(const char_t* name_, xml_attribute& hint_) const { xml_attribute_struct* hint = hint_._attr; @@ -5742,6 +5859,47 @@ return xml_attribute(); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_attribute xml_node::attribute(string_view_t name_, xml_attribute& hint_) const + { + xml_attribute_struct* hint = hint_._attr; + + // if hint is not an attribute of node, behavior is not defined + assert(!hint || (_root && impl::is_attribute_of(hint, _root))); + + if (!_root) return xml_attribute(); + + // optimistically search from hint up until the end + for (xml_attribute_struct* i = hint; i; i = i->next_attribute) + { + const char_t* iname = i->name; + if (iname && impl::stringview_equal(name_, iname)) + { + // update hint to maximize efficiency of searching for consecutive attributes + hint_._attr = i->next_attribute; + + return xml_attribute(i); + } + } + + // wrap around and search from the first attribute until the hint + // 'j' null pointer check is technically redundant, but it prevents a crash in case the assertion above fails + for (xml_attribute_struct* j = _root->first_attribute; j && j != hint; j = j->next_attribute) + { + const char_t* jname = j->name; + if (jname && impl::stringview_equal(name_, jname)) + { + // update hint to maximize efficiency of searching for consecutive attributes + hint_._attr = j->next_attribute; + + return xml_attribute(j); + } + } + + return xml_attribute(); + } +#endif + PUGI_IMPL_FN xml_node xml_node::previous_sibling() const { if (!_root) return xml_node(); @@ -5833,6 +5991,18 @@ return impl::strcpy_insitu(_root->name, _root->header, impl::xml_memory_page_name_allocated_mask, rhs, size); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_node::set_name(string_view_t rhs) + { + xml_node_type type_ = _root ? PUGI_IMPL_NODETYPE(_root) : node_null; + + if (type_ != node_element && type_ != node_pi && type_ != node_declaration) + return false; + + return impl::strcpy_insitu(_root->name, _root->header, impl::xml_memory_page_name_allocated_mask, rhs.data(), rhs.size()); + } +#endif + PUGI_IMPL_FN bool xml_node::set_value(const char_t* rhs) { xml_node_type type_ = _root ? PUGI_IMPL_NODETYPE(_root) : node_null; @@ -5853,6 +6023,18 @@ return impl::strcpy_insitu(_root->value, _root->header, impl::xml_memory_page_value_allocated_mask, rhs, size); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_node::set_value(string_view_t rhs) + { + xml_node_type type_ = _root ? PUGI_IMPL_NODETYPE(_root) : node_null; + + if (type_ != node_pcdata && type_ != node_cdata && type_ != node_comment && type_ != node_pi && type_ != node_doctype) + return false; + + return impl::strcpy_insitu(_root->value, _root->header, impl::xml_memory_page_value_allocated_mask, rhs.data(), rhs.size()); + } +#endif + PUGI_IMPL_FN xml_attribute xml_node::append_attribute(const char_t* name_) { if (!impl::allow_insert_attribute(type())) return xml_attribute(); @@ -5923,6 +6105,78 @@ return a; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_attribute xml_node::append_attribute(string_view_t name_) + { + if (!impl::allow_insert_attribute(type())) return xml_attribute(); + + impl::xml_allocator& alloc = impl::get_allocator(_root); + if (!alloc.reserve()) return xml_attribute(); + + xml_attribute a(impl::allocate_attribute(alloc)); + if (!a) return xml_attribute(); + + impl::append_attribute(a._attr, _root); + + a.set_name(name_); + + return a; + } + + PUGI_IMPL_FN xml_attribute xml_node::prepend_attribute(string_view_t name_) + { + if (!impl::allow_insert_attribute(type())) return xml_attribute(); + + impl::xml_allocator& alloc = impl::get_allocator(_root); + if (!alloc.reserve()) return xml_attribute(); + + xml_attribute a(impl::allocate_attribute(alloc)); + if (!a) return xml_attribute(); + + impl::prepend_attribute(a._attr, _root); + + a.set_name(name_); + + return a; + } + + PUGI_IMPL_FN xml_attribute xml_node::insert_attribute_after(string_view_t name_, const xml_attribute& attr) + { + if (!impl::allow_insert_attribute(type())) return xml_attribute(); + if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute(); + + impl::xml_allocator& alloc = impl::get_allocator(_root); + if (!alloc.reserve()) return xml_attribute(); + + xml_attribute a(impl::allocate_attribute(alloc)); + if (!a) return xml_attribute(); + + impl::insert_attribute_after(a._attr, attr._attr, _root); + + a.set_name(name_); + + return a; + } + + PUGI_IMPL_FN xml_attribute xml_node::insert_attribute_before(string_view_t name_, const xml_attribute& attr) + { + if (!impl::allow_insert_attribute(type())) return xml_attribute(); + if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute(); + + impl::xml_allocator& alloc = impl::get_allocator(_root); + if (!alloc.reserve()) return xml_attribute(); + + xml_attribute a(impl::allocate_attribute(alloc)); + if (!a) return xml_attribute(); + + impl::insert_attribute_before(a._attr, attr._attr, _root); + + a.set_name(name_); + + return a; + } +#endif + PUGI_IMPL_FN xml_attribute xml_node::append_copy(const xml_attribute& proto) { if (!proto) return xml_attribute(); @@ -6099,6 +6353,44 @@ return result; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_node xml_node::append_child(string_view_t name_) + { + xml_node result = append_child(node_element); + + result.set_name(name_); + + return result; + } + + PUGI_IMPL_FN xml_node xml_node::prepend_child(string_view_t name_) + { + xml_node result = prepend_child(node_element); + + result.set_name(name_); + + return result; + } + + PUGI_IMPL_FN xml_node xml_node::insert_child_after(string_view_t name_, const xml_node& node) + { + xml_node result = insert_child_after(node_element, node); + + result.set_name(name_); + + return result; + } + + PUGI_IMPL_FN xml_node xml_node::insert_child_before(string_view_t name_, const xml_node& node) + { + xml_node result = insert_child_before(node_element, node); + + result.set_name(name_); + + return result; + } +#endif + PUGI_IMPL_FN xml_node xml_node::append_copy(const xml_node& proto) { xml_node_type type_ = proto.type(); @@ -6242,6 +6534,13 @@ return remove_attribute(attribute(name_)); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_node::remove_attribute(string_view_t name_) + { + return remove_attribute(attribute(name_)); + } +#endif + PUGI_IMPL_FN bool xml_node::remove_attribute(const xml_attribute& a) { if (!_root || !a._attr) return false; @@ -6272,7 +6571,7 @@ attr = next; } - _root->first_attribute = 0; + _root->first_attribute = NULL; return true; } @@ -6282,6 +6581,13 @@ return remove_child(child(name_)); } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_node::remove_child(string_view_t name_) + { + return remove_child(child(name_)); + } +#endif + PUGI_IMPL_FN bool xml_node::remove_child(const xml_node& n) { if (!_root || !n._root || n._root->parent != _root) return false; @@ -6311,7 +6617,7 @@ cur = next; } - _root->first_child = 0; + _root->first_child = NULL; return true; } @@ -6331,7 +6637,7 @@ doc->header |= impl::xml_memory_page_contents_shared_mask; // get extra buffer element (we'll store the document fragment buffer there so that we can deallocate it later) - impl::xml_memory_page* page = 0; + impl::xml_memory_page* page = NULL; impl::xml_extra_buffer* extra = static_cast<impl::xml_extra_buffer*>(doc->allocate_memory(sizeof(impl::xml_extra_buffer) + sizeof(void*), page)); (void)page; @@ -6344,7 +6650,7 @@ #endif // add extra buffer to the list - extra->buffer = 0; + extra->buffer = NULL; extra->next = doc->extra_buffers; doc->extra_buffers = extra; @@ -6484,7 +6790,7 @@ xml_node arg_begin(_root); if (!walker.begin(arg_begin)) return false; - xml_node_struct* cur = _root ? _root->first_child + 0 : 0; + xml_node_struct* cur = _root ? _root->first_child + 0 : NULL; if (cur) { @@ -6526,7 +6832,7 @@ PUGI_IMPL_FN size_t xml_node::hash_value() const { - return static_cast<size_t>(reinterpret_cast<uintptr_t>(_root) / sizeof(xml_node_struct)); + return reinterpret_cast<uintptr_t>(_root) / sizeof(xml_node_struct); } PUGI_IMPL_FN xml_node_struct* xml_node::internal_object() const @@ -6546,14 +6852,14 @@ } #ifndef PUGIXML_NO_STL - PUGI_IMPL_FN void xml_node::print(std::basic_ostream<char, std::char_traits<char> >& stream, const char_t* indent, unsigned int flags, xml_encoding encoding, unsigned int depth) const + PUGI_IMPL_FN void xml_node::print(std::basic_ostream<char>& stream, const char_t* indent, unsigned int flags, xml_encoding encoding, unsigned int depth) const { xml_writer_stream writer(stream); print(writer, indent, flags, encoding, depth); } - PUGI_IMPL_FN void xml_node::print(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream, const char_t* indent, unsigned int flags, unsigned int depth) const + PUGI_IMPL_FN void xml_node::print(std::basic_ostream<wchar_t>& stream, const char_t* indent, unsigned int flags, unsigned int depth) const { xml_writer_stream writer(stream); @@ -6620,7 +6926,7 @@ if (impl::is_text_node(node)) return node; - return 0; + return NULL; } PUGI_IMPL_FN xml_node_struct* xml_text::_data_new() @@ -6631,7 +6937,7 @@ return xml_node(_root).append_child(node_pcdata).internal_object(); } - PUGI_IMPL_FN xml_text::xml_text(): _root(0) + PUGI_IMPL_FN xml_text::xml_text(): _root(NULL) { } @@ -6641,7 +6947,7 @@ PUGI_IMPL_FN xml_text::operator xml_text::unspecified_bool_type() const { - return _data() ? unspecified_bool_xml_text : 0; + return _data() ? unspecified_bool_xml_text : NULL; } PUGI_IMPL_FN bool xml_text::operator!() const @@ -6651,7 +6957,7 @@ PUGI_IMPL_FN bool xml_text::empty() const { - return _data() == 0; + return _data() == NULL; } PUGI_IMPL_FN const char_t* xml_text::get() const @@ -6742,6 +7048,15 @@ return dn ? impl::strcpy_insitu(dn->value, dn->header, impl::xml_memory_page_value_allocated_mask, rhs, size) : false; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN bool xml_text::set(string_view_t rhs) + { + xml_node_struct* dn = _data_new(); + + return dn ? impl::strcpy_insitu(dn->value, dn->header, impl::xml_memory_page_value_allocated_mask, rhs.data(), rhs.size()) : false; + } +#endif + PUGI_IMPL_FN bool xml_text::set(int rhs) { xml_node_struct* dn = _data_new(); @@ -6869,6 +7184,14 @@ return *this; } +#ifdef PUGIXML_HAS_STRING_VIEW + PUGI_IMPL_FN xml_text& xml_text::operator=(string_view_t rhs) + { + set(rhs); + return *this; + } +#endif + #ifdef PUGIXML_HAS_LONG_LONG PUGI_IMPL_FN xml_text& xml_text::operator=(long long rhs) { @@ -6931,7 +7254,7 @@ PUGI_IMPL_FN xml_node* xml_node_iterator::operator->() const { assert(_wrap._root); - return const_cast<xml_node*>(&_wrap); // BCC5 workaround + return &_wrap; } PUGI_IMPL_FN xml_node_iterator& xml_node_iterator::operator++() @@ -6992,7 +7315,7 @@ PUGI_IMPL_FN xml_attribute* xml_attribute_iterator::operator->() const { assert(_wrap._attr); - return const_cast<xml_attribute*>(&_wrap); // BCC5 workaround + return &_wrap; } PUGI_IMPL_FN xml_attribute_iterator& xml_attribute_iterator::operator++() @@ -7022,7 +7345,7 @@ return temp; } - PUGI_IMPL_FN xml_named_node_iterator::xml_named_node_iterator(): _name(0) + PUGI_IMPL_FN xml_named_node_iterator::xml_named_node_iterator(): _name(NULL) { } @@ -7053,7 +7376,7 @@ PUGI_IMPL_FN xml_node* xml_named_node_iterator::operator->() const { assert(_wrap._root); - return const_cast<xml_node*>(&_wrap); // BCC5 workaround + return &_wrap; } PUGI_IMPL_FN xml_named_node_iterator& xml_named_node_iterator::operator++() @@ -7132,7 +7455,7 @@ } } - PUGI_IMPL_FN xml_document::xml_document(): _buffer(0) + PUGI_IMPL_FN xml_document::xml_document(): _buffer(NULL) { _create(); } @@ -7143,7 +7466,7 @@ } #ifdef PUGIXML_HAS_MOVE - PUGI_IMPL_FN xml_document::xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT: _buffer(0) + PUGI_IMPL_FN xml_document::xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT: _buffer(NULL) { _create(); _move(rhs); @@ -7225,7 +7548,7 @@ if (_buffer) { impl::xml_memory::deallocate(_buffer); - _buffer = 0; + _buffer = NULL; } // destroy extra buffers (note: no need to destroy linked list nodes, they're allocated using document allocator) @@ -7253,7 +7576,7 @@ static_cast<impl::xml_document_struct*>(_root)->hash.clear(); #endif - _root = 0; + _root = NULL; } #ifdef PUGIXML_HAS_MOVE @@ -7308,7 +7631,7 @@ doc->_hash = &doc->hash; // make sure we don't access other hash up until the end when we reinitialize other document - other->_hash = 0; + other->_hash = NULL; #endif // move page structure @@ -7326,7 +7649,7 @@ page->prev = doc_page; doc_page->next = page; - other_page->next = 0; + other_page->next = NULL; } // make sure pages point to the correct document state @@ -7363,19 +7686,19 @@ // reset other document new (other) impl::xml_document_struct(PUGI_IMPL_GETPAGE(other)); - rhs._buffer = 0; + rhs._buffer = NULL; } #endif #ifndef PUGIXML_NO_STL - PUGI_IMPL_FN xml_parse_result xml_document::load(std::basic_istream<char, std::char_traits<char> >& stream, unsigned int options, xml_encoding encoding) + PUGI_IMPL_FN xml_parse_result xml_document::load(std::basic_istream<char>& stream, unsigned int options, xml_encoding encoding) { reset(); return impl::load_stream_impl(static_cast<impl::xml_document_struct*>(_root), stream, options, encoding, &_buffer); } - PUGI_IMPL_FN xml_parse_result xml_document::load(std::basic_istream<wchar_t, std::char_traits<wchar_t> >& stream, unsigned int options) + PUGI_IMPL_FN xml_parse_result xml_document::load(std::basic_istream<wchar_t>& stream, unsigned int options) { reset(); @@ -7445,7 +7768,7 @@ { impl::xml_buffered_writer buffered_writer(writer, encoding); - if ((flags & format_write_bom) && encoding != encoding_latin1) + if ((flags & format_write_bom) && buffered_writer.encoding != encoding_latin1) { // BOM always represents the codepoint U+FEFF, so just write it in native encoding #ifdef PUGIXML_WCHAR_MODE @@ -7459,7 +7782,7 @@ if (!(flags & format_no_declaration) && !impl::has_declaration(_root)) { buffered_writer.write_string(PUGIXML_TEXT("<?xml version=\"1.0\"")); - if (encoding == encoding_latin1) buffered_writer.write_string(PUGIXML_TEXT(" encoding=\"ISO-8859-1\"")); + if (buffered_writer.encoding == encoding_latin1) buffered_writer.write_string(PUGIXML_TEXT(" encoding=\"ISO-8859-1\"")); buffered_writer.write('?', '>'); if (!(flags & format_raw)) buffered_writer.write('\n'); } @@ -7470,14 +7793,14 @@ } #ifndef PUGIXML_NO_STL - PUGI_IMPL_FN void xml_document::save(std::basic_ostream<char, std::char_traits<char> >& stream, const char_t* indent, unsigned int flags, xml_encoding encoding) const + PUGI_IMPL_FN void xml_document::save(std::basic_ostream<char>& stream, const char_t* indent, unsigned int flags, xml_encoding encoding) const { xml_writer_stream writer(stream); save(writer, indent, flags, encoding); } - PUGI_IMPL_FN void xml_document::save(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream, const char_t* indent, unsigned int flags) const + PUGI_IMPL_FN void xml_document::save(std::basic_ostream<wchar_t>& stream, const char_t* indent, unsigned int flags) const { xml_writer_stream writer(stream); @@ -7790,7 +8113,7 @@ for (size_t probe = 0; probe <= hashmod; ++probe) { - if (table[bucket] == 0) + if (table[bucket] == NULL) { table[bucket] = key; return true; @@ -7838,7 +8161,7 @@ size_t _root_size; bool* _error; - xpath_allocator(xpath_memory_block* root, bool* error = 0): _root(root), _root_size(0), _error(error) + xpath_allocator(xpath_memory_block* root, bool* error = NULL): _root(root), _root_size(0), _error(error) { } @@ -7866,7 +8189,7 @@ if (!block) { if (_error) *_error = true; - return 0; + return NULL; } block->next = _root; @@ -7886,7 +8209,7 @@ new_size = (new_size + xpath_memory_block_alignment - 1) & ~(xpath_memory_block_alignment - 1); // we can only reallocate the last object - assert(ptr == 0 || static_cast<char*>(ptr) + old_size == &_root->data[0] + _root_size); + assert(ptr == NULL || static_cast<char*>(ptr) + old_size == &_root->data[0] + _root_size); // try to reallocate the object inplace if (ptr && _root_size - old_size + new_size <= _root->capacity) @@ -7897,7 +8220,7 @@ // allocate a new block void* result = allocate(new_size); - if (!result) return 0; + if (!result) return NULL; // we have a new block if (ptr) @@ -7992,7 +8315,7 @@ xpath_stack_data(): result(blocks + 0, &oom), temp(blocks + 1, &oom), oom(false) { - blocks[0].next = blocks[1].next = 0; + blocks[0].next = blocks[1].next = NULL; blocks[0].capacity = blocks[1].capacity = sizeof(blocks[0].data); stack.result = &result; @@ -8018,7 +8341,7 @@ static char_t* duplicate_string(const char_t* string, size_t length, xpath_allocator* alloc) { char_t* result = static_cast<char_t*>(alloc->allocate((length + 1) * sizeof(char_t))); - if (!result) return 0; + if (!result) return NULL; memcpy(result, string, length * sizeof(char_t)); result[length] = 0; @@ -8078,7 +8401,7 @@ size_t result_length = target_length + source_length; // allocate new buffer - char_t* result = static_cast<char_t*>(alloc->reallocate(_uses_heap ? const_cast<char_t*>(_buffer) : 0, (target_length + 1) * sizeof(char_t), (result_length + 1) * sizeof(char_t))); + char_t* result = static_cast<char_t*>(alloc->reallocate(_uses_heap ? const_cast<char_t*>(_buffer) : NULL, (target_length + 1) * sizeof(char_t), (result_length + 1) * sizeof(char_t))); if (!result) return; // append first string to the new buffer in case there was no reallocation @@ -8113,7 +8436,7 @@ size_t length_ = strlength(_buffer); const char_t* data_ = duplicate_string(_buffer, length_, alloc); - if (!data_) return 0; + if (!data_) return NULL; _buffer = data_; _uses_heap = true; @@ -8322,7 +8645,7 @@ if (node->value && (node->header & impl::xml_memory_page_value_allocated_or_shared_mask) == 0) return node->value; } - return 0; + return NULL; } xml_attribute_struct* attr = xnode.attribute().internal_object(); @@ -8335,10 +8658,10 @@ if ((attr->header & impl::xml_memory_page_value_allocated_or_shared_mask) == 0) return attr->value; } - return 0; + return NULL; } - return 0; + return NULL; } struct document_order_comparator @@ -8451,7 +8774,7 @@ if (v == 0) return PUGIXML_TEXT("0"); if (v != v) return PUGIXML_TEXT("NaN"); if (v * 2 == v) return value > 0 ? PUGIXML_TEXT("Infinity") : PUGIXML_TEXT("-Infinity"); - return 0; + return NULL; #endif } @@ -8616,9 +8939,9 @@ // parse string #ifdef PUGIXML_WCHAR_MODE - return wcstod(string, 0); + return wcstod(string, NULL); #else - return strtod(string, 0); + return strtod(string, NULL); #endif } @@ -8680,7 +9003,7 @@ { const char_t* pos = find_char(name, ':'); - prefix = pos ? name : 0; + prefix = pos ? name : NULL; prefix_length = pos ? static_cast<size_t>(pos - name) : 0; } @@ -8798,7 +9121,7 @@ unsigned int tc = static_cast<unsigned int>(*to); if (fc >= 128 || tc >= 128) - return 0; + return NULL; // code=128 means "skip character" if (!table[fc]) @@ -8813,7 +9136,7 @@ table[i] = static_cast<unsigned char>(i); void* result = alloc->allocate(sizeof(table)); - if (!result) return 0; + if (!result) return NULL; memcpy(result, table, sizeof(table)); @@ -8877,7 +9200,7 @@ struct xpath_variable_string: xpath_variable { - xpath_variable_string(): xpath_variable(xpath_type_string), value(0) + xpath_variable_string(): xpath_variable(xpath_type_string), value(NULL) { } @@ -8924,11 +9247,11 @@ template <typename T> PUGI_IMPL_FN T* new_xpath_variable(const char_t* name) { size_t length = strlength(name); - if (length == 0) return 0; // empty variable names are invalid + if (length == 0) return NULL; // empty variable names are invalid // $$ we can't use offsetof(T, name) because T is non-POD, so we just allocate additional length characters void* memory = xml_memory::allocate(sizeof(T) + length * sizeof(char_t)); - if (!memory) return 0; + if (!memory) return NULL; T* result = new (memory) T(); @@ -8954,7 +9277,7 @@ return new_xpath_variable<xpath_variable_boolean>(name); default: - return 0; + return NULL; } } @@ -9107,7 +9430,7 @@ xpath_node* _eos; public: - xpath_node_set_raw(): _type(xpath_node_set::type_unsorted), _begin(0), _end(0), _eos(0) + xpath_node_set_raw(): _type(xpath_node_set::type_unsorted), _begin(NULL), _end(NULL), _eos(NULL) { } @@ -9299,7 +9622,7 @@ const char_t* begin; const char_t* end; - xpath_lexer_string(): begin(0), end(0) + xpath_lexer_string(): begin(NULL), end(NULL) { } @@ -10487,40 +10810,40 @@ public: xpath_ast_node(ast_type_t type, xpath_value_type rettype_, const char_t* value): - _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(0), _right(0), _next(0) + _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(NULL), _right(NULL), _next(NULL) { assert(type == ast_string_constant); _data.string = value; } xpath_ast_node(ast_type_t type, xpath_value_type rettype_, double value): - _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(0), _right(0), _next(0) + _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(NULL), _right(NULL), _next(NULL) { assert(type == ast_number_constant); _data.number = value; } xpath_ast_node(ast_type_t type, xpath_value_type rettype_, xpath_variable* value): - _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(0), _right(0), _next(0) + _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(NULL), _right(NULL), _next(NULL) { assert(type == ast_variable); _data.variable = value; } - xpath_ast_node(ast_type_t type, xpath_value_type rettype_, xpath_ast_node* left = 0, xpath_ast_node* right = 0): - _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(left), _right(right), _next(0) + xpath_ast_node(ast_type_t type, xpath_value_type rettype_, xpath_ast_node* left = NULL, xpath_ast_node* right = NULL): + _type(static_cast<char>(type)), _rettype(static_cast<char>(rettype_)), _axis(0), _test(0), _left(left), _right(right), _next(NULL) { } xpath_ast_node(ast_type_t type, xpath_ast_node* left, axis_t axis, nodetest_t test, const char_t* contents): - _type(static_cast<char>(type)), _rettype(xpath_type_node_set), _axis(static_cast<char>(axis)), _test(static_cast<char>(test)), _left(left), _right(0), _next(0) + _type(static_cast<char>(type)), _rettype(xpath_type_node_set), _axis(static_cast<char>(axis)), _test(static_cast<char>(test)), _left(left), _right(NULL), _next(NULL) { assert(type == ast_step); _data.nodetest = contents; } xpath_ast_node(ast_type_t type, xpath_ast_node* left, xpath_ast_node* right, predicate_t test): - _type(static_cast<char>(type)), _rettype(xpath_type_node_set), _axis(0), _test(static_cast<char>(test)), _left(left), _right(right), _next(0) + _type(static_cast<char>(type)), _rettype(xpath_type_node_set), _axis(0), _test(static_cast<char>(test)), _left(left), _right(right), _next(NULL) { assert(type == ast_filter || type == ast_predicate); } @@ -10580,7 +10903,7 @@ xpath_string lr = _left->eval_string(c, stack); xpath_string rr = _right->eval_string(c, stack); - return find_substring(lr.c_str(), rr.c_str()) != 0; + return find_substring(lr.c_str(), rr.c_str()) != NULL; } case ast_func_boolean: @@ -11389,7 +11712,7 @@ _result->error = message; _result->offset = _lexer.current_pos() - _query; - return 0; + return NULL; } xpath_ast_node* error_oom() @@ -11397,7 +11720,7 @@ assert(_alloc->_error); *_alloc->_error = true; - return 0; + return NULL; } xpath_ast_node* error_rec() @@ -11413,37 +11736,37 @@ xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, const char_t* value) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, rettype, value) : 0; + return memory ? new (memory) xpath_ast_node(type, rettype, value) : NULL; } xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, double value) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, rettype, value) : 0; + return memory ? new (memory) xpath_ast_node(type, rettype, value) : NULL; } xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, xpath_variable* value) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, rettype, value) : 0; + return memory ? new (memory) xpath_ast_node(type, rettype, value) : NULL; } - xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, xpath_ast_node* left = 0, xpath_ast_node* right = 0) + xpath_ast_node* alloc_node(ast_type_t type, xpath_value_type rettype, xpath_ast_node* left = NULL, xpath_ast_node* right = NULL) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, rettype, left, right) : 0; + return memory ? new (memory) xpath_ast_node(type, rettype, left, right) : NULL; } xpath_ast_node* alloc_node(ast_type_t type, xpath_ast_node* left, axis_t axis, nodetest_t test, const char_t* contents) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, left, axis, test, contents) : 0; + return memory ? new (memory) xpath_ast_node(type, left, axis, test, contents) : NULL; } xpath_ast_node* alloc_node(ast_type_t type, xpath_ast_node* left, xpath_ast_node* right, predicate_t test) { void* memory = alloc_node(); - return memory ? new (memory) xpath_ast_node(type, left, right, test) : 0; + return memory ? new (memory) xpath_ast_node(type, left, right, test) : NULL; } const char_t* alloc_string(const xpath_lexer_string& value) @@ -11454,7 +11777,7 @@ size_t length = static_cast<size_t>(value.end - value.begin); char_t* c = static_cast<char_t*>(_alloc->allocate((length + 1) * sizeof(char_t))); - if (!c) return 0; + if (!c) return NULL; memcpy(c, value.begin, length * sizeof(char_t)); c[length] = 0; @@ -11697,7 +12020,7 @@ if (!_variables) return error("Unknown variable: variable set is not provided"); - xpath_variable* var = 0; + xpath_variable* var = NULL; if (!get_variable_scratch(_scratch, _variables, name.begin, name.end, &var)) return error_oom(); @@ -11714,7 +12037,7 @@ _lexer.next(); xpath_ast_node* n = parse_expression(); - if (!n) return 0; + if (!n) return NULL; if (_lexer.current() != lex_close_brace) return error("Expected ')' to match an opening '('"); @@ -11727,7 +12050,7 @@ case lex_quoted_string: { const char_t* value = alloc_string(_lexer.contents()); - if (!value) return 0; + if (!value) return NULL; _lexer.next(); @@ -11748,13 +12071,13 @@ case lex_string: { - xpath_ast_node* args[2] = {0}; + xpath_ast_node* args[2] = {NULL}; size_t argc = 0; xpath_lexer_string function = _lexer.contents(); _lexer.next(); - xpath_ast_node* last_arg = 0; + xpath_ast_node* last_arg = NULL; if (_lexer.current() != lex_open_brace) return error("Unrecognized function call");... [truncated message content] |
From: <sv...@op...> - 2025-02-15 16:52:50
|
Author: manx Date: Sat Feb 15 17:52:38 2025 New Revision: 22907 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22907 Log: Merged revision(s) 22889 from trunk/OpenMPT: [Ref] mpt/check/compiler.hpp: Detect missing exceptions support on MSVC. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/src/mpt/check/compiler.hpp Modified: branches/OpenMPT-1.31/src/mpt/check/compiler.hpp ============================================================================== --- branches/OpenMPT-1.31/src/mpt/check/compiler.hpp Sat Feb 15 17:47:49 2025 (r22906) +++ branches/OpenMPT-1.31/src/mpt/check/compiler.hpp Sat Feb 15 17:52:38 2025 (r22907) @@ -38,11 +38,15 @@ #endif #ifndef MPT_CHECK_CXX_IGNORE_WARNING_NO_EXCEPTIONS -#if MPT_COMPILER_GCC +#if MPT_COMPILER_MSVC +#if !defined(_CPPUNWIND) +MPT_WARNING("C++ compiler has no exception support.") +#endif +#elif MPT_COMPILER_GCC #if (!defined(__EXCEPTIONS) || (__EXCEPTIONS != 1)) MPT_WARNING("C++ compiler has no exception support.") #endif -#elif MPT_COMPILER_CLANG && !defined(_MSC_VER) +#elif MPT_COMPILER_CLANG #if (!defined(__EXCEPTIONS) || (__EXCEPTIONS != 1)) MPT_WARNING("C++ compiler has no exception support.") #endif |
From: <sv...@op...> - 2025-02-15 16:48:02
|
Author: manx Date: Sat Feb 15 17:47:49 2025 New Revision: 22906 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22906 Log: [Ref] Rewrite default ModInstrument handling to use the ultimately desired implementation for modern toolchains automatically, and apply appropriate work-arounds for other situations: We want constexpr ModInstrument{} due to bad code generation with temporary objects mostly in MSVC, however most stdlib implementations of C++20 fail to provide constexpr std::vector in C++20 mode, which is required for the envelopes. Thus we only activate that for C++23. For libopenmpt, this code path is only required for test suite, and inefficient code generation does not really matter. Modified: trunk/OpenMPT/soundlib/InstrumentExtensions.cpp Modified: trunk/OpenMPT/soundlib/InstrumentExtensions.cpp ============================================================================== --- trunk/OpenMPT/soundlib/InstrumentExtensions.cpp Sat Feb 15 17:39:56 2025 (r22905) +++ trunk/OpenMPT/soundlib/InstrumentExtensions.cpp Sat Feb 15 17:47:49 2025 (r22906) @@ -136,21 +136,32 @@ #ifndef MODPLUG_NO_FILESAVE -namespace -{ + +// We want constexpr ModInstrument{} due to bad code generation with temporary objects mostly in MSVC, +// however most stdlib implementations of C++20 fail to provide constexpr std::vector in C++20 mode, +// which is required for the envelopes. Thus we only activate that for C++23. +// For libopenmpt, this code path is only required for test suite, +// and inefficient code generation does not really matter. +#if MPT_CXX_AT_LEAST(23) || (MPT_CXX_AT_LEAST(20) && !defined(MPT_LIBCXX_QUIRK_NO_CXX20_CONSTEXPR_CONTAINER)) +#define MODINSTRUMENT_DEFAULT MPT_FORCE_CONSTEXPR_VALUE(ModInstrument{}) +#elif defined(LIBOPENMPT_BUILD) +#define MODINSTRUMENT_DEFAULT ModInstrument{} +#else #if MPT_COMPILER_CLANG #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wglobal-constructors" #pragma clang diagnostic ignored "-Wexit-time-destructors" #endif // MPT_COMPILER_CLANG - const ModInstrument DEFAULT_INSTRUMENT; +static MPT_CONSTEXPR20_CONTAINER_VAR ModInstrument ModInstrumentDefault; #if MPT_COMPILER_CLANG #pragma clang diagnostic pop #endif // MPT_COMPILER_CLANG -} // namespace +#define MODINSTRUMENT_DEFAULT ModInstrumentDefault +#endif + template <auto Member> -constexpr bool IsPropertyNonDefault(const ModInstrument &ins) { return DEFAULT_INSTRUMENT.*Member != ins.*Member; } +inline bool IsPropertyNonDefault(const ModInstrument &ins) { return MODINSTRUMENT_DEFAULT.*Member != ins.*Member; } template <auto Member> constexpr uint16 PropertySize() noexcept { return sizeof(ModInstrument{}.*Member); } @@ -187,7 +198,7 @@ struct PropertyWriterReleaseNode { - bool IsPropertyNeeded(const ModInstrument &ins) const noexcept { return DEFAULT_INSTRUMENT.GetEnvelope(type).nReleaseNode != ins.GetEnvelope(type).nReleaseNode; } + bool IsPropertyNeeded(const ModInstrument &ins) const noexcept { return MODINSTRUMENT_DEFAULT.GetEnvelope(type).nReleaseNode != ins.GetEnvelope(type).nReleaseNode; } static constexpr uint16 Size() noexcept { return sizeof(InstrumentEnvelope{}.nReleaseNode); } void Write(std::ostream &file, const ModInstrument &ins) const { mpt::IO::WriteIntLE(file, ins.GetEnvelope(type).nReleaseNode); } const EnvelopeType type; @@ -284,7 +295,7 @@ mpt::IO::WriteIntLE<uint16>(f, property.Size()); for(const ModInstrument *ins : instruments) { - property.Write(f, ins ? *ins : DEFAULT_INSTRUMENT); + property.Write(f, ins ? *ins : MODINSTRUMENT_DEFAULT); } } @@ -373,6 +384,9 @@ } +#undef MODINSTRUMENT_DEFAULT + + #endif // !MODPLUG_NO_FILESAVE |
From: <sv...@op...> - 2025-02-15 16:40:09
|
Author: manx Date: Sat Feb 15 17:39:56 2025 New Revision: 22905 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22905 Log: Merged revision(s) 22904 from trunk/OpenMPT: [Mod] build: CI: GitHub: Update NetBSD 10 to 10.1. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/.github/workflows/NetBSD-Autotools.yml branches/OpenMPT-1.31/.github/workflows/NetBSD-Makefile.yml Modified: branches/OpenMPT-1.31/.github/workflows/NetBSD-Autotools.yml ============================================================================== --- branches/OpenMPT-1.31/.github/workflows/NetBSD-Autotools.yml Sat Feb 15 17:38:52 2025 (r22904) +++ branches/OpenMPT-1.31/.github/workflows/NetBSD-Autotools.yml Sat Feb 15 17:39:56 2025 (r22905) @@ -11,7 +11,7 @@ fail-fast: false matrix: include: - - { version: '10.0' } + - { version: '10.1' } - { version: '9.4' } concurrency: Modified: branches/OpenMPT-1.31/.github/workflows/NetBSD-Makefile.yml ============================================================================== --- branches/OpenMPT-1.31/.github/workflows/NetBSD-Makefile.yml Sat Feb 15 17:38:52 2025 (r22904) +++ branches/OpenMPT-1.31/.github/workflows/NetBSD-Makefile.yml Sat Feb 15 17:39:56 2025 (r22905) @@ -11,9 +11,9 @@ fail-fast: false matrix: include: - - { version: '10.0', deps: sys } - - { version: '10.0', deps: local } - - { version: '10.0', deps: small } + - { version: '10.1', deps: sys } + - { version: '10.1', deps: local } + - { version: '10.1', deps: small } - { version: '9.4' , deps: sys } - { version: '9.4' , deps: local } - { version: '9.4' , deps: small } |
From: <sv...@op...> - 2025-02-15 16:39:01
|
Author: manx Date: Sat Feb 15 17:38:52 2025 New Revision: 22904 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22904 Log: [Mod] build: CI: GitHub: Update NetBSD 10 to 10.1. Modified: trunk/OpenMPT/.github/workflows/NetBSD-Autotools.yml trunk/OpenMPT/.github/workflows/NetBSD-Makefile.yml Modified: trunk/OpenMPT/.github/workflows/NetBSD-Autotools.yml ============================================================================== --- trunk/OpenMPT/.github/workflows/NetBSD-Autotools.yml Sat Feb 15 17:36:28 2025 (r22903) +++ trunk/OpenMPT/.github/workflows/NetBSD-Autotools.yml Sat Feb 15 17:38:52 2025 (r22904) @@ -13,7 +13,7 @@ fail-fast: false matrix: include: - - { version: '10.0' } + - { version: '10.1' } - { version: '9.4' } concurrency: Modified: trunk/OpenMPT/.github/workflows/NetBSD-Makefile.yml ============================================================================== --- trunk/OpenMPT/.github/workflows/NetBSD-Makefile.yml Sat Feb 15 17:36:28 2025 (r22903) +++ trunk/OpenMPT/.github/workflows/NetBSD-Makefile.yml Sat Feb 15 17:38:52 2025 (r22904) @@ -13,9 +13,9 @@ fail-fast: false matrix: include: - - { version: '10.0', deps: sys } - - { version: '10.0', deps: local } - - { version: '10.0', deps: small } + - { version: '10.1', deps: sys } + - { version: '10.1', deps: local } + - { version: '10.1', deps: small } - { version: '9.4' , deps: sys } - { version: '9.4' , deps: local } - { version: '9.4' , deps: small } |
From: <sv...@op...> - 2025-02-15 16:36:41
|
Author: manx Date: Sat Feb 15 17:36:28 2025 New Revision: 22903 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22903 Log: Merged revision(s) 22902 from branches/OpenMPT-1.29: Merged revision(s) 22901 from branches/OpenMPT-1.30: Merged revision(s) 22899 from trunk/OpenMPT: [Var] build: CI: GitHub: CPA: Update to 0.27.0. ........ ........ ........ Modified: branches/OpenMPT-1.28/ (props changed) branches/OpenMPT-1.28/.github/workflows/FreeBSD-13.4-Makefile.yml Modified: branches/OpenMPT-1.28/.github/workflows/FreeBSD-13.4-Makefile.yml ============================================================================== --- branches/OpenMPT-1.28/.github/workflows/FreeBSD-13.4-Makefile.yml Sat Feb 15 17:36:01 2025 (r22902) +++ branches/OpenMPT-1.28/.github/workflows/FreeBSD-13.4-Makefile.yml Sat Feb 15 17:36:28 2025 (r22903) @@ -17,7 +17,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -28,7 +28,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -41,7 +41,7 @@ sudo pkg upgrade -y sudo pkg install -y subversion p5-XML-XPath git mawk gmake pkgconf autoconf autoconf-archive automake libtool help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio sdl2 - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -53,7 +53,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 - name: Test - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -65,7 +65,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 check - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G |
From: <sv...@op...> - 2025-02-15 16:36:12
|
Author: manx Date: Sat Feb 15 17:36:01 2025 New Revision: 22902 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22902 Log: Merged revision(s) 22901 from branches/OpenMPT-1.30: Merged revision(s) 22899 from trunk/OpenMPT: [Var] build: CI: GitHub: CPA: Update to 0.27.0. ........ ........ Modified: branches/OpenMPT-1.29/ (props changed) branches/OpenMPT-1.29/.github/workflows/FreeBSD-13.4-Makefile.yml Modified: branches/OpenMPT-1.29/.github/workflows/FreeBSD-13.4-Makefile.yml ============================================================================== --- branches/OpenMPT-1.29/.github/workflows/FreeBSD-13.4-Makefile.yml Sat Feb 15 17:34:56 2025 (r22901) +++ branches/OpenMPT-1.29/.github/workflows/FreeBSD-13.4-Makefile.yml Sat Feb 15 17:36:01 2025 (r22902) @@ -17,7 +17,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -28,7 +28,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -41,7 +41,7 @@ sudo pkg upgrade -y sudo pkg install -y subversion p5-XML-XPath git mawk gmake pkgconf autoconf autoconf-archive automake libtool help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio sdl2 - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -53,7 +53,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 - name: Test - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -65,7 +65,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 check - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G |
From: <sv...@op...> - 2025-02-15 16:35:08
|
Author: manx Date: Sat Feb 15 17:34:56 2025 New Revision: 22901 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22901 Log: Merged revision(s) 22899 from trunk/OpenMPT: [Var] build: CI: GitHub: CPA: Update to 0.27.0. ........ Modified: branches/OpenMPT-1.30/ (props changed) branches/OpenMPT-1.30/.github/workflows/FreeBSD-13.4-Makefile.yml branches/OpenMPT-1.30/.github/workflows/FreeBSD-14.2-Makefile.yml branches/OpenMPT-1.30/.github/workflows/OpenBSD-7.4-Makefile.yml branches/OpenMPT-1.30/.github/workflows/OpenBSD-7.5-Makefile.yml Modified: branches/OpenMPT-1.30/.github/workflows/FreeBSD-13.4-Makefile.yml ============================================================================== --- branches/OpenMPT-1.30/.github/workflows/FreeBSD-13.4-Makefile.yml Sat Feb 15 17:33:25 2025 (r22900) +++ branches/OpenMPT-1.30/.github/workflows/FreeBSD-13.4-Makefile.yml Sat Feb 15 17:34:56 2025 (r22901) @@ -17,7 +17,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -28,7 +28,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -41,7 +41,7 @@ sudo pkg upgrade -y sudo pkg install -y subversion p5-XML-XPath git mawk gmake pkgconf autoconf autoconf-archive automake libtool help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio sdl2 - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -53,7 +53,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 - name: Test - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -65,7 +65,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 check - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G Modified: branches/OpenMPT-1.30/.github/workflows/FreeBSD-14.2-Makefile.yml ============================================================================== --- branches/OpenMPT-1.30/.github/workflows/FreeBSD-14.2-Makefile.yml Sat Feb 15 17:33:25 2025 (r22900) +++ branches/OpenMPT-1.30/.github/workflows/FreeBSD-14.2-Makefile.yml Sat Feb 15 17:34:56 2025 (r22901) @@ -17,7 +17,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -28,7 +28,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -41,7 +41,7 @@ sudo pkg upgrade -y sudo pkg install -y subversion p5-XML-XPath git mawk gmake pkgconf autoconf autoconf-archive automake libtool help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio sdl2 - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -53,7 +53,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 - name: Test - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -65,7 +65,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 check - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G Modified: branches/OpenMPT-1.30/.github/workflows/OpenBSD-7.4-Makefile.yml ============================================================================== --- branches/OpenMPT-1.30/.github/workflows/OpenBSD-7.4-Makefile.yml Sat Feb 15 17:33:25 2025 (r22900) +++ branches/OpenMPT-1.30/.github/workflows/OpenBSD-7.4-Makefile.yml Sat Feb 15 17:34:56 2025 (r22901) @@ -17,7 +17,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -28,7 +28,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -43,7 +43,7 @@ sudo pkg_add -I autoconf-2.71 automake-1.16.5 sudo pkg_add -I subversion p5-XML-XPath git mawk gmake pkgconf autoconf-archive libtool libltdl help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio-svn sdl2 - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -55,7 +55,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 - name: Test - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -67,7 +67,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 check - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G Modified: branches/OpenMPT-1.30/.github/workflows/OpenBSD-7.5-Makefile.yml ============================================================================== --- branches/OpenMPT-1.30/.github/workflows/OpenBSD-7.5-Makefile.yml Sat Feb 15 17:33:25 2025 (r22900) +++ branches/OpenMPT-1.30/.github/workflows/OpenBSD-7.5-Makefile.yml Sat Feb 15 17:34:56 2025 (r22901) @@ -17,7 +17,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -28,7 +28,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -43,7 +43,7 @@ sudo pkg_add -I autoconf-2.71 automake-1.16.5 sudo pkg_add -I subversion p5-XML-XPath git mawk gmake pkgconf autoconf-archive libtool libltdl help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio-svn sdl2 - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -55,7 +55,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 - name: Test - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -67,7 +67,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 AUTO_DEPS=1 check - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G |
From: <sv...@op...> - 2025-02-15 16:33:37
|
Author: manx Date: Sat Feb 15 17:33:25 2025 New Revision: 22900 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22900 Log: Merged revision(s) 22899 from trunk/OpenMPT: [Var] build: CI: GitHub: CPA: Update to 0.27.0. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/.github/workflows/FreeBSD-Autotools.yml branches/OpenMPT-1.31/.github/workflows/FreeBSD-Makefile.yml branches/OpenMPT-1.31/.github/workflows/NetBSD-Autotools.yml branches/OpenMPT-1.31/.github/workflows/NetBSD-Makefile.yml branches/OpenMPT-1.31/.github/workflows/OpenBSD-Autotools.yml branches/OpenMPT-1.31/.github/workflows/OpenBSD-Makefile.yml Modified: branches/OpenMPT-1.31/.github/workflows/FreeBSD-Autotools.yml ============================================================================== --- branches/OpenMPT-1.31/.github/workflows/FreeBSD-Autotools.yml Sat Feb 15 17:32:38 2025 (r22899) +++ branches/OpenMPT-1.31/.github/workflows/FreeBSD-Autotools.yml Sat Feb 15 17:33:25 2025 (r22900) @@ -24,7 +24,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -35,7 +35,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -48,7 +48,7 @@ sudo pkg upgrade -y sudo pkg install -y subversion p5-XML-XPath git mawk gmake pkgconf autoconf autoconf-archive automake libtool help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio sdl2 - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -60,7 +60,7 @@ run: | export MAKEFLAGS="-j$(sysctl -n hw.ncpu)"; ./build/autotools/autoconfiscate.sh - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G Modified: branches/OpenMPT-1.31/.github/workflows/FreeBSD-Makefile.yml ============================================================================== --- branches/OpenMPT-1.31/.github/workflows/FreeBSD-Makefile.yml Sat Feb 15 17:32:38 2025 (r22899) +++ branches/OpenMPT-1.31/.github/workflows/FreeBSD-Makefile.yml Sat Feb 15 17:33:25 2025 (r22900) @@ -28,7 +28,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -39,7 +39,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -52,7 +52,7 @@ sudo pkg upgrade -y sudo pkg install -y subversion p5-XML-XPath git mawk gmake pkgconf autoconf autoconf-archive automake libtool help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio sdl2 - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -64,7 +64,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 ${{ (matrix.deps == 'sys') && 'AUTO_DEPS=1' || (matrix.deps == 'local') && 'LOCAL_ZLIB=1 LOCAL_MPG123=1 LOCAL_OGG=1 LOCAL_VORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' || 'NO_ZLIB=1 NO_MPG123=1 NO_OGG=1 NO_VORBIS=1 NO_VORBISFILE=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' }} - name: Test - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -76,7 +76,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 ${{ (matrix.deps == 'sys') && 'AUTO_DEPS=1' || (matrix.deps == 'local') && 'LOCAL_ZLIB=1 LOCAL_MPG123=1 LOCAL_OGG=1 LOCAL_VORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' || 'NO_ZLIB=1 NO_MPG123=1 NO_OGG=1 NO_VORBIS=1 NO_VORBISFILE=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' }} check - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G Modified: branches/OpenMPT-1.31/.github/workflows/NetBSD-Autotools.yml ============================================================================== --- branches/OpenMPT-1.31/.github/workflows/NetBSD-Autotools.yml Sat Feb 15 17:32:38 2025 (r22899) +++ branches/OpenMPT-1.31/.github/workflows/NetBSD-Autotools.yml Sat Feb 15 17:33:25 2025 (r22900) @@ -24,7 +24,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -35,7 +35,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -53,7 +53,7 @@ sudo pkgin -y install autoconf autoconf-archive automake libtool libltdl sudo pkgin -y install doxygen help2man - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -65,7 +65,7 @@ run: | export MAKEFLAGS="-j4"; ./build/autotools/autoconfiscate.sh - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G Modified: branches/OpenMPT-1.31/.github/workflows/NetBSD-Makefile.yml ============================================================================== --- branches/OpenMPT-1.31/.github/workflows/NetBSD-Makefile.yml Sat Feb 15 17:32:38 2025 (r22899) +++ branches/OpenMPT-1.31/.github/workflows/NetBSD-Makefile.yml Sat Feb 15 17:33:25 2025 (r22900) @@ -28,7 +28,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -39,7 +39,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -57,7 +57,7 @@ sudo pkgin -y install autoconf autoconf-archive automake libtool libltdl sudo pkgin -y install doxygen help2man - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -69,7 +69,7 @@ run: | gmake -j4 STRICT=1 VERBOSE=1 ${{ (matrix.deps == 'sys') && 'AUTO_DEPS=1' || (matrix.deps == 'local') && 'LOCAL_ZLIB=1 LOCAL_MPG123=1 LOCAL_OGG=1 LOCAL_VORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' || 'NO_ZLIB=1 NO_MPG123=1 NO_OGG=1 NO_VORBIS=1 NO_VORBISFILE=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' }} - name: Test - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -81,7 +81,7 @@ run: | gmake -j4 STRICT=1 VERBOSE=1 ${{ (matrix.deps == 'sys') && 'AUTO_DEPS=1' || (matrix.deps == 'local') && 'LOCAL_ZLIB=1 LOCAL_MPG123=1 LOCAL_OGG=1 LOCAL_VORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' || 'NO_ZLIB=1 NO_MPG123=1 NO_OGG=1 NO_VORBIS=1 NO_VORBISFILE=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' }} check - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G Modified: branches/OpenMPT-1.31/.github/workflows/OpenBSD-Autotools.yml ============================================================================== --- branches/OpenMPT-1.31/.github/workflows/OpenBSD-Autotools.yml Sat Feb 15 17:32:38 2025 (r22899) +++ branches/OpenMPT-1.31/.github/workflows/OpenBSD-Autotools.yml Sat Feb 15 17:33:25 2025 (r22900) @@ -25,7 +25,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -36,7 +36,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -51,7 +51,7 @@ sudo pkg_add -I ${{ (matrix.version == '7.6') && 'autoconf-2.72p0 automake-1.16.5' || (matrix.version == '7.5') && 'autoconf-2.71 automake-1.16.5' || (matrix.version == '7.4') && 'autoconf-2.71 automake-1.16.5' || 'autoconf automake' }} sudo pkg_add -I subversion p5-XML-XPath git mawk gmake pkgconf autoconf-archive libtool libltdl help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio-svn sdl2 - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -63,7 +63,7 @@ run: | export MAKEFLAGS="-j$(sysctl -n hw.ncpu)"; ${{ (matrix.version == '7.6') && 'export AUTOCONF_VERSION=2.72' || (matrix.version == '7.5') && 'export AUTOCONF_VERSION=2.71' || (matrix.version == '7.4') && 'export AUTOCONF_VERSION=2.71' || '' }} ; ${{ (matrix.version == '7.6') && 'export AUTOMAKE_VERSION=1.16' || (matrix.version == '7.5') && 'export AUTOMAKE_VERSION=1.16' || (matrix.version == '7.4') && 'export AUTOMAKE_VERSION=1.16' || '' }} ;./build/autotools/autoconfiscate.sh - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G Modified: branches/OpenMPT-1.31/.github/workflows/OpenBSD-Makefile.yml ============================================================================== --- branches/OpenMPT-1.31/.github/workflows/OpenBSD-Makefile.yml Sat Feb 15 17:32:38 2025 (r22899) +++ branches/OpenMPT-1.31/.github/workflows/OpenBSD-Makefile.yml Sat Feb 15 17:33:25 2025 (r22900) @@ -31,7 +31,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -42,7 +42,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -57,7 +57,7 @@ sudo pkg_add -I ${{ (matrix.version == '7.6') && 'autoconf-2.72p0 automake-1.16.5' || (matrix.version == '7.5') && 'autoconf-2.71 automake-1.16.5' || (matrix.version == '7.4') && 'autoconf-2.71 automake-1.16.5' || 'autoconf automake' }} sudo pkg_add -I subversion p5-XML-XPath git mawk gmake pkgconf autoconf-archive libtool libltdl help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio-svn sdl2 - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -69,7 +69,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 ${{ (matrix.deps == 'sys') && 'AUTO_DEPS=1' || (matrix.deps == 'local') && 'LOCAL_ZLIB=1 LOCAL_MPG123=1 LOCAL_OGG=1 LOCAL_VORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' || 'NO_ZLIB=1 NO_MPG123=1 NO_OGG=1 NO_VORBIS=1 NO_VORBISFILE=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' }} - name: Test - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -81,7 +81,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 ${{ (matrix.deps == 'sys') && 'AUTO_DEPS=1' || (matrix.deps == 'local') && 'LOCAL_ZLIB=1 LOCAL_MPG123=1 LOCAL_OGG=1 LOCAL_VORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' || 'NO_ZLIB=1 NO_MPG123=1 NO_OGG=1 NO_VORBIS=1 NO_VORBISFILE=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' }} check - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G |
From: <sv...@op...> - 2025-02-15 16:32:46
|
Author: manx Date: Sat Feb 15 17:32:38 2025 New Revision: 22899 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22899 Log: [Var] build: CI: GitHub: CPA: Update to 0.27.0. Modified: trunk/OpenMPT/.github/workflows/FreeBSD-Autotools.yml trunk/OpenMPT/.github/workflows/FreeBSD-Makefile.yml trunk/OpenMPT/.github/workflows/NetBSD-Autotools.yml trunk/OpenMPT/.github/workflows/NetBSD-Makefile.yml trunk/OpenMPT/.github/workflows/OpenBSD-Autotools.yml trunk/OpenMPT/.github/workflows/OpenBSD-Makefile.yml Modified: trunk/OpenMPT/.github/workflows/FreeBSD-Autotools.yml ============================================================================== --- trunk/OpenMPT/.github/workflows/FreeBSD-Autotools.yml Sat Feb 15 17:29:14 2025 (r22898) +++ trunk/OpenMPT/.github/workflows/FreeBSD-Autotools.yml Sat Feb 15 17:32:38 2025 (r22899) @@ -26,7 +26,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -37,7 +37,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -50,7 +50,7 @@ sudo pkg upgrade -y sudo pkg install -y subversion p5-XML-XPath git mawk gmake pkgconf autoconf autoconf-archive automake libtool help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio sdl2 - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -62,7 +62,7 @@ run: | export MAKEFLAGS="-j$(sysctl -n hw.ncpu)"; ./build/autotools/autoconfiscate.sh - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G Modified: trunk/OpenMPT/.github/workflows/FreeBSD-Makefile.yml ============================================================================== --- trunk/OpenMPT/.github/workflows/FreeBSD-Makefile.yml Sat Feb 15 17:29:14 2025 (r22898) +++ trunk/OpenMPT/.github/workflows/FreeBSD-Makefile.yml Sat Feb 15 17:32:38 2025 (r22899) @@ -30,7 +30,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -41,7 +41,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -54,7 +54,7 @@ sudo pkg upgrade -y sudo pkg install -y subversion p5-XML-XPath git mawk gmake pkgconf autoconf autoconf-archive automake libtool help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio sdl2 - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -66,7 +66,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 ${{ (matrix.deps == 'sys') && 'AUTO_DEPS=1' || (matrix.deps == 'local') && 'LOCAL_ZLIB=1 LOCAL_MPG123=1 LOCAL_OGG=1 LOCAL_VORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' || 'NO_ZLIB=1 NO_MPG123=1 NO_OGG=1 NO_VORBIS=1 NO_VORBISFILE=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' }} - name: Test - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -78,7 +78,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 ${{ (matrix.deps == 'sys') && 'AUTO_DEPS=1' || (matrix.deps == 'local') && 'LOCAL_ZLIB=1 LOCAL_MPG123=1 LOCAL_OGG=1 LOCAL_VORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' || 'NO_ZLIB=1 NO_MPG123=1 NO_OGG=1 NO_VORBIS=1 NO_VORBISFILE=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' }} check - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G Modified: trunk/OpenMPT/.github/workflows/NetBSD-Autotools.yml ============================================================================== --- trunk/OpenMPT/.github/workflows/NetBSD-Autotools.yml Sat Feb 15 17:29:14 2025 (r22898) +++ trunk/OpenMPT/.github/workflows/NetBSD-Autotools.yml Sat Feb 15 17:32:38 2025 (r22899) @@ -26,7 +26,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -37,7 +37,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -55,7 +55,7 @@ sudo pkgin -y install autoconf autoconf-archive automake libtool libltdl sudo pkgin -y install doxygen help2man - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -67,7 +67,7 @@ run: | export MAKEFLAGS="-j4"; ./build/autotools/autoconfiscate.sh - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G Modified: trunk/OpenMPT/.github/workflows/NetBSD-Makefile.yml ============================================================================== --- trunk/OpenMPT/.github/workflows/NetBSD-Makefile.yml Sat Feb 15 17:29:14 2025 (r22898) +++ trunk/OpenMPT/.github/workflows/NetBSD-Makefile.yml Sat Feb 15 17:32:38 2025 (r22899) @@ -30,7 +30,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -41,7 +41,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -59,7 +59,7 @@ sudo pkgin -y install autoconf autoconf-archive automake libtool libltdl sudo pkgin -y install doxygen help2man - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -71,7 +71,7 @@ run: | gmake -j4 STRICT=1 VERBOSE=1 ${{ (matrix.deps == 'sys') && 'AUTO_DEPS=1' || (matrix.deps == 'local') && 'LOCAL_ZLIB=1 LOCAL_MPG123=1 LOCAL_OGG=1 LOCAL_VORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' || 'NO_ZLIB=1 NO_MPG123=1 NO_OGG=1 NO_VORBIS=1 NO_VORBISFILE=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' }} - name: Test - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -83,7 +83,7 @@ run: | gmake -j4 STRICT=1 VERBOSE=1 ${{ (matrix.deps == 'sys') && 'AUTO_DEPS=1' || (matrix.deps == 'local') && 'LOCAL_ZLIB=1 LOCAL_MPG123=1 LOCAL_OGG=1 LOCAL_VORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' || 'NO_ZLIB=1 NO_MPG123=1 NO_OGG=1 NO_VORBIS=1 NO_VORBISFILE=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' }} check - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G Modified: trunk/OpenMPT/.github/workflows/OpenBSD-Autotools.yml ============================================================================== --- trunk/OpenMPT/.github/workflows/OpenBSD-Autotools.yml Sat Feb 15 17:29:14 2025 (r22898) +++ trunk/OpenMPT/.github/workflows/OpenBSD-Autotools.yml Sat Feb 15 17:32:38 2025 (r22899) @@ -27,7 +27,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -38,7 +38,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -53,7 +53,7 @@ sudo pkg_add -I ${{ (matrix.version == '7.6') && 'autoconf-2.72p0 automake-1.16.5' || (matrix.version == '7.5') && 'autoconf-2.71 automake-1.16.5' || (matrix.version == '7.4') && 'autoconf-2.71 automake-1.16.5' || 'autoconf automake' }} sudo pkg_add -I subversion p5-XML-XPath git mawk gmake pkgconf autoconf-archive libtool libltdl help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio-svn sdl2 - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -65,7 +65,7 @@ run: | export MAKEFLAGS="-j$(sysctl -n hw.ncpu)"; ${{ (matrix.version == '7.6') && 'export AUTOCONF_VERSION=2.72' || (matrix.version == '7.5') && 'export AUTOCONF_VERSION=2.71' || (matrix.version == '7.4') && 'export AUTOCONF_VERSION=2.71' || '' }} ; ${{ (matrix.version == '7.6') && 'export AUTOMAKE_VERSION=1.16' || (matrix.version == '7.5') && 'export AUTOMAKE_VERSION=1.16' || (matrix.version == '7.4') && 'export AUTOMAKE_VERSION=1.16' || '' }} ;./build/autotools/autoconfiscate.sh - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G Modified: trunk/OpenMPT/.github/workflows/OpenBSD-Makefile.yml ============================================================================== --- trunk/OpenMPT/.github/workflows/OpenBSD-Makefile.yml Sat Feb 15 17:29:14 2025 (r22898) +++ trunk/OpenMPT/.github/workflows/OpenBSD-Makefile.yml Sat Feb 15 17:32:38 2025 (r22899) @@ -33,7 +33,7 @@ - name: Checkout uses: actions/checkout@v4 - name: Startup VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -44,7 +44,7 @@ shutdown_vm: false run: true - name: Install dependencies - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -59,7 +59,7 @@ sudo pkg_add -I ${{ (matrix.version == '7.6') && 'autoconf-2.72p0 automake-1.16.5' || (matrix.version == '7.5') && 'autoconf-2.71 automake-1.16.5' || (matrix.version == '7.4') && 'autoconf-2.71 automake-1.16.5' || 'autoconf automake' }} sudo pkg_add -I subversion p5-XML-XPath git mawk gmake pkgconf autoconf-archive libtool libltdl help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio-svn sdl2 - name: Build - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -71,7 +71,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 ${{ (matrix.deps == 'sys') && 'AUTO_DEPS=1' || (matrix.deps == 'local') && 'LOCAL_ZLIB=1 LOCAL_MPG123=1 LOCAL_OGG=1 LOCAL_VORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' || 'NO_ZLIB=1 NO_MPG123=1 NO_OGG=1 NO_VORBIS=1 NO_VORBISFILE=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' }} - name: Test - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G @@ -83,7 +83,7 @@ run: | gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 ${{ (matrix.deps == 'sys') && 'AUTO_DEPS=1' || (matrix.deps == 'local') && 'LOCAL_ZLIB=1 LOCAL_MPG123=1 LOCAL_OGG=1 LOCAL_VORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' || 'NO_ZLIB=1 NO_MPG123=1 NO_OGG=1 NO_VORBIS=1 NO_VORBISFILE=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' }} check - name: Shutdown VM - uses: cross-platform-actions/action@v0.26.0 + uses: cross-platform-actions/action@v0.27.0 with: architecture: x86_64 memory: 4G |
From: <sv...@op...> - 2025-02-15 16:29:26
|
Author: manx Date: Sat Feb 15 17:29:14 2025 New Revision: 22898 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22898 Log: [Fix] libopenmpt: r22885 removed a required header. Modified: trunk/OpenMPT/libopenmpt/libopenmpt_c.cpp Modified: trunk/OpenMPT/libopenmpt/libopenmpt_c.cpp ============================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_c.cpp Sat Feb 15 17:26:27 2025 (r22897) +++ trunk/OpenMPT/libopenmpt/libopenmpt_c.cpp Sat Feb 15 17:29:14 2025 (r22898) @@ -28,6 +28,7 @@ #include <cmath> #include <cstdio> #include <cstdlib> +#include <cstring> #if defined(_MSC_VER) #pragma warning(disable:4702) /* unreachable code */ |
From: <sv...@op...> - 2025-02-15 16:26:43
|
Author: manx Date: Sat Feb 15 17:26:27 2025 New Revision: 22897 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22897 Log: Partial merge of r22895. Merged revision(s) 22895 from trunk/OpenMPT: [Fix] libmodplug-0.8.8.5: Fix typo in linker option --no-undefined. ........ Modified: branches/OpenMPT-1.28/ (props changed) branches/OpenMPT-1.28/build/autotools/Makefile.am Modified: branches/OpenMPT-1.28/build/autotools/Makefile.am ============================================================================== --- branches/OpenMPT-1.28/build/autotools/Makefile.am Sat Feb 15 17:24:49 2025 (r22896) +++ branches/OpenMPT-1.28/build/autotools/Makefile.am Sat Feb 15 17:26:27 2025 (r22897) @@ -402,7 +402,7 @@ if ENABLE_LIBOPENMPT_MODPLUG lib_LTLIBRARIES += libopenmpt_modplug.la -libopenmpt_modplug_la_LDFLAGS = -version-info 1:0:0 -no-undefined +libopenmpt_modplug_la_LDFLAGS = -version-info 1:0:0 --no-undefined libopenmpt_modplug_la_CPPFLAGS = $(MINGWSTDTHREADS_CPPFLAGS) -I$(srcdir)/ libopenmpt_modplug_la_CXXFLAGS = libopenmpt_modplug_la_CFLAGS = @@ -415,7 +415,7 @@ if ENABLE_LIBMODPLUG pkgconfig_DATA += libmodplug/libmodplug.pc lib_LTLIBRARIES += libmodplug.la -libmodplug_la_LDFLAGS = -version-info 1:0:0 -no-undefined +libmodplug_la_LDFLAGS = -version-info 1:0:0 --no-undefined nobase_include_HEADERS += libmodplug/modplug.h libmodplug/sndfile.h libmodplug/stdafx.h libmodplug_la_CPPFLAGS = $(MINGWSTDTHREADS_CPPFLAGS) -I$(srcdir)/ libmodplug_la_CXXFLAGS = |