From b5b16a5a8febe07d1c9d695e0c8b3a909f960fb0 Mon Sep 17 00:00:00 2001 From: DirtBagXon Date: Sun, 12 Jan 2020 00:55:26 +0000 Subject: [PATCH] Code cleanup addressing warnings to gcc8 - Added 64bit Lua 'os.clock' timing work-a-round --- src/cpu/x86/instr86.cpp | 3 -- src/game/astron.cpp | 2 +- src/game/boardinfo.cpp | 2 +- src/game/cliff.cpp | 2 +- src/game/game.cpp | 2 +- src/game/gpworld.cpp | 2 +- src/game/lair2.cpp | 2 +- src/game/laireuro.cpp | 8 +++-- src/game/singe/loslib.c | 4 +++ src/game/timetrav.cpp | 7 ++-- src/io/mpo_fileio.cpp | 3 +- src/io/network.cpp | 15 ++++----- src/io/unzip.cpp | 19 ++++------- src/ldp-in/vp380.cpp | 2 -- src/ldp-out/ld-v6000.cpp | 2 +- src/sound/sound.h | 4 +++ src/sound/ssi263.cpp | 3 +- src/sound/tms9919-sdl.cpp | 11 ------ src/video/SDL_Console.cpp | 2 +- src/video/SDL_Console.h | 2 +- src/vldp2/libmpeg2/decode.c | 6 ++-- src/vldp2/libmpeg2/header.c | 2 +- src/vldp2/libmpeg2/idct.c | 4 +-- src/vldp2/libmpeg2/idct_mmx.c | 32 +++++++++--------- src/vldp2/libmpeg2/motion_comp_mmx.c | 50 ++++++++++++++-------------- src/vldp2/libmpeg2/slice.c | 26 +++++++-------- src/vldp2/libmpeg2/vlc.h | 2 +- src/vldp2/libvo/video_out_null.c | 8 ++--- src/vldp2/vldp/mpegscan.c | 1 + src/vldp2/vldp/vldp_internal.c | 1 + 30 files changed, 111 insertions(+), 118 deletions(-) diff --git a/src/cpu/x86/instr86.cpp b/src/cpu/x86/instr86.cpp index e42e612..472eeed 100644 --- a/src/cpu/x86/instr86.cpp +++ b/src/cpu/x86/instr86.cpp @@ -1180,9 +1180,6 @@ static void PREFIX86(_ds)(void) /* Opcode 0x3e */ static void PREFIX86(_aas)(void) /* Opcode 0x3f */ { - UINT8 ALcarry=1; - if (I.regs.b[AL]>0xf9) ALcarry=2; - if (I86_AF || ((I.regs.b[AL] & 0xf) > 9)) { I.regs.b[AL] -= 6; diff --git a/src/game/astron.cpp b/src/game/astron.cpp index c8462be..f321d47 100644 --- a/src/game/astron.cpp +++ b/src/game/astron.cpp @@ -708,7 +708,7 @@ Uint8 astron::port_read(Uint16 port) // writes a byte to the cpu's port void astron::port_write(Uint16 port, Uint8 value) { - char s[81] = { 0 }; + char s[82] = { 0 }; port &= 0xFF; diff --git a/src/game/boardinfo.cpp b/src/game/boardinfo.cpp index faa7d7c..5754b0c 100644 --- a/src/game/boardinfo.cpp +++ b/src/game/boardinfo.cpp @@ -176,7 +176,7 @@ void print_board_info(unsigned char index, // which board { char sequence_type[160] = { 0 }; - char s1[160] = { 0 }; + char s1[340] = { 0 }; char board_name[160] = { 0 }; // if we know that we are playing Dragon's Lair diff --git a/src/game/cliff.cpp b/src/game/cliff.cpp index 20c796d..a11fd4c 100644 --- a/src/game/cliff.cpp +++ b/src/game/cliff.cpp @@ -421,7 +421,7 @@ void outcommand(char *s) //dangit Matt, stop ripping out my useful routines =] static int row=1,commandnum=0; int slength,x; - char strtoprint[25],string2[25]; + char strtoprint[25],string2[40]; //gotoxy(43,row++); if (row==21) row=1; slength=strlen(s); diff --git a/src/game/game.cpp b/src/game/game.cpp index 32c35ef..7c411b8 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -293,7 +293,7 @@ Uint8 game::port_read(Uint16 port) // writes a byte to the cpu's port void game::port_write(Uint16 port, Uint8 value) { - char s[81] = { 0 }; + char s[82] = { 0 }; port &= 0xFF; sprintf(s, "ERROR: CPU port %x write requested (value %x) but this function is unimplemented!", port, value); diff --git a/src/game/gpworld.cpp b/src/game/gpworld.cpp index a9d646c..30af43c 100644 --- a/src/game/gpworld.cpp +++ b/src/game/gpworld.cpp @@ -386,7 +386,7 @@ Uint8 gpworld::port_read(Uint16 port) // writes a byte to the cpu's port void gpworld::port_write(Uint16 port, Uint8 value) { - char s[81] = { 0 }; + char s[82] = { 0 }; port &= 0xFF; diff --git a/src/game/lair2.cpp b/src/game/lair2.cpp index 63e6d94..5be6312 100644 --- a/src/game/lair2.cpp +++ b/src/game/lair2.cpp @@ -296,7 +296,7 @@ lair2::lair2() : { m_shortgamename = "lair2"; memset(m_cpumem, 0, CPU_MEM_SIZE); - memset(EEPROM_9536, 0, 0x80); + memset(EEPROM_9536, 0, sizeof(EEPROM_9536)); m_uCoinCount[0] = m_uCoinCount[1] = 0; banks[0] = 0xff; // bank 0 is active low banks[1] = 0x01; // bank 1 is active high - bit 0 is set for EEP diff --git a/src/game/laireuro.cpp b/src/game/laireuro.cpp index 11f53e3..38de54f 100644 --- a/src/game/laireuro.cpp +++ b/src/game/laireuro.cpp @@ -149,8 +149,12 @@ void laireuro::do_nmi() // Redraws the screen (if needed) on interrupt video_blit(); + // intermediate variable to avoid: promoted ~unsigned is always non-zero [-Wsign-compare] + uint8_t check1 = ~(m_banks[1] & 0x04); + uint8_t check2 = ~(m_banks[1] & 0x08); + // Italian DL doesn't like it if coins held too long - if (~(m_banks[1] & 0x04)) + if (check1) { static int coinCount = 0; if (coinCount >= 6) @@ -160,7 +164,7 @@ void laireuro::do_nmi() } coinCount++; } - if (~(m_banks[1] & 0x08)) + if (check2) { static int coinCount = 0; if (coinCount >= 6) diff --git a/src/game/singe/loslib.c b/src/game/singe/loslib.c index 70a67bc..f46d357 100644 --- a/src/game/singe/loslib.c +++ b/src/game/singe/loslib.c @@ -72,7 +72,11 @@ static int os_getenv (lua_State *L) { static int os_clock (lua_State *L) { +#ifdef __x86_64__ + lua_pushnumber(L, (((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC)*6); +#else lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC); +#endif return 1; } diff --git a/src/game/timetrav.cpp b/src/game/timetrav.cpp index d819e71..2cdd508 100644 --- a/src/game/timetrav.cpp +++ b/src/game/timetrav.cpp @@ -75,12 +75,13 @@ Uint8 timetrav::cpu_mem_read(Uint32 addr) Uint8 result = m_cpumem[addr]; // Scratch ram - if (addr < 0x10000) + if (addr < 0x10000) { + (void)0; } - // ROM - else if (addr >= 0xc0000) + else if (addr >= 0xc0000) { + (void)0; } else { diff --git a/src/io/mpo_fileio.cpp b/src/io/mpo_fileio.cpp index 5bb9be3..f690146 100644 --- a/src/io/mpo_fileio.cpp +++ b/src/io/mpo_fileio.cpp @@ -46,7 +46,8 @@ void mpo_test() { int i = 0; int b; - + + b = b + 0; b = 5 / i; // force crash } } diff --git a/src/io/network.cpp b/src/io/network.cpp index 900a4cc..9827ab8 100644 --- a/src/io/network.cpp +++ b/src/io/network.cpp @@ -145,12 +145,12 @@ struct net_packet g_packet; // what we're gonna send void net_set_gamename(char *gamename) { - strncpy(g_packet.gamename, gamename, sizeof(g_packet.gamename)); + strncpy(g_packet.gamename, gamename, sizeof(g_packet.gamename)-1); } void net_set_ldpname(char *ldpname) { - strncpy(g_packet.ldpname, ldpname, sizeof(g_packet.ldpname)); + strncpy(g_packet.ldpname, ldpname, sizeof(g_packet.ldpname)-1); } #ifdef WIN32 @@ -236,12 +236,11 @@ unsigned int get_sys_mem() unsigned int mem = 0; #ifdef LINUX FILE *F; - int iRes = 0; const char *s = "ls -l /proc/kcore | awk '{print $5}'"; F = popen(s, "r"); if (F) { - iRes = fscanf(F, "%u", &mem); // this breaks if they have over 2 gigs of ram :) + fscanf(F, "%u", &mem); // this breaks if they have over 2 gigs of ram :) pclose(F); } @@ -603,13 +602,13 @@ void net_send_data_to_server() printerror("your OS is unknown in network.cpp, please fix this"); } - strncpy(g_packet.os_desc, get_os_description(), sizeof(g_packet.os_desc)); + strncpy(g_packet.os_desc, get_os_description(), sizeof(g_packet.os_desc)-1); g_packet.protocol = PROTOCOL_VERSION; g_packet.mhz = get_cpu_mhz(); g_packet.mem = get_sys_mem(); - strncpy(g_packet.video_desc, get_video_description(), sizeof(g_packet.video_desc)); - strncpy(g_packet.cpu_name, get_cpu_name(), sizeof(g_packet.cpu_name)); - strncpy(g_packet.daphne_version, get_daphne_version(), sizeof(g_packet.daphne_version)); + strncpy(g_packet.video_desc, get_video_description(), sizeof(g_packet.video_desc)-1); + strncpy(g_packet.cpu_name, get_cpu_name(), sizeof(g_packet.cpu_name)-1); + strncpy(g_packet.daphne_version, get_daphne_version(), sizeof(g_packet.daphne_version)-1); // now compute CRC32 of the rest of the packet g_packet.crc32 = crc32(0L, Z_NULL, 0); diff --git a/src/io/unzip.cpp b/src/io/unzip.cpp index 5b85096..2f4a859 100644 --- a/src/io/unzip.cpp +++ b/src/io/unzip.cpp @@ -802,8 +802,8 @@ extern int ZEXPORT unzLocateFile ( if (file==NULL) return UNZ_PARAMERROR; - if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP) - return UNZ_PARAMERROR; + if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP) + return UNZ_PARAMERROR; s=(unz_s*)file; if (!s->current_file_ok) @@ -854,11 +854,7 @@ local int unzlocal_CheckCurrentFileCoherencyHeader ( *poffset_local_extrafield = 0; *psize_local_extrafield = 0; -// if (fseek(s->file,s->cur_file_info_internal.offset_curfile + -// s->byte_before_the_zipfile,SEEK_SET)!=0) - if (!mpo_seek(s->cur_file_info_internal.offset_curfile + - s->byte_before_the_zipfile, - MPO_SEEK_SET, s->file)) // MPO + if (!mpo_seek(s->cur_file_info_internal.offset_curfile + s->byte_before_the_zipfile, MPO_SEEK_SET, s->file)) // MPO return UNZ_ERRNO; @@ -884,9 +880,8 @@ local int unzlocal_CheckCurrentFileCoherencyHeader ( else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method)) err=UNZ_BADZIPFILE; - if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && - (s->cur_file_info.compression_method!=Z_DEFLATED)) - err=UNZ_BADZIPFILE; + if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && (s->cur_file_info.compression_method!=Z_DEFLATED)) + err=UNZ_BADZIPFILE; if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* date/time */ // MPO err=UNZ_ERRNO; @@ -949,8 +944,8 @@ extern int ZEXPORT unzOpenCurrentFile ( if (!s->current_file_ok) return UNZ_PARAMERROR; - if (s->pfile_in_zip_read != NULL) - unzCloseCurrentFile(file); + if (s->pfile_in_zip_read != NULL) + unzCloseCurrentFile(file); if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar, &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK) diff --git a/src/ldp-in/vp380.cpp b/src/ldp-in/vp380.cpp index 9338248..39da53e 100644 --- a/src/ldp-in/vp380.cpp +++ b/src/ldp-in/vp380.cpp @@ -200,7 +200,6 @@ void write_vp380 (unsigned char value) char yc[4]; int x; int y; - int Line = 0; // get x,y strncpy (xc, &CommandBuffer[5],2); @@ -218,7 +217,6 @@ void write_vp380 (unsigned char value) if (g_LDP1450_Strings[j].y == (36 * y) - 20) { g_LDP1450_TextControl.TextLine = j; - Line = 1; break; } } diff --git a/src/ldp-out/ld-v6000.cpp b/src/ldp-out/ld-v6000.cpp index 5b2d973..906011c 100644 --- a/src/ldp-out/ld-v6000.cpp +++ b/src/ldp-out/ld-v6000.cpp @@ -302,7 +302,7 @@ bool v6000::wait_for_finished() { const int time_to_finish = 3; // wait this long to timeout - char s[81] = { 0 }; + char s[48] = { 0 }; char debug_string[81] = { 0 }; // int status_timer = 0; int finish_timer = 0; diff --git a/src/sound/sound.h b/src/sound/sound.h index afe41a3..2b071c3 100644 --- a/src/sound/sound.h +++ b/src/sound/sound.h @@ -23,7 +23,11 @@ #ifndef SOUND_H #define SOUND_H +#ifdef WIN32 #include +#else +#include +#endif // header file for sound.c diff --git a/src/sound/ssi263.cpp b/src/sound/ssi263.cpp index 1692ae1..68d5b57 100644 --- a/src/sound/ssi263.cpp +++ b/src/sound/ssi263.cpp @@ -472,7 +472,6 @@ bool g_bSamplePlaying = false; void ssi263_say_phones(char *phonemes, int len) { sample_s the_sample; - unsigned int channel; the_sample.pu8Buf = NULL; the_sample.uLength = 0; @@ -480,7 +479,7 @@ void ssi263_say_phones(char *phonemes, int len) if (tqsynth_phones_to_wave(phonemes, len, &the_sample)) { g_bSamplePlaying = true; // so that we don't overlap samples (only happens at the very beginning of boot-up) - channel = samples_play_sample(the_sample.pu8Buf, the_sample.uLength, AUDIO_CHANNELS, -1, ssi263_finished_callback); + samples_play_sample(the_sample.pu8Buf, the_sample.uLength, AUDIO_CHANNELS, -1, ssi263_finished_callback); // Wait for sample to stop playing // NOTE : This is a hack and isn't proper emulation. diff --git a/src/sound/tms9919-sdl.cpp b/src/sound/tms9919-sdl.cpp index 44ce71a..a927827 100644 --- a/src/sound/tms9919-sdl.cpp +++ b/src/sound/tms9919-sdl.cpp @@ -131,7 +131,6 @@ void cSdlTMS9919::AudioCallback ( Uint8 *stream, int length ) // int volume = ( m_MasterVolume * AUDIO_MAX_VOLUME ) / 100; - bool mix = false; memset ( stream, m_AudioSpec.silence, length ); for ( int i = 0; i < 4; i++ ) { @@ -141,9 +140,6 @@ void cSdlTMS9919::AudioCallback ( Uint8 *stream, int length ) // make sure that attenuation (volume) isn't 15 = off and we have a frequency if (( m_Attenuation [i] != 15 ) && ( info->period >= 1.0 )) { - // new data so we'll need to mix - mix = true; - // set left = length (number of samples we need to process) int left = length/4, j = 1; @@ -198,13 +194,6 @@ void cSdlTMS9919::AudioCallback ( Uint8 *stream, int length ) } } -// if ( m_pSpeechSynthesizer != NULL ) { -// mix |= m_pSpeechSynthesizer->AudioCallback ( m_MixBuffer, length ); -// } - - //if ( mix == true ) { - // SDL_MixAudio ( stream, m_MixBuffer, length, volume ); -// } } int cSdlTMS9919::SetSpeechSynthesizer ( cTMS5220 *speech ) diff --git a/src/video/SDL_Console.cpp b/src/video/SDL_Console.cpp index 45e1c20..747e109 100644 --- a/src/video/SDL_Console.cpp +++ b/src/video/SDL_Console.cpp @@ -180,7 +180,7 @@ void UpdateConsole() void DrawConsole() { int loop; - SDL_Rect DestRect = {0, 0, ConsoleSurface->w, ConsoleSurface->h}; + SDL_Rect DestRect = {0, 0, (short unsigned int)ConsoleSurface->w, (short unsigned int)ConsoleSurface->h}; SDL_BlitSurface(ConsoleSurface, NULL, OutputScreen, &DestRect); diff --git a/src/video/SDL_Console.h b/src/video/SDL_Console.h index 9f6ef71..decff0e 100644 --- a/src/video/SDL_Console.h +++ b/src/video/SDL_Console.h @@ -5,7 +5,7 @@ #include "SDL_ConsoleCommands.h" -#define CHARS_PER_LINE 128 +#define CHARS_PER_LINE 256 #ifdef __cplusplus extern "C" { diff --git a/src/vldp2/libmpeg2/decode.c b/src/vldp2/libmpeg2/decode.c index d222a21..bf26635 100644 --- a/src/vldp2/libmpeg2/decode.c +++ b/src/vldp2/libmpeg2/decode.c @@ -40,7 +40,7 @@ const mpeg2_info_t * mpeg2_info (mpeg2dec_t * mpeg2dec) return &(mpeg2dec->info); } -static inline int skip_chunk (mpeg2dec_t * mpeg2dec, int bytes) +static int skip_chunk (mpeg2dec_t * mpeg2dec, int bytes) { uint8_t * current; uint32_t shift; @@ -74,7 +74,7 @@ static inline int skip_chunk (mpeg2dec_t * mpeg2dec, int bytes) return 0; } -static inline int copy_chunk (mpeg2dec_t * mpeg2dec, int bytes) +static int copy_chunk (mpeg2dec_t * mpeg2dec, int bytes) { uint8_t * current; uint32_t shift; @@ -116,7 +116,7 @@ void mpeg2_buffer (mpeg2dec_t * mpeg2dec, uint8_t * start, uint8_t * end) mpeg2dec->buf_end = end; } -static inline int seek_chunk (mpeg2dec_t * mpeg2dec) +static int seek_chunk (mpeg2dec_t * mpeg2dec) { int size, skipped; diff --git a/src/vldp2/libmpeg2/header.c b/src/vldp2/libmpeg2/header.c index 548d6bf..5a45ba7 100644 --- a/src/vldp2/libmpeg2/header.c +++ b/src/vldp2/libmpeg2/header.c @@ -249,7 +249,7 @@ static int sequence_display_ext (mpeg2dec_t * mpeg2dec) return 0; } -static inline void finalize_sequence (sequence_t * sequence) +static void finalize_sequence (sequence_t * sequence) { int width; int height; diff --git a/src/vldp2/libmpeg2/idct.c b/src/vldp2/libmpeg2/idct.c index bcae078..db3391e 100644 --- a/src/vldp2/libmpeg2/idct.c +++ b/src/vldp2/libmpeg2/idct.c @@ -60,7 +60,7 @@ do { \ } while (0) #endif -static void inline idct_row (int16_t * const block) +static void idct_row (int16_t * const block) { int d0, d1, d2, d3; int a0, a1, a2, a3, b0, b1, b2, b3; @@ -113,7 +113,7 @@ static void inline idct_row (int16_t * const block) block[7] = (a0 - b0) >> 8; } -static void inline idct_col (int16_t * const block) +static void idct_col (int16_t * const block) { int d0, d1, d2, d3; int a0, a1, a2, a3, b0, b1, b2, b3; diff --git a/src/vldp2/libmpeg2/idct_mmx.c b/src/vldp2/libmpeg2/idct_mmx.c index 4915b93..32e19a4 100644 --- a/src/vldp2/libmpeg2/idct_mmx.c +++ b/src/vldp2/libmpeg2/idct_mmx.c @@ -41,7 +41,7 @@ #if 0 /* C row IDCT - its just here to document the MMXEXT and MMX versions */ -static inline void idct_row (int16_t * row, int offset, +static void idct_row (int16_t * row, int offset, int16_t * table, int32_t * rounder) { int C1, C2, C3, C4, C5, C6, C7; @@ -90,7 +90,7 @@ static inline void idct_row (int16_t * row, int offset, c5, -c1, c3, -c1, \ c7, c3, c7, -c5 } -static inline void mmxext_row_head (int16_t * const row, const int offset, +static void mmxext_row_head (int16_t * const row, const int offset, const int16_t * const table) { movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */ @@ -107,7 +107,7 @@ static inline void mmxext_row_head (int16_t * const row, const int offset, pshufw_r2r (mm2, mm2, 0x4e); /* mm2 = x2 x0 x6 x4 */ } -static inline void mmxext_row (const int16_t * const table, +static void mmxext_row (const int16_t * const table, const int32_t * const rounder) { movq_m2r (*(table+8), mm1); /* mm1 = -C5 -C1 C3 C1 */ @@ -147,7 +147,7 @@ static inline void mmxext_row (const int16_t * const table, psubd_r2r (mm5, mm4); /* mm4 = a3-b3 a2-b2 + rounder */ } -static inline void mmxext_row_tail (int16_t * const row, const int store) +static void mmxext_row_tail (int16_t * const row, const int store) { psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */ @@ -165,7 +165,7 @@ static inline void mmxext_row_tail (int16_t * const row, const int store) movq_r2m (mm4, *(row+store+4)); /* save y7 y6 y5 y4 */ } -static inline void mmxext_row_mid (int16_t * const row, const int store, +static void mmxext_row_mid (int16_t * const row, const int store, const int offset, const int16_t * const table) { @@ -205,7 +205,7 @@ static inline void mmxext_row_mid (int16_t * const row, const int store, c5, -c1, c7, -c5, \ c7, c3, c3, -c1 } -static inline void mmx_row_head (int16_t * const row, const int offset, +static void mmx_row_head (int16_t * const row, const int offset, const int16_t * const table) { movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */ @@ -225,7 +225,7 @@ static inline void mmx_row_head (int16_t * const row, const int offset, punpckhdq_r2r (mm2, mm2); /* mm2 = x6 x4 x6 x4 */ } -static inline void mmx_row (const int16_t * const table, +static void mmx_row (const int16_t * const table, const int32_t * const rounder) { pmaddwd_r2r (mm2, mm4); /* mm4 = -C4*x4-C2*x6 C4*x4+C6*x6 */ @@ -265,7 +265,7 @@ static inline void mmx_row (const int16_t * const table, psubd_r2r (mm5, mm7); /* mm7 = a3-b3 a2-b2 + rounder */ } -static inline void mmx_row_tail (int16_t * const row, const int store) +static void mmx_row_tail (int16_t * const row, const int store) { psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */ @@ -289,7 +289,7 @@ static inline void mmx_row_tail (int16_t * const row, const int store) movq_r2m (mm7, *(row+store+4)); /* save y7 y6 y5 y4 */ } -static inline void mmx_row_mid (int16_t * const row, const int store, +static void mmx_row_mid (int16_t * const row, const int store, const int offset, const int16_t * const table) { movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */ @@ -326,7 +326,7 @@ static inline void mmx_row_mid (int16_t * const row, const int store, #if 0 /* C column IDCT - its just here to document the MMXEXT and MMX versions */ -static inline void idct_col (int16_t * col, int offset) +static void idct_col (int16_t * col, int offset) { /* multiplication - as implemented on mmx */ #define F(c,x) (((c) * (x)) >> 16) @@ -397,7 +397,7 @@ static inline void idct_col (int16_t * col, int offset) /* MMX column IDCT */ -static inline void idct_col (int16_t * const col, const int offset) +static void idct_col (int16_t * const col, const int offset) { #define T1 13036 #define T2 27146 @@ -559,7 +559,7 @@ static const int32_t rounder5[] ATTR_ALIGN(8) = #define declare_idct(idct,table,idct_row_head,idct_row,idct_row_tail,idct_row_mid) \ -static inline void idct (int16_t * const block) \ +static void idct (int16_t * const block) \ { \ static const int16_t table04[] ATTR_ALIGN(16) = \ table (22725, 21407, 19266, 16384, 12873, 8867, 4520); \ @@ -602,7 +602,7 @@ do { \ packuswb_r2r (r1, r0); \ } while (0) -static inline void block_copy (int16_t * const block, uint8_t * dest, +static void block_copy (int16_t * const block, uint8_t * dest, const int stride) { movq_m2r (*(block+0*8), mm0); @@ -635,7 +635,7 @@ do { \ paddsw_m2r (*(block+offset+4), r2); \ } while (0) -static inline void block_add (int16_t * const block, uint8_t * dest, +static void block_add (int16_t * const block, uint8_t * dest, const int stride) { movq_m2r (*dest, mm1); @@ -664,7 +664,7 @@ static inline void block_add (int16_t * const block, uint8_t * dest, } -static inline void block_zero (int16_t * const block) +static void block_zero (int16_t * const block) { pxor_r2r (mm0, mm0); movq_r2m (mm0, *(block+0*4)); @@ -698,7 +698,7 @@ do { \ pshufw_r2r (reg, reg, 0x00); \ } while (0) -static inline void block_add_DC (int16_t * const block, uint8_t * dest, +static void block_add_DC (int16_t * const block, uint8_t * dest, const int stride, const int cpu) { movd_v2r ((block[0] + 4) >> 3, mm0); diff --git a/src/vldp2/libmpeg2/motion_comp_mmx.c b/src/vldp2/libmpeg2/motion_comp_mmx.c index 33103e1..643d1bf 100644 --- a/src/vldp2/libmpeg2/motion_comp_mmx.c +++ b/src/vldp2/libmpeg2/motion_comp_mmx.c @@ -63,13 +63,13 @@ static mmx_t round4 = {0x0002000200020002LL}; * unrolling will help */ -static inline void mmx_zero_reg () +static void mmx_zero_reg () { /* load 0 into mm0 */ pxor_r2r (mm0, mm0); } -static inline void mmx_average_2_U8 (uint8_t * dest, const uint8_t * src1, +static void mmx_average_2_U8 (uint8_t * dest, const uint8_t * src1, const uint8_t * src2) { /* *dest = (*src1 + *src2 + 1)/ 2; */ @@ -88,7 +88,7 @@ static inline void mmx_average_2_U8 (uint8_t * dest, const uint8_t * src1, movq_r2m (mm4, *dest); /* store result in dest */ } -static inline void mmx_interp_average_2_U8 (uint8_t * dest, +static void mmx_interp_average_2_U8 (uint8_t * dest, const uint8_t * src1, const uint8_t * src2) { @@ -118,7 +118,7 @@ static inline void mmx_interp_average_2_U8 (uint8_t * dest, movq_r2m (mm6, *dest); /* store result in dest */ } -static inline void mmx_average_4_U8 (uint8_t * dest, const uint8_t * src1, +static void mmx_average_4_U8 (uint8_t * dest, const uint8_t * src1, const uint8_t * src2, const uint8_t * src3, const uint8_t * src4) @@ -171,7 +171,7 @@ static inline void mmx_average_4_U8 (uint8_t * dest, const uint8_t * src1, movq_r2m (mm1, *dest); /* store result in dest */ } -static inline void mmx_interp_average_4_U8 (uint8_t * dest, +static void mmx_interp_average_4_U8 (uint8_t * dest, const uint8_t * src1, const uint8_t * src2, const uint8_t * src3, @@ -237,7 +237,7 @@ static inline void mmx_interp_average_4_U8 (uint8_t * dest, /*-----------------------------------------------------------------------*/ -static inline void MC_avg_mmx (const int width, int height, uint8_t * dest, +static void MC_avg_mmx (const int width, int height, uint8_t * dest, const uint8_t * ref, const int stride) { mmx_zero_reg (); @@ -267,7 +267,7 @@ static void MC_avg_o_8_mmx (uint8_t * dest, const uint8_t * ref, /*-----------------------------------------------------------------------*/ -static inline void MC_put_mmx (const int width, int height, uint8_t * dest, +static void MC_put_mmx (const int width, int height, uint8_t * dest, const uint8_t * ref, const int stride) { mmx_zero_reg (); @@ -302,7 +302,7 @@ static void MC_put_o_8_mmx (uint8_t * dest, const uint8_t * ref, /*-----------------------------------------------------------------------*/ /* Half pixel interpolation in the x direction */ -static inline void MC_avg_x_mmx (const int width, int height, uint8_t * dest, +static void MC_avg_x_mmx (const int width, int height, uint8_t * dest, const uint8_t * ref, const int stride) { mmx_zero_reg (); @@ -332,7 +332,7 @@ static void MC_avg_x_8_mmx (uint8_t * dest, const uint8_t * ref, /*-----------------------------------------------------------------------*/ -static inline void MC_put_x_mmx (const int width, int height, uint8_t * dest, +static void MC_put_x_mmx (const int width, int height, uint8_t * dest, const uint8_t * ref, const int stride) { mmx_zero_reg (); @@ -362,7 +362,7 @@ static void MC_put_x_8_mmx (uint8_t * dest, const uint8_t * ref, /*-----------------------------------------------------------------------*/ -static inline void MC_avg_xy_mmx (const int width, int height, uint8_t * dest, +static void MC_avg_xy_mmx (const int width, int height, uint8_t * dest, const uint8_t * ref, const int stride) { const uint8_t * ref_next = ref + stride; @@ -396,7 +396,7 @@ static void MC_avg_xy_8_mmx (uint8_t * dest, const uint8_t * ref, /*-----------------------------------------------------------------------*/ -static inline void MC_put_xy_mmx (const int width, int height, uint8_t * dest, +static void MC_put_xy_mmx (const int width, int height, uint8_t * dest, const uint8_t * ref, const int stride) { const uint8_t * ref_next = ref + stride; @@ -429,7 +429,7 @@ static void MC_put_xy_8_mmx (uint8_t * dest, const uint8_t * ref, /*-----------------------------------------------------------------------*/ -static inline void MC_avg_y_mmx (const int width, int height, uint8_t * dest, +static void MC_avg_y_mmx (const int width, int height, uint8_t * dest, const uint8_t * ref, const int stride) { const uint8_t * ref_next = ref + stride; @@ -462,7 +462,7 @@ static void MC_avg_y_8_mmx (uint8_t * dest, const uint8_t * ref, /*-----------------------------------------------------------------------*/ -static inline void MC_put_y_mmx (const int width, int height, uint8_t * dest, +static void MC_put_y_mmx (const int width, int height, uint8_t * dest, const uint8_t * ref, const int stride) { const uint8_t * ref_next = ref + stride; @@ -524,7 +524,7 @@ do { \ /* CPU_MMXEXT code */ -static inline void MC_put1_8 (int height, uint8_t * dest, const uint8_t * ref, +static void MC_put1_8 (int height, uint8_t * dest, const uint8_t * ref, const int stride) { do { @@ -535,7 +535,7 @@ static inline void MC_put1_8 (int height, uint8_t * dest, const uint8_t * ref, } while (--height); } -static inline void MC_put1_16 (int height, uint8_t * dest, const uint8_t * ref, +static void MC_put1_16 (int height, uint8_t * dest, const uint8_t * ref, const int stride) { do { @@ -548,7 +548,7 @@ static inline void MC_put1_16 (int height, uint8_t * dest, const uint8_t * ref, } while (--height); } -static inline void MC_avg1_8 (int height, uint8_t * dest, const uint8_t * ref, +static void MC_avg1_8 (int height, uint8_t * dest, const uint8_t * ref, const int stride, const int cpu) { do { @@ -560,7 +560,7 @@ static inline void MC_avg1_8 (int height, uint8_t * dest, const uint8_t * ref, } while (--height); } -static inline void MC_avg1_16 (int height, uint8_t * dest, const uint8_t * ref, +static void MC_avg1_16 (int height, uint8_t * dest, const uint8_t * ref, const int stride, const int cpu) { do { @@ -575,7 +575,7 @@ static inline void MC_avg1_16 (int height, uint8_t * dest, const uint8_t * ref, } while (--height); } -static inline void MC_put2_8 (int height, uint8_t * dest, const uint8_t * ref, +static void MC_put2_8 (int height, uint8_t * dest, const uint8_t * ref, const int stride, const int offset, const int cpu) { @@ -588,7 +588,7 @@ static inline void MC_put2_8 (int height, uint8_t * dest, const uint8_t * ref, } while (--height); } -static inline void MC_put2_16 (int height, uint8_t * dest, const uint8_t * ref, +static void MC_put2_16 (int height, uint8_t * dest, const uint8_t * ref, const int stride, const int offset, const int cpu) { @@ -604,7 +604,7 @@ static inline void MC_put2_16 (int height, uint8_t * dest, const uint8_t * ref, } while (--height); } -static inline void MC_avg2_8 (int height, uint8_t * dest, const uint8_t * ref, +static void MC_avg2_8 (int height, uint8_t * dest, const uint8_t * ref, const int stride, const int offset, const int cpu) { @@ -618,7 +618,7 @@ static inline void MC_avg2_8 (int height, uint8_t * dest, const uint8_t * ref, } while (--height); } -static inline void MC_avg2_16 (int height, uint8_t * dest, const uint8_t * ref, +static void MC_avg2_16 (int height, uint8_t * dest, const uint8_t * ref, const int stride, const int offset, const int cpu) { @@ -638,7 +638,7 @@ static inline void MC_avg2_16 (int height, uint8_t * dest, const uint8_t * ref, static mmx_t mask_one = {0x0101010101010101LL}; -static inline void MC_put4_8 (int height, uint8_t * dest, const uint8_t * ref, +static void MC_put4_8 (int height, uint8_t * dest, const uint8_t * ref, const int stride, const int cpu) { movq_m2r (*ref, mm0); @@ -677,7 +677,7 @@ static inline void MC_put4_8 (int height, uint8_t * dest, const uint8_t * ref, } while (--height); } -static inline void MC_put4_16 (int height, uint8_t * dest, const uint8_t * ref, +static void MC_put4_16 (int height, uint8_t * dest, const uint8_t * ref, const int stride, const int cpu) { do { @@ -723,7 +723,7 @@ static inline void MC_put4_16 (int height, uint8_t * dest, const uint8_t * ref, } while (--height); } -static inline void MC_avg4_8 (int height, uint8_t * dest, const uint8_t * ref, +static void MC_avg4_8 (int height, uint8_t * dest, const uint8_t * ref, const int stride, const int cpu) { do { @@ -752,7 +752,7 @@ static inline void MC_avg4_8 (int height, uint8_t * dest, const uint8_t * ref, } while (--height); } -static inline void MC_avg4_16 (int height, uint8_t * dest, const uint8_t * ref, +static void MC_avg4_16 (int height, uint8_t * dest, const uint8_t * ref, const int stride, const int cpu) { do { diff --git a/src/vldp2/libmpeg2/slice.c b/src/vldp2/libmpeg2/slice.c index 7f6a2ed..e26e04b 100644 --- a/src/vldp2/libmpeg2/slice.c +++ b/src/vldp2/libmpeg2/slice.c @@ -45,7 +45,7 @@ static int non_linear_quantizer_scale [] = { 56, 64, 72, 80, 88, 96, 104, 112 }; -static inline int get_macroblock_modes (decoder_t * const decoder) +static int get_macroblock_modes (decoder_t * const decoder) { #define bit_buf (decoder->bitstream_buf) #define bits (decoder->bitstream_bits) @@ -138,7 +138,7 @@ static inline int get_macroblock_modes (decoder_t * const decoder) #undef bit_ptr } -static inline int get_quantizer_scale (decoder_t * const decoder) +static int get_quantizer_scale (decoder_t * const decoder) { #define bit_buf (decoder->bitstream_buf) #define bits (decoder->bitstream_bits) @@ -158,7 +158,7 @@ static inline int get_quantizer_scale (decoder_t * const decoder) #undef bit_ptr } -static inline int get_motion_delta (decoder_t * const decoder, +static int get_motion_delta (decoder_t * const decoder, const int f_code) { #define bit_buf (decoder->bitstream_buf) @@ -212,7 +212,7 @@ static inline int get_motion_delta (decoder_t * const decoder, #undef bit_ptr } -static inline int bound_motion_vector (const int vector, const int f_code) +static int bound_motion_vector (const int vector, const int f_code) { #if 0 unsigned int limit; @@ -231,7 +231,7 @@ static inline int bound_motion_vector (const int vector, const int f_code) #endif } -static inline int get_dmv (decoder_t * const decoder) +static int get_dmv (decoder_t * const decoder) { #define bit_buf (decoder->bitstream_buf) #define bits (decoder->bitstream_bits) @@ -247,7 +247,7 @@ static inline int get_dmv (decoder_t * const decoder) #undef bit_ptr } -static inline int get_coded_block_pattern (decoder_t * const decoder) +static int get_coded_block_pattern (decoder_t * const decoder) { #define bit_buf (decoder->bitstream_buf) #define bits (decoder->bitstream_bits) @@ -275,7 +275,7 @@ static inline int get_coded_block_pattern (decoder_t * const decoder) #undef bit_ptr } -static inline int get_luma_dc_dct_diff (decoder_t * const decoder) +static int get_luma_dc_dct_diff (decoder_t * const decoder) { #define bit_buf (decoder->bitstream_buf) #define bits (decoder->bitstream_bits) @@ -312,7 +312,7 @@ static inline int get_luma_dc_dct_diff (decoder_t * const decoder) #undef bit_ptr } -static inline int get_chroma_dc_dct_diff (decoder_t * const decoder) +static int get_chroma_dc_dct_diff (decoder_t * const decoder) { #define bit_buf (decoder->bitstream_buf) #define bits (decoder->bitstream_bits) @@ -955,7 +955,7 @@ static int get_mpeg1_non_intra_block (decoder_t * const decoder) return i; } -static inline void slice_intra_DCT (decoder_t * const decoder, const int cc, +static void slice_intra_DCT (decoder_t * const decoder, const int cc, uint8_t * const dest, const int stride) { #define bit_buf (decoder->bitstream_buf) @@ -983,7 +983,7 @@ static inline void slice_intra_DCT (decoder_t * const decoder, const int cc, #undef bit_ptr } -static inline void slice_non_intra_DCT (decoder_t * const decoder, +static void slice_non_intra_DCT (decoder_t * const decoder, uint8_t * const dest, const int stride) { int last; @@ -1212,7 +1212,7 @@ static void motion_fr_dmv (decoder_t * const decoder, motion_t * const motion, #undef bit_ptr } -static inline void motion_reuse (const decoder_t * const decoder, +static void motion_reuse (const decoder_t * const decoder, const motion_t * const motion, mpeg2_mc_fct * const * const table) { @@ -1225,7 +1225,7 @@ static inline void motion_reuse (const decoder_t * const decoder, MOTION (table, motion->ref[0], motion_x, motion_y, 16, 0); } -static inline void motion_zero (const decoder_t * const decoder, +static void motion_zero (const decoder_t * const decoder, const motion_t * const motion, mpeg2_mc_fct * const * const table) { @@ -1496,7 +1496,7 @@ void mpeg2_init_fbuf (decoder_t * decoder, uint8_t * current_fbuf[3], decoder->limit_y = height - 16; } -static inline int slice_init (decoder_t * const decoder, int code) +static int slice_init (decoder_t * const decoder, int code) { #define bit_buf (decoder->bitstream_buf) #define bits (decoder->bitstream_bits) diff --git a/src/vldp2/libmpeg2/vlc.h b/src/vldp2/libmpeg2/vlc.h index aa3dfe1..67deffa 100644 --- a/src/vldp2/libmpeg2/vlc.h +++ b/src/vldp2/libmpeg2/vlc.h @@ -27,7 +27,7 @@ do { \ bit_ptr += 2; \ } while (0) -static inline void bitstream_init (decoder_t * decoder, const uint8_t * start) +static void bitstream_init (decoder_t * decoder, const uint8_t * start) { decoder->bitstream_buf = (start[0] << 24) | (start[1] << 16) | (start[2] << 8) | start[3]; diff --git a/src/vldp2/libvo/video_out_null.c b/src/vldp2/libvo/video_out_null.c index aa09cf6..5f3ce06 100644 --- a/src/vldp2/libvo/video_out_null.c +++ b/src/vldp2/libvo/video_out_null.c @@ -82,7 +82,7 @@ static void null_draw_frame (vo_instance_t *instance, uint8_t * const * buf, voi // this is the potentially expensive callback that gets the hardware overlay // ready to be displayed, so we do this before we sleep // NOTE : if this callback fails, we don't want to display the frame due to double buffering considerations - if (g_in_info->prepare_frame(&g_yuv_buf[(int) id])) + if (g_in_info->prepare_frame(&g_yuv_buf[(long) id])) { #ifndef VLDP_BENCHMARK @@ -133,7 +133,7 @@ static void null_draw_frame (vo_instance_t *instance, uint8_t * const * buf, voi #endif // draw the frame // we are using the pointer 'id' as an index, kind of risky, but convenient :) - g_in_info->display_frame(&g_yuv_buf[(int) id]); + g_in_info->display_frame(&g_yuv_buf[(long) id]); #ifndef VLDP_BENCHMARK } // end if we didn't get a new command to interrupt the frame being displayed #endif @@ -271,8 +271,8 @@ static void null_draw_frame (vo_instance_t *instance, uint8_t * const * buf, voi static void null_setup_fbuf (vo_instance_t * _instance, uint8_t ** buf, void ** id) { - static buffer_index = 0; - *id = (int *) buffer_index; // THIS IS A LITTLE TRICKY + static intptr_t buffer_index = 0; + *id = (intptr_t *) buffer_index; // THIS IS A LITTLE TRICKY // We are setting an integer value to a pointer ... // Because it is convenient to let the pointer hold the value of this integer for us // Hopefully it doesn't cause any trouble later ;) diff --git a/src/vldp2/vldp/mpegscan.c b/src/vldp2/vldp/mpegscan.c index 1465f9d..3a5180c 100644 --- a/src/vldp2/vldp/mpegscan.c +++ b/src/vldp2/vldp/mpegscan.c @@ -63,6 +63,7 @@ Sample mpeg2 byte sequence: 00 00 01 B5 25 06 06 06 0B 42 0F 00 #include #include // for malloc #include "mpegscan.h" +#include "vldp_internal.h" unsigned char g_last_three[3] = { 0 }; // the last 3 bytes read unsigned int g_last_three_loc[3] = { 0 }; // the position of the last 3 bytes read diff --git a/src/vldp2/vldp/vldp_internal.c b/src/vldp2/vldp/vldp_internal.c index b446186..3d387b3 100644 --- a/src/vldp2/vldp/vldp_internal.c +++ b/src/vldp2/vldp/vldp_internal.c @@ -30,6 +30,7 @@ //#include //#include "inttypesreplace.h" #include +#include #include "vldp_internal.h" #include "vldp_common.h"