Ticket #1501: fix.patch

File fix.patch, 1.6 KB (added by crosewarne, 14 months ago)

Suggested fix for compilation issue under recent gcc

  • source/Lib/TLibCommon/ContextModel.h

    diff --git a/source/Lib/TLibCommon/ContextModel.h b/source/Lib/TLibCommon/ContextModel.h
    index 5b9d7629..1ed41c55 100644
    a b  
    5353// Class definition
    5454// ====================================================================================================================
    5555
     56#define GCC_9_1_0_WARNING_FIX 1
     57
    5658/// context model class
    5759class ContextModel
    5860{
    5961public:
     62#if !GCC_9_1_0_WARNING_FIX
    6063  ContextModel  ()                        { m_ucState = 0; m_binsCoded = 0; }
    6164  ~ContextModel ()                        {}
     65#endif
    6266
    6367  UChar getState  ()                { return ( m_ucState >> 1 ); }                    ///< get current state
    6468  UChar getMps    ()                { return ( m_ucState  & 1 ); }                    ///< get curret MPS
    public: 
    9094  UInt getBinsCoded()           { return m_binsCoded;   }
    9195
    9296private:
     97#if GCC_9_1_0_WARNING_FIX
     98  UChar         m_ucState = 0;                                                              ///< internal state variable
     99#else
    93100  UChar         m_ucState;                                                                  ///< internal state variable
     101#endif
    94102
    95103  static const  UInt  m_totalStates = (1 << CONTEXT_STATE_BITS) * 2; //*2 for MPS = [0|1]
    96104  static const  UChar m_aucNextStateMPS[m_totalStates];
    private: 
    99107#if FAST_BIT_EST
    100108  static UChar m_nextState[m_totalStates][2 /*MPS = [0|1]*/];
    101109#endif
     110#if GCC_9_1_0_WARNING_FIX
     111  UInt          m_binsCoded = 0;
     112#else
    102113  UInt          m_binsCoded;
     114#endif
    103115};
    104116
    105117//! \}