gobex: Improve multiple request queuing

gobex: Improve multiple request queuing

--- gobex/gobex.c
+++ gobex/gobex.c
@@ -163,8 +163,10 @@
 			goto done;

 		/* Can't send a request while there's a pending one */
-		if (obex->pending_req && p->id > 0)
+		if (obex->pending_req && p->id > 0) {
+			g_queue_push_head(obex->tx_queue, p);
 			goto done;
+		}

 		len = g_obex_packet_encode(p->pkt, obex->tx_buf, obex->tx_mtu);
 		if (len < 0) {
@@ -193,10 +195,22 @@
 	return FALSE;
 }

+static void enable_tx(GObex *obex)
+{
+	GIOCondition cond;
+
+	if (obex->write_source > 0)
+		return;
+
+	cond = G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL;
+	obex->write_source = g_io_add_watch(obex->io, cond, write_data, obex);
+
+	return;
+}
+
 static gboolean g_obex_send_internal(GObex *obex, struct pending_pkt *p,
 								GError **err)
 {
-	GIOCondition cond;

 	if (obex->io == NULL) {
 		g_set_error(err, G_OBEX_ERROR, G_OBEX_ERROR_DISCONNECTED,
@@ -209,8 +223,10 @@
 	if (g_queue_get_length(obex->tx_queue) > 1)
 		return TRUE;

-	cond = G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL;
-	obex->write_source = g_io_add_watch(obex->io, cond, write_data, obex);
+	if (p->id > 0 && obex->pending_req != NULL)
+		return TRUE;
+
+	enable_tx(obex);

 	return TRUE;
 }
@@ -307,6 +323,9 @@

 	pending_pkt_free(p);
 	obex->pending_req = NULL;
+
+	if (g_queue_get_length(obex->tx_queue) > 0)
+		enable_tx(obex);
 }

 static void handle_request(GObex *obex, GError *err, GObexPacket *req)


REFACTOR: Require `ResolverInterface` to be cancelable

--- include/nekit/utils/resolver_interface.h
+++ include/nekit/utils/resolver_interface.h
@@ -29,9 +29,12 @@
 #include <boost/asio.hpp>
 #include <boost/noncopyable.hpp>

+#include "async_io_interface.h"
+#include "cancelable.h"
+
 namespace nekit {
 namespace utils {
-class ResolverInterface : private boost::noncopyable {
+class ResolverInterface : public AsyncIoInterface, private boost::noncopyable {
  public:
   using EventHandler = std::function<void(
       std::shared_ptr<std::vector<boost::asio::ip::address>> addresses,
@@ -45,18 +48,16 @@
     Any
   };

+  ResolverInterface(boost::asio::io_service& io) : AsyncIoInterface{io} {}
+
   virtual ~ResolverInterface() = default;

-  virtual void Resolve(std::string domain, AddressPreference preference,
-                       EventHandler handler) = 0;
+  virtual Cancelable& Resolve(std::string domain, AddressPreference preference,
+                              EventHandler handler)
+      __attribute__((warn_unused_result)) = 0;
+
   virtual void Cancel() = 0;
 };

-class ResolverFactoryInterface : private boost::noncopyable {
- public:
-  virtual ~ResolverFactoryInterface() = default;
-
-  virtual std::unique_ptr<ResolverInterface> Build() = 0;
-};
 }  // namespace utils
 }  // namespace nekit


Fixed a seg fault by checking for operation context in case of get request

git-svn-id: fbb392d5347ebc45c06187f72dfd8bab02595dbf@892166 13f79535-47bb-0310-9956-ffa450edef68

--- src/core/transport/http/util/http_transport_utils.c
+++ src/core/transport/http/util/http_transport_utils.c
@@ -3468,8 +3468,15 @@
         axis2_op_ctx_t *op_ctx = NULL;
         axis2_msg_ctx_t *in_msg_ctx = NULL;
         op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
-        in_msg_ctx = axis2_op_ctx_get_msg_ctx(op_ctx, env, AXIS2_WSDL_MESSAGE_LABEL_IN);
-        ht = axis2_msg_ctx_get_property_value(msg_ctx, env, AXIS2_TRANSPORT_SESSION_TABLE);
+        if(op_ctx)
+        {
+            in_msg_ctx = axis2_op_ctx_get_msg_ctx(op_ctx, env, AXIS2_WSDL_MESSAGE_LABEL_IN);
+            if(in_msg_ctx)
+            {
+                ht = axis2_msg_ctx_get_property_value(in_msg_ctx, env,
+                        AXIS2_TRANSPORT_SESSION_TABLE);
+            }
+        }
         if(!ht)
         {
             return NULL;


Reverse order of template arguments

Reverse order of template arguments

2nd parameter can be deduced from function parameters

--- include/visionaray/detail/sched_common.h
+++ include/visionaray/detail/sched_common.h
@@ -266,8 +266,8 @@

 template <
-    typename R,
     size_t   Num,
+    typename R,
     typename PxSamplerT,
     typename Sampler,
     typename ...Args


Schedule fsevents thread after init

Schedule fsevents thread after init

git-svn-id: fa0849429efd6140f8c6b0411d4b758884714b35@6172 94223b32-352b-4d6d-a509-7b239cf53eea

--- wired/files.c
+++ wired/files.c
@@ -120,14 +120,10 @@

 	wd_files_fsevents = wi_fsevents_init(wi_fsevents_alloc());

-	if(wd_files_fsevents) {
+	if(wd_files_fsevents)
 		wi_fsevents_set_callback(wd_files_fsevents, wd_files_fsevents_callback);
-
-		if(!wi_thread_create_thread(wd_files_fsevents_thread, NULL))
-			wi_log_err(WI_STR("Could not create a thread: %m"));
-	} else {
+	else
 		wi_log_warn(WI_STR("Could not create fsevents: %m"));
-	}
 }

@@ -146,6 +142,11 @@
 		wi_timer_reschedule(wd_files_index_timer, wd_files_index_time);
 	else
 		wi_timer_invalidate(wd_files_index_timer);
+
+	if(wd_files_fsevents) {
+		if(!wi_thread_create_thread(wd_files_fsevents_thread, NULL))
+			wi_log_err(WI_STR("Could not create a thread: %m"));
+	}
 }


Fix a bug about 'DEL' command execute failure in Shell2.0. Signed-off-by: Jin Eric <eric.jin@intel.com>

Fix a bug about 'DEL' command execute failure in Shell2.0.
Signed-off-by: Jin Eric <28f988db17ff8624705e2c502b9148c9beb8c8f0@intel.com>

--- SctPkg/Application/InstallSct/InstallSctSupport.c
+++ SctPkg/Application/InstallSct/InstallSctSupport.c
@@ -35,12 +35,12 @@
   DOCUMENT, WHETHER OR NOT SUCH PARTY HAD ADVANCE NOTICE OF
   THE POSSIBILITY OF SUCH DAMAGES.

-  Copyright 2006 - 2012 Unified EFI, Inc. All
+  Copyright 2006 - 2014 Unified EFI, Inc. All
   Rights Reserved, subject to all existing rights in all
   matters included within this Test Suite, to which United
   EFI, Inc. makes no claim of right.

-  Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.

+  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.

   Portions copyright (c) 2014, ARM Ltd. All rights reserved.

 --*/
@@ -208,7 +208,7 @@
   // Create command line to delete this directory or file
   //
   CmdLine = SctPoolPrint (
-              L"DEL -q \"%s\"",
+              L"del -q \"%s\"",
               Name
               );
   if (CmdLine == NULL) {


SecurityPkg: Add TPM PTP detection in Tpm12SubmitCommand.

Previously, we only add PTP detection in Tpm12RequestUseTpm,
because RequestUseTpm does not check TPM command.
This patch also adds similar check in Tpm12SubmitCommand.
PTP device does not accept TPM12 command, so that it can
return error on PTP device, instead of wait till timeout.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: "Zhang, Chao B" <chao.b.zhang@intel.com>

git-svn-id: 3158a46dfd52e07d1fda3e32e1ab2e353a00b20f@19755 6f19259b-4bc3-4df7-8a09-765794883524

--- SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
+++ SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
@@ -55,6 +55,44 @@

   RegRead = MmioRead8 ((UINTN)&TisReg->Access);
   return (BOOLEAN)(RegRead != (UINT8)-1);
+}
+
+/**
+  Return PTP interface type.
+
+  @param[in] Register                Pointer to PTP register.
+
+  @return PTP interface type.
+**/
+PTP_INTERFACE_TYPE
+Tpm12GetPtpInterface (
+  IN VOID *Register
+  )
+{
+  PTP_CRB_INTERFACE_IDENTIFIER  InterfaceId;
+  PTP_FIFO_INTERFACE_CAPABILITY InterfaceCapability;
+
+  if (!Tpm12TisPcPresenceCheck (Register)) {
+    return PtpInterfaceMax;
+  }
+  //
+  // Check interface id
+  //
+  InterfaceId.Uint32 = MmioRead32 ((UINTN)&((PTP_CRB_REGISTERS *)Register)->InterfaceId);
+  InterfaceCapability.Uint32 = MmioRead32 ((UINTN)&((PTP_FIFO_REGISTERS *)Register)->InterfaceCapability);
+
+  if ((InterfaceId.Bits.InterfaceType == PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_CRB) &&
+      (InterfaceId.Bits.InterfaceVersion == PTP_INTERFACE_IDENTIFIER_INTERFACE_VERSION_CRB) &&
+      (InterfaceId.Bits.CapCRB != 0)) {
+    return PtpInterfaceCrb;
+  }
+  if ((InterfaceId.Bits.InterfaceType == PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_FIFO) &&
+      (InterfaceId.Bits.InterfaceVersion == PTP_INTERFACE_IDENTIFIER_INTERFACE_VERSION_FIFO) &&
+      (InterfaceId.Bits.CapFIFO != 0) &&
+      (InterfaceCapability.Bits.InterfaceVersion == INTERFACE_CAPABILITY_INTERFACE_VERSION_PTP)) {
+    return PtpInterfaceFifo;
+  }
+  return PtpInterfaceTis;
 }

 /**
@@ -393,51 +431,30 @@
   IN UINT8             *OutputParameterBlock
   )
 {
-  return Tpm12TisTpmCommand (
-           (TIS_PC_REGISTERS_PTR) (UINTN) PcdGet64 (PcdTpmBaseAddress),
-           InputParameterBlock,
-           InputParameterBlockSize,
-           OutputParameterBlock,
-           OutputParameterBlockSize
-           );
-}
-
-/**
-  Return PTP interface type.
-
-  @param[in] Register                Pointer to PTP register.
-
-  @return PTP interface type.
-**/
-PTP_INTERFACE_TYPE
-Tpm12GetPtpInterface (
-  IN VOID *Register
-  )
-{
-  PTP_CRB_INTERFACE_IDENTIFIER  InterfaceId;
-  PTP_FIFO_INTERFACE_CAPABILITY InterfaceCapability;
-
-  if (!Tpm12TisPcPresenceCheck (Register)) {
-    return PtpInterfaceMax;
-  }
-  //
-  // Check interface id
-  //
-  InterfaceId.Uint32 = MmioRead32 ((UINTN)&((PTP_CRB_REGISTERS *)Register)->InterfaceId);
-  InterfaceCapability.Uint32 = MmioRead32 ((UINTN)&((PTP_FIFO_REGISTERS *)Register)->InterfaceCapability);
-
-  if ((InterfaceId.Bits.InterfaceType == PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_CRB) &&
-      (InterfaceId.Bits.InterfaceVersion == PTP_INTERFACE_IDENTIFIER_INTERFACE_VERSION_CRB) &&
-      (InterfaceId.Bits.CapCRB != 0)) {
-    return PtpInterfaceCrb;
-  }
-  if ((InterfaceId.Bits.InterfaceType == PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_FIFO) &&
-      (InterfaceId.Bits.InterfaceVersion == PTP_INTERFACE_IDENTIFIER_INTERFACE_VERSION_FIFO) &&
-      (InterfaceId.Bits.CapFIFO != 0) &&
-      (InterfaceCapability.Bits.InterfaceVersion == INTERFACE_CAPABILITY_INTERFACE_VERSION_PTP)) {
-    return PtpInterfaceFifo;
-  }
-  return PtpInterfaceTis;
+  PTP_INTERFACE_TYPE  PtpInterface;
+
+  //
+  // Special handle for TPM1.2 to check PTP too, because PTP/TIS share same register address.
+  //
+  PtpInterface = Tpm12GetPtpInterface ((VOID *) (UINTN) PcdGet64 (PcdTpmBaseAddress));
+  switch (PtpInterface) {
+  case PtpInterfaceFifo:
+  case PtpInterfaceTis:
+    return Tpm12TisTpmCommand (
+             (TIS_PC_REGISTERS_PTR) (UINTN) PcdGet64 (PcdTpmBaseAddress),
+             InputParameterBlock,
+             InputParameterBlockSize,
+             OutputParameterBlock,
+             OutputParameterBlockSize
+             );
+  case PtpInterfaceCrb:
+    //
+    // No need to support CRB because it is only accept TPM2 command.
+    //
+  default:
+    return EFI_DEVICE_ERROR;
+  }
+
 }

 /**


Apple: ignore -Wdeprecated-declarations warnings

--- chaosvpn.h
+++ chaosvpn.h
@@ -10,6 +10,7 @@
 /* Workaround for OSX 10.7 and later */
 #define _AVAILABILITYMACROS_
 #define DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 #endif

 #include <openssl/ssl.h>


stw: fix uninitialized variable issue

stw: fix uninitialized variable issue

--- src/gallium/state_trackers/wgl/shared/stw_context.c
+++ src/gallium/state_trackers/wgl/shared/stw_context.c
@@ -80,7 +80,7 @@
    struct stw_context *ctx = NULL;
    GLvisual *visual = NULL;
    struct pipe_context *pipe = NULL;
-   UINT_PTR hglrc;
+   UINT_PTR hglrc = 0;

    if(!stw_dev)
       return 0;
@@ -140,25 +140,21 @@
       UINT_PTR i;

       for (i = 0; i < STW_CONTEXT_MAX; i++) {
-         if (stw_dev->ctx_array[i].ctx == NULL)
+         if (stw_dev->ctx_array[i].ctx == NULL) {
+            /* success:
+             */
+            stw_dev->ctx_array[i].ctx = ctx;
+            hglrc = i + 1;
             break;
+         }
       }
-
-      /* No slot available, fail:
-       */
-      if (i == STW_CONTEXT_MAX)
-         goto done;
-
-      stw_dev->ctx_array[i].ctx = ctx;
-
-      /* success:
-       */
-      hglrc = i + 1;
-   }
-done:
-   pipe_mutex_unlock( stw_dev->mutex );
-
-   return hglrc;
+   }
+   pipe_mutex_unlock( stw_dev->mutex );
+
+   /* Success?
+    */
+   if (hglrc != 0)
+      return hglrc;

 fail:
    if (visual)


Fixed compile failed.

Fixed compile failed.

--- src/network/ProcessPool.c
+++ src/network/ProcessPool.c
@@ -251,7 +251,7 @@
      */
     out.buf.info.from_fd = worker->id;

-    if (SwooleG.task_ipc_mode == SW_IPC_MSGQUEUE)
+    if (SwooleG.task_ipc_mode == 2)
     {
         out.mtype = worker->id + 1;
     }


Added comments to MMXAddressable.h

Added comments to MMXAddressable.h

--- Source/CoreMessaging/Addressable/MMXAddressable.h
+++ Source/CoreMessaging/Addressable/MMXAddressable.h
@@ -20,7 +20,15 @@

 @required

+/**
+ *  Primary means of addressing a message
+ */
 @property (nonatomic, readonly) NSString *address;
+
+/**
+ *  Secondary means of addressing a message.
+ *	Used primarily for addressing a message to a specific device.
+ */
 @property (nonatomic, readonly) NSString *subAddress;

 @end


Null-merge from 4.1

Null-merge from 4.1

--- innobase/dict/dict0load.c
+++ innobase/dict/dict0load.c
@@ -8,6 +8,9 @@
 *******************************************************/

 #include "dict0load.h"
+#ifndef UNIV_HOTBACKUP
+#include "mysql_version.h"
+#endif /* !UNIV_HOTBACKUP */

 #ifdef UNIV_NONINL
 #include "dict0load.ic"
@@ -55,6 +58,7 @@

 	sys_tables = dict_table_get_low("SYS_TABLES");
 	sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
+	ut_a(!sys_tables->comp);

 	tuple = dtuple_create(heap, 1);
 	dfield = dtuple_get_nth_field(tuple, 0);
@@ -77,7 +81,7 @@
 		return(NULL);
 	}

-	field = rec_get_nth_field(rec, 0, &len);
+	field = rec_get_nth_field_old(rec, 0, &len);

 	if (len < strlen(name)
 	    || ut_memcmp(name, field, strlen(name)) != 0) {
@@ -90,7 +94,7 @@
 		return(NULL);
 	}

-	if (!rec_get_deleted_flag(rec)) {
+	if (!rec_get_deleted_flag(rec, sys_tables->comp)) {

 		/* We found one */

@@ -163,9 +167,9 @@
 		return;
 	}

-	field = rec_get_nth_field(rec, 0, &len);
-
-	if (!rec_get_deleted_flag(rec)) {
+	field = rec_get_nth_field_old(rec, 0, &len);
+
+	if (!rec_get_deleted_flag(rec, sys_tables->comp)) {

 		/* We found one */

@@ -180,7 +184,7 @@

 		if (table == NULL) {
 			fputs("InnoDB: Failed to load table ", stderr);
-			ut_print_namel(stderr, NULL, field, len);
+			ut_print_namel(stderr, NULL, (char*) field, len);
 			putc('\n', stderr);
 		} else {
 			/* The table definition was corrupt if there
@@ -231,6 +235,7 @@

 	sys_tables = dict_table_get_low("SYS_TABLES");
 	sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
+	ut_a(!sys_tables->comp);

 	btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
 								TRUE, &mtr);
@@ -257,15 +262,15 @@
 		return;
 	}

-	field = rec_get_nth_field(rec, 0, &len);
-
-	if (!rec_get_deleted_flag(rec)) {
+	field = rec_get_nth_field_old(rec, 0, &len);
+
+	if (!rec_get_deleted_flag(rec, sys_tables->comp)) {

 		/* We found one */

                 char*	name = mem_strdupl((char*) field, len);

-		field = rec_get_nth_field(rec, 9, &len);
+		field = rec_get_nth_field_old(rec, 9, &len);
 		ut_a(len == 4);

 		space_id = mach_read_from_4(field);
@@ -338,6 +343,7 @@

 	sys_columns = dict_table_get_low("SYS_COLUMNS");
 	sys_index = UT_LIST_GET_FIRST(sys_columns->indexes);
+	ut_a(!sys_columns->comp);

 	tuple = dtuple_create(heap, 1);
 	dfield = dtuple_get_nth_field(tuple, 0);
@@ -356,28 +362,27 @@

 		ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr));

-		ut_a(!rec_get_deleted_flag(rec));
-
-		field = rec_get_nth_field(rec, 0, &len);
+		ut_a(!rec_get_deleted_flag(rec, sys_columns->comp));
+
+		field = rec_get_nth_field_old(rec, 0, &len);
 		ut_ad(len == 8);
 		ut_a(ut_dulint_cmp(table->id, mach_read_from_8(field)) == 0);

-		field = rec_get_nth_field(rec, 1, &len);
+		field = rec_get_nth_field_old(rec, 1, &len);
 		ut_ad(len == 4);
 		ut_a(i == mach_read_from_4(field));

 		ut_a(0 == ut_strcmp("NAME",
 			dict_field_get_col(
-			dict_index_get_nth_field(
-			dict_table_get_first_index(sys_columns), 4))->name));
-
-		field = rec_get_nth_field(rec, 4, &len);
+			dict_index_get_nth_field(sys_index, 4))->name));
+
+		field = rec_get_nth_field_old(rec, 4, &len);
 		name = mem_heap_strdupl(heap, (char*) field, len);

-		field = rec_get_nth_field(rec, 5, &len);
+		field = rec_get_nth_field_old(rec, 5, &len);
 		mtype = mach_read_from_4(field);

-		field = rec_get_nth_field(rec, 6, &len);
+		field = rec_get_nth_field_old(rec, 6, &len);
 		prtype = mach_read_from_4(field);

 		if (dtype_is_non_binary_string_type(mtype, prtype)
@@ -389,15 +394,14 @@
 					data_mysql_default_charset_coll);
 		}

-		field = rec_get_nth_field(rec, 7, &len);
+		field = rec_get_nth_field_old(rec, 7, &len);
 		col_len = mach_read_from_4(field);

 		ut_a(0 == ut_strcmp("PREC",
 			dict_field_get_col(
-			dict_index_get_nth_field(
-			dict_table_get_first_index(sys_columns), 8))->name));
-
-		field = rec_get_nth_field(rec, 8, &len);
+			dict_index_get_nth_field(sys_index, 8))->name));
+
+		field = rec_get_nth_field_old(rec, 8, &len);
 		prec = mach_read_from_4(field);

 		dict_mem_table_add_col(table, name, mtype, prtype, col_len,
@@ -462,6 +466,7 @@

 	sys_fields = dict_table_get_low("SYS_FIELDS");
 	sys_index = UT_LIST_GET_FIRST(sys_fields->indexes);
+	ut_a(!sys_fields->comp);

 	tuple = dtuple_create(heap, 1);
 	dfield = dtuple_get_nth_field(tuple, 0);
@@ -479,15 +484,15 @@
 		rec = btr_pcur_get_rec(&pcur);

 		ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr));
-		if (rec_get_deleted_flag(rec)) {
+		if (rec_get_deleted_flag(rec, sys_fields->comp)) {
 			dict_load_report_deleted_index(table->name, i);
 		}

-		field = rec_get_nth_field(rec, 0, &len);
+		field = rec_get_nth_field_old(rec, 0, &len);
 		ut_ad(len == 8);
 		ut_a(ut_memcmp(buf, field, len) == 0);

-		field = rec_get_nth_field(rec, 1, &len);
+		field = rec_get_nth_field_old(rec, 1, &len);
 		ut_a(len == 4);

 		/* The next field stores the field position in the index
@@ -513,10 +518,9 @@

 		ut_a(0 == ut_strcmp("COL_NAME",
 			dict_field_get_col(
-			dict_index_get_nth_field(
-			dict_table_get_first_index(sys_fields), 4))->name));
-
-		field = rec_get_nth_field(rec, 4, &len);
+			dict_index_get_nth_field(sys_index, 4))->name));
+
+		field = rec_get_nth_field_old(rec, 4, &len);

 		dict_mem_index_add_field(index,
                                          mem_heap_strdupl(heap, (char*) field, len), 0, prefix_len);
@@ -575,6 +579,7 @@

 	sys_indexes = dict_table_get_low("SYS_INDEXES");
 	sys_index = UT_LIST_GET_FIRST(sys_indexes->indexes);
+	ut_a(!sys_indexes->comp);

 	tuple = dtuple_create(heap, 1);
 	dfield = dtuple_get_nth_field(tuple, 0);
@@ -595,14 +600,14 @@

 		rec = btr_pcur_get_rec(&pcur);

-		field = rec_get_nth_field(rec, 0, &len);
+		field = rec_get_nth_field_old(rec, 0, &len);
 		ut_ad(len == 8);

 		if (ut_memcmp(buf, field, len) != 0) {
 			break;
 		}

-		if (rec_get_deleted_flag(rec)) {
+		if (rec_get_deleted_flag(rec, table->comp)) {
 			dict_load_report_deleted_index(table->name,
 				ULINT_UNDEFINED);

@@ -612,33 +617,31 @@
 			return(FALSE);
 		}

-		field = rec_get_nth_field(rec, 1, &len);
+		field = rec_get_nth_field_old(rec, 1, &len);
 		ut_ad(len == 8);
 		id = mach_read_from_8(field);

 		ut_a(0 == ut_strcmp("NAME",
 			dict_field_get_col(
-			dict_index_get_nth_field(
-			dict_table_get_first_index(sys_indexes), 4))->name));
-
-		field = rec_get_nth_field(rec, 4, &name_len);
+			dict_index_get_nth_field(sys_index, 4))->name));
+
+		field = rec_get_nth_field_old(rec, 4, &name_len);
 		name_buf = mem_heap_strdupl(heap, (char*) field, name_len);

-		field = rec_get_nth_field(rec, 5, &len);
+		field = rec_get_nth_field_old(rec, 5, &len);
 		n_fields = mach_read_from_4(field);

-		field = rec_get_nth_field(rec, 6, &len);
+		field = rec_get_nth_field_old(rec, 6, &len);
 		type = mach_read_from_4(field);

-		field = rec_get_nth_field(rec, 7, &len);
+		field = rec_get_nth_field_old(rec, 7, &len);
 		space = mach_read_from_4(field);

 		ut_a(0 == ut_strcmp("PAGE_NO",
 			dict_field_get_col(
-			dict_index_get_nth_field(
-			dict_table_get_first_index(sys_indexes), 8))->name));
-
-		field = rec_get_nth_field(rec, 8, &len);
+			dict_index_get_nth_field(sys_index, 8))->name));
+
+		field = rec_get_nth_field_old(rec, 8, &len);
 		page_no = mach_read_from_4(field);

 		if (page_no == FIL_NULL) {
@@ -680,12 +683,10 @@
 		} else {
  			index = dict_mem_index_create(table->name, name_buf,
 						space, type, n_fields);
-			index->page_no = page_no;
 			index->id = id;

 			dict_load_fields(table, index, heap);
-
-			dict_index_add_to_cache(table, index);
+			dict_index_add_to_cache(table, index, page_no);
 		}

 		btr_pcur_move_to_next_user_rec(&pcur, &mtr);
@@ -741,6 +742,7 @@

 	sys_tables = dict_table_get_low("SYS_TABLES");
 	sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
+	ut_a(!sys_tables->comp);

 	tuple = dtuple_create(heap, 1);
 	dfield = dtuple_get_nth_field(tuple, 0);
@@ -753,7 +755,7 @@
 	rec = btr_pcur_get_rec(&pcur);

 	if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
-					|| rec_get_deleted_flag(rec)) {
+			|| rec_get_deleted_flag(rec, sys_tables->comp)) {
 		/* Not found */

 		btr_pcur_close(&pcur);
@@ -763,11 +765,10 @@
 		return(NULL);
 	}

-	field = rec_get_nth_field(rec, 0, &len);
+	field = rec_get_nth_field_old(rec, 0, &len);

 	/* Check if the table name in record is the searched one */
 	if (len != ut_strlen(name) || ut_memcmp(name, field, len) != 0) {
-	err_exit:
 		btr_pcur_close(&pcur);
 		mtr_commit(&mtr);
 		mem_heap_free(heap);
@@ -777,10 +778,9 @@

 	ut_a(0 == ut_strcmp("SPACE",
 		dict_field_get_col(
-		dict_index_get_nth_field(
-			dict_table_get_first_index(sys_tables), 9))->name));
-
-	field = rec_get_nth_field(rec, 9, &len);
+		dict_index_get_nth_field(sys_index, 9))->name));
+
+	field = rec_get_nth_field_old(rec, 9, &len);
 	space = mach_read_from_4(field);

 	/* Check if the tablespace exists and has the right name */
@@ -812,49 +812,44 @@

 	ut_a(0 == ut_strcmp("N_COLS",
 		dict_field_get_col(
-		dict_index_get_nth_field(
-			dict_table_get_first_index(sys_tables), 4))->name));
-
-	field = rec_get_nth_field(rec, 4, &len);
+		dict_index_get_nth_field(sys_index, 4))->name));
+
+	field = rec_get_nth_field_old(rec, 4, &len);
 	n_cols = mach_read_from_4(field);
-	if (n_cols & 0x80000000UL) {
-		ut_print_timestamp(stderr);
-		fprintf(stderr,
-			"  InnoDB: table %s is in the new compact format\n"
-			"InnoDB: of MySQL 5.0.3 or later\n", name);
-		goto err_exit;
-	}
-
-	table = dict_mem_table_create(name, space, n_cols);
+
+	/* The high-order bit of N_COLS is the "compact format" flag. */
+	table = dict_mem_table_create(name, space,
+					n_cols & ~0x80000000UL,
+					!!(n_cols & 0x80000000UL));

 	table->ibd_file_missing = ibd_file_missing;

 	ut_a(0 == ut_strcmp("ID",
 		dict_field_get_col(
-		dict_index_get_nth_field(
-			dict_table_get_first_index(sys_tables), 3))->name));
-
-	field = rec_get_nth_field(rec, 3, &len);
+		dict_index_get_nth_field(sys_index, 3))->name));
+
+	field = rec_get_nth_field_old(rec, 3, &len);
 	table->id = mach_read_from_8(field);

-	field = rec_get_nth_field(rec, 5, &len);
+	field = rec_get_nth_field_old(rec, 5, &len);
 	table->type = mach_read_from_4(field);

 	if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
 		ut_error;
 #if 0 /* clustered tables have not been implemented yet */
-		field = rec_get_nth_field(rec, 6, &len);
+		field = rec_get_nth_field_old(rec, 6, &len);
 		table->mix_id = mach_read_from_8(field);

-		field = rec_get_nth_field(rec, 8, &len);
+		field = rec_get_nth_field_old(rec, 8, &len);
 		table->cluster_name = mem_heap_strdupl(heap, (char*) field, len);
 #endif
 	}

 	if ((table->type == DICT_TABLE_CLUSTER)
 	    || (table->type == DICT_TABLE_CLUSTER_MEMBER)) {
-
-		field = rec_get_nth_field(rec, 7, &len);
+
+		field = rec_get_nth_field_old(rec, 7, &len);
+		ut_a(len == 4);
 		table->mix_len = mach_read_from_4(field);
 	}

@@ -933,6 +928,7 @@
 	sys_tables = dict_sys->sys_tables;
 	sys_table_ids = dict_table_get_next_index(
 				dict_table_get_first_index(sys_tables));
+	ut_a(!sys_tables->comp);
 	heap = mem_heap_create(256);

 	tuple  = dtuple_create(heap, 1);
@@ -949,7 +945,7 @@
 	rec = btr_pcur_get_rec(&pcur);

 	if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
-					|| rec_get_deleted_flag(rec)) {
+			|| rec_get_deleted_flag(rec, sys_tables->comp)) {
 		/* Not found */

 		btr_pcur_close(&pcur);
@@ -964,7 +960,7 @@
 	table ID and NAME */

 	rec = btr_pcur_get_rec(&pcur);
-	field = rec_get_nth_field(rec, 0, &len);
+	field = rec_get_nth_field_old(rec, 0, &len);
 	ut_ad(len == 8);

 	/* Check if the table id in record is the one searched for */
@@ -978,7 +974,7 @@
 	}

 	/* Now we get the table name from the record */
-	field = rec_get_nth_field(rec, 1, &len);
+	field = rec_get_nth_field_old(rec, 1, &len);
 	/* Load the table definition to memory */
 	table = dict_load_table(mem_heap_strdupl(heap, (char*) field, len));

@@ -1046,6 +1042,7 @@

 	sys_foreign_cols = dict_table_get_low("SYS_FOREIGN_COLS");
 	sys_index = UT_LIST_GET_FIRST(sys_foreign_cols->indexes);
+	ut_a(!sys_foreign_cols->comp);

 	tuple = dtuple_create(foreign->heap, 1);
 	dfield = dtuple_get_nth_field(tuple, 0);
@@ -1060,21 +1057,21 @@
 		rec = btr_pcur_get_rec(&pcur);

 		ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr));
-		ut_a(!rec_get_deleted_flag(rec));
-
-		field = rec_get_nth_field(rec, 0, &len);
+		ut_a(!rec_get_deleted_flag(rec, sys_foreign_cols->comp));
+
+		field = rec_get_nth_field_old(rec, 0, &len);
 		ut_a(len == ut_strlen(id));
 		ut_a(ut_memcmp(id, field, len) == 0);

-		field = rec_get_nth_field(rec, 1, &len);
+		field = rec_get_nth_field_old(rec, 1, &len);
 		ut_a(len == 4);
 		ut_a(i == mach_read_from_4(field));

-		field = rec_get_nth_field(rec, 4, &len);
+		field = rec_get_nth_field_old(rec, 4, &len);
 		foreign->foreign_col_names[i] =
                         mem_heap_strdupl(foreign->heap, (char*) field, len);

-		field = rec_get_nth_field(rec, 5, &len);
+		field = rec_get_nth_field_old(rec, 5, &len);
 		foreign->referenced_col_names[i] =
                   mem_heap_strdupl(foreign->heap, (char*) field, len);

@@ -1118,6 +1115,7 @@

 	sys_foreign = dict_table_get_low("SYS_FOREIGN");
 	sys_index = UT_LIST_GET_FIRST(sys_foreign->indexes);
+	ut_a(!sys_foreign->comp);

 	tuple = dtuple_create(heap2, 1);
 	dfield = dtuple_get_nth_field(tuple, 0);
@@ -1130,7 +1128,7 @@
 	rec = btr_pcur_get_rec(&pcur);

 	if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
-					|| rec_get_deleted_flag(rec)) {
+			|| rec_get_deleted_flag(rec, sys_foreign->comp)) {
 		/* Not found */

 		fprintf(stderr,
@@ -1144,7 +1142,7 @@
 		return(DB_ERROR);
 	}

-	field = rec_get_nth_field(rec, 0, &len);
+	field = rec_get_nth_field_old(rec, 0, &len);

 	/* Check if the id in record is the searched one */
 	if (len != ut_strlen(id) || ut_memcmp(id, field, len) != 0) {
@@ -1167,7 +1165,8 @@

 	foreign = dict_mem_foreign_create();

-	foreign->n_fields = mach_read_from_4(rec_get_nth_field(rec, 5, &len));
+	foreign->n_fields =
+		mach_read_from_4(rec_get_nth_field_old(rec, 5, &len));

 	ut_a(len == 4);

@@ -1178,11 +1177,11 @@

 	foreign->id = mem_heap_strdup(foreign->heap, id);

-	field = rec_get_nth_field(rec, 3, &len);
+	field = rec_get_nth_field_old(rec, 3, &len);
 	foreign->foreign_table_name =
                 mem_heap_strdupl(foreign->heap, (char*) field, len);
-
-	field = rec_get_nth_field(rec, 4, &len);
+
+	field = rec_get_nth_field_old(rec, 4, &len);
 	foreign->referenced_table_name =
                 mem_heap_strdupl(foreign->heap, (char*) field, len);

@@ -1251,6 +1250,7 @@
 		return(DB_ERROR);
 	}

+	ut_a(!sys_foreign->comp);
 	mtr_start(&mtr);

 	/* Get the secondary index based on FOR_NAME from table
@@ -1282,7 +1282,7 @@
 	name and a foreign constraint ID */

 	rec = btr_pcur_get_rec(&pcur);
-	field = rec_get_nth_field(rec, 0, &len);
+	field = rec_get_nth_field_old(rec, 0, &len);

 	/* Check if the table name in the record is the one searched for; the
 	following call does the comparison in the latin1_swedish_ci
@@ -1305,13 +1305,13 @@
 		goto next_rec;
 	}

-	if (rec_get_deleted_flag(rec)) {
+	if (rec_get_deleted_flag(rec, sys_foreign->comp)) {

 		goto next_rec;
 	}

 	/* Now we get a foreign key constraint id */
-	field = rec_get_nth_field(rec, 1, &len);
+	field = rec_get_nth_field_old(rec, 1, &len);
 	id = mem_heap_strdupl(heap, (char*) field, len);

 	btr_pcur_store_position(&pcur, &mtr);


Correct an 'unresolved identifier' problem caused by an "inline"
function being used before it was defined - "forward" declaration
was insufficient.

innobase/lock/lock0lock.c:
  Compile problem on 'build', solved by moving the definition of
  'lock_rec_get_nth_bit' to the place of the ("forward") declaration.
  It is "inline", and now the body really appears before the first use.

--- innobase/lock/lock0lock.c
+++ innobase/lock/lock0lock.c
@@ -373,7 +373,29 @@
 /*=================*/
 			/* out: TRUE if bit set */
 	lock_t*	lock,	/* in: record lock */
-	ulint	i);	/* in: index of the bit */
+	ulint	i)	/* in: index of the bit */
+{
+	ulint	byte_index;
+	ulint	bit_index;
+	ulint	b;
+
+	ut_ad(lock);
+	ut_ad(lock_get_type(lock) == LOCK_REC);
+
+	if (i >= lock->un_member.rec_lock.n_bits) {
+
+		return(FALSE);
+	}
+
+	byte_index = i / 8;
+	bit_index = i % 8;
+
+	b = (ulint)*((byte*)lock + sizeof(lock_t) + byte_index);
+
+	return(ut_bit_get_nth(b, bit_index));
+}
+
+/*************************************************************************/

 #define lock_mutex_enter_kernel()	mutex_enter(&kernel_mutex)
 #define lock_mutex_exit_kernel()	mutex_exit(&kernel_mutex)
@@ -882,36 +904,6 @@
 {
 	return(lock->un_member.rec_lock.n_bits);
 }
-
-/*************************************************************************
-Gets the nth bit of a record lock. */
-UNIV_INLINE
-ibool
-lock_rec_get_nth_bit(
-/*=================*/
-			/* out: TRUE if bit set */
-	lock_t*	lock,	/* in: record lock */
-	ulint	i)	/* in: index of the bit */
-{
-	ulint	byte_index;
-	ulint	bit_index;
-	ulint	b;
-
-	ut_ad(lock);
-	ut_ad(lock_get_type(lock) == LOCK_REC);
-
-	if (i >= lock->un_member.rec_lock.n_bits) {
-
-		return(FALSE);
-	}
-
-	byte_index = i / 8;
-	bit_index = i % 8;
-
-	b = (ulint)*((byte*)lock + sizeof(lock_t) + byte_index);
-
-	return(ut_bit_get_nth(b, bit_index));
-}

 /**************************************************************************
 Sets the nth bit of a record lock to TRUE. */


Set default height for settings dialog to hildon2 standard.

pmo-trunk-r7515

--- src/hildon2/modest-hildon2-global-settings-dialog.c
+++ src/hildon2/modest-hildon2-global-settings-dialog.c
@@ -157,7 +157,7 @@

 	gtk_container_add (GTK_CONTAINER (GTK_DIALOG (self)->vbox), ppriv->updating_page);
 	gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (self)->vbox), MODEST_MARGIN_HALF);
-	gtk_window_set_default_size (GTK_WINDOW (self), -1, 340);
+	gtk_window_set_default_size (GTK_WINDOW (self), -1, MODEST_DIALOG_WINDOW_MAX_HEIGHT);
 }

 static void


Silenced a couple of compilation warnings generated by xcode


add fake usb/charging events for Sony PRSTUX

--- input/input-sony-prstux.h
+++ input/input-sony-prstux.h
@@ -18,8 +18,100 @@
 #ifndef _KO_INPUT_SONY_PRSTUX_H
 #define _KO_INPUT_SONY_PRSTUX_H

-void generateFakeEvent(int pipefd[2]) {
-    return;
+#define SONY_PRSTUX_BATT_DEVPATH "/devices/platform/imx-i2c.1/i2c-1/1-0049/twl6030_bci/power_supply/twl6030_battery"
+#include "libue.h"
+
+#define SONY_PRSTUX_BATTERY_STATE_CHARGING     0
+#define SONY_PRSTUX_BATTERY_STATE_DISCHARGING  1
+#define SONY_PRSTUX_BATTERY_STATE_NOT_CHARGING 2
+#define SONY_PRSTUX_BATTERY_STATE_FULL         3
+#define SONY_PRSTUX_BATTERY_STATE_UNKNOWN      4
+
+static int getBatteryState(void) {
+    int state = SONY_PRSTUX_BATTERY_STATE_DISCHARGING;
+    FILE* file = NULL;
+    size_t bytes_read;
+    char buffer[256] = { 0 };
+
+    file = fopen("/sys" SONY_PRSTUX_BATT_DEVPATH"/status", "r");
+    bytes_read = fread(buffer, 1, 256, file);
+
+    if (strcmp(buffer, "Charging\n") == 0) {
+        state = SONY_PRSTUX_BATTERY_STATE_CHARGING;
+    } else if (strcmp(buffer, "Full\n") == 0) {
+        state = SONY_PRSTUX_BATTERY_STATE_FULL;
+    } else if (strcmp(buffer, "Discharging\n") == 0) {
+        state = SONY_PRSTUX_BATTERY_STATE_DISCHARGING;
+    } else if (strcmp(buffer, "Not Charging\n") == 0) {
+        state = SONY_PRSTUX_BATTERY_STATE_NOT_CHARGING;
+    } else {
+        state = SONY_PRSTUX_BATTERY_STATE_UNKNOWN;
+    }
+    //fprintf(stderr, "battery state string: %s\n", buffer);
+
+    fclose(file);
+    return state;
 }
-
+
+static void sendEvent(int fd, struct input_event* ev) {
+    if (write(fd, ev, sizeof(struct input_event)) == -1) {
+        fprintf(stderr, "Failed to generate fake event.\n");
+    }
+}
+
+static void generateFakeEvent(int pipefd[2]) {
+    int re;
+    struct uevent_listener listener;
+    struct uevent uev;
+    struct input_event ev;
+    int prev_battery_state, battery_state;
+
+    close(pipefd[0]);
+
+    battery_state = getBatteryState();
+    prev_battery_state = battery_state;
+
+    //fprintf(stderr, "[fake] initial battery state: %d\n", battery_state);
+
+    ev.type = EV_KEY;
+    ev.value = 1;
+
+    re = ue_init_listener(&listener);
+    if (re < 0) {
+        fprintf(stderr, "[sony-prstux-fake-event] Failed to initilize libue listener, err: %d\n", re);
+        return;
+    }
+
+    while ((re = ue_wait_for_event(&listener, &uev)) == 0) {
+        if (uev.action == UEVENT_ACTION_CHANGE
+                && uev.devpath
+                && (UE_STR_EQ(uev.devpath, SONY_PRSTUX_BATT_DEVPATH))) {
+
+            battery_state = getBatteryState();
+            //fprintf(stderr, "[fake] battery state now: %d\n", battery_state);
+            if (prev_battery_state != battery_state) {
+                switch(battery_state) {
+                    case SONY_PRSTUX_BATTERY_STATE_CHARGING:
+                        ev.code = CODE_FAKE_USB_PLUG_IN;
+                        sendEvent(pipefd[1], &ev);
+                        ev.code = CODE_FAKE_CHARGING;
+                        sendEvent(pipefd[1], &ev);
+                    break;
+                    case SONY_PRSTUX_BATTERY_STATE_FULL:
+                        ev.code = CODE_FAKE_NOT_CHARGING;
+                        sendEvent(pipefd[1], &ev);
+                    break;
+                    case SONY_PRSTUX_BATTERY_STATE_DISCHARGING:
+                        ev.code = CODE_FAKE_USB_PLUG_OUT;
+                        sendEvent(pipefd[1], &ev);
+                        ev.code = CODE_FAKE_NOT_CHARGING;
+                        sendEvent(pipefd[1], &ev);
+                    break;
+                }
+            }
+            prev_battery_state = battery_state;
+        }
+    }
+}
+
 #endif


logging error

logging error

--- src/ngx_http_mruby_core.c
+++ src/ngx_http_mruby_core.c
@@ -215,6 +215,13 @@
         if (chain == NULL) {
             if (state->mrb->exc) {
                 mrb_gc_arena_restore(state->mrb, state->ai);
+                ngx_log_error(NGX_LOG_ERR
+                              , r->connection->log
+                              , 0
+                              , "%s ERROR %s: Failed to mrb_run"
+                              , MODULE_NAME
+                              , __FUNCTION__
+                              );
                 return NGX_HTTP_INTERNAL_SERVER_ERROR;
             }
             if (r->headers_out.status >= NGX_HTTP_OK) {
@@ -337,7 +344,14 @@

     if (r->headers_out.status == NGX_HTTP_OK) {
         if (chain == NULL) {
-            r->headers_out.status = NGX_HTTP_INTERNAL_SERVER_ERROR;
+            ngx_log_error(NGX_LOG_ERR
+                          , r->connection->log
+                          , 0
+                          , "%s ERROR %s: Nginx.rputs is required in advance of Nginx.return(200)"
+                          , MODULE_NAME
+                          , __FUNCTION__
+                          );
+             r->headers_out.status = NGX_HTTP_INTERNAL_SERVER_ERROR;
         } else {
             ngx_http_send_header(r);
             ngx_http_output_filter(r, chain->out);


Added print function to ArrayManipulator

--- TBTK/calc/TightBindingLib/include/ArrayManipulator.h
+++ TBTK/calc/TightBindingLib/include/ArrayManipulator.h
@@ -9,6 +9,7 @@
 #define COM_DAFER45_TBTK_ARRAY_MANIPULATOR

 #include "Index.h"
+#include <iostream>

 namespace TBTK{
 namespace Util{
@@ -17,17 +18,41 @@
 template<typename T>
 class ArrayManipulator{
 public:
+	/** Allocate uninitialized array. */
 	static void* create(const Index &ranges);
+
+	/** Allocate initialized array. */
 	static void* create(const Index &ranges, T fill);
+
+	/** Deallocate array. */
 	static void destroy(void *array, const Index &ranges);
+
+	/** Flatten multi-dimensional array. */
 	static T* flatten(void *array, const Index &ranges);
+
+	/** Create multi-dimensional array from one-dimensional array. */
 	static void* unflatten(T *array, const Index &ranges);
+
+	/** Print array. */
+	static void print(void * array, const Index &ranges);
 private:
+	/** Recursive helper function for uninitialized create. */
 	static void* createRecursive(Index ranges, void **result);
+
+	/** Recursive helper function for initialized create. */
 	static void* createRecursive(Index ranges, void **result, T fill);
+
+	/** Recursive helper function for destroy. */
 	static void destroyRecursive(void *array, Index ranges);
+
+	/** Recursive helper function for flatten. */
 	static void flattenRecursive(void *array, Index ranges, T *result, int offset);
+
+	/** Recursive helper function for unflatten. */
 	static void unflattenRecursive(T *array, Index ranges, void **result, int offset);
+
+	/** Recursive helper function for print. */
+	static void printRecursive(void *array, Index ranges);
 };

 template<typename T>
@@ -162,8 +187,28 @@
 	}
 }

+template<typename T>
+void ArrayManipulator<T>::print(void *array, const Index &ranges){
+	printRecursive(array, ranges);
+}
+
+template<typename T>
+void ArrayManipulator<T>::printRecursive(void *array, Index ranges){
+	if(ranges.indices.size() == 1){
+		for(int n = 0; n < ranges.indices.at(0); n++)
+			std::cout << ((T*)array)[n] << "\t";
+		std::cout << "\n";
+	}
+	else{
+		int currentRange = ranges.indices.at(0);
+		ranges.indices.erase(ranges.indices.begin());
+		for(int n = 0; n < currentRange; n++)
+			printRecursive(((void**)array)[n], ranges);
+		std::cout << "\n";
+	}
+}
+
 };	//End of namespace Util
 };	//End of namespace TBTK

 #endif
-


fixed macro

fixed macro

--- chesslib.h
+++ chesslib.h
@@ -42,7 +42,7 @@
 # error Non-compatible OS or compiler
 #endif

-#define initChessboard() _initChessboard(chess_board, 0, 'A')
+#define initChessboard(x) _initChessboard(x, 0, 'A')

 #define MOS 17	/*this one controls the chess board size, don't mess with it*/
 #define WHITE 2


more verbose trace information for NPP_ functions

--- src/np_plugin_functions.c
+++ src/np_plugin_functions.c
@@ -9,7 +9,11 @@
 NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[],
         char* argv[], NPSavedData* saved)
 {
-    trace_info("[NPP] %s\n", __func__);
+    int k;
+    trace_info("[NPP] %s pluginType=%s instance=%p, mode=%d, argc=%d, saved=%p\n", __func__,
+               pluginType, instance, mode, argc, saved);
+    for (k = 0; k < argc; k ++)
+        trace_info("            argn[%d] = %s, argv[%d] = %s\n", k, argn[k], k, argv[k]);
     return NPERR_NO_ERROR;
 }

@@ -17,112 +21,119 @@
 NPError
 NPP_Destroy(NPP instance, NPSavedData** save)
 {
-    trace_info("[NPP] %s\n", __func__);
+    trace_info("[NPP] %s instance=%p, save=%p\n", __func__, instance, save);
     return NPERR_NO_ERROR;
 }

 NPError
 NPP_SetWindow(NPP instance, NPWindow* window)
 {
-    trace_info("[NPP] %s\n", __func__);
+    trace_info("[NPP] %s instance=%p, window=%p\n", __func__, instance, window);
     return NPERR_NO_ERROR;
 }

 NPError
 NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype)
 {
-    trace_info("[NPP] %s\n", __func__);
+    trace_info("[NPP] %s instance=%p, type=%s, stream=%p, seekable=%d, stype=%p\n", __func__,
+               instance, type, stream, seekable, stype);
     return NPERR_NO_ERROR;
 }

 NPError
 NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason)
 {
-    trace_info("[NPP] %s\n", __func__);
+    trace_info("[NPP] %s instance=%p, stream=%p, reason=%d\n", __func__,
+               instance, stream, reason);
     return NPERR_NO_ERROR;
 }

 int32_t
 NPP_WriteReady(NPP instance, NPStream* stream)
 {
-    trace_info("[NPP] %s\n", __func__);
+    trace_info("[NPP] %s instance=%p, stream=%p\n", __func__, instance, stream);
     return 0;
 }

 int32_t
 NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer)
 {
-    trace_info("[NPP] %s\n", __func__);
+    trace_info("[NPP] %s instance=%p, stream=%p, offset=%d, len=%d, buffer=%p\n", __func__,
+               instance, stream, offset, len, buffer);
     return 0;
 }

 void
 NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
 {
-    trace_info("[NPP] %s\n", __func__);
+    trace_info("[NPP] %s instance=%p, stream=%p, fname=%s\n", __func__, instance, stream, fname);
     return;
 }

 void
 NPP_Print(NPP instance, NPPrint* platformPrint)
 {
-    trace_info("[NPP] %s\n", __func__);
+    trace_info("[NPP] %s instance=%p, platformPrint=%p\n", __func__, instance, platformPrint);
     return;
 }

 int16_t
 NPP_HandleEvent(NPP instance, void* event)
 {
-    trace_info("[NPP] %s\n", __func__);
+    trace_info("[NPP] %s instance=%p, event=%p\n", __func__, instance, event);
     return 0;
 }

 void
 NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData)
 {
-    trace_info("[NPP] %s\n", __func__);
+    trace_info("[NPP] %s instance=%p, url=%s, reason=%d, notifyData=%p\n", __func__,
+               instance, url, reason, notifyData);
     return;
 }

 NPError
 NPP_GetValue(NPP instance, NPPVariable variable, void *value)
 {
-    trace_info("[NPP] %s\n", __func__);
+    trace_info("[NPP] %s instance=%p, variable=%d, value=%p\n", __func__,
+               instance, variable, value);
     return NPERR_NO_ERROR;
 }

 NPError
 NPP_SetValue(NPP instance, NPNVariable variable, void *value)
 {
-    trace_info("[NPP] %s\n", __func__);
+    trace_info("[NPP] %s instance=%p, variable=%d, value=%p\n", __func__,
+               instance, variable, value);
     return NPERR_NO_ERROR;
 }

 NPBool
 NPP_GotFocus(NPP instance, NPFocusDirection direction)
 {
-    trace_info("[NPP] %s\n", __func__);
+    trace_info("[NPP] %s instance=%p, direction=%d\n", __func__, instance, direction);
     return 1;
 }

 void
 NPP_LostFocus(NPP instance)
 {
-    trace_info("[NPP] %s\n", __func__);
+    trace_info("[NPP] %s instance=%p\n", __func__, instance);
     return;
 }

 void
 NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData)
 {
-    trace_info("[NPP] %s\n", __func__);
+    trace_info("[NPP] %s instance=%p, url=%s, status=%d, notifyData=%p\n", __func__,
+               instance, url, status, notifyData);
     return;
 }

 NPError
 NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge)
 {
-    trace_info("[NPP] %s\n", __func__);
+    trace_info("[NPP] %s site=%s, flags=%llu, maxAge=%llu\n", __func__, site, flags, maxAge);
     return NPERR_NO_ERROR;
 }

@@ -136,6 +147,6 @@
 void
 NPP_DidComposite(NPP instance)
 {
-    trace_info("[NPP] %s\n", __func__);
+    trace_info("[NPP] %s instance=%p\n", __func__, instance);
     return;
 }


bug fixes in templates

bug fixes in templates

--- src/ofxEasyOscTemplates.h
+++ src/ofxEasyOscTemplates.h
@@ -4,6 +4,7 @@
 #include "ofxOsc.h"
 #include <functional>
 #include <type_traits>
+#include <typeinfo>

 //*--------------------------------------------------------------------------------------------------*//

@@ -17,7 +18,7 @@
     public:
         virtual ~ofxOscListener() {}
         // generic dispatch method, implemented differently for ofxOscVariable and ofxOscMemberFunction
-        virtual void dispatch(const ofxOscMessage & msg) = 0;
+        virtual void dispatch(const ofxOscMessage& msg) = 0;
         virtual bool compare(ofxOscListener* listener) = 0;
         virtual bool isLambda() {
             return false;
@@ -26,11 +27,11 @@
     protected:
         template<typename T>
         void getData(const ofxOscMessage& msg, int index, T& dest){
-            cout << "Bad argument type for variable/function argument!\n";
-        }
-        // overload for STL containers
-        template <typename T, template<typename E, typename Allocator = std::allocator<E>> class Container>
-        void getData(const ofxOscMessage& msg, int index, Container<T>& dest){
+            cout << "Bad argument type for variable/function argument " << typeid(dest).name() << "!\n";
+        }
+        // overload for std::vector
+        template <typename T>
+        void getData(const ofxOscMessage& msg, int index, vector<T>& dest){
             int length = msg.getNumArgs();
             dest.resize(length);

@@ -163,7 +164,7 @@
         // assigns OSC data to the variable.
         void dispatch(const ofxOscMessage & msg){
             if (var) {
-                getData<T>(msg, 0, *var);
+                getData(msg, 0, *var);
 			}
         }
         bool compare(ofxOscListener * listener){
@@ -291,8 +292,8 @@
         ofxOscMemberFunction(TObject* obj_, TReturn(TObject::*func_)(TArg)) : obj(obj_), func(func_) {}
         ~ofxOscMemberFunction() {}
         void dispatch(const ofxOscMessage & msg){
-            // decay: remove constness and references to get the bare type
-            typename std::decay<TArg>::type arg;
+            // remove constness and references to get the bare type
+            typename decay<TArg>::type arg;
             getData(msg, 0, arg);
             if (obj) {
                 (obj->*func)(arg);


printer BUGFIX printing into a memory

printer BUGFIX printing into a memory

wrong counting of the allocated space caused accessing out of bound memory

--- src/printer.c
+++ src/printer.c
@@ -125,7 +125,7 @@
                 return -1;
             }
             out->method.mem.buf = aux;
-            out->method.mem.size += count + 1;
+            out->method.mem.size = out->method.mem.len + count + 1;
         }
         memcpy(&out->method.mem.buf[out->method.mem.len], buf, count + 1);
         out->method.mem.len += count;


[for PSQL 10.1-1] Fix bug of a missing test in a subtyping

--- src/provsql.c
+++ src/provsql.c
@@ -216,7 +216,7 @@
   Const *c2;
   Var *v1;
   Var *v2;
-
+
   if(lnext(list_head(fromOpExpr->args))) {
     /* Sometimes Var is nested within a RelabelType */
     if(IsA(linitial(fromOpExpr->args), Var)) {
@@ -294,8 +294,10 @@
     } else {
       ListCell *lc2;
       foreach(lc2,be->args) {
-        oe = (OpExpr *) lfirst(lc2);
-        result = add_eq_from_OpExpr_to_Expr(oe,result,columns,constants);
+        if(IsA(lfirst(lc2),OpExpr)) {
+          oe = (OpExpr *) lfirst(lc2);
+          result = add_eq_from_OpExpr_to_Expr(oe,result,columns,constants);
+        }
       }
     }
   } /* Handle case of CROSS JOIN with no eqop */


Revert "Do not copy extra terminate character for null-length string in p_strdup()"

This reverts commit 57c6246f239d7594a8c4e564d4b82de2402c16d1.

--- src/pstring.c
+++ src/pstring.c
@@ -31,11 +31,7 @@
 	if (str == NULL)
 		return NULL;

-	len = strlen (str);
-
-	if (len != 0)
-		len += 1;
-
+	len = strlen (str) + 1;
 	if ((ret = p_malloc (len)) == NULL)
 		return NULL;


Replacing calloc() with Calloc().

Replacing calloc() with Calloc().

git-svn-id: b6c97393e82be3812a607970066d172a5388f86f@1149 df83fd30-4cca-4c36-ab9d-e8b5583ccbd1

--- src/omxAlgebraFunctions.c
+++ src/omxAlgebraFunctions.c
@@ -60,10 +60,10 @@
 			continue;
 		}
 		if(current <= previous) {
-			char *errstr = calloc(250, sizeof(char));
+			char *errstr = Calloc(250, char);
 			sprintf(errstr, "Thresholds are not strictly increasing.");
 			omxRaiseError(om->currentState, -1, errstr);
-			free(errstr);
+			Free(errstr);
 		}
 	}
 }
@@ -103,10 +103,10 @@
 	omxCopyMatrix(result, inMat);
 	F77_CALL(dgetrf)(&(result->cols), &(result->rows), result->data, &(result->leading), ipiv, &l);
 	if(l != 0) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Attempted to invert non-invertable matrix.");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 	}
 	F77_CALL(dgetri)(&(result->cols), result->data, &(result->leading), ipiv, work, &lwork, &l);

@@ -131,10 +131,10 @@
 			for(int k = 0; k < inMat->cols; k++)
 				omxSetMatrixElement(result, j, k, pow(omxMatrixElement(inMat, j,k), omxMatrixElement(power, j,k)));
 	} else {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Non-conformable matrices in ^ operator.");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 	}

 }
@@ -148,9 +148,9 @@
 	omxMatrix* postMul = matList[1];

 	if(preMul == NULL || postMul == NULL) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Null matrix pointer detected.\n");
-		free(errstr);
+		Free(errstr);
 	}

 	static double zero = 0.0;
@@ -158,10 +158,10 @@

 	/* Conformability Check! */
 	if(preMul->cols != postMul->rows) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Non-conformable matrices [(%d x %d) and (%d x %d)] in Matrix Multiply.", preMul->rows, preMul->cols, postMul->rows, postMul->cols);
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 	}

 	if(result->rows != preMul->rows || result->cols != postMul->cols)
@@ -187,10 +187,10 @@

 	/* Conformability Check! */
 	if(first->cols != second->cols || first->rows != second->rows) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Non-conformable matrices in Element Multiplication.");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 	}

 	omxCopyMatrix(result, first);
@@ -308,10 +308,10 @@

 	/* Conformability Check! */
 	if(inMat->cols != divisor->cols || inMat->rows != divisor->rows) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Non-conformable matrices in Element Division.");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 	}

 	omxCopyMatrix(result, inMat);
@@ -338,10 +338,10 @@

 	/* Conformability Check! */
 	if(inMat->cols != addend->cols || inMat->rows != addend->rows) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Non-conformable matrices in Matrix Addition.");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 	}

 	omxCopyMatrix(result, inMat);
@@ -363,7 +363,7 @@
 	int *retval;
 	/* Case 1: the source vector contains no elements */
 	if (source->rows == 0 || source->cols == 0) {
-		retval = (int*) calloc(dimLength, sizeof(int));
+		retval = (int*) Calloc(dimLength, int);
 		for(int i = 0; i < dimLength; i++) {
 			retval[i] = i;
 		}
@@ -375,20 +375,20 @@
 	for(int i = 0; i < source->rows * source->cols; i++) {
 		double delement = omxVectorElement(source, i);
 		if (!R_finite(delement)) {
-			char *errstr = calloc(250, sizeof(char));
+			char *errstr = Calloc(250, char);
 			sprintf(errstr, "non-finite value in '[' operator.\n");
 			omxRaiseError(result->currentState, -1, errstr);
-			free(errstr);
+			Free(errstr);
 			return(0);
 		}
 		int element = (int) delement;
 		if (element < 0) {
 			/* bounds checking */
 			if (element < - dimLength) {
-				char *errstr = calloc(250, sizeof(char));
+				char *errstr = Calloc(250, char);
 				sprintf(errstr, "index %d is out of bounds in '[' operator.", element);
 				omxRaiseError(result->currentState, -1, errstr);
-				free(errstr);
+				Free(errstr);
 				return(0);
 			}
 			negative++;
@@ -397,10 +397,10 @@
 		} else {
 			/* bounds checking */
 			if (element > dimLength) {
-				char *errstr = calloc(250, sizeof(char));
+				char *errstr = Calloc(250, char);
 				sprintf(errstr, "index %d is out of bounds in '[' operator.", element);
 				omxRaiseError(result->currentState, -1, errstr);
-				free(errstr);
+				Free(errstr);
 				return(0);
 			}
 			positive++;
@@ -408,15 +408,15 @@
 	}
 	/* It is illegal to mix positive and negative elements */
 	if (positive > 0 && negative > 0) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Positive and negative indices together in '[' operator.");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 		return(0);
 	}
 	/* convert negative indices into a list of positive indices */
 	if (negative > 0) {
-		int *track = calloc(dimLength, sizeof(int));
+		int *track = Calloc(dimLength, int);
 		int length = dimLength;
 		for(int i = 0; i < source->rows * source->cols; i++) {
 			int element = (int) omxVectorElement(source, i);
@@ -426,24 +426,24 @@
 			}
 		}
 		if (length == 0) {
-			free(track);
+			Free(track);
 			return(0);
 		}
-		retval = calloc(length, sizeof(int));
+		retval = Calloc(length, int);
 		int j = 0;
 		for(int i = 0; i < dimLength; i++) {
 			if(!track[i]) {
 				retval[j++] = i;
 			}
 		}
-		free(track);
+		Free(track);
 		*indices = retval;
 		return(length);
 	}
 	/* convert positive indices with offset of zero instead of one */
 	if (positive > 0) {
 		int length = positive - zero;
-		retval = calloc(length, sizeof(int));
+		retval = Calloc(length, int);
 		int j = 0;
 		for(int i = 0; i < source->rows * source->cols; i++) {
 			int element = (int) omxVectorElement(source, i);
@@ -483,8 +483,8 @@
 		}
 	}

-	if (rowIndexLength > 0) free(rowIndices);
-	if (colIndexLength > 0) free(colIndices);
+	if (rowIndexLength > 0) Free(rowIndices);
+	if (colIndexLength > 0) Free(colIndices);

 }

@@ -497,10 +497,10 @@
 	omxMatrix* subtrahend = matList[1];

 	if(inMat->cols != subtrahend->cols || inMat->rows != subtrahend->rows) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Non-conformable matrices in Matrix Subtract.");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 	}

 	omxCopyMatrix(result, inMat);
@@ -556,10 +556,10 @@

 	for(int j = 0; j < numArgs; j++) {
 		if(totalRows != matList[j]->rows) {
-			char *errstr = calloc(250, sizeof(char));
+			char *errstr = Calloc(250, char);
 			sprintf(errstr, "Non-conformable matrices in horizontal concatenation (cbind). First argument has %d rows, and argument #%d has %d rows.", totalRows, j + 1, matList[j]->rows);
 			omxRaiseError(result->currentState, -1, errstr);
-			free(errstr);
+			Free(errstr);
 		}
 		totalCols += matList[j]->cols;
 	}
@@ -592,10 +592,10 @@

 	for(int j = 0; j < numArgs; j++) {
 		if(totalCols != matList[j]->cols) {
-			char *errstr = calloc(250, sizeof(char));
+			char *errstr = Calloc(250, char);
 			sprintf(errstr, "Non-conformable matrices in vertical concatenation (rbind). First argument has %d cols, and argument #%d has %d cols.", totalCols, j + 1, matList[j]->cols);
 			omxRaiseError(result->currentState, -1, errstr);
-			free(errstr);
+			Free(errstr);
 		}
 		totalRows += matList[j]->rows;
 	}
@@ -629,10 +629,10 @@
 	int info;

 	if(rows != cols) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Determinant of non-square matrix cannot be found.\n");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 	}

 	if(result->rows != 1 || result->cols != 1) {
@@ -647,10 +647,10 @@
 	F77_CALL(dgetrf)(&(calcMat->rows), &(calcMat->cols), calcMat->data, &(calcMat->cols), ipiv, &info);

 	if(info != 0) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Determinant Calculation: Nonsingular matrix (at row %d) on LUP decomposition.", info);
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 	}

 	if(OMX_DEBUG_ALGEBRA) {
@@ -685,10 +685,10 @@
 	}

 	if(inMat->rows != inMat->cols) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Non-square matrix in Trace().\n");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 	}

 	double trace = 0.0;
@@ -854,10 +854,10 @@
 	}

 	if(inMat->cols != 1 && inMat->rows != 1) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "To generate a matrix from a diagonal that is not 1xN or Nx1.");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 	}

 	if (result->cols != diags || result->rows != diags) {
@@ -1057,10 +1057,10 @@
 	}

 	if(counter != size) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Internal error in vech().\n");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 	}

 }
@@ -1089,10 +1089,10 @@
 	}

 	if(counter != size) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Internal error in vechs().\n");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 	}

 }
@@ -1103,17 +1103,17 @@
 	double stop = omxVectorElement(matList[1], 0);

 	if (!R_finite(start)) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Non-finite start value in ':' operator.\n");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 	}

 	if (!R_finite(stop)) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Non-finite stop value in ':' operator.\n");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 	}

 	double difference = stop - start;
@@ -1158,34 +1158,34 @@
 	if (result->rows != 1 || result->cols != 1) omxResizeMatrix(result, 1, 1, FALSE);

 	if (cov->rows != cov->cols) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "covariance is not a square matrix");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 		return;
 	}

 	if (means->rows > 1 && means->cols > 1) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "means is neither row nor column vector");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 		return;
 	}

 	if (lBoundMat->rows > 1 && lBoundMat->cols > 1) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "lbounds is neither row nor column vector");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 		return;
 	}

 	if (uBoundMat->rows > 1 && uBoundMat->cols > 1) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "ubounds is neither row nor column vector");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 		return;
 	}

@@ -1195,7 +1195,7 @@
 	double *corList;
 	lBounds = (double*) Calloc(nElements, double);
 	uBounds = (double*) Calloc(nElements, double);
-	weights = (double*) Calloc(nElements, double);
+	weights = (double*) Calloc(nElements, double);
 	corList = (double*) Calloc(nElements * (nElements + 1) / 2, double);

 	omxStandardizeCovMatrix(cov, corList, weights);
@@ -1229,10 +1229,10 @@
 		uBounds[i] = (omxVectorElement(uBoundMat, i) - omxVectorElement(means, i))/weights[i];
 		Infin[i] = 2; // Default to both thresholds
 		if(uBounds[i] <= lBounds[i]) {
-			char *errstr = calloc(250, sizeof(char));
+			char *errstr = Calloc(250, char);
 			sprintf(errstr, "Thresholds are not strictly increasing: %3.3f >= %3.3f.", lBounds[i], uBounds[i]);
 			omxRaiseError(result->currentState, -1, errstr);
-			free(errstr);
+			Free(errstr);
 		}
 		if(!R_finite(lBounds[i]) ) {
 			Infin[i] -= 2;	// NA or INF or -INF means no lower threshold.
@@ -1250,12 +1250,12 @@
 	if(OMX_DEBUG_ALGEBRA) { Rprintf("Output of sadmvn is %f, %f, %d.\n", Error, likelihood, inform); }

 	if(inform == 2) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Improper input to sadmvn.");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
-	}
-
+		Free(errstr);
+	}
+
 	Free(corList);
 	Free(weights);
 	Free(uBounds);
@@ -1291,10 +1291,10 @@
 		for(j = 0; j < thresholdMats[currentMat]->cols; j++) {	// We walk along the columns of this threshold matrix
 			double ubound, lbound = omxMatrixElement(thresholdMats[currentMat], 0, j);
 			if(ISNA(lbound)) {
-				char *errstr = calloc(250, sizeof(char));
+				char *errstr = Calloc(250, char);
 				sprintf(errstr, "Invalid lowest threshold for dimension %d of Allint.", j);
 				omxRaiseError(result->currentState, -1, errstr);
-				free(errstr);
+				Free(errstr);
 				return;
 			}

@@ -1309,10 +1309,10 @@
 				}

 				if(!(ubound > lbound)) {
-					char *errstr = calloc(250, sizeof(char));
+					char *errstr = Calloc(250, char);
 					sprintf(errstr, "Thresholds (%f and %f) are not strictly increasing for dimension %d of Allint.", lbound, ubound, j+1);
 					omxRaiseError(result->currentState, -1, errstr);
-					free(errstr);
+					Free(errstr);
 					return;
 				}

@@ -1394,10 +1394,10 @@
 	if(OMX_DEBUG_ALGEBRA) { Rprintf("Output of sadmvn is %f, %f, %d.\n", Error, likelihood, inform); }

 	if(inform == 2) {
-		char *errstr = calloc(250, sizeof(char));
+		char *errstr = Calloc(250, char);
 		sprintf(errstr, "Improper input to sadmvn.");
 		omxRaiseError(result->currentState, -1, errstr);
-		free(errstr);
+		Free(errstr);
 	}

 	omxSetMatrixElement(result, 0, 0, likelihood);
@@ -1436,10 +1436,10 @@
 		if(OMX_DEBUG_ALGEBRA) { Rprintf("Output of sadmvn is %f, %f, %d.\n", Error, likelihood, inform); }

 		if(inform == 2) {
-			char *errstr = calloc(250, sizeof(char));
+			char *errstr = Calloc(250, char);
 			sprintf(errstr, "Improper input to sadmvn.");
 			omxRaiseError(result->currentState, -1, errstr);
-			free(errstr);
+			Free(errstr);
 		}

 		omxSetMatrixElement(result, i, 0, likelihood);


test mod

test mod


fixed up no bell when moving down in history

--- src/rawline.c
+++ src/rawline.c
@@ -789,7 +789,8 @@
 		_raw_redraw(raw, !move);

 		/* add current line status to temporary history */
-		_raw_hist_add_str(raw, raw->line->line->str);
+		if(raw->hist->index >= 0)
+			_raw_hist_add_str(raw, raw->line->line->str);
 	} while(!enter);

 	/* disable raw mode */


Optimze _dl_memset() for PowerPC. Other arches may also benefit from this iff it can do unaligned stores.

--- ldso/include/dl-string.h
+++ ldso/include/dl-string.h
@@ -158,6 +158,33 @@
 	return 0;
 }

+#if defined(powerpc)
+/* Will generate smaller and faster code due to loop unrolling.*/
+static inline void *_dl_memset(void *to, int c, size_t n)
+{
+        unsigned long chunks;
+        unsigned long *tmp_to;
+	unsigned char *tmp_char;
+
+        chunks = n / 4;
+        tmp_to = to + n;
+        c = c << 8 | c;
+        c = c << 16 | c;
+        if (!chunks)
+                goto lessthan4;
+        do {
+                *--tmp_to = c;
+        } while (--chunks);
+ lessthan4:
+        n = n % 4;
+        if (!n ) return to;
+        tmp_char = (unsigned char *)tmp_to;
+        do {
+                *--tmp_char = c;
+        } while (--n);
+        return to;
+}
+#else
 static inline void * _dl_memset(void * str,int c,size_t len)
 {
 	register char *a = str;
@@ -167,6 +194,7 @@

 	return str;
 }
+#endif

 static inline char *_dl_get_last_path_component(char *path)
 {


Use clear-handler function in finalize instead of dupping the code

--- src/request.c
+++ src/request.c
@@ -295,18 +295,7 @@

   DEBUG ("%p", object);

-  if (self->internal_handler_clear != NULL)
-    {
-      tp_clear_pointer (&self->internal_handler_data,
-          self->internal_handler_clear);
-      self->internal_handler_clear = NULL;
-    }
-  else
-    {
-      self->internal_handler_data = NULL;
-    }
-
-  self->internal_handler = NULL;
+  _mcd_request_clear_internal_handler (self);

   g_free (self->preferred_handler);
   g_free (self->object_path);


Missed return value

Missed return value

--- src/request.c
+++ src/request.c
@@ -300,6 +300,8 @@

         p_request = p_request->next;
     }
+
+    return 0;
 }

 int Process_Request(struct client_request *cr, struct request *s_request)


resolve CHANGE resolve_sibling uses a function instead recursion

--- src/resolve.c
+++ src/resolve.c
@@ -1652,6 +1652,7 @@
  * @param[in] name Node name.
  * @param[in] nam_len Node name length.
  * @param[in] type ORed desired type of the node. 0 means any type.
+ *                 Returns only schema data nodes (no uses, grouping, augment, choice, case).
  * @param[out] ret Pointer to the node of the desired type. Can be NULL.
  *
  * @return EXIT_SUCCESS on success, EXIT_FAILURE on forward reference, -1 on error.
@@ -1662,7 +1663,7 @@
 {
     struct lys_node *node, *old_siblings = NULL;
     struct lys_module *prefix_mod, *cur_mod;
-    int in_submod, rc;
+    int in_submod;

     assert(mod && siblings && name);
     assert(!(type & LYS_USES));
@@ -1687,7 +1688,7 @@
             return -1;
         }
         cur_mod = prefix_mod;
-        /* it is our module */
+        /* it is not our module */
         if (cur_mod != mod) {
             old_siblings = siblings;
             siblings = cur_mod->data;
@@ -1702,20 +1703,8 @@

     while (1) {
         /* try to find the node */
-        LY_TREE_FOR(siblings, node) {
-            if (node->nodetype == LYS_USES) {
-                /* an unresolved uses, we can still find it elsewhere */
-                if (!node->child) {
-                    continue;
-                }
-
-                /* search recursively */
-                rc = resolve_sibling(mod, node->child, prefix, pref_len, name, nam_len, type, ret);
-                if (rc != EXIT_FAILURE) {
-                    return rc;
-                }
-            }
-
+        node = NULL;
+        while ((node = lys_getnext(node, siblings->parent, cur_mod, 0))) {
             if (!type || (node->nodetype & type)) {
                 /* module check */
                 if (!node->module->type) {
@@ -2481,7 +2470,7 @@
             node = node->child;
         }

-        rc = resolve_sibling(mod, node, prefix, pref_len, name, nam_len, LYS_ANY & ~(LYS_GROUPING | LYS_USES), &node);
+        rc = resolve_sibling(mod, node, prefix, pref_len, name, nam_len, LYS_ANY, &node);
         if (rc) {
             LOGVAL(LYE_NORESOLV, line, path);
             return rc;


resolve BUGFIX -1 return should be EXIT_FAILURE

--- src/resolve.c
+++ src/resolve.c
@@ -2495,7 +2495,7 @@
             }

             if ((i = resolve_path_predicate_schema(id, mod, node, parent_node, line)) < 1) {
-                return -1;
+                return EXIT_FAILURE;
             }
             id += i;
         }


[cc1] Use u variable in emitconst()

[cc1] Use u variable in emitconst()

This variable was used to avoid type punning in emitconst(),
but due to a error at the end the type punning was done.

--- cc1/code.c
+++ cc1/code.c
@@ -224,7 +224,7 @@
 		fprintf(outfp,
 		        "#%c%llX",
 		        np->type->letter,
-		        (long long) sym->u.i & ones(tp->size));
+		        (long long) u & ones(tp->size));
 		break;
 	default:
 		abort();


Detect bad class specifiers in function declarations

function declarations in non external context could be specified
with a class storage, but a good compiler should detect this
situation and gives and error this problem.

--- cc1/decl.c
+++ cc1/decl.c
@@ -397,7 +397,7 @@
 {
 	Type *tp;
 	Symbol *sym;
-	int8_t sclass;
+	int8_t sclass, isfun;

 	tp = specifier(&sclass);
 	if (accept(';'))
@@ -406,12 +406,30 @@
 	do {
 		sym = declarator(tp, ID_EXPECTED);
 		sym->s.isdefined = 1;
+		isfun = BTYPE(sym->type) != FTN;
+
 		switch (sclass) {
-		case REGISTER: sym->s.isregister = 1; break;
-		case STATIC: sym->s.isstatic = 1; break;
-		case EXTERN: sym->s.isdefined = 0; break;
-		case TYPEDEF: /* TODO: */;break;
-		case AUTO: default: sym->s.isauto = 1;
+		case TYPEDEF:
+			/* TODO: */
+			break;
+		case STATIC:
+			sym->s.isstatic = 1;
+			break;
+		case EXTERN:
+			sym->s.isdefined = 0;
+			break;
+		case REGISTER:
+			sym->s.isregister = 1;
+			if (isfun)
+				goto bad_function;
+			break;
+		case AUTO:
+			if (isfun)
+				goto bad_function;
+			/* passtrough */
+		default:
+			sym->s.isauto = 1;
+			break;
 		}
 		if (accept('='))
 			initializer(sym);
@@ -419,6 +437,10 @@
 	} while (accept(','));

 	expect(';');
+	return;
+
+bad_function:
+	error("invalid storage class for function '%s'", sym->name);
 }

 Type *


added eigcov prototype

added eigcov prototype

--- src/pcapack/src/pcapack.h
+++ src/pcapack/src/pcapack.h
@@ -21,6 +21,7 @@

 // svd.c
 int pcapack_svd(bool inplace, const int nu, const int nv, int m, int n, double *x, double *s, double *u, double *vt);
+int pcapack_eig(bool inplace, bool only_values, bool symmetric, int n, double *x, double * values, double *vectors);

 #endif


Implemented CBA and CBQ

Implemented CBA and CBQ

--- src/plugins/engineering.c
+++ src/plugins/engineering.c
@@ -129,8 +129,8 @@

 /* neighbor cells */
 enum { NC_COL_FREQUENCY, NC_COL_C1, NC_COL_C2, NC_COL_RXLEV, NC_COL_BSIC,
-	NC_COL_CELL_ID, NC_COL_LAC, NC_COL_FRAME_OFFSET, NC_COL_CELL_TYPE_IND,
-	NC_COL_RAC };
+	NC_COL_CELL_ID, NC_COL_LAC, NC_COL_FRAME_OFFSET, NC_COL_CBA, NC_COL_CBQ,
+	NC_COL_CELL_TYPE_IND, NC_COL_RAC };
 #define NC_COL_LAST NC_COL_RAC
 #define NC_COL_COUNT (NC_COL_LAST + 1)

@@ -148,6 +148,8 @@
 	{ NC_COL_CELL_ID, "Cell ID" },
 	{ NC_COL_LAC, "Area code" },
 	{ NC_COL_FRAME_OFFSET, "Frame offset" },
+	{ NC_COL_CBA, "Cell Bar Access" },
+	{ NC_COL_CBQ, "Cell Bar Qualify" },
 	{ NC_COL_CELL_TYPE_IND, "Cell type" },
 	{ NC_COL_RAC, "Routing area code" },
 	{ 0, NULL }
@@ -268,6 +270,8 @@
 			G_TYPE_STRING,		/* NC_COL_CELL_ID */
 			G_TYPE_STRING,		/* NC_COL_LAC */
 			G_TYPE_STRING,		/* NC_COL_FRAME_OFFSET */
+			G_TYPE_STRING,		/* NC_COL_CBA */
+			G_TYPE_STRING,		/* NC_COL_CBQ */
 			G_TYPE_STRING,		/* NC_COL_CELL_TYPE_IND */
 			G_TYPE_STRING);		/* NC_COL_RAC */
 	scrolled = gtk_scrolled_window_new(NULL, NULL);
@@ -413,8 +417,10 @@
 		unsigned int frame_offset, GtkTreeIter * iter);
 static int _do_time_alignment(Engineering * engineering,
 		unsigned int time_alignment);
-static int _do_cba(Engineering * engineering, unsigned int cba);
-static int _do_cbq(Engineering * engineering, unsigned int cbq);
+static int _do_cba(Engineering * engineering, unsigned int cba,
+		GtkTreeIter * iter);
+static int _do_cbq(Engineering * engineering, unsigned int cbq,
+		GtkTreeIter * iter);
 static int _do_cell_type_ind(Engineering * engineering,
 		unsigned int cell_type_ind, GtkTreeIter * iter);
 static int _do_rac(Engineering * engineering, unsigned int rac,
@@ -604,9 +610,9 @@
 		case ENCI_TIME_ALIGNMENT:
 			return _do_time_alignment(engineering, u);
 		case ENCI_CBA:
-			return _do_cba(engineering, u);
+			return _do_cba(engineering, u, iter);
 		case ENCI_CBQ:
-			return _do_cbq(engineering, u);
+			return _do_cbq(engineering, u, iter);
 		case ENCI_CELL_TYPE_IND:
 			return _do_cell_type_ind(engineering, u, iter);
 		case ENCI_RAC:
@@ -746,13 +752,21 @@
 	return 0;
 }

-static int _do_cba(Engineering * engineering, unsigned int cba)
-{
-	return 0;
-}
-
-static int _do_cbq(Engineering * engineering, unsigned int cbq)
-{
+static int _do_cba(Engineering * engineering, unsigned int cba,
+		GtkTreeIter * iter)
+{
+	char const * buf = cba ? "Yes" : "No";
+
+	gtk_list_store_set(engineering->nc_store, iter, NC_COL_CBA, buf, -1);
+	return 0;
+}
+
+static int _do_cbq(Engineering * engineering, unsigned int cbq,
+		GtkTreeIter * iter)
+{
+	char const * buf = cbq ? "Yes" : "No";
+
+	gtk_list_store_set(engineering->nc_store, iter, NC_COL_CBQ, buf, -1);
 	return 0;
 }


ikev2: fix non-matching SPIs during rekey

Type:fix

Change-Id: I01ac57f6186b20d8ab4070b7259a82a150f0ae9a
Signed-off-by: Filip Tehlar <9891019d6f5d48a43af8fb71dfec78974db6001d@cisco.com>

--- src/plugins/ikev2/ikev2.c
+++ src/plugins/ikev2/ikev2.c
@@ -1541,6 +1541,8 @@
   vec_add1 (sas_in, a->remote_sa_id);
   if (a->is_rekey)
     {
+      ipsec_tun_protect_del (sw_if_index, NULL);
+
       /* replace local SA immediately */
       ipsec_sa_unlock_id (a->local_sa_id);


pmlogrewrite - missing initialization for one_name in metricspec

QA 483 and 496 were failing on some platforms.

--- src/pmlogrewrite/metric.c
+++ src/pmlogrewrite/metric.c
@@ -72,6 +72,7 @@
 	metric_root = mp;
 	mp->output = OUTPUT_ALL;
 	mp->one_inst = 0;
+	mp->one_name = NULL;
 	mp->old_name = name;
 	mp->old_desc = desc;
 	mp->new_desc = mp->old_desc;


Add a simple server abstraction.

Add a simple server abstraction.

git-svn-id: 9e2532540f1574e817ce42f20b9d0fb64899e451@776 4068ffdb-0463-0410-8185-8cc71e3bd399

error: pathspec 'io/socket/simple_server.h' did not match any file(s) known to git

--- io/socket/simple_server.h
+++ io/socket/simple_server.h
@@ -0,0 +1,105 @@
+#ifndef	IO_SOCKET_SIMPLE_SERVER_H
+#define	IO_SOCKET_SIMPLE_SERVER_H
+
+#include <io/socket/socket.h>
+
+/*
+ * XXX
+ * This is just one level up from using macros.  Would be nice to use abstract
+ * base classes and something a bit tidier.
+ */
+template<typename A, typename C, typename L>
+class SimpleServer {
+	LogHandle log_;
+	A arg_;
+	L *server_;
+	Action *accept_action_;
+	Action *close_action_;
+	Action *stop_action_;
+public:
+	SimpleServer(LogHandle log, A arg, SocketAddressFamily family, const std::string& interface)
+	: log_(log),
+	  arg_(arg),
+	  server_(NULL),
+	  accept_action_(NULL),
+	  close_action_(NULL),
+	  stop_action_(NULL)
+	{
+		server_ = L::listen(family, interface);
+		if (server_ == NULL)
+			HALT(log_) << "Unable to create listener.";
+
+		INFO(log_) << "Listening on: " << server_->getsockname();
+
+		EventCallback *cb = callback(this, &SimpleServer::accept_complete);
+		accept_action_ = server_->accept(cb);
+
+		Callback *scb = callback(this, &SimpleServer::stop);
+		stop_action_ = EventSystem::instance()->register_interest(EventInterestStop, scb);
+	}
+
+	~SimpleServer()
+	{
+		ASSERT(server_ == NULL);
+		ASSERT(accept_action_ == NULL);
+		ASSERT(close_action_ == NULL);
+		ASSERT(stop_action_ == NULL);
+	}
+
+private:
+	void accept_complete(Event e)
+	{
+		accept_action_->cancel();
+		accept_action_ = NULL;
+
+		switch (e.type_) {
+		case Event::Done:
+			break;
+		case Event::Error:
+			ERROR(log_) << "Accept error: " << e;
+			break;
+		default:
+			ERROR(log_) << "Unexpected event: " << e;
+			break;
+		}
+
+		if (e.type_ == Event::Done) {
+			Socket *client = (Socket *)e.data_;
+
+			INFO(log_) << "Accepted client: " << client->getpeername();
+
+			new C(arg_, client);
+		}
+
+		EventCallback *cb = callback(this, &SimpleServer::accept_complete);
+		accept_action_ = server_->accept(cb);
+	}
+
+	void close_complete(void)
+	{
+		close_action_->cancel();
+		close_action_ = NULL;
+
+		ASSERT(server_ != NULL);
+		delete server_;
+		server_ = NULL;
+
+		delete this;
+	}
+
+	void stop(void)
+	{
+		stop_action_->cancel();
+		stop_action_ = NULL;
+
+		accept_action_->cancel();
+		accept_action_ = NULL;
+
+		ASSERT(close_action_ == NULL);
+
+		Callback *cb = callback(this, &SimpleServer::close_complete);
+		close_action_ = server_->close(cb);
+	}
+};
+
+#endif /* !IO_SOCKET_SIMPLE_SERVER_H */


add back the close opcode check

add back the close opcode check

--- src/protocols/websocket.c
+++ src/protocols/websocket.c
@@ -142,6 +142,10 @@
                 socket_setError(socket, "WEBSOCKET: error receiving close response -- %s", STRERROR);
                 return FALSE;
         }
+        if ((*buf & 0xF) != 0x8) {
+                socket_setError(socket, "WEBSOCKET: close response error -- opcode 0x%x", *buf & 0xF);
+                return FALSE;
+        }

         return TRUE;
 }


VFS-2017 Clear proxyio read cache on flush.

--- src/proxyio/bufferAgent.h
+++ src/proxyio/bufferAgent.h
@@ -96,9 +96,13 @@

     void flush(const std::string &storageId, const std::string &fileId)
     {
-        typename decltype(m_writeBuffers)::accessor acc;
-        m_writeBuffers.find(acc, makeKey(storageId, fileId));
-        acc->second->flush();
+        typename decltype(m_writeBuffers)::accessor writeAcc;
+        m_writeBuffers.find(writeAcc, makeKey(storageId, fileId));
+        writeAcc->second->flush();
+
+        typename decltype(m_readCaches)::accessor readAcc;
+        m_readCaches.find(readAcc, makeKey(storageId, fileId));
+        readAcc->second->clear();
     }

     void fsync(const std::string &storageId, const std::string &fileId)


Implement the block scalar scanner.

Implement the block scalar scanner.

--- src/scanner.c
+++ src/scanner.c
@@ -629,7 +629,7 @@
          && CHECK_AT(parser,'\xA8',(offset)+2))     /* LS (#x2028) */   \
      || (CHECK_AT(parser,'\xE2',(offset))                               \
          && CHECK_AT(parser,'\x80',(offset)+1)                          \
-         && CHECK_AT(parser,'\xA9',(offset)+2)))    /* LS (#x2029) */
+         && CHECK_AT(parser,'\xA9',(offset)+2)))    /* PS (#x2029) */

 #define IS_BREAK(parser)    IS_BREAK_AT(parser,0)

@@ -691,11 +691,13 @@
      (IS_CRLF(parser) ?                             \
       (parser->index += 2,                          \
        parser->column = 0,                          \
+       parser->line ++,                             \
        parser->unread -= 2,                         \
        parser->pointer += 2) :                      \
       IS_BREAK(parser) ?                            \
       (parser->index ++,                            \
        parser->column = 0,                          \
+       parser->line ++,                             \
        parser->unread --,                           \
        parser->pointer += WIDTH(parser)) : 0)

@@ -704,8 +706,8 @@
  */

 #define RESIZE(parser,string)   \
-    (string.pointer-string.buffer+5 < string.size ? 1 :  \
-     yaml_parser_resize_string(parser, &string))
+    ((string).pointer-(string).buffer+5 < (string).size ? 1 :   \
+     yaml_parser_resize_string(parser, &(string)))

 /*
  * Copy a character to a string buffer and advance pointers.
@@ -713,23 +715,68 @@

 #define COPY(parser,string)     \
      (((*parser->pointer & 0x80) == 0x00 ?                  \
-       (*(string.pointer++) = *(parser->pointer++)) :       \
+       (*((string).pointer++) = *(parser->pointer++)) :     \
        (*parser->pointer & 0xE0) == 0xC0 ?                  \
-       (*(string.pointer++) = *(parser->pointer++),         \
-        *(string.pointer++) = *(parser->pointer++)) :       \
+       (*((string).pointer++) = *(parser->pointer++),       \
+        *((string).pointer++) = *(parser->pointer++)) :     \
        (*parser->pointer & 0xF0) == 0xE0 ?                  \
-       (*(string.pointer++) = *(parser->pointer++),         \
-        *(string.pointer++) = *(parser->pointer++),         \
-        *(string.pointer++) = *(parser->pointer++)) :       \
+       (*((string).pointer++) = *(parser->pointer++),       \
+        *((string).pointer++) = *(parser->pointer++),       \
+        *((string).pointer++) = *(parser->pointer++)) :     \
        (*parser->pointer & 0xF8) == 0xF0 ?                  \
-       (*(string.pointer++) = *(parser->pointer++),         \
-        *(string.pointer++) = *(parser->pointer++),         \
-        *(string.pointer++) = *(parser->pointer++),         \
-        *(string.pointer++) = *(parser->pointer++)) : 0),   \
+       (*((string).pointer++) = *(parser->pointer++),       \
+        *((string).pointer++) = *(parser->pointer++),       \
+        *((string).pointer++) = *(parser->pointer++),       \
+        *((string).pointer++) = *(parser->pointer++)) : 0), \
       parser->index ++,                                     \
       parser->column ++,                                    \
       parser->unread --)
-
+
+/*
+ * Copy a line break character to a string buffer and advance pointers.
+ */
+
+#define COPY_LINE(parser,string)    \
+    ((CHECK_AT(parser,'\r',0) && CHECK_AT(parser,'\n',1)) ? /* CR LF -> LF */   \
+     (*((string).pointer++) = (yaml_char_t) '\n',                               \
+      parser->pointer += 2,                                                     \
+      parser->index += 2,                                                       \
+      parser->column = 0,                                                       \
+      parser->line ++,                                                          \
+      parser->unread -= 2) :                                                    \
+     (CHECK_AT(parser,'\r',0) || CHECK_AT(parser,'\n',0)) ? /* CR|LF -> LF */   \
+     (*((string).pointer++) = (yaml_char_t) '\n',                               \
+      parser->pointer ++,                                                       \
+      parser->index ++,                                                         \
+      parser->column = 0,                                                       \
+      parser->line ++,                                                          \
+      parser->unread --) :                                                      \
+     (CHECK_AT(parser,'\xC2',0) && CHECK_AT(parser,'\x85',1)) ? /* NEL -> LF */ \
+     (*((string).pointer++) = (yaml_char_t) '\n',                               \
+      parser->pointer += 2,                                                     \
+      parser->index ++,                                                         \
+      parser->column = 0,                                                       \
+      parser->line ++,                                                          \
+      parser->unread --) :                                                      \
+     (CHECK_AT(parser,'\xE2',0) &&                                              \
+      CHECK_AT(parser,'\x80',1) &&                                              \
+      (CHECK_AT(parser,'\xA8',2) ||                                             \
+       CHECK_AT(parser,'\xA9',2))) ?                    /* LS|PS -> LS|PS */    \
+     (*((string).pointer++) = *(parser->pointer++),                             \
+      *((string).pointer++) = *(parser->pointer++),                             \
+      *((string).pointer++) = *(parser->pointer++),                             \
+      parser->index ++,                                                         \
+      parser->column = 0,                                                       \
+      parser->line ++,                                                          \
+      parser->unread --) : 0)
+
+/*
+ * Append a string to another string and clear the former string.
+ */
+
+#define JOIN(parser,head_string,tail_string)    \
+    (yaml_parser_join_string(parser, &(head_string), &(tail_string)) && \
+     yaml_parser_clear_string(parser, &(tail_string)))

 /*
  * Public API declarations.
@@ -769,6 +816,13 @@
 yaml_parser_resize_string(yaml_parser_t *parser, yaml_string_t *string);

 static int
+yaml_parser_join_string(yaml_parser_t *parser,
+        yaml_string_t *string1, yaml_string_t *string2);
+
+static int
+yaml_parser_clear_string(yaml_parser_t *parser, yaml_string_t *string);
+
+static int
 yaml_parser_resize_list(yaml_parser_t *parser, void **buffer, size_t *size,
         size_t item_size);

@@ -922,6 +976,11 @@

 static yaml_token_t *
 yaml_parser_scan_block_scalar(yaml_parser_t *parser, int literal);
+
+static int
+yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser,
+        int *indent, yaml_string_t *breaks,
+        yaml_mark_t start_mark, yaml_mark_t *end_mark);

 static int
 yaml_parser_scan_block_scalar_indicators(yaml_parser_t *parser,
@@ -1028,6 +1087,42 @@
     string->pointer = new_buffer + (string->buffer-string->pointer);
     string->buffer = new_buffer;
     string->size *= 2;
+
+    return 1;
+}
+
+/*
+ * Append a string to another string.
+ */
+
+static int
+yaml_parser_join_string(yaml_parser_t *parser,
+        yaml_string_t *string1, yaml_string_t *string2)
+{
+    if (string2->buffer == string2->pointer) return 1;
+
+    while (string1->pointer - string1->buffer + string2->pointer - string2->buffer + 1
+            > string1->size) {
+        if (!yaml_parser_resize_string(parser, string1)) return 0;
+    }
+
+    memcpy(string1->pointer, string2->buffer, string2->pointer-string2->buffer);
+
+    return 1;
+}
+
+/*
+ * Fill the string with NULs and move the pointer to the beginning.
+ */
+
+static int
+yaml_parser_clear_string(yaml_parser_t *parser, yaml_string_t *string)
+{
+    if (string->buffer == string->pointer) return 1;
+
+    memset(string->buffer, 0, string->pointer-string->buffer);
+
+    string->pointer = string->buffer;

     return 1;
 }
@@ -2460,7 +2555,10 @@

         token = yaml_version_directive_token_new(major, minor,
                 start_mark, end_mark);
-        if (!token) goto error;
+        if (!token) {
+            parser->error = YAML_MEMORY_ERROR;
+            return 0;
+        }
     }

     /* Is it a TAG directive? */
@@ -2479,14 +2577,17 @@

         token = yaml_tag_directive_token_new(handle, prefix,
                 start_mark, end_mark);
-        if (!token) goto error;
+        if (!token) {
+            parser->error = YAML_MEMORY_ERROR;
+            return 0;
+        }
     }

     /* Unknown directive. */

     else
     {
-        yaml_parser_set_scanner_error(parser, "While scanning a directive",
+        yaml_parser_set_scanner_error(parser, "while scanning a directive",
                 start_mark, "found uknown directive name");
         goto error;
     }
@@ -2508,7 +2609,7 @@
     /* Check if we are at the end of the line. */

     if (!IS_BREAKZ(parser)) {
-        yaml_parser_set_scanner_error(parser, "While scanning a directive",
+        yaml_parser_set_scanner_error(parser, "while scanning a directive",
                 start_mark, "did not found expected comment or line break");
         goto error;
     }
@@ -2801,7 +2902,10 @@
     token = type == YAML_ANCHOR_TOKEN ?
         yaml_anchor_token_new(string.buffer, start_mark, end_mark) :
         yaml_alias_token_new(string.buffer, start_mark, end_mark);
-    if (!token) goto error;
+    if (!token) {
+        parser->error = YAML_MEMORY_ERROR;
+        return 0;
+    }

     return token;

@@ -2907,7 +3011,10 @@
     /* Create a token. */

     token = yaml_tag_token_new(handle, suffix, start_mark, end_mark);
-    if (!token) goto error;
+    if (!token) {
+        parser->error = YAML_MEMORY_ERROR;
+        return 0;
+    }

     return token;

@@ -3132,3 +3239,288 @@
     return 1;
 }

+/*
+ * Scan a block scalar.
+ */
+
+static yaml_token_t *
+yaml_parser_scan_block_scalar(yaml_parser_t *parser, int literal)
+{
+    yaml_mark_t start_mark;
+    yaml_mark_t end_mark;
+    yaml_string_t string = yaml_parser_new_string(parser);
+    yaml_string_t line_break = yaml_parser_new_string(parser);
+    yaml_string_t breaks = yaml_parser_new_string(parser);
+    yaml_token_t *token = NULL;
+    int chomping = 0;
+    int increment = 0;
+    int indent = 0;
+    int leading_blank = 0;
+    int trailing_blank = 0;
+
+    if (!string.buffer) goto error;
+    if (!line_break.buffer) goto error;
+    if (!breaks.buffer) goto error;
+
+    /* Eat the indicator '|' or '>'. */
+
+    start_mark = yaml_parser_get_mark(parser);
+
+    FORWARD(parser);
+
+    /* Scan the additional block scalar indicators. */
+
+    if (!UPDATE(parser, 1)) goto error;
+
+    /* Check for a chomping indicator. */
+
+    if (CHECK(parser, '+') || CHECK(parser, '-'))
+    {
+        /* Set the chomping method and eat the indicator. */
+
+        chomping = CHECK(parser, '+') ? +1 : -1;
+
+        FORWARD(parser);
+
+        /* Check for an indentation indicator. */
+
+        if (!UPDATE(parser, 1)) goto error;
+
+        if (IS_DIGIT(parser))
+        {
+            /* Check that the intendation is greater than 0. */
+
+            if (CHECK(parser, '0')) {
+                yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
+                        start_mark, "found an intendation indicator equal to 0");
+                goto error;
+            }
+
+            /* Get the intendation level and eat the indicator. */
+
+            increment = AS_DIGIT(parser);
+
+            FORWARD(parser);
+        }
+    }
+
+    /* Do the same as above, but in the opposite order. */
+
+    else if (IS_DIGIT(parser))
+    {
+        if (CHECK(parser, '0')) {
+            yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
+                    start_mark, "found an intendation indicator equal to 0");
+            goto error;
+        }
+
+        increment = AS_DIGIT(parser);
+
+        FORWARD(parser);
+
+        if (!UPDATE(parser, 1)) goto error;
+
+        if (CHECK(parser, '+') || CHECK(parser, '-')) {
+            chomping = CHECK(parser, '+') ? +1 : -1;
+            FORWARD(parser);
+        }
+    }
+
+    /* Eat whitespaces and comments to the end of the line. */
+
+    if (!UPDATE(parser, 1)) goto error;
+
+    while (IS_BLANK(parser)) {
+        FORWARD(parser);
+        if (!UPDATE(parser, 1)) goto error;
+    }
+
+    if (CHECK(parser, '#')) {
+        while (!IS_BREAKZ(parser)) {
+            FORWARD(parser);
+            if (!UPDATE(parser, 1)) goto error;
+        }
+    }
+
+    /* Check if we are at the end of the line. */
+
+    if (!IS_BREAKZ(parser)) {
+        yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
+                start_mark, "did not found expected comment or line break");
+        goto error;
+    }
+
+    /* Eat a line break. */
+
+    if (IS_BREAK(parser)) {
+        if (!UPDATE(parser, 2)) goto error;
+        FORWARD_LINE(parser);
+    }
+
+    end_mark = yaml_parser_get_mark(parser);
+
+    /* Set the intendation level if it was specified. */
+
+    if (increment) {
+        indent = parser->indent >= 0 ? parser->indent+increment : increment;
+    }
+
+    /* Scan the leading line breaks and determine the indentation level if needed. */
+
+    if (!yaml_parser_scan_block_scalar_breaks(parser, &indent, &breaks,
+                start_mark, &end_mark)) goto error;
+
+    /* Scan the block scalar content. */
+
+    if (!UPDATE(parser, 1)) goto error;
+
+    while (parser->column == indent && !IS_Z(parser))
+    {
+        /*
+         * We are at the beginning of a non-empty line.
+         */
+
+        /* Is it a trailing whitespace? */
+
+        trailing_blank = IS_BLANK(parser);
+
+        /* Check if we need to fold the leading line break. */
+
+        if (!literal && (*line_break.buffer == '\n')
+                && !leading_blank && !trailing_blank)
+        {
+            /* Do we need to join the lines by space? */
+
+            if (*breaks.buffer == '\0') {
+                if (!RESIZE(parser, string)) goto error;
+                *(string.pointer ++) = ' ';
+            }
+
+            yaml_parser_clear_string(parser, &line_break);
+        }
+        else {
+            if (!JOIN(parser, string, line_break)) goto error;
+        }
+
+        /* Append the remaining line breaks. */
+
+        if (!JOIN(parser, string, breaks)) goto error;
+
+        /* Is it a leading whitespace? */
+
+        leading_blank = IS_BLANK(parser);
+
+        /* Consume the current line. */
+
+        while (!IS_BREAKZ(parser)) {
+            if (!RESIZE(parser, string)) goto error;
+            COPY(parser, string);
+            if (!UPDATE(parser, 1)) goto error;
+        }
+
+        /* Consume the line break. */
+
+        if (!UPDATE(parser, 2)) goto error;
+
+        COPY_LINE(parser, line_break);
+
+        /* Eat the following intendation spaces and line breaks. */
+
+        if (!yaml_parser_scan_block_scalar_breaks(parser,
+                    &indent, &breaks, start_mark, &end_mark)) goto error;
+    }
+
+    /* Chomp the tail. */
+
+    if (chomping != -1) {
+        if (!JOIN(parser, string, line_break)) goto error;
+    }
+    if (chomping == 1) {
+        if (!JOIN(parser, string, breaks)) goto error;
+    }
+
+    /* Create a token. */
+
+    token = yaml_scalar_token_new(string.buffer, string.pointer-string.buffer,
+            literal ? YAML_LITERAL_SCALAR_STYLE : YAML_FOLDED_SCALAR_STYLE,
+            start_mark, end_mark);
+    if (!token) {
+        parser->error = YAML_MEMORY_ERROR;
+        return 0;
+    }
+
+    yaml_free(line_break.buffer);
+    yaml_free(breaks.buffer);
+
+    return token;
+
+error:
+    yaml_free(string.buffer);
+    yaml_free(line_break.buffer);
+    yaml_free(breaks.buffer);
+
+    return NULL;
+}
+
+/*
+ * Scan intendation spaces and line breaks for a block scalar.  Determine the
+ * intendation level if needed.
+ */
+
+static int
+yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser,
+        int *indent, yaml_string_t *breaks,
+        yaml_mark_t start_mark, yaml_mark_t *end_mark)
+{
+    int max_indent = 0;
+
+    *end_mark = yaml_parser_get_mark(parser);
+
+    /* Eat the intendation spaces and line breaks. */
+
+    while (1)
+    {
+        /* Eat the intendation spaces. */
+
+        if (!UPDATE(parser, 1)) return 0;
+
+        while ((!*indent || parser->column < *indent) && IS_SPACE(parser)) {
+            FORWARD(parser);
+            if (!UPDATE(parser, 1)) return 0;
+        }
+
+        if (parser->column > max_indent)
+            max_indent = parser->column;
+
+        /* Check for a tab character messing the intendation. */
+
+        if ((!*indent || parser->column < *indent) && IS_TAB(parser)) {
+            return yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
+                    start_mark, "found a tab character where an intendation space is expected");
+        }
+
+        /* Have we found a non-empty line? */
+
+        if (!IS_BREAK(parser)) break;
+
+        /* Consume the line break. */
+
+        if (!UPDATE(parser, 2)) return 0;
+        if (!RESIZE(parser, *breaks)) return 0;
+        COPY_LINE(parser, *breaks);
+        *end_mark = yaml_parser_get_mark(parser);
+    }
+
+    /* Determine the indentation level if needed. */
+
+    if (!*indent) {
+        *indent = max_indent;
+        if (*indent < parser->indent + 1)
+            *indent = parser->indent + 1;
+        if (*indent < 1)
+            *indent = 1;
+    }
+
+   return 1;
+}
+


Fix missing token in example (#169)

Fix missing token in example (#169)

--- src/scanner.c
+++ src/scanner.c
@@ -348,6 +348,7 @@
  *          SCALAR("another value",plain)
  *          KEY
  *          SCALAR("a mapping",plain)
+ *          VALUE
  *          BLOCK-MAPPING-START
  *          KEY
  *          SCALAR("key 1",plain)


scanner: Make sure arguments have names.

--- src/scanner.c
+++ src/scanner.c
@@ -350,6 +350,9 @@

 		ctx->message = message;
 	} else if (strcmp(element_name, "arg") == 0) {
+		if (name == NULL)
+			fail(ctx, "no argument name given");
+
 		arg = malloc(sizeof *arg);
 		arg->name = strdup(name);


Fix typo error

Fix typo error

nessesary to necessary

--- src/scanner.c
+++ src/scanner.c
@@ -1636,7 +1636,7 @@

     if (!parser->flow_level)
     {
-        /* Check if we are allowed to start a new key (not nessesary simple). */
+        /* Check if we are allowed to start a new key (not necessary simple). */

         if (!parser->simple_key_allowed) {
             return yaml_parser_set_scanner_error(parser, NULL, parser->mark,


Fix official build breakage.

Fix official build breakage.

BUG=None
TEST=Tested compile with official mode flags
TBR=hbono

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

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@61150 0039d316-1c4b-4281-b951-d872f2087c98

--- base/logging.h
+++ base/logging.h
@@ -691,8 +691,6 @@

 #endif  // ENABLE_DCHECK
 #undef ENABLE_DCHECK
-
-#undef DCHECK_EAT_STREAM_PARAMETERS

 // Helper functions for CHECK_OP macro.
 // The (int, int) specialization works around the issue that the compiler


[Diagnostic] Always resolve types required for raw representative construction

Since both raw representable and value types originated in
constraint system they can have type variables which need to be
resolved before types could be used in a diagnostic and fix-it.

--- lib/Sema/CSDiagnostics.h
+++ lib/Sema/CSDiagnostics.h
@@ -2123,8 +2123,9 @@
   MissingRawRepresentativeInitFailure(const Solution &solution,
                                       Type rawReprType, Type valueType,
                                       ConstraintLocator *locator)
-      : FailureDiagnostic(solution, locator), RawReprType(rawReprType),
-        ValueType(valueType) {}
+      : FailureDiagnostic(solution, locator),
+        RawReprType(resolveType(rawReprType)),
+        ValueType(resolveType(valueType)) {}

   bool diagnoseAsError() override;
 };


do not forget to free memory

do not forget to free memory

--- ipv6-udp-only/demo/main.c
+++ ipv6-udp-only/demo/main.c
@@ -37,6 +37,9 @@
 	memcpy(p_s->payload, data, p->len);

 	udp_sendto(pcb, p_s, (ip_addr_t*)addr, port);
+
+	pbuf_free(p);
+	pbuf_free(p_s);
 }

 int main(void) {


a little progress with xinput extension

a little progress with xinput extension

--- xinput/test.c
+++ xinput/test.c
@@ -73,14 +73,13 @@
   gtk_widget_show (GTK_WIDGET(canvas));

   gtk_widget_show (button);
-  gtk_widget_show (window);

   printf("%d \n", GTK_WIDGET(button)->window) ;
   printf("%d \n", GTK_WIDGET(window)->window) ;

-  gdk_input_set_extension_events(GTK_WIDGET(window)->window,
+  gdk_input_set_extension_events(GTK_WIDGET(canvas)->window,
   GDK_POINTER_MOTION_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK,
   GDK_EXTENSION_EVENTS_ALL);

@@ -93,7 +92,10 @@
 		    NULL );
   g_signal_connect_swapped(G_OBJECT(window), "destroy",
 			   G_CALLBACK(gtk_main_quit), NULL );
+  gtk_widget_show (window);
+
   gtk_main () ;
+

   return 0 ;