mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Merge pull request #40 from photex/master
A few fixes for compatibility with rust-master
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#[macro_escape];
|
||||
|
||||
use std::io::buffered::BufferedWriter;
|
||||
use std::io::BufferedWriter;
|
||||
use std::io::{File, Writer};
|
||||
use std::str::CharIterator;
|
||||
use std::str::Chars;
|
||||
|
||||
struct ParseBranch {
|
||||
matches: ~[u8],
|
||||
@@ -23,7 +23,7 @@ impl ParseBranch {
|
||||
pub fn branchify(options: &[(&str, &str)], case_sensitive: bool) -> ~[ParseBranch] {
|
||||
let mut root = ParseBranch::new();
|
||||
|
||||
fn go_down_moses(branch: &mut ParseBranch, mut chariter: CharIterator, result: &str, case_sensitive: bool) {
|
||||
fn go_down_moses(branch: &mut ParseBranch, mut chariter: Chars, result: &str, case_sensitive: bool) {
|
||||
match chariter.next() {
|
||||
Some(c) => {
|
||||
let first_case = if case_sensitive { c as u8 } else { c.to_ascii().to_upper().to_byte() };
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
#[crate_id = "codegen#0.1"];
|
||||
|
||||
use std::os;
|
||||
use std::io::buffered::BufferedWriter;
|
||||
use std::io::BufferedWriter;
|
||||
use std::io::File;
|
||||
use std::io;
|
||||
use std::io::stdio::println;
|
||||
|
||||
+8
-4
@@ -685,8 +685,10 @@ fn wrap_event(raw: ll::SDL_Event) -> Event {
|
||||
Ok(window) => window,
|
||||
};
|
||||
|
||||
let text = str::from_utf8_owned(event.text.iter().take_while(|b| (**b) != 0i8).map(|b| b.to_u8().unwrap()).collect::<~[u8]>());
|
||||
|
||||
let text = match str::from_utf8_owned(event.text.iter().take_while(|b| (**b) != 0i8).map(|b| b.to_u8().unwrap()).collect::<~[u8]>()) {
|
||||
Some(t) => t,
|
||||
None => ~""
|
||||
};
|
||||
TextEditingEvent(event.timestamp as uint, window, text,
|
||||
event.start as int, event.length as int)
|
||||
}
|
||||
@@ -701,8 +703,10 @@ fn wrap_event(raw: ll::SDL_Event) -> Event {
|
||||
Ok(window) => window,
|
||||
};
|
||||
|
||||
let text = str::from_utf8_owned(event.text.iter().take_while(|b| (**b) != 0i8).map(|b| b.to_u8().unwrap()).collect::<~[u8]>());
|
||||
|
||||
let text = match str::from_utf8_owned(event.text.iter().take_while(|b| (**b) != 0i8).map(|b| b.to_u8().unwrap()).collect::<~[u8]>()) {
|
||||
Some(t) => t,
|
||||
None => ~""
|
||||
};
|
||||
TextInputEvent(event.timestamp as uint, window, text)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user