| ... | @@ -755,8 +755,7 @@ fn openSelfDebugInfoWindows(allocator: *mem.Allocator) !DebugInfo { | ... | @@ -755,8 +755,7 @@ fn openSelfDebugInfoWindows(allocator: *mem.Allocator) !DebugInfo { |
| 755 | return cap * 2 / 3 + 1; | 755 | return cap * 2 / 3 + 1; |
| 756 | } | 756 | } |
| 757 | }; | 757 | }; |
| 758 | var hash_tbl_hdr: HashTableHeader = undefined; | 758 | const hash_tbl_hdr = try pdb_stream.stream.readStruct(HashTableHeader); |
| 759 | try pdb_stream.stream.readStruct(HashTableHeader, &hash_tbl_hdr); | | |
| 760 | if (hash_tbl_hdr.Capacity == 0) | 759 | if (hash_tbl_hdr.Capacity == 0) |
| 761 | return error.InvalidDebugInfo; | 760 | return error.InvalidDebugInfo; |
| 762 | | 761 | |
| ... | @@ -790,8 +789,7 @@ fn openSelfDebugInfoWindows(allocator: *mem.Allocator) !DebugInfo { | ... | @@ -790,8 +789,7 @@ fn openSelfDebugInfoWindows(allocator: *mem.Allocator) !DebugInfo { |
| 790 | const dbi = di.pdb.dbi; | 789 | const dbi = di.pdb.dbi; |
| 791 | | 790 | |
| 792 | // Dbi Header | 791 | // Dbi Header |
| 793 | var dbi_stream_header: pdb.DbiStreamHeader = undefined; | 792 | const dbi_stream_header = try dbi.stream.readStruct(pdb.DbiStreamHeader); |
| 794 | try dbi.stream.readStruct(pdb.DbiStreamHeader, &dbi_stream_header); | | |
| 795 | const mod_info_size = dbi_stream_header.ModInfoSize; | 793 | const mod_info_size = dbi_stream_header.ModInfoSize; |
| 796 | const section_contrib_size = dbi_stream_header.SectionContributionSize; | 794 | const section_contrib_size = dbi_stream_header.SectionContributionSize; |
| 797 | | 795 | |
| ... | @@ -800,8 +798,7 @@ fn openSelfDebugInfoWindows(allocator: *mem.Allocator) !DebugInfo { | ... | @@ -800,8 +798,7 @@ fn openSelfDebugInfoWindows(allocator: *mem.Allocator) !DebugInfo { |
| 800 | // Module Info Substream | 798 | // Module Info Substream |
| 801 | var mod_info_offset: usize = 0; | 799 | var mod_info_offset: usize = 0; |
| 802 | while (mod_info_offset != mod_info_size) { | 800 | while (mod_info_offset != mod_info_size) { |
| 803 | var mod_info: pdb.ModInfo = undefined; | 801 | const mod_info = try dbi.stream.readStruct(pdb.ModInfo); |
| 804 | try dbi.stream.readStruct(pdb.ModInfo, &mod_info); | | |
| 805 | var this_record_len: usize = @sizeOf(pdb.ModInfo); | 802 | var this_record_len: usize = @sizeOf(pdb.ModInfo); |
| 806 | | 803 | |
| 807 | const module_name = try dbi.readNullTermString(allocator); | 804 | const module_name = try dbi.readNullTermString(allocator); |
| ... | @@ -845,7 +842,7 @@ fn openSelfDebugInfoWindows(allocator: *mem.Allocator) !DebugInfo { | ... | @@ -845,7 +842,7 @@ fn openSelfDebugInfoWindows(allocator: *mem.Allocator) !DebugInfo { |
| 845 | } | 842 | } |
| 846 | while (sect_cont_offset != section_contrib_size) { | 843 | while (sect_cont_offset != section_contrib_size) { |
| 847 | const entry = try sect_contribs.addOne(); | 844 | const entry = try sect_contribs.addOne(); |
| 848 | try dbi.stream.readStruct(pdb.SectionContribEntry, entry); | 845 | entry.* = try dbi.stream.readStruct(pdb.SectionContribEntry); |
| 849 | sect_cont_offset += @sizeOf(pdb.SectionContribEntry); | 846 | sect_cont_offset += @sizeOf(pdb.SectionContribEntry); |
| 850 | | 847 | |
| 851 | if (sect_cont_offset > section_contrib_size) | 848 | if (sect_cont_offset > section_contrib_size) |