diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-06-12 02:18:11 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-06-12 02:18:11 -0400 |
| commit | 7580e39b388525237a84aabfb41c462376eac28e (patch) | |
| tree | 32ed7e22da2c9cabddcf6abf312f0357f652deab | |
| parent | 3dd9af9948db696362aa5f41481dc4cb034bc6c2 (diff) | |
| download | zig-7580e39b388525237a84aabfb41c462376eac28e.tar.gz zig-7580e39b388525237a84aabfb41c462376eac28e.zip | |
zig fmt
| -rw-r--r-- | std/os/file.zig | 2 | ||||
| -rw-r--r-- | std/os/index.zig | 22 | ||||
| -rw-r--r-- | std/os/time.zig | 2 | ||||
| -rw-r--r-- | std/os/windows/util.zig | 15 |
4 files changed, 23 insertions, 18 deletions
diff --git a/std/os/file.zig b/std/os/file.zig index e09c03c08b..56da4f73a6 100644 --- a/std/os/file.zig +++ b/std/os/file.zig @@ -96,7 +96,7 @@ pub const File = struct { return File{ .handle = handle }; } - pub const AccessError = error { + pub const AccessError = error{ PermissionDenied, NotFound, NameTooLong, diff --git a/std/os/index.zig b/std/os/index.zig index b8907776c5..612301d25d 100644 --- a/std/os/index.zig +++ b/std/os/index.zig @@ -734,7 +734,7 @@ pub fn atomicSymLink(allocator: *Allocator, existing_path: []const u8, new_path: } } -pub const DeleteFileError = error { +pub const DeleteFileError = error{ FileNotFound, AccessDenied, FileBusy, @@ -1035,7 +1035,7 @@ pub fn makePath(allocator: *Allocator, full_path: []const u8) !void { } } -pub const DeleteDirError = error { +pub const DeleteDirError = error{ AccessDenied, FileBusy, SymLinkLoop, @@ -1090,7 +1090,6 @@ pub fn deleteDir(allocator: *Allocator, dir_path: []const u8) DeleteDirError!voi }, else => @compileError("unimplemented"), } - } /// Whether ::full_path describes a symlink, file, or directory, this function @@ -1227,7 +1226,7 @@ pub const Dir = struct { }; }; - pub const OpenError = error { + pub const OpenError = error{ PathNotFound, NotDir, AccessDenied, @@ -1253,13 +1252,13 @@ pub const Dir = struct { Os.windows => blk: { var find_file_data: windows.WIN32_FIND_DATAA = undefined; const handle = try windows_util.windowsFindFirstFile(allocator, dir_path, &find_file_data); - break :blk Handle { + break :blk Handle{ .handle = handle, .find_file_data = find_file_data, // TODO guaranteed copy elision .first = true, }; }, - Os.macosx, Os.ios => Handle { + Os.macosx, Os.ios => Handle{ .fd = try posixOpen( allocator, dir_path, @@ -1271,8 +1270,13 @@ pub const Dir = struct { .end_index = 0, .buf = []u8{}, }, - Os.linux => Handle { - .fd = try posixOpen(allocator, dir_path, posix.O_RDONLY | posix.O_DIRECTORY | posix.O_CLOEXEC, 0,), + Os.linux => Handle{ + .fd = try posixOpen( + allocator, + dir_path, + posix.O_RDONLY | posix.O_DIRECTORY | posix.O_CLOEXEC, + 0, + ), .index = 0, .end_index = 0, .buf = []u8{}, @@ -1378,7 +1382,7 @@ pub const Dir = struct { if (attrs & windows.FILE_ATTRIBUTE_NORMAL != 0) break :blk Entry.Kind.File; break :blk Entry.Kind.Unknown; }; - return Entry { + return Entry{ .name = name, .kind = kind, }; diff --git a/std/os/time.zig b/std/os/time.zig index 43a584d936..ffb506cd7d 100644 --- a/std/os/time.zig +++ b/std/os/time.zig @@ -74,7 +74,7 @@ fn milliTimestampWindows() u64 { const epoch_adj = epoch.windows * ms_per_s; const ft64 = (u64(ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - return @divFloor(ft64, hns_per_ms) - - epoch_adj; + return @divFloor(ft64, hns_per_ms) - -epoch_adj; } fn milliTimestampDarwin() u64 { diff --git a/std/os/windows/util.zig b/std/os/windows/util.zig index 0f0a190ed1..88a9e7952e 100644 --- a/std/os/windows/util.zig +++ b/std/os/windows/util.zig @@ -171,11 +171,12 @@ test "InvalidDll" { }; } - -pub fn windowsFindFirstFile(allocator: *mem.Allocator, dir_path: []const u8, - find_file_data: *windows.WIN32_FIND_DATAA) !windows.HANDLE -{ - const wild_and_null = []u8{'\\', '*', 0}; +pub fn windowsFindFirstFile( + allocator: *mem.Allocator, + dir_path: []const u8, + find_file_data: *windows.WIN32_FIND_DATAA, +) !windows.HANDLE { + const wild_and_null = []u8{ '\\', '*', 0 }; const path_with_wild_and_null = try allocator.alloc(u8, dir_path.len + wild_and_null.len); defer allocator.free(path_with_wild_and_null); @@ -195,7 +196,7 @@ pub fn windowsFindFirstFile(allocator: *mem.Allocator, dir_path: []const u8, } return handle; -} +} /// Returns `true` if there was another file, `false` otherwise. pub fn windowsFindNextFile(handle: windows.HANDLE, find_file_data: *windows.WIN32_FIND_DATAA) !bool { @@ -207,4 +208,4 @@ pub fn windowsFindNextFile(handle: windows.HANDLE, find_file_data: *windows.WIN3 }; } return true; -} +} |
