@abaplint/runtime 2.8.7 → 2.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setBit = void 0;
|
|
4
4
|
function setBit(number, hex, val) {
|
|
5
|
+
if (number.get() <= 0) {
|
|
6
|
+
throw new Error("BIT_OFFSET_NOT_POSITIVE");
|
|
7
|
+
}
|
|
5
8
|
let hexFull = hex.get();
|
|
6
9
|
if (hexFull === "") {
|
|
7
10
|
hexFull = "00";
|
package/build/src/types/hex.js
CHANGED
|
@@ -94,6 +94,10 @@ class Hex {
|
|
|
94
94
|
else {
|
|
95
95
|
offset = (0, _parse_1.parse)(offset);
|
|
96
96
|
}
|
|
97
|
+
if (offset * 2 > this.value.length
|
|
98
|
+
|| offset < 0) {
|
|
99
|
+
(0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
|
|
100
|
+
}
|
|
97
101
|
}
|
|
98
102
|
let length = input?.length;
|
|
99
103
|
if (length) {
|
|
@@ -103,24 +107,27 @@ class Hex {
|
|
|
103
107
|
else {
|
|
104
108
|
length = (0, _parse_1.parse)(length);
|
|
105
109
|
}
|
|
110
|
+
if (length * 2 > this.value.length
|
|
111
|
+
|| length < 0) {
|
|
112
|
+
(0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// NOTE: this only copies the minimal length of the string,
|
|
116
|
+
if (offset !== undefined && length !== undefined) {
|
|
117
|
+
if (offset * 2 + length * 2 > this.value.length) {
|
|
118
|
+
(0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
|
|
119
|
+
}
|
|
120
|
+
return new xstring_1.XString().set(this.value.substr(offset * 2, length * 2));
|
|
106
121
|
}
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
|| (offset && length && offset * 2 + length * 2 > this.value.length)
|
|
110
|
-
|| (offset && offset < 0)
|
|
111
|
-
|| (length && length < 0)) {
|
|
112
|
-
(0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
|
|
122
|
+
else if (offset !== undefined) {
|
|
123
|
+
return new xstring_1.XString().set(this.value.substr(offset * 2));
|
|
113
124
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
ret = ret.substr(offset * 2);
|
|
125
|
+
else if (length !== undefined) {
|
|
126
|
+
return new xstring_1.XString().set(this.value.substr(0, length * 2));
|
|
117
127
|
}
|
|
118
|
-
|
|
119
|
-
|
|
128
|
+
else {
|
|
129
|
+
throw new Error("hex: getOffset, unexpected");
|
|
120
130
|
}
|
|
121
|
-
const r = new xstring_1.XString();
|
|
122
|
-
r.set(ret);
|
|
123
|
-
return r;
|
|
124
131
|
}
|
|
125
132
|
}
|
|
126
133
|
exports.Hex = Hex;
|
|
@@ -61,6 +61,10 @@ class XString {
|
|
|
61
61
|
else {
|
|
62
62
|
offset = (0, _parse_1.parse)(offset);
|
|
63
63
|
}
|
|
64
|
+
if (offset * 2 > this.value.length
|
|
65
|
+
|| offset < 0) {
|
|
66
|
+
(0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
|
|
67
|
+
}
|
|
64
68
|
}
|
|
65
69
|
let length = input?.length;
|
|
66
70
|
if (length) {
|
|
@@ -70,26 +74,27 @@ class XString {
|
|
|
70
74
|
else {
|
|
71
75
|
length = (0, _parse_1.parse)(length);
|
|
72
76
|
}
|
|
77
|
+
if (length * 2 > this.value.length
|
|
78
|
+
|| length < 0) {
|
|
79
|
+
(0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// NOTE: this only copies the minimal length of the string,
|
|
83
|
+
if (offset !== undefined && length !== undefined) {
|
|
84
|
+
if (offset * 2 + length * 2 > this.value.length) {
|
|
85
|
+
(0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
|
|
86
|
+
}
|
|
87
|
+
return new XString().set(this.value.substr(offset * 2, length * 2));
|
|
73
88
|
}
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
|| (offset && length && offset * 2 + length * 2 > this.value.length)
|
|
77
|
-
|| (offset && offset < 0)
|
|
78
|
-
|| (length && length < 0)) {
|
|
79
|
-
(0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
|
|
89
|
+
else if (offset !== undefined) {
|
|
90
|
+
return new XString().set(this.value.substr(offset * 2));
|
|
80
91
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
// @ts-ignore
|
|
84
|
-
ret = ret.substr(offset * 2);
|
|
92
|
+
else if (length !== undefined) {
|
|
93
|
+
return new XString().set(this.value.substr(0, length * 2));
|
|
85
94
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
ret = ret.substr(0, length * 2);
|
|
95
|
+
else {
|
|
96
|
+
throw new Error("xstring: getOffset, unexpected");
|
|
89
97
|
}
|
|
90
|
-
const r = new XString();
|
|
91
|
-
r.set(ret);
|
|
92
|
-
return r;
|
|
93
98
|
}
|
|
94
99
|
}
|
|
95
100
|
exports.XString = XString;
|