- Timestamp:
- Mar 5, 2010, 1:38:54 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/assistant/lib/fulltextsearch/qclucene_global_p.h
r561 r632 37 37 #include <QtCore/QString> 38 38 39 #if !defined(_MSC_VER) && defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T)39 #if !defined(_MSC_VER) 40 40 # 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 42 46 # endif 43 47 #else … … 61 65 // ------------- 62 66 // 63 // adjustments here, need to be done in 67 // adjustments here, need to be done in 64 68 // QTDIR/src/3rdparty/clucene/src/CLucene/StdHeader.h as well 65 69 // … … 106 110 TCHAR* QStringToTChar(const QString &str) 107 111 { 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 111 115 str.toWCharArray(string); 116 112 117 #else 113 const QByteArray ba = str.toAscii(); 118 const QByteArray ba = str.toLocal8Bit(); 119 char *string = new char[ba.length() + 1]; 114 120 strcpy(string, ba.constData()); 121 115 122 #endif 116 return string;117 123 } 118 124 119 QString TCharToQString(constTCHAR *string)125 TCHAR *string) 120 126 { 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); 123 140 return retValue; 124 141 #else 125 return QString (QLatin1String(string));142 return QString); 126 143 #endif 127 144 }
Note:
See TracChangeset
for help on using the changeset viewer.