Comparing the three polynomial multiplication methods

error: pathspec 'fmpz_poly/profile/p-mul.c' did not match any file(s) known to git

--- fmpz_poly/profile/p-mul.c
+++ fmpz_poly/profile/p-mul.c
@@ -0,0 +1,120 @@
+/*=============================================================================
+
+    This file is part of FLINT.
+
+    FLINT is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    FLINT is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with FLINT; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+=============================================================================*/
+/******************************************************************************
+
+    Copyright (C) 2010 Sebastian Pancratz
+
+******************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <mpir.h>
+#include "flint.h"
+#include "fmpz.h"
+#include "fmpz_poly.h"
+#include "ulong_extras.h"
+#include "profiler.h"
+
+int
+main(void)
+{
+    long len, lenlo = 1, lenhi = 100, lenh = 1;
+    long bits, bitslo = 16, bitshi = 2048, bitsh = 16;
+
+    long cols = (lenhi + 1 - lenlo + (lenh - 1)) / lenh;     /* ceil((lenhi + 1 - lenlo) / lenh) */
+    long rows = (bitshi + 1 - bitslo + (bitsh - 1)) / bitsh; /* ceil((bitshi + 1 - bitslo) / bitsh) */
+
+    int i, j, x[rows][cols];
+    long cpumin = 10;
+    timeit_t tottime;
+
+    timeit_start(tottime);
+
+    fmpz_poly_randinit();
+
+    for (len = lenlo, j = 0; len <= lenhi; len += lenh, j++)
+    {
+        for (bits = bitslo, i = 0; bits <= bitshi; bits += bitsh, i++)
+        {
+            /*
+               Run the three methods and find out which is fastest.
+             */
+            fmpz_poly_t f, g, h;
+            timeit_t t[3];
+            long l, loops = 1;
+
+            fmpz_poly_init2(f, len);
+            fmpz_poly_init2(g, len);
+            fmpz_poly_init2(h, 2*len - 1);
+
+            fmpz_poly_randtest_not_zero(f, len, bits);
+            fmpz_poly_randtest_not_zero(g, len, bits);
+
+          loop:
+
+            timeit_start(t[0]);
+            for (l = 0; l < loops; l++)
+                fmpz_poly_mul_classical(h, f, g);
+            timeit_stop(t[0]);
+
+            timeit_start(t[1]);
+            for (l = 0; l < loops; l++)
+                fmpz_poly_mul_karatsuba(h, f, g);
+            timeit_stop(t[1]);
+
+            timeit_start(t[2]);
+            for (l = 0; l < loops; l++)
+                fmpz_poly_mul_KS(h, f, g);
+            timeit_stop(t[2]);
+
+            if (t[0]->cpu <= 10 || t[1]->cpu <= 10 || t[2]->cpu <= 10)
+            {
+                loops *= 10;
+                goto loop;
+            }
+
+            printf("%ld %ld %lf.3 %lf.3 %lf.3\n", len, bits, t[0]->cpu / (double) loops, t[1]->cpu / (double) loops, t[2]->cpu / (double) loops);
+
+            if (t[0]->cpu <= t[1]->cpu && t[0]->cpu <= t[2]->cpu)
+                x[i][j] = 0;
+            else if (t[1]->cpu <= t[2]->cpu)
+                x[i][j] = 1;
+            else
+                x[i][j] = 2;
+
+            fmpz_poly_clear(f);
+            fmpz_poly_clear(g);
+            fmpz_poly_clear(h);
+        }
+    }
+
+    timeit_stop(tottime);
+
+    printf("Total time: %ldms\n", tottime->cpu);
+
+    for (i = 0; i < rows; i++)
+    {
+        for (j = 0; j < cols; j++)
+            printf("%d", x[i][j]);
+        printf("\n");
+    }
+
+    fmpz_poly_randclear();
+}


Disable codecs which we don't have license for for now

--- gst/codecbin/plugin.c
+++ gst/codecbin/plugin.c
@@ -19,12 +19,14 @@
   return
       gst_element_register (plugin, "mpeg4vdec", GST_RANK_PRIMARY + 10,
       gst_mpeg4v_dec_get_type ()) &&
-      gst_element_register (plugin, "mpeg2vdec", GST_RANK_PRIMARY + 10,
-      gst_mpeg2v_dec_get_type ()) &&
-      gst_element_register (plugin, "vc1vdec", GST_RANK_PRIMARY + 10,
-      gst_vc1v_dec_get_type ()) &&
-      gst_element_register (plugin, "h263dec", GST_RANK_PRIMARY + 10,
-      gst_h263_dec_get_type ()) &&
+      /*
+         gst_element_register (plugin, "mpeg2vdec", GST_RANK_PRIMARY + 10,
+         gst_mpeg2v_dec_get_type ()) &&
+         gst_element_register (plugin, "vc1vdec", GST_RANK_PRIMARY + 10,
+         gst_vc1v_dec_get_type ()) &&
+         gst_element_register (plugin, "h263dec", GST_RANK_PRIMARY + 10,
+         gst_h263_dec_get_type ()) &&
+       */
       gst_element_register (plugin, "h264dec", GST_RANK_PRIMARY + 10,
       gst_h264_dec_get_type ());
 }


flvdemux: Introduce constant for no-more-pads threshold

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

--- gst/flv/gstflvdemux.c
+++ gst/flv/gstflvdemux.c
@@ -96,6 +96,9 @@

 /* two seconds - consider dts are resynced to another base if this different */
 #define RESYNC_THRESHOLD 2000
+
+/* how much stream time to wait for audio tags to appear after we have video, or vice versa */
+#define NO_MORE_PADS_THRESHOLD (6 * GST_SECOND)

 static gboolean flv_demux_handle_seek_push (GstFlvDemux * demux,
     GstEvent * event);
@@ -1171,7 +1174,7 @@

   if (G_UNLIKELY (!demux->no_more_pads
           && (GST_CLOCK_DIFF (demux->audio_start,
-                  GST_BUFFER_TIMESTAMP (outbuf)) > 6 * GST_SECOND))) {
+                  GST_BUFFER_TIMESTAMP (outbuf)) > NO_MORE_PADS_THRESHOLD))) {
     GST_DEBUG_OBJECT (demux,
         "Signalling no-more-pads because no video stream was found"
         " after 6 seconds of audio");
@@ -1558,7 +1561,7 @@

   if (G_UNLIKELY (!demux->no_more_pads
           && (GST_CLOCK_DIFF (demux->video_start,
-                  GST_BUFFER_TIMESTAMP (outbuf)) > 6 * GST_SECOND))) {
+                  GST_BUFFER_TIMESTAMP (outbuf)) > NO_MORE_PADS_THRESHOLD))) {
     GST_DEBUG_OBJECT (demux,
         "Signalling no-more-pads because no audio stream was found"
         " after 6 seconds of video");


Replace unused errno with a '>' character to distinguish GDAL messages from db messages

--- ogr_fdw.c
+++ ogr_fdw.c
@@ -171,19 +171,19 @@
 	switch (eErrClass)
 	{
 		case CE_None:
-			elog(NOTICE, "[%d] %s", err_no, msg);
-			return;
+			elog(NOTICE, "> %s", err_no, msg);
+			break;
 		case CE_Debug:
-			elog(DEBUG2, "[%d] %s", err_no, msg);
-			return;
+			elog(DEBUG2, "> %s", err_no, msg);
+			break;
 		case CE_Warning:
-			elog(WARNING, "[%d] %s", err_no, msg);
-			return;
+			elog(WARNING, "> %s", err_no, msg);
+			break;
 		case CE_Failure:
 		case CE_Fatal:
 		default:
-			elog(ERROR, "[%d] %s", err_no, msg);
-			return;
+			elog(ERROR, "> %s", err_no, msg);
+			break;
 	}
 	return;
 }


pluginloader: Don't call memcpy() with NULL src and 0 length

--- gst/gstpluginloader.c
+++ gst/gstpluginloader.c
@@ -586,7 +586,8 @@
   /* 4 bytes packet length */
   GST_WRITE_UINT32_BE (out + 4, payload_len);
   /* payload */
-  memcpy (out + HEADER_SIZE, payload, payload_len);
+  if (payload && payload_len)
+    memcpy (out + HEADER_SIZE, payload, payload_len);
   /* Write magic into the header */
   GST_WRITE_UINT32_BE (out + 8, HEADER_MAGIC);


GtkStyleContext: Invalidate contexts with a path

Fixes a tiny typo in commit f51c9d4154ba1ce4f20f7c4b7f705fe2756cb8ab
which manifested itself in GtkSpinButton's panels being drawn with an
incorrect, not updated state.

This patch took me more hours than you might think! :P

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

--- gtk/gtkstylecontext.c
+++ gtk/gtkstylecontext.c
@@ -3373,7 +3373,7 @@
       priv->pending_changes |= change;
       gtk_style_context_set_invalid (context, TRUE);
     }
-  else if (priv->widget_path == NULL)
+  else if (priv->widget_path != NULL)
     {
       G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
       gtk_style_context_invalidate (context);


new window

new window

--- menu_testing/src/feature_menu_layer.c
+++ menu_testing/src/feature_menu_layer.c
@@ -5,7 +5,9 @@
 #define NUM_FIRST_MENU_ITEMS 15

 static Window *s_main_window;
+static Window *new_window;
 static MenuLayer *s_menu_layer;
+static TextLayer *arrow;
 static GBitmap *s_menu_icons[NUM_MENU_ICONS];
 static GBitmap *s_background_bitmap;

@@ -53,7 +55,17 @@
         menu_cell_title_draw(ctx, cell_layer, "xxxxx Item");
       }
 }
-
+static void window_load(Window *window) {
+  arrow = text_layer_create(GRect(0, 55, 144, 50));
+  text_layer_set_background_color(arrow, GColorClear);
+  text_layer_set_text_color(arrow, GColorBlack);
+  text_layer_set_text(arrow, "00:00");
+
+  layer_add_child(window_get_root_layer(window), text_layer_get_layer(arrow));
+}
+static void window_unload(Window *window) {
+  window_destroy(new_window);
+}

 //clicked!
 static void menu_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *data) {
@@ -70,9 +82,15 @@
   dict_write_end(iter);

   app_message_outbox_send();
+
+   new_window=window_create();
+    window_set_window_handlers(new_window, (WindowHandlers) {
+    .load = window_load,
+    .unload = window_unload,
+  });
+  window_stack_push(new_window, true);

 }
-

 static void main_window_load(Window *window) {


stylecontext: Actually use superset matcher

... when looking up the needed changes.

This is what that matcher was actually written for, but it seems I never
hooked it in.

--- gtk/gtkstylecontext.c
+++ gtk/gtkstylecontext.c
@@ -3035,12 +3035,15 @@
       if (priv->relevant_changes == GTK_CSS_CHANGE_ANY)
         {
           GtkWidgetPath *path;
-          GtkCssMatcher matcher;
+          GtkCssMatcher matcher, superset;

           path = create_query_path (context, priv->info);
           if (_gtk_css_matcher_init (&matcher, path, priv->info->state_flags))
-            priv->relevant_changes = _gtk_style_provider_private_get_change (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
-                                                                             &matcher);
+            {
+              _gtk_css_matcher_superset_init (&superset, &matcher, GTK_STYLE_CONTEXT_RADICAL_CHANGE & ~GTK_CSS_CHANGE_SOURCE);
+              priv->relevant_changes = _gtk_style_provider_private_get_change (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
+                                                                               &superset);
+            }
           else
             priv->relevant_changes = 0;


nvim: remove unused structure field

nvim: remove unused structure field

This is probably a relicate of a previous tab implementation. It has
never actually been used.

--- src/include/eovim/nvim.h
+++ src/include/eovim/nvim.h
@@ -51,7 +51,6 @@
    Ecore_Exe *exe;
    Eina_List *requests;
    Eina_Hash *modes;
-   Eina_Inlist *tabs;

    msgpack_unpacker unpacker;
    msgpack_sbuffer sbuffer;


removing whitespace

removing whitespace

git-svn-id: d3d46767b8f15aa15dc28b4413db96165ce057f7@5086 140774ce-b5e7-0310-ab8b-a85725594a96

--- src/include/microhttpd.h
+++ src/include/microhttpd.h
@@ -162,7 +162,7 @@
   /**
    * Run using one thread per connection.
    */
-  MHD_USE_THREAD_PER_CONNECTION = 4,
+  MHD_USE_THREAD_PER_CONNECTION = 4,

   /**
    * Run using an internal thread doing SELECT.
@@ -221,13 +221,13 @@

 /**
  * Allow or deny a client to connect.
- *
+ *
  *
  * @param addr address information from the client
  * @param addrlen length of the address information
  * @return MHD_YES if connection is allowed, MHD_NO if not
  */
-typedef int
+typedef int
 (*MHD_AcceptPolicyCallback)(void * cls,
 			    const struct sockaddr * addr,
 			    socklen_t addrlen);
@@ -260,7 +260,7 @@
  * also to iterate over the headers that have been
  * added to a response.
  *
- * @return MHD_YES to continue iterating,
+ * @return MHD_YES to continue iterating,
  *         MHD_NO to abort the iteration
  */
 typedef int
@@ -289,11 +289,11 @@
  *        be queried multiple times for the same data;
  *        however, if an MHD_Response is not re-used,
  *        libmicrohttpd guarantees that "pos" will be
- *        the sum of all non-negative return values
+ *        the sum of all non-negative return values
  *        obtained from the content reader so far.
  * @return -1 on error (libmicrohttpd will no longer
  *  try to read content and instead close the connection
- *  with the client).
+ *  with the client).
  */
 typedef int
 (*MHD_ContentReaderCallback)(void * cls,
@@ -344,7 +344,7 @@
  *         daemon was not started with the right
  *         options for this call.
  */
-int
+int
 MHD_get_fdset(struct MHD_Daemon * daemon,
 	      fd_set * read_fd_set,
 	      fd_set * write_fd_set,
@@ -355,7 +355,7 @@
  * Run webserver operations (without blocking unless
  * in client callbacks).  This method should be called
  * by clients in combination with MHD_get_fdset
- * if the client-controlled select method is used.
+ * if the client-controlled select method is used.
  *
  * @return MHD_YES on success, MHD_NO if this
  *         daemon was not started with the right
@@ -368,11 +368,11 @@
 /**
  * Register an access handler for all URIs beginning with uri_prefix.
  *
- * @param uri_prefix
+ * @param uri_prefix
  * @return MRI_NO if a handler for this exact prefix
  *         already exists
  */
-int
+int
 MHD_register_handler(struct MHD_Daemon * daemon,
 		     const char * uri_prefix,
 		     MHD_AccessHandlerCallback dh,
@@ -382,11 +382,11 @@
  * Unregister an access handler for the URIs beginning with
  * uri_prefix.
  *
- * @param uri_prefix
+ * @param uri_prefix
  * @return MHD_NO if a handler for this exact prefix
  *         is not known for this daemon
  */
-int
+int
 MHD_unregister_handler(struct MHD_Daemon * daemon,
 		       const char * uri_prefix,
 		       MHD_AccessHandlerCallback dh,
@@ -399,7 +399,7 @@
  *        maybe NULL (then just count headers)
  * @param iterator_cls extra argument to iterator
  * @return number of entries iterated over
- */
+ */
 int
 MHD_get_session_values(struct MHD_Session * session,
 		       enum MHD_ValueKind kind,
@@ -412,7 +412,7 @@
  *
  * @param key the header to look for
  * @return NULL if no such item was found
- */
+ */
 const char *
 MHD_lookup_session_value(struct MHD_Session * session,
 			 enum MHD_ValueKind kind,
@@ -421,19 +421,19 @@
 /**
  * Queue a response to be transmitted to the client (as soon as
  * possible).
- *
+ *
  * @param session the session identifying the client
  * @param status_code HTTP status code (i.e. 200 for OK)
  * @param response response to transmit
  * @return MHD_NO on error (i.e. reply already sent),
  *         MHD_YES on success or if message has been queued
  */
-int
+int
 MHD_queue_response(struct MHD_Session * session,
 		   unsigned int status_code,
 		   struct MHD_Response * response);

-
+
 /**
  * Create a response object.  The response object can be extended with
  * header information and then be used any number of times.
@@ -457,7 +457,7 @@
  * @param size size of the data portion of the response
  * @param data the data itself
  * @param must_free libmicrohttpd should free data when done
- * @param must_copy libmicrohttpd must make a copy of data
+ * @param must_copy libmicrohttpd must make a copy of data
  *        right away, the data maybe released anytime after
  *        this call returns
  * @return NULL on error (i.e. invalid arguments, out of memory)
@@ -504,7 +504,7 @@
  *        maybe NULL (then just count headers)
  * @param iterator_cls extra argument to iterator
  * @return number of entries iterated over
- */
+ */
 int
 MHD_get_response_headers(struct MHD_Response * response,
 			 MHD_KeyValueIterator iterator,
@@ -516,7 +516,7 @@
  *
  * @param key which header to get
  * @return NULL if header does not exist
- */
+ */
 const char *
 MHD_get_response_header(struct MHD_Response * response,
 			const char * key);


remove useless includes

remove useless includes

--- src/include/mm/fractal.h
+++ src/include/mm/fractal.h
@@ -15,10 +15,6 @@
  */
 #ifndef MM_FRACTAL_H
 #define MM_FRACTAL_H
-
-#include <iostream>
-#include <cassert>
-#include <cmath>

 #include <mm/heightmap.h>
 #include <mm/random.h>


periodic checkin

periodic checkin

--- src/include/mod_python.h
+++ src/include/mod_python.h
@@ -69,7 +69,7 @@
  *
  * mod_python.c
  *
- * $Id: mod_python.h,v 1.2 2000/10/18 20:01:29 gtrubetskoy Exp $
+ * $Id: mod_python.h,v 1.3 2000/10/18 22:56:48 gtrubetskoy Exp $
  *
  * See accompanying documentation and source code comments
  * for details.
@@ -101,6 +101,9 @@
 #if !defined(WIN32)
 #include <sys/socket.h>
 #endif
+
+/* _apache initialization function */
+void init_apache();

 /* pool given to us in ChildInit. We use it for
    server.register_cleanup() */


gstrtpj2kpay: use tile bit and tile number to determine if there are multiple tiles in packet

Now we don't have to rely on a special value for the tile number.

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

--- gst/rtp/gstrtpj2kpay.c
+++ gst/rtp/gstrtpj2kpay.c
@@ -188,7 +188,7 @@
 typedef struct
 {
   RtpJ2KHeader header;
-  gboolean multi_tile_part;
+  gboolean multi_tile;
   gboolean bitstream;
   guint next_sot;
   gboolean force_packet;
@@ -271,15 +271,13 @@
           /* Isot */
           tile = GST_READ_UINT16_BE (&data[offset + 2]);

-          if (!state->multi_tile_part) {
-
-            /* tile is marked as valid */
-            state->header.T = 0;
-
-            /* we have detected multiple tile parts in this rtp packet : tile bit is now invalid */
-            if (state->header.tile != tile) {
+          if (!state->multi_tile) {
+            /* we have detected multiple tiles in this rtp packet : tile bit is now invalid */
+            if (state->header.T == 0 && state->header.tile != tile) {
               state->header.T = 1;
-              state->multi_tile_part = TRUE;
+              state->multi_tile = TRUE;
+            } else {
+              state->header.T = 0;
             }
           }
           state->header.tile = tile;
@@ -363,7 +361,7 @@
   state.header.priority = 255;  /* always 255 for now */
   state.header.tile = 0xffff;   /* no tile number */
   state.header.offset = 0;      /* offset of 0 */
-  state.multi_tile_part = FALSE;
+  state.multi_tile = FALSE;
   state.bitstream = FALSE;
   state.next_sot = 0;
   state.force_packet = FALSE;
@@ -515,7 +513,7 @@
       gst_buffer_list_add (list, outbuf);

       /* reset multi_tile */
-      state.multi_tile_part = FALSE;
+      state.multi_tile = FALSE;

       /* set MHF to zero if there is no more main header to process */


y4menc: fix uninitialized variable warning

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

--- gst/y4m/gsty4mencode.c
+++ gst/y4m/gsty4mencode.c
@@ -276,7 +276,7 @@
   timestamp = GST_BUFFER_TIMESTAMP (buf);

   if (G_UNLIKELY (!filter->header)) {
-    gboolean tff;
+    gboolean tff = FALSE;

     if (GST_VIDEO_INFO_IS_INTERLACED (&filter->info)) {
       tff = GST_BUFFER_FLAG_IS_SET (buf, GST_VIDEO_BUFFER_FLAG_TFF);


Added helper to serialize messages.

Added helper to serialize messages.

--- src/anh/observer/observer_interface.h
+++ src/anh/observer/observer_interface.h
@@ -12,6 +12,15 @@
     public:
         virtual ~ObserverInterface() {}

+        template<typename T>
+        void Notify(const T& message)
+        {
+            anh::ByteBuffer buffer;
+            message.serialize(buffer);
+
+            Notify(buffer);
+        }
+
         /**
          * Notifies observer that the observable object has changed state.
          *


Staging: rtl8192u: Added #include <linux/uaccess.h> instead of <asm/uaccess.h>

The following patch fixes the checkpatch.pl warning:
WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>

Signed-off-by: Dilek Uzulmez <c4c744022665004477b72b0a2baeb9f8cefe02eb@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


staging: rtl8723au: rtw_cfg80211_set_encryption(): Obtain key from key_params->key

Signed-off-by: Jes Sorensen <0e1e349bdba396f044a06b01fef702e072aa66d3@redhat.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


staging: wilc1000: set_channel: fix data type of s32Error

This patch changes data type of s32Error variable from s32 to int
because return type of this function is int.

Signed-off-by: Chaehyun Lim <cbe9b9d6f673cb1ece7082f467dd3b6acd0f8185@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


Fix memory leak of xml doc in folder hierarchy message

--- eas-daemon/libeas/eas-sync-folder-hierarchy-req.c
+++ eas-daemon/libeas/eas-sync-folder-hierarchy-req.c
@@ -296,6 +296,7 @@
 	eas_sync_folder_hierarchy_req_return (priv->results_fn_data, ret_sync_key, added_folders,
 										  updated_folders, deleted_folders, error);

+	xmlFreeDoc (doc);
     g_debug ("eas_sync_folder_hierarchy_req_MessageComplete--");
 	return TRUE;
 }


Fix condition for first double-sync, fix use-after-free when it happens

--- eas-daemon/libeas/eas-sync-folder-hierarchy-req.c
+++ eas-daemon/libeas/eas-sync-folder-hierarchy-req.c
@@ -117,7 +117,7 @@
     priv->accountID = g_strdup (accountId);
     eas_request_base_SetContext (&self->parent_instance, context);

-    if (syncKey && !g_strcmp0 (syncKey, "0"))
+    if (syncKey && g_strcmp0 (syncKey, "0"))
     {
         priv->state = EasSyncFolderHierarchyStep2;
     }
@@ -225,12 +225,6 @@
             //get syncKey
             const gchar* syncKey = eas_sync_folder_msg_get_syncKey (priv->syncFolderMsg);
             xmlDoc *newMsgDoc = NULL;
-
-            //clean up old message
-            if (priv->syncFolderMsg)
-            {
-                g_object_unref (priv->syncFolderMsg);
-            }

             //create new message with new syncKey
             priv->syncFolderMsg = eas_sync_folder_msg_new (syncKey, priv->accountID);


siphash: Replace current hash algorithm by SipHash

--- expat/lib/xmlparse.c
+++ expat/lib/xmlparse.c
@@ -33,6 +33,7 @@

 #include "ascii.h"
 #include "expat.h"
+#include "siphash.h"

 #ifdef XML_UNICODE
 #define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX
@@ -111,17 +112,11 @@
   const XML_Memory_Handling_Suite *mem;
 } HASH_TABLE;

-/* Basic character hash algorithm, taken from Python's string hash:
-   h = h * 1000003 ^ character, the constant being a prime number.
-
-*/
-#ifdef XML_UNICODE
-#define CHAR_HASH(h, c) \
-  (((h) * 0xF4243) ^ (unsigned short)(c))
-#else
-#define CHAR_HASH(h, c) \
-  (((h) * 0xF4243) ^ (unsigned char)(c))
-#endif
+static size_t
+keylen(KEY s);
+
+static void
+copy_salt_to_sipkey(XML_Parser parser, struct sipkey * key);

 /* For probing (after a collision) we need a step size relative prime
    to the hash table size, which is a power of 2. We use double-hashing,
@@ -3245,7 +3240,13 @@
       if (s[-1] == 2) {  /* prefixed */
         ATTRIBUTE_ID *id;
         const BINDING *b;
-        unsigned long uriHash = get_hash_secret_salt(parser);
+        unsigned long uriHash;
+        struct siphash sip_state;
+        struct sipkey sip_key;
+
+        copy_salt_to_sipkey(parser, &sip_key);
+        sip24_init(&sip_state, &sip_key);
+
         ((XML_Char *)s)[-1] = 0;  /* clear flag */
         id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0);
         if (!id || !id->prefix)
@@ -3254,21 +3255,25 @@
         if (!b)
           return XML_ERROR_UNBOUND_PREFIX;

-        /* as we expand the name we also calculate its hash value */
         for (j = 0; j < b->uriLen; j++) {
           const XML_Char c = b->uri[j];
           if (!poolAppendChar(&tempPool, c))
             return XML_ERROR_NO_MEMORY;
-          uriHash = CHAR_HASH(uriHash, c);
-        }
+        }
+
+        sip24_update(&sip_state, b->uri, b->uriLen * sizeof(XML_Char));
+
         while (*s++ != XML_T(ASCII_COLON))
           ;
+
+        sip24_update(&sip_state, s, keylen(s) * sizeof(XML_Char));
+
         do {  /* copies null terminator */
-          const XML_Char c = *s;
           if (!poolAppendChar(&tempPool, *s))
             return XML_ERROR_NO_MEMORY;
-          uriHash = CHAR_HASH(uriHash, c);
         } while (*s++);
+
+        uriHash = (unsigned long)sip24_final(&sip_state);

         { /* Check hash table for duplicate of expanded name (uriName).
              Derived from code in lookup(parser, HASH_TABLE *table, ...).
@@ -6302,13 +6307,32 @@
   return XML_FALSE;
 }

+static size_t
+keylen(KEY s)
+{
+  size_t len = 0;
+  for (; *s; s++, len++);
+  return len;
+}
+
+static void
+copy_salt_to_sipkey(XML_Parser parser, struct sipkey * key)
+{
+  key->k[0] = 0;
+  key->k[1] = get_hash_secret_salt(parser);
+}
+
 static unsigned long FASTCALL
 hash(XML_Parser parser, KEY s)
 {
-  unsigned long h = get_hash_secret_salt(parser);
-  while (*s)
-    h = CHAR_HASH(h, *s++);
-  return h;
+  struct siphash state;
+  struct sipkey key;
+  (void)sip_tobin;
+  (void)sip24_valid;
+  copy_salt_to_sipkey(parser, &key);
+  sip24_init(&state, &key);
+  sip24_update(&state, s, keylen(s) * sizeof(XML_Char));
+  return (unsigned long)sip24_final(&state);
 }

 static NAMED *


Prevent integer overflow in copyString

Prevent integer overflow in copyString

The copyString function is only used for encoding string supplied by
the library user.

--- expat/lib/xmlparse.c
+++ expat/lib/xmlparse.c
@@ -7412,7 +7412,7 @@

 static XML_Char *
 copyString(const XML_Char *s, const XML_Memory_Handling_Suite *memsuite) {
-  int charsRequired = 0;
+  size_t charsRequired = 0;
   XML_Char *result;

   /* First determine how long the string is */


The function clnt_dg_call(), which is used for UDP RPC calls, could
accidentally clobber the server address if a stray packet arrived
at the client port. This would result in any further retransmits
going to the wrong address.

For now, fix this by not saving the source address of the reply; this
matches the pre-tirpc behaviour.

--- lib/libc/rpc/clnt_dg.c
+++ lib/libc/rpc/clnt_dg.c
@@ -310,7 +310,7 @@
 	int dtbsize = __rpc_dtbsize();
 	sigset_t mask;
 	sigset_t newmask;
-	socklen_t fromlen, inlen;
+	socklen_t inlen;
 	ssize_t recvlen = 0;
 	int rpc_lock_value;
 	u_int32_t xid;
@@ -492,10 +492,8 @@
 				 */
 				errno = 0;
 			}
-			fromlen = sizeof (struct sockaddr_storage);
 			recvlen = _recvfrom(cu->cu_fd, cu->cu_inbuf,
-			    cu->cu_recvsz, 0, (struct sockaddr *)(void *)&cu->cu_raddr,
-			    &fromlen);
+			    cu->cu_recvsz, 0, NULL, NULL);
 		} while (recvlen < 0 && errno == EINTR);
 		if (recvlen < 0) {
 			if (errno == EWOULDBLOCK)


IOT-2539 Cleanup unused-parameter warning

This is a set of code that will sometimes have a warning
depending on what is defined. To prevent the
unused-parameter warning the parameters are cast to void.
A empty operation that will be compiled out but prevents
the warning.

Bug: https://jira.iotivity.org/browse/IOT-2539
Change-Id: I08c73fb565b62d3a760956976a012331863a6c73
Signed-off-by: George Nash <acbdc39d528a4315fe0b532d55c50ae46f5c1667@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21769
Tested-by: jenkins-iotivity <d95b56ce41a2e1ac4cecdd398defd7414407cc08@iotivity.org>
Reviewed-by: Dan Mihai <ba8e1833495515b49ded9e20cae80a8129155aa9@microsoft.com>
(cherry picked from commit 598e8c5b7e7ad9cfc6fab77f5843e5e390509728)

--- resource/csdk/connectivity/lib/libcoap-4.1.1/debug.c
+++ resource/csdk/connectivity/lib/libcoap-4.1.1/debug.c
@@ -140,6 +140,11 @@

 size_t
 coap_print_addr(const struct coap_address_t *addr, unsigned char *buf, size_t len) {
+    // Depending on what is defined its possible that the input parameters
+    // are not used. Cast them to void avoid unused-parameter warnings
+    (void)addr;
+    (void)buf;
+    (void)len;
 #if defined(HAVE_ARPA_INET_H) || defined(_WIN32)
     const void *addrptr = NULL;
 #if defined(__ANDROID__)


Zerocopy crypto_secretbox_open_easy()

Zerocopy crypto_secretbox_open_easy()

--- src/libsodium/crypto_secretbox/crypto_secretbox_easy.c
+++ src/libsodium/crypto_secretbox/crypto_secretbox_easy.c
@@ -68,39 +68,42 @@
                            unsigned long long clen, const unsigned char *n,
                            const unsigned char *k)
 {
-    unsigned char *c_boxed;
-    unsigned char *m_boxed;
-    size_t         c_boxed_len;
-    size_t         m_boxed_len;
-    int            rc;
+    unsigned char                     block0[64U];
+    unsigned char                     subkey[crypto_stream_salsa20_KEYBYTES];
+    unsigned long long                i;
+    unsigned long long                mlen0;

-    (void) sizeof(int[crypto_secretbox_BOXZEROBYTES + crypto_secretbox_MACBYTES
-                      == crypto_secretbox_ZEROBYTES ? 1 : -1]);
-    if (clen < crypto_secretbox_MACBYTES ||
-        clen > SIZE_MAX - crypto_secretbox_BOXZEROBYTES) {
+    if (clen < crypto_secretbox_MACBYTES) {
         return -1;
     }
-    c_boxed_len = clen + crypto_secretbox_BOXZEROBYTES;
-    if ((c_boxed = (unsigned char *) malloc(c_boxed_len)) == NULL) {
+    crypto_core_hsalsa20(subkey, n, k, sigma);
+    crypto_stream_salsa20(block0, crypto_stream_salsa20_KEYBYTES,
+                          n + 16, subkey);
+    if (crypto_onetimeauth_poly1305_verify(c, c + crypto_secretbox_MACBYTES,
+                                           clen - crypto_secretbox_MACBYTES,
+                                           block0) != 0) {
+        sodium_memzero(subkey, sizeof subkey);
         return -1;
     }
-    memset(c_boxed, 0, crypto_secretbox_BOXZEROBYTES);
-    memcpy(c_boxed + crypto_secretbox_BOXZEROBYTES, c, clen);
-    m_boxed_len = crypto_secretbox_ZEROBYTES + (clen - crypto_secretbox_MACBYTES);
-    if ((m_boxed = (unsigned char *) malloc(m_boxed_len)) == NULL) {
-        free(c_boxed);
-        return -1;
+    mlen0 = clen - crypto_secretbox_MACBYTES;
+    if (mlen0 > 64U - crypto_secretbox_ZEROBYTES) {
+        mlen0 = 64U - crypto_secretbox_ZEROBYTES;
     }
-    rc = crypto_secretbox_open(m_boxed, c_boxed,
-                               (unsigned long long) c_boxed_len, n, k);
-    free(c_boxed);
-    if (rc != 0) {
-        free(m_boxed);
-        return -1;
+    memcpy(block0 + crypto_secretbox_ZEROBYTES,
+           c + crypto_secretbox_MACBYTES, mlen0);
+    crypto_stream_salsa20_xor(block0, block0,
+                              crypto_secretbox_ZEROBYTES + mlen0,
+                              n + 16, subkey);
+    for (i = 0U; i < mlen0; i++) {
+        m[i] = block0[i + crypto_secretbox_ZEROBYTES];
     }
-    memcpy(m, m_boxed + crypto_secretbox_ZEROBYTES,
-           clen - crypto_secretbox_MACBYTES);
-    free(m_boxed);
+    if (clen - crypto_secretbox_MACBYTES > mlen0) {
+        crypto_stream_salsa20_xor_ic(m + mlen0,
+                                     c + crypto_secretbox_MACBYTES + mlen0,
+                                     clen - crypto_secretbox_MACBYTES - mlen0,
+                                     n + 16, 1U, subkey);
+    }
+    sodium_memzero(subkey, sizeof subkey);

     return 0;
 }


Don't use deprecated style api

Don't use deprecated style api

gtk_widget_modify_font() has been superseded by
gtk_widget_override_font(), so use that in GtkMessageDialog.

--- gtk/gtkmessagedialog.c
+++ gtk/gtkmessagedialog.c
@@ -391,7 +391,7 @@
   GtkStateFlags state;

   /* unset the font settings */
-  gtk_widget_modify_font (priv->label, NULL);
+  gtk_widget_override_font (priv->label, NULL);

   if (priv->has_secondary_text && !priv->has_primary_markup)
     {
@@ -402,7 +402,7 @@
       font_desc = pango_font_description_new ();
       pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
       pango_font_description_set_size (font_desc, size * PANGO_SCALE_LARGE);
-      gtk_widget_modify_font (priv->label, font_desc);
+      gtk_widget_override_font (priv->label, font_desc);
       pango_font_description_free (font_desc);
     }
 }


zephyr: lazor: add the write-protection switch interrupt

Add the write-protection switch interrupt. The switch state can be
updated in time.

BRANCH=None
BUG=b:182398910
TEST=Changed the write-protection switch in Cr50 console.
Checked the interrupts were triggered and showed the messages:
[225.050900 SW 0x05] # The WP bitmask is 0x4.
[230.853700 SW 0x01]

Change-Id: I8bd801ac872b9f7b91895e504069f91921c9592f
Signed-off-by: Wai-Hong Tam <04b587fdf5845741a0c5a8b9cd59ca72d73ef8fc@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2831051
Reviewed-by: Jack Rosenthal <d3f605bef1867f59845d4ce6e4f83b8dc9e4e0ae@chromium.org>
Commit-Queue: Jack Rosenthal <d3f605bef1867f59845d4ce6e4f83b8dc9e4e0ae@chromium.org>

--- zephyr/projects/trogdor/lazor/include/gpio_map.h
+++ zephyr/projects/trogdor/lazor/include/gpio_map.h
@@ -27,6 +27,7 @@
 #define EC_CROS_GPIO_INTERRUPTS                                               \
 	GPIO_INT(GPIO_AC_PRESENT, GPIO_INT_EDGE_BOTH, extpower_interrupt)     \
 	GPIO_INT(GPIO_LID_OPEN, GPIO_INT_EDGE_BOTH, lid_interrupt)            \
+	GPIO_INT(GPIO_WP_L, GPIO_INT_EDGE_BOTH, switch_interrupt)             \
 	GPIO_INT(GPIO_POWER_BUTTON_L, GPIO_INT_EDGE_BOTH,                     \
 		 power_button_interrupt)                                      \
 	GPIO_INT(GPIO_VOLUME_DOWN_L, GPIO_INT_EDGE_BOTH, button_interrupt)    \


GtkPlacesSidebar: Remove to FIXMEs

GtkPlacesSidebar: Remove to FIXMEs

It doesn't hurt to just add the ref here, as the FIXME suggests.

--- gtk/gtkplacessidebar.c
+++ gtk/gtkplacessidebar.c
@@ -2859,7 +2859,7 @@
       g_error_free (error);
     }

-  /* FIXME: drive_stop_cb() gets a reffed sidebar, and unrefs it.  Do we need to do the same here? */
+  g_object_unref (sidebar);
 }

 static void
@@ -2878,7 +2878,7 @@

   if (drive != NULL)
     {
-      g_drive_poll_for_media (drive, NULL, drive_poll_for_media_cb, sidebar);
+      g_drive_poll_for_media (drive, NULL, drive_poll_for_media_cb, g_object_ref (sidebar));
       g_object_unref (drive);
     }
 }
@@ -2909,7 +2909,7 @@
       g_error_free (error);
     }

-  /* FIXME: drive_stop_cb() gets a reffed sidebar, and unrefs it.  Do we need to do the same here? */
+  g_object_unref (sidebar);
 }

 static void
@@ -2932,7 +2932,7 @@

       mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar))));

-      g_drive_start (drive, G_DRIVE_START_NONE, mount_op, NULL, drive_start_cb, sidebar);
+      g_drive_start (drive, G_DRIVE_START_NONE, mount_op, NULL, drive_start_cb, g_object_ref (sidebar));

       g_object_unref (mount_op);
       g_object_unref (drive);


tests BUGFIX memory leaks

tests BUGFIX memory leaks

--- tests/api/test_tree_data.c
+++ tests/api/test_tree_data.c
@@ -528,7 +528,7 @@
     assert_string_equal(node->schema->name, "l");
     assert_ptr_not_equal(root->prev, root);

-    lyd_free(root);
+    lyd_free_withsiblings(root);

     root = lyd_new_path(NULL, ctx, "/a:l[key1='1'][key2='2']", NULL, 0);
     assert_non_null(root);
@@ -548,7 +548,7 @@
     assert_non_null(node);
     assert_string_equal(node->schema->name, "value");

-    lyd_free(root);
+    lyd_free_withsiblings(root);

     root = lyd_new_path(NULL, ctx, "/a:rpc1/x/input-leaf2", "dudu", 0);
     assert_non_null(root);


Disabled script range selection for interactive fit

--- fox-gui/interactive_fit.h
+++ fox-gui/interactive_fit.h
@@ -37,6 +37,7 @@

     m_all_parameters = fit_engine_get_all_parameters (m_fit_engine);

+    m_fit_engine->config->spectr_range.active = 0;
     m_fit_engine->config->subsampling = 0;

     m_model_spectr = spectra_alloc (m_ref_spectr);


Add padding to the themingengine class.

Add padding to the themingengine class.

--- gtk/gtkthemingengine.h
+++ gtk/gtkthemingengine.h
@@ -168,6 +168,9 @@
   GdkPixbuf * (* render_icon_pixbuf) (GtkThemingEngine    *engine,
                                       const GtkIconSource *source,
                                       GtkIconSize          size);
+
+  /*< private >*/
+  gpointer padding[16];
 };

 GType gtk_theming_engine_get_type (void) G_GNUC_CONST;
@@ -247,7 +250,6 @@

 GdkScreen * gtk_theming_engine_get_screen (GtkThemingEngine *engine);

-
 G_END_DECLS

 #endif /* __GTK_THEMING_ENGINE_H__ */


修正了jstd::basic_dictionary<K, V>::rehash()中的一个小bug;

Signed-off-by: shines77 <c816ee361b8bcaf7cf19d627e3bc89a63016b2b4@msn.com>

--- src/main/jimi/jstd/dictionary.h
+++ src/main/jimi/jstd/dictionary.h
@@ -460,9 +460,18 @@
                                 new_entry->pair.swap(old_entry->pair);
 #endif
                                 ++new_entry;
+                                ++old_entry;
                                 ++new_count;
                             }
-                            ++old_entry;
+                            else {
+#if USE_ENTRY_PLACEMENT_NEW
+                                // pair_type class placement delete
+                                pair_type * pair_ptr = &old_entry->pair;
+                                assert(pair_ptr != nullptr);
+                                pair_ptr->~pair_type();
+#endif
+                                ++old_entry;
+                            }
                         }
                         assert(new_count == this->size());


Remove now-obsolete comment.

Remove now-obsolete comment.

Submitted by:	netchild
MFC after:	1 week

--- sys/compat/linux/linux_futex.c
+++ sys/compat/linux/linux_futex.c
@@ -400,7 +400,7 @@
 		       "cmparg = %x, uaddr = %p\n",
 		       op, cmp, oparg, cmparg, uaddr);
 #endif
-	/* XXX: linux verifies access here and returns EFAULT */
+	/* XXX: Linux verifies access here and returns EFAULT */

 	switch (op) {
 	case FUTEX_OP_SET:
@@ -521,11 +521,6 @@
 		LINUX_CTR3(sys_futex, "WAKE uaddr %p val % d val3 %d",
 		    args->uaddr, args->val, args->val3);

-		/*
-		 * XXX: Linux is able to cope with different addresses
-		 * corresponding to the same mapped memory in the sleeping
-		 * and waker process(es).
-		 */
 #ifdef DEBUG
 		if (ldebug(sys_futex))
 			printf(ARGS(sys_futex, "futex_wake uaddr %p val %d val3 %d"),


Implement vfs clustering for msdosfs.

Implement vfs clustering for msdosfs.

This gives a very large speedup for small block sizes (in my tests,
about 5 times for write and 3 times for read with a block size of 512,
if clustering is possible) and a moderate speedup for the moderatatly
large block sizes that should be used on non-small media (4K is the
best size in most cases, and the speedup for that is about 1.3 times
for write and 1.2 times for read).  mmap() should benefit from clustering
like read()/write(), but the current implementation of vm only supports
clustering (at least for getpages) if the fs block size is >= PAGE SIZE.

msdosfs is now only slightly slower than ffs with soft updates for
writing and slightly faster for reading when both use their best block
sizes.  Writing is slower for msdosfs because of more sync writes.
Reading is faster for msdosfs because indirect blocks interfere with
clustering in ffs.

The changes in msdosfs_read() and msdosfs_write() are simpler merges
of corresponding code in ffs (after fixing some style bugs in ffs).
msdosfs_bmap() needs fs-specific code.  This implementation loops
calling a lower level bmap function to do the hard parts.  This is a
bit inefficient, but is efficient enough since msdsfs_bmap() is only
called when there is physical i/o to do.

Approved by:	re (hrs)

--- sys/fs/msdosfs/msdosfs_vnops.c
+++ sys/fs/msdosfs/msdosfs_vnops.c
@@ -598,6 +598,9 @@
 			error = bread(pmp->pm_devvp, lbn, blsize, NOCRED, &bp);
 		} else if (de_cn2off(pmp, rablock) >= dep->de_FileSize) {
 			error = bread(vp, lbn, blsize, NOCRED, &bp);
+		} else if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
+			error = cluster_read(vp, dep->de_FileSize, lbn, blsize,
+			    NOCRED, on + uio->uio_resid, seqcount, &bp);
 		} else if (seqcount > 1) {
 			rasize = blsize;
 			error = breadn(vp, lbn,
@@ -644,6 +647,7 @@
 	u_long osize;
 	int error = 0;
 	u_long count;
+	int seqcount;
 	daddr_t bn, lastcn;
 	struct buf *bp;
 	int ioflag = ap->a_ioflag;
@@ -729,6 +733,7 @@
 	} else
 		lastcn = de_clcount(pmp, osize) - 1;

+	seqcount = ioflag >> IO_SEQSHIFT;
 	do {
 		if (de_cluster(pmp, uio->uio_offset) > lastcn) {
 			error = ENOSPC;
@@ -797,19 +802,31 @@
 			break;
 		}

+		/* Prepare for clustered writes in some else clauses. */
+		if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0)
+			bp->b_flags |= B_CLUSTEROK;
+
 		/*
 		 * If IO_SYNC, then each buffer is written synchronously.
-		 * Otherwise, if on a
+		 * Otherwise, if we have a severe page deficiency then
+		 * write the buffer asynchronously.  Otherwise, if on a
 		 * cluster boundary then write the buffer asynchronously,
-		 * since we don't expect more writes into this
+		 * combining it with contiguous clusters if permitted and
+		 * possible, since we don't expect more writes into this
 		 * buffer soon.  Otherwise, do a delayed write because we
 		 * expect more writes into this buffer soon.
 		 */
 		if (ioflag & IO_SYNC)
 			(void)bwrite(bp);
-		else if (n + croffset == pmp->pm_bpcluster)
+		else if (vm_page_count_severe() || buf_dirty_count_severe())
 			bawrite(bp);
-		else
+		else if (n + croffset == pmp->pm_bpcluster) {
+			if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0)
+				cluster_write(vp, bp, dep->de_FileSize,
+				    seqcount);
+			else
+				bawrite(bp);
+		} else
 			bdwrite(bp);
 		dep->de_flag |= DE_UPDATE;
 	} while (error == 0 && uio->uio_resid > 0);
@@ -1778,10 +1795,12 @@
 	} */ *ap;
 {
 	struct denode *dep;
+	struct mount *mp;
 	struct msdosfsmount *pmp;
 	struct vnode *vp;
+	daddr_t runbn;
 	u_long cn;
-	int error;
+	int bnpercn, error, maxio, maxrun, run;

 	vp = ap->a_vp;
 	dep = VTODE(vp);
@@ -1798,7 +1817,31 @@
 	if (cn != ap->a_bn)
 		return (EFBIG);
 	error = pcbmap(dep, cn, ap->a_bnp, NULL, NULL);
-	return (error);
+	if (error != 0 || (ap->a_runp == NULL && ap->a_runb == NULL))
+		return (error);
+
+	mp = vp->v_mount;
+	maxio = mp->mnt_iosize_max / mp->mnt_stat.f_iosize;
+	bnpercn = de_cn2bn(pmp, 1);
+	if (ap->a_runp != NULL) {
+		maxrun = ulmin(maxio - 1, pmp->pm_maxcluster - cn);
+		for (run = 1; run <= maxrun; run++) {
+			if (pcbmap(dep, cn + run, &runbn, NULL, NULL) != 0 ||
+			    runbn != *ap->a_bnp + run * bnpercn)
+				break;
+		}
+		*ap->a_runp = run - 1;
+	}
+	if (ap->a_runb != NULL) {
+		maxrun = ulmin(maxio - 1, cn);
+		for (run = 1; run < maxrun; run++) {
+			if (pcbmap(dep, cn - run, &runbn, NULL, NULL) != 0 ||
+			    runbn != *ap->a_bnp - run * bnpercn)
+				break;
+		}
+		*ap->a_runb = run - 1;
+	}
+	return (0);
 }

 static int


glapi: Force frame pointer elimination on Windows.

To catch mismatches in cdecl vs stdcall calling convention.  See code
comment for more detailed explanation.

Tested with piglit gl-1.0-beginend-coverage (it now also crashes on
debug builds.)

VMware PR1350505.

Reviewed-by: Brian Paul <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@vmware.com>

--- src/mapi/glapi/glapi_dispatch.c
+++ src/mapi/glapi/glapi_dispatch.c
@@ -144,6 +144,28 @@
 GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z);
 GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer);

+/* Enable frame pointer elimination on Windows, otherwise forgetting to add
+ * APIENTRY to _mesa_* entrypoints will not cause crashes on debug builds, as
+ * the initial ESP value is saved in the EBP in the function prologue, then
+ * restored on the epilogue, clobbering any corruption in the ESP pointer due
+ * to mismatch in the callee calling convention.
+ *
+ * On MSVC it's not sufficient to enable /Oy -- other optimizations must be
+ * enabled or frame pointer will be used regardless.
+ *
+ * We don't do this when NDEBUG is defined since, frame pointer omission
+ * optimization compiler flag are already specified on release builds, and
+ * because on profile builds we must have frame pointers or certain profilers
+ * might fail to unwind the stack.
+ */
+#if defined(_WIN32) && !defined(NDEBUG)
+#  if defined(_MSC_VER)
+#    pragma optimize( "gty", on )
+#  elif defined(__GNUC__)
+#    pragma GCC optimize ("omit-frame-pointer")
+#  endif
+#endif
+
 #include "glapi/glapitemp.h"

 #endif /* USE_X86_ASM */


Android: handle all keys defined on android

--- systems/android/android_main.c
+++ systems/android/android_main.c
@@ -64,8 +64,8 @@
      int   ret;
 //   char *argv[] = { "android-native-dfb-app", "--dfb:debug=ANDROID,debug=direct/interface" };
 //     char *argv[] = { "android-native-dfb-app", "--dfb:no-debug", "-a" };
-   //char *argv[] = { "android-native-dfb-app", "--dfb:no-cursor-updates,no-sighandler,layer-buffer-mode=backvideo,debug=ANDROID/Main,debug=core/input,debug=core/inputevt" };
-     char *argv[] = { "android-native-dfb-app", "--dfb:no-cursor-updates,no-sighandler,layer-buffer-mode=backvideo,wm-fullscreen-updates,debug=GL,debug=EGL,debug=idirectfbsurface,debug=idirectfbsurfacew" };
+   char *argv[] = { "android-native-dfb-app", "--dfb:no-cursor-updates,wm-fullscreen-updates,no-sighandler,layer-buffer-mode=backvideo"};
+     //char *argv[] = { "android-native-dfb-app", "--dfb:no-cursor-updates,no-sighandler,layer-buffer-mode=backvideo,wm-fullscreen-updates,debug,no-debug=IDFBEventBuffer,no-debug=Core/GraphicsOps,no-debug=Core/GfxState,no-debug=Fusion/Skirmish,no-debug=Direct/Serial,no-debug=Core/SurfAllocation,no-debug=Core/WM,no-debug=GLES2/2D,no-debug=Core/SurfBuffer,no-debug=Core/Layers,no-debug=Core/SurfPoolLock,no-debug=Core/Input,no-debug=Core/LayerContext,no-debug=Core/WindowStack" };

      LOGI( "Running main()..." );

@@ -74,6 +74,226 @@
      LOGI( "main() has returned %d!", ret );

      return NULL;
+}
+
+static DFBInputDeviceKeyIdentifier
+translate_keycode( const int key_code )
+{
+     switch (key_code) {
+          case AKEYCODE_UNKNOWN:             return DIKI_UNKNOWN;
+          case AKEYCODE_SOFT_LEFT:           break;
+          case AKEYCODE_SOFT_RIGHT:          break;
+          case AKEYCODE_HOME:                break;
+          case AKEYCODE_BACK:                break;
+          case AKEYCODE_CALL:                break;
+          case AKEYCODE_ENDCALL:             break;
+          case AKEYCODE_0:                   return DIKI_0;
+          case AKEYCODE_1:                   return DIKI_1;
+          case AKEYCODE_2:                   return DIKI_2;
+          case AKEYCODE_3:                   return DIKI_3;
+          case AKEYCODE_4:                   return DIKI_4;
+          case AKEYCODE_5:                   return DIKI_5;
+          case AKEYCODE_6:                   return DIKI_6;
+          case AKEYCODE_7:                   return DIKI_7;
+          case AKEYCODE_8:                   return DIKI_8;
+          case AKEYCODE_9:                   return DIKI_9;
+          case AKEYCODE_STAR:                break;
+          case AKEYCODE_POUND:               break;
+          case AKEYCODE_DPAD_UP:             return DIKI_UP;
+          case AKEYCODE_DPAD_DOWN:           return DIKI_DOWN;
+          case AKEYCODE_DPAD_LEFT:           return DIKI_LEFT;
+          case AKEYCODE_DPAD_RIGHT:          return DIKI_RIGHT;
+          case AKEYCODE_DPAD_CENTER:         break;
+          case AKEYCODE_VOLUME_UP:           break;
+          case AKEYCODE_VOLUME_DOWN:         break;
+          case AKEYCODE_POWER:               break;
+          case AKEYCODE_CAMERA:              break;
+          case AKEYCODE_CLEAR:               break;
+          case AKEYCODE_A:                   return DIKI_A;
+          case AKEYCODE_B:                   return DIKI_B;
+          case AKEYCODE_C:                   return DIKI_C;
+          case AKEYCODE_D:                   return DIKI_D;
+          case AKEYCODE_E:                   return DIKI_E;
+          case AKEYCODE_F:                   return DIKI_F;
+          case AKEYCODE_G:                   return DIKI_G;
+          case AKEYCODE_H:                   return DIKI_H;
+          case AKEYCODE_I:                   return DIKI_I;
+          case AKEYCODE_J:                   return DIKI_J;
+          case AKEYCODE_K:                   return DIKI_K;
+          case AKEYCODE_L:                   return DIKI_L;
+          case AKEYCODE_M:                   return DIKI_M;
+          case AKEYCODE_N:                   return DIKI_N;
+          case AKEYCODE_O:                   return DIKI_O;
+          case AKEYCODE_P:                   return DIKI_P;
+          case AKEYCODE_Q:                   return DIKI_Q;
+          case AKEYCODE_R:                   return DIKI_R;
+          case AKEYCODE_S:                   return DIKI_S;
+          case AKEYCODE_T:                   return DIKI_T;
+          case AKEYCODE_U:                   return DIKI_U;
+          case AKEYCODE_V:                   return DIKI_V;
+          case AKEYCODE_W:                   return DIKI_W;
+          case AKEYCODE_X:                   return DIKI_X;
+          case AKEYCODE_Y:                   return DIKI_Y;
+          case AKEYCODE_Z:                   return DIKI_Z;
+          case AKEYCODE_COMMA:               return DIKI_COMMA;
+          case AKEYCODE_PERIOD:              break;
+          case AKEYCODE_ALT_LEFT:            return DIKI_ALT_L;
+          case AKEYCODE_ALT_RIGHT:           return DIKI_ALT_R;
+          case AKEYCODE_SHIFT_LEFT:          return DIKI_SHIFT_L;
+          case AKEYCODE_SHIFT_RIGHT:         return DIKI_SHIFT_R;
+          case AKEYCODE_TAB:                 return DIKI_TAB;
+          case AKEYCODE_SPACE:               return DIKI_SPACE;
+          case AKEYCODE_SYM:                 break;
+          case AKEYCODE_EXPLORER:            break;
+          case AKEYCODE_ENVELOPE:            break;
+          case AKEYCODE_ENTER:               return DIKI_ENTER;
+          case AKEYCODE_DEL:                 return DIKI_DELETE;
+          case AKEYCODE_GRAVE:               break;
+          case AKEYCODE_MINUS:               break;
+          case AKEYCODE_EQUALS:              break;
+          case AKEYCODE_LEFT_BRACKET:        return DIKI_BRACKET_LEFT;
+          case AKEYCODE_RIGHT_BRACKET:       return DIKI_BRACKET_RIGHT;
+          case AKEYCODE_BACKSLASH:           return DIKI_BACKSLASH;
+          case AKEYCODE_SEMICOLON:           return DIKI_SEMICOLON;
+          case AKEYCODE_APOSTROPHE:          break;
+          case AKEYCODE_SLASH:               return DIKI_SLASH;
+          case AKEYCODE_AT:                  break;
+          case AKEYCODE_NUM:                 break;
+          case AKEYCODE_HEADSETHOOK:         break;
+          case AKEYCODE_FOCUS:               break;
+          case AKEYCODE_PLUS:                break;
+          case AKEYCODE_MENU:                break;
+          case AKEYCODE_NOTIFICATION:        break;
+          case AKEYCODE_SEARCH:              break;
+          case AKEYCODE_MEDIA_PLAY_PAUSE:    break;
+          case AKEYCODE_MEDIA_STOP:          break;
+          case AKEYCODE_MEDIA_NEXT:          break;
+          case AKEYCODE_MEDIA_PREVIOUS:      break;
+          case AKEYCODE_MEDIA_REWIND:        break;
+          case AKEYCODE_MEDIA_FAST_FORWARD:  break;
+          case AKEYCODE_MUTE:                break;
+          case AKEYCODE_PAGE_UP:             return DIKI_PAGE_UP;
+          case AKEYCODE_PAGE_DOWN:           return DIKI_PAGE_DOWN;
+          case AKEYCODE_PICTSYMBOLS:         break;
+          case AKEYCODE_SWITCH_CHARSET:      break;
+          case AKEYCODE_BUTTON_A:            break;
+          case AKEYCODE_BUTTON_B:            break;
+          case AKEYCODE_BUTTON_C:            break;
+          case AKEYCODE_BUTTON_X:            break;
+          case AKEYCODE_BUTTON_Y:            break;
+          case AKEYCODE_BUTTON_Z:            break;
+          case AKEYCODE_BUTTON_L1:           break;
+          case AKEYCODE_BUTTON_R1:           break;
+          case AKEYCODE_BUTTON_L2:           break;
+          case AKEYCODE_BUTTON_R2:           break;
+          case AKEYCODE_BUTTON_THUMBL:       break;
+          case AKEYCODE_BUTTON_THUMBR:       break;
+          case AKEYCODE_BUTTON_START:        break;
+          case AKEYCODE_BUTTON_SELECT:       break;
+          case AKEYCODE_BUTTON_MODE:         break;
+          case AKEYCODE_ESCAPE:              return DIKI_ESCAPE;
+          case AKEYCODE_FORWARD_DEL:         break;
+          case AKEYCODE_CTRL_LEFT:           return DIKI_CONTROL_L;
+          case AKEYCODE_CTRL_RIGHT:          return DIKI_CONTROL_R;
+          case AKEYCODE_CAPS_LOCK:           return DIKI_CAPS_LOCK;
+          case AKEYCODE_SCROLL_LOCK:         return DIKI_SCROLL_LOCK;
+          case AKEYCODE_META_LEFT:           return DIKI_META_L;
+          case AKEYCODE_META_RIGHT:          return DIKI_META_R;
+          case AKEYCODE_FUNCTION:            break;
+          case AKEYCODE_SYSRQ:               break;
+          case AKEYCODE_BREAK:               break;
+          case AKEYCODE_MOVE_HOME:           break;
+          case AKEYCODE_MOVE_END:            break;
+          case AKEYCODE_INSERT:              return DIKI_INSERT;
+          case AKEYCODE_FORWARD:             break;
+          case AKEYCODE_MEDIA_PLAY:          break;
+          case AKEYCODE_MEDIA_PAUSE:         break;
+          case AKEYCODE_MEDIA_CLOSE:         break;
+          case AKEYCODE_MEDIA_EJECT:         break;
+          case AKEYCODE_MEDIA_RECORD:        break;
+          case AKEYCODE_F1:                  return DIKI_F1;
+          case AKEYCODE_F2:                  return DIKI_F2;
+          case AKEYCODE_F3:                  return DIKI_F3;
+          case AKEYCODE_F4:                  return DIKI_F4;
+          case AKEYCODE_F5:                  return DIKI_F5;
+          case AKEYCODE_F6:                  return DIKI_F6;
+          case AKEYCODE_F7:                  return DIKI_F7;
+          case AKEYCODE_F8:                  return DIKI_F8;
+          case AKEYCODE_F9:                  return DIKI_F9;
+          case AKEYCODE_F10:                 return DIKI_F10;
+          case AKEYCODE_F11:                 return DIKI_F11;
+          case AKEYCODE_F12:                 return DIKI_F12;
+          case AKEYCODE_NUM_LOCK:            return DIKI_NUM_LOCK;
+          case AKEYCODE_NUMPAD_0:            return DIKI_KP_0;
+          case AKEYCODE_NUMPAD_1:            return DIKI_KP_1;
+          case AKEYCODE_NUMPAD_2:            return DIKI_KP_2;
+          case AKEYCODE_NUMPAD_3:            return DIKI_KP_3;
+          case AKEYCODE_NUMPAD_4:            return DIKI_KP_4;
+          case AKEYCODE_NUMPAD_5:            return DIKI_KP_5;
+          case AKEYCODE_NUMPAD_6:            return DIKI_KP_6;
+          case AKEYCODE_NUMPAD_7:            return DIKI_KP_7;
+          case AKEYCODE_NUMPAD_8:            return DIKI_KP_8;
+          case AKEYCODE_NUMPAD_9:            return DIKI_KP_9;
+          case AKEYCODE_NUMPAD_DIVIDE:       return DIKI_KP_DIV;
+          case AKEYCODE_NUMPAD_MULTIPLY:     return DIKI_KP_MULT;
+          case AKEYCODE_NUMPAD_SUBTRACT:     return DIKI_KP_MINUS;
+          case AKEYCODE_NUMPAD_ADD:          return DIKI_KP_PLUS;
+          case AKEYCODE_NUMPAD_DOT:          break;
+          case AKEYCODE_NUMPAD_COMMA:        return DIKI_COMMA;
+          case AKEYCODE_NUMPAD_ENTER:        return DIKI_KP_ENTER;
+          case AKEYCODE_NUMPAD_EQUALS:       return DIKI_KP_EQUAL;
+          case AKEYCODE_NUMPAD_LEFT_PAREN:   break;
+          case AKEYCODE_NUMPAD_RIGHT_PAREN:  break;
+          case AKEYCODE_VOLUME_MUTE:         break;
+          case AKEYCODE_INFO:                break;
+          case AKEYCODE_CHANNEL_UP:          break;
+          case AKEYCODE_CHANNEL_DOWN:        break;
+          case AKEYCODE_ZOOM_IN:             break;
+          case AKEYCODE_ZOOM_OUT:            break;
+          case AKEYCODE_TV:                  break;
+          case AKEYCODE_WINDOW:              break;
+          case AKEYCODE_GUIDE:               break;
+          case AKEYCODE_DVR:                 break;
+          case AKEYCODE_BOOKMARK:            break;
+          case AKEYCODE_CAPTIONS:            break;
+          case AKEYCODE_SETTINGS:            break;
+          case AKEYCODE_TV_POWER:            break;
+          case AKEYCODE_TV_INPUT:            break;
+          case AKEYCODE_STB_POWER:           break;
+          case AKEYCODE_STB_INPUT:           break;
+          case AKEYCODE_AVR_POWER:           break;
+          case AKEYCODE_AVR_INPUT:           break;
+          case AKEYCODE_PROG_RED:            break;
+          case AKEYCODE_PROG_GREEN:          break;
+          case AKEYCODE_PROG_YELLOW:         break;
+          case AKEYCODE_PROG_BLUE:           break;
+          case AKEYCODE_APP_SWITCH:          break;
+          case AKEYCODE_BUTTON_1:            break;
+          case AKEYCODE_BUTTON_2:            break;
+          case AKEYCODE_BUTTON_3:            break;
+          case AKEYCODE_BUTTON_4:            break;
+          case AKEYCODE_BUTTON_5:            break;
+          case AKEYCODE_BUTTON_6:            break;
+          case AKEYCODE_BUTTON_7:            break;
+          case AKEYCODE_BUTTON_8:            break;
+          case AKEYCODE_BUTTON_9:            break;
+          case AKEYCODE_BUTTON_10:           break;
+          case AKEYCODE_BUTTON_11:           break;
+          case AKEYCODE_BUTTON_12:           break;
+          case AKEYCODE_BUTTON_13:           break;
+          case AKEYCODE_BUTTON_14:           break;
+          case AKEYCODE_BUTTON_15:           break;
+          case AKEYCODE_BUTTON_16:           break;
+          case AKEYCODE_LANGUAGE_SWITCH:     break;
+          case AKEYCODE_MANNER_MODE:         break;
+          case AKEYCODE_3D_MODE:             break;
+          case AKEYCODE_CONTACTS:            break;
+          case AKEYCODE_CALENDAR:            break;
+          case AKEYCODE_MUSIC:               break;
+          case AKEYCODE_CALCULATOR:          break;
+          default:                           break;
+     }
+     return DIKI_UNKNOWN;
 }

 /**
@@ -221,226 +441,7 @@

           evt.flags    = DIEF_KEYCODE | DIEF_KEYID;
           evt.key_code = AKeyEvent_getKeyCode( event );
-
-          switch (evt.key_code) {
-               case AKEYCODE_DPAD_UP:
-                    evt.key_id = DIKI_UP;
-                    break;
-               case AKEYCODE_DPAD_DOWN:
-                    evt.key_id = DIKI_DOWN;
-                    break;
-               case AKEYCODE_DPAD_LEFT:
-                    evt.key_id = DIKI_LEFT;
-                    break;
-               case AKEYCODE_DPAD_RIGHT:
-                    evt.key_id = DIKI_RIGHT;
-                    break;
-               case AKEYCODE_BACK:
-                    evt.key_id = DIKI_ESCAPE;
-                    break;
-               case AKEYCODE_1:
-                    evt.key_id = DIKI_1;
-                    break;
-               case AKEYCODE_2:
-                    evt.key_id = DIKI_2;
-                    break;
-               case AKEYCODE_3:
-                    evt.key_id = DIKI_3;
-                    break;
-               case AKEYCODE_4:
-                    evt.key_id = DIKI_4;
-                    break;
-               case AKEYCODE_5:
-                    evt.key_id = DIKI_5;
-                    break;
-               case AKEYCODE_6:
-                    evt.key_id = DIKI_6;
-                    break;
-               case AKEYCODE_7:
-                    evt.key_id = DIKI_7;
-                    break;
-               case AKEYCODE_8:
-                    evt.key_id = DIKI_8;
-                    break;
-               case AKEYCODE_9:
-                    evt.key_id = DIKI_9;
-                    break;
-               case AKEYCODE_0:
-                    evt.key_id = DIKI_0;
-                    break;
-               case AKEYCODE_MINUS:
-                    evt.key_id = DIKI_MINUS_SIGN;
-                    break;
-               case AKEYCODE_TAB:
-                    evt.key_id = DIKI_TAB;
-                    break;
-               case AKEYCODE_Q:
-                    evt.key_id = DIKI_Q;
-                    break;
-               case AKEYCODE_W:
-                    evt.key_id = DIKI_W;
-                    break;
-               case AKEYCODE_E:
-                    evt.key_id = DIKI_E;
-                    break;
-               case AKEYCODE_R:
-                    evt.key_id = DIKI_R;
-                    break;
-               case AKEYCODE_T:
-                    evt.key_id = DIKI_T;
-                    break;
-               case AKEYCODE_Y:
-                    evt.key_id = DIKI_Y;
-                    break;
-               case AKEYCODE_U:
-                    evt.key_id = DIKI_U;
-                    break;
-               case AKEYCODE_I:
-                    evt.key_id = DIKI_I;
-                    break;
-               case AKEYCODE_O:
-                    evt.key_id = DIKI_O;
-                    break;
-               case AKEYCODE_P:
-                    evt.key_id = DIKI_P;
-                    break;
-               case AKEYCODE_LEFT_BRACKET:
-                    evt.key_id = DIKI_BRACKET_LEFT;
-                    break;
-               case AKEYCODE_RIGHT_BRACKET:
-                    evt.key_id = DIKI_BRACKET_RIGHT;
-                    break;
-               case AKEYCODE_ENTER:
-                    evt.key_id = DIKI_ENTER;
-                    break;
-               case AKEYCODE_A:
-                    evt.key_id = DIKI_A;
-                    break;
-               case AKEYCODE_S:
-                    evt.key_id = DIKI_S;
-                    break;
-               case AKEYCODE_D:
-                    evt.key_id = DIKI_D;
-                    break;
-               case AKEYCODE_F:
-                    evt.key_id = DIKI_F;
-                    break;
-               case AKEYCODE_G:
-                    evt.key_id = DIKI_G;
-                    break;
-               case AKEYCODE_H:
-                    evt.key_id = DIKI_H;
-                    break;
-               case AKEYCODE_J:
-                    evt.key_id = DIKI_J;
-                    break;
-               case AKEYCODE_K:
-                    evt.key_id = DIKI_K;
-                    break;
-               case AKEYCODE_L:
-                    evt.key_id = DIKI_L;
-                    break;
-               case AKEYCODE_SEMICOLON:
-                    evt.key_id = DIKI_SEMICOLON;
-                    break;
-               case AKEYCODE_APOSTROPHE:
-                    evt.key_id = 0;
-                    break;
-               case AKEYCODE_GRAVE:
-                    evt.key_id = 0;
-                    break;
-               case AKEYCODE_SHIFT_LEFT:
-                    evt.key_id = DIKI_SHIFT_L;
-                    break;
-               case AKEYCODE_SHIFT_RIGHT:
-                    evt.key_id = DIKI_SHIFT_R;
-                    break;
-               case AKEYCODE_ALT_LEFT:
-                    evt.key_id = DIKI_ALT_L;
-                    break;
-               case AKEYCODE_ALT_RIGHT:
-                    evt.key_id = DIKI_ALT_R;
-                    break;
-               case AKEYCODE_CTRL_LEFT:
-                    evt.key_id = DIKI_CONTROL_L;
-                    break;
-               case AKEYCODE_CTRL_RIGHT:
-                    evt.key_id = DIKI_CONTROL_R;
-                    break;
-               case AKEYCODE_BACKSLASH:
-                    evt.key_id = DIKI_BACKSLASH;
-                    break;
-               case AKEYCODE_Z:
-                    evt.key_id = DIKI_Z;
-                    break;
-               case AKEYCODE_X:
-                    evt.key_id = DIKI_X;
-                    break;
-               case AKEYCODE_C:
-                    evt.key_id = DIKI_C;
-                    break;
-               case AKEYCODE_V:
-                    evt.key_id = DIKI_V;
-                    break;
-               case AKEYCODE_B:
-                    evt.key_id = DIKI_B;
-                    break;
-               case AKEYCODE_N:
-                    evt.key_id = DIKI_N;
-                    break;
-               case AKEYCODE_M:
-                    evt.key_id = DIKI_M;
-                    break;
-               case AKEYCODE_COMMA:
-                    evt.key_id = DIKI_COMMA;
-                    break;
-               case AKEYCODE_SLASH:
-                    evt.key_id = DIKI_SLASH;
-                    break;
-               case AKEYCODE_SPACE:
-                    evt.key_id = DIKI_SPACE;
-                    break;
-               case AKEYCODE_F1:
-                    evt.key_id = DIKI_F1;
-                    break;
-               case AKEYCODE_F2:
-                    evt.key_id = DIKI_F2;
-                    break;
-               case AKEYCODE_F3:
-                    evt.key_id = DIKI_F3;
-                    break;
-               case AKEYCODE_F4:
-                    evt.key_id = DIKI_F4;
-                    break;
-               case AKEYCODE_F5:
-                    evt.key_id = DIKI_F5;
-                    break;
-               case AKEYCODE_F6:
-                    evt.key_id = DIKI_F6;
-                    break;
-               case AKEYCODE_F7:
-                    evt.key_id = DIKI_F7;
-                    break;
-               case AKEYCODE_F8:
-                    evt.key_id = DIKI_F8;
-                    break;
-               case AKEYCODE_F9:
-                    evt.key_id = DIKI_F9;
-                    break;
-               case AKEYCODE_F10:
-                    evt.key_id = DIKI_F10;
-                    break;
-               case AKEYCODE_F11:
-                    evt.key_id = DIKI_F11;
-                    break;
-               case AKEYCODE_F12:
-                    evt.key_id = DIKI_F12;
-                    break;
-
-               default:
-                    D_DEBUG_AT( ANDROID_MAIN, "unhandled key event action %d key_code %d", action, evt.key_code );
-                    return 0;
-          }
+          evt.key_id   = translate_keycode( evt.key_code );

           dfb_input_dispatch( m_data->input, &evt );


[PATCH] mac80211: store channel info in sta_bss_list

Some AP equipment "in the wild" uses the same BSSID on multiple channels
(particularly "a" vs. "b/g").  This patch changes the key of sta_bss_list
to include both the BSSID and the channel so as to prevent a BSSID on
one channel from eclipsing the same BSSID on another channel.

Signed-off-by: John W. Linville <2a53bac7a5d324865ef46ec4c38b2c0fba1456b4@tuxdriver.com>

--- net/mac80211/ieee80211_sta.c
+++ net/mac80211/ieee80211_sta.c
@@ -61,7 +61,7 @@
 static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst,
 				     u8 *ssid, size_t ssid_len);
 static struct ieee80211_sta_bss *
-ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid);
+ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid, int channel);
 static void ieee80211_rx_bss_put(struct net_device *dev,
 				 struct ieee80211_sta_bss *bss);
 static int ieee80211_sta_find_ibss(struct net_device *dev,
@@ -427,7 +427,8 @@
 		if (sdata->type != IEEE80211_IF_TYPE_STA)
 			return;

-		bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
+		bss = ieee80211_rx_bss_get(dev, ifsta->bssid,
+					   local->hw.conf.channel);
 		if (bss) {
 			if (bss->has_erp_value)
 				ieee80211_handle_erp_ie(dev, bss->erp_value);
@@ -574,7 +575,7 @@
 		capab |= WLAN_CAPABILITY_SHORT_SLOT_TIME |
 			WLAN_CAPABILITY_SHORT_PREAMBLE;
 	}
-	bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
+	bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel);
 	if (bss) {
 		if (bss->capability & WLAN_CAPABILITY_PRIVACY)
 			capab |= WLAN_CAPABILITY_PRIVACY;
@@ -722,6 +723,7 @@
 static int ieee80211_privacy_mismatch(struct net_device *dev,
 				      struct ieee80211_if_sta *ifsta)
 {
+	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
 	struct ieee80211_sta_bss *bss;
 	int res = 0;

@@ -729,7 +731,7 @@
 	    ifsta->key_management_enabled)
 		return 0;

-	bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
+	bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel);
 	if (!bss)
 		return 0;

@@ -1242,7 +1244,8 @@
 	 * update our stored copy */
 	if (elems.erp_info && elems.erp_info_len >= 1) {
 		struct ieee80211_sta_bss *bss
-			= ieee80211_rx_bss_get(dev, ifsta->bssid);
+			= ieee80211_rx_bss_get(dev, ifsta->bssid,
+					       local->hw.conf.channel);
 		if (bss) {
 			bss->erp_value = elems.erp_info[0];
 			bss->has_erp_value = 1;
@@ -1272,7 +1275,8 @@
 			       " AP\n", dev->name);
 			return;
 		}
-		bss = ieee80211_rx_bss_get(dev, ifsta->bssid);
+		bss = ieee80211_rx_bss_get(dev, ifsta->bssid,
+					   local->hw.conf.channel);
 		if (bss) {
 			sta->last_rssi = bss->rssi;
 			sta->last_signal = bss->signal;
@@ -1348,7 +1352,7 @@

 static struct ieee80211_sta_bss *
-ieee80211_rx_bss_add(struct net_device *dev, u8 *bssid)
+ieee80211_rx_bss_add(struct net_device *dev, u8 *bssid, int channel)
 {
 	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
 	struct ieee80211_sta_bss *bss;
@@ -1359,6 +1363,7 @@
 	atomic_inc(&bss->users);
 	atomic_inc(&bss->users);
 	memcpy(bss->bssid, bssid, ETH_ALEN);
+	bss->channel = channel;

 	spin_lock_bh(&local->sta_bss_lock);
 	/* TODO: order by RSSI? */
@@ -1370,7 +1375,7 @@

 static struct ieee80211_sta_bss *
-ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid)
+ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid, int channel)
 {
 	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
 	struct ieee80211_sta_bss *bss;
@@ -1378,7 +1383,8 @@
 	spin_lock_bh(&local->sta_bss_lock);
 	bss = local->sta_bss_hash[STA_HASH(bssid)];
 	while (bss) {
-		if (memcmp(bss->bssid, bssid, ETH_ALEN) == 0) {
+		if (memcmp(bss->bssid, bssid, ETH_ALEN) == 0 &&
+		    bss->channel == channel) {
 			atomic_inc(&bss->users);
 			break;
 		}
@@ -1546,9 +1552,9 @@
 	else
 		channel = rx_status->channel;

-	bss = ieee80211_rx_bss_get(dev, mgmt->bssid);
+	bss = ieee80211_rx_bss_get(dev, mgmt->bssid, channel);
 	if (!bss) {
-		bss = ieee80211_rx_bss_add(dev, mgmt->bssid);
+		bss = ieee80211_rx_bss_add(dev, mgmt->bssid, channel);
 		if (!bss)
 			return;
 	} else {
@@ -1648,7 +1654,6 @@

 	bss->hw_mode = rx_status->phymode;
-	bss->channel = channel;
 	bss->freq = rx_status->freq;
 	if (channel != rx_status->channel &&
 	    (bss->hw_mode == MODE_IEEE80211G ||
@@ -2399,7 +2404,7 @@
 	printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %s\n",
 	       dev->name, print_mac(mac, bssid));

-	bss = ieee80211_rx_bss_add(dev, bssid);
+	bss = ieee80211_rx_bss_add(dev, bssid, local->hw.conf.channel);
 	if (!bss)
 		return -ENOMEM;

@@ -2410,7 +2415,6 @@
 		local->hw.conf.beacon_int = 100;
 	bss->beacon_int = local->hw.conf.beacon_int;
 	bss->hw_mode = local->hw.conf.phymode;
-	bss->channel = local->hw.conf.channel;
 	bss->freq = local->hw.conf.freq;
 	bss->last_update = jiffies;
 	bss->capability = WLAN_CAPABILITY_IBSS;
@@ -2470,7 +2474,7 @@
 	       "%s\n", print_mac(mac, bssid), print_mac(mac2, ifsta->bssid));
 #endif /* CONFIG_MAC80211_IBSS_DEBUG */
 	if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0 &&
-	    (bss = ieee80211_rx_bss_get(dev, bssid))) {
+	    (bss = ieee80211_rx_bss_get(dev, bssid, local->hw.conf.channel))) {
 		printk(KERN_DEBUG "%s: Selected IBSS BSSID %s"
 		       " based on configured SSID\n",
 		       dev->name, print_mac(mac, bssid));


netlabel: remove unnecessary break after goto

Signed-off-by: Fabian Frederick <3efd2a027b14fd890cd23a9ef6d1134b4e5ad850@skynet.be>
Acked-by: Paul Moore <a027184a55211cd23e3f3094f1fdc728df5e0500@paul-moore.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/netlabel/netlabel_kapi.c
+++ net/netlabel/netlabel_kapi.c
@@ -170,7 +170,6 @@
 #endif /* IPv6 */
 		default:
 			goto cfg_unlbl_map_add_failure;
-			break;
 		}

 		entry->def.addrsel = addrmap;


removed extra turnover.  Unnecessary according to tests

--- explore/static/prg.h
+++ explore/static/prg.h
@@ -16,7 +16,6 @@
    prg(uint64_t initial)
    {
 	   v = initial;
-	   merand48(v);
    }

    float merand48(uint64_t& initial)


Marked probable bug, pointed out by Anonymous.

--- apps/pkcs12.c
+++ apps/pkcs12.c
@@ -371,6 +371,8 @@

 	if (canames) sk_free(canames);

+	/* if (!pmatch) ...?  What should happen here?  XXX */
+
 	if(!noprompt &&
 		EVP_read_pw_string(pass, 50, "Enter Export Password:", 1)) {
 	    BIO_printf (bio_err, "Can't read Password\n");
@@ -421,7 +423,7 @@
 	ret = 0;
 	goto end;

-}
+    }

     if (!(p12 = d2i_PKCS12_bio (in, NULL))) {
 	ERR_print_errors(bio_err);


really fixed zte9xxx paging

really fixed zte9xxx paging

--- src/mdm_device_dslam_zte_9xxx.c
+++ src/mdm_device_dslam_zte_9xxx.c
@@ -589,14 +589,28 @@
 			sprintf(status->status_message, "Receive timeout.");
 			return;
 		}
-		//fprintf(stdout, "|1|%s|1|\n", tempbuffer);
-		tmp1 = strstr(tempbuffer, pagingstr);
-		if(tmp1 != NULL || (strstr(tempbuffer, "(Q to quit)") != NULL))
+		strncat(d->exec_buffer, tempbuffer, tempbufferlen);
+		d->exec_buffer_len += tempbufferlen;
+		prompt = strstr(d->exec_buffer, "$ ");
+		if(prompt != NULL)
+		{
+			lastlinebeforeprompt = strrchr(d->exec_buffer, 13);
+			*lastlinebeforeprompt = 0;
+			lastlinebeforeprompt = strrchr(d->exec_buffer, 13);
+			if(lastlinebeforeprompt != NULL)
+				*lastlinebeforeprompt = 0;
+			lastlinebeforeprompt = strrchr(d->exec_buffer, 13);
+			if(lastlinebeforeprompt != NULL)
+				*lastlinebeforeprompt = 0;
+			break;
+		}
+		tmp1 = strstr(d->exec_buffer, pagingstr);
+		if(tmp1 != NULL)
 		{
 #if MDM_DEBUG_MESSAGES > 0
 			MDM_LOGDEBUG("Paging");
 #endif
-			tempbufferlen -= paginglen;
+			d->exec_buffer_len -= paginglen;
 			sleep(1);
 			d->connection.send(&d->connection.descriptor, "", 0, status);
 			if(status->status == MDM_OP_ERROR)
@@ -606,6 +620,7 @@
 			pagebufferlen = 1;//paginglen;
 			do
 			{
+				MDM_LOGDEBUG("Reading paging");
 				mdm_connection_recv(
 					&d->connection, pagebuffer, &pagebufferlen, status
 				);
@@ -613,27 +628,14 @@
 				{
 					return;
 				}
+				MDM_LOGDEBUG("Reading paging %c", *pagebuffer);
 				if (pagebufferlen == 0) {
 					break;
 				}
 			} while(*pagebuffer == 32 || *pagebuffer == 13 || *pagebuffer == 10);
-			tempbuffer[tempbufferlen] = *pagebuffer;
-			tempbufferlen++;
-		}
-		strncat(d->exec_buffer, tempbuffer, tempbufferlen);
-		d->exec_buffer_len += tempbufferlen;
-		prompt = strstr(d->exec_buffer, "$ ");
-		if(prompt != NULL)
-		{
-			lastlinebeforeprompt = strrchr(d->exec_buffer, 13);
-			*lastlinebeforeprompt = 0;
-			lastlinebeforeprompt = strrchr(d->exec_buffer, 13);
-			if(lastlinebeforeprompt != NULL)
-				*lastlinebeforeprompt = 0;
-			lastlinebeforeprompt = strrchr(d->exec_buffer, 13);
-			if(lastlinebeforeprompt != NULL)
-				*lastlinebeforeprompt = 0;
-			break;
+			d->exec_buffer[d->exec_buffer_len] = *pagebuffer;
+			d->exec_buffer_len++;
+			d->exec_buffer[d->exec_buffer_len] = 0;
 		}
 	} while(1);
 	/*


tracker: enable directory notifications when browsing in filesystem mode

Signed-off-by: Lionel Landwerlin <9463032a5b99ffad10f36631678a833369a311b5@linux.intel.com>

--- src/media/tracker/grl-tracker.c
+++ src/media/tracker/grl-tracker.c
@@ -44,6 +44,19 @@

 /* ------- Definitions ------- */

+#define TRACKER_FOLDER_CLASS_REQUEST           \
+  "SELECT ?urn WHERE "                         \
+  "{ "                                         \
+  "?urn a rdfs:Class . "                       \
+  "FILTER(fn:ends-with(?urn,\"nfo#Folder\")) " \
+  "}"
+
+#define TRACKER_NOTIFY_FOLDER_UPDATE            \
+  "INSERT "                                     \
+  "{ "                                          \
+  "<%s> tracker:notify true "                   \
+  "}"
+
 /* --- Other --- */

 gboolean grl_tracker_plugin_init (GrlPluginRegistry *registry,
@@ -62,6 +75,63 @@
 /* =================== Tracker Plugin  =============== */

 static void
+init_sources (void)
+{
+  if (grl_tracker_connection != NULL) {
+    grl_tracker_media_dbus_start_watch ();
+
+    grl_tracker_metadata_source_init ();
+    grl_tracker_media_sources_init ();
+  }
+}
+
+static void
+tracker_update_folder_class_cb (GObject      *object,
+                                GAsyncResult *result,
+                                gpointer      data)
+{
+  init_sources ();
+}
+
+static void
+tracker_get_folder_class_cb (GObject      *object,
+                             GAsyncResult *result,
+                             gpointer       data)
+{
+  TrackerSparqlCursor  *cursor;
+
+  GRL_DEBUG ("%s", __FUNCTION__);
+
+  cursor = tracker_sparql_connection_query_finish (grl_tracker_connection,
+                                                   result, NULL);
+
+  if (!cursor) {
+    init_sources ();
+    return;
+  }
+
+  if (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
+    gchar *update = g_strdup_printf (TRACKER_NOTIFY_FOLDER_UPDATE,
+                                     tracker_sparql_cursor_get_string (cursor,
+                                                                       0,
+                                                                       NULL));
+
+    GRL_DEBUG ("\tupdate query: '%s'", update);
+
+    tracker_sparql_connection_update_async (grl_tracker_connection,
+                                            update,
+                                            G_PRIORITY_DEFAULT,
+                                            NULL,
+                                            tracker_update_folder_class_cb,
+                                            NULL);
+
+    g_free (update);
+  }
+
+  g_object_unref (cursor);
+}
+
+static void
 tracker_get_connection_cb (GObject             *object,
                            GAsyncResult        *res,
                            const GrlPluginInfo *plugin)
@@ -72,12 +142,14 @@

   grl_tracker_connection = tracker_sparql_connection_get_finish (res, NULL);

-  if (grl_tracker_connection != NULL) {
-    grl_tracker_media_dbus_start_watch ();
-
-    grl_tracker_metadata_source_init ();
-    grl_tracker_media_sources_init ();
-  }
+  if (grl_tracker_browse_filesystem)
+    tracker_sparql_connection_query_async (grl_tracker_connection,
+                                           TRACKER_FOLDER_CLASS_REQUEST,
+                                           NULL,
+                                           tracker_get_folder_class_cb,
+                                           NULL);
+  else
+    init_sources ();
 }

 gboolean


Minor changes to comments

Minor changes to comments

--- ext/RMagick/rmmain.c
+++ ext/RMagick/rmmain.c
@@ -1,4 +1,4 @@
-/* $Id: rmmain.c,v 1.247 2008/03/29 15:23:12 rmagick Exp $ */
+/* $Id: rmmain.c,v 1.248 2008/05/11 16:22:45 rmagick Exp $ */
 /*============================================================================\
 |                Copyright (C) 2008 by Timothy P. Hunter
 | Name:     rmmain.c
@@ -782,7 +782,8 @@
     // include Comparable
     rb_include_module(Class_Pixel, rb_mComparable);

-    // Magick::Pixel has 3 constructors: "new" "from_color", and "from_HSL".
+    // Magick::Pixel has 4 constructors: "new" "from_color", "from_hsla",
+    // and the deprecated "from_HSL".
     rb_define_alloc_func(Class_Pixel, Pixel_alloc);
     rb_define_singleton_method(Class_Pixel, "from_color", Pixel_from_color, 1);
     rb_define_singleton_method(Class_Pixel, "from_HSL", Pixel_from_HSL, 1);
@@ -813,7 +814,7 @@
     rb_define_method(Class_Pixel, "hash", Pixel_hash, 0);
     rb_define_method(Class_Pixel, "intensity", Pixel_intensity, 0);
     rb_define_method(Class_Pixel, "to_color", Pixel_to_color, -1);
-    rb_define_method(Class_Pixel, "to_HSL", Pixel_to_HSL, 0);
+    rb_define_method(Class_Pixel, "to_HSL", Pixel_to_HSL, 0);   // deprecated
     rb_define_method(Class_Pixel, "to_hsla", Pixel_to_hsla, 0);
     rb_define_method(Class_Pixel, "to_s", Pixel_to_s, 0);

@@ -1707,7 +1708,7 @@
     rb_define_const(Module_Magick, "Version", str);

     sprintf(long_version,
-            "This is %s ($Date: 2008/03/29 15:23:12 $) Copyright (C) 2008 by Timothy P. Hunter\n"
+            "This is %s ($Date: 2008/05/11 16:22:45 $) Copyright (C) 2008 by Timothy P. Hunter\n"
             "Built with %s\n"
             "Built for %s\n"
             "Web page: http://rmagick.rubyforge.org\n"


* ext/augeas/_augeas.c: expose new aug_flags from 0.5.0

--- ext/augeas/_augeas.c
+++ ext/augeas/_augeas.c
@@ -260,6 +260,8 @@
     DEF_AUG_FLAG(SAVE_BACKUP);
     DEF_AUG_FLAG(SAVE_NEWFILE);
     DEF_AUG_FLAG(TYPE_CHECK);
+    DEF_AUG_FLAG(NO_STDINC);
+    DEF_AUG_FLAG(NO_LOAD);
 #undef DEF_AUG_FLAG

     /* Define the methods */


domain.c: Use sensible default for libvirt_domain_qemu_agent_command

Usually, the default value of zero for optional arguments works
just fine. But that's not the case for
libvirt_domain_qemu_agent_command and its 'timeout' argument
because no timeout is usually not enough time for the guest agent
to reply (esp. when a more complex command was executed, e.g.
"guest-network-get-interfaces").

Use QEMU_AGENT_COMMAND_DEFAULT as the default value, which lets
libvirt use its own default timeout which is 5 seconds currently.

Closes: https://gitlab.com/libvirt/libvirt-ruby/-/issues/5
Signed-off-by: Michal Privoznik <83d82aaba2eed257f4814b0c239c260c4caaadf0@redhat.com>

--- ext/libvirt/domain.c
+++ ext/libvirt/domain.c
@@ -3769,6 +3769,10 @@
     int exception = 0;

     rb_scan_args(argc, argv, "12", &command, &timeout, &flags);
+
+    if (NIL_P(timeout)) {
+        timeout = INT2NUM(VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT);
+    }

     ret = virDomainQemuAgentCommand(ruby_libvirt_domain_get(d),
                                     StringValueCStr(command),


Fixes for freebsd

Fixes for freebsd

--- viewc/clang.c
+++ viewc/clang.c
@@ -106,6 +106,10 @@
                         fld->nullval);
                 }
             }
+            else
+            {
+                default_null[0]=EXEOS;
+            }

             if (fld->flags & NDRX_VIEW_FLAG_ELEMCNT_IND_C)
             {


Don't make volume upload zero bytes

Don't make volume upload zero bytes

The virStreamSourceFunc internal_sendall currently returns the first
value passed in from the block, which according the ruby-libvirt docs
should be zero:

  The send block should return an array of 2 elements; the first element
  should be the return code from the block (-1 for error, 0 otherwise)

But according to the libvirt docs of virStreamSourceFunc this indicates
EOF:

  Returns:  the number of bytes filled, 0 upon end of file, or -1 upon error

So return the size of the buffer to unbreak volume uploads.

--- ext/libvirt/stream.c
+++ ext/libvirt/stream.c
@@ -131,7 +131,7 @@

     memcpy(data, RSTRING_PTR(buffer), RSTRING_LEN(buffer));

-    return NUM2INT(retcode);
+    return RSTRING_LEN(buffer);
 }

 /*


viewer: call XInitThreads

viewer: call XInitThreads

I'm not sure it is a requirement, but gstreamer exmaples seem to call
it.

--- viewer/main.c
+++ viewer/main.c
@@ -27,6 +27,10 @@
 #include <stdlib.h>
 #include <libnotify/notify.h>
 #include <libintl.h>
+
+#if GST_GL_HAVE_WINDOW_X11 && defined (GDK_WINDOWING_X11)
+#include <gst/gl/x11/gstgldisplay_x11.h>
+#endif

 static char *arv_viewer_option_debug_domains = NULL;
 static char *arv_viewer_option_cache_policy = NULL;
@@ -73,6 +77,10 @@
 	GOptionContext *context;
 	GError *error = NULL;
 	ArvRegisterCachePolicy cache_policy = ARV_REGISTER_CACHE_POLICY_DEFAULT;
+
+#if GST_GL_HAVE_WINDOW_X11 && defined(GDK_WINDOWING_X11)
+	XInitThreads ();
+#endif

 	bindtextdomain (ARAVIS_GETTEXT, ARAVIS_LOCALE_DIR);
 	bind_textdomain_codeset (ARAVIS_GETTEXT, "UTF-8");


1.8.7 needs this for TRAP_BEG/TRAP_END

1.8.7 needs this for TRAP_BEG/TRAP_END

--- ext/nio4r/selector.c
+++ ext/nio4r/selector.c
@@ -4,6 +4,7 @@
  */

 #include "nio4r.h"
+#include "rubysig.h"

 static VALUE mNIO = Qnil;
 static VALUE cNIO_Channel  = Qnil;


Ignore disconnected outputs.

Ignore disconnected outputs.

Otherwise it leads to excessive redrawing activities which could
even lead to undesired results.

Signed-off-by: Tobias Stoeckmann <059b8b880f8441509ec8a65b50b4c6ae74ebea76@stoeckmann.org>

--- outputs.c
+++ outputs.c
@@ -54,7 +54,7 @@
 			return output;

 	if (name != NULL) {
-		warnx("output %s was not found, ignoring", name);
+		warnx("output %s was not found/disconnected, ignoring", name);
 		return NULL;
 	}

@@ -79,7 +79,7 @@
 	xcb_randr_get_screen_resources_cookie_t resources_cookie;
 	xcb_randr_get_screen_resources_reply_t *resources_reply;
 	xcb_randr_output_t *xcb_outputs;
-	int i;
+	int i, j;
 	size_t n;

 	resources_cookie = xcb_randr_get_screen_resources(c, screen->root);
@@ -94,6 +94,7 @@
 	SAFE_MUL(n, (size_t)len + 1, sizeof(*outputs));
 	outputs = xmalloc(n);

+	j = 0;
 	for (i = 0; i < len; i++) {
 		xcb_randr_get_output_info_cookie_t output_cookie;
 		xcb_randr_get_output_info_reply_t *output_reply;
@@ -108,41 +109,45 @@
 		output_reply = xcb_randr_get_output_info_reply(c, output_cookie,
 		    NULL);

+		if (output_reply->connection != XCB_RANDR_CONNECTION_CONNECTED)
+			continue;
+
 		name = xcb_randr_get_output_info_name(output_reply);
 		name_len = xcb_randr_get_output_info_name_length(output_reply);

 		crtc = xcb_randr_get_output_info_crtcs(output_reply);
 		crtc_len = xcb_randr_get_output_info_crtcs_length(output_reply);

-		outputs[i].name = xmalloc(name_len + 1);
+		outputs[j].name = xmalloc(name_len + 1);
 		memcpy(outputs[i].name, name, name_len);
-		outputs[i].name[name_len] = '\0';
+		outputs[j].name[name_len] = '\0';

 		if (crtc_len < 1)
 			errx(1, "failed to retrieve CRTCs for output %s",
-			    outputs[i].name);
+			    outputs[j].name);

 		crtc_cookie = xcb_randr_get_crtc_info(c, crtc[0],
 		    XCB_CURRENT_TIME);
 		crtc_reply = xcb_randr_get_crtc_info_reply(c, crtc_cookie,
 		    NULL);

-		outputs[i].x = crtc_reply->x;
-		outputs[i].y = crtc_reply->y;
-		outputs[i].width = crtc_reply->width;
-		outputs[i].height = crtc_reply->height;
-		DBG("output detected: %s, %dx%d+%d+%d\n", outputs[i].name,
-		    outputs[i].width, outputs[i].height, outputs[i].x,
-		    outputs[i].y);
+		outputs[j].x = crtc_reply->x;
+		outputs[j].y = crtc_reply->y;
+		outputs[j].width = crtc_reply->width;
+		outputs[j].height = crtc_reply->height;
+		DBG("output detected: %s, %dx%d+%d+%d\n", outputs[j].name,
+		    outputs[j].width, outputs[j].height, outputs[j].x,
+		    outputs[j].y);
+		j++;
 	}

-	outputs[len].name = NULL;
-	outputs[len].x = 0;
-	outputs[len].y = 0;
-	outputs[len].width = screen->width_in_pixels;
-	outputs[len].height = screen->height_in_pixels;
-	DBG("(randr) screen dimensions: %dx%d+%d+%d\n", outputs[len].width,
-	    outputs[len].height, outputs[len].x, outputs[len].y);
+	outputs[j].name = NULL;
+	outputs[j].x = 0;
+	outputs[j].y = 0;
+	outputs[j].width = screen->width_in_pixels;
+	outputs[j].height = screen->height_in_pixels;
+	DBG("(randr) screen dimensions: %dx%d+%d+%d\n", outputs[j].width,
+	    outputs[j].height, outputs[j].x, outputs[j].y);
 	return outputs;
 }
 #endif /* WITH_RANDR */


Fixed style.

Fixed style.

No need to keep the len integer separated from the iterators.
They are even used together.

Signed-off-by: Tobias Stoeckmann <059b8b880f8441509ec8a65b50b4c6ae74ebea76@stoeckmann.org>

--- outputs.c
+++ outputs.c
@@ -75,11 +75,10 @@
 get_randr_outputs(xcb_connection_t *c, xcb_screen_t *screen)
 {
 	wp_output_t *outputs;
-	int len;
 	xcb_randr_get_screen_resources_cookie_t resources_cookie;
 	xcb_randr_get_screen_resources_reply_t *resources_reply;
 	xcb_randr_output_t *xcb_outputs;
-	int i, j;
+	int i, j, len;
 	size_t n;

 	resources_cookie = xcb_randr_get_screen_resources(c, screen->root);


GabbleServerSaslChannel: don't handle the chain-up case

The channel manager does that now.

--- src/server-sasl-channel.c
+++ src/server-sasl-channel.c
@@ -1005,10 +1005,8 @@
     }
   else
     {
-      WOCKY_AUTH_REGISTRY_CLASS (
-          gabble_server_sasl_channel_parent_class)->start_auth_async_func (
-              auth_registry, mechanisms, allow_plain, is_secure_channel,
-              username, password, server, session_id, callback, user_data);
+      ERROR ("GabbleAuthManager is meant to do this bit now");
+      g_assert_not_reached ();
     }
 }

@@ -1018,20 +1016,9 @@
     WockyAuthRegistryStartData **start_data,
     GError **error)
 {
-  if (G_IS_SIMPLE_ASYNC_RESULT (result) &&
-      g_simple_async_result_get_source_tag ((GSimpleAsyncResult *) result) ==
-        gabble_server_sasl_channel_start_auth_async_func)
-    {
-      wocky_implement_finish_copy_pointer (self,
-          gabble_server_sasl_channel_start_auth_async_func,
-          wocky_auth_registry_start_data_dup, start_data);
-    }
-  else
-    {
-      return WOCKY_AUTH_REGISTRY_CLASS
-        (gabble_server_sasl_channel_parent_class)->start_auth_finish_func (
-            self, result, start_data, error);
-    }
+  wocky_implement_finish_copy_pointer (self,
+      gabble_server_sasl_channel_start_auth_async_func,
+      wocky_auth_registry_start_data_dup, start_data);
 }

 static void
@@ -1065,9 +1052,8 @@
     }
   else
     {
-      WOCKY_AUTH_REGISTRY_CLASS (
-          gabble_server_sasl_channel_parent_class)->challenge_async_func (
-              auth_registry, challenge_data, callback, user_data);
+      ERROR ("GabbleAuthManager is meant to do this bit now");
+      g_assert_not_reached ();
     }
 }

@@ -1077,20 +1063,9 @@
     GString **response,
     GError **error)
 {
-  if (G_IS_SIMPLE_ASYNC_RESULT (result) &&
-      g_simple_async_result_get_source_tag ((GSimpleAsyncResult *) result) ==
-        gabble_server_sasl_channel_challenge_async_func)
-    {
-      wocky_implement_finish_copy_pointer (self,
-          gabble_server_sasl_channel_challenge_async_func,
-          wocky_g_string_dup, response);
-    }
-  else
-    {
-      return WOCKY_AUTH_REGISTRY_CLASS
-        (gabble_server_sasl_channel_parent_class)->challenge_finish_func (
-            self, result, response, error);
-    }
+  wocky_implement_finish_copy_pointer (self,
+      gabble_server_sasl_channel_challenge_async_func,
+      wocky_g_string_dup, response);
 }

 static void
@@ -1128,9 +1103,8 @@
     }
   else
     {
-      WOCKY_AUTH_REGISTRY_CLASS (
-          gabble_server_sasl_channel_parent_class)->success_async_func (
-              auth_registry, callback, user_data);
+      ERROR ("GabbleAuthManager is meant to do this bit now");
+      g_assert_not_reached ();
     }
 }

@@ -1139,19 +1113,8 @@
     GAsyncResult *result,
     GError **error)
 {
-  if (G_IS_SIMPLE_ASYNC_RESULT (result) &&
-      g_simple_async_result_get_source_tag ((GSimpleAsyncResult *) result) ==
-        gabble_server_sasl_channel_success_async_func)
-    {
-      wocky_implement_finish_void (self,
-          gabble_server_sasl_channel_success_async_func);
-    }
-  else
-    {
-      return WOCKY_AUTH_REGISTRY_CLASS
-        (gabble_server_sasl_channel_parent_class)->success_finish_func (
-            self, result, error);
-    }
+  wocky_implement_finish_void (self,
+      gabble_server_sasl_channel_success_async_func);
 }

 static void


Trying to silence redefines

Trying to silence redefines

--- ext/oj/mimic_rails.c
+++ ext/oj/mimic_rails.c
@@ -770,7 +770,8 @@
     } else {
     	oj_json_parser_error_class = rb_define_class_under(json, "ParserError", json_error);
     }
-    rb_undef_method(json, "parse");
+    //rb_undef_method(json, "parse");
+    rb_undef(json, rb_intern("parse"));
     rb_define_module_function(json, "parse", oj_mimic_parse, -1);

     return Qnil;


Work on completion events: t+

Work on completion events: t+

--- cpan/libmarpa/dev/marpa.w
+++ cpan/libmarpa/dev/marpa.w
@@ -2712,12 +2712,12 @@
 @ @<Initialize IRL elements@> =
   Direct_Completion_Event_CIL_of_IRL(irl) = NULL;
   Indirect_Completion_Event_CIL_of_IRL(irl) = NULL;
-  IRL_has_Nondirect_Completions(irl) = 0;
+  IRL_has_Nondirect_Completion(irl) = 0;
 @ Nondirect event completions are indirect event completions which are
 not direct event completions.
 They may be though of as ``proper" indirect event completions.
 Only right recursive IRL's will have nondirect event completions.
-@d IRL_has_Nondirect_Completions(irl) ((irl)->t_has_nondirect_completions)
+@d IRL_has_Nondirect_Completion(irl) ((irl)->t_has_nondirect_completions)
 @<Bit aligned IRL elements@> =
    unsigned int t_has_nondirect_completions:1;

@@ -4885,7 +4885,7 @@
   Item_of_CIL(Indirect_Completion_Event_CIL_of_AHFA(state), (ix))
 @d Indirect_Completion_Event_ISY_Count_of_AHFA(state)
   Count_of_CIL(Indirect_Completion_Event_CIL_of_AHFA(state))
-@d AHFA_has_Nondirect_Completions(state)
+@d AHFA_has_Nondirect_Completion(state)
   ((state)->t_has_nondirect_completions)
 @ @<Widely aligned AHFA state elements@> =
 CIL t_indirect_completion_event_isyids;
@@ -5186,7 +5186,7 @@
 	    (Indirect_Completion_Event_CIL_of_IRL (irl),
 	     Direct_Completion_Event_CIL_of_IRL (irl), 0))
 	  {
-	    IRL_has_Nondirect_Completions (irl) = 1;
+	    IRL_has_Nondirect_Completion (irl) = 1;
 	  }
       }
     }
@@ -5474,7 +5474,7 @@
     my_obstack_alloc (g->t_obs, sizeof (ISYID));
   postdot_isyid = Postdot_ISYID_of_AIM (start_item);
   *postdot_isyidary = postdot_isyid;
-  AHFA_has_Nondirect_Completions(p_initial_state) = 0;
+  AHFA_has_Nondirect_Completion(p_initial_state) = 0;
   Direct_Completion_Event_CIL_of_AHFA(p_initial_state) =
     Indirect_Completion_Event_CIL_of_AHFA(p_initial_state) =
     Completion_CIL_of_AHFA(p_initial_state) =
@@ -5545,7 +5545,7 @@
       {
 	ISYID* p_postdot_isyidary = Postdot_ISYIDAry_of_AHFA(p_new_state) =
 	  my_obstack_alloc (g->t_obs, sizeof (ISYID));
-	AHFA_has_Nondirect_Completions(p_new_state) = 0;
+	AHFA_has_Nondirect_Completion(p_new_state) = 0;
 	Completion_CIL_of_AHFA(p_new_state)
 	= Direct_Completion_Event_CIL_of_AHFA(p_new_state)
 	= Indirect_Completion_Event_CIL_of_AHFA(p_new_state)
@@ -7260,7 +7260,7 @@
 struct s_earley_item_key;
 typedef struct s_earley_item_key* EIK;
 @ @d EIM_is_Extended(eim) ((eim)->is_extended_eim)
-@ @d EIM_has_Nondirect_Completions(eim) ((eim)->has_nondirect_completions)
+@ @d EIM_has_Nondirect_Completion(eim) ((eim)->has_nondirect_completions)
 @ @d EIM_at_Completion_Event_Closure(eim) ((eim)->at_completion_event_closure)
 @<Bit aligned Earley item elements@> =
     unsigned int is_extended_eim:1;
@@ -7310,17 +7310,17 @@
   const ES set = key.t_set;
   const int count = ++EIM_Count_of_ES(set);
   @<Check count against Earley item thresholds@>@;
-  if (AHFA_has_Nondirect_Completions(key.t_state)) {
+  if (AHFA_has_Nondirect_Completion(key.t_state)) {
     const EIMX new_eimx = my_obstack_new (r->t_obs, struct s_extended_earley_item, 1);
     new_item = (EIM)new_eimx;
     /* While developing, start with full set */
     Completion_Event_CIL_of_EIMX(new_eimx) = Indirect_Completion_Event_CIL_of_AHFA(key.t_state);
-    EIM_has_Nondirect_Completions(new_item) = 1;
+    EIM_has_Nondirect_Completion(new_item) = 1;
     EIM_at_Completion_Event_Closure(new_item) = 0;
     EIM_is_Extended(new_item) = 1;
   } else {
     new_item = my_obstack_new (r->t_obs, struct s_earley_item, 1);
-    EIM_has_Nondirect_Completions(new_item) = 0;
+    EIM_has_Nondirect_Completion(new_item) = 0;
     EIM_at_Completion_Event_Closure(new_item) = 1;
     EIM_is_Extended(new_item) = 0;
   }
@@ -7625,13 +7625,8 @@

 @ The CIL is |NULL| if the LIM is at a completion
 closure (by far the most common case).
-@d LV_CIL_of_LIM(lim) ((lim)->t_cil)
+@d CIL_of_LIM(lim) ((lim)->t_cil)
 @d LIM_at_Completion_Event_Closure(lim) (!(lim)->t_cil)
-@d RV_CIL_of_LIM(lim) (
-    LIM_at_Completion_Event_Closure(lim) ?
-    Indirect_Completion_Events_of_AHFA(Top_AHFA_of_LIM(lim)) :
-    (lim)->t_cil;
-)
 @<Widely aligned LIM elements@> =
     CIL t_cil;

@@ -9384,7 +9379,7 @@
       int event_isy_count;
       CIL cil;
       const EIM eim = eims[eim_ix];
-      if (EIM_has_Nondirect_Completions(eim)) {
+      if (EIM_has_Nondirect_Completion(eim)) {
 	const EIMX eimx = (EIMX)eim;
         cil = eimx->t_completion_event_isyids;
       } else {
@@ -9588,7 +9583,7 @@
     EIM_of_PIM(new_lim) = NULL;
     Predecessor_LIM_of_LIM(new_lim) = NULL;
     Origin_of_LIM(new_lim) = NULL;
-    LV_CIL_of_LIM(new_lim) = NULL;
+    CIL_of_LIM(new_lim) = NULL;
     Top_AHFA_of_LIM(new_lim) = base_to_ahfa;
     Base_EIM_of_LIM(new_lim) = leo_base;
     ES_of_LIM(new_lim) = current_earley_set;
@@ -9827,9 +9822,34 @@

 @ @<Populate |lim_to_process| from |predecessor_lim|@> =
 {
+  const AHFA top_AHFA = Top_AHFA_of_LIM (predecessor_lim);
+  Top_AHFA_of_LIM (lim_to_process) = top_AHFA;
   Predecessor_LIM_of_LIM (lim_to_process) = predecessor_lim;
   Origin_of_LIM (lim_to_process) = Origin_of_LIM (predecessor_lim);
-  Top_AHFA_of_LIM (lim_to_process) = Top_AHFA_of_LIM (predecessor_lim);
+  @/@, /* If the AHFA has non-direct completions ... */
+  if (AHFA_has_Nondirect_Completion (top_AHFA))
+    {
+      const CIL predecessor_cil = CIL_of_LIM (predecessor_lim);
+      @/@, /* and the predecessor LIM was not at completion closure ... */
+      if (predecessor_cil)
+	{
+	  CIL new_cil = cil_merge (&g->t_cilar, predecessor_cil,
+				   Direct_Completion_Event_CIL_of_AHFA
+				   (top_AHFA));
+	  @/@, /* and adding this completion does not bring the new LIM
+	  to completion closure ... */
+	  if (cil_cmp (new_cil,
+	    Indirect_Completion_Event_CIL_of_AHFA (top_AHFA),
+	    0)
+	    )
+	    {
+	  @/@, /* Set the CIL for this LIM to the completion CIL.
+	  Otherwise, leave it at the default of |NULL|, which indicated
+	  the LIM is at completion closure. */
+	      CIL_of_LIM (lim_to_process) = new_cil;
+	    }
+	}
+    }
 }

 @ If we have reached this code, either we do not have a predecessor
@@ -9846,8 +9866,14 @@
 and the top AHFA to-state was initialized to the AHFA to-state
 of the base EIM.
 @<Populate |lim_to_process| from its base Earley item@> = {
+  const AHFA top_AHFA = Top_AHFA_of_LIM(lim_to_process);
   EIM base_eim = Base_EIM_of_LIM(lim_to_process);
   Origin_of_LIM (lim_to_process) = Origin_of_EIM (base_eim);
+  @/@, /* CIL defaults to |NULL|, meaning LIM is at completion closure */
+  if (AHFA_has_Nondirect_Completion(top_AHFA))
+  {
+       CIL_of_LIM(lim_to_process) = Direct_Completion_Event_CIL_of_AHFA(top_AHFA);
+  }
 }

 @ @<Copy PIM workarea to postdot item array@> = {