(method: string, size: number)
| 940 | } |
| 941 | |
| 942 | protected beginCommandWrite(method: string, size: number): boolean { |
| 943 | if (this.error) return false; |
| 944 | |
| 945 | if (this.cmdCount + 1 > this.maxCmdCount) { |
| 946 | this.fail( |
| 947 | "ZRDL_TOO_LARGE", |
| 948 | `maxCmdCount exceeded (count=${this.cmdCount + 1}, max=${this.maxCmdCount})`, |
| 949 | ); |
| 950 | return false; |
| 951 | } |
| 952 | |
| 953 | if ((this.cmdLen & 3) !== 0) { |
| 954 | this.fail("ZRDL_INTERNAL", "writeCommandHeader: cmd cursor is not 4-byte aligned"); |
| 955 | return false; |
| 956 | } |
| 957 | |
| 958 | const required = this.cmdLen + size; |
| 959 | this.ensureCmdCapacity(required); |
| 960 | if (this.error) return false; |
| 961 | |
| 962 | if (required > this.cmdBuf.byteLength) { |
| 963 | this.failCapacity(method, size); |
| 964 | return false; |
| 965 | } |
| 966 | return true; |
| 967 | } |
| 968 | |
| 969 | protected failCapacity(method: string, size: number): void { |
| 970 | const required = this.cmdLen + size; |
nothing calls this directly
no test coverage detected