fixed compiler warnings
authorVictor Kirhenshtein <victor@netxms.org>
Fri, 10 Nov 2017 18:16:39 +0000 (20:16 +0200)
committerVictor Kirhenshtein <victor@netxms.org>
Fri, 10 Nov 2017 18:16:39 +0000 (20:16 +0200)
src/server/core/config.cpp
src/server/core/dcitem.cpp
src/server/core/dctable.cpp
src/server/core/session.cpp

index 53bc6c2..c297762 100644 (file)
@@ -178,10 +178,6 @@ stop_search:
        if (*debugLevel == NXCONFIG_UNINITIALIZED_VALUE)
           *debugLevel = (int)s_debugLevel;
 
-   int numTags = 0, lvl = 0;
-   TCHAR tagBuffer[254], lvlBuffer[2];
-   TCHAR const *ptr;
-
    if (s_debugTags != NULL)
    {
       int count;
index d41f6c8..27082d2 100644 (file)
@@ -154,8 +154,8 @@ DCItem::DCItem(DB_HANDLE hdb, DB_RESULT hResult, int iRow, Template *pNode) : DC
    list.splitAndAdd(pszTmp, _T(","));
    for(int i = 0; i < list.size(); i++)
    {
-      if(*(list.get(i)) != 0)
-         m_visibilityRights->add(_tcstoll(list.get(i), NULL, 0));
+      if (*(list.get(i)) != 0)
+         m_visibilityRights->add(_tcstol(list.get(i), NULL, 0));
    }
    free(pszTmp);
 
index e2385ab..c3c07a2 100644 (file)
@@ -224,7 +224,7 @@ DCTable::DCTable(DB_HANDLE hdb, DB_RESULT hResult, int iRow, Template *pNode) :
    for(int i = 0; i < list.size(); i++)
    {
       if(*(list.get(i)) != 0)
-         m_visibilityRights->add(_tcstoll(list.get(i), NULL, 0));
+         m_visibilityRights->add(_tcstol(list.get(i), NULL, 0));
    }
    free(pszTmp);
 }
index b5d7219..5350dde 100644 (file)
@@ -7807,7 +7807,7 @@ static StringList *SplitCommandLine(TCHAR *command)
    StringList *listOfStrings = new StringList();
    String tmp;
    int state = 0;
-   int size = _tcslen(command);
+   int size = (int)_tcslen(command);
    for(int i = 0; i < size; i++)
    {
       TCHAR c = command[i];
@@ -9705,7 +9705,7 @@ void ClientSession::exportConfiguration(NXCPMessage *pRequest)
          count = pRequest->getFieldAsUInt32(VID_NUM_ACTIONS);
          pdwList = (UINT32 *)malloc(sizeof(UINT32) * count);
          pRequest->getFieldAsInt32Array(VID_ACTION_LIST, count, pdwList);
-         for(int i = 0; i < count; i++)
+         for(i = 0; i < count; i++)
             CreateActionExportRecord(str, pdwList[i]);
          safe_free(pdwList);
          str.append(_T("\t</actions>\n"));
@@ -9930,7 +9930,7 @@ void ClientSession::addCACertificate(NXCPMessage *pRequest)
 {
    NXCPMessage msg;
 #ifdef _WITH_ENCRYPTION
-       UINT32 dwLen, dwQLen, dwCertId;
+       UINT32 dwCertId;
        BYTE *pData;
        OPENSSL_CONST BYTE *p;
        X509 *pCert;
@@ -9943,15 +9943,15 @@ void ClientSession::addCACertificate(NXCPMessage *pRequest)
        if (checkSysAccessRights(SYSTEM_ACCESS_SERVER_CONFIG))
        {
 #ifdef _WITH_ENCRYPTION
-               dwLen = pRequest->getFieldAsBinary(VID_CERTIFICATE, NULL, 0);
-               if (dwLen > 0)
+               size_t len = pRequest->getFieldAsBinary(VID_CERTIFICATE, NULL, 0);
+               if (len > 0)
                {
-                       pData = (BYTE *)malloc(dwLen);
-                       pRequest->getFieldAsBinary(VID_CERTIFICATE, pData, dwLen);
+                       pData = (BYTE *)malloc(len);
+                       pRequest->getFieldAsBinary(VID_CERTIFICATE, pData, len);
 
                        // Validate certificate
                        p = pData;
-                       pCert = d2i_X509(NULL, &p, dwLen);
+                       pCert = d2i_X509(NULL, &p, (long)len);
                        if (pCert != NULL)
                        {
             char subjectName[1024];
@@ -9968,13 +9968,13 @@ void ClientSession::addCACertificate(NXCPMessage *pRequest)
                                pszEscComments = EncodeSQLString(pszComments);
                                free(pszComments);
                                dwCertId = CreateUniqueId(IDG_CERTIFICATE);
-                               dwQLen = dwLen * 2 + (UINT32)_tcslen(pszEscComments) + (UINT32)_tcslen(pszEscSubject) + 256;
-                               pszQuery = (TCHAR *)malloc(dwQLen * sizeof(TCHAR));
-                               _sntprintf(pszQuery, dwQLen, _T("INSERT INTO certificates (cert_id,cert_type,subject,comments,cert_data) VALUES (%d,%d,'%s','%s','"),
+                               size_t qlen = len * 2 + _tcslen(pszEscComments) + _tcslen(pszEscSubject) + 256;
+                               pszQuery = (TCHAR *)malloc(qlen * sizeof(TCHAR));
+                               _sntprintf(pszQuery, qlen, _T("INSERT INTO certificates (cert_id,cert_type,subject,comments,cert_data) VALUES (%d,%d,'%s','%s','"),
                                           dwCertId, CERT_TYPE_TRUSTED_CA, pszEscSubject, pszEscComments);
                                free(pszEscSubject);
                                free(pszEscComments);
-                               BinToStr(pData, dwLen, &pszQuery[_tcslen(pszQuery)]);
+                               BinToStr(pData, len, &pszQuery[_tcslen(pszQuery)]);
                                _tcscat(pszQuery, _T("')"));
                                DB_HANDLE hdb = DBConnectionPoolAcquireConnection();
                                if (DBQuery(hdb, pszQuery))
@@ -11415,9 +11415,9 @@ void ClientSession::updateUsmCredentials(NXCPMessage *request)
                           DB_STATEMENT hStmt = DBPrepare(hdb, _T("INSERT INTO usm_credentials (id,user_name,auth_method,priv_method,auth_password,priv_password,zone) VALUES(?,?,?,?,?,?,?)"));
                           if (hStmt != NULL)
                           {
-                        UINT32 id;
+                        UINT32 id = VID_USM_CRED_LIST_BASE;
                         int count = (int)request->getFieldAsUInt32(VID_NUM_RECORDS);
-               for(int i = 0, id = VID_USM_CRED_LIST_BASE; i < count; i++, id += 4)
+               for(int i = 0; i < count; i++, id += 4)
                {
                   DBBind(hStmt, 1, DB_SQLTYPE_INTEGER, i+1);
                   DBBind(hStmt, 2, DB_SQLTYPE_VARCHAR, request->getFieldAsString(id++), DB_BIND_DYNAMIC);