Ver código fonte

Using our asserts in FileZilla code

Source commit: a294b54252528b1b33b5d205336bb321584dcf95
Martin Prikryl 10 anos atrás
pai
commit
c2f3ec506b

+ 5 - 5
source/filezilla/ApiLog.cpp

@@ -34,7 +34,7 @@ bool CApiLog::LoggingMessageType(int nMessageType) const
 
 void CApiLog::LogMessage(int nMessageType, LPCTSTR pMsgFormat, ...) const
 {
-  ASSERT(nMessageType>=FZ_LOG_STATUS && nMessageType<=FZ_LOG_DEBUG);
+  DebugAssert(nMessageType>=FZ_LOG_STATUS && nMessageType<=FZ_LOG_DEBUG);
   if (!LoggingMessageType(nMessageType))
     return;
 
@@ -52,7 +52,7 @@ void CApiLog::LogMessage(int nMessageType, LPCTSTR pMsgFormat, ...) const
 
 void CApiLog::LogMessageRaw(int nMessageType, LPCTSTR pMsg) const
 {
-  ASSERT(nMessageType>=FZ_LOG_STATUS && nMessageType<=FZ_LOG_DEBUG);
+  DebugAssert(nMessageType>=FZ_LOG_STATUS && nMessageType<=FZ_LOG_DEBUG);
   if (!LoggingMessageType(nMessageType))
     return;
 
@@ -63,7 +63,7 @@ void CApiLog::LogMessageRaw(int nMessageType, LPCTSTR pMsg) const
 
 void CApiLog::LogMessage(int nMessageType, UINT nFormatID, ...) const
 {
-  ASSERT(nMessageType>=FZ_LOG_STATUS && nMessageType<=FZ_LOG_DEBUG);
+  DebugAssert(nMessageType>=FZ_LOG_STATUS && nMessageType<=FZ_LOG_DEBUG);
   if (!LoggingMessageType(nMessageType))
     return;
 
@@ -97,12 +97,12 @@ void CApiLog::SendLogMessage(int nMessageType, LPCTSTR pMsg) const
 
 CString CApiLog::GetOption(int OptionID) const
 {
-  assert(FIntern != NULL);
+  DebugAssert(FIntern != NULL);
   return FIntern->GetOption(OptionID);
 }
 
 int CApiLog::GetOptionVal(int OptionID) const
 {
-  assert(FIntern != NULL);
+  DebugAssert(FIntern != NULL);
   return FIntern->GetOptionVal(OptionID);
 }

+ 23 - 23
source/filezilla/AsyncProxySocketLayer.cpp

@@ -48,7 +48,7 @@ CAsyncProxySocketLayer::~CAsyncProxySocketLayer()
 void CAsyncProxySocketLayer::SetProxy(int nProxyType)
 {
   //Validate the parameters
-  ASSERT(nProxyType==PROXYTYPE_NOPROXY);
+  DebugAssert(nProxyType==PROXYTYPE_NOPROXY);
   m_ProxyData.nProxyType=nProxyType;
 }
 
@@ -56,14 +56,14 @@ void CAsyncProxySocketLayer::SetProxy(int nProxyType, const char * pProxyHost, i
 {
   USES_CONVERSION;
   //Validate the parameters
-  ASSERT(nProxyType==PROXYTYPE_SOCKS4  ||
+  DebugAssert(nProxyType==PROXYTYPE_SOCKS4  ||
        nProxyType==PROXYTYPE_SOCKS4A ||
        nProxyType==PROXYTYPE_SOCKS5  ||
        nProxyType==PROXYTYPE_HTTP11);
-  ASSERT(!m_nProxyOpID);
-  ASSERT(pProxyHost && *pProxyHost);
-  ASSERT(ProxyPort>0);
-  ASSERT(ProxyPort<=65535);
+  DebugAssert(!m_nProxyOpID);
+  DebugAssert(pProxyHost && *pProxyHost);
+  DebugAssert(ProxyPort>0);
+  DebugAssert(ProxyPort<=65535);
 
   delete m_ProxyData.pProxyHost;
   delete m_ProxyData.pProxyUser;
@@ -82,11 +82,11 @@ void CAsyncProxySocketLayer::SetProxy(int nProxyType, const char * pProxyHost, i
 {
   USES_CONVERSION;
   //Validate the parameters
-  ASSERT(nProxyType==PROXYTYPE_SOCKS5 || nProxyType==PROXYTYPE_HTTP11);
-  ASSERT(!m_nProxyOpID);
-  ASSERT(pProxyHost && *pProxyHost);
-  ASSERT(ProxyPort>0);
-  ASSERT(ProxyPort<=65535);
+  DebugAssert(nProxyType==PROXYTYPE_SOCKS5 || nProxyType==PROXYTYPE_HTTP11);
+  DebugAssert(!m_nProxyOpID);
+  DebugAssert(pProxyHost && *pProxyHost);
+  DebugAssert(ProxyPort>0);
+  DebugAssert(ProxyPort<=65535);
 
   delete m_ProxyData.pProxyHost;
   delete m_ProxyData.pProxyUser;
@@ -317,8 +317,8 @@ void CAsyncProxySocketLayer::OnReceive(int nErrorCode)
           //Send authentication
           LPCSTR lpszAsciiUser = m_ProxyData.pProxyUser;
           LPCSTR lpszAsciiPass = m_ProxyData.pProxyPass;
-          ASSERT(strlen(lpszAsciiUser)<=255);
-          ASSERT(strlen(lpszAsciiPass)<=255);
+          DebugAssert(strlen(lpszAsciiUser)<=255);
+          DebugAssert(strlen(lpszAsciiPass)<=255);
           unsigned char *buffer = new unsigned char[3 + (lpszAsciiUser?strlen(lpszAsciiUser):0) + (lpszAsciiPass?strlen(lpszAsciiPass):0) + 1];
           sprintf((char *)buffer, "  %s %s", lpszAsciiUser?lpszAsciiUser:"", lpszAsciiPass?lpszAsciiPass:"");
           buffer[0]=1;
@@ -529,7 +529,7 @@ void CAsyncProxySocketLayer::OnReceive(int nErrorCode)
           m_nProxyOpState++;
           unsigned long ip;
           unsigned short port;
-          ASSERT(m_pRecvBuffer[3]==1);
+          DebugAssert(m_pRecvBuffer[3]==1);
           memcpy(&ip, &m_pRecvBuffer[4], 4);
           memcpy(&port, &m_pRecvBuffer[8], 2);
           t_ListenSocketCreatedStruct data;
@@ -586,7 +586,7 @@ void CAsyncProxySocketLayer::OnReceive(int nErrorCode)
   }
   if (m_ProxyData.nProxyType==PROXYTYPE_HTTP11)
   {
-    ASSERT (m_nProxyOpID==PROXYOP_CONNECT);
+    DebugAssert (m_nProxyOpID==PROXYOP_CONNECT);
     char buffer[9]={0};
     for(;;)
     {
@@ -667,7 +667,7 @@ BOOL CAsyncProxySocketLayer::Connect( LPCTSTR lpszHostAddress, UINT nHostPort )
   USES_CONVERSION;
 
   //Translate the host address
-  ASSERT(lpszHostAddress != NULL);
+  DebugAssert(lpszHostAddress != NULL);
 
   if (m_ProxyData.nProxyType != PROXYTYPE_SOCKS4)
   {
@@ -766,7 +766,7 @@ void CAsyncProxySocketLayer::OnConnect(int nErrorCode)
     TriggerEvent(FD_CONNECT, nErrorCode, TRUE);
     return;
   }
-  ASSERT(m_nProxyOpID);
+  DebugAssert(m_nProxyOpID);
   if (!m_nProxyOpID)
   {
     //This should not happen
@@ -789,7 +789,7 @@ void CAsyncProxySocketLayer::OnConnect(int nErrorCode)
     if (m_nProxyOpState)
       //Somehow OnConnect has been called more than once
       return;
-    ASSERT(m_ProxyData.nProxyType!=PROXYTYPE_NOPROXY);
+    DebugAssert(m_ProxyData.nProxyType!=PROXYTYPE_NOPROXY);
     ClearBuffer();
     DoLayerCallback(LAYERCALLBACK_LAYERSPECIFIC, PROXYERROR_NOERROR, 0);
     //Send the initial request
@@ -805,8 +805,8 @@ void CAsyncProxySocketLayer::OnConnect(int nErrorCode)
       memcpy(&command[2],&m_nProxyPeerPort,2); //Copy target address
       if (!m_nProxyPeerIp || m_ProxyData.nProxyType==PROXYTYPE_SOCKS4A)
       {
-        ASSERT(m_ProxyData.nProxyType==PROXYTYPE_SOCKS4A);
-        ASSERT(strcmp(lpszAscii, ""));
+        DebugAssert(m_ProxyData.nProxyType==PROXYTYPE_SOCKS4A);
+        DebugAssert(strcmp(lpszAscii, ""));
         //Set the IP to 0.0.0.x (x is nonzero)
         command[4]=0;
         command[5]=0;
@@ -945,7 +945,7 @@ void CAsyncProxySocketLayer::OnConnect(int nErrorCode)
       return;
     }
     else
-      ASSERT(FALSE);
+      DebugAssert(FALSE);
     //Now we'll wait for the response, handled in OnReceive
     m_nProxyOpState++;
   }
@@ -1011,7 +1011,7 @@ BOOL CAsyncProxySocketLayer::GetPeerName(CString &rPeerAddress, UINT &rPeerPort)
     return FALSE;
   }
 
-  ASSERT(m_ProxyData.nProxyType);
+  DebugAssert(m_ProxyData.nProxyType);
   BOOL res=GetPeerNameNext( rPeerAddress, rPeerPort );
   if (res)
   {
@@ -1044,7 +1044,7 @@ BOOL CAsyncProxySocketLayer::GetPeerName( SOCKADDR* lpSockAddr, int* lpSockAddrL
     return FALSE;
   }
 
-  ASSERT(m_ProxyData.nProxyType);
+  DebugAssert(m_ProxyData.nProxyType);
   BOOL res=GetPeerNameNext(lpSockAddr,lpSockAddrLen);
   if (res)
   {

+ 43 - 43
source/filezilla/AsyncSocketEx.cpp

@@ -59,7 +59,7 @@ public:
     RegisterClassEx(&wndclass);
 
     m_hWnd=CreateWindow(L"CAsyncSocketEx Helper Window", L"CAsyncSocketEx Helper Window", 0, 0, 0, 0, 0, 0, 0, GetModuleHandle(0), 0);
-    ASSERT(m_hWnd);
+    DebugAssert(m_hWnd);
     SetWindowLongPtr(m_hWnd, GWL_USERDATA, (LONG)this);
   };
 
@@ -82,10 +82,10 @@ public:
   //Adds a socket to the list of attached sockets
   BOOL AddSocket(CAsyncSocketEx *pSocket, int &nSocketIndex)
   {
-    ASSERT(pSocket);
+    DebugAssert(pSocket);
     if (!m_nWindowDataSize)
     {
-      ASSERT(!m_nSocketCount);
+      DebugAssert(!m_nSocketCount);
       m_nWindowDataSize=512;
       m_pAsyncSocketExWindowData=new t_AsyncSocketExWindowData[512]; //Reserve space for 512 active sockets
       memset(m_pAsyncSocketExWindowData, 0, 512*sizeof(t_AsyncSocketExWindowData));
@@ -93,10 +93,10 @@ public:
 
     if (nSocketIndex!=-1)
     {
-      ASSERT(m_pAsyncSocketExWindowData);
-      ASSERT(m_nWindowDataSize>nSocketIndex);
-      ASSERT(m_pAsyncSocketExWindowData[nSocketIndex].m_pSocket==pSocket);
-      ASSERT(m_nSocketCount);
+      DebugAssert(m_pAsyncSocketExWindowData);
+      DebugAssert(m_nWindowDataSize>nSocketIndex);
+      DebugAssert(m_pAsyncSocketExWindowData[nSocketIndex].m_pSocket==pSocket);
+      DebugAssert(m_nSocketCount);
       return TRUE;
     }
 
@@ -104,7 +104,7 @@ public:
     if (m_nSocketCount>=(m_nWindowDataSize-10))
     {
       int nOldWindowDataSize=m_nWindowDataSize;
-      ASSERT(m_nWindowDataSize<MAX_SOCKETS);
+      DebugAssert(m_nWindowDataSize<MAX_SOCKETS);
       m_nWindowDataSize+=512;
       if (m_nWindowDataSize>MAX_SOCKETS)
         m_nWindowDataSize=MAX_SOCKETS;
@@ -135,7 +135,7 @@ public:
   //Removes a socket from the socket storage
   BOOL RemoveSocket(CAsyncSocketEx *pSocket, int &nSocketIndex)
   {
-    ASSERT(pSocket);
+    DebugAssert(pSocket);
     if (nSocketIndex==-1)
       return TRUE;
 
@@ -143,10 +143,10 @@ public:
     MSG msg;
     while (PeekMessage(&msg, m_hWnd, WM_SOCKETEX_NOTIFY + nSocketIndex, WM_SOCKETEX_NOTIFY + nSocketIndex, PM_REMOVE));
 
-    ASSERT(m_pAsyncSocketExWindowData);
-    ASSERT(m_nWindowDataSize>0);
-    ASSERT(m_nSocketCount>0);
-    ASSERT(m_pAsyncSocketExWindowData[nSocketIndex].m_pSocket==pSocket);
+    DebugAssert(m_pAsyncSocketExWindowData);
+    DebugAssert(m_nWindowDataSize>0);
+    DebugAssert(m_nSocketCount>0);
+    DebugAssert(m_pAsyncSocketExWindowData[nSocketIndex].m_pSocket==pSocket);
     m_pAsyncSocketExWindowData[nSocketIndex].m_pSocket=0;
     nSocketIndex=-1;
     m_nSocketCount--;
@@ -187,13 +187,13 @@ public:
   static LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
   {
     //Verify parameters
-    ASSERT(hWnd);
+    DebugAssert(hWnd);
     if (!hWnd)
       return 0;
     CAsyncSocketExHelperWindow *pWnd=(CAsyncSocketExHelperWindow *)GetWindowLongPtr(hWnd, GWL_USERDATA);
     if (message>=WM_SOCKETEX_NOTIFY)
     {
-      ASSERT(pWnd);
+      DebugAssert(pWnd);
 
       if (message<static_cast<UINT>(WM_SOCKETEX_NOTIFY+pWnd->m_nWindowDataSize)) //Index is within socket storage
       {
@@ -388,7 +388,7 @@ public:
     }
     else if (message == WM_USER) //Notification event sent by a layer
     {
-      ASSERT(pWnd);
+      DebugAssert(pWnd);
 
       if (wParam >= static_cast<UINT>(pWnd->m_nWindowDataSize)) //Index is within socket storage
       {
@@ -520,13 +520,13 @@ public:
     }
     else if (message == WM_USER+1)
     {
-      ASSERT(pWnd);
+      DebugAssert(pWnd);
       // WSAAsyncGetHostByName reply
 
       // Verify parameters
-      ASSERT(hWnd);
+      DebugAssert(hWnd);
       CAsyncSocketExHelperWindow *pWnd = (CAsyncSocketExHelperWindow *)GetWindowLongPtr(hWnd, GWL_USERDATA);
-      ASSERT(pWnd);
+      DebugAssert(pWnd);
 
       CAsyncSocketEx *pSocket = NULL;
       for (int i = 0; i < pWnd->m_nWindowDataSize; i++)
@@ -565,7 +565,7 @@ public:
     }
     else if (message == WM_USER + 2)
     {
-      ASSERT(pWnd);
+      DebugAssert(pWnd);
       if (wParam >= static_cast<UINT>(pWnd->m_nWindowDataSize)) //Index is within socket storage
         return 0;
 
@@ -580,7 +580,7 @@ public:
     }
     else if (message == WM_TIMER)
     {
-      ASSERT(pWnd);
+      DebugAssert(pWnd);
       if (wParam != 1)
         return 0;
 
@@ -654,7 +654,7 @@ CAsyncSocketEx::~CAsyncSocketEx()
 
 BOOL CAsyncSocketEx::Create(UINT nSocketPort /*=0*/, int nSocketType /*=SOCK_STREAM*/, long lEvent /*=FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT | FD_CONNECT | FD_CLOSE*/, LPCTSTR lpszSocketAddress /*=NULL*/, int nFamily /*=AF_INET*/)
 {
-  ASSERT(GetSocketHandle() == INVALID_SOCKET);
+  DebugAssert(GetSocketHandle() == INVALID_SOCKET);
 
   //Close the socket, although this should not happen
   if (GetSocketHandle() != INVALID_SOCKET)
@@ -664,7 +664,7 @@ BOOL CAsyncSocketEx::Create(UINT nSocketPort /*=0*/, int nSocketType /*=SOCK_STR
   }
 
   BOOL res = InitAsyncSocketExInstance();
-  ASSERT(res);
+  DebugAssert(res);
   if (!res)
   {
     WSASetLastError(WSANOTINITIALISED);
@@ -844,17 +844,17 @@ BOOL CAsyncSocketEx::Bind(const SOCKADDR* lpSockAddr, int nSockAddrLen)
 
 void CAsyncSocketEx::AttachHandle(SOCKET hSocket)
 {
-  ASSERT(m_pLocalAsyncSocketExThreadData);
+  DebugAssert(m_pLocalAsyncSocketExThreadData);
   VERIFY(m_pLocalAsyncSocketExThreadData->m_pHelperWindow->AddSocket(this, m_SocketData.nSocketIndex));
   SetState(attached);
 }
 
 void CAsyncSocketEx::DetachHandle(SOCKET hSocket)
 {
-  ASSERT(m_pLocalAsyncSocketExThreadData);
+  DebugAssert(m_pLocalAsyncSocketExThreadData);
   if (!m_pLocalAsyncSocketExThreadData)
     return;
-  ASSERT(m_pLocalAsyncSocketExThreadData->m_pHelperWindow);
+  DebugAssert(m_pLocalAsyncSocketExThreadData->m_pHelperWindow);
   if (!m_pLocalAsyncSocketExThreadData->m_pHelperWindow)
     return;
   VERIFY(m_pLocalAsyncSocketExThreadData->m_pHelperWindow->RemoveSocket(this, m_SocketData.nSocketIndex));
@@ -907,8 +907,8 @@ BOOL CAsyncSocketEx::InitAsyncSocketExInstance()
     t_AsyncSocketExThreadDataList *pList=m_spAsyncSocketExThreadDataList;
     while (pList)
     {
-      ASSERT(pList->pThreadData);
-      ASSERT(pList->pThreadData->nInstanceCount>0);
+      DebugAssert(pList->pThreadData);
+      DebugAssert(pList->pThreadData->nInstanceCount>0);
 
       if (pList->pThreadData->nThreadId==id)
       {
@@ -966,19 +966,19 @@ void CAsyncSocketEx::FreeAsyncSocketExInstance()
   DWORD id=m_pLocalAsyncSocketExThreadData->nThreadId;
   m_sGlobalCriticalSection.Lock();
 
-  ASSERT(m_spAsyncSocketExThreadDataList);
+  DebugAssert(m_spAsyncSocketExThreadDataList);
   t_AsyncSocketExThreadDataList *pList=m_spAsyncSocketExThreadDataList;
   t_AsyncSocketExThreadDataList *pPrev=0;
 
   //Serach for data for current thread and decrease instance count
   while (pList)
   {
-    ASSERT(pList->pThreadData);
-    ASSERT(pList->pThreadData->nInstanceCount>0);
+    DebugAssert(pList->pThreadData);
+    DebugAssert(pList->pThreadData->nInstanceCount>0);
 
     if (pList->pThreadData->nThreadId==id)
     {
-      ASSERT(m_pLocalAsyncSocketExThreadData==pList->pThreadData);
+      DebugAssert(m_pLocalAsyncSocketExThreadData==pList->pThreadData);
       m_pLocalAsyncSocketExThreadData->nInstanceCount--;
 
       //Freeing last instance?
@@ -999,7 +999,7 @@ void CAsyncSocketEx::FreeAsyncSocketExInstance()
     }
     pPrev=pList;
     pList=pList->pNext;
-    ASSERT(pList);
+    DebugAssert(pList);
   }
 
   m_sGlobalCriticalSection.Unlock();
@@ -1041,7 +1041,7 @@ BOOL CAsyncSocketEx::Connect(LPCTSTR lpszHostAddress, UINT nHostPort)
   {
     USES_CONVERSION;
 
-    ASSERT(lpszHostAddress != NULL);
+    DebugAssert(lpszHostAddress != NULL);
 
     SOCKADDR_IN sockAddr;
     memset(&sockAddr,0,sizeof(sockAddr));
@@ -1075,7 +1075,7 @@ BOOL CAsyncSocketEx::Connect(LPCTSTR lpszHostAddress, UINT nHostPort)
   {
     USES_CONVERSION;
 
-    ASSERT( lpszHostAddress != NULL );
+    DebugAssert( lpszHostAddress != NULL );
 
     if (m_SocketData.addrInfo)
     {
@@ -1364,7 +1364,7 @@ BOOL CAsyncSocketEx::Attach(SOCKET hSocket, long lEvent /*= FD_READ | FD_WRITE |
 
 BOOL CAsyncSocketEx::AsyncSelect( long lEvent /*= FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT | FD_CONNECT | FD_CLOSE*/ )
 {
-  ASSERT(m_pLocalAsyncSocketExThreadData);
+  DebugAssert(m_pLocalAsyncSocketExThreadData);
   m_lEvent = lEvent;
   if (m_pFirstLayer)
     return TRUE;
@@ -1397,7 +1397,7 @@ BOOL CAsyncSocketEx::Listen( int nConnectionBacklog /*=5*/ )
 
 BOOL CAsyncSocketEx::Accept( CAsyncSocketEx& rConnectedSocket, SOCKADDR* lpSockAddr /*=NULL*/, int* lpSockAddrLen /*=NULL*/ )
 {
-  ASSERT(rConnectedSocket.m_SocketData.hSocket == INVALID_SOCKET);
+  DebugAssert(rConnectedSocket.m_SocketData.hSocket == INVALID_SOCKET);
   if (m_pFirstLayer)
   {
     return m_pFirstLayer->Accept(rConnectedSocket, lpSockAddr, lpSockAddrLen);
@@ -1432,9 +1432,9 @@ BOOL CAsyncSocketEx::TriggerEvent(long lEvent)
   if (m_SocketData.hSocket==INVALID_SOCKET)
     return FALSE;
 
-  ASSERT(m_pLocalAsyncSocketExThreadData);
-  ASSERT(m_pLocalAsyncSocketExThreadData->m_pHelperWindow);
-  ASSERT(m_SocketData.nSocketIndex!=-1);
+  DebugAssert(m_pLocalAsyncSocketExThreadData);
+  DebugAssert(m_pLocalAsyncSocketExThreadData->m_pHelperWindow);
+  DebugAssert(m_SocketData.nSocketIndex!=-1);
 
   if (m_pFirstLayer)
   {
@@ -1470,17 +1470,17 @@ HWND CAsyncSocketEx::GetHelperWindowHandle()
 
 BOOL CAsyncSocketEx::AddLayer(CAsyncSocketExLayer *pLayer)
 {
-  ASSERT(pLayer);
+  DebugAssert(pLayer);
 
   if (m_pFirstLayer)
   {
-    ASSERT(m_pLastLayer);
+    DebugAssert(m_pLastLayer);
     m_pLastLayer=m_pLastLayer->AddLayer(pLayer, this);
     return m_pLastLayer?TRUE:FALSE;
   }
   else
   {
-    ASSERT(!m_pLastLayer);
+    DebugAssert(!m_pLastLayer);
     pLayer->Init(0, this);
     m_pFirstLayer=pLayer;
     m_pLastLayer=m_pFirstLayer;

+ 25 - 25
source/filezilla/AsyncSocketExLayer.cpp

@@ -45,15 +45,15 @@ CAsyncSocketExLayer::~CAsyncSocketExLayer()
 
 CAsyncSocketExLayer *CAsyncSocketExLayer::AddLayer(CAsyncSocketExLayer *pLayer, CAsyncSocketEx *pOwnerSocket)
 {
-  ASSERT(pLayer);
-  ASSERT(pOwnerSocket);
+  DebugAssert(pLayer);
+  DebugAssert(pOwnerSocket);
   if (m_pNextLayer)
   {
     return m_pNextLayer->AddLayer(pLayer, pOwnerSocket);
   }
   else
   {
-    ASSERT(m_pOwnerSocket==pOwnerSocket);
+    DebugAssert(m_pOwnerSocket==pOwnerSocket);
     pLayer->Init(this, m_pOwnerSocket);
     m_pNextLayer=pLayer;
   }
@@ -126,7 +126,7 @@ void CAsyncSocketExLayer::OnClose(int nErrorCode)
 
 BOOL CAsyncSocketExLayer::TriggerEvent(long lEvent, int nErrorCode, BOOL bPassThrough /*=FALSE*/ )
 {
-  ASSERT(m_pOwnerSocket);
+  DebugAssert(m_pOwnerSocket);
   if (m_pOwnerSocket->m_SocketData.hSocket==INVALID_SOCKET)
   {
     return FALSE;
@@ -144,10 +144,10 @@ BOOL CAsyncSocketExLayer::TriggerEvent(long lEvent, int nErrorCode, BOOL bPassTh
 
   if (lEvent & FD_CONNECT)
   {
-    ASSERT(bPassThrough);
+    DebugAssert(bPassThrough);
     if (!nErrorCode)
     {
-      ASSERT(bPassThrough && (GetLayerState()==connected || GetLayerState()==attached));
+      DebugAssert(bPassThrough && (GetLayerState()==connected || GetLayerState()==attached));
     }
     else if (nErrorCode)
     {
@@ -167,9 +167,9 @@ BOOL CAsyncSocketExLayer::TriggerEvent(long lEvent, int nErrorCode, BOOL bPassTh
       m_nCriticalError = nErrorCode;
     }
   }
-  ASSERT(m_pOwnerSocket->m_pLocalAsyncSocketExThreadData);
-  ASSERT(m_pOwnerSocket->m_pLocalAsyncSocketExThreadData->m_pHelperWindow);
-  ASSERT(m_pOwnerSocket->m_SocketData.nSocketIndex!=-1);
+  DebugAssert(m_pOwnerSocket->m_pLocalAsyncSocketExThreadData);
+  DebugAssert(m_pOwnerSocket->m_pLocalAsyncSocketExThreadData->m_pHelperWindow);
+  DebugAssert(m_pOwnerSocket->m_SocketData.nSocketIndex!=-1);
   t_LayerNotifyMsg *pMsg=new t_LayerNotifyMsg;
   pMsg->hSocket = m_pOwnerSocket->m_SocketData.hSocket;
   pMsg->lEvent = ( lEvent % 0xffff ) + ( nErrorCode << 16);
@@ -231,7 +231,7 @@ int CAsyncSocketExLayer::SendNext(const void *lpBuf, int nBufLen, int nFlags /*=
 
   if (!m_pNextLayer)
   {
-    ASSERT(m_pOwnerSocket);
+    DebugAssert(m_pOwnerSocket);
     int sent = send(m_pOwnerSocket->GetSocketHandle(), (LPSTR)lpBuf, nBufLen, nFlags);
     return sent;
   }
@@ -261,7 +261,7 @@ int CAsyncSocketExLayer::ReceiveNext(void *lpBuf, int nBufLen, int nFlags /*=0*/
 
   if (!m_pNextLayer)
   {
-    ASSERT(m_pOwnerSocket);
+    DebugAssert(m_pOwnerSocket);
     return recv(m_pOwnerSocket->GetSocketHandle(), (LPSTR)lpBuf, nBufLen, nFlags);
   }
   else
@@ -272,8 +272,8 @@ int CAsyncSocketExLayer::ReceiveNext(void *lpBuf, int nBufLen, int nFlags /*=0*/
 
 BOOL CAsyncSocketExLayer::ConnectNext(LPCTSTR lpszHostAddress, UINT nHostPort)
 {
-  ASSERT(GetLayerState()==unconnected);
-  ASSERT(m_pOwnerSocket);
+  DebugAssert(GetLayerState()==unconnected);
+  DebugAssert(m_pOwnerSocket);
   BOOL res = FALSE;
   if (m_pNextLayer)
     res = m_pNextLayer->Connect(lpszHostAddress, nHostPort);
@@ -281,7 +281,7 @@ BOOL CAsyncSocketExLayer::ConnectNext(LPCTSTR lpszHostAddress, UINT nHostPort)
   {
     USES_CONVERSION;
 
-    ASSERT(lpszHostAddress != NULL);
+    DebugAssert(lpszHostAddress != NULL);
 
     SOCKADDR_IN sockAddr;
     memset(&sockAddr,0,sizeof(sockAddr));
@@ -311,7 +311,7 @@ BOOL CAsyncSocketExLayer::ConnectNext(LPCTSTR lpszHostAddress, UINT nHostPort)
   {
     USES_CONVERSION;
 
-    ASSERT(lpszHostAddress != NULL);
+    DebugAssert(lpszHostAddress != NULL);
 
     addrinfo hints, *res0, *res1;
     SOCKET hSocket;
@@ -419,8 +419,8 @@ BOOL CAsyncSocketExLayer::ConnectNext(LPCTSTR lpszHostAddress, UINT nHostPort)
 
 BOOL CAsyncSocketExLayer::ConnectNext( const SOCKADDR* lpSockAddr, int nSockAddrLen )
 {
-  ASSERT(GetLayerState()==unconnected);
-  ASSERT(m_pOwnerSocket);
+  DebugAssert(GetLayerState()==unconnected);
+  DebugAssert(m_pOwnerSocket);
   BOOL res;
   if (m_pNextLayer)
     res=m_pNextLayer->Connect(lpSockAddr, nSockAddrLen);
@@ -503,7 +503,7 @@ BOOL CAsyncSocketExLayer::GetPeerNameNext( SOCKADDR* lpSockAddr, int* lpSockAddr
   }
   else
   {
-    ASSERT(m_pOwnerSocket);
+    DebugAssert(m_pOwnerSocket);
     if ( !getpeername(m_pOwnerSocket->GetSocketHandle(), lpSockAddr, lpSockAddrLen) )
     {
       return TRUE;
@@ -582,7 +582,7 @@ BOOL CAsyncSocketExLayer::GetSockNameNext( SOCKADDR* lpSockAddr, int* lpSockAddr
     return m_pNextLayer->GetSockName(lpSockAddr, lpSockAddrLen);
   else
   {
-    ASSERT(m_pOwnerSocket);
+    DebugAssert(m_pOwnerSocket);
     if ( !getsockname(m_pOwnerSocket->GetSocketHandle(), lpSockAddr, lpSockAddrLen) )
       return TRUE;
     else
@@ -592,7 +592,7 @@ BOOL CAsyncSocketExLayer::GetSockNameNext( SOCKADDR* lpSockAddr, int* lpSockAddr
 
 void CAsyncSocketExLayer::Init(CAsyncSocketExLayer *pPrevLayer, CAsyncSocketEx *pOwnerSocket)
 {
-  ASSERT(pOwnerSocket);
+  DebugAssert(pOwnerSocket);
   m_pPrevLayer=pPrevLayer;
   m_pOwnerSocket=pOwnerSocket;
   m_pNextLayer=0;
@@ -606,7 +606,7 @@ int CAsyncSocketExLayer::GetLayerState()
 
 void CAsyncSocketExLayer::SetLayerState(int nLayerState)
 {
-  ASSERT(m_pOwnerSocket);
+  DebugAssert(m_pOwnerSocket);
   int nOldLayerState=GetLayerState();
   m_nLayerState=nLayerState;
   if (nOldLayerState!=nLayerState)
@@ -720,7 +720,7 @@ BOOL CAsyncSocketExLayer::Create(UINT nSocketPort, int nSocketType,
 
 BOOL CAsyncSocketExLayer::CreateNext(UINT nSocketPort, int nSocketType, long lEvent, LPCTSTR lpszSocketAddress, int nFamily /*=AF_INET*/)
 {
-  ASSERT(GetLayerState()==notsock);
+  DebugAssert(GetLayerState()==notsock);
   BOOL res = FALSE;
 
   m_nFamily = nFamily;
@@ -804,7 +804,7 @@ BOOL CAsyncSocketExLayer::Listen( int nConnectionBacklog)
 
 BOOL CAsyncSocketExLayer::ListenNext( int nConnectionBacklog)
 {
-  ASSERT(GetLayerState()==unconnected);
+  DebugAssert(GetLayerState()==unconnected);
   BOOL res;
   if (m_pNextLayer)
     res=m_pNextLayer->Listen(nConnectionBacklog);
@@ -824,7 +824,7 @@ BOOL CAsyncSocketExLayer::Accept( CAsyncSocketEx& rConnectedSocket, SOCKADDR* lp
 
 BOOL CAsyncSocketExLayer::AcceptNext( CAsyncSocketEx& rConnectedSocket, SOCKADDR* lpSockAddr /*=NULL*/, int* lpSockAddrLen /*=NULL*/ )
 {
-  ASSERT(GetLayerState()==listening);
+  DebugAssert(GetLayerState()==listening);
   BOOL res;
   if (m_pNextLayer)
     res=m_pNextLayer->Accept(rConnectedSocket, lpSockAddr, lpSockAddrLen);
@@ -868,7 +868,7 @@ BOOL CAsyncSocketExLayer::ShutDownNext(int nHow /*=sends*/)
 
   if (!m_pNextLayer)
   {
-    ASSERT(m_pOwnerSocket);
+    DebugAssert(m_pOwnerSocket);
     return (shutdown(m_pOwnerSocket->GetSocketHandle(), nHow) == 0);
   }
   else

+ 1 - 1
source/filezilla/AsyncSslSocketLayer.cpp

@@ -288,7 +288,7 @@ void CAsyncSslSocketLayer::OnSend(int nErrorCode)
             delete [] tmp;
           }
         }
-        ASSERT(m_pNetworkSendBuffer);
+        DebugAssert(m_pNetworkSendBuffer);
         memcpy(m_pNetworkSendBuffer + m_nNetworkSendBufferLen, buffer, numread-numsent);
         m_nNetworkSendBufferLen += numread - numsent;
       }

+ 1 - 1
source/filezilla/FileZillaApi.cpp

@@ -149,7 +149,7 @@ void CFileZillaApi::Destroy()
 {
   if (!m_bInitialized)
     return;
-  ASSERT(m_pMainThread);
+  DebugAssert(m_pMainThread);
   HANDLE tmp=m_pMainThread->m_hThread;
   m_pMainThread->Quit();
   //Wait for the main thread to quit

+ 1 - 1
source/filezilla/FileZillaIntern.cpp

@@ -29,7 +29,7 @@ bool TFileZillaIntern::PostMessage(WPARAM wParam, LPARAM lParam) const
       break;
 
     default:
-      ASSERT(FALSE);
+      DebugAssert(FALSE);
       Result = false;
       break;
   }

+ 23 - 23
source/filezilla/FileZillaIntf.cpp

@@ -39,7 +39,7 @@ __fastcall TFileZillaIntf::TFileZillaIntf() :
 //---------------------------------------------------------------------------
 __fastcall TFileZillaIntf::~TFileZillaIntf()
 {
-  ASSERT(FFileZillaApi == NULL);
+  DebugAssert(FFileZillaApi == NULL);
 
   delete FIntern;
   FIntern = NULL;
@@ -49,7 +49,7 @@ __fastcall TFileZillaIntf::~TFileZillaIntf()
 //---------------------------------------------------------------------------
 bool __fastcall TFileZillaIntf::Init()
 {
-  ASSERT(FFileZillaApi == NULL);
+  DebugAssert(FFileZillaApi == NULL);
 
   FFileZillaApi = new CFileZillaApi();
 
@@ -75,7 +75,7 @@ void __fastcall TFileZillaIntf::Destroying()
 //---------------------------------------------------------------------------
 bool __fastcall TFileZillaIntf::SetCurrentPath(const wchar_t * APath)
 {
-  ASSERT(FFileZillaApi != NULL);
+  DebugAssert(FFileZillaApi != NULL);
   CServerPath Path(APath);
   return Check(FFileZillaApi->SetCurrentPath(Path), L"setcurrentpath");
 }
@@ -94,7 +94,7 @@ bool __fastcall TFileZillaIntf::GetCurrentPath(wchar_t * Path, size_t MaxLen)
 //---------------------------------------------------------------------------
 bool __fastcall TFileZillaIntf::Cancel()
 {
-  ASSERT(FFileZillaApi != NULL);
+  DebugAssert(FFileZillaApi != NULL);
   // tolerate even "idle" state, quite possible in MT environment
   return Check(FFileZillaApi->Cancel(), L"cancel", FZ_REPLY_WOULDBLOCK | FZ_REPLY_IDLE);
 }
@@ -105,8 +105,8 @@ bool __fastcall TFileZillaIntf::Connect(const wchar_t * Host, int Port, const wc
   int iForcePasvIp, int iUseMlsd,
   X509 * Certificate, EVP_PKEY * PrivateKey)
 {
-  ASSERT(FFileZillaApi != NULL);
-  ASSERT((ServerType & FZ_SERVERTYPE_HIGHMASK) == FZ_SERVERTYPE_FTP);
+  DebugAssert(FFileZillaApi != NULL);
+  DebugAssert((ServerType & FZ_SERVERTYPE_HIGHMASK) == FZ_SERVERTYPE_FTP);
 
   t_server Server;
 
@@ -169,13 +169,13 @@ bool __fastcall TFileZillaIntf::Close(bool AllowBusy)
 //---------------------------------------------------------------------------
 bool __fastcall TFileZillaIntf::CustomCommand(const wchar_t * Command)
 {
-  ASSERT(FFileZillaApi != NULL);
+  DebugAssert(FFileZillaApi != NULL);
   return Check(FFileZillaApi->CustomCommand(Command), L"customcommand");
 }
 //---------------------------------------------------------------------------
 bool __fastcall TFileZillaIntf::MakeDir(const wchar_t* APath)
 {
-  ASSERT(FFileZillaApi != NULL);
+  DebugAssert(FFileZillaApi != NULL);
   CServerPath Path(APath);
   return Check(FFileZillaApi->MakeDir(Path), L"makedir");
 }
@@ -183,21 +183,21 @@ bool __fastcall TFileZillaIntf::MakeDir(const wchar_t* APath)
 bool __fastcall TFileZillaIntf::Chmod(int Value, const wchar_t* FileName,
   const wchar_t* APath)
 {
-  ASSERT(FFileZillaApi != NULL);
+  DebugAssert(FFileZillaApi != NULL);
   CServerPath Path(APath);
   return Check(FFileZillaApi->Chmod(Value, FileName, Path), L"chmod");
 }
 //---------------------------------------------------------------------------
 bool __fastcall TFileZillaIntf::Delete(const wchar_t* FileName, const wchar_t* APath)
 {
-  ASSERT(FFileZillaApi != NULL);
+  DebugAssert(FFileZillaApi != NULL);
   CServerPath Path(APath);
   return Check(FFileZillaApi->Delete(FileName, Path), L"delete");
 }
 //---------------------------------------------------------------------------
 bool __fastcall TFileZillaIntf::RemoveDir(const wchar_t* FileName, const wchar_t* APath)
 {
-  ASSERT(FFileZillaApi != NULL);
+  DebugAssert(FFileZillaApi != NULL);
   CServerPath Path(APath);
   return Check(FFileZillaApi->RemoveDir(FileName, Path), L"removedir");
 }
@@ -205,7 +205,7 @@ bool __fastcall TFileZillaIntf::RemoveDir(const wchar_t* FileName, const wchar_t
 bool __fastcall TFileZillaIntf::Rename(const wchar_t* OldName,
   const wchar_t* NewName, const wchar_t* APath, const wchar_t* ANewPath)
 {
-  ASSERT(FFileZillaApi != NULL);
+  DebugAssert(FFileZillaApi != NULL);
   CServerPath Path(APath);
   CServerPath NewPath(ANewPath);
   return Check(FFileZillaApi->Rename(OldName, NewName, Path, NewPath), L"rename");
@@ -213,20 +213,20 @@ bool __fastcall TFileZillaIntf::Rename(const wchar_t* OldName,
 //---------------------------------------------------------------------------
 bool __fastcall TFileZillaIntf::List()
 {
-  ASSERT(FFileZillaApi != NULL);
+  DebugAssert(FFileZillaApi != NULL);
   return Check(FFileZillaApi->List(), L"list");
 }
 //---------------------------------------------------------------------------
 bool __fastcall TFileZillaIntf::List(const wchar_t * APath)
 {
-  ASSERT(FFileZillaApi != NULL);
+  DebugAssert(FFileZillaApi != NULL);
   CServerPath Path(APath);
   return Check(FFileZillaApi->List(Path), L"list");
 }
 //---------------------------------------------------------------------------
 bool __fastcall TFileZillaIntf::ListFile(const wchar_t * FileName, const wchar_t * APath)
 {
-  ASSERT(FFileZillaApi != NULL);
+  DebugAssert(FFileZillaApi != NULL);
   CServerPath Path(APath);
   return Check(FFileZillaApi->ListFile(FileName, Path), L"listfile");
 }
@@ -321,9 +321,9 @@ bool __fastcall TFileZillaIntf::HandleMessage(WPARAM wParam, LPARAM lParam)
   {
     case FZ_MSG_STATUS:
       {
-        ASSERT(FZ_MSG_PARAM(wParam) == 0);
+        DebugAssert(FZ_MSG_PARAM(wParam) == 0);
         t_ffam_statusmessage * Status = (t_ffam_statusmessage *)lParam;
-        ASSERT(Status->post);
+        DebugAssert(Status->post);
         Result = HandleStatus(Status->status, Status->type);
         delete Status;
       }
@@ -338,7 +338,7 @@ bool __fastcall TFileZillaIntf::HandleMessage(WPARAM wParam, LPARAM lParam)
         COverwriteRequestData * Data = (COverwriteRequestData *)lParam;
         try
         {
-          ASSERT(Data != NULL);
+          DebugAssert(Data != NULL);
           wcsncpy(FileName1, Data->FileName1, LENOF(FileName1));
           FileName1[LENOF(FileName1) - 1] = L'\0';
           TRemoteFileTime RemoteTime;
@@ -370,7 +370,7 @@ bool __fastcall TFileZillaIntf::HandleMessage(WPARAM wParam, LPARAM lParam)
         CVerifyCertRequestData * AData = (CVerifyCertRequestData *)lParam;
         try
         {
-          ASSERT(AData != NULL);
+          DebugAssert(AData != NULL);
           TFtpsCertificateData Data;
           CopyContact(Data.Subject, AData->pCertData->subject);
           CopyContact(Data.Issuer, AData->pCertData->issuer);
@@ -430,14 +430,14 @@ bool __fastcall TFileZillaIntf::HandleMessage(WPARAM wParam, LPARAM lParam)
         // FZ_ASYNCREQUEST_GSS_AUTHFAILED
         // FZ_ASYNCREQUEST_GSS_NEEDUSER
         // FZ_ASYNCREQUEST_GSS_NEEDPASS
-        ASSERT(FALSE);
+        DebugAssert(FALSE);
         Result = false;
       }
       break;
 
     case FZ_MSG_LISTDATA:
       {
-        ASSERT(FZ_MSG_PARAM(wParam) == 0);
+        DebugAssert(FZ_MSG_PARAM(wParam) == 0);
         t_directory * Directory = (t_directory *)lParam;
         CString Path = Directory->path.GetPath();
         std::vector<TListDataEntry> Entries(Directory->num);
@@ -468,7 +468,7 @@ bool __fastcall TFileZillaIntf::HandleMessage(WPARAM wParam, LPARAM lParam)
 
     case FZ_MSG_TRANSFERSTATUS:
       {
-        ASSERT(FZ_MSG_PARAM(wParam) == 0);
+        DebugAssert(FZ_MSG_PARAM(wParam) == 0);
         t_ffam_transferstatus * Status = (t_ffam_transferstatus *)lParam;
         if (Status != NULL)
         {
@@ -492,7 +492,7 @@ bool __fastcall TFileZillaIntf::HandleMessage(WPARAM wParam, LPARAM lParam)
       break;
 
     default:
-      ASSERT(false);
+      DebugAssert(false);
       Result = false;
       break;
   }

+ 64 - 64
source/filezilla/FtpControlSocket.cpp

@@ -149,7 +149,7 @@ CCriticalSection CFtpControlSocket::m_SpeedLimitSync;
 
 CFtpControlSocket::CFtpControlSocket(CMainThread *pMainThread, CFileZillaTools * pTools)
 {
-  ASSERT(pMainThread);
+  DebugAssert(pMainThread);
   m_pOwner=pMainThread;
   m_pTools=pTools;
 
@@ -424,7 +424,7 @@ bool CFtpControlSocket::InitConnect()
       else
         m_pProxyLayer->SetProxy(PROXYTYPE_HTTP11, T2CA(GetOption(OPTION_PROXYHOST)) ,GetOptionVal(OPTION_PROXYPORT));
     else
-      ASSERT(FALSE);
+      DebugAssert(FALSE);
     AddLayer(m_pProxyLayer);
   }
 
@@ -1573,7 +1573,7 @@ void CFtpControlSocket::DoClose(int nError /*=0*/)
 
 void CFtpControlSocket::Disconnect()
 {
-  ASSERT(!m_Operation.nOpMode);
+  DebugAssert(!m_Operation.nOpMode);
   m_Operation.nOpMode=CSMODE_DISCONNECT;
   DoClose();
   ShowStatus(IDS_STATUSMSG_DISCONNECTED,FZ_LOG_STATUS); //Send the disconnected message to the message log
@@ -1677,7 +1677,7 @@ void CFtpControlSocket::List(BOOL bFinish, int nError /*=FALSE*/, CServerPath pa
   #define LIST_LIST  9
   #define LIST_WAITFINISH  10
 
-  ASSERT(!m_Operation.nOpMode || m_Operation.nOpMode&CSMODE_LIST);
+  DebugAssert(!m_Operation.nOpMode || m_Operation.nOpMode&CSMODE_LIST);
 
   m_Operation.nOpMode|=CSMODE_LIST;
 
@@ -2089,7 +2089,7 @@ void CFtpControlSocket::List(BOOL bFinish, int nError /*=FALSE*/, CServerPath pa
   else if (m_Operation.nOpState == LIST_MODE)
   {
 #ifdef MPEXT_NO_ZLIB
-    ASSERT(false);
+    DebugAssert(false);
 #else
     if (m_useZlib)
 #endif
@@ -2102,7 +2102,7 @@ void CFtpControlSocket::List(BOOL bFinish, int nError /*=FALSE*/, CServerPath pa
   else if (m_Operation.nOpState == LIST_OPTS)
   {
 #ifdef MPEXT_NO_ZLIB
-    ASSERT(false);
+    DebugAssert(false);
 #else
     pData->newZlibLevel = GetOptionVal(OPTION_MODEZ_LEVEL);
     cmd.Format(L"OPTS MODE Z LEVEL %d", pData->newZlibLevel);
@@ -2328,7 +2328,7 @@ void CFtpControlSocket::ListFile(CString filename, const CServerPath &path)
   #define LISTFILE_CWD   6
   #define LISTFILE_CWD2  7
 
-  ASSERT(!m_Operation.nOpMode || m_Operation.nOpMode&CSMODE_LISTFILE);
+  DebugAssert(!m_Operation.nOpMode || m_Operation.nOpMode&CSMODE_LISTFILE);
 
   m_Operation.nOpMode|=CSMODE_LISTFILE;
 
@@ -2677,7 +2677,7 @@ void CFtpControlSocket::FileTransfer(t_transferfile *transferfile/*=0*/,BOOL bFi
   //         |WAITFINISH|
   //         +----------+
 
-  ASSERT(!m_Operation.nOpMode || m_Operation.nOpMode&CSMODE_TRANSFER);
+  DebugAssert(!m_Operation.nOpMode || m_Operation.nOpMode&CSMODE_TRANSFER);
   if (!m_pOwner->IsConnected())
   {
     m_Operation.nOpMode=CSMODE_TRANSFER|(transferfile->get?CSMODE_DOWNLOAD:CSMODE_UPLOAD);
@@ -2690,7 +2690,7 @@ void CFtpControlSocket::FileTransfer(t_transferfile *transferfile/*=0*/,BOOL bFi
   //Process finish and error messages
   if (bFinish || nError)
   {
-    ASSERT(m_Operation.nOpMode&CSMODE_TRANSFER);
+    DebugAssert(m_Operation.nOpMode&CSMODE_TRANSFER);
 
     // APPE failed, ignore this reply
     if (m_Operation.nOpMode == FILETRANSFER_WAIT && bFinish)
@@ -2791,9 +2791,9 @@ void CFtpControlSocket::FileTransfer(t_transferfile *transferfile/*=0*/,BOOL bFi
   int nReplyError = 0;
   if (m_Operation.nOpState == FILETRANSFER_INIT)
   {
-    ASSERT(transferfile);
-    ASSERT(!m_Operation.nOpMode);
-    ASSERT(!m_Operation.pData);
+    DebugAssert(transferfile);
+    DebugAssert(!m_Operation.nOpMode);
+    DebugAssert(!m_Operation.pData);
 
     CString str;
     str.Format(transferfile->get?IDS_STATUSMSG_DOWNLOADSTART:IDS_STATUSMSG_UPLOADSTART,
@@ -2968,7 +2968,7 @@ void CFtpControlSocket::FileTransfer(t_transferfile *transferfile/*=0*/,BOOL bFi
         {
           if (code == 2 || code == 3)
           { //Create dir entry in parent dir
-            ASSERT(!pData->MKDSegments.empty());
+            DebugAssert(!pData->MKDSegments.empty());
             pData->MKDCurrent.AddSubdir(pData->MKDSegments.front());
             CString Segment=pData->MKDSegments.front();
             pData->MKDSegments.pop_front();
@@ -3064,7 +3064,7 @@ void CFtpControlSocket::FileTransfer(t_transferfile *transferfile/*=0*/,BOOL bFi
         }
         break;
       default:
-        ASSERT(FALSE);
+        DebugAssert(FALSE);
       }
 
       break;
@@ -3107,7 +3107,7 @@ void CFtpControlSocket::FileTransfer(t_transferfile *transferfile/*=0*/,BOOL bFi
       break;
     case FILETRANSFER_LIST_MODE:
 #ifdef MPEXT_NO_ZLIB
-      ASSERT(false);
+      DebugAssert(false);
       m_Operation.nOpState = FILETRANSFER_LIST_TYPE;
 #else
       if (code == 2 || code == 3)
@@ -3117,7 +3117,7 @@ void CFtpControlSocket::FileTransfer(t_transferfile *transferfile/*=0*/,BOOL bFi
       break;
     case FILETRANSFER_LIST_OPTS:
 #ifdef MPEXT_NO_ZLIB
-      ASSERT(false);
+      DebugAssert(false);
 #else
       if (code == 2 || code == 3)
         m_zlibLevel = pData->newZlibLevel;
@@ -3371,7 +3371,7 @@ void CFtpControlSocket::FileTransfer(t_transferfile *transferfile/*=0*/,BOOL bFi
         __int64 size;
         if (HandleSize(code, size))
         {
-          ASSERT(!pData->pFileSize);
+          DebugAssert(!pData->pFileSize);
           pData->pFileSize=new _int64;
           *pData->pFileSize=size;
         }
@@ -3399,7 +3399,7 @@ void CFtpControlSocket::FileTransfer(t_transferfile *transferfile/*=0*/,BOOL bFi
       break;
     case FILETRANSFER_MODE:
 #ifdef MPEXT_NO_ZLIB
-      ASSERT(false);
+      DebugAssert(false);
       m_Operation.nOpState = FILETRANSFER_PORTPASV;
 #else
       if (code == 2 || code == 3)
@@ -3409,7 +3409,7 @@ void CFtpControlSocket::FileTransfer(t_transferfile *transferfile/*=0*/,BOOL bFi
       break;
     case FILETRANSFER_OPTS:
 #ifdef MPEXT_NO_ZLIB
-      ASSERT(false);
+      DebugAssert(false);
 #else
       if (code == 2 || code == 3)
         m_zlibLevel = pData->newZlibLevel;
@@ -3666,7 +3666,7 @@ void CFtpControlSocket::FileTransfer(t_transferfile *transferfile/*=0*/,BOOL bFi
             {
               if (pData->transferdata.transfersize!=-1)
               {
-                ASSERT(m_pDataFile);
+                DebugAssert(m_pDataFile);
                 if (GetLength64(*m_pDataFile) == pData->transferdata.transfersize)
                 {
                   ShowStatus(IDS_ERRORMSG_CANTRESUME_FINISH, FZ_LOG_STATUS);
@@ -3857,7 +3857,7 @@ void CFtpControlSocket::FileTransfer(t_transferfile *transferfile/*=0*/,BOOL bFi
     break;
   case FILETRANSFER_LIST_MODE:
 #ifdef MPEXT_NO_ZLIB
-    ASSERT(false);
+    DebugAssert(false);
 #else
     if (m_useZlib)
     {
@@ -3871,7 +3871,7 @@ void CFtpControlSocket::FileTransfer(t_transferfile *transferfile/*=0*/,BOOL bFi
     break;
   case FILETRANSFER_LIST_OPTS:
 #ifdef MPEXT_NO_ZLIB
-    ASSERT(false);
+    DebugAssert(false);
 #else
     {
       pData->newZlibLevel = GetOptionVal(OPTION_MODEZ_LEVEL);
@@ -4095,7 +4095,7 @@ void CFtpControlSocket::FileTransfer(t_transferfile *transferfile/*=0*/,BOOL bFi
     break;
   case FILETRANSFER_MODE:
 #ifdef MPEXT_NO_ZLIB
-    ASSERT(false);
+    DebugAssert(false);
 #else
     if (m_useZlib)
     {
@@ -4109,7 +4109,7 @@ void CFtpControlSocket::FileTransfer(t_transferfile *transferfile/*=0*/,BOOL bFi
     break;
   case FILETRANSFER_OPTS:
 #ifdef MPEXT_NO_ZLIB
-    ASSERT(false);
+    DebugAssert(false);
 #else
     {
       pData->newZlibLevel = GetOptionVal(OPTION_MODEZ_LEVEL);
@@ -4275,7 +4275,7 @@ void CFtpControlSocket::FileTransfer(t_transferfile *transferfile/*=0*/,BOOL bFi
     }
     break;
   case FILETRANSFER_REST:
-    ASSERT(m_pDataFile);
+    DebugAssert(m_pDataFile);
     {
       CString command;
       __int64 transferoffset =
@@ -4669,7 +4669,7 @@ void CFtpControlSocket::ResetOperation(int nSuccessful /*=FALSE*/)
     //No operation in progress
     nSuccessful&=FZ_REPLY_DISCONNECTED|FZ_REPLY_CANCEL;
     if (!nSuccessful)
-      ASSERT(FALSE);
+      DebugAssert(FALSE);
   }
 
   if (nSuccessful&FZ_REPLY_DISCONNECTED)
@@ -4700,10 +4700,10 @@ public:
   };
   if (filename!=L"")
   {
-    ASSERT(!path.IsEmpty());
-    ASSERT(m_Operation.nOpMode==CSMODE_NONE);
-    ASSERT(m_Operation.nOpState==-1);
-    ASSERT(!m_Operation.pData);
+    DebugAssert(!path.IsEmpty());
+    DebugAssert(m_Operation.nOpMode==CSMODE_NONE);
+    DebugAssert(m_Operation.nOpState==-1);
+    DebugAssert(!m_Operation.pData);
     m_Operation.nOpMode=CSMODE_DELETE;
     if (!Send(L"DELE " + path.FormatFilename(filename)))
       return;
@@ -4714,10 +4714,10 @@ public:
   }
   else
   {
-    ASSERT(path.IsEmpty());
-    ASSERT(m_Operation.nOpMode==CSMODE_DELETE);
-    ASSERT(m_Operation.nOpState==-1);
-    ASSERT(m_Operation.pData);
+    DebugAssert(path.IsEmpty());
+    DebugAssert(m_Operation.nOpMode==CSMODE_DELETE);
+    DebugAssert(m_Operation.nOpState==-1);
+    DebugAssert(m_Operation.pData);
     int res=GetReplyCode();
     if (res==2 || res==3)
     { //Remove file from cached dirs
@@ -4747,7 +4747,7 @@ public:
         {
           if (dir.direntry[i].name==pData->m_FileName)
           {
-            ASSERT(!dir.direntry[i].dir || dir.direntry[i].bLink);
+            DebugAssert(!dir.direntry[i].dir || dir.direntry[i].bLink);
             found=TRUE;
             break;
           }
@@ -4800,10 +4800,10 @@ public:
   };
   if (dirname != L"")
   {
-    ASSERT(!path.IsEmpty());
-    ASSERT(m_Operation.nOpMode == CSMODE_NONE);
-    ASSERT(m_Operation.nOpState == -1);
-    ASSERT(!m_Operation.pData);
+    DebugAssert(!path.IsEmpty());
+    DebugAssert(m_Operation.nOpMode == CSMODE_NONE);
+    DebugAssert(m_Operation.nOpState == -1);
+    DebugAssert(!m_Operation.pData);
     m_Operation.nOpMode = CSMODE_RMDIR;
     CServerPath newPath = path;
     if (!newPath.AddSubdir(dirname))
@@ -4820,10 +4820,10 @@ public:
   }
   else
   {
-    ASSERT(path.IsEmpty());
-    ASSERT(m_Operation.nOpMode == CSMODE_RMDIR);
-    ASSERT(m_Operation.nOpState == -1);
-    ASSERT(m_Operation.pData);
+    DebugAssert(path.IsEmpty());
+    DebugAssert(m_Operation.nOpMode == CSMODE_RMDIR);
+    DebugAssert(m_Operation.nOpState == -1);
+    DebugAssert(m_Operation.pData);
     int res = GetReplyCode();
     if (res == 2 || res == 3)
     { //Remove dir from cached dirs
@@ -4853,7 +4853,7 @@ public:
         {
           if (dir.direntry[i].name == pData->m_DirName)
           {
-            ASSERT(dir.direntry[i].dir);
+            DebugAssert(dir.direntry[i].dir);
             found = TRUE;
             break;
           }
@@ -5081,7 +5081,7 @@ void CFtpControlSocket::SetFileExistsAction(int nAction, COverwriteRequestData *
     }
     else
     {
-      ASSERT(m_pDirectoryListing);
+      DebugAssert(m_pDirectoryListing);
       int i;
       for (i = 0; i < m_pDirectoryListing->num; i++)
       {
@@ -5136,9 +5136,9 @@ void CFtpControlSocket::MakeDir(const CServerPath &path)
   //Find existing parent and create subdirs one by one
   if (m_Operation.nOpState == MKD_INIT)
   {
-    ASSERT(!path.IsEmpty());
-    ASSERT(m_Operation.nOpMode==CSMODE_NONE);
-    ASSERT(!m_Operation.pData);
+    DebugAssert(!path.IsEmpty());
+    DebugAssert(m_Operation.nOpMode==CSMODE_NONE);
+    DebugAssert(!m_Operation.pData);
     m_Operation.nOpMode = CSMODE_MKDIR;
     if (!Send(L"CWD "+path.GetParent().GetPath()))
       return;
@@ -5151,9 +5151,9 @@ void CFtpControlSocket::MakeDir(const CServerPath &path)
   }
   else if (m_Operation.nOpState==MKD_FINDPARENT)
   {
-    ASSERT(m_Operation.nOpMode==CSMODE_MKDIR);
-    ASSERT(path.IsEmpty());
-    ASSERT(m_Operation.pData);
+    DebugAssert(m_Operation.nOpMode==CSMODE_MKDIR);
+    DebugAssert(path.IsEmpty());
+    DebugAssert(m_Operation.pData);
     CMakeDirData *pData=(CMakeDirData *)m_Operation.pData;
     int res=GetReplyCode();
     if (res==2 || res==3)
@@ -5189,7 +5189,7 @@ void CFtpControlSocket::MakeDir(const CServerPath &path)
     { //Create dir entry in parent dir
       CMakeDirData *pData=(CMakeDirData *)m_Operation.pData;
 
-      ASSERT(!pData->Segments.empty());
+      DebugAssert(!pData->Segments.empty());
 
       m_pOwner->SetCurrentPath(pData->Current);
 
@@ -5290,7 +5290,7 @@ void CFtpControlSocket::MakeDir(const CServerPath &path)
     }
   }
   else
-    ASSERT(FALSE);
+    DebugAssert(FALSE);
 }
 
 void CFtpControlSocket::Rename(CString oldName, CString newName, const CServerPath &path, const CServerPath &newPath)
@@ -5306,11 +5306,11 @@ void CFtpControlSocket::Rename(CString oldName, CString newName, const CServerPa
   };
   if (oldName != L"")
   {
-    ASSERT(newName != L"");
-    ASSERT(!path.IsEmpty());
-    ASSERT(m_Operation.nOpMode == CSMODE_NONE);
-    ASSERT(m_Operation.nOpState == -1);
-    ASSERT(!m_Operation.pData);
+    DebugAssert(newName != L"");
+    DebugAssert(!path.IsEmpty());
+    DebugAssert(m_Operation.nOpMode == CSMODE_NONE);
+    DebugAssert(m_Operation.nOpState == -1);
+    DebugAssert(!m_Operation.pData);
     m_Operation.nOpMode = CSMODE_RENAME;
     if (!Send(L"RNFR " + path.FormatFilename(oldName)))
       return;
@@ -5323,10 +5323,10 @@ void CFtpControlSocket::Rename(CString oldName, CString newName, const CServerPa
   }
   else
   {
-    ASSERT(oldName == L"");
-    ASSERT(path.IsEmpty());
-    ASSERT(m_Operation.nOpMode == CSMODE_RENAME);
-    ASSERT(m_Operation.pData);
+    DebugAssert(oldName == L"");
+    DebugAssert(path.IsEmpty());
+    DebugAssert(m_Operation.nOpMode == CSMODE_RENAME);
+    DebugAssert(m_Operation.pData);
     CRenameData *pData = reinterpret_cast<CRenameData *>(m_Operation.pData);
 
     if (m_Operation.nOpState == -1)
@@ -5472,7 +5472,7 @@ void CFtpControlSocket::Rename(CString oldName, CString newName, const CServerPa
 
 void CFtpControlSocket::SetVerifyCertResult(int nResult, t_SslCertData *pData)
 {
-  ASSERT(pData);
+  DebugAssert(pData);
   if (!m_pSslLayer)
     return;
   if (!m_Operation.nOpMode == CSMODE_CONNECT)
@@ -6021,7 +6021,7 @@ BOOL CFtpControlSocket::ParsePwdReply(CString& rawpwd)
 BOOL CFtpControlSocket::ParsePwdReply(CString& rawpwd, CServerPath & realPath)
 {
   CListData *pData = static_cast<CListData *>(m_Operation.pData);
-  ASSERT(pData);
+  DebugAssert(pData);
 
   int pos1 = rawpwd.Find(L'"');
   int pos2 = rawpwd.ReverseFind(L'"');

+ 1 - 1
source/filezilla/FtpListResult.cpp

@@ -779,7 +779,7 @@ void CFtpListResult::AddLine(t_directory::t_direntry &direntry)
     BOOL bContinue=FALSE;
     while (entryiter!=m_EntryList.end())
     {
-      ASSERT(dataiter!=m_TempData.end());
+      DebugAssert(dataiter!=m_TempData.end());
       t_directory::t_direntry dir=*entryiter;
       int oldversion=*dataiter;
       if (direntry.name==dir.name)

+ 11 - 11
source/filezilla/MainThread.cpp

@@ -128,44 +128,44 @@ BOOL CMainThread::OnThreadMessage(UINT Msg, WPARAM wParam, LPARAM lParam)
         switch(pCommand->id)
         {
         case FZ_COMMAND_CONNECT:
-          ASSERT(!IsConnected());
+          DebugAssert(!IsConnected());
           SetCurrentPath(CServerPath());
           m_pControlSocket->Connect(pCommand->server);
           break;
         case FZ_COMMAND_LIST:
-          ASSERT(m_pControlSocket);
+          DebugAssert(m_pControlSocket);
           m_pControlSocket->List(FALSE, 0, pCommand->path, pCommand->param1);
           break;
         case FZ_COMMAND_LISTFILE:
-          ASSERT(m_pControlSocket);
+          DebugAssert(m_pControlSocket);
           m_pControlSocket->ListFile(pCommand->param1, pCommand->path);
           break;
         case FZ_COMMAND_FILETRANSFER:
-          ASSERT(m_pControlSocket);
+          DebugAssert(m_pControlSocket);
           m_pControlSocket->FileTransfer(&pCommand->transferfile);
           break;
         case FZ_COMMAND_CUSTOMCOMMAND:
-          ASSERT(m_pControlSocket);
+          DebugAssert(m_pControlSocket);
           m_pControlSocket->FtpCommand(pCommand->param1);
           break;
         case FZ_COMMAND_DELETE:
-          ASSERT(m_pControlSocket);
+          DebugAssert(m_pControlSocket);
           m_pControlSocket->Delete(pCommand->param1, pCommand->path);
           break;
         case FZ_COMMAND_REMOVEDIR:
-          ASSERT(m_pControlSocket);
+          DebugAssert(m_pControlSocket);
           m_pControlSocket->RemoveDir(pCommand->param1, pCommand->path);
           break;
         case FZ_COMMAND_MAKEDIR:
-          ASSERT(m_pControlSocket);
+          DebugAssert(m_pControlSocket);
           m_pControlSocket->MakeDir(pCommand->path);
           break;
         case FZ_COMMAND_RENAME:
-          ASSERT(m_pControlSocket);
+          DebugAssert(m_pControlSocket);
           m_pControlSocket->Rename(pCommand->param1, pCommand->param2, pCommand->path, pCommand->newPath);
           break;
         case FZ_COMMAND_CHMOD:
-          ASSERT(m_pControlSocket);
+          DebugAssert(m_pControlSocket);
           m_pControlSocket->Chmod(pCommand->param1, pCommand->path, pCommand->param4);
           break;
         }
@@ -223,7 +223,7 @@ BOOL CMainThread::IsBusy()
 
 void CMainThread::Command(const t_command &command)
 {
-  ASSERT(!IsBusy());
+  DebugAssert(!IsBusy());
   ECS;
   if (m_bQuit)
   {

+ 13 - 13
source/filezilla/ServerPath.cpp

@@ -99,7 +99,7 @@ CServerPath::CServerPath(CString path, int nServerType, bool trim)
         int pos1 = path.Find( L"[" );
         if (pos1 == -1 || path.Right(1) != L"]")
         {
-          ASSERT(FALSE);
+          DebugAssert(FALSE);
           m_bEmpty = TRUE;
           return;
         }
@@ -145,7 +145,7 @@ CServerPath::CServerPath(CString path, int nServerType, bool trim)
         m_Prefix = path;
         return;
       }
-      ASSERT(pos == 2);
+      DebugAssert(pos == 2);
       m_Prefix = path.Left(pos);
       path = path.Mid(pos + 1);
       pos = path.Find( L"\\" );
@@ -160,7 +160,7 @@ CServerPath::CServerPath(CString path, int nServerType, bool trim)
     }
     break;
   default:
-    ASSERT(FALSE);
+    DebugAssert(FALSE);
   }
 }
 
@@ -422,7 +422,7 @@ const CString CServerPath::GetPath() const
 
     break;
   default:
-    ASSERT(FALSE);
+    DebugAssert(FALSE);
   }
   return path;
 }
@@ -502,7 +502,7 @@ CString CServerPath::GetLastSegment() const
 
 CServerPath CServerPath::GetParent() const
 {
-  ASSERT(HasParent());
+  DebugAssert(HasParent());
   CServerPath path;
   path = *this;
   path.m_Segments.pop_back();
@@ -584,7 +584,7 @@ CServerPath::CServerPath(CString subdir, const CServerPath &parent)
   if ( subdir==L"" )
   {
     if (IsEmpty())
-      ASSERT(FALSE);
+      DebugAssert(FALSE);
     else
       return;
   }
@@ -649,13 +649,13 @@ CServerPath::CServerPath(CString subdir, const CServerPath &parent)
         int pos1=subdir.Find( L"[" );
         if (pos1==-1)
         {
-          ASSERT( subdir.Right(1)!=L"]" );
+          DebugAssert( subdir.Right(1)!=L"]" );
           while ( subdir.Replace( L"..", L"." ) );
         }
         else
         {
           if (subdir.Right(1)!=L"]")
-            ASSERT(FALSE);
+            DebugAssert(FALSE);
           subdir=subdir.Left(subdir.GetLength()-1);
           if (pos1)
             m_Prefix=subdir.Left(pos1);
@@ -667,7 +667,7 @@ CServerPath::CServerPath(CString subdir, const CServerPath &parent)
           pos1=subdir.Find( L"[" );
           int pos2=subdir.Find( L"]" );
           if (pos1!=-1 || pos2!=-1)
-            ASSERT(FALSE);
+            DebugAssert(FALSE);
         }
         int pos=subdir.Find( L"." );
         while(pos!=-1)
@@ -744,7 +744,7 @@ CServerPath::CServerPath(CString subdir, const CServerPath &parent)
         subdir=subdir.Mid(pos+1);
         subdir.TrimLeft( L"\\" );
         if (subdir.Find( L":" )!=-1)
-          ASSERT(FALSE);
+          DebugAssert(FALSE);
       }
       if (pos==-1 || pos==1)
       {
@@ -759,11 +759,11 @@ CServerPath::CServerPath(CString subdir, const CServerPath &parent)
           m_Segments.push_back(subdir);
       }
       else
-        ASSERT(FALSE);
+        DebugAssert(FALSE);
     }
     break;
   default:
-    ASSERT(FALSE);
+    DebugAssert(FALSE);
   }
 }
 
@@ -837,7 +837,7 @@ CString CServerPath::FormatFilename(CString fn, bool omitPath /*=false*/) const
     path += fn;
     break;
   default:
-    ASSERT(FALSE);
+    DebugAssert(FALSE);
   }
   return path;
 }

+ 8 - 8
source/filezilla/TransferSocket.cpp

@@ -18,7 +18,7 @@
 
 CTransferSocket::CTransferSocket(CFtpControlSocket *pOwner, int nMode)
 {
-  ASSERT(pOwner);
+  DebugAssert(pOwner);
   InitIntern(pOwner->GetIntern());
   m_pOwner = pOwner;
   m_nMode = nMode;
@@ -196,7 +196,7 @@ void CTransferSocket::OnReceive(int nErrorCode)
       ableToRead = BUFSIZE;
 
     if (!beenWaiting)
-      ASSERT(ableToRead);
+      DebugAssert(ableToRead);
     else if (!ableToRead)
     {
       TriggerEvent(FD_READ);
@@ -702,9 +702,9 @@ void CTransferSocket::OnSend(int nErrorCode)
     else
       numread = 0;
 
-    ASSERT((numread+m_bufferpos) <= BUFSIZE);
-    ASSERT(numread>=0);
-    ASSERT(m_bufferpos>=0);
+    DebugAssert((numread+m_bufferpos) <= BUFSIZE);
+    DebugAssert(numread>=0);
+    DebugAssert(m_bufferpos>=0);
 
     if (numread+m_bufferpos <= 0)
     {
@@ -816,8 +816,8 @@ void CTransferSocket::OnSend(int nErrorCode)
         return;
       }
 
-      ASSERT(numread>=0);
-      ASSERT(m_bufferpos>=0);
+      DebugAssert(numread>=0);
+      DebugAssert(m_bufferpos>=0);
       numsent = Send(m_pBuffer, numread+m_bufferpos);
     }
   }
@@ -886,7 +886,7 @@ BOOL CTransferSocket::Create(BOOL bUseSsl)
       else
         m_pProxyLayer->SetProxy(PROXYTYPE_HTTP11, T2CA(GetOption(OPTION_PROXYHOST)), GetOptionVal(OPTION_PROXYPORT));
     else
-      ASSERT(FALSE);
+      DebugAssert(FALSE);
     AddLayer(m_pProxyLayer);
   }
 

+ 23 - 43
source/filezilla/stdafx.h

@@ -46,26 +46,6 @@ class CFileFix;
 //---------------------------------------------------------------------------
 #define _strlwr strlwr
 //---------------------------------------------------------------------------
-#ifdef _DEBUG
-#ifndef ASSERT
-#error ASSERT should be defined here by afx.h
-#endif
-#undef ASSERT
-// Copy of afx.h ASSERT with TRACE added.
-// Better would be to hook afxAssertFailedLine
-#define ASSERT(f) \
-  do \
-  { \
-    if (!(f)) \
-    { \
-      if (AfxAssertFailedLine(__FILE__, __LINE__)) \
-      { \
-        AfxDebugBreak(); \
-      } \
-    } \
-  } while (0)
-#endif
-//---------------------------------------------------------------------------
 const int FILEEXISTS_OVERWRITE = 0;
 const int FILEEXISTS_RESUME = 1;
 const int FILEEXISTS_RENAME = 2;
@@ -96,15 +76,15 @@ public:
   UINT Read(void * lpBuf, UINT nCount)
   {
     ASSERT_VALID(this);
-    ASSERT(m_hFile != (UINT)hFileNull);
+    DebugAssert(m_hFile != (UINT)hFileNull);
 
     if (nCount == 0)
     {
       return 0;   // avoid Win32 "null-read"
     }
 
-    ASSERT(lpBuf != NULL);
-    ASSERT(AfxIsValidAddress(lpBuf, nCount));
+    DebugAssert(lpBuf != NULL);
+    DebugAssert(AfxIsValidAddress(lpBuf, nCount));
 
     DWORD dwRead;
     if (!::ReadFile((HANDLE)m_hFile, lpBuf, nCount, &dwRead, NULL))
@@ -154,10 +134,10 @@ public:
 
   CStringA(const CStringA& stringSrc)
   {
-    ASSERT(stringSrc.GetData()->nRefs != 0);
+    DebugAssert(stringSrc.GetData()->nRefs != 0);
     if (stringSrc.GetData()->nRefs >= 0)
     {
-      ASSERT(stringSrc.GetData() != _afxDataNilA);
+      DebugAssert(stringSrc.GetData() != _afxDataNilA);
       m_pchData = stringSrc.m_pchData;
       InterlockedIncrement(&GetData()->nRefs);
     }
@@ -173,7 +153,7 @@ public:
     Init();
     if (lpsz != NULL && HIWORD(lpsz) == NULL)
     {
-      ASSERT(false);
+      DebugAssert(false);
     }
     else
     {
@@ -205,8 +185,8 @@ public:
   char operator[](int nIndex) const
   {
     // same as GetAt
-    ASSERT(nIndex >= 0);
-    ASSERT(nIndex < GetData()->nDataLength);
+    DebugAssert(nIndex >= 0);
+    DebugAssert(nIndex < GetData()->nDataLength);
     return m_pchData[nIndex];
   }
 
@@ -225,7 +205,7 @@ public:
       {
         // can just copy references around
         Release();
-        ASSERT(stringSrc.GetData() != _afxDataNilA);
+        DebugAssert(stringSrc.GetData() != _afxDataNilA);
         m_pchData = stringSrc.m_pchData;
         InterlockedIncrement(&GetData()->nRefs);
       }
@@ -235,7 +215,7 @@ public:
 
   const CStringA & operator=(LPCSTR lpsz)
   {
-    ASSERT(lpsz == NULL || AfxIsValidString(lpsz));
+    DebugAssert(lpsz == NULL || AfxIsValidString(lpsz));
     AssignCopy(SafeStrlen(lpsz), lpsz);
     return *this;
   }
@@ -255,7 +235,7 @@ public:
 
   int Compare(LPCSTR lpsz) const
   {
-    ASSERT(AfxIsValidString(lpsz));
+    DebugAssert(AfxIsValidString(lpsz));
     return strcmp(m_pchData, lpsz);
   }
 
@@ -280,8 +260,8 @@ public:
       nCount = 0;
     }
 
-    ASSERT(nFirst >= 0);
-    ASSERT(nFirst + nCount <= GetData()->nDataLength);
+    DebugAssert(nFirst >= 0);
+    DebugAssert(nFirst + nCount <= GetData()->nDataLength);
 
     // optimize case of returning entire string
     if (nFirst == 0 && nFirst + nCount == GetData()->nDataLength)
@@ -338,7 +318,7 @@ public:
 
   int Find(LPCSTR lpszSub, int nStart) const
   {
-    ASSERT(AfxIsValidString(lpszSub));
+    DebugAssert(AfxIsValidString(lpszSub));
 
     int nLength = GetData()->nDataLength;
     if (nStart > nLength)
@@ -364,7 +344,7 @@ protected:
 
   CStringDataA * GetData() const
   {
-    ASSERT(m_pchData != NULL); return ((CStringDataA*)m_pchData)-1;
+    DebugAssert(m_pchData != NULL); return ((CStringDataA*)m_pchData)-1;
   }
 
   void Init()
@@ -395,8 +375,8 @@ protected:
   // always allocate one extra character for '\0' termination
   // assumes [optimistically] that data length will equal allocation length
   {
-    ASSERT(nLen >= 0);
-    ASSERT(nLen <= INT_MAX-1);    // max size (enough room for 1 extra)
+    DebugAssert(nLen >= 0);
+    DebugAssert(nLen <= INT_MAX-1);    // max size (enough room for 1 extra)
 
     if (nLen == 0)
     {
@@ -434,7 +414,7 @@ protected:
   {
     if (pData != _afxDataNilA)
     {
-      ASSERT(pData->nRefs != 0);
+      DebugAssert(pData->nRefs != 0);
       if (InterlockedDecrement(&pData->nRefs) <= 0)
       {
         FreeData(pData);
@@ -446,7 +426,7 @@ protected:
   {
     if (GetData() != _afxDataNilA)
     {
-      ASSERT(GetData()->nRefs != 0);
+      DebugAssert(GetData()->nRefs != 0);
       if (InterlockedDecrement(&GetData()->nRefs) <= 0)
       {
         FreeData(GetData());
@@ -487,7 +467,7 @@ protected:
       // we have to grow the buffer, use the ConcatCopy routine
       CStringDataA* pOldData = GetData();
       ConcatCopy(GetData()->nDataLength, m_pchData, nSrcLen, lpszSrcData);
-      ASSERT(pOldData != NULL);
+      DebugAssert(pOldData != NULL);
       CStringA::Release(pOldData);
     }
     else
@@ -495,7 +475,7 @@ protected:
       // fast concatenation when buffer big enough
       memcpy(m_pchData+GetData()->nDataLength, lpszSrcData, nSrcLen*sizeof(char));
       GetData()->nDataLength += nSrcLen;
-      ASSERT(GetData()->nDataLength <= GetData()->nAllocLength);
+      DebugAssert(GetData()->nDataLength <= GetData()->nAllocLength);
       m_pchData[GetData()->nDataLength] = '\0';
     }
   }
@@ -509,7 +489,7 @@ protected:
       AllocBuffer(pData->nDataLength);
       memcpy(m_pchData, pData->data(), (pData->nDataLength+1)*sizeof(char));
     }
-    ASSERT(GetData()->nRefs <= 1);
+    DebugAssert(GetData()->nRefs <= 1);
   }
 
   void AllocBeforeWrite(int nLen)
@@ -519,7 +499,7 @@ protected:
       Release();
       AllocBuffer(nLen);
     }
-    ASSERT(GetData()->nRefs <= 1);
+    DebugAssert(GetData()->nRefs <= 1);
   }
 
   static int PASCAL SafeStrlen(LPCSTR lpsz)