summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qalgorithms.qdoc8
-rw-r--r--src/corelib/tools/qeasingcurve.cpp8
-rw-r--r--src/corelib/tools/qlocale_blackberry.cpp23
-rw-r--r--src/corelib/tools/qregexp.cpp4
-rw-r--r--src/corelib/tools/qregularexpression.cpp7
-rw-r--r--src/corelib/tools/qtimeline.cpp10
-rw-r--r--src/corelib/tools/qtimezoneprivate.cpp8
-rw-r--r--src/corelib/tools/qtimezoneprivate_p.h4
8 files changed, 46 insertions, 26 deletions
diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc
index cd389470a4..412b9cf3b2 100644
--- a/src/corelib/tools/qalgorithms.qdoc
+++ b/src/corelib/tools/qalgorithms.qdoc
@@ -49,9 +49,9 @@
iterators they accept. For example, qFill() accepts two
\l {forward iterators}. The iterator types required are specified
for each algorithm. If an iterator of the wrong type is passed (for
- example, if QList::ConstIterator is passed as an \l {output
- iterator}), you will always get a compiler error, although not
- necessarily a very informative one.
+ example, if QList::ConstIterator is passed as an
+ \l {Output Iterators}{output iterator}), you will always get a
+ compiler error, although not necessarily a very informative one.
Some algorithms have special requirements on the value type
stored in the containers. For example,
@@ -99,7 +99,7 @@
\section2 Output Iterators
- An \e{output iterator} is an iterator that can be used for
+ An output iterator is an iterator that can be used for
writing data sequentially to a container or to some output
stream. It must provide the following operators: unary \c{*} for
writing a value (i.e., \c{*it = val}) and prefix \c{++} for
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index 5daf067c71..2708901866 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -432,14 +432,14 @@ struct BezierEase : public QEasingCurveFunction
qreal p3x, p3y;
};
- bool _init;
- bool _valid;
QVector<SingleCubicBezier> _curves;
- int _curveCount;
QVector<qreal> _intervals;
+ int _curveCount;
+ bool _init;
+ bool _valid;
BezierEase()
- : QEasingCurveFunction(InOut), _init(false), _valid(false), _curves(10), _intervals(10)
+ : QEasingCurveFunction(InOut), _curves(10), _intervals(10), _init(false), _valid(false)
{ }
void init()
diff --git a/src/corelib/tools/qlocale_blackberry.cpp b/src/corelib/tools/qlocale_blackberry.cpp
index 48faa73070..c2c3476b0a 100644
--- a/src/corelib/tools/qlocale_blackberry.cpp
+++ b/src/corelib/tools/qlocale_blackberry.cpp
@@ -60,7 +60,7 @@ static const char ppsRegionLocalePath[] = "/pps/services/locale/settings";
static const char ppsLanguageLocalePath[] = "/pps/services/confstr/_CS_LOCALE";
static const char ppsHourFormatPath[] = "/pps/system/settings";
-static const size_t ppsBufferSize = 256;
+static const int MAX_PPS_SIZE = 16000;
QBBSystemLocaleData::QBBSystemLocaleData()
: languageNotifier(0)
@@ -186,9 +186,24 @@ QByteArray QBBSystemLocaleData::readPpsValue(const char *ppsObject, int ppsFd)
if (!ppsObject || ppsFd == -1)
return result;
- char buffer[ppsBufferSize];
+ // PPS objects are of unknown size, but must be read all at once.
+ // Relying on the file size may not be a good idea since the size may change before reading.
+ // Let's try with an initial size (512), and if the buffer is too small try with bigger one,
+ // until we succeed or until other non buffer-size-related error occurs.
+ // Using QVarLengthArray means the first try (of size == 512) uses a buffer on the stack - no allocation necessary.
+ // Hopefully that covers most use cases.
+ int bytes;
+ QVarLengthArray<char, 512> buffer;
+ for (;;) {
+ errno = 0;
+ bytes = qt_safe_read(ppsFd, buffer.data(), buffer.capacity() - 1);
+ const bool bufferIsTooSmall = (bytes == -1 && errno == EMSGSIZE && buffer.capacity() < MAX_PPS_SIZE);
+ if (!bufferIsTooSmall)
+ break;
+
+ buffer.resize(qMin(buffer.capacity()*2, MAX_PPS_SIZE));
+ }
- int bytes = qt_safe_read(ppsFd, buffer, ppsBufferSize - 1);
// This method is called in the ctor(), so do not use qWarning to log warnings
// if qt_safe_read fails to read the pps file
// since the user code may install a message handler that invokes QLocale API again
@@ -202,7 +217,7 @@ QByteArray QBBSystemLocaleData::readPpsValue(const char *ppsObject, int ppsFd)
pps_decoder_t ppsDecoder;
pps_decoder_initialize(&ppsDecoder, 0);
- if (pps_decoder_parse_pps_str(&ppsDecoder, buffer) == PPS_DECODER_OK) {
+ if (pps_decoder_parse_pps_str(&ppsDecoder, buffer.data()) == PPS_DECODER_OK) {
pps_decoder_push(&ppsDecoder, 0);
const char *ppsBuff;
if (pps_decoder_get_string(&ppsDecoder, ppsObject, &ppsBuff) == PPS_DECODER_OK) {
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index 88499ad9d9..d2b5adc974 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -1045,12 +1045,12 @@ public:
#endif
private:
- uint c; // character classes
QVector<QRegExpCharClassRange> r; // character ranges
- bool n; // negative?
#ifndef QT_NO_REGEXP_OPTIM
QVector<int> occ1; // first-occurrence array
#endif
+ uint c; // character classes
+ bool n; // negative?
};
#else
struct QRegExpCharClass
diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp
index d5bd1dff00..e1cf82bb8c 100644
--- a/src/corelib/tools/qregularexpression.cpp
+++ b/src/corelib/tools/qregularexpression.cpp
@@ -813,8 +813,9 @@ struct QRegularExpressionPrivate : QSharedData
int captureIndexForName(const QString &name) const;
- QString pattern;
+ // sizeof(QSharedData) == 4, so start our members with an enum
QRegularExpression::PatternOptions patternOptions;
+ QString pattern;
// *All* of the following members are set managed while holding this mutex,
// except for isDirty which is set to true by QRegularExpression setters
@@ -889,7 +890,7 @@ QRegularExpression::QRegularExpression(QRegularExpressionPrivate &dd)
\internal
*/
QRegularExpressionPrivate::QRegularExpressionPrivate()
- : pattern(), patternOptions(0),
+ : patternOptions(0), pattern(),
mutex(),
compiledPattern(0), studyData(0),
errorString(0), errorOffset(-1),
@@ -919,7 +920,7 @@ QRegularExpressionPrivate::~QRegularExpressionPrivate()
*/
QRegularExpressionPrivate::QRegularExpressionPrivate(const QRegularExpressionPrivate &other)
: QSharedData(other),
- pattern(other.pattern), patternOptions(other.patternOptions),
+ patternOptions(other.patternOptions), pattern(other.pattern),
mutex(),
compiledPattern(0), studyData(0),
errorString(0),
diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp
index 976c03aef4..3619c9e986 100644
--- a/src/corelib/tools/qtimeline.cpp
+++ b/src/corelib/tools/qtimeline.cpp
@@ -53,13 +53,17 @@ class QTimeLinePrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QTimeLine)
public:
inline QTimeLinePrivate()
- : startTime(0), duration(1000), startFrame(0), endFrame(0),
+ : easingCurve(QEasingCurve::InOutSine),
+ startTime(0), duration(1000), startFrame(0), endFrame(0),
updateInterval(1000 / 25),
totalLoopCount(1), currentLoopCount(0), currentTime(0), timerId(0),
- direction(QTimeLine::Forward), easingCurve(QEasingCurve::InOutSine),
+ direction(QTimeLine::Forward),
state(QTimeLine::NotRunning)
{ }
+ QElapsedTimer timer;
+ QEasingCurve easingCurve;
+
int startTime;
int duration;
int startFrame;
@@ -70,10 +74,8 @@ public:
int currentTime;
int timerId;
- QElapsedTimer timer;
QTimeLine::Direction direction;
- QEasingCurve easingCurve;
QTimeLine::State state;
inline void setState(QTimeLine::State newState)
{
diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp
index 08a5ce0861..ee34469c03 100644
--- a/src/corelib/tools/qtimezoneprivate.cpp
+++ b/src/corelib/tools/qtimezoneprivate.cpp
@@ -596,9 +596,11 @@ QUtcTimeZonePrivate::QUtcTimeZonePrivate(const QByteArray &zoneId, int offsetSec
}
QUtcTimeZonePrivate::QUtcTimeZonePrivate(const QUtcTimeZonePrivate &other)
- : QTimeZonePrivate(other), m_offsetFromUtc(other.m_offsetFromUtc), m_name(other.m_name),
- m_abbreviation(other.m_abbreviation), m_country(other.m_country),
- m_comment(other.m_comment)
+ : QTimeZonePrivate(other), m_name(other.m_name),
+ m_abbreviation(other.m_abbreviation),
+ m_comment(other.m_comment),
+ m_country(other.m_country),
+ m_offsetFromUtc(other.m_offsetFromUtc)
{
}
diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h
index 108aec2654..4fbb3ff6e0 100644
--- a/src/corelib/tools/qtimezoneprivate_p.h
+++ b/src/corelib/tools/qtimezoneprivate_p.h
@@ -203,11 +203,11 @@ private:
const QString &abbreviation, QLocale::Country country,
const QString &comment);
- int m_offsetFromUtc;
QString m_name;
QString m_abbreviation;
- QLocale::Country m_country;
QString m_comment;
+ QLocale::Country m_country;
+ int m_offsetFromUtc;
};
#ifdef QT_USE_ICU