mirror of https://gerrit.osmocom.org/asn1c
constness
This commit is contained in:
parent
ec4b7af9ef
commit
cf573ec13c
|
@ -0,0 +1,23 @@
|
||||||
|
The return value is returned in a compound structure:
|
||||||
|
\begin{codesample}
|
||||||
|
typedef struct {
|
||||||
|
enum {
|
||||||
|
RC_OK, /* Decoded successfully */
|
||||||
|
RC_WMORE, /* More data expected, call again */
|
||||||
|
RC_FAIL /* Failure to decode data */
|
||||||
|
} code; /* Result code */
|
||||||
|
size_t consumed; /* Number of bytes consumed */
|
||||||
|
} asn_dec_rval_t;
|
||||||
|
\end{codesample}
|
||||||
|
|
||||||
|
The \code{.code} member specifies the decoding outcome.
|
||||||
|
|
||||||
|
\begin{description}[labelindent=\parindent]
|
||||||
|
\item[RC\_OK] Decoded successfully and completely
|
||||||
|
\item[RC\_WMORE] More data expected, call again
|
||||||
|
\item[RC\_FAIL] Failed for good
|
||||||
|
\end{description}
|
||||||
|
|
||||||
|
The \code{.consumed} member specifies the amount of \code{buffer} data
|
||||||
|
that was used during parsing, irrespectively of the \code{.code}.
|
||||||
|
|
|
@ -33,7 +33,8 @@ asn_TYPE_outmost_tag(const asn_TYPE_descriptor_t *type_descriptor,
|
||||||
* Print the target language's structure in human readable form.
|
* Print the target language's structure in human readable form.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
asn_fprint(FILE *stream, asn_TYPE_descriptor_t *td, const void *struct_ptr) {
|
asn_fprint(FILE *stream, const asn_TYPE_descriptor_t *td,
|
||||||
|
const void *struct_ptr) {
|
||||||
if(!stream) stream = stdout;
|
if(!stream) stream = stdout;
|
||||||
if(!td || !struct_ptr) {
|
if(!td || !struct_ptr) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
|
@ -41,12 +42,14 @@ asn_fprint(FILE *stream, asn_TYPE_descriptor_t *td, const void *struct_ptr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Invoke type-specific printer */
|
/* Invoke type-specific printer */
|
||||||
if(td->op->print_struct(td, struct_ptr, 1, _print2fp, stream))
|
if(td->op->print_struct(td, struct_ptr, 1, _print2fp, stream)) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Terminate the output */
|
/* Terminate the output */
|
||||||
if(_print2fp("\n", 1, stream))
|
if(_print2fp("\n", 1, stream)) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return fflush(stream);
|
return fflush(stream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,16 +242,15 @@ typedef struct asn_TYPE_tag2member_s {
|
||||||
} asn_TYPE_tag2member_t;
|
} asn_TYPE_tag2member_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function is a wrapper around (td)->print_struct, which prints out
|
* This function prints out the contents of the target language's structure
|
||||||
* the contents of the target language's structure (struct_ptr) into the
|
* (struct_ptr) into the file pointer (stream) in human readable form.
|
||||||
* file pointer (stream) in human readable form.
|
|
||||||
* RETURN VALUES:
|
* RETURN VALUES:
|
||||||
* 0: The structure is printed.
|
* 0: The structure is printed.
|
||||||
* -1: Problem dumping the structure.
|
* -1: Problem dumping the structure.
|
||||||
* (See also xer_fprint() in xer_encoder.h)
|
* (See also xer_fprint() in xer_encoder.h)
|
||||||
*/
|
*/
|
||||||
int asn_fprint(FILE *stream, /* Destination stream descriptor */
|
int asn_fprint(FILE *stream, /* Destination stream descriptor */
|
||||||
asn_TYPE_descriptor_t *td, /* ASN.1 type descriptor */
|
const asn_TYPE_descriptor_t *td, /* ASN.1 type descriptor */
|
||||||
const void *struct_ptr); /* Structure to be printed */
|
const void *struct_ptr); /* Structure to be printed */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
Loading…
Reference in New Issue