From eb2c3fa8311df2d08a1995dced7a91061a395d94 Mon Sep 17 00:00:00 2001 From: q66 Date: Sun, 9 Aug 2015 00:14:56 +0100 Subject: [PATCH] start getting rid of null terminated strings --- cubescript.cc | 4 ++-- cubescript.hh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cubescript.cc b/cubescript.cc index 9bd4d1e..c112ede 100644 --- a/cubescript.cc +++ b/cubescript.cc @@ -2070,10 +2070,10 @@ void GenState::gen_main(const char *p, int ret_type) { code.push(CODE_EXIT | ((ret_type < VAL_ANY) ? (ret_type << CODE_RET) : 0)); } -ostd::Uint32 *CsState::compile(const char *p) { +ostd::Uint32 *CsState::compile(ostd::ConstCharRange str) { GenState gs(*this); gs.code.reserve(64); - gs.gen_main(p); + gs.gen_main(str.data()); ostd::Uint32 *code = new ostd::Uint32[gs.code.size()]; memcpy(code, gs.code.data(), gs.code.size() * sizeof(ostd::Uint32)); code[0] += 0x100; diff --git a/cubescript.hh b/cubescript.hh index 89c62ff..6536bf2 100644 --- a/cubescript.hh +++ b/cubescript.hh @@ -440,7 +440,7 @@ struct CsState { void print_var_float(Ident *id, float f); void print_var_str(Ident *id, ostd::ConstCharRange s); - ostd::Uint32 *compile(const char *code); + ostd::Uint32 *compile(ostd::ConstCharRange code); private: void debug_alias();