Add capacity parameter to the extern C evaluate string function for EvalValues
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
eb3afce5c5
commit
bb6c7edcf2
|
@ -28,9 +28,9 @@ namespace Porygon::Evaluation {
|
||||||
return result.size();
|
return result.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
int EvaluateEvalValueString(EvalValue *v, char16_t dst[]){
|
int EvaluateEvalValueString(EvalValue *v, char16_t* dst, size_t capacity){
|
||||||
auto result = v->EvaluateString();
|
auto result = v->EvaluateString();
|
||||||
for (int i = 0; i < result.size(); i++){
|
for (int i = 0; i < capacity; i++){
|
||||||
dst[i] = result[i];
|
dst[i] = result[i];
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -67,7 +67,7 @@ TEST_CASE( "Evaluate String", "[integration]" ) {
|
||||||
auto lastValue = script->GetLastValue();
|
auto lastValue = script->GetLastValue();
|
||||||
size_t size = GetEvalValueStringLength(lastValue);
|
size_t size = GetEvalValueStringLength(lastValue);
|
||||||
auto dst = new char16_t[size + 1]{'\0'};
|
auto dst = new char16_t[size + 1]{'\0'};
|
||||||
EvaluateEvalValueString(lastValue, dst);
|
EvaluateEvalValueString(lastValue, dst, size);
|
||||||
auto s = u16string(dst);
|
auto s = u16string(dst);
|
||||||
REQUIRE(s == u"foo bar");
|
REQUIRE(s == u"foo bar");
|
||||||
delete[] dst;
|
delete[] dst;
|
||||||
|
|
Loading…
Reference in New Issue