Main Page   Compound List   File List   Compound Members   File Members   Related Pages  

util.c File Reference

Some utility functions. More...

#include "util.h"
#include "zlib/SysZLib.h"

Include dependency graph for util.c:

Include dependency graph

Go to the source code of this file.

Functions

MemPtr get_object_ptr (FormPtr form, UInt16 object_id)
 Get a pointer to an object from its id. More...

Err setup_zlib ()
 Get ZLib ready. More...

Err teardown_zlib ()
 Tell the system we're finished with ZLib. More...

Err inflate_string_ref (Char *zstring, UInt32 zstring_len, Char *string, UInt32 string_len, Boolean local)
 Inflates a compressed string. More...


Detailed Description

Some utility functions.

Definition in file util.c.


Function Documentation

MemPtr get_object_ptr FormPtr    form,
UInt16    object_id
 

Get a pointer to an object from its id.

Parameters:
form  Pointer to the form for this object, or NULL to use the current form.
object_id  ID of the object to get a pointer to.
Returns:
Pointer to the object specified by object_id.

Definition at line 18 of file util.c.

Referenced by display_init(), display_update_scrollbar(), key_init(), list_cat_init(), list_init(), list_update_scrollbar(), prefs_init(), and prefs_save().

Err inflate_string_ref Char *    zstring,
UInt32    zstring_len,
Char *    string,
UInt32    string_len,
Boolean    local
 

Inflates a compressed string.

This function allocates memory for the deflated string and it is the caller's responsibility to free it later.

Parameters:
zstring  the compressed data
zstring_len  the length of the compressed data
string  the uncompressed data
string_len  the length of the uncompressed data (to be passed by the caller)
local  true to use a non-global ZLib ref.
The local parameter is needed so that this can be called from the global find function.

Todo:
add some error checking!

Definition at line 86 of file util.c.

Referenced by get_key_details_db(), and get_record_details_db().

Err setup_zlib  
 

Get ZLib ready.

Returns:
errNone if no error; otherwise: sysErrLibNotFound, sysErrNoFreeRAM, sysErrNoFreeLibSlots, or other error returned from the ZLib's install entry point.

Definition at line 30 of file util.c.

Referenced by start_application().

Err teardown_zlib  
 

Tell the system we're finished with ZLib.

Returns:
errNone if no error; otherwise: sysErrParamErr if an invalid reference is passed to SysLibRemove.

Definition at line 53 of file util.c.

Referenced by stop_application().