From 0fac4fbb8fb21135583f6de9d659f7beeb87c8bf Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Tue, 9 Oct 2012 17:43:17 +0200 Subject: [PATCH] Slightly improved seeding of the PRNG (again). --- etc/Translation/Blank.ts | 46 ++++++++++++++++++++++---------------------- etc/Translation/LameXP_PL.ts | 46 ++++++++++++++++++++++---------------------- etc/Translation/LameXP_SV.ts | 46 ++++++++++++++++++++++---------------------- src/Config.h | 2 +- src/Dialog_Update.cpp | 13 +++++++++---- src/Global.cpp | 23 ++++++++++++++++++++++ src/Global.h | 1 + 7 files changed, 103 insertions(+), 74 deletions(-) diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index 3a481cd4..8ce5d7e9 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -3234,105 +3234,105 @@ - - + + Build - + Unknown - + Testing your internet connection, please wait... - - + + It appears that the computer currently is offline! - - + + Please make sure your computer is connected to the internet and try again. - + Network connectivity test has failed! - + Please make sure your internet connection is working properly and try again. - + Checking for new updates online, please wait... - + Failed to fetch update information from server! - + Sorry, the update server might be busy at this time. Plase try again later. - + More information available at: - + A new version of LameXP is available! - + We highly recommend all users to install this update as soon as possible. - + No new updates available at this time. - + Your version of LameXP is still up-to-date. Please check for updates regularly! - + Your version appears to be newer than the latest release. - + This usually indicates your are currently using a pre-release version of LameXP. - + Update is being downloaded, please be patient... - + Update ready to install. Applicaion will quit... - + Update failed. Please try again or download manually! diff --git a/etc/Translation/LameXP_PL.ts b/etc/Translation/LameXP_PL.ts index 7ef095ef..f26f51ed 100644 --- a/etc/Translation/LameXP_PL.ts +++ b/etc/Translation/LameXP_PL.ts @@ -3235,105 +3235,105 @@ Zamknij - - + + Build Build - + Unknown Nieznana - + Testing your internet connection, please wait... Testowanie połączenia internetowego, prosze czekać... - - + + It appears that the computer currently is offline! LameXP wykrył brak dostępu do internetu! - - + + Please make sure your computer is connected to the internet and try again. Upewnij się że komputer jest podłączony do internetu i spróbuj ponownie. - + Network connectivity test has failed! Test połączenia internetowego zakończony niepowodzeniem! - + Please make sure your internet connection is working properly and try again. Upewnij się że połączenie internetowe działa prawidłowo i spróbuj ponownie. - + Checking for new updates online, please wait... Sprawdzanie aktualizacji online, prosze czekać... - + Failed to fetch update information from server! Pobieranie informacji z serwera zakończone niepowodzeniem! - + Sorry, the update server might be busy at this time. Plase try again later. Serwer aktualizacji wydaje się nie odpowiadać w tej chwili. Prosze spróbować później. - + More information available at: Więcej informacji tutaj: - + A new version of LameXP is available! Dostępna nowa wersja LameXP! - + We highly recommend all users to install this update as soon as possible. Jest wysoce zalecane aby zainstalować tę aktualizację jak najszybciej. - + No new updates available at this time. Nie ma nowych aktualizacji w tej chwili. - + Your version of LameXP is still up-to-date. Please check for updates regularly! Posiadasz najnowszą wersję LameXP. Sprawdzaj aktualizacje regularnie! - + Your version appears to be newer than the latest release. Posiadasz nowszą wersję LameXP niż ostatnie wydanie. - + This usually indicates your are currently using a pre-release version of LameXP. To wskazuje na to, że posiadasz wersję alfa LameXP. - + Update is being downloaded, please be patient... Pobieranie aktualizacji w toku, prosze czekać... - + Update ready to install. Applicaion will quit... Aktualizacja gotowa do instalacji. Teraz program zostanie zamknięty... - + Update failed. Please try again or download manually! Aktualizacja zakończona niepowodzeniem. Prosze spróbować ponownie lub zainstalować ręcznie! diff --git a/etc/Translation/LameXP_SV.ts b/etc/Translation/LameXP_SV.ts index 35d579c7..605b7f26 100644 --- a/etc/Translation/LameXP_SV.ts +++ b/etc/Translation/LameXP_SV.ts @@ -3236,105 +3236,105 @@ Stäng - - + + Build Build - + Unknown Okänd - + Testing your internet connection, please wait... Kontrollerar iInternetanslutningen, vänta... - - + + It appears that the computer currently is offline! Datorn verkar inte vara ansluten till Internet! - - + + Please make sure your computer is connected to the internet and try again. Tillse att datorn är ansluten till Internet och försök igen. - + Network connectivity test has failed! Anslutningskontrollen misslyckades! - + Please make sure your internet connection is working properly and try again. Tillse att Internetuppkopplingen fungerar korrekt och försök igen. - + Checking for new updates online, please wait... Söker nya uppdateringar, vänta... - + Failed to fetch update information from server! Kunde inte hämta uppdateringsinformation från servern! - + Sorry, the update server might be busy at this time. Plase try again later. Uppdateringsservern kan vara upptagen. Försök senare. - + More information available at: Mer information hittas på: - + A new version of LameXP is available! En ny version av LameXP finns tillgänglig! - + We highly recommend all users to install this update as soon as possible. Vi rekommenderar alla användare att installera denna uppdatering så snart som möjligt. - + No new updates available at this time. Det finns inga nya uppdateringar. - + Your version of LameXP is still up-to-date. Please check for updates regularly! Din version av LameXP är uppdaterad. Kontrollera regelbundet! - + Your version appears to be newer than the latest release. Din version verkar vara nyare än senaste 'Release'. - + This usually indicates your are currently using a pre-release version of LameXP. Det innebär normalt att du använder en beta-version av LameXP. - + Update is being downloaded, please be patient... Uppdatering laddas ner, vänta... - + Update ready to install. Applicaion will quit... Uppdatering klar att installeras. Programmet kommer att avslutas... - + Update failed. Please try again or download manually! Uppdateringen misslyckades. Försök igen, eller ladda ner manuellt! diff --git a/src/Config.h b/src/Config.h index 686c2879..b67debe9 100644 --- a/src/Config.h +++ b/src/Config.h @@ -30,7 +30,7 @@ #define VER_LAMEXP_MINOR_LO 6 #define VER_LAMEXP_TYPE Beta #define VER_LAMEXP_PATCH 1 -#define VER_LAMEXP_BUILD 1137 +#define VER_LAMEXP_BUILD 1139 /////////////////////////////////////////////////////////////////////////////// // Tool versions (minimum expected versions!) diff --git a/src/Dialog_Update.cpp b/src/Dialog_Update.cpp index 5ede6331..acea2d74 100644 --- a/src/Dialog_Update.cpp +++ b/src/Dialog_Update.cpp @@ -42,6 +42,7 @@ #include #include #include +#include /////////////////////////////////////////////////////////////////////////////// @@ -91,12 +92,14 @@ static const char *known_hosts[] = //Taken form: http://www.alexa.com/topsites "http://www.bing.com/", "http://www.cnet.com/", "http://cnzz.com/", + "http://qt.digia.com/", "http://www.ebay.com/", "http://www.equation.com/", "http://fc2.com/", "http://www.ffmpeg.org/", "http://www.flickr.com/", "http://www.gitorious.org/", + "http://git-scm.com/", "http://www.gnome.org/", "http://www.gnu.org/", "http://go.com/", @@ -114,13 +117,14 @@ static const char *known_hosts[] = //Taken form: http://www.alexa.com/topsites "http://www.livejournal.com/", "http://mail.ru/", "http://www.mediafire.com/", - "http://www.mozilla.org/", + "http://www.mozilla.org/en-US/", "http://mplayerhq.hu/", "http://www.msn.com/?st=1", "http://oss.netfarm.it/", "http://www.nytimes.com/", "http://www.opera.com/", "http://www.quakelive.com/", + "http://qt-project.org/", "http://www.seamonkey-project.org/", "http://www.sina.com.cn/", "http://www.sohu.com/", @@ -141,6 +145,7 @@ static const char *known_hosts[] = //Taken form: http://www.alexa.com/topsites "http://www.yandex.ru/", "http://www.youtube.com/", "http://www.zedo.com/", + "http://ffmpeg.zeranoe.com/", NULL }; @@ -420,7 +425,7 @@ void UpdateDialog::checkForUpdates(void) hostList << QString::fromLatin1(known_hosts[i]); } - qsrand(time(NULL)); + qsrand(lamexp_mix(clock(), time(NULL), _getpid())); while(!hostList.isEmpty()) { QString currentHost = hostList.takeAt(qrand() % hostList.count()); @@ -481,10 +486,10 @@ void UpdateDialog::checkForUpdates(void) mirrorList << QString::fromLatin1(update_mirrors_prim[index]); } - qsrand(GetTickCount() ^ ((DWORD)time(NULL))); + qsrand(lamexp_mix(clock(), time(NULL), _getpid())); if(const int len = mirrorList.count()) { - const int rounds = len * 16; + const int rounds = len * 1097; for(int i = 0; i < rounds; i++) { mirrorList.swap(i % len, qrand() % len); diff --git a/src/Global.cpp b/src/Global.cpp index 966e57fd..8fd39d32 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -2207,6 +2207,29 @@ QStringList lamexp_available_codepages(bool noAliases) } /* + * Robert Jenkins' 96 bit Mix Function + * Source: http://www.concentric.net/~Ttwang/tech/inthash.htm + */ +unsigned int lamexp_mix(const unsigned int x, const unsigned int y, const unsigned int z) +{ + unsigned int a = x; + unsigned int b = y; + unsigned int c = y; + + a=a-b; a=a-c; a=a^(c >> 13); + b=b-c; b=b-a; b=b^(a << 8); + c=c-a; c=c-b; c=c^(b >> 13); + a=a-b; a=a-c; a=a^(c >> 12); + b=b-c; b=b-a; b=b^(a << 16); + c=c-a; c=c-b; c=c^(b >> 5); + a=a-b; a=a-c; a=a^(c >> 3); + b=b-c; b=b-a; b=b^(a << 10); + c=c-a; c=c-b; c=c^(b >> 15); + + return c; +} + +/* * Entry point checks */ static DWORD lamexp_entry_check(void); diff --git a/src/Global.h b/src/Global.h index 00aa7eed..982ae057 100644 --- a/src/Global.h +++ b/src/Global.h @@ -155,6 +155,7 @@ bool lamexp_themes_enabled(void); void lamexp_blink_window(QWidget *poWindow, unsigned int count = 10, unsigned int delay = 150); const QString lamexp_clean_filename(const QString &str); const QString lamexp_clean_filepath(const QString &str); +unsigned int lamexp_mix(const unsigned int x, const unsigned int y, const unsigned int z); //Debug-only functions SIZE_T lamexp_dbg_private_bytes(void); -- 2.11.0