Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Roger Leigh
KWSys
Commits
c23e388b
Commit
c23e388b
authored
May 22, 2017
by
Brad King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ConsoleBuf: Avoid signed/unsigned comparison
Use `size_t` for lengths in `decodeInputBuffer`.
parent
fe1f22ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
ConsoleBuf.hxx.in
ConsoleBuf.hxx.in
+5
-4
No files found.
ConsoleBuf.hxx.in
View file @
c23e388b
...
...
@@ -338,7 +338,7 @@ private:
}
bool decodeInputBuffer(const std::string buffer, std::wstring& wbuffer)
{
in
t length =
int(
buffer.length()
)
;
size_
t length = buffer.length();
if (length == 0) {
wbuffer = std::wstring();
return true;
...
...
@@ -353,11 +353,12 @@ private:
data += BOMsize;
length -= BOMsize;
}
const
in
t wlength =
MultiByteToWideChar(
actualCodepage, 0, data, length, NULL, 0);
const
size_
t wlength =
static_cast<size_t>(MultiByteToWideChar(
actualCodepage, 0, data,
static_cast<int>(
length
)
, NULL, 0)
)
;
wchar_t* wbuf = new wchar_t[wlength];
const bool success =
MultiByteToWideChar(actualCodepage, 0, data, length, wbuf, wlength) > 0
MultiByteToWideChar(actualCodepage, 0, data, static_cast<int>(length),
wbuf, static_cast<int>(wlength)) > 0
? true
: false;
wbuffer = std::wstring(wbuf, wlength);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment