Disabling the CTRL+a shortcut for "Save _As..."

--- src/editor.c
+++ src/editor.c
@@ -51,8 +51,7 @@
 	{ "_Open", G_CALLBACK(on_file_open), GTK_STOCK_OPEN, GDK_O },
 	{ "", NULL, NULL, 0 },
 	{ "_Save", G_CALLBACK(on_file_save), GTK_STOCK_SAVE, GDK_S },
-	{ "_Save as...", G_CALLBACK(on_file_save_as), GTK_STOCK_SAVE_AS,
-		GDK_A },
+	{ "_Save as...", G_CALLBACK(on_file_save_as), GTK_STOCK_SAVE_AS, 0 },
 	{ "", NULL, NULL, 0 },
 	{ "_Close", G_CALLBACK(on_file_close), GTK_STOCK_CLOSE, 0 },
 	{ NULL, NULL, NULL, 0 }


Darwin: Fix #117 transfer size 64/32 bit issue for transfer callbacks

The transfer size is now always truncated to 32 bits.

--- libusb/os/darwin_usb.c
+++ libusb/os/darwin_usb.c
@@ -1524,16 +1524,18 @@
   struct usbi_transfer *itransfer = (struct usbi_transfer *)refcon;
   struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
   struct darwin_device_handle_priv *priv = (struct darwin_device_handle_priv *)transfer->dev_handle->os_priv;
-  UInt32 message;
+  UInt32 message, size;

   usbi_info (ITRANSFER_CTX (itransfer), "an async io operation has completed");
+
+  size = (UInt32) arg0;

   /* send a completion message to the device's file descriptor */
   message = MESSAGE_ASYNC_IO_COMPLETE;
   write (priv->fds[1], &message, sizeof (message));
   write (priv->fds[1], &itransfer, sizeof (itransfer));
   write (priv->fds[1], &result, sizeof (IOReturn));
-  write (priv->fds[1], &arg0, sizeof (UInt32));
+  write (priv->fds[1], &size, sizeof (size));
 }

 static int darwin_transfer_status (struct usbi_transfer *itransfer, kern_return_t result) {


fixes set_stacksize

fixes set_stacksize

--- libvips/iofuncs/init.c
+++ libvips/iofuncs/init.c
@@ -293,12 +293,16 @@
 	vips_min_stack_size = VIPS_MAX( default_min_stack_size,
 		vips__parse_size( pstacksize_str ) );

-	if( cur_stack_size < vips_min_stack_size ||
-		pthread_attr_setstacksize( &attr, vips_min_stack_size ) ||
-		pthread_setattr_default_np( &attr ) )
-		g_warning( _( "could not set minimum pthread stack "
-			"size of %s, current size is %dk" ),
-			pstacksize_str, (int) (cur_stack_size / 1024.0) );
+	if( cur_stack_size < vips_min_stack_size) {
+		if (pthread_attr_setstacksize( &attr, vips_min_stack_size ) ||
+		    pthread_setattr_default_np( &attr ) ) {
+			g_warning( _( "could not set minimum pthread stack "
+				"size of %s, current size is %dk" ),
+				pstacksize_str, (int) (cur_stack_size / 1024.0) );
+		}
+	}
+	pthread_attr_getstacksize( &attr, &cur_stack_size );
+	g_info("current stack size is set to %lu", cur_stack_size);
 #endif /*HAVE_PTHREAD_DEFAULT_NP*/
 }


sbefifo: fix sbefifo_register_get with multiple registers

sbefifo_register_get_pull is not indexing the result buffer correctly
for > 1 returned register.

Signed-off-by: Nicholas Piggin <24829078df5003d9dd1dd871ca2aeb0b1cf95ef4@gmail.com>
Reviewed-by: Joel Stanley <4816dabf8db1bc6cac35b3a24cab2ff844b5b0c7@jms.id.au>
Reviewed-by: Amitay Isaacs <a505e7c038746dbeb3edcd8d146dbd515432801f@ozlabs.org>

--- libsbefifo/cmd_register.c
+++ libsbefifo/cmd_register.c
@@ -57,6 +57,7 @@
 static int sbefifo_register_get_pull(uint8_t *buf, uint32_t buflen, uint8_t reg_count, uint64_t **value)
 {
 	uint32_t i;
+	uint32_t *b = (uint32_t *)buf;

 	if (buflen != reg_count * 8)
 		return EPROTO;
@@ -68,8 +69,8 @@
 	for (i=0; i<reg_count; i++) {
 		uint32_t val1, val2;

-		val1 = be32toh(*(uint32_t *) &buf[i*4]);
-		val2 = be32toh(*(uint32_t *) &buf[i*4+4]);
+		val1 = be32toh(b[i*2]);
+		val2 = be32toh(b[i*2+1]);

 		(*value)[i] = ((uint64_t)val1 << 32) | (uint64_t)val2;
 	}


Add getters in Node

Add getters in Node

--- libspaghetti/nodes/node.h
+++ libspaghetti/nodes/node.h
@@ -40,6 +40,8 @@

 class SPAGHETTI_API Node : public QGraphicsItem {
  public:
+  using Sockets = QVector<SocketItem *>;
+
   explicit Node(QGraphicsItem *a_parent = nullptr);
   ~Node() override;

@@ -57,12 +59,22 @@
   void setPackageView(PackageView *const a_packageView) { m_packageView = a_packageView; }

   void setElement(elements::Element *const a_element);
+
   void setName(QString a_name) { m_name = a_name; }
+  QString name() const { return m_name; }
+
   void setPath(QString a_path) { m_path = a_path; }
+  QString path() const { return m_path; }
+
   void setIcon(QString a_icon);
+  QPixmap icon() const { return m_icon; }
+  QString iconPath() const { return m_iconPath; }

   void iconify();
   void expand();
+
+  Sockets const &inputs() const { return m_inputs; }
+  Sockets const &outputs() const { return m_outputs; }

  private:
   void addSocket(SocketType const a_type, uint8_t const a_id, QString const a_name, ValueType const a_valueType);
@@ -73,12 +85,12 @@
   Type m_type{};
   QString m_name{};
   QString m_path{};
+  QString m_iconPath{};
   QPixmap m_icon{};
   QRectF m_boundingRect{};
   elements::Element *m_element{};
   PackageView *m_packageView{};

-  using Sockets = QVector<SocketItem *>;
   Sockets m_inputs{};
   Sockets m_outputs{};
 };


libstb/create-container: avoid using deprecated APIs when compiling with OpenSSL 3.0

OpenSSL 3.0 has deprecated functions that operate on raw key data, however the
closest replacement function are not available in OpenSSL 1.x. This patch
attempts to maintain compatibility with both 3.0 and 1.x versions.

Avoids using the following deprecated functions when compiling with 3.0:
 - EC_KEY_get0_group
 - EC_KEY_get0_public_key
 - EC_POINT_point2bn
 - EC_KEY_free

Signed-off-by: Eric Richter <1231eba1c884d483f37f1ec746d19a1008480910@linux.ibm.com>
Signed-off-by: Reza Arbab <4c896a97e6b998365c2d50a267b0f1ca5f7995de@linux.ibm.com>

--- libstb/create-container.c
+++ libstb/create-container.c
@@ -11,6 +11,9 @@
 #include <openssl/ec.h>
 #include <openssl/ecdsa.h>
 #include <openssl/evp.h>
+#if OPENSSL_VERSION_NUMBER >= 0x30000000
+#include <openssl/core_names.h>
+#endif
 #include <openssl/opensslv.h>
 #include <openssl/ossl_typ.h>
 #include <openssl/pem.h>
@@ -45,7 +48,7 @@
 void getPublicKeyRaw(ecc_key_t *pubkeyraw, char *filename)
 {
 	EVP_PKEY* pkey;
-	unsigned char pubkeyData[1 + 2 * EC_COORDBYTES];
+	unsigned char pubkeyData[1 + 2 * EC_COORDBYTES] = {0};

 	FILE *fp = fopen(filename, "r");
 	if (!fp)
@@ -64,6 +67,10 @@
 	}

 	if (pkey) {
+#if OPENSSL_VERSION_NUMBER >= 0x30000000
+		size_t sz;
+		EVP_PKEY_get_octet_string_param(pkey, OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY, pubkeyData, sizeof(pubkeyData), &sz);
+#else
 		EC_KEY *key;
 		const EC_GROUP *ecgrp;
 		const EC_POINT *ecpoint;
@@ -87,6 +94,7 @@

 		BN_free(pubkeyBN);
 		EC_KEY_free(key);
+#endif
 		EVP_PKEY_free(pkey);
 	}
 	else {


external actions, don't trigger execution of resource requests.

Only iterating does.

--- libswfdec/swfdec_player.c
+++ libswfdec/swfdec_player.c
@@ -515,8 +515,6 @@

   player->external_timeout.callback = NULL;
   swfdec_player_perform_external_actions (player);
-  swfdec_player_resource_request_perform (player);
-  swfdec_player_perform_actions (player);
 }

 void


McdAccountManager: creation: factor out property-setting function

--- src/mcd-account-manager-creation.c
+++ src/mcd-account-manager-creation.c
@@ -56,6 +56,42 @@
     g_slice_free (McdCreationData, cd);
 }

+static gboolean
+set_new_account_properties (McdAccount *account,
+                            GHashTable *properties,
+                            GError **error)
+{
+    GHashTableIter iter;
+    gpointer key, value;
+    gboolean ok = TRUE;
+
+    g_hash_table_iter_init (&iter, properties);
+
+    while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+        gchar *name = key;
+        gchar *dot, *iface, *pname;
+
+        if ((dot = strrchr (name, '.')) != NULL)
+        {
+            iface = g_strndup (name, dot - name);
+            pname = dot + 1;
+            mcd_dbusprop_set_property (TP_SVC_DBUS_PROPERTIES (account),
+                                      iface, pname, value, error);
+            g_free (iface);
+        }
+        else
+        {
+            g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+                         "Malformed property name: %s", name);
+            ok = FALSE;
+            break;
+        }
+    }
+
+    return ok;
+}
+
 static void
 create_account_with_properties_cb (McdAccountManager *account_manager,
                                    McdAccount *account,
@@ -64,9 +100,6 @@
 {
     McdCreationData *cd = user_data;
     const gchar *object_path;
-    GHashTableIter iter;
-    gchar *name;
-    GValue *value;
     GError *err = NULL;

     if (G_UNLIKELY (error))
@@ -77,31 +110,13 @@

     g_return_if_fail (MCD_IS_ACCOUNT (account));

-    g_hash_table_iter_init (&iter, cd->properties);
-    while (g_hash_table_iter_next (&iter, (gpointer)&name, (gpointer)&value) &&
-           err == NULL)
-    {
-        gchar *dot, *iface, *pname;
-
-        if ((dot = strrchr (name, '.')) != NULL)
-        {
-            iface = g_strndup (name, dot - name);
-            pname = dot + 1;
-            mcd_dbusprop_set_property (TP_SVC_DBUS_PROPERTIES (account),
-                                       iface, pname, value, &err);
-            g_free (iface);
-        }
-        else
-            err = g_error_new (TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
-                               "Unrecognized property: %s", name);
-    }
-
-    if (err)
+    if (!set_new_account_properties (account, cd->properties, &err))
     {
         dbus_g_method_return_error (cd->context, err);
         g_error_free (err);
-	return;
+        return;
     }
+
     object_path = mcd_account_get_object_path (account);
     mc_svc_account_manager_interface_creation_return_from_create_account
         (cd->context, object_path);


fix external actions

fix external actions

1) run perform_actions after external actions
2) don't clear the timeout after calling the actions, clear it before

--- libswfdec/swfdec_player.c
+++ libswfdec/swfdec_player.c
@@ -176,7 +176,8 @@
   g_return_if_fail (timeout->timestamp > player->time);
   g_return_if_fail (timeout->callback != NULL);

-  SWFDEC_LOG ("adding timeout %p", timeout);
+  SWFDEC_LOG ("adding timeout %p in %"G_GUINT64_FORMAT" msecs", timeout,
+      SWFDEC_TICKS_TO_MSECS (timeout->timestamp - player->time));
   next_tick = swfdec_player_get_next_event_time (player);
   /* the order is important, on events with the same time, we make sure the new one is last */
   for (walk = player->timeouts; walk; walk = walk->next) {
@@ -320,6 +321,12 @@
 {
   SwfdecPlayerAction *action;
   guint i;
+
+  /* remove timeout if it exists - do this before executing stuff below */
+  if (player->external_timeout.callback) {
+    swfdec_player_remove_timeout (player, &player->external_timeout);
+    player->external_timeout.callback = NULL;
+  }

   /* we need to query the number of current actions so newly added ones aren't
    * executed in here */
@@ -332,10 +339,7 @@
     action->func (action->object, action->data);
   }

-  if (player->external_timeout.callback) {
-    swfdec_player_remove_timeout (player, &player->external_timeout);
-    player->external_timeout.callback = NULL;
-  }
+  swfdec_player_perform_actions (player);
 }

 static void
@@ -916,6 +920,7 @@
   SwfdecPlayer *player = SWFDEC_PLAYER ((guint8 *) timeout - G_STRUCT_OFFSET (SwfdecPlayer, iterate_timeout));
   GList *walk;

+  swfdec_player_perform_external_actions (player);
   SWFDEC_INFO ("=== START ITERATION ===");
   /* start the iteration. This performs a goto next frame on all
    * movies that are not stopped. It also queues onEnterFrame.
@@ -953,8 +958,6 @@
   guint frames_now;

   swfdec_player_lock (player);
-  swfdec_player_perform_external_actions (player);
-  swfdec_player_perform_actions (player);
   target_time = player->time + SWFDEC_MSECS_TO_TICKS (msecs);
   SWFDEC_DEBUG ("advancing %u msecs (%u audio frames)", msecs, audio_samples);

@@ -1532,7 +1535,6 @@
   g_object_ref (loader);
   swfdec_player_add_level_from_loader (player, 0, loader, variables);
   swfdec_player_perform_external_actions (player);
-  swfdec_player_perform_actions (player);
   swfdec_player_unlock (player);
 }


Add a hack to allow adding actions that get executed "no matter what"

--- libswfdec/swfdec_player.c
+++ libswfdec/swfdec_player.c
@@ -358,6 +358,7 @@

   swfdec_js_finish_player (player);

+  swfdec_player_remove_all_actions (player, player); /* HACK to allow non-removable actions */
   g_assert (swfdec_ring_buffer_pop (player->actions) == NULL);
   swfdec_ring_buffer_free (player->actions);
   g_assert (player->movies == NULL);


automatically use the super buffer during script dfinition.

This is step 3 in the script rework and should make protected files work.

--- libswfdec/swfdec_script.c
+++ libswfdec/swfdec_script.c
@@ -235,6 +235,7 @@
 swfdec_script_new_from_bits (SwfdecBits *bits, const char *name, guint version)
 {
   SwfdecScript *script;
+  SwfdecBuffer *buffer;
   SwfdecBits org;
   guint len;

@@ -263,12 +264,14 @@
   }
   len -= swfdec_bits_left (bits) / 8;
   if (len == 0) {
-    script->buffer = swfdec_buffer_new ();
+    buffer = swfdec_buffer_new ();
   } else {
-    script->buffer = swfdec_bits_get_buffer (&org, len);
-  }
-  script->main = script->buffer->data;
-  script->exit = script->buffer->data + script->buffer->length;
+    buffer = swfdec_bits_get_buffer (&org, len);
+  }
+  script->main = buffer->data;
+  script->exit = buffer->data + buffer->length;
+  script->buffer = swfdec_buffer_ref (swfdec_buffer_get_super (buffer));
+  swfdec_buffer_unref (buffer);
   return script;
 }


s/swfdec_action_to_number/swfdec_value_to_number/

--- libswfdec/swfdec_script.c
+++ libswfdec/swfdec_script.c
@@ -155,7 +155,7 @@
 }

 static double
-swfdec_action_to_number (JSContext *cx, jsval val)
+swfdec_value_to_number (JSContext *cx, jsval val)
 {
   if (JSVAL_IS_INT (val)) {
     return JSVAL_TO_INT (val);
@@ -300,7 +300,7 @@
     frame = swfdec_sprite_get_frame (SWFDEC_SPRITE_MOVIE (movie)->sprite, name);
   } else {
     /* FIXME: how do we treat undefined etc? */
-    frame = swfdec_action_to_number (cx, val);
+    frame = swfdec_value_to_number (cx, val);
   }
   return frame;
 }
@@ -824,8 +824,8 @@
   rval = cx->fp->sp[-1];
   lval = cx->fp->sp[-2];
   if (((SwfdecScript *) cx->fp->swf)->version < 7) {
-    l = swfdec_action_to_number (cx, lval);
-    r = swfdec_action_to_number (cx, rval);
+    l = swfdec_value_to_number (cx, lval);
+    r = swfdec_value_to_number (cx, rval);
   } else {
     if (!swfdec_value_to_number_7 (cx, lval, &l) ||
         !swfdec_value_to_number_7 (cx, rval, &r))
@@ -901,8 +901,8 @@
     cx->fp->sp[-1] = STRING_TO_JSVAL (str);
   } else {
     double d, d2;
-    d = swfdec_action_to_number (cx, lval);
-    d2 = swfdec_action_to_number (cx, rval);
+    d = swfdec_value_to_number (cx, lval);
+    d2 = swfdec_value_to_number (cx, rval);
     d += d2;
     cx->fp->sp--;
     return JS_NewNumberValue(cx, d, &cx->fp->sp[-1]);
@@ -991,8 +991,8 @@
   rval = cx->fp->sp[-1];
   lval = cx->fp->sp[-2];
   cx->fp->sp--;
-  d = swfdec_action_to_number (cx, lval);
-  d2 = swfdec_action_to_number (cx, rval);
+  d = swfdec_value_to_number (cx, lval);
+  d2 = swfdec_value_to_number (cx, rval);
   if (action == 0x48)
     cx->fp->sp[-1] = BOOLEAN_TO_JSVAL (d < d2);
   else
@@ -1028,7 +1028,7 @@
 {
   double d;

-  d = swfdec_action_to_number (cx, cx->fp->sp[-1]);
+  d = swfdec_value_to_number (cx, cx->fp->sp[-1]);
   cx->fp->sp[-1] = INT_TO_JSVAL (d == 0 ? 1 : 0);
   return JS_TRUE;
 }
@@ -1038,7 +1038,7 @@
 {
   double d;

-  d = swfdec_action_to_number (cx, cx->fp->sp[-1]);
+  d = swfdec_value_to_number (cx, cx->fp->sp[-1]);
   cx->fp->sp[-1] = d == 0 ? JSVAL_TRUE : JSVAL_FALSE;
   return JS_TRUE;
 }
@@ -1063,7 +1063,7 @@
     SWFDEC_ERROR ("Jump action length invalid (is %u, should be 2", len);
     return JS_FALSE;
   }
-  d = swfdec_action_to_number (cx, cx->fp->sp[-1]);
+  d = swfdec_value_to_number (cx, cx->fp->sp[-1]);
   cx->fp->sp--;
   if (d != 0)
     cx->fp->pc += 5 + GINT16_FROM_LE (*((gint16*) data));
@@ -1075,7 +1075,7 @@
 {
   double d;

-  d = swfdec_action_to_number (cx, cx->fp->sp[-1]);
+  d = swfdec_value_to_number (cx, cx->fp->sp[-1]);
   d--;
   return JS_NewNumberValue (cx, d, &cx->fp->sp[-1]);
 }
@@ -1085,7 +1085,7 @@
 {
   double d;

-  d = swfdec_action_to_number (cx, cx->fp->sp[-1]);
+  d = swfdec_value_to_number (cx, cx->fp->sp[-1]);
   d++;
   return JS_NewNumberValue (cx, d, &cx->fp->sp[-1]);
 }
@@ -1199,8 +1199,8 @@

   rval = cx->fp->sp[-1];
   lval = cx->fp->sp[-2];
-  l = swfdec_action_to_number (cx, lval);
-  r = swfdec_action_to_number (cx, rval);
+  l = swfdec_value_to_number (cx, lval);
+  r = swfdec_value_to_number (cx, rval);
   switch (action) {
     case 0x0e:
       cond = l == r;
@@ -1340,7 +1340,7 @@
     return JS_FALSE;
   if (!swfdec_eval_jsval (cx, NULL, &fp->sp[-1]))
     return JS_FALSE;
-  if (swfdec_action_to_number (cx, fp->sp[-3])) {
+  if (swfdec_value_to_number (cx, fp->sp[-3])) {
     jsval tmp;
     if (stack_size < 7)
       return JS_FALSE;
@@ -1683,7 +1683,7 @@
 static JSBool
 swfdec_action_to_integer (JSContext *cx, guint action, const guint8 *data, guint len)
 {
-  double d = swfdec_action_to_number (cx, cx->fp->sp[-1]);
+  double d = swfdec_value_to_number (cx, cx->fp->sp[-1]);

   return JS_NewNumberValue (cx, (int) d, &cx->fp->sp[-1]);
 }
@@ -1782,8 +1782,8 @@
 {
   double x, y;

-  x = swfdec_action_to_number (cx, cx->fp->sp[-1]);
-  y = swfdec_action_to_number (cx, cx->fp->sp[-2]);
+  x = swfdec_value_to_number (cx, cx->fp->sp[-1]);
+  y = swfdec_value_to_number (cx, cx->fp->sp[-2]);
   cx->fp->sp--;
   errno = 0;
   x = fmod (x, y);


implement Equals

implement Equals

This is the last action that the compiler had implemented and this branch hadn't

--- libswfdec/swfdec_script.c
+++ libswfdec/swfdec_script.c
@@ -1019,7 +1019,7 @@
 }

 static JSBool
-swfdec_action_less (JSContext *cx, guint action, const guint8 *data, guint len)
+swfdec_action_old_compare (JSContext *cx, guint action, const guint8 *data, guint len)
 {
   jsval rval, lval;
   double l, r;
@@ -1029,7 +1029,17 @@
   lval = cx->fp->sp[-2];
   l = swfdec_action_to_number (cx, lval);
   r = swfdec_action_to_number (cx, rval);
-  cond = l < r;
+  switch (action) {
+    case 0x0e:
+      cond = l == r;
+      break;
+    case 0x0f:
+      cond = l < r;
+      break;
+    default:
+      g_assert_not_reached ();
+      return JS_FALSE;
+  }
   cx->fp->sp--;
   if (((SwfdecScript *) cx->fp->swf)->version < 5) {
     cx->fp->sp[-1] = INT_TO_JSVAL (cond ? 1 : 0);
@@ -1655,8 +1665,8 @@
   [0x0b] = { "Subtract", NULL, 2, 1, { NULL, swfdec_action_binary, swfdec_action_binary, swfdec_action_binary, swfdec_action_binary } },
   [0x0c] = { "Multiply", NULL, 2, 1, { NULL, swfdec_action_binary, swfdec_action_binary, swfdec_action_binary, swfdec_action_binary } },
   [0x0d] = { "Divide", NULL, 2, 1, { NULL, swfdec_action_binary, swfdec_action_binary, swfdec_action_binary, swfdec_action_binary } },
-  [0x0e] = { "Equals", NULL },
-  [0x0f] = { "Less", NULL, 2, 1, { NULL, swfdec_action_less, swfdec_action_less, swfdec_action_less, swfdec_action_less } },
+  [0x0e] = { "Equals", NULL, 2, 1, { NULL, swfdec_action_old_compare, swfdec_action_old_compare, swfdec_action_old_compare, swfdec_action_old_compare } },
+  [0x0f] = { "Less", NULL, 2, 1, { NULL, swfdec_action_old_compare, swfdec_action_old_compare, swfdec_action_old_compare, swfdec_action_old_compare } },
   [0x10] = { "And", NULL },
   [0x11] = { "Or", NULL },
   [0x12] = { "Not", NULL, 1, 1, { NULL, swfdec_action_not_4, swfdec_action_not_5, swfdec_action_not_5, swfdec_action_not_5 } },
@@ -1705,7 +1715,7 @@
   [0x45] = { "TargetPath", NULL, 1, 1, { NULL, NULL, swfdec_action_target_path, swfdec_action_target_path, swfdec_action_target_path } },
   [0x46] = { "Enumerate", NULL },
   [0x47] = { "Add2", NULL, 2, 1, { NULL, NULL, swfdec_action_add2_5, swfdec_action_add2_5, swfdec_action_add2_7 } },
-  [0x48] = { "Less2", NULL, 2, 1, { NULL, NULL, swfdec_action_new_comparison_6, swfdec_action_new_comparison_6, swfdec_action_new_comparison_7 }  },
+  [0x48] = { "Less2", NULL, 2, 1, { NULL, NULL, swfdec_action_new_comparison_6, swfdec_action_new_comparison_6, swfdec_action_new_comparison_7 } },
   [0x49] = { "Equals2", NULL, 2, 1, { NULL, NULL, swfdec_action_equals2, swfdec_action_equals2, swfdec_action_equals2 } },
   [0x4a] = { "ToNumber", NULL },
   [0x4b] = { "ToString", NULL },


libteamdctl: use cli->name in dbg messages

Signed-off-by: Jiri Pirko <1b548d10035ae428195c41f5d55eedb1437ccd8a@resnulli.us>

--- libteamdctl/libteamdctl.c
+++ libteamdctl/libteamdctl.c
@@ -225,13 +225,13 @@
 		if (cli_type) {
 			if (err) {
 				err(tdc, "Failed to connect using CLI \"%s\".",
-				    cli_type);
+				    cli->name);
 				return err;
 			}
 			return 0;
 		} else if (err) {
 			dbg(tdc, "Failed to connect using CLI \"%s\".",
-			    cli_type);
+			    cli->name);
 		} else {
 			dbg(tdc, "Connected using CLI \"%s\".", cli->name);
 			return 0;


Add applied/applied-bin/applied-pad properties to single filter manager

--- gst-libs/gst/farsight/fsu-single-filter-manager.c
+++ gst-libs/gst/farsight/fsu-single-filter-manager.c
@@ -37,6 +37,14 @@
         fsu_single_filter_manager_interface_init));

 static void fsu_single_filter_manager_dispose (GObject *object);
+static void fsu_single_filter_manager_get_property (GObject *object,
+    guint property_id,
+    GValue *value,
+    GParamSpec *pspec);
+static void fsu_single_filter_manager_set_property (GObject *object,
+    guint property_id,
+    const GValue *value,
+    GParamSpec *pspec);

 static GList *fsu_single_filter_manager_list_filters (
     FsuFilterManager *iface);
@@ -75,6 +83,14 @@
     GstMessage *message);

 typedef enum {INSERT, REMOVE, REPLACE} ModificationAction;
+
+enum
+{
+  PROP_APPLIED = 1,
+  PROP_APPLIED_BIN,
+  PROP_APPLIED_PAD,
+  LAST_PROPERTY
+};

 typedef struct
 {
@@ -111,6 +127,27 @@
   g_type_class_add_private (klass, sizeof (FsuSingleFilterManagerPrivate));

   gobject_class->dispose = fsu_single_filter_manager_dispose;
+  gobject_class->get_property = fsu_single_filter_manager_get_property;
+  gobject_class->set_property = fsu_single_filter_manager_set_property;
+
+  g_object_class_install_property (gobject_class, PROP_APPLIED,
+      g_param_spec_boolean ("applied", "Applied status",
+          "Whether the filter manager has been applied",
+          FALSE,
+          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_APPLIED_BIN,
+      g_param_spec_object ("applied-bin", "Applied bin",
+          "If applied, the bin it was applied on",
+          GST_TYPE_BIN,
+          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_APPLIED_PAD,
+      g_param_spec_object ("applied-pad", "Applied pad",
+          "If applied, the pad it was applied on",
+          GST_TYPE_BIN,
+          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
 }

 static void
@@ -156,6 +193,48 @@
   G_OBJECT_CLASS (fsu_single_filter_manager_parent_class)->dispose (object);
 }

+static void
+fsu_single_filter_manager_get_property (GObject *object,
+    guint property_id,
+    GValue *value,
+    GParamSpec *pspec)
+{
+  FsuSingleFilterManager *self = FSU_SINGLE_FILTER_MANAGER (object);
+  FsuSingleFilterManagerPrivate *priv = self->priv;
+
+  switch (property_id)
+  {
+    case PROP_APPLIED:
+      g_value_set_boolean (value, priv->applied_bin ? TRUE : FALSE);
+      break;
+    case PROP_APPLIED_BIN:
+      g_value_set_object (value, priv->applied_bin);
+      break;
+    case PROP_APPLIED_PAD:
+      g_value_set_object (value, priv->applied_pad);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+static void
+fsu_single_filter_manager_set_property (GObject *object,
+    guint property_id,
+    const GValue *value,
+    GParamSpec *pspec)
+{
+  FsuSingleFilterManager *self = FSU_SINGLE_FILTER_MANAGER (object);
+  FsuSingleFilterManagerPrivate *priv = self->priv;
+
+  switch (property_id)
+  {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}

 FsuFilterManager *fsu_single_filter_manager_new (void)
 {
@@ -514,7 +593,6 @@
     FsuFilterId *id)
 {
   FsuSingleFilterManager *self = FSU_SINGLE_FILTER_MANAGER (iface);
-  FsuSingleFilterManagerPrivate *priv = self->priv;
   gint index = g_list_index (self->priv->filters, id);

   if (index < 0)


docs: Update documentation to mention that HTTP and HTTPS are supported

Optional TLS certificates have been supported for a little while.

Signed-off-by: Philip Withnall <29c2a2ac2a854b9cf047275aa9de346d096be2e0@endlessm.com>

--- libuhttpmock/uhm-server.c
+++ libuhttpmock/uhm-server.c
@@ -30,8 +30,10 @@
  * where each request is expected by the server (in order). On receiving an expected request, the mock server will return the relevant response and move
  * to expecting the next request in the trace file.
  *
- * The mock server currently only operates on a single network interface, on HTTPS only. This may change in future. A dummy TLS certificate is used
- * to authenticate the server. This certificate is not signed by a CA, so the #SoupSession:ssl-strict property must be set to %FALSE in client code
+ * The mock server currently only operates on a single network interface, on HTTPS (if #UhmServer:tls-certificate is set) or HTTP otherwise.
+ * This may change in future. Your own TLS certificate can be provided to authenticate the server using #UhmServer:tls-certificate, or a dummy
+ * TLS certificate can be used by calling uhm_server_set_default_tls_certificate(). This certificate is not signed by a CA, so the
+ * #SoupSession:ssl-strict property must be set to %FALSE in client code
  * during (and only during!) testing.
  *
  * The server can operate in three modes: logging, testing, and comparing. These are set by #UhmServer:enable-logging and #UhmServer:enable-online.


unlock the mutex at the right place, outside the while (in case there's nothing to do)

--- gst-libs/gst/farsight/fsu-single-filter-manager.c
+++ gst-libs/gst/farsight/fsu-single-filter-manager.c
@@ -583,11 +583,10 @@
       priv->applied_filters = g_list_remove (priv->applied_filters, to_remove);
       free_filter_id (to_remove);
     }
-    g_mutex_unlock (priv->mutex);
-

     g_slice_free (FilterModification, modif);
   }
+  g_mutex_unlock (priv->mutex);

   gst_pad_set_blocked_async (pad, FALSE, pad_block_do_nothing, NULL);


Add debugging

Add debugging

20070208154631-93b9a-fb77ac76d5b324196b2b84a8f57077cadc6ec14e.gz

--- wocky/wocky-xmpp-reader.c
+++ wocky/wocky-xmpp-reader.c
@@ -31,6 +31,9 @@
 #include "wocky-xmpp-stanza.h"

 #define XMPP_STREAM_NAMESPACE "http://etherx.jabber.org/streams"
+
+#define DEBUG_FLAG DEBUG_XMPP_READER
+#include "wocky-debug.h"

 G_DEFINE_TYPE(WockyXmppReader, wocky_xmpp_reader, G_TYPE_OBJECT)

@@ -204,6 +207,12 @@
   WockyXmppReaderPrivate *priv = WOCKY_XMPP_READER_GET_PRIVATE (self);
   int i;

+  if (prefix) {
+    DEBUG("Element %s:%s started, depth %d", prefix, localname, priv->depth);
+  } else {
+    DEBUG("Element %s started, depth %d", localname, priv->depth);
+  }
+
   if (priv->stream_mode && G_UNLIKELY(priv->depth == 0)) {
     gchar *to = NULL;
     gchar *from = NULL;
@@ -280,6 +289,12 @@

   priv->depth--;

+  if (prefix) {
+    DEBUG("Element %s:%s ended, depth %d", prefix, localname, priv->depth);
+  } else {
+    DEBUG("Element %s ended, depth %d", localname, priv->depth);
+  }
+
   if (priv->node && priv->node->content) {
     /* Remove content if it's purely whitespace */
     const char *c;
@@ -307,6 +322,8 @@
   WockyXmppReader *self = WOCKY_XMPP_READER (user_data);
   WockyXmppReaderPrivate *priv = WOCKY_XMPP_READER_GET_PRIVATE (self);
   priv->error = TRUE;
+
+  DEBUG("Parsing failed %s", error->message);
 }

 gboolean


docs: Minor documentation fix to UhmServer

--- libuhttpmock/uhm-server.c
+++ libuhttpmock/uhm-server.c
@@ -19,7 +19,7 @@

 /**
  * SECTION:uhm-server
- * @short_description: mock web server
+ * @short_description: mock HTTP(S) server
  * @stability: Unstable
  * @include: libuhttpmock/uhm-server.h
  *


wayland: shutdown properly

wayland: shutdown properly

We cannot use _finalize as this will be called before GstGLWindow's
_finalize.  This causes us to try and perform operations with the
wayland server when the connection has been severed.

--- gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
+++ gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
@@ -56,8 +56,7 @@
 static GstGLAPI gst_gl_window_wayland_egl_get_gl_api (GstGLWindow * window);
 static gpointer gst_gl_window_wayland_egl_get_proc_address (GstGLWindow *
     window, const gchar * name);
-
-static void gst_gl_window_wayland_egl_finalize (GObject * object);
+static void gst_gl_window_wayland_egl_close (GstGLWindow * window);

 static void
 pointer_handle_enter (void *data, struct wl_pointer *pointer, uint32_t serial,
@@ -256,7 +255,6 @@
 static void
 gst_gl_window_wayland_egl_class_init (GstGLWindowWaylandEGLClass * klass)
 {
-  GObjectClass *object_class = (GObjectClass *) klass;
   GstGLWindowClass *window_class = (GstGLWindowClass *) klass;

   window_class->create_context =
@@ -278,8 +276,7 @@
       GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_get_gl_api);
   window_class->get_proc_address =
       GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_get_proc_address);
-
-  object_class->finalize = gst_gl_window_wayland_egl_finalize;
+  window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_wayland_egl_close);
 }

 static void
@@ -304,11 +301,11 @@
 }

 static void
-gst_gl_window_wayland_egl_finalize (GObject * object)
+gst_gl_window_wayland_egl_close (GstGLWindow * window)
 {
   GstGLWindowWaylandEGL *window_egl;

-  window_egl = GST_GL_WINDOW_WAYLAND_EGL (object);
+  window_egl = GST_GL_WINDOW_WAYLAND_EGL (window);

   gst_gl_window_wayland_egl_destroy_context (window_egl);

@@ -328,8 +325,6 @@
     wl_display_flush (window_egl->display.display);
     wl_display_disconnect (window_egl->display.display);
   }
-
-  G_OBJECT_CLASS (parent_class)->finalize (object);
 }

 static gboolean
@@ -570,7 +565,8 @@

   window_egl = GST_GL_WINDOW_WAYLAND_EGL (window);

-  gst_gl_window_wayland_egl_send_message (window, callback, data);
+  if (callback)
+    gst_gl_window_wayland_egl_send_message (window, callback, data);

   GST_LOG ("sending quit");


Remove duplicate file

Remove duplicate file

--- extobjc/EXTSwizzleTest.h
+++ extobjc/EXTSwizzleTest.h
@@ -1,22 +0,0 @@
-//
-//  EXTSwizzleTests.h
-//  UberFoundation
-//
-//  Created by Justin Spahr-Summers on 2010-08-15.
-//  Copyright 2010 Übermind, Inc. All rights reserved.
-//
-
-#import <SenTestingKit/SenTestingKit.h>
-#import <UberFoundation/EXTSwizzle.h>
-
-@interface EXTSwizzleTests : SenTestCase {
-
-}
-
-- (void)testMacroStringify;
-- (void)testMacroConcatenate;
-
-- (void)testInstanceMethodSwap;
-- (void)testClassMethodSwap;
-
-@end


Formatting

Formatting

--- unionfs.c
+++ unionfs.c
@@ -63,7 +63,6 @@
 	strcat(p, path);

 	int res = access(p, mask);
-
 	if (res == -1) return -errno;

 	return 0;
@@ -108,7 +107,6 @@
 	strcat(p, path);

 	int res = readlink(p, buf, size - 1);
-
 	if (res == -1) return -errno;

 	buf[res] = '\0';
@@ -197,10 +195,7 @@
 static int unionfs_mkdir(const char *path, mode_t mode) {
 	DBG("mkdir\n");

-	int res;
-
-	res = mkdir(path, mode);
-
+	int res = mkdir(path, mode);
 	if (res == -1) return -errno;

 	return 0;
@@ -258,7 +253,6 @@
 	strcat(f, from);

 	int res = symlink(f, to);
-
 	if (res == -1) return -errno;

 	return 0;
@@ -279,7 +273,6 @@
 	strcat(t, to);

 	int res = rename(f, t);
-
 	if (res == -1) return -errno;

 	// The path should no longer exist
@@ -292,10 +285,7 @@
 static int unionfs_link(const char *from, const char *to) {
 	DBG("link\n");

-	int res;
-
-	res = link(from, to);
-
+	int res = link(from, to);
 	if (res == -1) return -errno;

 	return 0;
@@ -313,7 +303,6 @@
 	strcat(p, path);

 	int res = chmod(p, mode);
-
 	if (res == -1) return -errno;

 	return 0;
@@ -330,7 +319,6 @@
 	strcat(p, path);

 	int res = lchown(p, uid, gid);
-
 	if (res == -1) return -errno;

 	return 0;
@@ -347,7 +335,6 @@
 	strcat(p, path);

 	int res = truncate(p, size);
-
 	if (res == -1) return -errno;

 	return 0;
@@ -364,7 +351,6 @@
 	strcat(p, path);

 	int res = utime(p, buf);
-
 	if (res == -1) return -errno;

 	return 0;
@@ -405,8 +391,9 @@
 		if (offset < strlen(out)) {
 			if (s > strlen(out)-offset) s = strlen(out)-offset;
 			memcpy(buf, out+offset, s);
-		} else
+		} else {
 			s = 0;
+		}

 		return s;
 	}
@@ -513,7 +500,6 @@
 	strcat(p, path);

 	int res = lsetxattr(p, name, value, size, flags);
-
 	if (res == -1) return -errno;

 	return 0;
@@ -530,7 +516,6 @@
 	strcat(p, path);

 	int res = lgetxattr(p, name, value, size);
-
 	if (res == -1) return -errno;

 	return 0;
@@ -547,7 +532,6 @@
 	strcat(p, path);

 	int res = llistxattr(p, list, size);
-
 	if (res == -1) return -errno;

 	return 0;
@@ -564,7 +548,6 @@
 	strcat(p, path);

 	int res = lremovexattr(p, name);
-
 	if (res == -1) return -errno;

 	return 0;


tuning

tuning

--- libvips/colour/sRGB2HSV.c
+++ libvips/colour/sRGB2HSV.c
@@ -99,7 +99,7 @@
 			if (delta == 0) {
 				q[0] = 0;
 			} else {
-				q[0] = (unsigned char) ((secondary_diff / (float) delta) + wrap_around_hue);
+				q[0] = (unsigned char) (85.333f*(secondary_diff / (float) delta) + wrap_around_hue);
 			}

 			q[1] = (( delta*255.0f / (float) c_max));


jxlsave: sync quality to distance calculation with libjxl (#3050)

Ensures the quality to distance conversion is continuous at 30.

See:
https://github.com/libjxl/libjxl/commit/ea5fa8074d0146ec0f4388f52990d428ea3b67c3

--- libvips/foreign/jxlsave.c
+++ libvips/foreign/jxlsave.c
@@ -249,7 +249,7 @@
 	if( !vips_object_argument_isset( object, "distance" ) )
 		jxl->distance = jxl->Q >= 30 ?
 			0.1 + (100 - jxl->Q) * 0.09 :
-			6.4 + pow(2.5, (30 - jxl->Q) / 5.0f) / 6.25f;
+			6.24 + pow(2.5, (30 - jxl->Q) / 5.0f) / 6.25f;

 	/* Distance 0 is lossless. libjxl will fail for lossy distance 0.
 	 */


fix default interpolator in similarity

fix default interpolator in similarity

was not defaulting correctly

--- libvips/resample/affine.c
+++ libvips/resample/affine.c
@@ -419,7 +419,10 @@
 		vips_check_vector_length( class->nickname,
 			affine->oarea->n, 4 ) )
 		return( -1 );
-	if( !vips_object_argument_isset( object, "interpolate" ) )
+	/* We can't use vips_object_argument_isset(), since it may have been
+	 * set to NULL, see vips_similarity().
+	 */
+	if( !affine->interpolate )
 		g_object_set( object,
 			"interpolate", vips_interpolate_new( "bilinear" ),
 			NULL );


Fix problem with mutable

Fix problem with mutable

git-svn-id: a252750ff815d3a2b96ee03015f3bd885a80a618@7206 94223b32-352b-4d6d-a509-7b239cf53eea

--- libwired/data/wi-string.c
+++ libwired/data/wi-string.c
@@ -1843,15 +1843,16 @@

 void wi_mutable_string_resolve_aliases_in_path(wi_mutable_string_t *path) {
-	wi_string_t		*component, *partialpath;
-	wi_array_t		*components;
-	wi_uinteger_t	i, count;
+	wi_mutable_string_t		*partialpath;
+	wi_string_t				*component;
+	wi_array_t				*components;
+	wi_uinteger_t			i, count;

 	WI_RUNTIME_ASSERT_MUTABLE(path);

-	components = wi_string_path_components(path);
-	count = wi_array_count(components);
-	partialpath = wi_string_init_with_capacity(wi_string_alloc(), WI_PATH_SIZE);
+	components		= wi_string_path_components(path);
+	count			= wi_array_count(components);
+	partialpath		= wi_string_init_with_capacity(wi_mutable_string_alloc(), WI_PATH_SIZE);

 	for(i = 0; i < count; i++) {
 		component = WI_ARRAY(components, i);


[XFS] kill XFS_INOBT_IS_FREE_DISK

[XFS] kill XFS_INOBT_IS_FREE_DISK

This macro is unused an all other acros in this family operate on native
types, so we most likely won't grow a user either.

SGI-PV: 971186
SGI-Modid: xfs-linux-melb:xfs-kern:29846a

Signed-off-by: Lachlan McIlroy <f5e96ceb240f4c6b121fe0445b266d7666b5fe0e@sgi.com>
Signed-off-by: Tim Shimmin <d1c056a983786a38ca76a05cda240c7b86d77136@sgi.com>

--- fs/xfs/xfs_ialloc_btree.h
+++ fs/xfs/xfs_ialloc_btree.h
@@ -81,8 +81,6 @@
 #define	XFS_INOBT_MASK(i)		((xfs_inofree_t)1 << (i))
 #define	XFS_INOBT_IS_FREE(rp,i)		\
 		(((rp)->ir_free & XFS_INOBT_MASK(i)) != 0)
-#define	XFS_INOBT_IS_FREE_DISK(rp,i)	\
-		((be64_to_cpu((rp)->ir_free) & XFS_INOBT_MASK(i)) != 0)
 #define	XFS_INOBT_SET_FREE(rp,i)	((rp)->ir_free |= XFS_INOBT_MASK(i))
 #define	XFS_INOBT_CLR_FREE(rp,i)	((rp)->ir_free &= ~XFS_INOBT_MASK(i))


assert

assert

--- media/dosamp/dosamp.c
+++ media/dosamp/dosamp.c
@@ -936,6 +936,8 @@
             convert_rdbuf_len += xx;
             buf += xx;
         }
+
+        assert(convert_rdbuf_len <= bufsz);

         samples = (uint32_t)convert_rdbuf_len / (uint32_t)file_codec.bytes_per_block;


more removal

more removal

--- media/dosamp/dosamp.c
+++ media/dosamp/dosamp.c
@@ -39,26 +39,6 @@
 #include <hw/sndsb/sndsbpnp.h>
 #endif

-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
-static unsigned char dmam = 0;
-static   signed char dma128 = 0;
-static unsigned char ignore_asp = 0;
-static unsigned char force_srate_tc = 0;
-static unsigned char force_srate_4xx = 0;
-static unsigned char always_reset_dsp_to_stop = 0;
-static unsigned char assume_dsp_hispeed_doesnt_block = 0;
-static unsigned char dma_autoinit_override = 0;
-static unsigned char sb_debug = 0;
-#endif
-
-static uint32_t      buffer_limit = 0;
-static unsigned char force_dma_probe = 0;
-static unsigned char force_irq_probe = 0;
-static unsigned char irq_probe_f2 = 1;
-static unsigned char irq_probe_80 = 1;
-static unsigned char dma_probe_e2 = 1;
-static unsigned char dma_probe_14 = 1;
-
 static struct dma_8237_allocation *sb_dma = NULL; /* DMA buffer */

 static struct sndsb_ctx*	sb_card = NULL;
@@ -106,20 +86,9 @@
 static char			wav_file[130] = {0};
 static unsigned char		wav_stereo = 0,wav_16bit = 0,wav_bytes_per_sample = 1;
 static unsigned long		wav_data_offset = 44,wav_data_length = 0,wav_sample_rate = 8000,wav_position = 0,wav_buffer_filepos = 0;
-static unsigned long		wav_sample_rate_by_timer_ticks = 1;
-static unsigned long		wav_sample_rate_by_timer = 1;
-static unsigned char		dont_sb_idle = 0;
 static unsigned char		dont_chain_irq = 0;
 static unsigned char		wav_playing = 0;
-static unsigned char		wav_record = 0;
 static signed char		reduced_irq_interval = 0;
-static unsigned char		sample_rate_timer_clamp = 0;
-static unsigned char		goldplay_samplerate_choice = GOLDRATE_MATCH;
-
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__))) /* this is too much to cram into a small model EXE */
-/* fun with Creative ADPCM */
-static unsigned char		do_adpcm_ai_warning = 1;
-#endif

 static volatile unsigned char	IRQ_anim = 0;

@@ -257,131 +226,9 @@
 	}
 }

-static void save_audio(struct sndsb_ctx *cx,uint32_t up_to,uint32_t min,uint32_t max,uint8_t initial) { /* load audio up to point or max */
-	unsigned char FAR *buffer = sb_dma->lin;
-	VGA_ALPHA_PTR wr = vga_state.vga_alpha_ram + 80 - 6;
-	unsigned char load=0;
-	uint16_t prev[6];
-	int rd,i,bufe=0;
-	uint32_t how;
-
-	/* caller should be rounding! */
-	assert((up_to & 3UL) == 0UL);
-	if (up_to >= cx->buffer_size) return;
-	if (cx->buffer_size < 32) return;
-	if (cx->backwards) return; /* NTS: When we do support backwards DMA recording, this code will need to reverse the audio then write forwards in WAV */
-	if (cx->buffer_last_io == up_to) return;
-	if (sb_card->dsp_adpcm != 0) return;
-	if (max == 0) max = cx->buffer_size/4;
-	if (max < 16) return;
-	lseek(wav_fd,wav_data_offset + (wav_position * (unsigned long)wav_bytes_per_sample),SEEK_SET);
-
-	if (cx->buffer_last_io == 0)
-		wav_buffer_filepos = wav_position;
-
-	while (max > 0UL) {
-		/* the most common "hang" apparently is when IRQ 0 triggers too much
-		   and then somehow execution gets stuck here */
-		if (irq_0_watchdog < 16UL)
-			break;
-
-		if (up_to < cx->buffer_last_io) {
-			how = (cx->buffer_size - cx->buffer_last_io); /* from last IO to end of buffer */
-			bufe = 1;
-		}
-		else {
-			if (up_to <= 8UL) break;
-			how = ((up_to-8UL) - cx->buffer_last_io); /* from last IO to up_to */
-			bufe = 0;
-		}
-
-		if (how > max)
-			how = max;
-		else if (how > 16384UL)
-			how = 16384UL;
-		else if (!bufe && how < min)
-			break;
-		else if (how == 0UL)
-			break;
-
-		if (!load) {
-			load = 1;
-			prev[0] = wr[0];
-			wr[0] = '[' | 0x0400;
-			prev[1] = wr[1];
-			wr[1] = 'S' | 0x0400;
-			prev[2] = wr[2];
-			wr[2] = 'A' | 0x0400;
-			prev[3] = wr[3];
-			wr[3] = 'V' | 0x0400;
-			prev[4] = wr[4];
-			wr[4] = 'E' | 0x0400;
-			prev[5] = wr[5];
-			wr[5] = ']' | 0x0400;
-		}
-
-		if (cx->buffer_last_io == 0)
-			wav_buffer_filepos = wav_position;
-
-		if (sb_card->audio_data_flipped_sign) {
-			if (wav_16bit)
-				for (i=0;i < ((int)how-1);i += 2) buffer[cx->buffer_last_io+i+1] ^= 0x80;
-			else
-				for (i=0;i < (int)how;i++) buffer[cx->buffer_last_io+i] ^= 0x80;
-		}
-
-#if TARGET_MSDOS == 32
-        rd = _dos_xwrite(wav_fd,buffer + cx->buffer_last_io,how);
-#else
-        {
-            uint32_t o;
-
-            o  = (uint32_t)FP_SEG(buffer) << 4UL;
-            o += (uint32_t)FP_OFF(buffer);
-            o += cx->buffer_last_io;
-            rd = _dos_xwrite(wav_fd,MK_FP(o >> 4UL,o & 0xFUL),how);
-        }
-#endif
-
-		if (rd <= 0 || (uint32_t)rd < how) {
-			fprintf(stderr,"write() failed, %d < %d\n",
-				rd,(int)how);
-			stop_play();
-			break;
-		}
-
-		assert((cx->buffer_last_io+((uint32_t)rd)) <= cx->buffer_size);
-		wav_position += (uint32_t)rd / wav_bytes_per_sample;
-		cx->buffer_last_io += (uint32_t)rd;
-
-		assert(cx->buffer_last_io <= cx->buffer_size);
-		if (cx->buffer_last_io == cx->buffer_size) cx->buffer_last_io = 0;
-		max -= (uint32_t)rd;
-	}
-
-	if (cx->buffer_last_io == 0)
-		wav_buffer_filepos = wav_position;
-
-	if (load) {
-		for (i=0;i < 6;i++)
-			wr[i] = prev[i];
-	}
-}
-
-static unsigned char adpcm_do_reset_interval=1;
-static unsigned long adpcm_reset_interval=0;
-static unsigned long adpcm_counter=0;
-#if TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__COMPACT__) || defined(__SMALL__))
-#else
-static unsigned char adpcm_tmp[4096];
-#endif
 static void load_audio(struct sndsb_ctx *cx,uint32_t up_to,uint32_t min,uint32_t max,uint8_t initial) { /* load audio up to point or max */
 	unsigned char FAR *buffer = sb_dma->lin;
 	VGA_ALPHA_PTR wr = vga_state.vga_alpha_ram + 80 - 6;
-#if TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__COMPACT__) || defined(__SMALL__))
-#else
-	unsigned char c;
-#endif
 	unsigned char load=0;
 	uint16_t prev[6];
 	int rd,i,bufe=0;
@@ -458,119 +305,8 @@
 		if (cx->buffer_last_io == 0)
 			wav_buffer_filepos = wav_position;

-		if (sb_card->dsp_adpcm > 0) {
-#if TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__COMPACT__) || defined(__SMALL__))
-			break; /* cut */
-#else
-			unsigned int src;
-
-			/* FIXME: Would be neat to demonstrate ADPCM playback with backwards DMA */
-			if (cx->backwards) break;
-
-			/* 16-bit mode: avoid integer overflow below */
-			if (how > 2048)
-				how = 2048;
-
-			/* ADPCM encoding does mono 8-bit only */
-			if (initial) {
-				/* reference byte */
-				rd = _dos_xread(wav_fd,buffer + cx->buffer_last_io,1);
-				sndsb_encode_adpcm_set_reference(buffer[cx->buffer_last_io],sb_card->dsp_adpcm);
-				cx->buffer_last_io++;
-				adpcm_counter++;
-				wav_position++;
-				initial = 0;
-				max--;
-				how--;
-			}
-
-			/* number of samples */
-			if (sb_card->dsp_adpcm == ADPCM_4BIT)
-				src = how * 2;
-			else if (sb_card->dsp_adpcm == ADPCM_2_6BIT)
-				src = how * 3;
-			else if (sb_card->dsp_adpcm == ADPCM_2BIT)
-				src = how * 4;
-
-			if (src > sizeof(adpcm_tmp)) {
-				src = sizeof(adpcm_tmp);
-				if (sb_card->dsp_adpcm == ADPCM_2_6BIT)
-					src -= src % 3;
-			}
-
-			rd = read(wav_fd,adpcm_tmp,src);
-			if (rd == 0 || rd == -1) {
-				wav_position = 0;
-				lseek(wav_fd,wav_data_offset + (wav_position * (unsigned long)wav_bytes_per_sample),SEEK_SET);
-				rd = read(wav_fd,adpcm_tmp,src);
-				if (rd == 0 || rd == -1) {
-#if TARGET_MSDOS == 32
-					memset(adpcm_tmp,128,src);
-#else
-					_fmemset(adpcm_tmp,128,src);
-#endif
-					rd = src;
-				}
-			}
-
-			wav_position += (uint32_t)rd;
-			if (sb_card->dsp_adpcm == ADPCM_4BIT) {
-				rd /= 2;
-				for (i=0;i < rd;i++) {
-					c  = sndsb_encode_adpcm_4bit(adpcm_tmp[(i*2)  ]) << 4;
-					c |= sndsb_encode_adpcm_4bit(adpcm_tmp[(i*2)+1]);
-					buffer[cx->buffer_last_io+i] = c;
-
-					if (adpcm_reset_interval != 0) {
-						if (++adpcm_counter >= adpcm_reset_interval) {
-							adpcm_counter -= adpcm_reset_interval;
-							sndsb_encode_adpcm_reset_wo_ref(sb_card->dsp_adpcm);
-						}
-					}
-				}
-			}
-			else if (sb_card->dsp_adpcm == ADPCM_2_6BIT) {
-				rd /= 3;
-				for (i=0;i < rd;i++) {
-					c  = sndsb_encode_adpcm_2_6bit(adpcm_tmp[(i*3)  ],0) << 5;
-					c |= sndsb_encode_adpcm_2_6bit(adpcm_tmp[(i*3)+1],0) << 2;
-					c |= sndsb_encode_adpcm_2_6bit(adpcm_tmp[(i*3)+2],1) >> 1;
-					buffer[cx->buffer_last_io+i] = c;
-
-					if (adpcm_reset_interval != 0) {
-						if (++adpcm_counter >= adpcm_reset_interval) {
-							adpcm_counter -= adpcm_reset_interval;
-							sndsb_encode_adpcm_reset_wo_ref(sb_card->dsp_adpcm);
-						}
-					}
-				}
-			}
-			else if (sb_card->dsp_adpcm == ADPCM_2BIT) {
-				rd /= 4;
-				for (i=0;i < rd;i++) {
-					c  = sndsb_encode_adpcm_2bit(adpcm_tmp[(i*4)  ]) << 6;
-					c |= sndsb_encode_adpcm_2bit(adpcm_tmp[(i*4)+1]) << 4;
-					c |= sndsb_encode_adpcm_2bit(adpcm_tmp[(i*4)+2]) << 2;
-					c |= sndsb_encode_adpcm_2bit(adpcm_tmp[(i*4)+3]);
-					buffer[cx->buffer_last_io+i] = c;
-
-					if (adpcm_reset_interval != 0) {
-						if (++adpcm_counter >= adpcm_reset_interval) {
-							adpcm_counter -= adpcm_reset_interval;
-							sndsb_encode_adpcm_reset_wo_ref(sb_card->dsp_adpcm);
-						}
-					}
-				}
-			}
-			else {
-				abort();
-			}
-
-			cx->buffer_last_io += (uint32_t)rd;
-#endif
-		}
-		else {
-			uint32_t oa,adj;
+        {
+            uint32_t oa,adj;

 			oa = cx->buffer_last_io;
 			if (cx->backwards) {
@@ -660,98 +396,6 @@
 	}
 }

-static void rec_vu(uint32_t pos) {
-	VGA_ALPHA_PTR wr = vga_state.vga_alpha_ram + (vga_state.vga_width * (vga_state.vga_height - 1));
-	const unsigned int leeway = 256;
-	unsigned int x,L=0,R=0,max;
-	uint16_t sample;
-
-	if (pos == (~0UL)) {
-		for (x=0;x < (unsigned int)vga_state.vga_width;x++)
-			wr[x] = 0x1E00 | 177;
-
-		return;
-	}
-
-	/* caller should be sample-aligning the position! */
-	assert((pos & 3UL) == 0UL);
-
-	if ((pos+(leeway*wav_bytes_per_sample)) < sb_card->buffer_size) {
-		if (wav_16bit) {
-			int16_t FAR *ptr = (int16_t FAR*)(sb_dma->lin + pos);
-			max = 32767;
-			if (wav_stereo) {
-				/* 16-bit PCM stereo */
-				for (x=0;x < leeway;x++) {
-					sample = ptr[x*2];
-					if (sb_card->audio_data_flipped_sign) sample = abs((uint16_t)sample - 32768);
-					else sample = abs((int16_t)sample);
-					if (L < sample) L = sample;
-
-					sample = ptr[x*2 + 1];
-					if (sb_card->audio_data_flipped_sign) sample = abs((uint16_t)sample - 32768);
-					else sample = abs((int16_t)sample);
-					if (R < sample) R = sample;
-				}
-			}
-			else {
-				/* 16-bit PCM mono */
-				for (x=0;x < leeway;x++) {
-					sample = ptr[x];
-					if (sb_card->audio_data_flipped_sign) sample = abs((uint16_t)sample - 32768);
-					else sample = abs((int16_t)sample);
-					if (L < sample) L = sample;
-				}
-			}
-		}
-		else {
-			max = 127;
-			if (wav_stereo) {
-				/* 8-bit PCM stereo */
-				for (x=0;x < leeway;x++) {
-					sample = sb_dma->lin[x*2 + pos];
-					if (sb_card->audio_data_flipped_sign) sample = abs((signed char)sample);
-					else sample = abs((int)sample - 128);
-					if (L < sample) L = sample;
-
-					sample = sb_dma->lin[x*2 + 1 + pos];
-					if (sb_card->audio_data_flipped_sign) sample = abs((signed char)sample);
-					else sample = abs((int)sample - 128);
-					if (R < sample) R = sample;
-				}
-			}
-			else {
-				/* 8-bit PCM mono */
-				for (x=0;x < leeway;x++) {
-					sample = sb_dma->lin[x + pos];
-					if (sb_card->audio_data_flipped_sign) sample = abs((signed char)sample);
-					else sample = abs((int)sample - 128);
-					if (L < sample) L = sample;
-				}
-			}
-		}
-
-		L = (unsigned int)(((unsigned long)L * 80UL) / (unsigned long)max);
-		if (wav_stereo)
-			R = (unsigned int)(((unsigned long)R * 80UL) / (unsigned long)max);
-		else
-			R = L;
-
-		if (L > 80) L = 80;
-		if (R > 80) R = 80;
-		for (x=0;x < 80;x++) {
-			if (x < L && x < R)
-				wr[x] = 0x0F00 | 219;
-			else if (x < L)
-				wr[x] = 0x0F00 | 223;
-			else if (x < R)
-				wr[x] = 0x0F00 | 220;
-			else
-				wr[x] = 0x0F00 | 32;
-		}
-	}
-}
-
 #define DMA_WRAP_DEBUG

 static void wav_idle() {
@@ -768,7 +412,7 @@
 	 * to poll the sound card's IRQ status and handle it directly so playback
 	 * continues to work. if we don't, playback will halt on actual Creative
 	 * Sound Blaster 16 hardware until it gets the I/O read to ack the IRQ */
-	if (!dont_sb_idle) sndsb_main_idle(sb_card);
+	sndsb_main_idle(sb_card);

 	_cli();
 #ifdef DMA_WRAP_DEBUG
@@ -804,19 +448,9 @@
 	pos &= (~3UL); /* round down */
 	_sti();

-	if (wav_record) {
-		/* read audio samples just behind DMA and render as VU meter */
-		rec_vu(pos);
-
-		/* write to disk */
-		save_audio(sb_card,pos,min(wav_sample_rate/4,4096)/*min*/,
-			sb_card->buffer_size/2/*max*/,0/*first block*/);
-	}
-	else {
-		/* load from disk */
-		load_audio(sb_card,pos,min(wav_sample_rate/8,4096)/*min*/,
-			sb_card->buffer_size/4/*max*/,0/*first block*/);
-	}
+    /* load from disk */
+    load_audio(sb_card,pos,min(wav_sample_rate/8,4096)/*min*/,
+        sb_card->buffer_size/4/*max*/,0/*first block*/);
 }

 static void update_cfg();
@@ -908,7 +542,7 @@

 		msg = temp_str;
 		sprintf(temp_str,"%ub %s %5luHz @%c%u:%02u:%02u.%02u",wav_16bit ? 16 : 8,wav_stereo ? "ST" : "MO",
-			wav_sample_rate,wav_playing ? (wav_record ? 'r' : 'p') : 's',pH,pM,pS,pSS);
+			wav_sample_rate,wav_playing ? (0 ? 'r' : 'p') : 's',pH,pM,pS,pSS);
 		for (wr=vga_state.vga_alpha_ram+(80*1),cc=0;cc < 29 && *msg != 0;cc++) *wr++ = 0x1F00 | ((unsigned char)(*msg++));
 		for (;cc < 29;cc++) *wr++ = 0x1F20;
 		msg = sndsb_dspoutmethod_str[sb_card->dsp_play_method];
@@ -998,65 +632,6 @@
 	}
 }

-static void open_wav_unique_name() {
-	int patience = 1000;
-	char *p,*q;
-
-	if (wav_fd >= 0) close(wav_fd);
-	wav_fd = -1;
-
-	do {
-		p = strrchr(wav_file,'.');
-		if (p == NULL) p = wav_file + strlen(wav_file) - 1;
-		else if (p > wav_file) p--;
-
-		if (p == wav_file) {
-			strcpy(wav_file,"untitled.wav");
-		}
-		else if (p >= wav_file) {
-			if (!isdigit(*p)) {
-				*p = '0';
-				break;
-			}
-			else if (*p == '9') {
-				*p = '0';
-				/* carry the 1 */
-				for (q=p-1;q >= wav_file;q--) {
-					if (isdigit(*q)) {
-						if (*q == '9') {
-							*q = '0';
-							continue;
-						}
-						else {
-							(*q)++;
-						}
-					}
-					else {
-						*q = '0';
-						break;
-					}
-				}
-			}
-			else {
-				(*p)++;
-			}
-		}
-
-		/* if the file already exists, then reject the name */
-		if ((wav_fd = open(wav_file,O_RDONLY|O_BINARY)) >= 0) {
-			close(wav_fd);
-			wav_fd = -1;
-		}
-		/* unless we are able to create the file, we don't want it */
-		else if ((wav_fd = open(wav_file,O_RDWR|O_BINARY|O_CREAT|O_EXCL|O_TRUNC,0644)) >= 0) {
-			break; /* works for me */
-		}
-
-		if (--patience == 0)
-			break;
-	} while (1);
-}
-
 static void free_dma_buffer() {
     if (sb_dma != NULL) {
         dma_8237_free_buffer(sb_dma);
@@ -1073,9 +648,9 @@
     ch = sndsb_dsp_playback_will_use_dma_channel(sb_card,wav_sample_rate,wav_stereo,wav_16bit);

     if (ch >= 4)
-        choice = sndsb_recommended_16bit_dma_buffer_size(sb_card,buffer_limit);
+        choice = sndsb_recommended_16bit_dma_buffer_size(sb_card,0);
     else
-        choice = sndsb_recommended_dma_buffer_size(sb_card,buffer_limit);
+        choice = sndsb_recommended_dma_buffer_size(sb_card,0);

     do {
         if (ch >= 4)
@@ -1116,57 +691,10 @@
             return;
     }

-	/* sorry, lock out unimplemented modes */
-	{
-		const char *why = NULL;
-		int i;
-
-		if (sb_card->backwards && sb_card->dsp_adpcm != 0)
-			why = "Backwards playback and ADPCM not implemented";
-		else if (sb_card->backwards && wav_record) /* NTS: When we do support this, code will need to reverse audio before writing to WAV */
-			why = "Backwards recording not implemented";
-
-		if (why) {
-			struct vga_msg_box box;
-			vga_msg_box_create(&box,why,0,0);
-			while (1) {
-				ui_anim(0);
-				if (kbhit()) {
-					i = getch();
-					if (i == 0) i = getch() << 8;
-					if (i == 13 || i == 27) break;
-				}
-			}
-			vga_msg_box_destroy(&box);
-
-			return;
-		}
-	}
-
-	if (wav_record)
-		open_wav_unique_name();
-
 	if (wav_fd < 0)
 		return;

-	choice_rate = sample_rate_timer_clamp ? wav_sample_rate_by_timer : wav_sample_rate;
-	if (sb_card->goldplay_mode) {
-		if (goldplay_samplerate_choice == GOLDRATE_DOUBLE)
-			choice_rate *= 2;
-		else if (goldplay_samplerate_choice == GOLDRATE_MAX) {
-			/* basically the maximum the DSP will run at */
-			if (sb_card->dsp_play_method <= SNDSB_DSPOUTMETHOD_200)
-				choice_rate = 22050;
-			else if (sb_card->dsp_play_method == SNDSB_DSPOUTMETHOD_201)
-				choice_rate = 44100;
-			else if (sb_card->dsp_play_method == SNDSB_DSPOUTMETHOD_3xx)
-				choice_rate = wav_stereo ? 22050 : 44100;
-			else if (sb_card->pnp_name == NULL)
-				choice_rate = 44100; /* Most clones and non-PnP SB16 cards max out at 44.1KHz */
-			else
-				choice_rate = 48000; /* SB16 ViBRA (PnP-era) cards max out at 48Khz */
-		}
-	}
+	choice_rate = wav_sample_rate;

 	update_cfg();
 	irq_0_watchdog_reset();
@@ -1175,31 +703,7 @@

 	sndsb_setup_dma(sb_card);

-	if (!wav_record)
-		load_audio(sb_card,sb_card->buffer_size/2,0/*min*/,0/*max*/,1/*first block*/);
-	else { /* create RIFF structure for recording */
-		uint32_t dw;
-		uint16_t w;
-
-		write(wav_fd,"RIFF",4);
-		dw = 44 - 8;			write(wav_fd,&dw,4);
-		write(wav_fd,"WAVEfmt ",8);
-		dw = 0x10;			write(wav_fd,&dw,4);
-
-		w = 1; /* PCM */		write(wav_fd,&w,2);
-		w = wav_stereo ? 2 : 1;		write(wav_fd,&w,2);
-		dw = wav_sample_rate;		write(wav_fd,&dw,4);
-		dw = wav_sample_rate * wav_bytes_per_sample;
-						write(wav_fd,&dw,4);
-		w = wav_bytes_per_sample;	write(wav_fd,&w,2);
-		w = wav_16bit ? 16 : 8;		write(wav_fd,&w,2);
-
-		write(wav_fd,"data",4);
-		dw = 0;				write(wav_fd,&dw,4);
-
-		wav_data_offset = 44;
-		wav_position = 0;
-	}
+    load_audio(sb_card,sb_card->buffer_size/2,0/*min*/,0/*max*/,1/*first block*/);

 	/* make sure the IRQ is acked */
 	if (sb_card->irq >= 8) {
@@ -1223,12 +727,6 @@
 		irq_0_adv = 182UL;		/* 18.2Hz */
 		irq_0_max = nr * 10UL;		/* sample rate */
 	}
-	else if (sb_card->goldplay_mode) {
-		write_8254_system_timer(wav_sample_rate_by_timer_ticks);
-		irq_0_count = 0;
-		irq_0_adv = 182UL;		/* 18.2Hz */
-		irq_0_max = wav_sample_rate_by_timer * 10UL;
-	}
 	wav_playing = 1;
 	_sti();
 }
@@ -1236,13 +734,12 @@
 static void stop_play() {
 	if (!wav_playing) return;
 	draw_irq_indicator();
-	if (!wav_record) {
-		wav_position = playback_live_position();
-		wav_position -= wav_position % (unsigned long)wav_bytes_per_sample;
-	}
+
+    wav_position = playback_live_position();
+    wav_position -= wav_position % (unsigned long)wav_bytes_per_sample;

 	_cli();
-	if (sb_card->dsp_play_method == SNDSB_DSPOUTMETHOD_DIRECT || sb_card->goldplay_mode) {
+	if (sb_card->dsp_play_method == SNDSB_DSPOUTMETHOD_DIRECT) {
 		irq_0_count = 0;
 		irq_0_adv = 1;
 		irq_0_max = 1;
@@ -1253,26 +750,6 @@
 	_sti();

 	ui_anim(1);
-	if (wav_fd >= 0 && wav_record) {
-		uint32_t dw;
-
-		unsigned long len = lseek(wav_fd,0,SEEK_END);
-
-		lseek(wav_fd,4,SEEK_SET);
-		dw = len - 8; write(wav_fd,&dw,4);
-
-		lseek(wav_fd,40,SEEK_SET);
-		dw = len - 44; write(wav_fd,&dw,4);
-
-		close(wav_fd);
-		wav_fd = -1;
-
-		wav_fd = open(wav_file,O_RDONLY|O_BINARY);
-		wav_data_offset = 44;
-		wav_data_length = len - 44;
-		wav_position = 0;
-		rec_vu(~0UL);
-	}
 }

 static void vga_write_until(unsigned int x) {
@@ -1296,213 +773,6 @@
 	"         DOS extender there may be enough overhead to overwhelm the CPU\n"
 	"         and possibly cause a crash.\n"
 	"         Enable?";
-#endif
-
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__))) /* this is too much to cram into a small model EXE */
-static int change_alias_idx = 0;
-static unsigned char dsp_alias_had_warned = 0;
-static const char *dsp_alias_warning =
-	"WARNING: DSP alias port will not work unless you are using an original\n"
-	"         Sound Blaster (DSP 1.xx or 2.xx) and NOT a clone. See the\n"
-	"         README file for more information.\n"
-	"         Enable anyway?";
-#endif
-
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__))) /* this is too much to cram into a small model EXE */
-static void measure_dsp_busy_cycle() {
-	unsigned long time1 = 0,time2 = 0,tlimit;
-	unsigned char timehits = 0;
-	t8254_time_t pr,cr,dl;
-	unsigned char pc,cc;
-	unsigned int i;
-	int c;
-
-	vga_write_color(0x07);
-	vga_clear();
-	vga_moveto(0,0);
-	vga_write("Testing DSP busy cycle... please wait\n");
-
-	_cli();
-
-	pc = inp(sb_card->baseio+SNDSB_BIO_DSP_WRITE_STATUS);
-	pr = read_8254(0);
-	tlimit = t8254_us2ticks(1000000);
-
-	time1 = 0;
-	while (time1 < tlimit) {
-		for (i=0;i < 1024;i++) {
-			cc = inp(sb_card->baseio+SNDSB_BIO_DSP_WRITE_STATUS);
-			if ((cc&0x80) != (pc&0x80)) break;
-			pc = cc;
-		}
-
-		cr = read_8254(0);
-		dl = pr - cr; /* we expect rollover. remember the 8254 counts DOWN */
-		pr = cr;
-		time1 += dl;
-
-		if ((cc&0x80) != (pc&0x80)) {
-			break;
-		}
-	}
-
-	time1 = 0;
-	while (time1 < tlimit) {
-		for (i=0;i < 1024;i++) {
-			cc = inp(sb_card->baseio+SNDSB_BIO_DSP_WRITE_STATUS);
-			if ((cc&0x80) != (pc&0x80)) break;
-			pc = cc;
-		}
-
-		cr = read_8254(0);
-		dl = pr - cr; /* we expect rollover. remember the 8254 counts DOWN */
-		pr = cr;
-		time1 += dl;
-
-		if ((cc&0x80) != (pc&0x80)) {
-			timehits |= 1;
-			break;
-		}
-	}
-
-	pc = cc;
-	pr = cr;
-	while (time2 < tlimit) {
-		for (i=0;i < 1024;i++) {
-			cc = inp(sb_card->baseio+SNDSB_BIO_DSP_WRITE_STATUS);
-			if ((cc&0x80) != (pc&0x80)) break;
-			pc = cc;
-		}
-
-		cr = read_8254(0);
-		dl = pr - cr; /* we expect rollover. remember the 8254 counts DOWN */
-		pr = cr;
-		time2 += dl;
-
-		if ((cc&0x80) != (pc&0x80)) {
-			timehits |= 2;
-			break;
-		}
-	}
-
-	_sti();
-
-	vga_write_color(0x07);
-	vga_write("DSP busy cycle measurements:\n");
-
-	if (timehits & 1) {
-		vga_write("Time to first transition: ");
-		sprintf(temp_str,"%.6f sec\n",(double)time1 / T8254_REF_CLOCK_HZ);
-		vga_write(temp_str);
-	}
-	else {
-		vga_write("Time to first transition could not be measured\n");
-	}
-
-	if (timehits & 2) {
-		vga_write("Time to second transition: ");
-		sprintf(temp_str,"%.6f sec\n",(double)time2 / T8254_REF_CLOCK_HZ);
-		vga_write(temp_str);
-	}
-	else {
-		vga_write("Time to second transition could not be measured\n");
-	}
-
-	vga_write("\n");
-	vga_write("Explanation: On some Creative Sound Blaster cards the DSP's busy bit (port 22Ch)\n");
-	vga_write("             cycles on/off by itself. This can be seen by software when polling.\n");
-	vga_write_sync();
-
-	do {
-		c = getch();
-	} while (!(c == 13 || c == 27));
-}
-
-static void change_alias_menu() {
-	unsigned char loop=1;
-	unsigned char redraw=1;
-	unsigned char uiredraw=1;
-	unsigned char selector=change_alias_idx;
-	VGA_ALPHA_PTR vga;
-	unsigned int cc;
-	char tmp[128];
-
-	while (loop) {
-		if (redraw || uiredraw) {
-			_cli();
-			if (redraw) {
-				for (vga=vga_state.vga_alpha_ram+(80*2),cc=0;cc < (80*23);cc++) *vga++ = 0x1E00 | 177;
-				ui_anim(1);
-			}
-			vga_moveto(0,4);
-
-			vga_write_color(selector == 0 ? 0x70 : 0x1F);
-			sprintf(tmp,"DSP alias:     %u",sb_card->dsp_alias_port);
-			vga_write(tmp);
-			vga_write_until(30);
-			vga_write("\n");
-
-			vga_write_sync();
-			_sti();
-			redraw = 0;
-			uiredraw = 0;
-		}
-
-		if (kbhit()) {
-			int c = getch();
-			if (c == 0) c = getch() << 8;
-
-			if (c == 27 || c == 13)
-				loop = 0;
-			else if (c == 0x4800) { /* up arrow */
-//				if (selector > 0) selector--;
-//				else selector=0;
-				uiredraw=1;
-			}
-			else if (c == 0x5000) { /* down arrow */
-//				if (selector < -1) selector++;
-//				else selector=0;
-				uiredraw=1;
-			}
-			else if (c == 0x4B00) { /* left arrow */
-				switch (selector) {
-					case 0:	/* sample rate */
-						sb_card->dsp_alias_port ^= 1;
-                        sndsb_update_dspio(sb_card);
-                        break;
-				};
-				update_cfg();
-				uiredraw=1;
-			}
-			else if (c == 0x4D00) { /* right arrow */
-				switch (selector) {
-					case 0:	/* sample rate */
-						sb_card->dsp_alias_port ^= 1;
-                        sndsb_update_dspio(sb_card);
-						break;
-				};
-				update_cfg();
-				uiredraw=1;
-			}
-		}
-
-		ui_anim(0);
-	}
-
-	if (!dsp_alias_had_warned && sb_card->dsp_alias_port) {
-		/* NOTE TO SELF: It can overwhelm the UI in DOSBox too, but DOSBox seems able to
-		   recover if you manage to hit CTRL+F12 to speed up the CPU cycles in the virtual machine.
-		   On real hardware, even with the recovery method the machine remains hung :( */
-		if (confirm_yes_no_dialog(dsp_alias_warning))
-			dsp_alias_had_warned = 1;
-		else {
-			sb_card->dsp_alias_port = 0;
-            sndsb_update_dspio(sb_card);
-        }
-	}
-
-	change_param_idx = selector;
-}
 #endif

 static void change_param_menu() {
@@ -1800,39 +1070,21 @@
 	{"Set file...",		's',	0,	0};
 static const struct vga_menu_item main_menu_file_quit =
 	{"Quit",		'q',	0,	0};
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__))) /* this is too much to cram into a small model EXE */
-static const struct vga_menu_item main_menu_windows_fullscreen =
-	{"Windows fullscreen",	'f',	0,	0};
-#endif

 static const struct vga_menu_item* main_menu_file[] = {
 	&main_menu_file_set,
 	&main_menu_file_quit,
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__))) /* this is too much to cram into a small model EXE */
-	&menu_separator,
-	&main_menu_windows_fullscreen,
-#endif
 	NULL
 };

 static const struct vga_menu_item main_menu_playback_play =
 	{"Play",		'p',	0,	0};
-static const struct vga_menu_item main_menu_playback_record =
-	{"Record",		'r',	0,	0};
 static const struct vga_menu_item main_menu_playback_stop =
 	{"Stop",		's',	0,	0};
 static const struct vga_menu_item main_menu_playback_params =
 	{"Parameters",		'a',	0,	0};
 static struct vga_menu_item main_menu_playback_reduced_irq =
 	{"xxx",			'i',	0,	0};
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__))) /* this is too much to cram into a small model EXE */
-static struct vga_menu_item main_menu_playback_autoinit_adpcm =
-	{"xxx",			'd',	0,	0};
-#endif
-static struct vga_menu_item main_menu_playback_goldplay =
-	{"xxx",			'g',	0,	0};
-static struct vga_menu_item main_menu_playback_goldplay_mode =
-	{"xxx",			'm',	0,	0};
 static struct vga_menu_item main_menu_playback_dsp_autoinit_dma =
 	{"xxx",			't',	0,	0};
 static struct vga_menu_item main_menu_playback_dsp_autoinit_command =
@@ -1842,46 +1094,22 @@
 	{"xxx",			'n',	0,	0};
 static struct vga_menu_item main_menu_playback_timer_clamp =
 	{"xxx",			0,	0,	0};
-static struct vga_menu_item main_menu_playback_force_hispeed =
-	{"xxx",			'h',	0,	0};
-static struct vga_menu_item main_menu_playback_flip_sign =
-	{"xxx",			'l',	0,	0};
 static struct vga_menu_item main_menu_playback_dsp4_fifo_autoinit =
 	{"xxx",			'f',	0,	0};
-static struct vga_menu_item main_menu_playback_dsp4_fifo_single =
-	{"xxx",			'e',	0,	0};
-static struct vga_menu_item main_menu_playback_dsp_nag_mode =
-	{"xxx",			'o',	0,	0};
-static struct vga_menu_item main_menu_playback_dsp_poll_ack_no_irq =
-	{"xxx",			'q',	0,	0};
-static struct vga_menu_item main_menu_playback_wari_hack_alias =
-	{"xxx",			'w',	0,	0};
 #endif

 static const struct vga_menu_item* main_menu_playback[] = {
 	&main_menu_playback_play,
-	&main_menu_playback_record,
 	&main_menu_playback_stop,
 	&menu_separator,
 	&main_menu_playback_params,
 	&main_menu_playback_reduced_irq,
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__))) /* this is too much to cram into a small model EXE */
-	&main_menu_playback_autoinit_adpcm,
-#endif
-	&main_menu_playback_goldplay,
-	&main_menu_playback_goldplay_mode,
 	&main_menu_playback_dsp_autoinit_dma,
 	&main_menu_playback_dsp_autoinit_command,
 #if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__))) /* this is too much to cram into a small model EXE */
 	&main_menu_playback_noreset_adpcm,
 	&main_menu_playback_timer_clamp,
-	&main_menu_playback_force_hispeed,
-	&main_menu_playback_flip_sign,
 	&main_menu_playback_dsp4_fifo_autoinit,
-	&main_menu_playback_dsp4_fifo_single,
-	&main_menu_playback_dsp_nag_mode,
-	&main_menu_playback_dsp_poll_ack_no_irq,
-	&main_menu_playback_wari_hack_alias,
 #endif
 	NULL
 };
@@ -1903,10 +1131,6 @@
 	{"Halt & continue DMA",	'h',	0,	0};
 #endif
 #if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__))) /* this is too much to cram into a small model EXE */
-static struct vga_menu_item main_menu_device_dsp_alias =
-	{"Alias ports",		'a',	0,	0};
-static struct vga_menu_item main_menu_device_busy_cycle =
-	{"Busy cycle",		'b',	0,	0};
 static struct vga_menu_item main_menu_device_srate_force =
 	{"xxx",		        's',	0,	0};
 static struct vga_menu_item main_menu_device_realloc_dma =
@@ -1925,8 +1149,6 @@
 	&main_menu_device_haltcont_dma,
 #endif
 #if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__))) /* this is too much to cram into a small model EXE */
-	&main_menu_device_dsp_alias,
-	&main_menu_device_busy_cycle,
     &main_menu_device_srate_force,
     &main_menu_device_realloc_dma,
 #endif
@@ -1978,18 +1200,11 @@
 static void update_cfg() {
 	unsigned int r;

-	wav_sample_rate_by_timer_ticks = T8254_REF_CLOCK_HZ / wav_sample_rate;
-	if (wav_sample_rate_by_timer_ticks == 0) wav_sample_rate_by_timer_ticks = 1;
-	wav_sample_rate_by_timer = T8254_REF_CLOCK_HZ / wav_sample_rate_by_timer_ticks;
-
 	sb_card->dsp_adpcm = sb_card->dsp_adpcm;
-	sb_card->dsp_record = wav_record;
 	r = wav_sample_rate;
 	if (sb_card->dsp_adpcm == ADPCM_4BIT) r /= 2;
 	else if (sb_card->dsp_adpcm == ADPCM_2_6BIT) r /= 3;
 	else if (sb_card->dsp_adpcm == ADPCM_2BIT) r /= 4;
-	adpcm_counter = 0;
-	adpcm_reset_interval = 0;
 	if (sb_card->dsp_adpcm > 0) {
 		if (sb_card->dsp_adpcm == ADPCM_4BIT)
 			sb_card->buffer_irq_interval = wav_sample_rate / 2;
@@ -2012,9 +1227,6 @@
 				sb_card->buffer_irq_interval % 3;
 		else if (sb_card->dsp_adpcm == ADPCM_2BIT)
 			sb_card->buffer_irq_interval &= ~3UL;
-
-		if (adpcm_do_reset_interval)
-			adpcm_reset_interval = sb_card->buffer_irq_interval;
 	}
 	else {
 		sb_card->buffer_irq_interval = r;
@@ -2040,50 +1252,13 @@
 		main_menu_playback_reduced_irq.text =
 			"IRQ interval: tiny";

-	if (goldplay_samplerate_choice == GOLDRATE_MATCH)
-		main_menu_playback_goldplay_mode.text =
-			"Goldplay sample rate: Match";
-	else if (goldplay_samplerate_choice == GOLDRATE_DOUBLE)
-		main_menu_playback_goldplay_mode.text =
-			"Goldplay sample rate: Double";
-	else if (goldplay_samplerate_choice == GOLDRATE_MAX)
-		main_menu_playback_goldplay_mode.text =
-			"Goldplay sample rate: Max";
-	else
-		main_menu_playback_goldplay_mode.text =
-			"?";
-
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__))) /* this is too much to cram into a small model EXE */
-	main_menu_playback_autoinit_adpcm.text =
-		sb_card->enable_adpcm_autoinit ? "ADPCM Auto-init: On" : "ADPCM Auto-init: Off";
-#endif
-	main_menu_playback_goldplay.text =
-		sb_card->goldplay_mode ? "Goldplay mode: On" : "Goldplay mode: Off";
 	main_menu_playback_dsp_autoinit_dma.text =
 		sb_card->dsp_autoinit_dma ? "DMA autoinit: On" : "DMA autoinit: Off";
 	main_menu_playback_dsp_autoinit_command.text =
 		sb_card->dsp_autoinit_command ? "DSP playback: auto-init" : "DSP playback: single-cycle";
 #if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__))) /* this is too much to cram into a small model EXE */
-	main_menu_playback_force_hispeed.text =
-		sb_card->force_hispeed ? "Force hispeed: On" : "Force hispeed: Off";
-	main_menu_playback_noreset_adpcm.text =
-		adpcm_do_reset_interval ? "ADPCM reset step/interval: On" : "ADPCM reset step/interval: Off";
-	main_menu_playback_timer_clamp.text =
-		sample_rate_timer_clamp ? "Clamp samplerate to timer: On" : "Clamp samplerate to timer: Off";
-	main_menu_playback_flip_sign.text =
-		sb_card->audio_data_flipped_sign ? "Flipped sign: On" : "Flipped sign: Off";
 	main_menu_playback_dsp4_fifo_autoinit.text =
 		sb_card->dsp_4xx_fifo_autoinit ? "DSP 4.xx autoinit FIFO: On" : "DSP 4.xx autoinit FIFO: Off";
-	main_menu_playback_dsp4_fifo_single.text =
-		sb_card->dsp_4xx_fifo_single_cycle ? "DSP 4.xx single FIFO: On" : "DSP 4.xx single FIFO: Off";
-	main_menu_playback_dsp_nag_mode.text =
-		sb_card->dsp_nag_mode ?
-			(sb_card->dsp_nag_hispeed ? "DSP nag mode: All" : "DSP nag mode: Non-highspeed")
-			: "DSP nag mode: Off";
-	main_menu_playback_dsp_poll_ack_no_irq.text =
-		sb_card->poll_ack_when_no_irq ? "Poll ack when no IRQ: On" : "Poll ack when no IRQ: Off";
-	main_menu_playback_wari_hack_alias.text =
-		sb_card->wari_hack_mode ? "Wari Hack Alias: On" : "Wari Hack Alias: Off";

     if (sb_card->srate_force_dsp_4xx)
         main_menu_device_srate_force.text = "Force srate cmd: Using 4.xx (switch to TC)";
@@ -2292,10 +1467,6 @@
     printf(" /srf4xx              Force SB16 sample rate commands\n");
     printf(" /srftc               Force SB/SBPro time constant sample rate\n");
     printf(" /noasp               Don't probe SB16 ASP/CSP chip\n");
-    printf(" /dma128              Enable 16-bit DMA to span 128KB\n");
-    printf(" /-dma128             Disable 16-bit DMA to span 128KB\n");
-    printf(" /dmam:[u|a|p]        Assume 16-bit DMA masking\n");
-    printf("                          u=unknown a=address p=page\n");
 #  endif
 # endif

@@ -2345,97 +1516,8 @@
 			else if (!strcmp(a,"adma")) {
 				assume_dma = 1;
 			}
-			else if (!strcmp(a,"sbalias:dsp")) {
-				sndsb_probe_options.use_dsp_alias = 1;
-			}
-			else if (!strcmp(a,"nif2")) {
-				irq_probe_f2 = 0;
-			}
-			else if (!strcmp(a,"ni80")) {
-				irq_probe_80 = 0;
-			}
-			else if (!strcmp(a,"nde2")) {
-				dma_probe_e2 = 0;
-			}
-			else if (!strcmp(a,"nd14")) {
-				dma_probe_14 = 0;
-			}
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
-            else if (!strcmp(a,"srf4xx")) {
-                force_srate_4xx = 1;
-            }
-            else if (!strcmp(a,"dma128")) {
-                dma128 = 1;
-            }
-            else if (!strcmp(a,"-dma128")) {
-                dma128 = -1;
-            }
-            else if (!strncmp(a,"dmam:",5)) {
-                a += 5;
-
-                if (*a == 'u' || *a == 'a' || *a == 'p')
-                    dmam = *a;
-                else
-                    return 1;
-            }
-#endif
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
-            else if (!strcmp(a,"noasp")) {
-                ignore_asp = 1;
-            }
-            else if (!strcmp(a,"srftc")) {
-                force_srate_tc = 1;
-            }
-			else if (!strcmp(a,"stopres")) {
-				always_reset_dsp_to_stop = 1;
-			}
-			else if (!strcmp(a,"hinoblk")) {
-				assume_dsp_hispeed_doesnt_block = 1;
-			}
-			else if (!strcmp(a,"dmaaio")) {
-				dma_autoinit_override = 1;
-			}
-#endif
-			else if (!strcmp(a,"fip")) {
-				force_irq_probe = 1;
-			}
-			else if (!strcmp(a,"fdp")) {
-				force_dma_probe = 1;
-			}
-			else if (!strcmp(a,"noidle")) {
-				dont_sb_idle = 1;
-			}
 			else if (!strcmp(a,"nochain")) {
 				dont_chain_irq = 1;
-			}
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
-			else if (!strcmp(a,"debug")) {
-				sb_debug = 1;
-			}
-            else if (!strcmp(a,"96k")) {
-                buffer_limit = 96UL * 1024UL;
-            }
-#endif
-            else if (!strcmp(a,"64k")) {
-                buffer_limit = 64UL * 1024UL;
-            }
-            else if (!strcmp(a,"63k")) {
-                buffer_limit = 63UL * 1024UL;
-            }
-            else if (!strcmp(a,"48k")) {
-                buffer_limit = 48UL * 1024UL;
-            }
-            else if (!strcmp(a,"32k")) {
-                buffer_limit = 32UL * 1024UL;
-            }
-            else if (!strcmp(a,"16k")) {
-                buffer_limit = 16UL * 1024UL;
-            }
-			else if (!strcmp(a,"8k")) {
-				buffer_limit = 8UL * 1024UL;
-			}
-			else if (!strcmp(a,"4k")) {
-				buffer_limit = 4UL * 1024UL;
 			}
 #if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
 			else if (!strcmp(a,"-nmi")) {
@@ -2512,18 +1594,6 @@
 		d8237_flags |= D8237_DMA_PRIMARY | D8237_DMA_SECONDARY;

 #if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
-    if (dma128 == 1)
-        d8237_enable_16bit_128kb_dma();
-    else if (dma128 == -1)
-        d8237_disable_16bit_128kb_dma();
-
-    if (dmam == 'u')
-        d8237_16bit_set_unknown_mask();
-    else if (dmam == 'a')
-        d8237_16bit_set_addr_mask();
-    else if (dmam == 'p')
-        d8237_16bit_set_page_mask();
-
 	printf("DMA available: 0-3=%s 4-7=%s mask8=0x%lx mask16=0x%lx 128k=%u\n",
 		d8237_flags&D8237_DMA_PRIMARY?"yes":"no",
 		d8237_flags&D8237_DMA_SECONDARY?"yes":"no",
@@ -2709,67 +1779,14 @@
 			sndsb_probe_mixer(cx);
 #endif

-		if (force_irq_probe) {
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
-			if (sb_debug) printf("SB %03x: Forgetting IRQ, forcing probe\n",cx->baseio);
-#endif
-			cx->irq = -1;
-		}
-		if (force_dma_probe) {
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
-			if (sb_debug) printf("SB %03x: Forgetting DMA, forcing probe\n",cx->baseio);
-#endif
-			cx->dma8 = cx->dma16 = -1;
-		}
-
-		if (cx->irq < 0 && irq_probe_f2) {
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
-			if (sb_debug) printf("SB %03x: Probing IRQ (F2)...\n",cx->baseio);
-#endif
+		if (cx->irq < 0)
 			sndsb_probe_irq_F2(cx);
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
-			if (cx->irq >= 0 && sb_debug) printf("SB %03x: Probing (F2) found IRQ %d\n",cx->baseio,cx->irq);
-#endif
-		}
-		if (cx->irq < 0 && irq_probe_80) {
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
-			if (sb_debug) printf("SB %03x: Probing IRQ (80)...\n",cx->baseio);
-#endif
+		if (cx->irq < 0)
 			sndsb_probe_irq_80(cx);
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
-			if (cx->irq >= 0 && sb_debug) printf("SB %03x: Probing (80) found IRQ %d\n",cx->baseio,cx->irq);
-#endif
-		}
-		if (cx->dma8 < 0 && dma_probe_e2) { // NTS: for some cards, this will also set the 16-bit DMA channel
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
-			if (sb_debug) printf("SB %03x: Probing DMA (E2)...\n",cx->baseio);
-#endif
+		if (cx->dma8 < 0)
 			sndsb_probe_dma8_E2(cx);
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
-			if (cx->dma8 >= 0 && sb_debug) printf("SB %03x: Probing (E2) found DMA %d\n",cx->baseio,cx->dma8);
-#endif
-		}
-		if (cx->dma8 < 0 && dma_probe_14) { // NTS: for some cards, this will also set the 16-bit DMA channel
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
-			if (sb_debug) printf("SB %03x: Probing DMA (14)...\n",cx->baseio);
-#endif
+		if (cx->dma8 < 0)
 			sndsb_probe_dma8_14(cx);
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
-			if (cx->dma8 >= 0 && sb_debug) printf("SB %03x: Probing (14) found DMA %d\n",cx->baseio,cx->dma8);
-#endif
-		}
-
-		// DMA auto-init override.
-		// WARNING: Single-cycle DSP commands with auto-init DMA can cause problems with SB clones or emulation.
-		//   - Sound Blaster Live! (EMU10K1 PCI cards) will play the audio extra-fast
-		//   - Pro Audio Spectrum cards will have occasional pops and crackles (confirmed on PAS16)
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
-		if (dma_autoinit_override) cx->dsp_autoinit_dma_override = 1;
-		if (assume_dsp_hispeed_doesnt_block) cx->hispeed_blocking = 0;
-		if (always_reset_dsp_to_stop) cx->always_reset_dsp_to_stop = 1;
-        if (force_srate_4xx) cx->srate_force_dsp_4xx = 1;
-        if (force_srate_tc) cx->srate_force_dsp_tc = 1;
-#endif

 		// having IRQ and DMA changes the ideal playback method and capabilities
 		sndsb_update_capabilities(cx);
@@ -2808,19 +1825,6 @@
 #endif
 			printf("      '%s'\n",cx->dsp_copyright);

-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)))
-            if (!ignore_asp) {
-                if (sndsb_check_for_sb16_asp(cx)) {
-                    printf("      CSP/ASP chip detected: version=0x%02x ",cx->asp_chip_version_id);
-
-                    if (sndsb_sb16_asp_ram_test(cx) > 0)
-                        printf("RAM OK\n");
-                    else
-                        printf("RAM TEST FAILED\n");
-                }
-            }
-#endif
-
 			count++;
 		}
 		if (count == 0) {
@@ -2876,7 +1880,6 @@

 	loop=1;
 	redraw=1;
-	wav_record=0;
 	bkgndredraw=1;
 	vga_menu_bar.bar = main_menu_bar;
 	vga_menu_bar.sel = -1;
@@ -2929,24 +1932,9 @@
 			else if (mitem == &main_menu_file_set) {
 				prompt_play_wav(0);
 				bkgndredraw = 1;
-				wav_record = 0;
 				redraw = 1;
 			}
 			else if (mitem == &main_menu_playback_play) {
-				if (wav_record) {
-					stop_play();
-					wav_record = 0;
-				}
-				if (!wav_playing) {
-					begin_play();
-					redraw = 1;
-				}
-			}
-			else if (mitem == &main_menu_playback_record) {
-				if (!wav_record) {
-					stop_play();
-					wav_record = 1;
-				}
 				if (!wav_playing) {
 					begin_play();
 					redraw = 1;
@@ -3120,14 +2108,6 @@
 				ui_anim(1);
 				if (wp) begin_play();
 			}
-			else if (mitem == &main_menu_device_dsp_alias) {
-				unsigned char wp = wav_playing;
-				if (wp) stop_play();
-				change_alias_menu();
-				if (wp) begin_play();
-				bkgndredraw = 1;
-				redraw = 1;
-			}
             else if (mitem == &main_menu_device_srate_force) {
 				unsigned char wp = wav_playing;
 				if (wp) stop_play();
@@ -3150,150 +2130,6 @@
 				bkgndredraw = 1;
 				redraw = 1;
             }
-            else if (mitem == &main_menu_device_realloc_dma) {
-                unsigned char wp = wav_playing;
-                if (wp) stop_play();
-                realloc_dma_buffer();
-                if (wp) begin_play();
-                bkgndredraw = 1;
-                redraw = 1;
-            }
-            else if (mitem == &main_menu_device_busy_cycle) {
-				// NTS: The user may be testing the busy cycle while the card is playing audio. Do NOT stop playback!
-				//      The test carried out in this function does not send DSP commands, it only polls the DSP.
-				measure_dsp_busy_cycle();
-				bkgndredraw = 1;
-				redraw = 1;
-			}
-			else if (mitem == &main_menu_playback_wari_hack_alias) {
-				unsigned char wp = wav_playing;
-				if (wp) stop_play();
-				sb_card->wari_hack_mode = !sb_card->wari_hack_mode;
-				update_cfg();
-				ui_anim(1);
-				if (wp) begin_play();
-			}
-			else if (mitem == &main_menu_playback_dsp_poll_ack_no_irq) {
-				unsigned char wp = wav_playing;
-				if (wp) stop_play();
-				sb_card->poll_ack_when_no_irq = !sb_card->poll_ack_when_no_irq;
-				update_cfg();
-				ui_anim(1);
-				if (wp) begin_play();
-			}
-			else if (mitem == &main_menu_playback_dsp_nag_mode) {
-				unsigned char wp = wav_playing;
-				if (wp) stop_play();
-				if (sb_card->dsp_nag_mode && sb_card->dsp_nag_hispeed) {
-					sb_card->dsp_nag_mode = sb_card->dsp_nag_hispeed = 0;
-				}
-				else if (sb_card->dsp_nag_mode) {
-					sb_card->dsp_nag_mode = sb_card->dsp_nag_hispeed = 1;
-				}
-				else {
-					sb_card->dsp_nag_hispeed = 0;
-					sb_card->dsp_nag_mode = 1;
-				}
-				update_cfg();
-				ui_anim(1);
-				if (wp) begin_play();
-			}
-			else if (mitem == &main_menu_playback_dsp4_fifo_single) {
-				unsigned char wp = wav_playing;
-				if (wp) stop_play();
-				sb_card->dsp_4xx_fifo_single_cycle = !sb_card->dsp_4xx_fifo_single_cycle;
-				update_cfg();
-				ui_anim(1);
-				if (wp) begin_play();
-			}
-			else if (mitem == &main_menu_playback_force_hispeed) {
-				unsigned char wp = wav_playing;
-				if (wp) stop_play();
-				sb_card->force_hispeed = !sb_card->force_hispeed;
-				update_cfg();
-				ui_anim(1);
-				if (wp) begin_play();
-			}
-			else if (mitem == &main_menu_playback_flip_sign) {
-				unsigned char wp = wav_playing;
-				if (wp) stop_play();
-				sb_card->audio_data_flipped_sign = !sb_card->audio_data_flipped_sign;
-				update_cfg();
-				ui_anim(1);
-				if (wp) begin_play();
-			}
-#endif
-			else if (mitem == &main_menu_playback_goldplay) {
-				unsigned char wp = wav_playing;
-				if (wp) stop_play();
-				sb_card->goldplay_mode = !sb_card->goldplay_mode;
-#if TARGET_MSDOS == 32
-				if (!irq_0_had_warned && sb_card->goldplay_mode) {
-					/* NOTE TO SELF: It can overwhelm the UI in DOSBox too, but DOSBox seems able to
-					   recover if you manage to hit CTRL+F12 to speed up the CPU cycles in the virtual machine.
-					   On real hardware, even with the recovery method the machine remains hung :( */
-					if (confirm_yes_no_dialog(dos32_irq_0_warning))
-						irq_0_had_warned = 1;
-					else
-						sb_card->goldplay_mode = 0;
-				}
-#endif
-				update_cfg();
-				ui_anim(1);
-				if (wp) begin_play();
-			}
-			else if (mitem == &main_menu_playback_goldplay_mode) {
-				unsigned char wp = wav_playing;
-				if (wp) stop_play();
-				if (++goldplay_samplerate_choice > GOLDRATE_MAX)
-					goldplay_samplerate_choice = GOLDRATE_MATCH;
-				update_cfg();
-				ui_anim(1);
-				if (wp) begin_play();
-			}
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__))) /* this is too much to cram into a small model EXE */
-			else if (mitem == &main_menu_windows_fullscreen) {
-				/* NTS: Does not seem to work under Windows XP */
-				if (windows_mode == WINDOWS_ENHANCED || windows_mode == WINDOWS_STANDARD) {
-					__asm {
-						mov	ax,0x168B
-						xor	bx,bx
-						int	0x2F
-					}
-				}
-				else {
-					struct vga_msg_box box;
-
-					vga_msg_box_create(&box,
-						windows_mode == WINDOWS_NONE ?
-						"Windows is not running" :
-						"Windows NT not supported"
-						,0,0);
-					while (1) {
-						ui_anim(0);
-						if (kbhit()) {
-							i = getch();
-							if (i == 0) i = getch() << 8;
-							if (i == 13 || i == 27) break;
-						}
-					}
-					vga_msg_box_destroy(&box);
-				}
-			}
-			else if (mitem == &main_menu_playback_noreset_adpcm) {
-				unsigned char wp = wav_playing;
-				if (wp) stop_play();
-				adpcm_do_reset_interval = !adpcm_do_reset_interval;
-				update_cfg();
-				if (wp) begin_play();
-			}
-			else if (mitem == &main_menu_playback_timer_clamp) {
-				unsigned char wp = wav_playing;
-				if (wp) stop_play();
-				sample_rate_timer_clamp = !sample_rate_timer_clamp;
-				update_cfg();
-				if (wp) begin_play();
-			}
 #endif
 			else if (mitem == &main_menu_playback_dsp_autoinit_dma) {
 				unsigned char wp = wav_playing;
@@ -3327,24 +2163,6 @@
 				bkgndredraw = 1;
 				redraw = 1;
 			}
-#if !(TARGET_MSDOS == 16 && (defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__))) /* this is too much to cram into a small model EXE */
-			else if (mitem == &main_menu_playback_autoinit_adpcm) {
-				unsigned char wp = wav_playing;
-				if (do_adpcm_ai_warning) {
-					if (adpcm_warning_prompt()) {
-						do_adpcm_ai_warning = 0;
-						if (wp) stop_play();
-						sb_card->enable_adpcm_autoinit ^= 1;
-						if (wp) begin_play();
-					}
-				}
-				else {
-					if (wp) stop_play();
-					sb_card->enable_adpcm_autoinit ^= 1;
-					if (wp) begin_play();
-				}
-			}
-#endif
 			else if (mitem == &main_menu_device_trigger_irq) {
 				unsigned char wp = wav_playing;
 				struct vga_msg_box box;
@@ -3552,11 +2370,9 @@
 				}
 			}
 			else if (i == ' ') {
-				if (!wav_record) {
-					if (wav_playing) stop_play();
-					else begin_play();
-				}
-			}
+                if (wav_playing) stop_play();
+                else begin_play();
+            }
 			else if (i == 0x4B00) {
 				unsigned char wp = wav_playing;
 				if (wp) stop_play();


added space

added space

--- ir/be/beuses.c
+++ ir/be/beuses.c
@@ -178,7 +178,7 @@
 				 * Spills/Reloads are a special case, they're not really a
 				 * usage of a value, continue searching
 				 */
-				if(be_is_Spill(node) || be_is_Reload(node)) {
+				if (be_is_Spill(node) || be_is_Reload(node)) {
 					return be_get_next_use(env, node, step, node, 1);
 				}


add missing cases in graph property dumper

--- ir/ir/irdump.c
+++ ir/ir/irdump.c
@@ -1499,6 +1499,8 @@
 		fprintf(F, " no_critical_edges");
 	if (irg_has_properties(irg, IR_GRAPH_PROPERTY_NO_BADS))
 		fprintf(F, " no_bads");
+	if (irg_has_properties(irg, IR_GRAPH_PROPERTY_NO_TUPLES))
+		fprintf(F, " no_tuples");
 	if (irg_has_properties(irg, IR_GRAPH_PROPERTY_NO_UNREACHABLE_CODE))
 		fprintf(F, " no_unreachable_code");
 	if (irg_has_properties(irg, IR_GRAPH_PROPERTY_ONE_RETURN))
@@ -1507,6 +1509,8 @@
 		fprintf(F, " consistent_dominance");
 	if (irg_has_properties(irg, IR_GRAPH_PROPERTY_CONSISTENT_POSTDOMINANCE))
 		fprintf(F, " consistent_postdominance");
+	if (irg_has_properties(irg, IR_GRAPH_PROPERTY_CONSISTENT_DOMINANCE_FRONTIERS))
+		fprintf(F, " consistent_dominance_frontiers");
 	if (irg_has_properties(irg, IR_GRAPH_PROPERTY_CONSISTENT_OUT_EDGES))
 		fprintf(F, " consistent_out_edges");
 	if (irg_has_properties(irg, IR_GRAPH_PROPERTY_CONSISTENT_OUTS))
@@ -1515,6 +1519,8 @@
 		fprintf(F, " consistent_loopinfo");
 	if (irg_has_properties(irg, IR_GRAPH_PROPERTY_CONSISTENT_ENTITY_USAGE))
 		fprintf(F, " consistent_entity_usage");
+	if (irg_has_properties(irg, IR_GRAPH_PROPERTY_MANY_RETURNS))
+		fprintf(F, " many_returns");
 	fprintf(F, "\"\n");
 }


Avoid errors with buggy preprocessors

Avoid errors with buggy preprocessors

--- extra/config/lkc_proto.h
+++ extra/config/lkc_proto.h
@@ -5,7 +5,7 @@
 P(conf_write,int,(const char *name));

 /* menu.c */
-P(rootmenu,struct menu,);
+extern struct menu rootmenu;

 P(menu_is_visible,bool,(struct menu *menu));
 P(menu_get_prompt,const char *,(struct menu *menu));
@@ -14,7 +14,7 @@

 /* symbol.c */
 P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
-P(sym_change_count,int,);
+extern int sym_change_count;

 P(sym_lookup,struct symbol *,(const char *name, int isconst));
 P(sym_find,struct symbol *,(const char *name));


IA32-Backend expects that the irg has a iro_* to opcode mapping. Ensure that by an additional assert.

[r14199]

--- ir/ir/irprog.c
+++ ir/ir/irprog.c
@@ -297,6 +297,7 @@
 void add_irp_opcode(ir_op *opcode) {
   assert(opcode != NULL);
   assert(irp);
+  assert(opcode->code == ARR_LEN(irp->opcodes) && "new_ir_op() called in wrong order");
   ARR_APP1(ir_op *, irp->opcodes, opcode);
 }


Initialize all the fields of the rtp_xr_voip_metrics_report_block_t structure.

--- src/rtcp_xr.c
+++ src/rtcp_xr.c
@@ -160,6 +160,7 @@
 	block->bh.length = htons(8);
 	block->ssrc = htonl(rtp_session_get_recv_ssrc(session));
 	block->gmin = RTCP_XR_GMIN;
+	block->reserved2 = 0;

 	// Fill RX config
 	block->rx_config = 0;


unroll by a given factor

unroll by a given factor

--- ir/opt/loop2.c
+++ ir/opt/loop2.c
@@ -5,6 +5,17 @@
 #include <assert.h>

 DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
+
+static void add_edge(ir_node *const node, ir_node *const pred)
+{
+	int       const arity = get_irn_arity(node);
+	ir_node **const in    = ALLOCAN(ir_node *, arity + 1);
+	for (int i = 0; i < arity; ++i) {
+		in[i] = get_irn_n(node, i);
+	}
+	in[arity] = pred;
+	set_irn_in(node, arity + 1, in);
+}

 static bool is_inner_loop(ir_loop *const outer_loop, ir_loop *inner_loop)
 {
@@ -71,6 +82,9 @@
 	ir_node *const new_node = exact_copy(node);
 	if (!is_Block(new_node))
 		set_nodes_block(new_node, new_block);
+	ir_node *const link = get_irn_link(node);
+	if (link)
+		set_irn_link(link, new_node);
 	set_irn_link(node, new_node);
 	set_irn_link(new_node, node);
 	DB((dbg, LEVEL_3, "duplicating node %N (%n), new node %N\n", node, node, new_node));
@@ -94,43 +108,26 @@
 	set_irn_in(phi, new_arity, in);
 }

-static void rewire_successor_block(ir_node *const block)
-{
-	if (irn_visited(block))
-		return;
-
-	int const arity = get_irn_arity(block);
-
-	// find the new arity
-	int new_arity = arity;
-	for (int i = 0; i < arity; ++i) {
-		ir_node *const pred_block     = get_irn_n(block, i);
-		ir_node *const new_pred_block = get_irn_link(pred_block);
-		if (new_pred_block && new_pred_block != pred_block)
-			++new_arity;
-	}
+static void rewire_successor_block(ir_node *const block, int n)
+{
+	ir_node *const node     = get_irn_n(block, n);
+	ir_node *const new_node = get_irn_link(node);
+	assert(new_node);
+	add_edge(block, new_node);

 	// rewire phis inside the block
 	unsigned int const n_outs = get_irn_n_outs(block);
 	for (unsigned int i = 0; i < n_outs; ++i) {
-		ir_node *const node = get_irn_out(block, i);
-		if (is_Phi(node))
-			rewire_successor_phi(node, block, arity, new_arity);
-	}
-
-	ir_node **const in = ALLOCAN(ir_node *, new_arity);
-	for (int i = 0, j = arity; i < arity; ++i) {
-		ir_node *const pred_block     = get_irn_n(block, i);
-		ir_node *const new_pred_block = get_irn_link(pred_block);
-
-		in[i] = pred_block;
-		if (new_pred_block && new_pred_block != pred_block) {
-			in[j++] = new_pred_block;
-		}
-	}
-	set_irn_in(block, new_arity, in);
-
-	mark_irn_visited(block);
+		ir_node *const phi = get_irn_out(block, i);
+		if (is_Phi(phi)) {
+			ir_node *const pred     = get_irn_n(phi, n);
+			ir_node       *new_pred = get_irn_link(pred);
+			if (new_pred == NULL) {
+				new_pred = pred;
+			}
+			add_edge(phi, new_pred);
+		}
+	}
 }

 static void rewire_node(ir_node *const node, ir_node *const header)
@@ -142,9 +139,13 @@
 	// rewire the successors outside the loop
 	unsigned int const n_outs = get_irn_n_outs(node);
 	for (unsigned int i = 0; i < n_outs; ++i) {
-		ir_node *const succ = get_irn_out(node, i);
+		int n;
+		ir_node *const succ = get_irn_out_ex(node, i, &n);
 		if (get_irn_link(succ) == NULL && is_Block(succ)) {
-			rewire_successor_block(succ);
+			rewire_successor_block(succ, n);
+		} else if (is_End(succ)) {
+			assert(get_irn_link(succ) == NULL);
+			add_End_keepalive(succ, new_node);
 		}
 	}

@@ -252,7 +253,7 @@
 	}
 }

-static void duplicate_loop(ir_loop *const loop)
+static void duplicate_loop(ir_loop *const loop, int factor)
 {
 	ir_node *const header = get_loop_header(loop);
 	if (header == NULL)
@@ -262,25 +263,28 @@
 	irg_walk_graph(get_irn_irg(header), firm_clear_link, NULL, NULL);
 	size_t const n_elements = get_loop_n_elements(loop);

-	// step 1: duplicate blocks
-	for (size_t i = 0; i < n_elements; ++i) {
-		loop_element const element = get_loop_element(loop, i);
-		if (*element.kind == k_ir_node) {
-			assert(is_Block(element.node));
-			duplicate_block(element.node);
-		}
-	}
-
-	// step 2: rewire the edges
-	inc_irg_visited(get_irn_irg(header));
-	for (size_t i = 0; i < n_elements; ++i) {
-		loop_element const element = get_loop_element(loop, i);
-		if (*element.kind == k_ir_node) {
-			assert(is_Block(element.node));
-			rewire_block(element.node, header);
-		}
-	}
-	rewire_keepalives(header);
+	for (int j = 0; j < factor; ++j) {
+
+		// step 1: duplicate blocks
+		for (size_t i = 0; i < n_elements; ++i) {
+			loop_element const element = get_loop_element(loop, i);
+			if (*element.kind == k_ir_node) {
+				assert(is_Block(element.node));
+				duplicate_block(element.node);
+			}
+		}
+
+		// step 2: rewire the edges
+		inc_irg_visited(get_irn_irg(header));
+		for (size_t i = 0; i < n_elements; ++i) {
+			loop_element const element = get_loop_element(loop, i);
+			if (*element.kind == k_ir_node) {
+				assert(is_Block(element.node));
+				rewire_block(element.node, header);
+			}
+		}
+
+	}
 }

 static void duplicate_innermost_loops(ir_loop *const loop, bool const outermost)
@@ -295,7 +299,7 @@
 		}
 	}
 	if (innermost && !outermost)
-		duplicate_loop(loop);
+		duplicate_loop(loop, 2);
 }

 void do_loop_unrolling2(ir_graph *const irg)


Forward-declare PaUtilRingBuffer

Forward-declare PaUtilRingBuffer

This is not strictly necessary but it helped the static analyzer in my
editor ...

--- src/rtmixer.h
+++ src/rtmixer.h
@@ -5,6 +5,7 @@
 /* End of declarations from portaudio.h */

 typedef unsigned long frame_t;
+typedef struct PaUtilRingBuffer PaUtilRingBuffer;
 typedef _Bool bool;
 #define true 1
 #define false 0


encode: initialize quantizer before testing if it's lossless

Fixes regression from de66f0b61c64d9e45aec85497959865b8c52c5cb

ntt-short1:
          LOW (%)  MEDIUM (%) HIGH (%)
    PSNR  0.078507  -2.696097  -2.828273
 PSNRHVS -4.092946  -6.079513  -4.700105
    SSIM -9.190285  -9.359456  -6.507524
FASTSSIM -20.656195 -17.598520 -11.446769

--- src/encode.c
+++ src/encode.c
@@ -3013,6 +3013,7 @@
   int nplanes;
   int pli;
   int use_masking;
+  int gop_quantizer;
   od_mb_enc_ctx mbctx;
   daala_image *ref_img;
   OD_RETURN_CHECK(enc, OD_EFAULT);
@@ -3076,7 +3077,35 @@
   }
   /* FIXME: This should be dynamic */
   mbctx.use_activity_masking = enc->use_activity_masking;
+  /*Quantizers must be initialized before using OD_LOSSLESS().*/
   mbctx.qm = enc->qm;
+  enc->state.coded_quantizer =
+   od_quantizer_to_codedquantizer(od_quantizer_from_quality(enc->quality));
+  /*Don't modulate gop_quantizer because we'll use the same QMs for every
+     frame until the next keyframe.*/
+  gop_quantizer = enc->state.quantizer =
+   od_codedquantizer_to_quantizer(enc->state.coded_quantizer);
+  /*Modulate frame QP.*/
+  if (enc->state.coded_quantizer != 0) {
+    if (frame_type == OD_I_FRAME || mbctx.is_golden_frame) {
+      enc->state.coded_quantizer =
+       OD_MAXI(1, enc->state.coded_quantizer + OD_DQP_I);
+      enc->state.quantizer =
+       od_codedquantizer_to_quantizer(enc->state.coded_quantizer);
+    }
+    if (frame_type == OD_P_FRAME && !mbctx.is_golden_frame) {
+      enc->state.coded_quantizer = OD_MINI(OD_N_CODED_QUANTIZERS - 2,
+       (int)(enc->state.coded_quantizer*OD_MQP_P) + OD_DQP_P);
+      enc->state.quantizer =
+       od_codedquantizer_to_quantizer(enc->state.coded_quantizer);
+    }
+    if (frame_type == OD_B_FRAME) {
+      enc->state.coded_quantizer = OD_MINI(OD_N_CODED_QUANTIZERS - 2,
+       (int)(enc->state.coded_quantizer*OD_MQP_B) + OD_DQP_B);
+      enc->state.quantizer =
+       od_codedquantizer_to_quantizer(enc->state.coded_quantizer);
+    }
+  }
   /* Use Haar for lossless since 1) it's more efficient than the DCT and 2)
      PVQ isn't lossless. We only look at luma quality based on the assumption
      that it's silly to have just some planes be lossless. */
@@ -3105,15 +3134,11 @@
   od_ec_encode_bool_q15(&enc->ec, mbctx.qm, 16384);
   od_ec_encode_bool_q15(&enc->ec, mbctx.use_haar_wavelet, 16384);
   od_ec_encode_bool_q15(&enc->ec, mbctx.is_golden_frame, 16384);
-  enc->state.coded_quantizer =
-   od_quantizer_to_codedquantizer(od_quantizer_from_quality(enc->quality));
-  enc->state.quantizer =
-   od_codedquantizer_to_quantizer(enc->state.coded_quantizer);
   if (mbctx.is_keyframe) {
     for (pli = 0; pli < nplanes; pli++) {
       int i;
       int q;
-      q = enc->state.quantizer;
+      q = gop_quantizer;
       if (q <= OD_DEFAULT_QMS[use_masking][0][pli].interp_q << OD_COEFF_SHIFT) {
         od_interp_qm(&enc->state.pvq_qm_q4[pli][0], q,
          &OD_DEFAULT_QMS[use_masking][0][pli], NULL);
@@ -3135,27 +3160,6 @@
       for (i = 0; i < OD_QM_SIZE; i++) {
         od_ec_enc_bits(&enc->ec, enc->state.pvq_qm_q4[pli][i], 8);
       }
-    }
-  }
-  /*Modulate frame QP.*/
-  if (enc->state.coded_quantizer != 0) {
-    if (frame_type == OD_I_FRAME || mbctx.is_golden_frame) {
-      enc->state.coded_quantizer =
-       OD_MAXI(1, enc->state.coded_quantizer + OD_DQP_I);
-      enc->state.quantizer =
-       od_codedquantizer_to_quantizer(enc->state.coded_quantizer);
-    }
-    if (frame_type == OD_P_FRAME && !mbctx.is_golden_frame) {
-      enc->state.coded_quantizer = OD_MINI(OD_N_CODED_QUANTIZERS - 2,
-       (int)(enc->state.coded_quantizer*OD_MQP_P) + OD_DQP_P);
-      enc->state.quantizer =
-       od_codedquantizer_to_quantizer(enc->state.coded_quantizer);
-    }
-    if (frame_type == OD_B_FRAME) {
-      enc->state.coded_quantizer = OD_MINI(OD_N_CODED_QUANTIZERS - 2,
-       (int)(enc->state.coded_quantizer*OD_MQP_B) + OD_DQP_B);
-      enc->state.quantizer =
-       od_codedquantizer_to_quantizer(enc->state.coded_quantizer);
     }
   }
   OD_LOG((OD_LOG_ENCODER, OD_LOG_INFO, "is_keyframe=%d", mbctx.is_keyframe));


added missing include

added missing include

[r7059]

--- ir/tr/tpop_t.h
+++ ir/tr/tpop_t.h
@@ -11,6 +11,8 @@
  */
 #ifndef _TPOP_T_H_
 #define _TPOP_T_H_
+
+#include <stdlib.h>

 #include "firm_types.h"
 #include "tpop.h"


adding some information to engine.c

adding some information to engine.c

--- src/engine.c
+++ src/engine.c
@@ -160,7 +160,7 @@
 	optarg = _optarg;

 	// configure remote content
-	athread_remote_init(user_argc, user_argv);
+	athread_remote_init(*user_argc, *user_argv);
 	athread_remote_slave_status();

 	return 0;


isl_coalesce.c: set_up_substitutions: plug memory leak on error path

Signed-off-by: Sven Verdoolaege <e5350bbed4977f5eb8ae1dc6abd9ae59d21ace75@kotnet.org>

--- isl_coalesce.c
+++ isl_coalesce.c
@@ -2119,6 +2119,7 @@

 	return list;
 error:
+	isl_aff_free(aff_nan);
 	isl_local_space_free(ls);
 	isl_basic_set_free(wrap_hull);
 	isl_aff_list_free(list);