view release on metacpan or search on metacpan
t/payment.t view on Meta::CPAN
$faultybopi->session_id;
};
ok($@, "Error: $@");
my %accdata = (
accountid => 99999,
trxuserid => 99999,
trxpassword => 0,
adminactionpassword => '5cfgRT34xsdedtFLdfHxj7tfwx24fe',
);
t/payment.t view on Meta::CPAN
Business::OnlinePayment::IPayment->new(%faulty, %urls);
$faultybopi->session_id;
};
# test all the bad values
ok($@, "Error: $@");
$faulty{$k} = $accdata{$k};
}
# adminactionpassword seems to be optional? But we need only to
# generate the session, nothing more
my $wsdl_file = File::Spec->catfile("t", "ipayment.wsdl");
my $bopi = Business::OnlinePayment::IPayment->new(%accdata, %urls,
wsdl_file => $wsdl_file);
$accdata{accountId} = delete $accdata{accountid};
$accdata{trxuserId} = delete $accdata{trxuserid};
is_deeply($bopi->accountData, { %accdata } , "Stored values ok");
is scalar(keys %{$bopi->processorUrls}), 3, "Found 3 urls";
is $bopi->processorUrls->{redirectUrl}, $urls{success_url}, "success ok";
is $bopi->processorUrls->{silentErrorUrl}, $urls{failure_url}, "success ok";
view all matches for this distribution
view release on metacpan or search on metacpan
share/www/static/jquery.js view on Meta::CPAN
},
// Contents
"empty": function( elem ) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
// not comment, processing instructions, or others
// Thanks to Diego Perini for the nodeName shortcut
// Greater than "@" means alpha characters (specifically not starting with "#" or "?")
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CAD/Drawing/IO/Circ.pm view on Meta::CPAN
if($opts{type} =~ m/(\..*)$/) {
$suffix = $1;
}
$suffix || die "need suffix\n";
$opts{suffix} = $suffix;
$self->write_circdata($directory, \%opts);
my ($s, $n) = check_select($opts);
foreach my $layer ($self->getLayerList()) {
$s->{l} && ($s->{l}{$layer} || next);
$n->{l} && ($n->{l}{$layer} && next);
my $outfile = "$directory/$layer$suffix";
lib/CAD/Drawing/IO/Circ.pm view on Meta::CPAN
close(TAG);
return(\%info);
} # end subroutine pingcirc definition
########################################################################
=head2 write_circdata
$drw->write_circdata($directory, \%options);
=cut
sub write_circdata {
my $self = shift;
my ($directory, $opts) = @_;
my $circfile = "$directory/$circtag";
# maybe load the existing one first and then over-write it?
my $existing = $self->pingcirc($directory);
lib/CAD/Drawing/IO/Circ.pm view on Meta::CPAN
foreach my $key (keys(%info)) {
print CDATA "$key:$info{$key}\n";
}
close(CDATA);
} # end subroutine write_circdata definition
########################################################################
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CAM/PDF.pm view on Meta::CPAN
{
my $self = shift;
my $deref = shift;
my $startnode = shift;
my $func = shift;
my $funcdata = shift;
my $traversed = shift || {};
my @stack = ($startnode);
my $i = 0;
while ($i < @stack)
{
my $objnode = $stack[$i++];
$self->$func($objnode, $funcdata);
my $type = $objnode->{type};
my $val = $objnode->{value};
if ($type eq 'object')
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CAM/XML.pm view on Meta::CPAN
=item $self->add(CAM::XML instance)
=item $self->add(-text => $text)
=item $self->add(-cdata => $text)
=item $self->add(-xml => $rawxml)
=item $self->add(<multiple elements of the above types>)
Add content within the current tag. Order of addition may be
significant. This content can be any one of 1) subsidiary XML tags
(CAM::XML), 2) literal text content (C<-text> or C<-cdata>), or 3)
pre-formatted XML content (C<-xml>).
In C<-text> and C<-cdata> content, any reserved characters will be
automatically escaped. Those two modes differ only in their XML
representation: C<-cdata> is more human-readable if there are a lot of
"&", "<" and ">" characters in your text, where C<-text> is usually more
compact for short strings. These strings are not escaped until
output.
Content in C<-xml> mode is parsed in as CAM::XML objects. If it is not
lib/CAM/XML.pm view on Meta::CPAN
# Test different kinds of input
!$add ? croak 'Undefined object'
: ref $add && $add->isa(__PACKAGE__) ? push @{ $self->{children} }, $add
: ref $add && $add->isa('CAM::XML::Text') ? push @{ $self->{children} }, $add
: ref $add ? croak 'Invalid object type to add to a CAM::XML node'
: $add =~ m/\A-(text|cdata)\z/xms ? $self->_add_text($1, shift)
: $add eq '-xml' ? $self->_add_xml(shift)
: croak "Unknown flag '$add'. Expected '-text' or '-cdata' or '-xml'";
}
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
examples/buttons.xml view on Meta::CPAN
<form title="Button on/off example" header="head.tmpl"
footer="foot.tmpl" post-event="post">
<page name="page1">
<title>Gratuitous first page</title>
<html>
<![cdata[
<p>This example form lets you turn buttons on and off. Hit
"Next" to get to the actual example</p>
]]>
</html>
</page>
view all matches for this distribution
view release on metacpan or search on metacpan
}
sub handle_char {
my $self = shift;
return sub {
my ($parser,$cdata) = @_;
return if $parser->depth == 1;
my $element = $parser->current_element;
$self->delete($element);
unshift @{$self->param_fetch(-name=>$element)},$cdata;
}
}
sub QuoteXMLChars {
$_[0] =~ s/&/&/g;
view all matches for this distribution
view release on metacpan or search on metacpan
my $type = 'text/css';
my $rel = 'stylesheet';
my $cdata_start = $XHTML ? "\n<!--/* <![CDATA[ */" : "\n<!-- ";
my $cdata_end = $XHTML ? "\n/* ]]> */-->\n" : " -->\n";
my @s = ref($style) eq 'ARRAY' ? @$style : $style;
my $other = '';
for my $s (@s) {
my @v = ref($verbatim) eq 'ARRAY' ? @$verbatim : $verbatim;
push(@result, "<style type=\"text/css\">\n$_\n</style>") for @v;
}
if ($code) {
my @c = ref($code) eq 'ARRAY' ? @$code : $code;
push(@result,style({'type'=>$type},"$cdata_start\n$_\n$cdata_end")) for @c;
}
} else {
my $src = $s;
push(@result,$XHTML ? qq(<link rel="$rel" type="$type" href="$src" $other/>)
my $comment = '//'; # javascript by default
$comment = '#' if $type=~/perl|tcl/i;
$comment = "'" if $type=~/vbscript/i;
my ($cdata_start,$cdata_end);
if ($XHTML) {
$cdata_start = "$comment<![CDATA[\n";
$cdata_end .= "\n$comment]]>";
} else {
$cdata_start = "\n<!-- Hide script\n";
$cdata_end = $comment;
$cdata_end .= " End script hiding -->\n";
}
my(@satts);
push(@satts,'src'=>$src) if $src;
push(@satts,'type'=>$type);
push(@satts,'charset'=>$charset) if ($src && $charset);
$code = $cdata_start . $code . $cdata_end if defined $code;
push(@result,$self->script({@satts},$code || ''));
}
@result;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CORBA/JAVA/ClassXmlVisitor.pm view on Meta::CPAN
print $FH " }\n";
print $FH "\n";
print $FH " public static ",$node->{java_Name}," read (",$self->{xml_pkg},"InputStream \$is, java.lang.String tag)\n";
print $FH " {\n";
print $FH " \$is.read_open_tag (tag);\n";
print $FH " java.lang.String str = \$is.read_pcdata ();\n";
print $FH " \$is.read_close_tag (tag);\n";
foreach (@{$node->{list_expr}}) {
print $FH " if (str.equals (\"",$_->{java_name},"\"))\n";
print $FH " return ",$_->{java_Name},";\n";
}
lib/CORBA/JAVA/ClassXmlVisitor.pm view on Meta::CPAN
print $FH " }\n";
print $FH "\n";
print $FH " public static void write (",$self->{xml_pkg},"OutputStream \$os, ",$node->{java_Name}," value, java.lang.String tag)\n";
print $FH " {\n";
print $FH " \$os.write_open_tag (tag);\n";
print $FH " \$os.write_pcdata (value.toString ());\n";
print $FH " \$os.write_close_tag (tag);\n";
print $FH " }\n";
print $FH "\n";
print $FH "}\n";
close $FH;
view all matches for this distribution
view release on metacpan or search on metacpan
ccc/CMenu.pm view on Meta::CPAN
if( $path =~ m#(^/.*)/[^/]*$# ) { # dirname
$self->prepare_item('', $1, undef, 'Branch', undef, undef);
}
my $selfptr = $self->{'SELFPTR'};
$type = 'LastBranch' if $path =~ m#^/_?Help$#i;
my $cdata = [$path, $hotkey, undef, $action, "<$type>"];
if( $type =~ /Item/ ) {
$cdata->[2] = sub { item_activated_cb($selfptr, $curr_item, @_) };
}
$self->{'FACTORY'}->create_item($cdata);
}
else {
$curr_item = $items->{$path};
if( $curr_item->{'TYPE'} ne $type ) {
carp "$self->{MENU_NAME}:$path already defined as a $type";
view all matches for this distribution
view release on metacpan or search on metacpan
t/unpacked/GraphViz/lib/GraphViz/XML.pm view on Meta::CPAN
my $label = $root->gi;
my $colour = 'blue';
my $shape = 'ellipse';
if ($root->is_pcdata) {
$label = $root->text;
$label =~ s|^\s+||;
$label =~ s|\s+$||;
$colour = 'black';
} else {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CSS/SAC/Selector/CharacterData.pm view on Meta::CPAN
# CSS::SAC::Selector::CharacterData->new($type,$data)
# creates a new sac CharacterDataSelector object
#---------------------------------------------------------------------#
sub new {
my $class = ref($_[0])?ref(shift):shift;
my $type = shift; # should be one of the cdata selectors
my $data = shift;
# create a selector
my $csel = $class->SUPER::new($type);
lib/CSS/SAC/Selector/CharacterData.pm view on Meta::CPAN
*CSS::SAC::Selector::CharacterData::getData = \&Data;
#---------------------------------------------------------------------#
# my $data = $csel->Data()
# $csel->Data($data)
# get/set the selector's cdata
#---------------------------------------------------------------------#
sub Data {
(@_==2) ? $_[0]->[_data_] = $_[1] :
$_[0]->[_data_];
}
lib/CSS/SAC/Selector/CharacterData.pm view on Meta::CPAN
=over
=item * CSS::SAC::Selector::CharacterData->new($type,$data)
=item * $sel->new($type,$data)
Creates a new cdata selector.
=item * $csel->Data([$data])
get/set the selector's data
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CTK/Util.pm view on Meta::CPAN
See L<Sys::Path/"cachedir">
Tags: CORE, BASE, FILE
=head3 cdata
$cdatatext = cdata( $text );
Returns a string "<![CDATA[$text]]>" for plain XML documents.
Tags: BASE, FORMAT
lib/CTK/Util.pm view on Meta::CPAN
=item B<:FORMAT>
Exports functions:
L</"cdata">,
L</"correct_dig">,
L</"correct_number">,
L</"dformat">,
L</"escape">,
L</"fformat">,
lib/CTK/Util.pm view on Meta::CPAN
);
my @est_encoding = qw(
to_utf8 to_windows1251 to_cp1251 to_base64 from_utf8
);
my @est_format = qw(
escape unescape slash tag tag_create cdata dformat fformat
lf_normalize nl_normalize file_lf_normalize file_nl_normalize
correct_number correct_dig
variant_stf trim
);
my @est_datetime = qw(
lib/CTK/Util.pm view on Meta::CPAN
$data_staring =~ s/\<\;/\</g;
$data_staring =~ s/\>\;/\>/g;
$data_staring =~ s/\"\;/\"/g;
return $data_staring;
}
sub cdata {
my $s = shift;
my $ss = to_utf8('<![CDATA[');
my $sf = to_utf8(']]>');
if (defined $s) {
return $ss.$s.$sf;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Calendar/Plugin/Renderer/SVG.pm view on Meta::CPAN
my $month_label = $self->month_label;
$calendar->text('id' => "month",
'fill' => 'blue',
'x' => $month_label->x,
'y' => $month_label->y,
'style' => $month_label->style)->cdata($month_label->text);
my $year_label = $self->year_label;
$calendar->text('id' => "year",
'fill' => 'blue',
'x' => $year_label->x,
'y' => $year_label->y,
'style' => $year_label->style)->cdata($year_label->text);
my $boundary_box = $self->boundary_box;
$calendar->rect('id' => 'bounding_box',
'height' => $boundary_box->height - $self->adjust_height,
'width' => $boundary_box->width - 14,
lib/Calendar/Plugin/Renderer/SVG.pm view on Meta::CPAN
'length' => $wdays->[$_]->text->length,
'adjust' => $wdays->[$_]->text->adjust,
'font-size' => $wdays->[$_]->text->font_size,
'text-anchor' => 'middle',
'stroke' => 'red')
->cdata($wdays->[$_]->text->value);
}
my $row = $self->_row;
my $days_box = $self->days_box;
foreach my $r (1..$row) {
lib/Calendar/Plugin/Renderer/SVG.pm view on Meta::CPAN
'font-size' => $days_box->[$r]->[$c]->text->font_size,
'stroke' => 'green',
'text-anchor' => 'right',
'fill' => 'silver',
'fill-opacity' => '50%')
->cdata($text);
}
}
return $svg->to_xml;
}
view all matches for this distribution
view release on metacpan or search on metacpan
root/static/js/yui/assets/dpSyntaxHighlighter.css view on Meta::CPAN
.dp-sql .keyword { color: blue; }
.dp-sql .func { color: #ff1493; }
.dp-sql .op { color: #808080; }
*/
.dp-xml {}
.dp-xml .cdata { color: #ff1493; }
.dp-xml .comments { color: green; }
.dp-xml .tag { color: blue; }
.dp-xml .tag-name { color: black; font-weight: bold; }
.dp-xml .attribute { color: red; }
.dp-xml .attribute-value { color: blue; }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catmandu/XML/Transformer.pm view on Meta::CPAN
is => 'lazy',
builder => sub {
[
map {
XML::LibXSLT->new()->parse_stylesheet(
XML::LibXML->load_xml(location => $_, no_cdata=>1)
)
} @{$_[0]->stylesheet}
]
}
);
view all matches for this distribution
view release on metacpan or search on metacpan
share/plotly.js/plotly.min.js view on Meta::CPAN
/*
* @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc
* @license MIT
* @preserve Project Home: https://github.com/voidqk/polybooljs
*/
var n,i=t("./lib/build-log"),a=t("./lib/epsilon"),o=t("./lib/intersecter"),s=t("./lib/segment-chainer"),l=t("./lib/segment-selector"),c=t("./lib/geojson"),u=!1,f=a();function h(t,e,r){var i=n.segments(t),a=n.segments(e),o=r(n.combine(i,a));return n.p...
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Chemistry/ESPT/Gfchk.pm view on Meta::CPAN
my $geomcount = 0;
my $gradientflag = 0;
my $hessflag = 0;
my $hesstot = 0;
my $irccoord = 0;
my $ircdata = 0;
my $ircflag = 0;
my $ircgeomflag = 0;
my $ircgradientflag = 0;
my $ircresults = 0;
my $ircresultsflag = 0;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Class/Root.pm view on Meta::CPAN
};
my $root_class_init = sub {
my $class = shift;
my $cdata = $class_data->{$class};
my %args = ( @_ );
while ( my($k,$v) = each %args ) {
my $method = $k;
unless ( $cdata->{$attr_init_done_key}->{$method} ) {
$cdata->{$attr_init_done_key}->{$method} = 1;
if ( ::RT_CHECKS ) {
eval { $class->$method($v) };
croak "Error calling method \"$method\" for \"$class\": $EVAL_ERROR\n" if $EVAL_ERROR;
} else {
$class->$method($v);
lib/Class/Root.pm view on Meta::CPAN
declare class_init => class_method { goto $root_class_init };
declare base_class_init => class_method {
my $class = shift;
my $cdata = $class_data->{$class};
my $caller;
if ( @_ and $_[0] =~ /^CALLER=(.*)/ ) {
shift;
$caller = $1;
lib/Class/Root.pm view on Meta::CPAN
unless ( defined $caller ) {
$caller = caller();
$caller =~ s/::LOCAL$//;
}
$cdata->{$base_init_done_key}->{$caller} = 1;
my %attr_values = %{ $schema->{$caller}->{CLASS_ATTR_VALUES} };
my @args = ( %attr_values );
my $key = 0;
lib/Class/Root.pm view on Meta::CPAN
}
my $not_seen_parents = 0;
for my $parent ( @caller_isa ) {
next if $cdata->{$base_init_done_key}->{$parent};
if ( my $code = $parent->can("class_init") ) {
$not_seen_parents++;
$class->$code( @args );
}
view all matches for this distribution
view release on metacpan or search on metacpan
C<as_string>. In the case of C<children_accept>, Visitor will create
an iterator in the class C<Class::Scalar::Iter> with the scalar as the
delegate.
In the case of C<as_string>, Visitor will use the string unless
C<$context-E<gt>{cdata_mapper}> is defined, in which case it returns
the result of calling the C<cdata_mapper> subroutine with the scalar
and the remaining arguments. The actual implementation is:
&{$context->{cdata_mapper}} ($scalar, @_);
=head1 AUTHOR
Ken MacLeod, ken@bitsko.slc.ut.us
view all matches for this distribution
view release on metacpan or search on metacpan
modules/CommonMark/src/scanners.re view on Meta::CPAN
processinginstruction = "?" ([^?>\x00]+ | [?][^>\x00] | [>])* "?>";
declaration = "!" [A-Z]+ spacechar+ [^>\x00]* ">";
cdata = "![CDATA[" ([^\]\x00]+ | "]" [^\]\x00] | "]]" [^>\x00])* "]]>";
htmltag = opentag | closetag | htmlcomment | processinginstruction |
declaration | cdata;
in_parens_nosp = [(] (reg_char|escaped_char|[\\])* [)];
in_double_quotes = ["] (escaped_char|[^"\x00])* ["];
in_single_quotes = ['] (escaped_char|[^'\x00])* ['];
view all matches for this distribution
view release on metacpan or search on metacpan
share/js/jquery-1.11.3.js view on Meta::CPAN
},
// Contents
"empty": function( elem ) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
// but not by others (comment: 8; processing instruction: 7; etc.)
// nodeType < 6 works because attributes (2) do not appear as children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
if ( elem.nodeType < 6 ) {
return false;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Complete/Fish/Gen/FromPerinciCmdLine.pm view on Meta::CPAN
unless $gengls_res->[0] == 200;
my $glspec = $gengls_res->[2];
$glspec->{'<>'} = sub{};
require Perinci::Sub::To::CLIDocData;
my $genclidocdata_res = Perinci::Sub::To::CLIDocData::gen_cli_doc_data_from_meta(
common_opts => $cli->{common_opts},
ggls_res => $gengls_res,
meta => $meta,
meta_is_normalized => 1,
per_arg_json => $cli->{per_arg_json},
per_arg_yaml => $cli->{per_arg_yaml},
);
return [500, "Can't generate CLI doc data: ".
"$genclidocdata_res->[0] - $genclidocdata_res->[1]"]
unless $genclidocdata_res->[0] == 200;
my $clidocdata = $genclidocdata_res->[2];
my $opt_desc = {};
for my $k (sort keys %{$clidocdata->{opts}}) {
my $v = $clidocdata->{opts}{$k};
next unless $v->{summary};
my @o = $k =~ /--?(\S+)/g;
for my $o (@o) {
$opt_desc->{$o} = $v->{summary};
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Complete/Zsh/Gen/FromPerinciCmdLine.pm view on Meta::CPAN
unless $gengls_res->[0] == 200;
my $glspec = $gengls_res->[2];
$glspec->{'<>'} = sub{};
require Perinci::Sub::To::CLIDocData;
my $genclidocdata_res = Perinci::Sub::To::CLIDocData::gen_cli_doc_data_from_meta(
common_opts => $cli->{common_opts},
ggls_res => $gengls_res,
meta => $meta,
meta_is_normalized => 1,
per_arg_json => $cli->{per_arg_json},
per_arg_yaml => $cli->{per_arg_yaml},
);
return [500, "Can't generate CLI doc data: ".
"$genclidocdata_res->[0] - $genclidocdata_res->[1]"]
unless $genclidocdata_res->[0] == 200;
my $clidocdata = $genclidocdata_res->[2];
my $opt_desc = {};
for my $k (sort keys %{$clidocdata->{opts}}) {
my $v = $clidocdata->{opts}{$k};
next unless $v->{summary};
my @o = $k =~ /--?(\S+)/g;
for my $o (@o) {
$opt_desc->{$o} = $v->{summary};
}
view all matches for this distribution
view release on metacpan or search on metacpan
SelfExtracting.pm view on Meta::CPAN
sub compress
{
my $data = shift;
my %o = @_;
@O{keys %o} = values %o;
my $cdata = &{"Compress::SelfExtracting::$O{type}::compress"}($data, \%O);
if ($O{uu}) {
$cdata = pack 'u', $cdata;
}
if ($O{standalone}) {
my $sa = &{"Compress::SelfExtracting::$O{type}::standalone"}(\%O);
return $sa.$cdata;
} else {
return "use Compress::SelfExtracting::Filter "
.join(', ', map { "$_ => '$O{$_}'" }
grep!/decompress|file|data/,keys %O).";\n"
.md5_hex($data)."\n$cdata\n";
}
}
sub decompress
{
view all matches for this distribution
view release on metacpan or search on metacpan
ext/zstd/tests/regression/data.c view on Meta::CPAN
/** Create the curl state. */
static curl_data_t curl_data_create(
data_resource_t const* resource,
data_type_t type) {
curl_data_t cdata = {};
XXH64_reset(&cdata.xxhash64, 0);
assert(UTIL_isDirectory(g_data_dir));
if (type == data_type_file) {
/* Decompress the resource and store to the path. */
char* cmd = cat3("zstd -dqfo '", resource->path, "'");
if (cmd == NULL) {
cdata.error = ENOMEM;
return cdata;
}
cdata.file = popen(cmd, "w");
free(cmd);
} else {
/* Decompress and extract the resource to the cache directory. */
char* cmd = cat3("zstd -dc | tar -x -C '", g_data_dir, "'");
if (cmd == NULL) {
cdata.error = ENOMEM;
return cdata;
}
cdata.file = popen(cmd, "w");
free(cmd);
}
if (cdata.file == NULL) {
cdata.error = errno;
}
return cdata;
}
/** Free the curl state. */
static int curl_data_free(curl_data_t cdata) {
return pclose(cdata.file);
}
/** curl callback. Updates the hash, and writes to the file. */
static size_t curl_write(void* data, size_t size, size_t count, void* ptr) {
curl_data_t* cdata = (curl_data_t*)ptr;
size_t const written = fwrite(data, size, count, cdata->file);
XXH64_update(&cdata->xxhash64, data, written * size);
return written;
}
static int curl_download_resource(
CURL* curl,
data_resource_t const* resource,
data_type_t type) {
curl_data_t cdata;
/* Download the data. */
if (curl_easy_setopt(curl, CURLOPT_URL, resource->url) != 0)
return EINVAL;
if (curl_easy_setopt(curl, CURLOPT_WRITEDATA, &cdata) != 0)
return EINVAL;
cdata = curl_data_create(resource, type);
if (cdata.error != 0)
return cdata.error;
int const curl_err = curl_easy_perform(curl);
int const close_err = curl_data_free(cdata);
if (curl_err) {
fprintf(
stderr,
"downloading '%s' for '%s' failed\n",
resource->url,
ext/zstd/tests/regression/data.c view on Meta::CPAN
fprintf(
stderr, "output directory '%s' does not exist\n", resource->path);
return EIO;
}
/* Check that the hash matches. */
if (XXH64_digest(&cdata.xxhash64) != resource->xxhash64) {
fprintf(
stderr,
"checksum does not match: 0x%llxLL != 0x%llxLL\n",
(unsigned long long)XXH64_digest(&cdata.xxhash64),
(unsigned long long)resource->xxhash64);
return EINVAL;
}
return 0;
ext/zstd/tests/regression/data.c view on Meta::CPAN
/** Download all the data. */
static int curl_download_data(data_t const* const* data) {
if (curl_global_init(CURL_GLOBAL_ALL) != 0)
return EFAULT;
curl_data_t cdata = {};
CURL* curl = curl_easy_init();
int err = EFAULT;
if (curl == NULL)
return EFAULT;
view all matches for this distribution
view release on metacpan or search on metacpan
zopflib/src/zopflipng/lodepng/lodepng_util.cpp view on Meta::CPAN
lodepng_chunk_type(type, chunk);
if(std::string(type).size() != 4) return 1; //Probably not a PNG file
if(std::string(type) == "IDAT")
{
const unsigned char* cdata = lodepng_chunk_data_const(chunk);
unsigned clength = lodepng_chunk_length(chunk);
if(chunk + clength + 12 > end || clength > png.size() || chunk + clength + 12 < begin) {
// corrupt chunk length
return 1;
}
for(unsigned i = 0; i < clength; i++)
{
zdata.push_back(cdata[i]);
}
}
next = lodepng_chunk_next_const(chunk);
if (next <= chunk) return 1; // integer overflow
view all matches for this distribution
view release on metacpan or search on metacpan
ext/zstd/tests/regression/data.c view on Meta::CPAN
/** Create the curl state. */
static curl_data_t curl_data_create(
data_resource_t const* resource,
data_type_t type) {
curl_data_t cdata = {};
XXH64_reset(&cdata.xxhash64, 0);
assert(UTIL_isDirectory(g_data_dir));
if (type == data_type_file) {
/* Decompress the resource and store to the path. */
char* cmd = cat3("zstd -dqfo '", resource->path, "'");
if (cmd == NULL) {
cdata.error = ENOMEM;
return cdata;
}
cdata.file = popen(cmd, "w");
free(cmd);
} else {
/* Decompress and extract the resource to the cache directory. */
char* cmd = cat3("zstd -dc | tar -x -C '", g_data_dir, "'");
if (cmd == NULL) {
cdata.error = ENOMEM;
return cdata;
}
cdata.file = popen(cmd, "w");
free(cmd);
}
if (cdata.file == NULL) {
cdata.error = errno;
}
return cdata;
}
/** Free the curl state. */
static int curl_data_free(curl_data_t cdata) {
return pclose(cdata.file);
}
/** curl callback. Updates the hash, and writes to the file. */
static size_t curl_write(void* data, size_t size, size_t count, void* ptr) {
curl_data_t* cdata = (curl_data_t*)ptr;
size_t const written = fwrite(data, size, count, cdata->file);
XXH64_update(&cdata->xxhash64, data, written * size);
return written;
}
static int curl_download_resource(
CURL* curl,
data_resource_t const* resource,
data_type_t type) {
curl_data_t cdata;
/* Download the data. */
if (curl_easy_setopt(curl, CURLOPT_URL, resource->url) != 0)
return EINVAL;
if (curl_easy_setopt(curl, CURLOPT_WRITEDATA, &cdata) != 0)
return EINVAL;
cdata = curl_data_create(resource, type);
if (cdata.error != 0)
return cdata.error;
int const curl_err = curl_easy_perform(curl);
int const close_err = curl_data_free(cdata);
if (curl_err) {
fprintf(
stderr,
"downloading '%s' for '%s' failed\n",
resource->url,
ext/zstd/tests/regression/data.c view on Meta::CPAN
fprintf(
stderr, "output directory '%s' does not exist\n", resource->path);
return EIO;
}
/* Check that the hash matches. */
if (XXH64_digest(&cdata.xxhash64) != resource->xxhash64) {
fprintf(
stderr,
"checksum does not match: 0x%llxLL != 0x%llxLL\n",
(unsigned long long)XXH64_digest(&cdata.xxhash64),
(unsigned long long)resource->xxhash64);
return EINVAL;
}
return 0;
ext/zstd/tests/regression/data.c view on Meta::CPAN
/** Download all the data. */
static int curl_download_data(data_t const* const* data) {
if (curl_global_init(CURL_GLOBAL_ALL) != 0)
return EFAULT;
curl_data_t cdata = {};
CURL* curl = curl_easy_init();
int err = EFAULT;
if (curl == NULL)
return EFAULT;
view all matches for this distribution
view release on metacpan or search on metacpan
contrib/parse-man.pl view on Meta::CPAN
qq!license="LGPLv2.1+"!,
qq!accept:".*" type=leaf value_type=uniline warn="$unknown_param_msg"!,
]);
}
foreach my $cdata ($data->{element}->@*) {
my ($config_class, $element, $desc, $extra_info, $supersedes) = $cdata->@*;
my $obj = setup_element ($meta_root, $config_class, $element, $desc, $extra_info, $supersedes);
$desc =~ s/ +$//gm;
$obj->fetch_element("description")->store(wrap('','',$desc));
view all matches for this distribution