Skip to content

Commit

Permalink
Auto merge of #11043 - heycam:attr, r=bholley
Browse files Browse the repository at this point in the history
Pass in string lengths to Gecko_GetAttrAsUTF8.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11043)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed May 6, 2016
2 parents e52b988 + 603a199 commit 0558687
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ports/geckolib/bindings.rs
Expand Up @@ -106,8 +106,8 @@ extern "C" {
-> *mut ServoComputedValues;
pub fn Servo_AddRefComputedValues(arg1: *mut ServoComputedValues);
pub fn Servo_ReleaseComputedValues(arg1: *mut ServoComputedValues);
pub fn Gecko_GetAttrAsUTF8(element: *mut RawGeckoElement, ns: *const u8,
name: *const u8, length: *mut u32)
pub fn Gecko_GetAttrAsUTF8(element: *mut RawGeckoElement, ns: *const u8, nslen: u32,
name: *const u8, namelen: u32, length: *mut u32)
-> *const ::std::os::raw::c_char;
pub fn Gecko_GetAtomAsUTF16(atom: *mut nsIAtom, length: *mut u32)
-> *const u16;
Expand Down
4 changes: 3 additions & 1 deletion ports/geckolib/wrapper.rs
Expand Up @@ -344,7 +344,9 @@ impl<'le> TElement for GeckoElement<'le> {
fn get_attr<'a>(&'a self, namespace: &Namespace, name: &Atom) -> Option<&'a str> {
unsafe {
let mut length: u32 = 0;
let ptr = Gecko_GetAttrAsUTF8(self.element, namespace.0.as_ptr(), name.as_ptr(), &mut length);
let ptr = Gecko_GetAttrAsUTF8(self.element,
namespace.0.as_ptr(), namespace.0.len() as u32,
name.as_ptr(), name.len() as u32, &mut length);
reinterpret_string(ptr, length)
}
}
Expand Down

0 comments on commit 0558687

Please sign in to comment.