mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-28 13:30:29 +00:00
Get address sanitizer mostly working
This commit is contained in:
parent
1f1f3cd477
commit
7327c345f9
149 changed files with 3777 additions and 3457 deletions
|
@ -218,11 +218,11 @@ static void ReadAll(int fd, void *buf, size_t n) {
|
|||
static void LoadImageOrDie(const char *path, size_t size, long yn, long xn,
|
||||
unsigned char RGB[yn][xn][4]) {
|
||||
int pid, ws, fds[3];
|
||||
const char *convert;
|
||||
char *convert, pathbuf[PATH_MAX];
|
||||
if (isempty((convert = getenv("CONVERT"))) &&
|
||||
!(IsWindows() && access((convert = "\\msys64\\mingw64\\bin\\convert.exe"),
|
||||
X_OK) != -1) &&
|
||||
!(convert = commandv("convert"))) {
|
||||
!(convert = commandv("convert", pathbuf))) {
|
||||
fputs("'convert' command not found\r\n"
|
||||
"please install imagemagick\r\n",
|
||||
stderr);
|
||||
|
|
|
@ -488,8 +488,9 @@ static int ReadAll(int fd, void *data, size_t size) {
|
|||
static void LoadFileViaImageMagick(const char *path, unsigned yn, unsigned xn,
|
||||
unsigned char rgb[yn][YS][xn][XS][CN]) {
|
||||
const char *convert;
|
||||
char pathbuf[PATH_MAX];
|
||||
int pid, ws, fds[3] = {STDIN_FILENO, -1, STDERR_FILENO};
|
||||
if (!(convert = commandv("convert"))) {
|
||||
if (!(convert = commandv("convert", pathbuf))) {
|
||||
fputs("error: `convert` command not found\n"
|
||||
"try: apt-get install imagemagick\n",
|
||||
stderr);
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
#include "tool/viz/lib/formatstringtable.h"
|
||||
#include "tool/viz/lib/stringbuilder.h"
|
||||
|
||||
static void *ConvertMatrixToStringTable(long yn, long xn, char *T[yn][xn],
|
||||
const double M[yn][xn], double digs,
|
||||
double rounder(double)) {
|
||||
void *ConvertMatrixToStringTable(long yn, long xn, char *T[yn][xn],
|
||||
const double M[yn][xn], double digs,
|
||||
double rounder(double)) {
|
||||
double f;
|
||||
long y, x;
|
||||
assert(yn && xn && !T[0][0]);
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "dsp/core/half.h"
|
||||
#include "dsp/core/illumination.h"
|
||||
#include "dsp/mpeg/mpeg.h"
|
||||
#include "dsp/mpeg/ycbcrio.h"
|
||||
#include "dsp/scale/scale.h"
|
||||
#include "dsp/tty/quant.h"
|
||||
#include "dsp/tty/tty.h"
|
||||
|
@ -772,21 +771,6 @@ static void RenderIt(void) {
|
|||
EndRender(p);
|
||||
}
|
||||
|
||||
static noinline void SaveMpegFrame(plm_frame_t *pf) {
|
||||
static long count;
|
||||
struct Ycbcrio *m;
|
||||
if (!count) {
|
||||
if (!isdirectory("o/frames")) {
|
||||
if (!isdirectory("o")) {
|
||||
CHECK_NE(-1, mkdir("o", 0755));
|
||||
}
|
||||
CHECK_NE(-1, mkdir("o/frames", 0755));
|
||||
}
|
||||
}
|
||||
m = YcbcrioOpen(gc(xasprintf("o/frames/%04ld.ycbcrio", (count++ % 100))), pf);
|
||||
YcbcrioClose(&m);
|
||||
}
|
||||
|
||||
static void RasterIt(void) {
|
||||
static bool once;
|
||||
static void *buf;
|
||||
|
@ -873,7 +857,6 @@ static void OnVideo(plm_t *mpeg, plm_frame_t *pf, void *user) {
|
|||
if (f2_->n) {
|
||||
WARNF("video frame dropped");
|
||||
} else {
|
||||
/* if (pf3_) SaveMpegFrame(pf); */
|
||||
TranscodeVideo(pf);
|
||||
if (!f1_->n) {
|
||||
xchg(&f1_, &f2_);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "libc/macros.h"
|
||||
#include "libc/math.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/madv.h"
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "libc/macros.h"
|
||||
#include "libc/math.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/madv.h"
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ This program is free software; you can redistribute it and/or modify │
|
||||
│ it under the terms of the GNU General Public License as published by │
|
||||
│ the Free Software Foundation; version 2 of the License. │
|
||||
│ │
|
||||
│ This program is distributed in the hope that it will be useful, but │
|
||||
│ WITHOUT ANY WARRANTY; without even the implied warranty of │
|
||||
│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU │
|
||||
│ General Public License for more details. │
|
||||
│ │
|
||||
│ You should have received a copy of the GNU General Public License │
|
||||
│ along with this program; if not, write to the Free Software │
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "dsp/mpeg/ycbcrio.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/ex.h"
|
||||
#include "libc/sysv/consts/exit.h"
|
||||
#include "third_party/getopt/getopt.h"
|
||||
|
||||
#define USAGE \
|
||||
" [FLAGS] [PATH...]\n\
|
||||
\n\
|
||||
Flags:\n\
|
||||
-h shows this information\n\
|
||||
\n"
|
||||
|
||||
static char *inpath_;
|
||||
|
||||
static void PrintUsage(int rc, FILE *f) {
|
||||
fputs("Usage: ", f);
|
||||
fputs(program_invocation_name, f);
|
||||
fputs(USAGE, f);
|
||||
exit(rc);
|
||||
}
|
||||
|
||||
static void GetOpts(int *argc, char *argv[]) {
|
||||
int opt;
|
||||
while ((opt = getopt(*argc, argv, "?h")) != -1) {
|
||||
switch (opt) {
|
||||
case '?':
|
||||
case 'h':
|
||||
PrintUsage(EXIT_SUCCESS, stdout);
|
||||
default:
|
||||
PrintUsage(EX_USAGE, stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ProcessFile(struct Ycbcrio *m) {
|
||||
/* m->frame-> */
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
size_t i;
|
||||
struct Ycbcrio *m;
|
||||
GetOpts(&argc, argv);
|
||||
for (i = optind; i < argc; ++i) {
|
||||
inpath_ = argv[i];
|
||||
m = YcbcrioOpen(inpath_, NULL);
|
||||
ProcessFile(m);
|
||||
YcbcrioClose(&m);
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue