mirror of
https://github.com/wez/wezterm.git
synced 2024-12-25 14:22:37 +03:00
fixup stream code for win32 portability
This commit is contained in:
parent
6c86e20b30
commit
39856e4d8a
@ -599,10 +599,14 @@ impl FreeTypeStream {
|
||||
|
||||
let name = source.name_or_path_str().to_string();
|
||||
|
||||
if len > c_ulong::MAX as usize {
|
||||
anyhow::bail!("{} is too large to pass to freetype! (len={})", name, len);
|
||||
}
|
||||
|
||||
let stream = Box::new(Self {
|
||||
stream: FT_StreamRec_ {
|
||||
base: base as *mut _,
|
||||
size: len as u64,
|
||||
size: len as c_ulong,
|
||||
pos: 0,
|
||||
descriptor: FT_StreamDesc_ {
|
||||
pointer: ptr::null_mut(),
|
||||
@ -638,6 +642,13 @@ impl FreeTypeStream {
|
||||
}
|
||||
|
||||
let len = meta.len();
|
||||
if len as usize > c_ulong::MAX as usize {
|
||||
anyhow::bail!(
|
||||
"{} is too large to pass to freetype! (len={})",
|
||||
p.display(),
|
||||
len
|
||||
);
|
||||
}
|
||||
|
||||
let (backing, base) = match unsafe { MmapOptions::new().map(&file) } {
|
||||
Ok(map) => {
|
||||
@ -657,7 +668,7 @@ impl FreeTypeStream {
|
||||
let stream = Box::new(Self {
|
||||
stream: FT_StreamRec_ {
|
||||
base,
|
||||
size: len,
|
||||
size: len as c_ulong,
|
||||
pos: 0,
|
||||
descriptor: FT_StreamDesc_ {
|
||||
pointer: ptr::null_mut(),
|
||||
@ -705,7 +716,7 @@ impl FreeTypeStream {
|
||||
0
|
||||
}
|
||||
StreamBacking::File(file) => {
|
||||
if let Err(err) = file.seek(SeekFrom::Start(offset)) {
|
||||
if let Err(err) = file.seek(SeekFrom::Start(offset.into())) {
|
||||
log::error!(
|
||||
"failed to seek {} to offset {}: {:#}",
|
||||
myself.name,
|
||||
|
Loading…
Reference in New Issue
Block a user