OSDN Git Service
(root)
/
yamml
/
yamml-git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
39b2ec6
)
file_win.cpp: 2 バイト余分にメモリを確保していたのを修正
author
starg
<starg@users.osdn.me>
Thu, 8 Sep 2016 10:33:28 +0000
(19:33 +0900)
committer
starg
<starg@users.osdn.me>
Thu, 8 Sep 2016 10:33:28 +0000
(19:33 +0900)
src/driver/file_win.cpp
patch
|
blob
|
history
diff --git
a/src/driver/file_win.cpp
b/src/driver/file_win.cpp
index
aba97bc
..
44c86ce
100644
(file)
--- a/
src/driver/file_win.cpp
+++ b/
src/driver/file_win.cpp
@@
-171,7
+171,7
@@
std::string ReadTextFile(const std::string& filePath)
}
else if (buffer.size() >= 2 && buffer[0] == 0xFF && buffer[1] == 0xFE) // UTF-16LE
{
- std::wstring wstr(
buffer.size(
) / 2, L'\0');
+ std::wstring wstr(
(buffer.size() - 1
) / 2, L'\0');
std::copy(buffer.begin() + 2, buffer.end(), reinterpret_cast<char*>(&wstr[0]));
return W2UTF8(wstr);
}