From 07ab3ca90db9d8387e516cc2a96258023770acc9 Mon Sep 17 00:00:00 2001 From: Marzo Sette Torres Junior Date: Sat, 5 Aug 2017 17:52:07 +0200 Subject: [PATCH] Getting rid of useless reinterpret_casts, and converting many more to static_casts. --- audio/AudioMixer.cc | 4 +- audio/OggAudioSample.cc | 8 +-- audio/RawAudioSample.cc | 4 +- audio/VocAudioSample.cc | 8 +-- .../timidity/timidity_playmidi.cpp | 2 +- files/databuf.h | 23 ++++---- files/listfiles.cc | 4 +- files/snprintf.cc | 10 ++-- files/utils.cc | 6 +- files/zip/zip.cc | 4 +- gamemap.cc | 2 +- gamewin.cc | 6 +- imagewin/ArbScaler.h | 2 +- imagewin/BilinearScalerInternal_2x.cpp | 2 +- imagewin/BilinearScalerInternal_Arb.cpp | 2 +- imagewin/BilinearScalerInternal_X1Y12.cpp | 2 +- imagewin/BilinearScalerInternal_X2Y24.cpp | 2 +- imagewin/PointScaler.cpp | 2 +- imagewin/ibuf16.cc | 3 +- imagewin/ibuf8.cc | 3 +- imagewin/imagewin.cc | 6 +- imagewin/savepcx.cc | 2 +- imagewin/scale_2x.cc | 20 +++---- imagewin/scale_2xSaI.cc | 48 +++++++-------- imagewin/scale_bilinear.cc | 32 +++++----- imagewin/scale_hq2x.cc | 16 ++--- imagewin/scale_hq3x.cc | 16 ++--- imagewin/scale_hq4x.cc | 16 ++--- imagewin/scale_interlace.cc | 20 +++---- imagewin/scale_point.cc | 20 +++---- imagewin/scale_xbr.cc | 48 +++++++-------- mapedit/chunklst.cc | 26 ++++----- mapedit/combo.cc | 38 ++++++------ mapedit/eggedit.cc | 2 +- mapedit/execbox.cc | 4 +- mapedit/locator.cc | 20 +++---- mapedit/npcedit.cc | 34 +++++------ mapedit/npclst.cc | 30 +++++----- mapedit/objbrowse.cc | 22 +++---- mapedit/objedit.cc | 2 +- mapedit/paledit.cc | 32 +++++----- mapedit/shapedraw.cc | 2 +- mapedit/shapeedit.cc | 14 ++--- mapedit/shapegroup.cc | 16 ++--- mapedit/shapelst.cc | 58 +++++++++---------- mapedit/studio.cc | 14 ++--- mapedit/ucbrowse.cc | 16 ++--- objs/chunks.cc | 2 +- objs/egg.cc | 2 +- party.cc | 4 +- server/servewin32.cc | 4 +- shapes/vgafile.cc | 4 +- windrag.cc | 12 ++-- 53 files changed, 347 insertions(+), 354 deletions(-) diff --git a/audio/AudioMixer.cc b/audio/AudioMixer.cc index 51fef2910..61b32d2dd 100644 --- a/audio/AudioMixer.cc +++ b/audio/AudioMixer.cc @@ -50,7 +50,7 @@ num_channels(num_channels_), channels(0), id_counter(0) desired.freq = sample_rate_; desired.channels = stereo_?2:1; desired.callback = sdlAudioCallback; - desired.userdata = reinterpret_cast(this); + desired.userdata = this; // Set update rate to 20 Hz, or there abouts. This should be more then adequate for everyone desired.samples=1; @@ -368,7 +368,7 @@ void AudioMixer::get2DPosition(sint32 instance_id, int &distance, int &angle) void AudioMixer::sdlAudioCallback(void *userdata, Uint8 *stream, int len) { - AudioMixer *mixer = reinterpret_cast(userdata); + AudioMixer *mixer = static_cast(userdata); mixer->MixAudio(reinterpret_cast(stream), len); } diff --git a/audio/OggAudioSample.cc b/audio/OggAudioSample.cc index c33d4957a..c0ac6e769 100644 --- a/audio/OggAudioSample.cc +++ b/audio/OggAudioSample.cc @@ -103,7 +103,7 @@ bool OggAudioSample::isThis(IDataSource *oggdata) void OggAudioSample::initDecompressor(void *DecompData) const { - OggDecompData *decomp = reinterpret_cast(DecompData); + OggDecompData *decomp = static_cast(DecompData); if (locked) throw exult_exception("Attempted to play OggAudioSample on more than one channel at the same time."); @@ -136,7 +136,7 @@ void OggAudioSample::rewind(void *DecompData) const void OggAudioSample::freeDecompressor(void *DecompData) const { - OggDecompData *decomp = reinterpret_cast(DecompData); + OggDecompData *decomp = static_cast(DecompData); if (decomp->freed) return; decomp->freed = true; @@ -150,7 +150,7 @@ void OggAudioSample::freeDecompressor(void *DecompData) const uint32 OggAudioSample::decompressFrame(void *DecompData, void *samples) const { - OggDecompData *decomp = reinterpret_cast(DecompData); + OggDecompData *decomp = static_cast(DecompData); vorbis_info *info = ov_info(&decomp->ov,-1); @@ -167,7 +167,7 @@ uint32 OggAudioSample::decompressFrame(void *DecompData, void *samples) const const int bigendianp = 1; #endif - long count = ov_read(&decomp->ov,reinterpret_cast(samples),frame_size,bigendianp,2,1,&decomp->bitstream); + long count = ov_read(&decomp->ov,static_cast(samples),frame_size,bigendianp,2,1,&decomp->bitstream); //if (count == OV_EINVAL || count == 0) { if (count <= 0) return 0; diff --git a/audio/RawAudioSample.cc b/audio/RawAudioSample.cc index 81b169d3f..688075bde 100644 --- a/audio/RawAudioSample.cc +++ b/audio/RawAudioSample.cc @@ -44,7 +44,7 @@ RawAudioSample::~RawAudioSample() void RawAudioSample::initDecompressor(void *DecompData) const { - RawDecompData *decomp = reinterpret_cast(DecompData); + RawDecompData *decomp = static_cast(DecompData); decomp->pos = start_pos; } @@ -55,7 +55,7 @@ void RawAudioSample::rewind(void *DecompData) const uint32 RawAudioSample::decompressFrame(void *DecompData, void *samples) const { - RawDecompData *decomp = reinterpret_cast(DecompData); + RawDecompData *decomp = static_cast(DecompData); if (decomp->pos == buffer_size) return 0; diff --git a/audio/VocAudioSample.cc b/audio/VocAudioSample.cc index c4b9b6b5b..780aa1db0 100644 --- a/audio/VocAudioSample.cc +++ b/audio/VocAudioSample.cc @@ -163,7 +163,7 @@ VocAudioSample::~VocAudioSample() void VocAudioSample::initDecompressor(void *DecompData) const { - VocDecompData *decomp = reinterpret_cast(DecompData); + VocDecompData *decomp = static_cast(DecompData); decomp->pos = 0x1a; decomp->compression = 0; decomp->adpcm_reference = -1; @@ -223,7 +223,7 @@ void VocAudioSample::decode_ADPCM_4(uint8* inBuf, bool VocAudioSample::advanceChunk(void *DecompData) const { - VocDecompData *decomp = reinterpret_cast(DecompData); + VocDecompData *decomp = static_cast(DecompData); if (decomp->pos == buffer_size) return false; @@ -291,7 +291,7 @@ bool VocAudioSample::advanceChunk(void *DecompData) const uint32 VocAudioSample::decompressFrame(void *DecompData, void *samples) const { - VocDecompData *decomp = reinterpret_cast(DecompData); + VocDecompData *decomp = static_cast(DecompData); // At end of stream?? if (!decomp->chunk_remain && !advanceChunk(decomp)) return 0; @@ -324,7 +324,7 @@ uint32 VocAudioSample::decompressFrame(void *DecompData, void *samples) const { bytes_used = num_samples/2; if (decomp->adpcm_reference == -1) bytes_used++; - decode_ADPCM_4(buffer+decomp->pos, bytes_used, reinterpret_cast(samples), decomp->adpcm_reference, decomp->adpcm_scale); + decode_ADPCM_4(buffer+decomp->pos, bytes_used, static_cast(samples), decomp->adpcm_reference, decomp->adpcm_scale); } else { diff --git a/audio/midi_drivers/timidity/timidity_playmidi.cpp b/audio/midi_drivers/timidity/timidity_playmidi.cpp index 819c31fb7..89600d84b 100644 --- a/audio/midi_drivers/timidity/timidity_playmidi.cpp +++ b/audio/midi_drivers/timidity/timidity_playmidi.cpp @@ -1088,7 +1088,7 @@ void Timidity_GenerateSamples(void *stream, int samples) do_compute_data(AUDIO_BUFFER_SIZE); samples -= AUDIO_BUFFER_SIZE; s32tobuf(stream, common_buffer, channels*AUDIO_BUFFER_SIZE); - stream = AUDIO_BUFFER_SIZE*sample_size + reinterpret_cast(stream); + stream = AUDIO_BUFFER_SIZE*sample_size + static_cast(stream); buffer_pointer=common_buffer; buffered_count=0; } diff --git a/files/databuf.h b/files/databuf.h index 617d7f170..a96749fff 100644 --- a/files/databuf.h +++ b/files/databuf.h @@ -115,7 +115,7 @@ class StreamDataSource: public DataSource { }; void read(void *b, size_t len) { - in->read(reinterpret_cast(b), len); + in->read(static_cast(b), len); }; virtual void read(std::string& s, size_t len) { @@ -144,7 +144,7 @@ class StreamDataSource: public DataSource { }; virtual void write(const void *b, size_t len) { - out->write(reinterpret_cast(b), len); + out->write(static_cast(b), len); }; virtual void write(const std::string &s) { @@ -209,15 +209,15 @@ class BufferDataSource: public DataSource { BufferDataSource(const void *data, size_t len) { // data can be NULL if len is also 0 assert(data != 0 || len == 0); - buf = reinterpret_cast(data); + buf = static_cast(data); buf_ptr = const_cast(buf); size = len; }; - void load(char *data, size_t len) { + void load(void *data, size_t len) { // data can be NULL if len is also 0 assert(data != 0 || len == 0); - buf = buf_ptr = reinterpret_cast(data); + buf = buf_ptr = static_cast(data); size = len; }; @@ -387,8 +387,8 @@ class StackBufferDataSource : protected BufferDataSource { inline uint32 pop4() { return read4(); } - inline void pop(uint8 *out, const uint32 size) { - read(reinterpret_cast(out), size); + inline void pop(void *out, const uint32 size) { + read(static_cast(out), size); }; // @@ -468,23 +468,20 @@ class ExultDataSource: public BufferDataSource { ExultDataSource(const File_spec &fname, int index) : BufferDataSource(0, 0) { U7object obj(fname, index); - buf = reinterpret_cast(obj.retrieve(size)); - buf_ptr = const_cast(buf); + buf = buf_ptr = reinterpret_cast(obj.retrieve(size)); } ExultDataSource(const File_spec &fname0, const File_spec &fname1, int index) : BufferDataSource(0, 0) { U7multiobject obj(fname0, fname1, index); - buf = reinterpret_cast(obj.retrieve(size)); - buf_ptr = const_cast(buf); + buf = buf_ptr = reinterpret_cast(obj.retrieve(size)); } ExultDataSource(const File_spec &fname0, const File_spec &fname1, const File_spec &fname2, int index) : BufferDataSource(0, 0) { U7multiobject obj(fname0, fname1, fname2, index); - buf = reinterpret_cast(obj.retrieve(size)); - buf_ptr = const_cast(buf); + buf = buf_ptr = reinterpret_cast(obj.retrieve(size)); } ~ExultDataSource() { diff --git a/files/listfiles.cc b/files/listfiles.cc index 10f86f87f..82b37577c 100644 --- a/files/listfiles.cc +++ b/files/listfiles.cc @@ -60,7 +60,7 @@ int U7ListFiles(const std::string &mask, FileList &files) { #ifdef UNICODE const char *name = path.c_str(); nLen = strlen(name) + 1; - LPTSTR lpszT2 = reinterpret_cast(_alloca(nLen * 2)); + LPTSTR lpszT2 = static_cast(_alloca(nLen * 2)); lpszT = lpszT2; MultiByteToWideChar(CP_ACP, 0, name, -1, lpszT2, nLen); #else @@ -121,7 +121,7 @@ int U7ListFiles(const std::string &mask, FileList &files) { ); #ifdef UNICODE nLen2 = _tcslen(lpMsgBuf) + 1; - str = reinterpret_cast(_alloca(nLen)); + str = static_cast(_alloca(nLen)); WideCharToMultiByte(CP_ACP, 0, lpMsgBuf, -1, str, nLen2, NULL, NULL); #else str = lpMsgBuf; diff --git a/files/snprintf.cc b/files/snprintf.cc index 235ebd746..0084af2c6 100644 --- a/files/snprintf.cc +++ b/files/snprintf.cc @@ -422,7 +422,7 @@ int asprintf(char **ptr, const char *fmt, /*args*/ ...) { str_l = portable_vsnprintf(NULL, static_cast(0), fmt, ap); va_end(ap); assert(str_l >= 0); /* possible integer overflow if str_m > INT_MAX */ - *ptr = reinterpret_cast(malloc(str_m = static_cast(str_l) + 1)); + *ptr = static_cast(malloc(str_m = static_cast(str_l) + 1)); if (*ptr == NULL) { errno = ENOMEM; str_l = -1; @@ -450,7 +450,7 @@ int vasprintf(char **ptr, const char *fmt, va_list ap) { va_end(ap2); } assert(str_l >= 0); /* possible integer overflow if str_m > INT_MAX */ - *ptr = reinterpret_cast(malloc(str_m = static_cast(str_l) + 1)); + *ptr = static_cast(malloc(str_m = static_cast(str_l) + 1)); if (*ptr == NULL) { errno = ENOMEM; str_l = -1; @@ -476,7 +476,7 @@ int asnprintf(char **ptr, size_t str_m, const char *fmt, /*args*/ ...) { /* if str_m is 0, no buffer is allocated, just set *ptr to NULL */ if (str_m == 0) { /* not interested in resulting string, just return size */ } else { - *ptr = reinterpret_cast(malloc(str_m)); + *ptr = static_cast(malloc(str_m)); if (*ptr == NULL) { errno = ENOMEM; str_l = -1; @@ -508,7 +508,7 @@ int vasnprintf(char **ptr, size_t str_m, const char *fmt, va_list ap) { /* if str_m is 0, no buffer is allocated, just set *ptr to NULL */ if (str_m == 0) { /* not interested in resulting string, just return size */ } else { - *ptr = reinterpret_cast(malloc(str_m)); + *ptr = static_cast(malloc(str_m)); if (*ptr == NULL) { errno = ENOMEM; str_l = -1; @@ -745,7 +745,7 @@ int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) { else if (precision == 0) str_arg_l = 0; else { /* memchr on HP does not like n > 2^31 !!! */ - const char *q = reinterpret_cast(memchr(str_arg, '\0', + const char *q = static_cast(memchr(str_arg, '\0', precision <= 0x7fffffff ? precision : 0x7fffffff)); str_arg_l = !q ? precision : (q - str_arg); } diff --git a/files/utils.cc b/files/utils.cc index 8748601ea..ca267a748 100644 --- a/files/utils.cc +++ b/files/utils.cc @@ -801,14 +801,14 @@ void U7copy( throw(e); } size_t bufsize = 0x8000; - unsigned char *buf = new unsigned char[0x8000]; + char *buf = new char[0x8000]; in.seekg(0, ios::end); // Get filesize. size_t filesize = in.tellg(); in.seekg(0, ios::beg); while (filesize > 0) { // Copy. size_t toread = bufsize < filesize ? bufsize : filesize; - in.read(reinterpret_cast(buf), toread); - out.write(reinterpret_cast(buf), toread); + in.read(buf, toread); + out.write(buf, toread); filesize -= toread; } out.flush(); diff --git a/files/zip/zip.cc b/files/zip/zip.cc index f7c4e7f89..b1b363eb2 100644 --- a/files/zip/zip.cc +++ b/files/zip/zip.cc @@ -470,9 +470,9 @@ extern int ZEXPORT zipWriteInFileInZip(zipFile file, const voidp buf, unsigned l if (file->in_opened_file_inzip == 0) return ZIP_PARAMERROR; - file->ci.stream.next_in = reinterpret_cast(buf); + file->ci.stream.next_in = static_cast(buf); file->ci.stream.avail_in = len; - file->ci.crc32 = crc32(file->ci.crc32, reinterpret_cast(buf), len); + file->ci.crc32 = crc32(file->ci.crc32, static_cast(buf), len); while ((err == ZIP_OK) && (file->ci.stream.avail_in > 0)) { if (file->ci.stream.avail_out == 0) { diff --git a/gamemap.cc b/gamemap.cc index 77df7049c..fbd3e596e 100644 --- a/gamemap.cc +++ b/gamemap.cc @@ -1358,7 +1358,7 @@ bool Game_map::insert_terrain( } } } else - memset(reinterpret_cast(buf), 0, ntiles * nbytes); + memset(buf, 0, ntiles * nbytes); Chunk_terrain *new_terrain = new Chunk_terrain(&buf[0], v2_chunks); // Insert in list. chunk_terrains->insert(chunk_terrains->begin() + tnum + 1, new_terrain); diff --git a/gamewin.cc b/gamewin.cc index 629bbd0f4..4e797cb1d 100644 --- a/gamewin.cc +++ b/gamewin.cc @@ -2991,9 +2991,7 @@ void Game_window::emulate_cache(Map_chunk *olist, Map_chunk *nlist) { old_maxy = c_num_chunks + oldy + 2; if (nmap == omap) { // Same map? // Set to 0 - // No casting _should_ be necessary at this point. - // Who needs this? - memset(reinterpret_cast(nearby), 0, sizeof(nearby)); + memset(nearby, 0, sizeof(nearby)); // Figure new range. int new_minx = c_num_chunks + newx - 2, new_maxx = c_num_chunks + newx + 2; @@ -3018,7 +3016,7 @@ void Game_window::emulate_cache(Map_chunk *olist, Map_chunk *nlist) { } } } else // New map, so cache out all of old. - memset(reinterpret_cast(nearby), 0, sizeof(nearby)); + memset(nearby, 0, sizeof(nearby)); // Swap out chunks no longer nearby (0). Game_object_vector removes; diff --git a/imagewin/ArbScaler.h b/imagewin/ArbScaler.h index f5ee4161c..de5156cbf 100644 --- a/imagewin/ArbScaler.h +++ b/imagewin/ArbScaler.h @@ -72,7 +72,7 @@ class ArbScaler { // Call this to scale a section of the screen inline bool Scale(SDL_Surface *texture, sint32 sx, sint32 sy, sint32 sw, sint32 sh, SDL_Surface *dest, sint32 dx, sint32 dy, sint32 dw, sint32 dh, bool clamp_src) const { - uint8 *pixel = reinterpret_cast(dest->pixels) + dx * dest->format->BytesPerPixel + dy * dest->pitch; + uint8 *pixel = static_cast(dest->pixels) + dx * dest->format->BytesPerPixel + dy * dest->pitch; sint32 pitch = dest->pitch; SDL_PixelFormat *src_format = texture->format; diff --git a/imagewin/BilinearScalerInternal_2x.cpp b/imagewin/BilinearScalerInternal_2x.cpp index 382d455f4..aae7d62de 100644 --- a/imagewin/BilinearScalerInternal_2x.cpp +++ b/imagewin/BilinearScalerInternal_2x.cpp @@ -30,7 +30,7 @@ bool BilinearScalerInternal_2x(SDL_Surface *tex, sint32 sx, sint32 sy, sint32 sw ignore_unused_variable_warning(dh); // Source buffer pointers int tpitch = tex->pitch / sizeof(uintS); - uintS *texel = reinterpret_cast(tex->pixels) + (sy * tpitch + sx); + uintS *texel = static_cast(tex->pixels) + (sy * tpitch + sx); uintS *tline_end = texel + (sw - 1); uintS *tex_end = texel + (sh - 4) * tpitch; int tex_diff = (tpitch * 4) - sw; diff --git a/imagewin/BilinearScalerInternal_Arb.cpp b/imagewin/BilinearScalerInternal_Arb.cpp index ae2ba3c48..aa9d9d0f1 100644 --- a/imagewin/BilinearScalerInternal_Arb.cpp +++ b/imagewin/BilinearScalerInternal_Arb.cpp @@ -28,7 +28,7 @@ bool BilinearScalerInternal_Arb(SDL_Surface *tex, sint32 sx, sint32 sy, sint32 s uint8 *pixel, sint32 dw, sint32 dh, sint32 pitch, bool clamp_src) { // Source buffer pointers int tpitch = tex->pitch / sizeof(uintS); - uintS *texel = reinterpret_cast(tex->pixels) + (sy * tpitch + sx); + uintS *texel = static_cast(tex->pixels) + (sy * tpitch + sx); uintS *tline_end = texel + (sw - 1); uintS *tex_end = texel + (sh - 4) * tpitch; int tex_diff = (tpitch * 4) - sw; diff --git a/imagewin/BilinearScalerInternal_X1Y12.cpp b/imagewin/BilinearScalerInternal_X1Y12.cpp index 189e808f0..8040e118f 100644 --- a/imagewin/BilinearScalerInternal_X1Y12.cpp +++ b/imagewin/BilinearScalerInternal_X1Y12.cpp @@ -29,7 +29,7 @@ bool BilinearScalerInternal_X1Y12(SDL_Surface *tex, sint32 sx, sint32 sy, sint32 ignore_unused_variable_warning(dh); // Source buffer pointers int tpitch = tex->pitch / sizeof(uintS); - uintS *texel = reinterpret_cast(tex->pixels) + (sy * tpitch + sx); + uintS *texel = static_cast(tex->pixels) + (sy * tpitch + sx); uintS *tline_end = texel + (sw); uintS *tex_end = texel + (sh - 5) * tpitch; int tex_diff = (tpitch * 5) - sw; diff --git a/imagewin/BilinearScalerInternal_X2Y24.cpp b/imagewin/BilinearScalerInternal_X2Y24.cpp index 6b1865ccc..6a11f3d7e 100644 --- a/imagewin/BilinearScalerInternal_X2Y24.cpp +++ b/imagewin/BilinearScalerInternal_X2Y24.cpp @@ -29,7 +29,7 @@ bool BilinearScalerInternal_X2Y24(SDL_Surface *tex, sint32 sx, sint32 sy, sint32 ignore_unused_variable_warning(dh); // Source buffer pointers int tpitch = tex->pitch / sizeof(uintS); - uintS *texel = reinterpret_cast(tex->pixels) + (sy * tpitch + sx); + uintS *texel = static_cast(tex->pixels) + (sy * tpitch + sx); uintS *tline_end = texel + (sw - 1); uintS *tex_end = texel + (sh - 5) * tpitch; int tex_diff = (tpitch * 5) - sw; diff --git a/imagewin/PointScaler.cpp b/imagewin/PointScaler.cpp index a8f52592c..e50287784 100644 --- a/imagewin/PointScaler.cpp +++ b/imagewin/PointScaler.cpp @@ -32,7 +32,7 @@ template class PointScalerInterna ignore_unused_variable_warning(clamp_src); // Source buffer pointers int tpitch = tex->pitch / sizeof(uintS); - uintS *texel = reinterpret_cast(tex->pixels) + (sy * tpitch + sx); + uintS *texel = static_cast(tex->pixels) + (sy * tpitch + sx); uintS *tline_end = texel + sw; uintS *tex_end = texel + sh * tpitch; int tex_diff = tpitch - sw; diff --git a/imagewin/ibuf16.cc b/imagewin/ibuf16.cc index 14eb3bbfa..2fa7362a0 100644 --- a/imagewin/ibuf16.cc +++ b/imagewin/ibuf16.cc @@ -146,8 +146,7 @@ void Image_buffer16::copy( unsigned short *from = get_pixels() + yfrom * line_width + srcx; // Go through lines. while (srch--) { - memmove(reinterpret_cast(to), - reinterpret_cast(from), srcw * 2); + memmove(to, from, srcw * 2); to += ynext; from += ynext; } diff --git a/imagewin/ibuf8.cc b/imagewin/ibuf8.cc index a7dc9739a..f967d545c 100644 --- a/imagewin/ibuf8.cc +++ b/imagewin/ibuf8.cc @@ -60,8 +60,7 @@ void Image_buffer8::copy( unsigned char *from = bits + yfrom * line_width + srcx; // Go through lines. while (srch--) { - std::memmove(reinterpret_cast(to), - reinterpret_cast(from), srcw); + std::memmove(to, from, srcw); to += ynext; from += ynext; } diff --git a/imagewin/imagewin.cc b/imagewin/imagewin.cc index bf59af6c4..33af079a2 100644 --- a/imagewin/imagewin.cc +++ b/imagewin/imagewin.cc @@ -636,7 +636,7 @@ void Image_window::create_surface( // Offset it set to the top left pixel if the game window ibuf->offset_x = (get_full_width() - get_game_width()) / 2; ibuf->offset_y = (get_full_height() - get_game_height()) / 2; - ibuf->bits = reinterpret_cast(draw_surface->pixels) - get_start_x() - get_start_y() * ibuf->line_width; + ibuf->bits = static_cast(draw_surface->pixels) - get_start_x() - get_start_y() * ibuf->line_width; // Scaler guardband is in effect if (draw_surface != display_surface && scaler != OpenGL) ibuf->bits += guard_band + ibuf->line_width * guard_band; } @@ -968,7 +968,7 @@ void Image_window::show( // Need to apply an offset to compensate for the guard_band if (inter_surface == display_surface) - inter_surface->pixels = reinterpret_cast(inter_surface->pixels) - inter_surface->pitch * guard_band * scale - inter_surface->format->BytesPerPixel * guard_band * scale; + inter_surface->pixels = static_cast(inter_surface->pixels) - inter_surface->pitch * guard_band * scale - inter_surface->format->BytesPerPixel * guard_band * scale; if (sel_scaler.arb) { if (!sel_scaler.arb->Scale(draw_surface, x + guard_band, y + guard_band, w, h, inter_surface, scale * (x + guard_band), scale * (y + guard_band), scale * w, scale * h, false)) @@ -996,7 +996,7 @@ void Image_window::show( // Undo guard_band offset if (inter_surface == display_surface) - inter_surface->pixels = reinterpret_cast(inter_surface->pixels) + inter_surface->pitch * guard_band * scale + inter_surface->format->BytesPerPixel * guard_band * scale; + inter_surface->pixels = static_cast(inter_surface->pixels) + inter_surface->pitch * guard_band * scale + inter_surface->format->BytesPerPixel * guard_band * scale; x *= scale; y *= scale; diff --git a/imagewin/savepcx.cc b/imagewin/savepcx.cc index 7f4d67bb1..2f8522521 100644 --- a/imagewin/savepcx.cc +++ b/imagewin/savepcx.cc @@ -138,7 +138,7 @@ static bool save_image(SDL_Surface *surface, SDL_RWops *dst) { width = surface->w; height = surface->h; - pixels = reinterpret_cast(surface->pixels); + pixels = static_cast(surface->pixels); pitch = surface->pitch; header.manufacturer = 0x0a; diff --git a/imagewin/scale_2x.cc b/imagewin/scale_2x.cc index 51cf7907d..f41938759 100644 --- a/imagewin/scale_2x.cc +++ b/imagewin/scale_2x.cc @@ -40,9 +40,9 @@ void Image_window::show_scaled8to8_2x_noblur( Manip8to8 manip(paletted_surface->format->palette->colors, paletted_surface->format); Scale2x_noblur - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch, manip); } @@ -53,9 +53,9 @@ void Image_window::show_scaled8to16_2x_noblur( Manip8to16 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale2x_noblur - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -67,9 +67,9 @@ void Image_window::show_scaled8to555_2x_noblur( Manip8to555 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale2x_noblur - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -81,9 +81,9 @@ void Image_window::show_scaled8to565_2x_noblur( Manip8to565 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale2x_noblur - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -95,9 +95,9 @@ void Image_window::show_scaled8to32_2x_noblur( Manip8to32 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale2x_noblur - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); diff --git a/imagewin/scale_2xSaI.cc b/imagewin/scale_2xSaI.cc index 4dd32ee74..95630feaa 100644 --- a/imagewin/scale_2xSaI.cc +++ b/imagewin/scale_2xSaI.cc @@ -39,9 +39,9 @@ void Image_window::show_scaled8to16_2xSaI( Manip8to16 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_2xSaI - (reinterpret_cast(draw_surface->pixels), x, y, w, h, + (static_cast(draw_surface->pixels), x, y, w, h, ibuf->line_width, ibuf->height, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -53,9 +53,9 @@ void Image_window::show_scaled8to555_2xSaI( Manip8to555 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_2xSaI - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -67,9 +67,9 @@ void Image_window::show_scaled8to565_2xSaI( Manip8to565 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_2xSaI - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -81,9 +81,9 @@ void Image_window::show_scaled8to32_2xSaI( Manip8to32 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_2xSaI - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -99,9 +99,9 @@ void Image_window::show_scaled8to16_Super2xSaI( Manip8to16 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_Super2xSaI - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -113,9 +113,9 @@ void Image_window::show_scaled8to555_Super2xSaI( Manip8to555 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_Super2xSaI - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -127,9 +127,9 @@ void Image_window::show_scaled8to565_Super2xSaI( Manip8to565 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_Super2xSaI - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -141,9 +141,9 @@ void Image_window::show_scaled8to32_Super2xSaI( Manip8to32 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_Super2xSaI - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -159,9 +159,9 @@ void Image_window::show_scaled8to16_SuperEagle( Manip8to16 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_SuperEagle - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -173,9 +173,9 @@ void Image_window::show_scaled8to555_SuperEagle( Manip8to555 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_SuperEagle - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -187,9 +187,9 @@ void Image_window::show_scaled8to565_SuperEagle( Manip8to565 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_SuperEagle - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -201,9 +201,9 @@ void Image_window::show_scaled8to32_SuperEagle( Manip8to32 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_SuperEagle - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); diff --git a/imagewin/scale_bilinear.cc b/imagewin/scale_bilinear.cc index 0c264d4dc..c5576944f 100644 --- a/imagewin/scale_bilinear.cc +++ b/imagewin/scale_bilinear.cc @@ -41,9 +41,9 @@ void Image_window::show_scaled8to16_bilinear( Manip8to16 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_2xBilinear - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -57,9 +57,9 @@ void Image_window::show_scaled8to555_bilinear( Manip8to555 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_2xBilinear - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -73,9 +73,9 @@ void Image_window::show_scaled8to565_bilinear( Manip8to565 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_2xBilinear - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -89,9 +89,9 @@ void Image_window::show_scaled8to32_bilinear( Manip8to32 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_2xBilinear - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -108,9 +108,9 @@ void Image_window::show_scaled8to16_BilinearPlus( Manip8to16 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_2xBilinearPlus - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -124,9 +124,9 @@ void Image_window::show_scaled8to555_BilinearPlus( Manip8to555 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_2xBilinearPlus - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -140,9 +140,9 @@ void Image_window::show_scaled8to565_BilinearPlus( Manip8to565 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_2xBilinearPlus - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -156,9 +156,9 @@ void Image_window::show_scaled8to32_BilinearPlus( Manip8to32 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_2xBilinearPlus - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); diff --git a/imagewin/scale_hq2x.cc b/imagewin/scale_hq2x.cc index 604ed0a34..84973162d 100644 --- a/imagewin/scale_hq2x.cc +++ b/imagewin/scale_hq2x.cc @@ -45,9 +45,9 @@ void Image_window::show_scaled8to16_Hq2x( Manip8to16 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_Hq2x - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -59,9 +59,9 @@ void Image_window::show_scaled8to555_Hq2x( Manip8to555 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_Hq2x - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -73,9 +73,9 @@ void Image_window::show_scaled8to565_Hq2x( Manip8to565 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_Hq2x - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -87,9 +87,9 @@ void Image_window::show_scaled8to32_Hq2x( Manip8to32 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_Hq2x - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); diff --git a/imagewin/scale_hq3x.cc b/imagewin/scale_hq3x.cc index 7327d6343..b8b1b231a 100644 --- a/imagewin/scale_hq3x.cc +++ b/imagewin/scale_hq3x.cc @@ -45,9 +45,9 @@ void Image_window::show_scaled8to16_Hq3x( Manip8to16 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_Hq3x - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -59,9 +59,9 @@ void Image_window::show_scaled8to555_Hq3x( Manip8to555 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_Hq3x - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -73,9 +73,9 @@ void Image_window::show_scaled8to565_Hq3x( Manip8to565 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_Hq3x - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -87,9 +87,9 @@ void Image_window::show_scaled8to32_Hq3x( Manip8to32 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_Hq3x - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); diff --git a/imagewin/scale_hq4x.cc b/imagewin/scale_hq4x.cc index ffbc1cdaf..823ca1431 100644 --- a/imagewin/scale_hq4x.cc +++ b/imagewin/scale_hq4x.cc @@ -45,9 +45,9 @@ void Image_window::show_scaled8to16_Hq4x( Manip8to16 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_Hq4x - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -59,9 +59,9 @@ void Image_window::show_scaled8to555_Hq4x( Manip8to555 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_Hq4x - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -73,9 +73,9 @@ void Image_window::show_scaled8to565_Hq4x( Manip8to565 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_Hq4x - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -87,9 +87,9 @@ void Image_window::show_scaled8to32_Hq4x( Manip8to32 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_Hq4x - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); diff --git a/imagewin/scale_interlace.cc b/imagewin/scale_interlace.cc index af603a687..0df752b44 100644 --- a/imagewin/scale_interlace.cc +++ b/imagewin/scale_interlace.cc @@ -38,9 +38,9 @@ void Image_window::show_scaled8to8_interlace( Manip8to8 manip(paletted_surface->format->palette->colors, paletted_surface->format); Scale_interlace - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch, manip, scale); } @@ -51,9 +51,9 @@ void Image_window::show_scaled8to16_interlace( Manip8to16 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_interlace - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip, scale); @@ -65,9 +65,9 @@ void Image_window::show_scaled8to555_interlace( Manip8to555 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_interlace - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip, scale); @@ -79,9 +79,9 @@ void Image_window::show_scaled8to565_interlace( Manip8to565 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_interlace - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip, scale); @@ -93,9 +93,9 @@ void Image_window::show_scaled8to32_interlace( Manip8to32 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_interlace - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip, scale); diff --git a/imagewin/scale_point.cc b/imagewin/scale_point.cc index a1f7704f7..209c7d6dd 100644 --- a/imagewin/scale_point.cc +++ b/imagewin/scale_point.cc @@ -38,9 +38,9 @@ void Image_window::show_scaled8to8_point( Manip8to8 manip(paletted_surface->format->palette->colors, paletted_surface->format); Scale_point - (reinterpret_cast(draw_surface->pixels), x, y, w, h, + (static_cast(draw_surface->pixels), x, y, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(display_surface->pixels), + static_cast(display_surface->pixels), display_surface->pitch, manip, scale); @@ -53,9 +53,9 @@ void Image_window::show_scaled8to16_point( Manip8to16 manip(paletted_surface->format->palette->colors, display_surface->format); Scale_point - (reinterpret_cast(draw_surface->pixels), x, y, w, h, + (static_cast(draw_surface->pixels), x, y, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(display_surface->pixels), + static_cast(display_surface->pixels), display_surface->pitch / display_surface->format->BytesPerPixel, manip, scale); @@ -68,9 +68,9 @@ void Image_window::show_scaled8to555_point( Manip8to555 manip(paletted_surface->format->palette->colors, display_surface->format); Scale_point - (reinterpret_cast(draw_surface->pixels), x, y, w, h, + (static_cast(draw_surface->pixels), x, y, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(display_surface->pixels), + static_cast(display_surface->pixels), display_surface->pitch / display_surface->format->BytesPerPixel, manip, scale); @@ -83,9 +83,9 @@ void Image_window::show_scaled8to565_point( Manip8to565 manip(paletted_surface->format->palette->colors, display_surface->format); Scale_point - (reinterpret_cast(draw_surface->pixels), x, y, w, h, + (static_cast(draw_surface->pixels), x, y, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(display_surface->pixels), + static_cast(display_surface->pixels), display_surface->pitch / display_surface->format->BytesPerPixel, manip, scale); @@ -98,9 +98,9 @@ void Image_window::show_scaled8to32_point( Manip8to32 manip(paletted_surface->format->palette->colors, display_surface->format); Scale_point - (reinterpret_cast(draw_surface->pixels), x, y, w, h, + (static_cast(draw_surface->pixels), x, y, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(display_surface->pixels), + static_cast(display_surface->pixels), display_surface->pitch / display_surface->format->BytesPerPixel, manip, scale); diff --git a/imagewin/scale_xbr.cc b/imagewin/scale_xbr.cc index 8cbca89bf..f5743b64c 100644 --- a/imagewin/scale_xbr.cc +++ b/imagewin/scale_xbr.cc @@ -48,9 +48,9 @@ void Image_window::show_scaled8to16_2xBR( Manip8to16 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_xBR - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -62,9 +62,9 @@ void Image_window::show_scaled8to555_2xBR( Manip8to555 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_xBR - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -76,9 +76,9 @@ void Image_window::show_scaled8to565_2xBR( Manip8to565 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_xBR - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -90,9 +90,9 @@ void Image_window::show_scaled8to32_2xBR( Manip8to32 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_xBR - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -107,9 +107,9 @@ void Image_window::show_scaled8to16_3xBR( Manip8to16 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_xBR - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -121,9 +121,9 @@ void Image_window::show_scaled8to555_3xBR( Manip8to555 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_xBR - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -135,9 +135,9 @@ void Image_window::show_scaled8to565_3xBR( Manip8to565 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_xBR - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -149,9 +149,9 @@ void Image_window::show_scaled8to32_3xBR( Manip8to32 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_xBR - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -166,9 +166,9 @@ void Image_window::show_scaled8to16_4xBR( Manip8to16 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_xBR - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -180,9 +180,9 @@ void Image_window::show_scaled8to555_4xBR( Manip8to555 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_xBR - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -194,9 +194,9 @@ void Image_window::show_scaled8to565_4xBR( Manip8to565 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_xBR - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); @@ -208,9 +208,9 @@ void Image_window::show_scaled8to32_4xBR( Manip8to32 manip(paletted_surface->format->palette->colors, inter_surface->format); Scale_xBR - (reinterpret_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, + (static_cast(draw_surface->pixels), x + guard_band, y + guard_band, w, h, ibuf->line_width, ibuf->height + guard_band, - reinterpret_cast(inter_surface->pixels), + static_cast(inter_surface->pixels), inter_surface->pitch / inter_surface->format->BytesPerPixel, manip); diff --git a/mapedit/chunklst.cc b/mapedit/chunklst.cc index 10ccd9672..ab465eedc 100644 --- a/mapedit/chunklst.cc +++ b/mapedit/chunklst.cc @@ -311,7 +311,7 @@ gint Chunk_chooser::configure( gpointer data // ->Chunk_chooser ) { ignore_unused_variable_warning(widget); - Chunk_chooser *chooser = reinterpret_cast(data); + Chunk_chooser *chooser = static_cast(data); chooser->Shape_draw::configure(); chooser->render(); // Set new scroll amounts. @@ -342,7 +342,7 @@ gint Chunk_chooser::expose( gpointer data // ->Chunk_chooser. ) { ignore_unused_variable_warning(widget); - Chunk_chooser *chooser = reinterpret_cast(data); + Chunk_chooser *chooser = static_cast(data); chooser->show(event->area.x, event->area.y, event->area.width, event->area.height); return (TRUE); @@ -400,7 +400,7 @@ gint Chunk_chooser::drag_motion( gpointer data // ->Shape_chooser. ) { ignore_unused_variable_warning(widget); - Chunk_chooser *chooser = reinterpret_cast(data); + Chunk_chooser *chooser = static_cast(data); if (!chooser->dragging && chooser->selected >= 0) chooser->start_drag(U7_TARGET_CHUNKID_NAME, U7_TARGET_CHUNKID, reinterpret_cast(event)); @@ -414,7 +414,7 @@ gint Chunk_chooser::mouse_press( gpointer data // ->Chunk_chooser. ) { ignore_unused_variable_warning(widget); - Chunk_chooser *chooser = reinterpret_cast(data); + Chunk_chooser *chooser = static_cast(data); if (event->button == 4) { chooser->scroll(true); @@ -468,7 +468,7 @@ static gint Mouse_release( gpointer data // ->Shape_chooser. ) { ignore_unused_variable_warning(widget, event); - Chunk_chooser *chooser = reinterpret_cast(data); + Chunk_chooser *chooser = static_cast(data); chooser->mouse_up(); return true; } @@ -487,7 +487,7 @@ void Chunk_chooser::drag_data_get( ) { ignore_unused_variable_warning(widget, context, time); cout << "In DRAG_DATA_GET" << endl; - Chunk_chooser *chooser = reinterpret_cast(data); + Chunk_chooser *chooser = static_cast(data); if (chooser->selected < 0 || info != U7_TARGET_CHUNKID) return; // Not sure about this. guchar buf[30]; @@ -517,7 +517,7 @@ gint Chunk_chooser::selection_clear( gpointer data // ->Chunk_chooser. ) { ignore_unused_variable_warning(widget, event, data); -// Chunk_chooser *chooser = reinterpret_cast(data); +// Chunk_chooser *chooser = static_cast(data); cout << "SELECTION_CLEAR" << endl; return TRUE; } @@ -533,7 +533,7 @@ gint Chunk_chooser::drag_begin( ) { ignore_unused_variable_warning(widget, context); cout << "In DRAG_BEGIN" << endl; - Chunk_chooser *chooser = reinterpret_cast(data); + Chunk_chooser *chooser = static_cast(data); if (chooser->selected < 0) return FALSE; // ++++Display a halt bitmap. #if 0 @@ -594,7 +594,7 @@ void Chunk_chooser::drag_data_received( gpointer udata // Should point to Shape_draw. ) { ignore_unused_variable_warning(widget, context, x, y, info, time); - Chunk_chooser *chooser = reinterpret_cast(udata); + Chunk_chooser *chooser = static_cast(udata); cout << "Chunk drag_data_received" << endl; if (seldata->type == gdk_atom_intern(U7_TARGET_CHUNKID_NAME, 0) && seldata->format == 8 && seldata->length > 0) { @@ -669,7 +669,7 @@ void Chunk_chooser::scrolled( GtkAdjustment *adj, // The adjustment. gpointer data // ->Chunk_chooser. ) { - Chunk_chooser *chooser = reinterpret_cast(data); + Chunk_chooser *chooser = static_cast(data); cout << "Scrolled to " << adj->value << '\n'; gint newindex = static_cast(adj->value); chooser->scroll(newindex); @@ -709,7 +709,7 @@ static void on_insert_empty( gpointer udata ) { ignore_unused_variable_warning(item); - Chunk_chooser *chooser = reinterpret_cast(udata); + Chunk_chooser *chooser = static_cast(udata); chooser->insert(false); } @@ -718,7 +718,7 @@ static void on_insert_dup( gpointer udata ) { ignore_unused_variable_warning(item); - Chunk_chooser *chooser = reinterpret_cast(udata); + Chunk_chooser *chooser = static_cast(udata); chooser->insert(true); } static void on_delete( @@ -726,7 +726,7 @@ static void on_delete( gpointer udata ) { ignore_unused_variable_warning(item); - Chunk_chooser *chooser = reinterpret_cast(udata); + Chunk_chooser *chooser = static_cast(udata); chooser->del(); } diff --git a/mapedit/combo.cc b/mapedit/combo.cc index e00f7f807..623e3c94a 100644 --- a/mapedit/combo.cc +++ b/mapedit/combo.cc @@ -111,7 +111,7 @@ C_EXPORT gint on_combo_draw_expose_event( gpointer data // ->Shape_chooser. ) { ignore_unused_variable_warning(data); - Combo_editor *combo = reinterpret_cast(gtk_object_get_user_data( + Combo_editor *combo = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(widget))))); combo->render_area(&event->area); return TRUE; @@ -121,7 +121,7 @@ C_EXPORT void on_combo_remove_clicked(GtkButton *button, gpointer user_data) { ignore_unused_variable_warning(user_data); - Combo_editor *combo = reinterpret_cast(gtk_object_get_user_data( + Combo_editor *combo = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(button))))); combo->remove(); } @@ -130,7 +130,7 @@ C_EXPORT void on_combo_apply_clicked(GtkButton *button, gpointer user_data) { ignore_unused_variable_warning(user_data); - Combo_editor *combo = reinterpret_cast(gtk_object_get_user_data( + Combo_editor *combo = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(button))))); combo->save(); } @@ -140,7 +140,7 @@ on_combo_ok_clicked(GtkButton *button, gpointer user_data) { ignore_unused_variable_warning(user_data); GtkWidget *win = gtk_widget_get_toplevel(GTK_WIDGET(button)); - Combo_editor *combo = reinterpret_cast(gtk_object_get_user_data( + Combo_editor *combo = static_cast(gtk_object_get_user_data( GTK_OBJECT(win))); combo->save(); gtk_widget_hide(win); @@ -150,7 +150,7 @@ C_EXPORT void on_combo_locx_changed(GtkSpinButton *button, gpointer user_data) { ignore_unused_variable_warning(user_data); - Combo_editor *combo = reinterpret_cast(gtk_object_get_user_data( + Combo_editor *combo = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(button))))); combo->set_position(); } @@ -159,7 +159,7 @@ C_EXPORT void on_combo_locy_changed(GtkSpinButton *button, gpointer user_data) { ignore_unused_variable_warning(user_data); - Combo_editor *combo = reinterpret_cast(gtk_object_get_user_data( + Combo_editor *combo = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(button))))); combo->set_position(); } @@ -168,7 +168,7 @@ C_EXPORT void on_combo_locz_changed(GtkSpinButton *button, gpointer user_data) { ignore_unused_variable_warning(user_data); - Combo_editor *combo = reinterpret_cast(gtk_object_get_user_data( + Combo_editor *combo = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(button))))); combo->set_position(); } @@ -177,7 +177,7 @@ C_EXPORT void on_combo_order_changed(GtkSpinButton *button, gpointer user_data) { ignore_unused_variable_warning(user_data); - Combo_editor *combo = reinterpret_cast(gtk_object_get_user_data( + Combo_editor *combo = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(button))))); combo->set_order(); } @@ -191,7 +191,7 @@ C_EXPORT gint on_combo_draw_button_press_event( gpointer data // ->Combo_chooser. ) { ignore_unused_variable_warning(data); - Combo_editor *combo = reinterpret_cast(gtk_object_get_user_data( + Combo_editor *combo = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(widget))))); return combo->mouse_press(event); } @@ -946,7 +946,7 @@ void Combo_chooser::drag_data_get( ) { ignore_unused_variable_warning(widget, context, time); cout << "In DRAG_DATA_GET" << endl; - Combo_chooser *chooser = reinterpret_cast(data); + Combo_chooser *chooser = static_cast(data); if (chooser->selected < 0 || info != U7_TARGET_COMBOID) return; // Not sure about this. // Get combo #. @@ -998,7 +998,7 @@ gint Combo_chooser::selection_clear( gpointer data // ->Combo_chooser. ) { ignore_unused_variable_warning(widget, event, data); -// Combo_chooser *chooser = reinterpret_cast(data); +// Combo_chooser *chooser = static_cast(data); cout << "SELECTION_CLEAR" << endl; return TRUE; } @@ -1014,7 +1014,7 @@ gint Combo_chooser::drag_begin( ) { ignore_unused_variable_warning(widget); cout << "In DRAG_BEGIN" << endl; - Combo_chooser *chooser = reinterpret_cast(data); + Combo_chooser *chooser = static_cast(data); if (chooser->selected < 0) return FALSE; // ++++Display a halt bitmap. // Get ->combo. @@ -1037,7 +1037,7 @@ void Combo_chooser::scrolled( GtkAdjustment *adj, // The adjustment. gpointer data // ->Combo_chooser. ) { - Combo_chooser *chooser = reinterpret_cast(data); + Combo_chooser *chooser = static_cast(data); gint newindex = static_cast(adj->value); chooser->scroll(newindex); } @@ -1053,7 +1053,7 @@ on_combo_key_press(GtkEntry *entry, GdkEventKey *event, gpointer user_data) { ignore_unused_variable_warning(entry); - Combo_chooser *chooser = reinterpret_cast(user_data); + Combo_chooser *chooser = static_cast(user_data); switch (event->keyval) { case GDK_Delete: chooser->remove(); @@ -1287,7 +1287,7 @@ gint Combo_chooser::configure( gpointer data // ->Combo_chooser ) { ignore_unused_variable_warning(widget); - Combo_chooser *chooser = reinterpret_cast(data); + Combo_chooser *chooser = static_cast(data); chooser->Shape_draw::configure(); chooser->render(); // Set new scroll amounts. @@ -1318,7 +1318,7 @@ gint Combo_chooser::expose( gpointer data // ->Combo_chooser. ) { ignore_unused_variable_warning(widget); - Combo_chooser *chooser = reinterpret_cast(data); + Combo_chooser *chooser = static_cast(data); chooser->show(event->area.x, event->area.y, event->area.width, event->area.height); return (TRUE); @@ -1375,7 +1375,7 @@ gint Combo_chooser::drag_motion( gpointer data // ->Shape_chooser. ) { ignore_unused_variable_warning(widget); - Combo_chooser *chooser = reinterpret_cast(data); + Combo_chooser *chooser = static_cast(data); if (!chooser->dragging && chooser->selected >= 0) chooser->start_drag(U7_TARGET_COMBOID_NAME, U7_TARGET_COMBOID, reinterpret_cast(event)); @@ -1393,7 +1393,7 @@ gint Combo_chooser::mouse_press( gpointer data // ->Combo_chooser. ) { gtk_widget_grab_focus(widget); // Enables keystrokes. - Combo_chooser *chooser = reinterpret_cast(data); + Combo_chooser *chooser = static_cast(data); if (event->button == 4) { chooser->scroll(true); @@ -1448,7 +1448,7 @@ static gint Mouse_release( gpointer data // ->Shape_chooser. ) { ignore_unused_variable_warning(widget, event); - Combo_chooser *chooser = reinterpret_cast(data); + Combo_chooser *chooser = static_cast(data); chooser->mouse_up(); return true; } diff --git a/mapedit/eggedit.cc b/mapedit/eggedit.cc index e0f46f7ee..f9696464d 100644 --- a/mapedit/eggedit.cc +++ b/mapedit/eggedit.cc @@ -156,7 +156,7 @@ static void Egg_monster_dropped( void *udata ) { if (file == U7_SHAPE_SHAPES && shape >= 150 && shape < 0xffff) - reinterpret_cast(udata)->set_egg_monster(shape, frame); + static_cast(udata)->set_egg_monster(shape, frame); } #ifdef WIN32 diff --git a/mapedit/execbox.cc b/mapedit/execbox.cc index 9200e0f19..b3434a258 100644 --- a/mapedit/execbox.cc +++ b/mapedit/execbox.cc @@ -95,7 +95,7 @@ static void Read_from_child( GdkInputCondition condition ) { ignore_unused_variable_warning(condition); - Exec_process *ex = reinterpret_cast(data); + Exec_process *ex = static_cast(data); ex->read_from_child(id); } void Exec_process::read_from_child( @@ -286,7 +286,7 @@ static void Exec_callback( int exit_code, // Exit code if datalen = 0. void *user_data // ->Exex_box ) { - Exec_box *box = reinterpret_cast(user_data); + Exec_box *box = static_cast(user_data); box->read_from_child(data, datalen, exit_code); } void Exec_box::read_from_child( diff --git a/mapedit/locator.cc b/mapedit/locator.cc index 7bd35a80c..1b116cbf4 100644 --- a/mapedit/locator.cc +++ b/mapedit/locator.cc @@ -64,7 +64,7 @@ C_EXPORT void on_loc_close_clicked( gpointer user_data ) { ignore_unused_variable_warning(user_data); - Locator *loc = reinterpret_cast(gtk_object_get_user_data( + Locator *loc = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(btn))))); loc->show(false); } @@ -78,7 +78,7 @@ C_EXPORT gboolean on_loc_window_delete_event( gpointer user_data ) { ignore_unused_variable_warning(event, user_data); - Locator *loc = reinterpret_cast( + Locator *loc = static_cast( gtk_object_get_user_data(GTK_OBJECT(widget))); loc->show(false); return TRUE; @@ -93,7 +93,7 @@ C_EXPORT gint on_loc_draw_configure_event( gpointer data // ->Shape_chooser ) { ignore_unused_variable_warning(event, data); - Locator *loc = reinterpret_cast(gtk_object_get_user_data( + Locator *loc = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(widget))))); loc->configure(widget); return TRUE; @@ -107,7 +107,7 @@ C_EXPORT gint on_loc_draw_expose_event( gpointer data // ->Shape_chooser. ) { ignore_unused_variable_warning(data); - Locator *loc = reinterpret_cast(gtk_object_get_user_data( + Locator *loc = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(widget))))); loc->render(&event->area); return TRUE; @@ -121,7 +121,7 @@ C_EXPORT gint on_loc_draw_button_press_event( gpointer data // ->Chunk_chooser. ) { ignore_unused_variable_warning(data); - Locator *loc = reinterpret_cast(gtk_object_get_user_data( + Locator *loc = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(widget))))); return loc->mouse_press(event); } @@ -132,7 +132,7 @@ C_EXPORT gint on_loc_draw_button_release_event( gpointer data // ->Chunk_chooser. ) { ignore_unused_variable_warning(data); - Locator *loc = reinterpret_cast(gtk_object_get_user_data( + Locator *loc = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(widget))))); return loc->mouse_release(event); } @@ -143,7 +143,7 @@ C_EXPORT gint on_loc_draw_motion_notify_event( gpointer data // ->Chunk_chooser. ) { ignore_unused_variable_warning(data); - Locator *loc = reinterpret_cast(gtk_object_get_user_data( + Locator *loc = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(widget))))); return loc->mouse_motion(event); } @@ -339,7 +339,7 @@ void Locator::vscrolled( // For vertical scrollbar. GtkAdjustment *adj, // The adjustment. gpointer data // ->Shape_chooser. ) { - Locator *loc = reinterpret_cast(data); + Locator *loc = static_cast(data); int oldty = loc->ty; loc->ty = static_cast(adj->value) * c_tiles_per_chunk; if (loc->ty != oldty) // (Already equal if this event came @@ -353,7 +353,7 @@ void Locator::hscrolled( // For horizontal scrollbar. GtkAdjustment *adj, // The adjustment. gpointer data // ->Locator. ) { - Locator *loc = reinterpret_cast(data); + Locator *loc = static_cast(data); int oldtx = loc->tx; loc->tx = static_cast(adj->value) * c_tiles_per_chunk; if (loc->tx != oldtx) // (Already equal if this event came @@ -407,7 +407,7 @@ void Locator::query_location( gint Locator::delayed_send_location( gpointer data // ->locator. ) { - Locator *loc = reinterpret_cast(data); + Locator *loc = static_cast(data); loc->send_location(); loc->send_location_timer = -1; return 0; // Cancels timer. diff --git a/mapedit/npcedit.cc b/mapedit/npcedit.cc index 1fe4d5238..d980c1d23 100644 --- a/mapedit/npcedit.cc +++ b/mapedit/npcedit.cc @@ -170,7 +170,7 @@ static void Npc_shape_dropped( void *udata ) { if (file == U7_SHAPE_SHAPES && shape >= 150 && shape < c_max_shapes) - reinterpret_cast(udata)->set_npc_shape(shape, frame); + static_cast(udata)->set_npc_shape(shape, frame); } // Schedule names. @@ -200,7 +200,7 @@ static void Npc_face_dropped( void *udata ) { if (file == U7_SHAPE_FACES && shape >= 0 && shape < 1024) - reinterpret_cast(udata)->set_npc_face(shape, frame); + static_cast(udata)->set_npc_face(shape, frame); } // Schedule names. @@ -235,13 +235,13 @@ static void Set_schedule_line( GtkBox *box = GTK_BOX(glade_xml_get_widget(app_xml, locname)); g_free(locname); GList *list = g_list_first(box->children); - GtkWidget *spin = reinterpret_cast(list->data)->widget; + GtkWidget *spin = static_cast(list->data)->widget; gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), tx); list = g_list_next(list); - spin = reinterpret_cast(list->data)->widget; + spin = static_cast(list->data)->widget; gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), ty); list = g_list_next(list); - spin = reinterpret_cast(list->data)->widget; + spin = static_cast(list->data)->widget; gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), tz); } @@ -268,13 +268,13 @@ static bool Get_schedule_line( GtkBox *box = GTK_BOX(glade_xml_get_widget(app_xml, locname)); g_free(locname); GList *list = g_list_first(box->children); - GtkWidget *spin = reinterpret_cast(list->data)->widget; + GtkWidget *spin = static_cast(list->data)->widget; sched.tx = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin)); list = g_list_next(list); - spin = reinterpret_cast(list->data)->widget; + spin = static_cast(list->data)->widget; sched.ty = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin)); list = g_list_next(list); - spin = reinterpret_cast(list->data)->widget; + spin = static_cast(list->data)->widget; sched.tz = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin)); sched.time = time; return true; @@ -379,7 +379,7 @@ static bool Get_prop_spin( GtkSpinButton *&spin, // Spin button returned. int &pnum // Property number (0-11) returned. ) { - GtkTableChild *ent = reinterpret_cast(list->data); + GtkTableChild *ent = static_cast(list->data); GtkBin *frame = GTK_BIN(ent->widget); spin = GTK_SPIN_BUTTON(frame->child); assert(spin != 0); @@ -407,7 +407,7 @@ static bool Get_flag_cbox( unsigned long *&bits, // ->one of 3 flags above. int &fnum // Flag # (0-31) returned. ) { - GtkTableChild *ent = reinterpret_cast(list->data); + GtkTableChild *ent = static_cast(list->data); cbox = GTK_CHECK_BUTTON(ent->widget); assert(cbox != 0); const char *name = glade_get_widget_name(GTK_WIDGET(cbox)); @@ -464,7 +464,7 @@ void ExultStudio::init_new_npc( // Set flag checkboxes. for (GList *list = g_list_first(ftable->children); list; list = g_list_next(list)) { - GtkTableChild *ent = reinterpret_cast(list->data); + GtkTableChild *ent = static_cast(list->data); GtkCheckButton *cbox = GTK_CHECK_BUTTON(ent->widget); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cbox), false); } @@ -787,8 +787,8 @@ void ExultStudio::schedule_btn_clicked( const char *name = glade_get_widget_name(btn); const char *numptr = name + 5; // Past "sched". int num = atoi(numptr); - GtkWidget *schedwin = reinterpret_cast(data); - GtkLabel *label = reinterpret_cast(gtk_object_get_user_data( + GtkWidget *schedwin = static_cast(data); + GtkLabel *label = static_cast(gtk_object_get_user_data( GTK_OBJECT(schedwin))); // User data = schedule #. gtk_object_set_user_data(GTK_OBJECT(label), reinterpret_cast(uintptr(num))); @@ -854,18 +854,18 @@ static void Game_loc_response( if (id != Exult_server::game_pos) return; // Get box with loc. spin btns. - GtkBox *box = reinterpret_cast(client); + GtkBox *box = static_cast(client); int tx = Read2(data); int ty = Read2(data); int tz = Read2(data); GList *list = g_list_first(box->children); - GtkWidget *spin = reinterpret_cast(list->data)->widget; + GtkWidget *spin = static_cast(list->data)->widget; gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), tx); list = g_list_next(list); - spin = reinterpret_cast(list->data)->widget; + spin = static_cast(list->data)->widget; gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), ty); list = g_list_next(list); - spin = reinterpret_cast(list->data)->widget; + spin = static_cast(list->data)->widget; gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), tz); } diff --git a/mapedit/npclst.cc b/mapedit/npclst.cc index fc052e7c4..10096cc07 100644 --- a/mapedit/npclst.cc +++ b/mapedit/npclst.cc @@ -170,7 +170,7 @@ void Npc_chooser::setup_shapes_info( ) { vector &npcs = get_npcs(); if (npcs.empty()) // No NPC's? Try to get them. - reinterpret_cast(file_info)->setup(); + static_cast(file_info)->setup(); // Get drawing area dimensions. gint winw = draw->allocation.width; int x = 0; @@ -289,7 +289,7 @@ static gint Configure_chooser( gpointer data // ->Npc_chooser ) { ignore_unused_variable_warning(widget); - Npc_chooser *chooser = reinterpret_cast(data); + Npc_chooser *chooser = static_cast(data); return chooser->configure(event); } gint Npc_chooser::configure( @@ -320,7 +320,7 @@ gint Npc_chooser::expose( gpointer data // ->Npc_chooser. ) { ignore_unused_variable_warning(widget); - Npc_chooser *chooser = reinterpret_cast(data); + Npc_chooser *chooser = static_cast(data); chooser->show(event->area.x, event->area.y, event->area.width, event->area.height); return (TRUE); @@ -377,7 +377,7 @@ gint Npc_chooser::drag_motion( gpointer data // ->Npc_chooser. ) { ignore_unused_variable_warning(widget); - Npc_chooser *chooser = reinterpret_cast(data); + Npc_chooser *chooser = static_cast(data); if (!chooser->dragging && chooser->selected >= 0) chooser->start_drag(U7_TARGET_NPCID_NAME, U7_TARGET_NPCID, reinterpret_cast(event)); @@ -451,7 +451,7 @@ static gint Mouse_press( GdkEventButton *event, gpointer data // ->Npc_chooser. ) { - Npc_chooser *chooser = reinterpret_cast(data); + Npc_chooser *chooser = static_cast(data); return chooser->mouse_press(widget, event); } static gint Mouse_release( @@ -460,7 +460,7 @@ static gint Mouse_release( gpointer data // ->Npc_chooser. ) { ignore_unused_variable_warning(widget, event); - Npc_chooser *chooser = reinterpret_cast(data); + Npc_chooser *chooser = static_cast(data); chooser->mouse_up(); return true; } @@ -473,7 +473,7 @@ on_npc_draw_key_press(GtkEntry *entry, GdkEventKey *event, gpointer user_data) { ignore_unused_variable_warning(entry, event, user_data); - //Npc_chooser *chooser = reinterpret_cast(user_data); + //Npc_chooser *chooser = static_cast(user_data); #if 0 switch (event->keyval) { case GDK_Delete: @@ -519,7 +519,7 @@ void Npc_chooser::edit_npc( void Npc_chooser::update_npc( int num ) { - reinterpret_cast(file_info)->read_npc(num); + static_cast(file_info)->read_npc(num); render(); update_statusbar(); } @@ -538,7 +538,7 @@ void Npc_chooser::drag_data_get( ) { ignore_unused_variable_warning(widget, context, time); cout << "In DRAG_DATA_GET" << endl; - Npc_chooser *chooser = reinterpret_cast(data); + Npc_chooser *chooser = static_cast(data); if (chooser->selected < 0 || info != U7_TARGET_NPCID) return; // Not sure about this. guchar buf[30]; @@ -568,7 +568,7 @@ gint Npc_chooser::selection_clear( gpointer data // ->Npc_chooser. ) { ignore_unused_variable_warning(widget, event, data); -// Npc_chooser *chooser = reinterpret_cast(data); +// Npc_chooser *chooser = static_cast(data); cout << "SELECTION_CLEAR" << endl; return TRUE; } @@ -584,7 +584,7 @@ gint Npc_chooser::drag_begin( ) { ignore_unused_variable_warning(widget); cout << "In DRAG_BEGIN" << endl; - Npc_chooser *chooser = reinterpret_cast(data); + Npc_chooser *chooser = static_cast(data); if (chooser->selected < 0) return FALSE; // ++++Display a halt bitmap. // Get ->npc. @@ -612,7 +612,7 @@ void Npc_chooser::drag_data_received( gpointer udata // Should point to Shape_draw. ) { ignore_unused_variable_warning(widget, context, x, y, info, time); - Npc_chooser *chooser = reinterpret_cast(udata); + Npc_chooser *chooser = static_cast(udata); cout << "Npc drag_data_received" << endl; if (seldata->type == gdk_atom_intern(U7_TARGET_NPCID_NAME, 0) && seldata->format == 8 && seldata->length > 0) { @@ -739,7 +739,7 @@ void Npc_chooser::vscrolled( // For vertical scrollbar. GtkAdjustment *adj, // The adjustment. gpointer data // ->Npc_chooser. ) { - Npc_chooser *chooser = reinterpret_cast(data); + Npc_chooser *chooser = static_cast(data); cout << "Scrolled to " << adj->value << '\n'; gint newindex = static_cast(adj->value); chooser->scroll_vertical(newindex); @@ -760,7 +760,7 @@ int Npc_chooser::get_count( vector &Npc_chooser::get_npcs( ) { - return reinterpret_cast(file_info)->get_npcs(); + return static_cast(file_info)->get_npcs(); } /* @@ -826,7 +826,7 @@ void on_npc_popup_edit_activate( gpointer udata ) { ignore_unused_variable_warning(item); - reinterpret_cast(udata)->edit_npc(); + static_cast(udata)->edit_npc(); } /* diff --git a/mapedit/objbrowse.cc b/mapedit/objbrowse.cc index ccfa8fcf0..7e17fcf9a 100644 --- a/mapedit/objbrowse.cc +++ b/mapedit/objbrowse.cc @@ -74,8 +74,8 @@ void Object_browser::on_browser_group_add( GtkMenuItem *item, gpointer udata ) { - Object_browser *chooser = reinterpret_cast(udata); - Shape_group *grp = reinterpret_cast(gtk_object_get_user_data( + Object_browser *chooser = static_cast(udata); + Shape_group *grp = static_cast(gtk_object_get_user_data( GTK_OBJECT(item))); int id = chooser->get_selected_id(); if (id >= 0) { // Selected shape? @@ -168,7 +168,7 @@ void Object_browser::on_browser_file_save( gpointer udata ) { ignore_unused_variable_warning(item); - Object_browser *chooser = reinterpret_cast(udata); + Object_browser *chooser = static_cast(udata); if (!chooser->file_info) return; // Nothing to write to. try { @@ -187,7 +187,7 @@ void Object_browser::on_browser_file_revert( gpointer udata ) { ignore_unused_variable_warning(item); - Object_browser *chooser = reinterpret_cast(udata); + Object_browser *chooser = static_cast(udata); if (!chooser->file_info) return; // No file? char *msg = g_strdup_printf("Okay to throw away any changes to '%s'?", @@ -235,7 +235,7 @@ static void on_find_down(GtkButton *button, gpointer user_data) { ignore_unused_variable_warning(button); - Object_browser *chooser = reinterpret_cast(user_data); + Object_browser *chooser = static_cast(user_data); chooser->search(gtk_entry_get_text( GTK_ENTRY(chooser->get_find_text())), 1); } @@ -243,7 +243,7 @@ static void on_find_up(GtkButton *button, gpointer user_data) { ignore_unused_variable_warning(button); - Object_browser *chooser = reinterpret_cast(user_data); + Object_browser *chooser = static_cast(user_data); chooser->search(gtk_entry_get_text( GTK_ENTRY(chooser->get_find_text())), -1); } @@ -253,7 +253,7 @@ on_find_key(GtkEntry *entry, gpointer user_data) { ignore_unused_variable_warning(entry); if (event->keyval == GDK_Return) { - Object_browser *chooser = reinterpret_cast(user_data); + Object_browser *chooser = static_cast(user_data); chooser->search(gtk_entry_get_text( GTK_ENTRY(chooser->get_find_text())), 1); return TRUE; @@ -265,14 +265,14 @@ static void on_loc_down(GtkButton *button, gpointer user_data) { ignore_unused_variable_warning(button); - Object_browser *chooser = reinterpret_cast(user_data); + Object_browser *chooser = static_cast(user_data); chooser->locate(false); } static void on_loc_up(GtkButton *button, gpointer user_data) { ignore_unused_variable_warning(button); - Object_browser *chooser = reinterpret_cast(user_data); + Object_browser *chooser = static_cast(user_data); chooser->locate(true); } @@ -280,14 +280,14 @@ static void on_move_down(GtkButton *button, gpointer user_data) { ignore_unused_variable_warning(button); - Object_browser *chooser = reinterpret_cast(user_data); + Object_browser *chooser = static_cast(user_data); chooser->move(false); } static void on_move_up(GtkButton *button, gpointer user_data) { ignore_unused_variable_warning(button); - Object_browser *chooser = reinterpret_cast(user_data); + Object_browser *chooser = static_cast(user_data); chooser->move(true); } diff --git a/mapedit/objedit.cc b/mapedit/objedit.cc index 7f060821d..bf39adf13 100644 --- a/mapedit/objedit.cc +++ b/mapedit/objedit.cc @@ -162,7 +162,7 @@ static void Obj_shape_dropped( ) { if (file == U7_SHAPE_SHAPES && shape >= c_first_obj_shape && shape < c_max_shapes) - reinterpret_cast(udata)->set_obj_shape(shape, frame); + static_cast(udata)->set_obj_shape(shape, frame); } #ifdef WIN32 diff --git a/mapedit/paledit.cc b/mapedit/paledit.cc index 43e1afd10..6845e0f81 100644 --- a/mapedit/paledit.cc +++ b/mapedit/paledit.cc @@ -208,7 +208,7 @@ int Palette_edit::color_closed( ) { ignore_unused_variable_warning(dlg, event); cout << "color_closed" << endl; - Palette_edit *paled = reinterpret_cast(data); + Palette_edit *paled = static_cast(data); paled->colorsel = 0; return FALSE; } @@ -222,7 +222,7 @@ void Palette_edit::color_cancel( gpointer data ) { ignore_unused_variable_warning(dlg); - Palette_edit *paled = reinterpret_cast(data); + Palette_edit *paled = static_cast(data); if (paled->colorsel) gtk_widget_destroy(GTK_WIDGET(paled->colorsel)); paled->colorsel = 0; @@ -237,7 +237,7 @@ void Palette_edit::color_okay( gpointer data ) { ignore_unused_variable_warning(dlg); - Palette_edit *paled = reinterpret_cast(data); + Palette_edit *paled = static_cast(data); if (paled->colorsel) { gdouble rgb[3]; gtk_color_selection_get_color( @@ -300,7 +300,7 @@ gint Palette_edit::configure( gpointer data // ->Palette_edit ) { ignore_unused_variable_warning(event); - Palette_edit *paled = reinterpret_cast(data); + Palette_edit *paled = static_cast(data); if (!paled->width) { // First time? paled->drawgc = gdk_gc_new(widget->window); // Foreground = yellow. @@ -321,7 +321,7 @@ gint Palette_edit::expose( gpointer data // ->Palette_edit. ) { ignore_unused_variable_warning(widget); - Palette_edit *paled = reinterpret_cast(data); + Palette_edit *paled = static_cast(data); paled->show(event->area.x, event->area.y, event->area.width, event->area.height); return (TRUE); @@ -337,7 +337,7 @@ gint Palette_edit::mouse_press( gpointer data // ->Palette_edit. ) { ignore_unused_variable_warning(widget); - Palette_edit *paled = reinterpret_cast(data); + Palette_edit *paled = static_cast(data); if (event->button == 4 || event->button == 5) // mouse wheel return (TRUE); @@ -392,7 +392,7 @@ void Palette_edit::drag_data_get( ignore_unused_variable_warning(widget, context, seldata, info, time, data); cout << "In DRAG_DATA_GET" << endl; #if 0 - Palette_edit *paled = reinterpret_cast(data); + Palette_edit *paled = static_cast(data); if (paled->selected < 0 || info != U7_TARGET_SHAPEID) return; // Not sure about this. guchar buf[30]; @@ -421,7 +421,7 @@ gint Palette_edit::selection_clear( gpointer data // ->Palette_edit. ) { ignore_unused_variable_warning(widget, event, data); -// Palette_edit *paled = reinterpret_cast(data); +// Palette_edit *paled = static_cast(data); cout << "SELECTION_CLEAR" << endl; return TRUE; } @@ -437,7 +437,7 @@ gint Palette_edit::drag_begin( ) { ignore_unused_variable_warning(widget, context, data); cout << "In DRAG_BEGIN" << endl; - //Palette_edit *paled = reinterpret_cast(data); + //Palette_edit *paled = static_cast(data); // Maybe someday. return TRUE; } @@ -450,7 +450,7 @@ void Palette_edit::palnum_changed( GtkAdjustment *adj, // The adjustment. gpointer data // ->Shape_chooser. ) { - Palette_edit *ed = reinterpret_cast(data); + Palette_edit *ed = static_cast(data); gint newnum = static_cast(adj->value); ed->show_palette(newnum); ed->render(); @@ -492,28 +492,28 @@ void on_insert_btn_clicked(GtkButton *button, gpointer user_data) { ignore_unused_variable_warning(button); - Palette_edit *ed = reinterpret_cast(user_data); + Palette_edit *ed = static_cast(user_data); ed->add_palette(); } void on_remove_btn_clicked(GtkButton *button, gpointer user_data) { ignore_unused_variable_warning(button); - Palette_edit *ed = reinterpret_cast(user_data); + Palette_edit *ed = static_cast(user_data); ed->remove_palette(); } void on_up_btn_clicked(GtkButton *button, gpointer user_data) { ignore_unused_variable_warning(button); - Palette_edit *ed = reinterpret_cast(user_data); + Palette_edit *ed = static_cast(user_data); ed->move_palette(true); } void on_down_btn_clicked(GtkButton *button, gpointer user_data) { ignore_unused_variable_warning(button); - Palette_edit *ed = reinterpret_cast(user_data); + Palette_edit *ed = static_cast(user_data); ed->move_palette(false); } @@ -884,7 +884,7 @@ void Palette_edit::export_palette( char *fname, gpointer user_data ) { - Palette_edit *ed = reinterpret_cast(user_data); + Palette_edit *ed = static_cast(user_data); if (U7exists(fname)) { char *msg = g_strdup_printf( "'%s' already exists. Overwrite?", fname); @@ -921,7 +921,7 @@ void Palette_edit::import_palette( char *fname, gpointer user_data ) { - Palette_edit *ed = reinterpret_cast(user_data); + Palette_edit *ed = static_cast(user_data); char *msg = g_strdup_printf( "Overwrite current palette from '%s'?", fname); int answer = Prompt(msg, "Yes", "No"); diff --git a/mapedit/shapedraw.cc b/mapedit/shapedraw.cc index f9706ec3c..2db7518f4 100644 --- a/mapedit/shapedraw.cc +++ b/mapedit/shapedraw.cc @@ -208,7 +208,7 @@ void Shape_draw::drag_data_received( gpointer udata // Should point to Shape_draw. ) { ignore_unused_variable_warning(widget, context, x, y, info, time); - Shape_draw *draw = reinterpret_cast(udata); + Shape_draw *draw = static_cast(udata); cout << "drag_data_received" << endl; if (draw->drop_callback && seldata->type == gdk_atom_intern(U7_TARGET_SHAPEID_NAME, 0) && diff --git a/mapedit/shapeedit.cc b/mapedit/shapeedit.cc index 60a55b92b..9b648f22a 100644 --- a/mapedit/shapeedit.cc +++ b/mapedit/shapeedit.cc @@ -239,7 +239,7 @@ C_EXPORT gboolean on_equip_draw_expose_event( ) { ignore_unused_variable_warning(widget); ExultStudio::get_instance()->show_equip_shape( - reinterpret_cast(data), + static_cast(data), event->area.x, event->area.y, event->area.width, event->area.height); return (TRUE); @@ -252,7 +252,7 @@ C_EXPORT gboolean on_equip_shape_changed( gpointer data // ->row info. ) { ignore_unused_variable_warning(widget); - Equip_row_widgets *eq = reinterpret_cast(data); + Equip_row_widgets *eq = static_cast(data); ExultStudio *studio = ExultStudio::get_instance(); studio->show_equip_shape(eq); int shape = gtk_spin_button_get_value_as_int( @@ -273,7 +273,7 @@ static void Equip_shape_dropped( void *udata // ->row. ) { ignore_unused_variable_warning(frame); - Equip_row_widgets *eq = reinterpret_cast(udata); + Equip_row_widgets *eq = static_cast(udata); if (file == U7_SHAPE_SHAPES && shape >= 0 && shape < c_max_shapes) { // Set shape #. gtk_spin_button_set_value(GTK_SPIN_BUTTON(eq->shape), shape); @@ -2535,7 +2535,7 @@ static void Explosion_shape_dropped( void ExultStudio::set_shape_notebook_frame( int frnum // Frame # to set. ) { - Shape_file_info *file_info = reinterpret_cast( + Shape_file_info *file_info = static_cast( gtk_object_get_data(GTK_OBJECT(shapewin), "file_info")); int shnum = get_num_entry("shinfo_shape"); Vga_file *ifile = file_info->get_ifile(); @@ -2545,7 +2545,7 @@ void ExultStudio::set_shape_notebook_frame( set_spin("shinfo_originy", shape->get_ybelow(), -shape->get_height(), shape->get_height()); - Shape_info *info = reinterpret_cast( + Shape_info *info = static_cast( gtk_object_get_user_data(GTK_OBJECT(shapewin))); if (!info) return; @@ -4247,9 +4247,9 @@ void ExultStudio::save_shape_window( ) { int shnum = get_num_entry("shinfo_shape"); int frnum = get_num_entry("shinfo_frame"); - Shape_info *info = reinterpret_cast( + Shape_info *info = static_cast( gtk_object_get_user_data(GTK_OBJECT(shapewin))); - Shape_file_info *file_info = reinterpret_cast( + Shape_file_info *file_info = static_cast( gtk_object_get_data(GTK_OBJECT(shapewin), "file_info")); Vga_file *ifile = file_info->get_ifile(); if (info) { // If 'shapes.vga', get name. diff --git a/mapedit/shapegroup.cc b/mapedit/shapegroup.cc index 83f3e0e16..16ee1be4e 100644 --- a/mapedit/shapegroup.cc +++ b/mapedit/shapegroup.cc @@ -661,7 +661,7 @@ void ExultStudio::del_group( vector toclose; vector::const_iterator it; for (it = group_windows.begin(); it != group_windows.end(); ++it) { - Object_browser *chooser = reinterpret_cast( + Object_browser *chooser = static_cast( gtk_object_get_data(GTK_OBJECT(*it), "browser")); if (chooser->get_group() == grp) // A match? @@ -691,7 +691,7 @@ void ExultStudio::groups_changed( void *grpaddr = 0; gtk_tree_model_get(model, loc, GRP_GROUP_COLUMN, &grpaddr, -1); - Shape_group *grp = reinterpret_cast(grpaddr); + Shape_group *grp = static_cast(grpaddr); if (value) // Changed? groups->set(grp, row); else @@ -718,7 +718,7 @@ C_EXPORT void on_group_up_clicked(GtkToggleButton *button, gpointer user_data) { ignore_unused_variable_warning(user_data); - Object_browser *chooser = reinterpret_cast(gtk_object_get_data( + Object_browser *chooser = static_cast(gtk_object_get_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(button))), "browser")); Shape_group *grp = chooser->get_group(); @@ -732,7 +732,7 @@ C_EXPORT void on_group_down_clicked(GtkToggleButton *button, gpointer user_data) { ignore_unused_variable_warning(user_data); - Object_browser *chooser = reinterpret_cast(gtk_object_get_data( + Object_browser *chooser = static_cast(gtk_object_get_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(button))), "browser")); Shape_group *grp = chooser->get_group(); @@ -746,7 +746,7 @@ C_EXPORT void on_group_shape_remove_clicked(GtkToggleButton *button, gpointer user_data) { ignore_unused_variable_warning(user_data); - Object_browser *chooser = reinterpret_cast(gtk_object_get_data( + Object_browser *chooser = static_cast(gtk_object_get_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(button))), "browser")); Shape_group *grp = chooser->get_group(); @@ -846,9 +846,9 @@ void ExultStudio::close_group_window( break; } } - GladeXML *xml = reinterpret_cast(gtk_object_get_data(GTK_OBJECT(grpwin), + GladeXML *xml = static_cast(gtk_object_get_data(GTK_OBJECT(grpwin), "xml")); - Object_browser *chooser = reinterpret_cast(gtk_object_get_data( + Object_browser *chooser = static_cast(gtk_object_get_data( GTK_OBJECT(grpwin), "browser")); delete chooser; gtk_widget_destroy(grpwin); @@ -899,7 +899,7 @@ void ExultStudio::update_group_windows( ) { for (vector::const_iterator it = group_windows.begin(); it != group_windows.end(); ++it) { - Object_browser *chooser = reinterpret_cast( + Object_browser *chooser = static_cast( gtk_object_get_data(GTK_OBJECT(*it), "browser")); if (!grp || chooser->get_group() == grp) { // A match? diff --git a/mapedit/shapelst.cc b/mapedit/shapelst.cc index 1e3cf91e9..be72c57ac 100644 --- a/mapedit/shapelst.cc +++ b/mapedit/shapelst.cc @@ -119,7 +119,7 @@ static void Shape_dropped_here( int frame, void *udata ) { - reinterpret_cast(udata)->shape_dropped_here(file, shape, frame); + static_cast(udata)->shape_dropped_here(file, shape, frame); } /* @@ -476,7 +476,7 @@ static gint Configure_chooser( gpointer data // ->Shape_chooser ) { ignore_unused_variable_warning(widget); - Shape_chooser *chooser = reinterpret_cast(data); + Shape_chooser *chooser = static_cast(data); return chooser->configure(event); } gint Shape_chooser::configure( @@ -509,7 +509,7 @@ gint Shape_chooser::expose( gpointer data // ->Shape_chooser. ) { ignore_unused_variable_warning(widget); - Shape_chooser *chooser = reinterpret_cast(data); + Shape_chooser *chooser = static_cast(data); chooser->show(event->area.x, event->area.y, event->area.width, event->area.height); return (TRUE); @@ -566,7 +566,7 @@ gint Shape_chooser::drag_motion( gpointer data // ->Shape_chooser. ) { ignore_unused_variable_warning(widget); - Shape_chooser *chooser = reinterpret_cast(data); + Shape_chooser *chooser = static_cast(data); if (!chooser->dragging && chooser->selected >= 0) chooser->start_drag(U7_TARGET_SHAPEID_NAME, U7_TARGET_SHAPEID, reinterpret_cast(event)); @@ -640,7 +640,7 @@ static gint Mouse_press( GdkEventButton *event, gpointer data // ->Shape_chooser. ) { - Shape_chooser *chooser = reinterpret_cast(data); + Shape_chooser *chooser = static_cast(data); return chooser->mouse_press(widget, event); } static gint Mouse_release( @@ -649,7 +649,7 @@ static gint Mouse_release( gpointer data // ->Shape_chooser. ) { ignore_unused_variable_warning(widget, event); - Shape_chooser *chooser = reinterpret_cast(data); + Shape_chooser *chooser = static_cast(data); chooser->mouse_up(); return true; } @@ -662,7 +662,7 @@ on_draw_key_press(GtkEntry *entry, GdkEventKey *event, gpointer user_data) { ignore_unused_variable_warning(entry); - Shape_chooser *chooser = reinterpret_cast(user_data); + Shape_chooser *chooser = static_cast(user_data); switch (event->keyval) { case GDK_Delete: chooser->del_frame(); @@ -1187,7 +1187,7 @@ void Shape_chooser::export_frame( char *fname, gpointer user_data ) { - Shape_chooser *ed = reinterpret_cast(user_data); + Shape_chooser *ed = static_cast(user_data); if (U7exists(fname)) { char *msg = g_strdup_printf( "'%s' already exists. Overwrite?", fname); @@ -1209,7 +1209,7 @@ void Shape_chooser::import_frame( char *fname, gpointer user_data ) { - Shape_chooser *ed = reinterpret_cast(user_data); + Shape_chooser *ed = static_cast(user_data); if (ed->selected < 0) return; // Shouldn't happen. int shnum = ed->info[ed->selected].shapenum, @@ -1254,7 +1254,7 @@ void Shape_chooser::export_all_frames( char *fname, gpointer user_data ) { - Shape_chooser *ed = reinterpret_cast(user_data); + Shape_chooser *ed = static_cast(user_data); int shnum = ed->info[ed->selected].shapenum; ed->export_all_pngs(fname, shnum); } @@ -1263,7 +1263,7 @@ void Shape_chooser::export_shape( char *fname, gpointer user_data ) { - Shape_chooser *ed = reinterpret_cast(user_data); + Shape_chooser *ed = static_cast(user_data); int shnum = ed->info[ed->selected].shapenum; Shape *shp = ed->ifile->extract_shape(shnum); Image_file_info::write_file(fname, &shp, 1, true); @@ -1328,7 +1328,7 @@ void Shape_chooser::import_all_frames( char *fname, gpointer user_data ) { - Shape_chooser *ed = reinterpret_cast(user_data); + Shape_chooser *ed = static_cast(user_data); if (ed->selected < 0) return; // Shouldn't happen. int shnum = ed->info[ed->selected].shapenum; @@ -1344,7 +1344,7 @@ void Shape_chooser::import_shape( gpointer user_data ) { if (U7exists(fname)) { - Shape_chooser *ed = reinterpret_cast(user_data); + Shape_chooser *ed = static_cast(user_data); if (ed->selected < 0) return; // Shouldn't happen. ifstream file; @@ -1435,7 +1435,7 @@ on_new_shape_okay_clicked(GtkButton *button, gpointer user_data) { ignore_unused_variable_warning(user_data); GtkWidget *win = gtk_widget_get_toplevel(GTK_WIDGET(button)); - Shape_chooser *chooser = reinterpret_cast( + Shape_chooser *chooser = static_cast( gtk_object_get_user_data(GTK_OBJECT(win))); chooser->create_new_shape(); gtk_widget_hide(win); @@ -1448,7 +1448,7 @@ C_EXPORT void on_new_shape_font_toggled( ignore_unused_variable_warning(user_data); bool on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(btn)); GtkWidget *win = gtk_widget_get_toplevel(GTK_WIDGET(btn)); - Shape_chooser *chooser = reinterpret_cast( + Shape_chooser *chooser = static_cast( gtk_object_get_user_data(GTK_OBJECT(win))); chooser->from_font_toggled(on); } @@ -1460,10 +1460,10 @@ C_EXPORT gboolean on_new_shape_font_color_draw_expose_event( ignore_unused_variable_warning(data); ExultStudio *studio = ExultStudio::get_instance(); int index = studio->get_spin("new_shape_font_color"); - Shape_chooser *ed = reinterpret_cast( + Shape_chooser *ed = static_cast( gtk_object_get_user_data(GTK_OBJECT(widget))); guint32 color = ed->get_color(index); - GdkGC *gc = reinterpret_cast( + GdkGC *gc = static_cast( gtk_object_get_data(GTK_OBJECT(widget), "color_gc")); if (!gc) { gc = gdk_gc_new(widget->window); @@ -1704,7 +1704,7 @@ void Shape_chooser::drag_data_get( ) { ignore_unused_variable_warning(widget, context, time); cout << "In DRAG_DATA_GET" << endl; - Shape_chooser *chooser = reinterpret_cast(data); + Shape_chooser *chooser = static_cast(data); if (chooser->selected < 0 || info != U7_TARGET_SHAPEID) return; // Not sure about this. guchar buf[30]; @@ -1740,7 +1740,7 @@ gint Shape_chooser::selection_clear( gpointer data // ->Shape_chooser. ) { ignore_unused_variable_warning(widget, event, data); -// Shape_chooser *chooser = reinterpret_cast(data); +// Shape_chooser *chooser = static_cast(data); cout << "SELECTION_CLEAR" << endl; return TRUE; } @@ -1756,7 +1756,7 @@ gint Shape_chooser::drag_begin( ) { ignore_unused_variable_warning(widget); cout << "In DRAG_BEGIN" << endl; - Shape_chooser *chooser = reinterpret_cast(data); + Shape_chooser *chooser = static_cast(data); if (chooser->selected < 0) return FALSE; // ++++Display a halt bitmap. // Get ->shape. @@ -1879,7 +1879,7 @@ void Shape_chooser::vscrolled( // For vertical scrollbar. GtkAdjustment *adj, // The adjustment. gpointer data // ->Shape_chooser. ) { - Shape_chooser *chooser = reinterpret_cast(data); + Shape_chooser *chooser = static_cast(data); cout << "Scrolled to " << adj->value << '\n'; gint newindex = static_cast(adj->value); chooser->scroll_vertical(newindex); @@ -1888,7 +1888,7 @@ void Shape_chooser::hscrolled( // For horizontal scrollbar. GtkAdjustment *adj, // The adjustment. gpointer data // ->Shape_chooser. ) { - Shape_chooser *chooser = reinterpret_cast(data); + Shape_chooser *chooser = static_cast(data); chooser->hoffset = static_cast(adj->value); chooser->render(); chooser->show(); @@ -1902,7 +1902,7 @@ void Shape_chooser::frame_changed( GtkAdjustment *adj, // The adjustment. gpointer data // ->Shape_chooser. ) { - Shape_chooser *chooser = reinterpret_cast(data); + Shape_chooser *chooser = static_cast(data); gint newframe = static_cast(adj->value); if (chooser->selected >= 0) { Shape_entry &shinfo = chooser->info[chooser->selected]; @@ -1926,7 +1926,7 @@ void Shape_chooser::all_frames_toggled( GtkToggleButton *btn, gpointer data ) { - Shape_chooser *chooser = reinterpret_cast(data); + Shape_chooser *chooser = static_cast(data); bool on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(btn)); chooser->frames_mode = on; if (on) // Frame => show horiz. scrollbar. @@ -1953,7 +1953,7 @@ void Shape_chooser::on_shapes_popup_info_activate( gpointer udata ) { ignore_unused_variable_warning(item); - reinterpret_cast(udata)->edit_shape_info(); + static_cast(udata)->edit_shape_info(); } void Shape_chooser::on_shapes_popup_edit_activate( @@ -1961,7 +1961,7 @@ void Shape_chooser::on_shapes_popup_edit_activate( gpointer udata ) { ignore_unused_variable_warning(item); - reinterpret_cast(udata)->edit_shape(); + static_cast(udata)->edit_shape(); } void Shape_chooser::on_shapes_popup_edtiles_activate( @@ -1969,7 +1969,7 @@ void Shape_chooser::on_shapes_popup_edtiles_activate( gpointer udata ) { ignore_unused_variable_warning(item); - Shape_chooser *ch = reinterpret_cast(udata); + Shape_chooser *ch = static_cast(udata); if (ch->selected < 0) return; // Shouldn't happen. ExultStudio *studio = ExultStudio::get_instance(); @@ -2091,14 +2091,14 @@ static void on_shapes_popup_new_frame( gpointer udata ) { ignore_unused_variable_warning(item); - reinterpret_cast(udata)->new_frame(); + static_cast(udata)->new_frame(); } static void on_shapes_popup_new_shape( GtkMenuItem *item, gpointer udata ) { ignore_unused_variable_warning(item); - reinterpret_cast(udata)->new_shape(); + static_cast(udata)->new_shape(); } /* diff --git a/mapedit/studio.cc b/mapedit/studio.cc index b01f5fc5d..f24859ab8 100644 --- a/mapedit/studio.cc +++ b/mapedit/studio.cc @@ -845,7 +845,7 @@ void on_choose_new_game_dir( const char *dir, gpointer udata // ->studio. ) { - (reinterpret_cast(udata))->create_new_game(dir); + (static_cast(udata))->create_new_game(dir); } void ExultStudio::create_new_game( const char *dir // Directory for new game. @@ -1269,9 +1269,9 @@ void ExultStudio::set_game_path(string gamename, string modname) { vector::const_iterator it; for (it = group_windows.begin(); it != group_windows.end(); ++it) { GtkWidget *grpwin = GTK_WIDGET(*it); - GladeXML *xml = reinterpret_cast(gtk_object_get_data(GTK_OBJECT(grpwin), + GladeXML *xml = static_cast(gtk_object_get_data(GTK_OBJECT(grpwin), "xml")); - Object_browser *chooser = reinterpret_cast(gtk_object_get_data( + Object_browser *chooser = static_cast(gtk_object_get_data( GTK_OBJECT(grpwin), "browser")); delete chooser; gtk_widget_destroy(grpwin); @@ -2363,7 +2363,7 @@ C_EXPORT gboolean on_prefs_background_expose_event( ) { ignore_unused_variable_warning(data); guint32 color = static_cast(reinterpret_cast(gtk_object_get_user_data(GTK_OBJECT(widget)))); - GdkGC *gc = reinterpret_cast( + GdkGC *gc = static_cast( gtk_object_get_data(GTK_OBJECT(widget), "color_gc")); if (!gc) { gc = gdk_gc_new(widget->window); @@ -2444,7 +2444,7 @@ void ExultStudio::run() { static gint Reconnect( gpointer data // ->ExultStudio. ) { - ExultStudio *studio = reinterpret_cast(data); + ExultStudio *studio = static_cast(data); if (studio->connect_to_server()) return 0; // Cancel timer. We succeeded. else @@ -2480,14 +2480,14 @@ static void Read_from_server( GdkInputCondition condition ) { ignore_unused_variable_warning(socket, condition); - ExultStudio *studio = reinterpret_cast(data); + ExultStudio *studio = static_cast(data); studio->read_from_server(); } #else static gint Read_from_server( gpointer data // ->ExultStudio. ) { - ExultStudio *studio = reinterpret_cast(data); + ExultStudio *studio = static_cast(data); studio->read_from_server(); return TRUE; } diff --git a/mapedit/ucbrowse.cc b/mapedit/ucbrowse.cc index 794238b2f..dcb6481fc 100644 --- a/mapedit/ucbrowse.cc +++ b/mapedit/ucbrowse.cc @@ -69,7 +69,7 @@ C_EXPORT void on_usecodes_ok_clicked( gpointer user_data ) { ignore_unused_variable_warning(user_data); - Usecode_browser *ucb = reinterpret_cast(gtk_object_get_user_data( + Usecode_browser *ucb = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(btn))))); ucb->okay(); } @@ -84,7 +84,7 @@ C_EXPORT void on_usecodes_treeview_row_activated( gpointer user_data ) { ignore_unused_variable_warning(path, column, user_data); - Usecode_browser *ucb = reinterpret_cast(gtk_object_get_user_data( + Usecode_browser *ucb = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(treeview))))); ucb->okay(); } @@ -97,7 +97,7 @@ C_EXPORT void on_usecodes_cancel_clicked( gpointer user_data ) { ignore_unused_variable_warning(user_data); - Usecode_browser *ucb = reinterpret_cast(gtk_object_get_user_data( + Usecode_browser *ucb = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(btn))))); ucb->cancel(); } @@ -111,7 +111,7 @@ C_EXPORT gboolean on_usecodes_dialog_delete_event( gpointer user_data ) { ignore_unused_variable_warning(event, user_data); - Usecode_browser *ucb = reinterpret_cast( + Usecode_browser *ucb = static_cast( gtk_object_get_user_data(GTK_OBJECT(widget))); ucb->cancel(); @@ -126,7 +126,7 @@ C_EXPORT void on_view_uc_classes_toggled( gpointer user_data ) { ignore_unused_variable_warning(user_data); - Usecode_browser *ucb = reinterpret_cast(gtk_object_get_user_data( + Usecode_browser *ucb = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(btn))))); ucb->setup_list(); } @@ -135,7 +135,7 @@ C_EXPORT void on_view_uc_functions_toggled( gpointer user_data ) { ignore_unused_variable_warning(user_data); - Usecode_browser *ucb = reinterpret_cast(gtk_object_get_user_data( + Usecode_browser *ucb = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(btn))))); ucb->setup_list(); } @@ -144,7 +144,7 @@ C_EXPORT void on_view_uc_shapes_toggled( gpointer user_data ) { ignore_unused_variable_warning(user_data); - Usecode_browser *ucb = reinterpret_cast(gtk_object_get_user_data( + Usecode_browser *ucb = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(btn))))); ucb->setup_list(); } @@ -154,7 +154,7 @@ C_EXPORT void on_view_uc_objects_toggled( gpointer user_data ) { ignore_unused_variable_warning(user_data); - Usecode_browser *ucb = reinterpret_cast(gtk_object_get_user_data( + Usecode_browser *ucb = static_cast(gtk_object_get_user_data( GTK_OBJECT(gtk_widget_get_toplevel(GTK_WIDGET(btn))))); ucb->setup_list(); } diff --git a/objs/chunks.cc b/objs/chunks.cc index 68754aca0..cfe5e4680 100644 --- a/objs/chunks.cc +++ b/objs/chunks.cc @@ -58,7 +58,7 @@ using std::rand; Chunk_cache::Chunk_cache( ) : egg_objects(4) { - memset(reinterpret_cast(&eggs[0]), 0, sizeof(eggs)); + memset(&eggs[0], 0, sizeof(eggs)); } /* diff --git a/objs/egg.cc b/objs/egg.cc index 4a30cfba6..3583041ee 100644 --- a/objs/egg.cc +++ b/objs/egg.cc @@ -1297,7 +1297,7 @@ void Field_object::activate( npcs.push_back(gwin->get_main_actor()); // Include Avatar. Rectangle eggfoot = get_footprint(); // Clear flag to check. - reinterpret_cast(animator)->activated = false; + static_cast(animator)->activated = false; for (Actor_vector::const_iterator it = npcs.begin(); it != npcs.end(); ++it) { Actor *actor = *it; diff --git a/party.cc b/party.cc index 63f69ab61..8c1561e31 100644 --- a/party.cc +++ b/party.cc @@ -49,8 +49,8 @@ using std::endl; Party_manager::Party_manager( ) : party_count(0), dead_party_count(0), validcnt(0) { // Clear party list. - std::memset(reinterpret_cast(&party[0]), 0, sizeof(party)); - std::memset(reinterpret_cast(&dead_party[0]), 0, sizeof(dead_party)); + std::memset(&party[0], 0, sizeof(party)); + std::memset(&dead_party[0], 0, sizeof(dead_party)); } /* diff --git a/server/servewin32.cc b/server/servewin32.cc index 98d2632d6..04cea19d8 100644 --- a/server/servewin32.cc +++ b/server/servewin32.cc @@ -84,13 +84,13 @@ bool OpenPortFile(const char *path, bool writing) { // Hack functions int write(int file, const void *v, unsigned int len) { ignore_unused_variable_warning(file); - return send(gDataSocket, reinterpret_cast(v), len, 0); + return send(gDataSocket, static_cast(v), len, 0); } int read(int file, void *v, unsigned int len) { ignore_unused_variable_warning(file); if (len == 0) return 0; - return recv(gDataSocket, reinterpret_cast(v), len, 0);; + return recv(gDataSocket, static_cast(v), len, 0);; /* WSABUF buffer; buffer.buf = (char*)v; diff --git a/shapes/vgafile.cc b/shapes/vgafile.cc index c548d4d2c..cd7e2f09a 100644 --- a/shapes/vgafile.cc +++ b/shapes/vgafile.cc @@ -795,7 +795,7 @@ inline void Shape::create_frames_list( ) { num_frames = frames_size = nframes; frames = new Shape_frame *[frames_size]; - memset(reinterpret_cast(frames), 0, frames_size * sizeof(Shape_frame *)); + memset(frames, 0, frames_size * sizeof(Shape_frame *)); } /* @@ -945,7 +945,7 @@ Shape_frame *Shape::store_frame( } if (!frames) { // First one? frames = new Shape_frame *[num_frames]; - memset(reinterpret_cast(frames), 0, num_frames * sizeof(Shape_frame *)); + memset(frames, 0, num_frames * sizeof(Shape_frame *)); } frames[framenum] = frame; return (frame); diff --git a/windrag.cc b/windrag.cc index a9f251513..03ae1d0f7 100644 --- a/windrag.cc +++ b/windrag.cc @@ -76,7 +76,7 @@ Windnd::QueryInterface(REFIID iid, void **ppvObject) { *ppvObject = this; if (NULL == *ppvObject) return E_NOINTERFACE; - reinterpret_cast(*ppvObject)->AddRef(); + static_cast(*ppvObject)->AddRef(); return NOERROR; } @@ -116,7 +116,7 @@ Windnd::DragEnter(IDataObject *pDataObject, STGMEDIUM med; pDataObject->GetData(&fetc, &med); - windragdata wdd(reinterpret_cast(GlobalLock(med.hGlobal))); + windragdata wdd(static_cast(GlobalLock(med.hGlobal))); GlobalUnlock(med.hGlobal); ReleaseStgMedium(&med); @@ -225,7 +225,7 @@ Windnd::Drop(IDataObject *pDataObject, STGMEDIUM med; pDataObject->GetData(&fetc, &med); - windragdata wdd(reinterpret_cast(GlobalLock(med.hGlobal))); + windragdata wdd(static_cast(GlobalLock(med.hGlobal))); GlobalUnlock(med.hGlobal); ReleaseStgMedium(&med); @@ -321,7 +321,7 @@ Windropsource::QueryInterface(REFIID iid, void **ppvObject) { *ppvObject = this; if (NULL == *ppvObject) return E_NOINTERFACE; - reinterpret_cast(*ppvObject)->AddRef(); + static_cast(*ppvObject)->AddRef(); return NOERROR; } @@ -391,7 +391,7 @@ Winstudioobj::QueryInterface(REFIID iid, void **ppvObject) { *ppvObject = this; if (NULL == *ppvObject) return E_NOINTERFACE; - reinterpret_cast(*ppvObject)->AddRef(); + static_cast(*ppvObject)->AddRef(); return NOERROR; } @@ -432,7 +432,7 @@ Winstudioobj::GetData( return E_OUTOFMEMORY; // This provides us with a pointer to the allocated memory - ldata = reinterpret_cast(GlobalLock(hText)); + ldata = static_cast(GlobalLock(hText)); data.serialize(ldata); GlobalUnlock(hText);