Compare commits
13 Commits
dea1e15e75
...
d14bfee30b
Author | SHA1 | Date |
---|---|---|
Juhani Krekelä | d14bfee30b | |
Juhani Krekelä | 8de433fbfb | |
Juhani Krekelä | 002785edda | |
Juhani Krekelä | b0476a5090 | |
Juhani Krekelä | b21e87476e | |
Juhani Krekelä | c062d2ce20 | |
Juhani Krekelä | c9b0ba1817 | |
Juhani Krekelä | 4d34329118 | |
Juhani Krekelä | 2c1611ea24 | |
Juhani Krekelä | db1a50c77f | |
Juhani Krekelä | c90f90dec2 | |
Juhani Krekelä | 72bca38e08 | |
Juhani Krekelä | 1df2b1e130 |
|
@ -24,7 +24,7 @@ if JAVASCRIPT
|
|||
links_LDADD=builtin.o context.o ipret.o javascr.o javascript.o md5.o md5hl.o ns.o pomocny.o regexp.o
|
||||
endif
|
||||
|
||||
links_SOURCES=af_unix.c auth.c beos.c bfu.c block.c bookmark.c cache.c charsets.c compress.c connect.c cookies.c data.c default.c dip.c directfb.c dither.c dns.c dos.c drivers.c error.c file.c finger.c fn_impl.c fontconf.c font_inc.c framebuf.c freetype.c ftp.c gif.c grx.c hpux.c html.c html_gr.c html_r.c html_tbl.c http.c https.c img.c imgcache.c jpeg.c jsint.c kbd.c language.c listedit.c lru.c mailto.c main.c memory.c menu.c objreq.c os_dep.c pmshell.c png.c sched.c select.c session.c smb.c string.c suffix.c svg.c svgalib.c terminal.c tiff.c types.c url.c view.c view_gr.c vms.c x.c xbm.c beos.h bits.h cfg.h codepage.h com-defs.h config-vms.h dfb_cur.h hpux.h language.h links.h os_dep.h os_depx.h setup.h arrow.inc certs.inc codepage.inc entity.inc fbcommon.inc language.inc links_ic.inc locase.inc suffix.inc suffix_x.inc uni_7b.inc upcase.inc vpipe.inc sortix.c
|
||||
links_SOURCES=af_unix.c auth.c beos.c bfu.c block.c bookmark.c cache.c charsets.c compress.c connect.c cookies.c data.c default.c dip.c directfb.c dither.c dns.c dos.c drivers.c error.c file.c finger.c fn_impl.c fontconf.c font_inc.c framebuf.c freetype.c ftp.c gif.c grx.c hpux.c html.c html_gr.c html_r.c html_tbl.c http.c https.c img.c imgcache.c jpeg.c jsint.c kbd.c language.c listedit.c lru.c mailto.c main.c memory.c menu.c objreq.c os_dep.c pmshell.c png.c sched.c select.c session.c smb.c sortix.c string.c suffix.c svg.c svgalib.c terminal.c tiff.c types.c url.c view.c view_gr.c vms.c x.c xbm.c beos.h bits.h cfg.h codepage.h com-defs.h config-vms.h dfb_cur.h hpux.h language.h links.h os_dep.h os_depx.h setup.h arrow.inc certs.inc codepage.inc entity.inc fbcommon.inc language.inc links_ic.inc locase.inc suffix.inc suffix_x.inc uni_7b.inc upcase.inc vpipe.inc
|
||||
# builtin.c context.c ipret.c javascr.c javascript.c md5.c md5hl.c ns.c pomocny.c regexp.c md5.h ns.h struct.h tree.h typy.h ipret.h javascript.h builtin.h builtin_keys.h
|
||||
|
||||
dist-hook:
|
||||
|
|
|
@ -76,7 +76,7 @@ bin_PROGRAMS = links
|
|||
@HAIKU_GR_TRUE@links_LDADD = haiku.o
|
||||
@JAVASCRIPT_TRUE@links_LDADD = builtin.o context.o ipret.o javascr.o javascript.o md5.o md5hl.o ns.o pomocny.o regexp.o
|
||||
|
||||
links_SOURCES = af_unix.c auth.c beos.c bfu.c block.c bookmark.c cache.c charsets.c compress.c connect.c cookies.c data.c default.c dip.c directfb.c dither.c dns.c dos.c drivers.c error.c file.c finger.c fn_impl.c fontconf.c font_inc.c framebuf.c freetype.c ftp.c gif.c grx.c hpux.c html.c html_gr.c html_r.c html_tbl.c http.c https.c img.c imgcache.c jpeg.c jsint.c kbd.c language.c listedit.c lru.c mailto.c main.c memory.c menu.c objreq.c os_dep.c pmshell.c png.c sched.c select.c session.c smb.c string.c suffix.c svg.c svgalib.c terminal.c tiff.c types.c url.c view.c view_gr.c vms.c x.c xbm.c beos.h bits.h cfg.h codepage.h com-defs.h config-vms.h dfb_cur.h hpux.h language.h links.h os_dep.h os_depx.h setup.h arrow.inc certs.inc codepage.inc entity.inc fbcommon.inc language.inc links_ic.inc locase.inc suffix.inc suffix_x.inc uni_7b.inc upcase.inc vpipe.inc sortix.c
|
||||
links_SOURCES = af_unix.c auth.c beos.c bfu.c block.c bookmark.c cache.c charsets.c compress.c connect.c cookies.c data.c default.c dip.c directfb.c dither.c dns.c dos.c drivers.c error.c file.c finger.c fn_impl.c fontconf.c font_inc.c framebuf.c freetype.c ftp.c gif.c grx.c hpux.c html.c html_gr.c html_r.c html_tbl.c http.c https.c img.c imgcache.c jpeg.c jsint.c kbd.c language.c listedit.c lru.c mailto.c main.c memory.c menu.c objreq.c os_dep.c pmshell.c png.c sched.c select.c session.c smb.c sortix.c string.c suffix.c svg.c svgalib.c terminal.c tiff.c types.c url.c view.c view_gr.c vms.c x.c xbm.c beos.h bits.h cfg.h codepage.h com-defs.h config-vms.h dfb_cur.h hpux.h language.h links.h os_dep.h os_depx.h setup.h arrow.inc certs.inc codepage.inc entity.inc fbcommon.inc language.inc links_ic.inc locase.inc suffix.inc suffix_x.inc uni_7b.inc upcase.inc vpipe.inc
|
||||
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
|
||||
|
|
|
@ -205,7 +205,6 @@ int bind_to_af_unix(unsigned char *name)
|
|||
#endif
|
||||
EINTRLOOP(rs, bind(s_unix_fd, &s_unix.s, s_unix_l));
|
||||
if (rs) {
|
||||
attempt_connect:
|
||||
/*debug("bind: %d, %s", errno, strerror(errno));*/
|
||||
if (af == PF_INET && errno == EADDRNOTAVAIL) {
|
||||
/* do not try to connect if the user has not configured loopback interface */
|
||||
|
@ -218,7 +217,7 @@ attempt_connect:
|
|||
#if defined(SOL_SOCKET) && defined(SO_REUSEADDR)
|
||||
EINTRLOOP(rs, setsockopt(s_unix_fd, SOL_SOCKET, SO_REUSEADDR, (void *)&a1, sizeof a1));
|
||||
#endif
|
||||
rs = blocking_connect(s_unix_fd, &s_unix.s, s_unix_l);
|
||||
EINTRLOOP(rs, connect(s_unix_fd, &s_unix.s, s_unix_l));
|
||||
if (rs) {
|
||||
retry:
|
||||
/*debug("connect: %d, %s", errno, strerror(errno));*/
|
||||
|
@ -256,7 +255,6 @@ retry_unlink:
|
|||
}
|
||||
EINTRLOOP(rs, listen(s_unix_fd, 100));
|
||||
if (rs) {
|
||||
if (errno == EADDRINUSE) goto attempt_connect;
|
||||
error("ERROR: listen failed: %d", errno);
|
||||
close_and_fail:
|
||||
EINTRLOOP(rs, close(s_unix_fd));
|
||||
|
|
|
@ -10459,7 +10459,7 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
|
|||
cat >> confdefs.h <<EOF
|
||||
#define $ac_tr_hdr 1
|
||||
EOF
|
||||
|
||||
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
fi
|
||||
|
|
10
connect.c
10
connect.c
|
@ -307,7 +307,7 @@ int get_pasv_socket(struct connection *c, int cc, int *sock, unsigned char *port
|
|||
}
|
||||
|
||||
#ifdef SUPPORT_IPV6
|
||||
int get_pasv_socket_ipv6(struct connection *c, int cc, int *sock, unsigned char *result, size_t result_size)
|
||||
int get_pasv_socket_ipv6(struct connection *c, int cc, int *sock, unsigned char *result)
|
||||
{
|
||||
int s;
|
||||
int rs;
|
||||
|
@ -335,7 +335,7 @@ int get_pasv_socket_ipv6(struct connection *c, int cc, int *sock, unsigned char
|
|||
if (rs) goto e;
|
||||
EINTRLOOP(rs, listen(s, 1));
|
||||
if (rs) goto e;
|
||||
snprintf(cast_char result, result_size, "|2|%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x|%d|",
|
||||
sprintf(cast_char result, "|2|%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x|%d|",
|
||||
sa.sin6_addr.s6_addr[0],
|
||||
sa.sin6_addr.s6_addr[1],
|
||||
sa.sin6_addr.s6_addr[2],
|
||||
|
@ -672,7 +672,7 @@ static void try_connect(struct connection *c)
|
|||
#if defined(__aarch64__) && defined(__ILP32__)
|
||||
errno = EINPROGRESS; /* arm64 ilp32 bug */
|
||||
#endif
|
||||
rs = connect(s, (struct sockaddr *)(void *)&sa, sizeof sa);
|
||||
EINTRLOOP(rs, connect(s, (struct sockaddr *)(void *)&sa, sizeof sa));
|
||||
#ifdef SUPPORT_IPV6
|
||||
} else if (addr->af == AF_INET6) {
|
||||
struct sockaddr_in6 sa;
|
||||
|
@ -686,14 +686,14 @@ static void try_connect(struct connection *c)
|
|||
#if defined(__aarch64__) && defined(__ILP32__)
|
||||
errno = EINPROGRESS; /* arm64 ilp32 bug */
|
||||
#endif
|
||||
rs = connect(s, (struct sockaddr *)(void *)&sa, sizeof sa);
|
||||
EINTRLOOP(rs, connect(s, (struct sockaddr *)(void *)&sa, sizeof sa));
|
||||
#endif
|
||||
} else {
|
||||
rs = -1;
|
||||
errno = EINVAL;
|
||||
}
|
||||
if (rs) {
|
||||
if (errno != EALREADY && errno != EINPROGRESS && errno != EINTR) {
|
||||
if (errno != EALREADY && errno != EINPROGRESS) {
|
||||
#ifdef BEOS
|
||||
if (errno == EWOULDBLOCK) errno = ETIMEDOUT;
|
||||
#endif
|
||||
|
|
106
default.c
106
default.c
|
@ -88,13 +88,13 @@ static void get_compiler_name(void)
|
|||
if (v1 == 4 && v2 < 5) v1 = 3;
|
||||
if (v1 == 4 && v2 == 5) v2 = 0;
|
||||
|
||||
if (!v3) snprintf(cast_char compiler_name, sizeof(compiler_name), "Borland C %d.%d", v1, v2);
|
||||
else snprintf(cast_char compiler_name, sizeof(compiler_name), "Borland C %d.%d.%d", v1, v2, v3);
|
||||
if (!v3) sprintf(cast_char compiler_name, "Borland C %d.%d", v1, v2);
|
||||
else sprintf(cast_char compiler_name, "Borland C %d.%d.%d", v1, v2, v3);
|
||||
|
||||
#elif defined(__clang__)
|
||||
|
||||
#if !defined(__clang_major__) || !defined(__clang_minor__)
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "LLVM/Clang");
|
||||
sprintf(cast_char compiler_name, "LLVM/Clang");
|
||||
#else
|
||||
int v1 = __clang_major__+0;
|
||||
int v2 = __clang_minor__+0;
|
||||
|
@ -103,8 +103,8 @@ static void get_compiler_name(void)
|
|||
#else
|
||||
int v3 = 0;
|
||||
#endif
|
||||
if (v3 > 0) snprintf(cast_char compiler_name, sizeof(compiler_name), "LLVM/Clang %d.%d.%d", v1, v2, v3);
|
||||
else snprintf(cast_char compiler_name, sizeof(compiler_name), "LLVM/Clang %d.%d", v1, v2);
|
||||
if (v3 > 0) sprintf(cast_char compiler_name, "LLVM/Clang %d.%d.%d", v1, v2, v3);
|
||||
else sprintf(cast_char compiler_name, "LLVM/Clang %d.%d", v1, v2);
|
||||
#endif
|
||||
|
||||
#elif defined(__COMO_VERSION__)
|
||||
|
@ -112,33 +112,33 @@ static void get_compiler_name(void)
|
|||
int w = __COMO_VERSION__+0;
|
||||
int v1 = w / 100;
|
||||
int v2 = w % 100;
|
||||
if (!(v2 % 10)) snprintf(cast_char compiler_name, sizeof(compiler_name), "Comeau C %d.%d", v1, v2 / 10);
|
||||
else snprintf(cast_char compiler_name, sizeof(compiler_name), "Comeau C %d.%02d", v1, v2);
|
||||
if (!(v2 % 10)) sprintf(cast_char compiler_name, "Comeau C %d.%d", v1, v2 / 10);
|
||||
else sprintf(cast_char compiler_name, "Comeau C %d.%02d", v1, v2);
|
||||
|
||||
#elif defined(__convexc__)
|
||||
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "Convex C");
|
||||
sprintf(cast_char compiler_name, "Convex C");
|
||||
|
||||
#elif defined(_CRAYC)
|
||||
|
||||
#if !defined(_RELEASE) || !defined(_RELEASE_MINOR)
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "Cray C");
|
||||
sprintf(cast_char compiler_name, "Cray C");
|
||||
#else
|
||||
int v1 = _RELEASE+0;
|
||||
int v2 = _RELEASE_MINOR+0;
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "Cray C %d.%d", v1, v2);
|
||||
sprintf(cast_char compiler_name, "Cray C %d.%d", v1, v2);
|
||||
#endif
|
||||
|
||||
#elif defined(__DCC__)
|
||||
|
||||
#ifndef __VERSION_NUMBER__
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "Diab C");
|
||||
sprintf(cast_char compiler_name, "Diab C");
|
||||
#else
|
||||
int w = __VERSION_NUMBER__+0;
|
||||
int v1 = w / 1000;
|
||||
int v2 = w / 100 % 10;
|
||||
int v3 = w % 100;
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "Diab C %d.%d.%02d", v1, v2, v3);
|
||||
sprintf(cast_char compiler_name, "Diab C %d.%d.%02d", v1, v2, v3);
|
||||
#endif
|
||||
|
||||
#elif defined(__DMC__)
|
||||
|
@ -147,8 +147,8 @@ static void get_compiler_name(void)
|
|||
int v1 = w / 0x100;
|
||||
int v2 = w / 0x10 % 0x10;
|
||||
int v3 = w % 0x10;
|
||||
if (!v3) snprintf(cast_char compiler_name, sizeof(compiler_name), "Digital Mars C %d.%d", v1, v2);
|
||||
else snprintf(cast_char compiler_name, sizeof(compiler_name), "Digital Mars C %d.%d.%d", v1, v2, v3);
|
||||
if (!v3) sprintf(cast_char compiler_name, "Digital Mars C %d.%d", v1, v2);
|
||||
else sprintf(cast_char compiler_name, "Digital Mars C %d.%d.%d", v1, v2, v3);
|
||||
|
||||
#elif defined(__DECC_VER)
|
||||
|
||||
|
@ -156,23 +156,23 @@ static void get_compiler_name(void)
|
|||
int v1 = w / 10000000;
|
||||
int v2 = w / 100000 % 100;
|
||||
int v3 = w % 10000;
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "DEC C %d.%d-%03d", v1, v2, v3);
|
||||
sprintf(cast_char compiler_name, "DEC C %d.%d-%03d", v1, v2, v3);
|
||||
|
||||
#elif defined(__ghs__)
|
||||
|
||||
#ifndef __GHS_VERSION_NUMBER__
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "Green Hill C");
|
||||
sprintf(cast_char compiler_name, "Green Hill C");
|
||||
#else
|
||||
int w = __GHS_VERSION_NUMBER__+0;
|
||||
int v1 = w / 100;
|
||||
int v2 = w / 10 % 10;
|
||||
int v3 = w % 10;
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "Green Hill C %d.%d.%d", v1, v2, v3);
|
||||
sprintf(cast_char compiler_name, "Green Hill C %d.%d.%d", v1, v2, v3);
|
||||
#endif
|
||||
|
||||
#elif defined(__HIGHC__)
|
||||
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "MetaWare High C");
|
||||
sprintf(cast_char compiler_name, "MetaWare High C");
|
||||
|
||||
#elif defined(__HP_cc)
|
||||
|
||||
|
@ -180,15 +180,15 @@ static void get_compiler_name(void)
|
|||
int v1 = w / 10000;
|
||||
int v2 = w / 100 % 100;
|
||||
int v3 = w % 100;
|
||||
if (w <= 1) snprintf(cast_char compiler_name, sizeof(compiler_name), "HP CC");
|
||||
else snprintf(cast_char compiler_name, sizeof(compiler_name), "HP CC %d.%02d.%02d", v1, v2, v3);
|
||||
if (w <= 1) sprintf(cast_char compiler_name, "HP CC");
|
||||
else sprintf(cast_char compiler_name, "HP CC %d.%02d.%02d", v1, v2, v3);
|
||||
|
||||
#elif defined(__xlc__)
|
||||
|
||||
int w = __xlc__+0;
|
||||
int v1 = w / 0x100;
|
||||
int v2 = w % 0x100;
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "IBM XL C %X.%X", v1, v2);
|
||||
sprintf(cast_char compiler_name, "IBM XL C %X.%X", v1, v2);
|
||||
|
||||
#elif defined(__IBMC__) && defined(__COMPILER_VER__)
|
||||
|
||||
|
@ -198,23 +198,23 @@ static void get_compiler_name(void)
|
|||
int v2 = w / 0x10000 % 0x100;
|
||||
int v3 = w % 0x10000;
|
||||
unsigned char *os = !v0 ? "S/370" : v0 == 1 ? "OS/390" : v0 == 4 ? "z/OS" : "";
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "IBM%s%s XL C %X.%0X.%X", *os ? " " : "", os, v1, v2, v3);
|
||||
sprintf(cast_char compiler_name, "IBM%s%s XL C %X.%0X.%X", *os ? " " : "", os, v1, v2, v3);
|
||||
|
||||
#elif defined(__ICC)
|
||||
|
||||
int w = __ICC+0;
|
||||
int v1 = w / 100;
|
||||
int v2 = w % 100;
|
||||
if (!(v2 % 10)) snprintf(cast_char compiler_name, sizeof(compiler_name), "Intel C %d.%d", v1, v2 / 10);
|
||||
else snprintf(cast_char compiler_name, sizeof(compiler_name), "Intel C %d.%02d", v1, v2);
|
||||
if (!(v2 % 10)) sprintf(cast_char compiler_name, "Intel C %d.%d", v1, v2 / 10);
|
||||
else sprintf(cast_char compiler_name, "Intel C %d.%02d", v1, v2);
|
||||
|
||||
#elif defined(__LCC__)
|
||||
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "LCC");
|
||||
sprintf(cast_char compiler_name, "LCC");
|
||||
|
||||
#elif defined(__NDPC__)
|
||||
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "Microway NDP C");
|
||||
sprintf(cast_char compiler_name, "Microway NDP C");
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
|
@ -227,8 +227,8 @@ static void get_compiler_name(void)
|
|||
if (v1 == 2) v1 = 1;
|
||||
visual = cast_uchar "Visual ";
|
||||
}
|
||||
if (!(v2 % 10)) snprintf(cast_char compiler_name, sizeof(compiler_name), "Microsoft %sC %d.%d", visual, v1, v2 / 10);
|
||||
else snprintf(cast_char compiler_name, sizeof(compiler_name), "Microsoft %sC %d.%02d", visual, v1, v2);
|
||||
if (!(v2 % 10)) sprintf(cast_char compiler_name, "Microsoft %sC %d.%d", visual, v1, v2 / 10);
|
||||
else sprintf(cast_char compiler_name, "Microsoft %sC %d.%02d", visual, v1, v2);
|
||||
|
||||
#elif defined(__MWERKS__)
|
||||
|
||||
|
@ -236,12 +236,12 @@ static void get_compiler_name(void)
|
|||
int v1 = w / 0x1000;
|
||||
int v2 = w / 0x100 % 0x10;
|
||||
int v3 = w % 0x100;
|
||||
if (w <= 1) snprintf(cast_char compiler_name, sizeof(compiler_name), "Metrowerks CodeWarrior");
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "Metrowerks CodeWarrior %x.%x.%x", v1, v2, v3);
|
||||
if (w <= 1) sprintf(cast_char compiler_name, "Metrowerks CodeWarrior");
|
||||
sprintf(cast_char compiler_name, "Metrowerks CodeWarrior %x.%x.%x", v1, v2, v3);
|
||||
|
||||
#elif defined(__NWCC__)
|
||||
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "NWCC");
|
||||
sprintf(cast_char compiler_name, "NWCC");
|
||||
|
||||
#elif defined(__OPEN64__)
|
||||
|
||||
|
@ -268,12 +268,12 @@ static void get_compiler_name(void)
|
|||
#else
|
||||
int v3 = 0;
|
||||
#endif
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "PCC %d.%d.%d", v1, v2, v3);
|
||||
sprintf(cast_char compiler_name, "PCC %d.%d.%d", v1, v2, v3);
|
||||
|
||||
#elif defined(__PGI) || defined(__PGIC__)
|
||||
|
||||
#if !defined(__PGIC__) || !defined(__PGIC_MINOR__)
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "The Portland Group C");
|
||||
sprintf(cast_char compiler_name, "The Portland Group C");
|
||||
#else
|
||||
int v1 = __PGIC__+0;
|
||||
int v2 = __PGIC_MINOR__+0;
|
||||
|
@ -282,8 +282,8 @@ static void get_compiler_name(void)
|
|||
#else
|
||||
int v3 = 0;
|
||||
#endif
|
||||
if (v3 > 0) snprintf(cast_char compiler_name, sizeof(compiler_name), "The Portland Group C %d.%d.%d", v1, v2, v3);
|
||||
else snprintf(cast_char compiler_name, sizeof(compiler_name), "The Portland Group C %d.%d", v1, v2);
|
||||
if (v3 > 0) sprintf(cast_char compiler_name, "The Portland Group C %d.%d.%d", v1, v2, v3);
|
||||
else sprintf(cast_char compiler_name, "The Portland Group C %d.%d", v1, v2);
|
||||
#endif
|
||||
|
||||
#elif defined(__SASC__)
|
||||
|
@ -291,7 +291,7 @@ static void get_compiler_name(void)
|
|||
int w = __SASC__+0;
|
||||
int v1 = w / 100;
|
||||
int v2 = w % 100;
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "SAS C %d.%02d", v1, v2);
|
||||
sprintf(cast_char compiler_name, "SAS C %d.%02d", v1, v2);
|
||||
|
||||
#elif (defined(__sgi) && defined(_COMPILER_VERSION)) || defined(_SGI_COMPILER_VERSION)
|
||||
|
||||
|
@ -303,7 +303,7 @@ static void get_compiler_name(void)
|
|||
int v1 = w / 100;
|
||||
int v2 = w / 10 % 10;
|
||||
int v3 = w % 10;
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "MIPSpro %d.%d.%d", v1, v2, v3);
|
||||
sprintf(cast_char compiler_name, "MIPSpro %d.%d.%d", v1, v2, v3);
|
||||
|
||||
#elif defined(__SUNPRO_C)
|
||||
|
||||
|
@ -313,8 +313,8 @@ static void get_compiler_name(void)
|
|||
int v1 = w / div;
|
||||
int v2 = w % div / 0x10;
|
||||
int v3 = w % 0x10;
|
||||
if (!v3) snprintf(cast_char compiler_name, sizeof(compiler_name), "Sun C %X.%0*X", v1, v2_digits, v2);
|
||||
else snprintf(cast_char compiler_name, sizeof(compiler_name), "Sun C %X.%0*X.%X", v1, v2_digits, v2, v3);
|
||||
if (!v3) sprintf(cast_char compiler_name, "Sun C %X.%0*X", v1, v2_digits, v2);
|
||||
else sprintf(cast_char compiler_name, "Sun C %X.%0*X.%X", v1, v2_digits, v2, v3);
|
||||
|
||||
#elif defined(__SYSC__) && defined(__SYSC_VER__)
|
||||
|
||||
|
@ -322,37 +322,37 @@ static void get_compiler_name(void)
|
|||
int v1 = w / 10000;
|
||||
int v2 = w / 100 % 100;
|
||||
int v3 = w % 100;
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "Dignus Systems C %d.%02d.%02d", v1, v2, v3);
|
||||
sprintf(cast_char compiler_name, "Dignus Systems C %d.%02d.%02d", v1, v2, v3);
|
||||
|
||||
#elif defined(__TenDRA__)
|
||||
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "TenDRA C");
|
||||
sprintf(cast_char compiler_name, "TenDRA C");
|
||||
|
||||
#elif defined(__TINYC__)
|
||||
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "Tiny C");
|
||||
sprintf(cast_char compiler_name, "Tiny C");
|
||||
|
||||
#elif defined(_UCC)
|
||||
|
||||
#if !defined(_MAJOR_REV) || !defined(_MINOR_REV)
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "Ultimate C");
|
||||
sprintf(cast_char compiler_name, "Ultimate C");
|
||||
#else
|
||||
int v1 = _MAJOR_REV+0;
|
||||
int v2 = _MAJOR_REV+0;
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "Ultimate C %d.%d", v1, v2);
|
||||
sprintf(cast_char compiler_name, "Ultimate C %d.%d", v1, v2);
|
||||
#endif
|
||||
|
||||
#elif defined(__USLC__)
|
||||
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "USL C");
|
||||
sprintf(cast_char compiler_name, "USL C");
|
||||
|
||||
#elif defined(__VAXC)
|
||||
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "VAX C");
|
||||
sprintf(cast_char compiler_name, "VAX C");
|
||||
|
||||
#elif defined(__VOSC__)
|
||||
|
||||
snprintf(cast_char compiler_name, sizeof(compiler_name), "Stratus VOS C");
|
||||
sprintf(cast_char compiler_name, "Stratus VOS C");
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
|
||||
|
@ -364,8 +364,8 @@ static void get_compiler_name(void)
|
|||
v1 -= 11;
|
||||
op = cast_uchar "Open";
|
||||
}
|
||||
if (!(v2 % 10)) snprintf(cast_char compiler_name, sizeof(compiler_name), "%sWatcom C %d.%d", op, v1, v2 / 10);
|
||||
else snprintf(cast_char compiler_name, sizeof(compiler_name), "%sWatcom C %d.%02d", op, v1, v2);
|
||||
if (!(v2 % 10)) sprintf(cast_char compiler_name, "%sWatcom C %d.%d", op, v1, v2 / 10);
|
||||
else sprintf(cast_char compiler_name, "%sWatcom C %d.%02d", op, v1, v2);
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
|
@ -385,10 +385,10 @@ static void get_compiler_name(void)
|
|||
#else
|
||||
unsigned char *prefix = cast_uchar "";
|
||||
#endif
|
||||
if (v1 == 2 && (v2 >= 90 && v2 <= 91)) snprintf(cast_char compiler_name, sizeof(compiler_name), "%sEGCS 1.%d", prefix, v2 - 90);
|
||||
else if (v3 > 0 && v2 >= 0) snprintf(cast_char compiler_name, sizeof(compiler_name), "%sGNU C %d.%d.%d", prefix, v1, v2, v3);
|
||||
else if (v2 >= 0) snprintf(cast_char compiler_name, sizeof(compiler_name), "%sGNU C %d.%d", prefix, v1, v2);
|
||||
else snprintf(cast_char compiler_name, sizeof(compiler_name), "%sGNU C %d", prefix, v1);
|
||||
if (v1 == 2 && (v2 >= 90 && v2 <= 91)) sprintf(cast_char compiler_name, "%sEGCS 1.%d", prefix, v2 - 90);
|
||||
else if (v3 > 0 && v2 >= 0) sprintf(cast_char compiler_name, "%sGNU C %d.%d.%d", prefix, v1, v2, v3);
|
||||
else if (v2 >= 0) sprintf(cast_char compiler_name, "%sGNU C %d.%d", prefix, v1, v2);
|
||||
else sprintf(cast_char compiler_name, "%sGNU C %d", prefix, v1);
|
||||
|
||||
#else
|
||||
|
||||
|
|
2
dns.c
2
dns.c
|
@ -773,7 +773,7 @@ int ipv6_full_access(void)
|
|||
sin6.sin6_family = AF_INET6;
|
||||
sin6.sin6_port = htons(1024);
|
||||
memcpy(&sin6.sin6_addr.s6_addr, "\052\001\004\060\000\015\000\000\002\314\236\377\376\044\176\032", 16);
|
||||
c = blocking_connect(h, (struct sockaddr *)(void *)&sin6, sizeof sin6);
|
||||
EINTRLOOP(c, connect(h, (struct sockaddr *)(void *)&sin6, sizeof sin6));
|
||||
EINTRLOOP(rs, close(h));
|
||||
if (!c) return 1;
|
||||
#endif
|
||||
|
|
6
error.c
6
error.c
|
@ -412,14 +412,14 @@ void int_error(const char *m, ...)
|
|||
#else
|
||||
va_list l;
|
||||
|
||||
snprintf(cast_char errbuf, sizeof(errbuf), "Internal error at %s:%d\r\n%s", errfile, errline, m);
|
||||
sprintf(cast_char errbuf, "Internal error at %s:%d\r\n%s", errfile, errline, m);
|
||||
va_start(l, m);
|
||||
os_report_error_va("Internal error", cast_const_char errbuf, l);
|
||||
va_end(l);
|
||||
|
||||
fatal_tty_exit();
|
||||
|
||||
snprintf(cast_char errbuf, sizeof(errbuf), "\n"ANSI_SET_BOLD"INTERNAL ERROR"ANSI_CLEAR_BOLD" at %s:%d: %s", errfile, errline, m);
|
||||
sprintf(cast_char errbuf, "\n"ANSI_SET_BOLD"INTERNAL ERROR"ANSI_CLEAR_BOLD" at %s:%d: %s", errfile, errline, m);
|
||||
va_start(l, m);
|
||||
er(1, cast_char errbuf, l);
|
||||
va_end(l);
|
||||
|
@ -433,7 +433,7 @@ void debug_msg(const char *m, ...)
|
|||
{
|
||||
va_list l;
|
||||
va_start(l, m);
|
||||
snprintf(cast_char errbuf, sizeof(errbuf), "\nDEBUG MESSAGE at %s:%d: %s", errfile, errline, m);
|
||||
sprintf(cast_char errbuf, "\nDEBUG MESSAGE at %s:%d: %s", errfile, errline, m);
|
||||
er(0, cast_char errbuf, l);
|
||||
va_end(l);
|
||||
}
|
||||
|
|
10
file.c
10
file.c
|
@ -104,7 +104,7 @@ static void stat_links(unsigned char **p, int *l, struct stat *stp)
|
|||
unsigned char lnk[64];
|
||||
if (!stp) add_to_str(p, l, cast_uchar " ");
|
||||
else {
|
||||
snprintf(cast_char lnk, sizeof(lnk), "%3ld ", (unsigned long)stp->st_nlink);
|
||||
sprintf(cast_char lnk, "%3ld ", (unsigned long)stp->st_nlink);
|
||||
add_to_str(p, l, lnk);
|
||||
}
|
||||
#endif
|
||||
|
@ -136,13 +136,13 @@ static void stat_user(unsigned char **p, int *l, struct stat *stp, int g)
|
|||
if (g && id == last_gid && last_gid != -1) goto a;
|
||||
if (!g) {
|
||||
ENULLLOOP(pwd, getpwuid(id));
|
||||
if (!pwd || !pwd->pw_name) snprintf(cast_char pp, sizeof(last_user), "%d", id);
|
||||
else snprintf(cast_char pp, sizeof(last_user), "%.8s", pwd->pw_name);
|
||||
if (!pwd || !pwd->pw_name) sprintf(cast_char pp, "%d", id);
|
||||
else sprintf(cast_char pp, "%.8s", pwd->pw_name);
|
||||
last_uid = id;
|
||||
} else {
|
||||
ENULLLOOP(grp, getgrgid(id));
|
||||
if (!grp || !grp->gr_name) snprintf(cast_char pp, sizeof(last_group), "%d", id);
|
||||
else snprintf(cast_char pp, sizeof(last_group), "%.8s", grp->gr_name);
|
||||
if (!grp || !grp->gr_name) sprintf(cast_char pp, "%d", id);
|
||||
else sprintf(cast_char pp, "%.8s", grp->gr_name);
|
||||
last_gid = id;
|
||||
}
|
||||
a:
|
||||
|
|
6
ftp.c
6
ftp.c
|
@ -250,7 +250,7 @@ static struct ftp_connection_info *add_file_cmd_to_str(struct connection *c, int
|
|||
int ps;
|
||||
#ifdef SUPPORT_IPV6
|
||||
if (is_ipv6(c->sock1)) {
|
||||
ps = get_pasv_socket_ipv6(c, c->sock1, &c->sock2, port_string, sizeof(port_string));
|
||||
ps = get_pasv_socket_ipv6(c, c->sock1, &c->sock2, port_string);
|
||||
if (ps) {
|
||||
mem_free(d);
|
||||
mem_free(s);
|
||||
|
@ -267,9 +267,9 @@ static struct ftp_connection_info *add_file_cmd_to_str(struct connection *c, int
|
|||
return NULL;
|
||||
}
|
||||
if (inf->eprt_epsv)
|
||||
snprintf(cast_char port_string, sizeof(port_string), "|1|%d.%d.%d.%d|%d|", pc[0], pc[1], pc[2], pc[3], (pc[4] << 8) | pc[5]);
|
||||
sprintf(cast_char port_string, "|1|%d.%d.%d.%d|%d|", pc[0], pc[1], pc[2], pc[3], (pc[4] << 8) | pc[5]);
|
||||
else
|
||||
snprintf(cast_char port_string, sizeof(port_string), "%d,%d,%d,%d,%d,%d", pc[0], pc[1], pc[2], pc[3], pc[4], pc[5]);
|
||||
sprintf(cast_char port_string, "%d,%d,%d,%d,%d,%d", pc[0], pc[1], pc[2], pc[3], pc[4], pc[5]);
|
||||
}
|
||||
if (strlen(cast_const_char port_string) >= sizeof(port_string))
|
||||
internal_error("buffer overflow in get_pasv_socket_ipv6: %d > %d", (int)strlen(cast_const_char port_string), (int)sizeof(port_string));
|
||||
|
|
2
html.c
2
html.c
|
@ -1633,7 +1633,7 @@ static void html_li(unsigned char *a)
|
|||
unsigned char *x;
|
||||
for (x = n; *x; x++) *x = upcase(*x);
|
||||
}
|
||||
} else snprintf(cast_char n, sizeof(n), "%d", par_format.list_number);
|
||||
} else sprintf(cast_char n, "%d", par_format.list_number);
|
||||
put_chrs(n, (int)strlen(cast_const_char n));
|
||||
put_chrs(cast_uchar ". ", 7);
|
||||
if (!F) par_format.leftmargin += (int)strlen(cast_const_char n) + c + 2;
|
||||
|
|
|
@ -620,7 +620,7 @@ static struct table *parse_table(unsigned char *html, unsigned char *eof, unsign
|
|||
mem_free(a);
|
||||
}
|
||||
#ifdef G
|
||||
snprintf(cast_char cell->bgcolor_str, sizeof(cell->bgcolor_str), "#%02x%02x%02x", cell->bgcolor.r & 0xff, cell->bgcolor.g & 0xff, cell->bgcolor.b & 0xff);
|
||||
sprintf(cast_char cell->bgcolor_str, "#%02x%02x%02x", cell->bgcolor.r & 0xff, cell->bgcolor.g & 0xff, cell->bgcolor.b & 0xff);
|
||||
#endif
|
||||
if ((csp = get_num(t_attr, cast_uchar "colspan")) == -1) csp = 1;
|
||||
if (!csp) csp = -1;
|
||||
|
@ -1805,8 +1805,8 @@ void table_bg(struct text_attrib *ta, unsigned char bgstr[8])
|
|||
if (ta->fg.g > max) max = ta->fg.g;
|
||||
if (ta->fg.b > max) max = ta->fg.b;
|
||||
max &= 0xff;
|
||||
snprintf(cast_char bgstr, 8, "#%02x%02x%02x", max, max, max);
|
||||
} else snprintf(cast_char bgstr, 8, "#%02x%02x%02x", G_HTML_TABLE_FRAME_COLOR, G_HTML_TABLE_FRAME_COLOR, G_HTML_TABLE_FRAME_COLOR);
|
||||
sprintf(cast_char bgstr, "#%02x%02x%02x", max, max, max);
|
||||
} else sprintf(cast_char bgstr, "#%02x%02x%02x", G_HTML_TABLE_FRAME_COLOR, G_HTML_TABLE_FRAME_COLOR, G_HTML_TABLE_FRAME_COLOR);
|
||||
}
|
||||
|
||||
static void g_new_tag(struct table *t, unsigned char *name, int x, int y)
|
||||
|
|
2
http.c
2
http.c
|
@ -353,7 +353,7 @@ static void add_url_to_str(unsigned char **str, int *l, unsigned char *url)
|
|||
for (sp = url; *sp && *sp != POST_CHAR; sp++) {
|
||||
if (*sp <= ' ' || *sp >= 127) {
|
||||
unsigned char esc[4];
|
||||
snprintf(cast_char esc, 4, "%%%02X", (int)*sp);
|
||||
sprintf(cast_char esc, "%%%02X", (int)*sp);
|
||||
add_to_str(str, l, esc);
|
||||
} else {
|
||||
add_chr_to_str(str, l, *sp);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* (c) 2002 Mikulas Patocka
|
||||
* This file is a part of the Links program, released under GPL.
|
||||
*/
|
||||
#include <langinfo.h>
|
||||
|
||||
#include "links.h"
|
||||
|
||||
|
@ -130,6 +131,8 @@ int get_default_charset(void)
|
|||
lang = cast_uchar getenv("LC_CTYPE");
|
||||
if (!lang)
|
||||
lang = cast_uchar getenv("LANG");
|
||||
if (!lang)
|
||||
lang = cast_uchar nl_langinfo(CODESET);
|
||||
if (!lang) {
|
||||
i = 0;
|
||||
goto ret_i;
|
||||
|
|
3
links.h
3
links.h
|
@ -1140,7 +1140,6 @@ extern int terminate_loop;
|
|||
int can_write(int fd);
|
||||
int can_read(int fd);
|
||||
int can_read_timeout(int fd, int sec);
|
||||
int blocking_connect(int fd, struct sockaddr *addr, socklen_t addrlen);
|
||||
int close_std_handle(int);
|
||||
void restore_std_handle(int, int);
|
||||
unsigned long select_info(int);
|
||||
|
@ -1582,7 +1581,7 @@ void continue_connection(struct connection *, int *, void (*)(struct connection
|
|||
int is_ipv6(int);
|
||||
int get_pasv_socket(struct connection *, int, int *, unsigned char *);
|
||||
#ifdef SUPPORT_IPV6
|
||||
int get_pasv_socket_ipv6(struct connection *, int, int *, unsigned char *, size_t);
|
||||
int get_pasv_socket_ipv6(struct connection *, int, int *, unsigned char *);
|
||||
#endif
|
||||
void write_to_socket(struct connection *, int, unsigned char *, int, void (*)(struct connection *));
|
||||
struct read_buffer *alloc_read_buffer(struct connection *c);
|
||||
|
|
4
menu.c
4
menu.c
|
@ -3872,8 +3872,8 @@ static void dlg_resize_terminal(struct terminal *term, void *xxx, void *ses_)
|
|||
struct dialog *d;
|
||||
unsigned x = (unsigned)term->x > 999 ? 999 : term->x;
|
||||
unsigned y = (unsigned)term->y > 999 ? 999 : term->y;
|
||||
snprintf(cast_char x_str, sizeof(x_str), "%u", x);
|
||||
snprintf(cast_char y_str, sizeof(y_str), "%u", y);
|
||||
sprintf(cast_char x_str, "%u", x);
|
||||
sprintf(cast_char y_str, "%u", y);
|
||||
d = mem_calloc(sizeof(struct dialog) + 4 * sizeof(struct dialog_item));
|
||||
d->title = TEXT_(T_RESIZE_TERMINAL);
|
||||
d->fn = group_fn;
|
||||
|
|
8
os_dep.c
8
os_dep.c
|
@ -3434,14 +3434,6 @@ int os_default_charset(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// PATCH: Always use UTF-8 instead of language-specific terminal charsets
|
||||
#elif defined(__sortix__)
|
||||
|
||||
int os_default_charset(void)
|
||||
{
|
||||
return utf8_table;
|
||||
}
|
||||
|
||||
#elif !defined(DOS)
|
||||
|
||||
int os_default_charset(void)
|
||||
|
|
16
select.c
16
select.c
|
@ -125,22 +125,6 @@ int can_read(int fd)
|
|||
}
|
||||
|
||||
|
||||
// PATCH: Handle connect not being restartable
|
||||
int blocking_connect(int fd, struct sockaddr *addr, socklen_t addrlen)
|
||||
{
|
||||
int connect_error;
|
||||
socklen_t len = sizeof(int);
|
||||
|
||||
if (!connect(fd, addr, addrlen)) return 0;
|
||||
if (errno != EINTR) return -1;
|
||||
|
||||
can_do_io(fd, 1, -1); // Wait until connected/failed
|
||||
getsockopt(fd, SOL_SOCKET, SO_ERROR, &connect_error, &len);
|
||||
errno = connect_error;
|
||||
return !connect_error ? 0 : -1;
|
||||
}
|
||||
|
||||
|
||||
int close_std_handle(int std)
|
||||
{
|
||||
#ifndef DOS
|
||||
|
|
|
@ -192,10 +192,10 @@ static void add_xnum_to_str(unsigned char **s, int *l, off_t n)
|
|||
static void add_time_to_str(unsigned char **s, int *l, uttime t)
|
||||
{
|
||||
unsigned char q[64];
|
||||
if (t >= 86400) snprintf(cast_char q, sizeof(q), "%lud ", (unsigned long)(t / 86400)), add_to_str(s, l, q);
|
||||
if (t >= 3600) t %= 86400, snprintf(cast_char q, sizeof(q), "%d:%02d", (int)(t / 3600), (int)(t / 60 % 60)), add_to_str(s, l, q);
|
||||
else snprintf(cast_char q, sizeof(q), "%d", (int)(t / 60)), add_to_str(s, l, q);
|
||||
snprintf(cast_char q, sizeof(q), ":%02d", (int)(t % 60)), add_to_str(s, l, q);
|
||||
if (t >= 86400) sprintf(cast_char q, "%lud ", (unsigned long)(t / 86400)), add_to_str(s, l, q);
|
||||
if (t >= 3600) t %= 86400, sprintf(cast_char q, "%d:%02d", (int)(t / 3600), (int)(t / 60 % 60)), add_to_str(s, l, q);
|
||||
else sprintf(cast_char q, "%d", (int)(t / 60)), add_to_str(s, l, q);
|
||||
sprintf(cast_char q, ":%02d", (int)(t % 60)), add_to_str(s, l, q);
|
||||
}
|
||||
|
||||
static unsigned char *get_stat_msg(struct status *stat, struct terminal *term)
|
||||
|
|
57
sortix.c
57
sortix.c
|
@ -22,6 +22,7 @@ struct window_data
|
|||
{
|
||||
uint32_t window_id;
|
||||
int modifiers;
|
||||
uint32_t *buffer;
|
||||
};
|
||||
|
||||
static int default_window_width = 600;
|
||||
|
@ -111,6 +112,10 @@ static void on_resize(void *ctx, uint32_t window_id, uint32_t width, uint32_t he
|
|||
|
||||
if (!width || !height) return;
|
||||
|
||||
free(window_data->buffer);
|
||||
// TODO: Overflow when multiplying
|
||||
window_data->buffer = mem_alloc(width * height * sizeof(uint32_t));
|
||||
|
||||
current_dev->size.x2 = width;
|
||||
current_dev->size.y2 = height;
|
||||
if (current_dev->resize_handler)
|
||||
|
@ -155,6 +160,7 @@ static unsigned char *sortix_init_driver(unsigned char *param, unsigned char *di
|
|||
|
||||
static struct graphics_device *sortix_init_device(void)
|
||||
{
|
||||
// TODO: Multi-window support
|
||||
struct graphics_device *dev = mem_calloc(sizeof(struct graphics_device));
|
||||
|
||||
dev->size.x1 = 0;
|
||||
|
@ -167,6 +173,8 @@ static struct graphics_device *sortix_init_device(void)
|
|||
struct window_data *window_data = mem_calloc(sizeof(struct window_data));
|
||||
dev->driver_data = window_data;
|
||||
window_data->window_id = 0;
|
||||
// TODO: Overflow when multiplying
|
||||
window_data->buffer = mem_alloc(default_window_width * default_window_height * sizeof(uint32_t));
|
||||
|
||||
display_create_window(connection, window_data->window_id);
|
||||
display_resize_window(connection, window_data->window_id, dev->size.x2, dev->size.y2);
|
||||
|
@ -181,6 +189,7 @@ static void sortix_shutdown_device(struct graphics_device *dev)
|
|||
{
|
||||
struct window_data *window_data = dev->driver_data;
|
||||
display_destroy_window(connection, window_data->window_id);
|
||||
free(window_data->buffer);
|
||||
free(window_data);
|
||||
}
|
||||
|
||||
|
@ -234,61 +243,61 @@ static void sortix_unregister_bitmap(struct bitmap *bmp)
|
|||
mem_free(bmp->data);
|
||||
}
|
||||
|
||||
static void sortix_draw_bitmap(struct graphics_device *dev, struct bitmap *bmp, int x1, int y1)
|
||||
static void sortix_draw_bitmap(struct graphics_device *dev, struct bitmap *bmp, int x, int y)
|
||||
{
|
||||
struct window_data *window_data = dev->driver_data;
|
||||
CLIP_DRAW_BITMAP
|
||||
|
||||
size_t width = bmp->x;
|
||||
size_t height = bmp->y;
|
||||
struct window_data *window_data = dev->driver_data;
|
||||
int pitch = dev->size.x2;
|
||||
|
||||
int width = bmp->x;
|
||||
int height = bmp->y;
|
||||
if (!width || !height)
|
||||
return;
|
||||
// TODO: Overflow when multiplying
|
||||
uint32_t *buffer = mem_alloc(width * height * sizeof(uint32_t));
|
||||
|
||||
for (size_t y = 0; y < height; y++) {
|
||||
for (size_t x = 0; x < width; x++) {
|
||||
void *pixel_data = ((unsigned char*)bmp->data) + y * bmp->skip + x * sizeof(uint32_t);
|
||||
for (int bitmap_y = 0; bitmap_y < height; bitmap_y++) {
|
||||
for (int bitmap_x = 0; bitmap_x < width; bitmap_x++) {
|
||||
void *pixel_data = ((unsigned char*)bmp->data) + bitmap_y * bmp->skip + bitmap_x * sizeof(uint32_t);
|
||||
uint32_t pixel;
|
||||
memcpy(&pixel, pixel_data, sizeof(uint32_t));
|
||||
// Set alpha (see sortix_fill_area() for more details)
|
||||
pixel |= 0xff000000;
|
||||
buffer[y * width + x] = pixel;
|
||||
window_data->buffer[(y + bitmap_y) * pitch + x + bitmap_x] = pixel;
|
||||
}
|
||||
}
|
||||
display_render_window(connection, window_data->window_id, x1, y1, width, height, buffer);
|
||||
free(buffer);
|
||||
|
||||
display_render_window(connection, window_data->window_id, 0, 0, dev->size.x2, dev->size.y2, window_data->buffer);
|
||||
}
|
||||
|
||||
static void sortix_fill_area(struct graphics_device *dev, int x1, int y1, int x2, int y2, long color)
|
||||
{
|
||||
struct window_data *window_data = dev->driver_data;
|
||||
CLIP_FILL_AREA
|
||||
|
||||
size_t width = x2 - x1;
|
||||
size_t height = y2 - y1;
|
||||
if (!width || !height)
|
||||
return;
|
||||
// TODO: Overflow when multiplying
|
||||
uint32_t *buffer = mem_alloc(width * height * sizeof(uint32_t));
|
||||
struct window_data *window_data = dev->driver_data;
|
||||
int pitch = dev->size.x2;
|
||||
|
||||
// Links uses a pixel format where the top byte is clear
|
||||
// Sortix stores alpha there, so set it to 255
|
||||
uint32_t pixel = color | 0xff000000;
|
||||
|
||||
for (size_t y = 0; y < height; y++) {
|
||||
for (size_t x = 0; x < width; x++)
|
||||
buffer[y * width + x] = pixel;
|
||||
for (int y = y1; y < y2; y++) {
|
||||
for (int x = x1; x < x2; x++) {
|
||||
window_data->buffer[y * pitch + x] = pixel;
|
||||
}
|
||||
}
|
||||
display_render_window(connection, window_data->window_id, x1, y1, width, height, buffer);
|
||||
free(buffer);
|
||||
|
||||
display_render_window(connection, window_data->window_id, 0, 0, dev->size.x2, dev->size.y2, window_data->buffer);
|
||||
}
|
||||
|
||||
static void sortix_draw_hline(struct graphics_device *dev, int x1, int y, int x2, long color)
|
||||
{
|
||||
CLIP_DRAW_HLINE
|
||||
sortix_fill_area(dev, x1, y, x2, y + 1, color);
|
||||
}
|
||||
|
||||
static void sortix_draw_vline(struct graphics_device *dev, int x, int y1, int y2, long color)
|
||||
{
|
||||
CLIP_DRAW_VLINE
|
||||
sortix_fill_area(dev, x, y1, x + 1, y2, color);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
NAME=links
|
||||
BUILD_LIBRARIES='libbrotli? libevent? libjpeg libpng librsvg? libssl libtiff? libz? libzstd? lzip? openmp? xz?'
|
||||
BUILD_SYSTEM=configure
|
||||
LOCATION_INDEPENDENT=true
|
|
@ -1,7 +0,0 @@
|
|||
tix.version=1
|
||||
tix.class=srctix
|
||||
pkg.name=links
|
||||
pkg.build-libraries=libjpeg libpng libssl libz libevent? librsvg? libtiff? xz?
|
||||
pkg.build-system=configure
|
||||
pkg.configure.args=--enable-graphics
|
||||
pkg.location-independent=true
|
6
url.c
6
url.c
|
@ -336,7 +336,7 @@ static unsigned char *translate_hashbang(unsigned char *up)
|
|||
unsigned char c = *dp;
|
||||
if (c <= 0x20 || c == 0x23 || c == 0x25 || c == 0x26 || c == 0x2b || c >= 0x7f) {
|
||||
unsigned char h[4];
|
||||
snprintf(cast_char h, 4, "%%%02X", c);
|
||||
sprintf(cast_char h, "%%%02X", c);
|
||||
add_to_str(&r, &rl, h);
|
||||
} else {
|
||||
add_chr_to_str(&r, &rl, c);
|
||||
|
@ -501,7 +501,7 @@ static void insert_wd(unsigned char **up, unsigned char *cwd)
|
|||
unsigned char c = *cw;
|
||||
if (c < ' ' || c == '%' || c >= 127) {
|
||||
unsigned char h[4];
|
||||
snprintf(cast_char h, 4, "%%%02X", (unsigned)c & 0xff);
|
||||
sprintf(cast_char h, "%%%02X", (unsigned)c & 0xff);
|
||||
add_to_str(&url, &url_l, h);
|
||||
} else {
|
||||
add_chr_to_str(&url, &url_l, c);
|
||||
|
@ -749,7 +749,7 @@ void add_conv_str(unsigned char **s, int *l, unsigned char *b, int ll, int encod
|
|||
if (!chr) continue;
|
||||
if (special_char(chr) && encode_special == 1) {
|
||||
unsigned char h[4];
|
||||
snprintf(cast_char h, 4, "%%%02X", (unsigned)chr & 0xff);
|
||||
sprintf(cast_char h, "%%%02X", (unsigned)chr & 0xff);
|
||||
add_to_str(s, l, h);
|
||||
continue;
|
||||
}
|
||||
|
|
4
view.c
4
view.c
|
@ -2035,7 +2035,7 @@ static void encode_string(unsigned char *name, unsigned char **data, int *len)
|
|||
else if (safe_char(*name)) add_chr_to_str(data, len, *name);
|
||||
else {
|
||||
unsigned char n[4];
|
||||
snprintf(cast_char n, 4, "%%%02X", *name);
|
||||
sprintf(cast_char n, "%%%02X", *name);
|
||||
add_to_str(data, len, n);
|
||||
}
|
||||
}
|
||||
|
@ -2270,7 +2270,7 @@ unsigned char *get_form_url(struct session *ses, struct f_data_c *f, struct form
|
|||
}
|
||||
for (i = 0; i < len; i++) {
|
||||
unsigned char p[3];
|
||||
snprintf(cast_char p, 3, "%02x", (int)data[i]);
|
||||
sprintf(cast_char p, "%02x", (int)data[i]);
|
||||
add_to_str(&go, &l, p);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue