mail[Wesnoth-commits] r43869 - /trunk/src/hash.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by koraq on July 04, 2010 - 06:50:
Author: mordante
Date: Sun Jul  4 06:50:05 2010
New Revision: 43869

URL: http://svn.gna.org/viewcvs/wesnoth?rev=43869&view=rev
Log:
Converted the old style casts to c++ style casts.

Modified:
    trunk/src/hash.cpp

Modified: trunk/src/hash.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/hash.cpp?rev=43869&r1=43868&r2=43869&view=diff
==============================================================================
--- trunk/src/hash.cpp (original)
+++ trunk/src/hash.cpp Sun Jul  4 06:50:05 2010
@@ -25,7 +25,7 @@
 
 unsigned char* md5(const std::string& input) {
        MD5 md5_worker;
-       md5_worker.update((unsigned char*) input.c_str(), input.size());
+       md5_worker.update(const_cast<unsigned char*>(reinterpret_cast<const 
unsigned char*>(input.c_str())), input.size());
        md5_worker.finalize();
        return md5_worker.raw_digest();
 }
@@ -56,12 +56,12 @@
                unsigned value = input[i++];
                encoded_hash.append(itoa64.substr(value & 0x3f,1));
                if(i < 16)
-                       value |= (int)input[i] << 8;
+                       value |= static_cast<int>(input[i]) << 8;
                encoded_hash.append(itoa64.substr((value >> 6) & 0x3f,1));
                if(i++ >= 16)
                        break;
                if(i < 16)
-                       value |= (int)input[i] << 16;
+                       value |= static_cast<int>(input[i]) << 16;
                encoded_hash.append(itoa64.substr((value >> 12) & 0x3f,1));
                if(i++ >= 16)
                        break;
@@ -76,7 +76,7 @@
 
        unsigned char* output = md5(salt + password);
        do {
-               output = md5(std::string((char *) output, (char *) output + 
16).append(password));
+               output = md5(std::string(reinterpret_cast<char*>(output), 
reinterpret_cast<char*>(output) + 16).append(password));
        } while(--iteration_count);
 
        return encode_hash(output);




Related Messages


Powered by MHonArc, Updated Sun Jul 04 07:00:05 2010