Bug 1857843 - Apply local patches to libogg. r=media-playback-reviewers,padenot

Differential Revision: https://phabricator.services.mozilla.com/D190528
This commit is contained in:
Chris Peterson 2023-10-14 05:13:32 +00:00
parent 9946c9f7c6
commit 3af5a32f4f
3 changed files with 72 additions and 6 deletions

View File

@ -201,6 +201,10 @@ extern int ogg_page_packets(const ogg_page *og);
extern void ogg_packet_clear(ogg_packet *op);
extern void ogg_set_mem_functions(ogg_malloc_function_type *malloc_func,
ogg_calloc_function_type *calloc_func,
ogg_realloc_function_type *realloc_func,
ogg_free_function_type *free_func);
#ifdef __cplusplus
}

View File

@ -16,12 +16,33 @@
#ifndef _OS_TYPES_H
#define _OS_TYPES_H
/* make it easy on the folks that want to compile the libs with a
different malloc than stdlib */
#define _ogg_malloc malloc
#define _ogg_calloc calloc
#define _ogg_realloc realloc
#define _ogg_free free
#include <stddef.h>
/* We indirect mallocs through settable-at-runtime functions to accommodate
memory reporting in the browser. */
#ifdef __cplusplus
extern "C" {
#endif
typedef void* (ogg_malloc_function_type)(size_t);
typedef void* (ogg_calloc_function_type)(size_t, size_t);
typedef void* (ogg_realloc_function_type)(void*, size_t);
typedef void (ogg_free_function_type)(void*);
extern ogg_malloc_function_type *ogg_malloc_func;
extern ogg_calloc_function_type *ogg_calloc_func;
extern ogg_realloc_function_type *ogg_realloc_func;
extern ogg_free_function_type *ogg_free_func;
#ifdef __cplusplus
}
#endif
#define _ogg_malloc ogg_malloc_func
#define _ogg_calloc ogg_calloc_func
#define _ogg_realloc ogg_realloc_func
#define _ogg_free ogg_free_func
#if defined(_WIN32)
@ -78,6 +99,16 @@
typedef int64_t ogg_int64_t;
typedef u_int64_t ogg_uint64_t;
#elif defined(__sun__)
/* Solaris and derivatives */
# include <inttypes.h>
typedef int16_t ogg_int16_t;
typedef uint16_t ogg_uint16_t;
typedef int32_t ogg_int32_t;
typedef uint32_t ogg_uint32_t;
typedef int64_t ogg_int64_t;
#elif defined(__HAIKU__)
/* Haiku */

View File

@ -0,0 +1,31 @@
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
* by the Xiph.Org Foundation http://www.xiph.org/ *
* *
*********************************************************************/
#include <stdlib.h>
#include "ogg/os_types.h"
ogg_malloc_function_type *ogg_malloc_func = malloc;
ogg_calloc_function_type *ogg_calloc_func = calloc;
ogg_realloc_function_type *ogg_realloc_func = realloc;
ogg_free_function_type *ogg_free_func = free;
void
ogg_set_mem_functions(ogg_malloc_function_type *malloc_func,
ogg_calloc_function_type *calloc_func,
ogg_realloc_function_type *realloc_func,
ogg_free_function_type *free_func)
{
ogg_malloc_func = malloc_func;
ogg_calloc_func = calloc_func;
ogg_realloc_func = realloc_func;
ogg_free_func = free_func;
}