coverity 1163393

coverity 1163393

--- Engine/sread.c
+++ Engine/sread.c
@@ -169,7 +169,7 @@
       switch(lastsource) {
       case 0: m = Str("  included from line %d of macro %s%s"); break;
       case 1: m = Str("  called from line %d of macro %s%s"); break;
-      default:
+        //default:
       case 2: m = Str("  in line %d of macro %s%s"); break;
       }
       msgfunc(csound, m, (lastsource == 0 ? curr->line - 1 : curr->line),


serveur en doxygen en cours

serveur en doxygen en cours

--- new_test_thread/Serveur.c
+++ new_test_thread/Serveur.c
@@ -134,18 +134,20 @@
  */
 static void write_player(int socket_descriptor, char *mesg) {
     if ((write(socket_descriptor, mesg, strlen(mesg))) <= 0) {
-        perror("erreur : impossible d'ecrire le message destine au serveur.");
+        perror("erreur : impossible d'ecrire le message destine au joueur.");
         exit(1);
     }
 }

 /////////////////////////////////////////////////////////////////////////////////////
-/* réception d'un message envoyé par le serveur */
-/*
-¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
-¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
-*/
+/**
+ * \fn char * reception(int sock)
+ * \brief Fonction qui reçoit un message envoyé par un joueur
+ *
+ * \param sock int stockant la description du socket
+ * \return cleaned_sentence une chaine contenant le message envoyé par le joueur
+ */
 char * reception(int sock) {
     //char *buffer = malloc(256*sizeof(char));//laisser en tableau sinon envoi 8 lettres par 8
     char * buffer = malloc(TAILLE_PHRASE_AVEC_CODE * sizeof(char));
@@ -158,7 +160,6 @@
         return "";
     }

-
     //traitement du message
     int i;
     for(i = 0; i < longueur; i++) {
@@ -180,6 +181,7 @@
     return cleaned_sentence;
 }

+/* blblblblblblblblblblblbbllllllllllllll*/
 ////////////////////////////////////////////////////////////////////////////////////
 /*
 void renvoi (int sock) {


instantiate msg

instantiate msg

--- detail/OnceTraversable.h
+++ detail/OnceTraversable.h
@@ -135,7 +135,13 @@
                 " and can be traversed with iterators only.");
     }

-    static ThisCol instantiate();
+    template <class U = int>
+    static ThisCol instantiate() {
+        static_assert(templatious::util::DummyResolver<U,false>::val,
+                "OnceTraversable can only be instantiated"
+                " out of another collection.");
+    }
+
     static ThisCol instantiate(size_t size);
     static ThisCol* instHeap();
     static ThisCol* instHeap(size_t size);


Added std:: prefixes to the ostreams in the file. Makes it easier to build instead of requiring the user to have a using directive.

--- newmat/include/newmatio.h
+++ newmat/include/newmatio.h
@@ -19,9 +19,9 @@

 /**************************** input/output *****************************/

-ostream& operator<<(ostream&, const BaseMatrix&);
+std::ostream& operator<<(std::ostream&, const BaseMatrix&);

-ostream& operator<<(ostream&, const GeneralMatrix&);
+std::ostream& operator<<(std::ostream&, const GeneralMatrix&);

 /*  Use in some old versions of G++ without complete iomanipulators


update the peer address when LTK has been found in old entry

--- connectivity/FEATURE_BLE/source/generic/SecurityDb.h
+++ connectivity/FEATURE_BLE/source/generic/SecurityDb.h
@@ -190,6 +190,11 @@
             SecurityDistributionFlags_t* flags = get_distribution_flags(correct_handle);
             flags->connected = true;

+            /* update peer address */
+            SecurityDistributionFlags_t* old_flags = get_distribution_flags(*db_handle);
+            flags->peer_address = old_flags->peer_address;
+            flags->peer_address_is_public = old_flags->peer_address_is_public;
+
             close_entry(*db_handle, false);
             *db_handle = correct_handle;
             cb(*db_handle, keys);


Remove some no longer needed debug logging.

--- FFusionCodec.c
+++ FFusionCodec.c
@@ -193,9 +193,7 @@

             if (bitfield >= 0x1010)
             {
-                Codecprintf("Use speedy y420 component");
-                printf(" 0x%lx\n", bitfield);
-
+                Codecprintf("Use speedy y420 component");
                 glob->hasy420 = 1;
             }
         }
@@ -208,7 +206,6 @@
         // most of our calls to the base decompressor instance

         err = OpenADefaultComponent(decompressorComponentType, kBaseCodecType, &glob->delegateComponent);
-        printf("Perian codec: glob->delegateComponent:0x%x \n",glob->delegateComponent);
         if (!err)
         {
             ComponentSetTarget(glob->delegateComponent, self);


Better handle parse errors for frame data which is completely broken.
Fixes #466

git-svn-id: d8f21eb7283bfb39ebab2f8f9b4a259b233f9348@1244 621663c8-3916-0410-8f58-edc14a8543d5

--- FFusionCodec.c
+++ FFusionCodec.c
@@ -917,10 +917,10 @@

 	if(glob->begin.parser != NULL)
 	{
-		int parsedBufSize;
+		int parsedBufSize = 0;
 		uint8_t *buffer = (uint8_t *)drp->codecData;
 		int bufferSize = p->bufferSize;
-		int skipped;
+		int skipped = 0;

 		if(glob->data.unparsedFrames.dataSize != 0)
 		{


have pipe open before spawning in shell

have pipe open before spawning in shell

Signed-off-by: Jens Nyberg <7200009990a46d4bb36e24284136c70d739d75fd@gmail.com>

--- packages/shell/shell.c
+++ packages/shell/shell.c
@@ -39,8 +39,8 @@
     call_walk(CALL_I1, CALL_L1, 1, "1");
     call_walk(CALL_O1, CALL_O0, 0, 0);
     call_open(CALL_L2);
+    call_spawn(CALL_DP);
     call_write(CALL_L2, 0, buffer->head, buffer->memory);
-    call_spawn(CALL_DP);
     call_close(CALL_L2);
     call_close(CALL_L1);


more fixing

more fixing

--- packages/slang/slang.c
+++ packages/slang/slang.c
@@ -12,13 +12,13 @@

 }

-static void execute_command(struct command *command, char *buffer)
+static void execute_command(struct command *command, char *buffer, unsigned int pipe)
 {

-    if (call_open(CALL_L4, CALL_DR, 4, "bin/"))
+    if (call_open(CALL_L0, CALL_DR, 4, "bin/"))
     {

-        if (open_path(CALL_L7, CALL_L4, command->binary.count, buffer + command->binary.index))
+        if (open_path(CALL_L1, CALL_L0, command->binary.count, buffer + command->binary.index))
         {

             unsigned int i = 0;
@@ -30,8 +30,8 @@
             if (command->out.path.count)
                 o = open_path(CALL_O1, CALL_DW, command->out.path.count, buffer + command->out.path.index);

-            call_spawn(CALL_L7);
-            call_close(CALL_L7);
+            call_spawn(CALL_L1);
+            call_close(CALL_L1);

             if (i)
                 call_close(CALL_I1);
@@ -41,7 +41,7 @@

         }

-        call_close(CALL_L4);
+        call_close(CALL_L0);

     }

@@ -60,22 +60,22 @@
         unsigned int cindex;

         for (cindex = 0; cindex < clast; cindex++)
-            call_open(CALL_L0 + cindex, CALL_DR, 17, "system/pipe/clone");
+            call_open(CALL_L2 + cindex, CALL_DR, 17, "system/pipe/clone");

         for (cindex = 0; cindex < clast; cindex++)
         {

-            call_open(CALL_O1, CALL_L0 + cindex, 4, "../0");
-            execute_command(&pipe->command[cindex], state->buffer);
-            call_open(CALL_I1, CALL_L0 + cindex, 4, "../1");
+            call_open(CALL_O1, CALL_L2 + cindex, 4, "../0");
+            execute_command(&pipe->command[cindex], state->buffer, CALL_L2 + cindex);
+            call_open(CALL_I1, CALL_L2 + cindex, 4, "../1");

         }

         for (cindex = 0; cindex < clast; cindex++)
-            call_close(CALL_L0 + cindex);
+            call_close(CALL_L2 + cindex);

         call_open(CALL_O1, CALL_O0, 0, 0);
-        execute_command(&pipe->command[clast], state->buffer);
+        execute_command(&pipe->command[clast], state->buffer, CALL_L2);

     }


macos fix

macos fix

--- extensions/ffi.c
+++ extensions/ffi.c
@@ -2296,7 +2296,9 @@
 // http://man7.org/tlpi/code/faq.html#use_default_source
 //  glibc version 6+ uses __GLIBC__/__GLIBC_MINOR__
 #ifndef _DEFAULT_SOURCE
+# ifndef __APPLE__
 #	error "Required -std=gnu11 (we use anonymous mmap)"
+# endif
 #endif

 // todo: добавить возможность вызова колбека как сопрограммы (так и назвать - сопрограмма)


Refactored download functions

Refactored download functions


Fix a bug on thread argument passing

Fix a bug on thread argument passing

--- dualport.c
+++ dualport.c
@@ -201,24 +201,28 @@
     arg_read1.loop = param.loop_count;
     arg_read1.byte_count = &total_bytes_read1;
     arg_read1.interval = 0;
+    arg_read1.packet_size = param.packet_size;

     arg_read2.fd = fd2;
     arg_read2.data_buf = cmp_buf;
     arg_read2.loop = param.loop_count;
     arg_read2.byte_count = &total_bytes_read2;
     arg_read2.interval = 0;
+    arg_read2.packet_size = param.packet_size;

     arg_write1.fd = fd1;
     arg_write1.data_buf = obuf;
     arg_write1.loop = param.loop_count;
     arg_write1.byte_count = &total_bytes_write1;
     arg_write1.interval = param.interval;
+    arg_write1.packet_size = param.packet_size;

     arg_write2.fd = fd2;
     arg_write2.data_buf = obuf;
     arg_write2.loop = param.loop_count;
     arg_write2.byte_count = &total_bytes_write2;
     arg_write2.interval = param.interval;
+    arg_write2.packet_size = param.packet_size;

     /* Start threads to do Read&Verify/Write */
     pthread_create(&thr_id_read1, NULL, routine_read, &arg_read1);


array size fixed

array size fixed

--- duckchat.h
+++ duckchat.h
@@ -108,7 +108,7 @@
 struct text_list {
     text_t txt_type; /* = TXT_LIST */
     int txt_nchannels;
-    struct channel_info txt_channels[0]; // May actually be more than 0
+    struct channel_info txt_channels[1]; // May actually be more than 0
 } packed;

 /* This is a substructure used by text_who. */


Fixed typo in --help output for --enable-agc.

Thanks to Sanjeev Gupta for reporting.

--- dump1090.c
+++ dump1090.c
@@ -2359,7 +2359,7 @@
     printf(
 "--device-index <index>   Select RTL device (default: 0).\n"
 "--gain <db>              Set gain (default: max gain. Use -100 for auto-gain).\n"
-"--enable-agc>            Enable the Automatic Gain Control (default: off).\n"
+"--enable-agc             Enable the Automatic Gain Control (default: off).\n"
 "--freq <hz>              Set frequency (default: 1090 Mhz).\n"
 "--ifile <filename>       Read data from file (use '-' for stdin).\n"
 "--interactive            Interactive mode refreshing data on screen.\n"


e/desk_wallpaper: Fix setting wallpaper from within Virtual Desk dialog

Summary:
It seems this was missed when doing the manager/container id removal
back in march.  The param validation was failing and causing the "Set"
button to not work in "Screen > Virtual Desktops > Click to Change
wallpaper".

Test Plan:
1. Open "Screen > Virtual Desktops > Click to Change wallpaper"
2. Click "Set"
  - Expect that a wallpaper dialog be shown
  - Before this patch nothing happens

Reviewers: zmike

Subscribers: cedric, seoz

Differential Revision: https://phab.enlightenment.org/D3298

--- src/modules/conf_theme/e_int_config_wallpaper.c
+++ src/modules/conf_theme/e_int_config_wallpaper.c
@@ -64,7 +64,7 @@

    if (!params) return NULL;
    zone_num = desk_x = desk_y = -1;
-   if (sscanf(params, "%i %i %i", &zone_num, &desk_x, &desk_y) != 4)
+   if (sscanf(params, "%i %i %i", &zone_num, &desk_x, &desk_y) != 3)
      return NULL;
    return _e_int_config_wallpaper_desk(NULL, zone_num, desk_x, desk_y);
 }


staging: lustre: lustre: obdclass: lprocfs_status.c: Tidied up some code in a case statement

Tidied up some code in a case statement after a discussion.

This was partly found using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <b2870f70e324b62b54eced4cf50284b23ec5baab@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -45,6 +45,7 @@
 #include "../include/lprocfs_status.h"
 #include "../include/lustre/lustre_idl.h"
 #include <linux/seq_file.h>
+#include <linux/ctype.h>

 static const char * const obd_connect_names[] = {
 	"read_only",
@@ -1896,16 +1897,16 @@
 	}

 	units = 1;
-	switch (*end) {
-	case 'p': case 'P':
+	switch (tolower(*end)) {
+	case 'p':
 		units <<= 10;
-	case 't': case 'T':
+	case 't':
 		units <<= 10;
-	case 'g': case 'G':
+	case 'g':
 		units <<= 10;
-	case 'm': case 'M':
+	case 'm':
 		units <<= 10;
-	case 'k': case 'K':
+	case 'k':
 		units <<= 10;
 	}
 	/* Specified units override the multiplier */


use a float not an int.

use a float not an int.

Change-Id: Ib569e9436cef4ba32721f8f8db97e9eaf43959dd
Reviewed-by: L Potter <0e329dfd61bdd4e2b2b708a31f12f199a7656feb@gmail.com>

--- src/plugins/sensors/linux/linuxsysaccelerometer.h
+++ src/plugins/sensors/linux/linuxsysaccelerometer.h
@@ -69,7 +69,7 @@
     int fd;
     QString path;
     QFile file;
-    int divisor;
+    float divisor;
     QString delimiter;
 };


gnatSampler working again

gnatSampler working again

--HG--
branch : gnat-planner

--- src/ompl/datastructures/gnatSampler.h
+++ src/ompl/datastructures/gnatSampler.h
@@ -158,8 +158,10 @@
         double N = (double)size() + 1;

         ompl::Profiler::Begin("GNAT - rebuildDataStructure");
-        if(fabs(fmod(log2(N),2.0)) < 1e-8)
-        {
+        //if(fabs(fmod(log2(N),2.0)) < 1e-8)
+        if(tree_->_deltaRadius/std::max(0.01,tree_->_maxObservedRadius) > 0.10)
+        {
+          //std::cout<<"Rebuilding tree: "<<tree_->_deltaRadius<<" "<<tree_->_maxObservedRadius<<std::endl;
           rebuildDataStructure();
         }
         ompl::Profiler::End("GNAT - rebuildDataStructure");
@@ -385,15 +387,11 @@
           _previousObservedRadius(0.0),
           _deltaRadius(0.0),
           _activity(-100.0),
-          _maxActivity(2.0),
-          _cachedBorderProbability(-1.0),
-          _cachedSamplingProbability(-1.0),
-          _cachedRadius(-1.0),
-          _cachedVolume(-1.0)
+          _maxActivity(2.0)
       {
         // The "+1" is needed because we add an element before we check whether to split
         data_.reserve(capacity+1);
-
+        resetCachedValues();
       }

         ~Node()
@@ -405,7 +403,10 @@
         double approximateVolume(GNAT &gnat)
         {
           //if(_cachedVolume >= 0.0) return _cachedVolume;
-          double V = 0.0;
+          double radius = nodeRadius(gnat);
+          double V = M_PI*powf(radius,2.0);
+          return V;
+          //double V = 0.0;
           if(data_.size() || (!children_.size() && !data_.size()))
           {
             double c = 2.0;
@@ -431,6 +432,13 @@
           if(nbh.size())
             return nbh.top().second;
           else return 0.0;
+        }
+
+        double dataInRadius(GNAT &gnat, const _T &data, double r)
+        {
+          std::vector<_T> v;
+          gnat.nearestR(data,r,v);
+          return v.size();
         }

         double getSamplingProbability(GNAT &gnat, bool border)
@@ -453,17 +461,17 @@
           double total = double(gnat.size());
           if(border)
           {
-            double a = powf(3.0,_activity);
+            double a = powf(2.0,_activity);
             double d = powf(2.0,1.0 + _deltaRadius);
             //double p = a*d*V*(1.0-N/total);
-            double p = (a*d*V);
+            double p = a*d*V;
             //std::cout<<"Calculating real: "<<p<<" "<<_activity<<" "<<data_.size()<<std::endl;
             _cachedBorderProbability = p;
             return p;
           }
           else
           {
-            double p = V*(1.0-N/total);
+            double p = V*V/N;
             _cachedSamplingProbability = p;
             return p;
           }
@@ -474,7 +482,8 @@
           //if(_cachedRadius >= 0.0) return _cachedRadius;
           double radius = maxRadius_;
           if(radius<=0.0) radius = _maxObservedRadius;
-          if(radius<=0.0) radius = boundingRadius(gnat,pivot_,true)/2.0;
+          //if(radius<=0.0) radius = boundingRadius(gnat,pivot_,true)/2.0;
+          if(radius<=0.0) radius = gnat.distFun_(pivot_,gnat.nearest(pivot_))/2.0;
           _cachedRadius = radius;
           return radius;
         }
@@ -572,8 +581,8 @@
           else
           {
             _activity = _activity - 1;
-            //if(_activity<-_maxObservedRadius)
-            //gnat.removeLeaf(this);
+            if(_activity<-_maxObservedRadius)
+              gnat.removeLeaf(this);
           }

         }


no need to get this.

no need to get this.

git-svn-id: 6d771e449150288cc513807b7f4d2af31e9482bd@58574 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/modules/engines/gl_common/evas_gl_context.c
+++ src/modules/engines/gl_common/evas_gl_context.c
@@ -557,10 +557,12 @@
                       &(shared->info.max_texture_units));
         glGetIntegerv(GL_MAX_TEXTURE_SIZE,
                       &(shared->info.max_texture_size));
-        shared->info.max_vertex_elements = 6 * 10000;
+        shared->info.max_vertex_elements = 6 * 100000;
 #ifdef GL_MAX_ELEMENTS_VERTICES
+/* only applies to glDrawRangeElements. don't really need to get it.
         glGetIntegerv(GL_MAX_ELEMENTS_VERTICES,
                       &(shared->info.max_vertex_elements));
+ */
 #endif
         s = getenv("EVAS_GL_VERTEX_MAX");
         if (s) shared->info.max_vertex_elements = atoi(s);


Added object create start/done dtrace probes (object names reported, source locations pending)

--- shotgun/lib/object_memory-inline.h
+++ shotgun/lib/object_memory-inline.h
@@ -1,4 +1,11 @@
 #include "shotgun/lib/auto.h"
+
+#if CONFIG_ENABLE_DTRACE
+#include "shotgun/dtrace.h"
+#define ENABLE_DTRACE 1
+#else
+#define ENABLE_DTRACE 0
+#endif

 static inline void _om_apply_class_flags(OBJECT obj, OBJECT cls) {
   obj->CanStoreIvars = (class_get_has_ivars(cls) == Qtrue);
@@ -58,8 +65,21 @@

 static inline OBJECT _om_inline_new_object_init(object_memory om, OBJECT cls, unsigned int fields) {
   OBJECT obj;
+
+#if ENABLE_DTRACE
+  if (RUBINIUS_OBJECT_CREATE_START_ENABLED() && om->bootstrap_loaded == 1) {
+    RUBINIUS_OBJECT_CREATE_START((char*)_inspect(cls), (char*)"unknown.rb", 1);
+  }
+#endif
+
   obj = _om_inline_new_object(om, cls, fields);
   fast_memfill((void*)BYTES_OF(obj), (uintptr_t)Qnil, fields);
+
+#if ENABLE_DTRACE
+  if (RUBINIUS_OBJECT_CREATE_DONE_ENABLED() && om->bootstrap_loaded == 1) {
+    RUBINIUS_OBJECT_CREATE_DONE((char*)_inspect(cls), (char*)"unknown.rb", 1);
+  }
+#endif

   return obj;
 }


Revert "Merge "evas/gl - fixed Evas_Map NightMare.""

This reverts commit 97ffa1facc98c3871cbd281233cffd055689911b, reversing
changes made to eed31b210f2dfcceb8f6388dc9904c04af7ba2de.

--- src/modules/engines/gl_common/evas_gl_context.c
+++ src/modules/engines/gl_common/evas_gl_context.c
@@ -2183,7 +2183,7 @@
           {
              clip = 0; cx = 0; cy = 0; cw = 0; ch = 0;
           }
-        x = nx; y = ny; w = nw; h = nh;
+        x = nx; y = nw; w = nw; h = nh;
      }

    if (!flat)


Add readwrite properties.

Add readwrite properties.

--- SelfieBooth/SelfieBooth/SelfieCollectionViewController.h
+++ SelfieBooth/SelfieBooth/SelfieCollectionViewController.h
@@ -11,15 +11,15 @@
 @interface SelfieCollectionViewController : UICollectionViewController <UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UIViewControllerTransitioningDelegate>

 /// A valid access token from Instagram.
-@property (nonatomic, strong) NSString *accessToken;
+@property (nonatomic, strong, readwrite) NSString *accessToken;

 /// To get media earlier than this max_id.
-@property (nonatomic, strong) NSString *max_id;
+@property (nonatomic, strong, readwrite) NSString *max_id;

 /// Object for all photos in collection view.
-@property (nonatomic, strong) NSArray *photos;
+@property (nonatomic, strong, readwrite) NSArray *photos;

 /// Object for pull-to-refresh feature
-@property (nonatomic, strong) UIRefreshControl *refreshControl;
+@property (nonatomic, strong, readwrite) UIRefreshControl *refreshControl;

 @end


Updated prototype scrolling implementation.

--- src/pixel_interface/pixel_interface.c
+++ src/pixel_interface/pixel_interface.c
@@ -177,9 +177,13 @@
 // is terminated and the screen returns to the bottom of the output -- this
 // also automatically shows the new output which has arrived, which should in
 // most cases result from a interrupt routine.
-static int top_upscroll_line = -1; // != -1 indicates upscroll is active.
+
+static int top_upscroll_line = -1; // != -1 indicates upscroll is active, this
+ // variable stores the topmost visible line on the screen (history-wise).
 static bool upscroll_hit_top = false;
 static history_output *history = NULL; // shared by upscroll and screen-refresh
+static int redraw_pixel_lines_to_skip = 0; // will be skipped on top of redraw.
+static int redraw_pixel_lines_to_draw = -1; // will be painted at most.

 // line-measurement gets it's own history
 static history_output *measurement_history = NULL;
@@ -245,7 +249,17 @@

 static void clear_to_eol(int window_number) {
-  int width, yspace, height;
+  int width, yspace, height, clip_bottom;
+
+  if (redraw_pixel_lines_to_skip > line_height) {
+    return;
+  }
+
+  clip_bottom
+    = (redraw_pixel_lines_to_draw >= 0)
+    && (redraw_pixel_lines_to_draw < line_height)
+    ? line_height - redraw_pixel_lines_to_draw
+    : 0;

   // Clear the remaining space on the line. This also ensures that the
   // background color for the line will be the current output_color.
@@ -263,9 +277,9 @@
     - z_windows[window_number]->ycursorpos;

   height
-    = yspace < line_height
+    = yspace < line_height - redraw_pixel_lines_to_skip - clip_bottom
     ? yspace
-    : line_height;
+    : line_height - redraw_pixel_lines_to_skip - clip_bottom;

   TRACE_LOG("clear-to-eol: %d, %d, %d, %d, win %d.\n",
       z_windows[window_number]->xpos
@@ -284,6 +298,7 @@
       width,
       height,
       z_to_rgb_colour(z_windows[window_number]->output_background_colour));
+      //z_to_rgb_colour(Z_COLOUR_BLUE));
 }

@@ -381,7 +396,7 @@
 static int init_history_remeasurement() {
   int last_active_z_window_id;

-  TRACE_LOG("total_nof_lines_stored: %d\n", total_nof_lines_stored);
+  TRACE_LOG("total_nof_lines_stored: %ld\n", total_nof_lines_stored);

   z_windows[measurement_window_id]->ypos
     = z_windows[0]->ypos;
@@ -486,18 +501,41 @@

 static void remeasure_next_paragraph() {
-  if (output_repeat_paragraphs(measurement_history, 1, true, true) < 0) {
+  int return_code, last_lines_in_history, lines_in_paragraph;
+
+  last_lines_in_history
+    = z_windows[measurement_window_id]->nof_consecutive_lines_output;
+
+  return_code
+    = output_repeat_paragraphs(measurement_history, 1, true, true);
+
+  lines_in_paragraph
+    = z_windows[measurement_window_id]->nof_consecutive_lines_output
+    - last_lines_in_history;
+
+  alter_last_paragraph_attributes(
+      measurement_history,
+      lines_in_paragraph + 1,
+      z_windows[0]->xsize);
+
+  TRACE_LOG("Remeasured paragraph had %d lines.\n", lines_in_paragraph);
+
+  if (return_code < 0) {
     // Finished remeasuring.
     TRACE_LOG("output_repeat_paragraphs returned < 0.\n");
     flush_window(measurement_window_id);
     history_is_being_remeasured = false;
     total_lines_in_history
       = z_windows[measurement_window_id]->nof_consecutive_lines_output - 1;
+    //printf("remeasure: total_lines_in_history: %ld.\n",
+    //    total_lines_in_history);
     TRACE_LOG("Finished remeasuring, %d lines in history.\n",
         total_lines_in_history);
   }
   else {
     // Not finished, process next paragraph.
+    //printf("nof_consecutive_lines_output: %d.\n",
+    //    z_windows[measurement_window_id]->nof_consecutive_lines_output);
     z_ucs_output(newline_string);
   }
 }
@@ -570,12 +608,13 @@

   //printf("Breaking line.\n");
   TRACE_LOG("Breaking line for window %d.\n", window_number);
+  TRACE_LOG("breakline-redraw_pixel_lines_to_skip_ %d.\n",
+      redraw_pixel_lines_to_skip);

   if (window_number != measurement_window_id) {
     clear_to_eol(window_number);

-    // We'll calculate the space we need below the current y_size that we need
-    // for a new line. If this is > 0 we have to scroll.
+    // We'll calculate the space below current line.
     TRACE_LOG("ycursorpos: %d.\n", z_windows[window_number]->ycursorpos);
     TRACE_LOG("line_height: %d.\n", line_height);
     TRACE_LOG("lower_padding: %d.\n", z_windows[window_number]->lower_padding);
@@ -615,7 +654,11 @@
     if (window_number != measurement_window_id) {
       // Only adjust y in case we're not measuring.

-      if (yspace_in_pixels < line_height) {
+      if ((redraw_pixel_lines_to_draw == -1)
+          && (yspace_in_pixels < line_height)) {
+        // We know we never have to scroll in redraw_mode, so we can skip
+        // this entire section when redrawing (which we determine by testing
+        // redraw_pixel_lines_to_draw == -1).
         nof_lines_to_scroll
           = z_windows[window_number]->ycursorpos
           + line_height
@@ -657,11 +700,28 @@
       else {
         TRACE_LOG(
             "breaking line, moving cursor down, no scrolling necessary.\n");
-        z_windows[window_number]->ycursorpos += line_height;
+        if (redraw_pixel_lines_to_skip > 0) {
+          // redraw_pixel_lines_to_skip cannot be greather than line_height,
+          // since we're catching this case before break_line is invoked.
+          z_windows[window_number]->ycursorpos
+            += (line_height - redraw_pixel_lines_to_skip);
+          redraw_pixel_lines_to_draw
+            -= (line_height - redraw_pixel_lines_to_skip);
+          redraw_pixel_lines_to_skip = 0;
+        }
+        else {
+          z_windows[window_number]->ycursorpos += line_height;
+          if (redraw_pixel_lines_to_draw != -1) {
+           if ((redraw_pixel_lines_to_draw -= line_height) < 0) {
+             redraw_pixel_lines_to_draw = 0;
+           }
+          }
+        }
       }
     }
     TRACE_LOG("new y-cursorpos: %d\n", z_windows[window_number]->ycursorpos);
   }
+  //printf("redraw_pixel_lines_to_draw: %d.\n", redraw_pixel_lines_to_draw);

   z_windows[window_number]->last_gylphs_xcursorpos = -1;
   z_windows[window_number]->rightmost_filled_xpos
@@ -673,6 +733,7 @@
   if ( (refresh_active == false) && (active_z_window_id == 0) ) {
     total_lines_in_history++;
     TRACE_LOG("total_lines_in_history: %ld.\n", total_lines_in_history);
+    //printf("total_lines_in_history: %ld.\n", total_lines_in_history);
   }

   if (window_number != measurement_window_id) {
@@ -800,6 +861,26 @@
   }
   */

+
+  // redraw_pixel_lines_to_draw will be 0 or greater in case of
+  // redraws, -1 during normal operation.
+  if (redraw_pixel_lines_to_draw == 0) {
+    if (charcode == Z_UCS_NEWLINE) {
+      z_windows[window_number]->nof_consecutive_lines_output++;
+      return 1;
+    }
+    return 0;
+  }
+
+  if (redraw_pixel_lines_to_skip >= line_height) {
+    if (charcode == Z_UCS_NEWLINE) {
+      redraw_pixel_lines_to_skip -= line_height;
+      z_windows[window_number]->nof_consecutive_lines_output++;
+      return 1;
+    }
+    return 0;
+  }
+
   if (charcode == Z_UCS_NEWLINE) {
     if (break_line(window_number) == false) {
       if (no_more_space != NULL)
@@ -893,8 +974,11 @@
           x,
           y,
           x_max,
-          0,
-          0,
+          redraw_pixel_lines_to_skip,
+          ( (redraw_pixel_lines_to_draw >= 0)
+            && (redraw_pixel_lines_to_draw < line_height)
+            ? line_height - redraw_pixel_lines_to_draw
+            : 0),
           reverse == false ? foreground_colour : background_colour,
           reverse == false ? background_colour : foreground_colour,
           screen_pixel_interface,
@@ -1380,6 +1464,16 @@

 static void z_ucs_output(z_ucs *z_ucs_output) {
+  /*
+  if ( (active_z_window_id == 0) && (z_ucs_len(z_ucs_output) > 0) ) {
+    printf("Output: \"");
+    for (int i=0; i<z_ucs_len(z_ucs_output); i++) {
+      printf("%c", z_ucs_output[i]);
+    }
+    printf("\".\n");
+  }
+  */
+
   TRACE_LOG("Output: \"");
   TRACE_LOG_Z_UCS(z_ucs_output);
   TRACE_LOG("\" to window %d, buffering: %d.\n",
@@ -2326,7 +2420,6 @@
         *current_input_y, nof_input_lines);
   }

-
   if (display_cursor == true) {
     draw_cursor();
   }
@@ -2653,6 +2746,7 @@
   refresh_scrollbar();
   screen_pixel_interface->update_screen();

+  z_windows[0]->nof_consecutive_lines_output = 0;
   refresh_active = false;
   disable_more_prompt = false;
 }
@@ -2664,20 +2758,22 @@

 void handle_scrolling(int event_type) {
-  int lines_to_copy, lines_to_draw, saved_padding; //, line_shift,
+  int lines_to_copy, saved_padding; //, line_shift,
   int top_line_to_draw;
   int last_active_z_window_id;
   int paragraph_attr1, paragraph_attr2;
-  int top_redraw_line;
   int nof_paragraphs;
   int max_top_scroll_line;
   int previous_upscroll_position;
   int history_screen_line_buf;
   int return_code;
   int extra_padding;
-  //z_ucs input;
+  z_ucs input;

   TRACE_LOG("Starting handle_scrolling.\n");
+
+  if (event_type == EVENT_WAS_CODE_PAGE_DOWN)
+    return;

   if ( (event_type == EVENT_WAS_CODE_PAGE_DOWN)
       && (top_upscroll_line <= z_windows[0]->ysize) ) {
@@ -2685,8 +2781,14 @@
     return;
   }

-  max_top_scroll_line = total_lines_in_history * line_height
-    + z_windows[0]->lower_padding;
+  max_top_scroll_line
+    = (nof_input_lines - 1 + total_lines_in_history) * line_height
+    + z_windows[0]->lower_padding - 1;
+  // We're always using the term "nof_input_lines - 1" since the last
+  // history line and the first input line share the same line on screen.
+  //printf("nof_input_lines: %d\n", nof_input_lines);
+  //printf("max_top_scroll_line: %d.\n", max_top_scroll_line);
+  TRACE_LOG("max_top_scroll_line: %d.\n", max_top_scroll_line);

   if ( (event_type == EVENT_WAS_CODE_PAGE_UP)
       && (top_upscroll_line >= max_top_scroll_line) ) {
@@ -2726,12 +2828,13 @@
     TRACE_LOG("History: %p\n", history);
     TRACE_LOG("z_windows[0]->ysize: %d.\n", z_windows[0]->ysize);
     history_screen_line = 0;
-    top_upscroll_line = z_windows[0]->ysize;
-  }
+    top_upscroll_line = z_windows[0]->ysize - 1;
+  }
+
+  previous_upscroll_position = top_upscroll_line;

   if (event_type == EVENT_WAS_CODE_PAGE_UP) {

-    previous_upscroll_position = top_upscroll_line;
     top_upscroll_line += (z_windows[0]->ysize / 2);

     if (top_upscroll_line >= max_top_scroll_line) {
@@ -2754,52 +2857,33 @@
         z_windows[active_z_window_id]->xpos,
         lines_to_copy,
         z_windows[active_z_window_id]->xsize);
-
     //screen_pixel_interface->update_screen();
     //event_type = get_next_event_wrapper(&input, 0);

-    TRACE_LOG("history_screen_line: %d.\n", history_screen_line);
-    //saved_padding = z_windows[0]->lower_padding;
-    //z_windows[0]->lower_padding += lines_to_copy;
-
-    lines_to_draw = z_windows[0]->ysize - lines_to_copy;
-    top_line_to_draw = top_upscroll_line;
-
-    /*
-    line_shift
-      = (top_upscroll_line + z_windows[0]->lower_padding) % line_height;
-    // line_shift indicates how many pixels we're above top of the next
-    // full text line of the window. For example, for a
-    // text_shift value of 4 the top 4 pixel lines of the topmost textline
-    // would be missing. 0 would indicate the the top most textline
-    // fits exactly into the the top of the drawing area.
-    TRACE_LOG("line_shift: %d.\n", line_shift);
-    */
-
-    TRACE_LOG("lines_to_draw: %d.\n", lines_to_draw);
-    TRACE_LOG("line_height: %d.\n", line_height);
-
-    TRACE_LOG("history_screen_line: %d.\n", history_screen_line);
+    redraw_pixel_lines_to_draw = z_windows[0]->ysize - lines_to_copy;

     screen_pixel_interface->fill_area(
         z_windows[0]->xpos,
         z_windows[0]->ypos,
         z_windows[0]->xsize,
-        lines_to_draw,
-        z_to_rgb_colour(Z_COLOUR_RED));
-        //z_to_rgb_colour(z_windows[0]->output_background_colour));
+        redraw_pixel_lines_to_draw,
+        z_to_rgb_colour(z_windows[0]->output_background_colour));
+    //z_to_rgb_colour(Z_COLOUR_RED));
+    //screen_pixel_interface->update_screen();
+    //event_type = get_next_event_wrapper(&input, 0);

     TRACE_LOG("history_screen_line: %d.\n", history_screen_line);
-
-    TRACE_LOG("history_screen_line: %d.\n", history_screen_line);
-    TRACE_LOG("line_height: %d.\n", line_height);
+    //saved_padding = z_windows[0]->lower_padding;
+    //z_windows[0]->lower_padding += lines_to_copy;
+
+    top_line_to_draw = 0;
   }
   else if (event_type == EVENT_WAS_CODE_PAGE_DOWN) {
     if (top_upscroll_line > 0) {
     }

     // Just for testing:
-    lines_to_draw = 0;
+    redraw_pixel_lines_to_draw = 0;
   }
   else {
     // Neither up nor down?
@@ -2810,172 +2894,102 @@

   // Check if the history is pointing at some place below the
   // current window to redraw.
-  if (history_screen_line * line_height
-      < top_upscroll_line - lines_to_draw) {
-
-    TRACE_LOG("history pointing below redraw area.\n");
-
-    do {
-      paragraph_attr1 = 0;
-      // In case we're repeating the very last paragraph this likely
-      // won't have its height stored in the history (simply because
-      // it hasn't been finished yet). In order to detect this we'll
-      // set paragraph_attr1 to 0 and compare later.
-
+  while (top_upscroll_line + 1
+      > (nof_input_lines - 1 + history_screen_line) * line_height
+      + z_windows[0]->lower_padding) {
+
+    paragraph_attr1 = 0;
+    // In case we're repeating the very last paragraph this likely
+    // won't have its height stored in the history (simply because
+    // it hasn't been finished yet). In order to detect this we'll
+    // set paragraph_attr1 to 0 and compare later.
+
+    TRACE_LOG("history_screen_line: %d.\n", history_screen_line);
+    TRACE_LOG("pre-rewind: paragraph_attr1:%d, paragraph_attr2: %d.\n",
+          paragraph_attr1, paragraph_attr2);
+
+    // Rewind history by one paragraph
+    return_code = output_rewind_paragraph(history, NULL,
+        &paragraph_attr1, &paragraph_attr2);
+    TRACE_LOG("return_code: %d.\n", return_code);
+
+    // Adapt line number that history is currently pointing to.
+
+    if (return_code == 0) {
+      TRACE_LOG("rewind: paragraph_attr1:%d, paragraph_attr2: %d.\n",
+          paragraph_attr1, paragraph_attr2);
       TRACE_LOG("history_screen_line: %d.\n", history_screen_line);
-      TRACE_LOG("pre-rewind: paragraph_attr1:%d, paragraph_attr2: %d.\n",
-          paragraph_attr1, paragraph_attr2);
-
-      // Rewind history by one paragraph
-      return_code = output_rewind_paragraph(history, NULL,
-          &paragraph_attr1, &paragraph_attr2);
-      TRACE_LOG("return_code: %d.\n", return_code);
-
-      // Adapt line number that history is currently pointing to.
+
       history_screen_line
         += paragraph_attr1 != 0 ? paragraph_attr1 : 1;
-
-      if (return_code == 0) {
-        TRACE_LOG("rewind: paragraph_attr1:%d, paragraph_attr2: %d.\n",
-            paragraph_attr1, paragraph_attr2);
-        TRACE_LOG("history_screen_line: %d.\n", history_screen_line);
-      }
-      else if (return_code == 1) {
-        TRACE_LOG("Hit buffer back while rewinding / %d.\n",
-            history_screen_line);
-      }
-
-      TRACE_LOG("history_screen_line * line_height: %d.\n",
-          history_screen_line * line_height);
-      TRACE_LOG("top_upscroll_line - lines_to_draw: %d.\n",
-          top_upscroll_line - lines_to_draw);
-    }
-    // Scroll up until we're above the lowest line to refresh.
-    while (history_screen_line * line_height
-        < top_upscroll_line - lines_to_draw);
-
-    TRACE_LOG("history_screen_line: %d.\n",
-        history_screen_line);
-    TRACE_LOG("line_height: %d.\n",
-        line_height);
-    TRACE_LOG("history_screen_line * line_height: %d.\n",
-        history_screen_line * line_height);
-    TRACE_LOG("top_upscroll_line - lines_to_draw: %d.\n",
-        top_upscroll_line - lines_to_draw);
-
-    top_redraw_line
-      = top_upscroll_line - history_screen_line * line_height
-      - z_windows[0]->lower_padding;
-
-    z_windows[0]->ycursorpos = top_redraw_line;
-    TRACE_LOG("redraw at ypos: %d.\n", z_windows[0]->ycursorpos);
-    reset_xcursorpos(0);
-
-    // For the case that the paragraph we're repeating is so large that the
-    // window would scroll up we're disabling scrolling before.
-    z_windows[0]->scrolling_active = false;
-    z_windows[0]->nof_lines_in_current_paragraph = 1;
-    output_repeat_paragraphs(history, 1, true, false);
+      //printf("rewind, history_screen_line: %d.\n", history_screen_line);
+    }
+    else if (return_code == 1) {
+      TRACE_LOG("Hit buffer back while rewinding / %d.\n",
+          history_screen_line);
+    }
+
+    //printf("tusl: %d, h*l*lp:%d\n", top_upscroll_line + 1,
+    //    (nof_input_lines - 1 + history_screen_line) * line_height
+    //    + z_windows[0]->lower_padding);
+  }
+
+  redraw_pixel_lines_to_skip
+    = ((nof_input_lines - 1 + history_screen_line) * line_height
+        + z_windows[0]->lower_padding)
+    - top_upscroll_line - 1;
+  TRACE_LOG("redraw_pixel_lines_to_skip: %d.\n", redraw_pixel_lines_to_skip);
+  //printf("redraw_pixel_lines_to_skip: %d.\n", redraw_pixel_lines_to_skip);
+
+  TRACE_LOG("history_screen_line: %d.\n",
+      history_screen_line);
+  TRACE_LOG("line_height: %d.\n",
+      line_height);
+  TRACE_LOG("history_screen_line * line_height: %d.\n",
+      history_screen_line * line_height);
+
+  z_windows[0]->ycursorpos = top_line_to_draw;
+  TRACE_LOG("redraw at ypos: %d.\n", z_windows[0]->ycursorpos);
+  reset_xcursorpos(0);
+
+  //printf("redraw_pixel_lines_to_draw: %d.\n", redraw_pixel_lines_to_draw);
+  while (redraw_pixel_lines_to_draw > 0) {
+    z_windows[0]->nof_consecutive_lines_output = 0;
+    //printf("ypos at %d.\n", z_windows[0]->ycursorpos);
+    output_repeat_paragraphs(history, 1, true, true);
+    z_ucs_output(newline_string);
     flush_window(0);
-    z_windows[0]->scrolling_active = true;
-
-    nof_paragraphs = 0;
-    history_screen_line_buf = history_screen_line;
-    extra_padding = 0;
-
-    do {
-      paragraph_attr1 = 0;
-      // In case we're repeating the very last paragraph this likely
-      // won't have its height stored in the history (simply because
-      // it hasn't been finished yet). In order to detect this we'll
-      // set paragraph_attr1 to 0 and compare later.
-
-      TRACE_LOG("history_screen_line: %d.\n", history_screen_line);
-      TRACE_LOG("pre-rewind: paragraph_attr1:%d, paragraph_attr2: %d.\n",
-          paragraph_attr1, paragraph_attr2);
-
-      // Rewind history by one paragraph
-      return_code = output_rewind_paragraph(
-          history, NULL, &paragraph_attr1, &paragraph_attr2);
-
-      if (return_code == 0) {
-        nof_paragraphs++;
-        /*
-           printf("rewind: paragraph_attr1:%d, paragraph_attr2: %d.\n",
-           paragraph_attr1, paragraph_attr2);
-           printf("history_screen_line: %d.\n", history_screen_line);
-           */
-        TRACE_LOG("rewind: paragraph_attr1:%d, paragraph_attr2: %d.\n",
-            paragraph_attr1, paragraph_attr2);
-        TRACE_LOG("history_screen_line: %d.\n", history_screen_line);
-
-        // Adapted line number that history is currently pointing to.
-        history_screen_line
-          += paragraph_attr1 != 0 ? paragraph_attr1 : 1;
-      }
-      else if (return_code == 1) {
-        TRACE_LOG("Hit buffer back.\n");
-        extra_padding = z_windows[0]->lower_padding;
-        screen_pixel_interface->fill_area(
-            z_windows[0]->xpos,
-            z_windows[0]->ypos,
-            z_windows[0]->xsize,
-            extra_padding,
-            z_to_rgb_colour(Z_COLOUR_GREEN));
-            //z_to_rgb_colour(z_windows[0]->output_background_colour));
-        break;
-      }
-
-      TRACE_LOG("history_screen_line * line_height: %d.\n",
-          history_screen_line * line_height);
-      TRACE_LOG("top_upscroll_line +  z_windows[0]->lower_padding: %d.\n",
-          top_upscroll_line +  z_windows[0]->lower_padding);
-    }
-    // Scroll up until we're above the lowest line to refresh.
-    while (history_screen_line * line_height
-        < top_upscroll_line + z_windows[0]->lower_padding);
-    TRACE_LOG("Finish, history_screen_line: %d.\n", history_screen_line);
-
-    // FIXME: when line_height < lines_to_draw.
-
-    saved_padding = z_windows[0]->lower_padding;
-    z_windows[0]->lower_padding
-      = z_windows[0]->ysize - top_redraw_line;
-    TRACE_LOG("top_redraw_line: %d.\n", top_redraw_line);
-    TRACE_LOG("lower redraw padding: %d.\n", z_windows[0]->lower_padding);
-    z_windows[0]->ycursorpos = top_redraw_line - line_height;
-    TRACE_LOG("ycursorpos redraw: %d.\n", z_windows[0]->ycursorpos);
-    reset_xcursorpos(0);
-    freetype_wordwrap_reset_position(z_windows[0]->wordwrapper);
-
-    z_windows[0]->nof_lines_in_current_paragraph = 1;
-    TRACE_LOG("Repeating %d paragraphs for redraw.\n", nof_paragraphs);
-    TRACE_LOG("ycursorpos redraw: %d.\n", z_windows[0]->ycursorpos);
-    output_repeat_paragraphs(history, nof_paragraphs, true, true);
-    history_screen_line = history_screen_line_buf;
-    flush_window(0);
-    freetype_wordwrap_reset_position(z_windows[0]->wordwrapper);
-
-    z_windows[0]->lower_padding = saved_padding;
-  }
-
-  // Check if the history is pointing to some place above the
-  // current window to redraw.
-  else if (history_screen_line * line_height
-      > top_upscroll_line) {
-
-    TRACE_LOG("history pointing above area.\n");
-
-  }
-  else {
-    TRACE_LOG("history pointing inside redraw area.\n");
-  }
-
+    //printf("redraw, history_screen_line: %d.\n", history_screen_line);
+    history_screen_line -= z_windows[0]->nof_consecutive_lines_output;
+    //printf("redraw, history_screen_line: %d.\n", history_screen_line);
+
+    //printf("total_nof_lines_stored: %ld\n", total_nof_lines_stored);
+    //printf("history_screen_line: %d.\n", history_screen_line);
+    //printf("redraw_pixel_lines_to_draw: %d.\n", redraw_pixel_lines_to_draw);
+    //screen_pixel_interface->update_screen();
+    //event_type = get_next_event_wrapper(&input, 0);
+  }
+
+  freetype_wordwrap_reset_position(z_windows[0]->wordwrapper);
   refresh_scrollbar();
   screen_pixel_interface->update_screen();
   disable_more_prompt = false;
+  z_windows[0]->nof_consecutive_lines_output = 0;

   TRACE_LOG("End of handle_scrolling.\n");
+}
+
+
+void end_scrolling() {
+  // End up-scroll.
+  TRACE_LOG("Ending scrollback.\n");
+  top_upscroll_line = -1;
+  upscroll_hit_top = false;
+  destroy_history_output(history);
+  history = NULL;
+  redraw_pixel_lines_to_skip = 0;
+  redraw_pixel_lines_to_draw = -1;
+  screen_pixel_interface->set_cursor_visibility(true);
 }

@@ -3235,13 +3249,7 @@
     }
     else {
       if (top_upscroll_line != -1) {
-        // End up-scroll.
-        TRACE_LOG("Ending scrollback.\n");
-        top_upscroll_line = -1;
-        upscroll_hit_top = false;
-        destroy_history_output(history);
-        history = NULL;
-        screen_pixel_interface->set_cursor_visibility(true);
+        end_scrolling();
         refresh_screen();
       }

@@ -3993,6 +4001,8 @@
   if ( (newysize < 1) || (newxsize < 1) )
     return;

+  end_scrolling();
+
   TRACE_LOG("Setting history_is_being_remeasured to true.\n");
   history_has_to_be_remeasured();


--- coders/sixel.c
+++ coders/sixel.c
@@ -1043,11 +1043,11 @@
       if ((*p == '}') && (*(p+1) == ';'))
         break;
       p+=strlen(p);
-      if ((size_t) (p-sixel_buffer+MagickPathExtent) < length)
+      if ((size_t) (p-sixel_buffer+MagickPathExtent+1) < length)
         continue;
       length<<=1;
       sixel_buffer=(char *) ResizeQuantumMemory(sixel_buffer,length+
-        MagickPathExtent,sizeof(*sixel_buffer));
+        MagickPathExtent+1,sizeof(*sixel_buffer));
       if (sixel_buffer == (char *) NULL)
         break;
       p=sixel_buffer+strlen(sixel_buffer);


build: 0.19 release updates on master

build: 0.19 release updates on master

as per doc/release-process.md.

Note: On branch-off, these same changes should be made on the release branch, with also these additional changes to both files:

  - set `CLIENT_VERSION_REVISION` to `0`
  - set `CLIENT_VERSION_IS_RELEASE` to `true`

Former-commit-id: ac8b9190e00df1455d8fc3351bbfaf9194198068

--- build_msvc/syscoin_config.h
+++ build_msvc/syscoin_config.h
@@ -14,7 +14,7 @@
 #define CLIENT_VERSION_MAJOR 4

 /* Minor version */
-#define CLIENT_VERSION_MINOR 18
+#define CLIENT_VERSION_MINOR 1

 /* Build revision */
 #define CLIENT_VERSION_REVISION 0
@@ -346,7 +346,7 @@
 #define PACKAGE_NAME "Syscoin Core"

 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "Syscoin Core 4.0.0"
+#define PACKAGE_STRING "Syscoin Core 4.1.0"

 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "syscoin"
@@ -355,7 +355,7 @@
 #define PACKAGE_URL "https://syscoin.org/"

 /* Define to the version of this package. */
-#define PACKAGE_VERSION "4.0.0"
+#define PACKAGE_VERSION "4.1.0"

 /* Define to necessary symbol if this constant uses a non-standard name on
    your system. */


ENH: File open dialog can open multiple files at once now

--- Qmitk/QmitkApplicationBase/QmitkMainTemplate.ui.h
+++ Qmitk/QmitkApplicationBase/QmitkMainTemplate.ui.h
@@ -1,19 +1,19 @@
 /*=========================================================================
-
+
 Program:   Medical Imaging & Interaction Toolkit
 Module:    $RCSfile$
 Language:  C++
 Date:      $Date$
 Version:   $Revision$
-
+
 Copyright (c) German Cancer Research Center, Division of Medical and
 Biological Informatics. All rights reserved.
 See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
+
 This software is distributed WITHOUT ANY WARRANTY; without even
 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 PURPOSE.  See the above copyright notices for more information.
-
+
 =========================================================================*/

@@ -95,38 +95,40 @@
 template <class T>
 static void __buildstring( ipPicDescriptor *pic, itk::Point<int, 3> p, QString &s, T dummy=0)
 {
-   QString value;
-   if ( p[0] < pic->n[0] && p[1] < pic->n[1] && p[2] < pic->n[2] ) {
-   if(pic->bpe!=24)
-   {
-       value.setNum(((T*) pic->data)[ p[0] + p[1]*pic->n[0] + p[2]*pic->n[0]*pic->n[1] ]);
-   }
-   else
-   {
-       value.setNum(((T*) pic->data)[p[0]*3 + 0 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]);
-       value.setNum(((T*) pic->data)[p[0]*3 + 1 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]);
-       value.setNum(((T*) pic->data)[p[0]*3 + 2 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]);
-   }
-   s+=value;
-} else {
-  s+= "point out of data";
-}
+  QString value;
+  if ( p[0] < pic->n[0] && p[1] < pic->n[1] && p[2] < pic->n[2] )
+  {
+    if(pic->bpe!=24)
+    {
+      value.setNum(((T*) pic->data)[ p[0] + p[1]*pic->n[0] + p[2]*pic->n[0]*pic->n[1] ]);
+    }
+    else
+    {
+      value.setNum(((T*) pic->data)[p[0]*3 + 0 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]);
+      value.setNum(((T*) pic->data)[p[0]*3 + 1 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]);
+      value.setNum(((T*) pic->data)[p[0]*3 + 2 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]);
+    }
+    s+=value;
+  }
+  else
+  {
+    s+= "point out of data";
+  }
 }
 class posOutputType : public mitk::OperationActor
 {
   mitk::DataTreeIteratorClone m_DataTreeIterator;
   mitk::ImageTimeSelector::Pointer m_TimeSelector;
 public:
-
+
   posOutputType(mitk::DataTreeIteratorBase* iterator)
   {
     m_DataTreeIterator = iterator;
     m_TimeSelector = mitk::ImageTimeSelector::New();
   }
-
+
   ~posOutputType()
-  {
-  }
+  {}

   typedef mitk::Operation Operation;
   void ExecuteOperation(Operation* operation) //writing mitk::Operation causes QT-Designer to create a Slot calles Operation*operation) and thus causes errors. Thats why we here have a typedef. //TODO: FIX it!
@@ -134,7 +136,7 @@
     mitk::PointOperation* pointoperation = dynamic_cast<mitk::PointOperation*>(operation);

     if ( pointoperation != NULL )
-    {
+    {
       switch ( operation->GetOperationType() )
       {
       case mitk::OpMOVE:
@@ -187,7 +189,7 @@
               return;

             m_TimeSelector->SetTimeNr(timestep);
-            m_TimeSelector->UpdateLargestPossibleRegion();
+            m_TimeSelector->UpdateLargestPossibleRegion();

             image = m_TimeSelector->GetOutput();

@@ -200,7 +202,7 @@
               pixel.sprintf(" (%.2f,%.2f,%.2f) [pixel] ", p[0], p[1], p[2]);
             s+=pixel;

-            ipPicDescriptor* pic = image->GetPic();
+            ipPicDescriptor* pic = image->GetPic();

             mitk::FillVector3D(p, (int)(p[0]+0.5), (int)(p[1]+0.5), (int)(p[2]+0.5));
             if ( image->GetGeometry()->IsIndexInside(p) )
@@ -213,11 +215,11 @@
               }
               else
                 __buildstring(pic, pi, s, (unsigned char) 1);
-            }
+            }
           }
           mitk::StatusBar::DisplayText(s.ascii(), 10000);
           break;
-        }
+        }
       case mitk::OpNOTHING:
         break;
       default:
@@ -231,23 +233,20 @@
 QmitkMainTemplate* QmitkMainTemplate::m_Instance = NULL;

 void QmitkMainTemplate::fileNew()
-{
-
-}
+{}

 void QmitkMainTemplate::fileOpen()
 {
 #ifdef MBI_INTERNAL
-//  QString fileName = QFileDialog::getOpenFileName(NULL,"all (*.seq *.pic *.pic.gz *.seq.gz *.pvtk *.stl *.vtk *.ves *.uvg *.par *.dcm *.mhd *.png *.tif *.jpg hpsonos.db HPSONOS.DB);;DKFZ Pic (*.seq *.pic *.pic.gz *.seq.gz);;surface files (*.stl *.vtk);;stl files (*.stl);;vtk surface files (*.vtk);;vtk image files (*.pvtk);;vessel files (*.ves *.uvg);;par/rec files (*.par);;DSR files (hpsonos.db HPSONOS.DB);;DICOM files (*.dcm)");
-  QString fileName = QFileDialog::getOpenFileName(NULL,CommonFunctionality::GetInternalFileExtensions());
+  //  QString fileName = QFileDialog::getOpenFileName(NULL,"all (*.seq *.pic *.pic.gz *.seq.gz *.pvtk *.stl *.vtk *.ves *.uvg *.par *.dcm *.mhd *.png *.tif *.jpg hpsonos.db HPSONOS.DB);;DKFZ Pic (*.seq *.pic *.pic.gz *.seq.gz);;surface files (*.stl *.vtk);;stl files (*.stl);;vtk surface files (*.vtk);;vtk image files (*.pvtk);;vessel files (*.ves *.uvg);;par/rec files (*.par);;DSR files (hpsonos.db HPSONOS.DB);;DICOM files (*.dcm)");
+  QStringList fileNames = QFileDialog::getOpenFileNames(CommonFunctionality::GetInternalFileExtensions(), NULL);
 #else
-//  QString fileName = QFileDialog::getOpenFileName(NULL,"all (*.seq *.pic *.pic.gz *.seq.gz *.pvtk *.stl *.vtk *.par  *.png *.tif *.jpg);;DKFZ Pic (*.seq *.pic *.pic.gz *.seq.gz);;surface files (*.stl *.vtk);;stl files (*.stl);;vtk surface files (*.vtk);;vtk image files (*.pvtk);;par/rec files (*.par);;DICOM files (*.dcm)");
-  QString fileName = QFileDialog::getOpenFileName( NULL,CommonFunctionality::GetExternalFileExtensions() );
+  //  QString fileName = QFileDialog::getOpenFileName(NULL,"all (*.seq *.pic *.pic.gz *.seq.gz *.pvtk *.stl *.vtk *.par  *.png *.tif *.jpg);;DKFZ Pic (*.seq *.pic *.pic.gz *.seq.gz);;surface files (*.stl *.vtk);;stl files (*.stl);;vtk surface files (*.vtk);;vtk image files (*.pvtk);;par/rec files (*.par);;DICOM files (*.dcm)");
+  QStringList fileNames = QFileDialog::getOpenFileNames( CommonFunctionality::GetExternalFileExtensions(), NULL );
 #endif
-
-  if ( !fileName.isNull() )
-  {
-    fileOpen(fileName.ascii());
+  for ( QStringList::Iterator it = fileNames.begin(); it != fileNames.end(); ++it )
+  {
+    fileOpen((*it).ascii());
   }
 }

@@ -358,9 +357,7 @@

 void QmitkMainTemplate::fileSave()
-{
-
-}
+{}

 void QmitkMainTemplate::fileSaveAs()
 {
@@ -417,9 +414,7 @@
 }

 void QmitkMainTemplate::filePrint()
-{
-
-}
+{}

 void QmitkMainTemplate::fileExit()
 {
@@ -437,39 +432,25 @@
 }

 void QmitkMainTemplate::editCut()
-{
-
-}
+{}

 void QmitkMainTemplate::editCopy()
-{
-
-}
+{}

 void QmitkMainTemplate::editPaste()
-{
-
-}
+{}

 void QmitkMainTemplate::editFind()
-{
-
-}
+{}

 void QmitkMainTemplate::helpIndex()
-{
-
-}
+{}

 void QmitkMainTemplate::helpContents()
-{
-
-}
+{}

 void QmitkMainTemplate::helpAbout()
-{
-
-}
+{}

 void QmitkMainTemplate::init()
@@ -493,13 +474,13 @@

 /*!
 \brief basic initialization of main widgets
-
+
 The method is should be called at the end of the initialize-method of its
 subclasses.
 */
 void QmitkMainTemplate::Initialize()
 {
-   mitk::DataTreePreOrderIterator it(tree);
+  mitk::DataTreePreOrderIterator it(tree);
   //initialize interaction sub-system: undo-controller, statemachine-factory and global-interaction

   // test for environment variable MITKCONF
@@ -584,16 +565,14 @@

 /*!
-
+
 */
 void QmitkMainTemplate::InitializeFunctionality()
-{
-
-}
+{}

 /*!
 \brief this method initializes the Qmitk functionality mediator
-
+
 When subclassing this template class the developer can overwrite the method
 to provide different layout templates
 */
@@ -651,7 +630,8 @@
   }
 }

-mitk::DataTree::Pointer QmitkMainTemplate::GetTree() {
+mitk::DataTree::Pointer QmitkMainTemplate::GetTree()
+{
   return tree;
 }

@@ -760,11 +740,11 @@

 bool QmitkMainTemplate::GetStandardViewsInitialized()
 {
-    return m_StandardViewsInitialized;
+  return m_StandardViewsInitialized;
 }

 void QmitkMainTemplate::SetStandardViewsInitialized( bool areInitialized )
 {
-    m_StandardViewsInitialized = areInitialized;
-}
+  m_StandardViewsInitialized = areInitialized;
+}


Undefine STATUS_SUM, because it is not needed, and it makes
bktr(4) work on alpha.

ok mickey@

--- dev/pci/bktr/bktr_core.c
+++ dev/pci/bktr/bktr_core.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: bktr_core.c,v 1.17 2005/06/23 14:57:48 robert Exp $	*/
+/*	$OpenBSD: bktr_core.c,v 1.18 2005/11/15 14:33:29 robert Exp $	*/
 /* $FreeBSD: src/sys/dev/bktr/bktr_core.c,v 1.114 2000/10/31 13:09:56 roger Exp $ */

 /*
@@ -387,8 +387,10 @@

 /* debug utility for holding previous INT_STAT contents */
-#define STATUS_SUM
+#undef STATUS_SUM
+#if defined( STATUS_SUM )
 static u_int	status_sum = 0;
+#endif

 /*
  * defines to make certain bit-fiddles understandable
@@ -2294,9 +2296,12 @@
 int
 bktr_common_ioctl( bktr_ptr_t bktr, ioctl_cmd_t cmd, caddr_t arg )
 {
-        int                           pixfmt;
-	unsigned int	              temp;
+	int                           pixfmt;
 	struct meteor_pixfmt          *pf_pub;
+
+#if defined( STATUS_SUM )
+	unsigned int                  temp;
+#endif

 	switch (cmd) {


Added trainer input

Added trainer input

Former-commit-id: a19c009674ee36e61390ebbcb19f1f6d35c48bb5

--- dynet/mp.h
+++ dynet/mp.h
@@ -432,6 +432,29 @@
         return return_value;
       }
     }
+
+    template<class D, class S>
+    S run_mp_minibatch_trainer(unsigned num_children, ILearner<D, S>* learner, Trainer* inputTrainer, const std::vector<D>& data) {
+      queue_name = generate_queue_name();
+      boost::interprocess::message_queue::remove(queue_name.c_str());
+      boost::interprocess::message_queue::remove(queue_name.c_str());
+      shared_memory_name = generate_shared_memory_name();
+      shared_object = get_shared_memory<SharedObject>();
+      std::vector<Workload> workloads = create_workloads(num_children);
+      std::vector<D> dev_data;
+      Trainer* trainer = inputTrainer;
+      unsigned cid = spawn_children(workloads);
+      if (cid < num_children) {
+        run_child(cid, learner, trainer, workloads, data, dev_data);
+        exit(0);
+      }
+      else {
+        S return_value = run_simple_parent(data, learner, workloads);
+        cleanup(workloads);
+        return return_value;
+      }
+    }
+
   }
 }
 #endif // !_WINDOWS


changed timeformat from HH:MM:SS to HHMMSS.
OsyncFormatSpec and TimeSpecReference

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

--- opensync/opensync_time.c
+++ opensync/opensync_time.c
@@ -26,8 +26,8 @@
  * Time formatting helper
  */

-/* Function remove dashes from datestamp.
- * Returns: YYYYMMDD[THH:MM:DD[Z]]
+/* Function remove dashes from datestamp and colon.
+ * Returns: YYYYMMDD[THHMMDD[Z]]
  */
 char *osync_time_timestamp_remove_dash(const char *timestamp) {
         int i, len;
@@ -38,6 +38,9 @@
 	for (i=0; i < len; i++) {
 		if (timestamp[i] == '-')
 			continue;
+
+		if (timestamp[i] == ':')
+			continue

 		str = g_string_append_c(str, timestamp[i]);
 	}
@@ -131,7 +134,7 @@

 	struct tm *utime = NULL;

-	sscanf(vtime, "%d-%02d-%02dT%02d:%02d:%02d%*01c",
+	sscanf(vtime, "%04d%02d%02dT%02d%02d%02d%*01c",
 			&(utime->tm_year), &(utime->tm_mon), &(utime->tm_mday),
 			&(utime->tm_hour), &(utime->tm_min), &(utime->tm_sec));

@@ -156,11 +159,11 @@
 		zonediff = osync_time_timezone_diff();
 		utime = osync_time_localtime2utc(time, zonediff);

-		vtime = g_strdup_printf("%d%02d%02dT%02d:%02d:%02dZ",
+		vtime = g_strdup_printf("%04d%02d%02dT%02d%02d%02dZ",
 				utime->tm_year + 1900, utime->tm_mon + 1, utime->tm_mday,
 				utime->tm_hour, utime->tm_min, utime->tm_sec);
 	} else {
-		vtime = g_strdup_printf("%d%02d%02dT%02d:%02d:%02dZ",
+		vtime = g_strdup_printf("%04d%02d%02dT%02d%02d%02dZ",
 				time->tm_year + 1900, time->tm_mon + 1, time->tm_mday,
 				time->tm_hour, time->tm_min, time->tm_sec);
 	}


Fixed typo which resulted in test failure

(cherry picked from commit 1965a491ba7031f5f7e9b368625b023cf9d65ecd)

--- Rendering/VolumeOpenGL2/vtkVolumeShaderComposer.h
+++ Rendering/VolumeOpenGL2/vtkVolumeShaderComposer.h
@@ -1585,8 +1585,8 @@
       \n    {\
       \n    if (in_useJittering)\
       \n      {\
-      \n      objDataPos = textureToObjMat * vec4(g_dataPos - g_dirStep\
-      \n                                          - jitterValue, 1.0);\
+      \n      objDataPos = textureToObjMat * vec4(g_dataPos - (g_dirStep\
+      \n                                           * jitterValue), 1.0);\
       \n      }\
       \n    else\
       \n      {\


whitespace fix.

whitespace fix.

--- surf.c
+++ surf.c
@@ -476,7 +476,6 @@
 				G_CALLBACK(itemclick), c);
 	}

-
 	/* VBox */
 	c->vbox = gtk_vbox_new(FALSE, 0);


ID PTSet: fix removeAny

ID PTSet: fix removeAny

Return true only if we modify the set.

--- include/dg/PointerAnalysis/PointsToSets/PointerIdPointsToSet.h
+++ include/dg/PointerAnalysis/PointsToSets/PointerIdPointsToSet.h
@@ -75,15 +75,18 @@
     bool removeAny(PSNode *target) {
         decltype(pointers) tmp;
         tmp.reserve(pointers.size());
+        bool removed = false;
         for (const auto& ptrID : pointers) {
             if (lookupTable.get(ptrID).target != target) {
                 tmp.set(ptrID);
+            } else {
+                removed = true;
             }
         }

         tmp.swap(pointers);

-        return !pointers.empty();
+        return removed;
     }

     void clear() {


Rename header here too

Rename header here too

svn path=/trunk/KDE/kdepim/knotes/; revision=649796

--- knotes/knotesnetsend.h
+++ knotes/knotesnetsend.h
@@ -35,7 +35,7 @@

 #include <q3cstring.h>

-#include <kbufferedsocket.h>
+#include <k3bufferedsocket.h>
 #include <ksocketaddress.h>

 using namespace KNetwork;


fixed typo

fixed typo

--- cmd/wm/view.c
+++ cmd/wm/view.c
@@ -388,8 +388,7 @@
 		Bool only_wildcards = True;
 		for(j = 0; j < client.size; j++) {
 			Client *c = client.data[i];
-			if(is_view_of(client.data[j], view.data[i]))
-				if(!strchr(c->tags, '*'))
+			if(is_view_of(c, view.data[i]) && !strchr(c->tags, '*'))
 					only_wildcards = False;
 		}
 		if(only_wildcards && view.size > 1) {


git-svn-id: https://www.imagemagick.org/subversion/ImageMagick/trunk@12576 aa41f4f7-0bf4-0310-aa73-e5a19afd5a74

--- coders/jpeg.c
+++ coders/jpeg.c
@@ -1899,10 +1899,10 @@
           length=MagickMin(GetStringInfoLength(profile)-i,65519L);
           p[12]=(unsigned char) ((i/65519L)+1);
           p[13]=(unsigned char) (GetStringInfoLength(profile)/65519L+1);
-          (void) CopyMagickMemory(p+tag_length,GetStringInfoDatum(profile)+i,
+          (void) CopyMagickMemory(p+tag_length+3,GetStringInfoDatum(profile)+i,
             length);
           jpeg_write_marker(jpeg_info,ICC_MARKER,GetStringInfoDatum(
-            custom_profile),(unsigned int) (length+tag_length));
+            custom_profile),(unsigned int) (length+tag_length+3));
         }
       }
     if (((LocaleCompare(name,"IPTC") == 0) ||


not ignoring conf requests if managed, but skipping all new geom

--- cmd/wm/event.c
+++ cmd/wm/event.c
@@ -122,47 +122,45 @@
 	c = client_of_win(ev->window);
 	ev->value_mask &= ~CWSibling;
 	if(c) {
-
-		if(c->frame.size && idx_of_area(c->frame.data[c->sel]->area))
-			return;
-
-		gravitate_client(c, True);
-
-		if(c->frame.size) {
-			if(ev->value_mask & CWX)
-				c->rect.x = ev->x;
-			if(ev->value_mask & CWY)
-				c->rect.y = ev->y;
-			if(ev->value_mask & CWWidth)
-				c->rect.width = ev->width;
-			if(ev->value_mask & CWHeight)
-				c->rect.height = ev->height;
-		}
-		if(ev->value_mask & CWBorderWidth)
-			c->border = ev->border_width;
-
-		gravitate_client(c, False);
-
-		if(c->frame.size) {
-			Frame *f = c->frame.data[c->sel];
-			if(c->rect.width >= rect.width && c->rect.height >= rect.height) {
-				f->rect.x = wc.x = -def.border;
-				f->rect.y = wc.y = -height_of_bar();
-			}
-			else {
-				f->rect.x = wc.x = c->rect.x - def.border;
-				f->rect.y = wc.y = c->rect.y - height_of_bar();
-			}
-			f->rect.width = wc.width = c->rect.width + 2 * def.border;
-			f->rect.height = wc.height = c->rect.height + def.border
-				+ height_of_bar();
-			wc.border_width = 1;
-			wc.sibling = None;
-			wc.stack_mode = ev->detail;
-			if(f->area->view != view.data[sel])
-				f->rect.x += 2 * rect.width;
-			XConfigureWindow(dpy, c->framewin, ev->value_mask, &wc);
-			configure_client(c);
+		if(c->frame.size && !idx_of_area(c->frame.data[c->sel]->area)) {
+			gravitate_client(c, True);
+
+			if(c->frame.size) {
+				if(ev->value_mask & CWX)
+					c->rect.x = ev->x;
+				if(ev->value_mask & CWY)
+					c->rect.y = ev->y;
+				if(ev->value_mask & CWWidth)
+					c->rect.width = ev->width;
+				if(ev->value_mask & CWHeight)
+					c->rect.height = ev->height;
+			}
+			if(ev->value_mask & CWBorderWidth)
+				c->border = ev->border_width;
+
+			gravitate_client(c, False);
+
+			if(c->frame.size) {
+				Frame *f = c->frame.data[c->sel];
+				if(c->rect.width >= rect.width && c->rect.height >= rect.height) {
+					f->rect.x = wc.x = -def.border;
+					f->rect.y = wc.y = -height_of_bar();
+				}
+				else {
+					f->rect.x = wc.x = c->rect.x - def.border;
+					f->rect.y = wc.y = c->rect.y - height_of_bar();
+				}
+				f->rect.width = wc.width = c->rect.width + 2 * def.border;
+				f->rect.height = wc.height = c->rect.height + def.border
+					+ height_of_bar();
+				wc.border_width = 1;
+				wc.sibling = None;
+				wc.stack_mode = ev->detail;
+				if(f->area->view != view.data[sel])
+					f->rect.x += 2 * rect.width;
+				XConfigureWindow(dpy, c->framewin, ev->value_mask, &wc);
+				configure_client(c);
+			}
 		}
 	}

@@ -174,10 +172,8 @@
 	if(c && c->frame.size) {
 		wc.x = def.border;
 		wc.y = height_of_bar();
-		if(idx_of_area(c->frame.data[c->sel]->area) > 0) {
-			wc.width = c->rect.width;
-			wc.height = c->rect.height;
-		}
+		wc.width = c->rect.width;
+		wc.height = c->rect.height;
 	}

 	wc.border_width = 0;


git-svn-id: https://www.imagemagick.org/subversion/ImageMagick/branches/ImageMagick-6@12023 aa41f4f7-0bf4-0310-aa73-e5a19afd5a74

--- coders/jpeg.c
+++ coders/jpeg.c
@@ -2224,6 +2224,7 @@
           jpeg_info->quality=0;
           extent=(MagickSizeType) SiPrefixToDoubleInterval(option,100.0);
           (void) DeleteImageOption(jpeg_info,"jpeg:extent");
+          (void) DeleteImageArtifact(jpeg_image,"jpeg:extent");
           (void) AcquireUniqueFilename(jpeg_image->filename);
           maximum=101;
           for (minimum=2; minimum != maximum; )


next is event file handling in bar2

next is event file handling in bar2

--- cmd/wmiibar2.c
+++ cmd/wmiibar2.c
@@ -625,6 +625,25 @@
     return 0;
 }

+static int
+do9p(Req *r)
+{
+	switch(r->fcall.id) {
+	case TVERSION: return xversion(r); break;
+	case TATTACH: return xattach(r); break;
+	case TWALK: return xwalk(r); break;
+	case TREMOVE: return xremove(r); break;
+	case TOPEN: return xopen(r); break;
+	case TREAD: return xread(r); break;
+	case TWRITE: return xwrite(r); break;
+	case TCLUNK: return xclunk(r); break;
+	case TSTAT: return xstat(r); break;
+	default:
+		break;
+	}
+	return -1;
+}
+
 static void
 handle_9p_req(IXPServer *s, IXPConn *c)
 {
@@ -637,33 +656,18 @@
 		return;
 	}
     /*fprintf(stderr, "msize=%d\n", msize);*/
-    if((msize = ixp_msg_to_fcall(msg, IXP_MAX_MSG, &r->fcall))) {
-		switch(r->fcall.id) {
-		case TVERSION: ret = xversion(r); break;
-		case TATTACH: ret = xattach(r); break;
-		case TWALK: ret = xwalk(r); break;
-		case TREMOVE: ret = xremove(r); break;
-		case TOPEN: ret = xopen(r); break;
-		case TREAD: ret = xread(r); break;
-		case TWRITE: ret = xwrite(r); break;
-		case TCLUNK: ret = xclunk(r); break;
-		case TSTAT: ret = xstat(r); break;
-		default:
-			goto error_do9p;
-			break;
-		}
-	}
+    if((msize = ixp_msg_to_fcall(msg, IXP_MAX_MSG, &r->fcall)))
+		ret = do9p(r);
 	if(ret == -1) {
-error_do9p:
 		/*fprintf(stderr, "function id=%d\n", s->fcall.id);*/
 		if(!errstr)
 			errstr = "function not supported";
 		r->fcall.id = RERROR;
 		cext_strlcpy(r->fcall.errstr, errstr, sizeof(r->fcall.errstr));
 	}
-    msize = ixp_fcall_to_msg(&r->fcall, msg, IXP_MAX_MSG);
-    if(ixp_send_message(c->fd, msg, msize, &errstr) != msize)
-        ixp_server_free_conn(s, c);
+	msize = ixp_fcall_to_msg(&r->fcall, msg, IXP_MAX_MSG);
+	if(ixp_send_message(c->fd, msg, msize, &errstr) != msize)
+		ixp_server_free_conn(s, c);
 }

 static void


git-svn-id: https://www.imagemagick.org/subversion/ImageMagick/branches/ImageMagick-6.7.4@6574 aa41f4f7-0bf4-0310-aa73-e5a19afd5a74

--- coders/tiff.c
+++ coders/tiff.c
@@ -686,6 +686,8 @@
 #endif
       case TIFF_RATIONAL:
       case TIFF_SRATIONAL:
+      case TIFF_FLOAT:
+      case TIFF_DOUBLE:
       {
         float
           rational[16];
@@ -829,7 +831,6 @@

   size_t
     length,
-    lsb_first,
     pad;

   ssize_t
@@ -1004,10 +1005,9 @@
     if (image->debug != MagickFalse)
       (void) LogMagickEvent(CoderEvent,GetMagickModule(),"Image depth: %.20g",
         (double) image->depth);
-    lsb_first=1;
-    image->endian=MSBEndian;
-    if ((int) (*(char *) &lsb_first) != 0)
-      image->endian=LSBEndian;
+    if ((photometric == PHOTOMETRIC_MINISBLACK) ||
+        (photometric == PHOTOMETRIC_MINISWHITE))
+      image->colorspace=GRAYColorspace;
     if (photometric == PHOTOMETRIC_SEPARATED)
       image->colorspace=CMYKColorspace;
     if (photometric == PHOTOMETRIC_CIELAB)
@@ -1126,6 +1126,7 @@
     if (status == MagickFalse)
       {
         TIFFClose(tiff);
+        quantum_info=DestroyQuantumInfo(quantum_info);
         ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
       }
     status=MagickTrue;
@@ -2555,8 +2556,7 @@
     i;

   size_t
-    length,
-    lsb_first;
+    length;

   ssize_t
     y;
@@ -2868,10 +2868,6 @@
         break;
       }
     }
-    lsb_first=1;
-    image->endian=MSBEndian;
-    if ((int) (*(char *) &lsb_first) != 0)
-      image->endian=LSBEndian;
     if ((compress_tag == COMPRESSION_CCITTFAX3) &&
         (photometric != PHOTOMETRIC_MINISWHITE))
       {
@@ -3145,6 +3141,7 @@
     quantum_info->endian=LSBEndian;
     if (endian == FILLORDER_LSB2MSB)
       quantum_info->endian=MSBEndian;
+    image->endian=quantum_info->endian;
     pixels=GetQuantumPixels(quantum_info);
     tiff_info.scanline=GetQuantumPixels(quantum_info);
     switch (photometric)
@@ -3199,8 +3196,7 @@
               register const PixelPacket
                 *restrict p;

-              p=GetVirtualPixels(image,0,y,image->columns,1,
-                &image->exception);
+              p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
               if (p == (const PixelPacket *) NULL)
                 break;
               length=ExportQuantumPixels(image,(const CacheView *) NULL,
@@ -3219,8 +3215,7 @@
               register const PixelPacket
                 *restrict p;

-              p=GetVirtualPixels(image,0,y,image->columns,1,
-                &image->exception);
+              p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
               if (p == (const PixelPacket *) NULL)
                 break;
               length=ExportQuantumPixels(image,(const CacheView *) NULL,
@@ -3239,8 +3234,7 @@
               register const PixelPacket
                 *restrict p;

-              p=GetVirtualPixels(image,0,y,image->columns,1,
-                &image->exception);
+              p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
               if (p == (const PixelPacket *) NULL)
                 break;
               length=ExportQuantumPixels(image,(const CacheView *) NULL,
@@ -3389,9 +3383,6 @@
     if (0 && (image_info->verbose == MagickTrue))
       TIFFPrintDirectory(tiff,stdout,MagickFalse);
     (void) TIFFWriteDirectory(tiff);
-    image->endian=MSBEndian;
-    if (endian == FILLORDER_LSB2MSB)
-      image->endian=LSBEndian;
     image=SyncNextImageInList(image);
     if (image == (Image *) NULL)
       break;


conditional compilation of fastexp

conditional compilation of fastexp

Former-commit-id: 16782bf88e936dee1e66a1b87ddff3a1022d632b

--- cnn/functors.h
+++ cnn/functors.h
@@ -28,7 +28,26 @@
   return fastpow2 (1.442695040f * p);
 }

+#if 0
+#define EXPAF (8388608 / 0.6931471806f)
+static inline float fastexp (float p) {
+  union { float f; int32_t i; } eco;
+  eco.i = (int32_t)(EXPAF * (p)) + 1065353216;
+  return eco.f;
+}
+#endif
+
+#if defined(__GNU_LIBRARY__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ < 14)
+#define USE_FASTEXP
+#else
+#undef USE_FASTEXP
+#endif
+
+#ifdef USE_FASTEXP
 #define CNN_EXPF fastexp
+#else
+#define CNN_EXPF expf
+#endif

 namespace cnn {


来自AC的快感:joy:!!!!

来自AC的快感:joy:!!!!

--- codevs/2618.c
+++ codevs/2618.c
@@ -3,31 +3,30 @@
 题目:p2618 核电站问题
 */

-// 谜之代码习惯
-int cnt;
-int sta[0xfffff];
-int save[51][6];
-int a, b;
-
+// 谜之代码习惯，头文件写全局后面
+long long sta[0xfffff],save[51][51],a, b;
 #include <stdio.h>

-void dfs(int l,int t){
+long long dfs(int l,int t){
 	// if(l > b) return ;
-	if(t >= a) {
-		cnt++ ;
-		return ;
+	if(save[l][t])
+		return save[l][t];
+	if(t >= a){
+		save[l][t] = 1;
+		return 1;
 	}
-	// if(){}
 	t++;l++;
-	if(l < b)
-		dfs(l, t);
-	dfs(0, t);
+	if(l < b){
+		save[l][t] = dfs(l, t);
+		save[0][t] = dfs(0, t);
+		return save[l][t] + save[0][t];
+	}
+	save[0][t] = dfs(0, t);
+	return save[0][t];
 }

 int main(int argc, char* argv[]){
     scanf("%d%d", &a, &b);
-    dfs(0, 0);
-    printf("%d", cnt);
-    while(10);
+    printf("%lld", dfs(0, 0));
     return 0;
 }


Cleanup the building of child lists in the reduction.

--- colm/pdarun.c
+++ colm/pdarun.c
@@ -1791,6 +1791,7 @@
 	if ( *action & act_rb ) {
 		int r, objectLength;
 		Kid *last, *child, *attrs;
+		Kid *dataLast, *dataChild;

 		pdaRun->reduction = *action >> 2;

@@ -1823,41 +1824,28 @@
 		attrs = allocAttrs( prg, objectLength );

 		/* Build the list of children. */
-		Kid *realChild = 0;
 		rhsLen = prg->rtd->prodInfo[pdaRun->reduction].length;
 		child = last = 0;
-		for ( r = 0;; ) {
-			if ( r == rhsLen )
-				break;
-
+		dataChild = dataLast = 0;
+		for ( r = 0; r < rhsLen; r++ ) {
+			/* The child. */
 			child = pdaRun->stackTop;
+			dataChild = pt(child->tree)->shadow;
+
+			/* Pop. */
 			pdaRun->stackTop = pdaRun->stackTop->next;
+
+			/* Reverse list. */
 			child->next = last;
+			dataChild->next = dataLast;
+
+			/* Track last for reversal. */
 			last = child;
-
-			r++;
-			realChild = child;
+			dataLast = dataChild;
 		}

 		pdaRun->redLel->tree->child = child;
-
-		/* SHADOW */
-		Kid *l = 0;
-		Kid *c = pdaRun->redLel->tree->child;
-		Kid *rc = 0;
-		if ( c != 0 ) {
-			rc = pt(c->tree)->shadow;
-			l = c;
-			c = c->next;
-			while ( c != 0 ) {
-				pt(l->tree)->shadow->next = pt(c->tree)->shadow;
-				l = c;
-				c = c->next;
-			}
-			pt(l->tree)->shadow->next = 0;
-		}
-
-		pt(pdaRun->redLel->tree)->shadow->tree->child = kidListConcat( attrs, rc );
+		pt(pdaRun->redLel->tree)->shadow->tree->child = kidListConcat( attrs, dataChild );

 		debug( REALM_PARSE, "reduced: %s rhsLen %d\n",
 				prg->rtd->prodInfo[pdaRun->reduction].name, rhsLen );
@@ -1872,7 +1860,7 @@

 		/* When the production is of zero length we stay in the same state.
 		 * Otherwise we use the state stored in the first child. */
-		pdaRun->cs = rhsLen == 0 ? pdaRun->curState : pt(realChild->tree)->state;
+		pdaRun->cs = rhsLen == 0 ? pdaRun->curState : pt(child->tree)->state;

 		assert( pdaRun->redLel->tree->refs == 1 );


put a location into the error string tree stored in a failed parse object

--- colm/pdarun.c
+++ colm/pdarun.c
@@ -497,13 +497,18 @@
 	Head *errorHead = 0;

 	/* If there are no error points on record assume the error occurred at the beginning of the stream. */
-	if ( deepest == 0 )
+	if ( deepest == 0 )  {
 		errorHead = stringAllocFull( prg, "PARSE ERROR at 1:1", 18 );
+		errorHead->location = locationAllocate( prg );
+		errorHead->location->line = 1;
+		errorHead->location->column = 1;
+	}
 	else {
 		debug( prg, REALM_PARSE, "deepest location byte: %d\n", deepest->location->byte );

 		long line = deepest->location->line;
 		long i, column = deepest->location->column;
+		long byte = deepest->location->byte;

 		for ( i = 0; i < deepest->length; i++ ) {
 			if ( deepest->data[i] != '\n' )
@@ -512,11 +517,18 @@
 				line += 1;
 				column = 1;
 			}
+			byte += 1;
 		}

 		char formatted[128];
 		sprintf( formatted, "PARSE ERROR at %ld:%ld", line, column );
 		errorHead = stringAllocFull( prg, formatted, strlen(formatted) );
+
+		errorHead->location = locationAllocate( prg );
+		errorHead->location->line = line;
+		errorHead->location->column = column;
+		errorHead->location->byte = byte;
+		errorHead->location->file = deepest->location->file;
 	}

 	Tree *tree = constructString( prg, errorHead );


Fix media upload memory leak

Fix media upload memory leak

--- code/twitter.c
+++ code/twitter.c
@@ -941,7 +941,12 @@
         curl_easy_setopt(State->cURL, CURLOPT_HTTPHEADER, OAuthHeaderList);
     }

-    if (curl_easy_perform(State->cURL) == CURLE_OK)
+    bool PerformSuccess = curl_easy_perform(State->cURL) == CURLE_OK;
+
+    curl_formfree(FormPost);
+    curl_slist_free_all(OAuthHeaderList);
+
+    if (PerformSuccess)
     {
         // Transfer complete, write function should be done writing
         twc_buffer Data = twc_ConsumeData(State);


PHPC-605: Split exceptions for unsupported ca_dir and capath options

--- php_phongo.c
+++ php_phongo.c
@@ -1316,8 +1316,13 @@
 	}

 #if defined(MONGOC_ENABLE_SSL_SECURE_CHANNEL) || defined(MONGOC_ENABLE_SSL_SECURE_TRANSPORT)
-	if (php_array_existsc(zoptions, "ca_dir") || php_array_existsc(zoptions, "capath")) {
-		phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "\"ca_dir\" and \"capath\" options are not supported by Secure Channel and Secure Transport");
+	if (php_array_existsc(zoptions, "ca_dir")) {
+		phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "\"ca_dir\" option is not supported by Secure Channel and Secure Transport");
+		return NULL;
+	}
+
+	if (php_array_existsc(zoptions, "capath")) {
+		phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "\"capath\" option is not supported by Secure Channel and Secure Transport");
 		return NULL;
 	}
 #endif


Fix btio compilation warnings

Fix btio compilation warnings

--- common/btio.c
+++ common/btio.c
@@ -586,8 +586,8 @@
 	return TRUE;
 }

-static gboolean parse_set_opts(GIOChannel *io, struct set_opts *opts,
-				GError **err, BtIOOption opt1, va_list args)
+static gboolean parse_set_opts(struct set_opts *opts, GError **err,
+						BtIOOption opt1, va_list args)
 {
 	BtIOOption opt = opt1;
 	const char *str;
@@ -1011,7 +1011,7 @@
 	}

 	if (!(pfd.revents & POLLOUT))
-		read(sock, &c, 1);
+		(void) read(sock, &c, 1);

 	accept_add(io, connect, user_data, destroy);

@@ -1027,7 +1027,7 @@
 	int sock;

 	va_start(args, opt1);
-	ret = parse_set_opts(io, &opts, err, opt1, args);
+	ret = parse_set_opts(&opts, err, opt1, args);
 	va_end(args);

 	if (!ret)
@@ -1125,6 +1125,10 @@
 		if (!sco_set(sock, opts->mtu, err))
 			return NULL;
 		break;
+	default:
+		g_set_error(err, BT_IO_ERROR, BT_IO_ERROR_INVALID_ARGS,
+				"Unknown BtIO type %d", type);
+		return NULL;
 	}

 	io = g_io_channel_unix_new(sock);
@@ -1145,7 +1149,7 @@
 	gboolean ret;

 	va_start(args, opt1);
-	ret = parse_set_opts(io, &opts, gerr, opt1, args);
+	ret = parse_set_opts(&opts, gerr, opt1, args);
 	va_end(args);

 	if (ret == FALSE)
@@ -1170,6 +1174,10 @@
 	case BT_IO_SCO:
 		err = sco_connect(sock, &opts.dst);
 		break;
+	default:
+		g_set_error(gerr, BT_IO_ERROR, BT_IO_ERROR_INVALID_ARGS,
+						"Unknown BtIO type %d", type);
+		return NULL;
 	}

 	if (err < 0) {
@@ -1202,7 +1210,7 @@
 	}

 	va_start(args, opt1);
-	ret = parse_set_opts(io, &opts, err, opt1, args);
+	ret = parse_set_opts(&opts, err, opt1, args);
 	va_end(args);

 	if (ret == FALSE)


Update fast serialize limitation.

Update fast serialize limitation.

--- php_swoole.h
+++ php_swoole.h
@@ -140,9 +140,9 @@
 #endif
 #endif

-//#if PHP_VERSION_ID < 70300
+#if PHP_VERSION_ID < 70400
 #define SW_USE_FAST_SERIALIZE 1
-//#endif
+#endif

 #if PHP_MAJOR_VERSION < 7
 #error "require PHP version 7.0 or later."


return error if can't find section

return error if can't find section


fix C++20 codepath (wrong arg name). Fixes #709

PiperOrigin-RevId: 449425262

--- hwy/ops/emu128-inl.h
+++ hwy/ops/emu128-inl.h
@@ -475,7 +475,7 @@
   // Signed right shift is now guaranteed to be arithmetic (rounding toward
   // negative infinity, i.e. shifting in the sign bit).
   for (size_t i = 0; i < N; ++i) {
-    v.raw[i] = static_cast<T>(v.raw[i] >> kBits);
+    v.raw[i] = static_cast<T>(v.raw[i] >> bits);
   }
 #else
   if (IsSigned<T>()) {


Debugger: Fix method names in comment

Debugger: Fix method names in comment

Change-Id: I269fdecce845f3cc0e8b70fbf5f7278a0eb00910
Reviewed-by: Kai Koehne <077bc265216106fb22408e62f2d97925ede69d10@nokia.com>

--- src/plugins/debugger/debuggerengine.h
+++ src/plugins/debugger/debuggerengine.h
@@ -291,7 +291,7 @@
     /*
      * For "external" clients of a debugger run control that needs to do
      * further setup before the debugger is started (e.g. Maemo).
-     * Afterwards, handleSetupDone() or handleSetupFailed() must be called
+     * Afterwards, handleRemoteSetupDone() or handleRemoteSetupFailed() must be called
      * to continue or abort debugging, respectively.
      * This signal is only emitted if the start parameters indicate that
      * a server start script should be used, but none is given.


Minor tweak to rubicon library location.

--- jni/rubicon.c
+++ jni/rubicon.c
@@ -828,7 +828,7 @@
 #ifdef ANDROID
     // If we're on android, we need to specify the location of the Rubicon
     // shared library as part of the environment.
-    sprintf(rubiconLibrary, "RUBICON_LIBRARY=%s/python/librubicon.so", installPath);
+    sprintf(rubiconLibrary, "RUBICON_LIBRARY=%s/rubicon/armeabi/librubicon.so", installPath);
     LOG_D("%s", rubiconLibrary);
     putenv(rubiconLibrary);
 #endif


removed unimplemeted method.

removed unimplemeted method.

--- VIMNetworking/Networking/Upload/TaskQueue/VIMTaskQueue.h
+++ VIMNetworking/Networking/Upload/TaskQueue/VIMTaskQueue.h
@@ -72,7 +72,6 @@
 - (nonnull NSUserDefaults *)taskQueueDefaults; // TODO: set this as a property instead? [AH]

 // Overide these in case you want to do your own delegate.
-- (void)togglePause:(nonnull VIMTask *)task pause:(BOOL) paused;
 - (void)taskDidStart:(nonnull VIMTask *)task;
 - (void)taskDidComplete:(nonnull VIMTask *)task;


Renamed add/sub tests to add_m/sub_m.

Renamed add/sub tests to add_m/sub_m.

--- t-nn.c
+++ t-nn.c
@@ -6,7 +6,7 @@

 rand_t state;

-int test_add(void)
+int test_add_m(void)
 {
    int result = 1;
    long i;
@@ -14,7 +14,7 @@
    len_t m, n;
    word_t ci;

-   printf("nn_add...");
+   printf("nn_add_m...");

    // test (a + b) + c = a + (b + c)
    for (i = 0; i < ITER && result == 1; i++)
@@ -88,7 +88,7 @@
    return result;
 }

-int test_sub(void)
+int test_sub_m(void)
 {
    int result = 1;
    long i;
@@ -96,7 +96,7 @@
    len_t m, n;
    word_t ci;

-   printf("nn_sub...");
+   printf("nn_sub_m...");

    // test (a - b) - c = (a - c) - b
    for (i = 0; i < ITER && result == 1; i++)
@@ -663,8 +663,8 @@

    randinit(state);

-   RUN(test_add);
-   RUN(test_sub);
+   RUN(test_add_m);
+   RUN(test_sub_m);
    RUN(test_shl);
    RUN(test_shr);
    RUN(test_copy);


densities can't be negative

densities can't be negative

--- src/diffusion/include/planet/eddy_diffusion_evaluator.h
+++ src/diffusion/include/planet/eddy_diffusion_evaluator.h
@@ -60,7 +60,7 @@
          template<typename StateType>
          ANTIOCH_AUTO(StateType)
          K(const StateType &ntot) const
-         ANTIOCH_AUTOFUNC(StateType,_K0 * Antioch::ant_sqrt(Antioch::ant_abs(_mixture.total_bottom_density()/ntot)))
+         ANTIOCH_AUTOFUNC(StateType,_K0 * Antioch::ant_sqrt(_mixture.total_bottom_density()/ntot))

          //! \return deddy_dT coefficient in cm2.s-1.K-1
          template<typename StateType>


Added HUE_RED, etc. as defined enum constants.

--- pixeltypes.h
+++ pixeltypes.h
@@ -67,6 +67,16 @@
     }
 };

+typedef enum {
+    HUE_RED = 0,
+    HUE_ORANGE = 32,
+    HUE_YELLOW = 64,
+    HUE_GREEN = 96,
+    HUE_AQUA = 128,
+    HUE_BLUE = 160,
+    HUE_PURPLE = 192,
+    HUE_PINK = 224
+} HSVHue;

 struct CRGB {
 	union {


- If the size difference between pkgs is 0, don't print anything in the delete case.

--- pkg/delete.c
+++ pkg/delete.c
@@ -110,7 +110,8 @@
 	if (oldsize > newsize) {
 		newsize *= -1;
 		humanize_number(size, sizeof(size), oldsize - newsize, "B", HN_AUTOSCALE, 0);
-	} else {
+	}
+	else if (newsize > oldsize) {
 		humanize_number(size, sizeof(size), newsize - oldsize, "B", HN_AUTOSCALE, 0);
 	}

@@ -125,7 +126,7 @@

 	if (oldsize > newsize)
 		printf("\nThe deinstallation will save %s\n", size);
-	else
+	else if (newsize > oldsize)
 		printf("\nThe deinstallation will require %s more space\n", size);

 	if (yes == false)


Use sysexits

Use sysexits

--- pkg/rquery.c
+++ pkg/rquery.c
@@ -82,7 +82,7 @@
 	match_t match = MATCH_EXACT;
 	int ch;
 	int ret = EPKG_OK;
-	int retcode = EXIT_SUCCESS;
+	int retcode = EX_OK;
 	int i;
 	char multiline = 0;
 	char *condition = NULL;
@@ -150,7 +150,7 @@
 			return (EX_IOERR);

 		/* do not fail if run as a user */
-		return (EXIT_SUCCESS);
+		return (EX_OK);
 	}

 	if (ret != EPKG_OK)
@@ -190,7 +190,7 @@
 			pkgdb_it_free(it);
 		}
 		if (!onematched)
-			retcode = EXIT_FAILURE;
+			retcode = EX_SOFTWARE;
 	}

 	pkg_free(pkg);


Remove stale comments from initialization function

Which registers are used for arguments is determined by the compiler.

--- task.c
+++ task.c
@@ -242,18 +242,11 @@
 // Internal task initializer.
 // Written in assembly so that it can mangle the stack pointer to initialize
 // the task's stack. Note that interrupts are temporarily disabled.
-static void * task__internal_initialize(void *sp, task_fn fn, void *data) {
+static void *task__internal_initialize(void *sp, task_fn fn, void *data) {
   void *result;

   asm volatile(
-    // Arguments
-    // - r24:r25 -- Top of new task's stack
-    // - r22:r23 -- Task function pointer
-    // - r20:r21 -- Task argument
-    // Returns:
-    // - r24:r25 -- Top of new task's stack
-
-    // About to overwrite the stack pointer// disable interrupts
+    // About to overwrite the stack pointer, disable interrupts
     "in r18, 0x3f\n" // r18 can be clobbered
     "cli\n"


Update rawdraw_sf

Update rawdraw_sf

--- rawdraw_sf.h
+++ rawdraw_sf.h
@@ -1,5 +1,5 @@
 //This file was automatically generated by Makefile at https://github.com/cntools/rawdraw
-//Generated from files git hash 9405c733df584e1e411cc030190451cbfc54af64 on Tue 09 Mar 2021 10:38:09 AM PST (This is not the git hash of this file)
+//Generated from files git hash 018fb03902382ab2461cdb020d26d234401a94f3 on Sun 21 Mar 2021 01:14:39 PM EDT (This is not the git hash of this file)
 // Copyright 2010-2021 <>< CNLohr, et. al. (Several other authors, many but not all mentioned)
 //	Licensed under the MIT/x11 or NewBSD License you choose.
 //
@@ -64,9 +64,17 @@
 extern int CNFGPenX, CNFGPenY;
 extern uint32_t CNFGBGColor;
 extern uint32_t CNFGLastColor;
-
+extern uint32_t CNFGDialogColor; //Only used for DrawBox
+
+//Draws text at CNFGPenX, CNFGPenY, with scale of `scale`.
 void CNFGDrawText( const char * text, short scale );
+
+//Determine how large a given test would be to draw.
 void CNFGGetTextExtents( const char * text, int * w, int * h, int textsize  );
+
+//Draws a box, outline as whatever the last CNFGColor was set to but also draws
+//a rectangle as a background as whatever CNFGDialogColor is set to.
+void CNFGDrawBox( short x1, short y1, short x2, short y2 );

 //To be provided by driver. Rawdraw uses colors in the format 0xRRGGBBAA
 //Note that some backends do not support alpha of any kind.
@@ -3466,11 +3474,11 @@

 uint32_t AGLF(CNFGColor)( uint32_t RGB )
 {
+	CNFGLastColor = RGB;
 	unsigned char red = ( RGB >> 24 ) & 0xFF;
 	unsigned char grn = ( RGB >> 16 ) & 0xFF;
 	unsigned char blu = ( RGB >> 8 ) & 0xFF;
 	unsigned long color = (red<<16)|(grn<<8)|(blu);
-	CNFGLastColor = color;
 	XSetForeground(CNFGDisplay, CNFGGC, color);
 	return color;
 }
@@ -3543,7 +3551,7 @@
 #endif

 /*
-Copyright (c) 2010-2020 <>< Charles Lohr
+Copyright (c) 2010-2021 <>< Charles Lohr, and several others!

 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
@@ -3692,6 +3700,20 @@
 //Set this if you are only using CNFG to create an OpenGL context.
 #ifndef CNFGCONTEXTONLY

+uint32_t CNFGDialogColor;
+
+void CNFGDrawBox( short x1, short y1, short x2, short y2 )
+{
+	uint32_t lc = CNFGLastColor;
+	CNFGColor( CNFGDialogColor );
+	CNFGTackRectangle( x1, y1, x2, y2 );
+	CNFGColor( lc );
+	CNFGTackSegment( x1, y1, x2, y1 );
+	CNFGTackSegment( x2, y1, x2, y2 );
+	CNFGTackSegment( x2, y2, x1, y2 );
+	CNFGTackSegment( x1, y2, x1, y1 );
+}
+
 void CNFGDrawText( const char * text, short scale )
 {
 	const unsigned char * lmap;


fix tcfs_read()

fix tcfs_read()

--- tcfs.c
+++ tcfs.c
@@ -302,8 +302,8 @@
 	ret = get_reply(sock, tc->buf);
 	assert(ret >= 4); (void)ret;
 	readed = buf_get_uint32(tc->buf);
-	if (readed <= 0)
-		return readed;
+	if ((int)readed <= 0)
+		return (int)readed;
 	memcpy(rbuf, tc->buf + 4, readed);
 	return readed;
 }


SNC fixes from Mike Kasprzak - added typename

--- rde_string.h
+++ rde_string.h
@@ -15,7 +15,7 @@
     {
         // Derived from: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/142054
         hash_value_t h = 0;
-		for (basic_string<E, TAllocator, TStorage>::size_type p = 0; p < x.length(); ++p)
+		for (typename basic_string<E, TAllocator, TStorage>::size_type p = 0; p < x.length(); ++p)
 		{
             h = x[p] + (h<<6) + (h<<16) - h;
         }


test all JSON struct pointers

test all JSON struct pointers

--- test.c
+++ test.c
@@ -174,30 +174,36 @@

 void
-cttestarrayparent()
-{
-	Valid t = {"[1]", 2, {
-		{'[', 3, "[1]"},
-		{'[', 1, "[]"},
-	}};
-	jsonparse(t.src, x, 100);
-	assertf(x[0].parent == nil, "x[1].parent = %p want nil", x[0].parent);
-	assertf(x[1].parent == &x[0], "x[1].parent = %p want %p", x[1].parent, &x[0]);
-}
-
-
-void
-cttestobjectparent()
-{
-	Valid t = {"{\"a\":1}", 3, {
-		{'[', 8, "{\"a\":1}"},
-		{'[', 3, "\"a\""},
-		{'[', 1, "1"},
-	}};
-	jsonparse(t.src, x, 100);
+cttestarraypointers()
+{
+	jsonparse("[1,2]", x, 100);
 	assertf(x[0].parent == nil, "x[1].parent = %p want nil", x[0].parent);
 	assertf(x[1].parent == &x[0], "x[1].parent = %p want %p", x[1].parent, &x[0]);
 	assertf(x[2].parent == &x[0], "x[2].parent = %p want %p", x[2].parent, &x[0]);
+	assertf(x[1].prev == nil, "x[1].prev = %p want nil", x[1].prev);
+	assertf(x[1].next == &x[2], "x[1].next = %p want %p", x[1].next, &x[2]);
+	assertf(x[2].prev == &x[1], "x[2].prev = %p want %p", x[2].prev, &x[1]);
+	assertf(x[2].next == nil, "x[2].next = %p want nil", x[2].next);
+}
+
+
+void
+cttestobjectpointers()
+{
+	jsonparse("{\"a\":1,\"b\":2}", x, 100);
+	assertf(x[0].parent == nil, "x[1].parent = %p want nil", x[0].parent);
+	assertf(x[1].parent == &x[0], "x[1].parent = %p want %p", x[1].parent, &x[0]);
+	assertf(x[2].parent == &x[0], "x[2].parent = %p want %p", x[2].parent, &x[0]);
+	assertf(x[3].parent == &x[0], "x[3].parent = %p want %p", x[3].parent, &x[0]);
+	assertf(x[4].parent == &x[0], "x[4].parent = %p want %p", x[4].parent, &x[0]);
+	assertf(x[1].prev == nil, "x[1].prev = %p want nil", x[1].prev);
+	assertf(x[1].next == &x[3], "x[1].next = %p want %p", x[1].next, &x[3]);
+	assertf(x[3].prev == &x[1], "x[3].prev = %p want %p", x[3].prev, &x[1]);
+	assertf(x[3].next == nil, "x[3].next = %p want nil", x[3].next);
+	assertf(x[2].prev == nil, "x[2].prev = %p want nil", x[2].prev);
+	assertf(x[2].next == &x[4], "x[2].next = %p want %p", x[2].next, &x[4]);
+	assertf(x[4].prev == &x[2], "x[4].prev = %p want %p", x[4].prev, &x[2]);
+	assertf(x[4].next == nil, "x[4].next = %p want nil", x[4].next);
 }


Failing on va_args for error and error_at_line

--- test.c
+++ test.c
@@ -80,12 +80,12 @@

 #ifdef HAVE_ERROR
   setup_test();
-  error(0, ENOSYS, "2 error");
+  error(0, ENOSYS, "%s", "2 error");
 #endif

 #ifdef HAVE_ERROR_AT_LINE
   setup_test();
-  error_at_line(0, ENOENT, __FILE__, __LINE__, "2 error_at_line");
+  error_at_line(0, ENOENT, __FILE__, __LINE__, "%s", "2 error_at_line");
 #endif

   return 0;


'x(x) int x; { }' was not accepted

'x(x) int x; { }' was not accepted

--- lang/cem/cemcom/code.c
+++ lang/cem/cemcom/code.c
@@ -196,6 +196,11 @@
 	register char *name = idf->id_text;
 	register struct def *def = idf->id_def;

+	while (def->df_level > L_GLOBAL) def = def->next;
+		/* idf->id_def does not indicate the right def structure
+		   when the function being defined has a parameter of the
+		   same name.
+		*/
 #ifndef PREPEND_SCOPES
 	code_scope(name, def);
 #endif	PREPEND_SCOPES


Create test.c

Create test.c

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

--- test.c
+++ test.c
@@ -0,0 +1,11 @@
+#include <stdio.h>
+//#include <F:/nRF51 SDK/components/softdevice/s110/headers/include_all.h>
+//#include <nrf_delay.h>
+int main(int argc, const char* argv[]) {
+	while (1){
+		printf("Hello, World");
+		//nrf_delay_ms(500);
+		break;
+	}
+  return 0;
+}


Expanded sample tests.

Expanded sample tests.

--- test.c
+++ test.c
@@ -5,18 +5,77 @@
 void setup() { }
 void teardown() { }

-TEST(passing_test)
+TEST(passing_true_test)
     ASSERT_TRUE(1 == 1, "One should be the same as itself");
 END_TEST

-TEST(failing_test)
+TEST(failing_true_test)
     ASSERT_TRUE(1 != 1, "One should not be the same as itself");
 END_TEST

-TEST(equal_failure_test)
-    ASSERT_EQUAL(1, 2, "%d", "One should equal Two");
+TEST(passing_false_test)
+    ASSERT_FALSE(1 != 1, "One should be the same as itself");
 END_TEST

-TEST(string_equal_failure)
+TEST(failing_false_test)
+    ASSERT_FALSE(1 == 1, "One should not be the same as itself");
+END_TEST
+
+TEST(passing_equal_test)
+    ASSERT_EQUAL(3.14, 3.14, "%f", "Pi should be the same as itself");
+END_TEST
+
+TEST(failing_equal_test)
+    ASSERT_EQUAL(1, 2, "%d", "One should equal two");
+END_TEST
+
+TEST(passing_not_equal_test)
+    ASSERT_NOT_EQUAL(1, 2, "One should not equal two");
+END_TEST
+
+TEST(failing_not_equal_test)
+    ASSERT_NOT_EQUAL(3.14, 3.14, "Pi should not be the same as itself");
+END_TEST
+
+TEST(passing_string_equal_test)
+    ASSERT_STRING_EQUAL("Hello", "Hello", "Hello should equal itself");
+END_TEST
+
+TEST(failing_string_equal_test)
     ASSERT_STRING_EQUAL("Hello", "World", "Hello should equal World");
-END_TEST+END_TEST
+
+TEST(passing_string_empty_test)
+    ASSERT_STRING_EMPTY("", "String should be empty");
+END_TEST
+
+TEST(failing_string_empty_test)
+    ASSERT_STRING_EMPTY("Hello", "String should be empty");
+END_TEST
+
+TEST(passing_string_not_empty_test)
+    ASSERT_STRING_NOT_EMPTY("Hello", "String should not be empty");
+END_TEST
+
+TEST(failing_string_not_empty_test)
+    ASSERT_STRING_NOT_EMPTY("", "String should not be empty");
+END_TEST
+
+TEST(passing_null_test)
+    ASSERT_NULL(NULL, "Pointer should be NULL");
+END_TEST
+
+TEST(failing_null_test)
+    const char string[] = "Hello";
+    ASSERT_NULL(string, "Pointer should be NULL");
+END_TEST
+
+TEST(passing_not_null_test)
+    const char string[] = "Hello";
+    ASSERT_NOT_NULL(string, "Pointer should not be NULL");
+END_TEST
+
+TEST(failing_not_null_test)
+    ASSERT_NOT_NULL(NULL, "Pointer should not be NULL");
+END_TEST
+


Test scaffold for Cyc_substring

Test scaffold for Cyc_substring

--- test.c
+++ test.c
@@ -125,6 +125,29 @@
   }
 }

+void substring(int s, int e) {
+  uint8_t raw[] = {65, 66, 0xCE, 0xBB};
+
+    const char *tmp = raw;
+    uint32_t codepoint;
+    uint32_t state = 0;
+    int count, start_i = 0, end_i = 0;
+
+    for (count = 0; *tmp; ++tmp){
+      if (!Cyc_utf8_decode(&state, &codepoint, (uint8_t)*tmp)){
+        if (count == s) {
+          start_i = end_i;
+        } else if (count == e) {
+          break;
+        }
+        count += 1;
+      }
+      end_i++;
+    }
+    raw[end_i] = '\0';
+    printf("raw=%s, s=%d, e=%d, start_i=%d, end_i=%d\n", raw, s, e, start_i, end_i);
+}
+
 void main(){
   char c[128];
   uint8_t cv[] = {0xEC, 0xBA, 0xBB, 0x00}; // Lambda (0x03bb) is encoded with leading 0xCE
@@ -157,5 +180,9 @@
   encode(0xcebb);

   printf("%06X\n", 0x0fff);
+  substring(0, 1);
+  substring(0, 2);
+  substring(1, 3);
+  substring(1, 4);
   return;
 }


Take width and height arguments

Take width and height arguments

--- test.c
+++ test.c
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>

@@ -17,15 +18,20 @@

 int main(int argc, char** argv)
 {
-    if (argc != 3) {
+    if (argc != 5) {
         fputs("Usage:\n", stdout);
-        fputs("  ./test device filename-prefix\n", stdout);
+        fputs("  ./test device width height filename-prefix\n", stdout);
         return 2;
     };

-    print_info(argv[1], 0);
+    char* device = argv[1];
+    int width = atoi(argv[2]);
+    int height = atoi(argv[3]);
+    char* filename_prefix = argv[4];

-    struct grabber* g = create_grabber(argv[1], 0, 320, 240);
+    print_info(device, 0);
+
+    struct grabber* g = create_grabber(argv[1], 0, height, width);
     if (g == NULL) {
         fputs("Oh no! Couldn't initialize grabber\n", stderr);
         return 1;
@@ -37,9 +43,9 @@
     fputs("Sleeping...\n", stdout);
     sleep(2);

-    char filename[strlen(argv[2]) + 3 + 1];
-    strcpy(filename, argv[2]);
-    char* filename_suffix = filename + strlen(argv[2]) + 1;
+    char filename[strlen(filename_prefix) + 3 + 1];
+    strcpy(filename, filename_prefix);
+    char* filename_suffix = filename + strlen(filename_prefix) + 1;
     filename_suffix[-1] = '-';
     for (int i = 0; i <= 20; ++i) {
         fputs("Grabbing frame...\n", stdout);


Fixed important source of memory leak in CUDA.

--- utilities/ITKCudaCommon/include/itkCudaDataManager.h
+++ utilities/ITKCudaCommon/include/itkCudaDataManager.h
@@ -45,6 +45,7 @@
   void Allocate(size_t bufferSize)
     {
     m_BufferSize = bufferSize;
+    CUDA_CHECK(cudaFree(m_GPUBuffer));
     CUDA_CHECK(cudaMalloc(&m_GPUBuffer, bufferSize));
     }


AccountChooser: don't return garbage from _set_account

Previously, the 'set' field of the stack-allocated 'data' structure was
not initialized. It's explicitly set to TRUE if the account is found,
but never otherwise set; so if the account is not found, this function
returned random garbage.

Reviewed-by: Xavier Claessens <e12e3c8a15d9732d47837092634d8c4dd9a00a7a@gmail.com>

--- libempathy-gtk/empathy-account-chooser.c
+++ libempathy-gtk/empathy-account-chooser.c
@@ -428,6 +428,7 @@

 	data.chooser = chooser;
 	data.account = account;
+	data.set = FALSE;

 	gtk_tree_model_foreach (model,
 				(GtkTreeModelForeachFunc) account_chooser_set_account_foreach,


individual_view_remove_dialog_show: set a mnemonic on the 'Delete and Block' button

--- libempathy-gtk/empathy-individual-view.c
+++ libempathy-gtk/empathy-individual-view.c
@@ -2283,8 +2283,19 @@
       GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, "%s", message);

   if (block_button)
-    gtk_dialog_add_button (GTK_DIALOG (dialog),
-        _("Delete and Block"), GTK_RESPONSE_REJECT);
+    {
+      GtkWidget *button;
+
+      /* gtk_dialog_add_button() doesn't allow us to pass a string with a
+       * mnemonic so we have to create the button manually. */
+      button = gtk_button_new_with_mnemonic (
+          _("Delete and _Block"));
+
+      gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button,
+          GTK_RESPONSE_REJECT);
+
+      gtk_widget_show (button);
+    }

   gtk_dialog_add_buttons (GTK_DIALOG (dialog),
       GTK_STOCK_CANCEL, GTK_RESPONSE_NO,


[C] Remove redundant include of winnt.h.

--- aeron-client/src/main/c/concurrent/aeron_atomic64_msvc.h
+++ aeron-client/src/main/c/concurrent/aeron_atomic64_msvc.h
@@ -21,7 +21,6 @@
 #include <stdint.h>
 #include <winsock2.h>
 #include <windows.h>
-#include <winnt.h>
 #include <intrin.h>

 #define AERON_GET_VOLATILE(dst, src) \


Remove comment

Remove comment

Ragecoding often leads eventually to wonderful software, but we don't
need a permanent reminder of it in the codebase. There is already enough
negativity in the world.

--- lib/eosknowledgesearchprivate/ekns-file-input-stream-wrapper.c
+++ lib/eosknowledgesearchprivate/ekns-file-input-stream-wrapper.c
@@ -1,8 +1,6 @@
 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */

 /* Copyright 2016 Endless Mobile, Inc. */
-
-/* A complete tire fire workaround for Gio's piece of trash horrible file / stream API. Kill me. */

 #include "ekns-file-input-stream-wrapper.h"