| 1 | Patch-Source: https://github.com/kilobyte/termrec/commit/8c594d7caf3f3fc706a93746ac31e3f90bbfadcf
|
| 2 | From 8c594d7caf3f3fc706a93746ac31e3f90bbfadcf Mon Sep 17 00:00:00 2001
|
| 3 | From: Adam Borowski <[email protected]>
|
| 4 | Date: Mon, 1 Sep 2025 23:12:24 +0200
|
| 5 | Subject: [PATCH] Fix asciicast failing on some 32-bit archs with 64-bit
|
| 6 | time_t.
|
| 7 |
|
| 8 | ---
|
| 9 | libtty/asciicast.c | 2 +-
|
| 10 | tests/vt.c | 2 +-
|
| 11 | 2 files changed, 2 insertions(+), 2 deletions(-)
|
| 12 |
|
| 13 | diff --git a/libtty/asciicast.c b/libtty/asciicast.c
|
| 14 | index 7f062c7..c12449d 100644
|
| 15 | |
| 16 | |
| 17 | @@ -487,7 +487,7 @@ void record_asciicast(FILE *f, void* state, const struct timeval *tm, const char
|
| 18 | fprintf(f, "{\"version\":%d, \"width\":%d, \"height\":%d",
|
| 19 | as->version, vt->sx, vt->sy);
|
| 20 | if (as->ts.tv_sec)
|
| 21 | - fprintf(f, ", \"timestamp\":%ld", as->ts.tv_sec);
|
| 22 | + fprintf(f, ", \"timestamp\":%lld", (long long int)as->ts.tv_sec);
|
| 23 | if (as->version == 1)
|
| 24 | fprintf(f, ", \"stdout\":[\n");
|
| 25 | else
|
| 26 | diff --git a/tests/vt.c b/tests/vt.c
|
| 27 | index 439e177..5e97a0a 100644
|
| 28 | |
| 29 | |
| 30 | @@ -4,6 +4,7 @@
|
| 31 | #include <unistd.h>
|
| 32 | #include <stdlib.h>
|
| 33 | #include <stdbool.h>
|
| 34 | +#include <inttypes.h>
|
| 35 | #include "tty.h"
|
| 36 | #include "wcwidth.h"
|
| 37 |
|
| 38 | @@ -50,7 +50,7 @@ static const char* describe_attr(uint64_t attr)
|
| 39 | b+=sprintf(b, " bg="), b+=describe_color(b, attr>>32);
|
| 40 | #define INVALID_ATTRS 0x7000000080000000
|
| 41 | if (attr & INVALID_ATTRS)
|
| 42 | - b+=sprintf(b, "bad_attr:%lx", attr & INVALID_ATTRS);
|
| 43 | + b+=sprintf(b, "bad_attr:%"PRIx64, attr & INVALID_ATTRS);
|
| 44 |
|
| 45 | return *buf? buf+1 : buf;
|
| 46 | }
|