QUrl: change the default action for spaces to decoded
That matches the QUrl::ComponentFormattingOptions flags and avoids modifying the memcpy'ed action table for the default. This applies to everything we set, since we keep decoded spaces in the strings in QUrlPrivate. Amends commit 1b7e9dba75f18342911bc6954be3e754322f091f ("Change the component formatting enum values so the default is zero") which changed from DecodeSpaces to EncodeSpaces. And amends the previous commit. Task-number: QTBUG-135949 Change-Id: I2a9e4ffc62ca4a75f675fffd366204c0a4ee7337 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
d3758ce9b0
commit
83d964ea70
@ -22,7 +22,7 @@ enum EncodingAction {
|
||||
// sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
|
||||
// / "*" / "+" / "," / ";" / "="
|
||||
static const uchar defaultActionTable[96] = {
|
||||
2, // space
|
||||
0, // space
|
||||
1, // '!' (sub-delim)
|
||||
2, // '"'
|
||||
1, // '#' (gen-delim)
|
||||
@ -648,8 +648,8 @@ qt_urlRecode(QString &appendTo, QStringView in,
|
||||
memcpy(actionTable, defaultActionTable, sizeof actionTable);
|
||||
if (encoding & QUrl::DecodeReserved)
|
||||
maskTable(actionTable, reservedMask);
|
||||
if (!(encoding & QUrl::EncodeSpaces))
|
||||
actionTable[0] = DecodeCharacter; // decode
|
||||
if (encoding & QUrl::EncodeSpaces)
|
||||
actionTable[0] = EncodeCharacter;
|
||||
|
||||
if (tableModifications) {
|
||||
for (const ushort *p = tableModifications; *p; ++p)
|
||||
@ -669,9 +669,6 @@ qsizetype qt_encodeFromUser(QString &appendTo, const QString &in, const ushort *
|
||||
actionTable['[' - ' '] = EncodeCharacter;
|
||||
actionTable[']' - ' '] = EncodeCharacter;
|
||||
|
||||
// Apply !EncodeSpaces, same as qt_urlRecode() above
|
||||
actionTable[0] = DecodeCharacter;
|
||||
|
||||
if (tableModifications) {
|
||||
for (const ushort *p = tableModifications; *p; ++p)
|
||||
actionTable[uchar(*p) - ' '] = *p >> 8;
|
||||
|
Loading…
x
Reference in New Issue
Block a user