clang-tidy/clang-format fixes

This commit is contained in:
Stephen Seo 2021-11-16 17:36:51 +09:00
parent ddb83ac7fc
commit 4f78d92bc8
4 changed files with 10 additions and 10 deletions

View file

@ -272,7 +272,6 @@ void Image::DecodePNG(const std::string &filename) {
// pass the FILE pointer to libpng
png_init_io(png_ptr, file);
// TODO BEGIN
// have libpng process the png data
png_read_png(png_ptr, png_info_ptr, PNG_TRANSFORM_IDENTITY, nullptr);
@ -404,7 +403,7 @@ void Image::DecodePGM(const std::string &filename) {
<< '"' << std::endl;
return;
}
value = (float)int_input / max_value;
value = static_cast<float>(int_input) / max_value;
data_.push_back(std::round(value * 255.0F));
}
} else if (str_input.compare("P5") == 0) {
@ -453,7 +452,7 @@ void Image::DecodePGM(const std::string &filename) {
std::cout << "WARNING: File data after PGM max is not whitespace "
"(filename \""
<< filename << "\")"
<< " value is " << (int)c << std::endl;
<< " value is " << c << std::endl;
}
if (!ifs.good()) {
@ -557,7 +556,7 @@ void Image::DecodePPM(const std::string &filename) {
<< '"' << std::endl;
return;
}
value = (float)int_input / max_value;
value = static_cast<float>(int_input) / max_value;
data_.push_back(std::round(value * 255.0F));
if (i % 3 == 2) {
// PPM is RGB but Image stores as RGBA
@ -609,7 +608,7 @@ void Image::DecodePPM(const std::string &filename) {
if (c != '\n' && c != ' ') {
std::cout
<< "WARNING: File data after PPM max is not whitespace (filename \""
<< filename << "\") value is " << (int)c << std::endl;
<< filename << "\") value is " << c << std::endl;
}
if (!ifs.good()) {

View file

@ -17,10 +17,10 @@ class Image {
* Image supports decoding .png, .pgm, and .ppm . Decoding only checks the
* filename suffix as a guide on which file-type to expect.
*/
Image(const char *filename);
explicit Image(const char *filename);
/// Same constructor as Image(const char *filename)
Image(const std::string &filename);
explicit Image(const std::string &filename);
// allow copy
Image(const Image &other) = default;

View file

@ -562,7 +562,8 @@ OpenCLContext::OpenCLContext() : context_(nullptr), queue_(nullptr) {
}
cl_context_properties context_properties[] = {
CL_CONTEXT_PLATFORM, (cl_context_properties)first_platform_id, 0};
CL_CONTEXT_PLATFORM,
static_cast<cl_context_properties>(first_platform_id), 0};
context_ = clCreateContextFromType(context_properties, CL_DEVICE_TYPE_GPU,
nullptr, nullptr, &err_num);