mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-11-16 09:11:12 +00:00
Declare realloc by hand for Rust 1.99
rustc 1.99 adds the suspicious_runtime_symbol_definitions lint, which fires on the bindgen-generated realloc binding because bindgen types its size argument as c_ulong rather than usize. With -D warnings this fails the format_rust check on the toolchain bump. Declare realloc next to free in ffi_alloc.rs with the size_t-correct signature and drop it from the bindgen allowlist. The only caller, avc/core.rs, now imports it from there. No behaviour change.
This commit is contained in:
@@ -30,7 +30,6 @@ fn main() {
|
||||
"store_hdcc",
|
||||
"do_cb",
|
||||
"decode_vbi",
|
||||
"realloc",
|
||||
"write_spumux_footer",
|
||||
"write_spumux_header",
|
||||
]);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
use crate::avc::common_types::*;
|
||||
use crate::avc::nal::*;
|
||||
use crate::avc::sei::*;
|
||||
use crate::bindings::{cc_subtitle, encoder_ctx, lib_cc_decode, realloc};
|
||||
use crate::bindings::{cc_subtitle, encoder_ctx, lib_cc_decode};
|
||||
use crate::ctorust::FromCType;
|
||||
use crate::ffi_alloc::realloc;
|
||||
use crate::libccxr_exports::time::ccxr_set_fts;
|
||||
use crate::{anchor_hdcc, current_fps, process_hdcc, store_hdcc, MPEG_CLOCK_FREQ};
|
||||
use lib_ccxr::common::AvcNalType;
|
||||
|
||||
@@ -2,6 +2,10 @@ use std::os::raw::c_void;
|
||||
|
||||
extern "C" {
|
||||
fn free(ptr: *mut c_void);
|
||||
// Declared here rather than through bindgen: bindgen types the size as
|
||||
// `c_ulong`, which rustc >= 1.99 flags as a mismatched definition of a
|
||||
// runtime symbol (`suspicious_runtime_symbol_definitions`).
|
||||
pub fn realloc(ptr: *mut c_void, size: usize) -> *mut c_void;
|
||||
}
|
||||
/// Frees memory allocated by C code (malloc/calloc)
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user