Skip to content

Commit 7548215

Browse files
committed
Windows based warnings fix
Signed-off-by: Aleksandr Motsjonov <[email protected]>
1 parent b77cea4 commit 7548215

File tree

8 files changed

+123
-123
lines changed

8 files changed

+123
-123
lines changed

src/rawtoaces_core/define.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# include <windows.h>
2525
//# define snprintf _snprintf
2626
# define _CRT_SECURE_NO_WARNINGS
27-
# define cmp_str stricmp
27+
# define cmp_str _stricmp
2828
#else
2929
# define cmp_str strcasecmp
3030
#endif
@@ -266,7 +266,7 @@ inline void lowerCase( char *tex )
266266
std::string tmp( tex );
267267

268268
for ( size_t i = 0; i < tmp.size(); i++ )
269-
tex[i] = tolower( tex[i] );
269+
tex[i] = static_cast<char>( tolower( tex[i] ) );
270270
}
271271

272272
// Function to check if a value is numeric

src/rawtoaces_core/mathOps.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ vector<vector<T>> invertVM( const vector<vector<T>> &vMtx )
105105

106106
template <typename T> vector<T> invertV( const vector<T> &vMtx )
107107
{
108-
size_t size = std::sqrt( vMtx.size() );
108+
size_t size = static_cast<size_t>( std::sqrt( vMtx.size() ) );
109109
vector<vector<T>> tmp( size, vector<T>( size ) );
110110

111111
for ( size_t i = 0; i < size; i++ )

src/rawtoaces_core/rawtoaces_core.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ vector<double> CCT_to_xy( const double &cct )
4444

4545
void calculate_daylight_SPD( const int &cct_input, Spectrum &spectrum )
4646
{
47-
int step = spectrum.shape.step;
47+
int step = static_cast<int>( spectrum.shape.step );
4848
int wavelength_range = s_series[53].wl - s_series[0].wl;
4949
assert( wavelength_range % step == 0 );
5050

@@ -272,12 +272,12 @@ bool SpectralSolver::load_spectral_data(
272272
{
273273
for ( const auto &directory: _search_directories )
274274
{
275-
std::filesystem::path path( directory );
276-
path.append( file_path );
275+
std::filesystem::path search_path( directory );
276+
search_path.append( file_path );
277277

278-
if ( std::filesystem::exists( path ) )
278+
if ( std::filesystem::exists( search_path ) )
279279
{
280-
return out_data.load( path.string() );
280+
return out_data.load( search_path.string() );
281281
}
282282
}
283283

@@ -321,15 +321,15 @@ bool SpectralSolver::find_illuminant( const std::string &type )
321321
if ( is_daylight )
322322
{
323323
int cct = atoi( type.substr( 1 ).c_str() );
324-
const std::string type = "d" + std::to_string( cct );
325-
generate_illuminant( cct, type, true, illuminant );
324+
const std::string illuminant_type = "d" + std::to_string( cct );
325+
generate_illuminant( cct, illuminant_type, true, illuminant );
326326
return true;
327327
}
328328
else if ( is_blackbody )
329329
{
330330
int cct = atoi( type.substr( 0, type.length() - 1 ).c_str() );
331-
const std::string type = std::to_string( cct ) + "k";
332-
generate_illuminant( cct, type, false, illuminant );
331+
const std::string illuminant_type = std::to_string( cct ) + "k";
332+
generate_illuminant( cct, illuminant_type, false, illuminant );
333333
return true;
334334
}
335335
else
@@ -364,25 +364,25 @@ bool SpectralSolver::find_illuminant( const vector<double> &wb )
364364
// Daylight - pre-calculate
365365
for ( int cct = 4000; cct <= 25000; cct += 500 )
366366
{
367-
SpectralData &illuminant = _all_illuminants.emplace_back();
367+
SpectralData &illuminant_data = _all_illuminants.emplace_back();
368368
const std::string type = "d" + std::to_string( cct / 100 );
369-
generate_illuminant( cct, type, true, illuminant );
369+
generate_illuminant( cct, type, true, illuminant_data );
370370
}
371371

372372
// Blackbody - pre-calculate
373373
for ( int cct = 1500; cct < 4000; cct += 500 )
374374
{
375-
SpectralData &illuminant = _all_illuminants.emplace_back();
375+
SpectralData &illuminant_data = _all_illuminants.emplace_back();
376376
const std::string type = std::to_string( cct ) + "k";
377-
generate_illuminant( cct, type, false, illuminant );
377+
generate_illuminant( cct, type, false, illuminant_data );
378378
}
379379

380380
auto illuminant_files = collect_data_files( "illuminant" );
381381

382382
for ( const auto &illuminant_file: illuminant_files )
383383
{
384-
SpectralData &illuminant = _all_illuminants.emplace_back();
385-
if ( !illuminant.load( illuminant_file ) )
384+
SpectralData &illuminant_data = _all_illuminants.emplace_back();
385+
if ( !illuminant_data.load( illuminant_file ) )
386386
{
387387
_all_illuminants.pop_back();
388388
continue;

src/rawtoaces_core/spectral_data.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Spectrum::Spectrum( double value, const Shape &reference_shape )
2323
{
2424
if ( shape.step > 0 )
2525
values.resize(
26-
( shape.last - shape.first + shape.step ) / shape.step, value );
26+
static_cast<size_t>( ( shape.last - shape.first + shape.step ) / shape.step ), value );
2727
}
2828

2929
template <typename Val_or_Ref, typename F>

src/rawtoaces_util/image_converter.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ bool prepare_transform_DNG(
443443
// Extract illuminant type for this calibration
444444
auto key = "raw:dng:calibration_illuminant" + index_string;
445445
metadata.calibration[k].illuminant =
446-
image_spec.get_int_attribute( key );
446+
static_cast<unsigned short>( image_spec.get_int_attribute( key ) );
447447

448448
// Extract XYZ to RGB color matrix
449449
auto key1 = "raw:dng:color_matrix" + index_string;
@@ -1026,7 +1026,7 @@ bool ImageConverter::parse_parameters( const OIIO::ArgParse &arg_parser )
10261026
[&]() {
10271027
for ( int i = 0; i < 3; i++ )
10281028
for ( int j = 0; j < 3; j++ )
1029-
settings.custom_matrix[i][j] = i == j ? 1.0 : 0.0;
1029+
settings.custom_matrix[i][j] = i == j ? 1.0f : 0.0f;
10301030
} );
10311031

10321032
auto crop_box = arg_parser["crop-box"].as_vec<int>();
@@ -1065,7 +1065,7 @@ bool ImageConverter::parse_parameters( const OIIO::ArgParse &arg_parser )
10651065
if ( chromatic_aberration.size() == 2 )
10661066
{
10671067
for ( size_t i = 0; i < 2; i++ )
1068-
settings.chromatic_aberration[i] = chromatic_aberration[i];
1068+
settings.chromatic_aberration[i] = static_cast<float>( chromatic_aberration[i] );
10691069
}
10701070

10711071
auto demosaic_algorithm = arg_parser["demosaic"].get();
@@ -1095,7 +1095,7 @@ bool ImageConverter::parse_parameters( const OIIO::ArgParse &arg_parser )
10951095
settings.headroom = arg_parser["headroom"].get<float>();
10961096
settings.auto_bright = arg_parser["auto-bright"].get<int>();
10971097
settings.adjust_maximum_threshold =
1098-
arg_parser["adjust-maximum-threshold"].get<int>();
1098+
static_cast<float>( arg_parser["adjust-maximum-threshold"].get<int>() );
10991099
settings.black_level = arg_parser["black-level"].get<int>();
11001100
settings.saturation_level = arg_parser["saturation-level"].get<int>();
11011101
settings.half_size = arg_parser["half-size"].get<int>();
@@ -1401,10 +1401,10 @@ bool ImageConverter::configure(
14011401

14021402
for ( size_t i = 0; i < _WB_multipliers.size(); i++ )
14031403
{
1404-
custom_WB[i] = _WB_multipliers[i];
1404+
custom_WB[i] = static_cast<float>( _WB_multipliers[i] );
14051405
}
14061406
if ( _WB_multipliers.size() == 3 )
1407-
custom_WB[3] = _WB_multipliers[1];
1407+
custom_WB[3] = static_cast<float>( _WB_multipliers[1] );
14081408

14091409
options.attribute(
14101410
"raw:user_mul",
@@ -1473,7 +1473,7 @@ bool apply_matrix(
14731473
{
14741474
for ( size_t j = 0; j < num_columns; j++ )
14751475
{
1476-
M[j][i] = matrix[i][j];
1476+
M[j][i] = static_cast<float>( matrix[i][j] );
14771477
}
14781478

14791479
for ( size_t j = num_columns; j < 4; j++ )
@@ -1634,8 +1634,8 @@ bool ImageConverter::save_image(
16341634
// - acesImageContainerFlag present,
16351635
// - no compression.
16361636

1637-
const float chromaticities[] = { 0.7347, 0.2653, 0, 1,
1638-
0.0001, -0.077, 0.32168, 0.33767 };
1637+
const float chromaticities[] = { 0.7347f, 0.2653f, 0.0f, 1.0f,
1638+
0.0001f, -0.077f, 0.32168f, 0.33767f };
16391639

16401640
OIIO::ImageSpec image_spec = buf.spec();
16411641
image_spec.set_format( OIIO::TypeDesc::HALF );

0 commit comments

Comments
 (0)