-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added -d postfix to libs. Adjust int casting. #10
base: master
Are you sure you want to change the base?
Conversation
@@ -49,7 +49,7 @@ namespace nowide { | |||
return 0; | |||
if(n >= buf_size) { | |||
tmp.resize(n+1,L'\0'); | |||
n = GetEnvironmentVariableW(name.c_str(),&tmp[0],tmp.size() - 1); | |||
n = GetEnvironmentVariableW(name.c_str(),&tmp[0], static_cast<unsigned long>(tmp.size() - 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to https://msdn.microsoft.com/en-us/library/windows/desktop/ms683188(v=vs.85).aspx, cast should be written as static_cast<DWORD>
@@ -43,8 +45,8 @@ namespace details { | |||
{ | |||
if(!handle_) | |||
return -1; | |||
int n = pptr() - pbase(); | |||
int r = 0; | |||
DWORD n = static_cast<DWORD>(pptr() - pbase()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead DWORD, pointers math should be calculated with ptrdiff_t
type.
@@ -59,29 +61,29 @@ namespace details { | |||
} | |||
private: | |||
|
|||
int write(char const *p,int n) | |||
DWORD write(char const *p, DWORD n) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that size_t
is better for 64-bit portability
@@ -193,13 +195,13 @@ namespace details { | |||
return out - buffer_; | |||
} | |||
|
|||
static const size_t buffer_size = 1024 * 3; | |||
static const size_t wbuffer_size = 1024; | |||
static const DWORD buffer_size = 1024 * 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size_t was better for 64-bit portability
Your PR contains two unrelated changes:
Please, split them to different PRs. |
Please consider for merging.