You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(35) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(37) |
Feb
(10) |
Mar
|
Apr
(2) |
May
(17) |
Jun
(1) |
Jul
(14) |
Aug
(14) |
Sep
(4) |
Oct
|
Nov
(14) |
Dec
(4) |
2005 |
Jan
(6) |
Feb
|
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
(92) |
Dec
(12) |
2006 |
Jan
(3) |
Feb
(4) |
Mar
|
Apr
(5) |
May
(3) |
Jun
(15) |
Jul
(3) |
Aug
(1) |
Sep
(29) |
Oct
(1) |
Nov
(6) |
Dec
(5) |
2007 |
Jan
(2) |
Feb
(2) |
Mar
|
Apr
(3) |
May
(14) |
Jun
(2) |
Jul
(16) |
Aug
(73) |
Sep
(12) |
Oct
(9) |
Nov
(27) |
Dec
(3) |
2008 |
Jan
(4) |
Feb
(4) |
Mar
(3) |
Apr
(8) |
May
(23) |
Jun
(4) |
Jul
(1) |
Aug
(3) |
Sep
(7) |
Oct
(5) |
Nov
(1) |
Dec
(1) |
2009 |
Jan
|
Feb
(10) |
Mar
|
Apr
(4) |
May
(4) |
Jun
(10) |
Jul
|
Aug
(1) |
Sep
|
Oct
(7) |
Nov
|
Dec
(1) |
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
|
Jun
(3) |
Jul
(11) |
Aug
(1) |
Sep
|
Oct
(15) |
Nov
(1) |
Dec
(5) |
2011 |
Jan
(4) |
Feb
(1) |
Mar
(6) |
Apr
|
May
(22) |
Jun
|
Jul
(8) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2012 |
Jan
|
Feb
(10) |
Mar
(1) |
Apr
(6) |
May
(27) |
Jun
(48) |
Jul
(30) |
Aug
(4) |
Sep
|
Oct
(3) |
Nov
(1) |
Dec
(11) |
2013 |
Jan
(4) |
Feb
(7) |
Mar
(6) |
Apr
(18) |
May
(28) |
Jun
(20) |
Jul
|
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(7) |
2014 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(9) |
May
(11) |
Jun
(10) |
Jul
|
Aug
(18) |
Sep
(12) |
Oct
(17) |
Nov
(10) |
Dec
(16) |
2015 |
Jan
(5) |
Feb
(1) |
Mar
(5) |
Apr
(4) |
May
(28) |
Jun
(2) |
Jul
|
Aug
|
Sep
(6) |
Oct
|
Nov
(2) |
Dec
(1) |
2016 |
Jan
(14) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(1) |
2017 |
Jan
(11) |
Feb
|
Mar
(21) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
(4) |
Oct
(4) |
Nov
|
Dec
(1) |
2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(13) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
2020 |
Jan
(10) |
Feb
(9) |
Mar
(5) |
Apr
(4) |
May
(3) |
Jun
(18) |
Jul
(4) |
Aug
(2) |
Sep
(20) |
Oct
(2) |
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2022 |
Jan
(1) |
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
2023 |
Jan
(10) |
Feb
(7) |
Mar
(29) |
Apr
(31) |
May
(29) |
Jun
(34) |
Jul
(3) |
Aug
(24) |
Sep
(22) |
Oct
(10) |
Nov
(38) |
Dec
(27) |
2024 |
Jan
(15) |
Feb
(8) |
Mar
(4) |
Apr
(20) |
May
(33) |
Jun
(18) |
Jul
(15) |
Aug
(23) |
Sep
(26) |
Oct
(32) |
Nov
(6) |
Dec
(4) |
2025 |
Jan
(7) |
Feb
(1) |
Mar
(1) |
Apr
(4) |
May
(46) |
Jun
(19) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ljs...@us...> - 2012-05-24 00:48:43
|
Revision: 767 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=767&view=rev Author: ljsebald Date: 2012-05-24 00:48:37 +0000 (Thu, 24 May 2012) Log Message: ----------- Make dbgio_enable() and dbgio_disable() actually do something useful. Modified Paths: -------------- kos/kernel/debug/dbgio.c Modified: kos/kernel/debug/dbgio.c =================================================================== --- kos/kernel/debug/dbgio.c 2012-05-24 00:00:39 UTC (rev 766) +++ kos/kernel/debug/dbgio.c 2012-05-24 00:48:37 UTC (rev 767) @@ -82,43 +82,75 @@ } int dbgio_set_irq_usage(int mode) { - assert( dbgio ); - return dbgio->set_irq_usage(mode); + if(dbgio_enabled) { + assert( dbgio ); + return dbgio->set_irq_usage(mode); + } + + return -1; } int dbgio_read() { - assert( dbgio ); - return dbgio->read(); + if(dbgio_enabled) { + assert( dbgio ); + return dbgio->read(); + } + + return -1; } int dbgio_write(int c) { - assert( dbgio ); - return dbgio->write(c); + if(dbgio_enabled) { + assert( dbgio ); + return dbgio->write(c); + } + + return -1; } int dbgio_flush() { - assert( dbgio ); - return dbgio->flush(); + if(dbgio_enabled) { + assert( dbgio ); + return dbgio->flush(); + } + + return -1; } int dbgio_write_buffer(const uint8 *data, int len) { - assert( dbgio ); - return dbgio->write_buffer(data, len, 0); + if(dbgio_enabled) { + assert( dbgio ); + return dbgio->write_buffer(data, len, 0); + } + + return -1; } int dbgio_read_buffer(uint8 *data, int len) { - assert( dbgio ); - return dbgio->read_buffer(data, len); + if(dbgio_enabled) { + assert( dbgio ); + return dbgio->read_buffer(data, len); + } + + return -1; } int dbgio_write_buffer_xlat(const uint8 *data, int len) { - assert( dbgio ); - return dbgio->write_buffer(data, len, 1); + if(dbgio_enabled) { + assert( dbgio ); + return dbgio->write_buffer(data, len, 1); + } + + return -1; } int dbgio_write_str(const char *str) { - assert( dbgio ); - return dbgio_write_buffer_xlat((const uint8*)str, strlen(str)); + if(dbgio_enabled) { + assert( dbgio ); + return dbgio_write_buffer_xlat((const uint8*)str, strlen(str)); + } + + return -1; } // Not re-entrant This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-05-24 00:00:45
|
Revision: 766 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=766&view=rev Author: ljsebald Date: 2012-05-24 00:00:39 +0000 (Thu, 24 May 2012) Log Message: ----------- Move the hop limit calculation up earlier in the IPv6 packet send function. This way, if we revert to IPv4, we have a sane ttl when the incoming hop limit was 0. Modified Paths: -------------- kos/kernel/net/net_ipv6.c Modified: kos/kernel/net/net_ipv6.c =================================================================== --- kos/kernel/net/net_ipv6.c 2012-05-23 23:59:15 UTC (rev 765) +++ kos/kernel/net/net_ipv6.c 2012-05-24 00:00:39 UTC (rev 766) @@ -131,6 +131,16 @@ } } + /* Set up the hop limit. We need to do this here, in case we end up passing + this off to the IPv4 code, otherwise we could end up with a 0 down there + for the ttl, which would be bad. */ + if(!hop_limit) { + if(net->hop_limit) + hop_limit = net->hop_limit; + else + hop_limit = 255; + } + /* If this is actually going both to and from an IPv4 address, use the IPv4 send function to do the rest. Note that only V4-mapped addresses are supported here (::ffff:x.y.z.w) */ @@ -149,17 +159,7 @@ hdr.lclass = 0; hdr.length = ntohs(data_size); hdr.next_header = proto; - - if(hop_limit) { - hdr.hop_limit = hop_limit; - } - else if(net->hop_limit) { - hdr.hop_limit = net->hop_limit; - } - else { - hdr.hop_limit = 255; - } - + hdr.hop_limit = hop_limit; hdr.src_addr = *src; hdr.dst_addr = *dst; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-05-23 23:59:21
|
Revision: 765 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=765&view=rev Author: ljsebald Date: 2012-05-23 23:59:15 +0000 (Wed, 23 May 2012) Log Message: ----------- Actually do 10 pings, like the comment says. Modified Paths: -------------- kos/examples/dreamcast/network/ping6/ping.c Modified: kos/examples/dreamcast/network/ping6/ping.c =================================================================== --- kos/examples/dreamcast/network/ping6/ping.c 2012-05-23 23:58:16 UTC (rev 764) +++ kos/examples/dreamcast/network/ping6/ping.c 2012-05-23 23:59:15 UTC (rev 765) @@ -60,7 +60,7 @@ printf("PING6 %s --> %s\n", str1, str2); /* Send out 10 pings, waiting 250ms between attempts. */ - for(i = 0; i < 2; ++i) { + for(i = 0; i < 10; ++i) { net_icmp6_send_echo(net_default_dev, &addr, 0, i, data, DATA_SIZE); thd_sleep(250); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-05-23 23:58:22
|
Revision: 764 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=764&view=rev Author: ljsebald Date: 2012-05-23 23:58:16 +0000 (Wed, 23 May 2012) Log Message: ----------- Disable the dbgio interface when dclsocket is enabled, not when its disabled. Modified Paths: -------------- kos/kernel/arch/dreamcast/fs/fs_dclsocket.c Modified: kos/kernel/arch/dreamcast/fs/fs_dclsocket.c =================================================================== --- kos/kernel/arch/dreamcast/fs/fs_dclsocket.c 2012-05-23 05:14:24 UTC (rev 763) +++ kos/kernel/arch/dreamcast/fs/fs_dclsocket.c 2012-05-23 23:58:16 UTC (rev 764) @@ -791,6 +791,10 @@ dbglog(DBG_INFO, "fs_dclsocket: About to disable console\n"); + /* Disable the console first of all */ + if(!strcmp(dbgio_dev_get(), "fs_dclsocket")) + dbgio_dev_select("null"); + /* Send dc-tool an exit packet */ memcpy(cmd.id, "DC00", 4); @@ -801,10 +805,6 @@ old = irq_disable(); - /* Disable the console first of all */ - if(strcmp(dbgio_dev_get(), "fs_dclsocket")) - dbgio_dev_select("null"); - /* Destroy our mutex, and set us as uninitted */ mutex_destroy(mutex); initted = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-05-23 05:14:31
|
Revision: 763 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=763&view=rev Author: ljsebald Date: 2012-05-23 05:14:24 +0000 (Wed, 23 May 2012) Log Message: ----------- Fix a few things in the fs_dclsocket init before they become problems... Modified Paths: -------------- kos/kernel/arch/dreamcast/fs/fs_dclsocket.c Modified: kos/kernel/arch/dreamcast/fs/fs_dclsocket.c =================================================================== --- kos/kernel/arch/dreamcast/fs/fs_dclsocket.c 2012-05-22 21:49:38 UTC (rev 762) +++ kos/kernel/arch/dreamcast/fs/fs_dclsocket.c 2012-05-23 05:14:24 UTC (rev 763) @@ -748,12 +748,13 @@ if(dcls_socket == -1) return -1; + memset(&addr, 0, sizeof(struct sockaddr_in)); addr.sin_family = AF_INET; addr.sin_port = htons(DCLOAD_PORT); addr.sin_addr.s_addr = INADDR_ANY; - memset(addr.sin_zero, 0, 8); - err = bind(dcls_socket, (struct sockaddr *)&addr, sizeof(struct sockaddr)); + err = bind(dcls_socket, (struct sockaddr *)&addr, + sizeof(struct sockaddr_in)); if(err == -1) goto error; @@ -762,7 +763,7 @@ addr.sin_addr.s_addr = htonl(ip); err = connect(dcls_socket, (struct sockaddr *)&addr, - sizeof(struct sockaddr)); + sizeof(struct sockaddr_in)); if(err == -1) goto error; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-05-22 21:49:44
|
Revision: 762 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=762&view=rev Author: ljsebald Date: 2012-05-22 21:49:38 +0000 (Tue, 22 May 2012) Log Message: ----------- Use libelf by default in dc-tool-serial as well. This patch was originally contributed by Ayla in the #dreamcastdev IRC channel. The commit before this (doing the same to dc-tool-ip) was based on this one, by the way. Modified Paths: -------------- dcload/dcload-ip/host-src/tool/dc-tool.c dcload/dcload-serial/Makefile.cfg dcload/dcload-serial/host-src/tool/Makefile dcload/dcload-serial/host-src/tool/dc-tool.c Modified: dcload/dcload-ip/host-src/tool/dc-tool.c =================================================================== --- dcload/dcload-ip/host-src/tool/dc-tool.c 2012-05-22 20:09:44 UTC (rev 761) +++ dcload/dcload-ip/host-src/tool/dc-tool.c 2012-05-22 21:49:38 UTC (rev 762) @@ -18,6 +18,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ + #ifdef WITH_BFD #include <bfd.h> #else @@ -541,7 +542,7 @@ #endif #ifdef WITH_BFD - if ((somebfd = bfd_openr(filename, 0))) { + if ((somebfd = bfd_openr(filename, 0))) { if (bfd_check_format(somebfd, bfd_object)) { /* try bfd first */ asection *section; @@ -572,7 +573,8 @@ } } } - + + bfd_close(somebfd); goto done_transfer; } @@ -649,8 +651,7 @@ close(inputfd); } #endif /* WITH_BFD */ - /* if all else fails, send raw bin */ - //! Close the bfd here too? + /* if all else fails, send raw bin */ inputfd = open(filename, O_RDONLY | O_BINARY); if (inputfd < 0) { Modified: dcload/dcload-serial/Makefile.cfg =================================================================== --- dcload/dcload-serial/Makefile.cfg 2012-05-22 20:09:44 UTC (rev 761) +++ dcload/dcload-serial/Makefile.cfg 2012-05-22 21:49:38 UTC (rev 762) @@ -1,6 +1,7 @@ # host compiler and flags HOSTCC = gcc HOSTCFLAGS = -O2 # -Wall +HOSTLDFLAGS = # cygwin probably needs this #HOSTCFLAGS = -O2 -D_WIN32 Modified: dcload/dcload-serial/host-src/tool/Makefile =================================================================== --- dcload/dcload-serial/host-src/tool/Makefile 2012-05-22 20:09:44 UTC (rev 761) +++ dcload/dcload-serial/host-src/tool/Makefile 2012-05-22 21:49:38 UTC (rev 762) @@ -6,6 +6,13 @@ CFLAGS = $(HOSTCFLAGS) -DBAUD_RATE=$(SERIALSPEED) -DSERIALDEVICE="\"$(SERIALDEVICE)\"" -DHAVE_GETOPT INCLUDE = -I$(LZOPATH) -I$(BFDINCLUDE) +ifdef WITH_BFD + CFLAGS += -DWITH_BFD + LDFLAGS = $(HOSTLDFLAGS) $(BFDLIB) +else + LDFLAGS = $(HOSTLDFLAGS) -lelf +endif + DCTOOL = dc-tool$(EXECUTABLEEXTENSION) OBJECTS = dc-tool.o minilzo.o syscalls.o unlink.o @@ -17,7 +24,7 @@ all: $(DCTOOL) $(DCTOOL): $(OBJECTS) - $(CC) -o $@ $(OBJECTS) $(BFDLIB) + $(CC) -o $@ $(OBJECTS) $(LDFLAGS) minilzo.o: $(LZOFILES) $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< Modified: dcload/dcload-serial/host-src/tool/dc-tool.c =================================================================== --- dcload/dcload-serial/host-src/tool/dc-tool.c 2012-05-22 20:09:44 UTC (rev 761) +++ dcload/dcload-serial/host-src/tool/dc-tool.c 2012-05-22 21:49:38 UTC (rev 762) @@ -19,7 +19,12 @@ * */ +#ifdef WITH_BFD #include <bfd.h> +#else +#include <libelf.h> +#endif + #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -685,85 +690,173 @@ unsigned int upload(unsigned char *filename, unsigned int address) { int inputfd; - int size; + int size = 0; unsigned char *inbuf; struct timeval starttime, endtime; unsigned char c; double stime, etime; + +#ifdef WITH_BFD bfd *somebfd; +#else + Elf *elf; + Elf32_Ehdr *ehdr; + Elf32_Shdr *shdr; + Elf_Scn *section = NULL; + Elf_Data *data; + char *section_name; + size_t index; +#endif lzo_init(); - somebfd = bfd_openr(filename, 0); +#ifdef WITH_BFD + if ((somebfd = bfd_openr(filename, 0))) { /* try bfd first */ + if(bfd_check_format(somebfd, bfd_object)) { + asection *section; + + printf("File format is %s, ", somebfd->xvec->name); + address = somebfd->start_address; + size = 0; + printf("start address is 0x%x\n", address); - if (somebfd) { /* try bfd first */ - if (bfd_check_format(somebfd, bfd_object)) { - asection *section; - - printf("File format is %s, ", somebfd->xvec->name); - address = somebfd->start_address; - size = 0; - printf("start address is 0x%x\n", address); + gettimeofday(&starttime, 0); - gettimeofday(&starttime, 0); + for (section = somebfd->sections; section != NULL; section = section->next) { + if ((section->flags & SEC_HAS_CONTENTS) && (section->flags & SEC_LOAD)) { + printf("Section %s, ",section->name); + printf("lma 0x%x, ",section->lma); + printf("size %d\n",bfd_section_size(somebfd, section)); + if (bfd_section_size(somebfd, section)) { + size += bfd_section_size(somebfd, section); + inbuf = malloc(bfd_section_size(somebfd, section)); + bfd_get_section_contents(somebfd, section, inbuf, 0, bfd_section_size(somebfd, section)); - for (section = somebfd->sections; section != NULL; section = section->next) - if ((section->flags & SEC_HAS_CONTENTS) && (section->flags & SEC_LOAD)) { - printf("Section %s, ",section->name); - printf("lma 0x%x, ",section->lma); - printf("size %d\n",bfd_section_size(somebfd, section)); - if (bfd_section_size(somebfd, section)) { - size += bfd_section_size(somebfd, section); - inbuf = malloc(bfd_section_size(somebfd, section)); - bfd_get_section_contents(somebfd, section, inbuf, 0, bfd_section_size(somebfd, section)); + c = 'B'; + serial_write(&c, 1); + blread(&c, 1); + + send_uint(section->lma); + send_uint(bfd_section_size(somebfd, section)); + + send_data(inbuf, bfd_section_size(somebfd, section), 1); + + free(inbuf); + } + } + } - c = 'B'; - serial_write(&c, 1); - blread(&c, 1); - - send_uint(section->lma); - send_uint(bfd_section_size(somebfd, section)); - - send_data(inbuf, bfd_section_size(somebfd, section), 1); - - free(inbuf); - } - } - bfd_close(somebfd); - } else { + bfd_close(somebfd); + goto done_transfer; + } -/* if that fails, send raw bin */ - - printf("File format is raw binary, start address is 0x%x\n", address); - inputfd = open(filename, O_RDONLY | O_BINARY); - - if (inputfd < 0) { - perror(filename); - exit(-1); - } - - size = lseek(inputfd, 0, SEEK_END); - lseek(inputfd, 0, SEEK_SET); - - inbuf = malloc(size); - - read(inputfd, inbuf, size); - - close(inputfd); - - gettimeofday(&starttime, 0); - - c = 'B'; - serial_write(&c, 1); - blread(&c, 1); - - send_uint(address); - send_uint(size); - - send_data(inbuf, size, 1); + bfd_close(somebfd); + } +#else /* !WITH_BFD -- use libelf */ + if(elf_version(EV_CURRENT) == EV_NONE) { + fprintf(stderr, "ELF library initialization error: %s\n", elf_errmsg(-1)); + exit(-1); + } - } + if((inputfd = open(filename, O_RDONLY)) < 0) { + perror(filename); + exit(-1); + } + if((elf = elf_begin(inputfd, ELF_C_READ, NULL)) == NULL) { + fprintf(stderr, "Unable to open ELF file: %s\n", elf_errmsg(-1)); + exit(-1); + } + + if(elf_kind(elf) == ELF_K_ELF) { + if(!(ehdr = elf32_getehdr(elf))) { + fprintf(stderr, "Unable to read ELF header: %s\n", elf_errmsg(-1)); + exit(-1); + } + + printf("File format is ELF, start address is 0x%x\n", ehdr->e_entry); + + /* Retrieve the index of the ELF section containing the string table of + section names */ + if(elf_getshdrstrndx(elf, &index)) { + fprintf(stderr, "Unable to read section index: %s\n", elf_errmsg(-1)); + exit(-1); + } + + gettimeofday(&starttime, 0); + while((section = elf_nextscn(elf, section))) { + if(!(shdr = elf32_getshdr(section))) { + fprintf(stderr, "Unable to read section header: %s\n", elf_errmsg(-1)); + exit(-1); + } + + if (!(section_name = elf_strptr(elf, index, shdr->sh_name))) { + fprintf(stderr, "Unable to read section nam: %s\n", elf_errmsg(-1)); + exit(-1); + } + + if(!shdr->sh_addr) + continue; + + /* Check if there's some data to upload. */ + data = elf_getdata(section, NULL); + if(!data->d_buf || !data->d_size) + continue; + + printf("Section %s, lma 0x%x, size %d\n", section_name, + shdr->sh_addr, shdr->sh_size); + size += shdr->sh_size; + + c = 'B'; + serial_write(&c, 1); + blread(&c, 1); + + send_uint(shdr->sh_addr); + send_uint(shdr->sh_size); + + do { + send_data(data->d_buf, data->d_size, 1); + } while((data = elf_getdata(section, data))); + } + + elf_end(elf); + close(inputfd); + goto done_transfer; + } else { + elf_end(elf); + close(inputfd); + } +#endif + /* if all else fails, send raw bin */ + printf("File format is raw binary, start address is 0x%x\n", address); + inputfd = open(filename, O_RDONLY | O_BINARY); + + if(inputfd < 0) { + perror(filename); + exit(-1); + } + + size = lseek(inputfd, 0, SEEK_END); + lseek(inputfd, 0, SEEK_SET); + + inbuf = malloc(size); + + read(inputfd, inbuf, size); + + close(inputfd); + + gettimeofday(&starttime, 0); + + c = 'B'; + serial_write(&c, 1); + blread(&c, 1); + + send_uint(address); + send_uint(size); + + send_data(inbuf, size, 1); + +done_transfer: gettimeofday(&endtime, 0); stime = starttime.tv_sec + starttime.tv_usec / 1000000.0; @@ -772,8 +865,7 @@ printf("effective: %.2f bytes / sec\n", (double) size / (etime - stime)); printf("%.2f seconds to transfer %d bytes\n", (etime - stime), size); fflush(stdout); - - } + return address; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-05-22 20:09:51
|
Revision: 761 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=761&view=rev Author: ljsebald Date: 2012-05-22 20:09:44 +0000 (Tue, 22 May 2012) Log Message: ----------- Use libelf instead of BFD by default on dc-tool-ip. Modified Paths: -------------- dcload/dcload-ip/Makefile.cfg dcload/dcload-ip/host-src/tool/Makefile dcload/dcload-ip/host-src/tool/dc-tool.c Modified: dcload/dcload-ip/Makefile.cfg =================================================================== --- dcload/dcload-ip/Makefile.cfg 2012-04-09 17:49:30 UTC (rev 760) +++ dcload/dcload-ip/Makefile.cfg 2012-05-22 20:09:44 UTC (rev 761) @@ -1,6 +1,7 @@ # host compiler and flags HOSTCC = gcc HOSTCFLAGS = -O2 +HOSTLDFLAGS = # cygwin may need this #HOSTCFLAGS = -O2 -D_WIN32 @@ -34,13 +35,10 @@ HOSTCFLAGS += $(VERFLAGS) # the ip of your dreamcast - set to 0.0.0.0 if you want to use arp on pc -#DREAMCAST_IP = 000.000.000.000 -DREAMCAST_IP = 192.168.11.6 -#DREAMCAST_IP = 10.0.0.32 +DREAMCAST_IP = 0.0.0.0 # dir to install dc-tool in TOOLINSTALLDIR = /usr/local/dc/bin -#TOOLINSTALLDIR = /usr/local/dc/bin # uncomment this for cygwin #EXECUTABLEEXTENSION = .exe Modified: dcload/dcload-ip/host-src/tool/Makefile =================================================================== --- dcload/dcload-ip/host-src/tool/Makefile 2012-04-09 17:49:30 UTC (rev 760) +++ dcload/dcload-ip/host-src/tool/Makefile 2012-05-22 20:09:44 UTC (rev 761) @@ -4,6 +4,13 @@ CFLAGS = $(HOSTCFLAGS) -DDREAMCAST_IP=\"$(DREAMCAST_IP)\" -DHAVE_GETOPT INCLUDE = -I$(BFDINCLUDE) +ifdef WITH_BFD + CFLAGS += -DWITH_BFD + LDFLAGS = $(HOSTLDFLAGS) $(BFDLIB) +else + LDFLAGS = $(HOSTLDFLAGS) -lelf +endif + DCTOOL = dc-tool$(EXECUTABLEEXTENSION) OBJECTS = dc-tool.o syscalls.o unlink.o @@ -14,7 +21,7 @@ all: $(DCTOOL) $(DCTOOL): $(OBJECTS) - $(CC) -o $@ $(OBJECTS) $(BFDLIB) + $(CC) -o $@ $(OBJECTS) $(LDFLAGS) .PHONY : install install: $(DCTOOL) Modified: dcload/dcload-ip/host-src/tool/dc-tool.c =================================================================== --- dcload/dcload-ip/host-src/tool/dc-tool.c 2012-04-09 17:49:30 UTC (rev 760) +++ dcload/dcload-ip/host-src/tool/dc-tool.c 2012-05-22 20:09:44 UTC (rev 761) @@ -18,7 +18,12 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ +#ifdef WITH_BFD #include <bfd.h> +#else +#include <libelf.h> +#endif + #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -523,69 +528,151 @@ struct timeval starttime, endtime; double stime, etime; +#ifdef WITH_BFD bfd *somebfd; +#else + Elf *elf; + Elf32_Ehdr *ehdr; + Elf32_Shdr *shdr; + Elf_Scn *section = NULL; + Elf_Data *data; + char *section_name; + size_t index; +#endif - somebfd = bfd_openr(filename, 0); +#ifdef WITH_BFD + if ((somebfd = bfd_openr(filename, 0))) { + if (bfd_check_format(somebfd, bfd_object)) { + /* try bfd first */ + asection *section; - if (somebfd) { - if (bfd_check_format(somebfd, bfd_object)) { - /* try bfd first */ - asection *section; + printf("File format is %s, ", somebfd->xvec->name); + address = somebfd->start_address; + size = 0; + printf("start address is 0x%x\n", address); - printf("File format is %s, ", somebfd->xvec->name); - address = somebfd->start_address; - size = 0; - printf("start address is 0x%x\n", address); + gettimeofday(&starttime, 0); - gettimeofday(&starttime, 0); + for (section = somebfd->sections; section != NULL; section = section->next) { + if ((section->flags & SEC_HAS_CONTENTS) && (section->flags & SEC_LOAD)) { + sectsize = bfd_section_size(somebfd, section); + printf("Section %s, ",section->name); + printf("lma 0x%x, ", (unsigned int)section->lma); + printf("size %d\n",sectsize); - for (section = somebfd->sections; section != NULL; section = section->next) { - if ((section->flags & SEC_HAS_CONTENTS) && (section->flags & SEC_LOAD)) { - sectsize = bfd_section_size(somebfd, section); - printf("Section %s, ",section->name); - printf("lma 0x%x, ", (unsigned int)section->lma); - printf("size %d\n",sectsize); + if (sectsize) { + size += sectsize; + inbuf = malloc(sectsize); + bfd_get_section_contents(somebfd, section, inbuf, 0, sectsize); - if (sectsize) { - size += sectsize; - inbuf = malloc(sectsize); - bfd_get_section_contents(somebfd, section, inbuf, 0, sectsize); + if(send_data(inbuf, section->lma, sectsize) == -1) + return -1; - if(send_data(inbuf, section->lma, sectsize) == -1) - return -1; - - free(inbuf); - } - } - } + free(inbuf); + } + } + } - bfd_close(somebfd); - } else { - /* if that fails, send raw bin */ - //! Close the bfd here too? - inputfd = open(filename, O_RDONLY | O_BINARY); + goto done_transfer; + } - if (inputfd < 0) { - perror(filename); - return -1; - } + bfd_close(somebfd); + } +#else /* !WITH_BFD -- use libelf */ + if(elf_version(EV_CURRENT) == EV_NONE) { + fprintf(stderr, "libelf initialization error: %s\n", elf_errmsg(-1)); + return -1; + } - printf("File format is raw binary, start address is 0x%x\n", address); + if((inputfd = open(filename, O_RDONLY | O_BINARY)) < 0) { + perror(filename); + return -1; + } - size = lseek(inputfd, 0, SEEK_END); - lseek(inputfd, 0, SEEK_SET); + if(!(elf = elf_begin(inputfd, ELF_C_READ, NULL))) { + fprintf(stderr, "Cannot read ELF file: %s\n", elf_errmsg(-1)); + return -1; + } - inbuf = malloc(size); - read(inputfd, inbuf, size); - close(inputfd); + if(elf_kind(elf) == ELF_K_ELF) { + if(!(ehdr = elf32_getehdr(elf))) { + fprintf(stderr, "Unable to read ELF header: %s\n", elf_errmsg(-1)); + return -1; + } - gettimeofday(&starttime, 0); + printf("File format is ELF, start address is 0x%x\n", ehdr->e_entry); - if(send_data(inbuf, address, size) == -1) - return -1; - } + /* Retrieve the index of the ELF section containing the string table of + section names */ + if(elf_getshdrstrndx(elf, &index)) { + fprintf(stderr, "Unable to read section index: %s\n", elf_errmsg(-1)); + return -1; + } + + gettimeofday(&starttime, 0); + while((section = elf_nextscn(elf, section))) { + if(!(shdr = elf32_getshdr(section))) { + fprintf(stderr, "Unable to read section header: %s\n", elf_errmsg(-1)); + return -1; + } + + if(!(section_name = elf_strptr(elf, index, shdr->sh_name))) { + fprintf(stderr, "Unable to read section name: %s\n", elf_errmsg(-1)); + return -1; + } + + if(!shdr->sh_addr) + continue; + + /* Check if there's some data to upload. */ + data = elf_getdata(section, NULL); + if(!data->d_buf || !data->d_size) + continue; + + printf("Section %s, lma 0x%08x, size %d\n", section_name, + shdr->sh_addr, shdr->sh_size); + size += shdr->sh_size; + + do { + if(send_data(data->d_buf, shdr->sh_addr + data->d_off, + data->d_size) == -1) + return -1; + } while((data = elf_getdata(section, data))); + } + + elf_end(elf); + close(inputfd); + goto done_transfer; } + else { + elf_end(elf); + close(inputfd); + } +#endif /* WITH_BFD */ + /* if all else fails, send raw bin */ + //! Close the bfd here too? + inputfd = open(filename, O_RDONLY | O_BINARY); + if (inputfd < 0) { + perror(filename); + return -1; + } + + printf("File format is raw binary, start address is 0x%x\n", address); + + size = lseek(inputfd, 0, SEEK_END); + lseek(inputfd, 0, SEEK_SET); + + inbuf = malloc(size); + read(inputfd, inbuf, size); + close(inputfd); + + gettimeofday(&starttime, 0); + + if(send_data(inbuf, address, size) == -1) + return -1; + +done_transfer: gettimeofday(&endtime, 0); stime = starttime.tv_sec + starttime.tv_usec / 1000000.0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-04-09 17:49:36
|
Revision: 760 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=760&view=rev Author: ljsebald Date: 2012-04-09 17:49:30 +0000 (Mon, 09 Apr 2012) Log Message: ----------- Fix compilation of two examples that didn't compile before. Modified Paths: -------------- kos/examples/dreamcast/conio/adventure/hdr.h kos/examples/dreamcast/conio/adventure/init.c kos/examples/dreamcast/conio/adventure/main.c kos/examples/dreamcast/network/httpd/httpd.c kos/examples/dreamcast/network/httpd/simhost.c Modified: kos/examples/dreamcast/conio/adventure/hdr.h =================================================================== --- kos/examples/dreamcast/conio/adventure/hdr.h 2012-04-09 12:08:51 UTC (rev 759) +++ kos/examples/dreamcast/conio/adventure/hdr.h 2012-04-09 17:49:30 UTC (rev 760) @@ -185,7 +185,7 @@ int forced (int locc); void getin (char **wrd1, char **wrd2); int here (int objj); -void init (void); +void my_init (void); void juggle (int); int liq (void); int liqloc (int locc); Modified: kos/examples/dreamcast/conio/adventure/init.c =================================================================== --- kos/examples/dreamcast/conio/adventure/init.c 2012-04-09 12:08:51 UTC (rev 759) +++ kos/examples/dreamcast/conio/adventure/init.c 2012-04-09 17:49:30 UTC (rev 760) @@ -60,7 +60,7 @@ static void linkdata (void); void -init() /* everything for 1st time run */ +my_init() /* everything for 1st time run */ { rdata(); /* read data from orig. file */ linkdata(); Modified: kos/examples/dreamcast/conio/adventure/main.c =================================================================== --- kos/examples/dreamcast/conio/adventure/main.c 2012-04-09 12:08:51 UTC (rev 759) +++ kos/examples/dreamcast/conio/adventure/main.c 2012-04-09 17:49:30 UTC (rev 760) @@ -80,7 +80,7 @@ setgid(getgid()); #endif - init(); /* Initialize everything */ + my_init(); /* Initialize everything */ /* signal(SIGINT,trapdel); */ #if 0 Modified: kos/examples/dreamcast/network/httpd/httpd.c =================================================================== --- kos/examples/dreamcast/network/httpd/httpd.c 2012-04-09 12:08:51 UTC (rev 759) +++ kos/examples/dreamcast/network/httpd/httpd.c 2012-04-09 17:49:30 UTC (rev 760) @@ -4,9 +4,9 @@ Copyright (C)2003 Dan Potter */ -#include <kos.h> #include <lwip/lwip.h> #include <lwip/sockets.h> +#include <stdio.h> #include <sys/queue.h> struct http_state; Modified: kos/examples/dreamcast/network/httpd/simhost.c =================================================================== --- kos/examples/dreamcast/network/httpd/simhost.c 2012-04-09 12:08:51 UTC (rev 759) +++ kos/examples/dreamcast/network/httpd/simhost.c 2012-04-09 17:49:30 UTC (rev 760) @@ -1,9 +1,14 @@ -#include <kos.h> #include <lwip/lwip.h> -#include <unistd.h> +#include <kos/thread.h> +#include <dc/video.h> +#include <dc/biosfont.h> +#include <dc/maple.h> +#include <dc/maple/controller.h> + extern uint8 romdisk[]; KOS_INIT_ROMDISK(romdisk); +KOS_INIT_FLAGS(INIT_DEFAULT | INIT_NET); void httpd(); void *do_httpd(void * foo) { @@ -12,7 +17,6 @@ } int main(int argc, char **argv) { - net_init(); lwip_kos_init(); thd_create(1, do_httpd, NULL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-04-09 12:08:59
|
Revision: 759 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=759&view=rev Author: ljsebald Date: 2012-04-09 12:08:51 +0000 (Mon, 09 Apr 2012) Log Message: ----------- A few documentation updates... Modified Paths: -------------- kos/doc/FAQ kos/doc/README kos/kernel/net/net_ipv4.c Modified: kos/doc/FAQ =================================================================== --- kos/doc/FAQ 2012-04-09 12:05:41 UTC (rev 758) +++ kos/doc/FAQ 2012-04-09 12:08:51 UTC (rev 759) @@ -1,5 +1,6 @@ KallistiOS ##version## FAQ -Copyright (c)2001 Dan Potter +Copyright (C) 2001 Dan Potter +Copyright (C) 2012 Lawrence Sebald Here you may find some answers to some common questions we hear regarding the usage of KOS. We will be adding more to this file over @@ -224,14 +225,6 @@ A) Presently there are six: -- Builtin -- mounts on /bi, and reads files from an internal array built -into the kernel (thus the name). This lets you embed bootstrap userland -code into the kernel, data files, etc. It's also non-permanent (like a -CDR) so if you are uploading test images you can put test files here. A -little known trick of /bi is that you can put an arbitrary pointer into -the table and tweak both the pointer and the file size at runtime, thus -providing proc-like functionality. - - ISO9660 -- mounts on /cd, and is a decent implementation of the ISO9660 file system standard used on CDs. Note that because of the simple nature of KOS's block devices right now, ISO9660 is bound @@ -259,7 +252,12 @@ here eats up core RAM, deleting them recovers it. Otherwise it works exactly like a normal file system. +- Sockets -- mounts on /sock. This one is not exactly a filesystem so to speak. +It is used to allow network sockets to use the normal VFS functions (write(), +read(), close()) for its operation. There are never any visible files on this +VFS, so you can't use open() to access it. + 1.5 Q) How can I make images for the romdisk file system? @@ -318,8 +316,10 @@ A) Yes. There is a very primitive and rudimentary driver for the Sega broadband adapter (an RTL8193C based 10/100 card) and the Lan Adapter on -the DC; and for TCP/IP there is a port of Adam Dunkel's lwIP embedded -stack. +the DC. With regards to TCP/IP and friends, there are two choices: either +you can use the built-in network stack or you can use lwIP, which is in +the kos-ports tree. Note though that currently the built-in network stack +does not actually support TCP (UDP is there though). 3.2 Modified: kos/doc/README =================================================================== --- kos/doc/README 2012-04-09 12:05:41 UTC (rev 758) +++ kos/doc/README 2012-04-09 12:08:51 UTC (rev 759) @@ -1,5 +1,7 @@ KallistiOS ##version## -README Copyright (C)2000-2003 Dan Potter +README +Copyright (C) 2000-2003 Dan Potter +Copyright (C) 2012 Lawrence Sebald OVERVIEW -------- @@ -65,7 +67,7 @@ the MMU and memory protection, a real process model, etc, check out KOS-MMU. It's not being worked on any more but it has some interesting code in it and is a clean example of a simple OS. Most of the interesting -code from KOS-MMU was merged into KOS 1.1.x, 1.2.x, and 1.3.x. +code from KOS-MMU was merged into KOS 1.1.x, 1.2.x, and 2.0.0. LICENSING @@ -97,25 +99,34 @@ version notes. - GNU Binutils / GCC / GNU Make for your host platform -If you don't have any of the above, please see this site for some more -instructions and a build script that may help you: +For the Dreamcast version, a Makefile is provided to build the requisite +GCC, Binutils, and Newlib versions in the utils/dc-chain directory. -DC: http://www.boob.co.uk/ +If you don't have any of the above, please see one of the following sites +for some more instructions (and perhaps a build script that may help you): + +DC: http://dcemulation.org/ GBA: http://www.gbadev.org/ -PS2: http://ps2dev.sf.net/ +PS2: http://wiki.ps2dev.org/ -On the DC, you'll want GCC 3.0.4. It's far better than the 2.9x series at -this point and even compiles nicely with -O2, unlike previous versions. The -default optimization setting in the enclosed environ files is -O2. If you -want to build SPU programs then you will also need an ARM tool chain. -Precompiled binaries are included for the ARM code that is used by the -addons, however. +On the Dreamcast, the 4.x series of GCC works pretty well. Look at the patches +provided in utils/dc-chain/patches to see what versions have been tested and +are known to work. In addition, many people still use earlier versions of GCC, +such as 3.4.6 and 3.0.4. There are often strange bugs with GCC for SuperH, so +if you deviate from these suggested versions, you're on your own (for instance, +pretty much the entire 3.1.x, 3.2.x, and 3.3.x branches of GCC were broken for +SuperH). Basically, if you use a newer version of GCC and find that it works +perfectly, great -- let us know and give us the patches needed to make it work. +However, if you find that it doesn't work, you're on your own to try to figure +out why. -DO NOT use a version of GCC beyond 3.0.4 for DC development. Let me repeat -that just to make sure... DO NOT use a version of GCC beyond 3.0.4. It has -a very small and well known set of bugs which are worked around with -compiler flags. There is unfortunately at least one major bug in every -known version of GCC past 3.0.4 for the SH-4 platform. +If you wish to work with the sound processor on the Dreamcast, you'll need an +ARM toolchain as well. ARM support is maintained pretty well in GCC, so most +versions should "just work". The ARM processor in the sound unit is fairly old +and doesn't support Thumb mode at all, so keep that in mind when building GCC. +You do not necessarily need an ARM version of GCC to build KOS for the DC, as +precompiled binaries are provided of the necessary code. As long as you don't +intend to modify the sound driver, you don't need the ARM tools. On the GBA, any fairly new GCC 3.0.x and above works fine. It includes the new ARM-supplied backend for that CPU target. It also provides a compiler @@ -127,7 +138,7 @@ versions AFAIK. YMMV, there may be a new one by now. Note that the PS2 port currently only builds for the RTE sub-arch, which is the loader DVD used with the PS2 Linux Kit. So using KOS for PS2 currently requires that you -have a Linux Kit. You can buy one here: +have a Linux Kit. You used to be able to buy one here: http://us.playstation.com/hardware/more/SCPH-97047.asp @@ -146,15 +157,14 @@ them anymore. After you have a working environ script, run it with 'source environ.sh' -and run your make program. For BSD people this will be 'gmake', otherwise +and run your make program. For BSD people this may be 'gmake', otherwise it will probably be just 'make'. It should be done after a few minutes. If something goes wrong, please check the FAQ; if that fails, email one of us and we'll see what we can do. I recommend putting the 'source' line above into your shell's .rc/.login. -This process should work (and has been tested) under Linux, BSD, and -Cygwin. It is very doubtful that it will work in any non-Unix -environment, though some success has been reported using Mingwin. +This process should work (and has been tested) under Linux, BSD, Cygwin and +MinGW/MSYS. It is very doubtful that it will work in any non-*nix environment. VERSION CODES @@ -200,7 +210,7 @@ ------------------------ All the interesting and maintainable pieces of the KOS 1.0.x "os mode" have -been fully integrated back into the mainline KOS 1.3.x tree. It is now used +been fully integrated back into the mainline KOS 2.0.x tree. It is now used for dynamic module loading and does not include process support, etc. This is unlikely to be revived again in the future. @@ -219,7 +229,10 @@ Gameboy Advance* -- This port is now being maintained by Gil Megidish. +- This port is was being maintained by Gil Megidish, however it appears + that is no longer the case. If someone wants to maintain it, please let + me know! Otherwise, this port will probably be removed from the tree in + the not-too-distant future. - There is not a lot of hardware support yet. IRQs aren't even supported, so don't even think about trying to use threads yet =). This port is somewhat immature however, so I expect the support to improve over @@ -240,6 +253,9 @@ the raw PS2 as well, I'd be happy to accept any help. - It is designed to be used with ps2-load-ip as a loader. - There is basically no hardware support yet, just a CPU/kernel-core port. +- This port is pretty much unmaintained at this point. Unless someone steps + up to maintain it, it will probably be cut from the tree sometime in the + future. Intel* IA32 @@ -248,6 +264,8 @@ embedded MP3 players. - It was written using the very old KOS 1.3.x snapshot, so it probably doesn't compile right now. But it could probably be fixed pretty easily. +- If nobody is interested in this port, it will likely be removed from the + tree in the nearish future as well. END --- Modified: kos/kernel/net/net_ipv4.c =================================================================== --- kos/kernel/net/net_ipv4.c 2012-04-09 12:05:41 UTC (rev 758) +++ kos/kernel/net/net_ipv4.c 2012-04-09 12:08:51 UTC (rev 759) @@ -104,7 +104,7 @@ net_ipv4_parse_address(ntohl(hdr->dest), dest_ip); /* Is this a loopback address (127/8)? */ - if((dest_ip[0] & 0xFF) == 0x7F) { + if(dest_ip[0] == 0x7F) { /* Put the IP header / data into our packet */ memcpy(pkt, hdr, 4 * (hdr->version_ihl & 0x0f)); memcpy(pkt + 4 * (hdr->version_ihl & 0x0f), data, size); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-04-09 12:05:47
|
Revision: 758 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=758&view=rev Author: ljsebald Date: 2012-04-09 12:05:41 +0000 (Mon, 09 Apr 2012) Log Message: ----------- Fix libtremor reliance on non-standard endian.h header, and provide the relevant parts elsewhere in header files. Modified Paths: -------------- kos/include/sys/_types.h kos/kernel/arch/dreamcast/include/arch/types.h kos-ports/libtremor/xiph/misc.h Modified: kos/include/sys/_types.h =================================================================== --- kos/include/sys/_types.h 2012-04-09 11:38:54 UTC (rev 757) +++ kos/include/sys/_types.h 2012-04-09 12:05:41 UTC (rev 758) @@ -88,8 +88,19 @@ // This part inserted to fix newlib brokenness. /** \brief Size of an fd_set. */ -#define FD_SETSIZE 1024 +#define FD_SETSIZE 1024 +/* The architecture should define the macro BYTE_ORDER in <arch/types.h> to + equal one of these macros for code that looks for these BSD-style macros. */ +/** \brief Little Endian test macro */ +#define LITTLE_ENDIAN 1234 + +/** \brief Big Endian test macro */ +#define BIG_ENDIAN 4321 + +/** \brief PDP Endian test macro */ +#define PDP_ENDIAN 3412 + // And this is for old KOS source compatability. #include <arch/types.h> Modified: kos/kernel/arch/dreamcast/include/arch/types.h =================================================================== --- kos/kernel/arch/dreamcast/include/arch/types.h 2012-04-09 11:38:54 UTC (rev 757) +++ kos/kernel/arch/dreamcast/include/arch/types.h 2012-04-09 12:05:41 UTC (rev 758) @@ -80,6 +80,14 @@ typedef handle_t tid_t; /**< \brief Thread ID type */ typedef handle_t prio_t; /**< \brief Priority value type */ +/* Make sure to pull in the base endianness defines... */ +#ifndef LITTLE_ENDIAN +#include <sys/_types.h> +#endif + +/** \brief Endianness definition -- Little Endian */ +#define BYTE_ORDER LITTLE_ENDIAN + __END_DECLS #endif /* __ARCH_TYPES_H */ Modified: kos-ports/libtremor/xiph/misc.h =================================================================== --- kos-ports/libtremor/xiph/misc.h 2012-04-09 11:38:54 UTC (rev 757) +++ kos-ports/libtremor/xiph/misc.h 2012-04-09 12:05:41 UTC (rev 758) @@ -30,7 +30,9 @@ #ifndef _V_WIDE_MATH #define _V_WIDE_MATH -#include <endian.h> +#if !(defined WIN32 && defined WINCE) +#include <sys/types.h> +#endif #if BYTE_ORDER==LITTLE_ENDIAN union magic { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-04-09 11:39:00
|
Revision: 757 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=757&view=rev Author: ljsebald Date: 2012-04-09 11:38:54 +0000 (Mon, 09 Apr 2012) Log Message: ----------- Link with libm, since some platforms need it and it probably won't hurt either way. Modified Paths: -------------- kos/utils/vqenc/Makefile Modified: kos/utils/vqenc/Makefile =================================================================== --- kos/utils/vqenc/Makefile 2012-04-09 01:32:51 UTC (rev 756) +++ kos/utils/vqenc/Makefile 2012-04-09 11:38:54 UTC (rev 757) @@ -7,7 +7,7 @@ # Use for other systems CFLAGS = -O2 -Wall -DINLINE=inline #-g# -LDFLAGS = -lpng -ljpeg -lz #-s -g +LDFLAGS = -lpng -ljpeg -lz -lm #-s -g all: vqenc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-04-09 01:32:57
|
Revision: 756 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=756&view=rev Author: ljsebald Date: 2012-04-09 01:32:51 +0000 (Mon, 09 Apr 2012) Log Message: ----------- #include <zlib.h> by itself, as it doesn't seem to be necessarily included by png.h. Modified Paths: -------------- kos/utils/vqenc/readpng.c Modified: kos/utils/vqenc/readpng.c =================================================================== --- kos/utils/vqenc/readpng.c 2012-04-09 01:05:26 UTC (rev 755) +++ kos/utils/vqenc/readpng.c 2012-04-09 01:32:51 UTC (rev 756) @@ -11,6 +11,7 @@ #include <stdlib.h> #include <png.h> /* libpng header; includes zlib.h */ +#include <zlib.h> #include "readpng.h" /* typedefs, common macros, public prototypes */ static png_structp png_ptr = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-04-09 01:05:32
|
Revision: 755 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=755&view=rev Author: ljsebald Date: 2012-04-09 01:05:26 +0000 (Mon, 09 Apr 2012) Log Message: ----------- Fix pvrmap example. Modified Paths: -------------- kos/examples/dreamcast/basic/mmu/pvrmap/pvrmap.c Modified: kos/examples/dreamcast/basic/mmu/pvrmap/pvrmap.c =================================================================== --- kos/examples/dreamcast/basic/mmu/pvrmap/pvrmap.c 2012-03-01 02:44:03 UTC (rev 754) +++ kos/examples/dreamcast/basic/mmu/pvrmap/pvrmap.c 2012-04-09 01:05:26 UTC (rev 755) @@ -28,7 +28,7 @@ /* Map the PVR video memory to 0 */ mmu_page_map(cxt, 0, 0x05000000 >> PAGESIZE_BITS, (8*1024*1024) >> PAGESIZE_BITS, - MMU_ALL_RDWR, MMU_NO_CACHE, MMU_NOT_SHARED, MMU_DIRTY); + MMU_ALL_RDWR, MMU_NO_CACHE, 0, 1); /* Draw a nice pattern to the NULL space */ vr = NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-03-01 02:44:13
|
Revision: 754 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=754&view=rev Author: ljsebald Date: 2012-03-01 02:44:03 +0000 (Thu, 01 Mar 2012) Log Message: ----------- Update libpng to 1.5.9. Modified Paths: -------------- kos-ports/libpng/png.c kos-ports/libpng/png.h kos-ports/libpng/pngconf.h kos-ports/libpng/pngerror.c kos-ports/libpng/pngget.c kos-ports/libpng/pngmem.c kos-ports/libpng/pngpread.c kos-ports/libpng/pngread.c kos-ports/libpng/pngrio.c kos-ports/libpng/pngrtran.c kos-ports/libpng/pngrutil.c kos-ports/libpng/pngset.c kos-ports/libpng/pngtrans.c kos-ports/libpng/pngwio.c kos-ports/libpng/pngwrite.c kos-ports/libpng/pngwtran.c kos-ports/libpng/pngwutil.c kos-ports/libpng/readpng.c Added Paths: ----------- kos-ports/libpng/ANNOUNCE kos-ports/libpng/CHANGES kos-ports/libpng/LICENSE kos-ports/libpng/README kos-ports/libpng/libpng-manual.txt kos-ports/libpng/pngdebug.h kos-ports/libpng/pnginfo.h kos-ports/libpng/pnglibconf.h kos-ports/libpng/pngpriv.h kos-ports/libpng/pngstruct.h Added: kos-ports/libpng/ANNOUNCE =================================================================== --- kos-ports/libpng/ANNOUNCE (rev 0) +++ kos-ports/libpng/ANNOUNCE 2012-03-01 02:44:03 UTC (rev 754) @@ -0,0 +1,42 @@ + +Libpng 1.5.9 - February 18, 2012 + +This is a public release of libpng, intended for use in production codes. + +Files available for download: + +Source files with LF line endings (for Unix/Linux) and with a +"configure" script + + libpng-1.5.9.tar.xz (LZMA-compressed, recommended) + libpng-1.5.9.tar.gz + libpng-1.5.9.tar.bz2 + +Source files with CRLF line endings (for Windows), without the +"configure" script + + lpng159.7z (LZMA-compressed, recommended) + lpng159.zip + +Other information: + + libpng-1.5.9-README.txt + libpng-1.5.9-LICENSE.txt + +Changes since the last public release (1.5.8): + + Rebuilt configure scripts in the tar distributions. + Removed two unused definitions from scripts/pnglibconf.h.prebuilt + Removed some unused arrays (with #ifdef) from png_read_push_finish_row(). + Removed tests for no-longer-used *_EMPTY_PLTE_SUPPORTED from pngstruct.h + Fixed CVE-2011-3026 buffer overrun bug. Deal more correctly with the test + on iCCP chunk length. Also removed spurious casts that may hide problems + on 16-bit systems. + +Send comments/corrections/commendations to png-mng-implement at lists.sf.net +(subscription required; visit +https://lists.sourceforge.net/lists/listinfo/png-mng-implement +to subscribe) +or to glennrp at users.sourceforge.net + +Glenn R-P Added: kos-ports/libpng/CHANGES =================================================================== --- kos-ports/libpng/CHANGES (rev 0) +++ kos-ports/libpng/CHANGES 2012-03-01 02:44:03 UTC (rev 754) @@ -0,0 +1,3820 @@ +#if 0 +CHANGES - changes for libpng + +Version 0.2 + added reader into png.h + fixed small problems in stub file + +Version 0.3 + added pull reader + split up pngwrite.c to several files + added pnglib.txt + added example.c + cleaned up writer, adding a few new transformations + fixed some bugs in writer + interfaced with zlib 0.5 + added K&R support + added check for 64 KB blocks for 16-bit machines + +Version 0.4 + cleaned up code and commented code + simplified time handling into png_time + created png_color_16 and png_color_8 to handle color needs + cleaned up color type defines + fixed various bugs + made various names more consistent + interfaced with zlib 0.71 + cleaned up zTXt reader and writer (using zlib's Reset functions) + split transformations into pngrtran.c and pngwtran.c + +Version 0.5 + interfaced with zlib 0.8 + fixed many reading and writing bugs + saved using 3 spaces instead of tabs + +Version 0.6 + added png_large_malloc() and png_large_free() + added png_size_t + cleaned up some compiler warnings + added png_start_read_image() + +Version 0.7 + cleaned up lots of bugs + finished dithering and other stuff + added test program + changed name from pnglib to libpng + +Version 0.71 [June, 1995] + changed pngtest.png for zlib 0.93 + fixed error in libpng.txt and example.c + +Version 0.8 + cleaned up some bugs + added png_set_filler() + split up pngstub.c into pngmem.c, pngio.c, and pngerror.c + added #define's to remove unwanted code + moved png_info_init() to png.c + added old_size into png_realloc() + added functions to manually set filtering and compression info + changed compression parameters based on image type + optimized filter selection code + added version info + changed external functions passing floats to doubles (k&r problems?) + put all the configurable stuff in pngconf.h + enabled png_set_shift to work with paletted images on read + added png_read_update_info() - updates info structure with transformations + +Version 0.81 [August, 1995] + incorporated Tim Wegner's medium model code (thanks, Tim) + +Version 0.82 [September, 1995] + [unspecified changes] + +Version 0.85 [December, 1995] + added more medium model code (almost everything's a far) + added i/o, error, and memory callback functions + fixed some bugs (16-bit, 4-bit interlaced, etc.) + added first run progressive reader (barely tested) + +Version 0.86 [January, 1996] + fixed bugs + improved documentation + +Version 0.87 [January, 1996] + fixed medium model bugs + fixed other bugs introduced in 0.85 and 0.86 + added some minor documentation + +Version 0.88 [January, 1996] + fixed progressive bugs + replaced tabs with spaces + cleaned up documentation + added callbacks for read/write and warning/error functions + +Version 0.89 [July, 1996] + Added new initialization API to make libpng work better with shared libs + we now have png_create_read_struct(), png_create_write_struct(), + png_create_info_struct(), png_destroy_read_struct(), and + png_destroy_write_struct() instead of the separate calls to + malloc and png_read_init(), png_info_init(), and png_write_init() + Changed warning/error callback functions to fix bug - this means you + should use the new initialization API if you were using the old + png_set_message_fn() calls, and that the old API no longer exists + so that people are aware that they need to change their code + Changed filter selection API to allow selection of multiple filters + since it didn't work in previous versions of libpng anyways + Optimized filter selection code + Fixed png_set_background() to allow using an arbitrary RGB color for + paletted images + Fixed gamma and background correction for paletted images, so + png_correct_palette is not needed unless you are correcting an + external palette (you will need to #define PNG_CORRECT_PALETTE_SUPPORTED + in pngconf.h) - if nobody uses this, it may disappear in the future. + Fixed bug with Borland 64K memory allocation (Alexander Lehmann) + Fixed bug in interlace handling (Smarasderagd, I think) + Added more error checking for writing and image to reduce invalid files + Separated read and write functions so that they won't both be linked + into a binary when only reading or writing functionality is used + New pngtest image also has interlacing and zTXt + Updated documentation to reflect new API + +Version 0.90 [January, 1997] + Made CRC errors/warnings on critical and ancillary chunks configurable + libpng will use the zlib CRC routines by (compile-time) default + Changed DOS small/medium model memory support - needs zlib 1.04 (Tim Wegner) + Added external C++ wrapper statements to png.h (Gilles Dauphin) + Allow PNG file to be read when some or all of file signature has already + been read from the beginning of the stream. ****This affects the size + of info_struct and invalidates all programs that use a shared libpng**** + Fixed png_filler() declarations + Fixed? background color conversions + Fixed order of error function pointers to match documentation + Current chunk name is now available in png_struct to reduce the number + of nearly identical error messages (will simplify multi-lingual + support when available) + Try to get ready for unknown-chunk callback functions: + - previously read critical chunks are flagged, so the chunk handling + routines can determine if the chunk is in the right place + - all chunk handling routines have the same prototypes, so we will + be able to handle all chunks via a callback mechanism + Try to fix Linux "setjmp" buffer size problems + Removed png_large_malloc, png_large_free, and png_realloc functions. + +Version 0.95 [March, 1997] + Fixed bug in pngwutil.c allocating "up_row" twice and "avg_row" never + Fixed bug in PNG file signature compares when start != 0 + Changed parameter type of png_set_filler(...filler...) from png_byte + to png_uint_32 + Added test for MACOS to ensure that both math.h and fp.h are not #included + Added macros for libpng to be compiled as a Windows DLL (Andreas Kupries) + Added "packswap" transformation, which changes the endianness of + packed-pixel bytes (Kevin Bracey) + Added "strip_alpha" transformation, which removes the alpha channel of + input images without using it (not necessarily a good idea) + Added "swap_alpha" transformation, which puts the alpha channel in front + of the color bytes instead of after + Removed all implicit variable tests which assume NULL == 0 (I think) + Changed several variables to "png_size_t" to show 16/32-bit limitations + Added new pCAL chunk read/write support + Added experimental filter selection weighting (Greg Roelofs) + Removed old png_set_rgbx() and png_set_xrgb() functions that have been + obsolete for about 2 years now (use png_set_filler() instead) + Added macros to read 16- and 32-bit ints directly from buffer, to be + used only on those systems that support it (namely PowerPC and 680x0) + With some testing, this may become the default for MACOS/PPC systems. + Only calculate CRC on data if we are going to use it + Added macros for zTXt compression type PNG_zTXt_COMPRESSION_??? + Added macros for simple libpng debugging output selectable at compile time + Removed PNG_READ_END_MODE in progressive reader (Smarasderagd) + More description of info_struct in libpng.txt and png.h + More instructions in example.c + More chunk types tested in pngtest.c + Renamed pngrcb.c to pngset.c, and all png_read_<chunk> functions to be + png_set_<chunk>. We now have corresponding png_get_<chunk> + functions in pngget.c to get information in info_ptr. This isolates + the application from the internal organization of png_info_struct + (good for shared library implementations). + +Version 0.96 [May, 1997] + Fixed serious bug with < 8bpp images introduced in 0.95 + Fixed 256-color transparency bug (Greg Roelofs) + Fixed up documentation (Greg Roelofs, Laszlo Nyul) + Fixed "error" in pngconf.h for Linux setjmp() behavior + Fixed DOS medium model support (Tim Wegner) + Fixed png_check_keyword() for case with error in static string text + Added read of CRC after IEND chunk for embedded PNGs (Laszlo Nyul) + Added typecasts to quiet compiler errors + Added more debugging info + +Version 0.97 [January, 1998] + Removed PNG_USE_OWN_CRC capability + Relocated png_set_crc_action from pngrutil.c to pngrtran.c + Fixed typecasts of "new_key", etc. (Andreas Dilger) + Added RFC 1152 [sic] date support + Fixed bug in gamma handling of 4-bit grayscale + Added 2-bit grayscale gamma handling (Glenn R-P) + Added more typecasts. 65536L becomes (png_uint_32)65536L, etc. (Glenn R-P) + Minor corrections in libpng.txt + Added simple sRGB support (Glenn R-P) + Easier conditional compiling, e.g., + define PNG_READ/WRITE_NOT_FULLY_SUPPORTED; + all configurable options can be selected from command-line instead + of having to edit pngconf.h (Glenn R-P) + Fixed memory leak in pngwrite.c (free info_ptr->text) (Glenn R-P) + Added more conditions for png_do_background, to avoid changing + black pixels to background when a background is supplied and + no pixels are transparent + Repaired PNG_NO_STDIO behavior + Tested NODIV support and made it default behavior (Greg Roelofs) + Added "-m" option and PNGTEST_DEBUG_MEMORY to pngtest (John Bowler) + Regularized version numbering scheme and bumped shared-library major + version number to 2 to avoid problems with libpng 0.89 apps + (Greg Roelofs) + +Version 0.98 [January, 1998] + Cleaned up some typos in libpng.txt and in code documentation + Fixed memory leaks in pCAL chunk processing (Glenn R-P and John Bowler) + Cosmetic change "display_gamma" to "screen_gamma" in pngrtran.c + Changed recommendation about file_gamma for PC images to .51 from .45, + in example.c and libpng.txt, added comments to distinguish between + screen_gamma, viewing_gamma, and display_gamma. + Changed all references to RFC1152 to read RFC1123 and changed the + PNG_TIME_RFC1152_SUPPORTED macro to PNG_TIME_RFC1123_SUPPORTED + Added png_invert_alpha capability (Glenn R-P -- suggestion by Jon Vincent) + Changed srgb_intent from png_byte to int to avoid compiler bugs + +Version 0.99 [January 30, 1998] + Free info_ptr->text instead of end_info_ptr->text in pngread.c (John Bowler) + Fixed a longstanding "packswap" bug in pngtrans.c + Fixed some inconsistencies in pngconf.h that prevented compiling with + PNG_READ_GAMMA_SUPPORTED and PNG_READ_hIST_SUPPORTED undefined + Fixed some typos and made other minor rearrangement of libpng.txt (Andreas) + Changed recommendation about file_gamma for PC images to .50 from .51 in + example.c and libpng.txt, and changed file_gamma for sRGB images to .45 + Added a number of functions to access information from the png structure + png_get_image_height(), etc. (Glenn R-P, suggestion by Brad Pettit) + Added TARGET_MACOS similar to zlib-1.0.8 + Define PNG_ALWAYS_EXTERN when __MWERKS__ && WIN32 are defined + Added type casting to all png_malloc() function calls + +Version 0.99a [January 31, 1998] + Added type casts and parentheses to all returns that return a value.(Tim W.) + +Version 0.99b [February 4, 1998] + Added type cast png_uint_32 on malloc function calls where needed. + Changed type of num_hist from png_uint_32 to int (same as num_palette). + Added checks for rowbytes overflow, in case png_size_t is less than 32 bits. + Renamed makefile.elf to makefile.lnx. + +Version 0.99c [February 7, 1998] + More type casting. Removed erroneous overflow test in pngmem.c. + Added png_buffered_memcpy() and png_buffered_memset(), apply them to rowbytes. + Added UNIX manual pages libpng.3 (incorporating libpng.txt) and png.5. + +Version 0.99d [February 11, 1998] + Renamed "far_to_near()" "png_far_to_near()" + Revised libpng.3 + Version 99c "buffered" operations didn't work as intended. Replaced them + with png_memcpy_check() and png_memset_check(). + Added many "if (png_ptr == NULL) return" to quell compiler warnings about + unused png_ptr, mostly in pngget.c and pngset.c. + Check for overlength tRNS chunk present when indexed-color PLTE is read. + Cleaned up spelling errors in libpng.3/libpng.txt + Corrected a problem with png_get_tRNS() which returned undefined trans array + +Version 0.99e [February 28, 1998] + Corrected png_get_tRNS() again. + Add parentheses for easier reading of pngget.c, fixed "||" should be "&&". + Touched up example.c to make more of it compileable, although the entire + file still can't be compiled (Willem van Schaik) + Fixed a bug in png_do_shift() (Bryan Tsai) + Added a space in png.h prototype for png_write_chunk_start() + Replaced pngtest.png with one created with zlib 1.1.1 + Changed pngtest to report PASS even when file size is different (Jean-loup G.) + Corrected some logic errors in png_do_invert_alpha() (Chris Patterson) + +Version 0.99f [March 5, 1998] + Corrected a bug in pngpread() introduced in version 99c (Kevin Bracey) + Moved makefiles into a "scripts" directory, and added INSTALL instruction file + Added makefile.os2 and pngos2.def (A. Zabolotny) and makefile.s2x (W. Sebok) + Added pointers to "note on libpng versions" in makefile.lnx and README + Added row callback feature when reading and writing nonprogressive rows + and added a test of this feature in pngtest.c + Added user transform callbacks, with test of the feature in pngtest.c + +Version 0.99g [March 6, 1998, morning] + Minor changes to pngtest.c to suppress compiler warnings. + Removed "beta" language from documentation. + +Version 0.99h [March 6, 1998, evening] + Minor changes to previous minor changes to pngtest.c + Changed PNG_READ_NOT_FULLY_SUPPORTED to PNG_READ_TRANSFORMS_NOT_SUPPORTED + and added PNG_PROGRESSIVE_READ_NOT_SUPPORTED macro + Added user transform capability + +Version 1.00 [March 7, 1998] + Changed several typedefs in pngrutil.c + Added makefile.wat (Pawel Mrochen), updated makefile.tc3 (Willem van Schaik) + Replaced "while(1)" with "for(;;)" + Added PNGARG() to prototypes in pngtest.c and removed some prototypes + Updated some of the makefiles (Tom Lane) + Changed some typedefs (s_start, etc.) in pngrutil.c + Fixed dimensions of "short_months" array in pngwrite.c + Replaced ansi2knr.c with the one from jpeg-v6 + +Version 1.0.0 [March 8, 1998] + Changed name from 1.00 to 1.0.0 (Adam Costello) + Added smakefile.ppc (with SCOPTIONS.ppc) for Amiga PPC (Andreas Kleinert) + +Version 1.0.0a [March 9, 1998] + Fixed three bugs in pngrtran.c to make gamma+background handling consistent + (Greg Roelofs) + Changed format of the PNG_LIBPNG_VER integer to xyyzz instead of xyz + for major, minor, and bugfix releases. This is 10001. (Adam Costello, + Tom Lane) + Make months range from 1-12 in png_convert_to_rfc1123 + +Version 1.0.0b [March 13, 1998] + Quieted compiler complaints about two empty "for" loops in pngrutil.c + Minor changes to makefile.s2x + Removed #ifdef/#endif around a png_free() in pngread.c + +Version 1.0.1 [March 14, 1998] + Changed makefile.s2x to reduce security risk of using a relative pathname + Fixed some typos in the documentation (Greg). + Fixed a problem with value of "channels" returned by png_read_update_info() + +Version 1.0.1a [April 21, 1998] + Optimized Paeth calculations by replacing abs() function calls with intrinsics + plus other loop optimizations. Improves avg decoding speed by about 20%. + Commented out i386istic "align" compiler flags in makefile.lnx. + Reduced the default warning level in some makefiles, to make them consistent. + Removed references to IJG and JPEG in the ansi2knr.c copyright statement. + Fixed a bug in png_do_strip_filler with XXRRGGBB => RRGGBB transformation. + Added grayscale and 16-bit capability to png_do_read_filler(). + Fixed a bug in pngset.c, introduced in version 0.99c, that sets rowbytes + too large when writing an image with bit_depth < 8 (Bob Dellaca). + Corrected some bugs in the experimental weighted filtering heuristics. + Moved a misplaced pngrutil code block that truncates tRNS if it has more + than num_palette entries -- test was done before num_palette was defined. + Fixed a png_convert_to_rfc1123() bug that converts day 31 to 0 (Steve Eddins). + Changed compiler flags in makefile.wat for better optimization + (Pawel Mrochen). + +Version 1.0.1b [May 2, 1998] + Relocated png_do_gray_to_rgb() within png_do_read_transformations() (Greg). + Relocated the png_composite macros from pngrtran.c to png.h (Greg). + Added makefile.sco (contributed by Mike Hopkirk). + Fixed two bugs (missing definitions of "istop") introduced in libpng-1.0.1a. + Fixed a bug in pngrtran.c that would set channels=5 under some circumstances. + More work on the Paeth-filtering, achieving imperceptible speedup + (A Kleinert). + More work on loop optimization which may help when compiled with C++ + compilers. + Added warnings when people try to use transforms they've defined out. + Collapsed 4 "i" and "c" loops into single "i" loops in pngrtran and pngwtran. + Revised paragraph about png_set_expand() in libpng.txt and libpng.3 (Greg) + +Version 1.0.1c [May 11, 1998] + Fixed a bug in pngrtran.c (introduced in libpng-1.0.1a) where the masks for + filler bytes should have been 0xff instead of 0xf. + Added max_pixel_depth=32 in pngrutil.c when using FILLER with palette images. + Moved PNG_WRITE_WEIGHTED_FILTER_SUPPORTED and PNG_WRITE_FLUSH_SUPPORTED + out of the PNG_WRITE_TRANSFORMS_NOT_SUPPORTED block of pngconf.h + Added "PNG_NO_WRITE_TRANSFORMS" etc., as alternatives for *_NOT_SUPPORTED, + for consistency, in pngconf.h + Added individual "ifndef PNG_NO_[CAPABILITY]" in pngconf.h to make it easier + to remove unwanted capabilities via the compile line + Made some corrections to grammar (which, it's) in documentation (Greg). + Corrected example.c, use of row_pointers in png_write_image(). + +Version 1.0.1d [May 24, 1998] + Corrected several statements that used side effects illegally in pngrutil.c + and pngtrans.c, that were introduced in version 1.0.1b + Revised png_read_rows() to avoid repeated if-testing for NULL (A Kleinert) + More corrections to example.c, use of row_pointers in png_write_image() + and png_read_rows(). + Added pngdll.mak and pngdef.pas to scripts directory, contributed by + Bob Dellaca, to make a png32bd.dll with Borland C++ 4.5 + Fixed error in example.c with png_set_text: num_text is 3, not 2 (Guido V.) + Changed several loops from count-down to count-up, for consistency. + +Version 1.0.1e [June 6, 1998] + Revised libpng.txt and libpng.3 description of png_set_read|write_fn(), and + added warnings when people try to set png_read_fn and png_write_fn in + the same structure. + Added a test such that png_do_gamma will be done when num_trans==0 + for truecolor images that have defined a background. This corrects an + error that was introduced in libpng-0.90 that can cause gamma processing + to be skipped. + Added tests in png.h to include "trans" and "trans_values" in structures + when PNG_READ_BACKGROUND_SUPPORTED or PNG_READ_EXPAND_SUPPORTED is defined. + Add png_free(png_ptr->time_buffer) in png_destroy_read_struct() + Moved png_convert_to_rfc_1123() from pngwrite.c to png.c + Added capability for user-provided malloc_fn() and free_fn() functions, + and revised pngtest.c to demonstrate their use, replacing the + PNGTEST_DEBUG_MEM feature. + Added makefile.w32, for Microsoft C++ 4.0 and later (Tim Wegner). + +Version 1.0.2 [June 14, 1998] + Fixed two bugs in makefile.bor . + +Version 1.0.2a [December 30, 1998] + Replaced and extended code that was removed from png_set_filler() in 1.0.1a. + Fixed a bug in png_do_filler() that made it fail to write filler bytes in + the left-most pixel of each row (Kevin Bracey). + Changed "static pngcharp tIME_string" to "static char tIME_string[30]" + in pngtest.c (Duncan Simpson). + Fixed a bug in pngtest.c that caused pngtest to try to write a tIME chunk + even when no tIME chunk was present in the source file. + Fixed a problem in pngrutil.c: gray_to_rgb didn't always work with 16-bit. + Fixed a problem in png_read_push_finish_row(), which would not skip some + passes that it should skip, for images that are less than 3 pixels high. + Interchanged the order of calls to png_do_swap() and png_do_shift() + in pngwtran.c (John Cromer). + Added #ifdef PNG_DEBUG/#endif surrounding use of PNG_DEBUG in png.h . + Changed "bad adaptive filter type" from error to warning in pngrutil.c . + Fixed a documentation error about default filtering with 8-bit indexed-color. + Separated the PNG_NO_STDIO macro into PNG_NO_STDIO and PNG_NO_CONSOLE_IO + (L. Peter Deutsch). + Added png_set_rgb_to_gray() and png_get_rgb_to_gray_status() functions. + Added png_get_copyright() and png_get_header_version() functions. + Revised comments on png_set_progressive_read_fn() in libpng.txt and example.c + Added information about debugging in libpng.txt and libpng.3 . + Changed "ln -sf" to "ln -s -f" in makefile.s2x, makefile.lnx, and + makefile.sco. + Removed lines after Dynamic Dependencies" in makefile.aco . + Revised makefile.dec to make a shared library (Jeremie Petit). + Removed trailing blanks from all files. + +Version 1.0.2a [January 6, 1999] + Removed misplaced #endif and #ifdef PNG_NO_EXTERN near the end of png.h + Added "if" tests to silence complaints about unused png_ptr in png.h and png.c + Changed "check_if_png" function in example.c to return true (nonzero) if PNG. + Changed libpng.txt to demonstrate png_sig_cmp() instead of png_check_sig() + which is obsolete. + +Version 1.0.3 [January 14, 1999] + Added makefile.hux, for Hewlett Packard HPUX 10.20 and 11.00 (Jim Rice) + Added a statement of Y2K compliance in png.h, libpng.3, and Y2KINFO. + +Version 1.0.3a [August 12, 1999] + Added check for PNG_READ_INTERLACE_SUPPORTED in pngread.c; issue a warning + if an attempt is made to read an interlaced image when it's not supported. + Added check if png_ptr->trans is defined before freeing it in pngread.c + Modified the Y2K statement to include versions back to version 0.71 + Fixed a bug in the check for valid IHDR bit_depth/color_types in pngrutil.c + Modified makefile.wat (added -zp8 flag, ".symbolic", changed some comments) + Replaced leading blanks with tab characters in makefile.hux + Changed "dworkin.wustl.edu" to "ccrc.wustl.edu" in various documents. + Changed (float)red and (float)green to (double)red, (double)green + in png_set_rgb_to_gray() to avoid "promotion" problems in AIX. + Fixed a bug in pngconf.h that omitted <stdio.h> when PNG_DEBUG==0 (K Bracey). + Reformatted libpng.3 and libpngpf.3 with proper fonts (script by J. vanZandt). + Updated documentation to refer to the PNG-1.2 specification. + Removed ansi2knr.c and left pointers to the latest source for ansi2knr.c + in makefile.knr, INSTALL, and README (L. Peter Deutsch) + Fixed bugs in calculation of the length of rowbytes when adding alpha + channels to 16-bit images, in pngrtran.c (Chris Nokleberg) + Added function png_set_user_transform_info() to store user_transform_ptr, + user_depth, and user_channels into the png_struct, and a function + png_get_user_transform_ptr() to retrieve the pointer (Chris Nokleberg) + Added function png_set_empty_plte_permitted() to make libpng useable + in MNG applications. + Corrected the typedef for png_free_ptr in png.h (Jesse Jones). + Correct gamma with srgb is 45455 instead of 45000 in pngrutil.c, to be + consistent with PNG-1.2, and allow variance of 500 before complaining. + Added assembler code contributed by Intel in file pngvcrd.c and modified + makefile.w32 to use it (Nirav Chhatrapati, INTEL Corporation, + Gilles Vollant) + Changed "ln -s -f" to "ln -f -s" in the makefiles to make Solaris happy. + Added some aliases for png_set_expand() in pngrtran.c, namely + png_set_expand_PLTE(), png_set_expand_depth(), and png_set_expand_tRNS() + (Greg Roelofs, in "PNG: The Definitive Guide"). + Added makefile.beo for BEOS on X86, contributed by Sander Stok. + +Version 1.0.3b [August 26, 1999] + Replaced 2147483647L several places with PNG_MAX_UINT macro, defined in png.h + Changed leading blanks to tabs in all makefiles. + Define PNG_USE_PNGVCRD in makefile.w32, to get MMX assembler code. + Made alternate versions of png_set_expand() in pngrtran.c, namely + png_set_gray_1_2_4_to_8, png_set_palette_to_rgb, and png_set_tRNS_to_alpha + (Greg Roelofs, in "PNG: The Definitive Guide"). Deleted the 1.0.3a aliases. + Relocated start of 'extern "C"' block in png.h so it doesn't include pngconf.h + Revised calculation of num_blocks in pngmem.c to avoid a potentially + negative shift distance, whose results are undefined in the C language. + Added a check in pngset.c to prevent writing multiple tIME chunks. + Added a check in pngwrite.c to detect invalid small window_bits sizes. + +Version 1.0.3d [September 4, 1999] + Fixed type casting of igamma in pngrutil.c + Added new png_expand functions to scripts/pngdef.pas and pngos2.def + Added a demo read_user_transform_fn that examines the row filters in pngtest.c + +Version 1.0.4 [September 24, 1999] + Define PNG_ALWAYS_EXTERN in pngconf.h if __STDC__ is defined + Delete #define PNG_INTERNAL and include "png.h" from pngasmrd.h + Made several minor corrections to pngtest.c + Renamed the makefiles with longer but more user friendly extensions. + Copied the PNG copyright and license to a separate LICENSE file. + Revised documentation, png.h, and example.c to remove reference to + "viewing_gamma" which no longer appears in the PNG specification. + Revised pngvcrd.c to use MMX code for interlacing only on the final pass. + Updated pngvcrd.c to use the faster C filter algorithms from libpng-1.0.1a + Split makefile.win32vc into two versions, makefile.vcawin32 (uses MMX + assembler code) and makefile.vcwin32 (doesn't). + Added a CPU timing report to pngtest.c (enabled by defining PNGTEST_TIMING) + Added a copy of pngnow.png to the distribution. + +Version 1.0.4a [September 25, 1999] + Increase max_pixel_depth in pngrutil.c if a user transform needs it. + Changed several division operations to right-shifts in pngvcrd.c + +Version 1.0.4b [September 30, 1999] + Added parentheses in line 3732 of pngvcrd.c + Added a comment in makefile.linux warning about buggy -O3 in pgcc 2.95.1 + +Version 1.0.4c [October 1, 1999] + Added a "png_check_version" function in png.c and pngtest.c that will generate + a helpful compiler error if an old png.h is found in the search path. + Changed type of png_user_transform_depth|channels from int to png_byte. + +Version 1.0.4d [October 6, 1999] + Changed 0.45 to 0.45455 in png_set_sRGB() + Removed unused PLTE entries from pngnow.png + Re-enabled some parts of pngvcrd.c (png_combine_row) that work properly. + +Version 1.0.4e [October 10, 1999] + Fixed sign error in pngvcrd.c (Greg Roelofs) + Replaced some instances of memcpy with simple assignments in pngvcrd (GR-P) + +Version 1.0.4f [October 15, 1999] + Surrounded example.c code with #if 0 .. #endif to prevent people from + inadvertently trying to compile it. + Changed png_get_header_version() from a function to a macro in png.h + Added type casting mostly in pngrtran.c and pngwtran.c + Removed some pointless "ptr = NULL" in pngmem.c + Added a "contrib" directory containing the source code from Greg's book. + +Version 1.0.5 [October 15, 1999] + Minor editing of the INSTALL and README files. + +Version 1.0.5a [October 23, 1999] + Added contrib/pngsuite and contrib/pngminus (Willem van Schaik) + Fixed a typo in the png_set_sRGB() function call in example.c (Jan Nijtmans) + Further optimization and bugfix of pngvcrd.c + Revised pngset.c so that it does not allocate or free memory in the user's + text_ptr structure. Instead, it makes its own copy. + Created separate write_end_info_struct in pngtest.c for a more severe test. + Added code in pngwrite.c to free info_ptr->text[i].key to stop a memory leak. + +Version 1.0.5b [November 23, 1999] + Moved PNG_FLAG_HAVE_CHUNK_HEADER, PNG_FLAG_BACKGROUND_IS_GRAY and + PNG_FLAG_WROTE_tIME from flags to mode. + Added png_write_info_before_PLTE() function. + Fixed some typecasting in contrib/gregbook/*.c + Updated scripts/makevms.com and added makevms.com to contrib/gregbook + and contrib/pngminus (Martin Zinser) + +Version 1.0.5c [November 26, 1999] + Moved png_get_header_version from png.h to png.c, to accommodate ansi2knr. + Removed all global arrays (according to PNG_NO_GLOBAL_ARRAYS macro), to + accommodate making DLL's: Moved usr_png_ver from global variable to function + png_get_header_ver() in png.c. Moved png_sig to png_sig_bytes in png.c and + eliminated use of png_sig in pngwutil.c. Moved the various png_CHNK arrays + into pngtypes.h. Eliminated use of global png_pass arrays. Declared the + png_CHNK and png_pass arrays to be "const". Made the global arrays + available to applications (although none are used in libpng itself) when + PNG_NO_GLOBAL_ARRAYS is not defined or when PNG_GLOBAL_ARRAYS is defined. + Removed some extraneous "-I" from contrib/pngminus/makefile.std + Changed the PNG_sRGB_INTENT macros in png.h to be consistent with PNG-1.2. + Change PNG_SRGB_INTENT to PNG_sRGB_INTENT in libpng.txt and libpng.3 + +Version 1.0.5d [November 29, 1999] + Add type cast (png_const_charp) two places in png.c + Eliminated pngtypes.h; use macros instead to declare PNG_CHNK arrays. + Renamed "PNG_GLOBAL_ARRAYS" to "PNG_USE_GLOBAL_ARRAYS" and made available + to applications a macro "PNG_USE_LOCAL_ARRAYS". + comment out (with #ifdef) all the new declarations when + PNG_USE_GLOBAL_ARRAYS is defined. + Added PNG_EXPORT_VAR macro to accommodate making DLL's. + +Version 1.0.5e [November 30, 1999] + Added iCCP, iTXt, and sPLT support; added "lang" member to the png_text + structure; refactored the inflate/deflate support to make adding new chunks + with trailing compressed parts easier in the future, and added new functions + png_free_iCCP, png_free_pCAL, png_free_sPLT, png_free_text, png_get_iCCP, + png_get_spalettes, png_set_iCCP, png_set_spalettes (Eric S. Raymond). + NOTE: Applications that write text chunks MUST define png_text->lang + before calling png_set_text(). It must be set to NULL if you want to + write tEXt or zTXt chunks. If you want your application to be able to + run with older versions of libpng, use + + #ifdef PNG_iTXt_SUPPORTED + png_text[i].lang = NULL; + #endif + + Changed png_get_oFFs() and png_set_oFFs() to use signed rather than unsigned + offsets (Eric S. Raymond). + Combined PNG_READ_cHNK_SUPPORTED and PNG_WRITE_cHNK_SUPPORTED macros into + PNG_cHNK_SUPPORTED and combined the three types of PNG_text_SUPPORTED + macros, leaving the separate macros also available. + Removed comments on #endifs at the end of many short, non-nested #if-blocks. + +Version 1.0.5f [December 6, 1999] + Changed makefile.solaris to issue a warning about potential problems when + the ucb "ld" is in the path ahead of the ccs "ld". + Removed "- [date]" from the "synopsis" line in libpng.3 and libpngpf.3. + Added sCAL chunk support (Eric S. Raymond). + +Version 1.0.5g [December 7, 1999] + Fixed "png_free_spallettes" typo in png.h + Added code to handle new chunks in pngpread.c + Moved PNG_CHNK string macro definitions outside of PNG_NO_EXTERN block + Added "translated_key" to png_text structure and png_write_iTXt(). + Added code in pngwrite.c to work around a newly discovered zlib bug. + +Version 1.0.5h [December 10, 1999] + NOTE: regarding the note for version 1.0.5e, the following must also + be included in your code: + png_text[i].translated_key = NULL; + Unknown chunk handling is now supported. + Option to eliminate all floating point support was added. Some new + fixed-point functions such as png_set_gAMA_fixed() were added. + Expanded tabs and removed trailing blanks in source files. + +Version 1.0.5i [December 13, 1999] + Added some type casts to silence compiler warnings. + Renamed "png_free_spalette" to "png_free_spalettes" for consistency. + Removed leading blanks from a #define in pngvcrd.c + Added some parameters to the new png_set_keep_unknown_chunks() function. + Added a test for up->location != 0 in the first instance of writing + unknown chunks in pngwrite.c + Changed "num" to "i" in png_free_spalettes() and png_free_unknowns() to + prevent recursion. + Added png_free_hIST() function. + Various patches to fix bugs in the sCAL and integer cHRM processing, + and to add some convenience macros for use with sCAL. + +Version 1.0.5j [December 21, 1999] + Changed "unit" parameter of png_write_sCAL from png_byte to int, to work + around buggy compilers. + Added new type "png_fixed_point" for integers that hold float*100000 values + Restored backward compatibility of tEXt/zTXt chunk processing: + Restored the first four members of png_text to the same order as v.1.0.5d. + Added members "lang_key" and "itxt_length" to png_text struct. Set + text_length=0 when "text" contains iTXt data. Use the "compression" + member to distinguish among tEXt/zTXt/iTXt types. Added + PNG_ITXT_COMPRESSION_NONE (1) and PNG_ITXT_COMPRESSION_zTXt(2) macros. + The "Note" above, about backward incompatibility of libpng-1.0.5e, no + longer applies. + Fixed png_read|write_iTXt() to read|write parameters in the right order, + and to write the iTXt chunk after IDAT if it appears in the end_ptr. + Added pnggccrd.c, version of pngvcrd.c Intel assembler for gcc (Greg Roelofs) + Reversed the order of trying to write floating-point and fixed-point gAMA. + +Version 1.0.5k [December 27, 1999] + Added many parentheses, e.g., "if (a && b & c)" becomes "if (a && (b & c))" + Added png_handle_as_unknown() function (Glenn) + Added png_free_chunk_list() function and chunk_list and num_chunk_list members + of png_ptr. + Eliminated erroneous warnings about multiple sPLT chunks and sPLT-after-PLTE. + Fixed a libpng-1.0.5h bug in pngrutil.c that was issuing erroneous warnings + about ignoring incorrect gAMA with sRGB (gAMA was in fact not ignored) + Added png_free_tRNS(); png_set_tRNS() now malloc's its own trans array (ESR). + Define png_get_int_32 when oFFs chunk is supported as well as when pCAL is. + Changed type of proflen from png_int_32 to png_uint_32 in png_get_iCCP(). + +Version 1.0.5l [January 1, 2000] + Added functions png_set_read_user_chunk_fn() and png_get_user_chunk_ptr() + for setting a callback function to handle unknown chunks and for + retrieving the associated user pointer (Glenn). + +Version 1.0.5m [January 7, 2000] + Added high-level functions png_read_png(), png_write_png(), png_free_pixels(). + +Version 1.0.5n [January 9, 2000] + Added png_free_PLTE() function, and modified png_set_PLTE() to malloc its + own memory for info_ptr->palette. This makes it safe for the calling + application to free its copy of the palette any time after it calls + png_set_PLTE(). + +Version 1.0.5o [January 20, 2000] + Cosmetic changes only (removed some trailing blanks and TABs) + +Version 1.0.5p [January 31, 2000] + Renamed pngdll.mak to makefile.bd32 + Cosmetic changes in pngtest.c + +Version 1.0.5q [February 5, 2000] + Relocated the makefile.solaris warning about PATH problems. + Fixed pngvcrd.c bug by pushing/popping registers in mmxsupport (Bruce Oberg) + Revised makefile.gcmmx + Added PNG_SETJMP_SUPPORTED, PNG_SETJMP_NOT_SUPPORTED, and PNG_ABORT() macros + +Version 1.0.5r [February 7, 2000] + Removed superfluous prototype for png_get_itxt from png.h + Fixed a bug in pngrtran.c that improperly expanded the background color. + Return *num_text=0 from png_get_text() when appropriate, and fix documentation + of png_get_text() in libpng.txt/libpng.3. + +Version 1.0.5s [February 18, 2000] + Added "png_jmp_env()" macro to pngconf.h, to help people migrate to the + new error handler that's planned for the next libpng release, and changed + example.c, pngtest.c, and contrib programs to use this macro. + Revised some of the DLL-export macros in pngconf.h (Greg Roelofs) + Fixed a bug in png_read_png() that caused it to fail to expand some images + that it should have expanded. + Fixed some mistakes in the unused and undocumented INCH_CONVERSIONS functions + in pngget.c + Changed the allocation of palette, history, and trans arrays back to + the version 1.0.5 method (linking instead of copying) which restores + backward compatibility with version 1.0.5. Added some remarks about + that in example.c. Added "free_me" member to info_ptr and png_ptr + and added png_free_data() function. + Updated makefile.linux and makefile.gccmmx to make directories conditionally. + Made cosmetic changes to pngasmrd.h + Added png_set_rows() and png_get_rows(), for use with png_read|write_png(). + Modified png_read_png() to allocate info_ptr->row_pointers only if it + hasn't already been allocated. + +Version 1.0.5t [March 4, 2000] + Changed png_jmp_env() migration aiding macro to png_jmpbuf(). + Fixed "interlace" typo (should be "interlaced") in contrib/gregbook/read2-x.c + Fixed bug with use of PNG_BEFORE_IHDR bit in png_ptr->mode, introduced when + PNG_FLAG_HAVE_CHUNK_HEADER was moved into png_ptr->mode in version 1.0.5b + Files in contrib/gregbook were revised to use png_jmpbuf() and to select + a 24-bit visual if one is available, and to allow abbreviated options. + Files in contrib/pngminus were revised to use the png_jmpbuf() macro. + Removed spaces in makefile.linux and makefile.gcmmx, introduced in 1.0.5s + +Version 1.0.5u [March 5, 2000] + Simplified the code that detects old png.h in png.c and pngtest.c + Renamed png_spalette (_p, _pp) to png_sPLT_t (_tp, _tpp) + Increased precision of rgb_to_gray calculations from 8 to 15 bits and + added png_set_rgb_to_gray_fixed() function. + Added makefile.bc32 (32-bit Borland C++, C mode) + +Version 1.0.5v [March 11, 2000] + Added some parentheses to the png_jmpbuf macro definition. + Updated references to the zlib home page, which has moved to freesoftware.com. + Corrected bugs in documentation regarding png_read_row() and png_write_row(). + Updated documentation of png_rgb_to_gray calculations in libpng.3/libpng.txt. + Renamed makefile.borland,turboc3 back to makefile.bor,tc3 as in version 1.0.3, + revised borland makefiles; added makefile.ibmvac3 and makefile.gcc (Cosmin) + +Version 1.0.6 [March 20, 2000] + Minor revisions of makefile.bor, libpng.txt, and gregbook/rpng2-win.c + Added makefile.sggcc (SGI IRIX with gcc) + +Version 1.0.6d [April 7, 2000] + Changed sprintf() to strcpy() in png_write_sCAL_s() to work without STDIO + Added data_length parameter to png_decompress_chunk() function + Revised documentation to remove reference to abandoned png_free_chnk functions + Fixed an error in png_rgb_to_gray_fixed() + Revised example.c, usage of png_destroy_write_struct(). + Renamed makefile.ibmvac3 to makefile.ibmc, added libpng.icc IBM project file + Added a check for info_ptr->free_me&PNG_FREE_TEXT when freeing text in png.c + Simplify png_sig_bytes() function to remove use of non-ISO-C strdup(). + +Version 1.0.6e [April 9, 2000] + Added png_data_freer() function. + In the code that checks for over-length tRNS chunks, added check of + info_ptr->num_trans as well as png_ptr->num_trans (Matthias Benckmann) + Minor revisions of libpng.txt/libpng.3. + Check for existing data and free it if the free_me flag is set, in png_set_*() + and png_handle_*(). + Only define PNG_WEIGHTED_FILTERS_SUPPORTED when PNG_FLOATING_POINT_SUPPORTED + is defined. + Changed several instances of PNG_NO_CONSOLE_ID to PNG_NO_STDIO in pngrutil.c + and mentioned the purposes of the two macros in libpng.txt/libpng.3. + +Version 1.0.6f [April 14, 2000] + Revised png_set_iCCP() and png_set_rows() to avoid prematurely freeing data. + Add checks in png_set_text() for NULL members of the input text structure. + Revised libpng.txt/libpng.3. + Removed superfluous prototype for png_set_iTXt from png.h + Removed "else" from pngread.c, after png_error(), and changed "0" to "length". + Changed several png_errors about malformed ancillary chunks to png_warnings. + +Version 1.0.6g [April 24, 2000] + Added png_pass-* arrays to pnggccrd.c when PNG_USE_LOCAL_ARRAYS is defined. + Relocated paragraph about png_set_background() in libpng.3/libpng.txt + and other revisions (Matthias Benckmann) + Relocated info_ptr->free_me, png_ptr->free_me, and other info_ptr and + png_ptr members to restore binary compatibility with libpng-1.0.5 + (breaks compatibility with libpng-1.0.6). + +Version 1.0.6h [April 24, 2000] + Changed shared library so-number pattern from 2.x.y.z to xy.z (this builds + libpng.so.10 & libpng.so.10.6h instead of libpng.so.2 & libpng.so.2.1.0.6h) + This is a temporary change for test purposes. + +Version 1.0.6i [May 2, 2000] + Rearranged some members at the end of png_info and png_struct, to put + unknown_chunks_num and free_me within the original size of the png_structs + and free_me, png_read_user_fn, and png_free_fn within the original png_info, + because some old applications allocate the structs directly instead of + using png_create_*(). + Added documentation of user memory functions in libpng.txt/libpng.3 + Modified png_read_png so that it will use user_allocated row_pointers + if present, unless free_me directs that it be freed, and added description + of the use of png_set_rows() and png_get_rows() in libpng.txt/libpng.3. + Added PNG_LEGACY_SUPPORTED macro, and #ifdef out all new (since version + 1.00) members of png_struct and png_info, to regain binary compatibility + when you define this macro. Capabilities lost in this event + are user transforms (new in version 1.0.0),the user transform pointer + (new in version 1.0.2), rgb_to_gray (new in 1.0.5), iCCP, sCAL, sPLT, + the high-level interface, and unknown chunks support (all new in 1.0.6). + This was necessary because of old applications that allocate the structs + directly as authors were instructed to do in libpng-0.88 and earlier, + instead of using png_create_*(). + Added modes PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT which + can be used to detect codes that directly allocate the structs, and + code to check these modes in png_read_init() and png_write_init() and + generate a libpng error if the modes aren't set and PNG_LEGACY_SUPPORTED + was not defined. + Added makefile.intel and updated makefile.watcom (Pawel Mrochen) + +Version 1.0.6j [May 3, 2000] + Overloaded png_read_init() and png_write_init() with macros that convert + calls to png_read_init_2() or png_write_init_2() that check the version + and structure sizes. + +Version 1.0.7beta11 [May 7, 2000] + Removed the new PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT modes + which are no longer used. + Eliminated the three new members of png_text when PNG_LEGACY_SUPPORTED is + defined or when neither PNG_READ_iTXt_SUPPORTED nor PNG_WRITE_iTXT_SUPPORTED + is defined. + Made PNG_NO_READ|WRITE_iTXt the default setting, to avoid memory + overrun when old applications fill the info_ptr->text structure directly. + Added PNGAPI macro, and added it to the definitions of all exported functions. + Relocated version macro definitions ahead of the includes of zlib.h and + pngconf.h in png.h. + +Version 1.0.7beta12 [May 12, 2000] + Revised pngset.c to avoid a problem with expanding the png_debug macro. + Deleted some extraneous defines from pngconf.h + Made PNG_NO_CONSOLE_IO the default condition when PNG_BUILD_DLL is defined. + Use MSC _RPTn debugging instead of fprintf if _MSC_VER is defined. + Added png_access_version_number() function. + Check for mask&PNG_FREE_CHNK (for TEXT, SCAL, PCAL) in png_free_data(). + Expanded libpng.3/libpng.txt information about png_data_freer(). + +Version 1.0.7beta14 [May 17, 2000] (beta13 was not published) + Changed pnggccrd.c and pngvcrd.c to handle bad adaptive filter types as + warnings instead of errors, as pngrutil.c does. + Set the PNG_INFO_IDAT valid flag in png_set_rows() so png_write_png() + will actually write IDATs. + Made the default PNG_USE_LOCAL_ARRAYS depend on PNG_DLL instead of WIN32. + Make png_free_data() ignore its final parameter except when freeing data + that can have multiple instances (text, sPLT, unknowns). + Fixed a new bug in png_set_rows(). + Removed info_ptr->valid tests from png_free_data(), as in version 1.0.5. + Added png_set_invalid() function. + Fixed incorrect illustrations of png_destroy_write_struct() in example.c. + +Version 1.0.7beta15 [May 30, 2000] + Revised the deliberately erroneous Linux setjmp code in pngconf.h to produce + fewer error messages. + Rearranged checks for Z_OK to check the most likely path first in pngpread.c + and pngwutil.c. + Added checks in pngtest.c for png_create_*() returning NULL, and mentioned + in libpng.txt/libpng.3 the need for applications to check this. + Changed names of png_default_*() functions in pngtest to pngtest_*(). + Changed return type of png_get_x|y_offset_*() from png_uint_32 to png_int_32. + Fixed some bugs in the unused PNG_INCH_CONVERSIONS functions in pngget.c + Set each pointer to NULL after freeing it in png_free_data(). + Worked around a problem in pngconf.h; AIX's strings.h defines an "index" + macro that conflicts with libpng's png_color_16.index. (Dimitri + Papadapoulos) + Added "msvc" directory with MSVC++ project files (Simon-Pierre Cadieux). + +Version 1.0.7beta16 [June 4, 2000] + Revised the workaround of AIX string.h "index" bug. + Added a check for overlength PLTE chunk in pngrutil.c. + Added PNG_NO_POINTER_INDEXING macro to use array-indexing instead of pointer + indexing in pngrutil.c and pngwutil.c to accommodate a buggy compiler. + Added a warning in png_decompress_chunk() when it runs out of data, e.g. + when it tries to read an erroneous PhotoShop iCCP chunk. + Added PNG_USE_DLL macro. + Revised the copyright/disclaimer/license notice. + Added contrib/msvctest directory + +Version 1.0.7rc1 [June 9, 2000] + Corrected the definition of PNG_TRANSFORM_INVERT_ALPHA (0x0400 not 0x0200) + Added contrib/visupng directory (Willem van Schaik) + +Version 1.0.7beta18 [June 23, 2000] + Revised PNGAPI definition, and pngvcrd.c to work with __GCC__ + and do not redefine PNGAPI if it is passed in via a compiler directive. + Revised visupng/PngFile.c to remove returns from within the Try block. + Removed leading underscores from "_PNG_H" and "_PNG_SAVE_BSD_SOURCE" macros. + Updated contrib/visupng/cexcept.h to version 1.0.0. + Fixed bugs in pngwrite.c and pngwutil.c that prevented writing iCCP chunks. + +Version 1.0.7rc2 [June 28, 2000] + Updated license to include disclaimers required by UCITA. + Fixed "DJBPP" typo in pnggccrd.c introduced in beta18. + +Version 1.0.7 [July 1, 2000] + Revised the definition of "trans_values" in libpng.3/libpng.txt + +Version 1.0.8beta1 [July 8, 2000] + Added png_free(png_ptr, key) two places in pngpread.c to stop memory leaks. + Changed PNG_NO_STDIO to PNG_NO_CONSOLE_IO, several places in pngrutil.c and + pngwutil.c. + Changed PNG_EXPORT_VAR to use PNG_IMPEXP, in pngconf.h. + Removed unused "#include <assert.h>" from png.c + Added WindowsCE support. + Revised pnggccrd.c to work with gcc-2.95.2 and in the Cygwin environment. + +Version 1.0.8beta2 [July 10, 2000] + Added project files to the wince directory and made further revisions + of pngtest.c, pngrio.c, and pngwio.c in support of WindowsCE. + +Version 1.0.8beta3 [July 11, 2000] + Only set the PNG_FLAG_FREE_TRNS or PNG_FREE_TRNS flag in png_handle_tRNS() + for indexed-color input files to avoid potential double-freeing trans array + under some unusual conditions; problem was introduced in version 1.0.6f. + Further revisions to pngtest.c and files in the wince subdirectory. + +Version 1.0.8beta4 [July 14, 2000] + Added the files pngbar.png and pngbar.jpg to the distribution. + Added makefile.cygwin, and cygwin support in pngconf.h + Added PNG_NO_ZALLOC_ZERO macro (makes png_zalloc skip zeroing memory) + +Version 1.0.8rc1 [July 16, 2000] + Revised png_debug() macros and statements to eliminate compiler warnings. + +Version 1.0.8 [July 24, 2000] + Added png_flush() in pngwrite.c, after png_write_IEND(). + Updated makefile.hpux to build a shared library. + +Version 1.0.9beta1 [November 10, 2000] + Fixed typo in scripts/makefile.hpux + Updated makevms.com in scripts and contrib/* and contrib/* (Martin Zinser) + Fixed seqence-point bug in contrib/pngminus/png2pnm (Martin Zinser) + Changed "cdrom.com" in documentation to "libpng.org" + Revised pnggccrd.c to get it all working, and updated makefile.gcmmx (Greg). + Changed type of "params" from voidp to png_voidp in png_read|write_png(). + Make sure PNGAPI and PNG_IMPEXP are defined in pngconf.h. + Revised the 3 instances of WRITEFILE in pngtest.c. + Relocated "msvc" and "wince" project subdirectories into "dll" subdirectory. + Updated png.rc in dll/msvc project + Revised makefile.dec to define and use LIBPATH and INCPATH + Increased size of global png_libpng_ver[] array from 12 to 18 chars. + Made global png_libpng_ver[], png_sig[] and png_pass_*[] arrays const. + Removed duplicate png_crc_finish() from png_handle_bKGD() function. + Added a warning when application calls png_read_update_info() multiple times. + Revised makefile.cygwin + Fixed bugs in iCCP support in pngrutil.c and pngwutil.c. + Replaced png_set_empty_plte_permitted() with png_permit_mng_features(). + +Version 1.0.9beta2 [November 19, 2000] + Renamed the "dll" subdirectory "projects". + Added borland project files to "projects" subdirectory. + Set VS_FF_PRERELEASE and VS_FF_PATCHED flags in msvc/png.rc when appropriate. + Add error message in png_set_compression_buffer_size() when malloc fails. + +Version 1.0.9beta3 [November 23, 2000] + Revised PNG_LIBPNG_BUILD_TYPE macro in png.h, used in the msvc project. + Removed the png_flush() in pngwrite.c that crashes some applications + that don't set png_output_flush_fn. + Added makefile.macosx and makefile.aix to scripts directory. + +Version 1.0.9beta4 [December 1, 2000] + Change png_chunk_warning to png_warning in png_check_keyword(). + Increased the first part of msg buffer from 16 to 18 in png_chunk_error(). + +Version 1.0.9beta5 [December 15, 2000] + Added support for filter method 64 (for PNG datastreams embedded in MNG). + +Version 1.0.9beta6 [December 18, 2000] + Revised png_set_filter() to accept filter method 64 when appropriate. + Added new PNG_HAVE_PNG_SIGNATURE bit to png_ptr->mode and use it to + help prevent applications from using MNG features in PNG datastreams. + Added png_permit_mng_features() function. + Revised libpng.3/libpng.txt. Changed "filter type" to "filter method". + +Version 1.0.9rc1 [December 23, 2000] + Revised test for PNG_HAVE_PNG_SIGNATURE in pngrutil.c + Fixed error handling of unknown compression type in png_decompress_chunk(). + In pngconf.h, define __cdecl when _MSC_VER is defined. + +Version 1.0.9beta7 [December 28, 2000] + Changed PNG_TEXT_COMPRESSION_zTXt to PNG_COMPRESSION_TYPE_BASE several places. + Revised memory management in png_set_hIST and png_handle_hIST in a backward + compatible manner. PLTE and tRNS were revised similarly. + Revised the iCCP chunk reader to ignore trailing garbage. + +Version 1.0.9beta8 [January 12, 2001] + Moved pngasmrd.h into pngconf.h. + Improved handling of out-of-spec garbage iCCP chunks generated by PhotoShop. + +Version 1.0.9beta9 [January 15, 2001] + Added png_set_invalid, png_permit_mng_features, and png_mmx_supported to + wince and msvc project module definition files. + Minor revision of makefile.cygwin. + Fixed bug with progressive reading of narrow interlaced images in pngpread.c + +Version 1.0.9beta10 [January 16, 2001] + Do not typedef png_FILE_p in pngconf.h when PNG_NO_STDIO is defined. + Fixed "png_mmx_supported" typo in project definition files. + +Version 1.0.9beta11 [January 19, 2001] + Updated makefile.sgi to make shared library. + Removed png_mmx_support() function and disabled PNG_MNG_FEATURES_SUPPORTED + by default, for the benefit of DLL forward compatibility. These will + be re-enabled in version 1.2.0. + +Version 1.0.9rc2 [January 22, 2001] + Revised cygwin support. + +Version 1.0.9 [January 31, 2001] + Added check of cygwin's ALL_STATIC in pngconf.h + Added "-nommx" parameter to contrib/gregbook/rpng2-win and rpng2-x demos. + +Version 1.0.10beta1 [March 14, 2001] + Revised makefile.dec, makefile.sgi, and makefile.sggcc; added makefile.hpgcc. + Reformatted libpng.3 to eliminate bad line breaks. + Added checks for _mmx_supported in the read_filter_row function of pnggccrd.c + Added prototype for png_mmx_support() near the top of pnggccrd.c + Moved some error checking from png_handle_IHDR to png_set_IHDR. + Added PNG_NO_READ_SUPPORTED and PNG_NO_WRITE_SUPPORTED macros. + Revised png_mmx_support() function in pnggccrd.c + Restored version 1.0.8 PNG_WRITE_EMPTY_PLTE_SUPPORTED behavior in pngwutil.c + Fixed memory leak in contrib/visupng/PngFile.c + Fixed bugs in png_combine_row() in pnggccrd.c and pngvcrd.c (C version) + Added warnings when retrieving or setting gamma=0. + Increased the first part of msg buffer from 16 to 18 in png_chunk_warning(). + +Version 1.0.10rc1 [March 23, 2001] + Changed all instances of memcpy, strcpy, and strlen to png_memcpy, png_strcpy, + and png_strlen. + Revised png_mmx_supported() function in pnggccrd.c to return proper value. + Fixed bug in progressive reading (pngpread.c) with small images (height < 8). + +Version 1.0.10 [March 30, 2001] + Deleted extraneous space (introduced in 1.0.9) from line 42 of makefile.cygwin + Added beos project files (Chris Herborth) + +Version 1.0.11beta1 [April 3, 2001] + Added type casts on several png_malloc() calls (Dimitri Papadapoulos). + Removed a no-longer needed AIX work-around from pngconf.h + Changed several "//" single-line comments to C-style in pnggccrd.c + +Version 1.0.11beta2 [April 11, 2001] + Removed PNGAPI from several functions whose prototypes did not have PNGAPI. + Updated scripts/pngos2.def + +Version 1.0.11beta3 [April 14, 2001] + Added checking the results of many instances of png_malloc() for NULL + +Version 1.0.11beta4 [April 20, 2001] + Undid the changes from version 1.0.11beta3. Added a check for NULL return + from user's malloc_fn(). + Removed some useless type casts of the NULL pointer. + Added makefile.netbsd + +Version 1.0.11 [April 27, 2001] + Revised makefile.netbsd + +Version 1.0.12beta1 [May 14, 2001] + Test for Windows platform in pngconf.h when including malloc.h (Emmanuel Blot) + Updated makefile.cygwin and handling of Cygwin's ALL_STATIC in pngconf.h + Added some never-to-be-executed code in pnggccrd.c to quiet compiler warnings. + Eliminated the png_error about apps using png_read|write_init(). Instead, + libpng will reallocate the png_struct and info_struct if they are too small. + This retains future binary compatibility for old applications written for + libpng-0.88 and earlier. + +Version 1.2.0beta1 [May 6, 2001] + Bumped DLLNUM to 2. + Re-enabled PNG_MNG_FEATURES_SUPPORTED and enabled PNG_ASSEMBLER_CODE_SUPPORTED + by default. + Added runtime selection of MMX features. + Added png_set_strip_error_numbers function and related macros. + +Version 1.2.0beta2 [May 7, 2001] + Finished merging 1.2.0beta1 with version 1.0.11 + Added a check for attempts to read or write PLTE in grayscale PNG datastreams. + +Version 1.2.0beta3 [May 17, 2001] + Enabled user memory function by default. + Modified png_create_struct so it passes user mem_ptr to user memory allocator. + Increased png_mng_features flag from png_byte to png_uint_32. + Bumped shared-library (so-number) and dll-number to 3. + +Version 1.2.0beta4 [June 23, 2001] + Check for missing profile length field in iCCP chunk and free chunk_data + in case of truncated iCCP chunk. + Bumped shared-library number to 3 in makefile.sgi and makefile.sggcc + Bumped dll-number from 2 to 3 in makefile.cygwin + Revised contrib/gregbook/rpng*-x.c to avoid a memory leak and to exit cleanly + if user attempts to run it on an 8-bit display. + Updated contrib/gregbook + Use png_malloc instead of png_zalloc to allocate palette in pngset.c + Updated makefile.ibmc + Added some typecasts to eliminate gcc 3.0 warnings. Changed prototypes + of png_write_oFFS width and height from png_uint_32 to png_int_32. + Updated example.c + Revised prototypes for png_debug_malloc and png_debug_free in pngtest.c + +Version 1.2.0beta5 [August 8, 2001] + Revised contrib/gregbook + Revised makefile.gcmmx + Revised pnggccrd.c to conditionally compile some thread-unsafe code only + when PNG_THREAD_UNSAFE_OK is defined. + Added tests to prevent pngwutil.c from writing a bKGD or tRNS chunk with + value exceeding 2^bit_... [truncated message content] |
From: <ljs...@us...> - 2012-02-28 14:00:44
|
Revision: 753 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=753&view=rev Author: ljsebald Date: 2012-02-28 14:00:32 +0000 (Tue, 28 Feb 2012) Log Message: ----------- Update libbz2 to 1.0.6. Modified Paths: -------------- kos-ports/include/bzlib/bzlib.h kos-ports/libbz2/CHANGES kos-ports/libbz2/LICENSE kos-ports/libbz2/README kos-ports/libbz2/blocksort.c kos-ports/libbz2/bzlib.c kos-ports/libbz2/bzlib_private.h kos-ports/libbz2/compress.c kos-ports/libbz2/crctable.c kos-ports/libbz2/decompress.c kos-ports/libbz2/huffman.c kos-ports/libbz2/kos/README.KOS kos-ports/libbz2/randtable.c Added Paths: ----------- kos-ports/libbz2/manual.html kos-ports/libbz2/manual.pdf kos-ports/libbz2/manual.ps kos-ports/libbz2/manual.xml Modified: kos-ports/include/bzlib/bzlib.h =================================================================== --- kos-ports/include/bzlib/bzlib.h 2012-02-28 13:11:51 UTC (rev 752) +++ kos-ports/include/bzlib/bzlib.h 2012-02-28 14:00:32 UTC (rev 753) @@ -4,61 +4,21 @@ /*--- bzlib.h ---*/ /*-------------------------------------------------------------*/ -/*-- - This file is a part of bzip2 and/or libbzip2, a program and - library for lossless, block-sorting data compression. +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. - Copyright (C) 1996-2002 Julian R Seward. All rights reserved. + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <js...@bz...> - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Julian Seward, Cambridge, UK. - js...@ac... - bzip2/libbzip2 version 1.0 of 21 March 2000 - - This program is based on (at least) the work of: - Mike Burrows - David Wheeler - Peter Fenwick - Alistair Moffat - Radford Neal - Ian H. Witten - Robert Sedgewick - Jon L. Bentley - - For more information on these sources, see the manual. ---*/ - - #ifndef _BZLIB_H #define _BZLIB_H @@ -110,8 +70,10 @@ #define BZ_EXPORT #endif +#ifndef BZ_NO_STDIO /* Need a definitition for FILE */ #include <stdio.h> +#endif #ifdef _WIN32 # include <windows.h> @@ -260,8 +222,7 @@ /*-- - Code contributed by Yoshioka Tsuneo - (QWF...@ni.../tsu...@is...), + Code contributed by Yoshioka Tsuneo (ts...@rr...) to support better zlib compatibility. This code is not _officially_ part of libbzip2 (yet); I haven't tested it, documented it, or considered the Modified: kos-ports/libbz2/CHANGES =================================================================== --- kos-ports/libbz2/CHANGES 2012-02-28 13:11:51 UTC (rev 752) +++ kos-ports/libbz2/CHANGES 2012-02-28 14:00:32 UTC (rev 753) @@ -1,5 +1,18 @@ + ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <js...@bz...> + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ + + 0.9.0 ~~~~~ First version. @@ -251,3 +264,64 @@ * added --fast and --best aliases for -1 -9 for gzip compatibility. + +1.0.3 (15 Feb 05) +~~~~~~~~~~~~~~~~~ +Fixes some minor bugs since the last version, 1.0.2. + +* Further robustification against corrupted compressed data. + There are currently no known bitstreams which can cause the + decompressor to crash, loop or access memory which does not + belong to it. If you are using bzip2 or the library to + decompress bitstreams from untrusted sources, an upgrade + to 1.0.3 is recommended. This fixes CAN-2005-1260. + +* The documentation has been converted to XML, from which html + and pdf can be derived. + +* Various minor bugs in the documentation have been fixed. + +* Fixes for various compilation warnings with newer versions of + gcc, and on 64-bit platforms. + +* The BZ_NO_STDIO cpp symbol was not properly observed in 1.0.2. + This has been fixed. + + +1.0.4 (20 Dec 06) +~~~~~~~~~~~~~~~~~ +Fixes some minor bugs since the last version, 1.0.3. + +* Fix file permissions race problem (CAN-2005-0953). + +* Avoid possible segfault in BZ2_bzclose. From Coverity's NetBSD + scan. + +* 'const'/prototype cleanups in the C code. + +* Change default install location to /usr/local, and handle multiple + 'make install's without error. + +* Sanitise file names more carefully in bzgrep. Fixes CAN-2005-0758 + to the extent that applies to bzgrep. + +* Use 'mktemp' rather than 'tempfile' in bzdiff. + +* Tighten up a couple of assertions in blocksort.c following automated + analysis. + +* Fix minor doc/comment bugs. + + +1.0.5 (10 Dec 07) +~~~~~~~~~~~~~~~~~ +Security fix only. Fixes CERT-FI 20469 as it applies to bzip2. + + +1.0.6 (6 Sept 10) +~~~~~~~~~~~~~~~~~ + +* Security fix for CVE-2010-0405. This was reported by Mikolaj + Izdebski. + +* Make the documentation build on Ubuntu 10.04 Modified: kos-ports/libbz2/LICENSE =================================================================== --- kos-ports/libbz2/LICENSE 2012-02-28 13:11:51 UTC (rev 752) +++ kos-ports/libbz2/LICENSE 2012-02-28 14:00:32 UTC (rev 753) @@ -1,7 +1,10 @@ -This program, "bzip2" and associated library "libbzip2", are -copyright (C) 1996-2002 Julian R Seward. All rights reserved. +-------------------------------------------------------------------------- +This program, "bzip2", the associated library "libbzip2", and all +documentation, are copyright (C) 1996-2010 Julian R Seward. All +rights reserved. + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -33,7 +36,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -Julian Seward, Cambridge, UK. -js...@ac... -bzip2/libbzip2 version 1.0.2 of 30 December 2001 +Julian Seward, js...@bz... +bzip2/libbzip2 version 1.0.6 of 6 September 2010 +-------------------------------------------------------------------------- Modified: kos-ports/libbz2/README =================================================================== --- kos-ports/libbz2/README 2012-02-28 13:11:51 UTC (rev 752) +++ kos-ports/libbz2/README 2012-02-28 14:00:32 UTC (rev 753) @@ -1,35 +1,50 @@ -This is the README for bzip2, a block-sorting file compressor, version -1.0.2. This version is fully compatible with the previous public -releases, versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0 and 1.0.1. +This is the README for bzip2/libzip2. +This version is fully compatible with the previous public releases. -bzip2-1.0.2 is distributed under a BSD-style license. For details, -see the file LICENSE. +------------------------------------------------------------------ +This file is part of bzip2/libbzip2, a program and library for +lossless, block-sorting data compression. +bzip2/libbzip2 version 1.0.6 of 6 September 2010 +Copyright (C) 1996-2010 Julian Seward <js...@bz...> + +Please read the WARNING, DISCLAIMER and PATENTS sections in this file. + +This program is released under the terms of the license contained +in the file LICENSE. +------------------------------------------------------------------ + Complete documentation is available in Postscript form (manual.ps), -PDF (manual.pdf, amazingly enough) or html (manual_toc.html). A -plain-text version of the manual page is available as bzip2.txt. -A statement about Y2K issues is now included in the file Y2K_INFO. +PDF (manual.pdf) or html (manual.html). A plain-text version of the +manual page is available as bzip2.txt. HOW TO BUILD -- UNIX -Type `make'. This builds the library libbz2.a and then the -programs bzip2 and bzip2recover. Six self-tests are run. -If the self-tests complete ok, carry on to installation: +Type 'make'. This builds the library libbz2.a and then the programs +bzip2 and bzip2recover. Six self-tests are run. If the self-tests +complete ok, carry on to installation: -To install in /usr/bin, /usr/lib, /usr/man and /usr/include, type +To install in /usr/local/bin, /usr/local/lib, /usr/local/man and +/usr/local/include, type + make install -To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type + +To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type + make install PREFIX=/xxx/yyy + If you are (justifiably) paranoid and want to see what 'make install' is going to do, you can first do + make -n install or make -n install PREFIX=/xxx/yyy respectively. -The -n instructs make to show the commands it would execute, but -not actually execute them. +The -n instructs make to show the commands it would execute, but not +actually execute them. + HOW TO BUILD -- UNIX, shared library libbz2.so. Do 'make -f Makefile-libbz2_so'. This Makefile seems to work for @@ -49,23 +64,25 @@ bzCompress to BZ2_bzCompress, to avoid namespace pollution. Unfortunately this means that the libbz2.so created by Makefile-libbz2_so will not work with any program which used an older -version of the library. Sorry. I do encourage library clients to -make the effort to upgrade to use version 1.0, since it is both faster -and more robust than previous versions. +version of the library. I do encourage library clients to make the +effort to upgrade to use version 1.0, since it is both faster and more +robust than previous versions. HOW TO BUILD -- Windows 95, NT, DOS, Mac, etc. It's difficult for me to support compilation on all these platforms. My approach is to collect binaries for these platforms, and put them -on the master web page (http://sources.redhat.com/bzip2). Look there. -However (FWIW), bzip2-1.0.X is very standard ANSI C and should compile +on the master web site (http://www.bzip.org). Look there. However +(FWIW), bzip2-1.0.X is very standard ANSI C and should compile unmodified with MS Visual C. If you have difficulties building, you might want to read README.COMPILATION.PROBLEMS. At least using MS Visual C++ 6, you can build from the unmodified sources by issuing, in a command shell: + nmake -f makefile.msc + (you may need to first run the MSVC-provided script VCVARS32.BAT so as to set up paths to the MSVC tools correctly). @@ -78,8 +95,7 @@ Nelson's churn program. Churn is an automated test driver which recursively traverses a directory structure, using bzip2 to compress and then decompress each file it encounters, and checking that the -decompressed data is the same as the original. There are more details -in Section 4 of the user guide. +decompressed data is the same as the original. @@ -87,18 +103,19 @@ WARNING: - This program (attempts to) compress data by performing several - non-trivial transformations on it. Unless you are 100% familiar - with *all* the algorithms contained herein, and with the - consequences of modifying them, you should NOT meddle with the - compression or decompression machinery. Incorrect changes can and - very likely *will* lead to disastrous loss of data. + This program and library (attempts to) compress data by + performing several non-trivial transformations on it. + Unless you are 100% familiar with *all* the algorithms + contained herein, and with the consequences of modifying them, + you should NOT meddle with the compression or decompression + machinery. Incorrect changes can and very likely *will* + lead to disastrous loss of data. DISCLAIMER: I TAKE NO RESPONSIBILITY FOR ANY LOSS OF DATA ARISING FROM THE - USE OF THIS PROGRAM, HOWSOEVER CAUSED. + USE OF THIS PROGRAM/LIBRARY, HOWSOEVER CAUSED. Every compression of a file implies an assumption that the compressed file can be decompressed to reproduce the original. @@ -111,19 +128,18 @@ PROGRAM UNLESS YOU ARE PREPARED TO ACCEPT THE POSSIBILITY, HOWEVER SMALL, THAT THE DATA WILL NOT BE RECOVERABLE. - That is not to say this program is inherently unreliable. Indeed, - I very much hope the opposite is true. bzip2 has been carefully - constructed and extensively tested. + That is not to say this program is inherently unreliable. + Indeed, I very much hope the opposite is true. bzip2/libbzip2 + has been carefully constructed and extensively tested. PATENTS: - To the best of my knowledge, bzip2 does not use any patented - algorithms. However, I do not have the resources available to - carry out a full patent search. Therefore I cannot give any + To the best of my knowledge, bzip2/libbzip2 does not use any + patented algorithms. However, I do not have the resources + to carry out a patent search. Therefore I cannot give any guarantee of the above statement. -End of legalities. WHAT'S NEW IN 0.9.0 (as compared to 0.1pl2) ? @@ -153,23 +169,37 @@ See the CHANGES file. +WHAT'S NEW IN 1.0.3 ? + See the CHANGES file. + +WHAT'S NEW IN 1.0.4 ? + + See the CHANGES file. + +WHAT'S NEW IN 1.0.5 ? + + See the CHANGES file. + +WHAT'S NEW IN 1.0.6 ? + + See the CHANGES file. + + I hope you find bzip2 useful. Feel free to contact me at - js...@ac... + js...@bz... if you have any suggestions or queries. Many people mailed me with comments, suggestions and patches after the releases of bzip-0.15, -bzip-0.21, and bzip2 versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0 and 1.0.1, -and the changes in bzip2 are largely a result of this feedback. -I thank you for your comments. +bzip-0.21, and bzip2 versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, +1.0.2 and 1.0.3, and the changes in bzip2 are largely a result of this +feedback. I thank you for your comments. -At least for the time being, bzip2's "home" is (or can be reached via) -http://sources.redhat.com/bzip2. +bzip2's "home" is http://www.bzip.org/ Julian Seward -js...@ac... +js...@bz... +Cambridge, UK. -Cambridge, UK (and what a great town this is!) - 18 July 1996 (version 0.15) 25 August 1996 (version 0.21) 7 August 1997 (bzip2, version 0.1) @@ -178,4 +208,8 @@ 8 June 1999 (bzip2, version 0.9.5) 4 Sept 1999 (bzip2, version 0.9.5d) 5 May 2000 (bzip2, version 1.0pre8) -30 December 2001 (bzip2, version 1.0.2pre1) \ No newline at end of file +30 December 2001 (bzip2, version 1.0.2pre1) +15 February 2005 (bzip2, version 1.0.3) +20 December 2006 (bzip2, version 1.0.4) +10 December 2007 (bzip2, version 1.0.5) + 6 Sept 2010 (bzip2, version 1.0.6) Modified: kos-ports/libbz2/blocksort.c =================================================================== --- kos-ports/libbz2/blocksort.c 2012-02-28 13:11:51 UTC (rev 752) +++ kos-ports/libbz2/blocksort.c 2012-02-28 14:00:32 UTC (rev 753) @@ -4,68 +4,21 @@ /*--- blocksort.c ---*/ /*-------------------------------------------------------------*/ -/*-- - This file is a part of bzip2 and/or libbzip2, a program and - library for lossless, block-sorting data compression. +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. - Copyright (C) 1996-2002 Julian R Seward. All rights reserved. + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <js...@bz...> - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Julian Seward, Cambridge, UK. - js...@ac... - bzip2/libbzip2 version 1.0 of 21 March 2000 - - This program is based on (at least) the work of: - Mike Burrows - David Wheeler - Peter Fenwick - Alistair Moffat - Radford Neal - Ian H. Witten - Robert Sedgewick - Jon L. Bentley - - For more information on these sources, see the manual. - - To get some idea how the block sorting algorithms in this file - work, read my paper - On the Performance of BWT Sorting Algorithms - in Proceedings of the IEEE Data Compression Conference 2000, - Snowbird, Utah, USA, 27-30 March 2000. The main sort in this - file implements the algorithm called cache in the paper. ---*/ - - #include "bzlib_private.h" /*---------------------------------------------*/ @@ -155,7 +108,7 @@ while (sp > 0) { - AssertH ( sp < FALLBACK_QSORT_STACK_SIZE, 1004 ); + AssertH ( sp < FALLBACK_QSORT_STACK_SIZE - 1, 1004 ); fpop ( lo, hi ); if (hi - lo < FALLBACK_QSORT_SMALL_THRESH) { @@ -690,7 +643,7 @@ while (sp > 0) { - AssertH ( sp < MAIN_QSORT_STACK_SIZE, 1001 ); + AssertH ( sp < MAIN_QSORT_STACK_SIZE - 2, 1001 ); mpop ( lo, hi, d ); if (hi - lo < MAIN_QSORT_SMALL_THRESH || Modified: kos-ports/libbz2/bzlib.c =================================================================== --- kos-ports/libbz2/bzlib.c 2012-02-28 13:11:51 UTC (rev 752) +++ kos-ports/libbz2/bzlib.c 2012-02-28 14:00:32 UTC (rev 753) @@ -4,75 +4,30 @@ /*--- bzlib.c ---*/ /*-------------------------------------------------------------*/ -/*-- - This file is a part of bzip2 and/or libbzip2, a program and - library for lossless, block-sorting data compression. +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. - Copyright (C) 1996-2002 Julian R Seward. All rights reserved. + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <js...@bz...> - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Julian Seward, Cambridge, UK. - js...@ac... - bzip2/libbzip2 version 1.0 of 21 March 2000 - - This program is based on (at least) the work of: - Mike Burrows - David Wheeler - Peter Fenwick - Alistair Moffat - Radford Neal - Ian H. Witten - Robert Sedgewick - Jon L. Bentley - - For more information on these sources, see the manual. ---*/ - -/*-- - CHANGES - ~~~~~~~ - 0.9.0 -- original version. - +/* CHANGES + 0.9.0 -- original version. 0.9.0a/b -- no changes in this file. + 0.9.0c -- made zero-length BZ_FLUSH work correctly in bzCompress(). + fixed bzWrite/bzRead to ignore zero-length requests. + fixed bzread to correctly handle read requests after EOF. + wrong parameter order in call to bzDecompressInit in + bzBuffToBuffDecompress. Fixed. +*/ - 0.9.0c - * made zero-length BZ_FLUSH work correctly in bzCompress(). - * fixed bzWrite/bzRead to ignore zero-length requests. - * fixed bzread to correctly handle read requests after EOF. - * wrong parameter order in call to bzDecompressInit in - bzBuffToBuffDecompress. Fixed. ---*/ - #include "bzlib_private.h" @@ -88,12 +43,12 @@ fprintf(stderr, "\n\nbzip2/libbzip2: internal error number %d.\n" "This is a bug in bzip2/libbzip2, %s.\n" - "Please report it to me at: js...@ac.... If this happened\n" + "Please report it to me at: js...@bz.... If this happened\n" "when you were using some program which uses libbzip2 as a\n" "component, you should also report this bug to the author(s)\n" "of that program. Please make an effort to report this bug;\n" "timely and accurate bug reports eventually lead to higher\n" - "quality software. Thanks. Julian Seward, 30 December 2001.\n\n", + "quality software. Thanks. Julian Seward, 10 December 2007.\n\n", errcode, BZ2_bzlibVersion() ); @@ -574,8 +529,11 @@ /*---------------------------------------------------*/ +/* Return True iff data corruption is discovered. + Returns False if there is no problem. +*/ static -void unRLE_obuf_to_output_FAST ( DState* s ) +Bool unRLE_obuf_to_output_FAST ( DState* s ) { UChar k1; @@ -584,7 +542,7 @@ while (True) { /* try to finish existing run */ while (True) { - if (s->strm->avail_out == 0) return; + if (s->strm->avail_out == 0) return False; if (s->state_out_len == 0) break; *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); @@ -594,10 +552,13 @@ s->strm->total_out_lo32++; if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; } - + /* can a new run be started? */ - if (s->nblock_used == s->save_nblock+1) return; + if (s->nblock_used == s->save_nblock+1) return False; + /* Only caused by corrupt data stream? */ + if (s->nblock_used > s->save_nblock+1) + return True; s->state_out_len = 1; s->state_out_ch = s->k0; @@ -637,6 +598,7 @@ UInt32 c_tPos = s->tPos; char* cs_next_out = s->strm->next_out; unsigned int cs_avail_out = s->strm->avail_out; + Int32 ro_blockSize100k = s->blockSize100k; /* end restore */ UInt32 avail_out_INIT = cs_avail_out; @@ -667,6 +629,10 @@ cs_avail_out--; } } + /* Only caused by corrupt data stream? */ + if (c_nblock_used > s_save_nblockPP) + return True; + /* can a new run be started? */ if (c_nblock_used == s_save_nblockPP) { c_state_out_len = 0; goto return_notr; @@ -712,6 +678,7 @@ s->strm->avail_out = cs_avail_out; /* end save */ } + return False; } @@ -732,8 +699,11 @@ /*---------------------------------------------------*/ +/* Return True iff data corruption is discovered. + Returns False if there is no problem. +*/ static -void unRLE_obuf_to_output_SMALL ( DState* s ) +Bool unRLE_obuf_to_output_SMALL ( DState* s ) { UChar k1; @@ -742,7 +712,7 @@ while (True) { /* try to finish existing run */ while (True) { - if (s->strm->avail_out == 0) return; + if (s->strm->avail_out == 0) return False; if (s->state_out_len == 0) break; *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); @@ -754,8 +724,11 @@ } /* can a new run be started? */ - if (s->nblock_used == s->save_nblock+1) return; - + if (s->nblock_used == s->save_nblock+1) return False; + + /* Only caused by corrupt data stream? */ + if (s->nblock_used > s->save_nblock+1) + return True; s->state_out_len = 1; s->state_out_ch = s->k0; @@ -788,7 +761,7 @@ while (True) { /* try to finish existing run */ while (True) { - if (s->strm->avail_out == 0) return; + if (s->strm->avail_out == 0) return False; if (s->state_out_len == 0) break; *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); @@ -800,7 +773,11 @@ } /* can a new run be started? */ - if (s->nblock_used == s->save_nblock+1) return; + if (s->nblock_used == s->save_nblock+1) return False; + + /* Only caused by corrupt data stream? */ + if (s->nblock_used > s->save_nblock+1) + return True; s->state_out_len = 1; s->state_out_ch = s->k0; @@ -830,6 +807,7 @@ /*---------------------------------------------------*/ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm ) { + Bool corrupt; DState* s; if (strm == NULL) return BZ_PARAM_ERROR; s = strm->state; @@ -840,12 +818,13 @@ if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR; if (s->state == BZ_X_OUTPUT) { if (s->smallDecompress) - unRLE_obuf_to_output_SMALL ( s ); else - unRLE_obuf_to_output_FAST ( s ); + corrupt = unRLE_obuf_to_output_SMALL ( s ); else + corrupt = unRLE_obuf_to_output_FAST ( s ); + if (corrupt) return BZ_DATA_ERROR; if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) { BZ_FINALISE_CRC ( s->calculatedBlockCRC ); if (s->verbosity >= 3) - VPrintf2 ( " {0x%x, 0x%x}", s->storedBlockCRC, + VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC, s->calculatedBlockCRC ); if (s->verbosity >= 2) VPrintf0 ( "]" ); if (s->calculatedBlockCRC != s->storedBlockCRC) @@ -863,7 +842,7 @@ Int32 r = BZ2_decompress ( s ); if (r == BZ_STREAM_END) { if (s->verbosity >= 3) - VPrintf2 ( "\n combined CRCs: stored = 0x%x, computed = 0x%x", + VPrintf2 ( "\n combined CRCs: stored = 0x%08x, computed = 0x%08x", s->storedCombinedCRC, s->calculatedCombinedCRC ); if (s->calculatedCombinedCRC != s->storedCombinedCRC) return BZ_DATA_ERROR; @@ -1371,8 +1350,7 @@ /*---------------------------------------------------*/ /*-- - Code contributed by Yoshioka Tsuneo - (QWF...@ni.../tsu...@is...), + Code contributed by Yoshioka Tsuneo (ts...@rr...) to support better zlib compatibility. This code is not _officially_ part of libbzip2 (yet); I haven't tested it, documented it, or considered the @@ -1383,7 +1361,7 @@ /*---------------------------------------------------*/ /*-- - return version like "0.9.0c". + return version like "0.9.5d, 4-Sept-1999". --*/ const char * BZ_API(BZ2_bzlibVersion)(void) { @@ -1536,9 +1514,10 @@ void BZ_API(BZ2_bzclose) (BZFILE* b) { int bzerr; - FILE *fp = ((bzFile *)b)->handle; + FILE *fp; if (b==NULL) {return;} + fp = ((bzFile *)b)->handle; if(((bzFile*)b)->writing){ BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL); if(bzerr != BZ_OK){ @@ -1557,7 +1536,7 @@ /*-- return last error code --*/ -static char *bzerrorstrings[] = { +static const char *bzerrorstrings[] = { "OK" ,"SEQUENCE_ERROR" ,"PARAM_ERROR" Modified: kos-ports/libbz2/bzlib_private.h =================================================================== --- kos-ports/libbz2/bzlib_private.h 2012-02-28 13:11:51 UTC (rev 752) +++ kos-ports/libbz2/bzlib_private.h 2012-02-28 14:00:32 UTC (rev 753) @@ -4,61 +4,21 @@ /*--- bzlib_private.h ---*/ /*-------------------------------------------------------------*/ -/*-- - This file is a part of bzip2 and/or libbzip2, a program and - library for lossless, block-sorting data compression. +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. - Copyright (C) 1996-2002 Julian R Seward. All rights reserved. + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <js...@bz...> - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Julian Seward, Cambridge, UK. - js...@ac... - bzip2/libbzip2 version 1.0 of 21 March 2000 - - This program is based on (at least) the work of: - Mike Burrows - David Wheeler - Peter Fenwick - Alistair Moffat - Radford Neal - Ian H. Witten - Robert Sedgewick - Jon L. Bentley - - For more information on these sources, see the manual. ---*/ - - #ifndef _BZLIB_PRIVATE_H #define _BZLIB_PRIVATE_H @@ -76,7 +36,7 @@ /*-- General stuff. --*/ -#define BZ_VERSION "1.0.2, 30-Dec-2001" +#define BZ_VERSION "1.0.6, 6-Sept-2010" typedef char Char; typedef unsigned char Bool; @@ -94,9 +54,11 @@ #endif #ifndef BZ_NO_STDIO + extern void BZ2_bz__AssertH__fail ( int errcode ); #define AssertH(cond,errcode) \ { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); } + #if BZ_DEBUG #define AssertD(cond,msg) \ { if (!(cond)) { \ @@ -107,6 +69,7 @@ #else #define AssertD(cond,msg) /* */ #endif + #define VPrintf0(zf) \ fprintf(stderr,zf) #define VPrintf1(zf,za1) \ @@ -119,17 +82,20 @@ fprintf(stderr,zf,za1,za2,za3,za4) #define VPrintf5(zf,za1,za2,za3,za4,za5) \ fprintf(stderr,zf,za1,za2,za3,za4,za5) + #else + extern void bz_internal_error ( int errcode ); #define AssertH(cond,errcode) \ { if (!(cond)) bz_internal_error ( errcode ); } -#define AssertD(cond,msg) /* */ -#define VPrintf0(zf) /* */ -#define VPrintf1(zf,za1) /* */ -#define VPrintf2(zf,za1,za2) /* */ -#define VPrintf3(zf,za1,za2,za3) /* */ -#define VPrintf4(zf,za1,za2,za3,za4) /* */ -#define VPrintf5(zf,za1,za2,za3,za4,za5) /* */ +#define AssertD(cond,msg) do { } while (0) +#define VPrintf0(zf) do { } while (0) +#define VPrintf1(zf,za1) do { } while (0) +#define VPrintf2(zf,za1,za2) do { } while (0) +#define VPrintf3(zf,za1,za2,za3) do { } while (0) +#define VPrintf4(zf,za1,za2,za3,za4) do { } while (0) +#define VPrintf5(zf,za1,za2,za3,za4,za5) do { } while (0) + #endif @@ -476,11 +442,15 @@ /*-- Macros for decompression. --*/ #define BZ_GET_FAST(cccc) \ + /* c_tPos is unsigned, hence test < 0 is pointless. */ \ + if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \ s->tPos = s->tt[s->tPos]; \ cccc = (UChar)(s->tPos & 0xff); \ s->tPos >>= 8; #define BZ_GET_FAST_C(cccc) \ + /* c_tPos is unsigned, hence test < 0 is pointless. */ \ + if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return True; \ c_tPos = c_tt[c_tPos]; \ cccc = (UChar)(c_tPos & 0xff); \ c_tPos >>= 8; @@ -503,8 +473,10 @@ (((UInt32)s->ll16[i]) | (GET_LL4(i) << 16)) #define BZ_GET_SMALL(cccc) \ - cccc = BZ2_indexIntoF ( s->tPos, s->cftab ); \ - s->tPos = GET_LL(s->tPos); + /* c_tPos is unsigned, hence test < 0 is pointless. */ \ + if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \ + cccc = BZ2_indexIntoF ( s->tPos, s->cftab ); \ + s->tPos = GET_LL(s->tPos); /*-- externs for decompression. --*/ Modified: kos-ports/libbz2/compress.c =================================================================== --- kos-ports/libbz2/compress.c 2012-02-28 13:11:51 UTC (rev 752) +++ kos-ports/libbz2/compress.c 2012-02-28 14:00:32 UTC (rev 753) @@ -4,72 +4,28 @@ /*--- compress.c ---*/ /*-------------------------------------------------------------*/ -/*-- - This file is a part of bzip2 and/or libbzip2, a program and - library for lossless, block-sorting data compression. +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. - Copyright (C) 1996-2002 Julian R Seward. All rights reserved. + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <js...@bz...> - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. +/* CHANGES + 0.9.0 -- original version. + 0.9.0a/b -- no changes in this file. + 0.9.0c -- changed setting of nGroups in sendMTFValues() + so as to do a bit better on small files +*/ - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Julian Seward, Cambridge, UK. - js...@ac... - bzip2/libbzip2 version 1.0 of 21 March 2000 - - This program is based on (at least) the work of: - Mike Burrows - David Wheeler - Peter Fenwick - Alistair Moffat - Radford Neal - Ian H. Witten - Robert Sedgewick - Jon L. Bentley - - For more information on these sources, see the manual. ---*/ - -/*-- - CHANGES - ~~~~~~~ - 0.9.0 -- original version. - - 0.9.0a/b -- no changes in this file. - - 0.9.0c - * changed setting of nGroups in sendMTFValues() so as to - do a bit better on small files ---*/ - #include "bzlib_private.h" @@ -488,9 +444,11 @@ /*-- Recompute the tables based on the accumulated frequencies. --*/ + /* maxLen was changed from 20 to 17 in bzip2-1.0.3. See + comment in huffman.c for details. */ for (t = 0; t < nGroups; t++) BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]), - alphaSize, 20 ); + alphaSize, 17 /*20*/ ); } @@ -527,7 +485,7 @@ if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; if (s->len[t][i] < minLen) minLen = s->len[t][i]; } - AssertH ( !(maxLen > 20), 3004 ); + AssertH ( !(maxLen > 17 /*20*/ ), 3004 ); AssertH ( !(minLen < 1), 3005 ); BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]), minLen, maxLen, alphaSize ); @@ -651,8 +609,8 @@ if (s->blockNo > 1) s->numZ = 0; if (s->verbosity >= 2) - VPrintf4( " block %d: crc = 0x%8x, " - "combined CRC = 0x%8x, size = %d\n", + VPrintf4( " block %d: crc = 0x%08x, " + "combined CRC = 0x%08x, size = %d\n", s->blockNo, s->blockCRC, s->combinedCRC, s->nblock ); BZ2_blockSort ( s ); @@ -703,7 +661,7 @@ bsPutUChar ( s, 0x50 ); bsPutUChar ( s, 0x90 ); bsPutUInt32 ( s, s->combinedCRC ); if (s->verbosity >= 2) - VPrintf1( " final combined CRC = 0x%x\n ", s->combinedCRC ); + VPrintf1( " final combined CRC = 0x%08x\n ", s->combinedCRC ); bsFinishWrite ( s ); } } Modified: kos-ports/libbz2/crctable.c =================================================================== --- kos-ports/libbz2/crctable.c 2012-02-28 13:11:51 UTC (rev 752) +++ kos-ports/libbz2/crctable.c 2012-02-28 14:00:32 UTC (rev 753) @@ -4,61 +4,21 @@ /*--- crctable.c ---*/ /*-------------------------------------------------------------*/ -/*-- - This file is a part of bzip2 and/or libbzip2, a program and - library for lossless, block-sorting data compression. +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. - Copyright (C) 1996-2002 Julian R Seward. All rights reserved. + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <js...@bz...> - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Julian Seward, Cambridge, UK. - js...@ac... - bzip2/libbzip2 version 1.0 of 21 March 2000 - - This program is based on (at least) the work of: - Mike Burrows - David Wheeler - Peter Fenwick - Alistair Moffat - Radford Neal - Ian H. Witten - Robert Sedgewick - Jon L. Bentley - - For more information on these sources, see the manual. ---*/ - - #include "bzlib_private.h" /*-- Modified: kos-ports/libbz2/decompress.c =================================================================== --- kos-ports/libbz2/decompress.c 2012-02-28 13:11:51 UTC (rev 752) +++ kos-ports/libbz2/decompress.c 2012-02-28 14:00:32 UTC (rev 753) @@ -4,61 +4,21 @@ /*--- decompress.c ---*/ /*-------------------------------------------------------------*/ -/*-- - This file is a part of bzip2 and/or libbzip2, a program and - library for lossless, block-sorting data compression. +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. - Copyright (C) 1996-2002 Julian R Seward. All rights reserved. + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <js...@bz...> - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Julian Seward, Cambridge, UK. - js...@ac... - bzip2/libbzip2 version 1.0 of 21 March 2000 - - This program is based on (at least) the work of: - Mike Burrows - David Wheeler - Peter Fenwick - Alistair Moffat - Radford Neal - Ian H. Witten - Robert Sedgewick - Jon L. Bentley - - For more information on these sources, see the manual. ---*/ - - #include "bzlib_private.h" @@ -421,6 +381,13 @@ es = -1; N = 1; do { + /* Check that N doesn't get too big, so that es doesn't + go negative. The maximum value that can be + RUNA/RUNB encoded is equal to the block size (post + the initial RLE), viz, 900k, so bounding N at 2 + million should guard against overflow without + rejecting any legitimate inputs. */ + if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); if (nextSym == BZ_RUNA) es = es + (0+1) * N; else if (nextSym == BZ_RUNB) es = es + (1+1) * N; N = N * 2; @@ -524,17 +491,36 @@ if (s->origPtr < 0 || s->origPtr >= nblock) RETURN(BZ_DATA_ERROR); + /*-- Set up cftab to facilitate generation of T^(-1) --*/ + /* Check: unzftab entries in range. */ + for (i = 0; i <= 255; i++) { + if (s->unzftab[i] < 0 || s->unzftab[i] > nblock) + RETURN(BZ_DATA_ERROR); + } + /* Actually generate cftab. */ + s->cftab[0] = 0; + for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1]; + for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1]; + /* Check: cftab entries in range. */ + for (i = 0; i <= 256; i++) { + if (s->cftab[i] < 0 || s->cftab[i] > nblock) { + /* s->cftab[i] can legitimately be == nblock */ + RETURN(BZ_DATA_ERROR); + } + } + /* Check: cftab entries non-descending. */ + for (i = 1; i <= 256; i++) { + if (s->cftab[i-1] > s->cftab[i]) { + RETURN(BZ_DATA_ERROR); + } + } + s->state_out_len = 0; s->state_out_ch = 0; BZ_INITIALISE_CRC ( s->calculatedBlockCRC ); s->state = BZ_X_OUTPUT; if (s->verbosity >= 2) VPrintf0 ( "rt+rld" ); - /*-- Set up cftab to facilitate generation of T^(-1) --*/ - s->cftab[0] = 0; - for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1]; - for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1]; - if (s->smallDecompress) { /*-- Make a copy of cftab, used in generation of T --*/ Modified: kos-ports/libbz2/huffman.c =================================================================== --- kos-ports/libbz2/huffman.c 2012-02-28 13:11:51 UTC (rev 752) +++ kos-ports/libbz2/huffman.c 2012-02-28 14:00:32 UTC (rev 753) @@ -4,61 +4,21 @@ /*--- huffman.c ---*/ /*-------------------------------------------------------------*/ -/*-- - This file is a part of bzip2 and/or libbzip2, a program and - library for lossless, block-sorting data compression. +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. - Copyright (C) 1996-2002 Julian R Seward. All rights reserved. + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <js...@bz...> - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ - 2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 3. Altered source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - - 4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - Julian Seward, Cambridge, UK. - js...@ac... - bzip2/libbzip2 version 1.0 of 21 March 2000 - - This program is based on (at least) the work of: - Mike Burrows - David Wheeler - Peter Fenwick - Alistair Moffat - Radford Neal - Ian H. Witten - Robert Sedgewick - Jon L. Bentley - - For more information on these sources, see the manual. ---*/ - - #include "bzlib_private.h" /*---------------------------------------------------*/ @@ -162,7 +122,24 @@ if (! tooLong) break; - for (i = 1; i < alphaSize; i++) { + /* 17 Oct 04: keep-going condition for the following loop used + to be 'i < alphaSize', which missed the last element, + theoretically leading to the possibility of the compressor + looping. However, this count-scaling step is only needed if + one of the generated Huffman code words is longer than + maxLen, which up to and including version 1.0.2 was 20 bits, + which is extremely unlikely. In version 1.0.3 maxLen was + changed to 17 bits, which has minimal effect on compression + ratio, but does mean this scaling step is used from time to + time, enough to verify that it works. + + This means that bzip2-1.0.3 and later will only produce + Huffman codes with a maximum length of 17 bits. However, in + order to preserve backwards compatibility with bitstreams + produced by versions pre-1.0.3, the decompressor must still + handle lengths of up to 20. */ + + for (i = 1; i <= alphaSize; i++) { j = weight[i] >> 8; j = 1 + (j / 2); weight[i] = j << 8; Modified: kos-ports/libbz2/kos/README.KOS =================================================================== --- kos-ports/libbz2/kos/README.KOS 2012-02-28 13:11:51 UTC (rev 752) +++ kos-ports/libbz2/kos/README.KOS 2012-02-28 14:00:32 UTC (rev 753) @@ -1,5 +1,5 @@ -This is a stripped down version of bzip2-1.0.2 just containing the compression -library libbz2. This is _NOT_ the original bzip2, but just a subset. The Makefile -is new, and the manual has been removed for size; for the full bzip2 package, -please see the URL in the README file. +This is a stripped down version of bzip2-1.0.6 just containing the compression +library libbz2. This is _NOT_ the original bzip2, but just a subset. The +Makefile is KOS-specific. Various other non-essential files have been removed. +For the full bzip2 distribution, go to http://www.bzip.org/ . Added: kos-ports/libbz2/manual.html =================================================================== --- kos-ports/libbz2/manual.html (rev 0) +++ kos-ports/libbz2/manual.html 2012-02-28 14:00:32 UTC (rev 753) @@ -0,0 +1,2540 @@ +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>bzip2 and libbzip2, version 1.0.6</title> +<meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> +<style type="text/css" media="screen">/* Colours: +#74240f dark brown h1, h2, h3, h4 +#336699 medium blue links +#339999 turquoise link hover colour +#202020 almost black general text +#761596 purple md5sum text +#626262 dark gray pre border +#eeeeee very light gray pre background +#f2f2f9 very light blue nav table background +#3366cc medium blue nav table border +*/ + +a, a:link, a:visited, a:active { color: #336699; } +a:hover { color: #339999; } + +body { font: 80%/126% sans-serif; } +h1, h2, h3, h4 { color: #74240f; } + +dt { color: #336699; font-weight: bold } +dd { + margin-left: 1.5em; + padding-bottom: 0.8em; +} + +/* -- ruler -- */ +div.hr_blue { + height: 3px; + background:#ffffff url("/images/hr_blue.png") repeat-x; } +div.hr_blue hr { display:none; } + +/* release styles */ +#release p { margin-top: 0.4em; } +#release .md5sum { color: #761596; } + + +/* ------ styles for docs|manuals|howto ------ */ +/* -- lists -- */ +ul { + margin: 0px 4px 16px 16px; + padding: 0px; + list-style: url("/images/li-blue.png"); +} +ul li { + margin-bottom: 10px; +} +ul ul { + list-style-type: none; + list-style-image: none; + margin-left: 0px; +} + +/* header / footer nav tables */ +table.nav { + border: solid 1px #3366cc; + background: #f2f2f9; + background-color: #f2f2f9; + margin-bottom: 0.5em; +} +/* don't have underlined links in chunked nav menus */ +table.nav a { text-decoration: none; } +table.nav a:hover { text-decoration: underline; } +table.nav td { font-size: 85%; } + +code, tt, pre { font-size: 120%; } +code, tt { color: #761596; } + +div.literallayout, pre.programlisting, pre.screen { + color: #000000; + padding: 0.5em; + background: #eeeeee; + border: 1px solid #626262; + background-color: #eeeeee; + margin: 4px 0px 4px 0px; +} +</style> +</head> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div lang="en" class="book" title="bzip2 and libbzip2, version 1.0.6"> +<div class="titlepage"> +<div> +<div><h1 class="title"> +<a name="userman"></a>bzip2 and libbzip2, version 1.0.6</h1></div> +<div><h2 class="subtitle">A program and library for data compression</h2></div> +<div><div class="authorgroup"><div class="author"> +<h3 class="author"> +<span class="firstname">Julian</span> <span class="surname">Seward</span> +</h3> +<div class="affiliation"><span class="orgname">http://www.bzip.org<br></span></div> +</div></div></div> +<div><p class="releaseinfo">Version 1.0.6 of 6 September 2010</p></div> +<div><p class="copyright">Copyright \xA9 1996-2010 Julian Seward</p></div> +<div><div class="legalnotice" title="Legal Notice"> +<a name="id537185"></a><p>This program, <code class="computeroutput">bzip2</code>, the + associated library <code class="computeroutput">libbzip2</code>, and + all documentation, are copyright \xA9 1996-2010 Julian Seward. + All rights reserved.</p> +<p>Redistribution and use in source and binary forms, with + or without modification, are permitted provided that the + following conditions are m... [truncated message content] |
From: <ljs...@us...> - 2012-02-28 13:12:04
|
Revision: 752 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=752&view=rev Author: ljsebald Date: 2012-02-28 13:11:51 +0000 (Tue, 28 Feb 2012) Log Message: ----------- Update zlib to version 1.2.6. Modified Paths: -------------- kos-ports/include/zlib/zconf.h kos-ports/include/zlib/zlib.h Added Paths: ----------- kos-ports/zlib/ kos-ports/zlib/ChangeLog kos-ports/zlib/FAQ kos-ports/zlib/INDEX kos-ports/zlib/Makefile kos-ports/zlib/README kos-ports/zlib/adler32.c kos-ports/zlib/compress.c kos-ports/zlib/crc32.c kos-ports/zlib/crc32.h kos-ports/zlib/deflate.c kos-ports/zlib/deflate.h kos-ports/zlib/doc/ kos-ports/zlib/doc/algorithm.txt kos-ports/zlib/doc/rfc1950.txt kos-ports/zlib/doc/rfc1951.txt kos-ports/zlib/doc/rfc1952.txt kos-ports/zlib/doc/txtvsbin.txt kos-ports/zlib/examples/ kos-ports/zlib/examples/README.examples kos-ports/zlib/examples/enough.c kos-ports/zlib/examples/fitblk.c kos-ports/zlib/examples/gun.c kos-ports/zlib/examples/gzappend.c kos-ports/zlib/examples/gzjoin.c kos-ports/zlib/examples/gzlog.c kos-ports/zlib/examples/gzlog.h kos-ports/zlib/examples/zlib_how.html kos-ports/zlib/examples/zpipe.c kos-ports/zlib/examples/zran.c kos-ports/zlib/gzclose.c kos-ports/zlib/gzguts.h kos-ports/zlib/gzlib.c kos-ports/zlib/gzread.c kos-ports/zlib/gzwrite.c kos-ports/zlib/infback.c kos-ports/zlib/inffast.c kos-ports/zlib/inffast.h kos-ports/zlib/inffixed.h kos-ports/zlib/inflate.c kos-ports/zlib/inflate.h kos-ports/zlib/inftrees.c kos-ports/zlib/inftrees.h kos-ports/zlib/kos/ kos-ports/zlib/kos/dreamcast.cnf kos-ports/zlib/kos/gba.cnf kos-ports/zlib/kos_zlib.c kos-ports/zlib/trees.c kos-ports/zlib/trees.h kos-ports/zlib/uncompr.c kos-ports/zlib/zlib.h kos-ports/zlib/zutil.c kos-ports/zlib/zutil.h Modified: kos-ports/include/zlib/zconf.h =================================================================== --- kos-ports/include/zlib/zconf.h 2012-02-28 13:09:38 UTC (rev 751) +++ kos-ports/include/zlib/zconf.h 2012-02-28 13:11:51 UTC (rev 752) @@ -1,100 +1,231 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2002 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h + * Copyright (C) 1995-2011 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h */ -#ifndef _ZCONF_H -#define _ZCONF_H +/* @(#) $Id$ */ +#ifndef ZCONF_H +#define ZCONF_H + /* * If you *really* need a unique prefix for all types and library functions, * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + * Even better than compiling with -DZ_PREFIX would be to use configure to set + * this permanently in zconf.h using "./configure --zprefix". */ -#ifdef Z_PREFIX -# define deflateInit_ z_deflateInit_ -# define deflate z_deflate -# define deflateEnd z_deflateEnd -# define inflateInit_ z_inflateInit_ -# define inflate z_inflate -# define inflateEnd z_inflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateSetDictionary z_deflateSetDictionary -# define deflateCopy z_deflateCopy -# define deflateReset z_deflateReset -# define deflateParams z_deflateParams -# define inflateInit2_ z_inflateInit2_ -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateReset z_inflateReset -# define compress z_compress -# define compress2 z_compress2 -# define uncompress z_uncompress -# define adler32 z_adler32 -# define crc32 z_crc32 -# define get_crc_table z_get_crc_table +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ +# define Z_PREFIX_SET -# define Byte z_Byte -# define uInt z_uInt -# define uLong z_uLong -# define Bytef z_Bytef -# define charf z_charf -# define intf z_intf -# define uIntf z_uIntf -# define uLongf z_uLongf -# define voidpf z_voidpf -# define voidp z_voidp -#endif +/* all linked symbols */ +# define _dist_code z__dist_code +# define _length_code z__length_code +# define _tr_align z__tr_align +# define _tr_flush_block z__tr_flush_block +# define _tr_init z__tr_init +# define _tr_stored_block z__tr_stored_block +# define _tr_tally z__tr_tally +# define adler32 z_adler32 +# define adler32_combine z_adler32_combine +# define adler32_combine64 z_adler32_combine64 +# ifndef Z_SOLO +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# endif +# define crc32 z_crc32 +# define crc32_combine z_crc32_combine +# define crc32_combine64 z_crc32_combine64 +# define deflate z_deflate +# define deflateBound z_deflateBound +# define deflateCopy z_deflateCopy +# define deflateEnd z_deflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateInit_ z_deflateInit_ +# define deflateParams z_deflateParams +# define deflatePending z_deflatePending +# define deflatePrime z_deflatePrime +# define deflateReset z_deflateReset +# define deflateResetKeep z_deflateResetKeep +# define deflateSetDictionary z_deflateSetDictionary +# define deflateSetHeader z_deflateSetHeader +# define deflateTune z_deflateTune +# define deflate_copyright z_deflate_copyright +# define get_crc_table z_get_crc_table +# ifndef Z_SOLO +# define gz_error z_gz_error +# define gz_intmax z_gz_intmax +# define gz_strwinerror z_gz_strwinerror +# define gzbuffer z_gzbuffer +# define gzclearerr z_gzclearerr +# define gzclose z_gzclose +# define gzclose_r z_gzclose_r +# define gzclose_w z_gzclose_w +# define gzdirect z_gzdirect +# define gzdopen z_gzdopen +# define gzeof z_gzeof +# define gzerror z_gzerror +# define gzflags z_gzflags +# define gzflush z_gzflush +# define gzgetc z_gzgetc +# define gzgetc_ z_gzgetc_ +# define gzgets z_gzgets +# define gzoffset z_gzoffset +# define gzoffset64 z_gzoffset64 +# define gzopen z_gzopen +# define gzopen64 z_gzopen64 +# define gzprintf z_gzprintf +# define gzputc z_gzputc +# define gzputs z_gzputs +# define gzread z_gzread +# define gzrewind z_gzrewind +# define gzseek z_gzseek +# define gzseek64 z_gzseek64 +# define gzsetparams z_gzsetparams +# define gztell z_gztell +# define gztell64 z_gztell64 +# define gzungetc z_gzungetc +# define gzwrite z_gzwrite +# endif +# define inflate z_inflate +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define inflateBackInit_ z_inflateBackInit_ +# define inflateCopy z_inflateCopy +# define inflateEnd z_inflateEnd +# define inflateGetHeader z_inflateGetHeader +# define inflateInit2_ z_inflateInit2_ +# define inflateInit_ z_inflateInit_ +# define inflateMark z_inflateMark +# define inflatePrime z_inflatePrime +# define inflateReset z_inflateReset +# define inflateReset2 z_inflateReset2 +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateUndermine z_inflateUndermine +# define inflateResetKeep z_inflateResetKeep +# define inflate_copyright z_inflate_copyright +# define inflate_fast z_inflate_fast +# define inflate_table z_inflate_table +# ifndef Z_SOLO +# define uncompress z_uncompress +# endif +# define zError z_zError +# ifndef Z_SOLO +# define zcalloc z_zcalloc +# define zcfree z_zcfree +# endif +# define zlibCompileFlags z_zlibCompileFlags +# define zlibVersion z_zlibVersion -#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) -# define WIN32 -#endif -#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) -# ifndef __32BIT__ -# define __32BIT__ +/* all zlib typedefs in zlib.h and zconf.h */ +# define Byte z_Byte +# define Bytef z_Bytef +# define alloc_func z_alloc_func +# define charf z_charf +# define free_func z_free_func +# ifndef Z_SOLO +# define gzFile z_gzFile +# define gz_header z_gz_header +# define gz_headerp z_gz_headerp # endif +# define in_func z_in_func +# define intf z_intf +# define out_func z_out_func +# define uInt z_uInt +# define uIntf z_uIntf +# define uLong z_uLong +# define uLongf z_uLongf +# define voidp z_voidp +# define voidpc z_voidpc +# define voidpf z_voidpf + +/* all zlib structs in zlib.h and zconf.h */ +# ifndef Z_SOLO +# define gz_header_s z_gz_header_s +# endif +# define internal_state z_internal_state + #endif + #if defined(__MSDOS__) && !defined(MSDOS) # define MSDOS #endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif /* * Compile with -DMAXSEG_64K if the alloc function cannot allocate more * than 64k bytes at a time (needed on systems with 16-bit int). */ -#if defined(MSDOS) && !defined(__32BIT__) +#ifdef SYS16BIT # define MAXSEG_64K #endif #ifdef MSDOS # define UNALIGNED_OK #endif -#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) -# define STDC -#endif -#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) +#ifdef __STDC_VERSION__ # ifndef STDC # define STDC # endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif #endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + #ifndef STDC # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const +# define const /* note: need a more gentle solution here */ # endif #endif +#if defined(ZLIB_CONST) && !defined(z_const) +# define z_const const +#else +# define z_const +#endif + /* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) # define NO_DUMMY_DECL #endif -/* Old Borland C incorrectly complains about missing returns: */ -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) -# define NEED_DUMMY_RETURN -#endif - - /* Maximum value for memLevel in deflateInit2 */ #ifndef MAX_MEM_LEVEL # ifdef MAXSEG_64K @@ -136,79 +267,101 @@ # endif #endif +#ifndef Z_ARG /* function prototypes for stdarg */ +# if defined(STDC) || defined(Z_HAVE_STDARG_H) +# define Z_ARG(args) args +# else +# define Z_ARG(args) () +# endif +#endif + /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, * just define FAR to be empty. */ -#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif # endif -#endif -#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) -# ifndef __32BIT__ +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ # define SMALL_MEDIUM -# define FAR _far +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif # endif #endif -/* Compile with -DZLIB_DLL for Windows DLL support */ -#if defined(ZLIB_DLL) -# if defined(_WINDOWS) || defined(WINDOWS) +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI # ifdef FAR # undef FAR # endif # include <windows.h> -# define ZEXPORT WINAPI + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI # ifdef WIN32 -# define ZEXPORTVA WINAPIV +# define ZEXPORTVA WINAPIV # else -# define ZEXPORTVA FAR _cdecl _export +# define ZEXPORTVA FAR CDECL # endif # endif -# if defined (__BORLANDC__) -# if (__BORLANDC__ >= 0x0500) && defined (WIN32) -# include <windows.h> -# define ZEXPORT __declspec(dllexport) WINAPI -# define ZEXPORTRVA __declspec(dllexport) WINAPIV +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) # else -# if defined (_Windows) && defined (__DLL__) -# define ZEXPORT _export -# define ZEXPORTVA _export -# endif +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) # endif # endif #endif -#if defined (__BEOS__) -# if defined (ZLIB_DLL) -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif +#ifndef ZEXTERN +# define ZEXTERN extern #endif - #ifndef ZEXPORT # define ZEXPORT #endif #ifndef ZEXPORTVA # define ZEXPORTVA #endif -#ifndef ZEXTERN -# define ZEXTERN extern -#endif #ifndef FAR -# define FAR +# define FAR #endif -#if !defined(MACOS) && !defined(TARGET_OS_MAC) +#if !defined(__MACTYPES__) typedef unsigned char Byte; /* 8 bits */ #endif typedef unsigned int uInt; /* 16 bits or more */ @@ -226,52 +379,88 @@ typedef uLong FAR uLongf; #ifdef STDC - typedef void FAR *voidpf; - typedef void *voidp; + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; #else - typedef Byte FAR *voidpf; - typedef Byte *voidp; + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; #endif -#ifdef HAVE_UNISTD_H -# include <sys/types.h> /* for off_t */ -# include <unistd.h> /* for SEEK_* and off_t */ -# define z_off_t off_t +#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ +# define Z_HAVE_UNISTD_H #endif -#ifndef SEEK_SET + +#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ +# define Z_HAVE_STDARG_H +#endif + +#ifdef STDC +# ifndef Z_SOLO +# include <sys/types.h> /* for off_t */ +# endif +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if -_LARGEFILE64_SOURCE - -1 == 1 +# undef _LARGEFILE64_SOURCE +#endif + +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 +# define Z_LARGE +#endif + +#if (defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE)) && !defined(Z_SOLO) +# include <unistd.h> /* for SEEK_* and off_t */ +# ifdef VMS +# include <unixio.h> /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif +#endif + +#if !defined(SEEK_SET) && !defined(Z_SOLO) # define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_CUR 1 /* Seek from current position. */ # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ #endif + #ifndef z_off_t -# define z_off_t long +# define z_off_t long #endif +#if !defined(_WIN32) && (defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0) +# define z_off64_t off64_t +#else +# if defined(_WIN32) +# define z_off64_t __int64 +# else +# define z_off64_t z_off_t +#endif +#endif + /* MVS linker does not support external names larger than 8 bytes */ #if defined(__MVS__) -# pragma map(deflateInit_,"DEIN") -# pragma map(deflateInit2_,"DEIN2") -# pragma map(deflateEnd,"DEEND") -# pragma map(inflateInit_,"ININ") -# pragma map(inflateInit2_,"ININ2") -# pragma map(inflateEnd,"INEND") -# pragma map(inflateSync,"INSY") -# pragma map(inflateSetDictionary,"INSEDI") -# pragma map(inflate_blocks,"INBL") -# pragma map(inflate_blocks_new,"INBLNE") -# pragma map(inflate_blocks_free,"INBLFR") -# pragma map(inflate_blocks_reset,"INBLRE") -# pragma map(inflate_codes_free,"INCOFR") -# pragma map(inflate_codes,"INCO") -# pragma map(inflate_fast,"INFA") -# pragma map(inflate_flush,"INFLU") -# pragma map(inflate_mask,"INMA") -# pragma map(inflate_set_dictionary,"INSEDI2") -# pragma map(inflate_copyright,"INCOPY") -# pragma map(inflate_trees_bits,"INTRBI") -# pragma map(inflate_trees_dynamic,"INTRDY") -# pragma map(inflate_trees_fixed,"INTRFI") -# pragma map(inflate_trees_free,"INTRFR") + #pragma map(deflateInit_,"DEIN") + #pragma map(deflateInit2_,"DEIN2") + #pragma map(deflateEnd,"DEEND") + #pragma map(deflateBound,"DEBND") + #pragma map(inflateInit_,"ININ") + #pragma map(inflateInit2_,"ININ2") + #pragma map(inflateEnd,"INEND") + #pragma map(inflateSync,"INSY") + #pragma map(inflateSetDictionary,"INSEDI") + #pragma map(compressBound,"CMBND") + #pragma map(inflate_table,"INTABL") + #pragma map(inflate_fast,"INFA") + #pragma map(inflate_copyright,"INCOPY") #endif -#endif /* _ZCONF_H */ +#endif /* ZCONF_H */ Modified: kos-ports/include/zlib/zlib.h =================================================================== --- kos-ports/include/zlib/zlib.h 2012-02-28 13:09:38 UTC (rev 751) +++ kos-ports/include/zlib/zlib.h 2012-02-28 13:11:51 UTC (rev 752) @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.1.4, March 11th, 2002 + version 1.2.6, January 29th, 2012 - Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,12 +24,12 @@ The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt - (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). + Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 + (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). */ -#ifndef _ZLIB_H -#define _ZLIB_H +#ifndef ZLIB_H +#define ZLIB_H #include "zconf.h" @@ -37,27 +37,44 @@ extern "C" { #endif -#define ZLIB_VERSION "1.1.4" +#define ZLIB_VERSION "1.2.6" +#define ZLIB_VERNUM 0x1260 +#define ZLIB_VER_MAJOR 1 +#define ZLIB_VER_MINOR 2 +#define ZLIB_VER_REVISION 6 +#define ZLIB_VER_SUBREVISION 0 -/* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed - data. This version of the library supports only one compression method - (deflation) but other algorithms will be added later and will have the same - stream interface. +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed data. + This version of the library supports only one compression method (deflation) + but other algorithms will be added later and will have the same stream + interface. - Compression can be done in a single step if the buffers are large - enough (for example if an input file is mmap'ed), or can be done by - repeated calls of the compression function. In the latter case, the - application must provide more input and/or consume the output + Compression can be done in a single step if the buffers are large enough, + or can be done by repeated calls of the compression function. In the latter + case, the application must provide more input and/or consume the output (providing more output space) before each call. - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio. + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never - crash even in case of corrupted input. + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip streams in memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never crash + even in case of corrupted input. */ typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); @@ -66,22 +83,22 @@ struct internal_state; typedef struct z_stream_s { - Bytef *next_in; /* next input byte */ + z_const Bytef *next_in; /* next input byte */ uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total nb of input bytes read so far */ + uLong total_in; /* total number of input bytes read so far */ Bytef *next_out; /* next output byte should be put there */ uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total nb of bytes output so far */ + uLong total_out; /* total number of bytes output so far */ - char *msg; /* last error message, NULL if no error */ + z_const char *msg; /* last error message, NULL if no error */ struct internal_state FAR *state; /* not visible by applications */ alloc_func zalloc; /* used to allocate the internal state */ free_func zfree; /* used to free the internal state */ voidpf opaque; /* private data object passed to zalloc and zfree */ - int data_type; /* best guess about the data type: ascii or binary */ + int data_type; /* best guess about the data type: binary or text */ uLong adler; /* adler32 value of the uncompressed data */ uLong reserved; /* reserved for future use */ } z_stream; @@ -89,45 +106,69 @@ typedef z_stream FAR *z_streamp; /* - The application must update next_in and avail_in when avail_in has - dropped to zero. It must update next_out and avail_out when avail_out - has dropped to zero. The application must initialize zalloc, zfree and - opaque before calling the init function. All other fields are set by the - compression library and must not be updated by the application. + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has dropped + to zero. It must update next_out and avail_out when avail_out has dropped + to zero. The application must initialize zalloc, zfree and opaque before + calling the init function. All other fields are set by the compression + library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the opaque value. - zalloc must return Z_NULL if there is not enough memory for the object. + zalloc must return Z_NULL if there is not enough memory for the object. If zlib is used in a multi-threaded application, zalloc and zfree must be thread safe. - On 16-bit systems, the functions zalloc and zfree must be able to allocate - exactly 65536 bytes, but will not be required to allocate more than this - if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, - pointers returned by zalloc for objects of exactly 65536 bytes *must* - have their offset normalized to zero. The default allocation function - provided by this library ensures this (see zutil.c). To reduce memory - requirements and avoid any allocation of 64K objects, at the expense of - compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this if + the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers + returned by zalloc for objects of exactly 65536 bytes *must* have their + offset normalized to zero. The default allocation function provided by this + library ensures this (see zutil.c). To reduce memory requirements and avoid + any allocation of 64K objects, at the expense of compression ratio, compile + the library with -DMAX_WBITS=14 (see zconf.h). - The fields total_in and total_out can be used for statistics or - progress reports. After compression, total_in holds the total size of - the uncompressed data and may be saved for use in the decompressor - (particularly if the decompressor wants to decompress everything in - a single step). + The fields total_in and total_out can be used for statistics or progress + reports. After compression, total_in holds the total size of the + uncompressed data and may be saved for use in the decompressor (particularly + if the decompressor wants to decompress everything in a single step). */ /* constants */ #define Z_NO_FLUSH 0 -#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ +#define Z_PARTIAL_FLUSH 1 #define Z_SYNC_FLUSH 2 #define Z_FULL_FLUSH 3 #define Z_FINISH 4 -/* Allowed flush values; see deflate() below for details */ +#define Z_BLOCK 5 +#define Z_TREES 6 +/* Allowed flush values; see deflate() and inflate() below for details */ #define Z_OK 0 #define Z_STREAM_END 1 @@ -138,8 +179,8 @@ #define Z_MEM_ERROR (-4) #define Z_BUF_ERROR (-5) #define Z_VERSION_ERROR (-6) -/* Return codes for the compression/decompression functions. Negative - * values are errors, positive values are used for special but normal events. +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. */ #define Z_NO_COMPRESSION 0 @@ -150,13 +191,16 @@ #define Z_FILTERED 1 #define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 #define Z_DEFAULT_STRATEGY 0 /* compression strategy; see deflateInit2() below for details */ #define Z_BINARY 0 -#define Z_ASCII 1 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ #define Z_UNKNOWN 2 -/* Possible values of the data_type field */ +/* Possible values of the data_type field (though see inflate()) */ #define Z_DEFLATED 8 /* The deflate compression method (the only one supported in this version) */ @@ -166,137 +210,167 @@ #define zlib_version zlibVersion() /* for compatibility with versions < 1.0.2 */ + /* basic functions */ ZEXTERN const char * ZEXPORT zlibVersion OF((void)); /* The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is - not compatible with the zlib.h header file used by the application. - This check is automatically made by deflateInit and inflateInit. + If the first character differs, the library code actually used is not + compatible with the zlib.h header file used by the application. This check + is automatically made by deflateInit and inflateInit. */ -/* +/* ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. - If zalloc and zfree are set to Z_NULL, deflateInit updates them to - use default allocation functions. + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. If + zalloc and zfree are set to Z_NULL, deflateInit updates them to use default + allocation functions. The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at - all (the input data is simply copied a block at a time). - Z_DEFAULT_COMPRESSION requests a default compromise between speed and - compression (currently equivalent to level 6). + 1 gives best speed, 9 gives best compression, 0 gives no compression at all + (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION + requests a default compromise between speed and compression (currently + equivalent to level 6). - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if level is not a valid compression level, + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if level is not a valid compression level, or Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). - msg is set to null if there is no error message. deflateInit does not - perform any compression: this will be done by deflate(). + with the version assumed by the caller (ZLIB_VERSION). msg is set to null + if there is no error message. deflateInit does not perform any compression: + this will be done by deflate(). */ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); /* deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce some - output latency (reading input without producing any output) except when + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when forced to flush. - The detailed semantics are as follows. deflate performs one or both of the + The detailed semantics are as follows. deflate performs one or both of the following actions: - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not + accordingly. If not all input can be processed (because there is not enough room in the output buffer), next_in and avail_in are updated and processing will resume at this point for the next call of deflate(). - Provide more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. + accordingly. This action is forced if the parameter flush is non zero. Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary (in interactive applications). - Some output may be provided even if flush is not set. + should be set only when necessary (in interactive applications). Some + output may be provided even if flush is not set. - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating avail_in or avail_out accordingly; avail_out - should never be zero before the call. The application can consume the - compressed output when it wants, for example when the output buffer is full - (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK - and with zero avail_out, it must be called again after making room in the - output buffer because there might be more output pending. + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating avail_in or avail_out accordingly; avail_out should + never be zero before the call. The application can consume the compressed + output when it wants, for example when the output buffer is full (avail_out + == 0), or after each call of deflate(). If deflate returns Z_OK and with + zero avail_out, it must be called again after making room in the output + buffer because there might be more output pending. + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumulate before producing output, in order to + maximize compression. + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In particular - avail_in is zero after the call if enough output space has been provided - before the call.) Flushing may degrade compression for some compression - algorithms and so it should be used only when necessary. + that the decompressor can get all input data available so far. (In + particular avail_in is zero after the call if enough output space has been + provided before the call.) Flushing may degrade compression for some + compression algorithms and so it should be used only when necessary. This + completes the current deflate block and follows it with an empty stored block + that is three bits plus filler bits to the next byte, followed by four bytes + (00 00 ff ff). + If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the + output buffer, but the output is not aligned to a byte boundary. All of the + input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. + This completes the current deflate block and follows it with an empty fixed + codes block that is 10 bits long. This assures that enough bytes are output + in order for the decompressor to finish the block before the empty fixed code + block. + + If flush is set to Z_BLOCK, a deflate block is completed and emitted, as + for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to + seven bits of the current block are held to be written as the next byte after + the next deflate block is completed. In this case, the decompressor may not + be provided enough bits at this point in order to complete decompression of + the data provided so far to the compressor. It may need to wait for the next + block to be emitted. This is for advanced applications that need to control + the emission of deflate blocks. + If flush is set to Z_FULL_FLUSH, all output is flushed as with Z_SYNC_FLUSH, and the compression state is reset so that decompression can restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - the compression. + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. If deflate returns with avail_out == 0, this function must be called again with the same value of the flush parameter and more output space (updated avail_out), until the flush is complete (deflate returns with non-zero - avail_out). + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there - was enough output space; if deflate returns with Z_OK, this function must be + pending output is flushed and deflate returns with Z_STREAM_END if there was + enough output space; if deflate returns with Z_OK, this function must be called again with Z_FINISH and more output space (updated avail_out) but no - more input data, until it returns with Z_STREAM_END or an error. After - deflate has returned Z_STREAM_END, the only possible operations on the - stream are deflateReset or deflateEnd. - + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the stream + are deflateReset or deflateEnd. + Z_FINISH can be used immediately after deflateInit if all the compression - is to be done in a single step. In this case, avail_out must be at least - 0.1% larger than avail_in plus 12 bytes. If deflate does not return - Z_STREAM_END, then it must be called again as described above. + is to be done in a single step. In this case, avail_out must be at least the + value returned by deflateBound (see below). Then deflate is guaranteed to + return Z_STREAM_END. If not enough output space is provided, deflate will + not return Z_STREAM_END, and it must be called again as described above. deflate() sets strm->adler to the adler32 checksum of all input read so far (that is, total_in bytes). - deflate() may update data_type if it can make a good guess about - the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered - binary. This field is only for information purposes and does not affect - the compression algorithm in any manner. + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered + binary. This field is only for information purposes and does not affect the + compression algorithm in any manner. deflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if all input has been consumed and all output has been produced (only when flush is set to Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible - (for example avail_in or avail_out was zero). + if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not + fatal, and deflate() can be called again with more input and more output + space to continue compressing. */ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. + This function discards any unprocessed input and does not flush any pending + output. deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, - msg may be set but then points to a static string (which must not be + prematurely (some input or output was discarded). In the error case, msg + may be set but then points to a static string (which must not be deallocated). */ -/* +/* ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); - Initializes the internal stream state for decompression. The fields + Initializes the internal stream state for decompression. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. If next_in is not Z_NULL and avail_in is large enough (the exact - value depends on the compression method), inflateInit determines the + the caller. If next_in is not Z_NULL and avail_in is large enough (the + exact value depends on the compression method), inflateInit determines the compression method from the zlib header and allocates all data structures accordingly; otherwise the allocation will be deferred to the first call of inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to @@ -304,100 +378,149 @@ inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller. msg is set to null if there is no error - message. inflateInit does not perform any decompression apart from reading - the zlib header if present: this will be done by inflate(). (So next_in and - avail_in may be modified, but next_out and avail_out are unchanged.) + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit() does not process any header information -- that is deferred + until inflate() is called. */ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); /* inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may some - introduce some output latency (reading input without producing any output) - except when forced to flush. + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. - The detailed semantics are as follows. inflate performs one or both of the + The detailed semantics are as follows. inflate performs one or both of the following actions: - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in is updated and processing - will resume at this point for the next call of inflate(). + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing will + resume at this point for the next call of inflate(). - Provide more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there - is no more input data or no more space in the output buffer (see below - about the flush parameter). + accordingly. inflate() provides as much output as possible, until there is + no more input data or no more space in the output buffer (see below about + the flush parameter). - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating the next_* and avail_* values accordingly. - The application can consume the uncompressed output when it wants, for - example when the output buffer is full (avail_out == 0), or after each - call of inflate(). If inflate returns Z_OK and with zero avail_out, it - must be called again after making room in the output buffer because there - might be more output pending. + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating the next_* and avail_* values accordingly. The + application can consume the uncompressed output when it wants, for example + when the output buffer is full (avail_out == 0), or after each call of + inflate(). If inflate returns Z_OK and with zero avail_out, it must be + called again after making room in the output buffer because there might be + more output pending. - If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much - output as possible to the output buffer. The flushing behavior of inflate is - not specified for values of the flush parameter other than Z_SYNC_FLUSH - and Z_FINISH, but the current implementation actually flushes as much output - as possible anyway. + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, + Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() + stop if and when it gets to the next deflate block boundary. When decoding + the zlib or gzip format, this will cause inflate() to return immediately + after the header and before the first block. When doing a raw inflate, + inflate() will go ahead and process the first block, and will return when it + gets to the end of that block, or when it runs out of data. + The Z_BLOCK option assists in appending to or combining deflate streams. + Also to assist in this, on return inflate() will set strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 if + inflate() is currently decoding the last block in the deflate stream, plus + 128 if inflate() returned immediately after decoding an end-of-block code or + decoding the complete header up to just before the first byte of the deflate + stream. The end-of-block will not be indicated until all of the uncompressed + data from that block has been written to strm->next_out. The number of + unused bits may in general be greater than seven, except when bit 7 of + data_type is set, in which case the number of unused bits will be less than + eight. data_type is set as noted here every time inflate() returns for all + flush options, and so can be used to determine the amount of currently + consumed input in bits. + + The Z_TREES option behaves as Z_BLOCK does, but it also returns when the + end of each deflate block header is reached, before any actual data in that + block is decoded. This allows the caller to determine the length of the + deflate block header for later use in random access within a deflate block. + 256 is added to the value of strm->data_type when inflate() returns + immediately after reaching the end of the deflate block header. + inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step - (a single call of inflate), the parameter flush should be set to - Z_FINISH. In this case all pending input is processed and all pending - output is flushed; avail_out must be large enough to hold all the - uncompressed data. (The size of the uncompressed data may have been saved - by the compressor for this purpose.) The next operation on this stream must - be inflateEnd to deallocate the decompression state. The use of Z_FINISH - is never required, but can be used to inform inflate that a faster routine - may be used for the single inflate() call. + error. However if all decompression is to be performed in a single step (a + single call of inflate), the parameter flush should be set to Z_FINISH. In + this case all pending input is processed and all pending output is flushed; + avail_out must be large enough to hold all the uncompressed data. (The size + of the uncompressed data may have been saved by the compressor for this + purpose.) The next operation on this stream must be inflateEnd to deallocate + the decompression state. The use of Z_FINISH is not required to perform an + inflation in one step. However it may be used to inform inflate that a + faster approach can be used for the single inflate() call. Z_FINISH also + informs inflate to not maintain a sliding window if the stream completes, + which reduces inflate's memory footprint. - If a preset dictionary is needed at this point (see inflateSetDictionary - below), inflate sets strm-adler to the adler32 checksum of the - dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise - it sets strm->adler to the adler32 checksum of all output produced - so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or - an error code as described below. At the end of the stream, inflate() - checks that its computed adler32 checksum is equal to that saved by the - compressor and returns Z_STREAM_END only if the checksum is correct. + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the effects of the flush parameter in this implementation are + on the return value of inflate() as noted below, when inflate() returns early + when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of + memory for a sliding window when Z_FINISH is used. + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the Adler-32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the Adler-32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed adler32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() can decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically, if requested when + initializing with inflateInit2(). Any information contained in the gzip + header is not retained, so applications that need that information should + instead use raw inflate, see inflateInit2() below, or inflateBack() and + perform their own processing of the gzip header and trailer. When processing + gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output + producted so far. The CRC-32 is checked against the gzip trailer. + inflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if the end of the compressed data has been reached and all uncompressed output has been produced, Z_NEED_DICT if a preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect - adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent - (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if no progress is possible or if there was not - enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR - case, the application may then call inflateSync to look for a good - compression block. + corrupted (input stream not conforming to the zlib format or incorrect check + value), Z_STREAM_ERROR if the stream structure was inconsistent (for example + next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in the + output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may + then call inflateSync() to look for a good compression block if a partial + recovery of the data is desired. */ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. + This function discards any unprocessed input and does not flush any pending + output. inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state - was inconsistent. In the error case, msg may be set but then points to a + was inconsistent. In the error case, msg may be set but then points to a static string (which must not be deallocated). */ + /* Advanced functions */ /* The following functions are needed only in some special applications. */ -/* +/* ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, int level, int method, @@ -405,76 +528,101 @@ int memLevel, int strategy)); - This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by - the caller. + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by the + caller. - The method parameter is the compression method. It must be Z_DEFLATED in + The method parameter is the compression method. It must be Z_DEFLATED in this version of the library. The windowBits parameter is the base two logarithm of the window size (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if deflateInit is used instead. + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute an adler32 check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), no + header crc, and the operating system will be set to 255 (unknown). If a + gzip stream is being written, strm->adler is a crc32 instead of an adler32. + The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but - is slow and reduces compression ratio; memLevel=9 uses maximum memory - for optimal speed. The default value is 8. See zconf.h for total memory - usage as a function of windowBits and memLevel. + for the internal compression state. memLevel=1 uses minimum memory but is + slow and reduces compression ratio; memLevel=9 uses maximum memory for + optimal speed. The default value is 8. See zconf.h for total memory usage + as a function of windowBits and memLevel. - The strategy parameter is used to tune the compression algorithm. Use the + The strategy parameter is used to tune the compression algorithm. Use the value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match). Filtered data consists mostly of small values with a - somewhat random distribution. In this case, the compression algorithm is - tuned to compress them better. The effect of Z_FILTERED is to force more - Huffman coding and less string matching; it is somewhat intermediate - between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects - the compression ratio but not the correctness of the compressed output even - if it is not set appropriately. + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned... [truncated message content] |
From: <ljs...@us...> - 2012-02-28 13:09:48
|
Revision: 751 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=751&view=rev Author: ljsebald Date: 2012-02-28 13:09:38 +0000 (Tue, 28 Feb 2012) Log Message: ----------- Removing zlib temporarily to make way for a new version... Removed Paths: ------------- kos-ports/zlib/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-02-27 20:40:34
|
Revision: 750 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=750&view=rev Author: ljsebald Date: 2012-02-27 20:40:27 +0000 (Mon, 27 Feb 2012) Log Message: ----------- Finish doxygen documentation! Modified Paths: -------------- kos/include/kos/elf.h kos/include/kos/fs.h Modified: kos/include/kos/elf.h =================================================================== --- kos/include/kos/elf.h 2012-02-18 02:00:32 UTC (rev 749) +++ kos/include/kos/elf.h 2012-02-27 20:40:27 UTC (rev 750) @@ -5,6 +5,18 @@ */ +/** \file kos/elf.h + \brief ELF binary loading support. + + This file contains the support functionality for loading ELF binaries in + KOS. This includes the various header structures and whatnot that are used + in ELF files to store code/data/relocations/etc. This isn't necessarily + meant for running multiple processes, but more for loadable library support + within KOS. + + \author Dan Potter +*/ + #ifndef __KOS_ELF_H #define __KOS_ELF_H @@ -14,69 +26,107 @@ #include <arch/types.h> #include <sys/queue.h> -/* ELF file header */ +/** \brief ELF file header. + + This header is at the beginning of any valid ELF binary and serves to + identify the architecture of the binary and various data about it. + + \headerfile kos/elf.h +*/ struct elf_hdr_t { - unsigned char ident[16]; /* For elf32-shl, 0x7f+"ELF"+1+1 */ - uint16 type; /* 0x02 for ET_EXEC */ - uint16 machine; /* 0x2a for elf32-shl */ - uint32 version; - uint32 entry; /* Entry point */ - uint32 phoff; /* Program header offset */ - uint32 shoff; /* Section header offset */ - uint32 flags; /* Processor flags */ - uint16 ehsize; /* ELF header size in bytes */ - uint16 phentsize; /* Program header entry size */ - uint16 phnum; /* Program header entry count */ - uint16 shentsize; /* Section header entry size */ - uint16 shnum; /* Section header entry count */ - uint16 shstrndx; /* String table section index */ + uint8 ident[16]; /**< \brief ELF identifier */ + uint16 type; /**< \brief ELF file type */ + uint16 machine; /**< \brief ELF file architecture */ + uint32 version; /**< \brief Object file version */ + uint32 entry; /**< \brief Entry point */ + uint32 phoff; /**< \brief Program header offset */ + uint32 shoff; /**< \brief Section header offset */ + uint32 flags; /**< \brief Processor flags */ + uint16 ehsize; /**< \brief ELF header size in bytes */ + uint16 phentsize; /**< \brief Program header entry size */ + uint16 phnum; /**< \brief Program header entry count */ + uint16 shentsize; /**< \brief Section header entry size */ + uint16 shnum; /**< \brief Section header entry count */ + uint16 shstrndx; /**< \brief String table section index */ }; -/* ELF architecture types */ -#define EM_386 3 /* ia32 */ -#define EM_ARM 40 /* arm */ -#define EM_SH 42 /* sh */ +/** \defgroup elf_archs ELF architecture types -/* Section header types */ -#define SHT_NULL 0 /* Inactive */ -#define SHT_PROGBITS 1 /* Program code/data */ -#define SHT_SYMTAB 2 /* Full symbol table */ -#define SHT_STRTAB 3 /* String table */ -#define SHT_RELA 4 /* Relocation table, with addends */ -#define SHT_HASH 5 /* Sym tab hashtable */ -#define SHT_DYNAMIC 6 /* Dynamic linking info */ -#define SHT_NOTE 7 /* Notes */ -#define SHT_NOBITS 8 /* Occupies no space in the file */ -#define SHT_REL 9 /* Relocation table, no addends */ -#define SHT_SHLIB 10 /* Invalid.. hehe */ -#define SHT_DYNSYM 11 /* Dynamic-only sym tab */ -#define SHT_LOPROC 0x70000000 /* Processor specific */ -#define SHT_HIPROC 0x7fffffff -#define SHT_LOUSER 0x80000000 /* Program specific */ -#define SHT_HIUSER 0xffffffff + These are the various architectures that we might care about for ELF files. -/* Section header flags */ -#define SHF_WRITE 1 /* Writable data */ -#define SHF_ALLOC 2 /* Resident */ -#define SHF_EXECINSTR 4 /* Executable instructions */ -#define SHF_MASKPROC 0xf0000000 /* Processor specific */ + @{ +*/ +#define EM_386 3 /**< \brief x86 (IA32) */ +#define EM_ARM 40 /**< \brief ARM */ +#define EM_SH 42 /**< \brief SuperH */ +/** @} */ -/* Special section indeces */ -#define SHN_UNDEF 0 /* Undefined, missing, irrelevant */ -#define SHN_ABS 0xfff1 /* Absolute values */ +/** \defgroup elf_sections Section header types -/* Section header */ + These are the various types of section headers that can exist in an ELF + file. + + @{ +*/ +#define SHT_NULL 0 /**< \brief Inactive section */ +#define SHT_PROGBITS 1 /**< \brief Program code/data */ +#define SHT_SYMTAB 2 /**< \brief Full symbol table */ +#define SHT_STRTAB 3 /**< \brief String table */ +#define SHT_RELA 4 /**< \brief Relocation table, with addends */ +#define SHT_HASH 5 /**< \brief Symbol hash table */ +#define SHT_DYNAMIC 6 /**< \brief Dynamic linking info */ +#define SHT_NOTE 7 /**< \brief Notes section */ +#define SHT_NOBITS 8 /**< \brief A section that occupies no space in + the file */ +#define SHT_REL 9 /**< \brief Relocation table, no addends */ +#define SHT_SHLIB 10 /**< \brief Reserved */ +#define SHT_DYNSYM 11 /**< \brief Dynamic-only sym tab */ +#define SHT_LOPROC 0x70000000 /**< \brief Start of processor specific types */ +#define SHT_HIPROC 0x7fffffff /**< \brief End of processor specific types */ +#define SHT_LOUSER 0x80000000 /**< \brief Start of program specific types */ +#define SHT_HIUSER 0xffffffff /**< \brief End of program specific types */ +/** @} */ + +/** \defgroup elf_hdrflags Section header flags + + These are the flags that can be set on a section header. These are related + to whether the section should reside in memory and permissions on it. + + @{ +*/ +#define SHF_WRITE 1 /**< \brief Writable data */ +#define SHF_ALLOC 2 /**< \brief Resident */ +#define SHF_EXECINSTR 4 /**< \brief Executable instructions */ +#define SHF_MASKPROC 0xf0000000 /**< \brief Processor specific mask */ +/** @} */ + +/** \defgroup elf_specsec Special section indeces + + These are the indices to be used in special situations in the section array. + + @{ +*/ +#define SHN_UNDEF 0 /**< \brief Undefined, missing, irrelevant */ +#define SHN_ABS 0xfff1 /**< \brief Absolute values */ +/** @} */ + +/** \brief ELF Section header. + + This structure represents the header on each ELF section. + + \headerfile kos/elf.h +*/ struct elf_shdr_t { - uint32 name; /* Index into string table */ - uint32 type; /* See constants above */ - uint32 flags; - uint32 addr; /* In-memory offset */ - uint32 offset; /* On-disk offset */ - uint32 size; /* Size (if SHT_NOBITS, zero file len */ - uint32 link; /* See below */ - uint32 info; /* See below */ - uint32 addralign; /* Alignment constraints */ - uint32 entsize; /* Fixed-size table entry sizes */ + uint32 name; /**< \brief Index into string table */ + uint32 type; /**< \brief Section type \see elf_sections */ + uint32 flags; /**< \brief Section flags \see elf_hdrflags */ + uint32 addr; /**< \brief In-memory offset */ + uint32 offset; /**< \brief On-disk offset */ + uint32 size; /**< \brief Size (if SHT_NOBITS, amount of 0s needed) */ + uint32 link; /**< \brief Section header table index link */ + uint32 info; /**< \brief Section header extra info */ + uint32 addralign; /**< \brief Alignment constraints */ + uint32 entsize; /**< \brief Fixed-size table entry sizes */ }; /* Link and info fields: @@ -100,69 +150,154 @@ */ -#define STB_LOCAL 0 -#define STB_GLOBAL 1 -#define STB_WEAK 2 +/** \defgroup elf_binding Symbol binding types. -#define STT_NOTYPE 0 -#define STT_OBJECT 1 -#define STT_FUNC 2 -#define STT_SECTION 3 -#define STT_FILE 4 + These are the values that can be set to say how a symbol is bound in an ELF + binary. This is stored in the upper 4 bits of the info field in elf_sym_t. -/* Symbol table entry */ + @{ +*/ +#define STB_LOCAL 0 /**< \brief Local (non-exported) symbol */ +#define STB_GLOBAL 1 /**< \brief Global (exported) symbol */ +#define STB_WEAK 2 /**< \brief Weak-linked symbol */ +/** @} */ + +/** \defgroup elf_symtype Symbol types. + + These are the values that can be set to say what kind of symbol a given + symbol in an ELF file is. This is stored in the lower 4 bits of the info + field in elf_sym_t. + + @{ +*/ +#define STT_NOTYPE 0 /**< \brief Symbol has no type */ +#define STT_OBJECT 1 /**< \brief Symbol is an object */ +#define STT_FUNC 2 /**< \brief Symbol is a function */ +#define STT_SECTION 3 /**< \brief Symbol is a section */ +#define STT_FILE 4 /**< \brief Symbol is a file name */ +/** @} */ + +/** \brief Symbol table entry + + This structure represents a single entry in a symbol table in an ELF file. + + \headerfile kos/elf.h +*/ struct elf_sym_t { - uint32 name; /* Index into stringtab */ - uint32 value; - uint32 size; - uint8 info; /* type == info & 0x0f */ - uint8 other; - uint16 shndx; /* Section index */ + uint32 name; /**< \brief Index into file's string table */ + uint32 value; /**< \brief Value of the symbol */ + uint32 size; /**< \brief Size of the symbol */ + uint8 info; /**< \brief Symbol type and binding */ + uint8 other; /**< \brief 0. Holds no meaning. */ + uint16 shndx; /**< \brief Section index */ }; + +/** \brief Retrieve the binding type for a symbol. + \param info The info field of an elf_sym_t. + \return The binding type of the symbol. + \see elf_binding +*/ #define ELF32_ST_BIND(info) ((info) >> 4) + +/** \brief Retrieve the symbol type for a symbol. + \param info The info field of an elf_sym_t. + \return The symbol type of the symbol. + \see elf_symtype +*/ #define ELF32_ST_TYPE(info) ((info) & 0xf) -/* Relocation-A Entries */ +/** \brief ELF Relocation entry (with explicit addend). + + This structure represents an ELF relocation entry with an explicit addend. + This structure is used on some architectures, whereas others use the + elf_rel_t structure instead. + + \headerfile kos/elf.h +*/ struct elf_rela_t { - uint32 offset; /* Offset within section */ - uint32 info; /* Symbol and type */ - int32 addend; /* "A" constant */ + uint32 offset; /**< \brief Offset within section */ + uint32 info; /**< \brief Symbol and type */ + int32 addend; /**< \brief Constant addend for the symbol */ }; -/* Relocation Entries */ +/** \brief ELF Relocation entry (without explicit addend). + + This structure represents an ELF relocation entry without an explicit + addend. This structure is used on some architectures, whereas others use the + elf_rela_t structure instead. + + \headerfile kos/elf.h +*/ struct elf_rel_t { - uint32 offset; /* Offset within section */ - uint32 info; /* Symbol and type */ + uint32 offset; /**< \brief Offset within section */ + uint32 info; /**< \brief Symbol and type */ }; -/* Relocation-related defs */ -#define R_SH_DIR32 1 -#define R_386_32 1 -#define R_386_PC32 2 +/** \defgroup elf_reltypes ELF relocation types + + These define the types of operations that can be done to calculate + relocations within ELF files. + + @{ +*/ +#define R_SH_DIR32 1 /**< \brief SuperH: Rel = Symbol + Addend */ +#define R_386_32 1 /**< \brief x86: Rel = Symbol + Addend */ +#define R_386_PC32 2 /**< \brief x86: Rel = Symbol + Addend - Value */ +/** @} */ + +/** \brief Retrieve the symbol index from a relocation entry. + \param i The info field of an elf_rel_t or elf_rela_t. + \return The symbol table index from that relocation entry. +*/ #define ELF32_R_SYM(i) ((i) >> 8) + +/** \brief Retrieve the relocation type from a relocation entry. + \param i The info field of an elf_rel_t or an elf_rela_t. + \return The relocation type of that relocation. + \see elf_reltypes +*/ #define ELF32_R_TYPE(i) ((uint8)(i)) +struct klibrary; -/* Kernel-specific definition of a loaded ELF binary */ -struct klibrary; +/** \brief Kernel-specific definition of a loaded ELF binary. + + This structure represents the internal representation of a loaded ELF binary + in KallistiOS (specifically as a dynamically loaded library). + + \headerfile kos/elf.h +*/ typedef struct elf_prog { - void *data; /* Data block containing the program */ - uint32 size; /* Memory image size (rounded up to page size) */ + void *data; /**< \brief Pointer to program in memory */ + uint32 size; /**< \brief Memory image size (rounded up to page size) */ - /* Library exports */ - ptr_t lib_get_name; - ptr_t lib_get_version; - ptr_t lib_open; - ptr_t lib_close; + /* Library exports */ + ptr_t lib_get_name; /**< \brief Pointer to get_name() function */ + ptr_t lib_get_version; /**< \brief Pointer to get_version() function */ + ptr_t lib_open; /**< \brief Pointer to library's open function */ + ptr_t lib_close; /**< \brief Pointer to library's close function */ - /* Library filename */ - char fn[256]; + char fn[256]; /**< \brief Filename of library */ } elf_prog_t; -/* Load an ELF binary and return the relevant data in an elf_prog_t structure. */ +/** \brief Load an ELF binary. + + This function loads an ELF binary from the VFS and fills in an elf_prog_t + for it. + + \param fn The filename of the binary on the VFS. + \param shell Unused? + \param out Storage for the binary that will be loaded. + \return 0 on success, <0 on failure. +*/ int elf_load(const char *fn, struct klibrary * shell, elf_prog_t * out); -/* Free a loaded ELF program */ +/** \brief Free a loaded ELF program. + + This function cleans up an ELF binary that was loaded with elf_load(). + + \param prog The loaded binary to clean up. +*/ void elf_free(elf_prog_t *prog); __END_DECLS Modified: kos/include/kos/fs.h =================================================================== --- kos/include/kos/fs.h 2012-02-18 02:00:32 UTC (rev 749) +++ kos/include/kos/fs.h 2012-02-27 20:40:27 UTC (rev 750) @@ -38,10 +38,10 @@ \headerfile kos/fs.h */ typedef struct kos_dirent { - int size; - char name[MAX_FN_LEN]; - time_t time; - uint32 attr; + int size; /**< \brief Size of the file in bytes. */ + char name[MAX_FN_LEN]; /**< \brief Name of the file. */ + time_t time; /**< \brief Last access/mod/change time (depends on VFS) */ + uint32 attr; /**< \brief Attributes of the file. */ } dirent_t; /* Forward declaration */ @@ -55,13 +55,13 @@ \headerfile kos/fs.h. */ -typedef struct { - struct vfs_handler *dev; /**< \brief The VFS handler for this file/dir */ - uint32 unique; /**< \brief A unique identifier on the VFS for this file/dir */ - uint32 type; /**< \brief File/Dir type */ - uint32 attr; /**< \brief Attributes */ - off_t size; /**< \brief Total file size, if applicable */ - time_t time; /**< \brief Last access/mod/change time (depends on VFS) */ +typedef struct { + struct vfs_handler *dev; /**< \brief The VFS handler for this file/dir */ + uint32 unique; /**< \brief A unique identifier on the VFS for this file/dir */ + uint32 type; /**< \brief File/Dir type */ + uint32 attr; /**< \brief Attributes */ + off_t size; /**< \brief Total file size, if applicable */ + time_t time; /**< \brief Last access/mod/change time (depends on VFS) */ } stat_t; /* stat_t.unique */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-02-18 02:00:43
|
Revision: 749 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=749&view=rev Author: ljsebald Date: 2012-02-18 02:00:32 +0000 (Sat, 18 Feb 2012) Log Message: ----------- Update the release notes... Things are starting to look a lot more like we might get a release done in the next year. ;) Modified Paths: -------------- kos/doc/RELNOTES Modified: kos/doc/RELNOTES =================================================================== --- kos/doc/RELNOTES 2012-02-18 01:24:01 UTC (rev 748) +++ kos/doc/RELNOTES 2012-02-18 02:00:32 UTC (rev 749) @@ -1,15 +1,29 @@ KallistiOS ##version## -Copyright (C)2002,2003 Dan Potter +Copyright (C) 2002, 2003 Dan Potter +Copyright (C) 2012 Lawrence Sebald -RELEASE NOTES for 1.3.0 +RELEASE NOTES for 2.0.0 ----------------------- -This tree was branched from the 1.2.x tree somewhat slightly before the 1.2.1 -release, so everything in that entry applies to this one as well. +This release has been a long time coming, to say the least. Pretty much every +part of KOS has been modified in some way since 1.2.0 and many things have +undergone a complete overhaul. After almost a decade of living exclusively in +the source repository things have finally settled to a point where a release is +possible and a good idea. +All of the various platform targets for KOS other than the Dreamcast target are +considered deprecated unless someone else steps up to maintain them. If nobody +steps up, these will be removed at a later date. I somewhat doubt that any of +the other platforms can be built successfully anymore at this point. + Several libc standards compliance things were fixed, so stdlib.h no longer includes assert.h for you. This will break some code that assumes that assert() is available when stdlib.h (or kos.h) is included. +Speaking of libc-related standards compliance stuff, the built-in libc has been +removed entirely in favor of using Newlib directly. You must build a patched +Newlib for use with KOS. The patches needed for various versions of Newlib are +included in the utils directory of the KOS source. + The build system (including environ.sh) has seen some overhauling. You'll need to build a new environ.sh from a sample again. Additionally, your Makefile may need to change. See the examples. @@ -24,9 +38,6 @@ The dbgio functions have changed. It now implements a full debug-friendly console system. See include/kos/dbgio.h for more info. - -RELEASE NOTES for 1.2.1 ------------------------ There is a new build system for addons/ports which is quite a bit more automated than the old way, and is arch-centric. Now to build a new addon you downloaded, just extract it into addons/ and it will be built for @@ -40,7 +51,40 @@ addon (libkosutils). If you use the bspline or kos_img_* functions, you'll need to add -lkosutils to your link line somewhere. +KOS now has a built-in network stack in the kernel/net directory. This is only +usable at the moment with the Broadband Adapter or the Lan Adapter for the +Dreamcast. Also, right now it only supports UDP. You also have an almost +complete set of sockets functions so that you can use the networking support +just like you would on any other OS. Add INIT_NET to your KOS_INIT_FLAGS to +initialize the network support on startup. +If you are using the networking support on the Dreamcast, it is now possible to +use dcload debugging through KOS' network stack. This is automatically set up +for you if you initialize the network at startup time (through the +KOS_INIT_FLAGS). + +The old Maple API (that was deprecated in 1.1.8) has been removed entirely from +the source tree. Please update any code that may still be using it to the "new" +API that has been around since 1.1.8. + +There are a few new Maple drivers included with this release that were not +around previously. There is now support for the PuruPuru pack, the Dreameye +camera, and the Sound Input Peripheral. See the appropriate header files for +more information about how to use each of these. + +All of the KOS header files have had Doxygen comments added to them. From now +on, anything to be added to KOS should be documented before it is included in +the main tree. + +A lot of cobwebs have built up over the years in the KOS source, and its quite +possible that there are parts of the code that do not work properly anymore. +Please, if you find anything that doesn't work properly anymore, report an issue +on the Sourceforge bug tracker! + +There's probably a whole bunch of other stuff that should be mentioned in here, +but its been so long since anyone has updated this document... + + RELEASE NOTES for 1.2.0 ----------------------- The PVR API's performance/statistics measuring facility has changed. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-02-18 01:24:11
|
Revision: 748 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=748&view=rev Author: ljsebald Date: 2012-02-18 01:24:01 +0000 (Sat, 18 Feb 2012) Log Message: ----------- Document that this file is undocumented in the KOS docs and defer to the POSIX standard for documentation. Modified Paths: -------------- kos/include/pthread.h Modified: kos/include/pthread.h =================================================================== --- kos/include/pthread.h 2012-02-18 01:12:56 UTC (rev 747) +++ kos/include/pthread.h 2012-02-18 01:24:01 UTC (rev 748) @@ -19,6 +19,20 @@ // Need a local copy of this because the default one is buggy. +/** \file pthread.h + \brief POSIX-compatibile (sorta) threading support. + + This file was imported (with a few changes) from Newlib. If you really want + to know about the functions in here, you should probably consult the Single + Unix Specification and the POSIX specification. Here's a link to that: + http://pubs.opengroup.org/onlinepubs/007904875/basedefs/pthread.h.html + + The rest of this file will remain undocumented, as it isn't really a part of + KOS proper... Also, doxygen tends to mangle this whole thing anyway... +*/ + +/** \cond */ + #ifndef __PTHREAD_h #define __PTHREAD_h @@ -299,4 +313,5 @@ #endif #endif +/** \endcond */ /* end of include file */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-02-18 01:13:02
|
Revision: 747 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=747&view=rev Author: ljsebald Date: 2012-02-18 01:12:56 +0000 (Sat, 18 Feb 2012) Log Message: ----------- Remove endian.h. Its unused and not needed. Removed Paths: ------------- kos/include/endian.h Deleted: kos/include/endian.h =================================================================== --- kos/include/endian.h 2012-02-18 01:06:18 UTC (rev 746) +++ kos/include/endian.h 2012-02-18 01:12:56 UTC (rev 747) @@ -1,122 +0,0 @@ -/* - * This module was ported from the BSD 4.5 libc by Dan Potter. Please - * see "README.BSD" in "docs" for more information. - * - */ - -/* - * Copyright (c) 1987, 1991 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)endian.h 7.8 (Berkeley) 4/3/91 - * $FreeBSD: src/sys/i386/include/endian.h,v 1.18 1999/12/29 04:33:01 peter Exp $ - */ - -#ifndef _MACHINE_ENDIAN_H_ -#define _MACHINE_ENDIAN_H_ - -#include <stdlib.h> - -/* - * Define the order of 32-bit words in 64-bit words. - */ -#define _QUAD_HIGHWORD 1 -#define _QUAD_LOWWORD 0 - -#ifndef _POSIX_SOURCE - -/* - * Definitions for byte order, according to byte significance from low - * address to high. - */ -#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ -#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ -#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ - -#define BYTE_ORDER LITTLE_ENDIAN - -#ifndef _KERNEL -#include <sys/cdefs.h> -#endif - -__BEGIN_DECLS -unsigned long htonl __P((unsigned long)); -unsigned short htons __P((unsigned short)); -unsigned long ntohl __P((unsigned long)); -unsigned short ntohs __P((unsigned short)); -__END_DECLS - -#define __word_swap_long(x) \ -__extension__ ({ register u_long __X = (x); \ - __asm ("rorl $16, %1" \ - : "=r" (__X) \ - : "0" (__X)); \ - __X; }) - -#if defined(_KERNEL) && (defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU)) && !defined(I386_CPU) - -#define __byte_swap_long(x) \ -__extension__ ({ register u_long __X = (x); \ - __asm ("bswap %0" \ - : "=r" (__X) \ - : "0" (__X)); \ - __X; }) -#else - -#define __byte_swap_long(x) \ -__extension__ ({ register u_long __X = (x); \ - __asm ("xchgb %h1, %b1\n\trorl $16, %1\n\txchgb %h1, %b1" \ - : "=q" (__X) \ - : "0" (__X)); \ - __X; }) -#endif - -#define __byte_swap_word(x) \ -__extension__ ({ register u_short __X = (x); \ - __asm ("xchgb %h1, %b1" \ - : "=q" (__X) \ - : "0" (__X)); \ - __X; }) - -/* - * Macros for network/external number representation conversion. - */ -/* #ifdef __GNUC__ -#define ntohl __byte_swap_long -#define ntohs __byte_swap_word -#define htonl __byte_swap_long -#define htons __byte_swap_word -#endif */ - -#define NTOHL(x) ((x) = ntohl((u_long)(x))) -#define NTOHS(x) ((x) = ntohs((u_short)(x))) -#define HTONL(x) ((x) = htonl((u_long)(x))) -#define HTONS(x) ((x) = htons((u_short)(x))) - -#endif /* ! _POSIX_SOURCE */ - -#endif /* !_MACHINE_ENDIAN_H_ */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-02-18 01:06:24
|
Revision: 746 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=746&view=rev Author: ljsebald Date: 2012-02-18 01:06:18 +0000 (Sat, 18 Feb 2012) Log Message: ----------- Document kos/fs.h. Modified Paths: -------------- kos/include/kos/fs.h Modified: kos/include/kos/fs.h =================================================================== --- kos/include/kos/fs.h 2012-02-17 22:37:44 UTC (rev 745) +++ kos/include/kos/fs.h 2012-02-18 01:06:18 UTC (rev 746) @@ -18,7 +18,25 @@ #include <kos/nmmgr.h> -/* Directory entry; all handlers must conform to this interface */ +/** \file kos/fs.h + \brief Virtual filesystem support. + + This file contains the interface to the virtual filesystem (VFS) of KOS. The + functions defined in this file make up the base of the filesystem operations + that can be performed by programs. The functions in here are abstracted by + various other layers in libc, and shouldn't be necessarily used (for + portability reasons). However, if you want only to interact with KOS in your + programs, feel free to use them to your heart's content! + + \author Dan Potter +*/ + +/** \brief Directory entry. + + All VFS handlers must conform to this interface in their directory entries. + + \headerfile kos/fs.h +*/ typedef struct kos_dirent { int size; char name[MAX_FN_LEN]; @@ -26,186 +44,469 @@ uint32 attr; } dirent_t; -/* File status information; like dirent, this is not the same as the *nix - variation but it has similar information. */ +/* Forward declaration */ struct vfs_handler; -typedef struct /*stat*/ { - struct vfs_handler * dev; /* The VFS handler for this file/dir */ - uint32 unique; /* A unique identifier on the VFS for this file/dir */ - uint32 type; /* File/Dir type */ - uint32 attr; /* Attributes */ - off_t size; /* Total file size, if applicable */ - time_t time; /* Last access/mod/change time (depends on VFS) */ + +/** \brief File status information. + + This structure, while different from the standard POSIX stat structure, + provides much of the same information. We limit it to only what is relevant + for KOS. + + \headerfile kos/fs.h. +*/ +typedef struct { + struct vfs_handler *dev; /**< \brief The VFS handler for this file/dir */ + uint32 unique; /**< \brief A unique identifier on the VFS for this file/dir */ + uint32 type; /**< \brief File/Dir type */ + uint32 attr; /**< \brief Attributes */ + off_t size; /**< \brief Total file size, if applicable */ + time_t time; /**< \brief Last access/mod/change time (depends on VFS) */ } stat_t; /* stat_t.unique */ -#define STAT_UNIQUE_NONE 0 /* Constant to use denoting the file has no unique ID */ +/**< \brief stat_t.unique: Constant to use denoting the file has no unique ID */ +#define STAT_UNIQUE_NONE 0 /* stat_t.type */ -#define STAT_TYPE_NONE 0 /* Unknown / undefined / not relevant */ -#define STAT_TYPE_FILE 1 /* Standard file */ -#define STAT_TYPE_DIR 2 /* Standard directory */ -#define STAT_TYPE_PIPE 3 /* A virtual device of some sort (pipe, socket, etc) */ -#define STAT_TYPE_META 4 /* Meta data */ +/** \brief stat_t.type: Unknown / undefined / not relevant */ +#define STAT_TYPE_NONE 0 +/** \brief stat_t.type: Standard file */ +#define STAT_TYPE_FILE 1 + +/** \brief stat_t.type: Standard directory */ +#define STAT_TYPE_DIR 2 + +/** \brief stat_t.type: A virtual device of some sort (pipe, socket, etc) */ +#define STAT_TYPE_PIPE 3 + +/** \brief stat_t.type: Meta data */ +#define STAT_TYPE_META 4 + /* stat_t.attr */ -#define STAT_ATTR_NONE 0x00 /* No attributes */ -#define STAT_ATTR_R 0x01 /* Read-capable */ -#define STAT_ATTR_W 0x02 /* Write-capable */ -#define STAT_ATTR_RW (STAT_ATTR_R | STAT_ATTR_W) /* Read/Write capable */ +#define STAT_ATTR_NONE 0x00 /**< \brief stat_t.attr: No attributes */ +#define STAT_ATTR_R 0x01 /**< \brief stat_t.attr: Read-capable */ +#define STAT_ATTR_W 0x02 /**< \brief stat_t.attr: Write-capable */ -/* File descriptor type */ +/** \brief stat_t.attr: Read/Write capable */ +#define STAT_ATTR_RW (STAT_ATTR_R | STAT_ATTR_W) + +/** \brief File descriptor type */ typedef int file_t; -/* Invalid file handle constant (for open failure, etc) */ +/** \brief Invalid file handle constant (for open failure, etc) */ #define FILEHND_INVALID ((file_t)-1) -/* Handler interface; all VFS handlers must implement this interface. */ +/** \brief VFS handler interface. + + All VFS handlers must implement this interface. + + \headerfile kos/fs.h +*/ typedef struct vfs_handler { - /* Name manager handler header */ - nmmgr_handler_t nmmgr; + /** \brief Name manager handler header */ + nmmgr_handler_t nmmgr; - /* Some VFS-specific pieces */ - int cache; /* Allow VFS cacheing; 0=no, 1=yes */ - void * privdata; /* Pointer to private data for the handler */ + /* Some VFS-specific pieces */ + /** \brief Allow VFS cacheing; 0=no, 1=yes */ + int cache; + /** \brief Pointer to private data for the handler */ + void *privdata; - /* Open a file on the given VFS; return a unique identifier */ - void * (*open)(struct vfs_handler * vfs, const char *fn, int mode); + /** \brief Open a file on the given VFS; return a unique identifier */ + void *(*open)(struct vfs_handler *vfs, const char *fn, int mode); - /* Close a previously opened file */ - void (*close)(void * hnd); + /** \brief Close a previously opened file */ + void (*close)(void *hnd); - /* Read from a previously opened file */ - ssize_t (*read)(void * hnd, void *buffer, size_t cnt); + /** \brief Read from a previously opened file */ + ssize_t (*read)(void *hnd, void *buffer, size_t cnt); - /* Write to a previously opened file */ - ssize_t (*write)(void * hnd, const void *buffer, size_t cnt); + /** \brief Write to a previously opened file */ + ssize_t (*write)(void *hnd, const void *buffer, size_t cnt); - /* Seek in a previously opened file */ - off_t (*seek)(void * hnd, off_t offset, int whence); + /** \brief Seek in a previously opened file */ + off_t (*seek)(void *hnd, off_t offset, int whence); - /* Return the current position in a previously opened file */ - off_t (*tell)(void * hnd); + /** \brief Return the current position in a previously opened file */ + off_t (*tell)(void *hnd); - /* Return the total size of a previously opened file */ - size_t (*total)(void * hnd); + /** \brief Return the total size of a previously opened file */ + size_t (*total)(void *hnd); - /* Read the next directory entry in a directory opened with O_DIR */ - dirent_t* (*readdir)(void * hnd); + /** \brief Read the next directory entry in a directory opened with O_DIR */ + dirent_t *(*readdir)(void *hnd); - /* Execute a device-specific call on a previously opened file */ - int (*ioctl)(void * hnd, void *data, size_t size); + /** \brief Execute a device-specific call on a previously opened file */ + int (*ioctl)(void *hnd, void *data, size_t size); - /* Rename/move a file on the given VFS */ - int (*rename)(struct vfs_handler * vfs, const char *fn1, const char *fn2); + /** \brief Rename/move a file on the given VFS */ + int (*rename)(struct vfs_handler *vfs, const char *fn1, const char *fn2); - /* Delete a file from the given VFS */ - int (*unlink)(struct vfs_handler * vfs, const char *fn); + /** \brief Delete a file from the given VFS */ + int (*unlink)(struct vfs_handler *vfs, const char *fn); - /* "Memory map" a previously opened file */ - void* (*mmap)(void * fd); + /** \brief "Memory map" a previously opened file */ + void *(*mmap)(void *fd); - /* Perform an I/O completion (async I/O) for a previously opened file */ - int (*complete)(void * fd, ssize_t * rv); + /** \brief Perform an I/O completion (async I/O) for a previously opened file */ + int (*complete)(void *fd, ssize_t *rv); - /* Get status information on a file on the given VFS */ - int (*stat)(struct vfs_handler * vfs, const char * fn, stat_t * rv); + /** \brief Get status information on a file on the given VFS */ + int (*stat)(struct vfs_handler *vfs, const char *fn, stat_t *rv); - /* Make a directory on the given VFS */ - int (*mkdir)(struct vfs_handler * vfs, const char * fn); + /** \brief Make a directory on the given VFS */ + int (*mkdir)(struct vfs_handler *vfs, const char *fn); - /* Remove a directory from the given VFS */ - int (*rmdir)(struct vfs_handler * vfs, const char * fn); + /** \brief Remove a directory from the given VFS */ + int (*rmdir)(struct vfs_handler *vfs, const char *fn); } vfs_handler_t; -/* This is the number of distinct file descriptors the global table - has in it. */ +/** \brief The number of distinct file descriptors that can be in use at a + time. +*/ #define FD_SETSIZE 1024 +/** \cond */ /* This is the private struct that will be used as raw file handles underlying descriptors. */ struct fs_hnd; /* The kernel-wide file descriptor table. These will reference to open files. */ -extern struct fs_hnd * fd_table[FD_SETSIZE]; +extern struct fs_hnd *fd_table[FD_SETSIZE]; +/** \endcond */ /* Open modes */ #include <sys/fcntl.h> -#if 0 -#define O_RDONLY 1 /* Read only */ -#define O_RDWR 2 /* Read-write */ -#define O_APPEND 3 /* Append to an existing file */ -#define O_WRONLY 4 /* Write-only */ -#endif -//#define O_MODE_MASK 7 /* Mask for mode numbers */ -#define O_MODE_MASK 0x0f /* Mask for mode numbers */ +/** \defgroup open_modes File open modes + + @{ +*/ +#define O_MODE_MASK 0x0f /**< \brief Mask for mode numbers */ //#define O_TRUNC 0x0100 /* Truncate */ -#define O_ASYNC 0x0200 /* Open for asynchronous I/O */ +#define O_ASYNC 0x0200 /**< \brief Open for asynchronous I/O */ //#define O_NONBLOCK 0x0400 /* Open for non-blocking I/O */ -#define O_DIR 0x1000 /* Open as directory */ -#define O_META 0x2000 /* Open as metadata */ +#define O_DIR 0x1000 /**< \brief Open as directory */ +#define O_META 0x2000 /**< \brief Open as metadata */ +/** @} */ -/* Seek modes */ -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 +/** \defgroup seek_modes Seek modes + These are the values you can pass for the whence parameter to fs_seek(). + + @{ +*/ +#define SEEK_SET 0 /**< \brief Set position to offset. */ +#define SEEK_CUR 1 /**< \brief Seek from current position. */ +#define SEEK_END 2 /**< \brief Seek from end of file. */ +/** @} */ + /* Standard file descriptor functions */ -file_t fs_open(const char *fn, int mode); -void fs_close(file_t hnd); -ssize_t fs_read(file_t hnd, void *buffer, size_t cnt); -ssize_t fs_write(file_t hnd, const void *buffer, size_t cnt); -off_t fs_seek(file_t hnd, off_t offset, int whence); -off_t fs_tell(file_t hnd); -size_t fs_total(file_t hnd); -dirent_t* fs_readdir(file_t hnd); -int fs_ioctl(file_t hnd, void *data, size_t size); -int fs_rename(const char *fn1, const char *fn2); -int fs_unlink(const char *fn); -int fs_chdir(const char *fn); -void* fs_mmap(file_t hnd); -int fs_complete(file_t fd, ssize_t * rv); -int fs_stat(const char * fn, stat_t * rv); -int fs_mkdir(const char * fn); -int fs_rmdir(const char * fn); -file_t fs_dup(file_t oldfd); -file_t fs_dup2(file_t oldfd, file_t newfd); +/** \brief Open a file on the VFS. -/* Call this function to create a "transient" file descriptor. What this - does for you is let you setup ad-hoc VFS integration for libs that - have their own open mechanism (e.g., TCP/IP sockets). It could also be - used to do things like generic resource management. Calling this - function is functionally identical to fs_open, except it doesn't - require registering a full VFS or doing a name lookup. */ -file_t fs_open_handle(vfs_handler_t * vfs, void * hnd); + This function opens the specified file, returning a new file descriptor to + access the file. -/* These two functions are used to reveal "internal" info about a file - descriptor, so that libraries can provide their own facilities using - VFS-sponsored file descriptors (e.g., TCP/IP bind, connect, etc). */ -vfs_handler_t * fs_get_handler(file_t fd); -void * fs_get_handle(file_t fd); + \param fn The path to open. + \param mode The mode to use with opening the file. This may + include the standard open modes (O_RDONLY, O_WRONLY, + etc), as well as values from the \ref open_modes + list. Multiple values can be ORed together. + \return The new file descriptor on success, -1 on error. +*/ +file_t fs_open(const char *fn, int mode); -/* Returns the working directory of the current thread */ +/** \brief Close an opened file. + + This function closes the specified file descriptor, releasing all resources + associated with the descriptor. + + \param hnd The file descriptor to close. +*/ +void fs_close(file_t hnd); + +/** \brief Read from an opened file. + + This function reads into the specified buffer from the file at its current + file pointer. + + \param hnd The file descriptor to read from. + \param buffer The buffer to read into. + \param cnt The size of the buffer (or the number of bytes + requested). + \return The number of bytes read, or -1 on error. Note that + this may not be the full number of bytes requested. +*/ +ssize_t fs_read(file_t hnd, void *buffer, size_t cnt); + +/** \brief Write to an opened file. + + This function writes the specfied buffer into the file at the current file + pointer. + + \param hnd The file descriptor to write into. + \param buffer The data to write into the file. + \param cnt The size of the buffer, in bytes. + \return The number of bytes written, or -1 on failure. Note + that the number of bytes written may be less than + what was requested. +*/ +ssize_t fs_write(file_t hnd, const void *buffer, size_t cnt); + +/** \brief Seek to a new position within a file. + + This function moves the file pointer to the specified position within the + file (the base of this position is determined by the whence parameter). + + \param hnd The file descriptor to move the pointer for. + \param offset The offset in bytes from the specified base. + \param whence The base of the pointer move. This should be one of + the \ref seek_modes values. + \return The new position of the file pointer. +*/ +off_t fs_seek(file_t hnd, off_t offset, int whence); + +/** \brief Retrieve the position of the pointer within a file. + + This function retrieves the current location of the file pointer within an + opened file. This is an offset in bytes from the start of the file. + + \param hnd The file descriptor to retrieve the pointer from. + \return The offset within the file for the pointer. +*/ +off_t fs_tell(file_t hnd); + +/** \brief Retrieve the length of an opened file. + + This file retrieves the length of the file associated with the given file + descriptor. + + \param hnd The file descriptor to retrieve the size from. + \return The length of the file on success, -1 on failure. +*/ +size_t fs_total(file_t hnd); + +/** \brief Read an entry from an opened directory. + + This function reads the next entry from the directory specified by the given + file descriptor. + + \param hnd The opened directory's file descriptor. + \return The next entry, or NULL on failure. +*/ +dirent_t *fs_readdir(file_t hnd); + +/** \brief Execute a device-specific command on a file descriptor. + + The types and formats of the commands are device/filesystem specific, and + are not documented here. Each filesystem may define any commands that are + specific to it with its implementation of this function. + + \param hnd The file descriptor to operate on. + \param data The command to send. + \param size The size of the command, in bytes. + \return -1 on failure. +*/ +int fs_ioctl(file_t hnd, void *data, size_t size); + +/** \brief Rename the specified file to the given filename. + + This function renames the file specified by the first argument to the second + argument. The two paths should be on the same filesystem. + + \param fn1 The existing file to rename. + \param fn2 The new filename to rename to. + \return 0 on success, -1 on failure. +*/ +int fs_rename(const char *fn1, const char *fn2); + +/** \brief Delete the specified file. + + This function deletes the specified file from the filesystem. This should + only be used for files, not for directories. For directories, use fs_rmdir() + instead of this function. + + \param fn The path to remove. + \return 0 on success, -1 on failure. +*/ +int fs_unlink(const char *fn); + +/** \brief Change the current working directory of the current thread. + + This function changes the current working directory for the current thread. + Any relative paths passed into file-related functions will be relative to + the path that is changed to. + + \param fn The path to set as the current working directory. + \return 0 on success, -1 on failure. +*/ +int fs_chdir(const char *fn); + +/** \brief Memory-map a previously opened file. + + This file "maps" the opened file into memory, reading the whole file into a + buffer, and returning that buffer. The returned buffer should not be freed, + as it will be freed when the file is closed. Bytes written into the buffer, + up to the original length of the file, will be written back to the file when + it is closed, assuming that the file is opened for writing. + + Note that some of the filesystems in KallistiOS do not support this + operation. + + \param hnd The descriptor to memory map. + \return The memory mapped buffer, or NULL on failure. +*/ +void *fs_mmap(file_t hnd); + +/** \brief Perform an I/O completion on the given file descriptor. + + This function is used with asynchronous I/O to perform an I/O completion on + the given file descriptor. Most filesystems do not support this operation + on KallistiOS. + + \param fd The descriptor to complete I/O on. + \param rv A buffer to store the size of the I/O in. + \return 0 on success, -1 on failure. +*/ +int fs_complete(file_t fd, ssize_t *rv); + +/** \brief Retrieve information about the specified path. + + This function retrieves the stat_t structure for the given path on the VFS. + This function is similar to the standard POSIX function stat(), but provides + slightly different data than it does. + + \param fn The path to retrieve information about. + \param rv The buffer to store stat information in. + \return 0 on success, -1 on failure. +*/ +int fs_stat(const char *fn, stat_t *rv); + +/** \brief Create a directory. + + This function creates the specified directory, if possible. + + \param fn The path of the directory to create. + \return 0 on success, -1 on failure. +*/ +int fs_mkdir(const char *fn); + +/** \brief Remove a directory by name. + + This function removes the specified directory. The directory shall only be + removed if it is empty. + + \param fn The path of the directory to remove. + \return 0 on success, -1 on failure. +*/ +int fs_rmdir(const char *fn); + +/** \brief Duplicate a file descriptor. + + This function duplicates the specified file descriptor, returning a new file + descriptor that can be used to access the file. This is equivalent to the + standard POSIX function dup(). + + \param oldfd The old file descriptor to duplicate. + \return The new file descriptor on success, -1 on failure. +*/ +file_t fs_dup(file_t oldfd); + +/** \brief Duplicate a file descriptor onto the specified descriptor. + + This function duplicates the specified file descriptor onto the other file + descriptor provided. If the newfd parameter represents an open file, that + file will be closed before the old descriptor is duplicated onto it. This is + equivalent to the standard POSIX function dup2(). + + \param oldfd The old file descriptor to duplicate. + \param newfd The descriptor to copy into. + \return The new file descriptor on success, -1 on failure. +*/ +file_t fs_dup2(file_t oldfd, file_t newfd); + +/** \brief Create a "transient" file descriptor. + + This function creates and opens a new file descriptor that isn't associated + directly with a file on the filesystem. This is used internally to actually + open files, and should (in general) not be called by user code. Effectively, + if you're trying to implement your own filesystem handler in your code, you + may need this function, otherwise you should just ignore it. + + \param vfs The VFS handler structure to use for the file. + \param hnd Internal handle data for the file. + \return The opened descriptor on success, -1 on failure. +*/ +file_t fs_open_handle(vfs_handler_t *vfs, void *hnd); + +/** \brief Retrieve the VFS Handler for a file descriptor. + + This function retrieves the Handler structure for the VFS of the specified + file descriptor. There is generally no reason to call this function in user + code, as it is meant for use internally. + + \param fd The file descriptor to retrieve the handler for. + \return The VFS' handler structure. +*/ +vfs_handler_t *fs_get_handler(file_t fd); + +/** \brief Retrieve the internal handle for a file descriptor. + + This function retrieves the internal file handle data of the specified file + descriptor. There is generally no reason to call this function in user code, + as it is meant for use internally. + + \param fd The file descriptor to retrieve the handler for. + \return The internal handle for the file descriptor. +*/ +void *fs_get_handle(file_t fd); + +/** \brief Get the current working directory of the running thread. + \return The current working directory. +*/ const char *fs_getwd(); /* Couple of util functions */ -/* Copies a file from 'src' to 'dst'. The amount of the file - actually copied without error is returned. */ -ssize_t fs_copy(const char * src, const char * dst); +/** \brief Copy a file. -/* Opens a file, allocates enough RAM to hold the whole thing, - reads it into RAM, and closes it. The caller owns the allocated - memory (and must free it). The file size is returned, or -1 - on failure; on success, out_ptr is filled with the address - of the loaded buffer, and on failure it is set to NULL. */ -ssize_t fs_load(const char * src, void ** out_ptr); + This function copies the file at src to dst on the filesystem. -/* VFS init */ -int fs_init(); -void fs_shutdown(); + \param src The filename to copy from. + \param dst The filename to copy to. + \return The number of bytes copied successfully. +*/ +ssize_t fs_copy(const char *src, const char *dst); +/** \brief Open and read a whole file into RAM. + + This function opens the specified file, reads it into memory (allocating the + necessary space with malloc), and closes the file. The caller is responsible + for freeing the memory when they are done with it. + + \param src The filename to open and read. + \param out_ptr A pointer to the buffer on success, NULL otherwise. + \return The size of the file on success, -1 otherwise. +*/ +ssize_t fs_load(const char *src, void **out_ptr); + +/** \brief Initialize the virtual filesystem. + + This is normally done for you by default when KOS starts. In general, there + should be no reason for you to call this function. + + \retval 0 On success. +*/ +int fs_init(); + +/** \brief Shut down the virtual filesystem. + + This is done for you by the normal shutdown procedure of KOS. There should + not really be any reason for you to call this function yourself. +*/ +void fs_shutdown(); + __END_DECLS #endif /* __KOS_FS_H */ - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-02-17 22:37:50
|
Revision: 745 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=745&view=rev Author: ljsebald Date: 2012-02-17 22:37:44 +0000 (Fri, 17 Feb 2012) Log Message: ----------- Protect fs_dup() and fs_dup2() against invalid file descriptors. Modified Paths: -------------- kos/kernel/fs/fs.c Modified: kos/kernel/fs/fs.c =================================================================== --- kos/kernel/fs/fs.c 2012-02-17 02:44:28 UTC (rev 744) +++ kos/kernel/fs/fs.c 2012-02-17 22:37:44 UTC (rev 745) @@ -266,19 +266,28 @@ file_t fs_dup(file_t oldfd) { /* Make sure it exists */ - if (!fd_table[oldfd]) { + if (oldfd < 0 || oldfd >= FD_SETSIZE) { errno = EBADF; return -1; } + else if (!fd_table[oldfd]) { + errno = EBADF; + return -1; + } return fs_hnd_assign(fd_table[oldfd]); } file_t fs_dup2(file_t oldfd, file_t newfd) { - if (!fd_table[oldfd]) { + /* Make sure the descriptors are valid */ + if (oldfd < 0 || oldfd >= FD_SETSIZE || newfd < 0 || newfd >= FD_SETSIZE) { errno = EBADF; return -1; } + else if (!fd_table[oldfd]) { + errno = EBADF; + return -1; + } if (fd_table[newfd]) fs_close(newfd); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2012-02-17 02:44:34
|
Revision: 744 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=744&view=rev Author: ljsebald Date: 2012-02-17 02:44:28 +0000 (Fri, 17 Feb 2012) Log Message: ----------- <Ayla> last patch, kernel/fs/fs.c:134 should return NULL, not 0 <humble_hoser> +1 for pedantic patch <humble_hoser> ;) <PingChan> #define NULL 0 <PingChan> therefore, 0 is proper :P <Ayla> humble_hoser, that hurts me <Ayla> I just want to fix warnings (From the #dreamcastdev channel on freenode) Modified Paths: -------------- kos/kernel/fs/fs.c Modified: kos/kernel/fs/fs.c =================================================================== --- kos/kernel/fs/fs.c 2011-12-31 18:10:30 UTC (rev 743) +++ kos/kernel/fs/fs.c 2012-02-17 02:44:28 UTC (rev 744) @@ -134,7 +134,7 @@ /* Invoke the handler */ if (cur->open == NULL) { errno = ENOSYS; - return 0; + return NULL; } h = cur->open(cur, cname, mode); if (h == NULL) return NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2011-12-31 18:10:37
|
Revision: 743 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=743&view=rev Author: ljsebald Date: 2011-12-31 18:10:30 +0000 (Sat, 31 Dec 2011) Log Message: ----------- Binutils 2.21 seems to have disappeared from the GNU FTP site, so use 2.22 instead. Modified Paths: -------------- kos/utils/dc-chain/Makefile kos/utils/dc-chain/download.sh kos/utils/dc-chain/unpack.sh Modified: kos/utils/dc-chain/Makefile =================================================================== --- kos/utils/dc-chain/Makefile 2011-12-04 01:42:38 UTC (rev 742) +++ kos/utils/dc-chain/Makefile 2011-12-31 18:10:30 UTC (rev 743) @@ -28,7 +28,7 @@ kos_root=$(CURDIR)/../../.. # kos_base: equivalent of KOS_BASE (contains include/ and kernel/) kos_base=$(kos_root)/kos -binutils_ver=2.21 +binutils_ver=2.22 gcc_ver=4.5.2 newlib_ver=1.19.0 gdb_ver=6.7.1 Modified: kos/utils/dc-chain/download.sh =================================================================== --- kos/utils/dc-chain/download.sh 2011-12-04 01:42:38 UTC (rev 742) +++ kos/utils/dc-chain/download.sh 2011-12-31 18:10:30 UTC (rev 743) @@ -1,5 +1,5 @@ #!/bin/sh -wget -c ftp://ftp.gnu.org/gnu/binutils/binutils-2.21.tar.bz2 || exit 1 +wget -c ftp://ftp.gnu.org/gnu/binutils/binutils-2.22.tar.bz2 || exit 1 wget -c ftp://ftp.gnu.org/gnu/gcc/gcc-4.5.2/gcc-4.5.2.tar.bz2 || exit 1 wget -c ftp://sources.redhat.com/pub/newlib/newlib-1.19.0.tar.gz || exit 1 Modified: kos/utils/dc-chain/unpack.sh =================================================================== --- kos/utils/dc-chain/unpack.sh 2011-12-04 01:42:38 UTC (rev 742) +++ kos/utils/dc-chain/unpack.sh 2011-12-31 18:10:30 UTC (rev 743) @@ -1,7 +1,7 @@ #!/bin/sh -rm -rf binutils-2.21 gcc-4.5.2 newlib-1.19.0 +rm -rf binutils-2.22 gcc-4.5.2 newlib-1.19.0 -tar jxf binutils-2.21.tar.bz2 || exit 1 +tar jxf binutils-2.22.tar.bz2 || exit 1 tar jxf gcc-4.5.2.tar.bz2 || exit 1 tar zxf newlib-1.19.0.tar.gz || exit 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |