Changeset 632


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.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/3rdparty/clucene/src/CLucene/index/CompoundFile.cpp

    r2 r632  
    1111#include "CLucene/util/Misc.h"
    1212
     13
     14
    1315CL_NS_USE(store)
    1416CL_NS_USE(util)
     
    7274            int64_t offset = stream->readLong();
    7375            int32_t read = stream->readString(tid, CL_MAX_PATH);
    74             QString aid(QString::fromWCharArray(tid, read));
     76            QString aid);
    7577
    7678            // set length of the previous entry
     
    294296                fe->directoryOffset = os->getFilePointer();
    295297                os->writeLong(0);    // for now
    296                 tfile[fe->file.toWCharArray(tfile)] = '\0';
     298                tfile[tfile)] = '\0';
    297299                os->writeString(tfile, _tcslen(tfile));
    298300            }
  • trunk/src/3rdparty/clucene/src/CLucene/index/IndexWriter.cpp

    r2 r632  
    1717#include "SegmentInfos.h"
    1818#include "SegmentMerger.h"
     19
     20
    1921
    2022CL_NS_USE(store)
     
    473475        for (int32_t i = input->readInt(); i > 0; i--) {
    474476            int32_t read = input->readString(tname, CL_MAX_PATH);
    475             result.push_back(QString::fromWCharArray(tname, read));
     477            result.push_back((tname, read));
    476478        }
    477479    } _CLFINALLY (
     
    516518        QStringList::const_iterator itr;
    517519        for (itr  = files.begin(); itr != files.end(); ++itr) {
    518             tfile[(*itr).toWCharArray(tfile)] = '\0';
     520            tfile[tfile)] = '\0';
    519521            output->writeString(tfile, _tcslen(tfile));
    520522        }
  • trunk/src/3rdparty/clucene/src/CLucene/index/SegmentInfos.cpp

    r2 r632  
    1212#include "CLucene/store/Directory.h"
    1313#include "CLucene/util/Misc.h"
     14
     15
    1416
    1517CL_NS_USE(store)
     
    207209
    208210                //Write the name of the current segment
    209                 int32_t count = si->name.toWCharArray(tname);
     211                int32_t count = tname);
    210212                tname[count] = '\0';
    211213                output->writeString(tname, _tcslen(tname));
  • trunk/src/3rdparty/clucene/src/CLucene/index/TermInfosReader.cpp

    r2 r632  
    217217    }
    218218
    219     //Reposition current term in the enumeration
    220     seekEnum(getIndexOffset(term));
    221     //Return the TermInfo for term
    222     return scanEnum(term);
     219    //Reposition current term in the enumeration
     220    int32_t indexOffset = getIndexOffset(term);
     221    if (indexOffset >= 0) {
     222        seekEnum(getIndexOffset(term));
     223        //Return the TermInfo for term
     224        return scanEnum(term);
     225    }
     226
     227    // term not found
     228    return NULL;
    223229}
    224230
     
    238244    //Retrieve the indexOffset for term
    239245    int32_t indexOffset = getIndexOffset(term);
     246
     247
     248
    240249    seekEnum(indexOffset);
    241250
     
    339348    //Pre  - term holds a reference to a valid term
    340349    //       indexTerms != NULL
    341     //Post - The new offset has been returned
     350    //Post - The new offset has been returned
    342351
    343352    //Check if is indexTerms is a valid array
  • trunk/src/3rdparty/clucene/src/CLucene/store/FSDirectory.cpp

    r561 r632  
    1919#include "CLucene/debug/condition.h"
    2020
     21
     22
    2123CL_NS_DEF(store)
    2224CL_NS_USE(util)
     
    560562
    561563    TCHAR tBuffer[2048] = { 0 };
    562     dirName.toWCharArray(tBuffer);
     564    tBuffer);
    563565   
    564566    char aBuffer[4096] = { 0 };
  • 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.