Added disassembly support

Added disassembly support


radv: fix cik macroModeIndex.

radv: fix cik macroModeIndex.

This just a CIK fix ported from radeonsi.

Tested-by: Kai Wasserbäch <31ea678c44dc4e8e22ccfd165592dd71a30e46ae@dev.carbon-project.org>
Reviewed-by: Edward O'Callaghan <b035da0d7e151e09fe2005f3a7bc526beb9b3245@folklore1984.net>
Reviewed-by: Bas Nieuwenhuizen <1d31d94f30d40df7951505d1034e1e923d02ec49@basnieuwenhuizen.nl>
Cc: "13.0 17.0" <59f39c0db42d4479a46b02d4d2bc11120e37bb44@lists.freedesktop.org>
Signed-off-by: Dave Airlie <f2295d84e358395675bc8031be58672073ae065e@redhat.com>

--- src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.c
+++ src/amd/vulkan/winsys/amdgpu/radv_amdgpu_surface.c
@@ -274,6 +274,19 @@
 		surf->micro_tile_mode = G_009910_MICRO_TILE_MODE(tile_mode);
 }

+static unsigned cik_get_macro_tile_index(struct radeon_surf *surf)
+{
+	unsigned index, tileb;
+
+	tileb = 8 * 8 * surf->bpe;
+	tileb = MIN2(surf->tile_split, tileb);
+
+	for (index = 0; tileb > 64; index++)
+		tileb >>= 1;
+
+	assert(index < 16);
+	return index;
+}

 static int radv_amdgpu_winsys_surface_init(struct radeon_winsys *_ws,
 					   struct radeon_surf *surf)
@@ -435,6 +448,7 @@
 				AddrSurfInfoIn.tileIndex = 10; /* 2D displayable */
 			else
 				AddrSurfInfoIn.tileIndex = 14; /* 2D non-displayable */
+			AddrSurfInfoOut.macroModeIndex = cik_get_macro_tile_index(surf);
 		}
 	}


Split function. Fixes mark tracking timings at clip boundaries.

--- src/libbluray/bluray.c
+++ src/libbluray/bluray.c
@@ -1912,19 +1912,7 @@
 static int _bd_read(BLURAY *bd, unsigned char *buf, int len)
 {
     BD_STREAM *st = &bd->st0;
-    int out_len;
-
-    if (st->fp) {
-        out_len = 0;
-        BD_DEBUG(DBG_STREAM, "Reading [%d bytes] at %"PRIu64"...\n", len, bd->s_pos);
-
-        if (st->clip == NULL) {
-            // We previously reached the last clip.  Nothing
-            // else to read.
-            _queue_event(bd, BD_EVENT_END_OF_TITLE, 0);
-            bd->end_of_playlist |= 1;
-            return 0;
-        }
+    int out_len = 0;

         while (len > 0) {
             uint32_t clip_pkt;
@@ -2058,18 +2046,38 @@
             bd->s_pos += size;
         }

-        /* mark tracking */
-        if (bd->next_mark >= 0 && bd->s_pos > bd->next_mark_pos) {
-            _playmark_reached(bd);
-        }
-
         BD_DEBUG(DBG_STREAM, "%d bytes read OK!\n", out_len);
         return out_len;
-    }
-
-    BD_DEBUG(DBG_STREAM | DBG_CRIT, "bd_read(): no valid title selected!\n");
-
-    return -1;
+}
+
+static int _bd_read_locked(BLURAY *bd, unsigned char *buf, int len)
+{
+    BD_STREAM *st = &bd->st0;
+    int r;
+
+    if (!st->fp) {
+        BD_DEBUG(DBG_STREAM | DBG_CRIT, "bd_read(): no valid title selected!\n");
+        return -1;
+    }
+
+    if (st->clip == NULL) {
+        // We previously reached the last clip.  Nothing
+        // else to read.
+        _queue_event(bd, BD_EVENT_END_OF_TITLE, 0);
+        bd->end_of_playlist |= 1;
+        return 0;
+    }
+
+    BD_DEBUG(DBG_STREAM, "Reading [%d bytes] at %"PRIu64"...\n", len, bd->s_pos);
+
+    r = _bd_read(bd, buf, len);
+
+    /* mark tracking */
+    if (bd->next_mark >= 0 && bd->s_pos > bd->next_mark_pos) {
+        _playmark_reached(bd);
+    }
+
+    return r;
 }

 int bd_read(BLURAY *bd, unsigned char *buf, int len)
@@ -2077,7 +2085,7 @@
     int result;

     bd_mutex_lock(&bd->mutex);
-    result = _bd_read(bd, buf, len);
+    result = _bd_read_locked(bd, buf, len);
     bd_mutex_unlock(&bd->mutex);

     return result;
@@ -3548,7 +3556,7 @@
         }
     }

-    int bytes = _bd_read(bd, buf, len);
+    int bytes = _bd_read_locked(bd, buf, len);

     if (bytes == 0) {


Update version to 2.5.4, we now have symbols for the crashreports

--- src/libclient/client.h
+++ src/libclient/client.h
@@ -95,7 +95,7 @@
      */
     static const quint32 versionMajor = 2;
     static const quint32 versionMinor = 5;
-    static const quint32 versionPatch = 3;
+    static const quint32 versionPatch = 4;

 public slots:
     bool init();


1.3.10 release build fixed

1.3.10 release build fixed


fixed overflow bug with clang in elina_int.h

--- elina_linearize/elina_int.h
+++ elina_linearize/elina_int.h
@@ -76,26 +76,7 @@
 /* mpz -> elina_int */
 static inline bool elina_int_set_mpz(elina_int_t *a, mpz_t b)
 {
-    int sgn;
-    size_t count;
-    unsigned long int tab[2];
-
-    sgn = mpz_sgn(b);
-    mpz_export(&tab,&count,1,sizeof(long int),0,0,b);
-    if (count==0){
-      *a = 0;
-    }
-    else {
-      *a = tab[0];
-      if (count==2){
-	*a = *a << (sizeof(long int)*8);
-	*a = *a + (long long int)(tab[1]);
-	if (*a<0){
-	  assert(0);
-	}
-      }
-      if (sgn<0) *a = -(*a);
-    }
+   *a = mpz_get_si(b);
   return true;
 }

@@ -141,15 +122,7 @@

 static inline bool mpz_set_elina_int(mpz_t a, elina_int_t b)
 {
-    unsigned long long int n;
-    unsigned long int rep[2];
-
-    n = llabs(b);
-    rep[1] = n & ULONG_MAX;
-    rep[0] = n >> (sizeof(long int)*8);
-    mpz_import(a,2,1,sizeof(unsigned long int),0,0,rep);
-    if (b<0)
-      mpz_neg(a,a);
+  mpz_set_si(a,b);
   return true;
 }


Add a 'conj()' test for sparse matrix/dense vector multiplications ('smatdvecmult')

--- blazetest/blazetest/mathtest/smatdvecmult/OperationTest.h
+++ blazetest/blazetest/mathtest/smatdvecmult/OperationTest.h
@@ -151,6 +151,7 @@
    template< typename T > void testScaledOperation   ( T scalar );
                           void testTransposeOperation();
                           void testAbsOperation      ();
+                          void testConjOperation     ();
                           void testEvalOperation     ();
                           void testSerialOperation   ();
                           void testSubvectorOperation();
@@ -291,6 +292,7 @@
    testScaledOperation( 2.0 );
    testTransposeOperation();
    testAbsOperation();
+   testConjOperation();
    testEvalOperation();
    testSerialOperation();
    testSubvectorOperation();
@@ -2751,6 +2753,288 @@

 //*************************************************************************************************
+/*!\brief Testing the conj sparse matrix/dense vector multiplication.
+//
+// \return void
+// \exception std::runtime_error Multiplication error detected.
+//
+// This function tests the conj matrix/vector multiplication with plain assignment, addition
+// assignment, subtraction assignment, and multiplication assignment. In case any error
+// resulting from the multiplication or the subsequent assignment is detected, a
+// \a std::runtime_error exception is thrown.
+*/
+template< typename MT    // Type of the left-hand side sparse matrix
+        , typename VT >  // Type of the right-hand side dense vector
+void OperationTest<MT,VT>::testConjOperation()
+{
+#if BLAZETEST_MATHTEST_TEST_CONJ_OPERATION
+   if( BLAZETEST_MATHTEST_TEST_CONJ_OPERATION > 1 )
+   {
+      //=====================================================================================
+      // Conj multiplication
+      //=====================================================================================
+
+      // Conj multiplication with the given matrix/vector
+      {
+         test_  = "Conj multiplication with the given matrix/vector";
+         error_ = "Failed multiplication operation";
+
+         try {
+            initResults();
+            dres_   = conj( lhs_ * rhs_ );
+            sres_   = conj( lhs_ * rhs_ );
+            refres_ = conj( reflhs_ * refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT>( ex );
+         }
+
+         checkResults<MT>();
+
+         try {
+            initResults();
+            dres_   = conj( olhs_ * rhs_ );
+            sres_   = conj( olhs_ * rhs_ );
+            refres_ = conj( reflhs_ * refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<TMT>( ex );
+         }
+
+         checkResults<TMT>();
+      }
+
+      // Conj multiplication with evaluated matrix/vector
+      {
+         test_  = "Conj multiplication with evaluated matrix/vector";
+         error_ = "Failed multiplication operation";
+
+         try {
+            initResults();
+            dres_   = conj( eval( lhs_ ) * eval( rhs_ ) );
+            sres_   = conj( eval( lhs_ ) * eval( rhs_ ) );
+            refres_ = conj( eval( reflhs_ ) * eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT>( ex );
+         }
+
+         checkResults<MT>();
+
+         try {
+            initResults();
+            dres_   = conj( eval( olhs_ ) * eval( rhs_ ) );
+            sres_   = conj( eval( olhs_ ) * eval( rhs_ ) );
+            refres_ = conj( eval( reflhs_ ) * eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<TMT>( ex );
+         }
+
+         checkResults<TMT>();
+      }
+
+
+      //=====================================================================================
+      // Conj multiplication with addition assignment
+      //=====================================================================================
+
+      // Conj multiplication with addition assignment with the given matrix/vector
+      {
+         test_  = "Conj multiplication with addition assignment with the given matrix/vector";
+         error_ = "Failed addition assignment operation";
+
+         try {
+            initResults();
+            dres_   += conj( lhs_ * rhs_ );
+            sres_   += conj( lhs_ * rhs_ );
+            refres_ += conj( reflhs_ * refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT>( ex );
+         }
+
+         checkResults<MT>();
+
+         try {
+            initResults();
+            dres_   += conj( olhs_ * rhs_ );
+            sres_   += conj( olhs_ * rhs_ );
+            refres_ += conj( reflhs_ * refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<TMT>( ex );
+         }
+
+         checkResults<TMT>();
+      }
+
+      // Conj multiplication with addition assignment with evaluated matrix/vector
+      {
+         test_  = "Conj multiplication with addition assignment with evaluated matrix/vector";
+         error_ = "Failed addition assignment operation";
+
+         try {
+            initResults();
+            dres_   += conj( eval( lhs_ ) * eval( rhs_ ) );
+            sres_   += conj( eval( lhs_ ) * eval( rhs_ ) );
+            refres_ += conj( eval( reflhs_ ) * eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT>( ex );
+         }
+
+         checkResults<MT>();
+
+         try {
+            initResults();
+            dres_   += conj( eval( olhs_ ) * eval( rhs_ ) );
+            sres_   += conj( eval( olhs_ ) * eval( rhs_ ) );
+            refres_ += conj( eval( reflhs_ ) * eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<TMT>( ex );
+         }
+
+         checkResults<TMT>();
+      }
+
+
+      //=====================================================================================
+      // Conj multiplication with subtraction assignment
+      //=====================================================================================
+
+      // Conj multiplication with subtraction assignment with the given matrix/vector
+      {
+         test_  = "Conj multiplication with subtraction assignment with the given matrix/vector";
+         error_ = "Failed subtraction assignment operation";
+
+         try {
+            initResults();
+            dres_   -= conj( lhs_ * rhs_ );
+            sres_   -= conj( lhs_ * rhs_ );
+            refres_ -= conj( reflhs_ * refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT>( ex );
+         }
+
+         checkResults<MT>();
+
+         try {
+            initResults();
+            dres_   -= conj( olhs_ * rhs_ );
+            sres_   -= conj( olhs_ * rhs_ );
+            refres_ -= conj( reflhs_ * refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<TMT>( ex );
+         }
+
+         checkResults<TMT>();
+      }
+
+      // Conj multiplication with subtraction assignment with evaluated matrix/vector
+      {
+         test_  = "Conj multiplication with subtraction assignment with evaluated matrix/vector";
+         error_ = "Failed subtraction assignment operation";
+
+         try {
+            initResults();
+            dres_   -= conj( eval( lhs_ ) * eval( rhs_ ) );
+            sres_   -= conj( eval( lhs_ ) * eval( rhs_ ) );
+            refres_ -= conj( eval( reflhs_ ) * eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT>( ex );
+         }
+
+         checkResults<MT>();
+
+         try {
+            initResults();
+            dres_   -= conj( eval( olhs_ ) * eval( rhs_ ) );
+            sres_   -= conj( eval( olhs_ ) * eval( rhs_ ) );
+            refres_ -= conj( eval( reflhs_ ) * eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<TMT>( ex );
+         }
+
+         checkResults<TMT>();
+      }
+
+
+      //=====================================================================================
+      // Conj multiplication with multiplication assignment
+      //=====================================================================================
+
+      // Conj multiplication with multiplication assignment with the given matrix/vector
+      {
+         test_  = "Conj multiplication with multiplication assignment with the given matrix/vector";
+         error_ = "Failed multiplication assignment operation";
+
+         try {
+            initResults();
+            dres_   *= conj( lhs_ * rhs_ );
+            sres_   *= conj( lhs_ * rhs_ );
+            refres_ *= conj( reflhs_ * refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT>( ex );
+         }
+
+         checkResults<MT>();
+
+         try {
+            initResults();
+            dres_   *= conj( olhs_ * rhs_ );
+            sres_   *= conj( olhs_ * rhs_ );
+            refres_ *= conj( reflhs_ * refrhs_ );
+         }
+         catch( std::exception& ex ) {
+            convertException<TMT>( ex );
+         }
+
+         checkResults<TMT>();
+      }
+
+      // Conj multiplication with multiplication assignment with evaluated matrix/vector
+      {
+         test_  = "Conj multiplication with multiplication assignment with evaluated matrix/vector";
+         error_ = "Failed multiplication assignment operation";
+
+         try {
+            initResults();
+            dres_   *= conj( eval( lhs_ ) * eval( rhs_ ) );
+            sres_   *= conj( eval( lhs_ ) * eval( rhs_ ) );
+            refres_ *= conj( eval( reflhs_ ) * eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<MT>( ex );
+         }
+
+         checkResults<MT>();
+
+         try {
+            initResults();
+            dres_   *= conj( eval( olhs_ ) * eval( rhs_ ) );
+            sres_   *= conj( eval( olhs_ ) * eval( rhs_ ) );
+            refres_ *= conj( eval( reflhs_ ) * eval( refrhs_ ) );
+         }
+         catch( std::exception& ex ) {
+            convertException<TMT>( ex );
+         }
+
+         checkResults<TMT>();
+      }
+   }
+#endif
+}
+//*************************************************************************************************
+
+
+//*************************************************************************************************
 /*!\brief Testing the evaluated sparse matrix/dense vector multiplication.
 //
 // \return void


Fix an include guard issue: "ENGINE" was missing from there

--- engine/gameprojectprivate.h
+++ engine/gameprojectprivate.h
@@ -18,8 +18,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */

-#ifndef GLUON_GAMEPROJECTPRIVATE_H
-#define GLUON_GAMEPROJECTPRIVATE_H
+#ifndef GLUON_ENGINE_GAMEPROJECTPRIVATE_H
+#define GLUON_ENGINE_GAMEPROJECTPRIVATE_H

 #include "assets/graphics/texture/textureasset.h"

@@ -61,4 +61,4 @@
     };
 }

-#endif // GLUON_GAMEPROJECTPRIVATE_H
+#endif // GLUON_ENGINE_GAMEPROJECTPRIVATE_H


DPRINTF takes a TCHAR * when it is a warnPrintf in disguise

thus, it requires usage of a TEXT macro to enable -DUNICODE compilation

--- platforms/win32/plugins/SoundPlugin/sqWin32Sound.c
+++ platforms/win32/plugins/SoundPlugin/sqWin32Sound.c
@@ -72,7 +72,7 @@

 sqInt
 soundShutdown(void) {
-  DPRINTF(("soundShutDown\n"));
+  DPRINTF((TEXT("soundShutDown\n")));
   snd_StopPlaying();
   snd_StopRecording();
   CloseHandle(hPlayEvent);
@@ -84,7 +84,7 @@
 snd_StopPlaying(void) {
   playTerminate = 0;
   if(lpdPlayBuffer) {
-    DPRINTF(("Shutting down DSound\n"));
+    DPRINTF((TEXT("Shutting down DSound\n")));
     IDirectSoundBuffer_Stop(lpdPlayBuffer);
     IDirectSoundBuffer_Release(lpdPlayBuffer);
     lpdPlayBuffer = NULL;
@@ -115,7 +115,7 @@
     if(WaitForSingleObject(hPlayEvent, INFINITE) == WAIT_OBJECT_0) {
       if(playTerminate) {
 	hPlayThread = NULL;
-	DPRINTF(("playCallback shutdown\n"));
+	DPRINTF((TEXT("playCallback shutdown\n")));
 	snd_StopPlaying();
 	return 0; /* done playing */
       }
@@ -170,7 +170,7 @@
   if(bytesWritten < playBufferSize)
     return 0;

-  DPRINTF(("[%d", frameCount));
+  DPRINTF((TEXT("[%d"), frameCount));

   hRes = IDirectSoundBuffer_Lock(lpdPlayBuffer,
 				 playBufferSize * playBufferIndex,
@@ -179,7 +179,7 @@
 				 NULL, NULL,
 				 0);
   if(FAILED(hRes)) {
-    DPRINTF(("snd_Play: IDirectSoundBuffer_Lock failed (errCode: %x)\n", hRes));
+    DPRINTF((TEXT("snd_Play: IDirectSoundBuffer_Lock failed (errCode: %x)\n"), hRes));
     return 0;
   }
   /* mix in stuff */
@@ -188,13 +188,13 @@
     short *shortSrc = (short*)(((char*)srcBufPtr)+startIndex);
     short *shortDst = (short*)dstPtr;
     dstLen /=2;
-    DPRINTF(("|%d", dstLen));
+    DPRINTF((TEXT("|%d"), dstLen));
     for(i=0;i<dstLen;i++) {
       *shortDst++ = *(shortSrc++);
     }
   }
   IDirectSoundBuffer_Unlock(lpdPlayBuffer, dstPtr, dstLen, NULL, 0);
-  DPRINTF(("]"));
+  DPRINTF((TEXT("]")));
   playBufferAvailable = 0;
   return bytesWritten / waveOutFormat.nBlockAlign;
 }
@@ -220,7 +220,7 @@
      (samplesPerSec != waveOutFormat.nSamplesPerSec) ||
      ((stereo == 0) != (waveOutFormat.nChannels == 1))) {
     /* format change */
-    DPRINTF(("DXSound format change (%d, %d, %s)\n", frameCount, samplesPerSec, (stereo ? "stereo" : "mono")));
+    DPRINTF((TEXT("DXSound format change (%d, %d, %s)\n"), frameCount, samplesPerSec, (stereo ? "stereo" : "mono")));
     snd_StopPlaying();
   }

@@ -228,27 +228,27 @@
     /* keep playing */
     playTerminate = 0;
     playSemaphore = semaIndex; /* might have changed */
-    DPRINTF(("Continuing DSound\n"));
+    DPRINTF((TEXT("Continuing DSound\n")));
     return 1;
   }

-  DPRINTF(("Starting DSound\n"));
+  DPRINTF((TEXT("Starting DSound\n")));
   if(!lpdSound) {
     /* Initialize DirectSound */
-    DPRINTF(("# Creating lpdSound\n"));
+    DPRINTF((TEXT("# Creating lpdSound\n")));
     hRes = CoCreateInstance(&CLSID_DirectSound,
 			    NULL,
 			    CLSCTX_INPROC_SERVER,
 			    &IID_IDirectSound,
 			    (void**)&lpdSound);
     if(FAILED(hRes)) {
-      DPRINTF(("sndStart: CoCreateInstance() failed (errCode: %x)\n", hRes));
+      DPRINTF((TEXT("sndStart: CoCreateInstance() failed (errCode: %x)\n"), hRes));
       return 0;
     }
-    DPRINTF(("# Initializing lpdSound\n"));
+    DPRINTF((TEXT("# Initializing lpdSound\n")));
     hRes = IDirectSound_Initialize(lpdSound, NULL);
     if(FAILED(hRes)) {
-      DPRINTF(("sndStart: IDirectSound_Initialize() failed (errCode: %x)\n", hRes));
+      DPRINTF((TEXT("sndStart: IDirectSound_Initialize() failed (errCode: %x)\n"), hRes));
       IDirectSound_Release(lpdSound);
       lpdSound = NULL;
       return 0;
@@ -256,17 +256,17 @@
     /* set the cooperative level (DSSCL_PRIORITY is recommended) */
     hRes = IDirectSound_SetCooperativeLevel(lpdSound, stWindow, DSSCL_PRIORITY);
     if(FAILED(hRes)) {
-      DPRINTF(("sndStart: IDirectSound_SetCooperativeLevel failed (errCode: %x)\n", hRes));
+      DPRINTF((TEXT("sndStart: IDirectSound_SetCooperativeLevel failed (errCode: %x)\n"), hRes));
       /* for now don't fail because of lack in cooperation */
     }
     /* grab the primary sound buffer for handling format changes */
     ZeroMemory(&dsbd, sizeof(dsbd));
     dsbd.dwSize = sizeof(dsbd);
     dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER;
-    DPRINTF(("# Creating primary buffer\n"));
+    DPRINTF((TEXT("# Creating primary buffer\n")));
     hRes = IDirectSound_CreateSoundBuffer(lpdSound, &dsbd, &lpdPrimaryBuffer, NULL);
     if(FAILED(hRes)) {
-      DPRINTF(("sndStart: Failed to create primary buffer (errCode: %x)\n", hRes));
+      DPRINTF((TEXT("sndStart: Failed to create primary buffer (errCode: %x)\n"), hRes));
       snd_StopPlaying();
       return 0;
     }
@@ -276,7 +276,7 @@

   if(!hPlayThread) {
     /* create the playback notification thread */
-    DPRINTF(("# Creating playback thread\n"));
+    DPRINTF((TEXT("# Creating playback thread\n")));
     hPlayThread = CreateThread(NULL, 0, playCallback, NULL, 0, &threadID);
     if(hPlayThread == 0) {
       printLastError(TEXT("sndStart: CreateThread failed"));
@@ -315,14 +315,14 @@
   if(lpdPrimaryBuffer) {
     hRes = IDirectSoundBuffer_SetFormat(lpdPrimaryBuffer, &waveOutFormat);
     if(FAILED(hRes)) {
-      DPRINTF(("sndStart: Failed to set primary buffer format (errCode: %x)\n", hRes));
-    }
-  }
-
-  DPRINTF(("# Creating play buffer\n"));
+      DPRINTF((TEXT("sndStart: Failed to set primary buffer format (errCode: %x)\n"), hRes));
+    }
+  }
+
+  DPRINTF((TEXT("# Creating play buffer\n")));
   hRes = IDirectSound_CreateSoundBuffer(lpdSound, &dsbd, &lpdPlayBuffer, NULL);
   if(FAILED(hRes)) {
-    DPRINTF(("sndStart: IDirectSound_CreateSoundBuffer() failed (errCode: %x)\n", hRes));
+    DPRINTF((TEXT("sndStart: IDirectSound_CreateSoundBuffer() failed (errCode: %x)\n"), hRes));
     snd_StopPlaying();
     /* and try again */
     return 0;
@@ -333,7 +333,7 @@
 					   &IID_IDirectSoundNotify,
 					   (void**)&lpdNotify );
   if(FAILED(hRes)) {
-    DPRINTF(("sndStart: QueryInterface(IDirectSoundNotify) failed (errCode: %x)\n"));
+    DPRINTF((TEXT("sndStart: QueryInterface(IDirectSoundNotify) failed (errCode: %x)\n")));
     snd_StopPlaying();
     return 0;
   }
@@ -341,19 +341,19 @@
   posNotify[1].dwOffset = 2 * playBufferSize - 1;
   posNotify[0].hEventNotify = hPlayEvent;
   posNotify[1].hEventNotify = hPlayEvent;
-  DPRINTF(("# Setting notifications\n"));
+  DPRINTF((TEXT("# Setting notifications\n")));
   hRes = IDirectSoundNotify_SetNotificationPositions(lpdNotify, 2, posNotify);
   IDirectSoundNotify_Release(lpdNotify);
   if(FAILED(hRes)) {
-    DPRINTF(("sndStart: IDirectSoundNotify_SetNotificationPositions() failed (errCode: %x)\n", hRes));
+    DPRINTF((TEXT("sndStart: IDirectSoundNotify_SetNotificationPositions() failed (errCode: %x)\n"), hRes));
     snd_StopPlaying();
     return 0;
   }

-  DPRINTF(("# Starting to play buffer\n"));
+  DPRINTF((TEXT("# Starting to play buffer\n")));
   hRes = IDirectSoundBuffer_Play(lpdPlayBuffer, 0, 0, DSBPLAY_LOOPING);
   if(FAILED(hRes)) {
-    DPRINTF(("sndStart: IDirectSoundBuffer_Play() failed (errCode: %x)\n", hRes));
+    DPRINTF((TEXT("sndStart: IDirectSoundBuffer_Play() failed (errCode: %x)\n"), hRes));
     snd_StopPlaying();
     return 0;
   }
@@ -393,12 +393,12 @@
 			    &IID_IDirectSoundCapture,
 			    (void**)&lpdCapture);
     if(FAILED(hRes)) {
-      DPRINTF(("snd_StartRec: CoCreateInstance() failed (errCode: %x)\n", hRes));
+      DPRINTF((TEXT("snd_StartRec: CoCreateInstance() failed (errCode: %x)\n"), hRes));
       return 0;
     }
     hRes = IDirectSoundCapture_Initialize(lpdCapture, NULL);
     if(FAILED(hRes)) {
-      DPRINTF(("snd_StartRec: IDirectSoundCapture_Initialize() failed (errCode: %x)\n", hRes));
+      DPRINTF((TEXT("snd_StartRec: IDirectSoundCapture_Initialize() failed (errCode: %x)\n"), hRes));
       lpdCapture = NULL;
       return 0;
     }
@@ -436,14 +436,14 @@
   dscb.lpwfxFormat = &waveInFormat;
   hRes = IDirectSoundCapture_CreateCaptureBuffer(lpdCapture, &dscb, &lpdRecBuffer, NULL);
   if(FAILED(hRes)) {
-    DPRINTF(("snd_StartRec: IDirectSoundCapture_CreateCaptureBuffer() failed (errCode: %x)\n", hRes));
+    DPRINTF((TEXT("snd_StartRec: IDirectSoundCapture_CreateCaptureBuffer() failed (errCode: %x)\n"), hRes));
     return 0;
   }
   hRes = IDirectSoundCaptureBuffer_QueryInterface(lpdRecBuffer,
 						  &IID_IDirectSoundNotify,
 						  (void**)&lpdNotify );
   if(FAILED(hRes)) {
-    DPRINTF(("snd_StartRec: QueryInterface(IDirectSoundNotify) failed (errCode: %x)\n"));
+    DPRINTF((TEXT("snd_StartRec: QueryInterface(IDirectSoundNotify) failed (errCode: %x)\n")));
     snd_StopRecording();
     return 0;
   }
@@ -454,13 +454,13 @@
   hRes = IDirectSoundNotify_SetNotificationPositions(lpdNotify, 2, posNotify);
   IDirectSoundNotify_Release(lpdNotify);
   if(FAILED(hRes)) {
-    DPRINTF(("snd_StartRec: IDirectSoundNotify_SetNotificationPositions() failed (errCode: %x)\n", hRes));
+    DPRINTF((TEXT("snd_StartRec: IDirectSoundNotify_SetNotificationPositions() failed (errCode: %x)\n"), hRes));
     snd_StopRecording();
     return 0;
   }
   hRes = IDirectSoundCaptureBuffer_Start(lpdRecBuffer, DSCBSTART_LOOPING);
   if(FAILED(hRes)) {
-    DPRINTF(("snd_StartRec: IDirectSoundCaptureBuffer_Start() failed (errCode: %x)\n", hRes));
+    DPRINTF((TEXT("snd_StartRec: IDirectSoundCaptureBuffer_Start() failed (errCode: %x)\n"), hRes));
     snd_StopRecording();
     return 0;
   }
@@ -530,7 +530,7 @@
 					NULL, NULL,
 					0);
   if(FAILED(hRes)) {
-    DPRINTF(("snd_Rec: IDirectSoundCaptureBuffer_Lock() failed (errCode: %x)\n", hRes));
+    DPRINTF((TEXT("snd_Rec: IDirectSoundCaptureBuffer_Lock() failed (errCode: %x)\n"), hRes));
     return 0;
   }

@@ -544,7 +544,7 @@
 					  srcPtr, srcLen,
 					  NULL, 0);
   if(FAILED(hRes)) {
-    DPRINTF(("snd_Rec: IDirectSoundCaptureBuffer_Unlock() failed (errCode: %x)\n", hRes));
+    DPRINTF((TEXT("snd_Rec: IDirectSoundCaptureBuffer_Unlock() failed (errCode: %x)\n"), hRes));
   }

   return bytesCopied / bytesPerSlice;


Undef win32 macros

Undef win32 macros

--- numba/_npymath_exports.c
+++ numba/_npymath_exports.c
@@ -13,12 +13,18 @@

 /* Missing math function on windows */
 #ifdef _WIN32
+    /* undef windows macros for the following */
+    #undef ldexpf
+    #undef frexpf
+
+    static
     float ldexpf(float x, int exp) {
-        return ldexp(x, exp);
-    }
-
+        return (float)ldexp(x, exp);
+    }
+
+    static
     float frexpf(float x, int *exp) {
-        return frexp(x, exp)
+        return (float)frexp(x, exp)
     }
 #endif /* WIN32 */


Ooops... last version of file was still in editor

git-svn-id: 9a9f2b9a3306a16adcf4bb38886fa4400f789efe@5271 42af7a65-404d-4744-a932-0658087f49c3

--- nuttx/lib/math/lib_exp.c
+++ nuttx/lib/math/lib_exp.c
@@ -32,6 +32,7 @@
 #include <nuttx/config.h>
 #include <nuttx/compiler.h>

+#include <sys/types.h>
 #include <math.h>

 #include "lib_internal.h"


doc fix

doc fix

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

--- ode/include/ode/config.h
+++ ode/include/ode/config.h
@@ -41,8 +41,10 @@

 /* if we're compiling on a pentium, we may need to know the clock rate so
- * that the timing function can report accurate times. i have not worked
- * out how to determine this automatically yet.
+ * that the timing function can report accurate times. this number only needs
+ * to be set accurately if we're doing performance tests - otherwise just
+ * ignore this. i have not worked out how to determine this number
+ * automatically yet.
  */

 #ifdef PENTIUM


Fix erroneous time zone conversion in osync_time_unix2vtime and osync_time_tm2unix

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

--- opensync/opensync_time.c
+++ opensync/opensync_time.c
@@ -245,10 +245,7 @@
 	char *vtime;
 	struct tm utc;

-	/* FIXME Find conversion problem from vtime to unixtime and change then to gmtime_r().
-	   (There is a probelm when converting from vtime to unixstamp and back. The result will be a wrong offset) */
-//	gmtime_r(timestamp, &utc);
-	localtime_r(timestamp, &utc);
+	gmtime_r(timestamp, &utc);
 	vtime = osync_time_tm2vtime(&utc, TRUE);

 	osync_trace(TRACE_EXIT, "%s: %s", __func__, vtime);
@@ -267,7 +264,7 @@

 	memcpy(tmp, tmtime, sizeof(struct tm));

-	timestamp = mktime(tmp);
+	timestamp = timegm(tmp);

 	g_free(tmp);


Kinematic bodies should not have sleeping info updated.

--- src/cpSpaceComponent.c
+++ src/cpSpaceComponent.c
@@ -241,6 +241,9 @@
 		for(int i=0; i<bodies->num; i++){
 			cpBody *body = (cpBody*)bodies->arr[i];

+			// TODO should make a separate array for kinematic bodies.
+			if(cpBodyGetType(body) != CP_BODY_TYPE_DYNAMIC) continue;
+
 			// Need to deal with infinite mass objects
 			cpFloat keThreshold = (dvsq ? body->m*dvsq : 0.0f);
 			body->sleeping.idleTime = (cpBodyKineticEnergy(body) > keThreshold ? 0.0f : body->sleeping.idleTime + dt);


Drafts now avoid collision between to osmosis working concurrently on the same object store with pid as the prefix

--- cpp/Osmosis/ObjectStore/Drafts.h
+++ cpp/Osmosis/ObjectStore/Drafts.h
@@ -1,6 +1,7 @@
 #ifndef __OSMOSIS_OBJECT_STORE_DRAFTS_H__
 #define __OSMOSIS_OBJECT_STORE_DRAFTS_H__

+#include <boost/algorithm/string/predicate.hpp>
 #include <mutex>

 namespace Osmosis {
@@ -12,7 +13,8 @@
 public:
 	Drafts( const boost::filesystem::path & rootPath ) :
 		_draftsPath( rootPath / DirectoryNames::DRAFTS ),
-		_counter( 0 )
+		_counter( 0 ),
+		_pidPrefix(pidPrefix())
 	{
 		if ( not boost::filesystem::is_directory( _draftsPath ) )
 			boost::filesystem::create_directories( _draftsPath );
@@ -21,8 +23,17 @@

 	void cleanUp()
 	{
+		std::time_t now = std::time(nullptr);
 		for ( auto i = boost::filesystem::directory_iterator( _draftsPath );
 				i != boost::filesystem::directory_iterator(); ++ i ) {
+			if ( not boost::starts_with( i->path().filename().string(), _pidPrefix ) ) {
+				if ( boost::filesystem::last_write_time( i->path() ) + SAFE_TO_ERASE_FROM_ANOTHER_PID > now ) {
+					TRACE_WARNING( "Will not erase a leftover draft from another PID " << i->path() );
+					continue;
+				}
+				TRACE_WARNING( "Erasing a leftover draft from another PID " << i->path() );
+
+			}
 			bool removed = boost::filesystem::remove( i->path() );
 			if ( not removed )
 				TRACE_ERROR( "File was removed under my feet " << i->path() );
@@ -45,7 +56,7 @@
 			++ _counter;
 			value = _counter;
 		}
-		return std::move( _draftsPath / std::to_string( value ) );
+		return std::move( _draftsPath / ( _pidPrefix + std::to_string( value ) ) );
 	}

 	boost::filesystem::path path() const
@@ -54,9 +65,17 @@
 	}

 private:
-	boost::filesystem::path _draftsPath;
-	size_t _counter;
-	std::mutex _counterLock;
+	enum { SAFE_TO_ERASE_FROM_ANOTHER_PID = 60 * 60 };
+
+	boost::filesystem::path  _draftsPath;
+	size_t                   _counter;
+	std::mutex               _counterLock;
+	std::string              _pidPrefix;
+
+	static std::string pidPrefix()
+	{
+		return std::to_string(getpid()) + ".";
+	}

 	Drafts( const Drafts & rhs ) = delete;
 	Drafts & operator= ( const Drafts & rhs ) = delete;


Only disable asserts for bootloader

Only disable asserts for bootloader

Asserts can be disabled to save space. This should only apply to the
bootloader since the interface has enough space for asserts.

--- source/daplink/util.h
+++ source/daplink/util.h
@@ -42,7 +42,7 @@
 uint32_t util_div_round_down(uint32_t dividen, uint32_t divisor);
 uint32_t util_div_round(uint32_t dividen, uint32_t divisor);

-#if !defined(DAPLINK_NO_ASSERT_FILENAMES)
+#if !(defined(DAPLINK_NO_ASSERT_FILENAMES) && defined(DAPLINK_BL))
 // With the filename enabled.
 #define util_assert(expression) _util_assert((expression), __FILE__, __LINE__)
 #else


Better error message on invalid funnel bundles

--- src/s6-rc/s6-rc-compile.c
+++ src/s6-rc/s6-rc-compile.c
@@ -539,7 +539,7 @@
     info = genalloc_s(nameinfo_t, &nameinfo) + id ;
   }
   if (info->type != SVTYPE_LONGRUN)
-    strerr_dief5x(1, "pipeline ", data.s + recinfo->pipelinename, " includes service ", name, " which is not a longrun") ;
+    strerr_dief6x(1, "pipeline ", data.s + recinfo->pipelinename, " includes service ", name, " of type ", typestr(info->type)) ;
   if (recinfo->bundle.n++ >= recinfo->nlong)
     strerr_dief4x(1, "pipeline ", data.s + recinfo->pipelinename, " is too long: possible loop involving ", name) ;
   if (verbosity >= 4)


tubes-channel: emit NewChannel when we create a new incoming muc stream tube

--- src/salut-tubes-channel.c
+++ src/salut-tubes-channel.c
@@ -49,6 +49,8 @@
 #include "salut-connection.h"
 #include "salut-contact.h"
 #include "salut-muc-channel.h"
+#include "salut-muc-manager.h"
+#include "salut-tubes-manager.h"
 #include "salut-xmpp-connection-manager.h"
 #include "tube-iface.h"
 #include "tube-dbus.h"
@@ -862,6 +864,21 @@

               tube = create_new_tube (self, type, initiator_handle, FALSE, service, parameters,
                   tube_id, 0, NULL);
+
+              if (type == TP_TUBE_TYPE_STREAM)
+                {
+                  /* FIXME: remove this test once D-Tube new API is
+                   * implemented */
+                  SalutMucManager *mgr;
+
+                  g_object_get (priv->conn, "muc-manager", &mgr, NULL);
+                  g_assert (mgr != NULL);
+
+                  tp_channel_manager_emit_new_channel (mgr,
+                      TP_EXPORTABLE_CHANNEL (tube), NULL);
+
+                  g_object_unref (mgr);
+                }

               /* the tube has reffed its initiator, no need to keep a ref */
               tp_handle_unref (contact_repo, initiator_handle);


GRU tokenizer early stopping now considers both sentence and token f1.

--- src/morphodita/tokenizer/gru_tokenizer_network_trainer.h
+++ src/morphodita/tokenizer/gru_tokenizer_network_trainer.h
@@ -118,8 +118,8 @@
   matrix_trainer<3, D> projection_fwd(this->projection_fwd), projection_bwd(this->projection_bwd);
   float learning_rate = learning_rate_initial, b1t = 1.f, b2t = 1.f;

-  float best_sentence_f1 = 0.f; unsigned best_sentence_f1_epoch = 0;
-  gru_tokenizer_network_trainer<D> best_sentence_f1_network;
+  float best_combined_f1 = 0.f; unsigned best_combined_f1_epoch = 0;
+  gru_tokenizer_network_trainer<D> best_combined_f1_network;

   size_t training_offset = 0, training_shift;
   vector<gru_tokenizer_network::char_info> training_input, instance_input(segment);
@@ -317,13 +317,13 @@
            << 100. * tokens.f1 << "%, sentences: " << 100. * sentences.precision << "%P/"
            << 100. * sentences.recall << "%R/" << 100. * sentences.f1 << "%";

-      if (early_stopping && sentences.f1 > best_sentence_f1) {
-        best_sentence_f1 = sentences.f1;
-        best_sentence_f1_epoch = epoch;
-        best_sentence_f1_network = *this;
-      }
-      if (early_stopping && best_sentence_f1 && epoch - best_sentence_f1_epoch > 30) {
-        cerr << endl << "Stopping after 30 iterations of not improving sentence f1." << endl;
+      if (early_stopping && sentences.f1 + tokens.f1 > best_combined_f1) {
+        best_combined_f1 = sentences.f1 + tokens.f1;
+        best_combined_f1_epoch = epoch;
+        best_combined_f1_network = *this;
+      }
+      if (early_stopping && best_combined_f1 && epoch - best_combined_f1_epoch > 30) {
+        cerr << endl << "Stopping after 30 iterations of not improving sum of sentence and token f1." << endl;
         break;
       }
     }
@@ -331,13 +331,13 @@
   }

   // Choose best network if desired
-  if (early_stopping && best_sentence_f1) {
-    cerr << "Choosing parameters from epoch " << best_sentence_f1_epoch+1 << "." << endl;
-    this->embeddings = best_sentence_f1_network.embeddings;
-    this->gru_fwd = best_sentence_f1_network.gru_fwd;
-    this->gru_bwd = best_sentence_f1_network.gru_bwd;
-    this->projection_fwd = best_sentence_f1_network.projection_fwd;
-    this->projection_bwd = best_sentence_f1_network.projection_bwd;
+  if (early_stopping && best_combined_f1) {
+    cerr << "Choosing parameters from epoch " << best_combined_f1_epoch+1 << "." << endl;
+    this->embeddings = best_combined_f1_network.embeddings;
+    this->gru_fwd = best_combined_f1_network.gru_fwd;
+    this->gru_bwd = best_combined_f1_network.gru_bwd;
+    this->projection_fwd = best_combined_f1_network.projection_fwd;
+    this->projection_bwd = best_combined_f1_network.projection_bwd;
   }

   // Encode the network


SalutTubesChannel: Add TargetID property

--- src/salut-tubes-channel.c
+++ src/salut-tubes-channel.c
@@ -95,6 +95,7 @@
   PROP_CONNECTION,
   PROP_MUC,
   PROP_INTERFACES,
+  PROP_TARGET_ID,
   LAST_PROPERTY
 };

@@ -239,6 +240,14 @@
           g_value_set_static_boxed (value, salut_tubes_channel_interfaces);
         else
           g_value_set_static_boxed (value, salut_tubes_channel_interfaces + 1);
+        break;
+      case PROP_TARGET_ID:
+        {
+           TpHandleRepoIface *repo = tp_base_connection_get_handles (
+             (TpBaseConnection *) priv->conn, priv->handle_type);
+
+           g_value_set_string (value, tp_handle_inspect (repo, priv->handle));
+        }
         break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -1786,6 +1795,7 @@
   static TpDBusPropertiesMixinPropImpl channel_props[] = {
       { "TargetHandleType", "handle-type", NULL },
       { "TargetHandle", "handle", NULL },
+      { "TargetID", "target-id", NULL },
       { "ChannelType", "channel-type", NULL },
       { "Interfaces", "interfaces", NULL },
       { NULL }
@@ -1817,6 +1827,13 @@
   g_object_class_override_property (object_class, PROP_HANDLE_TYPE,
       "handle-type");
   g_object_class_override_property (object_class, PROP_HANDLE, "handle");
+
+  param_spec = g_param_spec_string ("target-id", "Target JID",
+      "The string obtained by inspecting this channel's handle",
+      NULL,
+      G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK |
+      G_PARAM_STATIC_BLURB);
+  g_object_class_install_property (object_class, PROP_TARGET_ID, param_spec);

   param_spec = g_param_spec_object (
       "connection",


dfbtest_windows_watcher: fix warning

dfbtest_windows_watcher: fix warning

--- tests/dfbtest_windows_watcher.c
+++ tests/dfbtest_windows_watcher.c
@@ -79,7 +79,7 @@
      D_INFO( "  -> resource id  0x%016llx\n", (unsigned long long) info->resource_id );
      D_INFO( "  -> process id   %d\n", info->process_id );
      D_INFO( "  -> instance id  %d\n", info->instance_id );
-     D_INFO( "  -> state        0x%08x\n", info->state );
+     D_INFO( "  -> state        0x%08x\n", info->state.flags );

      dump_config( &info->config );
 }


Fixed potential bug in XHR callback

Fixed potential bug in XHR callback

git-svn-id: 33bf1455041ebe448dbaea643fd5b4b7ce02239d@2589 63c20433-aa62-49bd-875c-5a186b69a8fb

--- src/scenegraph/dom_smjs.c
+++ src/scenegraph/dom_smjs.c
@@ -2602,11 +2602,10 @@
 			break;
 		gf_sleep(1);
 	}
-
-	gf_sg_lock_javascript(ctx->c, 0);
-
 	/*if session not set, we've had an abort*/
 	if (!ctx->sess) return;
+
+	gf_sg_lock_javascript(ctx->c, 0);

 	switch (parameter->msg_type) {
 	case GF_NETIO_SETUP:


tests/gem_wait_rendering_timeout: make it compile

... we need to do this libdrm depency dance. Or just copy&paste it.

--- tests/gem_wait_render_timeout.c
+++ tests/gem_wait_render_timeout.c
@@ -52,6 +52,36 @@
 	return ret;
 }

+/* to avoid stupid depencies on libdrm, copy&paste */
+struct local_drm_i915_gem_wait {
+	/** Handle of BO we shall wait on */
+	__u32 bo_handle;
+	__u32 flags;
+	/** Number of nanoseconds to wait, Returns time remaining. */
+	__u64 timeout_ns;
+};
+
+# define WAIT_IOCTL DRM_IOWR(DRM_COMMAND_BASE + 0x2c, struct local_drm_i915_gem_wait)
+
+static int
+gem_bo_wait_timeout(int fd, uint32_t handle, uint64_t *timeout_ns)
+{
+	struct local_drm_i915_gem_wait wait;
+	int ret;
+
+	assert(timeout_ns);
+
+	wait.bo_handle = handle;
+	wait.timeout_ns = *timeout_ns;
+	wait.flags = 0;
+	ret = drmIoctl(fd, WAIT_IOCTL, &wait);
+	if (ret)
+		return ret;
+
+	*timeout_ns = wait.timeout_ns;
+
+	return ret;
+}

 static void blt_color_fill(struct intel_batchbuffer *batch,
 			   drm_intel_bo *buf,
@@ -128,7 +158,7 @@

 	intel_batchbuffer_flush(batch);

-	ret = drm_intel_gem_bo_wait(dst2, &timeout);
+	ret = gem_bo_wait_timeout(fd, dst2->handle, &timeout);
 	if (do_signals)
 		drmtest_stop_signal_helper();
 	if (ret) {


Fixed some configuration bug

Fixed some configuration bug

--- include/dma.h
+++ include/dma.h
@@ -151,12 +151,14 @@
 	bool incrementSource;
 	bool incrementDestination;
 	bool enableAA;
+
+	Dma_LinkCannel linkCh1;
+	Dma_LinkCannel linkCh2;
+
+#endif
+
 	uint8_t sourceModulo;
 	uint8_t destinationModulo;
-	Dma_LinkCannel linkCh1;
-	Dma_LinkCannel linkCh2;
-
-#endif

 	/* Source and destination data size */
     Dma_DataSize sSize;


Added status commands

Added status commands

--- include/hci.h
+++ include/hci.h
@@ -461,6 +461,37 @@
 /* Status params */
 #define OGF_STATUS_PARAM 	0x05

+#define OCF_READ_FAILED_CONTACT_COUNTER   0x0001
+typedef struct {
+	uint8_t 	status;
+	uint16_t	handle;
+	uint8_t 	counter;
+} __attribute__ ((packed)) read_failed_contact_counter_rp;
+#define READ_FAILED_CONTACT_COUNTER_RP_SIZE 4
+
+#define OCF_RESET_FAILED_CONTACT_COUNTER  0x0002
+typedef struct {
+	uint8_t 	status;
+	uint16_t	handle;
+} __attribute__ ((packed)) reset_failed_contact_counter_rp;
+#define OCF_RESET_FAILED_CONTACT_COUNTER_RP_SIZE 4
+
+#define OCF_GET_LINK_QUALITY   0x0003
+typedef struct {
+	uint8_t 	status;
+	uint16_t	handle;
+	uint8_t 	link_quality;
+} __attribute__ ((packed)) get_link_quality_rp;
+#define GET_LINK_QUALITY_RP_SIZE 4
+
+#define OCF_READ_RSSI  0x0005
+typedef struct {
+	uint8_t 	status;
+	uint16_t	handle;
+	uint8_t 	rssi;
+} __attribute__ ((packed)) read_rssi_rp;
+#define READ_RSSI_RP_SIZE 4
+
 /* ---- HCI Events ---- */
 #define EVT_INQUIRY_COMPLETE 	0x01


apage satanas! I would have preferred the static const, but vc6 is too dumb to accept the code; using an enum might seem strange, but it has actually becoem a widely-used idiom for defining integer contants in classes; the macro in the header file is evil, it pollutes the global namespace with a common word

git-svn-id: 609ac0b5210091cb75f7034bee43d3bb429ce1d9@1529 08b3d480-bf2c-0410-a26f-811ee3361c24

--- include/md5.h
+++ include/md5.h
@@ -63,8 +63,7 @@
   void init();
   typedef unsigned char uint1; //  8bit
   typedef unsigned int uint4;  // 32bit
-
-#define blocksize 64
+  enum {blocksize = 64}; // VC6 won't eat a const static int here

   void transform(const uint1 block[blocksize]);
   static void decode(uint4 output[], const uint1 input[], size_type len);


Fix PTE_ADDR to account for NX bit

Fix PTE_ADDR to account for NX bit

NX is the only high bit in a PTE, and we previously only masked out
the low bits.

--- include/mmu.h
+++ include/mmu.h
@@ -27,7 +27,7 @@
 #define PGOFFSET(a) ((a) & ((1<<PGSHIFT)-1))

 // Address in page table or page directory entry
-#define PTE_ADDR(pte)	((uptr)(pte) & ~0xFFF)
+#define PTE_ADDR(pte)	((uptr)(pte) & 0x7FFFFFFFFFFFF000u)

 #ifndef __ASSEMBLER__
 struct segdesc {


Capture and print error messages from llvm::verifyFunction

Signed-off-by: Nikos Armenatzoglou <e68f23697c56f18ab089b470c48a26160a94bb9c@gmail.com>

--- src/backend/codegen/include/codegen/base_codegen.h
+++ src/backend/codegen/include/codegen/base_codegen.h
@@ -24,6 +24,7 @@

 #include "llvm/IR/Function.h"
 #include "llvm/IR/Verifier.h"
+#include "llvm/Support/raw_ostream.h"

 namespace gpcodegen {
@@ -65,11 +66,15 @@
     if (codegen_validate_functions && valid_generated_functions) {
       for (llvm::Function* function : uncompiled_generated_functions_) {
         assert(nullptr != function);
+        std::string func_name = function->getName();
+        std::string error_message = "";
+        llvm::raw_string_ostream out(error_message);
         // Verify function returns true if there are errors.
-        valid_generated_functions &= !llvm::verifyFunction(*function);
+        valid_generated_functions &= !llvm::verifyFunction(*function, &out);
+        out.flush();
         if (!valid_generated_functions) {
-          std::string func_name = function->getName();
-          elog(WARNING, "Broken function found '%s'", func_name.c_str());
+          elog(WARNING, "Broken function found %s: %s",
+               func_name.c_str(), error_message.c_str());
           break;
         }
       }


pool: fix image pool to check for the video format to use.

Make gst_vaapi_image_pool_new() succeed, and thus returning a valid
image pool object, only if the underlying VA display does support the
requested VA image format.

--- gst-libs/gst/vaapi/gstvaapiimagepool.c
+++ gst-libs/gst/vaapi/gstvaapiimagepool.c
@@ -54,7 +54,7 @@
     pool->format = GST_VIDEO_INFO_FORMAT(vip);
     pool->width  = GST_VIDEO_INFO_WIDTH(vip);
     pool->height = GST_VIDEO_INFO_HEIGHT(vip);
-    return TRUE;
+    return gst_vaapi_display_has_image_format(base_pool->display, pool->format);
 }

 static gpointer


Added initial library for operating on data_channels

--- data_channel.c
+++ data_channel.c
@@ -14,61 +14,110 @@
 #include "log.h"
 #include "network.h"

-static uint8_t g_buf[1024];
-static uint8_t *const g_buf_end = g_buf + sizeof(g_buf) - 1;
+static uint8_t g_buf[2048];

-int status = 0;
+struct data_channel {
+    int conn;
+    FILE *file;
+    void (*process_cb)(struct data_channel *data_channel, void *arg);
+};
+
+static void
+exchange_params(struct data_channel *data_channel, void *arg)
+{
+    int msg_len = 0, retries = 0;
+
+    while (msg_len <= 0 && retries < 10) {
+        msg_len = network_tcp_receive(data_channel->conn, g_buf, sizeof(g_buf));
+        usleep(1000 * 25);
+        ++retries;
+    }
+
+    if (retries == 10) {
+        fprintf(stderr, "Couldn't receive scan params on data_channel %d\n", data_channel->conn);
+        goto err;
+    }
+
+    //TODO
+    abort();
+
+    data_channel->file = fopen("/tmp/scan.jpg", "ab");
+
+err:
+    fprintf(stderr, "Failed exchange scan params on data_channel %d\n", data_channel->conn);
+    abort();
+}
+
+static void
+init_connection(struct data_channel *data_channel, void *arg)
+{
+    int msg_len = 0, retries = 0;
+
+    while (msg_len <= 0 && retries < 10) {
+        msg_len = network_tcp_receive(data_channel->conn, g_buf, sizeof(g_buf));
+        usleep(1000 * 25);
+        ++retries;
+    }
+
+    if (retries == 10) {
+        fprintf(stderr, "Couldn't receive welcome message on data_channel %d\n", data_channel->conn);
+        goto err;
+    }
+
+    if (g_buf[0] != '+') {
+        fprintf(stderr, "Received invalid welcome message on data_channel %d\n", data_channel->conn);
+        hexdump("received message", g_buf, msg_len);
+        goto err;
+    }
+
+    msg_len = 0, retries = 0;
+    while (msg_len <= 0 && retries < 10) {
+        msg_len = network_tcp_send(data_channel->conn, "\x1b\x4b\x0a\x80", 4);
+        usleep(1000 * 25);
+        ++retries;
+    }
+
+    if (retries == 10) {
+        fprintf(stderr, "Couldn't send welcome message on data_channel %d\n", data_channel->conn);
+        goto err;
+    }
+
+    data_channel->process_cb = exchange_params;
+    return;
+
+err:
+    fprintf(stderr, "Failed to init data_channel %d\n", data_channel->conn);
+    abort();
+}

 static void
 data_channel_loop(void *arg1, void *arg2)
 {
-    int *conn = arg1;
-    int msg_len;
-
-    msg_len = network_tcp_receive(*conn, g_buf, 1024);
-    if (msg_len < 0) {
-        goto out;
-    }
-
-    if (status == 0) {
-        uint8_t a[] = { 0x1b, 0x4b, 0x0a, 0x80 };
-        msg_len = network_tcp_send(*conn, a, sizeof(a));
-    } else if (status == 1) {
-        uint8_t b[] = { 0x1b, 0x49, 0x0a, 0x52, 0x3d, 0x33, 0x30, 0x30, 0x2c, 0x33, 0x30, 0x30, 0x0a, 0x4d, 0x3d, 0x43, 0x47, 0x52, 0x41, 0x59, 0x0a, 0x44, 0x3d, 0x53, 0x49, 0x4e, 0x0a, 0x80 };
-        msg_len = network_tcp_send(*conn, b, sizeof(b));
-    } else if (status == 2) {
-        uint8_t c[] = { 0x1b, 0x58, 0x0a, 0x52, 0x3d, 0x33, 0x30, 0x30, 0x2c, 0x33, 0x30, 0x30, 0x0a, 0x4d, 0x3d, 0x43, 0x47, 0x52, 0x41, 0x59, 0x0a, 0x43, 0x3d, 0x4a, 0x50, 0x45, 0x47, 0x0a, 0x4a, 0x3d, 0x4d, 0x49, 0x4e, 0x0a, 0x42, 0x3d, 0x35, 0x30, 0x0a, 0x4e, 0x3d, 0x35, 0x30, 0x0a, 0x41, 0x3d, 0x30, 0x2c, 0x30, 0x2c, 0x32, 0x34, 0x36, 0x34, 0x2c, 0x33, 0x34, 0x38, 0x34, 0x0a, 0x44, 0x3d, 0x53, 0x49, 0x4e, 0x0a, 0x47, 0x3d, 0x31, 0x0a, 0x4c, 0x3d, 0x31, 0x32, 0x38, 0x0a, 0x80};
-        msg_len = network_tcp_send(*conn, c, sizeof(c));
-    } else {
-        goto out;
-    }
+    struct data_channel *data_channel = arg1;

-    if (msg_len < 0) {
-        perror("sendto");
-        goto out;
-    }
-
-    ++status;
-out:
-    usleep(500 * 1000);
+    data_channel->process_cb(data_channel, arg2);
 }

 static void
 data_channel_stop(void *arg1, void *arg2)
 {
-    int *conn = arg1;
+    struct data_channel *data_channel = arg1;

-    network_tcp_disconnect(*conn);
-    network_tcp_free(*conn);
+    if (data_channel->file) {
+        fclose(data_channel->file);
+    }

-    free(conn);
+    network_tcp_disconnect(data_channel->conn);
+    network_tcp_free(data_channel->conn);
+
+    free(data_channel);
 }

 void
 data_channel_create(uint16_t port)
 {
     int tid, conn;
-    int *conn_p;
+    struct data_channel *data_channel;

     conn = network_tcp_init_conn(htons(port), false);
     if (conn < 0) {
@@ -84,8 +133,10 @@

     tid = event_thread_create("data_channel");

-    conn_p = malloc(sizeof(conn));
-    *conn_p = conn;
-    event_thread_set_update_cb(tid, data_channel_loop, conn_p, NULL);
-    event_thread_set_stop_cb(tid, data_channel_stop, conn_p, NULL);
+    data_channel = calloc(1, sizeof(*data_channel));
+    data_channel->conn = conn;
+    data_channel->process_cb = init_connection;
+
+    event_thread_set_update_cb(tid, data_channel_loop, data_channel, NULL);
+    event_thread_set_stop_cb(tid, data_channel_stop, data_channel, NULL);
 }


attach to Planex and Corega Ethernet cards.

From NetBSD

ok deraadt@

--- dev/cardbus/if_rl_cardbus.c
+++ dev/cardbus/if_rl_cardbus.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: if_rl_cardbus.c,v 1.6 2004/04/07 15:47:52 mickey Exp $ */
+/*	$OpenBSD: if_rl_cardbus.c,v 1.7 2004/07/09 20:08:02 brad Exp $ */
 /*	$NetBSD: if_rl_cardbus.c,v 1.3.8.3 2001/11/14 19:14:02 nathanw Exp $	*/

 /*
@@ -100,7 +100,10 @@
 	{ CARDBUS_VENDOR_REALTEK, CARDBUS_PRODUCT_REALTEK_RT8138 },
 	{ CARDBUS_VENDOR_REALTEK, CARDBUS_PRODUCT_REALTEK_RT8139 },
 	{ CARDBUS_VENDOR_COREGA, CARDBUS_PRODUCT_COREGA_CB_TXD },
+	{ CARDBUS_VENDOR_COREGA, CARDBUS_PRODUCT_COREGA_2CB_TXD },
 	{ CARDBUS_VENDOR_DLINK, CARDBUS_PRODUCT_DLINK_DFE_690TXD },
+	{ CARDBUS_VENDOR_PLANEX, CARDBUS_PRODUCT_PLANEX_FNW_3603_TX },
+	{ CARDBUS_VENDOR_PLANEX, CARDBUS_PRODUCT_PLANEX_FNW_3800_TX },
 	{ 0, 0 }
 };


esp8266/modpybrtc: Simplify multiplication by fixed-point value.

--- esp8266/modpybrtc.c
+++ esp8266/modpybrtc.c
@@ -58,7 +58,7 @@
 }

 STATIC uint64_t pyb_rtc_raw_us(uint64_t cal) {
-    return system_get_rtc_time() * ((cal >> 12) * 1000 + (cal & 0xfff) / 4) / 1000;
+    return (system_get_rtc_time() * cal) >> 12;
 };

 void pyb_rtc_set_us_since_2000(uint64_t nowus) {


Doxygen documentation in csps-query-still

--- src/csps-query-still.h
+++ src/csps-query-still.h
@@ -127,6 +127,19 @@
     Header - Function prototypes
  */

+    /*! \brief CSPS query - Still - Handle
+     *
+     *  This function is a front-end to lp_query_still_create function that
+     *  takes advantage of the origin directive introduced in topology. It
+     *  retrieves the module and device name and tag declared as still-range
+     *  origin in the topology in order to call lp_query_still_create. It then
+     *  returns the created query structure on still-range.
+     *
+     *  \param  lpPath Path to CSPS structure
+     *
+     *  \return Created query structure
+     */
+
     lp_Still_t lp_query_still_origin(

         lp_Char_t const * const lpPath


Clarifying documentation of assignTransitionProbability.

git-svn-id: a7f2a8f7432d210e972fb03898013d213e2b549b@11654 e6417c60-b987-48fd-844e-b20f0fcc1017

--- seqan/core/include/seqan/graph_types/graph_impl_hmm.h
+++ seqan/core/include/seqan/graph_types/graph_impl_hmm.h
@@ -844,7 +844,7 @@
 /**
 .Function.assignTransitionProbability:
 ..cat:Graph
-..summary:Assigns a new transition probability.
+..summary:Assigns a new transition probability to an existing edge.
 ..signature:assignTransitionProbability(g, s1, s2, prob)
 ..param.g:A HMM.
 ...type:Spec.Hmm


fs-rtp-substream: Don't leak caps on error

Based on patch from Havard Graff

--- gst/fsrtpconference/fs-rtp-substream.c
+++ gst/fsrtpconference/fs-rtp-substream.c
@@ -1332,6 +1332,8 @@
   else
     fs_session_emit_error (FS_SESSION (substream->priv->session),
         FS_ERROR_CONSTRUCTION, error->message);
+  if (caps)
+    gst_caps_unref (caps);

   goto out;
 }


r300/compiler: Don't continue copy propagation inside loops.

--- src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
+++ src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
@@ -162,6 +162,11 @@
 	for(struct rc_instruction * inst = inst_mov->Next;
 	    inst != &c->Program.Instructions;
 	    inst = inst->Next) {
+		/* XXX In the future we might be able to make the optimizer
+		 * smart enough to handle loops. */
+		if(inst->U.I.Opcode == RC_OPCODE_BGNLOOP){
+			return;
+		}
 		rc_for_all_reads_mask(inst, peephole_scan_read, &s);
 		rc_for_all_writes_mask(inst, peephole_scan_write, &s);
 		if (s.Conflict)


DataLab Version 1.4.0 (Final)

DataLab Version 1.4.0 (Final)

	total ops: 137->116
	ilog2    : 48 -> 27

--- datalab/bits.c
+++ datalab/bits.c
@@ -258,30 +258,18 @@
  */
 int ilog2(int x) {
     int result = x;
-    int num;
-    result = result | (result >> 1);
-    result = result | (result >> 2);
-    result = result | (result >> 4);
-    result = result | (result >> 8);
-    result = result | (result >> 16);
-    num = (85 << 8) + 85;
-    num = (num << 16) + num;
-    result = (result & num) + ((result >> 1) & num);
-    num = (51 << 8) + 51;
-    num = (num << 16) + num;
-    result = (result & num) + ((result >> 2) & num);
-
-    num = (15 << 8) + 15;
-    num = (num << 16) + num;
-    result = (result & num) + ((result >> 4) & num);
-    num = (255 << 16) + 255;
-    result = (result & num) + ((result >> 8) & num);
-    num = (255 << 8) + 255;
-    result = (result & num) + ((result >> 16) & num);
-
-
-    return result + (~0);
-}
+    int num = 0;
+    num = ((!!(result >> 16)) << 4);
+    result = x >> num;
+    num = num + ((!!(result >> 8)) << 3);
+    result = x >> num;
+    num = num + ((!!(result >> 4)) << 2);
+    result = x >> num;
+    num = num + ((!!(result >> 2)) << 1);
+    result = x >> num;
+    return num + (!!(result >> 1)) ;
+}
+
 /*
  * float_half - Return bit-level equivalent of expression 0.5*f for
  *   floating point argument f.


proper implementations of Get[Compressed]TexImage functions

--- crserverlib/server_getteximage.c
+++ crserverlib/server_getteximage.c
@@ -6,25 +6,61 @@

 #include "chromium.h"
 #include "cr_error.h"
+#include "cr_mem.h"
+#include "cr_pixeldata.h"
 #include "server_dispatch.h"
 #include "server.h"

-void SERVER_DISPATCH_APIENTRY crServerDispatchGetTexImage( GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels )
+void SERVER_DISPATCH_APIENTRY
+crServerDispatchGetTexImage(GLenum target, GLint level, GLenum format,
+														GLenum type, GLvoid * pixels)
 {
-	crError( "glGetTexImage isn't *ever* allowed to be on the wire!" );
-	(void) target;
-	(void) level;
-	(void) format;
-	(void) type;
-	(void) pixels;
+	GLsizei width, height, depth, size;
+	GLvoid *buffer;
+
+	cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width);
+	cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height);
+	cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth);
+
+	size = crTextureSize(format, type, width, height, depth);
+
+	if (size && (buffer = crAlloc(size))) {
+		/* Note, the other pixel PACK parameters (default values) should
+		 * be OK at this point.
+		 */
+		cr_server.head_spu->dispatch_table.PixelStorei(GL_PACK_ALIGNMENT, 1);
+		cr_server.head_spu->dispatch_table.GetTexImage(target, level, format,
+																									 type, buffer);
+		crServerReturnValue( buffer, size );
+		crFree(buffer);
+	}
+	else {
+		crServerReturnValue( buffer, 0 );
+	}
 }

-void SERVER_DISPATCH_APIENTRY crServerDispatchGetCompressedTexImageARB( GLenum target, GLint level, GLvoid *img )
+#if CR_ARB_texture_compression
+
+void SERVER_DISPATCH_APIENTRY
+crServerDispatchGetCompressedTexImageARB(GLenum target, GLint level,
+																				 GLvoid *img)
 {
-	crError( "glGetCompressedTexImageARB isn't *ever* allowed to be on the wire!" );
-	(void) target;
-	(void) level;
-	(void) img;
+	GLint size;
+	GLvoid *buffer;
+
+	cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &size);
+
+	if (size && (buffer = crAlloc(size))) {
+		/* XXX the pixel PACK parameter should be OK at this point */
+		cr_server.head_spu->dispatch_table.GetCompressedTexImageARB(target, level,
+																																buffer);
+		crServerReturnValue( buffer, size );
+		crFree(buffer);
+	}
+	else {
+		crServerReturnValue( buffer, 0 );
+	}
 }

+#endif /* CR_ARB_texture_compression */


hm i wonder

hm i wonder

--- year3/cis2750/a1/src/CalendarParser.c
+++ year3/cis2750/a1/src/CalendarParser.c
@@ -374,7 +374,7 @@
             }

             tempProperty = initializeProperty(*tempStorage, otherTempStorage);
-            insertFront(&tempAlarm->properties, (void *)tempProperty);
+            insertFront(&tempAlarm->properties, tempProperty);
             tempSize = 0;
             tempCount = 0;
             memset(tempStorage, '\0', 1000);


include crm.h

include crm.h

--- src/default_lowlevel.h
+++ src/default_lowlevel.h
@@ -36,6 +36,8 @@
 #ifndef LOWLEVEL_H
 #define LOWLEVEL_H

+#include "crm.h"
+
 #define trim_xtal() pack_XTAL_CNTL(CTUNE_4PF, CTUNE, FTUNE, IBIAS);
 void default_vreg_init(void);
 void uart1_init(uint16_t inc, uint16_t mod, uint8_t samp);


added rdp_mcs.c

added rdp_mcs.c

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

--- rdp/rdp_mcs.c
+++ rdp/rdp_mcs.c
@@ -0,0 +1,549 @@
+/*
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+   xrdp: A Remote Desktop Protocol server.
+   Copyright (C) Jay Sorg 2005
+
+   librdp mcs layer
+
+*/
+
+#include "rdp.h"
+
+/*****************************************************************************/
+struct rdp_mcs* APP_CC
+rdp_mcs_create(struct rdp_sec* owner,
+               struct stream* client_mcs_data,
+               struct stream* server_mcs_data)
+{
+  struct rdp_mcs* self;
+
+  self = (struct rdp_mcs*)g_malloc(sizeof(struct rdp_mcs), 1);
+  self->sec_layer = owner;
+  self->userid = 1;
+  self->chanid = 1001;
+  self->client_mcs_data = client_mcs_data;
+  self->server_mcs_data = server_mcs_data;
+  self->iso_layer = rdp_iso_create(self);
+  return self;
+}
+
+/*****************************************************************************/
+void APP_CC
+rdp_mcs_delete(struct rdp_mcs* self)
+{
+  if (self == 0)
+  {
+    return;
+  }
+  rdp_iso_delete(self->iso_layer);
+  g_free(self);
+}
+
+/*****************************************************************************/
+/* returns error */
+int APP_CC
+rdp_mcs_recv(struct rdp_mcs* self, struct stream* s, int* chan)
+{
+  int appid;
+  int opcode;
+  int len;
+
+  if (rdp_iso_recv(self->iso_layer, s) != 0)
+  {
+    return 1;
+  }
+  in_uint8(s, opcode);
+  appid = opcode >> 2;
+  if (appid != MCS_SDIN)
+  {
+    return 1;
+  }
+  in_uint8s(s, 5);
+  in_uint8(s, len);
+  if (len & 0x80)
+  {
+    in_uint8s(s, 1);
+  }
+  return 0;
+}
+
+/*****************************************************************************/
+/* returns error */
+static int APP_CC
+rdp_mcs_ber_out_header(struct rdp_mcs* self, struct stream* s,
+                        int tag_val, int len)
+{
+  if (tag_val > 0xff)
+  {
+    out_uint16_be(s, tag_val);
+  }
+  else
+  {
+    out_uint8(s, tag_val);
+  }
+  if (len >= 0x80)
+  {
+    out_uint8(s, 0x82);
+    out_uint16_be(s, len);
+  }
+  else
+  {
+    out_uint8(s, len);
+  }
+  return 0;
+}
+
+/*****************************************************************************/
+/* returns error */
+static int APP_CC
+rdp_mcs_ber_out_int8(struct rdp_mcs* self, struct stream* s, int value)
+{
+  rdp_mcs_ber_out_header(self, s, BER_TAG_INTEGER, 1);
+  out_uint8(s, value);
+  return 0;
+}
+
+/*****************************************************************************/
+/* returns error */
+#if 0
+static int APP_CC
+rdp_mcs_ber_out_int16(struct rdp_mcs* self, struct stream* s, int value)
+{
+  rdp_mcs_ber_out_header(self, s, BER_TAG_INTEGER, 2);
+  out_uint8(s, (value >> 8));
+  out_uint8(s, value);
+  return 0;
+}
+#endif
+
+/*****************************************************************************/
+/* returns error */
+static int APP_CC
+rdp_mcs_ber_out_int24(struct rdp_mcs* self, struct stream* s, int value)
+{
+  rdp_mcs_ber_out_header(self, s, BER_TAG_INTEGER, 3);
+  out_uint8(s, (value >> 16));
+  out_uint8(s, (value >> 8));
+  out_uint8(s, value);
+  return 0;
+}
+
+/*****************************************************************************/
+/* returns error */
+static int APP_CC
+rdp_mcs_out_domain_params(struct rdp_mcs* self, struct stream* s,
+                           int max_channels,
+                           int max_users, int max_tokens,
+                           int max_pdu_size)
+{
+  rdp_mcs_ber_out_header(self, s, MCS_TAG_DOMAIN_PARAMS, 26);
+  rdp_mcs_ber_out_int8(self, s, max_channels);
+  rdp_mcs_ber_out_int8(self, s, max_users);
+  rdp_mcs_ber_out_int8(self, s, max_tokens);
+  rdp_mcs_ber_out_int8(self, s, 1);
+  rdp_mcs_ber_out_int8(self, s, 0);
+  rdp_mcs_ber_out_int8(self, s, 1);
+  rdp_mcs_ber_out_int24(self, s, max_pdu_size);
+  rdp_mcs_ber_out_int8(self, s, 2);
+  return 0;
+}
+
+/*****************************************************************************/
+/* returns error */
+static int APP_CC
+rdp_mcs_send_connection_initial(struct rdp_mcs* self)
+{
+  int data_len;
+  int len;
+  struct stream* s;
+
+  make_stream(s);
+  init_stream(s, 8192);
+  data_len = self->server_mcs_data->end - self->server_mcs_data->data;
+  len = 7 + 3 * 34 + 4 + data_len;
+  if (rdp_iso_init(self->iso_layer, s) != 0)
+  {
+    free_stream(s);
+    return 1;
+  }
+  rdp_mcs_ber_out_header(self, s, MCS_CONNECT_INITIAL, len);
+  rdp_mcs_ber_out_header(self, s, BER_TAG_OCTET_STRING, 0); /* calling domain */
+  rdp_mcs_ber_out_header(self, s, BER_TAG_OCTET_STRING, 0); /* called domain */
+  rdp_mcs_ber_out_header(self, s, BER_TAG_BOOLEAN, 1);
+  out_uint8(s, 0xff); /* upward flag */
+  rdp_mcs_out_domain_params(self, s, 2, 2, 0, 0xffff); /* target params */
+  rdp_mcs_out_domain_params(self, s, 1, 1, 1, 0x420); /* min params */
+  rdp_mcs_out_domain_params(self, s, 0xffff, 0xfc17, 0xffff, 0xffff); /* max params */
+  rdp_mcs_ber_out_header(self, s, BER_TAG_OCTET_STRING, data_len);
+  out_uint8p(s, self->server_mcs_data->data, data_len);
+  s_mark_end(s);
+  if (rdp_iso_send(self->iso_layer, s) != 0)
+  {
+    free_stream(s);
+    return 1;
+  }
+  free_stream(s);
+  return 0;
+}
+
+/*****************************************************************************/
+/* returns error */
+static int APP_CC
+rdp_mcs_ber_parse_header(struct rdp_mcs* self, struct stream* s,
+                         int tag_val, int* len)
+{
+  int tag;
+  int l;
+  int i;
+
+  if (tag_val > 0xff)
+  {
+    in_uint16_be(s, tag);
+  }
+  else
+  {
+    in_uint8(s, tag);
+  }
+  if (tag != tag_val)
+  {
+    return 1;
+  }
+  in_uint8(s, l);
+  if (l & 0x80)
+  {
+    l = l & ~0x80;
+    *len = 0;
+    while (l > 0)
+    {
+      in_uint8(s, i);
+      *len = (*len << 8) | i;
+      l--;
+    }
+  }
+  else
+  {
+    *len = l;
+  }
+  if (s_check(s))
+  {
+    return 0;
+  }
+  else
+  {
+    return 1;
+  }
+}
+
+/*****************************************************************************/
+/* returns error */
+static int APP_CC
+rdp_mcs_parse_domain_params(struct rdp_mcs* self, struct stream* s)
+{
+  int len;
+
+  if (rdp_mcs_ber_parse_header(self, s, MCS_TAG_DOMAIN_PARAMS, &len) != 0)
+  {
+    return 1;
+  }
+  in_uint8s(s, len);
+  if (s_check(s))
+  {
+    return 0;
+  }
+  else
+  {
+    return 1;
+  }
+}
+
+/*****************************************************************************/
+/* returns error */
+static int APP_CC
+rdp_mcs_recv_connection_response(struct rdp_mcs* self)
+{
+  int len;
+  int res;
+  struct stream* s;
+
+  make_stream(s);
+  init_stream(s, 8192);
+  if (rdp_iso_recv(self->iso_layer, s) != 0)
+  {
+    free_stream(s);
+    return 1;
+  }
+  rdp_mcs_ber_parse_header(self, s, MCS_CONNECT_RESPONSE, &len);
+  rdp_mcs_ber_parse_header(self, s, BER_TAG_RESULT, &len);
+  in_uint8(s, res);
+  if (res != 0)
+  {
+    free_stream(s);
+    return 1;
+  }
+  rdp_mcs_ber_parse_header(self, s, BER_TAG_INTEGER, &len);
+  in_uint8s(s, len); /* connect id */
+  rdp_mcs_parse_domain_params(self, s);
+  rdp_mcs_ber_parse_header(self, s, BER_TAG_OCTET_STRING, &len);
+  if (len > self->client_mcs_data->size)
+  {
+    len = self->client_mcs_data->size;
+  }
+  in_uint8a(s, self->client_mcs_data->data, len);
+  self->client_mcs_data->p = self->client_mcs_data->data;
+  self->client_mcs_data->end = self->client_mcs_data->data + len;
+  if (s_check_end(s))
+  {
+    free_stream(s);
+    return 0;
+  }
+  else
+  {
+    free_stream(s);
+    return 1;
+  }
+}
+
+/*****************************************************************************/
+/* returns error */
+static int APP_CC
+rdp_mcs_send_edrq(struct rdp_mcs* self)
+{
+  struct stream* s;
+
+  make_stream(s);
+  init_stream(s, 8192);
+  if (rdp_iso_init(self->iso_layer, s) != 0)
+  {
+    free_stream(s);
+    return 1;
+  }
+  out_uint8(s, (MCS_EDRQ << 2));
+  out_uint16_be(s, 0x100); /* height */
+  out_uint16_be(s, 0x100); /* interval */
+  s_mark_end(s);
+  if (rdp_iso_send(self->iso_layer, s) != 0)
+  {
+    free_stream(s);
+    return 1;
+  }
+  free_stream(s);
+  return 0;
+}
+
+/*****************************************************************************/
+/* returns error */
+static int APP_CC
+rdp_mcs_send_aurq(struct rdp_mcs* self)
+{
+  struct stream* s;
+
+  make_stream(s);
+  init_stream(s, 8192);
+  if (rdp_iso_init(self->iso_layer, s) != 0)
+  {
+    free_stream(s);
+    return 1;
+  }
+  out_uint8(s, (MCS_AURQ << 2));
+  s_mark_end(s);
+  if (rdp_iso_send(self->iso_layer, s) != 0)
+  {
+    free_stream(s);
+    return 1;
+  }
+  free_stream(s);
+  return 0;
+}
+
+/*****************************************************************************/
+/* returns error */
+static int APP_CC
+rdp_mcs_recv_aucf(struct rdp_mcs* self)
+{
+  int opcode;
+  int res;
+  struct stream* s;
+
+  make_stream(s);
+  init_stream(s, 8192);
+  if (rdp_iso_recv(self->iso_layer, s) != 0)
+  {
+    free_stream(s);
+    return 1;
+  }
+  in_uint8(s, opcode);
+  if ((opcode >> 2) != MCS_AUCF)
+  {
+    free_stream(s);
+    return 1;
+  }
+  in_uint8(s, res);
+  if (res != 0)
+  {
+    free_stream(s);
+    return 1;
+  }
+  if (opcode & 2)
+  {
+    in_uint16_be(s, self->userid);
+  }
+  if (!(s_check_end(s)))
+  {
+    free_stream(s);
+    return 1;
+  }
+  free_stream(s);
+  return 0;
+}
+
+/*****************************************************************************/
+/* returns error */
+static int APP_CC
+rdp_mcs_send_cjrq(struct rdp_mcs* self, int chanid)
+{
+  struct stream* s;
+
+  make_stream(s);
+  init_stream(s, 8192);
+  if (rdp_iso_init(self->iso_layer, s) != 0)
+  {
+    free_stream(s);
+    return 1;
+  }
+  out_uint8(s, (MCS_CJRQ << 2));
+  out_uint16_be(s, self->userid);
+  out_uint16_be(s, chanid);
+  s_mark_end(s);
+  if (rdp_iso_send(self->iso_layer, s) != 0)
+  {
+    free_stream(s);
+    return 1;
+  }
+  free_stream(s);
+  return 0;
+}
+
+/*****************************************************************************/
+/* returns error */
+static int APP_CC
+rdp_mcs_recv_cjcf(struct rdp_mcs* self)
+{
+  int opcode;
+  int res;
+  struct stream* s;
+
+  make_stream(s);
+  init_stream(s, 8192);
+  if (rdp_iso_recv(self->iso_layer, s) != 0)
+  {
+    free_stream(s);
+    return 1;
+  }
+  in_uint8(s, opcode);
+  if ((opcode >> 2) != MCS_CJCF)
+  {
+    free_stream(s);
+    return 1;
+  }
+  in_uint8(s, res);
+  if (res != 0)
+  {
+    free_stream(s);
+    return 1;
+  }
+  in_uint8s(s, 4); /* mcs_userid, req_chanid */
+  if (opcode & 2)
+  {
+    in_uint8s(s, 2); /* join_chanid */
+    in_uint8s(s, self->userid);
+  }
+  if (!(s_check_end(s)))
+  {
+    free_stream(s);
+    return 1;
+  }
+  free_stream(s);
+  return 0;
+}
+
+/*****************************************************************************/
+/* returns error */
+int APP_CC
+rdp_mcs_connect(struct rdp_mcs* self, char* ip, char* port)
+{
+  if (rdp_iso_connect(self->iso_layer, ip, port) != 0)
+  {
+    return 1;
+  }
+  rdp_mcs_send_connection_initial(self);
+  if (rdp_mcs_recv_connection_response(self) != 0)
+  {
+    rdp_iso_disconnect(self->iso_layer);
+    return 1;
+  }
+  rdp_mcs_send_edrq(self);
+  rdp_mcs_send_aurq(self);
+  if (rdp_mcs_recv_aucf(self) != 0)
+  {
+    rdp_iso_disconnect(self->iso_layer);
+    return 1;
+  }
+  rdp_mcs_send_cjrq(self, self->userid + 1001);
+  if (rdp_mcs_recv_cjcf(self) != 0)
+  {
+    rdp_iso_disconnect(self->iso_layer);
+    return 1;
+  }
+  rdp_mcs_send_cjrq(self, MCS_GLOBAL_CHANNEL);
+  if (rdp_mcs_recv_cjcf(self) != 0)
+  {
+    rdp_iso_disconnect(self->iso_layer);
+    return 1;
+  }
+  return 0;
+}
+
+/*****************************************************************************/
+/* returns error */
+int APP_CC
+rdp_mcs_init(struct rdp_mcs* self, struct stream* s)
+{
+  rdp_iso_init(self->iso_layer, s);
+  s_push_layer(s, mcs_hdr, 8);
+  return 0;
+}
+
+/*****************************************************************************/
+/* returns error */
+int APP_CC
+rdp_mcs_send(struct rdp_mcs* self, struct stream* s)
+{
+  int len;
+
+  s_pop_layer(s, mcs_hdr);
+  len = (s->end - s->p) - 8;
+  len = len | 0x8000;
+  out_uint8(s, MCS_SDRQ << 2);
+  out_uint16_be(s, self->userid);
+  out_uint16_be(s, MCS_GLOBAL_CHANNEL);
+  out_uint8(s, 0x70);
+  out_uint16_be(s, len);
+  if (rdp_iso_send(self->iso_layer, s) != 0)
+  {
+    return 1;
+  }
+  return 0;
+}


Correctly mark pair for sweeping

Correctly mark pair for sweeping

The flag needs to be OR'ed, ANDing causes head.bits to be cleared.

Fixes:

zsx@touchsmart-arch:~/work/r3-build$ ./r3-core pair.r
r3-core: /mnt/work/r3.git/make/../src/include/sys-value.h:171: VAL_TYPE_Debug: Assertion `v->header.bits & CELL_MASK' failed.
Aborted (core dumped)
zsx@touchsmart-arch:~/work/r3-build$ cat pair.r
REBOL []
recycle/torture
i: 1x1
add i 100x200

--- src/core/m-gc.c
+++ src/core/m-gc.c
@@ -918,7 +918,7 @@
             REBVAL *key = PAIRING_KEY(val->payload.pair);
             Init_Header_Aliased( // will be read via REBSER
                 &key->header,
-                key->header.bits & REBSER_REBVAL_FLAG_MARK
+                key->header.bits | REBSER_REBVAL_FLAG_MARK
             );
             break; }


Removed extra new-lines

Removed extra new-lines


Correct "notorious TCP bug"

Correct "notorious TCP bug"

--- src/core/m-gc.c
+++ src/core/m-gc.c
@@ -151,6 +151,8 @@
 /*
 ***********************************************************************/
 {
+	REBREQ *req;
+
 	if (
 		   IS_EVENT_MODEL(value, EVM_PORT)
 		|| IS_EVENT_MODEL(value, EVM_OBJECT)
@@ -166,15 +168,14 @@
 		// not be in VAL_EVENT_SER of the REBEVT structure.  It is held
 		// indirectly by the REBREQ ->req field of the event, which
 		// in turn possibly holds a singly linked list of other requests.
-		REBREQ *req = VAL_EVENT_REQ(value);
-
-		// The ->next field of a REBREQ is just used while it's in the
-		// device's ->pending list, and is set to 0 by Detach_Request
-		ASSERT(req->next == NULL, RP_MISC);
-
-		// The ->port field of the REBREQ is void*, so we must cast
-		// Comment says it is "link back to REBOL port object"
-		CHECK_MARK((REBSER*)req->port, depth);
+		req = VAL_EVENT_REQ(value);
+
+		while(req) {
+			// The ->port field of the REBREQ is void*, so we must cast
+			// Comment says it is "link back to REBOL port object"
+			CHECK_MARK((REBSER*)req->port, depth);
+			req = req->next;
+		}
 	}
 }


Fix some broken asserts

Fix some broken asserts

--- src/core/node.c
+++ src/core/node.c
@@ -2184,8 +2184,8 @@
 	dom_string *str;
 	dom_exception err;

-	assert(p->type = DOM_TEXT_NODE);
-	assert(n->type = DOM_TEXT_NODE);
+	assert(p->type == DOM_TEXT_NODE);
+	assert(n->type == DOM_TEXT_NODE);

 	err = dom_text_get_whole_text(n, &str);
 	if (err != DOM_NO_ERR)


mesa: fix error handling for glIsEnabled

According the man page, GL_INVALID_OPERATION should be generated if
glIsEnabled is executed betwwen the execution of glBegin and the
correspoding execution of glEnd.

Signed-off-by: Yuanhan Liu <5dcef21195e64c9c08aa779bb62b25e9133eaa33@linux.intel.com>
Signed-off-by: Brian Paul <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@vmware.com>

--- src/mesa/main/enable.c
+++ src/mesa/main/enable.c
@@ -1072,6 +1072,8 @@
 _mesa_IsEnabled( GLenum cap )
 {
    GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
+
    switch (cap) {
       case GL_ALPHA_TEST:
          return ctx->Color.AlphaEnabled;


mesa: reorder gl_program, gl_shader, gl_shader_program

gl_program : 1344->1336
gl_shader: 488->472
gl_shader_program: 352->344.

Acked-by: Brian Paul <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@vmware.com>
Reviewed-by: 36a696918b39a8a1af1f9065ac243691cfbc626b@amd.com>
Signed-off-by: Dave Airlie <f2295d84e358395675bc8031be58672073ae065e@redhat.com>

--- src/mesa/main/mtypes.h
+++ src/mesa/main/mtypes.h
@@ -2232,8 +2232,9 @@
 struct gl_program
 {
    GLuint Id;
+   GLint RefCount;
    GLubyte *String;  /**< Null-terminated program text */
-   GLint RefCount;
+
    GLenum Target;    /**< GL_VERTEX/FRAGMENT_PROGRAM_ARB, GL_GEOMETRY_PROGRAM_NV */
    GLenum Format;    /**< String encoding format */

@@ -2536,18 +2537,20 @@
    GLenum Type;
    gl_shader_stage Stage;
    GLuint Name;  /**< AKA the handle */
+   GLint RefCount;  /**< Reference count */
    GLchar *Label;   /**< GL_KHR_debug */
-   GLint RefCount;  /**< Reference count */
    GLboolean DeletePending;
    GLboolean CompileStatus;
+   GLboolean IsES;         /**< True if this shader uses GLSL ES */
+
+   GLuint SourceChecksum;       /**< for debug/logging purposes */
    const GLchar *Source;  /**< Source code string */
-   GLuint SourceChecksum;       /**< for debug/logging purposes */
+
    struct gl_program *Program;  /**< Post-compile assembly code */
    GLchar *InfoLog;
    struct gl_sl_pragmas Pragmas;

    unsigned Version;       /**< GLSL version used for linking */
-   GLboolean IsES;         /**< True if this shader uses GLSL ES */

    /**
     * \name Sampler tracking
@@ -2591,8 +2594,8 @@
     *
     * These fields are only set post-linking.
     */
+   unsigned NumUniformBlocks;
    struct gl_uniform_block *UniformBlocks;
-   unsigned NumUniformBlocks;

    struct exec_list *ir;
    struct glsl_symbol_table *symbols;
@@ -2882,8 +2885,8 @@
     */
    unsigned LastClipDistanceArraySize;

+   unsigned NumUniformBlocks;
    struct gl_uniform_block *UniformBlocks;
-   unsigned NumUniformBlocks;

    /**
     * Indices into the _LinkedShaders's UniformBlocks[] array for each stage


ui_server: new class Route

ui_server: new class Route

The Route is a helper to define a RESTful request mapping. It
resolves the input URI to a function callback.

The Route is a template class which makes it independent on the
target HTTP server implementation.

Reviewed-by: Petr Stehlík <34fd672d4ba535a5cc62ffb15c811632a40953f1@stud.fit.vutbr.cz>

error: pathspec 'server/src/server/Route.h' did not match any file(s) known to git

--- server/src/server/Route.h
+++ server/src/server/Route.h
@@ -0,0 +1,249 @@
+#ifndef BEEEON_ROUTE_H
+#define BEEEON_ROUTE_H
+
+#include <vector>
+#include <map>
+#include <Poco/URI.h>
+#include <Poco/Exception.h>
+#include <Poco/Logger.h>
+
+namespace BeeeOn {
+
+template <typename Request, typename Response, typename UserData = void *>
+class TRouteContext;
+
+/**
+ * RESTful route representation.
+ * Any kind of Request, Response pair can be used. We just need
+ * to be able to take a reference of them (early binding).
+ * Each resolution of a route takes a UserData argument to have
+ * a pointer to some request specific data.
+ *
+ * Examples:
+ *   /devices/getAll   -> void getAll(context)
+ *   /user/get/:userId -> void getUser(context)  [userId -> <value>]
+ *
+ * Simple wildcards are possible. A rule "*" match any request.
+ * Otherwise, every path fragment can be subtituted by "*" to match all
+ * such fragments.
+ */
+template <typename Request, typename Response, typename UserData = void *>
+class TRoute {
+public:
+	/**
+	 * Params data structure is currently represented by std::map.
+	 */
+	typedef std::map<std::string, std::string> Params;
+
+	/**
+	 * Related TRouteContext can be simply called Context.
+	 */
+	typedef TRouteContext<Request, Response, UserData> Context;
+
+	/**
+	 * Function for handling a routing request. The request
+	 * data is represented by the given context.
+	 */
+	typedef void (*Handler)(Context &context);
+
+	std::string getURI() const
+	{
+		return m_uri.getPath();
+	}
+
+	TRoute(std::string const &uri, Handler h, bool secure = true):
+		m_handler(h),
+		m_uri(uri),
+		m_secure(secure)
+	{
+		m_uri.getPathSegments(m_path);
+	}
+
+	TRoute(Poco::URI &uri, Handler h, bool secure = true):
+		m_handler(h),
+		m_uri(uri),
+		m_secure(secure)
+	{
+		m_uri.getPathSegments(m_path);
+	}
+
+	TRoute(const TRoute &copy):
+		m_handler(copy.m_handler),
+		m_uri(copy.m_uri),
+		m_path(copy.m_path),
+		m_secure(copy.m_secure)
+	{
+	}
+
+	~TRoute() {}
+
+	/**
+	 * @see match(Poco::URI, Params)
+	 */
+	bool match(std::string const &uri, Params &p) const
+	{
+		Poco::URI parsed(uri);
+		return match(parsed, p);
+	}
+
+	/**
+	 * Match the given URI for this route. If the route matches
+	 * it returns true and the extracted parameters are inserted
+	 * into the given params.
+	 */
+	bool match(Poco::URI &uri, Params &p) const
+	{
+		// match wildcard "*"
+		if (m_path.size() == 1 && m_uri.getPath() == "*")
+			return true;
+
+		if (m_uri.empty() || uri.empty())
+			return false;
+
+		size_t count;
+		std::vector<std::string> path;
+		uri.getPathSegments(path);
+
+		count = path.size();
+
+		if (count != m_path.size())
+			return false;
+
+		Params tmp;
+
+		for (unsigned int i = 0; i < count; ++i) {
+			// match partial wildcard
+			if (m_path[i] == "*")
+				continue;
+			else if (m_path[i].at(0) == ':')
+				tmp.insert(make_pair(m_path[i].substr(1), path[i]));
+			else if (m_path[i] != path[i])
+				return false;
+		}
+
+		p = tmp;
+		return true;
+	}
+
+	/**
+	 * Return true when this Route is considered secure. A secure
+	 * Route requires authentication.
+	 */
+	bool isSecure() const
+	{
+		return m_secure;
+	}
+
+	/**
+	 * Execute the route's handler. The handler is called with
+	 * the given request, response, params and userData.
+	 *
+	 * @throws Poco::NullPointerException when no handler is set
+	 *	for this route
+	 */
+	void execute(Request &request,
+			Response &response,
+			const Params &params,
+			UserData &userData) const
+	{
+		Context context(request, response, params, userData);
+		execute(context);
+	}
+
+	/**
+	 * Execute the route's handler with the given context.
+	 *
+	 * @throws Poco::NullPointerException when no handler is set
+	 *	for this route
+	 */
+	void execute(Context &context) const
+	{
+		if (m_handler == NULL)
+			throw Poco::NullPointerException("no handler for this route");
+		m_handler(context);
+	}
+
+	/**
+	 * Debug the Route instance with the given set of extracted
+	 * params. Reports the route into the given logger on DEBUG level.
+	 */
+	void debug(Poco::Logger &logger, const Params &p,
+			const char *file, size_t line) const
+	{
+		if (!logger.debug())
+			return;
+
+		std::string message = "route " + getURI() + " -> [";
+
+		Params::const_iterator it = p.begin();
+		if (it != p.end()) {
+			message += it->first + " = " + it->second;
+			++it;
+		}
+
+		for (; it != p.end(); ++it)
+			message += ", " + it->first + " = " + it->second;
+		message += "]";
+
+		logger.debug(message, file, line);
+	}
+
+private:
+	Handler m_handler;
+	Poco::URI m_uri;
+	std::vector<std::string> m_path;
+	bool m_secure;
+};
+
+/**
+ * Represents a context of a route resolution. It provides
+ * access to the Request and Response instances, the params
+ * extracted from URL (URI) and the userData specific to
+ * the request.
+ */
+template <typename Request, typename Response, typename UserData>
+class TRouteContext {
+public:
+	typedef typename TRoute<Request, Response>::Params Params;
+
+	TRouteContext(Request &request,
+			Response &response,
+			const Params &params,
+			UserData &userData):
+		m_request(request),
+		m_response(response),
+		m_params(params),
+		m_userData(userData)
+	{
+	}
+
+	Request &request() const
+	{
+		return m_request;
+	}
+
+	Response &response() const
+	{
+		return m_response;
+	}
+
+	const Params &params() const
+	{
+		return m_params;
+	}
+
+	UserData &userData() const
+	{
+		return m_userData;
+	}
+
+private:
+	Request &m_request;
+	Response &m_response;
+	const Params &m_params;
+	UserData &m_userData;
+};
+
+}
+
+#endif


fix ambiguity in stack operation

fix ambiguity in stack operation

--- interpreter.c
+++ interpreter.c
@@ -42,7 +42,7 @@

 /* empty ascending stack */
 	#define push(sp,val) (*sp=val,sp++)
-	#define pop(sp) (sp--,*sp)
+	#define pop(sp) ({sp--;*sp;})
 	#define peek_n(sp,nth) (*(sp-nth))
 	#define drop_n(sp,num) (sp-=num)


mesa: remove unused ENABLE_TEXGENx, ENABLE_TEXMATx flags

--- src/mesa/main/mtypes.h
+++ src/mesa/main/mtypes.h
@@ -1208,27 +1208,12 @@
 /*@}*/

-/* A selection of state flags to make driver and module's lives easier. */
-#define ENABLE_TEXGEN0        0x1
-#define ENABLE_TEXGEN1        0x2
-#define ENABLE_TEXGEN2        0x4
-#define ENABLE_TEXGEN3        0x8
-#define ENABLE_TEXGEN4        0x10
-#define ENABLE_TEXGEN5        0x20
-#define ENABLE_TEXGEN6        0x40
-#define ENABLE_TEXGEN7        0x80
-
-#define ENABLE_TEXMAT0        0x1	/* Ie. not the identity matrix */
-#define ENABLE_TEXMAT1        0x2
-#define ENABLE_TEXMAT2        0x4
-#define ENABLE_TEXMAT3        0x8
-#define ENABLE_TEXMAT4        0x10
-#define ENABLE_TEXMAT5        0x20
-#define ENABLE_TEXMAT6        0x40
-#define ENABLE_TEXMAT7        0x80
-
-#define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i))
-#define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
+
+/** Tex-gen enabled for texture unit? */
+#define ENABLE_TEXGEN(unit) (1 << (unit))
+
+/** Non-identity texture matrix for texture unit? */
+#define ENABLE_TEXMAT(unit) (1 << (unit))

 /**
@@ -1573,8 +1558,8 @@
    GLbitfield _EnabledUnits;  /**< one bit set for each really-enabled unit */
    GLbitfield _EnabledCoordUnits;   /**< one bit per enabled coordinate unit */
    GLbitfield _GenFlags;            /**< for texgen */
-   GLbitfield _TexGenEnabled;
-   GLbitfield _TexMatEnabled;
+   GLbitfield _TexGenEnabled;  /**< Mask of ENABLE_TEXGEN flags */
+   GLbitfield _TexMatEnabled;  /**< Mask of ENABLE_TEXMAT flags */
    /**@}*/

    struct gl_texture_unit Unit[MAX_TEXTURE_UNITS];


Fix evaluateInt

Fix evaluateInt

--- interpreter.c
+++ interpreter.c
@@ -95,12 +95,11 @@
     if(ast->kind == ekVal) {
         return ast->data.val;
     } else if(ast->kind == ekId) {
-        aatree* node = aatree_lookup(symbols,ast->data.name);
-        if(node == NULL) {
+        aatree_item* item = (aatree_item*)(aatree_lookup(symbols,ast->data.name));
+        if(item == NULL) {
             fprintf(stderr, "error: use of undeclared variable '%s'\n", ast->data.name);
             exit(1);
         }
-        aatree_item* item = (aatree_item*)(node->value);
 	return item->val;
     } else if(ast->kind == ekExpression) {


mesa: Fix array out-of-bounds access by _mesa_TexGenf.

_mesa_TexGenf calls _mesa_TexGenfv, which uses the params argument
as an array.
(cherry picked from commit ca5a7aadb4361e7d053aea8687372cd44cbd8795)

--- src/mesa/main/texgen.c
+++ src/mesa/main/texgen.c
@@ -206,7 +206,10 @@
 void GLAPIENTRY
 _mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param )
 {
-   _mesa_TexGenfv(coord, pname, &param);
+   GLfloat p[4];
+   p[0] = param;
+   p[1] = p[2] = p[3] = 0.0F;
+   _mesa_TexGenfv(coord, pname, p);
 }


Changed variable filenamenotgiven to filenamegiven and changed all assignments to it from FALSE to TRUE and vice-versa to make the logic correct

--- interpreter.c
+++ interpreter.c
@@ -1,4 +1,5 @@
-/* Author: Sheldon Sandbekkhaug
+/* Author(s): Sheldon Sandbekkhaug
+              Ryan Lorey
    Written 2013

 */
@@ -45,7 +46,7 @@
 int main(int argc, STRING *argv)
 {
     int i;
-    bool filenamenotgiven = TRUE;
+    bool filenamegiven = FALSE;

     delimeters[0] = ' ';
     delimeters[1] = '\t';
@@ -64,18 +65,18 @@
       else
       {
         // If we found a real file, open it
-        filenamenotgiven = FALSE;
+        filenamegiven = TRUE;
         input = fopen(*argv,"r");

         if (input == NULL)
         {
-          filenamenotgiven = TRUE;
+          filenamegiven = FALSE;
         }
       }
     }

     // Use stdin if no valid filename was given
-    if (filenamenotgiven)
+    if (!filenamegiven)
     {
       input = stdin;
       read_input(stdin);


Ensure adjusted "known delay" doesn't drop below zero.

The untrusted delay mode provides an option to reduce the "known delay"
parameter passed down to the core AEC. This is necessary to handle the
very low latencies observed with the Chromium audio backend on Mac.

Prior to this change, it was possible to pass a negative value. The AEC
produced good output in practice, but it turned out this tripped a
heretofore unnoticed assert in ProcessBlock().

This change avoids the assert, and maintains the good output across a
set of Mac recordings. Bit-exact in some cases, and in the remaining,
quickly converging to identical output.

The assert was hit on the last webrtc roll in Chromium in
content_browsertests on Mac.

Corresponds to:
https://chromereviews.googleplex.com/9960013

TBR=bjornv
TESTED=Verified locally that "content_browsertests
--gtest_filter=WebrtcBrowserTest.*"" passes.

Review URL: https://webrtc-codereview.appspot.com/2328005

git-svn-id: 03ae4fbe531b1eefc9d815f31e49022782c42458@4886 4adac7df-926f-26a2-2b94-8c16560cd09d

--- modules/audio_processing/aec/echo_cancellation.c
+++ modules/audio_processing/aec/echo_cancellation.c
@@ -814,13 +814,18 @@

   EstBufDelayExtended(self);

-  for (i = 0; i < num_frames; ++i) {
+  {
     // |delay_diff_offset| gives us the option to manually rewind the delay on
     // very low delay platforms which can't be expressed purely through
     // |reported_delay_ms|.
-    WebRtcAec_ProcessFrame(self->aec, &near[FRAME_LEN * i],
-        &near_high[FRAME_LEN * i], self->knownDelay + delay_diff_offset,
-        &out[FRAME_LEN * i], &out_high[FRAME_LEN * i]);
+    const int adjusted_known_delay =
+        WEBRTC_SPL_MAX(0, self->knownDelay + delay_diff_offset);
+
+    for (i = 0; i < num_frames; ++i) {
+      WebRtcAec_ProcessFrame(self->aec, &near[FRAME_LEN * i],
+          &near_high[FRAME_LEN * i], adjusted_known_delay,
+          &out[FRAME_LEN * i], &out_high[FRAME_LEN * i]);
+    }
   }
 }


mesa: Split out the format code from update_array()

Split out the code for updating the array format into a new function
called update_array_format(). This function will be called by both
update_array() and the new glVertexAttrib*Format() entry points in
ARB_vertex_attrib_binding.

Reviewed-by: Eric Anholt <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@anholt.net>
Reviewed-by: Ian Romanick <2b237cafb16dc45038e85df6c85e74e6d899eba9@intel.com>

--- src/mesa/main/varray.c
+++ src/mesa/main/varray.c
@@ -103,51 +103,32 @@

 /**
- * Do error checking and update state for glVertex/Color/TexCoord/...Pointer
- * functions.
+ * Does error checking and updates the format in an attrib array.
  *
- * \param func  name of calling function used for error reporting
- * \param attrib  the attribute array index to update
- * \param legalTypes  bitmask of *_BIT above indicating legal datatypes
- * \param sizeMin  min allowable size value
- * \param sizeMax  max allowable size value (may also be BGRA_OR_4)
- * \param size  components per element (1, 2, 3 or 4)
- * \param type  datatype of each component (GL_FLOAT, GL_INT, etc)
- * \param stride  stride between elements, in elements
- * \param normalized  are integer types converted to floats in [-1, 1]?
- * \param integer  integer-valued values (will not be normalized to [-1,1])
- * \param ptr  the address (or offset inside VBO) of the array data
- */
-static void
-update_array(struct gl_context *ctx,
-             const char *func,
-             GLuint attrib, GLbitfield legalTypesMask,
-             GLint sizeMin, GLint sizeMax,
-             GLint size, GLenum type, GLsizei stride,
-             GLboolean normalized, GLboolean integer,
-             const GLvoid *ptr)
+ * Called by update_array().
+ *
+ * \param func        Name of calling function used for error reporting
+ * \param attrib      The index of the attribute array
+ * \param legalTypes  Bitmask of *_BIT above indicating legal datatypes
+ * \param sizeMin     Min allowable size value
+ * \param sizeMax     Max allowable size value (may also be BGRA_OR_4)
+ * \param size        Components per element (1, 2, 3 or 4)
+ * \param type        Datatype of each component (GL_FLOAT, GL_INT, etc)
+ * \param normalized  Whether integer types are converted to floats in [-1, 1]
+ * \param integer     Integer-valued values (will not be normalized to [-1, 1])
+ */
+static bool
+update_array_format(struct gl_context *ctx,
+                    const char *func,
+                    GLuint attrib, GLbitfield legalTypesMask,
+                    GLint sizeMin, GLint sizeMax,
+                    GLint size, GLenum type,
+                    GLboolean normalized, GLboolean integer)
 {
    struct gl_client_array *array;
    GLbitfield typeBit;
-   GLsizei elementSize;
+   GLuint elementSize;
    GLenum format = GL_RGBA;
-
-   /* Page 407 (page 423 of the PDF) of the OpenGL 3.0 spec says:
-    *
-    *     "Client vertex arrays - all vertex array attribute pointers must
-    *     refer to buffer objects (section 2.9.2). The default vertex array
-    *     object (the name zero) is also deprecated. Calling
-    *     VertexAttribPointer when no buffer object or no vertex array object
-    *     is bound will generate an INVALID_OPERATION error..."
-    *
-    * The check for VBOs is handled below.
-    */
-   if (ctx->API == API_OPENGL_CORE
-       && (ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj)) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "%s(no array object bound)",
-                  func);
-      return;
-   }

    if (_mesa_is_gles(ctx)) {
       legalTypesMask &= ~(FIXED_GL_BIT | DOUBLE_BIT);
@@ -186,7 +167,7 @@
    if (typeBit == 0x0 || (typeBit & legalTypesMask) == 0x0) {
       _mesa_error(ctx, GL_INVALID_ENUM, "%s(type = %s)",
                   func, _mesa_lookup_enum_by_nr(type));
-      return;
+      return false;
    }

    /* Do size parameter checking.
@@ -206,26 +187,26 @@
        *    ...
        *    • size is BGRA and normalized is FALSE;"
        */
-      GLboolean bgra_error = GL_FALSE;
+      bool bgra_error = false;

       if (ctx->Extensions.ARB_vertex_type_2_10_10_10_rev) {
          if (type != GL_UNSIGNED_INT_2_10_10_10_REV &&
              type != GL_INT_2_10_10_10_REV &&
              type != GL_UNSIGNED_BYTE)
-            bgra_error = GL_TRUE;
+            bgra_error = true;
       } else if (type != GL_UNSIGNED_BYTE)
-         bgra_error = GL_TRUE;
+         bgra_error = true;

       if (bgra_error) {
          _mesa_error(ctx, GL_INVALID_OPERATION, "%s(size=GL_BGRA and type=%s)",
                      func, _mesa_lookup_enum_by_nr(type));
-         return;
+         return false;
       }

       if (!normalized) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "%s(size=GL_BGRA and normalized=GL_FALSE)", func);
-         return;
+         return false;
       }

       format = GL_BGRA;
@@ -233,17 +214,81 @@
    }
    else if (size < sizeMin || size > sizeMax || size > 4) {
       _mesa_error(ctx, GL_INVALID_VALUE, "%s(size=%d)", func, size);
-      return;
+      return false;
    }

    if (ctx->Extensions.ARB_vertex_type_2_10_10_10_rev &&
        (type == GL_UNSIGNED_INT_2_10_10_10_REV ||
         type == GL_INT_2_10_10_10_REV) && size != 4) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "%s(size=%d)", func, size);
-      return;
+      return false;
    }

    ASSERT(size <= 4);
+
+   elementSize = _mesa_bytes_per_vertex_attrib(size, type);
+   assert(elementSize != -1);
+
+   array = &ctx->Array.ArrayObj->VertexAttrib[attrib];
+   array->Size = size;
+   array->Type = type;
+   array->Format = format;
+   array->Normalized = normalized;
+   array->Integer = integer;
+   array->_ElementSize = elementSize;
+
+   return true;
+}
+
+
+/**
+ * Do error checking and update state for glVertex/Color/TexCoord/...Pointer
+ * functions.
+ *
+ * \param func  name of calling function used for error reporting
+ * \param attrib  the attribute array index to update
+ * \param legalTypes  bitmask of *_BIT above indicating legal datatypes
+ * \param sizeMin  min allowable size value
+ * \param sizeMax  max allowable size value (may also be BGRA_OR_4)
+ * \param size  components per element (1, 2, 3 or 4)
+ * \param type  datatype of each component (GL_FLOAT, GL_INT, etc)
+ * \param stride  stride between elements, in elements
+ * \param normalized  are integer types converted to floats in [-1, 1]?
+ * \param integer  integer-valued values (will not be normalized to [-1,1])
+ * \param ptr  the address (or offset inside VBO) of the array data
+ */
+static void
+update_array(struct gl_context *ctx,
+             const char *func,
+             GLuint attrib, GLbitfield legalTypesMask,
+             GLint sizeMin, GLint sizeMax,
+             GLint size, GLenum type, GLsizei stride,
+             GLboolean normalized, GLboolean integer,
+             const GLvoid *ptr)
+{
+   struct gl_client_array *array;
+
+   /* Page 407 (page 423 of the PDF) of the OpenGL 3.0 spec says:
+    *
+    *     "Client vertex arrays - all vertex array attribute pointers must
+    *     refer to buffer objects (section 2.9.2). The default vertex array
+    *     object (the name zero) is also deprecated. Calling
+    *     VertexAttribPointer when no buffer object or no vertex array object
+    *     is bound will generate an INVALID_OPERATION error..."
+    *
+    * The check for VBOs is handled below.
+    */
+   if (ctx->API == API_OPENGL_CORE
+       && (ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "%s(no array object bound)",
+                  func);
+      return;
+   }
+
+   if (!update_array_format(ctx, func, attrib, legalTypesMask, sizeMin, sizeMax,
+                            size, type, normalized, integer)) {
+      return;
+   }

    if (stride < 0) {
       _mesa_error( ctx, GL_INVALID_VALUE, "%s(stride=%d)", func, stride );
@@ -268,19 +313,10 @@
       return;
    }

-   elementSize = _mesa_bytes_per_vertex_attrib(size, type);
-   assert(elementSize != -1);
-
    array = &ctx->Array.ArrayObj->VertexAttrib[attrib];
-   array->Size = size;
-   array->Type = type;
-   array->Format = format;
    array->Stride = stride;
-   array->StrideB = stride ? stride : elementSize;
-   array->Normalized = normalized;
-   array->Integer = integer;
+   array->StrideB = stride ? stride : array->_ElementSize;
    array->Ptr = (const GLubyte *) ptr;
-   array->_ElementSize = elementSize;

    _mesa_reference_buffer_object(ctx, &array->BufferObj,
                                  ctx->Array.ArrayBufferObj);


make c code work with new string layout

make c code work with new string layout

--- interpreter.c
+++ interpreter.c
@@ -44,6 +44,7 @@
 {
 	void * address;					/* pointer into memory */
 	unsigned char flags;		/* may include other flags later (inline, recursive, etc) */
+	unsigned char name_header; /* should always be zero */
 	unsigned char name_length;
 	char name[];
 }	__attribute__((packed)) dict_entry;
@@ -73,7 +74,7 @@
   IFTRACE1(printf("looking for '%s'(%d) ", fname,length));
   for(char * ptr=(char*)dict;
 		(ptr < ((char*)dict+sizeof(dict)))&&(((dict_entry*)ptr)->name_length > 0);
-		ptr += (((dict_entry*)ptr)->name_length + 2*sizeof(unsigned char) + sizeof(void*))) {
+		ptr += (((dict_entry*)ptr)->name_length + 3*sizeof(unsigned char) + sizeof(void*))) {
 	 dict_entry *dptr = (dict_entry*)ptr;
      unsigned char rl = dict_entry_real_length(dptr);
 	 IFTRACE1(printf("comparing to (%#lx): %s(%d); ",(uintptr_t)dptr->name,dptr->name,rl));
@@ -94,7 +95,7 @@
   static char notfound[] = "(internal or private)";
   for (char * ptr=(char*)dict;
        (ptr < ((char*)dict+sizeof(dict)))&&(((dict_entry*)ptr)->name_length > 0);
-       ptr += (((dict_entry*)ptr)->name_length + 2*sizeof(unsigned char) + sizeof(void*))) {
+       ptr += (((dict_entry*)ptr)->name_length + 3*sizeof(unsigned char) + sizeof(void*))) {
     dict_entry *dptr = (dict_entry*)ptr;
     if (dptr->address == word)
       return dptr->name;
@@ -159,7 +160,7 @@
               case litc: {
                 seq_header h =(seq_header)*(ptr+1);
                 /* compensate for header byte */
-                ptr+=1+fe_seq_size(h,ptr+2); } break;
+                ptr+=2+fe_seq_size(h,ptr+2); } break;
               case litb:
               case oplit:
                 ptr+=sizeof(inst);
@@ -339,7 +340,7 @@
           /* pc is already at the next item -> header byte */
           seq_header h = (seq_header)(*pc);
           ppush((cell)pc);    /* push header to stack */
-          pc += 1 + fe_seq_size(h,pc+1);
+          pc += 2 + fe_seq_size(h,pc+1);
         } break;
         case strstart: {           /* ( -- countedstr ) */
           unsigned char len = *pc;