fix MSVC compilation/build issues

This commit is contained in:
Mario Fink 2021-07-02 09:39:16 +02:00
parent 1d7a512fd4
commit cda6673f85
5 changed files with 28 additions and 28 deletions

View File

@ -63,7 +63,7 @@ namespace imc
std::cout<<"WARNING: invalid length parameter in "<<thekey_.name_<<"-block " std::cout<<"WARNING: invalid length parameter in "<<thekey_.name_<<"-block "
<<"(block-end:"<<end_<<",buffer-size:"<<buffer_->size()<<")" <<"(block-end:"<<end_<<",buffer-size:"<<buffer_->size()<<")"
<<" => resetting block-end to buffer-size\n"; <<" => resetting block-end to buffer-size\n";
end_ = buffer_->size(); end_ = (unsigned long int)(buffer_->size());
} }
try { try {

View File

@ -215,7 +215,7 @@ namespace imc
// xname_ = std::string("time"); // xname_ = std::string("time");
// find appropriate precision for "xdata_" by means of "xstepwidth_" // find appropriate precision for "xdata_" by means of "xstepwidth_"
xprec_ = (xstepwidth_ > 0 ) ? ceil(fabs(log10(xstepwidth_))) : 10; xprec_ = (xstepwidth_ > 0 ) ? (int)ceil(fabs(log10(xstepwidth_))) : 10;
} }
// extract associated CP data // extract associated CP data
@ -296,7 +296,7 @@ namespace imc
buffer_->begin()+buffstrt+buffer_size_+1 ); buffer_->begin()+buffstrt+buffer_size_+1 );
// determine number of values in buffer // determine number of values in buffer
unsigned long int num_values = CSbuffer.size()/(signbits_/8); unsigned long int num_values = (unsigned long int)(CSbuffer.size()/(signbits_/8));
if ( num_values*(signbits_/8) != CSbuffer.size() ) if ( num_values*(signbits_/8) != CSbuffer.size() )
{ {
throw std::runtime_error("CSbuffer and significant bits of datatype don't match"); throw std::runtime_error("CSbuffer and significant bits of datatype don't match");

View File

@ -48,7 +48,7 @@ namespace imc
public: public:
datatype(): ubyte_(0), sbyte_(0), datatype(): ubyte_(0), sbyte_(0),
ushort_(0), sshort_(0), ushort_(0), sshort_(0),
ulint_(0.0), slint_(0.0), ulint_(0), slint_(0),
sfloat_(0.0), sdouble_(0.0), sfloat_(0.0), sdouble_(0.0),
sdigital_(0), sdigital_(0),
dtidx_(0) { }; dtidx_(0) { };
@ -61,10 +61,10 @@ namespace imc
datatype(imc_Slongint num): slint_(num), dtidx_(5) {}; datatype(imc_Slongint num): slint_(num), dtidx_(5) {};
datatype(imc_float num): sfloat_(num), dtidx_(6) {}; datatype(imc_float num): sfloat_(num), dtidx_(6) {};
datatype(imc_double num): ubyte_(0), sbyte_(0), ushort_(0), sshort_(0), datatype(imc_double num): ubyte_(0), sbyte_(0), ushort_(0), sshort_(0),
ulint_(0.0), slint_(0.0), sfloat_(0.0), sdouble_(num), ulint_(0), slint_(0), sfloat_(0.0), sdouble_(num),
sdigital_(0), dtidx_(7) {}; sdigital_(0), dtidx_(7) {};
datatype(imc_digital num): ubyte_(0), sbyte_(0), ushort_(0), sshort_(0), datatype(imc_digital num): ubyte_(0), sbyte_(0), ushort_(0), sshort_(0),
ulint_(0.0), slint_(0.0), sfloat_(0.0), sdouble_(num), ulint_(0), slint_(0), sfloat_(0.0), sdouble_(num),
sdigital_(num), dtidx_(10) {}; sdigital_(num), dtidx_(10) {};
// identify type // identify type

View File

@ -500,22 +500,22 @@ namespace imc
minute_ = std::stoi( get_parameter(buffer,&parameters[6]) ); minute_ = std::stoi( get_parameter(buffer,&parameters[6]) );
second_ = std::stod( get_parameter(buffer,&parameters[7]) ); second_ = std::stod( get_parameter(buffer,&parameters[7]) );
time_t rawtime; //time_t rawtime;
struct tm ts; //struct tm ts;
time(&rawtime); //time(&rawtime);
localtime_r(&rawtime,&ts); //localtime_r(&rawtime,&ts);
ts.tm_mday = day_; //ts.tm_mday = day_;
ts.tm_mon = month_-1; //ts.tm_mon = month_-1;
ts.tm_year = year_-1900; //ts.tm_year = year_-1900;
ts.tm_hour = hour_; //ts.tm_hour = hour_;
ts.tm_min = minute_; //ts.tm_min = minute_;
ts.tm_sec = (int)second_; //ts.tm_sec = (int)second_;
asctime_r(&ts,&timestamp_[0]); //asctime_r(&ts,&timestamp_[0]);
// timestamp_ = std::to_string(year_) + std::string("-") + std::to_string(month_) timestamp_ = std::to_string(year_) + std::string("-") + std::to_string(month_)
// + std::string("-") + std::to_string(day_) + std::string("-") + std::to_string(day_)
// + std::string("T") + std::to_string(hour_) + std::string("T") + std::to_string(hour_)
// + std::string(":") + std::to_string(minute_) + std::string(":") + std::to_string(minute_)
// + std::string(":") + std::to_string(second_); + std::string(":") + std::to_string(second_);
} }
// get info string // get info string

View File

@ -123,20 +123,20 @@ namespace imc
leng.push_back((char)*(it+pos)); leng.push_back((char)*(it+pos));
pos++; pos++;
} }
unsigned long length = std::stoul(leng); unsigned long int length = std::stoul(leng);
// declare and initialize corresponding key and block // declare and initialize corresponding key and block
// imc::key bkey( *(it+1)==imc::key_crit_ , newkey, // imc::key bkey( *(it+1)==imc::key_crit_ , newkey,
// imc::keys.at(newkey).description_, version ); // imc::keys.at(newkey).description_, version );
imc::block blk(itkey,it-buffer_.begin(), imc::block blk(itkey,(unsigned long int)(it-buffer_.begin()),
it-buffer_.begin()+pos+1+length, (unsigned long int)(it-buffer_.begin()+pos+1+length),
raw_file_, &buffer_); raw_file_, &buffer_);
// add block to list // add block to list
rawblocks_.push_back(blk); rawblocks_.push_back(blk);
// skip the remaining block according to its length // skip the remaining block according to its length
if ( it-buffer_.begin()+length < buffer_.size() ) if ( (unsigned long int)(it-buffer_.begin()+length) < (unsigned long int)(buffer_.size()) )
{ {
std::advance(it,length); std::advance(it,length);
} }
@ -253,7 +253,7 @@ namespace imc
// provide buffer size // provide buffer size
unsigned long int buffer_size() unsigned long int buffer_size()
{ {
return buffer_.size(); return (unsigned long int)buffer_.size();
} }
// get blocks // get blocks
@ -377,7 +377,7 @@ namespace imc
std::filesystem::path pf = pd / filenam; std::filesystem::path pf = pd / filenam;
// and print the channel // and print the channel
it->second.print(pf,sep); it->second.print(pf.u8string(),sep);
} }
} }