Cleanup EstEID 1.0/1.1 lefovers

Cleanup EstEID 1.0/1.1 lefovers

Signed-off-by: Raul Metsma <8b52b6b714585648fd300da0dbc0fa0678553280@metsma.ee>

--- src/libopensc/card-mcrd.c
+++ src/libopensc/card-mcrd.c
@@ -331,39 +331,33 @@
 	if (is_esteid_card(card)) {
 		/* Select the EstEID AID to get to a known state.
 		 * For some reason a reset is required as well... */
-		if (card->type == SC_CARD_TYPE_MCRD_ESTEID_V30) {
-			sc_reset(card, 0);
-
-			r = gp_select_aid(card, &EstEID_v3_AID);
-			if (r < 0)
-			{
-				r = gp_select_aid(card, &EstEID_v35_AID);
-				if (r >= 0) {
-					// Force EstEID 3.5 card recv size 255 with T=0 to avoid recursive read binary
-					// sc_read_binary cannot handle recursive 61 00 calls
-					if (card->reader && card->reader->active_protocol == SC_PROTO_T0)
-						card->max_recv_size = 255;
-				} else {
-					r = gp_select_aid(card, &AzeDIT_v35_AID);
-					if (r < 0) {
-						free(card->drv_data);
-						card->drv_data = NULL;
-						SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_INVALID_CARD);
-					}
+		sc_reset(card, 0);
+
+		r = gp_select_aid(card, &EstEID_v3_AID);
+		if (r < 0)
+		{
+			r = gp_select_aid(card, &EstEID_v35_AID);
+			if (r >= 0) {
+				// Force EstEID 3.5 card recv size 255 with T=0 to avoid recursive read binary
+				// sc_read_binary cannot handle recursive 61 00 calls
+				if (card->reader && card->reader->active_protocol == SC_PROTO_T0)
+					card->max_recv_size = 255;
+			} else {
+				r = gp_select_aid(card, &AzeDIT_v35_AID);
+				if (r < 0) {
+					free(card->drv_data);
+					card->drv_data = NULL;
+					SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_INVALID_CARD);
 				}
 			}
-			flags = SC_ALGORITHM_RSA_RAW | SC_ALGORITHM_RSA_HASH_SHA1 | SC_ALGORITHM_RSA_PAD_PKCS1 | SC_ALGORITHM_RSA_HASH_SHA256;
-			/* EstEID v3.0 has 2048 bit keys */
-			_sc_card_add_rsa_alg(card, 2048, flags, 0);
-
-			flags = SC_ALGORITHM_ECDSA_RAW | SC_ALGORITHM_ECDH_CDH_RAW | SC_ALGORITHM_ECDSA_HASH_NONE;
-			ext_flags = SC_ALGORITHM_EXT_EC_NAMEDCURVE | SC_ALGORITHM_EXT_EC_UNCOMPRESES;
-			_sc_card_add_ec_alg(card, 384, flags, ext_flags, NULL);
-		} else {
-			/* EstEID v1.0 and 1.1 have 1024 bit keys */
-			flags = SC_ALGORITHM_RSA_RAW | SC_ALGORITHM_RSA_PAD_PKCS1 | SC_ALGORITHM_RSA_HASH_SHA1;
-			_sc_card_add_rsa_alg(card, 1024, flags, 0);
-		}
+		}
+		flags = SC_ALGORITHM_RSA_RAW | SC_ALGORITHM_RSA_HASH_SHA1 | SC_ALGORITHM_RSA_PAD_PKCS1 | SC_ALGORITHM_RSA_HASH_SHA256;
+		/* EstEID v3.0 has 2048 bit keys */
+		_sc_card_add_rsa_alg(card, 2048, flags, 0);
+
+		flags = SC_ALGORITHM_ECDSA_RAW | SC_ALGORITHM_ECDH_CDH_RAW | SC_ALGORITHM_ECDSA_HASH_NONE;
+		ext_flags = SC_ALGORITHM_EXT_EC_NAMEDCURVE | SC_ALGORITHM_EXT_EC_UNCOMPRESES;
+		_sc_card_add_ec_alg(card, 384, flags, ext_flags, NULL);
 	} else {
 		flags = SC_ALGORITHM_RSA_RAW |SC_ALGORITHM_RSA_PAD_PKCS1 | SC_ALGORITHM_RSA_HASH_NONE;
 		_sc_card_add_rsa_alg(card, 512, flags, 0);


fixed missing include for session.h causing grief to package managers

--- libASGTK/asgtklookedit.c
+++ libASGTK/asgtklookedit.c
@@ -25,6 +25,7 @@
 #include "../libAfterImage/asvisual.h"
 #include "../libAfterStep/asapp.h"
 #include "../libAfterStep/screen.h"
+#include "../libAfterStep/session.h"
 #include "../libAfterStep/parser.h"
 #include "../libAfterStep/freestor.h"
 #include "../libAfterStep/mystyle.h"


Fixed debug msg

Fixed debug msg

--- libatmisrv/svqdispatch.c
+++ libatmisrv/svqdispatch.c
@@ -268,22 +268,28 @@

     call_age = ndrx_stopwatch_get_delta_sec(&call->timer);

-    NDRX_LOG(log_debug, "got call, cd: %d timestamp: %d (id: %d%d) callseq: %u, "
+    NDRX_LOG(log_debug, "got call, cd: %d timestamp: %d callseq: %u, "
 			"svc: %s, flags: %ld, call age: %ld, data_len: %ld, caller: %s "
                         " reply_to: %s, clttout: %d",
-                    	call->cd, call->timestamp, call->cd, call->timestamp, call->callseq,
+                    	call->cd, call->timestamp, call->callseq,
 			call->name, call->flags, call_age, call->data_len,
                         call->my_id, call->reply_to, call->clttout);

     if (call->clttout > 0 && call_age >= call->clttout &&
             !(call->flags & TPNOTIME))
     {
-        NDRX_LOG(log_error, "Received call already expired! "
-                "call age = %ld s, client timeout = %d s, caller: %s",
-                call_age, call->clttout, call->my_id);
-        userlog("Received call already expired! "
-                "call age = %ld s, client timeout = %d s, caller: %s",
-                 call_age, call->clttout, call->my_id);
+        NDRX_LOG(log_error, "Recieved expired call - drop, cd: %d timestamp: %d callseq: %u, "
+		    "svc: %s, flags: %ld, call age: %ld, data_len: %ld, caller: %s "
+                        " reply_to: %s, clttout: %d",
+                    	call->cd, call->timestamp, call->callseq,
+		    call->name, call->flags, call_age, call->data_len,
+                        call->my_id, call->reply_to, call->clttout);
+        userlog("Recieved expired call - drop, cd: %d timestamp: %d callseq: %u, "
+		    "svc: %s, flags: %ld, call age: %ld, data_len: %ld, caller: %s "
+                        " reply_to: %s, clttout: %d",
+                    	call->cd, call->timestamp, call->callseq,
+		    call->name, call->flags, call_age, call->data_len,
+                        call->my_id, call->reply_to, call->clttout);
         *status=EXFAIL;
         goto out;
     }


better min/max rate handling cleanup

better min/max rate handling
cleanup

git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@952 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

--- libavcodec/ratecontrol.c
+++ libavcodec/ratecontrol.c
@@ -64,9 +64,6 @@
     }
     rcc->buffer_index= s->avctx->rc_buffer_size/2;

-    rcc->next_non_b_qscale=10;
-    rcc->next_p_qscale=10;
-
     if(s->flags&CODEC_FLAG_PASS2){
         int i;
         char *p;
@@ -231,7 +228,6 @@
     const int pict_type= rce->new_pict_type;
     const double mb_num= s->mb_num;
     int i;
-    const double last_q= rcc->last_qscale_for[pict_type];

     double const_values[]={
         M_PI,
@@ -324,13 +320,34 @@
         q= -q*s->avctx->i_quant_factor + s->avctx->i_quant_offset;
     else if(pict_type==B_TYPE && s->avctx->b_quant_factor<0.0)
         q= -q*s->avctx->b_quant_factor + s->avctx->b_quant_offset;
-
+
+    return q;
+}
+
+static double get_diff_limited_q(MpegEncContext *s, RateControlEntry *rce, double q){
+    RateControlContext *rcc= &s->rc_context;
+    AVCodecContext *a= s->avctx;
+    const int pict_type= rce->new_pict_type;
+    const double last_p_q    = rcc->last_qscale_for[P_TYPE];
+    const double last_non_b_q= rcc->last_qscale_for[rcc->last_non_b_pict_type];
+
+    if     (pict_type==I_TYPE && (a->i_quant_factor>0.0 || rcc->last_non_b_pict_type==P_TYPE))
+        q= last_p_q    *ABS(a->i_quant_factor) + a->i_quant_offset;
+    else if(pict_type==B_TYPE && a->b_quant_factor>0.0)
+        q= last_non_b_q*    a->b_quant_factor  + a->b_quant_offset;
+
     /* last qscale / qdiff stuff */
-    if     (q > last_q + s->max_qdiff) q= last_q + s->max_qdiff;
-    else if(q < last_q - s->max_qdiff) q= last_q - s->max_qdiff;
+    if(rcc->last_non_b_pict_type==pict_type || pict_type!=I_TYPE){
+        double last_q= rcc->last_qscale_for[pict_type];
+        if     (q > last_q + a->max_qdiff) q= last_q + a->max_qdiff;
+        else if(q < last_q - a->max_qdiff) q= last_q - a->max_qdiff;
+    }

     rcc->last_qscale_for[pict_type]= q; //Note we cant do that after blurring

+    if(pict_type!=B_TYPE)
+        rcc->last_non_b_pict_type= pict_type;
+
     return q;
 }

@@ -380,13 +397,15 @@
 //printf("q:%f\n", q);
     /* buffer overflow/underflow protection */
     if(buffer_size){
-        double expected_size= rcc->buffer_index - bits;
+        double expected_size= rcc->buffer_index;

         if(min_rate){
-            double d= 2*(buffer_size - (expected_size + min_rate))/buffer_size;
+            double d= 2*(buffer_size - expected_size)/buffer_size;
             if(d>1.0) d=1.0;
             else if(d<0.0001) d=0.0001;
             q*= pow(d, 1.0/s->avctx->rc_buffer_aggressivity);
+
+            q= MIN(q, bits2qp(rce, MAX((min_rate - buffer_size + rcc->buffer_index)*2, 1)));
         }

         if(max_rate){
@@ -394,6 +413,8 @@
             if(d>1.0) d=1.0;
             else if(d<0.0001) d=0.0001;
             q/= pow(d, 1.0/s->avctx->rc_buffer_aggressivity);
+
+            q= MAX(q, bits2qp(rce, MAX(rcc->buffer_index/2, 1)));
         }
     }
 //printf("q:%f max:%f min:%f size:%f index:%d bits:%f agr:%f\n", q,max_rate, min_rate, buffer_size, rcc->buffer_index, bits, s->avctx->rc_buffer_aggressivity);
@@ -529,10 +550,7 @@

         assert(q>0.0);
 //printf("%f ", q);
-        if     (pict_type==I_TYPE && s->avctx->i_quant_factor>0.0)
-            q= rcc->next_p_qscale*s->avctx->i_quant_factor + s->avctx->i_quant_offset;
-        else if(pict_type==B_TYPE && s->avctx->b_quant_factor>0.0)
-            q= rcc->next_non_b_qscale*s->avctx->b_quant_factor + s->avctx->b_quant_offset;
+        q= get_diff_limited_q(s, rce, q);
 //printf("%f ", q);
         assert(q>0.0);

@@ -553,9 +571,6 @@
         rcc->pass1_wanted_bits+= s->bit_rate/fps;

         assert(q>0.0);
-
-        if(pict_type != B_TYPE) rcc->next_non_b_qscale= q;
-        if(pict_type == P_TYPE) rcc->next_p_qscale= q;
     }
 //printf("qmin:%d, qmax:%d, q:%f\n", qmin, qmax, q);

@@ -565,13 +580,11 @@

 //    printf("%f %d %d %d\n", q, picture_number, (int)wanted_bits, (int)s->total_bits);

-
 //printf("%f %f %f\n", q, br_compensation, short_term_q);
     qscale= (int)(q + 0.5);
-//printf("%d ", qscale);
-
-//printf("q:%d diff:%d comp:%f st_q:%f last_size:%d\n", qscale, (int)diff, br_compensation,
-//       short_term_q, s->frame_bits);
+
+//printf("q:%d diff:%d comp:%f st_q:%f last_size:%d type:%d\n", qscale, (int)diff, br_compensation,
+//       short_term_q, s->frame_bits, pict_type);
 //printf("%d %d\n", s->bit_rate, (int)fps);

     rcc->last_qscale= qscale;
@@ -693,21 +706,10 @@
         assert(filter_size%2==1);

         /* fixed I/B QP relative to P mode */
-        rcc->next_non_b_qscale= 10;
-        rcc->next_p_qscale= 10;
         for(i=rcc->num_entries-1; i>=0; i--){
             RateControlEntry *rce= &rcc->entry[i];
-            const int pict_type= rce->new_pict_type;
-
-            if     (pict_type==I_TYPE && s->avctx->i_quant_factor>0.0)
-                qscale[i]= rcc->next_p_qscale*s->avctx->i_quant_factor + s->avctx->i_quant_offset;
-            else if(pict_type==B_TYPE && s->avctx->b_quant_factor>0.0)
-                qscale[i]= rcc->next_non_b_qscale*s->avctx->b_quant_factor + s->avctx->b_quant_offset;
-
-            if(pict_type!=B_TYPE)
-                rcc->next_non_b_qscale= qscale[i];
-            if(pict_type==P_TYPE)
-                rcc->next_p_qscale= qscale[i];
+
+            qscale[i]= get_diff_limited_q(s, rce, qscale[i]);
         }

         /* smooth curve */


Fix duplicate of timezone

Fix duplicate of timezone

--- libc/misc/time/tm_conv.c
+++ libc/misc/time/tm_conv.c
@@ -81,10 +81,6 @@
 	/* Leap years.  */
 	{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
 };
-/* This global is exported to the wide world in keeping
- * with the interface in time.h */
-long int timezone;
-

 void __tm_conv(tmbuf, t, offset)
 struct tm *tmbuf;


NSManagedObject category if CoreData is loaded

--- PDKTModelBuilder/PDKTModelBuilder.h
+++ PDKTModelBuilder/PDKTModelBuilder.h
@@ -7,4 +7,6 @@
 //

 #import "PDKTEntityDataParser.h"
-#import "NSManagedObject+PDKTModelBuilder.h"
+#ifdef _COREDATADEFINES_H
+    #import "NSManagedObject+PDKTModelBuilder.h"
+#endif


Fixed bug #255

Fixed bug #255

Fixed memory leaks in the windib driver.

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

--- src/video/windib/SDL_dibvideo.c
+++ src/video/windib/SDL_dibvideo.c
@@ -413,6 +413,7 @@
 	ReleaseDC(SDL_Window, hdc);
 	return(depth);
 #else
+    int depth;
     int dib_size;
     LPBITMAPINFOHEADER dib_hdr;
     HDC hdc;
@@ -441,21 +442,23 @@
     DeleteObject(hbm);
     ReleaseDC(NULL, hdc);

+    depth = 0;
     switch( dib_hdr->biBitCount )
     {
-    case 8:     return 8;
-    case 24:    return 24;
-    case 32:    return 32;
+    case 8:     depth = 8; break;
+    case 24:    depth = 24; break;
+    case 32:    depth = 32; break;
     case 16:
         if( dib_hdr->biCompression == BI_BITFIELDS ) {
             /* check the red mask */
             switch( ((DWORD*)((char*)dib_hdr + dib_hdr->biSize))[0] ) {
-                case 0xf800: return 16;    /* 565 */
-                case 0x7c00: return 15;    /* 555 */
+                case 0xf800: depth = 16; break;   /* 565 */
+                case 0x7c00: depth = 15; break;   /* 555 */
             }
         }
     }
-    return 0;    /* poo. */
+    SDL_free(dib_hdr);
+    return depth;
 #endif /* NO_GETDIBITS */
 }

@@ -1024,6 +1027,8 @@

 void DIB_VideoQuit(_THIS)
 {
+	int i, j;
+
 	/* Destroy the window and everything associated with it */
 	if ( SDL_Window ) {
 		/* Delete the screen bitmap (also frees screen->pixels) */
@@ -1061,7 +1066,18 @@
 			aygshell = NULL;
 		}
 #endif
-
+	}
+
+	for ( i=0; i < SDL_arraysize(SDL_modelist); ++i ) {
+		if ( !SDL_modelist[i] ) {
+			continue;
+		}
+		for ( j=0; SDL_modelist[i][j]; ++j ) {
+			SDL_free(SDL_modelist[i][j]);
+		}
+		SDL_free(SDL_modelist[i]);
+		SDL_modelist[i] = NULL;
+		SDL_nummodes[i] = 0;
 	}
 }


* src/video_output/video_output.c: fixed video filter on-the-fly switching (use var_Get/Set instead of config_Get/Put).

--- src/video_output/video_output.c
+++ src/video_output/video_output.c
@@ -1,5 +1,6 @@
 /*****************************************************************************
  * video_output.c : video output thread
+ *
  * This module describes the programming interface for video output threads.
  * It includes functions allowing to open a new thread, send pictures to a
  * thread, and destroy a previously oppened video output thread.
@@ -136,12 +137,14 @@
     if( p_vout )
     {
         char *psz_filter_chain;
+        vlc_value_t val;

         /* We don't directly check for the "filter" variable for obvious
          * performance reasons. */
         if( p_vout->b_filter_change )
         {
-            psz_filter_chain = config_GetPsz( p_this, "filter" );
+            var_Get( p_this, "filter", &val );
+            psz_filter_chain = val.psz_string;

             if( psz_filter_chain && !*psz_filter_chain )
             {
@@ -420,15 +423,9 @@
     var_AddCallback( p_vout, "deinterlace", DeinterlaceCallback, NULL );

-    var_Create( p_vout, "filter", VLC_VAR_STRING );
+    var_Create( p_vout, "filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
     text.psz_string = _("Filters");
     var_Change( p_vout, "filter", VLC_VAR_SETTEXT, &text, NULL );
-    var_Change( p_vout, "filter", VLC_VAR_INHERITVALUE, &val, NULL );
-    if( val.psz_string )
-    {
-        var_Set( p_vout, "filter", val );
-        free( val.psz_string );
-    }
     var_AddCallback( p_vout, "filter", FilterCallback, NULL );

     /* Calculate delay created by internal caching */
@@ -559,30 +556,6 @@
     }

     msg_Dbg( p_vout, "got %i direct buffer(s)", I_OUTPUTPICTURES );
-
-#if 0
-    if( !p_vout->psz_filter_chain )
-    {
-        char *psz_aspect = config_GetPsz( p_vout, "pixel-ratio" );
-
-        if( psz_aspect )
-        {
-            int i_new_aspect = p_vout->output.i_width * VOUT_ASPECT_FACTOR
-                                                      * atof( psz_aspect )
-                                                      / p_vout->output.i_height;
-            free( psz_aspect );
-
-            if( i_new_aspect && i_new_aspect != p_vout->output.i_aspect )
-            {
-                AspectRatio( i_new_aspect, &i_aspect_x, &i_aspect_y );
-
-                msg_Dbg( p_vout, "output ratio forced to %i:%i\n",
-                         i_aspect_x, i_aspect_y );
-                p_vout->output.i_aspect = i_new_aspect;
-            }
-        }
-    }
-#endif

     AspectRatio( p_vout->render.i_aspect, &i_aspect_x, &i_aspect_y );
     msg_Dbg( p_vout,
@@ -1355,33 +1328,28 @@
     vlc_value_t val;

     char *psz_mode = newval.psz_string;
-    char *psz_filter;
-
-    psz_filter = config_GetPsz( p_vout, "filter" );
+    char *psz_filter, *psz_deinterlace = NULL;
+
+    var_Get( p_vout, "filter", &val );
+    psz_filter = val.psz_string;
+    if( psz_filter ) psz_deinterlace = strstr( psz_filter, "deinterlace" );

     if( !psz_mode || !*psz_mode )
     {
-        config_PutPsz( p_vout, "filter", "" );
-    }
-    else
-    {
-        if( !psz_filter || !*psz_filter )
-        {
-            config_PutPsz( p_vout, "filter", "deinterlace" );
-        }
-        else
-        {
-            if( strstr( psz_filter, "deinterlace" ) == NULL )
-            {
-                psz_filter = realloc( psz_filter, strlen( psz_filter ) + 20 );
-                strcat( psz_filter, ",deinterlace" );
-            }
-            config_PutPsz( p_vout, "filter", psz_filter );
-        }
-    }
-
-    if( psz_filter ) free( psz_filter );
-
+        if( psz_deinterlace )
+        {
+            char *psz_src = psz_deinterlace + sizeof("deinterlace") - 1;
+            if( psz_src[0] == ',' ) psz_src++;
+            memmove( psz_deinterlace, psz_src, strlen(psz_src) + 1 );
+        }
+    }
+    else if( !psz_deinterlace )
+    {
+        psz_filter = realloc( psz_filter, strlen( psz_filter ) +
+                              sizeof(",deinterlace") );
+        if( psz_filter && *psz_filter ) strcat( psz_filter, "," );
+        strcat( psz_filter, "deinterlace" );
+    }

     p_input = (input_thread_t *)vlc_object_find( p_this, VLC_OBJECT_INPUT,
                                                  FIND_PARENT );
@@ -1394,26 +1362,14 @@
         var_Create( p_input, "deinterlace-mode", VLC_VAR_STRING );
         var_Set( p_input, "deinterlace-mode", val );
     }
+    vlc_object_release( p_input );

     val.b_bool = VLC_TRUE;
     var_Set( p_vout, "intf-change", val );

-    /* Now restart current video stream */
-    var_Get( p_input, "video-es", &val );
-    if( val.i_int >= 0 )
-    {
-        p_vout->b_filter_change = VLC_TRUE;
-        suxor_thread_t *p_suxor =
-            vlc_object_create( p_vout, sizeof(suxor_thread_t) );
-        p_suxor->p_input = p_input; vlc_object_yield( p_input );
-        p_suxor->p_vout = p_vout; vlc_object_yield( p_vout );
-        if( psz_mode && *psz_mode )
-            p_suxor->psz_mode = strdup( psz_mode );
-        vlc_thread_create( p_suxor, "suxor", SuxorRestartVideoES,
-                           VLC_THREAD_PRIORITY_LOW, VLC_FALSE );
-    }
-
-    vlc_object_release( p_input );
+    val.psz_string = psz_filter;
+    var_Set( p_vout, "filter", val );
+    if( psz_filter ) free( psz_filter );

     return VLC_SUCCESS;
 }
@@ -1427,7 +1383,6 @@

     p_input = (input_thread_t *)vlc_object_find( p_this, VLC_OBJECT_INPUT,
                                                  FIND_PARENT );
-
     if (!p_input)
     {
         msg_Err( p_vout, "Input not found" );
@@ -1436,6 +1391,11 @@

     val.b_bool = VLC_TRUE;
     var_Set( p_vout, "intf-change", val );
+
+    /* Modify input as well because the vout might have to be restarted */
+    val.psz_string = newval.psz_string;
+    var_Create( p_input, "filter", VLC_VAR_STRING );
+    var_Set( p_input, "filter", val );

     /* Now restart current video stream */
     var_Get( p_input, "video-es", &val );


mingw does not have _snprintf_s

mingw does not have _snprintf_s

--- xbyak/xbyak.h
+++ xbyak/xbyak.h
@@ -820,7 +820,7 @@
 	static inline std::string toStr(int num)
 	{
 		char buf[16];
-#ifdef _WIN32
+#ifdef _MSC_VER
 		_snprintf_s
 #else
 		snprintf


Change default benchmark range

Change default benchmark range

--- src/bench2.c
+++ src/bench2.c
@@ -11,9 +11,9 @@

 #define ARGON2_BLOCK_SIZE 1024

-#define BENCH_MAX_T_COST 8
+#define BENCH_MAX_T_COST 16
 #define BENCH_MAX_M_COST (1024 * 1024)
-#define BENCH_MAX_THREADS 4
+#define BENCH_MAX_THREADS 8
 #define BENCH_MIN_PASSES (1024 * 1024)
 #define BENCH_MAX_SAMPLES 128

@@ -139,7 +139,7 @@
     printf("%8s%16s%8s%16s%16s\n", "t_cost", "m_cost", "threads",
            "Argon2d (ms)", "Argon2i (ms)");
     for (t_cost = 1; t_cost <= BENCH_MAX_T_COST; t_cost *= 2) {
-        for (m_cost = 1024; m_cost <= BENCH_MAX_M_COST; m_cost *= 2) {
+        for (m_cost = 64; m_cost <= BENCH_MAX_M_COST; m_cost *= 2) {
             for (p = 1; p <= BENCH_MAX_THREADS; p *= 2) {
                 res = benchmark(t_cost, m_cost, p);
                 if (res != 0) {


Reviewed by:	phk changed ^G to \007

Reviewed by:	phk
changed ^G to \007

--- libexec/talkd/announce.c
+++ libexec/talkd/announce.c
@@ -130,7 +130,7 @@
 	max_size = max(max_size, sizes[i]);
 	i++;
 	bptr = big_buf;
-	*bptr++ = ''; /* send something to wake them up */
+	*bptr++ = '\007'; /* send something to wake them up */
 	*bptr++ = '\r';	/* add a \r in case of raw mode */
 	*bptr++ = '\n';
 	for (i = 0; i < N_LINES; i++) {


fix up rets for libtorque_addssl()

fix up rets for libtorque_addssl()

--- src/libtorque/libtorque.c
+++ src/libtorque/libtorque.c
@@ -225,13 +225,22 @@
 	struct ssl_cbstate *cbs;

 	if((cbs = create_ssl_cbstate(ctx,sslctx,state,rx,tx)) == NULL){
-		return -1;
+		return LIBTORQUE_ERR_RESOURCE; // FIXME not necessarily correct
 	}
 	if(libtorque_addfd_unbuffered(ctx,fd,ssl_accept_rxfxn,NULL,cbs)){
 		free_ssl_cbstate(cbs);
-		return -1;
-	}
-	return 0;
+		return LIBTORQUE_ERR_RESOURCE; // FIXME not necessarily correct
+	}
+	return 0;
+}
+#else
+libtorque_err libtorque_addssl(libtorque_ctx *ctx __attribute__ ((unused)),
+				int fd __attribute__ ((unused)),
+				SSL_CTX *sslctx __attribute__ ((unused)),
+				libtorquercb rx __attribute__ ((unused)),
+				libtorquewcb tx __attribute__ ((unused)),
+				void *state __attribute__ ((unused))){
+	return LIBTORQUE_ERR_UNAVAIL;
 }
 #endif


Forgot the actual file

Forgot the actual file

--- libgnome/gnome-program.c
+++ libgnome/gnome-program.c
@@ -1292,7 +1292,8 @@
      * there are those evil people out there that modify it.
      * Also, this may be some other argv, think 'fake argv' here */
     program->_priv->argv = g_new (char *, argc + 1);
-    memcpy (program->_priv->argv, argv, sizeof (char *) * argc);
+    for (i = 0; i < argc; i++)
+        program->_priv->argv[i] = g_strdup (argv[i]);
     program->_priv->argv[argc] = NULL;

     if (!program_modules) {


script recording: Support opening device multiple times

Append to an existing record instead of overwriting it. Ensure that we do not
start writing at the end of the last line.

--- src/libumockdev-preload.c
+++ src/libumockdev-preload.c
@@ -529,11 +529,15 @@
 	abort();
     }

-    log = fopen(logname, "w");
+    log = fopen(logname, "a");
     if (log == NULL) {
 	perror("umockdev: failed to open script record file");
 	exit(1);
     }
+
+    // if we have a previous record, make sure that we start a new line
+    if (ftell(log) > 0)
+	putc('\n', log);

     DBG("script_record_open: start recording fd %i on device %i:%i into %s\n",
 	fd, major(fd_dev), minor(fd_dev), logname);


Fix wrong format in argument comment

Fix wrong format in argument comment

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

--- geom/inc/TVirtualGeoTrack.h
+++ geom/inc/TVirtualGeoTrack.h
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TVirtualGeoTrack.h,v 1.2 2003/06/17 09:13:55 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TVirtualGeoTrack.h,v 1.3 2003/06/17 19:46:10 brun Exp $
 // Author: Andrei Gheata   2003/04/10

 /*************************************************************************
@@ -76,7 +76,7 @@
    Bool_t              IsInTimeRange() const;
    virtual void        Paint(Option_t *option="") = 0;
    virtual void        PaintCollect(Double_t /*time*/, Double_t * /*box*/) {;}
-   virtual void        PaintCollectTrack(Double_t /*time*/, Double_t */*box*/) {;}
+   virtual void        PaintCollectTrack(Double_t /*time*/, Double_t * /*box*/) {;}
    virtual void        PaintTrack(Option_t *option="") = 0;
    virtual void        ResetTrack() = 0;
    void                SetName(const char *name);


Memleak fix

Memleak fix

--- libgnomeui/gnome-about.c
+++ libgnomeui/gnome-about.c
@@ -337,16 +337,15 @@
 			tmp = g_strdup_printf("<%s>", (gchar*) name_email->data);
 			item_email = DRAW_TEXT(x2, y, GNOME_ABOUT_CONTENT_COLOR,
 					       ai->font_names, tmp);
-			g_free (tmp);

 			tmp = g_strdup_printf("mailto:%s", (gchar*) name_email->data);
 			gtk_signal_connect(
 			    GTK_OBJECT(item_email), "event",
 			    (GtkSignalFunc) gnome_about_item_cb, ai);
-			gtk_object_set_data(
+			gtk_object_set_data_full(
 			    GTK_OBJECT(item_email),
-			    "url", (gchar*)name_email->data);
-			g_free (tmp);
+			    "url", tmp,
+			    (GtkDestroyNotify) g_free);
 		}

 		y += h + BASE_LINE_SKIP;


fixing missing authentification tokens in client

--- src/client/ua_client.c
+++ src/client/ua_client.c
@@ -215,11 +215,18 @@

 /** If the request fails, then the response is cast to UA_ResponseHeader (at the beginning of every
     response) and filled with the appropriate error code */
-static void synchronousRequest(UA_Client *client, const void *request, const UA_DataType *requestType,
+static void synchronousRequest(UA_Client *client, void *request, const UA_DataType *requestType,
                                void *response, const UA_DataType *responseType) {
     /* Check if sc needs to be renewed */
     if(client->scExpiresAt - UA_DateTime_now() <= client->config.timeToRenewSecureChannel * 10000 )
         UA_Client_renewSecureChannel(client);
+
+    /* Copy authenticationToken token to request header */
+    typedef struct {
+        UA_RequestHeader requestHeader;
+    } headerOnlyRequest;
+    /* The cast is valid, since all requests start with a requestHeader */
+    UA_NodeId_copy(&client->authenticationToken, &((headerOnlyRequest*)request)->requestHeader.authenticationToken);

     if(!response)
         return;


Add number of vertice as a member.

Add number of vertice as a member.

--- geometry/glc_extendedmesh.h
+++ geometry/glc_extendedmesh.h
@@ -82,7 +82,10 @@

 	//! Add vertices coordinate
 	inline void addVertices(const GLfloatVector& vertices)
-	{*(m_ExtendedGeomEngine.positionVectorHandle())+= vertices;}
+	{
+		*(m_ExtendedGeomEngine.positionVectorHandle())+= vertices;
+		m_NumberOfVertice+= vertices.size() / 3;
+	}

 	//! Add Normals
 	inline void addNormals(const GLfloatVector& normals)
@@ -151,6 +154,9 @@
 	//! Mesh number of faces
 	unsigned int m_NumberOfFaces;

+	//! Mesh number of vertice
+	unsigned int m_NumberOfVertice;
+
 	//! Selection state
 	bool m_IsSelected;


Write a new line after each event (debug mode)

--- libgpmat/src/gp-events.c
+++ libgpmat/src/gp-events.c
@@ -126,6 +126,7 @@
         }
     }
   va_end (argp);
+  write (STDERR_FILENO, "\n", 1);
 }

 const struct gp_attr_def gp_malloc_attrs[] = {


update conf-openblas: fix test.c

update conf-openblas: fix test.c

--- packages/conf-openblas/conf-openblas.0.1/files/test.c
+++ packages/conf-openblas/conf-openblas.0.1/files/test.c
@@ -1,4 +1,5 @@
-extern double cblas_dnrm2(int N, double *X, int INCX);
+#include <cblas.h>
+#include <lapacke.h>

 int main(int argc, char **argv)
 {


Update main.c

Update main.c

--- MPU6050/main.c
+++ MPU6050/main.c
@@ -41,7 +41,7 @@
 	do{
 		ms_update();
 		 char buff[256] = {0};
-		 sprintf(buff, "{\"yaw\":%f,\"pitch\":%f,\"roll\":%f,\"temperature\":%f}\n", ypr[YAW], ypr[PITCH],ypr[ROLL],temp);
+		 sprintf(buff, "{\"yaw\":%f,\"pitch\":%f,\"roll\":%f,\"temperature\":%f}\n", YAW360(ypr[YAW]), ypr[PITCH],ypr[ROLL],temp);
 		 sendto(fd, buff, strlen(buff), 0, (struct sockaddr *)&addr, sizeof(addr) );
 		 printf("{\"yaw\":%f,\"pitch\":%f,\"roll\":%f,\"temperature\":%f}\n", YAW360(ypr[YAW]), ypr[PITCH],ypr[ROLL],temp);
 		delay_ms(1);


Renamed RUNNING and STOPPING to GUAC_CLIENT_RUNNING and GUAC_CLIENT_STOPPING. Added GUAC_CLIENT_MOUSE_* masks.

--- libguac/include/client.h
+++ libguac/include/client.h
@@ -91,8 +91,33 @@
 typedef int guac_client_init_handler(guac_client* client, int argc, char** argv);

 /**
+ * Button mask value for the left mouse button.
+ */
+#define GUAC_CLIENT_MOUSE_LEFT        0x01
+
+/**
+ * Button mask value for the middle mouse button.
+ */
+#define GUAC_CLIENT_MOUSE_MIDDLE      0x02
+
+/**
+ * Button mask value for the right mouse button.
+ */
+#define GUAC_CLIENT_MOUSE_RIGHT       0x04
+
+/**
+ * Button mask value for scrolling the mouse scrollwheel up.
+ */
+#define GUAC_CLIENT_MOUSE_SCROLL_UP   0x08
+
+/**
+ * Button mask value for scrolling the mouse scrollwheel down.
+ */
+#define GUAC_CLIENT_MOUSE_SCROLL_DOWN 0x10
+
+/**
  * Possible current states of the Guacamole client. Currently, the only
- * two states are RUNNING and STOPPING.
+ * two states are GUAC_CLIENT_RUNNING and GUAC_CLIENT_STOPPING.
  */
 typedef enum guac_client_state {

@@ -100,13 +125,13 @@
      * The state of the client from when it has been allocated by the main
      * daemon until it is killed or disconnected.
      */
-    RUNNING,
+    GUAC_CLIENT_RUNNING,

     /**
      * The state of the client when a stop has been requested, signalling the
      * I/O threads to shutdown.
      */
-    STOPPING
+    GUAC_CLIENT_STOPPING

 } guac_client_state;

@@ -156,9 +181,9 @@

     /**
      * The current state of the client. When the client is first allocated,
-     * this will be initialized to RUNNING. It will remain at RUNNING until
-     * an event occurs which requires the client to shutdown, at which point
-     * the state becomes STOPPING.
+     * this will be initialized to GUAC_CLIENT_RUNNING. It will remain at
+     * GUAC_CLIENT_RUNNING until an event occurs which requires the client to
+     * shutdown, at which point the state becomes GUAC_CLIENT_STOPPING.
      */
     guac_client_state state;


Updated comments in RoiSegmenter2DNode

Updated comments in RoiSegmenter2DNode

--- sandbox/TFG/src/libraries/nodes/RoiSegmenter2DNode.h
+++ sandbox/TFG/src/libraries/nodes/RoiSegmenter2DNode.h
@@ -1,3 +1,20 @@
+//------------------------------------------------------------------------------
+//-- RoiSegmenter2DNode class
+//------------------------------------------------------------------------------
+//--
+//--  Connects the methods implemented in the RoiSegmenter2D class with the other packages using ROS topics.
+//--
+//------------------------------------------------------------------------------
+//--
+//-- This file belongs to the Bachelor's Thesis "In-hand object detection and tracking using 2D and 3D information"
+//-- (https://github.com/irenesanznieto/TFG)
+//--
+//------------------------------------------------------------------------------
+//-- Author: Irene Sanz Nieto
+//--
+//-- Released under the MIT license (more info on LICENSE.md file)
+//------------------------------------------------------------------------------
+
 #ifndef ROISEGMENTER2DNODE_H
 #define ROISEGMENTER2DNODE_H

@@ -5,7 +22,9 @@

 //* RoiSegmenter2DNode class
 /**
-* This class connects the methods implemented in the RoiSegmenter2D class with the other packages through ROS nodes.
+* Connects the methods implemented in the RoiSegmenter2D class with the other packages using ROS topics.
+* \author Irene Sanz Nieto ( https://github.com/irenesanznieto )
+* \date Feb 3rd, 2014
 */
 class RoiSegmenter2DNode
 {


Optimize apu_update a little.

Optimize apu_update a little.

--- src/binjgb.c
+++ src/binjgb.c
@@ -196,8 +196,7 @@
 #define ENVELOPE_MAX_VOLUME 15
 #define DUTY_CYCLE_COUNT 8
 #define SOUND_OUTPUT_COUNT 2
-#define SO1_MAX_VOLUME 7
-#define SO2_MAX_VOLUME 7
+#define SOUND_OUTPUT_MAX_VOLUME 7
 /* Additional samples so the AudioBuffer doesn't overflow. This could happen
  * because the audio buffer is updated at the granularity of an instruction, so
  * the most extra samples that could be added is equal to the APU cycle count
@@ -2997,10 +2996,10 @@

 static u8 update_square_wave(Channel* channel, SquareWave* wave) {
   static u8 duty[WAVE_DUTY_COUNT][DUTY_CYCLE_COUNT] = {
-      {0, 0, 0, 0, 0, 0, 0, 1}, /* WAVE_DUTY_12_5 */
-      {1, 0, 0, 0, 0, 0, 0, 1}, /* WAVE_DUTY_25 */
-      {1, 0, 0, 0, 0, 1, 1, 1}, /* WAVE_DUTY_50 */
-      {0, 1, 1, 1, 1, 1, 1, 0}, /* WAVE_DUTY_75 */
+          [WAVE_DUTY_12_5] = {0, 0, 0, 0, 0, 0, 0, 1},
+          [WAVE_DUTY_25] = {1, 0, 0, 0, 0, 0, 0, 1},
+          [WAVE_DUTY_50] = {1, 0, 0, 0, 0, 1, 1, 1},
+          [WAVE_DUTY_75] = {0, 1, 1, 1, 1, 1, 1, 0},
   };

   if (wave->cycles <= APU_CYCLES) {
@@ -3102,99 +3101,108 @@
   *buffer->position++ = so2;
 }

-static void apu_update(Emulator* e) {
+static void apu_mix_sample(Emulator *e, int channel, u8 sample,
+                           u16 *out_so1_sample, u16 *out_so2_sample) {
+  if (!e->config.disable_sound[channel]) {
+    *out_so1_sample += sample * e->state.apu.so1_output[channel];
+    *out_so2_sample += sample * e->state.apu.so2_output[channel];
+  }
+}
+
+static void apu_update_channel_1(Emulator *e, Bool length, Bool envelope,
+                                 Bool sweep, u16 *out_so1_sample,
+                                 u16 *out_so2_sample) {
   APU* apu = &e->state.apu;
-  Bool do_length = FALSE;
-  Bool do_envelope = FALSE;
-  Bool do_sweep = FALSE;
-  apu->cycles += APU_CYCLES;
-  apu->frame_cycles += APU_CYCLES;
-  if (VALUE_WRAPPED(apu->frame_cycles, FRAME_SEQUENCER_CYCLES)) {
-    apu->frame++;
-    VALUE_WRAPPED(apu->frame, FRAME_SEQUENCER_COUNT);
-
-    switch (apu->frame) {
-      case 0: do_length = TRUE; break;
-      case 1: break;
-      case 2: do_length = do_sweep = TRUE; break;
-      case 3: break;
-      case 4: do_length = TRUE; break;
-      case 5: break;
-      case 6: do_length = do_sweep = TRUE; break;
-      case 7: do_envelope = TRUE; break;
-    }
-
-    VERBOSE(apu, "%s: %c%c%c frame: %u cy: %u\n", __func__,
-            do_length ? 'L' : '.', do_envelope ? 'E' : '.',
-            do_sweep ? 'S' : '.', apu->frame, e->state.cycles);
-  }
-
+  Channel* channel1 = &apu->channel[CHANNEL1];
   u8 sample = 0;
-  u16 so1_mixed_sample = 0;
-  u16 so2_mixed_sample = 0;
-
-#define MIX_SAMPLE(channel, get_sample)      \
-  do {                                       \
-    if (!e->config.disable_sound[channel]) { \
-      sample = get_sample;                   \
-      if (apu->so1_output[channel]) {        \
-        so1_mixed_sample += sample;          \
-      }                                      \
-      if (apu->so2_output[channel]) {        \
-        so2_mixed_sample += sample;          \
-      }                                      \
-    }                                        \
-  } while (0)
-
-  /* Channel 1 */
-  Channel* channel1 = &apu->channel[CHANNEL1];
   if (channel1->status) {
-    if (do_sweep) update_channel_sweep(channel1, &apu->sweep);
+    if (sweep) update_channel_sweep(channel1, &apu->sweep);
     sample = update_square_wave(channel1, &channel1->square_wave);
   }
-  if (do_length) update_channel_length(channel1);
+  if (length) update_channel_length(channel1);
   if (channel1->status) {
-    if (do_envelope) update_channel_envelope(e, channel1);
-    MIX_SAMPLE(CHANNEL1, channelx_sample(channel1, sample));
-  }
-
-  /* Channel 2 */
+    if (envelope) update_channel_envelope(e, channel1);
+    apu_mix_sample(e, CHANNEL1, channelx_sample(channel1, sample),
+                   out_so1_sample, out_so2_sample);
+  }
+}
+
+static void apu_update_channel_2(Emulator *e, Bool length, Bool envelope,
+                                 u16 *out_so1_sample, u16 *out_so2_sample) {
+  APU* apu = &e->state.apu;
   Channel* channel2 = &apu->channel[CHANNEL2];
+  u8 sample = 0;
   if (channel2->status) {
     sample = update_square_wave(channel2, &channel2->square_wave);
   }
-  if (do_length) update_channel_length(channel2);
+  if (length) update_channel_length(channel2);
   if (channel2->status) {
-    if (do_envelope) update_channel_envelope(e, channel2);
-    MIX_SAMPLE(CHANNEL2, channelx_sample(channel2, sample));
-  }
-
-  /* Channel 3 */
+    if (envelope) update_channel_envelope(e, channel2);
+    apu_mix_sample(e, CHANNEL2, channelx_sample(channel2, sample),
+                   out_so1_sample, out_so2_sample);
+  }
+}
+
+static void apu_update_channel_3(Emulator *e, Bool length, u16 *out_so1_sample,
+                                 u16 *out_so2_sample) {
+  APU* apu = &e->state.apu;
   Channel* channel3 = &apu->channel[CHANNEL3];
+  u8 sample = 0;
   if (channel3->status) {
     sample = update_wave(apu, &apu->wave);
   }
-  if (do_length) update_channel_length(channel3);
+  if (length) update_channel_length(channel3);
   if (channel3->status) {
-    MIX_SAMPLE(CHANNEL3, channel3_sample(channel3, &apu->wave, sample));
-  }
-
-  /* Channel 4 */
+    apu_mix_sample(e, CHANNEL3, channel3_sample(channel3, &apu->wave, sample),
+                   out_so1_sample, out_so2_sample);
+  }
+}
+
+static void apu_update_channel_4(Emulator *e, Bool length, Bool envelope,
+                                 u16 *out_so1_sample, u16 *out_so2_sample) {
+  APU* apu = &e->state.apu;
   Channel* channel4 = &apu->channel[CHANNEL4];
+  u8 sample = 0;
   if (channel4->status) {
     sample = update_noise(apu, &apu->noise);
   }
-  if (do_length) update_channel_length(channel4);
+  if (length) update_channel_length(channel4);
   if (channel4->status) {
-    if (do_envelope) update_channel_envelope(e, channel4);
-    MIX_SAMPLE(CHANNEL4, channelx_sample(channel4, sample));
-  }
-
-  so1_mixed_sample *= (apu->so1_volume + 1);
-  so1_mixed_sample /= ((SO1_MAX_VOLUME + 1) * CHANNEL_COUNT);
-  so2_mixed_sample *= (apu->so2_volume + 1);
-  so2_mixed_sample /= ((SO2_MAX_VOLUME + 1) * CHANNEL_COUNT);
-  write_sample(&e->audio_buffer, so1_mixed_sample, so2_mixed_sample);
+    if (envelope) update_channel_envelope(e, channel4);
+    apu_mix_sample(e, CHANNEL4, channelx_sample(channel4, sample),
+                   out_so1_sample, out_so2_sample);
+  }
+}
+
+static void apu_update_channels(Emulator *e, Bool length, Bool envelope,
+                                Bool sweep) {
+  APU* apu = &e->state.apu;
+  u16 so1_sample = 0;
+  u16 so2_sample = 0;
+  apu_update_channel_1(e, length, envelope, sweep, &so1_sample, &so2_sample);
+  apu_update_channel_2(e, length, envelope, &so1_sample, &so2_sample);
+  apu_update_channel_3(e, length, &so1_sample, &so2_sample);
+  apu_update_channel_4(e, length, envelope, &so1_sample, &so2_sample);
+  so1_sample *= (apu->so1_volume + 1);
+  so1_sample /= ((SOUND_OUTPUT_MAX_VOLUME + 1) * CHANNEL_COUNT);
+  so2_sample *= (apu->so2_volume + 1);
+  so2_sample /= ((SOUND_OUTPUT_MAX_VOLUME + 1) * CHANNEL_COUNT);
+  write_sample(&e->audio_buffer, so1_sample, so2_sample);
+}
+
+static void apu_update(Emulator* e) {
+  e->state.apu.cycles += APU_CYCLES;
+  e->state.apu.frame_cycles += APU_CYCLES;
+  if (VALUE_WRAPPED(e->state.apu.frame_cycles, FRAME_SEQUENCER_CYCLES)) {
+    e->state.apu.frame++;
+    VALUE_WRAPPED(e->state.apu.frame, FRAME_SEQUENCER_COUNT);
+    switch (e->state.apu.frame) {
+      case 0: case 4: apu_update_channels(e, TRUE, FALSE, FALSE); return;
+      case 2: case 6: apu_update_channels(e, TRUE, FALSE, TRUE); return;
+      case 7: apu_update_channels(e, FALSE, TRUE, FALSE); return;
+    }
+  }
+  apu_update_channels(e, FALSE, FALSE, FALSE);
 }

 static void apu_mcycle(Emulator* e) {


circular queue in c

circular queue in c

error: pathspec 'data_structures/Queue/circular_queue.c' did not match any file(s) known to git

--- data_structures/Queue/circular_queue.c
+++ data_structures/Queue/circular_queue.c
@@ -0,0 +1,134 @@
+// C or C++ program for insertion and
+// deletion in Circular Queue
+#include<bits/stdc++.h>
+using namespace std;
+
+struct Queue
+{
+    // Initialize front and rear
+    int rear, front;
+
+    // Circular Queue
+    int size;
+    int *arr;
+
+    Queue(int s)
+    {
+       front = rear = -1;
+       size = s;
+       arr = new int[s];
+    }
+
+    void enQueue(int value);
+    int deQueue();
+    void displayQueue();
+};
+
+
+/* Function to create Circular queue */
+void Queue::enQueue(int value)
+{
+    if ((front == 0 && rear == size-1) ||
+            (rear == front-1))
+    {
+        printf("\nQueue is Full");
+        return;
+    }
+
+    else if (front == -1) /* Insert First Element */
+    {
+        front = rear = 0;
+        arr[rear] = value;
+    }
+
+    else if (rear == size-1 && front != 0)
+    {
+        rear = 0;
+        arr[rear] = value;
+    }
+
+    else
+    {
+        rear++;
+        arr[rear] = value;
+    }
+}
+
+// Function to delete element from Circular Queue
+int Queue::deQueue()
+{
+    if (front == -1)
+    {
+        printf("\nQueue is Empty");
+        return INT_MIN;
+    }
+
+    int data = arr[front];
+    arr[front] = -1;
+    if (front == rear)
+    {
+        front = -1;
+        rear = -1;
+    }
+    else if (front == size-1)
+        front = 0;
+    else
+        front++;
+
+    return data;
+}
+
+// Function displaying the elements
+// of Circular Queue
+void Queue::displayQueue()
+{
+    if (front == -1)
+    {
+        printf("\nQueue is Empty");
+        return;
+    }
+    printf("\nElements in Circular Queue are: ");
+    if (rear >= front)
+    {
+        for (int i = front; i <= rear; i++)
+            printf("%d ",arr[i]);
+    }
+    else
+    {
+        for (int i = front; i < size; i++)
+            printf("%d ", arr[i]);
+
+        for (int i = 0; i <= rear; i++)
+            printf("%d ", arr[i]);
+    }
+}
+
+/* Driver of the program */
+int main()
+{
+    Queue q(5);
+
+    // Inserting elements in Circular Queue
+    q.enQueue(14);
+    q.enQueue(22);
+    q.enQueue(13);
+    q.enQueue(-6);
+
+    // Display elements present in Circular Queue
+    q.displayQueue();
+
+    // Deleting elements from Circular Queue
+    printf("\nDeleted value = %d", q.deQueue());
+    printf("\nDeleted value = %d", q.deQueue());
+
+    q.displayQueue();
+
+    q.enQueue(9);
+    q.enQueue(20);
+    q.enQueue(5);
+
+    q.displayQueue();
+
+    q.enQueue(20);
+    return 0;
+}


cmd/gc: revert CL 60740044

cmd/gc: revert CL 60740044

LGTM=iant
R=iant
CC=golang-codereviews
https://codereview.appspot.com/60590047

--- src/cmd/gc/typecheck.c
+++ src/cmd/gc/typecheck.c
@@ -3199,7 +3199,7 @@
 		n->type->sym = n->sym;
 		nerrors0 = nerrors;
 		typecheckdeftype(n);
-		if(n->type != T && n->type->etype == TFORW && nerrors > nerrors0) {
+		if(n->type->etype == TFORW && nerrors > nerrors0) {
 			// Something went wrong during type-checking,
 			// but it was reported. Silence future errors.
 			n->type->broke = 1;


Call hif_state_set_allow_cancel() when the state is uncancellable

--- libhif/hif-transaction.c
+++ libhif/hif-transaction.c
@@ -921,6 +921,7 @@

 	/* set steps */
 	hif_state_set_number_steps (state, 5);
+	hif_state_set_allow_cancel (state, FALSE);

 	/* need to find the HyPackage in the rpmdb, not the remote one that we
 	 * just installed */
@@ -1443,6 +1444,7 @@
 	priv->step = HIF_TRANSACTION_STEP_STARTED;
 	rpmtsSetFlags (priv->ts, RPMTRANS_FLAG_NONE);
 	g_debug ("Running actual transaction");
+	hif_state_set_allow_cancel (state, FALSE);
 	rc = rpmtsRun (priv->ts, NULL, problems_filter);
 	if (rc < 0) {
 		ret = FALSE;


updates

updates

--- kernels/xeon/geometry/bezier_intersector.h
+++ kernels/xeon/geometry/bezier_intersector.h
@@ -94,8 +94,9 @@
       Vec4vfx P0, dP0du; curve.evalN(vu0,P0,dP0du);
       const Vec4vfx  P3   = Vec4vfx(shift_right_1(P0.x   ),shift_right_1(P0.y   ),shift_right_1(P0.z   ),shift_right_1(P0.w)   );
       const Vec4vfx dP3du = Vec4vfx(shift_right_1(dP0du.x),shift_right_1(dP0du.y),shift_right_1(dP0du.z),shift_right_1(dP0du.w));
-      const Vec4vfx P1 = P0 + Vec4vfx((u1-u0)/(3.0f*(VSIZEX-1)))*dP0du;
-      const Vec4vfx P2 = P3 - Vec4vfx((u1-u0)/(3.0f*(VSIZEX-1)))*dP3du;
+      const float dscale = (u1-u0)/(3.0f*(VSIZEX-1));
+      const Vec4vfx P1 = P0 + Vec4vfx(dscale)*dP0du;
+      const Vec4vfx P2 = P3 - Vec4vfx(dscale)*dP3du;

       /* calculate bounding cylinders */
       const vfloatx r1 = sqrt(sqr_point_to_line_distance(Vec3vfx(P1),Vec3vfx(P0),Vec3vfx(P3)));


bplist: Prevent OOB read when parsing data/string/array/dict size nodes

As reported in #91, the code that will read the big endian integer value
of variable size did not check if the actual number of bytes is still
withing the range of the actual plist data.
This commit fixes the issue with proper bounds checking.

--- src/bplist.c
+++ src/bplist.c
@@ -530,6 +530,8 @@
                 return NULL;
             (*object)++;
             next_size = 1 << next_size;
+            if (*object + next_size >= bplist->data + bplist->size)
+                return NULL;
             size = UINT_TO_HOST(*object, next_size);
             (*object) += next_size;
             break;


Delete generated_functions.h

Delete generated_functions.h

--- vnpy/api/tap/vntap/generated_files/generated_functions.h
+++ vnpy/api/tap/vntap/generated_files/generated_functions.h
@@ -1,113 +0,0 @@
-#pragma once
-#include "config.h"
-
-#include <pybind11/pybind11.h>
-#include <c2py/c2py.hpp>
-
-#include "iTapTradeAPI.h"
-#include "TapQuoteAPI.h"
-#include "TapAPIError.h"
-#include "iTapAPIError.h"
-#include "custom/custom_wrappers.hpp"
-
-
-void generate_vntap(pybind11::module & parent);
-void generate_sub_namespace_ITapTrade(pybind11::module & parent);
-void generate_ITapTrade_sub_namespace(pybind11::module & parent);
-void generate_class_ITapTrade_TapAPIApplicationInfo(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPICommodity(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIContract(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIExchangeInfo(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIChangePasswordReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIAuthPasswordReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPITradeLoginAuth(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPITradeLoginRspInfo(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIRequestVertificateCodeRsp(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIAccQryReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIAccountInfo(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPINewOrder(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIOrderInfo(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIOrderInfoNotice(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIOrderActionRsp(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIAmendOrder(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIOrderCancelReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIOrderQryReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIOrderProcessQryReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIFillQryReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIFillInfo(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPICloseQryReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPICloseInfo(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIPositionQryReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIPositionInfo(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIPositionProfit(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIPositionProfitNotice(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIPositionSummary(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIFundReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIFundData(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPICommodityInfo(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPITradeContractInfo(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPICurrencyInfo(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPITradeMessageReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPITradeMessage(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIBillQryReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIBillQryRsp(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIHisOrderQryReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIHisOrderQryRsp(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIHisMatchQryReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIHisMatchQryRsp(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIHisOrderProcessQryReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIHisPositionQryReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIHisPositionQryRsp(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIHisDeliveryQryReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIHisDeliveryQryRsp(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIAccountCashAdjustQryReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIAccountCashAdjustQryRsp(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIAccountFeeRentQryReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIAccountFeeRentQryRsp(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIAccountMarginRentQryReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIAccountMarginRentQryRsp(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIOrderQuoteMarketNotice(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIOrderMarketInsertReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIOrderMarketInsertRsp(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIOrderMarketDeleteReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIOrderLocalRemoveReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIOrderLocalRemoveRsp(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIOrderLocalInputReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIOrderLocalModifyReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIOrderLocalTransferReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIFillLocalInputReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPIFillLocalRemoveReq(pybind11::object & parent);
-void generate_class_ITapTrade_TapAPITradingCalendarQryRsp(pybind11::object & parent);
-void generate_class_ITapTrade_ITapTradeAPINotify(pybind11::object & parent);
-void generate_class_ITapTrade_ITapTradeAPI(pybind11::object & parent);
-void generate_ITapTrade_classes(pybind11::module & parent);
-void generate_ITapTrade_enums(pybind11::module & parent);
-void generate_ITapTrade_functions_0(pybind11::module & parent);
-void generate_ITapTrade_functions(pybind11::module & parent);
-void generate_ITapTrade_variables(pybind11::module & parent);
-void generate_ITapTrade_typedefs(pybind11::module & parent);
-void generate_caster_ITapTrade(pybind11::object & parent);
-void generate_ITapTrade_caster(pybind11::module & parent);
-void generate_vntap_sub_namespace(pybind11::module & parent);
-void generate_class_TapAPIApplicationInfo(pybind11::object & parent);
-void generate_class_TapAPICommodity(pybind11::object & parent);
-void generate_class_TapAPIContract(pybind11::object & parent);
-void generate_class_TapAPIExchangeInfo(pybind11::object & parent);
-void generate_class_TapAPIChangePasswordReq(pybind11::object & parent);
-void generate_class_TapAPIQuoteLoginAuth(pybind11::object & parent);
-void generate_class_TapAPIQuotLoginRspInfo(pybind11::object & parent);
-void generate_class_TapAPIQuoteCommodityInfo(pybind11::object & parent);
-void generate_class_TapAPIQuoteContractInfo(pybind11::object & parent);
-void generate_class_TapAPIQuoteWhole(pybind11::object & parent);
-void generate_class_ITapQuoteAPINotify(pybind11::object & parent);
-void generate_class_ITapQuoteAPI(pybind11::object & parent);
-void generate_vntap_classes(pybind11::module & parent);
-void generate_vntap_enums(pybind11::module & parent);
-void generate_vntap_functions_0(pybind11::module & parent);
-void generate_vntap_functions(pybind11::module & parent);
-void generate_vntap_variables(pybind11::module & parent);
-void generate_vntap_typedefs(pybind11::module & parent);
-void generate_caster_(pybind11::object & parent);
-void generate_vntap_caster(pybind11::module & parent);
-
-


cmd/gc: change compile error to "use of package %S without selector"

At present, when a package identifier is used outside of a selector expression, gc gives the error "use of package %S outside selector". However, in the selector expression x.f, the spec defines f as the selector. This change makes the error clearer.

Fixes issue 7133.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://codereview.appspot.com/50060047

Committer: Russ Cox <5ad239cb8a44f659eaaee0aa1ea5b94947abe557@golang.org>

--- src/cmd/gc/typecheck.c
+++ src/cmd/gc/typecheck.c
@@ -368,7 +368,7 @@
 		goto ret;

 	case OPACK:
-		yyerror("use of package %S not in selector", n->sym);
+		yyerror("use of package %S without selector", n->sym);
 		goto error;

 	case ODDD:


Resolve CancelIoEx() on first use to avoid _HS_INIT()

--- libhs/src/device_win32.c
+++ libhs/src/device_win32.c
@@ -31,17 +31,10 @@

 typedef BOOL WINAPI CancelIoEx_func(HANDLE hFile, LPOVERLAPPED lpOverlapped);

-static CancelIoEx_func *CancelIoEx_;
+static BOOL WINAPI CancelIoEx_resolve(HANDLE hFile, LPOVERLAPPED lpOverlapped);
+static CancelIoEx_func *CancelIoEx_ = CancelIoEx_resolve;

 #define READ_BUFFER_SIZE 16384
-
-_HS_INIT()
-{
-    HMODULE h = LoadLibrary("kernel32.dll");
-    assert(h);
-
-    CancelIoEx_ = (CancelIoEx_func *)GetProcAddress(h, "CancelIoEx");
-}

 static int open_win32_device(hs_device *dev, hs_handle_mode mode, hs_handle **rh)
 {
@@ -164,6 +157,12 @@
     return 0;
 }

+static BOOL WINAPI CancelIoEx_resolve(HANDLE hFile, LPOVERLAPPED lpOverlapped)
+{
+    CancelIoEx_ = (CancelIoEx_func *)GetProcAddress(LoadLibrary("kernel32.dll"), "CancelIoEx");
+    return CancelIoEx_(hFile, lpOverlapped);
+}
+
 static void close_win32_device(hs_handle *h)
 {
     if (h) {
@@ -171,7 +170,7 @@
         h->dev = NULL;

         if (h->pending_thread) {
-            if (CancelIoEx_) {
+            if (hs_win32_version() >= HS_WIN32_VERSION_VISTA) {
                 CancelIoEx_(h->handle, NULL);
             } else if (h->pending_thread == GetCurrentThreadId()) {
                 CancelIo(h->handle);


- extended comment

- extended comment

--- storage/Devices/Device.h
+++ storage/Devices/Device.h
@@ -57,7 +57,9 @@
     /// Also some devices do not have a intrinsic device name, e.g. btrfs.  We
     /// could even have objects for unused space, e.g. space between partitions
     /// or unallocated space of a volume group.
-
+    ///
+    /// Whenever possible use the storage id to find objects instead of
+    /// e.g. the name since only the storage id guarantees uniqueness.
     typedef unsigned int sid_t;


bplist: Improve parsing unicode nodes

bplist: Improve parsing unicode nodes

--- src/bplist.c
+++ src/bplist.c
@@ -92,22 +92,6 @@
     __p->__v;					  \
   })

-
-static void byte_convert(uint8_t * address, size_t size)
-{
-#ifdef __LITTLE_ENDIAN__
-    uint8_t i = 0, j = 0;
-    uint8_t tmp = 0;
-
-    for (i = 0; i < (size / 2); i++)
-    {
-        tmp = address[i];
-        j = ((size - 1) + 0) - i;
-        address[i] = address[j];
-        address[j] = tmp;
-    }
-#endif
-}

 #ifndef bswap16
 #define bswap16(x)   ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))
@@ -353,19 +337,22 @@

     data->type = PLIST_STRING;
     unicodestr = (uint16_t*) malloc(sizeof(uint16_t) * size);
-    memcpy(unicodestr, *bnode, sizeof(uint16_t) * size);
     for (i = 0; i < size; i++)
-        byte_convert((uint8_t *) (unicodestr + i), sizeof(uint16_t));
+        unicodestr[i] = be16toh(((uint16_t*)*bnode)[i]);

     tmpstr = plist_utf16_to_utf8(unicodestr, size, &items_read, &items_written);
     free(unicodestr);
+    if (!tmpstr) {
+        plist_free_data(data);
+        return NULL;
+    }
+    tmpstr[items_written] = '\0';

     data->type = PLIST_STRING;
-    data->strval = (char *) malloc(sizeof(char) * (items_written + 1));
-    memcpy(data->strval, tmpstr, items_written);
-    data->strval[items_written] = '\0';
-    data->length = strlen(data->strval);
-    free(tmpstr);
+    data->strval = realloc(tmpstr, items_written+1);
+    if (!data->strval)
+        data->strval = tmpstr;
+    data->length = items_written;
     return node_create(NULL, data);
 }