ya-struct 0.0.8 → 0.0.9
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.
- package/dist/lib/layout.js +8 -0
- package/dist/lib/types/string.js +1 -1
- package/lib/layout.ts +8 -0
- package/lib/types/string.ts +1 -1
- package/package.json +1 -1
package/dist/lib/layout.js
CHANGED
|
@@ -111,6 +111,14 @@ const layoutStruct = ({
|
|
|
111
111
|
|
|
112
112
|
break;
|
|
113
113
|
}
|
|
114
|
+
case "struct": {
|
|
115
|
+
|
|
116
|
+
if (currentOffsetInBits % 64 !== 0) {
|
|
117
|
+
throw Error("nested struct alignment handling not implemented yet");
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
114
122
|
case "string": {
|
|
115
123
|
// no special alignment needed
|
|
116
124
|
break;
|
package/dist/lib/types/string.js
CHANGED
|
@@ -37,7 +37,7 @@ const createStringParser = ({ length }/*: { length: number }*/)/*: TStringParser
|
|
|
37
37
|
|
|
38
38
|
const encoded = encoder.encode(value);
|
|
39
39
|
|
|
40
|
-
if (encoded.length + 1
|
|
40
|
+
if (encoded.length + 1 > length) {
|
|
41
41
|
throw Error("string too long to fit in target");
|
|
42
42
|
}
|
|
43
43
|
|
package/lib/layout.ts
CHANGED
|
@@ -111,6 +111,14 @@ const layoutStruct = ({
|
|
|
111
111
|
|
|
112
112
|
break;
|
|
113
113
|
}
|
|
114
|
+
case "struct": {
|
|
115
|
+
|
|
116
|
+
if (currentOffsetInBits % 64 !== 0) {
|
|
117
|
+
throw Error("nested struct alignment handling not implemented yet");
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
114
122
|
case "string": {
|
|
115
123
|
// no special alignment needed
|
|
116
124
|
break;
|
package/lib/types/string.ts
CHANGED
|
@@ -37,7 +37,7 @@ const createStringParser = ({ length }: { length: number }): TStringParser => {
|
|
|
37
37
|
|
|
38
38
|
const encoded = encoder.encode(value);
|
|
39
39
|
|
|
40
|
-
if (encoded.length + 1
|
|
40
|
+
if (encoded.length + 1 > length) {
|
|
41
41
|
throw Error("string too long to fit in target");
|
|
42
42
|
}
|
|
43
43
|
|
package/package.json
CHANGED