[GitHub] [hadoop] GauthamBanasandra commented on a diff in pull request #4228: HDFS-16468. Define ssize_t for Windows

2022-04-27 Thread GitBox


GauthamBanasandra commented on code in PR #4228:
URL: https://github.com/apache/hadoop/pull/4228#discussion_r859962108


##
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/x-platform/types.h:
##
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NATIVE_LIBHDFSPP_LIB_CROSS_PLATFORM_TYPES
+#define NATIVE_LIBHDFSPP_LIB_CROSS_PLATFORM_TYPES
+
+#if _WIN32 || _WIN64

Review Comment:
   Done.



-- 
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: common-issues-unsubscr...@hadoop.apache.org

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


-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[GitHub] [hadoop] GauthamBanasandra commented on a diff in pull request #4228: HDFS-16468. Define ssize_t for Windows

2022-04-26 Thread GitBox


GauthamBanasandra commented on code in PR #4228:
URL: https://github.com/apache/hadoop/pull/4228#discussion_r858971962


##
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/jni_helper.c:
##
@@ -487,10 +488,10 @@ static ssize_t wildcard_expandPath(const char* path, 
char* expanded)
  * allocated after using this function with expandedClasspath=NULL to get the
  * right size.
  */
-static ssize_t getClassPath_helper(const char *classpath, char* 
expandedClasspath)
+static x_platform_ssize_t getClassPath_helper(const char *classpath, char* 
expandedClasspath)
 {
-ssize_t length;
-ssize_t retval;
+x_platform_ssize_t length;

Review Comment:
   > Is this the best way to do this? Can't we just do the typedef for windows?
   
   I've handled this now.



-- 
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: common-issues-unsubscr...@hadoop.apache.org

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


-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[GitHub] [hadoop] GauthamBanasandra commented on a diff in pull request #4228: HDFS-16468. Define ssize_t for Windows

2022-04-25 Thread GitBox


GauthamBanasandra commented on code in PR #4228:
URL: https://github.com/apache/hadoop/pull/4228#discussion_r858176463


##
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/jni_helper.c:
##
@@ -487,10 +488,10 @@ static ssize_t wildcard_expandPath(const char* path, 
char* expanded)
  * allocated after using this function with expandedClasspath=NULL to get the
  * right size.
  */
-static ssize_t getClassPath_helper(const char *classpath, char* 
expandedClasspath)
+static x_platform_ssize_t getClassPath_helper(const char *classpath, char* 
expandedClasspath)
 {
-ssize_t length;
-ssize_t retval;
+x_platform_ssize_t length;

Review Comment:
   I've defined `ssize_t ` type under the `XPlatform::` namespace in C++ files. 
Since C lacks namespaces, I had to resort to adding `x_platform_` prefix.

   But no worries, even I had some reservations with this approach. I'll just 
rewrite this PR to use a common `ssize_t` typedef in a header file. We'll worry 
about the future possible conflicts with `ssize_t` if/whenever it happens.



-- 
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: common-issues-unsubscr...@hadoop.apache.org

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


-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[GitHub] [hadoop] GauthamBanasandra commented on a diff in pull request #4228: HDFS-16468. Define ssize_t for Windows

2022-04-25 Thread GitBox


GauthamBanasandra commented on code in PR #4228:
URL: https://github.com/apache/hadoop/pull/4228#discussion_r857914148


##
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/examples/cc/cat/cat.cc:
##
@@ -62,7 +62,6 @@ int main(int argc, char *argv[]) {
   //wrapping file_raw into a unique pointer to guarantee deletion
   std::unique_ptr file(file_raw);
 
-  ssize_t total_bytes_read = 0;

Review Comment:
   No, this isn't used at all.



-- 
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: common-issues-unsubscr...@hadoop.apache.org

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


-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[GitHub] [hadoop] GauthamBanasandra commented on a diff in pull request #4228: HDFS-16468. Define ssize_t for Windows

2022-04-25 Thread GitBox


GauthamBanasandra commented on code in PR #4228:
URL: https://github.com/apache/hadoop/pull/4228#discussion_r857913849


##
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/jni_helper.c:
##
@@ -487,10 +488,10 @@ static ssize_t wildcard_expandPath(const char* path, 
char* expanded)
  * allocated after using this function with expandedClasspath=NULL to get the
  * right size.
  */
-static ssize_t getClassPath_helper(const char *classpath, char* 
expandedClasspath)
+static x_platform_ssize_t getClassPath_helper(const char *classpath, char* 
expandedClasspath)
 {
-ssize_t length;
-ssize_t retval;
+x_platform_ssize_t length;

Review Comment:
   I put the `x_platform_` prefix to avoid any possible future conflicts with 
ssize_t. Like, if someone were to include a third-party library header that 
defines its own version of ssize_t, it shouldn't affect these parts.
   That's just my view. However, I don't mind just using the ssize_t typedef 
instead of x_platform_ssize_t if you prefer that.



-- 
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: common-issues-unsubscr...@hadoop.apache.org

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


-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org