[
https://issues.apache.org/jira/browse/GEODE-3288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16282279#comment-16282279
]
ASF GitHub Bot commented on GEODE-3288:
---------------------------------------
pivotal-jbarrett commented on a change in pull request #165: GEODE-3288:
Converts CacheableString to std::string.
URL: https://github.com/apache/geode-native/pull/165#discussion_r155602702
##########
File path: cppcache/src/CacheableFileName.cpp
##########
@@ -43,26 +43,16 @@ int8_t CacheableFileName::typeId() const {
}
int32_t CacheableFileName::hashcode() const {
-#ifndef _WIN32
- if (m_hashcode == 0) {
- m_hashcode = CacheableString::hashcode() ^ 1234321;
- }
- return m_hashcode;
-#endif
if (m_hashcode == 0) {
+#ifdef _WIN32
int localHashcode = 0;
- if (CacheableString::isCString()) {
- const char* data = CacheableString::asChar();
- for (uint32_t i = 0; i < CacheableString::length(); i++) {
- localHashcode = 31 * localHashcode + ACE_OS::ace_tolower(data[i]);
- }
- } else {
- const wchar_t* data = CacheableString::asWChar();
- for (uint32_t i = 0; i < CacheableString::length(); i++) {
- localHashcode = 31 * localHashcode + ACE_OS::ace_tolower(data[i]);
- }
+ for (auto&& c : CacheableString::value()) {
+ localHashcode = 31 * localHashcode + std::tolower(c, std::locale());
}
m_hashcode = localHashcode ^ 1234321;
+#else
+ m_hashcode = CacheableString::hashcode() ^ 1234321;
+#endif
Review comment:
Yes. This hashcode() method has to return the same value that the Java
domain object would return.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Replace char* with std::string
> ------------------------------
>
> Key: GEODE-3288
> URL: https://issues.apache.org/jira/browse/GEODE-3288
> Project: Geode
> Issue Type: Improvement
> Components: native client
> Reporter: Ernest Burghardt
>
> In all public API headers
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)