fixed Windows build errors
authorVictor Kirhenshtein <victor@netxms.org>
Mon, 31 Oct 2016 20:15:31 +0000 (22:15 +0200)
committerVictor Kirhenshtein <victor@netxms.org>
Mon, 31 Oct 2016 20:15:31 +0000 (22:15 +0200)
include/nms_common.h
include/nms_util.h
include/nxcpapi.h
src/libnetxms/cc_ucs2.cpp
src/libnetxms/cc_ucs4.cpp
src/libnetxms/libnetxms.vcproj
src/libnetxms/message.cpp
src/libnetxms/msgwq.cpp
src/server/core/session.cpp
tests/test-libnetxms/test-libnetxms.vcproj

index a4fb8d8..9d7fb10 100644 (file)
@@ -203,7 +203,7 @@ typedef int bool;
 
 #define HAVE_WCSLEN             1
 #define HAVE_WCSNCPY            1
-#define HACE_WCSDUP             1
+#define HAVE_WCSDUP             1
 
 #ifndef va_copy
 #define va_copy(x,y)            (x = y)
index abab9ac..1a51b9a 100644 (file)
@@ -65,7 +65,7 @@
 #endif
 #define htond(x) bswap_double(x)
 #define ntohd(x) bswap_double(x)
-#define SwapUCS2String(x) bswap_array_16((x), -1)
+#define SwapUCS2String(x) bswap_array_16((UINT16 *)(x), -1)
 #endif
 
 #ifdef __cplusplus
index 8502817..eb63dfb 100644 (file)
@@ -211,7 +211,7 @@ private:
    void housekeeperRun();
 
    static Mutex m_housekeeperLock;
-   static HashMap<UINT64, MsgWaitQueue> m_activeQueues;
+   static HashMap<UINT64, MsgWaitQueue> *m_activeQueues;
    static Condition m_shutdownCondition;
    static THREAD m_housekeeperThread;
    static EnumerationCallbackResult houseKeeperCallback(const void *key, const void *object, void *arg);
index 245dbc4..3feee26 100644 (file)
@@ -44,7 +44,7 @@ static int __internal_ucs2_to_ucs4(const UCS2CHAR *src, int srcLen, UCS4CHAR *ds
  */
 int LIBNETXMS_EXPORTABLE ucs2_to_ucs4(const UCS2CHAR *src, int srcLen, UCS4CHAR *dst, int dstLen)
 {
-#ifndef __DISABLE_ICONV
+#if !defined(__DISABLE_ICONV) && !defined(_WIN32)
    iconv_t cd;
    const char *inbuf;
    char *outbuf;
index 6266e2c..4258abd 100644 (file)
@@ -44,7 +44,7 @@ static int __internal_ucs4_to_ucs2(const UCS4CHAR *src, int srcLen, UCS2CHAR *ds
  */
 int LIBNETXMS_EXPORTABLE ucs4_to_ucs2(const UCS4CHAR *src, int srcLen, UCS2CHAR *dst, int dstLen)
 {
-#ifndef __DISABLE_ICONV
+#if !defined(__DISABLE_ICONV) && !defined(_WIN32)
    iconv_t cd;
    const char *inbuf;
    char *outbuf;
index bd9476c..d8cab38 100644 (file)
                                >
                        </File>
                        <File
+                               RelativePath=".\cc_mb.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\cc_ucs2.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\cc_ucs4.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\cc_utf8.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\config.cpp"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath=".\unicode_cc.h"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\..\include\uthash.h"
                                >
                        </File>
index 218341f..800ce55 100644 (file)
@@ -130,8 +130,6 @@ NXCPMessage::NXCPMessage(NXCPMessage *msg)
  */
 NXCPMessage::NXCPMessage(NXCP_MESSAGE *msg, int version)
 {
-   UINT32 i;
-
    m_flags = ntohs(msg->flags);
    m_code = ntohs(msg->code);
    m_id = ntohl(msg->id);
index f006838..b77e56b 100644 (file)
@@ -37,7 +37,7 @@
  * Housekeeper data
  */
 Mutex MsgWaitQueue::m_housekeeperLock;
-HashMap<UINT64, MsgWaitQueue> MsgWaitQueue::m_activeQueues(false);
+HashMap<UINT64, MsgWaitQueue> *MsgWaitQueue::m_activeQueues = new HashMap<UINT64, MsgWaitQueue>(false);
 Condition MsgWaitQueue::m_shutdownCondition(true);
 THREAD MsgWaitQueue::m_housekeeperThread = INVALID_THREAD_HANDLE;
 
@@ -66,7 +66,7 @@ MsgWaitQueue::MsgWaitQueue()
 
    // register new queue
    m_housekeeperLock.lock();
-   m_activeQueues.set(CAST_FROM_POINTER(this, UINT64), this);
+   m_activeQueues->set(CAST_FROM_POINTER(this, UINT64), this);
    if (m_housekeeperThread == INVALID_THREAD_HANDLE)
    {
       m_housekeeperThread = ThreadCreateEx(MsgWaitQueue::housekeeperThread, 0, NULL);
@@ -81,7 +81,7 @@ MsgWaitQueue::~MsgWaitQueue()
 {
    // unregister queue
    m_housekeeperLock.lock();
-   m_activeQueues.remove(CAST_FROM_POINTER(this, UINT64));
+   m_activeQueues->remove(CAST_FROM_POINTER(this, UINT64));
    m_housekeeperLock.unlock();
 
    clear();
@@ -382,7 +382,7 @@ THREAD_RESULT THREAD_CALL MsgWaitQueue::housekeeperThread(void *arg)
    while(!m_shutdownCondition.wait(TTL_CHECK_INTERVAL))
    {
       m_housekeeperLock.lock();
-      m_activeQueues.forEach(MsgWaitQueue::houseKeeperCallback, NULL);
+      m_activeQueues->forEach(MsgWaitQueue::houseKeeperCallback, NULL);
       m_housekeeperLock.unlock();
    }
    return THREAD_OK;
@@ -398,6 +398,7 @@ void MsgWaitQueue::shutdown()
    m_housekeeperLock.lock();
    m_housekeeperThread = INVALID_THREAD_HANDLE;
    m_housekeeperLock.unlock();
+   delete m_activeQueues;
 }
 
 /**
@@ -419,13 +420,13 @@ String MsgWaitQueue::getDiagInfo()
 {
    String out;
    m_housekeeperLock.lock();
-   out.append(m_activeQueues.size());
+   out.append(m_activeQueues->size());
    out.append(_T(" active queues\nHousekeeper thread state is "));
    out.append((m_housekeeperThread != INVALID_THREAD_HANDLE) ? _T("RUNNING\n") : _T("STOPPED\n"));
-   if (m_activeQueues.size() > 0)
+   if (m_activeQueues->size() > 0)
    {
       out.append(_T("Active queues:\n"));
-      m_activeQueues.forEach(MsgWaitQueue::diagInfoCallback, &out);
+      m_activeQueues->forEach(MsgWaitQueue::diagInfoCallback, &out);
    }
    m_housekeeperLock.unlock();
    return out;
index f2644e5..6b77c04 100644 (file)
@@ -2053,9 +2053,6 @@ void ClientSession::getAlarmCategories(UINT32 requestId)
 void ClientSession::modifyAlarmCategory(NXCPMessage *pRequest)
 {
    NXCPMessage msg;
-   UINT32 dwCategoryId;
-
-   // Prepare reply message
    msg.setCode(CMD_REQUEST_COMPLETED);
    msg.setId(pRequest->getId());
 
index 1e37242..428f781 100644 (file)
                                RelativePath=".\test-libnetxms.cpp"
                                >
                        </File>
+                       <File
+                               RelativePath=".\threads.cpp"
+                               >
+                       </File>
                </Filter>
                <Filter
                        Name="Header Files"