Fix function declaration to match definition for link error. (#3704)

--- iree/compiler/Conversion/LinalgToLLVM/Passes.h
+++ iree/compiler/Conversion/LinalgToLLVM/Passes.h
@@ -36,7 +36,7 @@
 /// linalg::MatmulOp.
 std::unique_ptr<FunctionPass> createConvImg2ColMatmulConversionPass();

-std::unique_ptr<FunctionPass> createLinalgTileAndDistributePass();
+std::unique_ptr<OperationPass<ModuleOp>> createLinalgTileAndDistributePass();

 /// Populates patterns to rewrite linalg::ConvOp into packed img2col operation
 /// followed by linalg::MatmulOp.


Fix segmentation fault in mysqlcheck when the last table checked with --auto-repair mode returned an error (such as being a merge table). (Bug #9492)

--- client/mysqlcheck.c
+++ client/mysqlcheck.c
@@ -537,6 +537,7 @@
   my_bool found_error=0;

   res = mysql_use_result(sock);
+
   prev[0] = '\0';
   for (i = 0; (row = mysql_fetch_row(res)); i++)
   {
@@ -565,7 +566,7 @@
     putchar('\n');
   }
   if (found_error && opt_auto_repair && what_to_do != DO_REPAIR &&
-      (!opt_fast || strcmp(row[3],"OK")))
+      !opt_fast)
     insert_dynamic(&tables4repair, prev);
   mysql_free_result(res);
 }


access: dvb: scan: map service type to original values

--- modules/access/dvb/scan.c
+++ modules/access/dvb/scan.c
@@ -63,11 +63,11 @@

 typedef enum
 {
-    SERVICE_UNKNOWN = 0,
-    SERVICE_DIGITAL_RADIO,
-    SERVICE_DIGITAL_TELEVISION,
-    SERVICE_DIGITAL_TELEVISION_AC_SD,
-    SERVICE_DIGITAL_TELEVISION_AC_HD,
+    SERVICE_TYPE_RESERVED                        = 0x00,
+    SERVICE_TYPE_DIGITAL_TELEVISION              = 0x01,
+    SERVICE_TYPE_DIGITAL_RADIO                   = 0x02,
+    SERVICE_TYPE_DIGITAL_TELEVISION_AC_SD        = 0x16,
+    SERVICE_TYPE_DIGITAL_TELEVISION_AC_HD        = 0x19,
 } scan_service_type_t;

 typedef struct scan_multiplex_t scan_multiplex_t;
@@ -171,7 +171,7 @@
     p_srv->i_program = i_program;
     p_srv->i_original_network_id = NETWORK_ID_RESERVED;

-    p_srv->type = SERVICE_UNKNOWN;
+    p_srv->type = SERVICE_TYPE_RESERVED;
     p_srv->psz_name = NULL;
     p_srv->psz_original_network_name = NULL;
     p_srv->i_channel = -1;
@@ -198,16 +198,19 @@
     return output;
 }

-static int scan_service_type( int service_type )
+static int scan_service_type_Supported( scan_service_type_t service_type )
 {
     switch( service_type )
     {
-    case 0x01: return SERVICE_DIGITAL_TELEVISION;
-    case 0x02: return SERVICE_DIGITAL_RADIO;
-    case 0x16: return SERVICE_DIGITAL_TELEVISION_AC_SD;
-    case 0x19: return SERVICE_DIGITAL_TELEVISION_AC_HD;
-    default:   return SERVICE_UNKNOWN;
-    }
+        case SERVICE_TYPE_DIGITAL_TELEVISION:
+        case SERVICE_TYPE_DIGITAL_RADIO:
+        case SERVICE_TYPE_DIGITAL_TELEVISION_AC_SD:
+        case SERVICE_TYPE_DIGITAL_TELEVISION_AC_HD:
+            return true;
+        default:
+            break;
+    }
+    return false;
 }

 static scan_multiplex_t *scan_multiplex_New( const scan_tuner_config_t *p_cfg, uint16_t i_ts_id )
@@ -949,8 +952,7 @@
                     s->psz_name = vlc_from_EIT( pD->i_service_name,
                                                 pD->i_service_name_length );

-                if( s->type == SERVICE_UNKNOWN )
-                    s->type = scan_service_type( pD->i_service_type );
+                s->type = pD->i_service_type;
             }
         }
     }
@@ -1174,7 +1176,7 @@
                     continue;
                 }

-                if( scan_service_type( i_service_type ) == SERVICE_UNKNOWN )
+                if( !scan_service_type_Supported( i_service_type ) )
                     continue;

                 scan_service_t *s = scan_multiplex_FindService( p_mplex, i_service_id );
@@ -1183,7 +1185,7 @@
                     s = scan_service_New( i_service_id );
                     if( likely(s) )
                     {
-                        s->type          = scan_service_type( i_service_type );
+                        s->type = i_service_type;
                         s->i_original_network_id = p_ts->i_orig_network_id;
                         if( !scan_multiplex_AddService( p_mplex, s ) )
                         {
@@ -1458,7 +1460,7 @@
         for( size_t i = 0; i < p_mplex->i_services; i++ )
         {
             const scan_service_t *s = p_mplex->pp_services[i];
-            if( s->type == SERVICE_UNKNOWN )
+            if( !scan_service_type_Supported( s->type ) )
             {
                 /* We should only select service that have been described by SDT */
                 msg_Dbg( p_obj, "scan_GetM3U: ignoring service number %d", s->i_program );
@@ -1478,10 +1480,10 @@
         const char *psz_type;
         switch( s->type )
         {
-            case SERVICE_DIGITAL_TELEVISION:       psz_type = "Digital television"; break;
-            case SERVICE_DIGITAL_TELEVISION_AC_SD: psz_type = "Digital television advanced codec SD"; break;
-            case SERVICE_DIGITAL_TELEVISION_AC_HD: psz_type = "Digital television advanced codec HD"; break;
-            case SERVICE_DIGITAL_RADIO:            psz_type = "Digital radio"; break;
+            case SERVICE_TYPE_DIGITAL_TELEVISION:       psz_type = "Digital television"; break;
+            case SERVICE_TYPE_DIGITAL_TELEVISION_AC_SD: psz_type = "Digital television advanced codec SD"; break;
+            case SERVICE_TYPE_DIGITAL_TELEVISION_AC_HD: psz_type = "Digital television advanced codec HD"; break;
+            case SERVICE_TYPE_DIGITAL_RADIO:            psz_type = "Digital radio"; break;
             default:
                 psz_type = "Unknown";
                 break;


Monitor: Request device info (send '/who' message) if autosubscribe is enabled after monitor created.

--- src/monitor.c
+++ src/monitor.c
@@ -215,8 +215,10 @@
 static void mmon_autosubscribe(mapper_monitor mon, int autosubscribe_flags)
 {
     // TODO: remove autorenewing subscription record if necessary
-    if (!mon->autosubscribe && autosubscribe_flags)
+    if (!mon->autosubscribe && autosubscribe_flags) {
         mapper_db_add_device_callback(&mon->db, on_device_autosubscribe, mon);
+        mmon_request_devices(mon);
+    }
     else if (mon->autosubscribe && !autosubscribe_flags) {
         mapper_db_remove_device_callback(&mon->db, on_device_autosubscribe, mon);
         while (mon->subscriptions) {


Handle correctly some more error cases

Handle correctly some more error cases

--- modules/access/gnomevfs.c
+++ modules/access/gnomevfs.c
@@ -93,7 +93,6 @@
     GnomeVFSURI    *p_uri = NULL;
     GnomeVFSResult  i_ret;
     GnomeVFSHandle *p_handle = NULL;
-
     if( !(gnome_vfs_init()) )
     {
         msg_Warn( p_access, "couldn't initilize GnomeVFS" );
@@ -159,18 +158,25 @@
         char *psz_path_begin;

         vlc_UrlParse( &url, psz_unescaped, 0 );
-
         psz_escaped_path = gnome_vfs_escape_path_string( url.psz_path );

+        if( psz_escaped_path && strcmp( psz_escaped_path,"/" )
+                                        && strcmp( psz_escaped_path,"//" ) )
+        {
     /* Now let's reconstruct a valid URI from all that stuff */
-        psz_path_begin = strstr( psz_unescaped, url.psz_path );
-        *psz_path_begin = '\0';
-        psz_uri = malloc( strlen( psz_unescaped ) +
+            psz_path_begin = strstr( psz_unescaped, url.psz_path );
+            if( psz_path_begin ) *psz_path_begin = '\0';
+            psz_uri = malloc( strlen( psz_unescaped ) +
                                         strlen( psz_escaped_path ) + 1 );
-        sprintf( psz_uri, "%s%s",psz_unescaped, psz_escaped_path );
-
-        g_free( psz_escaped_path );
-        g_free( psz_unescaped );
+            sprintf( psz_uri, "%s%s",psz_unescaped, psz_escaped_path );
+
+            g_free( psz_escaped_path );
+            g_free( psz_unescaped );
+        }
+        else
+        {
+            psz_uri = psz_unescaped;
+        }
     }
     else
     {


only raise read/write again when nessecarry

--- src/mrb_tls.c
+++ src/mrb_tls.c
@@ -391,11 +391,8 @@
           mrb_module_get(mrb, "Tls"), "Client"), cctx, &tls_type));
   }
   else
-  if (rc == TLS_READ_AGAIN)
-    mrb_raise(mrb, E_TLS_READ_AGAIN, tls_error((tls_t *) DATA_PTR(self)));
-  else
-  if (rc == TLS_WRITE_AGAIN)
-    mrb_raise(mrb, E_TLS_WRITE_AGAIN, tls_error((tls_t *) DATA_PTR(self)));
+  if (rc == TLS_READ_AGAIN||rc == TLS_WRITE_AGAIN)
+    mrb_raise(mrb, E_TLS_ERROR, tls_error((tls_t *) DATA_PTR(self)));
   else
     mrb_sys_fail(mrb, tls_error((tls_t *) DATA_PTR(self)));

@@ -414,11 +411,8 @@
   if (rc == 0)
     return self;
   else
-  if (rc == TLS_READ_AGAIN)
-    mrb_raise(mrb, E_TLS_READ_AGAIN, tls_error((tls_t *) DATA_PTR(self)));
-  else
-  if (rc == TLS_WRITE_AGAIN)
-    mrb_raise(mrb, E_TLS_WRITE_AGAIN, tls_error((tls_t *) DATA_PTR(self)));
+  if (rc == TLS_READ_AGAIN||rc == TLS_WRITE_AGAIN)
+    mrb_raise(mrb, E_TLS_ERROR, tls_error((tls_t *) DATA_PTR(self)));
   else
     mrb_sys_fail(mrb, tls_error((tls_t *) DATA_PTR(self)));

@@ -444,11 +438,8 @@
   if (rc == 0)
     return self;
   else
-  if (rc == TLS_READ_AGAIN)
-    mrb_raise(mrb, E_TLS_READ_AGAIN, tls_error((tls_t *) DATA_PTR(self)));
-  else
-  if (rc == TLS_WRITE_AGAIN)
-    mrb_raise(mrb, E_TLS_WRITE_AGAIN, tls_error((tls_t *) DATA_PTR(self)));
+  if (rc == TLS_READ_AGAIN||rc == TLS_WRITE_AGAIN)
+    mrb_raise(mrb, E_TLS_ERROR, tls_error((tls_t *) DATA_PTR(self)));
   else
     mrb_sys_fail(mrb, tls_error((tls_t *) DATA_PTR(self)));

@@ -471,11 +462,8 @@
   if (rc == 0)
     return self;
   else
-  if (rc == TLS_READ_AGAIN)
-    mrb_raise(mrb, E_TLS_READ_AGAIN, tls_error((tls_t *) DATA_PTR(self)));
-  else
-  if (rc == TLS_WRITE_AGAIN)
-    mrb_raise(mrb, E_TLS_WRITE_AGAIN, tls_error((tls_t *) DATA_PTR(self)));
+  if (rc == TLS_READ_AGAIN||rc == TLS_WRITE_AGAIN)
+    mrb_raise(mrb, E_TLS_ERROR, tls_error((tls_t *) DATA_PTR(self)));
   else
     mrb_sys_fail(mrb, tls_error((tls_t *) DATA_PTR(self)));

@@ -540,11 +528,8 @@
   if (rc == 0)
     return self;
   else
-  if (rc == TLS_READ_AGAIN)
-    mrb_raise(mrb, E_TLS_READ_AGAIN, tls_error((tls_t *) DATA_PTR(self)));
-  else
-  if (rc == TLS_WRITE_AGAIN)
-    mrb_raise(mrb, E_TLS_WRITE_AGAIN, tls_error((tls_t *) DATA_PTR(self)));
+  if (rc == TLS_READ_AGAIN||rc == TLS_WRITE_AGAIN)
+    mrb_raise(mrb, E_TLS_ERROR, tls_error((tls_t *) DATA_PTR(self)));
   else
     mrb_sys_fail(mrb, tls_error((tls_t *) DATA_PTR(self)));


MMS: improve documentation and debug messages

--- modules/access/mms/mmsh.c
+++ modules/access/mms/mmsh.c
@@ -941,7 +941,7 @@
     p_ck->p_data      = p_sys->buffer + 12;
     p_ck->i_data      = p_ck->i_size2 - 8;

-    if( p_ck->i_type == 0x4524 )   // Transfer complete
+    if( p_ck->i_type == 0x4524 )   // $E (End-of-Stream Notification) Packet
     {
         if( p_ck->i_sequence == 0 )
         {
@@ -954,7 +954,7 @@
             return VLC_EGENERIC;
         }
     }
-    else if( p_ck->i_type == 0x4324 )
+    else if( p_ck->i_type == 0x4324 ) // $C (Stream Change Notification) Packet
     {
         /* 0x4324 is CHUNK_TYPE_RESET: a new stream will follow with a sequence of 0 */
         msg_Warn( p_access, "next stream following (reset) seq=%d", p_ck->i_sequence  );
@@ -962,7 +962,12 @@
     }
     else if( (p_ck->i_type != 0x4824) && (p_ck->i_type != 0x4424) )
     {
-        msg_Err( p_access, "invalid chunk FATAL (0x%x)", p_ck->i_type );
+        /* Unsupported so far:
+         * $M (Metadata) Packet               0x4D24
+         * $P (Packet-Pair) Packet            0x5024
+         * $T (Test Data Notification) Packet 0x5424
+         */
+        msg_Err( p_access, "unrecognized chunk FATAL (0x%x)", p_ck->i_type );
         return VLC_EGENERIC;
     }


Fix the module name matching to the drivers present in the kernel. Previously
it would return true on a partial match where it would think the edsc module
was already present by having a positive match on 'ed'.  This changes it so
that it compares the full string including the nul terminators.

This also fixes a buffer overflow in the ifkind variable where the length of
the interface name in *argv wasnt checked for size.

Reviewed by:	brooks
Approved by:	re (gnn)

--- sbin/ifconfig/ifconfig.c
+++ sbin/ifconfig/ifconfig.c
@@ -895,21 +895,28 @@
 void
 ifmaybeload(const char *name)
 {
+#define MOD_PREFIX_LEN		3	/* "if_" */
 	struct module_stat mstat;
 	int fileid, modid;
-	char ifkind[35], *dp;
+	char ifkind[IFNAMSIZ + MOD_PREFIX_LEN], ifname[IFNAMSIZ], *dp;
 	const char *cp;

 	/* loading suppressed by the user */
 	if (noload)
 		return;

+	/* trim the interface number off the end */
+	strlcpy(ifname, name, sizeof(ifname));
+	for (dp = ifname; *dp != 0; dp++)
+		if (isdigit(*dp)) {
+			*dp = 0;
+			break;
+		}
+
 	/* turn interface and unit into module name */
 	strcpy(ifkind, "if_");
-	for (cp = name, dp = ifkind + 3;
-	    (*cp != 0) && !isdigit(*cp); cp++, dp++)
-		*dp = *cp;
-	*dp = 0;
+	strlcpy(ifkind + MOD_PREFIX_LEN, ifname,
+	    sizeof(ifkind) - MOD_PREFIX_LEN);

 	/* scan files in kernel */
 	mstat.version = sizeof(struct module_stat);
@@ -926,8 +933,8 @@
 				cp = mstat.name;
 			}
 			/* already loaded? */
-			if (strncmp(name, cp, strlen(cp)) == 0 ||
-			    strncmp(ifkind, cp, strlen(cp)) == 0)
+			if (strncmp(ifname, cp, strlen(ifname) + 1) == 0 ||
+			    strncmp(ifkind, cp, strlen(ifkind) + 1) == 0)
 				return;
 		}
 	}


Update keys in map

Update keys in map

--- src/msgpack.h
+++ src/msgpack.h
@@ -545,9 +545,11 @@
 inline void MsgPack::_update_map(size_t pos) const {
 	const auto pend = &_body->_obj->via.map.ptr[_body->_obj->via.map.size];
 	for (auto p = &_body->_obj->via.map.ptr[pos]; p != pend; ++p, ++pos) {
-		auto& mobj = _body->at(std::string(p->key.via.str.ptr, p->key.via.str.size));
-		mobj._body->_pos = pos;
-		mobj._body->_obj = &p->val;
+		std::string str_key(p->key.via.str.ptr, p->key.via.str.size);
+		auto& elem = _body->find(str_key)->second;
+		elem.first._body->_obj = &p->key;
+		elem.second._body->_pos = pos;
+		elem.second._body->_obj = &p->val;
 	}
 }


Allow character devices too

Allow character devices too

--- sbin/savecore/savecore.c
+++ sbin/savecore/savecore.c
@@ -126,7 +126,7 @@
 void	 DumpRead __P((int fd, void *bp, int size, off_t off, int flag));
 void	 DumpWrite __P((int fd, void *bp, int size, off_t off, int flag));
 int	 dump_exists __P((void));
-char	*find_dev __P((dev_t, int));
+char    *find_dev __P((dev_t));
 int	 get_crashtime __P((void));
 void	 get_dumpsize __P((void));
 void	 kmem_setup __P((void));
@@ -268,7 +268,7 @@
 	Lseek(kmem, (off_t)current_nl[X_DUMPMAG].n_value, L_SET);
 	(void)Read(kmem, &dumpmag, sizeof(dumpmag));
 	dumplo *= DEV_BSIZE;
-	ddname = find_dev(dumpdev, S_IFBLK);
+	ddname = find_dev(dumpdev);
 	dumpfd = Open(ddname, O_RDWR);
 	fp = fdopen(kmem, "r");
 	if (fp == NULL) {
@@ -463,9 +463,8 @@
 }

 char *
-find_dev(dev, type)
+find_dev(dev)
 	register dev_t dev;
-	register int type;
 {
 	register DIR *dfd;
 	struct dirent *dir;
@@ -483,7 +482,8 @@
 			syslog(LOG_ERR, "%s: %s", devname, strerror(errno));
 			continue;
 		}
-		if ((sb.st_mode & S_IFMT) != type)
+		if ((sb.st_mode & S_IFMT) != S_IFCHR &&
+		    (sb.st_mode & S_IFMT) != S_IFBLK)
 			continue;
 		if (dev == sb.st_rdev) {
 			closedir(dfd);


hotkeys: change volume on playlist rather than interface

--- modules/control/hotkeys.c
+++ modules/control/hotkeys.c
@@ -181,7 +181,7 @@
         case ACTIONID_VOL_UP:
         {
             audio_volume_t i_newvol;
-            aout_VolumeUp( p_intf, 1, &i_newvol );
+            aout_VolumeUp( p_playlist, 1, &i_newvol );
             DisplayVolume( p_intf, p_vout, i_newvol );
             break;
         }
@@ -189,7 +189,7 @@
         case ACTIONID_VOL_DOWN:
         {
             audio_volume_t i_newvol;
-            aout_VolumeDown( p_intf, 1, &i_newvol );
+            aout_VolumeDown( p_playlist, 1, &i_newvol );
             DisplayVolume( p_intf, p_vout, i_newvol );
             break;
         }
@@ -197,7 +197,7 @@
         case ACTIONID_VOL_MUTE:
         {
             audio_volume_t i_newvol = -1;
-            aout_ToggleMute( p_intf, &i_newvol );
+            aout_ToggleMute( p_playlist, &i_newvol );
             if( p_vout )
             {
                 if( i_newvol == 0 )


Revision 1.61 changed the allocation of buffer 'buf' in DoFile() from
the stack to the heap to work around a problem on ia64. Now, roughly
16 months and two compiler updates later, it isn't an issue anymore
in the sense that putting a 1M buffer on the stack just works and we
don't actually need to work around anything anymore.
However, since there's no advantage or need to put the buffer on the
stack (again), this change merely removes the XXX comment describing
that there's an explicit reason for the heap allocation. Hence, this
change is a functional no-op.

PR: ia64/38677

--- sbin/savecore/savecore.c
+++ sbin/savecore/savecore.c
@@ -221,12 +221,6 @@
 	dmpcnt = 0;
 	mediasize = 0;

-	/*
-	 * XXX On ia64 something breaks when the buffer is put on the
-	 * stack. When the buffer is roughly larger than 128K the read()
-	 * below simply fails with errno=14 (EFAULT). We work around
-	 * this by doing a one-time allocation...
-	 */
 	if (buf == NULL) {
 		buf = malloc(BUFFERSIZE);
 		if (buf == NULL) {


Prefering inline functions to macros for bigendian functions

--- lib/gsnizk/bigendian.h
+++ lib/gsnizk/bigendian.h
@@ -24,10 +24,10 @@

 #include "bigendian_cfg.h"

-#if defined(_WIN16) || defined(_WIN32) || defined(_WIN64) || \
-  defined(__WINDOWS__)
+#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64) || \
+  defined(__WINDOWS__)) && !defined(DOXYGEN_COMPILATION)
 #include <Winsock2.h>
-#elif defined(__linux__)
+#elif defined(__linux__) && !defined(DOXYGEN_COMPILATION)
 #include <arpa/inet.h>
 #else
 #define BIGENDIAN_CPP_IMPLEMENTATION
@@ -79,26 +79,23 @@

 #endif /* End of BIGENDIAN_CFG */

-#define ntohl(n) htonl(n)
-#define ntohs(n) htons(n)
-
-#ifdef DOXYGEN_COMPILATION
+/**
+ * @brief Converts from network to host byte order.
+ * @param netlong The network 16-bit integer.
+ * @return The host 16-bit integer.
+ */
+inline uint16_t ntohs(uint16_t netshort) {
+    return htons(netshort);
+}

 /**
  * @brief Converts from network to host byte order.
  * @param netlong The network 32-bit integer.
  * @return The host 32-bit integer.
  */
-uint32_t ntohl(uint32_t netlong);
-
-/**
- * @brief Converts from network to host byte order.
- * @param netlong The network 16-bit integer.
- * @return The host 16-bit integer.
- */
-uint16_t ntohs(uint16_t netshort);
-
-#endif /* End of DOXYGEN_COMPILATION */
+inline uint32_t ntohl(uint32_t netlong) {
+    return htonl(netlong);
+}

 #endif /* End of BIGENDIAN_CPP_IMPLEMENTATION */

@@ -124,17 +121,13 @@

 #endif /* End of BIGENDIAN_CFG */

-#define ntohll(n) htonll(n)
-
-#ifdef DOXYGEN_COMPILATION
-
 /**
  * @brief Converts from network to host byte order.
  * @param netlong The network 64-bit integer.
  * @return The host 64-bit integer.
  */
-uint64_t ntohll(uint64_t netlong);
-
-#endif /* End of DOXYGEN_COMPILATION */
+inline uint64_t ntohll(uint64_t netlong) {
+    return htonll(netlong);
+}

 #endif /* End of BIGENDIAN_H */


Don't use ck_assert_int_eq, fools the CI server.

--- tests/tests.c
+++ tests/tests.c
@@ -229,8 +229,7 @@

     char device_id[20];
     ck_assert(!config.connected);
-    ck_assert_int_eq(at_commander_get_device_id(&config, device_id,
-                sizeof(device_id)), -1);
+    ck_assert(at_commander_get_device_id(&config, device_id, sizeof(device_id)) == -1);
     ck_assert(config.connected);
     ck_assert_str_ne(device_id, "00066646C2AF");
 }
@@ -273,7 +272,7 @@

     char name[20];
     ck_assert(!config.connected);
-    ck_assert_int_eq(at_commander_get_name(&config, name, sizeof(name)), -1);
+    ck_assert(at_commander_get_name(&config, name, sizeof(name)) == -1);
     ck_assert(config.connected);
     ck_assert_str_ne(name, "FOO");
 }


lib: updatehub: Fix variable-size string copy

A malformed JSON payload that is received from an UpdateHub server
may trigger memory corruption in the Zephyr OS. This could result
in a denial of service in the best case, or code execution in the
worst case.

Signed-off-by: Gerson Fernando Budke <de7eb9f159f7e30f8dcdecee89db6e1a285bf5b2@ossystems.com.br>

--- lib/updatehub/updatehub.c
+++ lib/updatehub/updatehub.c
@@ -44,6 +44,8 @@
 #define MAX_DOWNLOAD_DATA (MAX_PAYLOAD_SIZE + 32)
 #define COAP_MAX_RETRY 3
 #define MAX_IP_SIZE 30
+
+#define SHA256_HEX_DIGEST_SIZE	((TC_SHA256_DIGEST_SIZE * 2) + 1)

 #if defined(CONFIG_UPDATEHUB_CE)
 #define UPDATEHUB_SERVER CONFIG_UPDATEHUB_SERVER
@@ -66,8 +68,8 @@
 } ctx;

 static struct update_info {
-	char package_uid[TC_SHA256_BLOCK_SIZE + 1];
-	char sha256sum_image[TC_SHA256_BLOCK_SIZE + 1];
+	char package_uid[SHA256_HEX_DIGEST_SIZE];
+	char sha256sum_image[SHA256_HEX_DIGEST_SIZE];
 	int image_size;
 } update_info;

@@ -106,13 +108,13 @@
 		return -1;
 	}

-	memset(update_info.package_uid, 0, TC_SHA256_BLOCK_SIZE + 1);
+	memset(update_info.package_uid, 0, SHA256_HEX_DIGEST_SIZE);
 	for (int i = 0; i < TC_SHA256_DIGEST_SIZE; i++) {
 		snprintk(buffer, sizeof(buffer), "%02x",
 			 hash[i]);
 		buffer_len = buffer_len + strlen(buffer);
 		strncat(&update_info.package_uid[i], buffer,
-			MIN(TC_SHA256_BLOCK_SIZE, buffer_len));
+			MIN(SHA256_HEX_DIGEST_SIZE - 1, buffer_len));
 	}

 	return 0;
@@ -325,7 +327,7 @@
 static bool install_update_cb_sha256(void)
 {
 	u8_t image_hash[TC_SHA256_DIGEST_SIZE];
-	char buffer[3], sha256_image_dowloaded[TC_SHA256_BLOCK_SIZE + 1];
+	char buffer[3], sha256_image_dowloaded[SHA256_HEX_DIGEST_SIZE];
 	int i, buffer_len = 0;

 	if (tc_sha256_final(image_hash, &ctx.sha256sum) < 1) {
@@ -333,12 +335,12 @@
 		return false;
 	}

-	memset(&sha256_image_dowloaded, 0, TC_SHA256_BLOCK_SIZE + 1);
+	memset(&sha256_image_dowloaded, 0, SHA256_HEX_DIGEST_SIZE);
 	for (i = 0; i < TC_SHA256_DIGEST_SIZE; i++) {
 		snprintk(buffer, sizeof(buffer), "%02x", image_hash[i]);
 		buffer_len = buffer_len + strlen(buffer);
 		strncat(&sha256_image_dowloaded[i], buffer,
-			MIN(TC_SHA256_BLOCK_SIZE, buffer_len));
+			MIN(SHA256_HEX_DIGEST_SIZE - 1, buffer_len));
 	}

 	if (strncmp(sha256_image_dowloaded,
@@ -625,6 +627,8 @@
 	char *device_id = k_malloc(DEVICE_ID_MAX_SIZE);
 	char *firmware_version = k_malloc(BOOT_IMG_VER_STRLEN_MAX);

+	size_t sha256size;
+
 	if (device_id == NULL || firmware_version == NULL ||
 	    metadata == NULL || metadata_copy == NULL) {
 		LOG_ERR("Could not alloc probe memory");
@@ -703,9 +707,18 @@
 			goto cleanup;
 		}

+		sha256size = strlen(
+			metadata_any_boards.objects[1].objects.sha256sum) + 1;
+
+		if (sha256size != SHA256_HEX_DIGEST_SIZE) {
+			LOG_ERR("SHA256 size is invalid");
+			ctx.code_status = UPDATEHUB_METADATA_ERROR;
+			goto cleanup;
+		}
+
 		memcpy(update_info.sha256sum_image,
 		       metadata_any_boards.objects[1].objects.sha256sum,
-		       strlen(metadata_any_boards.objects[1].objects.sha256sum));
+		       SHA256_HEX_DIGEST_SIZE);
 		update_info.image_size = metadata_any_boards.objects[1].objects.size;
 	} else {
 		if (!is_compatible_hardware(&metadata_some_boards)) {
@@ -714,10 +727,19 @@
 				UPDATEHUB_INCOMPATIBLE_HARDWARE;
 			goto cleanup;
 		}
+
+		sha256size = strlen(
+			metadata_any_boards.objects[1].objects.sha256sum) + 1;
+
+		if (sha256size != SHA256_HEX_DIGEST_SIZE) {
+			LOG_ERR("SHA256 size is invalid");
+			ctx.code_status = UPDATEHUB_METADATA_ERROR;
+			goto cleanup;
+		}
+
 		memcpy(update_info.sha256sum_image,
 		       metadata_some_boards.objects[1].objects.sha256sum,
-		       strlen(metadata_some_boards.objects[1]
-			      .objects.sha256sum));
+		       SHA256_HEX_DIGEST_SIZE);
 		update_info.image_size =
 			metadata_some_boards.objects[1].objects.size;
 	}


disable the ssl-write checks for a moving SSL-write-buffer

git-svn-id: afcb13c9e50fc8809038f378d727e45d1298e8d1@1273 152afb58-edef-0310-8abb-c4023f1b3aa9

--- src/network.c
+++ src/network.c
@@ -362,6 +362,9 @@
 					s->ssl_pemfile);
 			return -1;
 		}
+		SSL_CTX_set_default_read_ahead(s->ssl_ctx, 1);
+		SSL_CTX_set_mode(s->ssl_ctx, SSL_get_mode(s->ssl_ctx) | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
+
 		srv_socket->ssl_ctx = s->ssl_ctx;
 #else


Silence one more

Silence one more

--- mod_maxminddb.c
+++ mod_maxminddb.c
@@ -108,7 +108,7 @@

 /* create a disabled directory entry */

-static void *create_dir_config(apr_pool_t * p, char *d)
+static void *create_dir_config(apr_pool_t * p, char *UNUSED(d))
 {

     maxminddb_dir_config_rec *dcfg;


[build] avoid accept_filter_arg compiler warning

avoid compiler warning for struct accept_filter_arg af_name strncpy()

--- src/network.c
+++ src/network.c
@@ -401,7 +401,7 @@
 		/* FreeBSD accf_http filter */
 		struct accept_filter_arg afa;
 		memset(&afa, 0, sizeof(afa));
-		strncpy(afa.af_name, s->bsd_accept_filter->ptr, sizeof(afa.af_name));
+		strncpy(afa.af_name, s->bsd_accept_filter->ptr, sizeof(afa.af_name)-1);
 		if (setsockopt(srv_socket->fd, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa)) < 0) {
 			if (errno != ENOENT) {
 				log_perror(srv->errh, __FILE__, __LINE__,


doc. fix

doc. fix

darcs-hash:20080206065242-4eba8-3f88f8014671bcaea3cc92e6c046afbfa9b35112.gz

--- mod_menu/menu.c
+++ mod_menu/menu.c
@@ -1036,7 +1036,7 @@
  *
  * \begin{tabularx}{\linewidth}{lX}
  *  \tabhead{Field & Description}
- *  \var{scroll_amount} & Number of pixels to scroll at a time
+ *  \var{scroll_amount} & Number of pixels to scroll at a time in
  *                        pointer-controlled menus when one extends
  *                        beyond a border of the screen and the pointer
  *                        touches that border. \\


credit added for clever define check

credit added for clever define check

--- tapuino.c
+++ tapuino.c
@@ -22,7 +22,7 @@
 #include "fileutils.h"
 #include "menu.h"

-// thanks stack overflow
+// thanks stack overflow: http://stackoverflow.com/questions/4301471/c-macro-to-test-if-more-than-one-defined
 #if defined(MACHINE_C64) + defined(MACHINE_VIC) + defined(MACHINE_C16) != 1
   #error Define exactly one of MACHINE_C64, MACHINE_VIC, MACHINE_C16
 #endif


Network: Fix message ID check when waiting for new frame.

--- src/network.h
+++ src/network.h
@@ -171,7 +171,9 @@
   latest_accepted_state.message_id = last_message_id;

   // If states are already available on the socket, use the one with the most recent message ID.
-  while (network.udpAvailableData() >= static_cast<int>(sizeof(T))) {
+  // If there was no valid state on the socket, we need to wait.
+  while (network.udpAvailableData() >= static_cast<int>(sizeof(T)) ||
+         latest_accepted_state.message_id == last_message_id) {
     T received_state = network.udpRead<T>();
     uint32_t new_id = received_state.message_id;
     uint32_t old_id = latest_accepted_state.message_id;
@@ -183,11 +185,6 @@
     }
   }

-  // No newer state was available, we need to wait.
-  if (latest_accepted_state.message_id == last_message_id) {
-    latest_accepted_state = network.udpRead<T>();
-  }
-
   return latest_accepted_state;
 }


Fix: incorrect debug placement

Fix: incorrect debug placement

--- mod_xsendfile.c
+++ mod_xsendfile.c
@@ -244,16 +244,15 @@
   const xsendfile_path_t *paths;
   int i;

-
-#ifdef _DEBUG
-  ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "xsendfile: path is %s", root);
-#endif
-
   patharr = conf->paths;
   if (!shouldDeleteFile) {
     const char *root = ap_xsendfile_get_orginal_path(r);
     if (root) {
       xsendfile_path_t *newpath;
+
+#ifdef _DEBUG
+      ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "xsendfile: path is %s", root);
+#endif

       patharr = apr_array_make(
         r->pool,


bug fix

bug fix

--- src/network.h
+++ src/network.h
@@ -114,7 +114,7 @@
             Matrix* weights = network->connections[i]->weights;
             for (j = 0; j < weights->rows; j++){
                 for (k = 0; k < weights->cols; k++){
-                    reg_err += weights->data[i][j] * weights->data[i][j];
+                    reg_err += weights->data[j][k] * weights->data[j][k];
                 }
             }
         }


Update relationship "proposal" which shows use cases using the API

--- proposals/qtsw-relation.h
+++ proposals/qtsw-relation.h
@@ -68,7 +68,7 @@

 // Use Case 4: Retrieve The Groups Which A Particular Contact Is A Member Of
 QContactRelationshipFilter crf;
-crf.setRole(QContactRelationshipFilter::Source);                 // we want "source" contact ids
+crf.setRole(QContactRelationshipFilter::First);                  // we want "source" contact ids
 crf.setType(QContactRelationship::HasMember);                    // which have as a member
 crf.setOtherParticipant(someContact.id());                       // the particular contact.
 QList<QContactLocalId> matchingGroups = contactManager.contacts(crf);
@@ -99,27 +99,28 @@
 // Advantage: know that the information is up to date
 // Disadvantage: only get local id's (of contacts which are stored in the manager)
 QContactRelationshipFilter crf;
-crf.setRole(QContactRelationshipFilter::Destination);           // we want all destination particpants
+crf.setRole(QContactRelationshipFilter::Second);                // we want all destination particpants
 crf.setType(QContactRelationship::HasMember);                   // ie, group members
-crf.setOtherParticipant(someGroupContact.id());                 // where I am the source (group)
+crf.setOtherParticipant(someGroupContact.id());                 // where I am the first participant (group)
 QList<QContactLocalId> groupMembers = contactManager.contacts(crf);

 // Use Case 10: Retrieving The Members Of A Group (Option 2)
 // Advantage: get _all_ groups members no matter which manager they are part of
 // Disadvantage: cached information, possibly stale.
 QContact someGroup;
-QList<QContactId> groupMembers = someGroup.relatedContacts(QContactRelationship::HasMember, QContactRelationshipFilter::Destination);
+QList<QContactId> groupMembers = someGroup.relatedContacts(QContactRelationship::HasMember, QContactRelationshipFilter::First);

 // Use Case 11: Modify Ordering Of Group Members
-QContactRelationship someGroupRelationship;
-QList<QContactId> groupMembers = someGroupRelationship.destinationContacts();
-QContactId someEntry = groupMembers.takeAt(3);                  // move from position 3
-groupMembers.insert(6, someEntry);                              // to position 6
-someGroupRelationship.setDestinationContacts(groupMembers);
-contactManager.saveRelationship(someGroupRelationship);
+QList<QContactRelationship> orderedRelationships = someGroup.relationshipOrder();
+QContactRelationship firstRel = orderedRelationships.takeAt(0); // reorder some relationship
+orderedRelationships.insert(3, firstRel);                       // ie, make it less important
+someGroup.setRelationshipOrder(orderedRelationships);           // set the new order
+contactManager.saveContact(&someGroup);                         // and save the new order

 // Use Case 12: Adding A Contact To A Group
 QContactRelationship someGroupRelationship;
-someGroupRelationship.appendDestinationContact(someContact.id());
+someGroupRelationship.setFirst(someGroup.id());
+someGroupRelationship.setSecond(someContact.id());
+someGroupRelationship.setType(QContactRelationship::hasMember);
 contactManager.saveRelationship(someGroupRelationship);


SDL: move joystick lower

SDL: move joystick lower

--- project/jni/sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c
+++ project/jni/sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c
@@ -796,6 +796,8 @@
 	// Move to the screen edge
 	arrows[0].x = 0;
 	arrows[0].y = SDL_ANDROID_sRealWindowHeight - arrows[0].h;
+	if (size <= 2)
+		arrows[0].y = SDL_ANDROID_sRealWindowHeight - arrows[0].h * 3 / 4;

 	arrowsExtended[0].w = arrows[0].w * 2;
 	arrowsExtended[0].h = arrows[0].h * 2;


check if we're not looping and just print an alive/dead message

--- src/nfsping.c
+++ src/nfsping.c
@@ -120,8 +120,6 @@
         }
     }

-    printf("NFSPING %s\n", host_string);
-
     client = clntudp_create(client_sock, NFS_PROGRAM, 3, wait, &sock);
     clnt_control (client, CLSET_TIMEOUT, (char *) &timeout);

@@ -140,6 +138,11 @@
             sent++;

             if (status == RPC_SUCCESS) {
+                /* check if we're not looping */
+                if (!count) {
+                    printf("%s is alive\n", host_string);
+                    exit(EXIT_SUCCESS);
+                }
                 received++;
                 us = tv2us(call_end) - tv2us(call_start);
                 ms = us / 1000.0;
@@ -157,7 +160,11 @@

                 printf("%s : [%u], %03.2f ms (%03.2f avg, %.0f%% loss)\n", host_string, sent - 1, ms, avg, loss);
             } else {
-                clnt_perror(client, argv[0]);
+                clnt_perror(client, host_string);
+                if (!count) {
+                    printf("%s is dead\n", host_string);
+                    exit(EXIT_FAILURE);
+                }
             }
             if (count && sent >= count) {
                 break;


cos relation

cos relation


Fix bug in poll polling engine causing pollsets to be deleted before they are removed from pollset_sets

--- src/core/lib/iomgr/ev_poll_posix.c
+++ src/core/lib/iomgr/ev_poll_posix.c
@@ -191,6 +191,7 @@
   int kicked_without_pollers;
   grpc_closure *shutdown_done;
   grpc_closure_list idle_jobs;
+  int pollset_set_count;
   /* all polled fds */
   size_t fd_count;
   size_t fd_capacity;
@@ -228,7 +229,7 @@

 /* Return 1 if the pollset has active threads in pollset_work (pollset must
  * be locked) */
-static int pollset_has_workers(grpc_pollset *pollset);
+static bool pollset_has_workers(grpc_pollset *pollset);

 /*******************************************************************************
  * pollset_set definitions
@@ -658,8 +659,16 @@
   worker->next->prev = worker->prev;
 }

-static int pollset_has_workers(grpc_pollset *p) {
+static bool pollset_has_workers(grpc_pollset *p) {
   return p->root_worker.next != &p->root_worker;
+}
+
+static bool pollset_in_pollset_sets(grpc_pollset *p) {
+  return p->pollset_set_count;
+}
+
+static bool pollset_has_observers(grpc_pollset *p) {
+  return pollset_has_workers(p) || pollset_in_pollset_sets(p);
 }

 static grpc_pollset_worker *pop_front_worker(grpc_pollset *p) {
@@ -800,6 +809,7 @@
   pollset->fd_count = 0;
   pollset->fd_capacity = 0;
   pollset->fds = NULL;
+  pollset->pollset_set_count = 0;
 }

 static void pollset_destroy(grpc_pollset *pollset) {
@@ -1061,7 +1071,7 @@
   if (pollset->shutting_down) {
     if (pollset_has_workers(pollset)) {
       pollset_kick(pollset, NULL);
-    } else if (!pollset->called_shutdown) {
+    } else if (!pollset->called_shutdown && !pollset_has_observers(pollset)) {
       pollset->called_shutdown = 1;
       gpr_mu_unlock(&pollset->mu);
       finish_shutdown(exec_ctx, pollset);
@@ -1093,7 +1103,7 @@
   if (!pollset_has_workers(pollset)) {
     grpc_closure_list_sched(exec_ctx, &pollset->idle_jobs);
   }
-  if (!pollset->called_shutdown && !pollset_has_workers(pollset)) {
+  if (!pollset->called_shutdown && !pollset_has_observers(pollset)) {
     pollset->called_shutdown = 1;
     finish_shutdown(exec_ctx, pollset);
   }
@@ -1143,13 +1153,16 @@
                                     grpc_pollset_set *pollset_set,
                                     grpc_pollset *pollset) {
   size_t i, j;
+  gpr_mu_lock(&pollset->mu);
+  pollset->pollset_set_count++;
+  gpr_mu_unlock(&pollset->mu);
   gpr_mu_lock(&pollset_set->mu);
   if (pollset_set->pollset_count == pollset_set->pollset_capacity) {
     pollset_set->pollset_capacity =
         GPR_MAX(8, 2 * pollset_set->pollset_capacity);
-    pollset_set->pollsets =
-        gpr_realloc(pollset_set->pollsets, pollset_set->pollset_capacity *
-                                               sizeof(*pollset_set->pollsets));
+    pollset_set->pollsets = gpr_realloc(
+        pollset_set->pollsets,
+        pollset_set->pollset_capacity * sizeof(*pollset_set->pollsets));
   }
   pollset_set->pollsets[pollset_set->pollset_count++] = pollset;
   for (i = 0, j = 0; i < pollset_set->fd_count; i++) {
@@ -1178,6 +1191,17 @@
     }
   }
   gpr_mu_unlock(&pollset_set->mu);
+  gpr_mu_lock(&pollset->mu);
+  pollset->pollset_set_count--;
+  /* check shutdown */
+  if (pollset->shutting_down && !pollset->called_shutdown &&
+      !pollset_has_observers(pollset)) {
+    pollset->called_shutdown = 1;
+    gpr_mu_unlock(&pollset->mu);
+    finish_shutdown(exec_ctx, pollset);
+  } else {
+    gpr_mu_unlock(&pollset->mu);
+  }
 }

 static void pollset_set_add_pollset_set(grpc_exec_ctx *exec_ctx,


Missing header and pragma once

Missing header and pragma once

--- tests/utils.h
+++ tests/utils.h
@@ -21,4 +21,8 @@
  */

+#pragma once
+
+#include "../src/log.h"
+
 #define RETURN(x) { Log::finish(); return x; }


AutoDiff: add one missing operator- version

--- unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
+++ unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
@@ -216,6 +216,11 @@
       return *this;
     }

+    inline const AutoDiffScalar<DerType&> operator-(const Scalar& b) const
+    {
+      return AutoDiffScalar<DerType&>(m_value - b, m_derivatives);
+    }
+
     friend inline const AutoDiffScalar<DerType&> operator-(const Scalar& a, const AutoDiffScalar& b)
     {
       return AutoDiffScalar<DerType&>(a - b.value(), b.derivatives());


Remove isSyncDatabase in WebDatabaseObserver [3/3]

Final clean-up for methods with isSyncDatabase parameter.

[1] https://codereview.chromium.org/660873004/
[2] https://codereview.chromium.org/666333002/
[3] THIS PATCH

BUG=428254

Review URL: https://codereview.chromium.org/669063002

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@184779 bbb929c8-8fbe-4397-9dbb-9b2b20218538

--- public/platform/WebDatabaseObserver.h
+++ public/platform/WebDatabaseObserver.h
@@ -37,8 +37,6 @@

 class WebDatabaseObserver {
 public:
-    // FIXME: |isSyncDatabse| arguments are alwyas |false|. We should remove them.
-
     virtual void databaseOpened(
         const WebString& databaseIdentifier,
         const WebString& databaseName,
@@ -53,76 +51,27 @@
     virtual void reportOpenDatabaseResult(
         const WebString& databaseIdentifier,
         const WebString& databaseName,
-        int errorSite, int webSqlErrorCode, int sqliteErrorCode)
-    {
-        reportOpenDatabaseResult(databaseIdentifier, databaseName, false, errorSite, webSqlErrorCode, sqliteErrorCode);
-    }
-    virtual void reportChangeVersionResult(
-        const WebString& databaseIdentifier,
-        const WebString& databaseName,
-        int errorSite, int webSqlErrorCode, int sqliteErrorCode)
-    {
-        reportChangeVersionResult(databaseIdentifier, databaseName, false, errorSite, webSqlErrorCode, sqliteErrorCode);
-    }
-    virtual void reportStartTransactionResult(
-        const WebString& databaseIdentifier,
-        const WebString& databaseName,
-        int errorSite, int webSqlErrorCode, int sqliteErrorCode)
-    {
-        reportStartTransactionResult(databaseIdentifier, databaseName, false, errorSite, webSqlErrorCode, sqliteErrorCode);
-    }
-    virtual void reportCommitTransactionResult(
-        const WebString& databaseIdentifier,
-        const WebString& databaseName,
-        int errorSite, int webSqlErrorCode, int sqliteErrorCode)
-    {
-        reportCommitTransactionResult(databaseIdentifier, databaseName, false, errorSite, webSqlErrorCode, sqliteErrorCode);
-    }
-    virtual void reportExecuteStatementResult(
-        const WebString& databaseIdentifier,
-        const WebString& databaseName,
-        int errorSite, int webSqlErrorCode, int sqliteErrorCode)
-    {
-        reportExecuteStatementResult(databaseIdentifier, databaseName, false, errorSite, webSqlErrorCode, sqliteErrorCode);
-    }
-    virtual void reportVacuumDatabaseResult(
-        const WebString& databaseIdentifier,
-        const WebString& databaseName,
-        int sqliteErrorCode)
-    {
-        reportVacuumDatabaseResult(databaseIdentifier, databaseName, false, sqliteErrorCode);
-    }
-
-    // FIXME: Remove these functions once we no longer use isSyncDatabase in Chromium.
-    virtual void reportOpenDatabaseResult(
-        const WebString& databaseIdentifier,
-        const WebString& databaseName,
-        bool isSyncDatabase,
         int errorSite, int webSqlErrorCode, int sqliteErrorCode) { }
     virtual void reportChangeVersionResult(
         const WebString& databaseIdentifier,
         const WebString& databaseName,
-        bool isSyncDatabase,
         int errorSite, int webSqlErrorCode, int sqliteErrorCode) { }
     virtual void reportStartTransactionResult(
         const WebString& databaseIdentifier,
         const WebString& databaseName,
-        bool isSyncDatabase,
         int errorSite, int webSqlErrorCode, int sqliteErrorCode) { }
     virtual void reportCommitTransactionResult(
         const WebString& databaseIdentifier,
         const WebString& databaseName,
-        bool isSyncDatabase,
         int errorSite, int webSqlErrorCode, int sqliteErrorCode) { }
     virtual void reportExecuteStatementResult(
         const WebString& databaseIdentifier,
         const WebString& databaseName,
-        bool isSyncDatabase,
         int errorSite, int webSqlErrorCode, int sqliteErrorCode) { }
     virtual void reportVacuumDatabaseResult(
         const WebString& databaseIdentifier,
         const WebString& databaseName,
-        bool isSyncDatabase, int sqliteErrorCode) { }
+        int sqliteErrorCode) { }

 protected:
     ~WebDatabaseObserver() { }


Issue #16: Move cleanup of callbacks to destruction not after the callback has happend

--- lib/vpi_shim/gpi_vpi.c
+++ lib/vpi_shim/gpi_vpi.c
@@ -275,6 +275,7 @@
     vpiHandle cb_hdl;
     s_vpi_value  cb_value;
     gpi_sim_hdl_t gpi_hdl;
+    bool called;
 } s_vpi_cb_user_data, *p_vpi_cb_user_data;

 // Ask the attached simulator to return the user pointer
@@ -304,11 +305,12 @@
     p_vpi_cb_user_data user_data;
     user_data = (p_vpi_cb_user_data)cb_data->user_data;

+    user_data->called = true;
     rv = user_data->gpi_function(user_data->gpi_cb_data);

-    // Call destuctor
-    if (user_data->gpi_cleanup)
-        user_data->gpi_cleanup(user_data);
+    // We delay freeing until the top level owner
+    // calls gpi_deregister_callback
+    // this gives an implicit serialisation

     FEXIT
     return rv;
@@ -330,12 +332,12 @@
     // do some pointer magic.

     user_data = gpi_container_of(gpi_hdl, s_vpi_cb_user_data, gpi_hdl);
-    PLI_INT32 rc = vpi_remove_cb(user_data->cb_hdl);
-
-    free(user_data);
-
-    FEXIT
-    return rc;
+
+    if (user_data->gpi_cleanup)
+        user_data->gpi_cleanup(user_data);
+
+    FEXIT
+    return 1;
 }

 // Call when the handle relates to a one time callback
@@ -351,6 +353,11 @@
         exit(1);
     }

+    // If the callback has not been called we also need to call
+    // remove as well
+    if (!user_data->called)
+        vpi_remove_cb(cb_hdl);
+
     rc = vpi_free_object(cb_hdl);
     free(user_data);
     FEXIT
@@ -385,7 +392,7 @@
     p_vpi_cb_user_data user_data;

     // Freed when callback fires or the callback is deregistered
-    user_data = (p_vpi_cb_user_data)calloc(sizeof(s_vpi_cb_user_data), 1);
+    user_data = (p_vpi_cb_user_data)malloc(sizeof(s_vpi_cb_user_data));
     if (user_data == NULL) {
         LOG_WARN("VPI: Attempting allocate user_data for %s failed!", __func__);
     }
@@ -394,6 +401,7 @@
     user_data->gpi_function = gpi_function;
     user_data->gpi_cleanup = gpi_free_recurring;
     user_data->cb_value.format = vpiIntVal;
+    user_data->called = false;

     vpi_time_s.type = vpiSuppressTime;
     vpi_value_s.format = vpiIntVal;
@@ -428,6 +436,7 @@
     user_data->gpi_cb_data = gpi_cb_data;
     user_data->gpi_function = gpi_function;
     user_data->gpi_cleanup = gpi_free_one_time;
+    user_data->called = false;

     vpi_time_s.type = vpiSimTime;
     vpi_time_s.high = 0;
@@ -462,6 +471,7 @@
     user_data->gpi_cb_data = gpi_cb_data;
     user_data->gpi_function = gpi_function;
     user_data->gpi_cleanup = gpi_free_one_time;
+    user_data->called = false;

     vpi_time_s.type = vpiSimTime;
     vpi_time_s.high = 0;
@@ -495,6 +505,7 @@
     user_data->gpi_cb_data = gpi_cb_data;
     user_data->gpi_function = gpi_function;
     user_data->gpi_cleanup = gpi_free_one_time;
+    user_data->called = false;

     vpi_time_s.type = vpiSimTime;
     vpi_time_s.high = 0;
@@ -529,6 +540,7 @@
     user_data->gpi_cb_data = gpi_cb_data;
     user_data->gpi_function = gpi_function;
     user_data->gpi_cleanup = gpi_free_one_time;
+    user_data->called = false;

     vpi_time_s.type = vpiSimTime;
     vpi_time_s.high = (PLI_UINT32)(time_ps>>32);
@@ -563,6 +575,7 @@
     user_data->gpi_cb_data = gpi_cb_data;
     user_data->gpi_function = gpi_function;
     user_data->gpi_cleanup = gpi_free_one_time;
+    user_data->called = false;

     cb_data_s.reason    = cbStartOfSimulation;
     cb_data_s.cb_rtn    = handle_vpi_callback;
@@ -593,6 +606,7 @@
     user_data->gpi_cb_data = gpi_cb_data;
     user_data->gpi_function = gpi_function;
     user_data->gpi_cleanup = gpi_free_one_time;
+    user_data->called = false;

     cb_data_s.reason    = cbEndOfSimulation;
     cb_data_s.cb_rtn    = handle_vpi_callback;


All initializers for EXORpcAuthKey can return nil.

--- Classes/rpc/EXORpcAuthKey.h
+++ Classes/rpc/EXORpcAuthKey.h
@@ -44,7 +44,7 @@

  @return Authentication object to be used in RPC calls.
  */
-+ (EXORpcAuthKey*)authWithCIK:(NSString*)cik;
++ (nullable EXORpcAuthKey*)authWithCIK:(NSString*)cik;

 /**
  Create an auth identifying a child client by RID of the ancestor client by CIK
@@ -54,7 +54,7 @@

  @return Authentication object to be used in RPC calls.
  */
-+ (EXORpcAuthKey*)authWithCIK:(NSString*)cik client:(NSString*)clientid;
++ (nullable EXORpcAuthKey*)authWithCIK:(NSString*)cik client:(NSString*)clientid;

 /**
  Create an auth identifying a child resource by RID of the ancestor client by CIK
@@ -64,7 +64,7 @@

  @return Authentication object to be used in RPC calls.
  */
-+ (EXORpcAuthKey*)authWithCIK:(NSString*)cik resource:(NSString*)rid;
++ (nullable EXORpcAuthKey*)authWithCIK:(NSString*)cik resource:(NSString*)rid;

 /**
@@ -74,7 +74,7 @@

  @return Authentication object to be used in RPC calls.
  */
-- (instancetype)initWithCIK:(NSString*)cik;
+- (nullable instancetype)initWithCIK:(NSString*)cik;

 /**
  Return this auth as a plist that can be converted into JSON.


DOC: Modified documentation for UpdateOutputInformation to indicate the assumptions made about this method in any derived classes.

--- Code/Common/itkDataObject.h
+++ Code/Common/itkDataObject.h
@@ -295,9 +295,10 @@

   /**
    * Update the information for this DataObject so that it can be used
-   * as an output of a ProcessObject.  This method is used the pipeline
+   * as an output of a ProcessObject.  This method is used in the pipeline
    * mechanism to propagate information and initialize the meta data
-   * associated with a DataObject. This method calls its source's
+   * associated with a DataObject.  Any implementation of this method in
+   * a derived class is assumed to call its source's
    * ProcessObject::UpdateOutputInformation() which determines modified
    * times, LargestPossibleRegions, and any extra meta data like spacing,
    * origin, etc.


COMP: Fix from Simon Warfield http://www.itk.org/mailman/private/insight-developers/2006-July/008286.html

--- Code/Common/itk_hashtable.h
+++ Code/Common/itk_hashtable.h
@@ -395,7 +395,7 @@
       equals = ht.equals;
       get_key = ht.get_key;
       clear();
-      buckets.clear();
+      this->buckets.clear();
       copy_from(ht);
     }
     return *this;
@@ -403,7 +403,7 @@

   ~hashtable() {}

-  size_type size() const { return num_elements; }
+  size_type size() const { return this->num_elements; }
   size_type max_size() const { return size_type(-1); }
   bool empty() const { return size() == 0; }

@@ -412,15 +412,15 @@
     std::swap(hashfun, ht.hashfun);
     std::swap(equals, ht.equals);
     std::swap(get_key, ht.get_key);
-    buckets.swap(ht.buckets);
-    std::swap(num_elements, ht.num_elements);
+    this->buckets.swap(ht.buckets);
+    std::swap(this->num_elements, ht.num_elements);
   }

   iterator begin()
   {
-    for (size_type n = 0; n < buckets.size(); ++n)
-      if (buckets[n])
-        return iterator(buckets[n], this);
+    for (size_type n = 0; n < this->buckets.size(); ++n)
+      if (this->buckets[n])
+        return iterator(this->buckets[n], this);
     return end();
   }

@@ -428,9 +428,9 @@

   const_iterator begin() const
   {
-    for (size_type n = 0; n < buckets.size(); ++n)
-      if (buckets[n])
-        return const_iterator(buckets[n], this);
+    for (size_type n = 0; n < this->buckets.size(); ++n)
+      if (this->buckets[n])
+        return const_iterator(this->buckets[n], this);
     return end();
   }

@@ -441,7 +441,7 @@
   friend bool operator== VCL_NULL_TMPL_ARGS (const self&,const self&);
 public:

-  size_type bucket_count() const { return buckets.size(); }
+  size_type bucket_count() const { return this->buckets.size(); }

   size_type max_bucket_count() const
     { return prime_list[num_primes - 1]; }
@@ -449,20 +449,20 @@
   size_type elems_in_bucket(size_type bucket) const
   {
     size_type result = 0;
-    for (node* cur = buckets[bucket]; cur; cur = cur->next)
+    for (node* cur = this->buckets[bucket]; cur; cur = cur->next)
       result += 1;
     return result;
   }

   std::pair<iterator, bool> insert_unique(const value_type& obj)
   {
-    resize(num_elements + 1);
+    resize(this->num_elements + 1);
     return insert_unique_noresize(obj);
   }

   iterator insert_equal(const value_type& obj)
   {
-    resize(num_elements + 1);
+    resize(this->num_elements + 1);
     return insert_equal_noresize(obj);
   }

@@ -472,7 +472,7 @@
   void insert_unique(const value_type* f, const value_type* l)
   {
     size_type n = l - f;
-    resize(num_elements + n);
+    resize(this->num_elements + n);
     for ( ; n > 0; --n)
       insert_unique_noresize(*f++);
   }
@@ -480,7 +480,7 @@
   void insert_equal(const value_type* f, const value_type* l)
   {
     size_type n = l - f;
-    resize(num_elements + n);
+    resize(this->num_elements + n);
     for ( ; n > 0; --n)
       insert_equal_noresize(*f++);
   }
@@ -489,7 +489,7 @@
   {
     size_type n = 0;
     std::distance(f, l, n);
-    resize(num_elements + n);
+    resize(this->num_elements + n);
     for ( ; n > 0; --n)
       insert_unique_noresize(*f++);
   }
@@ -498,7 +498,7 @@
   {
     size_type n = 0;
     std::distance(f, l, n);
-    resize(num_elements + n);
+    resize(this->num_elements + n);
     for ( ; n > 0; --n)
       insert_equal_noresize(*f++);
   }
@@ -509,7 +509,7 @@
   {
     size_type n = bkt_num_key(key);
     node* first;
-    for ( first = buckets[n];
+    for ( first = this->buckets[n];
           first && !equals(get_key(first->val), key);
           first = first->next)
       {}
@@ -520,7 +520,7 @@
   {
     size_type n = bkt_num_key(key);
     const node* first;
-    for ( first = buckets[n];
+    for ( first = this->buckets[n];
           first && !equals(get_key(first->val), key);
           first = first->next)
       {}
@@ -532,7 +532,7 @@
     const size_type n = bkt_num_key(key);
     size_type result = 0;

-    for (const node* cur = buckets[n]; cur; cur = cur->next)
+    for (const node* cur = this->buckets[n]; cur; cur = cur->next)
       if (equals(get_key(cur->val), key))
         ++result;
     return result;
@@ -558,12 +558,12 @@
     void initialize_buckets(size_type n)
     {
         const size_type n_buckets = next_size(n);
-        buckets.reserve(n_buckets);
-        buckets.insert(buckets.end(), n_buckets, (node*) 0);
-        num_elements = 0;
+        this->buckets.reserve(n_buckets);
+        this->buckets.insert(this->buckets.end(), n_buckets, (node*) 0);
+        this->num_elements = 0;
     }
     size_type bkt_num_key(const key_type& key) const{
-        return bkt_num_key(key, buckets.size());
+        return bkt_num_key(key, this->buckets.size());
     }

     size_type bkt_num(const value_type& obj) const {
@@ -715,7 +715,7 @@
 hashtable<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc>::insert_unique_noresize(const __value_type__& obj)
 {
   const size_type n = bkt_num(obj);
-  node* first = buckets[n];
+  node* first = this->buckets[n];

   for (node* cur = first; cur; cur = cur->next)
     if (equals(get_key(cur->val), get_key(obj)))
@@ -723,8 +723,8 @@

   node* tmp = new_node(obj);
   tmp->next = first;
-  buckets[n] = tmp;
-  ++num_elements;
+  this->buckets[n] = tmp;
+  ++this->num_elements;
   return std::pair<iterator, bool>(iterator(tmp, this), true);
 }

@@ -755,10 +755,10 @@
 __reference__
 hashtable<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc>::find_or_insert(const __value_type__& obj)
 {
-  resize(num_elements + 1);
+  resize(this->num_elements + 1);

   size_type n = bkt_num(obj);
-  node* first = buckets[n];
+  node* first = this->buckets[n];

   for (node* cur = first; cur; cur = cur->next)
     if (equals(get_key(cur->val), get_key(obj)))
@@ -766,8 +766,8 @@

   node* tmp = new_node(obj);
   tmp->next = first;
-  buckets[n] = tmp;
-  ++num_elements;
+  this->buckets[n] = tmp;
+  ++this->num_elements;
   return tmp->val;
 }

@@ -823,7 +823,7 @@
 hashtable<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc>::erase(const __key_type__& key)
 {
   const size_type n = bkt_num_key(key);
-  node* first = buckets[n];
+  node* first = this->buckets[n];
   size_type erased = 0;

   if (first) {
@@ -842,12 +842,12 @@
       }
     }
     if (equals(get_key(first->val), key)) {
-      buckets[n] = first->next;
+      this->buckets[n] = first->next;
       delete_node(first);
       ++erased;
     }
   }
-  num_elements -= erased;
+  this->num_elements -= erased;
   return erased;
 }

@@ -858,12 +858,12 @@
   node* const p = it.cur;
   if (p) {
     const size_type n = bkt_num(p->val);
-    node* cur = buckets[n];
+    node* cur = this->buckets[n];

     if (cur == p) {
-      buckets[n] = cur->next;
+      this->buckets[n] = cur->next;
       delete_node(cur);
-      --num_elements;
+      --this->num_elements;
     }
     else {
       node* next = cur->next;
@@ -871,7 +871,7 @@
         if (next == p) {
           cur->next = next->next;
           delete_node(next);
-          --num_elements;
+          --this->num_elements;
           break;
         }
         else {
@@ -926,23 +926,23 @@
 void
 hashtable<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc>::resize(__size_type__ num_elements_hint)
 {
-    const size_type old_n = buckets.size();
+    const size_type old_n = this->buckets.size();
     if (num_elements_hint > old_n) {
         const size_type n = next_size(num_elements_hint);
         if (n > old_n) {
-      hashtable<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc>::buckets_type tmp(n, (node*)0);
+      typename hashtable<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc>::buckets_type tmp(n, (node*)0);
             for (size_type bucket = 0; bucket < old_n; ++bucket) {
-                node* first = buckets[bucket];
+                node* first = this->buckets[bucket];
                 while (first) {
                     size_type new_bucket = bkt_num(first->val, n);
-                    buckets[bucket] = first->next;
+                    this->buckets[bucket] = first->next;
                     first->next = tmp[new_bucket];
                     tmp[new_bucket] = first;
-                    first = buckets[bucket];
+                    first = this->buckets[bucket];
                 }
             }
-            buckets.clear();
-            buckets.swap(tmp);
+            this->buckets.clear();
+            this->buckets.swap(tmp);
         }
     }
 }


docs: fix simple typo, resuing -> reusing

There is a small typo in gumbo/parser.c.

Should read `reusing` rather than `resuing`.

--- gumbo/parser.c
+++ gumbo/parser.c
@@ -4647,7 +4647,7 @@
                     // we exclude the <html> tag as it causes crashes in the as-lxml
                     // module, see https://github.com/kovidgoyal/html5-parser/issues/17
                     // I dont have the time to track down the root cause, probably something
-                    // related to resuing the same string segments for the tag name and the
+                    // related to reusing the same string segments for the tag name and the
                     // special cloning/modification that happens to HTML tags. Since HTML tags
                     // are treated specially anyway, there is no harm in excluding them.
                     TAG(HTML)})) {


Don't set za's error when there is no error.  Noted by Pierre Joye.

--- lib/zip_file_replace.c
+++ lib/zip_file_replace.c
@@ -63,6 +63,7 @@
 _zip_file_replace(struct zip *za, zip_uint64_t idx, const char *name, struct zip_source *source, zip_flags_t flags)
 {
     zip_uint64_t za_nentry_prev;
+
     if (ZIP_IS_RDONLY(za)) {
 	_zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
 	return -1;
@@ -73,7 +74,7 @@
 	zip_int64_t i = -1;

 	if (flags & ZIP_FL_OVERWRITE)
-	    i = zip_name_locate(za, name, flags);
+	    i = _zip_name_locate(za, name, flags, NULL);

 	if (i == -1) {
 	    /* create and use new entry, used by zip_add */


updated documentation

updated documentation

--- livesupport/products/scheduler/src/SchedulerDaemon.h
+++ livesupport/products/scheduler/src/SchedulerDaemon.h
@@ -22,7 +22,7 @@

     Author   : $Author: maroy $
-    Version  : $Revision: 1.2 $
+    Version  : $Revision: 1.3 $
     Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemon.h,v $

 ------------------------------------------------------------------------------*/
@@ -105,7 +105,8 @@
  *

  *
  *  For details on the included elements, see the corresponding documentation
- *  for XmlRpcDaemon, ConnectionManagerFactory and ScheduleFactory.
+ *  for XmlRpcDaemon, StorageClientFactory, ConnectionManagerFactory
+ *  and ScheduleFactory.
  *
  *  The DTD for the above element is the following:
  *
@@ -115,10 +116,11 @@
  *

  *
  *  @author  $Author: maroy $
- *  @version $Revision: 1.2 $
+ *  @version $Revision: 1.3 $
+ *  @see ConnectionManagerFactory
+ *  @see StorageClientFactory
+ *  @see ScheduleFactory
  *  @see XmlRpcDaemon
- *  @see ConnectionManagerFactory
- *  @see ScheduleFactory
  */
 class SchedulerDaemon : public Installable,
                         public Configurable,


Feature: Initial DDS header info printing

--- textureinfo.h
+++ textureinfo.h
@@ -548,7 +548,34 @@
   static const std::uint32_t kIdentifier = 0x20534444; // "DDS "
   static const std::uint32_t kExpectedDDSSize = 124;

-  std::vector<std::string> column_names {};
+  std::vector<std::string> column_names {
+  "Pixel format (size)",
+  "Pixel format (flags)",
+  "Pixel format (fourcc)",
+  "Pixel format (bit count)",
+  "Pixel format (red mask)",
+  "Pixel format (blue mask)",
+  "Pixel format (green mask)",
+  "Pixel format (alpha mask)",
+  "Size",
+  "Flags",
+  "Width",
+  "Height",
+  "Depth",
+  "Number of MIP maps",
+  "Pitch or linear size",
+  "Capabilities (1)",
+  "Capabilities (2)",
+  "Capabilities (3)",
+  "Capabilities (4)",
+  "Reserved",
+  "Reserved (2)",
+  "DX10: Format",
+  "DX10: Dimension",
+  "DX10: Array size",
+  "DX10: Flags (1)",
+  "DX10: Flags (2)"
+  };
 }
 class DDSHeader: public IHeader {
 public:
@@ -567,8 +594,57 @@
     file.read(reinterpret_cast<char*>(&this->impl_), sizeof(this->impl_));
     HEADER_POST_LOAD(file)
   }
-  virtual std::string ToString() {assert(0);}
-  virtual std::string ToCsvString() {assert(0);}
+  std::vector<std::string> ToStringArray() {
+    std::vector<std::string> output;
+    const auto& impl(this->impl_);
+    const auto& dx10_impl(this->dx10_impl_);
+    output.push_back(std::to_string(impl.pixel_format.size));
+    output.push_back(std::to_string(impl.pixel_format.flags));
+    output.push_back(std::to_string(impl.pixel_format.fourcc));
+    output.push_back(std::to_string(impl.pixel_format.bit_count));
+    output.push_back(std::to_string(impl.pixel_format.red_mask));
+    output.push_back(std::to_string(impl.pixel_format.blue_mask));
+    output.push_back(std::to_string(impl.pixel_format.green_mask));
+    output.push_back(std::to_string(impl.pixel_format.alpha_mask));
+    output.push_back(std::to_string(impl.size));
+    output.push_back(std::to_string(impl.flags));
+    output.push_back(std::to_string(impl.width));
+    output.push_back(std::to_string(impl.height));
+    output.push_back(std::to_string(impl.depth));
+    output.push_back(std::to_string(impl.mip_map_count));
+    output.push_back(std::to_string(impl.pitch_or_linear_size));
+    output.push_back(std::to_string(impl.capabilities1));
+    output.push_back(std::to_string(impl.capabilities2));
+    output.push_back(std::to_string(impl.capabilities3));
+    output.push_back(std::to_string(impl.capabilities4));
+    std::string reserved;
+    for(auto& value: impl.reserved) {
+      reserved.append(std::to_string(value) + ':');
+    }
+    output.push_back(reserved);
+    output.push_back(std::to_string(impl.reserved2));
+    // DX 10
+    output.push_back(std::to_string(dx10_impl.dxgi_format));
+    output.push_back(std::to_string(dx10_impl.resource_dimension));
+    output.push_back(std::to_string(dx10_impl.array_size));
+    output.push_back(std::to_string(dx10_impl.misc_flags));
+    output.push_back(std::to_string(dx10_impl.misc_flags_2));
+    return output;
+    }
+  virtual std::string ToString() {
+    std::string output("");
+    const auto& variable_strings(this->ToStringArray());
+    for(unsigned int index=0; index<DDSInfo::column_names.size();++index)
+      output.append(DDSInfo::column_names.at(index) + ": " + variable_strings.at(index) + "\n");
+    return output;
+  }
+  virtual std::string ToCsvString() {
+    std::string output("");
+    const auto& variable_strings(this->ToStringArray());
+    for(const auto& variable_string:variable_strings)
+      output.append(variable_string + ',');
+    return output;
+  }
 public:
 private:
   struct PixelFormat {


Fix allocator use in static library demo. (#8404)

Missed in https://github.com/google/iree/pull/8389 since this demo was disabled (re-enabled in https://github.com/google/iree/pull/8382).

--- iree/samples/static_library/static_library_demo.c
+++ iree/samples/static_library/static_library_demo.c
@@ -124,13 +124,15 @@
   float kFloat4[] = {4.0f, 4.0f, 4.0f, 4.0f};
   float kFloat2[] = {2.0f, 2.0f, 2.0f, 2.0f};

-  iree_hal_memory_type_t input_memory_type =
-      IREE_HAL_MEMORY_TYPE_HOST_LOCAL | IREE_HAL_MEMORY_TYPE_DEVICE_VISIBLE;
   if (iree_status_is_ok(status)) {
     status = iree_hal_buffer_view_allocate_buffer(
         iree_hal_device_allocator(device), shape, IREE_ARRAYSIZE(shape),
         IREE_HAL_ELEMENT_TYPE_FLOAT_32, IREE_HAL_ENCODING_TYPE_DENSE_ROW_MAJOR,
-        input_memory_type, IREE_HAL_BUFFER_USAGE_ALL,
+        (iree_hal_buffer_params_t){
+            .type = IREE_HAL_MEMORY_TYPE_HOST_LOCAL |
+                    IREE_HAL_MEMORY_TYPE_DEVICE_VISIBLE,
+            .usage = IREE_HAL_BUFFER_USAGE_ALL,
+        },
         iree_make_const_byte_span((void*)kFloat4,
                                   sizeof(float) * kElementCount),
         &arg0_buffer_view);
@@ -139,7 +141,11 @@
     status = iree_hal_buffer_view_allocate_buffer(
         iree_hal_device_allocator(device), shape, IREE_ARRAYSIZE(shape),
         IREE_HAL_ELEMENT_TYPE_FLOAT_32, IREE_HAL_ENCODING_TYPE_DENSE_ROW_MAJOR,
-        input_memory_type, IREE_HAL_BUFFER_USAGE_ALL,
+        (iree_hal_buffer_params_t){
+            .type = IREE_HAL_MEMORY_TYPE_HOST_LOCAL |
+                    IREE_HAL_MEMORY_TYPE_DEVICE_VISIBLE,
+            .usage = IREE_HAL_BUFFER_USAGE_ALL,
+        },
         iree_make_const_byte_span((void*)kFloat2,
                                   sizeof(float) * kElementCount),
         &arg1_buffer_view);


* aac: some msg_Err -> msg_Warn

* aac: some msg_Err -> msg_Warn

--- modules/demux/aac/demux.c
+++ modules/demux/aac/demux.c
@@ -2,7 +2,7 @@
  * demux.c : Raw aac Stream input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: demux.c,v 1.3 2002/10/23 21:54:33 gbazin Exp $
+ * $Id: demux.c,v 1.4 2003/01/20 13:03:03 fenrir Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -621,7 +621,7 @@

     if( !ReadPES( p_input, &p_pes, p_aac->i_aac_frame_length ) )
     {
-        msg_Err( p_input,
+        msg_Warn( p_input,
                  "cannot read data" );
         return( -1 );
     }


all streams are idle if the sum of state is 0

--- lib/http2/connection.c
+++ lib/http2/connection.c
@@ -150,9 +150,8 @@
 static void update_idle_timeout(h2o_http2_conn_t *conn)
 {
     h2o_linklist_unlink(&conn->super._conns);
-    if (kh_size(conn->streams) == conn->num_streams.priority.open + conn->num_streams.priority.half_closed +
-                                      conn->num_streams.pull.open + conn->num_streams.pull.half_closed +
-                                      conn->num_streams.push.open + conn->num_streams.push.half_closed) {
+    if (0 == conn->num_streams.priority.open + conn->num_streams.priority.half_closed + conn->num_streams.pull.open +
+                 conn->num_streams.pull.half_closed + conn->num_streams.push.open + conn->num_streams.push.half_closed) {
         // all streams are idle
         h2o_linklist_insert(&conn->super.ctx->_idle_conns, &conn->super._conns);
     } else {


fix redis module

fix redis module

--- lib/modules/redis/redis.c
+++ lib/modules/redis/redis.c
@@ -44,8 +44,8 @@
     return -1;
   if (mod->io_handler) {
     monikor_unregister_io_handler(mon, mod->io_handler);
-    close(mod->io_handler->fd);
-    free(mod->io_handler->data);
+    if (mod->io_handler->fd != -1)
+      close(mod->io_handler->fd);
     free(mod->io_handler);
     mod->io_handler = NULL;
   }


added sampleformat enum

added sampleformat enum

--- libambix/ambix/ambix.h
+++ libambix/ambix/ambix.h
@@ -69,7 +69,15 @@
   AMBIX_SIMPLE   = 1,
   /** extended ambix file (w pre-multiplication matrix ) */
   AMBIX_EXTENDED = 2
-} ambix_filetype_t;
+} ambix_fileformat_t;
+
+typedef enum {
+  AMBIX_SAMPLEFORMAT_NONE=0,
+  AMBIX_SAMPLEFORMAT_PCM16,
+  AMBIX_SAMPLEFORMAT_PCM24,
+  AMBIX_SAMPLEFORMAT_PCM32,
+  AMBIX_SAMPLEFORMAT_FLOAT32,
+} ambix_sampleformat_t;

 /** this is for passing data about the opened ambix file between the host application and the library */
@@ -78,17 +86,19 @@
   unsigned long  frames;
   /** samplerate in Hz */
   int			samplerate;
+  /** type of the ambix file */
+  ambix_sampleformat_t sampleformat;

   /** type of the ambix file */
-  ambix_filetype_t ambixformat;
+  ambix_fileformat_t ambixfileformat;
   /** number of (raw) ambisonics channels present in the file
    * if the file contains a full set of ambisonics channels (always true if ambixformat==AMBIX_SIMPLE),
    * then ambichannels=(ambiorder+1)^2;
    * if the file contains a reduced set (ambichannels<(ambiorder+1)^2) you can reconstruct the full set by
    * multiplying the reduced set with the reconstruction matrix */
-	int			ambichannels;
+	unsigned int			ambichannels;
   /** number of non-ambisonics channels in the file */
-	int			otherchannels;
+	unsigned int			otherchannels;
 } ambixinfo_t;

 /** @brief Open an ambix file
@@ -130,7 +140,8 @@
  * @param ambix The handle to an ambix file
  * @return A libsndfile handle or NULL
  */
-struct SNDFILE*ambix_get_sndfile	(ambix_t*ambix);
+typedef struct SNDFILE_tag SNDFILE;
+SNDFILE*ambix_get_sndfile	(ambix_t*ambix);


Added function traits for template magic

error: pathspec 'src/cpp/auxiliary/FunctionTraits.h' did not match any file(s) known to git

--- src/cpp/auxiliary/FunctionTraits.h
+++ src/cpp/auxiliary/FunctionTraits.h
@@ -0,0 +1,37 @@
+#ifndef FUNCTIONTRAITS_H
+#define FUNCTIONTRAITS_H
+
+#include <type_traits>
+#include <tuple>
+
+namespace Aux {
+
+// Code by kennytm (auraHT Ltd.) 2011. See
+// http://stackoverflow.com/questions/7943525/is-it-possible-to-figure-out-the-parameter-type-and-return-type-of-a-lambda
+template <typename T>
+struct FunctionTraits
+	: public FunctionTraits<decltype(&T::operator())>
+{};
+// For generic types, directly use the result of the signature of its 'operator()'
+
+template <typename ClassType, typename ReturnType, typename... Args>
+struct FunctionTraits<ReturnType(ClassType::*)(Args...) const> {
+// we specialize for pointers to member function
+	constexpr static std::size_t arity = sizeof...(Args);
+	// arity is the number of arguments.
+
+	typedef ReturnType result_type;
+
+	template <std::size_t i>
+	struct arg
+	{
+		typedef typename std::tuple_element<i, std::tuple<Args...>>::type type;
+		// the i-th argument is equivalent to the i-th tuple element of a tuple
+		// composed of those arguments.
+	};
+};
+
+
+} // namespace Aux
+
+#endif // FUNCTIONTRAITS_H


last_picture should be never == NULL (it was with dr1) this might fix a segfault with error concealment

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

--- libavcodec/mpegvideo.c
+++ libavcodec/mpegvideo.c
@@ -656,6 +656,9 @@
             s->last_picture[i] = s->next_picture[i];
             s->next_picture[i] = tmp;
             s->current_picture[i] = tmp;
+
+            if(s->last_picture[i]==NULL)
+                s->last_picture[i]= s->next_picture[i];

             s->last_dr_opaque= s->next_dr_opaque;
             s->next_dr_opaque= avctx->dr_opaque_frame;


[CFI] Remove function pointer casts

[CFI] Remove function pointer casts

Control Flow Integrity [1] indirect call checking verifies that function
pointers only call valid functions with a matching type signature. This
change eliminates some function pointer casts that I missed in my last
CL https://crrev.com/c/780144.

BUG=chromium:776905

[1] https://www.chromium.org/developers/testing/control-flow-integrity

Change-Id: I1c7adbdfffa4fe0b62e993bfb31d06e64b022d66

--- vp9/encoder/vp9_ethread.c
+++ vp9/encoder/vp9_ethread.c
@@ -390,8 +390,9 @@
 }

 #if !CONFIG_REALTIME_ONLY
-static int first_pass_worker_hook(EncWorkerData *const thread_data,
-                                  MultiThreadHandle *multi_thread_ctxt) {
+static int first_pass_worker_hook(void *arg1, void *arg2) {
+  EncWorkerData *const thread_data = (EncWorkerData *)arg1;
+  MultiThreadHandle *multi_thread_ctxt = (MultiThreadHandle *)arg2;
   VP9_COMP *const cpi = thread_data->cpi;
   const VP9_COMMON *const cm = &cpi->common;
   const int tile_cols = 1 << cm->log2_tile_cols;
@@ -470,8 +471,8 @@
     }
   }

-  launch_enc_workers(cpi, (VPxWorkerHook)first_pass_worker_hook,
-                     multi_thread_ctxt, num_workers);
+  launch_enc_workers(cpi, first_pass_worker_hook, multi_thread_ctxt,
+                     num_workers);

   first_tile_col = &cpi->tile_data[0];
   for (i = 1; i < tile_cols; i++) {
@@ -480,8 +481,9 @@
   }
 }

-static int temporal_filter_worker_hook(EncWorkerData *const thread_data,
-                                       MultiThreadHandle *multi_thread_ctxt) {
+static int temporal_filter_worker_hook(void *arg1, void *arg2) {
+  EncWorkerData *const thread_data = (EncWorkerData *)arg1;
+  MultiThreadHandle *multi_thread_ctxt = (MultiThreadHandle *)arg2;
   VP9_COMP *const cpi = thread_data->cpi;
   const VP9_COMMON *const cm = &cpi->common;
   const int tile_cols = 1 << cm->log2_tile_cols;
@@ -553,13 +555,14 @@
     }
   }

-  launch_enc_workers(cpi, (VPxWorkerHook)temporal_filter_worker_hook,
-                     multi_thread_ctxt, num_workers);
+  launch_enc_workers(cpi, temporal_filter_worker_hook, multi_thread_ctxt,
+                     num_workers);
 }
 #endif  // !CONFIG_REALTIME_ONLY

-static int enc_row_mt_worker_hook(EncWorkerData *const thread_data,
-                                  MultiThreadHandle *multi_thread_ctxt) {
+static int enc_row_mt_worker_hook(void *arg1, void *arg2) {
+  EncWorkerData *const thread_data = (EncWorkerData *)arg1;
+  MultiThreadHandle *multi_thread_ctxt = (MultiThreadHandle *)arg2;
   VP9_COMP *const cpi = thread_data->cpi;
   const VP9_COMMON *const cm = &cpi->common;
   const int tile_cols = 1 << cm->log2_tile_cols;
@@ -648,8 +651,8 @@
     }
   }

-  launch_enc_workers(cpi, (VPxWorkerHook)enc_row_mt_worker_hook,
-                     multi_thread_ctxt, num_workers);
+  launch_enc_workers(cpi, enc_row_mt_worker_hook, multi_thread_ctxt,
+                     num_workers);

   for (i = 0; i < num_workers; i++) {
     VPxWorker *const worker = &cpi->workers[i];


Move default entry point implementations to their own file.
Make them externally visible because they may be useful for filters to use.

Commited in SoC by Bobby Bingham on 2007-08-02 15:14:05

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

--- libavfilter/avfilter.h
+++ libavfilter/avfilter.h
@@ -152,9 +152,13 @@
     int (*config_props)(AVFilterLink *link);
 };

-/* the default implementations of start_frame() and end_frame() */
+/* the default implementations of filter entry points */
 void avfilter_default_start_frame(AVFilterLink *link, AVFilterPicRef *picref);
 void avfilter_default_end_frame(AVFilterLink *link);
+int avfilter_default_config_output_link(AVFilterLink *link);
+int *avfilter_default_query_output_formats(AVFilterLink *link);
+AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link,
+                                                  int perms);

 typedef struct
 {


put back in lost speedups

put back in lost speedups

speed >1 can be spead up by turning these on - lost in a prior commit

Change-Id: Iaef85e10ecfeec3aea5ab0e691edf02bb7f5190d

--- vp9/encoder/vp9_onyx_if.c
+++ vp9/encoder/vp9_onyx_if.c
@@ -760,6 +760,13 @@
   sf->static_segmentation = 0;
 #endif
       sf->mb16_breakout = 0;
+
+      if (speed > 0) {
+        sf->optimize_coefficients = 0;
+        sf->no_skip_block4x4_search = 0;
+        sf->comp_inter_joint_search = 0;
+        sf->first_step = 1;
+      }
       break;

   }; /* switch */


revert r7181
This was a stupid mistake. We already take care of time_scale
in av_set_pts_info().

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

--- libavformat/matroska.c
+++ libavformat/matroska.c
@@ -2512,7 +2512,7 @@
             }
             if (cluster_time != (uint64_t)-1 && n == 0) {
                 if (cluster_time + block_time >= 0)
-                    timecode = (cluster_time + block_time) * matroska->time_scale;
+                    timecode = cluster_time + block_time;
             }
             /* FIXME: duration */


Remove unnecessary reference count increment

--- pyinstrument/low_level/stat_profile.c
+++ pyinstrument/low_level/stat_profile.c
@@ -273,22 +273,12 @@
 static PyObject *
 call_target(ProfilerState *pState, PyFrameObject *frame, int what, PyObject *arg)
 {
-    PyObject *whatstr;
-    PyObject *result;
-
-    whatstr = whatstrings[what];
-    Py_INCREF(whatstr);
-
     PyFrame_FastToLocals(frame);
-    Py_INCREF(frame);
-
-    PyObject *callargs[4] = { NULL, (PyObject *) frame, whatstr, arg == NULL ? Py_None : arg };
-
-    result = PyObject_Vectorcall(pState->target, callargs + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
+    PyObject *callargs[4] = { NULL, (PyObject *) frame, whatstrings[what], arg == NULL ? Py_None : arg };
+    PyObject *result = PyObject_Vectorcall(pState->target, callargs + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
     PyFrame_LocalsToFast(frame, 1);
     if (result == NULL)
         PyTraceBack_Here(frame);
-

     return result;
 }


Changed errors processing.  Now uses groupname-errors.

--- simta_ldap.c
+++ simta_ldap.c
@@ -79,11 +79,6 @@
     int				lds_search_type;/* one of USER, GROUP, ALL */
     char			*lds_string;	/* uri string */
     struct ldap_search_list     *lds_next;	/* next uri */
-};
-
-struct errdat {
-    int		errnum;
-    char **     errval;
 };

 struct ldap_search_list		*ldap_searches = NULL;
@@ -200,67 +195,6 @@
 	*domain = strdup("");
     return;
 }
-    static void
-dest_errdat (struct errdat * errdat)
-{
-    int		idx;
-
-    for (idx = 0; idx < errdat->errnum; idx++) {
-        free (errdat->errval[idx]);
-    }
-    return;
-}
-    static int
-add_errdat (struct errdat * errdat, char *val)
-{
-
-    if (errdat->errnum == 0) {
-	if ((errdat->errval = malloc (sizeof (char *) * 2)) == NULL) {
-	   return (1);
-	}
-    }
-    else {
-	if ((errdat->errval = realloc (errdat->errval,
-				sizeof (char *) * (errdat->errnum + 2)))
-		 == NULL) {
-	   return (1);
-	}
-    }
-    if ((errdat->errval[errdat->errnum] = strdup (val)) == NULL) {
-	return 1;
-    }
-    errdat->errnum++;
-    errdat->errval[errdat->errnum] = NULL;
-    return (0);
-}
-
-
-/*
-** Adds an array of email addresses "errmailvals" to the current
-** error envelope.
-*/
-    static int
-add_errmailvals (struct errdat * errdat, struct exp_addr *e_addr,
-		char ** errmailvals, char * dn)
-{
-
-    int		idx;
-    char	*attrval;
-
-    for (idx = 0; errmailvals[idx]; idx++) {
-	attrval = errmailvals[ idx ];
-	if (strchr (attrval, '@') ) {
-
-	    if (add_errdat(errdat, attrval) != 0) {
-		syslog (LOG_ERR,
-	"add_errmailvals: %s failed adding error recipient: %s", dn,
-				attrval);
-		break;
-	    }
-	}
-    }
-    return (0);
-}

 /*
 ** Unbind from the directory.
@@ -359,213 +293,6 @@
 	ldap_value_free( values );
     }
     return( 0 );
-}
-
-/*
-** Expands each value in the dn array "expdnvals"
-** For each person it stuff the mailforwardingaddress into the
-** error envelopement.  For each group it stuff the rdn@associatedomain
-** into the error envelopement.
-*/
-    static int
-add_errdnvals (struct errdat *errdat, struct expand *exp,
-		struct exp_addr *e_addr, char ** expdnvals)
-{
-    int		idx;
-
-    char	*search_dn;
-    LDAPMessage *res;
-    LDAPMessage	*entry;
-
-    char	*dn;
-    char	**vals;
-    char	**ufn;
-    char	*errmailbuf;
-    int		match;
-    int		rc;
-
-    struct timeval timeout;
-
-    for (idx = 0; expdnvals[idx]; idx++) {
-
-	timeout.tv_sec = ldap_timeout;
-	timeout.tv_usec = 0;
-
-	search_dn = expdnvals[idx];
-	res = NULL;
-	rc = ldap_search_st( ld, search_dn, LDAP_SCOPE_BASE, "(objectclass=*)",
-                        attrs, 0, &timeout, &res );
-
-	if ( rc != LDAP_SUCCESS
-	&&   rc != LDAP_SIZELIMIT_EXCEEDED
-	&&   rc != LDAP_NO_SUCH_OBJECT ) {
-
-	    syslog( LOG_ERR, "add_errdnvals: ldap_search_st Failed: %s",
-                    ldap_err2string(rc ));
-	    ldap_msgfree( res );
-
-	    simta_ldap_unbind (ld);
-	    return( LDAP_SYSERROR );
-	}
-
-	match = ldap_count_entries (ld, res );
-	if (match == -1) {
-	    syslog( LOG_ERR,
-    "add_errdnvals: Error parsing result from LDAP server for dn: %s",
-                        search_dn);
-	    ldap_msgfree( res );
-	    simta_ldap_unbind (ld);
-	    return( LDAP_SYSERROR );
-	}
-	/*
-        ** If not found -- Who cares!
-        */
-	if ( match == 0 ) {
-	    ldap_msgfree( res );
-	    continue;
-	}
-
-	if (( entry = ldap_first_entry( ld, res )) == NULL ) {
-	    syslog( LOG_ERR, "add_errdnvals: ldap_first_entry: %s",
-                ldap_err2string( ldap_result2error( ld, res, 1 )));
-	    ldap_msgfree( res );
-	    return( LDAP_SYSERROR );
-	}
-
-	dn = ldap_get_dn (ld, entry );
-
-	if ( ldap_people
-	&&  (simta_ldap_value( entry, "objectClass", ldap_people ) == 1 ) ) {
-	    if (( vals = ldap_get_values( ld, entry, mailfwdattr )) != NULL ) {
-		add_errmailvals (errdat, e_addr, vals, dn);
-		ldap_value_free( vals );
-	    }
-	}
-
-	if ( ldap_groups
-	&&  (simta_ldap_value( entry, "objectClass", ldap_groups ) == 1 ) ) {
-	    /*
-	    ** add rdn@associateddomain to env_recipient list
-	    */
-	    if (( vals = ldap_get_values( ld, entry,
-					 "associateddomain" )) != NULL ) {
-
-		ufn = ldap_explode_dn( dn, 1 );
-		errmailbuf = (char *) malloc
-				(strlen(ufn[0]) + strlen (vals[0]) + 2);
-		if (! errmailbuf) {
-		    syslog (LOG_ERR,
-		"add_errdnvals: Failed allocating errmailbuf: %s", dn);
-		    ldap_memfree (dn);
-		    ldap_msgfree( res );
-		    ldap_value_free( vals );
-		    ldap_value_free( ufn );
-		    return (LDAP_SYSERROR);
-		}
-
-		sprintf (errmailbuf, "%s@%s", ufn[0], vals[0]);
-
-		ldap_value_free( vals );
-		ldap_value_free( ufn );
-		rc = add_errdat (errdat, errmailbuf);
-
-		if( rc != 0 ) {
-		    syslog (LOG_ERR,
-	"add_errdnvals: %s failed adding error recipient: %s", dn,
-				errmailbuf);
-		    free (errmailbuf);
-		    ldap_memfree (dn);
-		    ldap_msgfree( res );
-		    return (LDAP_SYSERROR);
-		}
-		free (errmailbuf);
-	    }
-	}
-	ldap_memfree (dn);
-	ldap_msgfree( res );
-    }
-    return (0);
-}
-
-    static int
-simta_group_err_env (struct expand *exp, struct exp_addr *e_addr,
-			LDAPMessage *entry, char *dn)
-{
-
-    char **vals;
-
-    int suppressnoemail = 0;
-    char ** errdnvals;
-    char ** errmailvals;
-
-    struct  errdat	errdat = {0, NULL};
-    int     idx;
-    int     rc = 0;
-
-    if ((vals = ldap_get_values( ld, entry, "suppressNoEmailError")) != NULL) {
-
-	if (strcasecmp ( vals[0], "TRUE") == 0)	{
-	    suppressnoemail = TRUE;
-	}
-	ldap_value_free (vals);
-    }
-
-    errdnvals = ldap_get_values( ld, entry, "errorsto");
-    errmailvals = ldap_get_values( ld, entry, "rfc822errorsto");
-
-    if (errdnvals || errmailvals || suppressnoemail) {
-	if (errdnvals || errmailvals) {
-
-	    if (errmailvals) {
-		add_errmailvals (&errdat, e_addr, errmailvals, dn);
-		ldap_value_free ( errmailvals );
-	    }
-	    if (errdnvals) {
-		rc = add_errdnvals (&errdat, exp, e_addr, errdnvals);
-		ldap_value_free ( errdnvals );
-	    }
-
-	    if (suppressnoemail) {
-		e_addr->e_addr_errors->e_flags = SUPPRESSNOEMAILERROR;
-	    }
-	    if (errdat.errnum != 0) {
-		if ((e_addr->e_addr_errors  = address_bounce_create( exp )) == NULL ) {
-		    syslog (LOG_ERR,
-	  	    "simta_group_err_env: failed creating error env: %s", dn);
-		    dest_errdat (&errdat);
-		    return LDAP_SYSERROR;
-		}
-
-		for (idx = 0; idx < errdat.errnum; idx++) {
-		    if (env_recipient( e_addr->e_addr_errors,
-				errdat.errval[errdat.errnum]) != 0) {
-
-			syslog (LOG_ERR,
-	  	    "simta_group_err_env: failed creating error recip: %s", dn);
-			dest_errdat (&errdat);
-			return LDAP_SYSERROR;
-		    }
-		}
-		dest_errdat (&errdat);
-	    }
-	}
-	else
-	{   /*
-	    ** Else SuppressNoEmail must be true -- clone the current envelope
-	    */
-	    e_addr->e_addr_errors = env_dup (e_addr->e_addr_errors);
-	    if ( e_addr->e_addr_errors == NULL ) {
-		 syslog (LOG_ERR,
-                	"simta_group_err_env: Failed env_dup: %s", dn);
-		rc = LDAP_SYSERROR;
-	    }
-	    else {
-	        e_addr->e_addr_errors->e_flags = SUPPRESSNOEMAILERROR;
-	    }
-	}
-    }
-
-    return (rc);
 }

     /* return a statically allocated string if all goes well, NULL if not.
@@ -994,6 +721,7 @@
     char	**rdns;
     char	*senderbuf;
     char	*psender;
+    int		suppressnoemail = 0;

     dn = ldap_get_dn( ld, entry );

@@ -1001,6 +729,13 @@
 	dn_normalize_case(dn);
 	e_addr->e_addr_dn = strdup (dn);
     }
+    if ((vals = ldap_get_values( ld, entry, "suppressNoEmailError")) != NULL) {
+	if (strcasecmp ( vals[0], "TRUE") == 0) {
+	    suppressnoemail = 1;
+        }
+	ldap_value_free (vals);
+    }
+
     simta_ldapuser (exp->exp_env->e_mail, &sender_name, &sender_domain);

     vals = ldap_get_values (ld, entry, "associateddomain");
@@ -1010,10 +745,10 @@
     if (! senderbuf ) {
 	syslog (LOG_ERR,
                 "simta_ldap_expand_group: Failed allocating senderbuf: %s", dn);
-                    ldap_memfree (dn);
-                    ldap_value_free( vals );
-                    ldap_value_free( rdns );
-                    return (LDAP_SYSERROR);
+	ldap_memfree (dn);
+	ldap_value_free( vals );
+	ldap_value_free( rdns );
+	return (LDAP_SYSERROR);
     }
     sprintf (senderbuf, "%s-errors@%s", rdns[0], vals[0]);
     for (psender = senderbuf; *psender; psender++) {
@@ -1125,7 +860,7 @@
 			if (mailvals ) {
 			    ldap_value_free(mailvals );
 			}
-
+			free (senderbuf);
 			ldap_memfree (dn);
 			return (rc);
 		    }
@@ -1137,19 +872,51 @@
 	    }
 	    ldap_value_free ( memonly );
 	}
-	/* If needed, Create a new error envelope */
-	rc = simta_group_err_env (exp, e_addr, entry, dn);
-	if (rc != 0) {
+
+	if (suppressnoemail) {
+	    e_addr->e_addr_errors->e_flags = SUPPRESSNOEMAILERROR;
+	}
+	if ((e_addr->e_addr_errors  = address_bounce_create( exp )) == NULL ) {
+	    syslog (LOG_ERR,
+                  "simta_ldap_expand_group: failed creating error env: %s", dn);
 	    if (dnvals ) {
 		ldap_value_free( dnvals);
 	    }
 	    if (mailvals ) {
 		ldap_value_free(mailvals );
 	    }
+	    free (senderbuf);
 	    ldap_memfree (dn);
+	    return LDAP_SYSERROR;
+	}
+
+	if (env_recipient( e_addr->e_addr_errors, senderbuf) != 0) {
+       	    syslog (LOG_ERR,
+               "simta_ldap_expand_group: failed setting error recip: %s", dn);
+	    if (dnvals ) {
+		ldap_value_free( dnvals);
+	    }
+	    if (mailvals ) {
+		ldap_value_free(mailvals );
+	    }
 	    free (senderbuf);
-	    return (rc);
-	}
+	    ldap_memfree (dn);
+	    return LDAP_SYSERROR;
+	}
+	if (env_sender ( e_addr->e_addr_errors, "<>") != 0) {
+       	    syslog (LOG_ERR,
+               "simta_ldap_expand_group: failed setting error sender: %s", dn);
+	    if (dnvals ) {
+		ldap_value_free( dnvals);
+	    }
+	    if (mailvals ) {
+		ldap_value_free(mailvals );
+	    }
+	    free (senderbuf);
+	    ldap_memfree (dn);
+	    return LDAP_SYSERROR;
+	}
+

 	break;
     }   /* end of switch */
@@ -1163,11 +930,14 @@
 		if ( add_address( exp, ndn, e_addr->e_addr_errors,
 			ADDRESS_TYPE_LDAP, e_addr->e_addr_from ) != 0 ) {
 		    syslog (LOG_ERR,
-			"simta_ldap_expand_group: %s failed adding: %s", dn,
-			dnvals[ idx ]);
+			"simta_ldap_expand_group: %s failed adding: NULL", dn);
 		    break;
 		}
 	    } else {
+		/* If sending to group members
+		** -- change from address to be: group-errors@associateddomaon
+		** -- otherwise use the original sender.
+		*/
 		if ((type == LDS_GROUP_MEMBERS ) || (type == LDS_USER )) {
 		    rc =  add_address( exp, ndn, e_addr->e_addr_errors,
 				ADDRESS_TYPE_LDAP, senderbuf );
@@ -1182,7 +952,6 @@
 		    break;
 		}
 	    }
-
 	}
 	ldap_value_free( dnvals);
     }


Don’t create duplicate labels, don’t even involve the PROGRAM_START, and properly calculate relative branches

git-svn-id: dd14d189f2554b0b3f4c2209a95c13d2029e3fe8@457 96dfbd92-d197-e211-9ca9-00110a534b34

--- dis6502/main.c
+++ dis6502/main.c
@@ -62,10 +62,12 @@
 					address = (blob->data[offset + 2] << 8 | blob->data[offset + 1]);
 				}
 				else {
-					address = 0x600 + offset + blob->data[offset + 1];
+						address = offset + 2 + v6502_signedValueOfByte(blob->data[offset + 1]);
 				}

-				as6502_addSymbolToTable(table, currentLineNum, symbolName, address, as6502_symbol_type_label);
+				if (!as6502_symbolForAddress(table, address)) {
+					as6502_addSymbolToTable(table, currentLineNum, symbolName, address, as6502_symbol_type_label);
+				}
 			}
 			currentLineNum++;
 		}
@@ -73,13 +75,13 @@
 		// Disassemble
 		currentLineNum = 0;
 		for (uint8_t offset = 0; offset < blob->len; offset += v6502_instructionLengthForOpcode(blob->data[offset])) {
-			as6502_symbol *label = as6502_symbolForAddress(table, offset - 0x600);
+			as6502_symbol *label = as6502_symbolForAddress(table, offset);
 			if (label) {
 				fprintf(out, "%s:\n", label->name);
 			}

 			as6502_stringForInstruction(line, MAX_LINE_LEN, blob->data[offset], blob->data[offset + 2], blob->data[offset + 1]);
-			fprintf(out, "%s\n", line);
+			fprintf(out, "\t%s\n", line);
 			currentLineNum++;
 		}
 	}


added a helper class to create a value description that forwards to a base class's version

--- types/value_description.h
+++ types/value_description.h
@@ -958,6 +958,100 @@
 };

+/*****************************************************************************/
+/* DESCRIPTION FROM BASE                                                     */
+/*****************************************************************************/
+
+/** This class is used for when you want to create a value description for
+    a class that derives from a base class that provides most or all of its
+    functionality (eg, a vector).  It forwards all of the methods to the
+    base value description.
+*/
+
+template<typename T, typename Base,
+         typename BaseDescription = typename std::remove_reference<decltype(*getDefaultDescription((Base*)0))>::type>
+struct DescriptionFromBase
+    : public ValueDescriptionT<T> {
+
+    DescriptionFromBase(BaseDescription * inner
+                      = getDefaultDescription((Base *)0))
+        : inner(inner)
+    {
+    }
+
+    std::unique_ptr<BaseDescription> inner;
+
+    constexpr ssize_t offset() const
+    {
+        return (ssize_t)(static_cast<Base *>((T *)0));
+    }
+
+    void * fixPtr(void * ptr) const
+    {
+        return addOffset(ptr, offset());
+    }
+
+    const void * fixPtr(const void * ptr) const
+    {
+        return addOffset(ptr, offset());
+    }
+
+    virtual void parseJson(void * val, JsonParsingContext & context) const
+    {
+        inner->parseJson(fixPtr(val), context);
+    }
+
+    virtual void parseJsonTyped(T * val, JsonParsingContext & context) const
+    {
+        inner->parseJson(fixPtr(val), context);
+    }
+
+    virtual void printJson(const void * val, JsonPrintingContext & context) const
+    {
+        inner->printJson(fixPtr(val), context);
+    }
+
+    virtual void printJsonTyped(const T * val, JsonPrintingContext & context) const
+    {
+        inner->printJson(fixPtr(val), context);
+    }
+
+    virtual bool isDefault(const void * val) const
+    {
+        return inner->isDefault(fixPtr(val));
+    }
+
+    virtual bool isDefaultTyped(const T * val) const
+    {
+        return inner->isDefault(fixPtr(val));
+    }
+
+    virtual size_t getArrayLength(void * val) const
+    {
+        return inner->getArrayLength(fixPtr(val));
+    }
+
+    virtual void * getArrayElement(void * val, uint32_t element) const
+    {
+        return inner->getArrayElement(fixPtr(val), element);
+    }
+
+    virtual const void * getArrayElement(const void * val, uint32_t element) const
+    {
+        return inner->getArrayElement(fixPtr(val), element);
+    }
+
+    virtual void setArrayLength(void * val, size_t newLength) const
+    {
+        inner->setArrayLength(fixPtr(val), newLength);
+    }
+
+    virtual const ValueDescription & contained() const
+    {
+        return inner->contained();
+    }
+};
+

 /*****************************************************************************/
 /* CONVERSION FUNCTIONS                                                      */


pass index instead of struct zip_entry

pass index instead of struct zip_entry

--- lib/zip_file_get_offset.c
+++ lib/zip_file_get_offset.c
@@ -1,5 +1,5 @@
 /*
-  $NiH$
+  $NiH: zip_file_get_offset.c,v 1.1.2.1 2004/03/23 17:14:49 dillo Exp $

   zip_file_get_offset.c -- get offset of file data in archive.
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -57,12 +57,14 @@
 */

 unsigned int
-_zip_file_get_offset(struct zip *za, struct zip_entry *ze)
+_zip_file_get_offset(struct zip *za, int idx)
 {
     struct zip_dirent de;
     unsigned int offset;

-    if (fseek(za->zp, ze->offset, SEEK_SET) != 0) {
+    offset = za->cdir->entry[idx].offset;
+
+    if (fseek(za->zp, offset, SEEK_SET) != 0) {
 	_zip_error_set(&za->error, ZERR_SEEK, errno);
 	return 0;
     }
@@ -70,8 +72,7 @@
     if (_zip_dirent_read(&de, za->zp, NULL, 0, 1, &za->error) != 0)
 	return 0;

-    offset = ze->offset + LENTRYSIZE
-	+ de.filename_len + de.extrafield_len;
+    offset += LENTRYSIZE + de.filename_len + de.extrafield_len;

     _zip_dirent_finalize(&de);


screencopy-v1: use wlr_renderer_begin_with_buffer

--- types/wlr_screencopy_v1.c
+++ types/wlr_screencopy_v1.c
@@ -9,7 +9,6 @@
 #include <wlr/backend.h>
 #include <wlr/util/log.h>
 #include "wlr-screencopy-unstable-v1-protocol.h"
-#include "render/wlr_renderer.h"
 #include "render/pixel_format.h"
 #include "util/signal.h"

@@ -273,26 +272,24 @@
 		goto error_src_tex;
 	}

-	if (!wlr_renderer_bind_buffer(renderer, dst_buffer)) {
-		goto error_bind_buffer;
-	}
-
 	float mat[9];
 	wlr_matrix_identity(mat);
 	wlr_matrix_scale(mat, dst_buffer->width, dst_buffer->height);

-	wlr_renderer_begin(renderer, dst_buffer->width, dst_buffer->height);
+	if (!wlr_renderer_begin_with_buffer(renderer, dst_buffer)) {
+		goto error_renderer_begin;
+	}
+
 	wlr_renderer_clear(renderer, (float[]){ 0.0, 0.0, 0.0, 0.0 });
 	wlr_render_texture_with_matrix(renderer, src_tex, mat, 1.0f);
+
 	wlr_renderer_end(renderer);
-
-	wlr_renderer_bind_buffer(renderer, NULL);

 	wlr_texture_destroy(src_tex);
 	wlr_buffer_unlock(dst_buffer);
 	return true;

-error_bind_buffer:
+error_renderer_begin:
 	wlr_texture_destroy(src_tex);
 error_src_tex:
 	wlr_buffer_unlock(dst_buffer);


Apply integer overflow security fix for "CERT Advisory CA-2002-25 Integer Overflow In XDR Library" http://www.cert.org/advisories/CA-2002-25.html Patch from Solar Designer <solar@openwall.com>.

--- libc/inet/rpc/xdr_array.c
+++ libc/inet/rpc/xdr_array.c
@@ -48,6 +48,7 @@
 #include <string.h>
 #include <rpc/types.h>
 #include <rpc/xdr.h>
+#include <limits.h>

 #ifdef USE_IN_LIBIO
 # include <wchar.h>
@@ -84,7 +85,11 @@
       return FALSE;
     }
   c = *sizep;
-  if ((c > maxsize) && (xdrs->x_op != XDR_FREE))
+  /*
+   * XXX: Let the overflow possibly happen with XDR_FREE because mem_free()
+   * doesn't actually use its second argument anyway.
+   */
+  if ((c > maxsize || c > UINT_MAX / elsize) && (xdrs->x_op != XDR_FREE))
     {
       return FALSE;
     }


Don't actually iterate next_id until the order definitely succeeds

--- disorderBook.c
+++ disorderBook.c
@@ -1119,16 +1119,14 @@
     int id;
     ACCOUNT * accountobject;

-    id = next_id(0);
-
     // The o_and_e structure lets us send either an order or an error to the caller...

     o_and_e = init_o_and_e();

     // Check for too high an order ID, too high an account ID, or silly values...

-    if (id >= MAXORDERS)
-    {
+    if (next_id(1) >= MAXORDERS)                // Pass the no-iterate flag to next_id() here
+    {                                           // i.e. don't iterate until we know order succeeds
         o_and_e->error = TOO_MANY_ORDERS;
         return o_and_e;

@@ -1150,6 +1148,7 @@

     // Create order struct, and store a pointer to it in the account...

+    id = next_id(0);
     order = init_order(accountobject, qty, price, direction, orderType, id);
     add_order_to_account(order, accountobject);

@@ -1596,8 +1595,8 @@

             if (o_and_e->error)
             {
-                printf("{\"ok\": false, \"error\": \"Backend error %d (account_int = %d, qty = %d, price = %d, direction = %d, orderType = %d\"}",
-                    o_and_e->error, atoi(tokens[2]), atoi(tokens[3]), atoi(tokens[4]), atoi(tokens[5]), atoi(tokens[6]));
+                printf("{\"ok\": false, \"error\": \"Backend error %d (account = %s, account_int = %d, qty = %d, price = %d, direction = %d, orderType = %d)\"}",
+                    o_and_e->error, tokens[1], atoi(tokens[2]), atoi(tokens[3]), atoi(tokens[4]), atoi(tokens[5]), atoi(tokens[6]));
             } else {
                 print_order(stdout, o_and_e->order);
             }


blah, enable the stupid hidden proto for fcntl

--- libc/misc/syslog/syslog.c
+++ libc/misc/syslog/syslog.c
@@ -91,7 +91,7 @@
 libc_hidden_proto(strlen)
 libc_hidden_proto(strncpy)
 libc_hidden_proto(open)
-/*libc_hidden_proto(fcntl)*/
+libc_hidden_proto(fcntl)
 libc_hidden_proto(socket)
 libc_hidden_proto(close)
 libc_hidden_proto(write)


Extends test coverage

Extends test coverage

--- libchula/test/util_test.c
+++ libchula/test/util_test.c
@@ -518,6 +518,84 @@
 }
 END_TEST

+START_TEST (path_short)
+{
+    ret_t          ret;
+    chula_buffer_t path = CHULA_BUF_INIT;
+
+    ret = chula_path_short (&path);
+    ck_assert (ret == ret_ok);
+    ck_assert (path.len == 0);
+
+    chula_buffer_clean (&path);
+    chula_buffer_add_str (&path, "/../");
+    ret = chula_path_short (&path);
+    ck_assert (ret == ret_ok);
+    ck_assert_str_eq (path.buf, "/");
+
+    chula_buffer_clean (&path);
+    chula_buffer_add_str (&path, "/dir/second/../file");
+    ret = chula_path_short (&path);
+    ck_assert (ret == ret_ok);
+    ck_assert_str_eq (path.buf, "/dir/file");
+
+    chula_buffer_clean (&path);
+    chula_buffer_add_str (&path, "/in/../1/2/../../a/b/c/../../d");
+    ret = chula_path_short (&path);
+    ck_assert (ret == ret_ok);
+    ck_assert_str_eq (path.buf, "/a/d");
+
+    chula_buffer_mrproper (&path);
+}
+END_TEST
+
+START_TEST (find_exec)
+{
+    ret_t          ret;
+    chula_buffer_t path = CHULA_BUF_INIT;
+
+    ret = chula_path_find_exec ("find", &path);
+    ck_assert (ret == ret_ok);
+    ck_assert (strstr(path.buf, "find") != NULL);
+
+    chula_buffer_clean (&path);
+    ret = chula_path_find_exec ("it_does_not_exist", &path);
+    ck_assert (ret == ret_not_found);
+
+    chula_buffer_mrproper (&path);
+}
+END_TEST
+
+START_TEST (_gethostbyname)
+{
+    ret_t            ret;
+    chula_buffer_t   host = CHULA_BUF_INIT;
+    struct addrinfo *addr = NULL;
+
+    ret = chula_gethostbyname (&host, &addr);
+    ck_assert (ret == ret_error);
+
+    chula_buffer_add_str (&host, "example.com");
+    ret = chula_gethostbyname (&host, &addr);
+    ck_assert (ret == ret_ok);
+    ck_assert (addr->ai_family == 2);
+
+    chula_buffer_mrproper (&host);
+}
+END_TEST
+
+START_TEST (_gethostname)
+{
+    ret_t          ret;
+    chula_buffer_t name = CHULA_BUF_INIT;
+
+    ret = chula_gethostname (&name);
+    ck_assert (ret == ret_ok);
+    ck_assert (! chula_buffer_is_empty (&name));
+}
+END_TEST
+
+

 int
 util_tests (void)
@@ -549,5 +627,9 @@
     check_add (s1, _gmtime);
     check_add (s1, _localtime);
     check_add (s1, _timezone);
+    check_add (s1, path_short);
+    check_add (s1, find_exec);
+    check_add (s1, _gethostbyname);
+    check_add (s1, _gethostname);
     run_test (s1);
 }


Remove private headers from global public header

--- StateMachine/StateMachine.h
+++ StateMachine/StateMachine.h
@@ -2,7 +2,5 @@
 #define StateMachine_StateMachine_h

 #import "LSStateMachine.h"
-#import "LSEvent.h"
-#import "LSTransition.h"
 #import "LSStateMachineMacros.h"
 #endif