Revision control
Copy as Markdown
import QtQuick 2.0
QtObject {
property string test1: Qt.atob()
property string test2: Qt.atob("SGVsbG8gd29ybGQh")
property string test3: Qt.atob([
'S', 'G', 'V', 's', 'b', 'G', '8', 'g', 'd', '2', '9', 'y', 'b', 'G', 'Q', 'h'
])
property var better: Qt.atob([
0x52, 0x30, 0x6c, 0x47, 0x4f, 0x44, 0x64, 0x68,
0x41, 0x51, 0x41, 0x42, 0x41, 0x50, 0x41, 0x41,
0x41, 0x50, 0x38, 0x41, 0x41, 0x41, 0x41, 0x41,
0x41, 0x43, 0x77, 0x41, 0x41, 0x41, 0x41, 0x41,
0x41, 0x51, 0x41, 0x42, 0x41, 0x41, 0x41, 0x43,
0x41, 0x6b, 0x51, 0x42, 0x41, 0x44, 0x73, 0x3d,
])
property var better2: Qt.atob(new Uint8Array([
0x52, 0x30, 0x6c, 0x47, 0x4f, 0x44, 0x64, 0x68,
0x41, 0x51, 0x41, 0x42, 0x41, 0x50, 0x41, 0x41,
0x41, 0x50, 0x38, 0x41, 0x41, 0x41, 0x41, 0x41,
0x41, 0x43, 0x77, 0x41, 0x41, 0x41, 0x41, 0x41,
0x41, 0x51, 0x41, 0x42, 0x41, 0x41, 0x41, 0x43,
0x41, 0x6b, 0x51, 0x42, 0x41, 0x44, 0x73, 0x3d,
]).buffer)
function bad1() {
return Qt.atob([999, 888]);
}
function bad2() {
return Qt.atob(['ab', 'cde']);
}
function bad3() {
return Qt.atob([this]);
}
function bad4() {
return Qt.atob(new Uint8Array([0x02, 0x20, 0x41, 0xf1, 0x73, 0x3d]).buffer);
}
}