Fix a comment in memstat.h: errors are associated with memory type lists,
not individual types.

Submitted by:	Bryan Venteicher <bryanv at daemoninthecloset dot org>
MFC after:	3 days

--- lib/libmemstat/memstat.h
+++ lib/libmemstat/memstat.h
@@ -64,7 +64,7 @@
  * Library error conditions, mostly from the underlying data sources.  On
  * failure, functions typically return (-1) or (NULL); on success, (0) or a
  * valid data pointer.  The error from the last operation is stored in
- * struct memory_type, and accessed via memstat_get_error(mtp).
+ * struct memory_type_list, and accessed via memstat_get_error(list).
  */
 #define	MEMSTAT_ERROR_UNDEFINED		0	/* Initialization value. */
 #define	MEMSTAT_ERROR_NOMEMORY		1	/* Out of memory. */


kni: ignore double initialization

kni: ignore double initialization

Prevent double initialization of the KNI subsytem.

Signed-off-by: Marc Sune <8ac2233f04d2956a682020530ebe37f0d9d46630@bisdn.de>
Acked-by: Helin Zhang <aba9dfdb1a6ec8bf1ff66b95272c029f8dfde1b1@intel.com>

--- lib/librte_kni/rte_kni.c
+++ lib/librte_kni/rte_kni.c
@@ -201,6 +201,12 @@
 	char obj_name[OBJNAMSIZ];
 	char mz_name[RTE_MEMZONE_NAMESIZE];

+	/* Immediately return if KNI is already initialized */
+	if (kni_memzone_pool.initialized) {
+		RTE_LOG(WARNING, KNI, "Double call to rte_kni_init()");
+		return;
+	}
+
 	if (max_kni_ifaces == 0) {
 		RTE_LOG(ERR, KNI, "Invalid number of max_kni_ifaces %d\n",
 							max_kni_ifaces);


mesa: add missing null check in _mesa_NewHashTable()

Signed-off-by: Juha-Pekka Heikkila <cab67866509becb852d2a4e6f7e5924ad04fb975@gmail.com>
Reviewed-by: Ian Romanick <2b237cafb16dc45038e85df6c85e74e6d899eba9@intel.com>

--- src/mesa/main/hash.c
+++ src/mesa/main/hash.c
@@ -115,10 +115,20 @@

    if (table) {
       table->ht = _mesa_hash_table_create(NULL, uint_key_compare);
+      if (table->ht == NULL) {
+         free(table);
+         _mesa_error_no_memory(__func__);
+         return NULL;
+      }
+
       _mesa_hash_table_set_deleted_key(table->ht, uint_key(DELETED_KEY_VALUE));
       mtx_init(&table->Mutex, mtx_plain);
       mtx_init(&table->WalkMutex, mtx_plain);
    }
+   else {
+      _mesa_error_no_memory(__func__);
+   }
+
    return table;
 }


minor comments

minor comments

--- src/metaflac/usage.c
+++ src/metaflac/usage.c
@@ -161,7 +161,7 @@
 	fprintf(out, "       #s : a seekpoint every # seconds; # does not have to be a whole number\n");
 	fprintf(out, "                      If no SEEKTABLE block exists, one will be created.  If\n");
 	fprintf(out, "                      one already exists, points will be added to the existing\n");
-	fprintf(out, "                      table, and duplicates will be turned into placeholder\n");
+	fprintf(out, "                      table, and any duplicates will be turned into placeholder\n");
 	fprintf(out, "                      points.  You may use many --add-seekpoint options; the\n");
 	fprintf(out, "                      resulting SEEKTABLE will be the unique-ified union of\n");
 	fprintf(out, "                      all such values.  Example: --add-seekpoint=100x\n");


disable writeevents test for now

disable writeevents test for now

--- src/es_proto_helper.c
+++ src/es_proto_helper.c
@@ -605,7 +605,7 @@
         (NULL == CU_add_test(pSuite, "test proto ReadEvent", test_read_event))||
         (NULL == CU_add_test(pSuite, "test proto DeletePersistentSubscription", test_delete_persistent_subscription))||
         (NULL == CU_add_test(pSuite, "test proto TransactionCommit", test_transaction_commit))||
-        (NULL == CU_add_test(pSuite, "test proto WriteEvents", test_write_events))||
+        //(NULL == CU_add_test(pSuite, "test proto WriteEvents", test_write_events))||
         0)
     {
        CU_cleanup_registry();


minor cleanup

minor cleanup

--- libs/fudge/memory.c
+++ libs/fudge/memory.c
@@ -29,14 +29,13 @@
 {

     const char *ip = in1;
-    unsigned int count;

     if (count2 > count1)
         return 0;

-    count = count1 - count2 + 1;
+    count1 -= count2 + 1;

-    for (; count; count--)
+    for (; count1; count1--)
     {

         if (memory_match(ip, in2, count2))


Refactored generate() for pairs. (#1501)

Refactored `generate()` for pairs to introduce `toJSON()`, for cases
where we just want to generate the body of a JSON object.

--- ir/json_generator.h
+++ ir/json_generator.h
@@ -80,11 +80,18 @@

     template<typename T, typename U>
     void generate(const std::pair<T, U> &v) {
-        out << "{" << std::endl << ++indent << "\"first\" : ";
+        ++indent;
+        out << "{" << std::endl;
+        toJSON(v);
+        out << std::endl << --indent << "}";
+    }
+
+    template<typename T, typename U>
+    void toJSON(const std::pair<T, U> &v) {
+        out << indent << "\"first\" : ";
         generate(v.first);
         out << "," << std::endl << indent << "\"second\" : ";
         generate(v.second);
-        out << std::endl << --indent << "}";
     }

     template<typename T>


THE END

THE END

--- lifepod/MyProject.c
+++ lifepod/MyProject.c
@@ -695,10 +695,11 @@

   ADCON1 = 0X06;

-  TRISB = 255;         // entrada
-  TRISC = 0b11110000;  // alto entrada, baixo saida
+  TRISB = 0b11111101;
+  PORTB.F1 = 0;
+  TRISC = 0b11110000;
   PORTC = 0;
-  TRISD = 0;           // saida
+  TRISD = 0;

   // liga LCD
   Lcd_Init();
@@ -719,14 +720,17 @@
   strcpy(disp1, "Aperte YEARS (9)");

   do {
+    PORTB.F1 = 0;
     if(!tratou_key) {
       tratou_key = 1;
+      PORTB.F1 = 1;
       GotKey(tecla);
     }

     if (rfid_enabled) {
       if (MFRC522_isCard(&TagType)) {
         if (MFRC522_ReadCardSerial(&UID)) {
+          PORTB.F1 = 1;
           if (UID[0] == PLAYER1) {
             GotCard(0);
           } else if (UID[0] == PLAYER2) {


Fix null checks in fann_scale_output and fann_descale_output.

These functions checked scale_mean_in for null, but then proceeded to
use scale_mean_out. This was not problematic (since both are always
allocated in tandem), but highly illogical.

--- src/fann_train_data.c
+++ src/fann_train_data.c
@@ -1044,7 +1044,7 @@
 FANN_EXTERNAL void FANN_API fann_scale_output( struct fann *ann, fann_type *output_vector )
 {
 	unsigned cur_neuron;
-	if(ann->scale_mean_in == NULL)
+	if(ann->scale_mean_out == NULL)
 	{
 		fann_error( (struct fann_error *) ann, FANN_E_SCALE_NOT_PRESENT );
 		return;
@@ -1095,7 +1095,7 @@
 FANN_EXTERNAL void FANN_API fann_descale_output( struct fann *ann, fann_type *output_vector )
 {
 	unsigned cur_neuron;
-	if(ann->scale_mean_in == NULL)
+	if(ann->scale_mean_out == NULL)
 	{
 		fann_error( (struct fann_error *) ann, FANN_E_SCALE_NOT_PRESENT );
 		return;


fetch-pack: avoid repeatedly re-scanning pack directory

When we look up a sha1 object for reading via parse_object() =>
read_sha1_file() => read_object() callpath, we first check
packfiles, and then loose objects. If we still haven't found it, we
re-scan the list of packfiles in `objects/pack`. This final step
ensures that we can co-exist with a simultaneous repack process
which creates a new pack and then prunes the old object.

This extra re-scan usually does not have a performance impact for
two reasons:

  1. If an object is missing, then typically the re-scan will find a
     new pack, then no more misses will occur.  Or if it truly is
     missing, then our next step is usually to die().

  2. Re-scanning is cheap enough that we do not even notice.

However, these do not always hold. The assumption in (1) is that the
caller is expecting to find the object. This is usually the case,
but the call to `parse_object` in `everything_local` does not follow
this pattern. It is looking to see whether we have objects that the
remote side is advertising, not something we expect to
have. Therefore if we are fetching from a remote which has many refs
pointing to objects we do not have, we may end up re-scanning the
pack directory many times.

Even with this extra re-scanning, the impact is often not noticeable
due to (2); we just readdir() the packs directory and skip any packs
that are already loaded. However, if there are a large number of
packs, even enumerating the directory can be expensive, especially
if we do it repeatedly.

Having this many packs is a good sign the user should run `git gc`,
but it would still be nice to avoid having to scan the directory at
all.

Signed-off-by: Jeff King <696e3fbcf235d40b6ea1ebd61c87cbea79d444e7@peff.net>
Signed-off-by: Junio C Hamano <a6723cc3f76163bf7adb636a73ac3b0ceb3e6b9b@pobox.com>

--- builtin/fetch-pack.c
+++ builtin/fetch-pack.c
@@ -610,6 +610,9 @@
 	for (ref = *refs; ref; ref = ref->next) {
 		struct object *o;

+		if (!has_sha1_file(ref->old_sha1))
+			continue;
+
 		o = parse_object(ref->old_sha1);
 		if (!o)
 			continue;


fidlink() needs to pass back a vnode pointer for the open case soon, hence the prototype change

git-svn-id: a2d12f8ba5efd9a6cf770ee2a6d40c767093e4df@10379 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- zfs-fuse-0.5.0_slash/src/zfs-fuse/zfs_operations_slash.c
+++ zfs-fuse-0.5.0_slash/src/zfs-fuse/zfs_operations_slash.c
@@ -526,7 +526,7 @@
  * created.  We do this when we format the file system.
  */
 int
-zfsslash2_fidlink(zfsvfs_t *zfsvfs, vnode_t *linkvp, uint64_t linkid, int flags)
+zfsslash2_fidlink(zfsvfs_t *zfsvfs, vnode_t **linkvp, uint64_t linkid, int flags)
 {
 	int		i;
 	uint8_t		c;
@@ -538,7 +538,7 @@
 	char		id_name[20];
 	cred_t		creds = {0, 0};

-	ASSERT(linkvp);
+	ASSERT(*linkvp);
 	error = zfs_zget(zfsvfs, 3, &znode, B_TRUE);
 	if (error)
 		return error == EEXIST ? ENOENT : error;
@@ -563,9 +563,9 @@
 	id_name[1] = '\0';

 #ifdef NAMESPACE_EXPERIMENTAL
-	slashid = (uint64_t)VTOZ(linkvp)->z_fid & ((1ULL << SLASH_ID_FID_BITS) - 1);
+	slashid = (uint64_t)VTOZ(*linkvp)->z_fid & ((1ULL << SLASH_ID_FID_BITS) - 1);
 #else
-	slashid = (uint64_t)VTOZ(linkvp)->z_id;
+	slashid = (uint64_t)VTOZ(*linkvp)->z_id;
 #endif

 	for (i = 0; i < FID_PATH_DEPTH; i++, VN_RELE(dvp), dvp=vp) {
@@ -604,7 +604,7 @@
 	    case FIDLINK_OPEN:
 		break;
 	    case FIDLINK_CREATE:
-		error = VOP_LINK(vp, linkvp, (char *)id_name, &creds, NULL, FALLOWDIRLINK);
+		error = VOP_LINK(vp, *linkvp, (char *)id_name, &creds, NULL, FALLOWDIRLINK);
 		break;
 	    case FIDLINK_REMOVE:
 		error = VOP_REMOVE(vp, (char *)id_name, &creds, NULL, 0);
@@ -724,7 +724,7 @@
 		VN_RELE(vp);
 		vp = new_vp;

-		if ((error = zfsslash2_fidlink(zfsvfs, vp, FID_ANY, FIDLINK_CREATE)))
+		if ((error = zfsslash2_fidlink(zfsvfs, &vp, FID_ANY, FIDLINK_CREATE)))
 			goto out;
 	} else {
 		/*
@@ -960,7 +960,7 @@

 	/* we only suppress fid link when called from mds_repl_scandir() */
 	if (flags == 0) {
-		error = zfsslash2_fidlink(zfsvfs, vp, FID_ANY, FIDLINK_CREATE);
+		error = zfsslash2_fidlink(zfsvfs, &vp, FID_ANY, FIDLINK_CREATE);
 	}

 	if (fg) {
@@ -1264,7 +1264,7 @@
 		goto out;
 	}

-	error = zfsslash2_fidlink(zfsvfs, vp, FID_ANY, FIDLINK_REMOVE);
+	error = zfsslash2_fidlink(zfsvfs, &vp, FID_ANY, FIDLINK_REMOVE);
 	VN_RELE(vp);
  out:
 	VN_RELE(dvp);


fetch-pack: sort incoming heads

fetch-pack: sort incoming heads

There's no reason to preserve the incoming order of the
heads we're requested to fetch. By having them sorted, we
can replace some of the quadratic algorithms with linear
ones.

Signed-off-by: Jeff King <696e3fbcf235d40b6ea1ebd61c87cbea79d444e7@peff.net>
Signed-off-by: Junio C Hamano <a6723cc3f76163bf7adb636a73ac3b0ceb3e6b9b@pobox.com>

--- builtin/fetch-pack.c
+++ builtin/fetch-pack.c
@@ -1057,6 +1057,11 @@
 	return ret;
 }

+static int compare_heads(const void *a, const void *b)
+{
+	return strcmp(*(const char **)a, *(const char **)b);
+}
+
 struct ref *fetch_pack(struct fetch_pack_args *my_args,
 		       int fd[], struct child_process *conn,
 		       const struct ref *ref,
@@ -1076,8 +1081,11 @@
 			st.st_mtime = 0;
 	}

-	if (heads && nr_heads)
+	if (heads && nr_heads) {
 		nr_heads = remove_duplicates(nr_heads, heads);
+		qsort(heads, nr_heads, sizeof(*heads), compare_heads);
+	}
+
 	if (!ref) {
 		packet_flush(fd[1]);
 		die("no matching remote head");


Create problem9.c

Create problem9.c

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

--- projecteuler/problem9.c
+++ projecteuler/problem9.c
@@ -0,0 +1,38 @@
+/*
+* Project Euler Problem #9:
+*
+* A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
+* a^2 + b^2 = c^2
+* For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
+*
+* There exists exactly one Pythagorean triplet for which a + b + c = 1000.
+* Find the product abc.
+*
+* Author: Chris Moulds
+*/
+
+
+#include <stdio.h>
+
+int main()
+{
+	int a, b, c, sum;
+
+	for (int i = 1; i < 500; i++){
+		for (int j = 1; j < 500; j++){
+			sum = 1000*i + 1000*j - (i*j);
+			if (sum == 500000){
+				a = i;
+				b = j;
+				goto calc;
+			}
+		}
+	}
+
+	calc:
+		c = 1000 - a - b;
+		c *= (a*b);
+		printf("abc: %d\n", c);
+
+	return 0;
+}


compositor: export weston_buffer_from_resource()

This is needed to allow shell plugins to implement their own
screenshooter.

--- src/compositor.c
+++ src/compositor.c
@@ -1442,7 +1442,7 @@
 	free(buffer);
 }

-struct weston_buffer *
+WL_EXPORT struct weston_buffer *
 weston_buffer_from_resource(struct wl_resource *resource)
 {
 	struct weston_buffer *buffer;


Use __stdcall convention for intermodular calls

--- listerqt/listplug.h
+++ listerqt/listplug.h
@@ -4,11 +4,7 @@
 #include <qt_windows.h>
 #include <qglobal.h>

-/* This macro magic automates import/export of normal/proxy functions.
- * The agreement is:
- * - all exported functions from user .wlx are __stdcall
- * - all exported functions from core listerqt.dll are __cdecl
- */
+/* This macro magic automates import/export of normal/proxy functions */
 #define MACRO_HELPER(x) x
 #define PLUGIN_CORE_SFX proxy_
 #define FUNC_WRAPPER_HELPER2(func, sfx) sfx ## func
@@ -17,17 +13,25 @@
 #ifdef PLUGIN_CORE
   #define FUNC_WRAPPER_EXPORT(func) FUNC_WRAPPER(func)
   #define FUNC_WRAPPER_IMPORT(func) func
-  #define CALLTYPE_EXPORT __cdecl
+  #define CALLTYPE_EXPORT __stdcall
   #define CALLTYPE_IMPORT __stdcall
-  #define EXTERN_EXPORT extern "C" Q_DECL_EXPORT
+  #ifdef CORE_STATICLIB
+    #define EXTERN_EXPORT
+  #else
+    #define EXTERN_EXPORT Q_DECL_EXPORT
+  #endif
   #define EXTERN_IMPORT
 #else
   #define FUNC_WRAPPER_EXPORT(func) func
   #define FUNC_WRAPPER_IMPORT(func) FUNC_WRAPPER(func)
   #define CALLTYPE_EXPORT __stdcall
-  #define CALLTYPE_IMPORT __cdecl
+  #define CALLTYPE_IMPORT __stdcall
   #define EXTERN_EXPORT
-  #define EXTERN_IMPORT extern "C" Q_DECL_IMPORT
+  #ifdef CORE_STATICLIB
+    #define EXTERN_IMPORT
+  #else
+    #define EXTERN_IMPORT Q_DECL_IMPORT
+  #endif
 #endif

 #define FUNC_EXPORT(func, ret) EXTERN_EXPORT ret CALLTYPE_EXPORT FUNC_WRAPPER_EXPORT(func)


we should return success down here as the command worked

--- apps/bletiny/src/cmd.c
+++ apps/bletiny/src/cmd.c
@@ -1023,7 +1023,7 @@
         return rc;
     }

-    return -1;
+    return 0;
 }

 static int


compositor: Drop setuid when launching clients

--- src/compositor.c
+++ src/compositor.c
@@ -95,6 +95,9 @@
 	/* do not give our signal mask to the new process */
 	sigfillset(&allsigs);
 	sigprocmask(SIG_UNBLOCK, &allsigs, NULL);
+
+	/* Launch clients as the user. */
+	seteuid(getuid());

 	/* SOCK_CLOEXEC closes both ends, so we dup the fd to get a
 	 * non-CLOEXEC fd to pass through exec. */


(test) Better comments for constructor

(test) Better comments for constructor

--- prometheus/prometheus.h
+++ prometheus/prometheus.h
@@ -2,7 +2,8 @@

 class PrometheusClient {
  public:
-  // Create a new prometheus client connecting to server:port.
+  // Create a new prometheus client connecting to server:port,
+  // with "job" and "instance".  (See prometheus pushgateway docs)
   PrometheusClient(const String& server,
                    const uint16_t port,
                    const String& job,


trace_processor: Clear sort queues on ForceExtract

For a 26mb trace:

Before:
RssAnon:    100648 kB
After:
RssAnon:     48688 kB
Change-Id: If52244de451718f197c71a8129aee7765c08ce90

--- src/trace_processor/trace_sorter.h
+++ src/trace_processor/trace_sorter.h
@@ -145,6 +145,7 @@
   // Extract all events ignoring the window.
   void ExtractEventsForced() {
     SortAndExtractEventsBeyondWindow(/*window_size_ns=*/0);
+    queues_.resize(0);
   }

   // Sets the window size to be the size specified (which should be lower than


set default editor font size to 14

set default editor font size to 14

--- src/configfile.c
+++ src/configfile.c
@@ -68,7 +68,7 @@
 "statusbar = True\n"
 "rightpane = True\n"
 "spell_language = None\n"
-"font = Monospace 10\n"
+"font = Monospace 14\n"
 "\n"
 "[Preview]\n"
 "zoommode = pagewidth\n"


allow mass/volume flux in RANS2P to be set relative to boundary motion

--- proteus/mprans/RANS2P.h
+++ proteus/mprans/RANS2P.h
@@ -2894,7 +2894,7 @@
 					     bc_mom_u_adv_ext,
 					     bc_mom_v_adv_ext,
 					     bc_mom_w_adv_ext,
-					     ebqe_bc_flux_mass_ext[ebNE_kb],
+					     ebqe_bc_flux_mass_ext[ebNE_kb]+MOVING_DOMAIN*(xt_ext*normal[0]+yt_ext*normal[1]+zt_ext*normal[2]),
 					     ebqe_bc_flux_mom_u_adv_ext[ebNE_kb],
 					     ebqe_bc_flux_mom_v_adv_ext[ebNE_kb],
 					     ebqe_bc_flux_mom_w_adv_ext[ebNE_kb],
@@ -4550,7 +4550,7 @@
 							bc_mom_u_adv_ext,
 							bc_mom_v_adv_ext,
 							bc_mom_w_adv_ext,
-							ebqe_bc_flux_mass_ext[ebNE_kb],
+							ebqe_bc_flux_mass_ext[ebNE_kb]+MOVING_DOMAIN*(xt_ext*normal[0]+yt_ext*normal[1]+zt_ext*normal[2]),
 							ebqe_bc_flux_mom_u_adv_ext[ebNE_kb],
 							ebqe_bc_flux_mom_v_adv_ext[ebNE_kb],
 							ebqe_bc_flux_mom_w_adv_ext[ebNE_kb],


fix deadlock in wait_while_interface_down

--- src/connection.c
+++ src/connection.c
@@ -641,18 +641,17 @@
 	close_and_unref_connection (get_global_conn());
 	set_global_conn(NULL);

-	pthread_mutex_lock(get_interface_down_mut());
 	while (!get_interface_down_event ()) {
+	  pthread_mutex_lock(get_interface_down_mut());
   	  rtn = pthread_cond_wait(get_interface_down_con(), get_interface_down_mut());
+      pthread_mutex_unlock (get_interface_down_mut());
   	  if (rtn != 0)
   	    ParodusError
   	      ("Error on pthread_cond_wait (%d) in wait_while_interface_down\n", rtn);
   	  if ((rtn != 0) || g_shutdown) {
-	    pthread_mutex_unlock (get_interface_down_mut());
 	    return -1;
 	  }
 	}
-    pthread_mutex_unlock (get_interface_down_mut());
     return 0;
 }


size value of BaseNIntegerList is now unsigned short

--- lib/BaseNIntegerList.h
+++ lib/BaseNIntegerList.h
@@ -30,7 +30,7 @@
 	ListElem* head;
 	ListElem* tail;
 	unsigned char base;
-	unsigned char size;
+	unsigned short size;
 }BaseNIntegerList;

 /**


Initial refactoring in the direction of a more event-oriented approach

--- src/connection.c
+++ src/connection.c
@@ -77,10 +77,22 @@
 }

+void on_close(struct epoll_event_handler* target)
+{
+    connection_close(target);
+}
+
+
+void on_read(struct epoll_event_handler* target, char* buffer, int len)
+{
+    connection_write(target, buffer, len);
+}
+
+
 void connection_on_close_event(struct epoll_event_handler* self)
 {
     struct connection_closure* closure = (struct connection_closure*) self->closure;
-    connection_close(closure->peer);
+    on_close(closure->peer);
     connection_close(self);
 }

@@ -101,7 +113,7 @@
             return;
         }

-        connection_write(closure->peer, read_buffer, bytes_read);
+        on_read(closure->peer, read_buffer, bytes_read);
     }
 }


pkt-gen: avoid confusing message in ponger

--- apps/pkt-gen/pkt-gen.c
+++ apps/pkt-gen/pkt-gen.c
@@ -1372,7 +1372,8 @@
 		D("can only reply ping with 1 thread");
 		return NULL;
 	}
-	D("understood ponger %lu but don't know how to do it", n);
+	if (n > 0)
+		D("understood ponger %lu but don't know how to do it", n);
 	while (!targ->cancel && (n == 0 || sent < n)) {
 		uint32_t txcur, txavail;
 //#define BUSYWAIT


Do not pass the same information twice.

Do not pass the same information twice.

--- source/view.c
+++ source/view.c
@@ -493,11 +493,10 @@

 /**
  * @param state Internal state of the menu.
- * @param mon the dimensions of the monitor rofi is displayed on.
  *
  * Calculate the width of the window and the width of an element.
  */
-static void rofi_view_calculate_window_and_element_width ( RofiViewState *state, workarea *mon )
+static void rofi_view_calculate_window_and_element_width ( RofiViewState *state )
 {
     if ( config.menu_width < 0 ) {
         double fw = textbox_get_estimated_char_width ( );
@@ -506,7 +505,7 @@
     }
     else{
         // Calculate as float to stop silly, big rounding down errors.
-        state->w = config.menu_width < 101 ? ( mon->w / 100.0f ) * ( float ) config.menu_width : config.menu_width;
+        state->w = config.menu_width < 101 ? ( state->mon.w / 100.0f ) * ( float ) config.menu_width : config.menu_width;
     }

     if ( state->columns > 0 ) {
@@ -1488,7 +1487,7 @@
         state->menu_lines = config.menu_lines;
     }
     rofi_view_calculate_rows_columns ( state );
-    rofi_view_calculate_window_and_element_width ( state, &( state->mon ) );
+    rofi_view_calculate_window_and_element_width ( state );

     // Prompt box.
     state->prompt_tb = textbox_create ( TB_AUTOWIDTH, ( state->border ), ( state->border ),
@@ -1636,7 +1635,7 @@
         main_window = __create_window ( display, MENU_NORMAL );
     }

-    rofi_view_calculate_window_and_element_width ( state, &( state->mon ) );
+    rofi_view_calculate_window_and_element_width ( state );
     state->max_elements = 0;

     state->text = textbox_create ( ( TB_AUTOHEIGHT | TB_WRAP ) + ( ( markup ) ? TB_MARKUP : 0 ),


Change version to V3.10a, turn off development only flags

--- src/Appdefs.h
+++ src/Appdefs.h
@@ -10,7 +10,7 @@
 #include "wx/wx.h"
 #include "Portability.h"

-#define MASTER_VERSION_BASE "*V3.06c"    //add asterisk prefix between releases
+#define MASTER_VERSION_BASE "V3.10a"    //add asterisk prefix between releases

 #define USING_KINGBASE
 // no suffix indicates default .tdb is kingbase
@@ -50,9 +50,9 @@
 #endif

 // Conditional compiles
-#define DURING_DEVELOPMENT		    // If defined we get a console window for cprintf()
+//#define DURING_DEVELOPMENT		    // If defined we get a console window for cprintf()
 #define AUI_NOTEBOOK				// Define this to get X close boxes on tabs
-#define NEW_TAB_LAUNCHES_TESTBED	// If defined new tab feature actually launches testbed window instead
+//#define NEW_TAB_LAUNCHES_TESTBED	// If defined new tab feature actually launches testbed window instead
 #ifndef DURING_DEVELOPMENT
 //#undef  NEW_TAB_LAUNCHES_TESTBED	// Never unless during development
 #endif


Version bump.

Version bump.

--- src/core/nginx.h
+++ src/core/nginx.h
@@ -9,8 +9,8 @@
 #define _NGINX_H_INCLUDED_

-#define nginx_version      1009014
-#define NGINX_VERSION      "1.9.14"
+#define nginx_version      1009015
+#define NGINX_VERSION      "1.9.15"
 #define NGINX_VER          "nginx/" NGINX_VERSION

 #ifdef NGX_BUILD


correct error

correct error

int declaration to void

--- src/Physics.h
+++ src/Physics.h
@@ -11,7 +11,7 @@

-int jump_manager( std::shared_ptr<sf::Sprite> sprite, float GroundLevel, int vitesseInit);
+void jump_manager( std::shared_ptr<sf::Sprite> sprite, float GroundLevel, int vitesseInit);
 class Physics {
 public:
     // add_


added new weak candidate based on wpa-sec analysis


fix errors

fix errors

--- firmware/photon_fft.h
+++ firmware/photon_fft.h
@@ -38,7 +38,6 @@
 #include <vector>
 using namespace std;

-#define M_PI 3.414
 class Fft {

 public:


Connect data channel

Connect data channel

--- health/hdp.c
+++ health/hdp.c
@@ -36,7 +36,7 @@
 #include <mcap.h>
 #include <btio.h>
 #include <mcap_lib.h>
-
+#include <l2cap.h>
 #include <sdpd.h>
 #include "../src/dbus-common.h"

@@ -66,6 +66,13 @@
 	guint			ref;
 };

+struct hdp_connect_dc {
+	DBusConnection		*conn;
+	DBusMessage		*msg;
+	struct hdp_channel	*hdp_chann;
+	guint			ref;
+};
+
 static void free_hdp_create_dc(struct hdp_create_dc *dc_data)
 {
 	dbus_message_unref(dc_data->msg);
@@ -94,6 +101,36 @@

 	free_hdp_create_dc(dc_data);
 }
+
+static void free_hdp_conn_dc(struct hdp_connect_dc *conn_data)
+{
+	dbus_message_unref(conn_data->msg);
+	dbus_connection_unref(conn_data->conn);
+
+	g_free(conn_data);
+}
+
+static struct hdp_connect_dc *hdp_conn_data_ref(struct hdp_connect_dc *conn_data)
+{
+	conn_data->ref++;
+
+	DBG("hdp_conn_data_ref(%p): ref=%d", conn_data, conn_data->ref);
+
+	return conn_data;
+}
+
+static void hdp_conn_data_unref(struct hdp_connect_dc *conn_data)
+{
+	conn_data->ref--;
+
+	DBG("hdp_conn_data_ref(%p): ref=%d", conn_data, conn_data->ref);
+
+	if (conn_data->ref > 0)
+		return;
+
+	free_hdp_conn_dc(conn_data);
+}
+
 static int cmp_app_id(gconstpointer a, gconstpointer b)
 {
 	const struct hdp_application *app = a;
@@ -629,12 +666,79 @@
 	hdp_create_data_unref(dc_data);
 }

+static void hdp_connect_dc_destroy(gpointer data)
+{
+	struct hdp_connect_dc *hdp_conn = data;
+
+	hdp_conn_data_unref(hdp_conn);
+}
+
+static void hdp_mdl_conn_cb(struct mcap_mdl *mdl, GError *err, gpointer data)
+{
+	struct hdp_connect_dc *hdp_conn =  data;
+	struct hdp_channel *hdp_chann = hdp_conn->hdp_chann;
+	DBusMessage *reply;
+
+	if (err) {
+		/* TODO: Send abort request */
+		reply = g_dbus_create_error(hdp_conn->msg,
+						ERROR_INTERFACE ".HealthError",
+						"%s", err->message);
+		g_dbus_send_message(hdp_conn->conn, reply);
+		return;
+	}
+
+	hdp_chann->mdl_conn = TRUE;
+	reply = g_dbus_create_reply(hdp_conn->msg,
+					DBUS_TYPE_OBJECT_PATH, &hdp_chann->path,
+					DBUS_TYPE_INVALID);
+	g_dbus_send_message(hdp_conn->conn, reply);
+}
+
+static void hdp_get_dcpsm_cb(uint16_t dcpsm, gpointer user_data, GError *err)
+{
+	struct hdp_connect_dc *hdp_conn = user_data;
+	struct hdp_channel *hdp_chann = hdp_conn->hdp_chann;
+	GError *gerr = NULL;
+	DBusMessage *reply;
+	uint8_t mode;
+
+	if (err) {
+		/* TODO: Send abort request */
+		reply = g_dbus_create_error(hdp_conn->msg,
+					ERROR_INTERFACE ".HealthError",
+					"%s", err->message);
+		g_dbus_send_message(hdp_conn->conn, reply);
+		return;
+	}
+
+	if (hdp_chann->config == HDP_RELIABLE_DC)
+		mode = L2CAP_MODE_ERTM;
+	else
+		mode = L2CAP_MODE_STREAMING;
+
+	if (mcap_connect_mdl(hdp_chann->mdl, mode, dcpsm, hdp_mdl_conn_cb,
+						hdp_conn_data_ref(hdp_conn),
+						hdp_connect_dc_destroy, &gerr))
+		return;
+
+	/* TODO: Send abort request */
+	reply = g_dbus_create_error(hdp_conn->msg,
+						ERROR_INTERFACE ".HealthError",
+						"%s", gerr->message);
+	g_error_free(gerr);
+	hdp_conn_data_unref(hdp_conn);
+	g_dbus_send_message(hdp_conn->conn, reply);
+}
+
 static void device_create_mdl_cb(struct mcap_mdl *mdl, uint8_t conf,
 						GError *err, gpointer data)
 {
 	struct hdp_create_dc *user_data = data;
+	struct hdp_connect_dc *hdp_conn;
 	struct hdp_channel *hdp_chann;
 	DBusMessage *reply;
+	GError *gerr = NULL;

 	if (err) {
 		reply = g_dbus_create_error(user_data->msg,
@@ -644,8 +748,10 @@
 		return;
 	}

+	/*TODO: Check config and requested config before continue */
+
 	hdp_chann = g_new0(struct hdp_channel, 1);
-	hdp_chann->config = user_data->config;
+	hdp_chann->config = conf;
 	hdp_chann->mdep = user_data->mdep;
 	hdp_chann->app = user_data->app;
 	hdp_chann->mdl = mdl;
@@ -664,16 +770,28 @@
 					ERROR_INTERFACE ".HealthError",
 					"Can't register HEALTH_CHANNEL");
 		g_dbus_send_message(user_data->conn, reply);
-		g_free(hdp_chann);
+		hdp_connect_dc_destroy(hdp_chann);
 		return;
 	}

 	user_data->dev->channels = g_slist_append(user_data->dev->channels,
 								hdp_chann);
-	/* TODO: Connect the data channel */
+	hdp_conn = g_new0(struct hdp_connect_dc, 1);
+	hdp_conn->msg = dbus_message_ref(user_data->msg);
+	hdp_conn->conn = dbus_connection_ref(user_data->conn);
+	hdp_conn->hdp_chann = hdp_chann;
+
+	if (hdp_get_dcpsm(hdp_chann->dev, hdp_get_dcpsm_cb,
+						hdp_conn_data_ref(hdp_conn),
+						hdp_connect_dc_destroy, &gerr))
+		return;
+
+	/* TODO: Send abort request */
 	reply = g_dbus_create_error(user_data->msg,
-					ERROR_INTERFACE ".HealthError",
-					"Function is not implemented");
+						ERROR_INTERFACE ".HealthError",
+						"%s", gerr->message);
+	g_error_free(gerr);
+	hdp_conn_data_unref(hdp_conn);
 	g_dbus_send_message(user_data->conn, reply);
 }


tpm2_eventlog: use same output format for EV_EFI_ACTION and EV_POST_CODE

This also avoids a potential stack smash if the event log
violates the spec and has an action string longer than
permitted.

Signed-off-by: Trammell hudson <dfb64870173313a9a7b56f814c8e3b33e268497a@trmm.net>

--- lib/tpm2_eventlog_yaml.c
+++ lib/tpm2_eventlog_yaml.c
@@ -182,10 +182,7 @@
     const size_t len = event->EventSize;

     tpm2_tool_output(
-        "  Event:\n"
-        "    - Length: %zu\n"
-        "      String: '%.*s'\n",
-        len,
+        "  Event: '%.*s'\n",
         (int) len,
         data);
     return true;
@@ -225,11 +222,7 @@
 /* TCG PC Client PFP section 9.4.4 */
 bool yaml_uefi_action(UINT8 const *action, size_t size) {

-    /* longest string permitted by spec is 47 chars */
-    char buf[50] = { '\0', };
-
-    memcpy (buf, action, size);
-    tpm2_tool_output("  Event: %s\n", buf);
+    tpm2_tool_output("  Event: '%.*s'\n", (int) size, action);

     return true;
 }


Fixed video_format_IsSimilar regarding sar.

It also fixes es_format_IsSimilar.

--- src/misc/es_format.c
+++ src/misc/es_format.c
@@ -219,6 +219,8 @@
         v1.i_visible_height != v2.i_visible_height ||
         v1.i_x_offset != v2.i_x_offset || v1.i_y_offset != v2.i_y_offset )
         return false;
+    if( v1.i_sar_num * v2.i_sar_den != v2.i_sar_num * v1.i_sar_den )
+        return false;

     if( v1.i_chroma == VLC_CODEC_RGB15 ||
         v1.i_chroma == VLC_CODEC_RGB16 ||


input: add vlc_poll_i11e() support for Linux event file descriptor

This saves one file descriptor and some kernel resources.

--- src/misc/interrupt.c
+++ src/misc/interrupt.c
@@ -32,6 +32,9 @@
 #ifdef HAVE_POLL
 #include <poll.h>
 #endif
+#ifdef HAVE_SYS_EVENTFD_H
+# include <sys/eventfd.h>
+#endif

 #include <vlc_common.h>
 #include <vlc_fs.h> /* vlc_pipe */
@@ -256,7 +259,8 @@
     int *fd = ctx->data;

     vlc_interrupt_finish(ctx);
-    close(fd[1]);
+    if (fd[1] != fd[0])
+        close(fd[1]);
     close(fd[0]);
 }

@@ -269,7 +273,14 @@
     int canc;

     /* TODO: cache this */
-    /* TODO: use eventfd on Linux */
+# if defined (HAVE_SYS_EVENTFD_H) && defined (EFD_CLOEXEC)
+    canc = vlc_savecancel();
+    fd[0] = eventfd(0, EFD_CLOEXEC);
+    vlc_restorecancel(canc);
+    if (fd[0] != -1)
+        fd[1] = fd[0];
+    else
+# endif
     if (vlc_pipe(fd))
     {
         vlc_testcancel();
@@ -314,7 +325,8 @@
     }
 out:
     canc = vlc_savecancel();
-    close(fd[1]);
+    if (fd[1] != fd[0])
+        close(fd[1]);
     close(fd[0]);
     vlc_restorecancel(canc);
     return ret;


mmap: Improve tst-mmap3.

mmap: Improve tst-mmap3.

--- src/mmap/tst-mmap3.c
+++ src/mmap/tst-mmap3.c
@@ -99,7 +99,7 @@

   close(fd2);

-  for (i = PAGE_SIZE - TEST_SIZE; i < PAGE_SIZE + TEST_SIZE; ++i)
+  for (i = PAGE_SIZE - TEST_SIZE; i < PAGE_SIZE; ++i)
   {
     if (addr[i] != buf[i])
     {
@@ -116,7 +116,7 @@

   TEST_FORK_BEGIN("child 1", 0, 0);
   {
-    for (i = PAGE_SIZE - TEST_SIZE; i < PAGE_SIZE + TEST_SIZE; ++i)
+    for (i = PAGE_SIZE; i < PAGE_SIZE + TEST_SIZE; ++i)
     {
       if (addr[i] != buf[i])
       {
@@ -128,6 +128,15 @@
     return 0;
   }
   TEST_FORK_END();
+
+  for (i = 0; i < FILE_SIZE; ++i)
+  {
+    if (addr[i] != buf[i])
+    {
+      printf("addr[%d] is %u, must be %u\n", i, addr[i], buf[i]);
+      return 1;
+    }
+  }

   /*
    * Test 3: write to r/o mapping from child (should fail)


Update fix_parser_priv.c

Update fix_parser_priv.c

--- src/fix_parser_priv.c
+++ src/fix_parser_priv.c
@@ -12,11 +12,11 @@
 #include <string.h>

 /*------------------------------------------------------------------------------------------------------------------------*/
-FIXPage* fix_parser_alloc_page(FIXParser* parser, uint32_t pageSize)
+FIXPage* fix_parser_alloc_page(FIXParser* parser, uint32_t pageSize, FIXError** error)
 {
    if (parser->attrs.maxPages > 0 && parser->attrs.maxPages == parser->used_pages)
    {
-      fix_error_set(&parser->error,
+      *error = fix_error_create(
          FIX_ERROR_NO_MORE_PAGES, "No more pages available. MaxPages = %d, UsedPages = %d", parser->attrs.maxPages, parser->used_pages);
       return NULL;
    }
@@ -26,8 +26,7 @@
       uint32_t psize = (parser->attrs.pageSize > pageSize ? parser->attrs.pageSize : pageSize);
       if (parser->attrs.maxPageSize > 0 && psize > parser->attrs.maxPageSize)
       {
-         fix_error_set(
-               &parser->error,
+         *error = fix_error_create(
                FIX_ERROR_TOO_BIG_PAGE, "Requested new page is too big. MaxPageSize = %d, RequestedPageSize = %d",
                parser->attrs.maxPageSize, psize);
          return NULL;
@@ -57,12 +56,11 @@
 }

 /*------------------------------------------------------------------------------------------------------------------------*/
-FIXGroup* fix_parser_alloc_group(FIXParser* parser)
+FIXGroup* fix_parser_alloc_group(FIXParser* parser, FIXError** error)
 {
    if (parser->attrs.maxGroups > 0 && parser->attrs.maxGroups == parser->used_groups)
    {
-      fix_error_set(&parser->error,
-         FIX_ERROR_NO_MORE_GROUPS,
+      *error = fix_error_create(FIX_ERROR_NO_MORE_GROUPS,
          "No more groups available. MaxGroups = %d, UsedGroups = %d", parser->attrs.maxGroups, parser->used_groups);
       return NULL;
    }
@@ -93,7 +91,7 @@
 }

 /*------------------------------------------------------------------------------------------------------------------------*/
-int32_t fix_parser_validate_attrs(FIXError* error, FIXParserAttrs* attrs)
+int32_t fix_parser_validate_attrs(FIXParserAttrs* attrs, FIXError** error)
 {
    if (!attrs->pageSize)
    {
@@ -109,28 +107,29 @@
    }
    if (attrs->maxPageSize > 0 && attrs->maxPageSize < attrs->pageSize)
    {
-      fix_error_set(error, FIX_ERROR_INVALID_ARGUMENT, "ERROR: Parser attbutes are invalid: MaxPageSize < PageSize.");
+      *error = fix_error_create(FIX_ERROR_INVALID_ARGUMENT, "ERROR: Parser attbutes are invalid: MaxPageSize < PageSize.");
       return FIX_FAILED;
    }
    if (attrs->maxPages > 0 && attrs->maxPages < attrs->numPages)
    {
-      fix_error_set(error, FIX_ERROR_INVALID_ARGUMENT, "Parser attbutes are invalid: MaxPages < NumPages.");
+      *error = fix_error_create(FIX_ERROR_INVALID_ARGUMENT, "Parser attbutes are invalid: MaxPages < NumPages.");
       return FIX_FAILED;
    }
    if (attrs->maxGroups > 0 && attrs->maxGroups < attrs->numGroups)
    {
-      fix_error_set(error, FIX_ERROR_INVALID_ARGUMENT, "Parser attbutes are invalid: MaxGroups < NumGroups.");
-      return FIX_FAILED;
-   }
-   return FIX_SUCCESS;
-}
-
-/*------------------------------------------------------------------------------------------------------------------------*/
-FIXErrCode fix_parser_check_value(FIXError* error, FIXFieldDescr const* fdescr, char const* dbegin, char const* dend, char delimiter)
+      *error = fix_error_create(FIX_ERROR_INVALID_ARGUMENT, "Parser attbutes are invalid: MaxGroups < NumGroups.");
+      return FIX_FAILED;
+   }
+   return FIX_SUCCESS;
+}
+
+/*------------------------------------------------------------------------------------------------------------------------*/
+FIXErrCode fix_parser_check_value(FIXFieldDescr const* fdescr, char const* dbegin, char const* dend, char delimiter,
+      FIXError** error)
 {
    if (!fix_protocol_check_field_value(fdescr, dbegin, dend - dbegin))
    {
-      fix_error_set(error, FIX_ERROR_WRONG_FIELD_VALUE, "Wrong field '%s' value.", fdescr->type->name);
+      *error = fix_error_create(FIX_ERROR_WRONG_FIELD_VALUE, "Wrong field '%s' value.", fdescr->type->name);
       return FIX_FAILED;
    }
    if (IS_INT_TYPE(fdescr->type->valueType))
@@ -139,7 +138,7 @@
       int32_t cnt;
       if(FIX_FAILED == fix_utils_atoi64(dbegin, dend - dbegin, delimiter, &res, &cnt))
       {
-         fix_error_set(error, FIX_ERROR_WRONG_FIELD_VALUE, "Wrong field '%s' value.", fdescr->type->name);
+         *error = fix_error_create(FIX_ERROR_WRONG_FIELD_VALUE, "Wrong field '%s' value.", fdescr->type->name);
          return FIX_FAILED;
       }
    }
@@ -149,7 +148,7 @@
       int32_t cnt;
       if (!fix_utils_atod(dbegin, dend - dbegin, delimiter, &res, &cnt))
       {
-         fix_error_set(error, FIX_ERROR_WRONG_FIELD_VALUE, "Wrong field '%s' value.", fdescr->type->name);
+         *error = fix_error_create(FIX_ERROR_WRONG_FIELD_VALUE, "Wrong field '%s' value.", fdescr->type->name);
          return FIX_FAILED;
       }
    }
@@ -157,7 +156,7 @@
    {
       if (dend - dbegin != 1)
       {
-         fix_error_set(error, FIX_ERROR_WRONG_FIELD_VALUE, "Wrong field '%s' value.", fdescr->type->name);
+         *error = fix_error_create(FIX_ERROR_WRONG_FIELD_VALUE, "Wrong field '%s' value.", fdescr->type->name);
          return FIX_FAILED;
       }
    }
@@ -166,18 +165,16 @@

 /*------------------------------------------------------------------------------------------------------------------------*/
 static FIXErrCode fix_parser_parse_value(FIXMsg* msg, FIXGroup* group, FIXFieldDescr const* fdescr,
-      char const* dbegin, uint32_t len, char delimiter, char const** dend, FIXError* error)
+      char const* dbegin, uint32_t len, char delimiter, char const** dend, FIXError** error)
 {
    *dend = dbegin;
    if (msg && fdescr && fdescr->type->valueType == FIXFieldValueType_Data) // Data field
    {
       int32_t dataLength;
-      int32_t err = fix_msg_get_int32(msg, group, fdescr->dataLenField->type->tag, &dataLength);
+      int32_t err = fix_msg_get_int32(msg, group, fdescr->dataLenField->type->tag, &dataLength, error);
       if (err > 0)
       {
-         fix_error_set(
-               error, err,
-               "Unable to get length field '%d'.", fdescr->dataLenField->type->tag);
+         *error = fix_error_create(err, "Unable to get length field '%d'.", fdescr->dataLenField->type->tag);
          return FIX_FAILED;
       }
       *dend = dbegin + dataLength;
@@ -197,7 +194,7 @@
       }
       if (!len)
       {
-         fix_error_set(error, FIX_ERROR_NO_MORE_DATA, "Field value must be terminated with '%c' delimiter.", delimiter);
+         *error = fix_error_create(FIX_ERROR_NO_MORE_DATA, "Field value must be terminated with '%c' delimiter.", delimiter);
          return FIX_FAILED;
       }
    }
@@ -207,13 +204,13 @@
 /*------------------------------------------------------------------------------------------------------------------------*/
 static FIXTagNum fix_parser_parse_tag(
       FIXMsg* msg, FIXGroup* group, char const* data, uint32_t len, FIXTagNum* tag, FIXFieldDescr const** fdescr,
-      char const** dbegin, FIXError* error)
+      char const** dbegin, FIXError** error)
 {
    int32_t cnt;
    FIXErrCode res = fix_utils_atoi32(data, len, '=', tag, &cnt);
    if (res > 0)
    {
-      fix_error_set(error, res, "Unable to extract field number.");
+      *error = fix_error_create(res, "Unable to extract field number.");
       return FIX_FAILED;
    }
    *dbegin = data + cnt + 1;
@@ -227,7 +224,7 @@

 /*------------------------------------------------------------------------------------------------------------------------*/
 FIXTagNum fix_parser_parse_mandatory_field(
-      char const* data, uint32_t len, char delimiter, char const** dbegin, char const** dend, FIXError* error)
+      char const* data, uint32_t len, char delimiter, char const** dbegin, char const** dend, FIXError** error)
 {
    FIXTagNum tag = 0;
    if(FIX_FAILED == fix_parser_parse_tag(NULL, NULL, data, len, &tag, NULL, dbegin, error))
@@ -244,10 +241,10 @@
 /*------------------------------------------------------------------------------------------------------------------------*/
 FIXTagNum fix_parser_parse_field(
       FIXParser* parser, FIXMsg* msg, FIXGroup* group, char const* data, uint32_t len, char delimiter, FIXFieldDescr const** fdescr,
-      char const** dbegin, char const** dend)
+      char const** dbegin, char const** dend, FIXError** error)
 {
    FIXTagNum tag = 0;
-   if (FIX_FAILED == fix_parser_parse_tag(msg, group, data, len, &tag, fdescr, dbegin, &parser->error))
+   if (FIX_FAILED == fix_parser_parse_tag(msg, group, data, len, &tag, fdescr, dbegin, error))
    {
       return FIX_FAILED;
    }
@@ -255,18 +252,18 @@
    {
       if (parser->flags & PARSER_FLAG_CHECK_UNKNOWN_FIELDS)
       {
-         fix_error_set(&parser->error, FIX_ERROR_UNKNOWN_FIELD, "Field '%d' not found in description.", tag);
+         *error = fix_error_create(FIX_ERROR_UNKNOWN_FIELD, "Field '%d' not found in description.", tag);
          return FIX_FAILED;
       }
       else // just skip field value
       {
-         if (FIX_FAILED == fix_parser_parse_value(NULL, NULL, NULL, *dbegin, len - (*dbegin - data), delimiter, dend, &parser->error))
-         {
-            return FIX_FAILED;
-         }
-      }
-   }
-   if (FIX_FAILED == fix_parser_parse_value(msg, group, *fdescr, *dbegin, len - (*dbegin - data), delimiter, dend, &parser->error))
+         if (FIX_FAILED == fix_parser_parse_value(NULL, NULL, NULL, *dbegin, len - (*dbegin - data), delimiter, dend, error))
+         {
+            return FIX_FAILED;
+         }
+      }
+   }
+   if (FIX_FAILED == fix_parser_parse_value(msg, group, *fdescr, *dbegin, len - (*dbegin - data), delimiter, dend, error))
    {
       return FIX_FAILED;
    }
@@ -276,7 +273,7 @@
 /*------------------------------------------------------------------------------------------------------------------------*/
 FIXErrCode fix_parser_parse_group(
       FIXParser* parser, FIXMsg* msg, FIXGroup* parentGroup, FIXFieldDescr const* gdescr, int64_t numGroups, char const* data,
-      uint32_t len, char delimiter, char const** stop)
+      uint32_t len, char delimiter, char const** stop, FIXError** error)
 {
    FIXFieldDescr* first_req_field = &gdescr->group[0]; // first required field MUST be present in string
    FIXGroup* group = NULL;
@@ -287,7 +284,7 @@
       FIXTagNum tag = 0;
       char const* dbegin = NULL;
       FIXFieldDescr const* fdescr = NULL;
-      if(FIX_FAILED == fix_parser_parse_tag(NULL, NULL, *stop + 1, len, &tag, NULL, &dbegin, &parser->error))
+      if(FIX_FAILED == fix_parser_parse_tag(NULL, NULL, *stop + 1, len, &tag, NULL, &dbegin, error))
       {
          return FIX_FAILED;
       }
@@ -302,7 +299,7 @@
                {
                   if (!fix_field_get(msg, group, fdescr->type->tag))
                   {
-                     fix_error_set(&parser->error, FIX_ERROR_FIELD_NOT_FOUND,
+                     *error = fix_error_create(FIX_ERROR_FIELD_NOT_FOUND,
                            "Required field '%s' not found in group '%s'.",
                            fdescr->type->name, group->parent_fdescr->type->name);
                      return FIX_FAILED;
@@ -310,7 +307,7 @@
                }
             }
          }
-         group = fix_msg_add_group(msg, parentGroup, gdescr->type->tag);
+         group = fix_msg_add_group(msg, parentGroup, gdescr->type->tag, error);
          if (!group)
          {
             return FIX_FAILED;
@@ -329,27 +326,26 @@
             }
             else
             {
-               fix_error_set(
-                     &parser->error,
+               *error = fix_error_create(
                      FIX_ERROR_UNKNOWN_FIELD, "Field '%d' not found in group '%s' description.", tag, gdescr->type->name);
                return FIX_FAILED;
             }
          }
       }
-      if (FIX_FAILED == fix_parser_parse_value(msg, group, fdescr, dbegin, len - (dbegin - data), delimiter, stop, &parser->error))
+      if (FIX_FAILED == fix_parser_parse_value(msg, group, fdescr, dbegin, len - (dbegin - data), delimiter, stop, error))
       {
          return FIX_FAILED;
       }
       if (parser->flags & PARSER_FLAG_CHECK_VALUE)
       {
-         if (fix_parser_check_value(&parser->error, fdescr, dbegin, *stop, delimiter) == FIX_FAILED)
+         if (fix_parser_check_value(fdescr, dbegin, *stop, delimiter, error) == FIX_FAILED)
          {
             return FIX_FAILED;
          }
       }
       if (fdescr->category == FIXFieldCategory_Value)
       {
-         if (!fix_field_set(msg, group, fdescr, (unsigned char*)dbegin, *stop - dbegin))
+         if (!fix_field_set(msg, group, fdescr, (unsigned char*)dbegin, *stop - dbegin, error))
          {
             return FIX_FAILED;
          }
@@ -361,10 +357,10 @@
          FIXErrCode err = fix_utils_atoi32(dbegin, *stop - dbegin, delimiter, &numGroups, &cnt);
          if (err > 0)
          {
-            fix_error_set(&parser->error, err, "Unable to get group tag %d value.", tag);
-            return FIX_FAILED;
-         }
-         err = fix_parser_parse_group(parser, msg, group, fdescr, numGroups, *stop, data + len - *stop, delimiter, stop);
+            *error = fix_error_create(err, "Unable to get group tag %d value.", tag);
+            return FIX_FAILED;
+         }
+         err = fix_parser_parse_group(parser, msg, group, fdescr, numGroups, *stop, data + len - *stop, delimiter, stop, error);
          if (err == FIX_FAILED)
          {
             return FIX_FAILED;


Fixed input focus of shaded windows - needed to have KeyPressMask on frame window set

--- libAfterStep/afterstep.h
+++ libAfterStep/afterstep.h
@@ -341,6 +341,7 @@
 									 LeaveWindowMask 	| \
                                      SubstructureRedirectMask| \
                                      StructureNotifyMask| \
+								     KeyPressMask 		| \
                                      PointerMotionMask)  /* needed for proper Balloons operation */

 #define AS_CANVAS_EVENT_MASK 		(ButtonPressMask 	| \


MinGW compilation fix, inet_aton and #includes depend on networking support.

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

--- libavformat/os_support.c
+++ libavformat/os_support.c
@@ -36,10 +36,6 @@
 #endif
 #include <time.h>

-#include <stdlib.h>
-#include <strings.h>
-#include "barpainet.h"
-
 /**
  * gets the current time in micro seconds.
  */
@@ -71,7 +67,11 @@
 }
 #endif /* !defined(CONFIG_WINCE) && !defined(HAVE_LOCALTIME_R) */

-#if !defined(HAVE_INET_ATON)
+#if !defined(HAVE_INET_ATON) && defined(CONFIG_NETWORK)
+#include <stdlib.h>
+#include <strings.h>
+#include "barpainet.h"
+
 int inet_aton (const char * str, struct in_addr * add)
 {
     const char * pch = str;
@@ -93,4 +93,4 @@

     return 1;
 }
-#endif /* !defined HAVE_INET_ATON */
+#endif /* !defined(HAVE_INET_ATON) && defined(CONFIG_NETWORK) */


OOps.

OOps.

--- libc/misc/time/adjtime.c
+++ libc/misc/time/adjtime.c
@@ -49,5 +49,4 @@
   }
   return 0;
 }
-weak_alias(adjtime, __adjtime);


core: Fix a double free on adapter_stop

core: Fix a double free on adapter_stop

The discovery_list list has the list of current discovery clients and is
removed on adapter_stop (for example due a "power off" command). The
g_slist_free_full will call discovery_free on every element of the list
and remove the nodes of the list, but discovery_destroy (called by
discovery_free) will not only free the element, but also remove it from
the list. This causes the list node to be freed twice, once by
g_slist_free_full and once by g_slist_remove.

This fix calls successively discovery_destroy and lets it remove the
list's elements one by one.

--- src/adapter.c
+++ src/adapter.c
@@ -1540,15 +1540,6 @@
 	return FALSE;
 }

-static void discovery_free(void *data)
-{
-	struct discovery_client *client = data;
-
-	DBG("owner %s", client->owner);
-
-	g_dbus_remove_watch(dbus_conn, client->watch);
-}
-
 static void discovery_destroy(void *user_data)
 {
 	struct discovery_client *client = user_data;
@@ -4271,12 +4262,19 @@

 	cancel_passive_scanning(adapter);

-	if (adapter->discovery_list) {
-		g_slist_free_full(adapter->discovery_list, discovery_free);
-		adapter->discovery_list = NULL;
-
-		adapter->discovering = false;
-	}
+	while (adapter->discovery_list) {
+		struct discovery_client *client;
+
+		client = adapter->discovery_list->data;
+
+		/* g_dbus_remove_watch will remove the client from the
+		 * adapter's list and free it using the discovery_destroy
+		 * function.
+		 */
+		g_dbus_remove_watch(dbus_conn, client->watch);
+	}
+
+	adapter->discovering = false;

 	while (adapter->connections) {
 		struct btd_device *device = adapter->connections->data;


make gcc2.95 happy this time...

make gcc2.95 happy this time...

--- APPS/tcl_tester/sctp_tcl_test_app.c
+++ APPS/tcl_tester/sctp_tcl_test_app.c
@@ -174,7 +174,7 @@
 	char buf[256];
 	struct sockaddr_in *sin;
 	struct sockaddr_in6 *sin6;
-	sctp_assoc_t id;
+	sctp_assoc_t id = 0;

 	asocDown = 0;


Disable the built-in speaker when initializing the chip, before my neighbours start visiting me with large axes.

--- arch/aviion/dev/dart.c
+++ arch/aviion/dev/dart.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: dart.c,v 1.1.1.1 2006/05/09 18:13:32 miod Exp $	*/
+/*	$OpenBSD: dart.c,v 1.2 2007/12/12 20:37:31 miod Exp $	*/

 /*
  * Mach Operating System
@@ -43,6 +43,7 @@
 #include <machine/av400.h>
 #include <aviion/dev/sysconreg.h>
 #include <aviion/dev/dartreg.h>
+#define	SPKRDIS	0x10	/* disable speaker on OP3 */
 #include <aviion/dev/dartvar.h>

 #ifdef	DDB
@@ -175,9 +176,7 @@
 	dart_write(sc, DART_ACR, BDSET2 | CCLK16 | IPDCDIB | IPDCDIA);
 #endif
 	dart_write(sc, DART_IMR, sc->sc_sv_reg->sv_imr);
-#if 0
-	dart_write(sc, DART_OPCR, OPSET);
-#endif
+	dart_write(sc, DART_OPCR, OPSET | SPKRDIS);
 #if 0
 	dart_write(sc, DART_IVR, SYSCON_VECT + SYSCV_SCC);
 #endif


Refactored reading of optional order bytes

--- libfreerdp/core/orders.c
+++ libfreerdp/core/orders.c
@@ -1061,76 +1061,94 @@

 	return TRUE;
 }
-#define ORDER_FIELD_BYTE(NO, TARGET)                        \
-	do                                                      \
-	{                                                       \
-		if (orderInfo->fieldFlags & (1 << (NO - 1)))        \
-		{                                                   \
-			if (Stream_GetRemainingLength(s) < 1)           \
-			{                                               \
-				WLog_ERR(TAG, "error reading %s", #TARGET); \
-				return FALSE;                               \
-			}                                               \
-			Stream_Read_UINT8(s, TARGET);                   \
-		}                                                   \
-	} while (0)
-#define ORDER_FIELD_2BYTE(NO, TARGET1, TARGET2)                              \
-	do                                                                       \
-	{                                                                        \
-		if (orderInfo->fieldFlags & (1 << (NO - 1)))                         \
-		{                                                                    \
-			if (Stream_GetRemainingLength(s) < 2)                            \
-			{                                                                \
-				WLog_ERR(TAG, "error reading %s or %s", #TARGET1, #TARGET2); \
-				return FALSE;                                                \
-			}                                                                \
-			Stream_Read_UINT8(s, TARGET1);                                   \
-			Stream_Read_UINT8(s, TARGET2);                                   \
-		}                                                                    \
-	} while (0)
-#define ORDER_FIELD_UINT16(NO, TARGET)                      \
-	do                                                      \
-	{                                                       \
-		if (orderInfo->fieldFlags & (1 << (NO - 1)))        \
-		{                                                   \
-			if (Stream_GetRemainingLength(s) < 2)           \
-			{                                               \
-				WLog_ERR(TAG, "error reading %s", #TARGET); \
-				return FALSE;                               \
-			}                                               \
-			Stream_Read_UINT16(s, TARGET);                  \
-		}                                                   \
-	} while (0)
-#define ORDER_FIELD_UINT32(NO, TARGET)                      \
-	do                                                      \
-	{                                                       \
-		if (orderInfo->fieldFlags & (1 << (NO - 1)))        \
-		{                                                   \
-			if (Stream_GetRemainingLength(s) < 4)           \
-			{                                               \
-				WLog_ERR(TAG, "error reading %s", #TARGET); \
-				return FALSE;                               \
-			}                                               \
-			Stream_Read_UINT32(s, TARGET);                  \
-		}                                                   \
-	} while (0)
-#define ORDER_FIELD_COORD(NO, TARGET)                                    \
-	do                                                                   \
-	{                                                                    \
-		if ((orderInfo->fieldFlags & (1 << (NO - 1))) &&                 \
-		    !update_read_coord(s, &TARGET, orderInfo->deltaCoordinates)) \
-		{                                                                \
-			WLog_ERR(TAG, "error reading %s", #TARGET);                  \
-			return FALSE;                                                \
-		}                                                                \
-	} while (0)
-static INLINE BOOL ORDER_FIELD_COLOR(const ORDER_INFO* orderInfo, wStream* s, UINT32 NO,
-                                     UINT32* TARGET)
-{
+
+static INLINE BOOL read_order_field_byte(const ORDER_INFO* orderInfo, wStream* s, BYTE number,
+                                         UINT32* target, BOOL optional)
+{
+	const BOOL set = orderInfo->fieldFlags & (1 << (number - 1));
+	if (!set)
+		return TRUE;
+	if (Stream_GetRemainingLength(s) < 1)
+		return FALSE;
+	Stream_Read_UINT8(s, *target);
+	return TRUE;
+}
+
+static INLINE BOOL read_order_field_2bytes(const ORDER_INFO* orderInfo, wStream* s, BYTE number,
+                                           UINT32* target1, UINT32* target2, BOOL optional)
+{
+	const BOOL set = orderInfo->fieldFlags & (1 << (number - 1));
+	if (!set)
+		return TRUE;
+	if (Stream_GetRemainingLength(s) < 2)
+		return FALSE;
+	Stream_Read_UINT8(s, *target1);
+	Stream_Read_UINT8(s, *target2);
+	return TRUE;
+}
+
+static INLINE BOOL read_order_field_uint16(const ORDER_INFO* orderInfo, wStream* s, BYTE number,
+                                           UINT32* target, BOOL optional)
+{
+	const BOOL set = orderInfo->fieldFlags & (1 << (number - 1));
+	if (!set)
+		return TRUE;
+
+	if (Stream_GetRemainingLength(s) < 2)
+		return FALSE;
+
+	Stream_Read_UINT16(s, *target);
+	return TRUE;
+}
+
+static INLINE BOOL read_order_field_int16(const ORDER_INFO* orderInfo, wStream* s, BYTE number,
+                                          INT32* target, BOOL optional)
+{
+	const BOOL set = orderInfo->fieldFlags & (1 << (number - 1));
+	if (!set)
+		return TRUE;
+
+	if (Stream_GetRemainingLength(s) < 2)
+		return FALSE;
+
+	Stream_Read_INT16(s, *target);
+	return TRUE;
+}
+
+static INLINE BOOL read_order_field_uint32(const ORDER_INFO* orderInfo, wStream* s, BYTE number,
+                                           UINT32* target, BOOL optional)
+{
+	const BOOL set = orderInfo->fieldFlags & (1 << (number - 1));
+	if (!set)
+		return TRUE;
+	if (Stream_GetRemainingLength(s) < 4)
+		return FALSE;
+
+	Stream_Read_UINT32(s, *target);
+}
+
+static INLINE BOOL read_order_field_coord(const ORDER_INFO* orderInfo, wStream* s, UINT32 NO,
+                                          INT32* TARGET, BOOL optional)
+{
+	const BOOL set = (orderInfo->fieldFlags & (1 << (NO - 1)));
 	if (!TARGET || !orderInfo)
 		return FALSE;
-
-	if ((orderInfo->fieldFlags & (1 << (NO - 1))) && !update_read_color(s, TARGET))
+	if (!set)
+		return TRUE;
+
+	return update_read_coord(s, TARGET, orderInfo->deltaCoordinates);
+}
+
+static INLINE BOOL read_order_field_color(const ORDER_INFO* orderInfo, wStream* s, UINT32 NO,
+                                          UINT32* TARGET, BOOL optional)
+{
+	const BOOL set = (orderInfo->fieldFlags & (1 << (NO - 1)));
+	if (!TARGET || !orderInfo)
+		return FALSE;
+	if (!set)
+		return TRUE;
+
+	if (!update_read_color(s, TARGET))
 		return FALSE;

 	return TRUE;
@@ -1153,11 +1171,12 @@
 /* Primary Drawing Orders */
 static BOOL update_read_dstblt_order(wStream* s, const ORDER_INFO* orderInfo, DSTBLT_ORDER* dstblt)
 {
-	ORDER_FIELD_COORD(1, dstblt->nLeftRect);
-	ORDER_FIELD_COORD(2, dstblt->nTopRect);
-	ORDER_FIELD_COORD(3, dstblt->nWidth);
-	ORDER_FIELD_COORD(4, dstblt->nHeight);
-	ORDER_FIELD_BYTE(5, dstblt->bRop);
+	if (!read_order_field_coord(orderInfo, s, 1, &dstblt->nLeftRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &dstblt->nTopRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 3, &dstblt->nWidth, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 4, &dstblt->nHeight, FALSE) ||
+	    !read_order_field_byte(orderInfo, s, 5, &dstblt->bRop, TRUE))
+		return FALSE;
 	return TRUE;
 }
 int update_approximate_dstblt_order(ORDER_INFO* orderInfo, const DSTBLT_ORDER* dstblt)
@@ -1184,13 +1203,14 @@
 }
 static BOOL update_read_patblt_order(wStream* s, const ORDER_INFO* orderInfo, PATBLT_ORDER* patblt)
 {
-	ORDER_FIELD_COORD(1, patblt->nLeftRect);
-	ORDER_FIELD_COORD(2, patblt->nTopRect);
-	ORDER_FIELD_COORD(3, patblt->nWidth);
-	ORDER_FIELD_COORD(4, patblt->nHeight);
-	ORDER_FIELD_BYTE(5, patblt->bRop);
-	ORDER_FIELD_COLOR(orderInfo, s, 6, &patblt->backColor);
-	ORDER_FIELD_COLOR(orderInfo, s, 7, &patblt->foreColor);
+	if (!read_order_field_coord(orderInfo, s, 1, &patblt->nLeftRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &patblt->nTopRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 3, &patblt->nWidth, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 4, &patblt->nHeight, FALSE) ||
+	    !read_order_field_byte(orderInfo, s, 5, &patblt->bRop, TRUE) ||
+	    !read_order_field_color(orderInfo, s, 6, &patblt->backColor, TRUE) ||
+	    !read_order_field_color(orderInfo, s, 7, &patblt->foreColor, TRUE))
+		return FALSE;
 	return update_read_brush(s, &patblt->brush, orderInfo->fieldFlags >> 7);
 }
 int update_approximate_patblt_order(ORDER_INFO* orderInfo, PATBLT_ORDER* patblt)
@@ -1227,13 +1247,14 @@
 }
 static BOOL update_read_scrblt_order(wStream* s, const ORDER_INFO* orderInfo, SCRBLT_ORDER* scrblt)
 {
-	ORDER_FIELD_COORD(1, scrblt->nLeftRect);
-	ORDER_FIELD_COORD(2, scrblt->nTopRect);
-	ORDER_FIELD_COORD(3, scrblt->nWidth);
-	ORDER_FIELD_COORD(4, scrblt->nHeight);
-	ORDER_FIELD_BYTE(5, scrblt->bRop);
-	ORDER_FIELD_COORD(6, scrblt->nXSrc);
-	ORDER_FIELD_COORD(7, scrblt->nYSrc);
+	if (!read_order_field_coord(orderInfo, s, 1, &scrblt->nLeftRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &scrblt->nTopRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 3, &scrblt->nWidth, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 4, &scrblt->nHeight, FALSE) ||
+	    !read_order_field_byte(orderInfo, s, 5, &scrblt->bRop, TRUE) ||
+	    !read_order_field_coord(orderInfo, s, 6, &scrblt->nXSrc, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 7, &scrblt->nYSrc, FALSE))
+		return FALSE;
 	return TRUE;
 }
 int update_approximate_scrblt_order(ORDER_INFO* orderInfo, const SCRBLT_ORDER* scrblt)
@@ -1266,12 +1287,13 @@
                                           OPAQUE_RECT_ORDER* opaque_rect)
 {
 	BYTE byte;
-	ORDER_FIELD_COORD(1, opaque_rect->nLeftRect);
-	ORDER_FIELD_COORD(2, opaque_rect->nTopRect);
-	ORDER_FIELD_COORD(3, opaque_rect->nWidth);
-	ORDER_FIELD_COORD(4, opaque_rect->nHeight);
-
-	if (orderInfo->fieldFlags & ORDER_FIELD_05)
+	if (!read_order_field_coord(orderInfo, s, 1, &opaque_rect->nLeftRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &opaque_rect->nTopRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 3, &opaque_rect->nWidth, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 4, &opaque_rect->nHeight, FALSE))
+		return FALSE;
+
+	if ((orderInfo->fieldFlags & ORDER_FIELD_05) != 0)
 	{
 		if (Stream_GetRemainingLength(s) < 1)
 			return FALSE;
@@ -1280,7 +1302,7 @@
 		opaque_rect->color = (opaque_rect->color & 0x00FFFF00) | ((UINT32)byte);
 	}

-	if (orderInfo->fieldFlags & ORDER_FIELD_06)
+	if ((orderInfo->fieldFlags & ORDER_FIELD_06) != 0)
 	{
 		if (Stream_GetRemainingLength(s) < 1)
 			return FALSE;
@@ -1289,7 +1311,7 @@
 		opaque_rect->color = (opaque_rect->color & 0x00FF00FF) | ((UINT32)byte << 8);
 	}

-	if (orderInfo->fieldFlags & ORDER_FIELD_07)
+	if ((orderInfo->fieldFlags & ORDER_FIELD_07) != 0)
 	{
 		if (Stream_GetRemainingLength(s) < 1)
 			return FALSE;
@@ -1338,24 +1360,26 @@
 static BOOL update_read_draw_nine_grid_order(wStream* s, const ORDER_INFO* orderInfo,
                                              DRAW_NINE_GRID_ORDER* draw_nine_grid)
 {
-	ORDER_FIELD_COORD(1, draw_nine_grid->srcLeft);
-	ORDER_FIELD_COORD(2, draw_nine_grid->srcTop);
-	ORDER_FIELD_COORD(3, draw_nine_grid->srcRight);
-	ORDER_FIELD_COORD(4, draw_nine_grid->srcBottom);
-	ORDER_FIELD_UINT16(5, draw_nine_grid->bitmapId);
+	if (!read_order_field_coord(orderInfo, s, 1, &draw_nine_grid->srcLeft, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &draw_nine_grid->srcTop, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 3, &draw_nine_grid->srcRight, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 4, &draw_nine_grid->srcBottom, FALSE) ||
+	    !read_order_field_uint16(orderInfo, s, 5, &draw_nine_grid->bitmapId, FALSE))
+		return FALSE;
 	return TRUE;
 }
 static BOOL update_read_multi_dstblt_order(wStream* s, const ORDER_INFO* orderInfo,
                                            MULTI_DSTBLT_ORDER* multi_dstblt)
 {
-	ORDER_FIELD_COORD(1, multi_dstblt->nLeftRect);
-	ORDER_FIELD_COORD(2, multi_dstblt->nTopRect);
-	ORDER_FIELD_COORD(3, multi_dstblt->nWidth);
-	ORDER_FIELD_COORD(4, multi_dstblt->nHeight);
-	ORDER_FIELD_BYTE(5, multi_dstblt->bRop);
-	ORDER_FIELD_BYTE(6, multi_dstblt->numRectangles);
-
-	if (orderInfo->fieldFlags & ORDER_FIELD_07)
+	if (!read_order_field_coord(orderInfo, s, 1, &multi_dstblt->nLeftRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &multi_dstblt->nTopRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 3, &multi_dstblt->nWidth, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 4, &multi_dstblt->nHeight, FALSE) ||
+	    !read_order_field_byte(orderInfo, s, 5, &multi_dstblt->bRop, TRUE) ||
+	    !read_order_field_byte(orderInfo, s, 6, &multi_dstblt->numRectangles, TRUE))
+		return FALSE;
+
+	if ((orderInfo->fieldFlags & ORDER_FIELD_07) != 0)
 	{
 		if (Stream_GetRemainingLength(s) < 2)
 			return FALSE;
@@ -1369,20 +1393,22 @@
 static BOOL update_read_multi_patblt_order(wStream* s, const ORDER_INFO* orderInfo,
                                            MULTI_PATBLT_ORDER* multi_patblt)
 {
-	ORDER_FIELD_COORD(1, multi_patblt->nLeftRect);
-	ORDER_FIELD_COORD(2, multi_patblt->nTopRect);
-	ORDER_FIELD_COORD(3, multi_patblt->nWidth);
-	ORDER_FIELD_COORD(4, multi_patblt->nHeight);
-	ORDER_FIELD_BYTE(5, multi_patblt->bRop);
-	ORDER_FIELD_COLOR(orderInfo, s, 6, &multi_patblt->backColor);
-	ORDER_FIELD_COLOR(orderInfo, s, 7, &multi_patblt->foreColor);
+	if (!read_order_field_coord(orderInfo, s, 1, &multi_patblt->nLeftRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &multi_patblt->nTopRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 3, &multi_patblt->nWidth, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 4, &multi_patblt->nHeight, FALSE) ||
+	    !read_order_field_byte(orderInfo, s, 5, &multi_patblt->bRop, TRUE) ||
+	    !read_order_field_color(orderInfo, s, 6, &multi_patblt->backColor, TRUE) ||
+	    !read_order_field_color(orderInfo, s, 7, &multi_patblt->foreColor, TRUE))
+		return FALSE;

 	if (!update_read_brush(s, &multi_patblt->brush, orderInfo->fieldFlags >> 7))
 		return FALSE;

-	ORDER_FIELD_BYTE(13, multi_patblt->numRectangles);
-
-	if (orderInfo->fieldFlags & ORDER_FIELD_14)
+	if (!read_order_field_byte(orderInfo, s, 13, &multi_patblt->numRectangles, TRUE))
+		return FALSE;
+
+	if ((orderInfo->fieldFlags & ORDER_FIELD_14) != 0)
 	{
 		if (Stream_GetRemainingLength(s) < 2)
 			return FALSE;
@@ -1398,16 +1424,17 @@
 static BOOL update_read_multi_scrblt_order(wStream* s, const ORDER_INFO* orderInfo,
                                            MULTI_SCRBLT_ORDER* multi_scrblt)
 {
-	ORDER_FIELD_COORD(1, multi_scrblt->nLeftRect);
-	ORDER_FIELD_COORD(2, multi_scrblt->nTopRect);
-	ORDER_FIELD_COORD(3, multi_scrblt->nWidth);
-	ORDER_FIELD_COORD(4, multi_scrblt->nHeight);
-	ORDER_FIELD_BYTE(5, multi_scrblt->bRop);
-	ORDER_FIELD_COORD(6, multi_scrblt->nXSrc);
-	ORDER_FIELD_COORD(7, multi_scrblt->nYSrc);
-	ORDER_FIELD_BYTE(8, multi_scrblt->numRectangles);
-
-	if (orderInfo->fieldFlags & ORDER_FIELD_09)
+	if (!read_order_field_coord(orderInfo, s, 1, &multi_scrblt->nLeftRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &multi_scrblt->nTopRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 3, &multi_scrblt->nWidth, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 4, &multi_scrblt->nHeight, FALSE) ||
+	    !read_order_field_byte(orderInfo, s, 5, &multi_scrblt->bRop, TRUE) ||
+	    !read_order_field_coord(orderInfo, s, 6, &multi_scrblt->nXSrc, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 7, &multi_scrblt->nYSrc, FALSE) ||
+	    !read_order_field_byte(orderInfo, s, 8, &multi_scrblt->numRectangles, TRUE))
+		return FALSE;
+
+	if ((orderInfo->fieldFlags & ORDER_FIELD_09) != 0)
 	{
 		if (Stream_GetRemainingLength(s) < 2)
 			return FALSE;
@@ -1422,12 +1449,13 @@
                                                 MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
 {
 	BYTE byte;
-	ORDER_FIELD_COORD(1, multi_opaque_rect->nLeftRect);
-	ORDER_FIELD_COORD(2, multi_opaque_rect->nTopRect);
-	ORDER_FIELD_COORD(3, multi_opaque_rect->nWidth);
-	ORDER_FIELD_COORD(4, multi_opaque_rect->nHeight);
-
-	if (orderInfo->fieldFlags & ORDER_FIELD_05)
+	if (!read_order_field_coord(orderInfo, s, 1, &multi_opaque_rect->nLeftRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &multi_opaque_rect->nTopRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 3, &multi_opaque_rect->nWidth, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 4, &multi_opaque_rect->nHeight, FALSE))
+		return FALSE;
+
+	if ((orderInfo->fieldFlags & ORDER_FIELD_05) != 0)
 	{
 		if (Stream_GetRemainingLength(s) < 1)
 			return FALSE;
@@ -1436,7 +1464,7 @@
 		multi_opaque_rect->color = (multi_opaque_rect->color & 0x00FFFF00) | ((UINT32)byte);
 	}

-	if (orderInfo->fieldFlags & ORDER_FIELD_06)
+	if ((orderInfo->fieldFlags & ORDER_FIELD_06) != 0)
 	{
 		if (Stream_GetRemainingLength(s) < 1)
 			return FALSE;
@@ -1445,7 +1473,7 @@
 		multi_opaque_rect->color = (multi_opaque_rect->color & 0x00FF00FF) | ((UINT32)byte << 8);
 	}

-	if (orderInfo->fieldFlags & ORDER_FIELD_07)
+	if ((orderInfo->fieldFlags & ORDER_FIELD_07) != 0)
 	{
 		if (Stream_GetRemainingLength(s) < 1)
 			return FALSE;
@@ -1454,9 +1482,10 @@
 		multi_opaque_rect->color = (multi_opaque_rect->color & 0x0000FFFF) | ((UINT32)byte << 16);
 	}

-	ORDER_FIELD_BYTE(8, multi_opaque_rect->numRectangles);
-
-	if (orderInfo->fieldFlags & ORDER_FIELD_09)
+	if (!read_order_field_byte(orderInfo, s, 8, &multi_opaque_rect->numRectangles, TRUE))
+		return FALSE;
+
+	if ((orderInfo->fieldFlags & ORDER_FIELD_09) != 0)
 	{
 		if (Stream_GetRemainingLength(s) < 2)
 			return FALSE;
@@ -1471,14 +1500,15 @@
 static BOOL update_read_multi_draw_nine_grid_order(wStream* s, const ORDER_INFO* orderInfo,
                                                    MULTI_DRAW_NINE_GRID_ORDER* multi_draw_nine_grid)
 {
-	ORDER_FIELD_COORD(1, multi_draw_nine_grid->srcLeft);
-	ORDER_FIELD_COORD(2, multi_draw_nine_grid->srcTop);
-	ORDER_FIELD_COORD(3, multi_draw_nine_grid->srcRight);
-	ORDER_FIELD_COORD(4, multi_draw_nine_grid->srcBottom);
-	ORDER_FIELD_UINT16(5, multi_draw_nine_grid->bitmapId);
-	ORDER_FIELD_BYTE(6, multi_draw_nine_grid->nDeltaEntries);
-
-	if (orderInfo->fieldFlags & ORDER_FIELD_07)
+	if (!read_order_field_coord(orderInfo, s, 1, &multi_draw_nine_grid->srcLeft, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &multi_draw_nine_grid->srcTop, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 3, &multi_draw_nine_grid->srcRight, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 4, &multi_draw_nine_grid->srcBottom, FALSE) ||
+	    !read_order_field_uint16(orderInfo, s, 5, &multi_draw_nine_grid->bitmapId, TRUE) ||
+	    !read_order_field_byte(orderInfo, s, 6, &multi_draw_nine_grid->nDeltaEntries, TRUE))
+		return FALSE;
+
+	if ((orderInfo->fieldFlags & ORDER_FIELD_07) != 0)
 	{
 		if (Stream_GetRemainingLength(s) < 2)
 			return FALSE;
@@ -1493,16 +1523,17 @@
 static BOOL update_read_line_to_order(wStream* s, const ORDER_INFO* orderInfo,
                                       LINE_TO_ORDER* line_to)
 {
-	ORDER_FIELD_UINT16(1, line_to->backMode);
-	ORDER_FIELD_COORD(2, line_to->nXStart);
-	ORDER_FIELD_COORD(3, line_to->nYStart);
-	ORDER_FIELD_COORD(4, line_to->nXEnd);
-	ORDER_FIELD_COORD(5, line_to->nYEnd);
-	ORDER_FIELD_COLOR(orderInfo, s, 6, &line_to->backColor);
-	ORDER_FIELD_BYTE(7, line_to->bRop2);
-	ORDER_FIELD_BYTE(8, line_to->penStyle);
-	ORDER_FIELD_BYTE(9, line_to->penWidth);
-	ORDER_FIELD_COLOR(orderInfo, s, 10, &line_to->penColor);
+	if (!read_order_field_uint16(orderInfo, s, 1, &line_to->backMode, TRUE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &line_to->nXStart, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 3, &line_to->nYStart, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 4, &line_to->nXEnd, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 5, &line_to->nYEnd, FALSE) ||
+	    !read_order_field_color(orderInfo, s, 6, &line_to->backColor, TRUE) ||
+	    !read_order_field_byte(orderInfo, s, 7, &line_to->bRop2, TRUE) ||
+	    !read_order_field_byte(orderInfo, s, 8, &line_to->penStyle, TRUE) ||
+	    !read_order_field_byte(orderInfo, s, 9, &line_to->penWidth, TRUE) ||
+	    !read_order_field_color(orderInfo, s, 10, &line_to->penColor, TRUE))
+		return FALSE;
 	return TRUE;
 }
 int update_approximate_line_to_order(ORDER_INFO* orderInfo, const LINE_TO_ORDER* line_to)
@@ -1540,16 +1571,17 @@
 static BOOL update_read_polyline_order(wStream* s, const ORDER_INFO* orderInfo,
                                        POLYLINE_ORDER* polyline)
 {
-	UINT16 word;
+	UINT32 word;
 	UINT32 new_num = polyline->numDeltaEntries;
-	ORDER_FIELD_COORD(1, polyline->xStart);
-	ORDER_FIELD_COORD(2, polyline->yStart);
-	ORDER_FIELD_BYTE(3, polyline->bRop2);
-	ORDER_FIELD_UINT16(4, word);
-	ORDER_FIELD_COLOR(orderInfo, s, 5, &polyline->penColor);
-	ORDER_FIELD_BYTE(6, new_num);
-
-	if (orderInfo->fieldFlags & ORDER_FIELD_07)
+	if (!read_order_field_coord(orderInfo, s, 1, &polyline->xStart, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &polyline->yStart, FALSE) ||
+	    !read_order_field_byte(orderInfo, s, 3, &polyline->bRop2, TRUE) ||
+	    !read_order_field_uint16(orderInfo, s, 4, &word, TRUE) ||
+	    !read_order_field_color(orderInfo, s, 5, &polyline->penColor, TRUE) ||
+	    !read_order_field_byte(orderInfo, s, 6, &new_num, TRUE))
+		return FALSE;
+
+	if ((orderInfo->fieldFlags & ORDER_FIELD_07) != 0)
 	{
 		DELTA_POINT* new_points;

@@ -1584,15 +1616,16 @@
 	if (!s || !orderInfo || !memblt)
 		return FALSE;

-	ORDER_FIELD_UINT16(1, memblt->cacheId);
-	ORDER_FIELD_COORD(2, memblt->nLeftRect);
-	ORDER_FIELD_COORD(3, memblt->nTopRect);
-	ORDER_FIELD_COORD(4, memblt->nWidth);
-	ORDER_FIELD_COORD(5, memblt->nHeight);
-	ORDER_FIELD_BYTE(6, memblt->bRop);
-	ORDER_FIELD_COORD(7, memblt->nXSrc);
-	ORDER_FIELD_COORD(8, memblt->nYSrc);
-	ORDER_FIELD_UINT16(9, memblt->cacheIndex);
+	if (!read_order_field_uint16(orderInfo, s, 1, &memblt->cacheId, TRUE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &memblt->nLeftRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 3, &memblt->nTopRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 4, &memblt->nWidth, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 5, &memblt->nHeight, FALSE) ||
+	    !read_order_field_byte(orderInfo, s, 6, &memblt->bRop, TRUE) ||
+	    !read_order_field_coord(orderInfo, s, 7, &memblt->nXSrc, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 8, &memblt->nYSrc, FALSE) ||
+	    !read_order_field_uint16(orderInfo, s, 9, &memblt->cacheIndex, TRUE))
+		return FALSE;
 	memblt->colorIndex = (memblt->cacheId >> 8);
 	memblt->cacheId = (memblt->cacheId & 0xFF);
 	memblt->bitmap = NULL;
@@ -1633,21 +1666,21 @@
 static BOOL update_read_mem3blt_order(wStream* s, const ORDER_INFO* orderInfo,
                                       MEM3BLT_ORDER* mem3blt)
 {
-	ORDER_FIELD_UINT16(1, mem3blt->cacheId);
-	ORDER_FIELD_COORD(2, mem3blt->nLeftRect);
-	ORDER_FIELD_COORD(3, mem3blt->nTopRect);
-	ORDER_FIELD_COORD(4, mem3blt->nWidth);
-	ORDER_FIELD_COORD(5, mem3blt->nHeight);
-	ORDER_FIELD_BYTE(6, mem3blt->bRop);
-	ORDER_FIELD_COORD(7, mem3blt->nXSrc);
-	ORDER_FIELD_COORD(8, mem3blt->nYSrc);
-	ORDER_FIELD_COLOR(orderInfo, s, 9, &mem3blt->backColor);
-	ORDER_FIELD_COLOR(orderInfo, s, 10, &mem3blt->foreColor);
-
-	if (!update_read_brush(s, &mem3blt->brush, orderInfo->fieldFlags >> 10))
-		return FALSE;
-
-	ORDER_FIELD_UINT16(16, mem3blt->cacheIndex);
+	if (!read_order_field_uint16(orderInfo, s, 1, &mem3blt->cacheId, TRUE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &mem3blt->nLeftRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 3, &mem3blt->nTopRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 4, &mem3blt->nWidth, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 5, &mem3blt->nHeight, FALSE) ||
+	    !read_order_field_byte(orderInfo, s, 6, &mem3blt->bRop, TRUE) ||
+	    !read_order_field_coord(orderInfo, s, 7, &mem3blt->nXSrc, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 8, &mem3blt->nYSrc, FALSE) ||
+	    !read_order_field_color(orderInfo, s, 9, &mem3blt->backColor, TRUE) ||
+	    !read_order_field_color(orderInfo, s, 10, &mem3blt->foreColor, TRUE))
+		return FALSE;
+
+	if (!update_read_brush(s, &mem3blt->brush, orderInfo->fieldFlags >> 10) ||
+	    !read_order_field_uint16(orderInfo, s, 16, &mem3blt->cacheIndex, TRUE))
+		return FALSE;
 	mem3blt->colorIndex = (mem3blt->cacheId >> 8);
 	mem3blt->cacheId = (mem3blt->cacheId & 0xFF);
 	mem3blt->bitmap = NULL;
@@ -1656,39 +1689,38 @@
 static BOOL update_read_save_bitmap_order(wStream* s, const ORDER_INFO* orderInfo,
                                           SAVE_BITMAP_ORDER* save_bitmap)
 {
-	ORDER_FIELD_UINT32(1, save_bitmap->savedBitmapPosition);
-	ORDER_FIELD_COORD(2, save_bitmap->nLeftRect);
-	ORDER_FIELD_COORD(3, save_bitmap->nTopRect);
-	ORDER_FIELD_COORD(4, save_bitmap->nRightRect);
-	ORDER_FIELD_COORD(5, save_bitmap->nBottomRect);
-	ORDER_FIELD_BYTE(6, save_bitmap->operation);
+	if (!read_order_field_uint32(orderInfo, s, 1, &save_bitmap->savedBitmapPosition, TRUE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &save_bitmap->nLeftRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 3, &save_bitmap->nTopRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 4, &save_bitmap->nRightRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 5, &save_bitmap->nBottomRect, FALSE) ||
+	    !read_order_field_byte(orderInfo, s, 6, &save_bitmap->operation, TRUE))
+		return FALSE;
 	return TRUE;
 }
 static BOOL update_read_glyph_index_order(wStream* s, const ORDER_INFO* orderInfo,
                                           GLYPH_INDEX_ORDER* glyph_index)
 {
-	ORDER_FIELD_BYTE(1, glyph_index->cacheId);
-	ORDER_FIELD_BYTE(2, glyph_index->flAccel);
-	ORDER_FIELD_BYTE(3, glyph_index->ulCharInc);
-	ORDER_FIELD_BYTE(4, glyph_index->fOpRedundant);
-	ORDER_FIELD_COLOR(orderInfo, s, 5, &glyph_index->backColor);
-	ORDER_FIELD_COLOR(orderInfo, s, 6, &glyph_index->foreColor);
-	ORDER_FIELD_UINT16(7, glyph_index->bkLeft);
-	ORDER_FIELD_UINT16(8, glyph_index->bkTop);
-	ORDER_FIELD_UINT16(9, glyph_index->bkRight);
-	ORDER_FIELD_UINT16(10, glyph_index->bkBottom);
-	ORDER_FIELD_UINT16(11, glyph_index->opLeft);
-	ORDER_FIELD_UINT16(12, glyph_index->opTop);
-	ORDER_FIELD_UINT16(13, glyph_index->opRight);
-	ORDER_FIELD_UINT16(14, glyph_index->opBottom);
-
-	if (!update_read_brush(s, &glyph_index->brush, orderInfo->fieldFlags >> 14))
-		return FALSE;
-
-	ORDER_FIELD_UINT16(20, glyph_index->x);
-	ORDER_FIELD_UINT16(21, glyph_index->y);
-
-	if (orderInfo->fieldFlags & ORDER_FIELD_22)
+	if (!read_order_field_byte(orderInfo, s, 1, &glyph_index->cacheId, TRUE) ||
+	    !read_order_field_byte(orderInfo, s, 2, &glyph_index->flAccel, TRUE) ||
+	    !read_order_field_byte(orderInfo, s, 3, &glyph_index->ulCharInc, TRUE) ||
+	    !read_order_field_byte(orderInfo, s, 4, &glyph_index->fOpRedundant, TRUE) ||
+	    !read_order_field_color(orderInfo, s, 5, &glyph_index->backColor, TRUE) ||
+	    !read_order_field_color(orderInfo, s, 6, &glyph_index->foreColor, TRUE) ||
+	    !read_order_field_int16(orderInfo, s, 7, &glyph_index->bkLeft, TRUE) ||
+	    !read_order_field_int16(orderInfo, s, 8, &glyph_index->bkTop, TRUE) ||
+	    !read_order_field_int16(orderInfo, s, 9, &glyph_index->bkRight, TRUE) ||
+	    !read_order_field_int16(orderInfo, s, 10, &glyph_index->bkBottom, TRUE) ||
+	    !read_order_field_int16(orderInfo, s, 11, &glyph_index->opLeft, TRUE) ||
+	    !read_order_field_int16(orderInfo, s, 12, &glyph_index->opTop, TRUE) ||
+	    !read_order_field_int16(orderInfo, s, 13, &glyph_index->opRight, TRUE) ||
+	    !read_order_field_int16(orderInfo, s, 14, &glyph_index->opBottom, TRUE) ||
+	    !update_read_brush(s, &glyph_index->brush, orderInfo->fieldFlags >> 14) ||
+	    !read_order_field_int16(orderInfo, s, 20, &glyph_index->x, TRUE) ||
+	    !read_order_field_int16(orderInfo, s, 21, &glyph_index->y, TRUE))
+		return FALSE;
+
+	if ((orderInfo->fieldFlags & ORDER_FIELD_22) != 0)
 	{
 		if (Stream_GetRemainingLength(s) < 1)
 			return FALSE;
@@ -1764,22 +1796,24 @@
 static BOOL update_read_fast_index_order(wStream* s, const ORDER_INFO* orderInfo,
                                          FAST_INDEX_ORDER* fast_index)
 {
-	ORDER_FIELD_BYTE(1, fast_index->cacheId);
-	ORDER_FIELD_2BYTE(2, fast_index->ulCharInc, fast_index->flAccel);
-	ORDER_FIELD_COLOR(orderInfo, s, 3, &fast_index->backColor);
-	ORDER_FIELD_COLOR(orderInfo, s, 4, &fast_index->foreColor);
-	ORDER_FIELD_COORD(5, fast_index->bkLeft);
-	ORDER_FIELD_COORD(6, fast_index->bkTop);
-	ORDER_FIELD_COORD(7, fast_index->bkRight);
-	ORDER_FIELD_COORD(8, fast_index->bkBottom);
-	ORDER_FIELD_COORD(9, fast_index->opLeft);
-	ORDER_FIELD_COORD(10, fast_index->opTop);
-	ORDER_FIELD_COORD(11, fast_index->opRight);
-	ORDER_FIELD_COORD(12, fast_index->opBottom);
-	ORDER_FIELD_COORD(13, fast_index->x);
-	ORDER_FIELD_COORD(14, fast_index->y);
-
-	if (orderInfo->fieldFlags & ORDER_FIELD_15)
+	if (!read_order_field_byte(orderInfo, s, 1, &fast_index->cacheId, TRUE) ||
+	    !read_order_field_2bytes(orderInfo, s, 2, &fast_index->ulCharInc, &fast_index->flAccel,
+	                             TRUE) ||
+	    !read_order_field_color(orderInfo, s, 3, &fast_index->backColor, TRUE) ||
+	    !read_order_field_color(orderInfo, s, 4, &fast_index->foreColor, TRUE) ||
+	    !read_order_field_coord(orderInfo, s, 5, &fast_index->bkLeft, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 6, &fast_index->bkTop, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 7, &fast_index->bkRight, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 8, &fast_index->bkBottom, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 9, &fast_index->opLeft, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 10, &fast_index->opTop, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 11, &fast_index->opRight, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 12, &fast_index->opBottom, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 13, &fast_index->x, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 14, &fast_index->y, FALSE))
+		return FALSE;
+
+	if ((orderInfo->fieldFlags & ORDER_FIELD_15) != 0)
 	{
 		if (Stream_GetRemainingLength(s) < 1)
 			return FALSE;
@@ -1799,22 +1833,27 @@
                                          FAST_GLYPH_ORDER* fastGlyph)
 {
 	GLYPH_DATA_V2* glyph = &fastGlyph->glyphData;
-	ORDER_FIELD_BYTE(1, fastGlyph->cacheId);
-	ORDER_FIELD_2BYTE(2, fastGlyph->ulCharInc, fastGlyph->flAccel);
-	ORDER_FIELD_COLOR(orderInfo, s, 3, &fastGlyph->backColor);
-	ORDER_FIELD_COLOR(orderInfo, s, 4, &fastGlyph->foreColor);
-	ORDER_FIELD_COORD(5, fastGlyph->bkLeft);
-	ORDER_FIELD_COORD(6, fastGlyph->bkTop);
-	ORDER_FIELD_COORD(7, fastGlyph->bkRight);
-	ORDER_FIELD_COORD(8, fastGlyph->bkBottom);
-	ORDER_FIELD_COORD(9, fastGlyph->opLeft);
-	ORDER_FIELD_COORD(10, fastGlyph->opTop);
-	ORDER_FIELD_COORD(11, fastGlyph->opRight);
-	ORDER_FIELD_COORD(12, fastGlyph->opBottom);
-	ORDER_FIELD_COORD(13, fastGlyph->x);
-	ORDER_FIELD_COORD(14, fastGlyph->y);
-
-	if (orderInfo->fieldFlags & ORDER_FIELD_15)
+	if (!read_order_field_byte(orderInfo, s, 1, &fastGlyph->cacheId, TRUE))
+		return FALSE;
+	if (fastGlyph->cacheId > 9)
+		return FALSE;
+	if (!read_order_field_2bytes(orderInfo, s, 2, &fastGlyph->ulCharInc, &fastGlyph->flAccel,
+	                             TRUE) ||
+	    !read_order_field_color(orderInfo, s, 3, &fastGlyph->backColor, TRUE) ||
+	    !read_order_field_color(orderInfo, s, 4, &fastGlyph->foreColor, TRUE) ||
+	    !read_order_field_coord(orderInfo, s, 5, &fastGlyph->bkLeft, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 6, &fastGlyph->bkTop, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 7, &fastGlyph->bkRight, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 8, &fastGlyph->bkBottom, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 9, &fastGlyph->opLeft, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 10, &fastGlyph->opTop, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 11, &fastGlyph->opRight, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 12, &fastGlyph->opBottom, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 13, &fastGlyph->x, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 14, &fastGlyph->y, FALSE))
+		return FALSE;
+
+	if ((orderInfo->fieldFlags & ORDER_FIELD_15) != 0)
 	{
 		const BYTE* src;
 		wStream sub;
@@ -1865,14 +1904,15 @@
                                          POLYGON_SC_ORDER* polygon_sc)
 {
 	UINT32 num = polygon_sc->numPoints;
-	ORDER_FIELD_COORD(1, polygon_sc->xStart);
-	ORDER_FIELD_COORD(2, polygon_sc->yStart);
-	ORDER_FIELD_BYTE(3, polygon_sc->bRop2);
-	ORDER_FIELD_BYTE(4, polygon_sc->fillMode);
-	ORDER_FIELD_COLOR(orderInfo, s, 5, &polygon_sc->brushColor);
-	ORDER_FIELD_BYTE(6, num);
-
-	if (orderInfo->fieldFlags & ORDER_FIELD_07)
+	if (!read_order_field_coord(orderInfo, s, 1, &polygon_sc->xStart, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &polygon_sc->yStart, FALSE) ||
+	    !read_order_field_byte(orderInfo, s, 3, &polygon_sc->bRop2, TRUE) ||
+	    !read_order_field_byte(orderInfo, s, 4, &polygon_sc->fillMode, TRUE) ||
+	    !read_order_field_color(orderInfo, s, 5, &polygon_sc->brushColor, TRUE) ||
+	    !read_order_field_byte(orderInfo, s, 6, &num, TRUE))
+		return FALSE;
+
+	if ((orderInfo->fieldFlags & ORDER_FIELD_07) != 0)
 	{
 		DELTA_POINT* newpoints;

@@ -1900,19 +1940,21 @@
                                          POLYGON_CB_ORDER* polygon_cb)
 {
 	UINT32 num = polygon_cb->numPoints;
-	ORDER_FIELD_COORD(1, polygon_cb->xStart);
-	ORDER_FIELD_COORD(2, polygon_cb->yStart);
-	ORDER_FIELD_BYTE(3, polygon_cb->bRop2);
-	ORDER_FIELD_BYTE(4, polygon_cb->fillMode);
-	ORDER_FIELD_COLOR(orderInfo, s, 5, &polygon_cb->backColor);
-	ORDER_FIELD_COLOR(orderInfo, s, 6, &polygon_cb->foreColor);
+	if (!read_order_field_coord(orderInfo, s, 1, &polygon_cb->xStart, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &polygon_cb->yStart, FALSE) ||
+	    !read_order_field_byte(orderInfo, s, 3, &polygon_cb->bRop2, TRUE) ||
+	    !read_order_field_byte(orderInfo, s, 4, &polygon_cb->fillMode, TRUE) ||
+	    !read_order_field_color(orderInfo, s, 5, &polygon_cb->backColor, TRUE) ||
+	    !read_order_field_color(orderInfo, s, 6, &polygon_cb->foreColor, TRUE))
+		return FALSE;

 	if (!update_read_brush(s, &polygon_cb->brush, orderInfo->fieldFlags >> 6))
 		return FALSE;

-	ORDER_FIELD_BYTE(12, num);
-
-	if (orderInfo->fieldFlags & ORDER_FIELD_13)
+	if (!read_order_field_byte(orderInfo, s, 12, &num, TRUE))
+		return FALSE;
+
+	if ((orderInfo->fieldFlags & ORDER_FIELD_13) != 0)
 	{
 		DELTA_POINT* newpoints;

@@ -1943,26 +1985,28 @@
 static BOOL update_read_ellipse_sc_order(wStream* s, const ORDER_INFO* orderInfo,
                                          ELLIPSE_SC_ORDER* ellipse_sc)
 {
-	ORDER_FIELD_COORD(1, ellipse_sc->leftRect);
-	ORDER_FIELD_COORD(2, ellipse_sc->topRect);
-	ORDER_FIELD_COORD(3, ellipse_sc->rightRect);
-	ORDER_FIELD_COORD(4, ellipse_sc->bottomRect);
-	ORDER_FIELD_BYTE(5, ellipse_sc->bRop2);
-	ORDER_FIELD_BYTE(6, ellipse_sc->fillMode);
-	ORDER_FIELD_COLOR(orderInfo, s, 7, &ellipse_sc->color);
+	if (!read_order_field_coord(orderInfo, s, 1, &ellipse_sc->leftRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &ellipse_sc->topRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 3, &ellipse_sc->rightRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 4, &ellipse_sc->bottomRect, FALSE) ||
+	    !read_order_field_byte(orderInfo, s, 5, &ellipse_sc->bRop2, TRUE) ||
+	    !read_order_field_byte(orderInfo, s, 6, &ellipse_sc->fillMode, TRUE) ||
+	    !read_order_field_color(orderInfo, s, 7, &ellipse_sc->color, TRUE))
+		return FALSE;
 	return TRUE;
 }
 static BOOL update_read_ellipse_cb_order(wStream* s, const ORDER_INFO* orderInfo,
                                          ELLIPSE_CB_ORDER* ellipse_cb)
 {
-	ORDER_FIELD_COORD(1, ellipse_cb->leftRect);
-	ORDER_FIELD_COORD(2, ellipse_cb->topRect);
-	ORDER_FIELD_COORD(3, ellipse_cb->rightRect);
-	ORDER_FIELD_COORD(4, ellipse_cb->bottomRect);
-	ORDER_FIELD_BYTE(5, ellipse_cb->bRop2);
-	ORDER_FIELD_BYTE(6, ellipse_cb->fillMode);
-	ORDER_FIELD_COLOR(orderInfo, s, 7, &ellipse_cb->backColor);
-	ORDER_FIELD_COLOR(orderInfo, s, 8, &ellipse_cb->foreColor);
+	if (!read_order_field_coord(orderInfo, s, 1, &ellipse_cb->leftRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 2, &ellipse_cb->topRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 3, &ellipse_cb->rightRect, FALSE) ||
+	    !read_order_field_coord(orderInfo, s, 4, &ellipse_cb->bottomRect, FALSE) ||
+	    !read_order_field_byte(orderInfo, s, 5, &ellipse_cb->bRop2, TRUE) ||
+	    !read_order_field_byte(orderInfo, s, 6, &ellipse_cb->fillMode, TRUE) ||
+	    !read_order_field_color(orderInfo, s, 7, &ellipse_cb->backColor, TRUE) ||
+	    !read_order_field_color(orderInfo, s, 8, &ellipse_cb->foreColor, TRUE))
+		return FALSE;
 	return update_read_brush(s, &ellipse_cb->brush, orderInfo->fieldFlags >> 8);
 }
 /* Secondary Drawing Orders */


astyle

astyle

--- src/validator/obligation_checker.h
+++ src/validator/obligation_checker.h
@@ -187,13 +187,13 @@
     std::vector<OverlapDescriptor>& available_cells, size_t max_size);

   /** Populate a testcase with memory. */
-  bool build_testcase_cell_memory(CpuState& ceg, const CellMemory* target_memory,
-                                                 const CellMemory* rewrite_memory,
-                                                 const Cfg& target, const Cfg& rewrite,
-                                                 bool begin) const;
-
-  bool build_testcase_flat_memory(CpuState&, FlatMemory&,
-                               const std::map<const SymBitVectorAbstract*, uint64_t>& others) const;
+  bool build_testcase_cell_memory(CpuState& ceg, const CellMemory* target_memory,
+                                  const CellMemory* rewrite_memory,
+                                  const Cfg& target, const Cfg& rewrite,
+                                  bool begin) const;
+
+  bool build_testcase_flat_memory(CpuState&, FlatMemory&,
+                                  const std::map<const SymBitVectorAbstract*, uint64_t>& others) const;

   /** Go through lists of pairs of pointers and free all the memory. */
   void delete_memories(std::vector<std::pair<CellMemory*, CellMemory*>>& memories);
@@ -235,9 +235,9 @@
   }

   /** Check if a counterexample actually works. */
-  bool check_counterexample(const Cfg& target, const Cfg& rewrite, const CfgPath& P,
-                                 const CfgPath& Q, const Invariant& assume,
-                                 const Invariant& prove, const CpuState& ceg, const CpuState& ceg2);
+  bool check_counterexample(const Cfg& target, const Cfg& rewrite, const CfgPath& P,
+                            const CfgPath& Q, const Invariant& assume,
+                            const Invariant& prove, const CpuState& ceg, const CpuState& ceg2);

   /** Run the sandbox on a state, cfg along a path.  Used for checking counterexamples. */
   CpuState run_sandbox_on_path(const Cfg& cfg, const CfgPath& P, const CpuState& state);