Skip to content

Commit 17ebb60

Browse files
committed
fix fallout
1 parent 5299740 commit 17ebb60

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

src/librustdoc/html/markdown.rs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ type blockcodefn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
7272
type headerfn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
7373
libc::c_int, *mut libc::c_void);
7474

75+
type linkfn = extern "C" fn (*mut hoedown_buffer, *const hoedown_buffer,
76+
*const hoedown_buffer, *const hoedown_buffer,
77+
*mut libc::c_void) -> libc::c_int;
78+
79+
type normaltextfn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
80+
*mut libc::c_void);
81+
7582
#[repr(C)]
7683
struct hoedown_renderer {
7784
opaque: *mut libc::c_void,
@@ -83,21 +90,18 @@ struct hoedown_renderer {
8390
*mut libc::c_void)>,
8491
header: Option<headerfn>,
8592

86-
other_block_level_callbacks: [libc::size_t, ..9],
93+
other_block_level_callbacks: [libc::size_t; 9],
8794

8895
/* span level callbacks - NULL or return 0 prints the span verbatim */
89-
other_span_level_callbacks_1: [libc::size_t, ..9],
90-
link: Option<extern "C" fn (*mut hoedown_buffer, *const hoedown_buffer,
91-
*const hoedown_buffer, *const hoedown_buffer,
92-
*mut libc::c_void) -> libc::c_int>,
93-
other_span_level_callbacks_2: [libc::size_t, ..5],
96+
other_span_level_callbacks_1: [libc::size_t; 9],
97+
link: Option<linkfn>,
98+
other_span_level_callbacks_2: [libc::size_t; 5],
9499
// hoedown will add `math` callback here, but we use an old version of it.
95100

96101
/* low level callbacks - NULL copies input directly into the output */
97102
entity: Option<extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
98103
*mut libc::c_void)>,
99-
normal_text: Option<extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
100-
*mut libc::c_void)>,
104+
normal_text: Option<normaltextfn>,
101105

102106
/* header and footer */
103107
doc_header: Option<extern "C" fn(*mut hoedown_buffer, *mut libc::c_void)>,
@@ -502,14 +506,18 @@ pub fn plain_summary_line(md: &str) -> String {
502506
let mut plain_renderer: hoedown_renderer = ::std::mem::zeroed();
503507
let renderer = &mut plain_renderer as *mut hoedown_renderer;
504508
(*renderer).opaque = ob as *mut libc::c_void;
505-
(*renderer).link = Some(link);
506-
(*renderer).normal_text = Some(normal_text);
509+
(*renderer).link = Some(link as linkfn);
510+
(*renderer).normal_text = Some(normal_text as normaltextfn);
507511

508512
let document = hoedown_document_new(renderer, HOEDOWN_EXTENSIONS, 16);
509513
hoedown_document_render(document, ob, md.as_ptr(),
510514
md.len() as libc::size_t);
511515
hoedown_document_free(document);
512-
let plain = String::from_raw_buf_len((*ob).data, (*ob).size as uint);
516+
let plain_slice = slice::from_raw_buf(&(*ob).data, (*ob).size as uint);
517+
let plain = match str::from_utf8(plain_slice) {
518+
Ok(s) => s.to_string(),
519+
Err(_) => "".to_string(),
520+
};
513521
hoedown_buffer_free(ob);
514522
plain
515523
}

src/librustdoc/html/render.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use html::markdown;
6767
use stability_summary;
6868

6969
/// A pair of name and its optional document.
70-
#[deriving(Clone, Eq, Ord, PartialEq, PartialOrd)]
70+
#[derive(Clone, Eq, Ord, PartialEq, PartialOrd)]
7171
pub struct NameDoc(String, Option<String>);
7272

7373
/// Major driving force in all rustdoc rendering. This contains information

src/librustdoc/html/static/main.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -671,10 +671,7 @@
671671

672672
function plainSummaryLine(markdown) {
673673
var str = markdown.replace(/\n/g, ' ')
674-
str = str.replace(/</g, "&lt;")
675-
str = str.replace(/>/g, "&gt;")
676-
str = str.replace(/"/g, "&quot;")
677-
str = str.replace(/'/g, "&#39;")
674+
str = str.replace(/'/g, "\'")
678675
str = str.replace(/^#+? (.+?)/, "$1")
679676
str = str.replace(/\[(.*?)\]\(.*?\)/g, "$1")
680677
str = str.replace(/\[(.*?)\]\[.*?\]/g, "$1")

0 commit comments

Comments
 (0)