trivial: Replace printf with strconcat

trivial: Replace printf with strconcat

The latter is slightly cleaner and faster in this case.

--- src/as-xml.c
+++ src/as-xml.c
@@ -330,7 +330,7 @@
 	AsXMLMarkupParseHelper *helper = g_slice_new0 (AsXMLMarkupParseHelper);

 	helper->locale = g_strdup (locale);
-	xmldata = g_strdup_printf ("<root>%s</root>", markup);
+	xmldata = g_strconcat ("<root>", markup, "</root>", NULL);
 	helper->doc = xmlReadMemory (xmldata, strlen (xmldata),
 					NULL,
 					"utf-8",


Don't let simplify reduce the polygon to 0 vertices either

This could happen if the input has only very small polygons.

Found during work on CURA-8109.

--- src/PathOrderOptimizer.h
+++ src/PathOrderOptimizer.h
@@ -434,6 +434,10 @@
             const coord_t max_simplify_dist2 = seam_config.simplify_curvature * seam_config.simplify_curvature;
             simple_poly.simplify(max_simplify_dist2, max_simplify_dist2 / 4);
         }
+        if(simple_poly.empty()) //Simplify removed everything because it's all too small.
+        {
+            simple_poly = Polygon(*path.converted); //Restore the original. We have to output a vertex as the seam position, so there needs to be a vertex.
+        }

         // Paths, other than polygons, can be either clockwise or counterclockwise. Make sure this is detected.
         const bool clockwise = simple_poly.orientation();


Unit test passes.

Unit test passes.

git-svn-id: 6d5d0d0362179181a2785cceb38b76f62e64641d@243 5dfbf39a-1452-0410-8a97-9e58fedde8e3

--- Diminuto/diminuto_escape.c
+++ Diminuto/diminuto_escape.c
@@ -118,7 +118,8 @@
                 --tsize;
                 break;
             default:
-                *(tt++) = *(ff++);  /* Unknown escape sequence. */
+                ff += 2;
+                *(tt++) = *(ff - 1);  /* Unknown escape sequence. */
                 --tsize;
                 break;
             }


Partially implemented backup initiation

Partially implemented backup initiation

--- src/backup.c
+++ src/backup.c
@@ -27,6 +27,7 @@

 #include "backup.h"

+#include <string.h>
 #include <unistd.h>

 #include "search.h"
@@ -98,6 +99,56 @@
   return point;
 }

+/** Queries and processes the next search result recursively and updates
+  the given metadata as described in the documentation of initiateBackup().
+
+  @param metadata The metadata which should be updated.
+  @param node_list A pointer to the node list corresponding to the
+  currently traversed directory.
+  @param context The context from which the search result should be
+  queried.
+
+  @return The type of the processed result.
+*/
+static SearchResultType initiateMetadataRecursively(Metadata *metadata,
+                                                    PathNode **node_list,
+                                                    SearchContext *context)
+{
+  SearchResult result = searchGetNext(context);
+  if(result.type == SRT_end_of_directory ||
+     result.type == SRT_end_of_search ||
+     result.type == SRT_other)
+  {
+    return result.type;
+  }
+
+  PathNode *node = strtableGet(metadata->path_table, result.path);
+
+  if(node == NULL)
+  {
+    node = mpAlloc(sizeof *node);
+
+    String path_copy = strCopy(result.path);
+    memcpy(&node->path, &path_copy, sizeof(node->path));
+
+    node->policy = result.policy;
+    node->history = buildPathHistoryPoint(metadata, result);
+    node->subnodes = NULL;
+
+    /* Prepend the new node to the current node list. */
+    node->next = *node_list;
+    *node_list = node;
+  }
+
+  if(result.type == SRT_directory)
+  {
+    while(initiateMetadataRecursively(metadata, &node->subnodes, context)
+          != SRT_end_of_directory);
+  }
+
+  return result.type;
+}
+
 /** Initiates a backup by updating the given metadata with new or changed
   files found trough the specified search tree. To speed things up, hash
   computations of some files are skipped, which leaves the metadata in an
@@ -116,6 +167,7 @@
 */
 void initiateBackup(Metadata *metadata, SearchNode *root_node)
 {
-  (void)metadata;
-  (void)root_node;
+  SearchContext *context = searchNew(root_node);
+  while(initiateMetadataRecursively(metadata, &metadata->paths, context)
+        != SRT_end_of_search);
 }


Use correct index for ModifyWaitEvent in WaitForAllConnections

--- src/backend/distributed/connection/remote_commands.c
+++ src/backend/distributed/connection/remote_commands.c
@@ -831,7 +831,6 @@
 				}

 				connection = (MultiConnection *) event->user_data;
-				connectionIndex = event->pos + pendingConnectionsStartIndex;

 				if (event->events & WL_SOCKET_WRITEABLE)
 				{
@@ -844,7 +843,7 @@
 					else if (sendStatus == 0)
 					{
 						/* done writing, only wait for read events */
-						ModifyWaitEvent(waitEventSet, connectionIndex, WL_SOCKET_READABLE,
+						ModifyWaitEvent(waitEventSet, event->pos, WL_SOCKET_READABLE,
 										NULL);
 					}
 				}
@@ -866,6 +865,7 @@

 				if (connectionIsReady)
 				{
+					connectionIndex = event->pos + pendingConnectionsStartIndex;
 					connectionReady[connectionIndex] = true;
 					rebuildWaitEventSet = true;
 				}


spell check

spell check

git-svn-id: e2fa1b4f04257a65cc3162f75ad5f19d327daceb@612 85bd2434-ea95-11dd-8fb1-9960f2a117f8

--- src/QXmppRosterManager.h
+++ src/QXmppRosterManager.h
@@ -89,9 +89,9 @@

 signals:
     /// This signal is emitted when the Roster IQ is received after a successful
-    /// connection. That is the roster entries are empty before this signal is emmitted.
+    /// connection. That is the roster entries are empty before this signal is emitted.
     /// One should use getRosterBareJids() and getRosterEntry() only after
-    /// this signal has been emmitted.
+    /// this signal has been emitted.
     void rosterReceived();

     /// This signal is emitted when the presence of a particular bareJid and resource changes.


Move osync_db_bind_blob data parameter content to a senesitive trace call.

git-svn-id: e31799a7ad59d6ea355ca047c69e0aee8a59fcd3@2934 53f5c7ee-bee3-0310-bbc5-ea0e15fffd5e

--- opensync/db/opensync_db.c
+++ opensync/db/opensync_db.c
@@ -459,7 +459,8 @@
  */
 osync_bool osync_db_bind_blob(OSyncDB *db, const char *query, const char *data, unsigned int size, OSyncError **error)
 {
-	osync_trace(TRACE_ENTRY, "%s(%p, %s, %s, %u, %p)", __func__, db, query, data, size, error);
+	osync_trace(TRACE_ENTRY, "%s(%p, %s, %s, %u, %p)", __func__, db, query, size, error);
+	osync_trace(OSYNC_SENSITIVE, "data parameter : %s", data);

 	osync_assert(db);
 	osync_assert(query);


remove WINDOWID

remove WINDOWID

--- ttygif_osx.c
+++ ttygif_osx.c
@@ -109,7 +109,7 @@
 }

 int
-take_snapshot(int index, int delay, char* window_id, struct osx_config osx_options)
+take_snapshot(int index, int delay, struct osx_config osx_options)
 {
   static char cmd [256];

@@ -146,8 +146,6 @@
     setbuf(stdout, NULL);
     setbuf(fp, NULL);

-    char* wid = getenv("WINDOWID");
-
     while (1) {

         char *buf;
@@ -163,7 +161,7 @@
             delay = ttydelay(prev, h.tv);
         }

-        if (take_snapshot(index, delay, wid, osx_options) != 0) {
+        if (take_snapshot(index, delay, osx_options) != 0) {
             perror("snapshot");
             break;
         }
@@ -174,7 +172,8 @@
     }
 }

-void ttyplayback (FILE *fp, ReadFunc read_func, struct osx_config osx_options)
+void
+ttyplayback (FILE *fp, ReadFunc read_func, struct osx_config osx_options)
 {
     ttyplay(fp, ttyread, ttywrite, osx_options);
 }
@@ -244,4 +243,4 @@
     tcsetattr(0, TCSANOW, &old);  /* Return terminal state */

     return 0;
-}+}


Documentation: freefall: simplify pathnames

Copying to local variable is actually not neccessary, if all we need
to do is snprintf(). This also removes problem where devname could be
missing zero termination.

Reported-by: Rickard Strandqvist <b2870f70e324b62b54eced4cf50284b23ec5baab@spectrumdigital.se>
Signed-off-by: Pavel Machek <2375fa63e2908bb2df59f606483a3aa92321db7a@ucw.cz>
Signed-off-by: Randy Dunlap <6f29df8e90a57f1ba61ffd63b0468c86bb6d3a99@infradead.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- Documentation/laptops/freefall.c
+++ Documentation/laptops/freefall.c
@@ -29,16 +29,12 @@

 static int set_unload_heads_path(char *device)
 {
-	char devname[64];
-
 	if (strlen(device) <= 5 || strncmp(device, "/dev/", 5) != 0)
 		return -EINVAL;
-	strncpy(devname, device + 5, sizeof(devname) - 1);
-	devname[sizeof(devname) - 1] = '\0';
 	strncpy(device_path, device, sizeof(device_path) - 1);

 	snprintf(unload_heads_path, sizeof(unload_heads_path) - 1,
-				"/sys/block/%s/device/unload_heads", devname);
+				"/sys/block/%s/device/unload_heads", device+5);
 	return 0;
 }


py: compiler supports string juxtaposition=concatenation.

--- py/compile.c
+++ py/compile.c
@@ -2050,18 +2050,36 @@

 void compile_atom_string(compiler_t *comp, py_parse_node_struct_t *pns) {
     // a list of strings
-    EMIT(load_const_verbatim_start);
-    EMIT(load_const_verbatim_str, "'");
+
+    // check type of list (string or bytes) and count total number of bytes
     int n = PY_PARSE_NODE_STRUCT_NUM_NODES(pns);
+    int n_bytes = 0;
+    int string_kind = PY_PARSE_NODE_NULL;
     for (int i = 0; i < n; i++) {
-        // TODO allow concatenation of either strings or bytes, but not mixed
         assert(PY_PARSE_NODE_IS_LEAF(pns->nodes[i]));
-        assert(PY_PARSE_NODE_LEAF_KIND(pns->nodes[i]) == PY_PARSE_NODE_STRING);
+        int pn_kind = PY_PARSE_NODE_LEAF_KIND(pns->nodes[i]);
+        assert(pn_kind == PY_PARSE_NODE_STRING || pn_kind == PY_PARSE_NODE_BYTES);
+        if (i == 0) {
+            string_kind = pn_kind;
+        } else if (pn_kind != string_kind) {
+            printf("SyntaxError: cannot mix bytes and nonbytes literals\n");
+            return;
+        }
         const char *str = qstr_str(PY_PARSE_NODE_LEAF_ARG(pns->nodes[i]));
-        EMIT(load_const_verbatim_strn, str, strlen(str));
-    }
-    EMIT(load_const_verbatim_str, "'");
-    EMIT(load_const_verbatim_end);
+        n_bytes += strlen(str);
+    }
+
+    // allocate memory for concatenated string/bytes
+    char *cat_str = m_new(char, n_bytes + 1);
+    cat_str[0] = '\0';
+
+    // concatenate string/bytes
+    for (int i = 0; i < n; i++) {
+        const char *str = qstr_str(PY_PARSE_NODE_LEAF_ARG(pns->nodes[i]));
+        strcat(cat_str, str);
+    }
+
+    EMIT(load_const_str, qstr_from_str_take(cat_str), string_kind == PY_PARSE_NODE_BYTES);
 }

 // pns needs to have 2 nodes, first is lhs of comprehension, second is PN_comp_for node


py/mpprint: Implement %llu and %lld format specifiers for mp_printf.

Only enabled for MICROPY_OBJ_REPR_D.

--- py/mpprint.c
+++ py/mpprint.c
@@ -526,6 +526,20 @@
                 break;
             }
 #endif
+            // Because 'l' is eaten above, another 'l' means %ll.  We need to support
+            // this length specifier for OBJ_REPR_D (64-bit NaN boxing).
+            // TODO Either enable this unconditionally, or provide a specific config var.
+            #if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_D
+            case 'l': {
+                unsigned long long int arg_value = va_arg(args, unsigned long long int);
+                ++fmt;
+                if (*fmt == 'u' || *fmt == 'd') {
+                    chrs += mp_print_int(print, arg_value, *fmt == 'd', 10, 'a', flags, fill, width);
+                    break;
+                }
+                // fall through to default case to print unknown format char
+            }
+            #endif
             default:
                 print->print_strn(print->data, fmt, 1);
                 chrs += 1;


obexd: Use LM_AUTH and LM_ENCRYPT instead of LM_SECURE for now (same way as bluez)

--- obexd/src/bluetooth.c
+++ obexd/src/bluetooth.c
@@ -222,7 +222,7 @@
 	}

 	if (secure) {
-		int lm = RFCOMM_LM_SECURE;
+		int lm = RFCOMM_LM_AUTH | RFCOMM_LM_ENCRYPT;

 		if (setsockopt(sk, SOL_RFCOMM, RFCOMM_LM, &lm, sizeof(lm)) < 0) {
 			err = errno;


[INTERNAL] Parallel: pointer versions of atomicPostInc(), atomicDec(), atomicPostDec(), atomicAdd()

--- core/include/seqan/parallel/parallel_atomic_primitives.h
+++ core/include/seqan/parallel/parallel_atomic_primitives.h
@@ -460,10 +460,36 @@
     return __sync_lock_test_and_set(x, y);
 }

+// Pointer versions
+
 template <typename T>
 inline T * atomicInc(T * volatile & x)
 {
     return (T *) __sync_add_and_fetch((size_t volatile *)&x, sizeof(T));
+}
+
+template <typename T>
+inline T * atomicPostInc(T * volatile & x)
+{
+    return (T *) __sync_fetch_and_add((size_t volatile *)&x, sizeof(T));
+}
+
+template <typename T>
+inline T * atomicDec(T * volatile & x)
+{
+    return (T *) __sync_add_and_fetch((size_t volatile *)&x, -sizeof(T));
+}
+
+template <typename T>
+inline T * atomicPostDec(T * volatile & x)
+{
+    return (T *) __sync_fetch_and_add((size_t volatile *)&x, -sizeof(T));
+}
+
+template <typename T1, typename T2>
+inline T1 * atomicAdd(T1 * volatile & x, T2 y)
+{
+    return (T1 *) __sync_add_and_fetch((size_t volatile *)&x, y * sizeof(T2));
 }

 #endif  // #if defined(PLATFORM_WINDOWS) && !defined(PLATFORM_WINDOWS_MINGW)
@@ -477,20 +503,21 @@
 template <typename T>   inline T atomicPostInc(T      & x,             Serial)      { return x++;                    }
 template <typename T>   inline T atomicDec(T          & x,             Serial)      { return --x;                    }
 template <typename T>   inline T atomicPostDec(T      & x,             Serial)      { return x--;                    }
-template <typename T1, typename T2>   inline T1 atomicAdd(T1          & x, T2 y,       Serial)      { return x = x + y;              }
 template <typename T>   inline T atomicOr (T          & x, T y,        Serial)      { return x = x | y;              }
 template <typename T>   inline T atomicXor(T          & x, T y,        Serial)      { return x = x ^ y;              }
 template <typename T>   inline T atomicCas(T          & x, T cmp, T y, Serial)      { if (x == cmp) x = y; return x; }
-
+
 template <typename T>   inline T atomicInc(T volatile & x,             Parallel)    { return atomicInc(x);           }
 template <typename T>   inline T atomicPostInc(T volatile & x,         Parallel)    { return atomicPostInc(x);       }
 template <typename T>   inline T atomicDec(T volatile & x,             Parallel)    { return atomicDec(x);           }
 template <typename T>   inline T atomicPostDec(T volatile & x,         Parallel)    { return atomicPostDec(x);       }
-template <typename T1, typename T2>   inline T1 atomicAdd(T1 volatile & x, T2 y,       Parallel)    { return atomicAdd(x, y);        }
 template <typename T>   inline T atomicOr (T volatile & x, T y,        Parallel)    { return atomicOr(x, y);         }
 template <typename T>   inline T atomicXor(T volatile & x, T y,        Parallel)    { return atomicXor(x, y);        }
 template <typename T>   inline T atomicCas(T volatile & x, T cmp, T y, Parallel)    { return atomicCas(x, cmp, y);   }

+template <typename T1, typename T2>   inline T1 atomicAdd(T1          & x, T2 y, Serial)    { return x = x + y; }
+template <typename T1, typename T2>   inline T1 atomicAdd(T1 volatile & x, T2 y, Parallel)  { return atomicAdd(x, y); }
+

 } // namespace seqan


fix usage of fatal() function when Clang analyzer is used (#2617)

--- src/bgfx_p.h
+++ src/bgfx_p.h
@@ -67,7 +67,7 @@
 namespace bgfx
 {
 #if BX_COMPILER_CLANG_ANALYZER
-	void __attribute__( (analyzer_noreturn) ) fatal(Fatal::Enum _code, const char* _format, ...);
+	void __attribute__( (analyzer_noreturn) ) fatal(const char* _filePath, uint16_t _line, Fatal::Enum _code, const char* _format, ...);
 #else
 	void fatal(const char* _filePath, uint16_t _line, Fatal::Enum _code, const char* _format, ...);
 #endif // BX_COMPILER_CLANG_ANALYZER


Fix signed subtraction overflow in CBigNum::setint64().

As noticed by sipa (Pieter Wuille), this can happen when CBigNum::setint64() is
called with an integer value of INT64_MIN (-2^63).

When compiled with -ftrapv, the program would crash. Otherwise, it would
execute an undefined operation (although in practice, usually the correct one).

--- src/bignum.h
+++ src/bignum.h
@@ -131,7 +131,15 @@

         if (sn < (int64)0)
         {
-            n = -sn;
+            // We negate in 2 steps to avoid signed subtraction overflow,
+            // i.e. -(-2^63), which is an undefined operation and causes SIGILL
+            // when compiled with -ftrapv.
+            //
+            // Note that uint64_t n = sn, when sn is an int64_t, is a
+            // well-defined operation and n will be equal to sn + 2^64 when sn
+            // is negative.
+            n = sn;
+            n = -n;
             fNegative = true;
         } else {
             n = sn;


master client should ignore proto_max_bulk_len in bitops (#9626)

--- src/bitops.c
+++ src/bitops.c
@@ -429,7 +429,7 @@
     if (usehash) loffset *= bits;

     /* Limit offset to server.proto_max_bulk_len (512MB in bytes by default) */
-    if ((loffset < 0) || (loffset >> 3) >= server.proto_max_bulk_len)
+    if (loffset < 0 || (!(c->flags & CLIENT_MASTER) && (loffset >> 3) >= server.proto_max_bulk_len))
     {
         addReplyError(c,err);
         return C_ERR;


Swift support for QMChatService+AttachmentService

--- QMChatService/QMChatService/Categories/QMChatService+AttachmentService.h
+++ QMChatService/QMChatService/Categories/QMChatService+AttachmentService.h
@@ -20,11 +20,11 @@
  *  @param saveToStorage    if YES - saves to local storage
  *  @param completion       completion block with failure error
  */
-- (void)sendMessage:(QBChatMessage *)message
+- (void)sendMessage:(QB_NONNULL QBChatMessage *)message
                type:(QMMessageType)type
-           toDialog:(QBChatDialog *)dialog
+           toDialog:(QB_NONNULL QBChatDialog *)dialog
       saveToHistory:(BOOL)saveToHistory
       saveToStorage:(BOOL)saveToStorage
-         completion:(QBChatCompletionBlock)completion;
+         completion:(QB_NULLABLE QBChatCompletionBlock)completion;

 @end


Add support for exporting to tsv, in addtion to csv

Helpful when symbols can contain commas.

--- src/bloaty.h
+++ src/bloaty.h
@@ -467,7 +467,10 @@
           PrettyPrint(options.max_label_len, out);
           break;
         case bloaty::OutputFormat::kCSV:
-          PrintToCSV(out);
+          PrintToCSV(out, /*tabs=*/false);
+          break;
+        case bloaty::OutputFormat::kTSV:
+          PrintToCSV(out, /*tabs=*/true);
           break;
         case bloaty::OutputFormat::kTSV:
           PrintToCSV(out, /*tabs=*/true);
@@ -504,7 +507,7 @@
   bool diff_mode_ = false;

   void PrettyPrint(size_t max_label_len, std::ostream* out) const;
-  void PrintToCSV(std::ostream* out, bool tabs=false) const;
+  void PrintToCSV(std::ostream* out, bool tabs) const;
   size_t CalculateLongestLabel(const RollupRow& row, int indent) const;
   void PrettyPrintRow(const RollupRow& row, size_t indent, size_t longest_row,
                       std::ostream* out) const;
@@ -512,10 +515,10 @@
                        std::ostream* out) const;
   void PrintRowToCSV(const RollupRow& row,
                      std::vector<std::string> parent_labels,
-                     std::ostream* out, bool tabs=false) const;
+                     std::ostream* out, bool tabs) const;
   void PrintTreeToCSV(const RollupRow& row,
                       std::vector<std::string> parent_labels,
-                      std::ostream* out, bool tabs=false) const;
+                      std::ostream* out, bool tabs) const;
 };

 bool ParseOptions(bool skip_unknown, int* argc, char** argv[], Options* options,


Another title bar fix.

Another title bar fix.

--- src/border.c
+++ src/border.c
@@ -740,7 +740,7 @@
    GetBorderSize(&np->state, &north, &south, &east, &west);

    count = 0;
-   available = np->width + buttonWidth;
+   available = np->width - buttonWidth;
    if(available < buttonWidth) {
       return count;
    }
@@ -766,7 +766,6 @@
    }

    return count;
-
 }

 /** Draw the buttons on a client frame. */
@@ -796,13 +795,8 @@
       pixelDown = colors[COLOR_TITLE_DOWN];
    }

-   if(settings.handles) {
-      yoffset = south - 1;
-   } else {
-      yoffset = 0;
-   }
-
    /* Close button. */
+   yoffset = settings.handles ? (south - 1) : 0;
    if(np->state.border & BORDER_CLOSE) {

       JXSetForeground(display, gc, color);


Oops

Oops

git-svn-id: 31d9d2f6432a47c86a3640814024c107794ea77c@7401 0785d39b-7218-0410-832d-ea1e28bc413d

--- deal.II/lac/include/lac/sparse_matrix_ez.templates.h
+++ deal.II/lac/include/lac/sparse_matrix_ez.templates.h
@@ -491,13 +491,13 @@
   CHECKFOR(in,'[',c);

                                    // then read data
-  in.read(reinterpret_cast<char*>(&row_info[i]),
+  in.read(reinterpret_cast<char*>(&row_info[0]),
 	  sizeof(RowInfo) * row_info.size());

   CHECKFOR(in,']',c);
   CHECKFOR(in,'[',c);

-  in.read(reinterpret_cast<char*>(&data[i]),
+  in.read(reinterpret_cast<char*>(&data[0]),
 	  sizeof(Entry) * data.size());

   CHECKFOR(in,']',c);


show ServiceName in debug messages

show ServiceName in debug messages

--- dokan/mount.c
+++ dokan/mount.c
@@ -23,8 +23,6 @@
 #include <stdio.h>
 #include "dokani.h"

-
-
 static BOOL
 DokanServiceCheck(
 	LPCWSTR	ServiceName)
@@ -76,7 +74,7 @@
 		SERVICE_START | SERVICE_STOP | SERVICE_QUERY_STATUS | DELETE);

 	if (serviceHandle == NULL) {
-		DokanDbgPrint("failed to open Service: %d\n", GetLastError());
+		DokanDbgPrintW(L"failed to open Service (%s): %d\n", ServiceName, GetLastError());
 		CloseServiceHandle(controlHandle);
 		return FALSE;
 	}
@@ -85,29 +83,29 @@

 	if (Type == DOKAN_SERVICE_DELETE) {
 		if (DeleteService(serviceHandle)) {
-			DokanDbgPrint("Service deleted\n");
+			DokanDbgPrintW(L"Service (%s) deleted\n", ServiceName);
 			result = TRUE;
 		} else {
-			DokanDbgPrint("failed to delete service: %d\n", GetLastError());
+			DokanDbgPrintW(L"failed to delete service (%s): %d\n", ServiceName, GetLastError());
 			result = FALSE;
 		}

 	} else if (ss.dwCurrentState == SERVICE_STOPPED && Type == DOKAN_SERVICE_START) {
 		if (StartService(serviceHandle, 0, NULL)) {
-			DokanDbgPrint("Service started\n");
+			DokanDbgPrintW(L"Service (%s) started\n", ServiceName);
 			result = TRUE;
 		} else {
-			DokanDbgPrint("failed to start service: %d\n", GetLastError());
+			DokanDbgPrintW(L"failed to start service (%s): %d\n", ServiceName, GetLastError());
 			result = FALSE;
 		}

 	} else if (ss.dwCurrentState == SERVICE_RUNNING && Type == DOKAN_SERVICE_STOP) {

 		if (ControlService(serviceHandle, SERVICE_CONTROL_STOP, &ss)) {
-			DokanDbgPrint("Service stopped\n");
+			DokanDbgPrintW(L"Service (%s) stopped\n");
 			result = TRUE;
 		} else {
-			DokanDbgPrint("failed to stop service: %d\n", GetLastError());
+			DokanDbgPrintW(L"failed to stop service (%s): %d\n", ServiceName, GetLastError());
 			result = FALSE;
 		}
 	}
@@ -187,9 +185,9 @@

 	if (serviceHandle == NULL) {
 		if (GetLastError() == ERROR_SERVICE_EXISTS) {
-			DokanDbgPrint("Service is already installed\n");
-		} else {
-			DokanDbgPrint("failted to install service: %d\n", GetLastError());
+			DokanDbgPrintW(L"Service (%s) is already installed\n", ServiceName);
+		} else {
+			DokanDbgPrintW(L"failted to install service (%s): %d\n", ServiceName, GetLastError());
 		}
 		CloseServiceHandle(controlHandle);
 		return FALSE;
@@ -198,13 +196,13 @@
 	CloseServiceHandle(serviceHandle);
 	CloseServiceHandle(controlHandle);

-	DokanDbgPrint("Service isntalled\n");
+	DokanDbgPrintW(L"Service (%s) isntalled\n", ServiceName);

 	if (DokanServiceControl(ServiceName, DOKAN_SERVICE_START)) {
-		DokanDbgPrint("Service started\n");
+		DokanDbgPrintW(L"Service (%s) started\n", ServiceName);
 		return TRUE;
 	} else {
-		DokanDbgPrint("Service start failed\n");
+		DokanDbgPrintW(L"Service (%s) start failed\n", ServiceName);
 		return FALSE;
 	}
 }


Fix whitespace error

Fix whitespace error

--- TDTChocolate/FoundationAdditions/NSProcessInfo+TDTEnvironmentDetection.h
+++ TDTChocolate/FoundationAdditions/NSProcessInfo+TDTEnvironmentDetection.h
@@ -36,6 +36,6 @@
  @note This method relies on a public but unstable Apple API. It
  should not be used in a release build.
  */
-- (BOOL) tdt_isDebugged;
+- (BOOL)tdt_isDebugged;

 @end


Must clean bridge context before reconnecting.

--- src/bridge.c
+++ src/bridge.c
@@ -71,9 +71,26 @@
 {
 	int new_sock = -1;
 	int i;
+	struct _mqtt3_packet *packet;

 	if(!context || !context->bridge) return 1;

+	context->connected = false;
+	context->disconnecting = false;
+	context->duplicate = false;
+	context->sock = -1;
+	context->last_msg_in = time(NULL);
+	context->last_msg_out = time(NULL);
+	context->keepalive = 60; /* Default to 60s */
+	context->clean_session = true;
+	context->in_packet.payload = NULL;
+	mqtt3_context_packet_cleanup(&context->in_packet);
+	while(context->out_packet){
+		mqtt3_context_packet_cleanup(context->out_packet);
+		packet = context->out_packet;
+		context->out_packet = context->out_packet->next;
+		mqtt3_free(packet);
+	}
 	mqtt3_log_printf(MQTT3_LOG_NOTICE, "Connecting bridge %s", context->bridge->name);
 	new_sock = mqtt3_socket_connect(context->bridge->address, context->bridge->port);
 	if(new_sock == -1){


Fixed logic in bert_buffer_empty.

Fixed logic in bert_buffer_empty.

--- src/buffer.c
+++ src/buffer.c
@@ -35,7 +35,7 @@

 int bert_buffer_empty(const bert_buffer_t *buffer)
 {
-	return (!(buffer->head) || (buffer->head->length > 0));
+	return (!(buffer->head) || (buffer->head->length == 0));
 }

 size_t bert_buffer_length(const bert_buffer_t *buffer)


[core] remove redundant asserts

[core] remove redundant asserts

buffer_append_strftime() requires a non-NULL const string for format

buffer_append_string_encoded() and buffer_append_string_c_escaped()
both will handle encoding a 0-length string.  Since a 0-length string
is not expected, do not special-case it.  C type buffer_encoding_t
expects a constant value to be passed, so encoding map is not NULL.

--- src/buffer.c
+++ src/buffer.c
@@ -9,10 +9,6 @@
 static const char hex_chars_lc[] = "0123456789abcdef";
 static const char hex_chars_uc[] = "0123456789ABCDEF";

-/**
- * init the buffer
- *
- */

 __attribute_noinline__
 buffer* buffer_init(void) {
@@ -334,7 +330,6 @@
 }

 void buffer_append_strftime(buffer * const restrict b, const char * const restrict format, const struct tm * const restrict tm) {
-    force_assert(NULL != format);
     /*(localtime_r() or gmtime_r() producing tm should not have failed)*/
     if (__builtin_expect( (NULL == tm), 0)) return;

@@ -609,10 +604,6 @@
 	size_t d_len, ndx;
 	const char *map = NULL;

-	if (0 == s_len) return;
-
-	force_assert(NULL != s);
-
 	switch(encoding) {
 	case ENCODING_REL_URI:
 		map = encoded_chars_rel_uri;
@@ -627,8 +618,6 @@
 		map = encoded_chars_minimal_xml;
 		break;
 	}
-
-	force_assert(NULL != map);

 	/* count to-be-encoded-characters */
 	for (ds = (unsigned char *)s, d_len = 0, ndx = 0; ndx < s_len; ds++, ndx++) {
@@ -683,8 +672,6 @@
 void buffer_append_string_c_escaped(buffer * const restrict b, const char * const restrict s, size_t s_len) {
 	unsigned char *ds, *d;
 	size_t d_len, ndx;
-
-	if (0 == s_len) return;

 	/* count to-be-encoded-characters */
 	for (ds = (unsigned char *)s, d_len = 0, ndx = 0; ndx < s_len; ds++, ndx++) {


moved increment under lock

moved increment under lock

--- pthread_wq_np.c
+++ pthread_wq_np.c
@@ -130,8 +130,8 @@
 	pthread_mutex_unlock(&_init_mutex);
 	return 0;
 out_bad:
+	_wq_configured = 0;
 	pthread_mutex_unlock(&_init_mutex);
-	_wq_configured = 0;
 	return ENOMEM;
 }


Refactor semaphore tc

Refactor semaphore tc

Add NULL check case. Remove unneccesary variables

--- apps/examples/testcase/le_tc/kernel/tc_semaphore.c
+++ apps/examples/testcase/le_tc/kernel/tc_semaphore.c
@@ -25,15 +25,13 @@
 #include <sys/types.h>
 #include "tc_internal.h"

-#define SEC_2           2
-
-int g_pshared = 0;
-int g_count = 1;
-
-sem_t g_empty;
-sem_t g_full;
-sem_t g_mutex;
-int g_loop_cnt = 5;
+#define PSHARED     0
+#define SEC_2       2
+#define LOOP_CNT    5
+
+static sem_t g_empty;
+static sem_t g_full;
+static sem_t g_sem;

 /**
 * @fn                   :producer_func
@@ -43,25 +41,25 @@
 static void *producer_func(void *arg)
 {
 	int index;
-	int ret_val;
-	for (index = 0; index < g_loop_cnt; index++) {
-		ret_val = sem_wait(&g_empty);
-		if (ret_val == ERROR) {
+	int ret_chk;
+	for (index = 0; index < LOOP_CNT; index++) {
+		ret_chk = sem_wait(&g_empty);
+		if (ret_chk == ERROR) {
 			pthread_exit("sem_wait(&g_empty)");
 		}

-		ret_val = sem_wait(&g_mutex);
-		if (ret_val == ERROR) {
+		ret_chk = sem_wait(&g_sem);
+		if (ret_chk == ERROR) {
 			pthread_exit("sem_wait(&g_mutex)");
 		}

-		ret_val = sem_post(&g_mutex);
-		if (ret_val == ERROR) {
+		ret_chk = sem_post(&g_sem);
+		if (ret_chk == ERROR) {
 			pthread_exit("sem_post(&g_mutex)");
 		}

-		ret_val = sem_post(&g_full);
-		if (ret_val == ERROR) {
+		ret_chk = sem_post(&g_full);
+		if (ret_chk == ERROR) {
 			pthread_exit("sem_post(&g_full)");
 		}
 	}
@@ -77,25 +75,25 @@
 static void *consumer_func(void *arg)
 {
 	int index;
-	int ret_val;
-	for (index = 0; index < g_loop_cnt; index++) {
-		ret_val = sem_wait(&g_full);
-		if (ret_val == ERROR) {
+	int ret_chk;
+	for (index = 0; index < LOOP_CNT; index++) {
+		ret_chk = sem_wait(&g_full);
+		if (ret_chk == ERROR) {
 			pthread_exit("sem_wait(&g_full)");
 		}

-		ret_val = sem_wait(&g_mutex);
-		if (ret_val == ERROR) {
+		ret_chk = sem_wait(&g_sem);
+		if (ret_chk == ERROR) {
 			pthread_exit("sem_wait(&g_mutex)");
 		}

-		ret_val = sem_post(&g_mutex);
-		if (ret_val == ERROR) {
+		ret_chk = sem_post(&g_sem);
+		if (ret_chk == ERROR) {
 			pthread_exit("sem_post(&g_mutex)");
 		}

-		ret_val = sem_post(&g_empty);
-		if (ret_val == ERROR) {
+		ret_chk = sem_post(&g_empty);
+		if (ret_chk == ERROR) {
 			pthread_exit("sem_post(&g_empty)");
 		}
 	}
@@ -104,96 +102,117 @@
 }

 /**
-* @fn                   :tc_semaphore_sem_init_post_wait
-* @brief                :Unlocks the semaphore passed as argument.
+* @fn                   :tc_semaphore_sem_post_wait
+* @brief                :this tc tests sem_post, sem_wait
 * @scenario             :Unlocks the semaphore passed as argument.
-* API's covered         :sem_init, sem_post, sem_wait
-* Preconditions         :Semaphore should be initialised.
+* API's covered         :sem_post, sem_wait
+* Preconditions         :none
 * Postconditions        :Semaphore should be destroyed.
 * @return               :void
 */
-static void tc_semaphore_sem_init_post_wait(void)
-{
-	int ret_val;
+static void tc_semaphore_sem_post_wait(void)
+{
 	pthread_addr_t pexit_value = NULL;
 	pthread_t pid;
 	pthread_t cid;
-
-	ret_val = sem_init(&g_empty, g_pshared, g_count);
-	TC_ASSERT_NEQ("sem_init", ret_val, ERROR);
-
-	ret_val = sem_init(&g_full, g_pshared, 0);
-	TC_ASSERT_NEQ("sem_init", ret_val, ERROR);
-
-	ret_val = sem_init(&g_mutex, g_pshared, g_count);
-	TC_ASSERT_NEQ("sem_init", ret_val, ERROR);
-
-	ret_val = pthread_create(&pid, NULL, producer_func, NULL);
-	TC_ASSERT_EQ("pthread_create", ret_val, OK);
-
-	ret_val = pthread_create(&cid, NULL, consumer_func, NULL);
-	TC_ASSERT_EQ("pthread_create", ret_val, OK);
-
-	ret_val = pthread_join(pid, &pexit_value);
-	TC_ASSERT_EQ("pthread_join", ret_val, OK);
-	TC_ASSERT_EQ("pthread_join", pexit_value, NULL);
-
-	ret_val = pthread_join(cid, &pexit_value);
-	TC_ASSERT_EQ("pthread_join", ret_val, OK);
-	TC_ASSERT_EQ("pthread_join", pexit_value, NULL);
-
+	int ret_chk;
+
+#ifndef CONFIG_DEBUG
+	/* sem_wait test NULL case */
+
+	ret_chk = sem_wait(NULL);
+	TC_ASSERT_EQ("sem_wait", ret_chk, ERROR);
+	TC_ASSERT_EQ("sem_wait", get_errno(), EINVAL);
+#endif
+
+	/* sem_post test NULL case */
+
+	ret_chk = sem_post(NULL);
+	TC_ASSERT_EQ("sem_post", ret_chk, ERROR);
+	TC_ASSERT_EQ("sem_post", get_errno(), EINVAL);
+
+	/* sem_wait & sem post ping-pong test */
+
+	ret_chk = sem_init(&g_empty, PSHARED, 1);
+	TC_ASSERT_EQ_CLEANUP("sem_init", ret_chk, OK, "fail to init semaphore", goto cleanup);
+
+	ret_chk = sem_init(&g_full, PSHARED, 0);
+	TC_ASSERT_EQ_CLEANUP("sem_init", ret_chk, OK, "fail to init semaphore", goto cleanup);
+
+	ret_chk = sem_init(&g_sem, PSHARED, 1);
+	TC_ASSERT_EQ_CLEANUP("sem_init", ret_chk, OK, "fail to init semaphore", goto cleanup);
+
+	ret_chk = pthread_create(&pid, NULL, producer_func, NULL);
+	TC_ASSERT_EQ_CLEANUP("pthread_create", ret_chk, OK, "fail to create pthread", goto cleanup);
+
+	ret_chk = pthread_create(&cid, NULL, consumer_func, NULL);
+	TC_ASSERT_EQ_CLEANUP("pthread_create", ret_chk, OK, "fail to create pthread", goto cleanup);
+
+	ret_chk = pthread_join(pid, &pexit_value);
+	TC_ASSERT_EQ_CLEANUP("pthread_join", ret_chk, OK, "fail to join pthread", goto cleanup);
+	TC_ASSERT_EQ_CLEANUP("pthread_join", pexit_value, NULL, "unexpected exit value", goto cleanup);
+
+	ret_chk = pthread_join(cid, &pexit_value);
+	TC_ASSERT_EQ_CLEANUP("pthread_join", ret_chk, OK, "fail to join pthread", goto cleanup);
+	TC_ASSERT_EQ_CLEANUP("pthread_join", pexit_value, NULL, "unexpected exit value", goto cleanup);
+
+	TC_SUCCESS_RESULT();
+
+cleanup:
 	sem_destroy(&g_empty);
 	sem_destroy(&g_full);
-	sem_destroy(&g_mutex);
-	TC_SUCCESS_RESULT();
-}
+	sem_destroy(&g_sem);
+}
+

 /**
 * @fn                   :tc_semaphore_sem_trywait
-* @brief                :sem_trywait() is the same as sem_wait(), except that if the decrement cannot be
-*                        immediately performed, then call returns an error (errno set to EAGAIN)
-*                        instead of blocking.
-* @scenario             :sem_trywait() is the same as sem_wait(), except that if the decrement cannot be
-*                        immediately performed, then call returns an error (errno set to EAGAIN)
-*                        instead of blocking.
-* API's covered         :sem_init, sem_trywait
-* Preconditions         :Semaphore should be initialised and should be unlocked.
-* Postconditions        :Semaphore should be destroyed.
+* @brief                :this tc tests sem_trywait
+* @scenario             :if sem is NULL, sem_trywait returns ERROR and set errno to EINVAL
+*                        else if sem is not available, it returns ERROR and set errno to EAGAIN
+*                        else(==sem is available), it returns OK and get sem
+* API's covered         :sem_trywait
+* Preconditions         :none
+* Postconditions        :none
 * @return               :void
 */

 static void tc_semaphore_sem_trywait(void)
 {
-	int ret_val = ERROR;
-	sem_t sem_name;
-
-	ret_val = sem_init(&sem_name, g_pshared, 0);
-	TC_ASSERT_NEQ("sem_init", ret_val, ERROR);
-
-	/* semname count is 0, sem_trywait will not block, but return immediately with error */
-	ret_val = sem_trywait(&sem_name);
-	TC_ASSERT_EQ("sem_trywait", ret_val, ERROR);
-	sem_destroy(&sem_name);
-
-	ret_val = sem_init(&sem_name, g_pshared, g_count);
-	TC_ASSERT_NEQ("sem_init", ret_val, ERROR);
-
-	ret_val = sem_trywait(&sem_name);
-	TC_ASSERT_NEQ("sem_trywait", ret_val, ERROR);
-
-	ret_val = sem_post(&sem_name);
-	TC_ASSERT_NEQ("sem_post", ret_val, ERROR);
-
-	/* locking semaphore to test sem_trywait */
-	ret_val = sem_wait(&sem_name);
-	if (ret_val == ERROR) {
-		printf("tc_semaphore_sem_trywait FAIL : Semaphore not locked so skipping scenario to test sem_trywait in locked semaphore state \n");
-	} else {
-		/* locking semaphore in locked state using sem_trywait will return ERROR on pass */
-		ret_val = sem_trywait(&sem_name);
-		TC_ASSERT_EQ("sem_trywait", ret_val, ERROR);
-	}
-	sem_destroy(&sem_name);
+	sem_t sem;
+	int ret_chk;
+
+#ifndef CONFIG_DEBUG
+	/* test NULL case */
+
+	ret_chk = sem_trywait(NULL);
+	TC_ASSERT_EQ("sem_trywait", ret_chk, ERROR);
+	TC_ASSERT_EQ("sem_trywait", get_errno(), EINVAL);
+#endif
+
+	/* sem_trywait can't get sem */
+
+	ret_chk = sem_init(&sem, PSHARED, 0);
+	TC_ASSERT_EQ("sem_init", ret_chk, OK);
+
+	ret_chk = sem_trywait(&sem);
+	TC_ASSERT_EQ("sem_trywait", ret_chk, ERROR);
+	TC_ASSERT_EQ("sem_trywait", get_errno(), EAGAIN);
+
+	ret_chk = sem_destroy(&sem);
+	TC_ASSERT_EQ("sem_destroy", ret_chk, OK);
+
+	/* sem_trywait can get sem */
+
+	ret_chk = sem_init(&sem, PSHARED, 1);
+	TC_ASSERT_EQ("sem_init", ret_chk, OK);
+
+	ret_chk = sem_trywait(&sem);
+	TC_ASSERT_EQ("sem_trywait", ret_chk, OK);
+
+	ret_chk = sem_destroy(&sem);
+	TC_ASSERT_EQ("sem_destroy", ret_chk, OK);
+
 	TC_SUCCESS_RESULT();
 }

@@ -216,7 +235,7 @@

 	/* init sem count to 1 */

-	ret_chk = sem_init(&sem, 0, 1);
+	ret_chk = sem_init(&sem, PSHARED, 1);
 	TC_ASSERT_EQ("sem_init", ret_chk, OK);
 	ret_chk = clock_gettime(CLOCK_REALTIME, &abstime);
 	TC_ASSERT_EQ("clock_gettime", ret_chk, OK);
@@ -256,7 +275,7 @@

 	/* init sem count to 0 */

-	ret_chk = sem_init(&sem, 0, 0);
+	ret_chk = sem_init(&sem, PSHARED, 0);
 	TC_ASSERT_EQ("sem_init", ret_chk, OK);

 	/* invalid time test */
@@ -323,7 +342,7 @@
 	TC_ASSERT_EQ("sem_destroy", ret_chk, ERROR);
 	TC_ASSERT_EQ("sem_destroy", get_errno(), EINVAL);

-	ret_chk = sem_init(&sem, g_pshared, g_count);
+	ret_chk = sem_init(&sem, PSHARED, 1);
 	TC_ASSERT_EQ("sem_init", ret_chk, OK);

 	ret_chk = sem_destroy(&sem);
@@ -339,7 +358,7 @@

 int semaphore_main(void)
 {
-	tc_semaphore_sem_init_post_wait();
+	tc_semaphore_sem_post_wait();
 	tc_semaphore_sem_trywait();
 	tc_semaphore_sem_timedwait();
 	tc_semaphore_sem_destroy();


Try fix for ACK loop on QR test issue

Try fix for ACK loop on QR test issue

--- lib/src/loop.c
+++ lib/src/loop.c
@@ -96,7 +96,7 @@
         const uint64_t next = timeouts_timeout(ped(w)->wheel);
         // warn(CRT, "%" PRIu64, next);
         if (next == 0)
-            break;
+            continue;

         if (w_nic_rx(w, (int64_t)next) == false)
             continue;


Try and debug q_ready loop

Try and debug q_ready loop

--- lib/src/quic.c
+++ lib/src/quic.c
@@ -1002,30 +1002,35 @@
              const uint64_t nsec,
              struct q_conn ** const ready)
 {
+    struct q_conn * c;
+    sl_foreach (c, &c_ready, node_rx_ext) {
+        warn(ERR, "c_ready has %s conn %s", conn_type(c), cid_str(c->scid));
+    }
+
     if (sl_empty(&c_ready)) {
         if (nsec)
             restart_api_alarm(w, nsec);
-#ifdef DEBUG_EXTRA
+        // #ifdef DEBUG_EXTRA
         warn(WRN, "waiting for conn to get ready");
-#endif
+        // #endif
         loop_run(w, (func_ptr)q_ready, 0, 0);
     }

     if (ready == 0)
         goto done;

-    struct q_conn * const c = sl_first(&c_ready);
+    /*struct q_conn * const*/ c = sl_first(&c_ready);
     if (c) {
         bool remove = true;
 #ifndef NO_SERVER
         if (c->needs_accept)
             remove = c->have_new_data == false;
 #endif
-#if defined(DEBUG_EXTRA) && !defined(NO_SERVER)
+// #if defined(DEBUG_EXTRA) && !defined(NO_SERVER)
         warn(WRN, "%s conn %s ready to %s", conn_type(c), cid_str(c->scid),
              c->needs_accept ? "accept"
                              : (c->state == conn_clsd ? "close" : "rx"));
-#endif
+// #endif
         if (remove) {
             sl_remove_head(&c_ready, node_rx_ext);
             c->in_c_ready = false;


Fixed the lib

Fixed the lib

--- lib/src/text.c
+++ lib/src/text.c
@@ -20,11 +20,11 @@

 void putch(char c)
 {
-    __asm__ __volatile__("mov $0, %%eax; mov %0, %%ebx; int $" MACRO_STRING(SYSCALL_INTERRUPT) ";" : : "m" (c) : "eax", "ebx");
+    __asm__ __volatile__("mov $0x02, %%eax; mov %0, %%ebx; int $" MACRO_STRING(SYSCALL_INTERRUPT) ";" : : "m" (c) : "eax", "ebx");
 }

 void puts(string s)
 {
-    for (char *c = s; c != 0x0; c++)
-        putch(*c);
+    for (char *c = s; *c != 0x0; c++)
+      putch(*c);
 }


Small code improvement

Small code improvement

--- lib/src/util.c
+++ lib/src/util.c
@@ -215,23 +215,24 @@
     const char * const util_col[] = {BMAG, BRED, BYEL, BCYN, BBLU, BGRN};
     DTHREAD_LOCK;

-    struct timeval now = {0, 0}, dur = {0, 0};
+    static struct timeval last = {-1, -1};
+    struct timeval now = {0, 0}, dur = {0, 0}, diff = {0, 0};
     gettimeofday(&now, 0);
     timersub(&now, &util_epoch, &dur);
+    timersub(&now, &last, &diff);

     fprintf(stderr, DTHREAD_ID_IND(NRM), DTHREAD_ID);

-    char now_str[10];
-    static char last_str[10];
-    snprintf(now_str, sizeof(now_str), "%ld.%03ld",
-             (long)(dur.tv_sec % 1000), // NOLINT
-             (long)(dur.tv_usec / 1000) // NOLINT
-    );
-    if (strncmp(now_str, last_str, sizeof(now_str)) != 0) {
+    static char now_str[10];
+    if (diff.tv_sec || diff.tv_usec > 1000) {
+        snprintf(now_str, sizeof(now_str), "%ld.%03ld",
+                 (long)(dur.tv_sec % 1000), // NOLINT
+                 (long)(dur.tv_usec / 1000) // NOLINT
+        );
         fprintf(stderr, "%s ", now_str);
-        strncpy(last_str, now_str, sizeof(last_str));
+        last = now;
     } else
-        for (size_t i = 0; i <= strlen(last_str); i++)
+        for (size_t i = 0; i <= strlen(now_str); i++)
             fprintf(stderr, " ");
     fprintf(stderr, "%s " NRM " ", util_col[dlevel]);


Add prototypes

Add prototypes

--- ldso/ldso/ldso.c
+++ ldso/ldso/ldso.c
@@ -114,6 +114,7 @@
 	}
 }

+void _dl_run_init_array(struct elf_resolve *tpnt);
 void _dl_run_init_array(struct elf_resolve *tpnt)
 {
 	_dl_run_array_forward(tpnt->dynamic_info[DT_INIT_ARRAY],
@@ -121,11 +122,13 @@
 			      tpnt->loadaddr);
 }

+void _dl_app_init_array(void);
 void _dl_app_init_array(void)
 {
 	_dl_run_init_array(_dl_loaded_modules);
 }

+void _dl_run_fini_array(struct elf_resolve *tpnt);
 void _dl_run_fini_array(struct elf_resolve *tpnt)
 {
 	if (tpnt->dynamic_info[DT_FINI_ARRAY]) {
@@ -139,6 +142,7 @@
 	}
 }

+void _dl_app_fini_array(void);
 void _dl_app_fini_array(void)
 {
 	_dl_run_fini_array(_dl_loaded_modules);


Avoid gratitious behaviour change

Avoid gratitious behaviour change

gtk_entry_set_text() used to emit the ::delete-text, ::insert-text
signals. Changing to GtkEntryBuffer should not change this.

--- gtk/gtkentry.c
+++ gtk/gtkentry.c
@@ -6708,6 +6708,7 @@
 gtk_entry_set_text (GtkEntry    *entry,
 		    const gchar *text)
 {
+  gint tmp_pos;
   GtkEntryCompletion *completion;
   GtkEntryPrivate *priv;

@@ -6727,7 +6728,9 @@

   begin_change (entry);
   g_object_freeze_notify (G_OBJECT (entry));
-  gtk_entry_buffer_set_text (priv->buffer, text, -1);
+  gtk_editable_delete_text (GTK_EDITABLE (entry), 0, -1);
+  tmp_pos = 0;
+  gtk_editable_insert_text (GTK_EDITABLE (entry), text, strlen (text), &tmp_pos);
   g_object_thaw_notify (G_OBJECT (entry));
   end_change (entry);


Comment-out Paint() also in the header file.

--- EVE/EveDet/AliEveTRDData.h
+++ EVE/EveDet/AliEveTRDData.h
@@ -57,7 +57,7 @@

   void			ComputeRepresentation();
   const AliTRDarrayADC*	GetData() const {return fData.HasData() ? &fData : 0x0;}
-  void			Paint(Option_t *opt="");
+  //void			Paint(Option_t *opt="");
   void			Reset();
   void			SetData(AliTRDdigitsManager *digits);


Fix mirv_streams crashbug

Fix mirv_streams crashbug

- Fixed mirv_streams crashbug that e.g. could happen on listen servers when CS:GO was freeing a material (e.g. when POV player died) on the drawing thread while in the view rendering functions on the drawing thread at same time, causing HLAE to crash (tried to lock a mutex twice from same thread).

--- AfxHookSource/AfxStreams.h
+++ AfxHookSource/AfxStreams.h
@@ -2521,7 +2521,7 @@

 			virtual void AfxMaterialFree(CAfxTrackedMaterial* trackedMaterial)
 			{
-				std::unique_lock<std::mutex> unique_lock(m_Context->m_MapMutex);
+				// Happens only from drawing context or when not drawing, so no need to lock.

 				std::map<CAfxTrackedMaterial*, CCacheEntry>::iterator it = m_Context->m_Map.find(trackedMaterial);

@@ -2566,7 +2566,7 @@

 		virtual void AfxMaterialFree(CAfxTrackedMaterial * trackedMaterial)
 		{
-			std::unique_lock<std::shared_timed_mutex> unique_lock(m_Stream->m_PickerMutex);
+			// Happens only from drawing context or when not drawing, so no need to lock.

 			Materials.erase(trackedMaterial);
 		}
@@ -2633,7 +2633,7 @@

 		virtual void AfxMaterialFree(CAfxTrackedMaterial * material)
 		{
-			std::unique_lock<std::shared_timed_mutex> unique_lock(m_Stream->m_PickerMutex);
+			// Happens only from drawing context or when not drawing, so no need to lock.

 			m_Stream->m_PickerMaterials.erase(material);
 		}


label: Set wrap on the layout unconditionally

--- gtk/gtklabel.c
+++ gtk/gtklabel.c
@@ -3387,7 +3387,6 @@
       else
         width = allocation.width  - xpad * 2;

-      pango_layout_set_wrap (priv->layout, priv->wrap_mode);
       pango_layout_set_width (priv->layout, MAX (width, 1) * PANGO_SCALE);
     }
   else /* !priv->wrap */
@@ -3460,6 +3459,7 @@

       pango_layout_set_alignment (priv->layout, align);
       pango_layout_set_ellipsize (priv->layout, priv->ellipsize);
+      pango_layout_set_wrap (priv->layout, priv->wrap_mode);
       pango_layout_set_single_paragraph_mode (priv->layout, priv->single_line_mode);

       gtk_label_update_layout_width (label);


[Collections] Clean up interface by removing NS_REQUIRES_SUPER (#6788)

The delegate calls that return "BOOL" have no reason to *require* subclasses to call them. They set no state in the collection view. Subclasses can certainly call [super] if they want to get the functionality of MDCCollectionViewController, but the NS_REQUIRES_SUPER is too strong a requirement for a lot of subclassing.

--- components/Collections/src/MDCCollectionViewController.h
+++ components/Collections/src/MDCCollectionViewController.h
@@ -49,20 +49,11 @@
  as well as ink during the highlight/unhighlight states.
  */

-- (BOOL)collectionView:(nonnull UICollectionView *)collectionView
-    shouldHighlightItemAtIndexPath:(nonnull NSIndexPath *)indexPath NS_REQUIRES_SUPER;
-
 - (void)collectionView:(nonnull UICollectionView *)collectionView
     didHighlightItemAtIndexPath:(nonnull NSIndexPath *)indexPath NS_REQUIRES_SUPER;

 - (void)collectionView:(nonnull UICollectionView *)collectionView
     didUnhighlightItemAtIndexPath:(nonnull NSIndexPath *)indexPath NS_REQUIRES_SUPER;
-
-- (BOOL)collectionView:(nonnull UICollectionView *)collectionView
-    shouldSelectItemAtIndexPath:(nonnull NSIndexPath *)indexPath NS_REQUIRES_SUPER;
-
-- (BOOL)collectionView:(nonnull UICollectionView *)collectionView
-    shouldDeselectItemAtIndexPath:(nonnull NSIndexPath *)indexPath NS_REQUIRES_SUPER;

 - (void)collectionView:(nonnull UICollectionView *)collectionView
     didSelectItemAtIndexPath:(nonnull NSIndexPath *)indexPath NS_REQUIRES_SUPER;


Allow clearing input field in Android native text input

--- project/jni/sdl-1.2/src/video/android/SDL_androidinput.c
+++ project/jni/sdl-1.2/src/video/android/SDL_androidinput.c
@@ -896,6 +896,8 @@
 JNIEXPORT void JNICALL
 JAVA_EXPORT_NAME(DemoRenderer_nativeTextInputFinished) ( JNIEnv*  env, jobject thiz )
 {
+	if (textInputBufferPos == 0 && textInputBuffer) // No text input - clear buffer
+		textInputBuffer[0] = 0;
 	textInputBuffer = NULL;
 	SDL_ANDROID_TextInputFinished = 1;
 }


cleanup

cleanup

--- swf/swftools/lib/modules/swftext.c
+++ swf/swftools/lib/modules/swftext.c
@@ -447,31 +447,40 @@
         f->glyphnames = 0;
     }
 }
+
 static void font_freeusage(SWFFONT*f)
 {
-    if (f->use) {
-        if(f->use->chars) {
+    if (f->use)
+    {
+        if (f->use->chars)
+        {
             free(f->use->chars);f->use->chars = 0;
         }
-        if(f->use->neighbors) {
+        if (f->use->neighbors)
+        {
             free(f->use->neighbors);f->use->neighbors = 0;
         }
-        if(f->use->neighbors_hash) {
+        if (f->use->neighbors_hash)
+        {
             free(f->use->neighbors_hash);f->use->neighbors_hash = 0;
         }
         free(f->use); f->use = 0;
     }
 }
+
 static void font_freelayout(SWFFONT*f)
 {
-    if (f->layout) {
+    if (f->layout)
+    {
         swf_LayoutFree(f->layout);
         f->layout = 0;
     }
 }
+
 static void font_freename(SWFFONT*f)
 {
-    if (f->name) {
+    if (f->name)
+    {
         free(f->name);
         f->name = 0;
     }
@@ -546,13 +555,6 @@
     font->glyph2glyph = newpos;
 }

-void swf_FontPrepareForEditText(SWFFONT * font)
-{
-    if (!font->layout)
-        swf_FontCreateLayout(font);
-    swf_FontSort(font);
-}
-
 static unsigned hash2(int char1, int char2)
 {
     unsigned hash = char1^(char2<<8);
@@ -565,37 +567,20 @@
 int swf_FontUseGetPair(SWFFONT * f, int char1, int char2)
 {
     FONTUSAGE*u = f->use;
-    if(!u || !u->neighbors_hash_size)
+    if (!u || !u->neighbors_hash_size)
         return 0;
     unsigned hash = hash2(char1, char2);
-    while(1) {
+    while (1)
+    {
         hash = hash%u->neighbors_hash_size;
         int pos = u->neighbors_hash[hash];
-        if(!pos)
+        if (!pos)
             return 0;
-        if(pos &&
-                u->neighbors[pos-1].char1 == char1 &&
-                u->neighbors[pos-1].char2 == char2) {
+        if (pos && u->neighbors[pos-1].char1 == char1 && u->neighbors[pos-1].char2 == char2)
             return pos;
-        }
         hash++;
     }

-}
-
-static inline int fontSize(SWFFONT * font)
-{
-    int t;
-    int size = 0;
-    for (t = 0; t < font->numchars; t++) {
-        int l = 0;
-        if(font->glyph[t].shape)
-            l = (font->glyph[t].shape->bitlen + 7) / 8;
-        else
-            l = 8;
-        size += l + 1;
-    }
-    return size + (font->numchars + 1) * 2;
 }

 void swf_FontAddLayout(SWFFONT * f, int ascent, int descent, int leading)
@@ -655,188 +640,3 @@

     free(f);
 }
-
-static int swf_TextCountBits2(SWFFONT * font, U8 * s, int scale, U8 * gbits, U8 * abits, char *encoding)
-{
-    U16 g, a;
-    char utf8 = 0;
-    if ((!s) || (!font) || ((!gbits) && (!abits)) || (!font->ascii2glyph))
-        return -1;
-    g = a = 0;
-
-    if (!strcmp(encoding, "UTF8"))
-        utf8 = 1;
-    else if (!strcmp(encoding, "iso-8859-1"))
-        utf8 = 0;
-    else
-        fprintf(stderr, "Unknown encoding: %s", encoding);
-
-    while (*s) {
-        int glyph = -1, c;
-
-        if (!utf8)
-            c = *s++;
-        else
-            c = readUTF8char(&s);
-
-        if (c < font->maxascii)
-            glyph = font->ascii2glyph[c];
-        if (glyph >= 0) {
-            g = swf_CountUBits(glyph, g);
-            a = swf_CountBits(((((U32) font->glyph[glyph].advance) * scale) / 20) / 100, a);
-        }
-    }
-
-    if (gbits)
-        gbits[0] = (U8) g;
-    if (abits)
-        abits[0] = (U8) a;
-    return 0;
-}
-
-int swf_TextCountBits(SWFFONT * font, U8 * s, int scale, U8 * gbits, U8 * abits)
-{
-    return swf_TextCountBits2(font, s, scale, gbits, abits, "iso-8859-1");
-}
-
-int swf_TextCountBitsUTF8(SWFFONT * font, U8 * s, int scale, U8 * gbits, U8 * abits)
-{
-    return swf_TextCountBits2(font, s, scale, gbits, abits, "UTF8");
-}
-
-U32 swf_TextGetWidth(SWFFONT * font, U8 * s, int scale)
-{
-    U32 res = 0;
-
-    if (font && s) {
-        while (s[0]) {
-            int g = -1;
-            if (*s < font->maxascii)
-                g = font->ascii2glyph[*s];
-            if (g >= 0)
-                res += font->glyph[g].advance / 20;
-            s++;
-        }
-        if (scale)
-            res = (res * scale) / 100;
-    }
-    return res;
-}
-
-SRECT swf_TextCalculateBBoxUTF8(SWFFONT * font, U8 * s, int scale)
-{
-    int xpos = 0;
-    int ypos = 0;
-    SRECT r;
-    swf_GetRect(0, &r);
-    while (*s) {
-        int c = readUTF8char(&s);
-        if(c==13 || c==10) {
-            if(s[0] == 10) {
-                s++;
-            }
-            xpos=0;
-            ypos+=font->layout->leading;
-            continue;
-        }
-        if (c < font->maxascii) {
-            int g = font->ascii2glyph[c];
-            if (g >= 0) {
-                SRECT rn = font->layout->bounds[g];
-                rn.xmin = (rn.xmin * scale) / 20 / 100 + xpos;
-                rn.xmax = (rn.xmax * scale) / 20 / 100 + xpos;
-                rn.ymin = (rn.ymin * scale) / 20 / 100 + ypos;
-                rn.ymax = (rn.ymax * scale) / 20 / 100 + ypos;
-                swf_ExpandRect2(&r, &rn);
-                xpos += (font->glyph[g].advance * scale) / 20 / 100;
-            }
-        }
-    }
-    return r;
-}
-
-void swf_FontCreateLayout(SWFFONT * f)
-{
-    //    S16 leading = 0;
-    int t;
-    if (f->layout)
-        return;
-    if (!f->numchars)
-        return;
-
-    f->layout = (SWFLAYOUT *) calloc(1, sizeof(SWFLAYOUT));
-    f->layout->bounds = (SRECT *) malloc(f->numchars * sizeof(SRECT));
-    f->layout->ascent = 0;
-    f->layout->descent = 0;
-
-    for (t = 0; t < f->numchars; t++) {
-        SHAPE2 *shape2;
-        SRECT bbox;
-        int width;
-        shape2 = swf_ShapeToShape2(f->glyph[t].shape);
-        if (!shape2) {
-            fprintf(stderr, "Shape parse error\n");
-            exit(1);
-        }
-        bbox = swf_GetShapeBoundingBox(shape2);
-        swf_Shape2Free(shape2);
-        f->layout->bounds[t] = bbox;
-
-        width = (bbox.xmax);
-
-        /* The following is a heuristic- it may be that extractfont_DefineText
-       has already found out some widths for individual characters (from the way
-       they are used)- we now have to guess whether that width might be possible,
-       which is the case if it isn't either much too big or much too small */
-        if (width > f->glyph[t].advance * 3 / 2 || width < f->glyph[t].advance / 2)
-            f->glyph[t].advance = width;
-
-        if (-bbox.ymin > f->layout->ascent)
-            f->layout->ascent = -bbox.ymin;
-        if (bbox.ymax > f->layout->descent)
-            f->layout->descent = bbox.ymax;
-    }
-}
-
-void swf_DrawText(drawer_t * draw, SWFFONT * font, int size, const char *text)
-{
-    U8 *s = (U8 *) text;
-    int advance = 0;
-    while (*s) {
-        SHAPE *shape;
-        SHAPE2 *shape2;
-        SHAPELINE *l;
-        U32 c = readUTF8char(&s);
-        int g = font->ascii2glyph[c];
-        shape = font->glyph[g].shape;
-        if (((int) g) < 0) {
-            fprintf(stderr, "No char %d in font %s\n", c, font->name ? (char *) font->name : "?");
-            continue;
-        }
-        shape2 = swf_ShapeToShape2(shape);
-        l = shape2->lines;
-        while (l) {
-            if (l->type == moveTo) {
-                FPOINT to;
-                to.x = l->x * size / 100.0 / 20.0 + advance;
-                to.y = l->y * size / 100.0 / 20.0;
-                draw->moveTo(draw, &to);
-            } else if (l->type == lineTo) {
-                FPOINT to;
-                to.x = l->x * size / 100.0 / 20.0 + advance;
-                to.y = l->y * size / 100.0 / 20.0;
-                draw->lineTo(draw, &to);
-            } else if (l->type == splineTo) {
-                FPOINT mid, to;
-                mid.x = l->sx * size / 100.0 / 20.0 + advance;
-                mid.y = l->sy * size / 100.0 / 20.0;
-                to.x = l->x * size / 100.0 / 20.0 + advance;
-                to.y = l->y * size / 100.0 / 20.0;
-                draw->splineTo(draw, &mid, &to);
-            }
-            l = l->next;
-        }
-        swf_Shape2Free(shape2);
-        advance += font->glyph[g].advance * size / 100.0 / 20.0;
-    }
-}


framework: fix spelling mistake (#7832)

framework: fix spelling mistake (#7832)


range: Implement gtk_range_calc_slider() properly

--- gtk/gtkrange.c
+++ gtk/gtkrange.c
@@ -3625,12 +3625,39 @@
     }
 }

+static gboolean
+rectangle_equal (const GdkRectangle *a,
+                 const GdkRectangle *b)
+{
+  return a->x == b->x
+      && a->y == b->y
+      && a->width == b->width
+      && a->height == b->height;
+}
+
 static void
 gtk_range_calc_slider (GtkRange *range)
 {
-  range->priv->need_recalc = TRUE;
-  gtk_range_calc_layout (range);
-  gtk_widget_queue_draw (GTK_WIDGET (range));
+  GtkRangePrivate *priv = range->priv;
+  GdkRectangle new_slider;
+
+  gtk_range_compute_slider_position (range,
+                                     gtk_adjustment_get_value (priv->adjustment),
+                                     &new_slider);
+
+  if (rectangle_equal (&priv->slider, &new_slider))
+    return;
+
+  gtk_range_queue_draw_location (range, MOUSE_SLIDER);
+
+  priv->slider = new_slider;
+
+  gtk_range_queue_draw_location (range, MOUSE_SLIDER);
+
+  if (priv->has_origin)
+    gtk_range_queue_draw_location (range, MOUSE_TROUGH);
+
+  gtk_range_update_mouse_location (range);
 }

 static void
@@ -3790,10 +3817,6 @@
       priv->trough.y = priv->stepper_b.y + priv->stepper_b.height + stepper_spacing * has_steppers_ab;
       priv->trough.width = range_rect.width;
       priv->trough.height = priv->stepper_c.y - priv->trough.y - stepper_spacing * has_steppers_cd;
-
-      gtk_range_compute_slider_position (range,
-                                         gtk_adjustment_get_value (priv->adjustment),
-                                         &priv->slider);
     }
   else
     {
@@ -3888,12 +3911,9 @@
       priv->trough.y = range_rect.y;
       priv->trough.width = priv->stepper_c.x - priv->trough.x - stepper_spacing * has_steppers_cd;
       priv->trough.height = range_rect.height;
-
-      gtk_range_compute_slider_position (range,
-                                         gtk_adjustment_get_value (priv->adjustment),
-                                         &priv->slider);
     }

+  gtk_range_calc_slider (range);
   gtk_range_update_mouse_location (range);

   switch (priv->upper_sensitivity)


Fix assertion.

Fix assertion.

Mon Jan 20 13:59:53 2003  Soeren Sandmann  <sandmann@daimi.au.dk>

        * gtk/gtktable.c (gtk_table_resize): Fix assertion.

--- gtk/gtktable.c
+++ gtk/gtktable.c
@@ -512,7 +512,7 @@
 {
   g_return_if_fail (GTK_IS_TABLE (table));
   g_return_if_fail (n_rows > 0 && n_rows < 65536);
-  g_return_if_fail (n_rows > 0 && n_cols < 65536);
+  g_return_if_fail (n_cols > 0 && n_cols < 65536);

   n_rows = MAX (n_rows, 1);
   n_cols = MAX (n_cols, 1);


adicionado: gerador de instancias do bobos lanches.

error: pathspec 'projeto_e_analise_de_algoritmos/TP6/gerador_instancias.c' did not match any file(s) known to git

--- projeto_e_analise_de_algoritmos/TP6/gerador_instancias.c
+++ projeto_e_analise_de_algoritmos/TP6/gerador_instancias.c
@@ -0,0 +1,40 @@
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+void gera_vetor(int, int);
+
+int main(int argc, char **argv) {
+
+	if (argc != 3) {
+		printf("Argumentos Inválidos...\nUtilize: %s <tamanho_vetor> <distancia>\n", argv[0]);
+		exit(EXIT_FAILURE);
+	}
+	int tamanho = atoi(argv[1]);
+	int distancia = atoi(argv[2]);
+
+	gera_vetor(tamanho, distancia);
+
+	return EXIT_SUCCESS;
+}
+
+void gera_vetor(int tamanho, int distancia) {
+	char end[100];
+	sprintf(end, "instancia_%d_%d.txt", tamanho, distancia);
+	FILE *arquivo = fopen(end, "w");
+	int i, aux=0;
+
+	srand(time(NULL));
+	fprintf(arquivo, "%d\n", tamanho);
+	fprintf(arquivo, "%d\n", distancia*2);
+
+	for (i=0; i<tamanho; i++) {
+		aux += (1+(rand()%distancia));
+		fprintf(arquivo, "%d\n", aux);
+	}
+
+	for (i=0; i<tamanho; i++)
+		fprintf(arquivo, "%d\n", tamanho+(rand()%distancia));
+
+	fclose(arquivo);
+}


bootloader: Don't unnecessarily test OTA app slots more than once per boot

Would loop more than once through each OTA possibility, but really only
needs to try each slot once.

--- components/bootloader/subproject/main/bootloader_start.c
+++ components/bootloader/subproject/main/bootloader_start.c
@@ -262,8 +262,8 @@
         return bs->test;
     }

-    if (index >= 0 && index < MAX_OTA_SLOTS) {
-        return bs->ota[index % bs->app_count];
+    if (index >= 0 && index < MAX_OTA_SLOTS && index < bs->app_count) {
+        return bs->ota[index];
     }

     esp_partition_pos_t invalid = { 0 };
@@ -272,15 +272,16 @@

 static void log_invalid_app_partition(int index)
 {
+    const char *not_bootable = " is not bootable"; /* save a few string literal bytes */
     switch(index) {
     case FACTORY_INDEX:
-        ESP_LOGE(TAG, "Factory app partition is not bootable");
+        ESP_LOGE(TAG, "Factory app partition%s", not_bootable);
         break;
     case TEST_APP_INDEX:
-        ESP_LOGE(TAG, "Factory test app partition is not bootable");
+        ESP_LOGE(TAG, "Factory test app partition%s", not_bootable);
         break;
     default:
-        ESP_LOGE(TAG, "OTA app partition slot %d is not bootable", index);
+        ESP_LOGE(TAG, "OTA app partition slot %d%s", index, not_bootable);
         break;
     }
 }
@@ -367,6 +368,8 @@
     return false;
 }

+#define TRY_LOG_FORMAT "Trying partition index %d offs 0x%x size 0x%x"
+
 /* Load the app for booting. Start from partition 'start_index', if not bootable then work backwards to FACTORY_INDEX
  * (ie try any OTA slots in descending order and then the factory partition).
  *
@@ -382,29 +385,29 @@
     esp_partition_pos_t part;

     /* work backwards from start_index, down to the factory app */
-    do {
-        ESP_LOGD(TAG, "Trying partition index %d...", index);
+    for(index = start_index; index >= FACTORY_INDEX; index--) {
         part = index_to_partition(bs, index);
-        ESP_LOGD(TAG, "part offs 0x%x size 0x%x", part.offset, part.size);
+        if (part.size == 0) {
+            continue;
+        }
+        ESP_LOGD(TAG, TRY_LOG_FORMAT, index, part.offset, part.size);
         if (try_load_partition(&part, result)) {
             return true;
         }
-        if (part.size > 0) {
-            log_invalid_app_partition(index);
-        }
-        index--;
-    } while(index >= FACTORY_INDEX);
+        log_invalid_app_partition(index);
+    }

     /* failing that work forwards from start_index, try valid OTA slots */
-    index = start_index + 1;
-    while (index < bs->app_count) {
-        ESP_LOGD(TAG, "Trying partition index %d...", index);
+    for(index = start_index + 1; index < bs->app_count; index++) {
         part = index_to_partition(bs, index);
+        if (part.size == 0) {
+            continue;
+        }
+        ESP_LOGD(TAG, TRY_LOG_FORMAT, index, part.offset, part.size);
         if (try_load_partition(&part, result)) {
             return true;
         }
         log_invalid_app_partition(index);
-        index++;
     }

     if (try_load_partition(&bs->test, result)) {


Handle ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET

https://bugzilla.gnome.org/show_bug.cgi?id=733773

--- gtk/gtkwin32.c
+++ gtk/gtkwin32.c
@@ -99,6 +99,7 @@
   ULONG_PTR activation_cookie;
   LPSTR resource_name;
   BOOL activated;
+  DWORD error_code;

   resource_name = NULL;
   EnumResourceNames (gtk_dll, RT_MANIFEST, find_first_manifest,
@@ -115,11 +116,13 @@
   activation_ctx_descriptor.hModule = gtk_dll;
   activation_ctx_descriptor.lpResourceName = resource_name;
   activation_ctx_handle = CreateActCtx (&activation_ctx_descriptor);
-
-  if (activation_ctx_handle == INVALID_HANDLE_VALUE)
+  error_code = GetLastError ();
+
+  if (activation_ctx_handle == INVALID_HANDLE_VALUE &&
+      error_code != ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET)
     g_warning ("Failed to CreateActCtx for module %p, resource %p: %lu\n",
                gtk_dll, resource_name, GetLastError ());
-  else
+  else if (error_code != ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET)
     {
       activation_cookie = 0;
       activated = ActivateActCtx (activation_ctx_handle, &activation_cookie);


Complete comment.

Complete comment.

--- drake/systems/framework/abstract_value.h
+++ drake/systems/framework/abstract_value.h
@@ -42,7 +42,7 @@
   }

  private:
-  // Throws
+  /// Throws an std::runtime_error if value is nullptr.
   template<typename T> void ThrowIfNullptr(const Value<T>* value) const {
     if (value == nullptr) {
       std::string error("Abstract value type was not ");


Cosmetic: Commentaries improved for dxJoint::getSureMaxInfo()

git-svn-id: 83d585846b3bb6dc23aa7649400c5e2e04e3d09e@1710 685f7672-210f-0410-90b4-fe3ad19314fe

--- ode/src/joints/joint.h
+++ ode/src/joints/joint.h
@@ -73,11 +73,6 @@
     // i.e. that is the total number of rows in the jacobian. `nub' is the
     // number of unbounded variables (which have lo,hi = -/+ infinity).

-    struct SureMaxInfo
-    {
-      int8 max_m; // Zero or estimate of maximal `m'
-    };
-
     struct Info1
     {
         // Structure size should not exceed sizeof(pointer) bytes to have
@@ -117,6 +112,24 @@
         int *findex;
     };

+    // info returned by getSureMaxInfo function.
+    // The information is used for memory reservation in calculations.
+
+    struct SureMaxInfo
+    {
+      // The value of `max_m' must ALWAYS be not less than the value of `m'
+      // the getInfo1 call can generate in current joint state. Another
+      // requirement is that the value should be provided very quickly,
+      // without the excessive calculations.
+      // If it is hard/impossible to quickly predict the maximal value of `m'
+      // (which is the case for most joint types) the maximum for current
+      // joint type in general should be returned. If it can be known the `m'
+      // will be smaller, it can save a bit of memory from being reserved
+      // for calculations if that smaller value is returned.
+
+      int8 max_m; // Estimate of maximal `m' in Info1
+    };
+

     unsigned flags;             // dJOINT_xxx flags
     dxJointNode node[2];        // connections to bodies. node[1].body can be 0
@@ -127,11 +140,11 @@
     dxJoint( dxWorld *w );
     virtual ~dxJoint();

-    // This quickly!!! estimate minimum (zero or not) and maximum value of "m" that could be returned by getInfo1()
-    virtual void getSureMaxInfo( SureMaxInfo* info ) = 0;
-
     virtual void getInfo1( Info1* info ) = 0;
     virtual void getInfo2( Info2* info ) = 0;
+    // This call quickly!!! estimates maximum value of "m" that could be returned by getInfo1()
+	// See comments at definition of SureMaxInfo for defails.
+    virtual void getSureMaxInfo( SureMaxInfo* info ) = 0;
     virtual dJointType type() const = 0;
     virtual size_t size() const = 0;


[SCSI] iscsi: convert iser to new set/get param fns

Convert iser to libiscsi get/set param functions.
Fix bugs in it returning old error return values and
have it expose exp_statsn.

Signed-off-by: Mike Christie <6fe105eefab41990d7ec714c6c25ade3095cdb48@cs.wisc.edu>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@SteelEye.com>

--- drivers/infiniband/ulp/iser/iscsi_iser.c
+++ drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -438,158 +438,49 @@
 }

 static int
-iscsi_iser_conn_set_param(struct iscsi_cls_conn *cls_conn,
-			  enum iscsi_param param, uint32_t value)
-{
-	struct iscsi_conn *conn = cls_conn->dd_data;
-	struct iscsi_session *session = conn->session;
-
-	spin_lock_bh(&session->lock);
-	if (conn->c_stage != ISCSI_CONN_INITIAL_STAGE &&
-	    conn->stop_stage != STOP_CONN_RECOVER) {
-		printk(KERN_ERR "iscsi_iser: can not change parameter [%d]\n",
-		       param);
-		spin_unlock_bh(&session->lock);
-		return 0;
-	}
-	spin_unlock_bh(&session->lock);
+iscsi_iser_set_param(struct iscsi_cls_conn *cls_conn,
+		     enum iscsi_param param, char *buf, int buflen)
+{
+	int value;

 	switch (param) {
 	case ISCSI_PARAM_MAX_RECV_DLENGTH:
 		/* TBD */
 		break;
-	case ISCSI_PARAM_MAX_XMIT_DLENGTH:
-		conn->max_xmit_dlength =  value;
-		break;
 	case ISCSI_PARAM_HDRDGST_EN:
+		sscanf(buf, "%d", &value);
 		if (value) {
 			printk(KERN_ERR "DataDigest wasn't negotiated to None");
 			return -EPROTO;
 		}
 		break;
 	case ISCSI_PARAM_DATADGST_EN:
+		sscanf(buf, "%d", &value);
 		if (value) {
 			printk(KERN_ERR "DataDigest wasn't negotiated to None");
 			return -EPROTO;
 		}
 		break;
-	case ISCSI_PARAM_INITIAL_R2T_EN:
-		session->initial_r2t_en = value;
-		break;
-	case ISCSI_PARAM_IMM_DATA_EN:
-		session->imm_data_en = value;
-		break;
-	case ISCSI_PARAM_FIRST_BURST:
-		session->first_burst = value;
-		break;
-	case ISCSI_PARAM_MAX_BURST:
-		session->max_burst = value;
-		break;
-	case ISCSI_PARAM_PDU_INORDER_EN:
-		session->pdu_inorder_en = value;
-		break;
-	case ISCSI_PARAM_DATASEQ_INORDER_EN:
-		session->dataseq_inorder_en = value;
-		break;
-	case ISCSI_PARAM_ERL:
-		session->erl = value;
-		break;
 	case ISCSI_PARAM_IFMARKER_EN:
+		sscanf(buf, "%d", &value);
 		if (value) {
 			printk(KERN_ERR "IFMarker wasn't negotiated to No");
 			return -EPROTO;
 		}
 		break;
 	case ISCSI_PARAM_OFMARKER_EN:
+		sscanf(buf, "%d", &value);
 		if (value) {
 			printk(KERN_ERR "OFMarker wasn't negotiated to No");
 			return -EPROTO;
 		}
 		break;
 	default:
-		break;
+		return iscsi_set_param(cls_conn, param, buf, buflen);
 	}

 	return 0;
 }
-
-static int
-iscsi_iser_session_get_param(struct iscsi_cls_session *cls_session,
-			     enum iscsi_param param, uint32_t *value)
-{
-	struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);
-	struct iscsi_session *session = iscsi_hostdata(shost->hostdata);
-
-	switch (param) {
-	case ISCSI_PARAM_INITIAL_R2T_EN:
-		*value = session->initial_r2t_en;
-		break;
-	case ISCSI_PARAM_MAX_R2T:
-		*value = session->max_r2t;
-		break;
-	case ISCSI_PARAM_IMM_DATA_EN:
-		*value = session->imm_data_en;
-		break;
-	case ISCSI_PARAM_FIRST_BURST:
-		*value = session->first_burst;
-		break;
-	case ISCSI_PARAM_MAX_BURST:
-		*value = session->max_burst;
-		break;
-	case ISCSI_PARAM_PDU_INORDER_EN:
-		*value = session->pdu_inorder_en;
-		break;
-	case ISCSI_PARAM_DATASEQ_INORDER_EN:
-		*value = session->dataseq_inorder_en;
-		break;
-	case ISCSI_PARAM_ERL:
-		*value = session->erl;
-		break;
-	case ISCSI_PARAM_IFMARKER_EN:
-		*value = 0;
-		break;
-	case ISCSI_PARAM_OFMARKER_EN:
-		*value = 0;
-		break;
-	default:
-		return ISCSI_ERR_PARAM_NOT_FOUND;
-	}
-
-	return 0;
-}
-
-static int
-iscsi_iser_conn_get_param(struct iscsi_cls_conn *cls_conn,
-			  enum iscsi_param param, uint32_t *value)
-{
-	struct iscsi_conn *conn = cls_conn->dd_data;
-
-	switch(param) {
-	case ISCSI_PARAM_MAX_RECV_DLENGTH:
-		*value = conn->max_recv_dlength;
-		break;
-	case ISCSI_PARAM_MAX_XMIT_DLENGTH:
-		*value = conn->max_xmit_dlength;
-		break;
-	case ISCSI_PARAM_HDRDGST_EN:
-		*value = 0;
-		break;
-	case ISCSI_PARAM_DATADGST_EN:
-		*value = 0;
-		break;
-	/*case ISCSI_PARAM_TARGET_RECV_DLENGTH:
-		*value = conn->target_recv_dlength;
-		break;
-	case ISCSI_PARAM_INITIATOR_RECV_DLENGTH:
-		*value = conn->initiator_recv_dlength;
-		break;*/
-	default:
-		return ISCSI_ERR_PARAM_NOT_FOUND;
-	}
-
-	return 0;
-}
-

 static void
 iscsi_iser_conn_get_stats(struct iscsi_cls_conn *cls_conn, struct iscsi_stats *stats)
@@ -702,7 +593,12 @@
 				  ISCSI_FIRST_BURST |
 				  ISCSI_MAX_BURST |
 				  ISCSI_PDU_INORDER_EN |
-				  ISCSI_DATASEQ_INORDER_EN,
+				  ISCSI_DATASEQ_INORDER_EN |
+				  ISCSI_EXP_STATSN |
+				  ISCSI_PERSISTENT_PORT |
+				  ISCSI_PERSISTENT_ADDRESS |
+				  ISCSI_TARGET_NAME |
+				  ISCSI_TPGT,
 	.host_template          = &iscsi_iser_sht,
 	.conndata_size		= sizeof(struct iscsi_conn),
 	.max_lun                = ISCSI_ISER_MAX_LUN,
@@ -714,9 +610,9 @@
 	.create_conn            = iscsi_iser_conn_create,
 	.bind_conn              = iscsi_iser_conn_bind,
 	.destroy_conn           = iscsi_iser_conn_destroy,
-	.set_param              = iscsi_iser_conn_set_param,
-	.get_conn_param		= iscsi_iser_conn_get_param,
-	.get_session_param	= iscsi_iser_session_get_param,
+	.set_param              = iscsi_iser_set_param,
+	.get_conn_param		= iscsi_conn_get_param,
+	.get_session_param	= iscsi_session_get_param,
 	.start_conn             = iscsi_iser_conn_start,
 	.stop_conn              = iscsi_conn_stop,
 	/* these are called as part of conn recovery */


better printout, removed constants

better printout, removed constants

--- odeSolver/printModel.c
+++ odeSolver/printModel.c
@@ -1,6 +1,6 @@
 /*
-  Last changed Time-stamp: <2005-11-03 12:02:17 raim>
-  $Id: printModel.c,v 1.6 2005/11/03 11:04:00 raimc Exp $
+  Last changed Time-stamp: <2005-11-03 12:07:18 raim>
+  $Id: printModel.c,v 1.7 2005/11/03 11:08:21 raimc Exp $
 */
 /*
  *
@@ -694,10 +694,13 @@
   results = data->results;
   om = data->model;
   fprintf(f, "#t ");
-  for(i=0;i<data->nvalues;i++) fprintf(f, "%s ", om->names[i]);
-
-  fprintf(f, "\n");
-  fprintf(f, "##CONCENTRATIONS\n");
+  for(i=0;i<(om->neq+om->nass);i++) fprintf(f, "%s ", om->names[i]);
+
+  fprintf(f, "\n");
+  if ( Opt.Sensitivity  && results->sensitivity != NULL )
+    fprintf(f, "##CONCENTRATIONS AND SENSITIVITIES\n");
+  else
+    fprintf(f, "##CONCENTRATIONS\n");

   for ( i=0; i<=results->nout; ++i ) {
     fprintf(f, "%g ", results->time[i]);
@@ -707,10 +710,10 @@
     for ( j=0; j<om->nass; j++ ) {
       fprintf(f, "%g ", results->value[om->neq+j][i]);
     }
-    for ( j=0; j<om->nconst; j++ ) {
-      fprintf(f, "%g ",
-	      results->value[om->neq+om->nass+j][i]);
-    }
+/*     for ( j=0; j<om->nconst; j++ ) { */
+/*       fprintf(f, "%g ", */
+/* 	      results->value[om->neq+om->nass+j][i]); */
+/*     } */
     if ( Opt.Sensitivity && results->sensitivity != NULL ) {
       fprintf(f, "\n");
       for ( k=0; k<om->nsens; k++ ) {
@@ -723,9 +726,12 @@
     }
     fprintf(f, "\n");
   }
-  fprintf(f, "##CONCENTRATIONS\n");
+  if ( Opt.Sensitivity  && results->sensitivity != NULL )
+    fprintf(f, "##CONCENTRATIONS AND SENSITIVITIES\n");
+  else
+    fprintf(f, "##CONCENTRATIONS\n");
   fprintf(f, "#t ");
-  for(i=0;i<data->nvalues;i++) fprintf(f, "%s ", om->names[i]);
+  for(i=0;i<(om->neq+om->nass);i++) fprintf(f, "%s ", om->names[i]);
   fprintf(f, "\n\n");

   fflush(f);


Note on SPI peripheral hang

Note on SPI peripheral hang

--- content/OTRadioLink/utility/OTV0P2BASE_PowerManagement.h
+++ content/OTRadioLink/utility/OTV0P2BASE_PowerManagement.h
@@ -113,6 +113,9 @@
     // If already powered up then do nothing other than return false.
     // If this returns true then a matching powerDownSPI() may be advisable.
     // The optional slowSPI flag, if true, attempts to run the bus slow, eg for when long or loaded with LED on SCK.
+    //
+    // NOTE: If a matching powerDownSPI() has not already been called before
+    // this routine, the SPI peripheral will hang on initiating a transfer.
     template <uint8_t SPI_nSS, bool slowSPI>
     bool t_powerUpSPIIfDisabled()
         {


ixgbe: Cleanup holes in flags after removing several of them

This change is just meant to defragment the flags as there are several hole
that have been introduced since several features, or the flags for them,
have been removed.

Signed-off-by: Alexander Duyck <af56634f9be8457194a3461ec96c497f138af4ff@intel.com>
Tested-by: Phil Schmitt <e59a1cb13110d2d5848864a809262db69840c26d@intel.com>
Signed-off-by: Jeff Kirsher <87e35f5be20bb3e67f4ba6b86f5f6be3085b1b3a@intel.com>

--- drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -433,33 +433,33 @@
 	 * thus the additional *_CAPABLE flags.
 	 */
 	u32 flags;
-#define IXGBE_FLAG_MSI_CAPABLE                  (u32)(1 << 1)
-#define IXGBE_FLAG_MSI_ENABLED                  (u32)(1 << 2)
-#define IXGBE_FLAG_MSIX_CAPABLE                 (u32)(1 << 3)
-#define IXGBE_FLAG_MSIX_ENABLED                 (u32)(1 << 4)
-#define IXGBE_FLAG_RX_1BUF_CAPABLE              (u32)(1 << 6)
-#define IXGBE_FLAG_RX_PS_CAPABLE                (u32)(1 << 7)
-#define IXGBE_FLAG_RX_PS_ENABLED                (u32)(1 << 8)
-#define IXGBE_FLAG_IN_NETPOLL                   (u32)(1 << 9)
-#define IXGBE_FLAG_DCA_ENABLED                  (u32)(1 << 10)
-#define IXGBE_FLAG_DCA_CAPABLE                  (u32)(1 << 11)
-#define IXGBE_FLAG_IMIR_ENABLED                 (u32)(1 << 12)
-#define IXGBE_FLAG_MQ_CAPABLE                   (u32)(1 << 13)
-#define IXGBE_FLAG_DCB_ENABLED                  (u32)(1 << 14)
-#define IXGBE_FLAG_VMDQ_CAPABLE                 (u32)(1 << 18)
-#define IXGBE_FLAG_VMDQ_ENABLED                 (u32)(1 << 19)
-#define IXGBE_FLAG_FAN_FAIL_CAPABLE             (u32)(1 << 20)
-#define IXGBE_FLAG_NEED_LINK_UPDATE             (u32)(1 << 22)
-#define IXGBE_FLAG_NEED_LINK_CONFIG             (u32)(1 << 23)
-#define IXGBE_FLAG_FDIR_HASH_CAPABLE            (u32)(1 << 24)
-#define IXGBE_FLAG_FDIR_PERFECT_CAPABLE         (u32)(1 << 25)
-#define IXGBE_FLAG_FCOE_CAPABLE                 (u32)(1 << 26)
-#define IXGBE_FLAG_FCOE_ENABLED                 (u32)(1 << 27)
-#define IXGBE_FLAG_SRIOV_CAPABLE                (u32)(1 << 28)
-#define IXGBE_FLAG_SRIOV_ENABLED                (u32)(1 << 29)
+#define IXGBE_FLAG_MSI_CAPABLE                  (u32)(1 << 0)
+#define IXGBE_FLAG_MSI_ENABLED                  (u32)(1 << 1)
+#define IXGBE_FLAG_MSIX_CAPABLE                 (u32)(1 << 2)
+#define IXGBE_FLAG_MSIX_ENABLED                 (u32)(1 << 3)
+#define IXGBE_FLAG_RX_1BUF_CAPABLE              (u32)(1 << 4)
+#define IXGBE_FLAG_RX_PS_CAPABLE                (u32)(1 << 5)
+#define IXGBE_FLAG_RX_PS_ENABLED                (u32)(1 << 6)
+#define IXGBE_FLAG_IN_NETPOLL                   (u32)(1 << 7)
+#define IXGBE_FLAG_DCA_ENABLED                  (u32)(1 << 8)
+#define IXGBE_FLAG_DCA_CAPABLE                  (u32)(1 << 9)
+#define IXGBE_FLAG_IMIR_ENABLED                 (u32)(1 << 10)
+#define IXGBE_FLAG_MQ_CAPABLE                   (u32)(1 << 11)
+#define IXGBE_FLAG_DCB_ENABLED                  (u32)(1 << 12)
+#define IXGBE_FLAG_VMDQ_CAPABLE                 (u32)(1 << 13)
+#define IXGBE_FLAG_VMDQ_ENABLED                 (u32)(1 << 14)
+#define IXGBE_FLAG_FAN_FAIL_CAPABLE             (u32)(1 << 15)
+#define IXGBE_FLAG_NEED_LINK_UPDATE             (u32)(1 << 16)
+#define IXGBE_FLAG_NEED_LINK_CONFIG             (u32)(1 << 17)
+#define IXGBE_FLAG_FDIR_HASH_CAPABLE            (u32)(1 << 18)
+#define IXGBE_FLAG_FDIR_PERFECT_CAPABLE         (u32)(1 << 19)
+#define IXGBE_FLAG_FCOE_CAPABLE                 (u32)(1 << 20)
+#define IXGBE_FLAG_FCOE_ENABLED                 (u32)(1 << 21)
+#define IXGBE_FLAG_SRIOV_CAPABLE                (u32)(1 << 22)
+#define IXGBE_FLAG_SRIOV_ENABLED                (u32)(1 << 23)

 	u32 flags2;
-#define IXGBE_FLAG2_RSC_CAPABLE                 (u32)(1)
+#define IXGBE_FLAG2_RSC_CAPABLE                 (u32)(1 << 0)
 #define IXGBE_FLAG2_RSC_ENABLED                 (u32)(1 << 1)
 #define IXGBE_FLAG2_TEMP_SENSOR_CAPABLE         (u32)(1 << 2)
 #define IXGBE_FLAG2_TEMP_SENSOR_EVENT           (u32)(1 << 3)


staging: android: persistent_ram: Prepare for modular builds

This is a transition patch to keep things bisectable, just moves
some routines under '#ifndef MODULE'. The code inside the #ifndef
will go away soon, but so far we must support pstore and ram_console.

So, we are about to use persistent_ram with pstore, with the ability
to compile persistent_ram routines as modules. Some parts of
persistent_ram uses memblock_reserve() routine, which is should be
only used built-in code, and thus it is not exported.

These persistent_ram bits are only used by Android's ram_console,
which is always built-in.

Without this patch, we won't able to compile persistent_ram as a
module:

ERROR: "memblock_reserve" [fs/pstore/ramoops.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

(As alternative, we could export memblock_reserve, but the thing
is: we won't need it later.)

Signed-off-by: Anton Vorontsov <1aae5ab9541d66245293c8fc1b9880f5df073631@linaro.org>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/android/persistent_ram.c
+++ drivers/staging/android/persistent_ram.c
@@ -384,28 +384,6 @@
 	return 0;
 }

-static int __init persistent_ram_buffer_init(const char *name,
-		struct persistent_ram_zone *prz)
-{
-	int i;
-	struct persistent_ram *ram;
-	struct persistent_ram_descriptor *desc;
-	phys_addr_t start;
-
-	list_for_each_entry(ram, &persistent_ram_list, node) {
-		start = ram->start;
-		for (i = 0; i < ram->num_descs; i++) {
-			desc = &ram->descs[i];
-			if (!strcmp(desc->name, name))
-				return persistent_ram_buffer_map(start,
-						desc->size, prz);
-			start += desc->size;
-		}
-	}
-
-	return -EINVAL;
-}
-
 static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool ecc)
 {
 	int ret;
@@ -478,6 +456,29 @@
 	return ERR_PTR(ret);
 }

+#ifndef MODULE
+static int __init persistent_ram_buffer_init(const char *name,
+		struct persistent_ram_zone *prz)
+{
+	int i;
+	struct persistent_ram *ram;
+	struct persistent_ram_descriptor *desc;
+	phys_addr_t start;
+
+	list_for_each_entry(ram, &persistent_ram_list, node) {
+		start = ram->start;
+		for (i = 0; i < ram->num_descs; i++) {
+			desc = &ram->descs[i];
+			if (!strcmp(desc->name, name))
+				return persistent_ram_buffer_map(start,
+						desc->size, prz);
+			start += desc->size;
+		}
+	}
+
+	return -EINVAL;
+}
+
 static  __init
 struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc)
 {
@@ -528,3 +529,4 @@

 	return 0;
 }
+#endif


Fix: trunk/UiModule/Ether/View/EtherMenu.h(64): Warning: Signals cannot be declared virtual

git-svn-id: 65dd0ccd495961f396d5302e5521154b071f0302@2557 5b2332b8-efa3-11de-8684-7d64432d61a3

--- UiModule/Ether/View/EtherMenu.h
+++ UiModule/Ether/View/EtherMenu.h
@@ -20,17 +20,24 @@
         //! note that this class is NOT responsible of deleting the QGraphicsobjects it animates
         class EtherMenu : public QObject
         {
-
-        Q_OBJECT
-        Q_PROPERTY(qreal scale_factor READ GetScaleFactor WRITE SetScaleFactor)
+            Q_OBJECT
+            Q_PROPERTY(qreal scale_factor READ GetScaleFactor WRITE SetScaleFactor)

         public:
             //! Type of EtherMenu is either ELLIPSE_OPENS_UP, ELLIPSE_OPENS_DOWN, LINEAR_TOP, LINEAR_MID, LINEAR_BOTTOM
             EtherMenu();
             virtual ~EtherMenu();

-            //! Initializes the menu with given bounds, items that menu has, maximum size of the biggest item, scalefactor (how much scale down when item is more far away from being first) and number of objects visible in menu
-            virtual void Initialize(const QRectF& bounds, const QVector<InfoCard *>& items, const QRectF& max_size, qreal scalef, int visible_objects=5, qreal opacity_factor=0, qreal max_gap=0);
+            //! Initializes the menu with given bounds, items that menu has, maximum size of the biggest item,
+            //! scalefactor (how much scale down when item is more far away from being first) and number of objects visible in menu
+            virtual void Initialize(
+                const QRectF& bounds,
+                const QVector<InfoCard *>& items,
+                const QRectF& max_size,
+                qreal scalef,
+                int visible_objects=5,
+                qreal opacity_factor=0,
+                qreal max_gap=0);

             //! Set new focus item to center
             virtual void SetFocusToCard(InfoCard *card);
@@ -41,20 +48,20 @@
             virtual InfoCard *GetHighlighted();

             //! Returns the position of current index 0 (selected) item
-            virtual QPointF GetHightlightScenePos() { if (positions_.count() > 0) return positions_.at(0); else return QPointF(); }
+            virtual QPointF GetHightlightScenePos() const { if (positions_.count() > 0) return positions_.at(0); else return QPointF(); }

-			virtual void moveRight();
+            virtual void moveRight();

             virtual void moveLeft();

             virtual void SetScaleFactor(qreal sfactor){ scale_factor_ = sfactor; }

-            virtual qreal GetScaleFactor(){return scale_factor_;}
+            virtual qreal GetScaleFactor() const { return scale_factor_;}

-            virtual QVector<InfoCard *> GetObjects() { return objects_; }
+            virtual QVector<InfoCard *> GetObjects() const { return objects_; }

         signals:
-            virtual void ItemHighlighted(View::InfoCard*);
+            void ItemHighlighted(View::InfoCard*);

         protected:
             virtual void CalculateGap();
@@ -63,7 +70,6 @@
             virtual void ZOrderObjectBasedOnPriority(int index, int priority, bool animated);
             virtual void ChangeObjectOpacityBasedOnPriority(int index,int priority);
             virtual void AssignObjectsToStates();
-

             //! Differs from AssignObjectsToStates() function so that this
             //! version does not animate some stages (like z buffer)
@@ -115,7 +121,8 @@
             //! Determines the right limit. Meaning that the indexes right of this one on priority list are not visible
             int right_visible_limit_index_;

-            //! Opacity factor is used to scale cards transparency depending on the priority. 0 means that all the cards are completely opaque. 1 means that only highlighted card is opaque, rest of the cards are fully transparent.
+            //! Opacity factor is used to scale cards transparency depending on the priority. 0 means that all the cards are completely opaque.
+            //! 1 means that only highlighted card is opaque, rest of the cards are fully transparent.
             //! values between 1-0 increase transparenct when priority decreases.
             qreal opacity_factor_;

@@ -125,7 +132,6 @@
             qreal visible_;
             qreal invisible_;

-
             qreal current_gap_;
             qreal max_gap_;
         };


staging: brcm80211 dhd.h Remove CONFIG_HAS_WAKELOCK

Note:not sure if there is already something like this submitted or not.

The first two patches removes CONFIG_HAS_WAKELOCK since it is no longer in the kernel.
Please let me know, if this is the proper way of doing this and/or more needs
to be done..

Signed-off-by: Justin P. Mattock <9b32cf9e71573b2493f4d4937b5402d21e9eae9d@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/staging/brcm80211/brcmfmac/dhd.h
+++ drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -33,9 +33,6 @@
 #include <linux/ethtool.h>
 #include <asm/uaccess.h>
 #include <asm/unaligned.h>
-#if defined(CONFIG_HAS_WAKELOCK)
-#include <linux/wakelock.h>
-#endif			/* defined (CONFIG_HAS_WAKELOCK) */
 /* The kernel threading is sdio-specific */

 #include <wlioctl.h>
@@ -145,9 +142,6 @@
 	u8 country_code[WLC_CNTRY_BUF_SZ];
 	char eventmask[WL_EVENTING_MASK_LEN];

-#if defined(CONFIG_HAS_WAKELOCK)
-	struct wake_lock wakelock[WAKE_LOCK_MAX];
-#endif		/*  defined (CONFIG_HAS_WAKELOCK) */
 } dhd_pub_t;

 #if defined(CONFIG_PM_SLEEP)
@@ -228,41 +222,6 @@

 static inline void MUTEX_UNLOCK_WL_SCAN_SET(void)
 {
-}
-
-static inline void WAKE_LOCK_INIT(dhd_pub_t *dhdp, int index, char *y)
-{
-#if defined(CONFIG_HAS_WAKELOCK)
-	wake_lock_init(&dhdp->wakelock[index], WAKE_LOCK_SUSPEND, y);
-#endif	/* defined (CONFIG_HAS_WAKELOCK) */
-}
-
-static inline void WAKE_LOCK(dhd_pub_t *dhdp, int index)
-{
-#if defined(CONFIG_HAS_WAKELOCK)
-	wake_lock(&dhdp->wakelock[index]);
-#endif	/* defined (CONFIG_HAS_WAKELOCK) */
-}
-
-static inline void WAKE_UNLOCK(dhd_pub_t *dhdp, int index)
-{
-#if defined(CONFIG_HAS_WAKELOCK)
-	wake_unlock(&dhdp->wakelock[index]);
-#endif	/* defined (CONFIG_HAS_WAKELOCK) */
-}
-
-static inline void WAKE_LOCK_TIMEOUT(dhd_pub_t *dhdp, int index, long time)
-{
-#if defined(CONFIG_HAS_WAKELOCK)
-	wake_lock_timeout(&dhdp->wakelock[index], time);
-#endif	/* defined (CONFIG_HAS_WAKELOCK) */
-}
-
-static inline void WAKE_LOCK_DESTROY(dhd_pub_t *dhdp, int index)
-{
-#if defined(CONFIG_HAS_WAKELOCK)
-	wake_lock_destroy(&dhdp->wakelock[index]);
-#endif /* defined (CONFIG_HAS_WAKELOCK) */
 }

 typedef struct dhd_if_event {


Fix misspelling and pml4e_fields_u.raw should be ac_u64.

--- arch/x86/libs/page_table_x86/incs/page_table_x86.h
+++ arch/x86/libs/page_table_x86/incs/page_table_x86.h
@@ -144,7 +144,7 @@
   ac_u64 p:1;                   // Present
   ac_u64 rw:1;                  // Read write
   ac_u64 us:1;                  // User/Supervisor
-  ac_u64 pwt:1;                 // Page-level write-throug
+  ac_u64 pwt:1;                 // Page-level write-through
   ac_u64 pcd:1;                 // Page-level cache disable
   ac_u64 a:1;                   // Accessed
   ac_u64 reserved_0:6;
@@ -156,7 +156,7 @@
     L"pml4e_fields is not " AC_XSTR(PML4E_FIELDS_SIZE) " bytes");

 union pml4e_fields_u {
-  ac_uint raw;
+  ac_u64 raw;
   struct pml4e_fields fields;
 };

@@ -175,7 +175,7 @@
   ac_u64 p:1;                   // Present
   ac_u64 rw:1;                  // Read write
   ac_u64 us:1;                  // User/Supervisor
-  ac_u64 pwt:1;                 // Page-level write-throug
+  ac_u64 pwt:1;                 // Page-level write-through
   ac_u64 pcd:1;                 // Page-level cache disable
   ac_u64 a:1;                   // Accessed
   ac_u64 d:1;                   // Dirty
@@ -204,7 +204,7 @@
   ac_u64 p:1;                   // Present
   ac_u64 rw:1;                  // Read write
   ac_u64 us:1;                  // User/Supervisor
-  ac_u64 pwt:1;                 // Page-level write-throug
+  ac_u64 pwt:1;                 // Page-level write-through
   ac_u64 pcd:1;                 // Page-level cache disable
   ac_u64 a:1;                   // Accessed
   ac_u64 reserved_0:6;
@@ -236,7 +236,7 @@
   ac_u64 p:1;                   // Present
   ac_u64 rw:1;                  // Read write
   ac_u64 us:1;                  // User/Supervisor
-  ac_u64 pwt:1;                 // Page-level write-throug
+  ac_u64 pwt:1;                 // Page-level write-through
   ac_u64 pcd:1;                 // Page-level cache disable
   ac_u64 a:1;                   // Accessed
   ac_u64 d:1;                   // Dirty
@@ -265,7 +265,7 @@
   ac_u64 p:1;                   // Present
   ac_u64 rw:1;                  // Read write
   ac_u64 us:1;                  // User/Supervisor
-  ac_u64 pwt:1;                 // Page-level write-throug
+  ac_u64 pwt:1;                 // Page-level write-through
   ac_u64 pcd:1;                 // Page-level cache disable
   ac_u64 a:1;                   // Accessed
   ac_u64 reserved_0:6;
@@ -297,7 +297,7 @@
   ac_u64 p:1;                   // Present
   ac_u64 rw:1;                  // Read write
   ac_u64 us:1;                  // User/Supervisor
-  ac_u64 pwt:1;                 // Page-level write-throug
+  ac_u64 pwt:1;                 // Page-level write-through
   ac_u64 pcd:1;                 // Page-level cache disable
   ac_u64 a:1;                   // Accessed
   ac_u64 d:1;                   // Dirty


remove isnormal from scope which is actually not doing what I expected

--- opencog/util/numeric.h
+++ opencog/util/numeric.h
@@ -58,7 +58,6 @@
 using boost::math::isnan;
 using boost::math::isfinite;
 using boost::math::isinf;
-using boost::math::isnormal;

 #ifndef WIN32
 // This needs to be changed for non-gcc. Note however that so far it


staging: comedi: ni_65xx: hook up command support only if irq is available

Subdevice 3 is used in this driver to provide edge detection of the input
channels.

Move the reset/disable of the interrupts and the request_irq() so that
when subdevice 3 is setup we can conditionally hookup the async command
support only if the irq is available.

Also, remove the noise when the irq is not available.

Signed-off-by: H Hartley Sweeten <382ff55d8e07d1082d179e669636cd1552da4f36@visionengravers.com>
Reviewed-by: Ian Abbott <9e6ba6483b6a3e14d61f7c987e72ecb5b46122d6@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/comedi/drivers/ni_65xx.c
+++ drivers/staging/comedi/drivers/ni_65xx.c
@@ -582,7 +582,17 @@
 	if (!devpriv->mmio)
 		return -ENOMEM;

-	dev->irq = pcidev->irq;
+	writeb(NI_65XX_CLR_EDGE_INT | NI_65XX_CLR_OVERFLOW_INT,
+	       devpriv->mmio + NI_65XX_CLR_REG);
+	writeb(0x00, devpriv->mmio + NI_65XX_CTRL_REG);
+
+	if (pcidev->irq) {
+		ret = request_irq(pcidev->irq, ni_65xx_interrupt, IRQF_SHARED,
+				  dev->board_name, dev);
+		if (ret == 0)
+			dev->irq = pcidev->irq;
+	}
+
 	dev_info(dev->class_dev, "board: %s, ID=0x%02x", dev->board_name,
 	       readb(devpriv->mmio + NI_65XX_ID_REG));

@@ -647,18 +657,21 @@
 	}

 	s = &dev->subdevices[3];
-	dev->read_subdev = s;
-	s->type = COMEDI_SUBD_DI;
-	s->subdev_flags = SDF_READABLE | SDF_CMD_READ;
-	s->n_chan = 1;
-	s->range_table = &range_unknown;
-	s->maxdata = 1;
-	s->len_chanlist	= 1;
-	s->do_cmdtest = ni_65xx_intr_cmdtest;
-	s->do_cmd = ni_65xx_intr_cmd;
-	s->cancel = ni_65xx_intr_cancel;
-	s->insn_bits = ni_65xx_intr_insn_bits;
-	s->insn_config = ni_65xx_intr_insn_config;
+	s->type		= COMEDI_SUBD_DI;
+	s->subdev_flags	= SDF_READABLE;
+	s->n_chan	= 1;
+	s->maxdata	= 1;
+	s->range_table	= &range_digital;
+	s->insn_bits	= ni_65xx_intr_insn_bits;
+	if (dev->irq) {
+		dev->read_subdev = s;
+		s->subdev_flags	|= SDF_CMD_READ;
+		s->len_chanlist	= 1;
+		s->insn_config	= ni_65xx_intr_insn_config;
+		s->do_cmdtest	= ni_65xx_intr_cmdtest;
+		s->do_cmd	= ni_65xx_intr_cmd;
+		s->cancel	= ni_65xx_intr_cancel;
+	}

 	for (i = 0; i < ni_65xx_total_num_ports(board); ++i) {
 		writeb(0x00, devpriv->mmio + NI_65XX_FILTER_ENA(i));
@@ -667,19 +680,9 @@
 		else
 			writeb(0x00, devpriv->mmio + NI_65XX_IO_DATA_REG(i));
 	}
-	writeb(NI_65XX_CLR_EDGE_INT | NI_65XX_CLR_OVERFLOW_INT,
-	       devpriv->mmio + NI_65XX_CLR_REG);
-	writeb(0x00, devpriv->mmio + NI_65XX_CTRL_REG);

 	/* Set filter interval to 0  (32bit reg) */
 	writel(0x00000000, devpriv->mmio + NI_65XX_FILTER_REG);
-
-	ret = request_irq(dev->irq, ni_65xx_interrupt, IRQF_SHARED,
-			  "ni_65xx", dev);
-	if (ret < 0) {
-		dev->irq = 0;
-		dev_warn(dev->class_dev, "irq not available\n");
-	}

 	return 0;
 }


Fix alignment in teams-reduction.c test

Fix alignment in teams-reduction.c test

The runtime will use the global kmp_critical_name as a lock and
tries to atomically store a pointer in there. This will fail
if the global is only aligned by 4 bytes, the size of one int32_t
element. Use a union to ensure the global is aligned to the size
of a pointer on the current platform.

git-svn-id: f99161ee8ccfe2101cbe1bdda2220bce2ed25485@319811 91177308-0d34-0410-b5e6-96231b3b80d8

--- runtime/test/misc_bugs/teams-reduction.c
+++ runtime/test/misc_bugs/teams-reduction.c
@@ -30,7 +30,12 @@

 static ident_t dummy_loc = {0, 2, 0, 0, ";dummyFile;dummyFunc;0;0;;"};

-typedef int32_t kmp_critical_name[8];
+typedef union {
+  // The global will be used as pointer, so we need to make sure that the
+  // compiler correctly aligns the global...
+  void *ptr;
+  int32_t data[8];
+} kmp_critical_name;
 kmp_critical_name crit;

 int32_t __kmpc_global_thread_num(ident_t *);


src/bundle: perform keyring check earlier

If we want to verify, but have no keyring, we can abort early.

Signed-off-by: Jan Luebbe <3a82f1ac4ad59607a20f180f1c67ac8ba31ad0d5@pengutronix.de>

--- src/bundle.c
+++ src/bundle.c
@@ -1399,6 +1399,12 @@

 	r_context_begin_step("check_bundle", "Checking bundle", verify);

+	if (verify && !r_context()->config->keyring_path && !r_context()->config->keyring_directory) {
+		g_set_error(error, R_BUNDLE_ERROR, R_BUNDLE_ERROR_KEYRING, "No keyring file or directory provided");
+		res = FALSE;
+		goto out;
+	}
+
 	ibundle->verification_disabled = !verify;

 	/* Download Bundle to temporary location if remote URI is given */
@@ -1435,12 +1441,6 @@
 		} else {
 			ibundle->storepath = g_strconcat(path, ".castr", NULL);
 		}
-	}
-
-	if (verify && !r_context()->config->keyring_path && !r_context()->config->keyring_directory) {
-		g_set_error(error, R_BUNDLE_ERROR, R_BUNDLE_ERROR_KEYRING, "No keyring file or directory provided");
-		res = FALSE;
-		goto out;
 	}

 	g_message("Reading bundle: %s", ibundle->path);


Staging: rtl8723au: rtw_cmd: Replace foo*bar to foo *bar

Fixed the checkpatch.pl ERROR: "foo*bar" should be "foo *bar"

Signed-off-by: anuvazhayil <84327b8d5656135d4b7344a502403cb37f743b02@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>