Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

paulharris
Copy link

Please consider for merging.

@@ -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));
Copy link
Owner

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());
Copy link
Owner

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)
Copy link
Owner

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;
Copy link
Owner

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

@halex2005
Copy link
Owner

Your PR contains two unrelated changes:

  • adjust int casting
  • added -d postfix to libs

Please, split them to different PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants