114 Star 0 Fork 5

src-openEuler/perl-XML-SAX

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
perl-XML-SAX-0.99-rt20126.patch 1.60 KB
一键复制 编辑 原始数据 按行查看 历史
weiwei_150212 提交于 2020-07-27 16:38 . update to 1.02
diff --git a/lib/XML/SAX/PurePerl.pm b/lib/XML/SAX/PurePerl.pm
--- a/lib/XML/SAX/PurePerl.pm 2006-04-24 01:20:09.000000000 +0200
+++ b/lib/XML/SAX/PurePerl.pm 2012-08-09 12:47:48.736728516 +0200
@@ -595,22 +595,23 @@ sub Comment {
my $data = $reader->data(4);
if ($data =~ /^<!--/) {
- $reader->move_along(4);
+ $reader->move_along(4); # skip comment start
+ $data = $reader->data;
+ while ($data !~ m!-->!) {
+ my $n = $reader->read_more;
+ $self->parser_error("End of data seen while looking for close comment marker", $reader)
+ unless $n;
+ $data = $reader->data;
+ }
+
my $comment_str = '';
- while (1) {
- my $data = $reader->data;
- $self->parser_error("End of data seen while looking for close comment marker", $reader)
- unless length($data);
- if ($data =~ /^(.*?)-->/s) {
- $comment_str .= $1;
- $self->parser_error("Invalid comment (dash)", $reader) if $comment_str =~ /-$/;
- $reader->move_along(length($1) + 3);
- last;
- }
- else {
- $comment_str .= $data;
- $reader->move_along(length($data));
- }
+ if ($data =~ /^(.*?)-->/s) {
+ $comment_str = $1;
+ $self->parser_error("Invalid comment (dash)", $reader) if $comment_str =~ /-$/;
+ $reader->move_along(length($1) + 3);
+ }
+ else {
+ return 0;
}
$self->comment({ Data => $comment_str });
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/perl-XML-SAX.git
git@gitee.com:src-openeuler/perl-XML-SAX.git
src-openeuler
perl-XML-SAX
perl-XML-SAX
master

搜索帮助