ref: 630163e86a73b1e27f83fe9f238b2f5ee13b30c6
parent: da413b17cb8836b94042fc852cbdaccbf3892cb5
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Thu May 11 13:25:15 EDT 2017
Using oggp_int32 instead of some usage of int and long
--- a/src/ogg_packer.c
+++ b/src/ogg_packer.c
@@ -102,9 +102,9 @@
0xafb010b1,0xab710d06,0xa6322bdf,0xa2f33668,
0xbcb4666d,0xb8757bda,0xb5365d03,0xb1f740b4};
-static void ogg_page_checksum_set(unsigned char *page, int len){
+static void ogg_page_checksum_set(unsigned char *page, oggp_int32 len){
oggp_uint32 crc_reg=0;
- int i;
+ oggp_int32 i;
/* safety; needed for API behavior, but not framing code */
page[22]=0;
@@ -131,7 +131,7 @@
} oggp_page;
struct oggpacker {
- int serialno;
+ oggp_int32 serialno;
unsigned char *buf;
unsigned char *alloc_buf;
unsigned char *user_buf;
@@ -153,7 +153,7 @@
};
/** Allocates an oggpacker object */
-oggpacker *oggp_create(int serialno) {
+oggpacker *oggp_create(oggp_int32 serialno) {
oggpacker *oggp;
oggp = malloc(sizeof(*oggp));
if (oggp == NULL) goto fail;
@@ -367,7 +367,7 @@
/** Get a pointer to the contents of the next available page. Pointer is
invalidated on the next call to oggp_get_next_page() or oggp_commit_packet(). */
-int oggp_get_next_page(oggpacker *oggp, unsigned char **page, int *bytes) {
+int oggp_get_next_page(oggpacker *oggp, unsigned char **page, oggp_int32 *bytes) {
oggp_page *p;
int i;
unsigned char *ptr;
@@ -400,7 +400,7 @@
/* 32 bits of stream serial number */
{
- long serialno=oggp->serialno;
+ oggp_int32 serialno=oggp->serialno;
for(i=14;i<18;i++){
ptr[i]=(unsigned char)(serialno&0xff);
serialno>>=8;
@@ -408,7 +408,7 @@
}
{
- long pageno=p->pageno;
+ oggp_int32 pageno=p->pageno;
for(i=18;i<22;i++){
ptr[i]=(unsigned char)(pageno&0xff);
pageno>>=8;
@@ -429,7 +429,7 @@
/** Creates a new (chained) stream. This closes all outstanding pages. These
pages remain available with oggp_get_next_page(). */
-int oggp_chain(oggpacker *oggp, int serialno) {
+int oggp_chain(oggpacker *oggp, oggp_int32 serialno) {
oggp_flush_page(oggp);
oggp->serialno = serialno;
oggp->curr_granule = 0;
--- a/src/ogg_packer.h
+++ b/src/ogg_packer.h
@@ -39,7 +39,7 @@
typedef struct oggpacker oggpacker;
/** Allocates an oggpacker object */
-oggpacker *oggp_create(int serialno);
+oggpacker *oggp_create(oggp_int32 serialno);
/** Frees memory associated with an oggpacker object */
void oggp_destroy(oggpacker *oggp);
@@ -65,11 +65,11 @@
/** Get a pointer to the contents of the next available page. Pointer is
invalidated on the next call to oggp_get_next_page() or oggp_commit_packet(). */
-int oggp_get_next_page(oggpacker *oggp, unsigned char **page, int *bytes);
+int oggp_get_next_page(oggpacker *oggp, unsigned char **page, oggp_int32 *bytes);
/** Creates a new (chained) stream. This closes all outstanding pages. These
pages remain available with oggp_get_next_page(). */
-int oggp_chain(oggpacker *oggp, int serialno);
+int oggp_chain(oggpacker *oggp, oggp_int32 serialno);
# if defined(__cplusplus)
}