mp4v2 icon indicating copy to clipboard operation
mp4v2 copied to clipboard

Compilation error?

Open jD91mZM2 opened this issue 8 years ago • 4 comments

I'm trying to compile rust-media, and this dependency fails to build with

src/rtphint.cpp: In member function ‘void mp4v2::impl::MP4RtpHintTrack::GetPayload(char**, uint8_t*, uint16_t*, char**)’:
src/rtphint.cpp:342:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
                     if (pSlash != '\0') {

make: *** [makefile.cargo:155: /home/jD91mZM2/Downloads/rust-media/example/target/debug/build/mp4v2-sys-55f4f2479eafe4d1/out/src/rtphint.o] Error 1
make: *** Waiting for unfinished jobs....
thread 'main' panicked at 'assertion failed: result.success()', /home/jD91mZM2/.cargo/git/checkouts/mp4v2-631e8f3a85428d68/a6d29cd/build.rs:17:5

jD91mZM2 avatar Apr 08 '18 08:04 jD91mZM2

Based on the context of that line (if pSlash points to a /, advance the pointer and evaluate what character it points to) it was probably meant to be if (*pSlash != '\0') { to check whether the string has ended.

Arnavion avatar Jul 12 '18 11:07 Arnavion

Any solution to this? rust-media is still affected by this bug.

aegroto avatar Apr 12 '21 14:04 aegroto

Same error here.

NullBhikkhu avatar Sep 20 '21 06:09 NullBhikkhu

This error is sort of funny.

Just two lines above the offending one, you'll see:

if (pSlash != NULL) {

Given that '\0' expresses 0, and NULL expresses 0, both of these lines, as written, sort of ask the same question... except that g++ is smart enough to recognize '\0' as a character 0 rather than a literal 0.

Consequently, Arnavion's answer has to be correct... the author must have intended if (*pSlash != '\0') {. And, in fact, I made this change in ~/.cargo/git/checkouts/mp4v2-631e8f3a85428d68/a6d29cd/src/rtphint.cpp and built the resulting change, and it compiles successfully.

(Unfortunately, it isn't enough to get rust-media to compile, as that project has another problem).

tvanriper avatar Jan 22 '22 09:01 tvanriper