Slightly improved seeding of the PRNG (again).

This commit is contained in:
LoRd_MuldeR 2012-10-09 17:43:17 +02:00
parent f39beba138
commit 0fac4fbb8f
7 changed files with 103 additions and 74 deletions

View File

@ -3234,105 +3234,105 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="268"/>
<location filename="../../src/Dialog_Update.cpp" line="545"/>
<location filename="../../src/Dialog_Update.cpp" line="273"/>
<location filename="../../src/Dialog_Update.cpp" line="550"/>
<source>Build</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="269"/>
<location filename="../../src/Dialog_Update.cpp" line="274"/>
<source>Unknown</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="377"/>
<location filename="../../src/Dialog_Update.cpp" line="382"/>
<source>Testing your internet connection, please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="397"/>
<location filename="../../src/Dialog_Update.cpp" line="989"/>
<location filename="../../src/Dialog_Update.cpp" line="402"/>
<location filename="../../src/Dialog_Update.cpp" line="994"/>
<source>It appears that the computer currently is offline!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="400"/>
<location filename="../../src/Dialog_Update.cpp" line="992"/>
<location filename="../../src/Dialog_Update.cpp" line="405"/>
<location filename="../../src/Dialog_Update.cpp" line="997"/>
<source>Please make sure your computer is connected to the internet and try again.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="458"/>
<location filename="../../src/Dialog_Update.cpp" line="463"/>
<source>Network connectivity test has failed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="461"/>
<location filename="../../src/Dialog_Update.cpp" line="466"/>
<source>Please make sure your internet connection is working properly and try again.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="475"/>
<location filename="../../src/Dialog_Update.cpp" line="480"/>
<source>Checking for new updates online, please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="530"/>
<location filename="../../src/Dialog_Update.cpp" line="535"/>
<source>Failed to fetch update information from server!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="535"/>
<location filename="../../src/Dialog_Update.cpp" line="540"/>
<source>Sorry, the update server might be busy at this time. Plase try again later.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="547"/>
<location filename="../../src/Dialog_Update.cpp" line="552"/>
<source>More information available at:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="553"/>
<location filename="../../src/Dialog_Update.cpp" line="558"/>
<source>A new version of LameXP is available!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="555"/>
<location filename="../../src/Dialog_Update.cpp" line="560"/>
<source>We highly recommend all users to install this update as soon as possible.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="564"/>
<location filename="../../src/Dialog_Update.cpp" line="569"/>
<source>No new updates available at this time.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="566"/>
<location filename="../../src/Dialog_Update.cpp" line="571"/>
<source>Your version of LameXP is still up-to-date. Please check for updates regularly!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="575"/>
<location filename="../../src/Dialog_Update.cpp" line="580"/>
<source>Your version appears to be newer than the latest release.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="577"/>
<location filename="../../src/Dialog_Update.cpp" line="582"/>
<source>This usually indicates your are currently using a pre-release version of LameXP.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="870"/>
<location filename="../../src/Dialog_Update.cpp" line="875"/>
<source>Update is being downloaded, please be patient...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="915"/>
<location filename="../../src/Dialog_Update.cpp" line="920"/>
<source>Update ready to install. Applicaion will quit...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="923"/>
<location filename="../../src/Dialog_Update.cpp" line="928"/>
<source>Update failed. Please try again or download manually!</source>
<translation type="unfinished"></translation>
</message>

View File

@ -3235,105 +3235,105 @@
<translation type="unfinished">Zamknij</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="268"/>
<location filename="../../src/Dialog_Update.cpp" line="545"/>
<location filename="../../src/Dialog_Update.cpp" line="273"/>
<location filename="../../src/Dialog_Update.cpp" line="550"/>
<source>Build</source>
<translation type="unfinished">Build</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="269"/>
<location filename="../../src/Dialog_Update.cpp" line="274"/>
<source>Unknown</source>
<translation type="unfinished">Nieznana</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="377"/>
<location filename="../../src/Dialog_Update.cpp" line="382"/>
<source>Testing your internet connection, please wait...</source>
<translation type="unfinished">Testowanie połączenia internetowego, prosze czekać...</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="397"/>
<location filename="../../src/Dialog_Update.cpp" line="989"/>
<location filename="../../src/Dialog_Update.cpp" line="402"/>
<location filename="../../src/Dialog_Update.cpp" line="994"/>
<source>It appears that the computer currently is offline!</source>
<translation type="unfinished">LameXP wykrył brak dostępu do internetu!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="400"/>
<location filename="../../src/Dialog_Update.cpp" line="992"/>
<location filename="../../src/Dialog_Update.cpp" line="405"/>
<location filename="../../src/Dialog_Update.cpp" line="997"/>
<source>Please make sure your computer is connected to the internet and try again.</source>
<translation type="unfinished">Upewnij się że komputer jest podłączony do internetu i spróbuj ponownie.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="458"/>
<location filename="../../src/Dialog_Update.cpp" line="463"/>
<source>Network connectivity test has failed!</source>
<translation type="unfinished">Test połączenia internetowego zakończony niepowodzeniem!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="461"/>
<location filename="../../src/Dialog_Update.cpp" line="466"/>
<source>Please make sure your internet connection is working properly and try again.</source>
<translation type="unfinished">Upewnij się że połączenie internetowe działa prawidłowo i spróbuj ponownie.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="475"/>
<location filename="../../src/Dialog_Update.cpp" line="480"/>
<source>Checking for new updates online, please wait...</source>
<translation type="unfinished">Sprawdzanie aktualizacji online, prosze czekać...</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="530"/>
<location filename="../../src/Dialog_Update.cpp" line="535"/>
<source>Failed to fetch update information from server!</source>
<translation type="unfinished">Pobieranie informacji z serwera zakończone niepowodzeniem!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="535"/>
<location filename="../../src/Dialog_Update.cpp" line="540"/>
<source>Sorry, the update server might be busy at this time. Plase try again later.</source>
<translation type="unfinished">Serwer aktualizacji wydaje się nie odpowiadać w tej chwili. Prosze spróbować później.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="547"/>
<location filename="../../src/Dialog_Update.cpp" line="552"/>
<source>More information available at:</source>
<translation type="unfinished">Więcej informacji tutaj:</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="553"/>
<location filename="../../src/Dialog_Update.cpp" line="558"/>
<source>A new version of LameXP is available!</source>
<translation type="unfinished">Dostępna nowa wersja LameXP!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="555"/>
<location filename="../../src/Dialog_Update.cpp" line="560"/>
<source>We highly recommend all users to install this update as soon as possible.</source>
<translation type="unfinished">Jest wysoce zalecane aby zainstalować aktualizację jak najszybciej.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="564"/>
<location filename="../../src/Dialog_Update.cpp" line="569"/>
<source>No new updates available at this time.</source>
<translation type="unfinished">Nie ma nowych aktualizacji w tej chwili.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="566"/>
<location filename="../../src/Dialog_Update.cpp" line="571"/>
<source>Your version of LameXP is still up-to-date. Please check for updates regularly!</source>
<translation type="unfinished">Posiadasz najnowszą wersję LameXP. Sprawdzaj aktualizacje regularnie!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="575"/>
<location filename="../../src/Dialog_Update.cpp" line="580"/>
<source>Your version appears to be newer than the latest release.</source>
<translation type="unfinished">Posiadasz nowszą wersję LameXP niż ostatnie wydanie.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="577"/>
<location filename="../../src/Dialog_Update.cpp" line="582"/>
<source>This usually indicates your are currently using a pre-release version of LameXP.</source>
<translation type="unfinished">To wskazuje na to, że posiadasz wersję alfa LameXP.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="870"/>
<location filename="../../src/Dialog_Update.cpp" line="875"/>
<source>Update is being downloaded, please be patient...</source>
<translation type="unfinished">Pobieranie aktualizacji w toku, prosze czekać...</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="915"/>
<location filename="../../src/Dialog_Update.cpp" line="920"/>
<source>Update ready to install. Applicaion will quit...</source>
<translation type="unfinished">Aktualizacja gotowa do instalacji. Teraz program zostanie zamknięty...</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="923"/>
<location filename="../../src/Dialog_Update.cpp" line="928"/>
<source>Update failed. Please try again or download manually!</source>
<translation type="unfinished">Aktualizacja zakończona niepowodzeniem. Prosze spróbować ponownie lub zainstalować ręcznie!</translation>
</message>

View File

@ -3236,105 +3236,105 @@
<translation>Stäng</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="268"/>
<location filename="../../src/Dialog_Update.cpp" line="545"/>
<location filename="../../src/Dialog_Update.cpp" line="273"/>
<location filename="../../src/Dialog_Update.cpp" line="550"/>
<source>Build</source>
<translation>Build</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="269"/>
<location filename="../../src/Dialog_Update.cpp" line="274"/>
<source>Unknown</source>
<translation>Okänd</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="377"/>
<location filename="../../src/Dialog_Update.cpp" line="382"/>
<source>Testing your internet connection, please wait...</source>
<translation>Kontrollerar iInternetanslutningen, vänta...</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="397"/>
<location filename="../../src/Dialog_Update.cpp" line="989"/>
<location filename="../../src/Dialog_Update.cpp" line="402"/>
<location filename="../../src/Dialog_Update.cpp" line="994"/>
<source>It appears that the computer currently is offline!</source>
<translation>Datorn verkar inte vara ansluten till Internet!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="400"/>
<location filename="../../src/Dialog_Update.cpp" line="992"/>
<location filename="../../src/Dialog_Update.cpp" line="405"/>
<location filename="../../src/Dialog_Update.cpp" line="997"/>
<source>Please make sure your computer is connected to the internet and try again.</source>
<translation>Tillse att datorn är ansluten till Internet och försök igen.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="458"/>
<location filename="../../src/Dialog_Update.cpp" line="463"/>
<source>Network connectivity test has failed!</source>
<translation>Anslutningskontrollen misslyckades!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="461"/>
<location filename="../../src/Dialog_Update.cpp" line="466"/>
<source>Please make sure your internet connection is working properly and try again.</source>
<translation>Tillse att Internetuppkopplingen fungerar korrekt och försök igen.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="475"/>
<location filename="../../src/Dialog_Update.cpp" line="480"/>
<source>Checking for new updates online, please wait...</source>
<translation>Söker nya uppdateringar, vänta...</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="530"/>
<location filename="../../src/Dialog_Update.cpp" line="535"/>
<source>Failed to fetch update information from server!</source>
<translation>Kunde inte hämta uppdateringsinformation från servern!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="535"/>
<location filename="../../src/Dialog_Update.cpp" line="540"/>
<source>Sorry, the update server might be busy at this time. Plase try again later.</source>
<translation>Uppdateringsservern kan vara upptagen. Försök senare.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="547"/>
<location filename="../../src/Dialog_Update.cpp" line="552"/>
<source>More information available at:</source>
<translation>Mer information hittas :</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="553"/>
<location filename="../../src/Dialog_Update.cpp" line="558"/>
<source>A new version of LameXP is available!</source>
<translation>En ny version av LameXP finns tillgänglig!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="555"/>
<location filename="../../src/Dialog_Update.cpp" line="560"/>
<source>We highly recommend all users to install this update as soon as possible.</source>
<translation>Vi rekommenderar alla användare att installera denna uppdatering snart som möjligt.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="564"/>
<location filename="../../src/Dialog_Update.cpp" line="569"/>
<source>No new updates available at this time.</source>
<translation>Det finns inga nya uppdateringar.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="566"/>
<location filename="../../src/Dialog_Update.cpp" line="571"/>
<source>Your version of LameXP is still up-to-date. Please check for updates regularly!</source>
<translation>Din version av LameXP är uppdaterad. Kontrollera regelbundet!</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="575"/>
<location filename="../../src/Dialog_Update.cpp" line="580"/>
<source>Your version appears to be newer than the latest release.</source>
<translation>Din version verkar vara nyare än senaste &apos;Release&apos;.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="577"/>
<location filename="../../src/Dialog_Update.cpp" line="582"/>
<source>This usually indicates your are currently using a pre-release version of LameXP.</source>
<translation>Det innebär normalt att du använder en beta-version av LameXP.</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="870"/>
<location filename="../../src/Dialog_Update.cpp" line="875"/>
<source>Update is being downloaded, please be patient...</source>
<translation>Uppdatering laddas ner, vänta...</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="915"/>
<location filename="../../src/Dialog_Update.cpp" line="920"/>
<source>Update ready to install. Applicaion will quit...</source>
<translation>Uppdatering klar att installeras. Programmet kommer att avslutas...</translation>
</message>
<message>
<location filename="../../src/Dialog_Update.cpp" line="923"/>
<location filename="../../src/Dialog_Update.cpp" line="928"/>
<source>Update failed. Please try again or download manually!</source>
<translation>Uppdateringen misslyckades. Försök igen, eller ladda ner manuellt!</translation>
</message>

View File

@ -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!)

View File

@ -42,6 +42,7 @@
#include <time.h>
#include <MMSystem.h>
#include <WinInet.h>
#include <process.h>
///////////////////////////////////////////////////////////////////////////////
@ -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);

View File

@ -2206,6 +2206,29 @@ QStringList lamexp_available_codepages(bool noAliases)
return codecList;
}
/*
* 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
*/

View File

@ -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);