Add the fixup method to be used as a second pass for the analysis phase.

--- include/orange/AST.h
+++ include/orange/AST.h
@@ -50,6 +50,11 @@
 	bool m_resolved = false;

 	/**
+	 * Indicates whether or not this object has been fixed up in the analysis pas.
+	 */
+	bool m_fixed_up = false;
+
+	/**
 	 * The internal value returned by Codegen() and getValue().
 	 */
 	Value *m_value = nullptr;
@@ -182,7 +187,26 @@
 		if (m_resolved)
 			return;
 		m_resolved = true;
-	};
+
+		for (auto kvp : m_children) {
+			kvp.second->resolve();
+		}
+	}
+
+	/**
+	 * Fixes up the type of this object, intended for use during the analysis pass. Objects
+	 * can look at the types of siblings and static attributes of parents to further
+	 * determine their types.
+	 */
+	virtual void fixup() {
+		if (m_fixed_up)
+			return;
+		m_fixed_up = true;
+
+		for (auto kvp : m_children) {
+			kvp.second->fixup();
+		}
+	}

 	virtual ~ASTNode() { };
 };


Added missing return codes to psa_aead_decrypt

--- include/psa/crypto.h
+++ include/psa/crypto.h
@@ -2113,9 +2113,12 @@
  * \retval #PSA_ERROR_NOT_SUPPORTED
  *         \p alg is not supported or is not an AEAD algorithm.
  * \retval #PSA_ERROR_INSUFFICIENT_MEMORY
- * \retval #PSA_ERROR_COMMUNICATION_FAILURE
- * \retval #PSA_ERROR_HARDWARE_FAILURE
- * \retval #PSA_ERROR_CORRUPTION_DETECTED
+ * \retval #PSA_ERROR_BUFFER_TOO_SMALL
+ *         \p plaintext_size or \p nonce_length is too small
+ * \retval #PSA_ERROR_COMMUNICATION_FAILURE
+ * \retval #PSA_ERROR_HARDWARE_FAILURE
+ * \retval #PSA_ERROR_CORRUPTION_DETECTED
+ * \retval #PSA_ERROR_STORAGE_FAILURE
  * \retval #PSA_ERROR_BAD_STATE
  *         The library has not been previously initialized by psa_crypto_init().
  *         It is implementation-dependent whether a failure to initialize


- updated to be VC++-friendly

- updated to be VC++-friendly

--- fixed_eytzinger_map/include/fixed_eytzinger_map.h
+++ fixed_eytzinger_map/include/fixed_eytzinger_map.h
@@ -20,30 +20,8 @@
 #include <utility>
 #include <functional>

-class __fixed_eytzinger_map_base
-{
-public:
-    // gratefully taken from llvm's libc++:
-    template <class _Tp1, class _Tp2 = void>
-    struct __is_transparent
-    {
-    private:
-        struct __two {char __lx; char __lxx;};
-        template <class _Up> static __two __test(...);
-        template <class _Up> static char __test(typename _Up::is_transparent* = 0);
-    public:
-        static const bool value = sizeof(__test<_Tp1>(0)) == 1;
-    };
-
-    [[noreturn]] inline void __throw_at() const
-    { throw std::out_of_range("fixed_eytzinger_map::at:  key not found"); }
-    [[noreturn]] inline void __throw_sb() const
-    { throw std::out_of_range("fixed_eytzinger_map::operator[]:  key not found"); }
-
-};
-
 template <typename _Key, typename _Value, class _Compare = std::less<_Key> >
-class fixed_eytzinger_map : private _Compare, __fixed_eytzinger_map_base
+class fixed_eytzinger_map : private _Compare
 {
     struct pair_ptr_wrap;
     struct const_pair_ptr_wrap;
@@ -84,20 +62,20 @@

     // Element access
     mapped_type& at( const key_type& key );
-    template <typename _K2> typename std::enable_if<__is_transparent<_Compare, _K2>::value,
-    mapped_type&>::type at( const _K2& key );
+    template <typename _K2, typename _C = _Compare, typename = typename _C::is_transparent>
+    mapped_type& at( const _K2& key );

     const mapped_type& at( const key_type& key ) const;
-    template <typename _K2> typename std::enable_if<__is_transparent<_Compare, _K2>::value,
-    const mapped_type&>::type at( const _K2& key ) const;
+    template <typename _K2, typename _C = _Compare, typename = typename _C::is_transparent>
+    const mapped_type& at( const _K2& key ) const;

     mapped_type& operator[]( const key_type& key );
-    template <typename _K2> typename std::enable_if<__is_transparent<_Compare, _K2>::value,
-    mapped_type&>::type operator[]( const _K2& key );
+    template <typename _K2, typename _C = _Compare, typename = typename _C::is_transparent>
+    mapped_type& operator[]( const _K2& key );

     const mapped_type& operator[]( const key_type& key ) const;
-    template <typename _K2> typename std::enable_if<__is_transparent<_Compare, _K2>::value,
-    const mapped_type&>::type operator[]( const _K2& key ) const;
+    template <typename _K2, typename _C = _Compare, typename = typename _C::is_transparent>
+    const mapped_type& operator[]( const _K2& key ) const;

     // Iterators
@@ -122,40 +100,40 @@

     // Lookup
     size_type count( const key_type& key ) const noexcept;
-    template <typename _K2> typename std::enable_if<__is_transparent<_Compare, _K2>::value,
-    size_type>::type count( const _K2& key ) const noexcept;
+    template <typename _K2, typename _C = _Compare, typename = typename _C::is_transparent>
+    size_type count( const _K2& key ) const noexcept;

     iterator find( const key_type& key ) noexcept;
-    template <typename _K2> typename std::enable_if<__is_transparent<_Compare, _K2>::value,
-    iterator>::type find(const _K2& key) noexcept;
+    template <typename _K2, typename _C = _Compare, typename = typename _C::is_transparent>
+    iterator find(const _K2& key) noexcept;

     const_iterator find( const key_type& key ) const noexcept;
-    template <typename _K2> typename std::enable_if<__is_transparent<_Compare, _K2>::value,
-    const_iterator>::type find(const _K2& key) const noexcept;
+    template <typename _K2, typename _C = _Compare, typename = typename _C::is_transparent>
+    const_iterator find(const _K2& key) const noexcept;

     range_pair equal_range( const key_type& key ) noexcept;
-    template <typename _K2> typename std::enable_if<__is_transparent<_Compare, _K2>::value,
-    range_pair>::type equal_range(const _K2& key) noexcept;
+    template <typename _K2, typename _C = _Compare, typename = typename _C::is_transparent>
+    range_pair equal_range(const _K2& key) noexcept;

     const_range_pair equal_range( const key_type& key ) const noexcept;
-    template <typename _K2> typename std::enable_if<__is_transparent<_Compare, _K2>::value,
-    const_range_pair>::type equal_range(const _K2& key) const noexcept;
+    template <typename _K2, typename _C = _Compare, typename = typename _C::is_transparent>
+    const_range_pair equal_range(const _K2& key) const noexcept;

     iterator lower_bound( const key_type& key ) noexcept;
-    template <typename _K2> typename std::enable_if<__is_transparent<_Compare, _K2>::value,
-    iterator>::type lower_bound(const _K2& key) noexcept;
+    template <typename _K2, typename _C = _Compare, typename = typename _C::is_transparent>
+    iterator lower_bound(const _K2& key) noexcept;

     const_iterator lower_bound( const key_type& key ) const noexcept;
-    template <typename _K2> typename std::enable_if<__is_transparent<_Compare, _K2>::value,
-    const_iterator>::type lower_bound(const _K2& key) const noexcept;
+    template <typename _K2, typename _C = _Compare, typename = typename _C::is_transparent>
+    const_iterator lower_bound(const _K2& key) const noexcept;

     iterator upper_bound( const key_type& key ) noexcept;
-    template <typename _K2> typename std::enable_if<__is_transparent<_Compare, _K2>::value,
-    iterator>::type upper_bound(const _K2& key) noexcept;
+    template <typename _K2, typename _C = _Compare, typename = typename _C::is_transparent>
+    iterator upper_bound(const _K2& key) noexcept;

     const_iterator upper_bound( const key_type& key ) const noexcept;
-    template <typename _K2> typename std::enable_if<__is_transparent<_Compare, _K2>::value,
-    const_iterator>::type upper_bound(const _K2& key) const noexcept;
+    template <typename _K2, typename _C = _Compare, typename = typename _C::is_transparent>
+    const_iterator upper_bound(const _K2& key) const noexcept;

     // Assignment
@@ -167,21 +145,201 @@
     void assign( std::initializer_list<value_type> l );

 private:
-    void __alloc_init( size_t _count );
-    void __deallocate() noexcept;
-    void __construct_at( size_t _p, _Key &&_k, _Value &&_v ) noexcept;
-    void __destroy_at( size_t _p ) noexcept;
-    void __destroy_all() noexcept;
-    bool __comp(const _Key& _v1, const _Key &_v2) const noexcept;
-    bool __equal(const _Key& _v1, const _Key &_v2) const noexcept;
+    void alloc_init( size_t _count );
+    value_type *init_fill( size_t _base, value_type *_first);
+    void deallocate() noexcept;
+    void construct_at( size_t _p, _Key &&_k, _Value &&_v ) noexcept;
+    void destroy_at( size_t _p ) noexcept;
+    void destroy_all() noexcept;
+    bool comp(const _Key& _v1, const _Key &_v2) const noexcept;
+    bool equal(const _Key& _v1, const _Key &_v2) const noexcept;
     template <class _K1, class _K2>
-    bool __comp2(const _K1& _v1, const _K2 &_v2) const noexcept;
+    bool comp2(const _K1& _v1, const _K2 &_v2) const noexcept;
     template <class _K1, class _K2>
-    bool __equal2(const _K1& _v1, const _K2 &_v2) const noexcept;
-    value_type *__init_fill( size_t _base, value_type *_first);
+    bool equal2(const _K1& _v1, const _K2 &_v2) const noexcept;
+
+    [[noreturn]] void throw_at() const
+    { throw std::out_of_range("fixed_eytzinger_map::at:  key not found"); }
+    [[noreturn]] void throw_sb() const
+    { throw std::out_of_range("fixed_eytzinger_map::operator[]:  key not found"); }
+
     size_type    __m_count;
     key_type    *__m_keys;
     mapped_type *__m_values;
+};
+
+template <typename _Key, typename _Value, typename _Compare>
+struct fixed_eytzinger_map<_Key, _Value, _Compare>::proxy_iterator
+{
+	typedef std::bidirectional_iterator_tag         iterator_category;
+	typedef ptrdiff_t                               difference_type;
+	typedef std::pair<_Key, _Value>                 value_type;
+	typedef pair_ptr_wrap                           pointer;
+	typedef std::pair<const _Key&, _Value&>         reference;
+
+	proxy_iterator() noexcept : k(nullptr), v(nullptr)
+	{ }
+	proxy_iterator(const _Key *_k, _Value *_v) noexcept : k(_k), v(_v)
+	{ }
+	reference operator *() const noexcept
+	{
+		return reference{ *k, *v };
+	}
+	pointer operator->() const noexcept
+	{
+		return pointer{ k, v };
+	}
+	reference operator[](difference_type _n) const noexcept
+	{
+		return *(*this + _n);
+	}
+	proxy_iterator &operator++() noexcept
+	{
+		++k; ++v; return *this;
+	}
+	proxy_iterator operator++(int) noexcept
+	{
+		proxy_iterator __tmp = *this; ++(*this); return __tmp;
+	}
+	proxy_iterator &operator--() noexcept
+	{
+		--k; --v; return *this;
+	}
+	proxy_iterator operator--(int) noexcept
+	{
+		proxy_iterator __tmp = *this; --(*this); return __tmp;
+	}
+	proxy_iterator &operator+=(difference_type _d) noexcept
+	{
+		k += _d; v += _d; return *this;
+	}
+	proxy_iterator &operator-=(difference_type _d) noexcept
+	{
+		k -= _d; v -= _d; return *this;
+	}
+	proxy_iterator operator -(difference_type _d) noexcept
+	{
+		proxy_iterator __tmp = *this; return __tmp -= _d;
+	}
+	difference_type operator-(const proxy_iterator &_rhs) const noexcept
+	{
+		return k - _rhs.k;
+	}
+	bool operator ==(const proxy_iterator &_rhs) const noexcept
+	{
+		return k == _rhs.k;
+	}
+	bool operator !=(const proxy_iterator &_rhs) const noexcept
+	{
+		return k != _rhs.k;
+	}
+	bool operator  <(const proxy_iterator &_rhs) const noexcept
+	{
+		return k < _rhs.k;
+	}
+	bool operator  >(const proxy_iterator &_rhs) const noexcept
+	{
+		return k > _rhs.k;
+	}
+	bool operator <=(const proxy_iterator &_rhs) const noexcept
+	{
+		return k <= _rhs.k;
+	}
+	bool operator >=(const proxy_iterator &_rhs) const noexcept
+	{
+		return k >= _rhs.k;
+	}
+private:
+	const _Key *k;
+	_Value *v;
+	friend class fixed_eytzinger_map;
+};
+
+template <typename _Key, typename _Value, typename _Compare>
+struct fixed_eytzinger_map<_Key, _Value, _Compare>::const_proxy_iterator
+{
+	typedef std::bidirectional_iterator_tag         iterator_category;
+	typedef ptrdiff_t                               difference_type;
+	typedef std::pair<_Key, _Value>                 value_type;
+	typedef const_pair_ptr_wrap                     pointer;
+	typedef std::pair<const _Key&, const _Value&>   reference;
+
+	const_proxy_iterator() noexcept : k(nullptr), v(nullptr)
+	{ }
+	const_proxy_iterator(const _Key *_k, const _Value *_v) noexcept : k(_k), v(_v)
+	{ }
+	reference operator *() const noexcept
+	{
+		return reference{ *k, *v };
+	}
+	pointer operator->() const noexcept
+	{
+		return pointer{ k, v };
+	}
+	reference operator[](difference_type _n) const noexcept
+	{
+		return *(*this + _n);
+	}
+	const_proxy_iterator &operator++() noexcept
+	{
+		++k; ++v; return *this;
+	}
+	const_proxy_iterator operator++(int) noexcept
+	{
+		proxy_iterator __tmp = *this; ++(*this); return __tmp;
+	}
+	const_proxy_iterator &operator--() noexcept
+	{
+		--k; --v; return *this;
+	}
+	const_proxy_iterator operator--(int) noexcept
+	{
+		proxy_iterator __tmp = *this; --(*this); return __tmp;
+	}
+	const_proxy_iterator &operator+=(difference_type _d) noexcept
+	{
+		k += _d; v += _d; return *this;
+	}
+	const_proxy_iterator &operator-=(difference_type _d) noexcept
+	{
+		k -= _d; v -= _d; return *this;
+	}
+	const_proxy_iterator operator -(difference_type _d) noexcept
+	{
+		proxy_iterator __tmp = *this; return __tmp -= _d;
+	}
+	difference_type operator-(const const_proxy_iterator &_rhs) const noexcept
+	{
+		return k - _rhs.k;
+	}
+	bool operator ==(const const_proxy_iterator &_rhs) const noexcept
+	{
+		return k == _rhs.k;
+	}
+	bool operator !=(const const_proxy_iterator &_rhs) const noexcept
+	{
+		return k != _rhs.k;
+	}
+	bool operator  <(const const_proxy_iterator &_rhs) const noexcept
+	{
+		return k < _rhs.k;
+	}
+	bool operator  >(const const_proxy_iterator &_rhs) const noexcept
+	{
+		return k > _rhs.k;
+	}
+	bool operator <=(const const_proxy_iterator &_rhs) const noexcept
+	{
+		return k <= _rhs.k;
+	}
+	bool operator >=(const const_proxy_iterator &_rhs) const noexcept
+	{
+		return k >= _rhs.k;
+	}
+private:
+	const _Key *k;
+	const _Value *v;
+	friend class fixed_eytzinger_map;
 };

 template <typename _Key, typename _Value, typename _Compare>
@@ -216,7 +374,7 @@
 fixed_eytzinger_map<_Key, _Value, _Compare>::
 fixed_eytzinger_map( const fixed_eytzinger_map& _other )
 {
-    __alloc_init( _other.__m_count );
+    alloc_init( _other.__m_count );

     _Key *last_key = __m_keys;
     _Value *last_value = __m_values;
@@ -231,7 +389,7 @@
             it->~_Key();
         for( _Value *it = __m_values; it < last_value; ++it )
             it->~_Value();
-        __deallocate();
+		deallocate();
         std::rethrow_exception( std::current_exception() );
     }
 }
@@ -247,14 +405,14 @@
 {
     std::vector<value_type> t{ std::begin(_l), std::end(_l) };
     std::sort(t.begin(), t.end(), [this](const value_type &_v1, const value_type &_v2) {
-        return  __comp(_v1.first, _v2.first);
+        return comp(_v1.first, _v2.first);
     });
     t.erase( std::unique( t.begin(), t.end(), [this](const value_type &_v1, const value_type &_v2){
-        return __equal(_v1.first, _v2.first);
+        return equal(_v1.first, _v2.first);
     }), t.end());

-    __alloc_init( t.size() );
-    __init_fill( 0, t.data() );
+    alloc_init( t.size() );
+    init_fill( 0, t.data() );
 }

 template <typename _Key, typename _Value, typename _Compare>
@@ -273,26 +431,26 @@
                     "incompatible iterator type");
     std::vector<value_type> t{ _begin, _end };
     std::sort(std::begin(t), std::end(t), [this](const value_type &_v1, const value_type &_v2) {
-        return __comp(_v1.first, _v2.first);
+        return comp(_v1.first, _v2.first);
     });
     t.erase( std::unique( t.begin(), t.end(), [this](const value_type &_v1, const value_type &_v2){
-        return __equal(_v1.first, _v2.first);
+        return equal(_v1.first, _v2.first);
     }), t.end());

-    __alloc_init( t.size() );
-    __init_fill( 0, t.data() );
+    alloc_init( t.size() );
+    init_fill( 0, t.data() );
 }

 template <typename _Key, typename _Value, typename _Compare>
 fixed_eytzinger_map<_Key, _Value, _Compare>::
 ~fixed_eytzinger_map()
 {
-    __destroy_all();
-    __deallocate();
-}
-
-template <typename _Key, typename _Value, typename _Compare>
-void fixed_eytzinger_map<_Key, _Value, _Compare>::__deallocate() noexcept
+    destroy_all();
+	deallocate();
+}
+
+template <typename _Key, typename _Value, typename _Compare>
+void fixed_eytzinger_map<_Key, _Value, _Compare>::deallocate() noexcept
 {
     if( __m_keys ) {
         ::operator delete( __m_keys );
@@ -306,14 +464,14 @@
 }

 template <typename _Key, typename _Value, typename _Compare>
-void fixed_eytzinger_map<_Key, _Value, _Compare>::__destroy_at( size_t _p ) noexcept
+void fixed_eytzinger_map<_Key, _Value, _Compare>::destroy_at( size_t _p ) noexcept
 {
     (__m_keys+_p)->~_Key();
     (__m_values+_p)->~_Value();
 }

 template <typename _Key, typename _Value, typename _Compare>
-void fixed_eytzinger_map<_Key, _Value, _Compare>::__destroy_all() noexcept
+void fixed_eytzinger_map<_Key, _Value, _Compare>::destroy_all() noexcept
 {
     for( _Key *_first = __m_keys, *_last = __m_keys + __m_count; _first != _last; _first++ )
         _first->~_Key();
@@ -322,21 +480,21 @@
 }

 template <typename _Key, typename _Value, typename _Compare>
-void fixed_eytzinger_map<_Key, _Value, _Compare>::__alloc_init( size_t _count )
+void fixed_eytzinger_map<_Key, _Value, _Compare>::alloc_init( size_t _count )
 {
     __m_count = _count;
     try {
         __m_keys = static_cast<_Key*>( ::operator new(_count * sizeof(_Key)) );
         __m_values = static_cast<_Value*>( ::operator new(_count * sizeof(_Value)) );
     } catch( ... ) {
-       __deallocate();
+		deallocate();
         std::rethrow_exception( std::current_exception() );
     }
 }

 template <typename _Key, typename _Value, typename _Compare>
 void fixed_eytzinger_map<_Key, _Value, _Compare>::
-__construct_at( size_t _p, _Key &&_k, _Value &&_v ) noexcept
+construct_at( size_t _p, _Key &&_k, _Value &&_v ) noexcept
 {
     ::new((void*)(__m_keys+_p)) _Key( std::move(_k) );
     ::new((void*)(__m_values+_p)) _Value( std::move(_v) );
@@ -345,17 +503,17 @@
 template <typename _Key, typename _Value, typename _Compare>
 typename fixed_eytzinger_map<_Key, _Value, _Compare>::value_type *
 fixed_eytzinger_map<_Key, _Value, _Compare>::
-__init_fill( size_t _base, value_type *_first )
+init_fill( size_t _base, value_type *_first )
 {
     if( _base >= __m_count )
         return _first;

-	_first = __init_fill( 2 * _base + 1, _first ); // left branch
-
-    __construct_at( _base, std::move(_first->first), std::move(_first->second) ); // leaf
+	_first = init_fill( 2 * _base + 1, _first ); // left branch
+
+    construct_at( _base, std::move(_first->first), std::move(_first->second) ); // leaf
     ++_first;

-	_first = __init_fill( 2 * _base + 2, _first ); // right branch
+	_first = init_fill( 2 * _base + 2, _first ); // right branch

 	return _first;
 }
@@ -364,8 +522,8 @@
 void fixed_eytzinger_map<_Key, _Value, _Compare>::
 clear() noexcept
 {
-    __destroy_all();
-    __deallocate();
+    destroy_all();
+	deallocate();
 }

 template <typename _Key, typename _Value, typename _Compare>
@@ -380,21 +538,21 @@

 template <typename _Key, typename _Value, typename _Compare>
 bool fixed_eytzinger_map<_Key, _Value, _Compare>::
-__comp(const _Key& _v1, const _Key &_v2) const noexcept
+comp(const _Key& _v1, const _Key &_v2) const noexcept
 {
     return _Compare::operator()(_v1, _v2);
 }
 template <typename _Key, typename _Value, typename _Compare>
 bool fixed_eytzinger_map<_Key, _Value, _Compare>::
-__equal(const _Key& _v1, const _Key &_v2) const noexcept
-{
-    return !__comp(_v1, _v2) && !__comp(_v2, _v1);
+equal(const _Key& _v1, const _Key &_v2) const noexcept
+{
+    return !comp(_v1, _v2) && !comp(_v2, _v1);
 }

 template <typename _Key, typename _Value, typename _Compare>
 template <class _K1, class _K2>
 bool fixed_eytzinger_map<_Key, _Value, _Compare>::
-__comp2(const _K1& _v1, const _K2 &_v2) const noexcept
+comp2(const _K1& _v1, const _K2 &_v2) const noexcept
 {
     return _Compare::operator()(_v1, _v2);
 }
@@ -402,7 +560,7 @@
 template <typename _Key, typename _Value, typename _Compare>
 template <class _K1, class _K2>
 bool fixed_eytzinger_map<_Key, _Value, _Compare>::
-__equal2(const _K1& _v1, const _K2 &_v2) const noexcept
+equal2(const _K1& _v1, const _K2 &_v2) const noexcept
 {
     return !_Compare::operator()(_v1, _v2) && !_Compare::operator()(_v2, _v1);
 }
@@ -475,7 +633,7 @@
 {
     size_type i = __m_count, j = 0;
     while( j < __m_count ) {
-        if( __comp(__m_keys[j], _key) ){
+        if( comp(__m_keys[j], _key) ){
             j = 2 * j + 2; // right branch
         }
         else {
@@ -487,16 +645,13 @@
 }

 template <typename _Key, typename _Value, typename _Compare>
-template <typename _K2>
-typename std::enable_if<
-    __fixed_eytzinger_map_base::__is_transparent<_Compare, _K2>::value,
-    typename fixed_eytzinger_map<_Key, _Value, _Compare>::const_iterator
->::type
+template <typename _K2, typename _C, typename>
+typename fixed_eytzinger_map<_Key, _Value, _Compare>::const_iterator
 fixed_eytzinger_map<_Key, _Value, _Compare>::lower_bound(const _K2& _key) const noexcept
 {
     size_type i = __m_count, j = 0;
     while( j < __m_count ) {
-        if( __comp2(__m_keys[j], _key) ){
+        if( comp2(__m_keys[j], _key) ){
             j = 2 * j + 2; // right branch
         }
         else {
@@ -513,7 +668,7 @@
 {
     size_type i = __m_count, j = 0;
     while( j < __m_count ) {
-        if( __comp(__m_keys[j], _key) ){
+        if( comp(__m_keys[j], _key) ){
             j = 2 * j + 2; // right branch
         }
         else {
@@ -525,16 +680,13 @@
 }

 template <typename _Key, typename _Value, typename _Compare>
-template <typename _K2>
-typename std::enable_if<
-    __fixed_eytzinger_map_base::__is_transparent<_Compare, _K2>::value,
-    typename fixed_eytzinger_map<_Key, _Value, _Compare>::iterator
->::type
+template <typename _K2, typename _C, typename>
+typename fixed_eytzinger_map<_Key, _Value, _Compare>::iterator
 fixed_eytzinger_map<_Key, _Value, _Compare>::lower_bound(const _K2& _key) noexcept
 {
     size_type i = __m_count, j = 0;
     while( j < __m_count ) {
-        if( __comp2(__m_keys[j], _key) ){
+        if( comp2(__m_keys[j], _key) ){
             j = 2 * j + 2; // right branch
         }
         else {
@@ -551,7 +703,7 @@
 {
     size_type i = __m_count, j = 0;
     while( j < __m_count ) {
-        if( __comp(_key, __m_keys[j]) ){
+        if( comp(_key, __m_keys[j]) ){
             i = j;
             j = 2 * j + 1; // left branch
         }
@@ -563,16 +715,13 @@
 }

 template <typename _Key, typename _Value, typename _Compare>
-template <typename _K2>
-typename std::enable_if<
-    __fixed_eytzinger_map_base::__is_transparent<_Compare, _K2>::value,
-    typename fixed_eytzinger_map<_Key, _Value, _Compare>::iterator
->::type
+template <typename _K2, typename _C, typename>
+typename fixed_eytzinger_map<_Key, _Value, _Compare>::iterator
 fixed_eytzinger_map<_Key, _Value, _Compare>::upper_bound( const _K2& _key ) noexcept
 {
     size_type i = __m_count, j = 0;
     while( j < __m_count ) {
-        if( __comp2(_key, __m_keys[j]) ){
+        if( comp2(_key, __m_keys[j]) ){
             i = j;
             j = 2 * j + 1; // left branch
         }
@@ -589,7 +738,7 @@
 {
     size_type i = __m_count, j = 0;
     while( j < __m_count ) {
-        if( __comp(_key, __m_keys[j]) ){
+        if( comp(_key, __m_keys[j]) ){
             i = j;
             j = 2 * j + 1; // left branch
         }
@@ -601,16 +750,13 @@
 }

 template <typename _Key, typename _Value, typename _Compare>
-template <typename _K2>
-typename std::enable_if<
-    __fixed_eytzinger_map_base::__is_transparent<_Compare, _K2>::value,
-    typename fixed_eytzinger_map<_Key, _Value, _Compare>::const_iterator
->::type
+template <typename _K2, typename _C, typename>
+typename fixed_eytzinger_map<_Key, _Value, _Compare>::const_iterator
 fixed_eytzinger_map<_Key, _Value, _Compare>::upper_bound( const _K2& _key ) const noexcept
 {
     size_type i = __m_count, j = 0;
     while( j < __m_count ) {
-        if( __comp2(_key, __m_keys[j]) ){
+        if( comp2(_key, __m_keys[j]) ){
             i = j;
             j = 2 * j + 1; // left branch
         }
@@ -626,21 +772,18 @@
 fixed_eytzinger_map<_Key, _Value, _Compare>::find( const _Key& _key ) const noexcept
 {
     const_iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp(_key, *__p.k) )
+    if( __p != end() && !comp(_key, *__p.k) )
         return __p;
     return end();
 }

 template <typename _Key, typename _Value, typename _Compare>
-template <typename _K2>
-typename std::enable_if<
-    __fixed_eytzinger_map_base::__is_transparent<_Compare, _K2>::value,
-    typename fixed_eytzinger_map<_Key, _Value, _Compare>::const_iterator
->::type
+template <typename _K2, typename _C, typename>
+typename fixed_eytzinger_map<_Key, _Value, _Compare>::const_iterator
 fixed_eytzinger_map<_Key, _Value, _Compare>::find( const _K2& _key ) const noexcept
 {
     const_iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp2(_key, *__p.k) )
+    if( __p != end() && !comp2(_key, *__p.k) )
         return __p;
     return end();
 }
@@ -650,71 +793,60 @@
 fixed_eytzinger_map<_Key, _Value, _Compare>::find( const _Key& _key ) noexcept
 {
     iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp(_key, *__p.k) )
+    if( __p != end() && !comp(_key, *__p.k) )
         return __p;
     return end();
 }

 template <typename _Key, typename _Value, typename _Compare>
-template <typename _K2>
-typename std::enable_if<
-    __fixed_eytzinger_map_base::__is_transparent<_Compare, _K2>::value,
-    typename fixed_eytzinger_map<_Key, _Value, _Compare>::iterator
->::type
+template <typename _K2, typename _C, typename>
+typename fixed_eytzinger_map<_Key, _Value, _Compare>::iterator
 fixed_eytzinger_map<_Key, _Value, _Compare>::find( const _K2& _key ) noexcept
 {
     iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp2(_key, *__p.k) )
+    if( __p != end() && !comp2(_key, *__p.k) )
         return __p;
     return end();
 }

 template <typename _Key, typename _Value, typename _Compare>
-std::pair<typename fixed_eytzinger_map<_Key, _Value, _Compare>::iterator,
-          typename fixed_eytzinger_map<_Key, _Value, _Compare>::iterator>
+typename fixed_eytzinger_map<_Key, _Value, _Compare>::range_pair
 fixed_eytzinger_map<_Key, _Value, _Compare>::equal_range( const _Key& _key ) noexcept
 {
     iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp(_key, *__p.k) )
+    if( __p != end() && !comp(_key, *__p.k) )
         return {__p, std::next(__p, 1)};
     return {end(), end()};
 }

 template <typename _Key, typename _Value, typename _Compare>
-template <typename _K2>
-typename std::enable_if<
-    __fixed_eytzinger_map_base::__is_transparent<_Compare, _K2>::value,
-    typename fixed_eytzinger_map<_Key, _Value, _Compare>::range_pair
->::type
+template <typename _K2, typename _C, typename>
+typename fixed_eytzinger_map<_Key, _Value, _Compare>::range_pair
 fixed_eytzinger_map<_Key, _Value, _Compare>::equal_range( const _K2& _key ) noexcept
 {
     iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp2(_key, *__p.k) )
+    if( __p != end() && !comp2(_key, *__p.k) )
         return {__p, std::next(__p, 1)};
     return {end(), end()};
 }

 template <typename _Key, typename _Value, typename _Compare>
-std::pair<typename fixed_eytzinger_map<_Key, _Value, _Compare>::const_iterator,
-          typename fixed_eytzinger_map<_Key, _Value, _Compare>::const_iterator>
+typename fixed_eytzinger_map<_Key, _Value, _Compare>::const_range_pair
 fixed_eytzinger_map<_Key, _Value, _Compare>::equal_range( const _Key& _key ) const noexcept
 {
     const_iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp(_key, *__p.k) )
+    if( __p != end() && !comp(_key, *__p.k) )
         return {__p, std::next(__p, 1)};
     return {end(), end()};
 }

 template <typename _Key, typename _Value, typename _Compare>
-template <typename _K2>
-typename std::enable_if<
-    __fixed_eytzinger_map_base::__is_transparent<_Compare, _K2>::value,
-    typename fixed_eytzinger_map<_Key, _Value, _Compare>::const_range_pair
->::type
+template <typename _K2, typename _C, typename>
+typename fixed_eytzinger_map<_Key, _Value, _Compare>::const_range_pair
 fixed_eytzinger_map<_Key, _Value, _Compare>::equal_range( const _K2& _key ) const noexcept
 {
     const_iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp2(_key, *__p.k) )
+    if( __p != end() && !comp2(_key, *__p.k) )
         return {__p, std::next(__p, 1)};
     return {end(), end()};
 }
@@ -724,20 +856,18 @@
 fixed_eytzinger_map<_Key, _Value, _Compare>::count( const key_type& _key ) const noexcept
 {
     const_iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp(_key, *__p.k) )
+    if( __p != end() && !comp(_key, *__p.k) )
         return 1;
     return 0;
 }

 template <typename _Key, typename _Value, typename _Compare>
-template <typename _K2>
-typename std::enable_if<
-    __fixed_eytzinger_map_base::__is_transparent<_Compare, _K2>::value,
-    typename fixed_eytzinger_map<_Key, _Value, _Compare>::size_type
->::type fixed_eytzinger_map<_Key, _Value, _Compare>::count( const _K2& _key ) const noexcept
+template <typename _K2, typename _C, typename>
+typename fixed_eytzinger_map<_Key, _Value, _Compare>::size_type
+fixed_eytzinger_map<_Key, _Value, _Compare>::count( const _K2& _key ) const noexcept
 {
     const_iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp2(_key, *__p.k) )
+    if( __p != end() && !comp2(_key, *__p.k) )
         return 1;
     return 0;
 }
@@ -747,22 +877,19 @@
 at( const key_type &_key )
 {
     iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp(_key, *__p.k) )
+    if( __p != end() && !comp(_key, *__p.k) )
         return *__p.v;
-    __throw_at();
-}
-
-template <typename _Key, typename _Value, typename _Compare>
-template <typename _K2>
-typename std::enable_if<
-    __fixed_eytzinger_map_base::__is_transparent<_Compare, _K2>::value,
-    _Value&>
-::type fixed_eytzinger_map<_Key, _Value, _Compare>::at( const _K2 &_key )
+    throw_at();
+}
+
+template <typename _Key, typename _Value, typename _Compare>
+template <typename _K2, typename _C, typename>
+_Value& fixed_eytzinger_map<_Key, _Value, _Compare>::at( const _K2 &_key )
 {
     iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp2(_key, *__p.k) )
+    if( __p != end() && !comp2(_key, *__p.k) )
         return *__p.v;
-    __throw_at();
+    throw_at();
 }

 template <typename _Key, typename _Value, typename _Compare>
@@ -770,22 +897,19 @@
 at( const key_type &_key ) const
 {
     const_iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp(_key, *__p.k) )
+    if( __p != end() && !comp(_key, *__p.k) )
         return *__p.v;
-    __throw_at();
-}
-
-template <typename _Key, typename _Value, typename _Compare>
-template <typename _K2>
-typename std::enable_if<
-    __fixed_eytzinger_map_base::__is_transparent<_Compare, _K2>::value,
-    const _Value&>
-::type fixed_eytzinger_map<_Key, _Value, _Compare>::at( const _K2 &_key ) const
+    throw_at();
+}
+
+template <typename _Key, typename _Value, typename _Compare>
+template <typename _K2, typename _C, typename>
+const _Value& fixed_eytzinger_map<_Key, _Value, _Compare>::at( const _K2 &_key ) const
 {
     const_iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp2(_key, *__p.k) )
+    if( __p != end() && !comp2(_key, *__p.k) )
         return *__p.v;
-    __throw_at();
+    throw_at();
 }

 template <typename _Key, typename _Value, typename _Compare>
@@ -793,22 +917,19 @@
 operator[]( const key_type& _key )
 {
     iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp(_key, *__p.k) )
+    if( __p != end() && !comp(_key, *__p.k) )
         return *__p.v;
-    __throw_sb();
-}
-
-template <typename _Key, typename _Value, typename _Compare>
-template <typename _K2>
-typename std::enable_if<
-    __fixed_eytzinger_map_base::__is_transparent<_Compare, _K2>::value,
-    _Value&>
-::type fixed_eytzinger_map<_Key, _Value, _Compare>::operator[]( const _K2 &_key )
+    throw_sb();
+}
+
+template <typename _Key, typename _Value, typename _Compare>
+template <typename _K2, typename _C, typename>
+_Value& fixed_eytzinger_map<_Key, _Value, _Compare>::operator[]( const _K2 &_key )
 {
     iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp2(_key, *__p.k) )
+    if( __p != end() && !comp2(_key, *__p.k) )
         return *__p.v;
-    __throw_sb();
+    throw_sb();
 }

 template <typename _Key, typename _Value, typename _Compare>
@@ -816,22 +937,19 @@
 operator[]( const key_type& _key ) const
 {
     const_iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp(_key, *__p.k) )
+    if( __p != end() && !comp(_key, *__p.k) )
         return *__p.v;
-    __throw_sb();
-}
-
-template <typename _Key, typename _Value, typename _Compare>
-template <typename _K2>
-typename std::enable_if<
-    __fixed_eytzinger_map_base::__is_transparent<_Compare, _K2>::value,
-    const _Value&>
-::type fixed_eytzinger_map<_Key, _Value, _Compare>::operator[]( const _K2 &_key ) const
+    throw_sb();
+}
+
+template <typename _Key, typename _Value, typename _Compare>
+template <typename _K2, typename _C, typename>
+const _Value& fixed_eytzinger_map<_Key, _Value, _Compare>::operator[]( const _K2 &_key ) const
 {
     const_iterator __p = lower_bound(_key);
-    if( __p != end() && !__comp2(_key, *__p.k) )
+    if( __p != end() && !comp2(_key, *__p.k) )
         return *__p.v;
-    __throw_sb();
+    throw_sb();
 }

 template <typename _Key, typename _Value, typename _Compare>
@@ -908,152 +1026,6 @@
 };

 template <typename _Key, typename _Value, typename _Compare>
-struct fixed_eytzinger_map<_Key, _Value, _Compare>::proxy_iterator
-{
-    typedef std::random_access_iterator_tag         iterator_category;
-    typedef ssize_t                                 difference_type;
-    typedef std::pair<_Key, _Value>                 value_type;
-    typedef pair_ptr_wrap                           pointer;
-    typedef std::pair<const _Key&, _Value&>         reference;
-
-    proxy_iterator() noexcept : k(nullptr), v(nullptr)
-        { }
-    proxy_iterator( const _Key *_k, _Value *_v ) noexcept : k(_k), v(_v)
-        { }
-    reference operator *() const noexcept
-        { return reference{*k, *v}; }
-    pointer operator->() const noexcept
-        { return pointer{ k, v }; }
-    reference operator[](difference_type _n) const noexcept
-        { return *(*this + _n); }
-    proxy_iterator &operator++() noexcept
-        { ++k; ++v; return *this; }
-    proxy_iterator operator++(int) noexcept
-        { proxy_iterator __tmp = *this; ++(*this); return __tmp; }
-    proxy_iterator &operator--() noexcept
-        { --k; --v; return *this; }
-    proxy_iterator operator--(int) noexcept
-        { proxy_iterator __tmp = *this; --(*this); return __tmp; }
-    proxy_iterator &operator+=(difference_type _d) noexcept
-        { k += _d; v += _d; return *this; }
-    proxy_iterator &operator-=(difference_type _d) noexcept
-        { k -= _d; v -= _d; return *this; }
-    proxy_iterator operator -(difference_type _d) noexcept
-        { proxy_iterator __tmp = *this; return __tmp -= _d; }
-    difference_type operator-(const proxy_iterator &_rhs) const noexcept
-        { return k - _rhs.k; }
-    bool operator ==(const proxy_iterator &_rhs) const noexcept
-        { return k == _rhs.k; }
-    bool operator !=(const proxy_iterator &_rhs) const noexcept
-        { return k != _rhs.k; }
-    bool operator  <(const proxy_iterator &_rhs) const noexcept
-        { return k < _rhs.k; }
-    bool operator  >(const proxy_iterator &_rhs) const noexcept
-        { return k > _rhs.k; }
-    bool operator <=(const proxy_iterator &_rhs) const noexcept
-        { return k <= _rhs.k; }
-    bool operator >=(const proxy_iterator &_rhs) const noexcept
-        { return k >= _rhs.k; }
-private:
-    const _Key *k;
-    _Value *v;
-    friend class fixed_eytzinger_map;
-};
-
-template <typename _Key, typename _Value, typename _Compare>
-inline typename fixed_eytzinger_map<_Key, _Value, _Compare>::proxy_iterator
-operator+(typename fixed_eytzinger_map<_Key, _Value, _Compare>::proxy_iterator::difference_type __n,
-          typename fixed_eytzinger_map<_Key, _Value, _Compare>::proxy_iterator __x) noexcept
-{
-    __x += __n;
-    return __x;
-}
-
-template <typename _Key, typename _Value, typename _Compare>
-inline typename fixed_eytzinger_map<_Key, _Value, _Compare>::proxy_iterator
-operator+(typename fixed_eytzinger_map<_Key, _Value, _Compare>::proxy_iterator __x,
-          typename fixed_eytzinger_map<_Key, _Value, _Compare>::proxy_iterator::difference_type __n
-          ) noexcept
-{
-    __x += __n;
-    return __x;
-}
-
-template <typename _Key, typename _Value, typename _Compare>
-struct fixed_eytzinger_map<_Key, _Value, _Compare>::const_proxy_iterator
-{
-    typedef std::random_access_iterator_tag         iterator_category;
-    typedef ssize_t                                 difference_type;
-    typedef std::pair<_Key, _Value>                 value_type;
-    typedef const_pair_ptr_wrap                     pointer;
-    typedef std::pair<const _Key&, const _Value&>   reference;
-
-    const_proxy_iterator() noexcept : k(nullptr), v(nullptr)
-        { }
-    const_proxy_iterator( const _Key *_k, const _Value *_v ) noexcept : k(_k), v(_v)
-        { }
-    reference operator *() const noexcept
-        { return reference{*k, *v}; }
-    pointer operator->() const noexcept
-        { return pointer{ k, v }; }
-    reference operator[](difference_type _n) const noexcept
-        { return *(*this + _n); }
-    const_proxy_iterator &operator++() noexcept
-        { ++k; ++v; return *this; }
-    const_proxy_iterator operator++(int) noexcept
-        { proxy_iterator __tmp = *this; ++(*this); return __tmp; }
-    const_proxy_iterator &operator--() noexcept
-        { --k; --v; return *this; }
-    const_proxy_iterator operator--(int) noexcept
-        { proxy_iterator __tmp = *this; --(*this); return __tmp; }
-    const_proxy_iterator &operator+=(difference_type _d) noexcept
-        { k += _d; v += _d; return *this; }
-    const_proxy_iterator &operator-=(difference_type _d) noexcept
-        { k -= _d; v -= _d; return *this; }
-    const_proxy_iterator operator -(difference_type _d) noexcept
-        { proxy_iterator __tmp = *this; return __tmp -= _d; }
-    difference_type operator-(const const_proxy_iterator &_rhs) const noexcept
-        { return k - _rhs.k; }
-    bool operator ==(const const_proxy_iterator &_rhs) const noexcept
-        { return k == _rhs.k; }
-    bool operator !=(const const_proxy_iterator &_rhs) const noexcept
-        { return k != _rhs.k; }
-    bool operator  <(const const_proxy_iterator &_rhs) const noexcept
-        { return k < _rhs.k; }
-    bool operator  >(const const_proxy_iterator &_rhs) const noexcept
-        { return k > _rhs.k; }
-    bool operator <=(const const_proxy_iterator &_rhs) const noexcept
-        { return k <= _rhs.k; }
-    bool operator >=(const const_proxy_iterator &_rhs) const noexcept
-        { return k >= _rhs.k; }
-private:
-    const _Key *k;
-    const _Value *v;
-    friend class fixed_eytzinger_map;
-};
-
-template <typename _Key, typename _Value, typename _Compare>
-inline typename fixed_eytzinger_map<_Key, _Value, _Compare>::const_proxy_iterator
-operator+(typename fixed_eytzinger_map<_Key, _Value, _Compare>::
-            const_proxy_iterator::difference_type __n,
-          typename fixed_eytzinger_map<_Key, _Value, _Compare>::const_proxy_iterator __x) noexcept
-{
-    __x += __n;
-    return __x;
-}
-
-template <typename _Key, typename _Value, typename _Compare>
-inline typename fixed_eytzinger_map<_Key, _Value, _Compare>::const_proxy_iterator
-operator+(typename fixed_eytzinger_map<_Key, _Value, _Compare>::const_proxy_iterator __x,
-          typename fixed_eytzinger_map<_Key, _Value, _Compare>::const_proxy_iterator::
-            difference_type __n
-          ) noexcept
-{
-    __x += __n;
-    return __x;
-}
-
-template <typename _Key, typename _Value, typename _Compare>
 inline bool
 operator==(const fixed_eytzinger_map<_Key, _Value, _Compare>& __x,
            const fixed_eytzinger_map<_Key, _Value, _Compare>& __y)


Added setters to the quaternion class

Added setters to the quaternion class

--- include/quaternion.h
+++ include/quaternion.h
@@ -61,6 +61,26 @@
 	 * Returns the w component of this quaternion.
 	 */
 	float w() const;
+
+	/**
+	 * Changes the X component of this quaternion.
+	 */
+	void setX(float x);
+
+	/**
+	 * Changes the Y component of this quaternion.
+	 */
+	void setY(float y);
+
+	/**
+	 * Changes the Z component of this quaternion.
+	 */
+	void setZ(float z);
+
+	/**
+	 * Changes the W component of this quaternion.
+	 */
+	void setW(float w);

 	/**
 	 * Creates a quaternion from a rotation axis and an angle expressed in radians.
@@ -148,6 +168,26 @@
 	return mW;
 }

+GAMEMATH_INLINE void Quaternion::setX(float x)
+{
+	mX = x;
+}
+
+GAMEMATH_INLINE void Quaternion::setY(float y)
+{
+	mY = y;
+}
+
+GAMEMATH_INLINE void Quaternion::setZ(float z)
+{
+	mZ = z;
+}
+
+GAMEMATH_INLINE void Quaternion::setW(float w)
+{
+	mW = w;
+}
+
 GAMEMATH_INLINE const float *Quaternion::data() const
 {
 	return &mX;


remove LIKELY from public headers

remove LIKELY from public headers

Summary:
Fixes #2008
Closes https://github.com/facebook/rocksdb/pull/2009

Differential Revision: D4739885

Pulled By: maysamyabandeh

fbshipit-source-id: 36fba5d

--- include/rocksdb/db.h
+++ include/rocksdb/db.h
@@ -16,7 +16,6 @@
 #include <string>
 #include <unordered_map>
 #include <vector>
-#include "port/likely.h"
 #include "rocksdb/iterator.h"
 #include "rocksdb/listener.h"
 #include "rocksdb/metadata.h"
@@ -288,7 +287,7 @@
     PinnableSlice pinnable_val(value);
     assert(!pinnable_val.IsPinned());
     auto s = Get(options, column_family, key, &pinnable_val);
-    if (LIKELY(s.ok()) && pinnable_val.IsPinned()) {
+    if (s.ok() && pinnable_val.IsPinned()) {
       value->assign(pinnable_val.data(), pinnable_val.size());
     }  // else value is already assigned
     return s;


Expose rpc_object_pack()/rpc_object_unpack() API.

--- include/rpc/object.h
+++ include/rpc/object.h
@@ -84,6 +84,9 @@
 	} while(0)

 rpc_error_t rpc_get_last_error(void);
+
+rpc_object_t rpc_object_pack(const char *fmt, ...);
+int rpc_object_unpack(rpc_object_t, const char *fmt, ...);

 rpc_object_t rpc_null_create(void);
 rpc_object_t rpc_bool_create(bool value);


fixed lesser than

fixed lesser than

--- include/sqlite_orm.h
+++ include/sqlite_orm.h
@@ -344,7 +344,7 @@
         using binary_condition<L, R>::binary_condition;

         operator std::string () const {
-            return "<";
+            return "<=";
         }
     };


Get coding coventions right

Get coding coventions right

--- example4.c
+++ example4.c
@@ -286,9 +286,9 @@
     l_SPacket.size = 0;

 #if LIBAVFORMAT_VERSION_INT < 3613028
-       avcodec_get_frame_defaults(l_pFrame);
+    avcodec_get_frame_defaults(l_pFrame);
 #else
-       av_frame_unref(l_pFrame);
+    av_frame_unref(l_pFrame);
 #endif

     printf("fe_read_frame: Readed bytes %ld Copied bytes: %ld\n", l_iReadedBytes, l_iCopiedBytes);


Reestablish values lost when switching to PARAM

I've verified the rest and only these 2 were affected.


- replaced macros with inline funcs

- replaced macros with inline funcs

--- include/trurl/nbuf.h
+++ include/trurl/nbuf.h
@@ -46,29 +46,52 @@

 #include <trurl/n2h.h>
-#define n_buf_write_int8(nbuf, v)            \
+#define n_buf_write_int8_macro(nbuf, v)      \
      do {                                    \
          uint8_t v_ = v;                     \
          n_buf_write(nbuf, &v_, sizeof(v_)); \
      } while(0);

+static inline int n_buf_write_int8(tn_buf *nbuf, int v)
+{
+    uint8_t v_ = v;
+    return n_buf_write(nbuf, &v_, sizeof(v_));
+}
+
+
 #define n_buf_putc(nbuf, c)      n_buf_write_int8(nbuf, c)
-#define n_buf_add_int8(nbuf, v)  n_buf_write_int8(nbuf, v)
-
-#define n_buf_write_int16(nbuf, v)           \
+#define n_buf_add_int8(nbuf, v)  n_buf_write_int8(nbuf, v)
+#define n_buf_write_uint8(nbuf, v) n_buf_write_int8(nbuf, v)
+
+#define n_buf_write_int16_macro(nbuf, v)           \
     do {                                     \
          uint16_t nv = n_hton16(v);          \
          n_buf_write(nbuf, &nv, sizeof(nv)); \
     } while(0);

+static inline int n_buf_write_int16(tn_buf *nbuf, int v)
+{
+    uint16_t v_ = v;
+    return n_buf_write(nbuf, &v_, sizeof(v_));
+}
+
 #define n_buf_add_int16(nbuf, v) n_buf_write_int16(nbuf, v)
-
-#define n_buf_write_int32(nbuf, v)           \
+#define n_buf_write_uint16(nbuf, v) n_buf_write_int16(nbuf, v)
+
+#define n_buf_write_int32_macro(nbuf, v)     \
     do {                                     \
          uint32_t nv = n_hton32(v);          \
          n_buf_write(nbuf, &nv, sizeof(nv)); \
     } while(0);

+
+static inline int n_buf_write_int32(tn_buf *nbuf, int v)
+{
+    uint32_t v_ = v;
+    return n_buf_write(nbuf, &v_, sizeof(v_));
+}
+
+#define n_buf_write_uint32(nbuf, v) n_buf_write_int32(nbuf, v)
 #define n_buf_add_int32(nbuf, v) n_buf_write_int32(nbuf, v)

 //int n_buf_size(const tn_buf *buf);


Rename lock initializer

Rename lock initializer

--- include/truth/lock.h
+++ include/truth/lock.h
@@ -13,4 +13,4 @@
 void lock_acquire_writer(struct lock *lock);
 void lock_release_writer(struct lock *lock);

-#define Clear_Lock { .readers = 0, .writer = false }
+#define Lock_Clear { .readers = 0, .writer = false }


Expose slab_alloc_helper to the world

Expose slab_alloc_helper to the world

The API with all the knobs. I give up trying to make this shit clean, it ain't.

--- include/truth/slab.h
+++ include/truth/slab.h
@@ -2,6 +2,7 @@

 #include <truth/memory.h>
 #include <truth/types.h>
+#include <truth/region_vector.h>

 void slab_init(void);

@@ -12,3 +13,7 @@

 void *slab_alloc_locked(size_t bytes, enum memory_attributes attrs);
 void slab_free_locked(size_t count, void *address);
+
+void *slab_alloc_helper(size_t bytes, phys_addr *phys,
+                        enum memory_attributes page_attributes,
+                        struct region_vector *vect);


winsparkle.h no longer imports from src folder

As pointed out by @Vaclav Slavik the public API should be separate from
the private one.

--- include/winsparkle.h
+++ include/winsparkle.h
@@ -29,7 +29,6 @@
 #include <stddef.h>

 #include "winsparkle-version.h"
-#include "../src/winsparkletypes.h"

 #if !defined(BUILDING_WIN_SPARKLE) && defined(_MSC_VER)
 #pragma comment(lib, "WinSparkle.lib")
@@ -225,7 +224,7 @@

     @since 0.4
 */
-WIN_SPARKLE_API void __cdecl win_sparkle_set_shutdown_poll_callback(ShutDownPollCallback callback);
+WIN_SPARKLE_API void __cdecl win_sparkle_set_shutdown_poll_callback(int (*callback)());

 /**
     @param callback A function implemented by the host that terminates the
@@ -235,7 +234,7 @@

     @since 0.4
 */
-WIN_SPARKLE_API void __cdecl win_sparkle_set_shutdown_request_callback(ShutDownRequestCallback callback);
+WIN_SPARKLE_API void __cdecl win_sparkle_set_shutdown_request_callback(void (*callback)());

 //@}


render: add wlr_renderer_scissor docs

render: add wlr_renderer_scissor docs

--- include/wlr/render.h
+++ include/wlr/render.h
@@ -15,6 +15,11 @@
 void wlr_renderer_end(struct wlr_renderer *r);
 void wlr_renderer_clear(struct wlr_renderer *r, float red, float green,
 	float blue, float alpha);
+/**
+ * Defines a scissor box. Only pixels that lie within the scissor box can be
+ * modified by drawing functions. Providing a NULL `box` disables the scissor
+ * box.
+ */
 void wlr_renderer_scissor(struct wlr_renderer *r, struct wlr_box *box);
 /**
  * Requests a texture handle from this renderer.


Adding files in IR procedure to hold the configuration used by the procedure

--- includes/isa/irISA.h
+++ includes/isa/irISA.h
@@ -46,6 +46,8 @@
 	IRBlock *entryBlock;			//pointer to the entry block of the procedure
 	IRBlock **blocks;				//A pointer to an array of blocks
 	int nbBlock;
+	char issueWidth;
+	char configuration;

 	unsigned int procedureState;	//A value to store its state (optimized/translated or other things like that)


Repair ext2fs writes.

Repair ext2fs writes.

Strong candidate for backport to 6.x.

When allocating new blocks, the search for block group beginnings
would fail with a segfault.  There was a side-effect read access with
an off-by-one errors.  The results were not used in the error case so
the code worked in the past.  But now the FreeBSD kernel has tighter
mappings and the word accessed is not mapped (for me).

The Linux kernel has rewritten most of the allocation strategy by now.
Also, the Linux kernel cleaned up the integration of these files and
it look feasable to wrap the original Linux files in wrapper that
provides their favorite arguments instead of dragging around our own
code.


When a channel switch is done to a channel with different operating
characteristics force the stations to re-associate so protocol state
is re-initialized.  Note that for 11h/DFS this is irrelevant as channel
changes are never cross-band.

Reviewed by:	ctlaw

--- sys/net80211/ieee80211_hostap.c
+++ sys/net80211/ieee80211_hostap.c
@@ -125,6 +125,28 @@
 			IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni,
 			    "%s: inact %u", __func__, ni->ni_inact);
 		}
+}
+
+static void
+sta_drop(void *arg, struct ieee80211_node *ni)
+{
+	struct ieee80211vap *vap = arg;
+
+	if (ni->ni_vap == vap && ni->ni_associd != 0)
+		ieee80211_node_leave(ni);
+}
+
+/*
+ * Does a channel change require associated stations to re-associate
+ * so protocol state is correct.  This is used when doing CSA across
+ * bands or similar (e.g. HT -> legacy).
+ */
+static int
+isbandchange(struct ieee80211com *ic)
+{
+	return ((ic->ic_bsschan->ic_flags ^ ic->ic_csa_newchan->ic_flags) &
+	    (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HALF |
+	     IEEE80211_CHAN_QUARTER | IEEE80211_CHAN_HT)) != 0;
 }

 /*
@@ -307,6 +329,18 @@
 		}
 		ieee80211_node_authorize(vap->iv_bss);
 		break;
+	case IEEE80211_S_CSA:
+		if (ostate == IEEE80211_S_RUN && isbandchange(ic)) {
+			/*
+			 * On a ``band change'' silently drop associated
+			 * stations as they must re-associate before they
+			 * can pass traffic (as otherwise protocol state
+			 * such as capabilities and the negotiated rate
+			 * set may/will be wrong).
+			 */
+			ieee80211_iterate_nodes(&ic->ic_sta, sta_drop, vap);
+		}
+		break;
 	default:
 		break;
 	}


MFC revision 1.13

MFC revision 1.13

Make sure we are incrementing read counters

Approved by:	re@ (kensmith)

--- sys/security/audit/audit_pipe.c
+++ sys/security/audit/audit_pipe.c
@@ -934,6 +934,7 @@
 		audit_pipe_entry_free(ape);
 		ap->ap_truncates++;
 	} while (1);
+	ap->ap_reads++;
 	mtx_unlock(&audit_pipe_mtx);

 	/*


pack-refs: fix git_path() usage.

pack-refs: fix git_path() usage.

Signed-off-by: Junio C Hamano <dc50d1021234060e53ec42a77d526afa2fe07479@cox.net>

--- builtin-pack-refs.c
+++ builtin-pack-refs.c
@@ -56,7 +56,7 @@
 	struct ref_lock *lock = lock_ref_sha1(r->name + 5, r->sha1, 1);

 	if (lock) {
-		unlink(git_path(r->name));
+		unlink(git_path("%s", r->name));
 		unlock_ref(lock);
 	}
 }


Formatting only.

Formatting only.


Take proper account of signatures changing during page generation

--- src/c/urweb.c
+++ src/c/urweb.c
@@ -471,6 +471,8 @@
   int amInitializing;

   char error_message[ERROR_BUF_LEN];
+
+  int usedSig, needsResig;
 };

 size_t uw_headers_max = SIZE_MAX;
@@ -545,6 +547,9 @@
   ctx->nextId = 0;

   ctx->amInitializing = 0;
+
+  ctx->usedSig = 0;
+  ctx->needsResig = 0;

   return ctx;
 }
@@ -624,6 +629,8 @@
   ctx->queryString = NULL;
   ctx->nextId = 0;
   ctx->amInitializing = 0;
+  ctx->usedSig = 0;
+  ctx->needsResig = 0;
 }

 void uw_reset_keep_request(uw_context ctx) {
@@ -3083,6 +3090,11 @@
   return NULL;
 }

+static void set_cookie(uw_context ctx) {
+  if (ctx->usedSig)
+    ctx->needsResig = 1;
+}
+
 uw_unit uw_Basis_set_cookie(uw_context ctx, uw_Basis_string prefix, uw_Basis_string c, uw_Basis_string v, uw_Basis_time *expires, uw_Basis_bool secure) {
   uw_write_header(ctx, "Set-Cookie: ");
   uw_write_header(ctx, c);
@@ -3105,6 +3117,7 @@
   if (secure)
     uw_write_header(ctx, "; secure");
   uw_write_header(ctx, "\r\n");
+  set_cookie(ctx);

   return uw_unit_v;
 }
@@ -3115,6 +3128,7 @@
   uw_write_header(ctx, "=; path=");
   uw_write_header(ctx, prefix);
   uw_write_header(ctx, "; " THE_PAST "\r\n");
+  set_cookie(ctx);

   return uw_unit_v;
 }
@@ -3192,8 +3206,32 @@

 static const char begin_xhtml[] = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">";

+extern int uw_hash_blocksize;
+
+static const char sig_intro[] = "<input type=\"hidden\" name=\"Sig\" value=\"";
+
+static char *find_sig(char *haystack) {
+  int i;
+  char *s = strstr(haystack, sig_intro);
+
+  if (!s || strlen(haystack) - (s - haystack) - (sizeof sig_intro - 1) < uw_hash_blocksize*2+1)
+    return NULL;
+
+  s += sizeof sig_intro - 1;
+
+  for (i = 0; i < uw_hash_blocksize*2; ++i)
+    if (!isxdigit((int)s[i]))
+      return NULL;
+
+  if (s[i] != '"')
+    return NULL;
+
+  return s;
+}
+
 void uw_commit(uw_context ctx) {
   int i;
+  char *sig;

   if (uw_has_error(ctx)) {
     uw_rollback(ctx, 0);
@@ -3314,6 +3352,18 @@
         memcpy(start + 6, ctx->script_header, lenH);
         memcpy(start + 6 + lenH, "</head>", 7);
       }
+    }
+  }
+
+  if (ctx->needsResig) {
+    sig = find_sig(ctx->page.start);
+    if (sig) {
+      char *realsig = ctx->app->cookie_sig(ctx);
+
+      do {
+        memcpy(sig, realsig, 2*uw_hash_blocksize);
+        sig = find_sig(sig);
+      } while (sig);
     }
   }
 }
@@ -3561,8 +3611,6 @@
   return s ? s : "";
 }

-extern int uw_hash_blocksize;
-
 uw_Basis_string uw_Basis_makeSigString(uw_context ctx, uw_Basis_string sig) {
   uw_Basis_string r = uw_malloc(ctx, 2 * uw_hash_blocksize + 1);
   int i;
@@ -3591,6 +3639,7 @@
 }

 uw_Basis_string uw_Basis_sigString(uw_context ctx, uw_unit u) {
+  ctx->usedSig = 1;
   return ctx->app->cookie_sig(ctx);
 }


[examples] "get" uses -o to save to a file

The "get" example is now able to handle a new "-o"
parameter specifying the path of a file in which
to write the received body of a "GET" operation.

If the file exists, it will be overwritten.

https://bugzilla.gnome.org/show_bug.cgi?id=703229

--- examples/get.c
+++ examples/get.c
@@ -12,6 +12,7 @@
 static SoupSession *session;
 static GMainLoop *loop;
 static gboolean debug, head, quiet;
+static const gchar *output_file_path = NULL;

 static void
 get_url (const char *url)
@@ -19,6 +20,7 @@
 	const char *name;
 	SoupMessage *msg;
 	const char *header;
+	FILE *output_file = NULL;

 	msg = soup_message_new (head ? "HEAD" : "GET", url);
 	soup_message_set_flags (msg, SOUP_MESSAGE_NO_REDIRECT);
@@ -55,9 +57,23 @@
 			g_free (uri_string);
 			soup_uri_free (uri);
 		}
-	} else if (SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
-		fwrite (msg->response_body->data, 1,
-			msg->response_body->length, stdout);
+	} else if (!head && SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
+		if (output_file_path) {
+			output_file = fopen (output_file_path, "w");
+			if (!output_file)
+				g_printerr ("Error trying to create file %s.\n", output_file_path);
+		} else if (!quiet)
+			output_file = stdout;
+
+		if (output_file) {
+			fwrite (msg->response_body->data,
+				1,
+				msg->response_body->length,
+				output_file);
+
+			if (output_file_path)
+				fclose (output_file);
+		}
 	}
 }

@@ -77,6 +93,9 @@
 	{ "ntlm", 'n', 0,
 	  G_OPTION_ARG_NONE, &ntlm,
 	  "Use NTLM authentication", NULL },
+	{ "output", 'o', 0,
+	  G_OPTION_ARG_STRING, &output_file_path,
+	  "Write the received data to FILE instead of stdout", "FILE" },
 	{ "proxy", 'p', 0,
 	  G_OPTION_ARG_STRING, &proxy,
 	  "Use URL as an HTTP proxy", "URL" },
@@ -146,7 +165,7 @@
 			exit (1);
 		}

-		g_object_set (G_OBJECT (session),
+		g_object_set (G_OBJECT (session),
 			      SOUP_SESSION_PROXY_URI, proxy_uri,
 			      NULL);
 		soup_uri_free (proxy_uri);


Fix uw_Basis_lt_time

Fix uw_Basis_lt_time

--- src/c/urweb.c
+++ src/c/urweb.c
@@ -4271,7 +4271,7 @@
 }

 uw_Basis_bool uw_Basis_lt_time(uw_context ctx, uw_Basis_time t1, uw_Basis_time t2) {
-  return !!(t1.seconds < t2.seconds || t1.microseconds < t2.microseconds);
+  return !!(t1.seconds < t2.seconds || (t1.seconds == t2.seconds && t1.microseconds < t2.microseconds));
 }

 uw_Basis_bool uw_Basis_le_time(uw_context ctx, uw_Basis_time t1, uw_Basis_time t2) {


Added new operator<< syntax for adding elements to option arrays

--- configoption.h
+++ configoption.h
@@ -67,6 +67,10 @@
         OptionVector::iterator end();
         OptionVector::const_iterator cbegin() const;
         OptionVector::const_iterator cend() const;
+
+        // Adds an array element
+        template <typename Type>
+        Option& operator<<(const Type& data);

         // Converts the entire option array to a string
         std::string buildArrayString(const std::string& indentStr = "") const;
@@ -150,6 +154,13 @@
     return tmp;
 }

+template <typename Type>
+Option& Option::operator<<(const Type& data)
+{
+    push() = data;
+    return *this;
+}
+
 }

 #endif


JPEG: Implemented directly loading to NV16 surfaces staying in YCbCr space.

No offsets, clipping or scaling supported.

In my test (df_dok --load-image wood_andi.jpg) NV16 had a 34% advantage
over RGB16 with this change. It has been the other way around before.

[merged from old-surface-core-1.1]

--- interfaces/IDirectFBImageProvider/idirectfbimageprovider_jpeg.c
+++ interfaces/IDirectFBImageProvider/idirectfbimageprovider_jpeg.c
@@ -234,16 +234,34 @@
      longjmp(myerr->setjmp_buffer, 1);
 }

-
-static void
-copy_line32( u32 *dst, u8 *src, int width)
-{
-     u32 r, g , b;
+static inline void
+copy_line32( u32 *argb, const u8 *rgb, int width )
+{
      while (width--) {
-          r = (*src++) << 16;
-          g = (*src++) << 8;
-          b = (*src++);
-          *dst++ = (0xFF000000 |r|g|b);
+          *argb++ = 0xFF000000 | (rgb[0] << 16) | (rgb[1] << 8) | rgb[2];
+
+          rgb += 3;
+     }
+}
+
+static inline void
+copy_line_nv16( u16 *yy, u16 *cbcr, const u8 *src_ycbcr, int width )
+{
+     int x;
+
+     D_ASSUME( !(width & 1) );
+
+     for (x=0; x<width/2; x++) {
+#if WORDS_BIGENDIAN
+          yy[x] = (src_ycbcr[0] << 8) | src_ycbcr[3];
+#else
+          yy[x] = (src_ycbcr[3] << 8) | src_ycbcr[0];
+#endif
+
+          cbcr[x] = (((src_ycbcr[1] + src_ycbcr[4]) << 7) & 0xff00) |
+                     ((src_ycbcr[2] + src_ycbcr[5]) >> 1);
+
+          src_ycbcr += 6;
      }
 }

@@ -364,7 +382,7 @@
                                       const DFBRectangle     *dest_rect )
 {
      DFBResult              ret;
-     int                    direct = 0;
+     bool                   direct = false;
      DFBRegion              clip;
      DFBRectangle           rect;
      DFBSurfacePixelFormat  format;
@@ -416,6 +434,7 @@
           int row_stride;         /* physical row width in output buffer */
           u32 *row_ptr;
           int y = 0;
+          int uv_offset = 0;

           cinfo.err = jpeg_std_error(&jerr.pub);
           jerr.pub.error_exit = jpeglib_panic;
@@ -447,9 +466,31 @@
           jpeg_create_decompress(&cinfo);
           jpeg_buffer_src(&cinfo, data->buffer, 0);
           jpeg_read_header(&cinfo, TRUE);
-
-          cinfo.out_color_space = JCS_RGB;
+          jpeg_calc_output_dimensions(&cinfo);
+
+          if (cinfo.output_width == rect.w && cinfo.output_height == rect.h)
+               direct = true;
+
           cinfo.output_components = 3;
+
+          switch (dst_surface->format) {
+               case DSPF_NV16:
+                    uv_offset = dst_surface->height * pitch;
+
+                    if (direct && !rect.x && !rect.y) {
+                         D_INFO( "JPEG: Using YCbCr color space directly! (%dx%d)\n",
+                                 cinfo.output_width, cinfo.output_height );
+                         cinfo.out_color_space = JCS_YCbCr;
+                         break;
+                    }
+                    D_INFO( "JPEG: Going through RGB color space! (%dx%d -> %dx%d @%d,%d)\n",
+                            cinfo.output_width, cinfo.output_height, rect.w, rect.h, rect.x, rect.y );
+
+               default:
+                    cinfo.out_color_space = JCS_RGB;
+                    break;
+          }
+
           jpeg_start_decompress(&cinfo);

           data->width = cinfo.output_width;
@@ -467,21 +508,39 @@
           }
           row_ptr = data->image;

-          direct = (rect.w == data->width && rect.h == data->height);
-
           while (cinfo.output_scanline < cinfo.output_height && cb_result == DIRCR_OK) {
                jpeg_read_scanlines(&cinfo, buffer, 1);
-               copy_line32( row_ptr, *buffer, data->width);
-
-               if (direct) {
-                    DFBRectangle r = { rect.x, rect.y+y, rect.w, 1 };
-                    dfb_copy_buffer_32( row_ptr, lock.addr, lock.pitch,
-                                        &r, dst_surface, &clip );
-                    if (data->render_callback) {
-                         r = (DFBRectangle){ 0, y, data->width, 1 };
-                         cb_result = data->render_callback( &r,
-                                             data->render_callback_context );
-                    }
+
+               switch (dst_surface->format) {
+                    case DSPF_NV16:
+                         if (direct) {
+                              copy_line_nv16( lock.addr, lock.addr + uv_offset, *buffer, rect.w );
+
+                              lock.addr += lock.pitch;
+
+                              if (data->render_callback) {
+                                   DFBRectangle r = { 0, y, data->width, 1 };
+
+                                   cb_result = data->render_callback( &r,
+                                                                      data->render_callback_context );
+                              }
+                              break;
+                         }
+
+                    default:
+                         copy_line32( row_ptr, *buffer, data->width);
+
+                         if (direct) {
+                              DFBRectangle r = { rect.x, rect.y+y, rect.w, 1 };
+                              dfb_copy_buffer_32( row_ptr, lock.addr, lock.pitch,
+                                                  &r, dst_surface, &clip );
+                              if (data->render_callback) {
+                                   r = (DFBRectangle){ 0, y, data->width, 1 };
+                                   cb_result = data->render_callback( &r,
+                                                                      data->render_callback_context );
+                              }
+                         }
+                         break;
                }

                row_ptr += data->width;


avoid reading buffer for PERF_SAMPLE_TRANSACTION

This mmap type is not supported by old perf events (like the one on Cori).
Temporarily, it's better to remove the support until we find a better way to configure perf event support

--- src/tool/hpcrun/sample-sources/perf/mmap_read.c
+++ src/tool/hpcrun/sample-sources/perf/mmap_read.c
@@ -446,6 +446,7 @@
 				offset+=8;
 			}

+#if 0
 			if (sample_type & PERF_SAMPLE_TRANSACTION) {
 				long long abi;

@@ -454,6 +455,7 @@

 			}
 			break;
+#endif

 #if 0
 		/* AUX */


Fixes bug 161964 -  Some special audio files are not displayed in the Music..

Try to check whether a mp4 file is actually only audio, not video.

--- src/tracker-extract/tracker-extract-gstreamer.c
+++ src/tracker-extract/tracker-extract-gstreamer.c
@@ -79,7 +79,7 @@
 	EXTRACT_MIME_AUDIO,
 	EXTRACT_MIME_VIDEO,
 	EXTRACT_MIME_IMAGE,
-	EXTRACT_MIME_3GPP,
+	EXTRACT_MIME_GUESS,
 } ExtractMime;

 typedef struct {
@@ -124,7 +124,7 @@
 static void extract_gstreamer_image (const gchar          *uri,
                                      TrackerSparqlBuilder *preupdate,
                                      TrackerSparqlBuilder *metadata);
-static void extract_gstreamer_3gpp  (const gchar          *uri,
+static void extract_gstreamer_guess (const gchar          *uri,
                                      TrackerSparqlBuilder *preupdate,
                                      TrackerSparqlBuilder *metadata);

@@ -132,8 +132,9 @@
 	{ "audio/*", extract_gstreamer_audio },
 	{ "video/*", extract_gstreamer_video },
 	{ "image/*", extract_gstreamer_image },
-	/* mime type guessing returns video/3gpp also for 3gpp audio files */
-	{ "video/3gpp", extract_gstreamer_3gpp },
+	/* mime type guessing returns for instance video/3gpp also for 3gpp audio files */
+	{ "video/3gpp", extract_gstreamer_guess },
+	{ "video/mp4", extract_gstreamer_guess },
 	{ NULL, NULL }
 };

@@ -476,7 +477,7 @@
 		gchar *composer_uri = NULL;
 		gchar *album_uri = NULL;

-		if (extractor->mime == EXTRACT_MIME_3GPP) {
+		if (extractor->mime == EXTRACT_MIME_GUESS) {
 			gchar *video_codec = NULL, *audio_codec = NULL;

 			gst_tag_list_get_string (extractor->tagcache, GST_TAG_VIDEO_CODEC, &video_codec);
@@ -563,8 +564,8 @@

 			tracker_sparql_builder_insert_close (preupdate);

-			has_it = gst_tag_list_get_uint (extractor->tagcache,
-			                                GST_TAG_TRACK_COUNT,
+			has_it = gst_tag_list_get_uint (extractor->tagcache,
+			                                GST_TAG_TRACK_COUNT,
 			                                &count);

 			if (has_it) {
@@ -589,8 +590,8 @@
 				tracker_sparql_builder_insert_close (preupdate);
 			}

-			has_it = gst_tag_list_get_uint (extractor->tagcache,
-			                                GST_TAG_ALBUM_VOLUME_NUMBER,
+			has_it = gst_tag_list_get_uint (extractor->tagcache,
+			                                GST_TAG_ALBUM_VOLUME_NUMBER,
 			                                &count);

 			if (has_it) {
@@ -615,8 +616,8 @@
 				tracker_sparql_builder_insert_close (preupdate);
 			}

-			has_it = gst_tag_list_get_double (extractor->tagcache,
-			                                  GST_TAG_ALBUM_GAIN,
+			has_it = gst_tag_list_get_double (extractor->tagcache,
+			                                  GST_TAG_ALBUM_GAIN,
 			                                  &gain);

 			if (has_it) {
@@ -641,8 +642,8 @@
 				tracker_sparql_builder_insert_close (preupdate);
 			}

-			has_it = gst_tag_list_get_double (extractor->tagcache,
-			                                  GST_TAG_ALBUM_PEAK,
+			has_it = gst_tag_list_get_double (extractor->tagcache,
+			                                  GST_TAG_ALBUM_PEAK,
 			                                  &gain);

 			if (has_it) {
@@ -679,7 +680,7 @@
 		if (needs_audio) {
 			tracker_sparql_builder_object (metadata, "nmm:MusicPiece");
 			tracker_sparql_builder_object (metadata, "nfo:Audio");
-		}
+		}

 		if (extractor->mime == EXTRACT_MIME_VIDEO) {
 			tracker_sparql_builder_object (metadata, "nmm:Video");
@@ -763,7 +764,7 @@
 		if (needs_audio) {
 			tracker_sparql_builder_object (metadata, "nmm:MusicPiece");
 			tracker_sparql_builder_object (metadata, "nfo:Audio");
-		}
+		}

 		if (extractor->mime == EXTRACT_MIME_VIDEO) {
 			tracker_sparql_builder_object (metadata, "nmm:Video");
@@ -1199,11 +1200,11 @@
 }

 static void
-extract_gstreamer_3gpp (const gchar          *uri,
+extract_gstreamer_guess (const gchar          *uri,
                         TrackerSparqlBuilder *preupdate,
 			TrackerSparqlBuilder *metadata)
 {
-	tracker_extract_gstreamer (uri, preupdate, metadata, EXTRACT_MIME_3GPP);
+	tracker_extract_gstreamer (uri, preupdate, metadata, EXTRACT_MIME_GUESS);
 }

 TrackerExtractData *


tracker-extract: Fixed memory problem in GStreamer extractor

--- src/tracker-extract/tracker-extract-gstreamer.c
+++ src/tracker-extract/tracker-extract-gstreamer.c
@@ -282,7 +282,7 @@
                     GstTagList  *tag_list,
                     const gchar *tag)
 {
-	GDate    *date;
+	GDate    *date = NULL;
 	gboolean  ret;

 	date = NULL;


corrected bug when tensor->storage was NULL contrary to torch5, it can happen in Lua that tensor->storage is NULL in torch5, reinit (called when creating a tensor from Lua) was always assigning tensor->storage to something this is *not* the case in the new torch

--- packages/torch/generic/Tensor.c
+++ packages/torch/generic/Tensor.c
@@ -53,8 +53,15 @@
 static int torch_Tensor_(storage)(lua_State *L)
 {
   THTensor *tensor = luaT_checkudata(L, 1, torch_Tensor_id);
-  THStorage_(retain)(tensor->storage);
-  luaT_pushudata(L, tensor->storage, torch_Storage_id);
+
+  if(tensor->storage)
+  {
+    THStorage_(retain)(tensor->storage);
+    luaT_pushudata(L, tensor->storage, torch_Storage_id);
+  }
+  else
+    lua_pushnil(L);
+
   return 1;
 }

@@ -767,8 +774,13 @@
   torch_File_writeLong(L, tensor->size, tensor->nDimension);
   torch_File_writeLong(L, tensor->stride, tensor->nDimension);
   torch_File_writeLong(L, &storageOffset, 1);
-  THStorage_(retain)(tensor->storage);
-  luaT_pushudata(L, tensor->storage, torch_Storage_id);
+  if(tensor->storage)
+  {
+    THStorage_(retain)(tensor->storage);
+    luaT_pushudata(L, tensor->storage, torch_Storage_id);
+  }
+  else
+    lua_pushnil(L);
   torch_File_writeObject(L);
   return 0;
 }
@@ -810,7 +822,8 @@
   tensor->storageOffset = storageOffset-1; /* to respect Lua convention */
   torch_File_readObject(L);
   tensor->storage = luaT_toudata(L, -1, torch_Storage_id);
-  THStorage_(retain)(tensor->storage);
+  if(tensor->storage)
+    THStorage_(retain)(tensor->storage);
   lua_pop(L, 1);
   return 0;
 }


minor, evaluate incoming dcnts and convert to ymd

Signed-off-by: Sebastian Freundt <1f0829204b3475c52f714f96be4e7b39a87b6e74@ga-group.nl>

--- lib/date-core.c
+++ lib/date-core.c
@@ -112,6 +112,7 @@
 	struct {
 		unsigned int ab:1;
 		unsigned int bizda:1;
+		unsigned int d_dcnt_p:1;
 	} flags;
 	unsigned int b;
 	unsigned int q;
@@ -2025,13 +2026,37 @@
 		/* nearly all goes to ymd */
 		res.typ = DT_YMD;
 		res.ymd.y = d.y;
-		res.ymd.m = d.m;
+		if (LIKELY(!d.flags.d_dcnt_p)) {
+			res.ymd.m = d.m;
 #if defined WITH_FAST_ARITH
-		res.ymd.d = d.d;
+			res.ymd.d = d.d;
 #else  /* !WITH_FAST_ARITH */
-		/* check for illegal dates, like 31st of April */
-		if ((res.ymd.d = __get_mdays(d.y, d.m)) > d.d) {
-			res.ymd.d = d.d;
+			/* check for illegal dates, like 31st of April */
+			if ((res.ymd.d = __get_mdays(d.y, d.m)) > d.d) {
+				res.ymd.d = d.d;
+			}
+		} else {
+			/* convert dcnt to m + d */
+			unsigned int m = 13;
+			unsigned int rd = 0;
+
+			for (m = 1; m < GREG_MONTHS_P_YEAR &&
+				     d.d > __mon_yday[m + 1]; m++);
+			rd = d.d - __mon_yday[m] + 1;
+			if (UNLIKELY(__leapp(d.y))) {
+				if (UNLIKELY(d.d == 60)) {
+					m = 2;
+					rd = 29;
+				} else if (d.d != __mon_yday[m] + 1U) {
+					rd--;
+				} else {
+					/* grrrr */
+					m--;
+					rd = d.d - __mon_yday[m] - 1U;
+				}
+			}
+			res.ymd.m = m;
+			res.ymd.d = rd;
 		}
 #endif	/* !WITH_FAST_ARITH */
 	} else if (d.y && d.c && !d.flags.bizda) {
@@ -2297,7 +2322,10 @@
 		break;
 	case DT_SPFL_N_DCNT_YEAR:
 		/* was %D and %j, cannot be used at the moment */
-		(void)strtoui_lim(sp, &sp, 1, 366);
+		if ((d->d = strtoui_lim(sp, &sp, 1, 366)) < -1U) {
+			res = 0;
+			d->flags.d_dcnt_p = 1;
+		}
 		break;
 	case DT_SPFL_N_WCNT_YEAR:
 		/* was %C, cannot be used at the moment */


Use GtkGrid instead of GtkTable

Use GtkGrid instead of GtkTable

--- panel-plugin/config_gui.c
+++ panel-plugin/config_gui.c
@@ -74,23 +74,23 @@

     //tooltips = gtk_tooltips_new ();

-    table1 = gtk_table_new (3, 2, FALSE);
+    table1 = gtk_grid_new ();
     gtk_widget_show (table1);
     gtk_box_pack_start (GTK_BOX (vbox1), table1, FALSE, TRUE, 0);

     label1 = gtk_label_new (_("Command"));
     gtk_widget_show (label1);
-    gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 0, 1,
-        (GtkAttachOptions) (GTK_FILL),
-        (GtkAttachOptions) (0), 0, 0);
+    gtk_grid_attach (GTK_GRID (table1), label1, 0, 1, 0, 1);
+        //(GtkAttachOptions) (GTK_FILL),
+        //(GtkAttachOptions) (0), 0, 0);
     gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);
     gtk_widget_set_valign (label1, GTK_ALIGN_CENTER);

     wTF_Cmd = gtk_entry_new ();
     gtk_widget_show (wTF_Cmd);
-    gtk_table_attach (GTK_TABLE (table1), wTF_Cmd, 1, 2, 0, 1,
-        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-        (GtkAttachOptions) (0), 0, 0);
+    gtk_grid_attach (GTK_GRID (table1), wTF_Cmd, 1, 2, 0, 1);
+        //(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+        //(GtkAttachOptions) (0), 0, 0);
     //gtk_tooltips_set_tip (tooltips, wTF_Cmd,
     //    _("Input the shell command to spawn, then press <Enter>"),
     //    NULL);
@@ -99,9 +99,9 @@

     eventbox1 = gtk_event_box_new ();
     gtk_widget_show (eventbox1);
-    gtk_table_attach (GTK_TABLE (table1), eventbox1, 1, 2, 2, 3,
-        (GtkAttachOptions) (GTK_FILL),
-        (GtkAttachOptions) (GTK_FILL), 0, 0);
+    gtk_grid_attach (GTK_GRID (table1), eventbox1, 1, 2, 2, 3);
+        //(GtkAttachOptions) (GTK_FILL),
+        //(GtkAttachOptions) (GTK_FILL), 0, 0);

     gtk_widget_set_halign(GTK_CONTAINER(eventbox1), GTK_ALIGN_START);
     gtk_widget_set_valign(GTK_CONTAINER(eventbox1), GTK_ALIGN_START);
@@ -118,26 +118,26 @@

     label2 = gtk_label_new (_("Period (s) "));
     gtk_widget_show (label2);
-    gtk_table_attach (GTK_TABLE (table1), label2, 0, 1, 2, 3,
-        (GtkAttachOptions) (GTK_FILL),
-        (GtkAttachOptions) (0), 0, 0);
+    gtk_grid_attach (GTK_GRID (table1), label2, 0, 1, 2, 3);
+        //(GtkAttachOptions) (GTK_FILL),
+        //(GtkAttachOptions) (0), 0, 0);
     gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);
     gtk_widget_set_valign (label2, GTK_ALIGN_CENTER);

     wTB_Title = gtk_check_button_new_with_mnemonic (_("Label"));
     gtk_widget_show (wTB_Title);
-    gtk_table_attach (GTK_TABLE (table1), wTB_Title, 0, 1, 1, 2,
-        (GtkAttachOptions) (GTK_FILL),
-        (GtkAttachOptions) (0), 0, 0);
+    gtk_grid_attach (GTK_GRID (table1), wTB_Title, 0, 1, 1, 2);
+        //(GtkAttachOptions) (GTK_FILL),
+        //(GtkAttachOptions) (0), 0, 0);
     //gtk_tooltips_set_tip (tooltips, wTB_Title, _("Tick to display label"),
     //    NULL);
     gtk_widget_set_tooltip_text (wTB_Title, "Tick to display label");

     wTF_Title = gtk_entry_new ();
     gtk_widget_show (wTF_Title);
-    gtk_table_attach (GTK_TABLE (table1), wTF_Title, 1, 2, 1, 2,
-        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-        (GtkAttachOptions) (0), 0, 0);
+    gtk_grid_attach (GTK_GRID (table1), wTF_Title, 1, 2, 1, 2);
+        //(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+        //(GtkAttachOptions) (0), 0, 0);
     //gtk_tooltips_set_tip (tooltips, wTF_Title,
     //    _("Input the plugin label, then press <Enter>"),
     //    NULL);


default port based on scheme

default port based on scheme

git-svn-id: 33ed6c3feaacb64944efc691d1ae8e09b17f2bf9@1393683 13f79535-47bb-0310-9956-ffa450edef68

--- proton-c/src/messenger.c
+++ proton-c/src/messenger.c
@@ -372,6 +372,14 @@
   return a == b || (a && b && !strcmp(a, b));
 }

+static const char *default_port(const char *scheme)
+{
+  if (scheme && pn_streq(scheme, "amqps"))
+    return "5671";
+  else
+    return "5672";
+}
+
 pn_connection_t *pn_messenger_resolve(pn_messenger_t *messenger, char *address, char **name)
 {
   char *scheme = NULL;
@@ -404,7 +412,9 @@
     ctor = pn_connector_next(ctor);
   }

-  pn_connector_t *connector = pn_connector(messenger->driver, host, port ? port : "5672", NULL);
+  pn_connector_t *connector = pn_connector(messenger->driver, host,
+                                           port ? port : default_port(scheme),
+                                           NULL);
   if (!connector) return NULL;
   pn_transport_t *transport = pn_connector_transport(connector);
   if (scheme && !strcmp(scheme, "amqps")) {
@@ -496,13 +506,15 @@
   char *user = NULL;
   char *pass = NULL;
   char *host = "0.0.0.0";
-  char *port = "5672";
+  char *port = NULL;
   char *path = NULL;

   parse_url(copy, &scheme, &user, &pass, &host, &port, &path);

   if (host[0] == '~') {
-    pn_listener_t *lnr = pn_listener(messenger->driver, host + 1, port, pn_strdup(scheme));
+    pn_listener_t *lnr = pn_listener(messenger->driver, host + 1,
+                                     port ? port : default_port(scheme),
+                                     pn_strdup(scheme));
     if (lnr) {
       return 0;
     } else {


Fix string interning equality comparison

--- src/cc1/str.c
+++ src/cc1/str.c
@@ -144,13 +144,14 @@

 int cstring_eq(const struct cstring *a, const struct cstring *b)
 {
+	enum { EQUAL, NOT_EQUAL };
 	size_t sz;
 	void *ap, *bp;

 	if(a->type != b->type)
-		return 0;
+		return NOT_EQUAL;
 	if(a->count != b->count)
-		return 0;
+		return NOT_EQUAL;

 	switch(a->type){
 		case CSTRING_WIDE:
@@ -166,7 +167,7 @@
 			break;
 	}

-	return !memcmp(ap, bp, sz * a->count);
+	return memcmp(ap, bp, sz * a->count);

 }


pango: add version related methods

pango: add version related methods

--- pango/ext/pango/rbpango.c
+++ pango/ext/pango/rbpango.c
@@ -1,6 +1,6 @@
 /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
 /*
- *  Copyright (C) 2011  Ruby-GNOME2 Project Team
+ *  Copyright (C) 2011-2015  Ruby-GNOME2 Project Team
  *  Copyright (C) 2002-2005 Masao Mutoh
  *
  *  This library is free software; you can redistribute it and/or
@@ -31,6 +31,40 @@
  * Rendering
  */

+static VALUE
+rg_s_version(G_GNUC_UNUSED VALUE self)
+{
+    return INT2NUM(pango_version());
+}
+
+static VALUE
+rg_s_version_string(G_GNUC_UNUSED VALUE self)
+{
+    return CSTR2RVAL(pango_version_string());
+}
+
+static VALUE
+rg_s_check_version(G_GNUC_UNUSED VALUE self,
+                   VALUE major, VALUE minor, VALUE micro)
+{
+    const gchar *error_message;
+    error_message = pango_version_check(NUM2INT(major),
+                                        NUM2INT(minor),
+                                        NUM2INT(micro));
+    return CSTR2RVAL(error_message);
+}
+
+static VALUE
+rg_s_check_version_p(G_GNUC_UNUSED VALUE self,
+                     VALUE major, VALUE minor, VALUE micro)
+{
+    const gchar *error_message;
+    error_message = pango_version_check(NUM2INT(major),
+                                        NUM2INT(minor),
+                                        NUM2INT(micro));
+    return CBOOL2RVAL(!error_message);
+}
+
 struct rpango_reorder_items_args {
     PangoItem *item;
     VALUE ary;
@@ -267,6 +301,10 @@
                                 INT2FIX(PANGO_VERSION_MINOR),
                                 INT2FIX(PANGO_VERSION_MICRO)));

+    RG_DEF_SMETHOD(version, 0);
+    RG_DEF_SMETHOD(version_string, 0);
+    RG_DEF_SMETHOD(check_version, 3);
+    RG_DEF_SMETHOD_P(check_version, 3);
     RG_DEF_SMETHOD(reorder_items, 1);
     RG_DEF_SMETHOD(unichar_direction, 1);
     RG_DEF_SMETHOD(find_base_dir, 1);


Implemented basic slicing, using beg and len.

Ranges are next.

--- ext/bitarray.c
+++ ext/bitarray.c
@@ -235,8 +235,8 @@
     VALUE z;
     struct bit_array *z_ba;
     z = rb_bitarray_alloc(rb_bitarray_class);
+    rb_bitarray_initialize(z, SIZET2NUM(x_ba->bits + y_ba->bits));
     Data_Get_Struct(z, struct bit_array, z_ba);
-    rb_bitarray_initialize(z, SIZET2NUM(x_ba->bits + y_ba->bits));

     /* For each bit set in x and y, set the corresponding bit in z.
      *
@@ -419,28 +419,93 @@
     }
 }

+/* Return an individual bit. */
+static VALUE
+rb_bitarray_get_bit(VALUE self, VALUE bit)
+{
+    struct bit_array *ba;
+    Data_Get_Struct(self, struct bit_array, ba);
+
+    ptrdiff_t index = NUM2SSIZET(bit);
+
+    int bit_value = get_bit(ba, index);
+
+    if (bit_value >= 0) {
+        return INT2NUM(bit_value);
+    } else {
+        rb_raise(rb_eIndexError, "index %ld out of bit array", (long)index);
+    }
+}
+
+
+/* Create a new BitArray from a subsequence of x. */
+static VALUE
+rb_bitarray_subseq(VALUE x, ptrdiff_t beg, ptrdiff_t len)
+{
+    /* Quick exit - a negative length returns nil. */
+    if (len < 0) {
+        return Qnil;
+    }
+
+    struct bit_array *x_ba;
+    Data_Get_Struct(x, struct bit_array, x_ba);
+
+    /* Make sure that we don't try getting more bits than x has. We handle this
+     * the same way as Array; if beg+len is past the end of x, shorten len.
+     */
+    if (beg < 0) {
+        beg += x_ba->bits;
+    }
+    if ((beg + len) > x_ba->bits) {
+        len -= ((beg + len) - x_ba->bits);
+    }
+
+    /* Create a new BitArray of the appropriate size. */
+    VALUE y;
+    struct bit_array *y_ba;
+    y = rb_bitarray_alloc(rb_bitarray_class);
+    rb_bitarray_initialize(y, SSIZET2NUM(len));
+    Data_Get_Struct(y, struct bit_array, y_ba);
+
+    /* For each set bit in x[beg..len], set the corresponding bit in y. */
+    size_t x_index, y_index;
+    for (x_index = beg, y_index = 0;
+            x_index < len;
+            x_index++, y_index++)
+    {
+        if (get_bit(x_ba, x_index) == 1) {
+            set_bit(y_ba, y_index);
+        }
+    }
+
+    return y;
+}
+

 /* call-seq:
  *      bitarray[index]         -> value
- *
- * Bit Reference---Returns the bit at _index_. Negative indices count backwards
+ *      bitarray[beg, len]      -> a_bitarray
+ *
+ * Bit Reference---Returns the bit at _index_, or returns a subarray starting
+ * at _beg_, and continuing for _len_ bits. Negative indices count backwards
  * from the end of _bitarray_. If _index_ is greater than the capacity of
  * _bitarray_, an +IndexError+ is raised.
  */
-static VALUE
-rb_bitarray_get_bit(VALUE self, VALUE bit)
-{
-    struct bit_array *ba;
-    Data_Get_Struct(self, struct bit_array, ba);
-
-    ptrdiff_t index = NUM2SSIZET(bit);
-
-    int bit_value = get_bit(ba, index);
-
-    if (bit_value >= 0) {
-        return INT2NUM(bit_value);
-    } else {
-        rb_raise(rb_eIndexError, "index %ld out of bit array", (long)index);
+
+static VALUE
+rb_bitarray_bitref(int argc, VALUE *argv, VALUE self)
+{
+    /* For now, we only handle a single index, or a starting index and a
+     * length. Eventually, we'll also handle ranges.
+     */
+    if (argc == 1){
+        return rb_bitarray_get_bit(self, argv[0]);
+    } else if (argc == 2) {
+        ptrdiff_t beg = NUM2SSIZET(argv[0]);
+        ptrdiff_t len = NUM2SSIZET(argv[1]);
+        return rb_bitarray_subseq(self, beg, len);
+    } else {
+        rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc);
     }
 }

@@ -559,7 +624,7 @@
             rb_bitarray_toggle_bit, 1);
     rb_define_method(rb_bitarray_class, "toggle_all_bits",
             rb_bitarray_toggle_all_bits, 0);
-    rb_define_method(rb_bitarray_class, "[]", rb_bitarray_get_bit, 1);
+    rb_define_method(rb_bitarray_class, "[]", rb_bitarray_bitref, -1);
     rb_define_method(rb_bitarray_class, "[]=", rb_bitarray_assign_bit, 2);
     rb_define_method(rb_bitarray_class, "inspect", rb_bitarray_inspect, 0);
     rb_define_alias(rb_bitarray_class, "to_s", "inspect");


initilizing string that's the size of the read buffer

--- ext/yajl.c
+++ ext/yajl.c
@@ -120,7 +120,7 @@

     // allocate our parser
     hand = yajl_alloc(&callbacks, &cfg, NULL, (void *)ctx);
-    VALUE parsed = rb_str_new("", 0);
+    VALUE parsed = rb_str_new("", bufferSize);
     VALUE rbufsize = INT2FIX(bufferSize);

     // now parse from the IO


Replaced 'bus.h' with 'Instrument.h' for #include

--- insts/base/MIX/MIX.h
+++ insts/base/MIX/MIX.h
@@ -1,4 +1,4 @@
-#include <bus.h>        /* for MAXBUS */
+#include <Instrument.h>

 class MIX : public Instrument {
 	int outchan[MAXBUS];


r300/compiler: make lowering passes possibly use up to two less temps

CMP may now use two less temps, other non-native instructions may end up
using one less temp, except for SIN/COS/SCS, which I am leaving unchanged
for now.

This may reduce register pressure inside loops, because the register
allocator doesn't do a very good job there.

--- src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
+++ src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
@@ -83,16 +83,6 @@
 	fpi->U.I.SrcReg[1] = SrcReg1;
 	fpi->U.I.SrcReg[2] = SrcReg2;
 	return fpi;
-}
-
-static struct rc_dst_register dstreg(int file, int index)
-{
-	struct rc_dst_register dst;
-	dst.File = file;
-	dst.Index = index;
-	dst.WriteMask = RC_MASK_XYZW;
-	dst.RelAddr = 0;
-	return dst;
 }

 static struct rc_dst_register dstregtmpmask(int index, int mask)
@@ -187,6 +177,38 @@
 	return swizzle_smear(reg, RC_SWIZZLE_W);
 }

+static int is_dst_safe_to_reuse(struct rc_instruction *inst)
+{
+	const struct rc_opcode_info *info = rc_get_opcode_info(inst->U.I.Opcode);
+	unsigned i;
+
+	assert(info->HasDstReg);
+
+	if (inst->U.I.DstReg.File != RC_FILE_TEMPORARY)
+		return 0;
+
+	for (i = 0; i < info->NumSrcRegs; i++) {
+		if (inst->U.I.SrcReg[i].File == RC_FILE_TEMPORARY &&
+		    inst->U.I.SrcReg[i].Index == inst->U.I.DstReg.Index)
+			return 0;
+	}
+
+	return 1;
+}
+
+static struct rc_dst_register try_to_reuse_dst(struct radeon_compiler *c,
+					       struct rc_instruction *inst)
+{
+	unsigned tmp;
+
+	if (is_dst_safe_to_reuse(inst))
+		tmp = inst->U.I.DstReg.Index;
+	else
+		tmp = rc_find_free_temporary(c);
+
+	return dstregtmpmask(tmp, inst->U.I.DstReg.WriteMask);
+}
+
 static void transform_ABS(struct radeon_compiler* c,
 	struct rc_instruction* inst)
 {
@@ -210,10 +232,10 @@
 	 *     ceil(x) = x+frac(-x)
 	 */

-	int tempreg = rc_find_free_temporary(c);
-	emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstreg(RC_FILE_TEMPORARY, tempreg), negate(inst->U.I.SrcReg[0]));
+	struct rc_dst_register dst = try_to_reuse_dst(c, inst);
+	emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dst, negate(inst->U.I.SrcReg[0]));
 	emit2(c, inst->Prev, RC_OPCODE_ADD, inst->U.I.SaturateMode, inst->U.I.DstReg,
-		inst->U.I.SrcReg[0], srcreg(RC_FILE_TEMPORARY, tempreg));
+		inst->U.I.SrcReg[0], srcreg(RC_FILE_TEMPORARY, dst.Index));
 	rc_remove_instruction(inst);
 }

@@ -225,11 +247,11 @@
 	 * MIN tmp, src, max
 	 * MAX dst, tmp, min
 	 */
-	int tempreg = rc_find_free_temporary(c);
-	emit2(c, inst->Prev, RC_OPCODE_MIN, 0, dstreg(RC_FILE_TEMPORARY, tempreg),
+	struct rc_dst_register dst = try_to_reuse_dst(c, inst);
+	emit2(c, inst->Prev, RC_OPCODE_MIN, 0, dst,
 		inst->U.I.SrcReg[0], inst->U.I.SrcReg[2]);
 	emit2(c, inst->Prev, RC_OPCODE_MAX, inst->U.I.SaturateMode, inst->U.I.DstReg,
-		srcreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[1]);
+		srcreg(RC_FILE_TEMPORARY, dst.Index), inst->U.I.SrcReg[1]);
 	rc_remove_instruction(inst);
 }

@@ -275,10 +297,10 @@
 static void transform_FLR(struct radeon_compiler* c,
 	struct rc_instruction* inst)
 {
-	int tempreg = rc_find_free_temporary(c);
-	emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[0]);
+	struct rc_dst_register dst = try_to_reuse_dst(c, inst);
+	emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dst, inst->U.I.SrcReg[0]);
 	emit2(c, inst->Prev, RC_OPCODE_ADD, inst->U.I.SaturateMode, inst->U.I.DstReg,
-		inst->U.I.SrcReg[0], negate(srcreg(RC_FILE_TEMPORARY, tempreg)));
+		inst->U.I.SrcReg[0], negate(srcreg(RC_FILE_TEMPORARY, dst.Index)));
 	rc_remove_instruction(inst);
 }

@@ -368,14 +390,14 @@
 static void transform_LRP(struct radeon_compiler* c,
 	struct rc_instruction* inst)
 {
-	int tempreg = rc_find_free_temporary(c);
+	struct rc_dst_register dst = try_to_reuse_dst(c, inst);

 	emit2(c, inst->Prev, RC_OPCODE_ADD, 0,
-		dstreg(RC_FILE_TEMPORARY, tempreg),
+		dst,
 		inst->U.I.SrcReg[1], negate(inst->U.I.SrcReg[2]));
 	emit3(c, inst->Prev, RC_OPCODE_MAD, inst->U.I.SaturateMode,
 		inst->U.I.DstReg,
-		inst->U.I.SrcReg[0], srcreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[2]);
+		inst->U.I.SrcReg[0], srcreg(RC_FILE_TEMPORARY, dst.Index), inst->U.I.SrcReg[2]);

 	rc_remove_instruction(inst);
 }
@@ -383,9 +405,8 @@
 static void transform_POW(struct radeon_compiler* c,
 	struct rc_instruction* inst)
 {
-	int tempreg = rc_find_free_temporary(c);
-	struct rc_dst_register tempdst = dstreg(RC_FILE_TEMPORARY, tempreg);
-	struct rc_src_register tempsrc = srcreg(RC_FILE_TEMPORARY, tempreg);
+	struct rc_dst_register tempdst = try_to_reuse_dst(c, inst);
+	struct rc_src_register tempsrc = srcreg(RC_FILE_TEMPORARY, tempdst.Index);
 	tempdst.WriteMask = RC_MASK_W;
 	tempsrc.Swizzle = RC_SWIZZLE_WWWW;

@@ -405,11 +426,11 @@
 static void transform_SEQ(struct radeon_compiler* c,
 	struct rc_instruction* inst)
 {
-	int tempreg = rc_find_free_temporary(c);
-
-	emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
+	struct rc_dst_register dst = try_to_reuse_dst(c, inst);
+
+	emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
 	emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
-		negate(absolute(srcreg(RC_FILE_TEMPORARY, tempreg))), builtin_zero, builtin_one);
+		negate(absolute(srcreg(RC_FILE_TEMPORARY, dst.Index))), builtin_zero, builtin_one);

 	rc_remove_instruction(inst);
 }
@@ -424,11 +445,11 @@
 static void transform_SGE(struct radeon_compiler* c,
 	struct rc_instruction* inst)
 {
-	int tempreg = rc_find_free_temporary(c);
-
-	emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
+	struct rc_dst_register dst = try_to_reuse_dst(c, inst);
+
+	emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
 	emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
-		srcreg(RC_FILE_TEMPORARY, tempreg), builtin_zero, builtin_one);
+		srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_zero, builtin_one);

 	rc_remove_instruction(inst);
 }
@@ -436,11 +457,11 @@
 static void transform_SGT(struct radeon_compiler* c,
 	struct rc_instruction* inst)
 {
-	int tempreg = rc_find_free_temporary(c);
-
-	emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
+	struct rc_dst_register dst = try_to_reuse_dst(c, inst);
+
+	emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
 	emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
-		srcreg(RC_FILE_TEMPORARY, tempreg), builtin_one, builtin_zero);
+		srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_one, builtin_zero);

 	rc_remove_instruction(inst);
 }
@@ -448,11 +469,11 @@
 static void transform_SLE(struct radeon_compiler* c,
 	struct rc_instruction* inst)
 {
-	int tempreg = rc_find_free_temporary(c);
-
-	emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
+	struct rc_dst_register dst = try_to_reuse_dst(c, inst);
+
+	emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]);
 	emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
-		srcreg(RC_FILE_TEMPORARY, tempreg), builtin_zero, builtin_one);
+		srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_zero, builtin_one);

 	rc_remove_instruction(inst);
 }
@@ -460,11 +481,11 @@
 static void transform_SLT(struct radeon_compiler* c,
 	struct rc_instruction* inst)
 {
-	int tempreg = rc_find_free_temporary(c);
-
-	emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
+	struct rc_dst_register dst = try_to_reuse_dst(c, inst);
+
+	emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
 	emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
-		srcreg(RC_FILE_TEMPORARY, tempreg), builtin_one, builtin_zero);
+		srcreg(RC_FILE_TEMPORARY, dst.Index), builtin_one, builtin_zero);

 	rc_remove_instruction(inst);
 }
@@ -472,11 +493,11 @@
 static void transform_SNE(struct radeon_compiler* c,
 	struct rc_instruction* inst)
 {
-	int tempreg = rc_find_free_temporary(c);
-
-	emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
+	struct rc_dst_register dst = try_to_reuse_dst(c, inst);
+
+	emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dst, inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1]));
 	emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg,
-		negate(absolute(srcreg(RC_FILE_TEMPORARY, tempreg))), builtin_one, builtin_zero);
+		negate(absolute(srcreg(RC_FILE_TEMPORARY, dst.Index))), builtin_one, builtin_zero);

 	rc_remove_instruction(inst);
 }
@@ -490,12 +511,13 @@
 	 *   CMP tmp1, x, 1, 0
 	 *   ADD result, tmp0, -tmp1;
 	 */
-	unsigned tmp0, tmp1;
+	struct rc_dst_register dst0;
+	unsigned tmp1;

 	/* 0 < x */
-	tmp0 = rc_find_free_temporary(c);
+	dst0 = try_to_reuse_dst(c, inst);
 	emit3(c, inst->Prev, RC_OPCODE_CMP, 0,
-	      dstregtmpmask(tmp0, inst->U.I.DstReg.WriteMask),
+	      dst0,
 	      negate(inst->U.I.SrcReg[0]),
 	      builtin_one,
 	      builtin_zero);
@@ -512,7 +534,7 @@
 	/* result = tmp0 - tmp1 */
 	emit2(c, inst->Prev, RC_OPCODE_ADD, 0,
 	      inst->U.I.DstReg,
-	      srcreg(RC_FILE_TEMPORARY, tmp0),
+	      srcreg(RC_FILE_TEMPORARY, dst0.Index),
 	      negate(srcreg(RC_FILE_TEMPORARY, tmp1)));

 	rc_remove_instruction(inst);
@@ -534,15 +556,15 @@
 static void transform_XPD(struct radeon_compiler* c,
 	struct rc_instruction* inst)
 {
-	int tempreg = rc_find_free_temporary(c);
-
-	emit2(c, inst->Prev, RC_OPCODE_MUL, 0, dstreg(RC_FILE_TEMPORARY, tempreg),
+	struct rc_dst_register dst = try_to_reuse_dst(c, inst);
+
+	emit2(c, inst->Prev, RC_OPCODE_MUL, 0, dst,
 		swizzle(inst->U.I.SrcReg[0], RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_W),
 		swizzle(inst->U.I.SrcReg[1], RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_W));
 	emit3(c, inst->Prev, RC_OPCODE_MAD, inst->U.I.SaturateMode, inst->U.I.DstReg,
 		swizzle(inst->U.I.SrcReg[0], RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_W),
 		swizzle(inst->U.I.SrcReg[1], RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_W),
-		negate(srcreg(RC_FILE_TEMPORARY, tempreg)));
+		negate(srcreg(RC_FILE_TEMPORARY, dst.Index)));

 	rc_remove_instruction(inst);
 }
@@ -610,7 +632,7 @@
 {
 	/* There is no decent CMP available, so let's rig one up.
 	 * CMP is defined as dst = src0 < 0.0 ? src1 : src2
-	 * The following sequence consumes two temps and two extra slots
+	 * The following sequence consumes zero to two temps and two extra slots
 	 * (the second temp and the second slot is consumed by transform_LRP),
 	 * but should be equivalent:
 	 *
@@ -618,18 +640,18 @@
 	 * LRP dst, tmp0, src1, src2
 	 *
 	 * Yes, I know, I'm a mad scientist. ~ C. & M. */
-	int tempreg0 = rc_find_free_temporary(c);
+	struct rc_dst_register dst = try_to_reuse_dst(c, inst);

 	/* SLT tmp0, src0, 0.0 */
 	emit2(c, inst->Prev, RC_OPCODE_SLT, 0,
-		dstreg(RC_FILE_TEMPORARY, tempreg0),
+		dst,
 		inst->U.I.SrcReg[0], builtin_zero);

 	/* LRP dst, tmp0, src1, src2 */
 	transform_LRP(c,
 		emit3(c, inst->Prev, RC_OPCODE_LRP, 0,
 		      inst->U.I.DstReg,
-		      srcreg(RC_FILE_TEMPORARY, tempreg0), inst->U.I.SrcReg[1],  inst->U.I.SrcReg[2]));
+		      srcreg(RC_FILE_TEMPORARY, dst.Index), inst->U.I.SrcReg[1],  inst->U.I.SrcReg[2]));

 	rc_remove_instruction(inst);
 }
@@ -660,7 +682,7 @@
 static void transform_r300_vertex_fix_LIT(struct radeon_compiler* c,
 	struct rc_instruction* inst)
 {
-	int tempreg = rc_find_free_temporary(c);
+	struct rc_dst_register dst = try_to_reuse_dst(c, inst);
 	unsigned constant_swizzle;
 	int constant = rc_constants_add_immediate_scalar(&c->Program.Constants,
 							 0.0000000000000000001,
@@ -668,16 +690,16 @@

 	/* MOV dst, src */
 	emit1(c, inst->Prev, RC_OPCODE_MOV, 0,
-		dstreg(RC_FILE_TEMPORARY, tempreg),
+		dst,
 		inst->U.I.SrcReg[0]);

 	/* MAX dst.z, src, 0.00...001 */
 	emit2(c, inst->Prev, RC_OPCODE_MAX, 0,
-		dstregtmpmask(tempreg, RC_MASK_Y),
-		srcreg(RC_FILE_TEMPORARY, tempreg),
+		dstregtmpmask(dst.Index, RC_MASK_Y),
+		srcreg(RC_FILE_TEMPORARY, dst.Index),
 		srcregswz(RC_FILE_CONSTANT, constant, constant_swizzle));

-	inst->U.I.SrcReg[0] = srcreg(RC_FILE_TEMPORARY, tempreg);
+	inst->U.I.SrcReg[0] = srcreg(RC_FILE_TEMPORARY, dst.Index);
 }

 static void transform_r300_vertex_SEQ(struct radeon_compiler *c,
@@ -761,12 +783,13 @@
 	 *   SLT tmp1, x, 0;
 	 *   ADD result, tmp0, -tmp1;
 	 */
-	unsigned tmp0, tmp1;
+	struct rc_dst_register dst0 = try_to_reuse_dst(c, inst);
+	unsigned tmp1;

 	/* 0 < x */
-	tmp0 = rc_find_free_temporary(c);
+	dst0 = try_to_reuse_dst(c, inst);
 	emit2(c, inst->Prev, RC_OPCODE_SLT, 0,
-	      dstregtmpmask(tmp0, inst->U.I.DstReg.WriteMask),
+	      dst0,
 	      builtin_zero,
 	      inst->U.I.SrcReg[0]);

@@ -781,7 +804,7 @@
 	/* result = tmp0 - tmp1 */
 	emit2(c, inst->Prev, RC_OPCODE_ADD, 0,
 	      inst->U.I.DstReg,
-	      srcreg(RC_FILE_TEMPORARY, tmp0),
+	      srcreg(RC_FILE_TEMPORARY, dst0.Index),
 	      negate(srcreg(RC_FILE_TEMPORARY, tmp1)));

 	rc_remove_instruction(inst);


regenerated

regenerated


warn----

warn----

git-svn-id: 6ac5796aeae0cef97fb47bcc287d4ce899c6fa6e@62871 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/modules/conf_keybindings/e_int_config_keybindings.c
+++ src/modules/conf_keybindings/e_int_config_keybindings.c
@@ -856,7 +856,7 @@
         if (bi == bi_new) ret = bi_pos;
         if (ret < 0) bi_pos++;

-        if (modifiers != bi->modifiers)
+        if (modifiers != (int)bi->modifiers)
           {
              modifiers = bi->modifiers;
              b = _key_binding_header_get(modifiers);
@@ -1052,7 +1052,7 @@
           {
              E_Config_Binding_Key *bi = NULL, *bi2 = NULL;
              Eina_List *l = NULL;
-             int mod = E_BINDING_MODIFIER_NONE;
+             unsigned int mod = E_BINDING_MODIFIER_NONE;
              int found = 0, n;

              if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)


Need to strdup the params, as they are free'd later.

git-svn-id: 0f3f1c46c6da7ffd142db61e503a7ff63af3a195@32268 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/modules/conf_keybindings/e_int_config_keybindings.c
+++ src/modules/conf_keybindings/e_int_config_keybindings.c
@@ -93,7 +93,7 @@
 			     "enlightenment/keys", 0, v, NULL);
    if ((params) && (params[0]))
      {
-	cfd->cfdata->params = params;
+	cfd->cfdata->params = strdup(params);
 	_add_key_binding_cb(cfd->cfdata, NULL);
      }