diff options
Diffstat (limited to 'src/shared/Util.cpp')
-rw-r--r-- | src/shared/Util.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/shared/Util.cpp b/src/shared/Util.cpp index 26d2275ec2a..767b65e441c 100644 --- a/src/shared/Util.cpp +++ b/src/shared/Util.cpp @@ -1,7 +1,7 @@ /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * - * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,27 +36,27 @@ static MTRandTSS mtRand; int32 irand (int32 min, int32 max) { - return int32 (mtRand.get ().randInt (max - min)) + min; + return int32 (mtRand.get ().randInt (max - min)) + min; } uint32 urand (uint32 min, uint32 max) { - return mtRand.get ().randInt (max - min) + min; + return mtRand.get ().randInt (max - min) + min; } int32 rand32 () { - return mtRand.get ().randInt (); + return mtRand.get ().randInt (); } double rand_norm(void) { - return mtRand.get ().randExc (); + return mtRand.get ().randExc (); } double rand_chance (void) { - return mtRand.get ().randExc (100.0); + return mtRand.get ().randExc (100.0); } Tokens StrSplit(const std::string &src, const std::string &sep) @@ -254,8 +254,9 @@ bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize) size_t len = utf8::distance(utf8str,utf8str+csize); if(len > wsize) { + if(wsize > 0) + wstr[0] = L'\0'; wsize = 0; - wstr = L""; return false; } @@ -265,8 +266,9 @@ bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize) } catch(std::exception) { + if(wsize > 0) + wstr[0] = L'\0'; wsize = 0; - wstr = L""; return false; } |