Large reorganization of headers (WIP)

This commit is contained in:
Jeremy Soller
2018-08-26 08:11:35 -06:00
parent ff32c8cbbd
commit c20ce5ffed
261 changed files with 236 additions and 1672 deletions
+31
View File
@@ -0,0 +1,31 @@
use super::{constants, FILE};
use platform::types::*;
pub fn ftello(stream: &mut FILE) -> off_t {
let pos = stream.seek(
0,
if let Some((wbase, wpos, _)) = stream.write {
if (stream.flags & constants::F_APP > 0) && wpos > wbase {
constants::SEEK_END
} else {
constants::SEEK_CUR
}
} else {
constants::SEEK_CUR
},
);
if pos < 0 {
return pos;
}
let rdiff = if let Some((rpos, rend)) = stream.read {
rend - rpos
} else {
0
};
let wdiff = if let Some((wbase, wpos, _)) = stream.write {
wpos - wbase
} else {
0
};
pos - rdiff as i64 + wdiff as i64
}