Skip to content

Added -d postfix to libs. Adjust int casting.#10

Open
paulharris wants to merge 1 commit into
halex2005:masterfrom
paulharris:master
Open

Added -d postfix to libs. Adjust int casting.#10
paulharris wants to merge 1 commit into
halex2005:masterfrom
paulharris:master

Conversation

@paulharris

Copy link
Copy Markdown

Please consider for merging.

Comment thread boost/nowide/cenv.hpp
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
Copy Markdown
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>

return -1;
int n = pptr() - pbase();
int r = 0;
DWORD n = static_cast<DWORD>(pptr() - pbase());

Copy link
Copy Markdown
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.

private:

int write(char const *p,int n)
DWORD write(char const *p, DWORD n)

Copy link
Copy Markdown
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


static const size_t buffer_size = 1024 * 3;
static const size_t wbuffer_size = 1024;
static const DWORD buffer_size = 1024 * 3;

Copy link
Copy Markdown
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
Copy Markdown
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