Remove <iterator> dependency (#295, thanks to @mpusz)

We only really need `std::reverse_iterator<>`, and that is provided indirectly through \<array\>.

--- include/gsl/gsl-lite.hpp
+++ include/gsl/gsl-lite.hpp
@@ -19,7 +19,6 @@
 #define GSL_GSL_LITE_HPP_INCLUDED

 #include <exception> // for exception, terminate(), uncaught_exceptions()
-#include <iterator>  // for data(), size(), reverse_iterator<>, iterator_traits<>
 #include <limits>
 #include <memory>    // for addressof(), unique_ptr<>, shared_ptr<>
 #include <iosfwd>    // for basic_ostream<>
@@ -901,7 +900,11 @@
 #endif // ! gsl_CPP11_OR_GREATER

 #if gsl_HAVE( ARRAY )
-# include <array>
+# include <array> // indirectly includes reverse_iterator<>
+#endif
+
+#if ! gsl_HAVE( ARRAY )
+# include <iterator> // for reverse_iterator<>
 #endif

 #if !gsl_HAVE( CONSTRAINED_SPAN_CONTAINER_CTOR ) || !gsl_HAVE( AUTO )
@@ -1185,12 +1188,7 @@

 #endif // gsl_CPP11_120

-#if gsl_HAVE( STD_DATA )
-
-using std::data;
-using std::size;
-
-#elif gsl_HAVE( CONSTRAINED_SPAN_CONTAINER_CTOR )
+#if gsl_HAVE( CONSTRAINED_SPAN_CONTAINER_CTOR )

 template< class T, size_t N >
 gsl_NODISCARD gsl_api inline gsl_constexpr auto
@@ -1234,7 +1232,7 @@
     return il.begin();
 }

-#endif // span_HAVE( DATA )
+#endif // gsl_HAVE( CONSTRAINED_SPAN_CONTAINER_CTOR )

 } // namespace std17

@@ -2964,7 +2962,7 @@
     typedef std::reverse_iterator< const_iterator > const_reverse_iterator;

     typedef gsl_CONFIG_SPAN_INDEX_TYPE size_type;
-    typedef typename std::iterator_traits< iterator >::difference_type difference_type;
+    typedef std::ptrdiff_t difference_type;

     // 26.7.3.2 Constructors, copy, and assignment [span.cons]


transport/server: Fix CQL Snappy compression failure

The snappy_compress() function expects the "compressed_length" parameter
to contain the actual output buffer length but now we're passing random
garbage from the stack.

Fixes #1711
Message-Id: <e1910ffb6a04aa33d2ca4286f002d7b922e6c30b@scylladb.com>

--- transport/server.cc
+++ transport/server.cc
@@ -1518,9 +1518,9 @@
     const char* input = body.data();
     size_t input_len = body.size();
     std::vector<char> comp;
-    comp.resize(snappy_max_compressed_length(input_len));
+    size_t output_len = snappy_max_compressed_length(input_len);
+    comp.resize(output_len);
     char *output = comp.data();
-    size_t output_len;
     if (snappy_compress(input, input_len, output, &output_len) != SNAPPY_OK) {
         throw std::runtime_error("CQL frame Snappy compression failure");
     }


Fix build error++

Fix build error++

--- src/optimizer/stats/selectivity.cpp
+++ src/optimizer/stats/selectivity.cpp
@@ -14,6 +14,7 @@

 #include "catalog/table_catalog.h"
 #include "concurrency/transaction_manager_factory.h"
+#include "executor/executor_context.h"
 #include "function/string_functions.h"

 namespace peloton {
@@ -164,14 +165,16 @@
   for (size_t i = 0; i < sample_tuples.size(); i++) {
     auto value = sample_tuples[i]->GetValue(column_id);
     PL_ASSERT(value.GetTypeId() == type::TypeId::VARCHAR);
-    if (function::StringFunctions::Like(value.GetData(), value.GetLength(),
-                                        pattern,
+    executor::ExecutorContext dummy_context(nullptr);
+    if (function::StringFunctions::Like(dummy_context, value.GetData(),
+                                        value.GetLength(), pattern,
                                         condition.value.GetLength())) {
       matched_count++;
     }
   }
   total_count = sample_tuples.size();
-  LOG_TRACE("total sample size %lu matched tupe %lu", total_count, matched_count);
+  LOG_TRACE("total sample size %lu matched tupe %lu", total_count,
+            matched_count);

   return total_count == 0 ? DEFAULT_SELECTIVITY
                           : (double)matched_count / total_count;


Code optimization from Bertrand

Code optimization from Bertrand

git-svn-id: ecbadac9c76e8cf640a0bca86f6bd796c98521e3@34434 27541ba8-7e3a-0410-8455-c3a389f83636

--- tutorials/memstat/memstat.C
+++ tutorials/memstat/memstat.C
@@ -334,9 +334,8 @@
    }

    if (selected) {
-      const char *form1 = TString::Format("  Leak number=%d, leaking %d bytes at entry=%d    time=%gseconds\n\n",bin,nbytes,entry,time);
-      const char *form2 = ttip.Data();
-      gTip->SetText(TString::Format("%s%s",form1,form2));
+      TString form1 = TString::Format("  Leak number=%d, leaking %d bytes at entry=%d    time=%gseconds\n\n",bin,nbytes,entry,time);
+      gTip->SetText(TString::Format("%s%s",form1.Data(),ttip.Data() ));
       gTip->SetPosition(px+15, 100);
       gTip->Reset();
    }


Make 'WI exclusive' mode irrelevant in 'WI only' mode

This change makes it explicit that 'WI exclusive' mode
is irrelevant when 'WI only' mode is enabled.

--- lib/mgp.cpp
+++ lib/mgp.cpp
@@ -1480,7 +1480,7 @@

     // handle 'WI exclusive' mode
     bool keepWIFilter = false;
-    if (wiExclusive) {
+    if (wiExclusive || wiOnly) {
         int wiMatchLoPos = -1;
         int wiMatchHiPos = -1;
         for (int i = 0; i < pmInfos.size(); ++i) {


Add missing error return on bad value to --sort/--rsort

--- src/auracle_main.cc
+++ src/auracle_main.cc
@@ -166,6 +166,7 @@
             sort::MakePackageSorter(sv_optarg, sort::OrderBy::ORDER_ASC);
         if (flags->command_options.sorter == nullptr) {
           std::cerr << "error: invalid arg to --sort: " << sv_optarg << "\n";
+          return false;
         }
         break;
       case ARG_RSORT:
@@ -173,6 +174,7 @@
             sort::MakePackageSorter(sv_optarg, sort::OrderBy::ORDER_DESC);
         if (flags->command_options.sorter == nullptr) {
           std::cerr << "error: invalid arg to --rsort: " << sv_optarg << "\n";
+          return false;
         }
         break;
       case ARG_BASEURL:


http_client: rename the struct to CamelCase

--- src/http_client.cxx
+++ src/http_client.cxx
@@ -53,7 +53,7 @@
     .tv_usec = 0,
 };

-struct http_client {
+struct HttpClient {
     struct pool *const pool, *const caller_pool;

     const char *const peer_name;
@@ -125,24 +125,24 @@
     /* connection settings */
     bool keep_alive;

-    http_client(struct pool &_caller_pool, struct pool &_pool,
-                int fd, enum istream_direct fd_type,
-                const struct lease &lease, void *lease_ctx,
-                const SocketFilter *filter, void *filter_ctx,
-                http_method_t method, const char *uri,
-                HttpHeaders &&headers,
-                struct istream *body, bool expect_100,
-                const struct http_response_handler &handler,
-                void *ctx,
-                struct async_operation_ref &async_ref);
-
-    static struct http_client &FromResponseBody(struct istream &istream) {
+    HttpClient(struct pool &_caller_pool, struct pool &_pool,
+               int fd, enum istream_direct fd_type,
+               const struct lease &lease, void *lease_ctx,
+               const SocketFilter *filter, void *filter_ctx,
+               http_method_t method, const char *uri,
+               HttpHeaders &&headers,
+               struct istream *body, bool expect_100,
+               const struct http_response_handler &handler,
+               void *ctx,
+               struct async_operation_ref &async_ref);
+
+    static HttpClient &FromResponseBody(struct istream &istream) {
         auto &body = HttpBodyReader::FromStream(istream);
-        return ContainerCast2(body, &http_client::response_body_reader);
-    }
-
-    static struct http_client &FromAsync(struct async_operation &ao) {
-        return ContainerCast2(ao, &http_client::request_async);
+        return ContainerCast2(body, &HttpClient::response_body_reader);
+    }
+
+    static HttpClient &FromAsync(struct async_operation &ao) {
+        return ContainerCast2(ao, &HttpClient::request_async);
     }

     gcc_pure
@@ -260,7 +260,7 @@
  * Abort receiving the response status/headers from the HTTP server.
  */
 void
-http_client::AbortResponseHeaders(GError *error)
+HttpClient::AbortResponseHeaders(GError *error)
 {
     assert(response.read_state == response::READ_STATUS ||
            response.read_state == response::READ_HEADERS);
@@ -280,7 +280,7 @@
  * Abort receiving the response status/headers from the HTTP server.
  */
 void
-http_client::AbortResponseBody(GError *error)
+HttpClient::AbortResponseBody(GError *error)
 {
     assert(response.read_state == response::READ_BODY);
     assert(response.body != nullptr);
@@ -298,7 +298,7 @@
  * server.
  */
 void
-http_client::AbortResponse(GError *error)
+HttpClient::AbortResponse(GError *error)
 {
     assert(response.read_state == response::READ_STATUS ||
            response.read_state == response::READ_HEADERS ||
@@ -317,7 +317,7 @@
  */

 inline off_t
-http_client::GetAvailable(bool partial) const
+HttpClient::GetAvailable(bool partial) const
 {
     assert(!socket.ended || response_body_reader.IsSocketDone(socket));
     assert(response.read_state == response::READ_BODY);
@@ -329,13 +329,13 @@
 static off_t
 http_client_response_stream_available(struct istream *istream, bool partial)
 {
-    struct http_client &client = http_client::FromResponseBody(*istream);
+    HttpClient &client = HttpClient::FromResponseBody(*istream);

     return client.GetAvailable(partial);
 }

 inline void
-http_client::Read()
+HttpClient::Read()
 {
     assert(!socket.ended || response_body_reader.IsSocketDone(socket));
     assert(response.read_state == response::READ_BODY);
@@ -356,13 +356,13 @@
 static void
 http_client_response_stream_read(struct istream *istream)
 {
-    struct http_client &client = http_client::FromResponseBody(*istream);
+    HttpClient &client = HttpClient::FromResponseBody(*istream);

     client.Read();
 }

 inline int
-http_client::AsFD()
+HttpClient::AsFD()
 {
     assert(!socket.ended || response_body_reader.IsSocketDone(socket));
     assert(response.read_state == response::READ_BODY);
@@ -386,13 +386,13 @@
 static int
 http_client_response_stream_as_fd(struct istream *istream)
 {
-    struct http_client &client = http_client::FromResponseBody(*istream);
+    HttpClient &client = HttpClient::FromResponseBody(*istream);

     return client.AsFD();
 }

 inline void
-http_client::Close()
+HttpClient::Close()
 {
     assert(response.read_state == response::READ_BODY);
     assert(request.handler.IsUsed());
@@ -410,7 +410,7 @@
 static void
 http_client_response_stream_close(struct istream *istream)
 {
-    struct http_client &client = http_client::FromResponseBody(*istream);
+    HttpClient &client = HttpClient::FromResponseBody(*istream);

     client.Close();
 }
@@ -423,7 +423,7 @@
 };

 inline bool
-http_client::ParseStatusLine(const char *line, size_t length)
+HttpClient::ParseStatusLine(const char *line, size_t length)
 {
     assert(response.read_state == response::READ_STATUS);

@@ -473,7 +473,7 @@
 }

 inline bool
-http_client::HeadersFinished()
+HttpClient::HeadersFinished()
 {
     stopwatch_event(stopwatch, "headers");

@@ -569,7 +569,7 @@
 }

 inline bool
-http_client::HandleLine(const char *line, size_t length)
+HttpClient::HandleLine(const char *line, size_t length)
 {
     assert(response.read_state == response::READ_STATUS ||
            response.read_state == response::READ_HEADERS);
@@ -585,9 +585,9 @@
 }

 static void
-http_client_response_finished(struct http_client *client)
-{
-    assert(client->response.read_state == http_client::response::READ_BODY);
+http_client_response_finished(HttpClient *client)
+{
+    assert(client->response.read_state == HttpClient::response::READ_BODY);
     assert(client->request.handler.IsUsed());

     stopwatch_event(client->stopwatch, "end");
@@ -605,7 +605,7 @@
 }

 inline BufferedResult
-http_client::ParseHeaders(const void *_data, size_t length)
+HttpClient::ParseHeaders(const void *_data, size_t length)
 {
     assert(response.read_state == response::READ_STATUS ||
            response.read_state == response::READ_HEADERS);
@@ -645,7 +645,7 @@
 }

 void
-http_client::ResponseBodyEOF()
+HttpClient::ResponseBodyEOF()
 {
     assert(response.read_state == response::READ_BODY);
     assert(request.handler.IsUsed());
@@ -665,7 +665,7 @@
 }

 inline BufferedResult
-http_client::FeedBody(const void *data, size_t length)
+HttpClient::FeedBody(const void *data, size_t length)
 {
     assert(response.read_state == response::READ_BODY);

@@ -692,7 +692,7 @@
 }

 BufferedResult
-http_client::FeedHeaders(const void *data, size_t length)
+HttpClient::FeedHeaders(const void *data, size_t length)
 {
     assert(response.read_state == response::READ_STATUS ||
            response.read_state == response::READ_HEADERS);
@@ -732,7 +732,7 @@
                                                 "Peer closed the socket prematurely after status 100");
 #ifndef NDEBUG
             /* assertion workaround */
-            response.read_state = http_client::response::READ_STATUS;
+            response.read_state = HttpClient::response::READ_STATUS;
 #endif
             AbortResponseHeaders(error);
             return BufferedResult::CLOSED;
@@ -783,7 +783,7 @@
 }

 inline DirectResult
-http_client::TryResponseDirect(int fd, enum istream_direct fd_type)
+HttpClient::TryResponseDirect(int fd, enum istream_direct fd_type)
 {
     assert(socket.IsConnected());
     assert(response.read_state == response::READ_BODY);
@@ -825,7 +825,7 @@
 }

 inline BufferedResult
-http_client::Feed(const void *data, size_t length)
+HttpClient::Feed(const void *data, size_t length)
 {
     switch (response.read_state) {
     case response::READ_STATUS:
@@ -855,7 +855,7 @@
 static BufferedResult
 http_client_socket_data(const void *buffer, size_t size, void *ctx)
 {
-    struct http_client *client = (struct http_client *)ctx;
+    HttpClient *client = (HttpClient *)ctx;

     const ScopePoolRef ref(*client->pool TRACE_ARGS);
     return client->Feed(buffer, size);
@@ -864,7 +864,7 @@
 static DirectResult
 http_client_socket_direct(int fd, enum istream_direct fd_type, void *ctx)
 {
-    struct http_client *client = (struct http_client *)ctx;
+    HttpClient *client = (HttpClient *)ctx;

     return client->TryResponseDirect(fd, fd_type);

@@ -873,7 +873,7 @@
 static bool
 http_client_socket_closed(void *ctx)
 {
-    struct http_client *client = (struct http_client *)ctx;
+    HttpClient *client = (HttpClient *)ctx;

     stopwatch_event(client->stopwatch, "end");

@@ -889,9 +889,9 @@
 static bool
 http_client_socket_remaining(size_t remaining, void *ctx)
 {
-    struct http_client *client = (struct http_client *)ctx;
-
-    if (client->response.read_state < http_client::response::READ_BODY)
+    HttpClient *client = (HttpClient *)ctx;
+
+    if (client->response.read_state < HttpClient::response::READ_BODY)
         /* this information comes too early, we can't use it */
         return true;

@@ -909,7 +909,7 @@
 static bool
 http_client_socket_write(void *ctx)
 {
-    struct http_client *client = (struct http_client *)ctx;
+    HttpClient *client = (HttpClient *)ctx;

     const ScopePoolRef ref(*client->pool TRACE_ARGS);

@@ -931,7 +931,7 @@
 static enum write_result
 http_client_socket_broken(void *ctx)
 {
-    struct http_client *client = (struct http_client *)ctx;
+    HttpClient *client = (HttpClient *)ctx;

     /* the server has closed the connection, probably because he's not
        interested in our request body - that's ok; now we wait for his
@@ -950,7 +950,7 @@
 static void
 http_client_socket_error(GError *error, void *ctx)
 {
-    struct http_client *client = (struct http_client *)ctx;
+    HttpClient *client = (HttpClient *)ctx;

     stopwatch_event(client->stopwatch, "error");
     client->AbortResponse(error);
@@ -975,7 +975,7 @@
 static size_t
 http_client_request_stream_data(const void *data, size_t length, void *ctx)
 {
-    struct http_client *client = (struct http_client *)ctx;
+    HttpClient *client = (HttpClient *)ctx;

     assert(client->socket.IsConnected());

@@ -1005,7 +1005,7 @@
 http_client_request_stream_direct(istream_direct type, int fd,
                                   size_t max_length, void *ctx)
 {
-    struct http_client *client = (struct http_client *)ctx;
+    HttpClient *client = (HttpClient *)ctx;

     assert(client->socket.IsConnected());

@@ -1031,7 +1031,7 @@
 static void
 http_client_request_stream_eof(void *ctx)
 {
-    struct http_client *client = (struct http_client *)ctx;
+    HttpClient *client = (HttpClient *)ctx;

     stopwatch_event(client->stopwatch, "request");

@@ -1045,17 +1045,17 @@
 static void
 http_client_request_stream_abort(GError *error, void *ctx)
 {
-    struct http_client *client = (struct http_client *)ctx;
-
-    assert(client->response.read_state == http_client::response::READ_STATUS ||
-           client->response.read_state == http_client::response::READ_HEADERS ||
-           client->response.read_state == http_client::response::READ_BODY);
+    HttpClient *client = (HttpClient *)ctx;
+
+    assert(client->response.read_state == HttpClient::response::READ_STATUS ||
+           client->response.read_state == HttpClient::response::READ_HEADERS ||
+           client->response.read_state == HttpClient::response::READ_BODY);

     stopwatch_event(client->stopwatch, "abort");

     client->request.istream = nullptr;

-    if (client->response.read_state != http_client::response::READ_BODY)
+    if (client->response.read_state != HttpClient::response::READ_BODY)
         client->AbortResponseHeaders(error);
     else if (client->response.body != nullptr)
         client->AbortResponseBody(error);
@@ -1077,7 +1077,7 @@
  */

 inline void
-http_client::Abort()
+HttpClient::Abort()
 {
     stopwatch_event(stopwatch, "abort");

@@ -1095,7 +1095,7 @@
 static void
 http_client_request_abort(struct async_operation *ao)
 {
-    struct http_client &client = http_client::FromAsync(*ao);
+    HttpClient &client = HttpClient::FromAsync(*ao);

     client.Abort();
 }
@@ -1111,16 +1111,16 @@
  */

 inline
-http_client::http_client(struct pool &_caller_pool, struct pool &_pool,
-                         int fd, enum istream_direct fd_type,
-                         const struct lease &lease, void *lease_ctx,
-                         const SocketFilter *filter, void *filter_ctx,
-                         http_method_t method, const char *uri,
-                         HttpHeaders &&headers,
-                         struct istream *body, bool expect_100,
-                         const struct http_response_handler &handler,
-                         void *ctx,
-                         struct async_operation_ref &async_ref)
+HttpClient::HttpClient(struct pool &_caller_pool, struct pool &_pool,
+                       int fd, enum istream_direct fd_type,
+                       const struct lease &lease, void *lease_ctx,
+                       const SocketFilter *filter, void *filter_ctx,
+                       http_method_t method, const char *uri,
+                       HttpHeaders &&headers,
+                       struct istream *body, bool expect_100,
+                       const struct http_response_handler &handler,
+                       void *ctx,
+                       struct async_operation_ref &async_ref)
     :pool(&_pool), caller_pool(&_caller_pool),
      peer_name(p_strdup(pool, get_peer_name(fd))),
      stopwatch(stopwatch_fd_new(pool, fd, uri))
@@ -1132,7 +1132,7 @@
     p_lease_ref_set(lease_ref, lease, lease_ctx,
                     *pool, "http_client_lease");

-    response.read_state = http_client::response::READ_STATUS;
+    response.read_state = HttpClient::response::READ_STATUS;
     response.no_body = http_method_is_empty(method);

     pool_ref(caller_pool);
@@ -1236,11 +1236,11 @@
     struct pool *pool =
         pool_new_linear(&caller_pool, "http_client_request", 8192);

-    NewFromPool<struct http_client>(*pool, caller_pool, *pool,
-                                    fd, fd_type,
-                                    lease, lease_ctx,
-                                    filter, filter_ctx,
-                                    method, uri,
-                                    std::move(headers), body, expect_100,
-                                    handler, ctx, async_ref);
-}
+    NewFromPool<HttpClient>(*pool, caller_pool, *pool,
+                            fd, fd_type,
+                            lease, lease_ctx,
+                            filter, filter_ctx,
+                            method, uri,
+                            std::move(headers), body, expect_100,
+                            handler, ctx, async_ref);
+}


transport: merge response write and error handling continuations

The response write continuation does not defer, so traditional try/catch
works well and saves a continuation.

--- transport/server.cc
+++ transport/server.cc
@@ -713,12 +713,14 @@
                             return process_request_stage(this, bv, op, stream, service::client_state(service::client_state::request_copy_tag{}, client_state, ts), tracing_requested);
                         });
                     }
-                }().then([this, flags] (processing_result&& response) {
+                }().then_wrapped([this, flags, buf = std::move(buf), mem_permit = std::move(mem_permit), leave = std::move(leave)] (future<processing_result> response_f) {
+                  try {
+                    auto response = response_f.get0();
                     update_client_state(response);
                     write_response(std::move(response.cql_response), _compression);
-                }).handle_exception([buf = std::move(buf), mem_permit = std::move(mem_permit), leave = std::move(leave)] (std::exception_ptr ex) {
-                    // Not only logging, but also keeping buf and leave alive.
-                    clogger.error("request processing failed: {}", ex);
+                  } catch (...) {
+                    clogger.error("request processing failed: {}", std::current_exception());
+                  }
                 });
             }();


more includes for timer

more includes for timer

--- include/mapnik/timer.hpp
+++ include/mapnik/timer.hpp
@@ -25,6 +25,8 @@

 #include <cstdlib>
 #include <string>
+#include <sstream>
+#include <iomanip>
 #include <sys/time.h>

 namespace mapnik {


Skip socket stress tests on KVM platform.

They time out.

PiperOrigin-RevId: 327830892

--- test/syscalls/linux/socket_generic_stress.cc
+++ test/syscalls/linux/socket_generic_stress.cc
@@ -30,6 +30,9 @@
 using ConnectStressTest = SocketPairTest;

 TEST_P(ConnectStressTest, Reset65kTimes) {
+  // TODO(b/165912341): These are too slow on KVM platform with nested virt.
+  SKIP_IF(GvisorPlatform() == Platform::kKVM);
+
   for (int i = 0; i < 1 << 16; ++i) {
     auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair());

@@ -68,6 +71,9 @@
 using PersistentListenerConnectStressTest = SocketPairTest;

 TEST_P(PersistentListenerConnectStressTest, 65kTimesShutdownCloseFirst) {
+  // TODO(b/165912341): These are too slow on KVM platform with nested virt.
+  SKIP_IF(GvisorPlatform() == Platform::kKVM);
+
   for (int i = 0; i < 1 << 16; ++i) {
     auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair());
     ASSERT_THAT(shutdown(sockets->first_fd(), SHUT_RDWR), SyscallSucceeds());
@@ -87,6 +93,9 @@
 }

 TEST_P(PersistentListenerConnectStressTest, 65kTimesShutdownCloseSecond) {
+  // TODO(b/165912341): These are too slow on KVM platform with nested virt.
+  SKIP_IF(GvisorPlatform() == Platform::kKVM);
+
   for (int i = 0; i < 1 << 16; ++i) {
     auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair());
     ASSERT_THAT(shutdown(sockets->second_fd(), SHUT_RDWR), SyscallSucceeds());
@@ -106,6 +115,9 @@
 }

 TEST_P(PersistentListenerConnectStressTest, 65kTimesClose) {
+  // TODO(b/165912341): These are too slow on KVM platform with nested virt.
+  SKIP_IF(GvisorPlatform() == Platform::kKVM);
+
   for (int i = 0; i < 1 << 16; ++i) {
     auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair());
   }


transport/server: Fix "already exists" error serialization

The serialization for "already exists" error is special as explained in
the CQL binary protocol specification:

  0x2400    Already_exists: The query attempted to create a keyspace or a
            table that was already existing. The rest of the ERROR message
            body will be <ks><table> where:
              <ks> is a [string] representing either the keyspace that
                   already exists, or the keyspace in which the table that
                   already exists is.
              <table> is a [string] representing the name of the table that
                      already exists. If the query was attempting to create a
                      keyspace, <table> will be present but will be the empty
                      string.

Fix that to unconfuse "cqlsh" when attemting to create a duplicate
keyspace or table.

Signed-off-by: Pekka Enberg <add4fcd06328a394f0ad91feda7ee057316dc5ed@cloudius-systems.com>

--- transport/server.cc
+++ transport/server.cc
@@ -162,6 +162,7 @@
     future<> process_batch(uint16_t stream, temporary_buffer<char> buf);
     future<> process_register(uint16_t stream, temporary_buffer<char> buf);

+    future<> write_already_exists_error(int16_t stream, exceptions::exception_code err, sstring msg, sstring ks_name, sstring cf_name);
     future<> write_error(int16_t stream, exceptions::exception_code err, sstring msg);
     future<> write_ready(int16_t stream);
     future<> write_supported(int16_t stream);
@@ -358,6 +359,8 @@
         }).then_wrapped([stream = f.stream, this] (future<> f) {
             try {
                 f.get();
+            } catch (const exceptions::already_exists_exception& ex) {
+                write_already_exists_error(stream, ex.code(), ex.what(), ex.ks_name, ex.cf_name);
             } catch (const exceptions::cassandra_exception& ex) {
                 write_error(stream, ex.code(), ex.what());
             } catch (std::exception& ex) {
@@ -468,6 +471,16 @@
 {
     print("warning: ignoring event registration\n");
     return write_ready(stream);
+}
+
+future<> cql_server::connection::write_already_exists_error(int16_t stream, exceptions::exception_code err, sstring msg, sstring ks_name, sstring cf_name)
+{
+    auto response = make_shared<cql_server::response>(stream, cql_binary_opcode::ERROR);
+    response->write_int(static_cast<int32_t>(err));
+    response->write_string(msg);
+    response->write_string(ks_name);
+    response->write_string(cf_name);
+    return write_response(response);
 }

 future<> cql_server::connection::write_error(int16_t stream, exceptions::exception_code err, sstring msg)


factor the string storage into TBuffer

factor the string storage into TBuffer

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@12555 27541ba8-7e3a-0410-8455-c3a389f83636


a little optimization of Fp12::mul

a little optimization of Fp12::mul

--- include/mcl/fp_tower.hpp
+++ include/mcl/fp_tower.hpp
@@ -764,6 +764,8 @@
 template<class Fp> Fp2T<Fp> Fp2T<Fp>::g2[Fp2T<Fp>::gN];
 template<class Fp> Fp2T<Fp> Fp2T<Fp>::g3[Fp2T<Fp>::gN];

+template<class Fp>
+struct Fp6DblT;
 /*
 	Fp6T = Fp2[v] / (v^3 - xi)
 	x = a + b v + c v^2
@@ -774,6 +776,7 @@
 	typedef _Fp Fp;
 	typedef Fp2T<Fp> Fp2;
 	typedef Fp2DblT<Fp> Fp2Dbl;
+	typedef Fp6DblT<Fp> Fp6Dbl;
 	typedef Fp BaseFp;
 	Fp2 a, b, c;
 	Fp6T() { }
@@ -904,91 +907,7 @@
 		y.b += t1; // c^2 xi + 2ab
 		y.c -= t1; // b^2 + 2ac
 	}
-	/*
-		x = a + bv + cv^2, y = d + ev + fv^2, v^3 = xi
-		xy = (ad + (bf + ce)xi) + ((ae + bd) + cf xi)v + ((af + cd) + be)v^2
-		bf + ce = (b + c)(e + f) - be - cf
-		ae + bd = (a + b)(e + d) - ad - be
-		af + cd = (a + c)(d + f) - ad - cf
-	*/
-	static void mul(Fp6T& z, const Fp6T& x, const Fp6T& y)
-	{
-//clk.begin();
-		const Fp2& a = x.a;
-		const Fp2& b = x.b;
-		const Fp2& c = x.c;
-		const Fp2& d = y.a;
-		const Fp2& e = y.b;
-		const Fp2& f = y.c;
-#if 1
-		Fp2Dbl AD, BE, CF;
-		Fp2Dbl::mulPre(AD, a, d);
-		Fp2Dbl::mulPre(BE, b, e);
-		Fp2Dbl::mulPre(CF, c, f);
-
-		Fp2 t1, t2, t3, t4;
-		Fp2::add(t1, b, c);
-		Fp2::add(t2, e, f);
-		Fp2Dbl T1;
-		Fp2Dbl::mulPre(T1, t1, t2);
-		Fp2Dbl::sub(T1, T1, BE);
-		Fp2Dbl::sub(T1, T1, CF);
-		Fp2Dbl::mul_xi(T1, T1);
-
-		Fp2::add(t2, a, b);
-		Fp2::add(t3, e, d);
-		Fp2Dbl T2;
-		Fp2Dbl::mulPre(T2, t2, t3);
-		Fp2Dbl::sub(T2, T2, AD);
-		Fp2Dbl::sub(T2, T2, BE);
-
-		Fp2::add(t3, a, c);
-		Fp2::add(t4, d, f);
-		Fp2Dbl T3;
-		Fp2Dbl::mulPre(T3, t3, t4);
-		Fp2Dbl::sub(T3, T3, AD);
-		Fp2Dbl::sub(T3, T3, CF);
-
-		Fp2Dbl::add(AD, AD, T1);
-		Fp2Dbl::mod(z.a, AD);
-		Fp2Dbl::mul_xi(CF, CF);
-		Fp2Dbl::add(CF, CF, T2);
-		Fp2Dbl::mod(z.b, CF);
-		Fp2Dbl::add(T3, T3, BE);
-		Fp2Dbl::mod(z.c, T3);
-#else
-		Fp2 ad, be, cf;
-		Fp2::mul(ad, a, d);
-		Fp2::mul(be, b, e);
-		Fp2::mul(cf, c, f);
-
-		Fp2 t1, t2, t3, t4;
-		Fp2::add(t1, b, c);
-		Fp2::add(t2, e, f);
-		t1 *= t2;
-		t1 -= be;
-		t1 -= cf;
-		Fp2::mul_xi(t1, t1);
-
-		Fp2::add(t2, a, b);
-		Fp2::add(t3, e, d);
-		t2 *= t3;
-		t2 -= ad;
-		t2 -= be;
-
-		Fp2::add(t3, a, c);
-		Fp2::add(t4, d, f);
-		t3 *= t4;
-		t3 -= ad;
-		t3 -= cf;
-
-		Fp2::add(z.a, ad, t1);
-		Fp2::mul_xi(z.b, cf);
-		z.b += t2;
-		Fp2::add(z.c, t3, be);
-#endif
-//clk.end();
-	}
+	static inline void mul(Fp6T& z, const Fp6T& x, const Fp6T& y);
 	/*
 		x = a + bv + cv^2, v^3 = xi
 		y = 1/x = p/q where
@@ -1030,6 +949,94 @@
 	}
 };

+template<class Fp>
+struct Fp6DblT {
+	typedef Fp2T<Fp> Fp2;
+	typedef Fp6T<Fp> Fp6;
+	typedef Fp2DblT<Fp> Fp2Dbl;
+	typedef Fp6DblT<Fp> Fp6Dbl;
+	typedef fp::Unit Unit;
+	Fp2Dbl a, b, c;
+	static void add(Fp6Dbl& z, const Fp6Dbl& x, const Fp6Dbl& y)
+	{
+		Fp2Dbl::add(z.a, x.a, y.a);
+		Fp2Dbl::add(z.b, x.b, y.b);
+		Fp2Dbl::add(z.c, x.c, y.c);
+	}
+	static void sub(Fp6Dbl& z, const Fp6Dbl& x, const Fp6Dbl& y)
+	{
+		Fp2Dbl::sub(z.a, x.a, y.a);
+		Fp2Dbl::sub(z.b, x.b, y.b);
+		Fp2Dbl::sub(z.c, x.c, y.c);
+	}
+	/*
+		x = a + bv + cv^2, y = d + ev + fv^2, v^3 = xi
+		xy = (ad + (bf + ce)xi) + ((ae + bd) + cf xi)v + ((af + cd) + be)v^2
+		bf + ce = (b + c)(e + f) - be - cf
+		ae + bd = (a + b)(e + d) - ad - be
+		af + cd = (a + c)(d + f) - ad - cf
+	*/
+	static void mulPre(Fp6DblT& z, const Fp6& x, const Fp6& y)
+	{
+//clk.begin();
+		const Fp2& a = x.a;
+		const Fp2& b = x.b;
+		const Fp2& c = x.c;
+		const Fp2& d = y.a;
+		const Fp2& e = y.b;
+		const Fp2& f = y.c;
+		Fp2Dbl& za = z.a;
+		Fp2Dbl& zb = z.b;
+		Fp2Dbl& zc = z.c;
+		Fp2Dbl BE;
+		Fp2Dbl::mulPre(za, a, d);
+		Fp2Dbl::mulPre(BE, b, e);
+		Fp2Dbl::mulPre(zb, c, f);
+
+		Fp2 t1, t2, t3, t4;
+		Fp2::add(t1, b, c);
+		Fp2::add(t2, e, f);
+		Fp2Dbl T1;
+		Fp2Dbl::mulPre(T1, t1, t2);
+		Fp2Dbl::sub(T1, T1, BE);
+		Fp2Dbl::sub(T1, T1, zb);
+		Fp2Dbl::mul_xi(T1, T1);
+
+		Fp2::add(t2, a, b);
+		Fp2::add(t3, e, d);
+		Fp2Dbl T2;
+		Fp2Dbl::mulPre(T2, t2, t3);
+		Fp2Dbl::sub(T2, T2, za);
+		Fp2Dbl::sub(T2, T2, BE);
+
+		Fp2::add(t3, a, c);
+		Fp2::add(t4, d, f);
+		Fp2Dbl::mulPre(zc, t3, t4);
+		Fp2Dbl::sub(zc, zc, za);
+		Fp2Dbl::sub(zc, zc, zb);
+
+		Fp2Dbl::add(za, za, T1);
+		Fp2Dbl::mul_xi(zb, zb);
+		Fp2Dbl::add(zb, zb, T2);
+		Fp2Dbl::add(zc, zc, BE);
+//clk.end();
+	}
+	static void mod(Fp6& y, const Fp6Dbl& x)
+	{
+		Fp2Dbl::mod(y.a, x.a);
+		Fp2Dbl::mod(y.b, x.b);
+		Fp2Dbl::mod(y.c, x.c);
+	}
+};
+
+template<class Fp>
+inline void Fp6T<Fp>::mul(Fp6T<Fp>& z, const Fp6T<Fp>& x, const Fp6T<Fp>& y)
+{
+	Fp6DblT<Fp> Z;
+	Fp6DblT<Fp>::mulPre(Z, x, y);
+	Fp6DblT<Fp>::mod(z, Z);
+}
+
 /*
 	Fp12T = Fp6[w] / (w^2 - v)
 	x = a + b w
@@ -1039,6 +1046,8 @@
 	fp::Operator<Fp12T<Fp> > > {
 	typedef Fp2T<Fp> Fp2;
 	typedef Fp6T<Fp> Fp6;
+	typedef Fp2DblT<Fp> Fp2Dbl;
+	typedef Fp6DblT<Fp> Fp6Dbl;
 	typedef Fp BaseFp;
 	Fp6 a, b;
 	Fp12T() {}
@@ -1105,6 +1114,14 @@
 		Fp2::add(z.b, x.a, y.b);
 		Fp2::add(z.a, t, y.a);
 	}
+	static void mulVadd(Fp6Dbl& z, const Fp6Dbl& x, const Fp6Dbl& y)
+	{
+		Fp2Dbl t;
+		Fp2Dbl::mul_xi(t, x.c);
+		Fp2Dbl::add(z.c, x.b, y.c);
+		Fp2Dbl::add(z.b, x.a, y.b);
+		Fp2Dbl::add(z.a, t, y.a);
+	}
 	/*
 		x = a + bw, y = c + dw, w^2 = v
 		z = xy = (a + bw)(c + dw) = (ac + bdv) + (ad + bc)w
@@ -1114,19 +1131,33 @@
 	*/
 	static void mul(Fp12T& z, const Fp12T& x, const Fp12T& y)
 	{
+		// 4.7Kclk -> 4.55Kclk
 		const Fp6& a = x.a;
 		const Fp6& b = x.b;
 		const Fp6& c = y.a;
 		const Fp6& d = y.b;
-		Fp6 t1, t2, ac, bd;
+		Fp6 t1, t2;
 		Fp6::add(t1, a, b);
 		Fp6::add(t2, c, d);
+#if 1
+		Fp6Dbl T, AC, BD;
+		Fp6Dbl::mulPre(AC, a, c);
+		Fp6Dbl::mulPre(BD, b, d);
+		mulVadd(T, BD, AC);
+		Fp6Dbl::mod(z.a, T);
+		Fp6Dbl::mulPre(T, t1, t2); // (a + b)(c + d)
+		Fp6Dbl::sub(T, T, AC);
+		Fp6Dbl::sub(T, T, BD);
+		Fp6Dbl::mod(z.b, T);
+#else
+		Fp6 ac, bd;
 		t1 *= t2; // (a + b)(c + d)
 		Fp6::mul(ac, a, c);
 		Fp6::mul(bd, b, d);
 		mulVadd(z.a, bd, ac);
 		t1 -= ac;
 		Fp6::sub(z.b, t1, bd);
+#endif
 	}
 	/*
 		x = a + bw, w^2 = v


avoid cast of fpDbl_addPre/subPre

avoid cast of fpDbl_addPre/subPre

--- include/mcl/fp_tower.hpp
+++ include/mcl/fp_tower.hpp
@@ -141,27 +141,14 @@
 	static void addA(Unit *z, const Unit *x, const Unit *y) { Fp::op_.fpDbl_add(z, x, y, Fp::op_.p); }
 	static void subA(Unit *z, const Unit *x, const Unit *y) { Fp::op_.fpDbl_sub(z, x, y, Fp::op_.p); }
 	static void modA(Unit *z, const Unit *xy) { Fp::op_.fpDbl_mod(z, xy, Fp::op_.p); }
-	static void (*addPre)(FpDblT& z, const FpDblT& x, const FpDblT& y);
-	static void (*subPre)(FpDblT& z, const FpDblT& x, const FpDblT& y);
-	static void addPreC(FpDblT& z, const FpDblT& x, const FpDblT& y) { Fp::op_.fpDbl_addPre(z.v_, x.v_, y.v_); }
-	static void subPreC(FpDblT& z, const FpDblT& x, const FpDblT& y) { Fp::op_.fpDbl_subPre(z.v_, x.v_, y.v_); }
-#else
+#endif
 	static void addPre(FpDblT& z, const FpDblT& x, const FpDblT& y) { Fp::op_.fpDbl_addPre(z.v_, x.v_, y.v_); }
 	static void subPre(FpDblT& z, const FpDblT& x, const FpDblT& y) { Fp::op_.fpDbl_subPre(z.v_, x.v_, y.v_); }
-#endif
 	/*
 		mul(z, x, y) = mulPre(xy, x, y) + mod(z, xy)
 	*/
-	static void mulPre(FpDblT& xy, const Fp& x, const Fp& y)
-	{
-		const mcl::fp::Op& op = Fp::getOp();
-		op.fpDbl_mulPre(xy.v_, x.v_, y.v_);
-	}
-	static void sqrPre(FpDblT& xx, const Fp& x)
-	{
-		const mcl::fp::Op& op = Fp::getOp();
-		op.fpDbl_sqrPre(xx.v_, x.v_);
-	}
+	static void mulPre(FpDblT& xy, const Fp& x, const Fp& y) { Fp::op_.fpDbl_mulPre(xy.v_, x.v_, y.v_); }
+	static void sqrPre(FpDblT& xx, const Fp& x) { Fp::op_.fpDbl_sqrPre(xx.v_, x.v_); }
 	static void mulUnit(FpDblT& z, const FpDblT& x, Unit y)
 	{
 		if (mulSmallUnit(z, x, y)) return;
@@ -170,7 +157,7 @@
 	static void init()
 	{
 #ifdef MCL_XBYAK_DIRECT_CALL
-		mcl::fp::Op& op = Fp::getOpNonConst();
+		mcl::fp::Op& op = Fp::op_;
 		if (op.fpDbl_addA_ == 0) {
 			op.fpDbl_addA_ = addA;
 		}
@@ -180,20 +167,11 @@
 		if (op.fpDbl_modA_ == 0) {
 			op.fpDbl_modA_ = modA;
 		}
-		addPre = fp::func_ptr_cast<void (*)(FpDblT&, const FpDblT&, const FpDblT&)>(op.fpDbl_addPre);
-		if (addPre == 0) addPre = addPreC;
-		subPre = fp::func_ptr_cast<void (*)(FpDblT&, const FpDblT&, const FpDblT&)>(op.fpDbl_subPre);
-		if (subPre == 0) subPre = subPreC;
 #endif
 	}
 	void operator+=(const FpDblT& x) { add(*this, *this, x); }
 	void operator-=(const FpDblT& x) { sub(*this, *this, x); }
 };
-
-#ifdef MCL_XBYAK_DIRECT_CALL
-template<class Fp> void (*FpDblT<Fp>::addPre)(FpDblT&, const FpDblT&, const FpDblT&);
-template<class Fp> void (*FpDblT<Fp>::subPre)(FpDblT&, const FpDblT&, const FpDblT&);
-#endif

 /*
 	beta = -1


error: resolve isOK method

error: resolve isOK method

--- include/native/Error.hpp
+++ include/native/Error.hpp
@@ -60,7 +60,7 @@
   Error(const std::string &str) : _uv_err(-1), _str(str) {}
   ~Error() = default;
   bool isError() { return (_uv_err < 0); }
-  bool isOK() { return (_uv_err > 0); }
+  bool isOK() { return !isError(); }
   operator bool() { return isError(); }
   virtual Error &operator=(int iErrCode) {
     setError(iErrCode);


Get rid of an old file/idea.

Get rid of an old file/idea.

--- include/ndhist/dtype.hpp
+++ include/ndhist/dtype.hpp
@@ -1,115 +0,0 @@
-
-#ifndef NDHIST_DTYPE_H_INCLUDED
-#define NDHIST_DTYPE_H_INCLUDED 1
-
-#include <stdint.h>
-
-namespace ndhist {
-
-/**
- * The dtype_desc class provides a base class for all data type classes
- * usable with ndhist. It stores the size of the particular data type in bytes.
- */
-class dtype_desc
-{
-  public:
-    dtype_desc()
-      : size_(0)
-    {}
-
-    dtype_desc(size_t size)
-      : size_(size)
-    {}
-
-    inline
-    size_t GetSize() const { return size_; }
-
-  protected:
-    /// The size of the data type in bytes.
-    size_t size_;
-};
-
-template <CPPType>
-class dtype
-  : public dtype_desc
-{
-  public:
-    typedef CPPType cpp_type;
-
-    dtype()
-      : dtype_desc(sizeof(cpp_type))
-    {}
-};
-
-class float64
-  : public dtype<double>
-{
-  public:
-    typedef dtype<double> base;
-    typedef typename base::cpp_type cpp_type;
-
-    float64()
-      : base()
-    {}
-};
-
-class uint64
-  : public dtype<uint64_t>
-{
-  public:
-    typedef dtype<uint64_t> base;
-    typedef typename base::cpp_type cpp_type;
-
-    uint64()
-      : base()
-    {}
-};
-
-class dtype_value
-{
-  public:
-    dtype_value(dtype_desc const & dt)
-      : dtype_desc_(dt)
-      , data_(NULL)
-    {}
-
-    template <typename T>
-    bool
-    set(T value)
-    {
-        size_t sizeT = sizeof(T);
-        // Check if T is compatible with the given dtype_desc.
-        dtype<T> dt;
-        if(dt.GetSize() != sizeT)
-        {
-            return false;
-        }
-
-        // Allocate memory, if not done so alreay before.
-        if(data_ == NULL)
-        {
-            data_ = malloc(sizeT);
-            if(data_ == NULL)
-            {
-                return false;
-            }
-        }
-
-        memcpy(data_, &value, sizeT);
-        return true;
-    }
-
-    template <typename T>
-    T&
-    get()
-    {
-
-    }
-  protected:
-    char* data_;
-    dtype_desc dtype_desc_;
-};
-
-}// namespace ndhist
-
-#endif


include xml_parser from property_tree

include xml_parser from property_tree

--- include/pdal/Options.hpp
+++ include/pdal/Options.hpp
@@ -39,7 +39,7 @@
 #include <pdal/exceptions.hpp>
 #include <pdal/Bounds.hpp>
 #include <boost/property_tree/ptree.hpp>
-
+#include <boost/property_tree/xml_parser.hpp>

 namespace pdal
 {


Enable all bvh tests

Enable all bvh tests

--- geometry/spatial/bounding_volume_hierarchy_test.cc
+++ geometry/spatial/bounding_volume_hierarchy_test.cc
@@ -4,7 +4,6 @@
 #include "viewer/primitives/box.hh"
 #include "viewer/primitives/simple_geometry.hh"
 #include "viewer/window_3d.hh"
-#include "viewer/window_manager.hh"

 #include "geometry/import/read_stl.hh"
 #include "geometry/spatial/bounding_volume_hierarchy.hh"
@@ -34,17 +33,17 @@
 }

 void draw_children(const geometry::spatial::BoundingVolumeHierarchy &bvh, int base_node_ind) {
-  auto win                    = gl_viewer::get_window3d("Window A");
+  auto win = gl_viewer::get_window3d("Window A");
   auto draw_children_geometry = win->add_primitive<gl_viewer::SimpleGeometry>();

   Heap<int> stack;
   stack.push(base_node_ind);
   while (!stack.empty()) {
-    const int   next_index = stack.pop();
-    const auto &node       = bvh.tree()[next_index];
+    const int next_index = stack.pop();
+    const auto &node = bvh.tree()[next_index];
     if (node.is_leaf) {
       for (int k = node.leaf.start; k < node.leaf.end; ++k) {
-        const auto &              aabb = bvh.aabb()[k];
+        const auto &aabb = bvh.aabb()[k];
         gl_viewer::AxisAlignedBox gl_aabb;
         gl_aabb.lower = aabb.bbox.lower();
         gl_aabb.upper = aabb.bbox.upper();
@@ -61,7 +60,7 @@
 }

 void climb_tree(const geometry::spatial::BoundingVolumeHierarchy &bvh) {
-  auto win                 = gl_viewer::get_window3d("Window A");
+  auto win = gl_viewer::get_window3d("Window A");
   auto tree_climb_geometry = win->add_primitive<gl_viewer::SimpleGeometry>();

   // Explore first branch every time
@@ -80,7 +79,7 @@
   std::map<int, Eigen::Vector4d> colors;
   const auto tree = bvh.tree();
   while (heap.size()) {
-    const auto  next = heap.pop();
+    const auto next = heap.pop();
     const auto &node = tree[next.index];

     if (!node.is_leaf) {
@@ -100,7 +99,7 @@

       if (colors.count(next.depth) == 0) {
         colors[next.depth] = Eigen::Vector4d::Random();
-        const double t     = next.depth * (1.0 / 10.0);
+        const double t = next.depth * (1.0 / 10.0);
         colors[next.depth] = jcc::augment(gl_viewer::colors::viridis(t), 1.0);
       }
       aabb.color = colors[next.depth];
@@ -117,10 +116,8 @@
   auto win = gl_viewer::get_window3d("Window A");

   const std::string file_path = "/home/jacob/repos/experiments/data/test_stuff2.stl";
-  const auto        tri       = geometry::import::read_stl(file_path);
-
-  gl_viewer::WindowManager::draw();
-  auto scene_geometry   = win->add_primitive<gl_viewer::SimpleGeometry>();
+  const auto tri = geometry::import::read_stl(file_path);
+  auto scene_geometry = win->add_primitive<gl_viewer::SimpleGeometry>();
   auto visitor_geometry = win->add_primitive<gl_viewer::SimpleGeometry>();

   std::vector<geometry::spatial::Volume *> tri_ptrs;
@@ -162,7 +159,7 @@

   {
     geometry::Ray ray;
-    ray.origin    = Vec3(0.0, 0.0, 0.0);
+    ray.origin = Vec3(0.0, 0.0, 0.0);
     ray.direction = Vec3(1.0, 1.0, 1.0).normalized();

     scene_geometry->add_ray(ray, 10.0, Vec4(1.0, 0.0, 0.0, 1.0));
@@ -172,7 +169,7 @@
   {
     visitor_geometry->clear();
     geometry::Ray ray;
-    ray.origin    = Vec3(0.0, 0.0, 0.75);
+    ray.origin = Vec3(0.0, 0.0, 0.75);
     ray.direction = Vec3(-1.0, -1.0, 0.0).normalized();

     scene_geometry->add_ray(ray, 10.0, Vec4(1.0, 0.0, 0.0, 1.0));
@@ -186,64 +183,63 @@
   visitor_geometry->clear();
 }

-TEST(BoundingVolumeHierarchyTest, bounding_volumes) { /*
-   auto win = gl_viewer::get_window3d("Window A");
-
-   const std::string file_path = "/home/jacob/repos/experiments/data/test_stuff2.stl";
-   const auto        tri       = geometry::import::read_stl(file_path);
-
-   gl_viewer::WindowManager::draw();
-   auto scene_geometry   = win->add_primitive<gl_viewer::SimpleGeometry>();
-   auto visitor_geometry = win->add_primitive<gl_viewer::SimpleGeometry>();
-
-   std::vector<geometry::spatial::Volume *> tri_ptrs;
-   tri_ptrs.reserve(tri.triangles.size());
-   std::vector<geometry::spatial::TriangleVolume> triangles;
-   triangles.reserve(tri.triangles.size());
-
-   for (size_t k = 0; k < tri.triangles.size(); ++k) {
-     triangles.emplace_back(tri.triangles[k].vertices);
-     tri_ptrs.push_back(&triangles.back());
-   }
-
-   win->spin_until_step();
-
-   {
-     geometry::spatial::BoundingVolumeHierarchy bvh;
-     bvh.build(tri_ptrs);
-     verify_all_leaves_unique(bvh);
-     climb_tree(bvh);
-   }
-   return;
-
-   std::map<int, Eigen::Vector4d> colors;
-   for (int stop_depth = 0; stop_depth < 10; ++stop_depth) {
-     const auto visitor = [&visitor_geometry, &win, &colors, stop_depth](const geometry::spatial::BoundingBox<3> &box,
-                                                                         int depth, bool leaf) {
-       if ((depth != stop_depth) && !leaf) {
-         return;
-       }
-       gl_viewer::AxisAlignedBox aabb;
-       aabb.lower = box.lower();
-       aabb.upper = box.upper();
-
-       if (colors.count(depth) == 0) {
-         colors[depth] = Eigen::Vector4d::Random();
-       }
-       if (leaf) {
-         aabb.color = Eigen::Vector4d(0.0, 1.0, 0.0, 0.8);
-       } else {
-         aabb.color = colors[depth];
-       }
-       aabb.color[3] = 0.6;
-       aabb.color[0] = 1.0;
-
-       visitor_geometry->add_box(aabb);
-     };
-     geometry::spatial::BoundingVolumeHierarchy bvh;
-     bvh.build(tri_ptrs, visitor);
-     win->spin_until_step();
-     visitor_geometry->clear();
-   }
- */
-}
+TEST(BoundingVolumeHierarchyTest, bounding_volumes) {
+  auto win = gl_viewer::get_window3d("Window A");
+
+  const std::string file_path = "/home/jacob/repos/experiments/data/test_stuff2.stl";
+  const auto tri = geometry::import::read_stl(file_path);
+
+  auto scene_geometry = win->add_primitive<gl_viewer::SimpleGeometry>();
+  auto visitor_geometry = win->add_primitive<gl_viewer::SimpleGeometry>();
+
+  std::vector<geometry::spatial::Volume *> tri_ptrs;
+  tri_ptrs.reserve(tri.triangles.size());
+  std::vector<geometry::spatial::TriangleVolume> triangles;
+  triangles.reserve(tri.triangles.size());
+
+  for (size_t k = 0; k < tri.triangles.size(); ++k) {
+    triangles.emplace_back(tri.triangles[k].vertices);
+    tri_ptrs.push_back(&triangles.back());
+  }
+
+  win->spin_until_step();
+
+  {
+    geometry::spatial::BoundingVolumeHierarchy bvh;
+    bvh.build(tri_ptrs);
+    verify_all_leaves_unique(bvh);
+    climb_tree(bvh);
+  }
+  return;
+
+  std::map<int, Eigen::Vector4d> colors;
+  for (int stop_depth = 0; stop_depth < 10; ++stop_depth) {
+    const auto visitor = [&visitor_geometry, &win, &colors, stop_depth](const geometry::spatial::BoundingBox<3> &box,
+                                                                        int depth, bool leaf) {
+      if ((depth != stop_depth) && !leaf) {
+        return;
+      }
+      gl_viewer::AxisAlignedBox aabb;
+      aabb.lower = box.lower();
+      aabb.upper = box.upper();
+
+      if (colors.count(depth) == 0) {
+        colors[depth] = Eigen::Vector4d::Random();
+      }
+      if (leaf) {
+        aabb.color = Eigen::Vector4d(0.0, 1.0, 0.0, 0.8);
+      } else {
+        aabb.color = colors[depth];
+      }
+      aabb.color[3] = 0.6;
+      aabb.color[0] = 1.0;
+
+      visitor_geometry->add_box(aabb);
+    };
+    geometry::spatial::BoundingVolumeHierarchy bvh;
+    bvh.build(tri_ptrs, visitor);
+    win->spin_until_step();
+    visitor_geometry->clear();
+  }
+  win->spin_until_step();
+}


BackendData: don't search for an empty jobRef()

--- src/backenddata.cpp
+++ src/backenddata.cpp
@@ -98,10 +98,13 @@
     _archiveMap.insert(archive->name(), archive);

     // Ensure that the archive is attached to the job (if applicable).
-    for(const JobPtr &job : _jobMap)
-    {
-        if(job->objectKey() == archive->jobRef())
-            emit job->loadArchives();
+    if(!archive->jobRef().isEmpty())
+    {
+        for(const JobPtr &job : _jobMap)
+        {
+            if(job->objectKey() == archive->jobRef())
+                emit job->loadArchives();
+        }
     }
     return archive;
 }


Added tests for V1 compatibility

Added tests for V1 compatibility

--- test/signature.cpp
+++ test/signature.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Luca Zanconato
+ * Copyright 2016-2017 Luca Zanconato
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -303,3 +303,56 @@
         ASSERT_STREQ(ex.what(), "Final block already added.");
     }
 }
+
+TEST(signature, attached_version_one) {
+
+    saltpack::BYTE_ARRAY signer_secretkey({245, 6, 38, 38, 136, 83, 114, 248, 171, 127, 74, 11, 45, 29, 126, 213, 7,
+                                           236, 174, 197, 99, 201, 193, 207, 16, 91, 166, 133, 141, 50, 144, 211, 199,
+                                           45, 196, 24, 141, 60, 173, 36, 11, 156, 148, 221, 212, 160, 252, 133, 136,
+                                           160, 73, 11, 23, 129, 243, 218, 57, 180, 252, 17, 133, 46, 244, 139});
+    saltpack::BYTE_ARRAY signer_publickey({199, 45, 196, 24, 141, 60, 173, 36, 11, 156, 148, 221, 212, 160, 252, 133,
+                                           136, 160, 73, 11, 23, 129, 243, 218, 57, 180, 252, 17, 133, 46, 244, 139});
+
+    std::string ciphertext = "BEGIN SALTPACK SIGNED MESSAGE. kYM5h1pg6qz9UMn j6G7KB2OUmwXTFd 8hHAxRyMXKWKOxs "
+            "bECTM8qEn3zYPTA s94LWmdVgpRAw9I fxsGWxHAkkzEaL1 PfDAsXLp9Zq5ymY 5dySiZQZ5uC3IKy 9VGvkwoHiY8tLW1 "
+            "iF5oHeppoqzIN0N 6ySAuKEqldHH8TL j4z3Q4x5C7Rp1lt 7uQljohrfLUO7qx 5EbIJbUQqM22Geh VFAaePwM5YjWGEg "
+            "k2um83NphtgtIZQ fW0Aivnts1DYmJ7 bZHBN0yidHwJ2FY 5kmC0vApVJrJfni PwhFaGfjlMnghwS Y5G2v0olHriQMTV "
+            "rEEy. END SALTPACK SIGNED MESSAGE.";
+
+    // verify message
+    std::stringstream in(ciphertext);
+    saltpack::ArmoredInputStream is(in);
+    std::stringstream msg;
+    saltpack::MessageReader *dec = new saltpack::MessageReader(is);
+    while (dec->hasMoreBlocks()) {
+
+        saltpack::BYTE_ARRAY message = dec->getBlock();
+        msg.write(reinterpret_cast<const char *>(message.data()), message.size());
+    }
+    ASSERT_EQ(signer_publickey, dec->getSender());
+    delete dec;
+
+    ASSERT_EQ(msg.str(), "Signed message\n");
+}
+
+TEST(signature, detached_version_one) {
+
+    saltpack::BYTE_ARRAY signer_secretkey({245, 6, 38, 38, 136, 83, 114, 248, 171, 127, 74, 11, 45, 29, 126, 213, 7,
+                                           236, 174, 197, 99, 201, 193, 207, 16, 91, 166, 133, 141, 50, 144, 211, 199,
+                                           45, 196, 24, 141, 60, 173, 36, 11, 156, 148, 221, 212, 160, 252, 133, 136,
+                                           160, 73, 11, 23, 129, 243, 218, 57, 180, 252, 17, 133, 46, 244, 139});
+    saltpack::BYTE_ARRAY signer_publickey({199, 45, 196, 24, 141, 60, 173, 36, 11, 156, 148, 221, 212, 160, 252, 133,
+                                           136, 160, 73, 11, 23, 129, 243, 218, 57, 180, 252, 17, 133, 46, 244, 139});
+
+    std::string ciphertext = "BEGIN SALTPACK DETACHED SIGNATURE. kYM5h1pg6qz9UMn j6G7KBABYp9npL6 oT1KkalFeaDwWxs "
+            "bECTM8qEn3zYPTA s94LWmdVgpbwCki T35ZsJvycdnnkp5 xjaos54GAI71l9u lGzcrkDkh1iVWXY j8FY4EefSR9qMdi "
+            "p8bqfMDseqX84Y2 5dtmyvwTiGQKs1O B40DzEV9VHZbchf PVh04NGL8rZHdQf 1wzeX5z. END SALTPACK DETACHED SIGNATURE.";
+
+    // verify message
+    std::stringstream in(ciphertext);
+    std::stringstream msg("Signed message 2\n");
+    saltpack::ArmoredInputStream is(in);
+    saltpack::MessageReader *dec = new saltpack::MessageReader(is, msg);
+    ASSERT_EQ(signer_publickey, dec->getSender());
+    delete dec;
+}


FIX: PrintSelf test was failing

FIX: PrintSelf test was failing

--- Graphics/vtkWindowedSincPolyDataFilter.cxx
+++ Graphics/vtkWindowedSincPolyDataFilter.cxx
@@ -25,7 +25,7 @@
 #include "vtkTriangle.h"
 #include "vtkTriangleFilter.h"

-vtkCxxRevisionMacro(vtkWindowedSincPolyDataFilter, "1.36");
+vtkCxxRevisionMacro(vtkWindowedSincPolyDataFilter, "1.37");
 vtkStandardNewMacro(vtkWindowedSincPolyDataFilter);

 // Construct object with number of iterations 20; passband .1;
@@ -786,6 +786,7 @@

   os << indent << "Number of Iterations: " << this->NumberOfIterations << "\n";
   os << indent << "Passband: " << this->PassBand << "\n";
+  os << indent << "Normalize Coordinates: " << (this->NormalizeCoordinates ? "On\n" : "Off\n");
   os << indent << "Feature Edge Smoothing: " << (this->FeatureEdgeSmoothing ? "On\n" : "Off\n");
   os << indent << "Feature Angle: " << this->FeatureAngle << "\n";
   os << indent << "Edge Angle: " << this->EdgeAngle << "\n";


ResourceManager: Rename load_surface to load_texture

--- strapon/resource_manager/resource_manager.hpp
+++ strapon/resource_manager/resource_manager.hpp
@@ -27,7 +27,7 @@
 	}

 	/***/
-	bool load_surface(const std::string &key,
+	bool load_texture(const std::string &key,
 					  const std::string &path,
 					  SDL_Renderer *ren) {
 		SDL_Texture *texture;


Fix building of JavaHL.  We still get test failures, though.

* subversion/bindings/javahl/native/CreateJ.cpp
  (ReposNotifyInformation): Use the warning_str instead of the warning.

--- subversion/bindings/javahl/native/CreateJ.cpp
+++ subversion/bindings/javahl/native/CreateJ.cpp
@@ -755,7 +755,7 @@
   if (JNIUtil::isJavaExceptionThrown())
     POP_AND_RETURN_NULL;

-  jstring jWarning = JNIUtil::makeJString(reposNotify->warning);
+  jstring jWarning = JNIUtil::makeJString(reposNotify->warning_str);
   if (JNIUtil::isJavaExceptionThrown())
     POP_AND_RETURN_NULL;


store connections in a QHash which gets instantiated with an application

Signed-off-by: mkozjak <33ca8347785e11ec875b554f3d6b1d87b5459732@gmail.com>

--- recurse.hpp
+++ recurse.hpp
@@ -36,12 +36,21 @@
 private:
     QCoreApplication app;
     QTcpServer m_tcp_server;
+
     quint64 m_port;
     QVector<next_f> m_middleware;
     int current_middleware = 0;
-    void m_next(Request &request, Response &response);
+    void m_next(int &socket_id);
     void http_parse(Request &request);
     QString http_build_header(const Response &response);
+
+    struct Client {
+        QTcpSocket *socket;
+        Request request;
+        Response response;
+    };
+
+    QHash<int, Client> connections;
 };

 Recurse::Recurse(int & argc, char ** argv, QObject *parent) : app(argc, argv)
@@ -72,37 +81,43 @@

     connect(&m_tcp_server, &QTcpServer::newConnection, [this] {
         qDebug() << "client connected";
-        QTcpSocket *client = m_tcp_server.nextPendingConnection();
-
-        connect(client, &QTcpSocket::readyRead, [this, client] {
-            Request request;
-            Response response;
-
-            request.data = client->readAll();
-            http_parse(request);
-
-            qDebug() << "client request: " << request.data;
+        int socket_id = rand();
+
+        connections[socket_id] = {
+             m_tcp_server.nextPendingConnection()
+        };
+
+        connect(connections[socket_id].socket, &QTcpSocket::readyRead, [this, socket_id] {
+            connections[socket_id].request.data = connections[socket_id].socket->readAll();
+            http_parse(connections[socket_id].request);
+
+            qDebug() << "client request: " << connections[socket_id].request.data;

             if (m_middleware.count() > 0)
-                m_middleware[current_middleware](request, response, bind(&Recurse::m_next, this, ref(request), ref(response)));
+                m_middleware[current_middleware](
+                    connections[socket_id].request,
+                    connections[socket_id].response,
+                    bind(&Recurse::m_next, this, socket_id));

             current_middleware = 0;
             QString header;

-            response.method = request.method;
-            response.proto = request.proto;
-
-            if (response.status == 0)
-                response.status = 200;
-
-            header = http_build_header(response);
-            QString response_data = header + response.body;
+            connections[socket_id].response.method = connections[socket_id].request.method;
+            connections[socket_id].response.proto = connections[socket_id].request.proto;
+
+            if (connections[socket_id].response.status == 0)
+                connections[socket_id].response.status = 200;
+
+            header = http_build_header(connections[socket_id].response);
+            QString response_data = header + connections[socket_id].response.body;

             // send response to the client
-            qint64 check = client->write(response_data.toStdString().c_str(), response_data.size());
+            qint64 check = connections[socket_id].socket->write(
+                response_data.toStdString().c_str(),
+                response_data.size());

             qDebug() << "socket write debug:" << check;
-            client->close();
+            connections[socket_id].socket->close();
         });
     });

@@ -113,7 +128,7 @@
 //! \brief Recurse::m_next
 //! call next middleware
 //!
-void Recurse::m_next(Request &request, Response &response)
+void Recurse::m_next(int &socket_id)
 {
     qDebug() << "calling next:" << current_middleware << " num:" << m_middleware.size();

@@ -121,8 +136,10 @@
         return;
     };

-    m_middleware[current_middleware](request, response, bind(&Recurse::m_next, this, ref(request), ref(response)));
-
+    m_middleware[current_middleware](
+        connections[socket_id].request,
+        connections[socket_id].response,
+        bind(&Recurse::m_next, this, socket_id));
 };

 //!


* subversion/bindings/javahl/native/JNIUtil.cpp
  (checkJavaException): Add TODO.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@1664616 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/bindings/javahl/native/JNIUtil.cpp
+++ subversion/bindings/javahl/native/JNIUtil.cpp
@@ -804,6 +804,25 @@
     err->message = apr_psprintf(err->pool, _("Java exception: %s"), msg);
   else
     err->message = _("Java exception");
+
+
+  /* ### TODO: Use apr_pool_userdata_set() on the pool we just created
+               for the error chain to keep track of the actual Java
+               exception while the error is inside Subversion.
+
+               Once the error chain re-enters JavaHL we can check
+               if there is a true exception that we can add to the chain.
+
+               If the error is cleared in Subversion (which may happen
+               during composing error chains, etc.) the cleanup handler
+               handles properly releasing the exception.
+
+    apr_status_t
+    apr_pool_userdata_set(const void *data,
+                          const char *key,
+                          apr_status_t (*cleanup)(void *),
+                          apr_pool_t *pool)
+   */
   return err;
 }


Enable busy cursor during reexecution

Enable busy cursor during reexecution

--- src/investigate.cpp
+++ src/investigate.cpp
@@ -96,6 +96,10 @@
   GtkTreeModel *m = gtk_icon_view_get_model(icon_view);
   GtkWidget *w;

+  GdkCursor *cursor;
+  GdkDisplay *display;
+  GdkWindow *toplevel_window;
+
   const char *objectid;

   // save path
@@ -109,6 +113,16 @@
 		     2, &circles_list,
 		     3, &objectid,
 		     -1);
+
+  // busy cursor
+  display = gtk_widget_get_display(GTK_WIDGET(icon_view));
+  cursor = gdk_cursor_new_for_display(display, GDK_WATCH);
+  toplevel_window = gtk_widget_get_toplevel(GTK_WIDGET(icon_view))->window;
+  gdk_window_set_cursor(toplevel_window, cursor);
+  gdk_cursor_unref(cursor);
+  cursor = NULL;
+  gdk_display_flush(display);
+

   ls_obj_handle_t newobj;
   const char *attrs[] = {"", NULL};
@@ -136,6 +150,8 @@
   g_object_unref(pix_loader);
   pix_loader = NULL;
   ls_release_object(dr, newobj);
+
+  gdk_window_set_cursor(toplevel_window, NULL);

   w = glade_xml_get_widget(g_xml, "selectedResult");
   gtk_widget_queue_draw(w);


Added write(ostream&) for outputting to a string

--- intelhex.cc
+++ intelhex.cc
@@ -4,6 +4,8 @@
  * This software and all of its components are available under the BSD License
  * For a copy of the BSD License see http://www.freebsd.org
  * */
+
+#include <iostream>

 #include <stdio.h>
 #include <stdlib.h>
@@ -127,44 +129,60 @@
 	//Write all data to a file
 	void	hex_data::write(const char *path)
 	{
-		FILE	*fp;
-//		int i, j;
-		u_int8_t	checksum;
-
-		if( (fp=fopen(path, "w"))==NULL )
-		{
-			printf("%s: Can't open %s\n", __FUNCTION__, path);
-			return;
-		}
-
-		truncate(8);				//Truncate each record to length=8
+		ofstream	ofs(path);
+		write(ofs);
+	}
+
+	//Write all data to an output stream
+	void	hex_data::write(ostream &os)
+	{
+		uint8_t	checksum;
+
+		truncate(8);				//Truncate each record to length=8 (purely asthetic)
 		blocks.sort();				//Sort the data blocks by address (ascending)

+		os.setf(ios::hex, ios::basefield);	//Set the stream to ouput hex instead of decimal
+		os.setf(ios::uppercase);				//Use uppercase hex notation
+		os.fill('0');								//Pad with zeroes
+
 		for(lst_dblock::iterator i=blocks.begin(); i!=blocks.end(); i++)
 		{
 			checksum = 0;
 			if(i->first < 0x2100)
 			{	//Program memory and fuses require special consideration
-				fprintf(fp, ":%02X%04X00", i->second.size()*2, i->first*2);	//Record length and address
+				os << ':';	//Every line begins with ':'
+				os.width(2);
+				os << i->second.size()*2;	//Record length
+				os.width(4);
+				os << static_cast<uint16_t>(i->first*2);	//Address
+				os << "00";											//Record type
 				for(int j=0; j<i->second.size(); j++)	//Store the data bytes, LSB first, ASCII HEX
 				{
-					fprintf(fp, "%02X%02X", i->second[j] & 0x00FF, (i->second[j]>>8) & 0x00FF);
+					os.width(2);
+					os << (i->second[j] & 0x00FF);
+					os.width(2);
+					os << ((i->second[j]>>8) & 0x00FF);
 					checksum += i->second[j];
 				}
 			}
 			else	//EEPROM can just be written out
 			{
-				fprintf(fp, ":%02X%04X00", i->second.size(), i->first);	//Record length and address
+				os.width(2);
+				os << i->second.size();		//Record length
+				os.width(4);
+				os << i->first << "00";		//Address and record type
 				for(int j=0; j<i->second.size(); j++)	//Store the data bytes, LSB first, ASCII HEX
 				{
-					fprintf(fp, "%02X", i->second[j] & 0x00FF);
+					os.width(2);
+					os << (i->second[j] & 0x00FF);
 					checksum += i->second[j];
 				}
 			}
-			fprintf(fp, "00\n");	//Bogus checksum and a newline
+			os.width(2);
+			os << static_cast<int>(checksum);	//Bogus checksum byte
+			os << endl;
 		}
-		fprintf(fp, ":00000001FF\n");	//EOF marker
-		fclose(fp);
+		os << ":00000001FF\n";			//EOF marker
 	}

 	//Truncate all of the blocks to a given length


add normal model

add normal model

--- include/vSMC/sampler.hpp
+++ include/vSMC/sampler.hpp
@@ -168,6 +168,17 @@
     /// \brief Perform importance sampling integration
     ///
     /// \param intgral The functor used to compute the integrands
+    double integrate (typename Monitor<T>::integral_type integral) const
+    {
+        std::size_t n = particle.size();
+        integral(iter_num, particle, integrate_tmp);
+
+        return cblas_ddot(n, particle.get_weight_ptr(), 1, integrate_tmp, 1);
+    }
+
+    /// \brief Perform importance sampling integration
+    ///
+    /// \param intgral The functor used to compute the integrands
     /// \param param Additional parameters to be passed to integral
     double integrate (integral_type integral, void *param) const
     {


Cleaned up the EGL context config set up.

--- src/osgViewer/GraphicsWindowX11.cpp
+++ src/osgViewer/GraphicsWindowX11.cpp
@@ -725,49 +725,22 @@

         EGLConfig eglConfig = 0;

-        #if defined(OSG_GLES1_AVAILABLE)
-
-            #if 0
-            EGLint configAttribs[3];
-            configAttribs[0] = EGL_SURFACE_TYPE;
-            configAttribs[1] = EGL_WINDOW_BIT;
-            configAttribs[2] = EGL_NONE;
-            #else
-            EGLint configAttribs[] = {
-                    EGL_SAMPLE_BUFFERS, 0,
-                    EGL_SAMPLES, 0,
-                    EGL_RED_SIZE, 1,
-                    EGL_GREEN_SIZE, 1,
-                    EGL_BLUE_SIZE, 1,
-                    EGL_DEPTH_SIZE, 1,
-                    EGL_RENDERABLE_TYPE, EGL_OPENGL_ES1_BIT,
-                    EGL_NONE
-            };
-            #endif
-
+        #if defined(OSG_GLES2_AVAILABLE)
+            #define OSG_EGL_OPENGL_TARGET_BIT EGL_OPENGL_ES2_BIT
         #else
-
-            #if 0
-            EGLint configAttribs[5];
-            configAttribs[0] = EGL_SURFACE_TYPE;
-            configAttribs[1] = EGL_WINDOW_BIT;
-            configAttribs[2] = EGL_RENDERABLE_TYPE;
-            configAttribs[3] = EGL_OPENGL_ES2_BIT;
-            configAttribs[4] = EGL_NONE;
-            #else
-            EGLint configAttribs[] = {
-                    EGL_SAMPLE_BUFFERS, 0,
-                    EGL_SAMPLES, 0,
-                    EGL_RED_SIZE, 1,
-                    EGL_GREEN_SIZE, 1,
-                    EGL_BLUE_SIZE, 1,
-                    EGL_DEPTH_SIZE, 1,
-                    EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
-                    EGL_NONE
-            };
-            #endif
-
+            #define OSG_EGL_OPENGL_TARGET_BIT EGL_OPENGL_ES_BIT
         #endif
+
+        EGLint configAttribs[] = {
+                EGL_SAMPLE_BUFFERS, 0,
+                EGL_SAMPLES, 0,
+                EGL_RED_SIZE, 1,
+                EGL_GREEN_SIZE, 1,
+                EGL_BLUE_SIZE, 1,
+                EGL_DEPTH_SIZE, 1,
+                EGL_RENDERABLE_TYPE, OSG_EGL_OPENGL_TARGET_BIT,
+                EGL_NONE
+        };

         int numConfigs;
         if (!eglChooseConfig(_eglDisplay, configAttribs, &eglConfig, 1, &numConfigs) || (numConfigs != 1))
@@ -794,10 +767,11 @@
         #if defined(OSG_GLES1_AVAILABLE)
             EGLint* contextAttribs = 0;
         #else
-            EGLint contextAttribs[3];
-            contextAttribs[0] = EGL_CONTEXT_CLIENT_VERSION;
-            contextAttribs[1] = 2;
-            contextAttribs[2] = EGL_NONE;
+            EGLint contextAttribs[] = {
+                 EGL_CONTEXT_CLIENT_VERSION,
+                2,
+                EGL_NONE
+            };
         #endif

         _context = eglCreateContext(_eglDisplay, eglConfig, NULL, contextAttribs);


added support for IE incompatibility mode

--- src/output/output_http_internal.cpp
+++ src/output/output_http_internal.cpp
@@ -301,6 +301,7 @@

     H.Clean();
     H.SetHeader("Content-Type", "text/html");
+    H.SetHeader("X-UA-Compatible", "IE=edge");
     H.SetHeader("Server", "MistServer/" PACKAGE_VERSION);
     H.setCORSHeaders();
     if(method == "OPTIONS" || method == "HEAD"){


Symbian: Changed backend to support recently added QtMediaServices::CoverArtImage metadata key.

--- plugins/multimedia/symbian/mmf/mediaplayer/s60mediametadataprovider.cpp
+++ plugins/multimedia/symbian/mmf/mediaplayer/s60mediametadataprovider.cpp
@@ -135,6 +135,7 @@
         case QtMediaServices::VideoBitRate: return "videobitrate";
         case QtMediaServices::Duration: return "duration";
         case QtMediaServices::MediaType: return "contenttype";
+        case QtMediaServices::CoverArtImage: return "attachedpicture";
         case QtMediaServices::SubTitle: // TODO: Find the matching metadata keys
         case QtMediaServices::Description:
         case QtMediaServices::Category:
@@ -158,7 +159,7 @@
         case QtMediaServices::Mood:
         case QtMediaServices::TrackCount:
         case QtMediaServices::CoverArtUrlSmall:
-        case QtMediaServices::CoverArtUrlLarge:
+        case QtMediaServices::CoverArtUrlLarge:
         case QtMediaServices::Resolution:
         case QtMediaServices::PixelAspectRatio:
         case QtMediaServices::VideoFrameRate:


someChanges

someChanges

--- plugins/robots/robotsInterpreter/details/sensorsConfigurationWidget.cpp
+++ plugins/robots/robotsInterpreter/details/sensorsConfigurationWidget.cpp
@@ -44,8 +44,8 @@
 			<< tr("Color sensor (blue)")
 			<< tr("Color sensor (passive)")
 			<< tr("Sound sensor")
-			<< tr("gyroscope(passive)")
-			<< tr("aks(passive)")
+			<< tr("Gyroscope")
+			<< tr("Accelerometer")
 	;

 	mUi->port1ComboBox->clear();


psac: output of `k` during benchmark

psac: output of `k` during benchmark

--- src/benchmark_k.cpp
+++ src/benchmark_k.cpp
@@ -33,7 +33,7 @@
         sa.construct(true, k);
         double time = t.get_ms() - start;
         if (rank == 0)
-            std::cout << p << ";" << method_name << ";" << time << std::endl;
+            std::cout << p << ";" << method_name << ";" << k << ";" << time << std::endl;
     }
     {
         // without LCP and slow
@@ -43,7 +43,7 @@
         sa.construct(false, k);
         double time = t.get_ms() - start;
         if (rank == 0)
-            std::cout << p << ";" << method_name << ";" << time << std::endl;
+            std::cout << p << ";" << method_name << ";" << k << ";" << time << std::endl;
     }
     // TODO: array construction with multiple
 }


Create ArgumentParserTestFixture.StopParsing tester.

--- tester/libtbag/string/ArgumentParserTest.cpp
+++ tester/libtbag/string/ArgumentParserTest.cpp
@@ -165,19 +165,39 @@
     }
 };

-TEST_F(ArgumentParserTestFixture, Default)
-{
-    auto const result1 = parser.parse("program -i test -o result -v -t 0.7 kkk zzz xxx");
-    ASSERT_EQ(E_SUCCESS, result1.code);
-    ASSERT_EQ(4, result1.value.optional.size());
-    ASSERT_STREQ("test", result1.value.optional.at("input").c_str());
-    ASSERT_STREQ("result", result1.value.optional.at("output").c_str());
-    ASSERT_STREQ("1", result1.value.optional.at("verbose").c_str());
-    ASSERT_STREQ("0.7", result1.value.optional.at("threshold").c_str());
-    ASSERT_EQ(2, result1.value.positional.size());
-    ASSERT_STREQ("kkk", result1.value.positional.at("cmd1").c_str());
-    ASSERT_STREQ("zzz", result1.value.positional.at("cmd2").c_str());
-    ASSERT_EQ(1, result1.value.remain.size());
-    ASSERT_STREQ("xxx", result1.value.remain[0].c_str());
-}
-
+TEST_F(ArgumentParserTestFixture, Parse_Complex)
+{
+    auto const result = parser.parse("program -i test kkk -o result zzz -v xxx -t 0.7 vvv");
+    ASSERT_EQ(E_SUCCESS, result.code);
+    ASSERT_EQ(4, result.value.optional.size());
+    ASSERT_STREQ("test", result.value.optional.at("input").c_str());
+    ASSERT_STREQ("result", result.value.optional.at("output").c_str());
+    ASSERT_STREQ("1", result.value.optional.at("verbose").c_str());
+    ASSERT_STREQ("0.7", result.value.optional.at("threshold").c_str());
+    ASSERT_EQ(2, result.value.positional.size());
+    ASSERT_STREQ("kkk", result.value.positional.at("cmd1").c_str());
+    ASSERT_STREQ("zzz", result.value.positional.at("cmd2").c_str());
+    ASSERT_EQ(2, result.value.remain.size());
+    ASSERT_STREQ("xxx", result.value.remain[0].c_str());
+    ASSERT_STREQ("vvv", result.value.remain[1].c_str());
+}
+
+TEST_F(ArgumentParserTestFixture, StopParsing)
+{
+    auto const result = parser.parse("program kkk -o result -- -v -t 0.7 kkk zzz xxx");
+    ASSERT_EQ(E_SUCCESS, result.code);
+    ASSERT_EQ(2, result.value.optional.size());
+    ASSERT_STREQ("result", result.value.optional.at("output").c_str());
+    ASSERT_STREQ("0.5", result.value.optional.at("threshold").substr(0, 3).c_str());
+    ASSERT_EQ(2, result.value.positional.size());
+    ASSERT_STREQ("kkk", result.value.positional.at("cmd1").c_str());
+    ASSERT_STREQ("empty", result.value.positional.at("cmd2").c_str());
+    ASSERT_EQ(6, result.value.remain.size());
+    ASSERT_STREQ("-v", result.value.remain[0].c_str());
+    ASSERT_STREQ("-t", result.value.remain[1].c_str());
+    ASSERT_STREQ("0.7", result.value.remain[2].c_str());
+    ASSERT_STREQ("kkk", result.value.remain[3].c_str());
+    ASSERT_STREQ("zzz", result.value.remain[4].c_str());
+    ASSERT_STREQ("xxx", result.value.remain[5].c_str());
+}
+


INTEGRATION: CWS vgbugs07 (1.9.876); FILE MERGED 2007/06/04 13:26:47 vg 1.9.876.1: #i76605# Remove -I .../inc/module hack introduced by hedaburemove01

--- svx/source/editeng/SvXMLAutoCorrectImport.hxx
+++ svx/source/editeng/SvXMLAutoCorrectImport.hxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: SvXMLAutoCorrectImport.hxx,v $
  *
- *  $Revision: 1.9 $
+ *  $Revision: 1.10 $
  *
- *  last change: $Author: rt $ $Date: 2005-09-08 22:24:58 $
+ *  last change: $Author: hr $ $Date: 2007-06-27 17:53:22 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -55,7 +55,7 @@
 #include <xmloff/xmlnmspe.hxx>
 #endif
 #ifndef _MySVXACORR_HXX
-#include "svxacorr.hxx"
+#include <svx/svxacorr.hxx>
 #endif

 class SvXMLAutoCorrectImport : public SvXMLImport


replace shared_ptr with make_shared

replace shared_ptr with make_shared

--- loader/src/loader.cpp
+++ loader/src/loader.cpp
@@ -278,7 +278,7 @@
     _device = Device::create(deviceParams);

     // the manifest defines which data should be included in the dataset
-    auto manifest = shared_ptr<Manifest>(new Manifest(manifestFilename, shuffle));
+    auto manifest = make_shared<Manifest>(manifestFilename, shuffle);
     *itemCount = manifest->getSize();

     // build cacheDir from rootCacheDir and a hash of the manifest
@@ -287,23 +287,21 @@
     string cacheDir = cacheDirStream.str();

     // batch loader provdes random access to blocks of data in the manifest
-    auto batchLoader = shared_ptr<BatchLoaderCPIOCache>(new BatchLoaderCPIOCache(
+    auto batchLoader = make_shared<BatchLoaderCPIOCache>(
         cacheDir.c_str(),
-        shared_ptr<BatchFileLoader>(new BatchFileLoader(
-            manifest, subsetPercent
-        ))
-    ));
+        make_shared<BatchFileLoader>(manifest, subsetPercent)
+    );

     // _batch_iterator provides an unending iterator (shuffled or not) over
     // the batchLoader
     if(reshuffle) {
-        _batch_iterator = shared_ptr<ShuffledBatchIterator>(new ShuffledBatchIterator(
+        _batch_iterator = make_shared<ShuffledBatchIterator>(
              batchLoader, _macroBatchSize, _seed
-        ));
+        );
     } else {
-        _batch_iterator = shared_ptr<SequentialBatchIterator>(new SequentialBatchIterator(
+        _batch_iterator = make_shared<SequentialBatchIterator>(
              batchLoader, _macroBatchSize
-        ));
+        );
     }
 }

@@ -317,10 +315,10 @@
         int targetLen = _batchSize * _targetSize * _targetTypeSize;
         // Start the read buffers off with a reasonable size. They will
         // get resized as needed.
-        _readBufs = shared_ptr<BufferPool>(new BufferPool(dataLen / 8, targetLen));
+        _readBufs = make_shared<BufferPool>(dataLen / 8, targetLen);
         _readThread = unique_ptr<ReadThread>(new ReadThread(_readBufs, _batch_iterator));
         bool pinned = (_device->_type != CPU);
-        _decodeBufs = shared_ptr<BufferPool>(new BufferPool(dataLen, targetLen, pinned));
+        _decodeBufs = make_shared<BufferPool>(dataLen, targetLen, pinned);
         int numCores = thread::hardware_concurrency();
         int itemsPerThread = (_batchSize - 1) /  numCores + 1;
         int threadCount =  (_batchSize - 1) / itemsPerThread + 1;


check all vias

check all vias

Signed-off-by: Osama Hammad <9db276582e74f0a78d823b344170dd88e8931f50@vlsipool-k12.eecs.umich.edu>
Signed-off-by: osamahammad21 <ff46d8506d7d3ca8212b23af621ee9fec898c5fc@aucegypt.edu>

--- src/drt/src/gc/FlexGC_main.cpp
+++ src/drt/src/gc/FlexGC_main.cpp
@@ -3030,9 +3030,10 @@
     drNet* net = nullptr;
     auto& workerRegionQuery = getDRWorker()->getWorkerRegionQuery();
     marker->getBBox(markerBBox);
+    if(markerBBox.length() < layer->getWidth())
+      continue;
     workerRegionQuery.query(markerBBox, lNum, results);
-    bool upViaFound = false;
-    bool downViaFound = false;
+    std::map<frPoint, std::vector<drVia*>> vias;
     for (auto& connFig : results) {
       if (connFig->typeId() != drcVia) {
         continue;
@@ -3041,32 +3042,41 @@
       if (obj->getNet()->getFrNet() != *(marker->getSrcs().begin())) {
         continue;
       }
-      if (obj->getViaDef()->getCutLayerNum() == lNum + 1) {
-        upViaFound = true;
-      } else if (obj->getViaDef()->getCutLayerNum() == lNum - 1) {
-        downViaFound = true;
-      } else {
-        continue;
-      }
-      obj->getOrigin(origin);
-      net = obj->getNet();
-    }
-    if (!net) {
+      frPoint tmpOrigin;
+      obj->getOrigin(tmpOrigin);
+      frLayerNum cutLayerNum = obj->getViaDef()->getCutLayerNum();
+      if (cutLayerNum == lNum + 1 || cutLayerNum == lNum - 1) {
+        vias[tmpOrigin].push_back(obj);
+      }
+    }
+    for(auto& [tmpOrigin, objs] : vias)
+    {
+      bool upViaFound = false;
+      bool downViaFound = false;
+      for(auto obj : objs)
+      {
+        frLayerNum cutLayerNum = obj->getViaDef()->getCutLayerNum();
+        if(cutLayerNum == lNum + 1)
+          upViaFound = true;
+        else
+          downViaFound = true;
+        if(upViaFound && downViaFound)
+        {
+          net = obj->getNet();
+          origin = tmpOrigin;
+          break;
+        }
+      }
+    }
+    if (net == nullptr) {
       continue;
     }
-    if (!upViaFound || !downViaFound)
-      continue;
     markerBBox.shift(-origin.x(), -origin.y());
     auto patch = make_unique<drPatchWire>();
     patch->setLayerNum(lNum);
     patch->setOrigin(origin);
     patch->setOffsetBox(markerBBox);
     patch->addToNet(net);
-
-    if (!net) {
-      logger_->warn(DRT, 64, "Attempting to add patch with no drNet.");
-    }
-
     pwires_.push_back(std::move(patch));
   }
 }


Possibly fix string mangling bug

Possibly fix string mangling bug

--- clang-plugin/Indexer.cpp
+++ clang-plugin/Indexer.cpp
@@ -58,11 +58,11 @@
   }
 }

-std::string
+static std::string
 ToString(int n)
 {
   char s[32];
-  sprintf(s, "%06d", n);
+  sprintf(s, "%d", n);
   return std::string(s);
 }

@@ -195,6 +195,14 @@
   }
 };

+static std::string
+ToStringPadded(int n)
+{
+  char s[32];
+  sprintf(s, "%06d", n);
+  return std::string(s);
+}
+
 class IndexConsumer : public ASTConsumer,
                       public RecursiveASTVisitor<IndexConsumer>,
                       public DiagnosticConsumer
@@ -258,9 +266,9 @@
     if (!isInvalid) {
       unsigned line = sm.getSpellingLineNumber(loc, &isInvalid);
       if (!isInvalid) {
-        buffer = ToString(line);
+        buffer = ToStringPadded(line);
         buffer += ":";
-        buffer += ToString(column - 1);  // Make 0-based.
+        buffer += ToStringPadded(column - 1);  // Make 0-based.
       }
     }
     return buffer;


INTEGRATION: CWS autokerning (1.47.20); FILE MERGED 2006/11/15 19:05:54 cl 1.47.20.2: RESYNC: (1.47-1.48); FILE MERGED 2006/10/23 13:49:45 cl 1.47.20.1: #i70365# changed default for auto kerning in styles

--- sd/source/core/drawdoc4.cxx
+++ sd/source/core/drawdoc4.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: drawdoc4.cxx,v $
  *
- *  $Revision: 1.51 $
+ *  $Revision: 1.52 $
  *
- *  last change: $Author: kz $ $Date: 2006-12-12 16:32:15 $
+ *  last change: $Author: ihi $ $Date: 2006-12-19 12:57:00 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -74,6 +74,9 @@
 #define ITEMID_CHARRELIEF           EE_CHAR_RELIEF
 #define ITEMID_FRAMEDIR             EE_PARA_WRITINGDIR

+#define ITEMID_AUTOKERN EE_CHAR_PAIRKERNING
+#include <svx/akrnitem.hxx>
+
 #include <svx/svxids.hrc>
 #ifndef _SFX_SRCHITEM_HXX
 #include <sfx2/srchitem.hxx>
@@ -387,6 +390,9 @@
     rISet.Put( SdrTextLowerDistItem( 125 ) );

     rISet.Put( SvxLineSpacingItem() );
+
+    // #i16874# enable kerning by default but only for new documents
+    rISet.Put( SvxAutoKernItem( TRUE, EE_CHAR_PAIRKERNING ) );

     // Bullet
     // BulletItem und BulletFont fuer Titel und Gliederung


Make more FuText members private

Make more FuText members private

...and remove unused aOldLink

Change-Id: Ie1ff1db7c72e8efcfab3e61c31d03f5c9068275f

--- sd/source/ui/inc/futext.hxx
+++ sd/source/ui/inc/futext.hxx
@@ -78,16 +78,15 @@
         SdDrawDocument* pDoc,
         SfxRequest& rReq);

+private:
     virtual void disposing() SAL_OVERRIDE;

     SdrObjectWeakRef    mxTextObj;
-    Link<>              aOldLink;
     bool                bFirstObjCreated;
     bool                bJustEndedEdit;

     SfxRequest&         rRequest;

-private:
     void ImpSetAttributesForNewTextObject(SdrTextObj* pTxtObj);
     void ImpSetAttributesFitToSize(SdrTextObj* pTxtObj);
     void ImpSetAttributesFitToSizeVertical(SdrTextObj* pTxtObj);


INTEGRATION: CWS changefileheader (1.3.298); FILE MERGED 2008/04/01 15:35:28 thb 1.3.298.3: #i85898# Stripping all external header guards 2008/04/01 12:39:08 thb 1.3.298.2: #i85898# Stripping all external header guards 2008/03/31 13:58:16 rt 1.3.298.1: #i87441# Change license header to LPGL v3.

--- sd/source/ui/inc/optdlg.hxx
+++ sd/source/ui/inc/optdlg.hxx
@@ -1,48 +1,38 @@
 /*************************************************************************
  *
- *  OpenOffice.org - a multi-platform office productivity suite
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
- *  $RCSfile: optdlg.hxx,v $
+ * Copyright 2008 by Sun Microsystems, Inc.
  *
- *  $Revision: 1.3 $
+ * OpenOffice.org - a multi-platform office productivity suite
  *
- *  last change: $Author: kz $ $Date: 2006-12-12 17:45:47 $
+ * $RCSfile: optdlg.hxx,v $
+ * $Revision: 1.4 $
  *
- *  The Contents of this file are made available subject to
- *  the terms of GNU Lesser General Public License Version 2.1.
+ * This file is part of OpenOffice.org.
  *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
  *
- *    GNU Lesser General Public License Version 2.1
- *    =============================================
- *    Copyright 2005 by Sun Microsystems, Inc.
- *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
  *
- *    This library is free software; you can redistribute it and/or
- *    modify it under the terms of the GNU Lesser General Public
- *    License version 2.1, as published by the Free Software Foundation.
- *
- *    This library is distributed in the hope that it will be useful,
- *    but WITHOUT ANY WARRANTY; without even the implied warranty of
- *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *    Lesser General Public License for more details.
- *
- *    You should have received a copy of the GNU Lesser General Public
- *    License along with this library; if not, write to the Free Software
- *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- *    MA  02111-1307  USA
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
  *
  ************************************************************************/

 #ifndef SD_OPTDLG_HXX
 #define SD_OPTDLG_HXX

-#ifndef _SFXTABDLG_HXX //autogen
 #include <sfx2/tabdlg.hxx>
-#endif
-
-#ifndef _PRESENTATION_HXX
 #include "pres.hxx"
-#endif

 class SfxItemSet;


Fix memory leak in stmgr when measuring tuple data size (#3175)

--- heron/stmgr/src/cpp/manager/stmgr-server.cpp
+++ heron/stmgr/src/cpp/manager/stmgr-server.cpp
@@ -175,6 +175,7 @@
       ack_tuples_from_stmgrs_metrics_->incr_by(tuple_set->control().acks_size());
       fail_tuples_from_stmgrs_metrics_->incr_by(tuple_set->control().fails_size());
     }
+    __global_protobuf_pool_release__(tuple_set);

     stmgr_->HandleStreamManagerData(iter->second, _message);
   }


fixed broken parsing of collaborative filters' post-radius

--- src/plugins/cf/cf_configuration.cpp
+++ src/plugins/cf/cf_configuration.cpp
@@ -163,7 +163,7 @@
         break;

       case hash_post_radius:
-        _post_radius = static_cast<bool>(atoi(arg));
+        _post_radius = atoi(arg);
         configuration_spec::html_table_row(_config_args,cmd,arg,
                                            "Query similarity impact radius of posted URLs");
         break;


need to emit a few more signals when assigned MarbleWidget changes

--- src/plugins/declarative/Routing.cpp
+++ src/plugins/declarative/Routing.cpp
@@ -85,6 +85,8 @@
     }

     emit mapChanged();
+    emit routingProfileChanged();
+    emit hasRouteChanged();
 }

 MarbleWidget *Routing::map()


Update ir_Aiwa.cpp

Update ir_Aiwa.cpp

fixed typo in line 12


- чистка кода

 - чистка кода

git-svn-id: 41bd7e47c31e4d43f97241d7529f6785d233c6d8@10194 23f926e6-80f1-49ca-85a0-60d4a27bb3ac

--- rdo/app/rdo_studio/branches/dev_qt_migration/edit_ctrls/rdobaseedit.cpp
+++ rdo/app/rdo_studio/branches/dev_qt_migration/edit_ctrls/rdobaseedit.cpp
@@ -124,16 +124,6 @@
 //	ON_UPDATE_COMMAND_UI(ID_SEARCH_FIND_NEXT, OnUpdateSearchFindNextPrev)
 //	ON_UPDATE_COMMAND_UI(ID_SEARCH_FIND, OnUpdateSearchFind)
 //	ON_UPDATE_COMMAND_UI(ID_SEARCH_REPLACE, OnUpdateSearchReplace)
-//	ON_COMMAND( ID_SEARCH_BOOKMARK_TOGGLE  , OnBookmarkToggle )
-//	ON_COMMAND( ID_SEARCH_BOOKMARK_NEXT    , OnBookmarkNext )
-//	ON_COMMAND( ID_SEARCH_BOOKMARK_PREVIOUS, OnBookmarkPrev )
-//	ON_COMMAND( ID_SEARCH_BOOKMARKS_CLEAR  , OnBookmarkClearAll )
-//	ON_UPDATE_COMMAND_UI( ID_SEARCH_BOOKMARK_NEXT, OnHasBookmarks )
-//	ON_COMMAND(ID_VIEW_ZOOMIN, OnViewZoomIn)
-//	ON_COMMAND(ID_VIEW_ZOOMOUT, OnViewZoomOut)
-//	ON_COMMAND(ID_VIEW_ZOOMRESET, OnViewZoomReset)
-//	ON_UPDATE_COMMAND_UI( ID_SEARCH_BOOKMARK_PREVIOUS, OnHasBookmarks )
-//	ON_UPDATE_COMMAND_UI( ID_SEARCH_BOOKMARKS_CLEAR  , OnHasBookmarks )
 //	ON_UPDATE_COMMAND_UI( ID_SEARCH_FIND_PREVIOUS, OnUpdateSearchFindNextPrev )
 //	ON_COMMAND(ID_SEARCH_GOTO_LINE, OnSearchGotoLine)
 //


binarycoder: indent

binarycoder: indent

Change-Id: I751b10bcbea3cfe161fd50720177a187b9b4537e

--- src/binarycoder.cpp
+++ src/binarycoder.cpp
@@ -328,16 +328,16 @@

       void visitInt(TypeInt* type, int64_t value, bool isSigned, int byteSize)
       {
-        switch((isSigned?1:-1)*byteSize)
+        switch((isSigned ? 1 : -1) * byteSize)
         {
-          case 0:	 out.write((bool)value);  break;
-          case 1:	 out.write((int8_t)value);  break;
+          case 0:  out.write((bool)value);    break;
+          case 1:  out.write((int8_t)value);  break;
           case -1: out.write((uint8_t)value); break;
-          case 2:	 out.write((int16_t)value); break;
+          case 2:  out.write((int16_t)value); break;
           case -2: out.write((uint16_t)value);break;
-          case 4:	 out.write((int32_t)value); break;
+          case 4:  out.write((int32_t)value); break;
           case -4: out.write((uint32_t)value);break;
-          case 8:	 out.write((int64_t)value); break;
+          case 8:  out.write((int64_t)value); break;
           case -8: out.write((uint64_t)value);break;
           default:
             qiLogError("qi.type") << "Unknown integer type " << isSigned << " " << byteSize;


More description messages for device connect/disconnect

--- src/plugins/openni/OpenNIPlugin.cpp
+++ src/plugins/openni/OpenNIPlugin.cpp
@@ -35,7 +35,7 @@
         {
             ::openni::Status rc = ::openni::STATUS_OK;

-            cout << "Opening device" << endl;
+            cout << "device connected, opening device" << endl;
             rc = m_device.open(info->getUri());

             if (rc != ::openni::STATUS_OK)
@@ -51,6 +51,7 @@

         void OpenNIPlugin::onDeviceDisconnected(const ::openni::DeviceInfo* info)
         {
+            cout << "device disconnected" << endl;
             get_pluginService().destroy_stream(m_depthHandle);
             get_pluginService().destroy_stream(m_colorHandle);
             get_pluginService().destroy_stream_set(m_streamSetHandle);


From Bertrand:
- Set slider's background the same color than its parent frame.
- Added protection in the case of background pixmap is not present.

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@13377 27541ba8-7e3a-0410-8455-c3a389f83636

--- tutorials/mditest.C
+++ tutorials/mditest.C
@@ -1,4 +1,4 @@
-// @(#)root/tutorials:$Name:  $:$Id: mditest.C,v 1.1 2004/09/03 00:25:48 rdm Exp $
+// @(#)root/tutorials:$Name:  $:$Id: mditest.C,v 1.2 2005/11/24 17:08:36 rdm Exp $
 // Author: Fons Rademakers   2/9/2004

 #include <stdio.h>
@@ -99,7 +99,8 @@
    fMain->AddFrame(fMainFrame, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));

    const TGPicture *pbg = gClient->GetPicture("mditestbg.xpm");
-   fMainFrame->GetContainer()->SetBackgroundPixmap(pbg->GetPicture());
+   if (pbg)
+      fMainFrame->GetContainer()->SetBackgroundPixmap(pbg->GetPicture());

    TGMdiFrame *mdiFrame;

@@ -159,7 +160,8 @@
    fListBox->SetMultipleSelections(kFALSE);
    mdiFrame->AddFrame(fListBox,
                       new TGLayoutHints(kLHintsCenterX | kLHintsCenterY));
-   mdiFrame->AddFrame(new TGHSlider(mdiFrame, 50, kSlider1, 1),
+   mdiFrame->AddFrame(new TGHSlider(mdiFrame, 50, kSlider1, 1,
+                      kHorizontalFrame, ic),
                       new TGLayoutHints(kLHintsCenterX | kLHintsCenterY));
    mdiFrame->Move(400, 300);
    mdiFrame->SetWindowName("Four");
@@ -175,7 +177,7 @@
    fMain->SetWindowName("MDI test");
    fMain->SetClassHints("mdi test", "mdi test");

-   if (pbg->GetWidth() > 600 && pbg->GetHeight() > 400)
+   if (pbg && pbg->GetWidth() > 600 && pbg->GetHeight() > 400)
       fMain->Resize(pbg->GetWidth(), pbg->GetHeight()+25);
    else
       fMain->Resize(640, 400);


cli: update -netinfo help doc following the merge of 882ce251

--- src/bitcoin-cli.cpp
+++ src/bitcoin-cli.cpp
@@ -512,12 +512,12 @@
         "Returns a network peer connections dashboard with information from the remote server.\n"
         "This human-readable interface will change regularly and is not intended to be a stable API.\n"
         "Under the hood, -netinfo fetches the data by calling getpeerinfo and getnetworkinfo.\n"
-        "An optional integer argument from 0 to 4 can be passed for different peers listings.\n"
+        + strprintf("An optional integer argument from 0 to %d can be passed for different peers listings; %d to 255 are parsed as %d.\n", MAX_DETAIL_LEVEL, MAX_DETAIL_LEVEL, MAX_DETAIL_LEVEL) +
         "Pass \"help\" to see this detailed help documentation.\n"
         "If more than one argument is passed, only the first one is read and parsed.\n"
         "Suggestion: use with the Linux watch(1) command for a live dashboard; see example below.\n\n"
         "Arguments:\n"
-        "1. level (integer 0-4, optional)  Specify the info level of the peers dashboard (default 0):\n"
+        + strprintf("1. level (integer 0-%d, optional)  Specify the info level of the peers dashboard (default 0):\n", MAX_DETAIL_LEVEL) +
         "                                  0 - Connection counts and local addresses\n"
         "                                  1 - Like 0 but with a peers listing (without address or version columns)\n"
         "                                  2 - Like 1 but with an address column\n"
@@ -525,7 +525,7 @@
         "                                  4 - Like 1 but with both address and version columns\n"
         "2. help (string \"help\", optional) Print this help documentation instead of the dashboard.\n\n"
         "Result:\n\n"
-        "* The peers listing in levels 1-4 displays all of the peers sorted by direction and minimum ping time:\n\n"
+        + strprintf("* The peers listing in levels 1-%d displays all of the peers sorted by direction and minimum ping time:\n\n", MAX_DETAIL_LEVEL) +
         "  Column   Description\n"
         "  ------   -----------\n"
         "  <->      Direction\n"
@@ -562,9 +562,9 @@
         "Compact peers listing\n"
         "> bitcoin-cli -netinfo 1\n\n"
         "Full dashboard\n"
-        "> bitcoin-cli -netinfo 4\n\n"
+        + strprintf("> bitcoin-cli -netinfo %d\n\n", MAX_DETAIL_LEVEL) +
         "Full live dashboard, adjust --interval or --no-title as needed (Linux)\n"
-        "> watch --interval 1 --no-title bitcoin-cli -netinfo 4\n\n"
+        + strprintf("> watch --interval 1 --no-title bitcoin-cli -netinfo %d\n\n", MAX_DETAIL_LEVEL) +
         "See this help\n"
         "> bitcoin-cli -netinfo help\n"};
 };


Kits: Do not construct kits with names starting with -

Those look ugly.

Change-Id: I984060aaddf3294edf748a4c5c167efba7e40da8
Reviewed-by: Daniel Teske <d8a411aec9a206efedb4d45b75fe8d13f1e2b628@digia.com>

--- src/plugins/projectexplorer/kit.cpp
+++ src/plugins/projectexplorer/kit.cpp
@@ -206,7 +206,11 @@
 {
     if (name.contains(postfix))
         return QString();
-    return name + QLatin1Char('-') + postfix;
+    QString candidate = name;
+    if (!candidate.isEmpty())
+        candidate.append(QLatin1Char('-'));
+    candidate.append(postfix);
+    return candidate;
 }

 void Kit::setDisplayName(const QString &name)


pxt branch with a version of swe_rexi with nonlinear stuff

--- src/programs/swe_rexi_nonlinear.cpp
+++ src/programs/swe_rexi_nonlinear.cpp
@@ -8,6 +8,7 @@
 #include <sweet/Operators2D.hpp>
 #include <sweet/Stopwatch.hpp>
 #include <ostream>
+#include <algorithm>
 #include <sstream>
 #include <unistd.h>
 #include <stdio.h>
@@ -1227,10 +1228,6 @@
 			benchmark_analytical_error_maxabs_u = (t_u-prog_u).reduce_maxAbs();
 			benchmark_analytical_error_maxabs_v = (t_v-prog_v).reduce_maxAbs();
 		}
-
-//		benchmark_analytical_error_maxabs_h = (t_h-prog_h).reduce_norm2_quad()/(double)(parameters.discretization.res[0]*parameters.discretization.res[1]);
-//		benchmark_analytical_error_maxabs_u = (t_u-prog_u).reduce_norm2_quad()/(double)(parameters.discretization.res[0]*parameters.discretization.res[1]);
-//		benchmark_analytical_error_maxabs_v = (t_v-prog_v).reduce_norm2_quad()/(double)(parameters.discretization.res[0]*parameters.discretization.res[1]);
 	}

@@ -1363,15 +1360,34 @@
 		// first, update diagnostic values if required
 		update_diagnostics();

-		int id = simVars.misc.vis_id % (sizeof(vis_arrays)/sizeof(*vis_arrays));
+		const char* description = "";
+		if (simVars.misc.vis_id >= 0)
+		{
+			int id = simVars.misc.vis_id % (sizeof(vis_arrays)/sizeof(*vis_arrays));
+			description = vis_arrays[id].description;
+		}
+		else
+		{
+			switch (simVars.misc.vis_id)
+			{
+			case -1:
+				description = "Direct solution for h";
+				break;
+
+
+			case -2:
+				description = "Error in h";
+				break;
+			}
+		}

 		static char title_string[2048];
-		sprintf(title_string, "Time (days): %f (%.2f d), Timestep: %i, timestep size: %.14e, Vis: %.14s, Mass: %.14e, Energy: %.14e, Potential Entrophy: %.14e",
+		sprintf(title_string, "Time (days): %f (%.2f d), Timestep: %i, timestep size: %.14e, Vis: %s, Mass: %.14e, Energy: %.14e, Potential Entrophy: %.14e",
 				simVars.timecontrol.current_simulation_time,
 				simVars.timecontrol.current_simulation_time/(60.0*60.0*24.0),
 				simVars.timecontrol.current_timestep_nr,
 				simVars.timecontrol.current_timestep_size,
-				vis_arrays[id].description,
+				description,
 				simVars.diag.total_mass, simVars.diag.total_energy, simVars.diag.total_potential_enstrophy);

 		return title_string;
@@ -1405,8 +1421,15 @@
 			prog_v.file_saveData_ascii("swe_rexi_dump_v.csv");
 			break;

+		case 'C':
+			// dump data arrays to VTK
+			prog_h.file_saveData_vtk("swe_rexi_dump_h.vtk", "Height");
+			prog_u.file_saveData_vtk("swe_rexi_dump_u.vtk", "U-Velocity");
+			prog_v.file_saveData_vtk("swe_rexi_dump_v.vtk", "V-Velocity");
+			break;
+
 		case 'l':
-			// dump data arrays
+			// load data arrays
 			prog_h.file_loadData("swe_rexi_dump_h.csv", simVars.setup.input_data_binary);
 			prog_u.file_loadData("swe_rexi_dump_u.csv", simVars.setup.input_data_binary);
 			prog_v.file_loadData("swe_rexi_dump_v.csv", simVars.setup.input_data_binary);
@@ -1512,8 +1535,8 @@
 		std::cout << "	--rexi-helmholtz-solver-id=[int]	Use iterative solver for REXI" << std::endl;
 		std::cout << "	--rexi-helmholtz-solver-eps=[err]	Error threshold for iterative solver" << std::endl;
 		std::cout << std::endl;
-		std::cout << "	--init-cond-freq-mul-x=[float]	Setup initial conditions by using this multiplier values" << std::endl;
-		std::cout << "	--init-cond-freq-mul-y=[float]	" << std::endl;
+		std::cout << "	--init-cond-freq-x-mul=[float]	Setup initial conditions by using this multiplier values" << std::endl;
+		std::cout << "	--init-cond-freq-y-mul=[float]	" << std::endl;
 		std::cout << std::endl;
 		std::cout << "	--boundary-id=[0,1,...]	    Boundary id" << std::endl;
 		std::cout << "                              0: no boundary" << std::endl;


go to all-in-one instance test

go to all-in-one instance test

--- test/test_post.cpp
+++ test/test_post.cpp
@@ -1,103 +0,0 @@
-/*
- // Copyright (c) 2015-2016-2016 Pierre Guillot.
- // For information on usage and redistribution, and for a DISCLAIMER OF ALL
- // WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-*/
-
-#include <iostream>
-#include "test.hpp"
-extern "C"
-{
-#include "../thread/src/thd.h"
-}
-
-#define XPD_TEST_NLOOP  16
-#define XPD_TEST_NTHD   4
-
-static xpd::mutex gmutex;
-
-class post_tester : private xpd::instance
-{
-public:
-
-    ~post_tester()
-    {
-        if(m_patch)
-        {
-            xpd::instance::close(m_patch);
-        }
-    }
-
-    bool load(std::string const& name)
-    {
-        m_patch = xpd::instance::load(name, "");
-        return bool(m_patch);
-    }
-
-    bool prepare(const int nins, const int nouts, const int samplerate, const int nsamples)
-    {
-        xpd::instance::prepare(nins, nouts, samplerate, nsamples);
-        m_blksize = nsamples;
-        return xpd::instance::samplerate() == samplerate;
-    }
-
-    void send(std::vector<xpd::atom> const& vec)
-    {
-        xpd::instance::send(m_tfrom, xpd::symbol("list"), vec);
-    }
-
-    void receive(xpd::console::post const& post) xpd_final
-    {
-        m_counter++;
-    }
-
-    size_t counter() const xpd_noexcept
-    {
-        return m_counter;
-    }
-
-    static void test(post_tester* inst)
-    {
-        gmutex.lock();
-        for(size_t i = 0; i < XPD_TEST_NLOOP; i++)
-        {
-            inst->perform(inst->m_blksize, 0, NULL, 0, NULL);
-        }
-        gmutex.unlock();
-    }
-
-private:
-    xpd::patch m_patch;
-    xpd::tie   m_tfrom;
-    xpd::tie   m_tto;
-    size_t     m_counter;
-    size_t     m_blksize;
-};
-
-TEST_CASE("instance", "[instance post]")
-{
-    post_tester inst[XPD_TEST_NTHD];
-    thd_thread  thd[XPD_TEST_NTHD];
-
-    SECTION("post")
-    {
-        for(size_t i = 0; i < XPD_TEST_NTHD; ++i)
-        {
-            REQUIRE(inst[i].load("test_post.pd"));
-            REQUIRE(inst[i].prepare(0, 0, 44100, 256));
-            thd_thread_detach(thd+i, (thd_thread_method)(&post_tester::test), inst+i);
-        }
-
-        for(size_t i = 0; i < XPD_TEST_NTHD; ++i)
-        {
-            thd_thread_join(thd+i);
-            CHECK(inst[i].counter() == XPD_TEST_NLOOP);
-        }
-    }
-}
-
-#undef XPD_TEST_NLOOP
-
-
-
-


Changed the prnt variable so time would not print out in the integrator.

git-svn-id: 9e047e1e624cce0a2485e750063112e834f85522@2013 fc29be9c-2cb0-420d-b520-73dbd18add6e

--- OpenSim/Simulation/Integrator/IntegRKF.cpp
+++ OpenSim/Simulation/Integrator/IntegRKF.cpp
@@ -85,7 +85,7 @@
 	_status = RKF_NORMAL;
 	_steps = 0;
 	_trys = 0;
-	_maxSteps = 1000;
+	_maxSteps = 10000;
 	_halt = false;
 	_dtMax = 1.0;
 	_dtMin = 1.0e-8;


projectM-test random sound data

projectM-test random sound data

git-svn-id: af82bfd6a766e6c624b5753cb154dbd9bc14b036@1197 6778bc44-b910-0410-a7a0-be141de4315d

--- src/projectM-test/projectM-test.cpp
+++ src/projectM-test/projectM-test.cpp
@@ -24,6 +24,7 @@
 #include "sdltoprojectM.h"
 #include "ConfigFile.h"
 #include "getConfigFilename.h"
+#include <stdlib.h>

 // FIXME: portable includes?
 // i just added what works for me -fatray
@@ -85,6 +86,8 @@
 	// not reached
 	return 1;
 }
+
+float fakePCM[512];

 void renderLoop() {
 	while (1) {
@@ -139,6 +142,18 @@
 				break;
 			}
 		}
+ fakePCM[0]=0;
+        for (int x = 1; x< 512;x++)
+        {
+                fakePCM[x] = fakePCM[x-1] + (rand()%200 - 100) *.002;
+        }
+
+
+        globalPM->pcm()->addPCMfloat(fakePCM, 512);
+
+
+
+

 		globalPM->renderFrame();