added GL_PROXY_TEXTURE_RECTANGLE_NV to is_proxy_target()

--- src/mesa/main/teximage.c
+++ src/mesa/main/teximage.c
@@ -1,5 +1,3 @@
-/* $Id: teximage.c,v 1.127 2003/04/01 16:41:53 brianp Exp $ */
-
 /*
  * Mesa 3-D graphics library
  * Version:  5.1
@@ -453,7 +451,8 @@
    return (target == GL_PROXY_TEXTURE_1D ||
            target == GL_PROXY_TEXTURE_2D ||
            target == GL_PROXY_TEXTURE_3D ||
-           target == GL_PROXY_TEXTURE_CUBE_MAP_ARB);
+           target == GL_PROXY_TEXTURE_CUBE_MAP_ARB ||
+           target == GL_PROXY_TEXTURE_RECTANGLE_NV);
 }


mesa: add _mesa_cube_face_target() helper

Reviewed-by: Roland Scheidegger <7d58aee419d6f9201d75517c885374dff5e7d848@vmware.com>
Reviewed-by: Timothy Arceri <5dd83789ef3714029244367ba1ca09f1d7627408@collabora.com>

--- src/mesa/main/teximage.h
+++ src/mesa/main/teximage.h
@@ -49,6 +49,23 @@

 /**
+ * If the target is GL_TEXTURE_CUBE_MAP, return one of the
+ * GL_TEXTURE_CUBE_MAP_POSITIVE/NEGATIVE_X/Y/Z targets corresponding to
+ * the face parameter.
+ * Else, return target as-is.
+ */
+static inline GLenum
+_mesa_cube_face_target(GLenum target, unsigned face)
+{
+   assert(face < 6);
+   if (target == GL_TEXTURE_CUBE_MAP)
+      return GL_TEXTURE_CUBE_MAP_POSITIVE_X + face;
+   else
+      return target;
+}
+
+
+/**
  * For cube map faces, return a face index in [0,5].
  * For other targets return 0;
  */


main: round floating-point value to nearest integer in glGetTexParameteriv()

Previously, a cast was done to convert from float to int but there
were rounding errors.

The spec specificies in Data Conversion chapter that Floating-point values are
rounded to the nearest integer.

This patch fixes the following 8 dEQP tests:

dEQP-GLES3.functional.state_query.texture.texture_2d_texture_min_lod_gettexparameteri
dEQP-GLES3.functional.state_query.texture.texture_2d_texture_max_lod_gettexparameteri
dEQP-GLES3.functional.state_query.texture.texture_3d_texture_min_lod_gettexparameteri
dEQP-GLES3.functional.state_query.texture.texture_3d_texture_max_lod_gettexparameteri
dEQP-GLES3.functional.state_query.texture.texture_2d_array_texture_min_lod_gettexparameteri
dEQP-GLES3.functional.state_query.texture.texture_2d_array_texture_max_lod_gettexparameteri
dEQP-GLES3.functional.state_query.texture.texture_cube_map_texture_min_lod_gettexparameteri
dEQP-GLES3.functional.state_query.texture.texture_cube_map_texture_max_lod_gettexparameteri

Signed-off-by: Samuel Iglesias Gonsalvez <b753b212f30aed827c3eea2e437609dc37310153@igalia.com>
Reviewed-by: Ian Romanick <2b237cafb16dc45038e85df6c85e74e6d899eba9@intel.com>

--- src/mesa/main/texparam.c
+++ src/mesa/main/texparam.c
@@ -1957,14 +1957,18 @@
       case GL_TEXTURE_MIN_LOD:
          if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
             goto invalid_pname;
-
-         *params = (GLint) obj->Sampler.MinLod;
+         /* GL spec 'Data Conversions' section specifies that floating-point
+          * value in integer Get function is rounded to nearest integer
+          */
+         *params = IROUND(obj->Sampler.MinLod);
          break;
       case GL_TEXTURE_MAX_LOD:
          if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
             goto invalid_pname;
-
-         *params = (GLint) obj->Sampler.MaxLod;
+         /* GL spec 'Data Conversions' section specifies that floating-point
+          * value in integer Get function is rounded to nearest integer
+          */
+         *params = IROUND(obj->Sampler.MaxLod);
          break;
       case GL_TEXTURE_BASE_LEVEL:
          if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
@@ -1978,7 +1982,10 @@
       case GL_TEXTURE_MAX_ANISOTROPY_EXT:
          if (!ctx->Extensions.EXT_texture_filter_anisotropic)
             goto invalid_pname;
-         *params = (GLint) obj->Sampler.MaxAnisotropy;
+         /* GL spec 'Data Conversions' section specifies that floating-point
+          * value in integer Get function is rounded to nearest integer
+          */
+         *params = IROUND(obj->Sampler.MaxAnisotropy);
          break;
       case GL_GENERATE_MIPMAP_SGIS:
          if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)


mesa: added GL3 query for GL_TEXTURE_SHARED_SIZE

--- src/mesa/main/texparam.c
+++ src/mesa/main/texparam.c
@@ -934,6 +934,18 @@
          if (ctx->Extensions.EXT_packed_depth_stencil ||
              ctx->Extensions.ARB_framebuffer_object) {
             *params = _mesa_get_format_bits(texFormat, pname);
+         }
+         else {
+            _mesa_error(ctx, GL_INVALID_ENUM,
+                        "glGetTexLevelParameter[if]v(pname)");
+         }
+         break;
+      case GL_TEXTURE_SHARED_SIZE:
+         if (ctx->VersionMajor >= 3) {
+            /* XXX return number of exponent bits for shared exponent texture
+             * formats, like GL_RGB9_E5.
+             */
+            *params = 0;
          }
          else {
             _mesa_error(ctx, GL_INVALID_ENUM,


mesa: Return the correct internal fmt when a generic compressed fmt was used

If an application requests a generic compressed format for a texture
and the driver does not pick a specific compressed format, return the
generic base format (e.g., GL_RGBA) for the GL_TEXTURE_INTERNAL_FORMAT
query.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=3165
Reviewed-by: Brian Paul <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@vmware.com>

--- src/mesa/main/texparam.c
+++ src/mesa/main/texparam.c
@@ -915,9 +915,23 @@
             *params = _mesa_compressed_format_to_glenum(ctx, texFormat);
          }
          else {
-            /* return the user's requested internal format */
-            *params = img->InternalFormat;
-         }
+	    /* If the true internal format is not compressed but the user
+	     * requested a generic compressed format, we have to return the
+	     * generic base format that matches.
+	     *
+	     * From page 119 (page 129 of the PDF) of the OpenGL 1.3 spec:
+	     *
+	     *     "If no specific compressed format is available,
+	     *     internalformat is instead replaced by the corresponding base
+	     *     internal format."
+	     *
+	     * Otherwise just return the user's requested internal format
+	     */
+	    const GLenum f =
+	       _mesa_gl_compressed_format_base_format(img->InternalFormat);
+
+	    *params = (f != 0) ? f : img->InternalFormat;
+	 }
          break;
       case GL_TEXTURE_BORDER:
          *params = img->Border;


fixed problems with texel component size queries in glGetTexLevelParameter()

--- src/mesa/main/texstate.c
+++ src/mesa/main/texstate.c
@@ -1,4 +1,4 @@
-/* $Id: texstate.c,v 1.46 2001/04/20 19:21:41 brianp Exp $ */
+/* $Id: texstate.c,v 1.47 2001/04/24 16:11:35 brianp Exp $ */

 /*
  * Mesa 3-D graphics library
@@ -1124,6 +1124,7 @@
    const struct gl_texture_image *img = NULL;
    GLuint dimensions;
    GLboolean isProxy;
+   GLenum baseIntFormat;
    ASSERT_OUTSIDE_BEGIN_END(ctx);

    if (level < 0 || level >= ctx->Const.MaxTextureLevels) {
@@ -1146,6 +1147,8 @@
          *params = 0;
       return;
    }
+
+   baseIntFormat = _mesa_base_tex_format(ctx, img->IntFormat);

    isProxy = (target == GL_PROXY_TEXTURE_1D) ||
              (target == GL_PROXY_TEXTURE_2D) ||
@@ -1169,25 +1172,56 @@
          *params = img->Border;
          return;
       case GL_TEXTURE_RED_SIZE:
-         *params = img->TexFormat->RedBits;
+         if (baseIntFormat == GL_RGB ||
+             baseIntFormat == GL_RGBA)
+            *params = img->TexFormat->RedBits;
+         else
+            *params = 0;
          return;
       case GL_TEXTURE_GREEN_SIZE:
-         *params = img->TexFormat->GreenBits;
+         if (baseIntFormat == GL_RGB ||
+             baseIntFormat == GL_RGBA)
+            *params = img->TexFormat->GreenBits;
+         else
+            *params = 0;
          return;
       case GL_TEXTURE_BLUE_SIZE:
-         *params = img->TexFormat->BlueBits;
+         if (baseIntFormat == GL_RGB ||
+             baseIntFormat == GL_RGBA)
+            *params = img->TexFormat->BlueBits;
+         else
+            *params = 0;
          return;
       case GL_TEXTURE_ALPHA_SIZE:
-         *params = img->TexFormat->AlphaBits;
+         if (baseIntFormat == GL_ALPHA ||
+             baseIntFormat == GL_LUMINANCE_ALPHA ||
+             baseIntFormat == GL_RGBA)
+            *params = img->TexFormat->AlphaBits;
+         else
+            *params = 0;
          return;
       case GL_TEXTURE_INTENSITY_SIZE:
-         *params = img->TexFormat->IntensityBits;
+         if (baseIntFormat != GL_INTENSITY)
+            *params = 0;
+         else if (img->TexFormat->IntensityBits > 0)
+            *params = img->TexFormat->IntensityBits;
+         else /* intensity probably stored as rgb texture */
+            *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
          return;
       case GL_TEXTURE_LUMINANCE_SIZE:
-         *params = img->TexFormat->LuminanceBits;
+         if (baseIntFormat != GL_LUMINANCE &&
+             baseIntFormat != GL_LUMINANCE_ALPHA)
+            *params = 0;
+         else if (img->TexFormat->LuminanceBits > 0)
+            *params = img->TexFormat->LuminanceBits;
+         else /* luminance probably stored as rgb texture */
+            *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
          return;
       case GL_TEXTURE_INDEX_SIZE_EXT:
-         *params = img->TexFormat->IndexBits;
+         if (baseIntFormat == GL_COLOR_INDEX)
+            *params = img->TexFormat->IndexBits;
+         else
+            *params = 0;
          return;
       case GL_DEPTH_BITS:
          /* XXX this isn't in the GL_SGIX_depth_texture spec


mesa: move assertion after declarations in texstore.c

To fix MSVC build.

--- src/mesa/main/texstore.c
+++ src/mesa/main/texstore.c
@@ -729,9 +729,9 @@
       GLint swapSize = _mesa_sizeof_packed_type(srcType);
       if (swapSize == 2 || swapSize == 4) {
          int bytesPerPixel = _mesa_bytes_per_pixel(srcFormat, srcType);
-         assert(bytesPerPixel % swapSize == 0);
          int swapsPerPixel = bytesPerPixel / swapSize;
          int elementCount = srcWidth * srcHeight * srcDepth;
+         assert(bytesPerPixel % swapSize == 0);
          tempImage = malloc(elementCount * bytesPerPixel);
          if (!tempImage)
             return GL_FALSE;


mesa: Allow srcFormat=GL_DEPTH_STENCIL in _mesa_texstore_xx_xx() functions

_mesa_texstore_z24_s8() and _mesa_texstore_z32f_x24s8() are capable of
handling GL_DEPTH_STENCIL format. So, allow it in both the functions.

Cc: <59f39c0db42d4479a46b02d4d2bc11120e37bb44@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <e2026475996c48f0b97fd37e84129b3912980428@gmail.com>
Reviewed-by: Ian Romanick <2b237cafb16dc45038e85df6c85e74e6d899eba9@intel.com>

--- src/mesa/main/texstore.c
+++ src/mesa/main/texstore.c
@@ -2483,7 +2483,8 @@
           srcType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);

    if (srcFormat == GL_DEPTH_COMPONENT ||
-       srcFormat == GL_STENCIL_INDEX) {
+       srcFormat == GL_STENCIL_INDEX ||
+       srcFormat == GL_DEPTH_STENCIL) {
       GLuint *depth = malloc(srcWidth * sizeof(GLuint));
       GLubyte *stencil = malloc(srcWidth * sizeof(GLubyte));

@@ -3429,7 +3430,8 @@
           srcType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV);

    if (srcFormat == GL_DEPTH_COMPONENT ||
-       srcFormat == GL_STENCIL_INDEX) {
+       srcFormat == GL_STENCIL_INDEX ||
+       srcFormat == GL_DEPTH_STENCIL) {
       GLint img, row;
       const GLint srcRowStride
          = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType)


Temporary workaround for SQLite provider.

--- src/midgard_core_query.c
+++ src/midgard_core_query.c
@@ -1461,12 +1461,14 @@
 	GError *error = NULL;
 	if (!gda_connection_update_meta_store (mgd->priv->connection, &mcontext, &error)) {
 		gda_value_free (mcontext.column_values[0]);
-		g_warning("Failed to update meta data for table '%s': %s", mdc->table_name,
+		/* FIXME, there should be warning, but for some reason
+		 * either SQLite or gda-sqlite provider is buggy */
+		g_debug ("Failed to update meta data for table '%s': %s", mdc->table_name,
 				error && error->message ? error->message : "No detail");
 		if (error)
 			g_error_free(error);

-		return TRUE;
+		return FALSE;
 	}

 	GdaDataModel *dm_schema =
@@ -1666,8 +1668,10 @@
 		gda_server_provider_perform_operation (server, cnc, op, &error);

 	if(!created) {
-
-		g_warning("Can not add %s column to table '%s'. %s",
+
+		/* FIXME, there should be warning, but for some reason
+		 * either SQLite or gda-sqlite provider is buggy */
+		g_debug ("Can not add %s column to table '%s'. %s",
 				column_name, table_name, error->message);
 		g_clear_error(&error);
 		g_object_unref(op);


fix missing include in posix_madvise.c (compile error)

--- src/mman/posix_madvise.c
+++ src/mman/posix_madvise.c
@@ -1,5 +1,6 @@
 #define _GNU_SOURCE
 #include <sys/mman.h>
+#include "syscall.h"

 int posix_madvise(void *addr, size_t len, int advice)
 {


lumas/luma.c: check lower bounds on input

Upper bounds are not checked yet but maybe should be.
Partially fixes these Coverity findings:

CID 709423: Untrusted value as argument (TAINTED_SCALAR) [select defect]
370                        this.w = atoi( argv[ ++ arg ] );
371                else if ( !strcmp( argv[ arg ], "-h" ) )
CID 709423: Untrusted value as argument (TAINTED_SCALAR) [select defect]
372                        this.h = atoi( argv[ ++ arg ] );
373                else if ( !strcmp( argv[ arg ], "-bands" ) )
CID 709423: Untrusted value as argument (TAINTED_SCALAR) [select defect]
374                        this.bands = atoi( argv[ ++ arg ] );

--- src/modules/lumas/luma.c
+++ src/modules/lumas/luma.c
@@ -367,11 +367,31 @@
 		else if ( !strcmp( argv[ arg ], "-type" ) )
 			this.type = atoi( argv[ ++ arg ] );
 		else if ( !strcmp( argv[ arg ], "-w" ) )
-			this.w = atoi( argv[ ++ arg ] );
+		{
+			int tmp = atoi( argv[ ++ arg ] );
+			// TODO: is there an upper bound?
+			if ( tmp )
+				this.w = tmp;
+			else
+				return 1;
+		}
 		else if ( !strcmp( argv[ arg ], "-h" ) )
-			this.h = atoi( argv[ ++ arg ] );
+		{
+			int tmp = atoi( argv[ ++ arg ] );
+			// TODO: is there an upper bound?
+			if ( tmp )
+				this.h = tmp;
+			else return 1;
+		}
 		else if ( !strcmp( argv[ arg ], "-bands" ) )
-			this.bands = atoi( argv[ ++ arg ] );
+		{
+			int tmp = atoi( argv[ ++ arg ] );
+			// TODO: is there an upper bound?
+			if ( tmp >= 0 )
+				this.bands = tmp;
+			else
+				return 1;
+		}
 		else if ( !strcmp( argv[ arg ], "-rband" ) )
 			this.rband = atoi( argv[ ++ arg ] );
 		else if ( !strcmp( argv[ arg ], "-hmirror" ) )


Register the lightshow metadata.

Register the lightshow metadata.

--- src/modules/qt/factory.c
+++ src/modules/qt/factory.c
@@ -55,6 +55,9 @@
 	MLT_REGISTER( filter_type, "lightshow", filter_lightshow_init );
 #endif
 	MLT_REGISTER_METADATA( filter_type, "audiowaveform", metadata, "filter_audiowaveform.yml" );
+#ifdef USE_FFTW
+	MLT_REGISTER_METADATA( filter_type, "lightshow", metadata, "filter_lightshow.yml" );
+#endif
 	MLT_REGISTER_METADATA( producer_type, "qimage", metadata, "producer_qimage.yml" );
 	MLT_REGISTER_METADATA( producer_type, "qtext", metadata, "producer_qtext.yml" );
 	MLT_REGISTER_METADATA( producer_type, "kdenlivetitle", metadata, "producer_kdenlivetitle.yml" );


Update reactor->timeout_msec when new timer.

--- src/network/EventTimer.c
+++ src/network/EventTimer.c
@@ -71,9 +71,16 @@
     {
         return SW_ERR;
     }
+
     node->data = data;
     node->exec_msec = now_msec + _msec;
     node->interval = interval ? _msec : 0;
+
+    if (SwooleG.main_reactor->timeout_msec > _msec)
+    {
+        SwooleG.main_reactor->timeout_msec = _msec;
+    }
+
     swTimer_node_insert(&timer->root, node);
     return SW_OK;
 }


write checksums

write checksums

--- src/non_local_operator.h
+++ src/non_local_operator.h
@@ -313,6 +313,11 @@
                 }
             }

+            if (ctx__.control().print_checksum_ && ctx__.comm().rank() == 0) {
+                auto cs = this->op_.checksum();
+                print_checksum("D_operator", cs);
+            }
+
             if (this->pu_ == GPU) {
                 this->op_.allocate(memory_t::device);
                 this->op_.template copy<memory_t::host, memory_t::device>();
@@ -347,6 +352,12 @@
                     }
                 }
             }
+
+            if (ctx__.control().print_checksum_ && ctx__.comm().rank() == 0) {
+                auto cs = this->op_.checksum();
+                print_checksum("Q_operator", cs);
+            }
+
             if (this->pu_ == GPU) {
                 this->op_.allocate(memory_t::device);
                 this->op_.template copy<memory_t::host, memory_t::device>();


tiff: Use tile coordinates in cache key

tiff: Use tile coordinates in cache key

--- src/openslide-ops-tiff.c
+++ src/openslide-ops-tiff.c
@@ -380,12 +380,9 @@
   int64_t tw = l->tile_width;
   int64_t th = l->tile_height;

-  int64_t x = tile_x * tw;
-  int64_t y = tile_y * th;
-
   // cache
   struct _openslide_cache_entry *cache_entry;
-  uint32_t *tiledata = _openslide_cache_get(osr->cache, x, y, grid,
+  uint32_t *tiledata = _openslide_cache_get(osr->cache, tile_x, tile_y, grid,
                                             &cache_entry);
   if (!tiledata) {
     tiledata = g_slice_alloc(tw * th * 4);
@@ -395,7 +392,7 @@
     _openslide_tiff_clip_tile(osr, tiff, tiledata, tile_x, tile_y);

     // put it in the cache
-    _openslide_cache_put(osr->cache, x, y, grid,
+    _openslide_cache_put(osr->cache, tile_x, tile_y, grid,
 			 tiledata, tw * th * 4,
 			 &cache_entry);
   }


work around Tcl env behaviour that can cause a crash

git-svn-id: 620571fa9b4bd0cbce9a0cf901e91ef896adbf27@66579 d073be05-634f-4543-b044-5fe20cf6d1d6

--- src/pextlib1.0/Pextlib.c
+++ src/pextlib1.0/Pextlib.c
@@ -399,6 +399,10 @@
 #else
         clearenv();
 #endif
+        /* "If the entire env array is unset then Tcl will stop monitoring
+            env accesses and will not update environment variables."
+            - <http://www.tcl.tk/man/tcl8.4/TclCmd/tclvars.htm#M4> */
+        setenv("MACPORTS_DUMMY", "", 0);
     } else {
         (void) unsetenv(name);
     }


off-by-one in UmaskCmd

off-by-one in UmaskCmd

git-svn-id: 620571fa9b4bd0cbce9a0cf901e91ef896adbf27@68680 d073be05-634f-4543-b044-5fe20cf6d1d6

--- src/pextlib1.0/Pextlib.c
+++ src/pextlib1.0/Pextlib.c
@@ -275,7 +275,7 @@
 {
 	Tcl_Obj *tcl_result;
 	char *tcl_mask, *p;
-	const size_t stringlen = 4; /* 3 digits & \0 */
+	const size_t stringlen = 5; /* 4 digits & \0 */
 	int i;
 	mode_t *set;
 	mode_t newmode;
@@ -297,22 +297,17 @@

 	oldmode = umask(newmode);

-	tcl_mask = malloc(stringlen); /* 3 digits & \0 */
+	tcl_mask = calloc(1, stringlen); /* 4 digits & \0 */
 	if (!tcl_mask) {
 		return TCL_ERROR;
 	}

 	/* Totally gross and cool */
-	p = tcl_mask + stringlen;
-	*p = '\0';
+	p = tcl_mask + stringlen - 1;
 	for (i = stringlen - 1; i > 0; i--) {
 		p--;
 		*p = (oldmode & 7) + '0';
 		oldmode >>= 3;
-	}
-	if (*p != '0') {
-		p--;
-		*p = '0';
 	}

 	tcl_result = Tcl_NewStringObj(p, -1);


Exynos clock: SPI change priority in divider calibration to ensure that per-divider frequency limits are adhered to

--- src/plat/exynos5/clock.c
+++ src/plat/exynos5/clock.c
@@ -227,8 +227,8 @@
         return 0;
     }
     fin = clk_get_freq(clk->parent);
-    r = fin / 0xff / hz;
-    rpre = fin / (r + 1) / hz;
+    rpre = fin / 0xf / hz;
+    r = fin / (rpre + 1) / hz;
     exynos_cmu_set_div(_clk_regs, clkid, 1, r);
     exynos_cmu_set_div(_clk_regs, clkid + 2, 2, rpre);
     return clk_get_freq(clk);


bug fixed: ignore sigpipe, invalid port value and simple typo.

--- src/platform/linux/net.c
+++ src/platform/linux/net.c
@@ -21,9 +21,13 @@

 int mongo_write_socket( mongo *conn, const void *buf, int len ) {
     const char *cbuf = buf;
+    int flags = MSG_NOSIGNAL;
+
     while ( len ) {
-        int sent = send( conn->sock, cbuf, len, 0 );
+        int sent = send( conn->sock, cbuf, len, flags );
         if ( sent == -1 ) {
+            if (errno == EPIPE)
+                conn->connected = 0;
             conn->err = MONGO_IO_ERROR;
             return MONGO_ERROR;
         }
@@ -116,6 +120,7 @@

     conn->sock = 0;
     conn->connected = 0;
+    sprintf(port_str,"%d",port);

     memset( &hints, 0, sizeof( hints ) );
     hints.ai_family = AF_INET;
@@ -134,7 +139,7 @@
         mongo_close_socket( conn->sock );
         freeaddrinfo( addrs );
         conn->err = MONGO_CONN_FAIL;
-        return MONGO_ERROR:
+        return MONGO_ERROR;
     }

     setsockopt( conn->sock, IPPROTO_TCP, TCP_NODELAY, ( char * )&flag, sizeof( flag ) );


rdma: fix buggy cqe parsing (truncated packets)

Change-Id: I17228bd35cc7aa0d207a16502bf1376c75675302
Signed-off-by: Mohammed Hawari <e345ebb5fb15a590b29a075cdaf46eed42e192de@hawari.fr>
Type: fix

--- src/plugins/rdma/input.c
+++ src/plugins/rdma/input.c
@@ -973,9 +973,8 @@
 	  slow_path_needed =
 	    rdma_device_mlx5dv_legacy_rq_slow_path_needed (rxq->buf_sz,
 							   n_rx_packets, bc);
-	  n_rx_bytes =
-	    rdma_device_mlx5dv_fast_input (vm, rxq, bufs, mask, &bt, to_next,
-					   n_rx_packets, bc, ~1);
+	  n_rx_bytes = rdma_device_mlx5dv_fast_input (
+	    vm, rxq, bufs, mask, &bt, to_next, n_rx_packets, bc, ~0);

 	  /* If there are chained buffers, some of the head buffers have a current length
 	     higher than buf_sz: it needs to be fixed */


pre release ux rewrite plus bootstrap extract plus extractor qt util quazip - production test harness

error: pathspec 'src/qt/lockstatuslabel.h' did not match any file(s) known to git

--- src/qt/lockstatuslabel.h
+++ src/qt/lockstatuslabel.h
@@ -0,0 +1,24 @@
+#ifndef LOCKSTATUSLABEL_H
+#define LOCKSTATUSLABEL_H
+
+#include "clickablelabel.h"
+#include<QLabel>
+#include<QWidget>
+#include<Qt>
+
+class LockStatusLabel : public ClickableLabel
+{
+  Q_OBJECT
+  public:
+    explicit LockStatusLabel(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
+    ~LockStatusLabel();
+
+  signals:
+    void unlock(bool);
+
+  protected:
+    void mousePressEvent(QMouseEvent* e);
+
+};
+
+#endif


Clear will memory when allocating so pointers within it are NULL. This reduces the chance for problems with free() segfaulting if there are later problems such as a bad CONNECT packet.

--- src/read_handle_server.c
+++ src/read_handle_server.c
@@ -113,7 +113,7 @@
 	}

 	if(connect_flags & 0x04){
-		context->core.will = malloc(sizeof(struct mosquitto_message));
+		context->core.will = _mosquitto_calloc(1, sizeof(struct mosquitto_message));
 		if(!context->core.will) return MOSQ_ERR_NOMEM;
 		if(_mosquitto_read_string(&context->core.in_packet, &context->core.will->topic)) return 1;
 		if(_mosquitto_read_string(&context->core.in_packet, &will_message)) return 1;


s6-rc-update bugfix: correctly handle renamed pipes in the fdholder

--- src/s6-rc/s6-rc-update.c
+++ src/s6-rc/s6-rc-update.c
@@ -53,7 +53,9 @@
     newstate flags:
      1 -> is up (converted from old up)
      2 -> wanted up
+     4 -> is a bijective conversion target
      8 -> is a conversion target
+    16 -> changed names
     32 -> is up after closure (i.e. includes new deps)
  */

@@ -190,9 +192,14 @@
           strerr_diefu4x(6, "convert database: new service ", newdb->string + newdb->services[x].name, " is a target for more than one conversion, including old service ", olddb->string + olddb->services[i].name) ;
         newstate[x] |= 8 ;
         invimage[x] = i ;
+        if (oldstate[i] & 16) newstate[x] |= 16 ;
         bitarray_set(conversion_table + i * bitarray_div8(newn), x) ;
-        if (oldstate[i] & 8 && (i < olddb->nlong) != (x < newdb->nlong))
-          oldstate[i] |= 4 ;
+        if (oldstate[i] & 8)
+        {
+          newstate[x] |= 4 ;
+          if ((i < olddb->nlong) != (x < newdb->nlong))
+            oldstate[i] |= 4 ;
+        }
       }
     }
   }
@@ -234,7 +241,7 @@
       else oldstate[i] &= 221 ;
     }
     s6rc_graph_closure(olddb, oldstate, 5, 0) ;
-    i = newn ; while (i--) newstate[i] &= 8 ;
+    i = newn ; while (i--) newstate[i] &= 28 ;
     i = oldn ;
     while (i--) if (oldstate[i] & 1)
     {
@@ -320,7 +327,6 @@
   llen = sa->len ;
   if (!random_sauniquename(sa, 8) || !stralloc_0(sa)) dienomem() ;
   newlen = --sa->len ;
-  rm_rf(sa->s + sabase) ;
   if (mkdir(sa->s + sabase, 0755) < 0) strerr_diefu2sys(111, "mkdir ", sa->s + sabase) ;
   {
     unsigned int tmplen = satmp.len ;
@@ -419,13 +425,13 @@
 }

- /* Pipe updates */
-
-static inline int delete_old_pipes (s6_fdholder_t *a, s6rc_db_t const *olddb, unsigned char const *oldstate, tain_t const *deadline)
+ /* Updating the pipes contained in the fdholder */
+
+static inline int delete_unused_pipes (s6_fdholder_t *a, s6rc_db_t const *olddb, unsigned char const *oldstate, tain_t const *deadline)
 {
   unsigned int i = olddb->nlong ;
   while (i--)
-    if (!(oldstate[i] & 32) && oldstate[i] & 16
+    if (!(oldstate[i] & 8)
      && olddb->services[i].x.longrun.pipeline[0] < olddb->nlong)
     {
       unsigned int len = str_len(olddb->string + olddb->services[i].name) ;
@@ -439,38 +445,86 @@
   return 1 ;
 }

-static inline int create_new_pipes (s6_fdholder_t *a, s6rc_db_t const *newdb, unsigned char const *newstate, tain_t const *deadline)
+static inline int rename_pipes (s6_fdholder_t *a, s6rc_db_t const *olddb, s6rc_db_t const *newdb, unsigned char const *newstate, unsigned int const *invimage, tain_t const *deadline)
 {
   tain_t nano1 = { .sec = TAI_ZERO, .nano = 1 } ;
   tain_t limit ;
   tain_add_g(&limit, &tain_infinite_relative) ;
   unsigned int i = newdb->nlong ;
   while (i--)
-    if (newstate[i] & 4 && newdb->services[i].x.longrun.pipeline[0] < newdb->nlong)
+  {
+    if ((newstate[i] & 20) == 20 && newdb->services[i].x.longrun.pipeline[0] < newdb->nlong)
+    {
+      int fd ;
+      unsigned int oldlen = str_len(olddb->string + olddb->services[invimage[i]].name) ;
+      unsigned int newlen = str_len(newdb->string + newdb->services[i].name) ;
+      char oldpipename[oldlen + 13] ;
+      char newpipename[newlen + 13] ;
+      byte_copy(oldpipename, 12, "pipe:s6rc-r-") ;
+      byte_copy(oldpipename + 12, oldlen + 1, olddb->string + olddb->services[invimage[i]].name) ;
+      byte_copy(newpipename, 12, "pipe:s6rc-r-") ;
+      byte_copy(newpipename + 12, newlen + 1, newdb->string + newdb->services[i].name) ;
+      fd = s6_fdholder_retrieve_delete_g(a, oldpipename, deadline) ;
+      if (fd < 0) return 0 ;
+      if (!s6_fdholder_store_g(a, fd, newpipename, &limit, deadline))
+      {
+        close(fd) ;
+        return 0 ;
+      }
+      close(fd) ;
+      tain_add(&limit, &limit, &nano1) ;
+      oldpipename[10] = 'w' ;
+      newpipename[10] = 'w' ;
+      fd = s6_fdholder_retrieve_delete_g(a, oldpipename, deadline) ;
+      if (fd < 0) return 0 ;
+      if (!s6_fdholder_store_g(a, fd, newpipename, &limit, deadline))
+      {
+        close(fd) ;
+        return 0 ;
+      }
+      close(fd) ;
+      tain_add(&limit, &limit, &nano1) ;
+    }
+  }
+  return 1 ;
+}
+
+static inline int create_new_pipes (s6_fdholder_t *a, s6rc_db_t const *newdb, unsigned char const *newstate, tain_t const *deadline)
+{
+  tain_t nano1 = { .sec = TAI_ZERO, .nano = newdb->nlong % 1000000000U } ;
+  tain_t limit ;
+  unsigned int i = newdb->nlong ;
+  tain_add_g(&limit, &tain_infinite_relative) ;
+  tain_add(&limit, &limit, &nano1) ;
+  nano1.nano = 1 ;
+  while (i--)
+  {
+    if (!(newstate[i] & 4) && newdb->services[i].x.longrun.pipeline[0] < newdb->nlong)
     {
       int p[2] ;
       unsigned int len = str_len(newdb->string + newdb->services[i].name) ;
       char pipename[len + 13] ;
-      byte_copy(pipename, 12, "pipe:s6rc-w-") ;
+      byte_copy(pipename, 12, "pipe:s6rc-r-") ;
       byte_copy(pipename + 12, len + 1, newdb->string + newdb->services[i].name) ;
       if (pipe(p) < 0) return 0 ;
+      if (!s6_fdholder_store_g(a, p[0], pipename, &limit, deadline))
+      {
+        close(p[0]) ;
+        close(p[1]) ;
+        return 0 ;
+      }
+      close(p[0]) ;
       tain_add(&limit, &limit, &nano1) ;
+      pipename[10] = 'w' ;
       if (!s6_fdholder_store_g(a, p[1], pipename, &limit, deadline))
       {
         close(p[1]) ;
-        close(p[0]) ;
         return 0 ;
       }
       close(p[1]) ;
-      pipename[10] = 'r' ;
       tain_add(&limit, &limit, &nano1) ;
-      if (!s6_fdholder_store_g(a, p[0], pipename, &limit, deadline))
-      {
-        close(p[0]) ;
-        return 0 ;
-      }
-      close(p[0]) ;
-    }
+    }
+  }
   return 1 ;
 }

@@ -485,7 +539,7 @@
   tfmt[uint_fmt(tfmt, t)] = 0 ;
 }

-static void update_fdholder (s6rc_db_t const *olddb, unsigned char const *oldstate, s6rc_db_t const *newdb, unsigned char const *newstate, char const *const *envp, tain_t const *deadline)
+static inline void update_fdholder (s6rc_db_t const *olddb, unsigned char const *oldstate, s6rc_db_t const *newdb, unsigned char const *newstate, unsigned int const *invimage, char const *const *envp, tain_t const *deadline)
 {
   int fdsocket ;
   s6_fdholder_t a = S6_FDHOLDER_ZERO ;
@@ -501,7 +555,8 @@
     else goto closehammer ;
   }
   s6_fdholder_init(&a, fdsocket) ;
-  if (!delete_old_pipes(&a, olddb, oldstate, deadline)) goto freehammer ;
+  if (!delete_unused_pipes(&a, olddb, oldstate, deadline)) goto freehammer ;
+  if (!rename_pipes(&a, olddb, newdb, newstate, invimage, deadline)) goto freehammer ;
   if (!create_new_pipes(&a, newdb, newstate, deadline)) goto freehammer ;
   s6_fdholder_free(&a) ;
   close(fdsocket) ;
@@ -517,7 +572,7 @@
     pid_t pid ;
     int wstat ;
     char tfmt[UINT_FMT] ;
-    char const *newargv[7] = { S6_EXTBINPREFIX "s6-svc", "-T", tfmt, "-t", "--", fnsocket, 0 } ;
+    char const *newargv[7] = { S6_EXTBINPREFIX "s6-svc", "-T", tfmt, "-twR", "--", fnsocket, 0 } ;
     fill_tfmt(tfmt, deadline) ;
     fnsocket[livelen + sizeof("/servicedirs/" S6RC_FDHOLDER) - 1] = 0 ;
     pid = child_spawn0(newargv[0], newargv, envp) ;
@@ -525,7 +580,7 @@
     if (wait_pid(pid, &wstat) < 0) strerr_diefu1sys(111, "waitpid") ;
     tain_now_g() ;
     if (WIFSIGNALED(wstat) || WEXITSTATUS(wstat))
-      if (verbosity) strerr_warnw1x("restart s6rc-fdholder") ;
+      if (verbosity) strerr_warnwu1x("restart s6rc-fdholder") ;
     if (!tain_future(deadline)) strerr_dief1x(2, "timed out during s6rc-fdholder update") ;
   }
 }
@@ -728,7 +783,7 @@
         if (verbosity >= 2)
           strerr_warni1x("updating s6rc-fdholder pipe storage") ;

-        update_fdholder(&olddb, oldstate, &newdb, newstate, envp, &deadline) ;
+        update_fdholder(&olddb, oldstate, &newdb, newstate, invimage, envp, &deadline) ;
       }


Fixed property usage in file channel.

Fixed property usage in file channel.

20080718121656-8ed0e-c2a8e962f568aa10f7649e5df68511dadd29201c.gz

--- src/salut-file-channel.c
+++ src/salut-file-channel.c
@@ -120,7 +120,7 @@
   guint estimated_size;
   gchar *content_md5;
   gchar *description;
-  gpointer available_socket_types;
+  GHashTable *available_socket_types;
   guint transferred_bytes;

 };
@@ -205,7 +205,7 @@
         g_value_set_string (value, self->priv->description);
         break;
       case PROP_AVAILABLE_SOCKET_TYPES:
-        g_value_set_pointer (value, self->priv->available_socket_types);
+        g_value_set_boxed (value, self->priv->available_socket_types);
         break;
       case PROP_TRANSFERRED_BYTES:
         g_value_set_uint (value, self->priv->transferred_bytes);
@@ -263,12 +263,32 @@
         break;
       case PROP_DIRECTION:
       case PROP_CONTENT_TYPE:
+        /* This should not be writeable with the new request API */
+        self->priv->content_type = g_value_dup_string (value);
+        break;
       case PROP_FILENAME:
+        /* This should not be writeable with the new request API */
+        self->priv->filename = g_value_dup_string (value);
+        break;
       case PROP_SIZE:
+        /* This should not be writeable with the new request API */
+        self->priv->size = g_value_get_uint (value);
+        break;
       case PROP_ESTIMATED_SIZE:
+        /* This should not be writeable with the new request API */
+        self->priv->estimated_size = g_value_get_uint (value);
+        break;
       case PROP_CONTENT_MD5:
+        /* This should not be writeable with the new request API */
+        self->priv->content_md5 = g_value_dup_string (value);
+        break;
       case PROP_DESCRIPTION:
+        /* This should not be writeable with the new request API */
+        self->priv->description = g_value_dup_string (value);
+        break;
       case PROP_AVAILABLE_SOCKET_TYPES:
+        /* This should not be writeable with the new request API */
+        self->priv->available_socket_types = g_value_get_boxed (value);
         break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -308,6 +328,9 @@
   /* Connect to the bus */
   bus = tp_get_bus ();
   dbus_g_connection_register_g_object (bus, self->priv->object_path, obj);
+
+  /* Initialise the available socket types hash table*/
+  self->priv->available_socket_types = g_hash_table_new (g_int_hash, g_int_equal);

   return obj;
 }
@@ -428,7 +451,10 @@
       "gchar *content-type",
       "ContentType of the file",
       "",
-      G_PARAM_CONSTRUCT_ONLY |
+      /* TODO: change this to CONSTRUCT_ONLY when
+       * the new request API is used.
+       */
+      G_PARAM_CONSTRUCT |
       G_PARAM_READWRITE |
       G_PARAM_STATIC_NICK |
       G_PARAM_STATIC_BLURB);
@@ -439,7 +465,10 @@
       "gchar *filename",
       "Name of the file",
       "",
-      G_PARAM_CONSTRUCT_ONLY |
+      /* TODO: change this to CONSTRUCT_ONLY when
+       * the new request API is used.
+       */
+      G_PARAM_CONSTRUCT |
       G_PARAM_READWRITE |
       G_PARAM_STATIC_NICK |
       G_PARAM_STATIC_BLURB);
@@ -452,7 +481,10 @@
       0,
       G_MAXUINT,
       0,
-      G_PARAM_CONSTRUCT_ONLY |
+      /* TODO: change this to CONSTRUCT_ONLY when
+       * the new request API is used.
+       */
+      G_PARAM_CONSTRUCT |
       G_PARAM_READWRITE |
       G_PARAM_STATIC_NICK |
       G_PARAM_STATIC_BLURB);
@@ -465,7 +497,10 @@
       0,
       G_MAXUINT,
       0,
-      G_PARAM_CONSTRUCT_ONLY |
+      /* TODO: change this to CONSTRUCT_ONLY when
+       * the new request API is used.
+       */
+      G_PARAM_CONSTRUCT |
       G_PARAM_READWRITE |
       G_PARAM_STATIC_NICK |
       G_PARAM_STATIC_BLURB);
@@ -476,7 +511,10 @@
       "gchar *content-md5",
       "md5sum of the file contents",
       "",
-      G_PARAM_CONSTRUCT_ONLY |
+      /* TODO: change this to CONSTRUCT_ONLY when
+       * the new request API is used.
+       */
+      G_PARAM_CONSTRUCT |
       G_PARAM_READWRITE |
       G_PARAM_STATIC_NICK |
       G_PARAM_STATIC_BLURB);
@@ -487,17 +525,24 @@
       "gchar *description",
       "Description of the file",
       "",
-      G_PARAM_CONSTRUCT_ONLY |
+      /* TODO: change this to CONSTRUCT_ONLY when
+       * the new request API is used.
+       */
+      G_PARAM_CONSTRUCT |
       G_PARAM_READWRITE |
       G_PARAM_STATIC_NICK |
       G_PARAM_STATIC_BLURB);
   g_object_class_install_property (object_class, PROP_DESCRIPTION, param_spec);

-  param_spec = g_param_spec_pointer (
+  param_spec = g_param_spec_boxed (
       "available-socket-types",
       "SalutSupportedSocketMap available-socket-types",
       "Available socket types",
-      G_PARAM_CONSTRUCT_ONLY |
+      dbus_g_type_get_map ("GHashTable", G_TYPE_UINT, DBUS_TYPE_G_UINT_ARRAY),
+      /* TODO: change this to CONSTRUCT_ONLY when
+       * the new request API is used.
+       */
+      G_PARAM_CONSTRUCT |
       G_PARAM_READWRITE |
       G_PARAM_STATIC_NICK |
       G_PARAM_STATIC_BLURB);


Started setting properties on the channel when required.

20080717182633-8ed0e-be204cfaf33b754fe022aba7cae793b20063a3c9.gz

--- src/salut-file-channel.c
+++ src/salut-file-channel.c
@@ -668,9 +668,10 @@
                     SalutFileChannel *self)
 {
   guint id;
+  SalutFileChannelClass *class = SALUT_FILE_CHANNEL_CLASS (self);

   id = GPOINTER_TO_INT (g_hash_table_lookup (self->priv->name_to_id, ft->id));
-  /* TODO from mixin: set state */
+  g_object_set_data (G_OBJECT (class), "state", (gpointer) SALUT_FILE_TRANSFER_STATE_OPEN);

   g_signal_connect (ft, "finished", G_CALLBACK (ft_finished_cb), self);
 }
@@ -780,6 +781,19 @@
       GINT_TO_POINTER (id));
 }

+static void
+salut_file_channel_set_state (SalutSvcChannelTypeFile *iface,
+                              SalutFileTransferState state,
+                              SalutFileTransferStateChangeReason reason)
+{
+  SalutFileChannel *self = SALUT_FILE_CHANNEL (iface);
+  SalutFileChannelClass *klass = SALUT_FILE_CHANNEL_CLASS (self);
+
+  g_object_set_data (G_OBJECT (klass), "state", (gpointer) state);
+  salut_svc_channel_type_file_emit_file_transfer_state_changed (iface,
+      state, reason);
+}
+
 /**
  * salut_file_channel_accept_file
  *
@@ -809,8 +823,8 @@

   setup_local_socket (self);

-  salut_svc_channel_type_file_emit_file_transfer_state_changed (iface,
-        SALUT_FILE_TRANSFER_STATE_OPEN, SALUT_FILE_TRANSFER_STATE_CHANGE_REASON_NONE);
+  salut_file_channel_set_state (iface, SALUT_FILE_TRANSFER_STATE_OPEN,
+        SALUT_FILE_TRANSFER_STATE_CHANGE_REASON_NONE);

   g_value_init (out_address, G_TYPE_STRING);


shared/gatt-client: Remove stray line.

shared/gatt-client: Remove stray line.

Remove copy-paste artifact.

--- src/shared/gatt-client.h
+++ src/shared/gatt-client.h
@@ -36,7 +36,6 @@
 #define BT_GATT_CHRC_PROP_AUTH				0x40
 #define BT_GATT_CHRC_PROP_EXT_PROP			0x80

-/* Client Characteristic Configuration bit field */
 struct bt_gatt_client;

 struct bt_gatt_client *bt_gatt_client_new(struct bt_att *att, uint16_t mtu);


Fixed failed loading of audio buffers on failure.

Now it reports an error.

--- src/siege/audio/buffer.c
+++ src/siege/audio/buffer.c
@@ -206,13 +206,19 @@
     sgAudioBufferSetData(buffer, channels, format, frequency, data, datalen);
     free(data);

-lderr:
+end:
     if(stb)
         stb_vorbis_close(stb);
     if(buf)
         free(buf);
     return buffer;
-
+lderr:
+    if(buffer)
+    {
+        free(buffer);
+        buffer = NULL;
+        goto end;
+    }
 error:
     if(buffer)
         free(buffer);


Docu and spelling fix.

Docu and spelling fix.

svn path=/trunk/kdesupport/strigi/; revision=640083

--- src/streams/streambase.h
+++ src/streams/streambase.h
@@ -20,6 +20,7 @@
 #ifndef STREAMBASE_H
 #define STREAMBASE_H

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

 #define INT32MAX 0x7FFFFFFFL
@@ -62,6 +63,9 @@
      * If no error has occurred, an empty string is returned.
      **/
     const char* getError() const { return error.c_str(); }
+    /**
+     * @brief  Return the status of the stream.
+     **/
     StreamStatus getStatus() const { return status; }
     /**
      * @brief Get the current position in the stream.
@@ -102,7 +106,7 @@
        * @brief Repositions this stream to given requested position.
        * Reset is guaranteed to work after a successful call to read(),
        * when the new position is in the range of the data returned by read().
-       * This means that @p pos must lie between than the position
+       * This means that @p pos must lie between the the position
        * corresponding to the @p start parameter (x) of the @r read function
        * and the position corresponding to the last position in the returned
        * buffer (x + @p nread).


rewrote copying

rewrote copying

--- zahnrad.c
+++ zahnrad.c
@@ -192,14 +192,57 @@
  * ===============================================================
  */
 static void*
-zr_memcopy(void *dst, const void *src, zr_size size)
-{
-    zr_size i = 0;
-    char *d = (char*)dst;
-    const char *s = (const char*)src;
-    for (i = 0; i < size; ++i)
-        d[i] = s[i];
-    return dst;
+zr_memcopy(void *dst0, const void *src0, zr_size length)
+{
+    zr_ptr t;
+    typedef int word;
+    char *dst = dst0;
+    const char *src = src0;
+    if (length == 0 || dst == src)
+        goto done;
+
+    #define wsize sizeof(word)
+    #define wmask (wsize-1)
+    #define TLOOP(s) if (t) TLOOP1(s)
+    #define TLOOP1(s) do { s; } while (--t)
+
+    if ((unsigned long)dst < (unsigned long)src) {
+        t = (zr_ptr)src; /* only need low bits */
+        if ((t | (zr_ptr)dst) & wmask) {
+            if ((t ^ (zr_ptr)dst) & wmask || length < wsize)
+                t = length;
+            else
+                t = wsize - (t & wmask);
+            length -= t;
+            TLOOP1(*dst++ = *src++);
+        }
+        t = length / wsize;
+        TLOOP(*(word*)(void*)dst = *(const word*)(const void*)src; src += wsize; dst += wsize);
+        t = length & wmask;
+        TLOOP(*dst++ = *src++);
+    } else {
+        src += length;
+        dst += length;
+        t = (zr_ptr)src;
+        if ((t | (zr_ptr)dst) & wmask) {
+            if ((t ^ (zr_ptr)dst) & wmask || length <= wsize)
+                t = length;
+            else
+                t &= wmask;
+            length -= t;
+            TLOOP1(*--dst = *--src);
+        }
+        t = length / wsize;
+        TLOOP(src -= wsize; dst -= wsize; *(word*)(void*)dst = *(const word*)(const void*)src);
+        t = length & wmask;
+        TLOOP(*--dst = *--src);
+    }
+    #undef wsize
+    #undef wmask
+    #undef TLOOP
+    #undef TLOOP1
+done:
+    return (dst0);
 }

 static void


Get keys from class and check values

Get keys from class and check values

--- cimRsRequest.c
+++ cimRsRequest.c
@@ -48,6 +48,7 @@
   char* cn;
   char* meth; /* for class meth or inst meth */
   char* keyList;
+  CMPIArray *sortedKeyList;
   /* query stuff */
 } CimRsReq;

@@ -242,7 +243,6 @@

   return -1;
 }
-//MCS Start horrible try 2

 static void
 buildRSGetInstanceRequest(CimRequestContext *ctx, CimRsReq *rsReq, RequestHdr *reqHdr)
@@ -276,7 +276,6 @@
   //sreq->hdr.count = req->properties + 2;
   sreq->hdr.count = 0 + 2;

-  path = TrackedCMPIObjectPath(rsReq->ns, rsReq->cn, NULL);

 /*
   for (i = 0, m = req->instanceName.bindings.next; i < m; i++) {
@@ -292,9 +291,24 @@
 */
   //valp = getKeyValueTypePtr("string","Mike",NULL, &val, &type, rsReq->ns);
 //val.chars="Mike";
-char * keyval=strdup("Mike");
-
-CMAddKey(path, "name", keyval, CMPI_chars);
+  //char * keyval=strdup("Mike");
+  char * keyval,*keyname,*saveptr;
+  path = TrackedCMPIObjectPath(rsReq->ns, rsReq->cn, NULL);
+  keyval=strtok_r(rsReq->keyList," ",&saveptr);
+  for (i = 0; i < rsReq->sortedKeyList->ft->getSize(rsReq->sortedKeyList, NULL); i++)
+  {
+    keyname=CMGetCharPtr(rsReq->sortedKeyList->ft->getElementAt(rsReq->sortedKeyList, i, NULL).value.string);
+    printf("MCS key:%d %s\n", i,keyname);
+    if (keyval == NULL) {
+      printf("Missing key value for key %s\n",keyname);
+      // Need to abort or something, and should be an mlog call
+    } else {
+      CMAddKey(path, keyname, keyval, CMPI_chars);
+      keyval=strtok_r(NULL," ",&saveptr);
+    }
+  }
+
+
 printf("MCS path: %s\n",CMGetCharPtr(CMObjectPathToString(path,NULL)));

   sreq->objectPath = setObjectPathMsgSegment(path);
@@ -315,7 +329,6 @@

 printf("MCS done\n");
 }
-// End horrible try 2

 int getSortedKeys(CimRsReq *rsReq)
 {
@@ -338,12 +351,21 @@
   printf("MCS gc rc:%d %s\n",rc.rc,rc.msg);
   */
   CMPIConstClass *cc = getConstClass(rsReq->ns,rsReq->cn);
-  printf("MCS gcc\n");
   printf("MCS gcc %d\n",cc->refCount);
+  CMPIString * CCCN = cc->ft->getClassName(cc,NULL);
+  printf("MCS gcc %s\n",CCCN->ft->getCharPtr(CCCN,NULL));
   klist = cc->ft->getKeyList(cc);
-  printf("MCS gkl\n");
+  rsReq->sortedKeyList=klist;
   CMPICount kcount = klist->ft->getSize(klist, NULL);
   printf("MCS keycount:%u\n",kcount);
+  //CMPIData keyname=klist->ft->getElementAt(klist,0,NULL);
+  int i;
+  for (i = 0; i < klist->ft->getSize(klist, NULL); i++)
+  {
+    printf("MCS key:%d %s\n", i,CMGetCharPtr(klist->ft->getElementAt(klist, i, NULL).value.string));
+  }
+//OK Now need to actually sort them before sticking the request
+  rsReq->sortedKeyList=klist;

 }

@@ -385,7 +407,7 @@
   if (strcmp(ctx->verb,"GET") == 0) {
     if (req.scope == SCOPE_INSTANCE) {
       fprintf(stderr,"MCS is a gi\n");
-//    int rrc=getSortedKeys(&req);
+    int rrc=getSortedKeys(&req);
       buildRSGetInstanceRequest(ctx,&req,&reqHdr);
       fprintf(stderr,"MCS gotreq %s\n",reqHdr.className);
     }


gnrc/ipv6_auto_subnets: bail out early if adding prefix fails

--- sys/net/gnrc/routing/ipv6_auto_subnets/gnrc_ipv6_auto_subnets.c
+++ sys/net/gnrc/routing/ipv6_auto_subnets/gnrc_ipv6_auto_subnets.c
@@ -306,6 +306,10 @@
         /* configure subnet on downstream interface */
         idx = gnrc_netif_ipv6_add_prefix(downstream, &new_prefix, new_prefix_len,
                                          valid_ltime, pref_ltime);
+        if (idx < 0) {
+            DEBUG("auto_subnets: adding prefix to %u failed\n", downstream->pid);
+            continue;
+        }

         /* start advertising subnet */
         gnrc_ipv6_nib_change_rtr_adv_iface(downstream, true);
@@ -320,9 +324,7 @@
         }

         /* configure RPL root if applicable */
-        if (idx >= 0) {
-            gnrc_rpl_configure_root(downstream, &downstream->ipv6.addrs[idx]);
-        }
+        gnrc_rpl_configure_root(downstream, &downstream->ipv6.addrs[idx]);
     }

     /* immediately send an RA with RIO */


Import assert fix from mbed v3.

Import assert fix from mbed v3.

--- hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/libraries/util/nrf_assert.h
+++ hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/libraries/util/nrf_assert.h
@@ -1,9 +1,32 @@
 /*
- * Copyright (c) 2006 Nordic Semiconductor. All Rights Reserved.
+ * Copyright (c) Nordic Semiconductor ASA
+ * All rights reserved.
  *
- * The information contained herein is confidential property of Nordic Semiconductor. The use,
- * copying, transfer or disclosure of such information is prohibited except by express written
- * agreement with Nordic Semiconductor.
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above copyright notice, this
+ *   list of conditions and the following disclaimer in the documentation and/or
+ *   other materials provided with the distribution.
+ *
+ *   3. Neither the name of Nordic Semiconductor ASA nor the names of other
+ *   contributors to this software may be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  */

@@ -17,6 +40,10 @@
 #include <stdint.h>
 #include "nrf.h"
 #include "app_error.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif

 #if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER)

@@ -38,7 +65,7 @@
  */
 void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name);

-/*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */
+/*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */
 /*lint -emacro(774, ASSERT) */ /* Suppress "Boolean within 'if' always evaluates to True" */ \

 /** @brief Function for checking intended for production code.
@@ -53,8 +80,14 @@
     assert_nrf_callback((uint16_t)__LINE__, (uint8_t *)__FILE__);             \
 }
 #else
+#ifndef ASSERT
 #define ASSERT(expr) //!< Assert empty when disabled
 __WEAK void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name);
+#endif
 #endif /* defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) */

+#ifdef __cplusplus
+}
+#endif
+
 #endif /* NRF_ASSERT_H_ */


Safely initialize RTC on kinetis devices

When initializing the RTC on Kinetis devices, handle the case where
the time overflow interrupt is pending and the case where the time
alarm flag is pending. These flags persist across reset and if not
handled will cause a crash when powering up the low power ticker.

This problem manifested as a lp_ticker test failure on the K22F and
K64F on CI only when running a nightly. This problem has been present
but was made obvious by PR #4094 which configures all tickers to
interrupt at least every MBED_TICKER_INTERRUPT_TIMESTAMP_MAX_DELTA
(~31 minutes). This caused the RTC alarm to fire 31 minutes after the lp_ticker
or lp_timeout test and caused the next run of the lp_ticker test to
crash on boot.

--- targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/lp_ticker.c
+++ targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/lp_ticker.c
@@ -33,16 +33,26 @@

 static void rtc_isr(void)
 {
-    RTC_DisableInterrupts(RTC, kRTC_AlarmInterruptEnable);
-    RTC->TAR = 0; /* Write clears the IRQ flag */
+    uint32_t sr = RTC->SR;
+    if (sr & RTC_SR_TOF_MASK) {
+        // Reset RTC to 0 so it keeps counting
+        RTC_StopTimer(RTC);
+        RTC->TSR = 0;
+        RTC_StartTimer(RTC);
+    } else if (sr & RTC_SR_TAF_MASK) {
+        RTC_DisableInterrupts(RTC, kRTC_AlarmInterruptEnable);
+        RTC->TAR = 0; /* Write clears the IRQ flag */

-    /* Wait subsecond remainder if any */
-    if (lptmr_schedule) {
-        LPTMR_SetTimerPeriod(LPTMR0, lptmr_schedule);
-        LPTMR_EnableInterrupts(LPTMR0, kLPTMR_TimerInterruptEnable);
-        LPTMR_StartTimer(LPTMR0);
-    } else {
-        lp_ticker_irq_handler();
+        /* Wait subsecond remainder if any */
+        if (lptmr_schedule) {
+            LPTMR_SetTimerPeriod(LPTMR0, lptmr_schedule);
+            LPTMR_EnableInterrupts(LPTMR0, kLPTMR_TimerInterruptEnable);
+            LPTMR_StartTimer(LPTMR0);
+        } else {
+            lp_ticker_irq_handler();
+        }
+    } else if (sr & RTC_SR_TIF_MASK) {
+        RTC_DisableInterrupts(RTC, kRTC_TimeOverflowInterruptEnable);
     }
 }

@@ -73,6 +83,7 @@
         RTC_StartTimer(RTC);
     }

+    RTC->TAR = 0; /* Write clears the IRQ flag */
     NVIC_ClearPendingIRQ(RTC_IRQn);
     NVIC_SetVector(RTC_IRQn, (uint32_t)rtc_isr);
     NVIC_EnableIRQ(RTC_IRQn);


Test: Clamp job count

Test: Clamp job count

--- src/platform/test/cinema-main.c
+++ src/platform/test/cinema-main.c
@@ -210,6 +210,12 @@
 			break;
 		case 'j':
 			jobs = atoi(optarg);
+			if (jobs > MAX_JOBS) {
+				jobs = MAX_JOBS;
+			}
+			if (jobs < 1) {
+				jobs = 1;
+			}
 			break;
 		case 'n':
 			dryRun = true;


cblogctl get working with sqlite

cblogctl get working with sqlite

--- cli/cblogctl.c
+++ cli/cblogctl.c
@@ -66,7 +66,7 @@
 	sqlite3_initialize();
 	sqlite3_open(cblog_cdb, &sqlite);

-	if (sqlite3_prepare_v2(sqlite, "SELECT title, datetime(posts.date, 'unixepoch') as date, group_concat(tag, ',') as tags "
+	if (sqlite3_prepare_v2(sqlite, "SELECT title, datetime(posts.date, 'unixepoch') as date, group_concat(tag, ', ') as tags "
 	    "FROM posts, tags_posts, tags "
 	    "WHERE link=?1 and posts.id=tags_posts.post_id and tags_posts.tag_id=tags.id;", -1, &stmt, NULL) != SQLITE_OK)
 		errx(1, "%s", sqlite3_errmsg(sqlite));
@@ -96,46 +96,45 @@
 void
 cblogctl_get(const char *post_name)
 {
-	int			db;
-	FILE		*out;
-	char		key[BUFSIZ];
-	char		*val;
-	struct cdb	cdb;
-
-	if ((db = open(cblog_cdb, O_RDONLY)) < 0)
-		err(1, "%s", cblog_cdb);
-	cdb_init(&cdb, db);
+	sqlite3 *sqlite;
+	sqlite3_stmt *stmt;
+	int icol;
+	FILE *out;
+
+	sqlite3_initialize();
+	sqlite3_open(cblog_cdb, &sqlite);

 	out = fopen(post_name, "w");

-	snprintf(key, BUFSIZ, "%s_%s", post_name, "title");
-	if (cdb_find(&cdb, key, strlen(key)) > 0) {
-		val = db_get(&cdb);
-		fprintf(out, "Title: %s\n", val);
-	} else {
-		warnx("post %s not found", post_name);
-		return;
-	}
-
-	snprintf(key, BUFSIZ, "%s_%s", post_name, "tags");
-	if (cdb_find(&cdb, key, strlen(key)) > 0) {
-		val=db_get(&cdb);
-		fprintf(out, "Tags: %s\n", val);
-		free(val);
-	}
-
-	fprintf(out, "\n");
-
-	snprintf(key, BUFSIZ, "%s_%s", post_name,"source");
-	if (cdb_find(&cdb, key, strlen(key)) > 0) {
-		val = db_get(&cdb);
-		fprintf(out, "%s\n", val);
-		free(val);
-	}
-
+	if (sqlite3_prepare_v2(sqlite, "SELECT title as Title, "
+		"group_concat(tag, ', ') as Tags, source "
+	    "FROM posts, tags_posts, tags "
+	    "WHERE link=?1 and posts.id=tags_posts.post_id and tags_posts.tag_id=tags.id;", -1, &stmt, NULL) != SQLITE_OK)
+		errx(1, "%s", sqlite3_errmsg(sqlite));
+
+	sqlite3_bind_text(stmt, 1, post_name, -1, SQLITE_STATIC);
+	while (sqlite3_step(stmt) == SQLITE_ROW) {
+		for (icol = 0; icol < sqlite3_column_count(stmt); icol++) {
+			switch (sqlite3_column_type(stmt, icol)) {
+				case SQLITE_TEXT:
+					if (strcmp(sqlite3_column_name(stmt, icol),"source") == 0)
+							fprintf(out, "\n%s\n",  sqlite3_column_text(stmt, icol));
+					else
+						fprintf(out, "%s: %s\n", sqlite3_column_name(stmt, icol), sqlite3_column_text(stmt, icol));
+					break;
+				case SQLITE_INTEGER:
+					fprintf(out, "%s: %lld\n", sqlite3_column_name(stmt, icol), sqlite3_column_int64(stmt, icol));
+					break;
+				default:
+					/* do nothing */
+					break;
+			}
+		}
+	}
+	sqlite3_finalize(stmt);
+	sqlite3_close(sqlite);
+	sqlite3_shutdown();
 	fclose(out);
-	cdb_free(&cdb);
-	close(db);
 }

 void


[VAMOS] osmo-bts-omldummy: allocate shadow timeslots

Change-Id: I4aa9a8bb35bd828d6f25d5690297e727dace5974
Related: SYS#4895, OS#4941, SYS#5316, OS#4940

--- src/osmo-bts-omldummy/main.c
+++ src/osmo-bts-omldummy/main.c
@@ -135,6 +135,12 @@

 	set_bts_features(bts->features, cmdline.features);

+	/* VAMOS: allocate shadow timeslots for each TRX */
+	if (osmo_bts_has_feature(bts->features, BTS_FEAT_VAMOS)) {
+		llist_for_each_entry(trx, &bts->trx_list, list)
+			gsm_bts_trx_init_shadow_ts(trx);
+	}
+
 	//btsb = bts_role_bts(bts);
 	abis_init(bts);


intel: Verified that driver validation checks are covered for fb.c

--- icd/intel/fb.c
+++ icd/intel/fb.c
@@ -102,8 +102,8 @@
     struct intel_render_pass *rp;
     uint32_t i;

-    /* TODOVV: Move to validation layer */
-    assert(!(info->dependencyCount) && "Invalid dependencyCount");
+    // TODO: Add support for subpass dependencies
+    assert(!(info->dependencyCount) && "No ICD support for subpass dependencies");

     rp = (struct intel_render_pass *) intel_base_create(&dev->base.handle,
             sizeof(*rp), dev->base.dbg, VK_OBJECT_TYPE_RENDER_PASS, info, 0);
@@ -151,9 +151,8 @@
         struct intel_render_pass_subpass *subpass = &rp->subpasses[i];
         uint32_t j;

-        /* missing SPIR support? */
-        /* TODOVV: What do we test here? */
-        assert(!(subpass_info->inputCount) && "Unknown render pass failure");
+        // TODO: Add support for Input Attachment References
+        assert(!(subpass_info->inputCount) && "No ICD support for Input Attachments");

         for (j = 0; j < subpass_info->colorCount; j++) {
             const VkAttachmentReference *color_ref =


importer: Fix improper class for an error log.

--- cli/importer.c
+++ cli/importer.c
@@ -4678,6 +4678,7 @@
     }
     if( !funcs )
     {
+        importer->class = &lsmash_importer_class;
         lsmash_log( importer, LSMASH_LOG_ERROR, "failed to find the matched importer.\n" );
         goto fail;
     }


remove wchar.h header

remove wchar.h header

--- jni/yaft.h
+++ jni/yaft.h
@@ -16,7 +16,6 @@
 #include <sys/select.h>
 #include <termios.h>
 #include <unistd.h>
-#include <wchar.h>

 #include <android/log.h>
 #include <android/keycodes.h>


No soft link is necessary for C programs.

./jlibtool -o foo.lo -c foo.c ==> COMPILE.c
./jlibtool -o foo.o -c foo.c  ==> COMPILE.c
./jlibtool -o foo.a ...       ==> static link
./jlibtool -o foo.so ...      ==> dynamic link
./jlibtool -o foo ...         ==> link

When we see "-o file", we can look at the file extension to
see what we need to do.  We have a pretty good chance of
guessing correctly.

--- jlibtool.c
+++ jlibtool.c
@@ -1759,6 +1759,57 @@
 	    }
 	    push_count_chars(cmd_data->arglist, arg);
 	    assert(cmd_data->mode != mUnknown);
+    }
+
+    /*
+     *	We first pass over the command-line arguments looking for
+     *  "--mode", etc.  If so, then use the libtool compatibility
+     *  method for building the software.  Otherwise, auto-detect it
+     *  via "-o" and the extensions.
+     */
+    base = NULL;
+    if (cmd_data->mode == mUnknown) for (a = 1; a < argc; a++) {
+        arg = argv[a];
+
+	if (strncmp(arg, "--mode=", 7) == 0) {
+	  base = NULL;
+	  break;
+	}
+
+	if (strncmp(arg, "-o", 2) == 0) {
+	  base = argv[++a];
+	}
+    }
+
+    if (base) {
+	    arg = strrchr(base, '.');
+	    if (!arg) {
+		    cmd_data->mode = mLink;
+		    push_count_chars(cmd_data->arglist, LINK_c);
+	    }
+#ifdef EXE_EXT
+	    else if (strcmp(arg, EXE_EXT) == 0) {
+		    cmd_data->mode = mLink;
+		    push_count_chars(cmd_data->arglist, LINK_c);
+	    }
+#endif
+	    else if (strcmp(arg + 1, DYNAMIC_LIB_EXT) == 0) {
+		    cmd_data->mode = mLink;
+		    push_count_chars(cmd_data->arglist, LINK_c);
+	    }
+	    else if (strcmp(arg + 1, STATIC_LIB_EXT) == 0) {
+		    cmd_data->mode = mLink;
+		    push_count_chars(cmd_data->arglist, LINK_c);
+	    }
+	    else if (strcmp(arg + 1, "la") == 0) {
+		    cmd_data->mode = mLink;
+		    push_count_chars(cmd_data->arglist, LINK_c);
+	    }
+	    else if ((strcmp(arg + 1, "lo") == 0) ||
+		     (strcmp(arg + 1, "o") == 0)) {
+		    cmd_data->mode = mCompile;
+		    push_count_chars(cmd_data->arglist, CC);
+	    }
     }

     for (a = 1; a < argc; a++) {


Use __alpha__ and __mips__ instead of alpha & arc

--- miscfs/nullfs/null.h
+++ miscfs/nullfs/null.h
@@ -1,4 +1,4 @@
-/*	$OpenBSD: null.h,v 1.8 1998/03/01 17:01:24 niklas Exp $	*/
+/*	$OpenBSD: null.h,v 1.9 1998/03/01 17:18:01 niklas Exp $	*/
 /*	$NetBSD: null.h,v 1.7 1996/05/17 20:53:11 gwr Exp $	*/

 /*
@@ -69,7 +69,7 @@
 #define RETURN_PC(frameno) (void *)0
 #else
 /* Some architectures can just get the current frame's return address */
-#if defined(alpha) || defined(arc)
+#if defined(__alpha__) || defined(__mips__)
 #define RETURN_PC(frameno) (frameno ? 0 : __builtin_return_address(frameno))
 #else
 #define RETURN_PC(frameno) __builtin_return_address(frameno)


Progress on totient max

Progress on totient max

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

--- progress/totient_max.c
+++ progress/totient_max.c
@@ -0,0 +1,121 @@
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include <math.h>
+
+#define MAX     1000000
+
+int main(int argc, char** argv);
+uint64_t totient_function(uint64_t n);
+uint64_t gcd(uint64_t a, uint64_t b);
+int isprime(uint64_t s);
+
+static uint64_t TOTIENT_CACHE[MAX];
+static int gcount = 0;
+
+int main(int argc, char** argv)
+{
+        (void) argc;
+        (void) argv;
+
+        double tmp;
+        double ratio = 0;
+        uint64_t largest, tf;
+
+
+        for(uint64_t i = 2; i < MAX; i++){
+
+                if(isprime(i))
+                        continue;
+
+                tf = totient_function(i);
+                tmp = (double) i / (double)tf;
+
+                if(tmp > ratio){
+                        ratio = tmp;
+                        largest = i;
+                }
+
+        }
+
+        printf("%d\n", gcount);
+        printf("%li\n", largest);
+
+        return 0;
+
+
+}
+
+
+uint64_t totient_function(uint64_t n)
+{
+
+#define CACHE_BOUND     100
+
+        uint64_t count = 0;
+
+
+        /* See if the number is a candidate for our cached solution */
+
+        for(uint64_t i = 2; i < CACHE_BOUND; i++){
+
+                if(n < i){
+                        goto non_cached;
+                }
+                if(n % i == 0){
+
+                        if(!TOTIENT_CACHE[n/i] || !TOTIENT_CACHE[i]){
+                                goto non_cached;
+                        }
+                        TOTIENT_CACHE[n] = TOTIENT_CACHE[i] *
+                                TOTIENT_CACHE[n/i];
+                        return TOTIENT_CACHE[n];
+                }
+        }
+
+non_cached:
+
+        for(uint64_t i = 1; i < n; i++){
+                if(gcd(i, n) == 1){
+                        count++;
+        }
+        }
+        TOTIENT_CACHE[n] = count;
+        gcount++;
+
+        return count;
+
+}
+
+/* Euler's Method to find the greatest common divisor */
+uint64_t gcd(uint64_t a, uint64_t b)
+{
+        uint64_t tmp;
+
+        while(b){
+                tmp = a % b;
+                a = b;
+                b = tmp;
+        }
+
+        return a;
+
+}
+
+int isprime(uint64_t s)
+{
+        if (s < 2 || s == 2 || s % 2 == 0)
+                return (s == 2);
+
+        uint64_t top = (uint64_t) round((double) sqrt(s));
+
+        for(uint64_t i = 3; i <= top; i+=2){
+
+                if (s % i == 0)
+                        return 0;
+        }
+
+        return 1;
+}
+


- fixed indices when deleting and inserting items, so we can update   the menus correctly, not only construct them in the right order. - install an emission hook on the "parent-set" and update the menus   accordingly when it was a GtkMenuItem of the global menubar   that was added or removed. - added some conditional debugging output, i'm sure we will need   it again ;-)

--- ige-mac-menu.c
+++ ige-mac-menu.c
@@ -44,7 +44,8 @@

 static void   sync_menu_shell (GtkMenuShell *menu_shell,
 			       MenuRef       carbon_menu,
-			       gboolean      toplevel);
+			       gboolean      toplevel,
+			       gboolean      debug);

 /*
@@ -252,7 +253,7 @@
       SetMenuItemHierarchicalMenu (carbon_item->menu, carbon_item->index,
 				   carbon_item->submenu);

-      sync_menu_shell (GTK_MENU_SHELL (submenu), carbon_item->submenu, FALSE);
+      sync_menu_shell (GTK_MENU_SHELL (submenu), carbon_item->submenu, FALSE, FALSE);

       if (cfstr)
 	CFRelease (cfstr);
@@ -502,7 +503,7 @@
 	  HICommand command;
 	  OSStatus  err;

-	  /*g_print ("Menu: kEventClassCommand/kEventCommandProcess\n");*/
+	  /*g_printerr ("Menu: kEventClassCommand/kEventCommandProcess\n");*/

 	  err = GetEventParameter (event_ref, kEventParamDirectObject,
 				   typeHICommand, 0,
@@ -542,18 +543,18 @@
 	  /* This is called when an item is selected (what is the
 	   * GTK+ term? prelight?)
 	   */
-	  /*g_print ("kEventClassMenu/kEventMenuTargetItem\n");*/
+	  /*g_printerr ("kEventClassMenu/kEventMenuTargetItem\n");*/
 	  break;

 	case kEventMenuOpening:
 	  /* Is it possible to dynamically build the menu here? We
 	   * can at least set visibility/sensitivity.
 	   */
-	  /*g_print ("kEventClassMenu/kEventMenuOpening\n");*/
+	  /*g_printerr ("kEventClassMenu/kEventMenuOpening\n");*/
 	  break;

 	case kEventMenuClosed:
-	  /*g_print ("kEventClassMenu/kEventMenuClosed\n");*/
+	  /*g_printerr ("kEventClassMenu/kEventMenuClosed\n");*/
 	  break;

 	default:
@@ -598,12 +599,16 @@
 static void
 sync_menu_shell (GtkMenuShell *menu_shell,
                  MenuRef       carbon_menu,
-		 gboolean      toplevel)
+		 gboolean      toplevel,
+		 gboolean      debug)
 {
   GList         *children;
   GList         *l;
   MenuItemIndex  carbon_index = 1;

+  if (debug)
+    g_printerr ("%s: syncing shell %p\n", G_STRFUNC, menu_shell);
+
   carbon_menu_connect (GTK_WIDGET (menu_shell), carbon_menu);

   children = gtk_container_get_children (GTK_CONTAINER (menu_shell));
@@ -622,10 +627,18 @@

       carbon_item = carbon_menu_item_get (menu_item);

+      if (debug)
+	g_printerr ("%s: carbon_item %d for menu_item %d (%s, %s)\n",
+		    G_STRFUNC, carbon_item ? carbon_item->index : -1,
+		    carbon_index, get_menu_label_text (menu_item, NULL),
+		    g_type_name (G_TYPE_FROM_INSTANCE (menu_item)));
+
       if (carbon_item && carbon_item->index != carbon_index)
 	{
-	  DeleteMenuItem (carbon_item->menu,
-			  carbon_item->index);
+	  if (debug)
+	    g_printerr ("%s:   -> not matching, deleting\n", G_STRFUNC);
+
+	  DeleteMenuItem (carbon_item->menu, carbon_index);
 	  carbon_item = NULL;
 	}

@@ -636,6 +649,9 @@
 	  CFStringRef         cfstr      = NULL;
 	  MenuItemAttributes  attributes = 0;

+	  if (debug)
+	    g_printerr ("%s:   -> creating new\n", G_STRFUNC);
+
 	  label_text = get_menu_label_text (menu_item, &label);
 	  if (label_text)
 	    cfstr = CFStringCreateWithCString (NULL, label_text,
@@ -651,7 +667,7 @@
 	    attributes |= kMenuItemAttrHidden;

 	  InsertMenuItemTextWithCFString (carbon_menu, cfstr,
-					  carbon_index,
+					  carbon_index - 1,
 					  attributes, 0);
 	  SetMenuItemProperty (carbon_menu, carbon_index,
 			       IGE_QUARTZ_MENU_CREATOR,
@@ -680,10 +696,75 @@
   g_list_free (children);
 }

+
+static gulong emission_hook_id = 0;
+
+static gboolean
+parent_set_emission_hook (GSignalInvocationHint *ihint,
+			  guint                  n_param_values,
+			  const GValue          *param_values,
+			  gpointer               data)
+{
+  GtkWidget *instance = g_value_get_object (param_values);
+
+  if (GTK_IS_MENU_ITEM (instance))
+    {
+      GtkWidget *previous_parent = g_value_get_object (param_values + 1);
+      GtkWidget *menu_shell      = NULL;
+
+      if (GTK_IS_MENU_SHELL (previous_parent))
+	{
+	  menu_shell = previous_parent;
+        }
+      else if (GTK_IS_MENU_SHELL (instance->parent))
+	{
+	  menu_shell = instance->parent;
+	}
+
+      if (menu_shell)
+        {
+	  CarbonMenu *carbon_menu = carbon_menu_get (menu_shell);
+
+	  if (carbon_menu)
+	    {
+#if 0
+	      g_printerr ("%s: item %s %p (%s, %s)\n", G_STRFUNC,
+			  previous_parent ? "removed from" : "added to",
+			  menu_shell,
+			  get_menu_label_text (instance, NULL),
+			  g_type_name (G_TYPE_FROM_INSTANCE (instance)));
+#endif
+
+	      sync_menu_shell (GTK_MENU_SHELL (menu_shell),
+			       carbon_menu->menu,
+			       carbon_menu->menu == (MenuRef) data,
+			       FALSE);
+	    }
+        }
+    }
+
+  return TRUE;
+}
+
+static void
+parent_set_emission_hook_remove (GtkWidget *widget,
+				 gpointer   data)
+{
+  g_signal_remove_emission_hook (g_signal_lookup ("parent-set",
+						  GTK_TYPE_WIDGET),
+				 emission_hook_id);
+}
+
+
+/*
+ * public functions
+ */
+
 void
 ige_mac_menu_set_menu_bar (GtkMenuShell *menu_shell)
 {
   MenuRef carbon_menubar;
+  guint   hook_id;

   g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));

@@ -698,7 +779,18 @@

   setup_menu_event_handler ();

-  sync_menu_shell (menu_shell, carbon_menubar, TRUE);
+  emission_hook_id =
+    g_signal_add_emission_hook (g_signal_lookup ("parent-set",
+						 GTK_TYPE_WIDGET),
+				0,
+				parent_set_emission_hook,
+				carbon_menubar, NULL);
+
+  g_signal_connect (menu_shell, "destroy",
+		    G_CALLBACK (parent_set_emission_hook_remove),
+		    NULL);
+
+  sync_menu_shell (menu_shell, carbon_menubar, TRUE, FALSE);
 }

 void


要素へのアクセスが，size_typeではなくintでアクセスされていていたので修正．
VS.NETでの警告は回避．

git-svn-id: 3507153f7f2a502978d43a270f21b34bb2e07470@258 b31369ee-dac5-0310-8161-cccb92f82ee5

--- mist/filter/linear.h
+++ mist/filter/linear.h
@@ -1,19 +1,22 @@
 #ifndef __INCLUDE_FILTER_LINEAR_FILTER_H__
 #define __INCLUDE_FILTER_LINEAR_FILTER_H__

+
+#ifndef __INCLUDE_MIST_H__
 #include "../mist.h"
-#include "../config/mist_conf.h"
-#include "../config/mist_alloc.h"
-#include "../config/type_trait.h"
+#endif
+
+#ifndef __INCLUDE_MIST_LIMITS__
 #include "../limits.h"
+#endif
+
 #include <cmath>

 // mistOԂ̎n܂
 _MIST_BEGIN

-namespace linear_filter
-{
-
+namespace __linear_filter__
+{
 	//double^Cӂ̌^ւ̕ϊ
 	template< class T >
 	struct type_limits_2 : public mist::type_limits < T >
@@ -83,30 +86,31 @@

 	//ʒ[̏
 	template < class T_in >
-	inline double margin( const mist::array1< T_in >& in, const int& i )
+	inline double margin( const mist::array1< T_in >& in, typename mist::array1< T_in >::size_type &i )
 	{
 		return( in( i ) );
 	}

 	template < class T_in >
-	inline double margin( const mist::array2< T_in >& in, const int& i, const int& j )
+	inline double margin( const mist::array2< T_in >& in, const typename mist::array2< T_in >::size_type &i, const typename mist::array2< T_in >::size_type &j )
 	{
 		return( in( i, j ) );
 	}

 	template < class T_in >
-	inline double margin( const mist::array3< T_in >& in, const int& i, const int& j, const int& k )
+	inline double margin( const mist::array3< T_in >& in, const typename mist::array3< T_in >::size_type &i,
+							const typename mist::array3< T_in >::size_type &j, const typename mist::array3< T_in >::size_type &k )
 	{
 		return( in( i, j, k ) );
 	}

 	//evfɑ΂鉉Zʒ[ƂȊOɏꍇ
 	template < class T_in, class T_kernel >
-	inline double get_value( const mist::array1< T_in >& in, const mist::array1< T_kernel >& kernel, const int& i )
+	inline double get_value( const mist::array1< T_in > &in, const mist::array1< T_kernel > &kernel, const typename mist::array1< T_in >::size_type &i )
 	{
 		if( ( i >= (kernel.size1( ) / 2) ) && (i < (in.size1() - kernel.size1( ) / 2) ) )
 		{
-			int		ii;
+			typename mist::array2< T_in >::size_type ii;
 			double	val = 0;
 			for( ii = 0 ; ii < kernel.size1( ) ; ii++ )
 			{
@@ -121,11 +125,12 @@
 	}

 	template < class T_in, class T_kernel >
-	inline double get_value( const mist::array2< T_in >& in, const mist::array2< T_kernel >& kernel, const int& i, const int& j )
+	inline double get_value( const mist::array2< T_in > &in, const mist::array2< T_kernel > &kernel,
+								const typename mist::array2< T_in >::size_type &i, const typename mist::array2< T_in >::size_type &j )
 	{
 		if( ( j >= (kernel.size2( ) / 2) ) && (j < (in.size2() - kernel.size2( ) / 2) ) && ( i >= (kernel.size1( ) / 2) ) && (i < (in.size1() - kernel.size1( ) / 2) ) )
 		{
-			int		ii, jj;
+			typename mist::array2< T_in >::size_type ii, jj;
 			double	val = 0;
 			for( jj = 0 ; jj < kernel.size2( ) ; jj++ )
 			{
@@ -143,11 +148,12 @@
 	}

 	template < class T_in, class T_kernel >
-	inline double get_value( const mist::array3< T_in >& in, const mist::array3< T_kernel >& kernel, const int& i, const int& j, const int& k )
+	inline double get_value( const mist::array3< T_in >& in, const mist::array3< T_kernel >& kernel,
+							const typename mist::array3< T_in >::size_type &i, const typename mist::array3< T_in >::size_type &j, const typename mist::array3< T_in >::size_type &k )
 	{
 		if( ( k >= (kernel.size3( ) / 2) ) && (k < (in.size3() - kernel.size3( ) / 2) ) && ( j >= (kernel.size2( ) / 2) ) && (j < (in.size2() - kernel.size2( ) / 2) ) && ( i >= (kernel.size1( ) / 2) ) && (i < (in.size1() - kernel.size1( ) / 2) ) )
 		{
-			int		ii, jj, kk;
+			typename mist::array2< T_in >::size_type ii, jj, kk;
 			double	val = 0;
 			for( kk = 0 ; kk < kernel.size3( ) ; kk++ )
 			{
@@ -173,7 +179,7 @@
 	{
 		out.resize( in.size1( ) );
 		out.reso1( in.reso1( ) );
-		int		i;
+		typename mist::array2< T_in >::size_type i;
 		for( i = 0 ; i < in.size1() ; i++ )
 		{
 			 out( i ) = type_limits_2< T_out >::cast( get_value( in, kernel, i ) );
@@ -186,7 +192,7 @@
 		out.resize( in.size1( ), in.size2( ) );
 		out.reso1( in.reso1( ) );
 		out.reso2( in.reso2( ) );
-		int		i, j;
+		typename mist::array2< T_in >::size_type i, j;
 		for( j = 0 ; j < in.size2() ; j++ )
 		{
 			for( i = 0 ; i < in.size1() ; i++ )
@@ -203,7 +209,7 @@
 		out.reso1( in.reso1( ) );
 		out.reso2( in.reso2( ) );
 		out.reso3( in.reso3( ) );
-		int		i, j, k;
+		typename mist::array2< T_in >::size_type i, j, k;
 		for( k = 0 ; k < in.size3( ) ; k++ )
 		{
 			for( j = 0 ; j < in.size2( ) ; j++ )
@@ -218,10 +224,10 @@

 	//J[l̐K
 	template < class T_in, class T_out >
-	void normalize( const mist::array1< T_in >& in, mist::array1< T_out >& out)
-	{
-		double	norm;
-		int		i;
+	void normalize( const mist::array1< T_in >& in, mist::array1< T_out >& out )
+	{
+		double norm;
+		typename mist::array2< T_in >::size_type i;
 		norm = 0;
 		for( i = 0 ; i < in.size1( ) ; i++ )
 		{
@@ -237,8 +243,8 @@
 	template < class T_in, class T_out >
 	void normalize( const mist::array2< T_in >& in, mist::array2< T_out >& out )
 	{
-		double	norm;
-		int		i, j;
+		double norm;
+		typename mist::array2< T_in >::size_type i, j;
 		norm = 0;
 		for( i = 0 ; i < in.size1( ) ; i++ )
 		{
@@ -260,8 +266,8 @@
 	template < class T_in, class T_out >
 	void normalize( const mist::array3< T_in >& in, mist::array3< T_out >& out )
 	{
-		double	norm;
-		int		i, j, k;
+		double norm;
+		typename mist::array2< T_in >::size_type i, j, k;
 		norm = 0;
 		for( i = 0 ; i < in.size1( ) ; i++ )
 		{
@@ -285,158 +291,160 @@
 			}
 		}
 	}
-
-	//array1pKEVA
-	template < class T_in, class T_out >
-	void gaussian( const mist::array1< T_in >& in, mist::array1< T_out >& out )
-	{
-		mist::array1< double > kernel( 3 );
-
-		kernel( 0 ) = 0.60653066;
-		kernel( 1 ) = 1.0;
-		kernel( 2 ) = 0.60653066;
-
-		mist::array1< double >	n_kernel;
-		normalize( kernel, n_kernel );
-
-		apply( in, out, n_kernel );
-	}
-
-	//array2pKEVA
-	template < class T_in, class T_out >
-	void gaussian( const mist::array2< T_in >& in, mist::array2< T_out >& out )
-	{
-		mist::array2< double > kernel( 3, 3 );
-
-		kernel( 0, 0 ) = 0.367879441;
-		kernel( 1, 0 ) = 0.60653066;
-		kernel( 2, 0 ) = 0.367879441;
-		kernel( 0, 1 ) = 0.60653066;
-		kernel( 1, 1 ) = 1.0;
-		kernel( 2, 1 ) = 0.60653066;
-		kernel( 0, 2 ) = 0.367879441;
-		kernel( 1, 2 ) = 0.60653066;
-		kernel( 2, 2 ) = 0.367879441;
-
-		mist::array2< double >	n_kernel;
-		normalize( kernel, n_kernel );
-
-		apply( in, out, n_kernel );
-	}
-
-	//array3pKEVA
-	template < class T_in, class T_out >
-	void gaussian( const mist::array3< T_in >& in, mist::array3< T_out >& out )
-	{
-		mist::array3< double > kernel( 3, 3, 3 );
-
-		kernel( 0, 0, 0 ) = 0.22313016;
-		kernel( 1, 0, 0 ) = 0.367879441;
-		kernel( 2, 0, 0 ) = 0.22313016;
-		kernel( 0, 1, 0 ) = 0.367879441;
-		kernel( 1, 1, 0 ) = 0.60653066;
-		kernel( 2, 1, 0 ) = 0.367879441;
-		kernel( 0, 2, 0 ) = 0.22313016;
-		kernel( 1, 2, 0 ) = 0.367879441;
-		kernel( 2, 2, 0 ) = 0.22313016;
-
-		kernel( 0, 0, 1 ) = 0.367879441;
-		kernel( 1, 0, 1 ) = 0.60653066;
-		kernel( 2, 0, 1 ) = 0.367879441;
-		kernel( 0, 1, 1 ) = 0.60653066;
-		kernel( 1, 1, 1 ) = 1.0;
-		kernel( 2, 1, 1 ) = 0.60653066;
-		kernel( 0, 2, 1 ) = 0.367879441;
-		kernel( 1, 2, 1 ) = 0.60653066;
-		kernel( 2, 2, 1 ) = 0.367879441;
-
-		kernel( 0, 0, 2 ) = 0.22313016;
-		kernel( 1, 0, 2 ) = 0.367879441;
-		kernel( 2, 0, 2 ) = 0.22313016;
-		kernel( 0, 1, 2 ) = 0.367879441;
-		kernel( 1, 1, 2 ) = 0.60653066;
-		kernel( 2, 1, 2 ) = 0.367879441;
-		kernel( 0, 2, 2 ) = 0.22313016;
-		kernel( 1, 2, 2 ) = 0.367879441;
-		kernel( 2, 2, 2 ) = 0.22313016;
-
-		mist::array3< double >	n_kernel;
-		normalize( kernel, n_kernel );
-
-		apply( in, out, n_kernel );
-	}
-
-	//array1pvVA
-	template < class T_in, class T_out >
-	void laplacian( const mist::array1< T_in >& in, mist::array1< T_out >& out )
-	{
-		mist::array1< double > kernel( 3 );
-
-		kernel( 0 ) = 1.0;
-		kernel( 1 ) = -2.0;
-		kernel( 2 ) = 1.0;
-
-		apply( in, out, kernel );
-	}
-
-	//array2pvVA
-	template < class T_in, class T_out >
-	void laplacian( const mist::array2< T_in >& in, mist::array2< T_out >& out )
-	{
-		mist::array2< double > kernel( 3, 3 );
-
-		kernel( 0, 0 ) = 1.0;
-		kernel( 1, 0 ) = 1.0;
-		kernel( 2, 0 ) = 1.0;
-		kernel( 0, 1 ) = 1.0;
-		kernel( 1, 1 ) = -8.0;
-		kernel( 2, 1 ) = 1.0;
-		kernel( 0, 2 ) = 1.0;
-		kernel( 1, 2 ) = 1.0;
-		kernel( 2, 2 ) = 1.0;
-
-		apply( in, out, kernel );
-	}
-
-	//array3pvVA
-	template < class T_in, class T_out >
-	void laplacian( const mist::array3< T_in >& in, mist::array3< T_out >& out )
-	{
-		mist::array3< double > kernel( 3, 3, 3 );
-
-		kernel( 0, 0, 0 ) = 1.0;
-		kernel( 1, 0, 0 ) = 1.0;
-		kernel( 2, 0, 0 ) = 1.0;
-		kernel( 0, 1, 0 ) = 1.0;
-		kernel( 1, 1, 0 ) = 1.0;
-		kernel( 2, 1, 0 ) = 1.0;
-		kernel( 0, 2, 0 ) = 1.0;
-		kernel( 1, 2, 0 ) = 1.0;
-		kernel( 2, 2, 0 ) = 1.0;
-
-		kernel( 0, 0, 1 ) = 1.0;
-		kernel( 1, 0, 1 ) = 1.0;
-		kernel( 2, 0, 1 ) = 1.0;
-		kernel( 0, 1, 1 ) = 1.0;
-		kernel( 1, 1, 1 ) = -26.0;
-		kernel( 2, 1, 1 ) = 1.0;
-		kernel( 0, 2, 1 ) = 1.0;
-		kernel( 1, 2, 1 ) = 1.0;
-		kernel( 2, 2, 1 ) = 1.0;
-
-		kernel( 0, 0, 2 ) = 1.0;
-		kernel( 1, 0, 2 ) = 1.0;
-		kernel( 2, 0, 2 ) = 1.0;
-		kernel( 0, 1, 2 ) = 1.0;
-		kernel( 1, 1, 2 ) = 1.0;
-		kernel( 2, 1, 2 ) = 1.0;
-		kernel( 0, 2, 2 ) = 1.0;
-		kernel( 1, 2, 2 ) = 1.0;
-		kernel( 2, 2, 2 ) = 1.0;
-
-		apply( in, out, kernel );
-	}
-}
+}
+
+
+//array1pKEVA
+template < class T_in, class T_out >
+void gaussian( const mist::array1< T_in >& in, mist::array1< T_out >& out )
+{
+	mist::array1< double > kernel( 3 );
+
+	kernel( 0 ) = 0.60653066;
+	kernel( 1 ) = 1.0;
+	kernel( 2 ) = 0.60653066;
+
+	mist::array1< double >	n_kernel;
+	__linear_filter__::normalize( kernel, n_kernel );
+
+	__linear_filter__::apply( in, out, n_kernel );
+}
+
+//array2pKEVA
+template < class T_in, class T_out >
+void gaussian( const mist::array2< T_in >& in, mist::array2< T_out >& out )
+{
+	mist::array2< double > kernel( 3, 3 );
+
+	kernel( 0, 0 ) = 0.367879441;
+	kernel( 1, 0 ) = 0.60653066;
+	kernel( 2, 0 ) = 0.367879441;
+	kernel( 0, 1 ) = 0.60653066;
+	kernel( 1, 1 ) = 1.0;
+	kernel( 2, 1 ) = 0.60653066;
+	kernel( 0, 2 ) = 0.367879441;
+	kernel( 1, 2 ) = 0.60653066;
+	kernel( 2, 2 ) = 0.367879441;
+
+	mist::array2< double >	n_kernel;
+	__linear_filter__::normalize( kernel, n_kernel );
+
+	__linear_filter__::apply( in, out, n_kernel );
+}
+
+//array3pKEVA
+template < class T_in, class T_out >
+void gaussian( const mist::array3< T_in >& in, mist::array3< T_out >& out )
+{
+	mist::array3< double > kernel( 3, 3, 3 );
+
+	kernel( 0, 0, 0 ) = 0.22313016;
+	kernel( 1, 0, 0 ) = 0.367879441;
+	kernel( 2, 0, 0 ) = 0.22313016;
+	kernel( 0, 1, 0 ) = 0.367879441;
+	kernel( 1, 1, 0 ) = 0.60653066;
+	kernel( 2, 1, 0 ) = 0.367879441;
+	kernel( 0, 2, 0 ) = 0.22313016;
+	kernel( 1, 2, 0 ) = 0.367879441;
+	kernel( 2, 2, 0 ) = 0.22313016;
+
+	kernel( 0, 0, 1 ) = 0.367879441;
+	kernel( 1, 0, 1 ) = 0.60653066;
+	kernel( 2, 0, 1 ) = 0.367879441;
+	kernel( 0, 1, 1 ) = 0.60653066;
+	kernel( 1, 1, 1 ) = 1.0;
+	kernel( 2, 1, 1 ) = 0.60653066;
+	kernel( 0, 2, 1 ) = 0.367879441;
+	kernel( 1, 2, 1 ) = 0.60653066;
+	kernel( 2, 2, 1 ) = 0.367879441;
+
+	kernel( 0, 0, 2 ) = 0.22313016;
+	kernel( 1, 0, 2 ) = 0.367879441;
+	kernel( 2, 0, 2 ) = 0.22313016;
+	kernel( 0, 1, 2 ) = 0.367879441;
+	kernel( 1, 1, 2 ) = 0.60653066;
+	kernel( 2, 1, 2 ) = 0.367879441;
+	kernel( 0, 2, 2 ) = 0.22313016;
+	kernel( 1, 2, 2 ) = 0.367879441;
+	kernel( 2, 2, 2 ) = 0.22313016;
+
+	mist::array3< double >	n_kernel;
+	__linear_filter__::normalize( kernel, n_kernel );
+
+	__linear_filter__::apply( in, out, n_kernel );
+}
+
+//array1pvVA
+template < class T_in, class T_out >
+void laplacian( const mist::array1< T_in >& in, mist::array1< T_out >& out )
+{
+	mist::array1< double > kernel( 3 );
+
+	kernel( 0 ) = 1.0;
+	kernel( 1 ) = -2.0;
+	kernel( 2 ) = 1.0;
+
+	__linear_filter__::apply( in, out, kernel );
+}
+
+//array2pvVA
+template < class T_in, class T_out >
+void laplacian( const mist::array2< T_in >& in, mist::array2< T_out >& out )
+{
+	mist::array2< double > kernel( 3, 3 );
+
+	kernel( 0, 0 ) = 1.0;
+	kernel( 1, 0 ) = 1.0;
+	kernel( 2, 0 ) = 1.0;
+	kernel( 0, 1 ) = 1.0;
+	kernel( 1, 1 ) = -8.0;
+	kernel( 2, 1 ) = 1.0;
+	kernel( 0, 2 ) = 1.0;
+	kernel( 1, 2 ) = 1.0;
+	kernel( 2, 2 ) = 1.0;
+
+	__linear_filter__::apply( in, out, kernel );
+}
+
+//array3pvVA
+template < class T_in, class T_out >
+void laplacian( const mist::array3< T_in >& in, mist::array3< T_out >& out )
+{
+	mist::array3< double > kernel( 3, 3, 3 );
+
+	kernel( 0, 0, 0 ) = 1.0;
+	kernel( 1, 0, 0 ) = 1.0;
+	kernel( 2, 0, 0 ) = 1.0;
+	kernel( 0, 1, 0 ) = 1.0;
+	kernel( 1, 1, 0 ) = 1.0;
+	kernel( 2, 1, 0 ) = 1.0;
+	kernel( 0, 2, 0 ) = 1.0;
+	kernel( 1, 2, 0 ) = 1.0;
+	kernel( 2, 2, 0 ) = 1.0;
+
+	kernel( 0, 0, 1 ) = 1.0;
+	kernel( 1, 0, 1 ) = 1.0;
+	kernel( 2, 0, 1 ) = 1.0;
+	kernel( 0, 1, 1 ) = 1.0;
+	kernel( 1, 1, 1 ) = -26.0;
+	kernel( 2, 1, 1 ) = 1.0;
+	kernel( 0, 2, 1 ) = 1.0;
+	kernel( 1, 2, 1 ) = 1.0;
+	kernel( 2, 2, 1 ) = 1.0;
+
+	kernel( 0, 0, 2 ) = 1.0;
+	kernel( 1, 0, 2 ) = 1.0;
+	kernel( 2, 0, 2 ) = 1.0;
+	kernel( 0, 1, 2 ) = 1.0;
+	kernel( 1, 1, 2 ) = 1.0;
+	kernel( 2, 1, 2 ) = 1.0;
+	kernel( 0, 2, 2 ) = 1.0;
+	kernel( 1, 2, 2 ) = 1.0;
+	kernel( 2, 2, 2 ) = 1.0;
+
+	__linear_filter__::apply( in, out, kernel );
+}
+

 // mistOԂ̏I


Add missing READ specifier.

Add missing READ specifier.

--- plugins/filesystem/file.h
+++ plugins/filesystem/file.h
@@ -43,7 +43,7 @@
     Q_PROPERTY(bool executable READ executable)
     Q_PROPERTY(QDateTime created READ created)
     Q_PROPERTY(QDateTime lastRead READ lastRead)
-    Q_PROPERTY(QDateTime lastModified)
+    Q_PROPERTY(QDateTime lastModified READ lastModified)

 public:


in_kmsg: release sbuffer at cb_exit

in_kmsg: release sbuffer at cb_exit

Signed-off-by: Takahiro YAMASHITA <8b9f03f78cb27351a99f79113f99e589b65190d5@gmail.com>

--- plugins/in_kmsg/in_kmsg.c
+++ plugins/in_kmsg/in_kmsg.c
@@ -326,6 +326,8 @@
         close(ctx->fd);
     }

+    msgpack_sbuffer_destroy(&ctx->mp_sbuf);
+
     free(ctx);
     return 0;
 }


Remove obsolete comment.

Remove obsolete comment.

Obsoleted by commit 21dcda2713656a7483e3280ac9d2ada20a87a9a9, but I missed
seeing the cross-reference in the comments for exec_eval_integer().

Also improve the cross-reference in the comments for exec_eval_cleanup().

--- src/pl/plpgsql/src/pl_exec.c
+++ src/pl/plpgsql/src/pl_exec.c
@@ -3219,7 +3219,7 @@
  * unless it is a pass-by-value datatype.
  *
  * NB: if you change this code, see also the hacks in exec_assign_value's
- * PLPGSQL_DTYPE_ARRAYELEM case.
+ * PLPGSQL_DTYPE_ARRAYELEM case for partial cleanup after subscript evals.
  * ----------
  */
 static void
@@ -4749,8 +4749,7 @@
  * Note we do not do exec_eval_cleanup here; the caller must do it at
  * some later point.  (We do this because the caller may be holding the
  * results of other, pass-by-reference, expression evaluations, such as
- * an array value to be subscripted.  Also see notes in exec_eval_simple_expr
- * about allocation of the parameter array.)
+ * an array value to be subscripted.)
  * ----------
  */
 static int


played a bit around with doxygen latex

played a bit around with doxygen latex

--- src/shogun/statistics/LinearTimeMMD.h
+++ src/shogun/statistics/LinearTimeMMD.h
@@ -20,9 +20,16 @@
 class CFeatures;

 /** @brief This class implements the linear time Maximum Mean Statistic as
- * described in
- * Gretton, A., Borgwardt, K. M., Rasch, M. J., Schoelkopf, B., & Smola, A. (2012).
- * A Kernel Two-Sample Test. Journal of Machine Learning Research, 13, 671-721.
+ * described in [1].
+ * Given two sets of samples \f$\{x_i\}_{i=1}^m\sim p\f$ and
+ * \f$\{y_i\}_{i=1}^n\sim q\f$
+ * the (unbiased) statistic is computed as
+ * \f[
+ * \text{MMD}_l^2[\mathcal{F},X,Y]=\frac{1}{m(m-1)}\sum_{i=1}^m\sum_{j\neq i}^m
+ * k(x_i,x_j) + \frac{1}{n(n-1)}\sum_{i=1}^n\sum_{j\neq i}^nk(y_i,y_j)
+ *  - \frac{2}{mn}\sum_{i=1}^m\sum_{j=1}^nk(x_i,y_j)
+ * \f]
+ * in a RKHS \f$\mathcal{F}\f$
  *
  * Along with the statistic comes a method to compute a p-value based on a
  * Gaussian approximation of the null-distribution which is also possible in
@@ -33,6 +40,9 @@
  *
  * Comes with a method for selecting kernel weights, if a combined kernel on
  * combined features is used. See optimize_kernel_weights().
+ *
+ * [1]: Gretton, A., Borgwardt, K. M., Rasch, M. J., Schoelkopf, B., & Smola, A. (2012).
+ * A Kernel Two-Sample Test. Journal of Machine Learning Research, 13, 671-721.
  */
 class CLinearTimeMMD: public CKernelTwoSampleTestStatistic
 {
@@ -112,11 +122,13 @@
 	virtual float64_t compute_variance_estimate();

 #ifdef HAVE_LAPACK
-	/** TODO */
-	/** Selects optimal kernel weights (if the underlying kernel and features)
+	/** Selects optimal kernel weights (if the underlying kernel and features
 	 * are combined ones) using the ratio of the squared MMD by its standard
 	 * deviation as a criterion, i.e.
-	 * TODO latex
+	 * \f[
+	 * \frac{\text{MMD}_l^2[\mathcal{F},X,Y]}{\sigma_l}
+	 * \f]
+	 * where both expressions are estimated in linear time.
 	 * This comes down to solving a convex program which is quadratic in the
 	 * number of kernels.
 	 *


libtracker-data: Implement get_property() for n-columns in SQLite cursor

n-columns is an abstract property, so it should be implemented by all
the TrackerCursor subclasses

Fixes GB#654407.

--- src/libtracker-data/tracker-db-interface-sqlite.c
+++ src/libtracker-data/tracker-db-interface-sqlite.c
@@ -149,6 +149,11 @@
 	PROP_0,
 	PROP_FILENAME,
 	PROP_RO
+};
+
+enum {
+	TRACKER_DB_CURSOR_PROP_0,
+	TRACKER_DB_CURSOR_PROP_N_COLUMNS
 };

 G_DEFINE_TYPE_WITH_CODE (TrackerDBInterface, tracker_db_interface, G_TYPE_OBJECT,
@@ -1594,6 +1599,22 @@
 }

 static void
+tracker_db_cursor_get_property (GObject    *object,
+                                guint       prop_id,
+                                GValue     *value,
+                                GParamSpec *pspec)
+{
+	TrackerDBCursor *cursor = TRACKER_DB_CURSOR (object);
+	switch (prop_id) {
+	case TRACKER_DB_CURSOR_PROP_N_COLUMNS:
+		g_value_set_int (value, tracker_db_cursor_get_n_columns (cursor));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+	}
+}
+
+static void
 tracker_db_cursor_iter_next_thread (GSimpleAsyncResult *res,
                                     GObject            *object,
                                     GCancellable       *cancellable)
@@ -1643,6 +1664,7 @@
 	TrackerSparqlCursorClass *sparql_cursor_class = TRACKER_SPARQL_CURSOR_CLASS (class);

 	object_class->finalize = tracker_db_cursor_finalize;
+	object_class->get_property = tracker_db_cursor_get_property;

 	sparql_cursor_class->get_value_type = (TrackerSparqlValueType (*) (TrackerSparqlCursor *, gint)) tracker_db_cursor_get_value_type;
 	sparql_cursor_class->get_variable_name = (const gchar * (*) (TrackerSparqlCursor *, gint)) tracker_db_cursor_get_variable_name;
@@ -1656,6 +1678,8 @@
 	sparql_cursor_class->get_integer = (gint64 (*) (TrackerSparqlCursor *, gint)) tracker_db_cursor_get_int;
 	sparql_cursor_class->get_double = (gdouble (*) (TrackerSparqlCursor *, gint)) tracker_db_cursor_get_double;
 	sparql_cursor_class->get_boolean = (gboolean (*) (TrackerSparqlCursor *, gint)) tracker_db_cursor_get_boolean;
+
+	g_object_class_override_property (object_class, TRACKER_DB_CURSOR_PROP_N_COLUMNS, "n-columns");
 }

 static TrackerDBCursor *


Missed one more; #192

Missed one more; #192

--- dmoj/cptbox/ptbox.h
+++ dmoj/cptbox/ptbox.h
@@ -227,8 +227,6 @@
 };

 class pt_debugger_arm : public pt_debugger {
-    long peek_reg(int);
-    void poke_reg(int, long);
 public:
     pt_debugger_arm();


Add assertion to check for valid source ranges.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@91966 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/clang/Analysis/PathSensitive/BugReporter.h
+++ include/clang/Analysis/PathSensitive/BugReporter.h
@@ -203,7 +203,10 @@
   ~RangedBugReport();

   // FIXME: Move this out of line.
-  void addRange(SourceRange R) { Ranges.push_back(R); }
+  void addRange(SourceRange R) {
+    assert(R.isValid());
+    Ranges.push_back(R);
+  }

   // FIXME: Move this out of line.
   void getRanges(const SourceRange*& beg, const SourceRange*& end) {


Remove broken Assertions that failed if a statement executed in PL/pgSQL is
rewritten into another kind of statement, for example if an INSERT is
rewritten into an UPDATE.

Back-patch to 8.3 and 8.2. For HEAD, Tom suggested inventing a new
SPI_OK_REWRITTEN return code, but that's not a backportable solution. I'll
do that as a separate patch, this patch will do as a stopgap measure for HEAD
too in the meanwhile.

--- src/pl/plpgsql/src/pl_exec.c
+++ src/pl/plpgsql/src/pl_exec.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.202.2.2 2009/01/07 20:39:05 tgl Exp $
+ *	  $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.202.2.3 2009/01/14 09:53:54 heikki Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -2546,13 +2546,19 @@

 	/*
 	 * Check for error, and set FOUND if appropriate (for historical reasons
-	 * we set FOUND only for certain query types).	Also Assert that we
-	 * identified the statement type the same as SPI did.
+	 * we set FOUND only for certain query types).
+	 *
+	 * Note: the command type indicated by return code might not match
+	 * mod_stmt, if there is an INSTEAD OF rule rewriting an UPDATE into an
+	 * INSERT, for example. In that case, the INSERT doesn't have canSetTag
+	 * set, mod_stmt is false, and SPI_execute_plan sets SPI_processed to
+	 * zero. We'll set FOUND to false here in that case. If the statement is
+	 * rewritten into a utility statement, however, FOUND is left unchanged.
+	 * Arguably that's a bug, but changing it now could break applications.
 	 */
 	switch (rc)
 	{
 		case SPI_OK_SELECT:
-			Assert(!stmt->mod_stmt);
 			exec_set_found(estate, (SPI_processed != 0));
 			break;

@@ -2562,13 +2568,11 @@
 		case SPI_OK_INSERT_RETURNING:
 		case SPI_OK_UPDATE_RETURNING:
 		case SPI_OK_DELETE_RETURNING:
-			Assert(stmt->mod_stmt);
 			exec_set_found(estate, (SPI_processed != 0));
 			break;

 		case SPI_OK_SELINTO:
 		case SPI_OK_UTILITY:
-			Assert(!stmt->mod_stmt);
 			break;

 		default:


stm32_pinctrl: remove duplicate definition

remove duplicate definition of STM32PIN

Signed-off-by: Parthiban Nallathambi <6b0b8519cf5d39b6236ee1602e2efab4cd47c619@linumiz.com>

--- include/dt-bindings/pinctrl/stm32-pinctrl-common.h
+++ include/dt-bindings/pinctrl/stm32-pinctrl-common.h
@@ -28,17 +28,8 @@
 #define STM32_PORTS_MAX (STM32_PORTK + 1)
 #endif

-/**
- * @brief helper macro to encode an IO port pin in a numerical format
- */
-#define STM32PIN(_port, _pin) \
-	(_port << 4 | _pin)
-
-
 #define STM32_PINMUX_FUNC_GPIO 0
 #define STM32_PINMUX_FUNC_ANALOG (STM32_PINMUX_FUNC_ALT_MAX)
-
-

 /**
  * @brief helper macro to encode an IO port pin in a numerical format


r300/compiler: Try to eliminate REPL_ALPHA instructions

Scalar instruction that need to write to the xyz components of a
register must reserve the RGB instruction slot for a REPL_ALPHA
instruction.  With this commit, the scheduler will attempt to free
the RGB slot by moving the write to the w component of a register.

--- src/gallium/drivers/r300/compiler/radeon_pair_schedule.c
+++ src/gallium/drivers/r300/compiler/radeon_pair_schedule.c
@@ -896,7 +896,16 @@
 		return 0;
 	}

-	pair_inst->Alpha.Opcode = pair_inst->RGB.Opcode;
+	/* If we are converting a full instruction with RC_OPCODE_REPL_ALPHA
+	 * as the RGB opcode, then the Alpha instruction will already contain
+	 * the correct opcode and instruction args, so we do not want to
+	 * overwrite them.
+	 */
+	if (pair_inst->RGB.Opcode != RC_OPCODE_REPL_ALPHA) {
+		pair_inst->Alpha.Opcode = pair_inst->RGB.Opcode;
+		memcpy(pair_inst->Alpha.Arg, pair_inst->RGB.Arg,
+						sizeof(pair_inst->Alpha.Arg));
+	}
 	pair_inst->Alpha.DestIndex = new_index;
 	pair_inst->Alpha.WriteMask = RC_MASK_W;
 	pair_inst->Alpha.Target = pair_inst->RGB.Target;
@@ -904,8 +913,6 @@
 	pair_inst->Alpha.DepthWriteMask = pair_inst->RGB.DepthWriteMask;
 	pair_inst->Alpha.Saturate = pair_inst->RGB.Saturate;
 	pair_inst->Alpha.Omod = pair_inst->RGB.Omod;
-	memcpy(pair_inst->Alpha.Arg, pair_inst->RGB.Arg,
-						sizeof(pair_inst->Alpha.Arg));
 	/* Move the swizzles into the first chan */
 	for (i = 0; i < info->NumSrcRegs; i++) {
 		unsigned int j;
@@ -933,6 +940,48 @@
 					RC_FILE_TEMPORARY, old_swz, new_index);
 	}
 	return 1;
+}
+
+static void try_convert_and_pair(
+	struct schedule_state *s,
+	struct schedule_instruction ** inst_list)
+{
+	struct schedule_instruction * list_ptr = *inst_list;
+	while (list_ptr && *inst_list && (*inst_list)->NextReady) {
+		int paired = 0;
+		if (list_ptr->Instruction->U.P.Alpha.Opcode != RC_OPCODE_NOP
+			&& list_ptr->Instruction->U.P.RGB.Opcode
+						!= RC_OPCODE_REPL_ALPHA) {
+				goto next;
+		}
+		if (list_ptr->NumWriteValues == 1
+					&& convert_rgb_to_alpha(s, list_ptr)) {
+
+			struct schedule_instruction * pair_ptr;
+			remove_inst_from_list(inst_list, list_ptr);
+			add_inst_to_list_score(&s->ReadyAlpha, list_ptr);
+
+			for (pair_ptr = s->ReadyRGB; pair_ptr;
+					pair_ptr = pair_ptr->NextReady) {
+				if (merge_instructions(&pair_ptr->Instruction->U.P,
+						&list_ptr->Instruction->U.P)) {
+					remove_inst_from_list(&s->ReadyAlpha, list_ptr);
+					remove_inst_from_list(&s->ReadyRGB, pair_ptr);
+					pair_ptr->PairedInst = list_ptr;
+
+					add_inst_to_list(&s->ReadyFullALU, pair_ptr);
+					list_ptr = *inst_list;
+					paired = 1;
+					break;
+				}
+
+			}
+		}
+		if (!paired) {
+next:
+			list_ptr = list_ptr->NextReady;
+		}
+	}
 }

 /**
@@ -969,38 +1018,13 @@
 		return;
 	}

+	/* Full instructions that have RC_OPCODE_REPL_ALPHA in the RGB
+	 * slot can be converted into Alpha instructions. */
+	try_convert_and_pair(s, &s->ReadyFullALU);
+
 	/* Try to convert some of the RGB instructions to Alpha and
 	 * try to pair it with another RGB. */
-	rgb_ptr = s->ReadyRGB;
-	while (rgb_ptr && s->ReadyRGB && s->ReadyRGB->NextReady) {
-		int paired = 0;
-		if (rgb_ptr->NumWriteValues == 1
-					&& convert_rgb_to_alpha(s, rgb_ptr)) {
-
-			struct schedule_instruction * pair_ptr;
-			remove_inst_from_list(&s->ReadyRGB, rgb_ptr);
-			add_inst_to_list_score(&s->ReadyAlpha, rgb_ptr);
-
-			for (pair_ptr = s->ReadyRGB; pair_ptr;
-					pair_ptr = pair_ptr->NextReady) {
-				if (merge_instructions(&pair_ptr->Instruction->U.P,
-						&rgb_ptr->Instruction->U.P)) {
-					remove_inst_from_list(&s->ReadyAlpha, rgb_ptr);
-					remove_inst_from_list(&s->ReadyRGB, pair_ptr);
-					pair_ptr->PairedInst = rgb_ptr;
-
-					add_inst_to_list(&s->ReadyFullALU, pair_ptr);
-					rgb_ptr = s->ReadyRGB;
-					paired = 1;
-					break;
-				}
-
-			}
-		}
-		if (!paired) {
-			rgb_ptr = rgb_ptr->NextReady;
-		}
-	}
+	try_convert_and_pair(s, &s->ReadyRGB);
 }

 static void update_max_score(


Core: Composite property added override qualifiers

--- include/inviwo/core/properties/compositeproperty.h
+++ include/inviwo/core/properties/compositeproperty.h
@@ -51,40 +51,38 @@
     virtual CompositeProperty* clone() const;
     virtual ~CompositeProperty();

-    virtual void setOwner(PropertyOwner* owner);
-
-    virtual bool getReadOnly() const; // returns true if all sub properties are read only
-    virtual void setReadOnly(const bool& value);
-
-    //override original function in property
-    virtual void set(const Property* src);
-    virtual void setPropertyModified(bool modified);
-    virtual bool isPropertyModified() const;
-
-    virtual void invalidate(InvalidationLevel invalidationLevel,
-                            Property* modifiedProperty = 0);
-
-    virtual void setCurrentStateAsDefault();
-    virtual void resetToDefaultState();
-
-    virtual UsageMode getUsageMode() const; // returns the lowest mode of all sub properties
-    virtual void setUsageMode(UsageMode visibilityMode);
-    virtual bool getVisible(); // returns true if any sub property is visible
-    virtual void setVisible(bool val);
-
-    virtual void updateVisibility();
-
     virtual bool isCollapsed() const;
     virtual void setCollapsed(bool value);
+
+    // Override original functions in Property
+    virtual void setOwner(PropertyOwner* owner) override;
+
+    virtual bool getReadOnly() const override; // returns true if all sub properties are read only
+    virtual void setReadOnly(const bool& value) override;
+
+    virtual void set(const Property* src) override;
+    virtual void setPropertyModified(bool modified) override;
+    virtual bool isPropertyModified() const override;
+
+    virtual void setCurrentStateAsDefault() override;
+    virtual void resetToDefaultState() override;

+    virtual UsageMode getUsageMode() const override; // returns the lowest mode of all sub properties
+    virtual void setUsageMode(UsageMode visibilityMode) override;
+    virtual bool getVisible() override; // returns true if any sub property is visible
+    virtual void setVisible(bool val) override;

-    // Override from the property owner
-    virtual Processor* getProcessor();
-    virtual const Processor* getProcessor() const;
-    virtual std::vector<std::string> getPath() const;
+    virtual void updateVisibility() override;
+
+    // Override from the PropertyOwner
+    virtual void invalidate(InvalidationLevel invalidationLevel,
+                            Property* modifiedProperty = 0) override;
+    virtual Processor* getProcessor() override;
+    virtual const Processor* getProcessor() const override;
+    virtual std::vector<std::string> getPath() const override;

-    virtual void serialize(IvwSerializer& s) const;
-    virtual void deserialize(IvwDeserializer& d);
+    virtual void serialize(IvwSerializer& s) const override;
+    virtual void deserialize(IvwDeserializer& d) override;

 private:
     bool collapsed_;


Fix not result checking warning

Fix not result checking warning

--- input/device.c
+++ input/device.c
@@ -497,13 +497,14 @@
 static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
 {
 	struct uinput_event event;
+	int err;

 	memset(&event, 0, sizeof(event));
 	event.type	= type;
 	event.code	= code;
 	event.value	= value;

-	write(fd, &event, sizeof(event));
+	err = write(fd, &event, sizeof(event));
 }

 static void send_key(int fd, uint16_t key)


Automation debug improvements

Automation debug improvements

git-svn-id: 5a113f46df058f8047e288f4f3e948d899353d9a@127 410355f2-c4ea-45de-a5b5-301721f902b9

--- prs/src/mixerautomation.c
+++ prs/src/mixerautomation.c
@@ -116,7 +116,17 @@
 			mixer_reset_notification_time (a->m, a->last_event_time+e->delta_time);
 	a->events = list_append (a->events, e);
 	pthread_mutex_unlock (&(a->mut));
-	debug_printf (DEBUG_FLAGS_AUTOMATION, "Added automation eventK\n");
+	switch (e->type) {
+	case AUTOMATION_EVENT_TYPE_ADD_CHANNEL:
+			debug_printf (DEBUG_FLAGS_AUTOMATION, "Add channel event added %s\n", e->channel_name);
+			break;
+	case AUTOMATION_EVENT_TYPE_FADE_CHANNEL:
+		debug_printf (DEBUG_FLAGS_AUTOMATION, "fade channel event added %s\n", e->channel_name);
+		break;
+	case AUTOMATION_EVENT_TYPE_FADE_ALL:
+		debug_printf (DEBUG_FLAGS_AUTOMATION, "fade all event added.\n");
+		break;
+	}
 }

@@ -139,6 +149,9 @@
 		debug_printf (DEBUG_FLAGS_AUTOMATION, "mixer_Automation_next_event called with no events on stack.\n");
 		return;
 	}
+
+	mixer_time = mixer_get_time (a->m);
+	debug_printf (DEBUG_FLAGS_AUTOMATION, "Executing automation event, lag is %lf\n", a->last_event_time+e->delta_time-mixer_time);

 	/* Do event */