diff --git a/src/io/dmlc_simple.cpp b/src/io/dmlc_simple.cpp index b828a631e..065877a19 100644 --- a/src/io/dmlc_simple.cpp +++ b/src/io/dmlc_simple.cpp @@ -141,7 +141,7 @@ class SingleFileSplit : public dmlc::InputSplit { class StdFile : public dmlc::Stream { public: - explicit StdFile(FILE *fp, bool use_stdio) + explicit StdFile(std::FILE *fp, bool use_stdio) : fp(fp), use_stdio(use_stdio) { } virtual ~StdFile(void) { @@ -180,6 +180,7 @@ InputSplit* InputSplit::Create(const char *uri, unsigned part, unsigned nsplit, const char *type) { + using namespace std; using namespace xgboost; const char *msg = "xgboost is compiled in local mode\n"\ "to use hdfs, s3 or distributed version, compile with make dmlc=1"; @@ -190,13 +191,14 @@ InputSplit* InputSplit::Create(const char *uri, } Stream *Stream::Create(const char *fname, const char * const mode, bool allow_null) { + using namespace std; using namespace xgboost; const char *msg = "xgboost is compiled in local mode\n"\ "to use hdfs, s3 or distributed version, compile with make dmlc=1"; utils::Check(strncmp(fname, "s3://", 5) != 0, msg); utils::Check(strncmp(fname, "hdfs://", 7) != 0, msg); - FILE *fp = NULL; + std::FILE *fp = NULL; bool use_stdio = false; using namespace std; #ifndef XGBOOST_STRICT_CXX98_ diff --git a/src/io/io.cpp b/src/io/io.cpp index a9b98d652..dd4336170 100644 --- a/src/io/io.cpp +++ b/src/io/io.cpp @@ -15,6 +15,7 @@ DataMatrix* LoadDataMatrix(const char *fname, bool savebuffer, bool loadsplit, const char *cache_file) { + using namespace std; std::string fname_ = fname; const char *dlm = strchr(fname, '#'); diff --git a/src/io/libsvm_parser.h b/src/io/libsvm_parser.h index d9712c1f1..0e69d0467 100644 --- a/src/io/libsvm_parser.h +++ b/src/io/libsvm_parser.h @@ -111,7 +111,8 @@ class LibSVMPageFactory { */ inline void ParseBlock(char *begin, char *end, - LibSVMPage *out) { + LibSVMPage *out) { + using namespace std; out->Clear(); char *p = begin; while (p != end) { diff --git a/src/io/page_fmatrix-inl.hpp b/src/io/page_fmatrix-inl.hpp index 58038a874..7d4cdb9cf 100644 --- a/src/io/page_fmatrix-inl.hpp +++ b/src/io/page_fmatrix-inl.hpp @@ -255,7 +255,7 @@ class FMatrixPage : public IFMatrix { protected: inline bool TryLoadColData(void) { - FILE *fi = fopen64(col_meta_name_.c_str(), "rb"); + std::FILE *fi = fopen64(col_meta_name_.c_str(), "rb"); if (fi == NULL) return false; utils::FileStream fs(fi); LoadMeta(&fs); diff --git a/src/utils/thread.h b/src/utils/thread.h index 830b21cbe..14c27a785 100644 --- a/src/utils/thread.h +++ b/src/utils/thread.h @@ -55,8 +55,10 @@ inline void ThreadExit(void *status) { } // namespace xgboost #else // thread interface using g++ +extern "C" { #include #include +} namespace xgboost { namespace utils { /*!\brief semaphore class */ @@ -120,6 +122,7 @@ class Semaphore { } #endif }; + /*!\brief simple thread class */ class Thread { private: @@ -130,7 +133,7 @@ class Thread { pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); pthread_create(&thread, &attr, entry, param); - } + } inline int Join(void) { void *status; return pthread_join(thread, &status); diff --git a/src/utils/thread_buffer.h b/src/utils/thread_buffer.h index d4ca1d111..2bf365ae2 100644 --- a/src/utils/thread_buffer.h +++ b/src/utils/thread_buffer.h @@ -31,7 +31,8 @@ class ThreadBuffer { } /*!\brief set parameter, will also pass the parameter to factory */ inline void SetParam(const char *name, const char *val) { - if (!std::strcmp( name, "buffer_size")) buf_size = atoi(val); + using namespace std; + if (!strcmp( name, "buffer_size")) buf_size = atoi(val); factory.SetParam(name, val); } /*!