Restore unsafe to mp4parse_read and mp4parse_free.
Restore unsafe to mp4parse_read and mp4parse_free.

This definitely isn't prettier, but based on irc discussion
my understanding is this is still important. Rust allows one
to *construct* invalid pointers. It's only *dereference* which
requires unsafe. So it's useful to declare unsafe any function
which could dereference a raw pointer argument.

In

  fn foo(p: *const u8) { ... }
  foo(1 as *const u8);

the caller has an expectation of safety, despite passing an
invalid pointer. If foo() crashes, that's foo's fault for
not enforcing safety outside its internal unsafe blocks.

While

  unsafe fn foo(p: *const u8) { ... }
  unsafe { foo(1 as *const u8); }

crashing is the caller's fault for passing an invalid pointer
to a function which declared it might dereference it.

I kind of expected any function with raw pointer arguments to
be unsafe, but the language allows

  fn foo(p: *const u8) { println!("ptr {:?}", p): }

which is, in fact, safe, and something one might do.

Clearly, 'unsafe' is a technical term here.

All of this is moot in a C api, of course, but it's good
practice, and I'm writing rust unit tests.

kinetiknz/mp4parse-rust,mozilla/mp4parse-rust,kinetiknz/mp4parse-rust