Software: Apache/2.0.54 (Fedora). PHP/5.0.4 uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 uid=48(apache) gid=48(apache) groups=48(apache) Safe-mode: OFF (not secure) /usr/share/gtk-doc/html/glib/ drwxr-xr-x |
Viewing file: Select action/file-type:
Synopsis#include <glib.h> GByteArray; GByteArray* g_byte_array_new (void); GByteArray* g_byte_array_sized_new (guint reserved_size); GByteArray* g_byte_array_append (GByteArray *array, const guint8 *data, guint len); GByteArray* g_byte_array_prepend (GByteArray *array, const guint8 *data, guint len); GByteArray* g_byte_array_remove_index (GByteArray *array, guint index_); GByteArray* g_byte_array_remove_index_fast (GByteArray *array, guint index_); GByteArray* g_byte_array_remove_range (GByteArray *array, guint index_, guint length); void g_byte_array_sort (GByteArray *array, GCompareFunc compare_func); void g_byte_array_sort_with_data (GByteArray *array, GCompareDataFunc compare_func, gpointer user_data); GByteArray* g_byte_array_set_size (GByteArray *array, guint length); guint8* g_byte_array_free (GByteArray *array, gboolean free_segment); DescriptionGByteArray is based on GArray, to provide arrays of bytes which grow automatically as elements are added.
To create a new GByteArray use
To add elements to a GByteArray, use
To set the size of a GByteArray, use
To free a GByteArray, use Example 6. Using a GByteArray GByteArray *gbarray; gint i; gbarray = g_byte_array_new (); for (i = 0; i < 10000; i++) g_byte_array_append (gbarray, (guint8*) "abcd", 4); for (i = 0; i < 10000; i++) { g_assert (gbarray->data[4*i] == 'a'); g_assert (gbarray->data[4*i+1] == 'b'); g_assert (gbarray->data[4*i+2] == 'c'); g_assert (gbarray->data[4*i+3] == 'd'); } g_byte_array_free (gbarray, TRUE); DetailsGByteArraytypedef struct { guint8 *data; guint len; } GByteArray; The GByteArray struct allows access to the public fields of a GByteArray.
g_byte_array_new ()GByteArray* g_byte_array_new (void); Creates a new GByteArray.
g_byte_array_sized_new ()GByteArray* g_byte_array_sized_new (guint reserved_size);
Creates a new GByteArray with
g_byte_array_append ()GByteArray* g_byte_array_append (GByteArray *array, const guint8 *data, guint len); Adds the given bytes to the end of the GByteArray. The array will grow in size automatically if necessary.
g_byte_array_prepend ()GByteArray* g_byte_array_prepend (GByteArray *array, const guint8 *data, guint len); Adds the given data to the start of the GByteArray. The array will grow in size automatically if necessary.
g_byte_array_remove_index ()GByteArray* g_byte_array_remove_index (GByteArray *array, guint index_); Removes the byte at the given index from a GByteArray. The following bytes are moved down one place.
g_byte_array_remove_index_fast ()GByteArray* g_byte_array_remove_index_fast (GByteArray *array, guint index_);
Removes the byte at the given index from a GByteArray.
The last element in the array is used to fill in the space, so this function
does not preserve the order of the GByteArray. But it is faster than
g_byte_array_remove_range ()GByteArray* g_byte_array_remove_range (GByteArray *array, guint index_, guint length); Removes the given number of bytes starting at the given index from a GByteArray. The following elements are moved to close the gap.
Since 2.4 g_byte_array_sort ()void g_byte_array_sort (GByteArray *array, GCompareFunc compare_func);
Sorts a byte array, using
g_byte_array_sort_with_data ()void g_byte_array_sort_with_data (GByteArray *array, GCompareDataFunc compare_func, gpointer user_data);
Like
g_byte_array_set_size ()GByteArray* g_byte_array_set_size (GByteArray *array, guint length); Sets the size of the GByteArray, expanding it if necessary.
g_byte_array_free ()guint8* g_byte_array_free (GByteArray *array, gboolean free_segment);
Frees the memory allocated by the GByteArray.
If
|
:: Command execute :: | |
--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0036 ]-- |