[tf.data] Disable autotune for inputs of `LegacyParallelInterleave` that are in the staging phase.

PiperOrigin-RevId: 448280946

--- tensorflow/core/kernels/data/experimental/parallel_interleave_dataset_op.cc
+++ tensorflow/core/kernels/data/experimental/parallel_interleave_dataset_op.cc
@@ -379,17 +379,7 @@
               // `interleave_indices_`.
               interleave_indices_[index] = staging_indices_.front();
               staging_indices_.pop_front();
-              {
-                tf_shared_lock ckpt_l(ckpt_mu_);
-                if (worker_thread_states_[interleave_indices_[index]]
-                        .iterator != nullptr) {
-                  // TODO(wilsin): Write a unit test where we iterate through a
-                  // dataset, pause, and check the model proto autotune value.
-                  EnableAutotune(
-                      ctx, worker_thread_states_[interleave_indices_[index]]
-                               .iterator.get());
-                }
-              }
+
               next_index_ = (index + 1) % interleave_indices_.size();
               block_count_ = 0;
               // Restart the inner [for] loop
@@ -690,16 +680,16 @@
             input_impl_.reset();
             return Status::OK();
           }
-          if (i < dataset()->cycle_length_) {
-            interleave_indices_.push_back(i);
-          } else {
-            staging_indices_.push_back(i);
-          }
           workers_[i].SetInputs(s, std::move(args));
           std::shared_ptr<IteratorContext> new_ctx(new IteratorContext(*ctx));
           worker_threads_.push_back(ctx->StartThread(
               strings::StrCat(kDataParallelInterleaveWorker, "_", i),
               [this, new_ctx, i]() { WorkerThread(new_ctx, i); }));
+          if (i < dataset()->cycle_length_) {
+            interleave_indices_.push_back(i);
+          } else {
+            staging_indices_.push_back(i);
+          }
         }
         DCHECK(interleave_indices_.size() == dataset()->cycle_length_);
         DCHECK(staging_indices_.size() == dataset()->prefetch_input_elements_);
@@ -789,12 +779,7 @@
             // CHECKPOINT_MARKER_A
             // We have the input tensors but have not built the iterator yet.
           }
-          bool thread_in_staging = false;
-          {
-            mutex_lock l(mu_);
-            thread_in_staging = absl::c_find(staging_indices_, thread_index) !=
-                                staging_indices_.end();
-          }
+
           // 1b. Run the user defined function to produce a new iterator.
           {
             tf_shared_lock l(ckpt_mu_);
@@ -808,12 +793,6 @@
                 worker_thread_states_[thread_index].iterator_creation_status;
             if (!iterator_creation_status.ok()) {
               worker_thread_states_[thread_index].input.clear();
-            } else if (thread_in_staging) {
-              // TODO(wilsin): Write a unit test where we iterate through a
-              // dataset, pause, and check the model proto autotune value.
-              DisableAutotune(
-                  ctx.get(),
-                  worker_thread_states_[thread_index].iterator.get());
             }
             // CHECKPOINT_MARKER_B
             // Either an iterator has been successfully built and placed in


realm: more compiler warning fun

realm: more compiler warning fun

--- runtime/realm/logging.inl
+++ runtime/realm/logging.inl
@@ -35,8 +35,10 @@
   }

   // the static early outs are exactly to identify dead code, so ignore
-  //  compiler warnings related to that
+  //  compiler warnings related to that (and warnings for compilers that
+  //  don't understand -Wtautological-compare...)
 #pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpragmas"
 #pragma GCC diagnostic ignored "-Wtautological-compare"
   inline LoggerMessage Logger::spew(void)
   {


Made fix for #1894195 work in single pass mode.

--- src/Editor.cxx
+++ src/Editor.cxx
@@ -2389,10 +2389,10 @@
 						if (ll->chars[cpos + startseg] == ' ') {
 							if (drawWhitespaceBackground &&
 							        (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) {
-								PRectangle rcSpace(ll->positions[cpos + startseg] + xStart - subLineStart,
-										rcSegment.top,
-								        ll->positions[cpos + startseg + 1] + xStart - subLineStart,
-										rcSegment.bottom);
+								PRectangle rcSpace(ll->positions[cpos + startseg] + xStart - subLineStart,
+									rcSegment.top,
+									ll->positions[cpos + startseg + 1] + xStart - subLineStart,
+									rcSegment.bottom);
 								surface->FillRectangle(rcSpace, vsDraw.whitespaceBackground.allocated);
 							}
 						} else {
@@ -2524,7 +2524,10 @@
 									if (!twoPhaseDraw && drawWhitespaceBackground &&
 									        (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) {
 										textBack = vsDraw.whitespaceBackground.allocated;
-										PRectangle rcSpace(ll->positions[cpos + startseg] + xStart, rcSegment.top, ll->positions[cpos + startseg + 1] + xStart, rcSegment.bottom);
+										PRectangle rcSpace(ll->positions[cpos + startseg] + xStart - subLineStart,
+											rcSegment.top,
+											ll->positions[cpos + startseg + 1] + xStart - subLineStart,
+											rcSegment.bottom);
 										surface->FillRectangle(rcSpace, textBack);
 									}
 									PRectangle rcDot(xmid + xStart - subLineStart, rcSegment.top + vsDraw.lineHeight / 2, 0, 0);


native: new detection code

native: new detection code

--- src/plugins/native/inireader.cpp
+++ src/plugins/native/inireader.cpp
@@ -416,8 +416,8 @@
 		 return false;
 	 if (!QFileInfo(path).exists())
 		 return false;
-
-	 QDir disc (path);
+	 //old code
+	/* QDir disc (path);
 	 QStringList disclist = disc.entryList(QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs);
 	 foreach (QString disc, availableDiscs())
 	 {
@@ -434,6 +434,23 @@
 				 return true;
 		 }
 	  }
+	  */
+	 //new code
+	 QDir dir (path);
+	 foreach (QString disc, availableDiscs())
+	 {
+		 QStringList list (discFileList(disc));
+		 if (list.count() < dir.entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot).count())
+			 return false; //список на входе должен быть не меньше списка корневой директории диска.
+		 foreach (QString str, list)
+		 {
+			 if (dir.exists(str) && QFileInfo(str).isRelative()) //поддерживаются только относительные пути
+				 continue;
+			 else
+				 return false;
+		 }
+		 return true;
+	 }
 	 return false;
  }


Use bit_is_clear in HardwareSerial::flush()

This is slightly more clear than the previous explicit comparison.

--- hardware/arduino/avr/cores/arduino/HardwareSerial.cpp
+++ hardware/arduino/avr/cores/arduino/HardwareSerial.cpp
@@ -332,7 +332,7 @@
 void HardwareSerial::flush()
 {
   // UDR is kept full while the buffer is not empty, so TXC triggers when EMPTY && SENT
-  while (transmitting && ! (*_ucsra & _BV(TXC0)));
+  while (transmitting && bit_is_clear(*_ucsra, TXC0));
   transmitting = false;
 }


behave like a normal tabwidget, ie. don't move to the previous tab when closing the current

svn path=/trunk/KDE/kdepim/akregator/; revision=765758

--- akregator/src/tabwidget.cpp
+++ akregator/src/tabwidget.cpp
@@ -204,7 +204,6 @@
     Frame* f = d->framesById[frameId];
     d->frames.remove(f);
     d->framesById.remove(frameId);
-    slotPreviousTab();
     removeTab(indexOf(f));
     if (d->currentFrame())
       d->setTitle( d->currentFrame()->title(), currentWidget() );


Add S_DrawPickup

Add S_DrawPickup

--- GAME/NEWINV2.C
+++ GAME/NEWINV2.C
@@ -9,6 +9,7 @@
 #include "GAMEFLOW.H"
 #include "CONTROL.H"
 #include "SAVEGAME.H"
+#include "HEALTH.H"

 #include "LARA2GUN.H"
 #include "LARA1GUN.H"
@@ -25,6 +26,7 @@
 #include "SETUP.H"
 #include "LOADSAVE.H"
 #include "CD.H"
+#include "GPU.H"
 #endif

 enum invobj_types // update this whenever inventry_objects_list is modified
@@ -404,7 +406,7 @@
 	UNIMPLEMENTED();
 }

-void S_DrawPickup(short object_number)//41608, 41A5C
+void S_DrawPickup(short object_number)//41608(<), 41A5C(<) (F)
 {
 #if PC_VERSION
 	phd_LookAt(0, SECTOR(1), 0, 0, 0, 0, 0);
@@ -421,7 +423,12 @@
 		0,
 		1);
 #else
-	UNIMPLEMENTED();
+	ClearOTagR(db.pickup_ot, 256);
+	DrawThreeDeeObject2D(PickupX + 448, 200, convert_obj_to_invobj(object_number), 128, 0, (GnFrameCounter & 0x7F) << 9, 0, 0, 1);
+
+	db.pickup_ot[0] = db.pickup_ot[0] & 0xFF000000 | db.ot[0] & 0xFFFFFF;
+	db.ot[0] = db.ot[0] & 0xFF000000 | (int)(db.pickup_ot + 255) & 0xFFFFFF;
+
 #endif
 }


Resetting the chip this way doesn't work but setting the IO defaults appropriately is nessisary.

--- ft2232spi/ft2232spi.cpp
+++ ft2232spi/ft2232spi.cpp
@@ -34,9 +34,9 @@
 #define CHANNEL_TO_OPEN			0	/*0 for first available channel, 1 for next... */
 #define SPI_WRITE_COMPLETION_RETRY 100
 #define SPI_OPTS               SPI_TRANSFER_OPTIONS_SIZE_IN_BYTES | SPI_TRANSFER_OPTIONS_CHIPSELECT_ENABLE | SPI_TRANSFER_OPTIONS_CHIPSELECT_DISABLE
-#define GPIO_DIR			   0x93 /* 0b10010011 */
 #define GPIO_INIT			   GPIO_DIR /* Everything that's an output should be set high */
-#define RESET_CHIP
+//#define RESET_CHIP
+#define TEST_COMMUNICATION

 int _tmain(int argc, _TCHAR* argv[]) {
 	FT_STATUS ftStatus;
@@ -128,7 +128,7 @@

 		status = SPI_Write(ftHandle, wBuffer, sizeTransferred, &sizeTransferred, SPI_OPTS);
 		APP_CHECK_STATUS(status);
-		printf("Wrote/Read %d bytes\r\n", sizeTransferred);
+		printf("Transferred %d bytes\r\n", sizeTransferred);
 		unsigned long retry = 0;
 		bool state=FALSE;
 		SPI_IsBusy(ftHandle,&state);
@@ -139,6 +139,17 @@
 			retry++;
 		}

+#ifdef TEST_COMMUNICATION
+		Sleep(10);
+
+		for (sizeTransferred = 0; sizeTransferred < 10; sizeTransferred++) wBuffer[sizeTransferred] = sizeTransferred;
+		status = SPI_ReadWrite(ftHandle, rBuffer, wBuffer, sizeTransferred, &sizeTransferred, SPI_OPTS);
+		APP_CHECK_STATUS(status);
+		printf("Transferred %d bytes\r\n", sizeTransferred);
+		rBuffer[sizeTransferred] = 0;
+		printf("Received %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x \r\n", rBuffer[0], rBuffer[1], rBuffer[2], rBuffer[3], rBuffer[4], rBuffer[5], rBuffer[6], rBuffer[7], rBuffer[8], rBuffer[9]);
+
+#endif
 		status = SPI_CloseChannel(ftHandle);
 	}


Clipping copy range into document.

Clipping copy range into document.

--- src/Editor.cxx
+++ src/Editor.cxx
@@ -4230,6 +4230,8 @@
 }

 void Editor::CopyRangeToClipboard(int start, int end) {
+	start = pdoc->ClampPositionIntoDocument(start);
+	end = pdoc->ClampPositionIntoDocument(end);
 	SelectionText selectedText;
 	selectedText.Set(CopyRange(start, end), end - start + 1);
 	CopyToClipboard(selectedText);


can now accept multiple arguments to hash multiple files at once


Fix encoder checking eclipse warnings

Fix encoder checking eclipse warnings

--- hardware/libraries/CommonTools/DataEncoderChecking.hh
+++ hardware/libraries/CommonTools/DataEncoderChecking.hh
@@ -2,6 +2,8 @@

 #ifndef DATA_ENCODER_CHECKING_H__
 #define DATA_ENCODER_CHECKING_H__
+
+#include "PlatformConfig.h"

 /**
  * \addtogroup CommonTools


Finish winners

Finish winners

--- winners/winners.cpp
+++ winners/winners.cpp
@@ -50,290 +50,46 @@
     return std::make_pair(numbers, stars);
 }

-Key GetKey(std::string& key)
-{
-    std::stringstream ss;
-
-    ss << key;
-
-    std::vector<int> numbers;
-    for (int i = 0; i < NUMBER_COUNT; ++i)
-    {
-        int n;
-        ss >> n;
-        numbers.push_back(n);
-    }
-
-    std::string se;
-    ss >> se; // number/star separator;
-
-    std::vector<int> stars; // line 2, stars
-    for (int i = 0; i < STAR_COUNT; ++i)
-    {
-        int s;
-        ss >> s;
-        stars.push_back(s);
-    }
-
-    if (numbers.size() == 0 || stars.size() == 0 || ss.bad())
-    {
-        std::cout << "Erro ao processar " << BETS_FILE_NAME << "." << std::endl;
-        exit(EXIT_FAILURE);
-    }
-
-    return std::make_pair(numbers, stars);
-}
-
-typedef std::pair<Player*, KeyList> PlayerBets;
-typedef std::vector<PlayerBets> PlayerBetsList;
-
-#define PRIZES_MAX 13
-
-PlayerBetsList GetBets(const PlayerList& players)
-{
-    std::ifstream file(BETS_FILE_NAME);
-    if (!file.is_open())
-    {
-        std::cout << "Erro ao processar " << BETS_FILE_NAME << "." << std::endl;
-        exit(EXIT_FAILURE);
-    }
-
-    PlayerBetsList betsList;
-
-    while (!file.eof())
-    {
-        std::string idStr;
-        std::getline(file, idStr);
-
-        int id = atoi(idStr.c_str());
-
-        Player* player = SearchPlayerById(const_cast<PlayerList&>(players), id);
-        if (player == NULL)
-        {
-            if (!file.eof())
-                std::cout << "Jogador " << id << " nao encontrado." << std::endl;
-            break;
-        }
-
-        KeyList keys;
-        std::string keyStr;
-        do
-        {
-            std::getline(file, keyStr);
-            if (keyStr != "")
-                keys.push_back(GetKey(keyStr));
-        } while (keyStr != "");
-
-        PlayerBets bets = std::make_pair(player, keys);
-        betsList.push_back(bets);
-    }
-
-    // Merge duplicated ids into the same user
-    for (size_t i = 0; i < betsList.size(); ++i) // BUG: not working fine for all the cases
-    {
-        for (size_t j = i + 1; j < betsList.size(); ++j)
-        {
-            if (betsList[i].first == betsList[j].first)
-            {
-                betsList[i].second.insert(betsList[i].second.end(), betsList[j].second.begin(), betsList[j].second.end());
-                betsList.erase(betsList.begin() + j);
-                --j;
-            }
-        }
-    }
-
-    return betsList;
-}
-
-struct Match
-{
-    Match(int numberCount, int starCount)
-    {
-        NumberCount = numberCount;
-        StarCount = starCount;
-    }
-
-    Match()
-    {
-        NumberCount = 0;
-        StarCount = 0;
-    }
-
-    int NumberCount;
-    int StarCount;
-};
-
-struct PrizeKeyRow
-{
-	int PrizeId;
-	std::string Hits;
-	int WinnerCount;
-	double Value;
-};
-
-typedef std::vector<PrizeKeyRow> PrizeKeyRows;
-
-Match CalculateMatchingKeys(const Key& a, const Key& b)
-{
-    int numberCount = 0;
-    int starCount = 0;
-
-    for (int i = 0; i < NUMBER_COUNT; ++i)
-    {
-        for (int j = 0; j < NUMBER_COUNT; ++j)
-        {
-            if (a.first[i] == b.first[j])
-                numberCount++;
-        }
-    }
-
-    for (int i = 0; i < STAR_COUNT; ++i)
-    {
-        for (int j = 0; j < STAR_COUNT; ++j)
-        {
-            if (a.second[i] == b.second[j])
-                starCount++;
-        }
-    }
-
-    Match match(numberCount, starCount);
-    return match;
-}
-
-int GetPrizeId(const Key& prizeKey, const Key& betKey)
-{
-    Match match = CalculateMatchingKeys(prizeKey, betKey);
-
-    // 1- 5 nmeros + 2 estrelas
-    // 2- 5 nmeros + 1 estrela
-    // 3- 5 nmeros + 0 estrelas
-    // 4- 4 nmeros + 2 estrelas
-    // 5- 4 nmeros + 1 estrela
-    // 6- 4 nmeros + 0 estrelas
-    // 7- 3 nmeros + 2 estrelas
-    // 8- 2 nmeros + 2 estrelas
-    // 9- 3 nmeros + 1 estrela
-    // 10- 3 nmeros + 0 estrelas
-    // 11- 1 nmero + 2 estrelas
-    // 12- 2 nmeros + 1 estrela
-    // 13- 2 nmeros + 0 estrelas
-
-    const int NO_PRIZE = -1;
-
-    switch (match.StarCount)
-    {
-        case 0:
-            switch (match.NumberCount)
-            {
-                case 2: return 12;
-                case 3: return 9;
-                case 4: return 5;
-                case 5: return 2;
-                default: return NO_PRIZE;
-            }
-        	break;
-        case 1:
-            switch (match.NumberCount)
-            {
-                case 2: return 11;
-                case 3: return 8;
-                case 4: return 4;
-                case 5: return 1;
-                default: return NO_PRIZE;
-            }
-            break;
-        case 2:
-            switch (match.NumberCount)
-            {
-                case 1: return 10;
-                case 2: return 7;
-                case 3: return 6;
-                case 4: return 3;
-                case 5: return 0;
-                default: return NO_PRIZE;
-            }
-            break;
-        default:
-            return NO_PRIZE;
-    }
-}
-
-struct PrizedPlayer
-{
-	PrizedPlayer()
-	{
-		Reward = 0;
-	}
-
-	Player* Player; // the player
-	std::vector<int> Prizes; // prize and number of times it won
-	KeyList Keys; // prized keys
-	int TotalBetsCount; // number of bets (prized + non prized)
-	double Reward; // total money rewarded
-
-	void IncreaseBalance(double amount) { Player->Balance += amount; Reward += amount; }
-};
-
-typedef std::vector<PrizedPlayer> PrizedPlayers;
-
-// Returns the index of the player. If it does not exist, returns -1.
-int Find(const PrizedPlayers& prizedPlayers, const Player* player)
-{
-    for (size_t i = 0; i < prizedPlayers.size(); ++i)
-    {
-        if (prizedPlayers[i].Player == player)
-            return i;
-    }
-
-    return -1;
-}
-
-PrizedPlayers CalculatePrizedPlayers(const PlayerBetsList& bets, const Key& prizeKey)
-{
-    PrizedPlayers prizes;
-
-    for (size_t i = 0; i < bets.size(); ++i)
-    {
-        PrizedPlayer prizedPlayer;
-        prizedPlayer.Player = bets[i].first;
-
-        prizedPlayer.Prizes = std::vector<int>(PRIZES_MAX);
-
-        int index = Find(prizes, prizedPlayer.Player);
-        if (index == -1) // new player
-        {
-            prizes.push_back(prizedPlayer);
-            index = prizes.size() - 1;
-        }
-        // index now contains the index of the player that will be rewarded
-
-		prizedPlayer.TotalBetsCount = bets[i].second.size();
-
-        for (int j = 0; j < prizedPlayer.TotalBetsCount; ++j)
-        {
-            int prize = GetPrizeId(bets[i].second[j], prizeKey);
-            if (prize != -1)
-			{
-                prizes[index].Prizes[prize] = prizes[index].Prizes[prize] + 1;
-				prizes[index].Keys.push_back(bets[i].second[j]);
-			}
-        }
-    }
-
-    for (size_t i = 0; i < prizes.size(); ++i)
-    {
-        bool hasPrizes = false;
-        for (size_t j = 0; j < prizes[i].Prizes.size(); ++j)
-        {
-            if (prizes[i].Prizes[j] != 0)
-                hasPrizes = true;
-        }
-
-        if (!hasPrizes)
-            prizes.erase(prizes.begin() + i);
-    }
-
-    return prizes;
+int GetPrizeForHit(int numbers, int stars)
+{
+	const int NO_PRIZE = -1;
+
+	switch (stars)
+	{
+	case 0:
+		switch (numbers)
+		{
+		case 2: return 12;
+		case 3: return 9;
+		case 4: return 5;
+		case 5: return 2;
+		default: return NO_PRIZE;
+		}
+		break;
+	case 1:
+		switch (numbers)
+		{
+		case 2: return 11;
+		case 3: return 8;
+		case 4: return 4;
+		case 5: return 1;
+		default: return NO_PRIZE;
+		}
+		break;
+	case 2:
+		switch (numbers)
+		{
+		case 1: return 10;
+		case 2: return 7;
+		case 3: return 6;
+		case 4: return 3;
+		case 5: return 0;
+		default: return NO_PRIZE;
+		}
+		break;
+	default:
+		return NO_PRIZE;
+	}
 }

 std::string GetHitForPrize(int prize)
@@ -357,6 +113,245 @@
 	}
 }

+Key GetKey(std::string& key)
+{
+    std::stringstream ss;
+
+    ss << key;
+
+    std::vector<int> numbers;
+    for (int i = 0; i < NUMBER_COUNT; ++i)
+    {
+        int n;
+        ss >> n;
+        numbers.push_back(n);
+    }
+
+    std::string se;
+    ss >> se; // number/star separator;
+
+    std::vector<int> stars; // line 2, stars
+    for (int i = 0; i < STAR_COUNT; ++i)
+    {
+        int s;
+        ss >> s;
+        stars.push_back(s);
+    }
+
+    if (numbers.size() == 0 || stars.size() == 0 || ss.bad())
+    {
+        std::cout << "Erro ao processar " << BETS_FILE_NAME << "." << std::endl;
+        exit(EXIT_FAILURE);
+    }
+
+    return std::make_pair(numbers, stars);
+}
+
+typedef std::pair<Player*, KeyList> PlayerBets;
+typedef std::vector<PlayerBets> PlayerBetsList;
+
+#define PRIZES_MAX 13
+
+PlayerBetsList GetBets(const PlayerList& players)
+{
+    std::ifstream file(BETS_FILE_NAME);
+    if (!file.is_open())
+    {
+        std::cout << "Erro ao processar " << BETS_FILE_NAME << "." << std::endl;
+        exit(EXIT_FAILURE);
+    }
+
+    PlayerBetsList betsList;
+
+    while (!file.eof())
+    {
+        std::string idStr;
+        std::getline(file, idStr);
+
+        int id = atoi(idStr.c_str());
+
+        Player* player = SearchPlayerById(const_cast<PlayerList&>(players), id);
+        if (player == NULL)
+        {
+            if (!file.eof())
+                std::cout << "Jogador " << id << " nao encontrado." << std::endl;
+            break;
+        }
+
+        KeyList keys;
+        std::string keyStr;
+        do
+        {
+            std::getline(file, keyStr);
+            if (keyStr != "")
+                keys.push_back(GetKey(keyStr));
+        } while (keyStr != "");
+
+        PlayerBets bets = std::make_pair(player, keys);
+        betsList.push_back(bets);
+    }
+
+    // Merge duplicated ids into the same user
+    for (size_t i = 0; i < betsList.size(); ++i) // BUG: not working fine for all the cases
+    {
+        for (size_t j = i + 1; j < betsList.size(); ++j)
+        {
+            if (betsList[i].first == betsList[j].first)
+            {
+                betsList[i].second.insert(betsList[i].second.end(), betsList[j].second.begin(), betsList[j].second.end());
+                betsList.erase(betsList.begin() + j);
+                --j;
+            }
+        }
+    }
+
+    return betsList;
+}
+
+struct Match
+{
+    Match(int numberCount, int starCount)
+    {
+        NumberCount = numberCount;
+        StarCount = starCount;
+    }
+
+    Match()
+    {
+        NumberCount = 0;
+        StarCount = 0;
+    }
+
+    int NumberCount;
+    int StarCount;
+};
+
+struct PrizeKeyRow
+{
+	int PrizeId;
+	std::string Hits;
+	int WinnerCount;
+	double Value;
+};
+
+typedef std::vector<PrizeKeyRow> PrizeKeyRows;
+
+Match CalculateMatchingKeys(const Key& a, const Key& b)
+{
+    int numberCount = 0;
+    int starCount = 0;
+
+    for (int i = 0; i < NUMBER_COUNT; ++i)
+    {
+        for (int j = 0; j < NUMBER_COUNT; ++j)
+        {
+            if (a.first[i] == b.first[j])
+                numberCount++;
+        }
+    }
+
+    for (int i = 0; i < STAR_COUNT; ++i)
+    {
+        for (int j = 0; j < STAR_COUNT; ++j)
+        {
+            if (a.second[i] == b.second[j])
+                starCount++;
+        }
+    }
+
+    Match match(numberCount, starCount);
+    return match;
+}
+
+int GetPrizeId(const Key& prizeKey, const Key& betKey)
+{
+    Match match = CalculateMatchingKeys(prizeKey, betKey);
+    return GetPrizeForHit(match.NumberCount, match.StarCount);
+}
+
+struct PrizedPlayer
+{
+	PrizedPlayer()
+	{
+		Reward = 0;
+	}
+
+	Player* Player; // the player
+	std::vector< std::pair<int, double> > Prizes; // prize and number of times it won
+	KeyList Keys; // prized keys
+	int TotalBetsCount; // number of bets (prized + non prized)
+	double Reward; // total money rewarded
+
+	void IncreaseBalance(double amount, int prize)
+	{
+		Player->Balance += amount;
+		Reward += amount;
+		Prizes[prize].second = amount / Prizes[prize].first;
+	}
+};
+
+typedef std::vector<PrizedPlayer> PrizedPlayers;
+
+// Returns the index of the player. If it does not exist, returns -1.
+int Find(const PrizedPlayers& prizedPlayers, const Player* player)
+{
+    for (size_t i = 0; i < prizedPlayers.size(); ++i)
+    {
+        if (prizedPlayers[i].Player == player)
+            return i;
+    }
+
+    return -1;
+}
+
+PrizedPlayers CalculatePrizedPlayers(const PlayerBetsList& bets, const Key& prizeKey)
+{
+    PrizedPlayers prizes;
+
+    for (size_t i = 0; i < bets.size(); ++i)
+    {
+        PrizedPlayer prizedPlayer;
+        prizedPlayer.Player = bets[i].first;
+
+        prizedPlayer.Prizes = std::vector< std::pair<int, double> >(PRIZES_MAX);
+
+        int index = Find(prizes, prizedPlayer.Player);
+        if (index == -1) // new player
+        {
+            prizes.push_back(prizedPlayer);
+            index = prizes.size() - 1;
+        }
+        // index now contains the index of the player that will be rewarded
+
+		prizedPlayer.TotalBetsCount = bets[i].second.size();
+
+        for (int j = 0; j < prizedPlayer.TotalBetsCount; ++j)
+        {
+            int prize = GetPrizeId(bets[i].second[j], prizeKey);
+            if (prize != -1)
+			{
+                prizes[index].Prizes[prize].first = prizes[index].Prizes[prize].first + 1;
+				prizes[index].Keys.push_back(bets[i].second[j]);
+			}
+        }
+    }
+
+    for (size_t i = 0; i < prizes.size(); ++i)
+    {
+        bool hasPrizes = false;
+        for (size_t j = 0; j < prizes[i].Prizes.size(); ++j)
+        {
+            if (prizes[i].Prizes[j].first != 0)
+                hasPrizes = true;
+        }
+
+        if (!hasPrizes)
+            prizes.erase(prizes.begin() + i);
+    }
+
+    return prizes;
+}
+
 PrizeKeyRows CalculatePrizes(const PlayerBetsList& bets, int totalBets, const Key& prizeKey, PrizedPlayers& prizes)
 {
     prizes = CalculatePrizedPlayers(bets, prizeKey);
@@ -364,7 +359,7 @@
     int existingPrizes[PRIZES_MAX] = {0};
     for (size_t i = 0; i < prizes.size(); ++i)
         for (size_t j = 0; j < prizes[i].Prizes.size(); ++j)
-            existingPrizes[j] += prizes[i].Prizes[j];
+            existingPrizes[j] += prizes[i].Prizes[j].first;

     int countPrizedBets = 0;
     int countPrizedPrizes = 0; // no pun intended
@@ -395,7 +390,7 @@
             continue;

         for (size_t j = 0; j < prizes.size(); ++j)
-            prizes[j].IncreaseBalance(prizes[j].Prizes[i] * row.Value);
+            prizes[j].IncreaseBalance(prizes[j].Prizes[i].first * row.Value, i);
     }

 	return prizeKeyRows;
@@ -426,7 +421,72 @@
 	file.close();
 }

-void WriteWinners(const PrizedPlayers& prizes)
+std::string WriteKeyForWinners(const Key& key, const Key& prizeKey, const std::vector< std::pair<int, double> >* prizes)
+{
+	std::stringstream ss;
+
+	int numbers = 0;
+	int stars = 0;
+	bool prize = false;
+
+	// Write number part of keys
+	for (int i = 0; i < NUMBER_COUNT; ++i)
+	{
+		ss << std::setw(2) << key.first[i];
+		for (int j = 0; j < NUMBER_COUNT; ++j)
+		{
+			if (key.first[i] == prizeKey.first[j])
+			{
+				ss << "*";
+				numbers++;
+				prize = true;
+			}
+		}
+
+		if (prize)
+			prize = false;
+		else
+			ss << " ";
+
+		ss << " ";
+	}
+
+	// Write star part of keys
+	for (int i = 0; i < STAR_COUNT; ++i)
+	{
+		ss << std::setw(2) << key.second[i];
+		for (int j = 0; j < STAR_COUNT; ++j)
+		{
+			if (key.second[i] == prizeKey.second[j])
+			{
+				ss << "*";
+				stars++;
+				prize = true;
+			}
+		}
+
+		if (prize)
+			prize = false;
+		else
+			ss << " ";
+
+		ss << " ";
+	}
+
+	ss << "   ";
+
+	int prizeId = GetPrizeForHit(numbers, stars);
+
+	// Write prize in "hit" form
+	ss << "(" << GetHitForPrize(prizeId) << ")=";
+
+	// Write awarded money for this key
+	ss << std::setprecision(2) << std::fixed << prizes->at(prizeId).second;
+
+	return ss.str();
+}
+
+void WriteWinners(const PrizedPlayers& prizes, const Key& prizeKey)
 {
 	std::ofstream file(WINNERS_FILE_NAME);
 	if (!file.is_open())
@@ -450,12 +510,11 @@
 		file << " - ";

 		// write total reward
-		file << std::setprecision(2) << std::setiosflags(std::ios::fixed) << plr->Reward;
+		file << std::setprecision(2) << std::fixed << plr->Reward;
 		file << std::endl;

-		// ...
-
-		file << std::endl;
+		for (size_t i = 0; i < plr->Keys.size(); ++i)
+			file << WriteKeyForWinners(plr->Keys[i], prizeKey, &plr->Prizes) << std::endl;
 	}
 }

@@ -491,7 +550,7 @@

 	// Create winners.txt
 	std::cout << "- A criar ficheiro de winners..." << std::endl;
-	WriteWinners(prizedPlayers);
+	WriteWinners(prizedPlayers, prizeKey);

     // ...


[EventEngine] Fix race on WorkQueue's most-recent element (#31557)

--- src/core/lib/event_engine/work_queue.cc
+++ src/core/lib/event_engine/work_queue.cc
@@ -147,15 +147,7 @@
             std::memory_order_relaxed) == kInvalidTimestamp) {
       return nullptr;
     }
-    if (!most_recent_element_lock_.TryLock()) return nullptr;
-    absl::optional<Storage> ret;
-    if (GPR_LIKELY(most_recent_element_.has_value())) {
-      most_recent_element_enqueue_timestamp_.store(kInvalidTimestamp,
-                                                   std::memory_order_relaxed);
-      ret = std::exchange(most_recent_element_, absl::nullopt);
-    }
-    most_recent_element_lock_.Unlock();
-    return ret->closure();
+    return TryPopMostRecentElement();
   }
   // the queue has elements, let's pop one and update timestamps
   Storage ret_s;


Add support for multiple styles in the fallback fonts.

bug: 4390209
Change-Id: I74774b43b3f0c903fb96911e156d9911cf55bb68

--- src/ports/SkFontHost_android.cpp
+++ src/ports/SkFontHost_android.cpp
@@ -428,11 +428,14 @@
         them in the order we want them to be accessed by NextLogicalFont().
      */
     { "DroidSansArabic.ttf",        gFBNames    },
-    { "DroidSansHebrew.ttf",        gFBNames    },
+    { "DroidSansHebrew-Regular.ttf",gFBNames    },
+    { "DroidSansHebrew-Bold.ttf",   NULL        },
     { "DroidSansThai.ttf",          gFBNames    },
     { "MTLmr3m.ttf",                gFBNames    }, // Motoya Japanese Font
     { "MTLc3m.ttf",                 gFBNames    }, // Motoya Japanese Font
     { "DroidSansJapanese.ttf",      gFBNames    },
+    { "DroidSansEthiopic-Regular.ttf",gFBNames  },
+    { "DroidSansEthiopic-Bold.ttf", NULL        },
     { "DroidSansFallback.ttf",      gFBNames    }
 };

@@ -639,6 +642,16 @@
 SkFontID SkFontHost::NextLogicalFont(SkFontID currFontID, SkFontID origFontID) {
     load_system_fonts();

+    const SkTypeface* origTypeface = find_from_uniqueID(origFontID);
+    const SkTypeface* currTypeface = find_from_uniqueID(currFontID);
+
+    SkASSERT(origTypeface != 0);
+    SkASSERT(currTypeface != 0);
+
+    // Our fallback list always stores the id of the plain in each fallback
+    // family, so we transform currFontID to its plain equivalent.
+    currFontID = find_typeface(currTypeface, SkTypeface::kNormal)->uniqueID();
+
     /*  First see if fontID is already one of our fallbacks. If so, return
         its successor. If fontID is not in our list, then return the first one
         in our list. Note: list is zero-terminated, and returning zero means
@@ -647,10 +660,17 @@
     const uint32_t* list = gFallbackFonts;
     for (int i = 0; list[i] != 0; i++) {
         if (list[i] == currFontID) {
-            return list[i+1];
-        }
-    }
-    return list[0];
+            if (list[i+1] == 0)
+                return 0;
+            const SkTypeface* nextTypeface = find_from_uniqueID(list[i+1]);
+            return find_typeface(nextTypeface, origTypeface->style())->uniqueID();
+        }
+    }
+
+    // If we get here, currFontID was not a fallback, so we start at the
+    // beginning of our list.
+    const SkTypeface* firstTypeface = find_from_uniqueID(list[0]);
+    return find_typeface(firstTypeface, origTypeface->style())->uniqueID();
 }

 ///////////////////////////////////////////////////////////////////////////////


The test for LSP=A is now valid for S having zero rows


Patch from James Larcombe for SCI_DELLINERIGHT, SCI_DELLINELEFT and CARET_XEVEN.

--- src/Editor.cxx
+++ src/Editor.cxx
@@ -620,7 +620,7 @@
 		int xOffsetNew = xOffset;
 		if (pt.x < rcClient.left) {
 			xOffsetNew = xOffset - (rcClient.left - pt.x);
-		} else if (((xOffset > 0) && useMargin) || pt.x >= rcClient.right) {
+		} else if (((caretPolicy & CARET_XEVEN) && ((xOffset > 0) && useMargin)) || pt.x >= rcClient.right) {
 			xOffsetNew = xOffset + (pt.x - rcClient.right);
 			int xOffsetEOL = xOffset + (ptEOL.x - rcClient.right) - xMargin + 2;
 			//Platform::DebugPrintf("Margin %d %d\n", xOffsetNew, xOffsetEOL);
@@ -2012,6 +2012,8 @@
 	case SCI_VCHOMEEXTEND:
 	case SCI_DELWORDLEFT:
 	case SCI_DELWORDRIGHT:
+	case SCI_DELLINELEFT:
+	case SCI_DELLINERIGHT:
 	case SCI_LINECUT:
 	case SCI_LINEDELETE:
 	case SCI_LINETRANSPOSE:
@@ -2295,6 +2297,21 @@
 	case SCI_DELWORDRIGHT: {
 			int endWord = pdoc->NextWordStart(currentPos, 1);
 			pdoc->DeleteChars(currentPos, endWord - currentPos);
+			MovePositionTo(currentPos);
+		}
+		break;
+	case SCI_DELLINELEFT: {
+			int line = pdoc->LineFromPosition(currentPos);
+			int start = pdoc->LineStart(line);
+			pdoc->DeleteChars(start,currentPos - start);
+			MovePositionTo(start);
+			SetLastXChosen();
+		}
+		break;
+	case SCI_DELLINERIGHT: {
+			int line = pdoc->LineFromPosition(currentPos);
+			int end = pdoc->LineEnd(line);
+			pdoc->DeleteChars(currentPos,end - currentPos);
 			MovePositionTo(currentPos);
 		}
 		break;
@@ -4356,6 +4373,8 @@
 	case SCI_ZOOMOUT:
 	case SCI_DELWORDLEFT:
 	case SCI_DELWORDRIGHT:
+	case SCI_DELLINELEFT:
+	case SCI_DELLINERIGHT:
 	case SCI_LINECUT:
 	case SCI_LINEDELETE:
 	case SCI_LINETRANSPOSE:


[SC-166] Update butterfly view on scaling, projector and compensator changes

--- applications/mne_scan/libs/scDisp/realtimeevokedsetwidget.cpp
+++ applications/mne_scan/libs/scDisp/realtimeevokedsetwidget.cpp
@@ -452,7 +452,10 @@
         m_pQuickControlView->addGroupBox(pScalingView, "Scaling");

         connect(pScalingView, &ScalingView::scalingChanged,
-                m_pEvokedSetModel.data(), &EvokedSetModel::setScaling);
+                m_pEvokedSetModel.data(), &EvokedSetModel::setScaling);
+
+        connect(pScalingView, &ScalingView::scalingChanged,
+                m_pButterflyView.data(), &ButterflyView::updateView);

         connect(pScalingView, &ScalingView::scalingChanged,
                 m_pAverageLayoutView.data(), &AverageLayoutView::setScaleMap);
@@ -465,6 +468,9 @@
         connect(pProjectorsView, &ProjectorsView::projSelectionChanged,
                 m_pEvokedSetModel.data(), &EvokedSetModel::updateProjection);

+        connect(pProjectorsView, &ProjectorsView::projSelectionChanged,
+                m_pButterflyView.data(), &ButterflyView::updateView);
+
         //Activate projectors by default
         m_pEvokedSetModel->updateProjection();

@@ -475,6 +481,9 @@

         connect(pCompensatorView, &CompensatorView::compSelectionChanged,
                 m_pEvokedSetModel.data(), &EvokedSetModel::updateCompensator);
+
+        connect(pCompensatorView, &CompensatorView::compSelectionChanged,
+                m_pButterflyView.data(), &ButterflyView::updateView);

         // Quick control filter settings
         FilterSettingsView* pFilterSettingsView = new FilterSettingsView();


Fix broken android build

Fix broken android build

git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@3404 2bbb7eff-a529-9590-31e7-b0007b416f81

--- src/ports/SkFontHost_android.cpp
+++ src/ports/SkFontHost_android.cpp
@@ -552,7 +552,7 @@

 //        SkDebugf("---- SkTypeface[%d] %s fontID %d\n", i, rec[i].fFileName, tf->uniqueID());

-        FallbackScripts fallbackScript = SkGetScriptFromFileName(rec[i].fFileName);
+        FallbackScripts fallbackScript = SkGetFallbackScriptFromID(rec[i].fFileName);
         if (SkTypeface_ValidScript(fallbackScript)) {
             gFallbackScriptsMap[fallbackScript] = tf->uniqueID();
         }


Fixed a bug where some Android devices would not print the infolog after a shader compile error.

--- gameplay/src/Effect.cpp
+++ gameplay/src/Effect.cpp
@@ -245,6 +245,10 @@
     if (success != GL_TRUE)
     {
         GL_ASSERT( glGetShaderiv(vertexShader, GL_INFO_LOG_LENGTH, &length) );
+        if (length == 0)
+        {
+            length = 4096;
+        }
         if (length > 0)
         {
             infoLog = new char[length];
@@ -256,7 +260,7 @@
         if (vshPath)
             writeShaderToErrorFile(vshPath, shaderSource[2]);

-        GP_ERROR("Compile failed for vertex shader '%s' with error '%s'.", vshPath == NULL ? "NULL" : vshPath, infoLog == NULL ? "" : infoLog);
+        GP_ERROR("Compile failed for vertex shader '%s' with error '%s'.", vshPath == NULL ? vshSource : vshPath, infoLog == NULL ? "" : infoLog);
         SAFE_DELETE_ARRAY(infoLog);

         // Clean up.
@@ -284,6 +288,10 @@
     if (success != GL_TRUE)
     {
         GL_ASSERT( glGetShaderiv(fragmentShader, GL_INFO_LOG_LENGTH, &length) );
+        if (length == 0)
+        {
+            length = 4096;
+        }
         if (length > 0)
         {
             infoLog = new char[length];
@@ -295,7 +303,7 @@
         if (fshPath)
             writeShaderToErrorFile(fshPath, shaderSource[2]);

-        GP_ERROR("Compile failed for fragment shader (%s): %s", fshPath == NULL ? "NULL" : fshPath, infoLog == NULL ? "" : infoLog);
+        GP_ERROR("Compile failed for fragment shader (%s): %s", fshPath == NULL ? fshSource : fshPath, infoLog == NULL ? "" : infoLog);
         SAFE_DELETE_ARRAY(infoLog);

         // Clean up.
@@ -320,6 +328,10 @@
     if (success != GL_TRUE)
     {
         GL_ASSERT( glGetProgramiv(program, GL_INFO_LOG_LENGTH, &length) );
+        if (length == 0)
+        {
+            length = 4096;
+        }
         if (length > 0)
         {
             infoLog = new char[length];


Patch from Mark to avoid unnecessary save point notification.

--- src/Editor.cxx
+++ src/Editor.cxx
@@ -4018,7 +4018,6 @@

 	case SCI_SETSAVEPOINT:
 		pdoc->SetSavePoint();
-		NotifySavePoint(true);
 		break;

 	case SCI_GETSTYLEDTEXT: {


fix property callback function bug

fix property callback function bug

Former-commit-id: 00f2a0a9ff3965464ce5b3135b370a668b233a21 [formerly 64b39a8821280f537cd99726a5786878f9352a3b] [formerly 1cf06c5c259eb721874f6ffe4aa8044524d6ae68 [formerly b151402c60d6e57de8e8d134ffd681b1d7a78045]]
Former-commit-id: 5b4541482eab3b0ff575d23002ba6b9d70dd25be [formerly 3a92546f926f21760d4aa5ff888cdf8f4dbb8db9]
Former-commit-id: 7f851f65414025d4d32363cf08618deb6aba2bce
Former-commit-id: ee7e66c756cc70c458227ac6953419f237fbd63e

--- Frame/SDK/Core/AFCPropertyMgr.cpp
+++ Frame/SDK/Core/AFCPropertyMgr.cpp
@@ -21,7 +21,7 @@

 void AFCPropertyMgr::Clear()
 {
-    for (size_t i = 0; i < mxPropertys.size(); ++i)
+    for(size_t i = 0; i < mxPropertys.size(); ++i)
     {
         delete mxPropertys[i];
     }
@@ -38,7 +38,7 @@
 bool AFCPropertyMgr::RegisterCallback(const std::string& strProperty, const PROPERTY_EVENT_FUNCTOR_PTR& cb)
 {
     size_t index;
-    if (!FindIndex(strProperty.c_str(), index))
+    if(!FindIndex(strProperty.c_str(), index))
     {
         return false;
     }
@@ -49,7 +49,7 @@

 bool AFCPropertyMgr::FindIndex(const char* name, size_t& index)
 {
-    if (!mxIndices.GetData(name, index))
+    if(!mxIndices.GetData(name, index))
     {
         return false;
     }
@@ -59,14 +59,15 @@

 bool AFCPropertyMgr::OnPropertyCallback(const char* name, const AFIData& oldData, const AFIData& newData)
 {
-    if (mxPropertyCBs.empty())
-    {
-        return false;
-    }
-
-    for (auto& iter : mxPropertyCBs)
-    {
-        (*(iter.second))(mxSelf, name, oldData, newData);
+    if(mxPropertyCBs.empty())
+    {
+        return false;
+    }
+
+    auto& range = mxPropertyCBs.equal_range(name);
+    for(auto& iter = range.first; iter != range.second; ++iter)
+    {
+        (*(iter->second))(mxSelf, name, oldData, newData);
     }

     return true;
@@ -90,7 +91,7 @@
 bool AFCPropertyMgr::SetProperty(const char* name, const AFIData& value)
 {
     size_t index;
-    if (!FindIndex(name, index))
+    if(!FindIndex(name, index))
     {
         return false;
     }
@@ -105,7 +106,7 @@
 bool AFCPropertyMgr::SetPropertyBool(const char* name, const bool value)
 {
     size_t index;
-    if (!FindIndex(name, index))
+    if(!FindIndex(name, index))
     {
         return false;
     }
@@ -117,7 +118,7 @@

     mxPropertys[index]->prop_value.SetBool(value);

-    if (oldValue != value)
+    if(oldValue != value)
     {
         //property callbacks
         OnPropertyCallback(name, oldData, mxPropertys[index]->prop_value);
@@ -129,7 +130,7 @@
 bool AFCPropertyMgr::SetPropertyInt(const char* name, const int32_t value)
 {
     size_t index;
-    if (!FindIndex(name, index))
+    if(!FindIndex(name, index))
     {
         return false;
     }
@@ -141,7 +142,7 @@

     mxPropertys[index]->prop_value.SetInt(value);

-    if (oldValue != value)
+    if(oldValue != value)
     {
         //property callbacks
         OnPropertyCallback(name, oldData, mxPropertys[index]->prop_value);
@@ -153,7 +154,7 @@
 bool AFCPropertyMgr::SetPropertyInt64(const char* name, const int64_t value)
 {
     size_t index;
-    if (!FindIndex(name, index))
+    if(!FindIndex(name, index))
     {
         return false;
     }
@@ -165,7 +166,7 @@

     mxPropertys[index]->prop_value.SetInt64(value);

-    if (oldValue != value)
+    if(oldValue != value)
     {
         //property callbacks
         OnPropertyCallback(name, oldData, mxPropertys[index]->prop_value);
@@ -177,7 +178,7 @@
 bool AFCPropertyMgr::SetPropertyFloat(const char* name, const float value)
 {
     size_t index;
-    if (!FindIndex(name, index))
+    if(!FindIndex(name, index))
     {
         return false;
     }
@@ -189,7 +190,7 @@

     mxPropertys[index]->prop_value.SetFloat(value);

-    if (!IsZeroFloat(oldValue - value))
+    if(!IsZeroFloat(oldValue - value))
     {
         //property callbacks
         OnPropertyCallback(name, oldData, mxPropertys[index]->prop_value);
@@ -201,7 +202,7 @@
 bool AFCPropertyMgr::SetPropertyDouble(const char* name, const double value)
 {
     size_t index;
-    if (!FindIndex(name, index))
+    if(!FindIndex(name, index))
     {
         return false;
     }
@@ -213,7 +214,7 @@

     mxPropertys[index]->prop_value.SetDouble(value);

-    if (!IsZeroDouble(oldValue - value))
+    if(!IsZeroDouble(oldValue - value))
     {
         //property callbacks
         OnPropertyCallback(name, oldData, mxPropertys[index]->prop_value);
@@ -225,7 +226,7 @@
 bool AFCPropertyMgr::SetPropertyString(const char* name, const std::string& value)
 {
     size_t index;
-    if (!FindIndex(name, index))
+    if(!FindIndex(name, index))
     {
         return false;
     }
@@ -237,7 +238,7 @@

     mxPropertys[index]->prop_value.SetString(value.c_str());

-    if (oldValue == value)
+    if(oldValue == value)
     {
         //property callbacks
         OnPropertyCallback(name, oldData, mxPropertys[index]->prop_value);
@@ -249,7 +250,7 @@
 bool AFCPropertyMgr::SetPropertyObject(const char* name, const AFGUID& value)
 {
     size_t index;
-    if (!FindIndex(name, index))
+    if(!FindIndex(name, index))
     {
         return false;
     }
@@ -261,7 +262,7 @@

     mxPropertys[index]->prop_value.SetObject(value);

-    if (oldValue == value)
+    if(oldValue == value)
     {
         //property callbacks
         OnPropertyCallback(name, oldData, mxPropertys[index]->prop_value);
@@ -273,7 +274,7 @@
 bool AFCPropertyMgr::GetPropertyBool(const char* name)
 {
     size_t index;
-    if (!FindIndex(name, index))
+    if(!FindIndex(name, index))
     {
         return NULL_BOOLEAN;
     }
@@ -284,7 +285,7 @@
 int32_t AFCPropertyMgr::GetPropertyInt(const char* name)
 {
     size_t index;
-    if (!FindIndex(name, index))
+    if(!FindIndex(name, index))
     {
         return NULL_INT;
     }
@@ -295,7 +296,7 @@
 int64_t AFCPropertyMgr::GetPropertyInt64(const char* name)
 {
     size_t index;
-    if (!FindIndex(name, index))
+    if(!FindIndex(name, index))
     {
         return NULL_INT64;
     }
@@ -306,7 +307,7 @@
 float AFCPropertyMgr::GetPropertyFloat(const char* name)
 {
     size_t index;
-    if (!FindIndex(name, index))
+    if(!FindIndex(name, index))
     {
         return NULL_FLOAT;
     }
@@ -317,7 +318,7 @@
 double AFCPropertyMgr::GetPropertyDouble(const char* name)
 {
     size_t index;
-    if (!FindIndex(name, index))
+    if(!FindIndex(name, index))
     {
         return NULL_DOUBLE;
     }
@@ -328,7 +329,7 @@
 const char* AFCPropertyMgr::GetPropertyString(const char* name)
 {
     size_t index;
-    if (!FindIndex(name, index))
+    if(!FindIndex(name, index))
     {
         return NULL_STR.c_str();
     }
@@ -339,7 +340,7 @@
 const AFGUID& AFCPropertyMgr::GetPropertyObject(const char* name)
 {
     size_t index;
-    if (!FindIndex(name, index))
+    if(!FindIndex(name, index))
     {
         return NULL_GUID;
     }


rewrite next move (algorithmic) conditions

--- applicationsSrc/reconfCatoms2D/centralizedReconfiguration.cpp
+++ applicationsSrc/reconfCatoms2D/centralizedReconfiguration.cpp
@@ -132,46 +132,14 @@
 }

 static Catoms2DMove* nextMove(Catoms2DBlock  *c) {
-  P2PNetworkInterface *p1 = NULL, *p2 = NULL;
-  Catoms2DBlock  *pivot;
-  int i = 0;
-
-  // pick-up a neighbor of c
-  for (i = 0; i < 6; i++) {
-    p1 = c->getInterface((NeighborDirection::Direction)i);
-    if (p1->connectedInterface) {
-      break;
-    }
-  }
-
-  if ((i == 5) && !p1->connectedInterface) {
-    return NULL;
-  }
-
-  p2 = p1;
-  cout << "p1 dir: " << c->getDirection(p2) << endl;
-  while (true) {
-    if (ROTATION_DIRECTION == Catoms2DMove::ROTATE_CCW) {
-      p2 = nextInterface(c, Catoms2DMove::ROTATE_CW, p2);
-    } else if (ROTATION_DIRECTION == Catoms2DMove::ROTATE_CW) {
-      p2 = nextInterface(c, Catoms2DMove::ROTATE_CCW, p2);
-    }
-
-    cout << "p2 dir: " << c->getDirection(p2) << endl;
-    if (p2->connectedInterface) {
-      cout << "connected p2 dir: " << c->getDirection(p2) << endl;
-      pivot = (Catoms2DBlock*)p2->connectedInterface->hostBlock;
-      Catoms2DMove m(pivot,ROTATION_DIRECTION);
-      if (c->canMove(m)) {
-	cout << c->blockId << " can move arround " << pivot->blockId << endl;
-	return new Catoms2DMove(m);
-      }
-      cout << "can't move" << endl;
-    }
-    if (p1 == p2) {
-      return NULL;
-    }
-  }
+  P2PNetworkInterface *p2p = lastNeighborInDirection(c,ROTATION_DIRECTION);
+  Catoms2DBlock* pivot = (Catoms2DBlock*)p2p->connectedInterface->hostBlock;
+  Catoms2DMove m(pivot,ROTATION_DIRECTION);
+  if (c->canMove(m)) {
+    cout << c->blockId << " can move arround " << pivot->blockId << endl;
+    return new Catoms2DMove(m);
+  }
+  return NULL;
 }

 static Coordinate getPosition(Catoms2DBlock* c, Catoms2DMove &m) {


Fixed slices rendering order in RayMarchingState.

--- src/presets/RayMarchingStage.cpp
+++ src/presets/RayMarchingStage.cpp
@@ -99,7 +99,7 @@
     for( unsigned int sliceIdx = 0; sliceIdx < sampleRate; ++sliceIdx )
     {
         const float progress = static_cast< float >( sliceIdx ) / ( sampleRate - 1 );
-        const float offset = 2 * radius * ( 0.5f - progress );
+        const float   offset = -2 * radius * ( 0.5f - progress );

         /* Create slice vertices.
          */


CSharp: Fix default value for ImGuiDock API.

--- Source/CSharp/Generator/Pass/CSharp/Urho3DCustomPass.cpp
+++ Source/CSharp/Generator/Pass/CSharp/Urho3DCustomPass.cpp
@@ -37,6 +37,9 @@
     // cppast bug workaround
     if (auto* entity = generator->GetSymbol("Urho3D::Localization::Get(Urho3D::String const&,int)"))
         entity->children_[1]->defaultValue_ = "-1";
+
+    if (auto* entity = generator->GetSymbol("ImGui::BeginDock(char const*,bool*,ImGuiWindowFlags,ImVec2 const&)"))
+        entity->children_[3]->defaultValue_ = "new Vector2(-1, -1)";
 }

 bool Urho3DCustomPassLate::Visit(MetaEntity* entity, cppast::visitor_info info)


iox-#261 Rephrase doxygen comment in allocator

Signed-off-by: Simon Hoinkis <f0773326fce8fa552c28fe58d0e558a9f1b7687f@apex.ai>

--- iceoryx_utils/include/iceoryx_utils/internal/posix_wrapper/shared_memory_object/allocator.hpp
+++ iceoryx_utils/include/iceoryx_utils/internal/posix_wrapper/shared_memory_object/allocator.hpp
@@ -45,7 +45,7 @@
     /// @brief allocates on the memory supplied with the ctor
     /// @param[in] size of the memory to allocate
     /// @param[in] alignment of the memory to allocate
-    /// @note terminates if out of memory of finalizeAllocation was called before
+    /// @note May terminate if out of memory or finalizeAllocation() was called before
     void* allocate(const uint64_t size, const uint64_t alignment) noexcept;

   protected:


fixed: ssm crash as camera is changed

fixed: ssm crash as camera is changed

git-svn-id: 6c7e10cdde2c115f53707ba8ec4efe535f92d362@1513 4683daeb-ad0f-0410-a623-93161e962ae5

--- Source/System/Window/Utilities/OSGSimpleSceneManager.cpp
+++ Source/System/Window/Utilities/OSGSimpleSceneManager.cpp
@@ -444,7 +444,8 @@
     if(camera == NULL)
         return;

-    camera->setBeacon(_camera->getBeacon());
+    if(_camera != NULL)
+        camera->setBeacon(_camera->getBeacon());

     PerspectiveCamera *oldPer  =
         dynamic_pointer_cast<PerspectiveCamera>(_camera);
@@ -469,8 +470,11 @@
                   " different or unsupported camera types!\n"));
     }

-    camera->setNear(_camera->getNear());
-    camera->setFar (_camera->getFar());
+    if(_camera != NULL)
+    {
+        camera->setNear(_camera->getNear());
+        camera->setFar (_camera->getFar());
+    }

     for(UInt32 i=0;i<_win->getMFPort()->size();++i)


fixed dumb logic error in RunFile

fixed dumb logic error in RunFile

--- Source/UnrealEnginePython/Private/UnrealEnginePython.cpp
+++ Source/UnrealEnginePython/Private/UnrealEnginePython.cpp
@@ -519,12 +519,13 @@
 {
 	FScopePythonGIL gil;
 	FString full_path = UTF8_TO_TCHAR(filename);
+	FString original_path = full_path;
 	bool foundFile = false;
 	if (!FPaths::FileExists(filename))
 	{
 		for (FString ScriptsPath : ScriptsPaths)
 		{
-			full_path = FPaths::Combine(*ScriptsPath, full_path);
+			full_path = FPaths::Combine(*ScriptsPath, original_path);
 			if (FPaths::FileExists(full_path))
 			{
 				foundFile = true;


clean code

clean code

--- Source/UnrealSandboxTerrain/Private/SandboxVoxeldata.cpp
+++ Source/UnrealSandboxTerrain/Private/SandboxVoxeldata.cpp
@@ -429,11 +429,7 @@
         }
     }

-    FORCEINLINE void handleTriangle(TmpPoint &tmp1, TmpPoint &tmp2, TmpPoint &tmp3) {
-        //vp1 = vp1 + voxel_data.getOrigin();
-        //vp2 = vp2 + voxel_data.getOrigin();
-        //vp3 = vp3 + voxel_data.getOrigin();
-
+    FORCEINLINE void handleTriangle(TmpPoint &tmp1, TmpPoint &tmp2, TmpPoint &tmp3) {
 		FVector n = clcNormal(tmp1.v, tmp2.v, tmp3.v);
 		n = -n;

@@ -517,7 +513,6 @@
     }
 };

-//#define VoxelMeshExtractorPtr std::shared_ptr<VoxelMeshExtractor>
 typedef std::shared_ptr<VoxelMeshExtractor> VoxelMeshExtractorPtr;

 MeshDataPtr sandboxVoxelGenerateMesh(const VoxelData &vd, const VoxelDataParam &vdp) {


v1.6 only fixes to get v1.6 based build working on Apple Mac OS X

--- src/FXStat.cpp
+++ src/FXStat.cpp
@@ -83,6 +83,8 @@
 			{
 #if defined(__linux__)
 				// Unsupported at present
+#elif defined(__APPLE__)
+				// Unsupported at present
 #elif defined(__FreeBSD__)
 				created->set_time_t(st.st_birthtimespec.tv_sec);
 				created->value+=st.st_birthtimespec.tv_nsec/1000;
@@ -95,7 +97,7 @@
 #if defined(__linux__)
 				lastModified->set_time_t(st.st_mtim.tv_sec);
 				lastModified->value+=st.st_mtim.tv_nsec/1000;
-#elif defined(__FreeBSD__)
+#elif defined(__APPLE__) || defined(__FreeBSD__)
 				lastModified->set_time_t(st.st_mtimespec.tv_sec);
 				lastModified->value+=st.st_mtimespec.tv_nsec/1000;
 #else
@@ -107,7 +109,7 @@
 #if defined(__linux__)
 				lastAccessed->set_time_t(st.st_atim.tv_sec);
 				lastAccessed->value+=st.st_atim.tv_nsec/1000;
-#elif defined(__FreeBSD__)
+#elif defined(__APPLE__) || defined(__FreeBSD__)
 				lastAccessed->set_time_t(st.st_atimespec.tv_sec);
 				lastAccessed->value+=st.st_atimespec.tv_nsec/1000;
 #else
@@ -194,7 +196,7 @@
 			times[0].tv_usec=orig.st_atim.tv_nsec/1000;
 			times[1].tv_sec =orig.st_mtim.tv_sec;
 			times[1].tv_usec=orig.st_mtim.tv_nsec/1000;
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__APPLE__)
 			times[0].tv_sec =orig.st_atimespec.tv_sec;
 			times[0].tv_usec=orig.st_atimespec.tv_nsec/1000;
 			times[1].tv_sec =orig.st_mtimespec.tv_sec;


add nb seq filled and nb seq returned (comparison may remove some)

--- src/Filler.cpp
+++ src/Filler.cpp
@@ -350,6 +350,9 @@
 					_object->gapFill<span>(infostring,_tid,sourceSequence2,targetSequence2,filledSequences,begin_kmer_repeated,end_kmer_repeated,true);
 				}

+				infostring +=   Stringify::format ("\t%d", filledSequences.size()) ;
+
+
 				//Checks if all sequences are roughly the same :
 				if (all_consensuses_almost_identical(filledSequences,90))
 				{
@@ -363,6 +366,9 @@
 				}
 				else
 					;
+
+				infostring +=   Stringify::format ("\t%d", filledSequences.size()) ;
+
 				//if(verb)   printf(" [MULTIPLE SOLUTIONS]\n");

 				// TODO ecrire les resultats dans le fichier (method) : attention checker si mode Une ou Multiple Solutions
@@ -505,6 +511,8 @@
 			object->gapFill<span>(infostring,0,sourceSequence2,targetSequence2,filledSequences,begin_kmer_repeated,end_kmer_repeated,true);
 		}

+		infostring +=   Stringify::format ("\t%d", filledSequences.size()) ;
+
 		//Checks if all sequences are roughly the same :
 		if (all_consensuses_almost_identical(filledSequences,90))
 		{
@@ -519,7 +527,8 @@
 		else
 			;
 		//if(verb)   printf(" [MULTIPLE SOLUTIONS]\n");
-
+		infostring +=   Stringify::format ("\t%d", filledSequences.size()) ;
+

 		// TODO ecrire les resultats dans le fichier (method) : attention checker si mode Une ou Multiple Solutions
 		object->writeFilledBreakpoint(filledSequences,breakpointName,infostring);


Fixes bug in computing time difference when using an init value

Global::getTimeDiff did not account for differences in init times.

--- src/Global.cpp
+++ src/Global.cpp
@@ -141,7 +141,7 @@
    boost::gregorian::date_period diff(date2, date1);
    long int numDays = diff.length().days();

-   return numDays*24 + (iOffset1 - iOffset2);
+   return numDays*24 + (iInit1 - iInit2) + (iOffset1 - iOffset2);
 }

 float Global::getJulianDay(int iDate, int iInit, float iOffset) {


Verify that sizes in Copy are compatible.

--- general/mem_manager.hpp
+++ general/mem_manager.hpp
@@ -470,22 +470,16 @@
    inline bool DeviceIsValid() const;

    /// Copy @a size entries from @a src to @a *this.
-   /** The given @a size should not exceed the Capacity() of the source @a src
-       and the destination, @a *this. */
    inline void CopyFrom(const Memory &src, int size);

    /// Copy @a size entries from the host pointer @a src to @a *this.
-   /** The given @a size should not exceed the Capacity() of @a *this. */
    inline void CopyFromHost(const T *src, int size);

    /// Copy @a size entries from @a *this to @a dest.
-   /** The given @a size should not exceed the Capacity() of @a *this and the
-       destination, @a dest. */
    inline void CopyTo(Memory &dest, int size) const
    { dest.CopyFrom(*this, size); }

    /// Copy @a size entries from @a *this to the host pointer @a dest.
-   /** The given @a size should not exceed the Capacity() of @a *this. */
    inline void CopyToHost(T *dest, int size) const;

    /// Print the internal flags.
@@ -1087,6 +1081,7 @@
 template <typename T>
 inline void Memory<T>::CopyFrom(const Memory &src, int size)
 {
+   MFEM_VERIFY(src.capacity>=size && capacity>=size, "Incorrect size");
    if (!(flags & REGISTERED) && !(src.flags & REGISTERED))
    {
       if (h_ptr != src.h_ptr && size != 0)
@@ -1106,6 +1101,7 @@
 template <typename T>
 inline void Memory<T>::CopyFromHost(const T *src, int size)
 {
+   MFEM_VERIFY(capacity>=size, "Incorrect size");
    if (!(flags & REGISTERED))
    {
       if (h_ptr != src && size != 0)
@@ -1125,6 +1121,7 @@
 template <typename T>
 inline void Memory<T>::CopyToHost(T *dest, int size) const
 {
+   MFEM_VERIFY(capacity>=size, "Incorrect size");
    if (!(flags & REGISTERED))
    {
       if (h_ptr != dest && size != 0)


ENH: Merge changes from main tree into VTK-5-2 branch. (cvs -q up -j1.39 -j1.40 Graphics/vtkQuadricDecimation.cxx)

--- Graphics/vtkQuadricDecimation.cxx
+++ Graphics/vtkQuadricDecimation.cxx
@@ -55,7 +55,7 @@
 #include "vtkPriorityQueue.h"
 #include "vtkTriangle.h"

-vtkCxxRevisionMacro(vtkQuadricDecimation, "1.39");
+vtkCxxRevisionMacro(vtkQuadricDecimation, "1.39.50.1");
 vtkStandardNewMacro(vtkQuadricDecimation);

@@ -1116,7 +1116,7 @@
     this->Mesh->GetCellPoints(cellId, npts, pts);
     // making sure we don't already have the triangle we're about to
     // change this one to
-    if (pts[0] == pt1Id && this->Mesh->IsTriangle(pt0Id, pts[1], pts[2]) ||
+    if ((pts[0] == pt1Id && this->Mesh->IsTriangle(pt0Id, pts[1], pts[2])) ||
         (pts[1] == pt1Id && this->Mesh->IsTriangle(pts[0], pt0Id, pts[2])) ||
         (pts[2] == pt1Id && this->Mesh->IsTriangle(pts[0], pts[1], pt0Id)))
       {


Marshall Clow found some divide-by-zero warnings with UBSan in rand's binomial_distribution test.  This eliminates the divide-by-zeros and describes in comments the numerical difficulties the test is having.  Each of the problematic tests are exploring edge cases of the distribution.

git-svn-id: 756ef344af921d95d562d9e9f9389127a89a6314@177826 91177308-0d34-0410-b5e6-96231b3b80d8

--- test/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
+++ test/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
@@ -177,15 +177,23 @@
         }
         var /= u.size();
         double dev = std::sqrt(var);
-        skew /= u.size() * dev * var;
-        kurtosis /= u.size() * var * var;
-        kurtosis -= 3;
-        double x_mean = d.t() * d.p();
-        double x_var = x_mean*(1-d.p());
-        double x_skew = (1-2*d.p()) / std::sqrt(x_var);
-        double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+        // In this case:
+        //   skew     computes to 0./0. == nan
+        //   kurtosis computes to 0./0. == nan
+        //   x_skew     == inf
+        //   x_kurtosis == inf
+        //   These tests are commented out because UBSan warns about division by 0
+//        skew /= u.size() * dev * var;
+//        kurtosis /= u.size() * var * var;
+//        kurtosis -= 3;
+        double x_mean = d.t() * d.p();
+        double x_var = x_mean*(1-d.p());
+//        double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+//        double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
         assert(mean == x_mean);
         assert(var == x_var);
+//        assert(skew == x_skew);
+//        assert(kurtosis == x_kurtosis);
     }
     {
         typedef std::binomial_distribution<> D;
@@ -215,15 +223,23 @@
         }
         var /= u.size();
         double dev = std::sqrt(var);
-        skew /= u.size() * dev * var;
-        kurtosis /= u.size() * var * var;
-        kurtosis -= 3;
-        double x_mean = d.t() * d.p();
-        double x_var = x_mean*(1-d.p());
-        double x_skew = (1-2*d.p()) / std::sqrt(x_var);
-        double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+        // In this case:
+        //   skew     computes to 0./0. == nan
+        //   kurtosis computes to 0./0. == nan
+        //   x_skew     == -inf
+        //   x_kurtosis == inf
+        //   These tests are commented out because UBSan warns about division by 0
+//        skew /= u.size() * dev * var;
+//        kurtosis /= u.size() * var * var;
+//        kurtosis -= 3;
+        double x_mean = d.t() * d.p();
+        double x_var = x_mean*(1-d.p());
+//        double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+//        double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
         assert(mean == x_mean);
         assert(var == x_var);
+//        assert(skew == x_skew);
+//        assert(kurtosis == x_kurtosis);
     }
     {
         typedef std::binomial_distribution<> D;
@@ -333,15 +349,23 @@
         }
         var /= u.size();
         double dev = std::sqrt(var);
-        skew /= u.size() * dev * var;
-        kurtosis /= u.size() * var * var;
-        kurtosis -= 3;
-        double x_mean = d.t() * d.p();
-        double x_var = x_mean*(1-d.p());
-        double x_skew = (1-2*d.p()) / std::sqrt(x_var);
-        double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+        // In this case:
+        //   skew     computes to 0./0. == nan
+        //   kurtosis computes to 0./0. == nan
+        //   x_skew     == inf
+        //   x_kurtosis == inf
+        //   These tests are commented out because UBSan warns about division by 0
+//        skew /= u.size() * dev * var;
+//        kurtosis /= u.size() * var * var;
+//        kurtosis -= 3;
+        double x_mean = d.t() * d.p();
+        double x_var = x_mean*(1-d.p());
+//        double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+//        double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
         assert(mean == x_mean);
         assert(var == x_var);
+//        assert(skew == x_skew);
+//        assert(kurtosis == x_kurtosis);
     }
     {
         typedef std::binomial_distribution<> D;
@@ -371,15 +395,23 @@
         }
         var /= u.size();
         double dev = std::sqrt(var);
-        skew /= u.size() * dev * var;
-        kurtosis /= u.size() * var * var;
-        kurtosis -= 3;
-        double x_mean = d.t() * d.p();
-        double x_var = x_mean*(1-d.p());
-        double x_skew = (1-2*d.p()) / std::sqrt(x_var);
-        double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+        // In this case:
+        //   skew     computes to 0./0. == nan
+        //   kurtosis computes to 0./0. == nan
+        //   x_skew     == inf
+        //   x_kurtosis == inf
+        //   These tests are commented out because UBSan warns about division by 0
+//        skew /= u.size() * dev * var;
+//        kurtosis /= u.size() * var * var;
+//        kurtosis -= 3;
+        double x_mean = d.t() * d.p();
+        double x_var = x_mean*(1-d.p());
+//        double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+//        double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
         assert(mean == x_mean);
         assert(var == x_var);
+//        assert(skew == x_skew);
+//        assert(kurtosis == x_kurtosis);
     }
     {
         typedef std::binomial_distribution<> D;
@@ -409,14 +441,22 @@
         }
         var /= u.size();
         double dev = std::sqrt(var);
-        skew /= u.size() * dev * var;
-        kurtosis /= u.size() * var * var;
-        kurtosis -= 3;
-        double x_mean = d.t() * d.p();
-        double x_var = x_mean*(1-d.p());
-        double x_skew = (1-2*d.p()) / std::sqrt(x_var);
-        double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
+        // In this case:
+        //   skew     computes to 0./0. == nan
+        //   kurtosis computes to 0./0. == nan
+        //   x_skew     == -inf
+        //   x_kurtosis == inf
+        //   These tests are commented out because UBSan warns about division by 0
+//        skew /= u.size() * dev * var;
+//        kurtosis /= u.size() * var * var;
+//        kurtosis -= 3;
+        double x_mean = d.t() * d.p();
+        double x_var = x_mean*(1-d.p());
+//        double x_skew = (1-2*d.p()) / std::sqrt(x_var);
+//        double x_kurtosis = (1-6*d.p()*(1-d.p())) / x_var;
         assert(mean == x_mean);
         assert(var == x_var);
+//        assert(skew == x_skew);
+//        assert(kurtosis == x_kurtosis);
     }
 }


update: cleanup

update: cleanup

--- rx24t_SDC_sample/main.cpp
+++ rx24t_SDC_sample/main.cpp
@@ -223,8 +223,8 @@
 #endif
 	}

-	void utf8_to_sjis(const char* src, char* dst) {
-		utils::str::utf8_to_sjis(src, dst);
+	void utf8_to_sjis(const char* src, char* dst, uint32_t len) {
+		utils::str::utf8_to_sjis(src, dst, len);
 	}

 	uint8_t v_ = 91;


update fifo template

update fifo template

--- rx64m_test/write_file.hpp
+++ rx64m_test/write_file.hpp
@@ -8,7 +8,7 @@
 //=====================================================================//
 #include <cstdio>
 #include <cstring>
-#include "common/fifo.hpp"
+#include "common/fixed_fifo.hpp"
 #include "common/format.hpp"

 // #define WRITE_FILE_DEBUG
@@ -38,7 +38,7 @@

 		static const uint32_t BUF_SIZE = 64;

-		typedef utils::fifo<uint16_t, BUF_SIZE, sample_t> FIFO;
+		typedef utils::fixed_fifo<sample_t, BUF_SIZE> FIFO;
 		FIFO	fifo_;

 		FILE	*fp_;
@@ -160,7 +160,7 @@
 		//-----------------------------------------------------------------//
 		bool injection(const sample_t& data)
 		{
-			if(fifo_.length() >= (BUF_SIZE -2)) { // スペースが無い場合
+			if(fifo_.length() >= (BUF_SIZE - 2)) { // スペースが無い場合
 				return false;
 			}
 			fifo_.put(data);


Double panel in landscape enabled by default

--- sailfish/src/settings.cpp
+++ sailfish/src/settings.cpp
@@ -389,7 +389,7 @@

 bool Settings::getDoublePane()
 {
-    return settings.value("doublepane", false).toBool();
+    return settings.value("doublepane", true).toBool();
 }

 void Settings::setHint1Done(bool value)


fix unlock IncrementalAchievement crash

fix unlock IncrementalAchievement crash

--- js/frameworks/runtime-src/Classes/PluginSdkboxPlayJSHelper.cpp
+++ js/frameworks/runtime-src/Classes/PluginSdkboxPlayJSHelper.cpp
@@ -149,6 +149,11 @@
     virtual void onIncrementalAchievementStep(const std::string &achievement_name, double step) {
         JSContext* cx = s_cx;
         SdkboxPlayCallbackJS* cb = new SdkboxPlayCallbackJS();
+
+#if MOZJS_MAJOR_VERSION < 52
+        JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
+#endif
+
         cb->_name = "onIncrementalAchievementStep";
         cb->_paramVal[0] = SB_STR_TO_JSVAL(cx, achievement_name);
         cb->_paramVal[1] = JS::DoubleValue(step);


forward env var for session local stream path (for open source server)

--- src/cpp/server/ServerSessionManager.cpp
+++ src/cpp/server/ServerSessionManager.cpp
@@ -28,7 +28,7 @@
 #include <session/SessionConstants.hpp>

 #include <server/ServerOptions.hpp>
-
+#include <server/ServerPaths.hpp>
 #include <server/ServerErrorCategory.hpp>

 #include <server/auth/ServerValidateUser.hpp>
@@ -185,6 +185,11 @@
    if (!core::system::getenv(kCrashpadHandlerEnvVar).empty())
       environment.push_back({kCrashpadHandlerEnvVar, core::system::getenv(kCrashpadHandlerEnvVar)});

+
+   // forward path for session temp dir (used for local stream path)
+   environment.push_back(
+         std::make_pair(kSessionTmpDirEnvVar, sessionTmpDir().absolutePath()));
+
    // build the config object and return it
    core::system::ProcessConfig config;
    config.args = args;


added debug statement for when Hessian goes non-negative definite

--- lib/lbfgs.cpp
+++ lib/lbfgs.cpp
@@ -177,6 +177,9 @@
 		if(gk.dot(dk) >= 0) {
 			dk = -gk;
 			m_hist.clear();
+#ifdef DEBUG
+			cerr << "Clearing LBFGS History!" << endl;
+#endif //DEBUG
 		}

         // compute step size


use `git grep` when excluding standard git exclusions to prevent an unbounded amount of output

--- src/cpp/session/modules/SessionFind.cpp
+++ src/cpp/session/modules/SessionFind.cpp
@@ -923,6 +923,8 @@
    void onStderr(const core::system::ProcessOperations& ops, const std::string& data)
    {
       LOG_ERROR_MESSAGE("grep: " + data);
+      if (boost::algorithm::icontains(data, "not a git repository"))
+         module_context::showErrorMessage("Not a Git Repository", data);
    }

    void onExit(int exitCode)
@@ -989,28 +991,22 @@
    const std::string replacePattern;
 };

-core::Error createGitExclusionString(const FilePath& dirPath, std::string* pResultString)
-{
-   shell_utils::ShellCommand cmd("git");
-   cmd << "-C";
-   cmd << string_utils::utf8ToSystem(dirPath.getAbsolutePath());
-   cmd << "ls-files";
-   cmd << "-i";
-   cmd << "--exclude-standard";
-
-   core::system::ProcessResult result;
-   core::system::ProcessOptions options;
-
-   core::Error error = runCommand(cmd,
-                                  options,
-                                  &result);
-   if (error)
-      return error;
-
-   *pResultString = result.stdOut;
-   boost::algorithm::replace_all(*pResultString, "\n", " ");
-
-   return Success();
+void processExcludeFilePatterns(
+   const json::Array& excludeFilePatterns, std::string* pCmdArg, bool* pGitFlag)
+{
+   *pGitFlag = false;
+   for (json::Value filePattern : excludeFilePatterns)
+   {
+      if (filePattern.getType() != json::Type::STRING)
+         LOG_WARNING_MESSAGE("Exclude files contain non-string value");
+      else
+      {
+         if (filePattern.getString().compare("gitExclusions") == 0)
+            *pGitFlag = true;
+         else
+            pCmdArg->append("--exclude=" + filePattern.getString());
+      }
+   }
 }

 core::Error runGrepOperation(const GrepOptions& grepOptions, const ReplaceOptions& replaceOptions,
@@ -1064,9 +1060,32 @@
 #else
    shell_utils::ShellCommand cmd("grep");
 #endif
-   cmd << "-rHn" << "--binary-files=without-match" << "--color=always";
+
+   // Filepaths received from the client will be UTF-8 encoded;
+   // convert to system encoding here.
+   FilePath dirPath = module_context::resolveAliasedPath(grepOptions.directory);
+   std::string excludeArgs;
+   bool gitFlag = false;
+   processExcludeFilePatterns(grepOptions.excludeFilePatterns, &excludeArgs, &gitFlag);
+   if (gitFlag)
+   {
+      cmd = shell_utils::ShellCommand("git");
+      cmd << "-C";
+      cmd << string_utils::utf8ToSystem(dirPath.getAbsolutePath());
+      cmd <<  "grep";
+      cmd << "--untracked";
+      cmd << "--exclude-standard";
+   }
+   cmd << "-rHn";
+   if (!gitFlag)
+   {
+      cmd << "--color=always";
+      cmd << "--binary-files=without-match";
+   }
+
 #ifndef _WIN32
-   cmd << "--devices=skip";
+   if (!gitFlag)
+      cmd << "--devices=skip";
 #endif

    if (grepOptions.ignoreCase)
@@ -1079,45 +1098,27 @@
    if (!grepOptions.asRegex)
       cmd << "-F";

-   for (json::Value filePattern : grepOptions.filePatterns)
-   {
-      cmd << "--include=" + filePattern.getString();
-   }
-
-   // Filepaths received from the client will be UTF-8 encoded;
-   // convert to system encoding here.
-   FilePath dirPath = module_context::resolveAliasedPath(grepOptions.directory);
-   for (json::Value filePattern : grepOptions.excludeFilePatterns)
-   {
-      if (filePattern.getType() != json::Type::STRING)
-         LOG_WARNING_MESSAGE("Exclude files contain non-string value");
-      else
-      {
-         // to retrieve the git exclusions, we run a git command and parse the output
-         if (filePattern.getString().compare("gitExclusions") == 0)
-         {
-            std::string excludeGitExclusion;
-            error = createGitExclusionString(dirPath, &excludeGitExclusion);
-            if (error)
-               return error;
-
-            std::istringstream stream(excludeGitExclusion);
-            std::vector<std::string> results((std::istream_iterator<std::string>(stream)),
-               std::istream_iterator<std::string>());
-            for (std::string filePattern : results)
-            {
-               filePattern.insert(0, dirPath.getAbsolutePath() + "/");
-               cmd << "--exclude=" + filePattern;
-            }
-         }
-         else
-            cmd << "--exclude=" + filePattern.getString();
-      }
-   }
-
-   cmd << shell_utils::EscapeFilesOnly << "--" << shell_utils::EscapeAll;
-   cmd << string_utils::utf8ToSystem(dirPath.getAbsolutePath());
-
+   if (!gitFlag)
+   {
+      for (json::Value filePattern : grepOptions.filePatterns)
+      {
+         cmd << "--include=" + filePattern.getString();
+      }
+      cmd << shell_utils::EscapeFilesOnly << "--" << shell_utils::EscapeAll;
+      cmd << string_utils::utf8ToSystem(dirPath.getAbsolutePath());
+   }
+   else
+   {
+      for (json::Value filePattern : grepOptions.filePatterns)
+      {
+         cmd << shell_utils::EscapeFilesOnly << "--" << shell_utils::EscapeAll;
+         cmd << filePattern.getString();
+      }
+   }
+
+   if (!excludeArgs.empty())
+      cmd << excludeArgs;
+
    // Clear existing results
    findResults().clear();


INTEGRATION: CWS pchfix02 (1.5.16); FILE MERGED 2006/09/01 17:30:47 kaib 1.5.16.1: #i68856# Added header markers and pch files

--- i18npool/source/numberformatcode/numberformatcode.cxx
+++ i18npool/source/numberformatcode/numberformatcode.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: numberformatcode.cxx,v $
  *
- *  $Revision: 1.5 $
- *
- *  last change: $Author: hr $ $Date: 2006-06-20 04:47:57 $
+ *  $Revision: 1.6 $
+ *
+ *  last change: $Author: obo $ $Date: 2006-09-17 09:22:42 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -32,6 +32,9 @@
  *    MA  02111-1307  USA
  *
  ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_i18npool.hxx"

 #include <numberformatcode.hxx>
 #include <com/sun/star/i18n/KNumberFormatUsage.hpp>


iox-#27 Add PortPool client tests

iox-#27 Add PortPool client tests

--- iceoryx_posh/test/moduletests/test_roudi_portpool.cpp
+++ iceoryx_posh/test/moduletests/test_roudi_portpool.cpp
@@ -18,6 +18,7 @@
 #include "iceoryx_hoofs/cxx/convert.hpp"
 #include "iceoryx_posh/internal/roudi/port_pool_data.hpp"
 #include "iceoryx_posh/internal/runtime/node_data.hpp"
+#include "iceoryx_posh/popo/client_options.hpp"
 #include "iceoryx_posh/popo/subscriber_options.hpp"
 #include "iceoryx_posh/roudi/port_pool.hpp"
 #include "test.hpp"
@@ -30,8 +31,33 @@

 static constexpr uint32_t DEFAULT_DEVICE_ID{20U};
 static constexpr uint32_t DEFAULT_MEMORY_TYPE{100U};
+static constexpr uint32_t QUEUE_CAPACITY{10U};
 class PortPool_test : public Test
 {
+  public:
+    bool addClientPorts(uint32_t numberOfClientPortsToAdd,
+                        std::function<void(const capro::ServiceDescription& sd,
+                                           const RuntimeName_t& runtimeName,
+                                           const popo::ClientPortData& clientPort)> onAdd)
+    {
+        for (uint32_t i = 0; i < numberOfClientPortsToAdd; ++i)
+        {
+            std::string service = "service" + cxx::convert::toString(i);
+            IdString_t serviceId{cxx::TruncateToCapacity, service};
+            ServiceDescription sd{serviceId, "instance", "event"};
+            RuntimeName_t runtimeName{cxx::TruncateToCapacity, "AppName" + cxx::convert::toString(i)};
+
+            auto clientPortResult = sut.addClientPort(sd, &m_memoryManager, runtimeName, m_clientOptions, m_memoryInfo);
+            if (clientPortResult.has_error())
+            {
+                return false;
+            }
+            onAdd(sd, runtimeName, *clientPortResult.value());
+        }
+
+        return true;
+    }
+
   public:
     roudi::PortPoolData m_portPoolData;
     roudi::PortPool sut{m_portPoolData};
@@ -45,6 +71,7 @@
     popo::PublisherOptions m_publisherOptions{10U, m_nodeName};
     popo::SubscriberOptions m_subscriberOptions{
         iox::popo::SubscriberPortData::ChunkQueueData_t::MAX_CAPACITY, 10U, m_nodeName};
+    popo::ClientOptions m_clientOptions{QUEUE_CAPACITY, m_nodeName};
     iox::mepoo::MemoryInfo m_memoryInfo{DEFAULT_DEVICE_ID, DEFAULT_MEMORY_TYPE};
 };

@@ -403,6 +430,114 @@

 // END SubscriberPort tests

+// BEGIN ClientPort tests
+
+TEST_F(PortPool_test, AddClientPortIsSuccessful)
+{
+    ::testing::Test::RecordProperty("TEST_ID", "47d9cd34-22a6-480a-8595-d4abf46df428");
+    constexpr uint32_t NUMBER_OF_CLIENTS_TO_ADD{1U};
+    auto addSuccessful =
+        addClientPorts(NUMBER_OF_CLIENTS_TO_ADD, [&](const auto& sd, const auto& runtimeName, const auto& clientPort) {
+            EXPECT_EQ(clientPort.m_serviceDescription, sd);
+            EXPECT_EQ(clientPort.m_runtimeName, runtimeName);
+            EXPECT_EQ(clientPort.m_nodeName, m_clientOptions.nodeName);
+            EXPECT_EQ(clientPort.m_connectRequested, m_clientOptions.connectOnCreate);
+            EXPECT_EQ(clientPort.m_connectionState, ConnectionState::NOT_CONNECTED);
+            EXPECT_EQ(clientPort.m_chunkReceiverData.m_queue.capacity(), QUEUE_CAPACITY);
+            EXPECT_EQ(clientPort.m_chunkReceiverData.m_memoryInfo.deviceId, DEFAULT_DEVICE_ID);
+            EXPECT_EQ(clientPort.m_chunkReceiverData.m_memoryInfo.memoryType, DEFAULT_MEMORY_TYPE);
+            EXPECT_EQ(clientPort.m_chunkSenderData.m_historyCapacity, popo::ClientPortData::HISTORY_CAPACITY_ZERO);
+            EXPECT_EQ(clientPort.m_chunkSenderData.m_memoryInfo.deviceId, DEFAULT_DEVICE_ID);
+            EXPECT_EQ(clientPort.m_chunkSenderData.m_memoryInfo.memoryType, DEFAULT_MEMORY_TYPE);
+        });
+
+    EXPECT_TRUE(addSuccessful);
+}
+
+TEST_F(PortPool_test, AddClientPortToMaxCapacityIsSuccessful)
+{
+    ::testing::Test::RecordProperty("TEST_ID", "f8ee6f26-fdac-4bfd-9e28-46362e4359e9");
+    constexpr uint32_t NUMBER_OF_CLIENTS_TO_ADD{MAX_CLIENTS};
+    auto addSuccessful =
+        addClientPorts(NUMBER_OF_CLIENTS_TO_ADD, [&](const auto& sd, const auto&, const auto& clientPort) {
+            EXPECT_EQ(clientPort.m_serviceDescription, sd);
+        });
+
+    EXPECT_TRUE(addSuccessful);
+}
+
+
+TEST_F(PortPool_test, AddClientPortWhenClientListOverflowsReturnsError)
+{
+    ::testing::Test::RecordProperty("TEST_ID", "98c47d42-5f75-42a3-84b5-b97e72a17992");
+    constexpr uint32_t NUMBER_OF_CLIENTS_TO_ADD{MAX_CLIENTS};
+    auto addSuccessful = addClientPorts(NUMBER_OF_CLIENTS_TO_ADD, [&](const auto&, const auto&, const auto&) {});
+
+    EXPECT_TRUE(addSuccessful);
+
+    auto errorHandlerCalled{false};
+    auto errorHandlerGuard = ErrorHandler::setTemporaryErrorHandler(
+        [&](const Error error, const std::function<void()>, const ErrorLevel level) {
+            errorHandlerCalled = true;
+            EXPECT_THAT(error, Eq(Error::kPORT_POOL__CLIENTLIST_OVERFLOW));
+            EXPECT_THAT(level, Eq(ErrorLevel::MODERATE));
+        });
+
+    constexpr uint32_t ONE_MORE_CLIENT{1U};
+    auto additionalAddSuccessful = addClientPorts(ONE_MORE_CLIENT, [&](const auto&, const auto&, const auto&) {});
+
+    EXPECT_FALSE(additionalAddSuccessful);
+    EXPECT_TRUE(errorHandlerCalled);
+}
+
+TEST_F(PortPool_test, GetClientPortDataListIsSuccessful)
+{
+    ::testing::Test::RecordProperty("TEST_ID", "39119f21-ca97-4320-a805-029927a79372");
+    constexpr uint32_t NUMBER_OF_CLIENTS_TO_ADD{1U};
+    auto addSuccessful = addClientPorts(NUMBER_OF_CLIENTS_TO_ADD, [&](const auto&, const auto&, const auto&) {});
+    EXPECT_TRUE(addSuccessful);
+
+    auto clientPortDataList = sut.getClientPortDataList();
+
+    ASSERT_EQ(clientPortDataList.size(), NUMBER_OF_CLIENTS_TO_ADD);
+}
+
+TEST_F(PortPool_test, GetClientPortDataListWhenEmptyIsSuccessful)
+{
+    ::testing::Test::RecordProperty("TEST_ID", "6c08ae7d-1eed-46d6-b363-b2dc294d0e0e");
+    auto clientPortDataList = sut.getClientPortDataList();
+
+    ASSERT_EQ(clientPortDataList.size(), 0U);
+}
+
+TEST_F(PortPool_test, GetClientPortDataListCompletelyFilledIsSuccessful)
+{
+    ::testing::Test::RecordProperty("TEST_ID", "cdac1dca-f438-4816-90f9-ca976b6ccd88");
+    constexpr uint32_t NUMBER_OF_CLIENTS_TO_ADD{MAX_CLIENTS};
+    auto addSuccessful = addClientPorts(NUMBER_OF_CLIENTS_TO_ADD, [&](const auto&, const auto&, const auto&) {});
+    EXPECT_TRUE(addSuccessful);
+
+    auto clientPortDataList = sut.getClientPortDataList();
+
+    ASSERT_EQ(clientPortDataList.size(), MAX_CLIENTS);
+}
+
+TEST_F(PortPool_test, RemoveClientPortIsSuccessful)
+{
+    ::testing::Test::RecordProperty("TEST_ID", "d93ecaef-555a-4db4-a49d-390366457f97");
+    constexpr uint32_t NUMBER_OF_CLIENTS_TO_ADD{1U};
+    auto addSuccessful =
+        addClientPorts(NUMBER_OF_CLIENTS_TO_ADD,
+                       [&](const auto&, const auto&, const auto& clientPort) { sut.removeClientPort(&clientPort); });
+    EXPECT_TRUE(addSuccessful);
+
+    auto clientPortDataList = sut.getClientPortDataList();
+
+    EXPECT_EQ(clientPortDataList.size(), 0U);
+}
+
+// END ClientPort tests
+
 // BEGIN InterfacePort tests

 TEST_F(PortPool_test, AddInterfacePortIsSuccessful)


Fixed move constructor for win32_overlapped_operation_cancellable. (#80)

Addresses aspects of #34.

--- include/cppcoro/detail/win32_overlapped_operation.hpp
+++ include/cppcoro/detail/win32_overlapped_operation.hpp
@@ -172,9 +172,9 @@
 				: win32_overlapped_operation_base(std::move(other))
 				, m_state(other.m_state.load(std::memory_order_relaxed))
 				, m_cancellationToken(std::move(other.m_cancellationToken))
-				, m_errorCode(other.m_errorCode)
-				, m_numberOfBytesTransferred(other.m_numberOfBytesTransferred)
-			{
+			{
+				assert(m_errorCode == other.m_errorCode);
+				assert(m_numberOfBytesTransferred == other.m_numberOfBytesTransferred);
 			}

 		public:


minor fix

minor fix

--- include/fl/filter/gaussian/robust_gaussian_filter.hpp
+++ include/fl/filter/gaussian/robust_gaussian_filter.hpp
@@ -27,7 +27,7 @@
 #include <fl/filter/gaussian/gaussian_filter_nonlinear_generic.hpp>
 #include <fl/filter/gaussian/sigma_point_additive_uncorrelated_update_policy.hpp>
 #include <fl/filter/gaussian/sigma_point_additive_prediction_policy.hpp>
-#include <fl/filter/gaussian/sigma_point_additive_update_policy.hpp>S
+#include <fl/filter/gaussian/sigma_point_additive_update_policy.hpp>
 #include <fl/filter/gaussian/sigma_point_prediction_policy.hpp>
 #include <fl/filter/gaussian/sigma_point_update_policy.hpp>


still need to delete the job, even if it isn't json

--- lib/bodega/session.cpp
+++ lib/bodega/session.cpp
@@ -66,6 +66,8 @@

 void Session::Private::jobFinished(NetworkJob *job)
 {
+    job->deleteLater();
+
     if (!job->isJsonResponse()) {
         return;
     }
@@ -83,8 +85,6 @@
     if (job->authSuccess()) {
         setPoints(job->points());
     }
-
-    job->deleteLater();
 }

 QNetworkReply *Session::Private::get(const QUrl &url)


Fix truncated webp images DO NOT MERGE

Fix truncated webp images DO NOT MERGE

Bug: b/65290323
Test: ag/2974889

Merged-In: Ib6f385766d6d46ed7fe56188cae5a71b100102bd
Merged-In: I0cba5ab639f1e66b7c493a9f63735a0f5edbcfbf
Change-Id: I0cba5ab639f1e66b7c493a9f63735a0f5edbcfbf

Original message description:
========================================================================
If a webp file is truncated such that no rows can be decoded,
WebPIDecGetRGB does not initialize its "last_y" parameter. We use
rowsDecoded (passed as last_y) to determine which remaining rows to
fill.

Check the return value of WebPIDecGetRGB. If it fails (returns null),
or rowsDecoded is <= 0 (matching Chromium's check), return
kInvalidInput, since there is nothing to draw.

Note that this is a change in behavior for Android. Previously we
would decode an empty webp to just a transparent/black rectangle,
whereas now we simply fail. I think this is a change for the better.

Add a test which truncates a file to have 0 rows available and attempts
to decode it. msan verifies that we no longer depend on the
uninitialized value.

Stop attempting to test decoding subsets from an incomplete webp (in
CodecTest.cpp). Unless we have decoded the portion covered by the
subset, this will fail.

Remove test images inc0.webp (from both dm/ and colorspace/) and
inc1.webp. These just decode to transparent rectangles. Replace them
with inc2.webp and inc3.webp, which decode part of the image and then
have to fill with transparent.

Change-Id: I64d40be91c574b45963f9a43d8dd8f4929dd2939
Reviewed-on: https://skia-review.googlesource.com/50303
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: James Zern <jzern@google.com>
========================================================================

For simplicity, this does not update VERSION or tasks.json, as does the
original CL. It also does not include the test, which relied on more
recent changes.

Exempt-From-Owner-Approval: I should be an OWNER.

--- src/codec/SkWebpCodec.cpp
+++ src/codec/SkWebpCodec.cpp
@@ -235,7 +235,10 @@
     while (true) {
         const size_t bytesRead = stream()->read(buffer, BUFFER_SIZE);
         if (0 == bytesRead) {
-            WebPIDecGetRGB(idec, rowsDecoded, NULL, NULL, NULL);
+            if (!WebPIDecGetRGB(idec, rowsDecoded, NULL, NULL, NULL)
+                    || rowsDecoded && *rowsDecoded <= 0) {
+                return kInvalidInput;
+            }
             return kIncompleteInput;
         }


fix dynamic linker error

fix dynamic linker error

--- python/sym.cpp
+++ python/sym.cpp
@@ -16,9 +16,8 @@
   py::class_<Op>(m, "Op")
     .def(py::init<>(&Op::identity))
     .def(py::init(&parse_triplet))
-    .def_property_readonly_static("TDEN",
-            [](py::object) -> int { return Op::TDEN; },
-            "Denominator (integer) for the translation vector.")
+    .def_property_readonly_static("TDEN", [](py::object) { return Op::TDEN; },
+                           "Denominator (integer) for the translation vector.")
     .def_readwrite("rot", &Op::rot, "3x3 integer matrix.")
     .def_readwrite("tran", &Op::tran,
        "Numerators (integers) of the translation vector. Denominator TDEN=24.")
@@ -40,7 +39,7 @@
               for (int j = 0; j < 4; ++j) {
                 auto v = arr[i][j];
                 if (j == 3 && i != 3 && v != 0)
-                  row.append(fr(v, Op::TDEN));
+                  row.append(fr(v, Op::TDEN + 0));  // +0 to avoid linker error
                 else
                   row.append(v);
               }


update qtcmd, print current epoch in msec

--- qtcmd/main.cpp
+++ qtcmd/main.cpp
@@ -42,6 +42,10 @@
     qsrand((uint)(current % 0xffffffff));
 }

+void print_current_msec_epoch()
+{
+    qDebug() << "epoch in msec:" << QDateTime::currentMSecsSinceEpoch();
+}

 void test_array()
 {
@@ -92,6 +96,8 @@
 {
     QCoreApplication app(argc, argv);

+    print_current_msec_epoch();
+
     handleOpt(argc, argv);
     switch (gVars.kTest) {
         case TC_MD5LISTTEST:


テストコード修正

テストコード修正

git-svn-id: a96bd3a1dbf41cfa227a3340720cc8125cc9349e@8882 1ed66053-1c2d-0410-8867-f7571e6e31d3

--- l7vsd/unit_tests/session_test/tcp_session/tcp_session_test.cpp
+++ l7vsd/unit_tests/session_test/tcp_session/tcp_session_test.cpp
@@ -4948,7 +4948,9 @@
     BOOST_CHECK_EQUAL(45,l7vs::Logger::putLogError_id);
     std::cout << l7vs::Logger::putLogError_message << std::endl;

-    mutex_lock_test test_lock_obj(vs,io);
+//    mutex_lock_test test_lock_obj(vs,io);
+    mutex_lock_test test_lock_obj(vs,io,set_option,listen_endpoint,set_mode,set_context,set_ssl_cache_flag,set_ssl_handshake_time_out,plogger);
+
     test_lock_obj.set_up_thread_realserver_disconnect_event_test();
     test_lock_obj.set_protocol_module((l7vs::protocol_module_base*)&proto_test);


don't load files with *~ at end of them

don't load files with *~ at end of them

git-svn-id: 647c2dfdf120d9af8205d960f30c8711574448cd@890 6778bc44-b910-0410-a7a0-be141de4315d

--- src/qprojectM/qplaylistmodel.cpp
+++ src/qprojectM/qplaylistmodel.cpp
@@ -302,9 +302,9 @@
 			return false;
 		}
 		foreach (QFileInfo info, QDir(file).entryInfoList()) {
-			if (info.fileName().toLower().contains(".prjm") || info.fileName().toLower().contains(".milk"))
+			if (info.fileName().toLower().endsWith(".prjm") || info.fileName().toLower().endsWith(".milk"))
 				appendRow(info.absoluteFilePath(), info.fileName(), 3);
-		}
+		}
 		return true;
 	}


UI: Fix display of end of witness period

There was a regression in the UI code that made it never display this properly

--- src/qt/_Gulden/witnessdialog.cpp
+++ src/qt/_Gulden/witnessdialog.cpp
@@ -541,8 +541,6 @@

     infoForAccount.pointMapForecast[0] = 0;

-    CTxOutPoW2Witness witnessDetails;
-
     // fixme: (PHASE5) Use only rewards of current locked witness amounts, not of previous ones after a re-fund...
     // Extract details for every witness reward we have received.
     filter->setAccountFilter(forAccount);
@@ -608,7 +606,7 @@
         infoForAccount.nEstimatedWitnessBlockPeriod = uint64_t(1.0/fInv);
     }

-    infoForAccount.nLockBlocksRemaining = GetPoW2RemainingLockLengthInBlocks(witnessDetails.lockUntilBlock, chainActive.Tip()->nHeight);
+    infoForAccount.nLockBlocksRemaining = GetPoW2RemainingLockLengthInBlocks(accountStatus.lockUntilBlock, chainActive.Tip()->nHeight);

     return infoForAccount;
 }


Update tx confirmations after data is loaded

--- src/qt/transactiontablemodel.cpp
+++ src/qt/transactiontablemodel.cpp
@@ -72,6 +72,7 @@
      * this is sorted by sha256.
      */
     QList<TransactionRecord> cachedWallet;
+    bool isDataLoading = true;

     /* Query entire wallet anew from core.
      */
@@ -187,18 +188,21 @@
         {
             TransactionRecord *rec = &cachedWallet[idx];

-            // Get required locks upfront. This avoids the GUI from getting
-            // stuck if the core is holding the locks for a longer time - for
-            // example, during a wallet rescan.
-            //
-            // If a status update is needed (blocks came in since last check),
-            //  update the status of this transaction from the wallet. Otherwise,
-            // simply re-use the cached status.
-            interfaces::WalletTxStatus wtx;
-            int numBlocks;
-            int64_t block_time;
-            if (wallet.tryGetTxStatus(rec->hash, wtx, numBlocks, block_time) && rec->statusUpdateNeeded(numBlocks)) {
-                rec->updateStatus(wtx, numBlocks, block_time);
+            if(!isDataLoading)
+            {
+                // Get required locks upfront. This avoids the GUI from getting
+                // stuck if the core is holding the locks for a longer time - for
+                // example, during a wallet rescan.
+                //
+                // If a status update is needed (blocks came in since last check),
+                //  update the status of this transaction from the wallet. Otherwise,
+                // simply re-use the cached status.
+                interfaces::WalletTxStatus wtx;
+                int numBlocks;
+                int64_t block_time;
+                if (wallet.tryGetTxStatus(rec->hash, wtx, numBlocks, block_time) && rec->statusUpdateNeeded(numBlocks)) {
+                    rec->updateStatus(wtx, numBlocks, block_time);
+                }
             }
             return rec;
         }
@@ -270,6 +274,9 @@
     // Invalidate status (number of confirmations) and (possibly) description
     //  for all rows. Qt is smart enough to only actually request the data for the
     //  visible rows.
+    if(priv->isDataLoading)
+        priv->isDataLoading = false;
+
     modelDataChanged(Status);
     modelDataChanged(ToAddress);
 }


Remove bool IsPoR

Remove bool IsPoR

--- src/qt/transactiontablemodel.cpp
+++ src/qt/transactiontablemodel.cpp
@@ -21,9 +21,6 @@

 int64_t GetMaximumBoincSubsidy(int64_t nTime);
 double CoinToDouble(double surrogate);
-extern bool IsPoR(double amt);
-
-

 // Amount column is right-aligned it contains numbers
 static int column_alignments[] = {
@@ -354,23 +351,6 @@
     return description;
 }

-
-
-
-bool IsPoR(double amt)
-{
-	std::string sAmt = RoundToString(amt,8);
-	if (sAmt.length() > 8)
-	{
-		std::string suffix = sAmt.substr(sAmt.length()-4,4);
-		if (suffix =="0124" || suffix=="0123")
-		{
-			return true;
-		}
-	}
-	return false;
-}
-
 QString TransactionTableModel::formatTxType(const TransactionRecord *wtx) const
 {
     switch(wtx->type)


And finally.. multiple matches per input..  elvis has LEFT the building, the newly re-rewritten word filter is complete.  werd.

--- src/common/WordFilter.cxx
+++ src/common/WordFilter.cxx
@@ -72,7 +72,10 @@
   regmatch_t match[1];
   if (input == NULL) return false;
   int inputLength = strlen(input);
-
+
+  // a buffer to destroy during matching
+  char *sInput = new char(inputLength);
+  memcpy(sInput, input, inputLength * sizeof(char));

   /* maintain an array of match indices of the input; values are in
    * pairs.  the first number is the start position, the second is
@@ -154,108 +157,119 @@
 	 i != filters[firstchar].end(); ++i) {

       /* the big kahuna burger processing goes on here */
-      regCode = regexec(i->compiled, input, 1, match, 0);
-
-      if ( regCode == 0 ) {
-	int startOffset = match[0].rm_so;
-	int endOffset = match[0].rm_eo;
+      bool matched = true;
+      while (matched) {
+	matched = false;
+
+	regCode = regexec(i->compiled, sInput, 1, match, 0);
+
+//std::cout << "input is [" << sInput << "]" << std::endl;
+
+	if ( regCode == 0 ) {
+	  int startOffset = match[0].rm_so;
+	  int endOffset = match[0].rm_eo;

 //std::cout << "We matched ... ";

-	/* make sure we only match on word boundaries */
-	if ( (startOffset>1) && (isAlphabetic(input[startOffset-1])) ) {
+	  /* make sure we only match on word boundaries */
+	  if ( (startOffset>1) && (isAlphabetic(input[startOffset-1])) ) {

 //std::cout << "but didn't match a word beginning" << std::endl;
-
-	  /* we are in the middle of a word.. see if we can match a prefix before this */
-	  bool foundit =  false;
-	  for (std::set<filter_t, expressionCompare>::iterator j = prefixes.begin();
-	       j != prefixes.end(); ++j) {
-	    if (regexec(j->compiled, input, 1, match, 0) == 0) {
+
+	    /* we are in the middle of a word.. see if we can match a prefix before this */
+	    bool foundit =  false;
+	    for (std::set<filter_t, expressionCompare>::iterator j = prefixes.begin();
+		 j != prefixes.end(); ++j) {
+	      if (regexec(j->compiled, input, 1, match, 0) == 0) {

 //std::cout << "checking prefix: " << j->word << std::endl;

-	      if ( (match[0].rm_so > 1) && (isAlphabetic(input[match[0].rm_so - 1])) ) {
-		/* we matched, but we are still in the middle of a word */
-		continue;
-	      }
+		if ( (match[0].rm_so > 1) && (isAlphabetic(input[match[0].rm_so - 1])) ) {
+		  /* we matched, but we are still in the middle of a word */
+		  continue;
+		}

 //std::cout << "matched a prefix! " << j->word << std::endl;
-	      if (match[0].rm_eo == startOffset) {
-		/* perfect prefix match */
-		startOffset = match[0].rm_so;
-		foundit = true;
-		break;
+		if (match[0].rm_eo == startOffset) {
+		  /* perfect prefix match */
+		  startOffset = match[0].rm_so;
+		  foundit = true;
+		  break;
+		}
 	      }
 	    }
+	    if (!foundit) {
+	      /* couldn't find a prefix, so skip this match */
+//std::cout << "Could not find a prefix" <<std::endl;
+	      continue;
+	    }
 	  }
-	  if (!foundit) {
-	    /* couldn't find a prefix, so skip this match */
-//std::cout << "Could not find a prefix" <<std::endl;
-	    continue;
-	  }
-	}

 //std::cout << "is endoffset alphabetic: " << input[endOffset] << std::endl;

-	if ( (endOffset<inputLength-1) && (isAlphabetic(input[endOffset])) ) {
+	  if ( (endOffset<inputLength-1) && (isAlphabetic(input[endOffset])) ) {

 //std::cout << "but didn't match a word ending" << std::endl;
-
-	  /* we are at the start of a word, but not at the end, try to get to the end */
-	  bool foundit = false;
-	  for (std::set<filter_t, expressionCompare>::iterator j = suffixes.begin();
-	       j != suffixes.end(); ++j) {
+
+	    /* we are at the start of a word, but not at the end, try to get to the end */
+	    bool foundit = false;
+	    for (std::set<filter_t, expressionCompare>::iterator j = suffixes.begin();
+	         j != suffixes.end(); ++j) {
 //std::cout << "checking " << j->word << " against [" << input + endOffset << "]" << std::endl;
-
-	    if (regexec(j->compiled, input + endOffset, 1, match, 0) == 0) {
+
+	      if (regexec(j->compiled, input + endOffset, 1, match, 0) == 0) {

 //std::cout << "is " << match[0].rm_eo << " less than " << inputLength - endOffset << std::endl;
 //std::cout << "is alpha =?= " << input[endOffset + match[0].rm_eo + 1] << std::endl;

-	      /* again, make sure we are now at a word end */
-	      if ( (match[0].rm_eo < inputLength - endOffset) &&
-		   (isAlphabetic(input[endOffset + match[0].rm_eo])) ) {
-		/* we matched, but we are still in the middle of a word */
-		continue;
-	      }
+		/* again, make sure we are now at a word end */
+		if ( (match[0].rm_eo < inputLength - endOffset) &&
+                     (isAlphabetic(input[endOffset + match[0].rm_eo])) ) {
+		  /* we matched, but we are still in the middle of a word */
+		  continue;
+		}

 //std::cout << "matched a suffix! " << j->word << std::endl;
-	      if (match[0].rm_so == 0) {
-		/* push the end forward a little since we matched */
-		endOffset += match[0].rm_eo;
-		foundit = true;
-		break;
+		if (match[0].rm_so == 0) {
+		  /* push the end forward a little since we matched */
+		  endOffset += match[0].rm_eo;
+		  foundit = true;
+		  break;
+		}
 	      }
 	    }
+	    if (!foundit) {
+	      /* couldn't find a suffix, so skip this match */
+//std::cout << "Could not find a suffix" <<std::endl;
+	      continue;
+	    }
 	  }
-	  if (!foundit) {
-	    /* couldn't find a suffix, so skip this match */
-//std::cout << "Could not find a suffix" <<std::endl;
-	    continue;
+
+	  // add a few more slots if necessary (this should be rare/never)
+	  if (matchCount * 2 + 1 >= matchPair.size()) {
+	    matchPair.resize(matchCount * 2 + 201);
 	  }
-	}
-
-	// add a few more slots if necessary (this should be rare/never)
-	if (matchCount * 2 + 1 >= matchPair.size()) {
-	  matchPair.resize(matchCount * 2 + 201);
-	}
-
-	matchPair[matchCount * 2] = startOffset; /* position */
-	matchPair[(matchCount * 2) + 1] = endOffset - startOffset; /* length */
-	matchCount++;
-	filtered = true;
-
-      } else if ( regCode == REG_NOMATCH ) {
-	// do nothing
-	continue;
-
-      } else {
-	char errorBuffer[256];
-	regerror(regCode, i->compiled, errorBuffer, 256);
-        std::cout << errorBuffer << std::endl;
-
-      } /* end if regcode */
+
+	  matchPair[matchCount * 2] = startOffset; /* position */
+	  matchPair[(matchCount * 2) + 1] = endOffset - startOffset; /* length */
+	  matchCount++;
+	  filtered = true;
+	  matched = true;
+	  // zappo! .. erase stuff that has been filtered to speed up future checks
+	  memset(sInput + startOffset, ' ', endOffset - startOffset);
+
+	} else if ( regCode == REG_NOMATCH ) {
+	  // do nothing
+	  continue;
+
+	} else {
+	  char errorBuffer[256];
+	  regerror(regCode, i->compiled, errorBuffer, 256);
+          std::cout << errorBuffer << std::endl;
+
+	} /* end if regcode */
+
+      } /* end regexec-ing */

     } /* iterate over words in a particular character bin */

@@ -276,6 +290,8 @@
       continue;
     }
   }
+
+  delete sInput;

   return filtered;