Skip to content

Commit

Permalink
Rust return types
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasdenH committed Nov 28, 2019
1 parent db68fb4 commit c580958
Show file tree
Hide file tree
Showing 11 changed files with 167 additions and 181 deletions.
18 changes: 9 additions & 9 deletions dpx/src/dpx_agl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
mutable_transmutes,
non_camel_case_types,
non_snake_case,
non_upper_case_globals,
non_upper_case_globals
)]

use crate::DisplayExt;
Expand Down Expand Up @@ -385,11 +385,11 @@ pub unsafe fn agl_init_map() {
&mut aglmap,
Some(hval_free as unsafe fn(_: *mut libc::c_void) -> ()),
);
agl_load_listfile(b"texglyphlist.txt\x00" as *const u8 as *const i8, 0i32);
if agl_load_listfile(b"pdfglyphlist.txt\x00" as *const u8 as *const i8, 1i32) < 0i32 {
agl_load_listfile(b"texglyphlist.txt\x00" as *const u8 as *const i8, 0);
if agl_load_listfile(b"pdfglyphlist.txt\x00" as *const u8 as *const i8, 1).is_err() {
warn!("Failed to load AGL file \"{}\"...", "pdfglyphlist.txt");
}
if agl_load_listfile(b"glyphlist.txt\x00" as *const u8 as *const i8, 0i32) < 0i32 {
if agl_load_listfile(b"glyphlist.txt\x00" as *const u8 as *const i8, 0).is_err() {
warn!("Failed to load AGL file \"{}\"...", "glyphlist.txt");
};
}
Expand All @@ -404,19 +404,19 @@ pub unsafe fn agl_close_map() {
* http://partners.adobe.com/asn/tech/type/unicodegn.jsp
*/
/* Hash */
unsafe fn agl_load_listfile(filename: *const i8, is_predef: i32) -> i32 {
let mut count: i32 = 0i32;
unsafe fn agl_load_listfile(filename: *const i8, is_predef: i32) -> Result<u32, ()> {
let mut count: u32 = 0;
let mut wbuf: [i8; 1024] = [0; 1024];
if filename.is_null() {
return -1i32;
return Err(());
}
let handle = dpx_tt_open(
filename,
b".txt\x00" as *const u8 as *const i8,
TTInputFormat::FONTMAP,
);
if handle.is_none() {
return -1i32;
return Err(());
}
let mut handle = handle.unwrap();
if verbose != 0 {
Expand Down Expand Up @@ -529,7 +529,7 @@ unsafe fn agl_load_listfile(filename: *const i8, is_predef: i32) -> i32 {
if verbose != 0 {
info!(">");
}
count
Ok(count)
}

pub unsafe fn agl_lookup_list(glyphname: *const i8) -> *mut agl_name {
Expand Down
Loading

0 comments on commit c580958

Please sign in to comment.