remove dh parameter check at configure time.

this is done when the workers startup if a domain with tls was used.

--- src/config.c
+++ src/config.c
@@ -234,11 +234,6 @@
 	kore_parse_config_file(fp);
 	(void)fclose(fp);

-#if !defined(KORE_NO_TLS)
-	if (tls_dhparam == NULL)
-		fatal("incomplete TLS setup: no DH parameters provided");
-#endif
-
 	if (!kore_module_loaded())
 		fatal("no application module was loaded");


Add "--non-empty" flag to git-pack-objects

It skips writing the pack-file if it ends up being empty.

--- pack-objects.c
+++ pack-objects.c
@@ -18,6 +18,7 @@
 	struct object_entry *delta;
 };

+static int non_empty = 0;
 static int incremental = 0;
 static struct object_entry **sorted_by_sha, **sorted_by_type;
 static struct object_entry *objects = NULL;
@@ -391,6 +392,10 @@
 		const char *arg = argv[i];

 		if (*arg == '-') {
+			if (!strcmp("--non-empty", arg)) {
+				non_empty = 1;
+				continue;
+			}
 			if (!strcmp("--incremental", arg)) {
 				incremental = 1;
 				continue;
@@ -440,6 +445,8 @@
 		}
 		add_object_entry(sha1, hash);
 	}
+	if (non_empty && !nr_objects)
+		return 0;
 	get_object_details();

 	fprintf(stderr, "Packing %d objects\n", nr_objects);


add C implementation of TransientLogSpiral

error: pathspec 'galpy/potential_src/potential_c_ext/TransientLogSpiralPotential.c' did not match any file(s) known to git

--- galpy/potential_src/potential_c_ext/TransientLogSpiralPotential.c
+++ galpy/potential_src/potential_c_ext/TransientLogSpiralPotential.c
@@ -0,0 +1,34 @@
+#include <math.h>
+#include <galpy_potentials.h>
+//TransientLogSpiralPotential
+//
+double TransientLogSpiralPotentialRforce(double R,double phi,double t,
+					 int nargs, double *args){
+  //Get args
+  double amp= *args++;
+  double A= *args++;
+  double to= *args++;
+  double sigma2= *args++;
+  double alpha= *args++;
+  double m= *args++;
+  double omegas= *args++;
+  double gamma= *args++;
+  //Calculate Rforce
+  return amp * A * exp(-pow(t-to,2.)/2./sigma2) / R
+    * sin(alpha*log(R)+m*(phi-omegas*t-gamma));
+}
+double TransientLogSpiralPotentialphiforce(double R,double phi,double t,
+					   int nargs, double *args){
+  //Get args
+  double amp= *args++;
+  double A= *args++;
+  double to= *args++;
+  double sigma2= *args++;
+  double alpha= *args++;
+  double m= *args++;
+  double omegas= *args++;
+  double gamma= *args++;
+  //Calculate phiforce
+  return amp * A * exp(-pow(t-to,2.)/2./sigma2) / alpha * m
+    * sin(alpha*log(R)+m*(phi-omegas*t-gamma));
+}


Back to -dev

Back to -dev

--- src/config.h
+++ src/config.h
@@ -4,6 +4,6 @@
 /* package name */
 #define PACKAGE "pianobar"

-#define VERSION "2011.12.11"
+#define VERSION "2011.12.11-dev"

 #endif /* _CONFIG_H */


Fix: indentation and documentation

Fix: indentation and documentation

git-svn-id: e7ea667a1d39a4453c4efcc4ba7bca3d620c3f19@4238 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- io/include/pcl/io/ply_io.h
+++ io/include/pcl/io/ply_io.h
@@ -341,40 +341,47 @@
       appendFloatProperty (const std::string& name, const size_t& count = 1);

       /** Callback function for the begin of vertex line */
-      void vertexBeginCallback ();
+      void
+      vertexBeginCallback ();

       /** Callback function for the end of vertex line */
-      void vertexEndCallback ();
+      void
+      vertexEndCallback ();

       /** Callback function for the begin of range_grid line */
-      void rangeGridBeginCallback ();
+      void
+      rangeGridBeginCallback ();

       /** Callback function for the begin of range_grid vertex_indices property
         * param[in] size vertex_indices list size
         */
-      void rangeGridVertexIndicesBeginCallback (pcl::io::ply::uint8 size);
+      void
+      rangeGridVertexIndicesBeginCallback (pcl::io::ply::uint8 size);

       /** Callback function for each range_grid vertex_indices element
         * param[in] vertex_index index of the vertex in vertex_indices
         */
-      void rangeGridVertexIndicesElementCallback (pcl::io::ply::int32 vertex_index);
+      void
+      rangeGridVertexIndicesElementCallback (pcl::io::ply::int32 vertex_index);

       /** Callback function for the end of a range_grid vertex_indices property */
-      void rangeGridVertexIndicesEndCallback ();
+      void
+      rangeGridVertexIndicesEndCallback ();

       /** Callback function for the end of a range_grid element end */
-      void rangeGridEndCallback ();
-      /* void faceBegin(); */
-      /* void faceVertexIndicesBegin(pcl::io::ply::uint8 size); */
-      /* void faceVertexIndices_element(pcl::io::ply::int32 vertex_index); */
-      /* void faceVertexIndicesEnd(); */
-      /* void faceEnd(); */
+      void
+      rangeGridEndCallback ();
+
       /** Callback function for obj_info */
-      void objInfoCallback (const std::string& line);
+      void
+      objInfoCallback (const std::string& line);
+
       /// origin
       Eigen::Vector4f origin_;
+
       /// orientation
       Eigen::Matrix3f orientation_;
+
       //vertex element artifacts
       sensor_msgs::PointCloud2 *cloud_;
       size_t vertex_count_, vertex_properties_counter_;
@@ -395,11 +402,20 @@
   class PCL_EXPORTS PLYWriter : public FileWriter
   {
     public:
+      ///Constructor
       PLYWriter () : mask_ (0) {};
+
+      ///Destructor
       ~PLYWriter () {};

       /** \brief Generate the header of a PLY v.7 file format
         * \param[in] cloud the point cloud data message
+        * \param[in] origin the sensor data acquisition origin (translation)
+        * \param[in] orientation the sensor data acquisition origin (rotation)
+        * \param[in] valid_points number of valid points (finite ones for range_grid and
+        * all of them for camer)
+        * \param[in] use_camera if set to true then PLY file will use element camera else
+        * element range_grid will be used.
         */
       inline std::string
       generateHeaderBinary (const sensor_msgs::PointCloud2 &cloud,
@@ -413,6 +429,12 @@

       /** \brief Generate the header of a PLY v.7 file format
         * \param[in] cloud the point cloud data message
+        * \param[in] origin the sensor data acquisition origin (translation)
+        * \param[in] orientation the sensor data acquisition origin (rotation)
+        * \param[in] valid_points number of valid points (finite ones for range_grid and
+        * all of them for camer)
+        * \param[in] use_camera if set to true then PLY file will use element camera else
+        * element range_grid will be used.
         */
       inline std::string
       generateHeaderASCII (const sensor_msgs::PointCloud2 &cloud,
@@ -430,6 +452,8 @@
         * \param[in] origin the sensor data acquisition origin (translation)
         * \param[in] orientation the sensor data acquisition origin (rotation)
         * \param[in] precision the specified output numeric stream precision (default: 8)
+        * \param[in] use_camera if set to true then PLY file will use element camera else
+        * element range_grid will be used.
         */
       int
       writeASCII (const std::string &file_name, const sensor_msgs::PointCloud2 &cloud,
@@ -475,9 +499,9 @@
         * \param[in] origin the sensor acquisition origin
         * \param[in] orientation the sensor acquisition orientation
         * \param[in] binary set to true if the file is to be written in a binary
+        * PLY format, false (default) for ASCII
         * \param[in] use_camera set to true to used camera element and false to
         * use range_grid element
-        * PLY format, false (default) for ASCII
         */
       inline int
       write (const std::string &file_name, const sensor_msgs::PointCloud2 &cloud,
@@ -499,6 +523,8 @@
         * \param[in] orientation the sensor acquisition orientation
         * \param[in] binary set to true if the file is to be written in a binary
         * PLY format, false (default) for ASCII
+        * \param[in] use_camera set to true to used camera element and false to
+        * use range_grid element
         */
       inline int
       write (const std::string &file_name, const sensor_msgs::PointCloud2::ConstPtr &cloud,
@@ -515,6 +541,8 @@
         * \param[in] cloud the pcl::PointCloud data
         * \param[in] binary set to true if the file is to be written in a binary
         * PLY format, false (default) for ASCII
+        * \param[in] use_camera set to true to used camera element and false to
+        * use range_grid element
         */
       template<typename PointT> inline int
       write (const std::string &file_name,
@@ -544,7 +572,7 @@
                       bool binary,
                       bool use_camera,
                       int valid_points);
-
+
       void
       writeContentWithCameraASCII (int nr_points,
                                    int point_size,


Fix DataView setters

Fix DataView setters

--- iv/lv5/runtime_data_view.h
+++ iv/lv5/runtime_data_view.h
@@ -203,7 +203,7 @@
   }
   const uint32_t offset = args.At(0).ToUInt32(ctx, IV_LV5_ERROR(e));
   const int16_t value = args.At(1).ToInt32(ctx, IV_LV5_ERROR(e));
-  static_cast<JSDataView*>(view)->SetValue<int16_t>(offset, args.At(1).ToBoolean(), value, e);
+  static_cast<JSDataView*>(view)->SetValue<int16_t>(offset, args.At(2).ToBoolean(), value, e);
   return JSUndefined;
 }

@@ -219,7 +219,7 @@
   }
   const uint32_t offset = args.At(0).ToUInt32(ctx, IV_LV5_ERROR(e));
   const uint16_t value = args.At(1).ToUInt32(ctx, IV_LV5_ERROR(e));
-  static_cast<JSDataView*>(view)->SetValue<uint16_t>(offset, args.At(1).ToBoolean(), value, e);
+  static_cast<JSDataView*>(view)->SetValue<uint16_t>(offset, args.At(2).ToBoolean(), value, e);
   return JSUndefined;
 }

@@ -235,7 +235,7 @@
   }
   const uint32_t offset = args.At(0).ToUInt32(ctx, IV_LV5_ERROR(e));
   const int32_t value = args.At(1).ToInt32(ctx, IV_LV5_ERROR(e));
-  static_cast<JSDataView*>(view)->SetValue<int32_t>(offset, args.At(1).ToBoolean(), value, e);
+  static_cast<JSDataView*>(view)->SetValue<int32_t>(offset, args.At(2).ToBoolean(), value, e);
   return JSUndefined;
 }

@@ -251,7 +251,7 @@
   }
   const uint32_t offset = args.At(0).ToUInt32(ctx, IV_LV5_ERROR(e));
   const uint32_t value = args.At(1).ToUInt32(ctx, IV_LV5_ERROR(e));
-  static_cast<JSDataView*>(view)->SetValue<uint32_t>(offset, args.At(1).ToBoolean(), value, e);
+  static_cast<JSDataView*>(view)->SetValue<uint32_t>(offset, args.At(2).ToBoolean(), value, e);
   return JSUndefined;
 }

@@ -267,7 +267,7 @@
   }
   const uint32_t offset = args.At(0).ToUInt32(ctx, IV_LV5_ERROR(e));
   const float value = args.At(1).ToNumber(ctx, IV_LV5_ERROR(e));
-  static_cast<JSDataView*>(view)->SetValue<float>(offset, args.At(1).ToBoolean(), value, e);
+  static_cast<JSDataView*>(view)->SetValue<float>(offset, args.At(2).ToBoolean(), value, e);
   return JSUndefined;
 }


normalize check for context in cipher pragma

--- src/crypto.c
+++ src/crypto.c
@@ -95,10 +95,10 @@
     codec_vdbe_return_static_string(pParse, "cipher_version", codec_get_cipher_version());
   }else
   if( sqlite3StrICmp(zLeft, "cipher")==0 ){
-    if( zRight ) {
-      if(ctx) sqlcipher_codec_ctx_set_cipher(ctx, zRight, 2); // change cipher for both
-    }else {
-      if(ctx) {
+    if(ctx) {
+      if( zRight ) {
+        sqlcipher_codec_ctx_set_cipher(ctx, zRight, 2); // change cipher for both
+      }else {
         codec_vdbe_return_static_string(pParse, "cipher",
           sqlcipher_codec_ctx_get_cipher(ctx, 2));
       }


src/csp_io: set idout->src when sending thruogh routing table

--- src/csp_io.c
+++ src/csp_io.c
@@ -124,6 +124,9 @@
 	/* Try to send via routing table */
 	csp_route_t * route = csp_rtable_find_route(idout.dst);
 	if (route != NULL) {
+		if (idout.src == 0) {
+			idout.src = route->iface->addr;
+		}
 		csp_send_direct_iface(idout, packet, route->iface, route->via, from_me);
 		return;
 	}


Protect entries actions with lock

Protect entries actions with lock

--- src/curses.h
+++ src/curses.h
@@ -7,6 +7,7 @@
 #include <curses.h>

 #include <map>
+#include <mutex>
 #include <string>

 namespace curses {
@@ -173,10 +174,14 @@
  private:
   std::map<int, Entry> entries_;

+  std::mutex entries_lock_;
+
   int entry_id = 0;
   int selected = entry_id;
   int offset = 0;

+  bool needs_sync_ = false;
+
   int next_id() {
     return entry_id++;
   }
@@ -185,6 +190,10 @@
   ListWindow(int x, int y, int width, int height) : Window(x, y, width, height) {}

   int add_entry(const Entry& entry) {
+    std::lock_guard<std::mutex> guard(entries_lock_);
+
+    needs_sync_ = true;
+
     const auto next = next_id();
     entries_.emplace(next, entry);
     entries_.find(selected)->second.selected = true;
@@ -192,6 +201,13 @@
   }

   void sync_display() {
+    std::lock_guard<std::mutex> guard(entries_lock_);
+
+    if (!needs_sync_) {
+      return;
+    }
+    needs_sync_ = false;
+
     clear();
     for (auto& p : entries_) {
       if (p.first < offset || p.first >= offset + height_) {
@@ -201,7 +217,9 @@
     }
   }

-  bool update(Client&, Log& logfile) {
+  bool update(Client&, Log&) {
+    std::lock_guard<std::mutex> guard(entries_lock_);
+
     char c = get_char();
     int prev_selected = selected;
     switch (static_cast<DirectionKey>(c)) {
@@ -232,6 +250,7 @@
     if (prev_selected != selected) {
       entries_.find(prev_selected)->second.selected = false;
       entries_.find(selected)->second.selected = true;
+      needs_sync_ = true;
     }
     return true;
   }


imporved logic

imporved logic


fix pcf8591 input values

fix pcf8591 input values

--- firmware-src/sources/devices/pcf8591.c
+++ firmware-src/sources/devices/pcf8591.c
@@ -55,7 +55,7 @@

 	int i;
 	for (i = 0; i < sizeof(buf); i++) {
-		values[i] = mVoltage * ((float)(int8_t)buf[i]) / 255.0f; // TODO: check 256 scale?
+		values[i] = mVoltage * ((float)buf[i]) / 255.0f;
 	}

 	return DH_I2C_OK;
@@ -78,7 +78,7 @@
 		}
 	}

-	const int8_t v = (value / mVoltage * 255.0f); // TODO: check 256 scale?
+	const uint8_t v = (uint8_t)(value / mVoltage * 255.0f);

 	uint8_t buf[2];
 	buf[0] = 0x44;  // Config


i#1908: eliminate x64 vdso curiosities

i#1908: eliminate x64 vdso curiosities

Adds recording of both the vdso and vsyscall pages on x64 to avoid
curiosities from execution of vdso when the pages are split.

Fixes #1908

Review-URL: https://codereview.appspot.com/289580043

--- core/unix/os.c
+++ core/unix/os.c
@@ -363,12 +363,14 @@
 app_pc vsyscall_sysenter_return_pc = NULL;
 #define VSYSCALL_PAGE_START_HARDCODED ((app_pc)(ptr_uint_t) 0xffffe000)
 #ifdef X64
-/* i#430, in Red Hat Enterprise Server 5.6, vysycall region is marked
+/* i#430, in Red Hat Enterprise Server 5.6, vsyscall region is marked
  * not executable
  * ffffffffff600000-ffffffffffe00000 ---p 00000000 00:00 0  [vsyscall]
  */
 # define VSYSCALL_REGION_MAPS_NAME "[vsyscall]"
 #endif
+/* i#1908: vdso and vsyscall are now split */
+app_pc vdso_page_start = NULL;

 #if !defined(STANDALONE_UNIT_TEST) && !defined(STATIC_LIBRARY)
 /* The pthreads library keeps errno in its pthread_descr data structure,
@@ -7041,7 +7043,9 @@
                                         &last_seg_end,
                                         NULL, NULL)) {
             ASSERT_CURIOSITY(size == (ALIGN_FORWARD(first_seg_end, PAGE_SIZE) -
-                                      (ptr_uint_t)first_seg_base));
+                                      (ptr_uint_t)first_seg_base) ||
+                             base == vdso_page_start ||
+                             base == vsyscall_page_start);
             mod_size = ALIGN_FORWARD(last_seg_end, PAGE_SIZE) -
                 (ptr_uint_t)first_seg_base;
         }
@@ -7079,7 +7083,7 @@
             if (iter.vm_start == vsyscall_page_start) {
                 ASSERT_CURIOSITY(!at_map);
             } else {
-                ASSERT_CURIOSITY(iter.inode != 0);
+                ASSERT_CURIOSITY(iter.inode != 0 || base == vdso_page_start);
                 ASSERT_CURIOSITY(iter.offset == 0); /* first map shouldn't have offset */
                 /* XREF 307599 on rounding module end to the next PAGE boundary */
                 ASSERT_CURIOSITY((iter.vm_end - iter.vm_start ==
@@ -7094,7 +7098,7 @@
     memquery_iterator_stop(&iter);
 #ifdef HAVE_MEMINFO
     /* barring weird races we should find this map except [vdso] */
-    ASSERT_CURIOSITY(found_map || base == vsyscall_page_start);
+    ASSERT_CURIOSITY(found_map || base == vsyscall_page_start || base == vdso_page_start);
 #else /* HAVE_MEMINFO */
     /* Without /proc/maps or other memory querying interface available at
      * library map time, there is no way to find out the name of the file
@@ -8235,12 +8239,12 @@
             image = true;
 #endif
         } else if (strncmp(iter.comment, VSYSCALL_PAGE_MAPS_NAME,
-                    strlen(VSYSCALL_PAGE_MAPS_NAME)) == 0
-            IF_X64_ELSE(|| strncmp(iter.comment, VSYSCALL_REGION_MAPS_NAME,
-                                   strlen(VSYSCALL_REGION_MAPS_NAME)) == 0,
+                           strlen(VSYSCALL_PAGE_MAPS_NAME)) == 0 ||
+                   IF_X64_ELSE(strncmp(iter.comment, VSYSCALL_REGION_MAPS_NAME,
+                                       strlen(VSYSCALL_REGION_MAPS_NAME)) == 0,
             /* Older kernels do not label it as "[vdso]", but it is hardcoded there */
             /* 32-bit */
-                        || iter.vm_start == VSYSCALL_PAGE_START_HARDCODED)) {
+                               iter.vm_start == VSYSCALL_PAGE_START_HARDCODED)) {
 # ifndef X64
             /* We assume no vsyscall page for x64; thus, checking the
              * hardcoded address shouldn't have any false positives.
@@ -8256,6 +8260,8 @@
              */
             DODEBUG({ map_type = "VDSO"; });
             vsyscall_page_start = iter.vm_start;
+            if (vdso_page_start == NULL)
+                vdso_page_start = vsyscall_page_start; /* assume identical for now */
             LOG(GLOBAL, LOG_VMAREAS, 1, "found vsyscall page @ "PFX" %s\n",
                 vsyscall_page_start, iter.comment);
 # else
@@ -8271,6 +8277,13 @@
              */
             if (!TESTALL((PROT_READ|PROT_EXEC), iter.prot))
                 iter.prot |= (PROT_READ|PROT_EXEC);
+            /* i#1908: vdso and vsyscall pages are now split */
+            if (strncmp(iter.comment, VSYSCALL_PAGE_MAPS_NAME,
+                        strlen(VSYSCALL_PAGE_MAPS_NAME)) == 0)
+                vdso_page_start = iter.vm_start;
+            else if (strncmp(iter.comment, VSYSCALL_REGION_MAPS_NAME,
+                             strlen(VSYSCALL_REGION_MAPS_NAME)) == 0)
+                vsyscall_page_start = iter.vm_start;
 # endif
         } else if (mmap_check_for_module_overlap(iter.vm_start, size,
                                                  TEST(MEMPROT_READ, iter.prot),


Use NS_ENUM instead of typedef enum to eliminate 'ambiguous use' errors

--- framework/Source/iOS/GPUImageContext.h
+++ framework/Source/iOS/GPUImageContext.h
@@ -4,7 +4,16 @@

 #define GPUImageRotationSwapsWidthAndHeight(rotation) ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical || (rotation) == kGPUImageRotateRightFlipHorizontal)

-typedef enum { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizonal, kGPUImageRotateRightFlipVertical, kGPUImageRotateRightFlipHorizontal, kGPUImageRotate180 } GPUImageRotationMode;
+typedef NS_ENUM(NSUInteger, GPUImageRotationMode) {
+	kGPUImageNoRotation,
+	kGPUImageRotateLeft,
+	kGPUImageRotateRight,
+	kGPUImageFlipVertical,
+	kGPUImageFlipHorizonal,
+	kGPUImageRotateRightFlipVertical,
+	kGPUImageRotateRightFlipHorizontal,
+	kGPUImageRotate180
+};

 @interface GPUImageContext : NSObject


Quick bandaid for chromium:611002.

Quick bandaid for chromium:611002.

We're somehow receiving non-premultiplied src inputs like 0x00ffffff to this
SrcOver blend.  That's a bug I intend to follow up on.  But for a quick
compatibility fix, go back to treating values like 0x00ffffff as transparent,
like we used to before crrev.com/1820313002.

This will not affect the correctness of code paths using properly premultiplied colors.

This should not change performance in any meaningful way.

The SIMD code paths (handling strides of 16 pixels at a time) happen to treat
invalid colors like 0x00fffff as transparent already.

BUG=chromium:611002
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2075173002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

Review-Url: https://codereview.chromium.org/2075173002

--- src/opts/SkBlitRow_opts.h
+++ src/opts/SkBlitRow_opts.h
@@ -190,7 +190,11 @@
 #endif

     while (len-- > 0) {
-        if (*src) {
+        // This 0xFF000000 is not semantically necessary, but for compatibility
+        // with chromium:611002 we need to keep it until we figure out where
+        // the non-premultiplied src values (like 0x00FFFFFF) are coming from.
+        // TODO(mtklein): sort this out and assert *src is premul here.
+        if (*src & 0xFF000000) {
             *dst = (*src >= 0xFF000000) ? *src : SkPMSrcOver(*src, *dst);
         }
         src++;


i#58 MacOS: use SYS_thread_selfid for thread id

SYS_gettid is instead some kind of effective uid.  SYS_thread_selfid was
added in 10.6, so we simply do not support 10.5 or earlier.

SVN-Revision: 2468

--- core/unix/os.c
+++ core/unix/os.c
@@ -1,5 +1,5 @@
 /* *******************************************************************************
- * Copyright (c) 2010-2013 Google, Inc.  All rights reserved.
+ * Copyright (c) 2010-2014 Google, Inc.  All rights reserved.
  * Copyright (c) 2011 Massachusetts Institute of Technology  All rights reserved.
  * Copyright (c) 2000-2010 VMware, Inc.  All rights reserved.
  * *******************************************************************************/
@@ -687,10 +687,24 @@
      * or whether getpid suffices.  even 2.4 kernels have gettid
      * (maps to getpid), don't have an old enough target to test this.
      */
+#ifdef MACOS
+    kernel_thread_groups = (dynamorio_syscall(SYS_thread_selfid, 0) >= 0);
+#else
     kernel_thread_groups = (dynamorio_syscall(SYS_gettid, 0) >= 0);
+#endif
     LOG(GLOBAL, LOG_TOP|LOG_STATS, 1, "thread id is from %s\n",
         kernel_thread_groups ? "gettid" : "getpid");
+#ifdef MACOS
+    /* SYS_thread_selfid was added in 10.6.  We have no simple way to get the
+     * thread id on 10.5, so we don't support it.
+     */
+    if (!kernel_thread_groups) {
+        SYSLOG(SYSLOG_WARNING, UNSUPPORTED_OS_VERSION, 3,
+               get_application_name(), get_application_pid(), "Mac OSX 10.5 or earlier");
+    }
+#else
     ASSERT_CURIOSITY(kernel_thread_groups);
+#endif

     pid_cached = get_process_id();

@@ -1898,11 +1912,14 @@
 thread_id_t
 get_sys_thread_id(void)
 {
-    if (kernel_thread_groups) {
+#ifdef MACOS
+    if (kernel_thread_groups)
+        return dynamorio_syscall(SYS_thread_selfid, 0);
+#else
+    if (kernel_thread_groups)
         return dynamorio_syscall(SYS_gettid, 0);
-    } else {
-        return dynamorio_syscall(SYS_getpid, 0);
-    }
+#endif
+    return dynamorio_syscall(SYS_getpid, 0);
 }

 thread_id_t


[AVX512] Add masked v16i32 and v8i64 unaligned store tests.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@271134 91177308-0d34-0410-b5e6-96231b3b80d8

--- test/CodeGen/avx512f-builtins.c
+++ test/CodeGen/avx512f-builtins.c
@@ -194,6 +194,18 @@
   // CHECK-LABEL: @test_mm512_mask_store_pd
   // CHECK: @llvm.x86.avx512.mask.store.pd.512
   _mm512_mask_store_pd(p, m, a);
+}
+
+void test_mm512_mask_storeu_epi32(void *__P, __mmask16 __U, __m512i __A) {
+  // CHECK-LABEL: @test_mm512_mask_storeu_epi32
+  // CHECK: @llvm.x86.avx512.mask.storeu.d.512
+  return _mm512_mask_storeu_epi32(__P, __U, __A);
+}
+
+void test_mm512_mask_storeu_epi64(void *__P, __mmask8 __U, __m512i __A) {
+  // CHECK-LABEL: @test_mm512_mask_storeu_epi64
+  // CHECK: @llvm.x86.avx512.mask.storeu.q.512
+  return _mm512_mask_storeu_epi64(__P, __U, __A);
 }

 __m512i test_mm512_loadu_si512 (void *__P)


Bug fix:  not checking connection ID for some commands (Load,
ContextSave, FlushContext).

Also had to move location of GetConnectionID call.

--- resourcemgr/resourcemgr.c
+++ resourcemgr/resourcemgr.c
@@ -1269,6 +1269,10 @@

     numSessionHandles = i;

+    responseRval = GetConnectionId( &cmdConnectionId, tctiContext );
+    if( responseRval != TSS2_RC_SUCCESS )
+        goto SendCommand;
+
     switch( currentCommandCode )
     {
         case TPM_CC_StartAuthSession:
@@ -1303,6 +1307,13 @@
             {
                 goto SendCommand;
             }
+
+            if( foundEntryPtr->connectionId != cmdConnectionId )
+            {
+                responseRval = TSS2_RESMGR_UNOWNED_HANDLE;
+                goto SendCommand;
+            }
+
             cmdHierarchy = foundEntryPtr->hierarchy;

             // Skip past inPrivate param.
@@ -1351,6 +1362,18 @@
             cmdHierarchy = TPM_RH_NULL;
             break;
         case TPM_CC_ContextSave:
+            responseRval = FindEntry( entryList, RMFIND_VIRTUAL_HANDLE, cmdHandles[0].handle, &foundEntryPtr );
+            if( responseRval != TSS2_RC_SUCCESS )
+            {
+                goto SendCommand;
+            }
+
+            if( foundEntryPtr->connectionId != cmdConnectionId )
+            {
+                responseRval = TSS2_RESMGR_UNOWNED_HANDLE;
+                goto SendCommand;
+            }
+
             cmdSavedHandle = cmdHandles[0].handle;
             break;
         case TPM_CC_ContextLoad:
@@ -1359,6 +1382,19 @@
             break;
         case TPM_CC_FlushContext:
             cmdFlushedHandle = cmdHandles[0].handle;
+
+            responseRval = FindEntry( entryList, RMFIND_VIRTUAL_HANDLE, cmdHandles[0].handle, &foundEntryPtr );
+            if( responseRval != TSS2_RC_SUCCESS )
+            {
+                goto SendCommand;
+            }
+
+            if( foundEntryPtr->connectionId != cmdConnectionId )
+            {
+                responseRval = TSS2_RESMGR_UNOWNED_HANDLE;
+                goto SendCommand;
+            }
+
             break;
         case TPM_CC_Startup:
             RESMGR_UNMARSHAL_UINT16( command_buffer, command_size, &currentPtr, &startupType, &responseRval, SendCommand );
@@ -1375,10 +1411,6 @@
             break;
     }

-    if( responseRval != TSS2_RC_SUCCESS )
-        goto SendCommand;
-
-    responseRval = GetConnectionId( &cmdConnectionId, tctiContext );
     if( responseRval != TSS2_RC_SUCCESS )
         goto SendCommand;


code cleanup, removed blank lines

code cleanup, removed blank lines


PARQUET-657: Do not define DISALLOW_COPY_AND_ASSIGN if already defined

This can cause conflicts with other libraries that also use this common macro (from Google's gutil library originally)

Author: Wes McKinney <wesm@apache.org>

Closes #135 from wesm/PARQUET-657 and squashes the following commits:

bc4f09b [Wes McKinney] Do not define macro if has been defined elsewhere

--- src/parquet/util/macros.h
+++ src/parquet/util/macros.h
@@ -21,9 +21,11 @@
 // Useful macros from elsewhere

 // From Google gutil
+#ifndef DISALLOW_COPY_AND_ASSIGN
 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
   TypeName(const TypeName&) = delete;      \
   void operator=(const TypeName&) = delete
+#endif

 // ----------------------------------------------------------------------
 // From googletest


build: require _WIN32_WINNT 0x0600.

build: require _WIN32_WINNT 0x0600.

--- src/bson/bson-compat.h
+++ src/bson/bson-compat.h
@@ -37,6 +37,12 @@

 #ifdef BSON_OS_WIN32
+# if defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x0600)
+#  undef _WIN32_WINNT
+# endif
+# ifndef _WIN32_WINNT
+#  define _WIN32_WINNT 0x0600
+# endif
 # include <winsock2.h>
 #  ifndef WIN32_LEAN_AND_MEAN
 #   define WIN32_LEAN_AND_MEAN


Debug Elem Detail introduced

Debug Elem Detail introduced

FossilOrigin-Name: 6e12c8cef6773dba389edf5faec4113437d6769ad58496692008389ca0cddbb4

--- src/cw/dbg.h
+++ src/cw/dbg.h
@@ -96,6 +96,9 @@
 	/** Show message elements  */
 	DBG_ELEM,

+	/** Show message element details  */
+	DBG_ELEM_DETAIL,
+
 	/** Error in msg elements */
 	DBG_ELEM_ERR,


fixed compatibility issues with nginx 1.7.11+ configured with --with-threads. thanks Gate Bill for the report.

--- src/ddebug.h
+++ src/ddebug.h
@@ -1,6 +1,7 @@
 #ifndef DDEBUG_H
 #define DDEBUG_H

+#include <ngx_config.h>
 #include <ngx_core.h>
 #include <ngx_http.h>


supply a lock manager to make libav thread safe

--- src/decode.c
+++ src/decode.c
@@ -5,6 +5,7 @@
 #include <libavutil/channel_layout.h>

 #include <SDL/SDL.h>
+#include <SDL/SDL_thread.h>

 static double dB_scale;

@@ -16,8 +17,30 @@
     avformat_network_deinit();
 }

+static int my_lockmgr_cb(void **mutex, enum AVLockOp op) {
+    if (mutex == NULL)
+        return -1;
+    switch (op) {
+        case AV_LOCK_CREATE:
+            *mutex = SDL_CreateMutex();
+            break;
+        case AV_LOCK_OBTAIN:
+            SDL_LockMutex(*mutex);
+            break;
+        case AV_LOCK_RELEASE:
+            SDL_UnlockMutex(*mutex);
+            break;
+        case AV_LOCK_DESTROY:
+            SDL_DestroyMutex(*mutex);
+            break;
+    }
+    return 0;
+}
+
 int groove_init() {
     dB_scale = log(10.0) * 0.05;
+
+    av_lockmgr_register(&my_lockmgr_cb);

     srand(time(NULL));


device: only increase the ref_count when device is truly opened

--- src/device.c
+++ src/device.c
@@ -239,11 +239,6 @@
         return -RT_EBUSY;
     }

-    dev->ref_count++;
-    /* don't let bad things happen silently. If you are bitten by this assert,
-     * please set the ref_count to a bigger type. */
-    RT_ASSERT(dev->ref_count != 0);
-
     /* call device open interface */
     if (dev->open != RT_NULL)
     {
@@ -252,7 +247,14 @@

     /* set open flag */
     if (result == RT_EOK || result == -RT_ENOSYS)
+    {
         dev->open_flag = oflag | RT_DEVICE_OFLAG_OPEN;
+
+        dev->ref_count++;
+        /* don't let bad things happen silently. If you are bitten by this assert,
+         * please set the ref_count to a bigger type. */
+        RT_ASSERT(dev->ref_count != 0);
+    }

     return result;
 }


Manage GAttrib refs based on registered callbacks

Connection should not be dropped if there is at least one ATT connection
callback registered. After discovering primary services over the LE link,
GAttrib ref needs to be held to allow notifying an active connection
while registering connection callbacks(inside plugins probing).

--- src/device.c
+++ src/device.c
@@ -96,6 +96,7 @@
 	DBusConnection *conn;
 	DBusMessage *msg;
 	GIOChannel *io;
+	GAttrib *attrib;
 	struct btd_device *device;
 	GSList *match_uuids;
 	GSList *profiles_added;
@@ -163,6 +164,8 @@
 {
 	if (req->listener_id)
 		g_dbus_remove_watch(req->conn, req->listener_id);
+	if (req->attrib)
+		g_attrib_unref(req->attrib);
 	if (req->io) {
 		if (shutdown)
 			g_io_channel_shutdown(req->io, FALSE, NULL);
@@ -1642,8 +1645,20 @@
 		uuids = g_slist_append(uuids, prim->uuid);
 	}

+	/*
+	 * Profiles may register attio callbacks in the probing callback.
+	 * GAttrib reference can be released if the registered callbacks
+	 * list is emtpy.
+	 */
+	device->attrib = g_attrib_ref(req->attrib);
+
 	device_register_services(req->conn, device, g_slist_copy(services), -1);
 	device_probe_drivers(device, uuids);
+
+	if (device->attios == NULL) {
+		g_attrib_unref(device->attrib);
+		device->attrib = NULL;
+	}

 	g_slist_free(uuids);

@@ -1683,16 +1698,16 @@
 		device->attioid = 0;
 	}

-	device->attrib = g_attrib_new(io);
-	g_attrib_set_destroy_function(device->attrib, attrib_destroyed, device);
-
-	if (req)
-		gatt_discover_primary(device->attrib, NULL, primary_cb, req);
-	else if (device->attios)
+	if (req) {
+		req->attrib = g_attrib_new(io);
+		gatt_discover_primary(req->attrib, NULL, primary_cb, req);
+	} else if (device->attios) {
+		device->attrib = g_attrib_new(io);
+		g_attrib_set_destroy_function(device->attrib, attrib_destroyed,
+								device);
 		g_slist_foreach(device->attios, attio_connected,
 							device->attrib);
-
-	g_io_channel_unref(io);
+	}
 }

 static gboolean att_auto_connect(gpointer user_data)
@@ -1732,6 +1747,8 @@
 		g_error_free(gerr);
 		return TRUE;
 	}
+
+	g_io_channel_unref(io);

 	return TRUE;
 }
@@ -2566,18 +2583,17 @@
 	attio->dcfunc = dcfunc;
 	attio->user_data = user_data;

-	device->attios = g_slist_append(device->attios, attio);
-
 	if (device->attrib && cfunc)
 		cfunc(device->attrib, user_data);
-
-	if (device->attioid == 0 && device->attrib == NULL) {
+	else if (device->attioid == 0) {
 		att_auto_connect(device);
 		device->attioid = g_timeout_add_seconds(AUTOCONNECT_INTERVAL,
 							att_auto_connect,
 							device);
 	}

+	device->attios = g_slist_append(device->attios, attio);
+
 	return attio->id;
 }


core: Connect ATT IO before pairing

core: Connect ATT IO before pairing

Due to kernel-side issues we might miss ATT commands which arrive during
the SMP procedure. Therefore, connect ATT first and only then attempt to
pair.

--- src/device.c
+++ src/device.c
@@ -1411,8 +1411,12 @@
 	device->bonding = bonding;
 	bonding->device = device;

-	err = adapter_create_bonding(adapter, &device->bdaddr,
-					device->bdaddr_type, io_cap);
+	if (device_is_le(device) && !device_is_connected(device))
+		err = device_connect_le(device);
+	else
+		err = adapter_create_bonding(adapter, &device->bdaddr,
+						device->bdaddr_type, io_cap);
+
 	if (err < 0)
 		return btd_error_failed(msg, strerror(-err));


clean up target and device maps

clean up target and device maps

--- src/dflash.c
+++ src/dflash.c
@@ -235,15 +235,42 @@
 	}
 }

-static void target_clean(int tgt)
-{
-	struct dflash_file *f, *tmp;
+static void device_clean(struct lnvm_device *dev)
+{
+	HASH_DEL(devt, dev);
+	free(dev);
+}
+
+static void target_clean(struct lnvm_target *tgt)
+{
+	struct lnvm_device *dev = tgt->dev;
+
+	HASH_DEL(tgtt, tgt);
+	if (atomic_dec_and_test(&dev->ref_cnt))
+		device_clean(dev);
+	free(tgt);
+}
+
+static void target_ins_clean(int tgt)
+{
+	struct dflash_file *f, *f_tmp;
+	struct lnvm_target *t;
+	struct lnvm_target_map *tm;

 	/* Assume only one target and that all files belong to that target*/
-	HASH_ITER(hh, dfilet, f, tmp) {
+	HASH_ITER(hh, dfilet, f, f_tmp) {
 		clean_file_fd(f->gid);
 		HASH_DEL(dfilet, f);
 		file_free(f);
+	}
+
+	HASH_FIND_INT(tgtmt, &tgt, tm);
+	if (tm) {
+		t = tm->tgt;
+		if (atomic_dec_and_test(&t->ref_cnt))
+			target_clean(t);
+		HASH_DEL(tgtmt, tm);
+		free(tm);
 	}

 	assert(HASH_COUNT(fdt) == 0);
@@ -398,7 +425,7 @@
 void nvm_target_close(int tgt)
 {
 	close(tgt);
-	target_clean(tgt);
+	target_ins_clean(tgt);
 }

 int nvm_file_create(int tgt, uint32_t stream_id, int flags)


Camel: Fix use after free error

Camel: Fix use after free error

--- src/plugins/camel/camel.c
+++ src/plugins/camel/camel.c
@@ -414,29 +414,29 @@
 	return parser;
 }

+static parserType * saveText (parserType * const parser, char ** location);
+
 /**
  * @brief Read a double quoted value that starts and ends with optional whitespace characters
  *
+ * - The content of the double quoted value will be stored at the address specified via the variable `location`.
  * - If there was an error, then the status of the given parser structure will be updated accordingly.
- * - If the value was read successfully, then the start (position right after the first `"`) and end (position right before the ending
- *   `"`) of the double quoted content will be saved in the variables `parser->match` and `parser->end`.
- *
- * @pre The variables `parser` and `parser->file` must not be `NULL`
- *
- * @param parser Saves the parsing information this function operates on
- *
- * @retval An updated version of the variable `parser`
- */
-static parserType * doubleQuotedSpace (parserType * const parser)
+ *
+ * @pre The variables `parser` and `parser->file` must not be `NULL`
+ *
+ * @param parser Saves the parsing information this function operates on
+ *
+ * @retval An updated version of the variable `parser`
+ */
+static parserType * doubleQuotedSpace (parserType * const parser, char ** location)
 {
 	ELEKTRA_NOT_NULL (parser);
 	ELEKTRA_NOT_NULL (parser->file);

 	RET_NOK (whitespace (parser));
 	RET_NOK (doubleQuoted (parser));
-	char * text = parser->match;
+	RET_NOK (saveText (parser, location));
 	RET_NOK (whitespace (parser));
-	parser->match = text;

 	return parser;
 }
@@ -488,8 +488,7 @@
 	ELEKTRA_NOT_NULL (parser);
 	ELEKTRA_NOT_NULL (parser->file);

-	RET_NOK (doubleQuotedSpace (parser));
-	return saveText (parser, &parser->key);
+	return doubleQuotedSpace (parser, &parser->key);
 }

 /**
@@ -508,8 +507,7 @@
 	ELEKTRA_NOT_NULL (parser);
 	ELEKTRA_NOT_NULL (parser->file);

-	RET_NOK (doubleQuotedSpace (parser));
-	return saveText (parser, &parser->value);
+	return doubleQuotedSpace (parser, &parser->value);
 }

 /**


Added rewinddir() (untested)

Added rewinddir() (untested)

--- src/dirent.c
+++ src/dirent.c
@@ -1,18 +1,17 @@
 /* $Id$ */
-/* Copyright (c) 2007 Pierre Pronchery <khorben@defora.org> */
+/* Copyright (c) 2008 Pierre Pronchery <khorben@defora.org> */
 /* This file is part of DeforaOS System libc */
-/* libc is not free software; you can redistribute it and/or modify it under
- * the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 3.0
- * Unported as published by the Creative Commons organization.
+/* This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
  *
- * libc is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE.  See the Creative Commons Attribution-NonCommercial-
- * ShareAlike 3.0 Unported license for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * You should have received a copy of the Creative Commons Attribution-
- * NonCommercial-ShareAlike 3.0 along with libc; if not, browse to
- * http://creativecommons.org/licenses/by-nc-sa/3.0/ */
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>. */

@@ -131,3 +130,16 @@
 	return NULL;
 }
 #endif
+
+
+/* rewinddir */
+void rewinddir(DIR * dir)
+{
+	if(lseek(dir->fd, 0, SEEK_SET) != 0)
+	{
+		close(dir->fd);
+		dir->fd = -1;
+		dir->len = 0;
+	}
+	dir->len = 0;
+}


NSEC handling complete

NSEC handling complete

--- src/dnssec.c
+++ src/dnssec.c
@@ -513,8 +513,7 @@
 		return 1;

 	/* This is a valid wildcard expansion.  Calculate and return the
-	 * "Next closer" name, because we need another NSEC to cover it
-	 * for wildcards to hold...xi
+	 * "Next closer" name, because we need another NSEC to cover it.
 	 * (except for rrsigs for NSECs, but those are dealt with later)
 	 */
 	to_skip = _dname_label_count(rrset->name)
@@ -721,12 +720,12 @@

 static int nsec_bitmap_excludes_rrtype(getdns_rrset *nsec_rrset, uint16_t rr_type)
 {
-	rrtype_iter nsec_space, *nsec_rr;
+	rrtype_iter nsec_spc, *nsec_rr;
 	priv_getdns_rdf_iter bitmap_spc, *bitmap;

 	return (nsec_rrset->rr_type == GETDNS_RRTYPE_NSEC ||
 	        nsec_rrset->rr_type == GETDNS_RRTYPE_NSEC3 )
-	    && (nsec_rr = rrtype_iter_init(&nsec_space, nsec_rrset))
+	    && (nsec_rr = rrtype_iter_init(&nsec_spc, nsec_rrset))
 	    && (bitmap = priv_getdns_rdf_iter_init_at(&bitmap_spc, &nsec_rr->rr_i,
 			nsec_rrset->rr_type == GETDNS_RRTYPE_NSEC ? 1: 5))
 	    && !bitmap_has_type(bitmap, rr_type);
@@ -734,12 +733,12 @@

 static int nsec_bitmap_includes_rrtype(getdns_rrset *nsec_rrset, uint16_t rr_type)
 {
-	rrtype_iter nsec_space, *nsec_rr;
+	rrtype_iter nsec_spc, *nsec_rr;
 	priv_getdns_rdf_iter bitmap_spc, *bitmap;

 	return (nsec_rrset->rr_type == GETDNS_RRTYPE_NSEC ||
 	        nsec_rrset->rr_type == GETDNS_RRTYPE_NSEC3 )
-	    && (nsec_rr = rrtype_iter_init(&nsec_space, nsec_rrset))
+	    && (nsec_rr = rrtype_iter_init(&nsec_spc, nsec_rrset))
 	    && (bitmap = priv_getdns_rdf_iter_init_at(&bitmap_spc, &nsec_rr->rr_i,
 			nsec_rrset->rr_type == GETDNS_RRTYPE_NSEC ? 1: 5))
 	    && bitmap_has_type(bitmap, rr_type);
@@ -823,7 +822,8 @@
 	int nsec_cmp;
 	uint8_t *common1, *common2;

-	if (   !(rr = rrtype_iter_init(&rr_spc, nsec))
+	if (/* Get owner and next, nicely decompressed */
+	       !(rr = rrtype_iter_init(&rr_spc, nsec))
 	    || !(rdf = priv_getdns_rdf_iter_init(&rdf_spc, &rr->rr_i))
 	    || !(owner = priv_getdns_owner_if_or_as_decompressed(
 			    &rr->rr_i, owner_spc, &owner_len))
@@ -845,16 +845,24 @@

 	nsec_cmp = dname_compare(owner, next);
 	if (nsec_cmp < 0) {
-		DEBUG_SEC("nsec owner < next\n");
+		/* Regular NSEC */
 		return dname_compare(name, owner) >= 0
 		    && dname_compare(name, next)  <  0;
+
 	} else if (nsec_cmp > 0) {
-		/* The wrap around nsec */
-		DEBUG_SEC("nsec owner > next\n");
-		return dname_compare(name, owner) >= 0;
+		/* The wrap around nsec.  So NSEC->nxt == zone.name.
+		 * qname must be a subdomain of that.
+		 */
+		return dname_compare(name, owner) >= 0
+		    && is_subdomain(next, name) && dname_compare(next, name);
+
 	} else {
-		DEBUG_SEC("nsec owner == next\n");
-		return 1;
+		/* This nsec is the only nsec.
+		 * zone.name NSEC zone.name, disproves everything else,
+		 * but only for subdomains of that zone.
+		 * (also no zone.name == qname of course)
+		 */
+		return is_subdomain(owner, name) && dname_compare(owner, name);
 	}
 }

@@ -979,6 +987,8 @@
 {
 	rrset_iter i_spc, *i;
 	getdns_rrset *n;
+	rrtype_iter nsec_spc, *nsec_rr;
+	priv_getdns_rdf_iter bitmap_spc, *bitmap;
 	int keytag;

 	if (opt_out)
@@ -998,6 +1008,38 @@
 		}
 		if ((n = rrset_iter_value(i))->rr_type == GETDNS_RRTYPE_NSEC
 		    && nsec_covers_name(n, name, NULL)
+
+		    /* Get the bitmap rdata field */
+		    && (nsec_rr = rrtype_iter_init(&nsec_spc, n))
+		    && (bitmap = priv_getdns_rdf_iter_init_at(
+				    &bitmap_spc, &nsec_rr->rr_i, 1))
+
+		    /* NSEC should cover, but not match name...
+		     * Unless it is wildcard match, but then we have to check
+		     * that rrset->rr_type is not enlisted, because otherwise
+		     * it should have matched the wildcard.
+		     *
+		     * Also no CNAME... cause that should have matched too.
+		     */
+		    && (    !priv_getdns_dname_equal(n->name, name)
+		        || (   name[0] == 1 && name[1] == (uint8_t)'*'
+		            && !bitmap_has_type(bitmap, rrset->rr_type)
+		            && !bitmap_has_type(bitmap, GETDNS_RRTYPE_CNAME)
+		           )
+		       )
+
+		    /* When qname is a subdomain of the NSEC owner, make
+		     * sure there is no DNAME, and no delegation point
+		     * there.
+		     */
+		    && (   !is_subdomain(n->name, name)
+		        || (   !bitmap_has_type(bitmap, GETDNS_RRTYPE_DNAME)
+		            && (   !bitmap_has_type(bitmap, GETDNS_RRTYPE_NS)
+		                ||  bitmap_has_type(bitmap, GETDNS_RRTYPE_SOA)
+		               )
+		           )
+		       )
+
 		    && (keytag = a_key_signed_rrset(dnskey, n))) {

 			debug_sec_print_rrset("NSEC:   ", n);
@@ -1045,7 +1087,7 @@
 static int key_proves_nonexistance(getdns_rrset *keyset, getdns_rrset *rrset)
 {
 	getdns_rrset nsec_rrset, *cover, *ce;
-	rrtype_iter nsec_space, *nsec_rr;
+	rrtype_iter nsec_spc, *nsec_rr;
 	priv_getdns_rdf_iter bitmap_spc, *bitmap;
 	rrset_iter i_spc, *i;
 	uint8_t *ce_name, *nc_name;
@@ -1063,7 +1105,7 @@
 	nsec_rrset.rr_type = GETDNS_RRTYPE_NSEC;

 	if (/* A NSEC RR exists at the owner name of rrset */
-	      (nsec_rr = rrtype_iter_init(&nsec_space, &nsec_rrset))
+	      (nsec_rr = rrtype_iter_init(&nsec_spc, &nsec_rrset))

 	    /* Get the bitmap rdata field */
 	    && (bitmap = priv_getdns_rdf_iter_init_at(
@@ -1098,6 +1140,21 @@
 		debug_sec_print_rrset("NSEC NODATA proof for: ", rrset);
 		return keytag;
 	}
+	/* More NSEC NODATA cases
+	 * ======================
+	 * There are a few NSEC NODATA cases where qname doesn't match
+	 * NSEC->name:
+	 *
+	 * - An empty non terminal (ENT) will result in a NSEC covering the
+	 *   qname, where qname > NSEC->name and ce(qname) is a subdomain
+	 *   of NXT.  This case is handled below after the covering NSEC is
+	 *   found.
+	 *
+	 * - Or a wildcard match without the type.  The wildcard owner name
+	 *   match has special handing in the find_nsec_covering_name function.
+	 *   We still expect a NSEC covering the name though.  For names with
+	 *   label < '*' there will thus be two NSECs.  (is this true?)
+	 */

 	/* The NSEC Name error case
 	 * ========================
@@ -1107,20 +1164,18 @@
 	    ; i ; i = rrset_iter_next(i)) {

 		cover = rrset_iter_value(i);
-		/* Now let's find out if cover is indeed the NSEC covering
-		 * rrset's owner name.
-		 */
-		if (/* Is it an NSEC rrset? */
+
+		if (/* Is cover an NSEC rrset? */
 		       cover->rr_type != GETDNS_RRTYPE_NSEC

 		    /* Does it cover the name */
 		    || !nsec_covers_name(cover, rrset->name, &ce_name)

-		    /* But not a match */
+		    /* But not a match (because that would be NODATA case) */
 		    || priv_getdns_dname_equal(cover->name, rrset->name)

 		    /* Get the bitmap rdata field */
-		    || !(nsec_rr = rrtype_iter_init(&nsec_space, cover))
+		    || !(nsec_rr = rrtype_iter_init(&nsec_spc, cover))
 		    || !(bitmap = priv_getdns_rdf_iter_init_at(
 				    &bitmap_spc, &nsec_rr->rr_i, 1))

@@ -1137,8 +1192,25 @@
 		       )

 		    /* And a valid signature please (as always) */
-		    || !a_key_signed_rrset(keyset, cover))
+		    || !(keytag = a_key_signed_rrset(keyset, cover)))
 			continue;
+
+		/* We could have found a NSEC covering an Empty Non Terminal.
+		 * In that case no NSEC covering the wildcard is needed.
+		 * Because it was actually a NODATA proof.
+		 *
+		 * Empty NON terminals can be identified, by
+		 * qname > NSEC->name && NSEC->nxt is subdomain of qname.
+		 *
+		 * nsec_covers_name() will set ce_name to qname when NSEC->nxt
+		 * is a subdomain of qname.
+		 */
+		if (   dname_compare(rrset->name, cover->name) > 0
+		    && dname_compare(rrset->name, ce_name) == 0) {
+
+			debug_sec_print_dname("Empty Non Terminal: ", ce_name);
+			return keytag;
+		}

 		debug_sec_print_dname("Closest Encloser: ", ce_name);
 		memcpy(wc_name + 2, ce_name, _dname_len(ce_name));


void Tagging_Screen();

void Tagging_Screen();

--- Tagging/Main.h
+++ Tagging/Main.h
@@ -9,4 +9,7 @@
 void FileScan();

 //Process initial screen
-void Initial_Screen();+void Initial_Screen();
+
+//Process tagging screen
+void Tagging_Screen();


simplify the pipe parser

simplify the pipe parser

--- src/dollar.c
+++ src/dollar.c
@@ -91,18 +91,9 @@
 static fabr_tree *_nopi(fabr_input *i) { return fabr_rex("s", i, "[^|]+"); }
 static fabr_tree *_pi(fabr_input *i) { return fabr_rex("p", i, "\\|\\|?"); }

-static fabr_tree *_pi_nopi(fabr_input *i)
-{
-  return fabr_seq(NULL, i, _pi, _nopi, NULL);
-}
-static fabr_tree *_pi_nopi_star(fabr_input *i)
-{
-  return fabr_rep(NULL, i, _pi_nopi, 0, 0);
-}
-
 static fabr_tree *_pipe_parser(fabr_input *i)
 {
-  return fabr_seq(NULL, i, _nopi, _pi_nopi_star, NULL);
+  return fabr_jseq(NULL, i, _nopi, _pi);
 }

@@ -328,7 +319,7 @@
   if (strchr(s, '$') == NULL) return strdup(s);

   fabr_tree *t = fabr_parse_all(s, _parser);
-  fabr_puts_tree(t, s, 1);
+  //fabr_puts_tree(t, s, 1);
   char *r = expand(s, t->child, quote, data, func);
   fabr_tree_free(t);


ikev2: use remote proposals when installing tunnel

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

--- src/plugins/ikev2/ikev2.c
+++ src/plugins/ikev2/ikev2.c
@@ -1723,7 +1723,7 @@
     {
       ip46_address_set_ip4 (&a.local_ip, &sa->iaddr);
       ip46_address_set_ip4 (&a.remote_ip, &sa->raddr);
-      proposals = child->i_proposals;
+      proposals = child->r_proposals;
       a.local_spi = child->r_proposals[0].spi;
       a.remote_spi = child->i_proposals[0].spi;
     }
@@ -1731,7 +1731,7 @@
     {
       ip46_address_set_ip4 (&a.local_ip, &sa->raddr);
       ip46_address_set_ip4 (&a.remote_ip, &sa->iaddr);
-      proposals = child->r_proposals;
+      proposals = child->i_proposals;
       a.local_spi = child->i_proposals[0].spi;
       a.remote_spi = child->r_proposals[0].spi;
     }


Fix gtk source buffer segfault

Fix gtk source buffer segfault

--- src/editor.c
+++ src/editor.c
@@ -353,13 +353,11 @@

 void editor_fill_buffer(GuEditor* ec, const gchar* text)
 {
-  gtk_text_buffer_begin_user_action(ec_buffer);
   gtk_source_buffer_begin_not_undoable_action(ec->buffer);
   gtk_widget_set_sensitive(GTK_WIDGET(ec->view), FALSE);
   gtk_text_buffer_set_text(ec_buffer, text, strlen(text));
   gtk_widget_set_sensitive(GTK_WIDGET(ec->view), TRUE);
   gtk_source_buffer_end_not_undoable_action(ec->buffer);
-  gtk_text_buffer_end_user_action(ec_buffer);

   /* place cursor in the beggining of the document */
   GtkTextIter start;
@@ -479,12 +477,12 @@
       /* the text contains a partially styled text, remove it and apply
        * style to the whole text */
       outtext = g_strdup_printf("%s%s%s%s%s",
-                                style[selected][1], result[1], result[2], result[3],
-                                style[selected][2]);
+          style[selected][1], result[1], result[2], result[3],
+          style[selected][2]);
     }
   } else { /* no previous style applied */
     outtext = g_strdup_printf("%s%s%s",
-                              style[selected][1], selected_text, style[selected][2]);
+        style[selected][1], selected_text, style[selected][2]);
   }

   gtk_text_buffer_begin_user_action(ec_buffer);


FEATURE(1078): Implement browse method in samba xform

--- src/plugins/samba/samba.c
+++ src/plugins/samba/samba.c
@@ -52,6 +52,7 @@
                                xmms_xform_seek_mode_t whence,
                                xmms_error_t *error);
 static gboolean xmms_samba_plugin_setup (xmms_xform_plugin_t *xform_plugin);
+static GList *xmms_samba_browse (xmms_xform_t *xform, const gchar *url, xmms_error_t *error);

 /*
  * Plugin header
@@ -60,10 +61,19 @@
                   "Access SMB/CIFS fileshares over a network",
                   xmms_samba_plugin_setup);

+static void
+xmms_samba_auth_fn (const gchar *server, const gchar *share,
+                    gchar *workgroup, gint wgmaxlen, gchar *username,
+                    gint unmaxlen, gchar *password, gint pwmaxlen)
+{
+	return;
+}
+
 static gboolean
 xmms_samba_plugin_setup (xmms_xform_plugin_t *xform_plugin)
 {
 	xmms_xform_methods_t methods;
+	gint err;

 	XMMS_XFORM_METHODS_INIT (methods);

@@ -71,6 +81,7 @@
 	methods.destroy = xmms_samba_destroy;
 	methods.read = xmms_samba_read;
 	methods.seek = xmms_samba_seek;
+	methods.browse = xmms_samba_browse;

 	xmms_xform_plugin_methods_set (xform_plugin, &methods);

@@ -78,6 +89,12 @@
 	                              "application/x-url", XMMS_STREAM_TYPE_URL,
 	                              "smb://*", XMMS_STREAM_TYPE_END);

+	err = smbc_init (xmms_samba_auth_fn, 0);
+	if (err < 0) {
+		xmms_log_error ("%s", strerror (errno));
+		return FALSE;
+	}
+
 	return TRUE;
 }

@@ -85,15 +102,6 @@
 /*
  * Member functions
  */
-static void
-xmms_samba_auth_fn (const gchar *server, const gchar *share,
-                    gchar *workgroup, gint wgmaxlen, gchar *username,
-                    gint unmaxlen, gchar *password, gint pwmaxlen)
-{
-	return;
-}
-
-
 static gboolean
 xmms_samba_init (xmms_xform_t *xform)
 {
@@ -106,12 +114,6 @@

 	url = xmms_xform_indata_get_str (xform, XMMS_STREAM_TYPE_URL);
 	g_return_val_if_fail (url, FALSE);
-
-	err = smbc_init (xmms_samba_auth_fn, 0);
-	if (err < 0) {
-		xmms_log_error ("%s", strerror (errno));
-		return FALSE;
-	}

 	err = smbc_stat (url, &st);
 	if (err < 0) {
@@ -226,3 +228,35 @@

 	return res;
 }
+
+static GList *
+xmms_samba_browse (xmms_xform_t *xform,
+                   const gchar *url,
+                   xmms_error_t *error)
+{
+	GList *ret = NULL;
+	int handle;
+	struct smbc_dirent *dir;
+
+	handle = smbc_opendir (url);
+	if (handle < 0) {
+		xmms_error_set (error, XMMS_ERROR_GENERIC, "Couldn't browse URL");
+		xmms_log_error ("Couldn't open directory %s!", url);
+		return NULL;
+	}
+
+	while ((dir = smbc_readdir (handle))) {
+		gboolean is_dir = dir->smbc_type == SMBC_DIR ||
+		                  dir->smbc_type == SMBC_WORKGROUP ||
+		                  dir->smbc_type == SMBC_SERVER ||
+		                  dir->smbc_type == SMBC_FILE_SHARE;
+		gchar *t2 = xmms_medialib_url_encode (dir->name);
+		XMMS_DBG ("%s", t2);
+		ret = xmms_xform_browse_add_entry (ret, t2, is_dir, NULL);
+		g_free (t2);
+	}
+
+	smbc_closedir (handle);
+
+	return ret;
+}


Added quick and dirty signing support.

Added quick and dirty signing support.

--- src/engine.c
+++ src/engine.c
@@ -18,6 +18,31 @@
 	TD_PASS_MAX = 32
 };

+typedef int (*td_sign_fn)(const char *filename, char digest_out[16]);
+
+typedef struct td_signer_tag
+{
+	int is_lua;
+	union {
+		td_sign_fn function;
+		int lua_reference;
+	} function;
+}
+td_signer;
+
+int td_sign_timestamp(const char *filename, char digest_out[16])
+{
+	return 1;
+}
+
+int td_sign_digest(const char *filename, char digest_out[16])
+{
+	return 1;
+}
+
+static td_signer sign_timestamp = { 0, { td_sign_timestamp } };
+static td_signer sign_digest = { 0, { td_sign_digest } };
+
 static unsigned long
 djb2_hash(const char *str_)
 {
@@ -46,7 +71,7 @@
 {
 	const char *filename;
 	td_node *producer;
-	int (*sign_fn)(const char *filename);
+	td_signer *signer;
 	char signature[16];
 	struct td_file_tag *bucket_next;
 };
@@ -92,6 +117,10 @@
 	/* build passes */
 	int pass_count;
 	td_pass passes[TD_PASS_MAX];
+
+	td_signer *default_signer;
+
+	lua_State *L;
 };

 void* td_engine_alloc(td_engine *engine, size_t size)
@@ -159,6 +188,7 @@

 	f->filename = td_engine_strdup(engine, path, strlen(path));
 	f->bucket_next = engine->file_hash[slot];
+	f->signer = engine->default_signer;
 	engine->file_hash[slot] = f;
 	return f;
 }
@@ -187,6 +217,7 @@
 	lua_setmetatable(L, -2);

 	self->file_hash_size = 92413;
+	self->L = L;

 	/* apply optional overrides */
 	if (lua_gettop(L) == 1 && lua_istable(L, 1))
@@ -195,6 +226,7 @@
 	}

 	self->file_hash = (td_file **) calloc(sizeof(td_file*), self->file_hash_size);
+	self->default_signer = &sign_digest;

 	return 1;
 }
@@ -487,6 +519,57 @@
 	return result;
 }

+static void
+setup_file_signers(lua_State *L, td_engine *engine, td_node *node)
+{
+	lua_getfield(L, 2, "signers");
+	if (lua_isnil(L, -1))
+		goto leave;
+
+	lua_pushnil(L);
+	while (lua_next(L, -2))
+	{
+		if (!lua_isstring(L, -2))
+			luaL_error(L, "file signer keys must be strings");
+
+		const char *filename = lua_tostring(L, -2);
+		td_signer *signer;
+		td_file *file;
+
+		if (lua_isstring(L, -1))
+		{
+			const char* builtin_name = lua_tostring(L, -1);
+			if (0 == strcmp("digest", builtin_name))
+				signer = &sign_digest;
+			else if (0 == strcmp("timestamp", builtin_name))
+				signer = &sign_timestamp;
+			else
+				luaL_error(L, "%s: unsupported builtin sign function", builtin_name);
+
+			lua_pop(L, 1);
+		}
+		else if(lua_isfunction(L, -1))
+		{
+			/* save the lua closure in the registry so we can call it later */
+			signer = td_engine_alloc(engine, sizeof(td_signer));
+			signer->is_lua = 1;
+			signer->function.lua_reference = luaL_ref(L, -1); /* pops the value */
+		}
+		else
+			luaL_error(L, "signers must be either builtins (strings) or functions");
+
+		file = td_engine_get_file(engine, filename);
+
+		if (file->producer != node)
+			luaL_error(L, "%s isn't produced by this node; can't sign it", filename);
+
+		file->signer = signer;
+	}
+
+leave:
+	lua_pop(L, 1);
+}
+
 static int
 make_node(lua_State* L)
 {
@@ -513,6 +596,8 @@
 	lua_pop(L, 1);

 	node->deps = setup_deps(L, self, node, &node->dep_count);
+
+	setup_file_signers(L, self, node);

 	luaL_getmetatable(L, TUNDRA_NODE_MTNAME);
 	lua_setmetatable(L, -2);


src/pmdumplog/pmdumplog.c: fix compilation warning on some platforms

--- src/pmdumplog/pmdumplog.c
+++ src/pmdumplog/pmdumplog.c
@@ -671,6 +671,7 @@
 	    l_hashtype = (__pmHashCtl *)hp->data;
 	    prev_item = NULL;
 	    for (;;) {
+		this_item = NULL;
 		if (type == PM_LABEL_CONTEXT) {
 		    /*
 		     * All context labels have the same identifier within a
@@ -691,7 +692,6 @@
 		     * Search the hash of identifiers looking for the next lowest
 		     * one.
 		     */
-		    this_item = NULL;
 		    for (tix = 0; tix < l_hashtype->hsize; tix++) {
 			for (tp = l_hashtype->hash[tix]; tp != NULL; tp = tp->next) {
 			    ident = (unsigned int)tp->key;


Update entity.c

Update entity.c

--- src/entity.c
+++ src/entity.c
@@ -18,12 +18,3 @@
   if(e->index) glDeleteLists(e->index,1);
   free(e);
 }
-
-void useView(entity e)
-{
-
-}
-void render(entity e)
-{
-
-}


Tighten scope of local variable.

Tighten scope of local variable.

--- meinheld/server/server.c
+++ meinheld/server/server.c
@@ -1215,7 +1215,7 @@
 static void
 accept_callback(picoev_loop* loop, int fd, int events, void* cb_arg)
 {
-    int client_fd, ret, i;
+    int client_fd, ret;
     client_t *client;
     struct sockaddr_in client_addr;
     char *remote_addr;
@@ -1226,7 +1226,7 @@
         // next turn or other process
         return;
     } else if ((events & PICOEV_READ) != 0) {
-
+        int i;
         socklen_t client_len = sizeof(client_addr);
         for (i=0; i<8; ++i) {
 #if linux


iotivity: add name to thread of octimer

iotivity: add name to thread of octimer

Change-Id: I55b6d72ff87129f125a22ea459bb502b1b5b58c3
Signed-off-by: kim jin hong <c441c5eed2984051ccf2775cb93d9180c05155f2@samsung.com>

--- external/iotivity/iotivity_1.3-rel/resource/c_common/octimer/src/octimer.c
+++ external/iotivity/iotivity_1.3-rel/resource/c_common/octimer/src/octimer.c
@@ -266,6 +266,9 @@
         printf("ERROR; return code from pthread_create() is %d\n", res);
         return -1;
     }
+#ifdef __TIZENRT__
+		pthread_setname_np(thread_id, "IoT_Timer");
+#endif

     return 0;
 }


Update the vendor branch with a patch to this file that was
researched by glebius, and incorporated by ISC into the next
version of BIND. Unfortunately, it looks like their release
will come after the release of FreeBSD 6, so we will bring
this in now.

The patch addresses a problem with high-load resolvers which
hit memory barriers. Without this patch, running the resolving
name server out of memory would lead to "unpredictable results."

Of course, the canonical answer to this problem is to put more
memory into the system, however that is not always possible, and
the code should be able to handle this situation gracefully in
any case.

--- contrib/bind9/lib/dns/resolver.c
+++ contrib/bind9/lib/dns/resolver.c
@@ -2665,7 +2665,7 @@
 	    unsigned int options, unsigned int bucketnum, fetchctx_t **fctxp)
 {
 	fetchctx_t *fctx;
-	isc_result_t result = ISC_R_SUCCESS;
+	isc_result_t result;
 	isc_result_t iresult;
 	isc_interval_t interval;
 	dns_fixedname_t qdomain;
@@ -2687,8 +2687,10 @@
 	strcat(buf, "/");	/* checked */
 	strcat(buf, typebuf);	/* checked */
 	fctx->info = isc_mem_strdup(res->mctx, buf);
-	if (fctx->info == NULL)
+	if (fctx->info == NULL) {
+		result = ISC_R_NOMEMORY;
 		goto cleanup_fetch;
+	}
 	FCTXTRACE("create");
 	dns_name_init(&fctx->name, NULL);
 	result = dns_name_dup(name, res->mctx, &fctx->name);


fixed warning about possibly not initialized var

git-svn-id: 67bf12f30ddf2081c31403e0b02b2123541f1680@10487 08b3d480-bf2c-0410-a26f-811ee3361c24

--- src/c-ares/ares_init.c
+++ src/c-ares/ares_init.c
@@ -384,7 +384,7 @@
 static int init_by_resolv_conf(ares_channel channel)
 {
   char *line = NULL;
-  int status, nservers = 0, nsort = 0;
+  int status = 0, nservers = 0, nsort = 0;
   struct server_state *servers = NULL;
   struct apattern *sortlist = NULL;


fixed NFIObject.h

fixed NFIObject.h

--- NFComm/NFCore/NFIObject.h
+++ NFComm/NFCore/NFIObject.h
@@ -66,7 +66,7 @@
     template <typename T>
     NF_SHARE_PTR<T> AddComponent(const std::string& strComponentName)
     {
-        NFIComponent* pComponent = FindComponent(strComponentName);
+		NF_SHARE_PTR<T> pComponent = FindComponent(strComponentName);
         if (pComponent)
         {
             NF_SHARE_PTR<T> pNewCOmponent = pComponent->CreateNewInstance<T>();


arm/arm64: add 64bit read/write APIs

arm/arm64: add 64bit read/write APIs

Added sys_read64() and sys_write64() for 64bit operations.

Signed-off-by: Jiafei Pan <9a82dae3c788da2e3e922121e23957d42a7b9dfb@nxp.com>

--- include/arch/arm64/sys_io.h
+++ include/arch/arm64/sys_io.h
@@ -81,6 +81,22 @@
 	__asm__ volatile("str %w0, [%1]" : : "r" (data), "r" (addr));
 }

+static ALWAYS_INLINE uint64_t sys_read64(mem_addr_t addr)
+{
+	uint64_t val;
+
+	__asm__ volatile("ldr %x0, [%1]" : "=r" (val) : "r" (addr));
+
+	__DMB();
+	return val;
+}
+
+static ALWAYS_INLINE void sys_write64(uint64_t data, mem_addr_t addr)
+{
+	__DMB();
+	__asm__ volatile("str %x0, [%1]" : : "r" (data), "r" (addr));
+}
+
 #ifdef __cplusplus
 }
 #endif


[PATCH] lockdep: irqtrace cleanup of include/asm-i386/irqflags.h

Clean up the x86 irqflags.h file:

 - macro => inline function transformation
 - simplifications
 - style fixes

Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>
Signed-off-by: Arjan van de Ven <9043bf4b08f6c93a2cb55d98c3494b123858348f@linux.intel.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- include/asm-i386/irqflags.h
+++ include/asm-i386/irqflags.h
@@ -5,24 +5,95 @@
  *
  * This file gets included from lowlevel asm headers too, to provide
  * wrapped versions of the local_irq_*() APIs, based on the
- * raw_local_irq_*() macros from the lowlevel headers.
+ * raw_local_irq_*() functions from the lowlevel headers.
  */
 #ifndef _ASM_IRQFLAGS_H
 #define _ASM_IRQFLAGS_H

-#define raw_local_save_flags(x)	do { typecheck(unsigned long,x); __asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */); } while (0)
-#define raw_local_irq_restore(x) do { typecheck(unsigned long,x); __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory", "cc"); } while (0)
-#define raw_local_irq_disable()	__asm__ __volatile__("cli": : :"memory")
-#define raw_local_irq_enable()	__asm__ __volatile__("sti": : :"memory")
-/* used in the idle loop; sti takes one instruction cycle to complete */
-#define raw_safe_halt()		__asm__ __volatile__("sti; hlt": : :"memory")
-/* used when interrupts are already enabled or to shutdown the processor */
-#define halt()			__asm__ __volatile__("hlt": : :"memory")
+#ifndef __ASSEMBLY__

-#define raw_irqs_disabled_flags(flags)	(!((flags) & (1<<9)))
+static inline unsigned long __raw_local_save_flags(void)
+{
+	unsigned long flags;

-/* For spinlocks etc */
-#define raw_local_irq_save(x)	__asm__ __volatile__("pushfl ; popl %0 ; cli":"=g" (x): /* no input */ :"memory")
+	__asm__ __volatile__(
+		"pushfl ; popl %0"
+		: "=g" (flags)
+		: /* no input */
+	);
+
+	return flags;
+}
+
+#define raw_local_save_flags(flags) \
+		do { (flags) = __raw_local_save_flags(); } while (0)
+
+static inline void raw_local_irq_restore(unsigned long flags)
+{
+	__asm__ __volatile__(
+		"pushl %0 ; popfl"
+		: /* no output */
+		:"g" (flags)
+		:"memory", "cc"
+	);
+}
+
+static inline void raw_local_irq_disable(void)
+{
+	__asm__ __volatile__("cli" : : : "memory");
+}
+
+static inline void raw_local_irq_enable(void)
+{
+	__asm__ __volatile__("sti" : : : "memory");
+}
+
+/*
+ * Used in the idle loop; sti takes one instruction cycle
+ * to complete:
+ */
+static inline void raw_safe_halt(void)
+{
+	__asm__ __volatile__("sti; hlt" : : : "memory");
+}
+
+/*
+ * Used when interrupts are already enabled or to
+ * shutdown the processor:
+ */
+static inline void halt(void)
+{
+	__asm__ __volatile__("hlt": : :"memory");
+}
+
+static inline int raw_irqs_disabled_flags(unsigned long flags)
+{
+	return !(flags & (1 << 9));
+}
+
+static inline int raw_irqs_disabled(void)
+{
+	unsigned long flags = __raw_local_save_flags();
+
+	return raw_irqs_disabled_flags(flags);
+}
+
+/*
+ * For spinlocks, etc:
+ */
+static inline unsigned long __raw_local_irq_save(void)
+{
+	unsigned long flags = __raw_local_save_flags();
+
+	raw_local_irq_disable();
+
+	return flags;
+}
+
+#define raw_local_irq_save(flags) \
+		do { (flags) = __raw_local_irq_save(); } while (0)
+
+#endif /* __ASSEMBLY__ */

 /*
  * Do the CPU's IRQ-state tracing from assembly code. We call a


[MIPS] Cacheops.h: Fix typo.

[MIPS] Cacheops.h: Fix typo.

Signed-off-by: Ralf Baechle <92f48d309cda194c8eda36aa8f9ae28c488fa208@linux-mips.org>

--- include/asm-mips/cacheops.h
+++ include/asm-mips/cacheops.h
@@ -64,7 +64,7 @@
 #define Page_Invalidate_T	0x16

 /*
- * R1000-specific cacheops
+ * R10000-specific cacheops
  *
  * Cacheops 0x02, 0x06, 0x0a, 0x0c-0x0e, 0x16, 0x1a and 0x1e are unused.
  * Most of the _S cacheops are identical to the R4000SC _SD cacheops.


x86: fix asm-x86/byteorder.h for userspace export

Since asm-x86/byteorder.h is exported to userspace, use __asm__ rather than
asm in its code.

Signed-Off-By: Mike Frysinger <8f3f75c74bd5184edcfa6534cab3c13a00a2f794@gentoo.org>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>
Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>


x86_32: use generic percpu.h

x86_32: use generic percpu.h

x86_32 only provides a special way to obtain the local per cpu area offset
via x86_read_percpu. Otherwise it can fully use the generic handling.

Cc: 0474aee45985f5ae829f53849df476200e876990@suse.de
Signed-off-by: Christoph Lameter <a2610c5c148280bb6730402b12a8276c2f194fbe@sgi.com>
Signed-off-by: Mike Travis <e6cc0fb2b8dad4110ef62e9a33e5a8aa4e0f86d7@sgi.com>
Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>

--- include/asm-x86/percpu_32.h
+++ include/asm-x86/percpu_32.h
@@ -42,26 +42,7 @@
  */
 #ifdef CONFIG_SMP

-/* This is used for other cpus to find our section. */
-extern unsigned long __per_cpu_offset[];
-
-#define per_cpu_offset(x) (__per_cpu_offset[x])
-
-#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
-/* We can use this directly for local CPU (faster). */
-DECLARE_PER_CPU(unsigned long, this_cpu_off);
-
-/* var is in discarded region: offset to particular copy we want */
-#define per_cpu(var, cpu) (*({				\
-	extern int simple_indentifier_##var(void);	\
-	RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]); }))
-
-#define __raw_get_cpu_var(var) (*({					\
-	extern int simple_indentifier_##var(void);			\
-	RELOC_HIDE(&per_cpu__##var, x86_read_percpu(this_cpu_off));	\
-}))
-
-#define __get_cpu_var(var) __raw_get_cpu_var(var)
+#define __my_cpu_offset x86_read_percpu(this_cpu_off)

 /* A macro to avoid #include hell... */
 #define percpu_modcopy(pcpudst, src, size)			\
@@ -74,10 +55,17 @@

 /* fs segment starts at (positive) offset == __per_cpu_offset[cpu] */
 #define __percpu_seg "%%fs:"
+
 #else  /* !SMP */
+
+#define __percpu_seg ""
+
+#endif	/* SMP */
+
 #include <asm-generic/percpu.h>
-#define __percpu_seg ""
-#endif	/* SMP */
+
+/* We can use this directly for local CPU (faster). */
+DECLARE_PER_CPU(unsigned long, this_cpu_off);

 /* For arch-specific code, we can use direct single-insn ops (they
  * don't give an lvalue though). */


Remove unused TileGridInfo

Remove unused TileGridInfo

Chromium no longer uses TileGridInfo as of CL 856853003 and remove this
from skia.

BUG=chromium:447662

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

--- include/core/SkBBHFactory.h
+++ include/core/SkBBHFactory.h
@@ -8,7 +8,6 @@
 #ifndef SkBBHFactory_DEFINED
 #define SkBBHFactory_DEFINED

-#include "SkSize.h"
 #include "SkRect.h"

 class SkBBoxHierarchy;
@@ -29,25 +28,4 @@
     typedef SkBBHFactory INHERITED;
 };

-// TODO(mtklein): delete entirely when Chromium's clean for TileGridInfo
-class SK_API SkTileGridFactory {
-public:
-    struct TileGridInfo {
-        /** Tile placement interval */
-        SkISize  fTileInterval;
-
-        /** Pixel coverage overlap between adjacent tiles */
-        SkISize  fMargin;
-
-        /** Offset added to device-space bounding box positions to convert
-          * them to tile-grid space. This can be used to adjust the "phase"
-          * of the tile grid to match probable query rectangles that will be
-          * used to search into the tile grid. As long as the offset is smaller
-          * or equal to the margin, there is no need to extend the domain of
-          * the tile grid to prevent data loss.
-          */
-        SkIPoint fOffset;
-    };
-};
-
 #endif


removed const qualifier from GetCorner, now compiles again

git-svn-id: 28d9401aa571d5108e51b194aae6f24ca5964c06@4427 8cc4aa7f-3514-0410-904f-f2cc9021211c

--- include/csengine/quadtr3d.h
+++ include/csengine/quadtr3d.h
@@ -237,7 +237,7 @@
   const csBox3& GetBoundingBox() const { return bbox;}

   /// Get the root rectangle vertices, array of 4.
-  csVector3* GetCorners() const {return corners;}
+  csVector3* GetCorners() {return corners;}

   /// Make the tree empty again
   void MakeEmpty();


need a 64-bit integral type

need a 64-bit integral type

--- include/generic/curie/int.h
+++ include/generic/curie/int.h
@@ -52,6 +52,9 @@
    the platforms that are of most concern to me, so it should be good enough. */
 typedef unsigned long int_pointer;

+/* this is either 64 bits or we can't get anything that long anyway */
+typedef unsigned long long int_64;
+
 /* an astounishing lot of machines use 32-bit ints ... */
 typedef unsigned int int_32;


No EtM for GOST ciphers in TLS 1.2

No EtM for GOST ciphers in TLS 1.2

Reviewed-by: Paul Dale <ddec78389666b4f7c9b4d110380c848489a3e4aa@openssl.org>
Reviewed-by: Tomas Mraz <2bc6038c3dfca09b2da23c8b6da8ba884dc2dcc2@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17150)

--- ssl/statem/extensions_clnt.c
+++ ssl/statem/extensions_clnt.c
@@ -1695,7 +1695,11 @@
     /* Ignore if inappropriate ciphersuite */
     if (!(s->options & SSL_OP_NO_ENCRYPT_THEN_MAC)
             && s->s3.tmp.new_cipher->algorithm_mac != SSL_AEAD
-            && s->s3.tmp.new_cipher->algorithm_enc != SSL_RC4)
+            && s->s3.tmp.new_cipher->algorithm_enc != SSL_RC4
+            && s->s3.tmp.new_cipher->algorithm_enc != SSL_eGOST2814789CNT
+            && s->s3.tmp.new_cipher->algorithm_enc != SSL_eGOST2814789CNT12
+            && s->s3.tmp.new_cipher->algorithm_enc != SSL_MAGMA
+            && s->s3.tmp.new_cipher->algorithm_enc != SSL_KUZNYECHIK)
         s->ext.use_etm = 1;

     return 1;


Forgot to commit for changes to sprcal3d

git-svn-id: 28d9401aa571d5108e51b194aae6f24ca5964c06@16797 8cc4aa7f-3514-0410-904f-f2cc9021211c

--- include/imesh/spritecal3d.h
+++ include/imesh/spritecal3d.h
@@ -229,6 +229,12 @@
    */
   virtual int  FindMeshName(const char *meshName) = 0;

+  /**
+   * Returns the name of the default material that should go on this mesh.
+   */
+  virtual const char* GetDefaultMaterial( const char* meshName ) = 0;
+
+
   /**
    * Returns the xml name of the morph animation at a certain index in the array.
    */


Fix a memory leak on an error path

Fix a memory leak on an error path

A leak of an SSL_SESSION object can occur when decoding a psk extension on
an error path when using TLSv1.3

Reviewed-by: Richard Levitte <5fb523282dd7956571c80524edc2dccfa0bd8234@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2843)

--- ssl/statem/extensions_srvr.c
+++ ssl/statem/extensions_srvr.c
@@ -796,6 +796,7 @@
     s->session = sess;
     return 1;
 err:
+    SSL_SESSION_free(sess);
     return 0;
 }


Added documentation to the page manager.

--- include/legui/PageManager.h
+++ include/legui/PageManager.h
@@ -25,13 +25,51 @@
             virtual void setBoundingBox(const sf::FloatRect &box);
             virtual void updateSize();

+            /**
+             * @brief Pushes a new page ontop of the stack & makes it active.
+             *
+             * @param container The new page.
+             */
             void push(Container *container);
+            /**
+             * @brief Replaces & deletes the current page.
+             *
+             * @param container The new page.
+             */
             void replaceCurrent(Container *container);
+            /**
+             * @brief Deletes the page under the current one.
+             */
             void popUnder();
+            /**
+             * @brief Deletes the specified page.
+             *
+             * @param page The page ID to be deleted.
+             */
             void pop(std::size_t page);
+            /**
+             * @brief Pops (deletes) the page on the top & makes the page below the new current page.
+             */
             void pop();
+            /**
+             * @brief Returns the current page.
+             *
+             * @return The current page.
+             */
             Container* top();
+            /**
+             * @brief Returns the specified page.
+             *
+             * @param page The page id of the requested page.
+             *
+             * @return The requested page.
+             */
             Container* get(std::size_t page);
+            /**
+             * @brief Gets the current page id (of the page ontop).
+             *
+             * @return The currenz page id.
+             */
             std::size_t getCurrentPageId();
         protected:
             virtual void draw(sf::RenderTarget &target, sf::RenderStates states) const;


Remove #include compiler.h in public header

--- include/libunwind-aarch64.h
+++ include/libunwind-aarch64.h
@@ -34,7 +34,6 @@
 #include <inttypes.h>
 #include <stddef.h>
 #include <ucontext.h>
-#include "compiler.h"

 #ifndef UNW_EMPTY_STRUCT
 # define UNW_EMPTY_STRUCT
@@ -183,6 +182,13 @@
  * however, the __reserved struct is quite large: tune it down to only
  * the necessary used fields.  */

+#ifdef _MSC_VER
+// __attribute__((__aligned__(16))) is a GNUC attribute not recognized by MSVC
+// Since the field alignment doesn't matter for UNW_REMOTE_ONLY,
+// Temproarily define __attribute__(x) to remove it
+#define __attribute__(x)
+#endif
+
 struct unw_sigcontext
   {
 	uint64_t fault_address;
@@ -190,8 +196,12 @@
 	uint64_t sp;
 	uint64_t pc;
 	uint64_t pstate;
-	uint8_t __reserved[(66 * 8)] ALIGNED(16);
+	uint8_t __reserved[(66 * 8)] __attribute__((__aligned__(16)));
 };
+
+#ifdef _MSC_VER
+#undef __attribute__
+#endif

 typedef struct
   {


[media] v4l: Add missing compatibility definitions for bounds rectangles

Compatibility defines for ACTUAL subdev selection rectangles were added and
also the name of the BOUNDS rectangles was changed in the process, which,
alas, went unnoticed until now. Add compatibility definitions for these
rectangles.

Signed-off-by: Sakari Ailus <8d98c2be02a446df653daa2c00496b87f3f016e4@iki.fi>
Acked-by: Laurent Pinchart <3ded2f39a78f0d7044839546f95841842b4d7c96@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <ad86ba2154032c9f55743a190faa2459a9d61d42@redhat.com>

--- include/linux/v4l2-common.h
+++ include/linux/v4l2-common.h
@@ -53,10 +53,10 @@
 /* Backward compatibility target definitions --- to be removed. */
 #define V4L2_SEL_TGT_CROP_ACTIVE	V4L2_SEL_TGT_CROP
 #define V4L2_SEL_TGT_COMPOSE_ACTIVE	V4L2_SEL_TGT_COMPOSE
-#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL \
-	V4L2_SEL_TGT_CROP
-#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL \
-	V4L2_SEL_TGT_COMPOSE
+#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL	V4L2_SEL_TGT_CROP
+#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL V4L2_SEL_TGT_COMPOSE
+#define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS	V4L2_SEL_TGT_CROP_BOUNDS
+#define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS V4L2_SEL_TGT_COMPOSE_BOUNDS

 /* Selection flags */
 #define V4L2_SEL_FLAG_GE		(1 << 0)


Add unique_ptr for X509 ptr in cb::openssl

Change-Id: I5d9e31c44db28330032a0945b0b9cebef358e7b0
Reviewed-on: http://review.couchbase.org/76616
Reviewed-by: Dave Rigby <a09264da4832c7ff1d3bf1608a19f4b870f93750@couchbase.com>
Tested-by: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>

--- include/memcached/openssl.h
+++ include/memcached/openssl.h
@@ -1,6 +1,20 @@
 /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-#ifndef MEMCACHED_OPENSSL_H
-#define MEMCACHED_OPENSSL_H
+/*
+ *     Copyright 2017 Couchbase, Inc.
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ */
+#pragma once

 /*
  * Unfortunately Apple deprecated the use of OpenSSL in (at least) Mavericks
@@ -16,8 +30,21 @@
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
 #endif

+#include <memory>
+
 #include <openssl/ssl.h>
 #include <openssl/bio.h>
 #include <openssl/err.h>

-#endif
+namespace cb {
+namespace openssl {
+struct X509deletor {
+    void operator()(X509* cert) {
+        X509_free(cert);
+    }
+};
+
+using unique_x509_ptr = std::unique_ptr<X509, X509deletor>;
+}
+}
+


instrumenting visit_f

instrumenting visit_f

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

--- include/parrot/pmc_freeze.h
+++ include/parrot/pmc_freeze.h
@@ -14,7 +14,7 @@
 #define      PARROT_PMC_FREEZE_H_GUARD

 struct _visit_info;
-typedef void (*visit_f)(PARROT_INTERP, PMC*, struct _visit_info*);
+typedef void (*visit_f)(PARROT_INTERP, ARGIN_NULLOK(PMC*), ARGIN(struct _visit_info*));

 typedef enum {
     VISIT_FREEZE_NORMAL,


Comment.

Comment.

--- include/restc-cpp/logging.h
+++ include/restc-cpp/logging.h
@@ -25,6 +25,6 @@

 #else
-// No logging
+// The user of the API framework must provide log macros
 #error "No log framework is selected"
 #endif


drm: cleanup modesetting ioctls, one param per line

Since this already confused me once when adding addfb2.1, let's clean up
the header to split params one per line.

Signed-off-by: Rob Clark <915c10c999604870200b6defbe633d857c856ca0@gmail.com>
Reviewed-by: Alex Deucher <08dc22c6156113f2deff178e35e3ed9b24d6af9e@amd.com>
Signed-off-by: Daniel Vetter <c1b6782c4af8f0673da8923a0702a1832e5940f4@ffwll.ch>

--- include/uapi/drm/drm_mode.h
+++ include/uapi/drm/drm_mode.h
@@ -105,8 +105,16 @@

 struct drm_mode_modeinfo {
 	__u32 clock;
-	__u16 hdisplay, hsync_start, hsync_end, htotal, hskew;
-	__u16 vdisplay, vsync_start, vsync_end, vtotal, vscan;
+	__u16 hdisplay;
+	__u16 hsync_start;
+	__u16 hsync_end;
+	__u16 htotal;
+	__u16 hskew;
+	__u16 vdisplay;
+	__u16 vsync_start;
+	__u16 vsync_end;
+	__u16 vtotal;
+	__u16 vscan;

 	__u32 vrefresh;

@@ -124,8 +132,10 @@
 	__u32 count_crtcs;
 	__u32 count_connectors;
 	__u32 count_encoders;
-	__u32 min_width, max_width;
-	__u32 min_height, max_height;
+	__u32 min_width;
+	__u32 max_width;
+	__u32 min_height;
+	__u32 max_height;
 };

 struct drm_mode_crtc {
@@ -135,7 +145,8 @@
 	__u32 crtc_id; /**< Id */
 	__u32 fb_id; /**< Id of framebuffer */

-	__u32 x, y; /**< Position on the frameuffer */
+	__u32 x; /**< x Position on the framebuffer */
+	__u32 y; /**< y Position on the framebuffer */

 	__u32 gamma_size;
 	__u32 mode_valid;
@@ -153,12 +164,16 @@
 	__u32 flags; /* see above flags */

 	/* Signed dest location allows it to be partially off screen */
-	__s32 crtc_x, crtc_y;
-	__u32 crtc_w, crtc_h;
+	__s32 crtc_x;
+	__s32 crtc_y;
+	__u32 crtc_w;
+	__u32 crtc_h;

 	/* Source values are 16.16 fixed point */
-	__u32 src_x, src_y;
-	__u32 src_h, src_w;
+	__u32 src_x;
+	__u32 src_y;
+	__u32 src_h;
+	__u32 src_w;
 };

 struct drm_mode_get_plane {
@@ -244,7 +259,8 @@
 	__u32 connector_type_id;

 	__u32 connection;
-	__u32 mm_width, mm_height; /**< HxW in millimeters */
+	__u32 mm_width;  /**< width in millimeters */
+	__u32 mm_height; /**< height in millimeters */
 	__u32 subpixel;

 	__u32 pad;
@@ -327,7 +343,8 @@

 struct drm_mode_fb_cmd {
 	__u32 fb_id;
-	__u32 width, height;
+	__u32 width;
+	__u32 height;
 	__u32 pitch;
 	__u32 bpp;
 	__u32 depth;
@@ -340,7 +357,8 @@

 struct drm_mode_fb_cmd2 {
 	__u32 fb_id;
-	__u32 width, height;
+	__u32 width;
+	__u32 height;
 	__u32 pixel_format; /* fourcc code from drm_fourcc.h */
 	__u32 flags; /* see above flags */


fbdev: sh_mipi_dsi: Remove the unused sh_mipi_dsi_info lcd_chan field

The field is unused, remove it from the structure.

Signed-off-by: Laurent Pinchart <3ded2f39a78f0d7044839546f95841842b4d7c96@ideasonboard.com>

--- include/video/sh_mipi_dsi.h
+++ include/video/sh_mipi_dsi.h
@@ -25,8 +25,6 @@
 	MIPI_YUV420,
 };

-struct sh_mobile_lcdc_chan_cfg;
-
 #define SH_MIPI_DSI_HSABM	(1 << 0)
 #define SH_MIPI_DSI_HBPBM	(1 << 1)
 #define SH_MIPI_DSI_HFPBM	(1 << 2)
@@ -47,7 +45,6 @@

 struct sh_mipi_dsi_info {
 	enum sh_mipi_dsi_data_fmt	data_format;
-	struct sh_mobile_lcdc_chan_cfg	*lcd_chan;
 	int				channel;
 	int				lane;
 	unsigned long			flags;


include/vorbis/vorbisfile.h : Add comments about a desired change that cannot be made until we're willing to break ABI compatibility.

git-svn-id: 03f0f1727258f1959b7b485b30a676bafdb78148@13630 0101bb08-14d6-0310-b084-bc0e0c8e3800

--- include/vorbis/vorbisfile.h
+++ include/vorbis/vorbisfile.h
@@ -52,6 +52,19 @@
   if(f==NULL)return(-1);
   return fseek(f,off,whence);
 }
+
+/* These structs below (OV_CALLBACKS_DEFAULT etc)are defined here as static
+ * data. That means that every file which includes this header will get its
+ * own copy of these structs whether it uses them or not.
+ *
+ * It would be *much* better to move these the vorbisfile.c, make them
+ * publicly available and then define them here as externs so that
+ * only one copy of them (the one in the library's vorbisfile.c) is ever
+ * created.
+ *
+ * Unfortunately this cannot be done at the moment because doing so would
+ * break the libvorbisfile ABI. A good time to do that would be at some
+ * other time when the ABI is being broken for some other reason. */

 static ov_callbacks OV_CALLBACKS_DEFAULT = {
   (size_t (*)(void *, size_t, size_t, void *))  fread,


Don't duplicate nodes that straddle across 2 or 3 branches

Previously, insertStem() inserted an element into every branch
that it intersected with, unless it intersected all four branches.
This commit causes insertStem() to instead force the element into
a root node if it intersects more than one child.

--- include/zekku/BoxQuadTree.h
+++ include/zekku/BoxQuadTree.h
@@ -206,7 +206,7 @@
       // but rounding errors can result in p intersecting with box
       // but not with any of its subboxes.
       // Intersects every quadrant?
-      if (i0 && i1 && i2 && i3) {
+      if (i0 + i1 + i2 + i3 >= 2) {
         return insert(t, ti, p, root, box, true);
       }
       // Otherwise...


update comment

update comment

--- YYCategories/Quartz/YYCGUtilities.h
+++ YYCategories/Quartz/YYCGUtilities.h
@@ -107,12 +107,12 @@

 /**
- Resize rect to fit the size using a given contentMode.
+ Returns a rectangle to fit the @param rect with specified content mode.

- @param rect The draw rect
+ @param rect The constrant rect
  @param size The content size
  @param mode The content mode
- @return A resized rect for the given content mode.
+ @return A rectangle for the given content mode.
  @discussion UIViewContentModeRedraw is same as UIViewContentModeScaleToFill.
  */
 CGRect YYCGRectFitWithContentMode(CGRect rect, CGSize size, UIViewContentMode mode);


Fix incorrect allocation size (perforce change 8918)

PR:		bin/36658
Submitted by:	Takanori Saneto <sanewo@ba2.so-net.ne.jp>

--- contrib/openpam/lib/pam_putenv.c
+++ contrib/openpam/lib/pam_putenv.c
@@ -31,7 +31,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $P4: //depot/projects/openpam/lib/pam_putenv.c#6 $
+ * $P4: //depot/projects/openpam/lib/pam_putenv.c#7 $
  */

 #include <stdlib.h>
@@ -73,7 +73,8 @@

 	/* grow the environment list if necessary */
 	if (pamh->env_count == pamh->env_size) {
-		env = realloc(pamh->env, pamh->env_size * 2 + 1);
+		env = realloc(pamh->env,
+		    sizeof(char *) * (pamh->env_size * 2 + 1));
 		if (env == NULL)
 			return (PAM_BUF_ERR);
 		pamh->env = env;


GH680: Reuse strnlen() in strndup()

GH680: Reuse strnlen() in strndup()

Signed-off-by: Rich Salz <c04971a99e5a9ee80eaab4b1deb37e845b0bd697@openssl.org>
Reviewed-by: Matt Caswell <1fa2ef4755a9226cb9a0a4840bd89b158ac71391@openssl.org>

--- crypto/o_str.c
+++ crypto/o_str.c
@@ -133,17 +133,13 @@

 char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)
 {
-    const char *cp;
     size_t maxlen;
     char *ret;

     if (str == NULL)
         return NULL;

-    /* Get length. */
-    for (cp = str, maxlen = s; maxlen-- != 0 && *cp != '\0'; ++cp)
-        continue;
-    maxlen = cp - str;
+    maxlen = OPENSSL_strnlen(str, s)

     ret = CRYPTO_malloc(maxlen + 1, file, line);
     if (ret) {


CCBC-828: synchronize list of XERROR attributes with server

Change-Id: Ia28c88cc159c281a8655bbca86a10926cb5026df
Reviewed-on: http://review.couchbase.org/82734
Reviewed-by: Mike Goldsmith <c43a3c67d7a1203c37ce25b098df0254011e1ce6@gmail.com>
Reviewed-by: Michael Nitschinger <17b9e1c64588c7fa6419b4d29dc1f4426279ba01@nitschinger.at>
Tested-by: Sergey Avseyev <87f6d5e4fd3644c3c20800cde7fd3ad1569370b3@gmail.com>

--- src/errmap.h
+++ src/errmap.h
@@ -14,22 +14,95 @@

 enum ErrorAttribute {
 #define LCB_XERRMAP_ATTRIBUTES(X) \
-    X(TEMPORARY, "temp") \
-    X(SUBDOC, "subdoc") \
-    X(RETRY_NOW, "retry-now") \
-    X(RETRY_LATER, "retry-later") \
-    X(INVALID_INPUT, "invalid-input") \
-    X(NOT_ENABLED, "support") \
-    X(AUTH, "auth") \
-    X(CONN_STATE_INVALIDATED, "conn-state-invalidated") \
-    X(CONSTRAINT_FAILURE, "item-only") \
-    X(RETRY_EXP_BACKOFF, "retry-exp-backoff") \
-    X(RETRY_LINEAR_BACKOFF, "retry-linear-backoff") \
-    X(INTERNAL, "internal") \
-    X(DCP, "dcp") \
-    X(FETCH_CONFIG, "fetch-config") \
-    X(SPECIAL_HANDLING, "special-handling") \
-    X(AUTO_RETRY, "auto-retry")
+    /**                                                                 \
+     * This error is transient. Note that this does not mean the        \
+     * error is retriable.                                              \
+     */                                                                 \
+    X(TEMPORARY, "temp")                                                \
+    /**                                                                 \
+     * The error is related to the subdocument subsystem.               \
+     */                                                                 \
+    X(SUBDOC, "subdoc")                                                 \
+    /**                                                                 \
+     * The operation may be retried immediately.                        \
+     */                                                                 \
+    X(RETRY_NOW, "retry-now")                                           \
+    /**                                                                 \
+     * The operation may be retried after some time.                    \
+     */                                                                 \
+    X(RETRY_LATER, "retry-later")                                       \
+    /**                                                                 \
+     * This attribute means that a user's input was invalid because it  \
+     * violates the semantics of the operation, or exceeds some         \
+     * predefined limit.                                                \
+     */                                                                 \
+    X(INVALID_INPUT, "invalid-input")                                   \
+    /**                                                                 \
+     * The operation is not supported, possibly because the of server   \
+     * version, bucket type, or  current user.                          \
+     */                                                                 \
+    X(NOT_ENABLED, "support")                                           \
+    /**                                                                 \
+     * The operation failed because the client failed to authenticate   \
+     * or is not authorized to perform this operation. Note that this   \
+     * error in itself does not mean the connection is invalid, unless  \
+     * conn-state-invalidated is also present.                          \
+     */                                                                 \
+    X(AUTH, "auth")                                                     \
+    /**                                                                 \
+     * The current connection is no longer valid. The client must       \
+     * reconnect to the server. Note that the presence of other         \
+     * attributes may indicate an alternate remedy to fixing the        \
+     * connection without a disconnect, but without special remedial    \
+     * action a disconnect is needed.                                   \
+     */                                                                 \
+    X(CONN_STATE_INVALIDATED, "conn-state-invalidated")                 \
+    /**                                                                 \
+     * This attribute means that the error is related to a constraint   \
+     * failure regarding the item itself, i.e. the item does not exist, \
+     * already exists, or its current value makes the current operation \
+     * impossible. Retrying the operation when the item's value or      \
+     * status has changed may succeed.                                  \
+     */                                                                 \
+    X(CONSTRAINT_FAILURE, "item-only")                                  \
+    /**                                                                 \
+     *  This is an internal error in the server.                        \
+     */                                                                 \
+    X(INTERNAL, "internal")                                             \
+    /**                                                                 \
+     * The error is related to the DCP subsystem.                       \
+     */                                                                 \
+    X(DCP, "dcp")                                                       \
+    /**                                                                 \
+     * The client's cluster map may be outdated and requires updating.  \
+     * The client should obtain a newer configuration.                  \
+     */                                                                 \
+    X(FETCH_CONFIG, "fetch-config")                                     \
+    /**                                                                 \
+     * This error code must be handled specially. If it is not handled, \
+     * the connection must be dropped.                                  \
+     */                                                                 \
+    X(SPECIAL_HANDLING, "special-handling")                             \
+    /**                                                                 \
+     * Use retry specifications from the server                         \
+     */                                                                 \
+    X(AUTO_RETRY, "auto-retry")                                         \
+    /**                                                                 \
+     * The operation was successful for those situations                \
+     * where the error code is indicating successful (i.e. subdoc       \
+     * operations carried out on a deleted document)                    \
+     */                                                                 \
+    X(SUCCESS, "success")                                               \
+    /**                                                                 \
+     * This attribute specifies that the requested item is currently    \
+     * locked.                                                          \
+     */                                                                 \
+    X(ITEM_LOCKED, "item-locked")                                       \
+    /**                                                                 \
+     * This attribute means that the error is related to operating on   \
+     * a soft-deleted document.                                         \
+     */                                                                 \
+    X(ITEM_DELETED, "item-deleted")                                     \

     #define X(c, s) c,
     LCB_XERRMAP_ATTRIBUTES(X)


_tp_account_get_requested_features etc.: remove

--- telepathy-glib/account.c
+++ telepathy-glib/account.c
@@ -114,8 +114,6 @@
   GList *features;
   GList *callbacks;
   GArray *requested_features;
-  GArray *actual_features;
-  GArray *missing_features;
 };

 typedef struct {
@@ -292,9 +290,6 @@

   f->ready = TRUE;

-  if (!_tp_account_feature_in_array (feature, priv->actual_features))
-    g_array_append_val (priv->actual_features, feature);
-
   /* First, find which callbacks are satisfied and add those items
    * from the remove list. */
   l = priv->callbacks;
@@ -675,8 +670,6 @@
   priv->features = NULL;
   priv->callbacks = NULL;
   priv->requested_features = g_array_new (TRUE, FALSE, sizeof (GQuark));
-  priv->actual_features = g_array_new (TRUE, FALSE, sizeof (GQuark));
-  priv->missing_features = g_array_new (TRUE, FALSE, sizeof (GQuark));

   known_features = _tp_account_get_known_features ();

@@ -842,8 +835,6 @@
   priv->callbacks = NULL;

   g_array_free (priv->requested_features, TRUE);
-  g_array_free (priv->actual_features, TRUE);
-  g_array_free (priv->missing_features, TRUE);

   /* free any data held directly by the object here */
   if (G_OBJECT_CLASS (tp_account_parent_class)->finalize != NULL)
@@ -2684,61 +2675,6 @@
   return TRUE;
 }

-/**
- * _tp_account_get_requested_features:
- * @account: a #TpAccount
- *
- * <!-- -->
- *
- * Returns: a 0-terminated list of features requested on @account
- *
- * Since: 0.9.0
- */
-const GQuark *
-_tp_account_get_requested_features (TpAccount *account)
-{
-  g_return_val_if_fail (TP_IS_ACCOUNT (account), NULL);
-
-  return (const GQuark *) account->priv->requested_features->data;
-}
-
-/**
- * _tp_account_get_actual_features:
- * @account: a #TpAccount
- *
- * <!-- -->
- *
- * Returns: a 0-terminated list of actual features on @account
- *
- * Since: 0.9.0
- */
-const GQuark *
-_tp_account_get_actual_features (TpAccount *account)
-{
-  g_return_val_if_fail (TP_IS_ACCOUNT (account), NULL);
-
-  return (const GQuark *) account->priv->actual_features->data;
-}
-
-/**
- * _tp_account_get_missing_features:
- * @account: a #TpAccount
- *
- * <!-- -->
- *
- * Returns: a 0-terminated list of missing features from @account
- *          that have been requested
- *
- * Since: 0.9.0
- */
-const GQuark *
-_tp_account_get_missing_features (TpAccount *account)
-{
-  g_return_val_if_fail (TP_IS_ACCOUNT (account), NULL);
-
-  return (const GQuark *) account->priv->missing_features->data;
-}
-
 static void
 set_or_free (gchar **target,
     gchar *source)


add G_GNUC_WARN_UNUSED_RESULT on tp_message_to_text

--- telepathy-glib/message.h
+++ telepathy-glib/message.h
@@ -71,7 +71,7 @@
     const GValue *source);

 gchar * tp_message_to_text (TpMessage *message,
-    TpChannelTextMessageFlags *out_flags);
+    TpChannelTextMessageFlags *out_flags) G_GNUC_WARN_UNUSED_RESULT;

 /* Takes a TpCMMessage */
 void tp_message_set_handle (TpMessage *self, guint part, const gchar *key,


SSA: avoid a string copy in TextSubCodec and skip extremely large packets

git-svn-id: d8f21eb7283bfb39ebab2f8f9b4a259b233f9348@1325 621663c8-3916-0410-8f58-edc14a8543d5

--- TextSubCodec.c
+++ TextSubCodec.c
@@ -32,6 +32,8 @@
 #include "PerianResourceIDs.h"
 #include "SubRenderer.h"

+static const int kMaxSubPacketSize = 1*1024*1024; // 1MB
+
 // Data structures
 typedef struct TextSubGlobalsRecord {
 	ComponentInstance		self;
@@ -80,14 +82,6 @@
 #endif

 #define kNumPixelFormatsSupportedTextSub 2
-
-static CFMutableStringRef CFStringCreateMutableWithBytes(CFAllocatorRef alloc, char *cStr, size_t size, CFStringEncoding encoding) {
-	CFStringRef                s1 = CFStringCreateWithBytes(alloc,(UInt8*)cStr,size,encoding,false);
-	if (!s1) return NULL;
-	CFMutableStringRef s2 = CFStringCreateMutableCopy(alloc,0,s1);
-	CFRelease(s1);
-	return s2;
-}

 /* -- This Image Decompressor Uses the Base Image Decompressor Component --
 	The base image decompressor is an Apple-supplied component
@@ -315,20 +309,23 @@
 	CFMutableStringRef buf;

 	if (drp->codecData[0] == '\n' && myDrp->dataSize == 1) goto leave; // skip empty packets
+	if (myDrp->dataSize > kMaxSubPacketSize) goto leave; // skip very large packets, they probably cause stack overflows
+
+	buf = (CFMutableStringRef)CFStringCreateWithBytesNoCopy(NULL, (UInt8*)drp->codecData, myDrp->dataSize, kCFStringEncodingUTF8, false, kCFAllocatorNull);
+	if (!buf) goto leave;

 	if (glob->translateSRT) {
-		buf = CFStringCreateMutableWithBytes(NULL, drp->codecData, myDrp->dataSize, kCFStringEncodingUTF8);
+		CFStringRef origBuf = buf;
+		buf = CFStringCreateMutableCopy(NULL, 0, buf);
+		CFRelease(origBuf);
 		if (!buf) goto leave;
 		CFStringFindAndReplace(buf, CFSTR("<i>"),  CFSTR("{\\i1}"), CFRangeMake(0,CFStringGetLength(buf)), 0);
 		CFStringFindAndReplace(buf, CFSTR("</i>"), CFSTR("{\\i0}"), CFRangeMake(0,CFStringGetLength(buf)), 0);
 		CFStringFindAndReplace(buf, CFSTR("<"),    CFSTR("{"),      CFRangeMake(0,CFStringGetLength(buf)), 0);
 		CFStringFindAndReplace(buf, CFSTR(">"),    CFSTR("}"),      CFRangeMake(0,CFStringGetLength(buf)), 0);
-	} else {
-		buf = (CFMutableStringRef)CFStringCreateWithBytes(NULL, (UInt8*)drp->codecData, myDrp->dataSize, kCFStringEncodingUTF8, false);
-		if (!buf) goto leave;
 	}

-	SubRendererRenderPacket(glob->ssa,c,buf,myDrp->width,myDrp->height);
+	SubRendererRenderPacket(glob->ssa, c, buf, myDrp->width, myDrp->height);

 	if (IsTransparentSubtitleHackEnabled())
 		ConvertImageToQDTransparent(drp->baseAddr, myDrp->pixelFormat, drp->rowBytes, myDrp->width, myDrp->height);
@@ -357,7 +354,7 @@
 }

 // ImageCodecGetSourceDataGammaLevel
-// Returns 1.8, the gamma for sRGB.
+// Returns 2.2, the gamma for sRGB.
 pascal ComponentResult TextSubCodecGetSourceDataGammaLevel(TextSubGlobals glob, Fixed *sourceDataGammaLevel)
 {
 	*sourceDataGammaLevel = FloatToFixed(2.2);


removed tracing

removed tracing

--- Top/csmodule.c
+++ Top/csmodule.c
@@ -443,7 +443,7 @@
       read_directory = 0;
     }

-    printf("DIRECTORY: %s\n", dname1);
+    //printf("DIRECTORY: %s\n", dname1);
     dir = opendir(dname1);
     if (UNLIKELY(dir == (DIR*) NULL)) {
       //if (dname != NULL)  /* cannot be other */