aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2004-10-02 00:10:25 +0000
committerLev Walkin <vlm@lionet.info>2004-10-02 00:10:25 +0000
commit7c9e9237e9498ece7bb213718c6241fd3f1a6b3d (patch)
tree6c214a680d1702793a75cba7b9e906d6c4c643ef
parent28c89eb4d4f51a8205bd6d675c6aaf2b5101f06c (diff)
fixed limits accounting
-rw-r--r--asn1c/asn1c.16
-rw-r--r--asn1c/asn1c.c2
-rw-r--r--asn1c/unber.c13
3 files changed, 16 insertions, 5 deletions
diff --git a/asn1c/asn1c.1 b/asn1c/asn1c.1
index 7ac0015c..b331d440 100644
--- a/asn1c/asn1c.1
+++ b/asn1c/asn1c.1
@@ -80,7 +80,7 @@ an ASN.1 standard and compiler may fail to produce the meaningful code.
.TP
.B \-fnative-types
Use the native machine's data types (int, double) whenever possible,
-instead of the compound ASN.1 INTEGER_t, ENUMERATED_t and REAL_t types.
+instead of the compound INTEGER_t, ENUMERATED_t and REAL_t types.
.TP
.B \-fno-constraints
Do not generate ASN.1 subtype constraint checking code. This may make a shorter executable.
@@ -89,7 +89,9 @@ Do not generate ASN.1 subtype constraint checking code. This may make a shorter
Enable unnamed unions in the definitions of target language's structures.
.TP
.B \-ftypes88
-Use only ASN.1:1988 embedded types.
+Pretend to support only ASN.1:1988 embedded types. Certain reserved words,
+such as UniversalString and BMPString, become ordinary type references
+and may be redefined by the specification.
.SH OUTPUT OPTIONS
.TP
.B \-print-constraints
diff --git a/asn1c/asn1c.c b/asn1c/asn1c.c
index ad0cab43..98a607aa 100644
--- a/asn1c/asn1c.c
+++ b/asn1c/asn1c.c
@@ -313,7 +313,7 @@ usage(const char *av0) {
" -fnative-types Use \"int\" instead of INTEGER_t whenever possible\n"
" -fno-constraints Do not generate constraint checking code\n"
" -funnamed-unions Enable unnamed unions in structures\n"
-" -ftypes88 Use only ASN.1:1988 embedded types\n"
+" -ftypes88 Pretend to support only ASN.1:1988 embedded types\n"
"\n"
" -print-constraints Explain subtype constraints (debug)\n"
diff --git a/asn1c/unber.c b/asn1c/unber.c
index bb52690f..2ed9565c 100644
--- a/asn1c/unber.c
+++ b/asn1c/unber.c
@@ -301,11 +301,17 @@ static pd_code_e process_deeper(const char *fname, FILE *fp, int level, ssize_t
* This is a constructed type. Process recursively.
*/
printf(">\n"); /* Close the opening tag */
+ if(tlv_len != -1 && limit != -1) {
+ assert(limit >= tlv_len);
+ }
pdc = process_deeper(fname, fp, level + 1,
tlv_len == -1 ? limit : tlv_len,
&dec, tlv_len == -1);
if(pdc == PD_FAILED) return pdc;
- if(limit != -1) limit -= dec;
+ if(limit != -1) {
+ assert(limit >= dec);
+ limit -= dec;
+ }
*decoded += dec;
if(tlv_len == -1) {
tblen = 0;
@@ -316,7 +322,10 @@ static pd_code_e process_deeper(const char *fname, FILE *fp, int level, ssize_t
if(print_V(fname, fp, tlv_tag, tlv_len))
return PD_FAILED;
- limit -= tlv_len;
+ if(limit != -1) {
+ assert(limit >= tlv_len);
+ limit -= tlv_len;
+ }
*decoded += tlv_len;
}