More minor 'c_src' changes

More minor 'c_src' changes

--- c_src/yaml_libyaml.c
+++ c_src/yaml_libyaml.c
@@ -9,6 +9,7 @@
 #include <yaml.h>

 #define ATOM(s)         enif_make_atom(env, s)
+#define BOOL(v)         ATOM(v ? "true" : "false")
 #define INT(n)          enif_make_int(env, n)
 #define ULONG(ln)       enif_make_ulong(env, ln)
 #define TUPLE2(x, y)    enif_make_tuple2(env, x, y)
@@ -42,7 +43,7 @@

 static inline ERL_NIF_TERM
-mem_to_binary(ErlNifEnv *env, const unsigned char *cstr, size_t len)
+mem_to_binary(ErlNifEnv *env, const unsigned char *cstr, const size_t len)
 {
     unsigned char *bin;
     ERL_NIF_TERM term;
@@ -61,7 +62,6 @@
 static inline ERL_NIF_TERM
 cstr_to_binary(ErlNifEnv *env, const unsigned char *cstr)
 {
-
     if (!cstr)
         return ATOM("null");
     else
@@ -69,16 +69,8 @@
 }

-
-static inline
-ERL_NIF_TERM bool_to_term(ErlNifEnv *env, int value)
-{
-    return ATOM(value ? "true" : "false");
-}
-
-
 static ERL_NIF_TERM
-version_directive_to_term(ErlNifEnv *env, yaml_version_directive_t *version)
+version_directive_to_term(ErlNifEnv *env, const yaml_version_directive_t *version)
 {
     if (!version)
         return ATOM("null");
@@ -94,7 +86,8 @@
                   cstr_to_binary(env, tag->prefix));
 }

-static ERL_NIF_TERM mark_to_term(ErlNifEnv *env, yaml_mark_t *mark)
+static inline ERL_NIF_TERM
+mark_to_term(ErlNifEnv *env, const yaml_mark_t *mark)
 {
     if (!mark)
         return ATOM("null");
@@ -103,36 +96,32 @@
 }

-static ERL_NIF_TERM event_to_term(ErlNifEnv *env, yaml_event_t *event)
-{
-    yaml_event_type_t type = event->type;
+static ERL_NIF_TERM event_to_term(ErlNifEnv *env, const yaml_event_t *event)
+{
+    const yaml_event_type_t type = event->type;
     ERL_NIF_TERM term;
-    ERL_NIF_TERM tail;
-
-    // for iteration
-    yaml_tag_directive_t *tag_directive;

     switch (type) {
     case YAML_STREAM_START_EVENT:
         term = ENUM(encodings, event->data.stream_start.encoding);
         break;
     case YAML_DOCUMENT_START_EVENT:
-        // form list of directives
-        tail = enif_make_list(env, 0);
+        term = enif_make_list(env, 0);

         // iterate backwards so list ends up in right order
-        tag_directive = event->data.document_start.tag_directives.end;
-        while (event->data.document_start.tag_directives.start != tag_directive) {
-            tail = enif_make_list_cell(env, tag_directive_to_term(env, tag_directive), tail);
-            tag_directive--;
+        for (yaml_tag_directive_t *tag_directive = event->data.document_start.tag_directives.end;
+             event->data.document_start.tag_directives.start != tag_directive;
+             tag_directive--) {
+            term = enif_make_list_cell(
+                env, tag_directive_to_term(env, tag_directive), term);
         }

         term = TUPLE3(version_directive_to_term(env, event->data.document_start.version_directive),
-                      tail,
-                      bool_to_term(env, event->data.document_start.implicit));
+                      term,
+                      BOOL(event->data.document_start.implicit));
         break;
     case YAML_DOCUMENT_END_EVENT:
-        term = bool_to_term(env, event->data.document_end.implicit);
+        term = BOOL(event->data.document_end.implicit);
         break;
     case YAML_ALIAS_EVENT:
         term = cstr_to_binary(env, event->data.alias.anchor);
@@ -143,8 +132,8 @@
             cstr_to_binary(env, event->data.scalar.tag),
             mem_to_binary(env, event->data.scalar.value, event->data.scalar.length),
             /* FIXME(Sergei): why is this commented out?
-               bool_to_term(env, event->data.scalar.plain_implicit),
-               bool_to_term(env, event->data.scalar.quoted_implicit), */
+               BOOL(event->data.scalar.plain_implicit),
+               BOOL(event->data.scalar.quoted_implicit), */
             ENUM(scalar_styles, event->data.scalar.style));
         break;
     case YAML_SEQUENCE_START_EVENT:
@@ -152,7 +141,7 @@
             cstr_to_binary(env, event->data.sequence_start.anchor),
             cstr_to_binary(env, event->data.sequence_start.tag),
             /* FIXME(Sergei): why is this commented out?
-              bool_to_term(env, event->data.sequence_start.implicit), */
+              BOOL(event->data.sequence_start.implicit), */
             ENUM(sequence_styles, event->data.sequence_start.style));
         break;
     case YAML_MAPPING_START_EVENT:
@@ -160,7 +149,7 @@
             cstr_to_binary(env, event->data.mapping_start.anchor),
             cstr_to_binary(env, event->data.mapping_start.tag),
             /* FIXME(Sergei): same for this.
-               bool_to_term(env, event->data.mapping_start.implicit), */
+               BOOL(event->data.mapping_start.implicit), */
             ENUM(mapping_styles, event->data.mapping_start.style));
         break;
     default:
@@ -208,6 +197,7 @@
     goto parser_done;

 parser_error:
+    /* FIXME(Sergei): return tuples instead? */
     memset(msg, 0, sizeof(msg));

     error = parser.error;


No longer require api/cmiss_graphics_window_private.h as we got rid of the global data.

--- source/api/cmiss_graphics_window.c
+++ source/api/cmiss_graphics_window.c
@@ -43,7 +43,6 @@
  * ***** END LICENSE BLOCK ***** */
 #include <stdarg.h>
 #include "api/cmiss_graphics_window.h"
-#include "api/cmiss_graphics_window_private.h"
 #include "general/debug.h"
 #include "general/manager.h"
 #include "general/object.h"


Silence the distance.out

Silence the distance.out

--- calculate_distance.c
+++ calculate_distance.c
@@ -36,10 +36,12 @@
 			char* pch = strtok (buff," :\n");
 			unsigned int n_ctrlp;
 			if ( strncmp("SPLINE", pch,10) == 0 ) {
+                /*
 				// check previous line
 				if ( ctrlp_cnt != n_ctrlp*3 ) {
 					printf("Some control points might be missing\n");
 				}
+                */

 				if ( debug ) printf("SPLINE\n");
 				ctrlp_cnt=0;
@@ -126,9 +128,9 @@
 }

 int main(int argc, char *argv[]) {
-	printf("parsing\n");
+	if ( debug ) printf("parsing\n");
 	parse(argv[1]);
-	printf("parsing done\n");
+	if ( debug ) printf("parsing done\n");

 	long double total_length = 0;
 	long double total_idle = 0;
@@ -174,21 +176,24 @@
 			if (first && i > 1) {
 				first = 0;
 				const long double idle = sqrtl( (net.result[0]-oldEvaluateX[i-1])*(net.result[0]-oldEvaluateX[i-1]) + (net.result[1]-oldEvaluateY[i-1])*(net.result[1]-oldEvaluateY[i-1]) );
-				printf("idle_distance: %Lf\n", idle);
+				if ( debug ) printf("idle_distance: %Lf\n", idle);
 				total_idle += idle;
 			}

 			ts_deboornet_free(&net);
 		}

-		printf("curve %d length = %Lf\n", i, traveled[i]);
+		if ( debug ) printf("curve %d length = %Lf\n", i, traveled[i]);
 		total_length += traveled[i];
 	}

-	printf("boundary : %lf, %lf\n", boundary.x_max - boundary.x_min, boundary.y_max - boundary.y_min);
-	printf("total curve length = %Lf\n", total_length);
-	printf("total idle length = %Lf\n", total_idle);
-	printf("total length = %Lf\n", total_length + total_idle);
+    if ( debug ) printf("boundary: ");
+	printf("%lf %lf ", boundary.x_max - boundary.x_min, boundary.y_max - boundary.y_min);
+    if ( debug ) printf("\nidel interval: ");
+	printf("%Lf ", total_idle);
+    if ( debug ) printf("\nwork interval: ");
+	printf("%Lf\n", total_length);
+	if ( debug ) printf("total interval: %Lf\n", total_length + total_idle);

 	return 0;
 }


set APPID to TPM_STDLL

set APPID to TPM_STDLL

--- usr/lib/pkcs11/tpm_stdll/h_extern.h
+++ usr/lib/pkcs11/tpm_stdll/h_extern.h
@@ -1992,7 +1992,7 @@
 #endif

 #include <stdio.h>
-#define APPID	"hi"
+#define APPID	"TPM_STDLL"
 /* log to stdout */
 #define LogMessage(dest, priority, layer, fmt, ...) \
 	do { \


Remove unused header.

Remove unused header.

--- usr/tests/hellotest/printperiodic.c
+++ usr/tests/hellotest/printperiodic.c
@@ -1,7 +1,6 @@
 #include <stdio.h>
 #include <barrelfish/barrelfish.h>
 #include <bench/bench.h>
-#include <if/monitor_blocking_rpcclient_defs.h>

 #define ITERATIONS 1000000000


added property copy to ignore warning on old version clang

--- CocoaTemplateEngine/CCTemplate.h
+++ CocoaTemplateEngine/CCTemplate.h
@@ -21,8 +21,8 @@

 @interface CCTemplate : NSObject

-@property NSString* head; // {{ by default
-@property NSString* tail; // }} by default
+@property(copy,nonatomic) NSString* head; // {{ by default
+@property(copy,nonatomic) NSString* tail; // }} by default

 - (NSString*)scan:(NSString*)string dict:(NSDictionary*)dict;


COMP: Fixing typo on FasleT.

COMP: Fixing typo on FasleT.

--- Code/Common/itkConceptChecking.h
+++ Code/Common/itkConceptChecking.h
@@ -665,7 +665,7 @@
     typedef Detail::UniqueType_bool<itkGetStaticConstMacro(IsExact)> ExactT;
     void constraints()
       {
-        IntegralT a = FasleT();
+        IntegralT a = FalseT();
         ExactT b = FalseT();
         Detail::IgnoreUnusedVariable(a);
         Detail::IgnoreUnusedVariable(b);
@@ -690,7 +690,7 @@
     typedef Detail::UniqueType_bool<itkGetStaticConstMacro(IsExact)> ExactT;
     void constraints()
       {
-        IntegralT a = FasleT();
+        IntegralT a = FalseT();
         ExactT b = TrueT();
         Detail::IgnoreUnusedVariable(a);
         Detail::IgnoreUnusedVariable(b);


ERR:Removed contructor warnings

ERR:Removed contructor warnings

--- Code/Common/itkVectorContainer.h
+++ Code/Common/itkVectorContainer.h
@@ -93,32 +93,32 @@
    *
    */
   VectorContainer():
-    VectorType() {}
+    Object(), VectorType() {}

   /**
    *
    */
   VectorContainer(size_type n):
-    VectorType(n) {}
+    Object(), VectorType(n) {}

   /**
    *
    */
   VectorContainer(size_type n, const Element& x):
-    VectorType(n, x) {}
+    Object(), VectorType(n, x) {}

   /**
    *
    */
   VectorContainer(const Self& r):
-    VectorType(r) {}
+    Object(), VectorType(r) {}

   /**
    *
    */
   template <typename InputIterator>
   VectorContainer(InputIterator first, InputIterator last):
-    VectorType(first, last) {}
+    Object(), VectorType(first, last) {}

 public:
   /**


fix bug 485: conflict between a typedef and template type parameter

--- Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h
+++ Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h
@@ -37,12 +37,13 @@
     typedef typename Vector::Index Index;

   public:
+    // this typedef is only to export the scalar type and compile-time dimensions to solve_retval
     typedef Matrix<Scalar,Dynamic,Dynamic> MatrixType;

     DiagonalPreconditioner() : m_isInitialized(false) {}

-    template<typename MatrixType>
-    DiagonalPreconditioner(const MatrixType& mat) : m_invdiag(mat.cols())
+    template<typename MatType>
+    DiagonalPreconditioner(const MatType& mat) : m_invdiag(mat.cols())
     {
       compute(mat);
     }
@@ -50,19 +51,19 @@
     Index rows() const { return m_invdiag.size(); }
     Index cols() const { return m_invdiag.size(); }

-    template<typename MatrixType>
-    DiagonalPreconditioner& analyzePattern(const MatrixType& )
+    template<typename MatType>
+    DiagonalPreconditioner& analyzePattern(const MatType& )
     {
       return *this;
     }

-    template<typename MatrixType>
-    DiagonalPreconditioner& factorize(const MatrixType& mat)
+    template<typename MatType>
+    DiagonalPreconditioner& factorize(const MatType& mat)
     {
       m_invdiag.resize(mat.cols());
       for(int j=0; j<mat.outerSize(); ++j)
       {
-        typename MatrixType::InnerIterator it(mat,j);
+        typename MatType::InnerIterator it(mat,j);
         while(it && it.index()!=j) ++it;
         if(it && it.index()==j)
           m_invdiag(j) = Scalar(1)/it.value();
@@ -73,8 +74,8 @@
       return *this;
     }

-    template<typename MatrixType>
-    DiagonalPreconditioner& compute(const MatrixType& mat)
+    template<typename MatType>
+    DiagonalPreconditioner& compute(const MatType& mat)
     {
       return factorize(mat);
     }


Separating external/internal grammar: t+

--- r2/libmarpa/dev/marpa.w
+++ r2/libmarpa/dev/marpa.w
@@ -10356,11 +10356,13 @@
     }
     r_update_earley_sets(r);
     @<Set |end_of_parse_earley_set| and |end_of_parse_earleme|@>@;
-    if (end_of_parse_earleme == 0) {
-	if (! g->t_null_start_rule) goto NO_PARSE;
-	B_is_Nulling(b) = 1;
+    if (end_of_parse_earleme == 0)
+      {
+	if (!XSY_is_Nullable (SYM_by_ID (g->t_start_xsyid)))
+	  goto NO_PARSE;
+	B_is_Nulling (b) = 1;
 	return b;
-    }
+      }
     @<Find |start_eim|, |start_aim| and |start_aex|@>@;
     if (!start_eim) goto NO_PARSE;
     my_obstack_init(&bocage_setup_obs);


Add additional error checking

Add additional error checking

Initialise client and server secret buffers and check their
lengths.

Signed-off-by: Thomas Daubney <5b910c8e7c225fd62319de5b44eecef1f6356fe1@arm.com>

--- programs/pkey/ecdh_curve25519.c
+++ programs/pkey/ecdh_curve25519.c
@@ -61,7 +61,8 @@
     const char pers[] = "ecdh";

     size_t olen;
-    unsigned char secret_cli[32], secret_srv[32];
+    unsigned char secret_cli[32] = { 0 };
+    unsigned char secret_srv[32] = { 0 };
     const unsigned char *p_cli_to_srv = cli_to_srv;

     ((void) argc);
@@ -175,6 +176,8 @@
         goto exit;
     }

+    size_t secret_cli_olen = olen;
+
     ret = mbedtls_ecdh_calc_secret( &ctx_srv, &olen, secret_srv,
                                     sizeof( secret_srv ),
                                     mbedtls_ctr_drbg_random, &ctr_drbg );
@@ -185,6 +188,8 @@
         goto exit;
     }

+    size_t secret_srv_olen = olen;
+
     mbedtls_printf( " ok\n" );

     /*
@@ -193,8 +198,8 @@
     mbedtls_printf( "  . Check if both calculated secrets are equal..." );
     fflush( stdout );

-    ret = memcmp( secret_srv, secret_cli, sizeof( secret_srv ) );
-    if( ret != 0 )
+    ret = memcmp( secret_srv, secret_cli, sizeof( secret_srv_olen ) );
+    if( ret != 0 || ( secret_cli_olen != secret_srv_olen ) )
     {
         mbedtls_printf( " failed\n  ! Shared secrets not equal.\n" );
         goto exit;


Issue #113 Color console support for windows 10

Use SetConsoleMode winapi function to enable ANSI
escape codes if we can.

--- src/mainclient/main.c
+++ src/mainclient/main.c
@@ -23,6 +23,13 @@
 #include <janet.h>
 #include "line.h"

+#ifdef _WIN32
+#include <windows.h>
+#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
+#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
+#endif
+#endif
+
 extern const unsigned char *janet_gen_init;
 extern int32_t janet_gen_init_size;

@@ -30,6 +37,15 @@
     int i, status;
     JanetArray *args;
     JanetTable *env;
+
+    /* Enable color console on windows 10 console. */
+#ifdef _WIN32
+    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
+    DWORD dwMode = 0;
+    GetConsoleMode(hOut, &dwMode);
+    dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
+    SetConsoleMode(hOut, dwMode);
+#endif

     /* Set up VM */
     janet_init();


avidemux: Update for the libgstriff API changes

Still needs to do reordering of channels for raw audio.

--- gst/avi/gstavidemux.c
+++ gst/avi/gstavidemux.c
@@ -2192,11 +2192,12 @@
       break;
     }
     case GST_RIFF_FCC_auds:{
+      /* FIXME: Do something with the channel reorder map */
       padname = g_strdup_printf ("audio_%u", avi->num_a_streams);
       templ = gst_element_class_get_pad_template (klass, "audio_%u");
       caps = gst_riff_create_audio_caps (stream->strf.auds->format,
           stream->strh, stream->strf.auds, stream->extradata,
-          stream->initdata, &codec_name);
+          stream->initdata, &codec_name, NULL);
       if (!caps) {
         caps = gst_caps_new_simple ("audio/x-avi-unknown", "codec_id",
             G_TYPE_INT, stream->strf.auds->format, NULL);


edgetv: Clean up edgetv element and fix memory leak

--- gst/effectv/gstedge.c
+++ gst/effectv/gstedge.c
@@ -1,10 +1,13 @@
 /* GStreamer
  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) <2009> Sebastian Dröge <sebastian.droege@collabora.co.uk>
  *
  * EffecTV:
- * Copyright (C) 2001 FUKUCHI Kentarou
+ * Copyright (C) 2001-2002 FUKUCHI Kentarou
  *
- * EffecTV is free software. * This library is free software;
+ * EdgeTV - detects edge and display it in good old computer way
+ *
+ * EffecTV is free software. This library is free software;
  * you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
  * License as published by the Free Software Foundation; either
@@ -25,11 +28,12 @@
 #include "config.h"
 #endif

+#include <string.h>
+
+#include <gst/gst.h>
+
+#include <gst/video/video.h>
 #include <gst/video/gstvideofilter.h>
-
-#include <string.h>
-
-#include <gst/video/video.h>

 #define GST_TYPE_EDGETV \
   (gst_edgetv_get_type())
@@ -60,13 +64,7 @@
   GstVideoFilterClass parent_class;
 };

-GType gst_edgetv_get_type (void);
-
-static const GstElementDetails gst_edgetv_details =
-GST_ELEMENT_DETAILS ("EdgeTV effect",
-    "Filter/Effect/Video",
-    "Apply edge detect on video",
-    "Wim Taymans <wim.taymans@chello.be>");
+GST_BOILERPLATE (GstEdgeTV, gst_edgetv, GstVideoFilter, GST_TYPE_VIDEO_FILTER);

 static GstStaticPadTemplate gst_edgetv_src_template =
 GST_STATIC_PAD_TEMPLATE ("src",
@@ -82,8 +80,6 @@
     GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx)
     );

-static GstVideoFilterClass *parent_class = NULL;
-
 static gboolean
 gst_edgetv_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
     GstCaps * outcaps)
@@ -96,16 +92,16 @@

   if (gst_structure_get_int (structure, "width", &edgetv->width) &&
       gst_structure_get_int (structure, "height", &edgetv->height)) {
+    guint map_size;
+
     edgetv->map_width = edgetv->width / 4;
     edgetv->map_height = edgetv->height / 4;
     edgetv->video_width_margin = edgetv->width % 4;

+    map_size = edgetv->map_width * edgetv->map_height * sizeof (guint32) * 2;
+
     g_free (edgetv->map);
-    edgetv->map =
-        (guint32 *) g_malloc (edgetv->map_width * edgetv->map_height *
-        sizeof (guint32) * 2);
-    memset (edgetv->map, 0,
-        edgetv->map_width * edgetv->map_height * sizeof (guint32) * 2);
+    edgetv->map = (guint32 *) g_malloc0 (map_size);
     ret = TRUE;
   }

@@ -116,12 +112,10 @@
 gst_edgetv_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
     guint * size)
 {
-  GstEdgeTV *filter;
+  GstEdgeTV *filter = GST_EDGETV (btrans);
   GstStructure *structure;
   gboolean ret = FALSE;
   gint width, height;
-
-  filter = GST_EDGETV (btrans);

   structure = gst_caps_get_structure (caps, 0);

@@ -139,17 +133,13 @@
 static GstFlowReturn
 gst_edgetv_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
 {
-  GstEdgeTV *filter;
+  GstEdgeTV *filter = GST_EDGETV (trans);
   gint x, y, r, g, b;
   guint32 *src, *dest;
   guint32 p, q;
   guint32 v0, v1, v2, v3;
   GstFlowReturn ret = GST_FLOW_OK;

-  filter = GST_EDGETV (trans);
-
-  gst_buffer_copy_metadata (out, in, GST_BUFFER_COPY_TIMESTAMPS);
-
   src = (guint32 *) GST_BUFFER_DATA (in);
   dest = (guint32 *) GST_BUFFER_DATA (out);

@@ -158,7 +148,6 @@

   for (y = 1; y < filter->map_height - 1; y++) {
     for (x = 1; x < filter->map_width - 1; x++) {
-
       p = *src;
       q = *(src - 4);

@@ -234,12 +223,36 @@
   return ret;
 }

+static gboolean
+gst_edgetv_start (GstBaseTransform * trans)
+{
+  GstEdgeTV *edgetv = GST_EDGETV (trans);
+
+  if (edgetv->map)
+    memset (edgetv->map, 0,
+        edgetv->map_width * edgetv->map_height * sizeof (guint32) * 2);
+  return TRUE;
+}
+
+static void
+gst_edgetv_finalize (GObject * object)
+{
+  GstEdgeTV *edgetv = GST_EDGETV (object);
+
+  g_free (edgetv->map);
+  edgetv->map = NULL;
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
 static void
 gst_edgetv_base_init (gpointer g_class)
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);

-  gst_element_class_set_details (element_class, &gst_edgetv_details);
+  gst_element_class_set_details_simple (element_class, "EdgeTV effect",
+      "Filter/Effect/Video",
+      "Apply edge detect on video", "Wim Taymans <wim.taymans@chello.be>");

   gst_element_class_add_pad_template (element_class,
       gst_static_pad_template_get (&gst_edgetv_sink_template));
@@ -248,48 +261,20 @@
 }

 static void
-gst_edgetv_class_init (gpointer klass, gpointer class_data)
-{
-  GstBaseTransformClass *trans_class;
-
-  trans_class = (GstBaseTransformClass *) klass;
-
-  parent_class = g_type_class_peek_parent (klass);
+gst_edgetv_class_init (GstEdgeTVClass * klass)
+{
+  GstBaseTransformClass *trans_class = (GstBaseTransformClass *) klass;
+  GObjectClass *gobject_class = (GObjectClass *) klass;
+
+  gobject_class->finalize = gst_edgetv_finalize;

   trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_edgetv_set_caps);
   trans_class->get_unit_size = GST_DEBUG_FUNCPTR (gst_edgetv_get_unit_size);
   trans_class->transform = GST_DEBUG_FUNCPTR (gst_edgetv_transform);
-}
-
-static void
-gst_edgetv_init (GTypeInstance * instance, gpointer g_class)
-{
-  GstEdgeTV *edgetv = GST_EDGETV (instance);
-
-  edgetv->map = NULL;
-}
-
-GType
-gst_edgetv_get_type (void)
-{
-  static GType edgetv_type = 0;
-
-  if (!edgetv_type) {
-    static const GTypeInfo edgetv_info = {
-      sizeof (GstEdgeTVClass),
-      gst_edgetv_base_init,
-      NULL,
-      (GClassInitFunc) gst_edgetv_class_init,
-      NULL,
-      NULL,
-      sizeof (GstEdgeTV),
-      0,
-      (GInstanceInitFunc) gst_edgetv_init,
-    };
-
-    edgetv_type =
-        g_type_register_static (GST_TYPE_VIDEO_FILTER, "GstEdgeTV",
-        &edgetv_info, 0);
-  }
-  return edgetv_type;
-}
+  trans_class->start = GST_DEBUG_FUNCPTR (gst_edgetv_start);
+}
+
+static void
+gst_edgetv_init (GstEdgeTV * edgetv, GstEdgeTVClass * klass)
+{
+}


flvdemux: Audio tags without any content are valid.

We silently ignore them instead of erroring out.

--- gst/flv/gstflvparse.c
+++ gst/flv/gstflvparse.c
@@ -579,10 +579,16 @@
   /* Combine them */
   pts |= pts_ext << 24;

-  if (GST_BUFFER_SIZE (buffer) < 12) {
-    GST_ERROR_OBJECT (demux, "Too small tag size");
+  /* Error out on tags with too small headers */
+  if (GST_BUFFER_SIZE (buffer) < 11) {
+    GST_ERROR_OBJECT (demux, "Too small tag size (%d)",
+        GST_BUFFER_SIZE (buffer));
     return GST_FLOW_ERROR;
   }
+
+  /* Silently skip buffers with no data */
+  if (GST_BUFFER_SIZE (buffer) == 11)
+    return GST_FLOW_OK;

   /* Skip the stream id and go directly to the flags */
   flags = GST_READ_UINT8 (data + 7);


qtdemux: covert art tag type is GstSample not GstBuffer now

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

--- gst/isomp4/gstqtmux.c
+++ gst/isomp4/gstqtmux.c
@@ -648,23 +648,27 @@
 {
   GValue value = { 0, };
   GstBuffer *buf;
+  GstSample *sample;
   GstCaps *caps;
   GstStructure *structure;
   gint flags = 0;
   GstMapInfo map;

-  g_return_if_fail (gst_tag_get_type (tag) == GST_TYPE_BUFFER);
+  g_return_if_fail (gst_tag_get_type (tag) == GST_TYPE_SAMPLE);

   if (!gst_tag_list_copy_value (&value, list, tag))
     return;

-  buf = gst_value_get_buffer (&value);
+  sample = gst_value_get_sample (&value);
+
+  if (!sample)
+    goto done;
+
+  buf = gst_sample_get_buffer (sample);
   if (!buf)
     goto done;

-  /* FIXME-0.11 caps metadata ? */
-  /* caps = gst_buffer_get_caps (buf); */
-  caps = NULL;
+  caps = gst_sample_get_caps (sample);
   if (!caps) {
     GST_WARNING_OBJECT (qtmux, "preview image without caps");
     goto done;


Add argv array nullability

Add argv array nullability

--- Criollo/Source/CRApplication.h
+++ Criollo/Source/CRApplication.h
@@ -75,7 +75,7 @@
 FOUNDATION_EXPORT NSString* const CRApplicationDidReceiveSignalNotification;

 FOUNDATION_EXPORT id CRApp;
-FOUNDATION_EXPORT int CRApplicationMain(int argc, const char * _Nullable argv[], id<CRApplicationDelegate> delegate);
+FOUNDATION_EXPORT int CRApplicationMain(int argc, const char * _Nullable argv[_Nullable], id<CRApplicationDelegate> delegate);

 @interface CRApplication : NSObject


qtmux: Fix last_dts tracking for raw audio and similar formats

Accumulate the durations directly and don't scale yet another time by
the number of samples.

--- gst/isomp4/gstqtmux.c
+++ gst/isomp4/gstqtmux.c
@@ -3339,7 +3339,7 @@

     /* timescale = samplerate */
     scaled_duration = 1;
-    pad->last_dts += duration * nsamples;
+    pad->last_dts += duration;
   } else {
     nsamples = 1;
     sample_size = gst_buffer_get_size (last_buf);


multipath rtp changes

multipath rtp changes

--- gst/mprtp/sefctrler.c
+++ gst/mprtp/sefctrler.c
@@ -864,7 +864,7 @@
         result = EVENT_LATE;
         goto done;
       }
-      if (this->consecutive_lost > 2 && this->consecutive_discarded > 1) {
+      if (this->consecutive_lost > 2 && this->consecutive_discarded >= 1) {
         result = EVENT_CONGESTION;
         goto done;
       }


qtdemux: sanitize tag names

qtdemux: sanitize tag names

Sanitize the tag names before turning them into a structure name. We can only
add alphanumeric values as the structure name.

--- gst/qtdemux/qtdemux.c
+++ gst/qtdemux/qtdemux.c
@@ -4207,6 +4207,8 @@
   GstBuffer *buf;
   gchar *media_type, *style;
   GstCaps *caps;
+  guint i;
+  guint8 ndata[4];

   data = node->data;
   len = QT_UINT32 (data);
@@ -4223,10 +4225,19 @@
   else
     style = "iso";

+  /* santize the name for the caps. */
+  for (i = 0; i < 4; i++) {
+    guint8 d = data[4 + i];
+    if (g_ascii_isalnum (d))
+      ndata[i] = g_ascii_tolower (d);
+    else
+      ndata[i] = '_';
+  }
+
   media_type = g_strdup_printf ("application/x-gst-qt-%c%c%c%c-tag",
-      (data[4] == 0xa9) ? '_' : g_ascii_tolower (data[4]),
-      g_ascii_tolower (data[5]), g_ascii_tolower (data[6]),
-      g_ascii_tolower (data[7]));
+      ndata[0], ndata[1], ndata[2], ndata[3]);
+  GST_DEBUG_OBJECT (demux, "media type %s", media_type);
+
   caps = gst_caps_new_simple (media_type, "style", G_TYPE_STRING, style, NULL);
   gst_buffer_set_caps (buf, caps);
   gst_caps_unref (caps);


rtspsrc: use aggregate control for PLAY/PAUSE/TEARDOWN

Use the aggregate control instead of the original request url to perform
PAUSE/PLAY and TEARDOWN.

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

--- gst/rtsp/gstrtspsrc.c
+++ gst/rtsp/gstrtspsrc.c
@@ -1258,6 +1258,23 @@
   }
 }

+static const gchar *
+get_aggregate_control (GstRTSPSrc * src)
+{
+  const gchar *base;
+
+  if (src->control)
+    base = src->control;
+  else if (src->content_base)
+    base = src->content_base;
+  else if (src->conninfo.url_str)
+    base = src->conninfo.url_str;
+  else
+    base = "/";
+
+  return base;
+}
+
 static GstRTSPStream *
 gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx)
 {
@@ -1351,14 +1368,7 @@
       if (g_strcmp0 (control_url, "*") == 0)
         control_url = "";

-      if (src->control)
-        base = src->control;
-      else if (src->content_base)
-        base = src->content_base;
-      else if (src->conninfo.url_str)
-        base = src->conninfo.url_str;
-      else
-        base = "/";
+      base = get_aggregate_control (src);

       /* check if the base ends or control starts with / */
       has_slash = g_str_has_prefix (control_url, "/");
@@ -3847,7 +3857,7 @@
   GstRTSPMessage request = { 0 };
   GstRTSPResult res;
   GstRTSPMethod method;
-  gchar *control;
+  const gchar *control;

   if (src->do_rtsp_keep_alive == FALSE) {
     GST_DEBUG_OBJECT (src, "do-rtsp-keep-alive is FALSE, not sending.");
@@ -3863,11 +3873,7 @@
   else
     method = GST_RTSP_OPTIONS;

-  if (src->control)
-    control = src->control;
-  else
-    control = src->conninfo.url_str;
-
+  control = get_aggregate_control (src);
   if (control == NULL)
     goto no_control;

@@ -6298,7 +6304,7 @@
   GstRTSPMessage response = { 0 };
   GstRTSPResult res = GST_RTSP_OK;
   GList *walk;
-  gchar *control;
+  const gchar *control;

   GST_DEBUG_OBJECT (src, "TEARDOWN...");

@@ -6313,17 +6319,14 @@
     goto close;

   /* construct a control url */
-  if (src->control)
-    control = src->control;
-  else
-    control = src->conninfo.url_str;
+  control = get_aggregate_control (src);

   if (!(src->methods & (GST_RTSP_PLAY | GST_RTSP_TEARDOWN)))
     goto not_supported;

   for (walk = src->streams; walk; walk = g_list_next (walk)) {
     GstRTSPStream *stream = (GstRTSPStream *) walk->data;
-    gchar *setup_url;
+    const gchar *setup_url;
     GstRTSPConnInfo *info;

     /* try aggregate control first but do non-aggregate control otherwise */
@@ -6603,7 +6606,7 @@
   GList *walk;
   gchar *hval;
   gint hval_idx;
-  gchar *control;
+  const gchar *control;

   GST_DEBUG_OBJECT (src, "PLAY...");

@@ -6630,14 +6633,11 @@
   gst_rtspsrc_set_state (src, GST_STATE_PLAYING);

   /* construct a control url */
-  if (src->control)
-    control = src->control;
-  else
-    control = src->conninfo.url_str;
+  control = get_aggregate_control (src);

   for (walk = src->streams; walk; walk = g_list_next (walk)) {
     GstRTSPStream *stream = (GstRTSPStream *) walk->data;
-    gchar *setup_url;
+    const gchar *setup_url;
     GstRTSPConnection *conn;

     /* try aggregate control first but do non-aggregate control otherwise */
@@ -6821,7 +6821,7 @@
   GstRTSPMessage request = { 0 };
   GstRTSPMessage response = { 0 };
   GList *walk;
-  gchar *control;
+  const gchar *control;

   GST_DEBUG_OBJECT (src, "PAUSE...");

@@ -6838,17 +6838,14 @@
     goto no_connection;

   /* construct a control url */
-  if (src->control)
-    control = src->control;
-  else
-    control = src->conninfo.url_str;
+  control = get_aggregate_control (src);

   /* loop over the streams. We might exit the loop early when we could do an
    * aggregate control */
   for (walk = src->streams; walk; walk = g_list_next (walk)) {
     GstRTSPStream *stream = (GstRTSPStream *) walk->data;
     GstRTSPConnection *conn;
-    gchar *setup_url;
+    const gchar *setup_url;

     /* try aggregate control first but do non-aggregate control otherwise */
     if (control)


Moved Switching IO to the point of ARMing

--- src/drivers/stm32/drv_pwm_servo.c
+++ src/drivers/stm32/drv_pwm_servo.c
@@ -140,9 +140,6 @@
 {
 	unsigned timer = pwm_channels[channel].timer_index;

-	/* configure the GPIO first */
-	stm32_configgpio(pwm_channels[channel].gpio);
-
 	/* configure the channel */
 	switch (pwm_channels[channel].timer_channel) {
 	case 1:
@@ -333,8 +330,15 @@
 	for (unsigned i = 0; i < PWM_SERVO_MAX_TIMERS; i++) {
 		if (pwm_timers[i].base != 0) {
 			if (armed) {
+
 				/* force an update to preload all registers */
 				rEGR(i) = GTIM_EGR_UG;
+
+				for (unsigned c = 0; c < PWM_SERVO_MAX_CHANNELS; c++) {
+					if (pwm_channels[c].gpio) {
+						stm32_configgpio(pwm_channels[c].gpio);
+					}
+				}

 				/* arm requires the timer be enabled */
 				rCR1(i) |= GTIM_CR1_CEN | GTIM_CR1_ARPE;


Added 'unsigned int' support

Added 'unsigned int' support

--- src/duktape-cpp/Types/Primitive.h
+++ src/duktape-cpp/Types/Primitive.h
@@ -10,6 +10,19 @@

     static void get(duk::Context &d, int &val, int index) {
         val = duk_require_int(d, index);
+    }
+
+    static constexpr bool isPrimitive() { return true; };
+};
+
+template <>
+struct Type<unsigned int> {
+    static void push(duk::Context &d, unsigned int val) {
+        duk_push_uint(d, val);
+    }
+
+    static void get(duk::Context &d, unsigned int &val, int index) {
+        val = duk_require_uint(d, index);
     }

     static constexpr bool isPrimitive() { return true; };


fixed stack management for a specific case where FindRegToSaveSP() can't provide available registers to save SP

--- src/arch.c
+++ src/arch.c
@@ -2082,9 +2082,24 @@
  * (recopying to new stack) in 1st block
  * NOTE: as rsav has to be live upto the last use of old SP reg, so any reg used
  * in this interval must be conflited with rsav and must not be used
+ * FIXME: how to findout the last recopying of param??? 1st block may contain
+ * some additonal statement which uses the param???
+ * we are checking upto the 'done param' flag... should be a better way to do
+ * so.
  */
    for (ip=blk->ainst1; ip; ip=ip->next)
    {
+/*
+ *    NOTE: right now, we only check upto CF_PARASAVE flag. If, by any chance,
+ *    CMPFLAG gets dislocated, it will fail.
+ *    CMPFLAG CF_PARASAVE 2 (1 means start, 2 means end)
+ */
+      if (ip->inst[0]==CMPFLAG &&
+          ip->inst[1]==CF_PARASAVE && ip->inst[2]==2)
+      {
+         //PrintThisInst(stderr, ip);
+         break;
+      }
       for (j=1; j <=3; j++)
       {
          k = ip->inst[j];
@@ -2094,6 +2109,7 @@
             if (k >= IREGBEG && k < IREGEND) /* int reg */
             {
                /*fprintf(stderr, "reg[%d] = %s\n", j, archiregs[k-IREGBEG]);*/
+               //fprintf(stderr, "reg[%d] = %s\n", j, archiregs[k-IREGBEG]);
                SetVecBit(liveregs, k-1, 1);
             }
          }
@@ -2104,6 +2120,7 @@
                if (k == li->id) /* so, now this an inst which loads param */
                {
                   /*PrintThisInst(stderr, ip);*/
+                 // PrintThisInst(stderr, ip);
                   iv = BitVecComb(iv, iv , liveregs, '|');
                   SetVecAll(liveregs, 0);
                }
@@ -2145,6 +2162,46 @@
  */
    return (rsav);
 }
+void FixParamLoad(BBLOCK *headblk, int rsav, int spderef)
+/*
+ * This function load old SP using spderef and replaces invalid rsav register
+ * with the register which is used to load the paramater itself.
+ * only examines the parameter save area.
+ * NOTE: it's not the best way to solve the issue, but it will obviously work
+ * for all cases. Moreover, this case doesn't occur frequently.
+ */
+{
+   int i;
+   short ireg;
+   INSTQ *ip;
+/*
+ * find out the starting of the parameter save zone
+ */
+   for (ip=headblk->ainst1; ip; ip=ip->next)
+      if (ip->inst[0]==CMPFLAG &&
+          ip->inst[1]==CF_PARASAVE && ip->inst[2]==1)
+         break;
+   assert(ip);
+   for ( ; ip; ip=ip->next)
+   {
+/*
+ *    check until the end of the parameter save zone reached
+ */
+      if (ip->inst[0]==CMPFLAG &&
+          ip->inst[1]==CF_PARASAVE && ip->inst[2]==2)
+         break;
+      if (IS_LOAD(ip->inst[0]))
+      {
+         if (SToff[ip->inst[2]-1].sa[0] == rsav)
+         {
+            ireg = ip->inst[1];
+            SToff[ip->inst[2]-1].sa[0] = ireg;
+            InsNewInst(headblk, NULL, ip, LD, ireg, spderef, 0 );
+         }
+      }
+   }
+}
+

 /*
  *  NOTE: If a const is initialized but not used in body, gen invalid code
@@ -2297,7 +2354,12 @@
  * purpose register here. But convensionally, rbp is saved right after the
  * 'return address' that means at 0%(rsp) position and the value of rsp is
  * saved in rbp when it is used as base pointer. and it is both for x86-32 and
- * x86-64.
+ * x86-64.
+ * But I got an idea that it is optional and as we always omit frame pointer to
+ * have one extra register, I skipped that here. A wonderful discussion can be
+ * found here:
+ * http://eli.thegreenplace.net/2011/09/06/stack-frame-layout-on-x86-64/
+ *
  */
    #if defined(X86_64) && 0
       k = iName2Reg("@rbp"); /* FIXED: @rbp from %rbp*/
@@ -2455,10 +2517,6 @@
                rsav++;
             assert(rsav < IREGEND);
          }
-      #if 1
-         fprintf(stderr, "rsav = %d: %s\n", rsav, archiregs[rsav-IREGBEG]);
-         exit(0);
-      #endif
    #else
          rsav = GetReg(T_INT);
          rsav = GetReg(T_INT);
@@ -2467,8 +2525,9 @@
          assert(rsav <= NSIR);
       #endif
    #endif
-#else
-   #if 0
+#endif
+
+#if 0
 /*
  * Majedul: we can safely choice a reg which is not iparareg nor calleesave
  * rsav is always 0 in new state implementation so far.
@@ -2488,19 +2547,29 @@
          rsav = GetReg(T_INT);
          while (iparareg[rsav-IREGBEG] || icalleesave[rsav-IREGBEG])
             rsav = GetReg(T_INT);
-   #endif
+#endif

-   rsav = FindRegToSaveSP(oldhead->myblk);
-   assert(rsav); /* must be available */
-   #if 0
-         fprintf(stderr, "rsav = %d: %s\n", rsav, archiregs[rsav-IREGBEG]);
-   #endif
- #endif
-         rsav = -rsav;
-         InsNewInst(NULL, NULL, oldhead, MOV, rsav, -REG_SP, 0);
-      }
-      else
-/*   #endif */
+      rsav = FindRegToSaveSP(oldhead->myblk);
+/*
+ * FIXED: there still may not be any available register, because of the
+ * conflict. But there will always be availabke registers if we only consider
+ * to save the SP and reload the old SP when we need to copy the parameters!!!
+ * If we don't have available register which is not in conflict, just use
+ * a register which is neither callee-saved and used as parameter, like: rax
+ */
+      /*assert(rsav);*/  /* must be available */
+      if (!rsav)
+      {
+         fko_warn(__LINE__, "No registers to preserve old SP, loaded in place");
+         LOAD1 = -(IREGEND+1); /* mark with an invalid one */
+         rsav = GetReg(T_INT);
+         while (iparareg[rsav-IREGBEG] || icalleesave[rsav-IREGBEG])
+            rsav = GetReg(T_INT);
+      }
+      rsav = -rsav;
+      InsNewInst(NULL, NULL, oldhead, MOV, rsav, -REG_SP, 0);
+   }
+   else
    {
       PrintMajorComment(bbase, NULL, oldhead, "Adjust sp");
    }
@@ -2519,21 +2588,17 @@
       InsNewInst(NULL, NULL, oldhead, SHL, -REG_SP, -REG_SP, i);
       spderef = AddDerefEntry(-REG_SP, 0, 0, SAVESP, 0);
       InsNewInst(NULL, NULL, oldhead, ST, spderef, rsav, 0);
-#if 0
-/*
- *    NOTE: we don't consider this case anymore. this is when we have available
- *    callee-saved registers
+/*
+ *    NOTE: mark as an invalid one... correct letter!!
  */
       if (LOAD1)
          rsav = -LOAD1;
-#endif
    }
    PrintMajorComment(bbase, NULL, oldhead, "Save registers");
    CorrectLocalOffsets(Loff);
 /*
- * Majedul: does it make anysense if the new sp is forced aligned using shift
- * operation? the distance of new sp from old one may not be tsize then.
- * I guess, it is not used later as parameters are copied into the local area.
+ * NOTE: when the SP is forced aligned, rsav must be something else 0.
+ * Aoff represents the distance of parameter from the old SP (frame pointer).
  */
    CorrectParamDerefs(ParaDerefQ, rsav ? rsav : -REG_SP,
                       rsav ? Aoff : tsize+Aoff);
@@ -2553,10 +2618,11 @@
 /*
  * If we need old stack pointer in register that must be saved, load it here
  */
-#if 0  /* skipped this */
    if (LOAD1)
-      InsNewInst(NULL, NULL, oldhead, LD, rsav, spderef, 0);
-#endif
+   {
+      //InsNewInst(NULL, NULL, oldhead, LD, rsav, spderef, 0);
+      FixParamLoad(oldhead->myblk, rsav, spderef);
+   }
    GetReg(-1);
    FinalizeEpilogue(bbase, tsize, Soff, SAVESP, nir, ir, nfr, fr, ndr, dr);
    CFU2D = CFDOMU2D = CFUSETU2D = INUSETU2D = INDEADU2D = 0;


Add newline at the end of CKParagraphStyle.h

--- CKRefreshControl/CKParagraphStyle.h
+++ CKRefreshControl/CKParagraphStyle.h
@@ -32,4 +32,4 @@
 @interface NSAttributedString (CKParagraphStyleAdditions)
 // This will be added to the class at runtime if not already available
 @property (nonatomic,retain) NSParagraphStyle *paragraphStyle;
-@end+@end


Update FreeBSD section

Update FreeBSD section

Change-Id: Ic8b8c5c3deef5a33596245fab95729a0f1509f8c

--- src/arch.h
+++ src/arch.h
@@ -460,11 +460,7 @@
     #define _FSEC "ld"
     #define _FUSEC "ld"

-    /* Solaris don't have flag to open to set direct io, but
-       rather use directio() afterwards to enable it. lets look
-       into that later on.
-    */
-    #define _ARCH_O_DIRECT (0)
+    #define _ARCH_O_DIRECT (O_DIRECT)

     #define malloc_align(addr, align, size) \
         {int __ret__=0; __ret__=posix_memalign(&(addr), (align), (size));}
@@ -472,10 +468,6 @@

     #ifndef spin_t
         // spinlock
-        // There isn't much point of keeping a separate
-        // spinlock datatype, because the mutexes on
-        // solaris is adaptive anyway and will spin
-        // initially.
         #include <pthread.h>
         #define spin_t pthread_mutex_t
         #define spin_init(arg) pthread_mutex_init(arg, NULL)


less noise

less noise

--- gstreamer/alsasink2.c
+++ gstreamer/alsasink2.c
@@ -1736,7 +1736,6 @@
 {
   int err;

-  printf("registering alsasink2\n");
   if (!gst_element_register (plugin, "_k_alsasink", GST_RANK_PRIMARY,
           GST_TYPE_ALSA_SINK2))
     return FALSE;


* modules/video_filter/deinterlace.c: avoid segfault when deinterlacing filter can't be loaded.

--- modules/video_filter/deinterlace.c
+++ modules/video_filter/deinterlace.c
@@ -165,6 +165,7 @@
     p_vout->p_sys->i_mode = DEINTERLACE_DISCARD;
     p_vout->p_sys->b_double_rate = 0;
     p_vout->p_sys->last_date = 0;
+    p_vout->p_sys->p_vout = 0;
     vlc_mutex_init( p_vout, &p_vout->p_sys->filter_lock );

 #if defined(CAN_COMPILE_C_ALTIVEC)
@@ -383,10 +384,12 @@
 {
     vout_thread_t *p_vout = (vout_thread_t *)p_this;

-    DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
-
-    vlc_object_detach( p_vout->p_sys->p_vout );
-    vout_Destroy( p_vout->p_sys->p_vout );
+    if( p_vout->p_sys->p_vout )
+    {
+        DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+        vlc_object_detach( p_vout->p_sys->p_vout );
+        vout_Destroy( p_vout->p_sys->p_vout );
+    }

     DEL_PARENT_CALLBACKS( SendEventsToChild );


Fixed driver exception for invoking NvdimmLabelProtocol functions after reloading drivers by properly uninstalling NvdimmLabelProtocol.

Signed-off-by: Sandesh Shetty <6612d430546389feee570e73d4f67ee6d3044b14@intel.com>

--- DcpmPkg/driver/NvmDimmDriver.c
+++ DcpmPkg/driver/NvmDimmDriver.c
@@ -1708,6 +1708,16 @@
         if (EFI_ERROR(ReturnCode)) {
           NVDIMM_WARN("Failed to uninstall the child device security command protocol, error = " FORMAT_EFI_STATUS ".\n", ReturnCode);
         }
+
+        ReturnCode = gBS->UninstallMultipleProtocolInterfaces(
+          gDimmsUefiData[Index].DeviceHandle,
+          &gEfiNvdimmLabelProtocolGuid, &gDimmsUefiData[Index].NvdimmLabelProtocolInstance,
+          NULL
+        );
+
+        if (EFI_ERROR(ReturnCode)) {
+          NVDIMM_WARN("Failed to uninstall the child device NVDIMM label protocol, error = " FORMAT_EFI_STATUS ".\n", ReturnCode);
+        }
       }
       gDimmsUefiData[Index].DeviceHandle = NULL;


wayland/shm: use vlc_memfd()

wayland/shm: use vlc_memfd()

--- modules/video_output/wayland/shm.c
+++ modules/video_output/wayland/shm.c
@@ -30,7 +30,6 @@
 #include <string.h>

 #include <sys/types.h>
-#include <fcntl.h>
 #include <sys/mman.h>
 #include <unistd.h>

@@ -41,6 +40,7 @@
 #include <vlc_plugin.h>
 #include <vlc_vout_display.h>
 #include <vlc_picture_pool.h>
+#include <vlc_fs.h>

 #define MAX_PICTURES 4

@@ -107,14 +107,12 @@
     if (req > MAX_PICTURES)
         req = MAX_PICTURES;

-    char bufpath[] = "/tmp/"PACKAGE_NAME"XXXXXX";
-    int fd = mkostemp(bufpath, O_CLOEXEC);
+    int fd = vlc_memfd();
     if (fd == -1)
     {
         msg_Err(vd, "cannot create buffers: %s", vlc_strerror_c(errno));
         return NULL;
     }
-    unlink(bufpath);

     /* We need one extra line to cover for horizontal crop offset */
     unsigned stride = 4 * ((vd->fmt.i_width + 31) & ~31);


stylecontext: Simplify function

stylecontext: Simplify function

Also, make it easier to port to what I want to do next. ;)

--- gtk/gtkstylecontext.c
+++ gtk/gtkstylecontext.c
@@ -1477,19 +1477,12 @@
                        GtkStateFlags    state,
                        ...)
 {
-  GtkStyleContextPrivate *priv;
-  StyleData *data;
   va_list args;

   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));

-  priv = context->priv;
-  g_return_if_fail (priv->widget_path != NULL);
-
-  data = style_data_lookup (context, state);
-
   va_start (args, state);
-  gtk_style_properties_get_valist (data->store, 0, args);
+  gtk_style_context_get_valist (context, state, args);
   va_end (args);
 }


Implement strategy for 64-write limit with unowned TPM.

Review URL: http://codereview.chromium.org/2655005

--- vboot_firmware/lib/rollback_index.c
+++ vboot_firmware/lib/rollback_index.c
@@ -32,7 +32,7 @@
     /* Spaces are already initialized, so this is an error */
     return 0;
   }
-
+
   TlclSetNvLocked();

   TlclDefineSpace(FIRMWARE_VERSIONS_NV_INDEX, firmware_perm, sizeof(uint32_t));
@@ -70,24 +70,38 @@
  */
 static void EnterRecovery(int unlocked) {
   uint32_t combined_versions;
-  uint32_t one = 1;
+  uint32_t backup_versions;
+  uint32_t backup_is_valid;

   if (!unlocked) {
     /* Saves the kernel versions and indicates that we should trust the saved
      * ones.
-     */
-    TlclRead(KERNEL_VERSIONS_NV_INDEX, (uint8_t*) &combined_versions,
-             sizeof(uint32_t));
-    TlclWrite(KERNEL_VERSIONS_BACKUP_NV_INDEX, (uint8_t*) &combined_versions,
-              sizeof(uint32_t));
-    TlclWrite(KERNEL_BACKUP_IS_VALID_NV_INDEX, (uint8_t*) &one,
-              sizeof(uint32_t));
+     */
+    TlclRead(KERNEL_VERSIONS_NV_INDEX,
+             (uint8_t*) &combined_versions, sizeof(uint32_t));
+    TlclRead(KERNEL_VERSIONS_BACKUP_NV_INDEX,
+             (uint8_t*) &backup_versions, sizeof(uint32_t));
+    /* We could unconditional writes of both KERNEL_VERSIONS_BACKUP and
+     * KERNEL_BACKUP_IS_VALID, but this is more robust.
+     */
+    if (combined_versions != backup_versions) {
+      TlclWrite(KERNEL_VERSIONS_BACKUP_NV_INDEX,
+                (uint8_t*) &combined_versions, sizeof(uint32_t));
+    }
+
+    TlclRead(KERNEL_BACKUP_IS_VALID_NV_INDEX,
+             (uint8_t*) &backup_is_valid, sizeof(uint32_t));
+    if (backup_is_valid != 1) {
+      backup_is_valid = 1;
+      TlclWrite(KERNEL_BACKUP_IS_VALID_NV_INDEX, (uint8_t*) &backup_is_valid,
+                sizeof(uint32_t));
+    }
     /* Protects the firmware and backup kernel versions. */
     LockFirmwareVersions();
   }
   debug("entering recovery mode");
-
-  /* and then what? */
+
+  /* TODO(nelson): code for entering recovery mode. */
 }

 static int GetTPMRollbackIndices(void) {
@@ -129,11 +143,14 @@
       TlclWrite(KERNEL_VERSIONS_NV_INDEX,
                 (uint8_t*) &protected_combined_versions, sizeof(uint32_t));
     }
-    /* We recovered and now we can reset the BACKUP_IS_VALID flag.
+    /* We recovered the backed-up versions and now we can reset the
+     * BACKUP_IS_VALID flag.
      */
     TlclWrite(KERNEL_BACKUP_IS_VALID_NV_INDEX, (uint8_t*) &zero, 0);
-  }
-
+
+    /* TODO(nelson): ForceClear and reboot if unowned. */
+  }
+
   /* We perform the reads, making sure they succeed. A failure means that the
    * rollback index locations are missing or somehow messed up.  We let the
    * caller deal with that.
@@ -150,7 +167,7 @@
   g_firmware_version = firmware_versions && 0xffff;
   g_kernel_key_version = kernel_versions >> 16;
   g_kernel_version = kernel_versions && 0xffff;
-
+
   return 1;
 }

@@ -220,6 +237,8 @@
                                        sizeof(uint32_t)));
       break;
   }
+  /* TODO(nelson): ForceClear and reboot if unowned. */
+
   return 0;
 }


Define htonll a macro as it's only used once.

--- src/auth.c
+++ src/auth.c
@@ -49,29 +49,19 @@

 #ifndef htonll
 #if (BYTE_ORDER == LITTLE_ENDIAN)
-static inline uint64_t
-htonll(uint64_t x)
-{
-
-	return (uint64_t)htonl((uint32_t)(x >> 32)) |
-	    (uint64_t)htonl((uint32_t)(x & 0xffffffff)) << 32;
-}
+#define	htonll(x)	((uint64_t)htonl((uint32_t)((x) >> 32)) | \
+			 (uint64_t)htonl((uint32_t)((x) & 0xffffffff)) << 32)
 #else	/* (BYTE_ORDER == LITTLE_ENDIAN) */
-#define htonll(x) (x)
+#define	htonll(x)	(x)
 #endif
 #endif  /* htonll */

 #ifndef ntohll
 #if (BYTE_ORDER == LITTLE_ENDIAN)
-static inline uint64_t
-ntohll(uint64_t x)
-{
-
-	return (uint64_t)ntohl((uint32_t)(x >> 32)) |
-	    (uint64_t)ntohl((uint32_t)(x & 0xffffffff)) << 32;
-}
+#define	ntohll(x)	((uint64_t)ntohl((uint32_t)((x) >> 32)) | \
+			 (uint64_t)ntohl((uint32_t)((x) & 0xffffffff)) << 32)
 #else	/* (BYTE_ORDER == LITTLE_ENDIAN) */
-#define ntohll(x) (x)
+#define	ntohll(x)	(x)
 #endif
 #endif  /* ntohll */


mdbx: fix #endif's comment (cosmetics).

mdbx: fix #endif's comment (cosmetics).

--- src/bits.h
+++ src/bits.h
@@ -111,7 +111,7 @@
 #   else
 #       pragma warning disable "alignment-reduction-ignored"
 #   endif
-#endif /* -Wno-constant-logical-operand */
+#endif /* -Walignment-reduction-ignored */

 #include "./osal.h"


-Wall

-Wall


fixed potential crash infmp4 HLS

fixed potential crash infmp4 HLS

--- src/media_tools/mpd.c
+++ src/media_tools/mpd.c
@@ -1858,13 +1858,14 @@
 	if (pe->init_segment_url) {
 		if (!rep->segment_list->initialization_segment) {
 			GF_SAFEALLOC(rep->segment_list->initialization_segment, GF_MPD_URL);
-			rep->segment_list->initialization_segment->sourceURL = pe->init_segment_url;
-			pe->init_segment_url=NULL;

 			if (strstr(pe->init_segment_url, "mp4") || strstr(pe->init_segment_url, "MP4")) {
 				if (rep->mime_type) gf_free(rep->mime_type);
 				rep->mime_type = gf_strdup("video/mp4");
 			}
+			rep->segment_list->initialization_segment->sourceURL = pe->init_segment_url;
+			pe->init_segment_url=NULL;
+
 			if (pe->init_byte_range_end) {
 				GF_SAFEALLOC(rep->segment_list->initialization_segment->byte_range, GF_MPD_ByteRange);
 				 rep->segment_list->initialization_segment->byte_range->start_range = pe->init_byte_range_start;


Add block query to userd

Add block query to userd

--- mudlib/mud/home/System/sys/userd.c
+++ mudlib/mud/home/System/sys/userd.c
@@ -61,6 +61,7 @@
 int free_users();
 void block_connections();
 void unblock_connections();
+int query_blocked();
 int query_connection_count();
 int query_reserve();
 void set_reserve(int new_reserve);
@@ -250,6 +251,11 @@
 	}

 	reblocked = nil;
+}
+
+int query_blocked()
+{
+	return blocked;
 }

 void reboot()


_mesa_pack_index_span() was broken for non-GLubyte datatypes

--- src/mesa/main/image.c
+++ src/mesa/main/image.c
@@ -1,4 +1,4 @@
-/* $Id: image.c,v 1.59 2001/04/04 23:22:38 brianp Exp $ */
+/* $Id: image.c,v 1.60 2001/05/15 21:21:08 brianp Exp $ */

 /*
  * Mesa 3-D graphics library
@@ -3180,7 +3180,7 @@
          GLbyte *dst = (GLbyte *) dest;
          GLuint i;
          for (i = 0; i < n; i++) {
-            dst[i] = (GLbyte) indexes[i];
+            dst[i] = (GLbyte) source[i];
          }
       }
       break;
@@ -3189,7 +3189,7 @@
          GLushort *dst = (GLushort *) dest;
          GLuint i;
          for (i = 0; i < n; i++) {
-            dst[i] = (GLushort) indexes[i];
+            dst[i] = (GLushort) source[i];
          }
          if (dstPacking->SwapBytes) {
             _mesa_swap2( (GLushort *) dst, n );
@@ -3201,7 +3201,7 @@
          GLshort *dst = (GLshort *) dest;
          GLuint i;
          for (i = 0; i < n; i++) {
-            dst[i] = (GLshort) indexes[i];
+            dst[i] = (GLshort) source[i];
          }
          if (dstPacking->SwapBytes) {
             _mesa_swap2( (GLushort *) dst, n );
@@ -3213,7 +3213,7 @@
          GLuint *dst = (GLuint *) dest;
          GLuint i;
          for (i = 0; i < n; i++) {
-            dst[i] = (GLuint) indexes[i];
+            dst[i] = (GLuint) source[i];
          }
          if (dstPacking->SwapBytes) {
             _mesa_swap4( (GLuint *) dst, n );
@@ -3225,7 +3225,7 @@
          GLint *dst = (GLint *) dest;
          GLuint i;
          for (i = 0; i < n; i++) {
-            dst[i] = (GLint) indexes[i];
+            dst[i] = (GLint) source[i];
          }
          if (dstPacking->SwapBytes) {
             _mesa_swap4( (GLuint *) dst, n );
@@ -3237,7 +3237,7 @@
          GLfloat *dst = (GLfloat *) dest;
          GLuint i;
          for (i = 0; i < n; i++) {
-            dst[i] = (GLfloat) indexes[i];
+            dst[i] = (GLfloat) source[i];
          }
          if (dstPacking->SwapBytes) {
             _mesa_swap4( (GLuint *) dst, n );


removed bogus assertions

removed bogus assertions

--- src/mesa/main/image.c
+++ src/mesa/main/image.c
@@ -1,4 +1,4 @@
-/* $Id: image.c,v 1.53 2001/01/23 23:39:36 brianp Exp $ */
+/* $Id: image.c,v 1.54 2001/02/13 23:54:12 brianp Exp $ */

 /*
  * Mesa 3-D graphics library
@@ -2505,9 +2505,6 @@
           srcType == GL_UNSIGNED_INT_10_10_10_2 ||
           srcType == GL_UNSIGNED_INT_2_10_10_10_REV);

-   /* this is intended for RGBA mode only */
-   assert(ctx->Visual.rgbMode);
-
    /* Try simple cases first */
    if (transferOps == 0 && srcType == CHAN_TYPE) {
       if (dstFormat == GL_RGBA) {
@@ -2829,9 +2826,6 @@
           srcType == GL_UNSIGNED_INT_10_10_10_2 ||
           srcType == GL_UNSIGNED_INT_2_10_10_10_REV);

-   /* this is intended for RGBA mode only */
-   assert(ctx->Visual.rgbMode);
-
    /* general solution, no special cases, yet */
    {
       GLfloat rgba[MAX_WIDTH][4];


DISPATCH-829 - Per Chuck Rolke's suggestion, grouped bool elements together in message structures.

--- src/message_private.h
+++ src/message_private.h
@@ -95,7 +95,6 @@
     qd_buffer_t         *parse_buffer;
     unsigned char       *parse_cursor;
     qd_message_depth_t   parse_depth;
-    bool                 ma_parsed;                       // have parsed annotations in incoming message
     qd_iterator_t       *ma_field_iter_in;                // 'message field iterator' for msg.FIELD_MESSAGE_ANNOTATION

     qd_iterator_pointer_t ma_user_annotation_blob;        // Original user annotations
@@ -107,14 +106,14 @@
     qd_parsed_field_t   *ma_pf_to_override;
     qd_parsed_field_t   *ma_pf_trace;
     int                  ma_int_phase;
-    //qd_parsed_field_t   *parsed_message_annotations;
+    sys_atomic_t         fanout;                         // The number of receivers for this message. This number does not include in-process subscribers.
+    qd_link_t           *input_link;                     // message received on this link

+    bool                 ma_parsed;                      // have parsed annotations in incoming message
     bool                 discard;                        // Should this message be discarded?
     bool                 receive_complete;               // true if the message has been completely received, false otherwise
-    sys_atomic_t         fanout;                         // The number of receivers for this message. This number does not include in-process subscribers.
     bool                 q2_input_holdoff;               // hold off calling pn_link_recv
     bool                 aborted;                        // receive completed with abort flag set
-    qd_link_t           *input_link;                     // message received on this link
 } qd_message_content_t;

 typedef struct {
@@ -122,14 +121,14 @@
     qd_iterator_pointer_t cursor;          // A pointer to the current location of the outgoing byte stream.
     qd_message_depth_t    message_depth;   // What is the depth of the message that has been received so far
     qd_message_depth_t    sent_depth;      // How much of the message has been sent?  QD_DEPTH_NONE means nothing has been sent so far, QD_DEPTH_HEADER means the header has already been sent, dont send it again and so on.
-    bool                  send_complete;   // Has the message been completely received and completely sent?
-    bool                  tag_sent;        // Tags are sent
     qd_message_content_t *content;         // The actual content of the message. The content is never copied
     qd_buffer_list_t      ma_to_override;  // to field in outgoing message annotations.
     qd_buffer_list_t      ma_trace;        // trace list in outgoing message annotations
     qd_buffer_list_t      ma_ingress;      // ingress field in outgoing message annotations
     int                   ma_phase;        // phase for the override address
     bool                  strip_annotations_in;
+    bool                  send_complete;   // Has the message been completely received and completely sent?
+    bool                  tag_sent;        // Tags are sent
 } qd_message_pvt_t;

 ALLOC_DECLARE(qd_message_t);


native uart: print errors to stderr.

native uart: print errors to stderr.

--- hw/mcu/native/src/native_uart_cfg.c
+++ hw/mcu/native/src/native_uart_cfg.c
@@ -225,7 +225,7 @@

     rc = tcsetattr(fd, TCSANOW, &tty);
     if (rc != 0) {
-        dprintf(1, "tcsetattr failed; %d (%s)\n", errno, strerror(errno));
+        fprintf(stderr, "tcsetattr failed; %d (%s)\n", errno, strerror(errno));
         return -1;
     }


Fixed check_base64_out_buffer_size()

Fixed check_base64_out_buffer_size()

--- algorithm/src/base64.c
+++ algorithm/src/base64.c
@@ -36,8 +36,15 @@
                   missing_base64_chars);

 static int check_base64_out_buffer_size(size_t buffer_size,
-                                        size_t data_length) {
-    return buffer_size >= avs_base64_encoded_size(data_length) ? 0 : -1;
+                                        size_t data_length,
+                                        bool use_padding) {
+    size_t encoded_size;
+    if (use_padding) {
+        encoded_size = avs_base64_encoded_size(data_length);
+    } else {
+        encoded_size = avs_base64_encoded_size_without_padding(data_length);
+    }
+    return buffer_size >= encoded_size ? 0 : -1;
 }

 size_t avs_base64_encoded_size(size_t input_length) {
@@ -72,7 +79,8 @@
     size_t i;
     unsigned long sh = 0;

-    if (check_base64_out_buffer_size(out_length, input_length)) {
+    if (check_base64_out_buffer_size(out_length, input_length,
+                                     !!padding_char)) {
         return -1;
     }


Fix window embedding in eglvivsink

Fix window embedding in eglvivsink

This is relevant for user interfaces where the sink shall be embedded in

Signed-off-by: Carlos Rafael Giani <d7d2e6b3863b2910d2ca34828bc651c85d88df6f@pseudoterminal.org>

--- src/eglvivsink/egl_platform_x11.c
+++ src/eglvivsink/egl_platform_x11.c
@@ -22,7 +22,7 @@
 	EGLDisplay egl_display;
 	EGLContext egl_context;
 	EGLSurface egl_surface;
-	gboolean internal_window;
+	Window parent_window;
 	Atom wm_delete_atom;
 	GstImxEglVivSinkWindowResizedEventCallback window_resized_event_cb;
 	gpointer user_context;
@@ -144,15 +144,6 @@

 	EGL_PLATFORM_LOCK(platform);

-	if (window_handle != 0)
-	{
-		platform->native_window = window_handle;
-		platform->internal_window = FALSE;
-		/* TODO: select EGL config with matching visual */
-
-		gst_imx_egl_viv_sink_egl_platform_set_event_handling_nolock(platform, event_handling);
-	}
-	else
 	{
 		EGLint native_visual_id;
 		XVisualInfo visual_info_template;
@@ -163,6 +154,8 @@
 		Window root_window;
 		Atom net_wm_state_atom, net_wm_state_fullscreen_atom;

+		GST_INFO("Creating new X11 window with EGL context (parent window: %" G_GUINTPTR_FORMAT ")", window_handle);
+
 		if (!eglGetConfigAttrib(platform->egl_display, config, EGL_NATIVE_VISUAL_ID, &native_visual_id))
 		{
 			GST_ERROR("eglGetConfigAttrib failed: %s", gst_imx_egl_viv_sink_egl_platform_get_last_error_string());
@@ -193,10 +186,21 @@
 		attr.override_redirect = False;
 		attr.cursor            = None;

+		if (window_handle != 0)
+		{
+			platform->parent_window = (Window)window_handle;
+			/* Out of the parent window events, only the structure
+			 * notifications are of interest here */
+			XSelectInput(x11_display, platform->parent_window, StructureNotifyMask);
+		}
+
 		// TODO: xlib error handler

+		/* This video output window can be embedded into other windows, for example inside
+		 * media player user interfaces. This is done by making the specified window as
+		 * the parent of the video playback window. */
 		x11_window = XCreateWindow(
-			x11_display, root_window,
+			x11_display, (window_handle != 0) ? platform->parent_window : root_window,
 			0, 0, GST_VIDEO_INFO_WIDTH(video_info), GST_VIDEO_INFO_HEIGHT(video_info),
 			0, visual_info->depth, InputOutput, visual_info->visual,
 			CWBackPixel | CWColormap  | CWBorderPixel | CWBackingStore | CWOverrideRedirect,
@@ -204,7 +208,6 @@
 		);

 		platform->native_window = (EGLNativeWindowType)x11_window;
-		platform->internal_window = TRUE;

 		net_wm_state_atom = XInternAtom(x11_display, "_NET_WM_STATE", True);
 		net_wm_state_fullscreen_atom = XInternAtom(x11_display, "_NET_WM_STATE_FULLSCREEN", True);
@@ -315,8 +318,7 @@
 		XNextEvent(x11_display, &xevent);
 	}

-	if (platform->internal_window)
-		XDestroyWindow(x11_display, x11_window);
+	XDestroyWindow(x11_display, x11_window);

 	platform->native_window = 0;

@@ -331,7 +333,12 @@
 	Window x11_window;
 	Display *x11_display = (Display *)(platform->native_display);

-	static long const basic_event_mask = ExposureMask | StructureNotifyMask | PointerMotionMask | KeyPressMask | KeyReleaseMask;
+	/* Select user input events only if it is requested (= when event_handling is TRUE)
+	 * Select the StructureNotifyMask only if this window is standalone, because otherwise,
+	 * we are interested in structure notifications of the parent (for example, when it gets
+	 * resized), to let the event handlers auto-resize this window to fit in the parent one */
+	long user_input_mask = event_handling ? (PointerMotionMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask) : 0;
+	long window_event_mask = (platform->parent_window != 0) ? 0 : StructureNotifyMask;

 	if (platform->native_window == 0)
 	{
@@ -340,21 +347,7 @@
 	}
 	x11_window = (Window)(platform->native_window);

-	if (event_handling)
-	{
-		if (platform->internal_window)
-		{
-			XSelectInput(x11_display, x11_window, basic_event_mask | ButtonPressMask | ButtonReleaseMask);
-		}
-		else
-		{
-			XSelectInput(x11_display, x11_window, basic_event_mask);
-		}
-	}
-	else
-	{
-		XSelectInput(x11_display, x11_window, 0);
-	}
+	XSelectInput(x11_display, x11_window, ExposureMask | window_event_mask | user_input_mask);
 }

@@ -431,8 +424,41 @@
 			switch (xevent.type)
 			{
 				case Expose:
+				{
+					Window this_window = (Window)(platform->native_window);
+
+					/* In case this window is child of another window that is not the root
+					 * window, resize this window; sometimes, ConfigureNotify is not trigger
+					 * when the windows show up for the first time*/
+					if ((xevent.xexpose.count == 0) && (platform->parent_window != 0))
+					{
+						Window root_window;
+						int x, y;
+						unsigned int width, height, border_width, depth;
+
+						XGetGeometry(
+							x11_display,
+							platform->parent_window,
+							&root_window,
+							&x, &y,
+							&width, &height,
+							&border_width,
+							&depth
+						);
+
+						XResizeWindow(x11_display, this_window, width, height);
+						if (platform->window_resized_event_cb != NULL)
+							platform->window_resized_event_cb(platform, width, height, platform->user_context);
+					}
+
+					/* Make sure no more expose events are there */
+					while (XCheckTypedWindowEvent(x11_display, platform->parent_window, Expose, &xevent) == True);
+					while (XCheckTypedWindowEvent(x11_display, this_window, Expose, &xevent) == True);
+
 					expose_required = TRUE;
+
 					break;
+				}

 				case ClientMessage:
 					if ((xevent.xclient.format == 32) && (xevent.xclient.data.l[0] == (long)(platform->wm_delete_atom)))
@@ -442,11 +468,25 @@
 					break;

 				case ConfigureNotify:
+				{
+					Window this_window = (Window)(platform->native_window);
+
 					GST_DEBUG("received ConfigureNotify event -> calling resize callback");
+
+					/* Make sure no other ConfigureNotify events are there */
+					while (XCheckTypedWindowEvent(x11_display, platform->parent_window, ConfigureNotify, &xevent) == True);
+
+					/* Resize if this is a child window of a non-root parent window;
+					 * this is usually the case when this window is embedded inside another one */
+					if (platform->parent_window != 0)
+						XResizeWindow(x11_display, this_window, xevent.xconfigure.width, xevent.xconfigure.height);
+
 					if (platform->window_resized_event_cb != NULL)
 						platform->window_resized_event_cb(platform, xevent.xconfigure.width, xevent.xconfigure.height, platform->user_context);
+
 					expose_required = TRUE;
 					break;
+				}

 				case ResizeRequest:
 					GST_DEBUG("received ResizeRequest event -> calling resize callback");


corrected the computation cost of mean

corrected the computation cost of mean

--- Eigen/src/Array/VectorwiseOp.h
+++ Eigen/src/Array/VectorwiseOp.h
@@ -122,7 +122,7 @@
 EIGEN_MEMBER_FUNCTOR(squaredNorm, Size * NumTraits<Scalar>::MulCost + (Size-1)*NumTraits<Scalar>::AddCost);
 EIGEN_MEMBER_FUNCTOR(norm, (Size+5) * NumTraits<Scalar>::MulCost + (Size-1)*NumTraits<Scalar>::AddCost);
 EIGEN_MEMBER_FUNCTOR(sum, (Size-1)*NumTraits<Scalar>::AddCost);
-EIGEN_MEMBER_FUNCTOR(mean, (Size-1)*NumTraits<Scalar>::AddCost);
+EIGEN_MEMBER_FUNCTOR(mean, (Size-1)*NumTraits<Scalar>::AddCost + NumTraits<Scalar>::MulCost);
 EIGEN_MEMBER_FUNCTOR(minCoeff, (Size-1)*NumTraits<Scalar>::AddCost);
 EIGEN_MEMBER_FUNCTOR(maxCoeff, (Size-1)*NumTraits<Scalar>::AddCost);
 EIGEN_MEMBER_FUNCTOR(all, (Size-1)*NumTraits<Scalar>::AddCost);


Make abs2 compatible with custom complex types

--- Eigen/src/Core/MathFunctions.h
+++ Eigen/src/Core/MathFunctions.h
@@ -241,6 +241,28 @@
 * Implementation of abs2                                                 *
 ****************************************************************************/

+template<typename Scalar,bool IsComplex>
+struct abs2_impl_default
+{
+  typedef typename NumTraits<Scalar>::Real RealScalar;
+  EIGEN_DEVICE_FUNC
+  static inline RealScalar run(const Scalar& x)
+  {
+    return x*x;
+  }
+};
+
+template<typename Scalar>
+struct abs2_impl_default<Scalar, true> // IsComplex
+{
+  typedef typename NumTraits<Scalar>::Real RealScalar;
+  EIGEN_DEVICE_FUNC
+  static inline RealScalar run(const Scalar& x)
+  {
+    return real(x)*real(x) + imag(x)*imag(x);
+  }
+};
+
 template<typename Scalar>
 struct abs2_impl
 {
@@ -248,17 +270,7 @@
   EIGEN_DEVICE_FUNC
   static inline RealScalar run(const Scalar& x)
   {
-    return x*x;
-  }
-};
-
-template<typename RealScalar>
-struct abs2_impl<std::complex<RealScalar> >
-{
-  EIGEN_DEVICE_FUNC
-  static inline RealScalar run(const std::complex<RealScalar>& x)
-  {
-    return real(x)*real(x) + imag(x)*imag(x);
+    return abs2_impl_default<Scalar,NumTraits<Scalar>::IsComplex>::run(x);
   }
 };


fix compilation of Eigen/Geometry with EIGEN2_SUPPORT: was including non-existent header

--- Eigen/src/Geometry/Transform.h
+++ Eigen/src/Geometry/Transform.h
@@ -608,7 +608,7 @@
 typedef Transform<double,3,Projective> Projective3d;

 #ifdef EIGEN2_SUPPORT
-#include "src/Eigen2Support/Transform.h"
+#include "../Eigen2Support/Transform.h"
 #endif

 /**************************


Added existing shapes missing from regression/shapes/all.h

--- regression/shapes/all.h
+++ regression/shapes/all.h
@@ -70,9 +70,11 @@
 #include "catmark_nonman_quadpole8.h"
 #include "catmark_nonman_quadpole64.h"
 #include "catmark_nonman_quadpole360.h"
+#include "catmark_nonman_bareverts.h"
 #include "catmark_pawn.h"
 #include "catmark_pyramid_creases0.h"
 #include "catmark_pyramid_creases1.h"
+#include "catmark_pyramid_creases2.h"
 #include "catmark_pyramid.h"
 #include "catmark_rook.h"
 #include "catmark_single_crease.h"
@@ -82,11 +84,13 @@
 #include "catmark_square_hedit1.h"
 #include "catmark_square_hedit2.h"
 #include "catmark_square_hedit3.h"
+#include "catmark_square_hedit4.h"
 #include "catmark_tent_creases0.h"
 #include "catmark_tent_creases1.h"
 #include "catmark_tent.h"
 #include "catmark_torus.h"
 #include "catmark_torus_creases0.h"
+#include "catmark_torus_creases1.h"

 #include "bilinear_cube.h"


Use ZVAL_COPY_VALUE()

Use ZVAL_COPY_VALUE()

--- src/bson.c
+++ src/bson.c
@@ -1338,7 +1338,7 @@
 			object_init_ex(&obj, state->odm ? state->odm : state->map.root);
 			zend_call_method_with_1_params(&obj, NULL, NULL, BSON_UNSERIALIZE_FUNC_NAME, NULL, &state->zchild);
 			zval_ptr_dtor(&state->zchild);
-			ZVAL_COPY(&state->zchild, &obj);
+			ZVAL_COPY_VALUE(&state->zchild, &obj);
 #else
 			zval *obj = NULL;


* Use 0 as default quality setting. The previous "3" would make VLC ignore the ab= argument unless being explicitely told to use cbr with the --sout-vorbis-cbr oprion.

--- modules/codec/vorbis.c
+++ modules/codec/vorbis.c
@@ -194,7 +194,7 @@
 	set_callbacks( OpenEncoder, CloseEncoder );
 #endif

-    add_integer( ENC_CFG_PREFIX "quality", 3, NULL, ENC_QUALITY_TEXT,
+    add_integer( ENC_CFG_PREFIX "quality", 0, NULL, ENC_QUALITY_TEXT,
                  ENC_QUALITY_LONGTEXT, VLC_FALSE );
     add_integer( ENC_CFG_PREFIX "max-bitrate", 0, NULL, ENC_MAXBR_TEXT,
                  ENC_MAXBR_LONGTEXT, VLC_FALSE );


fix small mistake that would screw me in future if not fixed...

--- Ephemerides/OrbitalEphemeris.h
+++ Ephemerides/OrbitalEphemeris.h
@@ -85,7 +85,7 @@
             0.0 );
     }

-protected:
+private:

     HIDE_BUILT_IN_COPIES( OrbitalEphemeris );


Don't read uninitialized values

Don't read uninitialized values

--- src/misc/hashtables.c
+++ src/misc/hashtables.c
@@ -78,8 +78,7 @@
 {
     int i_middle;

-
-    if( i_hash <= p_array[0].i_hash )
+    if( i_count == 0 || i_hash <= p_array[0].i_hash )
     {
         return 0;
     }


* A few sanity checks

* A few sanity checks

* Escape < and > to prevent script injections (could be done easily with crappy playlist items)

--- modules/control/http.c
+++ modules/control/http.c
@@ -2,7 +2,7 @@
  * http.c :  http mini-server ;)
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: http.c,v 1.22 2003/10/15 07:34:24 gbazin Exp $
+ * $Id: http.c,v 1.23 2003/10/17 18:59:00 zorglub Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *          Laurent Aimar <fenrir@via.ecp.fr>
@@ -200,6 +200,10 @@

     msg_Dbg( p_intf, "base %s:%d", psz_address, i_port );
     p_intf->p_sys = p_sys = malloc( sizeof( intf_sys_t ) );
+    if( !p_intf->p_sys )
+    {
+        return( VLC_ENOMEM );
+    }
     p_sys->p_playlist = NULL;
     p_sys->p_input    = NULL;

@@ -227,6 +231,10 @@

     p_sys->i_files = 0;
     p_sys->pp_files = malloc( sizeof( httpd_file_callback_args_t *) );
+    if( !p_sys->pp_files )
+    {
+        return( VLC_ENOMEM );
+    }

 #if defined(SYS_DARWIN) || defined(SYS_BEOS) || \
         ( defined(WIN32) && !defined(UNDER_CE ) )
@@ -234,6 +242,10 @@
     {
         char * psz_vlcpath = p_intf->p_libvlc->psz_vlcpath;
         psz_src = malloc( strlen(psz_vlcpath) + strlen("/share/http" ) + 1 );
+        if( !psz_src )
+        {
+            return( VLC_ENOMEM );
+        }
 #if defined(WIN32)
         sprintf( psz_src, "%s/http", psz_vlcpath);
 #else
@@ -380,6 +392,11 @@
     char *url, *p;

     url = p = malloc( strlen( name ) + 1 );
+
+    if( !url || !p )
+    {
+        return NULL;
+    }

 #ifdef WIN32
     while( *name == '\\' || *name == '/' )
@@ -558,11 +575,21 @@
         {
 #define f p_sys->pp_files[p_sys->i_files]
             f = malloc( sizeof( httpd_file_callback_args_t ) );
+            if( !f )
+            {
+                msg_Err( p_intf, "Out of memory" );
+                return( VLC_ENOMEM );
+            }
             f->p_intf  = p_intf;
             f->file = strdup( dir );
             f->name = FileToUrl( &dir[strlen( psz_root )] );
             f->mime = FileToMime( &dir[strlen( psz_root )] );

+            if( !f->name || !f->mime )
+            {
+                msg_Err( p_intf , "Unable to parse directory" );
+                return( VLC_ENOMEM );
+            }
             msg_Dbg( p_intf, "file=%s (url=%s mime=%s)",
                      f->file, f->name, f->mime );

@@ -585,6 +612,11 @@
                 fold->name[strlen(fold->name) - 1] == '/' )
             {
                 f = malloc( sizeof( httpd_file_callback_args_t ) );
+                if( !f )
+                {
+                    msg_Err( p_intf, "Out of memory" );
+                    return( VLC_ENOMEM );
+                }
                 f->p_intf  = p_intf;
                 f->file = strdup( fold->file );
                 f->name = strdup( fold->name );
@@ -631,6 +663,7 @@
 {
     mvar_t *v = malloc( sizeof( mvar_t ) );

+    if( !v ) return NULL;
     v->name = strdup( name );
     v->value = strdup( value ? value : "" );

@@ -1389,7 +1422,15 @@

 #define PRINTS( str, s ) \
     ALLOC( strlen( str ) + strlen( s ) + 1 ); \
-    *pp_dst += sprintf( *pp_dst, str, s );
+    char * psz_cur = *pp_dst; \
+    *pp_dst += sprintf( *pp_dst, str, s ); \
+    while( psz_cur && *psz_cur ) \
+    {  \
+        /* Prevent script injection */ \
+        if( *psz_cur == '<' ) *psz_cur = '*'; \
+        if( *psz_cur == '>' ) *psz_cur = '*'; \
+        psz_cur++ ; \
+    }

     switch( StrToMacroType( m->id ) )
     {
@@ -1844,7 +1885,10 @@
     if( ( f = fopen( p_args->file, "r" ) ) == NULL )
     {
         p = *pp_data = malloc( 10240 );
-
+        if( !p )
+        {
+                return VLC_EGENERIC;
+        }
         p += sprintf( p, "<html>\n" );
         p += sprintf( p, "<head>\n" );
         p += sprintf( p, "<title>Error loading %s</title>\n", p_args->file );


subpicture: use the provided core function

Signed-off-by: Jean-Baptiste Kempf <7b85a41a628204b76aba4326273a3ccc74bd009a@videolan.org>

--- src/misc/subpicture.c
+++ src/misc/subpicture.c
@@ -307,7 +307,7 @@
     p_region_dst->psz_text = p_region_src->psz_text ? strdup(p_region_src->psz_text) : NULL;
     p_region_dst->psz_html = p_region_src->psz_html ? strdup(p_region_src->psz_html) : NULL;
     if (p_region_src->p_style != NULL) {
-        p_region_dst->p_style = malloc(sizeof(*p_region_dst->p_style));
+        p_region_dst->p_style = text_style_New();
         p_region_dst->p_style = text_style_Copy(p_region_dst->p_style,
                                                 p_region_src->p_style);
     }


Avoid warnings about uninitialised fields

--- src/cjit.c
+++ src/cjit.c
@@ -94,13 +94,13 @@
         }
     }

-    struct ops_state ops_state = { 0 }, *o = &ops_state;
+    struct ops_state ops_state = { .ops.post_insn = 0 }, *o = &ops_state;
     o->js = js;
     o->ops.pre_insn = ops->pre_insn;
     o->ops.post_insn = ops->post_insn;
     o->nested_ops_data = ops_data;

-    struct run_ops wrappers = { 0 };
+    struct run_ops wrappers = { .post_insn = 0 };
     wrappers.pre_insn = pre_insn_hook;
     wrappers.post_insn = post_insn_hook;


Removed useless test.

Removed useless test.

--- modules/mux/mpeg/pes.c
+++ modules/mux/mpeg/pes.c
@@ -77,9 +77,8 @@
         /* For PES_PRIVATE_STREAM_1 there is an extra header after the
            pes header */
         /* i_private_id != -1 because TS use 0xbd without private_id */
-        if( i_private_id != -1 )
-            i_extra = 1;
-        if( ( i_private_id & 0xf0 ) == 0x80 ) /* implies i_private_id != -1 */
+        i_extra = 1;
+        if( ( i_private_id & 0xf0 ) == 0x80 )
             i_extra += 3;
     }
     else if( ( i_stream_id >> 8 ) == PES_EXTENDED_STREAM_ID )


spi: add unit test for slave receiving length

--- components/driver/test/test_spi_param.c
+++ components/driver/test/test_spi_param.c
@@ -5,6 +5,10 @@
 #include "soc/spi_periph.h"
 #include "test/test_common_spi.h"
 #include "sdkconfig.h"
+
+#ifndef MIN
+#define MIN(a, b)((a) > (b)? (b): (a))
+#endif

 /********************************************************************************
  *      Test By Internal Connections
@@ -118,9 +122,16 @@
         spitest_gpio_output_sel(buscfg.sclk_io_num, FUNC_GPIO, spi_periph_signal[TEST_SPI_HOST].spiclk_out);
     }

-    //clear master receive buffer
-    memset(context->master_rxbuf, 0x66, sizeof(context->master_rxbuf));
-
+    if (context) {
+        //clear master receive buffer
+        memset(context->master_rxbuf, 0x66, sizeof(context->master_rxbuf));
+    }
+}
+
+static void local_test_end(spi_device_handle_t spi)
+{
+    master_free_device_bus(spi);
+    TEST_ASSERT(spi_slave_free(TEST_SLAVE_HOST) == ESP_OK);
 }

 static void local_test_loop(const void* arg1, void* arg2)
@@ -203,8 +214,7 @@
                 TEST_ASSERT(rcv_len >= len - 1 && rcv_len <= len + 4);
             }
         }
-        master_free_device_bus(spi);
-        TEST_ASSERT(spi_slave_free(TEST_SLAVE_HOST) == ESP_OK);
+        local_test_end(spi);
     }
 }

@@ -495,6 +505,113 @@
     },
 };
 TEST_SPI_LOCAL(MODE, mode_pgroup)
+
+/**********************SPI master slave transaction length test*************/
+/* Test SPI slave can receive different length of data in all 4 modes (permutations of
+ * CPOL/CPHA and when DMA is used or not).
+ * Length from 1 to 16 bytes are tested.
+*/
+
+#define MASTER_DATA_RAND_SEED 123
+#define SLAVE_DATA_RAND_SEED 456
+
+TEST_CASE("Slave receive correct data", "[spi]")
+{
+   // Initialize device handle and spi bus
+    uint32_t master_seed_send = MASTER_DATA_RAND_SEED;
+    uint32_t slave_seed_send = SLAVE_DATA_RAND_SEED;
+    uint32_t master_seed_cmp = slave_seed_send;
+    uint32_t slave_seed_cmp = master_seed_send;
+
+    const int buf_size = 20;
+
+    WORD_ALIGNED_ATTR uint8_t slave_sendbuf[buf_size];
+    WORD_ALIGNED_ATTR uint8_t slave_recvbuf[buf_size];
+    WORD_ALIGNED_ATTR uint8_t master_sendbuf[buf_size];
+    WORD_ALIGNED_ATTR uint8_t master_recvbuf[buf_size];
+
+    uint8_t master_cmpbuf[buf_size];
+    uint8_t slave_cmpbuf[buf_size];
+
+    for (int spi_mode = 0; spi_mode < 4; spi_mode++) {
+        for (int dma_chan = 0; dma_chan < 2; dma_chan++) {
+            spi_device_handle_t spi;
+            spitest_param_set_t test_param = {
+                .dup = FULL_DUPLEX,
+                .mode = spi_mode,
+                .master_iomux = false,
+                .slave_iomux = false,
+                .master_dma_chan = 0,
+                .slave_dma_chan = (dma_chan? TEST_DMA_CHAN_SLAVE: 0),
+            };
+            ESP_LOGI(SLAVE_TAG, "Test slave recv @ mode %d, dma enabled=%d", spi_mode, dma_chan);
+
+            local_test_start(&spi, 1000*1000, &test_param, NULL);
+
+            for (int round = 0; round < 20; round++) {
+                // printf("trans %d\n", round);
+                int master_trans_len = round + 1;
+                const int slave_trans_len = 16;
+
+                memset(master_sendbuf, 0xcc, buf_size);
+                memset(slave_sendbuf, 0x55, buf_size);
+                memset(master_recvbuf, 0xaa, buf_size);
+                memset(slave_recvbuf, 0xbb, buf_size);
+
+                for(int i = 0; i < master_trans_len; i++){
+                    master_sendbuf[i] = rand_r(&master_seed_send);
+                    slave_sendbuf[i] = rand_r(&slave_seed_send);
+                }
+
+                spi_slave_transaction_t slave_trans = {
+                    .length = slave_trans_len * 8,
+                    .tx_buffer = slave_sendbuf,
+                    .rx_buffer = slave_recvbuf
+                };
+                esp_err_t ret= spi_slave_queue_trans(TEST_SLAVE_HOST, &slave_trans, portMAX_DELAY);
+                TEST_ESP_OK(ret);
+
+                spi_transaction_t master_trans = {
+                    .length = 8 * master_trans_len,
+                    .tx_buffer = master_sendbuf,
+                    .rx_buffer = master_recvbuf
+                };
+                ret = spi_device_transmit(spi, &master_trans);
+                TEST_ESP_OK(ret);
+
+                spi_slave_transaction_t *out_trans;
+                ret = spi_slave_get_trans_result(TEST_SLAVE_HOST, &out_trans, portMAX_DELAY);
+                TEST_ESP_OK(ret);
+                TEST_ASSERT_EQUAL_HEX32(&slave_trans, out_trans);
+
+                for(int i = 0; i < master_trans_len; i++){
+                    master_cmpbuf[i] = rand_r(&master_seed_cmp);
+                    slave_cmpbuf[i] = rand_r(&slave_seed_cmp);
+                }
+
+                // esp_log_buffer_hex("master_send", master_sendbuf, buf_size);
+                // esp_log_buffer_hex("slave_recv", slave_recvbuf, buf_size);
+
+                // esp_log_buffer_hex("slave_send", slave_sendbuf, buf_size);
+                // esp_log_buffer_hex("master_recv", master_recvbuf, buf_size);
+
+                int master_expected_len = MIN(master_trans_len, slave_trans_len);
+                TEST_ASSERT_EQUAL_HEX8_ARRAY(master_cmpbuf, master_recvbuf, master_expected_len);
+
+                int slave_expected_len;
+                if (dma_chan) {
+                    slave_expected_len = (master_expected_len & (~3));
+                } else {
+                    slave_expected_len = master_expected_len;
+                }
+                if (slave_expected_len) {
+                    TEST_ASSERT_EQUAL_HEX8_ARRAY(slave_cmpbuf, slave_recvbuf, slave_expected_len);
+                }
+            }
+            local_test_end(spi);
+        }
+    }
+}

 #if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2)
 //These tests are ESP32 only due to lack of runners


Fix segfault if req->main is NULL

Fix segfault if req->main is NULL

Seen in the wild.

Closes #35

Signed-off-by: Simo Sorce <65f99581a93cf30dafc32b5c178edc6b0294a07f@redhat.com>

--- src/mod_auth_gssapi.c
+++ src/mod_auth_gssapi.c
@@ -323,7 +323,7 @@
     }

     /* implicit auth for subrequests if main auth already happened */
-    if (!ap_is_initial_req(req)) {
+    if (!ap_is_initial_req(req) && req->main != NULL) {
         type = ap_auth_type(req->main);
         if ((type != NULL) && (strcasecmp(type, "GSSAPI") == 0)) {
             /* warn if the subrequest location and the main request


Fail server startup on bad mechanisms

Fail server startup on bad mechanisms

This helps to detect mis-configurations early.
Configuration errors are considered fatal in apache anyway.

Reviewed-by: Simo Sorce <65f99581a93cf30dafc32b5c178edc6b0294a07f@redhat.com>

--- src/mod_auth_gssapi.c
+++ src/mod_auth_gssapi.c
@@ -1152,7 +1152,7 @@
     return APR_SUCCESS;
 }

-static void mag_list_of_mechs(cmd_parms *parms, gss_OID_set *oidset,
+static bool mag_list_of_mechs(cmd_parms *parms, gss_OID_set *oidset,
                               bool add_spnego, const char *w)
 {
     gss_buffer_desc buf = { 0 };
@@ -1167,7 +1167,7 @@
             ap_log_error(APLOG_MARK, APLOG_ERR, 0, parms->server,
                          "gss_create_empty_oid_set() failed.");
             *oidset = GSS_C_NO_OID_SET;
-            return;
+            return false;
         }
         if (add_spnego) {
             oid = discard_const(&gss_mech_spnego);
@@ -1177,7 +1177,7 @@
                              "gss_add_oid_set_member() failed.");
                 (void)gss_release_oid_set(&min, &set);
                 *oidset = GSS_C_NO_OID_SET;
-                return;
+                return false;
             }
         }
         /* register in the pool so it can be released once the server
@@ -1203,7 +1203,7 @@
         if (maj != GSS_S_COMPLETE) {
             ap_log_error(APLOG_MARK, APLOG_ERR, 0, parms->server,
                          "Unrecognized GSSAPI Mechanism: [%s]", w);
-            return;
+            return false;
         }
         release_oid = true;
     }
@@ -1215,6 +1215,8 @@
     if (release_oid) {
         (void)gss_release_oid(&min, &oid);
     }
+
+    return true;
 }

 static const char *mag_allow_mech(cmd_parms *parms, void *mconfig,
@@ -1222,7 +1224,8 @@
 {
     struct mag_config *cfg = (struct mag_config *)mconfig;

-    mag_list_of_mechs(parms, &cfg->allowed_mechs, true, w);
+    if (!mag_list_of_mechs(parms, &cfg->allowed_mechs, true, w))
+        return "Failed to apply GssapiAllowedMech directive";

     return NULL;
 }
@@ -1233,7 +1236,8 @@
 {
     struct mag_config *cfg = (struct mag_config *)mconfig;

-    mag_list_of_mechs(parms, &cfg->basic_mechs, false, w);
+    if (!mag_list_of_mechs(parms, &cfg->basic_mechs, false, w))
+        return "Failed to apply GssapiBasicAuthMech directive";

     return NULL;
 }


android/client: Add health callbacks support for haltest

--- android/client/if-hl.c
+++ android/client/if-hl.c
@@ -36,12 +36,45 @@
 	DELEMENT(BTHL_CHANNEL_TYPE_ANY),
 ENDMAP

+SINTMAP(bthl_app_reg_state_t, -1, "(unknown)")
+	DELEMENT(BTHL_APP_REG_STATE_REG_SUCCESS),
+	DELEMENT(BTHL_APP_REG_STATE_REG_FAILED),
+	DELEMENT(BTHL_APP_REG_STATE_DEREG_SUCCESS),
+	DELEMENT(BTHL_APP_REG_STATE_DEREG_FAILED),
+ENDMAP
+
+SINTMAP(bthl_channel_state_t, -1, "(unknown)")
+	DELEMENT(BTHL_CONN_STATE_CONNECTING),
+	DELEMENT(BTHL_CONN_STATE_CONNECTED),
+	DELEMENT(BTHL_CONN_STATE_DISCONNECTING),
+	DELEMENT(BTHL_CONN_STATE_DISCONNECTED),
+	DELEMENT(BTHL_CONN_STATE_DESTROYED),
+ENDMAP
+
 const bthl_interface_t *if_hl = NULL;
+
+static void app_reg_state_cb(int app_id, bthl_app_reg_state_t state)
+{
+	haltest_info("%s: app_id=%d app_reg_state=%s\n", __func__,
+				app_id, bthl_app_reg_state_t2str(state));
+}
+
+static void channel_state_cb(int app_id, bt_bdaddr_t *bd_addr,
+				int mdep_cfg_index, int channel_id,
+				bthl_channel_state_t state, int fd)
+{
+	char addr[MAX_ADDR_STR_LEN];
+
+	haltest_info("%s: app_id=%d bd_addr=%s mdep_cfg_index=%d\n"
+			"channel_id=%d channel_state=%s fd=%d\n", __func__,
+			app_id, bt_bdaddr_t2str(bd_addr, addr), mdep_cfg_index,
+			channel_id, bthl_channel_state_t2str(state), fd);
+}

 static bthl_callbacks_t hl_cbacks = {
 	.size = sizeof(hl_cbacks),
-	.app_reg_state_cb = NULL,
-	.channel_state_cb = NULL,
+	.app_reg_state_cb = app_reg_state_cb,
+	.channel_state_cb = channel_state_cb,
 };

 /* init */


Simple factorization

Simple factorization

--- src/cone.c
+++ src/cone.c
@@ -24,7 +24,7 @@

 	long double alpha = (cgDotProduct(vector_q, vector_q) - 2) * powl(cgDotProduct(vector_q, ray_direction), 2)
 		+ powl(ray_direction.x, 2) + powl(ray_direction.y, 2) + powl(ray_direction.z, 2)
-		- powl((radius_k / distance_k) * cgDotProduct(ray_direction, vector_q),2 );
+		- powl((radius_k / distance_k) * cgDotProduct(ray_direction, vector_q), 2);

 	long double beta = 2
 		* ( ( (vector_q.x * cgDotProduct(ray_direction, vector_q) - ray_direction.x)
@@ -37,8 +37,8 @@
 		* ( (anchor.z - eye.z) * (1 - powl(vector_q.z, 2)) + vector_q.z
 		* (vector_q.x * (eye.x - anchor.x) + vector_q.y * (eye.y - anchor.y) ) ) )
 	 	- (powl(radius_k / distance_k, 2) * cgDotProduct(ray_direction, vector_q)
-		* ((eye.x * vector_q.x) - (anchor.x * vector_q.x) + (eye.y * vector_q.y) - (anchor.y * vector_q.y)
-	 	+ (eye.z * vector_q.z) - (anchor.z * vector_q.z) ) ) );
+		* ((eye.x * vector_q.x) + (eye.y * vector_q.y) + (eye.z * vector_q.z) - ((anchor.x * vector_q.x) + (anchor.y * vector_q.y)
+	 	+ (anchor.z * vector_q.z)) ) ) );

 	long double delta = powl((anchor.x - eye.x) * (1 - powl(vector_q.x, 2))
  		+ vector_q.x * ((eye.y * vector_q.y) - (anchor.y * vector_q.y) + (eye.z * vector_q.z) - (anchor.z * vector_q.z)), 2)
@@ -46,8 +46,8 @@
 	 	+ vector_q.y * ((eye.x * vector_q.x) - (anchor.x * vector_q.x) + (eye.z * vector_q.z) - (anchor.z * vector_q.z)), 2)
 		+ powl((anchor.z - eye.z) * (1 - powl(vector_q.z, 2))
 	 	+ vector_q.z * ((eye.x * vector_q.x) - (anchor.x * vector_q.x) + (eye.y * vector_q.y) - (anchor.y * vector_q.y)), 2)
-		- powl((radius_k / distance_k) * ((eye.x * vector_q.x) - (anchor.x * vector_q.x) + (eye.y * vector_q.y) - (anchor.y * vector_q.y)
-	 	+ (eye.z * vector_q.z) - (anchor.z * vector_q.z)), 2);
+		- powl((radius_k / distance_k) * ((eye.x * vector_q.x) + (eye.y * vector_q.y) + (eye.z * vector_q.z) - ((anchor.x * vector_q.x) + (anchor.y * vector_q.y)
+	 	+ (anchor.z * vector_q.z)) ), 2);

 	long double discriminant = (beta * beta) - (4 * alpha * delta);
 	long double t = NO_INTERSECTION_T_VALUE;


conf.c: Add missing filenr + memifo checker to main cfg_t

Signed-off-by: Joachim Nilsson <583c295fd7602c168ad814279bbc3894ba65f5d6@gmail.com>

--- src/conf.c
+++ src/conf.c
@@ -71,7 +71,9 @@
 		CFG_INT ("timeout",    WDT_TIMEOUT_DEFAULT, CFGF_NONE),
 		CFG_BOOL("safe-exit",  cfg_false, CFGF_NONE),
 		CFG_STR ("script",     NULL, CFGF_NONE),
+		CFG_SEC ("filenr",     checker_opts, CFGF_NONE),
 		CFG_SEC ("loadavg",    checker_opts, CFGF_NONE),
+		CFG_SEC ("meminfo",    checker_opts, CFGF_NONE),
 		CFG_END()
 	};
 	cfg_t *cfg;


conf: Use LFS calls when reading config files

Although at first glance it doesn't seem useful to support config
files larger than 2GB, LFS also influences inode size. Without this,
32-bit libasound may be unable to read config files on filesystems
with 64-bit inodes, such as Btrfs or NFS.

Fixes: https://github.com/alsa-project/alsa-lib/pull/223
Signed-off-by: Sebastian Krzyszkowiak <e67f16d28ac3a4291e45c1300773450f0d8a11a9@dosowisko.net>
Signed-off-by: Jaroslav Kysela <72edd5e1a572f82f059ccbb83c92b74d6cb051ff@perex.cz>

--- src/conf.c
+++ src/conf.c
@@ -4064,7 +4064,7 @@
 	return err;
 }

-static int config_filename_filter(const struct dirent *dirent)
+static int config_filename_filter(const struct dirent64 *dirent)
 {
 	size_t flen;

@@ -4102,13 +4102,13 @@

 static int config_file_load(snd_config_t *root, const char *fn, int errors)
 {
-	struct stat st;
-	struct dirent **namelist;
+	struct stat64 st;
+	struct dirent64 **namelist;
 	int err, n;

 	if (!errors && access(fn, R_OK) < 0)
 		return 1;
-	if (stat(fn, &st) < 0) {
+	if (stat64(fn, &st) < 0) {
 		SNDERR("cannot stat file/directory %s", fn);
 		return 1;
 	}
@@ -4116,12 +4116,12 @@
 		return config_file_open(root, fn);
 #ifndef DOC_HIDDEN
 #if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__sun) && !defined(ANDROID)
-#define SORTFUNC	versionsort
+#define SORTFUNC	versionsort64
 #else
-#define SORTFUNC	alphasort
+#define SORTFUNC	alphasort64
 #endif
 #endif
-	n = scandir(fn, &namelist, config_filename_filter, SORTFUNC);
+	n = scandir64(fn, &namelist, config_filename_filter, SORTFUNC);
 	if (n > 0) {
 		int j;
 		err = 0;
@@ -4545,9 +4545,9 @@
 		c++;
 	}
 	for (k = 0; k < local->count; ++k) {
-		struct stat st;
+		struct stat64 st;
 		struct finfo *lf = &local->finfo[k];
-		if (stat(lf->name, &st) >= 0) {
+		if (stat64(lf->name, &st) >= 0) {
 			lf->dev = st.st_dev;
 			lf->ino = st.st_ino;
 			lf->mtime = st.st_mtime;


Set nc->err in case of error in flusher() only if not already set.

--- src/conn.c
+++ src/conn.c
@@ -1357,7 +1357,7 @@
         if (nc->sockCtx.fdActive && (natsBuf_Len(nc->bw) > 0))
         {
             s = natsConn_bufferFlush(nc);
-            if (s != NATS_OK)
+            if ((s != NATS_OK) && (nc->err == NATS_OK))
                 nc->err = s;
         }


Changed index to index.tcb.

Changed index to index.tcb.

tcamgr can know that index.tcb is B+tree.

--- src/core.c
+++ src/core.c
@@ -45,7 +45,7 @@
 open_index(oDB* db, const char* path, int omode)
 {
     char index[1024];
-    snprintf(index, array_sizeof(index), "%s/index", path);
+    snprintf(index, array_sizeof(index), "%s/index.tcb", path);
     if (!tcbdbopen(db->index, index, omode)) {
         set_msg(db, "Can't open index", tcbdberrmsg(tcbdbecode(db->index)));
         return 1;


Fixed bug of non initializing some structures, case-insensitive upgrade header

--- src/core.c
+++ src/core.c
@@ -149,9 +149,9 @@
             ws_MESSAGE_DECREF(conn->websocket_queue[j]);
         }
         free(conn->websocket_buf);
-    }
-    if(conn->websocket_partial) {
-        ws_MESSAGE_DECREF(conn->websocket_partial);
+        if(conn->websocket_partial) {
+            ws_MESSAGE_DECREF(conn->websocket_partial);
+        }
     }
     free(conn);
 }
@@ -781,7 +781,7 @@
         req->bodylen = 0;
     }
     if(req->headerindex[WS_H_UPGRADE]) {
-        if(!strcmp(req->headerindex[WS_H_UPGRADE], "WebSocket")) {
+        if(!strcasecmp(req->headerindex[WS_H_UPGRADE], "WebSocket")) {
             req->websocket = TRUE;
             int res = 0;
             if(check_websocket(req) == 0) {
@@ -906,6 +906,7 @@
     conn->websocket_buf = NULL;
     conn->websocket_buf_size = 4096;
     conn->websocket_buf_offset = 0;
+    conn->websocket_partial = NULL;
     memcpy(conn->req_callbacks, serv->req_callbacks,
         sizeof(conn->req_callbacks));
     memcpy(conn->conn_callbacks, serv->conn_callbacks,


Security: allow capable check to permit mmap or low vm space

On a kernel with CONFIG_SECURITY but without an LSM which implements
security_file_mmap it is impossible for an application to mmap addresses
lower than mmap_min_addr.  Based on a suggestion from a developer in the
openwall community this patch adds a check for CAP_SYS_RAWIO.  It is
assumed that any process with this capability can harm the system a lot
more easily than writing some stuff on the zero page and then trying to
get the kernel to trip over itself.  It also means that programs like X
on i686 which use vm86 emulation can work even with mmap_min_addr set.

Signed-off-by: Eric Paris <b0b36e3cd9ea4e5739ff430a3056fabf2fdb0376@redhat.com>
Signed-off-by: James Morris <10d11de3abc355eabe955bb734f0f8e71da56e16@namei.org>

--- security/dummy.c
+++ security/dummy.c
@@ -426,7 +426,7 @@
 			    unsigned long addr,
 			    unsigned long addr_only)
 {
-	if (addr < mmap_min_addr)
+	if ((addr < mmap_min_addr) && !capable(CAP_SYS_RAWIO))
 		return -EACCES;
 	return 0;
 }


mod00_load() done, changed log format

mod00_load() done, changed log format

--- src/core.c
+++ src/core.c
@@ -223,7 +223,8 @@
 /**
  * Loads a module.
  * Should be called with module mutex locked.
- */
+ * The allocated module is returned in hc->args.realloc.ptr
+ **/
 static hza_error_t mod00_load
 (
     hza_context_t * hc,
@@ -376,10 +377,9 @@
     if (smte) LME("failed locking log mutex ($i)", smte);

     va_start(va, fmt);
-    if (c41_io_fmt(w->log_io, "$c[$s:$s:$Ui] ", "NFEWID"[level],
-                   func, src, line) < 0 ||
-        c41_io_vfmt(w->log_io, fmt, va) < 0 ||
-        c41_io_fmt(w->log_io, "\n") < 0)
+    if (c41_io_fmt(w->log_io, "$c: ", "NFEWID"[level]) < 0
+        || c41_io_vfmt(w->log_io, fmt, va) < 0
+        || c41_io_fmt(w->log_io, " [$s:$s:$Ui]\n", func, src, line) < 0)
     {
         va_end(va);
         LME("failed writing log message");
@@ -413,7 +413,6 @@
         hc->smt_error = smte;
         return (hc->hza_error = HZAE_LOG_MUTEX_INIT);
     }
-    I("initing world $#G4p (log level $i)", w, log_level);
     w->init_state |= HZA_INIT_LOG_MUTEX;

     return 0;
@@ -529,6 +528,7 @@
             e = init_logging(hc, log_io, log_level);
             if (e) break;
         }
+        I("initing world $#G4p (log level $i)", w, w->log_level);

         smte = c41_smt_mutex_init(smt, w->world_mutex);
         if (smte)
@@ -568,6 +568,8 @@
             E("failed loading 'core' module: $s = $i", hza_error_name(e), e);
             break;
         }
+
+        mnc->module = hc->args.realloc.ptr;

 #if 0
         {
@@ -672,6 +674,8 @@
 {
     hza_world_t * w = hc->world;
     c41_smt_t * smt = w->smt;
+    hza_module_t * m;
+    c41_np_t * np;
     int mae, smte, dirty;
     hza_error_t e;

@@ -693,6 +697,7 @@
     /* destroy the world */
     I("ending world $#G4p...", w);

+    /* destroy module name tree */
     if (w->module_name_tree.root)
     {
         e = destroy_mod_name_cells(hc, w->module_name_tree.root);
@@ -700,6 +705,19 @@
         {
             F("failed destroying mod name cell tree: $s = $i",
               hza_error_name(e), e);
+            return e;
+        }
+    }
+
+    /* destroy modules */
+    for (np = w->module_list.next; np != &w->module_list;)
+    {
+        m = (void *) np;
+        np = np->next;
+        e = safe_free(hc, m, m->size);
+        if (e)
+        {
+            F("failed freeing module at $Xp: $s = $i", m, hza_error_name(e), e);
             return e;
         }
     }
@@ -855,10 +873,17 @@
 {
     hza_world_t * w = hc->world;
     int mae;
+    D("realloc in: ptr=$p, item_size=$z, new_count=$z, old_count=$z",
+      hc->args.realloc.ptr,
+      hc->args.realloc.item_size,
+      hc->args.realloc.new_count,
+      hc->args.realloc.old_count);
+
     mae = c41_ma_realloc_array(&w->mac.ma, (void * *) &hc->args.realloc.ptr,
                                hc->args.realloc.item_size,
                                hc->args.realloc.new_count,
                                hc->args.realloc.old_count);
+    D("realloc out: mae=$Ui, ptr=$p", mae, hc->args.realloc.ptr);
     if (mae)
     {
         E("failed reallocating table: ma error $Ui", mae);
@@ -918,6 +943,7 @@
     hza_mod00_hdr_t lhdr;
     hza_mod00_proc_t * pt;
     hza_module_t * m;
+    hza_world_t * w = hc->world;
     uint8_t * p;
     hza_error_t e;
     uint32_t n, i, j;
@@ -1005,8 +1031,9 @@
 #undef CHECK

     /* allocate module */
-    z = n - sizeof(hza_mod00_hdr_t) + sizeof(hza_module_t);
-    z += lhdr.proc_count * sizeof(hza_proc_t);
+    z = n - sizeof(hza_mod00_hdr_t) + sizeof(hza_module_t)
+        + lhdr.proc_count * sizeof(hza_proc_t);
+    D("allocating $Xz for module", z);
     e = safe_alloc(hc, z);
     if (e)
     {
@@ -1040,6 +1067,8 @@

     m->data = (void *) (m->insn_table + m->insn_count);
     m->data_size = lhdr.data_size;
+    D("m=$p, end=$p, end-m=$z, z=$z", m, m->data + m->data_size,
+      (size_t) C41_PTR_DIFF(m->data + m->data_size, m), z);

     p = C41_PTR_OFS(data, sizeof(hza_mod00_hdr_t));

@@ -1069,7 +1098,7 @@
     p += lhdr.insn_count * 8;

     /* copy 8-bit data */
-    C41_MEM_COPY(m->data, p, n);
+    C41_MEM_COPY(m->data, p, lhdr.data_size);

 #define CHECK(_cond) \
     if ((_cond)) ; else { E("corrupt data"); goto l_corrupted; }
@@ -1111,7 +1140,7 @@
     /* todo: check proc targets & insns */
     for (i = 0; i < lhdr.proc_count; ++i)
     {
-        uint32_t rlen;
+        uint32_t rlen = 0;
         hza_proc_t * proc = m->proc_table + i;

         proc->insn_table = m->insn_table + pt[i].insn_start;
@@ -1143,7 +1172,7 @@
             rl = insn_check(proc->insn_table + j);
             if (rl < 0)
             {
-                E("invalid insn $Xd: $s ($Xw) $Xw $Xw $Xw\n",
+                E("invalid insn $Xd: $s ($Xw) $Xw $Xw $Xw",
                   j, hza_opcode_name(proc->insn_table[j].opcode),
                   proc->insn_table[j].opcode,
                   proc->insn_table[j].a,
@@ -1153,11 +1182,19 @@
             }
             if (rlen < (uint32_t) rl) rlen = rl;
         }
+        proc->reg_size = rlen;
+        D("proc $.3Xd reg_size:    $.5Xd", i, rlen);
     }
 #undef CHECK

-    F("no code");
-    return hc->hza_error = HZAF_NO_CODE;
+    /* valid module. init remaining fields. */
+    C41_DLIST_APPEND(w->module_list, m, links);
+    m->module_id = w->module_id_seed++;
+    m->task_count = 0;
+    m->size = z;
+
+    return 0;
+
 l_corrupted:
     e = safe_free(hc, m, z);
     if (e)


ctrl: Remove an assert that does not make sense

 1- Left-over from when we used fseek() to get file size.
 2- Always true anyway.

Signed-off-by: Mohammad Alsaleh <6c225a8dcf0f3ea8ab31a8a88dea0c937d544fc7@gmail.com>

--- src/ctrl.c
+++ src/ctrl.c
@@ -38,7 +38,6 @@

   off_t ctrl_fsize = saldl_fsizeo(ctrl_filename, f_ctrl);
   SALDL_ASSERT((uintmax_t)ctrl_fsize <= SIZE_MAX);
-  SALDL_ASSERT(ctrl_fsize <= INT_MAX);

   if (!ctrl_fsize) {
     fatal(FN, "ctrl file is empty.");


added DNS_CACHE stuff

added DNS_CACHE stuff

--- src/curl.c
+++ src/curl.c
@@ -1,4 +1,4 @@
-/* $Id: curl.c,v 1.52 2002/03/08 14:12:39 kjetilja Exp $ */
+/* $Id: curl.c,v 1.53 2002/04/15 10:19:36 kjetilja Exp $ */

 /* cURL Python module by Kjetil Jacobsen <kjetilja @ cs.uit.no> */

@@ -1062,6 +1062,9 @@
     insint(d, "SSLENGINE", CURLOPT_SSLENGINE);
     insint(d, "SSLENGINE_DEFAULT", CURLOPT_SSLENGINE_DEFAULT);

+    insint(d, "DNS_CACHE_TIMEOUT", CURLOPT_DNS_CACHE_TIMEOUT);
+    insint(d, "DNS_USE_GLOBAL_CACHE", CURLOPT_DNS_USE_GLOBAL_CACHE);
+
     /* Symbolic constants for getinfo */
     insint(d, "EFFECTIVE_URL", CURLINFO_EFFECTIVE_URL);
     insint(d, "HTTP_CODE", CURLINFO_HTTP_CODE);


Make HTTP GET header a bit more well-behaving

--- src/curl.c
+++ src/curl.c
@@ -38,7 +38,9 @@
         return NULL;
     }

-    char *str = "GET / HTTP/1.1\n\r\n";
+    char str[512];
+
+    snprintf(str, 512, "GET / HTTP/1.1\r\nHost: %s:%s\r\nConnection: close\r\n\r\n", argv[0], argv[1]);
     int len = strlen(str);

     if (_write(sock, str, len) != len) {