Mixer fast paths;

Mixer fast paths;

- If no converter is needed, don't create/use it
- If no spatialization is needed, don't copy

In the best case, samples willi now be read into a buffer and immediately mixed into the output.

--- src/modules/audio/audio.c
+++ src/modules/audio/audio.c
@@ -79,6 +79,7 @@
     float mix[BUFFER_SIZE * 2];

     float* dst = count >= BUFFER_SIZE ? output : state.leftovers;
+    float* src = NULL; // The "current" buffer (used for fast paths)

     if (dst == state.leftovers) {
       memset(dst, 0, sizeof(state.leftovers));
@@ -92,25 +93,28 @@
         continue;
       }

+      // Read and convert raw frames until there's BUFFER_SIZE converted frames
       uint32_t channels = outputChannelCountForSource(source);
+      uint64_t frameLimit = sizeof(raw) / source->sound->channels / sizeof(float);
       uint32_t framesToConvert = BUFFER_SIZE;
       uint32_t framesConverted = 0;
       while (framesToConvert > 0) {
-        uint64_t rawCapacity = sizeof(raw) / source->sound->channels / sizeof(float);
-        uint64_t framesToRead = MIN(ma_data_converter_get_required_input_frame_count(source->converter, framesToConvert), rawCapacity);
-        uint64_t framesRead = source->sound->read(source->sound, source->offset, framesToRead, raw);
-
+        src = raw;
+        uint64_t framesToRead = source->converter ? MIN(ma_data_converter_get_required_input_frame_count(source->converter, framesToConvert), frameLimit) : framesToConvert;
+        uint64_t framesRead = source->sound->read(source->sound, source->offset, framesToRead, src);
         ma_uint64 framesIn = framesRead;
         ma_uint64 framesOut = framesToConvert;
-        ma_data_converter_process_pcm_frames(source->converter, raw, &framesIn, aux + framesConverted * channels, &framesOut);
-        // assert(framesIn == framesRead);
-        // assert(framesOut <= framesToConvert);
+
+        if (source->converter) {
+          ma_data_converter_process_pcm_frames(source->converter, src, &framesIn, aux + framesConverted * channels, &framesOut);
+          src = aux;
+        }

         if (framesRead < framesToRead) {
           source->offset = 0;
           if (!source->looping) {
             source->playing = false;
-            memset(aux + framesConverted * channels, 0, framesToConvert * channels * sizeof(float));
+            memset(src + framesConverted * channels, 0, framesToConvert * channels * sizeof(float));
             break;
           }
         }
@@ -120,15 +124,16 @@
         source->offset += framesRead;
       }

+      // Spatialize
       if (source->spatial) {
-        state.spatializer->apply(source, aux, mix, BUFFER_SIZE, BUFFER_SIZE);
-      } else {
-        memcpy(mix, aux, BUFFER_SIZE * OUTPUT_CHANNELS * sizeof(float));
+        state.spatializer->apply(source, src, mix, BUFFER_SIZE, BUFFER_SIZE);
+        src = mix;
       }

+      // Mix
       float volume = source->volume;
       for (uint32_t i = 0; i < OUTPUT_CHANNELS * BUFFER_SIZE; i++) {
-        dst[i] += mix[i] * volume;
+        dst[i] += src[i] * volume;
       }

       list = &source->next;
@@ -140,14 +145,13 @@
       dst[i] += mix[i];
     }

-    // Copy leftovers to output
+    // Copy some leftovers to output
     if (dst == state.leftovers) {
       memcpy(output, state.leftovers, count * OUTPUT_CHANNELS * sizeof(float));
       state.leftoverFrames = BUFFER_SIZE - count;
       state.leftoverOffset = count;
     }

-    // Scroll
     output += BUFFER_SIZE * OUTPUT_CHANNELS;
     count -= MIN(count, BUFFER_SIZE);
   } while (count > 0);
@@ -332,31 +336,33 @@
   source->volume = 1.f;
   source->spatial = spatial;

-  for (size_t i = 0; i < state.converters.length; i++) {
-    ma_data_converter* converter = state.converters.data[i];
-    if (converter->config.formatIn != miniaudioFormats[sound->format]) continue;
-    if (converter->config.sampleRateIn != sound->sampleRate) continue;
-    if (converter->config.channelsIn != sound->channels) continue;
-    if (converter->config.channelsOut != outputChannelCountForSource(source)) continue;
-    source->converter = converter;
-    break;
-  }
-
-  if (!source->converter) {
-    ma_data_converter_config config = ma_data_converter_config_init_default();
-    config.formatIn = miniaudioFormats[sound->format];
-    config.formatOut = miniaudioFormats[OUTPUT_FORMAT];
-    config.channelsIn = sound->channels;
-    config.channelsOut = outputChannelCountForSource(source);
-    config.sampleRateIn = sound->sampleRate;
-    config.sampleRateOut = PLAYBACK_SAMPLE_RATE;
-
-    ma_data_converter* converter = malloc(sizeof(ma_data_converter));
-    ma_result converterStatus = ma_data_converter_init(&config, converter);
-    lovrAssert(converterStatus == MA_SUCCESS, "Problem creating Source data converter #%d: %s (%d)", state.converters.length, ma_result_description(converterStatus), converterStatus);
-
-    arr_push(&state.converters, converter);
-    source->converter = converter;
+  if (sound->format != OUTPUT_FORMAT || sound->channels != outputChannelCountForSource(source) || sound->sampleRate != PLAYBACK_SAMPLE_RATE) {
+    for (size_t i = 0; i < state.converters.length; i++) {
+      ma_data_converter* converter = state.converters.data[i];
+      if (converter->config.formatIn != miniaudioFormats[sound->format]) continue;
+      if (converter->config.sampleRateIn != sound->sampleRate) continue;
+      if (converter->config.channelsIn != sound->channels) continue;
+      if (converter->config.channelsOut != outputChannelCountForSource(source)) continue;
+      source->converter = converter;
+      break;
+    }
+
+    if (!source->converter) {
+      ma_data_converter_config config = ma_data_converter_config_init_default();
+      config.formatIn = miniaudioFormats[sound->format];
+      config.formatOut = miniaudioFormats[OUTPUT_FORMAT];
+      config.channelsIn = sound->channels;
+      config.channelsOut = outputChannelCountForSource(source);
+      config.sampleRateIn = sound->sampleRate;
+      config.sampleRateOut = PLAYBACK_SAMPLE_RATE;
+
+      ma_data_converter* converter = malloc(sizeof(ma_data_converter));
+      ma_result converterStatus = ma_data_converter_init(&config, converter);
+      lovrAssert(converterStatus == MA_SUCCESS, "Problem creating Source data converter #%d: %s (%d)", state.converters.length, ma_result_description(converterStatus), converterStatus);
+
+      arr_push(&state.converters, converter);
+      source->converter = converter;
+    }
   }

   state.spatializer->sourceCreate(source);


Use rint instead of roundf to suppress compiler warnings.

--- src/modules/plus/interp.h
+++ src/modules/plus/interp.h
@@ -36,7 +36,7 @@

 //compile:   gcc -c -O2 -Wall -std=c99 -fPIC interp.c -o interp.o

-//	-std=c99 za roundf()
+//	-std=c99 za rintf()
 //	-fPIC da lahko linkas v .so (za frei0r)

 #include <math.h>
@@ -119,13 +119,13 @@
 {
 	//printf("u=%5.2f v=%5.2f   ",x,y);
 	printf("u=%5.3f v=%5.3f     ",x/(w-1),y/(h-1));
-	//printf("U=%2d V=%2d   ",(int)roundf(x),(int)roundf(y));
-
-#ifdef TEST_XY_LIMITS
-	if ((x<0)||(x>w)||(y<0)||(y>h)) return -1;
-#endif
-
-	*v=sl[(int)roundf(x)+(int)roundf(y)*w];
+	//printf("U=%2d V=%2d   ",(int)rintf(x),(int)rintf(y));
+
+#ifdef TEST_XY_LIMITS
+	if ((x<0)||(x>w)||(y<0)||(y>h)) return -1;
+#endif
+
+	*v=sl[(int)rintf(x)+(int)rintf(y)*w];
 	return 0;
 }

@@ -142,7 +142,7 @@
 	if ((x<0)||(x>w)||(y<0)||(y>h)) return -1;
 #endif

-	*v=sl[(int)roundf(x)+(int)roundf(y)*w];
+	*v=sl[(int)rintf(x)+(int)rintf(y)*w];
 	return 0;
 }

@@ -159,11 +159,11 @@
 #ifdef TEST_XY_LIMITS
 	if ((x<0)||(x>w)||(y<0)||(y>h)) return -1;
 #endif
-	v[3]= sl[(int)roundf(x)*4+(int)roundf(y)*4*w+3];
+	v[3]= sl[(int)rintf(x)*4+(int)rintf(y)*4*w+3];
 	float alpha = (float) v[3] / 255.0;
-	v[0]= v[0] * (1.0 - alpha) + sl[(int)roundf(x)*4+(int)roundf(y)*4*w] * alpha;
-	v[1]= v[1] * (1.0 - alpha) + sl[(int)roundf(x)*4+(int)roundf(y)*4*w+1] * alpha;
-	v[2]= v[2] * (1.0 - alpha) + sl[(int)roundf(x)*4+(int)roundf(y)*4*w+2] * alpha;
+	v[0]= v[0] * (1.0 - alpha) + sl[(int)rintf(x)*4+(int)rintf(y)*4*w] * alpha;
+	v[1]= v[1] * (1.0 - alpha) + sl[(int)rintf(x)*4+(int)rintf(y)*4*w+1] * alpha;
+	v[2]= v[2] * (1.0 - alpha) + sl[(int)rintf(x)*4+(int)rintf(y)*4*w+2] * alpha;

 	return 0;
 }


Clean up a doxygen comment

Clean up a doxygen comment

--- src/vistk/pipeline/edge.h
+++ src/vistk/pipeline/edge.h
@@ -223,7 +223,7 @@
      */
     void set_downstream_process(process_t process);

-    /// Configuration key that indicates the edge implies an execution dependency between upstream and downstream.
+    /// Configuration that indicates the edge implies an execution dependency between upstream and downstream.
     static config::key_t const config_dependency;
     /// Configuration for the maximum capacity of an edge.
     static config::key_t const config_capacity;


Workaround for currution issue that still needs resolving

--- src/mount/hostfs/hostfs.c
+++ src/mount/hostfs/hostfs.c
@@ -143,16 +143,13 @@
         }

         priv_escalate();
-        message(VERBOSE, "Binding '%s' to '%s/%s'\n", mountpoint, container_dir, mountpoint);
+        message(VERBOSE, "Binding '%s'(%s) to '%s/%s'\n", mountpoint, filesystem, container_dir, mountpoint);
         if ( mount(mountpoint, joinpath(container_dir, mountpoint), NULL, MS_BIND|MS_NOSUID|MS_REC, NULL) < 0 ) {
             message(ERROR, "There was an error binding the path %s: %s\n", mountpoint, strerror(errno));
             ABORT(255);
         }
         priv_drop();

-        free(source);
-        free(mountpoint);
-        free(filesystem);
     }

     free(line);


Add valuetype as "standard" type

Add valuetype as "standard" type

Add to vsdg/types.h header to make it available as "standard"
type.

--- include/jive/vsdg/types.h
+++ include/jive/vsdg/types.h
@@ -4,5 +4,6 @@
 #include <jive/vsdg/basetype.h>
 #include <jive/vsdg/statetype.h>
 #include <jive/vsdg/controltype.h>
+#include <jive/vsdg/valuetype.h>

 #endif


fix bug leck

fix bug leck

--- include/knlp/dictionary.h
+++ include/knlp/dictionary.h
@@ -201,7 +201,9 @@
                 }
                 KString kstr(la);
                 Normalize::normalize(kstr);
-                dict_->insert(kstr, vt);
+                if(dict_->find(kstr) == NULL)
+                    dict_->insert(kstr, vt);
+                else delete vt;
                 la = m + 1;
             }
             m++;
@@ -225,14 +227,16 @@

         KString kstr(la);
         Normalize::normalize(kstr);
-        dict_->insert(kstr, vt);
+        if(dict_->find(kstr) == NULL)
+            dict_->insert(kstr, vt);
+        else delete vt;
     }

     ~VectorDictionary()
     {
         for (DictT::iterator it = dict_->begin(); it != dict_->end(); ++it)
         {
-            delete *it.value();
+            delete[] *it.value();
         }
         delete dict_;
         delete[] buf_;


add __attribute__ format to Print::printf compiler now gives warnings by miss usage of printf

--- hardware/esp8266com/esp8266/cores/esp8266/Print.h
+++ hardware/esp8266com/esp8266/cores/esp8266/Print.h
@@ -63,7 +63,7 @@
             return write((const uint8_t *) buffer, size);
         }

-        size_t printf(const char * format, ...);
+        size_t printf(const char * format, ...)  __attribute__ ((format (printf, 2, 3)));
         size_t print(const __FlashStringHelper *);
         size_t print(const String &);
         size_t print(const char[]);


Updating API version and removing redundant forward declaration

--- include/librealsense/rs.h
+++ include/librealsense/rs.h
@@ -5,14 +5,10 @@
 #define LIBREALSENSE_RS_H

 #ifdef __cplusplus
-namespace rs{
-	enum class format;
-}
-
 extern "C" {
 #endif

-#define RS_API_VERSION 6
+#define RS_API_VERSION 7

 typedef enum rs_capabilities
 {


backlight: Revert some const qualifiers

backlight: Revert some const qualifiers

9905a43b2d563e6f89e4c63c4278ada03f2ebb14 went a little to far with const
qualifiers as there are legitiment cases where the function pointers
can change (machine specific setup code for example).

Signed-off-by: Richard Purdie <a03894c799ea916bd571ce8f12ed88f6fb3400f7@linux.intel.com>

--- include/linux/backlight.h
+++ include/linux/backlight.h
@@ -36,18 +36,18 @@
 struct fb_info;

 struct backlight_ops {
-	const unsigned int options;
+	unsigned int options;

 #define BL_CORE_SUSPENDRESUME	(1 << 0)

 	/* Notify the backlight driver some property has changed */
-	int (* const update_status)(struct backlight_device *);
+	int (*update_status)(struct backlight_device *);
 	/* Return the current backlight brightness (accounting for power,
 	   fb_blank etc.) */
-	int (* const get_brightness)(struct backlight_device *);
+	int (*get_brightness)(struct backlight_device *);
 	/* Check if given framebuffer device is the one bound to this backlight;
 	   return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */
-	int (* const check_fb)(struct fb_info *);
+	int (*check_fb)(struct fb_info *);
 };

 /* This structure defines all the properties of a backlight */


samples: mesh_badge: fix property ID

samples: mesh_badge: fix property ID

The mesh_badge sample uses a GATT Characteristic instead of a Mesh
Device Property to report the temperature. In addition to that the
status message is filled with with a GATT Unit instead of a the Mesh
Device Property.

Fix that by reporting a Present Device Operating Temperature, ie 0x0054
instead. This has the advantage of keeping the an s16t value to report
the temperature. This however change the marshalled format from B to A.

Signed-off-by: Aurelien Jarno <bceb368e7f2cb351af47298f32034f0587bbe4a6@aurel32.net>

--- samples/boards/reel_board/mesh_badge/src/mesh.c
+++ samples/boards/reel_board/mesh_badge/src/mesh.c
@@ -37,9 +37,7 @@

 #define MAX_SENS_STATUS_LEN 8

-#define SENS_PROP_ID_TEMP_CELSIUS 0x2A1F
-#define SENS_PROP_ID_UNIT_TEMP_CELSIUS 0x272F
-#define SENS_PROP_ID_TEMP_CELSIUS_SIZE 2
+#define SENS_PROP_ID_PRESENT_DEVICE_TEMP 0x0054

 enum {
 	SENSOR_HDR_A = 0,
@@ -205,14 +203,14 @@

 static void sens_temperature_celsius_fill(struct net_buf_simple *msg)
 {
-	struct sensor_hdr_b hdr;
+	struct sensor_hdr_a hdr;
 	/* TODO Get only temperature from sensor */
 	struct sensor_value val[2];
 	s16_t temp_degrees;

-	hdr.format = SENSOR_HDR_B;
+	hdr.format = SENSOR_HDR_A;
 	hdr.length = sizeof(temp_degrees);
-	hdr.prop_id = SENS_PROP_ID_UNIT_TEMP_CELSIUS;
+	hdr.prop_id = SENS_PROP_ID_PRESENT_DEVICE_TEMP;

 	get_hdc1010_val(val);
 	temp_degrees = sensor_value_to_double(&val[0]);
@@ -246,7 +244,7 @@
 	bt_mesh_model_msg_init(msg, BT_MESH_MODEL_OP_SENS_STATUS);

 	switch (id) {
-	case SENS_PROP_ID_TEMP_CELSIUS:
+	case SENS_PROP_ID_PRESENT_DEVICE_TEMP:
 		sens_temperature_celsius_fill(msg);
 		break;
 	default:


hiomap: quieten warning on failing to move a window

This isn't *necessarily* an error that we should complain loudly about.
If, for example, the BMC enforces the Read Only flag on a FFS partition,
opening a write window *should* fail, and we do indeed test this in
op-test.

Thus we deal with the error in a well known path: returning an error
code and then it's eventually a userspace problem.

Signed-off-by: Stewart Smith <ec31ab75ddf977353c8f660f92ea8b23f64aef25@linux.ibm.com>
Reviewed-by: Andrew Jeffery <02e0a999c50b1f88df7a8f5a04e1b76b35ea6a88@aj.id.au>
Signed-off-by: Stewart Smith <ec31ab75ddf977353c8f660f92ea8b23f64aef25@linux.ibm.com>

--- libflash/ipmi-hiomap.c
+++ libflash/ipmi-hiomap.c
@@ -277,7 +277,7 @@
 	ipmi_queue_msg_sync(msg);

 	if (res.cc != IPMI_CC_NO_ERROR) {
-		prerror("%s failed: %d\n", __func__, res.cc);
+		prlog(PR_INFO, "%s failed: %d\n", __func__, res.cc);
 		return false;
 	}


clang-format LLVM.h (NFC)

clang-format LLVM.h (NFC)

Summary:
- LLVM style does not indent inside namespaces
- Alphabetize

Reviewers: ruiu

Subscribers: sbc100, llvm-commits

Differential Revision: https://reviews.llvm.org/D55406

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@348652 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/lld/Common/LLVM.h
+++ include/lld/Common/LLVM.h
@@ -22,65 +22,65 @@
 #include <utility>

 namespace llvm {
-  // ADT's.
-  class raw_ostream;
-  class Error;
-  class StringRef;
-  class Twine;
-  class MemoryBuffer;
-  class MemoryBufferRef;
-  template<typename T> class ArrayRef;
-  template<unsigned InternalLen> class SmallString;
-  template<typename T, unsigned N> class SmallVector;
-  template<typename T> class ErrorOr;
-  template<typename T> class Expected;
+// ADT's.
+class raw_ostream;
+class Error;
+class StringRef;
+class Twine;
+class MemoryBuffer;
+class MemoryBufferRef;
+template <typename T> class ArrayRef;
+template <unsigned InternalLen> class SmallString;
+template <typename T, unsigned N> class SmallVector;
+template <typename T> class ErrorOr;
+template <typename T> class Expected;

-  namespace object {
-    class WasmObjectFile;
-    struct WasmSection;
-    struct WasmSegment;
-    class WasmSymbol;
-  }
+namespace object {
+class WasmObjectFile;
+struct WasmSection;
+struct WasmSegment;
+class WasmSymbol;
+} // namespace object

-  namespace wasm {
-    struct WasmFunction;
-    struct WasmGlobal;
-    struct WasmGlobalType;
-    struct WasmRelocation;
-    struct WasmSignature;
-  }
-}
+namespace wasm {
+struct WasmFunction;
+struct WasmGlobal;
+struct WasmGlobalType;
+struct WasmRelocation;
+struct WasmSignature;
+} // namespace wasm
+} // namespace llvm

 namespace lld {
-  // Casting operators.
-  using llvm::isa;
-  using llvm::cast;
-  using llvm::dyn_cast;
-  using llvm::dyn_cast_or_null;
-  using llvm::cast_or_null;
+// Casting operators.
+using llvm::cast;
+using llvm::cast_or_null;
+using llvm::dyn_cast;
+using llvm::dyn_cast_or_null;
+using llvm::isa;

-  // ADT's.
-  using llvm::raw_ostream;
-  using llvm::Error;
-  using llvm::StringRef;
-  using llvm::Twine;
-  using llvm::MemoryBuffer;
-  using llvm::MemoryBufferRef;
-  using llvm::ArrayRef;
-  using llvm::SmallString;
-  using llvm::SmallVector;
-  using llvm::ErrorOr;
-  using llvm::Expected;
+// ADT's.
+using llvm::ArrayRef;
+using llvm::Error;
+using llvm::ErrorOr;
+using llvm::Expected;
+using llvm::MemoryBuffer;
+using llvm::MemoryBufferRef;
+using llvm::raw_ostream;
+using llvm::SmallString;
+using llvm::SmallVector;
+using llvm::StringRef;
+using llvm::Twine;

-  using llvm::object::WasmObjectFile;
-  using llvm::object::WasmSection;
-  using llvm::object::WasmSegment;
-  using llvm::object::WasmSymbol;
-  using llvm::wasm::WasmFunction;
-  using llvm::wasm::WasmGlobal;
-  using llvm::wasm::WasmGlobalType;
-  using llvm::wasm::WasmRelocation;
-  using llvm::wasm::WasmSignature;
+using llvm::object::WasmObjectFile;
+using llvm::object::WasmSection;
+using llvm::object::WasmSegment;
+using llvm::object::WasmSymbol;
+using llvm::wasm::WasmFunction;
+using llvm::wasm::WasmGlobal;
+using llvm::wasm::WasmGlobalType;
+using llvm::wasm::WasmRelocation;
+using llvm::wasm::WasmSignature;
 } // end namespace lld.

 namespace std {
@@ -90,6 +90,6 @@
     return llvm::hash_value(s);
   }
 };
-}
+} // namespace std

 #endif


added missing namespace check in namespace-attach-module

svn: r1364

--- src/mzscheme/src/module.c
+++ src/mzscheme/src/module.c
@@ -979,6 +979,8 @@

   from_env = (Scheme_Env *)argv[0];
   if (argc > 2) {
+    if (!SCHEME_NAMESPACEP(argv[2]))
+      scheme_wrong_type("namespace-attach-module", "namespace", 2, argc, argv);
     to_env = (Scheme_Env *)argv[2];
     skip_notify = 1;
   } else


Removed unneeded parentheses.

Removed unneeded parentheses.

--- src/vrkit/plugin/Module.h
+++ src/vrkit/plugin/Module.h
@@ -101,7 +101,7 @@

       // GCC versions older than 4.0 do not handle the reinterpret_cast usage
       // below correctly.
-#if defined(__GNUC__) && (__GNUC_MAJOR__) < 4
+#if defined(__GNUC__) && __GNUC_MAJOR__ < 4
       return (CFuncType) getSymbol(name);
 #else
       return reinterpret_cast<CFuncType>(getSymbol(name));


slices 10 - fix slice flags when writing PBC

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@6253 d31e2699-5ff4-0310-a27c-f18f2fbe73fe

--- src/packout.c
+++ src/packout.c
@@ -65,7 +65,7 @@
 =item C<void
 PackFile_pack(struct PackFile *self, opcode_t *cursor)>

-Pack the PackFile into a contiguous region of memory.
+Pack the PackFile into a contiguous region of memory.

 Note that the memory block had better have at least the amount of memory
 indicated by C<PackFile_pack_size()>.
@@ -223,6 +223,7 @@
 {
     struct PMC *key;
     size_t i;
+    opcode_t type, slice_bits;

     *cursor++ = self->type;

@@ -264,40 +265,54 @@
         *cursor++ = i;
         /* and now type / value per component */
         for (key = self->u.key; key; key = PMC_data(key)) {
-            switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
-            case KEY_integer_FLAG:
-                *cursor++ = PARROT_ARG_IC;
-                *cursor++ = PMC_int_val(key);
-                break;
-            case KEY_number_FLAG:
-                *cursor++ = PARROT_ARG_NC;
-                *cursor++ = find_in_const(key, PFC_NUMBER);     /* Argh */
-                break;
-            case KEY_string_FLAG:
-                *cursor++ = PARROT_ARG_SC;
-                *cursor++ = find_in_const(key, PFC_STRING);     /* Argh */
-                break;
-
-            case KEY_integer_FLAG | KEY_register_FLAG:
-                *cursor++ = PARROT_ARG_I;
-                *cursor++ = PMC_int_val(key);
-                break;
-            case KEY_number_FLAG | KEY_register_FLAG:
-                *cursor++ = PARROT_ARG_N;
-                *cursor++ = PMC_int_val(key);
-                break;
-            case KEY_string_FLAG | KEY_register_FLAG:
-                *cursor++ = PARROT_ARG_S;
-                *cursor++ = PMC_int_val(key);
-                break;
-            case KEY_pmc_FLAG | KEY_register_FLAG:
-                *cursor++ = PARROT_ARG_P;
-                *cursor++ = PMC_int_val(key);
-                break;
-            default:
-                PIO_eprintf(NULL, "PackFile_Constant_pack: "
+            type = PObj_get_FLAGS(key);
+            slice_bits = 0;
+            if ((type & (KEY_start_slice_FLAG|KEY_inf_slice_FLAG)) ==
+                    (KEY_start_slice_FLAG|KEY_inf_slice_FLAG))
+                slice_bits |= PF_VT_END_INF;
+            if ((type & (KEY_end_slice_FLAG|KEY_inf_slice_FLAG)) ==
+                    (KEY_end_slice_FLAG|KEY_inf_slice_FLAG))
+                slice_bits |= PF_VT_START_ZERO;
+            if (type & KEY_start_slice_FLAG)
+                slice_bits |= PF_VT_START_SLICE;
+            if (type & KEY_end_slice_FLAG)
+                slice_bits |= PF_VT_END_SLICE;
+
+            type &= KEY_type_FLAGS;
+            switch (type) {
+                case KEY_integer_FLAG:
+                    *cursor++ = PARROT_ARG_IC | slice_bits;
+                    *cursor++ = PMC_int_val(key);
+                    break;
+                case KEY_number_FLAG:
+                    *cursor++ = PARROT_ARG_NC | slice_bits;
+                    *cursor++ = find_in_const(key, PFC_NUMBER);     /* Argh */
+                    break;
+                case KEY_string_FLAG:
+                    *cursor++ = PARROT_ARG_SC | slice_bits;
+                    *cursor++ = find_in_const(key, PFC_STRING);     /* Argh */
+                    break;
+
+                case KEY_integer_FLAG | KEY_register_FLAG:
+                    *cursor++ = PARROT_ARG_I | slice_bits;
+                    *cursor++ = PMC_int_val(key);
+                    break;
+                case KEY_number_FLAG | KEY_register_FLAG:
+                    *cursor++ = PARROT_ARG_N | slice_bits;
+                    *cursor++ = PMC_int_val(key);
+                    break;
+                case KEY_string_FLAG | KEY_register_FLAG:
+                    *cursor++ = PARROT_ARG_S | slice_bits;
+                    *cursor++ = PMC_int_val(key);
+                    break;
+                case KEY_pmc_FLAG | KEY_register_FLAG:
+                    *cursor++ = PARROT_ARG_P | slice_bits;
+                    *cursor++ = PMC_int_val(key);
+                    break;
+                default:
+                    PIO_eprintf(NULL, "PackFile_Constant_pack: "
                             "unsupported constant type\n");
-                Parrot_exit(1);
+                    Parrot_exit(1);
             }
         }


allow these to take a generic Value*

allow these to take a generic Value*

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@21492 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/llvm/InstrTypes.h
+++ include/llvm/InstrTypes.h
@@ -208,10 +208,10 @@
   /// getNegArgument, getNotArgument - Helper functions to extract the
   ///     unary argument of a NEG or NOT operation implemented via Sub or Xor.
   ///
-  static const Value*    getNegArgument(const BinaryOperator* Bop);
-  static       Value*    getNegArgument(      BinaryOperator* Bop);
-  static const Value*    getNotArgument(const BinaryOperator* Bop);
-  static       Value*    getNotArgument(      BinaryOperator* Bop);
+  static const Value*    getNegArgument(const Value *BinOp);
+  static       Value*    getNegArgument(      Value *BinOp);
+  static const Value*    getNotArgument(const Value *BinOp);
+  static       Value*    getNotArgument(      Value *BinOp);

   BinaryOps getOpcode() const {
     return static_cast<BinaryOps>(Instruction::getOpcode());


improve error message on re-definition of a constant

svn: r7907

--- src/mzscheme/src/syntax.c
+++ src/mzscheme/src/syntax.c
@@ -617,17 +617,22 @@
   else {
     if (((Scheme_Bucket_With_Home *)b)->home->module) {
       const char *msg;
+      int is_set;

       if (SCHEME_TRUEP(scheme_get_param(scheme_current_config(), MZCONFIG_ERROR_PRINT_SRCLOC)))
 	msg = "%s: cannot %s: %S in module: %D";
       else
 	msg = "%s: cannot %s: %S";

+      is_set = !strcmp(who, "set!");
+
       scheme_raise_exn(MZEXN_FAIL_CONTRACT_VARIABLE, b->key,
 		       msg,
 		       who,
 		       (b->val
-			? "change identifier that is instantiated as a module constant"
+			? (is_set
+                           ? "modify a constant"
+                           : "re-define a constant")
 			: "set identifier before its definition"),
 		       (Scheme_Object *)b->key,
 		       ((Scheme_Bucket_With_Home *)b)->home->module->modname);


Prototyped out part of indexed image support, added docs.

--- libguac/include/hash.h
+++ libguac/include/hash.h
@@ -42,6 +42,91 @@
 #include <cairo/cairo.h>

 /**
+ * A wrapper for a Cairo surface which allows fast image queries (linear time
+ * in the size of the query image). Given an arbitrary input image, the first
+ * occurence of that image within the contained surface can be found quickly.
+ */
+typedef struct guac_indexed_surface {
+
+    /**
+     * The Cairo surface which is indexed.
+     */
+    cairo_surface_t* surface;
+
+} guac_indexed_surface;
+
+typedef struct guac_indexed_surface_subimage {
+
+    /**
+     * The indexed surface this subimage is a part of.
+     */
+    guac_indexed_surface* surface;
+
+    /**
+     * The X coordinate of the upper-left point of the rectangle
+     * of the subimage.
+     */
+    int x;
+
+    /**
+     * The Y coordinate of the upper-left point of the rectangle
+     * of the subimage.
+     */
+    int y;
+
+    /**
+     * The width of the subimage in pixels.
+     */
+    int width;
+
+    /**
+     * The height of the subimage in pixels.
+     */
+    int height;
+
+} guac_indexed_surface_subimage;
+
+/**
+ * Creates a new indexed surface, using the given surface as the image data
+ * source. The given surface will be made searchable such that queries of
+ * images which are at least the given width and height can be resolved
+ * quickly.
+ *
+ * @param surface The Cairo surface to index.
+ * @param min_width The minimum image width to allow for queries.
+ * @param min_height The minimum image height to allow for queries.
+ * @return A newly allocated guac_indexed_surface.
+ */
+guac_indexed_surface* guac_indexed_surface_alloc(cairo_surface_t* surface,
+        int min_width, int min_height);
+
+/**
+ * Frees the given indexed surface.
+ *
+ * @param surface The guac_indexed_surface to free.
+ */
+void guac_indexed_surface_free(guac_indexed_surface* surface);
+
+/**
+ * Given an indexed surface and a query image, finds the rectangle of the
+ * subimage of the indexed surface containing exactly the query image (if
+ * any) and saves the result.
+ *
+ * @param surface The guac_indexed_surface to query.
+ * @param query The image to search for within the indexed surface.
+ * @param result A pointer to an already-allocated
+ *               guac_indexed_surface_subimage which will be modified
+ *               to contain the result if a result is found.
+ * @return Non-zero if the given query image was found within the indexed
+ *         surface, in which case the result will be stored in the given
+ *         guac_indexed_surface_subimage, or zero if the query image could
+ *         not be found, in which case the given guac_indexed_surface_subimage
+ *         will not be modified.
+ */
+int guac_indexed_surface_find(guac_indexed_surface* surface,
+        cairo_surface_t* query, guac_indexed_surface_subimage* result);
+
+/**
  * Produces a 24-bit hash value from all pixels of the given surface. The
  * surface provided must be RGB or ARGB with each pixel stored in 32 bits.
  * The hashing algorithm used is a variant of the cyclic polynomial rolling
@@ -53,6 +138,17 @@
  */
 unsigned int guac_hash_surface(cairo_surface_t* surface);

+/**
+ * Given two Cairo surfaces, returns zero if the data contained within each
+ * is identical, and a positive or negative value if the value of the first
+ * is found to be lexically greater or less than the second respectively.
+ *
+ * @param a The first Cairo surface to compare.
+ * @param b The Cairo surface to compare the first surface against.
+ * @return Zero if the data contained within each is identical, and a positive
+ *         or negative value if the value of the first is found to be lexically
+ *         greater or less than the second respectively.
+ */
 int guac_surface_cmp(cairo_surface_t* a, cairo_surface_t* b);

 #endif


added do_async

added do_async

--- include/mlk/tools/utils.h
+++ include/mlk/tools/utils.h
@@ -33,6 +33,15 @@
 		std::transform(std::begin(cpy), std::end(cpy), std::begin(cpy), [](char c){return std::tolower(c);});
 		return cpy[0] == 't' || cpy[0] == '1';
 	}
+
+    template<typename Func, typename... Args, typename Lambda_Return = typename mlk::lambda_info<Func>::return_type>
+    auto do_async(Func&& f, Args&&... args)
+    {
+        std::packaged_task<Lambda_Return(Args...)> task{f};
+        std::future<Lambda_Return> future{task.get_future()};
+        std::thread{std::move(task), std::forward<Args>(args)...}.detach();
+        return future;
+    }
 }


Add basic packet handler

Add basic packet handler

This is a handler that handles each packet before the first protocol
handler is called. This is useful to setup the stackinfo structure so
that the protocol handlers do not need the if/else construction. It is
also useful to perform tasks that is unrelated to any of the protocols
being handled, like printing generic packet information.

--- pcapfun.c
+++ pcapfun.c
@@ -50,12 +50,18 @@
 	bpf_u_int32 offset;
 } stackinfo_t;

+typedef struct packetinfo_t {
+	pcap_handler handler;
+} packetinfo_t;
+
 /* function prototypes */
 static void usage(char *program);
 static struct stackinfo_t *stackinfo_new(void);
+static struct packetinfo_t *packetinfo_new(pcap_handler link_handler);
 static pcap_t *setup_capture(char *device, char *filter);
 static int setup_filter(pcap_t *capt, char *device, char *filter);
 static pcap_handler get_link_handler(pcap_t *capt);
+static void handle_packet(u_char *args, const struct pcap_pkthdr *pkthdr, const u_char *packet);
 static void handle_ethernet(u_char *args, const struct pcap_pkthdr *pkthdr, const u_char *packet);
 static void handle_ipv4(u_char *args, const struct pcap_pkthdr *pkthdr, const u_char *packet);
 static void handle_udp(u_char *args, const struct pcap_pkthdr *pkthdr, const u_char *packet);
@@ -64,7 +70,8 @@
 main(int argc, char **argv)
 {
 	pcap_t *capt;
-	pcap_handler pkt_handler;
+	pcap_handler link_handler;
+	struct packetinfo_t *packetinfo;

 	/* check usage */
 	if (argc != 3) {
@@ -77,13 +84,16 @@
 	if (!capt)
 		return EXIT_FAILURE;

-	/* get packet handler based on link type */
-	pkt_handler = get_link_handler(capt);
-	if (!pkt_handler)
+	/* get link handler based on link type */
+	link_handler = get_link_handler(capt);
+	if (!link_handler)
 		return EXIT_FAILURE;

+	/* get packetinfo structure */
+	packetinfo = packetinfo_new(link_handler);
+
 	/* capture and process 10 packets */
-	pcap_loop(capt, 10, pkt_handler, NULL);
+	pcap_loop(capt, 10, handle_packet, (u_char *)packetinfo);

 	return EXIT_SUCCESS;
 }
@@ -115,6 +125,27 @@
 	stackinfo.offset = 0;

 	return &stackinfo;
+}
+
+/*
+ * Initialize packetinfo.
+ *
+ * The packetinfo structure is used to pass info to the packet handler:
+ *
+ *  - The packetinfo.handler is a function pointer to the handler that
+ *    hould be used to handle the first protocol.
+ *
+ * Returns a pointer to the static packetinfo buffer.
+ */
+
+static struct packetinfo_t *
+packetinfo_new(pcap_handler link_handler)
+{
+	static struct packetinfo_t packetinfo;
+
+	packetinfo.handler = link_handler;
+
+	return &packetinfo;
 }

 /*
@@ -214,6 +245,40 @@
 }

 /* ****************************************************************** */
+/* ************************ Packet handlers ************************* */
+/* ****************************************************************** */
+
+/*
+ * Basic packet handler.
+ */
+
+static void
+handle_packet(u_char *args, const struct pcap_pkthdr *pkthdr,
+	const u_char *packet)
+{
+	struct stackinfo_t *stackinfo;
+	struct packetinfo_t *packetinfo;
+
+	/* get clean stackinfo structure */
+	stackinfo = stackinfo_new();
+
+	/* extract the packetinfo structure */
+	packetinfo = (struct packetinfo_t *)(args);
+
+	/* print packet info */
+	printf("[pcap] time: %ld.%06ld len: %lu caplen: %lu\n",
+		(long)pkthdr->ts.tv_sec,
+		(long)pkthdr->ts.tv_usec,
+		(unsigned long)pkthdr->len,
+		(unsigned long)pkthdr->caplen);
+
+	/* handle the first protocol layer */
+	packetinfo->handler((u_char *)stackinfo, pkthdr, packet);
+
+	return;
+}
+
+/* ****************************************************************** */
 /* *********************** Protocol handlers ************************ */
 /* ****************************************************************** */

@@ -230,11 +295,8 @@
 	struct stackinfo_t *stackinfo;
 	pcap_handler handle_next = NULL;

-	/* extract stackinfo or get new one */
-	if (args)
-		stackinfo = (struct stackinfo_t*)(args);
-	else
-		stackinfo = stackinfo_new();
+	/* extract stackinfo */
+	stackinfo = (struct stackinfo_t*)(args);

 	/* check if header was captured completely */
 	if (pkthdr->caplen - stackinfo->offset < ETHER_SIZE) {
@@ -288,11 +350,8 @@
 	uint16_t ip_len, ip_off, offset;
 	pcap_handler handle_next = NULL;

-	/* extract stackinfo or get new one */
-	if (args)
-		stackinfo = (struct stackinfo_t*)(args);
-	else
-		stackinfo = stackinfo_new();
+	/* extract stackinfo */
+	stackinfo = (struct stackinfo_t*)(args);

 	/* check if header was captured completely */
 	if (pkthdr->caplen - stackinfo->offset < IPV4_SIZE) {
@@ -380,11 +439,8 @@
 	struct udphdr *udp;
 	struct stackinfo_t *stackinfo;

-	/* extract stackinfo or get new one */
-	if (args)
-		stackinfo = (struct stackinfo_t*)(args);
-	else
-		stackinfo = stackinfo_new();
+	/* extract stackinfo */
+	stackinfo = (struct stackinfo_t*)(args);

 	/* check if header was captured completely */
 	if (pkthdr->caplen - stackinfo->offset < UDP_SIZE) {


Fix flatten() operation for products without time dimension

--- libharp/harp-product.c
+++ libharp/harp-product.c
@@ -1774,6 +1774,10 @@
         /* the variable must be time-dependend */
         if (var->dimension_type[0] != harp_dimension_time)
         {
+            if (product->dimension[harp_dimension_time] == 0)
+            {
+                product->dimension[harp_dimension_time] = 1;
+            }
             if (harp_variable_add_dimension(var, 0, harp_dimension_time, product->dimension[harp_dimension_time]))
             {
                 return -1;


crc32c speedup

crc32c speedup

--- pcrc32c.c
+++ pcrc32c.c
@@ -39,6 +39,10 @@
 #include <nmmintrin.h>
 #define CRC32_HW
 #define CRC32_MSC
+#endif
+
+#ifdef CRC32_HW
+#define CRC32_PARALLEL_CHUNK 1360
 #endif

 static const uint32_t crc32c_table[8][256]={
@@ -413,9 +417,9 @@
   return (ecx>>20)&1;
 }

-#define CRC32C_64BIT_HW(crc, data) asm("crc32q %[value], %[crcval]\n" : [crcval] "+r" (crc) : [value] "r" (data))
-#define CRC32C_32BIT_HW(crc, data) asm("crc32l %[value], %[crcval]\n" : [crcval] "+r" (crc) : [value] "r" (data))
-#define CRC32C_8BIT_HW(crc, data) asm("crc32b %[value], %[crcval]\n" : [crcval] "+r" (crc) : [value] "r" (data))
+#define CRC32C_64BIT_HW(crc, data) asm("crc32q %[value], %[crcval]\n" : [crcval] "+r" (crc) : [value] "g" (data))
+#define CRC32C_32BIT_HW(crc, data) asm("crc32l %[value], %[crcval]\n" : [crcval] "+r" (crc) : [value] "g" (data))
+#define CRC32C_8BIT_HW(crc, data) asm("crc32b %[value], %[crcval]\n" : [crcval] "+r" (crc) : [value] "g" (data))

 #elif defined(CRC32_MSC)

@@ -435,87 +439,211 @@

 #endif

+/* we can trade this big table to a single uint32_t[32] and do bit by bit replacement, but it is significantly slower */
+static uint32_t crc32c_shift_chunk_table1360[4][256]={
+  {
+    0x00000000, 0x79113270, 0xf22264e0, 0x8b335690, 0xe1a8bf31, 0x98b98d41, 0x138adbd1, 0x6a9be9a1,
+    0xc6bd0893, 0xbfac3ae3, 0x349f6c73, 0x4d8e5e03, 0x2715b7a2, 0x5e0485d2, 0xd537d342, 0xac26e132,
+    0x889667d7, 0xf18755a7, 0x7ab40337, 0x03a53147, 0x693ed8e6, 0x102fea96, 0x9b1cbc06, 0xe20d8e76,
+    0x4e2b6f44, 0x373a5d34, 0xbc090ba4, 0xc51839d4, 0xaf83d075, 0xd692e205, 0x5da1b495, 0x24b086e5,
+    0x14c0b95f, 0x6dd18b2f, 0xe6e2ddbf, 0x9ff3efcf, 0xf568066e, 0x8c79341e, 0x074a628e, 0x7e5b50fe,
+    0xd27db1cc, 0xab6c83bc, 0x205fd52c, 0x594ee75c, 0x33d50efd, 0x4ac43c8d, 0xc1f76a1d, 0xb8e6586d,
+    0x9c56de88, 0xe547ecf8, 0x6e74ba68, 0x17658818, 0x7dfe61b9, 0x04ef53c9, 0x8fdc0559, 0xf6cd3729,
+    0x5aebd61b, 0x23fae46b, 0xa8c9b2fb, 0xd1d8808b, 0xbb43692a, 0xc2525b5a, 0x49610dca, 0x30703fba,
+    0x298172be, 0x509040ce, 0xdba3165e, 0xa2b2242e, 0xc829cd8f, 0xb138ffff, 0x3a0ba96f, 0x431a9b1f,
+    0xef3c7a2d, 0x962d485d, 0x1d1e1ecd, 0x640f2cbd, 0x0e94c51c, 0x7785f76c, 0xfcb6a1fc, 0x85a7938c,
+    0xa1171569, 0xd8062719, 0x53357189, 0x2a2443f9, 0x40bfaa58, 0x39ae9828, 0xb29dceb8, 0xcb8cfcc8,
+    0x67aa1dfa, 0x1ebb2f8a, 0x9588791a, 0xec994b6a, 0x8602a2cb, 0xff1390bb, 0x7420c62b, 0x0d31f45b,
+    0x3d41cbe1, 0x4450f991, 0xcf63af01, 0xb6729d71, 0xdce974d0, 0xa5f846a0, 0x2ecb1030, 0x57da2240,
+    0xfbfcc372, 0x82edf102, 0x09dea792, 0x70cf95e2, 0x1a547c43, 0x63454e33, 0xe87618a3, 0x91672ad3,
+    0xb5d7ac36, 0xccc69e46, 0x47f5c8d6, 0x3ee4faa6, 0x547f1307, 0x2d6e2177, 0xa65d77e7, 0xdf4c4597,
+    0x736aa4a5, 0x0a7b96d5, 0x8148c045, 0xf859f235, 0x92c21b94, 0xebd329e4, 0x60e07f74, 0x19f14d04,
+    0x5302e57c, 0x2a13d70c, 0xa120819c, 0xd831b3ec, 0xb2aa5a4d, 0xcbbb683d, 0x40883ead, 0x39990cdd,
+    0x95bfedef, 0xecaedf9f, 0x679d890f, 0x1e8cbb7f, 0x741752de, 0x0d0660ae, 0x8635363e, 0xff24044e,
+    0xdb9482ab, 0xa285b0db, 0x29b6e64b, 0x50a7d43b, 0x3a3c3d9a, 0x432d0fea, 0xc81e597a, 0xb10f6b0a,
+    0x1d298a38, 0x6438b848, 0xef0beed8, 0x961adca8, 0xfc813509, 0x85900779, 0x0ea351e9, 0x77b26399,
+    0x47c25c23, 0x3ed36e53, 0xb5e038c3, 0xccf10ab3, 0xa66ae312, 0xdf7bd162, 0x544887f2, 0x2d59b582,
+    0x817f54b0, 0xf86e66c0, 0x735d3050, 0x0a4c0220, 0x60d7eb81, 0x19c6d9f1, 0x92f58f61, 0xebe4bd11,
+    0xcf543bf4, 0xb6450984, 0x3d765f14, 0x44676d64, 0x2efc84c5, 0x57edb6b5, 0xdcdee025, 0xa5cfd255,
+    0x09e93367, 0x70f80117, 0xfbcb5787, 0x82da65f7, 0xe8418c56, 0x9150be26, 0x1a63e8b6, 0x6372dac6,
+    0x7a8397c2, 0x0392a5b2, 0x88a1f322, 0xf1b0c152, 0x9b2b28f3, 0xe23a1a83, 0x69094c13, 0x10187e63,
+    0xbc3e9f51, 0xc52fad21, 0x4e1cfbb1, 0x370dc9c1, 0x5d962060, 0x24871210, 0xafb44480, 0xd6a576f0,
+    0xf215f015, 0x8b04c265, 0x003794f5, 0x7926a685, 0x13bd4f24, 0x6aac7d54, 0xe19f2bc4, 0x988e19b4,
+    0x34a8f886, 0x4db9caf6, 0xc68a9c66, 0xbf9bae16, 0xd50047b7, 0xac1175c7, 0x27222357, 0x5e331127,
+    0x6e432e9d, 0x17521ced, 0x9c614a7d, 0xe570780d, 0x8feb91ac, 0xf6faa3dc, 0x7dc9f54c, 0x04d8c73c,
+    0xa8fe260e, 0xd1ef147e, 0x5adc42ee, 0x23cd709e, 0x4956993f, 0x3047ab4f, 0xbb74fddf, 0xc265cfaf,
+    0xe6d5494a, 0x9fc47b3a, 0x14f72daa, 0x6de61fda, 0x077df67b, 0x7e6cc40b, 0xf55f929b, 0x8c4ea0eb,
+    0x206841d9, 0x597973a9, 0xd24a2539, 0xab5b1749, 0xc1c0fee8, 0xb8d1cc98, 0x33e29a08, 0x4af3a878
+  },
+  {
+    0x00000000, 0xa605caf8, 0x49e7e301, 0xefe229f9, 0x93cfc602, 0x35ca0cfa, 0xda282503, 0x7c2deffb,
+    0x2273faf5, 0x8476300d, 0x6b9419f4, 0xcd91d30c, 0xb1bc3cf7, 0x17b9f60f, 0xf85bdff6, 0x5e5e150e,
+    0x44e7f5ea, 0xe2e23f12, 0x0d0016eb, 0xab05dc13, 0xd72833e8, 0x712df910, 0x9ecfd0e9, 0x38ca1a11,
+    0x66940f1f, 0xc091c5e7, 0x2f73ec1e, 0x897626e6, 0xf55bc91d, 0x535e03e5, 0xbcbc2a1c, 0x1ab9e0e4,
+    0x89cfebd4, 0x2fca212c, 0xc02808d5, 0x662dc22d, 0x1a002dd6, 0xbc05e72e, 0x53e7ced7, 0xf5e2042f,
+    0xabbc1121, 0x0db9dbd9, 0xe25bf220, 0x445e38d8, 0x3873d723, 0x9e761ddb, 0x71943422, 0xd791feda,
+    0xcd281e3e, 0x6b2dd4c6, 0x84cffd3f, 0x22ca37c7, 0x5ee7d83c, 0xf8e212c4, 0x17003b3d, 0xb105f1c5,
+    0xef5be4cb, 0x495e2e33, 0xa6bc07ca, 0x00b9cd32, 0x7c9422c9, 0xda91e831, 0x3573c1c8, 0x93760b30,
+    0x1673a159, 0xb0766ba1, 0x5f944258, 0xf99188a0, 0x85bc675b, 0x23b9ada3, 0xcc5b845a, 0x6a5e4ea2,
+    0x34005bac, 0x92059154, 0x7de7b8ad, 0xdbe27255, 0xa7cf9dae, 0x01ca5756, 0xee287eaf, 0x482db457,
+    0x529454b3, 0xf4919e4b, 0x1b73b7b2, 0xbd767d4a, 0xc15b92b1, 0x675e5849, 0x88bc71b0, 0x2eb9bb48,
+    0x70e7ae46, 0xd6e264be, 0x39004d47, 0x9f0587bf, 0xe3286844, 0x452da2bc, 0xaacf8b45, 0x0cca41bd,
+    0x9fbc4a8d, 0x39b98075, 0xd65ba98c, 0x705e6374, 0x0c738c8f, 0xaa764677, 0x45946f8e, 0xe391a576,
+    0xbdcfb078, 0x1bca7a80, 0xf4285379, 0x522d9981, 0x2e00767a, 0x8805bc82, 0x67e7957b, 0xc1e25f83,
+    0xdb5bbf67, 0x7d5e759f, 0x92bc5c66, 0x34b9969e, 0x48947965, 0xee91b39d, 0x01739a64, 0xa776509c,
+    0xf9284592, 0x5f2d8f6a, 0xb0cfa693, 0x16ca6c6b, 0x6ae78390, 0xcce24968, 0x23006091, 0x8505aa69,
+    0x2ce742b2, 0x8ae2884a, 0x6500a1b3, 0xc3056b4b, 0xbf2884b0, 0x192d4e48, 0xf6cf67b1, 0x50caad49,
+    0x0e94b847, 0xa89172bf, 0x47735b46, 0xe17691be, 0x9d5b7e45, 0x3b5eb4bd, 0xd4bc9d44, 0x72b957bc,
+    0x6800b758, 0xce057da0, 0x21e75459, 0x87e29ea1, 0xfbcf715a, 0x5dcabba2, 0xb228925b, 0x142d58a3,
+    0x4a734dad, 0xec768755, 0x0394aeac, 0xa5916454, 0xd9bc8baf, 0x7fb94157, 0x905b68ae, 0x365ea256,
+    0xa528a966, 0x032d639e, 0xeccf4a67, 0x4aca809f, 0x36e76f64, 0x90e2a59c, 0x7f008c65, 0xd905469d,
+    0x875b5393, 0x215e996b, 0xcebcb092, 0x68b97a6a, 0x14949591, 0xb2915f69, 0x5d737690, 0xfb76bc68,
+    0xe1cf5c8c, 0x47ca9674, 0xa828bf8d, 0x0e2d7575, 0x72009a8e, 0xd4055076, 0x3be7798f, 0x9de2b377,
+    0xc3bca679, 0x65b96c81, 0x8a5b4578, 0x2c5e8f80, 0x5073607b, 0xf676aa83, 0x1994837a, 0xbf914982,
+    0x3a94e3eb, 0x9c912913, 0x737300ea, 0xd576ca12, 0xa95b25e9, 0x0f5eef11, 0xe0bcc6e8, 0x46b90c10,
+    0x18e7191e, 0xbee2d3e6, 0x5100fa1f, 0xf70530e7, 0x8b28df1c, 0x2d2d15e4, 0xc2cf3c1d, 0x64caf6e5,
+    0x7e731601, 0xd876dcf9, 0x3794f500, 0x91913ff8, 0xedbcd003, 0x4bb91afb, 0xa45b3302, 0x025ef9fa,
+    0x5c00ecf4, 0xfa05260c, 0x15e70ff5, 0xb3e2c50d, 0xcfcf2af6, 0x69cae00e, 0x8628c9f7, 0x202d030f,
+    0xb35b083f, 0x155ec2c7, 0xfabceb3e, 0x5cb921c6, 0x2094ce3d, 0x869104c5, 0x69732d3c, 0xcf76e7c4,
+    0x9128f2ca, 0x372d3832, 0xd8cf11cb, 0x7ecadb33, 0x02e734c8, 0xa4e2fe30, 0x4b00d7c9, 0xed051d31,
+    0xf7bcfdd5, 0x51b9372d, 0xbe5b1ed4, 0x185ed42c, 0x64733bd7, 0xc276f12f, 0x2d94d8d6, 0x8b91122e,
+    0xd5cf0720, 0x73cacdd8, 0x9c28e421, 0x3a2d2ed9, 0x4600c122, 0xe0050bda, 0x0fe72223, 0xa9e2e8db
+  },
+  {
+    0x00000000, 0x59ce8564, 0xb39d0ac8, 0xea538fac, 0x62d66361, 0x3b18e605, 0xd14b69a9, 0x8885eccd,
+    0xc5acc6c2, 0x9c6243a6, 0x7631cc0a, 0x2fff496e, 0xa77aa5a3, 0xfeb420c7, 0x14e7af6b, 0x4d292a0f,
+    0x8eb5fb75, 0xd77b7e11, 0x3d28f1bd, 0x64e674d9, 0xec639814, 0xb5ad1d70, 0x5ffe92dc, 0x063017b8,
+    0x4b193db7, 0x12d7b8d3, 0xf884377f, 0xa14ab21b, 0x29cf5ed6, 0x7001dbb2, 0x9a52541e, 0xc39cd17a,
+    0x1887801b, 0x4149057f, 0xab1a8ad3, 0xf2d40fb7, 0x7a51e37a, 0x239f661e, 0xc9cce9b2, 0x90026cd6,
+    0xdd2b46d9, 0x84e5c3bd, 0x6eb64c11, 0x3778c975, 0xbffd25b8, 0xe633a0dc, 0x0c602f70, 0x55aeaa14,
+    0x96327b6e, 0xcffcfe0a, 0x25af71a6, 0x7c61f4c2, 0xf4e4180f, 0xad2a9d6b, 0x477912c7, 0x1eb797a3,
+    0x539ebdac, 0x0a5038c8, 0xe003b764, 0xb9cd3200, 0x3148decd, 0x68865ba9, 0x82d5d405, 0xdb1b5161,
+    0x310f0036, 0x68c18552, 0x82920afe, 0xdb5c8f9a, 0x53d96357, 0x0a17e633, 0xe044699f, 0xb98aecfb,
+    0xf4a3c6f4, 0xad6d4390, 0x473ecc3c, 0x1ef04958, 0x9675a595, 0xcfbb20f1, 0x25e8af5d, 0x7c262a39,
+    0xbfbafb43, 0xe6747e27, 0x0c27f18b, 0x55e974ef, 0xdd6c9822, 0x84a21d46, 0x6ef192ea, 0x373f178e,
+    0x7a163d81, 0x23d8b8e5, 0xc98b3749, 0x9045b22d, 0x18c05ee0, 0x410edb84, 0xab5d5428, 0xf293d14c,
+    0x2988802d, 0x70460549, 0x9a158ae5, 0xc3db0f81, 0x4b5ee34c, 0x12906628, 0xf8c3e984, 0xa10d6ce0,
+    0xec2446ef, 0xb5eac38b, 0x5fb94c27, 0x0677c943, 0x8ef2258e, 0xd73ca0ea, 0x3d6f2f46, 0x64a1aa22,
+    0xa73d7b58, 0xfef3fe3c, 0x14a07190, 0x4d6ef4f4, 0xc5eb1839, 0x9c259d5d, 0x767612f1, 0x2fb89795,
+    0x6291bd9a, 0x3b5f38fe, 0xd10cb752, 0x88c23236, 0x0047defb, 0x59895b9f, 0xb3dad433, 0xea145157,
+    0x621e006c, 0x3bd08508, 0xd1830aa4, 0x884d8fc0, 0x00c8630d, 0x5906e669, 0xb35569c5, 0xea9beca1,
+    0xa7b2c6ae, 0xfe7c43ca, 0x142fcc66, 0x4de14902, 0xc564a5cf, 0x9caa20ab, 0x76f9af07, 0x2f372a63,
+    0xecabfb19, 0xb5657e7d, 0x5f36f1d1, 0x06f874b5, 0x8e7d9878, 0xd7b31d1c, 0x3de092b0, 0x642e17d4,
+    0x29073ddb, 0x70c9b8bf, 0x9a9a3713, 0xc354b277, 0x4bd15eba, 0x121fdbde, 0xf84c5472, 0xa182d116,
+    0x7a998077, 0x23570513, 0xc9048abf, 0x90ca0fdb, 0x184fe316, 0x41816672, 0xabd2e9de, 0xf21c6cba,
+    0xbf3546b5, 0xe6fbc3d1, 0x0ca84c7d, 0x5566c919, 0xdde325d4, 0x842da0b0, 0x6e7e2f1c, 0x37b0aa78,
+    0xf42c7b02, 0xade2fe66, 0x47b171ca, 0x1e7ff4ae, 0x96fa1863, 0xcf349d07, 0x256712ab, 0x7ca997cf,
+    0x3180bdc0, 0x684e38a4, 0x821db708, 0xdbd3326c, 0x5356dea1, 0x0a985bc5, 0xe0cbd469, 0xb905510d,
+    0x5311005a, 0x0adf853e, 0xe08c0a92, 0xb9428ff6, 0x31c7633b, 0x6809e65f, 0x825a69f3, 0xdb94ec97,
+    0x96bdc698, 0xcf7343fc, 0x2520cc50, 0x7cee4934, 0xf46ba5f9, 0xada5209d, 0x47f6af31, 0x1e382a55,
+    0xdda4fb2f, 0x846a7e4b, 0x6e39f1e7, 0x37f77483, 0xbf72984e, 0xe6bc1d2a, 0x0cef9286, 0x552117e2,
+    0x18083ded, 0x41c6b889, 0xab953725, 0xf25bb241, 0x7ade5e8c, 0x2310dbe8, 0xc9435444, 0x908dd120,
+    0x4b968041, 0x12580525, 0xf80b8a89, 0xa1c50fed, 0x2940e320, 0x708e6644, 0x9adde9e8, 0xc3136c8c,
+    0x8e3a4683, 0xd7f4c3e7, 0x3da74c4b, 0x6469c92f, 0xecec25e2, 0xb522a086, 0x5f712f2a, 0x06bfaa4e,
+    0xc5237b34, 0x9cedfe50, 0x76be71fc, 0x2f70f498, 0xa7f51855, 0xfe3b9d31, 0x1468129d, 0x4da697f9,
+    0x008fbdf6, 0x59413892, 0xb312b73e, 0xeadc325a, 0x6259de97, 0x3b975bf3, 0xd1c4d45f, 0x880a513b
+  },
+  {
+    0x00000000, 0xc43c00d8, 0x8d947741, 0x49a87799, 0x1ec49873, 0xdaf898ab, 0x9350ef32, 0x576cefea,
+    0x3d8930e6, 0xf9b5303e, 0xb01d47a7, 0x7421477f, 0x234da895, 0xe771a84d, 0xaed9dfd4, 0x6ae5df0c,
+    0x7b1261cc, 0xbf2e6114, 0xf686168d, 0x32ba1655, 0x65d6f9bf, 0xa1eaf967, 0xe8428efe, 0x2c7e8e26,
+    0x469b512a, 0x82a751f2, 0xcb0f266b, 0x0f3326b3, 0x585fc959, 0x9c63c981, 0xd5cbbe18, 0x11f7bec0,
+    0xf624c398, 0x3218c340, 0x7bb0b4d9, 0xbf8cb401, 0xe8e05beb, 0x2cdc5b33, 0x65742caa, 0xa1482c72,
+    0xcbadf37e, 0x0f91f3a6, 0x4639843f, 0x820584e7, 0xd5696b0d, 0x11556bd5, 0x58fd1c4c, 0x9cc11c94,
+    0x8d36a254, 0x490aa28c, 0x00a2d515, 0xc49ed5cd, 0x93f23a27, 0x57ce3aff, 0x1e664d66, 0xda5a4dbe,
+    0xb0bf92b2, 0x7483926a, 0x3d2be5f3, 0xf917e52b, 0xae7b0ac1, 0x6a470a19, 0x23ef7d80, 0xe7d37d58,
+    0xe9a5f1c1, 0x2d99f119, 0x64318680, 0xa00d8658, 0xf76169b2, 0x335d696a, 0x7af51ef3, 0xbec91e2b,
+    0xd42cc127, 0x1010c1ff, 0x59b8b666, 0x9d84b6be, 0xcae85954, 0x0ed4598c, 0x477c2e15, 0x83402ecd,
+    0x92b7900d, 0x568b90d5, 0x1f23e74c, 0xdb1fe794, 0x8c73087e, 0x484f08a6, 0x01e77f3f, 0xc5db7fe7,
+    0xaf3ea0eb, 0x6b02a033, 0x22aad7aa, 0xe696d772, 0xb1fa3898, 0x75c63840, 0x3c6e4fd9, 0xf8524f01,
+    0x1f813259, 0xdbbd3281, 0x92154518, 0x562945c0, 0x0145aa2a, 0xc579aaf2, 0x8cd1dd6b, 0x48edddb3,
+    0x220802bf, 0xe6340267, 0xaf9c75fe, 0x6ba07526, 0x3ccc9acc, 0xf8f09a14, 0xb158ed8d, 0x7564ed55,
+    0x64935395, 0xa0af534d, 0xe90724d4, 0x2d3b240c, 0x7a57cbe6, 0xbe6bcb3e, 0xf7c3bca7, 0x33ffbc7f,
+    0x591a6373, 0x9d2663ab, 0xd48e1432, 0x10b214ea, 0x47defb00, 0x83e2fbd8, 0xca4a8c41, 0x0e768c99,
+    0xd6a79573, 0x129b95ab, 0x5b33e232, 0x9f0fe2ea, 0xc8630d00, 0x0c5f0dd8, 0x45f77a41, 0x81cb7a99,
+    0xeb2ea595, 0x2f12a54d, 0x66bad2d4, 0xa286d20c, 0xf5ea3de6, 0x31d63d3e, 0x787e4aa7, 0xbc424a7f,
+    0xadb5f4bf, 0x6989f467, 0x202183fe, 0xe41d8326, 0xb3716ccc, 0x774d6c14, 0x3ee51b8d, 0xfad91b55,
+    0x903cc459, 0x5400c481, 0x1da8b318, 0xd994b3c0, 0x8ef85c2a, 0x4ac45cf2, 0x036c2b6b, 0xc7502bb3,
+    0x208356eb, 0xe4bf5633, 0xad1721aa, 0x692b2172, 0x3e47ce98, 0xfa7bce40, 0xb3d3b9d9, 0x77efb901,
+    0x1d0a660d, 0xd93666d5, 0x909e114c, 0x54a21194, 0x03cefe7e, 0xc7f2fea6, 0x8e5a893f, 0x4a6689e7,
+    0x5b913727, 0x9fad37ff, 0xd6054066, 0x123940be, 0x4555af54, 0x8169af8c, 0xc8c1d815, 0x0cfdd8cd,
+    0x661807c1, 0xa2240719, 0xeb8c7080, 0x2fb07058, 0x78dc9fb2, 0xbce09f6a, 0xf548e8f3, 0x3174e82b,
+    0x3f0264b2, 0xfb3e646a, 0xb29613f3, 0x76aa132b, 0x21c6fcc1, 0xe5fafc19, 0xac528b80, 0x686e8b58,
+    0x028b5454, 0xc6b7548c, 0x8f1f2315, 0x4b2323cd, 0x1c4fcc27, 0xd873ccff, 0x91dbbb66, 0x55e7bbbe,
+    0x4410057e, 0x802c05a6, 0xc984723f, 0x0db872e7, 0x5ad49d0d, 0x9ee89dd5, 0xd740ea4c, 0x137cea94,
+    0x79993598, 0xbda53540, 0xf40d42d9, 0x30314201, 0x675dadeb, 0xa361ad33, 0xeac9daaa, 0x2ef5da72,
+    0xc926a72a, 0x0d1aa7f2, 0x44b2d06b, 0x808ed0b3, 0xd7e23f59, 0x13de3f81, 0x5a764818, 0x9e4a48c0,
+    0xf4af97cc, 0x30939714, 0x793be08d, 0xbd07e055, 0xea6b0fbf, 0x2e570f67, 0x67ff78fe, 0xa3c37826,
+    0xb234c6e6, 0x7608c63e, 0x3fa0b1a7, 0xfb9cb17f, 0xacf05e95, 0x68cc5e4d, 0x216429d4, 0xe558290c,
+    0x8fbdf600, 0x4b81f6d8, 0x02298141, 0xc6158199, 0x91796e73, 0x55456eab, 0x1ced1932, 0xd8d119ea
+  }
+};
+
+static uint32_t crc32c_shift_chunk(uint32_t crc){
+  return crc32c_shift_chunk_table1360[0][crc&0xff]^
+         crc32c_shift_chunk_table1360[1][(crc>>8)&0xff]^
+         crc32c_shift_chunk_table1360[2][(crc>>16)&0xff]^
+         crc32c_shift_chunk_table1360[3][crc>>24];
+}
+
 #if defined(_WIN64) || defined(__x86_64__)
-static uint32_t psync_crc32c_hw(uint64_t crc, const void *ptr, size_t len){
-  const char *data;
-  data=(const char *)ptr;
-  while (((uintptr_t)data)%sizeof(uint64_t) && len){
-    CRC32C_8BIT_HW(crc, *data);
-    data++;
+#define CRC32_WORD_SIZE 8
+#define CRC32_WORD_TYPE uint64_t
+#define CRC32_WORD_HW CRC32C_64BIT_HW
+static uint32_t psync_crc32c_hw(uint64_t crc0, const void *ptr, size_t len){
+#else
+#define CRC32_WORD_SIZE 4
+#define CRC32_WORD_TYPE uint32_t
+#define CRC32_WORD_HW CRC32C_32BIT_HW
+static uint32_t psync_crc32c_hw(uint32_t crc0, const void *ptr, size_t len){
+#endif
+  const char *data0;
+  data0=(const char *)ptr;
+  while (((uintptr_t)data0)%CRC32_WORD_SIZE && len){
+    CRC32C_8BIT_HW(crc0, *data0);
+    data0++;
     len--;
   }
-  while (len>=64){
-    len-=64;
-    CRC32C_64BIT_HW(crc, *((uint64_t *)data));
-    data+=8;
-    CRC32C_64BIT_HW(crc, *((uint64_t *)data));
-    data+=8;
-    CRC32C_64BIT_HW(crc, *((uint64_t *)data));
-    data+=8;
-    CRC32C_64BIT_HW(crc, *((uint64_t *)data));
-    data+=8;
-    CRC32C_64BIT_HW(crc, *((uint64_t *)data));
-    data+=8;
-    CRC32C_64BIT_HW(crc, *((uint64_t *)data));
-    data+=8;
-    CRC32C_64BIT_HW(crc, *((uint64_t *)data));
-    data+=8;
-    CRC32C_64BIT_HW(crc, *((uint64_t *)data));
-    data+=8;
-  }
-  while (len>=8){
-    len-=8;
-    CRC32C_64BIT_HW(crc, *((uint64_t *)data));
-    data+=8;
+  while (len>=CRC32_PARALLEL_CHUNK*3){
+    CRC32_WORD_TYPE crc1, crc2;
+    const char *end;
+    len-=CRC32_PARALLEL_CHUNK*3;
+    crc1=0;
+    crc2=0;
+    end=data0+CRC32_PARALLEL_CHUNK;
+    do {
+      CRC32_WORD_HW(crc0, *((CRC32_WORD_TYPE *)data0));
+      CRC32_WORD_HW(crc1, *((CRC32_WORD_TYPE *)(data0+CRC32_PARALLEL_CHUNK)));
+      CRC32_WORD_HW(crc2, *((CRC32_WORD_TYPE *)(data0+CRC32_PARALLEL_CHUNK*2)));
+      data0+=CRC32_WORD_SIZE;
+    } while (data0<end);
+    data0+=CRC32_PARALLEL_CHUNK*2;
+    crc0=crc32c_shift_chunk(crc0)^crc1;
+    crc0=crc32c_shift_chunk(crc0)^crc2;
+  }
+  while (len>=CRC32_WORD_SIZE*4){
+    len-=CRC32_WORD_SIZE*4;
+    CRC32_WORD_HW(crc0, *((CRC32_WORD_TYPE *)data0));
+    data0+=CRC32_WORD_SIZE;
+    CRC32_WORD_HW(crc0, *((CRC32_WORD_TYPE *)data0));
+    data0+=CRC32_WORD_SIZE;
+    CRC32_WORD_HW(crc0, *((CRC32_WORD_TYPE *)data0));
+    data0+=CRC32_WORD_SIZE;
+    CRC32_WORD_HW(crc0, *((CRC32_WORD_TYPE *)data0));
+    data0+=CRC32_WORD_SIZE;
+  }
+  while (len>=CRC32_WORD_SIZE){
+    len-=CRC32_WORD_SIZE;
+    CRC32_WORD_HW(crc0, *((CRC32_WORD_TYPE *)data0));
+    data0+=CRC32_WORD_SIZE;
   }
   while (len){
     len--;
-    CRC32C_8BIT_HW(crc, *data);
-    data++;
-  }
-  return crc;
-}
-#else
-static uint32_t psync_crc32c_hw(uint32_t crc, const void *ptr, size_t len){
-  const char *data;
-  data=(const char *)ptr;
-  while (((uintptr_t)data)%sizeof(uint32_t) && len){
-    CRC32C_8BIT_HW(crc, *data);
-    data++;
-    len--;
-  }
-  while (len>=32){
-    len-=32;
-    CRC32C_32BIT_HW(crc, *((uint32_t *)data));
-    data+=4;
-    CRC32C_32BIT_HW(crc, *((uint32_t *)data));
-    data+=4;
-    CRC32C_32BIT_HW(crc, *((uint32_t *)data));
-    data+=4;
-    CRC32C_32BIT_HW(crc, *((uint32_t *)data));
-    data+=4;
-    CRC32C_32BIT_HW(crc, *((uint32_t *)data));
-    data+=4;
-    CRC32C_32BIT_HW(crc, *((uint32_t *)data));
-    data+=4;
-    CRC32C_32BIT_HW(crc, *((uint32_t *)data));
-    data+=4;
-    CRC32C_32BIT_HW(crc, *((uint32_t *)data));
-    data+=4;
-  }
-  while (len>=4){
-    len-=4;
-    CRC32C_32BIT_HW(crc, *((uint32_t *)data));
-    data+=4;
-  }
-  while (len){
-    len--;
-    CRC32C_8BIT_HW(crc, *data);
-    data++;
-  }
-  return crc;
-}
-#endif
+    CRC32C_8BIT_HW(crc0, *data0);
+    data0++;
+  }
+  return crc0;
+}

 PSYNC_NOINLINE static uint32_t psync_crc32c_init(uint32_t crc, const void *ptr, size_t len){
   crc_hashw=psync_has_hw_crc()+1;


Typo in chartype.h include guard.

Typo in chartype.h include guard.

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@898 d31e2699-5ff4-0310-a27c-f18f2fbe73fe

--- include/parrot/chartype.h
+++ include/parrot/chartype.h
@@ -11,7 +11,7 @@
  */

 #if !defined(PARROT_CHARTYPE_H_GUARD)
-#define PARROT_ENCODING_H_GUARD
+#define PARROT_CHARTYPE_H_GUARD

 typedef UINTVAL (*CHARTYPE_TRANSCODER)(UINTVAL c);


Indent

Indent

--- libharp/harp-product.c
+++ libharp/harp-product.c
@@ -938,25 +938,25 @@

         if (length > 6 && strcmp(&variable->name[length - 6], "_count") == 0)
         {
-             if (!harp_product_has_variable(product, variable->name))
-             {
-                 harp_variable *new_variable;
-
-                 if (harp_variable_copy(count_variable, &new_variable) != 0)
-                 {
-                     return -1;
-                 }
-                 if (harp_variable_rename(new_variable, variable->name) != 0)
-                 {
-                     harp_variable_delete(new_variable);
-                     return -1;
-                 }
-                 if (harp_product_add_variable(product, new_variable) != 0)
-                 {
-                     harp_variable_delete(new_variable);
-                     return -1;
-                 }
-             }
+            if (!harp_product_has_variable(product, variable->name))
+            {
+                harp_variable *new_variable;
+
+                if (harp_variable_copy(count_variable, &new_variable) != 0)
+                {
+                    return -1;
+                }
+                if (harp_variable_rename(new_variable, variable->name) != 0)
+                {
+                    harp_variable_delete(new_variable);
+                    return -1;
+                }
+                if (harp_product_add_variable(product, new_variable) != 0)
+                {
+                    harp_variable_delete(new_variable);
+                    return -1;
+                }
+            }
         }
     }


os_index is a signed integer, make topo_alloc_s...

os_index is a signed integer, make topo_alloc_setup_object take a signed integer too

This commit was SVN r885.

--- include/private/private.h
+++ include/private/private.h
@@ -180,7 +180,7 @@
      })

 static inline struct topo_obj *
-topo_alloc_setup_object(topo_obj_type_t type, unsigned index)
+topo_alloc_setup_object(topo_obj_type_t type, signed index)
 {
   struct topo_obj *obj = malloc(sizeof(*obj));
   assert(obj);


[Service] Store the task being processed into the msu_context_t structure

Signed-off-by: Regis Merlino <bf92b28820f6093e0f55b8f19f2762bc8cee2f98@intel.com>

--- src/media-service-upnp.c
+++ src/media-service-upnp.c
@@ -100,6 +100,7 @@
 	GPtrArray *tasks;
 	GHashTable *watchers;
 	GCancellable *cancellable;
+	msu_task_t *current_task;
 	msu_upnp_t *upnp;
 	msu_settings_context_t *settings;
 };
@@ -345,6 +346,8 @@
 {
 	const gchar *client_name;
 	msu_client_t *client;
+
+	context->current_task = task;

 	switch (task->type) {
 	case MSU_TASK_GET_VERSION:
@@ -374,6 +377,8 @@
 	default:
 		break;
 	}
+
+	context->current_task = NULL;
 }

 static void prv_async_task_complete(msu_task_t *task, GVariant *result,
@@ -385,6 +390,7 @@

 	g_object_unref(context->cancellable);
 	context->cancellable = NULL;
+	context->current_task = NULL;

 	if (error) {
 		msu_task_fail_and_delete(task, error);
@@ -411,6 +417,7 @@
 	MSU_LOG_DEBUG("Enter");

 	context->cancellable = g_cancellable_new();
+	context->current_task = task;
 	client_name =
 		g_dbus_method_invocation_get_sender(task->invocation);
 	client = g_hash_table_lookup(context->watchers, client_name);


Restore support for SDT (process_sdt)

Restore support for SDT (process_sdt)

git-svn-id: ab66a9de07fa9d47c5829c82992f5279466c775f@1162 63c20433-aa62-49bd-875c-5a186b69a8fb

--- src/media_tools/mpegts.c
+++ src/media_tools/mpegts.c
@@ -561,7 +561,9 @@

 static void gf_m2ts_section_complete(GF_M2TS_Demuxer *ts, GF_M2TS_SectionFilter *sec, GF_M2TS_SECTION_ES *ses)
 {
-	if (! sec->process_section && !sec->had_error) {
+	if (sec->had_error) return;
+
+	if (!sec->process_section) {
 		if (ts->on_event) {
 			GF_M2TS_SL_PCK pck;
 			pck.data_len = sec->length;
@@ -811,6 +813,98 @@
 			goto aggregated_section;
 		}
 	}
+}
+
+static void gf_m2ts_process_sdt(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *ses, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)
+{
+	 u32 orig_net_id, pos, evt_type;
+	 u32 nb_sections;
+	 u32 data_size;
+	 unsigned char *data;
+	 GF_M2TS_Section *section;
+
+	 /*wait for the last section */
+	 if (!(status&GF_M2TS_TABLE_END)) return;
+
+	 /*skip if already received*/
+	 if (status&GF_M2TS_TABLE_REPEAT) {
+	         if (ts->on_event) ts->on_event(ts, GF_M2TS_EVT_SDT_REPEAT, NULL);
+	         return;
+	 }
+
+	 if (table_id != GF_M2TS_TABLE_ID_SDT_ACTUAL) {
+	         gf_m2ts_reset_sdt(ts);
+	         return;
+	 }
+
+	 gf_m2ts_reset_sdt(ts);
+
+	 nb_sections = gf_list_count(sections);
+	 if (nb_sections > 1) {
+	         GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("SDT on multiple sections not supported\n"));
+	 }
+
+	 section = (GF_M2TS_Section *)gf_list_get(sections, 0);
+	 data = section->data;
+	 data_size = section->data_size;
+
+	 orig_net_id = (data[0] << 8) | data[1];
+	 pos = 3;
+	 while (pos < data_size) {
+	         GF_M2TS_SDT *sdt;
+	         u32 descs_size, d_pos, ulen;
+
+	         GF_SAFEALLOC(sdt, GF_M2TS_SDT);
+	         gf_list_add(ts->SDTs, sdt);
+
+	         sdt->service_id = (data[pos]<<8) + data[pos+1];
+	         sdt->EIT_schedule = (data[pos+2] & 0x2) ? 1 : 0;
+	         sdt->EIT_present_following = (data[pos+2] & 0x1);
+	         sdt->running_status = (data[pos+3]>>5) & 0x7;
+	         sdt->free_CA_mode = (data[pos+3]>>4) & 0x1;
+	         descs_size = ((data[pos+3]&0xf)<<8) | data[pos+4];
+	         pos += 5;
+
+	         d_pos = 0;
+	         while (d_pos < descs_size) {
+	                 u8 d_tag = data[pos+d_pos];
+	                 u8 d_len = data[pos+d_pos+1];
+
+	                 switch (d_tag) {
+	                 case GF_M2TS_DVB_SERVICE_DESCRIPTOR:
+	                         if (sdt->provider) free(sdt->provider);
+	                         sdt->provider = NULL;
+	                         if (sdt->service) free(sdt->service);
+	                         sdt->service = NULL;
+
+	                         d_pos+=2;
+	                         sdt->service_type = data[pos+d_pos];
+	                         ulen = data[pos+d_pos+1];
+	                         d_pos += 2;
+	                         sdt->provider = (char*)malloc(sizeof(char)*(ulen+1));
+	                         memcpy(sdt->provider, data+pos+d_pos, sizeof(char)*ulen);
+	                         sdt->provider[ulen] = 0;
+	                         d_pos += ulen;
+
+	                         ulen = data[pos+d_pos];
+	                         d_pos += 1;
+	                         sdt->service = (char*)malloc(sizeof(char)*(ulen+1));
+	                         memcpy(sdt->service, data+pos+d_pos, sizeof(char)*ulen);
+	                         sdt->service[ulen] = 0;
+	                         d_pos += ulen;
+	                         break;
+
+	                 default:
+	                         GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[MPEG-2 TS] Skipping descriptor (0x%x) not supported\n", d_tag));
+	                         d_pos += d_len;
+	                         if (d_len == 0) d_pos = descs_size;
+	                         break;
+	                 }
+	         }
+	         pos += descs_size;
+	 }
+	 evt_type = GF_M2TS_EVT_SDT_FOUND;
+	 if (ts->on_event) ts->on_event(ts, evt_type, NULL);
 }

 static void gf_m2ts_process_mpeg4section(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *es, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)
@@ -1225,8 +1319,6 @@
 	/*PES first fragment: flush previous packet*/
 	if (flush_pes && pes->data) {
 		GF_M2TS_PESHeader pesh;
-	if (pes->pid==25)
-		pes->pid=25;

 		/*we need at least a full, valid start code !!*/
 		if ((pes->data_len >= 4) && !pes->data[0] && !pes->data[1] && (pes->data[2]==0x1)) {
@@ -1246,8 +1338,6 @@
 			/*SL-packetized stream*/
 			else if ((u8) pes->data[3]==0xfa) {
 				GF_M2TS_SL_PCK sl_pck;
-		if (pes->pid==25)
-			pes->pid=25;
 				/*read header*/
 				gf_m2ts_pes_header(pes, pes->data+3, pes->data_len-3, &pesh);

@@ -1570,7 +1660,7 @@
 	ts->SDTs = gf_list_new();

 	ts->pat = gf_m2ts_section_filter_new(gf_m2ts_process_pat, 0);
-	ts->sdt = gf_m2ts_section_filter_new(NULL/*gf_m2ts_process_sdt*/, 1);
+	ts->sdt = gf_m2ts_section_filter_new(gf_m2ts_process_sdt, 1);
 	ts->nit = gf_m2ts_section_filter_new(gf_m2ts_process_nit, 0);
 	ts->eit = gf_m2ts_section_filter_new(NULL/*gf_m2ts_process_eit*/, 1);
 	ts->tdt_tot_st = gf_m2ts_section_filter_new(NULL/*gf_m2ts_process_tdt_tot_st*/, 1);


libipc: Fix bug, set time on newly accepted connection not parent.

--- libipc/socket_inline.h
+++ libipc/socket_inline.h
@@ -158,8 +158,8 @@
       register_inet_socket(ret, true);
       set_nonblocking(ret, (flags & SOCK_NONBLOCK) != 0);
       set_cloexec(ret, (flags & SOCK_CLOEXEC) != 0);
-      set_time(fd, true, start);
-      set_time(fd, false, end);
+      set_time(ret, true, start);
+      set_time(ret, false, end);
     }
   }
   return ret;


Store key==value in GHashTable, when using it as a set

--- peerman.c
+++ peerman.c
@@ -53,7 +53,10 @@
 	else
 		peers->addrlist = g_list_append(peers->addrlist, addr);

-	g_hash_table_insert(peers->map_addr, addr->ip, GUINT_TO_POINTER(1));
+	/* when using GHashTable as a set, key=value enables some
+	 * unspecified GLib optimizations
+	 */
+	g_hash_table_insert(peers->map_addr, addr->ip, addr->ip);
 }

 static bool peerman_read_rec(struct peer_manager *peers,struct p2p_message *msg)


Increase verbosity of dump

Increase verbosity of dump

--- src/merger/common/dump.c
+++ src/merger/common/dump.c
@@ -145,8 +145,16 @@
 	}
 	else if (c->event == MALLOC_EV || c->event == REALLOC_EV)
 	{
-		fprintf (stdout, "%s SIZE: %lu\n", c->event==MALLOC_EV?"malloc()":"realloc()",
-		  c->param.misc_param.param);
+		if (c->value == EVT_BEGIN)
+			fprintf (stdout, "%s SIZE: %lu\n", c->event==MALLOC_EV?"malloc()":"realloc()",
+			  c->param.misc_param.param);
+		else if (c->value == EVT_END)
+			fprintf (stdout, "%s ADDRESS: %lu\n", c->event==MALLOC_EV?"malloc()":"realloc()",
+			  c->param.misc_param.param);
+	}
+	else if (c->event == FREE_EV && c->value == EVT_BEGIN)
+	{
+		fprintf (stdout, "free() ADDRESS: %lu\n", c->param.misc_param.param);
 	}
 	else if (c->event == OMPT_TASKFUNC_EV)
 	{


mesa: plug in GL_EXT_transform_feedback functions into dispatch

--- src/mesa/main/api_exec.c
+++ src/mesa/main/api_exec.c
@@ -89,6 +89,7 @@
 #include "texobj.h"
 #include "texparam.h"
 #include "texstate.h"
+#include "transformfeedback.h"
 #include "mtypes.h"
 #include "varray.h"
 #include "viewport.h"
@@ -477,6 +478,18 @@
    /* ???. GL_EXT_depth_bounds_test */
    SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT);

+   /* 352. GL_EXT_transform_feedback */
+#if _HAVE_FULL_GL
+   SET_BeginTransformFeedbackEXT(exec, _mesa_BeginTransformFeedback);
+   SET_EndTransformFeedbackEXT(exec, _mesa_EndTransformFeedback);
+   SET_BindBufferRangeEXT(exec, _mesa_BindBufferRange);
+   SET_BindBufferBaseEXT(exec, _mesa_BindBufferBase);
+   SET_BindBufferOffsetEXT(exec, _mesa_BindBufferOffsetEXT);
+   SET_TransformFeedbackVaryingsEXT(exec, _mesa_TransformFeedbackVaryings);
+   SET_GetTransformFeedbackVaryingEXT(exec, _mesa_GetTransformFeedbackVarying);
+#endif
+
+   /* 364. GL_EXT_provoking_vertex */
    SET_ProvokingVertexEXT(exec, _mesa_ProvokingVertexEXT);

    /* ARB 1. GL_ARB_multitexture */


fbobject: add additional fbo completeness checks for GLES

Reviewed-by: Ian Romanick <2b237cafb16dc45038e85df6c85e74e6d899eba9@intel.com>
Signed-off-by: Jordan Justen <a79006884ba9cf5f4f7fcbb92a15b208780d8c97@intel.com>

--- src/mesa/main/fbobject.c
+++ src/mesa/main/fbobject.c
@@ -523,6 +523,50 @@

 /**
+ * Is the given base format a legal format for a color renderbuffer?
+ */
+static GLboolean
+is_format_color_renderable(const struct gl_context *ctx, gl_format format, GLenum internalFormat)
+{
+   const GLenum baseFormat =
+      _mesa_get_format_base_format(format);
+   GLboolean valid;
+
+   valid = _mesa_is_legal_color_format(ctx, baseFormat);
+   if (!valid || _mesa_is_desktop_gl(ctx)) {
+      return valid;
+   }
+
+   /* Reject additional cases for GLES */
+   switch (internalFormat) {
+   case GL_RGBA8_SNORM:
+   case GL_RGB32F:
+   case GL_RGB32I:
+   case GL_RGB32UI:
+   case GL_RGB16F:
+   case GL_RGB16I:
+   case GL_RGB16UI:
+   case GL_RGB8_SNORM:
+   case GL_RGB8I:
+   case GL_RGB8UI:
+   case GL_SRGB8:
+   case GL_RGB9_E5:
+   case GL_RG8_SNORM:
+   case GL_R8_SNORM:
+      return GL_FALSE;
+   default:
+      break;
+   }
+
+   if (format == MESA_FORMAT_ARGB2101010 && internalFormat != GL_RGB10_A2) {
+      return GL_FALSE;
+   }
+
+   return GL_TRUE;
+}
+
+
+/**
  * Is the given base format a legal format for a depth/stencil renderbuffer?
  */
 static GLboolean
@@ -770,7 +814,7 @@
          f = texImg->_BaseFormat;
          attFormat = texImg->TexFormat;
          numImages++;
-         if (!_mesa_is_legal_color_format(ctx, f) &&
+         if (!is_format_color_renderable(ctx, attFormat, texImg->InternalFormat) &&
              !is_legal_depth_format(ctx, f)) {
             fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
             fbo_incomplete("texture attachment incomplete", -1);


add doc to sway_seat_get_focus_inactive()

--- include/sway/input/seat.h
+++ include/sway/input/seat.h
@@ -58,6 +58,15 @@

 swayc_t *sway_seat_get_focus(struct sway_seat *seat);

+/**
+ * Return the last container to be focused for the seat (or the most recently
+ * opened if no container has received focused) that is a child of the given
+ * container. The focus-inactive container of the root window is the focused
+ * container for the seat (if the seat does have focus). This function can be
+ * used to determine what container gets focused next if the focused container
+ * is destroyed, or focus moves to a container with children and we need to
+ * descend into the next leaf in focus order.
+ */
 swayc_t *sway_seat_get_focus_inactive(struct sway_seat *seat, swayc_t *container);

 swayc_t *sway_seat_get_focus_by_type(struct sway_seat *seat,


mesa/teximage: use correct extension for accept stencil texture.

This was using the wrong extension, ARB_stencil_texturing
doesn't mention any changes in this area.

Fixes "dEQP-GLES3.functional.fbo.completeness.renderable.texture.
stencil.stencil_index8."

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90751
Signed-off-by: Dave Airlie <f2295d84e358395675bc8031be58672073ae065e@redhat.com>
Reviewed-by: Ilia Mirkin <bcbbb7aa705ec3a5fc5824c01a845186c3d62fca@alum.mit.edu>
Reviewed-by: Kenneth Graunke <bd2562f754ec92342f93f61c25d731e290a2ffa8@whitecape.org>

--- src/mesa/main/teximage.c
+++ src/mesa/main/teximage.c
@@ -222,7 +222,7 @@
       }
    }

-   if (ctx->Extensions.ARB_stencil_texturing) {
+   if (ctx->Extensions.ARB_texture_stencil8) {
       switch (internalFormat) {
       case GL_STENCIL_INDEX:
       case GL_STENCIL_INDEX1:


Fix size check

Fix size check

--- libraries/libmdb/mdb.c
+++ libraries/libmdb/mdb.c
@@ -4003,7 +4003,7 @@

 				dkey.mv_size = NODEDSZ(leaf);
 				dkey.mv_data = NODEDATA(leaf);
-#if UINT_MAX > SIZE_MAX
+#if UINT_MAX < SIZE_MAX
 				if (mc->mc_dbx->md_dcmp == mdb_cmp_int && dkey.mv_size == sizeof(size_t))
 #ifdef MISALIGNED_OK
 					mc->mc_dbx->md_dcmp = mdb_cmp_long;
@@ -4673,7 +4673,7 @@
 		DB_DIRTY : 0;
 	mx->mx_dbx.md_name.mv_data = NODEKEY(node);
 	mx->mx_dbx.md_name.mv_size = node->mn_ksize;
-#if UINT_MAX > SIZE_MAX
+#if UINT_MAX < SIZE_MAX
 	if (mx->mx_dbx.md_cmp == mdb_cmp_int && mx->mx_db.md_pad == sizeof(size_t))
 #ifdef MISALIGNED_OK
 		mx->mx_dbx.md_cmp = mdb_cmp_long;


[C] Try initialise end to empty string.

[C] Try initialise end to empty string.

--- aeron-driver/src/main/c/util/aeron_prop_util.c
+++ aeron-driver/src/main/c/util/aeron_prop_util.c
@@ -32,7 +32,7 @@
         return -1;
     }

-    char *end = NULL;
+    char *end = "";
     const int64_t v = strtoll(str, &end, 0);
     if (v < 0 || end == str)
     {
@@ -96,7 +96,7 @@
         return -1;
     }

-    char *end = NULL;
+    char *end = "";
     const int64_t v = strtoll(str, &end, 0);
     if (v < 0 || end == str)
     {


Better error handling for libusb-1.0 backend. Patch from Tollef Fog Heen <tfheen@err.no>.

--- ykcore/ykcore_libusb-1.0.c
+++ ykcore/ykcore_libusb-1.0.c
@@ -186,7 +186,50 @@

 const char *_ykusb_strerror()
 {
-	static char buf[512];
-	snprintf(buf, sizeof(buf), "%s %d", "NOT IMPLEMENTED", ykl_errno);
+	static char *buf;
+	switch (ykl_errno) {
+	case LIBUSB_SUCCESS:
+		buf = "Success (no error)";
+		break;
+	case LIBUSB_ERROR_IO:
+		buf = "Input/output error";
+		break;
+	case LIBUSB_ERROR_INVALID_PARAM:
+		buf = "Invalid parameter";
+		break;
+	case LIBUSB_ERROR_ACCESS:
+		buf = "Access denied (insufficient permissions)";
+		break;
+	case LIBUSB_ERROR_NO_DEVICE:
+		buf = "No such device (it may have been disconnected)";
+		break;
+	case LIBUSB_ERROR_NOT_FOUND:
+		buf = "Entity not found";
+		break;
+	case LIBUSB_ERROR_BUSY:
+		buf = "Resource busy";
+		break;
+	case LIBUSB_ERROR_TIMEOUT:
+		buf = "Operation timed out";
+		break;
+	case LIBUSB_ERROR_OVERFLOW:
+		buf = "Overflow";
+		break;
+	case LIBUSB_ERROR_PIPE:
+		buf = "Pipe error";
+		break;
+	case LIBUSB_ERROR_INTERRUPTED:
+		buf = "System call interrupted (perhaps due to signal)";
+		break;
+	case LIBUSB_ERROR_NO_MEM:
+		buf = "Insufficient memory";
+		break;
+	case LIBUSB_ERROR_NOT_SUPPORTED:
+		buf = "Operation not supported or unimplemented on this platform";
+		break;
+	case LIBUSB_ERROR_OTHER:
+		buf = "Other/unknown error";
+		break;
+	}
 	return buf;
 }


Moved this file to another directory.

Moved this file to another directory.

--- week2/hello.c
+++ week2/hello.c
@@ -1,6 +0,0 @@
-#include <stdio.h>
-
-int main(void)
-{
-	printf("hello, world\n");
-}


デフォルト設定を変更(ビデオキャプチャサイズの最適化)

デフォルト設定を変更(ビデオキャプチャサイズの最適化)

--- src/pc6001v.h
+++ src/pc6001v.h
@@ -33,7 +33,7 @@
 #define	DEFAULT_MODEL			(0)					// 機種 60:PC-6001 61:PC-6001A 62:PC-6001mkⅡ 66:PC-6601 64:PC-6001mkⅡSR 68:PC-6601SR (0:自動選定)
 #define	DEFAULT_USEEXTRAM		(1)					// 拡張RAM 0:なし 1:あり
 #define	DEFAULT_SAMPLERATE		(44100)				// サンプリングレート
-#define	DEFAULT_SOUNDBUF		(1)					// サウンドバッファ長倍率(基本長はVSYNC)
+#define	DEFAULT_SOUNDBUF		(2)					// サウンドバッファ長倍率(基本長はVSYNC)
 #define	DEFAULT_MASTERVOL		(70)				// マスター音量
 #define	DEFAULT_PSGVOL			(60)				// PSG音量
 #define	DEFAULT_PSGLPF			(0)					// PSG LPFカットオフ周波数(0で無効)
@@ -60,8 +60,8 @@
 #define	DEFAULT_FULLSCREEN		(false) 			// フルスクリーン
 #define	DEFAULT_DISPSTATUS		(true) 				// ステータスバー表示状態
 #define	DEFAULT_AVIBPP			(24) 				// ビデオキャプチャ色深度
-#define	DEFAULT_AVIZOOM			(100) 				// ビデオキャプチャ時ウィンドウ表示倍率
-#define	DEFAULT_AVIFRMSKIP		(1)					// ビデオキャプチャ時フレームスキップ
+#define	DEFAULT_AVIZOOM			(200) 				// ビデオキャプチャ時ウィンドウ表示倍率
+#define	DEFAULT_AVIFRMSKIP		(0)					// ビデオキャプチャ時フレームスキップ
 #define	DEFAULT_AVISCANLINE		(false)				// ビデオキャプチャ時スキャンライン true:あり false:なし
 #define	DEFAULT_AVISCANLINEBR	(75)				// ビデオキャプチャ時スキャンライン輝度 (0-100)%
 #define	DEFAULT_AVIDISPNTSC		(true) 				// ビデオキャプチャ時4:3表示 true:有効 false:無効


WIP - bufferobject cleanup notes

WIP - bufferobject cleanup notes

WIP - bufferobject cleanup notes

--- QtOpenGLTests/OpenGLTester/OpenGLTester/ObjectBase.h
+++ QtOpenGLTests/OpenGLTester/OpenGLTester/ObjectBase.h
@@ -35,6 +35,20 @@
 	virtual void PreDraw();

 protected:
+
+	/*
+		TODO: There's a catch-22 situation here, in that during initialization,
+		we want to set up the vertex attributes to initialize the stride size,
+		but we can't initialize the vbo until we know what size we want, but
+		we can't know the size until we know what we're building. And we can't
+		build it unless we know the stride (since the vertex data comprises
+		what is described in the vertex attributes.
+
+		I guess we don't have to allocate the vbo before creating the vertex attribs
+		(assuming, this will be the next attempt). We only need to allocate the
+		vbo before knowing what the data is made up of.
+
+	*/
 	// Default attribs: Position, Normal
 	virtual void SetupVertexAttributes(QOpenGLBuffer* vbo);
 	virtual void Add(const QVector3D &v, const QVector3D &n);	// TODO: This should be moved somewhere else, like a Builder class


GSocket: fix broadcast documentation

GSocket: fix broadcast documentation

The :broadcast property only affects sending broadcast packets, not
receiving them.

--- gio/gsocket.c
+++ gio/gsocket.c
@@ -895,14 +895,14 @@
   /**
    * GSocket:broadcast:
    *
-   * Whether the socket should allow sending to and receiving from broadcast addresses.
+   * Whether the socket should allow sending to broadcast addresses.
    *
    * Since: 2.32
    */
   g_object_class_install_property (gobject_class, PROP_BROADCAST,
 				   g_param_spec_boolean ("broadcast",
 							 P_("Broadcast"),
-							 P_("Whether to allow sending to and receiving from broadcast addresses"),
+							 P_("Whether to allow sending to broadcast addresses"),
 							 FALSE,
 							 G_PARAM_READWRITE |
                                                          G_PARAM_STATIC_STRINGS));
@@ -1387,7 +1387,7 @@
  *
  * Gets the broadcast setting on @socket; if %TRUE,
  * it is possible to send packets to broadcast
- * addresses or receive from broadcast addresses.
+ * addresses.
  *
  * Returns: the broadcast setting on @socket
  *
@@ -1415,11 +1415,11 @@
 /**
  * g_socket_set_broadcast:
  * @socket: a #GSocket.
- * @broadcast: whether @socket should allow sending to and receiving
- *     from broadcast addresses
- *
- * Sets whether @socket should allow sending to and receiving from
- * broadcast addresses. This is %FALSE by default.
+ * @broadcast: whether @socket should allow sending to broadcast
+ *     addresses
+ *
+ * Sets whether @socket should allow sending to broadcast addresses.
+ * This is %FALSE by default.
  *
  * Since: 2.32
  */


wip, implemented PWM cycle interrupt handling

--- hw/drivers/pwm/pwm_nrf52/src/pwm_nrf52.c
+++ hw/drivers/pwm/pwm_nrf52/src/pwm_nrf52.c
@@ -24,6 +24,7 @@
 #include <errno.h>
 #include <pwm/pwm.h>
 #include <string.h>
+#include <bsp/cmsis_nvic.h>

 /* Nordic headers */
 #include <nrfx.h>
@@ -33,12 +34,15 @@
 /* Mynewt Nordic driver */
 #include "pwm_nrf52/pwm_nrf52.h"

+typedef void (*user_handler_t) ();
 struct nrf52_pwm_dev_global {
     bool in_use;
     bool playing;
     nrfx_pwm_t drv_instance;
     nrfx_pwm_config_t config;
     nrf_pwm_values_individual_t duty_cycles;
+    nrfx_pwm_handler_t internal_handler;
+    user_handler_t user_handler;
 };

 static struct nrf52_pwm_dev_global instances[] =
@@ -48,7 +52,9 @@
     [0].playing = false,
     [0].drv_instance = NRFX_PWM_INSTANCE(0),
     [0].config = NRFX_PWM_DEFAULT_CONFIG,
-    [0].duty_cycles = {0}
+    [0].duty_cycles = {0},
+    [0].internal_handler = NULL,
+    [0].user_handler = NULL
 #endif
 #if MYNEWT_VAL(PWM_1)
     ,
@@ -56,7 +62,9 @@
     [1].playing = false,
     [1].drv_instance = NRFX_PWM_INSTANCE(1),
     [1].config = NRFX_PWM_DEFAULT_CONFIG,
-    [1].duty_cycles = {0}
+    [1].duty_cycles = {0},
+    [1].internal_handler = NULL,
+    [1].user_handler = NULL
 #endif
 #if MYNEWT_VAL(PWM_2)
     ,
@@ -64,7 +72,9 @@
     [2].playing = false,
     [2].drv_instance = NRFX_PWM_INSTANCE(2),
     [2].config = NRFX_PWM_DEFAULT_CONFIG,
-    [2].duty_cycles = {0}
+    [2].duty_cycles = {0},
+    [2].internal_handler = NULL,
+    [2].user_handler = NULL
 #endif
 #if MYNEWT_VAL(PWM_3)
     ,
@@ -72,18 +82,69 @@
     [3].playing = false,
     [3].drv_instance = NRFX_PWM_INSTANCE(3),
     [3].config = NRFX_PWM_DEFAULT_CONFIG,
-    [3].duty_cycles = {0}
+    [3].duty_cycles = {0},
+    [3].internal_handler = NULL,
+    [3].user_handler = NULL
 #endif
 };

-/* /\** */
-/*  * Validate the contents of a given nrf_drv_pwm_config_t structure. */
-/*  *\/ */
-/* static int */
-/* validate_config(nrf_drv_pwm_config_t* config) */
-/* { */
-/*     return 0; */
-/* } */
+#if MYNEWT_VAL(PWM_0)
+static void handler_0(nrfx_pwm_evt_type_t event_type)
+{
+    if (event_type == NRFX_PWM_EVT_FINISHED)
+    {
+        instances[0].user_handler();
+    }
+}
+#endif
+
+#if MYNEWT_VAL(PWM_1)
+static void handler_1(nrfx_pwm_evt_type_t event_type)
+{
+    if (event_type == NRFX_PWM_EVT_FINISHED)
+    {
+        instances[1].user_handler();
+    }
+}
+#endif
+
+#if MYNEWT_VAL(PWM_2)
+static void handler_2(nrfx_pwm_evt_type_t event_type)
+{
+    if (event_type == NRFX_PWM_EVT_FINISHED)
+    {
+        instances[2].user_handler();
+    }
+}
+#endif
+
+#if MYNEWT_VAL(PWM_3)
+static void handler_3(nrfx_pwm_evt_type_t event_type)
+{
+    if (event_type == NRFX_PWM_EVT_FINISHED)
+    {
+        instances[3].user_handler();
+    }
+}
+#endif
+
+static nrfx_pwm_handler_t internal_handlers[] = {
+#if MYNEWT_VAL(PWM_0)
+handler_0
+#endif
+#if MYNEWT_VAL(PWM_1)
+,
+handler_1
+#endif
+#if MYNEWT_VAL(PWM_2)
+,
+handler_2
+#endif
+#if MYNEWT_VAL(PWM_3)
+,
+handler_3
+#endif
+};

 /**
  * Initialize a driver instance.
@@ -91,12 +152,7 @@
 static int
 init_instance(int inst_id, nrfx_pwm_config_t* init_conf)
 {
-    if(!instances[inst_id].in_use) {
-        return (EINVAL);
-    }
     nrfx_pwm_config_t *config;
-    memset(&instances[inst_id].duty_cycles, 0,
-		sizeof(instances[inst_id].duty_cycles));

     config = &instances[inst_id].config;
     if (!init_conf) {
@@ -113,8 +169,22 @@
     } else {
         memcpy(config, init_conf, sizeof(nrfx_pwm_config_t));
     }
-
-    return (0);
+    return (0);
+}
+
+/**
+ * Cleanup a driver instance.
+ */
+static void
+cleanup_instance(int inst_id)
+{
+    instances[inst_id].in_use = false;
+    instances[inst_id].playing = false;
+    instances[inst_id].internal_handler = NULL;
+    instances[inst_id].user_handler = NULL;
+    memset((uint16_t *) &instances[inst_id].duty_cycles,
+           0x00,
+           4 * sizeof(uint16_t));
 }

 /**
@@ -141,6 +211,8 @@
     dev = (struct pwm_dev *) odev;
     inst_id = dev->pwm_instance_id;

+    instances[inst_id].in_use = true;
+
     if (os_started()) {
         stat = os_mutex_pend(&dev->pwm_lock, wait);
         if (stat != OS_OK) {
@@ -177,9 +249,10 @@

     dev = (struct pwm_dev *) odev;
     inst_id = dev->pwm_instance_id;
+    assert(instances[inst_id].in_use);

     nrfx_pwm_uninit(&instances[inst_id].drv_instance);
-    instances[inst_id].playing = false;
+    cleanup_instance(inst_id);

     if (os_started()) {
         os_mutex_release(&dev->pwm_lock);
@@ -194,6 +267,8 @@
 static void
 play_current_config(struct nrf52_pwm_dev_global *instance)
 {
+    assert(instance->in_use);
+
     nrf_pwm_sequence_t const seq =
         {
             .values.p_individual = &instance->duty_cycles,
@@ -213,7 +288,7 @@
  *
  * @param dev The device to configure.
  * @param cnum The channel number to configure.
- * @param cfg  A pwm_chan_cfg data structure.
+ * @param cfg  A pwm_chan_cfg data structure, where .
  *
  * @return 0 on success, non-zero error code on failure.
  */
@@ -225,15 +300,23 @@
     int inst_id = dev->pwm_instance_id;
     nrfx_pwm_config_t *config = &instances[inst_id].config;

+    assert(instances[inst_id].in_use);
+
     config->output_pins[cnum] = cfg->pin;
     config->output_pins[cnum] |= (cfg->inverted) ?
         NRFX_PWM_PIN_INVERTED : config->output_pins[cnum];
+
+    //To-Do: Set irq priority over cfg
+    instances[inst_id].user_handler = (user_handler_t) cfg->data;
+    instances[inst_id].internal_handler = (cfg->data) ?
+        internal_handlers[inst_id] :
+        NULL;

     if (instances[inst_id].playing) {
         nrfx_pwm_uninit(&instances[inst_id].drv_instance);
         nrfx_pwm_init(&instances[inst_id].drv_instance,
                          &instances[inst_id].config,
-                         NULL);
+                         instances[inst_id].internal_handler);

         play_current_config(&instances[inst_id]);
     }
@@ -272,7 +355,7 @@
     if (!instances[inst_id].playing) {
         stat = nrfx_pwm_init(&instances[inst_id].drv_instance,
                                 &instances[inst_id].config,
-                                NULL);
+                                instances[inst_id].internal_handler);
         if (stat != NRFX_SUCCESS) {
             return (stat);
         }
@@ -298,8 +381,9 @@

     nrfx_pwm_uninit(&instances[inst_id].drv_instance);
     nrfx_pwm_init(&instances[inst_id].drv_instance,
-                     &instances[inst_id].config,
-                     NULL);
+                  &instances[inst_id].config,
+                  instances[inst_id].internal_handler);
+
     /* check if there is any channel in use */
     if (instances[inst_id].playing) {
         play_current_config(&instances[inst_id]);
@@ -359,8 +443,8 @@
     if (instances[inst_id].playing) {
         nrfx_pwm_uninit(&instances[inst_id].drv_instance);
         nrfx_pwm_init(&instances[inst_id].drv_instance,
-                         &instances[inst_id].config,
-                         NULL);
+                      &instances[inst_id].config,
+                      instances[inst_id].internal_handler);

         play_current_config(&instances[inst_id]);
     }
@@ -467,7 +551,6 @@

     assert(arg != NULL);
     dev->pwm_instance_id = *((int*) arg);
-    instances[dev->pwm_instance_id].in_use = true;

     dev->pwm_chan_count = NRF_PWM_CHANNEL_COUNT;
     os_mutex_init(&dev->pwm_lock);
@@ -482,5 +565,31 @@
     pwm_funcs->pwm_get_resolution_bits = nrf52_pwm_get_resolution_bits;
     pwm_funcs->pwm_disable = nrf52_pwm_disable;

-    return (0);
-}
+    switch (dev->pwm_instance_id) {
+#if MYNEWT_VAL(PWM_0)
+    case 0:
+        NVIC_SetVector(PWM0_IRQn, (uint32_t) nrfx_pwm_0_irq_handler);
+        break;
+#endif
+
+#if MYNEWT_VAL(PWM_1)
+    case 1:
+        NVIC_SetVector(PWM1_IRQn, (uint32_t) nrfx_pwm_1_irq_handler);
+        break;
+#endif
+
+#if MYNEWT_VAL(PWM_2)
+    case 2:
+        NVIC_SetVector(PWM2_IRQn, (uint32_t) nrfx_pwm_2_irq_handler);
+        break;
+#endif
+
+#if MYNEWT_VAL(PWM_3)
+    case 3:
+        NVIC_SetVector(PWM3_IRQn, (uint32_t) nrfx_pwm_3_irq_handler);
+        break;
+#endif
+    }
+
+    return (0);
+}


mesa: consolidate glCompressedTexSubImage() error checking

Do all the checking in one function instead of two and fix up some of
the error checking.alignment check

--- src/mesa/main/teximage.c
+++ src/mesa/main/teximage.c
@@ -3505,91 +3505,110 @@

 /**
  * Error checking for glCompressedTexSubImage[123]D().
- * \warning  There are some bad assumptions here about the size of compressed
- *           texture tiles (multiple of 4) used to test the validity of the
- *           offset and size parameters.
  * \return error code or GL_NO_ERROR.
  */
 static GLenum
-compressed_subtexture_error_check(struct gl_context *ctx, GLint dimensions,
+compressed_subtexture_error_check(struct gl_context *ctx, GLint dims,
                                   GLenum target, GLint level,
                                   GLint xoffset, GLint yoffset, GLint zoffset,
                                   GLsizei width, GLsizei height, GLsizei depth,
                                   GLenum format, GLsizei imageSize)
 {
-   GLint expectedSize, maxLevels = 0, maxTextureSize;
-
-   (void) zoffset;
-
-   if (dimensions == 1) {
-      /* 1D compressed textures not allowed */
-      return GL_INVALID_ENUM;
-   }
-   else if (dimensions == 2) {
-      if (target == GL_PROXY_TEXTURE_2D) {
-         maxLevels = ctx->Const.MaxTextureLevels;
-      }
-      else if (target == GL_TEXTURE_2D) {
-         maxLevels = ctx->Const.MaxTextureLevels;
-      }
-      else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
-         if (!ctx->Extensions.ARB_texture_cube_map)
-            return GL_INVALID_ENUM; /*target*/
-         maxLevels = ctx->Const.MaxCubeTextureLevels;
-      }
-      else if (_mesa_is_cube_face(target)) {
-         if (!ctx->Extensions.ARB_texture_cube_map)
-            return GL_INVALID_ENUM; /*target*/
-         maxLevels = ctx->Const.MaxCubeTextureLevels;
-      }
-      else {
-         return GL_INVALID_ENUM; /*target*/
-      }
-   }
-   else if (dimensions == 3) {
-      /* 3D compressed textures not allowed */
-      return GL_INVALID_ENUM;
-   }
-
-   maxTextureSize = 1 << (maxLevels - 1);
+   struct gl_texture_object *texObj;
+   struct gl_texture_image *texImage;
+   GLint expectedSize;
+   GLboolean targetOK;
+
+   if (dims == 2) {
+      switch (target) {
+      case GL_TEXTURE_2D:
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+      case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+         targetOK = GL_TRUE;
+         break;
+      default:
+         targetOK = GL_FALSE;
+       }
+    }
+   else {
+      assert(dims == 1 || dims == 3);
+      /* no 1D or 3D compressed textures at this time */
+      targetOK = GL_FALSE;
+   }
+
+   if (!targetOK) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage%uD(target)",
+                  dims);
+      return GL_TRUE;
+   }

    /* this will catch any invalid compressed format token */
-   if (!_mesa_is_compressed_format(ctx, format))
-      return GL_INVALID_ENUM;
-
-   if (width < 1 || width > maxTextureSize)
-      return GL_INVALID_VALUE;
-
-   if ((height < 1 || height > maxTextureSize)
-       && dimensions > 1)
-      return GL_INVALID_VALUE;
-
-   if (level < 0 || level >= maxLevels)
-      return GL_INVALID_VALUE;
+   if (!_mesa_is_compressed_format(ctx, format)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage%uD(format)",
+                  dims);
+      return GL_TRUE;
+   }
+
+   if (level < 0 || level >= _mesa_max_texture_levels(ctx, target)) {
+      _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexImage%uD(level=%d)",
+                  dims, level);
+      return GL_TRUE;
+   }

    expectedSize = compressed_tex_size(width, height, depth, format);
-   if (expectedSize != imageSize)
-      return GL_INVALID_VALUE;
-
-   return GL_NO_ERROR;
-}
-
-
-/**
- * Do second part of glCompressedTexSubImage error checking.
- * \return GL_TRUE if error found, GL_FALSE otherwise.
- */
-static GLboolean
-compressed_subtexture_error_check2(struct gl_context *ctx, GLuint dims,
-                                   GLint xoffset, GLint yoffset,
-                                   GLsizei width, GLsizei height,
-                                   GLsizei depth, GLenum format,
-                                   struct gl_texture_image *texImage)
-{
+   if (expectedSize != imageSize) {
+      _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexImage%uD(size=%d)",
+                  dims, imageSize);
+      return GL_TRUE;
+   }
+
+   texObj = _mesa_get_current_tex_object(ctx, target);
+   if (!texObj) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY,
+                  "glCompressedTexSubImage%uD()", dims);
+      return GL_TRUE;
+   }
+
+   texImage = _mesa_select_tex_image(ctx, texObj, target, level);
+   if (!texImage) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glCompressedTexSubImage%uD(invalid texture image)", dims);
+      return GL_TRUE;
+   }

    if ((GLint) format != texImage->InternalFormat) {
       _mesa_error(ctx, GL_INVALID_OPERATION,
                   "glCompressedTexSubImage%uD(format=0x%x)", dims, format);
+      return GL_TRUE;
+   }
+
+   /* check for negative offsets */
+   if (xoffset < 0 || yoffset < 0 || zoffset < 0) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glCompressedTexSubImage%uD(xoffset=%d yoffset=%d "
+                  "zoffset=%d)", dims, xoffset, yoffset, zoffset);
+      return GL_TRUE;
+   }
+
+   /* check for bad width, height, depth */
+   if (width < 0 || height < 0 || depth < 0) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glCompressedTexSubImage%uD(width=%d height=%d depth=%d)",
+                  dims, width, height, depth);
+      return GL_TRUE;
+   }
+
+   /* check offset + size */
+   if (xoffset + width > texImage->Width ||
+       yoffset + height > texImage->Height ||
+       zoffset + depth > texImage->Depth) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glCompressedTexSubImage%uD(x+width, y+height, z+depth)",
+                  dims);
       return GL_TRUE;
    }

@@ -3658,16 +3677,13 @@
 {
    struct gl_texture_object *texObj;
    struct gl_texture_image *texImage;
-   GLenum error;
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);

-   error = compressed_subtexture_error_check(ctx, dims, target, level,
-                                             xoffset, 0, 0, /* pos */
-                                             width, height, depth,   /* size */
-                                             format, imageSize);
-   if (error) {
-      _mesa_error(ctx, error, "glCompressedTexSubImage%uD", dims);
+   if (compressed_subtexture_error_check(ctx, dims, target, level,
+                                         xoffset, yoffset, zoffset,
+                                         width, height, depth,
+                                         format, imageSize)) {
       return;
    }

@@ -3678,12 +3694,7 @@
       texImage = _mesa_select_tex_image(ctx, texObj, target, level);
       assert(texImage);

-      if (compressed_subtexture_error_check2(ctx, dims, xoffset, yoffset,
-                                             width, height, depth,
-                                             format, texImage)) {
-         /* error was recorded */
-      }
-      else if (width > 0 && height > 0 && depth > 0) {
+      if (width > 0 && height > 0 && depth > 0) {
          ctx->Driver.CompressedTexSubImage(ctx, dims, texImage,
                                            xoffset, yoffset, zoffset,
                                            width, height, depth,


decode/value: object: allow set by reference (again) for some types

Signed-off-by: Michael Ira Krufky <00524723a60798c74a43fcc620c25dd7b9ece078@linuxtv.org>

--- libdvbtee/decode/value/object.h
+++ libdvbtee/decode/value/object.h
@@ -45,40 +45,24 @@
 	Object(const Object&);

 	template <typename T>
-	void set(std::string key, T val)
+	void setByRef(std::string& key, T& val)
 	{
 		if (map.count(key))
 			delete map[key];

-		map[key] = new Value<T>(key, val);
+		//map[key] = new Value<T>(key, val);
+		map.insert( std::pair<std::string, ValueBase*>(key, new Value<T>(key, val)) );
 	}

 	template <typename T>
-	void set(std::string key, T* val)
+	void set(std::string key, T val)
 	{
-		if (map.count(key))
-			delete map[key];
-
-		map[key] = new Value<T>(key, *val);
+		setByRef<T>(key, val);
 	}

-	template <typename T>
-	void set(std::string& key, T val)
-	{
-		if (map.count(key))
-			delete map[key];
-
-		map[key] = new Value<T>(key, val);
-	}
-
-	template <typename T>
-	void set(std::string& key, T* val)
-	{
-		if (map.count(key))
-			delete map[key];
-
-		map[key] = new Value<T>(key, *val);
-	}
+	inline void set(std::string key, std::string& val)	{ setByRef<std::string>(key, val); }
+	inline void set(std::string key, Array& val)		{ setByRef<Array>(key, val); }
+	inline void set(std::string key, Object& val)		{ setByRef<Object>(key, val); }

 	void set(ValueBase*);


Windows thread callback support

Windows thread callback support

--- libraries/libmdb/mdb.c
+++ libraries/libmdb/mdb.c
@@ -2568,11 +2568,8 @@
 }

-#ifndef _WIN32
 /** Release a reader thread's slot in the reader lock table.
  *	This function is called automatically when a thread exits.
- *	Windows doesn't support destructor callbacks for thread-specific storage,
- *	so this function is not compiled there.
  * @param[in] ptr This points to the slot in the reader lock table.
  */
 static void
@@ -2584,6 +2581,60 @@
 	reader->mr_pid = 0;
 	reader->mr_tid = 0;
 }
+
+#ifdef _WIN32
+/** Junk for arranging thread-specific callbacks on Windows. This is
+ *	necessarily platform and compiler-specific. Windows supports up
+ *	to 1088 keys. Let's assume nobody opens more than 64 environments
+ *	in a single process, for now. They can override this if needed.
+ */
+#ifndef MAX_TLS_KEYS
+#define MAX_TLS_KEYS	64
+#endif
+static pthread_key_t mdb_tls_keys[MAX_TLS_KEYS];
+static int mdb_tls_nkeys;
+
+static void NTAPI mdb_tls_callback(PVOID module, DWORD reason, PVOID ptr)
+{
+	int i;
+	switch(reason) {
+	case DLL_PROCESS_ATTACH: break;
+	case DLL_THREAD_ATTACH: break;
+	case DLL_THREAD_DETACH:
+		for (i=0; i<mdb_tls_nkeys; i++) {
+			MDB_reader *r = pthread_getspecific(mdb_tls_keys[i]);
+			mdb_env_reader_dest(r);
+		}
+		break;
+	case DLL_PROCESS_DETACH: break;
+	}
+}
+#ifdef __GNUC__
+#ifdef _WIN64
+const PIMAGE_TLS_CALLBACK mdb_tls_cbp __attribute__((section (".CRT$XLB"))) = mdb_tls_callback;
+#else
+PIMAGE_TLS_CALLBACK mdb_tls_cbp __attribute__((section (".CRT$XLB"))) = mdb_tls_callback;
+#endif
+#else
+#ifdef _WIN64
+/* Force some symbol references.
+ *	_tls_used forces the linker to create the TLS directory if not already done
+ *	mdb_tls_cbp prevents whole-program-optimizer from dropping the symbol.
+ */
+#pragma comment(linker, "/INCLUDE:_tls_used")
+#pragma comment(linker, "/INCLUDE:mdb_tls_cbp")
+#pragma const_seg(".CRT$XLB")
+extern const PIMAGE_TLS_CALLBACK mdb_tls_callback;
+const PIMAGE_TLS_CALLBACK mdb_tls_cbp = mdb_tls_callback;
+#pragma const_seg()
+#else	/* WIN32 */
+#pragma comment(linker, "/INCLUDE:__tls_used")
+#pragma comment(linker, "/INCLUDE:_mdb_tls_cbp")
+#pragma data_seg(".CRT$XLB")
+PIMAGE_TLS_CALLBACK mdb_tls_cbp = mdb_tls_callback;
+#pragma data_seg()
+#endif	/* WIN 32/64 */
+#endif	/* !__GNUC__ */
 #endif

 /** Downgrade the exclusive lock on the region back to shared */
@@ -3040,6 +3091,15 @@
 		env->me_path = strdup(path);
 		DPRINTF("opened dbenv %p", (void *) env);
 		pthread_key_create(&env->me_txkey, mdb_env_reader_dest);
+#ifdef _WIN32
+		/* Windows TLS callbacks need help finding their TLS info. */
+		if (mdb_tls_nkeys < MAX_TLS_KEYS)
+			mdb_tls_keys[mdb_tls_nkeys++] = env->me_txkey;
+		else {
+			rc = ENOMEM;
+			goto leave;
+		}
+#endif
 		LAZY_RWLOCK_INIT(&env->me_dblock, NULL);
 		if (excl)
 			mdb_env_share_locks(env);
@@ -3087,6 +3147,17 @@

 	LAZY_RWLOCK_DESTROY(&env->me_dblock);
 	pthread_key_delete(env->me_txkey);
+#ifdef _WIN32
+	/* Delete our key from the global list */
+	{ int i;
+		for (i=0; i<mdb_tls_nkeys; i++)
+			if (mdb_tls_keys[i] == env->me_txkey) {
+				mdb_tls_keys[i] = mdb_tls_keys[mdb_tls_nkeys-1];
+				mdb_tls_nkeys--;
+				break;
+			}
+	}
+#endif

 	if (env->me_map) {
 		munmap(env->me_map, env->me_mapsize);


Add a proper hash function for AqlValue objects.

--- arangod/Aql/Types.h
+++ arangod/Aql/Types.h
@@ -27,6 +27,8 @@

 #ifndef ARANGODB_AQL_TYPES_H
 #define ARANGODB_AQL_TYPES_H 1
+
+#include <functional>

 #include <Basics/JsonHelper.h>

@@ -254,7 +256,27 @@

 template<> struct hash<triagens::aql::AqlValue> {
   size_t operator () (triagens::aql::AqlValue const& x) const {
-    return 1;
+    std::hash<uint32_t> intHash;
+    std::hash<void const*> ptrHash;
+    size_t res = intHash(static_cast<uint32_t>(x._type));
+    switch (x._type) {
+      case triagens::aql::AqlValue::JSON: {
+        return res ^ ptrHash(x._json);
+      }
+      case triagens::aql::AqlValue::SHAPED: {
+        return res ^ ptrHash(x._marker);
+      }
+      case triagens::aql::AqlValue::DOCVEC: {
+        return res ^ ptrHash(x._vector);
+      }
+      case triagens::aql::AqlValue::RANGE: {
+        return res ^ ptrHash(x._range);
+      }
+      default: {
+        TRI_ASSERT(false);
+        return 0;
+      }
+    }
   }
 };


Added YAZ_FILEVERSION

Added YAZ_FILEVERSION

--- include/yaz/yaz-version.h
+++ include/yaz/yaz-version.h
@@ -24,7 +24,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-/* $Id: yaz-version.h,v 1.138 2007-12-19 11:02:21 adam Exp $ */
+/* $Id: yaz-version.h,v 1.139 2007-12-19 12:36:42 adam Exp $ */
 /**
  * \file yaz-version.h
  * \brief Defines YAZ version.
@@ -36,7 +36,10 @@
 #define YAZ_VERSION "3.0.18"
 #define YAZ_VERSIONL 0x030012

+#define YAZ_FILEVERSION 3,0,18,1
+
 #define YAZ_DATE 1
+

 #ifdef WIN32
 #ifdef NDEBUG


expose the KVO wrapper

expose the KVO wrapper

--- ReactiveCocoaFramework/ReactiveCocoa/ReactiveCocoa.h
+++ ReactiveCocoaFramework/ReactiveCocoa/ReactiveCocoa.h
@@ -36,6 +36,7 @@
 #import <ReactiveCocoa/NSNotificationCenter+RACSupport.h>
 #import <ReactiveCocoa/NSData+RACSupport.h>
 #import <ReactiveCocoa/NSString+RACSupport.h>
+#import <ReactiveCocoa/NSObject+RACKVOWrapper.h>

 #ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
 #import <ReactiveCocoa/UIControl+RACSubscribableSupport.h>