Postorder now properly computes depth for all directory paths given.

--- duvis.c
+++ duvis.c
@@ -223,7 +223,11 @@

     // Prepare for calculation
     struct entry *e = &entries[start];
-
+    uint32_t depth = e->n_components - 1;
+
+    e->depth = depth;
+    printf("e is: %s with depth: %d\n", e->components[depth], depth);
+
     /*
      * Need to allocate memory for children but not currently
      * sure how to accomplish this when coming from the other
@@ -231,17 +235,23 @@
      */

     //int n_children = 0;
-    int i = start + 1;
+    uint32_t i = start + 1;
     uint32_t offset = 0;

     while (i < end) {
-	int j = i + 1;
+	uint32_t j = i + 1;
+
+	// Correct the depth for the ith entry
+	if(entries[i].n_components == 1)
+	    entries[i].depth = 0;
+	else
+	    entries[i].depth = entries[i].n_components - 1;

 	// Create a new function for finding the correct offset index
 	if(entries[i].n_components < entries[j].n_components)
 		offset = entries[i].n_components - 1;
 	else if(entries[i].n_components == entries[j].n_components)
-		offset = entries[j].n_components - 1;
+	    	offset = entries[j].n_components - 1;
 	else if(entries[i].n_components > entries[j].n_components)
 		offset = entries[j].n_components - 1;

@@ -315,10 +325,6 @@
         perror("malloc");
         exit(1);
     }
-
-	printf("Start: %d\n", start);
-	printf("End: %d\n", end);
-	printf("Offset: %d\n", offset);

     /* Pass 2: Fill direct children and build subtrees. */
     int n_children = 0;
@@ -369,6 +375,18 @@
         show_entries(e->children[i]);
 }

+void showEntriesNew(struct entry e[], int n) {
+    uint32_t depth = 0;
+
+    for(uint32_t i = 0; i < n; i++)
+    {
+	depth = e[i].depth;
+	indent(depth);
+
+	printf("%s %"PRIu64"\n", e[i].components[depth], e[i].size);
+    }
+}
+
 void status(char *msg) {
     static int pass = 1;
     fprintf(stderr, "(%d) %s\n", pass++, msg);
@@ -426,7 +444,7 @@
         return 0;

     status("Displaying diagnostic information.");
-    dispEntries(entries, n_entries);
+    //dispEntries(entries, n_entries);
     //dispEntryDetail(entries, n_entries);

     status("Sorting entries.");
@@ -444,10 +462,11 @@
     build_tree_postorder(0, n_entries);

     status("After build_tree_preorder.");
-    dispEntryDetail(entries, n_entries);
+    //dispEntryDetail(entries, n_entries);

     status("Rendering tree.");
-    show_entries(&entries[0]);
+    //show_entries(&entries[0]);
+    showEntriesNew(entries, n_entries);

     return(0);
 }


Got rid of hcp_io_get_hwaddr once more.

Got rid of hcp_io_get_hwaddr once more.

--- src/hcp_io.c
+++ src/hcp_io.c
@@ -6,8 +6,8 @@
  * Copyright (c) 2013 cisco Systems, Inc.
  *
  * Created:       Mon Nov 25 14:00:10 2013 mstenber
- * Last modified: Tue Dec  3 15:20:35 2013 mstenber
- * Edit time:     191 min
+ * Last modified: Tue Dec  3 15:34:39 2013 mstenber
+ * Edit time:     197 min
  *
  */

@@ -34,6 +34,7 @@

 #ifdef __linux__
 #define AF_LINK AF_PACKET
+#include <linux/if_packet.h>
 #endif /* __linux__ */

 const char *hex_repr(char *buf, void *data, int len)
@@ -49,31 +50,6 @@
   return r;
 }
 #define HEX_REPR(buf, len) hex_repr(alloca((len) * 2 + 1), buf, len)
-
-#ifdef __linux__
-
-/* 'found' from odhcp6c */
-int
-hcp_io_get_hwaddr(const char *ifname, unsigned char *buf, int buf_left)
-{
-  struct ifreq ifr;
-  int sock;
-  int tocopy = buf_left < ETHER_ADDR_LEN ? buf_left : ETHER_ADDR_LEN;
-
-  sock = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
-  if (sock<0)
-    return 0;
-  strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
-  if (ioctl(sock, SIOCGIFINDEX, &ifr))
-    return 0;
-  if (ioctl(sock, SIOCGIFHWADDR, &ifr))
-    return 0;
-  memcpy(buf, ifr.ifr_hwaddr.sa_data, tocopy);
-  close(sock);
-  return tocopy;
-}
-
-#endif /* __linux__ */

 int
 hcp_io_get_hwaddrs(unsigned char *buf, int buf_left)
@@ -94,12 +70,8 @@
     {
       void *a = &p->ifa_addr->sa_data[0];
 #ifdef __linux__
-      unsigned char tbuf[ETHER_ADDR_LEN];
-
-      memset(tbuf, 0, sizeof(tbuf));
-      if (!hcp_io_get_hwaddr(p->ifa_name, tbuf, ETHER_ADDR_LEN))
-        continue;
-      a = tbuf;
+      struct sockaddr_ll *sll = (struct sockaddr_ll *) p->ifa_addr;
+      a = sll->sll_addr;
 #endif /* __linux__ */
       if (memcmp(a, zeroed_addr, sizeof(zeroed_addr)) == 0)
         continue;


Rearrange functions

Rearrange functions

--- src/helper.h
+++ src/helper.h
@@ -25,25 +25,6 @@
     if (sv_isobject(arg) && (SvTYPE(SvRV(arg)) == SVt_PVMG)) {
         return (void *)SvIV((SV *)SvRV(arg));
     }
-}
-
-SV *cpPli_body_to_sv(SV *arg, cpBody *obj, const char *classname)
-{
-    if (obj) {
-        SV *var = (SV *)cpBodyGetUserData(obj);
-        if (var == NULL) {
-            var = newSV(0);
-            sv_setref_pv(var, classname, (void *)obj);
-            cpBodySetUserData(obj, (cpDataPointer)var);
-        } else {
-            SvREFCNT_inc(var);
-        }
-        SvSetSV(arg, var);
-    } else {
-        sv_setsv(arg, &PL_sv_undef);
-    }
-
-    return arg;
 }

 cpVect cpPli_sv_to_vect(SV *arg)
@@ -119,11 +100,23 @@
     return newRV_inc((SV *)output);
 }

-void cpPli_body_refcnt_dec(cpBody *obj)
+SV *cpPli_body_to_sv(SV *arg, cpBody *obj, const char *classname)
 {
-    if (obj == NULL) { return; }
-    SV *arg = (SV *)cpBodyGetUserData(obj);
-    SvREFCNT_inc(obj);
+    if (obj) {
+        SV *var = (SV *)cpBodyGetUserData(obj);
+        if (var == NULL) {
+            var = newSV(0);
+            sv_setref_pv(var, classname, (void *)obj);
+            cpBodySetUserData(obj, (cpDataPointer)var);
+        } else {
+            SvREFCNT_inc(var);
+        }
+        SvSetSV(arg, var);
+    } else {
+        sv_setsv(arg, &PL_sv_undef);
+    }
+
+    return arg;
 }

 void cpPli_body_refcnt_inc(cpBody *obj)
@@ -131,6 +124,13 @@
     if (obj == NULL) { return; }
     SV *arg = (SV *)cpBodyGetUserData(obj);
     SvREFCNT_inc(arg);
+}
+
+void cpPli_body_refcnt_dec(cpBody *obj)
+{
+    if (obj == NULL) { return; }
+    SV *arg = (SV *)cpBodyGetUserData(obj);
+    SvREFCNT_inc(obj);
 }

 void cpPli_body_free(cpBody *obj)


[core] add missing include tbuf.h

[core] add missing include tbuf.h

--- core/log_io.c
+++ core/log_io.c
@@ -45,6 +45,7 @@
 #include <third_party/crc32.h>
 #include <util.h>
 #include <pickle.h>
+#include <tbuf.h>

 const u32 snap_marker_v04 = -1U;
 const u64 xlog_marker_v04 = -1ULL;


correct map template

correct map template

--- src/img_op.h
+++ src/img_op.h
@@ -354,7 +354,7 @@
     }

     //@@@ need to consider ROI
-    template<typename A> img_t map(T f(int x, int y, image_t<T, ocvType> *self), A arg){
+    template<typename A> img_t map(T f(int x, int y, image_t<T, ocvType> *self, A arg), A arg){

         img_t res(width, height, orgX, orgY);


made rx,tx,objects,goal externs

made rx,tx,objects,goal externs

git-svn-id: 08bd4009faf460f4228be30851ec390dfdd4ef2e@149 d6c55bfe-47cd-0eed-8827-52b0d3839261

--- src/inc/rf.h
+++ src/inc/rf.h
@@ -44,11 +44,11 @@
 	} payload;
 } __attribute__ ((packed)) packet_buffer;

-packet_buffer tx, rx;
+extern packet_buffer tx, rx;

-board_coord objects[4];
+extern volatile board_coord objects[4];

-board_coord goal_position; //The target position received from a goal packet
+extern board_coord goal_position; //The target position received from a goal packet

 /**
  * Transmits the contents of the RF buffer


unused

unused

--- slash2/slashd/main_mds.c
+++ slash2/slashd/main_mds.c
@@ -168,10 +168,13 @@
 		psc_fatal("failed to execute command to mount %s",
 		    zpoolname);

+#if 0
 	/* mount the other MDS file systems from the pool */
 	rc = system("zfs mount -a");
 	if (rc == -1)
 		psc_fatal("failed to execute command to mount file systems");
+#endif
+
 }

 void


Remove file forgotten in [79a45df736]

Remove file forgotten in [79a45df736]

--- modules/control/dbus.h
+++ modules/control/dbus.h
@@ -1,232 +0,0 @@
-/*****************************************************************************
- * dbus.h : D-Bus control interface
- *****************************************************************************
- * Copyright (C) 2006 Rafaël Carré
- * $Id$
- *
- * Authors:    Rafaël Carré <funman at videolanorg>
- *             Mirsal ENNAIME <mirsal dot ennaime at gmail dot com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/* MPRIS VERSION */
-#define VLC_MPRIS_VERSION_MAJOR     1
-#define VLC_MPRIS_VERSION_MINOR     0
-
-/* DBUS IDENTIFIERS */
-
-/* name registered on the session bus */
-#define VLC_MPRIS_DBUS_SERVICE         "org.mpris.vlc"
-
-#define MPRIS_DBUS_ROOT_INTERFACE      "org.freedesktop.MediaPlayer"
-#define MPRIS_DBUS_PLAYER_INTERFACE    "org.freedesktop.MediaPlayer"
-#define MPRIS_DBUS_TRACKLIST_INTERFACE "org.freedesktop.MediaPlayer"
-
-#define MPRIS_DBUS_ROOT_PATH        "/"
-#define MPRIS_DBUS_PLAYER_PATH      "/Player"
-#define MPRIS_DBUS_TRACKLIST_PATH   "/TrackList"
-
-/* MACROS */
-
-#define DBUS_METHOD( method_function ) \
-    static DBusHandlerResult method_function \
-            ( DBusConnection *p_conn, DBusMessage *p_from, void *p_this )
-
-#define DBUS_SIGNAL( signal_function ) \
-    static DBusHandlerResult signal_function \
-            ( DBusConnection *p_conn, void *p_data )
-
-#define REPLY_INIT \
-    DBusMessage* p_msg = dbus_message_new_method_return( p_from ); \
-    if( !p_msg ) return DBUS_HANDLER_RESULT_NEED_MEMORY; \
-
-#define REPLY_SEND \
-    if( !dbus_connection_send( p_conn, p_msg, NULL ) ) \
-        return DBUS_HANDLER_RESULT_NEED_MEMORY; \
-    dbus_connection_flush( p_conn ); \
-    dbus_message_unref( p_msg ); \
-    return DBUS_HANDLER_RESULT_HANDLED
-
-#define SIGNAL_INIT( interface, path, signal ) \
-    DBusMessage *p_msg = dbus_message_new_signal( path, \
-        interface, signal ); \
-    if( !p_msg ) return DBUS_HANDLER_RESULT_NEED_MEMORY; \
-
-#define SIGNAL_SEND \
-    if( !dbus_connection_send( p_conn, p_msg, NULL ) ) \
-        return DBUS_HANDLER_RESULT_NEED_MEMORY; \
-    dbus_message_unref( p_msg ); \
-    dbus_connection_flush( p_conn ); \
-    return DBUS_HANDLER_RESULT_HANDLED
-
-#define OUT_ARGUMENTS \
-    DBusMessageIter args; \
-    dbus_message_iter_init_append( p_msg, &args )
-
-#define DBUS_ADD( dbus_type, value ) \
-    if( !dbus_message_iter_append_basic( &args, dbus_type, value ) ) \
-        return DBUS_HANDLER_RESULT_NEED_MEMORY
-
-#define ADD_STRING( s ) DBUS_ADD( DBUS_TYPE_STRING, s )
-#define ADD_BOOL( b ) DBUS_ADD( DBUS_TYPE_BOOLEAN, b )
-#define ADD_INT32( i ) DBUS_ADD( DBUS_TYPE_INT32, i )
-#define ADD_BYTE( b ) DBUS_ADD( DBUS_TYPE_BYTE, b )
-
-/* XML data to answer org.freedesktop.DBus.Introspectable.Introspect requests */
-
-const char* psz_introspection_xml_data_root =
-"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n"
-"\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n"
-"<node>\n"
-"  <node name=\"Player\"/>\n"
-"  <node name=\"TrackList\"/>\n"
-"  <interface name=\"org.freedesktop.DBus.Introspectable\">\n"
-"    <method name=\"Introspect\">\n"
-"      <arg name=\"data\" direction=\"out\" type=\"s\"/>\n"
-"    </method>\n"
-"  </interface>\n"
-"  <interface name=\"org.freedesktop.MediaPlayer\">\n"
-"    <method name=\"Identity\">\n"
-"      <arg type=\"s\" direction=\"out\" />\n"
-"    </method>\n"
-"    <method name=\"MprisVersion\">\n"
-"      <arg type=\"(qq)\" direction=\"out\" />\n"
-"    </method>\n"
-"    <method name=\"Quit\">\n"
-"    </method>\n"
-"  </interface>\n"
-"</node>\n"
-;
-
-const char* psz_introspection_xml_data_player =
-"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n"
-"\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n"
-"<node>"
-"  <interface name=\"org.freedesktop.DBus.Introspectable\">\n"
-"    <method name=\"Introspect\">\n"
-"      <arg name=\"data\" direction=\"out\" type=\"s\"/>\n"
-"    </method>\n"
-"  </interface>\n"
-"  <interface name=\"org.freedesktop.MediaPlayer\">\n"
-"    <method name=\"GetStatus\">\n"
-"      <arg type=\"(iiii)\" direction=\"out\" />\n"
-"    </method>\n"
-"    <method name=\"Prev\">\n"
-"    </method>\n"
-"    <method name=\"Next\">\n"
-"    </method>\n"
-"    <method name=\"Stop\">\n"
-"    </method>\n"
-"    <method name=\"Play\">\n"
-"    </method>\n"
-"    <method name=\"Pause\">\n"
-"    </method>\n"
-"    <method name=\"Repeat\">\n"
-"      <arg type=\"b\" direction=\"in\" />\n"
-"    </method>\n"
-"    <method name=\"VolumeSet\">\n"
-"      <arg type=\"i\" direction=\"in\" />\n"
-"    </method>\n"
-"    <method name=\"VolumeGet\">\n"
-"      <arg type=\"i\" direction=\"out\" />\n"
-"    </method>\n"
-"    <method name=\"PositionSet\">\n"
-"      <arg type=\"i\" direction=\"in\" />\n"
-"    </method>\n"
-"    <method name=\"PositionGet\">\n"
-"      <arg type=\"i\" direction=\"out\" />\n"
-"    </method>\n"
-"    <method name=\"GetMetadata\">\n"
-"      <arg type=\"a{sv}\" direction=\"out\" />\n"
-"    </method>\n"
-"    <method name=\"GetCaps\">\n"
-"      <arg type=\"i\" direction=\"out\" />\n"
-"    </method>\n"
-"    <signal name=\"TrackChange\">\n"
-"      <arg type=\"a{sv}\"/>\n"
-"    </signal>\n"
-"    <signal name=\"StatusChange\">\n"
-"      <arg type=\"(iiii)\"/>\n"
-"    </signal>\n"
-"    <signal name=\"CapsChange\">\n"
-"      <arg type=\"i\"/>\n"
-"    </signal>\n"
-"  </interface>\n"
-"</node>\n"
-;
-
-const char* psz_introspection_xml_data_tracklist =
-"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n"
-"\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n"
-"<node>"
-"  <interface name=\"org.freedesktop.DBus.Introspectable\">\n"
-"    <method name=\"Introspect\">\n"
-"      <arg name=\"data\" direction=\"out\" type=\"s\"/>\n"
-"    </method>\n"
-"  </interface>\n"
-"  <interface name=\"org.freedesktop.MediaPlayer\">\n"
-"    <method name=\"AddTrack\">\n"
-"      <arg type=\"s\" direction=\"in\" />\n"
-"      <arg type=\"b\" direction=\"in\" />\n"
-"      <arg type=\"i\" direction=\"out\" />\n"
-"    </method>\n"
-"    <method name=\"DelTrack\">\n"
-"      <arg type=\"i\" direction=\"in\" />\n"
-"    </method>\n"
-"    <method name=\"GetMetadata\">\n"
-"      <arg type=\"i\" direction=\"in\" />\n"
-"      <arg type=\"a{sv}\" direction=\"out\" />\n"
-"    </method>\n"
-"    <method name=\"GetCurrentTrack\">\n"
-"      <arg type=\"i\" direction=\"out\" />\n"
-"    </method>\n"
-"    <method name=\"GetLength\">\n"
-"      <arg type=\"i\" direction=\"out\" />\n"
-"    </method>\n"
-"    <method name=\"SetLoop\">\n"
-"      <arg type=\"b\" direction=\"in\" />\n"
-"    </method>\n"
-"    <method name=\"SetRandom\">\n"
-"      <arg type=\"b\" direction=\"in\" />\n"
-"    </method>\n"
-"    <signal name=\"TrackListChange\">\n"
-"      <arg type=\"i\" />\n"
-"    </signal>\n"
-"  </interface>\n"
-"</node>\n"
-;
-
-
-/* Handle  messages reception */
-DBUS_METHOD( handle_root );
-DBUS_METHOD( handle_player );
-DBUS_METHOD( handle_tracklist );
-
-static const DBusObjectPathVTable vlc_dbus_root_vtable = {
-        NULL, handle_root, /* handler function */
-        NULL, NULL, NULL, NULL
-};
-
-static const DBusObjectPathVTable vlc_dbus_player_vtable = {
-        NULL, handle_player, /* handler function */
-        NULL, NULL, NULL, NULL
-};
-
-static const DBusObjectPathVTable vlc_dbus_tracklist_vtable = {
-        NULL, handle_tracklist, /* handler function */
-        NULL, NULL, NULL, NULL
-};
-


* http.c: fixed bug with spaces in mrl

* http.c: fixed bug with spaces in mrl

--- modules/control/http.c
+++ modules/control/http.c
@@ -2,7 +2,7 @@
  * http.c :  http mini-server ;)
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: http.c,v 1.34 2003/11/16 20:41:36 garf Exp $
+ * $Id: http.c,v 1.35 2003/11/17 15:29:03 garf Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *          Laurent Aimar <fenrir@via.ecp.fr>
@@ -2878,11 +2878,17 @@
     }

     /* extract the mrl */
-    s_temp = Find_end_MRL( s_mrl );
-
+    s_temp = strstr( s_mrl , " :" );
     if( s_temp == NULL )
     {
-        return NULL;
+        s_temp = s_mrl + strlen( s_mrl );
+    } else
+    {
+        while( (*s_temp == ' ') && (s_temp != s_mrl ) )
+        {
+            s_temp--;
+        }
+        s_temp++;
     }

     /* if the mrl is between " or ', we must remove them */


Vobsub: remove unused variable

Vobsub: remove unused variable

--- modules/demux/vobsub.c
+++ modules/demux/vobsub.c
@@ -75,7 +75,6 @@

 typedef struct
 {
-    es_format_t fmt;
     es_out_id_t *p_es;
     int         i_track_id;


session.c: check return value of session_nonblock in debug mode

Reported by Coverity CID 89805.

--- src/session.c
+++ src/session.c
@@ -1040,9 +1040,14 @@
     _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
          "Extra packets left %d", packets_left);

-    if(session->socket_prev_blockstate)
+    if(session->socket_prev_blockstate) {
         /* if the socket was previously blocking, put it back so */
-        session_nonblock(session->socket_fd, 0);
+        rc = session_nonblock(session->socket_fd, 0);
+        if (rc) {
+            _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
+             "unable to reset socket's blocking state");
+        }
+    }

     if (session->server_hostkey) {
         LIBSSH2_FREE(session, session->server_hostkey);


Remove empty line from logs

Remove empty line from logs

--- src/sevents.h
+++ src/sevents.h
@@ -99,7 +99,7 @@
     }
     if (count == 0) { return; }

-    _trace("events::remove_events(%u:%p):now_playing", count, state->events->now_playing);
+    _trace("events::remove_events(%p::%u):now_playing", state->events->now_playing, count);
     state->events->now_playing_count -= now_playing_events_free(state->events->now_playing, state->events->now_playing_count, count);
     if (count == state->events->now_playing_count && NULL != state->player->current) {
         mpris_properties_free(state->player->current);
@@ -217,8 +217,7 @@
     ev->volume_changed = false;
     ev->track_changed = false;
     ev->position_changed = false;
-    _trace("mem::zeroed::mpris_event\n");
-
+    _trace("mem::zeroed::mpris_event");
 }

 static inline bool mpris_event_happened(const struct mpris_event *what_happened)
@@ -254,8 +253,8 @@
         }
     }
     if(what_happened->track_changed) {
+#if 1
         // TODO: maybe add a queue flush event
-#if 1
         if (NULL != state->events->now_playing[0]) { remove_events_now_playing(state, 0); }
         if (NULL != state->events->scrobble) { remove_event_scrobble(state); }
 #endif


Misc fix in SVC file handling

Misc fix in SVC file handling

git-svn-id: ab66a9de07fa9d47c5829c82992f5279466c775f@4678 63c20433-aa62-49bd-875c-5a186b69a8fb

--- modules/isom_in/load.c
+++ modules/isom_in/load.c
@@ -88,8 +88,16 @@
 	const char *tag;
 	u32 i, count, ocr_es_id, tlen, base_track, j, track_id;
 	Bool highest_stream;
+	char *opt;
+	Bool add_ps_lower = GF_TRUE;

 	ocr_es_id = 0;
+	opt = (char*) gf_modules_get_option((GF_BaseInterface *)read->input, "ISOReader", "DeclareScalableXPS");
+	if (!opt) {
+		gf_modules_set_option((GF_BaseInterface *)read->input, "ISOReader", "DeclareScalableXPS", "yes");
+	} else if (!strcmp(opt, "no")) {
+		add_ps_lower = GF_FALSE;
+	}

 	/*TODO check for alternate tracks*/
 	count = gf_isom_get_track_count(read->mov);
@@ -123,9 +131,9 @@
 		if (esd) {
 			gf_isom_get_reference(read->mov, i+1, GF_ISOM_REF_BASE, 1, &base_track);
 			esd->has_ref_base = base_track ? GF_TRUE : GF_FALSE;
-			/* we add the SPS/PPS of the lower layers to this esd*/
-#if 1
-			if (esd->has_ref_base) {
+			/*FIXME: if we declare only SPS/PPS of the highest layer, we have a problem in decoding even though we have all SPS/PPS inband (OpenSVC bug ?)*/
+			/*so we add by default the SPS/PPS of the lower layers to this esd*/
+			if (esd->has_ref_base && add_ps_lower) {
 				u32 count, refIndex, ref_track, num_sps, num_pps, t;
 				GF_AVCConfig *cfg = gf_odf_avc_cfg_read(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength);
 				GF_AVCConfig *avccfg, *svccfg;
@@ -186,7 +194,7 @@
 				gf_odf_avc_cfg_write(cfg, &esd->decoderConfig->decoderSpecificInfo->data, &esd->decoderConfig->decoderSpecificInfo->dataLength);
 				gf_odf_avc_cfg_del(cfg);
 			}
-#endif
+
 			od = (GF_ObjectDescriptor *) gf_odf_desc_new(GF_ODF_OD_TAG);
 			od->service_ifce = read->input;
 			od->objectDescriptorID = 0;


use a head buffer

use a head buffer

--- src/shervin.c
+++ src/shervin.c
@@ -37,14 +37,16 @@

 // TODO: logging

-#define SHV_BUFFER_SIZE 2048
+#define SHV_HEAD_SIZE 8192
+#define SHV_BUFFER_SIZE 1024

 typedef struct shv_con {
-  short state; // 0 created, 1 headers read, 2 body read
   shv_route **routes;
   shv_route *route;
-  flu_sbuffer *src;
+  char *head;
+  size_t hoff;
+  flu_sbuffer *body;
   shv_request req;
   shv_response res;
 } shv_con;
@@ -53,8 +55,8 @@
 {
   shv_con *c = calloc(1, sizeof(shv_con));
   c->routes = routes;
-  c->state = 0;
-  c->src = flu_sbuffer_malloc();
+  c->head = calloc(SHV_HEAD_SIZE, sizeof(char));
+  c->hoff = 0;
   return c;
 }

@@ -66,31 +68,29 @@

 static void shv_handle_cb(struct ev_loop *l, struct ev_io *eio, int revents)
 {
-printf("watcher: %p\n", eio);
   if (EV_ERROR & revents) { perror("read invalid event"); return; }

-  // TODO: use a memstream
-  char buffer[SHV_BUFFER_SIZE];
+  shv_con *con = (shv_con *)eio->data;

-  ssize_t r = recv(eio->fd, buffer, SHV_BUFFER_SIZE, 0);
+  ssize_t r = recv(eio->fd, con->head + con->hoff, SHV_BUFFER_SIZE, 0);

-  if (r < 0) { /*perror("read error");*/ return; }
+  if (r < 0) { perror("read error"); return; }

   if (r == 0)
   {
     ev_io_stop(l, eio);
     free(eio);
     perror("*** client closing ***");
+    // TODO: free con
     return;
   }

-  printf("  >%s< %zu\n", buffer, strlen(buffer));
+  con->hoff += r;
+
+  printf("** current  >%s< l%zu r%zu\n", con->head, strlen(con->head), r);

   //send(eio->fd, buffer, r, 0);
   //memset(buffer, 0, r);
-
-  // TODO: read until the double crlf
-  // TODO: handle the incoming requests
 }

 static void shv_accept_cb(struct ev_loop *l, struct ev_io *eio, int revents)


Fixed save_wav(). Still need to figure out why the silence-added WAV is not saving properly.

--- src/silence.c
+++ src/silence.c
@@ -86,7 +86,7 @@
 	pack_iputw(1, fp);
 	pack_iputw(channels, fp);
 	pack_iputl(freq, fp);
-	pack_iputl(samples * channels * (bits / 8), fp);
+	pack_iputl(freq * channels * (bits / 8), fp);
 	pack_iputw(channels * (bits / 8), fp);
 	pack_iputw(bits, fp);


xfrm: fix calling free() with a bad pointer

sp->sec_ctx->ctx is a zero-length member, so it's already allocated

https://github.com/thom311/libnl/pull/61

Signed-off-by: Thomas Haller <16e26612e4159990a6b3691e92592e691ff74132@redhat.com>

--- lib/xfrm/sp.c
+++ lib/xfrm/sp.c
@@ -94,7 +94,6 @@

 	if(sp->sec_ctx)
 	{
-		free (sp->sec_ctx->ctx);
 		free (sp->sec_ctx);
 	}


Rework the html output for mkd_flags_are to use <s>strikethrough</s> on options that are logically OFF.

--- flags.c
+++ flags.c
@@ -44,20 +44,26 @@
     for (i=0; i < NR(flagnames); i++) {
 	set = flags & flagnames[i].flag;
 	name = flagnames[i].name;
-	not = *name == '!';
+	if ( not = (*name == '!') ) {
+	    ++name;
+	    set = !set;
+	}

 	if ( htmlplease )
 	    fprintf(f, "
");
 	else
 	    fputc(' ', f);
-	if ( set )
-	    fprintf(f, "%s", name);
-	else if ( not )
-	    fprintf(f, "%s", 1+name);
-	else
-	    fprintf(f, "!%s", name);
-	if ( htmlplease )
+
+	if ( !set )
+	    fprintf(f, htmlplease ? "<s>" : "!");
+
+	fprintf(f, "%s", name);
+
+	if ( htmlplease ) {
+	    if ( !set )
+		fprintf(f, "</s>");
 	    fprintf(f, "
\n");
+	}
     }
     if ( htmlplease )
 	fprintf(f, "
");


update old_string after a recursive preprocess call so we don't reset to a free'd vector; add recursion header/footer pragmas

--- ftepp.c
+++ ftepp.c
@@ -483,6 +483,16 @@
     ftepp_out(ftepp, "\"", false);
 }

+static void ftepp_recursion_header(ftepp_t *ftepp)
+{
+    ftepp_out(ftepp, "\n#pragma push(line)\n", false);
+}
+
+static void ftepp_recursion_footer(ftepp_t *ftepp)
+{
+    ftepp_out(ftepp, "\n#pragma pop(line)\n", false);
+}
+
 static bool ftepp_preprocess(ftepp_t *ftepp);
 static bool ftepp_macro_expand(ftepp_t *ftepp, ppmacro *macro, macroparam *params)
 {
@@ -560,11 +570,14 @@
     }
     ftepp->output_string = old_string;
     ftepp->lex = inlex;
+    ftepp_recursion_header(ftepp);
     if (!ftepp_preprocess(ftepp)) {
         lex_close(ftepp->lex);
         retval = false;
         goto cleanup;
     }
+    ftepp_recursion_footer(ftepp);
+    old_string = ftepp->output_string;

 cleanup:
     ftepp->lex           = old_lexer;


yaz_diag_srw_to_bib1 now looks up SRW diagnostic codes first in a new explicit reverse-mapping table, falling back to reverse-lookup in the old table only if this does not succeed.

--- src/srwutil.c
+++ src/srwutil.c
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: srwutil.c,v 1.63 2007-09-06 17:10:35 mike Exp $
+ * $Id: srwutil.c,v 1.64 2007-09-07 17:41:47 mike Exp $
  */
 /**
  * \file srwutil.c
@@ -947,7 +947,7 @@
 }

 /* bib1:srw */
-static int srw_bib1_map[] = {
+static int bib1_srw_map[] = {
     1, 1,
     2, 2,
     3, 11,
@@ -1116,9 +1116,21 @@
     0
 };

+/*
+ * This array contains overrides for when the first occurrence of a
+ * particular SRW error in the array above does not correspond with
+ * the best back-translation of that SRW error.
+ */
+static int srw_bib1_map[] = {
+    66, 238,
+    /* No doubt there are many more */
+    0
+};
+
+
 int yaz_diag_bib1_to_srw (int code)
 {
-    const int *p = srw_bib1_map;
+    const int *p = bib1_srw_map;
     while (*p)
     {
         if (code == p[0])
@@ -1130,7 +1142,17 @@

 int yaz_diag_srw_to_bib1(int code)
 {
+    /* Check explicit reverse-map first */
     const int *p = srw_bib1_map;
+    while (*p)
+    {
+        if (code == p[0])
+            return p[1];
+        p += 2;
+    }
+
+    /* Fall back on reverse lookup in main map */
+    p = bib1_srw_map;
     while (*p)
     {
         if (code == p[1])


Better fail

Better fail

--- gmqcc.h
+++ gmqcc.h
@@ -157,8 +157,8 @@
          * fail.  There is no valid way to get a 64bit type at this point
          * without making assumptions of too many things.
          */
-        typedef char         int64_t;
-        typedef char         uint64_t;
+        typedef struct { char _fail : 0; } int64_t;
+        typedef struct { char _fail : 0; } uint64_t;
 #   endif
 #endif
 #ifdef _LP64 /* long pointer == 64 */
@@ -170,7 +170,7 @@
 #endif
 /* Ensure type sizes are correct: */
 typedef char uint8_size_is_correct  [sizeof(uint8_t)  == 1?1:-1];
-typedef char uint16_size_if_correct [sizeof(uint16_t) == 2?1:-1];
+typedef char uint16_size_is_correct [sizeof(uint16_t) == 2?1:-1];
 typedef char uint32_size_is_correct [sizeof(uint32_t) == 4?1:-1];
 typedef char uint64_size_is_correct [sizeof(uint64_t) == 8?1:-1];
 typedef char int16_size_if_correct  [sizeof(int16_t)  == 2?1:-1];


Add compression in storage

Add compression in storage

--- src/storage.h
+++ src/storage.h
@@ -187,13 +187,16 @@

 	int free_blocks;

-	char buffer[STORAGE_BLOCK_SIZE];
+	char buffer0[STORAGE_BLOCK_SIZE];
+	char buffer1[STORAGE_BLOCK_SIZE];
 	uint32_t buffer_offset;

-	size_t bin_size;
 	off_t bin_offset;
 	StorageBinHeader bin_header;
 	StorageBinFooter bin_footer;
+
+	LZ4DecompressDescriptor dec_lz4;
+	LZ4DecompressDescriptor::iterator dec_it;

 	inline void growfile() {
 		if (free_blocks <= STORAGE_BLOCKS_MIN_FREE) {
@@ -223,8 +226,8 @@
 		  fd(0),
 		  free_blocks(0),
 		  buffer_offset(0),
-		  bin_size(0),
-		  bin_offset(0) { }
+		  bin_offset(0),
+		  dec_lz4(fd) { }

 	virtual ~Storage() {
 		close();
@@ -243,7 +246,7 @@

 #if STORAGE_BUFFER_CLEAR
 		if (flags & STORAGE_WRITABLE) {
-			memset(buffer, STORAGE_BUFFER_CLEAR_CHAR, sizeof(buffer));
+			memset(buffer0, STORAGE_BUFFER_CLEAR_CHAR, STORAGE_BLOCK_SIZE);
 		}
 #endif

@@ -275,7 +278,7 @@
 				buffer_offset = header.head.offset * STORAGE_ALIGNMENT;
 				size_t offset = (buffer_offset / STORAGE_BLOCK_SIZE) * STORAGE_BLOCK_SIZE;
 				buffer_offset -= offset;
-				if unlikely(io::pread(fd, buffer, sizeof(buffer), offset) < 0) {
+				if unlikely(io::pread(fd, buffer0, STORAGE_BLOCK_SIZE, offset) < 0) {
 					throw MSG_StorageIOError("IO error: pread");
 				}
 			}
@@ -294,7 +297,6 @@

 		fd = 0;
 		free_blocks = 0;
-		bin_size = 0;
 		bin_offset = 0;
 		bin_header.size = 0;
 		buffer_offset = 0;
@@ -308,17 +310,11 @@
 	}

 	uint32_t write(const char *data, size_t data_size, void* param=nullptr) {
-		// FIXME: Compress data here!
-
-		size_t data_size_orig = data_size;
-
-		uint32_t current_offset = header.head.offset;
-
 		uint32_t checksum = 0;

 		StorageBinHeader bin_header;
 		memset(&bin_header, 0, sizeof(bin_header));
-		bin_header.init(param, static_cast<uint32_t>(data_size));
+		bin_header.init(param, 0);
 		const StorageBinHeader* bin_header_data = &bin_header;
 		size_t bin_header_data_size = sizeof(StorageBinHeader);

@@ -326,9 +322,17 @@
 		memset(&bin_footer, 0, sizeof(bin_footer));
 		const StorageBinFooter* bin_footer_data = &bin_footer;
 		size_t bin_footer_data_size = sizeof(StorageBinFooter);
-		off_t block_offset = ((current_offset * STORAGE_ALIGNMENT) / STORAGE_BLOCK_SIZE) * STORAGE_BLOCK_SIZE;
-
-		while (bin_header_data_size || data_size || bin_footer_data_size) {
+		off_t block_offset = ((header.head.offset * STORAGE_ALIGNMENT) / STORAGE_BLOCK_SIZE) * STORAGE_BLOCK_SIZE;
+
+		LZ4CompressData lz4(data, data_size);
+		auto it = lz4.begin();
+		size_t it_offset = 0;
+
+		char* buffer = buffer0;
+		off_t tmp_block_offset = block_offset;
+		uint32_t tmp_buffer_offset = buffer_offset;
+
+		while (bin_header_data_size || it || bin_footer_data_size) {
 			if (bin_header_data_size) {
 				size_t size = STORAGE_BLOCK_SIZE - buffer_offset;
 				if (size > bin_header_data_size) {
@@ -338,28 +342,42 @@
 				bin_header_data_size -= size;
 				bin_header_data += size;
 				buffer_offset += size;
-				if (buffer_offset == sizeof(buffer)) {
+				if (buffer_offset == STORAGE_BLOCK_SIZE) {
 					buffer_offset = 0;
-					goto do_write;
-				}
-			}
-
-			if (data_size) {
+					if (buffer == buffer1) {
+						goto do_write;
+					} else {
+						buffer = buffer1;
+						goto do_update;
+					}
+				}
+			}
+
+			while (it) {
 				size_t size = STORAGE_BLOCK_SIZE - buffer_offset;
-				if (size > data_size) {
-					size = data_size;
-				}
-				memcpy(buffer + buffer_offset, data, size);
-				data_size -= size;
-				data += size;
+				if (size > it->size() - it_offset) {
+					size = it->size() - it_offset;
+				}
+				memcpy(buffer + buffer_offset, it->c_str() + it_offset, size);
 				buffer_offset += size;
-				if (buffer_offset == sizeof(buffer)) {
+				if (buffer_offset == STORAGE_BLOCK_SIZE) {
 					buffer_offset = 0;
-					goto do_write;
-				}
+					if (buffer == buffer1) {
+						goto do_write;
+					} else {
+						buffer = buffer1;
+						goto do_update;
+					}
+				}
+				++it;
+				it_offset = 0;
 			}

 			if (bin_footer_data_size) {
+				// Update Header.
+				bin_header.size = lz4.size();
+				memcpy(buffer0 + tmp_buffer_offset, &bin_header.size, sizeof(bin_header.size));
+
 				bin_footer.init(param, checksum);

 				size_t size = STORAGE_BLOCK_SIZE - buffer_offset;
@@ -374,17 +392,23 @@
 				// Align the buffer_offset to the next storage alignment
 				buffer_offset = static_cast<uint32_t>(((block_offset + buffer_offset + STORAGE_ALIGNMENT - 1) / STORAGE_ALIGNMENT) * STORAGE_ALIGNMENT - block_offset);

-				if (buffer_offset == sizeof(buffer)) {
+				if (buffer_offset == STORAGE_BLOCK_SIZE) {
 					buffer_offset = 0;
-					goto do_write;
+					if (buffer == buffer1) {
+						goto do_write;
+					} else {
+						buffer = buffer1;
+						goto do_update;
+					}
 				}
 			}

 		do_write:
-			if (io::pwrite(fd, buffer, sizeof(buffer), block_offset) != sizeof(buffer)) {
+			if (io::pwrite(fd, buffer, STORAGE_BLOCK_SIZE, block_offset) != STORAGE_BLOCK_SIZE) {
 				throw MSG_StorageIOError("IO error: pwrite");
 			}

+		do_update:
 			if (buffer_offset == 0) {
 				block_offset += STORAGE_BLOCK_SIZE;
 				if (block_offset >= STORAGE_LAST_BLOCK_OFFSET) {
@@ -392,24 +416,30 @@
 				}
 				--free_blocks;
 #if STORAGE_BUFFER_CLEAR
-				memset(buffer, STORAGE_BUFFER_CLEAR_CHAR, sizeof(buffer));
+				memset(buffer, STORAGE_BUFFER_CLEAR_CHAR, STORAGE_BLOCK_SIZE);
 #endif
 			}
 		}

-		header.head.offset += (((sizeof(StorageBinHeader) + data_size_orig + sizeof(StorageBinFooter)) + STORAGE_ALIGNMENT - 1) / STORAGE_ALIGNMENT);
-
-		return current_offset;
-	}
-
-	size_t read(char *buf, size_t buf_size, uint32_t limit=-1, void* param=nullptr) {
+		// Write the first used buffer.
+		if (buffer == buffer1) {
+			if (io::pwrite(fd, buffer, STORAGE_BLOCK_SIZE, tmp_block_offset) != STORAGE_BLOCK_SIZE) {
+				throw MSG_StorageIOError("IO error: pwrite");
+			}
+		}
+
+		header.head.offset += (((sizeof(StorageBinHeader) + bin_header.size + sizeof(StorageBinFooter)) + STORAGE_ALIGNMENT - 1) / STORAGE_ALIGNMENT);
+
+		return header.head.offset;
+	}
+
+	size_t read(char* buf, size_t buf_size, uint32_t limit=-1, void* param=nullptr) {
 		if (!buf_size) {
 			return 0;
 		}

 		ssize_t r;
 		uint32_t checksum = 0;
-		size_t bin_read;

 		if (!bin_header.size) {
 			off_t offset = io::lseek(fd, bin_offset, SEEK_SET);
@@ -417,7 +447,7 @@
 				throw MSG_StorageEOF("Storage EOF");
 			}

-			r = io::read(fd,  &bin_header, sizeof(StorageBinHeader));
+			r = io::read(fd, &bin_header, sizeof(StorageBinHeader));
 			if unlikely(r < 0) {
 				throw MSG_StorageIOError("IO error: read");
 			} else if unlikely(r != sizeof(StorageBinHeader)) {
@@ -425,45 +455,33 @@
 			}
 			bin_offset += r;
 			bin_header.validate(param);
-		}
-
-		if (buf_size > bin_header.size - bin_size) {
-			buf_size = bin_header.size - bin_size;
-		}
-
-		if (buf_size) {
-			r = io::read(fd, buf, buf_size);
-			if unlikely(r < 0) {
-				throw MSG_StorageIOError("IO error: read");
-			} else if unlikely(static_cast<size_t>(r) != buf_size) {
-				throw MSG_StorageCorruptVolume("Incomplete bin data");
-			}
-			bin_offset += r;
-
-			bin_size += r;
-			bin_read = r;
-
-			checksum = 0;  // FIXME: bin_checksum update
-
-		} else {
-			r = io::read(fd, &bin_footer, sizeof(StorageBinFooter));
-			if unlikely(r < 0) {
-				throw MSG_StorageIOError("IO error: read");
-			} else if unlikely(r != sizeof(StorageBinFooter)) {
-				throw MSG_StorageCorruptVolume("Incomplete bin footer");
-			}
-			bin_offset += r;
-			bin_footer.validate(param, checksum);
-
-			// Align the bin_offset to the next storage alignment
-			bin_offset = ((bin_offset + STORAGE_ALIGNMENT - 1) / STORAGE_ALIGNMENT) * STORAGE_ALIGNMENT;
-
-			bin_header.size = 0;
-			bin_size = 0;
-			bin_read = 0;
-		}
-
-		return bin_read;
+
+			io::fadvise(fd, bin_offset, bin_header.size, POSIX_FADV_WILLNEED);
+
+			dec_lz4.set_read_bytes(bin_header.size);
+			dec_it = dec_lz4.begin();
+			bin_offset += bin_header.size;
+		}
+
+		size_t _size = dec_it.read(buf, buf_size);
+		if (_size) {
+			return _size;
+		}
+
+		r = io::read(fd, &bin_footer, sizeof(StorageBinFooter));
+		if unlikely(r < 0) {
+			throw MSG_StorageIOError("IO error: read");
+		} else if unlikely(r != sizeof(StorageBinFooter)) {
+			throw MSG_StorageCorruptVolume("Incomplete bin footer");
+		}
+		bin_offset += r;
+		bin_footer.validate(param, checksum);
+
+		// Align the bin_offset to the next storage alignment
+		bin_offset = ((bin_offset + STORAGE_ALIGNMENT - 1) / STORAGE_ALIGNMENT) * STORAGE_ALIGNMENT;
+
+		bin_header.size = 0;
+		return 0;
 	}

 	void commit() {


Set errno to zero before call to sysconf()

--- src/sysconf.c
+++ src/sysconf.c
@@ -31,6 +31,7 @@
 	CAMLlocal1(val_res);
 	long r;

+	errno = 0;
 	if ((r = sysconf(sysconf_names[Int_val(val_name)])) == -1 &&
 	    errno == EINVAL)
 		uerror("sysconf", Nothing);


sysrepo REFACTOR minor sr_conn_count cleanup

--- src/sysrepo.c
+++ src/sysrepo.c
@@ -430,14 +430,11 @@
 sr_connection_count(uint32_t *conn_count)
 {
     sr_error_info_t *err_info = NULL;
-    sr_main_shm_t *main_shm = NULL;
-    sr_shm_t shm = SR_SHM_INITIALIZER;
+    sr_main_shm_t *main_shm;
+    sr_shm_t shm = SR_SHM_INITIALIZER, ext_shm = SR_SHM_INITIALIZER;
     int shm_lock = -1;
-    sr_shm_t ext_shm;
-    uint32_t idx = 0;
-    uint32_t count = 0;
-    sr_conn_shm_t *conn_s = NULL;
-    memset(&ext_shm, 0, sizeof(sr_shm_t));
+    uint32_t idx, count;
+    sr_conn_shm_t *conn_s;

     SR_CHECK_ARG_APIRET(!conn_count, NULL, err_info);

@@ -457,6 +454,9 @@

     /* open the main SHM */
     err_info = sr_shmmain_main_open(&shm, NULL);
+    if (!err_info && (shm.fd > -1)) {
+        err_info = sr_shmmain_ext_open(&ext_shm, 0);
+    }

     /* CREATE UNLOCK */
     sr_shmmain_createunlock(shm_lock);
@@ -471,11 +471,6 @@
     }

     main_shm = (sr_main_shm_t *)shm.addr;
-    *conn_count = main_shm->conn_count;
-
-    if ((err_info = sr_shmmain_ext_open(&ext_shm, 0))) {
-        goto cleanup;
-    }

     /* SHM LOCK */
     if ((err_info = sr_rwlock(&main_shm->lock, SR_MAIN_LOCK_TIMEOUT * 1000, SR_LOCK_READ, __func__))) {
@@ -484,10 +479,8 @@

     count = 0;
     conn_s = (sr_conn_shm_t *)(ext_shm.addr + main_shm->conns);
-    for (idx = 0; idx < main_shm->conn_count; idx++) {
-        if (!sr_connection_exists(conn_s[idx].cid)) {
-            SR_LOG_WRN("Skipping dead connection for CID %"PRIu32".", conn_s[idx].cid);
-        } else {
+    for (idx = 0; idx < main_shm->conn_count; ++idx) {
+        if (sr_connection_exists(conn_s[idx].cid)) {
             count++;
         }
     }
@@ -503,6 +496,7 @@
         close(shm_lock);
     }
     sr_shm_clear(&shm);
+    sr_shm_clear(&ext_shm);
     return sr_api_ret(NULL, err_info);
 }


Use volatile for curr_ticks

Use volatile for curr_ticks

--- src/systick.c
+++ src/systick.c
@@ -46,9 +46,9 @@
     return 0;
 }

-void systick_sleep(uint32_t ms)
+void systick_sleep(volatile uint32_t ms)
 {
-    uint32_t curr_ticks = sys_ticks;
+    volatile uint32_t curr_ticks = sys_ticks;
     while ((sys_ticks - curr_ticks) < ms);
 }


shortening line length

shortening line length

git-svn-id: 9e9401559e51101c165cdce4d49b411eb20436ed@3909 3d70eeeb-363e-0410-a505-8a46323a89f2

--- src/ten/ten.h
+++ src/ten/ten.h
@@ -110,7 +110,7 @@
 enum {
   tenInterpTypeUnknown,         /*  0: nobody knows */
   tenInterpTypeLinear,          /*  1: simple per-coefficient linear */
-  tenInterpTypeLogLinear,       /*  2: linear on coefs of logs (Log-Euclidean) */
+  tenInterpTypeLogLinear,       /*  2: linear on logs (Log-Euclidean) */
   tenInterpTypeAffineInvariant, /*  3: Riemannian approach of many authors */
   tenInterpTypeWang,            /*  4: affine-invariant of Z Wang & B Vemuri */
   tenInterpTypeGeoLoxK,         /*  5: geodesic-loxodrome on K_i invariants */


Compile fix after rebasing

Compile fix after rebasing

--- cpp/library.h
+++ cpp/library.h
@@ -23,7 +23,7 @@
     std::function<Signal(Chunk<FSignal>)>(
         [](auto fsignal)
         {
-            return Signal(psl::fillFromFrequency(fsignal),
+            return Signal(std::bind(psl::fillFromFrequency, fsignal),
                     fsignal().sampleRate(), fsignal().channels());
         });
     });
@@ -43,7 +43,7 @@
             // TODO: get these in a better way!
             int sampleRate = 44100;
             int channels = 2;
-            return Signal(fillFromFunction(f, sampleRate, channels),
+            return Signal(std::bind(fillFromFunction, f, sampleRate, channels),
                     sampleRate, channels);
         });
     });
@@ -108,21 +108,3 @@
     };
 }

-Signal psl::ift(Chunk<FSignal> fsignal)
-{
-    return Signal(std::bind(psl::fillFromFrequency, fsignal),
-            fsignal().sampleRate(), fsignal().channels());
-}
-
-FSignal psl::ft(Chunk<Signal> signal)
-{
-    return FSignal(signal, 500e3);
-}
-
-Signal psl::signal(Chunk<dubop_t> f)
-{
-    // TODO: get these in a better way!
-    int sampleRate = 44100;
-    int channels = 2;
-    return Signal(std::bind(fillFromFunction, f, sampleRate, channels), sampleRate, channels);
-}


- enable CTRL-X CTRL-E eval_last_expression from within the editor!

--- imacs.c
+++ imacs.c
@@ -9,6 +9,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <string.h>
+#include <ctype.h>

 #ifdef OTA
   #include "espressif/esp_common.h"
@@ -377,6 +378,51 @@
 // '[5~': 'PgUp',
 // '[6~': 'PdDown',

+#ifdef NO_MAIN
+  extern void* global_envp;
+#endif
+
+void eval_last_expr(imacs_buffer* b, char* end) {
+    // if on symbol - move forward to end of symbol
+    while (isalnum(*end) && end < b->end) end++;
+    end = *end ? end : end-1;
+    // if at spaces move back
+    while (isspace(*end) && end > b->buff) end--;
+    char* p = *end ? end : end-2;
+
+    // count parenthesis
+    int paren = 0;
+    // flag to read symbol fully
+    int sym = isalnum(*end);
+    do {
+        if (p < b->buff) break;
+        if (*p == ')') paren++;
+        if (*p == '(') paren--;
+        if (*p == '"') while (p > b->buff && *--p != '"');
+        if (paren && sym) sym = 0;
+        if (!paren && sym) sym = isalnum(*p);
+        p--;
+    } while (paren || sym);
+    p++;
+    // skip leading spaces
+    while (isspace(*p) && p < b->end-1) p++;
+
+    char* s = strndup(p, end - p + 1);
+
+    cleareos();
+    printf("\n======================================\n");
+    printf("EVAL: %s\n", s);
+    printf("--------------------------------------\n");
+#ifdef NO_MAIN
+    run(s, global_envp);
+#else
+    printf("ERROR - no eval/run method - install esp-lisp!\n");
+#endif
+    printf("\n------------------------------------\n");
+    printf("(Press CTRL-L to clear!)\n");
+    free(s);
+}
+
 // TODO: ugly...
 #ifdef OTA
   #define NO_MAIN
@@ -399,7 +445,7 @@
     savescreen();
     update(b, 1);

-    #define WANT() ({if (!b->wantcol) {b->wantcol = b->col; error(b, "-----", "");}})
+    #define WANT() ({if (!b->wantcol) {b->wantcol = b->col; }})
     // loop
     int c;
     while ((c = getch()) || 1) {
@@ -442,7 +488,7 @@
             printf("  [%c %d %d %d] ", c, c, CTRL + 'V', ESC + 'V'); } while (c=getch() != CTRL + 'C');
         else if (c == XTRA + CTRL + 'C') break;
         // lisp interaction TODO: https://www.emacswiki.org/emacs/EvaluatingExpressions
-        else if (c == XTRA + CTRL + 'E') break; // eval expression before point
+        else if (c == XTRA + CTRL + 'E') eval_last_expr(b, p);
         else if (c == META + ':') break; // enter expression on modeline, eval expression
         else if (c == XTRA + CTRL + 'Z') break; // suspend
         else if (c == XTRA + CTRL + 'F') break; // find-file
@@ -454,13 +500,8 @@
         #undef INS

         fix(b, (b->dirty * 10 + b->col) != old);
-
         if (lines != countLines(b)) why = 1;
-
         update(b, why);
-
-        // uncomment to read keys...
-
     }
     return 0;
 }


core_type might be available on ly on hybrid

Change-Id: If7138b92a4417fb3d574a5b488156ad4b10579da

--- cpucounters.h
+++ cpucounters.h
@@ -1188,15 +1188,18 @@

     std::pair<unsigned, unsigned> getOCREventNr(const int event, const unsigned coreID) const
     {
-        assert (coreID < topology.size());
-        switch (cpu_model)
-        {
+       assert (coreID < topology.size());
+       if (hybrid)
+       {
+            switch (cpu_model)
+            {
             case ADL:
                 if (topology[coreID].core_type == TopologyEntry::Atom)
                 {
                     return std::make_pair(OFFCORE_RESPONSE_0_EVTNR, event + 1);
                 }
                 break;
+            }
        }
        bool useGLCOCREvent = false;
        switch (cpu_model)


thanm: Make image_t store unsigned chars instead of chars.

--- image.h
+++ image.h
@@ -58,7 +58,7 @@
     format_t format);

 typedef struct {
-    char* data;
+    unsigned char* data;
     unsigned int width;
     unsigned int height;
     format_t format;


ImVector: Tweaked reserve() flow to avoid calling MemFree(NULL) which is unnecessary. (#1796)

--- imgui.h
+++ imgui.h
@@ -1235,8 +1235,10 @@
             return;
         value_type* new_data = (value_type*)ImGui::MemAlloc((size_t)new_capacity * sizeof(value_type));
         if (Data)
+        {
             memcpy(new_data, Data, (size_t)Size * sizeof(value_type));
-        ImGui::MemFree(Data);
+            ImGui::MemFree(Data);
+        }
         Data = new_data;
         Capacity = new_capacity;
     }


Comments

Comments

--- imgui.h
+++ imgui.h
@@ -522,12 +522,16 @@
     IMGUI_API void          CaptureKeyboardFromApp(bool capture = true);                        // manually override io.WantCaptureKeyboard flag next frame (said flag is entirely left for your application handle). e.g. force capture keyboard when your widget is being hovered.
     IMGUI_API void          CaptureMouseFromApp(bool capture = true);                           // manually override io.WantCaptureMouse flag next frame (said flag is entirely left for your application handle).

-    // Helpers functions to access memory allocators and clipboard functions.
+    // Clipboard Utilities (also see the LogToClipboard() function to capture or output text data to the clipboard)
+    IMGUI_API const char*   GetClipboardText();
+    IMGUI_API void          SetClipboardText(const char* text);
+
+    // Memory Utilities
+    // All those functions are not reliant on the current context.
+    // If you reload the contents of imgui.cpp at runtime, you may need to call SetCurrentContext() + SetAllocatorFunctions() again.
     IMGUI_API void          SetAllocatorFunctions(void* (*alloc_func)(size_t sz, void* user_data), void(*free_func)(void* ptr, void* user_data), void* user_data = NULL);
     IMGUI_API void*         MemAlloc(size_t size);
     IMGUI_API void          MemFree(void* ptr);
-    IMGUI_API const char*   GetClipboardText();
-    IMGUI_API void          SetClipboardText(const char* text);

 } // namespace ImGui


fixed a bug where lights would overflow the grid when playing high up on the drum layout

--- src/layout.c
+++ src/layout.c
@@ -162,7 +162,7 @@
     }

     u8 offset = note_number - start_note;
-    s8 quadrant = offset / NUM_NOTES;
+    s8 quadrant = min(3, offset / NUM_NOTES);
     u8 quadrant_offset = offset - quadrant * NUM_NOTES;
     u8 quadrant_row = quadrant_offset / DRUM_SIZE;


* src/libvlc.c: cosmetic fix.

* src/libvlc.c: cosmetic fix.

--- src/libvlc.c
+++ src/libvlc.c
@@ -2614,8 +2614,9 @@
         while( vlc_iconv( libvlc.from_locale, &iptr, &inb, &optr, &outb )
                                                                == (size_t)-1 )
         {
-            *optr++ = '?';
-            *iptr++;
+            *optr = '?';
+            optr++;
+            iptr++;
             vlc_iconv( libvlc.from_locale, NULL, NULL, NULL, NULL );
         }
         vlc_mutex_unlock( &libvlc.from_locale_lock );
@@ -2654,8 +2655,9 @@
         while( vlc_iconv( libvlc.to_locale, &iptr, &inb, &optr, &outb )
                                                                == (size_t)-1 )
         {
-            *optr++ = '?'; /* should not happen, and yes, it sucks */
-            *iptr++;
+            *optr = '?'; /* should not happen, and yes, it sucks */
+            optr++;
+            iptr++;
             vlc_iconv( libvlc.to_locale, NULL, NULL, NULL, NULL );
         }
         vlc_mutex_unlock( &libvlc.to_locale_lock );


Using default icon theme

Using default icon theme

--- src/mailer.c
+++ src/mailer.c
@@ -92,8 +92,7 @@
 				on_closex), NULL);
 	vbox = gtk_vbox_new(FALSE, 0);
 	/* theme */
-	mailer->theme = gtk_icon_theme_new();
-	gtk_icon_theme_set_custom_theme(mailer->theme, "gnome");
+	mailer->theme = gtk_icon_theme_get_default();
 	/* menubar */
 	widget = common_new_menubar(_mailer_menubar, mailer);
 	gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, FALSE, 0);


Set the online toggle button the size of a menu entry

--- src/mailer.c
+++ src/mailer.c
@@ -1045,7 +1045,7 @@
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mailer->st_online),
 			online);
 	image = gtk_image_new_from_stock(online ? GTK_STOCK_CONNECT
-			: GTK_STOCK_DISCONNECT, GTK_ICON_SIZE_BUTTON);
+			: GTK_STOCK_DISCONNECT, GTK_ICON_SIZE_MENU);
 	gtk_button_set_image(GTK_BUTTON(mailer->st_online), image);
 	for(i = 0; i < mailer->account_cnt; i++)
 		if(online)


Explicitly compare pointers to not NULL

Explicitly compare pointers to not NULL

--- input.c
+++ input.c
@@ -293,7 +293,7 @@
 		 */
 		freq_reset = 0;
 		if (realfreq < hw.freq / 2 || realfreq > hw.freq * 3/2) {
-			if (logfile)
+			if (logfile != NULL)
 				fprintf(logfile, realfreq < hw.freq / 2 ?
 				    "<" : ">");
 			realfreq = hw.freq;
@@ -381,7 +381,7 @@
 		outch = '_';
 	}
 report:
-	if (logfile) {
+	if (logfile != NULL) {
 		fprintf(logfile, "%c", outch);
 		if (state & GETBIT_EOM)
 			fprintf(logfile, "\n");


mark only standard io handles

mark only standard io handles

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

--- io/io.c
+++ io/io.c
@@ -1198,7 +1198,10 @@
     INTVAL i;
     ParrotIOTable table = piodata->table;

-    for (i = 0; i < PIO_NR_OPEN; i++) {
+    /* this was i < PIO_NR_OPEN, but only standard handles 0..2 need
+     * to be kept alive AFAIK -leo
+     */
+    for (i = 0; i < 3; i++) {
         if (table[i]) {
             pobject_lives(interpreter, (PObj *)table[i]);
         }


autofs: rework pipe search logic a bit

autofs: rework pipe search logic a bit

No not return error from autofs_find_pipe_read_end, if pipe end wasn't found,
because read_fd remains negative.
There is another explicit check in the caller of this function for read_fd and
proper messages are printed in such a case.
Return -ENOENT in case of read end of the pipe doesn't exist to distinguish
with other error types (will be used later).

Signed-off-by: Stanislav Kinsburskiy <43b28e187c4fe6e53d7ab0bb71957481e322f182@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <c9a32589e048e044184536f7ac71ef92fe82df3e@virtuozzo.com>

--- criu/autofs.c
+++ criu/autofs.c
@@ -141,21 +141,23 @@

 		if (fstatat(dirfd(dir), de->d_name, &buf, 0) < 0) {
 			pr_perror("Failed to fstatat");
+			goto out;
+		}
+
+		fd = atoi(de->d_name);
+
+		found = autofs_check_fd_stat(&buf, pgrp, fd, ino, &mode);
+		if (found < 0)
+			goto out;
+		if (found && (mode == O_RDONLY)) {
+			*read_fd = fd;
 			break;
 		}
-
-		fd = atoi(de->d_name);
-
-		found = autofs_check_fd_stat(&buf, pgrp, fd, ino, &mode);
-		if (found < 0)
-			break;
-		if (found && (mode == O_RDONLY)) {
-			*read_fd = fd;
-			ret = 0;
-			break;
-		}
-	}
-
+	}
+
+	ret = 0;
+
+out:
 	closedir(dir);
 	close_pid_proc();

@@ -177,7 +179,7 @@
 		pr_err("Master %d doesn't have a read end of the pipe with "
 			"inode %ld opened\n", pgrp, pipe_ino);
 		pr_err("Abandoned mount or control was delegated to child?\n");
-		return -1;
+		return -ENOENT;
 	}

 	/* Let's check, that read end is empty */


tcp: don't leak a file descriptor

tcp: don't leak a file descriptor

CID 164719 (#1 of 1): Resource leak (RESOURCE_LEAK)
7. leaked_handle: Handle variable sk going out of scope leaks the handle.

Signed-off-by: Andrew Vagin <74c05afa918858348d6db8037d82fa8124870113@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <c9a32589e048e044184536f7ac71ef92fe82df3e@virtuozzo.com>

--- criu/sk-tcp.c
+++ criu/sk-tcp.c
@@ -840,6 +840,7 @@
 		if (errno == EPERM) {
 			kdat.has_tcp_window = false;
 			pr_warn("TCP_REPAIR isn't available to unprivileged users\n");
+			close(sk);
 			return 0;
 		}
 		pr_perror("Unable to set TCP_REPAIR");


Small indent

Small indent

--- src/testApp.h
+++ src/testApp.h
@@ -71,13 +71,13 @@
         void windowResized(int w, int h);
         void dragEvent(ofDragInfo dragInfo);
         void gotMessage(ofMessage msg);
-    /** @} */
-
-
-    /**
-     The Constructor takes the facebook userid and looks for that particular uid in the Images folder
-     @param a long long it
-     */
+        /** @} */
+
+
+        /**
+         The Constructor takes the facebook userid and looks for that particular uid in the Images folder
+         @param a long long it
+         */
         testApp(long long int uid);


Remove sg-utils test output

Remove sg-utils test output

More bulk cleanup on the path to removing sg-utils dependencies.  Trying to make
test-sg as simple as possible so I can use it reliably to test on both master and my
killsg branch

--- src/test_sg.c
+++ src/test_sg.c
@@ -14,7 +14,6 @@

 int main(int argc, char *argv[]) {
 	// set scpi lib debug level: 0 for no debug info, 10 for lots
-	const int scsi_verbose = 2;
 	char *dev_name;

 	switch (argc) {
@@ -37,14 +36,11 @@
 		return EXIT_FAILURE;
 	}

-	fputs("*** stlink access test ***\n", stderr);
-	fprintf(stderr, "Using sg_lib %s : scsi_pt %s\n", sg_lib_version(),
-		scsi_pt_version());
-
-	stlink_t *sl = stlink_quirk_open(dev_name, scsi_verbose);
+	stlink_t *sl = stlink_quirk_open(dev_name, 10);
 	if (sl == NULL)
 		return EXIT_FAILURE;
-
+
+
 	// we are in mass mode, go to swd
 	stlink_enter_swd_mode(sl);
 	stlink_current_mode(sl);
@@ -176,7 +172,7 @@
 	stlink_force_debug(sl);
 	stlink_status(sl);
 #endif
-#if 1 /* read the system bootloader */
+#if 0 /* read the system bootloader */
 	fputs("\n++++++++++ reading bootloader ++++++++++++++++\n\n", stderr);
 	stlink_fread(sl, "/tmp/barfoo", sl->sys_base, sl->sys_size);
 #endif
@@ -202,6 +198,7 @@
 	stlink_run_at(sl, sl->sram_base);
 #endif

+#if 0
 	stlink_run(sl);
 	stlink_status(sl);
 	//----------------------------------------------------------------------
@@ -209,6 +206,7 @@
 	stlink_exit_debug_mode(sl);
 	stlink_current_mode(sl);
 	stlink_close(sl);
+#endif

 	//fflush(stderr); fflush(stdout);
 	return EXIT_SUCCESS;


delete fallback code

delete fallback code

--- src/testdir.c
+++ src/testdir.c
@@ -333,15 +333,11 @@
 		targ->retString = NULL;

 		int ret = CreateDetachedThread(__ExecScriptWorkerThreadLegacy, targ);
-		if (ret != 0) { //fallback
-			c->ret = Spawn(s->repairBinTimeout, s, c->path, c->path, targ->mode,
-				       NULL);
-			free((void*)targ->retString);
-			free((void*)targ->mode);
-			free((void*)targ);
-		} else {
-			ThrottleWorkerThreadCreation(s);
-		}
+		if (ret != 0) {
+			Logmsg(LOG_ERR, "Unable to create thread %s", strerror(-ret));
+			abort();
+		}
+		ThrottleWorkerThreadCreation(s);
 	}

 	c = NULL;
@@ -381,13 +377,10 @@
 		int ret = CreateDetachedThread(__ExecScriptWorkerThreadLegacy, targ);

 		if (ret != 0) {
-			c->ret = Spawn(s->repairBinTimeout, s, c->path, c->path, targ->mode,
-				       targ->retString, NULL);
-			free((void*)targ->mode);
-			free((void*)targ->retString);
-			free((void*)targ);
-		}
-
+			Logmsg(LOG_ERR, "Unable to create thread %s", strerror(-ret));
+			abort();
+		}
+
 		if (next == NULL) {
 			pthread_barrier_wait(&targ->barrier);
 			pthread_barrier_destroy(&targ->barrier);


Plug yet another fd leak

Plug yet another fd leak

--- src/threads.c
+++ src/threads.c
@@ -391,6 +391,7 @@
 				close(fd);
 				if (s->options & SOFTBOOT) {
 					s->error |= PIDFILERROR;
+					close(fd);
 					break;
 				} else {
 					continue;


refactor

refactor

--- src/tlerror.h
+++ src/tlerror.h
@@ -48,7 +48,7 @@
 struct TLError {};

 template <typename T, typename B>
-using base_of_t = typename std::enable_if<std::is_base_of<B, T>::value, T>::type;
+using base_of_t = std::enable_if_t<std::is_base_of<B, T>::value, T>;

 #define DEFINE_TLError(E, fmt) \


trie: added missing padding in kvs' calc_bucket.

--- src/trie/kv.c
+++ src/trie/kv.c
@@ -254,6 +254,9 @@
     leftover -= info->key.prefix_bits;
     leftover -= info->val.prefix_bits;

+    /* padding before the states bitfield */
+    if (leftover % 8) leftover += 8 - (leftover % 8);
+
     if (info->key.bits < 8) {
         size_t abs_buckets = 1ULL << info->key.bits;
         size_t abs_bucket_bits = info->val.bits ? info->val.bits : 1;


Grouping window updates.

Grouping window updates.

--- src/ui/view.c
+++ src/ui/view.c
@@ -63,7 +63,9 @@
 static void restyle_focus_item(struct mainwindow *mw, int style){
 	style=FI_STYLE(style);
 	restyle_window(body_w[cursor_i],style);
+	wrefresh(body_w[cursor_i]);
 	print_crop(body_w[cursor_i],mw->data.lv[cursor_i].line,BODY_WIDTH);
+	doupdate();
 }

 int low_item(struct mainwindow *mw){
@@ -212,17 +214,17 @@

 void clear_display(){
 	int i;
-
+/*
 	clear();
 	//erase();
 	refresh();
 	return;
-
-	wrefresh(titl_w);
-	wrefresh(head_w);
-	wrefresh(foot_w);
+*/
+	wclear(titl_w);
+	wclear(head_w);
+	wclear(foot_w);
 	for(i=0;i<bw_len;i++)
-		wrefresh(body_w[i]);
+		wclear(body_w[i]);
 }

 void regen_windows(struct mainwindow *mw){
@@ -320,7 +322,8 @@
 		str[i]=' ';
 	str[max]=0;
 	mvwprintw(w,0,0,"%ls",str);
-	wrefresh(w);
+	//wrefresh(w);
+	wnoutrefresh(w);

 	return ret;
 }
@@ -353,6 +356,8 @@
 		if(print_crop(body_w[i],mw->data.lv[i].line,BODY_WIDTH))
 			content_bw_max=i;
 	}
+
+	doupdate();
 }

 void catchresize(int sig){


Unbreak Windows build after UTF-16 change (sys/types.h does not define
int32_t on Windows).
Review URL: https://chromiumcodereview.appspot.com/9669051

git-svn-id: b158db1e4b4ab85d4c9e510fdef4b1e8c614b15b@11009 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

--- src/unicode.h
+++ src/unicode.h
@@ -117,19 +117,19 @@

 class Utf16 {
  public:
-  static inline bool IsLeadSurrogate(int32_t code) {
+  static inline bool IsLeadSurrogate(int code) {
     if (code == kNoPreviousCharacter) return false;
     return (code & 0xfc00) == 0xd800;
   }
-  static inline bool IsTrailSurrogate(int32_t code) {
+  static inline bool IsTrailSurrogate(int code) {
     if (code == kNoPreviousCharacter) return false;
     return (code & 0xfc00) == 0xdc00;
   }

-  static inline int32_t CombineSurrogatePair(uchar lead, uchar trail) {
+  static inline int CombineSurrogatePair(uchar lead, uchar trail) {
     return 0x10000 + ((lead & 0x3ff) << 10) + (trail & 0x3ff);
   }
-  static const int32_t kNoPreviousCharacter = -1;
+  static const int kNoPreviousCharacter = -1;
   static const uchar kMaxNonSurrogateCharCode = 0xffff;
   // Encoding a single UTF-16 code unit will produce 1, 2 or 3 bytes
   // of UTF-8 data.  The special case where the unit is a surrogate
@@ -140,10 +140,10 @@
   // One UTF-16 surrogate is endoded (illegally) as 3 UTF-8 bytes.
   // The illegality stems from the surrogate not being part of a pair.
   static const int kUtf8BytesToCodeASurrogate = 3;
-  static inline uchar LeadSurrogate(int32_t char_code) {
+  static inline uchar LeadSurrogate(int char_code) {
     return 0xd800 + (((char_code - 0x10000) >> 10) & 0x3ff);
   }
-  static inline uchar TrailSurrogate(int32_t char_code) {
+  static inline uchar TrailSurrogate(int char_code) {
     return 0xdc00 + (char_code & 0x3ff);
   }
 };


Add irc_hook_ext_dispatch examples

Add irc_hook_ext_dispatch examples

--- src/unicorn.h
+++ src/unicorn.h
@@ -199,6 +199,15 @@
 // parv[0] and parv[1] will be empty strings and parv[2] will be the
 // server name. If there is no source, then all of parv[0], parv[1],
 // and parv[2] will be empty.
+//
+// Examples:
+//   ":aji!alex@asu.edu JOIN #lobby"
+//       calls "JOIN" with arguments "aji", "alex", "asu.edu", "#lobby"
+//   "PING :t4.general.asu.edu"
+//       calls "PING" with arguments "", "", "", "t4.general.asu.edu"
+//   ":t4.general.asu.edu NOTICE :*** Notice -- Looking up your hostname"
+//       calls "NOTICE" with arguments "", "", "t4.general.asu.edu",
+//       "*** Notice -- Looking up your hostname"
 extern int irc_hook_ext_dispatch(irc_hook_table_t *table, irc_message_t *msg);

 #endif


update uoj17_5

update uoj17_5

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

--- src/uoj17_5.c
+++ src/uoj17_5.c
@@ -0,0 +1,18 @@
+#include "stdio.h"
+int main(int argc, char const *argv[])
+{
+	char ch;
+	char fb=1;
+	int count=0;
+	while((ch=getchar())!='\n'){
+		if(ch==' '){
+			fb=1;
+		}else{
+			if(fb){
+				count++;
+			}
+		}
+	}
+	printf("%d\n",count);
+	return 0;
+}


Add space

Add space

--- src/utl_log.h
+++ src/utl_log.h
@@ -83,9 +83,9 @@
 #endif

 #ifndef UTL_NDEBUG
-#define logcheck(e)    utl_log_check(!!(e),#e,__FILE__,__LINE__)
-#define logassert(e)   utl_log_assert(!!(e),#e,__FILE__,__LINE__)
-#define logexpect(e,...) (logcheck(e)? 1 :(logprintf(__VA_ARGS__),0))
+#define logcheck(e)       utl_log_check(!!(e),#e,__FILE__,__LINE__)
+#define logassert(e)      utl_log_assert(!!(e),#e,__FILE__,__LINE__)
+#define logexpect(e,...) (utl_log_check(!!(e),#e,__FILE__,__LINE__)? 1 :(logprintf(__VA_ARGS__),0))
 #define logclock       for(clock_t utl_log_clk = clock();\
                                utl_log_clk != (clock_t)-1; \
                                   (utl_log_dbglvl <= UTL_LOG_D)?utl_log_prt("CLK %ld/%ld sec.\x09:%s:%d\x09",(clock()-utl_log_clk), (long int)CLOCKS_PER_SEC,__FILE__,__LINE__):1,\
@@ -118,7 +118,7 @@

 #define _logprintf(...)
 #define _logcheck(...)      utl_ret(1)
-#define _logexepect(...)    utl_ret(1)
+#define _logexpect(...)     utl_ret(1)
 #define _logassert(...)
 #define _logopen(f,m)       utl_retptr(NULL)
 #define _logclose()         utl_ret(0)
@@ -128,7 +128,7 @@
 #define _logwarning(...)
 #define _logerror(...)
 #define _logtrace(...)
-#define _logtracewatch(...)
+#define _logwatch(...)

 extern FILE *utl_log_file;


Version is now 2.1.2

Version is now 2.1.2

--- src/version.h
+++ src/version.h
@@ -1 +1 @@
-#define REDIS_VERSION "2.1.1"
+#define REDIS_VERSION "2.1.2"


1.4.19

--- src/version.h
+++ src/version.h
@@ -1,7 +1,7 @@
 /*
  * This file is part of DGD, https://github.com/dworkin/dgd
  * Copyright (C) 1993-2010 Dworkin B.V.
- * Copyright (C) 2010-2012 DGD Authors (see the commit log for details)
+ * Copyright (C) 2010-2013 DGD Authors (see the commit log for details)
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as
@@ -17,4 +17,4 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */

-# define VERSION	"DGD 1.4.18"
+# define VERSION	"DGD 1.4.19"


Update version.h

Update version.h

--- src/version.h
+++ src/version.h
@@ -31,7 +31,7 @@
 static const int POW_CLIENT_VERSION = 80701;
 static const int POW_PROTOCOL_VERSION = 70002;
 static const int POW_TX_VERSION = 3;
-static const int POW_BLOCK_VERSION = 1;
+static const int POW_BLOCK_VERSION = 2;

 // network protocol versioning
 //


reset protocol to orig value

reset protocol to orig value

--- src/version.h
+++ src/version.h
@@ -46,7 +46,7 @@
 // network protocol versioning
 //

-static const int PROTOCOL_VERSION = 60004;
+static const int PROTOCOL_VERSION = 60003;

 // earlier versions not supported as of Feb 2012, and are disconnected
 // NOTE: as of bitcoin v0.6 message serialization (vSend, vRecv) still


version up

version up

--- src/version.h
+++ src/version.h
@@ -15,9 +15,9 @@

 static const int CLIENT_VERSION =
                            1000000 * CLIENT_VERSION_MAJOR
-                         +   00000 * CLIENT_VERSION_MINOR
-                         +     000 * CLIENT_VERSION_REVISION
-                         +       0 * CLIENT_VERSION_BUILD;
+                         +   10000 * CLIENT_VERSION_MINOR
+                         +     100 * CLIENT_VERSION_REVISION
+                         +       1 * CLIENT_VERSION_BUILD;

 extern const std::string CLIENT_NAME;
 extern const std::string CLIENT_BUILD;


Update version.h

Update version.h

Set version for release.

--- src/version.h
+++ src/version.h
@@ -1 +1 @@
-#define PYMSSQL_VERSION "2.1.4.rc2"
+#define PYMSSQL_VERSION "2.1.4"


master: ignore eff, rtr and error frames

--- src/master.c
+++ src/master.c
@@ -1337,6 +1337,24 @@
 			unload_driver(i);
 }

+static void apply_filters(int fd)
+{
+	struct can_filter filter[] = {
+		{
+			.can_id = CAN_INV_FILTER | CAN_EFF_FLAG,
+			.can_mask = CAN_EFF_FLAG
+		}, {
+			.can_id = CAN_INV_FILTER | CAN_RTR_FLAG,
+			.can_mask = CAN_RTR_FLAG
+		}, {
+			.can_id = CAN_INV_FILTER | CAN_ERR_FLAG,
+			.can_mask = CAN_ERR_FLAG
+		}
+	};
+
+	socketcan_apply_filters(fd, filter, 3);
+}
+
 __attribute__((visibility("default")))
 int co_master_run(void)
 {
@@ -1372,6 +1390,9 @@
 		goto socketcan_open_failure;
 	}

+	if (sock_type == SOCK_TYPE_CAN)
+		apply_filters(socket_.fd);
+
 #ifndef NO_MAREL_CODE
 	if (canopen_info_init(cfg.iface) < 0) {
 		perror("Could not initialize info structure");


Modules: no MULTI/EXEC for commands replicated from async contexts.

They are technically like commands executed from external clients one
after the other, and do not constitute a single atomic entity.

--- src/module.c
+++ src/module.c
@@ -1163,7 +1163,12 @@
  * in the context of a command execution. EXEC will be handled by the
  * RedisModuleCommandDispatcher() function. */
 void moduleReplicateMultiIfNeeded(RedisModuleCtx *ctx) {
+    /* If we already emitted MULTI return ASAP. */
     if (ctx->flags & REDISMODULE_CTX_MULTI_EMITTED) return;
+    /* If this is a thread safe context, we do not want to wrap commands
+     * executed into MUTLI/EXEC, they are executed as single commands
+     * from an external client in essence. */
+    if (ctx->flags & REDISMODULE_CTX_THREAD_SAFE) return;
     execCommandPropagateMulti(ctx->client);
     ctx->flags |= REDISMODULE_CTX_MULTI_EMITTED;
 }


Remove rogue whitespace in win_xcb.c

Remove rogue whitespace in win_xcb.c

--- src/win_xcb.c
+++ src/win_xcb.c
@@ -229,7 +229,7 @@
 {
     xcb_get_geometry_reply_t *geom_r = get_geom(wid);
     if(!geom_r)
-        return -1;
+        return -1;

     int y = geom_r->y;
     free(geom_r);
@@ -247,11 +247,11 @@
 {
     xcb_get_geometry_reply_t *geom_r = get_geom(wid);
     if(!geom_r)
-        return -1;
+        return -1;

     int bw = geom_r->border_width;
     free(geom_r);
-    return bw;
+    return bw;
 }

 void set_border_width(int wid, int width)
@@ -272,7 +272,7 @@
 {
     xcb_get_window_attributes_reply_t *attr_r = get_attr(wid);
     if(!attr_r)
-        return -1;
+        return -1;

     int map_state = attr_r->map_state;
     free(attr_r);
@@ -379,7 +379,7 @@
 	xcb_flush(conn);

 	char *event_string;
-	bool done;
+	bool done;
 	while(!done){
 		xcb_generic_event_t *event = xcb_wait_for_event(conn);
 		int wid;


src/nolibc: Fix `malloc()` alignment

src/nolibc: Fix `malloc()` alignment

Add `__attribute__((__aligned__))` to the `user_p` to guarantee
pointer returned by the `malloc()` is properly aligned for user.

This attribute asks the compiler to align a type to the maximum
useful alignment for the target machine we are compiling for,
which is often, but by no means always, 8 or 16 bytes [1].

Link: https://gcc.gnu.org/onlinedocs/gcc-11.2.0/gcc/Common-Variable-Attributes.html#Common-Variable-Attributes [1]
Fixes: https://github.com/axboe/liburing/issues/454
Reported-by: Louvian Lyndal <11eedcff86170ee6b74d67d75ab00cd71ae18465@gmail.com>
Signed-off-by: Ammar Faizi <0d988a99f192f3d558e868bf3333f67e1ba6e8d8@students.amikom.ac.id>
Link: https://lore.kernel.org/r/20211011064927.444704-1-0d988a99f192f3d558e868bf3333f67e1ba6e8d8@students.amikom.ac.id
Signed-off-by: Jens Axboe <cd8c6775e60d6f67a6984377324e5290df3d5358@kernel.dk>

--- src/nolibc.c
+++ src/nolibc.c
@@ -20,7 +20,7 @@

 struct uring_heap {
 	size_t		len;
-	char		user_p[];
+	char		user_p[] __attribute__((__aligned__));
 };

 void *malloc(size_t len)


CHG: optimization of getNextTask function

Signed-off-by: Giuseppe Monteleone <59bd0a3ff43b32849b319e645d4798d8a5d1e889@ing-monteleone.com>

--- src/os/yos.c
+++ src/os/yos.c
@@ -223,14 +223,14 @@
 UNUSED
 YOS_KERNEL(getNextTask)
 static void getNextTask(void) {
-	bool addTask = true;
-#if USE_IDLE_TASK
-	if (sCurrentTask == sIdleTask)
-		addTask = false;
-#endif
-
-	if (sCurrentTask->tWait == 0 && addTask)
-		taskEnqueue(&sTaskList,sCurrentTask);
+	if (sCurrentTask->tWait == 0) {
+#ifdef USE_IDLE
+		if (sCurrentTask != sIdleTask)
+#endif
+		{
+			taskEnqueue(&sTaskList,sCurrentTask);
+		}
+	}

 	sLeavingTask = sCurrentTask;
 	sCurrentTask = taskDequeue(&sTaskList);


[0.05] - Fixed syntax errors.

[0.05]
- Fixed syntax errors.

git-svn-id: 353d3467f7ad5dcb5400e8eeab2ebeea9c62ce43@188 c02c618c-1a3f-4eb4-9619-0621aa290f9c

--- srm_oparray.c
+++ srm_oparray.c
@@ -17,7 +17,7 @@
    |           Marcus Brger <marcus.boerger@t-online.de>                 |
    +----------------------------------------------------------------------+
  */
-/* $Id: srm_oparray.c,v 1.56 2008-10-22 08:40:06 derick Exp $ */
+/* $Id: srm_oparray.c,v 1.57 2008-10-23 11:05:07 derick Exp $ */

 #include "php.h"
 #include "zend_alloc.h"
@@ -545,8 +545,8 @@
 		VLD_PRINT(3, " RES[ ");
 		len = vld_dump_znode (NULL, op.result, base_address TSRMLS_CC);
 		VLD_PRINT(3, " ]");
-		if VLD_G(format)) {
-			if len==0) {
+		if (VLD_G(format)) {
+			if (len==0) {
 				vld_printf(stderr, " ");
 			}
 		} else {
@@ -610,7 +610,7 @@

 	set = vld_set_create(opa->size);
 	vld_analyse_branch(opa, 0, set TSRMLS_CC);
-	if VLD_G(format)) {
+	if (VLD_G(format)) {
 		vld_printf (stderr, "filename:%s%s\n", VLD_G(col_sep), opa->filename);
 		vld_printf (stderr, "function name:%s" ZSTRFMT "\n", VLD_G(col_sep), ZSTRCP(opa->function_name));
 		vld_printf (stderr, "number of ops:%s%d\n", VLD_G(col_sep), opa->last);


parser BUGFIX dollar signs in patterns must be escaped for pcre

Fixes #374

--- src/parser.c
+++ src/parser.c
@@ -1127,9 +1127,9 @@
 int
 lyp_check_pattern(const char *pattern, pcre **pcre_precomp)
 {
-    int idx, start, end, err_offset;
+    int idx, start, end, err_offset, dol_count;
     char *perl_regex, *ptr;
-    const char *err_msg;
+    const char *err_msg, *orig_ptr;
     pcre *precomp;

     /*
@@ -1137,11 +1137,36 @@
      *
      * http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#regexs
      */
-    perl_regex = malloc((strlen(pattern) + 2) * sizeof(char));
+
+    /* we need to replace all "$" with "\$", count them now */
+    for (dol_count = 0, ptr = strchr(pattern, '$'); ptr; ++dol_count, ptr = strchr(ptr + 1, '$'));
+
+    perl_regex = malloc((strlen(pattern) + 4 + dol_count) * sizeof(char));
     LY_CHECK_ERR_RETURN(!perl_regex, LOGMEM, EXIT_FAILURE);
-    strcpy(perl_regex, pattern);
+    perl_regex[0] = '\0';
+
+    ptr = perl_regex;
+
     if (strncmp(pattern + strlen(pattern) - 2, ".*", 2)) {
-        strcat(perl_regex, "$");
+        /* we wil add line-end anchoring */
+        ptr[0] = '(';
+        ++ptr;
+    }
+
+    for (orig_ptr = pattern; orig_ptr[0]; ++orig_ptr) {
+        if (orig_ptr[0] == '$') {
+            ptr += sprintf(ptr, "\\$");
+        } else {
+            ptr[0] = orig_ptr[0];
+            ++ptr;
+        }
+    }
+
+    if (strncmp(pattern + strlen(pattern) - 2, ".*", 2)) {
+        ptr += sprintf(ptr, ")$");
+    } else {
+        ptr[0] = '\0';
+        ++ptr;
     }

     /* substitute Unicode Character Blocks with exact Character Ranges */


DTLS fixes for signed/unsigned issues

DTLS fixes for signed/unsigned issues

Reviewed-by: Emilia Käsper <6521fc25e7624eef7c3a0d89b71de7e612d27d37@openssl.org>

--- ssl/d1_both.c
+++ ssl/d1_both.c
@@ -259,9 +259,9 @@
 int dtls1_do_write(SSL *s, int type)
 	{
 	int ret;
-	int curr_mtu;
+	unsigned int curr_mtu;
 	int retry = 1;
-	unsigned int len, frag_off, mac_size, blocksize;
+	unsigned int len, frag_off, mac_size, blocksize, used_len;

 	if(!dtls1_query_mtu(s))
 		return -1;
@@ -289,10 +289,15 @@
 		blocksize = 0;

 	frag_off = 0;
-	while( s->init_num)
-		{
-		curr_mtu = s->d1->mtu - BIO_wpending(SSL_get_wbio(s)) -
-			DTLS1_RT_HEADER_LENGTH - mac_size - blocksize;
+	/* s->init_num shouldn't ever be < 0...but just in case */
+	while( s->init_num > 0)
+		{
+		used_len = BIO_wpending(SSL_get_wbio(s)) +  DTLS1_RT_HEADER_LENGTH
+			+ mac_size + blocksize;
+		if(s->d1->mtu > used_len)
+			curr_mtu = s->d1->mtu - used_len;
+		else
+			curr_mtu = 0;

 		if ( curr_mtu <= DTLS1_HM_HEADER_LENGTH)
 			{
@@ -300,15 +305,23 @@
 			ret = BIO_flush(SSL_get_wbio(s));
 			if ( ret <= 0)
 				return ret;
-			curr_mtu = s->d1->mtu - DTLS1_RT_HEADER_LENGTH -
-				mac_size - blocksize;
-			}
-
-		if ( s->init_num > curr_mtu)
+			used_len = DTLS1_RT_HEADER_LENGTH + mac_size + blocksize;
+			if(s->d1->mtu > used_len + DTLS1_HM_HEADER_LENGTH)
+				curr_mtu = s->d1->mtu - used_len;
+			else
+				/* Shouldn't happen */
+				return -1;
+			}
+
+		/* We just checked that s->init_num > 0 so this cast should be safe */
+		if (((unsigned int)s->init_num) > curr_mtu)
 			len = curr_mtu;
 		else
 			len = s->init_num;

+		/* Shouldn't ever happen */
+		if(len > INT_MAX)
+			len = INT_MAX;

 		/* XDTLS: this function is too long.  split out the CCS part */
 		if ( type == SSL3_RT_HANDSHAKE)
@@ -319,11 +332,16 @@
 				s->init_off -= DTLS1_HM_HEADER_LENGTH;
 				s->init_num += DTLS1_HM_HEADER_LENGTH;

-				if ( s->init_num > curr_mtu)
+				/* We just checked that s->init_num > 0 so this cast should be safe */
+				if (((unsigned int)s->init_num) > curr_mtu)
 					len = curr_mtu;
 				else
 					len = s->init_num;
 				}
+
+			/* Shouldn't ever happen */
+			if(len > INT_MAX)
+				len = INT_MAX;

 			if ( len < DTLS1_HM_HEADER_LENGTH )
 				{


fix regression like   eval("'test'") === 'test'   directive is StringLiteral at the same time

--- src/parser.h
+++ src/parser.h
@@ -312,6 +312,7 @@
             line = lexer_.line_number();
         }
         stmt = ParseStatement(CHECK);
+        body->push_back(stmt);
         if (stmt->AsExpressionStatement() &&
             stmt->AsExpressionStatement()->expr()->AsStringLiteral()) {
           Expression* const expr = stmt->AsExpressionStatement()->expr();
@@ -339,7 +340,6 @@
         } else {
           // not directive, like
           // "String", "Comma"
-          body->push_back(stmt);
           break;
         }
       }


Don't compare a just free()d pointer

Don't compare a just free()d pointer

Found by tis-interpreter

Reviewed-by: Rich Salz <rsalz@openssl.org>

GH: #1173

--- ssl/ssl_lib.c
+++ ssl/ssl_lib.c
@@ -948,9 +948,9 @@
         BIO_free(s->bbio);
         s->bbio = NULL;
     }
-    BIO_free_all(s->rbio);
     if (s->wbio != s->rbio)
         BIO_free_all(s->wbio);
+    BIO_free_all(s->rbio);

     BUF_MEM_free(s->init_buf);


DEBUG: Better error if exceptions are still pending

--- src/pl-fli.c
+++ src/pl-fli.c
@@ -3517,6 +3517,8 @@
 PL_raise_exception(term_t exception)
 { GET_LD

+  save_backtrace("exception");
+
   if ( PL_is_variable(exception) )
     fatalError("Cannot throw variable exception");

@@ -3573,9 +3575,14 @@

 void
 PL_clear_foreign_exception(LocalFrame fr)
-{ Sdprintf("Foreign predicate %s did not clear exception",
+{ term_t ex = PL_exception(0);
+
+  Sdprintf("Foreign predicate %s did not clear exception: ",
 	   predicateName(fr->predicate));
-
+  PL_write_term(Serror, ex, 1200, 0);
+  Sdprintf("\n");
+  print_backtrace_named("exception");
+
   PL_clear_exception();
 }


Fix in ssltest is no-ssl2 configured (cherry picked from commit cbf9b4aed3e209fe8a39e1d6f55aaf46d1369dc4)

--- ssl/ssltest.c
+++ ssl/ssltest.c
@@ -977,7 +977,13 @@
 		meth=SSLv23_method();
 #else
 #ifdef OPENSSL_NO_SSL2
-	meth=SSLv3_method();
+	if (tls1)
+		meth=TLSv1_method();
+	else
+	if (ssl3)
+		meth=SSLv3_method();
+	else
+		meth=SSLv23_method();
 #else
 	meth=SSLv2_method();
 #endif


fix build on windows (interface keyword)

--- curl-helper.c
+++ curl-helper.c
@@ -22,12 +22,6 @@
 #include "config.h"
 #else
 #pragma message("No config file given.")
-#endif
-
-#if defined(_MSC_VER)
-#ifdef interface
-#undef interface
-#endif
 #endif

 void leave_blocking_section(void);
@@ -156,7 +150,7 @@
     struct curl_slist *postQuote;
     char *cookieFile;
     char *customRequest;
-    char *interface;
+    char *interface_; /* `interface` gives problems on windows */
     char *caInfo;
     char *caPath;
     char *randomFile;
@@ -1219,7 +1213,7 @@
     connection->postQuote = NULL;
     connection->cookieFile = NULL;
     connection->customRequest = NULL;
-    connection->interface = NULL;
+    connection->interface_ = NULL;
     connection->caInfo = NULL;
     connection->caPath = NULL;
     connection->randomFile = NULL;
@@ -1324,7 +1318,7 @@
     connection->postQuote = NULL;
     connection->cookieFile = NULL;
     connection->customRequest = NULL;
-    connection->interface = NULL;
+    connection->interface_ = NULL;
     connection->caInfo = NULL;
     connection->caPath = NULL;
     connection->randomFile = NULL;
@@ -1517,7 +1511,7 @@
     free_curl_slist(connection->postQuote);
     free_if(connection->cookieFile);
     free_if(connection->customRequest);
-    free_if(connection->interface);
+    free_if(connection->interface_);
     free_if(connection->caInfo);
     free_if(connection->caPath);
     free_if(connection->randomFile);
@@ -3455,14 +3449,14 @@

     Store_field(conn->ocamlValues, OcamlInterface, option);

-    if (conn->interface != NULL)
-        free(conn->interface);
-
-    conn->interface = strdup(String_val(option));
+    if (conn->interface_ != NULL)
+        free(conn->interface_);
+
+    conn->interface_ = strdup(String_val(option));

     result = curl_easy_setopt(conn->connection,
                               CURLOPT_INTERFACE,
-                              conn->interface);
+                              conn->interface_);

     if (result != CURLE_OK)
         raiseError(conn, result);


FIXED: memory corruption in '$qlf_info'/5

--- src/pl-wic.c
+++ src/pl-wic.c
@@ -2356,7 +2356,7 @@
     return warning("qlf_info/4: seek failed: %s", OsError());
   nqlf = (int)getInt32(s);
   DEBUG(MSG_QLF_SECTION, Sdprintf("Found %d sources at", nqlf));
-  qlfstart = (size_t*)allocHeapOrHalt(sizeof(long) * nqlf);
+  qlfstart = (size_t*)allocHeapOrHalt(sizeof(size_t) * nqlf);
   Sseek(s, -4 * (nqlf+1), SIO_SEEK_END);
   for(i=0; i<nqlf; i++)
   { qlfstart[i] = (size_t)getInt32(s);


Removed driver interface handling of nopause (it was a bad idea).  Added
call to (*plsc->tidy) [if defined] in plP_tidy.  Added a function
plsMouseEH for setting the mouse event handler (contributed by Radey
Shouman).

svn path=/trunk/; revision=801

--- src/plcore.c
+++ src/plcore.c
@@ -1,6 +1,12 @@
 /* $Id$
  * $Log$
- * Revision 1.28  1994/03/23 08:02:48  mjl
+ * Revision 1.29  1994/04/08 12:31:39  mjl
+ * Removed driver interface handling of nopause (it was a bad idea).  Added
+ * call to (*plsc->tidy) [if defined] in plP_tidy.  Added a function
+ * plsMouseEH for setting the mouse event handler (contributed by Radey
+ * Shouman).
+ *
+ * Revision 1.28  1994/03/23  08:02:48  mjl
  * Provided for handling more basic operations in the driver interface rather
  * than the drivers themselves (pls->nopause, resetting stream parameters
  * after a tidy, etc).  Added support for hardware fill -- if the device does
@@ -94,19 +100,15 @@

 /* End of page */
 /* The plot buffer must be called first */
-/* Nothing done if nopause is set */

 void
 plP_eop(void)
 {
-    plflush();
-    if ( ! plsc->nopause) {
-	if (plsc->plbuf_write)
-	    plbuf_eop(plsc);
-
-	offset = plsc->device - 1;
-	(*dispatch_table[offset].pl_eop) (plsc);
-    }
+    if (plsc->plbuf_write)
+	plbuf_eop(plsc);
+
+    offset = plsc->device - 1;
+    (*dispatch_table[offset].pl_eop) (plsc);
 }

 /* Set up new page. */
@@ -127,6 +129,12 @@
 void
 plP_tidy(void)
 {
+    if (plsc->tidy) {
+	(*plsc->tidy) (plsc->tidy_data);
+	plsc->tidy = NULL;
+	plsc->tidy_data = NULL;
+    }
+
     offset = plsc->device - 1;
     (*dispatch_table[offset].pl_tidy) (plsc);

@@ -1379,6 +1387,7 @@
 	    plexit("plGetDev: Too many tries.");
     }
     plsc->device = dev;
+    strcpy(plsc->DevName, dispatch_table[dev - 1].pl_DevName);
 }

 /*----------------------------------------------------------------------*\
@@ -1530,6 +1539,15 @@
 {
     plsc->KeyEH = KeyEH;
     plsc->KeyEH_data = KeyEH_data;
+}
+
+/* Set the function pointer for the mouse event handler */
+
+void
+plsMouseEH(void (*MouseEH) (PLMouse *, void *, int *), void *MouseEH_data)
+{
+    plsc->MouseEH = MouseEH;
+    plsc->MouseEH_data = MouseEH_data;
 }

 /* Set orientation.  Must be done before calling plinit. */


Correctly treat the case where one or two corners are encircled by the polygon
fill.  I gave up on this problem 9 years ago but it's actually not that bad.
A good test case: run "x16c -dev tk", zoom in on a smallish region, then start
panning around.  An incorrectly clipped region at one of the corners should
soon appear.  This change fixes most occurances of that.

Still todo: handle the encircling

svn path=/trunk/; revision=4836

--- src/plline.c
+++ src/plline.c
@@ -544,9 +544,13 @@
 	   void (*draw) (short *, short *, PLINT))
 {
     PLINT x1, x2, y1, y2;
-    PLINT i, iclp = -1;
-    short xclp[PL_MAXPOLY], yclp[PL_MAXPOLY];
+    int i, iclp = -1;
+    short xclp[2*PL_MAXPOLY], yclp[2*PL_MAXPOLY];
     int drawable;
+    int crossed_xmin1 = 0, crossed_xmax1 = 0;
+    int crossed_ymin1 = 0, crossed_ymax1 = 0;
+    int crossed_xmin2 = 0, crossed_xmax2 = 0;
+    int crossed_ymin2 = 0, crossed_ymax2 = 0;

     for (i = 0; i < npts - 1; i++) {
 	x1 = x[i];
@@ -559,120 +563,131 @@
 	    drawable = ! clipline(&x1, &y1, &x2, &y2, xmin, xmax, ymin, ymax);

 	if (drawable) {
-
-/* Not first point.  If first point of this segment matches up to the
-   previous point, just add it.  */
-
-	    if (iclp >= 0 && x1 == xclp[iclp] && y1 == yclp[iclp]) {
-		iclp++;
-		xclp[iclp] = x2;
-		yclp[iclp] = y2;
-	    }
-
-/* First point of polyline, OR . */
-
-/* If not, we need to add both points, to connect the points in the
- * polygon along the clip boundary.  If any of the previous points were
- * outside one of the 4 corners, assume the corner was encircled and add
- * it first.
- */
+	/* Boundary crossing condition -- coming in. */
+	    crossed_xmin2 = (x1 == xmin); crossed_xmax2 = (x1 == xmax);
+	    crossed_ymin2 = (y1 == ymin); crossed_ymax2 = (y1 == ymax);
+
+	/* If the first point of this segment, just add it. */
+
+	    if (iclp == 0) {
+		iclp++; xclp[iclp] = x1; yclp[iclp] = y1;
+		iclp++; xclp[iclp] = x2; yclp[iclp] = y2;
+	    }
+
+	/* Not first point.  If first point of this segment matches up to the
+	   previous point, just add it.  */
+
+	    else if (x1 == xclp[iclp] && y1 == yclp[iclp]) {
+		iclp++; xclp[iclp] = x2; yclp[iclp] = y2;
+	    }
+
+	/* Otherwise, we need to add both points, to connect the points in the
+	 * polygon along the clip boundary.  If we encircled a corner, we have
+	 * to add that first.
+	 */
+
 	    else {
-		iclp++;
-		xclp[iclp] = x1;
-		yclp[iclp] = y1;
-
-		if ((x1 == xmin && y2 == ymin) ||
-		    (x2 == xmin && y1 == ymin)) {
-		    iclp++;
-		    xclp[iclp] = xmin;
-		    yclp[iclp] = ymin;
+	    /* Treat the case where we encircled two corners */
+	    /* Upper two */
+		if ( (crossed_xmin1 && crossed_xmax2 && y[i] >= ymax) )
+		{
+		    iclp++; xclp[iclp] = xmin; yclp[iclp] = ymax;
+		    iclp++; xclp[iclp] = xmax; yclp[iclp] = ymax;
+		}
+	    /* Lower two */
+		else if ( (crossed_xmin1 && crossed_xmax2 && y[i] <= ymin) )
+		{
+		    iclp++; xclp[iclp] = xmin; yclp[iclp] = ymin;
+		    iclp++; xclp[iclp] = xmax; yclp[iclp] = ymin;
+		}
+	    /* Left two */
+		else if ( (crossed_ymin1 && crossed_ymax2 && x[i] <= xmin) )
+		{
+		    iclp++; xclp[iclp] = xmin; yclp[iclp] = ymin;
+		    iclp++; xclp[iclp] = xmin; yclp[iclp] = ymax;
+		}
+	    /* Right two */
+		else if ( (crossed_ymin1 && crossed_ymax2 && x[i] >= xmax) )
+		{
+		    iclp++; xclp[iclp] = xmax; yclp[iclp] = ymin;
+		    iclp++; xclp[iclp] = xmax; yclp[iclp] = ymin;
+		}
+	    /* Now the case where we encircled one corner */
+	    /* Lower left */
+		if ( (crossed_xmin1 && crossed_ymin2) ||
+		     (crossed_ymin1 && crossed_xmin2) )
+		{
+		    iclp++; xclp[iclp] = xmin; yclp[iclp] = ymin;
+		}
+	    /* Lower right */
+		else if ( (crossed_xmax1 && crossed_ymin2) ||
+			  (crossed_ymin1 && crossed_xmax2) )
+		{
+		    iclp++; xclp[iclp] = xmax; yclp[iclp] = ymin;
 		}
-		else if ((x1 == xmax && y2 == ymin) ||
-			 (x2 == xmax && y1 == ymin)) {
-		    iclp++;
-		    xclp[iclp] = xmax;
-		    yclp[iclp] = ymin;
+	    /* Upper left */
+		else if ( (crossed_xmin1 && crossed_ymax2) ||
+			  (crossed_ymax1 && crossed_xmin2) )
+		{
+		    iclp++; xclp[iclp] = xmin; yclp[iclp] = ymax;
+		}
+	    /* Upper right */
+		else if ( (crossed_xmax1 && crossed_ymax2) ||
+			  (crossed_ymax1 && crossed_xmax2) )
+		{
+		    iclp++; xclp[iclp] = xmax; yclp[iclp] = ymax;
 		}
-		else if ((x1 == xmax && y2 == ymax) ||
-			 (x2 == xmax && y1 == ymax)) {
-		    iclp++;
-		    xclp[iclp] = xmax;
-		    yclp[iclp] = ymax;
-		}
-		else if ((x1 == xmin && y2 == ymax) ||
-			 (x2 == xmin && y1 == ymax)) {
-		    iclp++;
-		    xclp[iclp] = xmin;
-		    yclp[iclp] = ymax;
-		}
-	    /* Experimental code from way back.
-	       Polygon clipping is HARD.
-		{
-		    int j;
-		    for (j = 0; j < i; j++) {
-			if (x[j] < xmin && y[j] < ymin) {
-			    break;
-			}
-			else if (x[j] < xmin && y[j] > ymax) {
-			    iclp++;
-			    xclp[iclp] = xmin;
-			    yclp[iclp] = ymax;
-			    break;
-			}
-			else if (x[j] > xmax && y[j] < ymin) {
-			    iclp++;
-			    xclp[iclp] = xmax;
-			    yclp[iclp] = ymin;
-			    break;
-			}
-			else if (x[j] > xmax && y[j] > ymax) {
-			    iclp++;
-			    xclp[iclp] = xmax;
-			    yclp[iclp] = ymax;
-			    break;
-			}
-		    }
-		}
-	    */
-		iclp++;
-		xclp[iclp] = x2;
-		yclp[iclp] = y2;
-	    }
-	}
-    }
-
-/* Draw the sucker */
+
+	    /* Now add current segment. */
+		iclp++; xclp[iclp] = x1; yclp[iclp] = y1;
+		iclp++; xclp[iclp] = x2; yclp[iclp] = y2;
+	    }
+
+	/* Boundary crossing condition -- going out. */
+	    crossed_xmin1 = (x2 == xmin); crossed_xmax1 = (x2 == xmax);
+	    crossed_ymin1 = (y2 == ymin); crossed_ymax1 = (y2 == ymax);
+	}
+    }
+
+/* Limit case - all vertices are outside of bounding box.  So just fill entire
+   box. */
+
+    if (iclp == 0 && npts >= 4) {
+	iclp++; xclp[iclp] = xmin; yclp[iclp] = ymin;
+	iclp++; xclp[iclp] = xmin; yclp[iclp] = ymax;
+	iclp++; xclp[iclp] = xmax; yclp[iclp] = ymax;
+	iclp++; xclp[iclp] = xmax; yclp[iclp] = ymin;
+    }
+
+/* Is this still needed? */

     if (iclp + 1 >= 2) {
 	if ((xclp[0] == xmin && yclp[iclp] == ymin) ||
-	    (xclp[iclp] == xmin && yclp[0] == ymin)) {
-	    iclp++;
-	    xclp[iclp] = xmin;
-	    yclp[iclp] = ymin;
+	    (xclp[iclp] == xmin && yclp[0] == ymin))
+	{
+	    iclp++; xclp[iclp] = xmin; yclp[iclp] = ymin;
 	}
 	else if ((xclp[0] == xmax && yclp[iclp] == ymin) ||
-		 (xclp[iclp] == xmax && yclp[0] == ymin)) {
-	    iclp++;
-	    xclp[iclp] = xmax;
-	    yclp[iclp] = ymin;
+		 (xclp[iclp] == xmax && yclp[0] == ymin))
+	{
+	    iclp++; xclp[iclp] = xmax; yclp[iclp] = ymin;
 	}
 	else if ((xclp[0] == xmax && yclp[iclp] == ymax) ||
-		 (xclp[iclp] == xmax && yclp[0] == ymax)) {
-	    iclp++;
-	    xclp[iclp] = xmax;
-	    yclp[iclp] = ymax;
+		 (xclp[iclp] == xmax && yclp[0] == ymax))
+	{
+	    iclp++; xclp[iclp] = xmax; yclp[iclp] = ymax;
 	}
 	else if ((xclp[0] == xmin && yclp[iclp] == ymax) ||
-		 (xclp[iclp] == xmin && yclp[0] == ymax)) {
-	    iclp++;
-	    xclp[iclp] = xmin;
-	    yclp[iclp] = ymax;
-	}
-    }
-    if (iclp + 1 >= 3) {
-      if(draw)
+		 (xclp[iclp] == xmin && yclp[0] == ymax))
+	{
+	    iclp++; xclp[iclp] = xmin; yclp[iclp] = ymax;
+	}
+    }
+
+/* Draw the sucker */
+
+    if (iclp >= 2 && draw)
 	(*draw)(xclp, yclp, iclp + 1);
-    }
 }

 /*----------------------------------------------------------------------*\


watchdogd: Don't default to a critical threshold if user has not set one

This patch removes the old backwards compat 'warn + 0.1' if a critical
threshold is unset by the operator, as introduced in 4fc3580.

As of now plugins' ability to do a forced WDT reset is controlable by
the system operator.

Signed-off-by: Joachim Nilsson <583c295fd7602c168ad814279bbc3894ba65f5d6@gmail.com>

--- src/plugin.c
+++ src/plugin.c
@@ -96,13 +96,10 @@
 		value = strtod(ptr, NULL);
 		if (value <= 0)
 			goto error;
-	} else {
-		/* Backwards compat, when only warning is given */
-		value += 0.1;
+
+		if (critical)
+			*critical = value;
 	}
-
-	if (critical)
-		*critical = value;

 	DEBUG("%s monitor: %.2f, %.2f", desc, warning ? *warning : 0.0, critical ? *critical : 0.0);


Docstring for CurlMulti.close

Docstring for CurlMulti.close

--- src/pycurl.c
+++ src/pycurl.c
@@ -3673,6 +3673,13 @@
     "reset() -> None. "
     "Reset all options set on curl handle to default values, but preserves live connections, session ID cache, DNS cache, cookies, and shares.\n";

+static const char co_multi_close_doc [] = "\
+close() -> None\n\
+\n\
+Corresponds to `curl_multi_cleanup`_ in libcurl. This method is\n\
+automatically called by pycurl when a CurlMulti object no longer has any\n\
+references to it, but can also be called explicitly.\
+";
 static const char co_multi_fdset_doc [] =
     "fdset() -> Tuple.  "
     "Returns a tuple of three lists that can be passed to the select.select() method .\n";
@@ -3709,7 +3716,7 @@

 static PyMethodDef curlmultiobject_methods[] = {
     {"add_handle", (PyCFunction)do_multi_add_handle, METH_VARARGS, NULL},
-    {"close", (PyCFunction)do_multi_close, METH_NOARGS, NULL},
+    {"close", (PyCFunction)do_multi_close, METH_NOARGS, co_multi_close_doc},
     {"fdset", (PyCFunction)do_multi_fdset, METH_NOARGS, co_multi_fdset_doc},
     {"info_read", (PyCFunction)do_multi_info_read, METH_VARARGS, co_multi_info_read_doc},
     {"perform", (PyCFunction)do_multi_perform, METH_NOARGS, NULL},


- added CURLINFO_OS_ERRNO - added CURLOPT_FTPSSLAUTH (and CURLFTPAUTH params)

--- src/pycurl.c
+++ src/pycurl.c
@@ -45,8 +45,8 @@
 #if !defined(PY_VERSION_HEX) || (PY_VERSION_HEX < 0x02020000)
 #  error "Need Python version 2.2 or greater to compile pycurl."
 #endif
-#if !defined(LIBCURL_VERSION_NUM) || (LIBCURL_VERSION_NUM < 0x070c01)
-#  error "Need libcurl version 7.12.1 or greater to compile pycurl."
+#if !defined(LIBCURL_VERSION_NUM) || (LIBCURL_VERSION_NUM < 0x070c02)
+#  error "Need libcurl version 7.12.2 or greater to compile pycurl."
 #endif

 #undef UNUSED
@@ -1366,6 +1366,7 @@
     case CURLINFO_HTTP_CONNECTCODE:
     case CURLINFO_HTTPAUTH_AVAIL:
     case CURLINFO_PROXYAUTH_AVAIL:
+    case CURLINFO_OS_ERRNO:
         {
             /* Return PyInt as result */
             long l_res = -1;
@@ -2313,14 +2314,6 @@
     insint_c(d, "INFOTYPE_DATA_OUT", CURLINFO_DATA_OUT);
     insint_c(d, "INFOTYPE_SSL_DATA_IN", CURLINFO_SSL_DATA_IN);
     insint_c(d, "INFOTYPE_SSL_DATA_OUT", CURLINFO_SSL_DATA_OUT);
-#if 0
-    /* deprecated names (for compatibility with old pycurl versions) */
-    insint_c(d, "TEXT", CURLINFO_TEXT);
-    insint_c(d, "HEADER_IN", CURLINFO_HEADER_IN);
-    insint_c(d, "HEADER_OUT", CURLINFO_HEADER_OUT);
-    insint_c(d, "DATA_IN", CURLINFO_DATA_IN);
-    insint_c(d, "DATA_OUT", CURLINFO_DATA_OUT);
-#endif

     /* CURLcode: error codes */
 /* FIXME: lots of error codes are missing */
@@ -2331,12 +2324,6 @@
     insint_c(d, "PROXYTYPE_HTTP", CURLPROXY_HTTP);
     insint_c(d, "PROXYTYPE_SOCKS4", CURLPROXY_SOCKS4);
     insint_c(d, "PROXYTYPE_SOCKS5", CURLPROXY_SOCKS5);
-#if 0
-    /* deprecated names (for compatibility with old pycurl versions) */
-    insint_c(d, "PROXY_HTTP", CURLPROXY_HTTP);
-    insint_c(d, "PROXY_SOCKS4", CURLPROXY_SOCKS4);
-    insint_c(d, "PROXY_SOCKS5", CURLPROXY_SOCKS5);
-#endif

     /* curl_httpauth: constants for setopt(HTTPAUTH, x) */
     insint_c(d, "HTTPAUTH_NONE", CURLAUTH_NONE);
@@ -2445,6 +2432,12 @@
     insint_c(d, "FTP_RESPONSE_TIMEOUT", CURLOPT_FTP_RESPONSE_TIMEOUT);
     insint_c(d, "IPRESOLVE", CURLOPT_IPRESOLVE);
     insint_c(d, "MAXFILESIZE", CURLOPT_MAXFILESIZE);
+    insint_c(d, "FTPSSLAUTH", CURLOPT_FTPSSLAUTH);
+
+    /* constants for setopt(FTPSSLAUTH, x) */
+    insint_c(d, "FTPAUTH_DEFAULT", CURLFTPAUTH_DEFAULT);
+    insint_c(d, "FTPAUTH_SSL", CURLFTPAUTH_SSL);
+    insint_c(d, "FTPAUTH_TLS", CURLFTPAUTH_TLS);

     /* constants for setopt(IPRESOLVE, x) */
     insint_c(d, "IPRESOLVE_WHATEVER", CURL_IPRESOLVE_WHATEVER);
@@ -2466,11 +2459,6 @@
     /* curl_TimeCond: constants for setopt(TIMECONDITION, x) */
     insint_c(d, "TIMECONDITION_IFMODSINCE", CURL_TIMECOND_IFMODSINCE);
     insint_c(d, "TIMECONDITION_IFUNMODSINCE", CURL_TIMECOND_IFUNMODSINCE);
-#if 0
-    /* deprecated names (for compatibility with old pycurl versions) */
-    insint_c(d, "TIMECOND_IFMODSINCE", CURL_TIMECOND_IFMODSINCE);
-    insint_c(d, "TIMECOND_IFUNMODSINCE", CURL_TIMECOND_IFUNMODSINCE);
-#endif

     /* CURLINFO: symbolic constants for getinfo(x) */
     insint_c(d, "EFFECTIVE_URL", CURLINFO_EFFECTIVE_URL);
@@ -2497,6 +2485,7 @@
     insint_c(d, "HTTP_CONNECTCODE", CURLINFO_HTTP_CONNECTCODE);
     insint_c(d, "HTTPAUTH_AVAIL", CURLINFO_HTTPAUTH_AVAIL);
     insint_c(d, "PROXYAUTH_AVAIL", CURLINFO_PROXYAUTH_AVAIL);
+    insint_c(d, "OS_ERRNO", CURLINFO_OS_ERRNO);

     insint_c(d, "FTP_SSL", CURLOPT_FTP_SSL);
     insint_c(d, "NETRC_FILE", CURLOPT_NETRC_FILE);


- remove @ from mail addresses

- remove @ from mail addresses

--- src/pycurl.c
+++ src/pycurl.c
@@ -16,8 +16,8 @@
  *  Domenico Andreoli <cavok at libero.it>
  *  Dominique <curl-and-python at d242.net>
  *  Paul Pacheco
- *  Victor Lascurain <bittor@eleka.net>
- *  K.S.Sreeram <sreeram@tachyontech.net>
+ *  Victor Lascurain <bittor at eleka.net>
+ *  K.S.Sreeram <sreeram at tachyontech.net>
  *
  * See file COPYING for license information.
  *


change order of tasks

change order of tasks

--- src/remote.c
+++ src/remote.c
@@ -92,7 +92,9 @@
 	Send operation code to MASTER
 */
 void send_op_to_master(int operation) {
+	printf("Slave %d sending op to master\n", athread_remote_rank);
 	MPI_Send(&operation, 1, MPI_INT, MASTER_ID, 0, MPI_COMM_WORLD);
+	printf("slave %d -- Operation sent\n", athread_remote_rank);
 }

 /*
@@ -143,8 +145,6 @@
 		**** steps to take ***
 		----------------------
 		recv ok from slave
-		send new task
-		recv ok
 		send task
 		recv ok
 		recv result
@@ -153,16 +153,7 @@
 	*/

 	request_ok_from_slave(remote_job_input->slave);
-
-	printf("Send new task request to slave %d\n", remote_job_input->slave);
-	send_op_to_slave(NEW_TASK, remote_job_input->slave);
-	printf("Sent done. Slave %d got it\n", remote_job_input->slave);
-
-	request_ok_from_slave(remote_job_input->slave);
-
-	printf("Sending task to slave %d\n", remote_job_input->slave);
-	printf("Task was sent. Slave %d got it. Waiting result\n", remote_job_input->slave);
-
+	return (void*) NULL;
 }

 int athread_remote_send_job(struct job *job) {


Crash when we get the percentages wrong.

Better to crash with an assertion than to get into an infinite loop.
We cold work around this, but there's a bug here and it's not a
rounding bug, so it's better not to conceal it.

--- src/render.c
+++ src/render.c
@@ -118,9 +118,12 @@
             double percentage = child->percent > 0.0 ? child->percent : 1.0 / children;
             assigned += sizes[i++] = percentage * total;
         }
+        assert(assigned == total ||
+                (assigned > total && assigned - total <= children * 2) ||
+                (assigned < total && total - assigned <= children * 2));
         int signal = assigned < total ? 1 : -1;
         while (assigned != total) {
-            for (i = 0; i < children && assigned < total; ++i) {
+            for (i = 0; i < children && assigned != total; ++i) {
                 sizes[i] += signal;
                 assigned += signal;
             }


roster.c: use send_with_reply to send the roster request

Not waiting for the reply and assume any IQ result with right nodes is
the reply is bong.

--- src/roster.c
+++ src/roster.c
@@ -1106,12 +1106,9 @@
  * if queries other than rosters are received.
  */
 static LmHandlerResult
-gabble_roster_iq_cb (LmMessageHandler *handler,
-                     LmConnection *lmconn,
-                     LmMessage *message,
-                     gpointer user_data)
-{
-  GabbleRoster *roster = GABBLE_ROSTER (user_data);
+got_roster_iq (GabbleRoster *roster,
+    LmMessage *message)
+{
   GabbleRosterPrivate *priv = roster->priv;
   TpBaseConnection *conn = (TpBaseConnection *) priv->conn;
   TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (conn,
@@ -1120,8 +1117,6 @@
   LmMessageSubType sub_type;
   const gchar *from;
   gboolean google_roster = FALSE;
-
-  g_assert (lmconn == priv->conn->lmconn);

   if (priv->list_channels == NULL)
     return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
@@ -1444,6 +1439,19 @@
   return LM_HANDLER_RESULT_REMOVE_MESSAGE;
 }

+static LmHandlerResult
+gabble_roster_iq_cb (LmMessageHandler *handler,
+                     LmConnection *lmconn,
+                     LmMessage *message,
+                     gpointer user_data)
+{
+  GabbleRoster *roster = GABBLE_ROSTER (user_data);
+  GabbleRosterPrivate *priv = roster->priv;
+
+  g_assert (lmconn == priv->conn->lmconn);
+
+  return got_roster_iq (roster, message);
+}

 static void
 _gabble_roster_send_presence_ack (GabbleRoster *roster,
@@ -1721,6 +1729,17 @@
     }
 }

+static LmHandlerResult
+roster_received_cb (GabbleConnection *conn,
+    LmMessage *sent_msg,
+    LmMessage *reply_msg,
+    GObject *roster_obj,
+    gpointer user_data)
+{
+  GabbleRoster *roster = GABBLE_ROSTER (user_data);
+
+  return got_roster_iq (roster, reply_msg);
+}

 static void
 connection_status_changed_cb (GabbleConnection *conn,
@@ -1757,7 +1776,8 @@

           message = _gabble_roster_message_new (self, LM_MESSAGE_SUB_TYPE_GET,
               NULL);
-          _gabble_connection_send (self->priv->conn, message, NULL);
+          _gabble_connection_send_with_reply (self->priv->conn, message,
+              roster_received_cb, G_OBJECT (self), self, NULL);
           lm_message_unref (message);
         }
       break;


Fix braces style in scaler.c

Fix braces style in scaler.c

--- src/scaler.c
+++ src/scaler.c
@@ -10,8 +10,10 @@
 	unsigned int i, j;
 	int scaleWidth = SCREEN_W * 2;

-	for (j = 0; j < SCREEN_H; ++j) {
-		for (i = 0; i < SCREEN_W/2; ++i) {
+	for (j = 0; j < SCREEN_H; ++j)
+	{
+		for (i = 0; i < SCREEN_W/2; ++i)
+		{
 			tmp = *from++;

 			tmp2 = (tmp & 0xffff) | (tmp << 16);


Note that iree_task_list_discard leaves the list in a usable state.

--- iree/task/list.h
+++ iree/task/list.h
@@ -51,7 +51,8 @@
 void iree_task_list_move(iree_task_list_t* list, iree_task_list_t* out_list);

 // Discards a task list; should be used for failure cleanup during list
-// construction to ensure intrusive pointers are reset.
+// construction to ensure intrusive pointers are reset. List is immediately
+// reusable as if it had been initialized.
 void iree_task_list_discard(iree_task_list_t* list);

 // Returns true if the list is empty.