authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-31 23:46:08 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-31 23:46:08 -07:00
log8f09305b8088596d37e78fe053b9494ec89a1f31
treec7f827cb68d2e0f131c02b6053d2290b6cb40a03
parente1aad7a592e568a9471213ef9fe885608ad52941
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

update to zig 0.15.2


2 files changed, 21 insertions(+), 21 deletions(-)

README.md+1-1
...@@ -3,7 +3,7 @@...@@ -3,7 +3,7 @@
3![loc](https://sloc.xyz/github/nektro/zig-qrcode)3![loc](https://sloc.xyz/github/nektro/zig-qrcode)
4[![license](https://img.shields.io/github/license/nektro/zig-qrcode.svg)](https://github.com/nektro/zig-qrcode/blob/master/LICENSE)4[![license](https://img.shields.io/github/license/nektro/zig-qrcode.svg)](https://github.com/nektro/zig-qrcode/blob/master/LICENSE)
5[![nektro @ github sponsors](https://img.shields.io/badge/sponsors-nektro-purple?logo=github)](https://github.com/sponsors/nektro)5[![nektro @ github sponsors](https://img.shields.io/badge/sponsors-nektro-purple?logo=github)](https://github.com/sponsors/nektro)
6[![Zig](https://img.shields.io/badge/Zig-0.14-f7a41d)](https://ziglang.org/)6[![Zig](https://img.shields.io/badge/Zig-0.15-f7a41d)](https://ziglang.org/)
7[![Zigmod](https://img.shields.io/badge/Zigmod-latest-f7a41d)](https://github.com/nektro/zigmod)7[![Zigmod](https://img.shields.io/badge/Zigmod-latest-f7a41d)](https://github.com/nektro/zigmod)
88
9Zig library for quick-response (QR) codes9Zig library for quick-response (QR) codes
qrcode.zig+20-20
...@@ -486,7 +486,7 @@ fn BitGrid(comptime size: usize) type {...@@ -486,7 +486,7 @@ fn BitGrid(comptime size: usize) type {
486 }486 }
487487
488 pub fn asBlockString(grid: *const @This(), allocator: std.mem.Allocator) ![]u8 {488 pub fn asBlockString(grid: *const @This(), allocator: std.mem.Allocator) ![]u8 {
489 var content: std.ArrayList(u8) = .init(allocator);489 var content: std.Io.Writer.Allocating = .init(allocator);
490 errdefer content.deinit();490 errdefer content.deinit();
491 for (0..grid.size / 2 + 1) |y| {491 for (0..grid.size / 2 + 1) |y| {
492 for (0..grid.size / 2 + 1) |x| {492 for (0..grid.size / 2 + 1) |x| {
...@@ -503,16 +503,16 @@ fn BitGrid(comptime size: usize) type {...@@ -503,16 +503,16 @@ fn BitGrid(comptime size: usize) type {
503 }503 }
504 }504 }
505 const characters = [_][]const u8{ " ", "▘", "▖", "▌", "▝", "▀", "▞", "▛", "▗", "▚", "▄", "▙", "▐", "▜", "▟", "█" };505 const characters = [_][]const u8{ " ", "▘", "▖", "▌", "▝", "▀", "▞", "▛", "▗", "▚", "▄", "▙", "▐", "▜", "▟", "█" };
506 try content.appendSlice(characters[(idx.mask)]);506 try content.writer.writeAll(characters[(idx.mask)]);
507 }507 }
508 if (builtin.is_test) try content.appendSlice("|");508 if (builtin.is_test) try content.writer.writeAll("|");
509 try content.appendSlice("\n");509 try content.writer.writeAll("\n");
510 }510 }
511 return content.toOwnedSlice();511 return content.toOwnedSlice();
512 }512 }
513513
514 pub fn asBlockString2(grid: *const @This(), allocator: std.mem.Allocator) ![]u8 {514 pub fn asBlockString2(grid: *const @This(), allocator: std.mem.Allocator) ![]u8 {
515 var content: std.ArrayList(u8) = .init(allocator);515 var content: std.Io.Writer.Allocating = .init(allocator);
516 errdefer content.deinit();516 errdefer content.deinit();
517 for (0..grid.size / 2 + 1) |y| {517 for (0..grid.size / 2 + 1) |y| {
518 for (0..grid.size) |x| {518 for (0..grid.size) |x| {
...@@ -527,17 +527,17 @@ fn BitGrid(comptime size: usize) type {...@@ -527,17 +527,17 @@ fn BitGrid(comptime size: usize) type {
527 idx.set(y2);527 idx.set(y2);
528 }528 }
529 const characters = [_][]const u8{ " ", "▀", "▄", "█" };529 const characters = [_][]const u8{ " ", "▀", "▄", "█" };
530 try content.appendSlice(characters[(idx.mask)]);530 try content.writer.writeAll(characters[(idx.mask)]);
531 }531 }
532 if (builtin.is_test) try content.appendSlice("|");532 if (builtin.is_test) try content.writer.writeAll("|");
533 try content.appendSlice("\n");533 try content.writer.writeAll("\n");
534 }534 }
535 return content.toOwnedSlice();535 return content.toOwnedSlice();
536 }536 }
537537
538 pub fn asBrailleString(grid: *const @This(), allocator: std.mem.Allocator) ![]u8 {538 pub fn asBrailleString(grid: *const @This(), allocator: std.mem.Allocator) ![]u8 {
539 const B = packed struct(u8) { @"0": bool, @"1": bool, @"2": bool, @"3": bool, @"4": bool, @"5": bool, @"6": bool, @"7": bool };539 const B = packed struct(u8) { @"0": bool, @"1": bool, @"2": bool, @"3": bool, @"4": bool, @"5": bool, @"6": bool, @"7": bool };
540 var content: std.ArrayList(u8) = .init(allocator);540 var content: std.Io.Writer.Allocating = .init(allocator);
541 errdefer content.deinit();541 errdefer content.deinit();
542 for (0..grid.size / 4 + 1) |y| {542 for (0..grid.size / 4 + 1) |y| {
543 for (0..grid.size / 2 + 1) |x| {543 for (0..grid.size / 2 + 1) |x| {
...@@ -557,23 +557,23 @@ fn BitGrid(comptime size: usize) type {...@@ -557,23 +557,23 @@ fn BitGrid(comptime size: usize) type {
557 cp += @as(u8, @bitCast(b));557 cp += @as(u8, @bitCast(b));
558 var buf: [3]u8 = undefined;558 var buf: [3]u8 = undefined;
559 _ = std.unicode.utf8Encode(cp, &buf) catch unreachable;559 _ = std.unicode.utf8Encode(cp, &buf) catch unreachable;
560 try content.appendSlice(&buf);560 try content.writer.writeAll(&buf);
561 }561 }
562 if (builtin.is_test) try content.appendSlice("|");562 if (builtin.is_test) try content.writer.writeAll("|");
563 try content.appendSlice("\n");563 try content.writer.writeAll("\n");
564 }564 }
565 return content.toOwnedSlice();565 return content.toOwnedSlice();
566 }566 }
567567
568 pub fn asSvg(grid: *const @This(), allocator: std.mem.Allocator) ![]u8 {568 pub fn asSvg(grid: *const @This(), allocator: std.mem.Allocator) ![]u8 {
569 var content: std.ArrayList(u8) = .init(allocator);569 var content: std.Io.Writer.Allocating = .init(allocator);
570 errdefer content.deinit();570 errdefer content.deinit();
571 try content.writer().print("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"{d}0\" height=\"{d}0\" viewBox=\"-1 -1 {d} {d}\" shape-rendering=\"crispEdges\" stroke=\"#000\">\n", .{ size + 2, size + 1, size + 2, size + 1 });571 try content.writer.print("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"{d}0\" height=\"{d}0\" viewBox=\"-1 -1 {d} {d}\" shape-rendering=\"crispEdges\" stroke=\"#000\">\n", .{ size + 2, size + 1, size + 2, size + 1 });
572 try content.writer().print("<rect x=\"-1\" y=\"-1\" width=\"{d}\" height=\"{d}\" fill=\"#fff\" stroke=\"none\" />\n", .{ size + 2, size + 1 });572 try content.writer.print("<rect x=\"-1\" y=\"-1\" width=\"{d}\" height=\"{d}\" fill=\"#fff\" stroke=\"none\" />\n", .{ size + 2, size + 1 });
573 var prev = false;573 var prev = false;
574 var run: u16 = 0;574 var run: u16 = 0;
575 for (0..size) |y| {575 for (0..size) |y| {
576 try content.appendSlice("<path d=\"");576 try content.writer.writeAll("<path d=\"");
577 for (0..size) |x| {577 for (0..size) |x| {
578 if (x == 0) {578 if (x == 0) {
579 run = 0;579 run = 0;
...@@ -584,7 +584,7 @@ fn BitGrid(comptime size: usize) type {...@@ -584,7 +584,7 @@ fn BitGrid(comptime size: usize) type {
584 run += 1;584 run += 1;
585 } else {585 } else {
586 if (prev) {586 if (prev) {
587 try content.writer().print("M{d},{d} h{d} ", .{ x - run, y, run });587 try content.writer.print("M{d},{d} h{d} ", .{ x - run, y, run });
588 }588 }
589 run = 1;589 run = 1;
590 }590 }
...@@ -592,11 +592,11 @@ fn BitGrid(comptime size: usize) type {...@@ -592,11 +592,11 @@ fn BitGrid(comptime size: usize) type {
592 }592 }
593 if (grid.isSet(size - 1, y)) {593 if (grid.isSet(size - 1, y)) {
594 const x = size;594 const x = size;
595 try content.writer().print("M{d},{d} h{d}", .{ x - run, y, run });595 try content.writer.print("M{d},{d} h{d}", .{ x - run, y, run });
596 }596 }
597 try content.appendSlice("\" />\n");597 try content.writer.writeAll("\" />\n");
598 }598 }
599 try content.appendSlice("</svg>\n");599 try content.writer.writeAll("</svg>\n");
600 return content.toOwnedSlice();600 return content.toOwnedSlice();
601 }601 }
602 };602 };