diff options
Diffstat (limited to 'chromium/third_party')
77 files changed, 1815 insertions, 2489 deletions
diff --git a/chromium/third_party/blink/public/strings/translations/blink_accessibility_strings_kk.xtb b/chromium/third_party/blink/public/strings/translations/blink_accessibility_strings_kk.xtb index 57a5c4ba395..57df7c73124 100644 --- a/chromium/third_party/blink/public/strings/translations/blink_accessibility_strings_kk.xtb +++ b/chromium/third_party/blink/public/strings/translations/blink_accessibility_strings_kk.xtb @@ -66,7 +66,7 @@ <translation id="6940482800520966738">Жұлдызша белгішесі</translation> <translation id="7022838723850801004">Бақытты және көңілсіз жүзді эмоджи белгішесі</translation> <translation id="7118469954320184356">Сипаттамасы жоқ.</translation> -<translation id="7410239719251593705">Ересектерге арналған мазмұн сияқты. Сипаттамасы жоқ.</translation> +<translation id="7410239719251593705">Ересектерге арналған контент сияқты. Сипаттамасы жоқ.</translation> <translation id="7533959249147584474">Белгісі жоқ кескін</translation> <translation id="7742609585924342092">Локация белгішесі</translation> <translation id="7745230546936012372">Жеткіліксіз сурет сипаттамаларын алу үшін контекстік мәзірді ашыңыз.</translation> diff --git a/chromium/third_party/blink/public/strings/translations/blink_strings_am.xtb b/chromium/third_party/blink/public/strings/translations/blink_strings_am.xtb index 02cbad1d900..a32348a9f08 100644 --- a/chromium/third_party/blink/public/strings/translations/blink_strings_am.xtb +++ b/chromium/third_party/blink/public/strings/translations/blink_strings_am.xtb @@ -18,7 +18,7 @@ <translation id="1758486001363313524">ሌላ...</translation> <translation id="1787192514241997742">ጠቅላላ ጊዜ፦ <ph name="REMAINING_TIME" /></translation> <translation id="1822429046913737220">ጥዋት/ከሰዓት</translation> -<translation id="1832974991323546415">በርቀት መሳሪያ ላይ አጫውት</translation> +<translation id="1832974991323546415">በርቀት መሣሪያ ላይ አጫውት</translation> <translation id="1921819250265091946">ቀቀ</translation> <translation id="1938124657309484470">ዋጋ <ph name="MAXIMUM_DATE_OR_TIME" /> ወይም ከዚያ በፊት መሆን አለበት።</translation> <translation id="1946271899482435442">የቀን መልቀሚያ አሳይ</translation> @@ -110,7 +110,7 @@ <translation id="6165053282446038410">ተዘርግቷል፣ <ph name="COUNT" /> የራስ-ማጠናቀቅ አማራጮች አሉ።</translation> <translation id="6212595056017402527">የአሁኑ ገጽ</translation> <translation id="6281588256137006900">ፍካት</translation> -<translation id="6310801910862476708">ከስዕል-ውስጥ-ስዕል ውጣ</translation> +<translation id="6310801910862476708">ከሥዕል-ውስጥ-ሥዕል ውጣ</translation> <translation id="6398862346408813489">የወር መምረጫ ፓነል አሳይ</translation> <translation id="6404546809543547843">የኦዲዮ ሰዓት አንፏቃቂ</translation> <translation id="6443871981718447451">የተዘጉ የመግለጫ ጽሁፎችን ምናሌ አሳይ</translation> @@ -173,10 +173,10 @@ <translation id="894736920926684893">የቅርጸት መቀያየሪያ</translation> <translation id="8987927404178983737">ወር</translation> <translation id="901493112792887934">የአሁኑ ጊዜ በሰከንዶች</translation> -<translation id="9093215626363556771">ከስዕል-ውስጥ-ስዕል ውጣ</translation> +<translation id="9093215626363556771">ከሥዕል-ውስጥ-ሥዕል ውጣ</translation> <translation id="9132465097189459683">ሌላ...</translation> <translation id="9155987714137265666"><ph name="WEEK" />፣ የሚጀምረው በ<ph name="WEEK_START_DATE" /></translation> <translation id="916607977885256133">በሥዕል ላይ ሥዕል</translation> <translation id="945780513535800434">በከፊል ምልክት ተደርጎበታል</translation> -<translation id="954003015749068518">ወደ ስዕል-ውስጥ-ስዕል ይግቡ</translation> +<translation id="954003015749068518">ወደ ሥዕል-ውስጥ-ሥዕል ይግቡ</translation> </translationbundle>
\ No newline at end of file diff --git a/chromium/third_party/blink/public/strings/translations/blink_strings_bs.xtb b/chromium/third_party/blink/public/strings/translations/blink_strings_bs.xtb index 74ddf3201eb..33036994be7 100644 --- a/chromium/third_party/blink/public/strings/translations/blink_strings_bs.xtb +++ b/chromium/third_party/blink/public/strings/translations/blink_strings_bs.xtb @@ -110,7 +110,7 @@ <translation id="6165053282446038410">prošireno, broj dostupnih opcija automatskog popunjavanja: <ph name="COUNT" />.</translation> <translation id="6212595056017402527">trenutna stranica</translation> <translation id="6281588256137006900">Svjetlost</translation> -<translation id="6310801910862476708">Izlaz iz načina slika u slici</translation> +<translation id="6310801910862476708">Izlazak iz načina rada slike u slici</translation> <translation id="6398862346408813489">Prikaži ploču za odabir mjeseca</translation> <translation id="6404546809543547843">regulator vremena audiozapisa</translation> <translation id="6443871981718447451">prikaži meni za titlove</translation> @@ -152,7 +152,7 @@ <translation id="8117451130807776954">Ova sedmica</translation> <translation id="8131955114056917397">0,25</translation> <translation id="8199524924445686405">gggg</translation> -<translation id="8261464734335370856">Netočan pravopis</translation> +<translation id="8261464734335370856">Nevažeći pravopis</translation> <translation id="8284326494547611709">Titlovi</translation> <translation id="835897206747267392">Nevažeća vrijednost.</translation> <translation id="839593075537728968">Vrijednost mora biti između <ph name="MINIMUM_TIME" /> i <ph name="MAXIMUM_TIME" />.</translation> diff --git a/chromium/third_party/blink/public/strings/translations/blink_strings_zh-HK.xtb b/chromium/third_party/blink/public/strings/translations/blink_strings_zh-HK.xtb index c8fa9743b9c..6fb295b18ba 100644 --- a/chromium/third_party/blink/public/strings/translations/blink_strings_zh-HK.xtb +++ b/chromium/third_party/blink/public/strings/translations/blink_strings_zh-HK.xtb @@ -8,7 +8,7 @@ <translation id="1306460908038601864">關閉</translation> <translation id="1311894908970423688">數值必須為 <ph name="VALUE_DATE_OR_TIME" />。</translation> <translation id="1480676835519562650">可以揀幾個項目,揀咗 <ph name="SELECTED" /> 個,總共有 <ph name="COUNT" /> 個。</translation> -<translation id="1588438908519853928">一般</translation> +<translation id="1588438908519853928">正常</translation> <translation id="1591562245178063882">本月</translation> <translation id="1637811476055996098">選擇檔案</translation> <translation id="1681022320378710418">目前嘅時間</translation> diff --git a/chromium/third_party/blink/renderer/core/html/forms/select_type.cc b/chromium/third_party/blink/renderer/core/html/forms/select_type.cc index 838879ed33c..6a6ebf5b618 100644 --- a/chromium/third_party/blink/renderer/core/html/forms/select_type.cc +++ b/chromium/third_party/blink/renderer/core/html/forms/select_type.cc @@ -325,22 +325,23 @@ void MenuListSelectType::ShowPopup(PopupMenu::ShowEventType type) { gfx::Rect local_root_rect = select_->VisibleBoundsInLocalRoot(); - if (!document.GetFrame()->LocalFrameRoot().IsOutermostMainFrame()) { + if (document.GetFrame()->LocalFrameRoot().IsOutermostMainFrame()) { + gfx::Rect visual_viewport_rect = + document.GetPage()->GetVisualViewport().RootFrameToViewport( + local_root_rect); + visual_viewport_rect.Intersect( + gfx::Rect(document.GetPage()->GetVisualViewport().Size())); + if (visual_viewport_rect.IsEmpty()) + return; + } else { // TODO(bokan): If we're in a remote frame, we cannot access the active // visual viewport. VisibleBoundsInLocalRoot will clip to the outermost // main frame but if the user is pinch-zoomed this won't be accurate. + // https://crbug.com/840944. if (local_root_rect.IsEmpty()) return; } - gfx::Rect visual_viewport_rect = - document.GetPage()->GetVisualViewport().RootFrameToViewport( - local_root_rect); - visual_viewport_rect.Intersect( - gfx::Rect(document.GetPage()->GetVisualViewport().Size())); - if (visual_viewport_rect.IsEmpty()) - return; - if (!popup_) { popup_ = document.GetPage()->GetChromeClient().OpenPopupMenu( *document.GetFrame(), *select_); diff --git a/chromium/third_party/blink/renderer/core/layout/layout_box_hot.cc b/chromium/third_party/blink/renderer/core/layout/layout_box_hot.cc index 3c6534b8277..55ef128d653 100644 --- a/chromium/third_party/blink/renderer/core/layout/layout_box_hot.cc +++ b/chromium/third_party/blink/renderer/core/layout/layout_box_hot.cc @@ -312,6 +312,19 @@ const NGLayoutResult* LayoutBox::CachedLayoutResult( if (column_spanner_path || cached_layout_result->ColumnSpannerPath()) return nullptr; + // Break appeal may have been reduced because the fragment crosses the + // fragmentation line, to send a strong signal to break before it + // instead. If we actually ended up breaking before it, this break appeal + // may no longer be valid, since there could be more room in the next + // fragmentainer. Miss the cache. + // + // TODO(mstensho): Maybe this shouldn't be necessary. Look into how + // FinishFragmentation() clamps break appeal down to + // kBreakAppealLastResort. Maybe there are better ways. + if (break_token && break_token->IsBreakBefore() && + cached_layout_result->BreakAppeal() < kBreakAppealPerfect) + return nullptr; + // If the node didn't break into multiple fragments, we might be able to // re-use the result. If the fragmentainer block-size has changed, or if // the fragment's block-offset within the fragmentainer has changed, we diff --git a/chromium/third_party/blink/renderer/core/layout/ng/grid/ng_grid_break_token_data.h b/chromium/third_party/blink/renderer/core/layout/ng/grid/ng_grid_break_token_data.h index 2f226d6a144..ab807d34fc0 100644 --- a/chromium/third_party/blink/renderer/core/layout/ng/grid/ng_grid_break_token_data.h +++ b/chromium/third_party/blink/renderer/core/layout/ng/grid/ng_grid_break_token_data.h @@ -6,6 +6,7 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_GRID_NG_GRID_BREAK_TOKEN_DATA_H_ #include "third_party/blink/renderer/core/layout/ng/grid/ng_grid_data.h" +#include "third_party/blink/renderer/core/layout/ng/grid/ng_grid_item.h" #include "third_party/blink/renderer/core/layout/ng/ng_block_break_token_data.h" #include "third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.h" #include "third_party/blink/renderer/platform/geometry/layout_unit.h" @@ -34,6 +35,9 @@ struct NGGridBreakTokenData final : NGBlockBreakTokenData { const NGGridLayoutData& layout_data, LayoutUnit intrinsic_block_size, LayoutUnit consumed_grid_block_size, + Vector<GridItemIndices>&& column_range_indices, + Vector<GridItemIndices>&& row_range_indices, + Vector<GridArea>&& resolved_positions, const Vector<GridItemPlacementData>& grid_items_placement_data, const Vector<LayoutUnit>& row_offset_adjustments, const Vector<EBreakBetween>& row_break_between, @@ -42,6 +46,9 @@ struct NGGridBreakTokenData final : NGBlockBreakTokenData { layout_data(layout_data), intrinsic_block_size(intrinsic_block_size), consumed_grid_block_size(consumed_grid_block_size), + column_range_indices(std::move(column_range_indices)), + row_range_indices(std::move(row_range_indices)), + resolved_positions(std::move(resolved_positions)), grid_items_placement_data(grid_items_placement_data), row_offset_adjustments(row_offset_adjustments), row_break_between(row_break_between), @@ -59,7 +66,9 @@ struct NGGridBreakTokenData final : NGBlockBreakTokenData { // it isn't used for determining the final block-size of the fragment and // won't include any block-end padding (this prevents saturation bugs). LayoutUnit consumed_grid_block_size; - + Vector<GridItemIndices> column_range_indices; + Vector<GridItemIndices> row_range_indices; + Vector<GridArea> resolved_positions; Vector<GridItemPlacementData> grid_items_placement_data; Vector<LayoutUnit> row_offset_adjustments; Vector<EBreakBetween> row_break_between; diff --git a/chromium/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc b/chromium/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc index 5dd4688f0e7..aab3dfcd146 100644 --- a/chromium/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc +++ b/chromium/third_party/blink/renderer/core/layout/ng/grid/ng_grid_layout_algorithm.cc @@ -116,7 +116,9 @@ NGGridProperties InitializeGridProperties( void CacheGridTrackSpanProperties( const NGGridLayoutTrackCollection& track_collection, GridItems* grid_items, - NGGridProperties* grid_properties = nullptr) { + NGGridProperties* grid_properties = nullptr, + const Vector<GridItemIndices>* range_indices = nullptr, + const Vector<GridArea>* resolved_positions = nullptr) { DCHECK(grid_items); const auto track_direction = track_collection.Direction(); @@ -144,16 +146,29 @@ void CacheGridTrackSpanProperties( CacheGridProperty(TrackSpanProperties::kIsDependentOnAvailableSize); } - auto CacheTrackSpanProperty = - [&](GridItemData& grid_item, const wtf_size_t range_index, - const TrackSpanProperties::PropertyId property) { - if (track_collection.RangeHasTrackSpanProperty(range_index, property)) - grid_item.SetTrackSpanProperty(property, track_direction); - }; - GridItems grid_items_spanning_multiple_ranges; - for (auto& grid_item : *grid_items) { - const auto& range_indices = grid_item.RangeIndices(track_direction); + for (wtf_size_t index = 0; index < grid_items->Size(); ++index) { + auto& grid_item = grid_items->At(index); + + // If positions range indices were provided, assign them before querying + // `RangeIndices` below. + if (resolved_positions && resolved_positions->size()) + grid_item.resolved_position = resolved_positions->at(index); + + if (range_indices && range_indices->size()) { + if (track_direction == kForColumns) + grid_item.column_range_indices = range_indices->at(index); + else + grid_item.row_range_indices = range_indices->at(index); + } + + const auto& item_range_indices = grid_item.RangeIndices(track_direction); + auto& track_span_properties = (track_direction == kForColumns) + ? grid_item.column_span_properties + : grid_item.row_span_properties; + + grid_item.ComputeSetIndices(track_collection); + track_span_properties.Reset(); // If a grid item spans only one range, then we can just cache the track // span properties directly. On the contrary, if a grid item spans multiple @@ -161,17 +176,9 @@ void CacheGridTrackSpanProperties( // to do more work to cache its track span properties. // // TODO(layout-dev): Investigate applying this concept to spans > 1. - if (range_indices.begin == range_indices.end) { - CacheTrackSpanProperty(grid_item, range_indices.begin, - TrackSpanProperties::kHasFlexibleTrack); - CacheTrackSpanProperty(grid_item, range_indices.begin, - TrackSpanProperties::kHasIntrinsicTrack); - CacheTrackSpanProperty(grid_item, range_indices.begin, - TrackSpanProperties::kHasAutoMinimumTrack); - CacheTrackSpanProperty(grid_item, range_indices.begin, - TrackSpanProperties::kHasFixedMinimumTrack); - CacheTrackSpanProperty(grid_item, range_indices.begin, - TrackSpanProperties::kHasFixedMaximumTrack); + if (item_range_indices.begin == item_range_indices.end) { + track_span_properties = + track_collection.RangeProperties(item_range_indices.begin); } else { grid_items_spanning_multiple_ranges.Append(&grid_item); } @@ -287,13 +294,17 @@ const NGLayoutResult* NGGridLayoutAlgorithm::LayoutInternal() { intrinsic_block_size = grid_data->intrinsic_block_size; layout_data = grid_data->layout_data; - for (auto& grid_item : grid_items) { - grid_item.ComputeSetIndices(*layout_data.Columns()); - grid_item.ComputeSetIndices(*layout_data.Rows()); - } - - CacheGridTrackSpanProperties(*layout_data.Columns(), &grid_items); - CacheGridTrackSpanProperties(*layout_data.Rows(), &grid_items); + // Update `grid_items` with resolved positions and range indices stored + // on the break token, as these are dependent on the `layout_data` above. + // + // TODO(kschmi): If these don't change between fragmentainers, we can store + // them (and Columns/Rows) on `NGGridBreakTokenData` and avoid recomputing. + CacheGridTrackSpanProperties( + *layout_data.Columns(), &grid_items, /* grid_properties */ nullptr, + &grid_data->column_range_indices, &grid_data->resolved_positions); + CacheGridTrackSpanProperties(*layout_data.Rows(), &grid_items, + /* grid_properties */ nullptr, + &grid_data->row_range_indices); } else { ComputeGridGeometry(node.CachedPlacementData(), &grid_items, &layout_data, &intrinsic_block_size); @@ -395,12 +406,21 @@ const NGLayoutResult* NGGridLayoutAlgorithm::LayoutInternal() { PlaceOutOfFlowItems(layout_data, block_size, oof_children); if (ConstraintSpace().HasBlockFragmentation()) { + Vector<GridItemIndices> column_range_indices; + Vector<GridItemIndices> row_range_indices; + Vector<GridArea> resolved_positions; + for (auto& grid_item : grid_items) { + column_range_indices.push_back(grid_item.column_range_indices); + row_range_indices.push_back(grid_item.row_range_indices); + resolved_positions.push_back(grid_item.resolved_position); + } container_builder_.SetBreakTokenData( MakeGarbageCollected<NGGridBreakTokenData>( container_builder_.GetBreakTokenData(), layout_data, intrinsic_block_size, consumed_grid_block_size, - grid_items_placement_data, row_offset_adjustments, - row_break_between, oof_children)); + std::move(column_range_indices), std::move(row_range_indices), + std::move(resolved_positions), grid_items_placement_data, + row_offset_adjustments, row_break_between, oof_children)); } // Copy grid layout data for use in computed style and devtools. @@ -442,11 +462,6 @@ MinMaxSizesResult NGGridLayoutAlgorithm::ComputeMinMaxSizes( LayoutTrackCollection(placement_data, kForColumns, &grid_items), LayoutTrackCollection(placement_data, kForRows, &grid_items)); - for (auto& grid_item : grid_items) { - grid_item.ComputeSetIndices(*layout_data.Columns()); - grid_item.ComputeSetIndices(*layout_data.Rows()); - } - auto grid_properties = InitializeGridProperties(grid_items, Style().GetWritingMode()); @@ -804,11 +819,6 @@ void NGGridLayoutAlgorithm::ComputeGridGeometry( *row_builder_collection, is_block_available_size_indefinite); } - for (auto& grid_item : *grid_items) { - grid_item.ComputeSetIndices(*layout_data->Columns()); - grid_item.ComputeSetIndices(*layout_data->Rows()); - } - auto grid_properties = InitializeGridProperties(*grid_items, container_style.GetWritingMode()); diff --git a/chromium/third_party/blink/renderer/core/layout/ng/grid/ng_grid_track_collection.cc b/chromium/third_party/blink/renderer/core/layout/ng/grid/ng_grid_track_collection.cc index 6d5e983c890..e6c6bd0592e 100644 --- a/chromium/third_party/blink/renderer/core/layout/ng/grid/ng_grid_track_collection.cc +++ b/chromium/third_party/blink/renderer/core/layout/ng/grid/ng_grid_track_collection.cc @@ -517,6 +517,12 @@ wtf_size_t NGGridLayoutTrackCollection::RangeBeginSetIndex( return ranges_[range_index].begin_set_index; } +TrackSpanProperties NGGridLayoutTrackCollection::RangeProperties( + wtf_size_t range_index) const { + DCHECK_LT(range_index, ranges_.size()); + return ranges_[range_index].properties; +} + bool NGGridLayoutTrackCollection::RangeHasTrackSpanProperty( wtf_size_t range_index, TrackSpanProperties::PropertyId property_id) const { diff --git a/chromium/third_party/blink/renderer/core/layout/ng/grid/ng_grid_track_collection.h b/chromium/third_party/blink/renderer/core/layout/ng/grid/ng_grid_track_collection.h index 8070cf772b3..f0ed053a675 100644 --- a/chromium/third_party/blink/renderer/core/layout/ng/grid/ng_grid_track_collection.h +++ b/chromium/third_party/blink/renderer/core/layout/ng/grid/ng_grid_track_collection.h @@ -191,6 +191,8 @@ class CORE_EXPORT NGGridLayoutTrackCollection wtf_size_t RangeSetCount(wtf_size_t range_index) const; // Return the index of the first set spanned by a given track range. wtf_size_t RangeBeginSetIndex(wtf_size_t range_index) const; + // Returns the track span properties of the range at position |range_index|. + TrackSpanProperties RangeProperties(wtf_size_t range_index) const; // Returns true if the specified property has been set in the track span // properties bitmask of the range at position |range_index|. diff --git a/chromium/third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder.h b/chromium/third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder.h index 17b4d018433..b773e07908c 100644 --- a/chromium/third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder.h +++ b/chromium/third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder.h @@ -133,14 +133,18 @@ class CORE_EXPORT NGConstraintSpaceBuilder final { space_.EnsureRareData()->fragmentainer_block_size = size; } - // Shrink the fragmentainer block-size, to reserve space at the end. This is - // needed for repeated table footers. - void ReserveSpaceAtFragmentainerEnd(LayoutUnit space) { + // Shrink the fragmentainer block-size, to reserve space for repeated table + // headers and footers. If there's a repeated header, the argument to + // SetFragmentainerOffset() also needs to be compensated for the block-size + // taken up by the repeated header, so that offset 0 is exactly where the + // non-repeated content starts / resumes after the repeated header. + void ReserveSpaceInFragmentainer(LayoutUnit space) { #if DCHECK_IS_ON() DCHECK(is_fragmentainer_block_size_set_); #endif - DCHECK_GE(space_.rare_data_->fragmentainer_block_size, space); space_.rare_data_->fragmentainer_block_size -= space; + space_.rare_data_->fragmentainer_block_size = + space_.rare_data_->fragmentainer_block_size.ClampNegativeToZero(); } void SetFragmentainerOffset(LayoutUnit offset) { diff --git a/chromium/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.cc b/chromium/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.cc index e9a88ec394b..b836552378e 100644 --- a/chromium/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.cc +++ b/chromium/third_party/blink/renderer/core/layout/ng/ng_container_fragment_builder.cc @@ -511,9 +511,9 @@ void NGContainerFragmentBuilder::PropagateOOFPositionedInfo( fixedpos_containing_block_offset = converter.ToLogical( multicol_info->fixedpos_containing_block.Offset(), fixedpos_containing_block_fragment->Size()); - fixedpos_containing_block_rel_offset = converter.ToLogical( + fixedpos_containing_block_rel_offset = RelativeInsetToLogical( multicol_info->fixedpos_containing_block.RelativeOffset(), - fixedpos_containing_block_fragment->Size()); + GetWritingDirection()); fixedpos_containing_block_rel_offset += relative_offset; // We want the fixedpos containing block offset to be the offset from // the containing block to the top of the fragmentation context root, @@ -611,9 +611,8 @@ void NGContainerFragmentBuilder::PropagateOOFFragmentainerDescendants( LogicalOffset containing_block_offset = converter.ToLogical(descendant.containing_block.Offset(), containing_block_fragment->Size()); - LogicalOffset containing_block_rel_offset = - converter.ToLogical(descendant.containing_block.RelativeOffset(), - containing_block_fragment->Size()); + LogicalOffset containing_block_rel_offset = RelativeInsetToLogical( + descendant.containing_block.RelativeOffset(), GetWritingDirection()); containing_block_rel_offset += relative_offset; if (!fragment.IsFragmentainerBox()) containing_block_offset += offset; @@ -657,9 +656,9 @@ void NGContainerFragmentBuilder::PropagateOOFFragmentainerDescendants( fixedpos_containing_block_offset = converter.ToLogical(descendant.fixedpos_containing_block.Offset(), fixedpos_containing_block_fragment->Size()); - fixedpos_containing_block_rel_offset = converter.ToLogical( + fixedpos_containing_block_rel_offset = RelativeInsetToLogical( descendant.fixedpos_containing_block.RelativeOffset(), - fixedpos_containing_block_fragment->Size()); + GetWritingDirection()); fixedpos_containing_block_rel_offset += relative_offset; if (!fragment.IsFragmentainerBox()) fixedpos_containing_block_offset += offset; diff --git a/chromium/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc b/chromium/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc index 0346e37be9d..83dfd0f3c0f 100644 --- a/chromium/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc +++ b/chromium/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc @@ -961,9 +961,9 @@ void NGOutOfFlowLayoutPart::LayoutOOFsInMulticol( fixedpos_containing_block_offset = converter.ToLogical(descendant.fixedpos_containing_block.Offset(), fixedpos_containing_block_fragment->Size()); - fixedpos_containing_block_rel_offset = converter.ToLogical( + fixedpos_containing_block_rel_offset = RelativeInsetToLogical( descendant.fixedpos_containing_block.RelativeOffset(), - fixedpos_containing_block_fragment->Size()); + writing_direction); } NGInlineContainer<LogicalOffset> inline_container( diff --git a/chromium/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_positioned_node.h b/chromium/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_positioned_node.h index 7295d86d4d8..f1ffccc5169 100644 --- a/chromium/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_positioned_node.h +++ b/chromium/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_positioned_node.h @@ -380,6 +380,20 @@ struct NGFragmentedOutOfFlowData final : NGPhysicalFragment::OutOfFlowData { MulticolCollection multicols_with_pending_oofs; }; +inline PhysicalOffset RelativeInsetToPhysical( + LogicalOffset relative_inset, + WritingDirectionMode writing_direction) { + return relative_inset.ConvertToPhysical(writing_direction, PhysicalSize(), + PhysicalSize()); +} + +inline LogicalOffset RelativeInsetToLogical( + PhysicalOffset relative_inset, + WritingDirectionMode writing_direction) { + return relative_inset.ConvertToLogical(writing_direction, PhysicalSize(), + PhysicalSize()); +} + } // namespace blink WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS( diff --git a/chromium/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.cc b/chromium/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.cc index 6a920c0ec36..79b20d51a32 100644 --- a/chromium/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.cc +++ b/chromium/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.cc @@ -102,8 +102,8 @@ NGContainingBlock<PhysicalOffset> PhysicalContainingBlock( return NGContainingBlock<PhysicalOffset>( containing_block.Offset().ConvertToPhysical( builder->Style().GetWritingDirection(), outer_size, inner_size), - containing_block.RelativeOffset().ConvertToPhysical( - builder->Style().GetWritingDirection(), outer_size, inner_size), + RelativeInsetToPhysical(containing_block.RelativeOffset(), + builder->Style().GetWritingDirection()), containing_block.Fragment(), containing_block.IsInsideColumnSpanner(), containing_block.RequiresContentBeforeBreaking()); } diff --git a/chromium/third_party/blink/renderer/core/layout/ng/table/ng_table_layout_algorithm.cc b/chromium/third_party/blink/renderer/core/layout/ng/table/ng_table_layout_algorithm.cc index c7f0000603b..92d8bfa1067 100644 --- a/chromium/third_party/blink/renderer/core/layout/ng/table/ng_table_layout_algorithm.cc +++ b/chromium/third_party/blink/renderer/core/layout/ng/table/ng_table_layout_algorithm.cc @@ -977,13 +977,12 @@ const NGLayoutResult* NGTableLayoutAlgorithm::GenerateFragment( auto CreateSectionConstraintSpace = [&table_writing_direction, §ion_available_inline_size, - &constraint_space_data, §ions, - this](const NGBlockNode& section, - LayoutUnit block_offset, - wtf_size_t section_index, - absl::optional<LayoutUnit> - repeated_footer_block_size, - ESectionRepeatMode repeat_mode) { + &constraint_space_data, §ions, this]( + const NGBlockNode& section, + LayoutUnit fragmentainer_block_offset, + wtf_size_t section_index, + LayoutUnit reserved_space, + ESectionRepeatMode repeat_mode) { NGConstraintSpaceBuilder section_space_builder( ConstraintSpace(), table_writing_direction, /* is_new_fc */ true); @@ -1007,17 +1006,21 @@ const NGLayoutResult* NGTableLayoutAlgorithm::GenerateFragment( section_space_builder.SetShouldRepeat(repeat_mode == kMayRepeatAgain); section_space_builder.SetIsInsideRepeatableContent(true); } else if (ConstraintSpace().HasBlockFragmentation()) { + // Note that, with fragmentainer_block_offset, we pretend that any + // repeated table header isn't there (since it doesn't really participate + // in block fragmentation anyway), so that the block-offset right after + // such a header will be at 0, as far as block fragmentation is concerned. + // This way the fragmentation engine will refuse to insert a break before + // having made some content progress (even if the first piece of content + // doesn't fit). SetupSpaceBuilderForFragmentation( - ConstraintSpace(), section, block_offset, §ion_space_builder, - /* is_new_fc */ true, + ConstraintSpace(), section, fragmentainer_block_offset, + §ion_space_builder, /* is_new_fc */ true, container_builder_.RequiresContentBeforeBreaking()); - if (repeated_footer_block_size) { - // Reserve space for the repeated footer at the block-end of the - // fragmentainer. No other section may extend into this area. - section_space_builder.ReserveSpaceAtFragmentainerEnd( - *repeated_footer_block_size); - } + // Reserve space for any repeated header / footer. + if (ConstraintSpace().HasKnownFragmentainerBlockSize()) + section_space_builder.ReserveSpaceInFragmentainer(reserved_space); } return section_space_builder.ToConstraintSpace(); @@ -1038,7 +1041,8 @@ const NGLayoutResult* NGTableLayoutAlgorithm::GenerateFragment( absl::optional<LayoutUnit> last_baseline; bool has_repeated_header = false; - absl::optional<LayoutUnit> pending_repeated_footer_block_size; + bool has_pending_repeated_footer = false; + LayoutUnit repeated_footer_block_size; // Before fragmented layout we need to go through the table's children, to // look for repeatable headers and footers. This is especially important for @@ -1061,25 +1065,50 @@ const NGLayoutResult* NGTableLayoutAlgorithm::GenerateFragment( if (child != grouped_children.header && child != grouped_children.footer) continue; - // Headers and footers may be repeated if their block-size is one quarter - // or less than that of the fragmentainer, AND 'break-inside' has an - // applicable avoid* value. Being repeated means that the section is - // monolithic, and nothing inside can break. - // - // See https://www.w3.org/TR/css-tables-3/#repeated-headers - LayoutUnit block_size = sections[entry.GetSectionIndex()].block_size; - if (block_size > max_section_block_size) - continue; if (!IsAvoidBreakValue(ConstraintSpace(), child.Style().BreakInside())) continue; + const NGBlockBreakToken* child_break_token = entry.GetBreakToken(); + // If we've already broken inside the section, it's not going to repeat, + // but rather perform regular fragmentation. + if (IsResumingLayout(child_break_token)) + continue; + + LayoutUnit block_size = sections[entry.GetSectionIndex()].block_size; + + // Unless we have already decided to repeat in a previous fragment, check + // if the block-size of the section is acceptable. + if (!child_break_token || !child_break_token->IsRepeated()) { + DCHECK(!child_break_token || child_break_token->IsBreakBefore()); + + // If this isn't the first fragment for the table box, and the section + // didn't repeat in the previous fragment, it doesn't make sense to + // start repeating now. If this is a header, we may already have + // finished (non-repeated) layout. If this is a footer, we have already + // laid out at least one fragment without it. + if (incoming_table_break_data && + incoming_table_break_data->has_entered_table_box) + continue; + + // Headers and footers may be repeated if their block-size is one + // quarter or less than that of the fragmentainer, AND 'break-inside' + // has an applicable avoid* value. Being repeated means that the section + // is monolithic, and nothing inside can break. + // + // See https://www.w3.org/TR/css-tables-3/#repeated-headers + if (block_size > max_section_block_size) + continue; + } + if (child == grouped_children.header) { has_repeated_header = true; } else { DCHECK_EQ(child, grouped_children.footer); + has_pending_repeated_footer = true; + // We need to reserve space for the repeated footer at the end of the // fragmentainer. - pending_repeated_footer_block_size = + repeated_footer_block_size = block_size + border_spacing.block_size + (has_collapsed_borders ? border_padding.block_end : LayoutUnit()); } @@ -1087,6 +1116,7 @@ const NGLayoutResult* NGTableLayoutAlgorithm::GenerateFragment( } LayoutUnit grid_block_size_inflation; + LayoutUnit repeated_header_block_size; bool broke_inside = false; bool has_ended_table_box_layout = false; NGTableChildIterator child_iterator(grouped_children, BreakToken()); @@ -1105,7 +1135,7 @@ const NGLayoutResult* NGTableLayoutAlgorithm::GenerateFragment( broke_inside = true; if (child == grouped_children.footer) - pending_repeated_footer_block_size.reset(); + has_pending_repeated_footer = false; break; } @@ -1114,6 +1144,7 @@ const NGLayoutResult* NGTableLayoutAlgorithm::GenerateFragment( const NGBlockBreakToken* child_break_token = entry.GetBreakToken(); const NGLayoutResult* child_result; + absl::optional<LayoutUnit> offset_before_repeated_header; LayoutUnit child_inline_offset; LayoutUnit child_block_end_margin; // Captions allow margins. absl::optional<TableBoxExtent> new_table_box_extent; @@ -1167,6 +1198,9 @@ const NGLayoutResult* NGTableLayoutAlgorithm::GenerateFragment( } child_result = caption.layout_result; child_inline_offset = caption.margins.inline_start; + + // Captions don't need to worry about repeated sections. + repeated_header_block_size = LayoutUnit(); } else { DCHECK(child.IsTableSection()); LayoutUnit collapsible_border_spacing; @@ -1187,7 +1221,6 @@ const NGLayoutResult* NGTableLayoutAlgorithm::GenerateFragment( } LayoutUnit offset_for_childless_section = child_block_offset; - child_block_offset += collapsible_border_spacing; bool may_repeat_again = false; if (child == grouped_children.header) { @@ -1199,6 +1232,12 @@ const NGLayoutResult* NGTableLayoutAlgorithm::GenerateFragment( // reach the end in this fragment, we need to abort and relayout. may_repeat_again = !is_known_to_be_last_table_box_; + // We need to measure the block-size of the repeated header, because + // this is something we have to subtract from available fragmentainer + // block-size, AND fragmentainer block-offset, when laying out + // non-repeated content (i.e. regular sections). + offset_before_repeated_header.emplace(child_block_offset); + // A header will share its collapsed border with the block-start of // the table. However when repeated it will draw the whole border // itself. We need to reserve additional space at the block-start for @@ -1208,26 +1247,34 @@ const NGLayoutResult* NGTableLayoutAlgorithm::GenerateFragment( child_block_offset += border_padding.block_start; } } else if (child == grouped_children.footer) { - if (pending_repeated_footer_block_size) { + if (has_pending_repeated_footer) { is_repeated_section = true; // For footers it's easier, though. Since we got all the way to the // footer during layout, this means that this will be the last time // the footer is repeated. We can finish it right away, unless we have // a repeated header as well (which means that we're going to // relayout). - pending_repeated_footer_block_size.reset(); + has_pending_repeated_footer = false; may_repeat_again = !is_known_to_be_last_table_box_ && has_repeated_header; } } + child_block_offset += collapsible_border_spacing; + ESectionRepeatMode repeat_mode = kNotRepeated; if (is_repeated_section) repeat_mode = may_repeat_again ? kMayRepeatAgain : kRepeatedLast; + LayoutUnit reserved_space; + if (repeat_mode == kNotRepeated) { + reserved_space = + repeated_header_block_size + repeated_footer_block_size; + } + NGConstraintSpace child_space = CreateSectionConstraintSpace( - child, child_block_offset, entry.GetSectionIndex(), - pending_repeated_footer_block_size, repeat_mode); + child, child_block_offset - repeated_header_block_size, + entry.GetSectionIndex(), reserved_space, repeat_mode); if (is_repeated_section) { child_result = child.LayoutRepeatableRoot(child_space, child_break_token); @@ -1257,9 +1304,11 @@ const NGLayoutResult* NGTableLayoutAlgorithm::GenerateFragment( child_block_offset = offset_for_childless_section; } } - if (ConstraintSpace().HasBlockFragmentation()) { + if (ConstraintSpace().HasBlockFragmentation() && + (!child_break_token || !is_repeated_section)) { LayoutUnit fragmentainer_block_offset = - ConstraintSpace().FragmentainerOffset() + child_block_offset; + ConstraintSpace().FragmentainerOffset() + child_block_offset - + repeated_header_block_size; NGBreakStatus break_status = BreakBeforeChildIfNeeded( ConstraintSpace(), child, *child_result, fragmentainer_block_offset, has_container_separation, &container_builder_); @@ -1291,6 +1340,12 @@ const NGLayoutResult* NGTableLayoutAlgorithm::GenerateFragment( child_block_offset += fragment.BlockSize() + child_block_end_margin; if (child.IsTableSection()) { + if (offset_before_repeated_header) { + repeated_header_block_size = child_block_offset - + *offset_before_repeated_header + + border_spacing.block_size; + } + if (new_table_box_extent) { // The first section was added successfully. We're officially inside the // table box! @@ -1340,7 +1395,7 @@ const NGLayoutResult* NGTableLayoutAlgorithm::GenerateFragment( NGLayoutResult::kNeedsRelayoutAsLastTableBox); } - if (pending_repeated_footer_block_size && table_box_extent) { + if (has_pending_repeated_footer && table_box_extent) { DCHECK(table_box_will_continue); // We broke before we got to the footer. Add it now. Before doing that, // though, also insert break tokens for the sections that we didn't get to @@ -1362,7 +1417,7 @@ const NGLayoutResult* NGTableLayoutAlgorithm::GenerateFragment( LogicalOffset offset(section_inline_offset, child_block_offset); NGConstraintSpace child_space = CreateSectionConstraintSpace( grouped_children.footer, offset.block_offset, entry.GetSectionIndex(), - /* repeated_footer_block_size */ absl::nullopt, kMayRepeatAgain); + /* reserved_space */ LayoutUnit(), kMayRepeatAgain); const NGLayoutResult* result = grouped_children.footer.LayoutRepeatableRoot( child_space, entry.GetBreakToken()); diff --git a/chromium/third_party/blink/renderer/core/paint/pre_paint_tree_walk.cc b/chromium/third_party/blink/renderer/core/paint/pre_paint_tree_walk.cc index a6a0a234fd8..d4c250a7fa7 100644 --- a/chromium/third_party/blink/renderer/core/paint/pre_paint_tree_walk.cc +++ b/chromium/third_party/blink/renderer/core/paint/pre_paint_tree_walk.cc @@ -690,19 +690,19 @@ void PrePaintTreeWalk::WalkFragmentationContextRootChildren( containing_block_context = &fragment_context.current; containing_block_context->paint_offset += child.offset; - if (object.IsLayoutView()) { - // Out-of-flow positioned descendants are positioned relatively to this - // fragmentainer (page). - fragment_context.absolute_position = *containing_block_context; - fragment_context.fixed_position = *containing_block_context; - } - // Keep track of the paint offset at the fragmentainer. This is needed // when entering OOF descendants. OOFs have the nearest fragmentainer as // their containing block, so when entering them during LayoutObject tree // traversal, we have to compensate for this. containing_block_context->paint_offset_for_oof_in_fragmentainer = containing_block_context->paint_offset; + + if (object.IsLayoutView()) { + // Out-of-flow positioned descendants are positioned relatively to this + // fragmentainer (page). + fragment_context.absolute_position = *containing_block_context; + fragment_context.fixed_position = *containing_block_context; + } } WalkChildren(actual_parent, box_fragment, fragmentainer_context); diff --git a/chromium/third_party/blink/renderer/core/timing/performance.cc b/chromium/third_party/blink/renderer/core/timing/performance.cc index 466b9e145d7..b61ee46dce4 100644 --- a/chromium/third_party/blink/renderer/core/timing/performance.cc +++ b/chromium/third_party/blink/renderer/core/timing/performance.cc @@ -273,11 +273,12 @@ PerformanceEntryVector Performance::getEntriesByType( PerformanceEntry::ToEntryTypeEnum(entry_type); if (!PerformanceEntry::IsValidTimelineEntryType(type)) { PerformanceEntryVector empty_entries; - String message = "Deprecated API for given entry type."; - GetExecutionContext()->AddConsoleMessage( - MakeGarbageCollected<ConsoleMessage>( - mojom::ConsoleMessageSource::kJavaScript, - mojom::ConsoleMessageLevel::kWarning, message)); + if (ExecutionContext* execution_context = GetExecutionContext()) { + String message = "Deprecated API for given entry type."; + execution_context->AddConsoleMessage(MakeGarbageCollected<ConsoleMessage>( + mojom::ConsoleMessageSource::kJavaScript, + mojom::ConsoleMessageLevel::kWarning, message)); + } return empty_entries; } return getEntriesByTypeInternal(type); diff --git a/chromium/third_party/blink/renderer/platform/graphics/static_bitmap_image_to_video_frame_copier.cc b/chromium/third_party/blink/renderer/platform/graphics/static_bitmap_image_to_video_frame_copier.cc index 892983b886b..1a2a251d71d 100644 --- a/chromium/third_party/blink/renderer/platform/graphics/static_bitmap_image_to_video_frame_copier.cc +++ b/chromium/third_party/blink/renderer/platform/graphics/static_bitmap_image_to_video_frame_copier.cc @@ -57,13 +57,9 @@ void StaticBitmapImageToVideoFrameCopier::Convert( return; } - if (image->width() == 1 || image->height() == 1) { - // We might need to convert the frame into I420 pixel format, and 1x1 frame - // can't be read back into I420. Capturing such a slim target is not a - // very practical thing to do anyway, so we're okay to fail here. - return; - } - + // We might need to convert the frame into I420 pixel format, and 1x1 frame + // can't be read back into I420. + const bool too_small_for_i420 = image->width() == 1 || image->height() == 1; if (!image->IsTextureBacked()) { // Initially try accessing pixels directly if they are in memory. sk_sp<SkImage> sk_image = image->PaintImageForCurrentFrame().GetSwSkImage(); @@ -90,7 +86,8 @@ void StaticBitmapImageToVideoFrameCopier::Convert( } // Try async reading if image is texture backed. - if (image->CurrentFrameKnownToBeOpaque() || can_discard_alpha_) { + if (!too_small_for_i420 && + (image->CurrentFrameKnownToBeOpaque() || can_discard_alpha_)) { // Split the callback so it can be used for both the GMB frame pool copy and // ReadYUVPixelsAsync fallback paths. auto split_callback = base::SplitOnceCallback(std::move(callback)); diff --git a/chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/navigation_body_loader.cc b/chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/navigation_body_loader.cc index 53ebd8e29fa..52c5839738f 100644 --- a/chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/navigation_body_loader.cc +++ b/chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/navigation_body_loader.cc @@ -31,6 +31,7 @@ #include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/wtf.h" +#include "third_party/ced/src/compact_enc_det/compact_enc_det.h" namespace blink { namespace { @@ -421,6 +422,12 @@ void NavigationBodyLoader::StartLoadingBodyInBackground( if (!response_body_) return; + // Initializing the map used when detecting encodings is not thread safe. + // Initialize on the main thread here to avoid races. + // TODO(crbug.com/1384221): Consider making the map thread safe in + // third_party/ced/src/util/encodings/encodings.cc. + EncodingNameAliasToEncoding(""); + off_thread_body_reader_.reset(new OffThreadBodyReader( std::move(response_body_), std::move(decoder), weak_factory_.GetWeakPtr(), task_runner_, worker_pool::CreateSequencedTaskRunner({}), diff --git a/chromium/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/chromium/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 698cb83a921..4ab43d81cce 100644 --- a/chromium/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/chromium/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -343,7 +343,7 @@ status: "experimental", origin_trial_feature_name: "BackForwardCacheNotRestoredReasons", base_feature: "BackForwardCacheSendNotRestoredReasons", - base_feature_status: "enabled", + base_feature_status: "disabled", copied_from_base_feature_if: "overridden", public: true, }, diff --git a/chromium/third_party/boringssl/src/ssl/ssl_test.cc b/chromium/third_party/boringssl/src/ssl/ssl_test.cc index 3709a4694f3..3515f602f19 100644 --- a/chromium/third_party/boringssl/src/ssl/ssl_test.cc +++ b/chromium/third_party/boringssl/src/ssl/ssl_test.cc @@ -8042,6 +8042,8 @@ RVHWbCvFvNZAoWiIJ2z34RLGInyZvCZ8xLAvsuaWULDDaoeDl1M0t4Hm SSL_CTX_set_verify(client_ctx.get(), SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, nullptr); + X509_VERIFY_PARAM_set_flags(SSL_CTX_get0_param(client_ctx.get()), + X509_V_FLAG_NO_CHECK_TIME); struct TestCase { X509 *cert; diff --git a/chromium/third_party/libaddressinput/chromium/resources/address_input_strings_tr.xtb b/chromium/third_party/libaddressinput/chromium/resources/address_input_strings_tr.xtb index 8ea0fe214f7..4edada56cb3 100644 --- a/chromium/third_party/libaddressinput/chromium/resources/address_input_strings_tr.xtb +++ b/chromium/third_party/libaddressinput/chromium/resources/address_input_strings_tr.xtb @@ -14,7 +14,7 @@ <translation id="4376888869070172068">Posta kodu biçimi tanınmadı.</translation> <translation id="4518701284698680367">Bir posta kodu sağlamalısınız (örneğin, <ph name="EXAMPLE" />). Posta kodunuzu bilmiyor musunuz? <ph name="BEGIN_LINK" />Buradan<ph name="END_LINK" /> bulabilirsiniz.</translation> <translation id="5089810972385038852">Eyalet</translation> -<translation id="5095208057601539847">Eyalet</translation> +<translation id="5095208057601539847">İl</translation> <translation id="5327248766486351172">Ad</translation> <translation id="5937097533660449554">Oblast</translation> <translation id="6132429659673988671">Banliyö</translation> @@ -29,7 +29,7 @@ <translation id="6777217372746654521">Bu adres satırının bir posta kutusu içerdiği anlaşılıyor. Lütfen sokak veya bina adresi kullanın.</translation> <translation id="6839929833149231406">Bölge</translation> <translation id="684852933191805996">Semt</translation> -<translation id="6970216967273061347">Bölge</translation> +<translation id="6970216967273061347">İlçe</translation> <translation id="7087282848513945231">Ülke</translation> <translation id="7139724024395191329">Emirlik</translation> <translation id="7393381084163773901">Adres</translation> diff --git a/chromium/third_party/libaom/README.chromium b/chromium/third_party/libaom/README.chromium index 60934136757..3405a94d577 100644 --- a/chromium/third_party/libaom/README.chromium +++ b/chromium/third_party/libaom/README.chromium @@ -2,8 +2,8 @@ Name: Alliance for Open Media Video Codec Short Name: libaom URL: https://aomedia.googlesource.com/aom/ Version: 3.4.0 -Date: Friday November 11 2022 -Revision: 4ebecefe77953f226e620821fe441e24547a121f +Date: Monday December 05 2022 +Revision: fcf671adc2f301c2d1fe3cfa6d545d59c5084d3d CPEPrefix: cpe:/a:aomedia:aomedia:3.4.0 License: BSD License File: source/libaom/LICENSE diff --git a/chromium/third_party/libaom/source/config/config/aom_version.h b/chromium/third_party/libaom/source/config/config/aom_version.h index 90c9c13020e..44f259c81d0 100644 --- a/chromium/third_party/libaom/source/config/config/aom_version.h +++ b/chromium/third_party/libaom/source/config/config/aom_version.h @@ -12,8 +12,8 @@ #define VERSION_MAJOR 3 #define VERSION_MINOR 5 #define VERSION_PATCH 0 -#define VERSION_EXTRA "289-g4ebecefe7" +#define VERSION_EXTRA "290-gfcf671adc" #define VERSION_PACKED \ ((VERSION_MAJOR << 16) | (VERSION_MINOR << 8) | (VERSION_PATCH)) -#define VERSION_STRING_NOSP "3.5.0-289-g4ebecefe7" -#define VERSION_STRING " 3.5.0-289-g4ebecefe7" +#define VERSION_STRING_NOSP "3.5.0-290-gfcf671adc" +#define VERSION_STRING " 3.5.0-290-gfcf671adc" diff --git a/chromium/third_party/libaom/source/libaom/av1/encoder/ratectrl.c b/chromium/third_party/libaom/source/libaom/av1/encoder/ratectrl.c index e6bb18486f6..d3ce8959c8b 100644 --- a/chromium/third_party/libaom/source/libaom/av1/encoder/ratectrl.c +++ b/chromium/third_party/libaom/source/libaom/av1/encoder/ratectrl.c @@ -2160,6 +2160,9 @@ void av1_rc_postencode_update(AV1_COMP *cpi, uint64_t bytes_used) { } #endif if (current_frame->frame_type == KEY_FRAME) rc->frames_since_key = 0; + + rc->prev_coded_width = cm->width; + rc->prev_coded_height = cm->height; // if (current_frame->frame_number == 1 && cm->show_frame) /* rc->this_frame_target = @@ -2176,6 +2179,8 @@ void av1_rc_postencode_update_drop_frame(AV1_COMP *cpi) { cpi->rc.rc_2_frame = 0; cpi->rc.rc_1_frame = 0; cpi->rc.prev_avg_frame_bandwidth = cpi->rc.avg_frame_bandwidth; + cpi->rc.prev_coded_width = cpi->common.width; + cpi->rc.prev_coded_height = cpi->common.height; } int av1_find_qindex(double desired_q, aom_bit_depth_t bit_depth, @@ -3120,8 +3125,15 @@ void av1_get_one_pass_rt_params(AV1_COMP *cpi, FRAME_TYPE *const frame_type, } } // Check for scene change: for SVC check on base spatial layer only. - if (cpi->sf.rt_sf.check_scene_detection && svc->spatial_layer_id == 0) - rc_scene_detection_onepass_rt(cpi, frame_input); + if (cpi->sf.rt_sf.check_scene_detection && svc->spatial_layer_id == 0) { + if (rc->prev_coded_width == cm->width && + rc->prev_coded_height == cm->height) { + rc_scene_detection_onepass_rt(cpi, frame_input); + } else if (cpi->src_sad_blk_64x64) { + aom_free(cpi->src_sad_blk_64x64); + cpi->src_sad_blk_64x64 = NULL; + } + } // Check for dynamic resize, for single spatial layer for now. // For temporal layers only check on base temporal layer. if (cpi->oxcf.resize_cfg.resize_mode == RESIZE_DYNAMIC) { diff --git a/chromium/third_party/libaom/source/libaom/av1/encoder/ratectrl.h b/chromium/third_party/libaom/source/libaom/av1/encoder/ratectrl.h index df177b9c306..9bb6ca1be97 100644 --- a/chromium/third_party/libaom/source/libaom/av1/encoder/ratectrl.h +++ b/chromium/third_party/libaom/source/libaom/av1/encoder/ratectrl.h @@ -256,6 +256,9 @@ typedef struct { int frame_level_fast_extra_bits; double frame_level_rate_correction_factors[RATE_FACTOR_LEVELS]; + + int prev_coded_width; + int prev_coded_height; /*!\endcond */ } RATE_CONTROL; diff --git a/chromium/third_party/libxml/README.chromium b/chromium/third_party/libxml/README.chromium index c39d7620ce6..9813d7cd51b 100644 --- a/chromium/third_party/libxml/README.chromium +++ b/chromium/third_party/libxml/README.chromium @@ -1,6 +1,6 @@ Name: libxml URL: http://xmlsoft.org -Version: ad338ca737c4df5a4d1c28f8ee18b878572f2964 +Version: e85f9b98a5389c69167176ae6600091e719ec38f CPEPrefix: cpe:/a:xmlsoft:libxml2:2.9.13 License: MIT License File: src/Copyright diff --git a/chromium/third_party/libxml/chromium/roll.py b/chromium/third_party/libxml/chromium/roll.py index 9bfc5e3d5b8..b0d19513662 100755 --- a/chromium/third_party/libxml/chromium/roll.py +++ b/chromium/third_party/libxml/chromium/roll.py @@ -108,7 +108,6 @@ SHARED_XML_CONFIGURE_OPTIONS = [ ('--without-modules', 'modules=no'), ('--without-pattern', 'pattern=no'), ('--without-regexps', 'regexps=no'), - ('--without-run-debug', 'run_debug=no'), ('--without-schemas', 'schemas=no'), ('--without-schematron', 'schematron=no'), ('--without-valid', 'valid=no'), diff --git a/chromium/third_party/libxml/linux/config.h b/chromium/third_party/libxml/linux/config.h index 32338b4b1eb..964ffe59e2c 100644 --- a/chromium/third_party/libxml/linux/config.h +++ b/chromium/third_party/libxml/linux/config.h @@ -4,21 +4,12 @@ /* A form that will not confuse apibuild.py */ #define ATTRIBUTE_DESTRUCTOR __attribute__((destructor)) -/* Type cast for the gethostbyname() argument */ -#define GETHOSTBYNAME_ARG_CAST /**/ - /* Define to 1 if you have the <arpa/inet.h> header file. */ #define HAVE_ARPA_INET_H 1 -/* Define to 1 if you have the <arpa/nameser.h> header file. */ -#define HAVE_ARPA_NAMESER_H 1 - /* Define if __attribute__((destructor)) is accepted */ #define HAVE_ATTRIBUTE_DESTRUCTOR 1 -/* Whether struct sockaddr::__ss_family exists */ -/* #undef HAVE_BROKEN_SS_FAMILY */ - /* Define to 1 if you have the <dlfcn.h> header file. */ #define HAVE_DLFCN_H 1 @@ -34,12 +25,12 @@ /* Define to 1 if you have the `ftime' function. */ #define HAVE_FTIME 1 -/* Define if getaddrinfo is there */ -#define HAVE_GETADDRINFO /**/ - /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 +/* Define to 1 if you have the <glob.h> header file. */ +#define HAVE_GLOB_H 1 + /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 @@ -75,7 +66,7 @@ /* Define to 1 if you have the <poll.h> header file. */ #define HAVE_POLL_H 1 -/* Define if <pthread.h> is there */ +/* Define to 1 if you have the <pthread.h> header file. */ #define HAVE_PTHREAD_H /**/ /* Define to 1 if you have the `putenv' function. */ @@ -84,9 +75,6 @@ /* Define to 1 if you have the `rand_r' function. */ -/* Define to 1 if you have the <resolv.h> header file. */ -#define HAVE_RESOLV_H 1 - /* Have shl_load based dso */ /* #undef HAVE_SHLLOAD */ @@ -171,16 +159,13 @@ /* Define to the version of this package. */ #define PACKAGE_VERSION "2.11.0" -/* Type cast for the send() function 2nd arg */ -#define SEND_ARG2_CAST /**/ - /* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ #define STDC_HEADERS 1 /* Support for IPv6 */ -#define SUPPORT_IP6 /**/ +/* #undef SUPPORT_IP6 */ /* Define if va_list is an array type */ #define VA_LIST_IS_ARRAY 1 @@ -189,16 +174,13 @@ #define VERSION "2.11.0" /* Determine what socket length (socklen_t) data type is */ -#define XML_SOCKLEN_T socklen_t +/* #undef XML_SOCKLEN_T */ /* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>, <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the #define below would cause a syntax error. */ /* #undef _UINT32_T */ -/* ss_family is not defined here, use __ss_family instead */ -/* #undef ss_family */ - /* Define to the type of an unsigned integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ /* #undef uint32_t */ diff --git a/chromium/third_party/libxml/linux/include/libxml/xmlversion.h b/chromium/third_party/libxml/linux/include/libxml/xmlversion.h index d3849d0c447..d1a3059b7e9 100644 --- a/chromium/third_party/libxml/linux/include/libxml/xmlversion.h +++ b/chromium/third_party/libxml/linux/include/libxml/xmlversion.h @@ -313,7 +313,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); /** * LIBXML_DEBUG_RUNTIME: * - * Whether the runtime debugging is configured in + * Removed */ #if 0 #define LIBXML_DEBUG_RUNTIME @@ -409,12 +409,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #endif #ifdef __GNUC__ - -/** - * ATTRIBUTE_UNUSED: - * - * Macro used to signal to GCC unused function parameters - */ +/** DOC_DISABLE */ #ifndef ATTRIBUTE_UNUSED # if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) @@ -424,12 +419,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); # endif #endif -/** - * LIBXML_ATTR_ALLOC_SIZE: - * - * Macro used to indicate to GCC this is an allocator function - */ - #ifndef LIBXML_ATTR_ALLOC_SIZE # if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))) # define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x))) @@ -440,12 +429,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); # define LIBXML_ATTR_ALLOC_SIZE(x) #endif -/** - * LIBXML_ATTR_FORMAT: - * - * Macro used to indicate to GCC the parameter are printf like - */ - #ifndef LIBXML_ATTR_FORMAT # if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) # define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args))) @@ -465,6 +448,19 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); # endif #endif +#if defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) +#define XML_IGNORE_FPTR_CAST_WARNINGS \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \ + _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"") +#define XML_POP_WARNINGS \ + _Pragma("GCC diagnostic pop") +#else +#define XML_IGNORE_FPTR_CAST_WARNINGS +#define XML_POP_WARNINGS +#endif + +/** DOC_ENABLE */ #else /* ! __GNUC__ */ /** * ATTRIBUTE_UNUSED: @@ -493,6 +489,18 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #ifndef XML_DEPRECATED #define XML_DEPRECATED #endif +/** + * LIBXML_IGNORE_FPTR_CAST_WARNINGS: + * + * Macro used to ignore pointer cast warnings that can't be worked around. + */ +#define XML_IGNORE_FPTR_CAST_WARNINGS +/** + * LIBXML_POP_WARNINGS: + * + * Macro used to restore warnings state. + */ +#define XML_POP_WARNINGS #endif /* __GNUC__ */ #ifdef __cplusplus diff --git a/chromium/third_party/libxml/mac/config.h b/chromium/third_party/libxml/mac/config.h index 32338b4b1eb..964ffe59e2c 100644 --- a/chromium/third_party/libxml/mac/config.h +++ b/chromium/third_party/libxml/mac/config.h @@ -4,21 +4,12 @@ /* A form that will not confuse apibuild.py */ #define ATTRIBUTE_DESTRUCTOR __attribute__((destructor)) -/* Type cast for the gethostbyname() argument */ -#define GETHOSTBYNAME_ARG_CAST /**/ - /* Define to 1 if you have the <arpa/inet.h> header file. */ #define HAVE_ARPA_INET_H 1 -/* Define to 1 if you have the <arpa/nameser.h> header file. */ -#define HAVE_ARPA_NAMESER_H 1 - /* Define if __attribute__((destructor)) is accepted */ #define HAVE_ATTRIBUTE_DESTRUCTOR 1 -/* Whether struct sockaddr::__ss_family exists */ -/* #undef HAVE_BROKEN_SS_FAMILY */ - /* Define to 1 if you have the <dlfcn.h> header file. */ #define HAVE_DLFCN_H 1 @@ -34,12 +25,12 @@ /* Define to 1 if you have the `ftime' function. */ #define HAVE_FTIME 1 -/* Define if getaddrinfo is there */ -#define HAVE_GETADDRINFO /**/ - /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 +/* Define to 1 if you have the <glob.h> header file. */ +#define HAVE_GLOB_H 1 + /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 @@ -75,7 +66,7 @@ /* Define to 1 if you have the <poll.h> header file. */ #define HAVE_POLL_H 1 -/* Define if <pthread.h> is there */ +/* Define to 1 if you have the <pthread.h> header file. */ #define HAVE_PTHREAD_H /**/ /* Define to 1 if you have the `putenv' function. */ @@ -84,9 +75,6 @@ /* Define to 1 if you have the `rand_r' function. */ -/* Define to 1 if you have the <resolv.h> header file. */ -#define HAVE_RESOLV_H 1 - /* Have shl_load based dso */ /* #undef HAVE_SHLLOAD */ @@ -171,16 +159,13 @@ /* Define to the version of this package. */ #define PACKAGE_VERSION "2.11.0" -/* Type cast for the send() function 2nd arg */ -#define SEND_ARG2_CAST /**/ - /* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ #define STDC_HEADERS 1 /* Support for IPv6 */ -#define SUPPORT_IP6 /**/ +/* #undef SUPPORT_IP6 */ /* Define if va_list is an array type */ #define VA_LIST_IS_ARRAY 1 @@ -189,16 +174,13 @@ #define VERSION "2.11.0" /* Determine what socket length (socklen_t) data type is */ -#define XML_SOCKLEN_T socklen_t +/* #undef XML_SOCKLEN_T */ /* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>, <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the #define below would cause a syntax error. */ /* #undef _UINT32_T */ -/* ss_family is not defined here, use __ss_family instead */ -/* #undef ss_family */ - /* Define to the type of an unsigned integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ /* #undef uint32_t */ diff --git a/chromium/third_party/libxml/mac/include/libxml/xmlversion.h b/chromium/third_party/libxml/mac/include/libxml/xmlversion.h index d3849d0c447..d1a3059b7e9 100644 --- a/chromium/third_party/libxml/mac/include/libxml/xmlversion.h +++ b/chromium/third_party/libxml/mac/include/libxml/xmlversion.h @@ -313,7 +313,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); /** * LIBXML_DEBUG_RUNTIME: * - * Whether the runtime debugging is configured in + * Removed */ #if 0 #define LIBXML_DEBUG_RUNTIME @@ -409,12 +409,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #endif #ifdef __GNUC__ - -/** - * ATTRIBUTE_UNUSED: - * - * Macro used to signal to GCC unused function parameters - */ +/** DOC_DISABLE */ #ifndef ATTRIBUTE_UNUSED # if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) @@ -424,12 +419,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); # endif #endif -/** - * LIBXML_ATTR_ALLOC_SIZE: - * - * Macro used to indicate to GCC this is an allocator function - */ - #ifndef LIBXML_ATTR_ALLOC_SIZE # if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))) # define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x))) @@ -440,12 +429,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); # define LIBXML_ATTR_ALLOC_SIZE(x) #endif -/** - * LIBXML_ATTR_FORMAT: - * - * Macro used to indicate to GCC the parameter are printf like - */ - #ifndef LIBXML_ATTR_FORMAT # if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) # define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args))) @@ -465,6 +448,19 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); # endif #endif +#if defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) +#define XML_IGNORE_FPTR_CAST_WARNINGS \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \ + _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"") +#define XML_POP_WARNINGS \ + _Pragma("GCC diagnostic pop") +#else +#define XML_IGNORE_FPTR_CAST_WARNINGS +#define XML_POP_WARNINGS +#endif + +/** DOC_ENABLE */ #else /* ! __GNUC__ */ /** * ATTRIBUTE_UNUSED: @@ -493,6 +489,18 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #ifndef XML_DEPRECATED #define XML_DEPRECATED #endif +/** + * LIBXML_IGNORE_FPTR_CAST_WARNINGS: + * + * Macro used to ignore pointer cast warnings that can't be worked around. + */ +#define XML_IGNORE_FPTR_CAST_WARNINGS +/** + * LIBXML_POP_WARNINGS: + * + * Macro used to restore warnings state. + */ +#define XML_POP_WARNINGS #endif /* __GNUC__ */ #ifdef __cplusplus diff --git a/chromium/third_party/libxml/src/CMakeLists.txt b/chromium/third_party/libxml/src/CMakeLists.txt index 730aec725dc..ccb225407b6 100644 --- a/chromium/third_party/libxml/src/CMakeLists.txt +++ b/chromium/third_party/libxml/src/CMakeLists.txt @@ -44,7 +44,6 @@ option(LIBXML2_WITH_PUSH "Add the PUSH parser interfaces" ON) option(LIBXML2_WITH_PYTHON "Build Python bindings" ON) option(LIBXML2_WITH_READER "Add the xmlReader parsing interface" ON) option(LIBXML2_WITH_REGEXPS "Add Regular Expressions support" ON) -option(LIBXML2_WITH_RUN_DEBUG "Add the runtime debugging module" OFF) option(LIBXML2_WITH_SAX1 "Add the older SAX1 interface" ON) option(LIBXML2_WITH_SCHEMAS "Add Relax-NG and Schemas support" ON) option(LIBXML2_WITH_SCHEMATRON "Add Schematron support" ON) @@ -78,15 +77,10 @@ endif() if(LIBXML2_WITH_PYTHON) check_include_files(unistd.h HAVE_UNISTD_H) check_symbol_exists(F_GETFL fcntl.h HAVE_F_GETFL) - if(HAVE_UNISTD_H AND HAVE_F_GETFL) - find_package(Python COMPONENTS Interpreter Development REQUIRED) - else() - find_package(Python2 COMPONENTS Interpreter Development REQUIRED) - add_library(Python::Python ALIAS Python2::Python) - set(Python_EXECUTABLE ${Python2_EXECUTABLE}) - set(Python_SITEARCH ${Python2_SITEARCH}) - endif() - set(LIBXML2_PYTHON_INSTALL_DIR ${Python_SITEARCH} CACHE PATH "Python bindings install directory") + find_package(Python COMPONENTS Interpreter Development REQUIRED) + #set(LIBXML2_PYTHON_INSTALL_DIR ${Python_SITEARCH} CACHE PATH "Python bindings install directory") + set(LIBXML2_PYTHON_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/python" + CACHE PATH "Python bindings install directory") endif() if(LIBXML2_WITH_THREADS) @@ -97,7 +91,7 @@ if(LIBXML2_WITH_ZLIB) find_package(ZLIB REQUIRED) endif() -foreach(VARIABLE IN ITEMS WITH_AUTOMATA WITH_C14N WITH_CATALOG WITH_DEBUG WITH_EXPR WITH_FTP WITH_HTML WITH_HTTP WITH_ICONV WITH_ICU WITH_ISO8859X WITH_LEGACY WITH_LZMA WITH_MEM_DEBUG WITH_MODULES WITH_OUTPUT WITH_PATTERN WITH_PUSH WITH_READER WITH_REGEXPS WITH_RUN_DEBUG WITH_SAX1 WITH_SCHEMAS WITH_SCHEMATRON WITH_THREADS WITH_THREAD_ALLOC WITH_TREE WITH_TRIO WITH_UNICODE WITH_VALID WITH_WRITER WITH_XINCLUDE WITH_XPATH WITH_XPTR WITH_XPTR_LOCS WITH_ZLIB) +foreach(VARIABLE IN ITEMS WITH_AUTOMATA WITH_C14N WITH_CATALOG WITH_DEBUG WITH_EXPR WITH_FTP WITH_HTML WITH_HTTP WITH_ICONV WITH_ICU WITH_ISO8859X WITH_LEGACY WITH_LZMA WITH_MEM_DEBUG WITH_MODULES WITH_OUTPUT WITH_PATTERN WITH_PUSH WITH_READER WITH_REGEXPS WITH_SAX1 WITH_SCHEMAS WITH_SCHEMATRON WITH_THREADS WITH_THREAD_ALLOC WITH_TREE WITH_TRIO WITH_UNICODE WITH_VALID WITH_WRITER WITH_XINCLUDE WITH_XPATH WITH_XPTR WITH_XPTR_LOCS WITH_ZLIB) if(LIBXML2_${VARIABLE}) set(${VARIABLE} 1) else() @@ -144,22 +138,7 @@ if (NOT MSVC) if(HAVE_ATTRIBUTE_DESTRUCTOR) set(ATTRIBUTE_DESTRUCTOR "__attribute__((destructor))") endif() - check_c_source_compiles(" - #include <netdb.h> - int main() { (void) gethostbyname((const char*) \"\"); return 0; } - " GETHOSTBYNAME_ARG_CAST_CONST) - if(NOT GETHOSTBYNAME_ARG_CAST_CONST) - set(GETHOSTBYNAME_ARG_CAST "(char *)") - else() - set(GETHOSTBYNAME_ARG_CAST "/**/") - endif() check_include_files(arpa/inet.h HAVE_ARPA_INET_H) - check_include_files(arpa/nameser.h HAVE_ARPA_NAMESER_H) - check_struct_has_member("struct sockaddr_storage" ss_family "sys/socket.h;sys/types.h" HAVE_SS_FAMILY) - check_struct_has_member("struct sockaddr_storage" __ss_family "sys/socket.h;sys/types.h" HAVE_BROKEN_SS_FAMILY) - if(HAVE_BROKEN_SS_FAMILY) - set(ss_family __ss_family) - endif() check_function_exists(class HAVE_CLASS) check_include_files(dlfcn.h HAVE_DLFCN_H) check_library_exists(dl dlopen "" HAVE_DLOPEN) @@ -167,7 +146,6 @@ if (NOT MSVC) check_include_files(fcntl.h HAVE_FCNTL_H) check_function_exists(fpclass HAVE_FPCLASS) check_function_exists(ftime HAVE_FTIME) - check_function_exists(getaddrinfo HAVE_GETADDRINFO) check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) check_include_files(inttypes.h HAVE_INTTYPES_H) check_function_exists(isascii HAVE_ISASCII) @@ -180,7 +158,6 @@ if (NOT MSVC) check_include_files(poll.h HAVE_POLL_H) check_function_exists(putenv HAVE_PUTENV) check_function_exists(rand_r HAVE_RAND_R) - check_include_files(resolv.h HAVE_RESOLV_H) check_library_exists(dld shl_load "" HAVE_SHLLOAD) check_function_exists(stat HAVE_STAT) check_include_files(stdint.h HAVE_STDINT_H) @@ -190,22 +167,11 @@ if (NOT MSVC) check_include_files(sys/stat.h HAVE_SYS_STAT_H) check_include_files(sys/timeb.h HAVE_SYS_TIMEB_H) check_include_files(sys/time.h HAVE_SYS_TIME_H) - check_include_files(sys/types.h HAVE_SYS_TYPES_H) check_include_files(unistd.h HAVE_UNISTD_H) check_function_exists(va_copy HAVE_VA_COPY) check_function_exists(__va_copy HAVE___VA_COPY) set(LT_OBJDIR ".libs/") check_c_source_compiles(" - #include <sys/socket.h> - #include <sys/types.h> - int main() { (void) send(1, (const char*) \"\", 1, 1); return 0; } - " SEND_ARG2_CAST_CONST) - if(NOT SEND_ARG2_CAST_CONST) - set(SEND_ARG2_CAST "(char *)") - else() - set(SEND_ARG2_CAST "/**/") - endif() - check_c_source_compiles(" #include <stdarg.h> void a(va_list* ap) {}; int main() { va_list ap1, ap2; a(&ap1); ap2 = (va_list) ap1; return 0; } @@ -218,7 +184,6 @@ if (NOT MSVC) check_c_source_compiles(" #include <stddef.h> #include <sys/socket.h> - #include <sys/types.h> int main() { (void) getsockopt(1, 1, 1, NULL, (socklen_t*) NULL); return 0; } " XML_SOCKLEN_T_SOCKLEN_T) if(XML_SOCKLEN_T_SOCKLEN_T) @@ -227,7 +192,6 @@ if (NOT MSVC) check_c_source_compiles(" #include <stddef.h> #include <sys/socket.h> - #include <sys/types.h> int main() { (void) getsockopt(1, 1, 1, NULL, (size_t*) NULL); return 0; } " XML_SOCKLEN_T_SIZE_T) if(XML_SOCKLEN_T_SIZE_T) @@ -236,7 +200,6 @@ if (NOT MSVC) check_c_source_compiles(" #include <stddef.h> #include <sys/socket.h> - #include <sys/types.h> int main() { (void) getsockopt (1, 1, 1, NULL, (int*) NULL); return 0; } " XML_SOCKLEN_T_INT) set(XML_SOCKLEN_T int) @@ -363,21 +326,24 @@ add_library(LibXml2::LibXml2 ALIAS LibXml2) target_compile_definitions(LibXml2 PRIVATE SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}") if(NOT BUILD_SHARED_LIBS) - target_compile_definitions(LibXml2 INTERFACE LIBXML_STATIC) + target_compile_definitions(LibXml2 PUBLIC LIBXML_STATIC) set(XML_CFLAGS "-DLIBXML_STATIC") endif() -if(BUILD_SHARED_LIBS AND UNIX AND NOT APPLE) - if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "GNU") +if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "GNU") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Wshadow \ +-Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return \ +-Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline \ +-Wredundant-decls -Wno-long-long -Wno-format-extra-args") + + if(BUILD_SHARED_LIBS AND UNIX AND NOT APPLE) target_link_options(LibXml2 PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libxml2.syms") endif() endif() if(LIBXML2_WITH_THREADS) target_compile_definitions(LibXml2 PRIVATE _REENTRANT) - if(WIN32) - target_compile_definitions(LibXml2 PRIVATE HAVE_WIN32_THREADS) - else() + if(NOT WIN32) check_include_files(pthread.h HAVE_PTHREAD_H) endif() endif() @@ -407,7 +373,7 @@ endif() if(WIN32) target_link_libraries(LibXml2 PRIVATE ws2_32) - set(WIN32_EXTRA_LIBADD "-lws2_32") + set(WINSOCK_LIBS "-lws2_32") endif() if(LIBXML2_WITH_ICONV) @@ -449,6 +415,7 @@ set_target_properties( POSITION_INDEPENDENT_CODE ON PREFIX lib VERSION ${PROJECT_VERSION} + SOVERSION ${LIBXML_MAJOR_VERSION} ) if(MSVC) @@ -513,7 +480,6 @@ if(LIBXML2_WITH_TESTS) runxmlconf runsuite testapi - testAutomata testchar testdict testModule @@ -528,9 +494,6 @@ if(LIBXML2_WITH_TESTS) endforeach() if(Threads_FOUND) foreach(TEST runtest testThreads) - if(WIN32) - target_compile_definitions(${TEST} PRIVATE HAVE_WIN32_THREADS) - endif() target_link_libraries(${TEST} Threads::Threads) endforeach() endif() @@ -584,6 +547,9 @@ if(LIBXML2_WITH_PYTHON) PREFIX lib VERSION ${PROJECT_VERSION} ) + if (WIN32) + set_target_properties(LibXml2Mod PROPERTIES SUFFIX ".pyd") + endif() install( TARGETS LibXml2Mod ARCHIVE DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT development @@ -655,7 +621,7 @@ endif() set(XML_INCLUDEDIR "-I\${includedir}/libxml2") set(XML_LIBDIR "-L\${libdir}") set(XML_LIBS "-lxml2") -set(XML_PRIVATE_LIBS "${Z_LIBS} ${LZMA_LIBS} ${THREAD_LIBS} ${ICONV_LIBS} ${ICU_LIBS} ${LIBM} ${WIN32_EXTRA_LIBADD}") +set(XML_PRIVATE_LIBS "${Z_LIBS} ${LZMA_LIBS} ${THREAD_LIBS} ${ICONV_LIBS} ${ICU_LIBS} ${LIBM} ${WINSOCK_LIBS}") file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig" "${CMAKE_INSTALL_PREFIX}") string(REGEX REPLACE "/$" "" PACKAGE_RELATIVE_PATH "${PACKAGE_RELATIVE_PATH}") diff --git a/chromium/third_party/libxml/src/HTMLparser.c b/chromium/third_party/libxml/src/HTMLparser.c index fd71aee89f9..93b6661ba93 100644 --- a/chromium/third_party/libxml/src/HTMLparser.c +++ b/chromium/third_party/libxml/src/HTMLparser.c @@ -326,7 +326,7 @@ htmlNodeInfoPop(htmlParserCtxtPtr ctxt) #define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l) #define COPY_BUF(l,b,i,v) \ - if (l == 1) b[i++] = (xmlChar) v; \ + if (l == 1) b[i++] = v; \ else i += xmlCopyChar(l,&b[i],v) /** @@ -2074,8 +2074,8 @@ static const htmlEntityDesc html40EntitiesTable[] = { #define growBuffer(buffer) { \ xmlChar *tmp; \ buffer##_size *= 2; \ - tmp = (xmlChar *) xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \ - if (tmp == NULL) { \ + tmp = (xmlChar *) xmlRealloc(buffer, buffer##_size); \ + if (tmp == NULL) { \ htmlErrMemory(ctxt, "growing buffer\n"); \ xmlFree(buffer); \ return(NULL); \ @@ -2744,7 +2744,7 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) { * allocate a translation buffer. */ buffer_size = HTML_PARSER_BUFFER_SIZE; - buffer = (xmlChar *) xmlMallocAtomic(buffer_size * sizeof(xmlChar)); + buffer = (xmlChar *) xmlMallocAtomic(buffer_size); if (buffer == NULL) { htmlErrMemory(ctxt, "buffer allocation failed\n"); return(NULL); @@ -3380,7 +3380,7 @@ htmlParsePI(htmlParserCtxtPtr ctxt) { ctxt->instate = state; return; } - buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); + buf = (xmlChar *) xmlMallocAtomic(size); if (buf == NULL) { htmlErrMemory(ctxt, NULL); ctxt->instate = state; @@ -3398,7 +3398,7 @@ htmlParsePI(htmlParserCtxtPtr ctxt) { xmlChar *tmp; size *= 2; - tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); + tmp = (xmlChar *) xmlRealloc(buf, size); if (tmp == NULL) { htmlErrMemory(ctxt, NULL); xmlFree(buf); @@ -3480,7 +3480,7 @@ htmlParseComment(htmlParserCtxtPtr ctxt) { ctxt->instate = XML_PARSER_COMMENT; SHRINK; SKIP(4); - buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); + buf = (xmlChar *) xmlMallocAtomic(size); if (buf == NULL) { htmlErrMemory(ctxt, "buffer allocation failed\n"); ctxt->instate = state; @@ -3529,7 +3529,7 @@ htmlParseComment(htmlParserCtxtPtr ctxt) { xmlChar *tmp; size *= 2; - tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); + tmp = (xmlChar *) xmlRealloc(buf, size); if (tmp == NULL) { xmlFree(buf); htmlErrMemory(ctxt, "growing buffer failed\n"); @@ -5924,7 +5924,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { * Handle preparsed entities and charRef */ if (ctxt->token != 0) { - chr[0] = (xmlChar) ctxt->token; + chr[0] = ctxt->token; htmlCheckParagraph(ctxt); if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) ctxt->sax->characters(ctxt->userData, chr, 1); diff --git a/chromium/third_party/libxml/src/Makefile.am b/chromium/third_party/libxml/src/Makefile.am index 8d6358e84a4..d567c07cc6b 100644 --- a/chromium/third_party/libxml/src/Makefile.am +++ b/chromium/third_party/libxml/src/Makefile.am @@ -2,22 +2,22 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = include . doc example fuzz xstc +SUBDIRS = include . doc example xstc if WITH_PYTHON SUBDIRS += python endif +if WITH_GLOB +SUBDIRS += fuzz +endif DIST_SUBDIRS = include . doc example fuzz python xstc AM_CPPFLAGS = -I$(top_builddir)/include -I$(srcdir)/include -DSYSCONFDIR='"$(sysconfdir)"' -AM_CFLAGS = $(EXTRA_CFLAGS) - check_PROGRAMS = \ runsuite \ runtest \ runxmlconf \ - testAutomata \ testModule \ testThreads \ testapi \ @@ -31,36 +31,86 @@ bin_PROGRAMS = xmllint xmlcatalog bin_SCRIPTS = xml2-config lib_LTLIBRARIES = libxml2.la -libxml2_la_CFLAGS = $(EXTRA_CFLAGS) $(THREAD_CFLAGS) $(Z_CFLAGS) $(LZMA_CFLAGS) +libxml2_la_CFLAGS = $(AM_CFLAGS) $(XML_PRIVATE_CFLAGS) libxml2_la_LIBADD = $(XML_PRIVATE_LIBS) -if USE_VERSION_SCRIPT -LIBXML2_VERSION_SCRIPT = $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxml2.syms -else -LIBXML2_VERSION_SCRIPT = -endif - -libxml2_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) \ - $(LIBXML2_VERSION_SCRIPT) \ +libxml2_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined \ -version-info $(LIBXML_VERSION_INFO) \ $(MODULE_PLATFORM_LIBS) +if USE_VERSION_SCRIPT +libxml2_la_LDFLAGS += $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxml2.syms +endif +libxml2_la_SOURCES = buf.c chvalid.c dict.c entities.c encoding.c error.c \ + globals.c hash.c list.c parser.c parserInternals.c \ + SAX2.c threads.c tree.c uri.c valid.c xmlIO.c \ + xmlmemory.c xmlstring.c +if WITH_C14N_SOURCES +libxml2_la_SOURCES += c14n.c +endif +if WITH_CATALOG_SOURCES +libxml2_la_SOURCES += catalog.c +endif +if WITH_DEBUG_SOURCES +libxml2_la_SOURCES += debugXML.c +endif +if WITH_FTP_SOURCES +libxml2_la_SOURCES += nanoftp.c +endif +if WITH_HTML_SOURCES +libxml2_la_SOURCES += HTMLparser.c HTMLtree.c +endif +if WITH_HTTP_SOURCES +libxml2_la_SOURCES += nanohttp.c +endif +if WITH_LEGACY_SOURCES +libxml2_la_SOURCES += legacy.c +if WITH_SAX1_SOURCES +libxml2_la_SOURCES += SAX.c +endif +endif +if WITH_LZMA_SOURCES +libxml2_la_SOURCES += xzlib.c +endif +if WITH_MODULES_SOURCES +libxml2_la_SOURCES += xmlmodule.c +endif +if WITH_OUTPUT_SOURCES +libxml2_la_SOURCES += xmlsave.c +endif +if WITH_PATTERN_SOURCES +libxml2_la_SOURCES += pattern.c +endif +if WITH_READER_SOURCES +libxml2_la_SOURCES += xmlreader.c +endif +if WITH_REGEXPS_SOURCES +libxml2_la_SOURCES += xmlregexp.c xmlunicode.c +endif +if WITH_SCHEMAS_SOURCES +libxml2_la_SOURCES += relaxng.c xmlschemas.c xmlschemastypes.c +if !WITH_XPATH_SOURCES +libxml2_la_SOURCES += xpath.c +endif +endif +if WITH_SCHEMATRON_SOURCES +libxml2_la_SOURCES += schematron.c +endif if WITH_TRIO_SOURCES -trio_sources = triostr.c trio.c -else -trio_sources = +libxml2_la_SOURCES += triostr.c trio.c +endif +if WITH_WRITER_SOURCES +libxml2_la_SOURCES += xmlwriter.c +endif +if WITH_XINCLUDE_SOURCES +libxml2_la_SOURCES += xinclude.c +endif +if WITH_XPATH_SOURCES +libxml2_la_SOURCES += xpath.c +endif +if WITH_XPTR_SOURCES +libxml2_la_SOURCES += xlink.c xpointer.c endif - -libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \ - parser.c tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c \ - valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.c \ - xpointer.c xinclude.c nanohttp.c nanoftp.c \ - catalog.c globals.c threads.c c14n.c xmlstring.c buf.c \ - xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \ - $(trio_sources) \ - xmlreader.c relaxng.c dict.c SAX2.c \ - xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c \ - xmlmodule.c schematron.c xzlib.c DEPS = $(top_builddir)/libxml2.la LDADDS = $(top_builddir)/libxml2.la @@ -70,65 +120,52 @@ m4datadir = $(datadir)/aclocal dist_m4data_DATA = libxml.m4 runtest_SOURCES=runtest.c -runtest_CFLAGS = $(EXTRA_CFLAGS) $(THREAD_CFLAGS) -runtest_LDFLAGS = +runtest_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS) runtest_DEPENDENCIES = $(DEPS) runtest_LDADD= $(BASE_THREAD_LIBS) $(THREAD_LIBS) $(LDADDS) testrecurse_SOURCES=testrecurse.c -testrecurse_LDFLAGS = testrecurse_DEPENDENCIES = $(DEPS) testrecurse_LDADD= $(LDADDS) testlimits_SOURCES=testlimits.c -testlimits_LDFLAGS = testlimits_DEPENDENCIES = $(DEPS) testlimits_LDADD= $(LDADDS) testchar_SOURCES=testchar.c -testchar_LDFLAGS = testchar_DEPENDENCIES = $(DEPS) testchar_LDADD= $(LDADDS) testdict_SOURCES=testdict.c -testdict_LDFLAGS = testdict_DEPENDENCIES = $(DEPS) testdict_LDADD= $(LDADDS) runsuite_SOURCES=runsuite.c -runsuite_LDFLAGS = runsuite_DEPENDENCIES = $(DEPS) runsuite_LDADD= $(LDADDS) xmllint_SOURCES=xmllint.c -xmllint_LDFLAGS = +xmllint_CFLAGS = $(AM_CFLAGS) $(RDL_CFLAGS) xmllint_DEPENDENCIES = $(DEPS) xmllint_LDADD= $(RDL_LIBS) $(LDADDS) xmlcatalog_SOURCES=xmlcatalog.c -xmlcatalog_LDFLAGS = xmlcatalog_DEPENDENCIES = $(DEPS) xmlcatalog_LDADD = $(RDL_LIBS) $(LDADDS) testThreads_SOURCES = testThreads.c -testThreads_CFLAGS = $(EXTRA_CFLAGS) $(THREAD_CFLAGS) -testThreads_LDFLAGS = +testThreads_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS) testThreads_DEPENDENCIES = $(DEPS) testThreads_LDADD= $(BASE_THREAD_LIBS) $(THREAD_LIBS) $(LDADDS) -testAutomata_SOURCES=testAutomata.c -testAutomata_LDFLAGS = -testAutomata_DEPENDENCIES = $(DEPS) -testAutomata_LDADD= $(LDADDS) - testModule_SOURCES=testModule.c -testModule_LDFLAGS = testModule_DEPENDENCIES = $(DEPS) testModule_LDADD= $(LDADDS) noinst_LTLIBRARIES = testdso.la testdso_la_SOURCES = testdso.c -testdso_la_LDFLAGS = -module -no-undefined -avoid-version -rpath $(libdir) +testdso_la_LDFLAGS = $(AM_LDFLAGS) \ + -module -no-undefined -avoid-version -rpath $(libdir) # that one forces the rebuild when "make rebuild" is run on doc/ rebuild_testapi: @@ -136,17 +173,14 @@ rebuild_testapi: $(PYTHON) $(srcdir)/gentest.py $(srcdir) ; fi ) testapi_SOURCES=testapi.c -testapi_LDFLAGS = testapi_DEPENDENCIES = $(DEPS) testapi_LDADD= $(LDADDS) runxmlconf_SOURCES=runxmlconf.c -runxmlconf_LDFLAGS = runxmlconf_DEPENDENCIES = $(DEPS) runxmlconf_LDADD= $(LDADDS) #testOOM_SOURCES=testOOM.c testOOMlib.h testOOMlib.c -#testOOM_LDFLAGS = #testOOM_DEPENDENCIES = $(DEPS) #testOOM_LDADD= $(LDADDS) @@ -175,7 +209,27 @@ asan: ./configure CFLAGS="-fsanitize=address,undefined -Wformat -Werror=format-security -Werror=array-bounds -g" CXXFLAGS="-fsanitize=address,undefined -Wformat -Werror=format-security -Werror=array-bounds -g" LDFLAGS="-fsanitize=address,undefined" CC="clang" CXX="clang++" --disable-shared ; OptimOff ; $(MAKE) clean ; $(MAKE) # Old test suite. This should be ported to C. -tests: $(TEST_DEBUG) $(TEST_CATALOG) $(TEST_REGEXPS) $(TEST_SCHEMATRON) Timingtests $(TEST_VTIME) $(PYTHON_TESTS) + +OLD_TESTS = Timingtests +if WITH_CATALOG_SOURCES +OLD_TESTS += Catatests +endif +if WITH_DEBUG_SOURCES +OLD_TESTS += Scripttests +endif +if WITH_SCHEMAS_SOURCES +if WITH_PYTHON +OLD_TESTS += RelaxNGPythonTests SchemasPythonTests +endif +endif +if WITH_SCHEMATRON_SOURCES +OLD_TESTS += Schematrontests +endif +if WITH_VALID_SOURCES +OLD_TESTS += VTimingtests +endif + +tests: $(OLD_TESTS) Scripttests : xmllint$(EXEEXT) @(echo > .memdump) @@ -252,24 +306,6 @@ Catatests : xmlcatalog$(EXEEXT) grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \ rm -f $(srcdir)/result/catalogs/mycatalog) -Automatatests: testAutomata$(EXEEXT) - @(echo > .memdump) - @echo "## Automata regression tests" - -@(for i in $(srcdir)/test/automata/* ; do \ - name=`basename $$i`; \ - if [ ! -d $$i ] ; then \ - if [ ! -f $(srcdir)/result/automata/$$name ] ; then \ - echo New test file $$name ; \ - $(CHECKER) $(top_builddir)/testAutomata $$i > $(srcdir)/result/automata/$$name; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - else \ - log=`$(CHECKER) $(top_builddir)/testAutomata $$i 2>&1 > result.$$name ; \ - grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ - diff $(srcdir)/result/automata/$$name result.$$name` ; \ - if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \ - rm result.$$name ; \ - fi ; fi ; done) - dba100000.xml: dbgenattr.pl @echo "## generating dba100000.xml" @($(PERL) $(top_srcdir)/dbgenattr.pl 100000 > dba100000.xml) @@ -423,7 +459,7 @@ LCOV = /usr/bin/lcov GENHTML = /usr/bin/genhtml cov: clean-cov - if [ "`echo $(LDFLAGS) | grep coverage`" = "" ] ; then \ + if [ "`echo $(AM_LDFLAGS) | grep coverage`" = "" ] ; then \ echo not configured with coverage; exit 1 ; fi if [ ! -x $(LCOV) -o ! -x $(GENHTML) ] ; then \ echo Need $(LCOV) and $(GENHTML) excecutables; exit 1 ; fi diff --git a/chromium/third_party/libxml/src/SAX2.c b/chromium/third_party/libxml/src/SAX2.c index 3ed2e549eed..3d75751e4be 100644 --- a/chromium/third_party/libxml/src/SAX2.c +++ b/chromium/third_party/libxml/src/SAX2.c @@ -1642,7 +1642,7 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts) ctxt->nodemem = -1; if (ctxt->linenumbers) { if (ctxt->input != NULL) { - if (ctxt->input->line < USHRT_MAX) + if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX) ret->line = ctxt->input->line; else ret->line = USHRT_MAX; @@ -1907,7 +1907,7 @@ skip: if (ctxt->linenumbers) { if (ctxt->input != NULL) { - if (ctxt->input->line < USHRT_MAX) + if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX) ret->line = ctxt->input->line; else { ret->line = USHRT_MAX; @@ -2285,7 +2285,7 @@ xmlSAX2StartElementNs(void *ctx, } if (ctxt->linenumbers) { if (ctxt->input != NULL) { - if (ctxt->input->line < USHRT_MAX) + if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX) ret->line = ctxt->input->line; else ret->line = USHRT_MAX; @@ -2710,7 +2710,7 @@ xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target, if (ctxt->linenumbers) { if (ctxt->input != NULL) { - if (ctxt->input->line < USHRT_MAX) + if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX) ret->line = ctxt->input->line; else ret->line = USHRT_MAX; @@ -2770,7 +2770,7 @@ xmlSAX2Comment(void *ctx, const xmlChar *value) if (ret == NULL) return; if (ctxt->linenumbers) { if (ctxt->input != NULL) { - if (ctxt->input->line < USHRT_MAX) + if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX) ret->line = ctxt->input->line; else ret->line = USHRT_MAX; diff --git a/chromium/third_party/libxml/src/buf.c b/chromium/third_party/libxml/src/buf.c index 85313b6c628..9b2a7d198ff 100644 --- a/chromium/third_party/libxml/src/buf.c +++ b/chromium/third_party/libxml/src/buf.c @@ -135,7 +135,7 @@ xmlBufCreate(void) { ret->size = xmlDefaultBufferSize; UPDATE_COMPAT(ret); ret->alloc = xmlBufferAllocScheme; - ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar)); + ret->content = (xmlChar *) xmlMallocAtomic(ret->size); if (ret->content == NULL) { xmlBufMemoryError(ret, "creating buffer"); xmlFree(ret); @@ -171,7 +171,7 @@ xmlBufCreateSize(size_t size) { ret->size = (size ? size + 1 : 0); /* +1 for ending null */ UPDATE_COMPAT(ret); if (ret->size){ - ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar)); + ret->content = (xmlChar *) xmlMallocAtomic(ret->size); if (ret->content == NULL) { xmlBufMemoryError(ret, "creating buffer"); xmlFree(ret); @@ -538,7 +538,7 @@ xmlBufDump(FILE *file, xmlBufPtr buf) { CHECK_COMPAT(buf) if (file == NULL) file = stdout; - ret = fwrite(buf->content, sizeof(xmlChar), buf->use, file); + ret = fwrite(buf->content, 1, buf->use, file); return(ret); } @@ -865,7 +865,7 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) { } } - memmove(&buf->content[buf->use], str, len*sizeof(xmlChar)); + memmove(&buf->content[buf->use], str, len); buf->use += len; buf->content[buf->use] = 0; UPDATE_COMPAT(buf) diff --git a/chromium/third_party/libxml/src/config.h.cmake.in b/chromium/third_party/libxml/src/config.h.cmake.in index 1f8be710f53..5177e45a9fe 100644 --- a/chromium/third_party/libxml/src/config.h.cmake.in +++ b/chromium/third_party/libxml/src/config.h.cmake.in @@ -4,18 +4,9 @@ /* Define if __attribute__((destructor)) is accepted */ #cmakedefine ATTRIBUTE_DESTRUCTOR @ATTRIBUTE_DESTRUCTOR@ -/* Type cast for the gethostbyname() argument */ -#cmakedefine GETHOSTBYNAME_ARG_CAST @GETHOSTBYNAME_ARG_CAST@ - /* Define to 1 if you have the <arpa/inet.h> header file. */ #cmakedefine HAVE_ARPA_INET_H 1 -/* Define to 1 if you have the <arpa/nameser.h> header file. */ -#cmakedefine HAVE_ARPA_NAMESER_H 1 - -/* Whether struct sockaddr::__ss_family exists */ -#cmakedefine HAVE_BROKEN_SS_FAMILY 1 - /* Define to 1 if you have the <dlfcn.h> header file. */ #cmakedefine HAVE_DLFCN_H 1 @@ -31,9 +22,6 @@ /* Define to 1 if you have the `ftime' function. */ #cmakedefine HAVE_FTIME 1 -/* Define if getaddrinfo is there */ -#cmakedefine HAVE_GETADDRINFO 1 - /* Define to 1 if you have the `gettimeofday' function. */ #cmakedefine HAVE_GETTIMEOFDAY 1 @@ -78,9 +66,6 @@ /* Define to 1 if you have the `rand_r' function. */ #cmakedefine HAVE_RAND_R 1 -/* Define to 1 if you have the <resolv.h> header file. */ -#cmakedefine HAVE_RESOLV_H 1 - /* Have shl_load based dso */ #cmakedefine HAVE_SHLLOAD 1 @@ -108,9 +93,6 @@ /* Define to 1 if you have the <sys/time.h> header file. */ #cmakedefine HAVE_SYS_TIME_H 1 -/* Define to 1 if you have the <sys/types.h> header file. */ -#cmakedefine HAVE_SYS_TYPES_H 1 - /* Define to 1 if you have the <unistd.h> header file. */ #cmakedefine HAVE_UNISTD_H 1 @@ -147,9 +129,6 @@ /* Define to the version of this package. */ #define PACKAGE_VERSION "@PACKAGE_VERSION@" -/* Type cast for the send() function 2nd arg */ -#cmakedefine SEND_ARG2_CAST @SEND_ARG2_CAST@ - /* Support for IPv6 */ #cmakedefine SUPPORT_IP6 1 @@ -167,9 +146,6 @@ #define below would cause a syntax error. */ #cmakedefine _UINT32_T @_UINT32_T@ -/* ss_family is not defined here, use __ss_family instead */ -#cmakedefine ss_family @ss_family@ - /* Define to the type of an unsigned integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ #cmakedefine uint32_t @uint32_t@ diff --git a/chromium/third_party/libxml/src/config.h.in b/chromium/third_party/libxml/src/config.h.in index c2dd854eb85..0c87bf54c2a 100644 --- a/chromium/third_party/libxml/src/config.h.in +++ b/chromium/third_party/libxml/src/config.h.in @@ -3,21 +3,12 @@ /* A form that will not confuse apibuild.py */ #undef ATTRIBUTE_DESTRUCTOR -/* Type cast for the gethostbyname() argument */ -#undef GETHOSTBYNAME_ARG_CAST - /* Define to 1 if you have the <arpa/inet.h> header file. */ #undef HAVE_ARPA_INET_H -/* Define to 1 if you have the <arpa/nameser.h> header file. */ -#undef HAVE_ARPA_NAMESER_H - /* Define if __attribute__((destructor)) is accepted */ #undef HAVE_ATTRIBUTE_DESTRUCTOR -/* Whether struct sockaddr::__ss_family exists */ -#undef HAVE_BROKEN_SS_FAMILY - /* Define to 1 if you have the <dlfcn.h> header file. */ #undef HAVE_DLFCN_H @@ -33,12 +24,12 @@ /* Define to 1 if you have the `ftime' function. */ #undef HAVE_FTIME -/* Define if getaddrinfo is there */ -#undef HAVE_GETADDRINFO - /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY +/* Define to 1 if you have the <glob.h> header file. */ +#undef HAVE_GLOB_H + /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H @@ -74,7 +65,7 @@ /* Define to 1 if you have the <poll.h> header file. */ #undef HAVE_POLL_H -/* Define if <pthread.h> is there */ +/* Define to 1 if you have the <pthread.h> header file. */ #undef HAVE_PTHREAD_H /* Define to 1 if you have the `putenv' function. */ @@ -83,9 +74,6 @@ /* Define to 1 if you have the `rand_r' function. */ #undef HAVE_RAND_R -/* Define to 1 if you have the <resolv.h> header file. */ -#undef HAVE_RESOLV_H - /* Have shl_load based dso */ #undef HAVE_SHLLOAD @@ -170,9 +158,6 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Type cast for the send() function 2nd arg */ -#undef SEND_ARG2_CAST - /* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ @@ -195,9 +180,6 @@ #define below would cause a syntax error. */ #undef _UINT32_T -/* ss_family is not defined here, use __ss_family instead */ -#undef ss_family - /* Define to the type of an unsigned integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ #undef uint32_t diff --git a/chromium/third_party/libxml/src/configure.ac b/chromium/third_party/libxml/src/configure.ac index 7badc57b740..13f7a1e76c1 100644 --- a/chromium/third_party/libxml/src/configure.ac +++ b/chromium/third_party/libxml/src/configure.ac @@ -48,12 +48,9 @@ AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MKDIR_P -AC_PROG_CPP -AC_PATH_PROG(MV, mv, /bin/mv) AC_PATH_PROG(TAR, tar, /bin/tar) AC_PATH_PROG(PERL, perl, /usr/bin/perl) AC_PATH_PROG(WGET, wget, /usr/bin/wget) -AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint) AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc) PKG_PROG_PKG_CONFIG @@ -61,33 +58,11 @@ LT_INIT([disable-static]) LT_LIB_M dnl -dnl if the system support linker version scripts for symbol versioning -dnl then add it -dnl -VERSION_SCRIPT_FLAGS= -# lt_cv_prog_gnu_ld is from libtool 2.+ -if test "$lt_cv_prog_gnu_ld" = yes; then - VERSION_SCRIPT_FLAGS=-Wl,--version-script= -else - case $host in - *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";; - esac -fi -AC_SUBST(VERSION_SCRIPT_FLAGS) -AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"]) - -dnl dnl We process the AC_ARG_WITH first so that later we can modify dnl some of them to try to prevent impossible combinations. This dnl also allows up so alphabetize the choices dnl -dnl -dnl zlib option might change flags, so we save them initially -dnl -_cppflags="${CPPFLAGS}" -_libs="${LIBS}" - AC_ARG_WITH(c14n, [ --with-c14n add the Canonicalization support (on)]) AC_ARG_WITH(catalog, @@ -127,13 +102,7 @@ AC_ARG_WITH(python, AC_ARG_WITH(reader, [ --with-reader add the xmlReader parsing interface (on)]) AC_ARG_WITH(readline, -[ --with-readline=DIR use readline in DIR],[ - if test "$withval" != "no" && test "$withval" != "yes"; then - RDL_DIR=$withval - CPPFLAGS="${CPPFLAGS} -I$withval/include" - LDFLAGS="${LDFLAGS} -L$withval/lib" - fi -]) +[ --with-readline[[=DIR]] use readline in DIR]) AC_ARG_WITH(regexps, [ --with-regexps add Regular Expressions support (on)]) AC_ARG_WITH(run_debug, @@ -165,327 +134,180 @@ AC_ARG_WITH(xptr-locs, AC_ARG_WITH(modules, [ --with-modules add the dynamic modules support (on)]) AC_ARG_WITH(zlib, -[ --with-zlib[[=DIR]] use libz in DIR],[ - if test "$withval" != "no" && test "$withval" != "yes"; then - Z_DIR=$withval - CPPFLAGS="${CPPFLAGS} -I$withval/include" - LDFLAGS="${LDFLAGS} -L$withval/lib" - fi -]) +[ --with-zlib[[=DIR]] use libz in DIR]) AC_ARG_WITH(lzma, -[ --with-lzma[[=DIR]] use liblzma in DIR],[ - if test "$withval" != "no" && test "$withval" != "yes"; then - LZMA_DIR=$withval - CPPFLAGS="${CPPFLAGS} -I$withval/include" - LDFLAGS="${LDFLAGS} -L$withval/lib" - fi -]) +[ --with-lzma[[=DIR]] use liblzma in DIR]) AC_ARG_WITH(coverage, [ --with-coverage build for code coverage with GCC (off)]) dnl dnl hard dependencies on options dnl -if test "$with_schemas" = "yes" -then - with_pattern=yes - with_regexps=yes -fi -if test "$with_schematron" = "yes" -then - with_pattern=yes - with_tree=yes - with_xpath=yes -fi -if test "$with_reader" = "yes" -then - with_push=yes -fi -if test "$with_xptr_locs" = "yes" -then - with_xptr=yes -fi -if test "$with_xptr" = "yes" -then - with_xpath=yes -fi -dnl -dnl option to build a minimal libxml2 library -dnl -if test "$with_minimum" = "yes" -then - echo "Configuring for a minimal library" - if test "$with_c14n" = "" - then - with_c14n=no - fi - if test "$with_catalog" = "" - then - with_catalog=no +if test "$with_c14n" = "yes"; then + if test "$with_output" = "no"; then + echo WARNING: --with-c14n overrides --without-output fi - echo So far so good! - if test "$with_debug" = "" - then - with_debug=no - fi - if test "$with_fexceptions" = "" - then - with_fexceptions=no - fi - if test "$with_history" = "" - then - with_history=no + with_output=yes + if test "$with_xpath" = "no"; then + echo WARNING: --with-c14n overrides --without-xpath fi - if test "$with_html" = "" - then - with_html=no - fi - if test "$with_http" = "" - then - with_http=no - fi - if test "$with_iconv" = "" - then - with_iconv=no - fi - if test "$with_iso8859x" = "" - then - with_iso8859x=no - fi - if test "$with_mem_debug" = "" - then - with_mem_debug=no - fi - if test "$with_output" = "" - then - with_output=no - fi - if test "$with_pattern" = "" - then - with_pattern=no - fi - if test "$with_push" = "" - then - with_push=no - fi - if test "$with_python" = "" - then - with_python=no - fi - if test "$with_reader" = "" - then - with_reader=no - fi - if test "$with_readline" = "" - then - with_readline=no - fi - if test "$with_regexps" = "" - then - with_regexps=no - fi - if test "$with_run_debug" = "" - then - with_run_debug=no - fi - if test "$with_sax1" = "" - then - with_sax1=no + with_xpath=yes +fi +if test "$with_schemas" = "yes"; then + if test "$with_pattern" = "no"; then + echo WARNING: --with-schemas overrides --without-pattern fi - if test "$with_schemas" = "" - then - with_schemas=no + with_pattern=yes + if test "$with_regexps" = "no"; then + echo WARNING: --with-schemas overrides --without-regexps fi - if test "$with_schematron" = "" - then - with_schematron=no + with_regexps=yes +fi +if test "$with_schematron" = "yes"; then + if test "$with_pattern" = "no"; then + echo WARNING: --with-schematron overrides --without-pattern fi - if test "$with_threads" = "" - then - with_threads=no + with_pattern=yes + if test "$with_tree" = "no"; then + echo WARNING: --with-schematron overrides --without-tree fi - if test "$with_thread_alloc" = "" - then - with_thread_alloc=no - fi - if test "$with_tree" = "" - then - with_tree=no + with_tree=yes + if test "$with_xpath" = "no"; then + echo WARNING: --with-schematron overrides --without-xpath fi - if test "$with_valid" = "" - then - with_valid=no + with_xpath=yes +fi +if test "$with_reader" = "yes"; then + if test "$with_push" = "no"; then + echo WARNING: --with-reader overrides --without-push fi - if test "$with_writer" = "" - then - with_writer=no + with_push=yes + if test "$with_tree" = "no"; then + echo WARNING: --with-reader overrides --without-tree fi - if test "$with_xinclude" = "" - then - with_xinclude=no + with_tree=yes +fi +if test "$with_writer" = "yes"; then + if test "$with_output" = "no"; then + echo WARNING: --with-writer overrides --without-output fi - if test "$with_xpath" = "" - then - with_xpath=no + with_output=yes + if test "$with_push" = "no"; then + echo WARNING: --with-writer overrides --without-push fi - if test "$with_xptr" = "" - then - with_xptr=no + with_push=yes +fi +if test "$with_xinclude" = "yes"; then + if test "$with_xpath" = "no"; then + echo WARNING: --with-xinclude overrides --without-xpath fi - if test "$with_zlib" = "" - then - with_zlib=no + with_xpath=yes +fi +if test "$with_xptr_locs" = "yes"; then + if test "$with_xptr" = "no"; then + echo WARNING: --with-xptr-locs overrides --without-xptr fi - if test "$with_modules" = "" - then - with_modules=no + with_xptr=yes +fi +if test "$with_xptr" = "yes"; then + if test "$with_xpath" = "no"; then + echo WARNING: --with-xptr overrides --without-xpath fi + with_xpath=yes fi -echo Checking zlib - -dnl Checks for zlib library. - -WITH_ZLIB=0 -if test "$with_zlib" = "no"; then - echo "Disabling zlib compression support" +if test "$with_minimum" = "yes"; then + dnl + dnl option to build a minimal libxml2 library + dnl + echo "Configuring for a minimal library" + test "$with_c14n" = "" && with_c14n=no + test "$with_catalog" = "" && with_catalog=no + test "$with_debug" = "" && with_debug=no + test "$with_fexceptions" = "" && with_fexceptions=no + test "$with_history" = "" && with_history=no + test "$with_html" = "" && with_html=no + test "$with_http" = "" && with_http=no + test "$with_iconv" = "" && with_iconv=no + test "$with_iso8859x" = "" && with_iso8859x=no + test "$with_mem_debug" = "" && with_mem_debug=no + test "$with_output" = "" && with_output=no + test "$with_pattern" = "" && with_pattern=no + test "$with_push" = "" && with_push=no + test "$with_python" = "" && with_python=no + test "$with_reader" = "" && with_reader=no + test "$with_readline" = "" && with_readline=no + test "$with_regexps" = "" && with_regexps=no + test "$with_run_debug" = "" && with_run_debug=no + test "$with_sax1" = "" && with_sax1=no + test "$with_schemas" = "" && with_schemas=no + test "$with_schematron" = "" && with_schematron=no + test "$with_threads" = "" && with_threads=no + test "$with_thread_alloc" = "" && with_thread_alloc=no + test "$with_tree" = "" && with_tree=no + test "$with_valid" = "" && with_valid=no + test "$with_writer" = "" && with_writer=no + test "$with_xinclude" = "" && with_xinclude=no + test "$with_xpath" = "" && with_xpath=no + test "$with_xptr" = "" && with_xptr=no + test "$with_zlib" = "" && with_zlib=no + test "$with_modules" = "" && with_modules=no else - # Don't run pkg-config if with_zlib contains a path. - if test "x$Z_DIR" = "x"; then - # Try pkg-config first so that static linking works. - PKG_CHECK_MODULES([Z],[zlib], - [WITH_ZLIB=1], - [:]) + dnl + dnl Disable dependent modules + dnl + if test "$with_output" = "no"; then + with_c14n=no + with_writer=no fi - - if test "$WITH_ZLIB" = "0"; then - AC_CHECK_HEADERS(zlib.h, - AC_CHECK_LIB(z, gzread,[ - WITH_ZLIB=1 - if test "x${Z_DIR}" != "x"; then - Z_CFLAGS="-I${Z_DIR}/include" - Z_LIBS="-L${Z_DIR}/lib -lz" - [case ${host} in - *-*-solaris*) - Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz" - ;; - esac] - else - Z_LIBS="-lz" - fi]) - ) + if test "$with_pattern" = "no"; then + with_schemas=no + with_schematron=no fi -fi - -AC_SUBST(Z_CFLAGS) -AC_SUBST(Z_LIBS) -AC_SUBST(WITH_ZLIB) - -echo Checking lzma - -dnl Checks for lzma library. - -WITH_LZMA=0 -if test "$with_lzma" = "no"; then - echo "Disabling lzma compression support" -else - # Don't run pkg-config if with_lzma contains a path. - if test "x$LZMA_DIR" = "x"; then - # Try pkg-config first so that static linking works. - PKG_CHECK_MODULES([LZMA],[liblzma], - [WITH_LZMA=1], - [:]) + if test "$with_push" = "no"; then + with_reader=no + with_writer=no fi - - # If pkg-config failed, fall back to AC_CHECK_LIB. This - # will not pick up the necessary LIBS flags for liblzma's - # private dependencies, though, so static linking may fail. - if test "$WITH_LZMA" = "0"; then - AC_CHECK_HEADERS(lzma.h, - AC_CHECK_LIB(lzma, lzma_code,[ - WITH_LZMA=1 - if test "x${LZMA_DIR}" != "x"; then - LZMA_CFLAGS="-I${LZMA_DIR}/include" - LZMA_LIBS="-L${LZMA_DIR}/lib -llzma" - else - LZMA_LIBS="-llzma" - fi]) - ) + if test "$with_regexps" = "no"; then + with_schemas=no + fi + if test "$with_tree" = "no"; then + with_reader=no + with_schematron=no + fi + if test "$with_xpath" = "no"; then + with_c14n=no + with_schematron=no + with_xinclude=no + with_xptr=no fi fi -AC_SUBST(LZMA_CFLAGS) -AC_SUBST(LZMA_LIBS) -AC_SUBST(WITH_LZMA) - -CPPFLAGS=${_cppflags} -LIBS=${_libs} - -echo Checking headers - +dnl dnl Checks for header files. -AC_CHECK_HEADERS([fcntl.h]) -AC_CHECK_HEADERS([unistd.h]) -AC_CHECK_HEADERS([sys/stat.h]) -AC_CHECK_HEADERS([sys/types.h]) -AC_CHECK_HEADERS([stdint.h]) -AC_CHECK_HEADERS([inttypes.h]) -AC_CHECK_HEADERS([sys/socket.h], [], [], -[#if HAVE_SYS_TYPES_H -# include <sys/types.h> -# endif -]) -AC_CHECK_HEADERS([netinet/in.h], [], [], -[#if HAVE_SYS_TYPES_H -# include <sys/types.h> -# endif -]) -AC_CHECK_HEADERS([arpa/inet.h], [], [], -[#if HAVE_SYS_TYPES_H -# include <sys/types.h> -# endif -#if HAVE_ARPA_INET_H -# include <arpa/inet.h> -# endif -]) -AC_CHECK_HEADERS([netdb.h]) -AC_CHECK_HEADERS([sys/time.h]) -AC_CHECK_HEADERS([sys/select.h]) -AC_CHECK_HEADERS([poll.h]) +dnl +AC_CHECK_HEADERS([stdint.h inttypes.h]) +AC_CHECK_HEADERS([fcntl.h unistd.h sys/stat.h]) AC_CHECK_HEADERS([sys/mman.h]) -AC_CHECK_HEADERS([sys/timeb.h]) -AC_CHECK_HEADERS([arpa/nameser.h], [], [], -[#if HAVE_SYS_TYPES_H -# include <sys/types.h> -# endif -]) -AC_CHECK_HEADERS([resolv.h], [], [], -[#if HAVE_SYS_TYPES_H -# include <sys/types.h> -# endif -#if HAVE_NETINET_IN_H -# include <netinet/in.h> -# endif -#if HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -# endif -]) -AC_CHECK_HEADERS([dl.h]) -AC_CHECK_HEADERS([dlfcn.h]) - - -echo Checking types +AC_CHECK_HEADERS([sys/socket.h netinet/in.h arpa/inet.h netdb.h]) +AC_CHECK_HEADERS([sys/select.h poll.h]) +AC_CHECK_HEADERS([sys/time.h sys/timeb.h]) +AC_CHECK_HEADERS([dl.h dlfcn.h]) +AC_CHECK_HEADERS([glob.h]) +AM_CONDITIONAL(WITH_GLOB, test "$ac_cv_header_glob_h" = "yes") +dnl +dnl Checking types +dnl AC_TYPE_UINT32_T - -echo Checking libraries +dnl +dnl Checking libraries +dnl +AC_CHECK_FUNCS(snprintf vsnprintf,, NEED_TRIO=1) dnl Checks for library functions. -AC_CHECK_FUNCS(gettimeofday ftime) -AC_CHECK_FUNCS(stat) -AC_CHECK_FUNCS(rand_r) -AC_CHECK_FUNCS(isascii mmap munmap putenv) +AC_CHECK_FUNCS([gettimeofday ftime stat rand_r isascii mmap munmap putenv]) AH_VERBATIM([HAVE_MUNMAP_AFTER],[/* mmap() is no good without munmap() */ #if defined(HAVE_MMAP) && !defined(HAVE_MUNMAP) @@ -523,68 +345,95 @@ va_list ap1, ap2; a(&ap1); ap2 = (va_list) ap1],[ AC_MSG_RESULT(yes) AC_DEFINE([VA_LIST_IS_ARRAY], [1],[Define if va_list is an array type])]) -dnl Checks for inet libraries: -AC_SEARCH_LIBS(gethostent, [nsl]) -AC_SEARCH_LIBS(setsockopt, [socket net network]) -AC_SEARCH_LIBS(connect, [inet]) +dnl +dnl Checks for inet libraries +dnl +if test "$with_http" != "no" || test "with_ftp" = "yes"; then + case "$host" in + *-*-mingw*) + dnl AC_SEARCH_LIBS doesn't work because of non-standard calling + dnl conventions on 32-bit Windows. + NET_LIBS="$NET_LIBS -lws2_32" + ;; + *) + _libs=$LIBS + AC_SEARCH_LIBS(gethostbyname, [nsl], [ + if test "$ac_cv_search_gethostbyname" != "none required"; then + NET_LIBS="$NET_LIBS $ac_cv_search_gethostbyname" + fi], [:], [$NET_LIBS]) + AC_SEARCH_LIBS(connect, [bsd socket inet], [ + if test "$ac_cv_search_connect" != "none required"; then + NET_LIBS="$NET_LIBS $ac_cv_search_connect" + fi], [:], [$NET_LIBS]) + LIBS=$_libs + ;; + esac -dnl Determine what socket length (socklen_t) data type is -AC_MSG_CHECKING([for type of socket length (socklen_t)]) -AC_TRY_COMPILE2([ -#include <stddef.h> -#include <sys/types.h> -#include <sys/socket.h>],[ -(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[ - AC_MSG_RESULT(socklen_t *) - XML_SOCKLEN_T=socklen_t],[ - AC_TRY_COMPILE2([ -#include <stddef.h> -#include <sys/types.h> -#include <sys/socket.h>],[ -(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[ - AC_MSG_RESULT(size_t *) - XML_SOCKLEN_T=size_t],[ + dnl Determine what socket length (socklen_t) data type is + AC_MSG_CHECKING([for type of socket length (socklen_t)]) AC_TRY_COMPILE2([ -#include <stddef.h> -#include <sys/types.h> -#include <sys/socket.h>],[ -(void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[ - AC_MSG_RESULT(int *) - XML_SOCKLEN_T=int],[ - AC_MSG_WARN(could not determine) - XML_SOCKLEN_T="int"])])]) -AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is]) - -dnl Checking if gethostbyname() argument is const. -AC_MSG_CHECKING([for const gethostbyname() argument]) -AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], - [[(void)gethostbyname((const char *)"");]])], -have_gethostbyname_const_arg=yes, -have_gethostbyname_const_arg=no) -AC_MSG_RESULT($have_gethostbyname_const_arg) -if test x"$have_gethostbyname_const_arg" = x"yes"; then - AC_DEFINE([GETHOSTBYNAME_ARG_CAST], [], - [Type cast for the gethostbyname() argument]) -else - AC_DEFINE([GETHOSTBYNAME_ARG_CAST], [(char *)], - [Type cast for the gethostbyname() argument]) + #include <stddef.h> + #ifdef _WIN32 + #include <ws2tcpip.h> + #else + #include <sys/socket.h> + #endif],[ + (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[ + AC_MSG_RESULT(socklen_t *) + XML_SOCKLEN_T=socklen_t],[ + AC_TRY_COMPILE2([ + #include <stddef.h> + #include <sys/socket.h>],[ + (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[ + AC_MSG_RESULT(size_t *) + XML_SOCKLEN_T=size_t],[ + AC_TRY_COMPILE2([ + #include <stddef.h> + #include <sys/socket.h>],[ + (void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[ + AC_MSG_RESULT(int *) + XML_SOCKLEN_T=int],[ + AC_MSG_WARN(could not determine) + XML_SOCKLEN_T="int"])])]) + AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is]) + + dnl + dnl Checking for availability of IPv6 + dnl + AC_ARG_ENABLE(ipv6, [ --enable-ipv6[[=yes/no]] enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes) + if test "$with_minimum" = "yes" + then + enable_ipv6=no + fi + if test $enable_ipv6 = yes; then + AC_MSG_CHECKING([whether to enable IPv6]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #ifdef _WIN32 + #include <winsock2.h> + #else + #include <sys/socket.h> + #ifdef HAVE_NETDB_H + #include <netdb.h> + #endif + #endif + ]], [[ + struct sockaddr_storage ss; + socket(AF_INET6, SOCK_STREAM, 0); + getaddrinfo(0, 0, 0, 0); + ]])], [ + AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6]) + AC_MSG_RESULT([yes])], [ + AC_MSG_RESULT([no])] + ) + fi fi -dnl Checking if send() second argument is const. -AC_MSG_CHECKING([for const send() second argument]) -AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> -#include <sys/socket.h>]], - [[(void)send(1,(const char *)"",1,1);]])], -have_send_const_arg2=yes, -have_send_const_arg2=no) -AC_MSG_RESULT($have_send_const_arg2) -if test x"$have_send_const_arg2" = x"yes"; then - AC_DEFINE([SEND_ARG2_CAST], [], - [Type cast for the send() function 2nd arg]) -else - AC_DEFINE([SEND_ARG2_CAST], [(char *)], - [Type cast for the send() function 2nd arg]) -fi +dnl +dnl Extra flags +dnl +XML_LIBDIR='-L${libdir}' +XML_INCLUDEDIR='-I${includedir}/libxml2' +XML_CFLAGS="" dnl Checking whether __attribute__((destructor)) is accepted by the compiler AC_MSG_CHECKING([whether __attribute__((destructor)) is accepted]) @@ -596,99 +445,26 @@ f(void) {}], [], [ AC_DEFINE([ATTRIBUTE_DESTRUCTOR], [__attribute__((destructor))],[A form that will not confuse apibuild.py])],[ AC_MSG_RESULT(no)]) - -dnl ***********************Checking for availability of IPv6******************* - -AC_MSG_CHECKING([whether to enable IPv6]) -AC_ARG_ENABLE(ipv6, [ --enable-ipv6[[=yes/no]] enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes) -if test "$with_minimum" = "yes" -then - enable_ipv6=no -fi -if test $enable_ipv6 = yes; then - have_ipv6=no - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -# include <sys/types.h> -# include <sys/socket.h> - ]], [[ - struct sockaddr_storage ss; - socket(AF_INET6, SOCK_STREAM, 0) - ]])], - have_ipv6=yes, - have_ipv6=no - ) - AC_MSG_RESULT($have_ipv6) - - if test $have_ipv6 = yes; then - AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6]) - have_broken_ss_family=no - - dnl ********************************************************************* - dnl on some platforms (like AIX 5L), the structure sockaddr doesn't have - dnl a ss_family member, but rather __ss_family. Let's detect that - dnl and define the HAVE_BROKEN_SS_FAMILY when we are on one of these - dnl platforms. However, we should only do this if ss_family is not - dnl present. - dnl ******************************************************************** - AC_MSG_CHECKING([struct sockaddr::ss_family]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -# include <sys/types.h> -# include <sys/socket.h> - ]], [[ - struct sockaddr_storage ss ; - ss.ss_family = 0 ; - ]])], - have_ss_family=yes, - have_ss_family=no - ) - AC_MSG_RESULT($have_ss_family) - if test x$have_ss_family = xno ; then - AC_MSG_CHECKING([broken struct sockaddr::ss_family]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -# include <sys/types.h> -# include <sys/socket.h> - ]], [[ - struct sockaddr_storage ss ; - ss.__ss_family = 0 ; - ]])], - have_broken_ss_family=yes, - have_broken_ss_family=no - ) - AC_MSG_RESULT($have_broken_ss_family) - if test x$have_broken_ss_family = xyes ; then - AC_DEFINE(HAVE_BROKEN_SS_FAMILY, [], - [Whether struct sockaddr::__ss_family exists]) - AC_DEFINE(ss_family, __ss_family, - [ss_family is not defined here, use __ss_family instead]) - else - AC_MSG_WARN(ss_family and __ss_family not found) - fi - fi - - have_getaddrinfo=no - AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes) - if test $have_getaddrinfo != yes; then - for lib in bsd socket inet; do - AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break]) - done - fi - - if test $have_getaddrinfo = yes; then - AC_DEFINE([HAVE_GETADDRINFO], [], [Define if getaddrinfo is there]) - fi - fi -fi - -dnl ******************************End IPv6 checks****************************** - -XML_LIBDIR='-L${libdir}' -XML_INCLUDEDIR='-I${includedir}/libxml2' - dnl -dnl Extra flags +dnl Linker version scripts for symbol versioning dnl -XML_CFLAGS="" -RDL_LIBS="" +VERSION_SCRIPT_FLAGS= +# lt_cv_prog_gnu_ld is from libtool 2.+ +if test "$lt_cv_prog_gnu_ld" = yes; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-msys* ) + ;; + *) + VERSION_SCRIPT_FLAGS=-Wl,--version-script= + ;; + esac +else + case $host in + *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";; + esac +fi +AC_SUBST(VERSION_SCRIPT_FLAGS) +AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"]) dnl dnl Workaround for native compilers @@ -698,13 +474,13 @@ dnl if test "${GCC}" != "yes" ; then case "${host}" in hppa*-*-hpux* ) - EXTRA_CFLAGS="${EXTRA_CFLAGS} -Wp,-H30000" + AM_CFLAGS="${AM_CFLAGS} -Wp,-H30000" ;; *-dec-osf* ) - EXTRA_CFLAGS="${EXTRA_CFLAGS} -ieee" + AM_CFLAGS="${AM_CFLAGS} -ieee" ;; alpha*-*-linux* ) - EXTRA_CFLAGS="${EXTRA_CFLAGS} -ieee" + AM_CFLAGS="${AM_CFLAGS} -ieee" ;; esac else @@ -714,19 +490,19 @@ else # Not activated by default because this inflates the code size # Used to allow propagation of C++ exceptions through the library # - EXTRA_CFLAGS="${EXTRA_CFLAGS} -fexceptions" + AM_CFLAGS="${AM_CFLAGS} -fexceptions" fi # warnings we'd like to see - EXTRA_CFLAGS="${EXTRA_CFLAGS} -pedantic -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls" + AM_CFLAGS="${AM_CFLAGS} -pedantic -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline" # warnings we'd like to suppress - EXTRA_CFLAGS="${EXTRA_CFLAGS} -Wno-long-long -Wno-format-extra-args" + AM_CFLAGS="${AM_CFLAGS} -Wno-long-long -Wno-format-extra-args" case "${host}" in alpha*-*-linux* ) - EXTRA_CFLAGS="${EXTRA_CFLAGS} -mieee" + AM_CFLAGS="${AM_CFLAGS} -mieee" ;; alpha*-*-osf* ) - EXTRA_CFLAGS="${EXTRA_CFLAGS} -mieee" + AM_CFLAGS="${AM_CFLAGS} -mieee" ;; esac fi @@ -737,302 +513,99 @@ case ${host} in hppa*-hp-mpeix) NEED_TRIO=1 ;; - *-*-mingw* | *-*-cygwin* | *-*-msvc* ) + *-*-cygwin* | *-*-mingw* | *-*-msys* ) # If the host is Windows, and shared libraries are disabled, we - # need to add -DLIBXML_STATIC to EXTRA_CFLAGS in order for linking to + # need to add -DLIBXML_STATIC to AM_CFLAGS in order for linking to # work properly (without it, xmlexports.h would force the use of # DLL imports, which obviously aren't present in a static # library). if test "x$enable_shared" = "xno"; then XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC" - EXTRA_CFLAGS="$EXTRA_CFLAGS -DLIBXML_STATIC" + AM_CFLAGS="$AM_CFLAGS -DLIBXML_STATIC" fi ;; esac dnl -dnl check for python +dnl Simple API modules dnl -PYTHON_TESTS= -AS_IF([test "x$with_python" != "xno"], [ - AM_PATH_PYTHON - PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}]) -]) -AM_CONDITIONAL([WITH_PYTHON], [test "x$with_python" != "xno"]) - -dnl check for dso support -WITH_MODULES=0 - -if test "$with_modules" != "no" ; then - case "$host" in - *-*-cygwin*) - MODULE_EXTENSION=".dll" - AC_CHECK_LIB(cygwin, dlopen, [ - WITH_MODULES=1 - MODULE_PLATFORM_LIBS= - AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso]) - ]) - ;; - *-*-mingw*) - MODULE_EXTENSION=".dll" - WITH_MODULES=1 - ;; - *) - AC_CHECK_FUNC(shl_load, libxml_have_shl_load=yes, [ - AC_CHECK_LIB(dld, shl_load, [ - MODULE_PLATFORM_LIBS="-ldld" - libxml_have_shl_load=yes], [ - AC_CHECK_FUNC(dlopen, libxml_have_dlopen=yes, [ - AC_CHECK_LIB(dl, dlopen, [ - MODULE_PLATFORM_LIBS="-ldl" - libxml_have_dlopen=yes])])])]) - - if test "${libxml_have_shl_load}" = "yes"; then - MODULE_EXTENSION=".sl" - WITH_MODULES=1 - AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso]) - fi - - if test "${libxml_have_dlopen}" = "yes"; then - case "${host}" in - *-*-hpux* ) - MODULE_EXTENSION=".sl" - ;; - * ) - MODULE_EXTENSION=".so" - ;; - esac - - WITH_MODULES=1 - AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso]) - fi - ;; - esac -fi - -AC_SUBST(WITH_MODULES) -AC_SUBST(MODULE_PLATFORM_LIBS) -AC_SUBST(MODULE_EXTENSION) - -dnl -dnl Check for trio string functions -dnl - -if test "${NEED_TRIO}" = "1" ; then - echo Adding trio library for string functions - WITH_TRIO=1 -else - WITH_TRIO=0 -fi -AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1") -AC_SUBST(WITH_TRIO) - -dnl -dnl Allow to enable/disable various pieces -dnl -echo Checking configuration requirements - -dnl -dnl Thread-related stuff -dnl -THREAD_LIBS="" -BASE_THREAD_LIBS="" -WITH_THREADS=0 -THREAD_CFLAGS="" -THREADS_W32="" -WITH_THREAD_ALLOC=0 - -if test "$with_threads" = "no" ; then - echo Disabling multithreaded support -else - echo Enabling multithreaded support - - dnl Default to native threads on Windows - case $host_os in - *mingw*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then - WITH_THREADS="1" - THREADS_W32="1" - THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS" - fi - ;; - esac - - dnl Use pthread by default in other cases - if test -z "$THREADS_W32"; then - if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then - AC_CHECK_HEADER(pthread.h, - AC_CHECK_LIB(pthread, pthread_join,[ - THREAD_LIBS="-lpthread" - AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there]) - WITH_THREADS="1"])) - fi - fi - - case $host_os in - *cygwin*) THREAD_LIBS="" - ;; - *beos*) WITH_THREADS="1" - THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS" - ;; - *linux*) - if test "${GCC}" = "yes" ; then - GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'` - GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'` - GCC_MEDIUM=`echo ${GCC_VERSION} | sed 's+[[0-9]]*\.++' | sed 's+\..*++'` - if test "${THREAD_LIBS}" = "-lpthread" ; then - if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null - then - THREAD_LIBS="" - BASE_THREAD_LIBS="-lpthread" - else - if expr ${GCC_MAJOR} \> 3 > /dev/null - then - THREAD_LIBS="" - BASE_THREAD_LIBS="-lpthread" - else - echo old GCC disabling weak symbols for pthread - fi - fi - fi - fi - ;; - esac - if test "$WITH_THREADS" = "1" ; then - THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT" - fi -fi -if test "$with_thread_alloc" = "yes" && test "$WITH_THREADS" = "1" ; then - WITH_THREAD_ALLOC=1 -fi - -AC_SUBST(THREAD_LIBS) -AC_SUBST(BASE_THREAD_LIBS) -AC_SUBST(WITH_THREADS) -AC_SUBST(THREAD_CFLAGS) -AC_SUBST(WITH_THREAD_ALLOC) -AM_CONDITIONAL([THREADS_W32],[test -n "$THREADS_W32"]) - -dnl -dnl xmllint shell history -dnl -if test "$with_history" = "yes" ; then - echo Enabling xmllint shell history - dnl check for terminal library. this is a very cool solution - dnl from octave's configure.in - unset tcap - for termlib in ncurses curses termcap terminfo termlib; do - AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"]) - test -n "$tcap" && break - done - - AC_CHECK_HEADER(readline/history.h, - AC_CHECK_LIB(history, append_history,[ - RDL_LIBS="-lhistory" - AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])])) - AC_CHECK_HEADER(readline/readline.h, - AC_CHECK_LIB(readline, readline,[ - RDL_LIBS="-lreadline $RDL_LIBS $tcap" - AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap)) - if test -n "$RDL_DIR" && test -n "$RDL_LIBS"; then - CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include" - RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS" - fi -fi - -dnl -dnl Tree functions -dnl if test "$with_tree" = "no" ; then echo Disabling DOM like tree manipulation APIs WITH_TREE=0 -else +else WITH_TREE=1 fi AC_SUBST(WITH_TREE) if test "$with_ftp" != "yes" ; then - echo Disabling FTP support WITH_FTP=0 - FTP_OBJ= -else +else + echo Enabling FTP support WITH_FTP=1 - FTP_OBJ=nanoftp.o fi AC_SUBST(WITH_FTP) -AC_SUBST(FTP_OBJ) +AM_CONDITIONAL(WITH_FTP_SOURCES, test "$WITH_FTP" = "1") if test "$with_http" = "no" ; then echo Disabling HTTP support WITH_HTTP=0 - HTTP_OBJ= -else +else WITH_HTTP=1 - HTTP_OBJ=nanohttp.o fi AC_SUBST(WITH_HTTP) -AC_SUBST(HTTP_OBJ) +AM_CONDITIONAL(WITH_HTTP_SOURCES, test "$WITH_HTTP" = "1") if test "$with_legacy" != "yes" ; then - echo Disabling deprecated APIs WITH_LEGACY=0 -else +else + echo Enabling deprecated APIs WITH_LEGACY=1 fi AC_SUBST(WITH_LEGACY) +AM_CONDITIONAL(WITH_LEGACY_SOURCES, test "$WITH_LEGACY" = "1") if test "$with_reader" = "no" ; then echo Disabling the xmlReader parsing interface WITH_READER=0 -else +else WITH_READER=1 - if test "$with_push" = "no" ; then - echo xmlReader requires Push interface - enabling it - with_push=yes - fi fi AC_SUBST(WITH_READER) +AM_CONDITIONAL(WITH_READER_SOURCES, test "$WITH_READER" = "1") if test "$with_writer" = "no" ; then echo Disabling the xmlWriter saving interface WITH_WRITER=0 -# WRITER_TEST= -else +else WITH_WRITER=1 -# WRITER_TEST=Writertests - if test "$with_push" = "no" ; then - echo xmlWriter requires Push interface - enabling it - with_push=yes - fi - if test "$with_output" = "no" ; then - echo xmlWriter requires Output interface - enabling it - with_output=yes - fi fi AC_SUBST(WITH_WRITER) -#AC_SUBST(WRITER_TEST) +AM_CONDITIONAL(WITH_WRITER_SOURCES, test "$WITH_WRITER" = "1") if test "$with_pattern" = "no" ; then echo Disabling the xmlPattern parsing interface WITH_PATTERN=0 -else +else WITH_PATTERN=1 fi AC_SUBST(WITH_PATTERN) +AM_CONDITIONAL(WITH_PATTERN_SOURCES, test "$WITH_PATTERN" = "1") if test "$with_sax1" = "no" ; then echo Disabling the older SAX1 interface WITH_SAX1=0 -else +else WITH_SAX1=1 fi AC_SUBST(WITH_SAX1) +AM_CONDITIONAL(WITH_SAX1_SOURCES, test "$WITH_SAX1" = "1") if test "$with_push" = "no" ; then echo Disabling the PUSH parser interfaces WITH_PUSH=0 -else +else WITH_PUSH=1 fi AC_SUBST(WITH_PUSH) @@ -1040,296 +613,127 @@ AC_SUBST(WITH_PUSH) if test "$with_html" = "no" ; then echo Disabling HTML support WITH_HTML=0 - HTML_OBJ= -else +else WITH_HTML=1 - HTML_OBJ="HTMLparser.o HTMLtree.o" fi AC_SUBST(WITH_HTML) -AC_SUBST(HTML_OBJ) +AM_CONDITIONAL(WITH_HTML_SOURCES, test "$WITH_HTML" = "1") if test "$with_valid" = "no" ; then echo Disabling DTD validation support WITH_VALID=0 - TEST_VTIME= -else +else WITH_VALID=1 - TEST_VTIME=VTimingtests fi AC_SUBST(WITH_VALID) -AC_SUBST(TEST_VALID) -AC_SUBST(TEST_VTIME) +AM_CONDITIONAL(WITH_VALID_SOURCES, test "$WITH_VALID" = "1") if test "$with_catalog" = "no" ; then echo Disabling Catalog support WITH_CATALOG=0 - CATALOG_OBJ= - TEST_CATALOG= -else +else WITH_CATALOG=1 - CATALOG_OBJ="catalog.o" - TEST_CATALOG=Catatests fi AC_SUBST(WITH_CATALOG) -AC_SUBST(CATALOG_OBJ) -AC_SUBST(TEST_CATALOG) +AM_CONDITIONAL(WITH_CATALOG_SOURCES, test "$WITH_CATALOG" = "1") if test "$with_xptr" = "no" ; then echo Disabling XPointer support WITH_XPTR=0 WITH_XPTR_LOCS=0 - XPTR_OBJ= -else +else WITH_XPTR=1 - XPTR_OBJ=xpointer.o - if test "$with_xpath" = "no" ; then - echo XPointer requires XPath support - enabling it - with_xpath=yes - fi - if test "$with_xptr_locs" = "yes" ; then - WITH_XPTR_LOCS=1 - else - WITH_XPTR_LOCS=0 - fi fi AC_SUBST(WITH_XPTR) +AM_CONDITIONAL(WITH_XPTR_SOURCES, test "$WITH_XPTR" = "1") + +if test "$with_xptr_locs" != "yes" ; then + WITH_XPTR_LOCS=0 +else + echo Enabling Xpointer locations support + WITH_XPTR_LOCS=1 +fi AC_SUBST(WITH_XPTR_LOCS) -AC_SUBST(XPTR_OBJ) if test "$with_c14n" = "no" ; then echo Disabling C14N support WITH_C14N=0 - C14N_OBJ= -else +else WITH_C14N=1 - C14N_OBJ="c14n.c" - if test "$with_xpath" = "no" ; then - echo C14N requires XPath support - enabling it - with_xpath=yes - fi fi AC_SUBST(WITH_C14N) -AC_SUBST(C14N_OBJ) +AM_CONDITIONAL(WITH_C14N_SOURCES, test "$WITH_C14N" = "1") if test "$with_xinclude" = "no" ; then echo Disabling XInclude support WITH_XINCLUDE=0 - XINCLUDE_OBJ= - with_xinclude="no" -else +else WITH_XINCLUDE=1 - XINCLUDE_OBJ=xinclude.o - if test "$with_xpath" = "no" ; then - echo XInclude requires XPath support - enabling it - with_xpath=yes - fi fi AC_SUBST(WITH_XINCLUDE) -AC_SUBST(XINCLUDE_OBJ) - -if test "$with_xptr" = "" && test "$with_xpath" = "no" ; then - with_xptr=no -fi - -if test "$with_schematron" = "" && test "$with_xpath" = "no" ; then - with_schematron=no -fi +AM_CONDITIONAL(WITH_XINCLUDE_SOURCES, test "$WITH_XINCLUDE" = "1") if test "$with_schematron" = "no" ; then echo "Disabling Schematron support" WITH_SCHEMATRON=0 - TEST_SCHEMATRON= -else - echo "Enabled Schematron support" +else WITH_SCHEMATRON=1 - TEST_SCHEMATRON="Schematrontests" - with_xpath=yes - with_pattern=yes - with_schematron=yes fi AC_SUBST(WITH_SCHEMATRON) -AC_SUBST(TEST_SCHEMATRON) +AM_CONDITIONAL(WITH_SCHEMATRON_SOURCES, test "$WITH_SCHEMATRON" = "1") if test "$with_xpath" = "no" ; then echo Disabling XPATH support WITH_XPATH=0 - XPATH_OBJ= -else +else WITH_XPATH=1 - XPATH_OBJ=xpath.o fi AC_SUBST(WITH_XPATH) -AC_SUBST(XPATH_OBJ) +AM_CONDITIONAL(WITH_XPATH_SOURCES, test "$WITH_XPATH" = "1") -dnl -dnl output functions -dnl if test "$with_output" = "no" ; then echo Disabling serialization/saving support WITH_OUTPUT=0 -else +else WITH_OUTPUT=1 fi AC_SUBST(WITH_OUTPUT) +AM_CONDITIONAL(WITH_OUTPUT_SOURCES, test "$WITH_OUTPUT" = "1") -WITH_ICONV=0 -if test "$with_iconv" = "no" ; then - echo Disabling ICONV support -else - if test "$with_iconv" != "yes" && test "$with_iconv" != "" ; then - CPPFLAGS="${CPPFLAGS} -I$with_iconv/include" - # Export this since our headers include iconv.h - XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include" - ICONV_LIBS="-L$with_iconv/lib" - fi - - AC_CHECK_HEADER(iconv.h, - AC_MSG_CHECKING(for iconv) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> -#include <iconv.h>]],[[ -iconv_t cd = iconv_open ("",""); -iconv (cd, NULL, NULL, NULL, NULL);]])],[ - AC_MSG_RESULT(yes) - WITH_ICONV=1],[ - AC_MSG_RESULT(no) - AC_MSG_CHECKING(for iconv in -liconv) - - _ldflags="${LDFLAGS}" - _libs="${LIBS}" - LDFLAGS="${LDFLAGS} ${ICONV_LIBS}" - LIBS="${LIBS} -liconv" - - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> -#include <iconv.h>]],[[ -iconv_t cd = iconv_open ("",""); -iconv (cd, NULL, NULL, NULL, NULL);]])],[ - AC_MSG_RESULT(yes) - WITH_ICONV=1 - ICONV_LIBS="${ICONV_LIBS} -liconv" - LIBS="${_libs}" - LDFLAGS="${_ldflags}"],[ - AC_MSG_RESULT(no) - LIBS="${_libs}" - LDFLAGS="${_ldflags}"])])) -fi -AC_SUBST(WITH_ICONV) - -WITH_ICU=0 -ICU_LIBS="" -if test "$with_icu" != "yes" ; then - echo Disabling ICU support -else - # Try pkg-config first so that static linking works. - # If this succeeeds, we ignore the WITH_ICU directory. - PKG_CHECK_MODULES([ICU],[icu-i18n], - [have_libicu=yes], - [have_libicu=no]) - - if test "x$have_libicu" = "xyes"; then - m4_ifdef([PKG_CHECK_VAR], - [PKG_CHECK_VAR([ICU_DEFS], [icu-i18n], [DEFS])]) - if test "x$ICU_DEFS" != "x"; then - CPPFLAGS="$CPPFLAGS $ICU_DEFS" - fi - fi - - # If pkg-config failed, fall back to AC_CHECK_LIB. This - # will not pick up the necessary LIBS flags for liblzma's - # private dependencies, though, so static linking may fail. - if test "x$have_libicu" = "xno"; then - ICU_CONFIG=icu-config - if ${ICU_CONFIG} --cflags >/dev/null 2>&1 - then - ICU_LIBS=`${ICU_CONFIG} --ldflags` - have_libicu=yes - echo Enabling ICU support - else - if test "$with_icu" != "yes" && test "$with_iconv" != "" ; then - CPPFLAGS="${CPPFLAGS} -I$with_icu" - fi - - AC_CHECK_HEADER(unicode/ucnv.h, - AC_MSG_CHECKING(for icu) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <unicode/ucnv.h>]], [[ - UConverter *utf = ucnv_open("UTF-8", NULL);]])],[ - AC_MSG_RESULT(yes) - have_libicu=yes],[ - AC_MSG_RESULT(no) - AC_MSG_CHECKING(for icu in -licucore) - - _ldflags="${LDFLAGS}" - _libs="${LIBS}" - LDFLAGS="${LDFLAGS} ${ICU_LIBS}" - LIBS="${LIBS} -licucore" - - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <unicode/ucnv.h>]], [[ - UConverter *utf = ucnv_open("UTF-8", NULL);]])],[ - AC_MSG_RESULT(yes) - have_libicu=yes - ICU_LIBS="${ICU_LIBS} -licucore" - LIBS="${_libs}" - LDFLAGS="${_ldflags}"],[ - AC_MSG_RESULT(no) - LIBS="${_libs}" - LDFLAGS="${_ldflags}"])])) - fi - fi - - # Found the library via either method? - if test "x$have_libicu" = "xyes"; then - WITH_ICU=1 - fi -fi -XML_LIBS="-lxml2" -XML_LIBTOOLLIBS="libxml2.la" -AC_SUBST(WITH_ICU) - -WITH_ISO8859X=1 -if test "$WITH_ICONV" != "1" ; then -if test "$with_iso8859x" = "no" ; then +if test "$WITH_ICONV" != "1" && test "$with_iso8859x" = "no" ; then echo Disabling ISO8859X support WITH_ISO8859X=0 -fi +else + WITH_ISO8859X=1 fi AC_SUBST(WITH_ISO8859X) if test "$with_schemas" = "no" ; then echo "Disabling Schemas/Relax-NG support" WITH_SCHEMAS=0 -else - echo "Enabled Schemas/Relax-NG support" +else WITH_SCHEMAS=1 - AS_IF([test "x$with_python" != "xno"], [ - PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests" - ]) - with_regexps=yes fi AC_SUBST(WITH_SCHEMAS) +AM_CONDITIONAL(WITH_SCHEMAS_SOURCES, test "$WITH_SCHEMAS" = "1") if test "$with_regexps" = "no" ; then echo Disabling Regexps support WITH_REGEXPS=0 - TEST_REGEXPS= -else +else WITH_REGEXPS=1 - TEST_REGEXPS="Automatatests" fi AC_SUBST(WITH_REGEXPS) -AC_SUBST(TEST_REGEXPS) +AM_CONDITIONAL(WITH_REGEXPS_SOURCES, test "$WITH_REGEXPS" = "1") if test "$with_debug" = "no" ; then echo Disabling DEBUG support WITH_DEBUG=0 - DEBUG_OBJ= - TEST_DEBUG= -else +else WITH_DEBUG=1 - DEBUG_OBJ=debugXML.o - TEST_DEBUG=Scripttests fi AC_SUBST(WITH_DEBUG) -AC_SUBST(DEBUG_OBJ) -AC_SUBST(TEST_DEBUG) +AM_CONDITIONAL(WITH_DEBUG_SOURCES, test "$WITH_DEBUG" = "1") if test "$with_mem_debug" = "yes" ; then if test "$with_thread_alloc" = "yes" ; then @@ -1339,102 +743,397 @@ if test "$with_mem_debug" = "yes" ; then echo Enabling memory debug support WITH_MEM_DEBUG=1 fi -else +else WITH_MEM_DEBUG=0 fi AC_SUBST(WITH_MEM_DEBUG) -if test "$with_run_debug" = "yes" ; then - echo Enabling runtime debug support - WITH_RUN_DEBUG=1 +dnl +dnl Check for Python +dnl + +AS_IF([test "x$with_python" != "xno"], [ + AM_PATH_PYTHON + PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}]) +]) +AM_CONDITIONAL([WITH_PYTHON], [test "x$with_python" != "xno"]) + +dnl +dnl Extra Python flags for Windows +dnl +PYTHON_LDFLAGS= +if test "${PYTHON}" != ""; then + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-msys* ) + PYTHON_LDFLAGS="-no-undefined -shrext .pyd" + ;; + esac +fi +AC_SUBST(PYTHON_LDFLAGS) + +dnl +dnl Check for DSO support +dnl +WITH_MODULES=0 + +if test "$with_modules" != "no" ; then + case "$host" in + *-*-cygwin* | *-*-msys* ) + MODULE_EXTENSION=".dll" + ;; + *-*-mingw*) + MODULE_EXTENSION=".dll" + WITH_MODULES=1 + ;; + *-*-hpux*) + MODULE_EXTENSION=".sl" + ;; + *) + MODULE_EXTENSION=".so" + ;; + esac + + if test "$WITH_MODULES" = "0"; then + _libs=$LIBS + AC_SEARCH_LIBS([dlopen], [dl], [ + WITH_MODULES=1 + if test "$ac_cv_search_dlopen" != "none required"; then + MODULE_PLATFORM_LIBS=$ac_cv_search_dlopen + fi + AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])], [ + AC_SEARCH_LIBS([shl_load], [dld], [ + WITH_MODULES=1 + if test "$ac_cv_search_shl_load" != "none required"; then + MODULE_PLATFORM_LIBS=$ac_cv_search_shl_load + fi + AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso])])]) + LIBS=$_libs + fi +fi + +AC_SUBST(WITH_MODULES) +AC_SUBST(MODULE_PLATFORM_LIBS) +AC_SUBST(MODULE_EXTENSION) +AM_CONDITIONAL(WITH_MODULES_SOURCES, test "$WITH_MODULES" = "1") + +dnl +dnl Check for trio string functions +dnl +if test "${NEED_TRIO}" = "1" ; then + echo Adding trio library for string functions + WITH_TRIO=1 else - WITH_RUN_DEBUG=0 + WITH_TRIO=0 fi -AC_SUBST(WITH_RUN_DEBUG) - -WIN32_EXTRA_LIBADD= -WIN32_EXTRA_LDFLAGS= -CYGWIN_EXTRA_LDFLAGS= -CYGWIN_EXTRA_PYTHON_LIBADD= -WIN32_EXTRA_PYTHON_LIBADD= -case "$host" in - *-*-mingw*) - CPPFLAGS="$CPPFLAGS -DWIN32" - WIN32_EXTRA_LIBADD="-lws2_32" - WIN32_EXTRA_LDFLAGS="-no-undefined" - if test "${PYTHON}" != "" - then - case "$host" in - *-w64-mingw*) - WIN32_EXTRA_PYTHON_LIBADD="-shrext .pyd -L${pythondir}/../../lib -lpython${PYTHON_VERSION}" - ;; - *) - WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython$(echo ${PYTHON_VERSION} | tr -d .)" - ;; - esac - fi - ;; - *-*-cygwin*) - CYGWIN_EXTRA_LDFLAGS="-no-undefined" - if test "${PYTHON}" != "" - then - CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}" - fi - ;; -esac +AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1") +AC_SUBST(WITH_TRIO) + +dnl +dnl Thread-related stuff +dnl +THREAD_LIBS="" +BASE_THREAD_LIBS="" +WITH_THREADS=0 +THREAD_CFLAGS="" +WITH_THREAD_ALLOC=0 -XML_PRIVATE_LIBS="$Z_LIBS $LZMA_LIBS $THREAD_LIBS $ICONV_LIBS $ICU_LIBS $LIBM $WIN32_EXTRA_LIBADD" +if test "$with_threads" = "no" ; then + echo Disabling multithreaded support +else + case $host_os in + *mingw*) + dnl Default to native threads on Windows + WITH_THREADS="1" + ;; + *) + dnl Use pthread by default in other cases + _libs=$LIBS + AC_CHECK_HEADERS(pthread.h, + AC_SEARCH_LIBS([pthread_join], [pthread], [ + WITH_THREADS="1" + if test "$ac_cv_search_pthread_join" != "none required"; then + THREAD_LIBS=$ac_cv_search_pthread_join + fi + AC_DEFINE([HAVE_PTHREAD_H], [], + [Define if <pthread.h> is there])])) + LIBS=$_libs + ;; + esac -AC_SUBST(WIN32_EXTRA_LIBADD) -AC_SUBST(WIN32_EXTRA_LDFLAGS) -AC_SUBST(WIN32_EXTRA_PYTHON_LIBADD) -AC_SUBST(CYGWIN_EXTRA_LDFLAGS) -AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD) + case $host_os in + *linux*) + if test "${GCC}" = "yes" ; then + BASE_THREAD_LIBS="$THREAD_LIBS" + THREAD_LIBS="" + fi + ;; + esac + + if test "$WITH_THREADS" = "1" ; then + THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT" + fi +fi +if test "$with_thread_alloc" = "yes" && test "$WITH_THREADS" = "1" ; then + WITH_THREAD_ALLOC=1 +fi + +AC_SUBST(THREAD_LIBS) +AC_SUBST(BASE_THREAD_LIBS) +AC_SUBST(WITH_THREADS) +AC_SUBST(THREAD_CFLAGS) +AC_SUBST(WITH_THREAD_ALLOC) -dnl Checking the standard string functions availability dnl -dnl Note mingw* has C99 implementation that produce expected xml numbers -dnl if code use {v}snprintf functions. -dnl If you like to activate at run-time C99 compatible number output -dnl see release note for mingw runtime 3.15: -dnl http://sourceforge.net/project/shownotes.php?release_id=24832 +dnl xmllint shell history dnl -dnl Also *win32*config.h files redefine them for various MSC compilers. +if test "$with_history" = "yes" && test "$with_readline" != "no"; then + echo Enabling xmllint shell history + dnl check for terminal library. this is a very cool solution + dnl from octave's configure.in + unset tcap + for termlib in ncurses curses termcap terminfo termlib; do + AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"]) + test -n "$tcap" && break + done + + _cppflags=$CPPFLAGS + _libs=$LIBS + if test "$with_readline" != "" && test "$with_readline" != "yes"; then + RDL_DIR=$with_readline + CPPFLAGS="${CPPFLAGS} -I$RDL_DIR/include" + LIBS="${LIBS} -L$RDL_DIR/lib" + fi + AC_CHECK_HEADER(readline/history.h, + AC_CHECK_LIB(history, append_history,[ + RDL_LIBS="-lhistory" + if test "x${RDL_DIR}" != "x"; then + RDL_CFLAGS="-I$RDL_DIR/include" + RDL_LIBS="-L$RDL_DIR/lib $RDL_LIBS" + fi + AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])])) + AC_CHECK_HEADER(readline/readline.h, + AC_CHECK_LIB(readline, readline,[ + RDL_LIBS="-lreadline $RDL_LIBS $tcap" + if test "x$RDL_DIR" != "x"; then + RDL_CFLAGS="-I$RDL_DIR/include" + RDL_LIBS="-L$RDL_DIR/lib $RDL_LIBS" + fi + AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap)) + CPPFLAGS=$_cppflags + LIBS=$_libs +fi +AC_SUBST(RDL_CFLAGS) +AC_SUBST(RDL_LIBS) + dnl -dnl So do not redefine {v}snprintf to _{v}snprintf like following: -dnl AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around]) -dnl AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around]) -dnl and do not redefine those functions is C-source files. +dnl Checks for zlib library. dnl -AC_CHECK_FUNCS(snprintf vsnprintf,, - NEED_TRIO=1) +WITH_ZLIB=0 + +if test "$with_zlib" = "no"; then + echo "Disabling zlib compression support" +else + if test "$with_zlib" != "yes"; then + Z_DIR=$with_zlib + fi + + # Don't run pkg-config if with_zlib contains a path. + if test "x$Z_DIR" = "x"; then + # Try pkg-config first so that static linking works. + PKG_CHECK_MODULES([Z],[zlib], + [WITH_ZLIB=1], + [:]) + fi + + if test "$WITH_ZLIB" = "0"; then + _cppflags=$CPPFLAGS + _libs=$LIBS + if test "x$Z_DIR" != "x"; then + CPPFLAGS="${CPPFLAGS} -I$Z_DIR/include" + LIBS="${LIBS} -L$Z_DIR/lib" + fi + AC_CHECK_HEADERS(zlib.h, + AC_CHECK_LIB(z, gzread,[ + WITH_ZLIB=1 + if test "x${Z_DIR}" != "x"; then + Z_CFLAGS="-I${Z_DIR}/include" + Z_LIBS="-L${Z_DIR}/lib -lz" + [case ${host} in + *-*-solaris*) + Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz" + ;; + esac] + else + Z_LIBS="-lz" + fi]) + ) + CPPFLAGS=$_cppflags + LIBS=$_libs + fi +fi +AC_SUBST(WITH_ZLIB) + +dnl +dnl Checks for lzma library. +dnl +WITH_LZMA=0 + +if test "$with_lzma" = "no"; then + echo "Disabling lzma compression support" +else + if test "$with_lzma" != "yes"; then + LZMA_DIR=$with_lzma + fi + + # Don't run pkg-config if with_lzma contains a path. + if test "x$LZMA_DIR" = "x"; then + # Try pkg-config first so that static linking works. + PKG_CHECK_MODULES([LZMA],[liblzma], + [WITH_LZMA=1], + [:]) + fi + + # If pkg-config failed, fall back to AC_CHECK_LIB. This + # will not pick up the necessary LIBS flags for liblzma's + # private dependencies, though, so static linking may fail. + if test "$WITH_LZMA" = "0"; then + _cppflags=$CPPFLAGS + _libs=$LIBS + if test "x$LZMA_DIR" != "x"; then + CPPFLAGS="${CPPFLAGS} -I$LZMA_DIR/include" + LIBS="${LIBS} -L$LZMA_DIR/lib" + fi + AC_CHECK_HEADERS(lzma.h, + AC_CHECK_LIB(lzma, lzma_code,[ + WITH_LZMA=1 + if test "x${LZMA_DIR}" != "x"; then + LZMA_CFLAGS="-I${LZMA_DIR}/include" + LZMA_LIBS="-L${LZMA_DIR}/lib -llzma" + else + LZMA_LIBS="-llzma" + fi]) + ) + CPPFLAGS=$_cppflags + LIBS=$_libs + fi +fi +AC_SUBST(WITH_LZMA) +AM_CONDITIONAL(WITH_LZMA_SOURCES, test "$WITH_LZMA" = "1") + +dnl +dnl Checks for iconv library. +dnl +WITH_ICONV=0 + +if test "$with_iconv" = "no" ; then + echo Disabling ICONV support +else + _cppflags=$CPPFLAGS + _libs=$LIBS + if test "$with_iconv" != "yes" && test "$with_iconv" != "" ; then + ICONV_DIR=$with_iconv + CPPFLAGS="$CPPFLAGS -I$ICONV_DIR/include" + LIBS="$LIBS -L$ICONV_DIR/libs" + # Export this since our headers include iconv.h + XML_INCLUDEDIR="$XML_INCLUDEDIR -I$ICONV_DIR/include" + fi + AC_CHECK_HEADER(iconv.h, [ + AC_SEARCH_LIBS([iconv], [iconv], [ + WITH_ICONV=1 + if test "$ac_cv_search_iconv" != "none required"; then + ICONV_LIBS=$ac_cv_search_iconv + fi], [ + dnl GNU libiconv prefixes symbols with "lib" + AC_CHECK_LIB([iconv], [libiconv], [ + WITH_ICONV=1 + ICONV_LIBS="-liconv"])])]) + if test "$WITH_ICONV" = "1" && test "$ICONV_DIR" != ""; then + ICONV_CFLAGS="-I$ICONV_DIR/include" + ICONV_LIBS="-L$ICONV_DIR/libs $ICONV_LIBS" + fi + CPPFLAGS=$_cppflags + LIBS=$_libs +fi +AC_SUBST(WITH_ICONV) + +dnl +dnl Checks for ICU library. +dnl +WITH_ICU=0 +ICU_LIBS="" + +if test "$with_icu" != "yes" ; then + echo Disabling ICU support +else + # Try pkg-config first so that static linking works. + # If this succeeeds, we ignore the WITH_ICU directory. + PKG_CHECK_MODULES([ICU], [icu-i18n], [ + WITH_ICU=1 + m4_ifdef([PKG_CHECK_VAR], + [PKG_CHECK_VAR([ICU_DEFS], [icu-i18n], [DEFS])]) + if test "x$ICU_DEFS" != "x"; then + ICU_CFLAGS="$ICU_CFLAGS $ICU_DEFS" + fi],[:]) + + if test "$WITH_ICU" = "0"; then + ICU_CONFIG=icu-config + if ${ICU_CONFIG} --cflags >/dev/null 2>&1 + then + WITH_ICU=1 + ICU_CFLAGS=`${ICU_CONFIG} --cflags` + ICU_LIBS=`${ICU_CONFIG} --ldflags` + else + _cppflags="${CPPFLAGS}" + _libs="${LIBS}" + if test "$with_icu" != "yes" && test "$with_icu" != "" ; then + ICU_DIR=$with_icu + CPPFLAGS="${CPPFLAGS} -I$ICU_DIR/include" + LIBS="${LIBS} -L$ICU_DIR/lib" + fi + + AC_CHECK_HEADER(unicode/ucnv.h, [ + AC_CHECK_LIB([icucore], [uconv_open], [ + WITH_ICU=1 + ICU_LIBS=-licucore + if test "$ICU_DIR" != ""; then + ICU_CFLAGS="-I$ICU_DIR/include" + ICU_LIBS="-L$ICU_DIR/libs $ICU_LIBS" + fi])]) + CPPFLAGS=$_cppflags + LIBS=$_libs + fi + fi +fi +AC_SUBST(WITH_ICU) if test "$with_coverage" = "yes" && test "${GCC}" = "yes" then echo Enabling code coverage for GCC - EXTRA_CFLAGS="$EXTRA_CFLAGS -fprofile-arcs -ftest-coverage" - LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage" + AM_CFLAGS="$AM_CFLAGS -fprofile-arcs -ftest-coverage" + AM_LDFLAGS="$AM_LDFLAGS -fprofile-arcs -ftest-coverage" else echo Disabling code coverage for GCC fi -AC_SUBST(EXTRA_CFLAGS) +XML_LIBS="-lxml2" +XML_LIBTOOLLIBS="libxml2.la" +XML_PRIVATE_LIBS="$Z_LIBS $LZMA_LIBS $THREAD_LIBS $ICONV_LIBS $ICU_LIBS $LIBM $NET_LIBS" +XML_PRIVATE_CFLAGS="$Z_CFLAGS $LZMA_CFLAGS $THREAD_CFLAGS $ICONV_CFLAGS $ICU_CFLAGS" + +AC_SUBST(AM_CFLAGS) +AC_SUBST(AM_LDFLAGS) AC_SUBST(XML_CFLAGS) AC_SUBST(XML_LIBDIR) AC_SUBST(XML_LIBS) AC_SUBST(XML_PRIVATE_LIBS) +AC_SUBST(XML_PRIVATE_CFLAGS) AC_SUBST(XML_LIBTOOLLIBS) -AC_SUBST(ICONV_LIBS) -AC_SUBST(ICU_LIBS) AC_SUBST(XML_INCLUDEDIR) -AC_SUBST(RDL_LIBS) - dnl for the spec file RELDATE=`date +'%a %b %e %Y'` AC_SUBST(RELDATE) -AC_SUBST(PYTHON_TESTS) # keep on one line for cygwin c.f. #130896 AC_CONFIG_FILES([libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile include/private/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile fuzz/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h libxml-2.0.pc libxml-2.0-uninstalled.pc libxml2-config.cmake]) diff --git a/chromium/third_party/libxml/src/entities.c b/chromium/third_party/libxml/src/entities.c index 25422b7f60a..81b75df954c 100644 --- a/chromium/third_party/libxml/src/entities.c +++ b/chromium/third_party/libxml/src/entities.c @@ -129,36 +129,19 @@ xmlFreeEntity(xmlEntityPtr entity) if ((entity->children) && (entity->owner == 1) && (entity == (xmlEntityPtr) entity->children->parent)) xmlFreeNodeList(entity->children); - if (dict != NULL) { - if ((entity->name != NULL) && (!xmlDictOwns(dict, entity->name))) - xmlFree((char *) entity->name); - if ((entity->ExternalID != NULL) && - (!xmlDictOwns(dict, entity->ExternalID))) - xmlFree((char *) entity->ExternalID); - if ((entity->SystemID != NULL) && - (!xmlDictOwns(dict, entity->SystemID))) - xmlFree((char *) entity->SystemID); - if ((entity->URI != NULL) && (!xmlDictOwns(dict, entity->URI))) - xmlFree((char *) entity->URI); - if ((entity->content != NULL) - && (!xmlDictOwns(dict, entity->content))) - xmlFree((char *) entity->content); - if ((entity->orig != NULL) && (!xmlDictOwns(dict, entity->orig))) - xmlFree((char *) entity->orig); - } else { - if (entity->name != NULL) - xmlFree((char *) entity->name); - if (entity->ExternalID != NULL) - xmlFree((char *) entity->ExternalID); - if (entity->SystemID != NULL) - xmlFree((char *) entity->SystemID); - if (entity->URI != NULL) - xmlFree((char *) entity->URI); - if (entity->content != NULL) - xmlFree((char *) entity->content); - if (entity->orig != NULL) - xmlFree((char *) entity->orig); - } + if ((entity->name != NULL) && + ((dict == NULL) || (!xmlDictOwns(dict, entity->name)))) + xmlFree((char *) entity->name); + if (entity->ExternalID != NULL) + xmlFree((char *) entity->ExternalID); + if (entity->SystemID != NULL) + xmlFree((char *) entity->SystemID); + if (entity->URI != NULL) + xmlFree((char *) entity->URI); + if (entity->content != NULL) + xmlFree((char *) entity->content); + if (entity->orig != NULL) + xmlFree((char *) entity->orig); xmlFree(entity); } @@ -195,18 +178,12 @@ xmlCreateEntity(xmlDictPtr dict, const xmlChar *name, int type, ret->SystemID = xmlStrdup(SystemID); } else { ret->name = xmlDictLookup(dict, name, -1); - if (ExternalID != NULL) - ret->ExternalID = xmlDictLookup(dict, ExternalID, -1); - if (SystemID != NULL) - ret->SystemID = xmlDictLookup(dict, SystemID, -1); + ret->ExternalID = xmlStrdup(ExternalID); + ret->SystemID = xmlStrdup(SystemID); } if (content != NULL) { ret->length = xmlStrlen(content); - if ((dict != NULL) && (ret->length < 5)) - ret->content = (xmlChar *) - xmlDictLookup(dict, content, ret->length); - else - ret->content = xmlStrndup(content, ret->length); + ret->content = xmlStrndup(content, ret->length); } else { ret->length = 0; ret->content = NULL; @@ -629,7 +606,7 @@ xmlEncodeEntitiesInternal(xmlDocPtr doc, const xmlChar *input, int attr) { * allocate an translation buffer. */ buffer_size = 1000; - buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar)); + buffer = (xmlChar *) xmlMalloc(buffer_size); if (buffer == NULL) { xmlEntitiesErrMemory("xmlEncodeEntities: malloc failed"); return(NULL); @@ -869,7 +846,7 @@ xmlEncodeSpecialChars(const xmlDoc *doc ATTRIBUTE_UNUSED, const xmlChar *input) * allocate an translation buffer. */ buffer_size = 1000; - buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar)); + buffer = (xmlChar *) xmlMalloc(buffer_size); if (buffer == NULL) { xmlEntitiesErrMemory("xmlEncodeSpecialChars: malloc failed"); return(NULL); diff --git a/chromium/third_party/libxml/src/error.c b/chromium/third_party/libxml/src/error.c index 49bd84e000f..c96877f4835 100644 --- a/chromium/third_party/libxml/src/error.c +++ b/chromium/third_party/libxml/src/error.c @@ -81,6 +81,8 @@ xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) { * initGenericErrorDefaultFunc: * @handler: the handler * + * DEPRECATED: Use xmlSetGenericErrorFunc. + * * Set or reset (if NULL) the default handler for generic errors * to the builtin error function. */ diff --git a/chromium/third_party/libxml/src/include/libxml/threads.h b/chromium/third_party/libxml/src/include/libxml/threads.h index 6eedac1f374..5c9d0bd27b0 100644 --- a/chromium/third_party/libxml/src/include/libxml/threads.h +++ b/chromium/third_party/libxml/src/include/libxml/threads.h @@ -74,14 +74,12 @@ XMLPUBFUN void XMLCALL XMLPUBFUN xmlGlobalStatePtr XMLCALL xmlGetGlobalState(void); -#ifdef HAVE_PTHREAD_H -#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) -#if defined(LIBXML_STATIC_FOR_DLL) +#if defined(LIBXML_THREAD_ENABLED) && defined(_WIN32) && \ + !defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL) int XMLCALL xmlDllMain(void *hinstDLL, unsigned long fdwReason, void *lpvReserved); #endif -#endif #ifdef __cplusplus } diff --git a/chromium/third_party/libxml/src/include/libxml/xmlerror.h b/chromium/third_party/libxml/src/include/libxml/xmlerror.h index f92b1aeed3e..f8ca8ab86b9 100644 --- a/chromium/third_party/libxml/src/include/libxml/xmlerror.h +++ b/chromium/third_party/libxml/src/include/libxml/xmlerror.h @@ -864,6 +864,7 @@ typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr erro XMLPUBFUN void XMLCALL xmlSetGenericErrorFunc (void *ctx, xmlGenericErrorFunc handler); +XML_DEPRECATED XMLPUBFUN void XMLCALL initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler); diff --git a/chromium/third_party/libxml/src/include/libxml/xmlversion.h.in b/chromium/third_party/libxml/src/include/libxml/xmlversion.h.in index bdebfe3b0c9..e83fb787265 100644 --- a/chromium/third_party/libxml/src/include/libxml/xmlversion.h.in +++ b/chromium/third_party/libxml/src/include/libxml/xmlversion.h.in @@ -313,9 +313,9 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); /** * LIBXML_DEBUG_RUNTIME: * - * Whether the runtime debugging is configured in + * Removed */ -#if @WITH_RUN_DEBUG@ +#if 0 #define LIBXML_DEBUG_RUNTIME #endif @@ -409,12 +409,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #endif #ifdef __GNUC__ - -/** - * ATTRIBUTE_UNUSED: - * - * Macro used to signal to GCC unused function parameters - */ +/** DOC_DISABLE */ #ifndef ATTRIBUTE_UNUSED # if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) @@ -424,12 +419,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); # endif #endif -/** - * LIBXML_ATTR_ALLOC_SIZE: - * - * Macro used to indicate to GCC this is an allocator function - */ - #ifndef LIBXML_ATTR_ALLOC_SIZE # if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))) # define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x))) @@ -440,12 +429,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); # define LIBXML_ATTR_ALLOC_SIZE(x) #endif -/** - * LIBXML_ATTR_FORMAT: - * - * Macro used to indicate to GCC the parameter are printf like - */ - #ifndef LIBXML_ATTR_FORMAT # if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) # define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args))) @@ -465,6 +448,19 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); # endif #endif +#if defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) +#define XML_IGNORE_FPTR_CAST_WARNINGS \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \ + _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"") +#define XML_POP_WARNINGS \ + _Pragma("GCC diagnostic pop") +#else +#define XML_IGNORE_FPTR_CAST_WARNINGS +#define XML_POP_WARNINGS +#endif + +/** DOC_ENABLE */ #else /* ! __GNUC__ */ /** * ATTRIBUTE_UNUSED: @@ -493,6 +489,18 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #ifndef XML_DEPRECATED #define XML_DEPRECATED #endif +/** + * LIBXML_IGNORE_FPTR_CAST_WARNINGS: + * + * Macro used to ignore pointer cast warnings that can't be worked around. + */ +#define XML_IGNORE_FPTR_CAST_WARNINGS +/** + * LIBXML_POP_WARNINGS: + * + * Macro used to restore warnings state. + */ +#define XML_POP_WARNINGS #endif /* __GNUC__ */ #ifdef __cplusplus diff --git a/chromium/third_party/libxml/src/include/private/Makefile.in b/chromium/third_party/libxml/src/include/private/Makefile.in index 3bbc5274ad9..2c41f374264 100644 --- a/chromium/third_party/libxml/src/include/private/Makefile.in +++ b/chromium/third_party/libxml/src/include/private/Makefile.in @@ -124,26 +124,22 @@ am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASE_THREAD_LIBS = @BASE_THREAD_LIBS@ -C14N_OBJ = @C14N_OBJ@ -CATALOG_OBJ = @CATALOG_OBJ@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ -CYGWIN_EXTRA_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ -CYGWIN_EXTRA_PYTHON_LIBADD = @CYGWIN_EXTRA_PYTHON_LIBADD@ -DEBUG_OBJ = @DEBUG_OBJ@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ @@ -155,14 +151,9 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -EXTRA_CFLAGS = @EXTRA_CFLAGS@ FGREP = @FGREP@ FILECMD = @FILECMD@ -FTP_OBJ = @FTP_OBJ@ GREP = @GREP@ -HTML_OBJ = @HTML_OBJ@ -HTTP_OBJ = @HTTP_OBJ@ -ICONV_LIBS = @ICONV_LIBS@ ICU_CFLAGS = @ICU_CFLAGS@ ICU_DEFS = @ICU_DEFS@ ICU_LIBS = @ICU_LIBS@ @@ -196,7 +187,6 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MODULE_EXTENSION = @MODULE_EXTENSION@ MODULE_PLATFORM_LIBS = @MODULE_PLATFORM_LIBS@ -MV = @MV@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ @@ -218,12 +208,13 @@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PYTHON = @PYTHON@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ -PYTHON_TESTS = @PYTHON_TESTS@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ +RDL_CFLAGS = @RDL_CFLAGS@ RDL_LIBS = @RDL_LIBS@ RELDATE = @RELDATE@ SED = @SED@ @@ -231,20 +222,11 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TAR = @TAR@ -TEST_CATALOG = @TEST_CATALOG@ -TEST_DEBUG = @TEST_DEBUG@ -TEST_REGEXPS = @TEST_REGEXPS@ -TEST_SCHEMATRON = @TEST_SCHEMATRON@ -TEST_VALID = @TEST_VALID@ -TEST_VTIME = @TEST_VTIME@ THREAD_CFLAGS = @THREAD_CFLAGS@ THREAD_LIBS = @THREAD_LIBS@ VERSION = @VERSION@ VERSION_SCRIPT_FLAGS = @VERSION_SCRIPT_FLAGS@ WGET = @WGET@ -WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ -WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ -WIN32_EXTRA_PYTHON_LIBADD = @WIN32_EXTRA_PYTHON_LIBADD@ WITH_C14N = @WITH_C14N@ WITH_CATALOG = @WITH_CATALOG@ WITH_DEBUG = @WITH_DEBUG@ @@ -263,7 +245,6 @@ WITH_PATTERN = @WITH_PATTERN@ WITH_PUSH = @WITH_PUSH@ WITH_READER = @WITH_READER@ WITH_REGEXPS = @WITH_REGEXPS@ -WITH_RUN_DEBUG = @WITH_RUN_DEBUG@ WITH_SAX1 = @WITH_SAX1@ WITH_SCHEMAS = @WITH_SCHEMAS@ WITH_SCHEMATRON = @WITH_SCHEMATRON@ @@ -278,16 +259,13 @@ WITH_XPATH = @WITH_XPATH@ WITH_XPTR = @WITH_XPTR@ WITH_XPTR_LOCS = @WITH_XPTR_LOCS@ WITH_ZLIB = @WITH_ZLIB@ -XINCLUDE_OBJ = @XINCLUDE_OBJ@ -XMLLINT = @XMLLINT@ XML_CFLAGS = @XML_CFLAGS@ XML_INCLUDEDIR = @XML_INCLUDEDIR@ XML_LIBDIR = @XML_LIBDIR@ XML_LIBS = @XML_LIBS@ XML_LIBTOOLLIBS = @XML_LIBTOOLLIBS@ +XML_PRIVATE_CFLAGS = @XML_PRIVATE_CFLAGS@ XML_PRIVATE_LIBS = @XML_PRIVATE_LIBS@ -XPATH_OBJ = @XPATH_OBJ@ -XPTR_OBJ = @XPTR_OBJ@ XSLTPROC = @XSLTPROC@ Z_CFLAGS = @Z_CFLAGS@ Z_LIBS = @Z_LIBS@ diff --git a/chromium/third_party/libxml/src/include/win32config.h b/chromium/third_party/libxml/src/include/win32config.h index 4f99ae0b2ea..2b113237058 100644 --- a/chromium/third_party/libxml/src/include/win32config.h +++ b/chromium/third_party/libxml/src/include/win32config.h @@ -1,9 +1,6 @@ #ifndef __LIBXML_WIN32_CONFIG__ #define __LIBXML_WIN32_CONFIG__ -#define SEND_ARG2_CAST -#define GETHOSTBYNAME_ARG_CAST - #define HAVE_SYS_STAT_H #define HAVE_STAT #define HAVE_FCNTL_H @@ -12,9 +9,13 @@ #define HAVE_STDINT_H #endif -#if defined(_MSC_VER) && _MSC_VER < 1900 +#if defined(_MSC_VER) +#if _MSC_VER < 1900 #define snprintf _snprintf -#define vsnprintf _vsnprintf +#endif +#if _MSC_VER < 1500 +#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a) +#endif #endif #endif /* __LIBXML_WIN32_CONFIG__ */ diff --git a/chromium/third_party/libxml/src/include/wsockcompat.h b/chromium/third_party/libxml/src/include/wsockcompat.h index 85b9e7d5689..141de0c6405 100644 --- a/chromium/third_party/libxml/src/include/wsockcompat.h +++ b/chromium/third_party/libxml/src/include/wsockcompat.h @@ -25,11 +25,14 @@ /* Check if ws2tcpip.h is a recent version which provides getaddrinfo() */ #if defined(GetAddrInfo) #include <wspiapi.h> -#define HAVE_GETADDRINFO +#ifndef SUPPORT_IP6 + #define SUPPORT_IP6 +#endif #endif -#undef XML_SOCKLEN_T +#ifndef XML_SOCKLEN_T #define XML_SOCKLEN_T int +#endif #ifndef ECONNRESET #define ECONNRESET WSAECONNRESET diff --git a/chromium/third_party/libxml/src/libxml.h b/chromium/third_party/libxml/src/libxml.h index a38f4f7c7f2..59294473c58 100644 --- a/chromium/third_party/libxml/src/libxml.h +++ b/chromium/third_party/libxml/src/libxml.h @@ -55,18 +55,6 @@ int vfprintf(FILE *, const char *, va_list); #endif #if defined(__clang__) || \ - (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)) -#define XML_IGNORE_PEDANTIC_WARNINGS \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wpedantic\"") -#define XML_POP_WARNINGS \ - _Pragma("GCC diagnostic pop") -#else -#define XML_IGNORE_PEDANTIC_WARNINGS -#define XML_POP_WARNINGS -#endif - -#if defined(__clang__) || \ (defined(__GNUC__) && (__GNUC__ >= 8)) #define ATTRIBUTE_NO_SANITIZE(arg) __attribute__((no_sanitize(arg))) #else diff --git a/chromium/third_party/libxml/src/nanoftp.c b/chromium/third_party/libxml/src/nanoftp.c index 009a8416cbe..b52f9b64808 100644 --- a/chromium/third_party/libxml/src/nanoftp.c +++ b/chromium/third_party/libxml/src/nanoftp.c @@ -48,9 +48,6 @@ #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif #include <libxml/xmlmemory.h> #include <libxml/parser.h> @@ -78,27 +75,16 @@ * A couple portability macros */ #ifndef _WINSOCKAPI_ -#if !defined(__BEOS__) || defined(__HAIKU__) #define closesocket(s) close(s) #endif -#endif - -#ifdef __BEOS__ -#ifndef PF_INET -#define PF_INET AF_INET -#endif -#endif - -#ifdef _AIX -#ifdef HAVE_BROKEN_SS_FAMILY -#define ss_family __ss_family -#endif -#endif #ifndef XML_SOCKLEN_T #define XML_SOCKLEN_T unsigned int #endif +#define GETHOSTBYNAME_ARG_CAST (char *) +#define SEND_ARG2_CAST (char *) + #define FTP_COMMAND_OK 200 #define FTP_SYNTAX_ERROR 500 #define FTP_GET_PASSWD 331 diff --git a/chromium/third_party/libxml/src/nanohttp.c b/chromium/third_party/libxml/src/nanohttp.c index cfd59eea504..0678b730eed 100644 --- a/chromium/third_party/libxml/src/nanohttp.c +++ b/chromium/third_party/libxml/src/nanohttp.c @@ -22,9 +22,6 @@ #ifdef HAVE_UNISTD_H #include <unistd.h> #endif -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif @@ -37,12 +34,6 @@ #ifdef HAVE_NETDB_H #include <netdb.h> #endif -#ifdef HAVE_RESOLV_H -#ifdef HAVE_ARPA_NAMESER_H -#include <arpa/nameser.h> -#endif -#include <resolv.h> -#endif #ifdef HAVE_FCNTL_H #include <fcntl.h> #endif @@ -85,23 +76,18 @@ * A couple portability macros */ #ifndef _WINSOCKAPI_ -#if !defined(__BEOS__) || defined(__HAIKU__) #define closesocket(s) close(s) -#endif #define SOCKET int #define INVALID_SOCKET (-1) #endif -#ifdef __BEOS__ -#ifndef PF_INET -#define PF_INET AF_INET -#endif -#endif - #ifndef XML_SOCKLEN_T #define XML_SOCKLEN_T unsigned int #endif +#define GETHOSTBYNAME_ARG_CAST (char *) +#define SEND_ARG2_CAST (char *) + #ifdef STANDALONE #define DEBUG_HTTP #define xmlStrncasecmp(a, b, n) strncasecmp((char *)a, (char *)b, n) @@ -191,20 +177,6 @@ static int socket_errno(void) { #endif } -#ifdef SUPPORT_IP6 -static -int have_ipv6(void) { - SOCKET s; - - s = socket (AF_INET6, SOCK_STREAM, 0); - if (s != INVALID_SOCKET) { - close (s); - return (1); - } - return (0); -} -#endif - /** * xmlNanoHTTPInit: * @@ -538,7 +510,7 @@ xmlNanoHTTPRecv(xmlNanoHTTPCtxtPtr ctxt) while (ctxt->state & XML_NANO_HTTP_READ) { if (ctxt->in == NULL) { - ctxt->in = (char *) xmlMallocAtomic(65000 * sizeof(char)); + ctxt->in = (char *) xmlMallocAtomic(65000); if (ctxt->in == NULL) { xmlHTTPErrMemory("allocating input"); ctxt->last = -1; @@ -899,15 +871,6 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr) status = ioctl(s, FIONBIO, &enable); } #else /* VMS */ -#if defined(__BEOS__) && !defined(__HAIKU__) - { - bool noblock = true; - - status = - setsockopt(s, SOL_SOCKET, SO_NONBLOCK, &noblock, - sizeof(noblock)); - } -#else /* __BEOS__ */ if ((status = fcntl(s, F_GETFL, 0)) != -1) { #ifdef O_NONBLOCK status |= O_NONBLOCK; @@ -926,7 +889,6 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr) closesocket(s); return INVALID_SOCKET; } -#endif /* !__BEOS__ */ #endif /* !VMS */ #endif /* !_WINSOCKAPI_ */ @@ -1045,33 +1007,19 @@ xmlNanoHTTPConnectHost(const char *host, int port) struct sockaddr_in sockin; #ifdef SUPPORT_IP6 - struct in6_addr ia6; struct sockaddr_in6 sockin6; #endif SOCKET s; memset (&sockin, 0, sizeof(sockin)); -#ifdef SUPPORT_IP6 - memset (&sockin6, 0, sizeof(sockin6)); -#endif - -#if !defined(HAVE_GETADDRINFO) && defined(SUPPORT_IP6) && defined(RES_USE_INET6) - if (have_ipv6 ()) - { - if (!(_res.options & RES_INIT)) - res_init(); - _res.options |= RES_USE_INET6; - } -#endif -#if defined(HAVE_GETADDRINFO) && defined(SUPPORT_IP6) && !defined(_WIN32) - if (have_ipv6 ()) -#endif -#if defined(HAVE_GETADDRINFO) && (defined(SUPPORT_IP6) || defined(_WIN32)) +#if defined(SUPPORT_IP6) { int status; struct addrinfo hints, *res, *result; + memset (&sockin6, 0, sizeof(sockin6)); + result = NULL; memset (&hints, 0,sizeof(hints)); hints.ai_socktype = SOCK_STREAM; @@ -1092,8 +1040,7 @@ xmlNanoHTTPConnectHost(const char *host, int port) memcpy (&sockin, res->ai_addr, res->ai_addrlen); sockin.sin_port = htons (port); addr = (struct sockaddr *)&sockin; -#ifdef SUPPORT_IP6 - } else if (have_ipv6 () && (res->ai_family == AF_INET6)) { + } else if (res->ai_family == AF_INET6) { if ((size_t)res->ai_addrlen > sizeof(sockin6)) { __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n"); freeaddrinfo (result); @@ -1102,7 +1049,6 @@ xmlNanoHTTPConnectHost(const char *host, int port) memcpy (&sockin6, res->ai_addr, res->ai_addrlen); sockin6.sin6_port = htons (port); addr = (struct sockaddr *)&sockin6; -#endif } else continue; /* for */ @@ -1116,11 +1062,7 @@ xmlNanoHTTPConnectHost(const char *host, int port) if (result) freeaddrinfo (result); } -#endif -#if defined(HAVE_GETADDRINFO) && defined(SUPPORT_IP6) && !defined(_WIN32) - else -#endif -#if !defined(HAVE_GETADDRINFO) || !defined(_WIN32) +#else { struct hostent *h; struct in_addr ia; @@ -1182,19 +1124,6 @@ xmlNanoHTTPConnectHost(const char *host, int port) sockin.sin_addr = ia; sockin.sin_port = (unsigned short)htons ((unsigned short)port); addr = (struct sockaddr *) &sockin; -#ifdef SUPPORT_IP6 - } else if (have_ipv6 () && (h->h_addrtype == AF_INET6)) { - /* AAAA records (IPv6) */ - if ((unsigned int) h->h_length > sizeof(ia6)) { - __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n"); - return INVALID_SOCKET; - } - memcpy (&ia6, h->h_addr_list[i], h->h_length); - sockin6.sin6_family = h->h_addrtype; - sockin6.sin6_addr = ia6; - sockin6.sin6_port = htons (port); - addr = (struct sockaddr *) &sockin6; -#endif } else break; /* for */ diff --git a/chromium/third_party/libxml/src/parser.c b/chromium/third_party/libxml/src/parser.c index fa8ff0f46e0..cb473fe122b 100644 --- a/chromium/third_party/libxml/src/parser.c +++ b/chromium/third_party/libxml/src/parser.c @@ -71,6 +71,9 @@ #include <libxml/xmlschemastypes.h> #include <libxml/relaxng.h> #endif +#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#include <libxml/xpath.h> +#endif #include "private/buf.h" #include "private/enc.h" @@ -109,6 +112,8 @@ xmlParseElementEnd(xmlParserCtxtPtr ctxt); * * ************************************************************************/ +#define XML_MAX_HUGE_LENGTH 1000000000 + #define XML_PARSER_BIG_ENTITY 1000 #define XML_PARSER_LOT_ENTITY 5000 @@ -566,7 +571,7 @@ xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info) errmsg = "Malformed declaration expecting version"; break; case XML_ERR_NAME_TOO_LONG: - errmsg = "Name too long use XML_PARSE_HUGE option"; + errmsg = "Name too long"; break; #if 0 case: @@ -1061,11 +1066,7 @@ xmlHasFeature(xmlFeature feature) return(0); #endif case XML_WITH_DEBUG_RUN: -#ifdef LIBXML_DEBUG_RUNTIME - return(1); -#else return(0); -#endif case XML_WITH_ZLIB: #ifdef LIBXML_ZLIB_ENABLED return(1); @@ -2176,7 +2177,7 @@ static void xmlGROW (xmlParserCtxtPtr ctxt) { #define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l) #define COPY_BUF(l,b,i,v) \ - if (l == 1) b[i++] = (xmlChar) v; \ + if (l == 1) b[i++] = v; \ else i += xmlCopyCharMultiByte(&b[i],v) #define CUR_CONSUMED \ @@ -2994,7 +2995,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { */ max = len * 2; - buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); + buffer = (xmlChar *) xmlMallocAtomic(max); if (buffer == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); @@ -3005,8 +3006,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { xmlChar *tmp; max *= 2; - tmp = (xmlChar *) xmlRealloc(buffer, - max * sizeof(xmlChar)); + tmp = (xmlChar *) xmlRealloc(buffer, max); if (tmp == NULL) { xmlFree(buffer); xmlErrMemory(ctxt, NULL); @@ -3073,7 +3073,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { */ max = len * 2; - buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); + buffer = (xmlChar *) xmlMallocAtomic(max); if (buffer == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); @@ -3084,8 +3084,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { xmlChar *tmp; max *= 2; - tmp = (xmlChar *) xmlRealloc(buffer, - max * sizeof(xmlChar)); + tmp = (xmlChar *) xmlRealloc(buffer, max); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); xmlFree(buffer); @@ -3218,6 +3217,9 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) { int len = 0, l; int c; int count = 0; + int maxLength = (ctxt->options & XML_PARSE_HUGE) ? + XML_MAX_TEXT_LENGTH : + XML_MAX_NAME_LENGTH; #ifdef DEBUG nbParseNameComplex++; @@ -3283,7 +3285,8 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) { if (ctxt->instate == XML_PARSER_EOF) return(NULL); } - len += l; + if (len <= INT_MAX - l) + len += l; NEXTL(l); c = CUR_CHAR(l); } @@ -3309,13 +3312,13 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) { if (ctxt->instate == XML_PARSER_EOF) return(NULL); } - len += l; + if (len <= INT_MAX - l) + len += l; NEXTL(l); c = CUR_CHAR(l); } } - if ((len > XML_MAX_NAME_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { + if (len > maxLength) { xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Name"); return(NULL); } @@ -3356,7 +3359,10 @@ const xmlChar * xmlParseName(xmlParserCtxtPtr ctxt) { const xmlChar *in; const xmlChar *ret; - int count = 0; + size_t count = 0; + size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ? + XML_MAX_TEXT_LENGTH : + XML_MAX_NAME_LENGTH; GROW; @@ -3380,8 +3386,7 @@ xmlParseName(xmlParserCtxtPtr ctxt) { in++; if ((*in > 0) && (*in < 0x80)) { count = in - ctxt->input->cur; - if ((count > XML_MAX_NAME_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { + if (count > maxLength) { xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Name"); return(NULL); } @@ -3402,6 +3407,9 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) { int len = 0, l; int c; int count = 0; + int maxLength = (ctxt->options & XML_PARSE_HUGE) ? + XML_MAX_TEXT_LENGTH : + XML_MAX_NAME_LENGTH; size_t startPosition = 0; #ifdef DEBUG @@ -3422,17 +3430,13 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) { while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ (xmlIsNameChar(ctxt, c) && (c != ':'))) { if (count++ > XML_PARSER_CHUNK_SIZE) { - if ((len > XML_MAX_NAME_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { - xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName"); - return(NULL); - } count = 0; GROW; if (ctxt->instate == XML_PARSER_EOF) return(NULL); } - len += l; + if (len <= INT_MAX - l) + len += l; NEXTL(l); c = CUR_CHAR(l); if (c == 0) { @@ -3450,8 +3454,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) { c = CUR_CHAR(l); } } - if ((len > XML_MAX_NAME_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { + if (len > maxLength) { xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName"); return(NULL); } @@ -3477,7 +3480,10 @@ static const xmlChar * xmlParseNCName(xmlParserCtxtPtr ctxt) { const xmlChar *in, *e; const xmlChar *ret; - int count = 0; + size_t count = 0; + size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ? + XML_MAX_TEXT_LENGTH : + XML_MAX_NAME_LENGTH; #ifdef DEBUG nbParseNCName++; @@ -3502,8 +3508,7 @@ xmlParseNCName(xmlParserCtxtPtr ctxt) { goto complex; if ((*in > 0) && (*in < 0x80)) { count = in - ctxt->input->cur; - if ((count > XML_MAX_NAME_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { + if (count > maxLength) { xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName"); return(NULL); } @@ -3585,6 +3590,9 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) { const xmlChar *cur = *str; int len = 0, l; int c; + int maxLength = (ctxt->options & XML_PARSE_HUGE) ? + XML_MAX_TEXT_LENGTH : + XML_MAX_NAME_LENGTH; #ifdef DEBUG nbParseStringName++; @@ -3610,7 +3618,7 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) { xmlChar *buffer; int max = len * 2; - buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); + buffer = (xmlChar *) xmlMallocAtomic(max); if (buffer == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); @@ -3620,15 +3628,8 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) { if (len + 10 > max) { xmlChar *tmp; - if ((len > XML_MAX_NAME_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { - xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName"); - xmlFree(buffer); - return(NULL); - } max *= 2; - tmp = (xmlChar *) xmlRealloc(buffer, - max * sizeof(xmlChar)); + tmp = (xmlChar *) xmlRealloc(buffer, max); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); xmlFree(buffer); @@ -3639,14 +3640,18 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) { COPY_BUF(l,buffer,len,c); cur += l; c = CUR_SCHAR(cur, l); + if (len > maxLength) { + xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName"); + xmlFree(buffer); + return(NULL); + } } buffer[len] = 0; *str = cur; return(buffer); } } - if ((len > XML_MAX_NAME_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { + if (len > maxLength) { xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName"); return(NULL); } @@ -3675,6 +3680,9 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) { int len = 0, l; int c; int count = 0; + int maxLength = (ctxt->options & XML_PARSE_HUGE) ? + XML_MAX_TEXT_LENGTH : + XML_MAX_NAME_LENGTH; #ifdef DEBUG nbParseNmToken++; @@ -3708,7 +3716,7 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) { xmlChar *buffer; int max = len * 2; - buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); + buffer = (xmlChar *) xmlMallocAtomic(max); if (buffer == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); @@ -3726,15 +3734,8 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) { if (len + 10 > max) { xmlChar *tmp; - if ((max > XML_MAX_NAME_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { - xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NmToken"); - xmlFree(buffer); - return(NULL); - } max *= 2; - tmp = (xmlChar *) xmlRealloc(buffer, - max * sizeof(xmlChar)); + tmp = (xmlChar *) xmlRealloc(buffer, max); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); xmlFree(buffer); @@ -3745,6 +3746,11 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) { COPY_BUF(l,buffer,len,c); NEXTL(l); c = CUR_CHAR(l); + if (len > maxLength) { + xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NmToken"); + xmlFree(buffer); + return(NULL); + } } buffer[len] = 0; return(buffer); @@ -3752,8 +3758,7 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) { } if (len == 0) return(NULL); - if ((len > XML_MAX_NAME_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { + if (len > maxLength) { xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NmToken"); return(NULL); } @@ -3781,6 +3786,9 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) { int len = 0; int size = XML_PARSER_BUFFER_SIZE; int c, l; + int maxLength = (ctxt->options & XML_PARSE_HUGE) ? + XML_MAX_HUGE_LENGTH : + XML_MAX_TEXT_LENGTH; xmlChar stop; xmlChar *ret = NULL; const xmlChar *cur = NULL; @@ -3792,7 +3800,7 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) { xmlFatalErr(ctxt, XML_ERR_ENTITY_NOT_STARTED, NULL); return(NULL); } - buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); + buf = (xmlChar *) xmlMallocAtomic(size); if (buf == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); @@ -3824,7 +3832,7 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) { xmlChar *tmp; size *= 2; - tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); + tmp = (xmlChar *) xmlRealloc(buf, size); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); goto error; @@ -3840,6 +3848,12 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) { GROW; c = CUR_CHAR(l); } + + if (len > maxLength) { + xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_NOT_FINISHED, + "entity value too long\n"); + goto error; + } } buf[len] = 0; if (ctxt->instate == XML_PARSER_EOF) @@ -3927,6 +3941,9 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { xmlChar *rep = NULL; size_t len = 0; size_t buf_size = 0; + size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ? + XML_MAX_HUGE_LENGTH : + XML_MAX_TEXT_LENGTH; int c, l, in_space = 0; xmlChar *current = NULL; xmlEntityPtr ent; @@ -3958,16 +3975,6 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { while (((NXT(0) != limit) && /* checked */ (IS_CHAR(c)) && (c != '<')) && (ctxt->instate != XML_PARSER_EOF)) { - /* - * Impose a reasonable limit on attribute size, unless XML_PARSE_HUGE - * special option is given - */ - if ((len > XML_MAX_TEXT_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { - xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, - "AttValue length too long\n"); - goto mem_error; - } if (c == '&') { in_space = 0; if (NXT(1) == '#') { @@ -4115,6 +4122,11 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { } GROW; c = CUR_CHAR(l); + if (len > maxLength) { + xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, + "AttValue length too long\n"); + goto mem_error; + } } if (ctxt->instate == XML_PARSER_EOF) goto error; @@ -4136,16 +4148,6 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { } else NEXT; - /* - * There we potentially risk an overflow, don't allow attribute value of - * length more than INT_MAX it is a very reasonable assumption ! - */ - if (len >= INT_MAX) { - xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, - "AttValue length too long\n"); - goto mem_error; - } - if (attlen != NULL) *attlen = len; return(buf); @@ -4220,6 +4222,9 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) { int len = 0; int size = XML_PARSER_BUFFER_SIZE; int cur, l; + int maxLength = (ctxt->options & XML_PARSE_HUGE) ? + XML_MAX_TEXT_LENGTH : + XML_MAX_NAME_LENGTH; xmlChar stop; int state = ctxt->instate; int count = 0; @@ -4236,7 +4241,7 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) { return(NULL); } - buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); + buf = (xmlChar *) xmlMallocAtomic(size); if (buf == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); @@ -4247,15 +4252,8 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) { if (len + 5 >= size) { xmlChar *tmp; - if ((size > XML_MAX_NAME_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { - xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "SystemLiteral"); - xmlFree(buf); - ctxt->instate = (xmlParserInputState) state; - return(NULL); - } size *= 2; - tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); + tmp = (xmlChar *) xmlRealloc(buf, size); if (tmp == NULL) { xmlFree(buf); xmlErrMemory(ctxt, NULL); @@ -4282,6 +4280,12 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) { SHRINK; cur = CUR_CHAR(l); } + if (len > maxLength) { + xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "SystemLiteral"); + xmlFree(buf); + ctxt->instate = (xmlParserInputState) state; + return(NULL); + } } buf[len] = 0; ctxt->instate = (xmlParserInputState) state; @@ -4311,6 +4315,9 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; int len = 0; int size = XML_PARSER_BUFFER_SIZE; + int maxLength = (ctxt->options & XML_PARSE_HUGE) ? + XML_MAX_TEXT_LENGTH : + XML_MAX_NAME_LENGTH; xmlChar cur; xmlChar stop; int count = 0; @@ -4327,7 +4334,7 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, NULL); return(NULL); } - buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); + buf = (xmlChar *) xmlMallocAtomic(size); if (buf == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); @@ -4338,14 +4345,8 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { if (len + 1 >= size) { xmlChar *tmp; - if ((size > XML_MAX_NAME_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { - xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Public ID"); - xmlFree(buf); - return(NULL); - } size *= 2; - tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); + tmp = (xmlChar *) xmlRealloc(buf, size); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); xmlFree(buf); @@ -4371,6 +4372,11 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { SHRINK; cur = CUR; } + if (len > maxLength) { + xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Public ID"); + xmlFree(buf); + return(NULL); + } } buf[len] = 0; if (cur != stop) { @@ -4774,6 +4780,9 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, int r, rl; int cur, l; size_t count = 0; + size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ? + XML_MAX_HUGE_LENGTH : + XML_MAX_TEXT_LENGTH; int inputid; inputid = ctxt->input->id; @@ -4781,7 +4790,7 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, if (buf == NULL) { len = 0; size = XML_PARSER_BUFFER_SIZE; - buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); + buf = (xmlChar *) xmlMallocAtomic(size); if (buf == NULL) { xmlErrMemory(ctxt, NULL); return; @@ -4819,13 +4828,6 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, if ((r == '-') && (q == '-')) { xmlFatalErr(ctxt, XML_ERR_HYPHEN_IN_COMMENT, NULL); } - if ((len > XML_MAX_TEXT_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { - xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, - "Comment too big found", NULL); - xmlFree (buf); - return; - } if (len + 5 >= size) { xmlChar *new_buf; size_t new_size; @@ -4863,6 +4865,13 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, GROW; cur = CUR_CHAR(l); } + + if (len > maxLength) { + xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, + "Comment too big found", NULL); + xmlFree (buf); + return; + } } buf[len] = 0; if (cur == 0) { @@ -4909,6 +4918,9 @@ xmlParseComment(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; size_t size = XML_PARSER_BUFFER_SIZE; size_t len = 0; + size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ? + XML_MAX_HUGE_LENGTH : + XML_MAX_TEXT_LENGTH; xmlParserInputState state; const xmlChar *in; size_t nbchar = 0; @@ -4967,7 +4979,7 @@ get_more: size = nbchar + 1; else size = XML_PARSER_BUFFER_SIZE + nbchar; - buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); + buf = (xmlChar *) xmlMallocAtomic(size); if (buf == NULL) { xmlErrMemory(ctxt, NULL); ctxt->instate = state; @@ -4977,8 +4989,7 @@ get_more: } else if (len + nbchar + 1 >= size) { xmlChar *new_buf; size += len + nbchar + XML_PARSER_BUFFER_SIZE; - new_buf = (xmlChar *) xmlRealloc(buf, - size * sizeof(xmlChar)); + new_buf = (xmlChar *) xmlRealloc(buf, size); if (new_buf == NULL) { xmlFree (buf); xmlErrMemory(ctxt, NULL); @@ -4992,8 +5003,7 @@ get_more: buf[len] = 0; } } - if ((len > XML_MAX_TEXT_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { + if (len > maxLength) { xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, "Comment too big found", NULL); xmlFree (buf); @@ -5197,6 +5207,9 @@ xmlParsePI(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; size_t len = 0; size_t size = XML_PARSER_BUFFER_SIZE; + size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ? + XML_MAX_HUGE_LENGTH : + XML_MAX_TEXT_LENGTH; int cur, l; const xmlChar *target; xmlParserInputState state; @@ -5237,7 +5250,7 @@ xmlParsePI(xmlParserCtxtPtr ctxt) { ctxt->instate = state; return; } - buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); + buf = (xmlChar *) xmlMallocAtomic(size); if (buf == NULL) { xmlErrMemory(ctxt, NULL); ctxt->instate = state; @@ -5272,14 +5285,6 @@ xmlParsePI(xmlParserCtxtPtr ctxt) { return; } count = 0; - if ((len > XML_MAX_TEXT_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { - xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED, - "PI %s too big found", target); - xmlFree(buf); - ctxt->instate = state; - return; - } } COPY_BUF(l,buf,len,cur); NEXTL(l); @@ -5289,15 +5294,14 @@ xmlParsePI(xmlParserCtxtPtr ctxt) { GROW; cur = CUR_CHAR(l); } + if (len > maxLength) { + xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED, + "PI %s too big found", target); + xmlFree(buf); + ctxt->instate = state; + return; + } } - if ((len > XML_MAX_TEXT_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { - xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED, - "PI %s too big found", target); - xmlFree(buf); - ctxt->instate = state; - return; - } buf[len] = 0; if (cur != '?') { xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED, @@ -9050,6 +9054,9 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, const xmlChar *in = NULL, *start, *end, *last; xmlChar *ret = NULL; int line, col; + int maxLength = (ctxt->options & XML_PARSE_HUGE) ? + XML_MAX_HUGE_LENGTH : + XML_MAX_TEXT_LENGTH; GROW; in = (xmlChar *) CUR_PTR; @@ -9089,8 +9096,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, start = in; if (in >= end) { GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end) - if (((in - start) > XML_MAX_TEXT_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { + if ((in - start) > maxLength) { xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, "AttValue length too long\n"); return(NULL); @@ -9103,8 +9109,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, if ((*in++ == 0x20) && (*in == 0x20)) break; if (in >= end) { GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end) - if (((in - start) > XML_MAX_TEXT_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { + if ((in - start) > maxLength) { xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, "AttValue length too long\n"); return(NULL); @@ -9137,16 +9142,14 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, last = last + delta; } end = ctxt->input->end; - if (((in - start) > XML_MAX_TEXT_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { + if ((in - start) > maxLength) { xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, "AttValue length too long\n"); return(NULL); } } } - if (((in - start) > XML_MAX_TEXT_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { + if ((in - start) > maxLength) { xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, "AttValue length too long\n"); return(NULL); @@ -9159,8 +9162,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, col++; if (in >= end) { GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end) - if (((in - start) > XML_MAX_TEXT_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { + if ((in - start) > maxLength) { xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, "AttValue length too long\n"); return(NULL); @@ -9168,8 +9170,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, } } last = in; - if (((in - start) > XML_MAX_TEXT_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { + if ((in - start) > maxLength) { xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, "AttValue length too long\n"); return(NULL); @@ -9179,6 +9180,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, in++; col++; if (len != NULL) { + if (alloc) *alloc = 0; *len = last - start; ret = (xmlChar *) start; } else { @@ -9188,7 +9190,6 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, CUR_PTR = in; ctxt->input->line = line; ctxt->input->col = col; - if (alloc) *alloc = 0; return ret; need_complex: if (alloc) *alloc = 1; @@ -9861,6 +9862,9 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) { int s, sl; int cur, l; int count = 0; + int maxLength = (ctxt->options & XML_PARSE_HUGE) ? + XML_MAX_HUGE_LENGTH : + XML_MAX_TEXT_LENGTH; /* Check 2.6.0 was NXT(0) not RAW */ if (CMP9(CUR_PTR, '<', '!', '[', 'C', 'D', 'A', 'T', 'A', '[')) { @@ -9884,7 +9888,7 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) { } NEXTL(sl); cur = CUR_CHAR(l); - buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); + buf = (xmlChar *) xmlMallocAtomic(size); if (buf == NULL) { xmlErrMemory(ctxt, NULL); return; @@ -9894,14 +9898,7 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) { if (len + 5 >= size) { xmlChar *tmp; - if ((size > XML_MAX_TEXT_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { - xmlFatalErrMsgStr(ctxt, XML_ERR_CDATA_NOT_FINISHED, - "CData section too big found", NULL); - xmlFree (buf); - return; - } - tmp = (xmlChar *) xmlRealloc(buf, size * 2 * sizeof(xmlChar)); + tmp = (xmlChar *) xmlRealloc(buf, size * 2); if (tmp == NULL) { xmlFree(buf); xmlErrMemory(ctxt, NULL); @@ -9927,6 +9924,12 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) { } NEXTL(l); cur = CUR_CHAR(l); + if (len > maxLength) { + xmlFatalErrMsg(ctxt, XML_ERR_CDATA_NOT_FINISHED, + "CData section too big found\n"); + xmlFree(buf); + return; + } } buf[len] = 0; ctxt->instate = XML_PARSER_CONTENT; @@ -10284,7 +10287,7 @@ xmlParseVersionNum(xmlParserCtxtPtr ctxt) { int size = 10; xmlChar cur; - buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); + buf = (xmlChar *) xmlMallocAtomic(size); if (buf == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); @@ -10309,7 +10312,7 @@ xmlParseVersionNum(xmlParserCtxtPtr ctxt) { xmlChar *tmp; size *= 2; - tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); + tmp = (xmlChar *) xmlRealloc(buf, size); if (tmp == NULL) { xmlFree(buf); xmlErrMemory(ctxt, NULL); @@ -10396,7 +10399,7 @@ xmlParseEncName(xmlParserCtxtPtr ctxt) { cur = CUR; if (((cur >= 'a') && (cur <= 'z')) || ((cur >= 'A') && (cur <= 'Z'))) { - buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); + buf = (xmlChar *) xmlMallocAtomic(size); if (buf == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); @@ -10414,7 +10417,7 @@ xmlParseEncName(xmlParserCtxtPtr ctxt) { xmlChar *tmp; size *= 2; - tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); + tmp = (xmlChar *) xmlRealloc(buf, size); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); xmlFree(buf); @@ -14723,10 +14726,6 @@ xmlSetEntityReferenceFunc(xmlEntityReferenceFunc func) * * ************************************************************************/ -#ifdef LIBXML_XPATH_ENABLED -#include <libxml/xpath.h> -#endif - static int xmlParserInitialized = 0; /** @@ -14753,9 +14752,6 @@ xmlInitParser(void) { #endif xmlInitThreads(); xmlInitGlobals(); - if ((xmlGenericError == xmlGenericErrorDefaultFunc) || - (xmlGenericError == NULL)) - initGenericErrorDefaultFunc(NULL); xmlInitMemory(); xmlInitializeDict(); xmlInitCharEncodingHandlers(); @@ -14768,7 +14764,7 @@ xmlInitParser(void) { htmlInitAutoClose(); htmlDefaultSAXHandlerInit(); #endif -#ifdef LIBXML_XPATH_ENABLED +#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) xmlXPathInit(); #endif xmlParserInitialized = 1; diff --git a/chromium/third_party/libxml/src/parserInternals.c b/chromium/third_party/libxml/src/parserInternals.c index a3133694625..c26ccdaa71a 100644 --- a/chromium/third_party/libxml/src/parserInternals.c +++ b/chromium/third_party/libxml/src/parserInternals.c @@ -812,7 +812,7 @@ encoding_error: */ int xmlCopyCharMultiByte(xmlChar *out, int val) { - if (out == NULL) return(0); + if ((out == NULL) || (val < 0)) return(0); /* * We are supposed to handle UTF8, check it's valid * From rfc2044: encoding of the Unicode values on UTF-8: @@ -838,7 +838,7 @@ xmlCopyCharMultiByte(xmlChar *out, int val) { *out++= ((val >> bits) & 0x3F) | 0x80 ; return (out - savedout); } - *out = (xmlChar) val; + *out = val; return 1; } @@ -855,12 +855,12 @@ xmlCopyCharMultiByte(xmlChar *out, int val) { int xmlCopyChar(int len ATTRIBUTE_UNUSED, xmlChar *out, int val) { - if (out == NULL) return(0); + if ((out == NULL) || (val < 0)) return(0); /* the len parameter is ignored */ if (val >= 0x80) { return(xmlCopyCharMultiByte (out, val)); } - *out = (xmlChar) val; + *out = val; return 1; } diff --git a/chromium/third_party/libxml/src/runsuite.c b/chromium/third_party/libxml/src/runsuite.c index 483490a2f3d..4e406a35670 100644 --- a/chromium/third_party/libxml/src/runsuite.c +++ b/chromium/third_party/libxml/src/runsuite.c @@ -13,7 +13,6 @@ #include <unistd.h> #endif #include <string.h> -#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> diff --git a/chromium/third_party/libxml/src/runtest.c b/chromium/third_party/libxml/src/runtest.c index 0b07c54314c..ff992951fac 100644 --- a/chromium/third_party/libxml/src/runtest.c +++ b/chromium/third_party/libxml/src/runtest.c @@ -18,7 +18,6 @@ #include <unistd.h> #endif #include <string.h> -#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -2428,12 +2427,11 @@ ignoreGenericError(void *ctx ATTRIBUTE_UNUSED, static void testXPath(const char *str, int xptr, int expr) { - xmlGenericErrorFunc handler = ignoreGenericError; xmlXPathObjectPtr res; xmlXPathContextPtr ctxt; /* Don't print generic errors to stderr. */ - initGenericErrorDefaultFunc(&handler); + xmlSetGenericErrorFunc(NULL, ignoreGenericError); nb_tests++; #if defined(LIBXML_XPTR_ENABLED) @@ -2465,7 +2463,7 @@ testXPath(const char *str, int xptr, int expr) { xmlXPathFreeContext(ctxt); /* Reset generic error handler. */ - initGenericErrorDefaultFunc(NULL); + xmlSetGenericErrorFunc(NULL, NULL); } /** @@ -4176,58 +4174,6 @@ testThread(void) return (res); } -#elif defined __BEOS__ -#include <OS.h> - -static thread_id tid[MAX_ARGC]; - -static int -testThread(void) -{ - unsigned int i, repeat; - status_t ret; - int res = 0; - - xmlInitParser(); - for (repeat = 0; repeat < 500; repeat++) { - xmlLoadCatalog(catalog); - for (i = 0; i < num_threads; i++) { - tid[i] = (thread_id) - 1; - } - for (i = 0; i < num_threads; i++) { - tid[i] = - spawn_thread(thread_specific_data, "xmlTestThread", - B_NORMAL_PRIORITY, (void *) &threadParams[i]); - if (tid[i] < B_OK) { - fprintf(stderr, "beos_thread_create failed\n"); - return (1); - } - printf("beos_thread_create %d -> %d\n", i, tid[i]); - } - for (i = 0; i < num_threads; i++) { - void *result; - ret = wait_for_thread(tid[i], &result); - printf("beos_thread_wait %d -> %d\n", i, ret); - if (ret != B_OK) { - fprintf(stderr, "beos_thread_wait failed\n"); - return (1); - } - } - - xmlCatalogCleanup(); - ret = B_OK; - for (i = 0; i < num_threads; i++) - if (threadParams[i].okay == 0) { - printf("Thread %d handling %s failed\n", i, - threadParams[i].filename); - ret = B_ERROR; - } - } - if (ret != B_OK) - return(1); - return (0); -} - #elif defined HAVE_PTHREAD_H #include <pthread.h> @@ -4324,7 +4270,9 @@ regexpTest(const char *filename, const char *result, const char *err, char expression[5000]; int len, ret, res = 0; - input = fopen(filename, "r"); + nb_tests++; + + input = fopen(filename, "rb"); if (input == NULL) { xmlGenericError(xmlGenericErrorContext, "Cannot open %s for reading\n", filename); @@ -4400,7 +4348,246 @@ regexpTest(const char *filename, const char *result, const char *err, return(res); } -#endif +#endif /* LIBXML_REGEXPS_ENABLED */ + +#ifdef LIBXML_AUTOMATA_ENABLED +/************************************************************************ + * * + * Automata tests * + * * + ************************************************************************/ + +static int scanNumber(char **ptr) { + int ret = 0; + char *cur; + + cur = *ptr; + while ((*cur >= '0') && (*cur <= '9')) { + ret = ret * 10 + (*cur - '0'); + cur++; + } + *ptr = cur; + return(ret); +} + +static int +automataTest(const char *filename, const char *result, + const char *err ATTRIBUTE_UNUSED, int options ATTRIBUTE_UNUSED) { + FILE *input, *output; + char *temp; + char expr[5000]; + int len; + int ret; + int i; + int res = 0; + xmlAutomataPtr am; + xmlAutomataStatePtr states[1000]; + xmlRegexpPtr regexp = NULL; + xmlRegExecCtxtPtr exec = NULL; + + nb_tests++; + + for (i = 0;i<1000;i++) + states[i] = NULL; + + input = fopen(filename, "rb"); + if (input == NULL) { + xmlGenericError(xmlGenericErrorContext, + "Cannot open %s for reading\n", filename); + return(-1); + } + temp = resultFilename(filename, "", ".res"); + if (temp == NULL) { + fprintf(stderr, "Out of memory\n"); + fatalError(); + } + output = fopen(temp, "wb"); + if (output == NULL) { + fprintf(stderr, "failed to open output file %s\n", temp); + free(temp); + return(-1); + } + + am = xmlNewAutomata(); + if (am == NULL) { + xmlGenericError(xmlGenericErrorContext, + "Cannot create automata\n"); + fclose(input); + return(-1); + } + states[0] = xmlAutomataGetInitState(am); + if (states[0] == NULL) { + xmlGenericError(xmlGenericErrorContext, + "Cannot get start state\n"); + xmlFreeAutomata(am); + fclose(input); + return(-1); + } + ret = 0; + + while (fgets(expr, 4500, input) != NULL) { + if (expr[0] == '#') + continue; + len = strlen(expr); + len--; + while ((len >= 0) && + ((expr[len] == '\n') || (expr[len] == '\t') || + (expr[len] == '\r') || (expr[len] == ' '))) len--; + expr[len + 1] = 0; + if (len >= 0) { + if ((am != NULL) && (expr[0] == 't') && (expr[1] == ' ')) { + char *ptr = &expr[2]; + int from, to; + + from = scanNumber(&ptr); + if (*ptr != ' ') { + xmlGenericError(xmlGenericErrorContext, + "Bad line %s\n", expr); + break; + } + if (states[from] == NULL) + states[from] = xmlAutomataNewState(am); + ptr++; + to = scanNumber(&ptr); + if (*ptr != ' ') { + xmlGenericError(xmlGenericErrorContext, + "Bad line %s\n", expr); + break; + } + if (states[to] == NULL) + states[to] = xmlAutomataNewState(am); + ptr++; + xmlAutomataNewTransition(am, states[from], states[to], + BAD_CAST ptr, NULL); + } else if ((am != NULL) && (expr[0] == 'e') && (expr[1] == ' ')) { + char *ptr = &expr[2]; + int from, to; + + from = scanNumber(&ptr); + if (*ptr != ' ') { + xmlGenericError(xmlGenericErrorContext, + "Bad line %s\n", expr); + break; + } + if (states[from] == NULL) + states[from] = xmlAutomataNewState(am); + ptr++; + to = scanNumber(&ptr); + if (states[to] == NULL) + states[to] = xmlAutomataNewState(am); + xmlAutomataNewEpsilon(am, states[from], states[to]); + } else if ((am != NULL) && (expr[0] == 'f') && (expr[1] == ' ')) { + char *ptr = &expr[2]; + int state; + + state = scanNumber(&ptr); + if (states[state] == NULL) { + xmlGenericError(xmlGenericErrorContext, + "Bad state %d : %s\n", state, expr); + break; + } + xmlAutomataSetFinalState(am, states[state]); + } else if ((am != NULL) && (expr[0] == 'c') && (expr[1] == ' ')) { + char *ptr = &expr[2]; + int from, to; + int min, max; + + from = scanNumber(&ptr); + if (*ptr != ' ') { + xmlGenericError(xmlGenericErrorContext, + "Bad line %s\n", expr); + break; + } + if (states[from] == NULL) + states[from] = xmlAutomataNewState(am); + ptr++; + to = scanNumber(&ptr); + if (*ptr != ' ') { + xmlGenericError(xmlGenericErrorContext, + "Bad line %s\n", expr); + break; + } + if (states[to] == NULL) + states[to] = xmlAutomataNewState(am); + ptr++; + min = scanNumber(&ptr); + if (*ptr != ' ') { + xmlGenericError(xmlGenericErrorContext, + "Bad line %s\n", expr); + break; + } + ptr++; + max = scanNumber(&ptr); + if (*ptr != ' ') { + xmlGenericError(xmlGenericErrorContext, + "Bad line %s\n", expr); + break; + } + ptr++; + xmlAutomataNewCountTrans(am, states[from], states[to], + BAD_CAST ptr, min, max, NULL); + } else if ((am != NULL) && (expr[0] == '-') && (expr[1] == '-')) { + /* end of the automata */ + regexp = xmlAutomataCompile(am); + xmlFreeAutomata(am); + am = NULL; + if (regexp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "Failed to compile the automata"); + break; + } + } else if ((expr[0] == '=') && (expr[1] == '>')) { + if (regexp == NULL) { + fprintf(output, "=> failed not compiled\n"); + } else { + if (exec == NULL) + exec = xmlRegNewExecCtxt(regexp, NULL, NULL); + if (ret == 0) { + ret = xmlRegExecPushString(exec, NULL, NULL); + } + if (ret == 1) + fprintf(output, "=> Passed\n"); + else if ((ret == 0) || (ret == -1)) + fprintf(output, "=> Failed\n"); + else if (ret < 0) + fprintf(output, "=> Error\n"); + xmlRegFreeExecCtxt(exec); + exec = NULL; + } + ret = 0; + } else if (regexp != NULL) { + if (exec == NULL) + exec = xmlRegNewExecCtxt(regexp, NULL, NULL); + ret = xmlRegExecPushString(exec, BAD_CAST expr, NULL); + } else { + xmlGenericError(xmlGenericErrorContext, + "Unexpected line %s\n", expr); + } + } + } + fclose(output); + fclose(input); + if (regexp != NULL) + xmlRegFreeRegexp(regexp); + if (exec != NULL) + xmlRegFreeExecCtxt(exec); + if (am != NULL) + xmlFreeAutomata(am); + + ret = compareFiles(temp, result); + if (ret) { + fprintf(stderr, "Result for %s failed in %s\n", filename, result); + res = 1; + } + if (temp != NULL) { + unlink(temp); + free(temp); + } + + return(res); +} + +#endif /* LIBXML_AUTOMATA_ENABLED */ /************************************************************************ * * @@ -4609,6 +4796,11 @@ testDesc testDescriptions[] = { regexpTest, "./test/regexp/*", "result/regexp/", "", ".err", 0 }, #endif +#if defined(LIBXML_AUTOMATA_ENABLED) + { "Automata regression tests" , + automataTest, "./test/automata/*", "result/automata/", "", NULL, + 0 }, +#endif {NULL, NULL, NULL, NULL, NULL, NULL, 0} }; diff --git a/chromium/third_party/libxml/src/runxmlconf.c b/chromium/third_party/libxml/src/runxmlconf.c index 5e88f80d289..69ce39fc4a8 100644 --- a/chromium/third_party/libxml/src/runxmlconf.c +++ b/chromium/third_party/libxml/src/runxmlconf.c @@ -15,7 +15,6 @@ #include <unistd.h> #endif #include <string.h> -#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> diff --git a/chromium/third_party/libxml/src/testAutomata.c b/chromium/third_party/libxml/src/testAutomata.c deleted file mode 100644 index 8d3cb27ae46..00000000000 --- a/chromium/third_party/libxml/src/testAutomata.c +++ /dev/null @@ -1,309 +0,0 @@ -/* - * testAutomata.c: simple module for testing regexp automata - * - * See Copyright for the status of this software. - * - * Daniel Veillard <veillard@redhat.com> - */ - -#include "libxml.h" -#ifdef LIBXML_AUTOMATA_ENABLED -#include <string.h> - -#include <libxml/tree.h> -#include <libxml/xmlautomata.h> - -static int scanNumber(char **ptr) { - int ret = 0; - char *cur; - - cur = *ptr; - while ((*cur >= '0') && (*cur <= '9')) { - ret = ret * 10 + (*cur - '0'); - cur++; - } - *ptr = cur; - return(ret); -} - -static void -testRegexpFile(const char *filename) { - FILE *input; - char expr[5000]; - int len; - int ret; - int i; - xmlAutomataPtr am; - xmlAutomataStatePtr states[1000]; - xmlRegexpPtr regexp = NULL; - xmlRegExecCtxtPtr exec = NULL; - - for (i = 0;i<1000;i++) - states[i] = NULL; - - input = fopen(filename, "rb"); - if (input == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Cannot open %s for reading\n", filename); - return; - } - - am = xmlNewAutomata(); - if (am == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Cannot create automata\n"); - fclose(input); - return; - } - states[0] = xmlAutomataGetInitState(am); - if (states[0] == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Cannot get start state\n"); - xmlFreeAutomata(am); - fclose(input); - return; - } - ret = 0; - - while (fgets(expr, 4500, input) != NULL) { - if (expr[0] == '#') - continue; - len = strlen(expr); - len--; - while ((len >= 0) && - ((expr[len] == '\n') || (expr[len] == '\t') || - (expr[len] == '\r') || (expr[len] == ' '))) len--; - expr[len + 1] = 0; - if (len >= 0) { - if ((am != NULL) && (expr[0] == 't') && (expr[1] == ' ')) { - char *ptr = &expr[2]; - int from, to; - - from = scanNumber(&ptr); - if (*ptr != ' ') { - xmlGenericError(xmlGenericErrorContext, - "Bad line %s\n", expr); - break; - } - if (states[from] == NULL) - states[from] = xmlAutomataNewState(am); - ptr++; - to = scanNumber(&ptr); - if (*ptr != ' ') { - xmlGenericError(xmlGenericErrorContext, - "Bad line %s\n", expr); - break; - } - if (states[to] == NULL) - states[to] = xmlAutomataNewState(am); - ptr++; - xmlAutomataNewTransition(am, states[from], states[to], - BAD_CAST ptr, NULL); - } else if ((am != NULL) && (expr[0] == 'e') && (expr[1] == ' ')) { - char *ptr = &expr[2]; - int from, to; - - from = scanNumber(&ptr); - if (*ptr != ' ') { - xmlGenericError(xmlGenericErrorContext, - "Bad line %s\n", expr); - break; - } - if (states[from] == NULL) - states[from] = xmlAutomataNewState(am); - ptr++; - to = scanNumber(&ptr); - if (states[to] == NULL) - states[to] = xmlAutomataNewState(am); - xmlAutomataNewEpsilon(am, states[from], states[to]); - } else if ((am != NULL) && (expr[0] == 'f') && (expr[1] == ' ')) { - char *ptr = &expr[2]; - int state; - - state = scanNumber(&ptr); - if (states[state] == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Bad state %d : %s\n", state, expr); - break; - } - xmlAutomataSetFinalState(am, states[state]); - } else if ((am != NULL) && (expr[0] == 'c') && (expr[1] == ' ')) { - char *ptr = &expr[2]; - int from, to; - int min, max; - - from = scanNumber(&ptr); - if (*ptr != ' ') { - xmlGenericError(xmlGenericErrorContext, - "Bad line %s\n", expr); - break; - } - if (states[from] == NULL) - states[from] = xmlAutomataNewState(am); - ptr++; - to = scanNumber(&ptr); - if (*ptr != ' ') { - xmlGenericError(xmlGenericErrorContext, - "Bad line %s\n", expr); - break; - } - if (states[to] == NULL) - states[to] = xmlAutomataNewState(am); - ptr++; - min = scanNumber(&ptr); - if (*ptr != ' ') { - xmlGenericError(xmlGenericErrorContext, - "Bad line %s\n", expr); - break; - } - ptr++; - max = scanNumber(&ptr); - if (*ptr != ' ') { - xmlGenericError(xmlGenericErrorContext, - "Bad line %s\n", expr); - break; - } - ptr++; - xmlAutomataNewCountTrans(am, states[from], states[to], - BAD_CAST ptr, min, max, NULL); - } else if ((am != NULL) && (expr[0] == '-') && (expr[1] == '-')) { - /* end of the automata */ - regexp = xmlAutomataCompile(am); - xmlFreeAutomata(am); - am = NULL; - if (regexp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Failed to compile the automata"); - break; - } - } else if ((expr[0] == '=') && (expr[1] == '>')) { - if (regexp == NULL) { - printf("=> failed not compiled\n"); - } else { - if (exec == NULL) - exec = xmlRegNewExecCtxt(regexp, NULL, NULL); - if (ret == 0) { - ret = xmlRegExecPushString(exec, NULL, NULL); - } - if (ret == 1) - printf("=> Passed\n"); - else if ((ret == 0) || (ret == -1)) - printf("=> Failed\n"); - else if (ret < 0) - printf("=> Error\n"); - xmlRegFreeExecCtxt(exec); - exec = NULL; - } - ret = 0; - } else if (regexp != NULL) { - if (exec == NULL) - exec = xmlRegNewExecCtxt(regexp, NULL, NULL); - ret = xmlRegExecPushString(exec, BAD_CAST expr, NULL); - } else { - xmlGenericError(xmlGenericErrorContext, - "Unexpected line %s\n", expr); - } - } - } - fclose(input); - if (regexp != NULL) - xmlRegFreeRegexp(regexp); - if (exec != NULL) - xmlRegFreeExecCtxt(exec); - if (am != NULL) - xmlFreeAutomata(am); -} - -int main(int argc, char **argv) { - - xmlInitParser(); - - if (argc == 1) { - int ret; - xmlAutomataPtr am; - xmlAutomataStatePtr start, cur; - xmlRegexpPtr regexp; - xmlRegExecCtxtPtr exec; - - am = xmlNewAutomata(); - start = xmlAutomataGetInitState(am); - - /* generate a[ba]*a */ - cur = xmlAutomataNewTransition(am, start, NULL, BAD_CAST"a", NULL); - xmlAutomataNewTransition(am, cur, cur, BAD_CAST"b", NULL); - xmlAutomataNewTransition(am, cur, cur, BAD_CAST"a", NULL); - cur = xmlAutomataNewCountTrans(am, cur, NULL, BAD_CAST"a", 2, 3, NULL); - xmlAutomataSetFinalState(am, cur); - - /* compile it in a regexp and free the automata */ - regexp = xmlAutomataCompile(am); - xmlFreeAutomata(am); - - /* test the regexp */ - xmlRegexpPrint(stdout, regexp); - exec = xmlRegNewExecCtxt(regexp, NULL, NULL); - ret = xmlRegExecPushString(exec, BAD_CAST"a", NULL); - if (ret == 1) - printf("final\n"); - else if (ret < 0) - printf("error\n"); - ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL); - if (ret == 1) - printf("final\n"); - else if (ret < 0) - printf("error\n"); - ret =xmlRegExecPushString(exec, BAD_CAST"b", NULL); - if (ret == 1) - printf("final\n"); - else if (ret < 0) - printf("error\n"); - ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL); - if (ret == 1) - printf("final\n"); - else if (ret < 0) - printf("error\n"); - ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL); - if (ret == 1) - printf("final\n"); - else if (ret < 0) - printf("error\n"); - ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL); - if (ret == 1) - printf("final\n"); - else if (ret < 0) - printf("error\n"); - ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL); - if (ret == 1) - printf("final\n"); - else if (ret < 0) - printf("error\n"); - if (ret == 0) { - ret = xmlRegExecPushString(exec, NULL, NULL); - if (ret == 1) - printf("final\n"); - else if (ret < 0) - printf("error\n"); - } - xmlRegFreeExecCtxt(exec); - - /* free the regexp */ - xmlRegFreeRegexp(regexp); - } else { - int i; - - for (i = 1;i < argc;i++) - testRegexpFile(argv[i]); - } - - xmlCleanupParser(); - xmlMemoryDump(); - return(0); -} - -#else -#include <stdio.h> -int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - printf("%s : Automata support not compiled in\n", argv[0]); - return(0); -} -#endif /* LIBXML_AUTOMATA_ENABLED */ diff --git a/chromium/third_party/libxml/src/testThreads.c b/chromium/third_party/libxml/src/testThreads.c index bef6537744b..0714deba8a9 100644 --- a/chromium/third_party/libxml/src/testThreads.c +++ b/chromium/third_party/libxml/src/testThreads.c @@ -10,10 +10,8 @@ #include <libxml/catalog.h> #ifdef HAVE_PTHREAD_H #include <pthread.h> -#elif defined HAVE_WIN32_THREADS +#elif defined(_WIN32) #include <windows.h> -#elif defined HAVE_BEOS_THREADS -#include <OS.h> #endif #include <string.h> #if !defined(_MSC_VER) @@ -25,10 +23,8 @@ #define TEST_REPEAT_COUNT 500 #ifdef HAVE_PTHREAD_H static pthread_t tid[MAX_ARGC]; -#elif defined HAVE_WIN32_THREADS +#elif defined(_WIN32) static HANDLE tid[MAX_ARGC]; -#elif defined HAVE_BEOS_THREADS -static thread_id tid[MAX_ARGC]; #endif typedef struct { @@ -145,7 +141,7 @@ main(void) xmlMemoryDump(); return (0); } -#elif defined HAVE_WIN32_THREADS +#elif defined(_WIN32) static DWORD WINAPI win32_thread_specific_data(void *private_data) { @@ -209,61 +205,7 @@ main(void) return (0); } -#elif defined HAVE_BEOS_THREADS -int -main(void) -{ - unsigned int i, repeat; - status_t ret; - - xmlInitParser(); - printf("Parser initialized\n"); - for (repeat = 0;repeat < TEST_REPEAT_COUNT;repeat++) { - printf("repeat: %d\n",repeat); - xmlLoadCatalog(catalog); - printf("loaded catalog: %s\n", catalog); - for (i = 0; i < num_threads; i++) { - tid[i] = (thread_id) -1; - } - printf("cleaned threads\n"); - for (i = 0; i < num_threads; i++) { - tid[i] = spawn_thread(thread_specific_data, "xmlTestThread", B_NORMAL_PRIORITY, (void *) &threadParams[i]); - if (tid[i] < B_OK) { - perror("beos_thread_create"); - exit(1); - } - printf("beos_thread_create %d -> %d\n", i, tid[i]); - } - for (i = 0; i < num_threads; i++) { - void *result; - ret = wait_for_thread(tid[i], &result); - printf("beos_thread_wait %d -> %d\n", i, ret); - if (ret != B_OK) { - perror("beos_thread_wait"); - exit(1); - } - } - - xmlCatalogCleanup(); - ret = B_OK; - for (i = 0; i < num_threads; i++) - if (threadParams[i].okay == 0) { - printf("Thread %d handling %s failed\n", i, - threadParams[i].filename); - ret = B_ERROR; - } - } - xmlCleanupParser(); - xmlMemoryDump(); - - if (ret == B_OK) - printf("testThread : BeOS : SUCCESS!\n"); - else - printf("testThread : BeOS : FAILED!\n"); - - return (0); -} -#endif /* pthreads or BeOS threads */ +#endif /* pthreads */ #else /* !LIBXML_THREADS_ENABLED */ int diff --git a/chromium/third_party/libxml/src/testapi.c b/chromium/third_party/libxml/src/testapi.c index 3e81f6645e0..2701f27fc33 100644 --- a/chromium/third_party/libxml/src/testapi.c +++ b/chromium/third_party/libxml/src/testapi.c @@ -124,6 +124,14 @@ int main(int argc, char **argv) { int ret; int blocks, mem; +#if defined(_WIN32) + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); + + printf("Skipping on Windows for now\n"); + return(0); +#endif + #ifdef HAVE_PUTENV /* access to the proxy can slow up regression tests a lot */ putenv((char *) "http_proxy="); diff --git a/chromium/third_party/libxml/src/testlimits.c b/chromium/third_party/libxml/src/testlimits.c index a5ed231f099..6322f8ba40c 100644 --- a/chromium/third_party/libxml/src/testlimits.c +++ b/chromium/third_party/libxml/src/testlimits.c @@ -17,7 +17,6 @@ #include <unistd.h> #endif #include <string.h> -#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <time.h> diff --git a/chromium/third_party/libxml/src/testrecurse.c b/chromium/third_party/libxml/src/testrecurse.c index fabc5138906..d213ebc63dc 100644 --- a/chromium/third_party/libxml/src/testrecurse.c +++ b/chromium/third_party/libxml/src/testrecurse.c @@ -17,7 +17,6 @@ #include <unistd.h> #endif #include <string.h> -#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> diff --git a/chromium/third_party/libxml/src/threads.c b/chromium/third_party/libxml/src/threads.c index cd5a517af1e..9fa477e53b6 100644 --- a/chromium/third_party/libxml/src/threads.c +++ b/chromium/third_party/libxml/src/threads.c @@ -16,19 +16,18 @@ #include <libxml/threads.h> #include <libxml/globals.h> -#ifdef HAVE_PTHREAD_H -#include <pthread.h> -#elif defined HAVE_WIN32_THREADS -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#ifndef HAVE_COMPILER_TLS -#include <process.h> -#endif -#endif - -#ifdef HAVE_BEOS_THREADS -#include <OS.h> -#include <TLS.h> +#ifdef LIBXML_THREAD_ENABLED + #ifdef HAVE_PTHREAD_H + #include <pthread.h> + #define HAVE_POSIX_THREADS + #elif defined(_WIN32) + #define WIN32_LEAN_AND_MEAN + #include <windows.h> + #ifndef HAVE_COMPILER_TLS + #include <process.h> + #endif + #define HAVE_WIN32_THREADS + #endif #endif #if defined(SOLARIS) @@ -40,10 +39,9 @@ /* #define DEBUG_THREADS */ -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS -#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 303) && \ - defined(__GLIBC__) && defined(__linux__) +#if defined(__GNUC__) && defined(__linux__) static int libxml_is_threaded = -1; @@ -73,7 +71,7 @@ static int libxml_is_threaded = 1; #endif /* __GNUC__, __GLIBC__, __linux__ */ -#endif /* HAVE_PTHREAD_H */ +#endif /* HAVE_POSIX_THREADS */ /* * TODO: this module still uses malloc/free and not xmlMalloc/xmlFree @@ -85,13 +83,10 @@ static int libxml_is_threaded = 1; * xmlMutex are a simple mutual exception locks */ struct _xmlMutex { -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS pthread_mutex_t lock; #elif defined HAVE_WIN32_THREADS CRITICAL_SECTION cs; -#elif defined HAVE_BEOS_THREADS - sem_id sem; - thread_id tid; #else int empty; #endif @@ -101,7 +96,7 @@ struct _xmlMutex { * xmlRMutex are reentrant mutual exception locks */ struct _xmlRMutex { -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS pthread_mutex_t lock; unsigned int held; unsigned int waiters; @@ -109,10 +104,6 @@ struct _xmlRMutex { pthread_cond_t cv; #elif defined HAVE_WIN32_THREADS CRITICAL_SECTION cs; -#elif defined HAVE_BEOS_THREADS - xmlMutexPtr lock; - thread_id tid; - int32 count; #else int empty; #endif @@ -124,7 +115,7 @@ struct _xmlRMutex { * - globalkey used for per-thread data */ -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS static pthread_key_t globalkey; static pthread_t mainthread; static pthread_once_t once_control = PTHREAD_ONCE_INIT; @@ -143,14 +134,6 @@ static struct { LONG control; } run_once = { 0, 0}; static volatile LPCRITICAL_SECTION global_init_lock = NULL; - -/* endif HAVE_WIN32_THREADS */ -#elif defined HAVE_BEOS_THREADS -int32 globalkey = 0; -thread_id mainthread = 0; -int32 run_once_init = 0; -static int32 global_init_lock = -1; -static vint32 global_init_count = 0; #endif static xmlRMutexPtr xmlLibraryLock = NULL; @@ -174,17 +157,11 @@ xmlNewMutex(void) if ((tok = malloc(sizeof(xmlMutex))) == NULL) return (NULL); -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS if (libxml_is_threaded != 0) pthread_mutex_init(&tok->lock, NULL); #elif defined HAVE_WIN32_THREADS InitializeCriticalSection(&tok->cs); -#elif defined HAVE_BEOS_THREADS - if ((tok->sem = create_sem(1, "xmlMutex")) < B_OK) { - free(tok); - return NULL; - } - tok->tid = -1; #endif return (tok); } @@ -202,13 +179,11 @@ xmlFreeMutex(xmlMutexPtr tok) if (tok == NULL) return; -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS if (libxml_is_threaded != 0) pthread_mutex_destroy(&tok->lock); #elif defined HAVE_WIN32_THREADS DeleteCriticalSection(&tok->cs); -#elif defined HAVE_BEOS_THREADS - delete_sem(tok->sem); #endif free(tok); } @@ -224,19 +199,11 @@ xmlMutexLock(xmlMutexPtr tok) { if (tok == NULL) return; -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS if (libxml_is_threaded != 0) pthread_mutex_lock(&tok->lock); #elif defined HAVE_WIN32_THREADS EnterCriticalSection(&tok->cs); -#elif defined HAVE_BEOS_THREADS - if (acquire_sem(tok->sem) != B_NO_ERROR) { -#ifdef DEBUG_THREADS - xmlGenericError(xmlGenericErrorContext, - "xmlMutexLock():BeOS:Couldn't acquire semaphore\n"); -#endif - } - tok->tid = find_thread(NULL); #endif } @@ -252,16 +219,11 @@ xmlMutexUnlock(xmlMutexPtr tok) { if (tok == NULL) return; -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS if (libxml_is_threaded != 0) pthread_mutex_unlock(&tok->lock); #elif defined HAVE_WIN32_THREADS LeaveCriticalSection(&tok->cs); -#elif defined HAVE_BEOS_THREADS - if (tok->tid == find_thread(NULL)) { - tok->tid = -1; - release_sem(tok->sem); - } #endif } @@ -282,7 +244,7 @@ xmlNewRMutex(void) if ((tok = malloc(sizeof(xmlRMutex))) == NULL) return (NULL); -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS if (libxml_is_threaded != 0) { pthread_mutex_init(&tok->lock, NULL); tok->held = 0; @@ -291,12 +253,6 @@ xmlNewRMutex(void) } #elif defined HAVE_WIN32_THREADS InitializeCriticalSection(&tok->cs); -#elif defined HAVE_BEOS_THREADS - if ((tok->lock = xmlNewMutex()) == NULL) { - free(tok); - return NULL; - } - tok->count = 0; #endif return (tok); } @@ -313,15 +269,13 @@ xmlFreeRMutex(xmlRMutexPtr tok ATTRIBUTE_UNUSED) { if (tok == NULL) return; -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS if (libxml_is_threaded != 0) { pthread_mutex_destroy(&tok->lock); pthread_cond_destroy(&tok->cv); } #elif defined HAVE_WIN32_THREADS DeleteCriticalSection(&tok->cs); -#elif defined HAVE_BEOS_THREADS - xmlFreeMutex(tok->lock); #endif free(tok); } @@ -337,7 +291,7 @@ xmlRMutexLock(xmlRMutexPtr tok) { if (tok == NULL) return; -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS if (libxml_is_threaded == 0) return; @@ -359,14 +313,6 @@ xmlRMutexLock(xmlRMutexPtr tok) pthread_mutex_unlock(&tok->lock); #elif defined HAVE_WIN32_THREADS EnterCriticalSection(&tok->cs); -#elif defined HAVE_BEOS_THREADS - if (tok->lock->tid == find_thread(NULL)) { - tok->count++; - return; - } else { - xmlMutexLock(tok->lock); - tok->count = 1; - } #endif } @@ -381,7 +327,7 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED) { if (tok == NULL) return; -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS if (libxml_is_threaded == 0) return; @@ -395,14 +341,6 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED) pthread_mutex_unlock(&tok->lock); #elif defined HAVE_WIN32_THREADS LeaveCriticalSection(&tok->cs); -#elif defined HAVE_BEOS_THREADS - if (tok->lock->tid == find_thread(NULL)) { - tok->count--; - if (tok->count == 0) { - xmlMutexUnlock(tok->lock); - } - return; - } #endif } @@ -416,7 +354,7 @@ void __xmlGlobalInitMutexLock(void) { /* Make sure the global init lock is initialized and then lock it. */ -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS /* The mutex is statically initialized, so we just lock it. */ #ifdef XML_PTHREAD_WEAK if (pthread_mutex_lock == NULL) @@ -456,41 +394,13 @@ __xmlGlobalInitMutexLock(void) /* Lock the chosen critical section */ EnterCriticalSection(global_init_lock); -#elif defined HAVE_BEOS_THREADS - int32 sem; - - /* Allocate a new semaphore */ - sem = create_sem(1, "xmlGlobalinitMutex"); - - while (global_init_lock == -1) { - if (atomic_add(&global_init_count, 1) == 0) { - global_init_lock = sem; - } else { - snooze(1); - atomic_add(&global_init_count, -1); - } - } - - /* If another thread successfully recorded its critical - * section in the global_init_lock then discard the one - * allocated by this thread. */ - if (global_init_lock != sem) - delete_sem(sem); - - /* Acquire the chosen semaphore */ - if (acquire_sem(global_init_lock) != B_NO_ERROR) { -#ifdef DEBUG_THREADS - xmlGenericError(xmlGenericErrorContext, - "xmlGlobalInitMutexLock():BeOS:Couldn't acquire semaphore\n"); -#endif - } #endif } void __xmlGlobalInitMutexUnlock(void) { -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS #ifdef XML_PTHREAD_WEAK if (pthread_mutex_unlock == NULL) return; @@ -500,8 +410,6 @@ __xmlGlobalInitMutexUnlock(void) if (global_init_lock != NULL) { LeaveCriticalSection(global_init_lock); } -#elif defined HAVE_BEOS_THREADS - release_sem(global_init_lock); #endif } @@ -514,7 +422,7 @@ __xmlGlobalInitMutexUnlock(void) void __xmlGlobalInitMutexDestroy(void) { -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS #elif defined HAVE_WIN32_THREADS if (global_init_lock != NULL) { DeleteCriticalSection(global_init_lock); @@ -579,7 +487,7 @@ xmlNewGlobalState(void) } #endif /* LIBXML_THREAD_ENABLED */ -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS #elif defined HAVE_WIN32_THREADS #if !defined(HAVE_COMPILER_TLS) #if defined(LIBXML_STATIC) && !defined(LIBXML_STATIC_FOR_DLL) @@ -614,24 +522,6 @@ static CRITICAL_SECTION cleanup_helpers_cs; #endif /* HAVE_COMPILER_TLS */ #endif /* HAVE_WIN32_THREADS */ -#if defined HAVE_BEOS_THREADS - -/** - * xmlGlobalStateCleanup: - * @data: unused parameter - * - * Used for Beos only - */ -void -xmlGlobalStateCleanup(void *data) -{ - void *globalval = tls_get(globalkey); - - if (globalval != NULL) - xmlFreeGlobalState(globalval); -} -#endif - /** * xmlGetGlobalState: * @@ -642,7 +532,7 @@ xmlGlobalStateCleanup(void *data) xmlGlobalStatePtr xmlGetGlobalState(void) { -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS xmlGlobalState *globalval; if (libxml_is_threaded == 0) @@ -714,21 +604,6 @@ xmlGetGlobalState(void) } return (globalval); #endif /* HAVE_COMPILER_TLS */ -#elif defined HAVE_BEOS_THREADS - xmlGlobalState *globalval; - - xmlOnceInit(); - - if ((globalval = (xmlGlobalState *) tls_get(globalkey)) == NULL) { - xmlGlobalState *tsd = xmlNewGlobalState(); - if (tsd == NULL) - return (NULL); - - tls_set(globalkey, tsd); - on_exit_thread(xmlGlobalStateCleanup, NULL); - return (tsd); - } - return (globalval); #else return (NULL); #endif @@ -752,7 +627,7 @@ xmlGetGlobalState(void) int xmlGetThreadId(void) { -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS pthread_t id; int ret; @@ -764,8 +639,6 @@ xmlGetThreadId(void) return (ret); #elif defined HAVE_WIN32_THREADS return GetCurrentThreadId(); -#elif defined HAVE_BEOS_THREADS - return find_thread(NULL); #else return ((int) 0); #endif @@ -781,7 +654,7 @@ xmlGetThreadId(void) int xmlIsMainThread(void) { -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS if (libxml_is_threaded == -1) xmlInitThreads(); if (libxml_is_threaded == 0) @@ -789,19 +662,15 @@ xmlIsMainThread(void) pthread_once(&once_control, xmlOnceInit); #elif defined HAVE_WIN32_THREADS xmlOnceInit(); -#elif defined HAVE_BEOS_THREADS - xmlOnceInit(); #endif #ifdef DEBUG_THREADS xmlGenericError(xmlGenericErrorContext, "xmlIsMainThread()\n"); #endif -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS return (pthread_equal(mainthread,pthread_self())); #elif defined HAVE_WIN32_THREADS return (mainthread == GetCurrentThreadId()); -#elif defined HAVE_BEOS_THREADS - return (mainthread == find_thread(NULL)); #else return (1); #endif @@ -849,7 +718,7 @@ xmlUnlockLibrary(void) void xmlInitThreads(void) { -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS #ifdef XML_PTHREAD_WEAK if (libxml_is_threaded == -1) { if ((pthread_once != NULL) && @@ -905,7 +774,7 @@ xmlCleanupThreads(void) #ifdef DEBUG_THREADS xmlGenericError(xmlGenericErrorContext, "xmlCleanupThreads()\n"); #endif -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS if (libxml_is_threaded != 0) pthread_key_delete(globalkey); once_control = once_control_init; @@ -953,7 +822,7 @@ xmlCleanupThreads(void) static void xmlOnceInit(void) { -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS (void) pthread_key_create(&globalkey, xmlFreeGlobalState); mainthread = pthread_self(); __xmlInitializeDict(); @@ -976,14 +845,6 @@ xmlOnceInit(void) Sleep(0); } } -#elif defined HAVE_BEOS_THREADS - if (atomic_add(&run_once_init, 1) == 0) { - globalkey = tls_allocate(); - tls_set(globalkey, NULL); - mainthread = find_thread(NULL); - __xmlInitializeDict(); - } else - atomic_add(&run_once_init, -1); #endif } #endif @@ -999,7 +860,7 @@ xmlOnceInit(void) * * Returns TRUE always */ -#ifdef HAVE_PTHREAD_H +#ifdef HAVE_POSIX_THREADS #elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) #if defined(LIBXML_STATIC_FOR_DLL) int XMLCALL diff --git a/chromium/third_party/libxml/src/tree.c b/chromium/third_party/libxml/src/tree.c index b296d920007..6a42f1187d3 100644 --- a/chromium/third_party/libxml/src/tree.c +++ b/chromium/third_party/libxml/src/tree.c @@ -1216,11 +1216,6 @@ xmlFreeDoc(xmlDocPtr cur) { #endif return; } -#ifdef LIBXML_DEBUG_RUNTIME -#ifdef LIBXML_DEBUG_ENABLED - xmlDebugCheckDocument(stderr, cur); -#endif -#endif if (cur != NULL) dict = cur->dict; @@ -4810,12 +4805,12 @@ xmlGetNodePath(const xmlNode *node) return (NULL); buf_len = 500; - buffer = (xmlChar *) xmlMallocAtomic(buf_len * sizeof(xmlChar)); + buffer = (xmlChar *) xmlMallocAtomic(buf_len); if (buffer == NULL) { xmlTreeErrMemory("getting node path"); return (NULL); } - buf = (xmlChar *) xmlMallocAtomic(buf_len * sizeof(xmlChar)); + buf = (xmlChar *) xmlMallocAtomic(buf_len); if (buf == NULL) { xmlTreeErrMemory("getting node path"); xmlFree(buffer); @@ -7148,7 +7143,7 @@ xmlBufferCreate(void) { ret->use = 0; ret->size = xmlDefaultBufferSize; ret->alloc = xmlBufferAllocScheme; - ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar)); + ret->content = (xmlChar *) xmlMallocAtomic(ret->size); if (ret->content == NULL) { xmlTreeErrMemory("creating buffer"); xmlFree(ret); @@ -7181,7 +7176,7 @@ xmlBufferCreateSize(size_t size) { ret->alloc = xmlBufferAllocScheme; ret->size = (size ? size + 1 : 0); /* +1 for ending null */ if (ret->size){ - ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar)); + ret->content = (xmlChar *) xmlMallocAtomic(ret->size); if (ret->content == NULL) { xmlTreeErrMemory("creating buffer"); xmlFree(ret); @@ -7458,7 +7453,7 @@ xmlBufferDump(FILE *file, xmlBufferPtr buf) { } if (file == NULL) file = stdout; - ret = fwrite(buf->content, sizeof(xmlChar), buf->use, file); + ret = fwrite(buf->content, 1, buf->use, file); return(ret > INT_MAX ? INT_MAX : ret); } @@ -7665,7 +7660,7 @@ xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) { } } - memmove(&buf->content[buf->use], str, len*sizeof(xmlChar)); + memmove(&buf->content[buf->use], str, len); buf->use += len; buf->content[buf->use] = 0; return 0; @@ -10250,3 +10245,48 @@ xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt, return (0); } +/************************************************************************ + * * + * XHTML detection * + * * + ************************************************************************/ + +#define XHTML_STRICT_PUBLIC_ID BAD_CAST \ + "-//W3C//DTD XHTML 1.0 Strict//EN" +#define XHTML_STRICT_SYSTEM_ID BAD_CAST \ + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" +#define XHTML_FRAME_PUBLIC_ID BAD_CAST \ + "-//W3C//DTD XHTML 1.0 Frameset//EN" +#define XHTML_FRAME_SYSTEM_ID BAD_CAST \ + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd" +#define XHTML_TRANS_PUBLIC_ID BAD_CAST \ + "-//W3C//DTD XHTML 1.0 Transitional//EN" +#define XHTML_TRANS_SYSTEM_ID BAD_CAST \ + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" + +/** + * xmlIsXHTML: + * @systemID: the system identifier + * @publicID: the public identifier + * + * Try to find if the document correspond to an XHTML DTD + * + * Returns 1 if true, 0 if not and -1 in case of error + */ +int +xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID) { + if ((systemID == NULL) && (publicID == NULL)) + return(-1); + if (publicID != NULL) { + if (xmlStrEqual(publicID, XHTML_STRICT_PUBLIC_ID)) return(1); + if (xmlStrEqual(publicID, XHTML_FRAME_PUBLIC_ID)) return(1); + if (xmlStrEqual(publicID, XHTML_TRANS_PUBLIC_ID)) return(1); + } + if (systemID != NULL) { + if (xmlStrEqual(systemID, XHTML_STRICT_SYSTEM_ID)) return(1); + if (xmlStrEqual(systemID, XHTML_FRAME_SYSTEM_ID)) return(1); + if (xmlStrEqual(systemID, XHTML_TRANS_SYSTEM_ID)) return(1); + } + return(0); +} + diff --git a/chromium/third_party/libxml/src/uri.c b/chromium/third_party/libxml/src/uri.c index 95d11fa7133..e6f1c3e704a 100644 --- a/chromium/third_party/libxml/src/uri.c +++ b/chromium/third_party/libxml/src/uri.c @@ -1076,7 +1076,7 @@ xmlSaveUri(xmlURIPtr uri) { max = 80; - ret = (xmlChar *) xmlMallocAtomic((max + 1) * sizeof(xmlChar)); + ret = (xmlChar *) xmlMallocAtomic(max + 1); if (ret == NULL) { xmlURIErrMemory("saving URI\n"); return(NULL); @@ -1657,6 +1657,7 @@ xmlURIUnescapeString(const char *str, int len, char *target) { c = c * 16 + (*in - 'A') + 10; in++; len -= 3; + /* Explicit sign change */ *out++ = (char) c; } else { *out++ = *in++; diff --git a/chromium/third_party/libxml/src/valid.c b/chromium/third_party/libxml/src/valid.c index dc2d175df61..182ffed1df2 100644 --- a/chromium/third_party/libxml/src/valid.c +++ b/chromium/third_party/libxml/src/valid.c @@ -835,7 +835,7 @@ xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem) { xmlSnprintfElementContent(expr, 5000, elem->content, 1); xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_NOT_DETERMINIST, - "Content model of %s is not determinist: %s\n", + "Content model of %s is not deterministic: %s\n", elem->name, BAD_CAST expr, NULL); #ifdef DEBUG_REGEXP_ALGO xmlRegexpPrint(stderr, elem->contModel); @@ -4906,6 +4906,7 @@ cont: */ if ((CONT != NULL) && ((CONT->parent == NULL) || + (CONT->parent == (xmlElementContentPtr) 1) || (CONT->parent->type != XML_ELEMENT_CONTENT_OR)) && ((CONT->ocur == XML_ELEMENT_CONTENT_MULT) || (CONT->ocur == XML_ELEMENT_CONTENT_OPT) || @@ -5158,7 +5159,8 @@ analyze: * Then act accordingly at the parent level */ RESET_OCCURRENCE; - if (CONT->parent == NULL) + if ((CONT->parent == NULL) || + (CONT->parent == (xmlElementContentPtr) 1)) break; switch (CONT->parent->type) { @@ -5440,9 +5442,13 @@ fail: STATE = 0; ret = xmlValidateElementType(ctxt); if ((ret == -3) && (warn)) { - xmlErrValidWarning(ctxt, child, XML_DTD_CONTENT_NOT_DETERMINIST, - "Content model for Element %s is ambiguous\n", - name, NULL, NULL); + char expr[5000]; + expr[0] = 0; + xmlSnprintfElementContent(expr, 5000, elemDecl->content, 1); + xmlErrValidNode(ctxt, (xmlNodePtr) elemDecl, + XML_DTD_CONTENT_NOT_DETERMINIST, + "Content model of %s is not deterministic: %s\n", + name, BAD_CAST expr, NULL); } else if (ret == -2) { /* * An entities reference appeared at this level. @@ -5663,6 +5669,7 @@ done: return(ret); } +#ifdef LIBXML_REGEXP_ENABLED /** * xmlValidateCheckMixed: * @ctxt: the validation context @@ -5728,6 +5735,7 @@ xmlValidateCheckMixed(xmlValidCtxtPtr ctxt, } return(0); } +#endif /* LIBXML_REGEXP_ENABLED */ /** * xmlValidGetElemDecl: diff --git a/chromium/third_party/libxml/src/win32/Makefile.bcb b/chromium/third_party/libxml/src/win32/Makefile.bcb index c4b51259e4a..4b0a2ef51ca 100644 --- a/chromium/third_party/libxml/src/win32/Makefile.bcb +++ b/chromium/third_party/libxml/src/win32/Makefile.bcb @@ -42,7 +42,7 @@ XML_INTDIR_A = int.a.bcb UTILS_INTDIR = int.utils.bcb # The preprocessor and its options. -CPP = cpp32.exe -P- -DWIN32 +CPP = cpp32.exe -P- CPPFLAGS = -I"$(XML_SRCDIR)\include" -DNOLIBTOOL !if "$(WITH_THREADS)" != "no" CPPFLAGS = $(CPPFLAGS) -D_REENTRANT -D__MT__ @@ -50,7 +50,7 @@ CPPFLAGS = $(CPPFLAGS) -D_REENTRANT -D__MT__ # The compiler and its options. CC = bcc32.exe -CFLAGS = -q -DWIN32 -D_NO_VCL -D_WINDOWS -D_MBCS -DEILSEQ=2 -DNOLIBTOOL -w- +CFLAGS = -q -D_NO_VCL -D_WINDOWS -D_MBCS -DEILSEQ=2 -DNOLIBTOOL -w- CFLAGS = $(CFLAGS) -I"$(XML_SRCDIR)" -I"$(XML_SRCDIR)\include" -I"$(INCPREFIX)" -I"$(INCLUDE)" !if "$(WITH_THREADS)" != "no" CFLAGS = $(CFLAGS) -D_REENTRANT -tWM @@ -59,9 +59,7 @@ CFLAGS = $(CFLAGS) -D_REENTRANT -tWM CFLAGS = $(CFLAGS) -tWR !endif !if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls" -CFLAGS = $(CFLAGS) -DHAVE_WIN32_THREADS -DHAVE_COMPILER_TLS -!else if "$(WITH_THREADS)" == "native" -CFLAGS = $(CFLAGS) -DHAVE_WIN32_THREADS +CFLAGS = $(CFLAGS) -DHAVE_COMPILER_TLS !else if "$(WITH_THREADS)" == "posix" CFLAGS = $(CFLAGS) -DHAVE_PTHREAD_H !endif @@ -205,7 +203,6 @@ XML_OBJS_A = $(XML_INTDIR_A)\buf.obj\ # Xmllint and friends executables. UTILS = $(BINDIR)\xmllint.exe\ $(BINDIR)\xmlcatalog.exe\ - $(BINDIR)\testAutomata.exe\ $(BINDIR)\testModule.exe\ $(BINDIR)\runtest.exe\ $(BINDIR)\runsuite.exe\ diff --git a/chromium/third_party/libxml/src/win32/Makefile.mingw b/chromium/third_party/libxml/src/win32/Makefile.mingw index 13f2d96fcdf..bd0c4297d3f 100644 --- a/chromium/third_party/libxml/src/win32/Makefile.mingw +++ b/chromium/third_party/libxml/src/win32/Makefile.mingw @@ -40,19 +40,16 @@ endif # The compiler and its options. CC = gcc.exe -CFLAGS += -DWIN32 -D_WINDOWS -D_MBCS -DNOLIBTOOL +CFLAGS += -D_WINDOWS -D_MBCS -DNOLIBTOOL CFLAGS += -I$(XML_SRCDIR) -I$(XML_SRCDIR)/include -I$(INCPREFIX) $(INCLUDE) ifneq ($(WITH_THREADS),no) CFLAGS += -D_REENTRANT endif ifeq ($(WITH_THREADS),yes) -CFLAGS += -DHAVE_WIN32_THREADS -DHAVE_COMPILER_TLS +CFLAGS += -DHAVE_COMPILER_TLS endif ifeq ($(WITH_THREADS),ctls) -CFLAGS += -DHAVE_WIN32_THREADS -DHAVE_COMPILER_TLS -endif -ifeq ($(WITH_THREADS),native) -CFLAGS += -DHAVE_WIN32_THREADS +CFLAGS += -DHAVE_COMPILER_TLS endif ifeq ($(WITH_THREADS),posix) CFLAGS += -DHAVE_PTHREAD_H @@ -201,7 +198,6 @@ XML_SRCS_A = $(subst .o,.c,$(subst $(XML_INTDIR_A)/,$(XML_SRCDIR)/,$(XML_OBJS_A) # Xmllint and friends executables. UTILS = $(BINDIR)/xmllint.exe\ $(BINDIR)/xmlcatalog.exe\ - $(BINDIR)/testAutomata.exe\ $(BINDIR)/testModule.exe\ $(BINDIR)/runtest.exe\ $(BINDIR)/runsuite.exe\ diff --git a/chromium/third_party/libxml/src/win32/Makefile.msvc b/chromium/third_party/libxml/src/win32/Makefile.msvc index 80e64e221de..7cc25b84a7d 100644 --- a/chromium/third_party/libxml/src/win32/Makefile.msvc +++ b/chromium/third_party/libxml/src/win32/Makefile.msvc @@ -50,9 +50,7 @@ CFLAGS = $(CFLAGS) /I$(XML_SRCDIR) /I$(XML_SRCDIR)\include /I$(INCPREFIX) CFLAGS = $(CFLAGS) /D "_REENTRANT" !endif !if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls" -CFLAGS = $(CFLAGS) /D "HAVE_WIN32_THREADS" /D "HAVE_COMPILER_TLS" -!else if "$(WITH_THREADS)" == "native" -CFLAGS = $(CFLAGS) /D "HAVE_WIN32_THREADS" +CFLAGS = $(CFLAGS) /D "HAVE_COMPILER_TLS" !else if "$(WITH_THREADS)" == "posix" CFLAGS = $(CFLAGS) /D "HAVE_PTHREAD_H" !endif @@ -255,7 +253,6 @@ XML_OBJS_A_DLL = $(XML_OBJS_A_DLL) $(XML_INTDIR_A_DLL)\xzlib.obj # Xmllint and friends executables. UTILS = $(BINDIR)\xmllint.exe\ $(BINDIR)\xmlcatalog.exe\ - $(BINDIR)\testAutomata.exe\ $(BINDIR)\testModule.exe\ $(BINDIR)\runtest.exe\ $(BINDIR)\runsuite.exe\ diff --git a/chromium/third_party/libxml/src/win32/configure.js b/chromium/third_party/libxml/src/win32/configure.js index 84994284110..e53cfcb7838 100644 --- a/chromium/third_party/libxml/src/win32/configure.js +++ b/chromium/third_party/libxml/src/win32/configure.js @@ -46,7 +46,6 @@ var withZlib = false; var withLzma = false; var withDebug = true; var withMemDebug = false; -var withRunDebug = false; var withSchemas = true; var withSchematron = true; var withRegExps = true; @@ -132,7 +131,6 @@ function usage() txt += " lzma: Enable lzma support (" + (withLzma? "yes" : "no") + ")\n"; txt += " xml_debug: Enable XML debbugging module (" + (withDebug? "yes" : "no") + ")\n"; txt += " mem_debug: Enable memory debugger (" + (withMemDebug? "yes" : "no") + ")\n"; - txt += " run_debug: Enable memory debugger (" + (withRunDebug? "yes" : "no") + ")\n"; txt += " regexps: Enable regular expressions (" + (withRegExps? "yes" : "no") + ")\n"; txt += " modules: Enable module support (" + (withModules? "yes" : "no") + ")\n"; txt += " tree: Enable tree api (" + (withTree? "yes" : "no") + ")\n"; @@ -229,7 +227,6 @@ function discoverVersion() vf.WriteLine("WITH_LZMA=" + (withLzma? "1" : "0")); vf.WriteLine("WITH_DEBUG=" + (withDebug? "1" : "0")); vf.WriteLine("WITH_MEM_DEBUG=" + (withMemDebug? "1" : "0")); - vf.WriteLine("WITH_RUN_DEBUG=" + (withRunDebug? "1" : "0")); vf.WriteLine("WITH_SCHEMAS=" + (withSchemas? "1" : "0")); vf.WriteLine("WITH_SCHEMATRON=" + (withSchematron? "1" : "0")); vf.WriteLine("WITH_REGEXPS=" + (withRegExps? "1" : "0")); @@ -337,8 +334,6 @@ function configureLibxml() of.WriteLine(s.replace(/\@WITH_DEBUG\@/, withDebug? "1" : "0")); } else if (s.search(/\@WITH_MEM_DEBUG\@/) != -1) { of.WriteLine(s.replace(/\@WITH_MEM_DEBUG\@/, withMemDebug? "1" : "0")); - } else if (s.search(/\@WITH_RUN_DEBUG\@/) != -1) { - of.WriteLine(s.replace(/\@WITH_RUN_DEBUG\@/, withRunDebug? "1" : "0")); } else if (s.search(/\@WITH_SCHEMAS\@/) != -1) { of.WriteLine(s.replace(/\@WITH_SCHEMAS\@/, withSchemas? "1" : "0")); } else if (s.search(/\@WITH_SCHEMATRON\@/) != -1) { @@ -492,8 +487,6 @@ for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) { withDebug = strToBool(arg.substring(opt.length + 1, arg.length)); else if (opt == "mem_debug") withMemDebug = strToBool(arg.substring(opt.length + 1, arg.length)); - else if (opt == "run_debug") - withRunDebug = strToBool(arg.substring(opt.length + 1, arg.length)); else if (opt == "schemas") withSchemas = strToBool(arg.substring(opt.length + 1, arg.length)); else if (opt == "schematron") @@ -672,7 +665,6 @@ txtOut += " zlib support: " + boolToStr(withZlib) + "\n"; txtOut += " lzma support: " + boolToStr(withLzma) + "\n"; txtOut += " Debugging module: " + boolToStr(withDebug) + "\n"; txtOut += " Memory debugging: " + boolToStr(withMemDebug) + "\n"; -txtOut += " Runtime debugging: " + boolToStr(withRunDebug) + "\n"; txtOut += " Regexp support: " + boolToStr(withRegExps) + "\n"; txtOut += " Module support: " + boolToStr(withModules) + "\n"; txtOut += " Tree support: " + boolToStr(withTree) + "\n"; diff --git a/chromium/third_party/libxml/src/xmlIO.c b/chromium/third_party/libxml/src/xmlIO.c index 578c21713c8..834b4ae5874 100644 --- a/chromium/third_party/libxml/src/xmlIO.c +++ b/chromium/third_party/libxml/src/xmlIO.c @@ -15,9 +15,6 @@ #include <stdlib.h> #include <errno.h> -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> #endif @@ -2035,8 +2032,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) { xmlGenericError( xmlGenericErrorContext, "Transmitted content saved in file: %s\n", buffer ); - fwrite( http_content, sizeof( char ), - content_lgth, tst_file ); + fwrite( http_content, 1, content_lgth, tst_file ); fclose( tst_file ); } @@ -2050,7 +2046,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) { while ( (avail = xmlNanoHTTPRead( http_ctxt, buffer, sizeof( buffer ) )) > 0 ) { - fwrite( buffer, sizeof( char ), avail, tst_file ); + fwrite( buffer, 1, avail, tst_file ); } fclose( tst_file ); diff --git a/chromium/third_party/libxml/src/xmlsave.c b/chromium/third_party/libxml/src/xmlsave.c index 17bc37eaba4..77cb7b9b012 100644 --- a/chromium/third_party/libxml/src/xmlsave.c +++ b/chromium/third_party/libxml/src/xmlsave.c @@ -24,52 +24,9 @@ #include "private/error.h" #include "private/save.h" -/************************************************************************ - * * - * XHTML detection * - * * - ************************************************************************/ -#define XHTML_STRICT_PUBLIC_ID BAD_CAST \ - "-//W3C//DTD XHTML 1.0 Strict//EN" -#define XHTML_STRICT_SYSTEM_ID BAD_CAST \ - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" -#define XHTML_FRAME_PUBLIC_ID BAD_CAST \ - "-//W3C//DTD XHTML 1.0 Frameset//EN" -#define XHTML_FRAME_SYSTEM_ID BAD_CAST \ - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd" -#define XHTML_TRANS_PUBLIC_ID BAD_CAST \ - "-//W3C//DTD XHTML 1.0 Transitional//EN" -#define XHTML_TRANS_SYSTEM_ID BAD_CAST \ - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" +#ifdef LIBXML_OUTPUT_ENABLED #define XHTML_NS_NAME BAD_CAST "http://www.w3.org/1999/xhtml" -/** - * xmlIsXHTML: - * @systemID: the system identifier - * @publicID: the public identifier - * - * Try to find if the document correspond to an XHTML DTD - * - * Returns 1 if true, 0 if not and -1 in case of error - */ -int -xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID) { - if ((systemID == NULL) && (publicID == NULL)) - return(-1); - if (publicID != NULL) { - if (xmlStrEqual(publicID, XHTML_STRICT_PUBLIC_ID)) return(1); - if (xmlStrEqual(publicID, XHTML_FRAME_PUBLIC_ID)) return(1); - if (xmlStrEqual(publicID, XHTML_TRANS_PUBLIC_ID)) return(1); - } - if (systemID != NULL) { - if (xmlStrEqual(systemID, XHTML_STRICT_SYSTEM_ID)) return(1); - if (xmlStrEqual(systemID, XHTML_FRAME_SYSTEM_ID)) return(1); - if (xmlStrEqual(systemID, XHTML_TRANS_SYSTEM_ID)) return(1); - } - return(0); -} - -#ifdef LIBXML_OUTPUT_ENABLED #define TODO \ xmlGenericError(xmlGenericErrorContext, \ diff --git a/chromium/third_party/libxml/src/xmlstring.c b/chromium/third_party/libxml/src/xmlstring.c index 2bd7e6a6fef..7fbf9d079e2 100644 --- a/chromium/third_party/libxml/src/xmlstring.c +++ b/chromium/third_party/libxml/src/xmlstring.c @@ -46,12 +46,12 @@ xmlStrndup(const xmlChar *cur, int len) { xmlChar *ret; if ((cur == NULL) || (len < 0)) return(NULL); - ret = (xmlChar *) xmlMallocAtomic(((size_t) len + 1) * sizeof(xmlChar)); + ret = (xmlChar *) xmlMallocAtomic((size_t) len + 1); if (ret == NULL) { xmlErrMemory(NULL, NULL); return(NULL); } - memcpy(ret, cur, len * sizeof(xmlChar)); + memcpy(ret, cur, len); ret[len] = 0; return(ret); } @@ -91,12 +91,13 @@ xmlCharStrndup(const char *cur, int len) { xmlChar *ret; if ((cur == NULL) || (len < 0)) return(NULL); - ret = (xmlChar *) xmlMallocAtomic(((size_t) len + 1) * sizeof(xmlChar)); + ret = (xmlChar *) xmlMallocAtomic((size_t) len + 1); if (ret == NULL) { xmlErrMemory(NULL, NULL); return(NULL); } for (i = 0;i < len;i++) { + /* Explicit sign change */ ret[i] = (xmlChar) cur[i]; if (ret[i] == 0) return(ret); } @@ -460,12 +461,12 @@ xmlStrncat(xmlChar *cur, const xmlChar *add, int len) { size = xmlStrlen(cur); if ((size < 0) || (size > INT_MAX - len)) return(NULL); - ret = (xmlChar *) xmlRealloc(cur, ((size_t) size + len + 1) * sizeof(xmlChar)); + ret = (xmlChar *) xmlRealloc(cur, (size_t) size + len + 1); if (ret == NULL) { xmlErrMemory(NULL, NULL); return(cur); } - memcpy(&ret[size], add, len * sizeof(xmlChar)); + memcpy(&ret[size], add, len); ret[size + len] = 0; return(ret); } @@ -500,13 +501,13 @@ xmlStrncatNew(const xmlChar *str1, const xmlChar *str2, int len) { size = xmlStrlen(str1); if ((size < 0) || (size > INT_MAX - len)) return(NULL); - ret = (xmlChar *) xmlMalloc(((size_t) size + len + 1) * sizeof(xmlChar)); + ret = (xmlChar *) xmlMalloc((size_t) size + len + 1); if (ret == NULL) { xmlErrMemory(NULL, NULL); return(xmlStrndup(str1, size)); } - memcpy(ret, str1, size * sizeof(xmlChar)); - memcpy(&ret[size], str2, len * sizeof(xmlChar)); + memcpy(ret, str1, size); + memcpy(&ret[size], str2, len); ret[size + len] = 0; return(ret); } @@ -874,11 +875,11 @@ xmlUTF8Strndup(const xmlChar *utf, int len) { if ((utf == NULL) || (len < 0)) return(NULL); i = xmlUTF8Strsize(utf, len); - ret = (xmlChar *) xmlMallocAtomic(((size_t) i + 1) * sizeof(xmlChar)); + ret = (xmlChar *) xmlMallocAtomic((size_t) i + 1); if (ret == NULL) { return(NULL); } - memcpy(ret, utf, i * sizeof(xmlChar)); + memcpy(ret, utf, i); ret[i] = 0; return(ret); } @@ -1025,7 +1026,7 @@ xmlEscapeFormatString(xmlChar **msg) if ((count > INT_MAX) || (msgLen > INT_MAX - count)) return(NULL); resultLen = msgLen + count + 1; - result = (xmlChar *) xmlMallocAtomic(resultLen * sizeof(xmlChar)); + result = (xmlChar *) xmlMallocAtomic(resultLen); if (result == NULL) { /* Clear *msg to prevent format string vulnerabilities in out-of-memory situations. */ diff --git a/chromium/third_party/libxml/src/xpath.c b/chromium/third_party/libxml/src/xpath.c index 372fdb24631..aa86fd3a754 100644 --- a/chromium/third_party/libxml/src/xpath.c +++ b/chromium/third_party/libxml/src/xpath.c @@ -130,6 +130,9 @@ */ #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION #define XPATH_MAX_RECURSION_DEPTH 500 +#elif defined(_WIN32) +/* Windows typically limits stack size to 1MB. */ +#define XPATH_MAX_RECURSION_DEPTH 1000 #else #define XPATH_MAX_RECURSION_DEPTH 5000 #endif @@ -3098,7 +3101,7 @@ xmlXPathPopExternal (xmlXPathParserContextPtr ctxt) { #define CUR_CHAR(l) xmlXPathCurrentChar(ctxt, &l) #define COPY_BUF(l,b,i,v) \ - if (l == 1) b[i++] = (xmlChar) v; \ + if (l == 1) b[i++] = v; \ else i += xmlCopyChar(l,&b[i],v) #define NEXTL(l) ctxt->cur += l @@ -4855,7 +4858,7 @@ xmlXPathRegisterFuncNS(xmlXPathContextPtr ctxt, const xmlChar *name, return(-1); if (f == NULL) return(xmlHashRemoveEntry2(ctxt->funcHash, name, ns_uri, NULL)); -XML_IGNORE_PEDANTIC_WARNINGS +XML_IGNORE_FPTR_CAST_WARNINGS return(xmlHashAddEntry2(ctxt->funcHash, name, ns_uri, (void *) f)); XML_POP_WARNINGS } @@ -4938,7 +4941,7 @@ xmlXPathFunctionLookupNS(xmlXPathContextPtr ctxt, const xmlChar *name, if (ctxt->funcHash == NULL) return(NULL); -XML_IGNORE_PEDANTIC_WARNINGS +XML_IGNORE_FPTR_CAST_WARNINGS ret = (xmlXPathFunction) xmlHashLookup2(ctxt->funcHash, name, ns_uri); XML_POP_WARNINGS return(ret); @@ -9921,7 +9924,7 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) { if (len > XML_MAX_NAME_LENGTH) { XP_ERRORNULL(XPATH_EXPR_ERROR); } - buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); + buffer = (xmlChar *) xmlMallocAtomic(max); if (buffer == NULL) { XP_ERRORNULL(XPATH_MEMORY_ERROR); } @@ -9938,8 +9941,7 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) { XP_ERRORNULL(XPATH_EXPR_ERROR); } max *= 2; - tmp = (xmlChar *) xmlRealloc(buffer, - max * sizeof(xmlChar)); + tmp = (xmlChar *) xmlRealloc(buffer, max); if (tmp == NULL) { xmlFree(buffer); XP_ERRORNULL(XPATH_MEMORY_ERROR); diff --git a/chromium/third_party/libxml/win32/config.h b/chromium/third_party/libxml/win32/config.h index 4f99ae0b2ea..2b113237058 100644 --- a/chromium/third_party/libxml/win32/config.h +++ b/chromium/third_party/libxml/win32/config.h @@ -1,9 +1,6 @@ #ifndef __LIBXML_WIN32_CONFIG__ #define __LIBXML_WIN32_CONFIG__ -#define SEND_ARG2_CAST -#define GETHOSTBYNAME_ARG_CAST - #define HAVE_SYS_STAT_H #define HAVE_STAT #define HAVE_FCNTL_H @@ -12,9 +9,13 @@ #define HAVE_STDINT_H #endif -#if defined(_MSC_VER) && _MSC_VER < 1900 +#if defined(_MSC_VER) +#if _MSC_VER < 1900 #define snprintf _snprintf -#define vsnprintf _vsnprintf +#endif +#if _MSC_VER < 1500 +#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a) +#endif #endif #endif /* __LIBXML_WIN32_CONFIG__ */ diff --git a/chromium/third_party/libxml/win32/include/libxml/xmlversion.h b/chromium/third_party/libxml/win32/include/libxml/xmlversion.h index 21fe6b12d43..a0dd526df0b 100644 --- a/chromium/third_party/libxml/win32/include/libxml/xmlversion.h +++ b/chromium/third_party/libxml/win32/include/libxml/xmlversion.h @@ -313,7 +313,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); /** * LIBXML_DEBUG_RUNTIME: * - * Whether the runtime debugging is configured in + * Removed */ #if 0 #define LIBXML_DEBUG_RUNTIME @@ -409,12 +409,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #endif #ifdef __GNUC__ - -/** - * ATTRIBUTE_UNUSED: - * - * Macro used to signal to GCC unused function parameters - */ +/** DOC_DISABLE */ #ifndef ATTRIBUTE_UNUSED # if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) @@ -424,12 +419,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); # endif #endif -/** - * LIBXML_ATTR_ALLOC_SIZE: - * - * Macro used to indicate to GCC this is an allocator function - */ - #ifndef LIBXML_ATTR_ALLOC_SIZE # if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))) # define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x))) @@ -440,12 +429,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); # define LIBXML_ATTR_ALLOC_SIZE(x) #endif -/** - * LIBXML_ATTR_FORMAT: - * - * Macro used to indicate to GCC the parameter are printf like - */ - #ifndef LIBXML_ATTR_FORMAT # if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) # define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args))) @@ -465,6 +448,19 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); # endif #endif +#if defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) +#define XML_IGNORE_FPTR_CAST_WARNINGS \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \ + _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"") +#define XML_POP_WARNINGS \ + _Pragma("GCC diagnostic pop") +#else +#define XML_IGNORE_FPTR_CAST_WARNINGS +#define XML_POP_WARNINGS +#endif + +/** DOC_ENABLE */ #else /* ! __GNUC__ */ /** * ATTRIBUTE_UNUSED: @@ -493,6 +489,18 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #ifndef XML_DEPRECATED #define XML_DEPRECATED #endif +/** + * LIBXML_IGNORE_FPTR_CAST_WARNINGS: + * + * Macro used to ignore pointer cast warnings that can't be worked around. + */ +#define XML_IGNORE_FPTR_CAST_WARNINGS +/** + * LIBXML_POP_WARNINGS: + * + * Macro used to restore warnings state. + */ +#define XML_POP_WARNINGS #endif /* __GNUC__ */ #ifdef __cplusplus diff --git a/chromium/third_party/node/node_modules.tar.gz.sha1 b/chromium/third_party/node/node_modules.tar.gz.sha1 index f715cf5d900..9c259b374a3 100644 --- a/chromium/third_party/node/node_modules.tar.gz.sha1 +++ b/chromium/third_party/node/node_modules.tar.gz.sha1 @@ -1 +1 @@ -86745dc1c2122a55cafa111fa8fdf1e0587da224 +b729bed78ce1308e2922e4c8479e68330a0365f5 |