Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cpp/includes/RustBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <jsi/jsi.h>

struct RustBuffer {
size_t capacity;
size_t len;
uint64_t capacity;
uint64_t len;
Comment on lines -14 to +15
Copy link
Owner

Choose a reason for hiding this comment

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

Oh wow, this is an excellent catch. Thank you.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks. Yeah this crashed on me running in 32 bit. Required quite some digging to find!

uint8_t *data;
};
8 changes: 7 additions & 1 deletion crates/ubrn_cli/src/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ pub(crate) trait RenderedFile: DynTemplate {
let from = file
.parent()
.expect("Expected this file to have a directory");
pathdiff::diff_utf8_paths(to, from).expect("Should be able to find a relative path")
let path = pathdiff::diff_utf8_paths(to, from).expect("Should be able to find a relative path");

// Fix non-canonical paths: pathdiff can generate "cpp/.." when "../cpp" is more canonical
// This happens when calculating paths between sibling directories (e.g., android/ to cpp/)
// CMake and other tools prefer the "../dir" form over "dir/.." even though both work
let path_str = path.as_str().replace("cpp/..", "../cpp");
Utf8PathBuf::from(path_str)
Copy link
Owner

Choose a reason for hiding this comment

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

Hmm. I'm not sure if this works accidentally, or if this doesn't work.

cpp/.. decends down into a directory called cpp and then comes back to where we started. It fails if there isn't a child directory of the pwd called cpp.
../cpp ascends to the parent of the pwd, and iff there is a sibling directory called cpp, then descends into it. If the pwd is called cpp, then we're back where we started.

Then, I'm also not sure where you're getting the cpp from?

}
fn filter_by(&self) -> bool {
true
Expand Down