Formatting fixes.

Formatting fixes.

git-svn-id: 5dea4be1dbd453f88943894215a4d7951dc0947d@6117 09075e82-0dd4-0310-85a5-a0d7c8717e4f

--- libmpdclient.c
+++ libmpdclient.c
@@ -1845,7 +1845,7 @@
 	free(query);
 }

-void mpd_sendPlaylistClearCommand(mpd_Connection *connection, char* path)
+void mpd_sendPlaylistClearCommand(mpd_Connection *connection, char *path)
 {
 	char *sPath = mpd_sanitizeArg(path);
 	char *string = malloc(strlen("playlistclear")+strlen(sPath)+5);
@@ -1856,7 +1856,7 @@
 }

 void mpd_sendPlaylistAddCommand(mpd_Connection *connection,
-                                char *playlist, char* path)
+                                char *playlist, char *path)
 {
 	char *sPlaylist = mpd_sanitizeArg(playlist);
 	char *sPath = mpd_sanitizeArg(path);


Fix pkg audit -F after -4/-6 merge

Fix pkg audit -F after -4/-6 merge

--- libpkg/fetch.c
+++ libpkg/fetch.c
@@ -559,10 +559,14 @@

 		fetchOpts = sbuf_new_auto();
 		sbuf_cat(fetchOpts, "i");
-		if ((repo->flags & REPO_FLAGS_USE_IPV4) == REPO_FLAGS_USE_IPV4)
-			sbuf_cat(fetchOpts, "4");
-		else if ((repo->flags & REPO_FLAGS_USE_IPV6) == REPO_FLAGS_USE_IPV6)
-			sbuf_cat(fetchOpts, "6");
+		if (repo != NULL) {
+			if ((repo->flags & REPO_FLAGS_USE_IPV4) ==
+			    REPO_FLAGS_USE_IPV4)
+				sbuf_cat(fetchOpts, "4");
+			else if ((repo->flags & REPO_FLAGS_USE_IPV6) ==
+			    REPO_FLAGS_USE_IPV6)
+				sbuf_cat(fetchOpts, "6");
+		}

 		pkg_debug(1,"Fetch: fetching from: %s://%s%s%s%s with opts \"%s\"",
 		    u->scheme,


Free sql request after printing it not before

--- libpkg/pkgdb.c
+++ libpkg/pkgdb.c
@@ -4484,8 +4484,8 @@
 	pkg_debug(4, "Pkgdb: running '%s'", sbuf_data(sql));
 	ret = sqlite3_prepare_v2(db->sqlite, sbuf_data(sql), -1, &stmt, NULL);
 	if (ret != SQLITE_OK) {
+		ERROR_SQLITE(db->sqlite, sbuf_data(sql));
 		sbuf_free(sql);
-		ERROR_SQLITE(db->sqlite, sbuf_data(sql));
 		return (-1);
 	}


Fix parsing yaml sequence

Fix parsing yaml sequence

--- libpkg/utils.c
+++ libpkg/utils.c
@@ -467,7 +467,7 @@
 	ucl_object_t *sub;

 	item = node->data.sequence.items.start;
-	while (item > node->data.sequence.items.top) {
+	while (item < node->data.sequence.items.top) {
 		val = yaml_document_get_node(doc, *item);
 		sub = ucl_object_new();
 		switch (val->type) {


cmac: reduce visibility of macros

cmac: reduce visibility of macros

The #undef is usefull for people who want to to amalgamated releases

--- library/cmac.c
+++ library/cmac.c
@@ -45,29 +45,6 @@
 #define mbedtls_printf printf
 #endif /* MBEDTLS_PLATFORM_C */
 #endif /* MBEDTLS_SELF_TEST && MBEDTLS_AES_C */
-
-/*
- * Macros for common operations.
- * Results in smaller compiled code than static inline functions.
- */
-
-/*
- * XOR 128-bit
- */
-#define XOR_128( o, i1, i2 )                                                \
-    for( i = 0; i < 16; i++ )                                               \
-        ( o )[i] = ( i1 )[i] ^ ( i2 )[i];
-
-/*
- * Update the CMAC state using an input block x
- */
-#define UPDATE_CMAC( x )                                                    \
-do {                                                                        \
-    XOR_128( state, ( x ), state );                                         \
-    if( ( ret = mbedtls_cipher_update( &ctx->cipher_ctx,                    \
-                                       state, 16, state, &olen ) ) != 0 )   \
-        return( ret );                                                      \
-} while( 0 )

 /* Implementation that should never be optimized out by the compiler */
 static void mbedtls_zeroize( void *v, size_t n ) {
@@ -212,6 +189,25 @@
 }

 /*
+ * XOR 128-bit
+ * Here, macro results in smaller compiled code than static inline function
+ */
+#define XOR_128( o, i1, i2 )                                                \
+    for( i = 0; i < 16; i++ )                                               \
+        ( o )[i] = ( i1 )[i] ^ ( i2 )[i];
+
+/*
+ * Update the CMAC state using an input block x
+ */
+#define UPDATE_CMAC( x )                                                    \
+do {                                                                        \
+    XOR_128( state, ( x ), state );                                         \
+    if( ( ret = mbedtls_cipher_update( &ctx->cipher_ctx,                    \
+                                       state, 16, state, &olen ) ) != 0 )   \
+        return( ret );                                                      \
+} while( 0 )
+
+/*
  * Generate tag on complete message
  */
 static int cmac_generate( mbedtls_cmac_context *ctx,
@@ -260,6 +256,9 @@

     return( 0 );
 }
+
+#undef XOR_128
+#undef UPDATE_CMAC

 int mbedtls_cmac_generate( mbedtls_cmac_context *ctx,
                            const unsigned char *input, size_t in_len,


Change to positive checks

Change to positive checks

1. Checge to check for `MBEDTLS_ECP_RESTARTABLE` for all definitions
of `rs_ctx`.
2. Remove checks for `_ALT` when using `rs_ctx` as they cannot coexist
with the Restartable configuration.

--- library/ecdh.c
+++ library/ecdh.c
@@ -212,7 +212,7 @@
     if( ( ret = ecdh_gen_public_restartable( &ctx->grp, &ctx->d, &ctx->Q,
                                              f_rng, p_rng, rs_ctx ) ) != 0 )
         return( ret );
-#endif /* MBEDTLS_ECDH_GEN_PUBLIC_ALT */
+#endif /* !MBEDTLS_ECDH_GEN_PUBLIC_ALT */

     if( ( ret = mbedtls_ecp_tls_write_group( &ctx->grp, &grp_len, buf, blen ) )
                 != 0 )
@@ -286,14 +286,14 @@
                       void *p_rng )
 {
     int ret;
-#if !defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT)
+#if defined(MBEDTLS_ECP_RESTARTABLE)
     mbedtls_ecp_restart_ctx *rs_ctx = NULL;
 #endif

     if( ctx == NULL || ctx->grp.pbits == 0 )
         return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );

-#if defined(MBEDTLS_ECP_RESTARTABLE) && !defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT)
+#if defined(MBEDTLS_ECP_RESTARTABLE)
     if( ctx->restart_enabled )
         rs_ctx = &ctx->rs;
 #endif
@@ -342,14 +342,14 @@
                       void *p_rng )
 {
     int ret;
-#if !defined(MBEDTLS_ECDH_COMPUTE_SHARED_ALT)
+#if defined(MBEDTLS_ECP_RESTARTABLE)
     mbedtls_ecp_restart_ctx *rs_ctx = NULL;
 #endif

     if( ctx == NULL || ctx->grp.pbits == 0 )
         return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );

-#if defined(MBEDTLS_ECP_RESTARTABLE) && !defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT)
+#if defined(MBEDTLS_ECP_RESTARTABLE)
     if( ctx->restart_enabled )
         rs_ctx = &ctx->rs;
 #endif


Refactor kvz_filter_deblock_lcu.

Refactor kvz_filter_deblock_lcu.

Moves code for filtering the rightmost 4 pixels of an LCU to a separate
function filter_deblock_lcu_rightmost.

--- src/filter.c
+++ src/filter.c
@@ -618,6 +618,45 @@

 /**
+ * \brief Filter rightmost 4 pixels of the horizontal egdes of an LCU.
+ *
+ * \param state     encoder state
+ * \param x_px      x-coordinate of the *right* edge of the LCU in pixels
+ * \param y_px      y-coordinate of the top edge of the LCU in pixels
+ */
+static void filter_deblock_lcu_rightmost(encoder_state_t * const state,
+                                         int32_t x_px,
+                                         int32_t y_px)
+{
+  // Luma
+  const int x = x_px - 4;
+  const int end = MIN(y_px + LCU_WIDTH, state->tile->frame->height);
+  for (int y = y_px; y < end; y += 8) {
+    // The top edge of the whole frame is not filtered.
+    bool tu_boundary = is_tu_boundary(state, x, y, EDGE_HOR);
+    bool pu_boundary = is_pu_boundary(state, x, y, EDGE_HOR);
+    if (y > 0 && (tu_boundary || pu_boundary)) {
+      filter_deblock_edge_luma(state, x, y, 4, EDGE_HOR, tu_boundary);
+    }
+  }
+
+  // Chroma
+  const int x_px_c = x_px >> 1;
+  const int y_px_c = y_px >> 1;
+  const int x_c = x_px_c - 4;
+  const int end_c = MIN(y_px_c + LCU_WIDTH_C, state->tile->frame->height >> 1);
+  for (int y_c = y_px_c; y_c < end_c; y_c += 8) {
+    // The top edge of the whole frame is not filtered.
+    bool tu_boundary = is_tu_boundary(state, x_c << 1, y_c << 1, EDGE_HOR);
+    bool pu_boundary = is_pu_boundary(state, x_c << 1, y_c << 1, EDGE_HOR);
+    if (y_c > 0 && (tu_boundary || pu_boundary)) {
+      filter_deblock_edge_chroma(state, x_c, y_c, 4, EDGE_HOR, tu_boundary);
+    }
+  }
+}
+
+
+/**
  * \brief Deblock a single LCU without using data from right or down.
  *
  * Filter the following vertical edges (horizontal filtering):
@@ -646,31 +685,7 @@
 {
   filter_deblock_lcu_inside(state, x_px, y_px, EDGE_VER);
   if (x_px > 0) {
-    // Luma
-    const int x = x_px - 4;
-    const int end = MIN(y_px + LCU_WIDTH, state->tile->frame->height);
-    for (int y = y_px; y < end; y += 8) {
-      // The top edge of the whole frame is not filtered.
-      bool tu_boundary = is_tu_boundary(state, x, y, EDGE_HOR);
-      bool pu_boundary = is_pu_boundary(state, x, y, EDGE_HOR);
-      if (y > 0 && (tu_boundary || pu_boundary)) {
-        filter_deblock_edge_luma(state, x, y, 4, EDGE_HOR, tu_boundary);
-      }
-    }
-
-    // Chroma
-    const int x_px_c = x_px >> 1;
-    const int y_px_c = y_px >> 1;
-    const int x_c = x_px_c - 4;
-    const int end_c = MIN(y_px_c + LCU_WIDTH_C, state->tile->frame->height >> 1);
-    for (int y_c = y_px_c; y_c < end_c; y_c += 8) {
-      // The top edge of the whole frame is not filtered.
-      bool tu_boundary = is_tu_boundary(state, x_c << 1, y_c << 1, EDGE_HOR);
-      bool pu_boundary = is_pu_boundary(state, x_c << 1, y_c << 1, EDGE_HOR);
-      if (y_c > 0 && (tu_boundary || pu_boundary)) {
-        filter_deblock_edge_chroma(state, x_c, y_c, 4, EDGE_HOR, tu_boundary);
-      }
-    }
+    filter_deblock_lcu_rightmost(state, x_px, y_px);
   }
   filter_deblock_lcu_inside(state, x_px, y_px, EDGE_HOR);
 }


Fixed deblocking and more variable name cleaning

--- src/filter.c
+++ src/filter.c
@@ -6,7 +6,7 @@
 /*! \file filter.c
     \brief filtering
     \author Marko Viitanen
-    \date 2013-04
+    \date 2013-05

     Filtering functions
 */
@@ -34,69 +34,69 @@
 };

-INLINE void filter_luma( uint8_t* piSrc, int32_t iOffset, int32_t tc , int8_t sw, int8_t bPartPNoFilter, int8_t bPartQNoFilter, int32_t iThrCut, int8_t bFilterSecondP, int8_t bFilterSecondQ)
+INLINE void filter_luma( uint8_t* src, int32_t offset, int32_t tc , int8_t sw, int8_t bPartPNoFilter, int8_t bPartQNoFilter, int32_t iThrCut, int8_t bFilterSecondP, int8_t bFilterSecondQ)
 {
   int32_t delta;

-  int16_t m0  = piSrc[-iOffset*4];
-  int16_t m1  = piSrc[-iOffset*3];
-  int16_t m2  = piSrc[-iOffset*2];
-  int16_t m3  = piSrc[-iOffset];
-  int16_t m4  = piSrc[0];
-  int16_t m5  = piSrc[ iOffset];
-  int16_t m6  = piSrc[ iOffset*2];
-  int16_t m7  = piSrc[ iOffset*3];
+  int16_t m0  = src[-offset*4];
+  int16_t m1  = src[-offset*3];
+  int16_t m2  = src[-offset*2];
+  int16_t m3  = src[-offset];
+  int16_t m4  = src[0];
+  int16_t m5  = src[ offset];
+  int16_t m6  = src[ offset*2];
+  int16_t m7  = src[ offset*3];

   if (sw)
   {
-    piSrc[-iOffset*3] = CLIP(m1-2*tc, m1+2*tc, ((2*m0 + 3*m1 + m2 + m3 + m4 + 4 )>>3));
-    piSrc[-iOffset*2] = CLIP(m2-2*tc, m2+2*tc, ((m1 + m2 + m3 + m4 + 2)>>2));
-    piSrc[-iOffset]   = CLIP(m3-2*tc, m3+2*tc, ((m1 + 2*m2 + 2*m3 + 2*m4 + m5 + 4) >> 3));
-    piSrc[0]          = CLIP(m4-2*tc, m4+2*tc, ((m2 + 2*m3 + 2*m4 + 2*m5 + m6 + 4) >> 3));
-    piSrc[ iOffset]   = CLIP(m5-2*tc, m5+2*tc, ((m3 + m4 + m5 + m6 + 2)>>2));
-    piSrc[ iOffset*2] = CLIP(m6-2*tc, m6+2*tc, ((m3 + m4 + m5 + 3*m6 + 2*m7 + 4 )>>3));
+    src[-offset*3] = CLIP(m1-2*tc, m1+2*tc, ((2*m0 + 3*m1 + m2 + m3 + m4 + 4 )>>3));
+    src[-offset*2] = CLIP(m2-2*tc, m2+2*tc, ((m1 + m2 + m3 + m4 + 2)>>2));
+    src[-offset]   = CLIP(m3-2*tc, m3+2*tc, ((m1 + 2*m2 + 2*m3 + 2*m4 + m5 + 4) >> 3));
+    src[0]         = CLIP(m4-2*tc, m4+2*tc, ((m2 + 2*m3 + 2*m4 + 2*m5 + m6 + 4) >> 3));
+    src[ offset]   = CLIP(m5-2*tc, m5+2*tc, ((m3 + m4 + m5 + m6 + 2)>>2));
+    src[ offset*2] = CLIP(m6-2*tc, m6+2*tc, ((m3 + m4 + m5 + 3*m6 + 2*m7 + 4 )>>3));
   }
   else
   {
     // Weak filter
-    delta = (9*(m4-m3) -3*(m5-m2) + 8)>>4 ;
+    delta = (9*(m4-m3) -3*(m5-m2) + 8)>>4;

     if ( abs(delta) < iThrCut )
     {
       int32_t tc2 = tc>>1;
       delta = CLIP(-tc, tc, delta);
-      piSrc[-iOffset] = CLIP(0,(1 << g_bitDepth)-1,(m3+delta));
-      piSrc[0] = CLIP(0,(1 << g_bitDepth)-1,(m4-delta));
+      src[-offset] = CLIP(0,(1 << g_bitDepth)-1,(m3+delta));
+      src[0] = CLIP(0,(1 << g_bitDepth)-1,(m4-delta));

       if(bFilterSecondP)
       {
         int32_t delta1 = CLIP(-tc2, tc2, (( ((m1+m3+1)>>1)- m2+delta)>>1));
-        piSrc[-iOffset*2] = CLIP(0,(1 << g_bitDepth)-1,(m2+delta1));
+        src[-offset*2] = CLIP(0,(1 << g_bitDepth)-1,(m2+delta1));
       }
       if(bFilterSecondQ)
       {
         int32_t delta2 = CLIP(-tc2, tc2, (( ((m6+m4+1)>>1)- m5-delta)>>1));
-        piSrc[ iOffset] = CLIP(0,(1 << g_bitDepth)-1,(m5+delta2));
+        src[ offset] = CLIP(0,(1 << g_bitDepth)-1,(m5+delta2));
       }
     }
   }

   if(bPartPNoFilter)
   {
-    piSrc[-iOffset]   = (uint8_t)m3;
-    piSrc[-iOffset*2] = (uint8_t)m2;
-    piSrc[-iOffset*3] = (uint8_t)m1;
+    src[-offset]   = (uint8_t)m3;
+    src[-offset*2] = (uint8_t)m2;
+    src[-offset*3] = (uint8_t)m1;
   }
   if(bPartQNoFilter)
   {
-    piSrc[0]          = (uint8_t)m4;
-    piSrc[ iOffset]   = (uint8_t)m5;
-    piSrc[ iOffset*2] = (uint8_t)m6;
-  }
-}
-
-INLINE void filter_chroma( uint8_t* src, int32_t offset, int32_t tc ,int8_t part_p_nofilter, int8_t part_q_nofilter)
+    src[0]          = (uint8_t)m4;
+    src[ offset]   = (uint8_t)m5;
+    src[ offset*2] = (uint8_t)m6;
+  }
+}
+
+INLINE void filter_chroma( uint8_t* src, int32_t offset, int32_t tc ,int8_t part_P_nofilter, int8_t part_Q_nofilter)
 {
   int32_t delta;

@@ -106,11 +106,11 @@
   int16_t m5  = src[ offset];

   delta = CLIP(-tc,tc, (((( m4 - m3 ) << 2 ) + m2 - m5 + 4 ) >> 3) );
-  if(!part_p_nofilter)
+  if(!part_P_nofilter)
   {
     src[-offset] = CLIP(0,(1 << g_bitDepth)-1,m3+delta);
   }
-  if(!part_q_nofilter)
+  if(!part_Q_nofilter)
   {
     src[0] = CLIP(0,(1 << g_bitDepth)-1,m4-delta);
   }
@@ -118,16 +118,13 @@

 void filter_deblock_edge_luma(encoder_control* encoder, int32_t xpos, int32_t ypos, int8_t depth, int8_t dir)
 {
-  int32_t iStride = encoder->in.cur_pic.width;
-  int32_t offset = iStride;
+  int32_t stride = encoder->in.cur_pic.width;
+  int32_t offset = stride;
   int32_t betaOffsetDiv2 = encoder->betaOffsetdiv2;
   int32_t tcOffsetDiv2   = encoder->tcOffsetdiv2;
-  const int8_t width     = (LCU_WIDTH>>depth);
-  const int8_t scu_width       = (LCU_WIDTH>>MAX_DEPTH);
-  const int8_t scu_width_log2  = TOBITS(scu_width);
   int8_t uiBs       = 2; /* Filter strength */
   /* ToDo: support 10+bits */
-  uint8_t* origsrc      = &encoder->in.cur_pic.yRecData[xpos+ypos*iStride];
+  uint8_t* origsrc      = &encoder->in.cur_pic.yRecData[xpos+ypos*stride];
   uint8_t* src = origsrc;
   int32_t step = 1;
   //CU_info* cu = &encoder->in.cur_pic.CU[depth][(xpos>>scu_width_log2) + (ypos>>scu_width_log2)*(encoder->in.width>>scu_width_log2)];
@@ -135,32 +132,31 @@
   if(dir == EDGE_VER)
   {
     offset = 1;
-    step = iStride;
-  }
-
-  /* For each subpart */
-
-  {
-    int32_t QP            = encoder->QP;
+    step = stride;
+  }
+
+  {
+    int32_t QP             = encoder->QP;
     int32_t bitdepth_scale = 1 << (g_bitDepth-8);
     int32_t TC_index       = CLIP(0, 51+2, (int32_t)(QP + 2*(uiBs-1) + (tcOffsetDiv2 << 1)));
     int32_t B_index        = CLIP(0, 51, QP + (betaOffsetDiv2 << 1));
-    int32_t Tc            = tctable_8x8[TC_index]*bitdepth_scale;
-    int32_t Beta          = betatable_8x8[B_index]*bitdepth_scale;
-    int32_t iSideThreshold = (Beta+(Beta>>1))>>3;
+    int32_t Tc             = tctable_8x8[TC_index]*bitdepth_scale;
+    int32_t Beta           = betatable_8x8[B_index]*bitdepth_scale;
+    int32_t side_threshold = (Beta+(Beta>>1))>>3;
     int32_t iThrCut        = Tc*10;
-    uint32_t blocks_in_part = (LCU_WIDTH>>depth) / 4;
+    uint32_t blocks_in_part= (LCU_WIDTH>>depth) / 4;
     uint32_t block_idx;

     /* ToDo: add CU based QP calculation */

+    /* For each 4-pixel part in the edge */
     for (block_idx = 0; block_idx < blocks_in_part; block_idx++)
     {
       int32_t dp0,dq0,dp3,dq3,d0,d3,dp,dq,d;

       /* Check conditions for filtering */
-      #define calc_DP(s,o) abs( s[-o*3] - 2*s[-o*2] + s[-o] )
-      #define calc_DQ(s,o) abs( s[0]    - 2*s[o]    + s[o*2] )
+      #define calc_DP(s,o) abs( (int16_t)s[-o*3] - (int16_t)2*s[-o*2] + (int16_t)s[-o] )
+      #define calc_DQ(s,o) abs( (int16_t)s[0]    - (int16_t)2*s[o]    + (int16_t)s[o*2] )

       dp0 = calc_DP( (src+step*(block_idx*4+0)), offset);
       dq0 = calc_DQ( (src+step*(block_idx*4+0)), offset);
@@ -177,9 +173,11 @@
       #endif
       if (d < Beta)
       {
-        #define useStrongFiltering(o,d,s) ( ((abs(s[-o*4]-s[-o]) + abs(s[-o*3]-s[0])) < (Beta>>3)) && (d<(Beta>>2)) && ( abs(s[-o]-s[0]) < ((Tc*5+1)>>1)) )
-        int8_t filter_P = (dp < iSideThreshold)?1:0;
-        int8_t filter_Q = (dq < iSideThreshold)?1:0;
+        int8_t filter_P = (dp < side_threshold)?1:0;
+        int8_t filter_Q = (dq < side_threshold)?1:0;
+
+        /* Strong filtering flag checking */
+        #define useStrongFiltering(o,d,s) ( ((abs(s[-o*4]-s[-o]) + abs(s[o*3]-s[0])) < (Beta>>3)) && (d<(Beta>>2)) && ( abs(s[-o]-s[0]) < ((Tc*5+1)>>1)) )
         int8_t sw = useStrongFiltering( offset, 2*d0, (src+step*(block_idx*4+0))) &&
                     useStrongFiltering( offset, 2*d3, (src+step*(block_idx*4+3)));

@@ -201,7 +199,7 @@
   /* ToDo: support 10+bits */
   uint8_t* srcU      = &encoder->in.cur_pic.uRecData[xpos+ypos*stride];
   uint8_t* srcV      = &encoder->in.cur_pic.vRecData[xpos+ypos*stride];
-
+  /* Init offset and step to EDGE_HOR */
   int32_t offset = stride;
   int32_t step = 1;

@@ -219,7 +217,7 @@

   // For each subpart
   {
-    int32_t QP            = encoder->QP;
+    int32_t QP             = encoder->QP;
     int32_t bitdepth_scale = 1 << (g_bitDepth-8);
     int32_t TC_index       = CLIP(0, 51+2, (int32_t)(QP + 2 + (tcOffsetDiv2 << 1)));
     int32_t Tc             = tctable_8x8[TC_index]*bitdepth_scale;
@@ -228,12 +226,12 @@

     for (blk_idx = 0; blk_idx < blocks_in_part; blk_idx++)
     {
-      /* Chroma Red */
+      /* Chroma U */
       filter_chroma( srcU+step*(blk_idx*4+0), offset, Tc,0, 0);
       filter_chroma( srcU+step*(blk_idx*4+1), offset, Tc,0, 0);
       filter_chroma( srcU+step*(blk_idx*4+2), offset, Tc,0, 0);
       filter_chroma( srcU+step*(blk_idx*4+3), offset, Tc,0, 0);
-      /* Chroma Blue */
+      /* Chroma V */
       filter_chroma( srcV+step*(blk_idx*4+0), offset, Tc,0, 0);
       filter_chroma( srcV+step*(blk_idx*4+1), offset, Tc,0, 0);
       filter_chroma( srcV+step*(blk_idx*4+2), offset, Tc,0, 0);
@@ -275,12 +273,17 @@

   /* DO THE FILTERING FOR EDGE */
   filter_deblock_edge_luma(encoder, xCtb*(LCU_WIDTH>>MAX_DEPTH), yCtb*(LCU_WIDTH>>MAX_DEPTH), depth, edge);
-  //if ( depth != MAX_DEPTH )
-  {
-    filter_deblock_edge_chroma(encoder, xCtb*(LCU_WIDTH>>(MAX_DEPTH+1)), yCtb*(LCU_WIDTH>>(MAX_DEPTH+1)), depth, edge);
-  }
-
-}
+
+  filter_deblock_edge_chroma(encoder, xCtb*(LCU_WIDTH>>(MAX_DEPTH+1)), yCtb*(LCU_WIDTH>>(MAX_DEPTH+1)), depth, edge);
+}
+
+/*! \brief Main function for Deblocking filtering
+  \param encoder the encoder info structure
+
+  This is the main function for deblocking filter, it will loop through all the
+  Largest Coding Units and call filter_deblock_CU with absolute X and Y coordinate
+  of the LCU.
+*/
 void filter_deblock(encoder_control* encoder)
 {
   int16_t xCtb,yCtb;


Cleanup

Cleanup

--- src/fin_vm.c
+++ src/fin_vm.c
@@ -40,11 +40,13 @@
     #define FIN_VM_OP(op)       case op:
 #endif

+static const uint32_t fin_vm_stack_storage = 64;
+
 typedef struct fin_vm_stack_t {
     fin_val_t* top;
     fin_val_t* begin;
     fin_val_t* end;
-    fin_val_t  stash[64];
+    fin_val_t  storage[fin_vm_stack_storage];
 } fin_vm_stack_t;

 typedef struct fin_vm_t {
@@ -149,9 +151,9 @@

 fin_vm_t* fin_vm_create(fin_ctx_t* ctx) {
     fin_vm_t* vm = (fin_vm_t*)ctx->alloc(NULL, sizeof(fin_vm_t));
-    vm->stack.top   = vm->stack.stash;
-    vm->stack.begin = vm->stack.stash;
-    vm->stack.end   = vm->stack.stash + FIN_COUNT_OF(vm->stack.stash);
+    vm->stack.top   = vm->stack.storage;
+    vm->stack.begin = vm->stack.storage;
+    vm->stack.end   = vm->stack.storage + fin_vm_stack_storage;
     vm->ctx = ctx;
     return vm;
 }


Fixing build

Fixing build

--- src/fin_vm.c
+++ src/fin_vm.c
@@ -151,7 +151,7 @@
     fin_vm_t* vm = (fin_vm_t*)ctx->alloc(NULL, sizeof(fin_vm_t));
     vm->stack.top   = vm->stack.storage;
     vm->stack.begin = vm->stack.storage;
-    vm->stack.end   = vm->stack.storage + fin_vm_stack_storage;
+    vm->stack.end   = vm->stack.storage + FIN_COUNT_OF(vm->stack.storage);
     vm->ctx = ctx;
     return vm;
 }


make udev/eeze mounting and volumes work on ubuntu 10.04... :)

SVN revision: 55993

--- src/bin/e_fm/e_fm_main_udisks.c
+++ src/bin/e_fm/e_fm_main_udisks.c
@@ -274,8 +274,8 @@
         if (v->optype == E_VOLUME_OP_TYPE_EJECT)
           _e_fm_main_udisks_cb_vol_ejected(v, msg, &err);
      }
+   _e_fm_main_udisks_volume_del(udi);
    _e_fm_main_udisks_storage_del(udi);
-   _e_fm_main_udisks_volume_del(udi);
 }

 static void
@@ -316,6 +316,7 @@
                                 E_Ukit_Properties *ret,
                                 DBusError *error)
 {
+   const char *str;
    int err = 0;

    if (!ret) goto error;
@@ -348,8 +349,17 @@
    s->serial = eina_stringshare_add(s->serial);

    s->removable = e_ukit_property_bool_get(ret, "DeviceIsRemovable", &err);
-
-   if (!s->removable) goto error; /* only track removable media */
+   s->system_internal = e_ukit_property_bool_get(ret, "DeviceIsSystemInternal", &err);
+   if (s->system_internal) goto error; /* only track non internal */
+   str = e_ukit_property_string_get(ret, "IdUsage", &err);
+   /* if not of filesystem usage type - skip it  - testing on ubuntu 10.04 */
+   if (!((str) && (!strcmp(str, "filesystem")))) goto error;
+   /* force it to be removable if it passed the above tests */
+   s->removable = EINA_TRUE;
+
+// ubuntu 10.04 - only dvd is reported as removable. usb storage and mmcblk
+// is not - but its not "system internal".
+//   if (!s->removable) goto error; /* only track removable media */
    s->media_available = e_ukit_property_bool_get(ret, "DeviceIsMediaAvailable", &err);
    s->media_size = e_ukit_property_uint64_get(ret, "DeviceSize", &err);

@@ -904,8 +914,13 @@
      }

    v->guard = ecore_timer_add(E_FM_MOUNT_TIMEOUT, (Ecore_Task_Cb)_e_fm_main_udisks_vol_mount_timeout, v);
+// on ubuntu 10.04 if we request mount with opt - it fails. unknown why right
+// now, but lets try without and maybe we need to try 2 mounts - one with
+// opts and one without?
+//   v->op = e_udisks_volume_mount(_e_fm_main_udisks_conn, v->udi,
+//                                        v->fstype, opt);
    v->op = e_udisks_volume_mount(_e_fm_main_udisks_conn, v->udi,
-                                        v->fstype, opt);
+                                        v->fstype, NULL);
    eina_list_free(opt);
    v->optype = E_VOLUME_OP_TYPE_MOUNT;
 }
@@ -955,7 +970,7 @@
    if (!s) return;
    if (s->validated)
      {
-        //	printf("--STO %s\n", s->udi);
+//        printf("--STO %s\n", s->udi);
           ecore_ipc_server_send(_e_fm_ipc_server,
                                 6 /*E_IPC_DOMAIN_FM*/,
                                 E_FM_OP_STORAGE_DEL,


adjust CLUE madctl so rotation 0 is 'right'

--- ports/nrf/boards/clue_nrf52840_express/board.c
+++ ports/nrf/boards/clue_nrf52840_express/board.c
@@ -40,7 +40,7 @@
 uint8_t display_init_sequence[] = {
     0x01, 0 | DELAY, 150, // SWRESET
     0x11, 0 | DELAY, 255, // SLPOUT
-    0x36, 1, 0x00,        // _MADCTL bottom to top refresh in vsync aligned order.
+    0x36, 1, 0b10100000,  // _MADCTL for rotation 0
     0x3a, 1, 0x55, // COLMOD - 16bit color
     0x21, 0 | DELAY, 10,                 // _INVON
     0x13, 0 | DELAY, 10,                 // _NORON
@@ -67,9 +67,9 @@
         bus,
         240, // Width (after rotation)
         240, // Height (after rotation)
-        0, // column start
+        80, // column start
         0, // row start
-        270, // rotation
+        0, // rotation
         16, // Color depth
         false, // Grayscale
         false, // Pixels in a byte share a row. Only used for depth < 8


Replace the description "Everything" by "All" as there
is a conflict with the Everything module wrt translations.

SVN revision: 48098

--- src/bin/e_int_border_remember.c
+++ src/bin/e_int_border_remember.c
@@ -619,7 +619,7 @@
    e_widget_list_object_append(o, ob, 1, 1, 0.5);
    ob = e_widget_radio_add(evas, _("Size, Position and Locks"), MODE_GEOMETRY_LOCKS, rg);
    e_widget_list_object_append(o, ob, 1, 1, 0.5);
-   ob = e_widget_radio_add(evas, _("Everything"), MODE_ALL, rg);
+   ob = e_widget_radio_add(evas, _("All"), MODE_ALL, rg);
    e_widget_list_object_append(o, ob, 1, 1, 0.5);
    return o;
 }


prevent editing of session recovery remembers

find/create new ones in this case

--- src/bin/e_int_client_remember.c
+++ src/bin/e_int_client_remember.c
@@ -23,6 +23,7 @@
 {
    E_Client *client;
    E_Remember *rem;
+   E_Remember *backup_rem;
    /*- BASIC -*/
    int       mode;
    int       warned;
@@ -140,6 +141,9 @@
      rem = ec->remember;
    else
      rem = cfdata->rem;
+
+   if (ec && rem && (rem->apply & E_REMEMBER_APPLY_UUID))
+     cfdata->backup_rem = rem = e_remember_find_usable(ec);

    if (rem)
      {
@@ -316,10 +320,11 @@

    if (cfdata->client)
      {
-        if (!cfdata->applied && cfdata->client->remember)
-          {
-             e_remember_unuse(cfdata->client->remember);
-             e_remember_del(cfdata->client->remember);
+        E_Remember *rem = cfdata->backup_rem ?: cfdata->client->remember;
+        if (!cfdata->applied && rem)
+          {
+             e_remember_unuse(rem);
+             e_remember_del(rem);
              e_config_save_queue();
           }

@@ -413,7 +418,7 @@
 {
    /* Actually take our cfdata settings and apply them in real life */
    E_Client *ec = cfdata->client;
-   E_Remember *rem = ec->remember;
+   E_Remember *rem = cfdata->backup_rem ?: ec->remember;

    if (cfdata->mode == MODE_NOTHING)
      {
@@ -421,8 +426,8 @@
           {
              e_remember_unuse(rem);
              e_remember_del(rem);
-          }
-        e_config_save_queue();
+             e_config_save_queue();
+          }
         return 1;
      }

@@ -431,7 +436,8 @@
         rem = e_remember_new();
         if (rem)
           {
-             ec->remember = rem;
+             if ((!ec->remember) || (!(ec->remember->apply & E_REMEMBER_APPLY_UUID)))
+               ec->remember = rem;
              cfdata->applied = 0;
           }
         else
@@ -450,7 +456,8 @@
    rem->apply = cfdata->mode;
    rem->apply_first_only = 0;

-   e_remember_use(rem);
+   if (ec->remember == rem)
+     e_remember_use(rem);
    e_remember_update(ec);
    cfdata->applied = 1;
    e_config_save_queue();
@@ -463,7 +470,7 @@
    E_Client *ec = cfdata->client;
    E_Remember *rem;

-   if (ec) rem = ec->remember;
+   if (ec) rem = cfdata->backup_rem ?: ec->remember;
    else rem = cfdata->rem;

    if (!rem)
@@ -624,8 +631,9 @@
      {
         _check_matches(rem, 1);
         rem->keep_settings = 0;
-        cfdata->client->remember = rem;
-        e_remember_update(cfdata->client);
+        if ((!ec->remember) || (!(ec->remember->apply & E_REMEMBER_APPLY_UUID)))
+          ec->remember = rem;
+        e_remember_update(ec);
         cfdata->applied = 1;
      }
    rem->keep_settings = cfdata->remember.keep_settings;


add function ho_trim

add function ho_trim

error: pathspec 'libs/ho_trim.c' did not match any file(s) known to git

--- libs/ho_trim.c
+++ libs/ho_trim.c
@@ -0,0 +1,46 @@
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+char *ho_trim(char *s) {
+    char *start, *last, *bk;
+    int len;
+
+    start = s;
+    while (isspace(*start))
+        start++;
+
+    bk = last = s + strlen(s) - 1;
+    while (last > start && isspace(*last))
+        last--;
+
+    if ((s != start) || (bk != last)) {
+        len = last - start + 1;
+        strncpy(s, start, len);
+        s[len] = '\0';
+    }
+    return s;
+}
+
+int main() {
+
+    char buf[128];
+    strcpy(buf, "    1234    ");
+    printf("$%s:\n", ho_trim(buf));
+
+    strcpy(buf, "1234    ");
+    printf("$%s:\n", ho_trim(buf));
+
+    strcpy(buf, "    1234");
+    printf("$%s:\n", ho_trim(buf));
+
+    strcpy(buf, "    1234  abcd   ");
+    printf("$%s:\n", ho_trim(buf));
+
+    strcpy(buf, "    ");
+    printf("$%s:\n", ho_trim(buf));
+
+    strcpy(buf, " ");
+    printf("$%s:\n", ho_trim(buf));
+    return 0;
+}


GT_element_settings_Computed_field_change will acknowledge a change if
there is no graphics object for settings. When previous definitions of
fields caused no graphics object to be built for iso_surfaces, the
change to a new definition that did would not update graphics. Now it does.

git-svn-id: 4705079bc6b8aadf675e3696f5c015a6aa4916e3@1672 3c1deb5b-d424-0410-962d-aba41a686d42

--- source/graphics/element_group_settings.c
+++ source/graphics/element_group_settings.c
@@ -1,7 +1,7 @@
 /*******************************************************************************
 FILE : element_group_settings.c

-LAST MODIFIED : 19 December 2001
+LAST MODIFIED : 21 January 2002

 DESCRIPTION :
 GT_element_settings structure and routines for describing and manipulating the
@@ -5949,7 +5949,7 @@
 int GT_element_settings_Computed_field_change(
 	struct GT_element_settings *settings, void *change_data_void)
 /*******************************************************************************
-LAST MODIFIED : 30 May 2001
+LAST MODIFIED : 21 January 2002

 DESCRIPTION :
 Iterator function telling the <settings> that the computed fields in the
@@ -5973,109 +5973,109 @@
 		&& (changed_field_list = change_data->changed_field_list))
 	{
 		return_code = 1;
-		if (settings->graphics_object)
-		{
-			rebuild_graphics_object = 0;
-			/* determine if the changed_field affects these settings */
-			/* compare geometry settings */
-			/* for all graphic types */
-			/* settings can get default coordinate field from gt_element_group */
-			if (settings->coordinate_field)
-			{
-				coordinate_field = settings->coordinate_field;
-			}
-			else
-			{
-				coordinate_field = change_data->default_coordinate_field;
-			}
-
-			if (Computed_field_depends_on_Computed_field_in_list(coordinate_field,
-				changed_field_list))
-			{
-				rebuild_graphics_object = 1;
-			}
-			/* currently for surfaces only */
-			else if (settings->texture_coordinate_field &&
+		rebuild_graphics_object = 0;
+		/* determine if the changed_field affects these settings */
+		/* compare geometry settings */
+		/* for all graphic types */
+		/* settings can get default coordinate field from gt_element_group */
+		if (settings->coordinate_field)
+		{
+			coordinate_field = settings->coordinate_field;
+		}
+		else
+		{
+			coordinate_field = change_data->default_coordinate_field;
+		}
+
+		if (Computed_field_depends_on_Computed_field_in_list(coordinate_field,
+			changed_field_list))
+		{
+			rebuild_graphics_object = 1;
+		}
+		/* currently for surfaces only */
+		else if (settings->texture_coordinate_field &&
+			Computed_field_depends_on_Computed_field_in_list(
+				settings->texture_coordinate_field, changed_field_list))
+		{
+			rebuild_graphics_object = 1;
+		}
+		/* for cylinders only */
+		else if ((GT_ELEMENT_SETTINGS_CYLINDERS == settings->settings_type) &&
+			settings->radius_scalar_field &&
+			Computed_field_depends_on_Computed_field_in_list(
+				settings->radius_scalar_field, changed_field_list))
+		{
+			rebuild_graphics_object = 1;
+		}
+		/* for iso_surfaces only */
+		else if ((GT_ELEMENT_SETTINGS_ISO_SURFACES == settings->settings_type) &&
+			settings->iso_scalar_field &&
+			Computed_field_depends_on_Computed_field_in_list(
+				settings->iso_scalar_field, changed_field_list))
+		{
+			rebuild_graphics_object = 1;
+		}
+		/* for node_points, data_points and element_points only */
+		else if (((GT_ELEMENT_SETTINGS_NODE_POINTS == settings->settings_type) ||
+			(GT_ELEMENT_SETTINGS_DATA_POINTS == settings->settings_type) ||
+			(GT_ELEMENT_SETTINGS_ELEMENT_POINTS == settings->settings_type)) &&
+			(settings->orientation_scale_field &&
 				Computed_field_depends_on_Computed_field_in_list(
-					settings->texture_coordinate_field, changed_field_list))
-			{
-				rebuild_graphics_object = 1;
-			}
-			/* for cylinders only */
-			else if ((GT_ELEMENT_SETTINGS_CYLINDERS == settings->settings_type) &&
-				settings->radius_scalar_field &&
+					settings->orientation_scale_field, changed_field_list)) ||
+			(settings->variable_scale_field &&
 				Computed_field_depends_on_Computed_field_in_list(
-					settings->radius_scalar_field, changed_field_list))
-			{
-				rebuild_graphics_object = 1;
-			}
-			/* for iso_surfaces only */
-			else if ((GT_ELEMENT_SETTINGS_ISO_SURFACES == settings->settings_type) &&
-				settings->iso_scalar_field &&
+					settings->variable_scale_field, changed_field_list)) ||
+			(settings->label_field &&
 				Computed_field_depends_on_Computed_field_in_list(
-					settings->iso_scalar_field, changed_field_list))
-			{
-				rebuild_graphics_object = 1;
-			}
-			/* for node_points, data_points and element_points only */
-			else if (((GT_ELEMENT_SETTINGS_NODE_POINTS == settings->settings_type) ||
-				(GT_ELEMENT_SETTINGS_DATA_POINTS == settings->settings_type) ||
-				(GT_ELEMENT_SETTINGS_ELEMENT_POINTS == settings->settings_type)) &&
-				(settings->orientation_scale_field &&
-					Computed_field_depends_on_Computed_field_in_list(
-						settings->orientation_scale_field, changed_field_list)) ||
-				(settings->variable_scale_field &&
-					Computed_field_depends_on_Computed_field_in_list(
-						settings->variable_scale_field, changed_field_list)) ||
-				(settings->label_field &&
-					Computed_field_depends_on_Computed_field_in_list(
-						settings->label_field, changed_field_list)))
-			{
-				rebuild_graphics_object = 1;
-			}
-			/* for element_points with a density field only */
-			else if ((GT_ELEMENT_SETTINGS_ELEMENT_POINTS == settings->settings_type)
-				&& ((XI_DISCRETIZATION_CELL_DENSITY ==
-					settings->xi_discretization_mode) ||
-					(XI_DISCRETIZATION_CELL_POISSON ==
-						settings->xi_discretization_mode)) &&
+					settings->label_field, changed_field_list)))
+		{
+			rebuild_graphics_object = 1;
+		}
+		/* for element_points with a density field only */
+		else if ((GT_ELEMENT_SETTINGS_ELEMENT_POINTS == settings->settings_type)
+			&& ((XI_DISCRETIZATION_CELL_DENSITY ==
+				settings->xi_discretization_mode) ||
+				(XI_DISCRETIZATION_CELL_POISSON ==
+					settings->xi_discretization_mode)) &&
+			Computed_field_depends_on_Computed_field_in_list(
+				settings->xi_point_density_field, changed_field_list))
+		{
+			rebuild_graphics_object = 1;
+		}
+		/* for volumes only */
+		else if ((GT_ELEMENT_SETTINGS_VOLUMES == settings->settings_type)&&
+			(settings->displacement_map_field &&
 				Computed_field_depends_on_Computed_field_in_list(
-					settings->xi_point_density_field, changed_field_list))
-			{
-				rebuild_graphics_object = 1;
-			}
-			/* for volumes only */
-			else if ((GT_ELEMENT_SETTINGS_VOLUMES == settings->settings_type)&&
-				(settings->displacement_map_field &&
-					Computed_field_depends_on_Computed_field_in_list(
-						settings->displacement_map_field, changed_field_list))||
-				(settings->blur_field &&
-					Computed_field_depends_on_Computed_field_in_list(
-						settings->blur_field, changed_field_list)))
-			{
-				rebuild_graphics_object = 1;
-			}
-			/* for streamlines only */
-			else if ((GT_ELEMENT_SETTINGS_STREAMLINES == settings->settings_type) &&
-				settings->stream_vector_field &&
+					settings->displacement_map_field, changed_field_list))||
+			(settings->blur_field &&
 				Computed_field_depends_on_Computed_field_in_list(
-					settings->stream_vector_field, changed_field_list))
-			{
-				rebuild_graphics_object = 1;
-			}
-			/* appearance settings for all settings types */
-			else if (settings->data_field &&
-				Computed_field_depends_on_Computed_field_in_list(
-					settings->data_field, changed_field_list))
-			{
-				rebuild_graphics_object = 1;
-			}
-			if (rebuild_graphics_object)
+					settings->blur_field, changed_field_list)))
+		{
+			rebuild_graphics_object = 1;
+		}
+		/* for streamlines only */
+		else if ((GT_ELEMENT_SETTINGS_STREAMLINES == settings->settings_type) &&
+			settings->stream_vector_field &&
+			Computed_field_depends_on_Computed_field_in_list(
+				settings->stream_vector_field, changed_field_list))
+		{
+			rebuild_graphics_object = 1;
+		}
+		/* appearance settings for all settings types */
+		else if (settings->data_field &&
+			Computed_field_depends_on_Computed_field_in_list(
+				settings->data_field, changed_field_list))
+		{
+			rebuild_graphics_object = 1;
+		}
+		if (rebuild_graphics_object)
+		{
+			if (settings->graphics_object)
 			{
 				DEACCESS(GT_object)(&(settings->graphics_object));
 				settings->graphics_object = (struct GT_object *)NULL;
-				change_data->rebuild_graphics = 1;
-			}
+			}
+			change_data->rebuild_graphics = 1;
 		}
 	}
 	else


MBA added to allocation reset function

MBA added to allocation reset function

Change-Id: I2cbb5d69b5f8010f9b9112d62fa7125bbe85dcd0

--- lib/allocation.c
+++ lib/allocation.c
@@ -1113,9 +1113,9 @@
 }

 /**
- * @brief Writes range of CAT COS MSR's with \a msr_val value
- *
- * Used as part of CAT reset process.
+ * @brief Writes range of MBA/CAT COS MSR's with \a msr_val value
+ *
+ * Used as part of CAT/MBA reset process.
  *
  * @param [in] msr_start First MSR to be written
  * @param [in] msr_num Number of MSR's to be written
@@ -1127,10 +1127,10 @@
  * @retval PQOS_RETVAL_ERROR on MSR write error
  */
 static int
-cat_cos_reset(const unsigned msr_start,
-              const unsigned msr_num,
-              const unsigned coreid,
-              const uint64_t msr_val)
+alloc_cos_reset(const unsigned msr_start,
+                const unsigned msr_num,
+                const unsigned coreid,
+                const uint64_t msr_val)
 {
         int ret = PQOS_RETVAL_OK;
         unsigned i;
@@ -1155,7 +1155,7 @@
  * @retval PQOS_RETVAL_ERROR on MSR write error
  */
 static int
-cat_assoc_reset(void)
+alloc_assoc_reset(void)
 {
         int ret = PQOS_RETVAL_OK;
         unsigned i;
@@ -1174,9 +1174,10 @@
         unsigned sockets_num = 0;
         unsigned *l2ids = NULL;
         unsigned l2id_num = 0;
-        const struct pqos_capability *cat_cap = NULL;
+        const struct pqos_capability *alloc_cap = NULL;
         const struct pqos_cap_l3ca *l3_cap = NULL;
         const struct pqos_cap_l2ca *l2_cap = NULL;
+        const struct pqos_cap_mba *mba_cap = NULL;
         int ret = PQOS_RETVAL_OK;
         unsigned max_l3_cos = 0;
         unsigned j;
@@ -1198,19 +1199,25 @@
         }

         /* Get L3 CAT capabilities */
-        (void) pqos_cap_get_type(m_cap, PQOS_CAP_TYPE_L3CA, &cat_cap);
-        if (cat_cap != NULL)
-                l3_cap = cat_cap->u.l3ca;
+        (void) pqos_cap_get_type(m_cap, PQOS_CAP_TYPE_L3CA, &alloc_cap);
+        if (alloc_cap != NULL)
+                l3_cap = alloc_cap->u.l3ca;

         /* Get L2 CAT capabilities */
-        cat_cap = NULL;
-        (void) pqos_cap_get_type(m_cap, PQOS_CAP_TYPE_L2CA, &cat_cap);
-        if (cat_cap != NULL)
-                l2_cap = cat_cap->u.l2ca;
-
-        /* Check if either L2 or L3 CAT is supported */
-        if (l2_cap == NULL && l3_cap == NULL) {
-                LOG_ERROR("L2/L3 CAT not present!\n");
+        alloc_cap = NULL;
+        (void) pqos_cap_get_type(m_cap, PQOS_CAP_TYPE_L2CA, &alloc_cap);
+        if (alloc_cap != NULL)
+                l2_cap = alloc_cap->u.l2ca;
+
+        /* Get MBA capabilities */
+        alloc_cap = NULL;
+        (void) pqos_cap_get_type(m_cap, PQOS_CAP_TYPE_MBA, &alloc_cap);
+        if (alloc_cap != NULL)
+                mba_cap = alloc_cap->u.mba;
+
+        /* Check if either L2 CAT, L3 CAT or MBA is supported */
+        if (l2_cap == NULL && l3_cap == NULL && mba_cap == NULL) {
+                LOG_ERROR("L2 CAT/L3 CAT/MBA not present!\n");
                 ret = PQOS_RETVAL_RESOURCE; /* no L2/L3 CAT present */
                 goto pqos_alloc_reset_exit;
         }
@@ -1258,8 +1265,8 @@
                         const uint64_t ways_mask =
                                 (1ULL << l3_cap->num_ways) - 1ULL;

-                        ret = cat_cos_reset(PQOS_MSR_L3CA_MASK_START,
-                                            max_l3_cos, core, ways_mask);
+                        ret = alloc_cos_reset(PQOS_MSR_L3CA_MASK_START,
+                                              max_l3_cos, core, ways_mask);
                         if (ret != PQOS_RETVAL_OK)
                                 goto pqos_alloc_reset_exit;
                 }
@@ -1283,18 +1290,38 @@
                         if (ret != PQOS_RETVAL_OK)
                                 goto pqos_alloc_reset_exit;

-                        ret = cat_cos_reset(PQOS_MSR_L2CA_MASK_START,
-                                            l2_cap->num_classes, core,
+                        ret = alloc_cos_reset(PQOS_MSR_L2CA_MASK_START,
+                                              l2_cap->num_classes, core,
                                             ways_mask);
                         if (ret != PQOS_RETVAL_OK)
                                 goto pqos_alloc_reset_exit;
                 }
         }

+        if (mba_cap != NULL) {
+                /**
+                 * Go through all sockets and reset MBA class defintions
+                 * 0 is the default MBA COS value in linear mode.
+                 */
+
+                for (j = 0; j < sockets_num; j++) {
+                        unsigned core = 0;
+
+                        ret = pqos_cpu_get_one_core(m_cpu, sockets[j], &core);
+                        if (ret != PQOS_RETVAL_OK)
+                                goto pqos_alloc_reset_exit;
+
+                        ret = alloc_cos_reset(PQOS_MSR_MBA_MASK_START,
+                                              mba_cap->num_classes, core, 0);
+                        if (ret != PQOS_RETVAL_OK)
+                                goto pqos_alloc_reset_exit;
+                }
+        }
+
         /**
          * Associate all cores with COS0
          */
-        ret = cat_assoc_reset();
+        ret = alloc_assoc_reset();
         if (ret != PQOS_RETVAL_OK)
                 goto pqos_alloc_reset_exit;


Fix string length problem about issue #42

--- src/c/ngx_http_clojure_module.c
+++ src/c/ngx_http_clojure_module.c
@@ -279,7 +279,7 @@
 		return exp->data;
 	} else {
 		u_char *sp = exp->data;
-		u_char *esp = sp + exp->len;
+		u_char *esp = sp + exp->len + 1;
 		u_char tmp[NGX_CLOJURE_CONF_LINE_MAX];
 		u_char *dp = tmp;
 		u_char *edp = dp + NGX_CLOJURE_CONF_LINE_MAX;
@@ -323,7 +323,7 @@
 static char * ngx_http_clojure_jvm_var_post_handler(ngx_conf_t *cf, void *data, void *conf) {
 	ngx_keyval_t *kv = conf;
 	ngx_http_clojure_loc_conf_t *lcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_clojure_module);
-	if (ngx_strnstr(kv->value.data, "#{", sizeof("#{")) != NULL) {
+	if (ngx_strnstr(kv->value.data, "#{", kv->value.len) != NULL) {
 		kv->value.data = ngx_http_clojure_eval_experssion(lcf, &kv->value, cf->pool);
 		if (kv->value.data == NULL) {
 			ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
@@ -339,7 +339,7 @@
 static char * ngx_http_clojure_jvm_options_post_handler(ngx_conf_t *cf, void *data, void *conf) {
 	ngx_str_t *v = conf;
 	ngx_http_clojure_loc_conf_t *lcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_clojure_module);
-	if (ngx_strnstr(v->data, "#{", sizeof("#{")) != NULL) {
+	if (ngx_strnstr(v->data, "#{", v->len) != NULL) {
 		u_char * ev = ngx_http_clojure_eval_experssion(lcf, v, cf->pool);
 		if (ev == NULL) {
 			ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,


HttpHeader: fix bug

HttpHeader: fix bug

--- source/src/Netty/codec-http/HttpHeader.c
+++ source/src/Netty/codec-http/HttpHeader.c
@@ -197,12 +197,28 @@
 TINY_LOR
 TinyRet HttpHeader_GetContentLength(HttpHeader * thiz, uint32_t *length)
 {
-    const char *value = HttpHeader_GetValue(thiz, CONTENT_LENGTH);
-    char *stop = NULL;
-
-    *length = (uint32_t)(strtol(value, &stop, 10));
-
-    return (stop != value) ? TINY_RET_OK : TINY_RET_E_ARG_INVALID;
+    TinyRet ret = TINY_RET_OK;
+
+    do
+    {
+        const char *value = HttpHeader_GetValue(thiz, CONTENT_LENGTH);
+        char *stop = NULL;
+
+        if (value == NULL)
+        {
+            (*length) = 0;
+            break;
+        }
+
+        *length = (uint32_t)(strtol(value, &stop, 10));
+
+        if (stop == value)
+        {
+            ret = TINY_RET_E_ARG_INVALID;
+        }
+    } while (false);
+
+    return ret;
 }

 TINY_LOR


Fix buffer length -- allow space for prefix.

--- src/format.c
+++ src/format.c
@@ -86,8 +86,9 @@
 #define MAXWIDTH        ( 500 )
 #define MAXPREC         ( 500 )
 #define MAXBASE         ( 36 )
-#define BUFLEN          ( 128 )  /* Must be long enough for 64-bit pointers
-                                     in binary with maximum grouping chars */
+#define BUFLEN          ( 130 )  /* Must be long enough for 64-bit pointers
+                                     in binary with maximum grouping chars and
+                                     prefix. */

 /**
     Return the maximum/minimum of two scalar values.


use red when formatting numbers

use red when formatting numbers

--- src/format.c
+++ src/format.c
@@ -291,22 +291,30 @@
 static int
 json_format_integer(int64_t integer, struct bf_buffer *buf,
                     struct json_format_ctx *ctx) {
+    JSON_SET_ANSI_COLOR(ctx, buf, JSON_ANSI_COLOR_RED);
+
     if (bf_buffer_add_printf(buf, "%"PRIi64, integer) == -1) {
         json_set_error("%s", bf_get_error());
-        return -1;
-    }
-
+        JSON_CLEAR_ANSI_COLOR(ctx, buf);
+        return -1;
+    }
+
+    JSON_CLEAR_ANSI_COLOR(ctx, buf);
     return 0;
 }

 static int
 json_format_real(double real, struct bf_buffer *buf,
                  struct json_format_ctx *ctx) {
+    JSON_SET_ANSI_COLOR(ctx, buf, JSON_ANSI_COLOR_RED);
+
     if (bf_buffer_add_printf(buf, "%.17g", real) == -1) {
         json_set_error("%s", bf_get_error());
-        return -1;
-    }
-
+        JSON_CLEAR_ANSI_COLOR(ctx, buf);
+        return -1;
+    }
+
+    JSON_CLEAR_ANSI_COLOR(ctx, buf);
     return 0;
 }


Compound literal init doesn't use .code any more

--- src/cc1/ops/expr_compound_lit.c
+++ src/cc1/ops/expr_compound_lit.c
@@ -7,6 +7,8 @@
 #include "../out/lbl.h"
 #include "../decl_init.h"
 #include "../type_is.h"
+
+#define COMP_LIT_INITIALISED(e) (e)->bits.complit.decl->bits.var.init.expr

 const char *str_expr_compound_lit(void)
 {
@@ -29,7 +31,7 @@
 	if(!stab->parent)
 		static_ctx = 1;

-	if(e->code)
+	if(COMP_LIT_INITIALISED(e))
 		return; /* being called from fold_gen_init_assignment_base */

 	/* must be set before the recursive fold_gen_init_assignment_base */
@@ -77,10 +79,11 @@
 	if(!e->expr_comp_lit_cgen){
 		e->expr_comp_lit_cgen = 1;

-		UCC_ASSERT(e->code->symtab->parent,
-				"global compound initialiser tried for code");
-
-		gen_stmt(e->code, octx);
+		out_val_consume(
+				octx,
+				gen_expr(
+					e->bits.complit.decl->bits.var.init.expr,
+					octx));
 	}
 }


added sys_get_pid

added sys_get_pid

--- libs/std/sys.c
+++ libs/std/sys.c
@@ -564,6 +564,18 @@
 #	endif
 }

+/**
+	sys_get_pid : void -> int
+	<doc>Returns the current process identifier</doc>
+**/
+static value sys_get_pid() {
+#	ifdef NEKO_WINDOWS
+	return alloc_int(GetCurrentProcessId());
+#	else
+	return alloc_int(getpid());
+#	endif
+}
+
 DEFINE_PRIM(get_env,1);
 DEFINE_PRIM(put_env,2);
 DEFINE_PRIM(set_time_locale,1);
@@ -588,5 +600,6 @@
 DEFINE_PRIM(sys_exe_path,0);
 DEFINE_PRIM(sys_file_type,1);
 DEFINE_PRIM(sys_getch,1);
+DEFINE_PRIM(sys_get_pid,0);

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


error fix for linux.

error fix for linux.

--- libs/std/sys.c
+++ libs/std/sys.c
@@ -255,7 +255,7 @@
 		if( e->d_name[0] == '.' && (e->d_name[1] == 0 || (e->d_name[1] == '.' && e->d_name[2] == 0)) )
 			continue;
 		tmp = alloc_array(2);
-		val_array_ptr(tmp)[0] = alloc_string(d->name);
+		val_array_ptr(tmp)[0] = alloc_string(e->d_name);
 		val_array_ptr(tmp)[1] = val_null;
 		if( cur )
 			val_array_ptr(cur)[1] = tmp;


Support for RISCV.

Support for RISCV.

--- libtock/tock.c
+++ libtock/tock.c
@@ -236,7 +236,7 @@
   register uint32_t a2  asm ("a2") = arg1;
   register void*    ret asm ("a0");
   asm volatile (
-    "li    a0, 4\n"
+    "li    a0, 5\n"
     "ecall\n"
     : "=r" (ret)
     : "r" (a1), "r" (a2)


proper error message in case zip_open fails

--- regress/fread.c
+++ regress/fread.c
@@ -1,8 +1,8 @@
 /*
-  $NiH: fread.c,v 1.4 2005/06/09 18:49:38 dillo Exp $
+  $NiH: fread.c,v 1.5 2005/07/16 17:14:32 wiz Exp $

   fread.c -- test cases for reading from zip archives
-  Copyright (C) 2004, 2005 Dieter Baron and Thomas Klausner
+  Copyright (C) 2004, 2005, 2006 Dieter Baron and Thomas Klausner

   This file is part of libzip, a library to manipulate ZIP archives.
   The authors can be contacted at <nih@giga.or.at>
@@ -65,6 +65,7 @@
     struct zip *z;
     struct zip_source *zs;
     char *archive;
+    char errstr[1024];

     fail = 0;

@@ -78,8 +79,9 @@
     archive = argv[1];

     if ((z=zip_open(mkname(archive), 0, &ze)) == NULL) {
-	printf("%s: opening zip archive ``%s'' failed (%d)\n", prg,
-	       archive, ze);
+	zip_error_to_str(errstr, sizeof(errstr), ze, errno);
+	printf("%s: opening zip archive ``%s'' failed: %s\n",
+	       prg, archive, errstr);
 	return 1;
     }


Prevent potential DOS through non-busy loop and segfault

--- src/ftpcmd.c
+++ src/ftpcmd.c
@@ -776,7 +776,8 @@
 			if (ptr2) {
 				memmove(ptr2, &ptr2[1], strlen(ptr2));
 				memmove(quot, &quot[1], strlen(quot));
-			}
+			} else
+                                break;
 		}
 		arg = ptr;
 	}
@@ -1411,7 +1412,7 @@
 static void handle_OPTS(ctrl_t *ctrl, char *arg)
 {
 	/* OPTS MLST type;size;modify;perm; */
-	if (strstr(arg, "MLST")) {
+	if (arg && strstr(arg, "MLST")) {
 		size_t i = 0;
 		char *ptr;
 		char buf[42] = "200 MLST OPTS ";


Fix cppcheck complaint.

Fix cppcheck complaint.

--- src/cl_wrapper/cl_interceptor.c
+++ src/cl_wrapper/cl_interceptor.c
@@ -2315,7 +2315,7 @@
     cl_err = clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, sizeof(cl_uint), &dim, NULL);
     check_cl_error(__FILE__, __LINE__, cl_err);

-    if (dim <= 0)
+    if (dim == 0)
         return 0;

     max_size = calloc(sizeof(size_t), dim);


m doc

m doc

Signed-off-by: Mattias Andrée <3d72f033b30d63e7ff5f0b71398e9c45b66386a1@kth.se>

--- src/gammad.c
+++ src/gammad.c
@@ -384,9 +384,6 @@

 /**
  * Create PID file
- *
- * @signal  SIGUSR1  Re-execute to updated process image
- * @signal  SIGTERM  Terminate the process gracefully
  *
  * @param   pidfile  The pathname of the PID file
  * @return           Zero on success, -1 on error,
@@ -881,6 +878,9 @@
  *
  * The process closes stdout when the socket has been created
  *
+ * @signal  SIGUSR1  Re-execute to updated process image
+ * @signal  SIGTERM  Terminate the process gracefully
+ *
  * @return  0: Successful
  *          1: An error occurred
  *          2: Already running


Properly export desktop files

Properly export desktop files

This makes a copy of all .desktop files and removes all TryExec lines
and converts all Exec lines to use xdg-app run.

--- xdg-app-dir.c
+++ xdg-app-dir.c
@@ -1,12 +1,15 @@
 #include "config.h"

 #include <string.h>
+#include <fcntl.h>

 #include <gio/gio.h>
 #include "libgsystem.h"

 #include "xdg-app-dir.h"
 #include "xdg-app-utils.h"
+
+#include "errno.h"

 struct XdgAppDir {
   GObject parent;
@@ -402,6 +405,301 @@
   return ret;
 }

+static gboolean
+read_fd (int           fd,
+         struct stat  *stat_buf,
+         gchar       **contents,
+         gsize        *length,
+         GError      **error)
+{
+  gchar *buf;
+  gsize bytes_read;
+  gsize size;
+  gsize alloc_size;
+
+  size = stat_buf->st_size;
+
+  alloc_size = size + 1;
+  buf = g_try_malloc (alloc_size);
+
+  if (buf == NULL)
+    {
+      g_set_error (error,
+                   G_FILE_ERROR,
+                   G_FILE_ERROR_NOMEM,
+                   "not enough memory");
+      return FALSE;
+    }
+
+  bytes_read = 0;
+  while (bytes_read < size)
+    {
+      gssize rc;
+
+      rc = read (fd, buf + bytes_read, size - bytes_read);
+
+      if (rc < 0)
+        {
+          if (errno != EINTR)
+            {
+              int save_errno = errno;
+
+              g_free (buf);
+              g_set_error (error,
+                           G_FILE_ERROR,
+                           g_file_error_from_errno (save_errno),
+                           "Failed to read from exported file");
+              return FALSE;
+            }
+        }
+      else if (rc == 0)
+        break;
+      else
+        bytes_read += rc;
+    }
+
+  buf[bytes_read] = '\0';
+
+  if (length)
+    *length = bytes_read;
+
+  *contents = buf;
+
+  return TRUE;
+}
+
+static gboolean
+export_desktop_file (const char    *app,
+                     const char    *branch,
+                     const char    *arch,
+                     int            parent_fd,
+                     const char    *name,
+                     struct stat   *stat_buf,
+                     char         **target,
+                     GCancellable  *cancellable,
+                     GError       **error)
+{
+  gboolean ret = FALSE;
+  gs_fd_close int desktop_fd = -1;
+  gs_free char *tmpfile_name = NULL;
+  gs_unref_object GOutputStream *out_stream = NULL;
+  gs_free gchar *data = NULL;
+  gsize data_len;
+  gs_free gchar *new_data = NULL;
+  gsize new_data_len;
+  gs_unref_keyfile GKeyFile *keyfile = NULL;
+  gs_free gchar *old_exec = NULL;
+  gint old_argc;
+  gs_strfreev gchar **old_argv = NULL;
+  GString *new_exec = NULL;
+  gs_free char *escaped_app = g_shell_quote (app);
+
+  if (!gs_file_openat_noatime (parent_fd, name, &desktop_fd, cancellable, error))
+    goto out;
+
+  if (!read_fd (desktop_fd, stat_buf, &data, &data_len, error))
+    goto out;
+
+  keyfile = g_key_file_new ();
+  if (!g_key_file_load_from_data (keyfile, data, data_len, G_KEY_FILE_KEEP_TRANSLATIONS, error))
+    goto out;
+
+  g_key_file_remove_key (keyfile, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_TRY_EXEC, NULL);
+
+  new_exec = g_string_new ("");
+  g_string_append_printf (new_exec, "xdg-app run --branch=%s --arch=%s", branch, arch);
+
+  old_exec = g_key_file_get_string (keyfile, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_EXEC, NULL);
+  if (old_exec && g_shell_parse_argv (old_exec, &old_argc, &old_argv, NULL) && old_argc >= 1)
+    {
+      int i;
+      gs_free char *command = g_shell_quote (old_argv[0]);
+
+      g_string_append_printf (new_exec, " --command=%s", command);
+
+      g_string_append (new_exec, " ");
+      g_string_append (new_exec, escaped_app);
+
+      for (i = 1; i < old_argc; i++)
+        {
+          gs_free char *arg = g_shell_quote (old_argv[i]);
+          g_string_append (new_exec, " ");
+          g_string_append (new_exec, arg);
+        }
+    }
+  else
+    {
+      g_string_append (new_exec, " ");
+      g_string_append (new_exec, escaped_app);
+    }
+
+  g_key_file_set_string (keyfile, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_EXEC, new_exec->str);
+
+
+  new_data = g_key_file_to_data (keyfile, &new_data_len, error);
+  if (new_data == NULL)
+    goto out;
+
+  if (!gs_file_open_in_tmpdir_at (parent_fd, 0755, &tmpfile_name, &out_stream, cancellable, error))
+    goto out;
+
+  if (!g_output_stream_write_all (out_stream, new_data, new_data_len, NULL, cancellable, error))
+    goto out;
+
+  if (!g_output_stream_close (out_stream, cancellable, error))
+    goto out;
+
+  gs_transfer_out_value (target, &tmpfile_name);
+
+  ret = TRUE;
+ out:
+
+  if (new_exec != NULL)
+    g_string_free (new_exec, TRUE);
+
+  return ret;
+}
+
+static gboolean
+export_dir (const char    *app,
+            const char    *branch,
+            const char    *arch,
+            int            source_parent_fd,
+            const char    *source_name,
+            const char    *source_symlink_prefix,
+            const char    *source_relpath,
+            int            destination_parent_fd,
+            const char    *destination_name,
+            GCancellable  *cancellable,
+            GError       **error)
+{
+  gboolean ret = FALSE;
+  int res;
+  gs_dirfd_iterator_cleanup GSDirFdIterator source_iter;
+  gs_fd_close int destination_dfd = -1;
+  struct dirent *dent;
+
+  if (!gs_dirfd_iterator_init_at (source_parent_fd, source_name, FALSE, &source_iter, error))
+    goto out;
+
+  do
+    res = mkdirat (destination_parent_fd, destination_name, 0777);
+  while (G_UNLIKELY (res == -1 && errno == EINTR));
+  if (res == -1)
+    {
+      if (errno != EEXIST)
+        {
+          gs_set_error_from_errno (error, errno);
+          goto out;
+        }
+    }
+
+  if (!gs_file_open_dir_fd_at (destination_parent_fd, destination_name,
+                               &destination_dfd,
+                               cancellable, error))
+    goto out;
+
+  while (TRUE)
+    {
+      struct stat stbuf;
+
+      if (!gs_dirfd_iterator_next_dent (&source_iter, &dent, cancellable, error))
+        goto out;
+
+      if (dent == NULL)
+        break;
+
+      if (fstatat (source_iter.fd, dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW) == -1)
+        {
+          int errsv = errno;
+          if (errsv == ENOENT)
+            continue;
+          else
+            {
+              gs_set_error_from_errno (error, errsv);
+              goto out;
+            }
+        }
+
+      if (S_ISDIR (stbuf.st_mode))
+        {
+          gs_free gchar *child_symlink_prefix = g_build_filename ("..", source_symlink_prefix, dent->d_name, NULL);
+          gs_free gchar *child_relpath = g_strconcat (source_relpath, dent->d_name, "/", NULL);
+
+          if (!export_dir (app, branch, arch,
+                           source_iter.fd, dent->d_name, child_symlink_prefix, child_relpath, destination_dfd, dent->d_name,
+                           cancellable, error))
+            goto out;
+        }
+      else if (S_ISREG (stbuf.st_mode))
+        {
+          gs_free gchar *target = NULL;
+
+          if (g_str_has_suffix (dent->d_name, ".desktop"))
+            {
+              gs_free gchar *new_name = NULL;
+
+              if (!export_desktop_file (app, branch, arch, source_iter.fd, dent->d_name, &stbuf, &new_name, cancellable, error))
+                goto out;
+
+              target = g_build_filename (source_symlink_prefix, new_name, NULL);
+            }
+          else
+            {
+              target = g_build_filename (source_symlink_prefix, dent->d_name, NULL);
+            }
+
+          if (unlinkat (destination_dfd, dent->d_name, 0) != 0 && errno != ENOENT)
+            {
+              gs_set_error_from_errno (error, errno);
+              goto out;
+            }
+
+          if (symlinkat (target, destination_dfd, dent->d_name) != 0)
+            {
+              gs_set_error_from_errno (error, errno);
+              goto out;
+            }
+        }
+      else
+        {
+          g_warning ("Not exporting file %s of unsupported type\n", source_relpath);
+        }
+    }
+
+  ret = TRUE;
+ out:
+
+  return ret;
+}
+
+gboolean
+xdg_app_export_dir (const char *app,
+                    const char *branch,
+                    const char *arch,
+                    GFile    *source,
+                    GFile    *destination,
+                    const char *symlink_prefix,
+                    GCancellable  *cancellable,
+                    GError       **error)
+{
+  gboolean ret = FALSE;
+
+  if (!gs_file_ensure_directory (destination, TRUE, cancellable, error))
+    goto out;
+
+  /* The fds are closed by this call */
+  if (!export_dir (app, branch, arch,
+                   AT_FDCWD, gs_file_get_path_cached (source), symlink_prefix, "",
+                   AT_FDCWD, gs_file_get_path_cached (destination),
+                   cancellable, error))
+    goto out;
+
+  ret = TRUE;
+
+ out:
+  return ret;
+}

 gboolean
@@ -476,15 +774,18 @@
         {
           gs_free char *relative_path = NULL;
           gs_free char *symlink_prefix = NULL;
+          gs_strfreev char **ref_parts = NULL;

           relative_path = g_file_get_relative_path (self->basedir, export);
           symlink_prefix = g_build_filename ("..", relative_path, NULL);

-          if (!xdg_app_overlay_symlink_tree (export, exports,
-                                             symlink_prefix,
-                                             cancellable,
-                                             error))
-              goto out;
+          ref_parts = g_strsplit (ref, "/", -1);
+
+          if (!xdg_app_export_dir (ref_parts[1], ref_parts[3], ref_parts[2], export, exports,
+                                   symlink_prefix,
+                                   cancellable,
+                                   error))
+            goto out;
         }
     }


[daemon] update description of CReporterDaemonMonitorPrivate::checkForDuplicates()

--- src/daemon/creporterdaemonmonitor_p.h
+++ src/daemon/creporterdaemonmonitor_p.h
@@ -141,13 +141,11 @@
         void resetCrashCount();

     public:
-        /*!
-         * @brief Checks for duplicate rich-cores, if auto-delete setting is enabled.
+        /**
+         * Checks whether 'similar' rich core was already handled.
          *
-         * Deletes rich-core file, if maximum number of similar files have been handled.
-         *
-         * @param Path to rich-core file to check.
-         * @return True, if file was dublicate and can be deleted; otherwise false.
+         * @param path File path of rich core to check.
+         * @return @c true if duplicate was found, otherwise @c false.
          */
         bool checkForDuplicates(const QString &path);


fix size_t/int issues (#55)

fix size_t/int issues (#55)

--- libxo/xo_buf.h
+++ libxo/xo_buf.h
@@ -28,7 +28,7 @@
 typedef struct xo_buffer_s {
     char *xb_bufp;		/* Buffer memory */
     char *xb_curp;		/* Current insertion point */
-    unsigned xb_size;		/* Size of buffer */
+    ssize_t xb_size;		/* Size of buffer */
 } xo_buffer_t;

 /*
@@ -111,10 +111,10 @@
  * return 0 to tell the caller they are in trouble.
  */
 static inline int
-xo_buf_has_room (xo_buffer_t *xbp, int len)
+xo_buf_has_room (xo_buffer_t *xbp, ssize_t len)
 {
     if (xbp->xb_curp + len >= xbp->xb_bufp + xbp->xb_size) {
-	int sz = xbp->xb_size + XO_BUFSIZ;
+	ssize_t sz = xbp->xb_size + XO_BUFSIZ;
 	char *bp = xo_realloc(xbp->xb_bufp, sz);
 	if (bp == NULL)
 	    return 0;
@@ -131,7 +131,7 @@
  * Append the given string to the given buffer
  */
 static inline void
-xo_buf_append (xo_buffer_t *xbp, const char *str, int len)
+xo_buf_append (xo_buffer_t *xbp, const char *str, ssize_t len)
 {
     if (!xo_buf_has_room(xbp, len))
 	return;
@@ -146,7 +146,7 @@
 static inline void
 xo_buf_append_str (xo_buffer_t *xbp, const char *str)
 {
-    int len = strlen(str);
+    ssize_t len = strlen(str);

     if (!xo_buf_has_room(xbp, len))
 	return;


gf_w32.c: fix dereference of undefined pointer value

Check for array boundaries of 't' in while loop header.

Signed-off-by: Danny Al-Gaaf <473e39ac77cf392f0dd9bacde8409de76c14d006@bisect.de>


Moved all g_iconv() state updates out of encoders/decoders

This gives a HUGE performance improvement as well as
simplifying the code.

--- src/giconv.c
+++ src/giconv.c
@@ -34,8 +34,8 @@
 #endif
 #include <errno.h>

-typedef int (* Decoder) (char **inbytes, size_t *inbytesleft, gunichar *outchar);
-typedef int (* Encoder) (gunichar c, char **outbytes, size_t *outbytesleft);
+typedef int (* Decoder) (char *inbuf, size_t inleft, gunichar *outchar);
+typedef int (* Encoder) (gunichar c, char *outbuf, size_t outleft);

 struct _GIConv {
 	Decoder decode;
@@ -46,23 +46,23 @@
 #endif
 };

-static int decode_utf32be (char **inbytes, size_t *inbytesleft, gunichar *outchar);
-static int encode_utf32be (gunichar c, char **outbytes, size_t *outbytesleft);
-
-static int decode_utf32le (char **inbytes, size_t *inbytesleft, gunichar *outchar);
-static int encode_utf32le (gunichar c, char **outbytes, size_t *outbytesleft);
-
-static int decode_utf16be (char **inbytes, size_t *inbytesleft, gunichar *outchar);
-static int encode_utf16be (gunichar c, char **outbytes, size_t *outbytesleft);
-
-static int decode_utf16le (char **inbytes, size_t *inbytesleft, gunichar *outchar);
-static int encode_utf16le (gunichar c, char **outbytes, size_t *outbytesleft);
-
-static int decode_utf8 (char **inbytes, size_t *inbytesleft, gunichar *outchar);
-static int encode_utf8 (gunichar c, char **outbytes, size_t *outbytesleft);
-
-static int decode_latin1 (char **inbytes, size_t *inbytesleft, gunichar *outchar);
-static int encode_latin1 (gunichar c, char **outbytes, size_t *outbytesleft);
+static int decode_utf32be (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_utf32be (gunichar c, char *outbuf, size_t outleft);
+
+static int decode_utf32le (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_utf32le (gunichar c, char *outbuf, size_t outleft);
+
+static int decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_utf16be (gunichar c, char *outbuf, size_t outleft);
+
+static int decode_utf16le (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_utf16le (gunichar c, char *outbuf, size_t outleft);
+
+static int decode_utf8 (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_utf8 (gunichar c, char *outbuf, size_t outleft);
+
+static int decode_latin1 (char *inbuf, size_t inleft, gunichar *outchar);
+static int encode_latin1 (gunichar c, char *outbuf, size_t outleft);

 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
 #define decode_utf32 decode_utf32le
@@ -189,18 +189,19 @@
 		goto encode;

 	while (inleft > 0) {
-		if (cd->decode (&inptr, &inleft, &c) == -1) {
-			rc = -1;
+		if ((rc = cd->decode (inptr, inleft, &c)) == -1)
 			break;
-		}
+
+		inleft -= rc;
+		inptr += rc;

 	encode:
-		if (cd->encode (c, &outptr, &outleft) == -1) {
-			rc = -1;
+		if ((rc = cd->encode (c, outptr, outleft)) == -1)
 			break;
-		}

 		c = (gunichar) -1;
+		outleft -= rc;
+		outptr += rc;
 	}

 	if (inbytesleft)
@@ -221,10 +222,9 @@
  */

 static int
-decode_utf32be (char **inbytes, size_t *inbytesleft, gunichar *outchar)
-{
-	gunichar *inptr = (gunichar *) *inbytes;
-	size_t inleft = *inbytesleft;
+decode_utf32be (char *inbuf, size_t inleft, gunichar *outchar)
+{
+	gunichar *inptr = (gunichar *) inbuf;
 	gunichar c;

 	if (inleft < 4) {
@@ -233,26 +233,21 @@
 	}

 	c = GUINT32_FROM_BE (*inptr);
-	inleft -= 4;
-	inptr++;

 	if (c >= 2147483648UL) {
 		errno = EILSEQ;
 		return -1;
 	}

-	*inbytes = (char *) inptr;
-	*inbytesleft = inleft;
 	*outchar = c;

-	return 0;
-}
-
-static int
-decode_utf32le (char **inbytes, size_t *inbytesleft, gunichar *outchar)
-{
-	gunichar *inptr = (gunichar *) *inbytes;
-	size_t inleft = *inbytesleft;
+	return 4;
+}
+
+static int
+decode_utf32le (char *inbuf, size_t inleft, gunichar *outchar)
+{
+	gunichar *inptr = (gunichar *) inbuf;
 	gunichar c;

 	if (inleft < 4) {
@@ -261,66 +256,51 @@
 	}

 	c = GUINT32_FROM_LE (*inptr);
-	inleft -= 4;
-	inptr++;

 	if (c >= 2147483648UL) {
 		errno = EILSEQ;
 		return -1;
 	}

-	*inbytes = (char *) inptr;
-	*inbytesleft = inleft;
 	*outchar = c;

-	return 0;
-}
-
-static int
-encode_utf32be (gunichar c, char **outbytes, size_t *outbytesleft)
-{
-	gunichar *outptr = (gunichar *) *outbytes;
-	size_t outleft = *outbytesleft;
+	return 4;
+}
+
+static int
+encode_utf32be (gunichar c, char *outbuf, size_t outleft)
+{
+	gunichar *outptr = (gunichar *) outbuf;

 	if (outleft < 4) {
 		errno = E2BIG;
 		return -1;
 	}

-	*outptr++ = GUINT32_TO_BE (c);
-	outleft -= 4;
-
-	*outbytes = (char *) outptr;
-	*outbytesleft = outleft;
-
-	return 0;
-}
-
-static int
-encode_utf32le (gunichar c, char **outbytes, size_t *outbytesleft)
-{
-	gunichar *outptr = (gunichar *) *outbytes;
-	size_t outleft = *outbytesleft;
+	*outptr = GUINT32_TO_BE (c);
+
+	return 4;
+}
+
+static int
+encode_utf32le (gunichar c, char *outbuf, size_t outleft)
+{
+	gunichar *outptr = (gunichar *) outbuf;

 	if (outleft < 4) {
 		errno = E2BIG;
 		return -1;
 	}

-	*outptr++ = GUINT32_TO_LE (c);
-	outleft -= 4;
-
-	*outbytes = (char *) outptr;
-	*outbytesleft = outleft;
-
-	return 0;
-}
-
-static int
-decode_utf16be (char **inbytes, size_t *inbytesleft, gunichar *outchar)
-{
-	gunichar2 *inptr = (gunichar2 *) *inbytes;
-	size_t inleft = *inbytesleft;
+	*outptr = GUINT32_TO_LE (c);
+
+	return 4;
+}
+
+static int
+decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar)
+{
+	gunichar2 *inptr = (gunichar2 *) inbuf;
 	gunichar2 c;
 	gunichar u;

@@ -330,21 +310,19 @@
 	}

 	u = GUINT16_FROM_BE (*inptr);
-	inleft -= 2;
-	inptr++;

 	if (u < 0xd800) {
 		/* 0x0000 -> 0xd7ff */
+		*outchar = u;
+		return 2;
 	} else if (u < 0xdc00) {
 		/* 0xd800 -> 0xdbff */
-		if (inleft < 2) {
+		if (inleft < 4) {
 			errno = EINVAL;
 			return -1;
 		}

-		c = GUINT16_FROM_BE (*inptr);
-		inleft -= 2;
-		inptr++;
+		c = GUINT16_FROM_BE (inptr[1]);

 		if (c < 0xdc00 || c > 0xdfff) {
 			errno = EILSEQ;
@@ -352,26 +330,24 @@
 		}

 		u = ((u - 0xd800) << 10) + (c - 0xdc00) + 0x0010000UL;
+		*outchar = u;
+
+		return 4;
 	} else if (u < 0xe000) {
 		/* 0xdc00 -> 0xdfff */
 		errno = EILSEQ;
 		return -1;
 	} else {
 		/* 0xe000 -> 0xffff */
-	}
-
-	*inbytes = (char *) inptr;
-	*inbytesleft = inleft;
-	*outchar = u;
-
-	return 0;
-}
-
-static int
-decode_utf16le (char **inbytes, size_t *inbytesleft, gunichar *outchar)
-{
-	gunichar2 *inptr = (gunichar2 *) *inbytes;
-	size_t inleft = *inbytesleft;
+		*outchar = u;
+		return 2;
+	}
+}
+
+static int
+decode_utf16le (char *inbuf, size_t inleft, gunichar *outchar)
+{
+	gunichar2 *inptr = (gunichar2 *) inbuf;
 	gunichar2 c;
 	gunichar u;

@@ -381,21 +357,19 @@
 	}

 	u = GUINT16_FROM_LE (*inptr);
-	inleft -= 2;
-	inptr++;

 	if (u < 0xd800) {
 		/* 0x0000 -> 0xd7ff */
+		*outchar = u;
+		return 2;
 	} else if (u < 0xdc00) {
 		/* 0xd800 -> 0xdbff */
-		if (inleft < 2) {
+		if (inleft < 4) {
 			errno = EINVAL;
 			return -1;
 		}

-		c = GUINT16_FROM_LE (*inptr);
-		inleft -= 2;
-		inptr++;
+		c = GUINT16_FROM_LE (inptr[1]);

 		if (c < 0xdc00 || c > 0xdfff) {
 			errno = EILSEQ;
@@ -403,26 +377,24 @@
 		}

 		u = ((u - 0xd800) << 10) + (c - 0xdc00) + 0x0010000UL;
+		*outchar = u;
+
+		return 4;
 	} else if (u < 0xe000) {
 		/* 0xdc00 -> 0xdfff */
 		errno = EILSEQ;
 		return -1;
 	} else {
 		/* 0xe000 -> 0xffff */
-	}
-
-	*inbytes = (char *) inptr;
-	*inbytesleft = inleft;
-	*outchar = u;
-
-	return 0;
-}
-
-static int
-encode_utf16be (gunichar c, char **outbytes, size_t *outbytesleft)
-{
-	gunichar2 *outptr = (gunichar2 *) *outbytes;
-	size_t outleft = *outbytesleft;
+		*outchar = u;
+		return 2;
+	}
+}
+
+static int
+encode_utf16be (gunichar c, char *outbuf, size_t outleft)
+{
+	gunichar2 *outptr = (gunichar2 *) outbuf;
 	gunichar2 ch;
 	gunichar c2;

@@ -434,8 +406,9 @@
 	if (c <= 0xffff && (c < 0xd800 || c > 0xdfff)) {
 		ch = (gunichar2) c;

-		*outptr++ = GUINT16_TO_BE (ch);
-		outleft -= 2;
+		*outptr = GUINT16_TO_BE (ch);
+
+		return 2;
 	} else if (outleft < 4) {
 		errno = E2BIG;
 		return -1;
@@ -443,25 +416,19 @@
 		c2 = c - 0x10000;

 		ch = (gunichar2) ((c2 >> 10) + 0xd800);
-		*outptr++ = GUINT16_TO_BE (ch);
+		outptr[0] = GUINT16_TO_BE (ch);

 		ch = (gunichar2) ((c2 & 0x3ff) + 0xdc00);
-		*outptr++ = GUINT16_TO_BE (ch);
-
-		outleft -= 4;
-	}
-
-	*outbytes = (char *) outptr;
-	*outbytesleft = outleft;
-
-	return 0;
-}
-
-static int
-encode_utf16le (gunichar c, char **outbytes, size_t *outbytesleft)
-{
-	gunichar2 *outptr = (gunichar2 *) *outbytes;
-	size_t outleft = *outbytesleft;
+		outptr[1] = GUINT16_TO_BE (ch);
+
+		return 4;
+	}
+}
+
+static int
+encode_utf16le (gunichar c, char *outbuf, size_t outleft)
+{
+	gunichar2 *outptr = (gunichar2 *) outbuf;
 	gunichar2 ch;
 	gunichar c2;

@@ -474,7 +441,8 @@
 		ch = (gunichar2) c;

 		*outptr++ = GUINT16_TO_LE (ch);
-		outleft -= 2;
+
+		return 2;
 	} else if (outleft < 4) {
 		errno = E2BIG;
 		return -1;
@@ -482,36 +450,28 @@
 		c2 = c - 0x10000;

 		ch = (gunichar2) ((c2 >> 10) + 0xd800);
-		*outptr++ = GUINT16_TO_LE (ch);
+		outptr[0] = GUINT16_TO_LE (ch);

 		ch = (gunichar2) ((c2 & 0x3ff) + 0xdc00);
-		*outptr++ = GUINT16_TO_LE (ch);
-
-		outleft -= 4;
-	}
-
-	*outbytes = (char *) outptr;
-	*outbytesleft = outleft;
-
-	return 0;
-}
-
-static int
-decode_utf8 (char **inbytes, size_t *inbytesleft, gunichar *outchar)
-{
-	unsigned char *inptr = (unsigned char *) *inbytes;
-	size_t inleft = *inbytesleft;
+		outptr[1] = GUINT16_TO_LE (ch);
+
+		return 4;
+	}
+}
+
+static int
+decode_utf8 (char *inbuf, size_t inleft, gunichar *outchar)
+{
+	unsigned char *inptr = (unsigned char *) inbuf;
 	gunichar u;
-	size_t n;
+	int n;

 	u = *inptr++;

 	if (u < 0x80) {
 		/* simple ascii case */
-		*inbytesleft = inleft - 1;
-		*inbytes = (char *) inptr;
-		*outchar = u;
-		return 0;
+		*outchar = u;
+		return 1;
 	} else if (u < 0xc2) {
 		errno = EILSEQ;
 		return -1;
@@ -548,18 +508,15 @@
 	case 2: u = (u << 6) | (*inptr++ ^ 0x80);
 	}

-	*inbytesleft = inleft - n;
-	*inbytes = (char *) inptr;
 	*outchar = u;

-	return 0;
-}
-
-static int
-encode_utf8 (gunichar c, char **outbytes, size_t *outbytesleft)
-{
-	size_t outleft = *outbytesleft;
-	unsigned char *outptr;
+	return n;
+}
+
+static int
+encode_utf8 (gunichar c, char *outbuf, size_t outleft)
+{
+	unsigned char *outptr = (unsigned char *) outbuf;
 	int base, n;

 	if (c < 128UL) {
@@ -590,8 +547,6 @@
 		return -1;
 	}

-	outptr = (unsigned char *) *outbytes;
-
 	switch (n) {
 	case 6: outptr[5] = (c & 0x3f) | 0x80; c >>= 6;
 	case 5: outptr[4] = (c & 0x3f) | 0x80; c >>= 6;
@@ -601,33 +556,19 @@
 	case 1: outptr[0] = c | base;
 	}

-	*outbytes = (char *) outptr + n;
-	*outbytesleft = outleft - n;
-
-	return 0;
-}
-
-static int
-decode_latin1 (char **inbytes, size_t *inbytesleft, gunichar *outchar)
-{
-	size_t inleft = *inbytesleft;
-	char *inptr = *inbytes;
-	gunichar u;
-
-	u = (unsigned char) *inptr;
-	*inbytesleft = inleft - 1;
-	*inbytes = inptr + 1;
-	*outchar = u;
-
-	return 0;
-}
-
-static int
-encode_latin1 (gunichar c, char **outbytes, size_t *outbytesleft)
-{
-	size_t outleft = *outbytesleft;
-	char *outptr = *outbytes;
-
+	return n;
+}
+
+static int
+decode_latin1 (char *inbuf, size_t inleft, gunichar *outchar)
+{
+	*outchar = (unsigned char) *inbuf;
+	return 1;
+}
+
+static int
+encode_latin1 (gunichar c, char *outbuf, size_t outleft)
+{
 	if (outleft < 1) {
 		errno = E2BIG;
 		return -1;
@@ -638,11 +579,7 @@
 		return -1;
 	}

-	*outptr++ = (char) c;
-	outleft--;
-
-	*outbytesleft = outleft;
-	*outbytes = outptr;
-
-	return 0;
-}
+	*outbuf = (char) c;
+
+	return 1;
+}


Fixed the -i parser

Fixed the -i parser

--- src/gistit.c
+++ src/gistit.c
@@ -150,14 +150,19 @@

 		// Set the gist description
 		if ((strcmp(argv[i], "-d") == 0 || strcmp(argv[i], "--description") == 0) && argv[i + 1] != NULL) {
-			description = argv[i + 1];
-			i += 1;
+			description = argv[++i];
 			continue;
 		}

 		// Define the gist as private
 		if (strcmp(argv[i], "-priv") == 0) {
 			is_public = 0;
+			continue;
+		}
+
+		// Get the gist filename
+		if (strcmp(argv[i], "-i") == 0 && argv[i + 1] != NULL) {
+			fakename = argv[++i];
 			continue;
 		}

@@ -168,11 +173,6 @@
 			} else {
 				filelist_add(files, argv[i]);
 			}
-			continue;
-		}
-
-		if (strcmp(argv[i], "-i") == 0 && argv[i + 1] != NULL) {
-			fakename = argv[i + 1];
 			continue;
 		}


Corrected N_Ghoast_potential when not using CIC particles

--- src/global.h
+++ src/global.h
@@ -80,10 +80,21 @@

 #ifdef GRAVITY
 #ifdef GRAVITY_5_POINTS_GRADIENT
+#ifdef PARTICLES
 #define N_GHOST_POTENTIAL 3 // 3 ghost cells are needed for 5 point gradient, ( one is for the CIC interpolation of the potential )
 #else
-#define N_GHOST_POTENTIAL 2 // 2 ghost cells are needed for first order gradient, ( one is for the CIC interpolation of the potential )
-#endif
+#define N_GHOST_POTENTIAL 2 // 2 ghost cells are needed for 5 point gradient
+#endif //PARTICLES
+
+#else
+#ifdef PARTICLES
+#define N_GHOST_POTENTIAL 2 // 2 ghost cells are needed for 3 point gradient, ( one is for the CIC interpolation of the potential )
+#else
+#define N_GHOST_POTENTIAL 1 // 1 ghost cells are needed for 3 point gradient
+#endif //PARTICLES
+#endif //GRAVITY_5_POINTS_GRADIENT
+
+
 #ifdef GRAVITY_LONG_INTS
 typedef long int grav_int_t;
 #else


Typo: exlude → exclude

Typo: exlude → exclude

--- src/global.h
+++ src/global.h
@@ -46,7 +46,7 @@
 #define FF_FILE    0x02
 #define FF_ERR     0x04 /* error while reading this item */
 #define FF_OTHFS   0x08 /* excluded because it was another filesystem */
-#define FF_EXL     0x10 /* excluded using exlude patterns */
+#define FF_EXL     0x10 /* excluded using exclude patterns */
 #define FF_SERR    0x20 /* error in subdirectory */
 #define FF_HLNKC   0x40 /* hard link candidate (file with st_nlink > 1) */
 #define FF_BSEL    0x80 /* selected */


small edits

small edits

--- permutationalgs/perm.h
+++ permutationalgs/perm.h
@@ -23,8 +23,9 @@
 #include <vector>
 using namespace std;

-// Choices are 16, 25, or 31. All three choices work for avoidance
-// code.  However, third choice is much slower than the others.
+// Choices are 16, 25, or 31. However, third choice is much slower
+// than the others. In order to use any of the latter two choices, you
+// must have the boost libraries installed.
 #define MAXPERMSIZE 16

 // permutations up to size 16


increasing version for AVBitStreamFilters

git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@5645 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

--- libavcodec/avcodec.h
+++ libavcodec/avcodec.h
@@ -17,8 +17,8 @@
 #define AV_STRINGIFY(s)         AV_TOSTRING(s)
 #define AV_TOSTRING(s) #s

-#define LIBAVCODEC_VERSION_INT  ((51<<16)+(9<<8)+0)
-#define LIBAVCODEC_VERSION      51.9.0
+#define LIBAVCODEC_VERSION_INT  ((51<<16)+(10<<8)+0)
+#define LIBAVCODEC_VERSION      51.10.0
 #define LIBAVCODEC_BUILD        LIBAVCODEC_VERSION_INT

 #define LIBAVCODEC_IDENT        "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)


One variable less. No real change to the actual code.

git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@12234 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b


1/0 fix

1/0 fix

git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@7658 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

--- libavcodec/h263dec.c
+++ libavcodec/h263dec.c
@@ -729,7 +729,7 @@
     decode_slice(s);
     while(s->mb_y<s->mb_height){
         if(s->msmpeg4_version){
-            if(s->mb_x!=0 || (s->mb_y%s->slice_height)!=0 || get_bits_count(&s->gb) > s->gb.size_in_bits)
+            if(s->slice_height==0 || s->mb_x!=0 || (s->mb_y%s->slice_height)!=0 || get_bits_count(&s->gb) > s->gb.size_in_bits)
                 break;
         }else{
             if(ff_h263_resync(s)<0)