Ignore:
Timestamp:
Mar 5, 2010, 1:38:54 AM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

3rdparty/clucene: Made it build in _ASCII mode.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/assistant/lib/fulltextsearch/qclucene_global_p.h

    r561 r632  
    3737#include <QtCore/QString>
    3838
    39 #if !defined(_MSC_VER) && defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)
     39#if !defined(_MSC_VER)
    4040#   if !defined(TCHAR)
    41 #       define TCHAR wchar_t
     41#       if defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T) && !defined(_ASCII)
     42#           define TCHAR wchar_t
     43#       else
     44#           define TCHAR char
     45#       endif
    4246#   endif
    4347#else
     
    6165//  -------------
    6266//
    63 // adjustments here, need to be done in 
     67// adjustments here, need to be done in
    6468// QTDIR/src/3rdparty/clucene/src/CLucene/StdHeader.h as well
    6569//
     
    106110    TCHAR* QStringToTChar(const QString &str)
    107111    {
    108         TCHAR *string = new TCHAR[(str.length() +1) * sizeof(TCHAR)];
    109         memset(string, 0, (str.length() +1) * sizeof(TCHAR));
    110         #if defined(UNICODE) || defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)
     112       
     113        ;
     114       
    111115            str.toWCharArray(string);
     116
    112117        #else
    113             const QByteArray ba = str.toAscii();
     118            const QByteArray ba = str.toLocal8Bit();
     119            char *string = new char[ba.length() + 1];
    114120            strcpy(string, ba.constData());
     121
    115122        #endif
    116         return string;
    117123    }
    118124
    119     QString TCharToQString(const TCHAR *string)
     125    TCHAR *string)
    120126    {
    121         #if defined(UNICODE) || defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)
    122             QString retValue = QString::fromWCharArray(string);
     127        #if (defined(UNICODE) || (defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T))) && !defined(_ASCII)
     128            return str.toWCharArray(string);
     129        #else
     130            const QByteArray ba = str.toLocal8Bit();
     131            strncpy(string, ba.constData(), ba.length());
     132            return ba.length();
     133        #endif
     134    }
     135
     136    QString TCharToQString(const TCHAR *string, int size = -1)
     137    {
     138        #if (defined(UNICODE) || (defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T))) && !defined(_ASCII)
     139            QString retValue = QString::fromWCharArray(string, size);
    123140            return retValue;
    124141        #else
    125             return QString(QLatin1String(string));
     142            return QString);
    126143        #endif
    127144    }
Note: See TracChangeset for help on using the changeset viewer.