mirror of
https://github.com/noirotm/libamf.git
synced 2026-05-02 22:19:09 -05:00
Add amf_ prefix to read_proc_t and write_proc_t types
This commit is contained in:
+93
-93
@@ -1,91 +1,91 @@
|
||||
#ifndef __AMF_H__
|
||||
#define __AMF_H__
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "@PACKAGE@"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "@PACKAGE_NAME@"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "@PACKAGE_STRING@"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "@PACKAGE_NAME@"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
|
||||
|
||||
/* The size of `double', as computed by sizeof. */
|
||||
#define SIZEOF_DOUBLE @SIZEOF_DOUBLE@
|
||||
|
||||
/* The size of `float', as computed by sizeof. */
|
||||
#define SIZEOF_FLOAT @SIZEOF_FLOAT@
|
||||
|
||||
/* The size of `long double', as computed by sizeof. */
|
||||
#define SIZEOF_LONG_DOUBLE @SIZEOF_LONG_DOUBLE@
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "@PACKAGE_VERSION@"
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#cmakedefine HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#cmakedefine HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stddef.h> header file. */
|
||||
#cmakedefine HAVE_STDDEF_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#cmakedefine HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if your processor stores words with the most significant byte
|
||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#cmakedefine WORDS_BIGENDIAN
|
||||
|
||||
/* Define to the type of an integer type of width exactly 16 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#cmakedefine int16_t short int
|
||||
|
||||
/* Define to the type of an integer type of width exactly 32 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#cmakedefine int32_t int
|
||||
|
||||
/* Define to the type of an integer type of width exactly 64 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#cmakedefine int64_t long long int
|
||||
|
||||
/* Define to the type of an integer type of width exactly 8 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#cmakedefine int8_t char
|
||||
|
||||
/* Define to the type of an unsigned integer type of width exactly 16 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#cmakedefine uint16_t unsigned short int
|
||||
|
||||
/* Define to the type of an unsigned integer type of width exactly 32 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#cmakedefine uint32_t unsigned int
|
||||
|
||||
/* Define to the type of an unsigned integer type of width exactly 64 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#cmakedefine uint64_t unsigned long long int
|
||||
|
||||
/* Define to the type of an unsigned integer type of width exactly 8 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#cmakedefine uint8_t unsigned char
|
||||
|
||||
#ifndef __AMF_H__
|
||||
#define __AMF_H__
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "@PACKAGE@"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "@PACKAGE_NAME@"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "@PACKAGE_STRING@"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "@PACKAGE_NAME@"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
|
||||
|
||||
/* The size of `double', as computed by sizeof. */
|
||||
#define SIZEOF_DOUBLE @SIZEOF_DOUBLE@
|
||||
|
||||
/* The size of `float', as computed by sizeof. */
|
||||
#define SIZEOF_FLOAT @SIZEOF_FLOAT@
|
||||
|
||||
/* The size of `long double', as computed by sizeof. */
|
||||
#define SIZEOF_LONG_DOUBLE @SIZEOF_LONG_DOUBLE@
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "@PACKAGE_VERSION@"
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#cmakedefine HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#cmakedefine HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stddef.h> header file. */
|
||||
#cmakedefine HAVE_STDDEF_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#cmakedefine HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if your processor stores words with the most significant byte
|
||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#cmakedefine WORDS_BIGENDIAN
|
||||
|
||||
/* Define to the type of an integer type of width exactly 16 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#cmakedefine int16_t short int
|
||||
|
||||
/* Define to the type of an integer type of width exactly 32 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#cmakedefine int32_t int
|
||||
|
||||
/* Define to the type of an integer type of width exactly 64 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#cmakedefine int64_t long long int
|
||||
|
||||
/* Define to the type of an integer type of width exactly 8 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#cmakedefine int8_t char
|
||||
|
||||
/* Define to the type of an unsigned integer type of width exactly 16 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#cmakedefine uint16_t unsigned short int
|
||||
|
||||
/* Define to the type of an unsigned integer type of width exactly 32 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#cmakedefine uint32_t unsigned int
|
||||
|
||||
/* Define to the type of an unsigned integer type of width exactly 64 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#cmakedefine uint64_t unsigned long long int
|
||||
|
||||
/* Define to the type of an unsigned integer type of width exactly 8 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#cmakedefine uint8_t unsigned char
|
||||
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/* AMF number */
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/* AMF number */
|
||||
typedef
|
||||
#if SIZEOF_FLOAT == 8
|
||||
float
|
||||
@@ -96,10 +96,10 @@ long double
|
||||
#else
|
||||
uint64_t
|
||||
#endif
|
||||
number64_t;
|
||||
|
||||
/* custom read/write function type */
|
||||
typedef size_t (*read_proc_t)(void * out_buffer, size_t size, void * user_data);
|
||||
typedef size_t (*write_proc_t)(const void * in_buffer, size_t size, void * user_data);
|
||||
|
||||
#endif /* __AMF_H__ */
|
||||
number64_t;
|
||||
|
||||
/* custom read/write function type */
|
||||
typedef size_t (*amf_read_proc_t)(void * out_buffer, size_t size, void * user_data);
|
||||
typedef size_t (*amf_write_proc_t)(const void * in_buffer, size_t size, void * user_data);
|
||||
|
||||
#endif /* __AMF_H__ */
|
||||
|
||||
+16
-16
@@ -192,7 +192,7 @@ size_t amf0_data_file_write(const amf0_data *data, FILE * stream) {
|
||||
}
|
||||
|
||||
/* read a number */
|
||||
static amf0_data * amf0_number_read(read_proc_t read_proc, void * user_data) {
|
||||
static amf0_data * amf0_number_read(amf_read_proc_t read_proc, void * user_data) {
|
||||
number64_t val;
|
||||
if (read_proc(&val, sizeof(number64_t), user_data) == sizeof(number64_t)) {
|
||||
return amf0_number_new(swap_number64(val));
|
||||
@@ -203,7 +203,7 @@ static amf0_data * amf0_number_read(read_proc_t read_proc, void * user_data) {
|
||||
}
|
||||
|
||||
/* read a boolean */
|
||||
static amf0_data * amf0_boolean_read(read_proc_t read_proc, void * user_data) {
|
||||
static amf0_data * amf0_boolean_read(amf_read_proc_t read_proc, void * user_data) {
|
||||
uint8_t val;
|
||||
if (read_proc(&val, sizeof(uint8_t), user_data) == sizeof(uint8_t)) {
|
||||
return amf0_boolean_new(val);
|
||||
@@ -214,7 +214,7 @@ static amf0_data * amf0_boolean_read(read_proc_t read_proc, void * user_data) {
|
||||
}
|
||||
|
||||
/* read a string */
|
||||
static amf0_data * amf0_string_read(read_proc_t read_proc, void * user_data) {
|
||||
static amf0_data * amf0_string_read(amf_read_proc_t read_proc, void * user_data) {
|
||||
uint16_t strsize;
|
||||
uint8_t * buffer;
|
||||
|
||||
@@ -244,7 +244,7 @@ static amf0_data * amf0_string_read(read_proc_t read_proc, void * user_data) {
|
||||
}
|
||||
|
||||
/* read an object */
|
||||
static amf0_data * amf0_object_read(read_proc_t read_proc, void * user_data) {
|
||||
static amf0_data * amf0_object_read(amf_read_proc_t read_proc, void * user_data) {
|
||||
amf0_data * name;
|
||||
amf0_data * element;
|
||||
uint8_t error_code;
|
||||
@@ -295,7 +295,7 @@ static amf0_data * amf0_object_read(read_proc_t read_proc, void * user_data) {
|
||||
}
|
||||
|
||||
/* read an associative array */
|
||||
static amf0_data * amf0_associative_array_read(read_proc_t read_proc, void * user_data) {
|
||||
static amf0_data * amf0_associative_array_read(amf_read_proc_t read_proc, void * user_data) {
|
||||
amf0_data * name;
|
||||
amf0_data * element;
|
||||
uint32_t size;
|
||||
@@ -354,7 +354,7 @@ static amf0_data * amf0_associative_array_read(read_proc_t read_proc, void * use
|
||||
}
|
||||
|
||||
/* read an array */
|
||||
static amf0_data * amf0_array_read(read_proc_t read_proc, void * user_data) {
|
||||
static amf0_data * amf0_array_read(amf_read_proc_t read_proc, void * user_data) {
|
||||
size_t i;
|
||||
amf0_data * element;
|
||||
uint8_t error_code;
|
||||
@@ -393,7 +393,7 @@ static amf0_data * amf0_array_read(read_proc_t read_proc, void * user_data) {
|
||||
}
|
||||
|
||||
/* read a date */
|
||||
static amf0_data * amf0_date_read(read_proc_t read_proc, void * user_data) {
|
||||
static amf0_data * amf0_date_read(amf_read_proc_t read_proc, void * user_data) {
|
||||
number64_t milliseconds;
|
||||
int16_t timezone;
|
||||
if (read_proc(&milliseconds, sizeof(number64_t), user_data) == sizeof(number64_t) &&
|
||||
@@ -406,7 +406,7 @@ static amf0_data * amf0_date_read(read_proc_t read_proc, void * user_data) {
|
||||
}
|
||||
|
||||
/* load AMF data from stream */
|
||||
amf0_data * amf0_data_read(read_proc_t read_proc, void * user_data) {
|
||||
amf0_data * amf0_data_read(amf_read_proc_t read_proc, void * user_data) {
|
||||
uint8_t type;
|
||||
if (read_proc(&type, sizeof(uint8_t), user_data) == sizeof(uint8_t)) {
|
||||
switch (type) {
|
||||
@@ -513,18 +513,18 @@ size_t amf0_data_size(const amf0_data *data) {
|
||||
}
|
||||
|
||||
/* write a number */
|
||||
static size_t amf0_number_write(const amf0_data * data, write_proc_t write_proc, void * user_data) {
|
||||
static size_t amf0_number_write(const amf0_data * data, amf_write_proc_t write_proc, void * user_data) {
|
||||
number64_t n = swap_number64(data->number_data);
|
||||
return write_proc(&n, sizeof(number64_t), user_data);
|
||||
}
|
||||
|
||||
/* write a boolean */
|
||||
static size_t amf0_boolean_write(const amf0_data * data, write_proc_t write_proc, void * user_data) {
|
||||
static size_t amf0_boolean_write(const amf0_data * data, amf_write_proc_t write_proc, void * user_data) {
|
||||
return write_proc(&(data->boolean_data), sizeof(uint8_t), user_data);
|
||||
}
|
||||
|
||||
/* write a string */
|
||||
static size_t amf0_string_write(const amf0_data * data, write_proc_t write_proc, void * user_data) {
|
||||
static size_t amf0_string_write(const amf0_data * data, amf_write_proc_t write_proc, void * user_data) {
|
||||
uint16_t s;
|
||||
size_t w = 0;
|
||||
|
||||
@@ -538,7 +538,7 @@ static size_t amf0_string_write(const amf0_data * data, write_proc_t write_proc,
|
||||
}
|
||||
|
||||
/* write an object */
|
||||
static size_t amf0_object_write(const amf0_data * data, write_proc_t write_proc, void * user_data) {
|
||||
static size_t amf0_object_write(const amf0_data * data, amf_write_proc_t write_proc, void * user_data) {
|
||||
amf0_node * node;
|
||||
size_t w = 0;
|
||||
uint16_t filler = swap_uint16(0);
|
||||
@@ -560,7 +560,7 @@ static size_t amf0_object_write(const amf0_data * data, write_proc_t write_proc,
|
||||
}
|
||||
|
||||
/* write an associative array */
|
||||
static size_t amf0_associative_array_write(const amf0_data * data, write_proc_t write_proc, void * user_data) {
|
||||
static size_t amf0_associative_array_write(const amf0_data * data, amf_write_proc_t write_proc, void * user_data) {
|
||||
amf0_node * node;
|
||||
size_t w = 0;
|
||||
uint32_t s;
|
||||
@@ -585,7 +585,7 @@ static size_t amf0_associative_array_write(const amf0_data * data, write_proc_t
|
||||
}
|
||||
|
||||
/* write an array */
|
||||
static size_t amf0_array_write(const amf0_data * data, write_proc_t write_proc, void * user_data) {
|
||||
static size_t amf0_array_write(const amf0_data * data, amf_write_proc_t write_proc, void * user_data) {
|
||||
amf0_node * node;
|
||||
size_t w = 0;
|
||||
uint32_t s;
|
||||
@@ -602,7 +602,7 @@ static size_t amf0_array_write(const amf0_data * data, write_proc_t write_proc,
|
||||
}
|
||||
|
||||
/* write a date */
|
||||
static size_t amf0_date_write(const amf0_data * data, write_proc_t write_proc, void * user_data) {
|
||||
static size_t amf0_date_write(const amf0_data * data, amf_write_proc_t write_proc, void * user_data) {
|
||||
size_t w = 0;
|
||||
number64_t milli;
|
||||
int16_t tz;
|
||||
@@ -616,7 +616,7 @@ static size_t amf0_date_write(const amf0_data * data, write_proc_t write_proc, v
|
||||
}
|
||||
|
||||
/* write amf data to stream */
|
||||
size_t amf0_data_write(const amf0_data *data, write_proc_t write_proc, void * user_data) {
|
||||
size_t amf0_data_write(const amf0_data *data, amf_write_proc_t write_proc, void * user_data) {
|
||||
size_t s = 0;
|
||||
if (data != NULL) {
|
||||
s += write_proc(&(data->type), sizeof(uint8_t), user_data);
|
||||
|
||||
+2
-2
@@ -95,10 +95,10 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* read AMF data */
|
||||
amf0_data * amf0_data_read(read_proc_t read_proc, void * user_data);
|
||||
amf0_data * amf0_data_read(amf_read_proc_t read_proc, void * user_data);
|
||||
|
||||
/* write AMF data */
|
||||
size_t amf0_data_write(const amf0_data * data, write_proc_t write_proc, void * user_data);
|
||||
size_t amf0_data_write(const amf0_data * data, amf_write_proc_t write_proc, void * user_data);
|
||||
|
||||
/* generic functions */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user