Style fixes

Style fixes

1. Remove redundant extra lines.
2. Have the function parameters aligned.
3. Remove redundant white spaces.

--- features/cryptocell/FEATURE_CRYPTOCELL310/aes_alt.c
+++ features/cryptocell/FEATURE_CRYPTOCELL310/aes_alt.c
@@ -29,12 +29,12 @@
  * AES-CFB128 buffer encryption/decryption
  */
 int mbedtls_aes_crypt_cfb128( mbedtls_aes_context *ctx,
-                       int mode,
-                       size_t length,
-                       size_t *iv_off,
-                       unsigned char iv[16],
-                       const unsigned char *input,
-                       unsigned char *output )
+                              int mode,
+                              size_t length,
+                              size_t *iv_off,
+                              unsigned char iv[16],
+                              const unsigned char *input,
+                              unsigned char *output )
 {
     return( MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED );
 }
@@ -43,11 +43,11 @@
  * AES-CFB8 buffer encryption/decryption
  */
 int mbedtls_aes_crypt_cfb8( mbedtls_aes_context *ctx,
-                       int mode,
-                       size_t length,
-                       unsigned char iv[16],
-                       const unsigned char *input,
-                       unsigned char *output )
+                            int mode,
+                            size_t length,
+                            unsigned char iv[16],
+                            const unsigned char *input,
+                            unsigned char *output )
 {
     return( MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED );
 }
@@ -82,11 +82,11 @@

 #if defined(MBEDTLS_CIPHER_MODE_OFB)
 int mbedtls_aes_crypt_ofb( mbedtls_aes_context *ctx,
-                       size_t length,
-                       size_t *iv_off,
-                       unsigned char iv[16],
-                       const unsigned char *input,
-                       unsigned char *output );
+                           size_t length,
+                           size_t *iv_off,
+                           unsigned char iv[16],
+                           const unsigned char *input,
+                           unsigned char *output );
 {
     return( MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED );
 }
@@ -114,9 +114,8 @@
 static int CC_aes_setkey( mbedtls_aes_context *ctx, const unsigned char *key,
                           unsigned int keybits, SaSiAesEncryptMode_t cipher_flag )
 {
-
     int ret = 0;
-    if ( ctx == NULL )
+    if( ctx == NULL )
         return( MBEDTLS_ERR_AES_BAD_INPUT_DATA );

     switch( keybits )
@@ -135,17 +134,16 @@
             return( MBEDTLS_ERR_AES_INVALID_KEY_LENGTH );
     }

-    return ( 0 );
-
+    return( 0 );
 }
 int mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const unsigned char *key,
-                    unsigned int keybits )
+                            unsigned int keybits )
 {
     return( CC_aes_setkey( ctx, key, keybits, SASI_AES_ENCRYPT ) );
 }

 int mbedtls_aes_setkey_dec( mbedtls_aes_context *ctx, const unsigned char *key,
-                    unsigned int keybits )
+                            unsigned int keybits )
 {
     return( CC_aes_setkey( ctx, key, keybits, SASI_AES_DECRYPT ) );
 }
@@ -177,17 +175,17 @@
     if( iv )
     {
         if( iv_len != SASI_AES_IV_SIZE_IN_BYTES )
-            return MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH;
-
-        ret = SaSi_AesSetIv ( &ctx->CC_Context, iv );
+            return( MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH );
+
+        ret = SaSi_AesSetIv( &ctx->CC_Context, iv );
         if( ret != 0 )
-            return ( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
+            return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
      }

      ret = SaSi_AesFinish( &ctx->CC_Context, length,
                            ( unsigned char* )input, length, output, &length );
      if( ret != 0 )
-         return ( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
+         return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );

      /* update the IV for next block
       * For CTR mode, update the nonce only if the current length is a full AES block length
@@ -199,20 +197,20 @@
      {
           ret = SaSi_AesGetIv( &ctx->CC_Context, iv );
           if( ret != 0 )
-              return ( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
+              return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
       }

       ret = SaSi_AesFree( &ctx->CC_Context );
-      if ( ret != 0 )
-          return ( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
-
-      return ( 0 );
+      if( ret != 0 )
+          return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
+
+      return( 0 );
 }

 int mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx,
-                    int mode,
-                    const unsigned char input[16],
-                    unsigned char output[16] )
+                           int mode,
+                           const unsigned char input[16],
+                           unsigned char output[16] )
 {
     if( ctx == NULL )
         return( MBEDTLS_ERR_AES_BAD_INPUT_DATA );
@@ -233,7 +231,7 @@
                            unsigned char *output )
 {
     if( ctx == NULL )
-        return ( MBEDTLS_ERR_AES_BAD_INPUT_DATA );
+        return( MBEDTLS_ERR_AES_BAD_INPUT_DATA );

     if( length % SASI_AES_BLOCK_SIZE_IN_BYTES )
         return( MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH );
@@ -262,7 +260,7 @@
     if( ctx == NULL )
         return( MBEDTLS_ERR_AES_BAD_INPUT_DATA );

-    if ( *nc_off )
+    if( *nc_off )
     {
         /* handle corner case where we are resuming a previous encryption,
          * and we are resuming within current cipher stream(stream_block) */
@@ -304,7 +302,7 @@
     *nc_off = ( length % SASI_AES_BLOCK_SIZE_IN_BYTES );

 exit:
-    return ret;
+    return( ret );
 }
 #endif /* MBEDTLS_CIPHER_MODE_CTR */
 #endif/* MBEDTLS_AES_ALT */


Added R_DISABLE_COPY() for disable class's copy constructor and assign operator

--- src/RTypes.h
+++ src/RTypes.h
@@ -26,4 +26,12 @@
  */
 #define RSIZE_OF_ARRAY(array) (sizeof((array))/sizeof((array)[0]))

+/**
+ * Disable copy constructor and assign operations.
+ *
+ */
+#define R_DISABLE_COPY(Class) \
+  Class(const Class &); \
+  Class &operator=(const Class &);
+
 #endif // __INCLUDED_C140043A425411E6A04700F1F38F93EF


int -> size_t

int -> size_t

--- src/RhoPhi.h
+++ src/RhoPhi.h
@@ -10,7 +10,7 @@
 class GeFiCa::RhoPhi : public Grid, public TNamed
 {
    public:
-      RhoPhi(int n1=101, int n2=180) : Grid(n1, n2),
+      RhoPhi(size_t n1=101, size_t n2=180) : Grid(n1, n2),
       TNamed("rhophi", "2D cylindrical coordinates in rho-phi") {};

       void GetBoundaryConditionFrom(Detector &detector);


"*(pointer_convert" -> " *pointer_convert", add gcount() check

--- src/db_file.h
+++ src/db_file.h
@@ -49,8 +49,8 @@
         char buffer[sizeof(_page_size) + sizeof(_num_pages)];
         _fs.read(buffer, sizeof(_page_size) + sizeof(_num_pages));

-        _page_size = *(pointer_convert<uint64*>(buffer));
-        _num_pages = *(pointer_convert<uint64*>(buffer + sizeof(_page_size)));
+        _page_size = *pointer_convert<uint64*>(buffer);
+        _num_pages = *pointer_convert<uint64*>(buffer + sizeof(_page_size));

         return _page_size;
     };
@@ -133,6 +133,7 @@
     void readPage(const uint64 i, char* buffer) {
         _fs.seekg(_page_size * i);
         _fs.read(buffer, _page_size);
+        assert(_fs.gcount() == _page_size);
     }

     uint64 pageSize() const { return _page_size; }


Adding definitions to datastructures

Adding definitions to datastructures

--- src/apk/xml.h
+++ src/apk/xml.h
@@ -173,6 +173,7 @@
    */
   class ElementStart {
    public:
+    // The header_length field in common header only covers the following two
     CommonHeader common_header;
     ElementHeader element_header;

@@ -182,6 +183,20 @@
     uint32_t name_space;
     // The name of the element
     uint32_t name;
+
+    // This is relative to the offset from "name_space"
+    uint16_t attribute_offset;
+    // Byte size of attribute structures
+    uint16_t attribute_length;
+    // Number of attributes with the element
+    uint16_t attribute_count;
+
+    // The following also describes attributes, but they are special attributes
+    // so they are separately stored.
+    // 0 means non-exist, and the index here starts at 1
+    uint16_t id_index;
+    uint16_t class_index;
+    uint16_t style_index;
   } BYTE_ALIGNED;

   using ElementEnd = ElementStart;


small fixes in Density

small fixes in Density

--- src/density.h
+++ src/density.h
@@ -66,7 +66,7 @@
         void generate_valence_density_it();

         /// Add band contribution to the muffin-tin density
-        void add_band_contribution_mt(double weight, std::vector<PeriodicFunction<complex16, radial_angular>*>& psi,
+        void add_band_contribution_mt(double weight, mdarray<complex16, 3>& fylm,
                                       std::vector<PeriodicFunction<double, radial_angular>*>& dens);

     public:
@@ -146,9 +146,8 @@
 };

 Density::Density(Global& parameters__, Potential* potential__, mdarray<double, 2>& kpoints__, double* kpoint_weights__,
-        int allocate_f__ = pw_component) :
-    parameters_(parameters__), potential_(potential__), allocate_f_(allocate_f__),
-    kpoint_set_(parameters__)
+                 int allocate_f__ = pw_component) :
+    parameters_(parameters__), potential_(potential__), allocate_f_(allocate_f__), kpoint_set_(parameters__)
 {
     rho_ = new PeriodicFunction<double>(parameters_, parameters_.lmax_rho());
     rho_->allocate(allocate_f_);
@@ -192,7 +191,19 @@
     }
     }

-    gaunt12_.set_lmax(parameters_.lmax_pw(), parameters_.lmax_pw(), parameters_.lmax_rho());
+    switch (basis_type)
+    {
+        case apwlo:
+        {
+            gaunt12_.set_lmax(parameters_.lmax_apw(), parameters_.lmax_apw(), parameters_.lmax_rho());
+            break;
+        }
+        case pwlo:
+        {
+            gaunt12_.set_lmax(parameters_.lmax_pw(), parameters_.lmax_pw(), parameters_.lmax_rho());
+            break;
+        }
+    }

     band_ = kpoint_set_.band();

@@ -314,6 +325,61 @@
         }
         for (int i = 0; i < parameters_.fft().size(); i++) rho_->f_it(i) = rho_avg;
     }
+
+    if (type == 2)
+    {
+        rho_->f_pw(0) = parameters_.num_electrons() / parameters_.omega();
+        for (int ig = 1; ig < parameters_.num_gvec(); ig++)
+        {
+            rho_->f_pw(ig) = (ig < 20) ? 1.0 / double(ig + 1) / parameters_.omega() : 0.0;
+        }
+
+        parameters_.fft().input(parameters_.num_gvec(), parameters_.fft_index(), rho_->f_pw());
+        parameters_.fft().transform(1);
+        parameters_.fft().output(rho_->f_it());
+
+        rho_->allocate(ylm_component);
+        rho_->zero(ylm_component);
+
+        sbessel_pw<double> jl(parameters_, parameters_.lmax_rho());
+
+        for (int igloc = 0; igloc < parameters_.spl_num_gvec().local_size(); igloc++)
+        {
+            int ig = parameters_.spl_num_gvec(igloc);
+            if (ig < 20)
+            {
+                std::cout << "ig = " << ig << std::endl;
+                jl.load(parameters_.gvec_len(ig));
+                complex16 z1 = rho_->f_pw(ig) * fourpi;
+
+                for (int ia = 0; ia < parameters_.num_atoms(); ia++)
+                {
+                    int iat = parameters_.atom_type_index_by_id(parameters_.atom(ia)->type_id());
+                    complex16 z2 = z1 * parameters_.gvec_phase_factor<local>(igloc, ia);
+
+                    #pragma omp parallel for default(shared)
+                    for (int lm = 0; lm < parameters_.lmmax_rho(); lm++)
+                    {
+                        int l = l_by_lm_[lm];
+                        complex16 z3 = z2 * pow(std::complex<double>(0, 1), l) * conj(parameters_.gvec_ylm(lm, igloc));
+                        for (int ir = 0; ir < parameters_.atom(ia)->num_mt_points(); ir++)
+                            rho_->f_ylm(lm, ir, ia) += z3 * jl(ir, l, iat);
+                    }
+                }
+            }
+        }
+        SHT sht_;
+        sht_.set_lmax(parameters_.lmax_rho());
+        for (int ia = 0; ia < parameters_.num_atoms(); ia++)
+        {
+            for (int ir = 0; ir < parameters_.atom(ia)->num_mt_points(); ir++)
+                sht_.convert_to_rlm(parameters_.lmax_rho(), &rho_->f_ylm(0, ir, ia), &rho_->f_rlm(0, ir, ia));
+        }
+        rho_->deallocate(ylm_component);
+
+        std::cout << "pseudo-random number of electrons : " << rho_->integrate(rlm_component | it_component);
+    }
+
 }

 template <int num_mag_dims>
@@ -722,7 +788,7 @@
         Platform::allreduce(&magnetization_[j]->f_it(0), parameters_.fft().size());
 }

-void Density::add_band_contribution_mt(double weight, std::vector<PeriodicFunction<complex16, radial_angular>*>& psi,
+void Density::add_band_contribution_mt(double weight, mdarray<complex16, 3>& fylm,
                                        std::vector<PeriodicFunction<double, radial_angular>*>& dens)
 {
     splindex<block> spl_num_atoms(parameters_.num_atoms(), band_->num_ranks_row(), band_->rank_row());
@@ -741,8 +807,7 @@

                 for (int ir = 0; ir < parameters_.atom(ia)->num_mt_points(); ir++)
                 {
-                    dens[0]->f_rlm(ir, lm3, ia) += weight * real(cg * conj(psi[0]->f_ylm(ir, lm1, ia)) *
-                                                   psi[0]->f_ylm(ir, lm2, ia));
+                    dens[0]->f_rlm(ir, lm3, ia) += weight * real(cg * conj(fylm(ir, lm1, ia)) * fylm(ir, lm2, ia));
                 }
             }
         }
@@ -754,7 +819,8 @@
     Timer t("sirius::Density::generate_valence_density_mt_directly");

     int lmax = (basis_type == apwlo) ? parameters_.lmax_apw() : parameters_.lmax_pw();
-
+    int lmmax = Utils::lmmax_by_lmax(lmax);
+
     std::vector<PeriodicFunction<double, radial_angular>*> dens(1 + parameters_.num_mag_dims());
     for (int i = 0; i < (int)dens.size(); i++)
     {
@@ -762,6 +828,8 @@
         dens[i]->allocate(rlm_component);
         dens[i]->zero();
     }
+
+    mdarray<complex16, 3> fylm(parameters_.max_num_mt_points(), lmmax, parameters_.num_atoms());

     // add k-point contribution
     for (int ikloc = 0; ikloc < kpoint_set_.spl_num_kpoints().local_size(); ikloc++)
@@ -775,17 +843,11 @@

             if (wo > 1e-14)
             {
-                std::vector<PeriodicFunction<complex16, radial_angular>*> psi(parameters_.num_spins());
-                for (int ispn = 0; ispn < parameters_.num_spins(); ispn++)
-                    psi[ispn] = kpoint_set_[ik]->spinor_wave_function_component<radial_angular>(band_, lmax, ispn, jloc);
-
-                add_band_contribution_mt(wo, psi, dens);
-
-                for (int ispn = 0; ispn < parameters_.num_spins(); ispn++)
-                {
-                    psi[ispn]->deallocate(ylm_component | it_component);
-                    delete psi[ispn];
-                }
+                int ispn = 0;
+
+                kpoint_set_[ik]->spinor_wave_function_component_mt<radial_angular>(band_, lmax, ispn, jloc, fylm);
+
+                add_band_contribution_mt(wo, fylm, dens);
             }
         }
     }


interpolationcontrolsource: fix write over the array size

The '++' got incidentially added during the refactoring in
2fe3939ce7ea84c45dd922e7f1097dd07f11fc5d.

--- libs/gst/controller/gstinterpolationcontrolsource.c
+++ libs/gst/controller/gstinterpolationcontrolsource.c
@@ -229,7 +229,7 @@
       ret = TRUE;
       GST_LOG ("values[%3d]=%lf", i, *values);
     } else {
-      *values++ = NAN;
+      *values = NAN;
       GST_LOG ("values[%3d]=-", i);
     }
     ts += interval;


fixed small memory leak

fixed small memory leak

--- src/difflib.h
+++ src/difflib.h
@@ -79,6 +79,10 @@
   using value_type = T;
   using hashable_type = typename T::value_type;
   using junk_function_type = std::function<bool(hashable_type const&)>;
+
+  ~SequenceMatcher(){
+    if (matching_blocks_!=nullptr) delete matching_blocks_;
+  }

   SequenceMatcher(T const& a, T const& b, junk_function_type is_junk = NoJunk<hashable_type>, bool auto_junk = true): a_(a), b_(b), is_junk_(is_junk), auto_junk_(auto_junk), matching_blocks_(nullptr) {
     chain_b();


Polish the VSC RST typography a bit.

Polish the VSC RST typography a bit.

--- bin/varnishstat/vsc2rst.c
+++ bin/varnishstat/vsc2rst.c
@@ -34,7 +34,7 @@
 #include <stdio.h>

 #define VSC_LEVEL_F(v,l,e,d)		\
-	static const char VSC_level_##v[] = l;
+	static const char VSC_level_##v[] = #v;
 #include "tbl/vsc_levels.h"
 #undef VSC_LEVEL_F

@@ -61,8 +61,19 @@

 #define VSC_DO(U,l,t,h) L(h);

-#define VSC_F(n, t, l, s, f, v, d, e)	\
-	printf("%s – %s (%s)\n\t%s\n\n", #n, d, VSC_level_##v, e);
+#define VSC_F(n, t, l, s, f, v, d, e)					\
+	do {								\
+		printf("``%s`` – ", #n);				\
+		if (s == 'c')						\
+			printf("`counter` - ");				\
+		else if (s == 'g')					\
+			printf("`gauge` - ");				\
+		else if (s == 'b')					\
+			printf("`bitmap` - ");				\
+		printf("%s\n\n", VSC_level_##v);			\
+		printf("\t%s\n\n", d);					\
+		printf("\t%s\n\n", e);					\
+	} while (0);

 #define VSC_DONE(U,l,t)


dncp_io: Removed Linux-ism (s6_addr32), and including hncp.h first so it can work-around platform brokenness when it includes hnetd.h.

--- src/dncp_io.c
+++ src/dncp_io.c
@@ -1,11 +1,12 @@
-#include <fcntl.h>
-#include <errno.h>
-#include <unistd.h>
-#include <arpa/inet.h>
-#include <libubox/utils.h>
-
 #include "hncp.h"
 #include "dncp_io.h"
+
+#undef __unused
+/* In linux, fcntl.h includes something with __unused. Argh. */
+#include <fcntl.h>
+#define __unused __attribute__((unused))
+
+#include <unistd.h>

 int dncp_io_sockets(struct uloop_fd *fd, uint16_t port,
 		uloop_fd_handler handle_v6, uloop_fd_handler handle_v4)
@@ -56,6 +57,14 @@
     close(fds[i].fd);
   }
 }
+
+#define IN_ADDR_TO_MAPPED_IN6_ADDR(a, a6)       \
+do {                                            \
+  memset(a6, 0, sizeof(*(a6)));                 \
+  (a6)->s6_addr[10] = 0xff;                     \
+  (a6)->s6_addr[11] = 0xff;                     \
+  ((uint32_t *)a6)[3] = *((uint32_t *)a);       \
+ } while (0)

 ssize_t dncp_io_recvmsg(struct uloop_fd *fds,
 		void *buf, size_t len,
@@ -103,20 +112,15 @@
 			struct sockaddr_in6 src6 = {
 			  .sin6_family = AF_INET6,
 			  .sin6_port = src4->sin_port,
-			  .sin6_addr = IN6ADDR_ANY_INIT,
 			  .sin6_scope_id = ipi->ipi_ifindex,
 			};

-			src6.sin6_addr.s6_addr32[2] = cpu_to_be32(0xffff);
-			src6.sin6_addr.s6_addr32[3] = src4->sin_addr.s_addr;
+			IN_ADDR_TO_MAPPED_IN6_ADDR(&src4->sin_addr, &src6.sin6_addr);
 			*src = src6;

           ifindex = ipi->ipi_ifindex;

-          dst->s6_addr32[0] = 0;
-          dst->s6_addr32[1] = 0;
-          dst->s6_addr32[2] = cpu_to_be32(0xffff);
-          dst->s6_addr32[3] = ipi->ipi_spec_dst.s_addr;
+		  IN_ADDR_TO_MAPPED_IN6_ADDR(&ipi->ipi_spec_dst.s_addr, &src6.sin6_addr);
         }
     if (ifindex && !if_indextoname(ifindex, ifname))
       {
@@ -172,7 +176,7 @@
       sock = fds[SOCKET_IPV6].fd;
     } else {
       dst4.sin_family = AF_INET;
-      dst4.sin_addr.s_addr = dst->sin6_addr.s6_addr32[3];
+      dst4.sin_addr.s_addr = *((uint32_t *)&dst->sin6_addr.s6_addr[12]);
       dst4.sin_port = dst->sin6_port;

       msg.msg_name = &dst4;
@@ -189,7 +193,7 @@
         struct in_pktinfo *info = (struct in_pktinfo*)CMSG_DATA(chdr);
         info->ipi_addr.s_addr = 0;
         info->ipi_ifindex = src->ipi6_ifindex;
-        info->ipi_spec_dst.s_addr = src->ipi6_addr.s6_addr32[3];
+        info->ipi_spec_dst.s_addr = *(uint32_t *)(&src->ipi6_addr.s6_addr[12]);
       }

       sock = fds[SOCKET_IPV4].fd;


In Gtk+ input context fix cursor position within preedit

When cursorPos equals -1 set it to the end of the preedit text.

RevBy: Michael Hasselmann

Full, original commit at 4efbd726ca30cd8a6522f4eca5df40a97db2f04f in maliit-framework

--- gtk-input-context/client-gtk/client-imcontext-gtk.c
+++ gtk-input-context/client-gtk/client-imcontext-gtk.c
@@ -563,16 +563,20 @@
                                gint32 cursorPos,
                                gpointer user_data)
 {
-    STEP();
-
     MeegoIMContext *imcontext = MEEGO_IMCONTEXT(user_data);
     if (imcontext != focused_imcontext)
         return;
+
+    DBG("imcontext = %p string = %s cursorPos = %d", imcontext, string, cursorPos);

     if (focused_imcontext) {
         g_free(focused_imcontext->preedit_str);
         focused_imcontext->preedit_str = g_strdup(string);
-        focused_imcontext->preedit_cursor_pos = cursorPos + g_utf8_strlen(string, -1) + 1;
+        /* If cursorPos is -1 explicitly set it to the end of the preedit */
+        if (cursorPos == -1) {
+            cursorPos = g_utf8_strlen(string, -1);
+        }
+        focused_imcontext->preedit_cursor_pos = cursorPos;
         g_signal_emit_by_name(focused_imcontext, "preedit-changed");
     }
 }


Attempt to make vector class exchangeble with box

This matches the vector class so it maches the signature of the
box2d vector class. The hope here is I could type alias them so
I can use either.

--- src/lib/units.h
+++ src/lib/units.h
@@ -1,5 +1,7 @@

 #include <cstdint>
+#include <cfloat>
+#include <cmath>
 #include <string>

 #include "SDL2/SDL.h"
@@ -16,8 +18,35 @@
     float x;
     float y;

-    Vector2d(const float x=0, const float y=0): x(x), y(y)
-    {
+    Vector2d() :
+      x(0), y(0)
+    { }
+
+    Vector2d(float x, float y): x(x), y(y)
+    { }
+
+    // b2d
+    void SetZero()
+    {
+      x = 0.0f;
+      y = 0.0f;
+    }
+
+    // b2d
+    void Set(float x_, float y_) { x = x_; y = y_; }
+
+    // b2d
+    Vector2d operator -() const { Vector2d v; v.Set(-x, -y); return v; }
+
+
+    float operator () (int i) const
+    {
+      return (&x)[i];
+    }
+
+    float& operator () (int i)
+    {
+      return (&x)[i];
     }

     Vector2d operator+(const Vector2d& a) const
@@ -48,6 +77,11 @@
       return *this;
     }

+    void operator -= (const Vector2d& v)
+    {
+      x -= v.x; y -= v.y;
+    }
+
     Vector2d& operator*=(const float f)
     {
       x *= f;
@@ -64,6 +98,41 @@
     bool operator!=(const Vector2d& a) const
     {
       return x != a.x && y != a.y;
+    }
+
+    float Length() const
+    {
+      return sqrt(x * x + y * y);
+    }
+
+    float LengthSquared() const
+    {
+      return x * x + y * y;
+    }
+
+
+    float Normalize()
+    {
+      float length = Length();
+      if (length < FLT_EPSILON)
+      {
+        return 0.0f;
+      }
+      float invLength = 1.0f / length;
+      x *= invLength;
+      y *= invLength;
+
+      return length;
+    }
+
+    bool IsValid() const
+    {
+      return !!x && !!y;
+    }
+
+    Vector2d Skew() const
+    {
+      return Vector2d(-y, x);
     }
   };


ngx_core.h

--- nginx/src/core/ngx_core.h
+++ nginx/src/core/ngx_core.h
@@ -12,22 +12,21 @@
 #include <ngx_config.h>

-typedef struct ngx_module_s      ngx_module_t;
-typedef struct ngx_conf_s        ngx_conf_t;
-typedef struct ngx_cycle_s       ngx_cycle_t;
-typedef struct ngx_pool_s        ngx_pool_t;
-typedef struct ngx_chain_s       ngx_chain_t;
-typedef struct ngx_log_s         ngx_log_t;
-typedef struct ngx_open_file_s   ngx_open_file_t;
-typedef struct ngx_command_s     ngx_command_t;
-typedef struct ngx_file_s        ngx_file_t;
-typedef struct ngx_event_s       ngx_event_t;
-typedef struct ngx_event_aio_s   ngx_event_aio_t;
-typedef struct ngx_connection_s  ngx_connection_t;
-
-#if (NGX_THREADS)
-typedef struct ngx_thread_task_s  ngx_thread_task_t;
-#endif
+typedef struct ngx_module_s          ngx_module_t;
+typedef struct ngx_conf_s            ngx_conf_t;
+typedef struct ngx_cycle_s           ngx_cycle_t;
+typedef struct ngx_pool_s            ngx_pool_t;
+typedef struct ngx_chain_s           ngx_chain_t;
+typedef struct ngx_log_s             ngx_log_t;
+typedef struct ngx_open_file_s       ngx_open_file_t;
+typedef struct ngx_command_s         ngx_command_t;
+typedef struct ngx_file_s            ngx_file_t;
+typedef struct ngx_event_s           ngx_event_t;
+typedef struct ngx_event_aio_s       ngx_event_aio_t;
+typedef struct ngx_connection_s      ngx_connection_t;
+typedef struct ngx_thread_task_s     ngx_thread_task_t;
+typedef struct ngx_ssl_s             ngx_ssl_t;
+typedef struct ngx_ssl_connection_s  ngx_ssl_connection_t;

 typedef void (*ngx_event_handler_pt)(ngx_event_t *ev);
 typedef void (*ngx_connection_handler_pt)(ngx_connection_t *c);


fix integer overflow in setproctitle

fix integer overflow in setproctitle

1. don't cast to long
2. check overflow before addition

v2: just remove the cast, don't change the type of the variables

Reported-by: Coverity
Signed-off-by: Tycho Andersen <10c18fcb898ee6b17d6575d444b125d10b3f4d6a@canonical.com>
Acked-by: Stéphane Graber <089afc6d81f66f1168a9849e15660feae286e024@ubuntu.com>

--- src/lxc/utils.c
+++ src/lxc/utils.c
@@ -1644,15 +1644,21 @@
 		if (len >= arg_end - arg_start) {
 			env_start = env_end;
 		}
+
+		/* check overflow */
+		if (arg_start + len < 0) {
+			return -1;
+		}
+
 		arg_end = arg_start + len;
 	}

 	strcpy((char*)arg_start, title);

-	ret |= prctl(PR_SET_MM, PR_SET_MM_ARG_START,   (long)arg_start, 0, 0);
-	ret |= prctl(PR_SET_MM, PR_SET_MM_ARG_END,     (long)arg_end, 0, 0);
-	ret |= prctl(PR_SET_MM, PR_SET_MM_ENV_START,   (long)env_start, 0, 0);
-	ret |= prctl(PR_SET_MM, PR_SET_MM_ENV_END,     (long)env_end, 0, 0);
+	ret |= prctl(PR_SET_MM, PR_SET_MM_ARG_START,   arg_start, 0, 0);
+	ret |= prctl(PR_SET_MM, PR_SET_MM_ARG_END,     arg_end, 0, 0);
+	ret |= prctl(PR_SET_MM, PR_SET_MM_ENV_START,   env_start, 0, 0);
+	ret |= prctl(PR_SET_MM, PR_SET_MM_ENV_END,     env_end, 0, 0);

 	return ret;
 }


Update RingOpenGL - Add Function (Source Code) : GLint glRenderMode(GLenum mode)

--- extensions/ringopengl/ring_opengl21.c
+++ extensions/ringopengl/ring_opengl21.c
@@ -7292,6 +7292,20 @@
 		return ;
 	}
 	glRectsv((GLshort *) RING_API_GETCPOINTER(1,"GLshort"),(GLshort *) RING_API_GETCPOINTER(2,"GLshort"));
+}
+
+
+RING_FUNC(ring_glRenderMode)
+{
+	if ( RING_API_PARACOUNT != 1 ) {
+		RING_API_ERROR(RING_API_MISS1PARA);
+		return ;
+	}
+	if ( ! RING_API_ISNUMBER(1) ) {
+		RING_API_ERROR(RING_API_BADPARATYPE);
+		return ;
+	}
+	RING_API_RETNUMBER(glRenderMode( (GLenum )  (int) RING_API_GETNUMBER(1)));
 }

 RING_API void ringlib_init(RingState *pRingState)
@@ -7654,4 +7668,5 @@
 	ring_vm_funcregister("glrectfv",ring_glRectfv);
 	ring_vm_funcregister("glrectiv",ring_glRectiv);
 	ring_vm_funcregister("glrectsv",ring_glRectsv);
-}
+	ring_vm_funcregister("glrendermode",ring_glRenderMode);
+}


BLE Host - Fix spurious maybe-uninitialized warn.

X-Original-Commit: 5ccea9b6c74a35ca34be7a17b5d63fc3dcda0bda

--- nimble/host/src/ble_gap.c
+++ nimble/host/src/ble_gap.c
@@ -745,6 +745,10 @@
         }

         ble_gap_conn_to_snapshot(conn, &snap);
+    } else {
+        /* Silence spurious maybe-uninitialized warning. */
+        snap.cb = NULL;
+        snap.cb_arg = NULL;
     }

     conn->bhc_flags &= ~BLE_HS_CONN_F_UPDATE;


replace hardcoded path to devnull with macro from paths.h

--- src/dyndnsd.c
+++ src/dyndnsd.c
@@ -11,6 +11,7 @@
 #include <fcntl.h>
 #include <grp.h>
 #include <ifaddrs.h>
+#include <paths.h>
 #include <pwd.h>
 #include <signal.h>
 #include <stdbool.h>
@@ -87,7 +88,7 @@
 		}
 	}

-	devnull = open("/dev/null", O_WRONLY|O_CLOEXEC);
+	devnull = open(_PATH_DEVNULL, O_WRONLY|O_CLOEXEC);
 	if (-1 == devnull)
 		err(EXIT_FAILURE, "cannopt open file '/dev/null': open(2)");


Fix the return value of esp_now_send()

Fix the return value of esp_now_send()

--- components/esp32/include/esp_now.h
+++ components/esp32/include/esp_now.h
@@ -48,6 +48,7 @@
 #define ESP_ERR_ESPNOW_NOT_FOUND    (ESP_ERR_ESPNOW_BASE + 4) /*!< ESPNOW peer is not found */
 #define ESP_ERR_ESPNOW_INTERNAL     (ESP_ERR_ESPNOW_BASE + 5) /*!< Internal error */
 #define ESP_ERR_ESPNOW_EXIST        (ESP_ERR_ESPNOW_BASE + 6) /*!< ESPNOW peer has existed */
+#define ESP_ERR_ESPNOW_IF           (ESP_ERR_ESPNOW_BASE + 7) /*!< Interface error */

 #define ESP_NOW_ETH_ALEN             6         /*!< Length of ESPNOW peer MAC address */
 #define ESP_NOW_KEY_LEN              16        /*!< Length of ESPNOW peer local master key */
@@ -191,6 +192,7 @@
   *          - ESP_ERR_ESPNOW_INTERNAL : internal error
   *          - ESP_ERR_ESPNOW_NO_MEM : out of memory
   *          - ESP_ERR_ESPNOW_NOT_FOUND : peer is not found
+  *          - ESP_ERR_ESPNOW_IF : current WiFi interface doesn't match that of peer
   */
 esp_err_t esp_now_send(const uint8_t *peer_addr, const uint8_t *data, size_t len);


Update RingOpenGL - Add Function (Source Code) : void glMultiTexCoord2d(GLenum target,GLdouble s,GLdouble t)

--- extensions/ringopengl/ring_opengl21.c
+++ extensions/ringopengl/ring_opengl21.c
@@ -5710,6 +5710,28 @@
 		return ;
 	}
 	glMultiTexCoord2f( (GLenum )  (int) RING_API_GETNUMBER(1), (GLfloat ) RING_API_GETNUMBER(2), (GLfloat ) RING_API_GETNUMBER(3));
+}
+
+
+RING_FUNC(ring_glMultiTexCoord2d)
+{
+	if ( RING_API_PARACOUNT != 3 ) {
+		RING_API_ERROR(RING_API_MISS3PARA);
+		return ;
+	}
+	if ( ! RING_API_ISNUMBER(1) ) {
+		RING_API_ERROR(RING_API_BADPARATYPE);
+		return ;
+	}
+	if ( ! RING_API_ISNUMBER(2) ) {
+		RING_API_ERROR(RING_API_BADPARATYPE);
+		return ;
+	}
+	if ( ! RING_API_ISNUMBER(3) ) {
+		RING_API_ERROR(RING_API_BADPARATYPE);
+		return ;
+	}
+	glMultiTexCoord2d( (GLenum )  (int) RING_API_GETNUMBER(1), (GLdouble ) RING_API_GETNUMBER(2), (GLdouble ) RING_API_GETNUMBER(3));
 }

 RING_API void ringlib_init(RingState *pRingState)
@@ -5991,4 +6013,5 @@
 	ring_vm_funcregister("glmultitexcoord2s",ring_glMultiTexCoord2s);
 	ring_vm_funcregister("glmultitexcoord2i",ring_glMultiTexCoord2i);
 	ring_vm_funcregister("glmultitexcoord2f",ring_glMultiTexCoord2f);
-}
+	ring_vm_funcregister("glmultitexcoord2d",ring_glMultiTexCoord2d);
+}


- Some cleanup in skill.c, moved the icewall flag check to skill_notok.

git-svn-id: c1e39603916b71782cde5facdf0b79eff05c1414@5360 54d463be-8e91-2dee-dedb-b68131a5f0ec

--- src/map/skill.c
+++ src/map/skill.c
@@ -751,6 +751,12 @@
 		case MC_VENDING:
 		case MC_IDENTIFY:
 			return 0; // always allowed
+		case WZ_ICEWALL:
+			// noicewall flag [Valaris]
+			if (map[sd->bl.m].flag.noicewall) {
+				clif_skill_fail(sd,sd->skillid,0,0);
+				return 1;
+			}
 		default:
 			return (map[sd->bl.m].flag.noskill);
 	}
@@ -1540,9 +1546,6 @@
 	if (bl->type == BL_PC)
 		tsd = (struct map_session_data *)bl;

-//Shouldn't be needed, skillnotok's return value is highly unlikely to have changed after you started casting. [Skotlex]
-//	if(dsrc->type == BL_PC && skillnotok(skillid, (struct map_session_data *)dsrc))
-//		return 0; // [MouseJstr]
 // Is this check really needed? FrostNova won't hurt you if you step right where the caster is?
 	if(skillid == WZ_FROSTNOVA && dsrc->x == bl->x && dsrc->y == bl->y) //gpXLt?Xgm@?Adsrcbl??Ȃ牽Ȃ
 		return 0;
@@ -3058,9 +3061,6 @@

 	if (skillid > 0 && skillid < MAX_SKILL)
 		type = SkillStatusChangeTable[skillid];
-//Shouldn't be needed, skillnotok's return value is highly unlikely to have changed after you started casting. [Skotlex]
-//	if (sd && skillnotok(skillid, sd)) // [MouseJstr]
-//		return 0;

 	//Check for undead skills that convert a no-damage skill into a damage one. [Skotlex]
 	switch (skillid) {
@@ -5863,16 +5863,12 @@
 	if (sc && !sc->count)
 		sc = NULL; //Unneeded.

-	if( skillid != WZ_METEOR &&
+	if(skillid != WZ_METEOR &&
 		skillid != AM_CANNIBALIZE &&
 		skillid != AM_SPHEREMINE &&
 		skillid != CR_CULTIVATION &&
 		skillid != AC_SHOWER)
 		clif_skill_poseffect(src,skillid,skilllv,x,y,tick);
-
-//Shouldn't be needed, skillnotok's return value is highly unlikely to have changed after you started casting. [Skotlex]
-//	if (sd && skillnotok(skillid, sd)) // [MouseJstr]
-//		return 0;

 	switch(skillid)
 	{
@@ -6151,10 +6147,6 @@

 	if( sd->bl.prev == NULL || pc_isdead(sd) )
 		return 0;
-
-//Shouldn't be needed, skillnotok's return value is highly unlikely to have changed after you started casting. [Skotlex]
-//	if(skillnotok(skill_num, sd))
-//		return 0;

 	if(sd->sc.opt1 || sd->sc.option&OPTION_HIDE ) {
 		skill_failed(sd);
@@ -8432,11 +8424,10 @@

 	if(skillnotok(skill_num, sd)) // [MouseJstr]
 		return 0;
-	if (tsd && (skill_num == ALL_RESURRECTION || skill_num == PR_REDEMPTIO) && !pc_isdead(tsd))
-		return 0;
-
+
 	if(skill_get_inf2(skill_num)&INF2_NO_TARGET_SELF && sd->bl.id == target_id)
 		return 0;
+
 	if(!status_check_skilluse(&sd->bl, bl, skill_num, 0))
 	{
 		if(skill_num == PR_LEXAETERNA) //Eh.. assuming skill failed due to opponent frozen/stone-cursed. [Skotlex]
@@ -8657,18 +8648,12 @@

 	nullpo_retr(0, sd);

-	if (pc_isdead(sd))
-		return 0;
 	if (skill_lv <= 0)
 		return 0;
 	if (sd->skilltimer != -1) //Normally not needed since clif.c checks for it, but at/char/script commands don't! [Skotlex]
 		return 0;
 	if (skillnotok(skill_num, sd)) // [MouseJstr]
 		return 0;
-	if (skill_num == WZ_ICEWALL && map[sd->bl.m].flag.noicewall && !map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.gvg)  { // noicewall flag [Valaris]
-		clif_skill_fail(sd,sd->skillid,0,0);
-		return 0;
-	}
 	if (map_getcell(sd->bl.m, skill_x, skill_y, CELL_CHKNOPASS))
 	{	//prevent casting ground targeted spells on non-walkable areas. [Skotlex]


convert two if conditions to yoda conditions

--- src/dyndnsd.c
+++ src/dyndnsd.c
@@ -146,7 +146,7 @@
 		for (ssize_t i = 0; i < nev; i++) {

 			/* SIGTERM event */
-			if (events[i].ident == SIGTERM) {
+			if (SIGTERM == events[i].ident) {
 				syslog(LOG_NOTICE, "SIGTERM received. Terminating...");
 				goto end;
 			}
@@ -269,7 +269,7 @@
 	for (i = 1; i; i <<= 1) {
 		if (flags & i) {
 			sa = (struct sockaddr *)cp;
-			if (i == RTA_IFA)
+			if (RTA_IFA == i)
 				return sa;
 			ADVANCE(cp, sa);
 		}


curve udah jalan

curve udah jalan

--- src/drawing.c
+++ src/drawing.c
@@ -304,10 +304,14 @@
     }

 	// Draw Curve
-	for (i = 0; i < n_curve; i++){
+	for (i = 0; i <= n_curve; i++){
+        canvas_draw_bezier( curves[i].px, curves[i].py, curves[i].color );
+
+    }
+	/*for (i = 0; i < n_curve; i++){
 		canvas_draw_bezier( curves[i].px, curves[i].py, curves[i].color );

-	}
+	}*/

 	//Draw polygons


fix bug that phy_enter_critical cannot effect on dual-core

Sometimes, libphy.a call phy_enter_critical() to protect accessing
critical sections, such like operating on I2C, but it may not effect
when both the CPU core call it. It may cause accessing I2C blocking
and cannot recover by esp_restart(), until do HW reboot.

--- components/esp_wifi/src/phy_init.c
+++ components/esp_wifi/src/phy_init.c
@@ -75,14 +75,28 @@
 static int64_t s_phy_rf_en_ts = 0;
 #endif

+static DRAM_ATTR portMUX_TYPE s_phy_int_mux = portMUX_INITIALIZER_UNLOCKED;
+
 uint32_t IRAM_ATTR phy_enter_critical(void)
 {
-    return portENTER_CRITICAL_NESTED();
+    if (xPortInIsrContext()) {
+        portENTER_CRITICAL_ISR(&s_phy_int_mux);
+
+    } else {
+        portENTER_CRITICAL(&s_phy_int_mux);
+    }
+    // Interrupt level will be stored in current tcb, so always return zero.
+    return 0;
 }

 void IRAM_ATTR phy_exit_critical(uint32_t level)
 {
-    portEXIT_CRITICAL_NESTED(level);
+    // Param level don't need any more, ignore it.
+    if (xPortInIsrContext()) {
+        portEXIT_CRITICAL_ISR(&s_phy_int_mux);
+    } else {
+        portEXIT_CRITICAL(&s_phy_int_mux);
+    }
 }

 #if CONFIG_IDF_TARGET_ESP32


Update RingOpenGL - Add Function (Source Code) : void gluNurbsCurve(GLUnurbs* nurb,GLint knotCount,GLfloat * knots,GLint stride,GLfloat * control,GLint order,GLenum type)

--- extensions/ringopengl/ring_opengl21.c
+++ extensions/ringopengl/ring_opengl21.c
@@ -11508,6 +11508,44 @@
 		return ;
 	}
 	gluNextContour((GLUtesselator *) RING_API_GETCPOINTER(1,"GLUtesselator"), (GLenum )  (int) RING_API_GETNUMBER(2));
+}
+
+
+RING_FUNC(ring_gluNurbsCurve)
+{
+	if ( RING_API_PARACOUNT != 7 ) {
+		RING_API_ERROR(RING_API_BADPARACOUNT);
+		return ;
+	}
+	if ( ! RING_API_ISPOINTER(1) ) {
+		RING_API_ERROR(RING_API_BADPARATYPE);
+		return ;
+	}
+	if ( ! RING_API_ISNUMBER(2) ) {
+		RING_API_ERROR(RING_API_BADPARATYPE);
+		return ;
+	}
+	if ( ! RING_API_ISPOINTER(3) ) {
+		RING_API_ERROR(RING_API_BADPARATYPE);
+		return ;
+	}
+	if ( ! RING_API_ISNUMBER(4) ) {
+		RING_API_ERROR(RING_API_BADPARATYPE);
+		return ;
+	}
+	if ( ! RING_API_ISPOINTER(5) ) {
+		RING_API_ERROR(RING_API_BADPARATYPE);
+		return ;
+	}
+	if ( ! RING_API_ISNUMBER(6) ) {
+		RING_API_ERROR(RING_API_BADPARATYPE);
+		return ;
+	}
+	if ( ! RING_API_ISNUMBER(7) ) {
+		RING_API_ERROR(RING_API_BADPARATYPE);
+		return ;
+	}
+	gluNurbsCurve((GLUnurbs *) RING_API_GETCPOINTER(1,"GLUnurbs"), (GLint ) RING_API_GETNUMBER(2),(GLfloat *) RING_API_GETCPOINTER(3,"GLfloat"), (GLint ) RING_API_GETNUMBER(4),(GLfloat *) RING_API_GETCPOINTER(5,"GLfloat"), (GLint ) RING_API_GETNUMBER(6), (GLenum )  (int) RING_API_GETNUMBER(7));
 }

 RING_API void ringlib_init(RingState *pRingState)
@@ -12081,4 +12119,5 @@
 	ring_vm_funcregister("glunewquadric",ring_gluNewQuadric);
 	ring_vm_funcregister("glunewtess",ring_gluNewTess);
 	ring_vm_funcregister("glunextcontour",ring_gluNextContour);
-}
+	ring_vm_funcregister("glunurbscurve",ring_gluNurbsCurve);
+}


Fixed basepage access when debug was enabled.

--- nlisttree_mcc/NListtree.c
+++ nlisttree_mcc/NListtree.c
@@ -1489,7 +1489,7 @@
 */
 BOOL GetVisualEntries( struct NListtree_Data *data, struct MUI_NListtree_TreeNode *tn, LONG pos, LONG *ent )
 {
-	D(bug("GetVisualEntries()  tn 0x%lx  pos %ld  *ent %ld\n",tn,pos,*ent));
+	D(bug("tn=0x%lx pos=%ld  *ent %ld\n",tn,pos,ent?(*ent):0));
 	if ( tn->tn_Flags & TNF_LIST )
 	{
 		struct MUI_NListtree_TreeNode *tn2;
@@ -1511,9 +1511,7 @@
 		}
 		else
 		{
-			D(bug( "Table  %ld\n",tn2->tn_IFlags & TNIF_VISIBLE ) );
-
-			if ( tn->tn_Flags & TNF_OPEN )
+			if (tn->tn_Flags & TNF_OPEN)
 			{
 				ULONG i;
 				struct Table *tb = &CLN( tn )->ln_Table;


add rand_minmax to math.h

add rand_minmax to math.h

--- src/math/math.h
+++ src/math/math.h
@@ -87,6 +87,10 @@
   return rand() * INV_RAND_MAX;
 }

+ct_inline float ct_rand_minmax(const float min, const float max) {
+  return ct_rand_normpos() * (max - min) + min;
+}
+
 ct_inline int ct_signumf(const float x, const float eps) {
   if (ct_deltaeqf(x, 0.f, eps)) {
     return 0;


remove the !WEBP_REFERENCE_IMPLEMENTATION tweak in Put8x8uv

There's no speed diff, so better remove it altogether

Reported in https://code.google.com/p/webp/issues/detail?id=215

Change-Id: I991330de18bec340029d6df5fed0dfb4337e4662

--- src/dsp/dec.c
+++ src/dsp/dec.c
@@ -417,14 +417,9 @@
 // helper for chroma-DC predictions
 static WEBP_INLINE void Put8x8uv(uint8_t value, uint8_t* dst) {
   int j;
-#ifndef WEBP_REFERENCE_IMPLEMENTATION
-  const uint64_t v = (uint64_t)value * 0x0101010101010101ULL;
   for (j = 0; j < 8; ++j) {
-    *(uint64_t*)(dst + j * BPS) = v;
-  }
-#else
-  for (j = 0; j < 8; ++j) memset(dst + j * BPS, value, 8);
-#endif
+    memset(dst + j * BPS, value, 8);
+  }
 }

 static void DC8uv(uint8_t *dst) {     // DC


minor fix: indentation

minor fix: indentation

--- sample/exafmm-dev-13274dd4ac68/include/traversal.h
+++ sample/exafmm-dev-13274dd4ac68/include/traversal.h
@@ -44,18 +44,18 @@
       countWeight(Ci, Cj, mutual, remote);                      //  Increment M2L weight
     } else if (Ci->NCHILD == 0 && Cj->NCHILD == 0) {            // Else if both cells are bodies
       if (Cj->NBODY == 0) {                                     //  If the bodies weren't sent from remote node
-	std::cout << Ci->ICELL << " " << Cj->ICELL << std::endl;
-	kernel::M2L(Ci, Cj, Xperiodic, mutual);                 //   M2L kernel
+				std::cout << Ci->ICELL << " " << Cj->ICELL << std::endl;
+				kernel::M2L(Ci, Cj, Xperiodic, mutual);                 //   M2L kernel
         countKernel(numM2L);                                    //   Increment M2L counter
-	countWeight(Ci, Cj, mutual, remote);                    //   Increment M2L weight
+				countWeight(Ci, Cj, mutual, remote);                    //   Increment M2L weight
       } else {                                                  //  Else if the bodies were sent
-	if (R2 == 0 && Ci == Cj) {                              //   If source and target are same
-	  kernel::P2P(Ci);                                      //    P2P kernel for single cell
-	} else {                                                //   Else if source and target are different
-	  kernel::P2P(Ci, Cj, Xperiodic, mutual);               //    P2P kernel for pair of cells
-	}                                                       //   End if for same source and target
-	countKernel(numP2P);                                    //   Increment P2P counter
-	countWeight(Ci, Cj, mutual, remote);                    //   Increment P2P weight
+				if (R2 == 0 && Ci == Cj) {                              //   If source and target are same
+					kernel::P2P(Ci);                                      //    P2P kernel for single cell
+				} else {                                                //   Else if source and target are different
+					kernel::P2P(Ci, Cj, Xperiodic, mutual);               //    P2P kernel for pair of cells
+				}                                                       //   End if for same source and target
+				countKernel(numP2P);                                    //   Increment P2P counter
+				countWeight(Ci, Cj, mutual, remote);                    //   Increment P2P weight
       }                                                         //  End if for bodies
     } else {                                                    // Else if cells are close but not bodies
       splitCell(Ci, Cj, Xperiodic, mutual, remote);             //  Split cell and call function recursively for child
@@ -81,42 +81,42 @@
       Tracer tracer;                                            //  Instantiate tracer
       logger::startTracer(tracer);                              //  Start tracer
       if (CiEnd - CiBegin == 1 || CjEnd - CjBegin == 1) {       //  If only one cell in range
-	if (CiBegin == CjBegin) {                               //   If Ci == Cj
-	  assert(CiEnd == CjEnd);                               //    Check if mutual & self interaction
-	  traversal->traverse(CiBegin, CjBegin, Xperiodic, mutual, remote);// Call traverse for single pair
-	} else {                                                //   If Ci != Cj
-	  for (C_iter Ci=CiBegin; Ci!=CiEnd; Ci++) {            //    Loop over all Ci cells
-	    for (C_iter Cj=CjBegin; Cj!=CjEnd; Cj++) {          //     Loop over all Cj cells
-	      traversal->traverse(Ci, Cj, Xperiodic, mutual, remote); // Call traverse for single pair
-	    }                                                   //     End loop over all Cj cells
-	  }                                                     //    End loop over all Ci cells
-	}                                                       //   End if for Ci == Cj
+				if (CiBegin == CjBegin) {                               //   If Ci == Cj
+					assert(CiEnd == CjEnd);                               //    Check if mutual & self interaction
+					traversal->traverse(CiBegin, CjBegin, Xperiodic, mutual, remote);// Call traverse for single pair
+				} else {                                                //   If Ci != Cj
+					for (C_iter Ci=CiBegin; Ci!=CiEnd; Ci++) {            //    Loop over all Ci cells
+						for (C_iter Cj=CjBegin; Cj!=CjEnd; Cj++) {          //     Loop over all Cj cells
+							traversal->traverse(Ci, Cj, Xperiodic, mutual, remote); // Call traverse for single pair
+						}                                                   //     End loop over all Cj cells
+					}                                                     //    End loop over all Ci cells
+				}                                                       //   End if for Ci == Cj
       } else {                                                  //  If many cells are in the range
-	C_iter CiMid = CiBegin + (CiEnd - CiBegin) / 2;         //   Split range of Ci cells in half
-	C_iter CjMid = CjBegin + (CjEnd - CjBegin) / 2;         //   Split range of Cj cells in half
-	mk_task_group;                                          //   Initialize task group
-	{
-	  TraverseRange leftBranch(traversal, CiBegin, CiMid,   //    Instantiate recursive functor
-				   CjBegin, CjMid, Xperiodic, mutual, remote);
-	  create_taskc(leftBranch);                             //    Ci:former Cj:former
-	  TraverseRange rightBranch(traversal, CiMid, CiEnd,    //    Instantiate recursive functor
-				    CjMid, CjEnd, Xperiodic, mutual, remote);
-	  rightBranch();                                        //    Ci:latter Cj:latter
-	  wait_tasks;                                           //    Synchronize task group
-	}
-	{
-	  TraverseRange leftBranch(traversal, CiBegin, CiMid,   //    Instantiate recursive functor
-				   CjMid, CjEnd, Xperiodic, mutual, remote);
-	  create_taskc(leftBranch);                             //    Ci:former Cj:latter
-	  if (!mutual || CiBegin != CjBegin) {                  //    Exclude mutual & self interaction
+				C_iter CiMid = CiBegin + (CiEnd - CiBegin) / 2;         //   Split range of Ci cells in half
+				C_iter CjMid = CjBegin + (CjEnd - CjBegin) / 2;         //   Split range of Cj cells in half
+				mk_task_group;                                          //   Initialize task group
+				{
+					TraverseRange leftBranch(traversal, CiBegin, CiMid,   //    Instantiate recursive functor
+																	 CjBegin, CjMid, Xperiodic, mutual, remote);
+					create_taskc(leftBranch);                             //    Ci:former Cj:former
+					TraverseRange rightBranch(traversal, CiMid, CiEnd,    //    Instantiate recursive functor
+																		CjMid, CjEnd, Xperiodic, mutual, remote);
+					rightBranch();                                        //    Ci:latter Cj:latter
+					wait_tasks;                                           //    Synchronize task group
+				}
+				{
+					TraverseRange leftBranch(traversal, CiBegin, CiMid,   //    Instantiate recursive functor
+																	 CjMid, CjEnd, Xperiodic, mutual, remote);
+					create_taskc(leftBranch);                             //    Ci:former Cj:latter
+					if (!mutual || CiBegin != CjBegin) {                  //    Exclude mutual & self interaction
             TraverseRange rightBranch(traversal, CiMid, CiEnd,  //    Instantiate recursive functor
-				      CjBegin, CjMid, Xperiodic, mutual, remote);
-	    rightBranch();                                      //    Ci:latter Cj:former
-	  } else {                                              //    If mutual or self interaction
-	    assert(CiEnd == CjEnd);                             //     Check if mutual & self interaction
-	  }                                                     //    End if for mutual & self interaction
-	  wait_tasks;                                           //    Synchronize task group
-	}
+																			CjBegin, CjMid, Xperiodic, mutual, remote);
+						rightBranch();                                      //    Ci:latter Cj:former
+					} else {                                              //    If mutual or self interaction
+						assert(CiEnd == CjEnd);                             //     Check if mutual & self interaction
+					}                                                     //    End if for mutual & self interaction
+					wait_tasks;                                           //    Synchronize task group
+				}
       }                                                         //  End if for many cells in range
       logger::stopTracer(tracer);                               //  Stop tracer
     }                                                           // End overload operator()
@@ -267,33 +267,33 @@
     C_iter Cj;                                                  //!< Iterator of source cell
     int prange;                                                 //!< Range of periodic images
     real_t cycle;                                               //!< Periodic cycle
-    DirectRecursion(C_iter _Ci, C_iter _Cj, int _prange, real_t _cycle) :// Constructor
-      Ci(_Ci), Cj(_Cj), prange(_prange), cycle(_cycle) {}       // Initialize variables
+	DirectRecursion(C_iter _Ci, C_iter _Cj, int _prange, real_t _cycle) :// Constructor
+		Ci(_Ci), Cj(_Cj), prange(_prange), cycle(_cycle) {}       // Initialize variables
     void operator() () {                                        // Overload operator
       if (Ci->NBODY < 25) {                                     // If number of target bodies is less than threshold
-	vec3 Xperiodic = 0;                                     //   Periodic coordinate offset
-	for (int ix=-prange; ix<=prange; ix++) {                //   Loop over x periodic direction
-	  for (int iy=-prange; iy<=prange; iy++) {              //    Loop over y periodic direction
-	    for (int iz=-prange; iz<=prange; iz++) {            //     Loop over z periodic direction
-	      Xperiodic[0] = ix * cycle;                        //      Coordinate shift for x periodic direction
-	      Xperiodic[1] = iy * cycle;                        //      Coordinate shift for y periodic direction
-	      Xperiodic[2] = iz * cycle;                        //      Coordinate shift for z periodic direction
-	      kernel::P2P(Ci, Cj, Xperiodic, false);            //      Evaluate P2P kernel
-	    }                                                   //     End loop over z periodic direction
-	  }                                                     //    End loop over y periodic direction
-	}                                                       //   End loop over x periodic direction
+				vec3 Xperiodic = 0;                                     //   Periodic coordinate offset
+				for (int ix=-prange; ix<=prange; ix++) {                //   Loop over x periodic direction
+					for (int iy=-prange; iy<=prange; iy++) {              //    Loop over y periodic direction
+						for (int iz=-prange; iz<=prange; iz++) {            //     Loop over z periodic direction
+							Xperiodic[0] = ix * cycle;                        //      Coordinate shift for x periodic direction
+							Xperiodic[1] = iy * cycle;                        //      Coordinate shift for y periodic direction
+							Xperiodic[2] = iz * cycle;                        //      Coordinate shift for z periodic direction
+							kernel::P2P(Ci, Cj, Xperiodic, false);            //      Evaluate P2P kernel
+						}                                                   //     End loop over z periodic direction
+					}                                                     //    End loop over y periodic direction
+				}                                                       //   End loop over x periodic direction
       } else {                                                  // If number of target bodies is more than threshold
         Cells cells; cells.resize(1);                           //  Initialize new cell vector
-	C_iter Ci2 = cells.begin();                             //  New cell iterator for right branch
-	Ci2->BODY = Ci->BODY + Ci->NBODY / 2;                   //  Set begin iterator to handle latter half
-	Ci2->NBODY = Ci->NBODY - Ci->NBODY / 2;                 //  Set range to handle latter half
-	Ci->NBODY = Ci->NBODY / 2;                              //  Set range to handle first half
-	mk_task_group;                                          //  Initialize task group
+				C_iter Ci2 = cells.begin();                             //  New cell iterator for right branch
+				Ci2->BODY = Ci->BODY + Ci->NBODY / 2;                   //  Set begin iterator to handle latter half
+				Ci2->NBODY = Ci->NBODY - Ci->NBODY / 2;                 //  Set range to handle latter half
+				Ci->NBODY = Ci->NBODY / 2;                              //  Set range to handle first half
+				mk_task_group;                                          //  Initialize task group
         DirectRecursion leftBranch(Ci, Cj, prange, cycle);      //  Instantiate recursive functor
-	create_taskc(leftBranch);                               //  Create new task for left branch
-	DirectRecursion rightBranch(Ci2, Cj, prange, cycle);    //  Instantiate recursive functor
-	rightBranch();                                          //  Use old task for right branch
-	wait_tasks;                                             //  Synchronize task group
+				create_taskc(leftBranch);                               //  Create new task for left branch
+				DirectRecursion rightBranch(Ci2, Cj, prange, cycle);    //  Instantiate recursive functor
+				rightBranch();                                          //  Use old task for right branch
+				wait_tasks;                                             //  Synchronize task group
       }                                                         // End if for NBODY threshold
     }                                                           // End operator
   };


[DeviceDriver] Fix can infinite loop when can driver send error

 - in _can_int_tx if can driver sendmsg do not return RT_EOK,
   it will repeat until sendmsg return RT_EOK
 - if error occur on can bus(wire broken or EMI), all threads that
   have lower priority will not be executed
 - we should let application layer to determine if resend is appropriate
   when send fail, besides in data link layer, can already implemented
   auto resend in hardware

--- components/drivers/can/can.c
+++ components/drivers/can/can.c
@@ -158,10 +158,10 @@
         {
             /* send failed. */
             level = rt_hw_interrupt_disable();
-            rt_list_insert_after(&tx_fifo->freelist, &tx_tosnd->list);
+            rt_list_insert_before(&tx_fifo->freelist, &tx_tosnd->list);
             rt_hw_interrupt_enable(level);
             rt_sem_release(&(tx_fifo->sem));
-            continue;
+            goto err_ret;
         }

         can->status.sndchange = 1;
@@ -189,6 +189,7 @@
         }
         else
         {
+err_ret:
             level = rt_hw_interrupt_disable();
             can->status.dropedsndpkg++;
             rt_hw_interrupt_enable(level);


Update RingOpenGL - Add Function (Source Code) : int glXGetFBConfigAttrib(Display * dpy,GLXFBConfig config,int attribute,int * value)

--- extensions/ringopengl/ring_opengl21.c
+++ extensions/ringopengl/ring_opengl21.c
@@ -12585,6 +12585,31 @@
 		*pValue = glXGetCurrentReadDrawable();
 		RING_API_RETCPOINTER(pValue,"GLXDrawable");
 	}
+}
+
+
+RING_FUNC(ring_glXGetFBConfigAttrib)
+{
+	if ( RING_API_PARACOUNT != 4 ) {
+		RING_API_ERROR(RING_API_MISS4PARA);
+		return ;
+	}
+	if ( ! RING_API_ISPOINTER(1) ) {
+		RING_API_ERROR(RING_API_BADPARATYPE);
+		return ;
+	}
+	if ( ! RING_API_ISNUMBER(3) ) {
+		RING_API_ERROR(RING_API_BADPARATYPE);
+		return ;
+	}
+	if ( ! RING_API_ISSTRING(4) ) {
+		RING_API_ERROR(RING_API_BADPARATYPE);
+		return ;
+	}
+	RING_API_RETNUMBER(glXGetFBConfigAttrib((Display *) RING_API_GETCPOINTER(1,"Display"),* (GLXFBConfig  *) RING_API_GETCPOINTER(2,"GLXFBConfig"), (int ) RING_API_GETNUMBER(3),RING_API_GETINTPOINTER(4)));
+	if (RING_API_ISCPOINTERNOTASSIGNED(2))
+		free(RING_API_GETCPOINTER(2,"GLXFBConfig"));
+	RING_API_ACCEPTINTVALUE(4) ;
 }

 RING_API void ringlib_init(RingState *pRingState)
@@ -13203,4 +13228,5 @@
 	ring_vm_funcregister("glxgetcurrentdisplay",ring_glXGetCurrentDisplay);
 	ring_vm_funcregister("glxgetcurrentdrawable",ring_glXGetCurrentDrawable);
 	ring_vm_funcregister("glxgetcurrentreaddrawable",ring_glXGetCurrentReadDrawable);
-}
+	ring_vm_funcregister("glxgetfbconfigattrib",ring_glXGetFBConfigAttrib);
+}


fix INFOs in websocket code

fix INFOs in websocket code

--- common/common_websocket.c
+++ common/common_websocket.c
@@ -111,7 +111,7 @@
 #else
 			SERROR_CHECK(ioctl(frame->parent->int_sock, FIONREAD, &int_avail) != -1, "ioctl() failed!");
 #endif
-			SINFO("int_avail: %d", int_avail);
+			SDEBUG("int_avail: %d", int_avail);
 			if (int_avail < WEBSOCKET_HEADER_LENGTH) {
 				bol_error_state = false;
 				SFREE(buf);
@@ -251,9 +251,9 @@
 		frame->cb(EV_A, frame);
 	}

-	SINFO("int_request_len: %d", int_request_len);
-	SINFO("client_message->int_position: %d", client_message->int_position);
-	SINFO("frame->int_length: %d", frame->int_length);
+	SDEBUG("int_request_len: %d", int_request_len);
+	SDEBUG("client_message->int_position: %d", client_message->int_position);
+	SDEBUG("frame->int_length: %d", frame->int_length);
 	bol_error_state = false;
 	SFREE(buf);
 	return;


WARNING, etc. macros: add

WARNING, etc. macros: add

Signed-off-by: Simon McVittie <2b470b34502dbf3ba4bcc04ea7e64f4e0e104f33@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=55391
Reviewed-by: Xavier Claessens <6f61b6f8ca6f7cbeae6bb087ddf85cf85dce43eb@collabora.co.uk>

--- src/mcd-debug.h
+++ src/mcd-debug.h
@@ -47,6 +47,15 @@

 #endif /* ENABLE_DEBUG */

+#define MESSAGE(format, ...) \
+  g_message ("%s: " format, G_STRFUNC, ##__VA_ARGS__)
+#define WARNING(format, ...) \
+  g_warning ("%s: " format, G_STRFUNC, ##__VA_ARGS__)
+#define CRITICAL(format, ...) \
+  g_critical ("%s: " format, G_STRFUNC, ##__VA_ARGS__)
+#define ERROR(format, ...) \
+  g_error ("%s: " format, G_STRFUNC, ##__VA_ARGS__)
+
 extern gint mcd_debug_level;

 void mcd_debug_init (void);


Modified make error.

Modified make error.

--- autoload/proc.c
+++ autoload/proc.c
@@ -487,7 +487,7 @@
                 strerror(errno));
     }

-    pid_t pid = fork();
+    pid = fork();
 #endif
     if (pid < 0) {
         return vp_stack_return_error(&_result, "forkpty() error: %s",
@@ -500,7 +500,7 @@
         close(slave);
         if (execv(argv[0], argv) < 0) {
             /* error */
-            write(fdm, strerror(errno), strlen(strerror(errno)));
+            write(master, strerror(errno), strlen(strerror(errno)));
             _exit(EXIT_FAILURE);
         }
     } else {


perf python: Add PERF_RECORD_{LOST,READ,SAMPLE} routine tables

So those friggin "spurious" PERF_RECORD_MMAP events were actually a
brain fart copy'n'paste error in the python binding, doh. I.e. they
weren't MMAPs, just SAMPLEs.

Fix it by providing routines for these events instead of using the MMAP
ones.

Cc: David Ahern <b80c1600f604d3b0d768f26f90a76757e76005dd@gmail.com>
Cc: Frederic Weisbecker <e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com>
Cc: Mike Galbraith <3cfa3897b7f55b5396b7a47c83b66325184bc9b4@gmx.de>
Cc: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>
Cc: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Cc: Stephane Eranian <f199ae9781930a5b94b284ca2f471140752002a7@google.com>
Link: 56109e301ef92206f0edabe7411c1327d788f61f@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>

--- tools/perf/util/python.c
+++ tools/perf/util/python.c
@@ -187,14 +187,117 @@
 	.tp_repr	= (reprfunc)pyrf_throttle_event__repr,
 };

+static char pyrf_lost_event__doc[] = PyDoc_STR("perf lost event object.");
+
+static PyMemberDef pyrf_lost_event__members[] = {
+	sample_members
+	member_def(lost_event, id, T_ULONGLONG, "event id"),
+	member_def(lost_event, lost, T_ULONGLONG, "number of lost events"),
+	{ .name = NULL, },
+};
+
+static PyObject *pyrf_lost_event__repr(struct pyrf_event *pevent)
+{
+	PyObject *ret;
+	char *s;
+
+	if (asprintf(&s, "{ type: lost, id: %#" PRIx64 ", "
+			 "lost: %#" PRIx64 " }",
+		     pevent->event.lost.id, pevent->event.lost.lost) < 0) {
+		ret = PyErr_NoMemory();
+	} else {
+		ret = PyString_FromString(s);
+		free(s);
+	}
+	return ret;
+}
+
+static PyTypeObject pyrf_lost_event__type = {
+	PyVarObject_HEAD_INIT(NULL, 0)
+	.tp_name	= "perf.lost_event",
+	.tp_basicsize	= sizeof(struct pyrf_event),
+	.tp_flags	= Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,
+	.tp_doc		= pyrf_lost_event__doc,
+	.tp_members	= pyrf_lost_event__members,
+	.tp_repr	= (reprfunc)pyrf_lost_event__repr,
+};
+
+static char pyrf_read_event__doc[] = PyDoc_STR("perf read event object.");
+
+static PyMemberDef pyrf_read_event__members[] = {
+	sample_members
+	member_def(read_event, pid, T_UINT, "event pid"),
+	member_def(read_event, tid, T_UINT, "event tid"),
+	{ .name = NULL, },
+};
+
+static PyObject *pyrf_read_event__repr(struct pyrf_event *pevent)
+{
+	return PyString_FromFormat("{ type: read, pid: %u, tid: %u }",
+				   pevent->event.read.pid,
+				   pevent->event.read.tid);
+	/*
+ 	 * FIXME: return the array of read values,
+ 	 * making this method useful ;-)
+ 	 */
+}
+
+static PyTypeObject pyrf_read_event__type = {
+	PyVarObject_HEAD_INIT(NULL, 0)
+	.tp_name	= "perf.read_event",
+	.tp_basicsize	= sizeof(struct pyrf_event),
+	.tp_flags	= Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,
+	.tp_doc		= pyrf_read_event__doc,
+	.tp_members	= pyrf_read_event__members,
+	.tp_repr	= (reprfunc)pyrf_read_event__repr,
+};
+
+static char pyrf_sample_event__doc[] = PyDoc_STR("perf sample event object.");
+
+static PyMemberDef pyrf_sample_event__members[] = {
+	sample_members
+	member_def(perf_event_header, type, T_UINT, "event type"),
+	{ .name = NULL, },
+};
+
+static PyObject *pyrf_sample_event__repr(struct pyrf_event *pevent)
+{
+	PyObject *ret;
+	char *s;
+
+	if (asprintf(&s, "{ type: sample }") < 0) {
+		ret = PyErr_NoMemory();
+	} else {
+		ret = PyString_FromString(s);
+		free(s);
+	}
+	return ret;
+}
+
+static PyTypeObject pyrf_sample_event__type = {
+	PyVarObject_HEAD_INIT(NULL, 0)
+	.tp_name	= "perf.sample_event",
+	.tp_basicsize	= sizeof(struct pyrf_event),
+	.tp_flags	= Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,
+	.tp_doc		= pyrf_sample_event__doc,
+	.tp_members	= pyrf_sample_event__members,
+	.tp_repr	= (reprfunc)pyrf_sample_event__repr,
+};
+
 static int pyrf_event__setup_types(void)
 {
 	int err;
 	pyrf_mmap_event__type.tp_new =
 	pyrf_task_event__type.tp_new =
 	pyrf_comm_event__type.tp_new =
+	pyrf_lost_event__type.tp_new =
+	pyrf_read_event__type.tp_new =
+	pyrf_sample_event__type.tp_new =
 	pyrf_throttle_event__type.tp_new = PyType_GenericNew;
 	err = PyType_Ready(&pyrf_mmap_event__type);
+	if (err < 0)
+		goto out;
+	err = PyType_Ready(&pyrf_lost_event__type);
 	if (err < 0)
 		goto out;
 	err = PyType_Ready(&pyrf_task_event__type);
@@ -206,20 +309,26 @@
 	err = PyType_Ready(&pyrf_throttle_event__type);
 	if (err < 0)
 		goto out;
+	err = PyType_Ready(&pyrf_read_event__type);
+	if (err < 0)
+		goto out;
+	err = PyType_Ready(&pyrf_sample_event__type);
+	if (err < 0)
+		goto out;
 out:
 	return err;
 }

 static PyTypeObject *pyrf_event__type[] = {
 	[PERF_RECORD_MMAP]	 = &pyrf_mmap_event__type,
-	[PERF_RECORD_LOST]	 = &pyrf_mmap_event__type,
+	[PERF_RECORD_LOST]	 = &pyrf_lost_event__type,
 	[PERF_RECORD_COMM]	 = &pyrf_comm_event__type,
 	[PERF_RECORD_EXIT]	 = &pyrf_task_event__type,
 	[PERF_RECORD_THROTTLE]	 = &pyrf_throttle_event__type,
 	[PERF_RECORD_UNTHROTTLE] = &pyrf_throttle_event__type,
 	[PERF_RECORD_FORK]	 = &pyrf_task_event__type,
-	[PERF_RECORD_READ]	 = &pyrf_mmap_event__type,
-	[PERF_RECORD_SAMPLE]	 = &pyrf_mmap_event__type,
+	[PERF_RECORD_READ]	 = &pyrf_read_event__type,
+	[PERF_RECORD_SAMPLE]	 = &pyrf_sample_event__type,
 };

 static PyObject *pyrf_event__new(union perf_event *event)


MSVC: Rely on noexcept for SFINAE

MSVC: Rely on noexcept for SFINAE

MSVC fails to compile the enable_ifs. It should work equally well via
SFINAE of the noexcept operator.

Refs: gh-119
Signed-off-by: Matthias Kretz <372ea4eca737a13cd010ee806d4ce7b98ee71550@kde.org>

--- common/elementreference.h
+++ common/elementreference.h
@@ -57,12 +57,8 @@
     }

     template <typename T>
-        Vc_INTRINSIC enable_if<
-            std::is_same<void, decltype(Accessor::set(std::declval<U &>(), int(),
-                                                      std::declval<T>()))>::value,
-            ElementReference &>
-        operator=(T &&x) &&
-        noexcept(set_noexcept<T>())
+        Vc_INTRINSIC ElementReference &operator=(T &&x) &&
+        noexcept(noexcept(Accessor::set(std::declval<U &>(), int(), std::declval<T>())))
     {
         Accessor::set(obj, index, std::forward<T>(x));
         return *this;
@@ -73,14 +69,9 @@
 #define Vc_OP_(op_)                                                                      \
     template <typename T, typename R = decltype(std::declval<const value_type &>()       \
                                                     op_ std::declval<T>())>              \
-        Vc_INTRINSIC enable_if<                                                          \
-            std::is_same<void, decltype(Accessor::set(std::declval<U &>(), int(),        \
-                                                      std::declval<R &&>()))>::value,    \
-            ElementReference &>                                                          \
-        operator op_##=(T &&x) &&                                                        \
-        noexcept(get_noexcept &&                                                         \
-                 set_noexcept<decltype(std::declval<const value_type &>()                \
-                                           op_ std::declval<T>())>())                    \
+        Vc_INTRINSIC ElementReference &operator op_##=(T &&x) &&                         \
+        noexcept(get_noexcept && noexcept(Accessor::set(std::declval<U &>(), int(),      \
+                                                        std::declval<R &&>())))          \
     {                                                                                \
         const value_type &lhs = Accessor::get(obj, index);                               \
         Accessor::set(obj, index, lhs op_ std::forward<T>(x));                           \


mds flock: make get_overlapping_locks and share_space handle 0 lengths

Signed-off-by: Greg Farnum <0bcb4295d38ee745130ea5f2bb88ef4eef474e61@dreamhost.com>

--- src/mds/flock.h
+++ src/mds/flock.h
@@ -465,7 +465,12 @@
   }
   bool share_space(multimap<uint64_t, ceph_filelock>::iterator& iter,
 		   ceph_filelock& lock) {
-    return share_space(iter, lock.start, lock.start+lock.length-1);
+    uint64_t end = lock.start;
+    if (lock.length)
+      end += lock.length - 1;
+    else // zero length means to end-of-file
+      end = uint64_t(-1);
+    return share_space(iter, lock.start, end);
   }

   /*
@@ -481,12 +486,23 @@
     // create a lock starting one earlier and ending one later
     // to check for neighbors
     ceph_filelock neighbor_check_lock = lock;
-    neighbor_check_lock.start = neighbor_check_lock.start - 1;
-    if (neighbor_check_lock.length)
-      neighbor_check_lock.length = neighbor_check_lock.length+ 2;
+    if (neighbor_check_lock.start != 0) {
+      neighbor_check_lock.start = neighbor_check_lock.start - 1;
+      if (neighbor_check_lock.length)
+        neighbor_check_lock.length = neighbor_check_lock.length + 2;
+    } else {
+      if (neighbor_check_lock.length)
+        neighbor_check_lock.length = neighbor_check_lock.length + 1;
+    }
     //find the last held lock starting at the point after lock
+    uint64_t endpoint = lock.start;
+    if (lock.length) {
+      endpoint += lock.length;
+    } else {
+      endpoint = uint64_t(-1); // max offset
+    }
     multimap<uint64_t, ceph_filelock>::iterator iter =
-      get_last_before(lock.start + lock.length, held_locks);
+      get_last_before(endpoint, held_locks);
     bool cont = iter != held_locks.end();
     while(cont) {
       if (share_space(iter, lock)) {


perf symbols: Call the symbol filter in dso__synthesize_plt_symbols()

We need to pass the symbol to the filter so that, for instance,
'perf top' can do filtering and also set the private area it
manages, setting the ->map pointer, etc.

I found this while running 'perf top' on a machine where hits
happened on PLT symbols, where ->map wasn't being set up and
segfaults thus happened.

Signed-off-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>
Cc: Frederic Weisbecker <e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com>
Cc: Mike Galbraith <3cfa3897b7f55b5396b7a47c83b66325184bc9b4@gmx.de>
Cc: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>
Cc: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
LKML-Reference: <790b2bfc038f0df4f97ce605b9fe096ebac7f780@infradead.org>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>

--- tools/perf/util/symbol.c
+++ tools/perf/util/symbol.c
@@ -281,6 +281,11 @@
 		if (sym == NULL)
 			goto out_delete_line;

+		/*
+		 * We will pass the symbols to the filter later, in
+		 * kernel_maps__split_kallsyms, when we have split the
+		 * maps per module
+		 */
 		dso__insert_symbol(kernel_map->dso, sym);
 	}

@@ -555,7 +560,8 @@
  * And always look at the original dso, not at debuginfo packages, that
  * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS).
  */
-static int dso__synthesize_plt_symbols(struct  dso *self)
+static int dso__synthesize_plt_symbols(struct  dso *self, struct map *map,
+				       symbol_filter_t filter)
 {
 	uint32_t nr_rel_entries, idx;
 	GElf_Sym sym;
@@ -643,8 +649,12 @@
 			if (!f)
 				goto out_elf_end;

-			dso__insert_symbol(self, f);
-			++nr;
+			if (filter && filter(map, f))
+				symbol__delete(f);
+			else {
+				dso__insert_symbol(self, f);
+				++nr;
+			}
 		}
 	} else if (shdr_rel_plt.sh_type == SHT_REL) {
 		GElf_Rel pos_mem, *pos;
@@ -661,8 +671,12 @@
 			if (!f)
 				goto out_elf_end;

-			dso__insert_symbol(self, f);
-			++nr;
+			if (filter && filter(map, f))
+				symbol__delete(f);
+			else {
+				dso__insert_symbol(self, f);
+				++nr;
+			}
 		}
 	}

@@ -1050,7 +1064,7 @@
 		goto more;

 	if (ret > 0) {
-		int nr_plt = dso__synthesize_plt_symbols(self);
+		int nr_plt = dso__synthesize_plt_symbols(self, map, filter);
 		if (nr_plt > 0)
 			ret += nr_plt;
 	}


mds: fix replica state for mix->sync

mds: fix replica state for mix->sync

Should be mix->sync(2): the same as a replica who already go the first
SYNC message and is waiting in mix->sync(2) for the final SYNC to indicate
the gather is completed.

--- src/mds/locks.c
+++ src/mds/locks.c
@@ -85,7 +85,7 @@
     [LOCK_SYNC]      = { 0,         false, LOCK_SYNC, ANY,  0,   ANY, 0,   0,   ANY, 0,   CEPH_CAP_GSHARED|CEPH_CAP_GCACHE|CEPH_CAP_GRD,0,0,CEPH_CAP_GSHARED|CEPH_CAP_GCACHE|CEPH_CAP_GRD },
     [LOCK_LOCK_SYNC] = { LOCK_SYNC, false, LOCK_LOCK, AUTH, 0,   0,   0,   0,   0,   0,   CEPH_CAP_GCACHE,0,0,0 },
     [LOCK_EXCL_SYNC] = { LOCK_SYNC, true,  LOCK_LOCK, 0,    0,   0,   0,   XCL, 0,   0,   0,CEPH_CAP_GSHARED|CEPH_CAP_GCACHE|CEPH_CAP_GRD,0,0 },
-    [LOCK_MIX_SYNC]  = { LOCK_SYNC, false, LOCK_MIX,  0,    0,   0,   0,   0,   0,   0,   CEPH_CAP_GRD|CEPH_CAP_GLAZYIO,0,0,CEPH_CAP_GRD },
+    [LOCK_MIX_SYNC]  = { LOCK_SYNC, false, LOCK_MIX_SYNC2,0,0,   0,   0,   0,   0,   0,   CEPH_CAP_GRD|CEPH_CAP_GLAZYIO,0,0,CEPH_CAP_GRD },
     [LOCK_MIX_SYNC2] = { LOCK_SYNC, false, 0,         0,    0,   0,   0,   0,   0,   0,   CEPH_CAP_GRD|CEPH_CAP_GLAZYIO,0,0,CEPH_CAP_GRD },
     [LOCK_SNAP_SYNC] = { LOCK_SYNC, false, LOCK_LOCK, 0,    0,   0,   0,   AUTH,0,   0,   0,0,0,0 },


Fixed a bug introduced in r1181 where clicking and dragging the last anchor in a project would cause other notes in the project to be deleted.

--- src/menu/edit.c
+++ src/menu/edit.c
@@ -988,7 +988,7 @@
 	char text[EOF_MAX_LYRIC_LENGTH+1] = {0};
 	unsigned long notepos = 0;
 	long notelength = 0;
-	char affect_all = 0;	//Is set to nonzero if all notes in the project are affected by this operation
+	char affect_until_end = 0;	//Is set to nonzero if all notes until the end of the project are affected by this operation

 	for(i = 0; i < EOF_TRACKS_MAX; i++)
 	{
@@ -1001,7 +1001,7 @@
 	start_pos = eof_song->beat[last_anchor]->pos;
 	if((next_anchor < 0) || (option == 1))
 	{	//If there was no following anchor, or the notes are being auto-adjusted
-		affect_all = 1;	//All notes in the project are to be deleted and replaced from the auto-adjust file
+		affect_until_end = 1;	//Track this condition, as the last beat's position may now be before some notes and may no longer be a suitable end point
 	}
 	else
 	{
@@ -1019,8 +1019,8 @@
 		for(i = eof_get_track_size(eof_song, j); i > 0; i--)
 		{	//For each note in the track, in reverse order
 			notepos = eof_get_note_pos(eof_song, j, i - 1);
-			if(affect_all || ((notepos + eof_get_note_length(eof_song, j, i - 1) >= start_pos) && (notepos < end_pos)))
-			{	//If the note is in the affected range of the chart
+			if((notepos + eof_get_note_length(eof_song, j, i - 1) >= start_pos) && (affect_until_end || (notepos < end_pos)))
+			{	//If the note is in the affected range of the chart (between affected anchors or between an anchor and the end of the project)
 				eof_track_delete_note(eof_song, j, i - 1);	//Delete the note
 			}
 		}


End in the appropriate directories when running actions

--- src/action.c
+++ src/action.c
@@ -46,6 +46,7 @@
 int main(int argc, char **argv) {
     struct image_object image;
     char *command;
+    char *dir = get_current_dir_name();

     singularity_config_init(joinpath(SYSCONFDIR, "/singularity/singularity.conf"));
     singularity_registry_init();
@@ -75,6 +76,12 @@

     singularity_priv_drop_perm();

+    if ( is_dir(dir) == 0 ) {
+        chdir(dir);
+    } else {
+        chdir(singularity_priv_home());
+    }
+
     setenv("SINGULARITY_CONTAINER", singularity_image_name(&image), 1);
     command = singularity_registry_get("COMMAND");


Fixed invalid counter value readings from GPA sample data

--- source/compute_engine/opencl/gpa_profiling_instance.h
+++ source/compute_engine/opencl/gpa_profiling_instance.h
@@ -69,6 +69,7 @@
         }

         checkGPAError(gpaFunctions.GPA_EndSession(session), "GPA_EndSession");
+        checkGPAError(gpaFunctions.GPA_IsSessionComplete(session), "GPA_IsSessionComplete");

         KernelProfilingData result;
         size_t sampleSizeInBytes;
@@ -97,7 +98,7 @@
             switch (counterType)
             {
             case GPA_DATA_TYPE_FLOAT64:
-                value.doubleValue = static_cast<double>(sampleData[i]);
+                value.doubleValue = *(reinterpret_cast<double*>(&sampleData[i]));
                 type = ProfilingCounterType::Double;
                 break;
             case GPA_DATA_TYPE_UINT64:


OverlayException.h

OverlayException.h

error: pathspec 'stheno/src/org/cracs/stheno/core/p2p/exception/OverlayException.h' did not match any file(s) known to git

--- stheno/src/org/cracs/stheno/core/p2p/exception/OverlayException.h
+++ stheno/src/org/cracs/stheno/core/p2p/exception/OverlayException.h
@@ -0,0 +1,51 @@
+/*
+ *  Copyright 2012 Rolando Martins, CRACS & INESC-TEC, DCC/FCUP
+ *
+ *  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.
+ *
+ */
+/*
+ * File:   OverlayException.h
+ * Author: Rolando Martins (rolando.martins@gmail.com)
+ *
+ * Created on May 12, 2010, 11:38 AM
+ */
+
+#ifndef OVERLAYEXCEPTION_H
+#define	OVERLAYEXCEPTION_H
+
+#include <euryale/common/exception/Exception.h>
+
+class OverlayException : public Exception {
+public:
+
+    static const char* INVALID_OVERLAY;
+    static const char* PRIMITIVE_NOT_IMPLEMENTED;
+    static const char* BOOTSTRAP_FAILED;
+
+    OverlayException(const char* exception);
+    OverlayException(const String& message);
+    OverlayException(const OverlayException&);
+    virtual ~OverlayException();
+
+    virtual const String& message();
+    virtual const char* objectID() const;
+    virtual const String& toString();
+
+private:
+    String m_messageString;
+};
+
+
+#endif	/* OVERLAYEXCEPTION_H */
+


Fixed more errors

Fixed more errors

--- jni/PocketPC/tile/BeaconTile.h
+++ jni/PocketPC/tile/BeaconTile.h
@@ -1,16 +1,15 @@
 #pragma once

-#include "mcpe/tile/EntityTile.h"
+#include "mcpe/tile/Tile.h"
 #include "mcpe/item/Item.h"
 #include "mcpe/util/Random.h"
-//#include "mcpe/level/tileentity/BeaconTileEntity.h"

-class BeaconTile: public EntityTile {
+class BeaconTile: public Tile {
 public:
 	BeaconTile(int);

 	virtual const TextureUVCoordinateSet& getTexture(signed char, int);
-	//virtual TileEntity* newTileEntity(const TilePos &);
+	Tile* isCubeShaped()

 private:
 	TextureUVCoordinateSet secondary_tex;


Dispatch events asynchronously

Dispatch events asynchronously

Summary: This diff fixes the dispaching of Async Events in Android C++ layer to ensure proper asynchronouns dispatching in the JS thread.

Reviewed By: shergin

Differential Revision: D12988348

fbshipit-source-id: 7aa60b11e2c264c2e68354ed83eb75139060d211

--- ReactCommon/fabric/events/EventBeat.h
+++ ReactCommon/fabric/events/EventBeat.h
@@ -58,13 +58,13 @@
    */
   void setFailCallback(const FailCallback &failCallback);

- protected:
   /*
    * Should be used by sublasses to send a beat.
    * Receiver might ignore the call if a beat was not requested.
    */
   void beat(jsi::Runtime &runtime) const;

+ protected:
   BeatCallback beatCallback_;
   FailCallback failCallback_;
   mutable std::atomic<bool> isRequested_{false};


undefined min/max in OpenGL.h

undefined min/max in OpenGL.h

--- 3rdparty/GL/OpenGL.h
+++ 3rdparty/GL/OpenGL.h
@@ -3,6 +3,9 @@
 #include <gl/glew.h>
 #include <gl/wglew.h>
 #include <GL/GL.h>
+
+#undef min
+#undef max
 #elif PLATFORM_LINUX
 #include <GL/glew.h>
 #include <GL/gl.h>


set %USERPROFILE% since LoginUserW won't

--- src/elevate.c
+++ src/elevate.c
@@ -192,7 +192,6 @@
   toWideChar(parameters, &wparameters);

   HANDLE hToken;
-  LPVOID lpvEnv;

   PROCESS_INFORMATION pi;
   ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
@@ -205,9 +204,9 @@
     wbail(127, "LogonUser");
   }

-  if (!CreateEnvironmentBlock(&lpvEnv, hToken, TRUE)) {
-    wbail(127, "CreateEnvironmentBlock");
-  }
+  // don't have enough permissions to NetUserGetInfo
+  // C:\Users is a constant even on non-English windows
+  SetEnvironmentVariableW(L"USERPROFILE", L"C:\\Users\\itch-player");

   wchar_t *ExePath;
   toWideChar(argv[4], &ExePath);
@@ -240,7 +239,9 @@

   if (!CreateProcessWithLogonW(wuser, L".", wpassword,
     LOGON_WITH_PROFILE, wcommand, wparameters,
-    CREATE_UNICODE_ENVIRONMENT, lpvEnv, DirPath,
+    0,
+    NULL, // inherit parent environment
+    DirPath,
     &si, &pi)) {
     wbail(127, "CreateProcessWithLogonW");
   }
@@ -251,10 +252,6 @@
   if (GetExitCodeProcess(pi.hProcess, &code) == 0) {
     // Not sure when this could ever happen.
     wbail(127, "failed GetExitCodeProcess call");
-  }
-
-  if (!DestroyEnvironmentBlock(lpvEnv)) {
-    wbail(127, "failed DestroyEnvironmentBlock call");
   }

   CloseHandle(hToken);


STYLE:Fixed some too long lines.

STYLE:Fixed some too long lines.

--- Rendering/vtkOpenGLExtensionManager.h
+++ Rendering/vtkOpenGLExtensionManager.h
@@ -166,7 +166,8 @@
   // Description:
   // Returns a function pointer to the OpenGL extension function with the
   // given name.  Returns NULL if the function could not be retrieved.
-  virtual vtkOpenGLExtensionManagerFunctionPointer GetProcAddress(const char *fname);
+  virtual vtkOpenGLExtensionManagerFunctionPointer GetProcAddress(
+    const char *fname);
 //ETX

   // Description:
@@ -268,9 +269,9 @@

   // Description:
   // Wrap around the generated vtkgl::LoadExtension to deal with OpenGL 1.2
-  // and its optional part GL_ARB_imaging. Also functions like glBlendEquation()
-  // or glBlendColor are optional in OpenGL 1.2 or 1.3 and provided by the
-  // GL_ARB_imaging but there are core features in OpenGL 1.4.
+  // and its optional part GL_ARB_imaging. Also functions like
+  // glBlendEquation() or glBlendColor() are optional in OpenGL 1.2 or 1.3 and
+  // provided by the GL_ARB_imaging but there are core features in OpenGL 1.4.
   virtual int SafeLoadExtension(const char *name);

 private:


Add more debugging prints for rendering debugging

--- src/dvb-sub.c
+++ src/dvb-sub.c
@@ -651,7 +651,8 @@
 				else {
 					if (map_table)
 						bits = map_table[bits];
-					g_print ("READ_nBIT_STRING (4): Putting value 0x%x in destbuf %d times\n", bits, run_length);
+					g_print ("READ_nBIT_STRING (4): Putting value 0x%x in destbuf %d times [pixels_read = %d, dbuf_len = %d, all will be added = %s]\n",
+					         bits, run_length, pixels_read, dbuf_len, ((pixels_read + run_length) < dbuf_len) ? "TRUE" : "FALSE");
 					while (run_length-- > 0 && pixels_read < dbuf_len) {
 						*destbuf++ = bits;
 						pixels_read++;
@@ -671,6 +672,8 @@
 						else {
 							if (map_table)
 								bits = map_table[bits];
+							g_print ("READ_nBIT_STRING (4): Putting value 0x%x in destbuf %d times [pixels_read = %d, dbuf_len = %d, all will be added = %s]\n",
+							         bits, run_length, pixels_read, dbuf_len, ((pixels_read + run_length) < dbuf_len) ? "TRUE" : "FALSE");
 							while (run_length-- > 0 && pixels_read < dbuf_len) {
 								*destbuf++ = bits;
 								pixels_read++;
@@ -686,6 +689,8 @@
 						else {
 							if (map_table)
 								bits = map_table[bits];
+							g_print ("READ_nBIT_STRING (4): Putting value 0x%x in destbuf %d times [pixels_read = %d, dbuf_len = %d, all will be added = %s]\n",
+							         bits, run_length, pixels_read, dbuf_len, ((pixels_read + run_length) < dbuf_len) ? "TRUE" : "FALSE");
 							while (run_length-- > 0 && pixels_read < dbuf_len) {
 								*destbuf++ = bits;
 								pixels_read++;
@@ -698,6 +703,7 @@
 						else
 							bits = 0;
 						if (pixels_read <= dbuf_len) {
+							g_print ("READ_nBIT_STRING (4): Putting value 0x%x in destbuf 2 times (hardcoded)\n", bits);
 							*destbuf++ = bits;
 							*destbuf++ = bits;
 						}
@@ -710,6 +716,7 @@
 						bits = map_table[0];
 					else
 						bits = 0;
+					g_print ("READ_nBIT_STRING (4): Putting value 0x%x in destbuf 1 times (hardcoded)\n", bits);
 					*destbuf++ = bits;
 					pixels_read++;
 				}
@@ -762,7 +769,7 @@
 	                    0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
 	guint8 *map_table;

-	g_print ("DVB pixel block size %d, %s field:\n", buf_size,
+	g_print ("READ_PIXEL_DATA_BLOCK: DVB pixel block size %d, %s field:\n", buf_size,
 	         top_bottom ? "bottom" : "top");

 #ifdef DEBUG_PACKET_CONTENTS
@@ -816,6 +823,7 @@

 				/* FIXME: I don't see any guards about buffer size here - buf++ happens with the switch, but size
 				 * FIXME: passed is the global size apparently? */
+				g_print ("READ_nBIT_STRING (4): String data into position %dx%d\n", x_pos, y_pos);
 				x_pos += _dvb_sub_read_4bit_string(pbuf + (y_pos * region->width) + x_pos,
 				                                   region->width - x_pos, &buf, buf_size,
 				                                   non_mod, map_table);
@@ -834,23 +842,27 @@
 				break;

 			case 0x20:
+				g_print ("READ_nBIT_PIXEL_DATA_BLOCK: handling map2to4 table data\n");
 				/* FIXME: I don't see any guards about buffer size here - buf++ happens with the switch, but
-				 * FIXME: buffer is walked without length checks? */
+				 * FIXME: buffer is walked without length checks? Same deal in other map table cases */
 				map2to4[0] = (*buf) >> 4;
 				map2to4[1] = (*buf++) & 0xf;
 				map2to4[2] = (*buf) >> 4;
 				map2to4[3] = (*buf++) & 0xf;
 				break;
 			case 0x21:
+				g_print ("READ_nBIT_PIXEL_DATA_BLOCK: handling map2to8 table data\n");
 				for (i = 0; i < 4; i++)
 					map2to8[i] = *buf++;
 				break;
 			case 0x22:
+				g_print ("READ_nBIT_PIXEL_DATA_BLOCK: handling map4to8 table data\n");
 				for (i = 0; i < 16; i++)
 					map4to8[i] = *buf++;
 				break;

 			case 0xf0:
+				g_print ("READ_nBIT_PIXEL_DATA_BLOCK: end of object line code encountered\n");
 				x_pos = display->x_pos;
 				y_pos += 2;
 				break;
@@ -875,6 +887,8 @@
 	buf += 2;

 	object = get_object (dvb_sub, object_id);
+
+	g_print ("READ_nBIT_PRE - parse_object_segment: A new object segment has occurred\n");

 	if (!object) {
 		g_warning ("Nothing known about object with ID %u yet inside parse_object_segment, bailing out", object_id);


fix some undefined behaviour

fix some undefined behaviour

--- src/misc/opts.c
+++ src/misc/opts.c
@@ -184,8 +184,10 @@
 	int argc = *argcp;

 	// create writable copy of opts
-	struct opt_s wopts[n];
-	memcpy(wopts, opts, sizeof wopts);
+	struct opt_s wopts[n ?: 1];
+
+	if (NULL != opts)
+		memcpy(wopts, opts, sizeof wopts);

 	int max_num_long_opts = (int) ' ';


Fixed 64-bit warning.

Fixed 64-bit warning.

--- 3rdparty/fcpp/cpp2.c
+++ 3rdparty/fcpp/cpp2.c
@@ -627,7 +627,7 @@

     char **incptr;
     char tmpname[NWORK]; /* Filename work area    */
-    int len;
+    size_t len;

     #if HOST == SYS_AMIGADOS
     if( strchr (filename, ':') != NULL )


abort on a place if the place has no character

--- libswfdec/swfdec_sprite_movie.c
+++ libswfdec/swfdec_sprite_movie.c
@@ -254,7 +254,7 @@
     graphic = swfdec_swf_decoder_get_character (SWFDEC_SWF_DECODER (mov->swf->decoder), id);
     if (!SWFDEC_IS_GRAPHIC (graphic)) {
       SWFDEC_FIXME ("character %u is not a graphic (does it even exist?), aborting", id);
-      return TRUE;
+      return FALSE;
     }
     cur = swfdec_movie_new (player, depth, mov, graphic, name);
     swfdec_movie_set_static_properties (cur, has_transform ? &transform : NULL,


Fix T48508: Cycles Regression / Crash

Fix T48508: Cycles Regression / Crash

--- src/kernel/kernel_shadow.h
+++ src/kernel/kernel_shadow.h
@@ -126,8 +126,6 @@
 				/* stop if all light is blocked */
 				if(is_zero(throughput)) {
 					/* free dynamic storage */
-					if(hits != hits_stack)
-						free(hits);
 					return true;
 				}


pg_get_paddr wip

pg_get_paddr wip

error: pathspec 'src/mm/paging.c' did not match any file(s) known to git


Cleanup code a bit

Cleanup code a bit

--- 433Mhz/433Mhz_test.c
+++ 433Mhz/433Mhz_test.c
@@ -13,7 +13,6 @@
     srand(time(NULL));

     bool CODE_RECEIVED = false;
-
     while(!CODE_RECEIVED) {
         // Is the switch available?
         if (rand() % 2) {
@@ -23,10 +22,9 @@

             // Sleep for two seconds simulating capture event.
             sleep(2);
-
             if (value == 0) {
                 // Unknown encoding
-                printf("%i\n", value);
+                printf("0\n");
             } else {
                 // Simulate receiving a delay
                 int delay = (rand() % 200) + 100;


Don't ignore xmlNodeDump return code

Don't ignore xmlNodeDump return code

This should not fail, ever, unless we run out of memory. But since I was
looking at that code, having a sanity check here is better in case this
does become more relevant in future (and simply because not checking it
was not good prectice).

--- src/as-xml.c
+++ src/as-xml.c
@@ -94,13 +94,20 @@

 	str = g_string_new ("");
 	for (iter = node->children; iter != NULL; iter = iter->next) {
+		gint r;
+
 		/* discard spaces */
 		if (iter->type != XML_ELEMENT_NODE) {
-					continue;
-		}
-
-		nodeBuf = xmlBufferCreate();
-		xmlNodeDump (nodeBuf, NULL, iter, 0, 1);
+			continue;
+		}
+
+		nodeBuf = xmlBufferCreate ();
+		r = xmlNodeDump (nodeBuf, NULL, iter, 0, 1);
+		if (r < 0) {
+			xmlBufferFree (nodeBuf);
+			g_warning ("xmlNodeDump failed (%i) while serializing node children.", r);
+			continue;
+		}
 		if (str->len > 0)
 			g_string_append (str, "\n");
 		g_string_append_printf (str, "%s", (const gchar*) nodeBuf->content);


Fix compilation error of CUDA kernels after recent volume commit

Apparently the code path with malloc() was enabled for CUDA.

--- src/kernel/kernel_volume.h
+++ src/kernel/kernel_volume.h
@@ -627,6 +627,11 @@
 		step_size = kernel_data.integrator.volume_step_size;
 		/* compute exact steps in advance for malloc */
 		max_steps = max((int)ceilf(ray->t/step_size), 1);
+		if(max_steps > global_max_steps) {
+			max_steps = global_max_steps;
+			step_size = ray->t / (float)max_steps;
+		}
+#ifdef __KERNEL_CPU__
 		/* NOTE: For the branched path tracing it's possible to have direct
 		 * and indirect light integration both having volume segments allocated.
 		 * We detect this using index in the pre-allocated memory. Currently we
@@ -640,17 +645,16 @@
 		const int index = kg->decoupled_volume_steps_index;
 		assert(index < sizeof(kg->decoupled_volume_steps) /
 		               sizeof(*kg->decoupled_volume_steps));
-		if(max_steps > global_max_steps) {
-			max_steps = global_max_steps;
-			step_size = ray->t / (float)max_steps;
-		}
 		if(kg->decoupled_volume_steps[index] == NULL) {
 			kg->decoupled_volume_steps[index] =
 			        (VolumeStep*)malloc(sizeof(VolumeStep)*global_max_steps);
 		}
 		segment->steps = kg->decoupled_volume_steps[index];
+		++kg->decoupled_volume_steps_index;
+#else
+		segment->steps = (VolumeStep*)malloc(sizeof(VolumeStep)*max_steps);
+#endif
 		random_jitter_offset = lcg_step_float(&state->rng_congruential) * step_size;
-		++kg->decoupled_volume_steps_index;
 	}
 	else {
 		max_steps = 1;
@@ -764,12 +768,16 @@
 ccl_device void kernel_volume_decoupled_free(KernelGlobals *kg, VolumeSegment *segment)
 {
 	if(segment->steps != &segment->stack_step) {
+#ifdef __KERNEL_CPU__
 		/* NOTE: We only allow free last allocated segment.
 		 * No random order of alloc/free is supported.
 		 */
 		assert(kg->decoupled_volume_steps_index > 0);
 		assert(segment->steps == kg->decoupled_volume_steps[kg->decoupled_volume_steps_index - 1]);
 		--kg->decoupled_volume_steps_index;
+#else
+		free(segment->steps);
+#endif
 	}
 }


added missing space in request header sent to the backend server

git-svn-id: e98c317c6679dcf055eb388f05b44c3a6d6b38c6@275 152afb58-edef-0310-8abb-c4023f1b3aa9

--- src/mod_proxy.c
+++ src/mod_proxy.c
@@ -389,6 +389,7 @@

 	/* request line */
 	buffer_copy_string_buffer(write_buffer, con->request.http_method_name);
+	BUFFER_APPEND_STRING_CONST(write_buffer, " ");
 	buffer_append_string_buffer(write_buffer, con->request.uri);
 	BUFFER_APPEND_STRING_CONST(write_buffer, " HTTP/1.0\r\n");


update

update

update


fixed #75

fixed #75


lib-lda: Added %{to_envelope} to deliver_log_format

--- src/lib-lda/mail-deliver.c
+++ src/lib-lda/mail-deliver.c
@@ -67,6 +67,7 @@
 		{ 'w', NULL, "vsize" },
 		{ '\0', NULL, "delivery_time" },
 		{ '\0', NULL, "session_time" },
+		{ '\0', NULL, "to_envelope" },
 		{ '\0', NULL, NULL }
 	};
 	struct var_expand_table *tab;
@@ -97,6 +98,7 @@
 		mail_deliver_log_var_expand_table_update_times(ctx, tab);
 		tab[8].value = dec2str(ctx->session_time_msecs);
 	}
+	tab[9].value = ctx->dest_addr;
 	return tab;
 }


* src/augrun.c (nexttoken): print unknown escape sequences

This makes it easier to debug this error.

--- src/augrun.c
+++ src/augrun.c
@@ -160,7 +160,7 @@
                     s += 1;
                     break;
                 default:
-                    ERR_REPORT(cmd, AUG_ECMDRUN, "unknown escape sequence");
+                    ERR_REPORT(cmd, AUG_ECMDRUN, "unknown escape sequence: %c", *(s+1));
                     return NULL;
             }
         }


Compatibility.

Compatibility.

--- MS6/kernel/cpu/gridding/utils.h
+++ MS6/kernel/cpu/gridding/utils.h
@@ -41,13 +41,13 @@
 struct Vector3 {
   Expr fields[_VECTOR_FIELDS];
   Vector3(Expr a1, Expr a2, Expr a3)
-      : fields({ a1, a2, a3 })
+      : fields{ a1, a2, a3 }
     { }
   Vector3(FuncRefVar f)
-      : fields({ Tuple(f)[_A1], Tuple(f)[_A2], Tuple(f)[_A3] })
+      : fields{ Tuple(f)[_A1], Tuple(f)[_A2], Tuple(f)[_A3] }
     { }
   Vector3(FuncRefExpr f)
-      : fields({ Tuple(f)[_A1], Tuple(f)[_A2], Tuple(f)[_A3] })
+      : fields{ Tuple(f)[_A1], Tuple(f)[_A2], Tuple(f)[_A3] }
     { }
   Expr operator [](int i) const { return fields[i]; }
   operator Tuple() {
@@ -71,19 +71,19 @@
 struct Matrix {
   Expr fields[_MATRIX_FIELDS];
   Matrix(Expr a11, Expr a12, Expr a13, Expr a21, Expr a22, Expr a23, Expr a31, Expr a32, Expr a33)
-      : fields({ a11, a12, a13, a21, a22, a23, a31, a32, a33 })
+      : fields{ a11, a12, a13, a21, a22, a23, a31, a32, a33 }
     { }
   Matrix(Tuple f)
-      : fields({ Tuple(f)[_A11], Tuple(f)[_A12], Tuple(f)[_A13]
-               , Tuple(f)[_A21], Tuple(f)[_A22], Tuple(f)[_A23]
-               , Tuple(f)[_A31], Tuple(f)[_A32], Tuple(f)[_A33]
-               })
+      : fields{ Tuple(f)[_A11], Tuple(f)[_A12], Tuple(f)[_A13]
+              , Tuple(f)[_A21], Tuple(f)[_A22], Tuple(f)[_A23]
+              , Tuple(f)[_A31], Tuple(f)[_A32], Tuple(f)[_A33]
+              }
     { }
   Matrix(FuncRefVar f)
-      : fields({ Tuple(f)[_A11], Tuple(f)[_A12], Tuple(f)[_A13]
-               , Tuple(f)[_A21], Tuple(f)[_A22], Tuple(f)[_A23]
-               , Tuple(f)[_A31], Tuple(f)[_A32], Tuple(f)[_A33]
-               })
+      : fields{ Tuple(f)[_A11], Tuple(f)[_A12], Tuple(f)[_A13]
+              , Tuple(f)[_A21], Tuple(f)[_A22], Tuple(f)[_A23]
+              , Tuple(f)[_A31], Tuple(f)[_A32], Tuple(f)[_A33]
+              }
     { }
   Expr operator [](int i) const { return fields[i]; }
   operator Tuple() {


baseboard/intelrvp/led.c: Format with clang-format

BUG=b:236386294
BRANCH=none
TEST=none

Change-Id: If125604449235c8c8354275bdd0da599f9aea8a0
Signed-off-by: Jack Rosenthal <d3f605bef1867f59845d4ce6e4f83b8dc9e4e0ae@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3727900
Reviewed-by: Jeremy Bettis <4df7b5147fee087dca33c181f288ee7dbf56e022@chromium.org>

--- baseboard/intelrvp/led.c
+++ baseboard/intelrvp/led.c
@@ -19,30 +19,30 @@
 const int led_charge_lvl_2 = 97;

 struct led_descriptor led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
-	[STATE_CHARGING_LVL_1]	     = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
-	[STATE_CHARGING_LVL_2]	     = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
-	[STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN,  LED_INDEFINITE} },
-	[STATE_DISCHARGE_S0]	     = {{LED_OFF,  LED_INDEFINITE} },
-	[STATE_DISCHARGE_S3]	     = {{LED_OFF,  LED_INDEFINITE} },
-	[STATE_DISCHARGE_S5]         = {{LED_OFF,  LED_INDEFINITE} },
-	[STATE_BATTERY_ERROR]        = {{EC_LED_COLOR_RED,  1 * LED_ONE_SEC},
-					{LED_OFF,	    1 * LED_ONE_SEC} },
-	[STATE_FACTORY_TEST]         = {{EC_LED_COLOR_RED,   2 * LED_ONE_SEC},
-					{EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
+	[STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED, LED_INDEFINITE } },
+	[STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER, LED_INDEFINITE } },
+	[STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+					   LED_INDEFINITE } },
+	[STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+	[STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+	[STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+	[STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+				  { LED_OFF, 1 * LED_ONE_SEC } },
+	[STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+				 { EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC } },
 };

 const struct led_descriptor
-		led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
-	[PWR_LED_STATE_ON]           = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
-	[PWR_LED_STATE_SUSPEND_AC]   = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
-					{LED_OFF,	   1 * LED_ONE_SEC} },
-	[PWR_LED_STATE_OFF]           = {{LED_OFF, LED_INDEFINITE} },
-};
+	led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+		[PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+		[PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+						 1 * LED_ONE_SEC },
+					       { LED_OFF, 1 * LED_ONE_SEC } },
+		[PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+	};

-const enum ec_led_id supported_led_ids[] = {
-	EC_LED_ID_POWER_LED,
-	EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED,
+					     EC_LED_ID_BATTERY_LED };

 const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);

@@ -51,15 +51,15 @@
 	if (color == EC_LED_COLOR_WHITE)
 #ifdef CONFIG_ZEPHYR
 		gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(led_white_l),
-							LED_ON_LVL);
+				LED_ON_LVL);
 #else
 		gpio_set_level(GPIO_PWR_LED_WHITE_L, LED_ON_LVL);
 #endif /* CONFIG_ZEPHYR */
 	else
-		/* LED_OFF and unsupported colors */
+	/* LED_OFF and unsupported colors */
 #ifdef CONFIG_ZEPHYR
 		gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(led_white_l),
-							LED_OFF_LVL);
+				LED_OFF_LVL);
 #else
 		gpio_set_level(GPIO_PWR_LED_WHITE_L, LED_OFF_LVL);
 #endif /* CONFIG_ZEPHYR */
@@ -70,32 +70,28 @@
 	switch (color) {
 	case EC_LED_COLOR_RED:
 #ifdef CONFIG_ZEPHYR
-		gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(led_red_l),
-							LED_ON_LVL);
+		gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(led_red_l), LED_ON_LVL);
 #else
 		gpio_set_level(GPIO_BAT_LED_RED_L, LED_ON_LVL);
 #endif /* CONFIG_ZEPHYR */
 		break;
 	case EC_LED_COLOR_AMBER:
 #ifdef CONFIG_ZEPHYR
-		gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(led_red_l),
-							LED_ON_LVL);
+		gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(led_red_l), LED_ON_LVL);
 #else
 		gpio_set_level(GPIO_BAT_LED_RED_L, LED_ON_LVL);
 #endif /* CONFIG_ZEPHYR */
 		break;
 	case EC_LED_COLOR_GREEN:
 #ifdef CONFIG_ZEPHYR
-		gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(led_red_l),
-							LED_OFF_LVL);
+		gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(led_red_l), LED_OFF_LVL);
 #else
 		gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
 #endif /* CONFIG_ZEPHYR */
 		break;
 	default: /* LED_OFF and other unsupported colors */
 #ifdef CONFIG_ZEPHYR
-		gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(led_red_l),
-							LED_OFF_LVL);
+		gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(led_red_l), LED_OFF_LVL);
 #else
 		gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
 #endif /* CONFIG_ZEPHYR */


Initialize response before use.

Initialize response before use.

--- src/element.c
+++ src/element.c
@@ -423,7 +423,7 @@

 cJSON *remove_element_from_peer(const struct peer *p, const cJSON *request)
 {
-	cJSON *response;
+	cJSON *response = NULL;
 	const cJSON *params = get_params(p, request, &response);
 	if (unlikely(params == NULL)) {
 		return response;


pgsql: Removed accidentally committed debug code.

--HG--
branch : HEAD

--- src/lib-sql/driver-pgsql.c
+++ src/lib-sql/driver-pgsql.c
@@ -387,7 +387,6 @@
 	i_assert(!db->querying);
 	i_assert(db->connected);

-	i_warning("%s", query);
 	if (!PQsendQuery(db->pg, query)) {
 		db->connected = FALSE;
 		result_finish(result);