Log4cxx
  1. Log4cxx
  2. LOGCXX-107

Can't compile log4cxx in ascii on Windows

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.10.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      Windows

      Description

      on unicodehelper.cpp at line 95
      ////////
      #if defined(_WIN32)
      unsigned int UnicodeHelper::decodeWide(const wchar_t*& src, const wchar_t* srcEnd) {
      unsigned int sv = *(src++);
      if (sv < 0xDC00 || sv >= 0xDC00)

      { return sv; }

      /////
      according to unicodhelper.h the line should be "#if LOG4CXX_HAS_WCHAR_T"

        Activity

        Curt Arnold made changes -
        Field Original Value New Value
        Fix Version/s 0.9.8 [ 10782 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Curt Arnold added a comment -

        Rev 315077 (also removed spurious tab in hierarchy.cpp)

        Show
        Curt Arnold added a comment - Rev 315077 (also removed spurious tab in hierarchy.cpp)
        Hide
        Alban Seurat added a comment -

        On windows with Visual studio .NET 2003,

        I want to compile log4cxx in "Ascii mode", so in log4cxx.h, i put LOG4CXX_HAS_WCHAR_T to 0 with LOG4CXX_LOCALE_ENCODING_US_ASCII to 1

        So when I compile the file unicodehelper.h the 3 functions inside the #if LOG4CXX_HAS_WCHAR_T has not been declared and the compilation failed.

        Maybe we can use "#if defined(WIN32) && LOG4CXX_HAS_WCHAR_T" like just before with "#if LOG4CXX_HAS_WCHAR_T && defined(STDC_ISO_10646_)" ?

        Show
        Alban Seurat added a comment - On windows with Visual studio .NET 2003, I want to compile log4cxx in "Ascii mode", so in log4cxx.h, i put LOG4CXX_HAS_WCHAR_T to 0 with LOG4CXX_LOCALE_ENCODING_US_ASCII to 1 So when I compile the file unicodehelper.h the 3 functions inside the #if LOG4CXX_HAS_WCHAR_T has not been declared and the compilation failed. Maybe we can use "#if defined( WIN32) && LOG4CXX_HAS_WCHAR_T" like just before with "#if LOG4CXX_HAS_WCHAR_T && defined( STDC_ISO_10646 _)" ?
        Hide
        Curt Arnold added a comment -

        No, it should not.

        The header file uses that #if LOG4CXX_HAS_WCHAR_T since the function UnicodeHelper::decodeWide must be present in all wchar_t enabled builds. However, there are several implementations of decodeWide depending on the nature of wchar_t. If the nature of wchar_t can't be determined, the build will fail due to a link failure.

        The particular implementation of decodeWide at line 95 in unicodehelper.cpp is only valid if wchar_t contains UTF-16 values. The only platform currently supported where wchar_t is UTF-16 is Windows. If another platforms are indentified where wchar_t is UTF-16, then the #if defined(_WIN32) can be modified (likely introducing a LOG4CXX_WCHAR_T_IS_UTF16 macro within unicodehelper.cpp).

        What was the compile problem that you were having, what compiler were you using, etc.

        Show
        Curt Arnold added a comment - No, it should not. The header file uses that #if LOG4CXX_HAS_WCHAR_T since the function UnicodeHelper::decodeWide must be present in all wchar_t enabled builds. However, there are several implementations of decodeWide depending on the nature of wchar_t. If the nature of wchar_t can't be determined, the build will fail due to a link failure. The particular implementation of decodeWide at line 95 in unicodehelper.cpp is only valid if wchar_t contains UTF-16 values. The only platform currently supported where wchar_t is UTF-16 is Windows. If another platforms are indentified where wchar_t is UTF-16, then the #if defined(_WIN32) can be modified (likely introducing a LOG4CXX_WCHAR_T_IS_UTF16 macro within unicodehelper.cpp). What was the compile problem that you were having, what compiler were you using, etc.
        Alban Seurat created issue -

          People

          • Assignee:
            Curt Arnold
            Reporter:
            Alban Seurat
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development