Avoid reserved identifiers for macros/functions

parent 651de262
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#if !defined(_opusenc_h) #ifndef OPUSENC_H
# define _opusenc_h (1) # define OPUSENC_H
/**\mainpage /**\mainpage
\section Introduction \section Introduction
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#if !defined(_oggpacker_h) #ifndef OGGPACKER_H
# define _oggpacker_h (1) # define OGGPACKER_H
# if defined(__cplusplus) # if defined(__cplusplus)
......
...@@ -118,7 +118,7 @@ static int write_matrix_chars(Packet *p, const OpusGenericEncoder *st) ...@@ -118,7 +118,7 @@ static int write_matrix_chars(Packet *p, const OpusGenericEncoder *st)
#endif #endif
} }
int _ope_opus_header_get_size(const OpusHeader *h) int opeint_opus_header_get_size(const OpusHeader *h)
{ {
int len=0; int len=0;
if (opeint_use_projection(h->channel_mapping)) if (opeint_use_projection(h->channel_mapping))
...@@ -141,7 +141,7 @@ int _ope_opus_header_get_size(const OpusHeader *h) ...@@ -141,7 +141,7 @@ int _ope_opus_header_get_size(const OpusHeader *h)
return len; return len;
} }
int _ope_opus_header_to_packet(const OpusHeader *h, unsigned char *packet, int len, const OpusGenericEncoder *st) int opeint_opus_header_to_packet(const OpusHeader *h, unsigned char *packet, int len, const OpusGenericEncoder *st)
{ {
int i; int i;
Packet p; Packet p;
...@@ -248,7 +248,7 @@ The comment header is decoded as follows: ...@@ -248,7 +248,7 @@ The comment header is decoded as follows:
buf[base]=(val)&0xff; \ buf[base]=(val)&0xff; \
}while(0) }while(0)
void _ope_comment_init(char **comments, int* length, const char *vendor_string) void opeint_comment_init(char **comments, int* length, const char *vendor_string)
{ {
/*The 'vendor' field should be the actual encoding library used.*/ /*The 'vendor' field should be the actual encoding library used.*/
int vendor_length=strlen(vendor_string); int vendor_length=strlen(vendor_string);
...@@ -267,7 +267,7 @@ void _ope_comment_init(char **comments, int* length, const char *vendor_string) ...@@ -267,7 +267,7 @@ void _ope_comment_init(char **comments, int* length, const char *vendor_string)
*comments=p; *comments=p;
} }
int _ope_comment_add(char **comments, int* length, const char *tag, const char *val) int opeint_comment_add(char **comments, int* length, const char *tag, const char *val)
{ {
char* p=*comments; char* p=*comments;
int vendor_length=readint(p, 8); int vendor_length=readint(p, 8);
...@@ -291,7 +291,7 @@ int _ope_comment_add(char **comments, int* length, const char *tag, const char * ...@@ -291,7 +291,7 @@ int _ope_comment_add(char **comments, int* length, const char *tag, const char *
return 0; return 0;
} }
void _ope_comment_pad(char **comments, int* length, int amount) void opeint_comment_pad(char **comments, int* length, int amount)
{ {
if(amount>0){ if(amount>0){
int i; int i;
......
...@@ -83,14 +83,14 @@ typedef struct { ...@@ -83,14 +83,14 @@ typedef struct {
unsigned char stream_map[255]; unsigned char stream_map[255];
} OpusHeader; } OpusHeader;
int _ope_opus_header_get_size(const OpusHeader *h); int opeint_opus_header_get_size(const OpusHeader *h);
int _ope_opus_header_to_packet(const OpusHeader *h, unsigned char *packet, int len, const OpusGenericEncoder *st); int opeint_opus_header_to_packet(const OpusHeader *h, unsigned char *packet, int len, const OpusGenericEncoder *st);
void _ope_comment_init(char **comments, int* length, const char *vendor_string); void opeint_comment_init(char **comments, int* length, const char *vendor_string);
int _ope_comment_add(char **comments, int* length, const char *tag, const char *val); int opeint_comment_add(char **comments, int* length, const char *tag, const char *val);
void _ope_comment_pad(char **comments, int* length, int amount); void opeint_comment_pad(char **comments, int* length, int amount);
#endif #endif
...@@ -87,7 +87,7 @@ OggOpusComments *ope_comments_create() { ...@@ -87,7 +87,7 @@ OggOpusComments *ope_comments_create() {
if (c == NULL) return NULL; if (c == NULL) return NULL;
libopus_str = opus_get_version_string(); libopus_str = opus_get_version_string();
snprintf(vendor_str, sizeof(vendor_str), "%s, %s %s", libopus_str, PACKAGE_NAME, PACKAGE_VERSION); snprintf(vendor_str, sizeof(vendor_str), "%s, %s %s", libopus_str, PACKAGE_NAME, PACKAGE_VERSION);
_ope_comment_init(&c->comment, &c->comment_length, vendor_str); opeint_comment_init(&c->comment, &c->comment_length, vendor_str);
c->seen_file_icons = 0; c->seen_file_icons = 0;
if (c->comment == NULL) { if (c->comment == NULL) {
free(c); free(c);
...@@ -123,25 +123,25 @@ void ope_comments_destroy(OggOpusComments *comments){ ...@@ -123,25 +123,25 @@ void ope_comments_destroy(OggOpusComments *comments){
int ope_comments_add(OggOpusComments *comments, const char *tag, const char *val) { int ope_comments_add(OggOpusComments *comments, const char *tag, const char *val) {
if (tag == NULL || val == NULL) return OPE_BAD_ARG; if (tag == NULL || val == NULL) return OPE_BAD_ARG;
if (strchr(tag, '=')) return OPE_BAD_ARG; if (strchr(tag, '=')) return OPE_BAD_ARG;
if (_ope_comment_add(&comments->comment, &comments->comment_length, tag, val)) return OPE_ALLOC_FAIL; if (opeint_comment_add(&comments->comment, &comments->comment_length, tag, val)) return OPE_ALLOC_FAIL;
return OPE_OK; return OPE_OK;
} }
/* Add a comment. */ /* Add a comment. */
int ope_comments_add_string(OggOpusComments *comments, const char *tag_and_val) { int ope_comments_add_string(OggOpusComments *comments, const char *tag_and_val) {
if (!strchr(tag_and_val, '=')) return OPE_BAD_ARG; if (!strchr(tag_and_val, '=')) return OPE_BAD_ARG;
if (_ope_comment_add(&comments->comment, &comments->comment_length, NULL, tag_and_val)) return OPE_ALLOC_FAIL; if (opeint_comment_add(&comments->comment, &comments->comment_length, NULL, tag_and_val)) return OPE_ALLOC_FAIL;
return OPE_OK; return OPE_OK;
} }
int ope_comments_add_picture(OggOpusComments *comments, const char *filename, int picture_type, const char *description) { int ope_comments_add_picture(OggOpusComments *comments, const char *filename, int picture_type, const char *description) {
char *picture_data; char *picture_data;
int err; int err;
picture_data = _ope_parse_picture_specification(filename, picture_type, description, &err, &comments->seen_file_icons); picture_data = opeint_parse_picture_specification(filename, picture_type, description, &err, &comments->seen_file_icons);
if (picture_data == NULL || err != OPE_OK){ if (picture_data == NULL || err != OPE_OK){
return err; return err;
} }
_ope_comment_add(&comments->comment, &comments->comment_length, "METADATA_BLOCK_PICTURE", picture_data); opeint_comment_add(&comments->comment, &comments->comment_length, "METADATA_BLOCK_PICTURE", picture_data);
free(picture_data); free(picture_data);
return OPE_OK; return OPE_OK;
} }
...@@ -149,11 +149,11 @@ int ope_comments_add_picture(OggOpusComments *comments, const char *filename, in ...@@ -149,11 +149,11 @@ int ope_comments_add_picture(OggOpusComments *comments, const char *filename, in
int ope_comments_add_picture_from_memory(OggOpusComments *comments, const char *ptr, size_t size, int picture_type, const char *description) { int ope_comments_add_picture_from_memory(OggOpusComments *comments, const char *ptr, size_t size, int picture_type, const char *description) {
char *picture_data; char *picture_data;
int err; int err;
picture_data = _ope_parse_picture_specification_from_memory(ptr, size, picture_type, description, &err, &comments->seen_file_icons); picture_data = opeint_parse_picture_specification_from_memory(ptr, size, picture_type, description, &err, &comments->seen_file_icons);
if (picture_data == NULL || err != OPE_OK){ if (picture_data == NULL || err != OPE_OK){
return err; return err;
} }
_ope_comment_add(&comments->comment, &comments->comment_length, "METADATA_BLOCK_PICTURE", picture_data); opeint_comment_add(&comments->comment, &comments->comment_length, "METADATA_BLOCK_PICTURE", picture_data);
free(picture_data); free(picture_data);
return OPE_OK; return OPE_OK;
} }
...@@ -325,7 +325,7 @@ OggOpusEnc *ope_encoder_create_file(const char *path, OggOpusComments *comments, ...@@ -325,7 +325,7 @@ OggOpusEnc *ope_encoder_create_file(const char *path, OggOpusComments *comments,
free(obj); free(obj);
return NULL; return NULL;
} }
obj->file = _ope_fopen(path, "wb"); obj->file = opeint_fopen(path, "wb");
if (!obj->file) { if (!obj->file) {
if (error) *error = OPE_CANNOT_OPEN; if (error) *error = OPE_CANNOT_OPEN;
ope_encoder_destroy(enc); ope_encoder_destroy(enc);
...@@ -514,7 +514,7 @@ static void init_stream(OggOpusEnc *enc) { ...@@ -514,7 +514,7 @@ static void init_stream(OggOpusEnc *enc) {
} }
oggp_set_muxing_delay(enc->oggp, enc->max_ogg_delay); oggp_set_muxing_delay(enc->oggp, enc->max_ogg_delay);
} }
_ope_comment_pad(&enc->streams->comment, &enc->streams->comment_length, enc->comment_padding); opeint_comment_pad(&enc->streams->comment, &enc->streams->comment_length, enc->comment_padding);
/* Get preskip at the last minute (when it can no longer change). */ /* Get preskip at the last minute (when it can no longer change). */
if (enc->global_granule_offset == -1) { if (enc->global_granule_offset == -1) {
...@@ -531,9 +531,9 @@ static void init_stream(OggOpusEnc *enc) { ...@@ -531,9 +531,9 @@ static void init_stream(OggOpusEnc *enc) {
int ret; int ret;
int packet_size; int packet_size;
unsigned char *p; unsigned char *p;
header_size = _ope_opus_header_get_size(&enc->header); header_size = opeint_opus_header_get_size(&enc->header);
p = oggp_get_packet_buffer(enc->oggp, header_size); p = oggp_get_packet_buffer(enc->oggp, header_size);
packet_size = _ope_opus_header_to_packet(&enc->header, p, header_size, &enc->st); packet_size = opeint_opus_header_to_packet(&enc->header, p, header_size, &enc->st);
if (enc->packet_callback) enc->packet_callback(enc->packet_callback_data, p, packet_size, 0); if (enc->packet_callback) enc->packet_callback(enc->packet_callback_data, p, packet_size, 0);
oggp_commit_packet(enc->oggp, packet_size, 0, 0); oggp_commit_packet(enc->oggp, packet_size, 0, 0);
ret = oe_flush_page(enc); ret = oe_flush_page(enc);
...@@ -870,7 +870,7 @@ int ope_encoder_continue_new_file(OggOpusEnc *enc, const char *path, OggOpusComm ...@@ -870,7 +870,7 @@ int ope_encoder_continue_new_file(OggOpusEnc *enc, const char *path, OggOpusComm
int ret; int ret;
struct StdioObject *obj; struct StdioObject *obj;
if (!(obj = malloc(sizeof(*obj)))) return OPE_ALLOC_FAIL; if (!(obj = malloc(sizeof(*obj)))) return OPE_ALLOC_FAIL;
obj->file = _ope_fopen(path, "wb"); obj->file = opeint_fopen(path, "wb");
if (!obj->file) { if (!obj->file) {
free(obj); free(obj);
/* By trying to open the file first, we can recover if we can't open it. */ /* By trying to open the file first, we can recover if we can't open it. */
......
...@@ -228,13 +228,13 @@ static void extract_jpeg_params(const unsigned char *data, size_t data_length, ...@@ -228,13 +228,13 @@ static void extract_jpeg_params(const unsigned char *data, size_t data_length,
#define IMAX(a,b) ((a) > (b) ? (a) : (b)) #define IMAX(a,b) ((a) > (b) ? (a) : (b))
static unsigned char *_ope_read_picture_file(const char *filename, const char *description, int *error, size_t *size, size_t *offset) { static unsigned char *opeint_read_picture_file(const char *filename, const char *description, int *error, size_t *size, size_t *offset) {
FILE *picture_file; FILE *picture_file;
size_t cbuf; size_t cbuf;
size_t nbuf; size_t nbuf;
size_t data_offset; size_t data_offset;
unsigned char *buf; unsigned char *buf;
picture_file=_ope_fopen(filename,"rb"); picture_file=opeint_fopen(filename,"rb");
/*Buffer size: 8 static 4-byte fields plus 2 dynamic fields, plus the /*Buffer size: 8 static 4-byte fields plus 2 dynamic fields, plus the
file/URL data. file/URL data.
We reserve at least 10 bytes for the media type, in case we still need to We reserve at least 10 bytes for the media type, in case we still need to
...@@ -302,7 +302,7 @@ static int validate_picture_type(int picture_type, int seen_file_icons) { ...@@ -302,7 +302,7 @@ static int validate_picture_type(int picture_type, int seen_file_icons) {
have already been added, to ensure only one is allowed. have already been added, to ensure only one is allowed.
Return: A Base64-encoded string suitable for use in a METADATA_BLOCK_PICTURE Return: A Base64-encoded string suitable for use in a METADATA_BLOCK_PICTURE
tag.*/ tag.*/
static char *_ope_parse_picture_specification_impl(unsigned char *buf, size_t nbuf, size_t data_offset, int picture_type, const char *description, static char *opeint_parse_picture_specification_impl(unsigned char *buf, size_t nbuf, size_t data_offset, int picture_type, const char *description,
int *error, int *seen_file_icons){ int *error, int *seen_file_icons){
opus_uint32 width; opus_uint32 width;
opus_uint32 height; opus_uint32 height;
...@@ -390,7 +390,7 @@ static char *_ope_parse_picture_specification_impl(unsigned char *buf, size_t nb ...@@ -390,7 +390,7 @@ static char *_ope_parse_picture_specification_impl(unsigned char *buf, size_t nb
return out; return out;
} }
char *_ope_parse_picture_specification(const char *filename, int picture_type, const char *description, char *opeint_parse_picture_specification(const char *filename, int picture_type, const char *description,
int *error, int *seen_file_icons){ int *error, int *seen_file_icons){
size_t nbuf; size_t nbuf;
size_t data_offset; size_t data_offset;
...@@ -402,14 +402,14 @@ char *_ope_parse_picture_specification(const char *filename, int picture_type, c ...@@ -402,14 +402,14 @@ char *_ope_parse_picture_specification(const char *filename, int picture_type, c
return NULL; return NULL;
} }
if (description == NULL) description = ""; if (description == NULL) description = "";
buf = _ope_read_picture_file(filename, description, error, &nbuf, &data_offset); buf = opeint_read_picture_file(filename, description, error, &nbuf, &data_offset);
if (buf == NULL) return NULL; if (buf == NULL) return NULL;
ret = _ope_parse_picture_specification_impl(buf, nbuf, data_offset, picture_type, description, error, seen_file_icons); ret = opeint_parse_picture_specification_impl(buf, nbuf, data_offset, picture_type, description, error, seen_file_icons);
free(buf); free(buf);
return ret; return ret;
} }
char *_ope_parse_picture_specification_from_memory(const char *mem, size_t size, int picture_type, const char *description, char *opeint_parse_picture_specification_from_memory(const char *mem, size_t size, int picture_type, const char *description,
int *error, int *seen_file_icons){ int *error, int *seen_file_icons){
size_t nbuf; size_t nbuf;
size_t data_offset; size_t data_offset;
...@@ -429,7 +429,7 @@ char *_ope_parse_picture_specification_from_memory(const char *mem, size_t size, ...@@ -429,7 +429,7 @@ char *_ope_parse_picture_specification_from_memory(const char *mem, size_t size,
return NULL; return NULL;
} }
memcpy(buf+data_offset, mem, size); memcpy(buf+data_offset, mem, size);
ret = _ope_parse_picture_specification_impl(buf, nbuf, data_offset, picture_type, description, error, seen_file_icons); ret = opeint_parse_picture_specification_impl(buf, nbuf, data_offset, picture_type, description, error, seen_file_icons);
free(buf); free(buf);
return ret; return ret;
} }
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef __PICTURE_H #ifndef PICTURE_H
#define __PICTURE_H #define PICTURE_H
#include <opus.h> #include <opus.h>
#include "opusenc.h" #include "opusenc.h"
...@@ -39,10 +39,10 @@ typedef enum{ ...@@ -39,10 +39,10 @@ typedef enum{
#define BASE64_LENGTH(len) (((len)+2)/3*4) #define BASE64_LENGTH(len) (((len)+2)/3*4)
char *_ope_parse_picture_specification(const char *filename, int picture_type, const char *description, char *opeint_parse_picture_specification(const char *filename, int picture_type, const char *description,
int *error, int *seen_file_icons); int *error, int *seen_file_icons);
char *_ope_parse_picture_specification_from_memory(const char *mem, size_t size, int picture_type, const char *description, char *opeint_parse_picture_specification_from_memory(const char *mem, size_t size, int picture_type, const char *description,
int *error, int *seen_file_icons); int *error, int *seen_file_icons);
#define WRITE_U32_BE(buf, val) \ #define WRITE_U32_BE(buf, val) \
...@@ -54,4 +54,4 @@ char *_ope_parse_picture_specification_from_memory(const char *mem, size_t size, ...@@ -54,4 +54,4 @@ char *_ope_parse_picture_specification_from_memory(const char *mem, size_t size,
} \ } \
while(0); while(0);
#endif /* __PICTURE_H */ #endif /* PICTURE_H */
...@@ -50,7 +50,7 @@ static wchar_t *utf8_to_utf16(const char *input) ...@@ -50,7 +50,7 @@ static wchar_t *utf8_to_utf16(const char *input)
return ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL; return ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;
} }
FILE *_ope_fopen(const char *filename_utf8, const char *mode_utf8) FILE *opeint_fopen(const char *filename_utf8, const char *mode_utf8)
{ {
FILE *ret = NULL; FILE *ret = NULL;
wchar_t *filename_utf16 = utf8_to_utf16(filename_utf8); wchar_t *filename_utf16 = utf8_to_utf16(filename_utf8);
...@@ -71,7 +71,7 @@ FILE *_ope_fopen(const char *filename_utf8, const char *mode_utf8) ...@@ -71,7 +71,7 @@ FILE *_ope_fopen(const char *filename_utf8, const char *mode_utf8)
#include <stdio.h> #include <stdio.h>
FILE *_ope_fopen(const char *filename_utf8, const char *mode_utf8) { FILE *opeint_fopen(const char *filename_utf8, const char *mode_utf8) {
return fopen(filename_utf8, mode_utf8); return fopen(filename_utf8, mode_utf8);
} }
......
...@@ -34,6 +34,6 @@ ...@@ -34,6 +34,6 @@
#define WIN_UNICODE 1 #define WIN_UNICODE 1
FILE *_ope_fopen(const char *filename_utf8, const char *mode_utf8); FILE *opeint_fopen(const char *filename_utf8, const char *mode_utf8);
#endif #endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment