mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-08-20 21:51:25 +08:00
Move reading terminating null to str.read()
This commit is contained in:
@@ -177,14 +177,14 @@ size_t DataTypeHandler::interpretAsType(
|
|||||||
case 0x0009: // string
|
case 0x0009: // string
|
||||||
case 0x000a: // octet_string
|
case 0x000a: // octet_string
|
||||||
case 0x000b: // unicode_string
|
case 0x000b: // unicode_string
|
||||||
dataSize = str.str().size() + 1; // include terminating \0
|
dataSize = str.str().size();
|
||||||
if (dataSize > targetSize) {
|
if (dataSize > targetSize) {
|
||||||
stringstream err;
|
stringstream err;
|
||||||
err << "String too large ("
|
err << "String too large ("
|
||||||
<< dataSize << " > " << targetSize << ")";
|
<< dataSize << " > " << targetSize << ")";
|
||||||
throw SizeException(err.str());
|
throw SizeException(err.str());
|
||||||
}
|
}
|
||||||
str.read((char *) target, dataSize);
|
str.read((char *) target, dataSize + 1); // including \0
|
||||||
break;
|
break;
|
||||||
case 0x0011: // double
|
case 0x0011: // double
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user