Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to mozilla/rust@aa6725407ae0a2cb88458e147e76adf8bcae0961. #34

Merged
merged 2 commits into from May 9, 2014
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Remove instances of ~"".

  • Loading branch information
Ms2ger committed May 8, 2014
commit 3cd51f8722d724edbc06cb17a721b4266cea5c08
14 lib.rs
@@ -86,20 +86,20 @@ pub fn load_png_from_memory(image: &[u8]) -> Result<Image,~str> {
ptr::null(),
ptr::null());
if png_ptr.is_null() {
return Err(~"could not create read struct");
return Err("could not create read struct".to_owned());
}
let info_ptr = ffi::png_create_info_struct(&*png_ptr);
if info_ptr.is_null() {
let png_ptr: *ffi::png_struct = &*png_ptr;
ffi::png_destroy_read_struct(&png_ptr, ptr::null(), ptr::null());
return Err(~"could not create info struct");
return Err("could not create info struct".to_owned());
}
let res = ffi::setjmp(ffi::pngshim_jmpbuf(png_ptr));
if res != 0 {
let png_ptr: *ffi::png_struct = &*png_ptr;
let info_ptr: *ffi::png_info = &*info_ptr;
ffi::png_destroy_read_struct(&png_ptr, &info_ptr, ptr::null());
return Err(~"error reading png");
return Err("error reading png".to_owned());
}

let mut image_data = ImageData {
@@ -143,7 +143,7 @@ pub fn load_png_from_memory(image: &[u8]) -> Result<Image,~str> {
(ffi::COLOR_TYPE_PALETTE, 8) => (RGBA8, 4),
(ffi::COLOR_TYPE_GRAY, 8) => (K8, 1),
(ffi::COLOR_TYPE_GA, 8) => (KA8, 2),
_ => fail!(~"color type not supported"),
_ => fail!("color type not supported"),
};

let mut image_data = slice::from_elem((width * height * pixel_width) as uint, 0u8);
@@ -208,20 +208,20 @@ pub fn store_png(img: &Image, path: &Path) -> Result<(),~str> {
ptr::null(),
ptr::null());
if png_ptr.is_null() {
return Err(~"could not create write struct");
return Err("could not create write struct".to_owned());
}
let info_ptr = ffi::png_create_info_struct(&*png_ptr);
if info_ptr.is_null() {
let png_ptr: *ffi::png_struct = &*png_ptr;
ffi::png_destroy_write_struct(&png_ptr, ptr::null());
return Err(~"could not create info struct");
return Err("could not create info struct".to_owned());
}
let res = ffi::setjmp(ffi::pngshim_jmpbuf(png_ptr));
if res != 0 {
let png_ptr: *ffi::png_struct = &*png_ptr;
let info_ptr: *ffi::png_info = &*info_ptr;
ffi::png_destroy_write_struct(&png_ptr, &info_ptr);
return Err(~"error writing png");
return Err("error writing png".to_owned());
}

ffi::png_set_write_fn(png_ptr, cast::transmute(writer), write_data, flush_data);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.