Skip to content

Commit

Permalink
Fix compilation on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Nov 5, 2024
1 parent 103424e commit 6e271c4
Showing 1 changed file with 18 additions and 26 deletions.
44 changes: 18 additions & 26 deletions bzip2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1412,52 +1412,44 @@ unsafe extern "C" fn mySignalCatcher(_: IntNative) {
}
unsafe fn mySIGSEGVorSIGBUScatcher(_: IntNative) {
let mut msg: *const libc::c_char = std::ptr::null::<libc::c_char>();
if opMode == 1 as libc::c_int {
if opMode == 1 {
msg = b": Caught a SIGSEGV or SIGBUS whilst compressing.\n\n Possible causes are (most likely first):\n (1) This computer has unreliable memory or cache hardware\n (a surprisingly common problem; try a different machine.)\n (2) A bug in the compiler used to create this executable\n (unlikely, if you didn't compile bzip2 yourself.)\n (3) A real bug in bzip2 -- I hope this should never be the case.\n The user's manual, Section 4.3, has more info on (1) and (2).\n \n If you suspect this is a bug in bzip2, or are unsure about (1)\n or (2), report it at: https://gitlab.com/bzip2/bzip2/-/issues\n Section 4.3 of the user's manual describes the info a useful\n bug report should have. If the manual is available on your\n system, please try and read it before mailing me. If you don't\n have the manual or can't be bothered to read it, mail me anyway.\n\n\0"
as *const u8 as *const libc::c_char;
} else {
msg = b": Caught a SIGSEGV or SIGBUS whilst decompressing.\n\n Possible causes are (most likely first):\n (1) The compressed data is corrupted, and bzip2's usual checks\n failed to detect this. Try bzip2 -tvv my_file.bz2.\n (2) This computer has unreliable memory or cache hardware\n (a surprisingly common problem; try a different machine.)\n (3) A bug in the compiler used to create this executable\n (unlikely, if you didn't compile bzip2 yourself.)\n (4) A real bug in bzip2 -- I hope this should never be the case.\n The user's manual, Section 4.3, has more info on (2) and (3).\n \n If you suspect this is a bug in bzip2, or are unsure about (2)\n or (3), report it at: https://gitlab.com/bzip2/bzip2/-/issues\n Section 4.3 of the user's manual describes the info a useful\n bug report should have. If the manual is available on your\n system, please try and read it before mailing me. If you don't\n have the manual or can't be bothered to read it, mail me anyway.\n\n\0"
as *const u8 as *const libc::c_char;
}
write(2, b"\n" as *const u8 as *const libc::c_void, 1);
write(2, progName as *const libc::c_void, strlen(progName) as _);
write(2, msg as *const libc::c_void, strlen(msg) as _);
msg = b"\tInput file = \0" as *const u8 as *const libc::c_char;
write(
2 as libc::c_int,
b"\n\0" as *const u8 as *const libc::c_char as *const libc::c_void,
1 as libc::c_int as size_t,
);
write(
2 as libc::c_int,
progName as *const libc::c_void,
strlen(progName),
msg as *const libc::c_void,
strlen(msg) as _,
);
write(2 as libc::c_int, msg as *const libc::c_void, strlen(msg));
msg = b"\tInput file = \0" as *const u8 as *const libc::c_char;
write(2 as libc::c_int, msg as *const libc::c_void, strlen(msg));
write(
2 as libc::c_int,
2,
inName.as_mut_ptr() as *const libc::c_void,
strlen(inName.as_mut_ptr()),
strlen(inName.as_mut_ptr()) as _,
);
write(
2 as libc::c_int,
2,
b"\n\0" as *const u8 as *const libc::c_char as *const libc::c_void,
1 as libc::c_int as size_t,
1,
);
msg = b"\tOutput file = \0" as *const u8 as *const libc::c_char;
write(2 as libc::c_int, msg as *const libc::c_void, strlen(msg));
write(2, msg as *const libc::c_void, strlen(msg) as _);
write(
2 as libc::c_int,
2,
outName.as_mut_ptr() as *const libc::c_void,
strlen(outName.as_mut_ptr()),
);
write(
2 as libc::c_int,
b"\n\0" as *const u8 as *const libc::c_char as *const libc::c_void,
1 as libc::c_int as size_t,
strlen(outName.as_mut_ptr()) as _,
);
if opMode == 1 as libc::c_int {
setExit(3 as libc::c_int);
write(2, b"\n" as *const u8 as *const libc::c_void, 1);
if opMode == 1 {
setExit(3);
} else {
setExit(2 as libc::c_int);
setExit(2);
}
_exit(exitValue);
}
Expand Down

0 comments on commit 6e271c4

Please sign in to comment.