Clean up vector serialization.

Clean up vector serialization.

--- src/serialize.h
+++ src/serialize.h
@@ -510,32 +510,34 @@
 template<typename Stream, unsigned int N, typename T> inline void Unserialize(Stream& is, prevector<N, T>& v);

 /**
+ * vectoroverwritewrapper
+ * used by compactsizevectorwrapper, varintvectorwrapper, nosizevectorwrapper to allow template specilisation of serilisation with as little overhead as possible.
+ */
+template <typename VectorType, typename WrapperType> class vectoroverwritewrapper
+{
+public:
+    VectorType& vector;
+    vectoroverwritewrapper(VectorType& vector_) : vector(vector_)
+    {
+    }
+};
+
+/**
  * compactsizevectorwrapper
  * same as normal vector but using compact size to represent the size when serializing
  */
-template <typename T1, typename T2> class pairr
-{
-public:
-    T1& first;
-    T2& second;
-    pairr(T1& first_, T2& second_) : first(first_), second(second_) {};
-};
-
-
 struct compactsizevectorwrapper
 {
     compactsizevectorwrapper() {};
 };

-template<typename T> pairr<T, compactsizevectorwrapper> MakeCompactSizeVector(T& obj)
-{
-    compactsizevectorwrapper wrap;
-    return pairr<T, compactsizevectorwrapper> (obj, wrap);
-}
-template<typename T> const pairr<const T, const compactsizevectorwrapper> MakeCompactSizeVector(const T& obj)
-{
-    const compactsizevectorwrapper wrap;
-    return pairr<const T, const compactsizevectorwrapper> (obj, wrap);
+template<typename T> vectoroverwritewrapper<T, compactsizevectorwrapper> MakeCompactSizeVector(T& obj)
+{
+    return vectoroverwritewrapper<T, compactsizevectorwrapper> (obj);
+}
+template<typename T> const vectoroverwritewrapper<const T, const compactsizevectorwrapper> MakeCompactSizeVector(const T& obj)
+{
+    return vectoroverwritewrapper<const T, const compactsizevectorwrapper> (obj);
 }

 #define COMPACTSIZEVECTOR(obj) REF(MakeCompactSizeVector(obj))
@@ -550,15 +552,13 @@
     varintvectorwrapper() {};
 };

-template<typename T> pairr<T, varintvectorwrapper> MakeVarIntVector(T& obj)
-{
-    varintvectorwrapper wrap;
-    return pairr<T, varintvectorwrapper> (obj, wrap);
-}
-template<typename T> const pairr<const T, const varintvectorwrapper> MakeVarIntVector(const T& obj)
-{
-    const varintvectorwrapper wrap;
-    return pairr<const T, const varintvectorwrapper> (obj, wrap);
+template<typename T> vectoroverwritewrapper<T, varintvectorwrapper> MakeVarIntVector(T& obj)
+{
+    return vectoroverwritewrapper<T, varintvectorwrapper> (obj);
+}
+template<typename T> const vectoroverwritewrapper<const T, const varintvectorwrapper> MakeVarIntVector(const T& obj)
+{
+    return vectoroverwritewrapper<const T, const varintvectorwrapper> (obj);
 }

 #define VARINTVECTOR(obj) REF(MakeVarIntVector(REF(obj)))
@@ -573,15 +573,13 @@
     nosizevectorwrapper() {};
 };

-template<typename T> pairr<T, nosizevectorwrapper> MakeNoSizeVector(T& obj)
-{
-    nosizevectorwrapper wrap;
-    return pairr<T, nosizevectorwrapper> (obj, wrap);
-}
-template<typename T> const pairr<const T, const nosizevectorwrapper> MakeNoSizeVector(const T& obj)
-{
-    const nosizevectorwrapper wrap;
-    return pairr<const T, const nosizevectorwrapper> (obj, wrap);
+template<typename T> vectoroverwritewrapper<T, nosizevectorwrapper> MakeNoSizeVector(T& obj)
+{
+    return vectoroverwritewrapper<T, nosizevectorwrapper> (obj);
+}
+template<typename T> const vectoroverwritewrapper<const T, const nosizevectorwrapper> MakeNoSizeVector(const T& obj)
+{
+    return vectoroverwritewrapper<const T, const nosizevectorwrapper> (obj);
 }

 #define NOSIZEVECTOR(obj) REF(MakeNoSizeVector(REF(obj)))
@@ -768,54 +766,54 @@
  * vector
  */
 template<typename Stream, typename K>
-void Serialize(Stream& os, const pairr<const std::vector<K>, const compactsizevectorwrapper>& item)
-{
-    const std::vector<K>& v = item.first;
+void Serialize(Stream& os, const vectoroverwritewrapper<const std::vector<K>, const compactsizevectorwrapper>& item)
+{
+    const std::vector<K>& v = item.vector;
     WriteCompactSize(os, v.size());
     for (typename std::vector<K>::const_iterator vi = v.begin(); vi != v.end(); ++vi)
         ::Serialize(os, (*vi));
 }

 template<typename Stream, typename K>
-void Serialize(Stream& os, const pairr<std::vector<K>, compactsizevectorwrapper>& item)
-{
-    const std::vector<K>& v = item.first;
+void Serialize(Stream& os, const vectoroverwritewrapper<std::vector<K>, compactsizevectorwrapper>& item)
+{
+    const std::vector<K>& v = item.vector;
     WriteCompactSize(os, v.size());
     for (typename std::vector<K>::const_iterator vi = v.begin(); vi != v.end(); ++vi)
         ::Serialize(os, (*vi));
 }

 template<typename Stream, typename K>
-void Serialize(Stream& os, const pairr<const std::vector<std::vector<K>>, const compactsizevectorwrapper>& item)
-{
-    const std::vector<std::vector<K>>& v = item.first;
+void Serialize(Stream& os, const vectoroverwritewrapper<const std::vector<std::vector<K>>, const compactsizevectorwrapper>& item)
+{
+    const std::vector<std::vector<K>>& v = item.vector;
     WriteCompactSize(os, v.size());
     for (typename std::vector<std::vector<K>>::const_iterator vi = v.begin(); vi != v.end(); ++vi)
         ::Serialize(os, COMPACTSIZEVECTOR(*vi));
 }

 template<typename Stream>
-void Serialize(Stream& os, const pairr<const std::vector<unsigned char>, const compactsizevectorwrapper>& item)
-{
-    const std::vector<unsigned char>& v = item.first;
+void Serialize(Stream& os, const vectoroverwritewrapper<const std::vector<unsigned char>, const compactsizevectorwrapper>& item)
+{
+    const std::vector<unsigned char>& v = item.vector;
     WriteCompactSize(os, v.size());
     if (!v.empty())
         os.write((char*)&v[0], v.size() * sizeof(unsigned char));
 }

 template<typename Stream>
-void Serialize(Stream& os, const pairr<std::vector<unsigned char>, const compactsizevectorwrapper>& item)
-{
-    const std::vector<unsigned char>& v = item.first;
+void Serialize(Stream& os, const vectoroverwritewrapper<std::vector<unsigned char>, const compactsizevectorwrapper>& item)
+{
+    const std::vector<unsigned char>& v = item.vector;
     WriteCompactSize(os, v.size());
     if (!v.empty())
         os.write((char*)&v[0], v.size() * sizeof(unsigned char));
 }

 template<typename Stream>
-void Serialize(Stream& os, const pairr<std::vector<unsigned char>, compactsizevectorwrapper>& item)
-{
-    const std::vector<unsigned char>& v = item.first;
+void Serialize(Stream& os, const vectoroverwritewrapper<std::vector<unsigned char>, compactsizevectorwrapper>& item)
+{
+    const std::vector<unsigned char>& v = item.vector;
     WriteCompactSize(os, v.size());
     if (!v.empty())
         os.write((char*)&v[0], v.size() * sizeof(unsigned char));
@@ -825,27 +823,27 @@

 template<typename Stream, typename A>
-void Serialize(Stream& os, const pairr<const std::vector<unsigned char, A>, const compactsizevectorwrapper>& item)
-{
-    const std::vector<unsigned char, A>& v = item.first;
+void Serialize(Stream& os, const vectoroverwritewrapper<const std::vector<unsigned char, A>, const compactsizevectorwrapper>& item)
+{
+    const std::vector<unsigned char, A>& v = item.vector;
     WriteCompactSize(os, v.size());
     if (!v.empty())
         os.write((char*)&v[0], v.size() * sizeof(unsigned char));
 }

 template<typename Stream, typename A>
-void Serialize(Stream& os, const pairr<std::vector<unsigned char, A>, const compactsizevectorwrapper>& item)
-{
-    const std::vector<unsigned char, A>& v = item.first;
+void Serialize(Stream& os, const vectoroverwritewrapper<std::vector<unsigned char, A>, const compactsizevectorwrapper>& item)
+{
+    const std::vector<unsigned char, A>& v = item.vector;
     WriteCompactSize(os, v.size());
     if (!v.empty())
         os.write((char*)&v[0], v.size() * sizeof(unsigned char));
 }

 template<typename Stream, typename A>
-void Serialize(Stream& os, const pairr<std::vector<unsigned char, A>, compactsizevectorwrapper>& item)
-{
-    const std::vector<unsigned char, A>& v = item.first;
+void Serialize(Stream& os, const vectoroverwritewrapper<std::vector<unsigned char, A>, compactsizevectorwrapper>& item)
+{
+    const std::vector<unsigned char, A>& v = item.vector;
     WriteCompactSize(os, v.size());
     if (!v.empty())
         os.write((char*)&v[0], v.size() * sizeof(unsigned char));
@@ -855,9 +853,9 @@

 template<typename Stream, typename K>
-void Unserialize(Stream& is, pairr<std::vector<K>, compactsizevectorwrapper>& item)
-{
-    std::vector<K>& v = item.first;
+void Unserialize(Stream& is, vectoroverwritewrapper<std::vector<K>, compactsizevectorwrapper>& item)
+{
+    std::vector<K>& v = item.vector;
     v.clear();
     unsigned int nSize = ReadCompactSize(is);
     unsigned int i = 0;
@@ -874,9 +872,9 @@
 }

 template<typename Stream, typename K>
-void Unserialize(Stream& is, pairr<std::vector<std::vector<K>>, compactsizevectorwrapper>& item)
-{
-    std::vector<std::vector<K>>& v = item.first;
+void Unserialize(Stream& is, vectoroverwritewrapper<std::vector<std::vector<K>>, compactsizevectorwrapper>& item)
+{
+    std::vector<std::vector<K>>& v = item.vector;
     v.clear();
     unsigned int nSize = ReadCompactSize(is);
     unsigned int i = 0;
@@ -893,9 +891,9 @@
 }

 template<typename Stream>
-void Unserialize(Stream& is, pairr<std::vector<unsigned char>, compactsizevectorwrapper>& item)
-{
-    std::vector<unsigned char>& v = item.first;
+void Unserialize(Stream& is, vectoroverwritewrapper<std::vector<unsigned char>, compactsizevectorwrapper>& item)
+{
+    std::vector<unsigned char>& v = item.vector;
     v.clear();
     unsigned int nSize = ReadCompactSize(is);
     unsigned int i = 0;
@@ -909,9 +907,9 @@
 }

 template<typename Stream, typename A>
-void Unserialize(Stream& is, pairr<std::vector<unsigned char, A>, compactsizevectorwrapper>& item)
-{
-    std::vector<unsigned char, A>& v = item.first;
+void Unserialize(Stream& is, vectoroverwritewrapper<std::vector<unsigned char, A>, compactsizevectorwrapper>& item)
+{
+    std::vector<unsigned char, A>& v = item.vector;
     v.clear();
     unsigned int nSize = ReadCompactSize(is);
     unsigned int i = 0;
@@ -925,9 +923,9 @@
 }

 template<typename Stream>
-void Unserialize(Stream& is, const pairr<std::vector<unsigned char>, compactsizevectorwrapper>& item)
-{
-    std::vector<unsigned char>& v = item.first;
+void Unserialize(Stream& is, const vectoroverwritewrapper<std::vector<unsigned char>, compactsizevectorwrapper>& item)
+{
+    std::vector<unsigned char>& v = item.vector;
     v.clear();
     unsigned int nSize = ReadCompactSize(is);
     unsigned int i = 0;
@@ -941,9 +939,9 @@
 }

 template<typename Stream, typename A>
-void Unserialize(Stream& is, const pairr<std::vector<unsigned char, A>, compactsizevectorwrapper>& item)
-{
-    std::vector<unsigned char, A>& v = item.first;
+void Unserialize(Stream& is, const vectoroverwritewrapper<std::vector<unsigned char, A>, compactsizevectorwrapper>& item)
+{
+    std::vector<unsigned char, A>& v = item.vector;
     v.clear();
     unsigned int nSize = ReadCompactSize(is);
     unsigned int i = 0;
@@ -957,9 +955,9 @@
 }

 template<typename Stream, typename A>
-void Unserialize(Stream& is, pairr<const std::vector<unsigned char, A>, compactsizevectorwrapper>& item)
-{
-    std::vector<unsigned char, A>& v = item.first;
+void Unserialize(Stream& is, vectoroverwritewrapper<const std::vector<unsigned char, A>, compactsizevectorwrapper>& item)
+{
+    std::vector<unsigned char, A>& v = item.vector;
     v.clear();
     unsigned int nSize = ReadCompactSize(is);
     unsigned int i = 0;
@@ -976,27 +974,27 @@
  * varintvectorwrapper
  */
 template<typename Stream, typename K>
-void Serialize(Stream& os, const pairr<std::vector<K>, varintvectorwrapper>& item)
-{
-    const std::vector<K>& v = item.first;
+void Serialize(Stream& os, const vectoroverwritewrapper<std::vector<K>, varintvectorwrapper>& item)
+{
+    const std::vector<K>& v = item.vector;
     WriteVarInt(os, v.size());
     for (typename std::vector<K>::const_iterator vi = v.begin(); vi != v.end(); ++vi)
         ::Serialize(os, (*vi));
 }

 template<typename Stream, typename K>
-void Serialize(Stream& os, pairr<std::vector<K>, varintvectorwrapper>& item)
-{
-    std::vector<K>& v = item.first;
+void Serialize(Stream& os, vectoroverwritewrapper<std::vector<K>, varintvectorwrapper>& item)
+{
+    std::vector<K>& v = item.vector;
     WriteVarInt(os, v.size());
     for (typename std::vector<K>::const_iterator vi = v.begin(); vi != v.end(); ++vi)
         ::Serialize(os, (*vi));
 }

 template<typename Stream, typename K>
-void Serialize(Stream& os, const pairr<std::vector<std::vector<K>>, varintvectorwrapper>& item)
-{
-    const std::vector<std::vector<K>>& v = item.first;
+void Serialize(Stream& os, const vectoroverwritewrapper<std::vector<std::vector<K>>, varintvectorwrapper>& item)
+{
+    const std::vector<std::vector<K>>& v = item.vector;
     WriteVarInt(os, v.size());
     for (typename std::vector<std::vector<K>>::const_iterator vi = v.begin(); vi != v.end(); ++vi)
         ::Serialize(os, VARINTVECTOR(*vi));
@@ -1005,27 +1003,27 @@

 template<typename Stream>
-void Serialize(Stream& os, const pairr<std::vector<unsigned char>, varintvectorwrapper>& item)
-{
-    const std::vector<unsigned char>& v = item.first;
+void Serialize(Stream& os, const vectoroverwritewrapper<std::vector<unsigned char>, varintvectorwrapper>& item)
+{
+    const std::vector<unsigned char>& v = item.vector;
     WriteVarInt(os, v.size());
     if (!v.empty())
         os.write((char*)&v[0], v.size() * sizeof(unsigned char));
 }

 template<typename Stream>
-void Serialize(Stream& os, pairr<std::vector<unsigned char>, varintvectorwrapper>& item)
-{
-    std::vector<unsigned char>& v = item.first;
+void Serialize(Stream& os, vectoroverwritewrapper<std::vector<unsigned char>, varintvectorwrapper>& item)
+{
+    std::vector<unsigned char>& v = item.vector;
     WriteVarInt(os, v.size());
     if (!v.empty())
         os.write((char*)&v[0], v.size() * sizeof(unsigned char));
 }

 template<typename Stream, typename K>
-void Unserialize(Stream& is, pairr<std::vector<K>, varintvectorwrapper>& item)
-{
-    std::vector<K>& v = item.first;
+void Unserialize(Stream& is, vectoroverwritewrapper<std::vector<K>, varintvectorwrapper>& item)
+{
+    std::vector<K>& v = item.vector;
     v.clear();
     unsigned int nSize = ReadVarInt<Stream, unsigned int>(is);
     unsigned int i = 0;
@@ -1042,9 +1040,9 @@
 }

 template<typename Stream, typename K>
-void Unserialize(Stream& is, pairr<std::vector<std::vector<K>>, varintvectorwrapper>& item)
-{
-    std::vector<std::vector<K>>& v = item.first;
+void Unserialize(Stream& is, vectoroverwritewrapper<std::vector<std::vector<K>>, varintvectorwrapper>& item)
+{
+    std::vector<std::vector<K>>& v = item.vector;
     v.clear();
     unsigned int nSize = ReadVarInt<Stream, unsigned int>(is);
     unsigned int i = 0;
@@ -1068,25 +1066,25 @@
  * nosizevectorwrapper
  */
 template<typename Stream, typename K>
-void Serialize(Stream& os, const pairr<std::vector<K>, nosizevectorwrapper>& item)
-{
-    const std::vector<K>& v = item.first;
+void Serialize(Stream& os, const vectoroverwritewrapper<std::vector<K>, nosizevectorwrapper>& item)
+{
+    const std::vector<K>& v = item.vector;
     for (typename std::vector<K>::const_iterator vi = v.begin(); vi != v.end(); ++vi)
         ::Serialize(os, (*vi));
 }

 template<typename Stream>
-void Serialize(Stream& os, const pairr<const std::vector<unsigned char>, nosizevectorwrapper>& item)
-{
-    const std::vector<unsigned char>& v = item.first;
+void Serialize(Stream& os, const vectoroverwritewrapper<const std::vector<unsigned char>, nosizevectorwrapper>& item)
+{
+    const std::vector<unsigned char>& v = item.vector;
     if (!v.empty())
         os.write((char*)&v[0], v.size() * sizeof(unsigned char));
 }

 template<typename Stream, typename K>
-void Unserialize(Stream& is, pairr<std::vector<K>, nosizevectorwrapper>& item)
-{
-    std::vector<K>& v = item.first;
+void Unserialize(Stream& is, vectoroverwritewrapper<std::vector<K>, nosizevectorwrapper>& item)
+{
+    std::vector<K>& v = item.vector;
     //v.clear();
     unsigned int nSize = v.size();
     unsigned int i = 0;
@@ -1103,9 +1101,9 @@
 }

 template<typename Stream>
-void Unserialize(Stream& is, pairr<std::vector<unsigned char>, nosizevectorwrapper>& item)
-{
-    std::vector<unsigned char>& v = item.first;
+void Unserialize(Stream& is, vectoroverwritewrapper<std::vector<unsigned char>, nosizevectorwrapper>& item)
+{
+    std::vector<unsigned char>& v = item.vector;
     //v.clear();
     unsigned int nSize = v.size();
     unsigned int i = 0;


TLV type error fixed under pkitruststore_cryptoapi.

--- src/ksi/pkitruststore_cryptoapi.c
+++ src/ksi/pkitruststore_cryptoapi.c
@@ -170,7 +170,7 @@
 		goto cleanup;
 	}

-	res = KSI_TLV_new(ctx, KSI_TLV_PAYLOAD_RAW, tag, isNonCritical, isForward, &tmp);
+	res = KSI_TLV_new(ctx, tag, isNonCritical, isForward, &tmp);
 	if (res != KSI_OK){
 		KSI_pushError(ctx, res, NULL);
 		goto cleanup;
@@ -396,7 +396,7 @@
 	}

-	res = KSI_TLV_new(ctx, KSI_TLV_PAYLOAD_RAW, tag, isNonCritical, isForward, &tmp);
+	res = KSI_TLV_new(ctx, tag, isNonCritical, isForward, &tmp);
 	if (res != KSI_OK){
 		KSI_pushError(ctx, res, NULL);
 		goto cleanup;


mips: add forgotten argument to lw

mips: add forgotten argument to lw

--- orc/orcprogram-mips.c
+++ orc/orcprogram-mips.c
@@ -267,7 +267,7 @@

   /* $t0 = number of iterations in region0 (before alignment) */
   orc_mips_emit_addiu (compiler, ORC_MIPS_T0, ORC_MIPS_ZERO, 1 << align_shift);
-  orc_mips_emit_lw (compiler, ORC_MIPS_T1,
+  orc_mips_emit_lw (compiler, ORC_MIPS_T1, ORC_MIPS_A0,
                     ORC_MIPS_EXECUTOR_OFFSET_ARRAYS(align_var));
   orc_mips_emit_sub (compiler, ORC_MIPS_T0, ORC_MIPS_T0, ORC_MIPS_T1);
   orc_mips_emit_andi (compiler, ORC_MIPS_T0, ORC_MIPS_T0, (1 << align_shift) - 1);


update text when secundary colors change.

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

--- src/lib/canvas/evas_object_text.c
+++ src/lib/canvas/evas_object_text.c
@@ -783,6 +783,7 @@
    o->cur.shadow.g = g;
    o->cur.shadow.b = b;
    o->cur.shadow.a = a;
+   o->changed = 1;
    evas_object_change(obj);
 }

@@ -835,6 +836,7 @@
    o->cur.glow.g = g;
    o->cur.glow.b = b;
    o->cur.glow.a = a;
+   o->changed = 1;
    evas_object_change(obj);
 }

@@ -887,6 +889,7 @@
    o->cur.glow2.g = g;
    o->cur.glow2.b = b;
    o->cur.glow2.a = a;
+   o->changed = 1;
    evas_object_change(obj);
 }

@@ -939,6 +942,7 @@
    o->cur.outline.g = g;
    o->cur.outline.b = b;
    o->cur.outline.a = a;
+   o->changed = 1;
    evas_object_change(obj);
 }


Bug in computing the wrench (force, torque in generic section) of the Euler beam, when shear center was offset. Fixed.

--- src/unit_FEM/ChElementBeamEuler.h
+++ src/unit_FEM/ChElementBeamEuler.h
@@ -699,8 +699,8 @@
 							Klaw_r(i,3) +=  Sz * Klaw_r(i,1) -Sy * Klaw_r(i,2);

 						// .. compute wrench = Klaw_l * sect_ek
-						ChMatrixNM<double,6> wrench;
-						wrench = Klaw_r * sect_ek;
+						ChMatrixNM<double,6,1> wrench;
+						wrench.MatrMultiply(Klaw_r, sect_ek);
 						Fforce  = wrench.ClipVector(0,0);
 						Mtorque = wrench.ClipVector(3,0);


ecore: fix compilation when GNUTLS_HANDSHAKE_NEW_SESSION_TICKET is not defined

SVN revision: 52679

--- src/lib/ecore_con/ecore_con_ssl.c
+++ src/lib/ecore_con/ecore_con_ssl.c
@@ -57,8 +57,10 @@
         return "Client hello";
       case GNUTLS_HANDSHAKE_SERVER_HELLO:
         return "Server hello";
+#ifdef GNUTLS_HANDSHAKE_NEW_SESSION_TICKET
       case GNUTLS_HANDSHAKE_NEW_SESSION_TICKET:
         return "New session ticket";
+#endif
       case GNUTLS_HANDSHAKE_CERTIFICATE_PKT:
         return "Certificate packet";
       case GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE:


created debugging to find the critical combination of alloc and frees

--- src/us_test_allocator_heap_main.c
+++ src/us_test_allocator_heap_main.c
@@ -68,6 +68,15 @@
     }
     return largest_free;
 }
+int saved_allocation_item[10000];
+int saved_allocation_size[10000];
+bool saved_allocation_alloc_or_free[10000];
+int saved_repeat_count;
+
+int min_allocation_item[10000];
+int min_allocation_size[10000];
+bool min_allocation_alloc_or_free[10000];
+int min_repeat_count=INT_MAX;

 #define MAX_ALLOCATIONS (256)
 bool us_test_allocator_heap_stress( us_allocator_heap_t *allocator )
@@ -79,11 +88,15 @@
     {
         allocations[i] = 0;
     }
-    for( i=0; i<repeat_count; ++i )
+    for( i=0; (i<repeat_count) && (i<min_repeat_count) ; ++i )
     {
         bool alloc_or_free = rand() & 1;
         int item = rand() % MAX_ALLOCATIONS;
         int sz = (rand() % 256)+4;
+        saved_allocation_item[i]=item;
+        saved_allocation_alloc_or_free[i]=alloc_or_free;
+        saved_allocation_size[i]=sz;
+        saved_repeat_count=i;
         if( alloc_or_free )
         {
             int largest_free;
@@ -97,9 +110,17 @@
             if( allocations[item] == 0 && largest_free>sz )
             {
                 us_log_error( "Tried to allocate %d bytes, failed, but largest free block was %d", sz, largest_free );
+#if 1
                 us_allocator_heap_report( allocator );
                 allocations[item] = allocator->m_base.alloc( &allocator->m_base, sz, 1 );
                 abort();
+#else
+                return(false);
+#endif
+            }
+            else if(allocations[item] == 0)
+            {
+                us_log_error( "Tried to allocate %d bytes, failed, largest free block was %d", sz, largest_free );
             }
         }
         else
@@ -116,17 +137,15 @@
         us_delete( &allocator->m_base, allocations[i] );
         allocations[i]=0;
     }
-
-    return true;
+    return true;
 }
-

 int us_test_allocator_heap_main ( int argc, char **argv )
 {
+    int i,j;
     int r = 1;
     static uint32_t raw_memory[32768];
     us_allocator_heap_t heap;
-
     if ( us_testutil_start ( 2048, 2048, argc, argv ) )
     {
 #if US_ENABLE_LOGGING
@@ -134,10 +153,65 @@
 #endif
         us_log_set_level ( US_LOG_LEVEL_DEBUG );
         us_log_info ( "Hello world from %s compiled on %s", __FILE__, __DATE__ );
+#if 1
+        j=0;
+        while(j<3000)
+        {
+            for(i=0; i<sizeof(raw_memory)/sizeof(raw_memory[0]); i++)
+            {
+                raw_memory[i]=0;
+            }
+            if( us_allocator_heap_init_raw( &heap, &raw_memory[0], sizeof(raw_memory) ) )
+            {
+                r = us_test_allocator_heap_stress( &heap );
+                if(!r && (saved_repeat_count<min_repeat_count))
+                {
+                    for(i=0; i<=saved_repeat_count; i++)
+                    {
+                        min_allocation_item[i]=saved_allocation_item[i];
+                        min_allocation_size[i]=saved_allocation_size[i];
+                        min_allocation_alloc_or_free[i]=saved_allocation_alloc_or_free[i];
+                    }
+                    min_repeat_count=saved_repeat_count;
+                    us_log_info ( "new min (%d) after %d\n",min_repeat_count,j);
+                    if(min_repeat_count==0)
+                    {
+                        break;
+                    }
+                }
+            }
+            j++;
+        }
+        for(i=0; i<=min_repeat_count; i++)
+        {
+            us_log_info ( "item[%d],size=%d, %s\n", min_allocation_item[i],min_allocation_size[i],min_allocation_alloc_or_free[i]?"alloc":"free");
+        }
+#else
         if( us_allocator_heap_init_raw( &heap, &raw_memory[0], sizeof(raw_memory) ) )
         {
-            r = us_test_allocator_heap_stress( &heap );
-        }
+            void * ptr1,*ptr2,*ptr3;
+            ptr1=(void *)heap.m_base.alloc( &heap.m_base, 253, 1 );
+            ptr2=(void *)heap.m_base.alloc( &heap.m_base, 181, 1 );
+            us_delete( &heap.m_base, ptr1 );
+            ptr3=(void *)heap.m_base.alloc( &heap.m_base, 175, 1 );
+            if(ptr1==0)
+            {
+                us_log_error( "ptr1 failed\n");
+            }
+            if(ptr2==0)
+            {
+                us_log_error( "ptr2 failed\n");
+            }
+            if(ptr3==0)
+            {
+                us_log_error( "ptr3 failed\n");
+            }
+        }
+        else
+        {
+            us_log_error( "init failed\n");
+        }
+#endif
         us_log_info ( "Finishing us_test_allocator" );
         us_logger_finish();
         us_testutil_finish();


ssl uh-oh

ssl uh-oh

SVN revision: 50612

--- src/lib/ecore_con/ecore_con_ssl.c
+++ src/lib/ecore_con/ecore_con_ssl.c
@@ -714,7 +714,7 @@
    FILE *fp = NULL;
    X509 *cert = NULL;

-   if (!(fp = fopen(certificate_file, "r")))
+   if (!(fp = fopen(cert_file, "r")))
       goto on_error;

    if (!(cert = PEM_read_X509(fp, NULL, NULL, NULL)))


ok, sorry, there was a reason: shutting up gcc warnings.  spank myself :P

SVN revision: 56612

--- src/lib/ecore_con/ecore_con_url.c
+++ src/lib/ecore_con/ecore_con_url.c
@@ -321,6 +321,7 @@
    return url_con;
 #else
    return NULL;
+   url = NULL;
 #endif
 }


causes mroe problems than it fixes

SVN revision: 18686

--- src/lib/ecore_evas/ecore_evas_x.c
+++ src/lib/ecore_evas/ecore_evas_x.c
@@ -459,9 +459,10 @@
 	       details[e->detail]);
      }
  */
-   if ((e->mode == ECORE_X_EVENT_MODE_GRAB) ||
-       (e->mode == ECORE_X_EVENT_MODE_UNGRAB))
-     return 0;
+// disable. causes mroe problems than it fixes
+//   if ((e->mode == ECORE_X_EVENT_MODE_GRAB) ||
+//       (e->mode == ECORE_X_EVENT_MODE_UNGRAB))
+//     return 0;
 /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
    if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
    _ecore_evas_x_modifier_locks_update(ee, e->modifiers);


fileselector_button: Added missing description about focus signals.

--- src/lib/elc_fileselector_button.h
+++ src/lib/elc_fileselector_button.h
@@ -37,6 +37,8 @@
  *   pointer comes as the @c event_info data (a stringshared
  *   string)
  * - @c "language,changed" - the program's language changed
+ * - @c "focused" - When the fileselector button has received focus. (since 1.8)
+ * - @c "unfocused" - When the fileselector button has lost focus. (since 1.8)
  *
  * Default text parts of the fileselector_button widget that you can use for
  * are:


took out printfs (verbose)

took out printfs (verbose)

--- src/lib/libfilterexec/fexec_opt.c
+++ src/lib/libfilterexec/fexec_opt.c
@@ -12,7 +12,13 @@
 extern void update_filter_order(filter_data_t *fdata, const permutation_t *perm);

-#define VERBOSE 1
+// #define VERBOSE 1
+
+#ifdef VERBOSE
+#define   IFVERBOSE
+#else
+#define   IFVERBOSE if(0)
+#endif

 static const int RESTART_INTERVAL = 200;

@@ -29,74 +35,76 @@
   if(hc) {
     hill_climb_init(hc, fdata->fd_perm, fdata->fd_po);
   }
-  printf("hill climb starts at: %s\n", pmPrint(fdata->fd_perm, buf, BUFSIZ));
+  IFVERBOSE printf("hill climb starts at: %s\n", pmPrint(fdata->fd_perm, buf, BUFSIZ));
   return (void *)hc;
 }

 void
 hill_climb_delete(void *context) {
-	hc_state_t *hc = (hc_state_t *)context;
-	hill_climb_cleanup(hc);
+  hc_state_t *hc = (hc_state_t *)context;
+
+  hill_climb_cleanup(hc);
   if(hc->global_best) {		/* XXX */
     pmDelete(hc->global_best);
   }
-
-	free(hc);
+
+  free(hc);
 }

 /* return true if we are currently exploiting a permutation */
 int
 hill_climb_optimize(void *context, filter_data_t *fdata) {
-	int err = 0;
-	hc_state_t *hc = (hc_state_t *)context;
-	char buf[BUFSIZ];
-	static int optimizer_done = 0; /* time before restart */
+  int err = 0;
+  hc_state_t *hc = (hc_state_t *)context;
+  char buf[BUFSIZ];
+  static int optimizer_done = 0; /* time before restart */

-	printf("hc-opt\n");
+ IFVERBOSE printf("hc-opt\n");

-	if(optimizer_done > 0) {
-		optimizer_done--;
-		/* restart hill climbing (in case we have better data now */
-		if(!optimizer_done) {
-			printf("restarting hill climb\n");
-			hill_climb_cleanup(hc);
-			hill_climb_init(hc, fdata->fd_perm, fdata->fd_po);
-		}
-		return 1;
-	}
+ if(optimizer_done > 0) {
+   optimizer_done--;
+   /* restart hill climbing (in case we have better data now */
+   if(!optimizer_done) {
+     IFVERBOSE printf("restarting hill climb\n");
+     hill_climb_cleanup(hc);
+     hill_climb_init(hc, fdata->fd_perm, fdata->fd_po);
+   }
+   return 1;
+ }

-	while(!err) {
-		//printf("hc\n");
-		err = hill_climb_step(hc, fdata->fd_po,
-				      (evaluation_func_t)fexec_evaluate, fdata);
-	}
-	switch(err) {
-	case RC_ERR_COMPLETE:
-		printf("hill climb optimizer suggests: %s\n",
-		       pmPrint(hill_climb_result(hc), buf, BUFSIZ));
-		fexec_print_cost(fdata, hill_climb_result(hc)); printf("\n");
-		/* update and restart */
-		optimizer_done = RESTART_INTERVAL;
-		if(pmEqual(fdata->fd_perm, hill_climb_result(hc))) {
-			printf("hill climbing didn't find further improvement\n");
-			//hill_climb_cleanup(hc);
-		} else {
-			update_filter_order(fdata, hill_climb_result(hc));
-			hill_climb_cleanup(hc);
-			hill_climb_init(hc, fdata->fd_perm, fdata->fd_po);
-		}
-		break;
-	case RC_ERR_NODATA:
-		printf("hill climb optimizer needs more data for: %s\n",
-		       pmPrint(hill_climb_next(hc), buf, BUFSIZ));
-		update_filter_order(fdata, hill_climb_next(hc));
-		break;
-	default:
-		break;
-	}
-
-
-	return (err == RC_ERR_COMPLETE);
+ while(!err) {
+   //printf("hc\n");
+   err = hill_climb_step(hc, fdata->fd_po,
+			 (evaluation_func_t)fexec_evaluate, fdata);
+ }
+ switch(err) {
+ case RC_ERR_COMPLETE:
+#ifdef VERBOSE
+   printf("hill climb optimizer suggests: %s\n",
+	  pmPrint(hill_climb_result(hc), buf, BUFSIZ));
+   fexec_print_cost(fdata, hill_climb_result(hc)); printf("\n");
+#endif
+   /* update and restart */
+   optimizer_done = RESTART_INTERVAL;
+   if(pmEqual(fdata->fd_perm, hill_climb_result(hc))) {
+     IFVERBOSE printf("hill climbing didn't find further improvement\n");
+     //hill_climb_cleanup(hc);
+   } else {
+     update_filter_order(fdata, hill_climb_result(hc));
+     hill_climb_cleanup(hc);
+     hill_climb_init(hc, fdata->fd_perm, fdata->fd_po);
+   }
+   break;
+ case RC_ERR_NODATA:
+   IFVERBOSE printf("hill climb optimizer needs more data for: %s\n",
+		    pmPrint(hill_climb_next(hc), buf, BUFSIZ));
+   update_filter_order(fdata, hill_climb_next(hc));
+   break;
+ default:
+   break;
+ }
+
+ return (err == RC_ERR_COMPLETE);
 }

 /* ********************************************************************** */
@@ -135,19 +143,16 @@
 #endif
 	static int optimizer_done = 0; /* time before restart */

-#ifdef VERBOSE
-	printf("bf-opt\n");
-#endif
+	IFVERBOSE printf("bf-opt\n");
+
 	if(optimizer_done > 0) {
 		optimizer_done--;
 		/* restart (in case we have better data now */
 		if(!optimizer_done) {
-#ifdef VERBOSE
-			printf("--- restarting optimizer ------------------------------\n");
-#endif
-			best_first_cleanup(bf);
-			best_first_init(bf, pmLength(fdata->fd_perm), fdata->fd_po,
-					(evaluation_func_t)fexec_evaluate, fdata);
+		  IFVERBOSE printf("--- restarting optimizer ------------------------------\n");
+		  best_first_cleanup(bf);
+		  best_first_init(bf, pmLength(fdata->fd_perm), fdata->fd_po,
+				  (evaluation_func_t)fexec_evaluate, fdata);
 		}
 		return 1;
 	}
@@ -165,16 +170,14 @@
 #endif
 		/* update and restart */
 		if(pmEqual(fdata->fd_perm, best_first_result(bf))) {
-#ifdef VERBOSE
-			printf("optimizer didn't find further improvement\n");
-#endif
-			optimizer_done = RESTART_INTERVAL;
-			//best_first_cleanup(bf);
+		  IFVERBOSE printf("optimizer didn't find further improvement\n");
+		  optimizer_done = RESTART_INTERVAL;
+		  //best_first_cleanup(bf);
 		} else {
-			update_filter_order(fdata, best_first_result(bf));
-			best_first_cleanup(bf);
-			best_first_init(bf, pmLength(fdata->fd_perm), fdata->fd_po,
-					(evaluation_func_t)fexec_evaluate, fdata);
+		  update_filter_order(fdata, best_first_result(bf));
+		  best_first_cleanup(bf);
+		  best_first_init(bf, pmLength(fdata->fd_perm), fdata->fd_po,
+				  (evaluation_func_t)fexec_evaluate, fdata);
 		}
 		break;
 	case RC_ERR_NODATA:


Increase size of targets metadata file accepted

Signed-off-by: Ben Clouser <318d09978a11718ac0de401c132f6956c6cd168d@toradex.com>

--- src/libaktualizr/uptane/fetcher.h
+++ src/libaktualizr/uptane/fetcher.h
@@ -11,7 +11,7 @@
 constexpr int64_t kMaxDirectorTargetsSize = 64 * 1024;
 constexpr int64_t kMaxTimestampSize = 64 * 1024;
 constexpr int64_t kMaxSnapshotSize = 64 * 1024;
-constexpr int64_t kMaxImagesTargetsSize = 1024 * 1024;
+constexpr int64_t kMaxImagesTargetsSize = 8 * 1024 * 1024;

 class IMetadataFetcher {
  public:


prev() and next() improved

prev() and next() improved

--- llist/stdllist.h
+++ llist/stdllist.h
@@ -153,49 +153,61 @@
 	return 0;
 }

-int prev (int value, Node *list)
-{
-	if (empty(list))
-	{
-		list->value = value;
-		list->next = NULL;
+/*
+	Changes the value of (node) with (value) and
+	next becomes (node)
+	@arguments (int value, Node *list)
+	@return int
+*/
+int prev (int value, Node *node)
+{
+	if (empty(node))
+	{
+		node->value = value;
+		node->next = NULL;
 		return 0;
 	}

-	Node *temp = newNode();
-	if (temp == NULL)
+	Node *nextNode = newNode();
+	if (nextNode == NULL)
 	{
 		return 1;
 	}

-	temp->value = list->value;
-	temp->next = list->next;
-
-	list->value = value;
-	list->next = temp;
-
-	return 0;
-}
-
-int next (int value, Node *list)
-{
-	if (empty(list))
-	{
-		list->value = value;
-		list->next = NULL;
+	nextNode->value = node->value;
+	nextNode->next = node->next;
+
+	node->value = value;
+	node->next = nextNode;
+
+	return 0;
+}
+
+/*
+	Adds a node with (value) as next of (node)
+	@arguments (int value, Node *list)
+	@return int
+*/
+
+int next (int value, Node *node)
+{
+	if (empty(node))
+	{
+		node->value = value;
+		node->next = NULL;
 		return 0;
 	}

-	Node *node = newNode();
-	if (node == NULL)
+	Node *nextNode = newNode();
+	if (nextNode == NULL)
 	{
 		return 1;
 	}

-	node->value = value;
-	node->next = NULL;
-
-	list->next = node;
+	nextNode->value = value;
+	nextNode->next = NULL;
+
+	node->next = nextNode;

 	return 0;
 }


Updated the copyright information

Updated the copyright information

--- src/keyboard.c
+++ src/keyboard.c
@@ -1,6 +1,6 @@
 /* $Id$ */
 static char const _copyright[] =
-"Copyright (c) 2011-2012 Pierre Pronchery <khorben@defora.org>";
+"Copyright (c) 2011-2013 Pierre Pronchery <khorben@defora.org>";
 /* This file is part of DeforaOS Desktop Keyboard */
 static char const _license[] =
 "This program is free software: you can redistribute it and/or modify\n"


[format] code style of rt_strcmp function

--- src/kservice.c
+++ src/kservice.c
@@ -456,7 +456,10 @@
 rt_int32_t rt_strcmp(const char *cs, const char *ct)
 {
     while (*cs && *cs == *ct)
-        cs++, ct++;
+    {
+        cs++;
+        ct++;
+    }

     return (*cs - *ct);
 }


signature: Fix warnings

signature: Fix warnings

Add extra braces to avoid ambiguous if-else.

Also, free() doesn't need a check.

--- src/signature.c
+++ src/signature.c
@@ -33,12 +33,8 @@
 	if (sig == NULL)
 		return;

-	if (sig->name)
-		free(sig->name);
-
-	if (sig->email)
-		free(sig->email);
-
+	free(sig->name);
+	free(sig->email);
 	free(sig);
 }

@@ -66,11 +62,12 @@
 	left = skip_leading_spaces(input, input_end);
 	right = skip_trailing_spaces(input, input_end - 1);

-	if (right <= left)
+	if (right <= left) {
 		if (fail_when_empty)
 			return git__throw(GIT_EINVALIDARGS, "Failed to trim. Input is either empty or only contains spaces");
 		else
 			right = left - 1;
+	}

 	trimmed_input_length = right - left + 1;


Make it possible to take address of sha1_result() function.

--- src/lib/sha1.h
+++ src/lib/sha1.h
@@ -42,7 +42,7 @@
    they won't conflict with the actual programs that are trying to use it.
    This particular instance has been fixed in 4.1.18 and 5.0.19, but there
    are others. */
-#define sha1_result(a, b) sha1_result_libmysqlclient_craps_all_over(a, b)
+#define sha1_result sha1_result_libmysqlclient_craps_all_over

 struct sha1_ctxt {
 	union {


src/liboping.c: Simplify packet creation and parsing.

--- src/liboping.c
+++ src/liboping.c
@@ -302,19 +302,16 @@
 		return (NULL);

 	icmp_hdr = (struct icmp *) buffer;
-	buffer     += ICMP_MINLEN;
-	buffer_len -= ICMP_MINLEN;
-
 	if (icmp_hdr->icmp_type != ICMP_ECHOREPLY)
 	{
-		dprintf ("Unexpected ICMP type: %i\n", icmp_hdr->icmp_type);
+		dprintf ("Unexpected ICMP type: %"PRIu8"\n", icmp_hdr->icmp_type);
 		return (NULL);
 	}

 	recv_checksum = icmp_hdr->icmp_cksum;
+	/* This writes to buffer. */
 	icmp_hdr->icmp_cksum = 0;
-	calc_checksum = ping_icmp4_checksum ((char *) icmp_hdr,
-			ICMP_MINLEN + buffer_len);
+	calc_checksum = ping_icmp4_checksum (buffer, buffer_len);

 	if (recv_checksum != calc_checksum)
 	{
@@ -815,7 +812,51 @@
 	struct icmp *icmp4;
 	int status;

-	char buf[4096];
+	char   buf[4096] = {0};
+	size_t buflen;
+
+	char *data;
+	size_t datalen;
+
+	dprintf ("ph->hostname = %s\n", ph->hostname);
+
+	icmp4 = (struct icmp *) buf;
+	*icmp4 = (struct icmp) {
+		.icmp_type = ICMP_ECHO,
+		.icmp_id   = htons (ph->ident),
+		.icmp_seq  = htons (ph->sequence),
+	};
+
+	datalen = strlen (ph->data);
+	buflen = ICMP_MINLEN + datalen;
+	if (sizeof (buf) < buflen)
+		return (EINVAL);
+
+	data  = buf + ICMP_MINLEN;
+	memcpy (data, ph->data, datalen);
+
+	icmp4->icmp_cksum = ping_icmp4_checksum (buf, buflen);
+
+	dprintf ("Sending ICMPv4 package with ID 0x%04x\n", ph->ident);
+
+	status = ping_sendto (obj, ph, buf, buflen);
+	if (status < 0)
+	{
+		perror ("ping_sendto");
+		return (-1);
+	}
+
+	dprintf ("sendto: status = %i\n", status);
+
+	return (0);
+}
+
+static int ping_send_one_ipv6 (pingobj_t *obj, pinghost_t *ph)
+{
+	struct icmp6_hdr *icmp6;
+	int status;
+
+	char buf[4096] = {0};
 	int  buflen;

 	char *data;
@@ -823,68 +864,22 @@

 	dprintf ("ph->hostname = %s\n", ph->hostname);

-	memset (buf, '\0', sizeof (buf));
-	icmp4 = (struct icmp *) buf;
+	icmp6 = (struct icmp6_hdr *) buf;
+	*icmp6 = (struct icmp6_hdr) {
+		.icmp6_type  = ICMP6_ECHO_REQUEST,
+		.icmp6_id    = htons (ph->ident),
+		.icmp6_seq   = htons (ph->sequence),
+	};
+
+	datalen = strlen (ph->data);
+	buflen = sizeof (*icmp6) + datalen;
+	if (sizeof (buf) < buflen)
+		return (EINVAL);
+
 	data  = buf + ICMP_MINLEN;
-
-	icmp4->icmp_type  = ICMP_ECHO;
-	icmp4->icmp_code  = 0;
-	icmp4->icmp_cksum = 0;
-	icmp4->icmp_id    = htons (ph->ident);
-	icmp4->icmp_seq   = htons (ph->sequence);
-
-	buflen = sizeof(buf) - ICMP_MINLEN;
-	strncpy (data, ph->data, buflen);
-	datalen = strlen (data);
-
-	buflen = datalen + ICMP_MINLEN;
-
-	icmp4->icmp_cksum = ping_icmp4_checksum (buf, buflen);
-
-	dprintf ("Sending ICMPv4 package with ID 0x%04x\n", ph->ident);
-
-	status = ping_sendto (obj, ph, buf, buflen);
-	if (status < 0)
-	{
-		perror ("ping_sendto");
-		return (-1);
-	}
-
-	dprintf ("sendto: status = %i\n", status);
-
-	return (0);
-}
-
-static int ping_send_one_ipv6 (pingobj_t *obj, pinghost_t *ph)
-{
-	struct icmp6_hdr *icmp6;
-	int status;
-
-	char buf[4096];
-	int  buflen;
-
-	char *data;
-	int   datalen;
-
-	dprintf ("ph->hostname = %s\n", ph->hostname);
-
-	memset (buf, '\0', sizeof (buf));
-	icmp6 = (struct icmp6_hdr *) buf;
-	data  = (char *) (icmp6 + 1);
-
-	icmp6->icmp6_type  = ICMP6_ECHO_REQUEST;
-	icmp6->icmp6_code  = 0;
-	/* The checksum will be calculated by the TCP/IP stack.  */
-	/* FIXME */
-	icmp6->icmp6_cksum = 0;
-	icmp6->icmp6_id    = htons (ph->ident);
-	icmp6->icmp6_seq   = htons (ph->sequence);
-
-	buflen = 4096 - ICMP_MINLEN;
-	strncpy (data, ph->data, buflen);
-	datalen = strlen (data);
-
-	buflen = datalen + ICMP_MINLEN;
+	memcpy (data, ph->data, datalen);
+
+	/* The checksum will be calculated by the TCP/IP stack. */

 	dprintf ("Sending ICMPv6 package with ID 0x%04x\n", ph->ident);


oops... private inheritance

oops... private inheritance

--- src/singleton.h
+++ src/singleton.h
@@ -7,7 +7,7 @@
 namespace core {

 template<class T>
-class Singleton : core::Noncopyable<T> {
+class Singleton : private core::Noncopyable<T> {
  public:
   static T* Instance() {
     thread::CallOnce(&once_, &Singleton<T>::Initialize);


added shebang support

added shebang support

--- src/libulver.c
+++ src/libulver.c
@@ -1002,7 +1002,22 @@
 		return ulver_error(env, "unable to read() file %s: %s", filename, strerror(errno));
         }

-        ulver_form *uf = ulver_parse(env, buf, rlen);
+	// check for shebang
+	char *checked_buf = buf;
+	if (rlen > 2) {
+		if (buf[0] == '#' && buf[1] == '!') {
+			checked_buf++;
+			rlen--;
+			while(rlen > 0) {
+				checked_buf++;
+				rlen--;
+				if (*checked_buf == '\n') break;
+			}
+		}
+	}
+	if (rlen == 0) return NULL;
+
+        ulver_form *uf = ulver_parse(env, checked_buf, rlen);
 	env->free(env, buf, st.st_size);
 	ulver_object *ret = NULL;
         while(uf) {


Properly handle OOM in trace_save().

Properly handle OOM in trace_save().

Thanks to Vyacheslav Egorov.

--- src/lj_trace.c
+++ src/lj_trace.c
@@ -117,15 +117,22 @@
 }
 #endif

-/* Save current trace by copying and compacting it. */
-static void trace_save(jit_State *J)
+/* Allocate space for copy of trace. */
+static GCtrace *trace_save_alloc(jit_State *J)
 {
   size_t sztr = ((sizeof(GCtrace)+7)&~7);
   size_t szins = (J->cur.nins-J->cur.nk)*sizeof(IRIns);
   size_t sz = sztr + szins +
 	      J->cur.nsnap*sizeof(SnapShot) +
 	      J->cur.nsnapmap*sizeof(SnapEntry);
-  GCtrace *T = lj_mem_newt(J->L, (MSize)sz, GCtrace);
+  return lj_mem_newt(J->L, (MSize)sz, GCtrace);
+}
+
+/* Save current trace by copying and compacting it. */
+static void trace_save(jit_State *J, GCtrace *T)
+{
+  size_t sztr = ((sizeof(GCtrace)+7)&~7);
+  size_t szins = (J->cur.nins-J->cur.nk)*sizeof(IRIns);
   char *p = (char *)T + sztr;
   memcpy(T, &J->cur, sizeof(GCtrace));
   setgcrefr(T->nextgc, J2G(J)->gc.root);
@@ -417,6 +424,7 @@
   BCOp op = bc_op(J->cur.startins);
   GCproto *pt = &gcref(J->cur.startpt)->pt;
   TraceNo traceno = J->cur.traceno;
+  GCtrace *T = trace_save_alloc(J);  /* Do this first. May throw OOM. */
   lua_State *L;

   switch (op) {
@@ -461,7 +469,7 @@
   /* Commit new mcode only after all patching is done. */
   lj_mcode_commit(J, J->cur.mcode);
   J->postproc = LJ_POST_NONE;
-  trace_save(J);
+  trace_save(J, T);

   L = J->L;
   lj_vmevent_send(L, TRACE,


ltr_pipe.c: Adjusted heading and roll axes in accordance with recent linuxtrack changes.

--- src/ltr_pipe.c
+++ src/ltr_pipe.c
@@ -855,7 +855,7 @@

 	int r = snprintf(buf, sizeof(buf),
 			"%f\t%f\t%f\t%f\t%f\t%f\n",
-			d->h * -1, d->p, d->r, d->x, d->y, d->z);
+			d->h, d->p, -d->r, d->x, d->y, d->z);

 	xwrite(buf, r);
 }
@@ -873,7 +873,7 @@

 	r = snprintf(buf, sizeof(buf),
 			"R/11\\%f\\%f\\%f",
-			d->h * -1, d->p * -1, d->r);
+			d->h, -d->p, d->r);

 	xwrite(buf, r);
 }
@@ -936,7 +936,7 @@

 	int r = snprintf(buf, sizeof(buf),
 			"PANH %f\nPANV %f\n",
-			d->h, d->p);
+			-d->h, d->p);

 	xwrite(buf, r);
 }
@@ -948,8 +948,8 @@
  **/
 static void write_data_mouse(const struct ltr_data *d)
 {
-        int8_t x  = (int8_t) d->h;
-        int8_t y  = (int8_t) d->p;
+        int8_t x  = (int8_t) -d->h;
+        int8_t y  = (int8_t)  d->p;
         int8_t zx = 0;
         int8_t zy = 0;

@@ -991,7 +991,7 @@

 	/* heading */
 	ie.code  = (Args.format == FORMAT_UINPUT_REL) ? REL_X : ABS_X;
-	ie.value = (int32_t) d->h;
+	ie.value = (int32_t) -d->h;
 	xwrite(&ie, sizeof(ie));

 	/* pitch */
@@ -1001,7 +1001,7 @@

 	/* roll */
 	ie.code  = (Args.format == FORMAT_UINPUT_REL) ? REL_Z : ABS_Z;
-	ie.value = (int32_t) d->r;
+	ie.value = (int32_t) -d->r;
 	xwrite(&ie, sizeof(ie));

 	if (Args.format == FORMAT_UINPUT_ABS) {


Cruft

Cruft

--- src/lx/out/c.c
+++ src/lx/out/c.c
@@ -160,40 +160,6 @@
 	}

 	assert(!"unreached");
-	return 0;
-}
-
-/* XXX: centralise */
-static int
-xset_contains(const struct state_set *set, const struct fsm_state *state)
-{
-	const struct state_set *s;
-
-	for (s = set; s != NULL; s = s->next) {
-		if (s->state == state) {
-			return 1;
-		}
-	}
-
-	return 0;
-}
-
-/* Return true if the edges after o contains state */
-/* TODO: centralise */
-static int
-contains(struct fsm_edge edges[], int o, struct fsm_state *state)
-{
-	int i;
-
-	assert(edges != NULL);
-	assert(state != NULL);
-
-	for (i = o; i <= UCHAR_MAX; i++) {
-		if (xset_contains(edges[i].sl, state)) {
-			return 1;
-		}
-	}
-
 	return 0;
 }


clone_paths: use 'rootfs' for destination directory

We were trying to be smart and use whatever the last part of
the container's rootfs path was.  However for block devices
that doesn't make much sense.  I.e. if lxc.rootfs = /dev/md-1,
chances are that /var/lib/lxc/c1/md-1 does not exist.

So always use the $lxcpath/$lxcname/rootfs, and if it does
not exist, try to create it.

With this, 'lxc-clone -s -o c1 -n c2' where c1 has an lvm backend
is fixed.  See https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1414771

Signed-off-by: Serge Hallyn <3df611b026e4639bee8aef7a4beb2e39fcebb313@ubuntu.com>
Acked-by: Stéphane Graber <089afc6d81f66f1168a9849e15660feae286e024@ubuntu.com>

--- src/lxc/bdev.c
+++ src/lxc/bdev.c
@@ -3340,7 +3340,6 @@
 	const char *oldname = c0->name;
 	const char *oldpath = c0->config_path;
 	struct rsync_data data;
-	char *rootfs;

 	/* if the container name doesn't show up in the rootfs path, then
 	 * we don't know how to come up with a new name
@@ -3359,25 +3358,26 @@

 	if (!orig->dest) {
 		int ret;
-		orig->dest = malloc(MAXPATHLEN);
+		size_t len;
+		struct stat sb;
+
+		len = strlen(oldpath) + strlen(oldname) + strlen("/rootfs") + 2;
+		orig->dest = malloc(len);
 		if (!orig->dest) {
 			ERROR("out of memory");
 			bdev_put(orig);
 			return NULL;
 		}
-		rootfs = strrchr(orig->src, '/');
-		if (!rootfs) {
-			ERROR("invalid rootfs path");
-			bdev_put(orig);
-			return NULL;
-		}
-		rootfs++;
-		ret = snprintf(orig->dest, MAXPATHLEN, "%s/%s/%s", oldpath, oldname, rootfs);
-		if (ret < 0 || ret >= MAXPATHLEN) {
+		ret = snprintf(orig->dest, len, "%s/%s/rootfs", oldpath, oldname);
+		if (ret < 0 || ret >= len) {
 			ERROR("rootfs path too long");
 			bdev_put(orig);
 			return NULL;
 		}
+		ret = stat(orig->dest, &sb);
+		if (ret < 0 && errno == ENOENT)
+			if (mkdir_p(orig->dest, 0755) < 0)
+				WARN("Error creating '%s', continuing.", orig->dest);
 	}

 	/*


lyd mods BUGFIX invalid failure of applying scheduled changes

In case the non-implemented module is also scheduled
to be installed, it is okay.

--- src/lyd_mods.c
+++ src/lyd_mods.c
@@ -1064,11 +1064,12 @@
  * @brief Check data dependencies of a module.
  *
  * @param[in] ly_mod Libyang module to check.
+ * @param[in] sr_mods Sysrepo module data.
  * @param[out] fail Whether any dependant module was not implemented.
  * @return err_info, NULL on success.
  */
 static sr_error_info_t *
-sr_lydmods_check_data_deps(const struct lys_module *ly_mod, int *fail)
+sr_lydmods_check_data_deps(const struct lys_module *ly_mod, const struct lyd_node *sr_mods, int *fail)
 {
     sr_error_info_t *err_info = NULL;
     struct lys_module **dep_mods = NULL;
@@ -1078,6 +1079,8 @@
     struct lys_when *when;
     struct lys_restr *musts;
     uint8_t i, must_size;
+    char *xpath;
+    struct ly_set *set;

     LY_TREE_FOR(ly_mod->data, root) {
         for (elem = next = root; elem; elem = next) {
@@ -1202,8 +1205,24 @@
     /* check all the dependency modules */
     for (i = 0; i < dep_mod_count; ++i) {
         if (!dep_mods[i]->implemented) {
-            SR_LOG_WRN("Module \"%s\" depends on module \"%s\", which is not implemented.", ly_mod->name, dep_mods[i]->name);
-            *fail = 1;
+            /* maybe it is scheduled to be installed? */
+            if (asprintf(&xpath, "installed-module[name='%s']", dep_mods[i]->name) == -1) {
+                SR_ERRINFO_MEM(&err_info);
+                goto cleanup;
+            }
+            set = lyd_find_path(sr_mods, xpath);
+            free(xpath);
+            if (!set) {
+                sr_errinfo_new_ly(&err_info, lyd_node_module(sr_mods)->ctx);
+                goto cleanup;
+            }
+            assert(set->number < 2);
+
+            if (!set->number) {
+                SR_LOG_WRN("Module \"%s\" depends on module \"%s\", which is not implemented.", ly_mod->name, dep_mods[i]->name);
+                *fail = 1;
+            }
+            ly_set_free(set);
         }
     }

@@ -1262,7 +1281,7 @@
         }

         /* check that all the dependant modules are implemented */
-        if ((err_info = sr_lydmods_check_data_deps(ly_mod, fail)) || *fail) {
+        if ((err_info = sr_lydmods_check_data_deps(ly_mod, sr_mods, fail)) || *fail) {
             goto cleanup;
         }

@@ -1332,7 +1351,7 @@
         feat_set = NULL;

         /* check that all the dependant modules are implemented */
-        if ((err_info = sr_lydmods_check_data_deps(ly_mod, fail)) || *fail) {
+        if ((err_info = sr_lydmods_check_data_deps(ly_mod, sr_mods, fail)) || *fail) {
             goto cleanup;
         }

@@ -1418,7 +1437,7 @@
         set = NULL;

         /* check that all the dependant modules are implemented */
-        if ((err_info = sr_lydmods_check_data_deps(ly_mod, fail)) || *fail) {
+        if ((err_info = sr_lydmods_check_data_deps(ly_mod, sr_mods, fail)) || *fail) {
             goto cleanup;
         }


* change writting.

  * change writting.

git-svn-id: 941c396c0c997e7bb438e0bf88317cdf88a3ff60@1278 1a406e8e-add9-4483-a2c8-d8cac5b7c224


url_handlers: Use sizeof(page) instead of 10 in snprintf calls

Signed-off-by: Andrew Clayton <02e0a999c50b1f88df7a8f5a04e1b76b35ea6a88@opentechlabs.co.uk>

--- www/url_handlers.c
+++ www/url_handlers.c
@@ -433,11 +433,11 @@

 	if (pages > 1) {
 		if (page_no - 1 > 0) {
-			snprintf(page, 10, "%d", page_no - 1);
+			snprintf(page, sizeof(page), "%d", page_no - 1);
 			ml = TMPL_add_var(ml, "prev_page", page, NULL);
 		}
 		if (page_no + 1 <= pages) {
-			snprintf(page, 10, "%d", page_no + 1);
+			snprintf(page, sizeof(page), "%d", page_no + 1);
 			ml = TMPL_add_var(ml, "next_page", page, NULL);
 		}
 	} else {
@@ -1725,11 +1725,11 @@

 	if (pages > 1) {
 		if (page_no - 1 > 0) {
-			snprintf(page, 10, "%d", page_no - 1);
+			snprintf(page, sizeof(page), "%d", page_no - 1);
 			ml = TMPL_add_var(ml, "prev_page", page, NULL);
 		}
 		if (page_no + 1 <= pages) {
-			snprintf(page, 10, "%d", page_no + 1);
+			snprintf(page, sizeof(page), "%d", page_no + 1);
 			ml = TMPL_add_var(ml, "next_page", page, NULL);
 		}
 	} else {
@@ -1860,11 +1860,11 @@

 	if (pages > 1) {
 		if (page_no - 1 > 0) {
-			snprintf(page, 10, "%d", page_no - 1);
+			snprintf(page, sizeof(page), "%d", page_no - 1);
 			ml = TMPL_add_var(ml, "prev_page", page, NULL);
 		}
 		if (page_no + 1 <= pages) {
-			snprintf(page, 10, "%d", page_no + 1);
+			snprintf(page, sizeof(page), "%d", page_no + 1);
 			ml = TMPL_add_var(ml, "next_page", page, NULL);
 		}
 	} else {
@@ -2188,11 +2188,11 @@

 	if (pages > 1) {
 		if (page_no - 1 > 0) {
-			snprintf(page, 10, "%d", page_no - 1);
+			snprintf(page, sizeof(page), "%d", page_no - 1);
 			ml = TMPL_add_var(ml, "prev_page", page, NULL);
 		}
 		if (page_no + 1 <= pages) {
-			snprintf(page, 10, "%d", page_no + 1);
+			snprintf(page, sizeof(page), "%d", page_no + 1);
 			ml = TMPL_add_var(ml, "next_page", page, NULL);
 		}
 	} else {


more INness

more INness

--- src/plrmodes.c
+++ src/plrmodes.c
@@ -141,21 +141,22 @@
 		if(plr->moveflags && !creal(e->args[0]))
 			arg -= (carg(e->pos0)-carg(e->pos-plr->pos))*2;

-		if(global.frames - plr->prevmovetime <= 10 && global.frames == plr->movetime) {
+		//if(global.frames - plr->prevmovetime <= 10 && global.frames == plr->movetime) {
+		if(global.frames == plr->movetime) {
 			int new = plr->curmove;
 			int old = plr->prevmove;

 			if(new == MOVEFLAG_UP && old == MOVEFLAG_DOWN) {
-				arg = -M_PI/2;
+				arg = M_PI/2;
 				e->args[0] = plr->movetime;
 			} else if(new == MOVEFLAG_DOWN && old == MOVEFLAG_UP) {
-				arg = -3*M_PI/2;
+				arg = 3*M_PI/2;
 				e->args[0] = plr->movetime;
 			} else if(new == MOVEFLAG_LEFT && old == MOVEFLAG_RIGHT) {
-				arg = M_PI;
+				arg = 0;
 				e->args[0] = plr->movetime;
 			} else if(new == MOVEFLAG_RIGHT && old == MOVEFLAG_LEFT) {
-				arg = 0;
+				arg = M_PI;
 				e->args[0] = plr->movetime;
 			}
 		}


Tweaking the delay function.

Tweaking the delay function.


This commit was generated by cvs2svn to compensate for changes in r56944, which included commits to RCS files with non-trunk default branches.

--- contrib/binutils/gas/ehopt.c
+++ contrib/binutils/gas/ehopt.c
@@ -261,17 +261,52 @@
      expressionS *exp;
      unsigned int *pnbytes;
 {
+  static int saw_size;
+  static symbolS *size_end_sym;
   static int saw_advance_loc4;
   static fragS *loc4_frag;
   static int loc4_fix;

+  if (saw_size
+      && S_IS_DEFINED (size_end_sym))
+    {
+      /* We have come to the end of the CIE or FDE.  See below where
+         we set saw_size.  We must check this first because we may now
+         be looking at the next size.  */
+      saw_size = 0;
+      saw_advance_loc4 = 0;
+    }
+
   if (flag_traditional_format)
     {
       /* Don't optimize.  */
     }
   else if (strcmp (segment_name (now_seg), ".eh_frame") != 0)
-    saw_advance_loc4 = 0;
-  else if (*pnbytes == 1
+    {
+      saw_size = 0;
+      saw_advance_loc4 = 0;
+    }
+  else if (! saw_size
+	   && *pnbytes == 4)
+    {
+      /* This might be the size of the CIE or FDE.  We want to know
+         the size so that we don't accidentally optimize across an FDE
+         boundary.  We recognize the size in one of two forms: a
+         symbol which will later be defined as a difference, or a
+         subtraction of two symbols.  Either way, we can tell when we
+         are at the end of the FDE because the symbol becomes defined
+         (in the case of a subtraction, the end symbol, from which the
+         start symbol is being subtracted).  Other ways of describing
+         the size will not be optimized.  */
+      if ((exp->X_op == O_symbol || exp->X_op == O_subtract)
+	  && ! S_IS_DEFINED (exp->X_add_symbol))
+	{
+	  saw_size = 1;
+	  size_end_sym = exp->X_add_symbol;
+	}
+    }
+  else if (saw_size
+	   && *pnbytes == 1
 	   && exp->X_op == O_constant
 	   && exp->X_add_number == DW_CFA_advance_loc4)
     {


Apply vendor patch: include the header files from the canonical place.

Explained to me by:	ru

--- contrib/ngatm/snmp_atm/atm.h
+++ contrib/ngatm/snmp_atm/atm.h
@@ -36,9 +36,9 @@
 #include <net/if.h>
 #include <net/if_mib.h>

-#include "snmpmod.h"
-#include "snmp_mibII.h"
-#include "snmp_atm.h"
+#include <bsnmp/snmpmod.h>
+#include <bsnmp/snmp_mibII.h>
+#include <bsnmp/snmp_atm.h>

 /*
  * Event registrations


Need to use __MACOSX__ for the Mac OS X platform.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401765

--- src/video/maccommon/SDL_macgl_c.h
+++ src/video/maccommon/SDL_macgl_c.h
@@ -26,7 +26,7 @@

 #if SDL_VIDEO_OPENGL
 #include "SDL_opengl.h"
-#ifdef MACOSX
+#if __MACOSX__
 #include <AGL/agl.h>   /* AGL.framework */
 #else
 #include <agl.h>


MapTransform: comments added

MapTransform: comments added

--- src/vw/Cartography/MapTransform.h
+++ src/vw/Cartography/MapTransform.h
@@ -25,8 +25,10 @@
 #include <vw/Cartography/GeoReference.h>

-/// \file MapTransform.h Used to test the validity of IP matching on map projected images.
-
+/// \file MapTransform.h
+// Given a pixel in a map-projected image, convert it to lonlat, then
+// convert to the DEM pixel, then to the DEM lonlat, then to the DEM
+// xyz, then project into the camera, and find the camera pixel.
 namespace vw { namespace camera{
   class CameraModel; // forward declaration
 }}
@@ -34,9 +36,6 @@
 namespace vw {
 namespace cartography {

-  // MapTransform. Used to test the validity of IP matching on map
-  // projected images. However, this could be used for performing an RPC
-  // map projection.
   class MapTransform : public vw::TransformBase<MapTransform> {
     vw::camera::CameraModel const* m_cam;
     GeoReference m_image_georef, m_dem_georef;


Add comment about when to use OpNode::CloneInOtherGraph()

--- xchainer/op_node.h
+++ xchainer/op_node.h
@@ -77,6 +77,7 @@
     void RegisterExoticPreviousArrayNodes(GraphId other_graph_id, std::vector<std::weak_ptr<ArrayNode>> exotic_prev_array_nodes);

     // Clones the op node in another graph.
+    // Used when fabricating array nodes in output array retention.
     std::shared_ptr<OpNode> CloneInOtherGraph(const GraphId& other_graph_id) const;

     void Unchain() {


Add Thread support on Win32 API

Add Thread support on Win32 API

error: pathspec 'elog/thread_win32.h' did not match any file(s) known to git

--- elog/thread_win32.h
+++ elog/thread_win32.h
@@ -0,0 +1,84 @@
+#ifndef ELOG_THREAD_WIN32_H_
+#define ELOG_THREAD_WIN32_H_
+
+#include <functional>
+#include <process.h>
+#include <windows.h>
+#include "util.h"
+
+namespace LOG {
+
+class ScopedThreadHandle : NonCopyable {
+ public:
+  explicit ScopedThreadHandle(HANDLE handle = NULL)
+      : handle_(handle) {
+  }
+
+  ~ScopedThreadHandle() {
+    Reset();
+  }
+
+  HANDLE Get() const {
+    return handle_;
+  }
+
+  void Reset(HANDLE handle = NULL) {
+    if (handle_) {
+      CloseHandle(handle_);
+    }
+    handle_ = handle;
+  }
+
+ private:
+  HANDLE handle_;
+};
+
+class Thread : NonCopyable {
+ public:
+  Thread() {
+  }
+
+  template <typename ThreadBody>
+  explicit Thread(ThreadBody thread_body)
+      : thread_body_(thread_body) {
+  }
+
+  ~Thread() {
+  }
+
+  template <typename ThreadBody>
+  void set_thread_body(ThreadBody thread_body) {
+    thread_body_ = thread_body;
+  }
+
+  void Run() {
+    HANDLE handle = reinterpret_cast<HANDLE>(
+            _beginthreadex(NULL, 0, StaticThreadBody, NULL, 0, NULL));
+    thread_handle_.Reset(handle);
+  }
+
+  void Detach() {
+    // do nothing
+  }
+
+  void Join() {
+    HANDLE handle = thread_handle_.Get();
+    if (handle) {
+      WaitForSingleObject(handle, INFINITE);
+    }
+  }
+
+ private:
+  static int WINAPI StaticThreadBody(LPVOID self_ptr) {
+    Thread& self = *reinterpret_cast<Thread*>(self_ptr);
+    self.thread_body_();
+    return NULL;
+  }
+
+  ScopedThreadHandle thread_handle_;
+  std::tr1::function<void ()> thread_body_;
+};
+
+}  // namespace LOG
+
+#endif  // ELOG_THREAD_WIN32_H_


Update lv_btn.c

Update lv_btn.c

Allow NULL as parameter to lv_btn_set_styles for any style which is not to be changed.

--- lv_objx/lv_btn.c
+++ lv_objx/lv_btn.c
@@ -295,7 +295,7 @@
 }

 /**
- * Set styles of a button is each state
+ * Set styles of a button is each state. Use NULL for any style which are not be changed.
  * @param btn pointer to button object
  * @param rel pointer to a style for releases state
  * @param pr  pointer to a style for pressed state
@@ -308,14 +308,18 @@
                                        lv_style_t * ina)
 {
     lv_btn_ext_t * ext = lv_obj_get_ext(btn);
-    ext->styles[LV_BTN_STATE_REL] = rel;
-    ext->styles[LV_BTN_STATE_PR] = pr;
-    ext->styles[LV_BTN_STATE_TREL] = trel;
-    ext->styles[LV_BTN_STATE_TPR] = tpr;
-    ext->styles[LV_BTN_STATE_INA] = ina;
+
+    if(rel != NULL)	ext->styles[LV_BTN_STATE_REL] = rel;
+
+    if(pr != NULL) ext->styles[LV_BTN_STATE_PR] = pr;
+
+    if(trel) ext->styles[LV_BTN_STATE_TREL] = trel;
+
+    if(tpr) ext->styles[LV_BTN_STATE_TPR] = tpr;
+
+    if(ina) ext->styles[LV_BTN_STATE_INA] = ina;

     lv_obj_set_style(btn, ext->styles[ext->state]);
-
 }

 /*=====================


Clean up some unneeded includes & the ret value.

--- src/sumbuffer.c
+++ src/sumbuffer.c
@@ -5,59 +5,49 @@
 #include <errno.h>

 #include <ctype.h>
-#include <unistd.h>
-#include <getopt.h>

 #include "blake2.h"

 int blake2s_buffer(const void *buffer, size_t length, void *resstream)
 {
-	int ret = -1;
 	blake2s_state S[1];

 	blake2s_init(S, BLAKE2S_OUTBYTES);
 	blake2s_update(S, buffer, length);
 	blake2s_final(S, resstream, BLAKE2S_OUTBYTES);
-	ret = 0;

-	return ret;
+	return 0;
 }

 int blake2b_buffer(const char *buffer, size_t length, void *resstream)
 {
-	int ret = -1;
 	blake2b_state S[1];

 	blake2b_init(S, BLAKE2B_OUTBYTES);
 	blake2b_update(S, buffer, length);
 	blake2b_final(S, resstream, BLAKE2B_OUTBYTES);
-	ret = 0;

-	return ret;
+	return 0;
 }

 int blake2sp_buffer(const void *buffer, size_t length, void *resstream)
 {
-	int ret = -1;
 	blake2sp_state S[1];

 	blake2sp_init(S, BLAKE2S_OUTBYTES);
 	blake2sp_update(S, buffer, length);
 	blake2sp_final(S, resstream, BLAKE2S_OUTBYTES);
-	ret = 0;

-	return ret;
+	return 0;
 }

 int blake2bp_buffer(const void *buffer, size_t length, void *resstream)
 {
-	int ret = -1;
 	blake2bp_state S[1];

 	blake2bp_init(S, BLAKE2B_OUTBYTES);
 	blake2bp_update(S, buffer, length);
 	blake2bp_final(S, resstream, BLAKE2B_OUTBYTES);
-	ret = 0;

-	return ret;
+	return 0;
 }


git-svn-id: https://www.imagemagick.org/subversion/ImageMagick/trunk@3214 aa41f4f7-0bf4-0310-aa73-e5a19afd5a74

--- magick/compare.c
+++ magick/compare.c
@@ -830,12 +830,12 @@
     *image_statistics,
     *reconstruct_statistics;

+  MagickBooleanType
+    status;
+
   MagickOffsetType
     progress;

-  MagickBooleanType
-    status;
-
   MagickRealType
     area;

@@ -846,7 +846,7 @@
     y;

   /*
-    Subtract the mean.
+    Normalize to account for variation due to lighting and exposure condition.
   */
   image_statistics=GetImageChannelStatistics(image,exception);
   reconstruct_statistics=GetImageChannelStatistics(reconstruct_image,exception);
@@ -929,16 +929,12 @@
   for (i=0; i < (ssize_t) AllChannels; i++)
   {
     MagickRealType
-      alpha;
-
-    alpha=image_statistics[i].standard_deviation*
+      gamma;
+
+    gamma=image_statistics[i].standard_deviation*
       reconstruct_statistics[i].standard_deviation;
-    if (fabs(alpha) <= MagickEpsilon)
-      {
-        distortion[i]=1.0;
-        continue;
-      }
-    distortion[i]=QuantumRange*distortion[i]/alpha;
+    gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
+    distortion[i]=QuantumRange*gamma*distortion[i];
   }
   distortion[AllChannels]=0.0;
   if ((channel & RedChannel) != 0)
@@ -1570,8 +1566,8 @@
     status;

   MagickRealType
-    alpha,
-    area;
+    area,
+    gamma;

   ssize_t
     y;
@@ -1580,7 +1576,7 @@
     number_channels;

   /*
-    Subtract the mean.
+    Normalize to account for variation due to lighting and exposure condition.
   */
   image_statistics=GetImageChannelStatistics(image,exception);
   status=MagickTrue;
@@ -1642,17 +1638,16 @@
   /*
     Divide by the standard deviation.
   */
-  alpha=image_statistics[AllChannels].standard_deviation*
+  gamma=image_statistics[AllChannels].standard_deviation*
     reconstruct_statistics[AllChannels].standard_deviation;
-  distortion=QuantumRange*distortion/alpha;
+  gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
+  distortion=QuantumRange*gamma*distortion;
   number_channels=3;
   if (image->matte != MagickFalse)
     number_channels++;
   if (image->colorspace == CMYKColorspace)
     number_channels++;
   distortion=sqrt(distortion/number_channels);
-  if (fabs(alpha) <= MagickEpsilon)
-    distortion=1.0;
   /*
     Free resources.
   */


Add test cases for the execute command function.

--- src/test/main.c
+++ src/test/main.c
@@ -516,6 +516,65 @@
     }
 }

+char* test_ImapConnectionExecuteCommand()
+{
+    //test case 1:
+    //execute a command on an invalid connection (NULL).
+    //the result should be NULL.
+    {
+        ImapConnection* invalidConnection = NULL;
+        const char* validCommand = "SELECT INBOX";
+
+        const char* result = ImapConnection_ExecuteCommand(invalidConnection, validCommand);
+        mu_assert("Execute IMAP command on NULL connection\n", (result == NULL));
+
+        ImapConnection_Delete(invalidConnection);
+    }
+
+    //test case 2:
+    //execute an invalid command (NULL) on a valid connection.
+    //the result should be NULL.
+    {
+        ImapConnection* validConnection = ImapConnection_Create(IMAP_NO_SSL, "127.0.0.1", 993);
+        const char* invalidCommand = NULL;
+
+        const char* result = ImapConnection_ExecuteCommand(validConnection, invalidCommand);
+        mu_assert("Execute invalid IMAP command on valid connection\n", (result == NULL));
+
+        ImapConnection_Delete(validConnection);
+    }
+
+    //test case 3:
+    //execute a valid command on a connection that does not support IMAP protocol.
+    //the result should be NULL.
+    {
+        ImapConnection* localConnection = ImapConnection_Create(IMAP_NO_SSL, "127.0.0.1", 993);
+        const char* validCommand = "SELECT INBOX";
+
+        const char* result = ImapConnection_ExecuteCommand(localConnection, validCommand);
+        mu_assert("Execute IMAP command on a connection that does not handle IMAP\n", (result == NULL));
+
+        ImapConnection_Delete(localConnection);
+    }
+
+    /*
+    //TODO: Andrei: remove personal data before commit to github.
+    //test case 4:
+    //execute a valid command on an IMAP server.
+    //the result should be NOT NULL.
+    {
+        ImapConnection* validConnection = ImapConnection_Create(IMAP_SSL, "imaps://imap.mail.yahoo.com/", IMAP_SSL_DEFAULT_PORT, "testemailgateway", "PRIVATE");
+        const char* validCommand = "SELECT INBOX";
+
+        const char* result = ImapConnection_ExecuteCommand(validConnection, validCommand);
+        mu_assert("Execute IMAP command on a valid IMAP connection\n", (result != NULL));
+
+        printf("%s\n", result);
+        ImapConnection_Delete(validConnection);
+    }
+    */
+}
+
 int tests_run = 0;

 char* runAllTests()
@@ -539,6 +598,7 @@
     mu_run_test(test_SmtpConnection_SendEmail2);

     mu_run_test(test_ImapConnection_Create);
+    mu_run_test(test_ImapConnectionExecuteCommand);
     return 0;
 }


Correctly recognize DEL when emitted by the Backspace key; src/textadept.c

--- src/textadept.c
+++ src/textadept.c
@@ -2509,7 +2509,7 @@
 #else
   TermKeyResult res;
   TermKeyKey key;
-  int keysyms[] = {0,SCK_BACK,SCK_TAB,SCK_RETURN,SCK_ESCAPE,0,0,SCK_UP,SCK_DOWN,SCK_LEFT,SCK_RIGHT,0,0,SCK_INSERT,SCK_DELETE,0,SCK_PRIOR,SCK_NEXT,SCK_HOME,SCK_END};
+  int keysyms[] = {0,SCK_BACK,SCK_TAB,SCK_RETURN,SCK_ESCAPE,0,SCK_BACK,SCK_UP,SCK_DOWN,SCK_LEFT,SCK_RIGHT,0,0,SCK_INSERT,SCK_DELETE,0,SCK_PRIOR,SCK_NEXT,SCK_HOME,SCK_END};
   while ((res = textadept_waitkey(ta_tk, &key)) != TERMKEY_RES_EOF) {
     if (res == TERMKEY_RES_ERROR) continue;
     if (key.type == TERMKEY_TYPE_UNICODE)


Re-structured src/textadept.h.

Re-structured src/textadept.h.

--- src/textadept.h
+++ src/textadept.h
@@ -50,6 +50,17 @@
 void set_default_editor_properties(ScintillaObject *sci);
 void set_default_buffer_properties(ScintillaObject *sci);

+GtkWidget* pm_create_ui();
+void pm_toggle_focus();
+void pm_open_parent(GtkTreeIter *iter, GtkTreePath *path);
+void pm_close_parent(GtkTreeIter *iter, GtkTreePath *path);
+void pm_activate_selection();
+void pm_popup_context_menu(GdkEventButton *event, GCallback callback);
+void pm_process_selected_menu_item(GtkWidget *menu_item);
+
+GtkWidget *find_create_ui();
+void find_toggle_focus();
+
 // lua_interface.c
 void l_init(int argc, char **argv, bool reinit);
 void l_close();
@@ -84,17 +95,4 @@
 void l_find_replace(const char *rtext);
 void l_find_replace_all(const char *ftext, const char *rtext, int flags);

-// pm.c
-GtkWidget* pm_create_ui();
-void pm_toggle_focus();
-void pm_open_parent(GtkTreeIter *iter, GtkTreePath *path);
-void pm_close_parent(GtkTreeIter *iter, GtkTreePath *path);
-void pm_activate_selection();
-void pm_popup_context_menu(GdkEventButton *event, GCallback callback);
-void pm_process_selected_menu_item(GtkWidget *menu_item);
-
-// find_replace.c
-GtkWidget *find_create_ui();
-void find_toggle_focus();
-
 #endif


Fix typo

Fix typo

--- subsys/ChSubsysDefs.h
+++ subsys/ChSubsysDefs.h
@@ -97,7 +97,7 @@
 };

 /// Vector of wheel state structures
-typedef std::vector<ChWheelState> ChwheelStates;
+typedef std::vector<ChWheelState> ChWheelStates;

 ///
 /// Structure to communicate a set of generalized tire forces.


* subversion/svn/main.c
  (main): Disallow simultaneous use of --with-revprop and
    --with-no-revprops, as should have done in r33086.

Patch by: danielsh

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@873173 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/svn/main.c
+++ subversion/svn/main.c
@@ -1657,6 +1657,16 @@
       return svn_cmdline_handle_exit_error(err, pool, "svn: ");
     }

+  /* Disallow simultaneous use of both --with-revprop and
+     --with-no-revprops.  */
+  if (opt_state.revprop_table && opt_state.no_revprops)
+    {
+      err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                             _("--with-revprop and --with-no-revprops "
+                               "are mutually exclusive"));
+      return svn_cmdline_handle_exit_error(err, pool, "svn: ");
+    }
+
   /* --trust-server-cert can only be used with --non-interactive */
   if (opt_state.trust_server_cert && !opt_state.non_interactive)
     {


forgot to delete that

forgot to delete that

git-svn-id: 42b1393cca5d551bec90c34575d0b84245f1dba8@9216 0101bb08-14d6-0310-b084-bc0e0c8e3800

--- symbian/speex_types.h
+++ symbian/speex_types.h
@@ -1,40 +0,0 @@
-/*
-   Copyright (C) 2005 Commonwealth Scientific and Industrial Research
-   Organisation (CSIRO) Australia
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions
-   are met:
-
-   - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
-   - Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-
-   - Neither the name of CSIRO Australia nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-   PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE ORGANISATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef SPEEX_TYPES_H
-#define SPEEX_TYPES_H
-
-typedef signed short spx_int16_t;
-typedef signed long spx_int32_t;
-typedef unsigned long spx_uint32_t;
-
-#endif /* ! SPEEX_TYPES_H */


MFp4:
	o Fix the packet statistics
	o Make sure we set the FD bit when in full duplex
	o Improve TX side efficency by eliminating a data copy for
	  unfragmented mbufs (the hardware can't do s/g).
	o Minor busdma pedantry
	o better comments in some places, more XXX in others
	o Minor style nits.

This solves a problem I was seeing where I'd get no ethernet when not
booting with a NFS root.  Well, unless I unplugged the cable and
plugged it back in first so I'd get the same up down up messages I get
for NFS root...

Thanks to sam and scottl for suggestions on making this driver more
efficient through better use of approrpiate APIs.

--- sys/arm/at91/if_ate.c
+++ sys/arm/at91/if_ate.c
@@ -195,7 +195,6 @@
 	ate_get_mac(sc, eaddr);
 	ate_set_mac(sc, eaddr);

-
 	sc->ifp = ifp = if_alloc(IFT_ETHER);
 	if (mii_phy_probe(dev, &sc->miibus, ate_ifmedia_upd, ate_ifmedia_sts)) {
 		device_printf(dev, "Cannot find my PHY.\n");
@@ -271,10 +270,12 @@
 	 * For the last buffer, set the wrap bit so the controller
 	 * restarts from the first descriptor.
 	 */
+	bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map, BUS_DMASYNC_PREWRITE);
 	if (i == ATE_MAX_RX_BUFFERS - 1)
 		sc->rx_descs[i].addr = segs[0].ds_addr | ETH_WRAP_BIT;
 	else
 		sc->rx_descs[i].addr = segs[0].ds_addr;
+	bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map, BUS_DMASYNC_POSTWRITE);
 	sc->rx_descs[i].status = 0;
 	/* Flush the memory in the mbuf */
 	bus_dmamap_sync(sc->rxtag, sc->rx_map[i], BUS_DMASYNC_PREREAD);
@@ -489,11 +490,30 @@
 }

 static void
+ate_stat_update(struct ate_softc *sc, int active)
+{
+	/*
+	 * The speed and full/half-duplex state needs to be reflected
+	 * in the ETH_CFG register.
+	 */
+	if (IFM_SUBTYPE(active) == IFM_10_T)
+		WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) & ~ETH_CFG_SPD);
+	else
+		WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) | ETH_CFG_SPD);
+	if (active & IFM_FDX)
+		WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) | ETH_CFG_FD);
+	else
+		WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) & ~ETH_CFG_FD);
+}
+
+static void
 ate_tick(void *xsc)
 {
 	struct ate_softc *sc = xsc;
+	struct ifnet *ifp = sc->ifp;
 	struct mii_data *mii;
 	int active;
+	uint32_t c;

 	/*
 	 * The KB920x boot loader tests ETH_SR & ETH_SR_LINK and will ask
@@ -506,25 +526,8 @@
 		active = mii->mii_media_active;
 		mii_tick(mii);
 		if (mii->mii_media_status & IFM_ACTIVE &&
-		     active != mii->mii_media_active) {
-			/*
-			 * The speed and full/half-duplex state needs
-			 * to be reflected in the ETH_CFG register, it
-			 * seems.
-			 */
-			if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T)
-				WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) &
-				    ~ETH_CFG_SPD);
-			else
-				WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) |
-				    ETH_CFG_SPD);
-			if (mii->mii_media_active & IFM_FDX)
-				WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) |
-				    ETH_CFG_FD);
-			else
-				WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) &
-				    ~ETH_CFG_FD);
-		}
+		     active != mii->mii_media_active)
+			ate_stat_update(sc, mii->mii_media_active);
 	}

 	/*
@@ -535,16 +538,25 @@
 	 * the dot3Stats mib, so for those we just count them as general
 	 * errors.  Stats for iframes, ibutes, oframes and obytes are
 	 * collected elsewhere.  These registers zero on a read to prevent
-	 * races.
+	 * races.  For all the collision stats, also update the collision
+	 * stats for the interface.
 	 */
 	sc->mibdata.dot3StatsAlignmentErrors += RD4(sc, ETH_ALE);
 	sc->mibdata.dot3StatsFCSErrors += RD4(sc, ETH_SEQE);
-	sc->mibdata.dot3StatsSingleCollisionFrames += RD4(sc, ETH_SCOL);
-	sc->mibdata.dot3StatsMultipleCollisionFrames += RD4(sc, ETH_MCOL);
+	c = RD4(sc, ETH_SCOL);
+	ifp->if_collisions += c;
+	sc->mibdata.dot3StatsSingleCollisionFrames += c;
+	c = RD4(sc, ETH_MCOL);
+	sc->mibdata.dot3StatsMultipleCollisionFrames += c;
+	ifp->if_collisions += c;
 	sc->mibdata.dot3StatsSQETestErrors += RD4(sc, ETH_SQEE);
 	sc->mibdata.dot3StatsDeferredTransmissions += RD4(sc, ETH_DTE);
-	sc->mibdata.dot3StatsLateCollisions += RD4(sc, ETH_LCOL);
-	sc->mibdata.dot3StatsExcessiveCollisions += RD4(sc, ETH_ECOL);
+	c = RD4(sc, ETH_LCOL);
+	sc->mibdata.dot3StatsLateCollisions += c;
+	ifp->if_collisions += c;
+	c = RD4(sc, ETH_ECOL);
+	sc->mibdata.dot3StatsExcessiveCollisions += c;
+	ifp->if_collisions += c;
 	sc->mibdata.dot3StatsCarrierSenseErrors += RD4(sc, ETH_CSE);
 	sc->mibdata.dot3StatsFrameTooLongs += RD4(sc, ETH_ELR);
 	sc->mibdata.dot3StatsInternalMacReceiveErrors += RD4(sc, ETH_DRFC);
@@ -552,7 +564,7 @@
 	 * not sure where to lump these, so count them against the errors
 	 * for the interface.
 	 */
-	sc->ifp->if_oerrors += RD4(sc, ETH_CSE) + RD4(sc, ETH_TUE);
+	sc->ifp->if_oerrors += RD4(sc, ETH_TUE);
 	sc->ifp->if_ierrors += RD4(sc, ETH_CDE) + RD4(sc, ETH_RJB) +
 	    RD4(sc, ETH_USF);

@@ -577,9 +589,9 @@
     uint32_t low, high;

     /*
-     * The KB920x loaders will setup the MAC with an address, if one
-     * is set in the loader.  The TSC loader will also set the MAC address
-     * in a similar way.  Grab the MAC address from the SA1[HL] registers.
+     * The boot loader setup the MAC with an address, if one is set in
+     * the loader.  The TSC loader will also set the MAC address in a
+     * similar way.  Grab the MAC address from the SA1[HL] registers.
      */
     low = RD4(sc, ETH_SA1L);
     high =  RD4(sc, ETH_SA1H);
@@ -595,6 +607,7 @@
 ate_intr(void *xsc)
 {
 	struct ate_softc *sc = xsc;
+	struct ifnet *ifp = sc->ifp;
 	int status;
 	int i;
 	void *bp;
@@ -614,15 +627,18 @@
 			rx_stat = sc->rx_descs[i].status;
 			if ((rx_stat & ETH_LEN_MASK) == 0) {
 				printf("ignoring bogus 0 len packet\n");
+				bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map,
+				    BUS_DMASYNC_PREWRITE);
 				sc->rx_descs[i].addr &= ~ETH_CPU_OWNER;
 				bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map,
-				    BUS_DMASYNC_PREWRITE);
+				    BUS_DMASYNC_POSTWRITE);
 				continue;
 			}
 			/* Flush memory for mbuf so we don't get stale bytes */
 			bus_dmamap_sync(sc->rxtag, sc->rx_map[i],
 			    BUS_DMASYNC_POSTREAD);
-			WR4(sc, ETH_RSR, RD4(sc, ETH_RSR));	// XXX WHY? XXX imp
+			WR4(sc, ETH_RSR, RD4(sc, ETH_RSR));
+
 			/*
 			 * The length returned by the device includes the
 			 * ethernet CRC calculation for the packet, but
@@ -630,25 +646,37 @@
 			 */
 			mb = m_devget(sc->rx_buf[i],
 			    (rx_stat & ETH_LEN_MASK) - ETHER_CRC_LEN,
-			    ETHER_ALIGN, sc->ifp, NULL);
+			    ETHER_ALIGN, ifp, NULL);
+			bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map,
+			    BUS_DMASYNC_PREWRITE);
 			sc->rx_descs[i].addr &= ~ETH_CPU_OWNER;
 			bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map,
-			    BUS_DMASYNC_PREWRITE);
+			    BUS_DMASYNC_POSTWRITE);
 			bus_dmamap_sync(sc->rxtag, sc->rx_map[i],
 			    BUS_DMASYNC_PREREAD);
-			if (mb != NULL)
-				(*sc->ifp->if_input)(sc->ifp, mb);
+			if (mb != NULL) {
+				ifp->if_ipackets++;
+				(*ifp->if_input)(ifp, mb);
+			}
+
 		}
 	}
 	if (status & ETH_ISR_TCOM) {
 		ATE_LOCK(sc);
+		/* XXX TSR register should be cleared */
 		if (sc->sent_mbuf[0]) {
+			bus_dmamap_sync(sc->rxtag, sc->tx_map[0],
+			    BUS_DMASYNC_POSTWRITE);
 			m_freem(sc->sent_mbuf[0]);
+			ifp->if_opackets++;
 			sc->sent_mbuf[0] = NULL;
 		}
 		if (sc->sent_mbuf[1]) {
 			if (RD4(sc, ETH_TSR) & ETH_TSR_IDLE) {
+				bus_dmamap_sync(sc->rxtag, sc->tx_map[1],
+				    BUS_DMASYNC_POSTWRITE);
 				m_freem(sc->sent_mbuf[1]);
+				ifp->if_opackets++;
 				sc->txcur = 0;
 				sc->sent_mbuf[0] = sc->sent_mbuf[1] = NULL;
 			} else {
@@ -684,6 +712,7 @@
 {
 	struct ate_softc *sc = xsc;
 	struct ifnet *ifp = sc->ifp;
+ 	struct mii_data *mii;

 	ATE_ASSERT_LOCKED(sc);

@@ -731,6 +760,10 @@
 	 */
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+
+	mii = device_get_softc(sc->miibus);
+	mii_pollstat(mii);
+	ate_stat_update(sc, mii->mii_media_active);
 	atestart_locked(ifp);

 	callout_reset(&sc->tick_ch, hz, ate_tick, sc);
@@ -745,7 +778,7 @@
 	struct ate_softc *sc = ifp->if_softc;
 	struct mbuf *m, *mdefrag;
 	bus_dma_segment_t segs[1];
-	int nseg;
+	int nseg, e;

 	ATE_ASSERT_LOCKED(sc);
 	if (ifp->if_drv_flags & IFF_DRV_OACTIVE)
@@ -767,14 +800,19 @@
 			ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 			return;
 		}
-		mdefrag = m_defrag(m, M_DONTWAIT);
-		if (mdefrag == NULL) {
-			IFQ_DRV_PREPEND(&ifp->if_snd, m);
-			return;
+		e = bus_dmamap_load_mbuf_sg(sc->mtag, sc->tx_map[sc->txcur], m,
+		    segs, &nseg, 0);
+		if (e == EFBIG) {
+			mdefrag = m_defrag(m, M_DONTWAIT);
+			if (mdefrag == NULL) {
+				IFQ_DRV_PREPEND(&ifp->if_snd, m);
+				return;
+			}
+			m = mdefrag;
+			e = bus_dmamap_load_mbuf_sg(sc->mtag,
+			    sc->tx_map[sc->txcur], m, segs, &nseg, 0);
 		}
-		m = mdefrag;
-		if (bus_dmamap_load_mbuf_sg(sc->mtag, sc->tx_map[sc->txcur], m,
-		    segs, &nseg, 0) != 0) {
+		if (e != 0) {
 			m_freem(m);
 			continue;
 		}


Add a missing \n.

Add a missing \n.

--- sys/arm/at91/if_ate.c
+++ sys/arm/at91/if_ate.c
@@ -191,7 +191,7 @@
 	callout_init_mtx(&sc->tick_ch, &sc->sc_mtx, 0);

 	if ((err = ate_get_mac(sc, eaddr)) != 0) {
-		device_printf(dev, "No MAC address set");
+		device_printf(dev, "No MAC address set\n");
 		goto out;
 	}
 	ate_set_mac(sc, eaddr);


Last commit was in error, revert.

Last commit was in error, revert.

--- sys/dev/ata/ata-all.c
+++ sys/dev/ata/ata-all.c
@@ -663,7 +663,7 @@
 	btrim(atacap->serial, sizeof(atacap->serial));
 	bpack(atacap->serial, atacap->serial, sizeof(atacap->serial));

-	if (bootverbose || 1)
+	if (bootverbose)
 	    printf("ata%d-%s: pio=%s wdma=%s udma=%s cable=%s wire\n",
 		   device_get_unit(ch->dev),
 		   ata_unit2str(atadev),


Use the presence of ctlr->dmainit instead of r_res1 to find out when to initialise DMA.


Use a constant instead of a magic number for the flag that enables decoding of a device ROM.


bandaid assumption that char is signed

bandaid assumption that char is signed

MFC after:	1 week

--- sys/dev/ppbus/immio.c
+++ sys/dev/ppbus/immio.c
@@ -789,7 +789,7 @@
 		}

 	/* Experience showed that we should discard this */
-	if (h == -1)
+	if (h == (char) -1)
 		h = 0;

 	*result = ((int) h << 8) | ((int) l & 0xff);


Handle GEOM::ident attribute by attaching 'sX' string at the end of ident
received from the underlying provider, where X is pp->index value.

OK'ed by:	phk


Rewrite the SMP filedesc locking in knote_attach() in order to
  1.  eliminate unnecessary loop which frees and re-allocates
	the just allocated array
  2.  eliminate the newsize recomputation
  3.  eliminate unnecessary unlock and relock around free
  4.  correctly match the free with the malloc into M_KQUEUE instead of M_TEMP
  5.  eliminate conditional assignment of oldlist, which is equivalent to a
	simple assignment
  6.  eliminate the oldlist temporary variable completely

Reviewed by:    jhb


Back out rev 1.12; its not clear that this is the right thing to do, and in any event, it wasn't done correctly in the first place.

--- sys/kern/kern_event.c
+++ sys/kern/kern_event.c
@@ -557,9 +557,12 @@
 		kq->kq_state |= KQ_SLEEP;
 		error = tsleep(kq, PSOCK | PCATCH, "kqread", timeout);
 		splx(s);
-		if (error == 0 || error == ERESTART)
+		if (error == 0)
 			goto retry;
-		if (error == EWOULDBLOCK)
+		/* don't restart after signals... */
+		if (error == ERESTART)
+			error = EINTR;
+		else if (error == EWOULDBLOCK)
 			error = 0;
 		goto done;
 	}


Don't recursively panic when we call mi_switch() in a critical section, even though calling mi_switch() after a panic is likely a bug anyway as the recursive panic only serves to make things worse.

--- sys/kern/kern_synch.c
+++ sys/kern/kern_synch.c
@@ -287,7 +287,7 @@
 #endif
 	KASSERT(td->td_critnest == 1 || (td->td_critnest == 2 &&
 	    (td->td_pflags & TDP_OWEPREEMPT) != 0 && (flags & SW_INVOL) != 0 &&
-	    newtd == NULL),
+	    newtd == NULL) || panicstr,
 	    ("mi_switch: switch in a critical section"));
 	KASSERT((flags & (SW_INVOL | SW_VOL)) != 0,
 	    ("mi_switch: switch must be voluntary or involuntary"));


clean up more timeout/untimeout portability stuff. make sure flags and stuff are set sensibly.

--- sys/net/if_spppsubr.c
+++ sys/net/if_spppsubr.c
@@ -17,7 +17,7 @@
  *
  * From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997
  *
- * $Id: if_spppsubr.c,v 1.47 1998/12/11 21:40:13 phk Exp $
+ * $Id: if_spppsubr.c,v 1.48 1998/12/16 18:42:30 phk Exp $
  */

 #include <sys/param.h>
@@ -95,11 +95,11 @@
 #include <net/if_sppp.h>

 #if defined (__FreeBSD__)
-# define UNTIMEOUT(fun, arg, handle)	\
-	untimeout(fun, arg, handle)
+# define UNTIMEOUT(fun, arg, handle) untimeout(fun, arg, handle)
+# define TIMEOUT(fun, arg1, arg2, handle) handle = timeout(fun, arg1, arg2)
 #else
-# define UNTIMEOUT(fun, arg, handle)	\
-	untimeout(fun, arg)
+# define UNTIMEOUT(fun, arg, handle) untimeout(fun, arg)
+# define TIMEOUT(fun, arg1, arg2, handle) timeout(fun, arg1, arg2)
 #endif
 #define MAXALIVECNT     3               /* max. alive packets */

@@ -772,17 +772,17 @@

 	/* Initialize keepalive handler. */
 	if (! spppq)
-#if defined (__FreeBSD__)
-		keepalive_ch =
-#endif
-		timeout(sppp_keepalive, 0, hz * 10);
+		TIMEOUT(sppp_keepalive, 0, hz * 10, keepalive_ch);

 	/* Insert new entry into the keepalive list. */
 	sp->pp_next = spppq;
 	spppq = sp;

+	sp->pp_if.if_mtu = PP_MTU;
+	sp->pp_if.if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
 	sp->pp_if.if_type = IFT_PPP;
 	sp->pp_if.if_output = sppp_output;
+	sp->pp_flags = PP_KEEPALIVE;
 	sp->pp_fastq.ifq_maxlen = 32;
 	sp->pp_cpq.ifq_maxlen = 20;
 	sp->pp_loopcnt = 0;
@@ -1711,10 +1711,8 @@
 		case STATE_STOPPING:
 			sppp_cp_send(sp, cp->proto, TERM_REQ, ++sp->pp_seq,
 				     0, 0);
-#if defined (__FreeBSD__)
-			sp->ch[cp->protoidx] =
-#endif
-			timeout(cp->TO, (void *)sp, sp->lcp.timeout);
+			TIMEOUT(cp->TO, (void *)sp, sp->lcp.timeout,
+			    sp->ch[cp->protoidx]);
 			break;
 		case STATE_REQ_SENT:
 		case STATE_ACK_RCVD:
@@ -1724,10 +1722,8 @@
 			break;
 		case STATE_ACK_SENT:
 			(cp->scr)(sp);
-#if defined (__FreeBSD__)
-			sp->ch[cp->protoidx] =
-#endif
-			timeout(cp->TO, (void *)sp, sp->lcp.timeout);
+			TIMEOUT(cp->TO, (void *)sp, sp->lcp.timeout,
+			    sp->ch[cp->protoidx]);
 			break;
 		}

@@ -1756,10 +1752,8 @@
 	case STATE_REQ_SENT:
 	case STATE_ACK_RCVD:
 	case STATE_ACK_SENT:
-#if defined (__FreeBSD__)
-		sp->ch[cp->protoidx]  =
-#endif
-		timeout(cp->TO, (void *)sp, sp->lcp.timeout);
+		TIMEOUT(cp->TO, (void *)sp, sp->lcp.timeout,
+		    sp->ch[cp->protoidx]);
 		break;
 	}
 }
@@ -3259,11 +3253,7 @@
 		 * a number between 300 and 810 seconds.
 		 */
 		i = 300 + ((unsigned)(random() & 0xff00) >> 7);
-
-#if defined (__FreeBSD__)
-		sp->ch[IDX_CHAP] =
-#endif
-		timeout(chap.TO, (void *)sp, i * hz);
+		TIMEOUT(chap.TO, (void *)sp, i * hz, sp->ch[IDX_CHAP]);
 	}

 	if (debug) {
@@ -3529,10 +3519,8 @@
 	if (sp->myauth.proto == PPP_PAP) {
 		/* we are peer, send a request, and start a timer */
 		pap.scr(sp);
-#if defined (__FreeBSD__)
-		sp->pap_my_to_ch =
-#endif
-		timeout(sppp_pap_my_TO, (void *)sp, sp->lcp.timeout);
+		TIMEOUT(sppp_pap_my_TO, (void *)sp, sp->lcp.timeout,
+		    sp->pap_my_to_ch);
 	}
 }

@@ -3808,10 +3796,7 @@
 		}
 	}
 	splx(s);
-#if defined (__FreeBSD__)
-	keepalive_ch =
-#endif
-	timeout(sppp_keepalive, 0, hz * 10);
+	TIMEOUT(sppp_keepalive, 0, hz * 10, keepalive_ch);
 }

 /*


Fix lyd_merge for lists without keys

Fix lyd_merge for lists without keys

--- src/tree_data.c
+++ src/tree_data.c
@@ -1597,6 +1597,14 @@
         }
         break;
     case LYS_LIST:
+        if (((struct lys_node_list *)node1->schema)->keys_size == 0)
+        {
+          /* If there is no key, there is no way to detect equivalence,
+           * so the nodes must always be different
+           */
+          return 0;
+        }
+
         child1 = node1->child;
         child2 = node2->child;
         /* the exact data order is guaranteed */


Fix bugs in the MP fragment reassembly code that can cause a panic.

--- sys/netgraph/ng_ppp.c
+++ sys/netgraph/ng_ppp.c
@@ -874,8 +874,8 @@
 	const priv_p priv = node->private;
 	struct ng_ppp_frag frag0, *frag = &frag0;
 	struct ng_ppp_frag *qent, *qnext;
-	struct ng_ppp_frag *first = NULL, *last = NULL;
-	int diff, highSeq, nextSeq;
+	struct ng_ppp_frag *first, *last;
+	int diff, highSeq, nextSeq, inserted;
 	struct mbuf *tail;

 	/* Extract fragment information from MP header */
@@ -940,10 +940,12 @@
 	m = NULL;

 	/* Add fragment to queue, which is reverse sorted by sequence number */
+	inserted = 0;
 	CIRCLEQ_FOREACH(qent, &priv->frags, f_qent) {
 		diff = MP_SEQ_DIFF(priv, frag->seq, qent->seq);
 		if (diff > 0) {
 			CIRCLEQ_INSERT_BEFORE(&priv->frags, qent, frag, f_qent);
+			inserted = 1;
 			break;
 		} else if (diff == 0) {	     /* should never happen! */
 			log(LOG_ERR, "%s: rec'd dup MP fragment\n", node->name);
@@ -956,34 +958,38 @@
 			return (EINVAL);
 		}
 	}
-	if (qent == NULL)
+	if (!inserted)
 		CIRCLEQ_INSERT_TAIL(&priv->frags, frag, f_qent);

+	/* Find the last fragment in the possibly newly completed frame */
+	last = NULL;
+	qent = frag;
+	nextSeq = frag->seq;
+	while (qent != (void *)&priv->frags && qent->seq == nextSeq) {
+		if (qent->last) {
+			last = qent;
+			break;
+		}
+		qent = CIRCLEQ_PREV(qent, f_qent);
+		nextSeq = (nextSeq + 1) & MP_SEQ_MASK(priv);
+	}
+	if (last == NULL)
+		goto incomplete;
+
 	/* Find the first fragment in the possibly newly completed frame */
-	for (nextSeq = frag->seq, qent = frag;
-	    qent != (void *) &priv->frags;
-	    qent = CIRCLEQ_PREV(qent, f_qent)) {
-		if (qent->seq != nextSeq)
-			goto pruneQueue;
+	first = NULL;
+	qent = frag;
+	nextSeq = frag->seq;
+	while (qent != (void *)&priv->frags && qent->seq == nextSeq) {
 		if (qent->first) {
 			first = qent;
 			break;
 		}
+		qent = CIRCLEQ_NEXT(qent, f_qent);
 		nextSeq = (nextSeq - 1) & MP_SEQ_MASK(priv);
 	}
-
-	/* Find the last fragment in the possibly newly completed frame */
-	for (nextSeq = frag->seq, qent = frag;
-	    qent != (void *) &priv->frags;
-	    qent = CIRCLEQ_NEXT(qent, f_qent)) {
-		if (qent->seq != nextSeq)
-			goto pruneQueue;
-		if (qent->last) {
-			last = qent;
-			break;
-		}
-		nextSeq = (nextSeq + 1) & MP_SEQ_MASK(priv);
-	}
+	if (first == NULL)
+		goto incomplete;

 	/* We have a complete frame, extract it from the queue */
 	for (tail = NULL, qent = first; qent != NULL; qent = qnext) {
@@ -1004,10 +1010,10 @@
 		FREE(qent, M_NETGRAPH);
 	}

-pruneQueue:
+incomplete:
 	/* Prune out stale entries in the queue */
 	for (qent = CIRCLEQ_LAST(&priv->frags);
-	    qent != (void *) &priv->frags; qent = qnext) {
+	    qent != (void *)&priv->frags; qent = qnext) {
 		if (MP_SEQ_DIFF(priv, highSeq, qent->seq) <= MP_MAX_SEQ_LINGER)
 			break;
 		qnext = CIRCLEQ_PREV(qent, f_qent);
@@ -1526,11 +1532,11 @@
 ng_ppp_free_frags(node_p node)
 {
 	const priv_p priv = node->private;
-	struct ng_ppp_frag *qent, *next;
+	struct ng_ppp_frag *qent, *qnext;

 	for (qent = CIRCLEQ_FIRST(&priv->frags);
-	    qent != (void *) &priv->frags; qent = next) {
-		next = CIRCLEQ_NEXT(qent, f_qent);
+	    qent != (void *)&priv->frags; qent = qnext) {
+		qnext = CIRCLEQ_NEXT(qent, f_qent);
 		NG_FREE_DATA(qent->data, qent->meta);
 		FREE(qent, M_NETGRAPH);
 	}


data validation BUGFIX assignement instead of comparison

--- src/tree_data.c
+++ src/tree_data.c
@@ -5557,7 +5557,7 @@
                 msg_sibling->prev = msg_sibling;
                 msg_sibling->parent = NULL;
             } else {
-                assert(data_tree_sibling->prev = msg_sibling);
+                assert(data_tree_sibling->prev == msg_sibling);
                 data_tree_sibling->prev = msg_sibling->prev;
                 data_tree_sibling->prev->next = NULL;
                 msg_sibling->prev = msg_sibling;


Cleanup useless break.

Cleanup useless break.

Submitted by:	JINMEI Tatuya <jinmei@isl.rdc.toshiba.co.jp>

--- sys/netinet6/ip6_fw.c
+++ sys/netinet6/ip6_fw.c
@@ -291,19 +291,16 @@
 				opts &= ~IPV6_FW_IP6OPT_ESP;
 				nopts &= ~IPV6_FW_IP6OPT_ESP;
 				goto opts_check;
-				break;
 			case IPPROTO_NONE:
 				opts &= ~IPV6_FW_IP6OPT_NONXT;
 				nopts &= ~IPV6_FW_IP6OPT_NONXT;
 				goto opts_check;
-				break;
 			case IPPROTO_DSTOPTS:
 				opts &= ~IPV6_FW_IP6OPT_OPTS;
 				nopts &= ~IPV6_FW_IP6OPT_OPTS;
 				break;
 			default:
 				goto opts_check;
-				break;
 			}
 			*off += (ip6e->ip6e_len + 1) << 3;
 			break;


lyd_insert_sibling() BUGFIX detection if validation will be needed

It is necessary to detect if the node is being inserted into (moved in)
RPC. In that case it is necessary to validate the result because nodes
order matters in RPCs. But the code could skip the RPC tree detection
if the node was top-level (RPC operation top level).

--- src/tree_data.c
+++ src/tree_data.c
@@ -2321,13 +2321,13 @@
         return EXIT_FAILURE;
     }

-    if (node->parent != sibling->parent || !node->parent || (invalid = lyp_is_rpc(node->schema))) {
+    if (node->parent != sibling->parent || (invalid = lyp_is_rpc(node->schema)) || !node->parent) {
         /* a) it is not just moving under a parent node (invalid = 1) or
-         * b) it is top-level where we don't know if it is the same tree (invalid = 1), or
-         * c) it is in an RPC where nodes order matters (invalid = 2),
+         * b) it is in an RPC where nodes order matters (invalid = 2) or
+         * c) it is top-level where we don't know if it is the same tree (invalid = 1),
          * so the validation will be necessary */
-        if (!node->parent) {
-            /* b) search in siblings */
+        if (!node->parent && !invalid) {
+            /* c) search in siblings */
             for (iter = node->prev; iter != node; iter = iter->prev) {
                 if (iter == sibling) {
                     break;
@@ -2337,7 +2337,7 @@
                 /* node and siblings are not currently in the same data tree */
                 invalid++;
             }
-        } else { /* a) and c) */
+        } else { /* a) and b) */
             invalid++;
         }
     }


MFC: r207241

MFC: r207241

- Add a missing const.
- Map the NS16550 found in Fujitsu Siemens PRIMEPOWER250 to PNP0501 as well.


data tree MAINTENANCE do not use strlen as a variable name to avoid confusion

Fixes #787

--- src/tree_data.c
+++ src/tree_data.c
@@ -29,12 +29,12 @@
 #include "tree_schema.h"

 static int
-cmp_str(const char *refstr, const char *str, size_t strlen)
-{
-
-    if (strlen) {
-        int r = strncmp(refstr, str, strlen);
-        if (!r && !refstr[strlen]) {
+cmp_str(const char *refstr, const char *str, size_t str_len)
+{
+
+    if (str_len) {
+        int r = strncmp(refstr, str, str_len);
+        if (!r && !refstr[str_len]) {
             return 0;
         } else {
             return 1;


MFC r202971:

MFC r202971:

Return proper error code.

Found with:	clang

--- sys/ufs/ufs/ufs_acl.c
+++ sys/ufs/ufs/ufs_acl.c
@@ -465,7 +465,7 @@

 	error = ufs_setacl_nfs4_internal(ap->a_vp, ap->a_aclp, ap->a_td);

-	return (0);
+	return (error);
 }

 /*


data tree BUGFIX bits leaf has value_str just like any leaf

Memory leak fix.

--- src/tree_data.c
+++ src/tree_data.c
@@ -3169,7 +3169,7 @@
             if (((struct lyd_node_leaf_list *)node)->value.bit) {
                 free(((struct lyd_node_leaf_list *)node)->value.bit);
             }
-            break;
+            /* fallthrough */
         default:
             lydict_remove(node->schema->module->ctx, ((struct lyd_node_leaf_list *)node)->value_str);
             break;


Add a missing initialization of the hold_count for device pager ficticiouse pages.

--- sys/vm/device_pager.c
+++ sys/vm/device_pager.c
@@ -36,7 +36,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)device_pager.c	8.1 (Berkeley) 6/11/93
- * $Id: device_pager.c,v 1.19 1995/12/14 09:54:49 phk Exp $
+ * $Id: device_pager.c,v 1.20 1996/01/19 03:59:38 dyson Exp $
  */

 #include <sys/param.h>
@@ -282,6 +282,7 @@
 	m->queue = PQ_NONE;

 	m->wire_count = 1;
+	m->hold_count = 0;
 	m->phys_addr = paddr;

 	return (m);


Removed unused file.

Removed unused file.

--- sys/vm/device_pager.h
+++ sys/vm/device_pager.h
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1990 University of Utah.
- * Copyright (c) 1991, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	@(#)device_pager.h	8.3 (Berkeley) 12/13/93
- * $Id$
- */
-
-#ifndef	_DEVICE_PAGER_
-#define	_DEVICE_PAGER_	1
-
-
-#endif				/* _DEVICE_PAGER_ */


tube-dbus: always create the dbus_names hash table as the property has to be implemented in muc tubes too

--- src/tube-dbus.c
+++ src/tube-dbus.c
@@ -164,7 +164,7 @@
   GSList *dbus_msg_queue;
   /* current size of the queue in bytes. The maximum is MAX_QUEUE_SIZE */
   unsigned long dbus_msg_queue_size;
-  /* mapping of contact handle -> D-Bus name (NULL for 1-1 D-Bus tubes) */
+  /* mapping of contact handle -> D-Bus name (empty for 1-1 D-Bus tubes) */
   GHashTable *dbus_names;
   /* mapping of D-Bus name -> contact handle */
   GHashTable *dbus_name_to_handle;
@@ -830,6 +830,9 @@

   base = (TpBaseConnection *) priv->conn;

+  priv->dbus_names = g_hash_table_new_full (g_direct_hash, g_direct_equal,
+      NULL, g_free);
+
   g_assert (priv->self_handle != 0);
   if (priv->handle_type == TP_HANDLE_TYPE_ROOM)
     {
@@ -846,8 +849,6 @@

       g_assert (priv->stream_id != NULL);

-      priv->dbus_names = g_hash_table_new_full (g_direct_hash, g_direct_equal,
-          NULL, g_free);
       priv->dbus_name_to_handle = g_hash_table_new_full (g_str_hash,
          g_str_equal, NULL, NULL);

@@ -883,7 +884,6 @@
     {
       /* The D-Bus names mapping is used in muc tubes only */
       priv->dbus_local_name = NULL;
-      priv->dbus_names = NULL;
       priv->dbus_name_to_handle = NULL;

       /* For contact (IBB) tubes we need to be able to reassemble messages. */