mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Fix some build warnings
- Mark some instances of unused fields and variables as as allowed, when they are used for memory management. - Remove the use of some deprecated function.s Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
9a03911abf
commit
c021df027a
5 changed files with 11 additions and 12 deletions
|
@ -68,12 +68,15 @@ struct OS2Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[allow(unused)]
|
||||||
pub struct FontHandle {
|
pub struct FontHandle {
|
||||||
// The font binary. This must stay valid for the lifetime of the font,
|
// The font binary. This must stay valid for the lifetime of the font,
|
||||||
// if the font is created using FT_Memory_Face.
|
// if the font is created using FT_Memory_Face.
|
||||||
font_data: Arc<FontTemplateData>,
|
font_data: Arc<FontTemplateData>,
|
||||||
face: FT_Face,
|
face: FT_Face,
|
||||||
handle: FontContextHandle,
|
// `context_handle` is unused, but here to ensure that the underlying
|
||||||
|
// FreeTypeLibraryHandle is not dropped.
|
||||||
|
context_handle: FontContextHandle,
|
||||||
can_do_fast_shaping: bool,
|
can_do_fast_shaping: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +147,7 @@ impl FontHandleMethods for FontHandle {
|
||||||
let mut handle = FontHandle {
|
let mut handle = FontHandle {
|
||||||
face: face,
|
face: face,
|
||||||
font_data: template,
|
font_data: template,
|
||||||
handle: fctx.clone(),
|
context_handle: fctx.clone(),
|
||||||
can_do_fast_shaping: false,
|
can_do_fast_shaping: false,
|
||||||
};
|
};
|
||||||
// TODO (#11310): Implement basic support for GPOS and GSUB.
|
// TODO (#11310): Implement basic support for GPOS and GSUB.
|
||||||
|
|
|
@ -75,6 +75,7 @@ pub struct FreeTypeLibraryHandle {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for FreeTypeLibraryHandle {
|
impl Drop for FreeTypeLibraryHandle {
|
||||||
|
#[allow(unused)]
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
assert!(!self.ctx.is_null());
|
assert!(!self.ctx.is_null());
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -130,11 +131,7 @@ impl FontContextHandle {
|
||||||
FT_Add_Default_Modules(ctx);
|
FT_Add_Default_Modules(ctx);
|
||||||
|
|
||||||
FontContextHandle {
|
FontContextHandle {
|
||||||
ctx: Rc::new(FreeTypeLibraryHandle {
|
ctx: Rc::new(FreeTypeLibraryHandle { ctx, mem, user }),
|
||||||
ctx: ctx,
|
|
||||||
mem: mem,
|
|
||||||
user: user,
|
|
||||||
}),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,6 +115,7 @@ impl Deref for ServoJSPrincipalsRef<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
pub unsafe extern "C" fn destroy_servo_jsprincipal(principals: *mut JSPrincipals) {
|
pub unsafe extern "C" fn destroy_servo_jsprincipal(principals: *mut JSPrincipals) {
|
||||||
Box::from_raw(GetRustJSPrincipalsPrivate(principals) as *mut MutableOrigin);
|
Box::from_raw(GetRustJSPrincipalsPrivate(principals) as *mut MutableOrigin);
|
||||||
DestroyRustJSPrincipals(principals);
|
DestroyRustJSPrincipals(principals);
|
||||||
|
|
|
@ -38,7 +38,7 @@ use dom_struct::dom_struct;
|
||||||
use euclid::default::{Rect, Size2D};
|
use euclid::default::{Rect, Size2D};
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
use image::codecs::png::PngEncoder;
|
use image::codecs::png::PngEncoder;
|
||||||
use image::ColorType;
|
use image::{ColorType, ImageEncoder};
|
||||||
use ipc_channel::ipc::{self as ipcchan, IpcSharedMemory};
|
use ipc_channel::ipc::{self as ipcchan, IpcSharedMemory};
|
||||||
use js::error::throw_type_error;
|
use js::error::throw_type_error;
|
||||||
use js::rust::HandleValue;
|
use js::rust::HandleValue;
|
||||||
|
@ -427,7 +427,7 @@ impl HTMLCanvasElementMethods for HTMLCanvasElement {
|
||||||
// FIXME(nox): https://github.com/image-rs/image-png/issues/86
|
// FIXME(nox): https://github.com/image-rs/image-png/issues/86
|
||||||
// FIXME(nox): https://github.com/image-rs/image-png/issues/87
|
// FIXME(nox): https://github.com/image-rs/image-png/issues/87
|
||||||
PngEncoder::new(&mut png)
|
PngEncoder::new(&mut png)
|
||||||
.encode(&file, self.Width(), self.Height(), ColorType::Rgba8)
|
.write_image(&file, self.Width(), self.Height(), ColorType::Rgba8)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let mut url = "data:image/png;base64,".to_owned();
|
let mut url = "data:image/png;base64,".to_owned();
|
||||||
// FIXME(nox): Should this use base64::URL_SAFE?
|
// FIXME(nox): Should this use base64::URL_SAFE?
|
||||||
|
|
|
@ -51,9 +51,7 @@ impl ServoUrl {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn into_string(self) -> String {
|
pub fn into_string(self) -> String {
|
||||||
Arc::try_unwrap(self.0)
|
String::from(Arc::try_unwrap(self.0).unwrap_or_else(|s| (*s).clone()))
|
||||||
.unwrap_or_else(|s| (*s).clone())
|
|
||||||
.into_string()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn into_url(self) -> Url {
|
pub fn into_url(self) -> Url {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue