| ... | ... | @@ -683,10 +683,12 @@ pub const ArgIteratorWindows = struct { |
| 683 | 683 | const wtf8_len = unicode.calcWtf8Len(cmd_line); |
| 684 | 684 | |
| 685 | 685 | // This buffer must be large enough to contain contiguous NUL-terminated slices |
| 686 | | // of each argument. For arguments past the first one, space for the NUL-terminator |
| 687 | | // is guaranteed due to the necessary whitespace between arugments. However, we need |
| 688 | | // one extra byte to guarantee enough room for the NUL terminator if the command line |
| 689 | | // ends up being exactly 1 argument long with no quotes, etc. |
| 686 | // of each argument. |
| 687 | // - During parsing, the length of a parsed argument will always be equal to |
| 688 | // to less than its unparsed length |
| 689 | // - The first argument needs one extra byte of space allocated for its NUL |
| 690 | // terminator, but for each subsequent argument the necessary whitespace |
| 691 | // between arguments guarantees room for their NUL terminator(s). |
| 690 | 692 | const buffer = try allocator.alloc(u8, wtf8_len + 1); |
| 691 | 693 | errdefer allocator.free(buffer); |
| 692 | 694 | |