Fix examples
This commit is contained in:
parent
655300d3e9
commit
3c8f892c19
4 changed files with 7 additions and 31 deletions
|
@ -39,8 +39,8 @@ fn main() -> Result<(), LvError> {
|
|||
let mut arc = Arc::new(&mut screen)?;
|
||||
arc.set_size(150, 150)?;
|
||||
arc.set_align(&mut screen, Align::Center, 0, 10)?;
|
||||
arc.set_start_angle(135, ArcPart::Indicator)?;
|
||||
arc.set_end_angle(135, ArcPart::Indicator)?;
|
||||
arc.set_start_angle(135)?;
|
||||
arc.set_end_angle(135)?;
|
||||
|
||||
let mut loading_lbl = Label::new(&mut screen)?;
|
||||
loading_lbl.set_text("Loading...")?;
|
||||
|
@ -75,7 +75,7 @@ fn main() -> Result<(), LvError> {
|
|||
i = 1;
|
||||
}
|
||||
angle = if forward { angle + 1 } else { angle - 1 };
|
||||
arc.set_end_angle(angle + 135, ArcPart::Indicator)?;
|
||||
arc.set_end_angle(angle + 135)?;
|
||||
i += 1;
|
||||
|
||||
sleep(Duration::from_millis(10));
|
||||
|
|
|
@ -43,7 +43,7 @@ fn main() -> Result<(), LvError> {
|
|||
// // Set the indicator style for the bar object
|
||||
let mut ind_style = Style::default();
|
||||
ind_style.set_bg_color(State::DEFAULT, Color::from_rgb((100, 245, 100)));
|
||||
bar.add_style(BarPart::Indicator, ind_style)?;
|
||||
bar.add_style(Part::All, ind_style)?;
|
||||
|
||||
let mut loading_lbl = Label::new(&mut screen)?;
|
||||
loading_lbl.set_text("Loading...")?;
|
||||
|
|
|
@ -53,7 +53,7 @@ fn main() -> Result<(), LvError> {
|
|||
gauge_style.set_scale_end_border_width(State::DEFAULT, 4);
|
||||
|
||||
let mut gauge = Gauge::new(&mut screen)?;
|
||||
gauge.add_style(GaugePart::Main, gauge_style)?;
|
||||
gauge.add_style(Part::Main, gauge_style)?;
|
||||
gauge.set_align(&mut screen, Align::Center, 0, 0)?;
|
||||
gauge.set_value(0, 50)?;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
use core::{mem, ptr, slice, usize};
|
||||
use core::{ptr, usize};
|
||||
use cty::*;
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -147,7 +147,7 @@ pub unsafe extern "C" fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t
|
|||
#[no_mangle]
|
||||
pub unsafe extern "C" fn strrchr(s: *const c_char, c: c_int) -> *mut c_char {
|
||||
let len = strlen(s) as isize;
|
||||
let c = c as i8;
|
||||
let c = c as c_char;
|
||||
let mut i = len - 1;
|
||||
while i >= 0 {
|
||||
if *s.offset(i) == c {
|
||||
|
@ -157,27 +157,3 @@ pub unsafe extern "C" fn strrchr(s: *const c_char, c: c_int) -> *mut c_char {
|
|||
}
|
||||
ptr::null_mut()
|
||||
}
|
||||
|
||||
unsafe fn inner_strstr(
|
||||
mut haystack: *const c_char,
|
||||
needle: *const c_char,
|
||||
mask: c_char,
|
||||
) -> *mut c_char {
|
||||
while *haystack != 0 {
|
||||
let mut i = 0;
|
||||
loop {
|
||||
if *needle.offset(i) == 0 {
|
||||
// We reached the end of the needle, everything matches this far
|
||||
return haystack as *mut c_char;
|
||||
}
|
||||
if *haystack.offset(i) & mask != *needle.offset(i) & mask {
|
||||
break;
|
||||
}
|
||||
|
||||
i += 1;
|
||||
}
|
||||
|
||||
haystack = haystack.offset(1);
|
||||
}
|
||||
ptr::null_mut()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue