mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
fix runaway default packing, array range syntax
This commit is contained in:
parent
6e17a56908
commit
0810adaa2c
@ -251,7 +251,11 @@ generate_hash(HashGenerator &hashgen) const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool DCArrayParameter::
|
bool DCArrayParameter::
|
||||||
pack_default_value(DCPackData &pack_data, bool &pack_error) const {
|
pack_default_value(DCPackData &pack_data, bool &pack_error) const {
|
||||||
if (has_default_value()) {
|
// We only want to call up if the DCField can pack the value
|
||||||
|
// immediately--we don't trust the DCField to generate the default
|
||||||
|
// value (since it doesn't know how large the minimum length array
|
||||||
|
// is).
|
||||||
|
if (_has_default_value && !_default_value_stale) {
|
||||||
return DCField::pack_default_value(pack_data, pack_error);
|
return DCField::pack_default_value(pack_data, pack_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ get_num_nested_fields() const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE bool DCPacker::
|
INLINE bool DCPacker::
|
||||||
more_nested_fields() const {
|
more_nested_fields() const {
|
||||||
return (_current_field != (DCPackerInterface *)NULL);
|
return (_current_field != (DCPackerInterface *)NULL && !_pack_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -160,6 +160,7 @@ dc_cleanup_parser() {
|
|||||||
%type <str> optional_name
|
%type <str> optional_name
|
||||||
%type <u.s_uint> char_or_uint
|
%type <u.s_uint> char_or_uint
|
||||||
%type <u.s_uint> small_unsigned_integer
|
%type <u.s_uint> small_unsigned_integer
|
||||||
|
%type <u.s_uint> small_negative_integer
|
||||||
%type <u.int64> signed_integer
|
%type <u.int64> signed_integer
|
||||||
%type <u.uint64> unsigned_integer
|
%type <u.uint64> unsigned_integer
|
||||||
%type <u.real> char_or_number
|
%type <u.real> char_or_number
|
||||||
@ -779,6 +780,13 @@ uint_range:
|
|||||||
if (!uint_range.add_range($1, $3)) {
|
if (!uint_range.add_range($1, $3)) {
|
||||||
yyerror("Overlapping range");
|
yyerror("Overlapping range");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
| char_or_uint small_negative_integer
|
||||||
|
{
|
||||||
|
uint_range.clear();
|
||||||
|
if (!uint_range.add_range($1, $2)) {
|
||||||
|
yyerror("Overlapping range");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
| uint_range ',' char_or_uint
|
| uint_range ',' char_or_uint
|
||||||
{
|
{
|
||||||
@ -791,6 +799,12 @@ uint_range:
|
|||||||
if (!uint_range.add_range($3, $5)) {
|
if (!uint_range.add_range($3, $5)) {
|
||||||
yyerror("Overlapping range");
|
yyerror("Overlapping range");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
| uint_range ',' char_or_uint small_negative_integer
|
||||||
|
{
|
||||||
|
if (!uint_range.add_range($3, $4)) {
|
||||||
|
yyerror("Overlapping range");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -856,6 +870,20 @@ small_unsigned_integer:
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
small_negative_integer:
|
||||||
|
SIGNED_INTEGER
|
||||||
|
{
|
||||||
|
$$ = (unsigned int)-$1;
|
||||||
|
if ($1 >= 0) {
|
||||||
|
yyerror("Syntax error.");
|
||||||
|
|
||||||
|
} else if ($$ != -$1) {
|
||||||
|
yyerror("Number out of range.");
|
||||||
|
$$ = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
signed_integer:
|
signed_integer:
|
||||||
SIGNED_INTEGER
|
SIGNED_INTEGER
|
||||||
;
|
;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user