fix some windows type conversion warning

This commit is contained in:
Tianqi Chen 2014-08-30 12:40:51 -07:00
parent 99c44f2e51
commit 3f7aeb22c5
4 changed files with 17 additions and 8 deletions

View File

@ -5,7 +5,7 @@ CXX=`Rcmd config CXX`
TCFLAGS=`Rcmd config CFLAGS` TCFLAGS=`Rcmd config CFLAGS`
# expose these flags to R CMD SHLIB # expose these flags to R CMD SHLIB
PKG_CPPFLAGS= -DXGBOOST_CUSTOMIZE_ERROR_ -I$(PKGROOT) $(SHLIB_OPENMP_CFLAGS) PKG_CPPFLAGS= -DXGBOOST_CUSTOMIZE_ERROR_ -I$(PKGROOT) $(SHLIB_OPENMP_CFLAGS)
XGBFLAG= -O3 -DXGBOOST_CUSTOMIZE_ERROR_ -fPIC $(SHLIB_OPENMP_CFLAGS) XGBFLAG= -O3 -DXGBOOST_CUSTOMIZE_ERROR_ -fPIC $(SHLIB_OPENMP_CFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CFLAGS) PKG_LIBS = $(SHLIB_OPENMP_CFLAGS)
ifeq ($(no_omp),1) ifeq ($(no_omp),1)

View File

@ -105,7 +105,9 @@ class DMatrixSimple : public DataMatrix {
if (!silent) { if (!silent) {
printf("%lux%lu matrix with %lu entries is loaded from %s\n", printf("%lux%lu matrix with %lu entries is loaded from %s\n",
info.num_row(), info.num_col(), row_data_.size(), fname); static_cast<unsigned long>(info.num_row()),
static_cast<unsigned long>(info.num_col()),
static_cast<unsigned long>(row_data_.size()), fname);
} }
fclose(file); fclose(file);
// try to load in additional file // try to load in additional file
@ -155,7 +157,9 @@ class DMatrixSimple : public DataMatrix {
if (!silent) { if (!silent) {
printf("%lux%lu matrix with %lu entries is loaded", printf("%lux%lu matrix with %lu entries is loaded",
info.num_row(), info.num_col(), row_data_.size()); static_cast<unsigned long>(info.num_row()),
static_cast<unsigned long>(info.num_col()),
static_cast<unsigned long>(row_data_.size()));
if (fname != NULL) { if (fname != NULL) {
printf(" from %s\n", fname); printf(" from %s\n", fname);
} else { } else {
@ -183,9 +187,12 @@ class DMatrixSimple : public DataMatrix {
if (!silent) { if (!silent) {
printf("%lux%lu matrix with %lu entries is saved to %s\n", printf("%lux%lu matrix with %lu entries is saved to %s\n",
info.num_row(), info.num_col(), row_data_.size(), fname); static_cast<unsigned long>(info.num_row()),
static_cast<unsigned long>(info.num_col()),
static_cast<unsigned long>(row_data_.size()), fname);
if (info.group_ptr.size() != 0) { if (info.group_ptr.size() != 0) {
printf("data contains %lu groups\n", info.group_ptr.size()-1); printf("data contains %u groups\n",
static_cast<unsigned>(info.group_ptr.size()-1));
} }
} }
} }

View File

@ -98,7 +98,8 @@ struct MetaInfo {
group_ptr.push_back(group_ptr.back()+nline); group_ptr.push_back(group_ptr.back()+nline);
} }
if (!silent) { if (!silent) {
printf("%lu groups are loaded from %s\n", group_ptr.size()-1, fname); printf("%u groups are loaded from %s\n",
static_cast<unsigned>(group_ptr.size()-1), fname);
} }
fclose(fi); fclose(fi);
return true; return true;

View File

@ -66,10 +66,11 @@ class BoostLearner {
snprintf(str_temp, sizeof(str_temp), "%u", num_feature); snprintf(str_temp, sizeof(str_temp), "%u", num_feature);
this->SetParam("bst:num_feature", str_temp); this->SetParam("bst:num_feature", str_temp);
} }
snprintf(str_temp, sizeof(str_temp), "%lu", buffer_size); snprintf(str_temp, sizeof(str_temp), "%lu",
static_cast<unsigned long>(buffer_size));
this->SetParam("num_pbuffer", str_temp); this->SetParam("num_pbuffer", str_temp);
if (!silent) { if (!silent) {
printf("buffer_size=%ld\n", buffer_size); printf("buffer_size=%ld\n", static_cast<long>(buffer_size));
} }
} }
/*! /*!