Changeset 19 in cheroxy for trunk


Ignore:
Timestamp:
11/08/12 17:12:01 (12 years ago)
Author:
cheese
Message:

#1 fix error on linux for r18

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/CRXException.h

    r18 r19  
    66
    77#include <string>
     8#include <stdarg.h>
    89
    910#ifdef _WIN32
     
    1112#endif
    1213
    13 #define CRX_ERROR(__CODE,__FMT,...)                                             \
    14     do {                                                                        \
    15         SetErrorCode    (__CODE);                                           \
    16         SetErrorMessage (__FILE__,__func__,__LINE__,__FMT,__VA_ARGS__);     \
     14#define CRX_ERROR(__CODE,__FMT,...)                                         \
     15    do {                                                                    \
     16        SetErrorCode (__CODE);                                          \
     17        SetErrorMessage (__FILE__,__func__,__LINE__,__FMT,##__VA_ARGS__);   \
     18    } while (0)
     19
     20#define CRX_ERROR_ADD(__MESSAGE)                                            \
     21    do {                                                                    \
     22        AddMessage (__MESSAGE);                                             \
    1723    } while (0)
    1824
     
    4753                                         const char * aFormat,
    4854                                         va_list    aVaList);
     55
     56    void        AddMessage              (const char * aMessage);
    4957};
    5058
  • trunk/src/CRXException.cpp

    r18 r19  
    55#include "CRXException.h"
    66
    7 #include <stdarg.h>
    87#include <sstream>
    98
     
    6059CRXException::SetErrorMessage (const char   * aFile,
    6160                               const char   * aFunction,
    62                                const int        aLine,
     61                               const int    aLine,
    6362                               const char   * aFormat, ...)
    6463{
     
    147146    return aErrorStream.str();
    148147}
     148
     149void
     150CRXException::AddMessage (const char * aMessage)
     151{
     152    mMessage += aMessage;
     153}
  • trunk/src/CRXProxy.cpp

    r18 r19  
    88
    99#include "CRXProxy.h"
     10
     11#include <string.h>
    1012
    1113#ifdef _DEBUG
     
    3032THREAD_FUNCTION_RETURN
    3133THREAD_FUNCTION_CALLING_CONVENTION
    32 CRXProxyWrapper (void * aProxy)
     34CRXProxyWrapper (void * aThreadArg)
    3335{
    34     return (THREAD_FUNCTION_RETURN)((CRXProxy *) aProxy)->Forward ();
     36    int         aResult = 0;
     37    CRXProxy    * aProxy = (CRXProxy *) aThreadArg;
     38   
     39    aResult = aProxy->Forward ();
     40    if (aResult)
     41        PRINT_ERROR << aProxy->GetErrorMessage ();
     42
     43    return (THREAD_FUNCTION_RETURN)0;
    3544}
    3645
     
    8392        if (aResult < 0)
    8493        {
     94            CRX_ERROR_ADD (mClient.GetErrorMessage ().c_str ());
    8595            CRX_ERROR (aResult, "failed to receive from browser");
    86             PRINT_ERROR << mClient.GetErrorMessage() << GetErrorMessage();
    8796            break;
    8897        }
     
    99108            if (aResult < 0)
    100109            {
     110                CRX_ERROR_ADD (aWebServer.GetErrorMessage ().c_str ());
    101111                CRX_ERROR (aResult, "failed to connect to server <%s>", aHttpRequest.GetURL ().c_str ());
    102                 PRINT_ERROR << aWebServer.GetErrorMessage() << GetErrorMessage();
    103112                return aResult;
    104113            }
     
    109118        if (aResult != aReceivedSize)
    110119        {
     120            CRX_ERROR_ADD (aWebServer.GetErrorMessage ().c_str ());
    111121            CRX_ERROR (aResult, "failed to send to server <%s>", aHttpRequest.GetURL ().c_str ());
    112             PRINT_ERROR << aWebServer.GetErrorMessage() << GetErrorMessage();
    113122            return aResult;
    114123        }
     
    122131            if (aResult < 0)
    123132            {
     133                CRX_ERROR_ADD (aWebServer.GetErrorMessage ().c_str ());
    124134                CRX_ERROR (aResult, "failed to receive <%s>", aHttpRequest.GetURL ().c_str ());
    125                 PRINT_ERROR << aWebServer.GetErrorMessage() << GetErrorMessage();
    126135                break;
    127136            }
     
    135144            if (aResult != aReceivedSize)
    136145            {
     146                CRX_ERROR_ADD (mClient.GetErrorMessage ().c_str ());
    137147                CRX_ERROR (aResult, "failed to send <%s>", aHttpRequest.GetURL ().c_str ());
    138                 PRINT_ERROR << mClient.GetErrorMessage() << GetErrorMessage();
    139148                break;
    140149            }
  • trunk/src/makefile

    r14 r19  
    1515#----------------------------------------------------------
    1616FILES           =   \
     17                    CRXException        \
    1718                    CRXHttpMessage      \
    1819                    CRXHttpRequest      \
     
    2021                    CRXSocket           \
    2122                    CRXMutex            \
     23                    CRXProxy            \
    2224                    main                \
    2325
    2426CXX             = g++
    2527LD              = g++
    26 CXXDEFS         =
     28CXXDEFS         = -D_DEBUG
    2729CXXFLAGS        = $(PLATFORM) -fPIC -Wall -Wcast-align -c -g
    2830LDFLAGS         = $(PLATFORM)
Note: See TracChangeset for help on using the changeset viewer.