Skip to content

[WasmFS] Use const uint8_t* in JS API impl. NFC#24706

Merged
kleisauke merged 4 commits intoemscripten-core:mainfrom
kleisauke:wasmfs-js-api-constness
Apr 6, 2026
Merged

[WasmFS] Use const uint8_t* in JS API impl. NFC#24706
kleisauke merged 4 commits intoemscripten-core:mainfrom
kleisauke:wasmfs-js-api-constness

Conversation

@kleisauke
Copy link
Copy Markdown
Collaborator

In line with #23825.

@kleisauke
Copy link
Copy Markdown
Collaborator Author

@sbc100
Copy link
Copy Markdown
Collaborator

sbc100 commented Jul 15, 2025

#24707

// Writes to a file, possibly creating it, and returns the number of bytes
// written successfully. If the file already exists, appends to it.
int _wasmfs_write_file(const char* pathname, char* data, size_t data_size) {
int _wasmfs_write_file(const char* pathname, const char* data, size_t data_size) {
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.

I wonder why we don't use uint8_t here to like that .write method below does?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Commit 251c091 uses uint8_t here, which would also avoid the cast below.

Note that there are still many intptr_t casts in this file, these will be addressed in PR #19559.

@kleisauke kleisauke changed the title [WasmFS] Use const char* in JS API impl. NFC [WasmFS] Use const uint8_t* in JS API impl. NFC Apr 6, 2026
@kleisauke kleisauke merged commit 557c3fb into emscripten-core:main Apr 6, 2026
38 checks passed
@kleisauke kleisauke deleted the wasmfs-js-api-constness branch April 6, 2026 16:19
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