mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-23 21:10:19 +00:00
some fix
This commit is contained in:
parent
7a53ae47ee
commit
7182257413
@ -7,8 +7,7 @@ namespace pkpy{
|
|||||||
// Skip utf8 BOM if there is any.
|
// Skip utf8 BOM if there is any.
|
||||||
if (strncmp(source.data(), "\xEF\xBB\xBF", 3) == 0) index += 3;
|
if (strncmp(source.data(), "\xEF\xBB\xBF", 3) == 0) index += 3;
|
||||||
// Drop all '\r'
|
// Drop all '\r'
|
||||||
// SStream ss(source.size());
|
SStream ss(source.size());
|
||||||
SStream ss;
|
|
||||||
while(index < source.size()){
|
while(index < source.size()){
|
||||||
if(source[index] != '\r') ss << source[index];
|
if(source[index] != '\r') ss << source[index];
|
||||||
index++;
|
index++;
|
||||||
|
|||||||
@ -437,6 +437,7 @@ int utf8len(unsigned char c, bool suppress){
|
|||||||
|
|
||||||
Str SStream::str(){
|
Str SStream::str(){
|
||||||
// after this call, the buffer is no longer valid
|
// after this call, the buffer is no longer valid
|
||||||
|
buffer.reserve(buffer.size() + 1); // allocate one more byte for '\0'
|
||||||
return Str(buffer.detach());
|
return Str(buffer.detach());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user