mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-23 21:10:19 +00:00
some fix
This commit is contained in:
parent
7a5ec84d14
commit
25d36840ad
@ -24,7 +24,8 @@ int utf8len(unsigned char c, bool suppress){
|
|||||||
for(int i=0; i<this->size; i++){ \
|
for(int i=0; i<this->size; i++){ \
|
||||||
this->data[i] = __s[i]; \
|
this->data[i] = __s[i]; \
|
||||||
if(!isascii(__s[i])) is_ascii = false; \
|
if(!isascii(__s[i])) is_ascii = false; \
|
||||||
}
|
} \
|
||||||
|
this->data[this->size] = '\0';
|
||||||
|
|
||||||
Str::Str(): size(0), is_ascii(true), data(_inlined) {
|
Str::Str(): size(0), is_ascii(true), data(_inlined) {
|
||||||
_inlined[0] = '\0';
|
_inlined[0] = '\0';
|
||||||
@ -71,6 +72,7 @@ int utf8len(unsigned char c, bool suppress){
|
|||||||
if(other.is_inlined()){
|
if(other.is_inlined()){
|
||||||
data = _inlined;
|
data = _inlined;
|
||||||
for(int i=0; i<size; i++) _inlined[i] = other._inlined[i];
|
for(int i=0; i<size; i++) _inlined[i] = other._inlined[i];
|
||||||
|
data[size] = '\0';
|
||||||
}else{
|
}else{
|
||||||
data = other.data;
|
data = other.data;
|
||||||
// zero out `other`
|
// zero out `other`
|
||||||
@ -430,6 +432,7 @@ int utf8len(unsigned char c, bool suppress){
|
|||||||
}
|
}
|
||||||
|
|
||||||
Str SStream::str(){
|
Str SStream::str(){
|
||||||
|
buffer.push_back('\0');
|
||||||
// after this call, the buffer is no longer valid
|
// after this call, the buffer is no longer valid
|
||||||
return Str(buffer.detach());
|
return Str(buffer.detach());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user