mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-28 05:20:28 +00:00
Apply clang-format update to repo (#1154)
Commit bc6c183
introduced a bunch of discrepancies between what files
look like in the repo and what clang-format says they should look like.
However, there were already a few discrepancies prior to that. Most of
these discrepancies seemed to be unintentional, but a few of them were
load-bearing (e.g., a #include that violated header ordering needing
something to have been #defined by a 'later' #include.)
I opted to take what I hope is a relatively smooth-brained approach: I
reverted the .clang-format change, ran clang-format on the whole repo,
reapplied the .clang-format change, reran clang-format again, and then
reverted the commit that contained the first run. Thus the full effect
of this PR should only be to apply the changed formatting rules to the
repo, and from skimming the results, this seems to be the case.
My work can be checked by applying the short, manual commits, and then
rerunning the command listed in the autogenerated commits (those whose
messages I have prefixed auto:) and seeing if your results agree.
It might be that the other diffs should be fixed at some point but I'm
leaving that aside for now.
fd '\.c(c|pp)?$' --print0| xargs -0 clang-format -i
This commit is contained in:
parent
342d0c81e5
commit
6e6fc38935
863 changed files with 9201 additions and 4627 deletions
|
@ -61,9 +61,11 @@ const wint_t kCombiningLowLine = L'\u0332';
|
|||
const wint_t kCombiningDoubleMacronBelow = L'\u035f';
|
||||
|
||||
forceinline int PutChar(wint_t (*buf)[3], size_t *i, wint_t *cc, FILE *out) {
|
||||
if (fputwc((*buf)[0], out) == -1) return -1;
|
||||
if (fputwc((*buf)[0], out) == -1)
|
||||
return -1;
|
||||
if (*cc != -1) {
|
||||
if (fputwc(*cc, out) == -1) return -1;
|
||||
if (fputwc(*cc, out) == -1)
|
||||
return -1;
|
||||
*cc = -1;
|
||||
}
|
||||
(*buf)[0] = (*buf)[1];
|
||||
|
@ -77,7 +79,8 @@ int CombineAsciiMarks(FILE *in, FILE *out) {
|
|||
size_t i = 0;
|
||||
for (;;) {
|
||||
while (i < 3) {
|
||||
if ((wc = fgetwc(in)) == -1) goto InputBreak;
|
||||
if ((wc = fgetwc(in)) == -1)
|
||||
goto InputBreak;
|
||||
buf[i++] = wc;
|
||||
}
|
||||
if (buf[1] == '\b' && cc == -1) {
|
||||
|
@ -104,12 +107,14 @@ int CombineAsciiMarks(FILE *in, FILE *out) {
|
|||
}
|
||||
}
|
||||
if (i == 3) {
|
||||
if (PutChar(&buf, &i, &cc, out) == -1) goto OutputBreak;
|
||||
if (PutChar(&buf, &i, &cc, out) == -1)
|
||||
goto OutputBreak;
|
||||
}
|
||||
}
|
||||
InputBreak:
|
||||
while (i) {
|
||||
if (PutChar(&buf, &i, &cc, out) == -1) goto OutputBreak;
|
||||
if (PutChar(&buf, &i, &cc, out) == -1)
|
||||
goto OutputBreak;
|
||||
}
|
||||
OutputBreak:
|
||||
return (fclose(in) | fclose(out)) != -1 ? 0 : -1;
|
||||
|
|
|
@ -37,9 +37,10 @@
|
|||
|
||||
#define SQR(X) ((X) * (X))
|
||||
#define UNCUBE(x) x < 48 ? 0 : x < 115 ? 1 : (x - 35) / 40
|
||||
#define ORDIE(X) \
|
||||
do { \
|
||||
if (!(X)) perror(#X), exit(1); \
|
||||
#define ORDIE(X) \
|
||||
do { \
|
||||
if (!(X)) \
|
||||
perror(#X), exit(1); \
|
||||
} while (0)
|
||||
|
||||
int want24bit_;
|
||||
|
|
|
@ -58,10 +58,12 @@ int main(int argc, char *argv[]) {
|
|||
return 1;
|
||||
}
|
||||
for (b = o = 0;;) {
|
||||
if (!(n = fread(R, 1, 16, f))) break;
|
||||
if (!(n = fread(R, 1, 16, f)))
|
||||
break;
|
||||
p = A, q = B;
|
||||
for (c = i = 0; i < n; ++i) {
|
||||
if (i == 8) *p++ = ' ';
|
||||
if (i == 8)
|
||||
*p++ = ' ';
|
||||
*p++ = "0123456789abcdef"[(R[i] & 0xF0) >> 4];
|
||||
*p++ = "0123456789abcdef"[(R[i] & 0x0F) >> 0];
|
||||
*p++ = ' ';
|
||||
|
@ -77,6 +79,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
o += n;
|
||||
}
|
||||
if (o) printf("%08x\n", o);
|
||||
if (o)
|
||||
printf("%08x\n", o);
|
||||
return !feof(f);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,8 @@ int main(int argc, char *argv[]) {
|
|||
bzero(glyphs, sizeof(glyphs));
|
||||
}
|
||||
glyphs[col] = kCp437[c];
|
||||
if (col) putchar(',');
|
||||
if (col)
|
||||
putchar(',');
|
||||
printf("0x%02x", c);
|
||||
if (++col == COLS) {
|
||||
col = 0;
|
||||
|
|
|
@ -102,9 +102,12 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
if (KCPUIDS(16H, EAX)) {
|
||||
printf("\n");
|
||||
if ((x = KCPUIDS(16H, EAX) & 0x7fff)) decimal("frequency", x, "mhz");
|
||||
if ((x = KCPUIDS(16H, EBX) & 0x7fff)) decimal("turbo", x, "mhz");
|
||||
if ((x = KCPUIDS(16H, ECX) & 0x7fff)) decimal("bus", x, "mhz");
|
||||
if ((x = KCPUIDS(16H, EAX) & 0x7fff))
|
||||
decimal("frequency", x, "mhz");
|
||||
if ((x = KCPUIDS(16H, EBX) & 0x7fff))
|
||||
decimal("turbo", x, "mhz");
|
||||
if ((x = KCPUIDS(16H, ECX) & 0x7fff))
|
||||
decimal("bus", x, "mhz");
|
||||
}
|
||||
|
||||
if (X86_HAVE(HYPERVISOR)) {
|
||||
|
|
|
@ -36,7 +36,8 @@ void PrintUsage(int rc, FILE *f) {
|
|||
void PrintUri(const char *path) {
|
||||
size_t n;
|
||||
void *img;
|
||||
if (!(img = gc(xslurp(path, &n)))) exit(2);
|
||||
if (!(img = gc(xslurp(path, &n))))
|
||||
exit(2);
|
||||
fputs("data:", stdout);
|
||||
fputs(FindContentType(path, -1), stdout);
|
||||
fputs(";base64,", stdout);
|
||||
|
|
|
@ -136,7 +136,8 @@ extern const char16_t kRunes[];
|
|||
*/
|
||||
static char *tptoa(char *p, wchar_t x) {
|
||||
unsigned long w;
|
||||
for (w = tpenc(x); w; w >>= 010) *p++ = w & 0xff;
|
||||
for (w = tpenc(x); w; w >>= 010)
|
||||
*p++ = w & 0xff;
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -163,8 +164,10 @@ static float frgb2std(float x) {
|
|||
*/
|
||||
static void rgb2float(unsigned n, float *f, const unsigned char *u) {
|
||||
unsigned i;
|
||||
for (i = 0; i < n; ++i) f[i] = u[i];
|
||||
for (i = 0; i < n; ++i) f[i] /= 255;
|
||||
for (i = 0; i < n; ++i)
|
||||
f[i] = u[i];
|
||||
for (i = 0; i < n; ++i)
|
||||
f[i] /= 255;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -172,9 +175,12 @@ static void rgb2float(unsigned n, float *f, const unsigned char *u) {
|
|||
*/
|
||||
static void float2rgb(unsigned n, unsigned char *u, float *f) {
|
||||
unsigned i;
|
||||
for (i = 0; i < n; ++i) f[i] *= 256;
|
||||
for (i = 0; i < n; ++i) f[i] = roundf(f[i]);
|
||||
for (i = 0; i < n; ++i) u[i] = MAX(0, MIN(255, f[i]));
|
||||
for (i = 0; i < n; ++i)
|
||||
f[i] *= 256;
|
||||
for (i = 0; i < n; ++i)
|
||||
f[i] = roundf(f[i]);
|
||||
for (i = 0; i < n; ++i)
|
||||
u[i] = MAX(0, MIN(255, f[i]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,7 +192,8 @@ static void float2rgb(unsigned n, unsigned char *u, float *f) {
|
|||
static dontinline void rgb2lin(unsigned n, float *f, const unsigned char *u) {
|
||||
unsigned i;
|
||||
rgb2float(n, f, u);
|
||||
for (i = 0; i < n; ++i) f[i] = frgb2lin(f[i]);
|
||||
for (i = 0; i < n; ++i)
|
||||
f[i] = frgb2lin(f[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -194,7 +201,8 @@ static dontinline void rgb2lin(unsigned n, float *f, const unsigned char *u) {
|
|||
*/
|
||||
static dontinline void rgb2std(unsigned n, unsigned char *u, float *f) {
|
||||
unsigned i;
|
||||
for (i = 0; i < n; ++i) f[i] = frgb2std(f[i]);
|
||||
for (i = 0; i < n; ++i)
|
||||
f[i] = frgb2std(f[i]);
|
||||
float2rgb(n, u, f);
|
||||
}
|
||||
|
||||
|
@ -288,25 +296,31 @@ static unsigned combinecolors(unsigned char bf[1u << MC][2],
|
|||
/**
|
||||
* Computes distance between synthetic block and actual.
|
||||
*/
|
||||
#define ADJUDICATE(SYMBOL, ARCH) \
|
||||
ARCH static float SYMBOL(unsigned b, unsigned f, unsigned g, \
|
||||
const float lb[CN][YS * XS]) { \
|
||||
unsigned i, k, gu; \
|
||||
float p[BN], q[BN], fu, bu, r; \
|
||||
bzero(q, sizeof(q)); \
|
||||
for (k = 0; k < CN; ++k) { \
|
||||
gu = kGlyphs[g]; \
|
||||
bu = lb[k][b]; \
|
||||
fu = lb[k][f]; \
|
||||
for (i = 0; i < BN; ++i) p[i] = (gu & (1u << i)) ? fu : bu; \
|
||||
for (i = 0; i < BN; ++i) p[i] -= lb[k][i]; \
|
||||
for (i = 0; i < BN; ++i) p[i] *= p[i]; \
|
||||
for (i = 0; i < BN; ++i) q[i] += p[i]; \
|
||||
} \
|
||||
r = 0; \
|
||||
for (i = 0; i < BN; ++i) q[i] = sqrtf(q[i]); \
|
||||
for (i = 0; i < BN; ++i) r += q[i]; \
|
||||
return r; \
|
||||
#define ADJUDICATE(SYMBOL, ARCH) \
|
||||
ARCH static float SYMBOL(unsigned b, unsigned f, unsigned g, \
|
||||
const float lb[CN][YS * XS]) { \
|
||||
unsigned i, k, gu; \
|
||||
float p[BN], q[BN], fu, bu, r; \
|
||||
bzero(q, sizeof(q)); \
|
||||
for (k = 0; k < CN; ++k) { \
|
||||
gu = kGlyphs[g]; \
|
||||
bu = lb[k][b]; \
|
||||
fu = lb[k][f]; \
|
||||
for (i = 0; i < BN; ++i) \
|
||||
p[i] = (gu & (1u << i)) ? fu : bu; \
|
||||
for (i = 0; i < BN; ++i) \
|
||||
p[i] -= lb[k][i]; \
|
||||
for (i = 0; i < BN; ++i) \
|
||||
p[i] *= p[i]; \
|
||||
for (i = 0; i < BN; ++i) \
|
||||
q[i] += p[i]; \
|
||||
} \
|
||||
r = 0; \
|
||||
for (i = 0; i < BN; ++i) \
|
||||
q[i] = sqrtf(q[i]); \
|
||||
for (i = 0; i < BN; ++i) \
|
||||
r += q[i]; \
|
||||
return r; \
|
||||
}
|
||||
|
||||
ADJUDICATE(adjudicate_avx2, _Microarchitecture("avx2,fma"))
|
||||
|
@ -339,14 +353,20 @@ static float adjudicate(unsigned b, unsigned f, unsigned g,
|
|||
gu = kGlyphs[g];
|
||||
bu = lb[k][b];
|
||||
fu = lb[k][f];
|
||||
for (i = 0; i < BN; ++i) p[i] = (gu & (1u << i)) ? fu : bu;
|
||||
for (i = 0; i < BN; ++i) p[i] -= lb[k][i];
|
||||
for (i = 0; i < BN; ++i) p[i] *= p[i];
|
||||
for (i = 0; i < BN; ++i) q[i] += p[i];
|
||||
for (i = 0; i < BN; ++i)
|
||||
p[i] = (gu & (1u << i)) ? fu : bu;
|
||||
for (i = 0; i < BN; ++i)
|
||||
p[i] -= lb[k][i];
|
||||
for (i = 0; i < BN; ++i)
|
||||
p[i] *= p[i];
|
||||
for (i = 0; i < BN; ++i)
|
||||
q[i] += p[i];
|
||||
}
|
||||
r = 0;
|
||||
for (i = 0; i < BN; ++i) q[i] = sqrtf(q[i]);
|
||||
for (i = 0; i < BN; ++i) r += q[i];
|
||||
for (i = 0; i < BN; ++i)
|
||||
q[i] = sqrtf(q[i]);
|
||||
for (i = 0; i < BN; ++i)
|
||||
r += q[i];
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -376,7 +396,8 @@ static struct Cell derasterize(unsigned char block[CN][YS * XS]) {
|
|||
cell.fg[0] = block[0][f];
|
||||
cell.fg[1] = block[1][f];
|
||||
cell.fg[2] = block[2][f];
|
||||
if (!r) return cell;
|
||||
if (!r)
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -464,7 +485,8 @@ static int ReadAll(int fd, void *data, size_t size) {
|
|||
p = data;
|
||||
n = size;
|
||||
do {
|
||||
if ((rc = read(fd, p, n)) == -1) return -1;
|
||||
if ((rc = read(fd, p, n)) == -1)
|
||||
return -1;
|
||||
got = rc;
|
||||
assert(got || !n);
|
||||
p += got;
|
||||
|
@ -605,7 +627,8 @@ int main(int argc, char *argv[]) {
|
|||
size = y_ * YS * x_ * XS * CN;
|
||||
CHECK_NOTNULL((rgb = _mapanon(ROUNDUP(size, FRAMESIZE))));
|
||||
for (i = optind; i < argc; ++i) {
|
||||
if (!argv[i]) continue;
|
||||
if (!argv[i])
|
||||
continue;
|
||||
if (m_) {
|
||||
LoadFileViaImageMagick(argv[i], y_, x_, rgb);
|
||||
} else {
|
||||
|
|
|
@ -59,7 +59,8 @@ static char *Raster(int yn, int xn, unsigned char Y[yn][xn], int *dw) {
|
|||
int y, x, i, j, k, s, w, bi, bs;
|
||||
*dw = 0;
|
||||
for (y = 0; y < yn; y += 4) {
|
||||
if (y) appendw(&r, '\n');
|
||||
if (y)
|
||||
appendw(&r, '\n');
|
||||
for (w = x = 0; x < xn; x += 4) {
|
||||
for (i = 0; i < 4; ++i) {
|
||||
for (j = 0; j < 4; ++j) {
|
||||
|
@ -87,7 +88,8 @@ static char *Raster(int yn, int xn, unsigned char Y[yn][xn], int *dw) {
|
|||
appendw(&r, tpenc(kBlocks[bi].c));
|
||||
++w;
|
||||
}
|
||||
if (w > *dw) *dw = w;
|
||||
if (w > *dw)
|
||||
*dw = w;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
@ -171,7 +173,8 @@ int main(int argc, char *argv[]) {
|
|||
strcmp(rasters[j], rasters[j - 1])) {
|
||||
isdifferent = true;
|
||||
}
|
||||
if (dw > maxw) maxw = dw;
|
||||
if (dw > maxw)
|
||||
maxw = dw;
|
||||
}
|
||||
}
|
||||
free(bmap);
|
||||
|
@ -189,7 +192,8 @@ int main(int argc, char *argv[]) {
|
|||
continue;
|
||||
}
|
||||
p = strchrnul(rasters[j], '\n');
|
||||
if (p - rasters[j]) gotsome = true;
|
||||
if (p - rasters[j])
|
||||
gotsome = true;
|
||||
printf("%-*.*s ", maxw, p - rasters[j], rasters[j]);
|
||||
rasters[j] = *p ? p + 1 : p;
|
||||
}
|
||||
|
|
153
tool/viz/hwcap.c
153
tool/viz/hwcap.c
|
@ -26,60 +26,111 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
long x = getauxval(AT_HWCAP);
|
||||
|
||||
if (x & HWCAP_FP) puts("HWCAP_FP");
|
||||
if (x & HWCAP_ASIMD) puts("HWCAP_ASIMD");
|
||||
if (x & HWCAP_EVTSTRM) puts("HWCAP_EVTSTRM");
|
||||
if (x & HWCAP_AES) puts("HWCAP_AES");
|
||||
if (x & HWCAP_PMULL) puts("HWCAP_PMULL");
|
||||
if (x & HWCAP_SHA1) puts("HWCAP_SHA1");
|
||||
if (x & HWCAP_SHA2) puts("HWCAP_SHA2");
|
||||
if (x & HWCAP_CRC32) puts("HWCAP_CRC32");
|
||||
if (x & HWCAP_ATOMICS) puts("HWCAP_ATOMICS");
|
||||
if (x & HWCAP_FPHP) puts("HWCAP_FPHP");
|
||||
if (x & HWCAP_ASIMDHP) puts("HWCAP_ASIMDHP");
|
||||
if (x & HWCAP_CPUID) puts("HWCAP_CPUID");
|
||||
if (x & HWCAP_ASIMDRDM) puts("HWCAP_ASIMDRDM");
|
||||
if (x & HWCAP_JSCVT) puts("HWCAP_JSCVT");
|
||||
if (x & HWCAP_FCMA) puts("HWCAP_FCMA");
|
||||
if (x & HWCAP_LRCPC) puts("HWCAP_LRCPC");
|
||||
if (x & HWCAP_DCPOP) puts("HWCAP_DCPOP");
|
||||
if (x & HWCAP_SHA3) puts("HWCAP_SHA3");
|
||||
if (x & HWCAP_SM3) puts("HWCAP_SM3");
|
||||
if (x & HWCAP_SM4) puts("HWCAP_SM4");
|
||||
if (x & HWCAP_ASIMDDP) puts("HWCAP_ASIMDDP");
|
||||
if (x & HWCAP_SHA512) puts("HWCAP_SHA512");
|
||||
if (x & HWCAP_SVE) puts("HWCAP_SVE");
|
||||
if (x & HWCAP_ASIMDFHM) puts("HWCAP_ASIMDFHM");
|
||||
if (x & HWCAP_DIT) puts("HWCAP_DIT");
|
||||
if (x & HWCAP_USCAT) puts("HWCAP_USCAT");
|
||||
if (x & HWCAP_ILRCPC) puts("HWCAP_ILRCPC");
|
||||
if (x & HWCAP_FLAGM) puts("HWCAP_FLAGM");
|
||||
if (x & HWCAP_SSBS) puts("HWCAP_SSBS");
|
||||
if (x & HWCAP_SB) puts("HWCAP_SB");
|
||||
if (x & HWCAP_PACA) puts("HWCAP_PACA");
|
||||
if (x & HWCAP_PACG) puts("HWCAP_PACG");
|
||||
if (x & HWCAP_FP)
|
||||
puts("HWCAP_FP");
|
||||
if (x & HWCAP_ASIMD)
|
||||
puts("HWCAP_ASIMD");
|
||||
if (x & HWCAP_EVTSTRM)
|
||||
puts("HWCAP_EVTSTRM");
|
||||
if (x & HWCAP_AES)
|
||||
puts("HWCAP_AES");
|
||||
if (x & HWCAP_PMULL)
|
||||
puts("HWCAP_PMULL");
|
||||
if (x & HWCAP_SHA1)
|
||||
puts("HWCAP_SHA1");
|
||||
if (x & HWCAP_SHA2)
|
||||
puts("HWCAP_SHA2");
|
||||
if (x & HWCAP_CRC32)
|
||||
puts("HWCAP_CRC32");
|
||||
if (x & HWCAP_ATOMICS)
|
||||
puts("HWCAP_ATOMICS");
|
||||
if (x & HWCAP_FPHP)
|
||||
puts("HWCAP_FPHP");
|
||||
if (x & HWCAP_ASIMDHP)
|
||||
puts("HWCAP_ASIMDHP");
|
||||
if (x & HWCAP_CPUID)
|
||||
puts("HWCAP_CPUID");
|
||||
if (x & HWCAP_ASIMDRDM)
|
||||
puts("HWCAP_ASIMDRDM");
|
||||
if (x & HWCAP_JSCVT)
|
||||
puts("HWCAP_JSCVT");
|
||||
if (x & HWCAP_FCMA)
|
||||
puts("HWCAP_FCMA");
|
||||
if (x & HWCAP_LRCPC)
|
||||
puts("HWCAP_LRCPC");
|
||||
if (x & HWCAP_DCPOP)
|
||||
puts("HWCAP_DCPOP");
|
||||
if (x & HWCAP_SHA3)
|
||||
puts("HWCAP_SHA3");
|
||||
if (x & HWCAP_SM3)
|
||||
puts("HWCAP_SM3");
|
||||
if (x & HWCAP_SM4)
|
||||
puts("HWCAP_SM4");
|
||||
if (x & HWCAP_ASIMDDP)
|
||||
puts("HWCAP_ASIMDDP");
|
||||
if (x & HWCAP_SHA512)
|
||||
puts("HWCAP_SHA512");
|
||||
if (x & HWCAP_SVE)
|
||||
puts("HWCAP_SVE");
|
||||
if (x & HWCAP_ASIMDFHM)
|
||||
puts("HWCAP_ASIMDFHM");
|
||||
if (x & HWCAP_DIT)
|
||||
puts("HWCAP_DIT");
|
||||
if (x & HWCAP_USCAT)
|
||||
puts("HWCAP_USCAT");
|
||||
if (x & HWCAP_ILRCPC)
|
||||
puts("HWCAP_ILRCPC");
|
||||
if (x & HWCAP_FLAGM)
|
||||
puts("HWCAP_FLAGM");
|
||||
if (x & HWCAP_SSBS)
|
||||
puts("HWCAP_SSBS");
|
||||
if (x & HWCAP_SB)
|
||||
puts("HWCAP_SB");
|
||||
if (x & HWCAP_PACA)
|
||||
puts("HWCAP_PACA");
|
||||
if (x & HWCAP_PACG)
|
||||
puts("HWCAP_PACG");
|
||||
|
||||
x = getauxval(AT_HWCAP2);
|
||||
|
||||
if (x & HWCAP2_DCPODP) puts("HWCAP2_DCPODP");
|
||||
if (x & HWCAP2_SVE2) puts("HWCAP2_SVE2");
|
||||
if (x & HWCAP2_SVEAES) puts("HWCAP2_SVEAES");
|
||||
if (x & HWCAP2_SVEPMULL) puts("HWCAP2_SVEPMULL");
|
||||
if (x & HWCAP2_SVEBITPERM) puts("HWCAP2_SVEBITPERM");
|
||||
if (x & HWCAP2_SVESHA3) puts("HWCAP2_SVESHA3");
|
||||
if (x & HWCAP2_SVESM4) puts("HWCAP2_SVESM4");
|
||||
if (x & HWCAP2_FLAGM2) puts("HWCAP2_FLAGM2");
|
||||
if (x & HWCAP2_FRINT) puts("HWCAP2_FRINT");
|
||||
if (x & HWCAP2_SVEI8MM) puts("HWCAP2_SVEI8MM");
|
||||
if (x & HWCAP2_SVEF32MM) puts("HWCAP2_SVEF32MM");
|
||||
if (x & HWCAP2_SVEF64MM) puts("HWCAP2_SVEF64MM");
|
||||
if (x & HWCAP2_SVEBF16) puts("HWCAP2_SVEBF16");
|
||||
if (x & HWCAP2_I8MM) puts("HWCAP2_I8MM");
|
||||
if (x & HWCAP2_BF16) puts("HWCAP2_BF16");
|
||||
if (x & HWCAP2_DGH) puts("HWCAP2_DGH");
|
||||
if (x & HWCAP2_RNG) puts("HWCAP2_RNG");
|
||||
if (x & HWCAP2_BTI) puts("HWCAP2_BTI");
|
||||
if (x & HWCAP2_MTE) puts("HWCAP2_MTE");
|
||||
if (x & HWCAP2_DCPODP)
|
||||
puts("HWCAP2_DCPODP");
|
||||
if (x & HWCAP2_SVE2)
|
||||
puts("HWCAP2_SVE2");
|
||||
if (x & HWCAP2_SVEAES)
|
||||
puts("HWCAP2_SVEAES");
|
||||
if (x & HWCAP2_SVEPMULL)
|
||||
puts("HWCAP2_SVEPMULL");
|
||||
if (x & HWCAP2_SVEBITPERM)
|
||||
puts("HWCAP2_SVEBITPERM");
|
||||
if (x & HWCAP2_SVESHA3)
|
||||
puts("HWCAP2_SVESHA3");
|
||||
if (x & HWCAP2_SVESM4)
|
||||
puts("HWCAP2_SVESM4");
|
||||
if (x & HWCAP2_FLAGM2)
|
||||
puts("HWCAP2_FLAGM2");
|
||||
if (x & HWCAP2_FRINT)
|
||||
puts("HWCAP2_FRINT");
|
||||
if (x & HWCAP2_SVEI8MM)
|
||||
puts("HWCAP2_SVEI8MM");
|
||||
if (x & HWCAP2_SVEF32MM)
|
||||
puts("HWCAP2_SVEF32MM");
|
||||
if (x & HWCAP2_SVEF64MM)
|
||||
puts("HWCAP2_SVEF64MM");
|
||||
if (x & HWCAP2_SVEBF16)
|
||||
puts("HWCAP2_SVEBF16");
|
||||
if (x & HWCAP2_I8MM)
|
||||
puts("HWCAP2_I8MM");
|
||||
if (x & HWCAP2_BF16)
|
||||
puts("HWCAP2_BF16");
|
||||
if (x & HWCAP2_DGH)
|
||||
puts("HWCAP2_DGH");
|
||||
if (x & HWCAP2_RNG)
|
||||
puts("HWCAP2_RNG");
|
||||
if (x & HWCAP2_BTI)
|
||||
puts("HWCAP2_BTI");
|
||||
if (x & HWCAP2_MTE)
|
||||
puts("HWCAP2_MTE");
|
||||
|
||||
#endif /* __aarch64__ */
|
||||
}
|
||||
|
|
|
@ -46,8 +46,10 @@ void PrintImg(const char *path) {
|
|||
size_t n;
|
||||
int yn, xn, cn, w, h;
|
||||
void *img, *pix, *src;
|
||||
if (!(img = gc(xslurp(path, &n)))) exit(2);
|
||||
if (!(pix = gc(stbi_load_from_memory(img, n, &xn, &yn, &cn, 0)))) exit(3);
|
||||
if (!(img = gc(xslurp(path, &n))))
|
||||
exit(2);
|
||||
if (!(pix = gc(stbi_load_from_memory(img, n, &xn, &yn, &cn, 0))))
|
||||
exit(3);
|
||||
if (linktag) {
|
||||
printf("<a href=\"%s\"\n >", path);
|
||||
}
|
||||
|
@ -71,7 +73,8 @@ void PrintImg(const char *path) {
|
|||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (!NoDebug()) ShowCrashReports();
|
||||
if (!NoDebug())
|
||||
ShowCrashReports();
|
||||
int i;
|
||||
while ((i = getopt(argc, argv, "?huas01234")) != -1) {
|
||||
switch (i) {
|
||||
|
|
|
@ -31,9 +31,12 @@ unsigned *convoindex(unsigned leftpad, unsigned n, unsigned rightpad) {
|
|||
unsigned i, j, *p;
|
||||
if ((p = malloc(sizeof(unsigned) * (leftpad + n + rightpad)))) {
|
||||
i = 0;
|
||||
for (j = 0; j < leftpad; ++j) p[i++] = 0;
|
||||
for (j = 0; j < n; ++j) p[i++] = j;
|
||||
for (j = 0; j < rightpad; ++j) p[i++] = n - 1;
|
||||
for (j = 0; j < leftpad; ++j)
|
||||
p[i++] = 0;
|
||||
for (j = 0; j < n; ++j)
|
||||
p[i++] = j;
|
||||
for (j = 0; j < rightpad; ++j)
|
||||
p[i++] = n - 1;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -112,7 +112,8 @@ void *FormatStringTableAsAssembly(long yn, long xn, const char *const T[yn][xn],
|
|||
EmitSection(yn, xn, w, GetArrayAlignment(yn, xn, w, align), emit, a);
|
||||
emit(name, a);
|
||||
emit(":", a);
|
||||
if (strwidth(name, 0) >= 8) emit("\n", a);
|
||||
if (strwidth(name, 0) >= 8)
|
||||
emit("\n", a);
|
||||
FormatStringTable(yn, xn, T, emit, a, gc(xstrcat("\t.", storage, "\t")), ",",
|
||||
"\n");
|
||||
emit("\t.endobj\t", a);
|
||||
|
|
|
@ -51,8 +51,10 @@ void *FormatStringTable(long yn, long xn, const char *const T[yn][xn],
|
|||
for (y = 0; y < yn; ++y) {
|
||||
emit(startrow, a);
|
||||
for (x = 0; x < xn; ++x) {
|
||||
if (x) emit(comma, a);
|
||||
for (n = w - strwidth(T[y][x], 0), i = 0; i < n; ++i) emit(" ", a);
|
||||
if (x)
|
||||
emit(comma, a);
|
||||
for (n = w - strwidth(T[y][x], 0), i = 0; i < n; ++i)
|
||||
emit(" ", a);
|
||||
emit(T[y][x], a);
|
||||
}
|
||||
emit(endrow, a);
|
||||
|
|
|
@ -61,8 +61,10 @@ long sharpen(long cn, long yw, long xw, unsigned char p[cn][yw][xw], long yn,
|
|||
rc = enomem();
|
||||
}
|
||||
free(ta);
|
||||
if (ix) free(ix - 1);
|
||||
if (iy) free(iy - 1);
|
||||
if (ix)
|
||||
free(ix - 1);
|
||||
if (iy)
|
||||
free(iy - 1);
|
||||
} else {
|
||||
rc = einval();
|
||||
}
|
||||
|
|
|
@ -40,8 +40,10 @@ forceinline void ConvolveGradient(unsigned yn, unsigned xn,
|
|||
tmp = _mapanon((size = ROUNDUP(sizeof(float) * 4 * xn * yn, FRAMESIZE)));
|
||||
for (y = 0; y < yn - KW + 1; ++y) {
|
||||
for (x = 0; x < xn - KW + 1; ++x) {
|
||||
for (k = 0; k < 4; ++k) py[k] = 0;
|
||||
for (k = 0; k < 4; ++k) px[k] = 0;
|
||||
for (k = 0; k < 4; ++k)
|
||||
py[k] = 0;
|
||||
for (k = 0; k < 4; ++k)
|
||||
px[k] = 0;
|
||||
for (i = 0; i < KW; ++i) {
|
||||
for (j = 0; j < KW; ++j) {
|
||||
for (k = 0; k < 4; ++k) {
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
static dontinline void StringBuilderGrow(size_t need, struct StringBuilder *sb) {
|
||||
size_t n2;
|
||||
n2 = MAX(16, sb->n);
|
||||
while (sb->i + need > n2) n2 += n2 >> 1;
|
||||
while (sb->i + need > n2)
|
||||
n2 += n2 >> 1;
|
||||
sb->p = xrealloc(sb->p, n2);
|
||||
sb->n = n2;
|
||||
}
|
||||
|
@ -39,7 +40,8 @@ int StringBuilderAppend(const char *s, struct StringBuilder *sb) {
|
|||
size_t size;
|
||||
CHECK_LE(sb->i, sb->n);
|
||||
size = strlen(s);
|
||||
if (sb->i + size + 1 > sb->n) StringBuilderGrow(size + 1, sb);
|
||||
if (sb->i + size + 1 > sb->n)
|
||||
StringBuilderGrow(size + 1, sb);
|
||||
memcpy(sb->p + sb->i, s, size + 1);
|
||||
sb->i += size;
|
||||
return 0;
|
||||
|
|
|
@ -66,7 +66,9 @@ long unsharp(long cn, long yw, long xw, unsigned char img[cn][yw][xw], long yn,
|
|||
rc = enomem();
|
||||
}
|
||||
free(t);
|
||||
if (ix) free(ix - 2);
|
||||
if (iy) free(iy - 2);
|
||||
if (ix)
|
||||
free(ix - 2);
|
||||
if (iy)
|
||||
free(iy - 2);
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -27,11 +27,16 @@ void WriteToFrameBuffer(size_t dyn, size_t dxn, unsigned char dst[dyn][dxn][4],
|
|||
unsigned y, x, k, upix[4];
|
||||
for (y = 0; y < yn; ++y) {
|
||||
for (x = 0; x < xn; ++x) {
|
||||
for (k = 0; k < 4; ++k) fpix[k] = src[y][x][k];
|
||||
for (k = 0; k < 4; ++k) fpix[k] *= 255;
|
||||
for (k = 0; k < 4; ++k) ipix[k] = fpix[k] + .5f;
|
||||
for (k = 0; k < 4; ++k) upix[k] = MAX(0, ipix[k]);
|
||||
for (k = 0; k < 4; ++k) upix[k] = MIN(255, upix[k]);
|
||||
for (k = 0; k < 4; ++k)
|
||||
fpix[k] = src[y][x][k];
|
||||
for (k = 0; k < 4; ++k)
|
||||
fpix[k] *= 255;
|
||||
for (k = 0; k < 4; ++k)
|
||||
ipix[k] = fpix[k] + .5f;
|
||||
for (k = 0; k < 4; ++k)
|
||||
upix[k] = MAX(0, ipix[k]);
|
||||
for (k = 0; k < 4; ++k)
|
||||
upix[k] = MIN(255, upix[k]);
|
||||
dst[y][x][0] = upix[2];
|
||||
dst[y][x][1] = upix[1];
|
||||
dst[y][x][2] = upix[0];
|
||||
|
|
|
@ -163,7 +163,8 @@ void YCbCrComputeCoefficients(int swing, double gamma,
|
|||
void YCbCrInit(struct YCbCr **ycbcr, bool yonly, int swing, double gamma,
|
||||
const double gamut[3], const double illuminant[3]) {
|
||||
int i;
|
||||
if (!*ycbcr) *ycbcr = xcalloc(1, sizeof(struct YCbCr));
|
||||
if (!*ycbcr)
|
||||
*ycbcr = xcalloc(1, sizeof(struct YCbCr));
|
||||
(*ycbcr)->yonly = yonly;
|
||||
bzero((*ycbcr)->magnums, sizeof((*ycbcr)->magnums));
|
||||
bzero((*ycbcr)->lighting, sizeof((*ycbcr)->lighting));
|
||||
|
@ -318,8 +319,10 @@ void YCbCr2RgbScaler(struct YCbCr *me, long dyn, long dxn,
|
|||
yox, pry, prx);
|
||||
YCbCrComputeSamplingSolution(&me->chroma, dyn, dxn, scyn, scxn, cry, crx,
|
||||
coy, cox, pry, prx);
|
||||
if (pf8_) sharpen(1, yys, yxs, (void *)Y, yyn, yxn);
|
||||
if (pf9_) unsharp(1, yys, yxs, (void *)Y, yyn, yxn);
|
||||
if (pf8_)
|
||||
sharpen(1, yys, yxs, (void *)Y, yyn, yxn);
|
||||
if (pf9_)
|
||||
unsharp(1, yys, yxs, (void *)Y, yyn, yxn);
|
||||
GyaradosUint8(yys, yxs, Y, yys, yxs, Y, dyn, dxn, syn, sxn, 0, 255,
|
||||
me->luma.cy, me->luma.cx, true);
|
||||
GyaradosUint8(cys, cxs, Cb, cys, cxs, Cb, dyn, dxn, scyn, scxn, 0, 255,
|
||||
|
|
102
tool/viz/life.c
102
tool/viz/life.c
|
@ -313,7 +313,8 @@ static void AppendData(char *data, unsigned len) {
|
|||
unsigned n;
|
||||
if (buffer.i + len + 1 > buffer.n) {
|
||||
n = MAX(buffer.i + len + 1, MAX(16, buffer.n + (buffer.n >> 1)));
|
||||
if (!(p = realloc(buffer.p, n))) return;
|
||||
if (!(p = realloc(buffer.p, n)))
|
||||
return;
|
||||
buffer.p = p;
|
||||
buffer.n = n;
|
||||
}
|
||||
|
@ -393,7 +394,8 @@ static void OnTurbo(void) {
|
|||
|
||||
static void OnSlowmo(void) {
|
||||
--speed;
|
||||
if (speed < 1) speed = 1;
|
||||
if (speed < 1)
|
||||
speed = 1;
|
||||
}
|
||||
|
||||
static void SetZoom(long y, long x, int d) {
|
||||
|
@ -417,15 +419,18 @@ static void OnUnzoom(long y, long x) {
|
|||
|
||||
static void OnMouseLeftDrag(long y, long x) {
|
||||
int i;
|
||||
if (y == save_y && x == save_x) return;
|
||||
if (y == save_y && x == save_x)
|
||||
return;
|
||||
save_y = y;
|
||||
save_x = x;
|
||||
y = top + (y << (zoom + !!zoom));
|
||||
x = left + (x << zoom);
|
||||
y += _rand64() & ((1ul << (zoom + !!zoom)) - 1);
|
||||
x += _rand64() & ((1ul << zoom) - 1);
|
||||
if (y < 0 || y >= byn) return;
|
||||
if (x < 0 || x >= bxn) return;
|
||||
if (y < 0 || y >= byn)
|
||||
return;
|
||||
if (x < 0 || x >= bxn)
|
||||
return;
|
||||
if (erase) {
|
||||
Unset(y, x);
|
||||
} else {
|
||||
|
@ -447,8 +452,10 @@ static void OnMouseLeftDown(long y, long x) {
|
|||
y = top + (y << (zoom + !!zoom));
|
||||
x = left + (x << zoom);
|
||||
erase = false;
|
||||
if (y < 0 || y >= byn) return;
|
||||
if (x < 0 || x >= bxn) return;
|
||||
if (y < 0 || y >= byn)
|
||||
return;
|
||||
if (x < 0 || x >= bxn)
|
||||
return;
|
||||
if ((erase = Test(y, x))) {
|
||||
Unset(y, x);
|
||||
} else {
|
||||
|
@ -472,7 +479,8 @@ static void OnMouseRightDrag(long y, long x) {
|
|||
long dy, dx, h, w;
|
||||
dy = (save_y - y) << zoom;
|
||||
dx = (save_x - x) << zoom;
|
||||
if (zoom) dy <<= 1;
|
||||
if (zoom)
|
||||
dy <<= 1;
|
||||
if (natural) {
|
||||
dy = -dy;
|
||||
dx = -dx;
|
||||
|
@ -494,7 +502,8 @@ static void *NewBoard(size_t *out_size) {
|
|||
p = _mapanon(n);
|
||||
mprotect(p, getauxval(AT_PAGESZ), 0);
|
||||
mprotect(p + k, n - k, 0);
|
||||
if (out_size) *out_size = n;
|
||||
if (out_size)
|
||||
*out_size = n;
|
||||
return p + getauxval(AT_PAGESZ);
|
||||
}
|
||||
|
||||
|
@ -524,7 +533,8 @@ static void GenerateStatusLine(void) {
|
|||
|
||||
static void OnHeader(void) {
|
||||
size_t n;
|
||||
if (!buffer.i) return;
|
||||
if (!buffer.i)
|
||||
return;
|
||||
switch (buffer.p[0]) {
|
||||
case 'N':
|
||||
if (buffer.i > 2) {
|
||||
|
@ -541,7 +551,8 @@ static void OnHeader(void) {
|
|||
static int ReadChar(FILE *f) {
|
||||
int c;
|
||||
++column;
|
||||
if ((c = fgetc(f)) == -1) return -1;
|
||||
if ((c = fgetc(f)) == -1)
|
||||
return -1;
|
||||
if (c == '\n') {
|
||||
++line;
|
||||
column = 0;
|
||||
|
@ -552,10 +563,12 @@ static int ReadChar(FILE *f) {
|
|||
static int GetChar(FILE *f) {
|
||||
int c;
|
||||
for (;;) {
|
||||
if ((c = ReadChar(f)) == -1) return -1;
|
||||
if ((c = ReadChar(f)) == -1)
|
||||
return -1;
|
||||
if (c == '#' && column == 1) {
|
||||
for (;;) {
|
||||
if ((c = ReadChar(f)) == -1) return -1;
|
||||
if ((c = ReadChar(f)) == -1)
|
||||
return -1;
|
||||
if (c == '\r') {
|
||||
continue;
|
||||
} else if (c == '\n') {
|
||||
|
@ -575,30 +588,40 @@ static int LoadFile(const char *path) {
|
|||
long c, y, x, i, n, yn, xn, yo, xo;
|
||||
line = 0;
|
||||
f = fopen(path, "r");
|
||||
if (GetChar(f) != 'x') goto ReadError;
|
||||
if (GetChar(f) != ' ') goto ReadError;
|
||||
if (GetChar(f) != '=') goto ReadError;
|
||||
if (GetChar(f) != ' ') goto ReadError;
|
||||
if (GetChar(f) != 'x')
|
||||
goto ReadError;
|
||||
if (GetChar(f) != ' ')
|
||||
goto ReadError;
|
||||
if (GetChar(f) != '=')
|
||||
goto ReadError;
|
||||
if (GetChar(f) != ' ')
|
||||
goto ReadError;
|
||||
xn = 0;
|
||||
for (;;) {
|
||||
if ((c = GetChar(f)) == -1) goto ReadError;
|
||||
if (!isdigit(c)) break;
|
||||
if ((c = GetChar(f)) == -1)
|
||||
goto ReadError;
|
||||
if (!isdigit(c))
|
||||
break;
|
||||
xn *= 10;
|
||||
xn += c - '0';
|
||||
}
|
||||
do {
|
||||
if ((c = GetChar(f)) == -1) goto ReadError;
|
||||
if ((c = GetChar(f)) == -1)
|
||||
goto ReadError;
|
||||
} while (!isdigit(c));
|
||||
yn = 0;
|
||||
do {
|
||||
yn *= 10;
|
||||
yn += c - '0';
|
||||
if ((c = GetChar(f)) == -1) goto ReadError;
|
||||
if ((c = GetChar(f)) == -1)
|
||||
goto ReadError;
|
||||
} while (isdigit(c));
|
||||
while (c != '\n') {
|
||||
if ((c = ReadChar(f)) == -1) goto ReadError;
|
||||
if ((c = ReadChar(f)) == -1)
|
||||
goto ReadError;
|
||||
}
|
||||
if (yn > byn || xn > bxn) goto ReadError;
|
||||
if (yn > byn || xn > bxn)
|
||||
goto ReadError;
|
||||
SwapBoards();
|
||||
bzero(board, (byn * bxn) >> 3);
|
||||
yo = byn / 2 - yn / 2;
|
||||
|
@ -606,7 +629,8 @@ static int LoadFile(const char *path) {
|
|||
y = 0;
|
||||
x = 0;
|
||||
for (;;) {
|
||||
if ((c = GetChar(f)) == -1) goto ReadError;
|
||||
if ((c = GetChar(f)) == -1)
|
||||
goto ReadError;
|
||||
if (c == '!') {
|
||||
break;
|
||||
} else if (isspace(c)) {
|
||||
|
@ -615,8 +639,10 @@ static int LoadFile(const char *path) {
|
|||
if (isdigit(c)) {
|
||||
n = c - '0';
|
||||
for (;;) {
|
||||
if ((c = GetChar(f)) == -1) goto ReadError;
|
||||
if (!isdigit(c)) break;
|
||||
if ((c = GetChar(f)) == -1)
|
||||
goto ReadError;
|
||||
if (!isdigit(c))
|
||||
break;
|
||||
n *= 10;
|
||||
n += c - '0';
|
||||
}
|
||||
|
@ -624,12 +650,14 @@ static int LoadFile(const char *path) {
|
|||
n = 1;
|
||||
}
|
||||
if (c == '$') {
|
||||
if (++y == yn) y = 0;
|
||||
if (++y == yn)
|
||||
y = 0;
|
||||
x = 0;
|
||||
} else if (c == 'b' || c == 'o') {
|
||||
for (i = 0; i < n; ++i) {
|
||||
if (x >= xn) {
|
||||
if (++y == yn) y = 0;
|
||||
if (++y == yn)
|
||||
y = 0;
|
||||
x = 0;
|
||||
}
|
||||
if (c == 'o') {
|
||||
|
@ -758,9 +786,11 @@ static void OnSigWinch(int sig) {
|
|||
static void OnMouse(char *p) {
|
||||
int e, x, y;
|
||||
e = strtol(p, &p, 10);
|
||||
if (*p == ';') ++p;
|
||||
if (*p == ';')
|
||||
++p;
|
||||
x = min(txn, max(1, strtol(p, &p, 10))) - 1;
|
||||
if (*p == ';') ++p;
|
||||
if (*p == ';')
|
||||
++p;
|
||||
y = min(tyn, max(1, strtol(p, &p, 10))) - 1;
|
||||
e |= (*p == 'm') << 2;
|
||||
switch (e) {
|
||||
|
@ -847,7 +877,8 @@ static void ReadKeyboard(void) {
|
|||
char buf[32], *p = buf;
|
||||
bzero(buf, sizeof(buf));
|
||||
if (readansi(0, buf, sizeof(buf)) == -1) {
|
||||
if (errno == EINTR) return;
|
||||
if (errno == EINTR)
|
||||
return;
|
||||
exit(errno);
|
||||
}
|
||||
switch (*p++) {
|
||||
|
@ -951,7 +982,8 @@ static int InvertXtermGreyscale(int x) {
|
|||
static int ByteToColor(int x) {
|
||||
uint8_t c;
|
||||
c = x / 256. * 24 + 232;
|
||||
if (white) c = InvertXtermGreyscale(c);
|
||||
if (white)
|
||||
c = InvertXtermGreyscale(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
@ -1095,7 +1127,8 @@ static bool HasPendingInput(void) {
|
|||
static bool ShouldDraw(void) {
|
||||
struct timespec now;
|
||||
static struct timespec next;
|
||||
if (!isdragging) return true;
|
||||
if (!isdragging)
|
||||
return true;
|
||||
now = timespec_real();
|
||||
if (timespec_cmp(now, next) > 0 && !HasPendingInput()) {
|
||||
next = timespec_add(now, timespec_frommicros(1. / 24 * 1e6));
|
||||
|
@ -1384,7 +1417,8 @@ static void Gui(void) {
|
|||
╚────────────────────────────────────────────────────────────────────────────│*/
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (!NoDebug()) ShowCrashReports();
|
||||
if (!NoDebug())
|
||||
ShowCrashReports();
|
||||
out = 1;
|
||||
speed = 1;
|
||||
tyn = right = 80;
|
||||
|
|
|
@ -123,7 +123,8 @@ int main(int argc, char *argv[]) {
|
|||
MMDB_open("/usr/local/share/maxmind/GeoLite2-ASN.mmdb", 0, asdb));
|
||||
for (rc = 0, i = 1; i < argc; ++i) {
|
||||
if (PrintIpInfo(argv[i]) != -1) {
|
||||
if (i + 1 < argc) printf("\n");
|
||||
if (i + 1 < argc)
|
||||
printf("\n");
|
||||
} else {
|
||||
fprintf(stderr, "NOT FOUND: %s\n", argv[i]);
|
||||
rc = 1;
|
||||
|
|
|
@ -343,7 +343,8 @@ static void PreventBufferbloat(void) {
|
|||
|
||||
static bool HasPendingInput(void) {
|
||||
struct pollfd fds[1];
|
||||
if (IsWindows()) return true; /* XXX */
|
||||
if (IsWindows())
|
||||
return true; /* XXX */
|
||||
fds[0].fd = 0;
|
||||
fds[0].events = POLLIN;
|
||||
fds[0].revents = 0;
|
||||
|
@ -355,8 +356,10 @@ static int GetCurrentRange(void) {
|
|||
int i;
|
||||
if (ranges.i) {
|
||||
for (i = 0; i < ranges.i; ++i) {
|
||||
if (offset < ranges.p[i].a) return MAX(0, i - 1);
|
||||
if (offset < ranges.p[i].b) return i;
|
||||
if (offset < ranges.p[i].a)
|
||||
return MAX(0, i - 1);
|
||||
if (offset < ranges.p[i].b)
|
||||
return i;
|
||||
}
|
||||
return ranges.i - 1;
|
||||
} else {
|
||||
|
@ -472,9 +475,11 @@ static void OnPrevEnd(void) {
|
|||
static void OnMouse(char *p) {
|
||||
int e, x, y;
|
||||
e = strtol(p, &p, 10);
|
||||
if (*p == ';') ++p;
|
||||
if (*p == ';')
|
||||
++p;
|
||||
x = min(txn, max(1, strtol(p, &p, 10))) - 1;
|
||||
if (*p == ';') ++p;
|
||||
if (*p == ';')
|
||||
++p;
|
||||
y = min(tyn, max(1, strtol(p, &p, 10))) - 1;
|
||||
e |= (*p == 'm') << 2;
|
||||
switch (e) {
|
||||
|
@ -523,7 +528,8 @@ static void ReadKeyboard(void) {
|
|||
char buf[32], *p = buf;
|
||||
bzero(buf, sizeof(buf));
|
||||
if (readansi(0, buf, sizeof(buf)) == -1) {
|
||||
if (errno == EINTR) return;
|
||||
if (errno == EINTR)
|
||||
return;
|
||||
exit(errno);
|
||||
}
|
||||
switch (*p++) {
|
||||
|
@ -698,8 +704,10 @@ static void LoadRanges(void) {
|
|||
range.b = 0;
|
||||
ranges.i = 0;
|
||||
for (;;) {
|
||||
if ((n = read(fd, b, sizeof(b))) == -1) exit(1);
|
||||
if (!n) break;
|
||||
if ((n = read(fd, b, sizeof(b))) == -1)
|
||||
exit(1);
|
||||
if (!n)
|
||||
break;
|
||||
for (i = 0; i < n; ++i) {
|
||||
switch (t) {
|
||||
case 0:
|
||||
|
@ -807,7 +815,8 @@ static void Render(void) {
|
|||
for (i = 0, n = p - buffer; i < n; i += got) {
|
||||
got = 0;
|
||||
if ((rc = write(out, buffer + i, n - i)) == -1) {
|
||||
if (errno == EINTR) continue;
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
exit(errno);
|
||||
}
|
||||
got = rc;
|
||||
|
@ -828,7 +837,8 @@ static void Zoom(long have) {
|
|||
n = have >> zoom;
|
||||
i = n / txn;
|
||||
r = n % txn;
|
||||
if (r) ++i;
|
||||
if (r)
|
||||
++i;
|
||||
if (order == LINEAR) {
|
||||
for (; i < tyn; ++i) {
|
||||
canvas[txn * i] = '~';
|
||||
|
@ -877,7 +887,8 @@ static void MemZoom(void) {
|
|||
}
|
||||
if (ok && HasPendingInput()) {
|
||||
ReadKeyboard();
|
||||
if (!IsWindows()) continue; /* XXX */
|
||||
if (!IsWindows())
|
||||
continue; /* XXX */
|
||||
}
|
||||
ok = true;
|
||||
if (pid) {
|
||||
|
@ -953,7 +964,8 @@ static void GetOpts(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (!NoDebug()) ShowCrashReports();
|
||||
if (!NoDebug())
|
||||
ShowCrashReports();
|
||||
out = 1;
|
||||
GetOpts(argc, argv);
|
||||
Open();
|
||||
|
|
|
@ -172,7 +172,8 @@ static void GetOpts(int *argc, char *argv[]) {
|
|||
}
|
||||
}
|
||||
if (optind == *argc) {
|
||||
if (!g_flags.out) g_flags.out = "-";
|
||||
if (!g_flags.out)
|
||||
g_flags.out = "-";
|
||||
argv[(*argc)++] = "-";
|
||||
}
|
||||
if (!g_flags.full && (!g_flags.width || !g_flags.width)) {
|
||||
|
@ -269,7 +270,8 @@ struct Block {
|
|||
static void *Raster(long yn, long xn, unsigned char Y[yn][xn]) {
|
||||
long y, x, i, j, k, s, bi, bs;
|
||||
for (y = 0; y + 4 <= yn; y += 4) {
|
||||
if (y) fputc('\n', stdout);
|
||||
if (y)
|
||||
fputc('\n', stdout);
|
||||
for (x = 0; x + 2 <= xn; x += 2) {
|
||||
bi = 0;
|
||||
bs = LONG_MAX;
|
||||
|
|
|
@ -228,7 +228,8 @@ static void PrintImageImpl(long syn, long sxn, unsigned char RGB[3][syn][sxn],
|
|||
unsigned char a[3], b[3];
|
||||
didhalfy = false;
|
||||
for (y = y0; y < yn; y += dy) {
|
||||
if (y) printf("\e[0m\n");
|
||||
if (y)
|
||||
printf("\e[0m\n");
|
||||
for (x = x0; x < xn; x += dx) {
|
||||
a[0] = RGB[0][y][x];
|
||||
a[1] = RGB[1][y][x];
|
||||
|
@ -328,8 +329,10 @@ static void PrintImageSerious(long yn, long xn, unsigned char RGB[3][yn][xn],
|
|||
long y, x;
|
||||
struct TtyRgb bg = {0x12, 0x34, 0x56, 0};
|
||||
struct TtyRgb fg = {0x12, 0x34, 0x56, 0};
|
||||
if (g_flags.unsharp) unsharp(3, yn, xn, RGB, yn, xn);
|
||||
if (g_flags.dither) dither(yn, xn, RGB, yn, xn);
|
||||
if (g_flags.unsharp)
|
||||
unsharp(3, yn, xn, RGB, yn, xn);
|
||||
if (g_flags.dither)
|
||||
dither(yn, xn, RGB, yn, xn);
|
||||
if (yn && xn) {
|
||||
for (y = 0; y < tyn; ++y) {
|
||||
for (x = 0; x < txn; ++x) {
|
||||
|
@ -396,8 +399,10 @@ void WithImageFile(const char *path,
|
|||
wyn = g_winsize.ws_row * 2;
|
||||
wxn = g_winsize.ws_col;
|
||||
if (g_flags.ignoreaspect) {
|
||||
if (!dyn) dyn = wyn;
|
||||
if (!dxn) dxn = wxn * (1 + !g_flags.half);
|
||||
if (!dyn)
|
||||
dyn = wyn;
|
||||
if (!dxn)
|
||||
dxn = wxn * (1 + !g_flags.half);
|
||||
}
|
||||
if (!dyn && !dxn) {
|
||||
if (sxn * wyn > syn * wxn) {
|
||||
|
@ -439,7 +444,8 @@ int main(int argc, char *argv[]) {
|
|||
int i;
|
||||
ShowCrashReports();
|
||||
GetOpts(&argc, argv);
|
||||
if (optind == argc) PrintUsage(EXIT_SUCCESS, STDOUT_FILENO);
|
||||
if (optind == argc)
|
||||
PrintUsage(EXIT_SUCCESS, STDOUT_FILENO);
|
||||
stbi_set_unpremultiply_on_load(true);
|
||||
for (i = optind; i < argc; ++i) {
|
||||
WithImageFile(argv[i], ProcessImage);
|
||||
|
|
|
@ -58,7 +58,8 @@ int NextBestThing(void) {
|
|||
posix_fadvise(fd, 0, 0, MADV_SEQUENTIAL);
|
||||
ssize_t wrote;
|
||||
while ((wrote = copyfd(fd, 1, -1)) != -1) {
|
||||
if (wrote == 0) break;
|
||||
if (wrote == 0)
|
||||
break;
|
||||
}
|
||||
close(fd);
|
||||
return 0;
|
||||
|
@ -139,11 +140,16 @@ void PrintSystemInfo(void) {
|
|||
}
|
||||
|
||||
const char *ft2str(int ft) {
|
||||
if (ft == kNtFileTypeUnknown) return "kNtFileTypeUnknown";
|
||||
if (ft == kNtFileTypeDisk) return "kNtFileTypeDisk";
|
||||
if (ft == kNtFileTypeChar) return "kNtFileTypeChar";
|
||||
if (ft == kNtFileTypePipe) return "kNtFileTypePipe";
|
||||
if (ft == kNtFileTypeRemote) return "kNtFileTypeRemote";
|
||||
if (ft == kNtFileTypeUnknown)
|
||||
return "kNtFileTypeUnknown";
|
||||
if (ft == kNtFileTypeDisk)
|
||||
return "kNtFileTypeDisk";
|
||||
if (ft == kNtFileTypeChar)
|
||||
return "kNtFileTypeChar";
|
||||
if (ft == kNtFileTypePipe)
|
||||
return "kNtFileTypePipe";
|
||||
if (ft == kNtFileTypeRemote)
|
||||
return "kNtFileTypeRemote";
|
||||
return "wut?";
|
||||
}
|
||||
|
||||
|
|
|
@ -529,8 +529,10 @@ static bool OpenSpeaker(void) {
|
|||
if (!once) {
|
||||
once = true;
|
||||
i = 0;
|
||||
if (ffplay_) tryspeakerfns_[i++] = TryFfplay;
|
||||
if (sox_) tryspeakerfns_[i++] = TrySox;
|
||||
if (ffplay_)
|
||||
tryspeakerfns_[i++] = TryFfplay;
|
||||
if (sox_)
|
||||
tryspeakerfns_[i++] = TrySox;
|
||||
}
|
||||
snprintf(fifopath_, sizeof(fifopath_), "%s%s.%d.%d.wav", __get_tmpdir(),
|
||||
firstnonnull(program_invocation_short_name, "unknown"), getpid(),
|
||||
|
@ -589,7 +591,8 @@ static void DescribeAlgorithms(char *p) {
|
|||
break;
|
||||
case kTtyQuantAnsi:
|
||||
p = stpcpy(p, " aixterm ansi");
|
||||
if (istango_) p = stpcpy(p, " tango");
|
||||
if (istango_)
|
||||
p = stpcpy(p, " tango");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -609,7 +612,8 @@ static void DescribeAlgorithms(char *p) {
|
|||
}
|
||||
|
||||
static char *StartRender(char *vt) {
|
||||
if (!ttymode_) vt += sprintf(vt, "\r\n\r\n");
|
||||
if (!ttymode_)
|
||||
vt += sprintf(vt, "\r\n\r\n");
|
||||
if (fullclear_) {
|
||||
vt += sprintf(vt, "\e[0m\e[H\e[J");
|
||||
fullclear_ = false;
|
||||
|
@ -640,8 +644,10 @@ static bool HasAdjustments(void) {
|
|||
}
|
||||
|
||||
static char *DescribeAdjustments(char *p) {
|
||||
if (emboss_) p = stpcpy(p, " emboss");
|
||||
if (sobel_) p = stpcpy(p, " sobel");
|
||||
if (emboss_)
|
||||
p = stpcpy(p, " emboss");
|
||||
if (sobel_)
|
||||
p = stpcpy(p, " sobel");
|
||||
switch (sharp_) {
|
||||
case kSharpSharp:
|
||||
p = stpcpy(p, " sharp");
|
||||
|
@ -662,21 +668,36 @@ static char *DescribeAdjustments(char *p) {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
if (IsNonZeroFloat(hue_)) p += sprintf(p, " hue%+.2f", hue_);
|
||||
if (IsNonZeroFloat(sat_)) p += sprintf(p, " sat%+.2f", sat_);
|
||||
if (IsNonZeroFloat(lit_)) p += sprintf(p, " lit%+.2f", lit_);
|
||||
if (pf1_) p = stpcpy(p, " PF1");
|
||||
if (pf2_) p = stpcpy(p, " PF2");
|
||||
if (pf3_) p = stpcpy(p, " PF3");
|
||||
if (pf4_) p = stpcpy(p, " PF4");
|
||||
if (pf5_) p = stpcpy(p, " PF5");
|
||||
if (pf6_) p = stpcpy(p, " PF6");
|
||||
if (pf7_) p = stpcpy(p, " PF7");
|
||||
if (pf8_) p = stpcpy(p, " PF8");
|
||||
if (pf9_) p = stpcpy(p, " PF9");
|
||||
if (pf10_) p = stpcpy(p, " PF10");
|
||||
if (pf11_) p = stpcpy(p, " PF11");
|
||||
if (pf12_) p = stpcpy(p, " PF12");
|
||||
if (IsNonZeroFloat(hue_))
|
||||
p += sprintf(p, " hue%+.2f", hue_);
|
||||
if (IsNonZeroFloat(sat_))
|
||||
p += sprintf(p, " sat%+.2f", sat_);
|
||||
if (IsNonZeroFloat(lit_))
|
||||
p += sprintf(p, " lit%+.2f", lit_);
|
||||
if (pf1_)
|
||||
p = stpcpy(p, " PF1");
|
||||
if (pf2_)
|
||||
p = stpcpy(p, " PF2");
|
||||
if (pf3_)
|
||||
p = stpcpy(p, " PF3");
|
||||
if (pf4_)
|
||||
p = stpcpy(p, " PF4");
|
||||
if (pf5_)
|
||||
p = stpcpy(p, " PF5");
|
||||
if (pf6_)
|
||||
p = stpcpy(p, " PF6");
|
||||
if (pf7_)
|
||||
p = stpcpy(p, " PF7");
|
||||
if (pf8_)
|
||||
p = stpcpy(p, " PF8");
|
||||
if (pf9_)
|
||||
p = stpcpy(p, " PF9");
|
||||
if (pf10_)
|
||||
p = stpcpy(p, " PF10");
|
||||
if (pf11_)
|
||||
p = stpcpy(p, " PF11");
|
||||
if (pf12_)
|
||||
p = stpcpy(p, " PF12");
|
||||
*p++ = ' ';
|
||||
*p++ = '\0';
|
||||
return p;
|
||||
|
@ -782,8 +803,10 @@ static void TranscodeVideo(plm_frame_t *pf) {
|
|||
|
||||
TIMEIT(t1, {
|
||||
pary_ = 2;
|
||||
if (pf1_) pary_ = 1.;
|
||||
if (pf2_) pary_ = (266 / 64.) * (900 / 1600.);
|
||||
if (pf1_)
|
||||
pary_ = 1.;
|
||||
if (pf2_)
|
||||
pary_ = (266 / 64.) * (900 / 1600.);
|
||||
pary_ *= plm_get_pixel_aspect_ratio(plm_);
|
||||
YCbCr2RgbScale(g2_->yn, g2_->xn, g2_->b, pf->y.height, pf->y.width,
|
||||
(void *)pf->y.data, pf->cr.height, pf->cr.width,
|
||||
|
@ -805,8 +828,10 @@ static void TranscodeVideo(plm_frame_t *pf) {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
if (sobel_) sobel(g2_);
|
||||
if (emboss_) emboss(g2_);
|
||||
if (sobel_)
|
||||
sobel(g2_);
|
||||
if (emboss_)
|
||||
emboss(g2_);
|
||||
switch (sharp_) {
|
||||
case kSharpSharp:
|
||||
sharpen(3, g2_->yn, g2_->xn, g2_->b, g2_->yn, g2_->xn);
|
||||
|
@ -932,7 +957,8 @@ static void WriteVideo(void) {
|
|||
}
|
||||
|
||||
static void RefreshDisplay(void) {
|
||||
if (f1_ && f1_->n) f1_->i = 0;
|
||||
if (f1_ && f1_->n)
|
||||
f1_->i = 0;
|
||||
DimensionDisplay();
|
||||
resized_ = false;
|
||||
historyclear_ = true;
|
||||
|
@ -1287,8 +1313,10 @@ static void PerformBestEffortIo(void) {
|
|||
DEBUGF("poll() toto=%d [grace=%,ldns]", toto,
|
||||
timespec_tonanos(GetGraceTime()));
|
||||
if (toto) {
|
||||
if (fds[0].revents & (POLLIN | POLLERR)) ReadKeyboard();
|
||||
if (fds[1].revents & (POLLOUT | POLLERR)) WriteVideo();
|
||||
if (fds[0].revents & (POLLIN | POLLERR))
|
||||
ReadKeyboard();
|
||||
if (fds[1].revents & (POLLOUT | POLLERR))
|
||||
WriteVideo();
|
||||
}
|
||||
} else if (errno == EINTR) {
|
||||
DEBUGF("poll() → EINTR");
|
||||
|
@ -1300,7 +1328,8 @@ static void PerformBestEffortIo(void) {
|
|||
|
||||
static void RestoreTty(void) {
|
||||
DrainVideo();
|
||||
if (ttymode_) ttysend(outfd_, "\r\n\e[J");
|
||||
if (ttymode_)
|
||||
ttysend(outfd_, "\r\n\e[J");
|
||||
ttymode_ = false;
|
||||
ttyraw(-1);
|
||||
}
|
||||
|
@ -1352,7 +1381,8 @@ static void PrintVideo(void) {
|
|||
|
||||
static bool AskUserYesOrNoQuestion(const char *prompt) {
|
||||
char c;
|
||||
if (yes_ || !ttymode_) return true;
|
||||
if (yes_ || !ttymode_)
|
||||
return true;
|
||||
ttysend(outfd_, "\r\e[K");
|
||||
ttysend(outfd_, prompt);
|
||||
ttysend(outfd_, " [yn] ");
|
||||
|
@ -1411,8 +1441,10 @@ static void GetOpts(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
static void OnExit(void) {
|
||||
if (playpid_) kill(playpid_, SIGTERM), sched_yield();
|
||||
if (plm_) plm_destroy(plm_), plm_ = NULL;
|
||||
if (playpid_)
|
||||
kill(playpid_, SIGTERM), sched_yield();
|
||||
if (plm_)
|
||||
plm_destroy(plm_), plm_ = NULL;
|
||||
YCbCrFree(&ycbcr_);
|
||||
RestoreTty();
|
||||
ttyidentclear(&ti_);
|
||||
|
@ -1561,8 +1593,10 @@ int main(int argc, char *argv[]) {
|
|||
ShowCrashReports();
|
||||
fullclear_ = true;
|
||||
GetOpts(argc, argv);
|
||||
if (!tuned_) PickDefaults();
|
||||
if (optind == argc) PrintUsage(EX_USAGE, STDERR_FILENO);
|
||||
if (!tuned_)
|
||||
PickDefaults();
|
||||
if (optind == argc)
|
||||
PrintUsage(EX_USAGE, STDERR_FILENO);
|
||||
patharg_ = argv[optind];
|
||||
s = commandvenv("SOX", "sox");
|
||||
sox_ = s ? strdup(s) : 0;
|
||||
|
@ -1584,7 +1618,8 @@ int main(int argc, char *argv[]) {
|
|||
xsigaction(SIGWINCH, OnResize, 0, 0, NULL);
|
||||
xsigaction(SIGCHLD, OnSigChld, 0, 0, NULL);
|
||||
xsigaction(SIGPIPE, OnSigPipe, 0, 0, NULL);
|
||||
if (ttyraw(kTtyLfToCrLf) != -1) ttymode_ = true;
|
||||
if (ttyraw(kTtyLfToCrLf) != -1)
|
||||
ttymode_ = true;
|
||||
__cxa_atexit((void *)OnExit, NULL, NULL);
|
||||
__log_file = fopen(logpath_, "a");
|
||||
if (ischardev(infd_) && ischardev(outfd_)) {
|
||||
|
@ -1593,10 +1628,12 @@ int main(int argc, char *argv[]) {
|
|||
infd_ = -1;
|
||||
}
|
||||
/* CHECK_NE(-1, fcntl(outfd_, F_SETFL, O_NONBLOCK)); */
|
||||
if (CanPlayAudio()) MakeLatencyLittleLessBad();
|
||||
if (CanPlayAudio())
|
||||
MakeLatencyLittleLessBad();
|
||||
TryToOpenFrameBuffer();
|
||||
RenounceSpecialPrivileges();
|
||||
if (t2 > t1) longjmp(jb_, 1);
|
||||
if (t2 > t1)
|
||||
longjmp(jb_, 1);
|
||||
OpenVideo();
|
||||
DimensionDisplay();
|
||||
starttime_ = timespec_real();
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
static void SetLimit(int resource, uint64_t soft, uint64_t hard) {
|
||||
struct rlimit old;
|
||||
struct rlimit lim = {soft, hard};
|
||||
if (resource == 127) return;
|
||||
if (resource == 127)
|
||||
return;
|
||||
if (setrlimit(resource, &lim) == -1) {
|
||||
if (!getrlimit(resource, &old)) {
|
||||
lim.rlim_max = MIN(hard, old.rlim_max);
|
||||
|
|
|
@ -57,5 +57,6 @@ int main(int argc, char *argv[]) {
|
|||
expect = timeval_add(start, interval);
|
||||
signal(SIGALRM, OnTick);
|
||||
setitimer(ITIMER_REAL, &(struct itimerval){interval, interval}, 0);
|
||||
for (;;) pause();
|
||||
for (;;)
|
||||
pause();
|
||||
}
|
||||
|
|
|
@ -63,28 +63,37 @@ int main(int argc, char *argv[]) {
|
|||
ssize_t n;
|
||||
size_t i, j;
|
||||
bool chopped;
|
||||
if (argc < 2) return 1;
|
||||
if ((fd = open(argv[1], O_RDONLY)) == -1) return 2;
|
||||
if (fstat(fd, &st) == -1) return 3;
|
||||
if (argc < 2)
|
||||
return 1;
|
||||
if ((fd = open(argv[1], O_RDONLY)) == -1)
|
||||
return 2;
|
||||
if (fstat(fd, &st) == -1)
|
||||
return 3;
|
||||
n = st.st_size - MIN(st.st_size, sizeof(buf));
|
||||
if ((n = pread(fd, buf, sizeof(buf), n)) == -1) return 4;
|
||||
if ((n = pread(fd, buf, sizeof(buf), n)) == -1)
|
||||
return 4;
|
||||
for (p = buf + n, i = 0; i < 10; ++i) {
|
||||
p = firstnonnull(memrchr(buf, '\n', p - buf), buf);
|
||||
}
|
||||
chopped = false;
|
||||
if (buf + n - p) ++p;
|
||||
if (buf + n - p)
|
||||
++p;
|
||||
i = st.st_size - (buf + n - p);
|
||||
atexit(OnExit);
|
||||
HideCursor();
|
||||
xsigaction(SIGINT, OnInt, 0, 0, 0);
|
||||
xsigaction(SIGTERM, OnInt, 0, 0, 0);
|
||||
while (!exited) {
|
||||
if (fstat(fd, &st) == -1) return 5;
|
||||
if (i > st.st_size) i = 0;
|
||||
if (fstat(fd, &st) == -1)
|
||||
return 5;
|
||||
if (i > st.st_size)
|
||||
i = 0;
|
||||
for (; i < st.st_size; i += n) {
|
||||
if ((n = pread(fd, buf, sizeof(buf), i)) == -1) return 6;
|
||||
if ((n = pread(fd, buf, sizeof(buf), i)) == -1)
|
||||
return 6;
|
||||
j = n;
|
||||
while (j && (buf[j - 1] == '\n' || buf[j - 1] == '\r')) --j;
|
||||
while (j && (buf[j - 1] == '\n' || buf[j - 1] == '\r'))
|
||||
--j;
|
||||
if (j) {
|
||||
if (chopped) {
|
||||
WriteString("\r\n");
|
||||
|
|
|
@ -66,7 +66,8 @@ int main(int argc, char *argv[]) {
|
|||
"RegionSize", "State", "Type", "AllocationProtect", "Protect");
|
||||
for (p = 0;; p = (char *)mi.BaseAddress + mi.RegionSize) {
|
||||
bzero(&mi, sizeof(mi));
|
||||
if (!VirtualQuery(p, &mi, sizeof(mi))) break;
|
||||
if (!VirtualQuery(p, &mi, sizeof(mi)))
|
||||
break;
|
||||
sizefmt(b[0], mi.RegionSize, 1024);
|
||||
printf("%.12lx %.12lx %10s %16s %16s %32s %32s\n", mi.AllocationBase,
|
||||
mi.BaseAddress, b[0], DescribeNtMemState(b[1], mi.State),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue