diff options
author | sanikoyes <sanikoyes@163.com> | 2014-04-06 21:52:47 +0800 |
---|---|---|
committer | sanikoyes <sanikoyes@163.com> | 2014-04-06 21:52:47 +0800 |
commit | 77a840e350668a9c80b1e63b9b73aac44221c53b (patch) | |
tree | 40d2115e639bdc72a61811ac4f2fb0f04ec8eb7f /core/os/file_access.cpp | |
parent | 14bbdcb139b35e6d206df1ab3176d34245b72329 (diff) | |
parent | ded365031ede27b7a6efef59bc886343f58d310b (diff) |
Merge branch 'master' into hotfix-android-unicode-ime-input
Diffstat (limited to 'core/os/file_access.cpp')
-rw-r--r-- | core/os/file_access.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp index 23250a7345..31e7d19bae 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -428,8 +428,30 @@ void FileAccess::store_string(const String& p_string) { CharString cs=p_string.utf8(); store_buffer((uint8_t*)&cs[0],cs.length()); - } + +void FileAccess::store_pascal_string(const String& p_string) { + + CharString cs = p_string.utf8(); + store_32(cs.length()); + store_buffer((uint8_t*)&cs[0], cs.length()); +}; + +String FileAccess::get_pascal_string() { + + uint32_t sl = get_32(); + CharString cs; + cs.resize(sl+1); + get_buffer((uint8_t*)cs.ptr(),sl); + cs[sl]=0; + + String ret; + ret.parse_utf8(cs.ptr()); + + return ret; +}; + + void FileAccess::store_line(const String& p_line) { store_string(p_line); |