Skip to content

Commit

Permalink
Run rustfmt.
Browse files Browse the repository at this point in the history
  • Loading branch information
crlf0710 committed Nov 27, 2019
1 parent a5a5bc4 commit 1d7c90d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 29 deletions.
26 changes: 9 additions & 17 deletions dpx/src/dpx_pdfobj.rs
Original file line number Diff line number Diff line change
Expand Up @@ -989,11 +989,7 @@ pub unsafe fn pdf_string_length(object: &pdf_obj) -> u32 {
* characters in an output string.
*/

pub unsafe fn pdfobj_escape_str(
buffer: &mut [u8],
s: *const u8,
len: size_t,
) -> size_t {
pub unsafe fn pdfobj_escape_str(buffer: &mut [u8], s: *const u8, len: size_t) -> size_t {
let bufsize = buffer.len();
let mut result = 0;
for i in 0..len {
Expand All @@ -1011,11 +1007,11 @@ pub unsafe fn pdfobj_escape_str(
result += 1;
write!(&mut buffer[result..], "{:03o}", ch);
result += 3;
/*result = (result as u64).wrapping_add(sprintf(
buffer.offset(result as isize),
b"%03o\x00" as *const u8 as *const i8,
ch as i32,
) as u64) as size_t as size_t*/
/*result = (result as u64).wrapping_add(sprintf(
buffer.offset(result as isize),
b"%03o\x00" as *const u8 as *const i8,
ch as i32,
) as u64) as size_t as size_t*/
} else {
match ch {
40 => {
Expand Down Expand Up @@ -1097,11 +1093,8 @@ unsafe fn write_string(strn: &pdf_string, handle: &mut OutputHandleWrapper) {
* handled as quickly as possible since there are so many of them.
*/
for i in 0..len {
let count = pdfobj_escape_str(
&mut wbuf[..],
&mut *s.offset(i as isize),
1i32 as size_t,
) as usize;
let count = pdfobj_escape_str(&mut wbuf[..], &mut *s.offset(i as isize), 1i32 as size_t)
as usize;
pdf_out(handle, &wbuf[..count]);
}
pdf_out_char(handle, b')');
Expand Down Expand Up @@ -3181,8 +3174,7 @@ unsafe fn pdf_new_ref(object: *mut pdf_obj) -> *mut pdf_obj {
if (*object).label() == 0 {
pdf_label_obj(object);
}
let result =
pdf_indirect::new(ptr::null_mut(), (*object).id).into_obj();
let result = pdf_indirect::new(ptr::null_mut(), (*object).id).into_obj();
let ref mut fresh28 = (*((*result).data as *mut pdf_indirect)).obj;
*fresh28 = object;
result
Expand Down
14 changes: 4 additions & 10 deletions engine/src/xetex_font_manager_fontconfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ pub unsafe extern "C" fn XeTeXFontMgr_FC_searchForHostPlatformFonts(
b"fullname\x00" as *const u8 as *const libc::c_char,
i,
&mut s as *mut *mut libc::c_char as *mut *mut FcChar8,
) == FcResultMatch
) == FcResultMatch
{
if CStr::from_ptr(name) == CStr::from_ptr(s) {
let mut names_0: *mut XeTeXFontMgrNameCollection =
Expand All @@ -612,18 +612,15 @@ pub unsafe extern "C" fn XeTeXFontMgr_FC_searchForHostPlatformFonts(
b"family\x00" as *const u8 as *const libc::c_char,
i,
&mut s as *mut *mut libc::c_char as *mut *mut FcChar8,
) == FcResultMatch
) == FcResultMatch
{
if CStr::from_ptr(name) == CStr::from_ptr(s)
|| hyph != 0 && (&**famName == CStr::from_ptr(s))
{
let mut names_1: *mut XeTeXFontMgrNameCollection =
XeTeXFontMgr_readNames(self_0, pat);
XeTeXFontMgr_addToMaps(self_0, pat, names_1);
XeTeXFontMgr_cacheFamilyMembers(
self_0,
(*names_1).m_familyNames,
);
XeTeXFontMgr_cacheFamilyMembers(self_0, (*names_1).m_familyNames);
XeTeXFontMgrNameCollection_delete(names_1);
found = true;
continue 'traverse_fonts;
Expand Down Expand Up @@ -651,10 +648,7 @@ pub unsafe extern "C" fn XeTeXFontMgr_FC_searchForHostPlatformFonts(
let mut names_2: *mut XeTeXFontMgrNameCollection =
XeTeXFontMgr_readNames(self_0, pat);
XeTeXFontMgr_addToMaps(self_0, pat, names_2);
XeTeXFontMgr_cacheFamilyMembers(
self_0,
(*names_2).m_familyNames,
);
XeTeXFontMgr_cacheFamilyMembers(self_0, (*names_2).m_familyNames);
XeTeXFontMgrNameCollection_delete(names_2);
found = true;
continue 'traverse_fonts;
Expand Down
2 changes: 1 addition & 1 deletion engine/src/xetex_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ pub unsafe extern "C" fn get_uni_c(mut f: *mut UFILE) -> i32 {
}
bad_utf8_warning();
return 0xFFFD; /* return without adjusting by offsetsFromUTF8 */
}
}
rval <<= 6;
rval += c;
}
Expand Down
2 changes: 1 addition & 1 deletion engine/src/xetex_pagebuilder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ pub unsafe extern "C" fn build_page() {
if *NODE_type(slf.p as isize) < GLUE_NODE || *NODE_type(slf.p as isize) > KERN_NODE {
return contribute(slf);
}

return update_heights(slf);

unsafe fn update_heights(mut slf: Args) -> (Args, bool) {
Expand Down

0 comments on commit 1d7c90d

Please sign in to comment.