summaryrefslogtreecommitdiff
path: root/client/Utility.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'client/Utility.cpp')
-rw-r--r--client/Utility.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/client/Utility.cpp b/client/Utility.cpp
index 2faed74..547a56a 100644
--- a/client/Utility.cpp
+++ b/client/Utility.cpp
@@ -27,3 +27,29 @@ QByteArray md5_sum(QString &filename)
Logger::Debug("MD5 sum for %s is: %s\n", filename.toStdString().c_str(), res.data());
return res;
}
+
+#ifdef WIN32
+
+int wstrlen(_TCHAR * wstr)
+{
+ int l_idx = 0;
+ while (((char*)wstr)[l_idx]!=0) l_idx+=2;
+ return l_idx;
+}
+
+char* wstrdup(_TCHAR* wSrc)
+{
+ int l_idx=0;
+ int l_len = wstrlen(wSrc);
+ char * l_nstr = (char*)malloc(l_len);
+ if (l_nstr) {
+ do {
+ l_nstr[l_idx] = (char)wSrc[l_idx];
+ l_idx++;
+ } while ((char)wSrc[l_idx]!=0);
+ }
+ l_nstr[l_idx] = 0;
+ return l_nstr;
+}
+
+#endif \ No newline at end of file