Ticket #10716: 0001-enable-compilation-on-mingw32-w64-64-bit-mingw.patch

File 0001-enable-compilation-on-mingw32-w64-64-bit-mingw.patch, 17.9 KB (added by lexvictory@…, 12 years ago)

Fix mingw-w64 compilation (0.25)

  • mythtv/filters/greedyhdeint/mangle.h

    From 1e3475e369c7f3a794234c4c4da69e1df5264e49 Mon Sep 17 00:00:00 2001
    From: Xander Victory <x@xandervictory.id.au>
    Date: Sat, 12 May 2012 20:39:16 +0800
    Subject: [PATCH] enable compilation on mingw32-w64 (64 bit mingw)
    
    ---
     mythtv/filters/greedyhdeint/mangle.h               |    2 +-
     mythtv/filters/linearblend/filter_linearblend.c    |    4 +-
     mythtv/filters/yadif/aclib_template.c              |   12 ++++----
     mythtv/filters/yadif/filter_yadif.c                |    4 +-
     mythtv/libs/libmyth/audio/audiooutputbase.cpp      |    4 ++
     mythtv/libs/libmyth/audio/audiooutpututil.cpp      |    8 ++--
     mythtv/libs/libmyth/audio/audiooutputwin.cpp       |    4 +-
     mythtv/libs/libmythbase/compat.h                   |    2 +-
     mythtv/libs/libmythbluray/file/filesystem.h        |    6 +++-
     mythtv/libs/libmythsoundtouch/FIFOSampleBuffer.cpp |    2 +-
     mythtv/libs/libmythsoundtouch/TDStretch.cpp        |    2 +-
     .../libs/libmythsoundtouch/cpu_detect_x86_gcc.cpp  |    2 +-
     mythtv/libs/libmythsoundtouch/sse_gcc.cpp          |   31 +++++++++++++++----
     mythtv/libs/libmythtv/RTjpegN.cpp                  |    8 ++--
     mythtv/libs/libmythtv/nuppeldecoder.cpp            |    4 +-
     mythtv/libs/libmythtv/signalmonitor.cpp            |    2 +-
     .../programs/mythfrontend/audiogeneralsettings.cpp |    2 +-
     17 files changed, 62 insertions(+), 37 deletions(-)
    
    diff --git a/mythtv/filters/greedyhdeint/mangle.h b/mythtv/filters/greedyhdeint/mangle.h
    index a868245..8dd7ff5 100644
    a b  
    99
    1010/* Feel free to add more to the list, eg. a.out IMO */
    1111/* Use rip-relative addressing if compiling PIC code on x86-64. */
    12 #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__OS2__) || \
     12#if defined(__CYGWIN__) || defined(__MINGW32__) && !defined(_WIN64) || defined(__OS2__) || \
    1313    CONFIG_DARWIN || (defined(__OpenBSD__) && !defined(__ELF__))
    1414#if ARCH_X86_64 && defined(PIC)
    1515#define MANGLE(a) "_" #a"(%%rip)"
  • mythtv/filters/linearblend/filter_linearblend.c

    diff --git a/mythtv/filters/linearblend/filter_linearblend.c b/mythtv/filters/linearblend/filter_linearblend.c
    index dda046f..5317f66 100644
    a b void linearBlendMMX(unsigned char *src, int stride) 
    8282       PAVGB(%%mm1, %%mm2)                                   // 2L8 + L7 + L9
    8383       "movq %%mm2, (%%"REG_d", %1, 2)                     \n\t"
    8484
    85        : : "r" (src), "r" ((long)stride)
     85       : : "r" (src), "r" ((intptr_t)stride)
    8686       : "%"REG_a, "%"REG_d
    8787    );
    8888}
    void linearBlend3DNow(unsigned char *src, int stride) 
    129129       PAVGUSB(%%mm1, %%mm2)                                 // 2L8 + L7 + L9
    130130       "movq %%mm2, (%%"REG_d", %1, 2)                     \n\t"
    131131
    132        : : "r" (src), "r" ((long)stride)
     132       : : "r" (src), "r" ((intptr_t)stride)
    133133       : "%"REG_a, "%"REG_d
    134134    );
    135135}
  • mythtv/filters/yadif/aclib_template.c

    diff --git a/mythtv/filters/yadif/aclib_template.c b/mythtv/filters/yadif/aclib_template.c
    index 436db6a..c80aedd 100644
    a b If you have questions please contact with me: Nick Kurshev: nickols_k@mail.ru. 
    7878/* for small memory blocks (<256 bytes) this version is faster */
    7979#define small_memcpy(to,from,n)\
    8080{\
    81 register unsigned long int dummy;\
     81register uintptr_t dummy;\
    8282__asm__ __volatile__(\
    8383        "rep; movsb"\
    8484        :"=&D"(to), "=&S"(from), "=&c"(dummy)\
    void * RENAME(fast_memcpy)(void * to, const void * from, size_t len) 
    165165#endif
    166166        if (len >= MIN_LEN)
    167167        {
    168           register unsigned long int delta;
     168          register uintptr_t delta;
    169169          /* Align destinition to MMREG_SIZE -boundary */
    170           delta = ((unsigned long int)to)&(MMREG_SIZE-1);
     170          delta = ((uintptr_t)to)&(MMREG_SIZE-1);
    171171          if (delta)
    172172          {
    173173            delta=MMREG_SIZE-delta;
    void * RENAME(fast_memcpy)(void * to, const void * from, size_t len) 
    186186           processor's decoders, but it's not always possible.
    187187        */
    188188#ifdef HAVE_SSE /* Only P3 (may be Cyrix3) */
    189         if (((unsigned long)from) & 15)
     189        if (((uintptr_t)from) & 15)
    190190        /* if SRC is misaligned */
    191191        for (; i>0; i--)
    192192        {
    void * RENAME(fast_memcpy)(void * to, const void * from, size_t len) 
    231231        }
    232232#else
    233233        // Align destination at BLOCK_SIZE boundary
    234         for (; ((long)to & (BLOCK_SIZE-1)) && i>0; i--)
     234        for (; ((intptr_t)to & (BLOCK_SIZE-1)) && i>0; i--)
    235235        {
    236236                __asm__ __volatile__ (
    237237#ifndef HAVE_ONLY_MMX1
    void * RENAME(fast_memcpy)(void * to, const void * from, size_t len) 
    318318                        " jae 1b                \n\t"
    319319      MOVX" %6, %%"REG_b" \n\t"
    320320                                : "+r" (from), "+r" (to), "+r" (i)
    321                                 : "r" ((long)BLOCK_SIZE), "i" (BLOCK_SIZE/64), "i" ((long)CONFUSION_FACTOR), "m" (oldbx)
     321                                : "r" ((intptr_t)BLOCK_SIZE), "i" (BLOCK_SIZE/64), "i" ((intptr_t)CONFUSION_FACTOR), "m" (oldbx)
    322322                                : "%"REG_a, "memory"
    323323                );
    324324
  • mythtv/filters/yadif/filter_yadif.c

    diff --git a/mythtv/filters/yadif/filter_yadif.c b/mythtv/filters/yadif/filter_yadif.c
    index cd2c1e3..b2b8d58 100644
    a b static void filter_line_mmx2(struct ThisFilter *p, uint8_t *dst, 
    352352            :[prev] "r"(prev),\
    353353             [cur]  "r"(cur),\
    354354             [next] "r"(next),\
    355              [prefs]"r"((long)refs),\
    356              [mrefs]"r"((long)-refs),\
     355             [prefs]"r"((intptr_t)refs),\
     356             [mrefs]"r"((intptr_t)-refs),\
    357357             [pw1]  "m"(pw_1),\
    358358             [pb1]  "m"(pb_1),\
    359359             [mode] "g"(mode)\
  • mythtv/libs/libmyth/audio/audiooutputbase.cpp

    diff --git a/mythtv/libs/libmyth/audio/audiooutputbase.cpp b/mythtv/libs/libmyth/audio/audiooutputbase.cpp
    index 4024221..79d3700 100644
    a b  
    2626#define RPOS audiobuffer + raud
    2727#define ABUF audiobuffer
    2828#define STST soundtouch::SAMPLETYPE
     29#ifdef _WIN64
     30#define AOALIGN(x) (((long long)&x + 15) & ~0xf);
     31#else
    2932#define AOALIGN(x) (((long)&x + 15) & ~0xf);
     33#endif
    3034
    3135// 1,2,5 and 7 channels are currently valid for upmixing if required
    3236#define UPMIX_CHANNEL_MASK ((1<<1)|(1<<2)|(1<<5)|1<<7)
  • mythtv/libs/libmyth/audio/audiooutpututil.cpp

    diff --git a/mythtv/libs/libmyth/audio/audiooutpututil.cpp b/mythtv/libs/libmyth/audio/audiooutpututil.cpp
    index 68e882b..2a69f8a 100644
    a b static int fromFloat8(uchar *out, float *in, int len) 
    140140    float f = (1<<7) - 1;
    141141
    142142#if ARCH_X86
    143     if (sse_check() && len >= 16 && ((unsigned long)out & 0xf) == 0)
     143    if (sse_check() && len >= 16 && ((uintptr_t)out & 0xf) == 0)
    144144    {
    145145        int loops = len >> 4;
    146146        i = loops << 4;
    static int fromFloat16(short *out, float *in, int len) 
    245245    float f = (1<<15) - 1;
    246246
    247247#if ARCH_X86
    248     if (sse_check() && len >= 16 && ((unsigned long)out & 0xf) == 0)
     248    if (sse_check() && len >= 16 && ((uintptr_t)out & 0xf) == 0)
    249249    {
    250250        int loops = len >> 4;
    251251        i = loops << 4;
    static int fromFloat32(AudioFormat format, int *out, float *in, int len) 
    352352        shift = 0;
    353353
    354354#if ARCH_X86
    355     if (sse_check() && len >= 16 && ((unsigned long)out & 0xf) == 0)
     355    if (sse_check() && len >= 16 && ((uintptr_t)out & 0xf) == 0)
    356356    {
    357357        float o = 1, mo = -1;
    358358        int loops = len >> 4;
    static int fromFloatFLT(float *out, float *in, int len) 
    417417    int i = 0;
    418418
    419419#if ARCH_X86
    420     if (sse_check() && len >= 16 && ((unsigned long)in & 0xf) == 0)
     420    if (sse_check() && len >= 16 && ((uintptr_t)in & 0xf) == 0)
    421421    {
    422422        int loops = len >> 4;
    423423        float o = 1, mo = -1;
  • mythtv/libs/libmyth/audio/audiooutputwin.cpp

    diff --git a/mythtv/libs/libmyth/audio/audiooutputwin.cpp b/mythtv/libs/libmyth/audio/audiooutputwin.cpp
    index ff665dc..0b81e82 100644
    a b bool AudioOutputWin::OpenDevice(void) 
    218218
    219219    MMRESULT mmr = waveOutOpen(&m_priv->m_hWaveOut, WAVE_MAPPER,
    220220                               (WAVEFORMATEX *)&wf,
    221                                (DWORD)AudioOutputWinPrivate::waveOutProc,
    222                                (DWORD)this, CALLBACK_FUNCTION);
     221                               (DWORD_PTR)AudioOutputWinPrivate::waveOutProc,
     222                               (DWORD_PTR)this, CALLBACK_FUNCTION);
    223223
    224224    if (mmr == WAVERR_BADFORMAT)
    225225    {
  • mythtv/libs/libmythbase/compat.h

    diff --git a/mythtv/libs/libmythbase/compat.h b/mythtv/libs/libmythbase/compat.h
    index 425624a..6e97f73 100644
    a b inline int statfs(const char* path, struct statfs* buffer) 
    202202
    203203#ifdef USING_MINGW
    204204#define mkfifo(path, mode) \
    205     (int)CreateNamedPipeA(path, PIPE_ACCESS_DUPLEX | WRITE_DAC, \
     205    (intptr_t)CreateNamedPipeA(path, PIPE_ACCESS_DUPLEX | WRITE_DAC, \
    206206                          PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, \
    207207                          1024, 1024, 10000, NULL)
    208208#endif // USING_MINGW
  • mythtv/libs/libmythbluray/file/filesystem.h

    diff --git a/mythtv/libs/libmythbluray/file/filesystem.h b/mythtv/libs/libmythbluray/file/filesystem.h
    index c173f4c..b9c5ce8 100644
    a b struct bd_file_s 
    4040    int64_t (*seek)(BD_FILE_H *file, int64_t offset, int32_t origin);
    4141    int64_t (*tell)(BD_FILE_H *file);
    4242    int (*eof)(BD_FILE_H *file);
    43     int (*stat)(BD_FILE_H *file, struct stat *buf);
     43    #ifdef _WIN64
     44        int (*_stat64)(BD_FILE_H *file, struct stat *buf);//not sure if this is just my mingw32-w64 install or not
     45    #else
     46        int (*stat)(BD_FILE_H *file, struct stat *buf);
     47    #endif
    4448    int64_t (*read)(BD_FILE_H *file, uint8_t *buf, int64_t size);
    4549    int64_t (*write)(BD_FILE_H *file, const uint8_t *buf, int64_t size);
    4650};
  • mythtv/libs/libmythsoundtouch/FIFOSampleBuffer.cpp

    diff --git a/mythtv/libs/libmythsoundtouch/FIFOSampleBuffer.cpp b/mythtv/libs/libmythsoundtouch/FIFOSampleBuffer.cpp
    index f88b4f6..ad4573a 100644
    a b void FIFOSampleBuffer::ensureCapacity(uint capacityRequirement) 
    171171        {
    172172            throw std::runtime_error("Couldn't allocate memory!\n");
    173173        }
    174         temp = (SAMPLETYPE *)(((ulong)tempUnaligned + 15) & -16);
     174        temp = (SAMPLETYPE *)(((intptr_t)tempUnaligned + 15) & -16);
    175175        memcpy(temp, ptrBegin(), samplesInBuffer * channels * sizeof(SAMPLETYPE));
    176176        delete[] bufferUnaligned;
    177177        buffer = temp;
  • mythtv/libs/libmythsoundtouch/TDStretch.cpp

    diff --git a/mythtv/libs/libmythsoundtouch/TDStretch.cpp b/mythtv/libs/libmythsoundtouch/TDStretch.cpp
    index d00b057..9b55468 100644
    a b void TDStretch::acceptNewOverlapLength(uint newOverlapLength) 
    781781
    782782        pRefMidBufferUnaligned = new SAMPLETYPE[midBufferLength + 16 / sizeof(SAMPLETYPE)];
    783783        // ensure that 'pRefMidBuffer' is aligned to 16 byte boundary for efficiency
    784         pRefMidBuffer = (SAMPLETYPE *)((((ulong)pRefMidBufferUnaligned) + 15) & -16);
     784        pRefMidBuffer = (SAMPLETYPE *)((((intptr_t)pRefMidBufferUnaligned) + 15) & -16);
    785785    }
    786786}
    787787
  • mythtv/libs/libmythsoundtouch/cpu_detect_x86_gcc.cpp

    diff --git a/mythtv/libs/libmythsoundtouch/cpu_detect_x86_gcc.cpp b/mythtv/libs/libmythsoundtouch/cpu_detect_x86_gcc.cpp
    index ac5c284..de82b17 100644
    a b static int mm_support(void) 
    9595    int rval = 0;
    9696    int eax, ebx, ecx, edx;
    9797    int max_std_level, max_ext_level, std_caps=0, ext_caps=0;
    98     long a, c;
     98    intptr_t a, c;
    9999
    100100    __asm__ __volatile__ (
    101101                          /* See if CPUID instruction is supported ... */
  • mythtv/libs/libmythsoundtouch/sse_gcc.cpp

    diff --git a/mythtv/libs/libmythsoundtouch/sse_gcc.cpp b/mythtv/libs/libmythsoundtouch/sse_gcc.cpp
    index acbbcd9..2c8ff53 100644
    a b double TDStretchSSE3::calcCrossCorrMulti(const float *mPos, const float *cPos) c 
    1111{
    1212    double corr = 0;
    1313    int count = overlapLength * channels;
    14     int loops = count >> 4;
     14    #ifdef _WIN64
     15        intptr_t loops = count >> 4;
     16    #else
     17        int loops = count >> 4;
     18    #endif
    1519    int i = loops << 4;
    1620    const float *mp = mPos;
    1721    const float *cp = cPos;
    double TDStretchSSE2::calcCrossCorrMulti(const float *mPos, const float *cPos) c 
    5357{
    5458    double corr = 0;
    5559    int count = overlapLength * channels;
    56     int loops = count >> 4;
     60    #ifdef _WIN64
     61        intptr_t loops = count >> 4;
     62    #else
     63        int loops = count >> 4;
     64    #endif
    5765    int i = loops << 4;
    5866    const float *mp = mPos;
    5967    const float *cp = cPos;
    double TDStretchSSE3::calcCrossCorrStereo(const float *mPos, const float *cPos) 
    99107{
    100108    double corr = 0;
    101109    int count = overlapLength <<1;
    102     int loops = count >> 4;
     110    #ifdef _WIN64
     111        intptr_t loops = count >> 4;
     112    #else
     113        int loops = count >> 4;
     114    #endif
    103115    int i = loops << 4;
     116   
    104117    const float *mp = mPos;
    105118    const float *cp = cPos;
    106119
    double TDStretchSSE2::calcCrossCorrStereo(const float *mPos, const float *cPos) 
    141154{
    142155    double corr = 0;
    143156    int count = overlapLength <<1;
    144     int loops = count >> 4;
     157    #ifdef _WIN64
     158        intptr_t loops = count >> 4;
     159    #else
     160        int loops = count >> 4;
     161    #endif
    145162    int i = loops << 4;
    146163    const float *mp = mPos;
    147164    const float *cp = cPos;
    void TDStretchSSE2::overlapMulti(float *output, const float *input) const 
    220237            "sub        $1,     %%ecx       \n\t"
    221238            "jnz        1b                  \n\t"
    222239            :
    223             :"c"(overlapLength),"r"(i),"r"(m),"r"(o),"r"((long)channels)
     240            :"c"(overlapLength),"r"(i),"r"(m),"r"(o),"r"((intptr_t)channels)
    224241        );
    225242    else
    226243        __asm__ volatile (
    void TDStretchSSE2::overlapMulti(float *output, const float *input) const 
    258275            "sub        $1,     %%ecx       \n\t"
    259276            "jnz        1b                  \n\t"
    260277            :
    261             :"c"(overlapLength),"r"(i),"r"(m),"r"(o),"r"((long)channels)
     278            :"c"(overlapLength),"r"(i),"r"(m),"r"(o),"r"((intptr_t)channels)
    262279        );
    263280}
    264281
    void FIRFilterSSE2::setCoefficients(const float *coeffs, uint newLen, uint uRDF) 
    325342    // Ensure that filter coeffs array is aligned to 16-byte boundary
    326343    delete[] filterCoeffsUnalign;
    327344    filterCoeffsUnalign = new float[2 * newLen + 16];
    328     filterCoeffsAlign = (float *)(((ulong)filterCoeffsUnalign + 15) & -16);
     345    filterCoeffsAlign = (float *)(((uintptr_t)filterCoeffsUnalign + 15) & -16);
    329346
    330347    float fdiv = (float)resultDivider;
    331348
  • mythtv/libs/libmythtv/RTjpegN.cpp

    diff --git a/mythtv/libs/libmythtv/RTjpegN.cpp b/mythtv/libs/libmythtv/RTjpegN.cpp
    index 1a3d61c..df6afab 100644
    a b int RTjpeg::SetSize(int *w, int *h) 
    27272727
    27282728    if (key_rate > 0)
    27292729    {
    2730         unsigned long tmp;
     2730        uintptr_t tmp;
    27312731        if (old)
    27322732            delete [] old_start;
    27332733        old_start = new int16_t[((4*width*height)+32)];
    27342734
    2735         tmp = (unsigned long)old_start;
     2735        tmp = (uintptr_t)old_start;
    27362736        tmp += 32;
    27372737        tmp = tmp>>5;
    27382738
    int RTjpeg::SetSize(int *w, int *h) 
    27492749
    27502750int RTjpeg::SetIntra(int *key, int *lm, int *cm)
    27512751{
    2752     unsigned long tmp;
     2752    uintptr_t tmp;
    27532753
    27542754    if (*key < 0)
    27552755        *key = 0;
    int RTjpeg::SetIntra(int *key, int *lm, int *cm) 
    27772777    if (old)
    27782778        delete [] old_start;
    27792779    old_start = new int16_t[((4*width*height)+32)];
    2780     tmp = (unsigned long)old_start;
     2780    tmp = (uintptr_t)old_start;
    27812781    tmp += 32;
    27822782    tmp = tmp >> 5;
    27832783    old = (int16_t *)(tmp << 5);
  • mythtv/libs/libmythtv/nuppeldecoder.cpp

    diff --git a/mythtv/libs/libmythtv/nuppeldecoder.cpp b/mythtv/libs/libmythtv/nuppeldecoder.cpp
    index 33d8061..8aef8a1 100644
    a b NuppelDecoder::NuppelDecoder(MythPlayer *parent, 
    5656    memset(&extradata, 0, sizeof(extendeddata));
    5757    memset(&tmppicture, 0, sizeof(AVPicture));
    5858    planes[0] = planes[1] = planes[2] = 0;
    59     audioSamples = (short int*) (((long)audioSamples_buf + 15) & ~0xf);
     59    audioSamples = (short int*) (((intptr_t)audioSamples_buf + 15) & ~0xf);
    6060    memset(audioSamples, 0, AVCODEC_MAX_AUDIO_FRAME_SIZE * sizeof(short int));
    6161
    6262    // set parent class variables
    int NuppelDecoder::OpenFile(RingBuffer *rbuffer, bool novideo, 
    615615
    616616    buf = new unsigned char[video_size];
    617617    strm_buf = new unsigned char[video_size * 2 + 16];
    618     strm = (unsigned char*) (((long)strm_buf + 15) & ~0xf);
     618    strm = (unsigned char*) (((intptr_t)strm_buf + 15) & ~0xf);
    619619
    620620    if (hasFullPositionMap)
    621621        return 1;
  • mythtv/libs/libmythtv/signalmonitor.cpp

    diff --git a/mythtv/libs/libmythtv/signalmonitor.cpp b/mythtv/libs/libmythtv/signalmonitor.cpp
    index 9bfc339..29a8c4d 100644
    a b SignalMonitor *SignalMonitor::Init(QString cardtype, int db_cardnum, 
    167167    {
    168168        LOG(VB_GENERAL, LOG_ERR,
    169169            QString("Failed to create signal monitor in Init(%1, %2, 0x%3)")
    170                 .arg(cardtype).arg(db_cardnum).arg((long)channel,0,16));
     170                .arg(cardtype).arg(db_cardnum).arg((intptr_t)channel,0,16));
    171171    }
    172172
    173173    return signalMonitor;
  • mythtv/programs/mythfrontend/audiogeneralsettings.cpp

    diff --git a/mythtv/programs/mythfrontend/audiogeneralsettings.cpp b/mythtv/programs/mythfrontend/audiogeneralsettings.cpp
    index 7d40e09..c2d58a2 100644
    a b void AudioTestThread::run() 
    621621    if (m_audioOutput)
    622622    {
    623623        char *frames_in = new char[m_channels * 1024 * sizeof(int32_t) + 15];
    624         char *frames = (char *)(((long)frames_in + 15) & ~0xf);
     624        char *frames = (char *)(((intptr_t)frames_in + 15) & ~0xf);
    625625
    626626        m_audioOutput->Pause(false);
    627627