Reduce number of range and slice operators #239

Replace .. and ... with : and ..
This commit is contained in:
gingerBill
2018-08-01 21:34:59 +01:00
parent a6fe656f21
commit 0718f14774
31 changed files with 204 additions and 219 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ read_entire_file :: proc(name: string) -> (data: []byte, success: bool) {
delete(data);
return nil, false;
}
return data[0..bytes_read], true;
return data[0:bytes_read], true;
}
write_entire_file :: proc(name: string, data: []byte, truncate := true) -> (success: bool) {
+1 -1
View File
@@ -49,7 +49,7 @@ OS_Node_Information :: struct {
ntype: OS_Node_Type,
size: i64,
// Our additions...
// Our additions..
position: i64,
}
+1 -1
View File
@@ -74,7 +74,7 @@ Stat :: struct {
_reserve1,
_reserve2,
_reserve3: i64,
serial_numbe: u64, // File serial number...? Maybe.
serial_numbe: u64, // File serial number..? Maybe.
_reserve4: i64,
};
+1 -1
View File
@@ -73,7 +73,7 @@ Stat :: struct {
blocks: i64, // Number of blocks allocated for the file
block_size: i32, // Optimal blocksize for I/O
flags: u32, // User-defined flags for the file
gen_num: u32, // File generation number ...?
gen_num: u32, // File generation number ..?
_spare: i32, // RESERVED
_reserve1,
_reserve2: i64, // RESERVED
+3 -3
View File
@@ -100,7 +100,7 @@ open :: proc(path: string, mode: int = O_RDONLY, perm: u32 = 0) -> (Handle, Errn
}
buf: [300]byte;
copy(buf[..], cast([]byte)path);
copy(buf[:], cast([]byte)path);
handle := Handle(win32.create_file_a(cstring(&buf[0]), access, share_mode, sa, create_mode, win32.FILE_ATTRIBUTE_NORMAL, nil));
if handle != INVALID_HANDLE do return handle, ERROR_NONE;
@@ -221,7 +221,7 @@ last_write_time_by_name :: proc(name: string) -> File_Time {
assert(len(buf) > len(name));
copy(buf[..], cast([]byte)name);
copy(buf[:], cast([]byte)name);
if win32.get_file_attributes_ex_a(cstring(&buf[0]), win32.GetFileExInfoStandard, &data) {
last_write_time = data.last_write_time;
@@ -279,7 +279,7 @@ _alloc_command_line_arguments :: proc() -> []string {
if n > 0 {
n -= 1;
}
arg_list[i] = string(buf[..n]);
arg_list[i] = string(buf[:n]);
}
return arg_list;