All pastes #1764049 Raw Edit

Mine

public text v1 · immutable
#1764049 ·published 2010-01-24 15:27 UTC
rendered paste body
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0f8a87a..db46817 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -288,8 +288,8 @@ if(STATIC AND CMAKE_COMPILER_IS_GNUCXX)
 endif(STATIC AND CMAKE_COMPILER_IS_GNUCXX)
 
 if(WIN32)
-  link_libraries(imm32 winmm dbghelp Secur32)  # missing by default :/
-
+  find_library(DBGHELP_IBRARY dbghelp PATH ${CMAKE_LIBRARY_PATH} )
+  link_libraries(imm32 winmm  Secur32 ${DBGHELP_IBRARY})  # missing by default :/
   if(HAVE_SSL AND STATIC)
      find_package(OpenSSL REQUIRED)
      link_libraries(${OPENSSL_LIBRARIES} libeay32MD)
diff --git a/src/common/identity.cpp b/src/common/identity.cpp
index 275afcc..db37577 100644
--- a/src/common/identity.cpp
+++ b/src/common/identity.cpp
@@ -76,6 +76,18 @@ Identity::Identity(const Identity &other, QObject *parent)
   init();
 }
 
+#ifdef Q_OS_WIN32
+#ifdef UNICODE
+QString tcharToQString(TCHAR *tchar){
+  return  QString::fromUtf16( reinterpret_cast<ushort*>(tchar));
+}
+#else
+QString tcharToQString(TCHAR *tchar){
+  return  QString::fromLocal8(tchar);
+}
+#endif
+
+#endif
 void Identity::init() {
   setObjectName(QString::number(id().toInt()));
   setAllowClientUpdates(true);
@@ -102,7 +114,7 @@ QString Identity::defaultNick() {
   DWORD  bufCharCount = 128;
   //if(GetUserNameEx(/* NameSamCompatible */ 1, infoBuf, &bufCharCount))
   if(GetUserNameEx(NameSamCompatible, infoBuf, &bufCharCount)) {
-    QString nickName(infoBuf);
+    QString nickName( tcharToQString(infoBuf));
     int lastBs = nickName.lastIndexOf('\\');
     if(lastBs != -1) {
       nickName = nickName.mid(lastBs + 1);
@@ -138,7 +150,7 @@ QString Identity::defaultRealName() {
   TCHAR  infoBuf[128];
   DWORD  bufCharCount = 128;
   if(GetUserName(infoBuf, &bufCharCount))
-    return QString(infoBuf);
+    return tcharToQString(infoBuf);
   else
     return generalDefault;
 #else
diff --git a/src/common/logbacktrace_win.cpp b/src/common/logbacktrace_win.cpp
index 31d1f95..6f95d68 100644
--- a/src/common/logbacktrace_win.cpp
+++ b/src/common/logbacktrace_win.cpp
@@ -90,13 +90,26 @@ void Quassel::logBacktrace(const QString &filename) {
 #ifdef _M_IX86
     ZeroMemory(&Context, sizeof(CONTEXT));
     Context.ContextFlags = CONTEXT_CONTROL;
-    __asm {
+    
+//TODO:port asssembler to mingw32
+#ifdef __MINGW32__
+//      asm("Label:\n\t"
+//        "movl %%ebp,%0;\n\t"
+//        "movl %%esp,%1;\n\t"
+//        "movl $Label,%%eax;\n\t"
+//        "movl %%eax,;\n\t"
+//        :"=r"(Content.Epb),"=r"(Context.Esp),"=r"(Context.Eip)
+//        ://no input
+//        :"ebp","esp","eax");
+#else
+    _asm {
     Label:
       mov [Context.Ebp], ebp;
       mov [Context.Esp], esp;
       mov eax, [Label];
       mov [Context.Eip], eax;
     }
+#endif
 #else
     RtlCaptureContext(&Context);
 #endif
diff --git a/src/common/quassel.h b/src/common/quassel.h
index b42ee47..22b322e 100644
--- a/src/common/quassel.h
+++ b/src/common/quassel.h
@@ -26,7 +26,11 @@
 #include <QString>
 
 #include "abstractcliparser.h"
-
+#ifdef __MINGW32__
+//TODO:why TCHAR doesn't work with logbacktrace_win.h 
+//#include <windows.h>
+typedef const char *PCTSTR;
+#endif
 class Quassel {
   Q_DECLARE_TR_FUNCTIONS(Quassel)
 
diff --git a/src/common/syncableobject.h b/src/common/syncableobject.h
index 28e1472..2ab00e8 100644
--- a/src/common/syncableobject.h
+++ b/src/common/syncableobject.h
@@ -33,13 +33,13 @@
 #define SYNCABLE_OBJECT static const int _classNameOffset__;
 #define INIT_SYNCABLE_OBJECT(x) const int x ::_classNameOffset__ = QByteArray(staticMetaObject.className()).length() + 2;
 
-#ifdef Q_WS_WIN
+#ifdef _MSC_VER
 #    define SYNC(...) sync_call__(SignalProxy::Server, (__FUNCTION__ + _classNameOffset__), __VA_ARGS__);
 #    define REQUEST(...) sync_call__(SignalProxy::Client, (__FUNCTION__ + _classNameOffset__) , __VA_ARGS__);
 #else
 #    define SYNC(...) sync_call__(SignalProxy::Server, __func__, __VA_ARGS__);
 #    define REQUEST(...) sync_call__(SignalProxy::Client, __func__, __VA_ARGS__);
-#endif //Q_WS_WIN
+#endif //_MSC_VER
 
 #define SYNC_OTHER(x, ...) sync_call__(SignalProxy::Server, #x, __VA_ARGS__);
 #define REQUEST_OTHER(x, ...) sync_call__(SignalProxy::Client, #x, __VA_ARGS__);