Back to index

im-sdk  12.3.91
Functions
comp-ccdef.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <iiimp-data.h>
#include "iiimp-dataP.h"

Go to the source code of this file.

Functions

IIIMP_ccdefiiimp_ccdef_new (IIIMP_data_s *data_s, IIIMP_string *contents)
void iiimp_ccdef_delete (IIIMP_data_s *data_s, IIIMP_ccdef *ccdef)
void iiimp_ccdef_pack (IIIMP_data_s *data_s, IIIMP_ccdef *m, size_t *nbyte, uchar_t **ptr)
IIIMP_ccdefiiimp_ccdef_unpack (IIIMP_data_s *data_s, size_t *nbyte, const uchar_t **ptr, size_t nbyte_max)
void iiimp_ccdef_print (IIIMP_data_s *data_s, IIIMP_ccdef *m)

Function Documentation

void iiimp_ccdef_delete ( IIIMP_data_s *  data_s,
IIIMP_ccdef ccdef 
)

Definition at line 37 of file comp-ccdef.c.

{
    if (NULL == ccdef) return;
    iiimp_string_delete(data_s, ccdef->contents);
    free(ccdef);
    return;

}

Here is the call graph for this function:

Here is the caller graph for this function:

IIIMP_ccdef* iiimp_ccdef_new ( IIIMP_data_s *  data_s,
IIIMP_string contents 
)

Definition at line 12 of file comp-ccdef.c.

{
    IIIMP_ccdef *    ccdef;

    ccdef = (IIIMP_ccdef *)malloc(sizeof (IIIMP_ccdef));
    if (NULL == ccdef) {
       data_s->status = IIIMP_DATA_MALLOC_ERROR;
       return NULL;
    }

    if (NULL == contents) {
       ccdef->nbyte = 4;
    } else {
       ccdef->nbyte = contents->nbyte;
    }

    ccdef->contents = contents;

    return ccdef;
}

Here is the caller graph for this function:

void iiimp_ccdef_pack ( IIIMP_data_s *  data_s,
IIIMP_ccdef m,
size_t *  nbyte,
uchar_t **  ptr 
)

Definition at line 48 of file comp-ccdef.c.

{
    size_t           rest;
    uchar_t *        p;

    rest = *nbyte;
    p = *ptr;

    iiimp_string_pack(data_s, m->contents, &rest, &p);

    *nbyte = rest;
    *ptr = p;

    return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void iiimp_ccdef_print ( IIIMP_data_s *  data_s,
IIIMP_ccdef m 
)

Definition at line 108 of file comp-ccdef.c.

{
    if (NULL == m) return;

    iiimp_string_print(data_s, m->contents);
}

Here is the call graph for this function:

IIIMP_ccdef* iiimp_ccdef_unpack ( IIIMP_data_s *  data_s,
size_t *  nbyte,
const uchar_t **  ptr,
size_t  nbyte_max 
)

Definition at line 70 of file comp-ccdef.c.

{
    IIIMP_ccdef *    ccdef;
    size_t           rest;
    const uchar_t *  p;

    rest = nbyte_max;
    p = *ptr;

    if ((*nbyte < rest) || (rest < (4 + 4 + 4 + 4))) {
       data_s->status = IIIMP_DATA_INVALID;
       return NULL;
    }

    ccdef = (IIIMP_ccdef *)malloc(sizeof (IIIMP_ccdef));
    if (NULL == ccdef) {
       data_s->status = IIIMP_DATA_MALLOC_ERROR;
       return NULL;
    }

    ccdef->contents = iiimp_string_unpack(data_s, &rest, &p, rest);
    if (NULL == ccdef->contents) {
       free(ccdef);
       return NULL;
    }

    *nbyte = rest;
    *ptr = p;

    return ccdef;
}

Here is the call graph for this function:

Here is the caller graph for this function: