| ... | ... | @@ -1017,17 +1017,14 @@ pub const Manifest = struct { |
| 1017 | 1017 | // Validate and check discovered files. |
| 1018 | 1018 | while (off + 1 < disk_contents.len) { |
| 1019 | 1019 | const file_off: File.Offset = @fromBackingInt(@intCast(off)); |
| 1020 | | const file = file_off.getFallible(disk_contents) catch |
| 1021 | | return checkLockedMiss(m, input_contents_len, .invalid_manifest); |
| 1022 | | if (file.flags.prefix >= m.cache.prefixes_len) |
| 1023 | | return checkLockedMiss(m, input_contents_len, .invalid_manifest); |
| 1024 | | const path = file_off.pathFallible(disk_contents) catch |
| 1025 | | return checkLockedMiss(m, input_contents_len, .invalid_manifest); |
| 1026 | | if (path.len == 0) return checkLockedMiss(m, input_contents_len, .invalid_manifest); |
| 1020 | const file = file_off.getFallible(disk_contents) catch return .invalid_manifest; |
| 1021 | if (file.flags.prefix >= m.cache.prefixes_len) return .invalid_manifest; |
| 1022 | const path = file_off.pathFallible(disk_contents) catch return .invalid_manifest; |
| 1023 | if (path.len == 0) return .invalid_manifest; |
| 1027 | 1024 | |
| 1028 | 1025 | try m.files.putContext(gpa, file_off, {}, .{ .contents = disk_contents }); |
| 1029 | 1026 | const result = try checkDiscoveredPath(m, file_off, disk_contents); |
| 1030 | | if (result != .hit) return checkLockedMiss(m, input_contents_len, result); |
| 1027 | if (result != .hit) return result; |
| 1031 | 1028 | |
| 1032 | 1029 | off += File.sizeOf(path.len); |
| 1033 | 1030 | } |
| ... | ... | @@ -1035,7 +1032,7 @@ pub const Manifest = struct { |
| 1035 | 1032 | // Final terminating zero byte to distinguish empty manifest file from |
| 1036 | 1033 | // manifest with zero files. |
| 1037 | 1034 | const file_valid = off + 1 == disk_contents.len and disk_contents[off] == 0; |
| 1038 | | if (!file_valid) return checkLockedMiss(m, input_contents_len, .incomplete_manifest); |
| 1035 | if (!file_valid) return .incomplete_manifest; |
| 1039 | 1036 | |
| 1040 | 1037 | // Since it's a cache hit, we accept the input file contents from disk and discard the other copy. |
| 1041 | 1038 | // Furthermore, don't track the trailing zero byte in contents. |
| ... | ... | @@ -1082,11 +1079,6 @@ pub const Manifest = struct { |
| 1082 | 1079 | return result; |
| 1083 | 1080 | } |
| 1084 | 1081 | |
| 1085 | | fn checkLockedMiss(m: *Manifest, input_contents_len: usize, result: CheckResult) CheckResult { |
| 1086 | | m.contents.shrinkRetainingCapacity(input_contents_len); |
| 1087 | | return result; |
| 1088 | | } |
| 1089 | | |
| 1090 | 1082 | /// Similar to `checkInputPath` and `checkDiscoveredPath` but does not compare metadata or digest against file |
| 1091 | 1083 | /// system. Only ensures that metadata and digest are available. |
| 1092 | 1084 | fn populateInputPath( |