forked from soutade/libgourou
Remove implicit handle of final \0 in ByteArray
This commit is contained in:
parent
47a38b1ebc
commit
dc15fc7197
|
@ -293,7 +293,7 @@ namespace gourou
|
||||||
*/
|
*/
|
||||||
static inline void writeFile(std::string path, ByteArray& data)
|
static inline void writeFile(std::string path, ByteArray& data)
|
||||||
{
|
{
|
||||||
writeFile(path, data.data(), data.length()-1);
|
writeFile(path, data.data(), data.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,14 +37,14 @@ namespace gourou
|
||||||
ByteArray::ByteArray(const char* data, int length)
|
ByteArray::ByteArray(const char* data, int length)
|
||||||
{
|
{
|
||||||
if (length == -1)
|
if (length == -1)
|
||||||
length = strlen(data) + 1;
|
length = strlen(data);
|
||||||
|
|
||||||
initData((const unsigned char*)data, (unsigned int) length);
|
initData((const unsigned char*)data, (unsigned int) length);
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArray::ByteArray(const std::string& str)
|
ByteArray::ByteArray(const std::string& str)
|
||||||
{
|
{
|
||||||
initData((unsigned char*)str.c_str(), (unsigned int)str.length() + 1);
|
initData((unsigned char*)str.c_str(), (unsigned int)str.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ByteArray::initData(const unsigned char* data, unsigned int length)
|
void ByteArray::initData(const unsigned char* data, unsigned int length)
|
||||||
|
|
|
@ -907,7 +907,7 @@ namespace gourou
|
||||||
|
|
||||||
ByteArray privateLicenseKey = ByteArray::fromBase64(user->getPrivateLicenseKey());
|
ByteArray privateLicenseKey = ByteArray::fromBase64(user->getPrivateLicenseKey());
|
||||||
/* In adobekey.py, we get base64 decoded data [26:] */
|
/* In adobekey.py, we get base64 decoded data [26:] */
|
||||||
write(fd, privateLicenseKey.data()+26, privateLicenseKey.length()-1-26);
|
write(fd, privateLicenseKey.data()+26, privateLicenseKey.length()-26);
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user