Back to index

im-sdk  12.3.91
Functions
comp-binaryfile-object.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_binaryfile_objectiiimp_binaryfile_object_new (IIIMP_data_s *data_s, IIIMP_string *object)
void iiimp_binaryfile_object_delete (IIIMP_data_s *data_s, IIIMP_binaryfile_object *bin_obj)
void iiimp_binaryfile_object_pack (IIIMP_data_s *data_s, IIIMP_binaryfile_object *m, size_t *nbyte, uchar_t **ptr)
IIIMP_binaryfile_objectiiimp_binaryfile_object_unpack (IIIMP_data_s *data_s, size_t *nbyte, const uchar_t **ptr, size_t nbyte_max)
void iiimp_binaryfile_object_print (IIIMP_data_s *data_s, IIIMP_binaryfile_object *m)

Function Documentation

void iiimp_binaryfile_object_delete ( IIIMP_data_s *  data_s,
IIIMP_binaryfile_object bin_obj 
)

Definition at line 37 of file comp-binaryfile-object.c.

{
    if (NULL == bin_obj) return;
    iiimp_string_delete(data_s, bin_obj->object);
    free(bin_obj);
    return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

IIIMP_binaryfile_object* iiimp_binaryfile_object_new ( IIIMP_data_s *  data_s,
IIIMP_string object 
)

Definition at line 12 of file comp-binaryfile-object.c.

{
    IIIMP_binaryfile_object *      bin_obj;

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

    bin_obj->object = object;
    if (NULL == object) {
       bin_obj->nbyte = 4;
    } else {
       bin_obj->nbyte = object->nbyte;
    }

       return bin_obj;
}

Here is the caller graph for this function:

void iiimp_binaryfile_object_pack ( IIIMP_data_s *  data_s,
IIIMP_binaryfile_object m,
size_t *  nbyte,
uchar_t **  ptr 
)

Definition at line 49 of file comp-binaryfile-object.c.

{
    size_t                  rest;
    uchar_t *               p;

    rest = *nbyte;
    p = *ptr;

    iiimp_string_pack(data_s, m->object, &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_binaryfile_object_print ( IIIMP_data_s *  data_s,
IIIMP_binaryfile_object m 
)

Definition at line 110 of file comp-binaryfile-object.c.

{
    if (NULL == m) return;

    iiimp_string_print(data_s, m->object);
}

Here is the call graph for this function:

Here is the caller graph for this function:

IIIMP_binaryfile_object* iiimp_binaryfile_object_unpack ( IIIMP_data_s *  data_s,
size_t *  nbyte,
const uchar_t **  ptr,
size_t  nbyte_max 
)

Definition at line 71 of file comp-binaryfile-object.c.

{
    IIIMP_binaryfile_object *      bin_obj;
    size_t                  rest;
    const uchar_t *         p;

    rest = nbyte_max;
    p = *ptr;

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

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

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

    *nbyte = rest;
    *ptr = p;

    return bin_obj;
}

Here is the call graph for this function:

Here is the caller graph for this function: