Eet.h | Eet.h | |||
---|---|---|---|---|
#ifndef _EET_H | #ifndef _EET_H | |||
#define _EET_H | #define _EET_H | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <Eina.h> | ||||
#ifdef EAPI | #ifdef EAPI | |||
# undef EAPI | # undef EAPI | |||
#endif | #endif | |||
#ifdef _WIN32 | #ifdef _WIN32 | |||
# ifdef EFL_EET_BUILD | # ifdef EFL_EET_BUILD | |||
# ifdef DLL_EXPORT | # ifdef DLL_EXPORT | |||
# define EAPI __declspec(dllexport) | # define EAPI __declspec(dllexport) | |||
# else | # else | |||
skipping to change at line 60 | skipping to change at line 61 | |||
#define EET_T_INT 3 /**< Data type: int */ | #define EET_T_INT 3 /**< Data type: int */ | |||
#define EET_T_LONG_LONG 4 /**< Data type: long long */ | #define EET_T_LONG_LONG 4 /**< Data type: long long */ | |||
#define EET_T_FLOAT 5 /**< Data type: float */ | #define EET_T_FLOAT 5 /**< Data type: float */ | |||
#define EET_T_DOUBLE 6 /**< Data type: double */ | #define EET_T_DOUBLE 6 /**< Data type: double */ | |||
#define EET_T_UCHAR 7 /**< Data type: unsigned char */ | #define EET_T_UCHAR 7 /**< Data type: unsigned char */ | |||
#define EET_T_USHORT 8 /**< Data type: unsigned short */ | #define EET_T_USHORT 8 /**< Data type: unsigned short */ | |||
#define EET_T_UINT 9 /**< Data type: unsigned int */ | #define EET_T_UINT 9 /**< Data type: unsigned int */ | |||
#define EET_T_ULONG_LONG 10 /**< Data type: unsigned long long */ | #define EET_T_ULONG_LONG 10 /**< Data type: unsigned long long */ | |||
#define EET_T_STRING 11 /**< Data type: char * */ | #define EET_T_STRING 11 /**< Data type: char * */ | |||
#define EET_T_INLINED_STRING 12 /**< Data type: char * (but compressed i nside the resulting eet) */ | #define EET_T_INLINED_STRING 12 /**< Data type: char * (but compressed i nside the resulting eet) */ | |||
#define EET_T_LAST 13 /**< Last data type */ | #define EET_T_NULL 13 /**< Data type: (void *) (only use it if | |||
you know why) */ | ||||
#define EET_T_LAST 14 /**< Last data type */ | ||||
#define EET_G_UNKNOWN 100 /**< Unknown group data encoding type */ | #define EET_G_UNKNOWN 100 /**< Unknown group data encoding type */ | |||
#define EET_G_ARRAY 101 /**< Fixed size array group type */ | #define EET_G_ARRAY 101 /**< Fixed size array group type */ | |||
#define EET_G_VAR_ARRAY 102 /**< Variable size array group type */ | #define EET_G_VAR_ARRAY 102 /**< Variable size array group type */ | |||
#define EET_G_LIST 103 /**< Linked list group type */ | #define EET_G_LIST 103 /**< Linked list group type */ | |||
#define EET_G_HASH 104 /**< Hash table group type */ | #define EET_G_HASH 104 /**< Hash table group type */ | |||
#define EET_G_LAST 105 /**< Last group type */ | #define EET_G_LAST 105 /**< Last group type */ | |||
/************************************************************************** */ | /************************************************************************** */ | |||
skipping to change at line 96 | skipping to change at line 98 | |||
EET_ERROR_WRITE_ERROR, | EET_ERROR_WRITE_ERROR, | |||
EET_ERROR_WRITE_ERROR_FILE_TOO_BIG, | EET_ERROR_WRITE_ERROR_FILE_TOO_BIG, | |||
EET_ERROR_WRITE_ERROR_IO_ERROR, | EET_ERROR_WRITE_ERROR_IO_ERROR, | |||
EET_ERROR_WRITE_ERROR_OUT_OF_SPACE, | EET_ERROR_WRITE_ERROR_OUT_OF_SPACE, | |||
EET_ERROR_WRITE_ERROR_FILE_CLOSED, | EET_ERROR_WRITE_ERROR_FILE_CLOSED, | |||
EET_ERROR_MMAP_FAILED, | EET_ERROR_MMAP_FAILED, | |||
EET_ERROR_X509_ENCODING_FAILED, | EET_ERROR_X509_ENCODING_FAILED, | |||
EET_ERROR_SIGNATURE_FAILED, | EET_ERROR_SIGNATURE_FAILED, | |||
EET_ERROR_INVALID_SIGNATURE, | EET_ERROR_INVALID_SIGNATURE, | |||
EET_ERROR_NOT_SIGNED, | EET_ERROR_NOT_SIGNED, | |||
EET_ERROR_NOT_IMPLEMENTED | EET_ERROR_NOT_IMPLEMENTED, | |||
EET_ERROR_PRNG_NOT_SEEDED, | ||||
EET_ERROR_ENCRYPT_FAILED, | ||||
EET_ERROR_DECRYPT_FAILED | ||||
} Eet_Error; | } Eet_Error; | |||
typedef struct _Eet_File Eet_File; | typedef struct _Eet_File Eet_File; | |||
typedef struct _Eet_Dictionary Eet_Dictionary; | typedef struct _Eet_Dictionary Eet_Dictionary; | |||
typedef struct _Eet_Data_Descriptor Eet_Data_Descriptor; | typedef struct _Eet_Data_Descriptor Eet_Data_Descriptor; | |||
typedef struct _Eet_Key Eet_Key; | typedef struct _Eet_Key Eet_Key; | |||
typedef struct _Eet_Node Eet_Node; | ||||
typedef struct _Eet_Data_Descriptor_Class Eet_Data_Descriptor_Class; | typedef struct _Eet_Data_Descriptor_Class Eet_Data_Descriptor_Class; | |||
#define EET_DATA_DESCRIPTOR_CLASS_VERSION 2 | #define EET_DATA_DESCRIPTOR_CLASS_VERSION 2 | |||
struct _Eet_Data_Descriptor_Class | struct _Eet_Data_Descriptor_Class | |||
{ | { | |||
int version; | int version; | |||
const char *name; | const char *name; | |||
int size; | int size; | |||
struct { | struct { | |||
skipping to change at line 306 | skipping to change at line 312 | |||
EAPI void eet_identity_print(Eet_Key *key, FILE *out); | EAPI void eet_identity_print(Eet_Key *key, FILE *out); | |||
/** | /** | |||
* Get the x509 der certificate associated with an Eet_File. Will retur n NULL | * Get the x509 der certificate associated with an Eet_File. Will retur n NULL | |||
* if the file is not signed. | * if the file is not signed. | |||
* | * | |||
* @since 2.0.0 | * @since 2.0.0 | |||
*/ | */ | |||
EAPI const void *eet_identity_x509(Eet_File *ef, int *der_length); | EAPI const void *eet_identity_x509(Eet_File *ef, int *der_length); | |||
/** | ||||
* Get the raw signature associated with an Eet_File. Will return NULL | ||||
* if the file is not signed. | ||||
*/ | ||||
EAPI const void *eet_identity_signature(Eet_File *ef, int *signature_len | ||||
gth); | ||||
/** | ||||
* Get the SHA1 associated with a file. Could be the one used to sign t | ||||
he data | ||||
* or if the data where not signed, it will be the SHA1 of the file. | ||||
* | ||||
* @since 2.0.0 | ||||
*/ | ||||
EAPI const void *eet_identity_sha1(Eet_File *ef, int *sha1_length); | ||||
/** | /** | |||
* Display the x509 der certificate to out. | * Display the x509 der certificate to out. | |||
* | * | |||
* @since 2.0.0 | * @since 2.0.0 | |||
*/ | */ | |||
EAPI void eet_identity_certificate_print(const unsigned char *certificat e, int der_length, FILE *out); | EAPI void eet_identity_certificate_print(const unsigned char *certificat e, int der_length, FILE *out); | |||
/** | /** | |||
* Return a handle to the shared string dictionary of the Eet file | * Return a handle to the shared string dictionary of the Eet file | |||
* @param ef A valid eet file handle. | * @param ef A valid eet file handle. | |||
skipping to change at line 360 | skipping to change at line 380 | |||
* NULL is returned if the lookup fails or if memory errors are | * NULL is returned if the lookup fails or if memory errors are | |||
* encountered. It is the job of the calling program to call free() on | * encountered. It is the job of the calling program to call free() on | |||
* the returned data. The number of bytes in the returned data chunk are | * the returned data. The number of bytes in the returned data chunk are | |||
* placed in size_ret. | * placed in size_ret. | |||
* | * | |||
* If the eet file handle is not valid NULL is returned and size_ret is | * If the eet file handle is not valid NULL is returned and size_ret is | |||
* filled with 0. | * filled with 0. | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI void *eet_read_cipher(Eet_File *ef, const char *name, int *size_ret , const char *cipher_key); | ||||
EAPI void *eet_read(Eet_File *ef, const char *name, int *size_ret); | EAPI void *eet_read(Eet_File *ef, const char *name, int *size_ret); | |||
/** | /** | |||
* Read a specified entry from an eet file and return data | * Read a specified entry from an eet file and return data | |||
* @param ef A valid eet file handle opened for reading. | * @param ef A valid eet file handle opened for reading. | |||
* @param name Name of the entry. eg: "/base/file_i_want". | * @param name Name of the entry. eg: "/base/file_i_want". | |||
* @param size_ret Number of bytes read from entry and returned. | * @param size_ret Number of bytes read from entry and returned. | |||
* @return The data stored in that entry in the eet file. | * @return The data stored in that entry in the eet file. | |||
* | * | |||
* This function finds an entry in the eet file that is stored under the | * This function finds an entry in the eet file that is stored under the | |||
skipping to change at line 408 | skipping to change at line 429 | |||
* | * | |||
* Name, and data must not be NULL, and size must be > 0. If these | * Name, and data must not be NULL, and size must be > 0. If these | |||
* conditions are not met, 0 will be returned. | * conditions are not met, 0 will be returned. | |||
* | * | |||
* The data will be copied (and optionally compressed) in ram, pending | * The data will be copied (and optionally compressed) in ram, pending | |||
* a flush to disk (it will stay in ram till the eet file handle is | * a flush to disk (it will stay in ram till the eet file handle is | |||
* closed though). | * closed though). | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI int eet_write_cipher(Eet_File *ef, const char *name, const void *da ta, int size, int compress, const char *cipher_key); | ||||
EAPI int eet_write(Eet_File *ef, const char *name, const void *data, int size, int compress); | EAPI int eet_write(Eet_File *ef, const char *name, const void *data, int size, int compress); | |||
/** | /** | |||
* Delete a specified entry from an Eet file being written or re-written | * Delete a specified entry from an Eet file being written or re-written | |||
* @param ef A valid eet file handle opened for writing. | * @param ef A valid eet file handle opened for writing. | |||
* @param name Name of the entry. eg: "/base/file_i_want". | * @param name Name of the entry. eg: "/base/file_i_want". | |||
* @return Success or failure of the delete. | * @return Success or failure of the delete. | |||
* | * | |||
* This function will delete the specified chunk of data from the eet fi le | * This function will delete the specified chunk of data from the eet fi le | |||
* and return greater than 0 on success. 0 will be returned on failure. | * and return greater than 0 on success. 0 will be returned on failure. | |||
skipping to change at line 505 | skipping to change at line 527 | |||
* Compress is filled with the compression value/amount the image was | * Compress is filled with the compression value/amount the image was | |||
* stored with. The quality value is filled with the quality encoding of | * stored with. The quality value is filled with the quality encoding of | |||
* the image file (0 - 100). The lossy flags is either 0 or 1 as to if | * the image file (0 - 100). The lossy flags is either 0 or 1 as to if | |||
* the image was encoded lossily or not. | * the image was encoded lossily or not. | |||
* | * | |||
* On success the function returns 1 indicating the header was read and | * On success the function returns 1 indicating the header was read and | |||
* decoded properly, or 0 on failure. | * decoded properly, or 0 on failure. | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI int eet_data_image_header_read_cipher(Eet_File *ef, const char *nam e, const char *key, unsigned int *w, unsigned int *h, int *alpha, int *comp ress, int *quality, int *lossy); | ||||
EAPI int eet_data_image_header_read(Eet_File *ef, const char *name, unsi gned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy); | EAPI int eet_data_image_header_read(Eet_File *ef, const char *name, unsi gned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy); | |||
/** | /** | |||
* Read image data from the named key in the eet file. | * Read image data from the named key in the eet file. | |||
* @param ef A valid eet file handle opened for reading. | * @param ef A valid eet file handle opened for reading. | |||
* @param name Name of the entry. eg: "/base/file_i_want". | * @param name Name of the entry. eg: "/base/file_i_want". | |||
* @param w A pointer to the unsigned int to hold the width in pixels. | * @param w A pointer to the unsigned int to hold the width in pixels. | |||
* @param h A pointer to the unsigned int to hold the height in pixels. | * @param h A pointer to the unsigned int to hold the height in pixels. | |||
* @param alpha A pointer to the int to hold the alpha flag. | * @param alpha A pointer to the int to hold the alpha flag. | |||
* @param compress A pointer to the int to hold the compression amount. | * @param compress A pointer to the int to hold the compression amount. | |||
skipping to change at line 542 | skipping to change at line 565 | |||
* the image file (0 - 100). The lossy flags is either 0 or 1 as to if | * the image file (0 - 100). The lossy flags is either 0 or 1 as to if | |||
* the image was encoded lossily or not. | * the image was encoded lossily or not. | |||
* | * | |||
* On success the function returns a pointer to the image data decoded. The | * On success the function returns a pointer to the image data decoded. The | |||
* calling application is responsible for calling free() on the image da ta | * calling application is responsible for calling free() on the image da ta | |||
* when it is done with it. On failure NULL is returned and the paramete r | * when it is done with it. On failure NULL is returned and the paramete r | |||
* values may not contain any sensible data. | * values may not contain any sensible data. | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI void *eet_data_image_read_cipher(Eet_File *ef, const char *name, co nst char *key, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy); | ||||
EAPI void *eet_data_image_read(Eet_File *ef, const char *name, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *loss y); | EAPI void *eet_data_image_read(Eet_File *ef, const char *name, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *loss y); | |||
/** | /** | |||
* Read image data from the named key in the eet file. | * Read image data from the named key in the eet file. | |||
* @param ef A valid eet file handle opened for reading. | * @param ef A valid eet file handle opened for reading. | |||
* @param name Name of the entry. eg: "/base/file_i_want". | * @param name Name of the entry. eg: "/base/file_i_want". | |||
* @param src_x The starting x coordinate from where to dump the stream. | * @param src_x The starting x coordinate from where to dump the stream. | |||
* @param src_y The starting y coordinate from where to dump the stream. | * @param src_y The starting y coordinate from where to dump the stream. | |||
* @param d A pointer to the pixel surface. | * @param d A pointer to the pixel surface. | |||
* @param w The expected width in pixels of the pixel surface to decode. | * @param w The expected width in pixels of the pixel surface to decode. | |||
skipping to change at line 581 | skipping to change at line 605 | |||
* Compress is filled with the compression value/amount the image was | * Compress is filled with the compression value/amount the image was | |||
* stored with. The quality value is filled with the quality encoding of | * stored with. The quality value is filled with the quality encoding of | |||
* the image file (0 - 100). The lossy flags is either 0 or 1 as to if | * the image file (0 - 100). The lossy flags is either 0 or 1 as to if | |||
* the image was encoded lossily or not. | * the image was encoded lossily or not. | |||
* | * | |||
* On success the function returns 1, and 0 on failure. On failure the | * On success the function returns 1, and 0 on failure. On failure the | |||
* parameter values may not contain any sensible data. | * parameter values may not contain any sensible data. | |||
* | * | |||
* @since 1.0.2 | * @since 1.0.2 | |||
*/ | */ | |||
EAPI int eet_data_image_read_to_surface(Eet_File *ef, const char *name, u | EAPI int eet_data_image_read_to_surface_cipher(Eet_File *ef, const char | |||
nsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, uns | *name, const char *key, unsigned int src_x, unsigned int src_y, unsigned in | |||
igned int h, unsigned int row_stride, int *alpha, int *compress, int *quali | t *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, | |||
ty, int *lossy); | int *compress, int *quality, int *lossy); | |||
EAPI int eet_data_image_read_to_surface(Eet_File *ef, const char *name, | ||||
unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, un | ||||
signed int h, unsigned int row_stride, int *alpha, int *compress, int *qual | ||||
ity, int *lossy); | ||||
/** | /** | |||
* Write image data to the named key in an eet file. | * Write image data to the named key in an eet file. | |||
* @param ef A valid eet file handle opened for writing. | * @param ef A valid eet file handle opened for writing. | |||
* @param name Name of the entry. eg: "/base/file_i_want". | * @param name Name of the entry. eg: "/base/file_i_want". | |||
* @param data A pointer to the image pixel data. | * @param data A pointer to the image pixel data. | |||
* @param w The width of the image in pixels. | * @param w The width of the image in pixels. | |||
* @param h The height of the image in pixels. | * @param h The height of the image in pixels. | |||
* @param alpha The alpha channel flag. | * @param alpha The alpha channel flag. | |||
* @param compress The compression amount. | * @param compress The compression amount. | |||
skipping to change at line 615 | skipping to change at line 640 | |||
* This is only used if the image is not lossily encoded. Quality is use d on | * This is only used if the image is not lossily encoded. Quality is use d on | |||
* lossy compression and should be a value from 0 to 100. The lossy flag | * lossy compression and should be a value from 0 to 100. The lossy flag | |||
* can be 0 or 1. 0 means encode losslessly and 1 means to encode with | * can be 0 or 1. 0 means encode losslessly and 1 means to encode with | |||
* image quality loss (but then have a much smaller encoding). | * image quality loss (but then have a much smaller encoding). | |||
* | * | |||
* On success this function returns the number of bytes that were requir ed | * On success this function returns the number of bytes that were requir ed | |||
* to encode the image data, or on failure it returns 0. | * to encode the image data, or on failure it returns 0. | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI int eet_data_image_write_cipher(Eet_File *ef, const char *name, con st char *key, const void *data, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy); | ||||
EAPI int eet_data_image_write(Eet_File *ef, const char *name, const void *data, unsigned int w, unsigned int h, int alpha, int compress, int qualit y, int lossy); | EAPI int eet_data_image_write(Eet_File *ef, const char *name, const void *data, unsigned int w, unsigned int h, int alpha, int compress, int qualit y, int lossy); | |||
/** | /** | |||
* Decode Image data header only to get information. | * Decode Image data header only to get information. | |||
* @param data The encoded pixel data. | * @param data The encoded pixel data. | |||
* @param size The size, in bytes, of the encoded pixel data. | * @param size The size, in bytes, of the encoded pixel data. | |||
* @param w A pointer to the unsigned int to hold the width in pixels. | * @param w A pointer to the unsigned int to hold the width in pixels. | |||
* @param h A pointer to the unsigned int to hold the height in pixels. | * @param h A pointer to the unsigned int to hold the height in pixels. | |||
* @param alpha A pointer to the int to hold the alpha flag. | * @param alpha A pointer to the int to hold the alpha flag. | |||
* @param compress A pointer to the int to hold the compression amount. | * @param compress A pointer to the int to hold the compression amount. | |||
skipping to change at line 650 | skipping to change at line 676 | |||
* Compress is filled with the compression value/amount the image was | * Compress is filled with the compression value/amount the image was | |||
* stored with. The quality value is filled with the quality encoding of | * stored with. The quality value is filled with the quality encoding of | |||
* the image file (0 - 100). The lossy flags is either 0 or 1 as to if | * the image file (0 - 100). The lossy flags is either 0 or 1 as to if | |||
* the image was encoded lossily or not. | * the image was encoded lossily or not. | |||
* | * | |||
* On success the function returns 1 indicating the header was read and | * On success the function returns 1 indicating the header was read and | |||
* decoded properly, or 0 on failure. | * decoded properly, or 0 on failure. | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI int eet_data_image_header_decode_cipher(const void *data, const cha r *key, int size, unsigned int *w, unsigned int *h, int *alpha, int *compre ss, int *quality, int *lossy); | ||||
EAPI int eet_data_image_header_decode(const void *data, int size, unsign ed int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *l ossy); | EAPI int eet_data_image_header_decode(const void *data, int size, unsign ed int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *l ossy); | |||
/** | /** | |||
* Decode Image data into pixel data. | * Decode Image data into pixel data. | |||
* @param data The encoded pixel data. | * @param data The encoded pixel data. | |||
* @param size The size, in bytes, of the encoded pixel data. | * @param size The size, in bytes, of the encoded pixel data. | |||
* @param w A pointer to the unsigned int to hold the width in pixels. | * @param w A pointer to the unsigned int to hold the width in pixels. | |||
* @param h A pointer to the unsigned int to hold the height in pixels. | * @param h A pointer to the unsigned int to hold the height in pixels. | |||
* @param alpha A pointer to the int to hold the alpha flag. | * @param alpha A pointer to the int to hold the alpha flag. | |||
* @param compress A pointer to the int to hold the compression amount. | * @param compress A pointer to the int to hold the compression amount. | |||
skipping to change at line 687 | skipping to change at line 714 | |||
* the image file (0 - 100). The lossy flags is either 0 or 1 as to if | * the image file (0 - 100). The lossy flags is either 0 or 1 as to if | |||
* the image was encoded lossily or not. | * the image was encoded lossily or not. | |||
* | * | |||
* On success the function returns a pointer to the image data decoded. The | * On success the function returns a pointer to the image data decoded. The | |||
* calling application is responsible for calling free() on the image da ta | * calling application is responsible for calling free() on the image da ta | |||
* when it is done with it. On failure NULL is returned and the paramete r | * when it is done with it. On failure NULL is returned and the paramete r | |||
* values may not contain any sensible data. | * values may not contain any sensible data. | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI void *eet_data_image_decode_cipher(const void *data, const char *ke y, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, i nt *quality, int *lossy); | ||||
EAPI void *eet_data_image_decode(const void *data, int size, unsigned in t *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy) ; | EAPI void *eet_data_image_decode(const void *data, int size, unsigned in t *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy) ; | |||
/** | /** | |||
* Decode Image data into pixel data. | * Decode Image data into pixel data. | |||
* @param data The encoded pixel data. | * @param data The encoded pixel data. | |||
* @param size The size, in bytes, of the encoded pixel data. | * @param size The size, in bytes, of the encoded pixel data. | |||
* @param src_x The starting x coordinate from where to dump the stream. | * @param src_x The starting x coordinate from where to dump the stream. | |||
* @param src_y The starting y coordinate from where to dump the stream. | * @param src_y The starting y coordinate from where to dump the stream. | |||
* @param d A pointer to the pixel surface. | * @param d A pointer to the pixel surface. | |||
* @param w The expected width in pixels of the pixel surface to decode. | * @param w The expected width in pixels of the pixel surface to decode. | |||
skipping to change at line 726 | skipping to change at line 754 | |||
* Compress is filled with the compression value/amount the image was | * Compress is filled with the compression value/amount the image was | |||
* stored with. The quality value is filled with the quality encoding of | * stored with. The quality value is filled with the quality encoding of | |||
* the image file (0 - 100). The lossy flags is either 0 or 1 as to if | * the image file (0 - 100). The lossy flags is either 0 or 1 as to if | |||
* the image was encoded lossily or not. | * the image was encoded lossily or not. | |||
* | * | |||
* On success the function returns 1, and 0 on failure. On failure the | * On success the function returns 1, and 0 on failure. On failure the | |||
* parameter values may not contain any sensible data. | * parameter values may not contain any sensible data. | |||
* | * | |||
* @since 1.0.2 | * @since 1.0.2 | |||
*/ | */ | |||
EAPI int eet_data_image_decode_to_surface_cipher(const void *data, const char *key, int size, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, in t *compress, int *quality, int *lossy); | ||||
EAPI int eet_data_image_decode_to_surface(const void *data, int size, un signed int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsi gned int h, unsigned int row_stride, int *alpha, int *compress, int *qualit y, int *lossy); | EAPI int eet_data_image_decode_to_surface(const void *data, int size, un signed int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsi gned int h, unsigned int row_stride, int *alpha, int *compress, int *qualit y, int *lossy); | |||
/** | /** | |||
* Encode image data for storage or transmission. | * Encode image data for storage or transmission. | |||
* @param data A pointer to the image pixel data. | * @param data A pointer to the image pixel data. | |||
* @param size_ret A pointer to an int to hold the size of the returned data. | * @param size_ret A pointer to an int to hold the size of the returned data. | |||
* @param w The width of the image in pixels. | * @param w The width of the image in pixels. | |||
* @param h The height of the image in pixels. | * @param h The height of the image in pixels. | |||
* @param alpha The alpha channel flag. | * @param alpha The alpha channel flag. | |||
* @param compress The compression amount. | * @param compress The compression amount. | |||
skipping to change at line 759 | skipping to change at line 788 | |||
* This is only used if the image is not lossily encoded. Quality is use d on | * This is only used if the image is not lossily encoded. Quality is use d on | |||
* lossy compression and should be a value from 0 to 100. The lossy flag | * lossy compression and should be a value from 0 to 100. The lossy flag | |||
* can be 0 or 1. 0 means encode losslessly and 1 means to encode with | * can be 0 or 1. 0 means encode losslessly and 1 means to encode with | |||
* image quality loss (but then have a much smaller encoding). | * image quality loss (but then have a much smaller encoding). | |||
* | * | |||
* On success this function returns a pointer to the encoded data that y ou | * On success this function returns a pointer to the encoded data that y ou | |||
* can free with free() when no longer needed. | * can free with free() when no longer needed. | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI void *eet_data_image_encode_cipher(const void *data, const char *ke y, unsigned int w, unsigned int h, int alpha, int compress, int quality, in t lossy, int *size_ret); | ||||
EAPI void *eet_data_image_encode(const void *data, int *size_ret, unsign ed int w, unsigned int h, int alpha, int compress, int quality, int lossy); | EAPI void *eet_data_image_encode(const void *data, int *size_ret, unsign ed int w, unsigned int h, int alpha, int compress, int quality, int lossy); | |||
/************************************************************************** */ | /************************************************************************** */ | |||
/** | /** | |||
* Create a new empty data structure descriptor. | * Create a new empty data structure descriptor. | |||
* @param name The string name of this data structure (most be a global constant and never change). | * @param name The string name of this data structure (most be a global constant and never change). | |||
* @param size The size of the struct (in bytes). | * @param size The size of the struct (in bytes). | |||
* @param func_list_next The function to get the next list node. | * @param func_list_next The function to get the next list node. | |||
* @param func_list_append The function to append a member to a list. | * @param func_list_append The function to append a member to a list. | |||
skipping to change at line 821 | skipping to change at line 851 | |||
* typedef struct _blah | * typedef struct _blah | |||
* { | * { | |||
* char character; | * char character; | |||
* short sixteen; | * short sixteen; | |||
* int integer; | * int integer; | |||
* long long lots; | * long long lots; | |||
* float floating; | * float floating; | |||
* double floating_lots; | * double floating_lots; | |||
* char *string; | * char *string; | |||
* Blah2 *blah2; | * Blah2 *blah2; | |||
* Evas_List *blah3; | * Eina_List *blah3; | |||
* } | * } | |||
* Blah; | * Blah; | |||
* | * | |||
* Eina_Hash* | ||||
* eet_eina_hash_add(Eina_Hash *hash, const char *key, const void *data) | ||||
* { | ||||
* if (!hash) hash = eina_hash_string_superfast_new(NULL); | ||||
* if (!hash) return NULL; | ||||
* | ||||
* eina_hash_add(hash, key, data); | ||||
* return hash; | ||||
* } | ||||
* | ||||
* int | * int | |||
* main(int argc, char **argv) | * main(int argc, char **argv) | |||
* { | * { | |||
* Blah blah; | * Blah blah; | |||
* Blah2 blah2; | * Blah2 blah2; | |||
* Blah3 blah3; | * Blah3 blah3; | |||
* Eet_Data_Descriptor *edd, *edd2, *edd3; | * Eet_Data_Descriptor *edd, *edd2, *edd3; | |||
* void *data; | * void *data; | |||
* int size; | * int size; | |||
* FILE *f; | * FILE *f; | |||
* Blah *blah_in; | * Blah *blah_in; | |||
* | * | |||
* edd3 = eet_data_descriptor_new("blah3", sizeof(Blah3), | * edd3 = eet_data_descriptor_new("blah3", sizeof(Blah3), | |||
* evas_list_next, | * eina_list_next, | |||
* evas_list_append, | * eina_list_append, | |||
* evas_list_data, | * eina_list_data_get, | |||
* evas_list_free, | * eina_list_free, | |||
* evas_hash_foreach, | * eina_hash_foreach, | |||
* evas_hash_add, | * eet_eina_hash_add, | |||
* evas_hash_free); | * eina_hash_free); | |||
* EET_DATA_DESCRIPTOR_ADD_BASIC(edd3, Blah3, "string3", string, EET_ T_STRING); | * EET_DATA_DESCRIPTOR_ADD_BASIC(edd3, Blah3, "string3", string, EET_ T_STRING); | |||
* | * | |||
* edd2 = eet_data_descriptor_new("blah2", sizeof(Blah2), | * edd2 = eet_data_descriptor_new("blah2", sizeof(Blah2), | |||
* evas_list_next, | * eina_list_next, | |||
* evas_list_append, | * eina_list_append, | |||
* evas_list_data, | * eina_list_data_get, | |||
* evas_list_free, | * eina_list_free, | |||
* evas_hash_foreach, | * eina_hash_foreach, | |||
* evas_hash_add, | * eet_eina_hash_add, | |||
* evas_hash_free); | * eina_hash_free); | |||
* EET_DATA_DESCRIPTOR_ADD_BASIC(edd2, Blah2, "string2", string, EET_ T_STRING); | * EET_DATA_DESCRIPTOR_ADD_BASIC(edd2, Blah2, "string2", string, EET_ T_STRING); | |||
* | * | |||
* edd = eet_data_descriptor_new("blah", sizeof(Blah), | * edd = eet_data_descriptor_new("blah", sizeof(Blah), | |||
* evas_list_next, | * eina_list_next, | |||
* evas_list_append, | * eina_list_append, | |||
* evas_list_data, | * eina_list_data_get, | |||
* evas_list_free, | * eina_list_free, | |||
* evas_hash_foreach, | * eina_hash_foreach, | |||
* evas_hash_add, | * eet_eina_hash_add, | |||
* evas_hash_free); | * eina_hash_free); | |||
* EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "character", character, E ET_T_CHAR); | * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "character", character, E ET_T_CHAR); | |||
* EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "sixteen", sixteen, EET_T _SHORT); | * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "sixteen", sixteen, EET_T _SHORT); | |||
* EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "integer", integer, EET_T _INT); | * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "integer", integer, EET_T _INT); | |||
* EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "lots", lots, EET_T_LONG_ LONG); | * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "lots", lots, EET_T_LONG_ LONG); | |||
* EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "floating", floating, EET _T_FLOAT); | * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "floating", floating, EET _T_FLOAT); | |||
* EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "floating_lots", floating _lots, EET_T_DOUBLE); | * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "floating_lots", floating _lots, EET_T_DOUBLE); | |||
* EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "string", string, EET_T_S TRING); | * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "string", string, EET_T_S TRING); | |||
* EET_DATA_DESCRIPTOR_ADD_SUB(edd, Blah, "blah2", blah2, edd2); | * EET_DATA_DESCRIPTOR_ADD_SUB(edd, Blah, "blah2", blah2, edd2); | |||
* EET_DATA_DESCRIPTOR_ADD_LIST(edd, Blah, "blah3", blah3, edd3); | * EET_DATA_DESCRIPTOR_ADD_LIST(edd, Blah, "blah3", blah3, edd3); | |||
* | * | |||
skipping to change at line 887 | skipping to change at line 927 | |||
* blah2.string="subtype string here!"; | * blah2.string="subtype string here!"; | |||
* | * | |||
* blah.character='7'; | * blah.character='7'; | |||
* blah.sixteen=0x7777; | * blah.sixteen=0x7777; | |||
* blah.integer=0xc0def00d; | * blah.integer=0xc0def00d; | |||
* blah.lots=0xdeadbeef31337777; | * blah.lots=0xdeadbeef31337777; | |||
* blah.floating=3.141592654; | * blah.floating=3.141592654; | |||
* blah.floating_lots=0.777777777777777; | * blah.floating_lots=0.777777777777777; | |||
* blah.string="bite me like a turnip"; | * blah.string="bite me like a turnip"; | |||
* blah.blah2 = &blah2; | * blah.blah2 = &blah2; | |||
* blah.blah3 = evas_list_append(NULL, &blah3); | * blah.blah3 = eina_list_append(NULL, &blah3); | |||
* blah.blah3 = evas_list_append(blah.blah3, &blah3); | * blah.blah3 = eina_list_append(blah.blah3, &blah3); | |||
* blah.blah3 = evas_list_append(blah.blah3, &blah3); | * blah.blah3 = eina_list_append(blah.blah3, &blah3); | |||
* blah.blah3 = evas_list_append(blah.blah3, &blah3); | * blah.blah3 = eina_list_append(blah.blah3, &blah3); | |||
* blah.blah3 = evas_list_append(blah.blah3, &blah3); | * blah.blah3 = eina_list_append(blah.blah3, &blah3); | |||
* blah.blah3 = evas_list_append(blah.blah3, &blah3); | * blah.blah3 = eina_list_append(blah.blah3, &blah3); | |||
* blah.blah3 = evas_list_append(blah.blah3, &blah3); | * blah.blah3 = eina_list_append(blah.blah3, &blah3); | |||
* | * | |||
* data = eet_data_descriptor_encode(edd, &blah, &size); | * data = eet_data_descriptor_encode(edd, &blah, &size); | |||
* printf("-----DECODING\n"); | * printf("-----DECODING\n"); | |||
* blah_in = eet_data_descriptor_decode(edd, data, size); | * blah_in = eet_data_descriptor_decode(edd, data, size); | |||
* | * | |||
* printf("-----DECODED!\n"); | * printf("-----DECODED!\n"); | |||
* printf("%c\n", blah_in->character); | * printf("%c\n", blah_in->character); | |||
* printf("%x\n", (int)blah_in->sixteen); | * printf("%x\n", (int)blah_in->sixteen); | |||
* printf("%x\n", blah_in->integer); | * printf("%x\n", blah_in->integer); | |||
* printf("%lx\n", blah_in->lots); | * printf("%lx\n", blah_in->lots); | |||
* printf("%f\n", (double)blah_in->floating); | * printf("%f\n", (double)blah_in->floating); | |||
* printf("%f\n", (double)blah_in->floating_lots); | * printf("%f\n", (double)blah_in->floating_lots); | |||
* printf("%s\n", blah_in->string); | * printf("%s\n", blah_in->string); | |||
* printf("%p\n", blah_in->blah2); | * printf("%p\n", blah_in->blah2); | |||
* printf(" %s\n", blah_in->blah2->string); | * printf(" %s\n", blah_in->blah2->string); | |||
* { | * { | |||
* Evas_List *l; | * Eina_List *l; | |||
* Blah3 *blah3_in; | ||||
* | * | |||
* for (l = blah_in->blah3; l; l = l->next) | * EINA_LIST_FOREACH(blah_in->blah3, l, blah3_in) | |||
* { | * { | |||
* Blah3 *blah3_in; | ||||
* | ||||
* blah3_in = l->data; | ||||
* printf("%p\n", blah3_in); | * printf("%p\n", blah3_in); | |||
* printf(" %s\n", blah3_in->string); | * printf(" %s\n", blah3_in->string); | |||
* } | * } | |||
* } | * } | |||
* eet_data_descriptor_free(edd); | * eet_data_descriptor_free(edd); | |||
* eet_data_descriptor_free(edd2); | * eet_data_descriptor_free(edd2); | |||
* eet_data_descriptor_free(edd3); | * eet_data_descriptor_free(edd3); | |||
* | * | |||
* return 0; | * return 0; | |||
* } | * } | |||
skipping to change at line 990 | skipping to change at line 1028 | |||
* in the data. It checks sizes and headers whenever it reads data, allo wing | * in the data. It checks sizes and headers whenever it reads data, allo wing | |||
* the programmer to not worry about corrupt data. | * the programmer to not worry about corrupt data. | |||
* | * | |||
* Once a data structure has been described by the programmer with the | * Once a data structure has been described by the programmer with the | |||
* fields they wish to save or load, storing or retrieving a data struct ure | * fields they wish to save or load, storing or retrieving a data struct ure | |||
* from an eet file, or from a chunk of memory is as simple as a single | * from an eet file, or from a chunk of memory is as simple as a single | |||
* function call. | * function call. | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI void *eet_data_read_cipher(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, const char *key); | ||||
EAPI void *eet_data_read(Eet_File *ef, Eet_Data_Descriptor *edd, const c har *name); | EAPI void *eet_data_read(Eet_File *ef, Eet_Data_Descriptor *edd, const c har *name); | |||
/** | /** | |||
* Write a data structure from memory and store in an eet file. | * Write a data structure from memory and store in an eet file. | |||
* @param ef The eet file handle to write to. | * @param ef The eet file handle to write to. | |||
* @param edd The data descriptor to use when encoding. | * @param edd The data descriptor to use when encoding. | |||
* @param name The key to store the data under in the eet file. | * @param name The key to store the data under in the eet file. | |||
* @param data A pointer to the data structure to ssave and encode. | * @param data A pointer to the data structure to ssave and encode. | |||
* @param compress Compression flags for storage. | * @param compress Compression flags for storage. | |||
* @return 1 on successful write, 0 on failure. | * @return 1 on successful write, 0 on failure. | |||
* | * | |||
* This function is the reverse of eet_data_read(), saving a data struct ure | * This function is the reverse of eet_data_read(), saving a data struct ure | |||
* to an eet file. | * to an eet file. | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI int eet_data_write_cipher(Eet_File *ef, Eet_Data_Descriptor *edd, c onst char *name, const char *key, const void *data, int compress); | ||||
EAPI int eet_data_write(Eet_File *ef, Eet_Data_Descriptor *edd, const ch ar *name, const void *data, int compress); | EAPI int eet_data_write(Eet_File *ef, Eet_Data_Descriptor *edd, const ch ar *name, const void *data, int compress); | |||
/** | /** | |||
* Dump an eet encoded data structure into ascii text | * Dump an eet encoded data structure into ascii text | |||
* @param data_in The pointer to the data to decode into a struct. | * @param data_in The pointer to the data to decode into a struct. | |||
* @param size_in The size of the data pointed to in bytes. | * @param size_in The size of the data pointed to in bytes. | |||
* @param dumpfunc The function to call passed a string when new data is converted to text | * @param dumpfunc The function to call passed a string when new data is converted to text | |||
* @param dumpdata The data to pass to the @p dumpfunc callback. | * @param dumpdata The data to pass to the @p dumpfunc callback. | |||
* @return 1 on success, 0 on failure | * @return 1 on success, 0 on failure | |||
* | * | |||
skipping to change at line 1051 | skipping to change at line 1091 | |||
* rewind(f); | * rewind(f); | |||
* data = malloc(len); | * data = malloc(len); | |||
* fread(data, len, 1, f); | * fread(data, len, 1, f); | |||
* fclose(f); | * fclose(f); | |||
* eet_data_text_dump(data, len, output, NULL); | * eet_data_text_dump(data, len, output, NULL); | |||
* } | * } | |||
* @endcode | * @endcode | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI int eet_data_text_dump_cipher(const void *data_in, const char *key, int size_in, void (*dumpfunc) (void *data, const char *str), void *dumpdat a); | ||||
EAPI int eet_data_text_dump(const void *data_in, int size_in, void (*dum pfunc) (void *data, const char *str), void *dumpdata); | EAPI int eet_data_text_dump(const void *data_in, int size_in, void (*dum pfunc) (void *data, const char *str), void *dumpdata); | |||
/** | /** | |||
* Take an ascii encoding from eet_data_text_dump() and re-encode in bin ary. | * Take an ascii encoding from eet_data_text_dump() and re-encode in bin ary. | |||
* @param text The pointer to the string data to parse and encode. | * @param text The pointer to the string data to parse and encode. | |||
* @param textlen The size of the string in bytes (not including 0 byte terminator). | * @param textlen The size of the string in bytes (not including 0 byte terminator). | |||
* @param size_ret This gets filled in with the encoded data blob size i n bytes. | * @param size_ret This gets filled in with the encoded data blob size i n bytes. | |||
* @return The encoded data on success, NULL on failure. | * @return The encoded data on success, NULL on failure. | |||
* | * | |||
* This function will parse the string pointed to by @p text and return | * This function will parse the string pointed to by @p text and return | |||
* an encoded data lump the same way eet_data_descriptor_encode() takes an | * an encoded data lump the same way eet_data_descriptor_encode() takes an | |||
* in-memory data struct and encodes into a binary blob. @p text is a no rmal | * in-memory data struct and encodes into a binary blob. @p text is a no rmal | |||
* C string. | * C string. | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI void *eet_data_text_undump_cipher(const char *text, const char *key , int textlen, int *size_ret); | ||||
EAPI void *eet_data_text_undump(const char *text, int textlen, int *size _ret); | EAPI void *eet_data_text_undump(const char *text, int textlen, int *size _ret); | |||
/** | /** | |||
* Dump an eet encoded data structure from an eet file into ascii text | * Dump an eet encoded data structure from an eet file into ascii text | |||
* @param ef A valid eet file handle. | * @param ef A valid eet file handle. | |||
* @param name Name of the entry. eg: "/base/file_i_want". | * @param name Name of the entry. eg: "/base/file_i_want". | |||
* @param dumpfunc The function to call passed a string when new data is converted to text | * @param dumpfunc The function to call passed a string when new data is converted to text | |||
* @param dumpdata The data to pass to the @p dumpfunc callback. | * @param dumpdata The data to pass to the @p dumpfunc callback. | |||
* @return 1 on success, 0 on failure | * @return 1 on success, 0 on failure | |||
* | * | |||
* This function will take an open and valid eet file from eet_open() re quest | * This function will take an open and valid eet file from eet_open() re quest | |||
* the data encoded by eet_data_descriptor_encode() corresponding to the key @p name | * the data encoded by eet_data_descriptor_encode() corresponding to the key @p name | |||
* and convert it into human readable ascii text. It does this by callin g the | * and convert it into human readable ascii text. It does this by callin g the | |||
* @p dumpfunc callback for all new text that is generated. This callbac k should | * @p dumpfunc callback for all new text that is generated. This callbac k should | |||
* append to any existing text buffer and will be passed the pointer @p dumpdata | * append to any existing text buffer and will be passed the pointer @p dumpdata | |||
* as a parameter as well as a string with new text to be appended. | * as a parameter as well as a string with new text to be appended. | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI int eet_data_dump_cipher(Eet_File *ef, const char *name, const char *key, void (*dumpfunc) (void *data, const char *str), void *dumpdata); | ||||
EAPI int eet_data_dump(Eet_File *ef, const char *name, void (*dumpfunc) (void *data, const char *str), void *dumpdata); | EAPI int eet_data_dump(Eet_File *ef, const char *name, void (*dumpfunc) (void *data, const char *str), void *dumpdata); | |||
/** | /** | |||
* Take an ascii encoding from eet_data_dump() and re-encode in binary. | * Take an ascii encoding from eet_data_dump() and re-encode in binary. | |||
* @param ef A valid eet file handle. | * @param ef A valid eet file handle. | |||
* @param name Name of the entry. eg: "/base/file_i_want". | * @param name Name of the entry. eg: "/base/file_i_want". | |||
* @param text The pointer to the string data to parse and encode. | * @param text The pointer to the string data to parse and encode. | |||
* @param textlen The size of the string in bytes (not including 0 byte terminator). | * @param textlen The size of the string in bytes (not including 0 byte terminator). | |||
* @param compress Compression flags (1 == compress, 0 = don't compress) . | * @param compress Compression flags (1 == compress, 0 = don't compress) . | |||
* @return 1 on success, 0 on failure | * @return 1 on success, 0 on failure | |||
* | * | |||
* This function will parse the string pointed to by @p text, encode it the same | * This function will parse the string pointed to by @p text, encode it the same | |||
* way eet_data_descriptor_encode() takes an in-memory data struct and e ncodes into a | * way eet_data_descriptor_encode() takes an in-memory data struct and e ncodes into a | |||
* binary blob. | * binary blob. | |||
* | * | |||
* The data (optionally compressed) will be in ram, pending a flush to | * The data (optionally compressed) will be in ram, pending a flush to | |||
* disk (it will stay in ram till the eet file handle is closed though). | * disk (it will stay in ram till the eet file handle is closed though). | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI int eet_data_undump_cipher(Eet_File *ef, const char *name, const ch ar *key, const char *text, int textlen, int compress); | ||||
EAPI int eet_data_undump(Eet_File *ef, const char *name, const char *tex t, int textlen, int compress); | EAPI int eet_data_undump(Eet_File *ef, const char *name, const char *tex t, int textlen, int compress); | |||
/** | /** | |||
* Decode a data structure from an arbitary location in memory. | * Decode a data structure from an arbitary location in memory. | |||
* @param edd The data descriptor to use when decoding. | * @param edd The data descriptor to use when decoding. | |||
* @param data_in The pointer to the data to decode into a struct. | * @param data_in The pointer to the data to decode into a struct. | |||
* @param size_in The size of the data pointed to in bytes. | * @param size_in The size of the data pointed to in bytes. | |||
* @return NULL on failure, or a valid decoded struct pointer on success . | * @return NULL on failure, or a valid decoded struct pointer on success . | |||
* | * | |||
* This function will decode a data structure that has been encoded usin g | * This function will decode a data structure that has been encoded usin g | |||
skipping to change at line 1132 | skipping to change at line 1176 | |||
* succeed. | * succeed. | |||
* | * | |||
* This function is useful for decoding data structures delivered to the | * This function is useful for decoding data structures delivered to the | |||
* application by means other than an eet file, such as an IPC or socket | * application by means other than an eet file, such as an IPC or socket | |||
* connection, raw files, shared memory etc. | * connection, raw files, shared memory etc. | |||
* | * | |||
* Please see eet_data_read() for more information. | * Please see eet_data_read() for more information. | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI void *eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd, c onst void *data_in, const char *key, int size_in); | ||||
EAPI void *eet_data_descriptor_decode(Eet_Data_Descriptor *edd, const vo id *data_in, int size_in); | EAPI void *eet_data_descriptor_decode(Eet_Data_Descriptor *edd, const vo id *data_in, int size_in); | |||
/** | /** | |||
* Encode a dsata struct to memory and return that encoded data. | * Encode a dsata struct to memory and return that encoded data. | |||
* @param edd The data descriptor to use when encoding. | * @param edd The data descriptor to use when encoding. | |||
* @param data_in The pointer to the struct to encode into data. | * @param data_in The pointer to the struct to encode into data. | |||
* @param size_ret A pointer to the an int to be filled with the decoded size. | * @param size_ret A pointer to the an int to be filled with the decoded size. | |||
* @return NULL on failure, or a valid encoded data chunk on success. | * @return NULL on failure, or a valid encoded data chunk on success. | |||
* | * | |||
* This function takes a data structutre in memory and encodes it into a | * This function takes a data structutre in memory and encodes it into a | |||
skipping to change at line 1160 | skipping to change at line 1205 | |||
* | * | |||
* On success a non NULL valid pointer is returned and what @p size_ret | * On success a non NULL valid pointer is returned and what @p size_ret | |||
* points to is set to the size of this decoded data, in bytes. When the | * points to is set to the size of this decoded data, in bytes. When the | |||
* encoded data is no longer needed, call free() on it. On failure NULL is | * encoded data is no longer needed, call free() on it. On failure NULL is | |||
* returned and what @p size_ret points to is set to 0. | * returned and what @p size_ret points to is set to 0. | |||
* | * | |||
* Please see eet_data_write() for more information. | * Please see eet_data_write() for more information. | |||
* | * | |||
* @since 1.0.0 | * @since 1.0.0 | |||
*/ | */ | |||
EAPI void *eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd, c onst void *data_in, const char *key, int *size_ret); | ||||
EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd, const vo id *data_in, int *size_ret); | EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd, const vo id *data_in, int *size_ret); | |||
/** | /** | |||
* Add a basic data element to a data descriptor. | * Add a basic data element to a data descriptor. | |||
* @param edd The data descriptor to add the type to. | * @param edd The data descriptor to add the type to. | |||
* @param struct_type The type of the struct. | * @param struct_type The type of the struct. | |||
* @param name The string name to use to encode/decode this member (must be a constant global and never change). | * @param name The string name to use to encode/decode this member (must be a constant global and never change). | |||
* @param member The struct member itself to be encoded. | * @param member The struct member itself to be encoded. | |||
* @param type The type of the member to encode. | * @param type The type of the member to encode. | |||
* | * | |||
skipping to change at line 1314 | skipping to change at line 1360 | |||
#define EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(edd, struct_type, name, member, s ubtype) \ | #define EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(edd, struct_type, name, member, s ubtype) \ | |||
{ \ | { \ | |||
struct_type ___ett; \ | struct_type ___ett; \ | |||
\ | \ | |||
eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_VAR_A RRAY, \ | eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_VAR_A RRAY, \ | |||
(char *)(&(___ett.member)) - (char * )(&(___ett)), \ | (char *)(&(___ett.member)) - (char * )(&(___ett)), \ | |||
(char *)(&(___ett.member ## _count)) - (char *)(&(___ett)), /* 0, */NULL, subtype); \ | (char *)(&(___ett.member ## _count)) - (char *)(&(___ett)), /* 0, */NULL, subtype); \ | |||
} | } | |||
/************************************************************************** */ | /************************************************************************** */ | |||
EAPI Eet_Node *eet_node_char_new(const char *name, char c); | ||||
EAPI Eet_Node *eet_node_short_new(const char *name, short s); | ||||
EAPI Eet_Node *eet_node_int_new(const char *name, int i); | ||||
EAPI Eet_Node *eet_node_long_long_new(const char *name, long long l); | ||||
EAPI Eet_Node *eet_node_float_new(const char *name, float f); | ||||
EAPI Eet_Node *eet_node_double_new(const char *name, double d); | ||||
EAPI Eet_Node *eet_node_unsigned_char_new(const char *name, unsigned cha | ||||
r uc); | ||||
EAPI Eet_Node *eet_node_unsigned_short_new(const char *name, unsigned sh | ||||
ort us); | ||||
EAPI Eet_Node *eet_node_unsigned_int_new(const char *name, unsigned int | ||||
ui); | ||||
EAPI Eet_Node *eet_node_string_new(const char *name, const char *str); | ||||
EAPI Eet_Node *eet_node_inlined_string_new(const char *name, const char | ||||
*str); | ||||
EAPI Eet_Node *eet_node_null_new(const char *name); | ||||
EAPI Eet_Node *eet_node_list_new(const char *name, Eina_List *nodes); | ||||
EAPI Eet_Node *eet_node_array_new(const char *name, int count, Eina_List | ||||
*nodes); | ||||
EAPI Eet_Node *eet_node_var_array_new(const char *name, int count, Eina_ | ||||
List *nodes); | ||||
EAPI Eet_Node *eet_node_hash_new(const char *name, const char *key, Eina | ||||
_List *nodes); | ||||
EAPI Eet_Node *eet_node_struct_new(const char *name, Eina_List *nodes); | ||||
EAPI void eet_node_del(Eet_Node *n); | ||||
EAPI void *eet_data_node_encode_cipher(Eet_Node *node, const char *key, | ||||
int *size_ret); | ||||
EAPI int eet_data_node_write_cipher(Eet_File *ef, const char *name, cons | ||||
t char *key, Eet_Node *node, int compress); | ||||
/************************************************************************** | ||||
*/ | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 33 change blocks. | ||||
40 lines changed or deleted | 127 lines changed or added | |||