Skip to content

uf2: adapt to 0.17 API, add file tracking support#994

Open
by965738071 wants to merge 5 commits into
ZigEmbeddedGroup:mainfrom
by965738071:uf2-file-tracking
Open

uf2: adapt to 0.17 API, add file tracking support#994
by965738071 wants to merge 5 commits into
ZigEmbeddedGroup:mainfrom
by965738071:uf2-file-tracking

Conversation

@by965738071

Copy link
Copy Markdown
Contributor

No description provided.

@Grazfather Grazfather left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I will test this out shortly

Comment thread tools/uf2/src/update_family_id.zig Outdated
@by965738071

Copy link
Copy Markdown
Contributor Author

@Grazfather I have removed the unused code.

Comment thread tools/uf2/src/uf2.zig Outdated
families: std.AutoArrayHashMapUnmanaged(FamilyId, void),
files: std.ArrayList(FileEntry),

// TODO: keep track of contained files

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can get rid of this now

Comment thread tools/uf2/src/uf2.zig Outdated
pub fn deinit(self: *Archive) void {
self.blocks.deinit(self.allocator);
self.families.deinit(self.allocator);
//free file name at line 236

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't reference line numbers, they will very quickly stop being correct.

Comment thread tools/uf2/src/uf2.zig
errdefer _ = self.blocks.pop();

const block = &self.blocks.items[self.blocks.len - 1];
const block = &self.blocks.items[self.blocks.items.len - 1];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did this ever work?

Comment thread tools/uf2/src/uf2.zig Outdated
target_addr += @as(u32, @intCast(n_read));
block.payload_size = @as(u32, @intCast(n_read));
if (n_read != block.data.len) {
if (n_read < block.data.len) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like you only need the second one.

Comment thread tools/uf2/src/uf2.zig Outdated
if (n_copied < block.data.len) {
// write null terminator and peace out
block.data[n_copied] = 0;
// 文件已读完,只复制剩余的路径

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

English comments please

…, simplify redundant if, use English comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants