You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by hustterry <gi...@git.apache.org> on 2018/03/21 06:48:41 UTC
[GitHub] logging-log4cxx pull request #4: mbsrtowcs() returns the number of wide char...
GitHub user hustterry opened a pull request:
https://github.com/apache/logging-log4cxx/pull/4
mbsrtowcs() returns the number of wide char,but not the source in str…
mbsrtowcs() returns the number of wide char,but not the source length.
If there have n chinese characters,the log will output more last n characters.
src/main/cpp/charsetdecoder.cpp
@@ -175,11 +175,11 @@ namespace log4cxx
stat = APR_BADARG;
in.position(src - in.data());
break;
} else {
stat = append(out, buf);
- in.position(in.position() + converted);
+ in.position(in.position() + requested);
}
}
}
return stat;
}
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/hustterry/logging-log4cxx master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/logging-log4cxx/pull/4.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #4
----
----
---
[GitHub] logging-log4cxx issue #4: mbsrtowcs() returns the number of wide char,but no...
Posted by tschoening <gi...@git.apache.org>.
Github user tschoening commented on the issue:
https://github.com/apache/logging-log4cxx/pull/4
I fixed this using "requested" like mentioned in LOGCXX-399 and the linked PR #4 on GitHub. Additionally I added a test "decodingtest" using "encodingtest" as template, but the problem didn't occur using my C++Builder because I lack the used API, so am not sure if that works at all. It didn't fail before and doesn't now, so in the worst case is simply not doing anything useful. ;-)
---
[GitHub] logging-log4cxx pull request #4: mbsrtowcs() returns the number of wide char...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/logging-log4cxx/pull/4
---
[GitHub] logging-log4cxx issue #4: mbsrtowcs() returns the number of wide char,but no...
Posted by tschoening <gi...@git.apache.org>.
Github user tschoening commented on the issue:
https://github.com/apache/logging-log4cxx/pull/4
It's a string by definition so I guess we can ignore problems with terminating `0` within the string before `requested` has been reached. Additionally, `x * converted` should be wrong as well because how many bytes one multibyte character spans depends on the current locale, right? So sounds safe to assume in case of success that simply all requested characters/bytes have been processed. This is reported to work in the linked issues as well:
> Then I modified the "in.position(in.position() + converted);" to "in.position(in.position() + requested);"
https://issues.apache.org/jira/browse/LOGCXX-399?focusedCommentId=13969295&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-13969295
---
[GitHub] logging-log4cxx issue #4: mbsrtowcs() returns the number of wide char,but no...
Posted by tschoening <gi...@git.apache.org>.
Github user tschoening commented on the issue:
https://github.com/apache/logging-log4cxx/pull/4
This has been reported before with different possible solutions. Is "requested" really correct compared to e.g. `sizeof(...) * converted` or such? Less than `requested` chars could have been processed in theory even without any error.
https://issues.apache.org/jira/browse/LOGCXX-369
https://issues.apache.org/jira/browse/LOGCXX-399
---