| ... | @@ -687,17 +687,17 @@ fn transStringLiteral( | ... | @@ -687,17 +687,17 @@ fn transStringLiteral( |
| 687 | const kind = ZigClangStringLiteral_getKind(stmt); | 687 | const kind = ZigClangStringLiteral_getKind(stmt); |
| 688 | switch (kind) { | 688 | switch (kind) { |
| 689 | .Ascii, .UTF8 => { | 689 | .Ascii, .UTF8 => { |
| 690 | var clen: usize = undefined; | 690 | var len: usize = undefined; |
| 691 | const cstr = ZigClangStringLiteral_getString_bytes_begin_size(stmt, &clen); | 691 | const bytes_ptr = ZigClangStringLiteral_getString_bytes_begin_size(stmt, &len); |
| 692 | const zstr = try rp.c.str(cstr); | 692 | const str = bytes_ptr[0..len]; |
| 693 | | 693 | |
| 694 | var len: usize = 0; | 694 | len = 0; |
| 695 | for (zstr) |c| len += escapeChar(c).len; | 695 | for (str) |c| len += escapeChar(c).len; |
| 696 | | 696 | |
| 697 | const buf = try rp.c.a().alloc(u8, len + "c\"\"".len); | 697 | const buf = try rp.c.a().alloc(u8, len + "c\"\"".len); |
| 698 | buf[0] = 'c'; | 698 | buf[0] = 'c'; |
| 699 | buf[1] = '"'; | 699 | buf[1] = '"'; |
| 700 | writeEscapedString(buf[2..], zstr); | 700 | writeEscapedString(buf[2..], str); |
| 701 | buf[buf.len - 1] = '"'; | 701 | buf[buf.len - 1] = '"'; |
| 702 | | 702 | |
| 703 | const token = try appendToken(rp.c, .StringLiteral, buf); | 703 | const token = try appendToken(rp.c, .StringLiteral, buf); |