Make agnosticbintest work faster not syncing on the clock

Change-Id: I7f2ef24f5536a6b817b57a8f0d60c05b0c3a532a

--- tests/check/element/agnosticbin.c
+++ tests/check/element/agnosticbin.c
@@ -209,7 +209,7 @@
   g_signal_connect (bus, "message", G_CALLBACK (bus_msg), pipeline);
   g_object_unref (bus);

-  g_object_set (G_OBJECT (fakesink2), "sync", TRUE, "signal-handoffs", TRUE,
+  g_object_set (G_OBJECT (fakesink2), "sync", FALSE, "signal-handoffs", TRUE,
       NULL);
   g_signal_connect (G_OBJECT (fakesink2), "handoff",
       G_CALLBACK (fakesink_hand_off), loop);


Add an alias for WS2852 to WS2812, fix #257.

--- FastLED.h
+++ FastLED.h
@@ -98,6 +98,7 @@
 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class UCS1904 : public UCS1904Controller800Khz<DATA_PIN, RGB_ORDER> {};
 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class UCS2903 : public UCS2903Controller<DATA_PIN, RGB_ORDER> {};
 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2812 : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
+template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2852 : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2812B : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class SK6812 : public SK6812Controller<DATA_PIN, RGB_ORDER> {};
 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class SK6822 : public SK6822Controller<DATA_PIN, RGB_ORDER> {};
@@ -459,8 +460,8 @@
 	/// Update all our controllers with the current led colors
 	void show() { show(m_Scale); }

-	/// clear the leds, optionally wiping the local array of data as well
-	/// @param writeData whether or not to write into the local data array as well
+	/// clear the leds, wiping the local array of data, optionally black out the leds as well
+	/// @param writeData whether or not to write out to the leds as well
 	void clear(boolean writeData = false);

 	/// clear out the local data array


tests: timelineedition: Add a test_scaling.

It will check that the clip updates its size correctly.

--- tests/check/ges/timelineedition.c
+++ tests/check/ges/timelineedition.c
@@ -1254,6 +1254,216 @@

 GST_END_TEST;

+static void
+_set_track_element_width_height (GESTrackElement * trksrc, gint wvalue,
+    gint hvalue)
+{
+  GValue width = { 0 };
+  GValue height = { 0 };
+
+  g_value_init (&width, G_TYPE_INT);
+  g_value_init (&height, G_TYPE_INT);
+  g_value_set_int (&width, wvalue);
+  g_value_set_int (&height, hvalue);
+  if (wvalue >= 0)
+    ges_track_element_set_child_property (trksrc, "width", &width);
+  if (hvalue >= 0)
+    ges_track_element_set_child_property (trksrc, "height", &height);
+}
+
+static gboolean
+check_frame_positionner_size (GESClip * clip, gint width, gint height)
+{
+  GESTrackElement *trksrc;
+  GValue val_width = { 0 };
+  GValue val_height = { 0 };
+  gint real_width, real_height;
+
+  trksrc = GES_CONTAINER_CHILDREN (clip)->data;
+  if (!GES_IS_VIDEO_SOURCE (trksrc))
+    return FALSE;
+
+  g_value_init (&val_width, G_TYPE_INT);
+  g_value_init (&val_height, G_TYPE_INT);
+
+  ges_track_element_get_child_property (trksrc, "width", &val_width);
+  ges_track_element_get_child_property (trksrc, "height", &val_height);
+
+  real_width = g_value_get_int (&val_width);
+  real_height = g_value_get_int (&val_height);
+
+  return (width == real_width && height == real_height);
+}
+
+GST_START_TEST (test_scaling)
+{
+  GESTimeline *timeline;
+  GESLayer *layer;
+  GESAsset *asset1, *asset2;
+  GESClip *clip;
+  GESTrack *trackv = GES_TRACK (ges_video_track_new ());
+  GstCaps *caps =
+      gst_caps_new_simple ("video/x-raw", "width", G_TYPE_INT, 1200, "height",
+      G_TYPE_INT, 1000, NULL);
+
+  ges_init ();
+  timeline = ges_timeline_new ();
+  ges_timeline_add_track (timeline, trackv);
+  layer = ges_layer_new ();
+  fail_unless (ges_timeline_add_layer (timeline, layer));
+
+  g_object_set (layer, "auto-transition", TRUE, NULL);
+
+  asset1 = GES_ASSET (ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL));
+  asset2 = GES_ASSET (ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL));
+
+  fail_unless (asset1 != NULL && asset2 != NULL);
+
+  GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (timeline),
+      GST_DEBUG_GRAPH_SHOW_ALL, "ges-integration-timeline");
+
+  ges_track_set_restriction_caps (trackv, caps);
+  gst_caps_unref (caps);
+
+  GST_DEBUG ("adding clip, should be 1200 x 1000");
+  clip =
+      ges_layer_add_asset (layer, GES_ASSET (asset1), 0 * GST_SECOND,
+      0 * GST_SECOND, 4 * GST_SECOND, GES_TRACK_TYPE_UNKNOWN);
+  gst_object_unref (asset1);
+  g_object_set (clip, "vpattern", (gint) GES_VIDEO_TEST_PATTERN_SMPTE75, NULL);
+
+  /**
+   * Our track: 1200 x 1000
+   *
+   * 0--------------0
+   * | width : 1200 |
+   * | height: 1000 |
+   * 0--------------2
+   */
+
+  /* clip takes the size set on the track as a default */
+  fail_unless (check_frame_positionner_size (clip, 1200, 1000));
+
+  if (GES_IS_VIDEO_SOURCE (GES_CONTAINER_CHILDREN (clip)->data))
+    _set_track_element_width_height (GES_CONTAINER_CHILDREN (clip)->data, 1024,
+        768);
+
+  GST_DEBUG ("Setting clip size, should be 1024 x 768");
+
+  /**
+   * Our timeline : 1200 x 1000
+   *
+   * 0--------------0
+   * | width : 1024 |
+   * | height: 768  |
+   * 0--------------2
+   */
+
+  /* Clip has to comply to direct orders */
+  fail_unless (check_frame_positionner_size (clip, 1024, 768));
+
+  GST_DEBUG ("Changing caps, should still be 1024 x 768");
+
+  caps =
+      gst_caps_new_simple ("video/x-raw", "width", G_TYPE_INT, 1400, "height",
+      G_TYPE_INT, 1200, NULL);
+  ges_track_set_restriction_caps (trackv, caps);
+  gst_caps_unref (caps);
+
+  /**
+   * Our timeline : 1400 x 1200
+   *
+   * 0--------------0
+   * | width : 1024 |
+   * | height: 768  |
+   * 0--------------2
+   */
+
+  /* Clip still has to be the same size */
+  fail_unless (check_frame_positionner_size (clip, 1024, 768));
+
+  GST_DEBUG ("Setting width to 0, should be 1400 x 768");
+
+  /* -1 means don't set it, only valid here */
+  if (GES_IS_VIDEO_SOURCE (GES_CONTAINER_CHILDREN (clip)->data))
+    _set_track_element_width_height (GES_CONTAINER_CHILDREN (clip)->data, 0,
+        -1);
+
+  /**
+   * Our timeline : 1400 x 1200
+   *
+   * 0--------------0
+   * | width : 1400 |
+   * | height: 768  |
+   * 0--------------2
+   */
+
+  /* Clip width was set to 0 so it has to use track width */
+  /* Clip height is still directly set by the user */
+  fail_unless (check_frame_positionner_size (clip, 1400, 768));
+
+  GST_DEBUG ("Setting height to 0, should be 1400 x 1200");
+
+  if (GES_IS_VIDEO_SOURCE (GES_CONTAINER_CHILDREN (clip)->data))
+    _set_track_element_width_height (GES_CONTAINER_CHILDREN (clip)->data, -1,
+        0);
+
+  /**
+   * Our timeline : 1400 x 1200
+   *
+   * 0--------------0
+   * | width : 1400 |
+   * | height: 1200 |
+   * 0--------------2
+   */
+
+  /* Clip width still has to use track width */
+  /* Clip height was set to 0 so it has to use track height */
+  fail_unless (check_frame_positionner_size (clip, 1400, 1200));
+
+  GST_DEBUG ("Removing restriction on track height, should be 1400 x 240");
+
+  caps =
+      gst_caps_new_simple ("video/x-raw", "width", G_TYPE_INT, 1400, "height",
+      G_TYPE_INT, 0, NULL);
+  ges_track_set_restriction_caps (trackv, caps);
+  gst_caps_unref (caps);
+
+  /**
+   * Our timeline : 1400 x no restriction
+   *
+   * 0--------------0
+   * | width : 1400 |
+   * | height: 240  |
+   * 0--------------2
+   */
+
+  /* Clip width still has to use track width */
+  /* Clip height was set to 0 so it has to use natural clip height */
+  fail_unless (check_frame_positionner_size (clip, 1400, 0));
+
+  GST_DEBUG ("Removing restriction on track width, should be 320 x 240");
+
+  caps = gst_caps_new_empty_simple ("video/x-raw");
+  ges_track_set_restriction_caps (trackv, caps);
+  gst_caps_unref (caps);
+
+  /**
+   * Our timeline : no restriction x no restriction
+   *
+   * 0--------------0
+   * | width : 320  |
+   * | height: 240  |
+   * 0--------------2
+   */
+
+  /* Clip width was set to 0 so it has to use natural clip width */
+  /* Clip height was set to 0 so it has to use natural clip height */
+  fail_unless (check_frame_positionner_size (clip, 0, 0));
+}
+
+GST_END_TEST;
+
 static Suite *
 ges_suite (void)
 {
@@ -1268,6 +1478,7 @@
   tcase_add_test (tc_chain, test_simple_triming);
   tcase_add_test (tc_chain, test_groups);
   tcase_add_test (tc_chain, test_snapping_groups);
+  tcase_add_test (tc_chain, test_scaling);

   return s;
 }


Deletred obsolete file

Deletred obsolete file


Additional tests.

Additional tests.

--- tests/mem_functions.c
+++ tests/mem_functions.c
@@ -5014,6 +5014,71 @@

   // See if memcached is reachable.
   value= memcached_get(memc, key, strlen(key), &len, &flags, &rc);
+
+  if (value)
+  {
+    free(value);
+    test_true(value); // Pointer won't be zero so this is fine.
+  }
+
+  test_true(len == 0);
+  test_true(rc == MEMCACHED_NOTFOUND);
+
+  return TEST_SUCCESS;
+}
+
+/*
+  Test case adapted from John Gorman <johngorman2@gmail.com>
+
+  We are testing the error condition when we connect to a server via memcached_get_by_key()
+  but find that the server is not available.
+*/
+static test_return_t memcached_get_by_key_MEMCACHED_SOME_ERRORS(memcached_st *memc)
+{
+  (void)memc;
+  memcached_st *tl_memc_h;
+  memcached_server_st *servers;
+
+  const char *key= "MemcachedLives";
+  size_t len;
+  uint32_t flags;
+  memcached_return rc;
+  char *value;
+
+  // Create a handle.
+  tl_memc_h= memcached_create(NULL);
+  servers= memcached_servers_parse("localhost:9898"); // This server should not exist
+  memcached_server_push(tl_memc_h, servers);
+  memcached_server_list_free(servers);
+
+  // See if memcached is reachable.
+  value= memcached_get_by_key(tl_memc_h, key, strlen(key), key, strlen(key), &len, &flags, &rc);
+
+  if (value)
+  {
+    free(value);
+    test_true(value); // Pointer won't be zero so this is fine.
+  }
+
+  test_true(len == 0);
+  test_true(rc == MEMCACHED_SOME_ERRORS);
+
+  return TEST_SUCCESS;
+}
+
+/*
+  We connect to a server which exists, but search for a key that does not exist.
+*/
+static test_return_t memcached_get_by_key_MEMCACHED_NOTFOUND(memcached_st *memc)
+{
+  const char *key= "MemcachedKeyNotEXIST";
+  size_t len;
+  uint32_t flags;
+  memcached_return rc;
+  char *value;
+
+  // See if memcached is reachable.
+  value= memcached_get_by_key(memc, key, strlen(key), key, strlen(key), &len, &flags, &rc);

   if (value)
   {
@@ -6192,6 +6257,8 @@
 test_st error_conditions[] ={
   {"memcached_get_MEMCACHED_SOME_ERRORS", 0, (test_callback_fn)memcached_get_MEMCACHED_SOME_ERRORS },
   {"memcached_get_MEMCACHED_NOTFOUND", 0, (test_callback_fn)memcached_get_MEMCACHED_NOTFOUND },
+  {"memcached_get_by_key_MEMCACHED_SOME_ERRORS", 0, (test_callback_fn)memcached_get_by_key_MEMCACHED_SOME_ERRORS },
+  {"memcached_get_by_key_MEMCACHED_NOTFOUND", 0, (test_callback_fn)memcached_get_by_key_MEMCACHED_NOTFOUND },
   {0, 0, (test_callback_fn)0}
 };


Fix ubsan warning: vp8/encoder/onyx_ifc

Fix ubsan warning: vp8/encoder/onyx_ifc

BUG=https://bugs.chromium.org/p/webm/issues/detail?id=1219

Change-Id: I4362a1cf79fdcb478b29ddbcdf8091c5f5d10645

--- vp8/encoder/onyx_if.c
+++ vp8/encoder/onyx_if.c
@@ -5222,7 +5222,7 @@
         vp8_second_pass(cpi);

     encode_frame_to_data_rate(cpi, size, dest, dest_end, frame_flags);
-    cpi->twopass.bits_left -= 8 * *size;
+    cpi->twopass.bits_left -= 8 * (int)(*size);

     if (!cpi->common.refresh_alt_ref_frame)
     {


no message

no message

git-svn-id: 2bceadd671bcc8d4f7a34159d1bc3b98592acb3b@18 7ec92016-0320-0410-acc4-a06ded1c099a

--- Functor.h
+++ Functor.h
@@ -8,7 +8,7 @@
 //     purpose is hereby granted without fee, provided that the above copyright
 //     notice appear in all copies and that both that copyright notice and this
 //     permission notice appear in supporting documentation.
-// The author or Addison-Welsey Longman make no representations about the
+// The author or Addison-Wesley Longman make no representations about the
 //     suitability of this software for any purpose. It is provided "as is"
 //     without express or implied warranty.
 ////////////////////////////////////////////////////////////////////////////////


Update comments.

Update comments.

--- m-string.h
+++ m-string.h
@@ -82,8 +82,8 @@

 static inline void stringi_clear2(string_t *v) { string_clear(*v); }

-/* NOTE: Returned pointer has to be released by a free.
-   It makes a hard link between a string and a free... */
+/* NOTE: Returned pointer has to be released by 'free' (if not overloaded).
+   It makes a hard link between a string and 'free'... */
 static inline char *
 string_clear_get_str(string_t v)
 {
@@ -352,6 +352,9 @@
 string_search_rchar (const string_t v, char c)
 {
   STRING_CONTRACT (v);
+  // NOTE: Can implement it in a faster way than the libc function
+  // by scanning backward from the bottom of the string (which is
+  // possible since we know the size)
   const char *p = (const char*) strrchr(string_get_cstr(v), c);
   return p == NULL ? STRING_FAILURE : (size_t) (p-string_get_cstr(v));
 }


Bug 477186: Infinite loop in CERT_GetCertChainFromCert, r=wtc

--- security/nss/lib/certhigh/certvfy.c
+++ security/nss/lib/certhigh/certvfy.c
@@ -1947,6 +1947,7 @@
 CERT_GetCertChainFromCert(CERTCertificate *cert, int64 time, SECCertUsage usage)
 {
     CERTCertList *chain = NULL;
+    int count = 0;

     if (NULL == cert) {
         return NULL;
@@ -1964,7 +1965,7 @@
         return NULL;
     }

-    while (cert != NULL) {
+    while (cert != NULL && ++count <= CERT_MAX_CERT_CHAIN) {
 	if (SECSuccess != CERT_AddCertToListTail(chain, cert)) {
             /* return partial chain */
             PORT_SetError(SEC_ERROR_NO_MEMORY);


Checkin for relyea. Call CERT_DestoryCertificateList instead of CERT_DestroyCertList

--- security/nss/lib/smime/cmssiginfo.c
+++ security/nss/lib/smime/cmssiginfo.c
@@ -111,7 +111,7 @@
 	CERT_DestroyCertificate(si->cert);

     if (si->certList != NULL)
-	CERT_DestroyCertList(si->certList);
+	CERT_DestroyCertificateList(si->certList);

     /* XXX storage ??? */
 }
@@ -859,7 +859,7 @@

     /* don't leak if we get called twice */
     if (signerinfo->certList != NULL) {
-	CERT_DestroyCertList(signerinfo->certList);
+	CERT_DestroyCertificateList(signerinfo->certList);
 	signerinfo->certList = NULL;
     }


ima: provide double buffering for hash calculation

The asynchronous hash API allows initiating a hash calculation and
then performing other tasks, while waiting for the hash calculation
to complete.

This patch introduces usage of double buffering for simultaneous
hashing and reading of the next chunk of data from storage.

Changes in v3:
- better comments

Signed-off-by: Dmitry Kasatkin <c116bc32ce0fd3cd5ab78828b5c5c631dc6f63d8@samsung.com>
Signed-off-by: Mimi Zohar <f02992f7c171053741caa6b515d9896745b37477@linux.vnet.ibm.com>


Bug 338071: pk11_CreateNewContextInSlot may dereference a NULL symkey pointer Patch contributed by Shailendra Jain <shailen.n.jain@gmail.com>, r=nelson

--- security/nss/lib/pk11wrap/pk11cxt.c
+++ security/nss/lib/pk11wrap/pk11cxt.c
@@ -249,7 +249,8 @@
     SECStatus rv;

     PORT_Assert(slot != NULL);
-    if (!slot || (!symKey && operation != CKA_DIGEST)) {
+    if (!slot || (!symKey && ((operation != CKA_DIGEST) ||
+	                      (type == CKM_SKIPJACK_CBC64)))) {
 	PORT_SetError(SEC_ERROR_INVALID_ARGS);
 	return NULL;
     }


clean up patch based on wtc review

clean up patch based on wtc review

--- security/nss/lib/softoken/pkcs11c.c
+++ security/nss/lib/softoken/pkcs11c.c
@@ -1999,34 +1999,34 @@
 }

 static SECStatus
-nsc_DSA_Verify_Stub(void *ctx, void *pSignature, unsigned int ulSignatureLen,
-                               void *pData, unsigned int ulDataLen)
+nsc_DSA_Verify_Stub(void *ctx, void *sigBuf, unsigned int sigLen,
+                               void *dataBuf, unsigned int dataLen)
 {
     SECItem signature, digest;
     SECKEYLowPublicKey *key = (SECKEYLowPublicKey *)ctx;

-    signature.data = (unsigned char *)pSignature;
-    signature.len = ulSignatureLen;
-    digest.data = (unsigned char *)pData;
-    digest.len = ulDataLen;
+    signature.data = (unsigned char *)sigBuf;
+    signature.len = sigLen;
+    digest.data = (unsigned char *)dataBuf;
+    digest.len = dataLen;
     return DSA_VerifyDigest(&(key->u.dsa), &signature, &digest);
 }

 static SECStatus
-nsc_DSA_Sign_Stub(void *ctx, void *pSignature,
-                  unsigned int *ulSignatureLen, unsigned int maxulSignatureLen,
-                  void *pData, unsigned int ulDataLen)
+nsc_DSA_Sign_Stub(void *ctx, void *sigBuf,
+                  unsigned int *sigLen, unsigned int maxSigLen,
+                  void *dataBuf, unsigned int dataLen)
 {
     SECItem signature = { 0 }, digest;
     SECStatus rv;
     SECKEYLowPrivateKey *key = (SECKEYLowPrivateKey *)ctx;

-    (void)SECITEM_AllocItem(NULL, &signature, maxulSignatureLen);
-    digest.data = (unsigned char *)pData;
-    digest.len = ulDataLen;
+    (void)SECITEM_AllocItem(NULL, &signature, maxSigLen);
+    digest.data = (unsigned char *)dataBuf;
+    digest.len = dataLen;
     rv = DSA_SignDigest(&(key->u.dsa), &signature, &digest);
-    *ulSignatureLen = signature.len;
-    PORT_Memcpy((unsigned char *)pSignature, signature.data, signature.len);
+    *sigLen = signature.len;
+    PORT_Memcpy(sigBuf, signature.data, signature.len);
     SECITEM_FreeItem(&signature, PR_FALSE);
     return rv;
 }
@@ -2480,8 +2480,8 @@
 			   CK_MECHANISM_PTR pMechanism,CK_OBJECT_HANDLE hKey)
 {
     PK11Session *session;
-    PK11Object *key = NULL;
-    PK11SessionContext *context = NULL;
+    PK11Object *key;
+    PK11SessionContext *context;
     CK_KEY_TYPE key_type;
     CK_RV crv = CKR_OK;
     SECKEYLowPublicKey *pubKey;


Bug 191467 Multipart signing and verifying broken for several mechanisms in softoken Reporter:   	Andreas.Sterbenz@sun.com (Andreas Sterbenz) sr=nelsonb

Bug 191467
Multipart signing and verifying broken for several mechanisms in softoken
Reporter:   4d793a377cf133baab1b2babf9119bc2c52ee14d@sun.com (Andreas Sterbenz)
sr=nelsonb

--- security/nss/lib/softoken/pkcs11c.c
+++ security/nss/lib/softoken/pkcs11c.c
@@ -1731,7 +1731,6 @@
 	    crv = CKR_KEY_TYPE_INCONSISTENT;
 	    break;
 	}
-	context->multi = PR_FALSE;
 	privKey = pk11_GetPrivKey(key,CKK_RSA,&crv);
 	if (privKey == NULL) {
 	    if (info) PORT_Free(info);
@@ -2187,7 +2186,6 @@
 	    crv = CKR_KEY_TYPE_INCONSISTENT;
 	    break;
 	}
-	context->multi = PR_FALSE;
 	pubKey = pk11_GetPubKey(key,CKK_DSA,&crv);
 	if (pubKey == NULL) {
 	    break;


Fixing segmentation fault in debug trace

--- examples/6lbr/6lbr/packet-filter.c
+++ examples/6lbr/6lbr/packet-filter.c
@@ -213,7 +213,11 @@
 {
 	uip_ds6_nbr_t *nbr = NULL;
     PRINTF("eth_output: ");
-    PRINTLLADDR(dest);
+    if ( IS_BROADCAST_ADDR(dest) ) {
+    	PRINTF("Broadcast");
+    } else {
+    	PRINTLLADDR(dest);
+    }
     PRINTF("\n");
 	//Packet filtering
 	//----------------
@@ -334,9 +338,7 @@

 	//Sending packet
 	//--------------
-	PRINTF("eth_output: Sending packet to ethernet");
-    PRINTLLADDR(dest);
-    PRINTF("\n");
+	PRINTF("eth_output: Sending packet to ethernet\n");
 	eth_drv_send();

 	return 1;