andrdoid: Fix some compiler warnings (#34070)

This removes unused code in order to reduce the number of compiler
warnings on the Android build. Some of this code might be used in the
future and it can be restored from git commit history.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2024-10-30 13:20:43 +01:00 committed by GitHub
parent 517e8a376a
commit f12071f77e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 14 additions and 86 deletions

View file

@ -2,15 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::fs::File;
use std::io::Read;
use std::path::Path;
use std::sync::LazyLock;
use base::text::{is_cjk, UnicodeBlock, UnicodeBlockMethod};
use log::warn;
use malloc_size_of_derive::MallocSizeOf;
use serde::{Deserialize, Serialize};
use style::values::computed::font::GenericFontFamily;
use style::values::computed::{
FontStretch as StyleFontStretch, FontStyle as StyleFontStyle, FontWeight as StyleFontWeight,

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::ffi::CString;
use std::ffi::{CStr, CString};
use std::ptr;
use base::text::{UnicodeBlock, UnicodeBlockMethod};
@ -26,7 +26,7 @@ use style::values::computed::{FontStretch, FontStyle, FontWeight};
use style::Atom;
use unicode_script::Script;
use super::{c_str_to_string, LocalFontIdentifier};
use super::LocalFontIdentifier;
use crate::font::map_platform_values_to_style_values;
use crate::font_template::{FontTemplate, FontTemplateDescriptor};
use crate::platform::add_noto_fallback_families;
@ -289,3 +289,11 @@ fn font_weight_from_fontconfig_pattern(pattern: *mut FcPattern) -> Option<FontWe
let mapped_weight = map_platform_values_to_style_values(&mapping, weight as f64);
Some(FontWeight::from_float(mapped_weight as f32))
}
/// Creates a String from the given null-terminated buffer.
/// Panics if the buffer does not contain UTF-8.
unsafe fn c_str_to_string(s: *const c_char) -> String {
std::str::from_utf8(CStr::from_ptr(s).to_bytes())
.unwrap()
.to_owned()
}

View file

@ -3,26 +3,16 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::convert::TryInto;
use std::ffi::CStr;
use std::fs::File;
use std::path::{Path, PathBuf};
use std::str;
use libc::c_char;
use malloc_size_of_derive::MallocSizeOf;
use memmap2::Mmap;
use serde::{Deserialize, Serialize};
use style::Atom;
use webrender_api::NativeFontHandle;
/// Creates a String from the given null-terminated buffer.
/// Panics if the buffer does not contain UTF-8.
unsafe fn c_str_to_string(s: *const c_char) -> String {
str::from_utf8(CStr::from_ptr(s).to_bytes())
.unwrap()
.to_owned()
}
pub mod font;
#[cfg(all(target_os = "linux", not(target_env = "ohos"), not(ohos_mock)))]

View file

@ -3,8 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::collections::HashMap;
use std::ffi::OsStr;
use std::fs::File;
use std::io::Read;
use std::os::unix::ffi::OsStrExt;
use std::path::{Path, PathBuf};
use std::sync::LazyLock;
@ -13,7 +11,6 @@ use std::{fs, io};
use base::text::{UnicodeBlock, UnicodeBlockMethod};
use log::{debug, error, warn};
use malloc_size_of_derive::MallocSizeOf;
use serde::{Deserialize, Serialize};
use style::values::computed::font::GenericFontFamily;
use style::values::computed::{
FontStretch as StyleFontStretch, FontStyle as StyleFontStyle, FontWeight as StyleFontWeight,