Closed Bug 1318428 Opened 8 years ago Closed 8 years ago

Use nsstring bindings in rust-url-capi

Categories

(Core :: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: manishearth, Assigned: nika)

References

Details

(Whiteboard: [necko-active])

Attachments

(1 file)

We should use Michael's nsstring bindings in rust-url-capi instead of the c_fn_get_buffer stuff.
Depends on: 1319083
This patch also drops the pretense that rust-url-capi will be used from outside of c++, or that it will be used outside of mozilla-central, removing the ifdef __cplusplus code, and including the C++ header "nsString.h". MozReview-Commit-ID: BULhHf3DObe
Attachment #8812790 - Flags: review?(valentin.gosu)
Assignee: nobody → michael
Attachment #8812790 - Flags: review?(manishearth)
Comment on attachment 8812790 [details] [diff] [review] Use the nsstring bindings in rust-url-capi Review of attachment 8812790 [details] [diff] [review]: ----------------------------------------------------------------- LGTM. Needs peer review to land. Have you tested it with network logging to see if it's still largely working? It shouldn't complain about mismatches on regular sites but will complain with malformed IDNA like https://github.com/servo/rust-url/issues/207
Attachment #8812790 - Flags: review?(manishearth) → review+
Comment on attachment 8812790 [details] [diff] [review] Use the nsstring bindings in rust-url-capi Review of attachment 8812790 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me. Please do a try run before pushing. ::: netwerk/base/rust-url-capi/src/lib.rs @@ +70,4 @@ > if urlptr.is_null() { > return NSError::InvalidArg.error_code(); > } > + let url = &*(urlptr as *const Url); Is there an advantage to using this syntax instead of let url: &Url = mem::transmute(urlptr); ?
Attachment #8812790 - Flags: review?(valentin.gosu) → review+
> Is there an advantage to using this syntax instead of let url: &Url = mem::transmute(urlptr); ? Generally good style to avoid transmuting when you can do it a different way. Transmutes are a swiss army knife, and just as pointy -- if the type of the argument changed here you may end up transmuting the wrong thing, whereas you'd be protected from that to some degree with this.
Whiteboard: [necko-active]
Pushed by michael@thelayzells.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/bd1c7797c866 Use the nsstring bindings in rust-url-capi, r=valentin
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: