From 1c9656aedb3040b7f08161ece138ce0fe33c4699 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 31 Dec 2018 15:50:49 +0000 Subject: [PATCH] Vet core library --- core/os/os_windows.odin | 1 - core/strings/strings.odin | 8 ++++---- core/unicode/utf8/utf8.odin | 8 ++++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/core/os/os_windows.odin b/core/os/os_windows.odin index 6eb147f10..6fd46ffd5 100644 --- a/core/os/os_windows.odin +++ b/core/os/os_windows.odin @@ -218,7 +218,6 @@ last_write_time :: proc(fd: Handle) -> (File_Time, Errno) { } last_write_time_by_name :: proc(name: string) -> (File_Time, Errno) { - last_write_time: win32.Filetime; data: win32.File_Attribute_Data; wide_path := win32.utf8_to_wstring(name); diff --git a/core/strings/strings.odin b/core/strings/strings.odin index 9d9082b62..9f8d20d5b 100644 --- a/core/strings/strings.odin +++ b/core/strings/strings.odin @@ -283,8 +283,8 @@ replace :: proc(s, old, new: string, n: int, allocator := context.allocator) -> j := start; if len(old) == 0 { if i > 0 { - _, w := utf8.decode_rune_in_string(s[start:]); - j += w; + _, width := utf8.decode_rune_in_string(s[start:]); + j += width; } } else { j += index(s[start:], old); @@ -381,8 +381,8 @@ index_rune :: proc(s: string, r: rune) -> int { return index_byte(s, byte(r)); case r == utf8.RUNE_ERROR: - for r, i in s { - if r == utf8.RUNE_ERROR { + for c, i in s { + if c == utf8.RUNE_ERROR { return i; } } diff --git a/core/unicode/utf8/utf8.odin b/core/unicode/utf8/utf8.odin index ec2c8a1e0..50b33a680 100644 --- a/core/unicode/utf8/utf8.odin +++ b/core/unicode/utf8/utf8.odin @@ -201,11 +201,11 @@ valid_string :: proc(s: string) -> bool { return false; } else if size == 2 { // Okay - } else if b := s[i+2]; b < 0x80 || 0xbf < b { + } else if c := s[i+2]; c < 0x80 || 0xbf < c { return false; } else if size == 3 { // Okay - } else if b := s[i+3]; b < 0x80 || 0xbf < b { + } else if d := s[i+3]; b < 0x80 || 0xbf < d { return false; } i += size; @@ -242,11 +242,11 @@ rune_count :: proc(s: []u8) -> int { size = 1; } else if size == 2 { // Okay - } else if b := s[i+2]; b < 0x80 || 0xbf < b { + } else if c := s[i+2]; c < 0x80 || 0xbf < c { size = 1; } else if size == 3 { // Okay - } else if b := s[i+3]; b < 0x80 || 0xbf < b { + } else if d := s[i+3]; d < 0x80 || 0xbf < d { size = 1; } i += size;