"src/objective/vscode:/vscode.git/clone" did not exist on "a46c68fe318adf824fb62549cfb938bfc7f6e2a3"
Commit 11f9682b authored by Shaochen Shi's avatar Shaochen Shi Committed by Guolin Ke
Browse files

Fix build error when HDFS is enabled. (#2540)

* Fix build error when HDFS is enabled.

* Replace string with char array to eliminate cpplint.
parent 26ff099a
......@@ -55,6 +55,7 @@ struct LocalFile : VirtualFileReader, VirtualFileWriter {
};
const char* kHdfsProto = "hdfs://";
const size_t kHdfsProtoLength = strlen(kHdfsProto);
#ifdef USE_HDFS
struct HDFSFile : VirtualFileReader, VirtualFileWriter {
......@@ -117,12 +118,12 @@ struct HDFSFile : VirtualFileReader, VirtualFileWriter {
}
static hdfsFS GetHDFSFileSystem(const std::string& uri) {
size_t end = uri.find("/", kHdfsProto.length());
size_t end = uri.find("/", kHdfsProtoLength);
if (uri.find(kHdfsProto) != 0 || end == std::string::npos) {
Log::Warning("Bad HDFS uri, no namenode found [%s]", uri.c_str());
return NULL;
}
std::string hostport = uri.substr(kHdfsProto.length(), end - kHdfsProto.length());
std::string hostport = uri.substr(kHdfsProtoLength, end - kHdfsProtoLength);
if (fs_cache_.count(hostport) == 0) {
fs_cache_[hostport] = MakeHDFSFileSystem(hostport);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment