20
20
*/
21
21
#include " config.h"
22
22
#include " input.h"
23
- #include < QtCore>
23
+
24
+ #include < QString>
25
+ #include < QVariant>
26
+ #include < QStack>
27
+ #include < QTextCodec>
28
+ #include < QByteArray>
29
+ #include < QFileInfo>
30
+ #include < QStringList>
31
+ #include < QRegExp>
32
+ #include < QTextStream>
24
33
25
34
#define YY_NO_UNISTD_H 1
26
35
@@ -52,7 +61,7 @@ static QVariant *g_arg;
52
61
static Input *g_curOption=0 ;
53
62
static QString g_elemStr;
54
63
static QTextCodec *g_codec = QTextCodec::codecForName (" UTF-8" );
55
- static QString g_codecName = QString::fromAscii (" UTF-8" );
64
+ static QString g_codecName = QString::fromLatin1 (" UTF-8" );
56
65
static int g_lastState;
57
66
static QByteArray g_tmpString;
58
67
@@ -74,13 +83,13 @@ static int yyread(char *buf,int maxSize)
74
83
}
75
84
}
76
85
77
- static QString warning_str = QString::fromAscii (" warning: " );
78
- static QString error_str = QString::fromAscii (" error: " );
86
+ static QString warning_str = QString::fromLatin1 (" warning: " );
87
+ static QString error_str = QString::fromLatin1 (" error: " );
79
88
80
89
void config_err (const char *fmt, ...)
81
90
{
82
91
QString msg = error_str;
83
- msg.append (QString::fromAscii (fmt));
92
+ msg.append (QString::fromLatin1 (fmt));
84
93
va_list args;
85
94
va_start (args, fmt);
86
95
vfprintf (stderr, qPrintable (msg), args);
@@ -89,7 +98,7 @@ void config_err(const char *fmt, ...)
89
98
void config_warn (const char *fmt, ...)
90
99
{
91
100
QString msg = warning_str;
92
- msg.append (QString::fromAscii (fmt));
101
+ msg.append (QString::fromLatin1 (fmt));
93
102
va_list args;
94
103
va_start (args, fmt);
95
104
vfprintf (stderr, qPrintable (msg), args);
@@ -101,10 +110,10 @@ static void substEnvVarsInString(QString &s);
101
110
102
111
static void checkEncoding ()
103
112
{
104
- Input *option = g_options->value (QString::fromAscii (" DOXYFILE_ENCODING" ));
113
+ Input *option = g_options->value (QString::fromLatin1 (" DOXYFILE_ENCODING" ));
105
114
if (option && option->value ().toString ()!=g_codecName)
106
115
{
107
- QTextCodec *newCodec = QTextCodec::codecForName (option->value ().toString ().toAscii ());
116
+ QTextCodec *newCodec = QTextCodec::codecForName (option->value ().toString ().toLatin1 ());
108
117
if (newCodec)
109
118
{
110
119
g_codec = newCodec;
@@ -115,7 +124,7 @@ static void checkEncoding()
115
124
116
125
static FILE *tryPath (const QString &path,const QString &fileName)
117
126
{
118
- QString absName=!path.isEmpty () ? path+QString::fromAscii (" /" )+fileName : fileName;
127
+ QString absName=!path.isEmpty () ? path+QString::fromLatin1 (" /" )+fileName : fileName;
119
128
QFileInfo fi (absName);
120
129
if (fi.exists () && fi.isFile ())
121
130
{
@@ -144,7 +153,7 @@ static FILE *findFile(const QString &fileName)
144
153
if (f) return f;
145
154
}
146
155
// try cwd if g_includePathList fails
147
- return tryPath (QString::fromAscii (" ." ),fileName);
156
+ return tryPath (QString::fromLatin1 (" ." ),fileName);
148
157
}
149
158
150
159
static void readIncludeFile (const QString &incName)
@@ -160,8 +169,8 @@ static void readIncludeFile(const QString &incName)
160
169
substEnvVarsInString (inc);
161
170
inc = inc.trimmed ();
162
171
uint incLen = inc.length ();
163
- if (inc.at (0 )==QChar::fromAscii (' "' ) &&
164
- inc.at (incLen-1 )==QChar::fromAscii (' "' )) // strip quotes
172
+ if (inc.at (0 )==QChar::fromLatin1 (' "' ) &&
173
+ inc.at (incLen-1 )==QChar::fromLatin1 (' "' )) // strip quotes
165
174
{
166
175
inc=inc.mid (1 ,incLen-2 );
167
176
}
@@ -383,7 +392,7 @@ static void readIncludeFile(const QString &incName)
383
392
384
393
static void substEnvVarsInString (QString &s)
385
394
{
386
- static QRegExp re (QString::fromAscii (" \\ $\\ ([a-z_A-Z0-9]+\\ )" ));
395
+ static QRegExp re (QString::fromLatin1 (" \\ $\\ ([a-z_A-Z0-9]+\\ )" ));
387
396
if (s.isEmpty ()) return ;
388
397
int p=0 ;
389
398
int i,l;
@@ -409,8 +418,8 @@ static void substEnvVarsInStrList(QStringList &sl)
409
418
foreach (QString result, sl)
410
419
{
411
420
// an argument with quotes will have an extra space at the end, so wasQuoted will be TRUE.
412
- bool wasQuoted = (result.indexOf (QChar::fromAscii (' ' ))!=-1 ) ||
413
- (result.indexOf (QChar::fromAscii (' \t ' ))!=-1 );
421
+ bool wasQuoted = (result.indexOf (QChar::fromLatin1 (' ' ))!=-1 ) ||
422
+ (result.indexOf (QChar::fromLatin1 (' \t ' ))!=-1 );
414
423
// here we strip the quote again
415
424
substEnvVarsInString (result);
416
425
@@ -430,33 +439,33 @@ static void substEnvVarsInStrList(QStringList &sl)
430
439
{
431
440
QChar c=0 ;
432
441
// skip until start of new word
433
- while (i<l && ((c=result.at (i))==QChar::fromAscii (' ' ) || c==QChar::fromAscii (' \t ' ))) i++;
442
+ while (i<l && ((c=result.at (i))==QChar::fromLatin1 (' ' ) || c==QChar::fromLatin1 (' \t ' ))) i++;
434
443
p=i; // p marks the start index of the word
435
444
// skip until end of a word
436
- while (i<l && ((c=result.at (i))!=QChar::fromAscii (' ' ) &&
437
- c!=QChar::fromAscii (' \t ' ) &&
438
- c!=QChar::fromAscii (' "' ))) i++;
445
+ while (i<l && ((c=result.at (i))!=QChar::fromLatin1 (' ' ) &&
446
+ c!=QChar::fromLatin1 (' \t ' ) &&
447
+ c!=QChar::fromLatin1 (' "' ))) i++;
439
448
if (i<l) // not at the end of the string
440
449
{
441
- if (c==QChar::fromAscii (' "' )) // word within quotes
450
+ if (c==QChar::fromLatin1 (' "' )) // word within quotes
442
451
{
443
452
p=i+1 ;
444
453
for (i++;i<l;i++)
445
454
{
446
455
c=result.at (i);
447
- if (c==QChar::fromAscii (' "' )) // end quote
456
+ if (c==QChar::fromLatin1 (' "' )) // end quote
448
457
{
449
458
out += result.mid (p,i-p);
450
459
p=i+1 ;
451
460
break ;
452
461
}
453
- else if (c==QChar::fromAscii (' \\ ' )) // skip escaped stuff
462
+ else if (c==QChar::fromLatin1 (' \\ ' )) // skip escaped stuff
454
463
{
455
464
i++;
456
465
}
457
466
}
458
467
}
459
- else if (c==QChar::fromAscii (' ' ) || c==QChar::fromAscii (' \t ' )) // separator
468
+ else if (c==QChar::fromLatin1 (' ' ) || c==QChar::fromLatin1 (' \t ' )) // separator
460
469
{
461
470
out += result.mid (p,i-p);
462
471
p=i+1 ;
@@ -529,7 +538,7 @@ bool parseConfig(
529
538
void writeStringValue (QTextStream &t,QTextCodec *codec,const QString &s)
530
539
{
531
540
QChar c;
532
- bool needsEscaping=FALSE ;
541
+ bool needsEscaping=false ;
533
542
// convert the string back to it original encoding
534
543
// QByteArray se = codec->fromUnicode(s);
535
544
t.setCodec (codec);
@@ -538,20 +547,20 @@ void writeStringValue(QTextStream &t,QTextCodec *codec,const QString &s)
538
547
{
539
548
while (!(c=*p++).isNull () && !needsEscaping)
540
549
{
541
- needsEscaping = (c==QChar::fromAscii (' ' ) ||
542
- c==QChar::fromAscii (' \n ' ) ||
543
- c==QChar::fromAscii (' \t ' ) ||
544
- c==QChar::fromAscii (' "' ));
550
+ needsEscaping = (c==QChar::fromLatin1 (' ' ) ||
551
+ c==QChar::fromLatin1 (' \n ' ) ||
552
+ c==QChar::fromLatin1 (' \t ' ) ||
553
+ c==QChar::fromLatin1 (' "' ));
545
554
}
546
555
if (needsEscaping)
547
556
{
548
557
t << " \" " ;
549
558
p=s.data ();
550
559
while (!p->isNull ())
551
560
{
552
- if (*p ==QChar::fromAscii (' ' ) &&
553
- *(p+1 )==QChar::fromAscii (' \0 ' )) break ; // skip inserted space at the end
554
- if (*p ==QChar::fromAscii (' "' )) t << " \\ " ; // escape quotes
561
+ if (*p ==QChar::fromLatin1 (' ' ) &&
562
+ *(p+1 )==QChar::fromLatin1 (' \0 ' )) break ; // skip inserted space at the end
563
+ if (*p ==QChar::fromLatin1 (' "' )) t << " \\ " ; // escape quotes
555
564
t << *p++;
556
565
}
557
566
t << " \" " ;
0 commit comments