- }
- else
- {
- o->error = OOTHER;
- return 0;
- }
- }
- else if (o->bp - o->stack[o->stackp].base !=
- o->stack[o->stackp].len)
- {
- o->error = OOTHER;
- return 0;
- }
- o->stackp--;
- return 1;
- case ODR_ENCODE:
- if ((res = ber_enclen(o->stack[o->stackp].lenb,
- o->bp - o->stack[o->stackp].base,
- o->stack[o->stackp].lenlen, 1)) < 0)
- {
- o->error = OSPACE;
- return 0;
- }
- if (res == 0) /* indefinite encoding */
- {
- *(o->bp++) = *(o->bp++) = 0;
- o->left--;
- }
- o->stackp--;
- return 1;
- case ODR_PRINT: return 1;
- default:
- o->error = OOTHER;
- return 0;
+ }
+ else
+ {
+ o->error = OOTHER;
+ return 0;
+ }
+ }
+ else if (o->bp - o->op->stack[o->op->stackp].base !=
+ o->op->stack[o->op->stackp].len)
+ {
+ o->error = OCONLEN;
+ return 0;
+ }
+ o->op->stackp--;
+ return 1;
+ case ODR_ENCODE:
+ pos = odr_tell(o);
+ odr_seek(o, ODR_S_SET, o->op->stack[o->op->stackp].len_offset);
+ if ((res = ber_enclen(o, pos - o->op->stack[o->op->stackp].base_offset,
+ o->op->stack[o->op->stackp].lenlen, 1)) < 0)
+ {
+ o->error = OLENOV;
+ return 0;
+ }
+ odr_seek(o, ODR_S_END, 0);
+ if (res == 0) /* indefinite encoding */
+ {
+#ifdef ODR_DEBUG
+ fprintf(stderr, "[cons_end(%d): indefinite]", o->op->stackp);
+#endif
+ if (odr_putc(o, 0) < 0 || odr_putc(o, 0) < 0)
+ return 0;
+ }
+#ifdef ODR_DEBUG
+ else
+ {
+ fprintf(stderr, "[cons_end(%d): definite]", o->op->stackp);
+ }
+#endif
+ o->op->stackp--;
+ return 1;
+ case ODR_PRINT:
+ o->op->stackp--;
+ o->indent--;
+ odr_prname(o, 0);
+ fprintf(o->print, "}\n");
+ return 1;
+ default:
+ o->error = OOTHER;
+ return 0;