Skip to content

Commit

Permalink
Fixes for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Nov 6, 2024
1 parent cef00c2 commit 7047c2c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions bzip2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ use libbzip2_rs_sys::bzlib::{
BZ2_bzWriteClose64, BZ2_bzWriteOpen, BZ2_bzlibVersion,
};

#[cfg(target_env = "msvc")]
use libc::_stati64 as lstat;
#[cfg(not(target_env = "msvc"))]
use libc::lstat;
use libc::{
_exit, close, exit, fchmod, fchown, fclose, fdopen, ferror, fflush, fgetc, fileno, fopen,
fprintf, fread, free, fwrite, getenv, isatty, lstat, malloc, open, perror, remove, rewind,
signal, size_t, stat, strcat, strcmp, strcpy, strlen, strncmp, strncpy, strstr, ungetc,
utimbuf, utime, write, FILE,
fprintf, fread, free, fwrite, getenv, isatty, malloc, open, perror, remove, rewind, signal,
size_t, stat, strcat, strcmp, strcpy, strlen, strncmp, strncpy, strstr, ungetc, utimbuf, utime,
write, FILE,
};
extern "C" {
static mut stdin: *mut FILE;
Expand Down Expand Up @@ -1555,6 +1559,7 @@ unsafe fn saveInputFileMetaInfo(mut srcName: *mut c_char) {
ioError();
}
}
#[cfg(unix)]
unsafe fn applySavedTimeInfoToOutputFile(mut dstName: *mut c_char) {
let mut retVal: IntNative = 0;
let mut uTimBuf: utimbuf = utimbuf {
Expand All @@ -1568,6 +1573,9 @@ unsafe fn applySavedTimeInfoToOutputFile(mut dstName: *mut c_char) {
ioError();
}
}
#[cfg(not(unix))]
unsafe fn applySavedTimeInfoToOutputFile(_dstName: *mut c_char) {}
#[cfg(unix)]
unsafe fn applySavedFileAttrToOutputFile(mut fd: IntNative) {
let mut retVal: IntNative = 0;
retVal = fchmod(fd, fileMetaInfo.st_mode);
Expand All @@ -1576,6 +1584,8 @@ unsafe fn applySavedFileAttrToOutputFile(mut fd: IntNative) {
}
fchown(fd, fileMetaInfo.st_uid, fileMetaInfo.st_gid);
}
#[cfg(not(unix))]
unsafe fn applySavedFileAttrToOutputFile(_fd: IntNative) {}
unsafe fn containsDubiousChars(_: *mut c_char) -> Bool {
0
}
Expand Down

0 comments on commit 7047c2c

Please sign in to comment.