diff options
author | 2020-01-31 03:46:27 +0100 | |
---|---|---|
committer | 2020-01-30 21:46:27 -0500 | |
commit | dfaf9dd5bcf354f09fde7573b7042bb63d84fad0 (patch) | |
tree | d018f200f2077123b6e0971499b1de213577ded4 /src/lib | |
parent | 4a102057779ece1b11431ff0b7787249ce0ad3ad (diff) |
fixed some modernize-use-auto clang-tidy warnings (nw) (#6238)
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/util/aviio.cpp | 12 | ||||
-rw-r--r-- | src/lib/util/cdrom.cpp | 4 | ||||
-rw-r--r-- | src/lib/util/chd.cpp | 12 | ||||
-rw-r--r-- | src/lib/util/chdcodec.cpp | 12 | ||||
-rw-r--r-- | src/lib/util/corefile.cpp | 2 | ||||
-rw-r--r-- | src/lib/util/flac.cpp | 2 | ||||
-rw-r--r-- | src/lib/util/hashing.cpp | 2 | ||||
-rw-r--r-- | src/lib/util/jedparse.cpp | 8 | ||||
-rw-r--r-- | src/lib/util/plaparse.cpp | 2 | ||||
-rw-r--r-- | src/lib/util/png.cpp | 10 | ||||
-rw-r--r-- | src/lib/util/wavwrite.cpp | 2 | ||||
-rw-r--r-- | src/lib/util/xmlfile.cpp | 8 |
12 files changed, 38 insertions, 38 deletions
diff --git a/src/lib/util/aviio.cpp b/src/lib/util/aviio.cpp index 99958577d57..067f81fef27 100644 --- a/src/lib/util/aviio.cpp +++ b/src/lib/util/aviio.cpp @@ -298,7 +298,7 @@ public: std::uint32_t width = info.video_width; std::uint32_t height = info.video_height; - std::uint32_t integal_multiple = std::uint32_t(AVI_INTEGRAL_MULTIPLE); + auto integal_multiple = std::uint32_t(AVI_INTEGRAL_MULTIPLE); if (integal_multiple > 1) { width = width - (width % integal_multiple); @@ -720,8 +720,8 @@ inline void put_64bits(std::uint8_t *data, std::uint64_t value) inline void u64toa(std::uint64_t val, char *output) { - std::uint32_t lo = std::uint32_t(val & 0xffffffff); - std::uint32_t hi = std::uint32_t(val >> 32); + auto lo = std::uint32_t(val & 0xffffffff); + auto hi = std::uint32_t(val >> 32); if (hi != 0) sprintf(output, "%X%08X", hi, lo); else @@ -1055,7 +1055,7 @@ avi_file::error avi_stream::rgb32_compress_to_rgb(const bitmap_rgb32 &bitmap, st avi_file::error avi_stream::yuv_decompress_to_yuy16(const std::uint8_t *data, std::uint32_t numbytes, bitmap_yuy16 &bitmap) const { - std::uint16_t const *const dataend = reinterpret_cast<const std::uint16_t *>(data + numbytes); + auto const *const dataend = reinterpret_cast<const std::uint16_t *>(data + numbytes); int x, y; /* compressed video */ @@ -1107,7 +1107,7 @@ avi_file::error avi_stream::yuv_decompress_to_yuy16(const std::uint8_t *data, st avi_file::error avi_stream::yuy16_compress_to_yuy(const bitmap_yuy16 &bitmap, std::uint8_t *data, std::uint32_t numbytes) const { - std::uint16_t *const dataend = reinterpret_cast<std::uint16_t *>(data + numbytes); + auto *const dataend = reinterpret_cast<std::uint16_t *>(data + numbytes); int x, y; /* compressed video */ @@ -1871,7 +1871,7 @@ avi_file::error avi_file_impl::read_sound_samples(int channel, std::uint32_t fir /* extract 16-bit samples from the chunk */ if (stream->samplebits() == 16) { - const std::int16_t *base = reinterpret_cast<const std::int16_t *>(&m_tempbuffer[8]); + const auto *base = reinterpret_cast<const std::int16_t *>(&m_tempbuffer[8]); base += stream->channels() * (firstsample - chunkbase) + offset; for (sampnum = 0; sampnum < samples_this_chunk; sampnum++) { diff --git a/src/lib/util/cdrom.cpp b/src/lib/util/cdrom.cpp index d2415108d80..94efa870d8d 100644 --- a/src/lib/util/cdrom.cpp +++ b/src/lib/util/cdrom.cpp @@ -558,7 +558,7 @@ uint32_t cdrom_read_data(cdrom_file *file, uint32_t lbasector, void *buffer, uin /* return 2352 byte mode 1 raw sector from 2048 bytes of mode 1 data */ if ((datatype == CD_TRACK_MODE1_RAW) && (tracktype == CD_TRACK_MODE1)) { - uint8_t *bufptr = (uint8_t *)buffer; + auto *bufptr = (uint8_t *)buffer; uint32_t msf = lba_to_msf(lbasector); static const uint8_t syncbytes[12] = {0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00}; @@ -1247,7 +1247,7 @@ chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc) return err; /* reconstruct the TOC from it */ - uint32_t *mrp = reinterpret_cast<uint32_t *>(&oldmetadata[0]); + auto *mrp = reinterpret_cast<uint32_t *>(&oldmetadata[0]); toc->numtrks = *mrp++; for (i = 0; i < CD_MAX_TRACKS; i++) diff --git a/src/lib/util/chd.cpp b/src/lib/util/chd.cpp index 274c6a37aab..daad423147a 100644 --- a/src/lib/util/chd.cpp +++ b/src/lib/util/chd.cpp @@ -888,7 +888,7 @@ chd_error chd_file::read_hunk(uint32_t hunknum, void *buffer) uint32_t blocklen; util::crc32_t blockcrc; uint8_t *rawmap; - uint8_t *dest = reinterpret_cast<uint8_t *>(buffer); + auto *dest = reinterpret_cast<uint8_t *>(buffer); switch (m_version) { // v3/v4 map entries @@ -1045,7 +1045,7 @@ chd_error chd_file::write_hunk(uint32_t hunknum, const void *buffer) { // first make sure we need to allocate it bool all_zeros = true; - const uint32_t *scan = reinterpret_cast<const uint32_t *>(buffer); + const auto *scan = reinterpret_cast<const uint32_t *>(buffer); for (uint32_t index = 0; index < m_hunkbytes / 4; index++) if (scan[index] != 0) { @@ -1140,7 +1140,7 @@ chd_error chd_file::read_bytes(uint64_t offset, void *buffer, uint32_t bytes) // iterate over hunks uint32_t first_hunk = offset / m_hunkbytes; uint32_t last_hunk = (offset + bytes - 1) / m_hunkbytes; - uint8_t *dest = reinterpret_cast<uint8_t *>(buffer); + auto *dest = reinterpret_cast<uint8_t *>(buffer); for (uint32_t curhunk = first_hunk; curhunk <= last_hunk; curhunk++) { // determine start/end boundaries @@ -1193,7 +1193,7 @@ chd_error chd_file::write_bytes(uint64_t offset, const void *buffer, uint32_t by // iterate over hunks uint32_t first_hunk = offset / m_hunkbytes; uint32_t last_hunk = (offset + bytes - 1) / m_hunkbytes; - const uint8_t *source = reinterpret_cast<const uint8_t *>(buffer); + const auto *source = reinterpret_cast<const uint8_t *>(buffer); for (uint32_t curhunk = first_hunk; curhunk <= last_hunk; curhunk++) { // determine start/end boundaries @@ -3010,7 +3010,7 @@ chd_error chd_file_compressor::compress_continue(double &progress, double &ratio void *chd_file_compressor::async_walk_parent_static(void *param, int threadid) { - work_item *item = reinterpret_cast<work_item *>(param); + auto *item = reinterpret_cast<work_item *>(param); item->m_compressor->async_walk_parent(*item); return nullptr; } @@ -3052,7 +3052,7 @@ void chd_file_compressor::async_walk_parent(work_item &item) void *chd_file_compressor::async_compress_hunk_static(void *param, int threadid) { - work_item *item = reinterpret_cast<work_item *>(param); + auto *item = reinterpret_cast<work_item *>(param); item->m_compressor->async_compress_hunk(*item, threadid); return nullptr; } diff --git a/src/lib/util/chdcodec.cpp b/src/lib/util/chdcodec.cpp index 026393b60a2..3f76af302bd 100644 --- a/src/lib/util/chdcodec.cpp +++ b/src/lib/util/chdcodec.cpp @@ -751,7 +751,7 @@ void chd_zlib_allocator::install(z_stream &stream) voidpf chd_zlib_allocator::fast_alloc(voidpf opaque, uInt items, uInt size) { - chd_zlib_allocator *codec = reinterpret_cast<chd_zlib_allocator *>(opaque); + auto *codec = reinterpret_cast<chd_zlib_allocator *>(opaque); // compute the size, rounding to the nearest 1k size = (size * items + 0x3ff) & ~0x3ff; @@ -769,7 +769,7 @@ voidpf chd_zlib_allocator::fast_alloc(voidpf opaque, uInt items, uInt size) } // alloc a new one and put it into the list - uint32_t *ptr = reinterpret_cast<uint32_t *>(new uint8_t[size + sizeof(uint32_t)]); + auto *ptr = reinterpret_cast<uint32_t *>(new uint8_t[size + sizeof(uint32_t)]); for (int scan = 0; scan < MAX_ZLIB_ALLOCS; scan++) if (codec->m_allocptr[scan] == nullptr) { @@ -790,7 +790,7 @@ voidpf chd_zlib_allocator::fast_alloc(voidpf opaque, uInt items, uInt size) void chd_zlib_allocator::fast_free(voidpf opaque, voidpf address) { - chd_zlib_allocator *codec = reinterpret_cast<chd_zlib_allocator *>(opaque); + auto *codec = reinterpret_cast<chd_zlib_allocator *>(opaque); // find the hunk uint32_t *ptr = reinterpret_cast<uint32_t *>(address) - 1; @@ -971,7 +971,7 @@ chd_lzma_allocator::~chd_lzma_allocator() void *chd_lzma_allocator::fast_alloc(void *p, size_t size) { - chd_lzma_allocator *codec = reinterpret_cast<chd_lzma_allocator *>(p); + auto *codec = reinterpret_cast<chd_lzma_allocator *>(p); // compute the size, rounding to the nearest 1k size = (size + 0x3ff) & ~0x3ff; @@ -989,7 +989,7 @@ void *chd_lzma_allocator::fast_alloc(void *p, size_t size) } // alloc a new one and put it into the list - uint32_t *ptr = reinterpret_cast<uint32_t *>(new uint8_t[size + sizeof(uint32_t)]); + auto *ptr = reinterpret_cast<uint32_t *>(new uint8_t[size + sizeof(uint32_t)]); for (int scan = 0; scan < MAX_LZMA_ALLOCS; scan++) if (codec->m_allocptr[scan] == nullptr) { @@ -1013,7 +1013,7 @@ void chd_lzma_allocator::fast_free(void *p, void *address) if (address == nullptr) return; - chd_lzma_allocator *codec = reinterpret_cast<chd_lzma_allocator *>(p); + auto *codec = reinterpret_cast<chd_lzma_allocator *>(p); // find the hunk uint32_t *ptr = reinterpret_cast<uint32_t *>(address) - 1; diff --git a/src/lib/util/corefile.cpp b/src/lib/util/corefile.cpp index 148ac24c14b..1fe33c7e348 100644 --- a/src/lib/util/corefile.cpp +++ b/src/lib/util/corefile.cpp @@ -395,7 +395,7 @@ int core_text_file::getc() // fetch the next character char16_t utf16_buffer[UTF16_CHAR_MAX]; - char32_t uchar = char32_t(~0); + auto uchar = char32_t(~0); switch (m_text_type) { default: diff --git a/src/lib/util/flac.cpp b/src/lib/util/flac.cpp index 7fce66c2bce..9030249a7d0 100644 --- a/src/lib/util/flac.cpp +++ b/src/lib/util/flac.cpp @@ -559,7 +559,7 @@ void flac_decoder::metadata_callback_static(const FLAC__StreamDecoder *decoder, return; // parse out the data we care about - flac_decoder *fldecoder = reinterpret_cast<flac_decoder *>(client_data); + auto *fldecoder = reinterpret_cast<flac_decoder *>(client_data); fldecoder->m_sample_rate = metadata->data.stream_info.sample_rate; fldecoder->m_bits_per_sample = metadata->data.stream_info.bits_per_sample; fldecoder->m_channels = metadata->data.stream_info.channels; diff --git a/src/lib/util/hashing.cpp b/src/lib/util/hashing.cpp index 448cdc5d6ec..a5946f1ace8 100644 --- a/src/lib/util/hashing.cpp +++ b/src/lib/util/hashing.cpp @@ -284,7 +284,7 @@ void crc16_creator::append(const void *data, uint32_t length) 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 }; - const uint8_t *src = reinterpret_cast<const uint8_t *>(data); + const auto *src = reinterpret_cast<const uint8_t *>(data); // fetch the current value into a local and rip through the source data uint16_t crc = m_accum.m_raw; diff --git a/src/lib/util/jedparse.cpp b/src/lib/util/jedparse.cpp index 962a41a8ee0..d25b35c3328 100644 --- a/src/lib/util/jedparse.cpp +++ b/src/lib/util/jedparse.cpp @@ -189,7 +189,7 @@ static void process_field(jed_data *data, const uint8_t *cursrc, const uint8_t * int jed_parse(const void *data, size_t length, jed_data *result) { - const uint8_t *cursrc = (const uint8_t *)data; + const auto *cursrc = (const uint8_t *)data; const uint8_t *srcend = cursrc + length; const uint8_t *scan; jed_parse_info pinfo; @@ -283,7 +283,7 @@ int jed_parse(const void *data, size_t length, jed_data *result) size_t jed_output(const jed_data *data, void *result, size_t length) { - uint8_t *curdst = (uint8_t *)result; + auto *curdst = (uint8_t *)result; uint8_t *dstend = curdst + length; int i, zeros, ones; char tempbuf[256]; @@ -379,7 +379,7 @@ size_t jed_output(const jed_data *data, void *result, size_t length) int jedbin_parse(const void *data, size_t length, jed_data *result) { - const uint8_t *cursrc = (const uint8_t *)data; + const auto *cursrc = (const uint8_t *)data; /* initialize the output */ memset(result, 0, sizeof(*result)); @@ -424,7 +424,7 @@ int jedbin_parse(const void *data, size_t length, jed_data *result) size_t jedbin_output(const jed_data *data, void *result, size_t length) { - uint8_t *curdst = (uint8_t *)result; + auto *curdst = (uint8_t *)result; /* ensure we have enough room */ if (length >= 4 + (data->numfuses + 7) / 8) diff --git a/src/lib/util/plaparse.cpp b/src/lib/util/plaparse.cpp index fbecd27232b..756d29f46da 100644 --- a/src/lib/util/plaparse.cpp +++ b/src/lib/util/plaparse.cpp @@ -308,7 +308,7 @@ static bool process_field(jed_data *data, const uint8_t **src, const uint8_t *sr int pla_parse(const void *data, size_t length, jed_data *result) { - const uint8_t *src = (const uint8_t *)data; + const auto *src = (const uint8_t *)data; const uint8_t *srcend = src + length; parse_info pinfo; diff --git a/src/lib/util/png.cpp b/src/lib/util/png.cpp index e3ebf10688f..6eb5293da53 100644 --- a/src/lib/util/png.cpp +++ b/src/lib/util/png.cpp @@ -201,7 +201,7 @@ private: stream.next_out = pnginfo.image.get(); stream.avail_out = expected; stream.avail_in = 0; - std::list<image_data_chunk>::const_iterator it = idata.begin(); + auto it = idata.begin(); while ((idata.end() != it) && ((Z_OK == zerr) || (Z_BUF_ERROR == zerr)) && !stream.avail_in) { stream.avail_in = it->length; @@ -1042,7 +1042,7 @@ static png_error convert_bitmap_to_image_palette(png_info &pnginfo, const bitmap /* copy in the pixels, specifying a nullptr filter */ for (y = 0; y < pnginfo.height; y++) { - uint16_t *src = reinterpret_cast<uint16_t *>(bitmap.raw_pixptr(y)); + auto *src = reinterpret_cast<uint16_t *>(bitmap.raw_pixptr(y)); uint8_t *dst = &pnginfo.image[y * (rowbytes + 1)]; /* store the filter byte, then copy the data */ @@ -1088,7 +1088,7 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t & /* 16bpp palettized format */ if (bitmap.format() == BITMAP_FORMAT_IND16) { - uint16_t *src16 = reinterpret_cast<uint16_t *>(bitmap.raw_pixptr(y)); + auto *src16 = reinterpret_cast<uint16_t *>(bitmap.raw_pixptr(y)); for (x = 0; x < pnginfo.width; x++) { rgb_t color = palette[*src16++]; @@ -1101,7 +1101,7 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t & /* 32-bit RGB direct */ else if (bitmap.format() == BITMAP_FORMAT_RGB32) { - uint32_t *src32 = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(y)); + auto *src32 = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(y)); for (x = 0; x < pnginfo.width; x++) { rgb_t raw = *src32++; @@ -1114,7 +1114,7 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t & /* 32-bit ARGB direct */ else if (bitmap.format() == BITMAP_FORMAT_ARGB32) { - uint32_t *src32 = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(y)); + auto *src32 = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(y)); for (x = 0; x < pnginfo.width; x++) { rgb_t raw = *src32++; diff --git a/src/lib/util/wavwrite.cpp b/src/lib/util/wavwrite.cpp index 93b4b0a6ca7..56a7cd4e43b 100644 --- a/src/lib/util/wavwrite.cpp +++ b/src/lib/util/wavwrite.cpp @@ -23,7 +23,7 @@ wav_file *wav_open(const char *filename, int sample_rate, int channels) std::uint16_t temp16; // allocate memory for the wav struct - wav_file *const wav = new (std::nothrow) wav_file; + auto *const wav = new (std::nothrow) wav_file; if (!wav) return nullptr; diff --git a/src/lib/util/xmlfile.cpp b/src/lib/util/xmlfile.cpp index 430de1f7c38..8ba2cec92c3 100644 --- a/src/lib/util/xmlfile.cpp +++ b/src/lib/util/xmlfile.cpp @@ -754,7 +754,7 @@ const char *normalize_string(const char *string) static void *expat_malloc(size_t size) { - uint32_t *result = (uint32_t *)malloc(size + 4 * sizeof(uint32_t)); + auto *result = (uint32_t *)malloc(size + 4 * sizeof(uint32_t)); *result = size; return &result[4]; } @@ -837,7 +837,7 @@ static bool expat_setup_parser(parse_info &info, parse_options const *opts) static void expat_element_start(void *data, const XML_Char *name, const XML_Char **attributes) { - parse_info *info = (parse_info *) data; + auto *info = (parse_info *) data; data_node **curnode = &info->curnode; data_node *newnode; int attr; @@ -866,7 +866,7 @@ static void expat_element_start(void *data, const XML_Char *name, const XML_Char static void expat_data(void *data, const XML_Char *s, int len) { - parse_info *info = (parse_info *) data; + auto *info = (parse_info *) data; data_node **curnode = &info->curnode; (*curnode)->append_value(s, len); } @@ -879,7 +879,7 @@ static void expat_data(void *data, const XML_Char *s, int len) static void expat_element_end(void *data, const XML_Char *name) { - parse_info *info = (parse_info *) data; + auto *info = (parse_info *) data; data_node **curnode = &info->curnode; /* strip leading/trailing spaces from the value data */ |