Fixed a small issue with glCompressedTexImage2D if color space compression fail

--- src/gl/texture.c
+++ src/gl/texture.c
@@ -2066,16 +2066,18 @@
             half=pixels;
             glstate->texture.bound[glstate->texture.active]->alpha = (internalformat==GL_COMPRESSED_RGB_S3TC_DXT1_EXT)?false:true;
             format = (internalformat==GL_COMPRESSED_RGB_S3TC_DXT1_EXT)?GL_RGB:GL_RGBA;
-            glstate->texture.bound[glstate->texture.active]->format = format; //internalformat;
             type = (internalformat==GL_COMPRESSED_RGB_S3TC_DXT1_EXT)?GL_UNSIGNED_SHORT_5_6_5:GL_UNSIGNED_SHORT_4_4_4_4;
-            glstate->texture.bound[glstate->texture.active]->type = type;
-            glstate->texture.bound[glstate->texture.active]->compressed = true;
             if (pixel_convert(pixels, &half, width, height, GL_RGBA, GL_UNSIGNED_BYTE, format, type, 0))
                 fact = 0;
 //            if (pixel_thirdscale(pixels, &half, width, height, GL_RGBA, GL_UNSIGNED_BYTE))
 //                fact = 1;
-            else
-                glstate->texture.bound[glstate->texture.active]->type = GL_UNSIGNED_BYTE;
+            else {
+                format = GL_RGBA;
+                type = GL_UNSIGNED_BYTE;
+            }
+            glstate->texture.bound[glstate->texture.active]->format = format; //internalformat;
+            glstate->texture.bound[glstate->texture.active]->type = type;
+            glstate->texture.bound[glstate->texture.active]->compressed = true;
         } else {
             fact = 0;
         }
@@ -2083,7 +2085,7 @@
 		glshim_glGetIntegerv(GL_UNPACK_ALIGNMENT, &oldalign);
 		if (oldalign!=1)
             glshim_glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-		glshim_glTexImage2D(target, level, GL_RGBA, width>>fact, height>>fact, border, format, type, half);
+		glshim_glTexImage2D(target, level, format, width>>fact, height>>fact, border, format, type, half);
 		if (oldalign!=1)
             glshim_glPixelStorei(GL_UNPACK_ALIGNMENT, oldalign);
 		if (half!=pixels)


Added EXT version of Shaders functions

Added EXT version of Shaders functions

--- src/glx/lookup.c
+++ src/glx/lookup.c
@@ -641,10 +641,10 @@
     _EX(glVertexAttrib2##suffix); \
     _EX(glVertexAttrib3##suffix); \
     _EX(glVertexAttrib4##suffix); \
-    /*_ARB(glVertexAttrib1##suffix); \
-    _ARB(glVertexAttrib2##suffix); \
-    _ARB(glVertexAttrib3##suffix); \
-    _ARB(glVertexAttrib4##suffix)*/
+    _EXT(glVertexAttrib1##suffix); \
+    _EXT(glVertexAttrib2##suffix); \
+    _EXT(glVertexAttrib3##suffix); \
+    _EXT(glVertexAttrib4##suffix);
     THUNK(s);
     THUNK(d);
     THUNK(sv);
@@ -655,17 +655,19 @@
     _EX(glVertexAttrib4u##suffix##v); \
     _EX(glVertexAttrib4N##suffix##v); \
     _EX(glVertexAttrib4Nu##suffix##v);\
-    /*_ARB(glVertexAttrib4##suffix##v); \
-    _ARB(glVertexAttrib4u##suffix##v); \
-    _ARB(glVertexAttrib4N##suffix##v); \
-    _ARB(glVertexAttrib4Nu##suffix##v)*/
+    _EXT(glVertexAttrib4##suffix##v); \
+    _EXT(glVertexAttrib4u##suffix##v); \
+    _EXT(glVertexAttrib4N##suffix##v); \
+    _EXT(glVertexAttrib4Nu##suffix##v);
     THUNK(b);
     THUNK(s);
     THUNK(i);
     #undef THUNK
     _EX(glGetVertexAttribdv);
+    _EXT(glGetVertexAttribdv);
     _ARB(glGetVertexAttribdv);
     _EX(glVertexAttrib4Nub);
+    _EXT(glVertexAttrib4Nub);
     _ARB(glVertexAttrib4Nub);
     // arb version of shader stuffs
     //  GL_ARB_vertex_shader
@@ -756,66 +758,67 @@
     _ARB(glGetUniformfv);
     _ARB(glGetUniformiv);
     _ARB(glGetShaderSource);
-    /*_ARB(glAttachShader);
-    _ARB(glBindAttribLocation);
-    _ARB(glCompileShader);
-    _ARB(glCreateProgram);
-    _ARB(glCreateShader);
-    _ARB(glDeleteProgram);
-    _ARB(glDeleteShader);
-    _ARB(glDetachShader);
-    _ARB(glGetActiveAttrib);
-    _ARB(glGetActiveUniform);
-    _ARB(glGetAttachedShaders);
-    _ARB(glGetAttribLocation);
-    _ARB(glGetProgramInfoLog);
-    _ARB(glGetProgramiv);
-    _ARB(glGetShaderInfoLog);
-    _ARB(glGetShaderPrecisionFormat);
-    _ARB(glGetShaderSource);
-    _ARB(glGetShaderiv);
-    _ARB(glGetUniformLocation);
-    _ARB(glGetUniformfv);
-    _ARB(glGetUniformiv);
-    _ARB(glGetVertexAttribPointerv);
-    _ARB(glGetVertexAttribfv);
-    _ARB(glGetVertexAttribiv);
-    _ARB(glIsProgram);
-    _ARB(glIsShader);
-    _ARB(glReleaseShaderCompiler);
-    _ARB(glShaderBinary);
-    _ARB(glShaderSource);
-    _ARB(glUniform1f);
-    _ARB(glUniform1fv);
-    _ARB(glUniform1i);
-    _ARB(glUniform1iv);
-    _ARB(glUniform2f);
-    _ARB(glUniform2fv);
-    _ARB(glUniform2i);
-    _ARB(glUniform2iv);
-    _ARB(glUniform3f);
-    _ARB(glUniform3fv);
-    _ARB(glUniform3i);
-    _ARB(glUniform3iv);
-    _ARB(glUniform4f);
-    _ARB(glUniform4fv);
-    _ARB(glUniform4i);
-    _ARB(glUniform4iv);
-    _ARB(glUniformMatrix2fv);
-    _ARB(glUniformMatrix3fv);
-    _ARB(glUniformMatrix4fv);
-    _ARB(glUseProgram);
-    _ARB(glValidateProgram);
-    _ARB(glVertexAttrib1f);
-    _ARB(glVertexAttrib1fv);
-    _ARB(glVertexAttrib2f);
-    _ARB(glVertexAttrib2fv);
-    _ARB(glVertexAttrib3f);
-    _ARB(glVertexAttrib3fv);
-    _ARB(glVertexAttrib4f);
-    _ARB(glVertexAttrib4fv);
-    _ARB(glVertexAttribPointer);
-    _ARB(glVertexPointer);*/
+    // EXT version of Shaders functions
+    _EXT(glAttachShader);
+    _EXT(glBindAttribLocation);
+    _EXT(glCompileShader);
+    _EXT(glCreateProgram);
+    _EXT(glCreateShader);
+    _EXT(glDeleteProgram);
+    _EXT(glDeleteShader);
+    _EXT(glDetachShader);
+    _EXT(glGetActiveAttrib);
+    _EXT(glGetActiveUniform);
+    _EXT(glGetAttachedShaders);
+    _EXT(glGetAttribLocation);
+    _EXT(glGetProgramInfoLog);
+    _EXT(glGetProgramiv);
+    _EXT(glGetShaderInfoLog);
+    _EXT(glGetShaderPrecisionFormat);
+    _EXT(glGetShaderSource);
+    _EXT(glGetShaderiv);
+    _EXT(glGetUniformLocation);
+    _EXT(glGetUniformfv);
+    _EXT(glGetUniformiv);
+    _EXT(glGetVertexAttribPointerv);
+    _EXT(glGetVertexAttribfv);
+    _EXT(glGetVertexAttribiv);
+    _EXT(glIsProgram);
+    _EXT(glIsShader);
+    _EXT(glReleaseShaderCompiler);
+    _EXT(glShaderBinary);
+    _EXT(glShaderSource);
+    _EXT(glUniform1f);
+    _EXT(glUniform1fv);
+    _EXT(glUniform1i);
+    _EXT(glUniform1iv);
+    _EXT(glUniform2f);
+    _EXT(glUniform2fv);
+    _EXT(glUniform2i);
+    _EXT(glUniform2iv);
+    _EXT(glUniform3f);
+    _EXT(glUniform3fv);
+    _EXT(glUniform3i);
+    _EXT(glUniform3iv);
+    _EXT(glUniform4f);
+    _EXT(glUniform4fv);
+    _EXT(glUniform4i);
+    _EXT(glUniform4iv);
+    _EXT(glUniformMatrix2fv);
+    _EXT(glUniformMatrix3fv);
+    _EXT(glUniformMatrix4fv);
+    _EXT(glUseProgram);
+    _EXT(glValidateProgram);
+    _EXT(glVertexAttrib1f);
+    _EXT(glVertexAttrib1fv);
+    _EXT(glVertexAttrib2f);
+    _EXT(glVertexAttrib2fv);
+    _EXT(glVertexAttrib3f);
+    _EXT(glVertexAttrib3fv);
+    _EXT(glVertexAttrib4f);
+    _EXT(glVertexAttrib4fv);
+    _EXT(glVertexAttribPointer);
+    _EXT(glVertexPointer);

     // stub non-squared matrix access
     STUB(glUniformMatrix2x3fv);


nautilus: Limit input current to fraction of negotiated limit

Limit input current to 96% of negotiated limit

BUG=b:70481533
BRANCH=none
TEST=build/flash nautilus, connect adapter and check input current

Change-Id: I20e250d8a37f22b471a69329b2e74da2c7ff2763
Reviewed-on: https://chromium-review.googlesource.com/818844
Commit-Ready: YongBeum Ha <0375183cfb575c7cdd5cfe73f9fcd260a8810df7@samsung.com>
Tested-by: YongBeum Ha <0375183cfb575c7cdd5cfe73f9fcd260a8810df7@samsung.com>
Reviewed-by: Shawn N <5259333ce42e3ace6a73988cec7115ed9d3a661a@chromium.org>

--- board/nautilus/board.c
+++ board/nautilus/board.c
@@ -502,6 +502,11 @@
 void board_set_charge_limit(int port, int supplier, int charge_ma,
 			    int max_ma, int charge_mv)
 {
+        /*
+         * Limit the input current to 96% negotiated limit,
+         * to account for the charger chip margin.
+         */
+	charge_ma = charge_ma * 96 / 100;
 	charge_set_input_current_limit(MAX(charge_ma,
 				   CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
 }


fix compiling issues

fix compiling issues

--- src/governance.h
+++ src/governance.h
@@ -13,7 +13,7 @@
 #include "base58.h"
 #include "masternode.h"
 #include "governance-vote.h"
-#include "masternodeman.cpp"
+#include "masternodeman.h"
 #include <boost/lexical_cast.hpp>
 #include "init.h"


redrix: tcs3400: update coeff conversion

Fix ALS coefficient conversion

BUG=b:196313037
BRANCH=main
TEST='make -j BOARD=redrix' in EC repo, verified builds succeed.

Signed-off-by: Boris Mittelberg <46897f4fb5cad4b1d5146ad1fd460d7f4825bbf7@google.com>
Change-Id: I5b356658cfd067a52360a224f7b8982c37a74bf8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3827025
Reviewed-by: YH Lin <a608809fda0b3a5e5ffc78f5b79106a21e96e6dd@chromium.org>
Reviewed-by: caveh jalali <08e24a66aefda7a55ca7d73f8903e0fb16eec763@chromium.org>
Tested-by: YH Lin <a608809fda0b3a5e5ffc78f5b79106a21e96e6dd@chromium.org>
Reviewed-by: Nick Vaccaro <d7b7f639f621b3ed89d9b581ffecdb610b635a33@google.com>
Commit-Queue: YH Lin <a608809fda0b3a5e5ffc78f5b79106a21e96e6dd@chromium.org>

--- board/redrix/sensors.c
+++ board/redrix/sensors.c
@@ -114,7 +114,7 @@
 			.cover_scale = ALS_CHANNEL_SCALE(1.6)
 		}
 	},
-	.calibration.irt = INT_TO_FP(0.41),
+	.calibration.irt = FLOAT_TO_FP(0.41),
 	.saturation.again = TCS_DEFAULT_AGAIN,
 	.saturation.atime = TCS_DEFAULT_ATIME,
 };


test/shared-wq: use normal init

test/shared-wq: use normal init

We don't need the params anymore.

Signed-off-by: Jens Axboe <cd8c6775e60d6f67a6984377324e5290df3d5358@kernel.dk>

--- test/shared-wq.c
+++ test/shared-wq.c
@@ -55,12 +55,10 @@

 int main(int argc, char *argv[])
 {
-	struct io_uring_params p;
 	struct io_uring ring;
 	int ret;

-	memset(&p, 0, sizeof(p));
-	ret = io_uring_queue_init_params(8, &ring, &p);
+	ret = io_uring_queue_init(8, &ring, 0);
 	if (ret) {
 		fprintf(stderr, "ring setup failed\n");
 		return 1;


start some cleanup

start some cleanup

--- ccnd/udplink/udplink.c
+++ ccnd/udplink/udplink.c
@@ -7,8 +7,13 @@
 #include <poll.h>
 #include <string.h>

+#include "ccn/ccn.h"
 #include "ccn/ccnd.h"
-#include "ccn/coding.h"
+
+void
+usage(char *name) {
+    fprintf(stderr, "Usage: %s [-d(ebug)] [-c ccnsocket] -h remotehost -r remoteport [-l localport]\n", name);
+}

 int
 main (int argc, char * const argv[]) {
@@ -19,49 +24,48 @@
         char remoteport[8];
         char localport[8];
         int debug;
-    } options = {NULL, NULL, NULL, 0};
+    } options = {NULL, NULL, "\0\0\0\0\0\0\0", "\0\0\0\0\0\0\0", 0};

     int c;
     int result;
     int localsock;
     int remotesock;
-    int timeout_1s = 1000;
-    struct sockaddr_un localsockaddr = {0};
     struct addrinfo hints = {0};
-    struct addrinfo *remote_addrinfo_result = NULL;
-    struct addrinfo *local_addrinfo_result = NULL;
+    struct addrinfo *raddrinfo = NULL;
+    struct addrinfo *laddrinfo = NULL;
     struct pollfd fds[2];
-    void *ccn;
-    struct ccn_skeleton_decoder decoder = {0};
+    struct ccn *ccn;
+    struct ccn_skeleton_decoder ldecoder = {0};
+    struct ccn_skeleton_decoder rdecoder = {0};
     unsigned char buf[PIPE_BUF];

-    while ((c = getopt(argc, argv, "dl:r:p:P:")) != -1) {
+    while ((c = getopt(argc, argv, "dc:h:r:l:")) != -1) {
         switch (c) {
         case 'd': {
-            options.debug = 1;
+            options.debug++;
         }
-        case 'l': {
+        case 'c': {
             options.localsockname = optarg;
             break;
         }
-        case 'r': {
+        case 'h': {
             options.remotehostname = optarg;
             break;
         }
-        case 'p': {
+        case 'r':
+        case 'l': {
             int port = atoi(optarg);
+            char portstr[8];
             if (port <= 0 || port >= 65536) {
-                errx(1, "remote port must be in range 1..65535");
+                usage(argv[0]);
+                errx(1, "port must be in range 1..65535");
             }
-            snprintf(options.remoteport, sizeof(options.remoteport), "%d", port);
-            break;
-        }
-        case 'P': {
-            int port = atoi(optarg);
-            if (port <= 0 || port >= 65536) {
-                errx(1, "local port must be in range 1..65535");
-            }
-            snprintf(options.localport, sizeof(options.localport), "%d", port);
+            snprintf(portstr, sizeof(portstr), "%d", port);
+            if (c == 'r') {
+                memmove(options.remoteport, portstr, sizeof(options.remoteport));
+            } else {
+                memmove(options.localport, portstr, sizeof(options.localport));
+            }
             break;
         }
         }
@@ -69,46 +73,51 @@

     /* the remote end of the connection must be specified */
     if (options.remotehostname == NULL) {
-        errx(1, "remote host/address required");
+        usage(argv[0]);
+        errx(1, "remote hostname/address required");
     }

     if (options.remoteport[0] == '\0') {
+        usage(argv[0]);
         errx(1, "remote port required");
     }

     /* connect to the local ccn socket */
     ccn = ccn_create();
     localsock = ccn_connect(ccn, options.localsockname);
-
+    if (localsock == -1) {
+        err(1, "ccn_connect");
+    }
     hints.ai_family = AF_UNSPEC;
     hints.ai_socktype = SOCK_DGRAM;
 #ifdef AI_NUMERICSERV
     hints.ai_flags = AI_NUMERICSERV;
 #endif
-    result = getaddrinfo(options.remotehostname, options.remoteport, &hints, &remote_addrinfo_result);
-    if (result != 0 || remote_addrinfo_result == NULL) {
+    result = getaddrinfo(options.remotehostname, options.remoteport, &hints, &raddrinfo);
+    if (result != 0 || raddrinfo == NULL) {
         errx(1, "getaddrinfo(%s, %s, ...): %s\n", options.remotehostname, options.remoteport, gai_strerror(result));
     }

-    hints.ai_family = remote_addrinfo_result->ai_family;
+    hints.ai_family = raddrinfo->ai_family;
     hints.ai_flags = AI_PASSIVE;
 #ifdef AI_NUMERICSERV
     hints.ai_flags |= AI_NUMERICSERV;
 #endif
-    result = getaddrinfo(NULL, options.localport, &hints, &local_addrinfo_result);
-    if (result != 0 || local_addrinfo_result == NULL) {
+    result = getaddrinfo(NULL, options.localport, &hints, &laddrinfo);
+    if (result != 0 || laddrinfo == NULL) {
         errx(1, "getaddrinfo(NULL, %s, ...): %s\n", options.localport, gai_strerror(result));
     }

-    remotesock = socket(remote_addrinfo_result->ai_family, remote_addrinfo_result->ai_socktype, 0);
+    remotesock = socket(raddrinfo->ai_family, raddrinfo->ai_socktype, 0);
     if (remotesock == -1) {
         err(1, "socket");
     }

-    result = bind(remotesock, local_addrinfo_result->ai_addr, local_addrinfo_result->ai_addrlen);
+    result = bind(remotesock, laddrinfo->ai_addr, laddrinfo->ai_addrlen);
     if (result == -1) {
         err(1, "bind(remotesock, local...)");
     }
+
     /* XXX we need to play games for multicast here */

     /* announce our presence to ccnd and request CCN PDU encapsulation */
@@ -123,10 +132,9 @@
     fds[1].events = POLLIN;

     for (;;) {
-        result = poll(fds, 2, timeout_1s);
-        if (result == -1) {
-            err(1, "poll");
-        }
+        if (0 == (result = poll(fds, 2, -1))) continue;
+        if (-1 == result) err(1, "poll");
+
         /* process local data */
         if (fds[0].revents & (POLLIN)) {
             int dres;
@@ -137,14 +145,14 @@
             if (recvlen == 0) {
                 errx(1, "recv(localsock, ...) EOF");
             }
-            memset((void *)&decoder, 0, sizeof(decoder));
-            dres = ccn_skeleton_decode(&decoder, buf, recvlen);
-            if (decoder.state != 0 || dres != recvlen) {
+            memset((void *)&ldecoder, 0, sizeof(ldecoder));
+            dres = ccn_skeleton_decode(&ldecoder, buf, recvlen);
+            if (ldecoder.state != 0 || dres != recvlen) {
                 errx(1, "protocol error on local socket");
             }
             /* send the packet out on the remote side, removing encapsulation */
             result = sendto(remotesock, &buf[CCN_EMPTY_PDU_LENGTH - 1], dres - CCN_EMPTY_PDU_LENGTH, 0,
-                            remote_addrinfo_result->ai_addr, remote_addrinfo_result->ai_addrlen);
+                            raddrinfo->ai_addr, raddrinfo->ai_addrlen);
             if (result == -1) {
                 err(1, "sendto(remotesock, buf, %d)", dres - CCN_EMPTY_PDU_LENGTH);
             }
@@ -157,6 +165,7 @@
                 fprintf(stderr, "\n");
             }
         }
+
         /* process remote data */
         if (fds[1].revents & (POLLIN)) {
             struct sockaddr from = {0};


add #define RT_USING_CONSOLE into the rtconfig.h [RENESAS M16C project]

git-svn-id: 839522a79b1d56a78fa446d2fd3a0c499f8e535e@1394 bbd45198-f89e-11dd-88c7-29a3b14d5316

--- bsp/m16c62p/rtconfig.h
+++ bsp/m16c62p/rtconfig.h
@@ -64,6 +64,7 @@
 #define RT_UART_RX_BUFFER_SIZE	64

 /* SECTION: Console options */
+#define RT_USING_CONSOLE
 /* the buffer size of console */
 #define RT_CONSOLEBUF_SIZE	128


useless include random

useless include random

--- fflas-ffpack/utils/fflas_randommatrix.h
+++ fflas-ffpack/utils/fflas_randommatrix.h
@@ -40,7 +40,6 @@
 #include <givaro/givinteger.h>
 #include <givaro/givintprime.h>
 #include <givaro/givranditer.h>
-#include <random>

 namespace FFPACK {


Fix for compile error with RECT_TX without EXT_TX

Change-Id: I2f4e3fc877c03a5bee7f7fd1dc50e6a693697647

--- av1/decoder/decodemv.c
+++ av1/decoder/decodemv.c
@@ -306,14 +306,14 @@
     if (allow_select && tx_mode == TX_MODE_SELECT) {
       const TX_SIZE coded_tx_size =
           read_selected_tx_size(cm, xd, inter_tx_size_cat_lookup[bsize], r);
-#if !CONFIG_RECT_TX
-      assert(coded_tx_size <= max_txsize_lookup[bsize]);
-#else
+#if CONFIG_EXT_TX && CONFIG_RECT_TX
       if (coded_tx_size > max_txsize_lookup[bsize]) {
         assert(coded_tx_size == max_txsize_lookup[bsize] + 1);
         return max_txsize_rect_lookup[bsize];
       }
-#endif  // !CONFIG_RECT_TX
+#else
+      assert(coded_tx_size <= max_txsize_lookup[bsize]);
+#endif  // CONFIG_EXT_TX && CONFIG_RECT_TX
       return coded_tx_size;
     } else {
       return tx_size_from_tx_mode(bsize, cm->tx_mode, 1);


Add deleted constructor to avoid the compiler falling through to the bool constructor in case of missuse.

--- lib/Basics/JsonHelper.h
+++ lib/Basics/JsonHelper.h
@@ -486,6 +486,8 @@
           : _zone(z), _json(j), _autofree(autofree) {
         }

+        explicit Json (TRI_json_t* j) = delete;
+
 ////////////////////////////////////////////////////////////////////////////////
 /// @brief "copy" constructor, note that in the AUTOFREE case this steals
 /// the structure from j to allow returning Json objects by value without


VirtualImage: Slight improvement to documentation.

--- lib/MaRC/VirtualImage.h
+++ lib/MaRC/VirtualImage.h
@@ -265,9 +265,9 @@
          * transformations, if any.  Raw data is computed/retrieved
          * from the @c read_data_i() template method.
          *
-         * @param lat  Bodycentric (e.g. planetocentric) latitude in
-         *             radians.
-         * @param lon  Longitude in radians.
+         * @param[in]  lat  Bodycentric (e.g. planetocentric) latitude
+         *                  in radians.
+         * @param[in]  lon  Longitude in radians.
          *
          * @param[out] data Data retrieved from image.
          *
@@ -308,8 +308,9 @@

         /// Data offset
         /**
-         * Offset value applied to all (scaled) computed data.  This
-         * value corresponds to zero in the virtual image.
+         * Offset value that should be applied to all (scaled)
+         * computed data.  This value corresponds to zero in the
+         * virtual image.
          *
          * @return Data offset.
          */
@@ -338,12 +339,13 @@
         /// Compute data specific to a given virtual image.
         /**
          * This template method is the core implementation of the
-         * read_data() method.
-         *
-         * @param lat  Bodycentric (e.g. planetocentric) latitude in
-         *             radians.
-         * @param lon  Longitude in radians.
-         * @param data Data retrieved from image.
+         * @c read_data() method.
+         *
+         * @param[in]  lat  Bodycentric (e.g. planetocentric) latitude
+         *                  in radians.
+         * @param[in]  lon  Longitude in radians.
+         *
+         * @param[out] data Data retrieved from image.
          *
          * @retval true  Data retrieved
          * @retval false No data retrieved.
@@ -359,23 +361,27 @@
         /// Linear scaling coefficient applied to physical data.
         /**
          * Linear scaling coefficient applied to physical data to
-         * allow it to fit in map array element of specific type with
-         * the most amount of significant digits.
-         *
-         * @note This is inverse of the of scaling coefficient needed
-         *       to retrieve the true physical value.
+         * allow data to fit in map array element of specific type
+         * with the most amount of significant digits.
+         *
+         * @note This is inverse of the of the scaling coefficient
+         *       needed to retrieve the true physical value.
+         *
+         * @see @c VirtualImage::scale()
          */
         double const scale_;

         /// Offset value applied to scaled physical data.
         /**
-         * This offset is applied to scaled physical data to allow it
-         * to fit in map array element of specific type with the most
-         * amount of significant digits.
-         *
-         * @note This is the offset multiplied by the inverse of the
-         *       of scaling value needed to retrieve the true physical
-         *       value.
+         * This offset is applied to scaled physical data to allow
+         * data fit in a map array element of specific type with the
+         * most amount of significant digits.
+         *
+         * @note This is the negative offset multiplied by the inverse
+         *       of the of scaling value needed to retrieve the true
+         *       physical value.
+         *
+         * @see @c VirtualImage::offset()
          */
         double const offset_;


backend/drm: use EGL_PLATFORM_GBM_KHR

backend/drm: use EGL_PLATFORM_GBM_KHR

This is just the vendor-agnostic define for the GBM platform. It has the
same value as EGL_PLATFORM_GBM_MESA, so should work with old drivers
that only offer the Mesa-vendored extension too.

--- backend/drm/renderer.c
+++ backend/drm/renderer.c
@@ -42,8 +42,8 @@

 	renderer->gbm_format = GBM_FORMAT_ARGB8888;
 	renderer->wlr_rend = create_renderer_func(&renderer->egl,
-		EGL_PLATFORM_GBM_MESA, renderer->gbm,
-		config_attribs, renderer->gbm_format);
+		EGL_PLATFORM_GBM_KHR, renderer->gbm, config_attribs,
+		renderer->gbm_format);
 	if (!renderer->wlr_rend) {
 		wlr_log(WLR_ERROR, "Failed to create EGL/WLR renderer");
 		goto error_gbm;


Removed unused function

Removed unused function

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403283

--- test/testalpha.c
+++ test/testalpha.c
@@ -325,23 +325,6 @@
     SDL_BlitSurface(sprite, NULL, screen, &updates[1]);

     /* Make it so! */
-    SDL_UpdateRects(screen, 2, updates);
-}
-
-void
-WarpSprite(SDL_Surface * screen, int x, int y)
-{
-    SDL_Rect updates[2];
-
-    /* Erase, move, Draw, update */
-    updates[0] = position;
-    SDL_BlitSurface(backing, NULL, screen, &updates[0]);
-    position.x = x - sprite->w / 2;     /* Center about X */
-    position.y = y - sprite->h / 2;     /* Center about Y */
-    updates[1] = position;
-    SDL_BlitSurface(screen, &updates[1], backing, NULL);
-    updates[1] = position;
-    SDL_BlitSurface(sprite, NULL, screen, &updates[1]);
     SDL_UpdateRects(screen, 2, updates);
 }


Clean up testspeed.c

Clean up testspeed.c

--- test/testspeed.c
+++ test/testspeed.c
@@ -46,7 +46,6 @@
 int done = 0;

 double times[100];
-float value;

 void switch_modes();
 void print_results();
@@ -264,7 +263,7 @@
         }
     }

-    value = (float)rand();
+    float value = (float)rand();

     signal(SIGINT, ctrlc);

@@ -287,7 +286,7 @@
     // start things off
     eprintf("STARTING TEST...\n");
     times[0] = current_time();
-    mpr_sig_set_value(sendsig, counter++, 1, MPR_FLT, &value);
+    mpr_sig_set_value(sendsig, counter, 1, MPR_FLT, &value);
     while (!done) {
         mpr_dev_poll(src, 0);
         mpr_dev_poll(dst, 0);


Improve new file in future

Improve new file in future

--- Future/toImplement/macroClassInfo.c
+++ Future/toImplement/macroClassInfo.c
@@ -7,15 +7,12 @@
 #define GET_CLASS_INFO_NB_IMPLEMENTS(x, nb, ...)        \
     nb

-#define GET_CLASS_INFO(what, extends, nbInter, interfaces...)       \
-    GET_CLASS_INFO_ ## what(extends, nbInter, ##interfaces)
-
 #define CLASS_INFO_String(what)                 \
-    GET_CLASS_INFO(what, Object, 1, toString)
+    GET_CLASS_INFO_ ## what(Object, 2, toString, Serializable)

 #define CLASS_INFO(name, what)                  \
     CLASS_INFO_ ## name(what)

 CLASS_INFO(String, EXTENDS)
+CLASS_INFO(String, NB_IMPLEMENTS)
 CLASS_INFO(String, IMPLEMENTS)
-CLASS_INFO(String, NB_IMPLEMENTS)


Added test for uploading 2 files

Added test for uploading 2 files

--- test/unit_test.c
+++ test/unit_test.c
@@ -24,11 +24,18 @@
 #define USE_LUA
 #include "mongoose.c"

-#define FATAL(str, line) do {                     \
+static int s_total_tests = 0;
+static int s_failed_tests = 0;
+
+#define FAIL(str, line) do {                     \
   printf("Fail on line %d: [%s]\n", line, str);   \
-  abort();                                        \
+  s_failed_tests++; \
 } while (0)
-#define ASSERT(expr) do { if (!(expr)) FATAL(#expr, __LINE__); } while (0)
+
+#define ASSERT(expr) do { \
+  s_total_tests++; \
+  if (!(expr)) FAIL(#expr, __LINE__); \
+} while (0)

 #define HTTP_PORT "56789"
 #define HTTPS_PORT "56790"
@@ -187,6 +194,7 @@
 static const char *fetch_data = "hello world!\n";
 static const char *inmemory_file_data = "hi there";
 static const char *upload_filename = "upload_test.txt";
+static const char *upload_filename2 = "upload_test2.txt";
 static const char *upload_ok_message = "upload successful";

 static const char *open_file_cb(const struct mg_connection *conn,
@@ -200,16 +208,39 @@
 }

 static void upload_cb(struct mg_connection *conn, const char *path) {
+  const struct mg_request_info *ri = mg_get_request_info(conn);
   char *p1, *p2;
   int len1, len2;

-  ASSERT(!strcmp(path, "./upload_test.txt"));
-  ASSERT((p1 = read_file("mongoose.c", &len1)) != NULL);
-  ASSERT((p2 = read_file(path, &len2)) != NULL);
-  ASSERT(len1 == len2);
-  ASSERT(memcmp(p1, p2, len1) == 0);
-  free(p1), free(p2);
-  remove(upload_filename);
+  if (atoi(ri->query_string) == 1) {
+    ASSERT(!strcmp(path, "./upload_test.txt"));
+    ASSERT((p1 = read_file("mongoose.c", &len1)) != NULL);
+    ASSERT((p2 = read_file(path, &len2)) != NULL);
+    ASSERT(len1 == len2);
+    ASSERT(memcmp(p1, p2, len1) == 0);
+    free(p1), free(p2);
+    remove(upload_filename);
+  } else if (atoi(ri->query_string) == 2) {
+    if (!strcmp(path, "./upload_test.txt")) {
+      ASSERT((p1 = read_file("mongoose.h", &len1)) != NULL);
+      ASSERT((p2 = read_file(path, &len2)) != NULL);
+      ASSERT(len1 == len2);
+      ASSERT(memcmp(p1, p2, len1) == 0);
+      free(p1), free(p2);
+      remove(upload_filename);
+    } else if (!strcmp(path, "./upload_test2.txt")) {
+      ASSERT((p1 = read_file("README.md", &len1)) != NULL);
+      ASSERT((p2 = read_file(path, &len2)) != NULL);
+      ASSERT(len1 == len2);
+      ASSERT(memcmp(p1, p2, len1) == 0);
+      free(p1), free(p2);
+      remove(upload_filename);
+    } else {
+      ASSERT(0);
+    }
+  } else {
+    ASSERT(0);
+  }

   mg_printf(conn, "HTTP/1.0 200 OK\r\nContent-Length: %d\r\n\r\n%s",
             (int) strlen(upload_ok_message), upload_ok_message);
@@ -227,7 +258,8 @@
   }

   if (!strcmp(ri->uri, "/upload")) {
-    ASSERT(mg_upload(conn, ".") == 1);
+    ASSERT(ri->query_string != NULL);
+    ASSERT(mg_upload(conn, ".") == atoi(ri->query_string));
   }

   return 0;
@@ -348,24 +380,27 @@
   static const char *boundary = "OOO___MY_BOUNDARY___OOO";
   struct mg_context *ctx;
   struct mg_connection *conn;
-  char ebuf[100], buf[20], *file_data, *post_data = NULL;
-  int file_len, post_data_len;
+  char ebuf[100], buf[20], *file_data, *file2_data, *post_data;
+  int file_len, file2_len, post_data_len;

   ASSERT((ctx = mg_start(&CALLBACKS, NULL, OPTIONS)) != NULL);
+
+  // Upload one file
   ASSERT((file_data = read_file("mongoose.c", &file_len)) != NULL);
+  post_data = NULL;
   post_data_len = alloc_printf(&post_data, 0,
                                        "--%s\r\n"
                                        "Content-Disposition: form-data; "
                                        "name=\"file\"; "
                                        "filename=\"%s\"\r\n\r\n"
                                        "%.*s\r\n"
-                                       "--%s\r\n",
+                                       "--%s--\r\n",
                                        boundary, upload_filename,
                                        file_len, file_data, boundary);
   ASSERT(post_data_len > 0);
   ASSERT((conn = mg_download("localhost", atoi(HTTPS_PORT), 1,
                              ebuf, sizeof(ebuf),
-                             "POST /upload HTTP/1.1\r\n"
+                             "POST /upload?1 HTTP/1.1\r\n"
                              "Content-Length: %d\r\n"
                              "Content-Type: multipart/form-data; "
                              "boundary=%s\r\n\r\n"
@@ -375,6 +410,47 @@
   ASSERT(mg_read(conn, buf, sizeof(buf)) == (int) strlen(upload_ok_message));
   ASSERT(memcmp(buf, upload_ok_message, strlen(upload_ok_message)) == 0);
   mg_close_connection(conn);
+
+  // Upload two files
+  ASSERT((file_data = read_file("mongoose.h", &file_len)) != NULL);
+  ASSERT((file2_data = read_file("README.md", &file2_len)) != NULL);
+  post_data = NULL;
+  post_data_len = alloc_printf(&post_data, 0,
+                               // First file
+                               "--%s\r\n"
+                               "Content-Disposition: form-data; "
+                               "name=\"file\"; "
+                               "filename=\"%s\"\r\n\r\n"
+                               "%.*s\r\n"
+
+                               // Second file
+                               "--%s\r\n"
+                               "Content-Disposition: form-data; "
+                               "name=\"file\"; "
+                               "filename=\"%s\"\r\n\r\n"
+                               "%.*s\r\n"
+
+                               // Final boundary
+                               "--%s--\r\n",
+                               boundary, upload_filename,
+                               file_len, file_data,
+                               boundary, upload_filename2,
+                               file2_len, file2_data,
+                               boundary);
+  ASSERT(post_data_len > 0);
+  ASSERT((conn = mg_download("localhost", atoi(HTTPS_PORT), 1,
+                             ebuf, sizeof(ebuf),
+                             "POST /upload?2 HTTP/1.1\r\n"
+                             "Content-Length: %d\r\n"
+                             "Content-Type: multipart/form-data; "
+                             "boundary=%s\r\n\r\n"
+                             "%.*s", post_data_len, boundary,
+                             post_data_len, post_data)) != NULL);
+  free(file_data), free(file2_data), free(post_data);
+  ASSERT(mg_read(conn, buf, sizeof(buf)) == (int) strlen(upload_ok_message));
+  ASSERT(memcmp(buf, upload_ok_message, strlen(upload_ok_message)) == 0);
+  mg_close_connection(conn);
+
   mg_stop(ctx);
 }

@@ -666,6 +742,7 @@
   test_lua();
 #endif

-  printf("%s\n", "PASSED");
-  return 0;
-}
+  printf("TOTAL TESTS: %d, FAILED: %d\n", s_total_tests, s_failed_tests);
+
+  return s_failed_tests == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+}


Lets not use the mdb->transaction bool but create a private one named mdb->explicit_commit as mdb->transaction is used by the bacula core and we need a private setting for Ingres.

--- bacula/src/cats/cats.h
+++ bacula/src/cats/cats.h
@@ -581,6 +581,7 @@
    uint32_t cached_path_id;
    bool allow_transactions;       /* transactions allowed */
    bool transaction;              /* transaction started */
+   bool explicit_commit;          /* do an explicit commit after each query */
    int changes;                   /* changes made to db */
    POOLMEM *fname;                /* Filename only */
    POOLMEM *path;                 /* Path only */


implement keepResults for masks and LRBni prototype header

--- benchmarks/benchmark.h
+++ benchmarks/benchmark.h
@@ -219,13 +219,18 @@
     }
 };

+template<typename T>
+static inline void _keepXRegister(T x0, T x1, T x2, T x3, T x4, T x5, T x6, T x7)
+{
+    asm volatile(""::"x"(x0), "x"(x1), "x"(x2), "x"(x3), "x"(x4), "x"(x5), "x"(x6), "x"(x7));
+}
+
 #if defined(VC_IMPL_AVX)
 template<typename T> struct KeepResultsHelper<Vc::Vector<T>, 16> {
     static inline void keepDirty(Vc::Vector<T> &tmp0) { asm volatile("":"+x"(tmp0.data())); }
     static inline void keep(Vc::Vector<T> tmp0, Vc::Vector<T> tmp1, Vc::Vector<T> tmp2, Vc::Vector<T> tmp3,
             Vc::Vector<T> tmp4, Vc::Vector<T> tmp5, Vc::Vector<T> tmp6, Vc::Vector<T> tmp7) {
-        asm volatile(""::"x"(tmp0.data()), "x"(tmp1.data()), "x"(tmp2.data()), "x"(tmp3.data()),
-                "x"(tmp4.data()), "x"(tmp5.data()), "x"(tmp6.data()), "x"(tmp7.data()));
+        _keepXRegister(tmp0.data(), tmp1.data(), tmp2.data(), tmp3.data(), tmp4.data(), tmp5.data(), tmp6.data(), tmp7.data());
     }
 };
 template<typename T> struct KeepResultsHelper<Vc::Vector<T>, 32> {
@@ -234,8 +239,13 @@
     }
     static inline void keep(Vc::Vector<T> tmp0, Vc::Vector<T> tmp1, Vc::Vector<T> tmp2, Vc::Vector<T> tmp3,
             Vc::Vector<T> tmp4, Vc::Vector<T> tmp5, Vc::Vector<T> tmp6, Vc::Vector<T> tmp7) {
-        asm volatile(""::"x"(tmp0.data()), "x"(tmp1.data()), "x"(tmp2.data()), "x"(tmp3.data()),
-                "x"(tmp4.data()), "x"(tmp5.data()), "x"(tmp6.data()), "x"(tmp7.data()));
+        _keepXRegister(tmp0.data(), tmp1.data(), tmp2.data(), tmp3.data(), tmp4.data(), tmp5.data(), tmp6.data(), tmp7.data());
+    }
+};
+template<unsigned int S1, size_t S2, int S3> struct KeepResultsHelper<Vc::AVX::Mask<S1, S2>, S3> {
+    static inline void keep(Vc::AVX::Mask<S1, S2> tmp0, Vc::AVX::Mask<S1, S2> tmp1, Vc::AVX::Mask<S1, S2> tmp2, Vc::AVX::Mask<S1, S2> tmp3,
+            Vc::AVX::Mask<S1, S2> tmp4, Vc::AVX::Mask<S1, S2> tmp5, Vc::AVX::Mask<S1, S2> tmp6, Vc::AVX::Mask<S1, S2> tmp7) {
+        _keepXRegister(tmp0.data(), tmp1.data(), tmp2.data(), tmp3.data(), tmp4.data(), tmp5.data(), tmp6.data(), tmp7.data());
     }
 };
 #elif defined(VC_IMPL_SSE)
@@ -243,39 +253,57 @@
     static inline void keepDirty(Vc::Vector<T> &tmp0) { asm volatile("":"+x"(tmp0.data())); }
     static inline void keep(Vc::Vector<T> tmp0, Vc::Vector<T> tmp1, Vc::Vector<T> tmp2, Vc::Vector<T> tmp3,
             Vc::Vector<T> tmp4, Vc::Vector<T> tmp5, Vc::Vector<T> tmp6, Vc::Vector<T> tmp7) {
-        asm volatile(""::"x"(tmp0.data()), "x"(tmp1.data()), "x"(tmp2.data()), "x"(tmp3.data()),
-                "x"(tmp4.data()), "x"(tmp5.data()), "x"(tmp6.data()), "x"(tmp7.data()));
+        _keepXRegister(tmp0.data(), tmp1.data(), tmp2.data(), tmp3.data(), tmp4.data(), tmp5.data(), tmp6.data(), tmp7.data());
     }
 };
 template<typename T> struct KeepResultsHelper<Vc::Vector<T>, 32> {
     static inline void keepDirty(Vc::Vector<T> &tmp0) {
-        asm volatile("":"+x"(tmp0.data()[0]), "+x"(&tmp0.data()[1]));
-    }
-    static inline void keep(Vc::Vector<T> tmp0, Vc::Vector<T> tmp1, Vc::Vector<T> tmp2, Vc::Vector<T> tmp3,
-            Vc::Vector<T> tmp4, Vc::Vector<T> tmp5, Vc::Vector<T> tmp6, Vc::Vector<T> tmp7) {
-        asm volatile(""::"x"(tmp0.data()[0]), "x"(&tmp0.data()[1]),
-                "x"(tmp1.data()[0]), "x"(&tmp1.data()[1]),
-                "x"(tmp2.data()[0]), "x"(&tmp2.data()[1]),
-                "x"(tmp3.data()[0]), "x"(&tmp3.data()[1]));
-        asm volatile(""::"x"(tmp4.data()[0]), "x"(&tmp4.data()[1]),
-                "x"(tmp5.data()[0]), "x"(&tmp5.data()[1]),
-                "x"(tmp6.data()[0]), "x"(&tmp6.data()[1]),
-                "x"(tmp7.data()[0]), "x"(&tmp7.data()[1]));
-    }
-};
-#elif defined(VC_IMPL_LRBni)
-//X template<typename T> struct KeepResultsHelper<Vc::Vector<T>, 64> {
-//X     static inline void keepDirty(Vc::Vector<T> &tmp0) {
-//X         asm volatile("":"+x"(tmp0.data()), "+x"(&tmp0)[1]),
-//X                 "+x"(&tmp0)[2]), "+x"(&tmp0)[3]));
-//X     }
-//X     static inline void keep(Vc::Vector<T> tmp0, Vc::Vector<T> tmp1, Vc::Vector<T> tmp2, Vc::Vector<T> tmp3) {
-//X         asm volatile(""::"x"(tmp0.data()), "x"(&tmp0)[1]), "x"(&tmp0)[2]), "x"(&tmp0)[3]),
-//X                 "x"(tmp1.data()), "x"(&tmp1)[1]), "x"(&tmp1)[2]), "x"(&tmp1)[3]));
-//X         asm volatile(""::"x"(tmp2.data()), "x"(&tmp2)[1]), "x"(&tmp2)[2]), "x"(&tmp2)[3]),
-//X                 "x"(tmp3.data()), "x"(&tmp3)[1]), "x"(&tmp3)[2]), "x"(&tmp3)[3]));
-//X     }
-//X };
+        asm volatile("":"+x"(tmp0.data()[0]), "+x"(tmp0.data()[1]));
+    }
+    static inline void keep(Vc::Vector<T> tmp0, Vc::Vector<T> tmp1, Vc::Vector<T> tmp2, Vc::Vector<T> tmp3,
+            Vc::Vector<T> tmp4, Vc::Vector<T> tmp5, Vc::Vector<T> tmp6, Vc::Vector<T> tmp7) {
+        _keepXRegister(tmp0.data()[0], tmp0.data()[1], tmp1.data()[0], tmp1.data()[1], tmp2.data()[0], tmp2.data()[1], tmp3.data()[0], tmp3.data()[1]);
+        _keepXRegister(tmp4.data()[0], tmp4.data()[1], tmp5.data()[0], tmp5.data()[1], tmp6.data()[0], tmp6.data()[1], tmp7.data()[0], tmp7.data()[1]);
+    }
+};
+template<unsigned int S> struct KeepResultsHelper<Vc::SSE::Mask<S>, 16> {
+    static inline void keepDirty(Vc::SSE::Mask<S> &tmp0) { asm volatile("":"+x"(tmp0.data())); }
+    static inline void keep(Vc::SSE::Mask<S> tmp0, Vc::SSE::Mask<S> tmp1, Vc::SSE::Mask<S> tmp2, Vc::SSE::Mask<S> tmp3,
+            Vc::SSE::Mask<S> tmp4, Vc::SSE::Mask<S> tmp5, Vc::SSE::Mask<S> tmp6, Vc::SSE::Mask<S> tmp7) {
+        _keepXRegister(tmp0.data(), tmp1.data(), tmp2.data(), tmp3.data(), tmp4.data(), tmp5.data(), tmp6.data(), tmp7.data());
+    }
+};
+template<> struct KeepResultsHelper<Vc::SSE::Float8Mask, 32> {
+    static inline void keep(Vc::SSE::Float8Mask tmp0, Vc::SSE::Float8Mask tmp1, Vc::SSE::Float8Mask tmp2, Vc::SSE::Float8Mask tmp3,
+            Vc::SSE::Float8Mask tmp4, Vc::SSE::Float8Mask tmp5, Vc::SSE::Float8Mask tmp6, Vc::SSE::Float8Mask tmp7) {
+        _keepXRegister(tmp0.data()[0], tmp0.data()[1], tmp1.data()[0], tmp1.data()[1], tmp2.data()[0], tmp2.data()[1], tmp3.data()[0], tmp3.data()[1]);
+        _keepXRegister(tmp4.data()[0], tmp4.data()[1], tmp5.data()[0], tmp5.data()[1], tmp6.data()[0], tmp6.data()[1], tmp7.data()[0], tmp7.data()[1]);
+    }
+};
+#elif defined(VC_IMPL_LRBni) && defined(VC_LRBni_PROTOTYPE_H)
+#include <xmmintrin.h>
+template<typename T> struct KeepResultsHelper<Vc::Vector<T>, 64> {
+    static inline void keepDirty(Vc::Vector<T> &tmp0) {
+        __m128 *x = reinterpret_cast<__m128 *>(&tmp0);
+        asm volatile("":"+x"(x[0]), "+x"(x[1]), "+x"(x[2]), "+x"(x[3]));
+    }
+    static inline void keep(Vc::Vector<T> tmp0, Vc::Vector<T> tmp1, Vc::Vector<T> tmp2, Vc::Vector<T> tmp3,
+            Vc::Vector<T> tmp4, Vc::Vector<T> tmp5, Vc::Vector<T> tmp6, Vc::Vector<T> tmp7) {
+        // doesn't make so much sense with so many required registers
+        __m128 *x0 = reinterpret_cast<__m128 *>(&tmp0);
+        __m128 *x1 = reinterpret_cast<__m128 *>(&tmp1);
+        __m128 *x2 = reinterpret_cast<__m128 *>(&tmp2);
+        __m128 *x3 = reinterpret_cast<__m128 *>(&tmp3);
+        _keepXRegister(x0[0], x0[1], x0[2], x0[3], x1[0], x1[1], x1[2], x1[3]);
+        _keepXRegister(x2[0], x2[1], x2[2], x2[3], x3[0], x3[1], x3[2], x3[3]);
+        __m128 *x4 = reinterpret_cast<__m128 *>(&tmp4);
+        __m128 *x5 = reinterpret_cast<__m128 *>(&tmp5);
+        __m128 *x6 = reinterpret_cast<__m128 *>(&tmp6);
+        __m128 *x7 = reinterpret_cast<__m128 *>(&tmp7);
+        _keepXRegister(x4[0], x4[1], x4[2], x4[3], x5[0], x5[1], x5[2], x5[3]);
+        _keepXRegister(x6[0], x6[1], x6[2], x6[3], x7[0], x7[1], x7[2], x7[3]);
+    }
+};
 #endif

 template<typename T> static inline void keepResultsDirty(T &tmp0)
@@ -298,6 +326,11 @@
     KeepResultsHelper<T, sizeof(T)>::keep(tmp0, tmp1, tmp2, tmp3, tmp0, tmp1, tmp2, tmp3);
 }

+template<typename T> static inline void keepResults(T tmp0, T tmp1, T tmp2, T tmp3, T tmp4, T tmp5)
+{
+    KeepResultsHelper<T, sizeof(T)>::keep(tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp0, tmp1);
+}
+
 template<typename T> static inline void keepResults(T tmp0, T tmp1, T tmp2, T tmp3, T tmp4, T tmp5, T tmp6, T tmp7)
 {
     KeepResultsHelper<T, sizeof(T)>::keep(tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7);


workaround for msvc that seems not to appreciate much macros

--- test/lib/component.h
+++ test/lib/component.h
@@ -1,11 +1,14 @@
 #include <entt/core/type_traits.hpp>

-ENTT_SHARED_STRUCT(position, {
+struct position {
     int x;
     int y;
-})
+};

-ENTT_SHARED_STRUCT(velocity, {
+struct velocity {
     int dx;
     int dy;
-})
+};
+
+ENTT_SHARED_TYPE(position)
+ENTT_SHARED_TYPE(velocity)


test/motion_common.h: Format with clang-format

BUG=b:236386294
BRANCH=none
TEST=none

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

--- test/motion_common.h
+++ test/motion_common.h
@@ -13,7 +13,7 @@
  * The task will read the vectors at that interval
  */
 #define TEST_LID_EC_RATE (1 * MSEC)
-#define TEST_LID_FREQUENCY (1e9 / TEST_LID_EC_RATE)   /* mHz */
+#define TEST_LID_FREQUENCY (1e9 / TEST_LID_EC_RATE) /* mHz */

 /*
  * Time in ms to wait for the task to read the vectors.
@@ -30,7 +30,8 @@

 void wait_for_valid_sample(void);
 void feed_accel_data(const float *array, int *idx,
-		int (filler)(const struct motion_sensor_t *s, const float f));
+		     int(filler)(const struct motion_sensor_t *s,
+				 const float f));

 /*
  * External data - from
@@ -65,4 +66,4 @@
 extern const size_t kAccelerometerVerticalHingeTestDataLength;
 extern const float kAccelerometerVerticalHingeUnstableTestData[];
 extern const size_t kAccelerometerVerticalHingeUnstableTestDataLength;
-#endif  /* __CROS_EC_MOTION_COMMON_H */
+#endif /* __CROS_EC_MOTION_COMMON_H */


Save 1 _fe_negate since s1 == -s2

Save 1 _fe_negate since s1 == -s2

--- src/group_impl.h
+++ src/group_impl.h
@@ -461,7 +461,7 @@

 static void secp256k1_gej_add_ge(secp256k1_gej_t *r, const secp256k1_gej_t *a, const secp256k1_ge_t *b) {
-    /* Operations: 7 mul, 5 sqr, 4 normalize, 22 mul_int/add/negate/cmov */
+    /* Operations: 7 mul, 5 sqr, 4 normalize, 21 mul_int/add/negate/cmov */
     static const secp256k1_fe_t fe_1 = SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 1);
     secp256k1_fe_t zz, u1, u2, s1, s2, t, tt, m, n, q, rr;
     secp256k1_fe_t m_alt, rr_alt;
@@ -540,8 +540,8 @@
      * a nontrivial cube root of one. In either case, an alternate
      * non-indeterminate expression for lambda is (y1 - y2)/(x1 - x2),
      * so we set R/M equal to this. */
-    secp256k1_fe_negate(&rr_alt, &s2, 1);   /* rr = -Y2*Z1^3  */
-    secp256k1_fe_add(&rr_alt, &s1);         /* rr = Y1*Z2^3 - Y2*Z1^3 */
+    rr_alt = s1;
+    secp256k1_fe_mul_int(&rr_alt, 2);       /* rr = Y1*Z2^3 - Y2*Z1^3 (2) */
     secp256k1_fe_add(&m_alt, &u1);          /* Malt = X1*Z2^2 - X2*Z1^2 */

     secp256k1_fe_cmov(&rr_alt, &rr, !degenerate);


Added logic to send a second HEAD request if initial status is 406 - not acceptable since that indicates the content might be link protected and RANGE header is not allowed.  Simplified the if clause around using time seek range values for dtcp and non-dtcp content.  Added methods to convert between npt and bytes to be used by dlna_src_handle_query_convert().  Adjusted log message levels.  Changed name of method from "formulate_extra_headers" to "adjust_http_src_headers" since the method will now set property of souphttpsrc so that RANGE header is excluded in additional to adding extra headers.  It will now add Range.dtcp.com header for DTCP encrypted content.

--- src/gstdlnasrc.c
+++ src/gstdlnasrc.c
@@ -171,6 +171,7 @@
 #define HTTP_STATUS_OK 200
 #define HTTP_STATUS_CREATED 201
 #define HTTP_STATUS_PARTIAL 206
+#define HTTP_STATUS_NOT_ACCEPTABLE 406

 // Description of a pad that the element will (or might) create and use
 //
@@ -306,12 +307,19 @@

 static gboolean dlna_src_is_rate_supported (GstDlnaSrc * dlna_src, gfloat rate);

-static gboolean dlna_src_formulate_extra_headers (GstDlnaSrc * dlna_src,
-    gfloat rate, GstFormat format, guint64 start, GstStructure ** headers);
+static gboolean dlna_src_adjust_http_src_headers (GstDlnaSrc * dlna_src,
+    gfloat rate, GstFormat format, guint64 start);

 static gboolean dlna_src_npt_to_nanos (GstDlnaSrc * dlna_src, gchar * string,
     guint64 * media_time_nanos);

+static gboolean
+dlna_src_convert_bytes_to_npt_nanos (GstDlnaSrc * dlna_src, guint64 bytes,
+    guint64 * npt_nanos);
+
+static gboolean
+dlna_src_convert_npt_nanos_to_bytes (GstDlnaSrc * dlna_src, guint64 npt_nanos,
+    guint64 * bytes);

 #define gst_dlna_src_parent_class parent_class

@@ -699,6 +707,14 @@
         GST_DEBUG_OBJECT (dlna_src,
             "Server supplied content-length header: %"
             G_GUINT64_FORMAT, dlna_src->server_info->content_length);
+      } else if (dlna_src->server_info->byte_seek_total > 0) {
+        gst_query_set_duration (query, GST_FORMAT_BYTES,
+            dlna_src->server_info->byte_seek_total);
+        ret = TRUE;
+
+        GST_DEBUG_OBJECT (dlna_src,
+            "Server supplied time seek range header: %"
+            G_GUINT64_FORMAT, dlna_src->server_info->byte_seek_total);
       } else {
         GST_DEBUG_OBJECT (dlna_src,
             "Duration in bytes not available for content item");
@@ -746,6 +762,7 @@
   gboolean supports_seeking = FALSE;
   gint64 seek_start = 0;
   gint64 seek_end = 0;
+  gboolean use_byte_range = FALSE;

   GST_DEBUG_OBJECT (dlna_src, "Called");

@@ -760,37 +777,32 @@
       &seek_end);

   if ((format == GST_FORMAT_BYTES) || (format == GST_FORMAT_DEFAULT)) {
-    // Check for DTCP encrypted content
+    // Determine if this server supports byte based seeks for this content
+    // Check if got time seek in order to use byte range
     if ((dlna_src->server_info->content_features != NULL) &&
-        (dlna_src->server_info->content_features->flag_link_protected_set) &&
-        (dlna_src->server_info->content_features->flag_full_clear_text_set ||
-            dlna_src->server_info->
-            content_features->flag_limited_clear_text_set)) {
-
-      // Set results of query but don't do actual seek
-      gst_query_set_seeking (query, GST_FORMAT_BYTES, TRUE,
-          dlna_src->server_info->dtcp_range_start,
-          dlna_src->server_info->dtcp_range_end);
-      ret = TRUE;
-
-      GST_DEBUG_OBJECT (dlna_src,
-          "Byte seeks supported for this content by the server, start %"
-          G_GUINT64_FORMAT ", end %" G_GUINT64_FORMAT,
-          dlna_src->server_info->dtcp_range_start,
-          dlna_src->server_info->dtcp_range_end);
-
-    } else if ((dlna_src->server_info->content_features != NULL) &&
-        (dlna_src->server_info->content_features->op_range_supported) &&
-        (dlna_src->server_info->time_seek_response_received)) {
-      // Determine if this server supports byte based seeks for this content
-
+        dlna_src->server_info->time_seek_response_received) {
+
+      // Check for non-encrypted content and range seek supported
+      if (!dlna_src->server_info->content_features->flag_link_protected_set &&
+          dlna_src->server_info->content_features->op_range_supported)
+        use_byte_range = TRUE;
+
+      // Check for encrypted content and range seek supported
+      if (dlna_src->server_info->content_features->flag_link_protected_set &&
+          (dlna_src->server_info->content_features->flag_full_clear_text_set ||
+              dlna_src->server_info->content_features->
+              flag_limited_clear_text_set))
+        use_byte_range = TRUE;
+    }
+
+    if (use_byte_range) {
       // Set results of query but don't do actual seek
       gst_query_set_seeking (query, GST_FORMAT_BYTES, TRUE,
           dlna_src->server_info->byte_seek_start,
           dlna_src->server_info->byte_seek_end);
       ret = TRUE;

-      GST_DEBUG_OBJECT (dlna_src,
+      GST_INFO_OBJECT (dlna_src,
           "Byte seeks supported for this content by the server, start %"
           G_GUINT64_FORMAT ", end %" G_GUINT64_FORMAT,
           dlna_src->server_info->byte_seek_start,
@@ -803,11 +815,11 @@
             dlna_src->server_info->content_length);
         ret = TRUE;

-        GST_DEBUG_OBJECT (dlna_src,
+        GST_INFO_OBJECT (dlna_src,
             "Server accepts byte range requests, start 0, end %"
             G_GUINT64_FORMAT, dlna_src->server_info->content_length);
       } else {
-        GST_DEBUG_OBJECT (dlna_src,
+        GST_INFO_OBJECT (dlna_src,
             "Seeking in bytes not available for content item");
       }
     }
@@ -856,6 +868,7 @@
   gdouble rate = 1.0;
   gint64 start = 0;
   gint64 end = 0;
+  gboolean use_byte_range = FALSE;

   GST_LOG_OBJECT (dlna_src, "Called");

@@ -869,29 +882,25 @@
   gst_query_parse_segment (query, &rate, &format, &start, &end);

   if (format == GST_FORMAT_BYTES) {
-    // Check for DTCP encrypted content
+    // Determine if this server supports byte based seeks for this content
+    // Check if got time seek in order to use byte range
     if ((dlna_src->server_info->content_features != NULL) &&
-        (dlna_src->server_info->content_features->flag_link_protected_set) &&
-        (dlna_src->server_info->content_features->flag_full_clear_text_set ||
-            dlna_src->server_info->
-            content_features->flag_limited_clear_text_set)) {
-
-      // Set segment info based on server support of dtcp byte based seeks
-      gst_query_set_segment (query, dlna_src->rate, GST_FORMAT_BYTES,
-          dlna_src->server_info->dtcp_range_start,
-          dlna_src->server_info->dtcp_range_end);
-      ret = TRUE;
-
-      GST_DEBUG_OBJECT (dlna_src,
-          "Segment info in bytes for this content, rate %f, start %"
-          G_GUINT64_FORMAT ", end %" G_GUINT64_FORMAT,
-          dlna_src->rate,
-          dlna_src->server_info->dtcp_range_start,
-          dlna_src->server_info->dtcp_range_end);
-
-    } else if ((dlna_src->server_info->content_features != NULL) &&
-        (dlna_src->server_info->content_features->op_range_supported) &&
-        (dlna_src->server_info->time_seek_response_received)) {
+        dlna_src->server_info->time_seek_response_received) {
+
+      // Check for non-encrypted content and range seek supported
+      if (!dlna_src->server_info->content_features->flag_link_protected_set &&
+          dlna_src->server_info->content_features->op_range_supported)
+        use_byte_range = TRUE;
+
+      // Check for encrypted content and range seek supported
+      if (dlna_src->server_info->content_features->flag_link_protected_set &&
+          (dlna_src->server_info->content_features->flag_full_clear_text_set ||
+              dlna_src->server_info->content_features->
+              flag_limited_clear_text_set))
+        use_byte_range = TRUE;
+    }
+
+    if (use_byte_range) {

       // Set segment info based on server support of byte based seeks
       gst_query_set_segment (query, dlna_src->rate, GST_FORMAT_BYTES,
@@ -1000,27 +1009,26 @@
     return ret;
   }

-  // Issue head to get conversion info
-  GstDlnaSrcHeadResponse *head_response = NULL;
-  if (!dlna_src_head_request (dlna_src, start_npt, start_byte, FALSE,
-          &head_response)) {
-    GST_WARNING_OBJECT (dlna_src, "Problems with HEAD request");
-    return FALSE;
-  }
-  // Get time seek start positions which contain converted value
-  if (dest_fmt == GST_FORMAT_BYTES) {
-    dest_val = head_response->time_seek_npt_start;
-  } else if (dest_fmt == GST_FORMAT_TIME) {
-    dest_val = head_response->time_seek_npt_start;
-  }
+  if (dest_fmt == GST_FORMAT_TIME) {
+    if (!dlna_src_convert_bytes_to_npt_nanos (dlna_src, start_byte,
+            (guint64 *) & dest_val)) {
+      GST_WARNING_OBJECT (dlna_src, "Problems converting to time");
+      return ret;
+    }
+  } else {                      // dest_fmt == GST_FORMAT_BYTES
+    if (!dlna_src_convert_npt_nanos_to_bytes (dlna_src, start_npt,
+            (guint64 *) & dest_val)) {
+      GST_WARNING_OBJECT (dlna_src, "Problems converting to bytes");
+      return ret;
+    }
+  }
+
   // Return results in query
   gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);

-  // Free head response structure
-  dlna_src_head_response_free (dlna_src, head_response);
-
   return ret;
 }
+

 /**
  * Perform action necessary when seek event is received
@@ -1079,26 +1087,19 @@
   dlna_src->requested_start = start;
   dlna_src->requested_stop = stop;

-  if (dlna_src->requested_rate != 1.0) {
-    // Create necessary extra headers for http src so change can be requested
-    GstStructure *extra_headers_struct = NULL;
-
-    if (!dlna_src_formulate_extra_headers (dlna_src, dlna_src->requested_rate,
-            dlna_src->requested_format,
-            dlna_src->requested_start, &extra_headers_struct)) {
-      GST_ERROR_OBJECT (dlna_src, "Problem formulating extra headers");
+  // Make sure info is available for soup http src header adjustments
+  if ((dlna_src->uri) && (dlna_src->server_info) &&
+      (dlna_src->server_info->content_features != NULL)) {
+    // Adjust headers for http src so change can be requested
+    if (!dlna_src_adjust_http_src_headers (dlna_src, dlna_src->requested_rate,
+            dlna_src->requested_format, dlna_src->requested_start)) {
+      GST_ERROR_OBJECT (dlna_src, "Problems adjusting soup http src headers");
       // Returning true to prevent further processing
       return TRUE;
     }
-    // Convert structure to GValue in order to set property
-    GValue struct_value = G_VALUE_INIT;
-    g_value_init (&struct_value, GST_TYPE_STRUCTURE);
-    gst_value_set_structure (&struct_value, extra_headers_struct);
-    g_object_set_property (G_OBJECT (dlna_src->http_src), "extra-headers",
-        &struct_value);
-
-    gst_structure_free (extra_headers_struct);
-  }
+  } else
+    GST_INFO_OBJECT (dlna_src,
+        "No header adjustments since server only supports Range requests");

   GST_DEBUG_OBJECT (dlna_src,
       "returning false to make sure souphttpsrc gets chance to process");
@@ -1126,6 +1127,7 @@
     GstFormat format, guint64 start,
     GstSeekType start_type, guint64 stop, GstSeekType stop_type)
 {
+  gboolean use_byte_range = FALSE;
   // Check if supplied rate is supported
   if ((rate == 1.0) || (dlna_src_is_rate_supported (dlna_src, rate))) {
     GST_INFO_OBJECT (dlna_src, "New rate of %4.1f is supported by server",
@@ -1138,39 +1140,26 @@

   // Check if supplied start is valid
   if (format == GST_FORMAT_BYTES) {
-    // Check for encrypted content
+    // Determine if this server supports byte based seeks for this content
+    // Check if got time seek in order to use byte range
     if ((dlna_src->server_info->content_features != NULL) &&
-        (dlna_src->server_info->content_features->flag_link_protected_set)) {
-      // Verify clear byte text seeks are supported for dtcp/ip encrypted content
-      if (dlna_src->server_info->content_features->flag_full_clear_text_set ||
-          dlna_src->server_info->
-          content_features->flag_limited_clear_text_set) {
-        // Verify dtcp range is valid
-        if ((start < dlna_src->server_info->dtcp_range_start) ||
-            (start > dlna_src->server_info->dtcp_range_end)) {
-          GST_WARNING_OBJECT (dlna_src,
-              "Specified start byte %" G_GUINT64_FORMAT
-              " is not valid, valid range: %" G_GUINT64_FORMAT
-              " to %" G_GUINT64_FORMAT, start,
-              dlna_src->server_info->dtcp_range_start,
-              dlna_src->server_info->dtcp_range_end);
-          return FALSE;
-        } else {
-          GST_INFO_OBJECT (dlna_src,
-              "Specified start byte %" G_GUINT64_FORMAT
-              " is valid, valid range: %" G_GUINT64_FORMAT
-              " to %" G_GUINT64_FORMAT, start,
-              dlna_src->server_info->dtcp_range_start,
-              dlna_src->server_info->dtcp_range_end);
-        }
-      } else {
-        GST_WARNING_OBJECT (dlna_src,
-            "Content is encrypted and clear text seeks are not supported");
-        return FALSE;
-      }
-    } else if ((dlna_src->server_info->content_features != NULL) &&
-        (dlna_src->server_info->content_features->op_range_supported) &&
-        (dlna_src->server_info->time_seek_response_received)) {
+        dlna_src->server_info->time_seek_response_received) {
+
+      // Check for non-encrypted content and range seek supported
+      if (!dlna_src->server_info->content_features->flag_link_protected_set &&
+          dlna_src->server_info->content_features->op_range_supported)
+        use_byte_range = TRUE;
+
+      // Check for encrypted content and range seek supported
+      if (dlna_src->server_info->content_features->flag_link_protected_set &&
+          (dlna_src->server_info->content_features->flag_full_clear_text_set ||
+              dlna_src->server_info->content_features->
+              flag_limited_clear_text_set))
+        use_byte_range = TRUE;
+    }
+
+    if (use_byte_range) {
+
       // Verify start byte is within range
       if ((start < dlna_src->server_info->byte_seek_start) ||
           (start > dlna_src->server_info->byte_seek_end)) {
@@ -1276,53 +1265,148 @@

 /**
  * Create extra headers to supply to soup http src based on requested starting
- * postion and rate.
+ * postion and rate.  Instruct souphttpsrc to exclude range header if it conflicts
+ * with any of the extra headers which have been added.
  *
  * @param	dlna_src 	this element
  * @param	rate		requested rate to include in playspeed header
  * @param	format		create either time or byte based seek header
  * @param	start		starting position to include, will be either bytes or time depending on format
- * @param	headers		extra headers structure to populate with results
  *
  * @return	true if extra headers were successfully created, false otherwise
  */
 static gboolean
-dlna_src_formulate_extra_headers (GstDlnaSrc * dlna_src, gfloat rate,
-    GstFormat format, guint64 start, GstStructure ** headers)
-{
-  gchar *ps_field_name = "PlaySpeed.dlna.org";
-  gchar *ps_field_value_prefix = "speed=";
-  gchar ps_field_value[64] = { 0 };
-
-  // Get string representation of rate
-  int i = 0;
-  char *rateStr = NULL;
-  for (i = 0; i < dlna_src->server_info->content_features->playspeeds_cnt; i++) {
-    if (dlna_src->server_info->content_features->playspeeds[i] == rate) {
-      rateStr = dlna_src->server_info->content_features->playspeed_strs[i];
-      break;
-    }
-  }
-
-  if (rateStr == NULL) {
-    GST_ERROR_OBJECT (dlna_src,
-        "Unable to get string representation of rate: %lf", rate);
+dlna_src_adjust_http_src_headers (GstDlnaSrc * dlna_src, gfloat rate,
+    GstFormat format, guint64 start)
+{
+  GValue struct_value = G_VALUE_INIT;
+  GstStructure *extra_headers_struct;
+
+  gboolean disable_range_header = FALSE;
+
+  gchar *playspeed_field_name = "PlaySpeed.dlna.org";
+  gchar *playspeed_field_value_prefix = "speed=";
+  gchar playspeed_field_value[64] = { 0 };
+
+  gchar *time_seek_range_field_name = "TimeSeekRange.dlna.org";
+  gchar *time_seek_range_field_value_prefix = "npt=";
+  gchar time_seek_range_field_value[64] = { 0 };
+  guint64 start_time_nanos;
+  guint64 start_time_secs;
+
+  gchar *range_dtcp_field_name = "Range.dtcp.com";
+  gchar *range_dtcp_field_value_prefix = "bytes=";
+  gchar range_dtcp_field_value[64] = { 0 };
+
+  // Make sure range header is included by default
+  GValue boolean_value = G_VALUE_INIT;
+  g_value_init (&boolean_value, G_TYPE_BOOLEAN);
+  g_value_set_boolean (&boolean_value, FALSE);
+  g_object_set_property (G_OBJECT (dlna_src->http_src), "exclude-range-header",
+      &boolean_value);
+
+  GST_DEBUG_OBJECT (dlna_src, "called");
+
+  // Create header structure with dlna transfer mode header
+  extra_headers_struct = gst_structure_new ("extraHeadersStruct",
+      "transferMode.dlna.org", G_TYPE_STRING, "Streaming", NULL);
+  if (extra_headers_struct == NULL) {
+    GST_WARNING_OBJECT (dlna_src, "Problems creating extra headers structure");
     return FALSE;
   }
-
-  g_snprintf ((gchar *) & ps_field_value[0], 64, "%s%s", ps_field_value_prefix,
-      rateStr);
-  GST_INFO_OBJECT (dlna_src, "Set playspeed header value: %s", ps_field_value);
-
-  *headers = gst_structure_new ("extraHeadersStruct",
-      "transferMode.dlna.org", G_TYPE_STRING, "Streaming",
-      ps_field_name, G_TYPE_STRING, &ps_field_value, NULL);
-
-  if (*headers == NULL) {
-    GST_WARNING_OBJECT (dlna_src, "Did not create extra headers structure");
-    return FALSE;
-  } else {
-    GST_LOG_OBJECT (dlna_src, "Created extra headers structure");
+  // If rate != 1.0, add playspeed header and time seek range header
+  if (rate != 1.0) {
+    // Get string representation of rate
+    int i = 0;
+    char *rateStr = NULL;
+    for (i = 0; i < dlna_src->server_info->content_features->playspeeds_cnt;
+        i++) {
+      if (dlna_src->server_info->content_features->playspeeds[i] == rate) {
+        rateStr = dlna_src->server_info->content_features->playspeed_strs[i];
+        break;
+      }
+    }
+    if (rateStr == NULL) {
+      GST_ERROR_OBJECT (dlna_src,
+          "Unable to get string representation of rate: %lf", rate);
+      return FALSE;
+    }
+    g_snprintf ((gchar *) & playspeed_field_value[0], 64, "%s%s",
+        playspeed_field_value_prefix, rateStr);
+
+    // Add header to structure
+    gst_structure_set (extra_headers_struct, playspeed_field_name,
+        G_TYPE_STRING, &playspeed_field_value, NULL);
+    GST_INFO_OBJECT (dlna_src,
+        "Adjust headers by including playspeed header value: %s",
+        playspeed_field_value);
+
+    // Add time seek range header, convert bytes to time if necessary
+    if (format != GST_FORMAT_TIME) {
+      // Issue head request to convert starting bytes to starting time
+      if (!dlna_src_convert_bytes_to_npt_nanos (dlna_src, start,
+              &start_time_nanos)) {
+        GST_WARNING_OBJECT (dlna_src,
+            "Problems converting %" G_GUINT64_FORMAT " to npt", start);
+        return FALSE;
+      }
+    } else
+      start_time_nanos = start;
+
+    // Convert start time from nanos into secs string
+    start_time_secs = start_time_nanos / 1000000000L;
+
+    // If using playspeed, include TimeSeekRange header with starting time
+    g_snprintf ((gchar *) & time_seek_range_field_value[0], 64,
+        "%s%" G_GUINT64_FORMAT ".0-", time_seek_range_field_value_prefix,
+        start_time_secs);
+
+    // Add header to structure
+    gst_structure_set (extra_headers_struct, time_seek_range_field_name,
+        G_TYPE_STRING, &time_seek_range_field_value, NULL);
+
+    GST_INFO_OBJECT (dlna_src,
+        "Adjust headers by including TimeSeekRange header value: %s",
+        time_seek_range_field_value);
+
+    // Set flag so range header is not included by souphttpsrc
+    disable_range_header = TRUE;
+  } else
+    GST_INFO_OBJECT (dlna_src,
+        "Not adjusting with playspeed or time seek range ");
+
+  // If dtcp protected content and rate = 1.0, add range.dtcp.com header
+  if ((rate == 1.0) && (format == GST_FORMAT_BYTES)
+      && (dlna_src->server_info->content_features->flag_link_protected_set)) {
+    g_snprintf ((gchar *) & range_dtcp_field_value[0], 64,
+        "%s%" G_GUINT64_FORMAT "-", range_dtcp_field_value_prefix, start);
+
+    // Add header to structure
+    gst_structure_set (extra_headers_struct, range_dtcp_field_name,
+        G_TYPE_STRING, &range_dtcp_field_value, NULL);
+
+    GST_INFO_OBJECT (dlna_src,
+        "Adjust headers by including Range.dtcp.com header value: %s",
+        range_dtcp_field_value);
+
+    // Set flag so range header is not included by souphttpsrc
+    disable_range_header = TRUE;
+  } else
+    GST_INFO_OBJECT (dlna_src, "Not adjusting with range.dtcp.com");
+
+  // Set extra header property of soup http src
+  g_value_init (&struct_value, GST_TYPE_STRUCTURE);
+  gst_value_set_structure (&struct_value, extra_headers_struct);
+  g_object_set_property (G_OBJECT (dlna_src->http_src), "extra-headers",
+      &struct_value);
+  gst_structure_free (extra_headers_struct);
+
+  // Disable range header if necessary
+  if (disable_range_header) {
+    g_value_set_boolean (&boolean_value, TRUE);
+    g_object_set_property (G_OBJECT (dlna_src->http_src),
+        "exclude-range-header", &boolean_value);
+    GST_INFO_OBJECT (dlna_src, "Adjust headers by excluding range header");
   }

   return TRUE;
@@ -1431,6 +1515,11 @@
       GST_ERROR_OBJECT (dlna_src, "Problems setting up dtcp elements");
       return FALSE;
     }
+    g_object_set (G_OBJECT (dlna_src->http_src), "content-size",
+        dlna_src->server_info->byte_seek_total, NULL);
+    GST_INFO_OBJECT (dlna_src,
+        "Set HTTP src DTCP content size: %" G_GUINT64_FORMAT,
+        dlna_src->server_info->byte_seek_total);
   } else {
     GST_INFO_OBJECT (dlna_src, "No DTCP setup required");

@@ -1542,6 +1631,7 @@
 dlna_src_init_uri (GstDlnaSrc * dlna_src, const gchar * value)
 {
   gchar struct_str[MAX_HTTP_BUF_SIZE] = { 0 };
+  GstDlnaSrcHeadResponse *head_response = NULL;

   // Set the uri in the src
   if (dlna_src->uri) {
@@ -1566,20 +1656,30 @@
   GST_DEBUG_OBJECT (dlna_src, "Issuing HEAD Request");
   if (!dlna_src_head_request (dlna_src, 0, 0, TRUE, &dlna_src->server_info)) {
     GST_WARNING_OBJECT (dlna_src,
-        "Unable to issue HEAD request & get HEAD response");
-  }
-  // Handle special case where RANGE & TimeSeekRange headers are
+        "Unable to issue first HEAD request & get HEAD response");
+  }
+  // Check if content could be DTCP encrypted and server did not like range header
+  // in initial HEAD request
+  if ((dlna_src->server_info != NULL) &&
+      (dlna_src->server_info->ret_code == HTTP_STATUS_NOT_ACCEPTABLE)) {
+    GST_INFO_OBJECT (dlna_src,
+        "Issuing another HEAD Request without range header for potential DTCP content");
+    if (!dlna_src_head_request (dlna_src, 0, 0, FALSE, &dlna_src->server_info)) {
+      GST_WARNING_OBJECT (dlna_src,
+          "Unable to issue second HEAD request & get HEAD response");
+    }
+  }
+  // Check if a second HEAD request should be issued due to RANGE & TimeSeekRange headers are
   // included but server only responded with Range (no TimeSeekRange)
   // but indicates that it supports time seek range.
   if ((dlna_src->server_info != NULL) &&
       (dlna_src->server_info->content_features != NULL) &&
       (dlna_src->server_info->content_features->op_time_seek_supported) &&
       (!dlna_src->server_info->time_seek_response_received)) {
-    // Issue another head request to get time seek response header
-    GST_DEBUG_OBJECT (dlna_src,
+
+    GST_INFO_OBJECT (dlna_src,
         "Issuing another HEAD Request to get time seek header in response");

-    GstDlnaSrcHeadResponse *head_response = NULL;
     if (!dlna_src_head_request (dlna_src, 0, 0, FALSE, &head_response)) {
       GST_WARNING_OBJECT (dlna_src,
           "Unable to issue second HEAD request & get HEAD response");
@@ -1685,9 +1785,11 @@
  * Sends HEAD request and reads response to gather info about content item associated
  * with supplied URL.
  *
- * @param dlna_src      this element
- * @param start_npt     request content starting at this normal play time
- * @param start_byte    request content starting at this byte
+ * @param dlna_src              this element
+ * @param start_npt             request content starting at this normal play time
+ * @param start_byte            request content starting at this byte
+ * @param include_range_header  include Range header in HEAD request
+ * @param head_response         results of HEAD request
  *
  * @return  true got successful HEAD response, false otherwise
  */
@@ -1733,6 +1835,7 @@
   if (((*head_response)->ret_code != HTTP_STATUS_OK) &&
       ((*head_response)->ret_code != HTTP_STATUS_CREATED) &&
       ((*head_response)->ret_code != HTTP_STATUS_PARTIAL)) {
+
     GST_WARNING_OBJECT (dlna_src,
         "Error code received in HEAD response: %d %s",
         (*head_response)->ret_code, (*head_response)->ret_msg);
@@ -2503,7 +2606,7 @@
 }

 /**
- * Parse the byte range which may be containt in the following headers:
+ * Parse the byte range which may be contained in the following headers:
  *
  * TimeSeekRange header formatting as specified in DLNA 7.4.40.5:
  *
@@ -3574,6 +3677,67 @@
 }

 /**
+ * Utility function which uses server info from time seek range in order
+ * to convert supplied byte position to corresponding normal play time (npt) in nanoseconds.
+ *
+ * @param   dlna_src    this element instance
+ * @param   bytes       byte position to convert to npt in nanoseconds
+ * @param   npt_nanos   npt which represents supplied byte position
+ *
+ * @return  TRUE if conversion was successful, false otherwise
+ */
+static gboolean
+dlna_src_convert_bytes_to_npt_nanos (GstDlnaSrc * dlna_src, guint64 bytes,
+    guint64 * npt_nanos)
+{
+  // Unable to issue time seek range header with bytes and get back npt
+  // so just using the time seek range results from previous head to estimate
+  // what npt would be for supplied byte
+  *npt_nanos = (bytes * dlna_src->server_info->time_seek_npt_duration) /
+      dlna_src->server_info->byte_seek_total;
+
+  GST_INFO_OBJECT (dlna_src,
+      "Converted %" G_GUINT64_FORMAT " bytes to %" GST_TIME_FORMAT
+      " npt using total bytes=%" G_GUINT64_FORMAT " total npt=%"
+      GST_TIME_FORMAT, bytes, GST_TIME_ARGS (*npt_nanos),
+      dlna_src->server_info->byte_seek_total,
+      GST_TIME_ARGS (dlna_src->server_info->time_seek_npt_duration));
+
+  return TRUE;
+}
+
+/**
+ * Utility function which uses server info from time seek range in order
+ * to convert supplied normal play time (npt) in nanoseconds to corresponding byte position.
+ *
+ * @param   dlna_src    this element instance
+ * @param   npt_nanos   npt in nanoseconds to convert to byte position
+ * @param   bytes       byte position which represents supplied npt nanos
+ *
+ * @return  TRUE if conversion was successful, false otherwise
+ */
+static gboolean
+dlna_src_convert_npt_nanos_to_bytes (GstDlnaSrc * dlna_src, guint64 npt_nanos,
+    guint64 * bytes)
+{
+  // Issue head to get conversion info
+  GstDlnaSrcHeadResponse *head_response = NULL;
+  if (!dlna_src_head_request (dlna_src, npt_nanos, 0, FALSE, &head_response)) {
+    GST_WARNING_OBJECT (dlna_src, "Problems with HEAD request");
+    return FALSE;
+  }
+  *bytes = head_response->byte_seek_start;
+  GST_INFO_OBJECT (dlna_src,
+      "Converted %" GST_TIME_FORMAT " npt to %" G_GUINT64_FORMAT " bytes",
+      GST_TIME_ARGS (npt_nanos), *bytes);
+
+  // Free head response structure
+  dlna_src_head_response_free (dlna_src, head_response);
+
+  return TRUE;
+}
+
+/**
  * Convert supplied string which represents normal play time (npt) into
  * nanoseconds.  The format of NPT is as follows:
  *


Allow more than 8 bits to be read at once.

The current bit stream code only allows up to 8 bits to be read at once.
Rework this to allow more, and fill the bit buffer when needed.

--- lib/bit_stream_reader.c
+++ lib/bit_stream_reader.c
@@ -59,24 +59,41 @@
 static int peek_bits(BitStreamReader *reader,
                      unsigned int n)
 {
-	uint8_t buf[3];
+	uint8_t buf[4];
+	unsigned int fill_bytes;
 	size_t bytes;

-	// Always try to keep at least 8 bits in the input buffer.
-	// When the level drops low, read some more bytes to top it up.
+	if (n == 0) {
+		return 0;
+	}

-	if (reader->bits < 8) {
-		bytes = reader->callback(buf, 3, reader->callback_data);
+	// If there are not enough bits in the buffer to satisfy this
+	// request, we need to fill up the buffer with more bits.
+
+	if (reader->bits < n) {
+
+		// Maximum number of bytes we can fill?
+
+		fill_bytes = (32 - reader->bits) / 8;
+
+		// Read from input and fill bit_buffer.
+
+		memset(buf, 0, sizeof(buf));
+		bytes = reader->callback(buf, fill_bytes,
+		                         reader->callback_data);

 		reader->bit_buffer |= (uint32_t) buf[0] << (24 - reader->bits);
 		reader->bit_buffer |= (uint32_t) buf[1] << (16 - reader->bits);
 		reader->bit_buffer |= (uint32_t) buf[2] << (8 - reader->bits);
+		reader->bit_buffer |= (uint32_t) buf[3];

 		reader->bits += bytes * 8;
-	}

-	if (reader->bits < n) {
-		return -1;
+		// Do we have enough now?  If not, we're out of luck.
+
+		if (reader->bits < n) {
+			return -1;
+		}
 	}

 	return (signed int) (reader->bit_buffer >> (32 - n));


add unit tests for analyzePatter/factorize API

--- test/sparse_solver.h
+++ test/sparse_solver.h
@@ -46,10 +46,30 @@
   x = solver.solve(b);
   if (solver.info() != Success)
   {
-    std::cerr << "sparse SPD: solving failed\n";
-    return;
-  }
-  VERIFY(oldb.isApprox(b) && "sparse SPD: the rhs should not be modified!");
+    std::cerr << "sparse solver testing: solving failed\n";
+    return;
+  }
+  VERIFY(oldb.isApprox(b) && "sparse solver testing: the rhs should not be modified!");
+
+  VERIFY(x.isApprox(refX,test_precision<Scalar>()));
+
+  x.setZero();
+  // test the analyze/factorize API
+  solver.analyzePattern(A);
+  solver.factorize(A);
+  if (solver.info() != Success)
+  {
+    std::cerr << "sparse solver testing: factorization failed (check_sparse_solving)\n";
+    exit(0);
+    return;
+  }
+  x = solver.solve(b);
+  if (solver.info() != Success)
+  {
+    std::cerr << "sparse solver testing: solving failed\n";
+    return;
+  }
+  VERIFY(oldb.isApprox(b) && "sparse solver testing: the rhs should not be modified!");

   VERIFY(x.isApprox(refX,test_precision<Scalar>()));
 }


removed that empty_close check again, because I am going to change the design of empty response bodies

--- test/t-http-client.c
+++ test/t-http-client.c
@@ -357,24 +357,6 @@
     assert(c->aborted);
 }

-static void
-test_empty_body_close(pool_t pool, struct context *c)
-{
-    c->fd = connect_mirror();
-    c->close_response_body_early = true;
-    http_client_request(pool, c->fd, &my_lease, c,
-                        HTTP_METHOD_GET, "/foo", NULL,
-                        istream_null_new(pool),
-                        &my_response_handler, c, &c->async_ref);
-    pool_unref(pool);
-    pool_commit();
-
-    event_dispatch();
-
-    assert(c->released);
-    assert(c->aborted);
-}
-

 /*
  * main
@@ -413,7 +395,6 @@
     run_test(pool, test_close_request_body_early);
     run_test(pool, test_data_blocking);
     run_test(pool, test_body_fail);
-    run_test(pool, test_empty_body_close);

     pool_unref(pool);
     pool_commit();


Add new tests to test relation combined if range.


Added cast to shut up compiler warning

Added cast to shut up compiler warning

--- tests/bs_alloc.c
+++ tests/bs_alloc.c
@@ -279,7 +279,7 @@
 	buffer = NULL;
 	result = bs_get_buffer(bs, &buffer);
 	fail_unless(result == BS_OK);
-	fail_unless(buffer == 0xdeadbeef);
+	fail_unless(buffer == (BSbyte *) 0xdeadbeef);

 	bs_unset_buffer(bs);
 	bs_free(bs);


accept sequence of mapping as path config node

--- lib/core/configurator.c
+++ lib/core/configurator.c
@@ -240,6 +240,50 @@
     return strcmp(x->key->data.scalar, y->key->data.scalar);
 }

+static yoml_t *convert_path_config_node(h2o_configurator_command_t *cmd, yoml_t *node)
+{
+    size_t i, j;
+
+    switch (node->type) {
+    case YOML_TYPE_MAPPING:
+        break;
+    case YOML_TYPE_SEQUENCE: {
+        /* convert to mapping */
+        yoml_t *map = h2o_mem_alloc(offsetof(yoml_t, data.mapping.elements));
+        map->type = YOML_TYPE_MAPPING;
+        map->_refcnt = 1;
+        map->data.mapping.size = 0;
+
+        for (i = 0; i != node->data.sequence.size; ++i) {
+            yoml_t *elem = node->data.sequence.elements[i];
+            if (elem->type != YOML_TYPE_MAPPING) {
+                yoml_free(map, NULL);
+                goto Error;
+            }
+            for (j = 0; j != elem->data.mapping.size; ++j) {
+                yoml_t *elemkey = elem->data.mapping.elements[j].key;
+                yoml_t *elemvalue = elem->data.mapping.elements[j].value;
+                map = h2o_mem_realloc(map, offsetof(yoml_t, data.mapping.elements) +
+                                               sizeof(yoml_mapping_element_t) * (map->data.mapping.size + 1));
+                map->data.mapping.elements[map->data.mapping.size].key = elemkey;
+                map->data.mapping.elements[map->data.mapping.size].value = elemvalue;
+                ++map->data.mapping.size;
+                ++elemkey->_refcnt;
+                ++elemvalue->_refcnt;
+            }
+        }
+        return map;
+    } break;
+    default:
+    Error:
+        h2o_configurator_errprintf(cmd, node, "value must be a mapping or sequence of mapping");
+        return NULL;
+    }
+
+    ++node->_refcnt;
+    return node;
+}
+
 static int on_config_paths(h2o_configurator_command_t *cmd, h2o_configurator_context_t *ctx, yoml_t *node)
 {
     size_t i;
@@ -261,8 +305,15 @@
         h2o_configurator_context_t *path_ctx = create_context(ctx, 0);
         path_ctx->pathconf = h2o_config_register_path(path_ctx->hostconf, key->data.scalar, 0);
         path_ctx->mimemap = &path_ctx->pathconf->mimemap;
-        int cmd_ret = h2o_configurator_apply_commands(path_ctx, value, H2O_CONFIGURATOR_FLAG_PATH, NULL);
+
+        yoml_t *config_node = convert_path_config_node(cmd, value);
+        if (config_node == NULL)
+            return -1;
+
+        int cmd_ret = h2o_configurator_apply_commands(path_ctx, config_node, H2O_CONFIGURATOR_FLAG_PATH, NULL);
         destroy_context(path_ctx);
+        yoml_free(config_node, NULL);
+
         if (cmd_ret != 0)
             return cmd_ret;
     }


Removed duplication of size parameter validation

--- src/heatshrink.c
+++ src/heatshrink.c
@@ -9,6 +9,45 @@
 #define DEFAULT_HEATSHRINK_WINDOW_SZ2 11
 #define DEFAULT_HEATSHRINK_LOOKAHEAD_SZ2 4
 #define DEFAULT_DECODER_INPUT_BUFFER_SIZE 256
+
+
+/************************************************************
+ * Utils
+ ************************************************************/
+/**
+ * Check that the window and lookahead size paramters are valid.
+ * If not, 0 is returned and an exception is thrown.
+ *
+ * @param {uint8_t} window_sz2
+ * @param {uint8_t} lookahead_sz2
+ * @returns {int}  1 if parameters are valid, else 0
+ */
+static int validate_size_params(uint8_t window_sz2, uint8_t lookahead_sz2)
+{
+		if((window_sz2 < HEATSHRINK_MIN_WINDOW_BITS) ||
+			 (window_sz2 > HEATSHRINK_MAX_WINDOW_BITS)) {
+				PyObject *exc_msg = PyString_FromFormat(
+						"Invalid window size %d. Valid values are between %d and %d.",
+						window_sz2, HEATSHRINK_MIN_WINDOW_BITS, HEATSHRINK_MAX_WINDOW_BITS
+						);
+				PyErr_SetObject(PyExc_ValueError, exc_msg);
+				Py_DECREF(exc_msg);
+				return 0;
+		}
+
+		if ((lookahead_sz2 < HEATSHRINK_MIN_LOOKAHEAD_BITS) ||
+				(lookahead_sz2 >= window_sz2)) {
+				PyObject *exc_msg = PyString_FromFormat(
+						"Invalid lookahead size %d. Valid values are between %d and %d.",
+						lookahead_sz2, HEATSHRINK_MIN_LOOKAHEAD_BITS, window_sz2
+						);
+				PyErr_SetObject(PyExc_ValueError, exc_msg);
+				Py_DECREF(exc_msg);
+				return 0;
+		}
+
+		return 1;
+}

 /************************************************************
  * Encoding
@@ -121,25 +160,7 @@
 				return NULL;
 		}

-		if((window_sz2 < HEATSHRINK_MIN_WINDOW_BITS) ||
-			 (window_sz2 > HEATSHRINK_MAX_WINDOW_BITS)) {
-				PyObject *exc_msg = PyString_FromFormat(
-						"Invalid window size %d. Valid values are between %d and %d.",
-						window_sz2, HEATSHRINK_MIN_WINDOW_BITS, HEATSHRINK_MAX_WINDOW_BITS
-				);
-				PyErr_SetObject(PyExc_ValueError, exc_msg);
-				Py_DECREF(exc_msg);
-				return NULL;
-		}
-
-		if ((lookahead_sz2 < HEATSHRINK_MIN_LOOKAHEAD_BITS) ||
-				(lookahead_sz2 >= window_sz2)) {
-				PyObject *exc_msg = PyString_FromFormat(
-						"Invalid lookahead size %d. Valid values are between %d and %d.",
-						lookahead_sz2, HEATSHRINK_MIN_LOOKAHEAD_BITS, window_sz2
-				);
-				PyErr_SetObject(PyExc_ValueError, exc_msg);
-				Py_DECREF(exc_msg);
+		if(!validate_size_params(window_sz2, lookahead_sz2)) {
 				return NULL;
 		}

@@ -282,25 +303,7 @@

     log_debug("Received buffer of size %zd", view.shape[0]);

-		if((window_sz2 < HEATSHRINK_MIN_WINDOW_BITS) ||
-			 (window_sz2 > HEATSHRINK_MAX_WINDOW_BITS)) {
-				PyObject *exc_msg = PyString_FromFormat(
-						"Invalid window size %d. Valid values are between %d and %d.",
-						window_sz2, HEATSHRINK_MIN_WINDOW_BITS, HEATSHRINK_MAX_WINDOW_BITS
-				);
-				PyErr_SetObject(PyExc_ValueError, exc_msg);
-				Py_DECREF(exc_msg);
-				return NULL;
-		}
-
-		if ((lookahead_sz2 < HEATSHRINK_MIN_LOOKAHEAD_BITS) ||
-				(lookahead_sz2 >= window_sz2)) {
-				PyObject *exc_msg = PyString_FromFormat(
-						"Invalid lookahead size %d. Valid values are between %d and %d.",
-						lookahead_sz2, HEATSHRINK_MIN_LOOKAHEAD_BITS, window_sz2
-				);
-				PyErr_SetObject(PyExc_ValueError, exc_msg);
-				Py_DECREF(exc_msg);
+		if(!validate_size_params(window_sz2, lookahead_sz2)) {
 				return NULL;
 		}


Create helloworld.c

Create helloworld.c

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

--- src/helloworld.c
+++ src/helloworld.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main(){
+  printf("Hola Mundo!!");
+  return 0;
+}


Bluetooth: Simplify packet copy in hci_send_to_monitor function

Within the monitor functionality, the global atomic variable called
monitor_promisc ensures that no memory allocation happend when there
is actually no client listening. This means it is safe to just create
a copy of the skb since it is guaranteed that at least one client
exists. No extra checks needed.

Signed-off-by: Marcel Holtmann <44592b4eea36663c86b994bb0ea99d15309c1c7d@holtmann.org>
Signed-off-by: Johan Hedberg <628991c7b0a19c384f9b99c21ec330ce952bb838@intel.com>

--- net/bluetooth/hci_sock.c
+++ net/bluetooth/hci_sock.c
@@ -221,6 +221,7 @@
 {
 	struct sock *sk;
 	struct sk_buff *skb_copy = NULL;
+	struct hci_mon_hdr *hdr;
 	__le16 opcode;

 	if (!atomic_read(&monitor_promisc))
@@ -251,6 +252,17 @@
 		return;
 	}

+	/* Create a private copy with headroom */
+	skb_copy = __pskb_copy_fclone(skb, HCI_MON_HDR_SIZE, GFP_ATOMIC, true);
+	if (!skb_copy)
+		return;
+
+	/* Put header before the data */
+	hdr = (void *) skb_push(skb_copy, HCI_MON_HDR_SIZE);
+	hdr->opcode = opcode;
+	hdr->index = cpu_to_le16(hdev->id);
+	hdr->len = cpu_to_le16(skb->len);
+
 	read_lock(&hci_sk_list.lock);

 	sk_for_each(sk, &hci_sk_list.head) {
@@ -261,22 +273,6 @@

 		if (hci_pi(sk)->channel != HCI_CHANNEL_MONITOR)
 			continue;
-
-		if (!skb_copy) {
-			struct hci_mon_hdr *hdr;
-
-			/* Create a private copy with headroom */
-			skb_copy = __pskb_copy_fclone(skb, HCI_MON_HDR_SIZE,
-						      GFP_ATOMIC, true);
-			if (!skb_copy)
-				continue;
-
-			/* Put header before the data */
-			hdr = (void *) skb_push(skb_copy, HCI_MON_HDR_SIZE);
-			hdr->opcode = opcode;
-			hdr->index = cpu_to_le16(hdev->id);
-			hdr->len = cpu_to_le16(skb->len);
-		}

 		nskb = skb_clone(skb_copy, GFP_ATOMIC);
 		if (!nskb)


mac80211: fix the increment of unicast/multicast counters for forwarded PREQ

Forwarded PREQ is either unicast or multicast. The appropriate counters
should be incremented accordingly.

Signed-off-by: Chun-Yeow Yeoh <06347be8a1534b1f0025d629ea7c7ce02309a6de@gmail.com>
Signed-off-by: John W. Linville <2a53bac7a5d324865ef46ec4c38b2c0fba1456b4@tuxdriver.com>

--- net/mac80211/mesh_hwmp.c
+++ net/mac80211/mesh_hwmp.c
@@ -603,7 +603,10 @@
 				hopcount, ttl, cpu_to_le32(lifetime),
 				cpu_to_le32(metric), cpu_to_le32(preq_id),
 				sdata);
-		ifmsh->mshstats.fwded_mcast++;
+		if (!is_multicast_ether_addr(da))
+			ifmsh->mshstats.fwded_unicast++;
+		else
+			ifmsh->mshstats.fwded_mcast++;
 		ifmsh->mshstats.fwded_frames++;
 	}
 }


Addresses #1308
Port test1308a to windows

git-svn-id: beb45b6ef193120fbd8d9d9ab02545cda21cf59e@8324 c7de825b-a66e-492c-adef-691d508d4ae1

--- newbrt/tests/test1308a.c
+++ newbrt/tests/test1308a.c
@@ -3,6 +3,7 @@
 #include <assert.h>
 #include <string.h>

+#include "toku_portability.h"
 #include "../brt.h"

 #define FNAME "test1308a.data"


logic directive

logic directive

--- ngx_http_geoip2_module.c
+++ ngx_http_geoip2_module.c
@@ -211,11 +211,11 @@
         if (gcf->first_non_private_ip == 0) {
             xfwd = &r->headers_in.x_forwarded_for;
         } else {
-            ngx_str_t *sc;
+            ngx_str_t *xfwd_ips;

             xfwd = ngx_array_create(r->pool, 1, sizeof(ngx_str_t));
-            sc = xfwd->elts;
-            sc[0] = "62.81.177.242";
+            xfwd_ips = xfwd->elts;
+            xfwd_ips[0] = ngx_string("62.81.177.242");
         }

         if (xfwd->nelts > 0 && gcf->proxies != NULL) {


Fixed bug: too few bytes were allocated for range string

--- ngx_http_upload_module.c
+++ ngx_http_upload_module.c
@@ -1963,7 +1963,7 @@

     value = (ngx_http_upload_range_t *) ((char *) u + data);

-    p = ngx_palloc(r->pool, 3*NGX_OFF_T_LEN + 2);
+    p = ngx_palloc(r->pool, sizeof("bytes ") - 1 + 3*NGX_OFF_T_LEN + 2);
     if (p == NULL) {
         return NGX_ERROR;
     }


[3party] Compilation fix

[3party] Compilation fix

--- 3party/jansson/src/jansson_config.h
+++ 3party/jansson/src/jansson_config.h
@@ -34,6 +34,6 @@

 /* If locale.h and localeconv() are available, define to 1,
    otherwise to 0. */
-#define JSON_HAVE_LOCALECONV 1
+#define JSON_HAVE_LOCALECONV 0

 #endif


fix wrong arg type

fix wrong arg type

--- APPS/apitester/src/sctp_utilities.h
+++ APPS/apitester/src/sctp_utilities.h
@@ -169,7 +169,7 @@
  * SCTP_KEY tests
  *
  ********************************************************/
-int sctp_get_auth_key(int fd, sctp_assoc_t assoc_id, uint16_t keyid,
+int sctp_get_auth_key(int fd, sctp_assoc_t assoc_id, uint16_t *keyid,
 		      uint16_t *keylen, uint8_t *keytext);
 int sctp_set_auth_key(int fd, sctp_assoc_t assoc_id, uint16_t keyid,
 		      uint16_t keylen, uint8_t *keytext);


after rereading I see its 51 X 1024 NOT 512 X 1024.

Also at 768Kbpersec a round of I-frame with all
its P/B is about 15 sec of video.

--- APPS/unr_client/unreliable_client.c
+++ APPS/unr_client/unreliable_client.c
@@ -10,7 +10,7 @@
 #include <getopt.h>

 #define SIZE_OF_MESSAGE (512 * 1024)
-#define SIZE_OF_I_FRAME SIZE_OF_MESSAGE
+#define SIZE_OF_I_FRAME (51 * 1024)
 #define SIZE_OF_P_FRAME (9 * 1024)
 #define SIZE_OF_B_FRAME (3 * 1024)


check body!=NULL

check body!=NULL

--- src/http-cache.c
+++ src/http-cache.c
@@ -88,10 +88,12 @@
     if (status != HTTP_STATUS_OK || body == NULL)
         return 0;

-    available = istream_available(body, 1);
-    if (available != (off_t)-1 && available > 256 * 1024)
-        /* too large for the cache */
-        return 0;
+    if (body != NULL) {
+        available = istream_available(body, 1);
+        if (available != (off_t)-1 && available > 256 * 1024)
+            /* too large for the cache */
+            return 0;
+    }

     return 1;
 }


tests/kms_flip: Use fixed size (2kx2k) buffers for dummy load

Make the dummy load independent of the display resolution by using a
two fixed size dummy bos to generate the load. As a final step do
another copy from one of the dummy bos to the fb to make sure there's
a dependency between the dummy load and any subsequent operation on
the fb.

Signed-off-by: Ville Syrjälä <cd6e8d405ca90be3a03d5427c5b24fbd2d68dcc4@linux.intel.com>

--- tests/kms_flip.c
+++ tests/kms_flip.c
@@ -190,28 +190,35 @@
 static void emit_dummy_load__bcs(struct test_output *o)
 {
 	int i, limit;
-	drm_intel_bo *dummy_bo, *target_bo;
+	drm_intel_bo *src_bo, *dst_bo, *fb_bo;
 	struct igt_fb *fb_info = &o->fb_info[o->current_fb_id];
-	unsigned pitch = fb_info->stride;

 	limit = intel_gen(devid) < 6 ? 500 : 5000;

-	dummy_bo = drm_intel_bo_alloc(bufmgr, "dummy_bo", fb_info->size, 4096);
-	igt_assert(dummy_bo);
-	target_bo = gem_handle_to_libdrm_bo(bufmgr, drm_fd, "imported", fb_info->gem_handle);
-	igt_assert(target_bo);
+	src_bo = drm_intel_bo_alloc(bufmgr, "dummy_bo", 2048*2048*4, 4096);
+	igt_assert(src_bo);
+
+	dst_bo = drm_intel_bo_alloc(bufmgr, "dummy_bo", 2048*2048*4, 4096);
+	igt_assert(dst_bo);
+
+	fb_bo = gem_handle_to_libdrm_bo(bufmgr, drm_fd, "imported", fb_info->gem_handle);
+	igt_assert(fb_bo);

 	for (i = 0; i < limit; i++) {
-		blit_copy(dummy_bo, target_bo,
-			  o->fb_width, o->fb_height,
-			  pitch, pitch);
-
-		swap(dummy_bo, target_bo);
-	}
+		blit_copy(dst_bo, src_bo,
+			  2048, 2048,
+			  2048*4, 2048*4);
+
+		swap(src_bo, dst_bo);
+	}
+	blit_copy(fb_bo, src_bo,
+		  min(o->fb_width, 2048), min(o->fb_height, 2048),
+		  fb_info->stride, 2048*4);
 	intel_batchbuffer_flush(batch);

-	drm_intel_bo_unreference(dummy_bo);
-	drm_intel_bo_unreference(target_bo);
+	drm_intel_bo_unreference(src_bo);
+	drm_intel_bo_unreference(dst_bo);
+	drm_intel_bo_unreference(fb_bo);
 }

 static void emit_fence_stress(struct test_output *o)
@@ -260,7 +267,7 @@
 {
 	const struct igt_fb *fb_info = &o->fb_info[o->current_fb_id];
 	igt_render_copyfunc_t copyfunc;
-	struct igt_buf sb[2], *src, *dst;
+	struct igt_buf sb[3], *src, *dst, *fb;
 	int i, limit;

 	copyfunc = igt_get_render_copyfunc(devid);
@@ -269,37 +276,51 @@

 	limit = intel_gen(devid) < 6 ? 500 : 5000;

-	sb[0].bo = drm_intel_bo_alloc(bufmgr, "dummy_bo", fb_info->size, 4096);
+	sb[0].bo = drm_intel_bo_alloc(bufmgr, "dummy_bo", 2048*2048*4, 4096);
 	igt_assert(sb[0].bo);
 	sb[0].size = sb[0].bo->size;
 	sb[0].tiling = I915_TILING_NONE;
 	sb[0].data = NULL;
 	sb[0].num_tiles = sb[0].bo->size;
-	sb[0].stride = 4 * o->fb_width;
-
-	sb[1].bo = gem_handle_to_libdrm_bo(bufmgr, drm_fd, "imported", fb_info->gem_handle);
+	sb[0].stride = 4 * 2048;
+
+	sb[1].bo = drm_intel_bo_alloc(bufmgr, "dummy_bo", 2048*2048*4, 4096);
 	igt_assert(sb[1].bo);
 	sb[1].size = sb[1].bo->size;
-	sb[1].tiling = fb_info->tiling;
+	sb[1].tiling = I915_TILING_NONE;
 	sb[1].data = NULL;
 	sb[1].num_tiles = sb[1].bo->size;
-	sb[1].stride = fb_info->stride;
+	sb[1].stride = 4 * 2048;
+
+	sb[2].bo = gem_handle_to_libdrm_bo(bufmgr, drm_fd, "imported", fb_info->gem_handle);
+	igt_assert(sb[2].bo);
+	sb[2].size = sb[2].bo->size;
+	sb[2].tiling = fb_info->tiling;
+	sb[2].data = NULL;
+	sb[2].num_tiles = sb[2].bo->size;
+	sb[2].stride = fb_info->stride;

 	src = &sb[0];
 	dst = &sb[1];
+	fb = &sb[2];

 	for (i = 0; i < limit; i++) {
 		copyfunc(batch, NULL,
 			 src, 0, 0,
-			 o->fb_width, o->fb_height,
+			 2048, 2048,
 			 dst, 0, 0);

 		swap(src, dst);
 	}
+	copyfunc(batch, NULL,
+		 src, 0, 0,
+		 min(o->fb_width, 2048), min(o->fb_height, 2048),
+		 fb, 0, 0);
 	intel_batchbuffer_flush(batch);

 	drm_intel_bo_unreference(sb[0].bo);
 	drm_intel_bo_unreference(sb[1].bo);
+	drm_intel_bo_unreference(sb[2].bo);
 }

 static void dpms_off_other_outputs(struct test_output *o)


Remove redundant comment

Remove redundant comment

--- lib/dictBuilder/zdict.c
+++ lib/dictBuilder/zdict.c
@@ -117,7 +117,7 @@
         free(dummyBs);
         free(wksp);
         free(offcodeNCount);
-        return headerSize;  /* this may be an error value if ZSTD_loadCEntropy() encountered an error */
+        return headerSize;
     }
 }


Lines authored by mkonicek

Lines authored by mkonicek

This commit forms part of the blame-preserving initial commit suite.

--- lib/fb/include/fb/log.h
+++ lib/fb/include/fb/log.h
@@ -180,3 +180,59 @@
 #ifndef FBLOGE_IF
 #define FBLOGE_IF(cond, ...) \
   ((CONDITION(cond)) ? ((void)FBLOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) : (void)0)
+#endif
+
+// ---------------------------------------------------------------------
+
+/*
+ * Conditional based on whether the current LOG_TAG is enabled at
+ * verbose priority.
+ */
+#ifndef IF_FBLOGV
+#if FBLOG_NDEBUG
+#define IF_FBLOGV() if (false)
+#else
+#define IF_FBLOGV() IF_FBLOG(LOG_VERBOSE, LOG_TAG)
+#endif
+#endif
+
+/*
+ * Conditional based on whether the current LOG_TAG is enabled at
+ * debug priority.
+ */
+#ifndef IF_FBLOGD
+#define IF_FBLOGD() IF_FBLOG(LOG_DEBUG, LOG_TAG)
+#endif
+
+/*
+ * Conditional based on whether the current LOG_TAG is enabled at
+ * info priority.
+ */
+#ifndef IF_FBLOGI
+#define IF_FBLOGI() IF_FBLOG(LOG_INFO, LOG_TAG)
+#endif
+
+/*
+ * Conditional based on whether the current LOG_TAG is enabled at
+ * warn priority.
+ */
+#ifndef IF_FBLOGW
+#define IF_FBLOGW() IF_FBLOG(LOG_WARN, LOG_TAG)
+#endif
+
+/*
+ * Conditional based on whether the current LOG_TAG is enabled at
+ * error priority.
+ */
+#ifndef IF_FBLOGE
+#define IF_FBLOGE() IF_FBLOG(LOG_ERROR, LOG_TAG)
+#endif
+
+// ---------------------------------------------------------------------
+
+/*
+ * Log a fatal error.  If the given condition fails, this stops program
+ * execution like a normal assertion, but also generating the given message.
+ * It is NOT stripped from release builds.  Note that the condition test
+ * is -inverted- from the normal assert() semantics.
+ */


Fix style breakage.

Fix style breakage.

--- lib/libc/stdio/refill.c
+++ lib/libc/stdio/refill.c
@@ -73,6 +73,7 @@
 int
 __srefill(FILE *fp)
 {
+
 	/* make sure stdio is set up */
 	if (!__sdidinit)
 		__sinit();


Kill dead statement

Kill dead statement

Spotted by VTEST.

--- lib/libvarnishapi/vut.c
+++ lib/libvarnishapi/vut.c
@@ -199,10 +199,8 @@
 	case 'Q':
 		AN(arg);
 		p = VFIL_readfile(NULL, arg, NULL);
-		if (p == NULL) {
+		if (p == NULL)
 			VUT_Error(vut, 1, "-Q %s: %s", arg, strerror(errno));
-			return (-1);
-		}
 		vut_arg_q(vut, p);
 		free(p);
 		return (1);


proper errorchecks for regsub syntax.

proper errorchecks for regsub syntax.

(The recent change that moved the compiler into its own subprocess
eliminates risk that a compiler error causes the management process
to die, you just do not get a sensible syntax error).

Fixes: #417

git-svn-id: 2c9807fa3ff65b17195bd55dc8a6c4261e10127b@3546 d4fa192b-c00b-0410-8231-f00ffab90ce4

--- lib/libvcl/vcc_string.c
+++ lib/libvcl/vcc_string.c
@@ -53,6 +53,8 @@
 	int i;

 	Expect(tl, CSTR);
+	if (tl->err)
+		return (NULL);
 	memset(&t, 0, sizeof t);
 	i = regcomp(&t, tl->t->dec, REG_EXTENDED | (sub ? 0 : REG_NOSUB));
 	if (i != 0) {
@@ -88,6 +90,8 @@
 	Fb(tl, 0, "VRT_regsub(sp, %d, ", all);

 	Expect(tl, '(');
+	if (tl->err)
+		return (0);
 	vcc_NextToken(tl);

 	if (!vcc_StringVal(tl)) {
@@ -96,14 +100,20 @@
 	}

 	Expect(tl, ',');
+	if (tl->err)
+		return (0);
 	vcc_NextToken(tl);

 	Expect(tl, CSTR);
+	if (tl->err)
+		return (0);
 	p = vcc_regexp(tl, 1);
 	vcc_NextToken(tl);
 	Fb(tl, 0, ", %s, ", p);

 	Expect(tl, ',');
+	if (tl->err)
+		return (0);
 	vcc_NextToken(tl);

 	if (!vcc_StringVal(tl)) {
@@ -112,6 +122,8 @@
 	}

 	Expect(tl, ')');
+	if (tl->err)
+		return (0);
 	vcc_NextToken(tl);
 	Fb(tl, 0, ")");


Pass route to function by reference instead of value

--- lib/quagga/src/quagga.c
+++ lib/quagga/src/quagga.c
@@ -77,9 +77,9 @@
 } zebra;

 /* prototypes intern */
+static unsigned char *zebra_route_packet(uint32_t, struct ipv4_route *);
 #if 0
 static unsigned char *try_read(ssize_t *);
-static unsigned char *zebra_route_packet(struct ipv4_route r, ssize_t *);
 static int parse_interface_add(unsigned char *, size_t);
 static int parse_interface_delete(unsigned char *, size_t);
 static int parse_interface_up(unsigned char *, size_t);
@@ -260,7 +260,7 @@
 /* Creates a Route-Packet-Payload, needs address, netmask, nexthop,
    distance, and a pointer of an size_t */
 static unsigned char *
-zebra_route_packet(uint32_t cmd, struct ipv4_route r)
+zebra_route_packet(uint32_t cmd, struct ipv4_route *r)
 {

   int count;
@@ -274,33 +274,33 @@

   t = &cmdopt[2];
   *t++ = cmd;
-  *t++ = r.type;
-  *t++ = r.flags;
-  *t++ = r.message;
-  *t++ = r.prefixlen;
-  len = (r.prefixlen + 7) / 8;
-  memcpy(t, &r.prefix.v4.s_addr, len);
+  *t++ = r->type;
+  *t++ = r->flags;
+  *t++ = r->message;
+  *t++ = r->prefixlen;
+  len = (r->prefixlen + 7) / 8;
+  memcpy(t, &r->prefix.v4.s_addr, len);
   t = t + len;

-  if (r.message & ZAPI_MESSAGE_NEXTHOP) {
-    *t++ = r.nh_count + r.ind_num;
-
-      for (count = 0; count < r.nh_count; count++) {
+  if (r->message & ZAPI_MESSAGE_NEXTHOP) {
+    *t++ = r->nh_count + r->ind_num;
+
+      for (count = 0; count < r->nh_count; count++) {
         *t++ = ZEBRA_NEXTHOP_IPV4;
-        memcpy(t, &r.nexthop[count].v4.s_addr, sizeof r.nexthop[count].v4.s_addr);
-        t += sizeof r.nexthop[count].v4.s_addr;
+        memcpy(t, &r->nexthop[count].v4.s_addr, sizeof r->nexthop[count].v4.s_addr);
+        t += sizeof r->nexthop[count].v4.s_addr;
       }
-      for (count = 0; count < r.ind_num; count++) {
+      for (count = 0; count < r->ind_num; count++) {
         *t++ = ZEBRA_NEXTHOP_IFINDEX;
-        ind = htonl(r.index[count]);
+        ind = htonl(r->index[count]);
         memcpy(t, &ind, sizeof ind);
         t += sizeof ind;
       }
   }
-  if ((r.message & ZAPI_MESSAGE_DISTANCE) > 0)
-    *t++ = r.distance;
-  if ((r.message & ZAPI_MESSAGE_METRIC) > 0) {
-    metric = htonl(r.metric);
+  if ((r->message & ZAPI_MESSAGE_DISTANCE) > 0)
+    *t++ = r->distance;
+  if ((r->message & ZAPI_MESSAGE_METRIC) > 0) {
+    metric = htonl(r->metric);
     memcpy(t, &metric, sizeof metric);
     t += sizeof metric;
   }
@@ -738,7 +738,7 @@
     route.distance = zebra.distance;
   }

-  retval = zebra_send_command(zebra_route_packet(ZEBRA_IPV4_ROUTE_ADD, route));
+  retval = zebra_send_command(zebra_route_packet(ZEBRA_IPV4_ROUTE_ADD, &route));

   return retval;
 }
@@ -779,7 +779,7 @@
     route.distance = zebra.distance;
   }

-  retval = zebra_send_command(zebra_route_packet(ZEBRA_IPV4_ROUTE_DELETE, route));
+  retval = zebra_send_command(zebra_route_packet(ZEBRA_IPV4_ROUTE_DELETE, &route));

   return retval;
 }


For NextDay v4.5

For NextDay v4.5

--- NextDayKit/NextDayClientConfig.h
+++ NextDayKit/NextDayClientConfig.h
@@ -6,7 +6,8 @@
 //  Copyright (c) 2013年 Next Experience Interactive. All rights reserved.
 //

-#define NEXTDAY_SERVERURL @"wss://api.nextday.im/1/ws/"
+#define NEXTDAY_SERVERURL @"wss://api.nextday.im/4.5/ws/"
+//#define NEXTDAY_SERVERURL @"wss://test.nextday.im/4.5/ws/"
 #define NEXTDAYCLIENT_ERRORDOMAIN @"im.nextday.nextdaykit"

 // Logging


Changed scan to always pass the folder argument. This is in line with the man page.

--- uip/scan.c
+++ uip/scan.c
@@ -320,7 +320,7 @@

 	    switch (state = scan (in, msgnum, 0, nfs, width,
 			msgnum == mp->curmsg, unseen,
-			hdrflag ? folder : NULL, 0L, 1)) {
+			folder, 0L, 1)) {
 		case SCNMSG:
 		case SCNENC:
 		case SCNERR: