Skip to content

Commit 503ea51

Browse files
committed
Use c_char in unsafe
1 parent 7830f8a commit 503ea51

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

cpp2rust/converter/converter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1977,7 +1977,7 @@ bool Converter::VisitStringLiteral(clang::StringLiteral *expr) {
19771977
if (auto *arr_ty = ctx_.getAsConstantArrayType(curr_init_type_.back())) {
19781978
uint64_t arr_size = arr_ty->getSize().getZExtValue();
19791979
if (expr->getString().empty()) {
1980-
StrCat(std::format("[0 as {}; {}]", CharRustType(), arr_size));
1980+
StrCat(std::format("[0 as libc::c_char; {}]", arr_size));
19811981
return false;
19821982
}
19831983
uint64_t pad = arr_size > expr->getString().size()

cpp2rust/converter/models/converter_refcount.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2238,7 +2238,7 @@ void ConverterRefCount::ConvertFunctionMain(
22382238
StrCat(std::format(R"(
22392239
pub fn main() {{
22402240
let argv: Vec<Value<Vec<u8>>> = ::std::env::args()
2241-
.map(|x| Rc::new(RefCell::new(x.bytes().collect())))
2241+
.map(|x| Rc::new(RefCell::new(x.as_bytes().to_vec())))
22422242
.collect();
22432243
let mut argv: Value<Vec<Ptr<u8>>> = Rc::new(RefCell::new(
22442244
argv.iter().map(|x| {{ x.borrow_mut().push(0); x.as_pointer() }}).collect(),

0 commit comments

Comments
 (0)