You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/06/25 07:23:20 UTC

[GitHub] [rocketmq-client-cpp] SRC-xiaojin opened a new pull request, #419: avoid possible type conversion compile error

SRC-xiaojin opened a new pull request, #419:
URL: https://github.com/apache/rocketmq-client-cpp/pull/419

   ## What is the purpose of the change
   
   avoid possible type conversion compile error
   
   ## Brief changelog
   
   avoid possible type conversion compile error
   
   ## Verifying this change
   
   verified using "Visual Studio 17 2022"
   
   Follow this checklist to help us incorporate your contribution quickly and easily. Notice, `it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR`.
   
   - [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue. 
   - [x] Format the pull request title like `[ISSUE #123] Fix UnknownException when host config not exist`. Each commit in the pull request should have a meaningful subject line and body.
   - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [x] Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when a cross-module dependency exists.
   - [ ] If this contribution is large, please file an [Apache Individual Contributor License Agreement](http://www.apache.org/licenses/#clas).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq-client-cpp] SRC-xiaojin commented on a diff in pull request #419: avoid possible type conversion compile error

Posted by GitBox <gi...@apache.org>.
SRC-xiaojin commented on code in PR #419:
URL: https://github.com/apache/rocketmq-client-cpp/pull/419#discussion_r906805448


##########
src/transport/TcpTransport.cpp:
##########
@@ -207,7 +207,7 @@ void TcpTransport::eventCallback(BufferEvent* event, short what, TcpTransport* t
 
     // disable Nagle
     int val = 1;
-    setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void*)&val, sizeof(val));
+    setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, static_cast<const char *>((void*)&val), sizeof(val));

Review Comment:
   no problem



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq-client-cpp] SRC-xiaojin commented on a diff in pull request #419: avoid possible type conversion compile error

Posted by GitBox <gi...@apache.org>.
SRC-xiaojin commented on code in PR #419:
URL: https://github.com/apache/rocketmq-client-cpp/pull/419#discussion_r906806681


##########
src/producer/StringIdMaker.cpp:
##########
@@ -125,11 +125,11 @@ std::string StringIdMaker::createUniqID() {
   return std::string(kFixString, 20) + std::string(hex_buf, 12);
 }
 
-void StringIdMaker::hexdump(unsigned char* in, char* out, std::size_t len) {
-  for (std::size_t i = 0; i < len; i++) {
-    unsigned char v = in[i];
-    out[i * 2] = sHexAlphabet[v >> 4];
-    out[i * 2 + 1] = sHexAlphabet[v & 0x0FU];
+void StringIdMaker::hexdump(unsigned char* buffer, char* out_buff, std::size_t index) {
+  for (std::size_t i = 0; i < index; i++) {
+    unsigned char v = buffer[i];
+    out_buff[i * 2] = sHexAlphabet[v >> 4];
+    out_buff[i * 2 + 1] = sHexAlphabet[v & 0x0FU];

Review Comment:
   function declaration below:
   static void hexdump(unsigned char* buffer, char* out_buff, std::size_t index);
   when I use "Visual Studio 17 2022" ,hava compile error, so I think need change



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq-client-cpp] ifplusor commented on a diff in pull request #419: avoid possible type conversion compile error

Posted by GitBox <gi...@apache.org>.
ifplusor commented on code in PR #419:
URL: https://github.com/apache/rocketmq-client-cpp/pull/419#discussion_r906770391


##########
src/producer/StringIdMaker.cpp:
##########
@@ -125,11 +125,11 @@ std::string StringIdMaker::createUniqID() {
   return std::string(kFixString, 20) + std::string(hex_buf, 12);
 }
 
-void StringIdMaker::hexdump(unsigned char* in, char* out, std::size_t len) {
-  for (std::size_t i = 0; i < len; i++) {
-    unsigned char v = in[i];
-    out[i * 2] = sHexAlphabet[v >> 4];
-    out[i * 2 + 1] = sHexAlphabet[v & 0x0FU];
+void StringIdMaker::hexdump(unsigned char* buffer, char* out_buff, std::size_t index) {
+  for (std::size_t i = 0; i < index; i++) {
+    unsigned char v = buffer[i];
+    out_buff[i * 2] = sHexAlphabet[v >> 4];
+    out_buff[i * 2 + 1] = sHexAlphabet[v & 0x0FU];

Review Comment:
   Rename is unnecessary.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq-client-cpp] ifplusor commented on a diff in pull request #419: avoid possible type conversion compile error

Posted by GitBox <gi...@apache.org>.
ifplusor commented on code in PR #419:
URL: https://github.com/apache/rocketmq-client-cpp/pull/419#discussion_r906770176


##########
src/transport/TcpTransport.cpp:
##########
@@ -207,7 +207,7 @@ void TcpTransport::eventCallback(BufferEvent* event, short what, TcpTransport* t
 
     // disable Nagle
     int val = 1;
-    setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void*)&val, sizeof(val));
+    setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, static_cast<const char *>((void*)&val), sizeof(val));

Review Comment:
   Why not below?
   ```c++
       setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, static_cast<const char *>(&val), sizeof(val));
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq-client-cpp] ifplusor commented on a diff in pull request #419: avoid possible type conversion compile error

Posted by GitBox <gi...@apache.org>.
ifplusor commented on code in PR #419:
URL: https://github.com/apache/rocketmq-client-cpp/pull/419#discussion_r906770176


##########
src/transport/TcpTransport.cpp:
##########
@@ -207,7 +207,7 @@ void TcpTransport::eventCallback(BufferEvent* event, short what, TcpTransport* t
 
     // disable Nagle
     int val = 1;
-    setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void*)&val, sizeof(val));
+    setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, static_cast<const char *>((void*)&val), sizeof(val));

Review Comment:
   Why not below?
   ```suggestion
       setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, static_cast<const char *>(&val), sizeof(val));
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq-client-cpp] ShannonDing merged pull request #419: avoid possible type conversion compile error

Posted by GitBox <gi...@apache.org>.
ShannonDing merged PR #419:
URL: https://github.com/apache/rocketmq-client-cpp/pull/419


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org