aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2011-01-25 20:41:50 +0100
committerErwan Velu <erwanaliasr1@gmail.com>2011-01-25 20:41:50 +0100
commit995558ff657a357b3e44a299525ff66dbb0300b3 (patch)
treeb6caeafa866311926705b2eba695fbd699220f60
parent2cb593ae927a80e856a255c9e484d16038033f62 (diff)
parent808d43ea43c9df30a0a6922ef4cb4678634d41ab (diff)
downloadsyslinux-995558ff657a357b3e44a299525ff66dbb0300b3.tar.gz
syslinux-995558ff657a357b3e44a299525ff66dbb0300b3.tar.xz
syslinux-995558ff657a357b3e44a299525ff66dbb0300b3.zip
Merge branch 'master' into chouffe
Conflicts: com32/hdt/hdt.h
-rw-r--r--.gitignore4
-rw-r--r--BUGS4
-rw-r--r--MCONFIG13
-rw-r--r--MCONFIG.build33
-rw-r--r--MCONFIG.devel2
-rw-r--r--MCONFIG.embedded30
-rw-r--r--Makefile15
-rw-r--r--Makefile.private3
-rw-r--r--NEWS140
-rw-r--r--README4
-rw-r--r--TODO22
-rwxr-xr-xcodepage/cptable.pl40
-rw-r--r--com32/MCONFIG38
-rw-r--r--com32/Makefile5
-rw-r--r--com32/cmenu/Makefile15
-rw-r--r--com32/cmenu/adv_menu.tpl4
-rw-r--r--com32/cmenu/complex.c4
-rw-r--r--com32/cmenu/libmenu/com32io.c11
-rw-r--r--com32/cmenu/libmenu/com32io.h2
-rw-r--r--com32/cmenu/libmenu/des.c7
-rw-r--r--com32/cmenu/libmenu/menu.c2
-rw-r--r--com32/cmenu/libmenu/passwords.h2
-rw-r--r--com32/cmenu/libmenu/syslnx.c2
-rw-r--r--com32/gfxboot/gfxboot.c113
-rw-r--r--com32/gplinclude/cpuid.h6
-rw-r--r--com32/gplinclude/dmi/dmi_memory.h8
-rw-r--r--com32/gpllib/cpuid.c4
-rw-r--r--com32/gpllib/disk/bootloaders.c6
-rw-r--r--com32/gpllib/disk/labels.c466
-rw-r--r--com32/gpllib/disk/mbrs.c48
-rw-r--r--com32/gpllib/disk/msdos.c4
-rw-r--r--com32/gpllib/dmi/dmi.c166
-rw-r--r--com32/gpllib/dmi/dmi_memory.c18
-rw-r--r--com32/gpllib/memory.c2
-rw-r--r--com32/gpllib/vpd/vpd.c14
-rw-r--r--com32/hdt/Makefile7
-rw-r--r--com32/hdt/floppy/hdt.cfg4
-rw-r--r--com32/hdt/hdt-cli-cpu.c2
-rw-r--r--com32/hdt/hdt-cli-hdt.c9
-rw-r--r--com32/hdt/hdt-cli-kernel.c2
-rw-r--r--com32/hdt/hdt-cli-pci.c4
-rw-r--r--com32/hdt/hdt-cli-pxe.c6
-rw-r--r--com32/hdt/hdt-cli.c29
-rw-r--r--com32/hdt/hdt-cli.h8
-rw-r--r--com32/hdt/hdt-common.c30
-rw-r--r--com32/hdt/hdt-common.h4
-rw-r--r--com32/hdt/hdt-menu.c7
-rw-r--r--com32/include/com32.h13
-rw-r--r--com32/include/dev.h1
-rw-r--r--com32/include/dirent.h18
-rw-r--r--com32/include/getopt.h22
-rw-r--r--com32/include/ilog2.h48
-rw-r--r--com32/include/netinet/in.h48
-rw-r--r--com32/include/png.h1899
-rw-r--r--com32/include/pngconf.h542
-rw-r--r--com32/include/string.h1
-rw-r--r--com32/include/sys/bitops.h58
-rw-r--r--com32/include/sys/cpu.h75
-rw-r--r--com32/include/sys/dirent.h45
-rw-r--r--com32/include/sys/times.h4
-rw-r--r--com32/include/syslinux/boot.h2
-rw-r--r--com32/include/syslinux/config.h11
-rw-r--r--com32/include/syslinux/idle.h1
-rw-r--r--com32/include/syslinux/pmapi.h79
-rw-r--r--com32/include/syslinux/pxe.h485
-rw-r--r--com32/include/syslinux/pxe_api.h571
-rw-r--r--com32/include/unistd.h7
-rw-r--r--com32/include/zconf.h281
-rw-r--r--com32/include/zlib.h1293
-rw-r--r--com32/lib/MCONFIG17
-rw-r--r--com32/lib/Makefile40
-rw-r--r--com32/lib/chdir.c10
-rw-r--r--com32/lib/closedir.c30
-rw-r--r--com32/lib/com32.ld68
-rw-r--r--com32/lib/fprintf.c2
-rw-r--r--com32/lib/getcwd.c23
-rw-r--r--com32/lib/getopt.c117
-rw-r--r--com32/lib/getopt_long.c152
-rw-r--r--com32/lib/libpng/ANNOUNCE77
-rw-r--r--com32/lib/libpng/CHANGES1325
-rw-r--r--com32/lib/libpng/KNOWNBUG33
-rw-r--r--com32/lib/libpng/LICENSE10
-rw-r--r--com32/lib/libpng/README123
-rw-r--r--com32/lib/libpng/TODO1
-rw-r--r--com32/lib/libpng/Y2KINFO4
-rw-r--r--com32/lib/libpng/example.c324
-rw-r--r--com32/lib/libpng/libpng.31083
-rw-r--r--com32/lib/libpng/libpng.txt2959
-rw-r--r--com32/lib/libpng/libpngpf.3562
-rw-r--r--com32/lib/libpng/png.59
-rw-r--r--com32/lib/libpng/png.c894
-rw-r--r--com32/lib/libpng/pngerror.c267
-rw-r--r--com32/lib/libpng/pnggccrd.c5381
-rw-r--r--com32/lib/libpng/pngget.c414
-rw-r--r--com32/lib/libpng/pngmem.c158
-rw-r--r--com32/lib/libpng/pngpread.c671
-rw-r--r--com32/lib/libpng/pngread.c910
-rw-r--r--com32/lib/libpng/pngrio.c85
-rw-r--r--com32/lib/libpng/pngrtran.c1426
-rw-r--r--com32/lib/libpng/pngrutil.c1458
-rw-r--r--com32/lib/libpng/pngset.c995
-rw-r--r--com32/lib/libpng/pngtest.c795
-rw-r--r--com32/lib/libpng/pngtrans.c153
-rw-r--r--com32/lib/libpng/pngvcrd.c3904
-rw-r--r--com32/lib/libpng/pngwio.c152
-rw-r--r--com32/lib/libpng/pngwrite.c810
-rw-r--r--com32/lib/libpng/pngwtran.c95
-rw-r--r--com32/lib/libpng/pngwutil.c1124
-rw-r--r--com32/lib/lmalloc.c57
-rw-r--r--com32/lib/lstrdup.c18
-rw-r--r--com32/lib/memmem.c45
-rw-r--r--com32/lib/memmove.S31
-rw-r--r--com32/lib/opendir.c41
-rw-r--r--com32/lib/pci/scan.c8
-rw-r--r--com32/lib/printf.c2
-rw-r--r--com32/lib/qsort.c4
-rw-r--r--com32/lib/readdir.c57
-rw-r--r--com32/lib/strpcpy.c20
-rw-r--r--com32/lib/strspn.c4
-rw-r--r--com32/lib/sys/entry.S60
-rw-r--r--com32/lib/sys/farcall.c15
-rw-r--r--com32/lib/sys/file.h18
-rw-r--r--com32/lib/sys/fileclose.c11
-rw-r--r--com32/lib/sys/fileread.c51
-rw-r--r--com32/lib/sys/fstat.c4
-rw-r--r--com32/lib/sys/gpxe.c25
-rw-r--r--com32/lib/sys/open.c26
-rw-r--r--com32/lib/sys/openmem.c61
-rw-r--r--com32/lib/sys/readdir.c30
-rw-r--r--com32/lib/sys/sleep.c22
-rw-r--r--com32/lib/sys/stdcon_write.c19
-rw-r--r--com32/lib/sys/times.c8
-rw-r--r--com32/lib/sys/vesa/background.c4
-rw-r--r--com32/lib/sys/vesa/initvesa.c52
-rw-r--r--com32/lib/sys/vesa/screencpy.c7
-rw-r--r--com32/lib/sys/zfile.c8
-rw-r--r--com32/lib/syslinux/idle.c24
-rw-r--r--com32/lib/syslinux/memscan.c9
-rw-r--r--com32/lib/syslinux/pxe_dns.c13
-rw-r--r--com32/lib/syslinux/pxe_get_cached.c37
-rw-r--r--com32/lib/syslinux/pxe_get_nic.c14
-rw-r--r--com32/lib/syslinux/run_command.c17
-rw-r--r--com32/lib/syslinux/runimage.c27
-rw-r--r--com32/lib/vdprintf.c84
-rw-r--r--com32/lib/vsscanf.c25
-rw-r--r--com32/lib/zlib/FAQ347
-rw-r--r--com32/lib/zlib/README89
-rw-r--r--com32/lib/zlib/adler32.c136
-rw-r--r--com32/lib/zlib/compress.c6
-rw-r--r--com32/lib/zlib/crc32.c202
-rw-r--r--com32/lib/zlib/deflate.c495
-rw-r--r--com32/lib/zlib/deflate.h49
-rw-r--r--com32/lib/zlib/infback.c105
-rw-r--r--com32/lib/zlib/inffast.c95
-rw-r--r--com32/lib/zlib/inffast.h4
-rw-r--r--com32/lib/zlib/inflate.c382
-rw-r--r--com32/lib/zlib/inflate.h37
-rw-r--r--com32/lib/zlib/inftrees.c69
-rw-r--r--com32/lib/zlib/inftrees.h27
-rw-r--r--com32/lib/zlib/trees.c138
-rw-r--r--com32/lib/zlib/trees.h5
-rw-r--r--com32/lib/zlib/uncompr.c5
-rw-r--r--com32/lib/zlib/zlib.366
-rw-r--r--com32/lib/zlib/zutil.c68
-rw-r--r--com32/lib/zlib/zutil.h67
-rw-r--r--com32/libutil/get_key.c2
-rw-r--r--com32/libutil/sha256crypt.c12
-rw-r--r--com32/libutil/sha512crypt.c10
-rw-r--r--com32/lua/COPYRIGHT34
-rw-r--r--com32/lua/HISTORY183
-rw-r--r--com32/lua/INSTALL99
-rw-r--r--com32/lua/Makefile-orig120
-rw-r--r--com32/lua/README37
-rw-r--r--com32/lua/doc/amazon.gifbin0 -> 797 bytes
-rw-r--r--com32/lua/doc/contents.html499
-rw-r--r--com32/lua/doc/cover.pngbin0 -> 3305 bytes
-rw-r--r--com32/lua/doc/logo.gifbin0 -> 4232 bytes
-rw-r--r--com32/lua/doc/lua.1163
-rw-r--r--com32/lua/doc/lua.css41
-rw-r--r--com32/lua/doc/lua.html172
-rw-r--r--com32/lua/doc/luac.1136
-rw-r--r--com32/lua/doc/luac.html145
-rw-r--r--com32/lua/doc/manual.css13
-rw-r--r--com32/lua/doc/manual.html8764
-rw-r--r--com32/lua/doc/readme.html40
-rw-r--r--com32/lua/doc/syslinux.asc286
-rw-r--r--com32/lua/etc/Makefile44
-rw-r--r--com32/lua/etc/README37
-rw-r--r--com32/lua/etc/all.c38
-rw-r--r--com32/lua/etc/lua.hpp9
-rw-r--r--com32/lua/etc/lua.icobin0 -> 1078 bytes
-rw-r--r--com32/lua/etc/lua.pc31
-rw-r--r--com32/lua/etc/luavs.bat28
-rw-r--r--com32/lua/etc/min.c39
-rw-r--r--com32/lua/etc/noparser.c50
-rw-r--r--com32/lua/etc/strict.lua41
-rw-r--r--com32/lua/src/Makefile71
-rw-r--r--com32/lua/src/Makefile-orig182
-rw-r--r--com32/lua/src/dmi.c301
-rw-r--r--com32/lua/src/lapi.c1085
-rw-r--r--com32/lua/src/lapi.h16
-rw-r--r--com32/lua/src/lauxlib.c656
-rw-r--r--com32/lua/src/lauxlib.h174
-rw-r--r--com32/lua/src/lbaselib.c651
-rw-r--r--com32/lua/src/lcode.c839
-rw-r--r--com32/lua/src/lcode.h76
-rw-r--r--com32/lua/src/ldblib.c397
-rw-r--r--com32/lua/src/ldebug.c622
-rw-r--r--com32/lua/src/ldebug.h33
-rw-r--r--com32/lua/src/ldo.c518
-rw-r--r--com32/lua/src/ldo.h57
-rw-r--r--com32/lua/src/ldump.c164
-rw-r--r--com32/lua/src/lfunc.c174
-rw-r--r--com32/lua/src/lfunc.h34
-rw-r--r--com32/lua/src/lgc.c711
-rw-r--r--com32/lua/src/lgc.h110
-rw-r--r--com32/lua/src/linit.c44
-rw-r--r--com32/lua/src/liolib.c560
-rw-r--r--com32/lua/src/llex.c461
-rw-r--r--com32/lua/src/llex.h81
-rw-r--r--com32/lua/src/llimits.h128
-rw-r--r--com32/lua/src/lmathlib.c265
-rw-r--r--com32/lua/src/lmem.c86
-rw-r--r--com32/lua/src/lmem.h49
-rw-r--r--com32/lua/src/loadlib.c665
-rw-r--r--com32/lua/src/lobject.c214
-rw-r--r--com32/lua/src/lobject.h381
-rw-r--r--com32/lua/src/lopcodes.c102
-rw-r--r--com32/lua/src/lopcodes.h268
-rw-r--r--com32/lua/src/loslib.c247
-rw-r--r--com32/lua/src/lparser.c1339
-rw-r--r--com32/lua/src/lparser.h82
-rw-r--r--com32/lua/src/lstate.c214
-rw-r--r--com32/lua/src/lstate.h169
-rw-r--r--com32/lua/src/lstring.c111
-rw-r--r--com32/lua/src/lstring.h31
-rw-r--r--com32/lua/src/lstrlib.c870
-rw-r--r--com32/lua/src/ltable.c588
-rw-r--r--com32/lua/src/ltable.h40
-rw-r--r--com32/lua/src/ltablib.c279
-rw-r--r--com32/lua/src/ltm.c75
-rw-r--r--com32/lua/src/ltm.h54
-rw-r--r--com32/lua/src/lua.c396
-rw-r--r--com32/lua/src/lua.h391
-rw-r--r--com32/lua/src/luac.c200
-rw-r--r--com32/lua/src/luaconf.h817
-rw-r--r--com32/lua/src/lualib.h65
-rw-r--r--com32/lua/src/lundump.c225
-rw-r--r--com32/lua/src/lundump.h36
-rw-r--r--com32/lua/src/lvm.c783
-rw-r--r--com32/lua/src/lvm.h36
-rw-r--r--com32/lua/src/lzio.c82
-rw-r--r--com32/lua/src/lzio.h67
-rw-r--r--com32/lua/src/pci.c183
-rw-r--r--com32/lua/src/print.c227
-rw-r--r--com32/lua/src/syslinux.c472
-rw-r--r--com32/lua/src/vesa.c148
-rw-r--r--com32/lua/test/README26
-rw-r--r--com32/lua/test/bisect.lua27
-rw-r--r--com32/lua/test/cf.lua16
-rw-r--r--com32/lua/test/dmi.lua21
-rw-r--r--com32/lua/test/echo.lua5
-rw-r--r--com32/lua/test/env.lua7
-rw-r--r--com32/lua/test/factorial.lua32
-rw-r--r--com32/lua/test/fib.lua40
-rw-r--r--com32/lua/test/fibfor.lua13
-rw-r--r--com32/lua/test/globals.lua13
-rw-r--r--com32/lua/test/hello.lua3
-rw-r--r--com32/lua/test/life.lua111
-rw-r--r--com32/lua/test/luac.lua7
-rw-r--r--com32/lua/test/pci.lua34
-rw-r--r--com32/lua/test/printf.lua7
-rw-r--r--com32/lua/test/readonly.lua12
-rw-r--r--com32/lua/test/sieve.lua29
-rw-r--r--com32/lua/test/sort.lua66
-rw-r--r--com32/lua/test/syslinux-derivative.lua38
-rw-r--r--com32/lua/test/syslinux.lua1
-rw-r--r--com32/lua/test/table.lua12
-rw-r--r--com32/lua/test/trace-calls.lua32
-rw-r--r--com32/lua/test/trace-globals.lua38
-rw-r--r--com32/lua/test/vesa.lua55
-rw-r--r--com32/lua/test/xd.lua14
-rw-r--r--com32/mboot/map.c33
-rw-r--r--com32/mboot/mboot.c2
-rw-r--r--com32/mboot/mboot.h8
-rw-r--r--com32/menu/menu.h4
-rw-r--r--com32/menu/menumain.c31
-rw-r--r--com32/menu/readconfig.c45
-rw-r--r--com32/modules/Makefile4
-rw-r--r--com32/modules/chain.c1308
-rw-r--r--com32/modules/config.c7
-rw-r--r--com32/modules/cpuid.c2
-rw-r--r--com32/modules/disk.c7
-rw-r--r--com32/modules/elf.c8
-rw-r--r--com32/modules/host.c42
-rw-r--r--com32/modules/ifcpu.c98
-rw-r--r--com32/modules/ifcpu64.c9
-rw-r--r--com32/modules/ifplop.c170
-rw-r--r--com32/modules/ls.c177
-rw-r--r--com32/modules/pcitest.c3
-rw-r--r--com32/modules/pmload.c8
-rw-r--r--com32/modules/pwd.c51
-rw-r--r--com32/modules/sdi.c9
-rw-r--r--com32/modules/vpdtest.c1
-rw-r--r--com32/modules/whichsys.c128
-rw-r--r--com32/rosh/Makefile20
-rw-r--r--com32/rosh/rosh.c1311
-rw-r--r--com32/rosh/rosh.h216
-rw-r--r--com32/sysdump/acpi.c259
-rw-r--r--com32/sysdump/backend.h1
-rw-r--r--com32/sysdump/be_srec.c85
-rw-r--r--com32/sysdump/be_tftp.c53
-rw-r--r--com32/sysdump/cpuid.c29
-rw-r--r--com32/sysdump/ctime.c7
-rw-r--r--com32/sysdump/main.c2
-rw-r--r--com32/sysdump/memmap.c6
-rw-r--r--com32/sysdump/rbtree.c132
-rw-r--r--com32/sysdump/rbtree.h53
-rw-r--r--com32/sysdump/sysdump.h1
-rw-r--r--com32/sysdump/vesa.c7
-rw-r--r--com32/tools/.gitignore1
-rw-r--r--com32/tools/Makefile30
-rw-r--r--com32/tools/relocs.c693
-rw-r--r--core/Makefile86
-rw-r--r--core/abort.inc6
-rw-r--r--core/adv.inc58
-rw-r--r--core/bcopy32.inc297
-rw-r--r--core/bcopyxx.inc57
-rw-r--r--core/bios.inc8
-rw-r--r--core/bootsect.inc14
-rw-r--r--core/cache.inc114
-rw-r--r--core/call16.c41
-rw-r--r--core/callback.inc215
-rwxr-xr-xcore/checksumiso.pl51
-rw-r--r--core/cleanup.inc7
-rw-r--r--core/cmdline.inc11
-rw-r--r--core/codepage.S5
-rw-r--r--core/com32.inc431
-rw-r--r--core/comboot.inc214
-rw-r--r--core/common.inc25
-rw-r--r--core/config.inc5
-rw-r--r--core/configinit.inc2
-rw-r--r--core/conio.inc17
-rw-r--r--core/console.c22
-rw-r--r--core/cpuinit.inc99
-rw-r--r--core/diskboot.inc444
-rw-r--r--core/diskfs.inc173
-rw-r--r--core/diskstart.inc662
-rw-r--r--core/dnsresolv.inc389
-rw-r--r--core/ext2_fs.inc183
-rw-r--r--core/extern.inc32
-rw-r--r--core/extlinux.asm931
-rw-r--r--core/font.inc6
-rw-r--r--core/fs/btrfs/btrfs.c674
-rw-r--r--core/fs/btrfs/btrfs.h292
-rw-r--r--core/fs/btrfs/crc32c.h50
-rw-r--r--core/fs/cache.c125
-rw-r--r--core/fs/chdir.c103
-rw-r--r--core/fs/diskio.c419
-rw-r--r--core/fs/ext2/bmap.c228
-rw-r--r--core/fs/ext2/ext2.c335
-rw-r--r--core/fs/ext2/ext2_fs.h310
-rw-r--r--core/fs/fat/fat.c795
-rw-r--r--core/fs/fat/fat_fs.h158
-rw-r--r--core/fs/fs.c477
-rw-r--r--core/fs/getcwd.c13
-rw-r--r--core/fs/getfssec.c194
-rw-r--r--core/fs/iso9660/iso9660.c348
-rw-r--r--core/fs/iso9660/iso9660_fs.h51
-rw-r--r--core/fs/lib/close.c9
-rw-r--r--core/fs/lib/loadconfig.c34
-rw-r--r--core/fs/lib/mangle.c49
-rw-r--r--core/fs/lib/searchconfig.c40
-rw-r--r--core/fs/loadhigh.c112
-rw-r--r--core/fs/newconfig.c41
-rw-r--r--core/fs/nonextextent.c13
-rw-r--r--core/fs/pxe/dhcp_option.c258
-rw-r--r--core/fs/pxe/dnsresolv.c349
-rw-r--r--core/fs/pxe/idle.c112
-rw-r--r--core/fs/pxe/portnum.c68
-rw-r--r--core/fs/pxe/pxe.c1745
-rw-r--r--core/fs/pxe/pxe.h252
-rw-r--r--core/fs/readdir.c57
-rw-r--r--core/getc.inc22
-rw-r--r--core/graphics.inc6
-rw-r--r--core/head.inc6
-rw-r--r--core/highmem.inc6
-rw-r--r--core/idle.c49
-rw-r--r--core/idle.inc47
-rw-r--r--core/include/cache.h23
-rw-r--r--core/include/codepage.h27
-rw-r--r--core/include/core.h91
-rw-r--r--core/include/ctype.h25
-rw-r--r--core/include/disk.h37
-rw-r--r--core/include/fs.h227
-rw-r--r--core/include/pmapi.h8
-rw-r--r--core/init.inc118
-rw-r--r--core/isolinux.asm669
-rw-r--r--core/kaboom.c16
-rw-r--r--core/kernel.inc3
-rw-r--r--core/keywords1
-rw-r--r--core/keywords.inc3
-rw-r--r--core/layout.inc91
-rw-r--r--core/ldlinux.asm1416
-rw-r--r--core/loadhigh.inc78
-rw-r--r--core/localboot.inc9
-rw-r--r--core/lzo/enter.ash89
-rw-r--r--core/lzo/leave.ash114
-rw-r--r--core/lzo/lzo1c_d.ash184
-rw-r--r--core/lzo/lzo1f_d.ash176
-rw-r--r--core/lzo/lzo1x_d.ash401
-rw-r--r--core/lzo/lzo1x_f1.S63
-rw-r--r--core/lzo/lzo_asm.h287
-rw-r--r--core/macros.inc2
-rw-r--r--core/mem/free.c154
-rw-r--r--core/mem/init.c38
-rw-r--r--core/mem/malloc.c99
-rw-r--r--core/mem/malloc.h82
-rw-r--r--core/parsecmd.inc19
-rw-r--r--core/parseconfig.inc35
-rw-r--r--core/plaincon.inc2
-rw-r--r--core/pm.inc450
-rw-r--r--core/pmapi.c43
-rw-r--r--core/pmcall.inc70
-rw-r--r--core/prefix.inc17
-rw-r--r--core/printf.c20
-rw-r--r--core/pxeidle.inc122
-rw-r--r--core/pxelinux.asm2694
-rw-r--r--core/rllpack.c105
-rw-r--r--core/rllpack.inc164
-rw-r--r--core/runkernel.inc51
-rw-r--r--core/serirq.inc24
-rw-r--r--core/stack.inc20
-rw-r--r--core/strcasecmp.c11
-rw-r--r--core/strcpy.inc2
-rw-r--r--core/strecpy.inc28
-rw-r--r--core/strncasecmp.c24
-rw-r--r--core/syslinux.ld321
-rw-r--r--core/timer.inc57
-rw-r--r--core/ui.inc59
-rw-r--r--core/writedec.inc7
-rw-r--r--core/writehex.inc1
-rw-r--r--core/writestr.inc1
-rw-r--r--doc/comboot.txt159
-rw-r--r--doc/extlinux.txt8
-rw-r--r--doc/gpt.txt53
-rw-r--r--doc/memdisk.txt6
-rw-r--r--doc/menu.txt22
-rw-r--r--doc/syslinux.txt34
-rw-r--r--dos/Makefile34
-rw-r--r--dos/argv.c4
-rw-r--r--dos/com16.ld130
-rw-r--r--dos/crt0.S29
-rw-r--r--dos/ctype.h3
-rw-r--r--dos/dosexe.ld133
-rw-r--r--dos/errno.h35
-rw-r--r--dos/getsetsl.c117
-rw-r--r--dos/header.S54
-rw-r--r--dos/int2526.S2
-rw-r--r--dos/ldlinux.S19
-rw-r--r--dos/malloc.c32
-rw-r--r--dos/memmove.S36
-rw-r--r--dos/stdio.h2
-rw-r--r--dos/stdlib.h4
-rw-r--r--dos/strchr.c17
-rw-r--r--dos/string.h3
-rw-r--r--dos/strntoumax.c73
-rw-r--r--dos/strtoul.c15
-rw-r--r--dos/sysexits.h1
-rw-r--r--dos/syslinux.c206
-rw-r--r--dosutil/eltorito.asm15
-rw-r--r--dosutil/mdiskchk.c254
-rw-r--r--dosutil/mdiskchk.combin7273 -> 8106 bytes
-rw-r--r--extlinux/Makefile10
-rw-r--r--extlinux/btrfs.h22
-rw-r--r--extlinux/ext2_fs.h497
-rw-r--r--extlinux/fat.h7
-rwxr-xr-x[-rw-r--r--]extlinux/main.c1066
-rw-r--r--libfat/libfat.h2
-rw-r--r--libfat/open.c6
-rw-r--r--libinstaller/Makefile9
-rw-r--r--libinstaller/advio.c162
-rwxr-xr-xlibinstaller/bin2c.pl4
-rw-r--r--libinstaller/fat.c129
-rw-r--r--libinstaller/getopt/getopt.h25
-rw-r--r--libinstaller/getopt/getopt_long.c152
-rw-r--r--libinstaller/linux/fiemap.h68
-rw-r--r--libinstaller/linux/loop.h96
-rw-r--r--libinstaller/linuxioctl.h47
-rw-r--r--libinstaller/setadv.c20
-rw-r--r--libinstaller/setadv.h16
-rw-r--r--libinstaller/syslinux.h37
-rw-r--r--libinstaller/syslxcom.c286
-rw-r--r--libinstaller/syslxcom.h22
-rw-r--r--libinstaller/syslxint.h222
-rw-r--r--libinstaller/syslxmod.c339
-rw-r--r--libinstaller/syslxopt.c267
-rw-r--r--libinstaller/syslxopt.h43
-rw-r--r--linux/Makefile9
-rwxr-xr-x[-rw-r--r--]linux/syslinux.c303
-rw-r--r--lzo/.gitignore1
-rw-r--r--lzo/LZO.TXT291
-rw-r--r--lzo/Makefile39
-rw-r--r--lzo/include/lzo/lzo1.h96
-rw-r--r--lzo/include/lzo/lzo1a.h96
-rw-r--r--lzo/include/lzo/lzo1b.h160
-rw-r--r--lzo/include/lzo/lzo1c.h160
-rw-r--r--lzo/include/lzo/lzo1f.h108
-rw-r--r--lzo/include/lzo/lzo1x.h177
-rw-r--r--lzo/include/lzo/lzo1y.h145
-rw-r--r--lzo/include/lzo/lzo1z.h150
-rw-r--r--lzo/include/lzo/lzo2a.h92
-rw-r--r--lzo/include/lzo/lzo_asm.h139
-rw-r--r--lzo/include/lzo/lzoconf.h417
-rw-r--r--lzo/include/lzo/lzodefs.h1807
-rw-r--r--lzo/include/lzo/lzoutil.h73
-rw-r--r--lzo/prepcore.c385
-rw-r--r--lzo/src/compr1b.h81
-rw-r--r--lzo/src/compr1c.h81
-rw-r--r--lzo/src/config1x.h118
-rw-r--r--lzo/src/lzo1_d.ch155
-rw-r--r--lzo/src/lzo1x_1.c50
-rw-r--r--lzo/src/lzo1x_1k.c50
-rw-r--r--lzo/src/lzo1x_1l.c50
-rw-r--r--lzo/src/lzo1x_1o.c50
-rw-r--r--lzo/src/lzo1x_9x.c881
-rw-r--r--lzo/src/lzo1x_c.ch351
-rw-r--r--lzo/src/lzo1x_d.ch466
-rw-r--r--lzo/src/lzo1x_d1.c46
-rw-r--r--lzo/src/lzo1x_d2.c46
-rw-r--r--lzo/src/lzo1x_d3.c108
-rw-r--r--lzo/src/lzo1x_o.c45
-rw-r--r--lzo/src/lzo1x_oo.ch366
-rw-r--r--lzo/src/lzo_conf.h323
-rw-r--r--lzo/src/lzo_crc.c167
-rw-r--r--lzo/src/lzo_dict.h316
-rw-r--r--lzo/src/lzo_dll.ch64
-rw-r--r--lzo/src/lzo_init.c176
-rw-r--r--lzo/src/lzo_mchw.ch242
-rw-r--r--lzo/src/lzo_ptr.c92
-rw-r--r--lzo/src/lzo_ptr.h154
-rw-r--r--lzo/src/lzo_str.c71
-rw-r--r--lzo/src/lzo_swd.ch707
-rw-r--r--lzo/src/lzo_util.c165
-rw-r--r--lzo/src/miniacc.h6553
-rw-r--r--lzo/src/stats1a.h137
-rw-r--r--lzo/src/stats1b.h142
-rw-r--r--lzo/src/stats1c.h61
-rw-r--r--man/extlinux.15
-rw-r--r--man/syslinux.185
-rw-r--r--mbr/altmbr.S2
-rwxr-xr-xmbr/checksize.pl2
-rw-r--r--mbr/gptmbr.S67
-rw-r--r--mbr/isohdpfx.S11
-rw-r--r--mbr/mbr.S2
-rw-r--r--memdisk/Makefile2
-rw-r--r--memdisk/acpi.h3
-rw-r--r--memdisk/compiler.h9
-rw-r--r--memdisk/eltorito.h29
-rw-r--r--memdisk/memdisk.inc15
-rw-r--r--memdisk/mstructs.h178
-rw-r--r--memdisk/setup.c225
-rw-r--r--memdisk/unzip.c2
-rw-r--r--modules/Makefile2
-rw-r--r--modules/gfxboot.asm1084
-rw-r--r--modules/ver.asm606
-rwxr-xr-x[-rw-r--r--]mtools/Makefile3
-rwxr-xr-x[-rw-r--r--]mtools/syslinux.c164
-rw-r--r--sample/Makefile34
-rw-r--r--sample/README6
-rw-r--r--sample/atou.c12
-rw-r--r--sample/c32echo.c47
-rw-r--r--sample/c32entry.S66
-rw-r--r--sample/c32exit.S10
-rw-r--r--sample/comecho.asm32
-rw-r--r--sample/conio.c59
-rw-r--r--sample/fd.c59
-rw-r--r--sample/filetest.c97
-rw-r--r--sample/hello.c43
-rw-r--r--sample/hello2.c58
-rw-r--r--sample/printf.c316
-rw-r--r--sample/skipatou.c13
-rw-r--r--utils/Makefile9
-rw-r--r--utils/isohybrid.c20
-rw-r--r--utils/memdiskfind.c168
-rw-r--r--version2
-rw-r--r--win/hello.c (renamed from win32/hello.c)0
-rw-r--r--win/sysexits.h1
-rw-r--r--win/syslinux.c (renamed from win32/syslinux.c)156
-rw-r--r--win32/Makefile35
-rw-r--r--win32/README6
-rwxr-xr-xwin32/find-mingw32.sh (renamed from win32/find-mingw.sh)1
-rw-r--r--win64/Makefile92
-rw-r--r--win64/README10
-rwxr-xr-xwin64/find-mingw64.sh24
595 files changed, 84452 insertions, 34845 deletions
diff --git a/.gitignore b/.gitignore
index ff19a5e5..cece7b5f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,13 +9,16 @@
*.elf
*.exe
*.gen
+*.lib
*.lnx
*.lo
*.lsr
*.lst
*.map
*.o
+*.obj
*.orig
+*.raw
*.rej
*.s
*.sec
@@ -37,6 +40,7 @@
/utils/isohdpfx.c
/utils/isohybrid
/utils/isohybrid.pl
+/utils/memdiskfind
/utils/mkdiskimage
/version.h
/version.mk
diff --git a/BUGS b/BUGS
deleted file mode 100644
index 9639da80..00000000
--- a/BUGS
+++ /dev/null
@@ -1,4 +0,0 @@
-Known bugs that have not yet been fixed:
-
-- PXELINUX: Some PXE stacks fail with routing enabled, some with
- routing disabled. Try both?
diff --git a/MCONFIG b/MCONFIG
index e9c16d38..c76b5917 100644
--- a/MCONFIG
+++ b/MCONFIG
@@ -32,15 +32,17 @@ BOOTDIR = /boot
EXTLINUXDIR = $(BOOTDIR)/extlinux
NASM = nasm
-NASMOPT = -O9999
+NASMOPT = -Ox
PERL = perl
+UPX = upx
CHMOD = chmod
CC = gcc
gcc_ok = $(shell tmpf=gcc_ok.$$$$.tmp; \
- if $(CC) $(1) -c $(topdir)/dummy.c -o $$tmpf 2>/dev/null ; \
+ if $(CC) $(GCCOPT) $(1) -c $(topdir)/dummy.c \
+ -o $$tmpf 2>/dev/null ; \
then echo '$(1)'; else echo '$(2)'; fi; \
rm -f $$tmpf)
@@ -71,3 +73,10 @@ MAKEDEPS = -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d
# Dependencies that exclude system headers; use whenever we use
# header files from the platform.
UMAKEDEPS = -Wp,-MT,$@,-MMD,$(dir $@).$(notdir $@).d
+
+# Items that are only appropriate during development; this file is
+# removed when tarballs are generated.
+-include $(topdir)/MCONFIG.devel
+
+# Local additions, like -DDEBUG can go here
+-include $(topdir)/MCONFIG.local
diff --git a/MCONFIG.build b/MCONFIG.build
new file mode 100644
index 00000000..d1abff2a
--- /dev/null
+++ b/MCONFIG.build
@@ -0,0 +1,33 @@
+## -*- makefile -*- ------------------------------------------------------
+##
+## Copyright 2001-2008 H. Peter Anvin - All Rights Reserved
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+## Boston MA 02111-1307, USA; either version 2 of the License, or
+## (at your option) any later version; incorporated herein by reference.
+##
+## -----------------------------------------------------------------------
+
+##
+## Right now we don't distinguish between "build" system and the "host"
+## system, although we really should...
+##
+include $(topdir)/MCONFIG
+
+OPTFLAGS = -g -Os
+INCLUDES =
+CFLAGS = -W -Wall -Wno-sign-compare -D_FILE_OFFSET_BITS=64 \
+ $(OPTFLAGS) $(INCLUDES)
+LDFLAGS =
+LIBS =
+
+.SUFFIXES: .c .o .S .s .i .elf .com .bin .asm .lst .c32 .lss
+
+%.o: %.c
+ $(CC) $(UMAKEDEPS) $(CFLAGS) -c -o $@ $<
+%.i: %.c
+ $(CC) $(UMAKEDEPS) $(CFLAGS) -E -o $@ $<
+%.s: %.c
+ $(CC) $(UMAKEDEPS) $(CFLAGS) -S -o $@ $<
diff --git a/MCONFIG.devel b/MCONFIG.devel
new file mode 100644
index 00000000..104207f5
--- /dev/null
+++ b/MCONFIG.devel
@@ -0,0 +1,2 @@
+# Useful while doing development, but not for production.
+GCCWARN += -Wno-clobbered -Werror
diff --git a/MCONFIG.embedded b/MCONFIG.embedded
index 4b42e0da..9f5846d7 100644
--- a/MCONFIG.embedded
+++ b/MCONFIG.embedded
@@ -16,22 +16,30 @@
include $(topdir)/MCONFIG
-GCCOPT := $(call gcc_ok,-m32,) \
- $(call gcc_ok,-ffreestanding,) \
- $(call gcc_ok,-fno-stack-protector,) \
- $(call gcc_ok,-falign-functions=0,-malign-functions=0) \
- $(call gcc_ok,-falign-jumps=0,-malign-jumps=0) \
- $(call gcc_ok,-falign-loops=0,-malign-loops=0) \
- $(call gcc_ok,-mpreferred-stack-boundary=2,) \
- $(call gcc_ok,-mincoming-stack-boundary=2,) \
- -march=i386 -Os -fomit-frame-pointer -mregparm=3 -DREGPARM=3 \
+GCCOPT := $(call gcc_ok,-m32,)
+GCCOPT += $(call gcc_ok,-ffreestanding,)
+GCCOPT += $(call gcc_ok,-fno-stack-protector,)
+GCCOPT += $(call gcc_ok,-fwrapv,)
+GCCOPT += $(call gcc_ok,-freg-struct-return,)
+GCCOPT += -march=i386 -Os -fomit-frame-pointer -mregparm=3 -DREGPARM=3 \
-msoft-float
+GCCOPT += $(call gcc_ok,-fno-exceptions,)
+GCCOPT += $(call gcc_ok,-fno-asynchronous-unwind-tables,)
+GCCOPT += $(call gcc_ok,-fno-strict-aliasing,)
+GCCOPT += $(call gcc_ok,-falign-functions=0,-malign-functions=0)
+GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0)
+GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0)
+GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0)
+GCCOPT += $(call gcc_ok,-mpreferred-stack-boundary=2,)
+GCCOPT += $(call gcc_ok,-mincoming-stack-boundary=2,)
LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc)
LD += -m elf_i386
-CFLAGS = $(GCCOPT) -g $(GCCWARN) -Wno-sign-compare $(OPTFLAGS) $(INCLUDES)
-SFLAGS = $(CFLAGS) -D__ASSEMBLY__
+
+# Note: use += for CFLAGS and SFLAGS in case something is set in MCONFIG.local
+CFLAGS += $(GCCOPT) -g $(GCCWARN) -Wno-sign-compare $(OPTFLAGS) $(INCLUDES)
+SFLAGS += $(CFLAGS) -D__ASSEMBLY__
.SUFFIXES: .c .o .S .s .i .elf .com .bin .asm .lst .c32 .lss
diff --git a/Makefile b/Makefile
index 2393faa6..da90cdc4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
## -----------------------------------------------------------------------
##
## Copyright 1998-2009 H. Peter Anvin - All Rights Reserved
-## Copyright 2009 Intel Corporation; author: H. Peter Anvin
+## Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ include $(topdir)/MCONFIG
MODULES = memdisk/memdisk memdump/memdump.com modules/*.com \
com32/menu/*.c32 com32/modules/*.c32 com32/mboot/*.c32 \
com32/hdt/*.c32 com32/rosh/*.c32 com32/gfxboot/*.c32 \
- com32/sysdump/*.c32
+ com32/sysdump/*.c32 com32/lua/src/*.c32
# syslinux.exe is BTARGET so as to not require everyone to have the
# mingw suite installed
@@ -43,7 +43,8 @@ BOBJECTS = $(BTARGET) \
mbr/mbr_c.bin mbr/altmbr_c.bin mbr/gptmbr_c.bin \
mbr/mbr_f.bin mbr/altmbr_f.bin mbr/gptmbr_f.bin \
core/pxelinux.0 core/isolinux.bin core/isolinux-debug.bin \
- gpxe/gpxelinux.0 dos/syslinux.com win32/syslinux.exe \
+ gpxe/gpxelinux.0 dos/syslinux.com \
+ win32/syslinux.exe win64/syslinux64.exe \
dosutil/*.com dosutil/*.sys \
$(MODULES)
@@ -53,8 +54,8 @@ BOBJECTS = $(BTARGET) \
# Note: libinstaller is both a BSUBDIR and an ISUBDIR. It contains
# files that depend only on the B phase, but may have to be regenerated
# for "make installer".
-BSUBDIRS = codepage core memdisk modules com32 mbr memdump gpxe sample \
- libinstaller dos win32 dosutil
+BSUBDIRS = codepage com32 lzo core memdisk modules mbr memdump gpxe sample \
+ libinstaller dos win32 win64 dosutil
ITARGET =
IOBJECTS = $(ITARGET) \
utils/gethostip utils/isohybrid utils/mkdiskimage \
@@ -68,9 +69,9 @@ INSTALL_SBIN = extlinux/extlinux
# Things to install in /usr/lib/syslinux
INSTALL_AUX = core/pxelinux.0 gpxe/gpxelinux.0 core/isolinux.bin \
core/isolinux-debug.bin \
- dos/syslinux.com win32/syslinux.exe \
+ dos/syslinux.com \
mbr/*.bin $(MODULES)
-INSTALL_AUX_OPT = win32/syslinux.exe
+INSTALL_AUX_OPT = win32/syslinux.exe win64/syslinux64.exe
# These directories manage their own installables
INSTALLSUBDIRS = com32 utils dosutil
diff --git a/Makefile.private b/Makefile.private
index ab9fee21..c70c204d 100644
--- a/Makefile.private
+++ b/Makefile.private
@@ -17,7 +17,8 @@
#
.PHONY: official release
-PRIVATE = Makefile.private
+# These files are removed when tarballs are generated.
+PRIVATE = Makefile.private MCONFIG.devel
GIT_DIR ?= .git
ABS_GIT_DIR := $(shell cd '$(GIT_DIR)' 2>/dev/null && pwd)
diff --git a/NEWS b/NEWS
index 83761e22..613d99d2 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,146 @@ Starting with 1.47, changes marked with SYSLINUX, PXELINUX, ISOLINUX
or EXTLINUX apply to that specific program only; other changes apply
to all derivatives.
+Changes in 4.04:
+ * PXELINUX: Fix handling of unqualified DNS names.
+ * PXELINUX: Fix timer bug when PXELINUX might be unloaded
+ (Gene Cumm).
+ * core/writedec.inc: Fix duplicate declaration and overflow
+ (Gene Cumm).
+ * GCC 4.5 fixes.
+ * sample directory: Fix Makefile include (Gene Cumm).
+ * ver.com: New universal DOS/COMBOOT application to display
+ version information (includes DRMK) (Gene Cumm).
+ * rosh.c32: updated; Using getopt() for internal commands to aid
+ parsing options; Fix bugs in ls; add warm reboot and echo
+ (Gene Cumm).
+ * com32: fix a file descriptor leak.
+ * gfxboot.c32: handle TEXT..ENDTEXT; error out on no LABELs
+ found (Sebastian Herbszt).
+ * Fix booting on non-partitioned devices.
+ * MBR, isohybrid: Workaround for a BIOS issue on Acer
+ Travelmate and possibly other machines.
+
+Changes in 4.03:
+ * Don't hang if no configuration file is found.
+ * Better support for booting from MBRs which don't pass
+ handover information.
+ * EXTLINUX: Try to be smarter about finding the partition
+ offset.
+ * chain.c32: support chainloading Dell Real Mode Kernel (Gene
+ Cumm).
+ * chain.c32: fix booting in CHS mode.
+ * rosh.c32 updated (Gene Cumm).
+ * Fix the -s option to the syslinux/extlinux installer (Arwin
+ Vosselman).
+ * isohybrid: fix padding of large images (PJ Pandit).
+
+Changes in 4.02:
+ * SYSLINUX: correctly handle the case where the -d option is
+ specified with a non-absolute path, i.e. "syslinux -d
+ syslinux" instead of "syslinux -d /syslinux".
+ * ISOLINUX: recognize the directory names /boot/syslinux and
+ /syslinux, and the filename syslinux.cfg in addition to the
+ isolinux-specific names. Thus, "syslinux.cfg" is now a
+ generic name, whereas "isolinux.cfg" or "extlinux.conf" is
+ specific to different derivative.
+ * chain.c32: support setting alternate config filename for
+ stage2 of GRUB Legacy (Gert Hulselmans).
+ * whichsys.c32: execute specific command, based on Syslinux
+ bootloader variant (Gert Hulselmans).
+ * lua.c32: a lot of new bindings added to the "syslinux"
+ namespace: VESA, PCI, DMI, kernel loading (Marcel Ritter).
+ * btrfs: print a comprehensive error message if compressed or
+ encrypted files are encountered (neither is currently
+ supported.)
+ * SYSLINUX: mtools installer: honor TMPDIR, error out on disk
+ full.
+ * Handle fallbacks from EDD to CHS, to deal with systems which
+ announce EDD support but don't actually have it.
+ * SYSLINUX: the mtools, DOS and win32 installers now use the new
+ command line options.
+ * PXELINUX: fix the use of IP addresses in TFTP :: or tftp://
+ host syntax.
+ * SYSLINUX: experimental Win64 installer (syslinux64.exe).
+
+Changes in 4.01:
+ * ISOLINUX: fix initialization on systems which don't zero
+ low memory.
+ * SYSLINUX/EXTLINUX: fix handing of disk read retries in
+ EDD mode.
+ * ISOLINUX: change the initialization sequence to avoid
+ problems with certain (old) BIOSes. Special thanks to
+ Helmut Hullen for invaluable debugging support.
+ * ifplop.c32: new module which detects if the PLoP Boot Loader
+ already has booted a CDROM or USB drive (Gert Hulselmans).
+ * Correct a severe memory overwrite bug, triggered primarily
+ when selecting a very long command line in the menu system.
+ * lua.c32: Lua script interpreter, currently experimental
+ (Alexey Zaytsev, Marcel Ritter, Geert Stappers).
+ * PXELINUX: new option IPAPPEND 4 to append the system UUID to
+ the kernel command line.
+ * PXELINUX: display BOOTIF and SYSUUID at startup time, and
+ when Ctrl-N is pressed on the command line.
+
+Changes in 4.00:
+ * Major code base changes; all filesystem rewritten in C.
+ This work was done primarily by Liu Aleaxander (Yuanhan Liu).
+ * EXTLINUX: btrfs and ext4 support. btrfs support was done by
+ Alek Du of Intel.
+ * EXTLINUX is no longer a separate derivative; extlinux and
+ syslinux both install the same loader (ldlinux.sys); for the
+ Linux-based installers the extlinux binary is used for a
+ mounted filesystem; the syslinux binary for an unmounted
+ filesystem.
+ * When loading a new configuration file with the CONFIG
+ command, one can now also specify a new current directory
+ with an APPEND statement.
+ * Full ADV support for Syslinux, to boot-once and MENU SAVE
+ works.
+ * Full support of GPT-partitioned disks, including disks
+ and/or parititions larger than 2 TiB (if supported by BIOS.)
+ * The GPT handover protocol adjusted to the current T13
+ committee draft; see doc/gpt.txt.
+ * HDT: code cleanup, small bugfixes
+ * The "linux" syslinux installer (syslinux-nomtools) now has a
+ command-line syntax closer to the extlinux installer. The
+ mtools, dos and win32 installers will get this new syntax
+ eventually, but it is not implemented yet.
+ * chain.c32: support booting GPT partitions by index, GUID, label.
+ * chain.c32: support booting the Syslinux partition with "fs".
+ * chain.c32: implement gpt.txt hand-over protocol.
+ * chain.c32: support for chainloading Grub stage 2.
+ * PXELINUX: TFTP URL syntax (tftp://) supported even when not
+ running gPXE/gpxelinux.
+ * New ls.c32 module to display the contents of the disk from
+ the command line, and pwd.c32 to display the current
+ directory.
+ * rosh.c32 (read only shell) updated and hopefully usable.
+ * PXELINUX: Support "localboot -1", just like the other
+ derivatives.
+ * gfxboot.com removed in favor of gfxboot.c32.
+ * New MENU HELP statement to display fullscreen help text as a
+ result of a menu selection.
+ * memdiskfind utility that can be used with the phram driver
+ in the Linux kernel to mount a memdisk.
+ * ifcpu.c32: Adding usage when no parameters are given,
+ adding PAE support.
+ * ifcpu.c32, ifcpu64.c32: handle more than one argument per
+ target.
+ * isohybrid: C version which does not require Perl.
+ * New command MENU IMMEDIATE to permit hotkeys to activate
+ immediately without needing Enter.
+ * mdiskchk.com supports a --no-sequential (or -n) option to
+ suppress the classic all-drive-probing heuristic. Useful
+ on BIOSes who crash/hang when certain drive numbers are
+ probed.
+ * ElTorito.Sys DOS driver now scans drive numbers upwards
+ instead of downwards, in order to avoid a fairly common
+ bug on some BIOSes where probing drive 0xFF causes a
+ failure.
+ * NASM 2.03 or later required to build. 2.07 or later
+ recommended.
+
Changes in 3.86:
* chain.c32: fix chainloading the MBR of a hard disk (broken
in 3.85).
diff --git a/README b/README
index aebc421c..ff905aa8 100644
--- a/README
+++ b/README
@@ -17,8 +17,8 @@ Also see the files:
COPYING - For the license terms of this software.
SYSLINUX now builds in a Linux environment, using nasm. You need nasm
-version 0.98.39 or later to build SYSLINUX from source. See
-http://nasm.sf.net/ for information about nasm.
+version 2.03 or later (2.07 or later recommended) to build SYSLINUX
+from source. See http://www.nasm.us/ for information about nasm.
There is now a mailing list for SYSLINUX. See the end of syslinux.txt
for details.
diff --git a/TODO b/TODO
deleted file mode 100644
index 530b4bfb..00000000
--- a/TODO
+++ /dev/null
@@ -1,22 +0,0 @@
-*** To do in the short term:
-
-- PXELINUX: Figure out localboot/idle problems.
-
-- PXELINUX: Support changing the default server and boot file prefix?
-
-- Library support for all the comboot system calls.
-
-- Deal with non-512-byte sectors (if I can get media which does...)
-
-
-*** Future projects:
-
-- Clean up the command-line parsing.
-
-- Cleaned up documentation, with a real man page.
-
-- API call to get directory listing.
-
-- COM32-based CLI.
-
-- Rewrite the filesystems to run in protected mode C code.
diff --git a/codepage/cptable.pl b/codepage/cptable.pl
index 05cfc3eb..e29cf006 100755
--- a/codepage/cptable.pl
+++ b/codepage/cptable.pl
@@ -82,7 +82,7 @@ open(CPOUT, '>', $cpout)
# Magic number, in anticipation of being able to load these
# files dynamically...
#
-print CPOUT pack("VV", 0x8fad232b, 0x9c295319);
+print CPOUT pack("VV", 0x58a8b3d4, 0x51d21eb1);
# Header fields available for future use...
print CPOUT pack("VVVVVV", 0, 0, 0, 0, 0, 0);
@@ -97,6 +97,7 @@ print CPOUT pack("VVVVVV", 0, 0, 0, 0, 0, 0);
# ... where @ytab is console codepage -> Unicode and
# %tabx is Unicode -> filesystem codepage.
#
+@uctab = (undef) x 256;
for ($i = 0; $i < 256; $i++) {
$uuc = $ucase{$ytab[$i]}; # Unicode upper case
if (defined($tabx{$uuc})) {
@@ -106,15 +107,44 @@ for ($i = 0; $i < 256; $i++) {
# Upper case equivalent stripped of accents
$u = $tabx{${$decomp{$uuc}}[0]};
} else {
- # No equivalent at all found. Set this to zero, which should
- # prevent shortname matching altogether (still making longname
- # matching possible, of course.)
- $u = 0;
+ # No equivalent at all found. Assume it is a lower-case-only
+ # character, like greek alpha in CP437.
+ $u = $i;
}
+ $uctab[$i] = $u;
print CPOUT pack("C", $u);
}
#
+# Self (shortname) lowercase table.
+# This depends both on the console codepage and the filesystem codepage;
+# the logical transcoding operation is:
+#
+# $taby{$lcase{$xtab[$i]}}
+#
+# ... where @ytab is console codepage -> Unicode and
+# %tabx is Unicode -> filesystem codepage.
+#
+@lctab = (undef) x 256;
+for ($i = 0; $i < 256; $i++) {
+ $llc = $lcase{$xtab[$i]}; # Unicode lower case
+ if (defined($l = $taby{$llc}) && $uctab[$l] == $i) {
+ # Straight-forward conversion
+ } elsif (defined($l = $tabx{${$decomp{$llc}}[0]}) && $uctab[$l] == $i) {
+ # Lower case equivalent stripped of accents
+ } else {
+ # No equivalent at all found. Find *anything* that matches the
+ # bijection criterion...
+ for ($l = 0; $l < 256; $l++) {
+ last if ($uctab[$l] == $i);
+ }
+ $l = $i if ($l == 256); # If nothing, we're screwed anyway...
+ }
+ $lctab[$i] = $l;
+ print CPOUT pack("C", $l);
+}
+
+#
# Unicode (longname) matching table.
# This only depends on the console codepage.
#
diff --git a/com32/MCONFIG b/com32/MCONFIG
index 0e152de3..a74ed326 100644
--- a/com32/MCONFIG
+++ b/com32/MCONFIG
@@ -1,5 +1,5 @@
## -*- makefile -*- -------------------------------------------------------
-##
+##
## Copyright 2008-2009 H. Peter Anvin - All Rights Reserved
## Copyright 2009 Intel Corporation; author: H. Peter Anvin
##
@@ -17,17 +17,25 @@
include $(topdir)/MCONFIG
-GCCOPT := $(call gcc_ok,-std=gnu99,) \
- $(call gcc_ok,-m32,) \
- $(call gcc_ok,-fno-stack-protector,) \
- $(call gcc_ok,-falign-functions=0,-malign-functions=0) \
- $(call gcc_ok,-falign-jumps=0,-malign-jumps=0) \
- $(call gcc_ok,-falign-loops=0,-malign-loops=0) \
- $(call gcc_ok,-mpreferred-stack-boundary=2,) \
- $(call gcc_ok,-mincoming-stack-boundary=2,) \
- -march=i386 -Os -fomit-frame-pointer -mregparm=3 -DREGPARM=3
-
-com32 = $(topdir)/com32
+GCCOPT := $(call gcc_ok,-std=gnu99,)
+GCCOPT += $(call gcc_ok,-m32,)
+GCCOPT += $(call gcc_ok,-fno-stack-protector,)
+GCCOPT += $(call gcc_ok,-fwrapv,)
+GCCOPT += $(call gcc_ok,-freg-struct-return,)
+GCCOPT += -mregparm=3 -DREGPARM=3 -march=i386 -Os
+GCCOPT += $(call gcc_ok,-fPIE,-fPIC)
+GCCOPT += $(call gcc_ok,-fno-exceptions,)
+GCCOPT += $(call gcc_ok,-fno-asynchronous-unwind-tables,)
+GCCOPT += $(call gcc_ok,-fno-strict-aliasing,)
+GCCOPT += $(call gcc_ok,-falign-functions=0,-malign-functions=0)
+GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0)
+GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0)
+GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0)
+GCCOPT += $(call gcc_ok,-mpreferred-stack-boundary=2,)
+GCCOPT += $(call gcc_ok,-incoming-stack-boundary=2,)
+
+com32 := $(topdir)/com32
+RELOCS := $(com32)/tools/relocs
ifneq ($(NOGPL),1)
GPLLIB = $(com32)/gpllib/libcom32gpl.a
@@ -47,10 +55,11 @@ SFLAGS = $(GCCOPT) $(GCCWARN) -march=i386 \
-I$(com32)/libutil/include -I$(com32)/include $(GPLINCLUDE)
COM32LD = $(com32)/lib/com32.ld
-LDFLAGS = -m elf_i386 -T $(COM32LD)
+LDFLAGS = -m elf_i386 --emit-relocs -T $(COM32LD)
LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc)
-LNXCFLAGS = -I$(com32)/libutil/include $(GCCWARN) -O -g -D_GNU_SOURCE
+LNXCFLAGS = -I$(com32)/libutil/include $(GCCWARN) -O -g \
+ -D_GNU_SOURCE -D_FORTIFY_SOURCE=0 -Wno-error
LNXSFLAGS = -g
LNXLDFLAGS = -g
@@ -86,3 +95,4 @@ C_LNXLIBS = $(com32)/libutil/libutil_lnx.a
%.c32: %.elf
$(OBJCOPY) -O binary $< $@
+ $(RELOCS) $< >> $@ || ( rm -f $@ ; false )
diff --git a/com32/Makefile b/com32/Makefile
index 3821e581..b090c403 100644
--- a/com32/Makefile
+++ b/com32/Makefile
@@ -1,4 +1,5 @@
-SUBDIRS = lib gpllib libutil modules mboot menu samples rosh cmenu \
- hdt gfxboot sysdump
+SUBDIRS = tools lib gpllib libutil modules mboot menu samples rosh cmenu \
+ hdt gfxboot sysdump lua/src
+
all tidy dist clean spotless install:
set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
diff --git a/com32/cmenu/Makefile b/com32/cmenu/Makefile
index 0ede58dc..794af741 100644
--- a/com32/cmenu/Makefile
+++ b/com32/cmenu/Makefile
@@ -39,21 +39,6 @@ MENUS = $(CMENUS) $(IMENUS)
%.c: %.menu adv_menu.tpl
python menugen.py --input=$< --output=$@ --template=adv_menu.tpl
-.PRECIOUS: %.o
-%.o: %.S
- $(CC) $(MAKEDEPS) $(SFLAGS) -c -o $@ $<
-
-.PRECIOUS: %.o
-%.o: %.c %.h
- $(CC) $(MAKEDEPS) $(CFLAGS) -c -o $@ $<
-
-.PRECIOUS: %.elf
-%.elf: %.o libmenu/libmenu.a $(LIBS)
- $(LD) $(LDFLAGS) -o $@ $^
-
-%.c32: %.elf
- $(OBJCOPY) -O binary $< $@
-
all: menus
libmenu/libmenu.a: $(LIBMENU)
diff --git a/com32/cmenu/adv_menu.tpl b/com32/cmenu/adv_menu.tpl
index a1a5d96a..871c7827 100644
--- a/com32/cmenu/adv_menu.tpl
+++ b/com32/cmenu/adv_menu.tpl
@@ -221,7 +221,7 @@ void keys_handler(t_menusystem * ms __attribute__ (( unused )), t_menuitem * mi,
}
}
-t_handler_return login_handler(t_menuitem *mi)
+t_handler_return login_handler(t_menusystem *ms, t_menuitem *mi)
{
(void)mi; // Unused
char pwd[40];
@@ -229,6 +229,8 @@ t_handler_return login_handler(t_menuitem *mi)
int nc, nr;
t_handler_return rv;
+ (void)ms;
+
rv = ACTION_INVALID;
if (PWD_ROW < 0) return rv; // No need to authenticate
diff --git a/com32/cmenu/complex.c b/com32/cmenu/complex.c
index 905aaeec..b80005d1 100644
--- a/com32/cmenu/complex.c
+++ b/com32/cmenu/complex.c
@@ -100,6 +100,8 @@ t_handler_return login_handler(t_menusystem * ms, t_menuitem * mi)
int nc, nr;
t_handler_return rv;
+ (void)ms;
+
if (mi->item == loginstr) { /* User wants to login */
if (getscreensize(1, &nr, &nc)) {
/* Unknown screen size? */
@@ -138,6 +140,7 @@ t_handler_return login_handler(t_menusystem * ms, t_menuitem * mi)
}
rv.valid = 0;
rv.refresh = 1;
+ rv.reserved = 0;
return rv;
}
@@ -241,6 +244,7 @@ t_handler_return checkbox_handler(t_menusystem * ms, t_menuitem * mi)
rv.valid = 0;
rv.refresh = 1;
+ rv.reserved = 0;
return rv;
}
diff --git a/com32/cmenu/libmenu/com32io.c b/com32/cmenu/libmenu/com32io.c
index 6a27d1a1..8e5016be 100644
--- a/com32/cmenu/libmenu/com32io.c
+++ b/com32/cmenu/libmenu/com32io.c
@@ -27,17 +27,6 @@ void getpos(char *row, char *col, char page)
*col = REG_DL(outreg);
}
-unsigned char sleep(unsigned int msec)
-{
- unsigned long micro = 1000 * msec;
-
- REG_AH(inreg) = 0x86;
- REG_CX(inreg) = (micro >> 16);
- REG_DX(inreg) = (micro & 0xFFFF);
- __intcall(0x15, &inreg, &outreg);
- return REG_AH(outreg);
-}
-
char inputc(char *scancode)
{
syslinux_idle(); /* So syslinux can perform periodic activity */
diff --git a/com32/cmenu/libmenu/com32io.h b/com32/cmenu/libmenu/com32io.h
index 6ff6857e..d9cce3d6 100644
--- a/com32/cmenu/libmenu/com32io.h
+++ b/com32/cmenu/libmenu/com32io.h
@@ -63,6 +63,4 @@ static inline char getvideomode(void) // Get the current video mode
return readbiosb(0x449);
}
-unsigned char sleep(unsigned int msec); // Sleep for specified time
-
#endif
diff --git a/com32/cmenu/libmenu/des.c b/com32/cmenu/libmenu/des.c
index a058df89..37148b24 100644
--- a/com32/cmenu/libmenu/des.c
+++ b/com32/cmenu/libmenu/des.c
@@ -912,10 +912,9 @@ static int des_cipher(const char *in, char *out, my_u_int32_t salt, int count)
void setkey(const char *key)
{
int i, j;
- my_u_int32_t packed_keys[2];
- my_u_char_t *p;
+ char *p, packed_keys[8];
- p = (my_u_char_t *) packed_keys;
+ p = packed_keys;
for (i = 0; i < 8; i++) {
p[i] = 0;
@@ -935,7 +934,7 @@ void encrypt(char *block, int flag)
des_init();
setup_salt(0L);
- p = block;
+ p = (my_u_char_t *)block;
for (i = 0; i < 2; i++) {
io[i] = 0L;
for (j = 0; j < 32; j++)
diff --git a/com32/cmenu/libmenu/menu.c b/com32/cmenu/libmenu/menu.c
index 13754768..19a7e598 100644
--- a/com32/cmenu/libmenu/menu.c
+++ b/com32/cmenu/libmenu/menu.c
@@ -655,9 +655,9 @@ pt_menuitem showmenus(uchar startmenu)
ms->menus[(unsigned int)startmenu], 0, NORMALMENU);
// Hide the garbage we left on the screen
- cursoron();
cls();
gotoxy(ms->minrow, ms->mincol);
+ cursoron();
// Return user choice
return rv;
diff --git a/com32/cmenu/libmenu/passwords.h b/com32/cmenu/libmenu/passwords.h
index 9ac06b19..2e0ec27c 100644
--- a/com32/cmenu/libmenu/passwords.h
+++ b/com32/cmenu/libmenu/passwords.h
@@ -8,7 +8,7 @@ char isallowed(const char *username, const char *perm);
// Initialise the list of of user passwords permissions from file
void init_passwords(const char *filename);
// Free all space used for internal data structures
-void close_passwords();
+void close_passwords(void);
#define MAX_USERS 128 // Maximum number of users
#define USERNAME_LENGTH 12 // Max length of user name
diff --git a/com32/cmenu/libmenu/syslnx.c b/com32/cmenu/libmenu/syslnx.c
index 5cc19333..53e2401b 100644
--- a/com32/cmenu/libmenu/syslnx.c
+++ b/com32/cmenu/libmenu/syslnx.c
@@ -63,6 +63,8 @@ void runsyslinuximage(const char *cmd, long ipappend)
unsigned int numfun = 0;
char *ptr, *cmdline;
+ (void)ipappend; // XXX: Unused?!
+
getversion(NULL, &numfun);
// Function 16h not supported Fall back to runcommand
if (numfun < 0x16)
diff --git a/com32/gfxboot/gfxboot.c b/com32/gfxboot/gfxboot.c
index a6c95fe1..552728fd 100644
--- a/com32/gfxboot/gfxboot.c
+++ b/com32/gfxboot/gfxboot.c
@@ -21,6 +21,7 @@
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <minmax.h>
#include <syslinux/loadfile.h>
#include <syslinux/config.h>
@@ -60,7 +61,7 @@
#define GFX_CB_PASSWORD_DONE 11
// real mode code chunk, will be placed into bounce buffer
-extern void realmode_callback_start, realmode_callback_end;
+extern const char realmode_callback_start[], realmode_callback_end[];
// gets in the way
#undef linux
@@ -134,6 +135,7 @@ gfx_menu_t gfx_menu;
menu_t *menu;
menu_t *menu_default;
+static menu_t *menu_ptr, **menu_next;
struct {
uint32_t jmp_table[12];
@@ -161,7 +163,7 @@ char *get_config_file_name(void);
char *skip_spaces(char *s);
char *skip_nonspaces(char *s);
void chop_line(char *s);
-int read_config_file(void);
+int read_config_file(const char *filename);
unsigned magic_ok(unsigned char *buf, unsigned *code_size);
unsigned find_file(unsigned char *buf, unsigned len, unsigned *gfx_file_start, unsigned *file_len, unsigned *code_size);
int gfx_init(char *file);
@@ -182,27 +184,29 @@ void boot_entry(menu_t *menu_ptr, char *arg);
int main(int argc, char **argv)
{
int menu_index;
- enum syslinux_filesystem syslinux_id;
- com32sys_t r;
+ const union syslinux_derivative_info *sdi;
openconsole(&dev_stdcon_r, &dev_stdcon_w);
- syslinux_id = syslinux_version()->filesystem;
-
lowmem_buf = __com32.cs_bounce;
lowmem_buf_size = __com32.cs_bounce_size;
- r.eax.l = 0x0a; // Get Derivative-Specific Information
- r.ecx.l = 9;
- __intcall(0x22, &r, &r);
- gfx_config.sector_shift = (uint8_t) r.ecx.l;
- gfx_config.boot_drive = (uint8_t) r.edx.l;
+ sdi = syslinux_derivative_info();
- if(syslinux_id == SYSLINUX_FS_PXELINUX) {
+ gfx_config.sector_shift = sdi->disk.sector_shift;
+ gfx_config.boot_drive = sdi->disk.drive_number;
+
+ if(sdi->c.filesystem == SYSLINUX_FS_PXELINUX) {
gfx_config.sector_shift = 11;
gfx_config.boot_drive = 0;
}
+ gfx_config.media_type = gfx_config.boot_drive < 0x80 ? 1 : 0;
+
+ if(sdi->c.filesystem == SYSLINUX_FS_ISOLINUX) {
+ gfx_config.media_type = sdi->iso.cd_mode ? 0 : 2;
+ }
+
gfx_config.bootloader = 1;
gfx_config.sysconfig_size = sizeof gfx_config;
gfx_config.bootloader_seg = 0; // apparently not needed
@@ -217,7 +221,7 @@ int main(int argc, char **argv)
return 0;
}
- if(read_config_file()) {
+ if(read_config_file("~")) {
printf("Error reading config file\n");
if(argc > 2) show_message(argv[2]);
@@ -311,16 +315,24 @@ void chop_line(char *s)
// return:
// 0: ok, 1: error
//
-int read_config_file(void)
+int read_config_file(const char *filename)
{
FILE *f;
char *s, *t, buf[MAX_CONFIG_LINE_LEN];
- unsigned u, menu_idx = 0, label_size = 0, append_size = 0;
- menu_t *menu_ptr = NULL, **menu_next = &menu;
+ unsigned u, top_level = 0, text = 0;
- menu_default = calloc(1, sizeof *menu_default);
+ if(!strcmp(filename, "~")) {
+ top_level = 1;
+ filename = syslinux_config_file();
+ gfx_menu.entries = 0;
+ gfx_menu.label_size = 0;
+ gfx_menu.arg_size = 0;
+ menu_ptr = NULL;
+ menu_next = &menu;
+ menu_default = calloc(1, sizeof *menu_default);
+ }
- if(!(f = fopen(syslinux_config_file(), "r"))) return 1;
+ if(!(f = fopen(filename, "r"))) return 1;
while((s = fgets(buf, sizeof buf, f))) {
chop_line(s);
@@ -330,6 +342,14 @@ int read_config_file(void)
if(*t) *t++ = 0;
t = skip_spaces(t);
+ if(!strcasecmp(s, "endtext")) {
+ text = 0;
+ continue;
+ }
+
+ if (text)
+ continue;
+
if(!strcasecmp(s, "timeout")) {
timeout = atoi(t);
continue;
@@ -338,17 +358,17 @@ int read_config_file(void)
if(!strcasecmp(s, "default")) {
menu_default->label = strdup(t);
u = strlen(t);
- if(u > label_size) label_size = u;
+ if(u > gfx_menu.label_size) gfx_menu.label_size = u;
continue;
}
if(!strcasecmp(s, "label")) {
menu_ptr = *menu_next = calloc(1, sizeof **menu_next);
menu_next = &menu_ptr->next;
- menu_idx++;
+ gfx_menu.entries++;
menu_ptr->label = menu_ptr->menu_label = strdup(t);
u = strlen(t);
- if(u > label_size) label_size = u;
+ if(u > gfx_menu.label_size) gfx_menu.label_size = u;
continue;
}
@@ -375,7 +395,7 @@ int read_config_file(void)
if(!strcasecmp(s, "append")) {
(menu_ptr ?: menu_default)->append = strdup(t);
u = strlen(t);
- if(u > append_size) append_size = u;
+ if(u > gfx_menu.arg_size) gfx_menu.arg_size = u;
continue;
}
@@ -384,6 +404,11 @@ int read_config_file(void)
continue;
}
+ if(!strcasecmp(s, "text")) {
+ text = 1;
+ continue;
+ }
+
if(!strcasecmp(s, "menu") && menu_ptr) {
s = skip_spaces(t);
t = skip_nonspaces(s);
@@ -393,17 +418,37 @@ int read_config_file(void)
if(!strcasecmp(s, "label")) {
menu_ptr->menu_label = strdup(t);
u = strlen(t);
- if(u > label_size) label_size = u;
+ if(u > gfx_menu.label_size) gfx_menu.label_size = u;
continue;
}
+
+ if(!strcasecmp(s, "include")) {
+ goto do_include;
+ }
+ }
+
+ if (!strcasecmp(s, "include")) {
+do_include:
+ s = t;
+ t = skip_nonspaces(s);
+ if (*t) *t = 0;
+ read_config_file(s);
}
}
fclose(f);
+ if (!top_level)
+ return 0;
+
+ if (gfx_menu.entries == 0) {
+ printf("No LABEL keywords found.\n");
+ return 1;
+ }
+
// final '\0'
- label_size++;
- append_size++;
+ gfx_menu.label_size++;
+ gfx_menu.arg_size++;
// ensure we have a default entry
if(!menu_default->label) menu_default->label = menu->label;
@@ -417,19 +462,16 @@ int read_config_file(void)
}
}
- gfx_menu.entries = menu_idx;
- gfx_menu.label_size = label_size;
- gfx_menu.arg_size = append_size;
gfx_menu.default_entry = menu_default->menu_label;
- gfx_menu.label_list = calloc(menu_idx, label_size);
- gfx_menu.arg_list = calloc(menu_idx, append_size);
+ gfx_menu.label_list = calloc(gfx_menu.entries, gfx_menu.label_size);
+ gfx_menu.arg_list = calloc(gfx_menu.entries, gfx_menu.arg_size);
for(u = 0, menu_ptr = menu; menu_ptr; menu_ptr = menu_ptr->next, u++) {
if(!menu_ptr->append) menu_ptr->append = menu_default->append;
if(!menu_ptr->ipappend) menu_ptr->ipappend = menu_default->ipappend;
- if(menu_ptr->menu_label) strcpy(gfx_menu.label_list + u * label_size, menu_ptr->menu_label);
- if(menu_ptr->append) strcpy(gfx_menu.arg_list + u * append_size, menu_ptr->append);
+ if(menu_ptr->menu_label) strcpy(gfx_menu.label_list + u * gfx_menu.label_size, menu_ptr->menu_label);
+ if(menu_ptr->append) strcpy(gfx_menu.arg_list + u * gfx_menu.arg_size, menu_ptr->append);
}
return 0;
@@ -533,7 +575,7 @@ int gfx_init(char *file)
gfx_config.file = gfx_config.archive_start + file_start;
- u = &realmode_callback_end - &realmode_callback_start;
+ u = realmode_callback_end - realmode_callback_start;
u = (u + REALMODE_BUF_SIZE + 0xf) & ~0xf;
if(u + code_size > lowmem_size) {
@@ -541,7 +583,8 @@ int gfx_init(char *file)
return 1;
}
- memcpy(lowmem + REALMODE_BUF_SIZE, &realmode_callback_start, &realmode_callback_end - &realmode_callback_start);
+ memcpy(lowmem + REALMODE_BUF_SIZE, realmode_callback_start,
+ realmode_callback_end - realmode_callback_start);
// fill in buffer size and location
*(uint16_t *) (lowmem + REALMODE_BUF_SIZE) = REALMODE_BUF_SIZE;
@@ -747,7 +790,7 @@ void *load_one(char *file, ssize_t *file_size)
if(size) {
buf = malloc(size);
for(i = 1, cur = 0 ; cur < size && i > 0; cur += i) {
- i = save_read(fd, buf + cur, CHUNK_SIZE);
+ i = save_read(fd, buf + cur, min(CHUNK_SIZE, size - cur));
if(i == -1) break;
gfx_progress_update(i);
}
diff --git a/com32/gplinclude/cpuid.h b/com32/gplinclude/cpuid.h
index bc9df171..53a08085 100644
--- a/com32/gplinclude/cpuid.h
+++ b/com32/gplinclude/cpuid.h
@@ -19,6 +19,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <cpufeature.h>
+#include <sys/bitops.h>
#include <sys/cpu.h>
#include <klibc/compiler.h>
@@ -173,11 +174,6 @@ typedef struct {
#define X86_VENDOR_NUM 9
#define X86_VENDOR_UNKNOWN 0xff
-static inline __purefunc bool test_bit(int nr, const uint32_t * addr)
-{
- return ((1UL << (nr & 31)) & (addr[nr >> 5])) != 0;
-}
-
#define cpu_has(c, bit) test_bit(bit, (c)->x86_capability)
/*
diff --git a/com32/gplinclude/dmi/dmi_memory.h b/com32/gplinclude/dmi/dmi_memory.h
index 47ad7fcd..4d0ad442 100644
--- a/com32/gplinclude/dmi/dmi_memory.h
+++ b/com32/gplinclude/dmi/dmi_memory.h
@@ -66,12 +66,12 @@ void dmi_memory_device_size(uint16_t code, char *size);
const char *dmi_memory_device_form_factor(uint8_t code);
void dmi_memory_device_set(uint8_t code, char *set);
const char *dmi_memory_device_type(uint8_t code);
-void dmi_memory_device_type_detail(uint16_t code, char *type_detail);
+void dmi_memory_device_type_detail(uint16_t code, char *type_detail, int sizeof_type_detail);
void dmi_memory_device_speed(uint16_t code, char *speed);
-void dmi_memory_module_connections(uint8_t, char *);
+void dmi_memory_module_connections(uint8_t, char *, int);
void dmi_memory_module_speed(uint8_t, char *);
-void dmi_memory_module_types(uint16_t, const char *, char *);
-void dmi_memory_module_size(uint8_t, char *);
+void dmi_memory_module_types(uint16_t, const char *, char *, int);
+void dmi_memory_module_size(uint8_t, char *, int);
void dmi_memory_module_error(uint8_t, const char *, char *);
#endif
diff --git a/com32/gpllib/cpuid.c b/com32/gpllib/cpuid.c
index f33e8958..2d5b5ce9 100644
--- a/com32/gpllib/cpuid.c
+++ b/com32/gpllib/cpuid.c
@@ -423,9 +423,9 @@ void set_generic_info(struct cpuinfo_x86 *c, s_cpu * cpu)
cpu->vendor_id = c->x86_vendor;
cpu->model_id = c->x86_model;
cpu->stepping = c->x86_mask;
- strncpy(cpu->vendor, cpu_devs[c->x86_vendor]->c_vendor,
+ strlcpy(cpu->vendor, cpu_devs[c->x86_vendor]->c_vendor,
sizeof(cpu->vendor));
- strncpy(cpu->model, c->x86_model_id, sizeof(cpu->model));
+ strlcpy(cpu->model, c->x86_model_id, sizeof(cpu->model));
cpu->num_cores = c->x86_num_cores;
cpu->l1_data_cache_size = c->x86_l1_data_cache_size;
cpu->l1_instruction_cache_size = c->x86_l1_instruction_cache_size;
diff --git a/com32/gpllib/disk/bootloaders.c b/com32/gpllib/disk/bootloaders.c
index 188dd64b..e0340112 100644
--- a/com32/gpllib/disk/bootloaders.c
+++ b/com32/gpllib/disk/bootloaders.c
@@ -31,11 +31,11 @@ int get_bootloader_string(struct driveinfo *d, const struct part_entry *p,
return -1;
else {
if (!strncmp(boot_sector + 3, "SYSLINUX", 8))
- strncpy(buffer, "SYSLINUX", buffer_size - 1);
+ strlcpy(buffer, "SYSLINUX", buffer_size - 1);
else if (!strncmp(boot_sector + 3, "EXTLINUX", 8))
- strncpy(buffer, "EXTLINUX", buffer_size - 1);
+ strlcpy(buffer, "EXTLINUX", buffer_size - 1);
else if (!strncmp(boot_sector + 3, "MSWIN4.1", 8))
- strncpy(buffer, "MSWIN4.1", buffer_size - 1);
+ strlcpy(buffer, "MSWIN4.1", buffer_size - 1);
else
return -1;
/* Add more... */
diff --git a/com32/gpllib/disk/labels.c b/com32/gpllib/disk/labels.c
index 8017d48a..ad3d33b3 100644
--- a/com32/gpllib/disk/labels.c
+++ b/com32/gpllib/disk/labels.c
@@ -18,637 +18,637 @@ void get_label(int label, char **buffer_label)
switch (label) {
case 0x01:
- strncpy(buffer, "DOS 12-bit fat", buffer_size);
+ strlcpy(buffer, "DOS 12-bit fat", buffer_size);
break;
case 0x02:
- strncpy(buffer, "XENIX root", buffer_size);
+ strlcpy(buffer, "XENIX root", buffer_size);
break;
case 0x03:
- strncpy(buffer, "XENIX /usr", buffer_size);
+ strlcpy(buffer, "XENIX /usr", buffer_size);
break;
case 0x04:
- strncpy(buffer, "DOS 3.0+ 16-bit FAT (up to 32M)", buffer_size);
+ strlcpy(buffer, "DOS 3.0+ 16-bit FAT (up to 32M)", buffer_size);
break;
case 0x05:
- strncpy(buffer, "DOS 3.3+ Extended Partition", buffer_size);
+ strlcpy(buffer, "DOS 3.3+ Extended Partition", buffer_size);
break;
case 0x06:
- strncpy(buffer, "DOS 3.31+ 16-bit FAT (over 32M)", buffer_size);
+ strlcpy(buffer, "DOS 3.31+ 16-bit FAT (over 32M)", buffer_size);
break;
case 0x07:
- strncpy(buffer, "OS/2 IFS (e.g., HPFS)", buffer_size);
+ strlcpy(buffer, "OS/2 IFS (e.g., HPFS)", buffer_size);
break;
- //case 0x07: strncpy(buffer, "Advanced Unix", buffer_size); break;
- //case 0x07: strncpy(buffer, "Windows NT NTFS", buffer_size); break;
- //case 0x07: strncpy(buffer, "QNX2.x (pre-1988)", buffer_size); break;
+ //case 0x07: strlcpy(buffer, "Advanced Unix", buffer_size); break;
+ //case 0x07: strlcpy(buffer, "Windows NT NTFS", buffer_size); break;
+ //case 0x07: strlcpy(buffer, "QNX2.x (pre-1988)", buffer_size); break;
case 0x08:
- strncpy(buffer, "OS/2 (v1.0-1.3 only)", buffer_size);
+ strlcpy(buffer, "OS/2 (v1.0-1.3 only)", buffer_size);
break;
- //case 0x08: strncpy(buffer, "AIX boot partition", buffer_size); break;
- //case 0x08: strncpy(buffer, "SplitDrive", buffer_size); break;
- //case 0x08: strncpy(buffer, "DELL partition spanning multiple drives", buffer_size); break;
- //case 0x08: strncpy(buffer, "Commodore DOS", buffer_size); break;
- //case 0x08: strncpy(buffer, "QNX 1.x and 2.x ("qny")", buffer_size); break;
+ //case 0x08: strlcpy(buffer, "AIX boot partition", buffer_size); break;
+ //case 0x08: strlcpy(buffer, "SplitDrive", buffer_size); break;
+ //case 0x08: strlcpy(buffer, "DELL partition spanning multiple drives", buffer_size); break;
+ //case 0x08: strlcpy(buffer, "Commodore DOS", buffer_size); break;
+ //case 0x08: strlcpy(buffer, "QNX 1.x and 2.x ("qny")", buffer_size); break;
case 0x09:
- strncpy(buffer, "AIX data partition", buffer_size);
+ strlcpy(buffer, "AIX data partition", buffer_size);
break;
- //case 0x09: strncpy(buffer, "Coherent filesystem", buffer_size); break;
- //case 0x09: strncpy(buffer, "QNX 1.x and 2.x ("qnz")", buffer_size); break;
+ //case 0x09: strlcpy(buffer, "Coherent filesystem", buffer_size); break;
+ //case 0x09: strlcpy(buffer, "QNX 1.x and 2.x ("qnz")", buffer_size); break;
case 0x0a:
- strncpy(buffer, "OS/2 Boot Manager", buffer_size);
+ strlcpy(buffer, "OS/2 Boot Manager", buffer_size);
break;
- //case 0x0a: strncpy(buffer, "Coherent swap partition", buffer_size); break;
- //case 0x0a: strncpy(buffer, "OPUS", buffer_size); break;
+ //case 0x0a: strlcpy(buffer, "Coherent swap partition", buffer_size); break;
+ //case 0x0a: strlcpy(buffer, "OPUS", buffer_size); break;
case 0x0b:
- strncpy(buffer, "WIN95 OSR2 32-bit FAT", buffer_size);
+ strlcpy(buffer, "WIN95 OSR2 32-bit FAT", buffer_size);
break;
case 0x0c:
- strncpy(buffer, "WIN95 OSR2 32-bit FAT, LBA-mapped", buffer_size);
+ strlcpy(buffer, "WIN95 OSR2 32-bit FAT, LBA-mapped", buffer_size);
break;
case 0x0e:
- strncpy(buffer, "WIN95: DOS 16-bit FAT, LBA-mapped", buffer_size);
+ strlcpy(buffer, "WIN95: DOS 16-bit FAT, LBA-mapped", buffer_size);
break;
case 0x0f:
- strncpy(buffer, "WIN95: Extended partition, LBA-mapped", buffer_size);
+ strlcpy(buffer, "WIN95: Extended partition, LBA-mapped", buffer_size);
break;
case 0x10:
- strncpy(buffer, "OPUS (?)", buffer_size);
+ strlcpy(buffer, "OPUS (?)", buffer_size);
break;
case 0x11:
- strncpy(buffer, "Hidden DOS 12-bit FAT", buffer_size);
+ strlcpy(buffer, "Hidden DOS 12-bit FAT", buffer_size);
break;
case 0x12:
- strncpy(buffer, "Compaq config partition", buffer_size);
+ strlcpy(buffer, "Compaq config partition", buffer_size);
break;
case 0x14:
- strncpy(buffer, "Hidden DOS 16-bit FAT <32M", buffer_size);
+ strlcpy(buffer, "Hidden DOS 16-bit FAT <32M", buffer_size);
break;
case 0x16:
- strncpy(buffer, "Hidden DOS 16-bit FAT >=32M", buffer_size);
+ strlcpy(buffer, "Hidden DOS 16-bit FAT >=32M", buffer_size);
break;
case 0x17:
- strncpy(buffer, "Hidden IFS (e.g., HPFS)", buffer_size);
+ strlcpy(buffer, "Hidden IFS (e.g., HPFS)", buffer_size);
break;
case 0x18:
- strncpy(buffer, "AST SmartSleep Partition", buffer_size);
+ strlcpy(buffer, "AST SmartSleep Partition", buffer_size);
break;
case 0x19:
- strncpy(buffer, "Unused (Claimed for Willowtech Photon COS)",
+ strlcpy(buffer, "Unused (Claimed for Willowtech Photon COS)",
buffer_size);
break;
case 0x1b:
- strncpy(buffer, "Hidden WIN95 OSR2 32-bit FAT", buffer_size);
+ strlcpy(buffer, "Hidden WIN95 OSR2 32-bit FAT", buffer_size);
break;
case 0x1c:
- strncpy(buffer, "Hidden WIN95 OSR2 32-bit FAT, LBA-mapped",
+ strlcpy(buffer, "Hidden WIN95 OSR2 32-bit FAT, LBA-mapped",
buffer_size);
break;
case 0x1e:
- strncpy(buffer, "Hidden WIN95 16-bit FAT, LBA-mapped", buffer_size);
+ strlcpy(buffer, "Hidden WIN95 16-bit FAT, LBA-mapped", buffer_size);
break;
case 0x20:
- strncpy(buffer, "Unused", buffer_size);
+ strlcpy(buffer, "Unused", buffer_size);
break;
case 0x21:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
- //case 0x21: strncpy(buffer, "Unused", buffer_size); break;
+ //case 0x21: strlcpy(buffer, "Unused", buffer_size); break;
case 0x22:
- strncpy(buffer, "Unused", buffer_size);
+ strlcpy(buffer, "Unused", buffer_size);
break;
case 0x23:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x24:
- strncpy(buffer, "NEC DOS 3.x", buffer_size);
+ strlcpy(buffer, "NEC DOS 3.x", buffer_size);
break;
case 0x26:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x31:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x32:
- strncpy(buffer, "NOS", buffer_size);
+ strlcpy(buffer, "NOS", buffer_size);
break;
case 0x33:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x34:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x35:
- strncpy(buffer, "JFS on OS/2 or eCS", buffer_size);
+ strlcpy(buffer, "JFS on OS/2 or eCS", buffer_size);
break;
case 0x36:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x38:
- strncpy(buffer, "THEOS ver 3.2 2gb partition", buffer_size);
+ strlcpy(buffer, "THEOS ver 3.2 2gb partition", buffer_size);
break;
case 0x39:
- strncpy(buffer, "Plan 9 partition", buffer_size);
+ strlcpy(buffer, "Plan 9 partition", buffer_size);
break;
- //case 0x39: strncpy(buffer, "THEOS ver 4 spanned partition", buffer_size); break;
+ //case 0x39: strlcpy(buffer, "THEOS ver 4 spanned partition", buffer_size); break;
case 0x3a:
- strncpy(buffer, "THEOS ver 4 4gb partition", buffer_size);
+ strlcpy(buffer, "THEOS ver 4 4gb partition", buffer_size);
break;
case 0x3b:
- strncpy(buffer, "THEOS ver 4 extended partition", buffer_size);
+ strlcpy(buffer, "THEOS ver 4 extended partition", buffer_size);
break;
case 0x3c:
- strncpy(buffer, "PartitionMagic recovery partition", buffer_size);
+ strlcpy(buffer, "PartitionMagic recovery partition", buffer_size);
break;
case 0x3d:
- strncpy(buffer, "Hidden NetWare", buffer_size);
+ strlcpy(buffer, "Hidden NetWare", buffer_size);
break;
case 0x40:
- strncpy(buffer, "Venix 80286", buffer_size);
+ strlcpy(buffer, "Venix 80286", buffer_size);
break;
case 0x41:
- strncpy(buffer, "Linux/MINIX (sharing disk with DRDOS)", buffer_size);
+ strlcpy(buffer, "Linux/MINIX (sharing disk with DRDOS)", buffer_size);
break;
- //case 0x41: strncpy(buffer, "Personal RISC Boot", buffer_size); break;
- //case 0x41: strncpy(buffer, "PPC PReP (Power PC Reference Platform) Boot", buffer_size); break;
+ //case 0x41: strlcpy(buffer, "Personal RISC Boot", buffer_size); break;
+ //case 0x41: strlcpy(buffer, "PPC PReP (Power PC Reference Platform) Boot", buffer_size); break;
case 0x42:
- strncpy(buffer, "Linux swap (sharing disk with DRDOS)", buffer_size);
+ strlcpy(buffer, "Linux swap (sharing disk with DRDOS)", buffer_size);
break;
- //case 0x42: strncpy(buffer, "SFS (Secure Filesystem)", buffer_size); break;
- //case 0x42: strncpy(buffer, "Windows 2000 marker", buffer_size); break;
+ //case 0x42: strlcpy(buffer, "SFS (Secure Filesystem)", buffer_size); break;
+ //case 0x42: strlcpy(buffer, "Windows 2000 marker", buffer_size); break;
case 0x43:
- strncpy(buffer, "Linux native (sharing disk with DRDOS)", buffer_size);
+ strlcpy(buffer, "Linux native (sharing disk with DRDOS)", buffer_size);
break;
case 0x44:
- strncpy(buffer, "GoBack partition", buffer_size);
+ strlcpy(buffer, "GoBack partition", buffer_size);
break;
case 0x45:
- strncpy(buffer, "Boot-US boot manager", buffer_size);
+ strlcpy(buffer, "Boot-US boot manager", buffer_size);
break;
- //case 0x45: strncpy(buffer, "Priam", buffer_size); break;
- //case 0x45: strncpy(buffer, "EUMEL/Elan", buffer_size); break;
+ //case 0x45: strlcpy(buffer, "Priam", buffer_size); break;
+ //case 0x45: strlcpy(buffer, "EUMEL/Elan", buffer_size); break;
case 0x46:
- strncpy(buffer, "EUMEL/Elan", buffer_size);
+ strlcpy(buffer, "EUMEL/Elan", buffer_size);
break;
case 0x47:
- strncpy(buffer, "EUMEL/Elan", buffer_size);
+ strlcpy(buffer, "EUMEL/Elan", buffer_size);
break;
case 0x48:
- strncpy(buffer, "EUMEL/Elan", buffer_size);
+ strlcpy(buffer, "EUMEL/Elan", buffer_size);
break;
case 0x4a:
- strncpy(buffer, "AdaOS Aquila (Default)", buffer_size);
+ strlcpy(buffer, "AdaOS Aquila (Default)", buffer_size);
break;
- //case 0x4a: strncpy(buffer, "ALFS/THIN lightweight filesystem for DOS", buffer_size); break;
+ //case 0x4a: strlcpy(buffer, "ALFS/THIN lightweight filesystem for DOS", buffer_size); break;
case 0x4c:
- strncpy(buffer, "Oberon partition", buffer_size);
+ strlcpy(buffer, "Oberon partition", buffer_size);
break;
case 0x4d:
- strncpy(buffer, "QNX4.x", buffer_size);
+ strlcpy(buffer, "QNX4.x", buffer_size);
break;
case 0x4e:
- strncpy(buffer, "QNX4.x 2nd part", buffer_size);
+ strlcpy(buffer, "QNX4.x 2nd part", buffer_size);
break;
case 0x4f:
- strncpy(buffer, "QNX4.x 3rd part", buffer_size);
+ strlcpy(buffer, "QNX4.x 3rd part", buffer_size);
break;
- //case 0x4f: strncpy(buffer, "Oberon partition", buffer_size); break;
+ //case 0x4f: strlcpy(buffer, "Oberon partition", buffer_size); break;
case 0x50:
- strncpy(buffer, "OnTrack Disk Manager (older versions) RO",
+ strlcpy(buffer, "OnTrack Disk Manager (older versions) RO",
buffer_size);
break;
- //case 0x50: strncpy(buffer, "Lynx RTOS", buffer_size); break;
- //case 0x50: strncpy(buffer, "Native Oberon (alt)", buffer_size); break;
+ //case 0x50: strlcpy(buffer, "Lynx RTOS", buffer_size); break;
+ //case 0x50: strlcpy(buffer, "Native Oberon (alt)", buffer_size); break;
case 0x51:
- strncpy(buffer, "OnTrack Disk Manager RW (DM6 Aux1)", buffer_size);
+ strlcpy(buffer, "OnTrack Disk Manager RW (DM6 Aux1)", buffer_size);
break;
- //case 0x51: strncpy(buffer, "Novell", buffer_size); break;
+ //case 0x51: strlcpy(buffer, "Novell", buffer_size); break;
case 0x52:
- strncpy(buffer, "CP/M", buffer_size);
+ strlcpy(buffer, "CP/M", buffer_size);
break;
- //case 0x52: strncpy(buffer, "Microport SysV/AT", buffer_size); break;
+ //case 0x52: strlcpy(buffer, "Microport SysV/AT", buffer_size); break;
case 0x53:
- strncpy(buffer, "Disk Manager 6.0 Aux3", buffer_size);
+ strlcpy(buffer, "Disk Manager 6.0 Aux3", buffer_size);
break;
case 0x54:
- strncpy(buffer, "Disk Manager 6.0 Dynamic Drive Overlay", buffer_size);
+ strlcpy(buffer, "Disk Manager 6.0 Dynamic Drive Overlay", buffer_size);
break;
case 0x55:
- strncpy(buffer, "EZ-Drive", buffer_size);
+ strlcpy(buffer, "EZ-Drive", buffer_size);
break;
case 0x56:
- strncpy(buffer, "Golden Bow VFeature Partitioned Volume.", buffer_size);
+ strlcpy(buffer, "Golden Bow VFeature Partitioned Volume.", buffer_size);
break;
- //case 0x56: strncpy(buffer, "DM converted to EZ-BIOS", buffer_size); break;
+ //case 0x56: strlcpy(buffer, "DM converted to EZ-BIOS", buffer_size); break;
case 0x57:
- strncpy(buffer, "DrivePro", buffer_size);
+ strlcpy(buffer, "DrivePro", buffer_size);
break;
- //case 0x57: strncpy(buffer, "VNDI Partition", buffer_size); break;
+ //case 0x57: strlcpy(buffer, "VNDI Partition", buffer_size); break;
case 0x5c:
- strncpy(buffer, "Priam EDisk", buffer_size);
+ strlcpy(buffer, "Priam EDisk", buffer_size);
break;
case 0x61:
- strncpy(buffer, "SpeedStor", buffer_size);
+ strlcpy(buffer, "SpeedStor", buffer_size);
break;
case 0x63:
- strncpy(buffer,
+ strlcpy(buffer,
"Unix System V (SCO, ISC Unix, UnixWare, ...), Mach, GNU Hurd",
buffer_size);
break;
case 0x64:
- strncpy(buffer, "PC-ARMOUR protected partition", buffer_size);
+ strlcpy(buffer, "PC-ARMOUR protected partition", buffer_size);
break;
- //case 0x64: strncpy(buffer, "Novell Netware 286, 2.xx", buffer_size); break;
+ //case 0x64: strlcpy(buffer, "Novell Netware 286, 2.xx", buffer_size); break;
case 0x65:
- strncpy(buffer, "Novell Netware 386, 3.xx or 4.xx", buffer_size);
+ strlcpy(buffer, "Novell Netware 386, 3.xx or 4.xx", buffer_size);
break;
case 0x66:
- strncpy(buffer, "Novell Netware SMS Partition", buffer_size);
+ strlcpy(buffer, "Novell Netware SMS Partition", buffer_size);
break;
case 0x67:
- strncpy(buffer, "Novell", buffer_size);
+ strlcpy(buffer, "Novell", buffer_size);
break;
case 0x68:
- strncpy(buffer, "Novell", buffer_size);
+ strlcpy(buffer, "Novell", buffer_size);
break;
case 0x69:
- strncpy(buffer, "Novell Netware 5+, Novell Netware NSS Partition",
+ strlcpy(buffer, "Novell Netware 5+, Novell Netware NSS Partition",
buffer_size);
break;
case 0x70:
- strncpy(buffer, "DiskSecure Multi-Boot", buffer_size);
+ strlcpy(buffer, "DiskSecure Multi-Boot", buffer_size);
break;
case 0x71:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x73:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x74:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
- //case 0x74: strncpy(buffer, "Scramdisk partition", buffer_size); break;
+ //case 0x74: strlcpy(buffer, "Scramdisk partition", buffer_size); break;
case 0x75:
- strncpy(buffer, "IBM PC/IX", buffer_size);
+ strlcpy(buffer, "IBM PC/IX", buffer_size);
break;
case 0x76:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0x77:
- strncpy(buffer, "M2FS/M2CS partition", buffer_size);
+ strlcpy(buffer, "M2FS/M2CS partition", buffer_size);
break;
- //case 0x77: strncpy(buffer, "VNDI Partition", buffer_size); break;
+ //case 0x77: strlcpy(buffer, "VNDI Partition", buffer_size); break;
case 0x78:
- strncpy(buffer, "XOSL FS", buffer_size);
+ strlcpy(buffer, "XOSL FS", buffer_size);
break;
case 0x7E:
- strncpy(buffer, " ", buffer_size);
+ strlcpy(buffer, " ", buffer_size);
break;
case 0x80:
- strncpy(buffer, "MINIX until 1.4a", buffer_size);
+ strlcpy(buffer, "MINIX until 1.4a", buffer_size);
break;
case 0x81:
- strncpy(buffer, "MINIX since 1.4b, early Linux", buffer_size);
+ strlcpy(buffer, "MINIX since 1.4b, early Linux", buffer_size);
break;
- //case 0x81: strncpy(buffer, "Mitac disk manager", buffer_size); break;
- //case 0x82: strncpy(buffer, "Prime", buffer_size); break;
- //case 0x82: strncpy(buffer, "Solaris x86", buffer_size); break;
+ //case 0x81: strlcpy(buffer, "Mitac disk manager", buffer_size); break;
+ //case 0x82: strlcpy(buffer, "Prime", buffer_size); break;
+ //case 0x82: strlcpy(buffer, "Solaris x86", buffer_size); break;
case 0x82:
- strncpy(buffer, "Linux swap", buffer_size);
+ strlcpy(buffer, "Linux swap", buffer_size);
break;
case 0x83:
- strncpy(buffer, "Linux native (usually ext2fs)", buffer_size);
+ strlcpy(buffer, "Linux native (usually ext2fs)", buffer_size);
break;
case 0x84:
- strncpy(buffer, "OS/2 hidden C: drive", buffer_size);
+ strlcpy(buffer, "OS/2 hidden C: drive", buffer_size);
break;
- //case 0x84: strncpy(buffer, "Hibernation partition", buffer_size); break;
+ //case 0x84: strlcpy(buffer, "Hibernation partition", buffer_size); break;
case 0x85:
- strncpy(buffer, "Linux extended partition", buffer_size);
+ strlcpy(buffer, "Linux extended partition", buffer_size);
break;
- //case 0x86: strncpy(buffer, "Old Linux RAID partition superblock", buffer_size); break;
+ //case 0x86: strlcpy(buffer, "Old Linux RAID partition superblock", buffer_size); break;
case 0x86:
- strncpy(buffer, "NTFS volume set", buffer_size);
+ strlcpy(buffer, "NTFS volume set", buffer_size);
break;
case 0x87:
- strncpy(buffer, "NTFS volume set", buffer_size);
+ strlcpy(buffer, "NTFS volume set", buffer_size);
break;
case 0x8a:
- strncpy(buffer, "Linux Kernel Partition (used by AiR-BOOT)",
+ strlcpy(buffer, "Linux Kernel Partition (used by AiR-BOOT)",
buffer_size);
break;
case 0x8b:
- strncpy(buffer, "Legacy Fault Tolerant FAT32 volume", buffer_size);
+ strlcpy(buffer, "Legacy Fault Tolerant FAT32 volume", buffer_size);
break;
case 0x8c:
- strncpy(buffer,
+ strlcpy(buffer,
"Legacy Fault Tolerant FAT32 volume using BIOS extd INT 13h",
buffer_size);
break;
case 0x8d:
- strncpy(buffer, "Free FDISK hidden Primary DOS FAT12 partitition",
+ strlcpy(buffer, "Free FDISK hidden Primary DOS FAT12 partitition",
buffer_size);
break;
case 0x8e:
- strncpy(buffer, "Linux Logical Volume Manager partition", buffer_size);
+ strlcpy(buffer, "Linux Logical Volume Manager partition", buffer_size);
break;
case 0x90:
- strncpy(buffer, "Free FDISK hidden Primary DOS FAT16 partitition",
+ strlcpy(buffer, "Free FDISK hidden Primary DOS FAT16 partitition",
buffer_size);
break;
case 0x91:
- strncpy(buffer, "Free FDISK hidden DOS extended partitition",
+ strlcpy(buffer, "Free FDISK hidden DOS extended partitition",
buffer_size);
break;
case 0x92:
- strncpy(buffer, "Free FDISK hidden Primary DOS large FAT16 partitition",
+ strlcpy(buffer, "Free FDISK hidden Primary DOS large FAT16 partitition",
buffer_size);
break;
case 0x93:
- strncpy(buffer, "Hidden Linux native partition", buffer_size);
+ strlcpy(buffer, "Hidden Linux native partition", buffer_size);
break;
- //case 0x93: strncpy(buffer, "Amoeba", buffer_size); break;
+ //case 0x93: strlcpy(buffer, "Amoeba", buffer_size); break;
case 0x94:
- strncpy(buffer, "Amoeba bad block table", buffer_size);
+ strlcpy(buffer, "Amoeba bad block table", buffer_size);
break;
case 0x95:
- strncpy(buffer, "MIT EXOPC native partitions", buffer_size);
+ strlcpy(buffer, "MIT EXOPC native partitions", buffer_size);
break;
case 0x97:
- strncpy(buffer, "Free FDISK hidden Primary DOS FAT32 partitition",
+ strlcpy(buffer, "Free FDISK hidden Primary DOS FAT32 partitition",
buffer_size);
break;
case 0x98:
- strncpy(buffer, "Free FDISK hidden Primary DOS FAT32 partitition (LBA)",
+ strlcpy(buffer, "Free FDISK hidden Primary DOS FAT32 partitition (LBA)",
buffer_size);
break;
case 0x99:
- strncpy(buffer, "DCE376 logical drive", buffer_size);
+ strlcpy(buffer, "DCE376 logical drive", buffer_size);
break;
case 0x9a:
- strncpy(buffer, "Free FDISK hidden Primary DOS FAT16 partitition (LBA)",
+ strlcpy(buffer, "Free FDISK hidden Primary DOS FAT16 partitition (LBA)",
buffer_size);
break;
case 0x9b:
- strncpy(buffer, "Free FDISK hidden DOS extended partitition (LBA)",
+ strlcpy(buffer, "Free FDISK hidden DOS extended partitition (LBA)",
buffer_size);
break;
case 0x9f:
- strncpy(buffer, "BSD/OS", buffer_size);
+ strlcpy(buffer, "BSD/OS", buffer_size);
break;
case 0xa0:
- strncpy(buffer, "Laptop hibernation partition", buffer_size);
+ strlcpy(buffer, "Laptop hibernation partition", buffer_size);
break;
case 0xa1:
- strncpy(buffer, "Laptop hibernation partition", buffer_size);
+ strlcpy(buffer, "Laptop hibernation partition", buffer_size);
break;
- //case 0xa1: strncpy(buffer, "HP Volume Expansion (SpeedStor variant)", buffer_size); break;
+ //case 0xa1: strlcpy(buffer, "HP Volume Expansion (SpeedStor variant)", buffer_size); break;
case 0xa3:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0xa4:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0xa5:
- strncpy(buffer, "BSD/386, 386BSD, NetBSD, FreeBSD", buffer_size);
+ strlcpy(buffer, "BSD/386, 386BSD, NetBSD, FreeBSD", buffer_size);
break;
case 0xa6:
- strncpy(buffer, "OpenBSD", buffer_size);
+ strlcpy(buffer, "OpenBSD", buffer_size);
break;
case 0xa7:
- strncpy(buffer, "NEXTSTEP", buffer_size);
+ strlcpy(buffer, "NEXTSTEP", buffer_size);
break;
case 0xa8:
- strncpy(buffer, "Mac OS-X", buffer_size);
+ strlcpy(buffer, "Mac OS-X", buffer_size);
break;
case 0xa9:
- strncpy(buffer, "NetBSD", buffer_size);
+ strlcpy(buffer, "NetBSD", buffer_size);
break;
case 0xaa:
- strncpy(buffer, "Olivetti Fat 12 1.44Mb Service Partition",
+ strlcpy(buffer, "Olivetti Fat 12 1.44Mb Service Partition",
buffer_size);
break;
case 0xab:
- strncpy(buffer, "Mac OS-X Boot partition", buffer_size);
+ strlcpy(buffer, "Mac OS-X Boot partition", buffer_size);
break;
- //case 0xab: strncpy(buffer, "GO! partition", buffer_size); break;
+ //case 0xab: strlcpy(buffer, "GO! partition", buffer_size); break;
case 0xae:
- strncpy(buffer, "ShagOS filesystem", buffer_size);
+ strlcpy(buffer, "ShagOS filesystem", buffer_size);
break;
case 0xaf:
- strncpy(buffer, "ShagOS swap partition", buffer_size);
+ strlcpy(buffer, "ShagOS swap partition", buffer_size);
break;
case 0xb0:
- strncpy(buffer, "BootStar Dummy", buffer_size);
+ strlcpy(buffer, "BootStar Dummy", buffer_size);
break;
case 0xb1:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0xb3:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0xb4:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0xb6:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0xb7:
- strncpy(buffer, "BSDI BSD/386 filesystem", buffer_size);
+ strlcpy(buffer, "BSDI BSD/386 filesystem", buffer_size);
break;
case 0xb8:
- strncpy(buffer, "BSDI BSD/386 swap partition", buffer_size);
+ strlcpy(buffer, "BSDI BSD/386 swap partition", buffer_size);
break;
case 0xbb:
- strncpy(buffer, "Boot Wizard hidden", buffer_size);
+ strlcpy(buffer, "Boot Wizard hidden", buffer_size);
break;
case 0xbe:
- strncpy(buffer, "Solaris 8 boot partition", buffer_size);
+ strlcpy(buffer, "Solaris 8 boot partition", buffer_size);
break;
case 0xc0:
- strncpy(buffer, "CTOS", buffer_size);
+ strlcpy(buffer, "CTOS", buffer_size);
break;
- //case 0xc0: strncpy(buffer, "REAL/32 secure small partition", buffer_size); break;
- //case 0xc0: strncpy(buffer, "NTFT Partition", buffer_size); break;
+ //case 0xc0: strlcpy(buffer, "REAL/32 secure small partition", buffer_size); break;
+ //case 0xc0: strlcpy(buffer, "NTFT Partition", buffer_size); break;
case 0xc1:
- strncpy(buffer, "DRDOS/secured (FAT-12)", buffer_size);
+ strlcpy(buffer, "DRDOS/secured (FAT-12)", buffer_size);
break;
case 0xc2:
- strncpy(buffer, "Reserved for DR-DOS 7+", buffer_size);
+ strlcpy(buffer, "Reserved for DR-DOS 7+", buffer_size);
break;
- //case 0xc2: strncpy(buffer, "Hidden Linux", buffer_size); break;
+ //case 0xc2: strlcpy(buffer, "Hidden Linux", buffer_size); break;
case 0xc3:
- strncpy(buffer, "Hidden Linux swap", buffer_size);
+ strlcpy(buffer, "Hidden Linux swap", buffer_size);
break;
case 0xc4:
- strncpy(buffer, "DRDOS/secured (FAT-16, < 32M)", buffer_size);
+ strlcpy(buffer, "DRDOS/secured (FAT-16, < 32M)", buffer_size);
break;
case 0xc5:
- strncpy(buffer, "DRDOS/secured (extended)", buffer_size);
+ strlcpy(buffer, "DRDOS/secured (extended)", buffer_size);
break;
case 0xc6:
- strncpy(buffer, "DRDOS/secured (FAT-16, >= 32M)", buffer_size);
+ strlcpy(buffer, "DRDOS/secured (FAT-16, >= 32M)", buffer_size);
break;
- //case 0xc6: strncpy(buffer, "Windows NT corrupted FAT16 volume/stripe set", buffer_size); break;
+ //case 0xc6: strlcpy(buffer, "Windows NT corrupted FAT16 volume/stripe set", buffer_size); break;
case 0xc7:
- strncpy(buffer, "Windows NT corrupted NTFS volume/stripe set",
+ strlcpy(buffer, "Windows NT corrupted NTFS volume/stripe set",
buffer_size);
break;
- //case 0xc7: strncpy(buffer, "Syrinx boot", buffer_size); break;
+ //case 0xc7: strlcpy(buffer, "Syrinx boot", buffer_size); break;
case 0xc8:
- strncpy(buffer, "(See also ID c2.)", buffer_size);
+ strlcpy(buffer, "(See also ID c2.)", buffer_size);
break;
case 0xc9:
- strncpy(buffer, "(See also ID c2.)", buffer_size);
+ strlcpy(buffer, "(See also ID c2.)", buffer_size);
break;
case 0xca:
- strncpy(buffer, "(See also ID c2.)", buffer_size);
+ strlcpy(buffer, "(See also ID c2.)", buffer_size);
break;
case 0xcb:
- strncpy(buffer, "reserved for DRDOS/secured (FAT32)", buffer_size);
+ strlcpy(buffer, "reserved for DRDOS/secured (FAT32)", buffer_size);
break;
case 0xcc:
- strncpy(buffer, "reserved for DRDOS/secured (FAT32, LBA)", buffer_size);
+ strlcpy(buffer, "reserved for DRDOS/secured (FAT32, LBA)", buffer_size);
break;
case 0xcd:
- strncpy(buffer, "CTOS Memdump?", buffer_size);
+ strlcpy(buffer, "CTOS Memdump?", buffer_size);
break;
case 0xce:
- strncpy(buffer, "reserved for DRDOS/secured (FAT16, LBA)", buffer_size);
+ strlcpy(buffer, "reserved for DRDOS/secured (FAT16, LBA)", buffer_size);
break;
case 0xd0:
- strncpy(buffer, "REAL/32 secure big partition", buffer_size);
+ strlcpy(buffer, "REAL/32 secure big partition", buffer_size);
break;
case 0xd1:
- strncpy(buffer, "Old Multiuser DOS secured FAT12", buffer_size);
+ strlcpy(buffer, "Old Multiuser DOS secured FAT12", buffer_size);
break;
case 0xd4:
- strncpy(buffer, "Old Multiuser DOS secured FAT16 <32M", buffer_size);
+ strlcpy(buffer, "Old Multiuser DOS secured FAT16 <32M", buffer_size);
break;
case 0xd5:
- strncpy(buffer, "Old Multiuser DOS secured extended partition",
+ strlcpy(buffer, "Old Multiuser DOS secured extended partition",
buffer_size);
break;
case 0xd6:
- strncpy(buffer, "Old Multiuser DOS secured FAT16 >=32M", buffer_size);
+ strlcpy(buffer, "Old Multiuser DOS secured FAT16 >=32M", buffer_size);
break;
case 0xd8:
- strncpy(buffer, "CP/M-86", buffer_size);
+ strlcpy(buffer, "CP/M-86", buffer_size);
break;
case 0xda:
- strncpy(buffer, "Non-FS Data", buffer_size);
+ strlcpy(buffer, "Non-FS Data", buffer_size);
break;
case 0xdb:
- strncpy(buffer,
+ strlcpy(buffer,
"Digital Research CP/M, Concurrent CP/M, Concurrent DOS",
buffer_size);
break;
- //case 0xdb: strncpy(buffer, "CTOS (Convergent Technologies OS -Unisys)", buffer_size); break;
- //case 0xdb: strncpy(buffer, "KDG Telemetry SCPU boot", buffer_size); break;
+ //case 0xdb: strlcpy(buffer, "CTOS (Convergent Technologies OS -Unisys)", buffer_size); break;
+ //case 0xdb: strlcpy(buffer, "KDG Telemetry SCPU boot", buffer_size); break;
case 0xdd:
- strncpy(buffer, "Hidden CTOS Memdump?", buffer_size);
+ strlcpy(buffer, "Hidden CTOS Memdump?", buffer_size);
break;
case 0xde:
- strncpy(buffer, "Dell PowerEdge Server utilities (FAT fs)",
+ strlcpy(buffer, "Dell PowerEdge Server utilities (FAT fs)",
buffer_size);
break;
case 0xdf:
- strncpy(buffer, "DG/UX virtual disk manager partition", buffer_size);
+ strlcpy(buffer, "DG/UX virtual disk manager partition", buffer_size);
break;
- //case 0xdf: strncpy(buffer, "BootIt EMBRM", buffer_size); break;
+ //case 0xdf: strlcpy(buffer, "BootIt EMBRM", buffer_size); break;
case 0xe0:
- strncpy(buffer,
+ strlcpy(buffer,
"Reserved by STMicroelectronics for a filesystem called ST AVFS.",
buffer_size);
break;
case 0xe1:
- strncpy(buffer, "DOS access or SpeedStor 12-bit FAT extended partition",
+ strlcpy(buffer, "DOS access or SpeedStor 12-bit FAT extended partition",
buffer_size);
break;
case 0xe3:
- strncpy(buffer, "DOS R/O or SpeedStor", buffer_size);
+ strlcpy(buffer, "DOS R/O or SpeedStor", buffer_size);
break;
case 0xe4:
- strncpy(buffer, "SpeedStor 16-bit FAT extended partition < 1024 cyl.",
+ strlcpy(buffer, "SpeedStor 16-bit FAT extended partition < 1024 cyl.",
buffer_size);
break;
case 0xe5:
- strncpy(buffer,
+ strlcpy(buffer,
"Tandy DOS with logical sectored FAT (According to Powerquest.)",
buffer_size);
break;
- //case 0xe5: strncpy(buffer, "Reserved", buffer_size); break;
+ //case 0xe5: strlcpy(buffer, "Reserved", buffer_size); break;
case 0xe6:
- strncpy(buffer, "Reserved", buffer_size);
+ strlcpy(buffer, "Reserved", buffer_size);
break;
case 0xeb:
- strncpy(buffer, "BFS (aka BeFS)", buffer_size);
+ strlcpy(buffer, "BFS (aka BeFS)", buffer_size);
break;
case 0xed:
- strncpy(buffer, "Reserved for Matthias Paul's Sprytix", buffer_size);
+ strlcpy(buffer, "Reserved for Matthias Paul's Sprytix", buffer_size);
break;
case 0xee:
- strncpy(buffer,
+ strlcpy(buffer,
"Indication that this legacy MBR is followed by an EFI header",
buffer_size);
break;
case 0xef:
- strncpy(buffer, "Partition that contains an EFI file system",
+ strlcpy(buffer, "Partition that contains an EFI file system",
buffer_size);
break;
case 0xf0:
- strncpy(buffer, "Linux/PA-RISC boot loader", buffer_size);
+ strlcpy(buffer, "Linux/PA-RISC boot loader", buffer_size);
break;
case 0xf1:
- strncpy(buffer, "SpeedStor", buffer_size);
+ strlcpy(buffer, "SpeedStor", buffer_size);
break;
case 0xf2:
- strncpy(buffer,
+ strlcpy(buffer,
"DOS 3.3+ secondary partition (Powerquest writes: Unisys DOS with logical sectored FAT.)",
buffer_size);
break;
case 0xf3:
- strncpy(buffer,
+ strlcpy(buffer,
"Reserved (Powerquest writes: Storage Dimensions SpeedStor.)",
buffer_size);
break;
case 0xf4:
- strncpy(buffer, "SpeedStor large partition", buffer_size);
+ strlcpy(buffer, "SpeedStor large partition", buffer_size);
break;
- //case 0xf4: strncpy(buffer, "Prologue single-volume partition", buffer_size); break;
+ //case 0xf4: strlcpy(buffer, "Prologue single-volume partition", buffer_size); break;
case 0xf5:
- strncpy(buffer, "Prologue multi-volume partition", buffer_size);
+ strlcpy(buffer, "Prologue multi-volume partition", buffer_size);
break;
case 0xf6:
- strncpy(buffer,
+ strlcpy(buffer,
"Reserved (Powerquest writes: Storage Dimensions SpeedStor. )",
buffer_size);
break;
case 0xfa:
- strncpy(buffer, "Bochs", buffer_size);
+ strlcpy(buffer, "Bochs", buffer_size);
break;
case 0xfb:
- strncpy(buffer, "VMware File System partition", buffer_size);
+ strlcpy(buffer, "VMware File System partition", buffer_size);
break;
case 0xfc:
- strncpy(buffer, "VMware Swap partition", buffer_size);
+ strlcpy(buffer, "VMware Swap partition", buffer_size);
break;
case 0xfd:
- strncpy(buffer,
+ strlcpy(buffer,
"Linux raid partition with autodetect using persistent superblock (Powerquest writes: Reserved for FreeDOS. )",
buffer_size);
break;
case 0xfe:
- strncpy(buffer, "SpeedStor > 1024 cyl.", buffer_size);
+ strlcpy(buffer, "SpeedStor > 1024 cyl.", buffer_size);
break;
- //case 0xfe: strncpy(buffer, "LANstep", buffer_size); break;
- //case 0xfe: strncpy(buffer, "IBM PS/2 IML (Initial Microcode Load) partition, located at the end of the disk.", buffer_size); break;
- //case 0xfe: strncpy(buffer, "Windows NT Disk Administrator hidden partition", buffer_size); break;
- //case 0xfe: strncpy(buffer, "Linux Logical Volume Manager partition (old)", buffer_size); break;
+ //case 0xfe: strlcpy(buffer, "LANstep", buffer_size); break;
+ //case 0xfe: strlcpy(buffer, "IBM PS/2 IML (Initial Microcode Load) partition, located at the end of the disk.", buffer_size); break;
+ //case 0xfe: strlcpy(buffer, "Windows NT Disk Administrator hidden partition", buffer_size); break;
+ //case 0xfe: strlcpy(buffer, "Linux Logical Volume Manager partition (old)", buffer_size); break;
case 0xff:
- strncpy(buffer, "Xenix Bad Block Table ", buffer_size);
+ strlcpy(buffer, "Xenix Bad Block Table ", buffer_size);
break;
default:
- strncpy(buffer, "Unknown", buffer_size);
+ strlcpy(buffer, "Unknown", buffer_size);
break;
}
}
diff --git a/com32/gpllib/disk/mbrs.c b/com32/gpllib/disk/mbrs.c
index b468f791..41bb20c6 100644
--- a/com32/gpllib/disk/mbrs.c
+++ b/com32/gpllib/disk/mbrs.c
@@ -30,73 +30,75 @@ void get_mbr_string(const uint32_t label, char *buffer, const int buffer_size)
case 0xfa33:
case 0xfab8:
case 0xfabe:
- strncpy(buffer, "No bootloader", buffer_size - 1);
+ strlcpy(buffer, "No bootloader", buffer_size - 1);
break;
case 0x0ebe:
- strncpy(buffer, "ThinkPad", buffer_size - 1);
+ strlcpy(buffer, "ThinkPad", buffer_size - 1);
break;
case 0x31c0:
- strncpy(buffer, "Acer 3", buffer_size - 1);
+ strlcpy(buffer, "Acer 3", buffer_size - 1);
break;
case 0x33c0:
- strncpy(buffer, "Windows", buffer_size - 1);
+ strlcpy(buffer, "Windows", buffer_size - 1);
break;
case 0x33ff:
- strncpy(buffer, "HP/Gateway", buffer_size - 1);
+ strlcpy(buffer, "HP/Gateway", buffer_size - 1);
break;
case 0xb800:
- strncpy(buffer, "PloP", buffer_size - 1);
+ strlcpy(buffer, "PloP", buffer_size - 1);
break;
case 0xea05:
- strncpy(buffer, "XOSL", buffer_size - 1);
+ strlcpy(buffer, "XOSL", buffer_size - 1);
break;
case 0xea1e:
- strncpy(buffer, "Truecrypt Boot Loader", buffer_size - 1);
+ strlcpy(buffer, "Truecrypt Boot Loader", buffer_size - 1);
break;
case 0xeb04:
- strncpy(buffer, "Solaris", buffer_size - 1);
+ strlcpy(buffer, "Solaris", buffer_size - 1);
break;
case 0xeb48:
- strncpy(buffer, "Grub", buffer_size - 1);
+ strlcpy(buffer, "Grub", buffer_size - 1);
break;
case 0xeb4c:
- strncpy(buffer, "Grub2 (v1.96)", buffer_size - 1);
+ strlcpy(buffer, "Grub2 (v1.96)", buffer_size - 1);
break;
case 0xeb63:
- strncpy(buffer, "Grub2 (v1.97)", buffer_size - 1);
+ strlcpy(buffer, "Grub2 (v1.97)", buffer_size - 1);
break;
case 0xeb5e:
/* We need more than 2 bytes */
if (((label >> 8) & 0xff) == 0x00)
- strncpy(buffer, "fbinst", buffer_size - 1);
+ strlcpy(buffer, "fbinst", buffer_size - 1);
else if (((label >> 8) & 0xff) == 0x80)
- strncpy(buffer, "Grub4Dos", buffer_size - 1);
+ strlcpy(buffer, "Grub4Dos", buffer_size - 1);
+ else if (((label >> 8) & 0xff) == 0x90)
+ strlcpy(buffer, "WEE", buffer_size - 1);
else
- strncpy(buffer, "Unknown mbr", buffer_size - 1);
+ strlcpy(buffer, "Unknown mbr", buffer_size - 1);
break;
case 0xfa31:
/* We need more than 2 bytes */
if (((label >> 8) & 0xff) == 0xc9)
- strncpy(buffer, "Master Boot LoaDeR", buffer_size - 1);
+ strlcpy(buffer, "Master Boot LoaDeR", buffer_size - 1);
else if (((label >> 8) & 0xff) == 0xc0)
- strncpy(buffer, "Syslinux", buffer_size - 1);
+ strlcpy(buffer, "Syslinux", buffer_size - 1);
else
- strncpy(buffer, "Unknown mbr", buffer_size - 1);
+ strlcpy(buffer, "Unknown mbr", buffer_size - 1);
break;
case 0xfaeb:
- strncpy(buffer, "Lilo", buffer_size - 1);
+ strlcpy(buffer, "Lilo", buffer_size - 1);
break;
case 0xfc31:
- strncpy(buffer, "Testdisk", buffer_size - 1);
+ strlcpy(buffer, "Testdisk", buffer_size - 1);
break;
case 0xfc33:
- strncpy(buffer, "GAG", buffer_size - 1);
+ strlcpy(buffer, "GAG", buffer_size - 1);
break;
case 0xfceb:
- strncpy(buffer, "BootIT NG", buffer_size - 1);
+ strlcpy(buffer, "BootIT NG", buffer_size - 1);
break;
default:
- strncpy(buffer, "Unknown mbr", buffer_size - 1);
+ strlcpy(buffer, "Unknown mbr", buffer_size - 1);
break;
}
diff --git a/com32/gpllib/disk/msdos.c b/com32/gpllib/disk/msdos.c
index affec43b..a4ee60fb 100644
--- a/com32/gpllib/disk/msdos.c
+++ b/com32/gpllib/disk/msdos.c
@@ -20,13 +20,13 @@
#include <disk/partition.h>
#include <disk/read.h>
-static inline int is_extended_partition(struct part_entry *ptab)
+static int is_extended_partition(struct part_entry *ptab)
{
return (ptab->ostype == 0x05 ||
ptab->ostype == 0x0f || ptab->ostype == 0x85);
}
-static inline int msdos_magic_present(const char *ptab)
+static int msdos_magic_present(const char *ptab)
{
return (*(uint16_t *) (ptab + 0x1fe) == 0xaa55);
}
diff --git a/com32/gpllib/dmi/dmi.c b/com32/gpllib/dmi/dmi.c
index d333b9ab..507b11ac 100644
--- a/com32/gpllib/dmi/dmi.c
+++ b/com32/gpllib/dmi/dmi.c
@@ -73,11 +73,11 @@ static void dmi_on_board_devices(struct dmi_header *h, s_dmi * dmi)
&& i <
sizeof dmi->base_board.devices_information /
sizeof *dmi->base_board.devices_information; i++) {
- strncpy(dmi->base_board.devices_information[i].type,
+ strlcpy(dmi->base_board.devices_information[i].type,
dmi_on_board_devices_type(p[2 * i] & 0x7F),
sizeof dmi->base_board.devices_information[i].type);
dmi->base_board.devices_information[i].status = p[2 * i] & 0x80;
- strncpy(dmi->base_board.devices_information[i].description,
+ strlcpy(dmi->base_board.devices_information[i].description,
dmi_string(h, p[2 * i + 1]),
sizeof dmi->base_board.devices_information[i].description);
}
@@ -103,7 +103,7 @@ static const char *dmi_system_reset_boot_option(uint8_t code)
static void dmi_system_reset_count(uint16_t code, char *array)
{
if (code == 0xFFFF)
- strncpy(array, "Unknown", sizeof array);
+ strlcpy(array, "Unknown", sizeof array);
else
snprintf(array, sizeof array, "%u", code);
}
@@ -111,7 +111,7 @@ static void dmi_system_reset_count(uint16_t code, char *array)
static void dmi_system_reset_timer(uint16_t code, char *array)
{
if (code == 0xFFFF)
- strncpy(array, "Unknown", sizeof array);
+ strlcpy(array, "Unknown", sizeof array);
else
snprintf(array, sizeof array, "%u min", code);
}
@@ -179,22 +179,22 @@ static void dmi_system_boot_status(uint8_t code, char *array)
};
if (code <= 8)
- strncpy(array, status[code], SYSTEM_BOOT_STATUS_SIZE);
+ strlcpy(array, status[code], SYSTEM_BOOT_STATUS_SIZE);
if (code >= 128 && code <= 191)
- strncpy(array, "OEM-specific", SYSTEM_BOOT_STATUS_SIZE);
+ strlcpy(array, "OEM-specific", SYSTEM_BOOT_STATUS_SIZE);
if (code >= 192)
- strncpy(array, "Product-specific", SYSTEM_BOOT_STATUS_SIZE);
+ strlcpy(array, "Product-specific", SYSTEM_BOOT_STATUS_SIZE);
}
void dmi_bios_runtime_size(uint32_t code, s_dmi * dmi)
{
if (code & 0x000003FF) {
dmi->bios.runtime_size = code;
- strncpy(dmi->bios.runtime_size_unit, "bytes",
+ strlcpy(dmi->bios.runtime_size_unit, "bytes",
sizeof(dmi->bios.runtime_size_unit));
} else {
dmi->bios.runtime_size = code >> 10;
- strncpy(dmi->bios.runtime_size_unit, "KB",
+ strlcpy(dmi->bios.runtime_size_unit, "KB",
sizeof(dmi->bios.runtime_size_unit));
}
@@ -279,10 +279,10 @@ void dmi_system_wake_up_type(uint8_t code, s_dmi * dmi)
};
if (code <= 0x08) {
- strncpy(dmi->system.wakeup_type, type[code],
+ strlcpy(dmi->system.wakeup_type, type[code],
sizeof(dmi->system.wakeup_type));
} else {
- strncpy(dmi->system.wakeup_type, out_of_spec,
+ strlcpy(dmi->system.wakeup_type, out_of_spec,
sizeof(dmi->system.wakeup_type));
}
return;
@@ -516,6 +516,8 @@ int dmi_iterate(s_dmi * dmi)
int found = 0;
/* Cleaning structures */
+ memset(dmi, 0, sizeof(s_dmi));
+
memset(&dmi->base_board, 0, sizeof(s_base_board));
memset(&dmi->battery, 0, sizeof(s_battery));
memset(&dmi->bios, 0, sizeof(s_bios));
@@ -579,16 +581,16 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
if (h->length < 0x12)
break;
dmi->bios.filled = true;
- strncpy(dmi->bios.vendor, dmi_string(h, data[0x04]),
+ strlcpy(dmi->bios.vendor, dmi_string(h, data[0x04]),
sizeof(dmi->bios.vendor));
- strncpy(dmi->bios.version, dmi_string(h, data[0x05]),
+ strlcpy(dmi->bios.version, dmi_string(h, data[0x05]),
sizeof(dmi->bios.version));
- strncpy(dmi->bios.release_date, dmi_string(h, data[0x08]),
+ strlcpy(dmi->bios.release_date, dmi_string(h, data[0x08]),
sizeof(dmi->bios.release_date));
dmi->bios.address = WORD(data + 0x06);
dmi_bios_runtime_size((0x10000 - WORD(data + 0x06)) << 4, dmi);
dmi->bios.rom_size = (data[0x09] + 1) << 6;
- strncpy(dmi->bios.rom_size_unit, "kB", sizeof(dmi->bios.rom_size_unit));
+ strlcpy(dmi->bios.rom_size_unit, "kB", sizeof(dmi->bios.rom_size_unit));
dmi_bios_characteristics(QWORD(data + 0x0A), dmi);
if (h->length < 0x13)
@@ -611,13 +613,13 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
if (h->length < 0x08)
break;
dmi->system.filled = true;
- strncpy(dmi->system.manufacturer, dmi_string(h, data[0x04]),
+ strlcpy(dmi->system.manufacturer, dmi_string(h, data[0x04]),
sizeof(dmi->system.manufacturer));
- strncpy(dmi->system.product_name, dmi_string(h, data[0x05]),
+ strlcpy(dmi->system.product_name, dmi_string(h, data[0x05]),
sizeof(dmi->system.product_name));
- strncpy(dmi->system.version, dmi_string(h, data[0x06]),
+ strlcpy(dmi->system.version, dmi_string(h, data[0x06]),
sizeof(dmi->system.version));
- strncpy(dmi->system.serial, dmi_string(h, data[0x07]),
+ strlcpy(dmi->system.serial, dmi_string(h, data[0x07]),
sizeof(dmi->system.serial));
if (h->length < 0x19)
break;
@@ -625,9 +627,9 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
dmi_system_wake_up_type(data[0x18], dmi);
if (h->length < 0x1B)
break;
- strncpy(dmi->system.sku_number, dmi_string(h, data[0x19]),
+ strlcpy(dmi->system.sku_number, dmi_string(h, data[0x19]),
sizeof(dmi->system.sku_number));
- strncpy(dmi->system.family, dmi_string(h, data[0x1A]),
+ strlcpy(dmi->system.family, dmi_string(h, data[0x1A]),
sizeof(dmi->system.family));
break;
@@ -635,22 +637,22 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
if (h->length < 0x08)
break;
dmi->base_board.filled = true;
- strncpy(dmi->base_board.manufacturer, dmi_string(h, data[0x04]),
+ strlcpy(dmi->base_board.manufacturer, dmi_string(h, data[0x04]),
sizeof(dmi->base_board.manufacturer));
- strncpy(dmi->base_board.product_name, dmi_string(h, data[0x05]),
+ strlcpy(dmi->base_board.product_name, dmi_string(h, data[0x05]),
sizeof(dmi->base_board.product_name));
- strncpy(dmi->base_board.version, dmi_string(h, data[0x06]),
+ strlcpy(dmi->base_board.version, dmi_string(h, data[0x06]),
sizeof(dmi->base_board.version));
- strncpy(dmi->base_board.serial, dmi_string(h, data[0x07]),
+ strlcpy(dmi->base_board.serial, dmi_string(h, data[0x07]),
sizeof(dmi->base_board.serial));
if (h->length < 0x0F)
break;
- strncpy(dmi->base_board.asset_tag, dmi_string(h, data[0x08]),
+ strlcpy(dmi->base_board.asset_tag, dmi_string(h, data[0x08]),
sizeof(dmi->base_board.asset_tag));
dmi_base_board_features(data[0x09], dmi);
- strncpy(dmi->base_board.location, dmi_string(h, data[0x0A]),
+ strlcpy(dmi->base_board.location, dmi_string(h, data[0x0A]),
sizeof(dmi->base_board.location));
- strncpy(dmi->base_board.type, dmi_string(h, data[0x0D]),
+ strlcpy(dmi->base_board.type, dmi_string(h, data[0x0D]),
sizeof(dmi->base_board.type));
if (h->length < 0x0F + data[0x0E] * sizeof(uint16_t))
break;
@@ -659,29 +661,29 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
if (h->length < 0x09)
break;
dmi->chassis.filled = true;
- strncpy(dmi->chassis.manufacturer, dmi_string(h, data[0x04]),
+ strlcpy(dmi->chassis.manufacturer, dmi_string(h, data[0x04]),
sizeof(dmi->chassis.manufacturer));
- strncpy(dmi->chassis.type, dmi_chassis_type(data[0x05] & 0x7F),
+ strlcpy(dmi->chassis.type, dmi_chassis_type(data[0x05] & 0x7F),
sizeof(dmi->chassis.type));
- strncpy(dmi->chassis.lock, dmi_chassis_lock(data[0x05] >> 7),
+ strlcpy(dmi->chassis.lock, dmi_chassis_lock(data[0x05] >> 7),
sizeof(dmi->chassis.lock));
- strncpy(dmi->chassis.version, dmi_string(h, data[0x06]),
+ strlcpy(dmi->chassis.version, dmi_string(h, data[0x06]),
sizeof(dmi->chassis.version));
- strncpy(dmi->chassis.serial, dmi_string(h, data[0x07]),
+ strlcpy(dmi->chassis.serial, dmi_string(h, data[0x07]),
sizeof(dmi->chassis.serial));
- strncpy(dmi->chassis.asset_tag, dmi_string(h, data[0x08]),
+ strlcpy(dmi->chassis.asset_tag, dmi_string(h, data[0x08]),
sizeof(dmi->chassis.asset_tag));
if (h->length < 0x0D)
break;
- strncpy(dmi->chassis.boot_up_state, dmi_chassis_state(data[0x09]),
+ strlcpy(dmi->chassis.boot_up_state, dmi_chassis_state(data[0x09]),
sizeof(dmi->chassis.boot_up_state));
- strncpy(dmi->chassis.power_supply_state,
+ strlcpy(dmi->chassis.power_supply_state,
dmi_chassis_state(data[0x0A]),
sizeof(dmi->chassis.power_supply_state));
- strncpy(dmi->chassis.thermal_state,
+ strlcpy(dmi->chassis.thermal_state,
dmi_chassis_state(data[0x0B]),
sizeof(dmi->chassis.thermal_state));
- strncpy(dmi->chassis.security_status,
+ strlcpy(dmi->chassis.security_status,
dmi_chassis_security_status(data[0x0C]),
sizeof(dmi->chassis.security_status));
if (h->length < 0x11)
@@ -698,31 +700,31 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
if (h->length < 0x1A)
break;
dmi->processor.filled = true;
- strncpy(dmi->processor.socket_designation,
+ strlcpy(dmi->processor.socket_designation,
dmi_string(h, data[0x04]),
sizeof(dmi->processor.socket_designation));
- strncpy(dmi->processor.type,
+ strlcpy(dmi->processor.type,
dmi_processor_type(data[0x05]), sizeof(dmi->processor.type));
- strncpy(dmi->processor.manufacturer,
+ strlcpy(dmi->processor.manufacturer,
dmi_string(h, data[0x07]), sizeof(dmi->processor.manufacturer));
- strncpy(dmi->processor.family,
+ strlcpy(dmi->processor.family,
dmi_processor_family(data[0x06],
dmi->processor.manufacturer),
sizeof(dmi->processor.family));
dmi_processor_id(data[0x06], data + 8, dmi_string(h, data[0x10]), dmi);
- strncpy(dmi->processor.version,
+ strlcpy(dmi->processor.version,
dmi_string(h, data[0x10]), sizeof(dmi->processor.version));
dmi_processor_voltage(data[0x11], dmi);
dmi->processor.external_clock = WORD(data + 0x12);
dmi->processor.max_speed = WORD(data + 0x14);
dmi->processor.current_speed = WORD(data + 0x16);
if (data[0x18] & (1 << 6))
- strncpy(dmi->processor.status,
+ strlcpy(dmi->processor.status,
dmi_processor_status(data[0x18] & 0x07),
sizeof(dmi->processor.status));
else
sprintf(dmi->processor.status, "Unpopulated");
- strncpy(dmi->processor.upgrade,
+ strlcpy(dmi->processor.upgrade,
dmi_processor_upgrade(data[0x19]),
sizeof(dmi->processor.upgrade));
if (h->length < 0x20)
@@ -735,11 +737,11 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
dmi->processor.cache3);
if (h->length < 0x23)
break;
- strncpy(dmi->processor.serial, dmi_string(h, data[0x20]),
+ strlcpy(dmi->processor.serial, dmi_string(h, data[0x20]),
sizeof(dmi->processor.serial));
- strncpy(dmi->processor.asset_tag, dmi_string(h, data[0x21]),
+ strlcpy(dmi->processor.asset_tag, dmi_string(h, data[0x21]),
sizeof(dmi->processor.asset_tag));
- strncpy(dmi->processor.part_number, dmi_string(h, data[0x22]),
+ strlcpy(dmi->processor.part_number, dmi_string(h, data[0x22]),
sizeof(dmi->processor.part_number));
break;
case 6: /* 3.3.7 Memory Module Information */
@@ -749,13 +751,13 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
s_memory_module *module =
&dmi->memory_module[dmi->memory_module_count - 1];
dmi->memory_module[dmi->memory_module_count - 1].filled = true;
- strncpy(module->socket_designation, dmi_string(h, data[0x04]),
+ strlcpy(module->socket_designation, dmi_string(h, data[0x04]),
sizeof(module->socket_designation));
- dmi_memory_module_connections(data[0x05], module->bank_connections);
+ dmi_memory_module_connections(data[0x05], module->bank_connections, sizeof(module->bank_connections));
dmi_memory_module_speed(data[0x06], module->speed);
- dmi_memory_module_types(WORD(data + 0x07), " ", module->type);
- dmi_memory_module_size(data[0x09], module->installed_size);
- dmi_memory_module_size(data[0x0A], module->enabled_size);
+ dmi_memory_module_types(WORD(data + 0x07), " ", module->type, sizeof(module->type));
+ dmi_memory_module_size(data[0x09], module->installed_size, sizeof(module->installed_size));
+ dmi_memory_module_size(data[0x0A], module->enabled_size, sizeof(module->enabled_size));
dmi_memory_module_error(data[0x0B], "\t\t", module->error_status);
break;
case 7: /* 3.3.8 Cache Information */
@@ -764,7 +766,7 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
dmi->cache_count++;
if (dmi->cache_count > MAX_DMI_CACHE_ITEMS)
break;
- strncpy(dmi->cache[dmi->cache_count - 1].socket_designation,
+ strlcpy(dmi->cache[dmi->cache_count - 1].socket_designation,
dmi_string(h, data[0x04]),
sizeof(dmi->cache[dmi->cache_count - 1].socket_designation));
snprintf(dmi->cache[dmi->cache_count - 1].configuration,
@@ -774,10 +776,10 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
WORD(data +
0x05) & 0x0008 ? "Socketed" : "Not Socketed",
(WORD(data + 0x05) & 0x0007) + 1);
- strncpy(dmi->cache[dmi->cache_count - 1].mode,
+ strlcpy(dmi->cache[dmi->cache_count - 1].mode,
dmi_cache_mode((WORD(data + 0x05) >> 8) & 0x0003),
sizeof(dmi->cache[dmi->cache_count - 1].mode));
- strncpy(dmi->cache[dmi->cache_count - 1].location,
+ strlcpy(dmi->cache[dmi->cache_count - 1].location,
dmi_cache_location((WORD(data + 0x05) >> 5) & 0x0003),
sizeof(dmi->cache[dmi->cache_count - 1].location));
dmi->cache[dmi->cache_count - 1].installed_size =
@@ -791,13 +793,13 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
if (h->length < 0x13)
break;
dmi->cache[dmi->cache_count - 1].speed = data[0x0F]; /* ns */
- strncpy(dmi->cache[dmi->cache_count - 1].error_correction_type,
+ strlcpy(dmi->cache[dmi->cache_count - 1].error_correction_type,
dmi_cache_ec_type(data[0x10]),
sizeof(dmi->cache[dmi->cache_count - 1].error_correction_type));
- strncpy(dmi->cache[dmi->cache_count - 1].system_type,
+ strlcpy(dmi->cache[dmi->cache_count - 1].system_type,
dmi_cache_type(data[0x11]),
sizeof(dmi->cache[dmi->cache_count - 1].system_type));
- strncpy(dmi->cache[dmi->cache_count - 1].associativity,
+ strlcpy(dmi->cache[dmi->cache_count - 1].associativity,
dmi_cache_associativity(data[0x12]),
sizeof(dmi->cache[dmi->cache_count - 1].associativity));
break;
@@ -826,49 +828,49 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
dmi_memory_device_width(WORD(data + 0x08), mem->total_width);
dmi_memory_device_width(WORD(data + 0x0A), mem->data_width);
dmi_memory_device_size(WORD(data + 0x0C), mem->size);
- strncpy(mem->form_factor,
+ strlcpy(mem->form_factor,
dmi_memory_device_form_factor(data[0x0E]),
sizeof(mem->form_factor));
dmi_memory_device_set(data[0x0F], mem->device_set);
- strncpy(mem->device_locator, dmi_string(h, data[0x10]),
+ strlcpy(mem->device_locator, dmi_string(h, data[0x10]),
sizeof(mem->device_locator));
- strncpy(mem->bank_locator, dmi_string(h, data[0x11]),
+ strlcpy(mem->bank_locator, dmi_string(h, data[0x11]),
sizeof(mem->bank_locator));
- strncpy(mem->type, dmi_memory_device_type(data[0x12]),
+ strlcpy(mem->type, dmi_memory_device_type(data[0x12]),
sizeof(mem->type));
- dmi_memory_device_type_detail(WORD(data + 0x13), mem->type_detail);
+ dmi_memory_device_type_detail(WORD(data + 0x13), mem->type_detail, sizeof(mem->type_detail));
if (h->length < 0x17)
break;
dmi_memory_device_speed(WORD(data + 0x15), mem->speed);
if (h->length < 0x1B)
break;
- strncpy(mem->manufacturer, dmi_string(h, data[0x17]),
+ strlcpy(mem->manufacturer, dmi_string(h, data[0x17]),
sizeof(mem->manufacturer));
- strncpy(mem->serial, dmi_string(h, data[0x18]), sizeof(mem->serial));
- strncpy(mem->asset_tag, dmi_string(h, data[0x19]),
+ strlcpy(mem->serial, dmi_string(h, data[0x18]), sizeof(mem->serial));
+ strlcpy(mem->asset_tag, dmi_string(h, data[0x19]),
sizeof(mem->asset_tag));
- strncpy(mem->part_number, dmi_string(h, data[0x1A]),
+ strlcpy(mem->part_number, dmi_string(h, data[0x1A]),
sizeof(mem->part_number));
break;
case 22: /* 3.3.23 Portable Battery */
if (h->length < 0x10)
break;
dmi->battery.filled = true;
- strncpy(dmi->battery.location, dmi_string(h, data[0x04]),
+ strlcpy(dmi->battery.location, dmi_string(h, data[0x04]),
sizeof(dmi->battery.location));
- strncpy(dmi->battery.manufacturer, dmi_string(h, data[0x05]),
+ strlcpy(dmi->battery.manufacturer, dmi_string(h, data[0x05]),
sizeof(dmi->battery.manufacturer));
if (data[0x06] || h->length < 0x1A)
- strncpy(dmi->battery.manufacture_date,
+ strlcpy(dmi->battery.manufacture_date,
dmi_string(h, data[0x06]),
sizeof(dmi->battery.manufacture_date));
if (data[0x07] || h->length < 0x1A)
- strncpy(dmi->battery.serial, dmi_string(h, data[0x07]),
+ strlcpy(dmi->battery.serial, dmi_string(h, data[0x07]),
sizeof(dmi->battery.serial));
- strncpy(dmi->battery.name, dmi_string(h, data[0x08]),
+ strlcpy(dmi->battery.name, dmi_string(h, data[0x08]),
sizeof(dmi->battery.name));
if (data[0x09] != 0x02 || h->length < 0x1A)
- strncpy(dmi->battery.chemistry,
+ strlcpy(dmi->battery.chemistry,
dmi_battery_chemistry(data[0x09]),
sizeof(dmi->battery.chemistry));
if (h->length < 0x1A)
@@ -878,7 +880,7 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
dmi_battery_capacity(WORD(data + 0x0A), data[0x15],
dmi->battery.design_capacity);
dmi_battery_voltage(WORD(data + 0x0C), dmi->battery.design_voltage);
- strncpy(dmi->battery.sbds, dmi_string(h, data[0x0E]),
+ strlcpy(dmi->battery.sbds, dmi_string(h, data[0x0E]),
sizeof(dmi->battery.sbds));
dmi_battery_maximum_error(data[0x0F], dmi->battery.maximum_error);
if (h->length < 0x1A)
@@ -890,7 +892,7 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
1980 + (WORD(data + 0x12) >> 9),
(WORD(data + 0x12) >> 5) & 0x0F, WORD(data + 0x12) & 0x1F);
if (data[0x09] == 0x02)
- strncpy(dmi->battery.sbds_chemistry, dmi_string(h, data[0x14]),
+ strlcpy(dmi->battery.sbds_chemistry, dmi_string(h, data[0x14]),
sizeof(dmi->battery.sbds_chemistry));
// sprintf(dmi->battery.oem_info,"0x%08X",DWORD(h, data+0x16));
break;
@@ -902,10 +904,10 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
dmi->system.system_reset.watchdog = data[0x04] & (1 << 5);
if (!(data[0x04] & (1 << 5)))
break;
- strncpy(dmi->system.system_reset.boot_option,
+ strlcpy(dmi->system.system_reset.boot_option,
dmi_system_reset_boot_option((data[0x04] >> 1) & 0x3),
sizeof dmi->system.system_reset.boot_option);
- strncpy(dmi->system.system_reset.boot_option_on_limit,
+ strlcpy(dmi->system.system_reset.boot_option_on_limit,
dmi_system_reset_boot_option((data[0x04] >> 3) & 0x3),
sizeof dmi->system.system_reset.boot_option_on_limit);
dmi_system_reset_count(WORD(data + 0x05),
@@ -921,16 +923,16 @@ void dmi_decode(struct dmi_header *h, uint16_t ver, s_dmi * dmi)
if (h->length < 0x05)
break;
dmi->hardware_security.filled = true;
- strncpy(dmi->hardware_security.power_on_passwd_status,
+ strlcpy(dmi->hardware_security.power_on_passwd_status,
dmi_hardware_security_status(data[0x04] >> 6),
sizeof dmi->hardware_security.power_on_passwd_status);
- strncpy(dmi->hardware_security.keyboard_passwd_status,
+ strlcpy(dmi->hardware_security.keyboard_passwd_status,
dmi_hardware_security_status((data[0x04] >> 4) & 0x3),
sizeof dmi->hardware_security.keyboard_passwd_status);
- strncpy(dmi->hardware_security.administrator_passwd_status,
+ strlcpy(dmi->hardware_security.administrator_passwd_status,
dmi_hardware_security_status((data[0x04] >> 2) & 0x3),
sizeof dmi->hardware_security.administrator_passwd_status);
- strncpy(dmi->hardware_security.front_panel_reset_status,
+ strlcpy(dmi->hardware_security.front_panel_reset_status,
dmi_hardware_security_status(data[0x04] & 0x3),
sizeof dmi->hardware_security.front_panel_reset_status);
break;
diff --git a/com32/gpllib/dmi/dmi_memory.c b/com32/gpllib/dmi/dmi_memory.c
index a1f2b440..21458293 100644
--- a/com32/gpllib/dmi/dmi_memory.c
+++ b/com32/gpllib/dmi/dmi_memory.c
@@ -132,7 +132,7 @@ const char *dmi_memory_device_type(uint8_t code)
return out_of_spec;
}
-void dmi_memory_device_type_detail(uint16_t code, char *type_detail)
+void dmi_memory_device_type_detail(uint16_t code, char *type_detail, int sizeof_type_detail)
{
/* 3.3.18.3 */
static const char *detail[] = {
@@ -157,7 +157,7 @@ void dmi_memory_device_type_detail(uint16_t code, char *type_detail)
for (i = 1; i <= 12; i++)
if (code & (1 << i))
- snprintf(type_detail,sizeof(type_detail), "%s", detail[i - 1]);
+ snprintf(type_detail, sizeof_type_detail, "%s", detail[i - 1]);
}
}
@@ -173,7 +173,7 @@ void dmi_memory_device_speed(uint16_t code, char *speed)
* 3.3.7 Memory Module Information (Type 6)
*/
-void dmi_memory_module_types(uint16_t code, const char *sep, char *type)
+void dmi_memory_module_types(uint16_t code, const char *sep, char *type, int sizeof_type)
{
/* 3.3.7.1 */
static const char *types[] = {
@@ -197,11 +197,11 @@ void dmi_memory_module_types(uint16_t code, const char *sep, char *type)
for (i = 0; i <= 10; i++)
if (code & (1 << i))
- snprintf(type,sizeof(type), "%s%s%s", type, sep, types[i]);
+ snprintf(type, sizeof_type, "%s%s%s", type, sep, types[i]);
}
}
-void dmi_memory_module_connections(uint8_t code, char *connection)
+void dmi_memory_module_connections(uint8_t code, char *connection, int sizeof_connection)
{
if (code == 0xFF)
sprintf(connection, "%s", "None");
@@ -209,7 +209,7 @@ void dmi_memory_module_connections(uint8_t code, char *connection)
if ((code & 0xF0) != 0xF0)
sprintf(connection, "%u ", code >> 4);
if ((code & 0x0F) != 0x0F)
- snprintf(connection,sizeof(connection), "%s%u", connection, code & 0x0F);
+ snprintf(connection, sizeof_connection, "%s%u", connection, code & 0x0F);
}
}
@@ -221,7 +221,7 @@ void dmi_memory_module_speed(uint8_t code, char *speed)
sprintf(speed, "%u ns", code);
}
-void dmi_memory_module_size(uint8_t code, char *size)
+void dmi_memory_module_size(uint8_t code, char *size, int sizeof_size)
{
/* 3.3.7.2 */
switch (code & 0x7F) {
@@ -239,9 +239,9 @@ void dmi_memory_module_size(uint8_t code, char *size)
}
if (code & 0x80)
- snprintf(size,sizeof(size),"%s %s", size, "(Double-bank Connection)");
+ snprintf(size, sizeof_size, "%s %s", size, "(Double-bank Connection)");
else
- snprintf(size,sizeof(size), "%s %s", size, "(Single-bank Connection)");
+ snprintf(size, sizeof_size, "%s %s", size, "(Single-bank Connection)");
}
void dmi_memory_module_error(uint8_t code, const char *prefix, char *error)
diff --git a/com32/gpllib/memory.c b/com32/gpllib/memory.c
index d98de030..28a95ff4 100644
--- a/com32/gpllib/memory.c
+++ b/com32/gpllib/memory.c
@@ -44,7 +44,7 @@ void get_type(int type, char *type_ptr, int type_ptr_sz)
{
unsigned int real_type = type - 1;
if (real_type < sizeof(e820_types) / sizeof(e820_types[0]))
- strncpy(type_ptr, e820_types[real_type], type_ptr_sz);
+ strlcpy(type_ptr, e820_types[real_type], type_ptr_sz);
}
/**
diff --git a/com32/gpllib/vpd/vpd.c b/com32/gpllib/vpd/vpd.c
index 6507f0d4..0e2b148e 100644
--- a/com32/gpllib/vpd/vpd.c
+++ b/com32/gpllib/vpd/vpd.c
@@ -81,19 +81,19 @@ int vpd_decode(s_vpd * vpd)
printf("VPD: Bad checksum!\n");
}
- strncpy(vpd->bios_build_id, q + 0x0D, 9);
- strncpy(vpd->box_serial_number, q + 0x16, 7);
- strncpy(vpd->motherboard_serial_number, q + 0x1D, 11);
- strncpy(vpd->machine_type_model, q + 0x28, 7);
+ strlcpy(vpd->bios_build_id, q + 0x0D, 9);
+ strlcpy(vpd->box_serial_number, q + 0x16, 7);
+ strlcpy(vpd->motherboard_serial_number, q + 0x1D, 11);
+ strlcpy(vpd->machine_type_model, q + 0x28, 7);
if (q[5] < 0x44)
return VPD_TABLE_PRESENT;
- strncpy(vpd->bios_release_date, q + 0x30, 8);
- strncpy(vpd->default_flash_filename, q + 0x38, 12);
+ strlcpy(vpd->bios_release_date, q + 0x30, 8);
+ strlcpy(vpd->default_flash_filename, q + 0x38, 12);
if (q[5] >= 0x46 && q[0x44] != 0x00) {
- strncpy(vpd->bios_version, q + 0x44, 255);
+ strlcpy(vpd->bios_version, q + 0x44, 255);
}
return VPD_TABLE_PRESENT;
diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile
index 8cd96f2c..24e63c29 100644
--- a/com32/hdt/Makefile
+++ b/com32/hdt/Makefile
@@ -30,7 +30,7 @@ VERSION = $(shell $(SED) -n 's/\#define VERSION \"\(.*\)\"/\1/p' hdt.h)
CODENAME = $(shell $(SED) -n 's/\#define CODENAME \"\(.*\)\"/\1/p' hdt.h)
VERSION_C32 = $(shell echo $(VERSION) | $(SED) -e 's/-/_/g' | $(SED) -e 's/\./_/g')
-MEMTEST_URL = http://memtest.org/download/4.00/memtest86+-4.00.bin
+MEMTEST_URL = http://memtest.org/download/4.10/memtest86+-4.10.bin
MEMTEST = memtest.bin
KERNEL_VERSION ?= $(shell uname -r)
@@ -43,7 +43,6 @@ ISOLINUX_DIR ?= isolinux
FLOPPY_DIR ?= floppy
PCI_IDS_FILE ?= $(PWD)/$(FLOPPY_DIR)/pci.ids
GZ_PCI_IDS_FILE ?= $(PCI_IDS_FILE).gz
-REBOOT_COM32 ?= $(com32)/modules/reboot.c32
MENU_COM32 ?= $(com32)/menu/menu.c32
ART_DIR ?= art/
QEMU ?= qemu-kvm
@@ -56,7 +55,7 @@ hdt.elf : $(OBJS) $(LIBS) $(C_LIBS)
memtest:
-[ ! -f $(FLOPPY_DIR)/$(MEMTEST) ] && $(WGET) $(MEMTEST_URL) -O $(FLOPPY_DIR)/$(MEMTEST)
-hdt.img: hdt.c32 $(FLOPPY_DIR)/hdt.cfg $(FLOPPY_DIR)/mtools.conf $(topdir)/mtools/syslinux $(REBOOT_COM32) $(MENU_COM32) memtest
+hdt.img: hdt.c32 $(FLOPPY_DIR)/hdt.cfg $(FLOPPY_DIR)/mtools.conf $(topdir)/mtools/syslinux $(MENU_COM32) memtest
rm -f hdt*.img
$(SED) -e 's/%VERSION%/$(VERSION)/g' $(FLOPPY_DIR)/hdt.cfg |\
$(SED) -e 's/%CODENAME%/$(CODENAME)/g' > $(FLOPPY_DIR)/syslinux.cfg
@@ -68,7 +67,6 @@ hdt.img: hdt.c32 $(FLOPPY_DIR)/hdt.cfg $(FLOPPY_DIR)/mtools.conf $(topdir)/mtool
-[ -f $(MODULES_PCIMAP_FILE) ] && cat $(MODULES_PCIMAP_FILE) | $(GZIPPROG) - -f | MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) - a:modules.pcimap
MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) hdt.c32 a:
MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(MENU_COM32) a:
- MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(REBOOT_COM32) a:
@ [ -f $(GZ_PCI_IDS_FILE) ] && MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(GZ_PCI_IDS_FILE) a:pci.ids || printf "\nThe $(GZ_PCI_IDS_FILE) file is missing and can be downloaded from http://pciids.sourceforge.net and gzipped in\nthe ./com32/hdt/$(FLOPPY_DIR) directory of the extracted Syslinux source.\n\n"
MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(FLOPPY_DIR)/syslinux.cfg a:
MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(FLOPPY_DIR)/$(MEMTEST) a:
@@ -89,7 +87,6 @@ hdt.iso: hdt.c32 $(topdir)/core/isolinux.bin $(FLOPPY_DIR)/hdt.cfg memtest
$(SED) -e 's/%VERSION%/$(VERSION)/g' $(FLOPPY_DIR)/hdt.cfg |\
$(SED) -e 's/%CODENAME%/$(CODENAME)/g' > $(ISO_DIR)/$(ISOLINUX_DIR)/isolinux.cfg
cp hdt.c32 $(ISO_DIR)/$(ISOLINUX_DIR)
- cp $(REBOOT_COM32) $(ISO_DIR)/$(ISOLINUX_DIR)
cp $(FLOPPY_DIR)/$(MEMTEST) $(ISO_DIR)/$(ISOLINUX_DIR)
cp $(MENU_COM32) $(ISO_DIR)/$(ISOLINUX_DIR)
cp -av $(ART_DIR)/backgnd.png $(ISO_DIR)/$(ISOLINUX_DIR)
diff --git a/com32/hdt/floppy/hdt.cfg b/com32/hdt/floppy/hdt.cfg
index 27d11bac..1350521a 100644
--- a/com32/hdt/floppy/hdt.cfg
+++ b/com32/hdt/floppy/hdt.cfg
@@ -71,8 +71,8 @@ APPEND modules_pcimap=modules.pcimap modules_alias=modules.alias pciids=pci.ids
MENU SEPARATOR
LABEL memtest
-MENU LABEL Memtest86+ 4.00
+MENU LABEL Memtest86+ 4.10
TEXT HELP
- Starts Memtest86+ 4.00
+ Starts Memtest86+ 4.10
ENDTEXT
LINUX memtest.bin
diff --git a/com32/hdt/hdt-cli-cpu.c b/com32/hdt/hdt-cli-cpu.c
index 170de9a3..de0c9cde 100644
--- a/com32/hdt/hdt-cli-cpu.c
+++ b/com32/hdt/hdt-cli-cpu.c
@@ -84,7 +84,7 @@ static void show_flag(char *buffer, bool flag, char *flag_name, bool flush)
if ((((strlen(buffer) + strlen(flag_name)) > 66) && flag) || flush) {
snprintf(output_buffer, sizeof output_buffer, "Flags : %s\n",
buffer);
- more_printf(output_buffer);
+ more_printf("%s", output_buffer);
memset(buffer, 0, sizeof(buffer));
if (flush)
return;
diff --git a/com32/hdt/hdt-cli-hdt.c b/com32/hdt/hdt-cli-hdt.c
index f52bcae0..65068232 100644
--- a/com32/hdt/hdt-cli-hdt.c
+++ b/com32/hdt/hdt-cli-hdt.c
@@ -30,6 +30,7 @@
#include <string.h>
#include <stdlib.h>
#include <syslinux/config.h>
+#include <syslinux/reboot.h>
#include "hdt-menu.h"
#include "hdt-cli.h"
@@ -244,11 +245,9 @@ void main_show_hdt(int argc __unused, char **argv __unused,
static void do_reboot(int argc __unused, char **argv __unused,
struct s_hardware *hardware)
{
- /* Use specific syslinux call if needed */
- if (issyslinux())
- return runsyslinuxcmd(hardware->reboot_label);
- else
- return csprint(hardware->reboot_label, 0x07);
+ (void) hardware;
+ /* Let's call the internal rebooting call */
+ syslinux_reboot(1);
}
/* Default hdt mode */
diff --git a/com32/hdt/hdt-cli-kernel.c b/com32/hdt/hdt-cli-kernel.c
index aaa177ef..89d013b4 100644
--- a/com32/hdt/hdt-cli-kernel.c
+++ b/com32/hdt/hdt-cli-kernel.c
@@ -82,7 +82,7 @@ void main_show_kernel(int argc __unused, char **argv __unused,
}
if (found == true) {
strncat(buffer, "\n", 1);
- more_printf(buffer);
+ more_printf("%s", buffer);
}
}
diff --git a/com32/hdt/hdt-cli-pci.c b/com32/hdt/hdt-cli-pci.c
index 42571cfc..07c079d5 100644
--- a/com32/hdt/hdt-cli-pci.c
+++ b/com32/hdt/hdt-cli-pci.c
@@ -205,8 +205,8 @@ static void show_pci_devices(int argc __unused, char **argv __unused,
pci_device->product,
pci_device->sub_vendor, pci_device->sub_product);
- more_printf(first_line);
- more_printf(second_line);
+ more_printf("%s", first_line);
+ more_printf("%s", second_line);
more_printf("\n");
} else if (nopciids == true) {
if (nomodulesfile == true) {
diff --git a/com32/hdt/hdt-cli-pxe.c b/com32/hdt/hdt-cli-pxe.c
index faba0436..d906b947 100644
--- a/com32/hdt/hdt-cli-pxe.c
+++ b/com32/hdt/hdt-cli-pxe.c
@@ -65,14 +65,14 @@ void main_show_pxe(int argc __unused, char **argv __unused,
snprintf(buffer, sizeof(buffer),
" PCI Bus pos. : %02x:%02x.%02x\n", p->pci_bus,
p->pci_dev, p->pci_func);
- more_printf(buffer);
+ more_printf("%s", buffer);
} else {
snprintf(buffer, sizeof(buffer), " Manufacturer : %s \n",
p->pci_device->dev_info->vendor_name);
- more_printf(buffer);
+ more_printf("%s", buffer);
snprintf(buffer, sizeof(buffer), " Product : %s \n",
p->pci_device->dev_info->product_name);
- more_printf(buffer);
+ more_printf("%s", buffer);
}
more_printf(" Addresses : %d.%d.%d.%d @ %s\n", p->ip_addr[0],
p->ip_addr[1], p->ip_addr[2], p->ip_addr[3], p->mac_addr);
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c
index 91c8e8f9..8b5335eb 100644
--- a/com32/hdt/hdt-cli.c
+++ b/com32/hdt/hdt-cli.c
@@ -87,7 +87,7 @@ static void autocomplete_add_token_to_list(const char *token)
{
struct autocomplete_list *new = malloc(sizeof(struct autocomplete_list));
- strncpy(new->autocomplete_token, token, sizeof(new->autocomplete_token));
+ strlcpy(new->autocomplete_token, token, sizeof(new->autocomplete_token));
new->next = NULL;
autocomplete_backlog++;
@@ -273,13 +273,13 @@ static void expand_aliases(char *line __unused, char **command, char **module,
*argc = 1;
*argv = malloc(*argc * sizeof(char *));
argv[0] = malloc((sizeof(*command) + 1) * sizeof(char));
- strncpy(argv[0], *command, sizeof(*command) + 1);
+ strlcpy(argv[0], *command, sizeof(*command) + 1);
dprintf("CLI DEBUG: ALIAS %s ", *command);
- strncpy(*command, CLI_SET, sizeof(CLI_SET)); /* set */
+ strlcpy(*command, CLI_SET, sizeof(CLI_SET)); /* set */
*module = malloc(sizeof(CLI_MODE) * sizeof(char));
- strncpy(*module, CLI_MODE, sizeof(CLI_MODE)); /* mode */
+ strlcpy(*module, CLI_MODE, sizeof(CLI_MODE)); /* mode */
dprintf("--> %s %s %s\n", *command, *module, argv[0]);
goto out;
@@ -291,7 +291,7 @@ static void expand_aliases(char *line __unused, char **command, char **module,
if (!strncmp(*command, hdt_aliases[i].aliases[j],
sizeof(hdt_aliases[i].aliases[j]))) {
dprintf("CLI DEBUG: ALIAS %s ", *command);
- strncpy(*command, hdt_aliases[i].command,
+ strlcpy(*command, hdt_aliases[i].command,
sizeof(hdt_aliases[i].command) + 1);
dprintf("--> %s\n", *command);
goto out; /* Don't allow chaining aliases */
@@ -363,14 +363,14 @@ static void parse_command_line(char *line, char **command, char **module,
if (token_found == 0) {
/* Main command to execute */
*command = malloc((token_len + 1) * sizeof(char));
- strncpy(*command, pch, token_len);
+ strlcpy(*command, pch, token_len);
(*command)[token_len] = '\0';
dprintf("CLI DEBUG: command = %s\n", *command);
args_pos += args_len;
} else if (token_found == 1) {
/* Module */
*module = malloc((token_len + 1) * sizeof(char));
- strncpy(*module, pch, token_len);
+ strlcpy(*module, pch, token_len);
(*module)[token_len] = '\0';
dprintf("CLI DEBUG: module = %s\n", *module);
args_pos += args_len;
@@ -392,7 +392,7 @@ static void parse_command_line(char *line, char **command, char **module,
while (pch != NULL) {
dprintf("CLI DEBUG: argv[%d] = %s\n", argc_iter, pch);
argv[argc_iter] = malloc(sizeof(pch) * sizeof(char));
- strncpy(argv[argc_iter], pch, sizeof(pch));
+ strlcpy(argv[argc_iter], pch, sizeof(pch));
argc_iter++;
pch = strtok(NULL, CLI_SPACE);
/*
@@ -711,7 +711,6 @@ static void exec_command(char *line, struct s_hardware *hardware)
}
}
-out:
/* Let's not forget to clean ourselves */
if (command != NULL)
free(command);
@@ -777,6 +776,10 @@ void start_auto_mode(struct s_hardware *hardware)
void print_history(int argc, char **argv, struct s_hardware * hardware)
{
+ (void)argc;
+ (void)argv;
+ (void)hardware;
+
reset_more_printf();
for (int i = 1; i <= MAX_HISTORY_SIZE; i++) {
if (i == hdt_cli.history_pos) {
@@ -911,7 +914,7 @@ void start_cli_mode(struct s_hardware *hardware)
/* Let's make that future position the one we use */
memset(INPUT, 0, sizeof(INPUT));
- strncpy(INPUT, hdt_cli.history[future_history_pos], sizeof(INPUT));
+ strlcpy(INPUT, hdt_cli.history[future_history_pos], sizeof(INPUT));
/* Clear the line */
clear_line();
@@ -952,7 +955,7 @@ void start_cli_mode(struct s_hardware *hardware)
/* Let's make that future position the one we use */
memset(INPUT, 0, sizeof(INPUT));
- strncpy(INPUT, hdt_cli.history[future_history_pos], sizeof(INPUT));
+ strlcpy(INPUT, hdt_cli.history[future_history_pos], sizeof(INPUT));
/* Clear the line */
clear_line();
@@ -972,7 +975,7 @@ void start_cli_mode(struct s_hardware *hardware)
move_cursor_to_column(0);
reset_prompt();
printf("%s", autocomplete_last_seen->autocomplete_token);
- strncpy(INPUT,
+ strlcpy(INPUT,
autocomplete_last_seen->autocomplete_token,
sizeof(INPUT));
hdt_cli.cursor_pos = strlen(INPUT);
@@ -1086,7 +1089,7 @@ void start_cli_mode(struct s_hardware *hardware)
char key[2];
int trailing_chars = strlen(INPUT) - hdt_cli.cursor_pos;
memset(temp_command, 0, sizeof(temp_command));
- strncpy(temp_command, INPUT, hdt_cli.cursor_pos);
+ strlcpy(temp_command, INPUT, hdt_cli.cursor_pos);
sprintf(key, "%c", current_key);
strncat(temp_command, key, 1);
strncat(temp_command,
diff --git a/com32/hdt/hdt-cli.h b/com32/hdt/hdt-cli.h
index 814a03a9..13291092 100644
--- a/com32/hdt/hdt-cli.h
+++ b/com32/hdt/hdt-cli.h
@@ -30,16 +30,10 @@
#define DEFINE_HDT_CLI_H
#include <stdio.h>
#include <getkey.h>
+#include <dprintf.h>
#include "hdt-common.h"
-#define DEBUG 0
-#if DEBUG
-# define dprintf printf
-#else
-# define dprintf(f, ...) ((void)0)
-#endif
-
#define MAX_LINE_SIZE 256
#define CLI_SPACE " "
diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c
index b1170477..ded079ed 100644
--- a/com32/hdt/hdt-common.c
+++ b/com32/hdt/hdt-common.c
@@ -78,31 +78,27 @@ void detect_parameters(const int argc, const char *argv[],
} else if (!strncmp(argv[i], "verbose", 7)) {
quiet = false;
} else if (!strncmp(argv[i], "modules_pcimap=", 15)) {
- strncpy(hardware->modules_pcimap_path, argv[i] + 15,
+ strlcpy(hardware->modules_pcimap_path, argv[i] + 15,
sizeof(hardware->modules_pcimap_path));
convert_isolinux_filename(hardware->modules_pcimap_path, hardware);
} else if (!strncmp(argv[i], "pciids=", 7)) {
- strncpy(hardware->pciids_path, argv[i] + 7,
+ strlcpy(hardware->pciids_path, argv[i] + 7,
sizeof(hardware->pciids_path));
convert_isolinux_filename(hardware->pciids_path, hardware);
} else if (!strncmp(argv[i], "modules_alias=", 14)) {
- strncpy(hardware->modules_alias_path, argv[i] + 14,
+ strlcpy(hardware->modules_alias_path, argv[i] + 14,
sizeof(hardware->modules_alias_path));
convert_isolinux_filename(hardware->modules_alias_path, hardware);
} else if (!strncmp(argv[i], "memtest=", 8)) {
- strncpy(hardware->memtest_label, argv[i] + 8,
+ strlcpy(hardware->memtest_label, argv[i] + 8,
sizeof(hardware->memtest_label));
convert_isolinux_filename(hardware->memtest_label, hardware);
- } else if (!strncmp(argv[i], "reboot=", 7)) {
- strncpy(hardware->reboot_label, argv[i] + 7,
- sizeof(hardware->reboot_label));
- convert_isolinux_filename(hardware->reboot_label, hardware);
} else if (!strncmp(argv[i], "vesa", 4)) {
vesamode = true;
max_console_lines = MAX_CLI_LINES;
/* If the user defines a background image */
if (!strncmp(argv[i], "vesa=", 5)) {
- strncpy(hardware->vesa_background, argv[i] + 5,
+ strlcpy(hardware->vesa_background, argv[i] + 5,
sizeof(hardware->vesa_background));
}
} else if (!strncmp(argv[i], "novesa", 6)) {
@@ -205,15 +201,13 @@ void init_hardware(struct s_hardware *hardware)
memset(hardware->modules_alias_path, 0,
sizeof hardware->modules_alias_path);
memset(hardware->memtest_label, 0, sizeof hardware->memtest_label);
- memset(hardware->reboot_label, 0, sizeof hardware->reboot_label);
memset(hardware->auto_label, 0, sizeof hardware->auto_label);
memset(hardware->vesa_background, 0, sizeof hardware->vesa_background);
strcat(hardware->pciids_path, "pci.ids");
strcat(hardware->modules_pcimap_path, "modules.pcimap");
strcat(hardware->modules_alias_path, "modules.alias");
strcat(hardware->memtest_label, "memtest");
- strcat(hardware->reboot_label, "reboot.c32");
- strncpy(hardware->vesa_background, CLI_DEFAULT_BACKGROUND,
+ strlcpy(hardware->vesa_background, CLI_DEFAULT_BACKGROUND,
sizeof(hardware->vesa_background));
}
@@ -310,11 +304,11 @@ int detect_vesa(struct s_hardware *hardware)
mode_ptr = GET_PTR(gi->video_mode_ptr);
oem_ptr = GET_PTR(gi->oem_vendor_name_ptr);
- strncpy(hardware->vesa.vendor, oem_ptr, sizeof(hardware->vesa.vendor));
+ strlcpy(hardware->vesa.vendor, oem_ptr, sizeof(hardware->vesa.vendor));
oem_ptr = GET_PTR(gi->oem_product_name_ptr);
- strncpy(hardware->vesa.product, oem_ptr, sizeof(hardware->vesa.product));
+ strlcpy(hardware->vesa.product, oem_ptr, sizeof(hardware->vesa.product));
oem_ptr = GET_PTR(gi->oem_product_rev_ptr);
- strncpy(hardware->vesa.product_revision, oem_ptr,
+ strlcpy(hardware->vesa.product_revision, oem_ptr,
sizeof(hardware->vesa.product_revision));
hardware->vesa.major_version = (gi->version >> 8) & 0xff;
@@ -562,13 +556,13 @@ void cpu_detect(struct s_hardware *hardware)
/* Old processors doesn't manage the identify commands
* Let's use the dmi value in that case */
if (strlen(remove_spaces(hardware->cpu.model)) == 0)
- strncpy(hardware->cpu.model, hardware->dmi.processor.version,
+ strlcpy(hardware->cpu.model, hardware->dmi.processor.version,
sizeof(hardware->cpu.model));
/* Some CPUs like to put many spaces in the model name
* That makes some weird display in console/menu
* Let's remove that mulitple spaces */
- strncpy(hardware->cpu.model,del_multi_spaces(hardware->cpu.model),sizeof(hardware->cpu.model));
+ strlcpy(hardware->cpu.model,del_multi_spaces(hardware->cpu.model),sizeof(hardware->cpu.model));
hardware->cpu_detection = true;
}
@@ -660,7 +654,7 @@ char *del_multi_spaces(char *p)
/* Let's copy to the current position
* the content from the second space*/
- strncpy(p, p + 1, strlen(p + 1));
+ strlcpy(p, p + 1, strlen(p + 1));
/* The string is 1 char smaller */
*(p + strlen(p) - 1) = '\0';
diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h
index 21b7e5b9..3aa5a506 100644
--- a/com32/hdt/hdt-common.h
+++ b/com32/hdt/hdt-common.h
@@ -61,6 +61,9 @@
#define HDT_RETURN_TO_CLI 100
#define MAX_VESA_MODES 255
+/* This value is used for rebooting from the menu mode */
+#define HDT_REBOOT "hdt_reboot"
+
/* The maximum number of commands we can process */
#define MAX_NB_AUTO_COMMANDS 255
/* The maximum size of a command */
@@ -206,7 +209,6 @@ struct s_hardware {
char modules_alias_path[255];
char pciids_path[255];
char memtest_label[255];
- char reboot_label[255];
char auto_label[AUTO_COMMAND_SIZE];
char vesa_background[255];
};
diff --git a/com32/hdt/hdt-menu.c b/com32/hdt/hdt-menu.c
index 1d00ab80..0fc6fb1a 100644
--- a/com32/hdt/hdt-menu.c
+++ b/com32/hdt/hdt-menu.c
@@ -28,6 +28,7 @@
#include <unistd.h>
#include <memory.h>
+#include <syslinux/reboot.h>
#include "hdt-menu.h"
int start_menu_mode(struct s_hardware *hardware, char *version_string)
@@ -61,6 +62,10 @@ int start_menu_mode(struct s_hardware *hardware, char *version_string)
(curr->data, HDT_SWITCH_TO_CLI, sizeof(HDT_SWITCH_TO_CLI))) {
return HDT_RETURN_TO_CLI;
}
+ if (!strncmp
+ (curr->data, HDT_REBOOT, sizeof(HDT_REBOOT))) {
+ syslinux_reboot(1);
+ }
strcpy(cmd, curr->data);
/* Use specific syslinux call if needed */
@@ -279,7 +284,7 @@ void compute_main_menu(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware)
HDT_SWITCH_TO_CLI, 0);
add_item("<A>bout", "About Menu", OPT_SUBMENU, NULL,
hdt_menu->about_menu.menu);
- add_item("<R>eboot", "Reboot", OPT_RUN, hardware->reboot_label, 0);
+ add_item("<R>eboot", "Reboot", OPT_RUN, HDT_REBOOT, 0);
add_item("E<x>it", "Exit", OPT_EXITMENU, NULL, 0);
hdt_menu->main_menu.items_count++;
diff --git a/com32/include/com32.h b/com32/include/com32.h
index 665fa0bf..6b142082 100644
--- a/com32/include/com32.h
+++ b/com32/include/com32.h
@@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2002-2009 H. Peter Anvin - All Rights Reserved
- * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ * Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -92,6 +92,8 @@ typedef struct {
#define EFLAGS_VIP 0x00100000
#define EFLAGS_ID 0x00200000
+struct com32_pmapi;
+
extern struct com32_sys_args {
uint32_t cs_sysargs;
char *cs_cmdline;
@@ -102,6 +104,7 @@ extern struct com32_sys_args {
int __cdecl (*cs_cfarcall)(uint32_t, const void *, uint32_t);
uint32_t cs_memsize;
const char *cs_name;
+ const struct com32_pmapi *cs_pm;
} __com32;
/*
@@ -115,6 +118,14 @@ int __cfarcall(uint16_t __cs, uint16_t __ip,
extern const com32sys_t __com32_zero_regs;
/*
+ * Lowmem allocation functions
+ */
+void *lmalloc(size_t);
+void *lzalloc(size_t);
+void lfree(void *);
+char *lstrdup(const char *);
+
+/*
* These functions convert between linear pointers in the range
* 0..0xFFFFF and real-mode style SEG:OFFS pointers. Note that a
* 32-bit linear pointer is not compatible with a SEG:OFFS pointer
diff --git a/com32/include/dev.h b/com32/include/dev.h
index 7809fb56..70b3165c 100644
--- a/com32/include/dev.h
+++ b/com32/include/dev.h
@@ -41,6 +41,7 @@ struct input_dev;
struct output_dev;
__extern int opendev(const struct input_dev *, const struct output_dev *, int);
+__extern int openmem(const void *, size_t, int);
/* Common generic devices */
diff --git a/com32/include/dirent.h b/com32/include/dirent.h
index d99b21fb..c4aca4f0 100644
--- a/com32/include/dirent.h
+++ b/com32/include/dirent.h
@@ -10,23 +10,7 @@
#include <stddef.h>
#include <sys/types.h>
-#ifndef NAME_MAX
-#define NAME_MAX 255
-#endif
-
-struct dirent {
- long d_ino; /* Inode/File number */
- off_t d_size; /* Size of file */
- mode_t d_mode; /* Type of file */
- char d_name[NAME_MAX + 1];
-};
-
-typedef struct {
- short dd_stat; /* status return from last lookup */
- uint16_t dd_fd;
- size_t dd_sect;
- char dd_name[NAME_MAX + 1]; /* directory */
-} DIR;
+#include <sys/dirent.h>
__extern DIR *opendir(const char *);
__extern struct dirent *readdir(DIR *);
diff --git a/com32/include/getopt.h b/com32/include/getopt.h
new file mode 100644
index 00000000..71c41cd9
--- /dev/null
+++ b/com32/include/getopt.h
@@ -0,0 +1,22 @@
+#ifndef _GETOPT_H
+#define _GETOPT_H
+
+#include <klibc/extern.h>
+
+struct option {
+ const char *name;
+ int has_arg;
+ int *flag;
+ int val;
+};
+
+enum {
+ no_argument = 0,
+ required_argument = 1,
+ optional_argument = 2,
+};
+
+__extern int getopt_long(int, char *const *, const char *,
+ const struct option *, int *);
+
+#endif /* _GETOPT_H */
diff --git a/com32/include/ilog2.h b/com32/include/ilog2.h
new file mode 100644
index 00000000..91a50576
--- /dev/null
+++ b/com32/include/ilog2.h
@@ -0,0 +1,48 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2010 Intel Corporation; author: H. Peter Anvin
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+
+#ifndef _ILOG2_H
+#define _ILOG2_H
+
+/*
+ * Computes floor(log2(x)) -- undefined for x = 0.
+ */
+
+#include <klibc/compiler.h>
+#include <stdint.h>
+
+static inline __constfunc uint32_t ilog2(uint32_t __v)
+{
+# if __GNUC__ >= 4
+ return __builtin_clz(__v) ^ 31;
+# else
+ asm("bsrl %1,%0" : "=r" (__v) : "rm" (__v));
+ return __v;
+# endif
+}
+
+#endif /* _ILOG2_H */
diff --git a/com32/include/netinet/in.h b/com32/include/netinet/in.h
index 051cc08f..ccf04750 100644
--- a/com32/include/netinet/in.h
+++ b/com32/include/netinet/in.h
@@ -4,37 +4,47 @@
/* COM32 will be running on an i386 platform */
#include <stdint.h>
+#include <klibc/compiler.h>
-static inline uint16_t __htons(uint16_t v)
+#define __htons_macro(v) ((uint16_t) \
+ (((uint16_t)(v) << 8) | \
+ ((uint16_t)(v) >> 8)))
+
+static inline __constfunc uint16_t __htons(uint16_t v)
{
- return ((v) << 8) | ((v) >> 8);
+ return __htons_macro(v);
}
-#define htons(x) __htons(x)
-#define ntohs(x) __htons(x)
+#define htons(x) (__builtin_constant_p(x) ? __htons_macro(x) : __htons(x))
+#define ntohs(x) htons(x)
+
+#define __htonl_macro(v) ((uint32_t) \
+ ((((uint32_t)(v) & 0x000000ff) << 24) | \
+ (((uint32_t)(v) & 0x0000ff00) << 8) | \
+ (((uint32_t)(v) & 0x00ff0000) >> 8) | \
+ (((uint32_t)(v) & 0xff000000) >> 24)))
-static inline uint32_t __htonl(uint32_t v)
+static inline __constfunc uint32_t __htonl(uint32_t v)
{
- if (__builtin_constant_p(v)) {
- return (((v) & 0x000000ff) << 24) |
- (((v) & 0x0000ff00) << 8) |
- (((v) & 0x00ff0000) >> 8) | (((v) & 0xff000000) >> 24);
- } else {
-asm("xchgb %h0,%b0 ; roll $16,%0 ; xchgb %h0,%b0":"+abcd"(v));
- return v;
- }
+ asm("xchgb %h0,%b0 ; roll $16,%0 ; xchgb %h0,%b0"
+ : "+q" (v));
+ return v;
}
-#define htonl(x) __htonl(x)
-#define ntohl(x) __htonl(x)
+#define htonl(x) (__builtin_constant_p(x) ? __htonl_macro(x) : __htonl(x))
+#define ntohl(x) htonl(x)
+
+#define __htonq_macro(v) ((uint64_t) \
+ (((uint64_t)__htonl_macro((uint32_t)(v)) << 32) | \
+ (__htonl_macro((uint32_t)((uint64_t)(v) >> 32)))))
-static inline uint64_t __htonq(uint64_t v)
+static inline __constfunc uint64_t __htonq(uint64_t v)
{
- return ((uint64_t) __htonl(v) << 32) | __htonl(v >> 32);
+ return ((uint64_t)__htonl(v) << 32) | __htonl(v >> 32);
}
-#define htonq(x) __htonq(x)
-#define ntohq(x) __htonq(x)
+#define htonq(x) (__builtin_constant_p(x) ? __htonq_macro(x) : __htonq(x))
+#define ntohq(x) htonq(x)
typedef uint32_t in_addr_t;
typedef uint16_t in_port_t;
diff --git a/com32/include/png.h b/com32/include/png.h
index 800b912e..cc1915df 100644
--- a/com32/include/png.h
+++ b/com32/include/png.h
@@ -1,14 +1,16 @@
/* png.h - header file for PNG reference library
*
- * libpng version 1.2.8 - December 3, 2004
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * libpng version 1.2.44 - June 26, 2010
+ * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
+ * This code is released under the libpng license (See LICENSE, below)
+ *
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
- * libpng versions 0.97, January 1998, through 1.2.8 - December 3, 2004: Glenn
+ * libpng versions 0.97, January 1998, through 1.2.44 - June 26, 2010: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@@ -102,15 +104,164 @@
* 1.0.16 10 10016 10.so.0.1.0.16
* 1.2.6 13 10206 12.so.0.1.2.6
* 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2
- * 1.0.17rc1 10 10017 12.so.0.1.0.17rc1
+ * 1.0.17rc1 10 10017 10.so.0.1.0.17rc1
* 1.2.7rc1 13 10207 12.so.0.1.2.7rc1
- * 1.0.17 10 10017 12.so.0.1.0.17
+ * 1.0.17 10 10017 10.so.0.1.0.17
* 1.2.7 13 10207 12.so.0.1.2.7
* 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5
- * 1.0.18rc1-5 10 10018 12.so.0.1.0.18rc1-5
+ * 1.0.18rc1-5 10 10018 10.so.0.1.0.18rc1-5
* 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5
- * 1.0.18 10 10018 12.so.0.1.0.18
+ * 1.0.18 10 10018 10.so.0.1.0.18
* 1.2.8 13 10208 12.so.0.1.2.8
+ * 1.2.9beta1-3 13 10209 12.so.0.1.2.9beta1-3
+ * 1.2.9beta4-11 13 10209 12.so.0.9[.0]
+ * 1.2.9rc1 13 10209 12.so.0.9[.0]
+ * 1.2.9 13 10209 12.so.0.9[.0]
+ * 1.2.10beta1-8 13 10210 12.so.0.10[.0]
+ * 1.2.10rc1-3 13 10210 12.so.0.10[.0]
+ * 1.2.10 13 10210 12.so.0.10[.0]
+ * 1.2.11beta1-4 13 10211 12.so.0.11[.0]
+ * 1.0.19rc1-5 10 10019 10.so.0.19[.0]
+ * 1.2.11rc1-5 13 10211 12.so.0.11[.0]
+ * 1.0.19 10 10019 10.so.0.19[.0]
+ * 1.2.11 13 10211 12.so.0.11[.0]
+ * 1.0.20 10 10020 10.so.0.20[.0]
+ * 1.2.12 13 10212 12.so.0.12[.0]
+ * 1.2.13beta1 13 10213 12.so.0.13[.0]
+ * 1.0.21 10 10021 10.so.0.21[.0]
+ * 1.2.13 13 10213 12.so.0.13[.0]
+ * 1.2.14beta1-2 13 10214 12.so.0.14[.0]
+ * 1.0.22rc1 10 10022 10.so.0.22[.0]
+ * 1.2.14rc1 13 10214 12.so.0.14[.0]
+ * 1.0.22 10 10022 10.so.0.22[.0]
+ * 1.2.14 13 10214 12.so.0.14[.0]
+ * 1.2.15beta1-6 13 10215 12.so.0.15[.0]
+ * 1.0.23rc1-5 10 10023 10.so.0.23[.0]
+ * 1.2.15rc1-5 13 10215 12.so.0.15[.0]
+ * 1.0.23 10 10023 10.so.0.23[.0]
+ * 1.2.15 13 10215 12.so.0.15[.0]
+ * 1.2.16beta1-2 13 10216 12.so.0.16[.0]
+ * 1.2.16rc1 13 10216 12.so.0.16[.0]
+ * 1.0.24 10 10024 10.so.0.24[.0]
+ * 1.2.16 13 10216 12.so.0.16[.0]
+ * 1.2.17beta1-2 13 10217 12.so.0.17[.0]
+ * 1.0.25rc1 10 10025 10.so.0.25[.0]
+ * 1.2.17rc1-3 13 10217 12.so.0.17[.0]
+ * 1.0.25 10 10025 10.so.0.25[.0]
+ * 1.2.17 13 10217 12.so.0.17[.0]
+ * 1.0.26 10 10026 10.so.0.26[.0]
+ * 1.2.18 13 10218 12.so.0.18[.0]
+ * 1.2.19beta1-31 13 10219 12.so.0.19[.0]
+ * 1.0.27rc1-6 10 10027 10.so.0.27[.0]
+ * 1.2.19rc1-6 13 10219 12.so.0.19[.0]
+ * 1.0.27 10 10027 10.so.0.27[.0]
+ * 1.2.19 13 10219 12.so.0.19[.0]
+ * 1.2.20beta01-04 13 10220 12.so.0.20[.0]
+ * 1.0.28rc1-6 10 10028 10.so.0.28[.0]
+ * 1.2.20rc1-6 13 10220 12.so.0.20[.0]
+ * 1.0.28 10 10028 10.so.0.28[.0]
+ * 1.2.20 13 10220 12.so.0.20[.0]
+ * 1.2.21beta1-2 13 10221 12.so.0.21[.0]
+ * 1.2.21rc1-3 13 10221 12.so.0.21[.0]
+ * 1.0.29 10 10029 10.so.0.29[.0]
+ * 1.2.21 13 10221 12.so.0.21[.0]
+ * 1.2.22beta1-4 13 10222 12.so.0.22[.0]
+ * 1.0.30rc1 10 10030 10.so.0.30[.0]
+ * 1.2.22rc1 13 10222 12.so.0.22[.0]
+ * 1.0.30 10 10030 10.so.0.30[.0]
+ * 1.2.22 13 10222 12.so.0.22[.0]
+ * 1.2.23beta01-05 13 10223 12.so.0.23[.0]
+ * 1.2.23rc01 13 10223 12.so.0.23[.0]
+ * 1.2.23 13 10223 12.so.0.23[.0]
+ * 1.2.24beta01-02 13 10224 12.so.0.24[.0]
+ * 1.2.24rc01 13 10224 12.so.0.24[.0]
+ * 1.2.24 13 10224 12.so.0.24[.0]
+ * 1.2.25beta01-06 13 10225 12.so.0.25[.0]
+ * 1.2.25rc01-02 13 10225 12.so.0.25[.0]
+ * 1.0.31 10 10031 10.so.0.31[.0]
+ * 1.2.25 13 10225 12.so.0.25[.0]
+ * 1.2.26beta01-06 13 10226 12.so.0.26[.0]
+ * 1.2.26rc01 13 10226 12.so.0.26[.0]
+ * 1.2.26 13 10226 12.so.0.26[.0]
+ * 1.0.32 10 10032 10.so.0.32[.0]
+ * 1.2.27beta01-06 13 10227 12.so.0.27[.0]
+ * 1.2.27rc01 13 10227 12.so.0.27[.0]
+ * 1.0.33 10 10033 10.so.0.33[.0]
+ * 1.2.27 13 10227 12.so.0.27[.0]
+ * 1.0.34 10 10034 10.so.0.34[.0]
+ * 1.2.28 13 10228 12.so.0.28[.0]
+ * 1.2.29beta01-03 13 10229 12.so.0.29[.0]
+ * 1.2.29rc01 13 10229 12.so.0.29[.0]
+ * 1.0.35 10 10035 10.so.0.35[.0]
+ * 1.2.29 13 10229 12.so.0.29[.0]
+ * 1.0.37 10 10037 10.so.0.37[.0]
+ * 1.2.30beta01-04 13 10230 12.so.0.30[.0]
+ * 1.0.38rc01-08 10 10038 10.so.0.38[.0]
+ * 1.2.30rc01-08 13 10230 12.so.0.30[.0]
+ * 1.0.38 10 10038 10.so.0.38[.0]
+ * 1.2.30 13 10230 12.so.0.30[.0]
+ * 1.0.39rc01-03 10 10039 10.so.0.39[.0]
+ * 1.2.31rc01-03 13 10231 12.so.0.31[.0]
+ * 1.0.39 10 10039 10.so.0.39[.0]
+ * 1.2.31 13 10231 12.so.0.31[.0]
+ * 1.2.32beta01-02 13 10232 12.so.0.32[.0]
+ * 1.0.40rc01 10 10040 10.so.0.40[.0]
+ * 1.2.32rc01 13 10232 12.so.0.32[.0]
+ * 1.0.40 10 10040 10.so.0.40[.0]
+ * 1.2.32 13 10232 12.so.0.32[.0]
+ * 1.2.33beta01-02 13 10233 12.so.0.33[.0]
+ * 1.2.33rc01-02 13 10233 12.so.0.33[.0]
+ * 1.0.41rc01 10 10041 10.so.0.41[.0]
+ * 1.2.33 13 10233 12.so.0.33[.0]
+ * 1.0.41 10 10041 10.so.0.41[.0]
+ * 1.2.34beta01-07 13 10234 12.so.0.34[.0]
+ * 1.0.42rc01 10 10042 10.so.0.42[.0]
+ * 1.2.34rc01 13 10234 12.so.0.34[.0]
+ * 1.0.42 10 10042 10.so.0.42[.0]
+ * 1.2.34 13 10234 12.so.0.34[.0]
+ * 1.2.35beta01-03 13 10235 12.so.0.35[.0]
+ * 1.0.43rc01-02 10 10043 10.so.0.43[.0]
+ * 1.2.35rc01-02 13 10235 12.so.0.35[.0]
+ * 1.0.43 10 10043 10.so.0.43[.0]
+ * 1.2.35 13 10235 12.so.0.35[.0]
+ * 1.2.36beta01-05 13 10236 12.so.0.36[.0]
+ * 1.2.36rc01 13 10236 12.so.0.36[.0]
+ * 1.0.44 10 10044 10.so.0.44[.0]
+ * 1.2.36 13 10236 12.so.0.36[.0]
+ * 1.2.37beta01-03 13 10237 12.so.0.37[.0]
+ * 1.2.37rc01 13 10237 12.so.0.37[.0]
+ * 1.2.37 13 10237 12.so.0.37[.0]
+ * 1.2.45 10 10045 12.so.0.45[.0]
+ * 1.0.46 10 10046 10.so.0.46[.0]
+ * 1.2.38beta01 13 10238 12.so.0.38[.0]
+ * 1.2.38rc01-03 13 10238 12.so.0.38[.0]
+ * 1.0.47 10 10047 10.so.0.47[.0]
+ * 1.2.38 13 10238 12.so.0.38[.0]
+ * 1.2.39beta01-05 13 10239 12.so.0.39[.0]
+ * 1.2.39rc01 13 10239 12.so.0.39[.0]
+ * 1.0.48 10 10048 10.so.0.48[.0]
+ * 1.2.39 13 10239 12.so.0.39[.0]
+ * 1.2.40beta01 13 10240 12.so.0.40[.0]
+ * 1.2.40rc01 13 10240 12.so.0.40[.0]
+ * 1.0.49 10 10049 10.so.0.49[.0]
+ * 1.2.40 13 10240 12.so.0.40[.0]
+ * 1.2.41beta01-18 13 10241 12.so.0.41[.0]
+ * 1.0.51rc01 10 10051 10.so.0.51[.0]
+ * 1.2.41rc01-03 13 10241 12.so.0.41[.0]
+ * 1.0.51 10 10051 10.so.0.51[.0]
+ * 1.2.41 13 10241 12.so.0.41[.0]
+ * 1.2.42beta01-02 13 10242 12.so.0.42[.0]
+ * 1.2.42rc01-05 13 10242 12.so.0.42[.0]
+ * 1.0.52 10 10052 10.so.0.52[.0]
+ * 1.2.42 13 10242 12.so.0.42[.0]
+ * 1.2.43beta01-05 13 10243 12.so.0.43[.0]
+ * 1.0.53rc01-02 10 10053 10.so.0.53[.0]
+ * 1.2.43rc01-02 13 10243 12.so.0.43[.0]
+ * 1.0.53 10 10053 10.so.0.53[.0]
+ * 1.2.43 13 10243 12.so.0.43[.0]
+ * 1.2.44beta01-03 13 10244 12.so.0.44[.0]
+ * 1.2.44rc01-03 13 10244 12.so.0.44[.0]
+ * 1.2.44 13 10244 12.so.0.44[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -120,7 +271,7 @@
* to the source version x.y.z (leading zeros in y and z). Beta versions
* were given the previous public release number plus a letter, until
* version 1.0.6j; from then on they were given the upcoming public
- * release number plus "betaNN" or "rcN".
+ * release number plus "betaNN" or "rcNN".
*
* Binary incompatibility exists only when applications make direct access
* to the info_ptr or png_ptr members through png.h, and the compiled
@@ -140,8 +291,10 @@
* If you modify libpng you may insert additional notices immediately following
* this sentence.
*
- * libpng versions 1.2.6, August 15, 2004, through 1.2.8, December 3, 2004, are
- * Copyright (c) 2004 Glenn Randers-Pehrson, and are
+ * This code is released under the libpng license.
+ *
+ * libpng versions 1.2.6, August 15, 2004, through 1.2.44, June 26, 2010, are
+ * Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors:
*
@@ -252,13 +405,13 @@
* Y2K compliance in libpng:
* =========================
*
- * December 3, 2004
+ * June 26, 2010
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
- * upward through 1.2.8 are Y2K compliant. It is my belief that earlier
+ * upward through 1.2.44 are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant.
*
* Libpng only has three year fields. One is a 2-byte unsigned integer
@@ -314,9 +467,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.2.8"
+#define PNG_LIBPNG_VER_STRING "1.2.44"
#define PNG_HEADER_VERSION_STRING \
- " libpng version 1.2.8 - December 3, 2004 (header)\n"
+ " libpng version 1.2.44 - June 26, 2010\n"
#define PNG_LIBPNG_VER_SONUM 0
#define PNG_LIBPNG_VER_DLLNUM 13
@@ -324,9 +477,10 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 2
-#define PNG_LIBPNG_VER_RELEASE 8
+#define PNG_LIBPNG_VER_RELEASE 44
/* This should match the numeric part of the final component of
- * PNG_LIBPNG_VER_STRING, omitting any leading zero: */
+ * PNG_LIBPNG_VER_STRING, omitting any leading zero:
+ */
#define PNG_LIBPNG_VER_BUILD 0
@@ -351,15 +505,16 @@
* We must not include leading zeros.
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
* version 1.0.0 was mis-numbered 100 instead of 10000). From
- * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */
-#define PNG_LIBPNG_VER 10208 /* 1.2.8 */
+ * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
+ */
+#define PNG_LIBPNG_VER 10244 /* 1.2.44 */
#ifndef PNG_VERSION_INFO_ONLY
-/* include the compression library's header */
+/* Include the compression library's header */
#include "zlib.h"
#endif
-/* include all user configurable info, including optional assembler routines */
+/* Include all user configurable info, including optional assembler routines */
#include "pngconf.h"
/*
@@ -375,15 +530,15 @@
* StringFileInfo block must contain a SpecialBuild string.
*/
-#if defined(PNG_USER_PRIVATEBUILD)
-# define PNG_LIBPNG_BUILD_TYPE PNG_LIBPNG_BUILD_BASE_TYPE | \
- PNG_LIBPNG_BUILD_PRIVATE
+#ifdef PNG_USER_PRIVATEBUILD
+# define PNG_LIBPNG_BUILD_TYPE \
+ (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE)
#else
-# if defined(PNG_LIBPNG_SPECIALBUILD)
-# define PNG_LIBPNG_BUILD_TYPE PNG_LIBPNG_BUILD_BASE_TYPE | \
- PNG_LIBPNG_BUILD_SPECIAL
+# ifdef PNG_LIBPNG_SPECIALBUILD
+# define PNG_LIBPNG_BUILD_TYPE \
+ (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL)
# else
-# define PNG_LIBPNG_BUILD_TYPE PNG_LIBPNG_BUILD_BASE_TYPE
+# define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE)
# endif
#endif
@@ -434,14 +589,14 @@ extern "C" {
#define png_write_status_ptr_NULL NULL
#endif
-/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
+/* Variables declared in png.c - only it needs to define PNG_NO_EXTERN */
#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
/* Version information for C files, stored in png.c. This had better match
* the version above.
*/
#ifdef PNG_USE_GLOBAL_ARRAYS
-PNG_EXPORT_VAR (const char) png_libpng_ver[18];
- /* need room for 99.99.99beta99z */
+PNG_EXPORT_VAR (PNG_CONST char) png_libpng_ver[18];
+ /* Need room for 99.99.99beta99z */
#else
#define png_libpng_ver png_get_header_ver(NULL)
#endif
@@ -449,17 +604,14 @@ PNG_EXPORT_VAR (const char) png_libpng_ver[18];
#ifdef PNG_USE_GLOBAL_ARRAYS
/* This was removed in version 1.0.5c */
/* Structures to facilitate easy interlacing. See png.c for more details */
-PNG_EXPORT_VAR (const int FARDATA) png_pass_start[7];
-PNG_EXPORT_VAR (const int FARDATA) png_pass_inc[7];
-PNG_EXPORT_VAR (const int FARDATA) png_pass_ystart[7];
-PNG_EXPORT_VAR (const int FARDATA) png_pass_yinc[7];
-PNG_EXPORT_VAR (const int FARDATA) png_pass_mask[7];
-PNG_EXPORT_VAR (const int FARDATA) png_pass_dsp_mask[7];
-#ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
-PNG_EXPORT_VAR (const int FARDATA) png_pass_width[7];
-#endif
+PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_start[7];
+PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_inc[7];
+PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_ystart[7];
+PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_yinc[7];
+PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_mask[7];
+PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_dsp_mask[7];
/* This isn't currently used. If you need it, see png.c for more details.
-PNG_EXPORT_VAR (const int FARDATA) png_pass_height[7];
+PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_height[7];
*/
#endif
@@ -563,7 +715,8 @@ typedef png_text FAR * FAR * png_textpp;
#endif
/* Supported compression types for text in PNG files (tEXt, and zTXt).
- * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */
+ * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed.
+ */
#define PNG_TEXT_COMPRESSION_NONE_WR -3
#define PNG_TEXT_COMPRESSION_zTXt_WR -2
#define PNG_TEXT_COMPRESSION_NONE -1
@@ -590,15 +743,17 @@ typedef struct png_time_struct
typedef png_time FAR * png_timep;
typedef png_time FAR * FAR * png_timepp;
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
+ defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
/* png_unknown_chunk is a structure to hold queued chunks for which there is
* no specific support. The idea is that we can use this to queue
* up private chunks for output even though the library doesn't actually
* know about their semantics.
*/
+#define PNG_CHUNK_NAME_LENGTH 5
typedef struct png_unknown_chunk_t
{
- png_byte name[5];
+ png_byte name[PNG_CHUNK_NAME_LENGTH];
png_byte *data;
png_size_t size;
@@ -651,26 +806,26 @@ typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp;
*/
typedef struct png_info_struct
{
- /* the following are necessary for every PNG file */
- png_uint_32 width; /* width of image in pixels (from IHDR) */
- png_uint_32 height; /* height of image in pixels (from IHDR) */
- png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
- png_uint_32 rowbytes; /* bytes needed to hold an untransformed row */
- png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */
- png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
- png_uint_16 num_trans; /* number of transparent palette color (tRNS) */
- png_byte bit_depth; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
- png_byte color_type; /* see PNG_COLOR_TYPE_ below (from IHDR) */
+ /* The following are necessary for every PNG file */
+ png_uint_32 width PNG_DEPSTRUCT; /* width of image in pixels (from IHDR) */
+ png_uint_32 height PNG_DEPSTRUCT; /* height of image in pixels (from IHDR) */
+ png_uint_32 valid PNG_DEPSTRUCT; /* valid chunk data (see PNG_INFO_ below) */
+ png_uint_32 rowbytes PNG_DEPSTRUCT; /* bytes needed to hold an untransformed row */
+ png_colorp palette PNG_DEPSTRUCT; /* array of color values (valid & PNG_INFO_PLTE) */
+ png_uint_16 num_palette PNG_DEPSTRUCT; /* number of color entries in "palette" (PLTE) */
+ png_uint_16 num_trans PNG_DEPSTRUCT; /* number of transparent palette color (tRNS) */
+ png_byte bit_depth PNG_DEPSTRUCT; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
+ png_byte color_type PNG_DEPSTRUCT; /* see PNG_COLOR_TYPE_ below (from IHDR) */
/* The following three should have been named *_method not *_type */
- png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
- png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
- png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
+ png_byte compression_type PNG_DEPSTRUCT; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
+ png_byte filter_type PNG_DEPSTRUCT; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
+ png_byte interlace_type PNG_DEPSTRUCT; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
/* The following is informational only on read, and not used on writes. */
- png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */
- png_byte pixel_depth; /* number of bits per pixel */
- png_byte spare_byte; /* to align the data, and for future use */
- png_byte signature[8]; /* magic bytes read by libpng from start of file */
+ png_byte channels PNG_DEPSTRUCT; /* number of data channels per pixel (1, 2, 3, 4) */
+ png_byte pixel_depth PNG_DEPSTRUCT; /* number of bits per pixel */
+ png_byte spare_byte PNG_DEPSTRUCT; /* to align the data, and for future use */
+ png_byte signature[8] PNG_DEPSTRUCT; /* magic bytes read by libpng from start of file */
/* The rest of the data is optional. If you are reading, check the
* valid field to see if the information in these are valid. If you
@@ -683,16 +838,16 @@ typedef struct png_info_struct
* on which the image was created, normally in the range [1.0, 2.5].
* Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
*/
- float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
+ float gamma PNG_DEPSTRUCT; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
#endif
-#if defined(PNG_sRGB_SUPPORTED)
+#ifdef PNG_sRGB_SUPPORTED
/* GR-P, 0.96a */
/* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
- png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */
+ png_byte srgb_intent PNG_DEPSTRUCT; /* sRGB rendering intent [0, 1, 2, or 3] */
#endif
-#if defined(PNG_TEXT_SUPPORTED)
+#ifdef PNG_TEXT_SUPPORTED
/* The tEXt, and zTXt chunks contain human-readable textual data in
* uncompressed, compressed, and optionally compressed forms, respectively.
* The data in "text" is an array of pointers to uncompressed,
@@ -701,26 +856,26 @@ typedef struct png_info_struct
* unique, and the text string may be empty. Any number of text chunks may
* be in an image.
*/
- int num_text; /* number of comments read/to write */
- int max_text; /* current size of text array */
- png_textp text; /* array of comments read/to write */
+ int num_text PNG_DEPSTRUCT; /* number of comments read/to write */
+ int max_text PNG_DEPSTRUCT; /* current size of text array */
+ png_textp text PNG_DEPSTRUCT; /* array of comments read/to write */
#endif /* PNG_TEXT_SUPPORTED */
-#if defined(PNG_tIME_SUPPORTED)
+#ifdef PNG_tIME_SUPPORTED
/* The tIME chunk holds the last time the displayed image data was
* modified. See the png_time struct for the contents of this struct.
*/
- png_time mod_time;
+ png_time mod_time PNG_DEPSTRUCT;
#endif
-#if defined(PNG_sBIT_SUPPORTED)
+#ifdef PNG_sBIT_SUPPORTED
/* The sBIT chunk specifies the number of significant high-order bits
* in the pixel data. Values are in the range [1, bit_depth], and are
* only specified for the channels in the pixel data. The contents of
* the low-order bits is not specified. Data is valid if
* (valid & PNG_INFO_sBIT) is non-zero.
*/
- png_color_8 sig_bit; /* significant bits in color channels */
+ png_color_8 sig_bit PNG_DEPSTRUCT; /* significant bits in color channels */
#endif
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
@@ -734,8 +889,8 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* single color specified that should be treated as fully transparent.
* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
*/
- png_bytep trans; /* transparent values for paletted image */
- png_color_16 trans_values; /* transparent color for non-palette image */
+ png_bytep trans PNG_DEPSTRUCT; /* transparent values for paletted image */
+ png_color_16 trans_values PNG_DEPSTRUCT; /* transparent color for non-palette image */
#endif
#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
@@ -745,38 +900,38 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* in "background" are normally in the same color space/depth as the
* pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
*/
- png_color_16 background;
+ png_color_16 background PNG_DEPSTRUCT;
#endif
-#if defined(PNG_oFFs_SUPPORTED)
+#ifdef PNG_oFFs_SUPPORTED
/* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
* and downwards from the top-left corner of the display, page, or other
* application-specific co-ordinate space. See the PNG_OFFSET_ defines
* below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.
*/
- png_int_32 x_offset; /* x offset on page */
- png_int_32 y_offset; /* y offset on page */
- png_byte offset_unit_type; /* offset units type */
+ png_int_32 x_offset PNG_DEPSTRUCT; /* x offset on page */
+ png_int_32 y_offset PNG_DEPSTRUCT; /* y offset on page */
+ png_byte offset_unit_type PNG_DEPSTRUCT; /* offset units type */
#endif
-#if defined(PNG_pHYs_SUPPORTED)
+#ifdef PNG_pHYs_SUPPORTED
/* The pHYs chunk gives the physical pixel density of the image for
* display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
* defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
*/
- png_uint_32 x_pixels_per_unit; /* horizontal pixel density */
- png_uint_32 y_pixels_per_unit; /* vertical pixel density */
- png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
+ png_uint_32 x_pixels_per_unit PNG_DEPSTRUCT; /* horizontal pixel density */
+ png_uint_32 y_pixels_per_unit PNG_DEPSTRUCT; /* vertical pixel density */
+ png_byte phys_unit_type PNG_DEPSTRUCT; /* resolution type (see PNG_RESOLUTION_ below) */
#endif
-#if defined(PNG_hIST_SUPPORTED)
+#ifdef PNG_hIST_SUPPORTED
/* The hIST chunk contains the relative frequency or importance of the
* various palette entries, so that a viewer can intelligently select a
* reduced-color palette, if required. Data is an array of "num_palette"
* values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
* is non-zero.
*/
- png_uint_16p hist;
+ png_uint_16p hist PNG_DEPSTRUCT;
#endif
#ifdef PNG_cHRM_SUPPORTED
@@ -787,18 +942,18 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero.
*/
#ifdef PNG_FLOATING_POINT_SUPPORTED
- float x_white;
- float y_white;
- float x_red;
- float y_red;
- float x_green;
- float y_green;
- float x_blue;
- float y_blue;
+ float x_white PNG_DEPSTRUCT;
+ float y_white PNG_DEPSTRUCT;
+ float x_red PNG_DEPSTRUCT;
+ float y_red PNG_DEPSTRUCT;
+ float x_green PNG_DEPSTRUCT;
+ float y_green PNG_DEPSTRUCT;
+ float x_blue PNG_DEPSTRUCT;
+ float y_blue PNG_DEPSTRUCT;
#endif
#endif
-#if defined(PNG_pCAL_SUPPORTED)
+#ifdef PNG_pCAL_SUPPORTED
/* The pCAL chunk describes a transformation between the stored pixel
* values and original physical data values used to create the image.
* The integer range [0, 2^bit_depth - 1] maps to the floating-point
@@ -810,42 +965,43 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* implemented, and for a description of the ASCII parameter strings.
* Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
*/
- png_charp pcal_purpose; /* pCAL chunk description string */
- png_int_32 pcal_X0; /* minimum value */
- png_int_32 pcal_X1; /* maximum value */
- png_charp pcal_units; /* Latin-1 string giving physical units */
- png_charpp pcal_params; /* ASCII strings containing parameter values */
- png_byte pcal_type; /* equation type (see PNG_EQUATION_ below) */
- png_byte pcal_nparams; /* number of parameters given in pcal_params */
+ png_charp pcal_purpose PNG_DEPSTRUCT; /* pCAL chunk description string */
+ png_int_32 pcal_X0 PNG_DEPSTRUCT; /* minimum value */
+ png_int_32 pcal_X1 PNG_DEPSTRUCT; /* maximum value */
+ png_charp pcal_units PNG_DEPSTRUCT; /* Latin-1 string giving physical units */
+ png_charpp pcal_params PNG_DEPSTRUCT; /* ASCII strings containing parameter values */
+ png_byte pcal_type PNG_DEPSTRUCT; /* equation type (see PNG_EQUATION_ below) */
+ png_byte pcal_nparams PNG_DEPSTRUCT; /* number of parameters given in pcal_params */
#endif
/* New members added in libpng-1.0.6 */
#ifdef PNG_FREE_ME_SUPPORTED
- png_uint_32 free_me; /* flags items libpng is responsible for freeing */
+ png_uint_32 free_me PNG_DEPSTRUCT; /* flags items libpng is responsible for freeing */
#endif
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
- /* storage for unknown chunks that the library doesn't recognize. */
- png_unknown_chunkp unknown_chunks;
- png_size_t unknown_chunks_num;
+#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
+ defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
+ /* Storage for unknown chunks that the library doesn't recognize. */
+ png_unknown_chunkp unknown_chunks PNG_DEPSTRUCT;
+ png_size_t unknown_chunks_num PNG_DEPSTRUCT;
#endif
-#if defined(PNG_iCCP_SUPPORTED)
+#ifdef PNG_iCCP_SUPPORTED
/* iCCP chunk data. */
- png_charp iccp_name; /* profile name */
- png_charp iccp_profile; /* International Color Consortium profile data */
+ png_charp iccp_name PNG_DEPSTRUCT; /* profile name */
+ png_charp iccp_profile PNG_DEPSTRUCT; /* International Color Consortium profile data */
/* Note to maintainer: should be png_bytep */
- png_uint_32 iccp_proflen; /* ICC profile data length */
- png_byte iccp_compression; /* Always zero */
+ png_uint_32 iccp_proflen PNG_DEPSTRUCT; /* ICC profile data length */
+ png_byte iccp_compression PNG_DEPSTRUCT; /* Always zero */
#endif
-#if defined(PNG_sPLT_SUPPORTED)
- /* data on sPLT chunks (there may be more than one). */
- png_sPLT_tp splt_palettes;
- png_uint_32 splt_palettes_num;
+#ifdef PNG_sPLT_SUPPORTED
+ /* Data on sPLT chunks (there may be more than one). */
+ png_sPLT_tp splt_palettes PNG_DEPSTRUCT;
+ png_uint_32 splt_palettes_num PNG_DEPSTRUCT;
#endif
-#if defined(PNG_sCAL_SUPPORTED)
+#ifdef PNG_sCAL_SUPPORTED
/* The sCAL chunk describes the actual physical dimensions of the
* subject matter of the graphic. The chunk contains a unit specification
* a byte value, and two ASCII strings representing floating-point
@@ -853,36 +1009,36 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* in the image. This external representation is converted to double
* here. Data values are valid if (valid & PNG_INFO_sCAL) is non-zero.
*/
- png_byte scal_unit; /* unit of physical scale */
+ png_byte scal_unit PNG_DEPSTRUCT; /* unit of physical scale */
#ifdef PNG_FLOATING_POINT_SUPPORTED
- double scal_pixel_width; /* width of one pixel */
- double scal_pixel_height; /* height of one pixel */
+ double scal_pixel_width PNG_DEPSTRUCT; /* width of one pixel */
+ double scal_pixel_height PNG_DEPSTRUCT; /* height of one pixel */
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
- png_charp scal_s_width; /* string containing height */
- png_charp scal_s_height; /* string containing width */
+ png_charp scal_s_width PNG_DEPSTRUCT; /* string containing height */
+ png_charp scal_s_height PNG_DEPSTRUCT; /* string containing width */
#endif
#endif
-#if defined(PNG_INFO_IMAGE_SUPPORTED)
+#ifdef PNG_INFO_IMAGE_SUPPORTED
/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS) non-zero */
/* Data valid if (valid & PNG_INFO_IDAT) non-zero */
- png_bytepp row_pointers; /* the image bits */
+ png_bytepp row_pointers PNG_DEPSTRUCT; /* the image bits */
#endif
#if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED)
- png_fixed_point int_gamma; /* gamma of image, if (valid & PNG_INFO_gAMA) */
+ png_fixed_point int_gamma PNG_DEPSTRUCT; /* gamma of image, if (valid & PNG_INFO_gAMA) */
#endif
#if defined(PNG_cHRM_SUPPORTED) && defined(PNG_FIXED_POINT_SUPPORTED)
- png_fixed_point int_x_white;
- png_fixed_point int_y_white;
- png_fixed_point int_x_red;
- png_fixed_point int_y_red;
- png_fixed_point int_x_green;
- png_fixed_point int_y_green;
- png_fixed_point int_x_blue;
- png_fixed_point int_y_blue;
+ png_fixed_point int_x_white PNG_DEPSTRUCT;
+ png_fixed_point int_y_white PNG_DEPSTRUCT;
+ png_fixed_point int_x_red PNG_DEPSTRUCT;
+ png_fixed_point int_y_red PNG_DEPSTRUCT;
+ png_fixed_point int_x_green PNG_DEPSTRUCT;
+ png_fixed_point int_y_green PNG_DEPSTRUCT;
+ png_fixed_point int_x_blue PNG_DEPSTRUCT;
+ png_fixed_point int_y_blue PNG_DEPSTRUCT;
#endif
} png_info;
@@ -894,8 +1050,10 @@ typedef png_info FAR * FAR * png_infopp;
#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
#define PNG_UINT_32_MAX ((png_uint_32)(-1))
#define PNG_SIZE_MAX ((png_size_t)(-1))
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
/* PNG_MAX_UINT is deprecated; use PNG_UINT_31_MAX instead. */
#define PNG_MAX_UINT PNG_UINT_31_MAX
+#endif
/* These describe the color_type field in png_info. */
/* color type masks */
@@ -1033,10 +1191,10 @@ typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp,
png_row_infop, png_bytep));
#endif
-#if defined(PNG_USER_CHUNKS_SUPPORTED)
+#ifdef PNG_USER_CHUNKS_SUPPORTED
typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp));
#endif
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
#endif
@@ -1053,7 +1211,12 @@ typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
#define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */
#define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */
#define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */
-#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */
+#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* write only, deprecated */
+/* Added to libpng-1.2.34 */
+#define PNG_TRANSFORM_STRIP_FILLER_BEFORE 0x0800 /* write only */
+#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */
+/* Added to libpng-1.2.41 */
+#define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */
/* Flags for MNG supported features */
#define PNG_FLAG_MNG_EMPTY_PLTE 0x01
@@ -1075,288 +1238,316 @@ struct png_struct_def
#ifdef PNG_SETJMP_SUPPORTED
jmp_buf jmpbuf; /* used in png_error */
#endif
- png_error_ptr error_fn; /* function for printing errors and aborting */
- png_error_ptr warning_fn; /* function for printing warnings */
- png_voidp error_ptr; /* user supplied struct for error functions */
- png_rw_ptr write_data_fn; /* function for writing output data */
- png_rw_ptr read_data_fn; /* function for reading input data */
- png_voidp io_ptr; /* ptr to application struct for I/O functions */
+ png_error_ptr error_fn PNG_DEPSTRUCT; /* function for printing errors and aborting */
+ png_error_ptr warning_fn PNG_DEPSTRUCT; /* function for printing warnings */
+ png_voidp error_ptr PNG_DEPSTRUCT; /* user supplied struct for error functions */
+ png_rw_ptr write_data_fn PNG_DEPSTRUCT; /* function for writing output data */
+ png_rw_ptr read_data_fn PNG_DEPSTRUCT; /* function for reading input data */
+ png_voidp io_ptr PNG_DEPSTRUCT; /* ptr to application struct for I/O functions */
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
- png_user_transform_ptr read_user_transform_fn; /* user read transform */
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
+ png_user_transform_ptr read_user_transform_fn PNG_DEPSTRUCT; /* user read transform */
#endif
-#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
- png_user_transform_ptr write_user_transform_fn; /* user write transform */
+#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
+ png_user_transform_ptr write_user_transform_fn PNG_DEPSTRUCT; /* user write transform */
#endif
/* These were added in libpng-1.0.2 */
-#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
+#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
- png_voidp user_transform_ptr; /* user supplied struct for user transform */
- png_byte user_transform_depth; /* bit depth of user transformed pixels */
- png_byte user_transform_channels; /* channels in user transformed pixels */
-#endif
-#endif
-
- png_uint_32 mode; /* tells us where we are in the PNG file */
- png_uint_32 flags; /* flags indicating various things to libpng */
- png_uint_32 transformations; /* which transformations to perform */
-
- z_stream zstream; /* pointer to decompression structure (below) */
- png_bytep zbuf; /* buffer for zlib */
- png_size_t zbuf_size; /* size of zbuf */
- int zlib_level; /* holds zlib compression level */
- int zlib_method; /* holds zlib compression method */
- int zlib_window_bits; /* holds zlib compression window bits */
- int zlib_mem_level; /* holds zlib compression memory level */
- int zlib_strategy; /* holds zlib compression strategy */
-
- png_uint_32 width; /* width of image in pixels */
- png_uint_32 height; /* height of image in pixels */
- png_uint_32 num_rows; /* number of rows in current pass */
- png_uint_32 usr_width; /* width of row at start of write */
- png_uint_32 rowbytes; /* size of row in bytes */
- png_uint_32 irowbytes; /* size of current interlaced row in bytes */
- png_uint_32 iwidth; /* width of current interlaced row in pixels */
- png_uint_32 row_number; /* current row in interlace pass */
- png_bytep prev_row; /* buffer to save previous (unfiltered) row */
- png_bytep row_buf; /* buffer to save current (unfiltered) row */
- png_bytep sub_row; /* buffer to save "sub" row when filtering */
- png_bytep up_row; /* buffer to save "up" row when filtering */
- png_bytep avg_row; /* buffer to save "avg" row when filtering */
- png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
- png_row_info row_info; /* used for transformation routines */
-
- png_uint_32 idat_size; /* current IDAT size for read */
- png_uint_32 crc; /* current chunk CRC value */
- png_colorp palette; /* palette from the input file */
- png_uint_16 num_palette; /* number of color entries in palette */
- png_uint_16 num_trans; /* number of transparency values */
- png_byte chunk_name[5]; /* null-terminated name of current chunk */
- png_byte compression; /* file compression type (always 0) */
- png_byte filter; /* file filter type (always 0) */
- png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
- png_byte pass; /* current interlace pass (0 - 6) */
- png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
- png_byte color_type; /* color type of file */
- png_byte bit_depth; /* bit depth of file */
- png_byte usr_bit_depth; /* bit depth of users row */
- png_byte pixel_depth; /* number of bits per pixel */
- png_byte channels; /* number of channels in file */
- png_byte usr_channels; /* channels at start of write */
- png_byte sig_bytes; /* magic bytes read/written from start of file */
+ png_voidp user_transform_ptr PNG_DEPSTRUCT; /* user supplied struct for user transform */
+ png_byte user_transform_depth PNG_DEPSTRUCT; /* bit depth of user transformed pixels */
+ png_byte user_transform_channels PNG_DEPSTRUCT; /* channels in user transformed pixels */
+#endif
+#endif
+
+ png_uint_32 mode PNG_DEPSTRUCT; /* tells us where we are in the PNG file */
+ png_uint_32 flags PNG_DEPSTRUCT; /* flags indicating various things to libpng */
+ png_uint_32 transformations PNG_DEPSTRUCT; /* which transformations to perform */
+
+ z_stream zstream PNG_DEPSTRUCT; /* pointer to decompression structure (below) */
+ png_bytep zbuf PNG_DEPSTRUCT; /* buffer for zlib */
+ png_size_t zbuf_size PNG_DEPSTRUCT; /* size of zbuf */
+ int zlib_level PNG_DEPSTRUCT; /* holds zlib compression level */
+ int zlib_method PNG_DEPSTRUCT; /* holds zlib compression method */
+ int zlib_window_bits PNG_DEPSTRUCT; /* holds zlib compression window bits */
+ int zlib_mem_level PNG_DEPSTRUCT; /* holds zlib compression memory level */
+ int zlib_strategy PNG_DEPSTRUCT; /* holds zlib compression strategy */
+
+ png_uint_32 width PNG_DEPSTRUCT; /* width of image in pixels */
+ png_uint_32 height PNG_DEPSTRUCT; /* height of image in pixels */
+ png_uint_32 num_rows PNG_DEPSTRUCT; /* number of rows in current pass */
+ png_uint_32 usr_width PNG_DEPSTRUCT; /* width of row at start of write */
+ png_uint_32 rowbytes PNG_DEPSTRUCT; /* size of row in bytes */
+#if 0 /* Replaced with the following in libpng-1.2.43 */
+ png_size_t irowbytes PNG_DEPSTRUCT;
+#endif
+/* Added in libpng-1.2.43 */
+#ifdef PNG_USER_LIMITS_SUPPORTED
+ /* Added in libpng-1.4.0: Total number of sPLT, text, and unknown
+ * chunks that can be stored (0 means unlimited).
+ */
+ png_uint_32 user_chunk_cache_max PNG_DEPSTRUCT;
+#endif
+ png_uint_32 iwidth PNG_DEPSTRUCT; /* width of current interlaced row in pixels */
+ png_uint_32 row_number PNG_DEPSTRUCT; /* current row in interlace pass */
+ png_bytep prev_row PNG_DEPSTRUCT; /* buffer to save previous (unfiltered) row */
+ png_bytep row_buf PNG_DEPSTRUCT; /* buffer to save current (unfiltered) row */
+#ifndef PNG_NO_WRITE_FILTER
+ png_bytep sub_row PNG_DEPSTRUCT; /* buffer to save "sub" row when filtering */
+ png_bytep up_row PNG_DEPSTRUCT; /* buffer to save "up" row when filtering */
+ png_bytep avg_row PNG_DEPSTRUCT; /* buffer to save "avg" row when filtering */
+ png_bytep paeth_row PNG_DEPSTRUCT; /* buffer to save "Paeth" row when filtering */
+#endif
+ png_row_info row_info PNG_DEPSTRUCT; /* used for transformation routines */
+
+ png_uint_32 idat_size PNG_DEPSTRUCT; /* current IDAT size for read */
+ png_uint_32 crc PNG_DEPSTRUCT; /* current chunk CRC value */
+ png_colorp palette PNG_DEPSTRUCT; /* palette from the input file */
+ png_uint_16 num_palette PNG_DEPSTRUCT; /* number of color entries in palette */
+ png_uint_16 num_trans PNG_DEPSTRUCT; /* number of transparency values */
+ png_byte chunk_name[5] PNG_DEPSTRUCT; /* null-terminated name of current chunk */
+ png_byte compression PNG_DEPSTRUCT; /* file compression type (always 0) */
+ png_byte filter PNG_DEPSTRUCT; /* file filter type (always 0) */
+ png_byte interlaced PNG_DEPSTRUCT; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
+ png_byte pass PNG_DEPSTRUCT; /* current interlace pass (0 - 6) */
+ png_byte do_filter PNG_DEPSTRUCT; /* row filter flags (see PNG_FILTER_ below ) */
+ png_byte color_type PNG_DEPSTRUCT; /* color type of file */
+ png_byte bit_depth PNG_DEPSTRUCT; /* bit depth of file */
+ png_byte usr_bit_depth PNG_DEPSTRUCT; /* bit depth of users row */
+ png_byte pixel_depth PNG_DEPSTRUCT; /* number of bits per pixel */
+ png_byte channels PNG_DEPSTRUCT; /* number of channels in file */
+ png_byte usr_channels PNG_DEPSTRUCT; /* channels at start of write */
+ png_byte sig_bytes PNG_DEPSTRUCT; /* magic bytes read/written from start of file */
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
#ifdef PNG_LEGACY_SUPPORTED
- png_byte filler; /* filler byte for pixel expansion */
+ png_byte filler PNG_DEPSTRUCT; /* filler byte for pixel expansion */
#else
- png_uint_16 filler; /* filler bytes for pixel expansion */
+ png_uint_16 filler PNG_DEPSTRUCT; /* filler bytes for pixel expansion */
#endif
#endif
-#if defined(PNG_bKGD_SUPPORTED)
- png_byte background_gamma_type;
+#ifdef PNG_bKGD_SUPPORTED
+ png_byte background_gamma_type PNG_DEPSTRUCT;
# ifdef PNG_FLOATING_POINT_SUPPORTED
- float background_gamma;
+ float background_gamma PNG_DEPSTRUCT;
# endif
- png_color_16 background; /* background color in screen gamma space */
-#if defined(PNG_READ_GAMMA_SUPPORTED)
- png_color_16 background_1; /* background normalized to gamma 1.0 */
+ png_color_16 background PNG_DEPSTRUCT; /* background color in screen gamma space */
+#ifdef PNG_READ_GAMMA_SUPPORTED
+ png_color_16 background_1 PNG_DEPSTRUCT; /* background normalized to gamma 1.0 */
#endif
#endif /* PNG_bKGD_SUPPORTED */
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
- png_flush_ptr output_flush_fn;/* Function for flushing output */
- png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */
- png_uint_32 flush_rows; /* number of rows written since last flush */
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
+ png_flush_ptr output_flush_fn PNG_DEPSTRUCT; /* Function for flushing output */
+ png_uint_32 flush_dist PNG_DEPSTRUCT; /* how many rows apart to flush, 0 - no flush */
+ png_uint_32 flush_rows PNG_DEPSTRUCT; /* number of rows written since last flush */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
- int gamma_shift; /* number of "insignificant" bits 16-bit gamma */
+ int gamma_shift PNG_DEPSTRUCT; /* number of "insignificant" bits 16-bit gamma */
#ifdef PNG_FLOATING_POINT_SUPPORTED
- float gamma; /* file gamma value */
- float screen_gamma; /* screen gamma value (display_exponent) */
+ float gamma PNG_DEPSTRUCT; /* file gamma value */
+ float screen_gamma PNG_DEPSTRUCT; /* screen gamma value (display_exponent) */
#endif
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
- png_bytep gamma_table; /* gamma table for 8-bit depth files */
- png_bytep gamma_from_1; /* converts from 1.0 to screen */
- png_bytep gamma_to_1; /* converts from file to 1.0 */
- png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
- png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
- png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
+ png_bytep gamma_table PNG_DEPSTRUCT; /* gamma table for 8-bit depth files */
+ png_bytep gamma_from_1 PNG_DEPSTRUCT; /* converts from 1.0 to screen */
+ png_bytep gamma_to_1 PNG_DEPSTRUCT; /* converts from file to 1.0 */
+ png_uint_16pp gamma_16_table PNG_DEPSTRUCT; /* gamma table for 16-bit depth files */
+ png_uint_16pp gamma_16_from_1 PNG_DEPSTRUCT; /* converts from 1.0 to screen */
+ png_uint_16pp gamma_16_to_1 PNG_DEPSTRUCT; /* converts from file to 1.0 */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
- png_color_8 sig_bit; /* significant bits in each available channel */
+ png_color_8 sig_bit PNG_DEPSTRUCT; /* significant bits in each available channel */
#endif
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
- png_color_8 shift; /* shift for significant bit tranformation */
+ png_color_8 shift PNG_DEPSTRUCT; /* shift for significant bit tranformation */
#endif
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
|| defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
- png_bytep trans; /* transparency values for paletted files */
- png_color_16 trans_values; /* transparency values for non-paletted files */
+ png_bytep trans PNG_DEPSTRUCT; /* transparency values for paletted files */
+ png_color_16 trans_values PNG_DEPSTRUCT; /* transparency values for non-paletted files */
#endif
- png_read_status_ptr read_row_fn; /* called after each row is decoded */
- png_write_status_ptr write_row_fn; /* called after each row is encoded */
+ png_read_status_ptr read_row_fn PNG_DEPSTRUCT; /* called after each row is decoded */
+ png_write_status_ptr write_row_fn PNG_DEPSTRUCT; /* called after each row is encoded */
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
- png_progressive_info_ptr info_fn; /* called after header data fully read */
- png_progressive_row_ptr row_fn; /* called after each prog. row is decoded */
- png_progressive_end_ptr end_fn; /* called after image is complete */
- png_bytep save_buffer_ptr; /* current location in save_buffer */
- png_bytep save_buffer; /* buffer for previously read data */
- png_bytep current_buffer_ptr; /* current location in current_buffer */
- png_bytep current_buffer; /* buffer for recently used data */
- png_uint_32 push_length; /* size of current input chunk */
- png_uint_32 skip_length; /* bytes to skip in input data */
- png_size_t save_buffer_size; /* amount of data now in save_buffer */
- png_size_t save_buffer_max; /* total size of save_buffer */
- png_size_t buffer_size; /* total amount of available input data */
- png_size_t current_buffer_size; /* amount of data now in current_buffer */
- int process_mode; /* what push library is currently doing */
- int cur_palette; /* current push library palette index */
-
-# if defined(PNG_TEXT_SUPPORTED)
- png_size_t current_text_size; /* current size of text input data */
- png_size_t current_text_left; /* how much text left to read in input */
- png_charp current_text; /* current text chunk buffer */
- png_charp current_text_ptr; /* current location in current_text */
-# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */
-
+ png_progressive_info_ptr info_fn PNG_DEPSTRUCT; /* called after header data fully read */
+ png_progressive_row_ptr row_fn PNG_DEPSTRUCT; /* called after each prog. row is decoded */
+ png_progressive_end_ptr end_fn PNG_DEPSTRUCT; /* called after image is complete */
+ png_bytep save_buffer_ptr PNG_DEPSTRUCT; /* current location in save_buffer */
+ png_bytep save_buffer PNG_DEPSTRUCT; /* buffer for previously read data */
+ png_bytep current_buffer_ptr PNG_DEPSTRUCT; /* current location in current_buffer */
+ png_bytep current_buffer PNG_DEPSTRUCT; /* buffer for recently used data */
+ png_uint_32 push_length PNG_DEPSTRUCT; /* size of current input chunk */
+ png_uint_32 skip_length PNG_DEPSTRUCT; /* bytes to skip in input data */
+ png_size_t save_buffer_size PNG_DEPSTRUCT; /* amount of data now in save_buffer */
+ png_size_t save_buffer_max PNG_DEPSTRUCT; /* total size of save_buffer */
+ png_size_t buffer_size PNG_DEPSTRUCT; /* total amount of available input data */
+ png_size_t current_buffer_size PNG_DEPSTRUCT; /* amount of data now in current_buffer */
+ int process_mode PNG_DEPSTRUCT; /* what push library is currently doing */
+ int cur_palette PNG_DEPSTRUCT; /* current push library palette index */
+
+# ifdef PNG_TEXT_SUPPORTED
+ png_size_t current_text_size PNG_DEPSTRUCT; /* current size of text input data */
+ png_size_t current_text_left PNG_DEPSTRUCT; /* how much text left to read in input */
+ png_charp current_text PNG_DEPSTRUCT; /* current text chunk buffer */
+ png_charp current_text_ptr PNG_DEPSTRUCT; /* current location in current_text */
+# endif /* PNG_TEXT_SUPPORTED */
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
/* for the Borland special 64K segment handler */
- png_bytepp offset_table_ptr;
- png_bytep offset_table;
- png_uint_16 offset_table_number;
- png_uint_16 offset_table_count;
- png_uint_16 offset_table_count_free;
+ png_bytepp offset_table_ptr PNG_DEPSTRUCT;
+ png_bytep offset_table PNG_DEPSTRUCT;
+ png_uint_16 offset_table_number PNG_DEPSTRUCT;
+ png_uint_16 offset_table_count PNG_DEPSTRUCT;
+ png_uint_16 offset_table_count_free PNG_DEPSTRUCT;
#endif
-#if defined(PNG_READ_DITHER_SUPPORTED)
- png_bytep palette_lookup; /* lookup table for dithering */
- png_bytep dither_index; /* index translation for palette files */
+#ifdef PNG_READ_DITHER_SUPPORTED
+ png_bytep palette_lookup PNG_DEPSTRUCT; /* lookup table for dithering */
+ png_bytep dither_index PNG_DEPSTRUCT; /* index translation for palette files */
#endif
#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
- png_uint_16p hist; /* histogram */
+ png_uint_16p hist PNG_DEPSTRUCT; /* histogram */
#endif
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
- png_byte heuristic_method; /* heuristic for row filter selection */
- png_byte num_prev_filters; /* number of weights for previous rows */
- png_bytep prev_filters; /* filter type(s) of previous row(s) */
- png_uint_16p filter_weights; /* weight(s) for previous line(s) */
- png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
- png_uint_16p filter_costs; /* relative filter calculation cost */
- png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
+ png_byte heuristic_method PNG_DEPSTRUCT; /* heuristic for row filter selection */
+ png_byte num_prev_filters PNG_DEPSTRUCT; /* number of weights for previous rows */
+ png_bytep prev_filters PNG_DEPSTRUCT; /* filter type(s) of previous row(s) */
+ png_uint_16p filter_weights PNG_DEPSTRUCT; /* weight(s) for previous line(s) */
+ png_uint_16p inv_filter_weights PNG_DEPSTRUCT; /* 1/weight(s) for previous line(s) */
+ png_uint_16p filter_costs PNG_DEPSTRUCT; /* relative filter calculation cost */
+ png_uint_16p inv_filter_costs PNG_DEPSTRUCT; /* 1/relative filter calculation cost */
#endif
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
- png_charp time_buffer; /* String to hold RFC 1123 time text */
+#ifdef PNG_TIME_RFC1123_SUPPORTED
+ png_charp time_buffer PNG_DEPSTRUCT; /* String to hold RFC 1123 time text */
#endif
/* New members added in libpng-1.0.6 */
#ifdef PNG_FREE_ME_SUPPORTED
- png_uint_32 free_me; /* flags items libpng is responsible for freeing */
+ png_uint_32 free_me PNG_DEPSTRUCT; /* flags items libpng is responsible for freeing */
#endif
-#if defined(PNG_USER_CHUNKS_SUPPORTED)
- png_voidp user_chunk_ptr;
- png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
+#ifdef PNG_USER_CHUNKS_SUPPORTED
+ png_voidp user_chunk_ptr PNG_DEPSTRUCT;
+ png_user_chunk_ptr read_user_chunk_fn PNG_DEPSTRUCT; /* user read chunk handler */
#endif
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
- int num_chunk_list;
- png_bytep chunk_list;
+#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+ int num_chunk_list PNG_DEPSTRUCT;
+ png_bytep chunk_list PNG_DEPSTRUCT;
#endif
/* New members added in libpng-1.0.3 */
-#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
- png_byte rgb_to_gray_status;
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+ png_byte rgb_to_gray_status PNG_DEPSTRUCT;
/* These were changed from png_byte in libpng-1.0.6 */
- png_uint_16 rgb_to_gray_red_coeff;
- png_uint_16 rgb_to_gray_green_coeff;
- png_uint_16 rgb_to_gray_blue_coeff;
+ png_uint_16 rgb_to_gray_red_coeff PNG_DEPSTRUCT;
+ png_uint_16 rgb_to_gray_green_coeff PNG_DEPSTRUCT;
+ png_uint_16 rgb_to_gray_blue_coeff PNG_DEPSTRUCT;
#endif
/* New member added in libpng-1.0.4 (renamed in 1.0.9) */
#if defined(PNG_MNG_FEATURES_SUPPORTED) || \
defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
-/* changed from png_byte to png_uint_32 at version 1.2.0 */
+/* Changed from png_byte to png_uint_32 at version 1.2.0 */
#ifdef PNG_1_0_X
- png_byte mng_features_permitted;
+ png_byte mng_features_permitted PNG_DEPSTRUCT;
#else
- png_uint_32 mng_features_permitted;
+ png_uint_32 mng_features_permitted PNG_DEPSTRUCT;
#endif /* PNG_1_0_X */
#endif
/* New member added in libpng-1.0.7 */
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
- png_fixed_point int_gamma;
+ png_fixed_point int_gamma PNG_DEPSTRUCT;
#endif
/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
-#if defined(PNG_MNG_FEATURES_SUPPORTED)
- png_byte filter_type;
+#ifdef PNG_MNG_FEATURES_SUPPORTED
+ png_byte filter_type PNG_DEPSTRUCT;
#endif
-#if defined(PNG_1_0_X) || (defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD))
+#ifdef PNG_1_0_X
/* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */
- png_uint_32 row_buf_size;
+ png_uint_32 row_buf_size PNG_DEPSTRUCT;
#endif
/* New members added in libpng-1.2.0 */
-#if !defined(PNG_1_0_X) && defined(PNG_ASSEMBLER_CODE_SUPPORTED)
- png_byte mmx_bitdepth_threshold;
- png_uint_32 mmx_rowbytes_threshold;
- png_uint_32 asm_flags;
+#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
+# ifndef PNG_1_0_X
+# ifdef PNG_MMX_CODE_SUPPORTED
+ png_byte mmx_bitdepth_threshold PNG_DEPSTRUCT;
+ png_uint_32 mmx_rowbytes_threshold PNG_DEPSTRUCT;
+# endif
+ png_uint_32 asm_flags PNG_DEPSTRUCT;
+# endif
#endif
/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
#ifdef PNG_USER_MEM_SUPPORTED
- png_voidp mem_ptr; /* user supplied struct for mem functions */
- png_malloc_ptr malloc_fn; /* function for allocating memory */
- png_free_ptr free_fn; /* function for freeing memory */
+ png_voidp mem_ptr PNG_DEPSTRUCT; /* user supplied struct for mem functions */
+ png_malloc_ptr malloc_fn PNG_DEPSTRUCT; /* function for allocating memory */
+ png_free_ptr free_fn PNG_DEPSTRUCT; /* function for freeing memory */
#endif
/* New member added in libpng-1.0.13 and 1.2.0 */
- png_bytep big_row_buf; /* buffer to save current (unfiltered) row */
+ png_bytep big_row_buf PNG_DEPSTRUCT; /* buffer to save current (unfiltered) row */
-#if defined(PNG_READ_DITHER_SUPPORTED)
+#ifdef PNG_READ_DITHER_SUPPORTED
/* The following three members were added at version 1.0.14 and 1.2.4 */
- png_bytep dither_sort; /* working sort array */
- png_bytep index_to_palette; /* where the original index currently is */
- /* in the palette */
- png_bytep palette_to_index; /* which original index points to this */
- /* palette color */
+ png_bytep dither_sort PNG_DEPSTRUCT; /* working sort array */
+ png_bytep index_to_palette PNG_DEPSTRUCT; /* where the original index currently is */
+ /* in the palette */
+ png_bytep palette_to_index PNG_DEPSTRUCT; /* which original index points to this */
+ /* palette color */
#endif
/* New members added in libpng-1.0.16 and 1.2.6 */
- png_byte compression_type;
+ png_byte compression_type PNG_DEPSTRUCT;
-#ifdef PNG_SET_USER_LIMITS_SUPPORTED
- png_uint_32 user_width_max;
- png_uint_32 user_height_max;
+#ifdef PNG_USER_LIMITS_SUPPORTED
+ png_uint_32 user_width_max PNG_DEPSTRUCT;
+ png_uint_32 user_height_max PNG_DEPSTRUCT;
#endif
+/* New member added in libpng-1.0.25 and 1.2.17 */
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
+ /* Storage for unknown chunk that the library doesn't recognize. */
+ png_unknown_chunk unknown_chunk PNG_DEPSTRUCT;
+#endif
+
+/* New members added in libpng-1.2.26 */
+ png_uint_32 old_big_row_buf_size PNG_DEPSTRUCT;
+ png_uint_32 old_prev_row_size PNG_DEPSTRUCT;
+
+/* New member added in libpng-1.2.30 */
+ png_charp chunkdata PNG_DEPSTRUCT; /* buffer for reading chunk data */
+
+
};
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
-typedef png_structp version_1_2_8;
+typedef png_structp version_1_2_44;
typedef png_struct FAR * FAR * png_structpp;
@@ -1386,17 +1577,17 @@ extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start,
/* Simple signature checking function. This is the same as calling
* png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).
*/
-extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num));
+extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num)) PNG_DEPRECATED;
/* Allocate and initialize png_ptr struct for reading, and any other memory. */
extern PNG_EXPORT(png_structp,png_create_read_struct)
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
- png_error_ptr error_fn, png_error_ptr warn_fn));
+ png_error_ptr error_fn, png_error_ptr warn_fn)) PNG_ALLOCATED;
/* Allocate and initialize png_ptr struct for writing, and any other memory */
extern PNG_EXPORT(png_structp,png_create_write_struct)
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
- png_error_ptr error_fn, png_error_ptr warn_fn));
+ png_error_ptr error_fn, png_error_ptr warn_fn)) PNG_ALLOCATED;
#ifdef PNG_WRITE_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size)
@@ -1416,11 +1607,11 @@ extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(png_structp,png_create_read_struct_2)
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
- png_malloc_ptr malloc_fn, png_free_ptr free_fn));
+ png_malloc_ptr malloc_fn, png_free_ptr free_fn)) PNG_ALLOCATED;
extern PNG_EXPORT(png_structp,png_create_write_struct_2)
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
- png_malloc_ptr malloc_fn, png_free_ptr free_fn));
+ png_malloc_ptr malloc_fn, png_free_ptr free_fn)) PNG_ALLOCATED;
#endif
/* Write a PNG chunk - size, type, (optional) data, CRC. */
@@ -1440,13 +1631,17 @@ extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr));
/* Allocate and initialize the info structure */
extern PNG_EXPORT(png_infop,png_create_info_struct)
- PNGARG((png_structp png_ptr));
+ PNGARG((png_structp png_ptr)) PNG_ALLOCATED;
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
/* Initialize the info structure (old interface - DEPRECATED) */
-extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr));
+extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr))
+ PNG_DEPRECATED;
#undef png_info_init
#define png_info_init(info_ptr) png_info_init_3(&info_ptr,\
png_sizeof(png_info));
+#endif
+
extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr,
png_size_t png_info_struct_size));
@@ -1456,36 +1651,41 @@ extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr,
extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr,
png_infop info_ptr));
-#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
-/* read the information before the actual image data. */
+#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+/* Read the information before the actual image data. */
extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr,
png_infop info_ptr));
#endif
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
+#ifdef PNG_TIME_RFC1123_SUPPORTED
extern PNG_EXPORT(png_charp,png_convert_to_rfc1123)
PNGARG((png_structp png_ptr, png_timep ptime));
#endif
-#if !defined(_WIN32_WCE)
-/* "time.h" functions are not supported on WindowsCE */
-#if defined(PNG_WRITE_tIME_SUPPORTED)
-/* convert from a struct tm to png_time */
+#ifdef PNG_CONVERT_tIME_SUPPORTED
+/* Convert from a struct tm to png_time */
extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime,
struct tm FAR * ttime));
-/* convert from time_t to png_time. Uses gmtime() */
+/* Convert from time_t to png_time. Uses gmtime() */
extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime,
time_t ttime));
-#endif /* PNG_WRITE_tIME_SUPPORTED */
-#endif /* _WIN32_WCE */
+#endif /* PNG_CONVERT_tIME_SUPPORTED */
-#if defined(PNG_READ_EXPAND_SUPPORTED)
+#ifdef PNG_READ_EXPAND_SUPPORTED
/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr));
-extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp png_ptr));
+#ifndef PNG_1_0_X
+extern PNG_EXPORT(void,png_set_expand_gray_1_2_4_to_8) PNGARG((png_structp
+ png_ptr));
+#endif
extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr));
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
+/* Deprecated */
+extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp
+ png_ptr)) PNG_DEPRECATED;
+#endif
#endif
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
@@ -1493,12 +1693,12 @@ extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr));
#endif
-#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
/* Expand the grayscale to 24-bit RGB if necessary. */
extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr));
#endif
-#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
/* Reduce RGB to grayscale. */
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr,
@@ -1513,7 +1713,7 @@ extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp
extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth,
png_colorp palette));
-#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
+#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr));
#endif
@@ -1535,7 +1735,7 @@ extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr,
#define PNG_FILLER_BEFORE 0
#define PNG_FILLER_AFTER 1
/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */
-#if !defined(PNG_1_0_X)
+#ifndef PNG_1_0_X
extern PNG_EXPORT(void,png_set_add_alpha) PNGARG((png_structp png_ptr,
png_uint_32 filler, int flags));
#endif
@@ -1573,7 +1773,7 @@ extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr));
#endif
-#if defined(PNG_READ_BACKGROUND_SUPPORTED)
+#ifdef PNG_READ_BACKGROUND_SUPPORTED
/* Handle alpha and tRNS by replacing with a background color. */
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr,
@@ -1586,19 +1786,19 @@ extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr,
#define PNG_BACKGROUND_GAMMA_UNIQUE 3
#endif
-#if defined(PNG_READ_16_TO_8_SUPPORTED)
-/* strip the second byte of information from a 16-bit depth file. */
+#ifdef PNG_READ_16_TO_8_SUPPORTED
+/* Strip the second byte of information from a 16-bit depth file. */
extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr));
#endif
-#if defined(PNG_READ_DITHER_SUPPORTED)
+#ifdef PNG_READ_DITHER_SUPPORTED
/* Turn on dithering, and reduce the palette to the number of colors available. */
extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr,
png_colorp palette, int num_palette, int maximum_colors,
png_uint_16p histogram, int full_dither));
#endif
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
/* Handle gamma correction. Screen_gamma=(display_exponent) */
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr,
@@ -1606,89 +1806,91 @@ extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr,
#endif
#endif
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
#if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
/* Permit or disallow empty PLTE (0: not permitted, 1: permitted) */
/* Deprecated and will be removed. Use png_permit_mng_features() instead. */
extern PNG_EXPORT(void,png_permit_empty_plte) PNGARG((png_structp png_ptr,
- int empty_plte_permitted));
+ int empty_plte_permitted)) PNG_DEPRECATED;
+#endif
#endif
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
/* Set how many lines between output flushes - 0 for no flushing */
extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows));
/* Flush the current PNG output buffer */
extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr));
#endif
-/* optional update palette with requested transformations */
+/* Optional update palette with requested transformations */
extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr));
-/* optional call to update the users info structure */
+/* Optional call to update the users info structure */
extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr,
png_infop info_ptr));
#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
-/* read one or more rows of image data. */
+/* Read one or more rows of image data. */
extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr,
png_bytepp row, png_bytepp display_row, png_uint_32 num_rows));
#endif
#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
-/* read a row of data. */
+/* Read a row of data. */
extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr,
png_bytep row,
png_bytep display_row));
#endif
#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
-/* read the whole image into memory at once. */
+/* Read the whole image into memory at once. */
extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr,
png_bytepp image));
#endif
-/* write a row of image data */
+/* Write a row of image data */
extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr,
png_bytep row));
-/* write a few rows of image data */
+/* Write a few rows of image data */
extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr,
png_bytepp row, png_uint_32 num_rows));
-/* write the image data */
+/* Write the image data */
extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr,
png_bytepp image));
-/* writes the end of the PNG file. */
+/* Writes the end of the PNG file. */
extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr,
png_infop info_ptr));
#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
-/* read the end of the PNG file. */
+/* Read the end of the PNG file. */
extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr,
png_infop info_ptr));
#endif
-/* free any memory associated with the png_info_struct */
+/* Free any memory associated with the png_info_struct */
extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr,
png_infopp info_ptr_ptr));
-/* free any memory associated with the png_struct and the png_info_structs */
+/* Free any memory associated with the png_struct and the png_info_structs */
extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp
png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr));
-/* free all memory used by the read (old method - NOT DLL EXPORTED) */
+/* Free all memory used by the read (old method - NOT DLL EXPORTED) */
extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_infop end_info_ptr));
+ png_infop end_info_ptr)) PNG_DEPRECATED;
-/* free any memory associated with the png_struct and the png_info_structs */
+/* Free any memory associated with the png_struct and the png_info_structs */
extern PNG_EXPORT(void,png_destroy_write_struct)
PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr));
-/* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
-extern void png_write_destroy PNGARG((png_structp png_ptr));
+/* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
+extern void png_write_destroy PNGARG((png_structp png_ptr)) PNG_DEPRECATED;
-/* set the libpng method of handling chunk CRC errors */
+/* Set the libpng method of handling chunk CRC errors */
extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr,
int crit_action, int ancil_action));
@@ -1716,7 +1918,7 @@ extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr,
* header file (zlib.h) for an explination of the compression functions.
*/
-/* set the filtering method(s) used by libpng. Currently, the only valid
+/* Set the filtering method(s) used by libpng. Currently, the only valid
* value for "method" is 0.
*/
extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method,
@@ -1821,7 +2023,7 @@ extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr,
* more information.
*/
-#if !defined(PNG_NO_STDIO)
+#ifdef PNG_STDIO_SUPPORTED
/* Initialize the input/output for the PNG file to the default functions. */
extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp));
#endif
@@ -1844,6 +2046,11 @@ extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr));
* If buffered output is not used, then output_flush_fn can be set to NULL.
* If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time
* output_flush_fn will be ignored (and thus can be NULL).
+ * It is probably a mistake to use NULL for output_flush_fn if
+ * write_data_fn is not also NULL unless you have built libpng with
+ * PNG_WRITE_FLUSH_SUPPORTED undefined, because in this case libpng's
+ * default flush function, which uses the standard *FILE structure, will
+ * be used.
*/
extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr,
png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));
@@ -1908,15 +2115,15 @@ extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr,
png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
png_progressive_end_ptr end_fn));
-/* returns the user pointer associated with the push read functions */
+/* Returns the user pointer associated with the push read functions */
extern PNG_EXPORT(png_voidp,png_get_progressive_ptr)
PNGARG((png_structp png_ptr));
-/* function to be called when data becomes available */
+/* Function to be called when data becomes available */
extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_bytep buffer, png_size_t buffer_size));
-/* function that combines rows. Not very much different than the
+/* Function that combines rows. Not very much different than the
* png_combine_row() call. Is this even used?????
*/
extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr,
@@ -1924,20 +2131,20 @@ extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr,
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr,
- png_uint_32 size));
+ png_uint_32 size)) PNG_ALLOCATED;
-#if defined(PNG_1_0_X)
+#ifdef PNG_1_0_X
# define png_malloc_warn png_malloc
#else
/* Added at libpng version 1.2.4 */
extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr,
- png_uint_32 size));
+ png_uint_32 size)) PNG_ALLOCATED;
#endif
-/* frees a pointer allocated by png_malloc() */
+/* Frees a pointer allocated by png_malloc() */
extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));
-#if defined(PNG_1_0_X)
+#ifdef PNG_1_0_X
/* Function to allocate memory for zlib. */
extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items,
uInt size));
@@ -1951,11 +2158,12 @@ extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 free_me, int num));
#ifdef PNG_FREE_ME_SUPPORTED
/* Reassign responsibility for freeing existing data, whether allocated
- * by libpng or by the application */
+ * by libpng or by the application
+ */
extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr,
png_infop info_ptr, int freer, png_uint_32 mask));
#endif
-/* assignments for png_data_freer */
+/* Assignments for png_data_freer */
#define PNG_DESTROY_WILL_FREE_DATA 1
#define PNG_SET_WILL_FREE_DATA 1
#define PNG_USER_WILL_FREE_DATA 2
@@ -1976,37 +2184,46 @@ extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr,
#ifdef PNG_USER_MEM_SUPPORTED
extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr,
- png_uint_32 size));
+ png_uint_32 size)) PNG_ALLOCATED;
extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr,
png_voidp ptr));
#endif
extern PNG_EXPORT(png_voidp,png_memcpy_check) PNGARG((png_structp png_ptr,
- png_voidp s1, png_voidp s2, png_uint_32 size));
+ png_voidp s1, png_voidp s2, png_uint_32 size)) PNG_DEPRECATED;
extern PNG_EXPORT(png_voidp,png_memset_check) PNGARG((png_structp png_ptr,
- png_voidp s1, int value, png_uint_32 size));
+ png_voidp s1, int value, png_uint_32 size)) PNG_DEPRECATED;
#if defined(USE_FAR_KEYWORD) /* memory model conversion function */
extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
int check));
#endif /* USE_FAR_KEYWORD */
+#ifndef PNG_NO_ERROR_TEXT
/* Fatal error in PNG image of libpng - can't continue */
extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr,
- png_const_charp error_message));
+ png_const_charp error_message)) PNG_NORETURN;
/* The same, but the chunk name is prepended to the error string. */
extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr,
- png_const_charp error_message));
+ png_const_charp error_message)) PNG_NORETURN;
+#else
+/* Fatal error in PNG image of libpng - can't continue */
+extern PNG_EXPORT(void,png_err) PNGARG((png_structp png_ptr)) PNG_NORETURN;
+#endif
+#ifndef PNG_NO_WARNINGS
/* Non-fatal error in libpng. Can continue, but may have a problem. */
extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr,
png_const_charp warning_message));
+#ifdef PNG_READ_SUPPORTED
/* Non-fatal error in libpng, chunk name is prepended to message. */
extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr,
png_const_charp warning_message));
+#endif /* PNG_READ_SUPPORTED */
+#endif /* PNG_NO_WARNINGS */
/* The png_set_<chunk> functions are for storing values in the png_info_struct.
* Similarly, the png_get_<chunk> calls are used to read values from the
@@ -2028,13 +2245,15 @@ png_infop info_ptr, png_uint_32 flag));
extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr,
png_infop info_ptr));
-#if defined(PNG_INFO_IMAGE_SUPPORTED)
+#ifdef PNG_INFO_IMAGE_SUPPORTED
/* Returns row_pointers, which is an array of pointers to scanlines that was
-returned from png_read_png(). */
+ * returned from png_read_png().
+ */
extern PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr,
png_infop info_ptr));
/* Set row_pointers, which is an array of pointers to scanlines for use
-by png_write_png(). */
+ * by png_write_png().
+ */
extern PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_bytepp row_pointers));
#endif
@@ -2102,17 +2321,17 @@ png_ptr, png_infop info_ptr));
extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr,
png_infop info_ptr));
-#if defined(PNG_bKGD_SUPPORTED)
+#ifdef PNG_bKGD_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_color_16p *background));
#endif
-#if defined(PNG_bKGD_SUPPORTED)
+#ifdef PNG_bKGD_SUPPORTED
extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_color_16p background));
#endif
-#if defined(PNG_cHRM_SUPPORTED)
+#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr,
png_infop info_ptr, double *white_x, double *white_y, double *red_x,
@@ -2128,7 +2347,7 @@ extern PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr,
#endif
#endif
-#if defined(PNG_cHRM_SUPPORTED)
+#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr,
png_infop info_ptr, double white_x, double white_y, double red_x,
@@ -2143,7 +2362,7 @@ extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr,
#endif
#endif
-#if defined(PNG_gAMA_SUPPORTED)
+#ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr,
png_infop info_ptr, double *file_gamma));
@@ -2152,7 +2371,7 @@ extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_fixed_point *int_file_gamma));
#endif
-#if defined(PNG_gAMA_SUPPORTED)
+#ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr,
png_infop info_ptr, double file_gamma));
@@ -2161,12 +2380,12 @@ extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_fixed_point int_file_gamma));
#endif
-#if defined(PNG_hIST_SUPPORTED)
+#ifdef PNG_hIST_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_16p *hist));
#endif
-#if defined(PNG_hIST_SUPPORTED)
+#ifdef PNG_hIST_SUPPORTED
extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_16p hist));
#endif
@@ -2181,36 +2400,36 @@ extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr,
int color_type, int interlace_method, int compression_method,
int filter_method));
-#if defined(PNG_oFFs_SUPPORTED)
+#ifdef PNG_oFFs_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,
int *unit_type));
#endif
-#if defined(PNG_oFFs_SUPPORTED)
+#ifdef PNG_oFFs_SUPPORTED
extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y,
int unit_type));
#endif
-#if defined(PNG_pCAL_SUPPORTED)
+#ifdef PNG_pCAL_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1,
int *type, int *nparams, png_charp *units, png_charpp *params));
#endif
-#if defined(PNG_pCAL_SUPPORTED)
+#ifdef PNG_pCAL_SUPPORTED
extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1,
int type, int nparams, png_charp units, png_charpp params));
#endif
-#if defined(PNG_pHYs_SUPPORTED)
+#ifdef PNG_pHYs_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
#endif
-#if defined(PNG_pHYs_SUPPORTED)
+#ifdef PNG_pHYs_SUPPORTED
extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type));
#endif
@@ -2221,53 +2440,53 @@ extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr,
extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_colorp palette, int num_palette));
-#if defined(PNG_sBIT_SUPPORTED)
+#ifdef PNG_sBIT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_color_8p *sig_bit));
#endif
-#if defined(PNG_sBIT_SUPPORTED)
+#ifdef PNG_sBIT_SUPPORTED
extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_color_8p sig_bit));
#endif
-#if defined(PNG_sRGB_SUPPORTED)
+#ifdef PNG_sRGB_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr,
png_infop info_ptr, int *intent));
#endif
-#if defined(PNG_sRGB_SUPPORTED)
+#ifdef PNG_sRGB_SUPPORTED
extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr,
png_infop info_ptr, int intent));
extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr,
png_infop info_ptr, int intent));
#endif
-#if defined(PNG_iCCP_SUPPORTED)
+#ifdef PNG_iCCP_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_charpp name, int *compression_type,
png_charpp profile, png_uint_32 *proflen));
/* Note to maintainer: profile should be png_bytepp */
#endif
-#if defined(PNG_iCCP_SUPPORTED)
+#ifdef PNG_iCCP_SUPPORTED
extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_charp name, int compression_type,
png_charp profile, png_uint_32 proflen));
/* Note to maintainer: profile should be png_bytep */
#endif
-#if defined(PNG_sPLT_SUPPORTED)
+#ifdef PNG_sPLT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_sPLT_tpp entries));
#endif
-#if defined(PNG_sPLT_SUPPORTED)
+#ifdef PNG_sPLT_SUPPORTED
extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_sPLT_tp entries, int nentries));
#endif
-#if defined(PNG_TEXT_SUPPORTED)
+#ifdef PNG_TEXT_SUPPORTED
/* png_get_text also returns the number of text chunks in *num_text */
extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_textp *text_ptr, int *num_text));
@@ -2281,37 +2500,37 @@ extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr,
* they will never be NULL pointers.
*/
-#if defined(PNG_TEXT_SUPPORTED)
+#ifdef PNG_TEXT_SUPPORTED
extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_textp text_ptr, int num_text));
#endif
-#if defined(PNG_tIME_SUPPORTED)
+#ifdef PNG_tIME_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_timep *mod_time));
#endif
-#if defined(PNG_tIME_SUPPORTED)
+#ifdef PNG_tIME_SUPPORTED
extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_timep mod_time));
#endif
-#if defined(PNG_tRNS_SUPPORTED)
+#ifdef PNG_tRNS_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_bytep *trans, int *num_trans,
png_color_16p *trans_values));
#endif
-#if defined(PNG_tRNS_SUPPORTED)
+#ifdef PNG_tRNS_SUPPORTED
extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_bytep trans, int num_trans,
png_color_16p trans_values));
#endif
-#if defined(PNG_tRNS_SUPPORTED)
+#ifdef PNG_tRNS_SUPPORTED
#endif
-#if defined(PNG_sCAL_SUPPORTED)
+#ifdef PNG_sCAL_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr,
png_infop info_ptr, int *unit, double *width, double *height));
@@ -2323,29 +2542,34 @@ extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr,
#endif
#endif /* PNG_sCAL_SUPPORTED */
-#if defined(PNG_sCAL_SUPPORTED)
+#ifdef PNG_sCAL_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr,
png_infop info_ptr, int unit, double width, double height));
-#endif
+#else
#ifdef PNG_FIXED_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr,
png_infop info_ptr, int unit, png_charp swidth, png_charp sheight));
#endif
+#endif
#endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
-/* provide a list of chunks and how they are to be handled, if the built-in
+#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+/* Provide a list of chunks and how they are to be handled, if the built-in
handling or default unknown chunk handling is not desired. Any chunks not
listed will be handled in the default manner. The IHDR and IEND chunks
must not be listed.
- keep = 0: follow default behavour
+ keep = 0: follow default behaviour
= 1: do not keep
= 2: keep only if safe-to-copy
= 3: keep even if unsafe-to-copy
*/
extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp
png_ptr, int keep, png_bytep chunk_list, int num_chunks));
+PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep
+ chunk_name));
+#endif
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns));
extern PNG_EXPORT(void, png_set_unknown_chunk_location)
@@ -2353,18 +2577,15 @@ extern PNG_EXPORT(void, png_set_unknown_chunk_location)
extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp
png_ptr, png_infop info_ptr, png_unknown_chunkpp entries));
#endif
-#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
-PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep
- chunk_name));
-#endif
/* Png_free_data() will turn off the "valid" flag for anything it frees.
- If you need to turn it off for a chunk that your application has freed,
- you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); */
+ * If you need to turn it off for a chunk that your application has freed,
+ * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK);
+ */
extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr,
png_infop info_ptr, int mask));
-#if defined(PNG_INFO_IMAGE_SUPPORTED)
+#ifdef PNG_INFO_IMAGE_SUPPORTED
/* The "params" pointer is currently not used and is for future expansion. */
extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr,
png_infop info_ptr,
@@ -2386,34 +2607,90 @@ extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
#include <crtdbg.h>
#if (PNG_DEBUG > 1)
-#define png_debug(l,m) _RPT0(_CRT_WARN,m)
-#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m,p1)
-#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m,p1,p2)
+#ifndef _DEBUG
+# define _DEBUG
+#endif
+#ifndef png_debug
+#define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
+#endif
+#ifndef png_debug1
+#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
+#endif
+#ifndef png_debug2
+#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
+#endif
#endif
#else /* PNG_DEBUG_FILE || !_MSC_VER */
#ifndef PNG_DEBUG_FILE
#define PNG_DEBUG_FILE stderr
#endif /* PNG_DEBUG_FILE */
+
#if (PNG_DEBUG > 1)
-#define png_debug(l,m) \
-{ \
- int num_tabs=l; \
- fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
- (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
-}
-#define png_debug1(l,m,p1) \
-{ \
- int num_tabs=l; \
- fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
- (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
-}
-#define png_debug2(l,m,p1,p2) \
-{ \
- int num_tabs=l; \
- fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
- (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
-}
+/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on non-ISO
+ * compilers.
+ */
+# ifdef __STDC__
+# ifndef png_debug
+# define png_debug(l,m) \
+ { \
+ int num_tabs=l; \
+ fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
+ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
+ }
+# endif
+# ifndef png_debug1
+# define png_debug1(l,m,p1) \
+ { \
+ int num_tabs=l; \
+ fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
+ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
+ }
+# endif
+# ifndef png_debug2
+# define png_debug2(l,m,p1,p2) \
+ { \
+ int num_tabs=l; \
+ fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
+ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
+ }
+# endif
+# else /* __STDC __ */
+# ifndef png_debug
+# define png_debug(l,m) \
+ { \
+ int num_tabs=l; \
+ char format[256]; \
+ snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
+ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
+ m,PNG_STRING_NEWLINE); \
+ fprintf(PNG_DEBUG_FILE,format); \
+ }
+# endif
+# ifndef png_debug1
+# define png_debug1(l,m,p1) \
+ { \
+ int num_tabs=l; \
+ char format[256]; \
+ snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
+ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
+ m,PNG_STRING_NEWLINE); \
+ fprintf(PNG_DEBUG_FILE,format,p1); \
+ }
+# endif
+# ifndef png_debug2
+# define png_debug2(l,m,p1,p2) \
+ { \
+ int num_tabs=l; \
+ char format[256]; \
+ snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
+ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
+ m,PNG_STRING_NEWLINE); \
+ fprintf(PNG_DEBUG_FILE,format,p1,p2); \
+ }
+# endif
+# endif /* __STDC __ */
#endif /* (PNG_DEBUG > 1) */
+
#endif /* _MSC_VER */
#endif /* (PNG_DEBUG > 0) */
#endif /* PNG_DEBUG */
@@ -2427,8 +2704,6 @@ extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
#define png_debug2(l, m, p1, p2)
#endif
-extern PNG_EXPORT(png_bytep,png_sig_bytes) PNGARG((void));
-
extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr));
@@ -2446,7 +2721,8 @@ extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp
#define PNG_HANDLE_CHUNK_ALWAYS 3
/* Added to version 1.2.0 */
-#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
+#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
+#ifdef PNG_MMX_CODE_SUPPORTED
#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */
#define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */
#define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04
@@ -2472,8 +2748,9 @@ extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp
#define PNG_SELECT_READ 1
#define PNG_SELECT_WRITE 2
+#endif /* PNG_MMX_CODE_SUPPORTED */
-#if !defined(PNG_1_0_X)
+#ifndef PNG_1_0_X
/* pngget.c */
extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask)
PNGARG((int flag_select, int *compilerID));
@@ -2504,21 +2781,21 @@ extern PNG_EXPORT(void,png_set_mmx_thresholds)
png_uint_32 mmx_rowbytes_threshold));
#endif /* PNG_1_0_X */
-#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
-#if !defined(PNG_1_0_X)
+#ifndef PNG_1_0_X
/* png.c, pnggccrd.c, or pngvcrd.c */
extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));
+#endif /* PNG_1_0_X */
+#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
/* Strip the prepended error numbers ("#nnn ") from error and warning
- * messages before passing them to the error or warning handler. */
+ * messages before passing them to the error or warning handler.
+ */
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp
png_ptr, png_uint_32 strip_mode));
#endif
-#endif /* PNG_1_0_X */
-
/* Added at libpng-1.2.6 */
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
extern PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp
@@ -2528,8 +2805,9 @@ extern PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_structp
extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
png_ptr));
#endif
-
-/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
+/* Maintainer: Put new public prototypes here ^, in libpng.3, and in
+ * project defs
+ */
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
/* With these routines we avoid an integer divide, which will be slower on
@@ -2558,7 +2836,7 @@ extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
(png_uint_32)(alpha)) + (png_uint_32)32768L); \
(composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
-#else /* standard method using integer division */
+#else /* Standard method using integer division */
# define png_composite(composite, fg, alpha, bg) \
(composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \
@@ -2572,22 +2850,65 @@ extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
+/* Inline macros to do direct reads of bytes from the input buffer. These
+ * require that you are using an architecture that uses PNG byte ordering
+ * (MSB first) and supports unaligned data storage. I think that PowerPC
+ * in big-endian mode and 680x0 are the only ones that will support this.
+ * The x86 line of processors definitely do not. The png_get_int_32()
+ * routine also assumes we are using two's complement format for negative
+ * values, which is almost certainly true.
+ */
+#ifdef PNG_READ_BIG_ENDIAN_SUPPORTED
+# define png_get_uint_32(buf) ( *((png_uint_32p) (buf)))
+# define png_get_uint_16(buf) ( *((png_uint_16p) (buf)))
+# define png_get_int_32(buf) ( *((png_int_32p) (buf)))
+#else
+extern PNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf));
+extern PNG_EXPORT(png_uint_16,png_get_uint_16) PNGARG((png_bytep buf));
+extern PNG_EXPORT(png_int_32,png_get_int_32) PNGARG((png_bytep buf));
+#endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */
+extern PNG_EXPORT(png_uint_32,png_get_uint_31)
+ PNGARG((png_structp png_ptr, png_bytep buf));
+/* No png_get_int_16 -- may be added if there's a real need for it. */
+
+/* Place a 32-bit number into a buffer in PNG byte order (big-endian).
+ */
+extern PNG_EXPORT(void,png_save_uint_32)
+ PNGARG((png_bytep buf, png_uint_32 i));
+extern PNG_EXPORT(void,png_save_int_32)
+ PNGARG((png_bytep buf, png_int_32 i));
+
+/* Place a 16-bit number into a buffer in PNG byte order.
+ * The parameter is declared unsigned int, not png_uint_16,
+ * just to avoid potential problems on pre-ANSI C compilers.
+ */
+extern PNG_EXPORT(void,png_save_uint_16)
+ PNGARG((png_bytep buf, unsigned int i));
+/* No png_save_int_16 -- may be added if there's a real need for it. */
+
+/* ************************************************************************* */
+
/* These next functions are used internally in the code. They generally
* shouldn't be used unless you are writing code to add or replace some
* functionality in libpng. More information about most functions can
* be found in the files where the functions are located.
*/
-#if defined(PNG_INTERNAL)
-/* Various modes of operation. Note that after an init, mode is set to
- * zero automatically when the structure is created.
+/* Various modes of operation, that are visible to applications because
+ * they are used for unknown chunk location.
*/
#define PNG_HAVE_IHDR 0x01
#define PNG_HAVE_PLTE 0x02
#define PNG_HAVE_IDAT 0x04
-#define PNG_AFTER_IDAT 0x08
+#define PNG_AFTER_IDAT 0x08 /* Have complete zlib datastream */
#define PNG_HAVE_IEND 0x10
+
+#ifdef PNG_INTERNAL
+
+/* More modes of operation. Note that after an init, mode is set to
+ * zero automatically when the structure is created.
+ */
#define PNG_HAVE_gAMA 0x20
#define PNG_HAVE_cHRM 0x40
#define PNG_HAVE_sRGB 0x80
@@ -2596,8 +2917,9 @@ extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
#define PNG_WROTE_INFO_BEFORE_PLTE 0x400
#define PNG_BACKGROUND_IS_GRAY 0x800
#define PNG_HAVE_PNG_SIGNATURE 0x1000
+#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
-/* flags for the transformations the PNG library does on the image data */
+/* Flags for the transformations the PNG library does on the image data */
#define PNG_BGR 0x0001
#define PNG_INTERLACE 0x0002
#define PNG_PACK 0x0004
@@ -2624,14 +2946,15 @@ extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
#define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */
/* 0x800000L Unused */
#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */
- /* 0x2000000L unused */
- /* 0x4000000L unused */
+#define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */
+#define PNG_PREMULTIPLY_ALPHA 0x4000000L /* Added to libpng-1.2.41 */
+ /* by volker */
/* 0x8000000L unused */
/* 0x10000000L unused */
/* 0x20000000L unused */
/* 0x40000000L unused */
-/* flags for png_create_struct */
+/* Flags for png_create_struct */
#define PNG_STRUCT_PNG 0x0001
#define PNG_STRUCT_INFO 0x0002
@@ -2641,7 +2964,7 @@ extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
#define PNG_COST_SHIFT 3
#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))
-/* flags for the png_ptr->flags rather than declaring a byte for each one */
+/* Flags for the png_ptr->flags rather than declaring a byte for each one */
#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001
#define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002
#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004
@@ -2683,7 +3006,7 @@ extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
#define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \
PNG_FLAG_CRC_CRITICAL_MASK)
-/* save typing and make code easier to understand */
+/* Save typing and make code easier to understand */
#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
abs((int)((c1).green) - (int)((c2).green)) + \
@@ -2696,19 +3019,19 @@ extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
(( ((width) * ((png_uint_32)(pixel_bits))) + 7) >> 3) )
/* PNG_OUT_OF_RANGE returns true if value is outside the range
- ideal-delta..ideal+delta. Each argument is evaluated twice.
- "ideal" and "delta" should be constants, normally simple
- integers, "value" a variable. Added to libpng-1.2.6 JB */
+ * ideal-delta..ideal+delta. Each argument is evaluated twice.
+ * "ideal" and "delta" should be constants, normally simple
+ * integers, "value" a variable. Added to libpng-1.2.6 JB
+ */
#define PNG_OUT_OF_RANGE(value, ideal, delta) \
( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
-/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
+/* Variables declared in png.c - only it needs to define PNG_NO_EXTERN */
#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
-/* place to hold the signature string for a PNG file. */
+/* Place to hold the signature string for a PNG file. */
#ifdef PNG_USE_GLOBAL_ARRAYS
- PNG_EXPORT_VAR (const png_byte FARDATA) png_sig[8];
+ PNG_EXPORT_VAR (PNG_CONST png_byte FARDATA) png_sig[8];
#else
-#define png_sig png_sig_bytes(NULL)
#endif
#endif /* PNG_NO_EXTERN */
@@ -2716,97 +3039,82 @@ extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
* define the name here, and add an invocation of the macro in png.c and
* wherever it's needed.
*/
-#define PNG_IHDR const png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'}
-#define PNG_IDAT const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}
-#define PNG_IEND const png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'}
-#define PNG_PLTE const png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'}
-#define PNG_bKGD const png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'}
-#define PNG_cHRM const png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'}
-#define PNG_gAMA const png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'}
-#define PNG_hIST const png_byte png_hIST[5] = {104, 73, 83, 84, '\0'}
-#define PNG_iCCP const png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'}
-#define PNG_iTXt const png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'}
-#define PNG_oFFs const png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'}
-#define PNG_pCAL const png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'}
-#define PNG_sCAL const png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'}
-#define PNG_pHYs const png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'}
-#define PNG_sBIT const png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'}
-#define PNG_sPLT const png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'}
-#define PNG_sRGB const png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'}
-#define PNG_tEXt const png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'}
-#define PNG_tIME const png_byte png_tIME[5] = {116, 73, 77, 69, '\0'}
-#define PNG_tRNS const png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}
-#define PNG_zTXt const png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}
+#define PNG_IHDR png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'}
+#define PNG_IDAT png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}
+#define PNG_IEND png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'}
+#define PNG_PLTE png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'}
+#define PNG_bKGD png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'}
+#define PNG_cHRM png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'}
+#define PNG_gAMA png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'}
+#define PNG_hIST png_byte png_hIST[5] = {104, 73, 83, 84, '\0'}
+#define PNG_iCCP png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'}
+#define PNG_iTXt png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'}
+#define PNG_oFFs png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'}
+#define PNG_pCAL png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'}
+#define PNG_sCAL png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'}
+#define PNG_pHYs png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'}
+#define PNG_sBIT png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'}
+#define PNG_sPLT png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'}
+#define PNG_sRGB png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'}
+#define PNG_tEXt png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'}
+#define PNG_tIME png_byte png_tIME[5] = {116, 73, 77, 69, '\0'}
+#define PNG_tRNS png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}
+#define PNG_zTXt png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}
#ifdef PNG_USE_GLOBAL_ARRAYS
-PNG_EXPORT_VAR (const png_byte FARDATA) png_IHDR[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_IDAT[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_IEND[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_PLTE[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_bKGD[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_cHRM[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_gAMA[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_hIST[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_iCCP[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_iTXt[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_oFFs[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_pCAL[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_sCAL[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_pHYs[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_sBIT[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_sPLT[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_sRGB[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_tEXt[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_tIME[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_tRNS[5];
-PNG_EXPORT_VAR (const png_byte FARDATA) png_zTXt[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_IHDR[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_IDAT[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_IEND[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_PLTE[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_bKGD[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_cHRM[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_gAMA[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_hIST[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_iCCP[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_iTXt[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_oFFs[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_pCAL[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_sCAL[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_pHYs[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_sBIT[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_sPLT[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_sRGB[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_tEXt[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_tIME[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_tRNS[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_zTXt[5];
#endif /* PNG_USE_GLOBAL_ARRAYS */
-
-/* Inline macros to do direct reads of bytes from the input buffer. These
- * require that you are using an architecture that uses PNG byte ordering
- * (MSB first) and supports unaligned data storage. I think that PowerPC
- * in big-endian mode and 680x0 are the only ones that will support this.
- * The x86 line of processors definitely do not. The png_get_int_32()
- * routine also assumes we are using two's complement format for negative
- * values, which is almost certainly true.
- */
-#if defined(PNG_READ_BIG_ENDIAN_SUPPORTED)
-# if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED)
-# define png_get_int_32(buf) ( *((png_int_32p) (buf)))
-# endif
-# define png_get_uint_32(buf) ( *((png_uint_32p) (buf)))
-# define png_get_uint_16(buf) ( *((png_uint_16p) (buf)))
-#else
-# if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED)
-PNG_EXTERN png_int_32 png_get_int_32 PNGARG((png_bytep buf));
-# endif
-PNG_EXTERN png_uint_32 png_get_uint_32 PNGARG((png_bytep buf));
-PNG_EXTERN png_uint_16 png_get_uint_16 PNGARG((png_bytep buf));
-#endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */
-PNG_EXTERN png_uint_32 png_get_uint_31 PNGARG((png_structp png_ptr,
- png_bytep buf));
-
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
/* Initialize png_ptr struct for reading, and allocate any other memory.
* (old interface - DEPRECATED - use png_create_read_struct instead).
*/
-extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr));
+extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr))
+ PNG_DEPRECATED;
#undef png_read_init
#define png_read_init(png_ptr) png_read_init_3(&png_ptr, \
PNG_LIBPNG_VER_STRING, png_sizeof(png_struct));
+#endif
+
extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr,
png_const_charp user_png_ver, png_size_t png_struct_size));
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr,
png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
png_info_size));
+#endif
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
/* Initialize png_ptr struct for writing, and allocate any other memory.
* (old interface - DEPRECATED - use png_create_write_struct instead).
*/
-extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr));
+extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr))
+ PNG_DEPRECATED;
#undef png_write_init
#define png_write_init(png_ptr) png_write_init_3(&png_ptr, \
PNG_LIBPNG_VER_STRING, png_sizeof(png_struct));
+#endif
+
extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr,
png_const_charp user_png_ver, png_size_t png_struct_size));
extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr,
@@ -2814,119 +3122,107 @@ extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr,
png_info_size));
/* Allocate memory for an internal libpng struct */
-PNG_EXTERN png_voidp png_create_struct PNGARG((int type));
+PNG_EXTERN png_voidp png_create_struct PNGARG((int type)) PNG_PRIVATE;
/* Free memory from internal libpng struct */
-PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));
+PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)) PNG_PRIVATE;
PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr
- malloc_fn, png_voidp mem_ptr));
+ malloc_fn, png_voidp mem_ptr)) PNG_PRIVATE;
PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
- png_free_ptr free_fn, png_voidp mem_ptr));
+ png_free_ptr free_fn, png_voidp mem_ptr)) PNG_PRIVATE;
/* Free any memory that info_ptr points to and reset struct. */
PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
- png_infop info_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
#ifndef PNG_1_0_X
/* Function to allocate memory for zlib. */
-PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
+PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items,
+ uInt size)) PNG_PRIVATE;
/* Function to free memory for zlib */
-PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
+PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr)) PNG_PRIVATE;
#ifdef PNG_SIZE_T
/* Function to convert a sizeof an item to png_sizeof item */
- PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size));
+ PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size))
+ PNG_PRIVATE;
#endif
/* Next four functions are used internally as callbacks. PNGAPI is required
- * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */
+ * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3.
+ */
PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr,
- png_bytep data, png_size_t length));
+ png_bytep data, png_size_t length)) PNG_PRIVATE;
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr,
- png_bytep buffer, png_size_t length));
+ png_bytep buffer, png_size_t length)) PNG_PRIVATE;
#endif
PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr,
- png_bytep data, png_size_t length));
+ png_bytep data, png_size_t length)) PNG_PRIVATE;
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
-#if !defined(PNG_NO_STDIO)
-PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr));
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
+#ifdef PNG_STDIO_SUPPORTED
+PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr))
+ PNG_PRIVATE;
#endif
#endif
#else /* PNG_1_0_X */
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr,
- png_bytep buffer, png_size_t length));
+ png_bytep buffer, png_size_t length)) PNG_PRIVATE;
#endif
#endif /* PNG_1_0_X */
/* Reset the CRC variable */
-PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
+PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr)) PNG_PRIVATE;
/* Write the "data" buffer to whatever output you are using. */
PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data,
- png_size_t length));
+ png_size_t length)) PNG_PRIVATE;
/* Read data from whatever input you are using into the "data" buffer */
PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
- png_size_t length));
+ png_size_t length)) PNG_PRIVATE;
/* Read bytes into buf, and update png_ptr->crc */
PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
- png_size_t length));
+ png_size_t length)) PNG_PRIVATE;
/* Decompress data in a chunk that uses compression */
#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
-PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr,
- int comp_type, png_charp chunkdata, png_size_t chunklength,
- png_size_t prefix_length, png_size_t *data_length));
+PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr,
+ int comp_type, png_size_t chunklength,
+ png_size_t prefix_length, png_size_t *data_length)) PNG_PRIVATE;
#endif
/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
-PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip));
+PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip)
+ PNG_PRIVATE);
/* Read the CRC from the file and compare it to the libpng calculated CRC */
-PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr));
+PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr)) PNG_PRIVATE;
/* Calculate the CRC over a section of data. Note that we are only
* passing a maximum of 64K on systems that have this as a memory limit,
* since this is the maximum buffer size we can specify.
*/
PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
- png_size_t length));
+ png_size_t length)) PNG_PRIVATE;
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
-PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
+PNG_EXTERN void png_flush PNGARG((png_structp png_ptr)) PNG_PRIVATE;
#endif
+/* Simple function to write the signature */
+PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr)) PNG_PRIVATE;
-/* Place a 32-bit number into a buffer in PNG byte order (big-endian).
- * The only currently known PNG chunks that use signed numbers are
- * the ancillary extension chunks, oFFs and pCAL.
- */
-PNG_EXTERN void png_save_uint_32 PNGARG((png_bytep buf, png_uint_32 i));
-
-#if defined(PNG_WRITE_pCAL_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
-PNG_EXTERN void png_save_int_32 PNGARG((png_bytep buf, png_int_32 i));
-#endif
-
-/* Place a 16-bit number into a buffer in PNG byte order.
- * The parameter is declared unsigned int, not png_uint_16,
- * just to avoid potential problems on pre-ANSI C compilers.
- */
-PNG_EXTERN void png_save_uint_16 PNGARG((png_bytep buf, unsigned int i));
-
-/* simple function to write the signature */
-PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr));
-
-/* write various chunks */
+/* Write various chunks */
/* Write the IHDR chunk, and update the png_struct with the necessary
* information.
@@ -2934,478 +3230,551 @@ PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr));
PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
png_uint_32 height,
int bit_depth, int color_type, int compression_method, int filter_method,
- int interlace_method));
+ int interlace_method)) PNG_PRIVATE;
PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,
- png_uint_32 num_pal));
+ png_uint_32 num_pal)) PNG_PRIVATE;
PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
- png_size_t length));
+ png_size_t length)) PNG_PRIVATE;
-PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));
+PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr)) PNG_PRIVATE;
-#if defined(PNG_WRITE_gAMA_SUPPORTED)
+#ifdef PNG_WRITE_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
-PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma));
+PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma))
+ PNG_PRIVATE;
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
-PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, png_fixed_point
- file_gamma));
+PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr,
+ png_fixed_point file_gamma)) PNG_PRIVATE;
#endif
#endif
-#if defined(PNG_WRITE_sBIT_SUPPORTED)
+#ifdef PNG_WRITE_sBIT_SUPPORTED
PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
- int color_type));
+ int color_type)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_cHRM_SUPPORTED)
+#ifdef PNG_WRITE_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr,
double white_x, double white_y,
double red_x, double red_y, double green_x, double green_y,
- double blue_x, double blue_y));
+ double blue_x, double blue_y)) PNG_PRIVATE;
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr,
png_fixed_point int_white_x, png_fixed_point int_white_y,
png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
- png_fixed_point int_blue_y));
+ png_fixed_point int_blue_y)) PNG_PRIVATE;
#endif
#endif
-#if defined(PNG_WRITE_sRGB_SUPPORTED)
+#ifdef PNG_WRITE_sRGB_SUPPORTED
PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
- int intent));
+ int intent)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_iCCP_SUPPORTED)
+#ifdef PNG_WRITE_iCCP_SUPPORTED
PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,
png_charp name, int compression_type,
- png_charp profile, int proflen));
+ png_charp profile, int proflen)) PNG_PRIVATE;
/* Note to maintainer: profile should be png_bytep */
#endif
-#if defined(PNG_WRITE_sPLT_SUPPORTED)
+#ifdef PNG_WRITE_sPLT_SUPPORTED
PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr,
- png_sPLT_tp palette));
+ png_sPLT_tp palette)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_tRNS_SUPPORTED)
+#ifdef PNG_WRITE_tRNS_SUPPORTED
PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,
- png_color_16p values, int number, int color_type));
+ png_color_16p values, int number, int color_type)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_bKGD_SUPPORTED)
+#ifdef PNG_WRITE_bKGD_SUPPORTED
PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,
- png_color_16p values, int color_type));
+ png_color_16p values, int color_type)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_hIST_SUPPORTED)
+#ifdef PNG_WRITE_hIST_SUPPORTED
PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,
- int num_hist));
+ int num_hist)) PNG_PRIVATE;
#endif
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,
- png_charp key, png_charpp new_key));
+ png_charp key, png_charpp new_key)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_tEXt_SUPPORTED)
+#ifdef PNG_WRITE_tEXt_SUPPORTED
PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,
- png_charp text, png_size_t text_len));
+ png_charp text, png_size_t text_len)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_zTXt_SUPPORTED)
+#ifdef PNG_WRITE_zTXt_SUPPORTED
PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,
- png_charp text, png_size_t text_len, int compression));
+ png_charp text, png_size_t text_len, int compression)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_iTXt_SUPPORTED)
+#ifdef PNG_WRITE_iTXt_SUPPORTED
PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,
int compression, png_charp key, png_charp lang, png_charp lang_key,
- png_charp text));
+ png_charp text)) PNG_PRIVATE;
#endif
-#if defined(PNG_TEXT_SUPPORTED) /* Added at version 1.0.14 and 1.2.4 */
+#ifdef PNG_TEXT_SUPPORTED /* Added at version 1.0.14 and 1.2.4 */
PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_textp text_ptr, int num_text));
+ png_infop info_ptr, png_textp text_ptr, int num_text)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_oFFs_SUPPORTED)
+#ifdef PNG_WRITE_oFFs_SUPPORTED
PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
- png_int_32 x_offset, png_int_32 y_offset, int unit_type));
+ png_int_32 x_offset, png_int_32 y_offset, int unit_type)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_pCAL_SUPPORTED)
+#ifdef PNG_WRITE_pCAL_SUPPORTED
PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose,
png_int_32 X0, png_int_32 X1, int type, int nparams,
- png_charp units, png_charpp params));
+ png_charp units, png_charpp params)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_pHYs_SUPPORTED)
+#ifdef PNG_WRITE_pHYs_SUPPORTED
PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,
png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
- int unit_type));
+ int unit_type)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_tIME_SUPPORTED)
+#ifdef PNG_WRITE_tIME_SUPPORTED
PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
- png_timep mod_time));
+ png_timep mod_time)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_sCAL_SUPPORTED)
+#ifdef PNG_WRITE_sCAL_SUPPORTED
#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,
- int unit, double width, double height));
+ int unit, double width, double height)) PNG_PRIVATE;
#else
#ifdef PNG_FIXED_POINT_SUPPORTED
PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,
- int unit, png_charp width, png_charp height));
+ int unit, png_charp width, png_charp height)) PNG_PRIVATE;
#endif
#endif
#endif
/* Called when finished processing a row of data */
-PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));
+PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)) PNG_PRIVATE;
/* Internal use only. Called before first row of data */
-PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));
+PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr)) PNG_PRIVATE;
-#if defined(PNG_READ_GAMMA_SUPPORTED)
-PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr));
+#ifdef PNG_READ_GAMMA_SUPPORTED
+PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr)) PNG_PRIVATE;
#endif
-/* combine a row of data, dealing with alpha, etc. if requested */
+/* Combine a row of data, dealing with alpha, etc. if requested */
PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
- int mask));
+ int mask)) PNG_PRIVATE;
-#if defined(PNG_READ_INTERLACING_SUPPORTED)
-/* expand an interlaced row */
+#ifdef PNG_READ_INTERLACING_SUPPORTED
+/* Expand an interlaced row */
/* OLD pre-1.0.9 interface:
PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
- png_bytep row, int pass, png_uint_32 transformations));
+ png_bytep row, int pass, png_uint_32 transformations)) PNG_PRIVATE;
*/
-PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));
+PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr)) PNG_PRIVATE;
#endif
/* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */
-#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
-/* grab pixels out of a row for an interlaced pass */
+#ifdef PNG_WRITE_INTERLACING_SUPPORTED
+/* Grab pixels out of a row for an interlaced pass */
PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
- png_bytep row, int pass));
+ png_bytep row, int pass)) PNG_PRIVATE;
#endif
-/* unfilter a row */
+/* Unfilter a row */
PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,
- png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));
+ png_row_infop row_info, png_bytep row, png_bytep prev_row,
+ int filter)) PNG_PRIVATE;
/* Choose the best filter to use and filter the row data */
PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,
- png_row_infop row_info));
+ png_row_infop row_info)) PNG_PRIVATE;
/* Write out the filtered row. */
PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr,
- png_bytep filtered_row));
-/* finish a row while reading, dealing with interlacing passes, etc. */
+ png_bytep filtered_row)) PNG_PRIVATE;
+/* Finish a row while reading, dealing with interlacing passes, etc. */
PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));
-/* initialize the row buffers, etc. */
-PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr));
-/* optional call to update the users info structure */
+/* Initialize the row buffers, etc. */
+PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+/* Optional call to update the users info structure */
PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,
- png_infop info_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
-/* these are the functions that do the transformations */
-#if defined(PNG_READ_FILLER_SUPPORTED)
+/* These are the functions that do the transformations */
+#ifdef PNG_READ_FILLER_SUPPORTED
PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,
- png_bytep row, png_uint_32 filler, png_uint_32 flags));
+ png_bytep row, png_uint_32 filler, png_uint_32 flags)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
+#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,
- png_bytep row));
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
+#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,
- png_bytep row));
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
+#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,
- png_bytep row));
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
+#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,
- png_bytep row));
+ png_bytep row)) PNG_PRIVATE;
#endif
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,
- png_bytep row, png_uint_32 flags));
+ png_bytep row, png_uint_32 flags)) PNG_PRIVATE;
#endif
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
-PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));
+PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info,
+ png_bytep row)) PNG_PRIVATE;
#endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
-PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));
+PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info,
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop
- row_info, png_bytep row));
+ row_info, png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
- png_bytep row));
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_PACK_SUPPORTED)
-PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));
+#ifdef PNG_READ_PACK_SUPPORTED
+PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info,
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_SHIFT_SUPPORTED)
+#ifdef PNG_READ_SHIFT_SUPPORTED
PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,
- png_color_8p sig_bits));
+ png_color_8p sig_bits)) PNG_PRIVATE;
#endif
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
-PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));
+PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info,
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_16_TO_8_SUPPORTED)
-PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));
+#ifdef PNG_READ_16_TO_8_SUPPORTED
+PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info,
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_DITHER_SUPPORTED)
+#ifdef PNG_READ_DITHER_SUPPORTED
PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info,
- png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup));
+ png_bytep row, png_bytep palette_lookup,
+ png_bytep dither_lookup)) PNG_PRIVATE;
-# if defined(PNG_CORRECT_PALETTE_SUPPORTED)
+# ifdef PNG_CORRECT_PALETTE_SUPPORTED
PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
- png_colorp palette, int num_palette));
+ png_colorp palette, int num_palette)) PNG_PRIVATE;
# endif
#endif
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
-PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row));
+PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info,
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_PACK_SUPPORTED)
+#ifdef PNG_WRITE_PACK_SUPPORTED
PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,
- png_bytep row, png_uint_32 bit_depth));
+ png_bytep row, png_uint_32 bit_depth)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_SHIFT_SUPPORTED)
+#ifdef PNG_WRITE_SHIFT_SUPPORTED
PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,
- png_color_8p bit_depth));
+ png_color_8p bit_depth)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_BACKGROUND_SUPPORTED)
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_BACKGROUND_SUPPORTED
+#ifdef PNG_READ_GAMMA_SUPPORTED
PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
png_color_16p trans_values, png_color_16p background,
png_color_16p background_1,
png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
- png_uint_16pp gamma_16_to_1, int gamma_shift));
+ png_uint_16pp gamma_16_to_1, int gamma_shift)) PNG_PRIVATE;
#else
PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
- png_color_16p trans_values, png_color_16p background));
+ png_color_16p trans_values, png_color_16p background)) PNG_PRIVATE;
#endif
#endif
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,
png_bytep gamma_table, png_uint_16pp gamma_16_table,
- int gamma_shift));
+ int gamma_shift)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_EXPAND_SUPPORTED)
+#ifdef PNG_READ_EXPAND_SUPPORTED
PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info,
- png_bytep row, png_colorp palette, png_bytep trans, int num_trans));
+ png_bytep row, png_colorp palette, png_bytep trans,
+ int num_trans)) PNG_PRIVATE;
PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,
- png_bytep row, png_color_16p trans_value));
+ png_bytep row, png_color_16p trans_value)) PNG_PRIVATE;
#endif
/* The following decodes the appropriate chunks, and does error correction,
* then calls the appropriate callback for the chunk if it is valid.
*/
-/* decode the IHDR chunk */
+/* Decode the IHDR chunk */
PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
-#if defined(PNG_READ_bKGD_SUPPORTED)
+#ifdef PNG_READ_bKGD_SUPPORTED
PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_cHRM_SUPPORTED)
+#ifdef PNG_READ_cHRM_SUPPORTED
PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_gAMA_SUPPORTED)
+#ifdef PNG_READ_gAMA_SUPPORTED
PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_hIST_SUPPORTED)
+#ifdef PNG_READ_hIST_SUPPORTED
PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_iCCP_SUPPORTED)
+#ifdef PNG_READ_iCCP_SUPPORTED
extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif /* PNG_READ_iCCP_SUPPORTED */
-#if defined(PNG_READ_iTXt_SUPPORTED)
+#ifdef PNG_READ_iTXt_SUPPORTED
PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_oFFs_SUPPORTED)
+#ifdef PNG_READ_oFFs_SUPPORTED
PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_pCAL_SUPPORTED)
+#ifdef PNG_READ_pCAL_SUPPORTED
PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_pHYs_SUPPORTED)
+#ifdef PNG_READ_pHYs_SUPPORTED
PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_sBIT_SUPPORTED)
+#ifdef PNG_READ_sBIT_SUPPORTED
PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_sCAL_SUPPORTED)
+#ifdef PNG_READ_sCAL_SUPPORTED
PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_sPLT_SUPPORTED)
+#ifdef PNG_READ_sPLT_SUPPORTED
extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif /* PNG_READ_sPLT_SUPPORTED */
-#if defined(PNG_READ_sRGB_SUPPORTED)
+#ifdef PNG_READ_sRGB_SUPPORTED
PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_tEXt_SUPPORTED)
+#ifdef PNG_READ_tEXt_SUPPORTED
PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_tIME_SUPPORTED)
+#ifdef PNG_READ_tIME_SUPPORTED
PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_tRNS_SUPPORTED)
+#ifdef PNG_READ_tRNS_SUPPORTED
PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_zTXt_SUPPORTED)
+#ifdef PNG_READ_zTXt_SUPPORTED
PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length));
+ png_infop info_ptr, png_uint_32 length)) PNG_PRIVATE;
PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
- png_bytep chunk_name));
+ png_bytep chunk_name)) PNG_PRIVATE;
-/* handle the transformations for reading and writing */
-PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
-PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));
+/* Handle the transformations for reading and writing */
+PNG_EXTERN void png_do_read_transformations
+ PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_do_write_transformations
+ PNGARG((png_structp png_ptr)) PNG_PRIVATE;
-PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr));
+PNG_EXTERN void png_init_read_transformations
+ PNGARG((png_structp png_ptr)) PNG_PRIVATE;
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr,
- png_infop info_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr)) PNG_PRIVATE;
PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,
- png_uint_32 length));
-PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr));
-PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr));
+ png_uint_32 length)) PNG_PRIVATE;
+PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr)) PNG_PRIVATE;
PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,
- png_bytep buffer, png_size_t buffer_length));
-PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr));
+ png_bytep buffer, png_size_t buffer_length)) PNG_PRIVATE;
+PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr)) PNG_PRIVATE;
PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr,
- png_bytep buffer, png_size_t buffer_length));
-PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr));
+ png_bytep buffer, png_size_t buffer_length)) PNG_PRIVATE;
+PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr)) PNG_PRIVATE;
PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length));
+ png_infop info_ptr, png_uint_32 length)) PNG_PRIVATE;
PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr,
- png_infop info_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));
+ png_infop info_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr,
+ png_bytep row)) PNG_PRIVATE;
PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr,
- png_infop info_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr));
-#if defined(PNG_READ_tEXt_SUPPORTED)
+ png_infop info_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_read_push_finish_row
+ PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+#ifdef PNG_READ_tEXt_SUPPORTED
PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length));
+ png_infop info_ptr, png_uint_32 length)) PNG_PRIVATE;
PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr,
- png_infop info_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_zTXt_SUPPORTED)
+#ifdef PNG_READ_zTXt_SUPPORTED
PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length));
+ png_infop info_ptr, png_uint_32 length)) PNG_PRIVATE;
PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,
- png_infop info_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_iTXt_SUPPORTED)
+#ifdef PNG_READ_iTXt_SUPPORTED
PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length));
+ png_infop info_ptr, png_uint_32 length)) PNG_PRIVATE;
PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,
- png_infop info_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
#endif
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#ifdef PNG_MNG_FEATURES_SUPPORTED
PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,
- png_bytep row));
+ png_bytep row)) PNG_PRIVATE;
PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
- png_bytep row));
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
+#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
+#ifdef PNG_MMX_CODE_SUPPORTED
/* png.c */ /* PRIVATE */
-PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr));
+PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+#endif
#endif
+
+
+/* The following six functions will be exported in libpng-1.4.0. */
+#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
+PNG_EXTERN png_uint_32 png_get_pixels_per_inch PNGARG((png_structp png_ptr,
+png_infop info_ptr));
+
+PNG_EXTERN png_uint_32 png_get_x_pixels_per_inch PNGARG((png_structp png_ptr,
+png_infop info_ptr));
+
+PNG_EXTERN png_uint_32 png_get_y_pixels_per_inch PNGARG((png_structp png_ptr,
+png_infop info_ptr));
+
+PNG_EXTERN float png_get_x_offset_inches PNGARG((png_structp png_ptr,
+png_infop info_ptr));
+
+PNG_EXTERN float png_get_y_offset_inches PNGARG((png_structp png_ptr,
+png_infop info_ptr));
+
+#ifdef PNG_pHYs_SUPPORTED
+PNG_EXTERN png_uint_32 png_get_pHYs_dpi PNGARG((png_structp png_ptr,
+png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
+#endif /* PNG_pHYs_SUPPORTED */
+#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
+
+/* Read the chunk header (length + type name) */
+PNG_EXTERN png_uint_32 png_read_chunk_header
+ PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+
+/* Added at libpng version 1.2.34 */
+#ifdef PNG_cHRM_SUPPORTED
+PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
+ png_fixed_point int_white_x, png_fixed_point int_white_y,
+ png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
+ int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
+ png_fixed_point int_blue_y)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_cHRM_SUPPORTED
+#ifdef PNG_CHECK_cHRM_SUPPORTED
+/* Added at libpng version 1.2.34 */
+PNG_EXTERN void png_64bit_product PNGARG((long v1, long v2,
+ unsigned long *hi_product, unsigned long *lo_product)) PNG_PRIVATE;
+#endif
+#endif
+
+/* Added at libpng version 1.2.41 */
+PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,
+ png_uint_32 width, png_uint_32 height, int bit_depth,
+ int color_type, int interlace_type, int compression_type,
+ int filter_type)) PNG_PRIVATE;
+
+/* Added at libpng version 1.2.41 */
+PNG_EXTERN png_voidp png_calloc PNGARG((png_structp png_ptr,
+ png_uint_32 size));
+
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
#endif /* PNG_INTERNAL */
@@ -3415,5 +3784,5 @@ PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr));
#endif
#endif /* PNG_VERSION_INFO_ONLY */
-/* do not put anything past this line */
+/* Do not put anything past this line */
#endif /* PNG_H */
diff --git a/com32/include/pngconf.h b/com32/include/pngconf.h
index 3ac628c4..defc16d9 100644
--- a/com32/include/pngconf.h
+++ b/com32/include/pngconf.h
@@ -1,11 +1,14 @@
/* pngconf.h - machine configurable file for libpng
*
- * libpng version 1.2.8 - December 3, 2004
- * For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2004 Glenn Randers-Pehrson
+ * libpng version 1.2.44 - June 26, 2010
+ * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+ * This code is released under the libpng license.
+ * For conditions of distribution and use, see the disclaimer
+ * and license in png.h
*/
/* Any machine specific code is near the front of this file, so if you
@@ -24,9 +27,19 @@
* includes the resource compiler for Windows DLL configurations.
*/
#ifdef PNG_USER_CONFIG
+# ifndef PNG_USER_PRIVATEBUILD
+# define PNG_USER_PRIVATEBUILD
+# endif
#include "pngusr.h"
#endif
+/* PNG_CONFIGURE_LIBPNG is set by the "configure" script. */
+#ifdef PNG_CONFIGURE_LIBPNG
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#endif
+
/*
* Added at libpng-1.2.8
*
@@ -55,8 +68,8 @@
#endif
#ifdef PRIVATEBUILD
-# pragma message("PRIVATEBUILD is deprecated. Use\
- PNG_USER_PRIVATEBUILD instead.")
+# pragma message("PRIVATEBUILD is deprecated.\
+ Use PNG_USER_PRIVATEBUILD instead.")
# define PNG_USER_PRIVATEBUILD PRIVATEBUILD
#endif
#endif /* __STDC__ */
@@ -65,6 +78,14 @@
/* End of material added to libpng-1.2.8 */
+/* Added at libpng-1.2.19, removed at libpng-1.2.20 because it caused trouble
+ Restored at libpng-1.2.21 */
+#if !defined(PNG_NO_WARN_UNINITIALIZED_ROW) && \
+ !defined(PNG_WARN_UNINITIALIZED_ROW)
+# define PNG_WARN_UNINITIALIZED_ROW 1
+#endif
+/* End of material added at libpng-1.2.19/1.2.21 */
+
/* This is the size of the compression buffer, and thus the size of
* an IDAT chunk. Make this whatever size you feel is best for your
* machine. One of these will be allocated per png_struct. When this
@@ -94,8 +115,33 @@
# define PNG_WRITE_SUPPORTED
#endif
+/* Enabled in 1.2.41. */
+#ifdef PNG_ALLOW_BENIGN_ERRORS
+# define png_benign_error png_warning
+# define png_chunk_benign_error png_chunk_warning
+#else
+# ifndef PNG_BENIGN_ERRORS_SUPPORTED
+# define png_benign_error png_error
+# define png_chunk_benign_error png_chunk_error
+# endif
+#endif
+
+/* Added in libpng-1.2.41 */
+#if !defined(PNG_NO_WARNINGS) && !defined(PNG_WARNINGS_SUPPORTED)
+# define PNG_WARNINGS_SUPPORTED
+#endif
+
+#if !defined(PNG_NO_ERROR_TEXT) && !defined(PNG_ERROR_TEXT_SUPPORTED)
+# define PNG_ERROR_TEXT_SUPPORTED
+#endif
+
+#if !defined(PNG_NO_CHECK_cHRM) && !defined(PNG_CHECK_cHRM_SUPPORTED)
+# define PNG_CHECK_cHRM_SUPPORTED
+#endif
+
/* Enabled by default in 1.2.0. You can disable this if you don't need to
- support PNGs that are embedded in MNG datastreams */
+ * support PNGs that are embedded in MNG datastreams
+ */
#if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES)
# ifndef PNG_MNG_FEATURES_SUPPORTED
# define PNG_MNG_FEATURES_SUPPORTED
@@ -153,44 +199,44 @@
* PNG_BUILD_DLL and PNG_STATIC because those change some defaults
* such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
*/
-#if defined(__CYGWIN__)
-# if defined(ALL_STATIC)
-# if defined(PNG_BUILD_DLL)
+#ifdef __CYGWIN__
+# ifdef ALL_STATIC
+# ifdef PNG_BUILD_DLL
# undef PNG_BUILD_DLL
# endif
-# if defined(PNG_USE_DLL)
+# ifdef PNG_USE_DLL
# undef PNG_USE_DLL
# endif
-# if defined(PNG_DLL)
+# ifdef PNG_DLL
# undef PNG_DLL
# endif
-# if !defined(PNG_STATIC)
+# ifndef PNG_STATIC
# define PNG_STATIC
# endif
# else
-# if defined (PNG_BUILD_DLL)
-# if defined(PNG_STATIC)
+# ifdef PNG_BUILD_DLL
+# ifdef PNG_STATIC
# undef PNG_STATIC
# endif
-# if defined(PNG_USE_DLL)
+# ifdef PNG_USE_DLL
# undef PNG_USE_DLL
# endif
-# if !defined(PNG_DLL)
+# ifndef PNG_DLL
# define PNG_DLL
# endif
# else
-# if defined(PNG_STATIC)
-# if defined(PNG_USE_DLL)
+# ifdef PNG_STATIC
+# ifdef PNG_USE_DLL
# undef PNG_USE_DLL
# endif
-# if defined(PNG_DLL)
+# ifdef PNG_DLL
# undef PNG_DLL
# endif
# else
-# if !defined(PNG_USE_DLL)
+# ifndef PNG_USE_DLL
# define PNG_USE_DLL
# endif
-# if !defined(PNG_DLL)
+# ifndef PNG_DLL
# define PNG_DLL
# endif
# endif
@@ -211,10 +257,16 @@
* #define PNG_NO_STDIO
*/
-#if defined(_WIN32_WCE)
+#if !defined(PNG_NO_STDIO) && !defined(PNG_STDIO_SUPPORTED)
+# define PNG_STDIO_SUPPORTED
+#endif
+
+#ifdef _WIN32_WCE
# include <windows.h>
/* Console I/O functions are not supported on WindowsCE */
# define PNG_NO_CONSOLE_IO
+ /* abort() may not be supported on some/all Windows CE platforms */
+# define PNG_ABORT() exit(-1)
# ifdef PNG_DEBUG
# undef PNG_DEBUG
# endif
@@ -238,12 +290,16 @@
# endif
# endif
# else
-# if !defined(_WIN32_WCE)
+# ifndef _WIN32_WCE
/* "stdio.h" functions are not supported on WindowsCE */
# include <stdio.h>
# endif
# endif
+#if !(defined PNG_NO_CONSOLE_IO) && !defined(PNG_CONSOLE_IO_SUPPORTED)
+# define PNG_CONSOLE_IO_SUPPORTED
+#endif
+
/* This macro protects us against machines that don't have function
* prototypes (ie K&R style headers). If your compiler does not handle
* function prototypes, define this macro and use the included ansi2knr.
@@ -266,6 +322,7 @@
# define PNGARG(arglist) arglist
#endif /* _NO_PROTO */
+
#endif /* OF */
#endif /* PNGARG */
@@ -293,28 +350,38 @@
#ifdef PNG_SETJMP_SUPPORTED
/* This is an attempt to force a single setjmp behaviour on Linux. If
* the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
+ *
+ * You can bypass this test if you know that your application uses exactly
+ * the same setjmp.h that was included when libpng was built. Only define
+ * PNG_SKIP_SETJMP_CHECK while building your application, prior to the
+ * application's '#include "png.h"'. Don't define PNG_SKIP_SETJMP_CHECK
+ * while building a separate libpng library for general use.
*/
-# ifdef __linux__
-# ifdef _BSD_SOURCE
-# define PNG_SAVE_BSD_SOURCE
-# undef _BSD_SOURCE
-# endif
-# ifdef _SETJMP_H
- /* If you encounter a compiler error here, see the explanation
- * near the end of INSTALL.
- */
- __png.h__ already includes setjmp.h;
- __dont__ include it again.;
-# endif
-# endif /* __linux__ */
+# ifndef PNG_SKIP_SETJMP_CHECK
+# ifdef __linux__
+# ifdef _BSD_SOURCE
+# define PNG_SAVE_BSD_SOURCE
+# undef _BSD_SOURCE
+# endif
+# ifdef _SETJMP_H
+ /* If you encounter a compiler error here, see the explanation
+ * near the end of INSTALL.
+ */
+ __pngconf.h__ in libpng already includes setjmp.h;
+ __dont__ include it again.;
+# endif
+# endif /* __linux__ */
+# endif /* PNG_SKIP_SETJMP_CHECK */
/* include setjmp.h for error handling */
# include <setjmp.h>
# ifdef __linux__
# ifdef PNG_SAVE_BSD_SOURCE
-# define _BSD_SOURCE
+# ifndef _BSD_SOURCE
+# define _BSD_SOURCE
+# endif
# undef PNG_SAVE_BSD_SOURCE
# endif
# endif /* __linux__ */
@@ -344,8 +411,8 @@
* them inside an appropriate ifdef/endif pair for portability.
*/
-#if defined(PNG_FLOATING_POINT_SUPPORTED)
-# if defined(MACOS)
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+# ifdef MACOS
/* We need to check that <math.h> hasn't already been included earlier
* as it seems it doesn't agree with <fp.h>, yet we should really use
* <fp.h> if possible.
@@ -453,21 +520,33 @@
*/
/* The size of the png_text structure changed in libpng-1.0.6 when
- * iTXt is supported. It is turned off by default, to support old apps
- * that malloc the png_text structure instead of calling png_set_text()
- * and letting libpng malloc it. It will be turned on by default in
- * libpng-1.3.0.
+ * iTXt support was added. iTXt support was turned off by default through
+ * libpng-1.2.x, to support old apps that malloc the png_text structure
+ * instead of calling png_set_text() and letting libpng malloc it. It
+ * will be turned on by default in libpng-1.4.0.
*/
-#ifndef PNG_iTXt_SUPPORTED
-# if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
+# ifndef PNG_NO_iTXt_SUPPORTED
+# define PNG_NO_iTXt_SUPPORTED
+# endif
+# ifndef PNG_NO_READ_iTXt
# define PNG_NO_READ_iTXt
# endif
-# if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt)
+# ifndef PNG_NO_WRITE_iTXt
# define PNG_NO_WRITE_iTXt
# endif
#endif
+#if !defined(PNG_NO_iTXt_SUPPORTED)
+# if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
+# define PNG_READ_iTXt
+# endif
+# if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt)
+# define PNG_WRITE_iTXt
+# endif
+#endif
+
/* The following support, added after version 1.0.0, can be turned off here en
* masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
* with old applications that require the length of png_struct and png_info
@@ -478,6 +557,7 @@
# define PNG_NO_FREE_ME
# define PNG_NO_READ_UNKNOWN_CHUNKS
# define PNG_NO_WRITE_UNKNOWN_CHUNKS
+# define PNG_NO_HANDLE_AS_UNKNOWN
# define PNG_NO_READ_USER_CHUNKS
# define PNG_NO_READ_iCCP
# define PNG_NO_WRITE_iCCP
@@ -507,7 +587,7 @@
# define PNG_FREE_ME_SUPPORTED
#endif
-#if defined(PNG_READ_SUPPORTED)
+#ifdef PNG_READ_SUPPORTED
#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
!defined(PNG_NO_READ_TRANSFORMS)
@@ -571,29 +651,40 @@
# endif
#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
+/* PNG_PROGRESSIVE_READ_NOT_SUPPORTED is deprecated. */
#if !defined(PNG_NO_PROGRESSIVE_READ) && \
!defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
#endif /* about interlacing capability! You'll */
- /* still have interlacing unless you change the following line: */
-
+ /* still have interlacing unless you change the following define: */
#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
+/* PNG_NO_SEQUENTIAL_READ_SUPPORTED is deprecated. */
+#if !defined(PNG_NO_SEQUENTIAL_READ) && \
+ !defined(PNG_SEQUENTIAL_READ_SUPPORTED) && \
+ !defined(PNG_NO_SEQUENTIAL_READ_SUPPORTED)
+# define PNG_SEQUENTIAL_READ_SUPPORTED
+#endif
+
+#define PNG_READ_INTERLACING_SUPPORTED /* required in PNG-compliant decoders */
+
#ifndef PNG_NO_READ_COMPOSITE_NODIV
# ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */
-# define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */
+# define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */
# endif
#endif
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
/* Deprecated, will be removed from version 2.0.0.
Use PNG_MNG_FEATURES_SUPPORTED instead. */
#ifndef PNG_NO_READ_EMPTY_PLTE
# define PNG_READ_EMPTY_PLTE_SUPPORTED
#endif
+#endif
#endif /* PNG_READ_SUPPORTED */
-#if defined(PNG_WRITE_SUPPORTED)
+#ifdef PNG_WRITE_SUPPORTED
# if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
!defined(PNG_NO_WRITE_TRANSFORMS)
@@ -625,19 +716,25 @@
# ifndef PNG_NO_WRITE_SWAP_ALPHA
# define PNG_WRITE_SWAP_ALPHA_SUPPORTED
# endif
+#ifndef PNG_1_0_X
# ifndef PNG_NO_WRITE_INVERT_ALPHA
# define PNG_WRITE_INVERT_ALPHA_SUPPORTED
# endif
+#endif
# ifndef PNG_NO_WRITE_USER_TRANSFORM
# define PNG_WRITE_USER_TRANSFORM_SUPPORTED
# endif
#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
+#if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \
+ !defined(PNG_WRITE_INTERLACING_SUPPORTED)
#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant
encoders, but can cause trouble
if left undefined */
+#endif
#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
+ !defined(PNG_WRITE_WEIGHTED_FILTER) && \
defined(PNG_FLOATING_POINT_SUPPORTED)
# define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
#endif
@@ -646,10 +743,12 @@
# define PNG_WRITE_FLUSH_SUPPORTED
#endif
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
/* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
#ifndef PNG_NO_WRITE_EMPTY_PLTE
# define PNG_WRITE_EMPTY_PLTE_SUPPORTED
#endif
+#endif
#endif /* PNG_WRITE_SUPPORTED */
@@ -691,37 +790,70 @@
#endif
/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0
- even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */
+ * and removed from version 1.2.20. The following will be removed
+ * from libpng-1.4.0
+*/
+
+#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_OPTIMIZED_CODE)
+# ifndef PNG_OPTIMIZED_CODE_SUPPORTED
+# define PNG_OPTIMIZED_CODE_SUPPORTED
+# endif
+#endif
+
#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
# ifndef PNG_ASSEMBLER_CODE_SUPPORTED
# define PNG_ASSEMBLER_CODE_SUPPORTED
# endif
+
+# if defined(__GNUC__) && defined(__x86_64__) && (__GNUC__ < 4)
+ /* work around 64-bit gcc compiler bugs in gcc-3.x */
+# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
+# define PNG_NO_MMX_CODE
+# endif
+# endif
+
+# ifdef __APPLE__
+# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
+# define PNG_NO_MMX_CODE
+# endif
+# endif
+
+# if (defined(__MWERKS__) && ((__MWERKS__ < 0x0900) || macintosh))
+# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
+# define PNG_NO_MMX_CODE
+# endif
+# endif
+
# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
# define PNG_MMX_CODE_SUPPORTED
# endif
-#endif
-/* If you are sure that you don't need thread safety and you are compiling
- with PNG_USE_PNGCCRD for an MMX application, you can define this for
- faster execution. See pnggccrd.c.
-#define PNG_THREAD_UNSAFE_OK
-*/
+#endif
+/* end of obsolete code to be removed from libpng-1.4.0 */
-#if !defined(PNG_1_0_X)
+/* Added at libpng-1.2.0 */
+#ifndef PNG_1_0_X
#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
# define PNG_USER_MEM_SUPPORTED
#endif
#endif /* PNG_1_0_X */
/* Added at libpng-1.2.6 */
-#if !defined(PNG_1_0_X)
-#ifndef PNG_SET_USER_LIMITS_SUPPORTED
-#if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED)
-# define PNG_SET_USER_LIMITS_SUPPORTED
-#endif
-#endif
+#ifndef PNG_1_0_X
+# ifndef PNG_SET_USER_LIMITS_SUPPORTED
+# ifndef PNG_NO_SET_USER_LIMITS
+# define PNG_SET_USER_LIMITS_SUPPORTED
+# endif
+# endif
#endif /* PNG_1_0_X */
+/* Added at libpng-1.0.53 and 1.2.43 */
+#ifndef PNG_USER_LIMITS_SUPPORTED
+# ifndef PNG_NO_USER_LIMITS
+# define PNG_USER_LIMITS_SUPPORTED
+# endif
+#endif
+
/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter
* how large, set these limits to 0x7fffffffL
*/
@@ -732,6 +864,33 @@
# define PNG_USER_HEIGHT_MAX 1000000L
#endif
+/* Added at libpng-1.2.43. To accept all valid PNGs no matter
+ * how large, set these two limits to 0.
+ */
+#ifndef PNG_USER_CHUNK_CACHE_MAX
+# define PNG_USER_CHUNK_CACHE_MAX 0
+#endif
+
+/* Added at libpng-1.2.43 */
+#ifndef PNG_USER_CHUNK_MALLOC_MAX
+# define PNG_USER_CHUNK_MALLOC_MAX 0
+#endif
+
+#ifndef PNG_LITERAL_SHARP
+# define PNG_LITERAL_SHARP 0x23
+#endif
+#ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
+# define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
+#endif
+#ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
+# define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
+#endif
+
+/* Added at libpng-1.2.34 */
+#ifndef PNG_STRING_NEWLINE
+#define PNG_STRING_NEWLINE "\n"
+#endif
+
/* These are currently experimental features, define them if you want */
/* very little testing */
@@ -756,6 +915,11 @@
#define PNG_NO_POINTER_INDEXING
*/
+#if !defined(PNG_NO_POINTER_INDEXING) && \
+ !defined(PNG_POINTER_INDEXING_SUPPORTED)
+# define PNG_POINTER_INDEXING_SUPPORTED
+#endif
+
/* These functions are turned off by default, as they will be phased out. */
/*
#define PNG_USELESS_TESTS_SUPPORTED
@@ -859,14 +1023,22 @@
# define PNG_READ_zTXt_SUPPORTED
# define PNG_zTXt_SUPPORTED
#endif
+#ifndef PNG_NO_READ_OPT_PLTE
+# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
+#endif /* optional PLTE chunk in RGB and RGBA images */
+#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
+ defined(PNG_READ_zTXt_SUPPORTED)
+# define PNG_READ_TEXT_SUPPORTED
+# define PNG_TEXT_SUPPORTED
+#endif
+
+#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
+
#ifndef PNG_NO_READ_UNKNOWN_CHUNKS
# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
# define PNG_UNKNOWN_CHUNKS_SUPPORTED
# endif
-# ifndef PNG_NO_HANDLE_AS_UNKNOWN
-# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
-# endif
#endif
#if !defined(PNG_NO_READ_USER_CHUNKS) && \
defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
@@ -879,17 +1051,14 @@
# undef PNG_NO_HANDLE_AS_UNKNOWN
# endif
#endif
-#ifndef PNG_NO_READ_OPT_PLTE
-# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
-#endif /* optional PLTE chunk in RGB and RGBA images */
-#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
- defined(PNG_READ_zTXt_SUPPORTED)
-# define PNG_READ_TEXT_SUPPORTED
-# define PNG_TEXT_SUPPORTED
-#endif
-#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
+#ifndef PNG_NO_HANDLE_AS_UNKNOWN
+# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+# endif
+#endif
+#ifdef PNG_WRITE_SUPPORTED
#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
#ifdef PNG_NO_WRITE_TEXT
@@ -1001,17 +1170,6 @@
# define PNG_zTXt_SUPPORTED
# endif
#endif
-#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
-# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
-# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
-# define PNG_UNKNOWN_CHUNKS_SUPPORTED
-# endif
-# ifndef PNG_NO_HANDLE_AS_UNKNOWN
-# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
-# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
-# endif
-# endif
-#endif
#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
defined(PNG_WRITE_zTXt_SUPPORTED)
# define PNG_WRITE_TEXT_SUPPORTED
@@ -1020,8 +1178,37 @@
# endif
#endif
+#ifdef PNG_WRITE_tIME_SUPPORTED
+# ifndef PNG_NO_CONVERT_tIME
+# ifndef _WIN32_WCE
+/* The "tm" structure is not supported on WindowsCE */
+# ifndef PNG_CONVERT_tIME_SUPPORTED
+# define PNG_CONVERT_tIME_SUPPORTED
+# endif
+# endif
+# endif
+#endif
+
#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
+#if !defined(PNG_NO_WRITE_FILTER) && !defined(PNG_WRITE_FILTER_SUPPORTED)
+# define PNG_WRITE_FILTER_SUPPORTED
+#endif
+
+#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
+# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
+# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
+# define PNG_UNKNOWN_CHUNKS_SUPPORTED
+# endif
+#endif
+
+#ifndef PNG_NO_HANDLE_AS_UNKNOWN
+# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+# endif
+#endif
+#endif /* PNG_WRITE_SUPPORTED */
+
/* Turn this off to disable png_read_png() and
* png_write_png() and leave the row_pointers member
* out of the info structure.
@@ -1030,12 +1217,10 @@
# define PNG_INFO_IMAGE_SUPPORTED
#endif
-/* need the time information for reading tIME chunks */
-#if defined(PNG_tIME_SUPPORTED)
-# if !defined(_WIN32_WCE) && !defined(__COM32__)
+/* Need the time information for converting tIME chunks */
+#ifdef PNG_CONVERT_tIME_SUPPORTED
/* "time.h" functions are not supported on WindowsCE */
# include <time.h>
-# endif
#endif
/* Some typedefs to get us started. These should be safe on most of the
@@ -1057,10 +1242,10 @@ typedef unsigned char png_byte;
change (I'm not sure if you will or not, so I thought I'd be safe) */
#ifdef PNG_SIZE_T
typedef PNG_SIZE_T png_size_t;
-# define png_sizeof(x) png_convert_size(sizeof (x))
+# define png_sizeof(x) png_convert_size(sizeof(x))
#else
typedef size_t png_size_t;
-# define png_sizeof(x) sizeof (x)
+# define png_sizeof(x) sizeof(x)
#endif
/* The following is needed for medium model support. It cannot be in the
@@ -1104,8 +1289,8 @@ typedef unsigned char png_byte;
*/
/* MSC Medium model */
-#if defined(FAR)
-# if defined(M_I86MM)
+#ifdef FAR
+# ifdef M_I86MM
# define USE_FAR_KEYWORD
# define FARDATA FAR
# include <dos.h>
@@ -1138,7 +1323,7 @@ typedef char FAR * png_charp;
typedef png_fixed_point FAR * png_fixed_point_p;
#ifndef PNG_NO_STDIO
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
typedef HANDLE png_FILE_p;
#else
typedef FILE * png_FILE_p;
@@ -1167,7 +1352,7 @@ typedef char FAR * FAR * FAR * png_charppp;
#if defined(PNG_1_0_X) || defined(PNG_1_2_X)
/* SPC - Is this stuff deprecated? */
-/* It'll be removed as of libpng-1.3.0 - GR-P */
+/* It'll be removed as of libpng-1.4.0 - GR-P */
/* libpng typedefs for types in zlib. If zlib changes
* or another compression library is used, then change these.
* Eliminates need to change all the source files.
@@ -1202,17 +1387,17 @@ typedef z_stream FAR * png_zstreamp;
* When building a static lib, default to no GLOBAL ARRAYS, but allow
* command-line override
*/
-#if defined(__CYGWIN__)
-# if !defined(PNG_STATIC)
-# if defined(PNG_USE_GLOBAL_ARRAYS)
+#ifdef __CYGWIN__
+# ifndef PNG_STATIC
+# ifdef PNG_USE_GLOBAL_ARRAYS
# undef PNG_USE_GLOBAL_ARRAYS
# endif
-# if !defined(PNG_USE_LOCAL_ARRAYS)
+# ifndef PNG_USE_LOCAL_ARRAYS
# define PNG_USE_LOCAL_ARRAYS
# endif
# else
# if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
-# if defined(PNG_USE_GLOBAL_ARRAYS)
+# ifdef PNG_USE_GLOBAL_ARRAYS
# undef PNG_USE_GLOBAL_ARRAYS
# endif
# endif
@@ -1227,14 +1412,15 @@ typedef z_stream FAR * png_zstreamp;
* but might be required for some pre-1.0.5c applications.
*/
#if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
-# if defined(PNG_NO_GLOBAL_ARRAYS) || (defined(__GNUC__) && defined(PNG_DLL))
+# if defined(PNG_NO_GLOBAL_ARRAYS) || \
+ (defined(__GNUC__) && defined(PNG_DLL)) || defined(_MSC_VER)
# define PNG_USE_LOCAL_ARRAYS
# else
# define PNG_USE_GLOBAL_ARRAYS
# endif
#endif
-#if defined(__CYGWIN__)
+#ifdef __CYGWIN__
# undef PNGAPI
# define PNGAPI __cdecl
# undef PNG_IMPEXP
@@ -1275,7 +1461,7 @@ typedef z_stream FAR * png_zstreamp;
# define PNG_IMPEXP
# endif
-# if !defined(PNG_IMPEXP)
+# ifndef PNG_IMPEXP
# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol
# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol
@@ -1286,7 +1472,7 @@ typedef z_stream FAR * png_zstreamp;
# define PNG_EXPORT PNG_EXPORT_TYPE1
# else
# define PNG_EXPORT PNG_EXPORT_TYPE2
-# if defined(PNG_BUILD_DLL)
+# ifdef PNG_BUILD_DLL
# define PNG_IMPEXP __export
# else
# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
@@ -1296,8 +1482,8 @@ typedef z_stream FAR * png_zstreamp;
# endif
# endif
-# if !defined(PNG_IMPEXP)
-# if defined(PNG_BUILD_DLL)
+# ifndef PNG_IMPEXP
+# ifdef PNG_BUILD_DLL
# define PNG_IMPEXP __declspec(dllexport)
# else
# define PNG_IMPEXP __declspec(dllimport)
@@ -1343,6 +1529,70 @@ typedef z_stream FAR * png_zstreamp;
# endif
#endif
+#ifdef PNG_PEDANTIC_WARNINGS
+# ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED
+# define PNG_PEDANTIC_WARNINGS_SUPPORTED
+# endif
+#endif
+
+#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
+/* Support for compiler specific function attributes. These are used
+ * so that where compiler support is available incorrect use of API
+ * functions in png.h will generate compiler warnings. Added at libpng
+ * version 1.2.41.
+ */
+# ifdef __GNUC__
+# ifndef PNG_USE_RESULT
+# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
+# endif
+# ifndef PNG_NORETURN
+# define PNG_NORETURN __attribute__((__noreturn__))
+# endif
+# ifndef PNG_ALLOCATED
+# define PNG_ALLOCATED __attribute__((__malloc__))
+# endif
+
+ /* This specifically protects structure members that should only be
+ * accessed from within the library, therefore should be empty during
+ * a library build.
+ */
+# ifndef PNG_DEPRECATED
+# define PNG_DEPRECATED __attribute__((__deprecated__))
+# endif
+# ifndef PNG_DEPSTRUCT
+# define PNG_DEPSTRUCT __attribute__((__deprecated__))
+# endif
+# ifndef PNG_PRIVATE
+# if 0 /* Doesn't work so we use deprecated instead*/
+# define PNG_PRIVATE \
+ __attribute__((warning("This function is not exported by libpng.")))
+# else
+# define PNG_PRIVATE \
+ __attribute__((__deprecated__))
+# endif
+# endif /* PNG_PRIVATE */
+# endif /* __GNUC__ */
+#endif /* PNG_PEDANTIC_WARNINGS */
+
+#ifndef PNG_DEPRECATED
+# define PNG_DEPRECATED /* Use of this function is deprecated */
+#endif
+#ifndef PNG_USE_RESULT
+# define PNG_USE_RESULT /* The result of this function must be checked */
+#endif
+#ifndef PNG_NORETURN
+# define PNG_NORETURN /* This function does not return */
+#endif
+#ifndef PNG_ALLOCATED
+# define PNG_ALLOCATED /* The result of the function is new memory */
+#endif
+#ifndef PNG_DEPSTRUCT
+# define PNG_DEPSTRUCT /* Access to this struct member is deprecated */
+#endif
+#ifndef PNG_PRIVATE
+# define PNG_PRIVATE /* This is a private libpng function */
+#endif
+
/* User may want to use these so they are not in PNG_INTERNAL. Any library
* functions that are passed far data must be model independent.
*/
@@ -1358,23 +1608,42 @@ typedef z_stream FAR * png_zstreamp;
(LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
#endif
-#if defined(USE_FAR_KEYWORD) /* memory model independent fns */
-/* use this to make far-to-near assignments */
+#ifdef USE_FAR_KEYWORD /* memory model independent fns */
+/* Use this to make far-to-near assignments */
# define CHECK 1
# define NOCHECK 0
# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
-# define png_strcpy _fstrcpy
-# define png_strncpy _fstrncpy /* Added to v 1.2.6 */
+# define png_snprintf _fsnprintf /* Added to v 1.2.19 */
# define png_strlen _fstrlen
# define png_memcmp _fmemcmp /* SJT: added */
# define png_memcpy _fmemcpy
# define png_memset _fmemset
-#else /* use the usual functions */
+#else /* Use the usual functions */
# define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr)
-# define png_strcpy strcpy
-# define png_strncpy strncpy /* Added to v 1.2.6 */
+# ifndef PNG_NO_SNPRINTF
+# ifdef _MSC_VER
+# define png_snprintf _snprintf /* Added to v 1.2.19 */
+# define png_snprintf2 _snprintf
+# define png_snprintf6 _snprintf
+# else
+# define png_snprintf snprintf /* Added to v 1.2.19 */
+# define png_snprintf2 snprintf
+# define png_snprintf6 snprintf
+# endif
+# else
+ /* You don't have or don't want to use snprintf(). Caution: Using
+ * sprintf instead of snprintf exposes your application to accidental
+ * or malevolent buffer overflows. If you don't have snprintf()
+ * as a general rule you should provide one (you can get one from
+ * Portable OpenSSH).
+ */
+# define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
+# define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
+# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
+ sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
+# endif
# define png_strlen strlen
# define png_memcmp memcmp /* SJT: added */
# define png_memcpy memcpy
@@ -1390,47 +1659,6 @@ typedef z_stream FAR * png_zstreamp;
# define PNG_ZBUF_SIZE 65536L
#endif
-#ifdef PNG_READ_SUPPORTED
-/* Prior to libpng-1.0.9, this block was in pngasmrd.h */
-#if defined(PNG_INTERNAL)
-
-/* These are the default thresholds before the MMX code kicks in; if either
- * rowbytes or bitdepth is below the threshold, plain C code is used. These
- * can be overridden at runtime via the png_set_mmx_thresholds() call in
- * libpng 1.2.0 and later. The values below were chosen by Intel.
- */
-
-#ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT
-# define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT 128 /* >= */
-#endif
-#ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT
-# define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT 9 /* >= */
-#endif
-
-/* Set this in the makefile for VC++ on Pentium, not here. */
-/* Platform must be Pentium. Makefile must assemble and load pngvcrd.c .
- * MMX will be detected at run time and used if present.
- */
-#ifdef PNG_USE_PNGVCRD
-# define PNG_HAVE_ASSEMBLER_COMBINE_ROW
-# define PNG_HAVE_ASSEMBLER_READ_INTERLACE
-# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
-#endif
-
-/* Set this in the makefile for gcc/as on Pentium, not here. */
-/* Platform must be Pentium. Makefile must assemble and load pnggccrd.c .
- * MMX will be detected at run time and used if present.
- */
-#ifdef PNG_USE_PNGGCCRD
-# define PNG_HAVE_ASSEMBLER_COMBINE_ROW
-# define PNG_HAVE_ASSEMBLER_READ_INTERLACE
-# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
-#endif
-/* - see pnggccrd.c for info about what is currently enabled */
-
-#endif /* PNG_INTERNAL */
-#endif /* PNG_READ_SUPPORTED */
-
/* Added at libpng-1.2.8 */
#endif /* PNG_VERSION_INFO_ONLY */
diff --git a/com32/include/string.h b/com32/include/string.h
index c964ee3b..af9792b6 100644
--- a/com32/include/string.h
+++ b/com32/include/string.h
@@ -23,7 +23,6 @@ __extern char *strcat(char *, const char *);
__extern char *strchr(const char *, int);
__extern int strcmp(const char *, const char *);
__extern char *strcpy(char *, const char *);
-__extern char *strpcpy(char *, const char *);
__extern size_t strcspn(const char *, const char *);
__extern char *strdup(const char *);
__extern char *strndup(const char *, size_t);
diff --git a/com32/include/sys/bitops.h b/com32/include/sys/bitops.h
new file mode 100644
index 00000000..06cf9f3e
--- /dev/null
+++ b/com32/include/sys/bitops.h
@@ -0,0 +1,58 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2010 Intel Corporation; author: H. Peter Anvin
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * bitops.h
+ *
+ * Simple bitwise operations
+ */
+
+#ifndef _BITOPS_H
+#define _BITOPS_H
+
+#include <klibc/compiler.h>
+
+static inline void set_bit(long __bit, void *__bitmap)
+{
+ asm volatile("btsl %1,%0" : "+m" (__bitmap) : "Ir" (__bit) : "memory");
+}
+
+static inline void clr_bit(long __bit, void *__bitmap)
+{
+ asm volatile("btcl %1,%0" : "+m" (__bitmap) : "Ir" (__bit) : "memory");
+}
+
+static inline int __purefunc test_bit(long __bit, const void *__bitmap)
+{
+ unsigned char __r;
+ asm("btl %2,%1; setnz %0"
+ : "=r" (__r)
+ : "m" (__bitmap), "Ir" (__bit));
+ return __r;
+}
+
+#endif /* _BITOPS_H */
diff --git a/com32/include/sys/cpu.h b/com32/include/sys/cpu.h
index dfba02e7..53a6250e 100644
--- a/com32/include/sys/cpu.h
+++ b/com32/include/sys/cpu.h
@@ -8,14 +8,14 @@
static inline uint64_t rdtsc(void)
{
uint64_t v;
- asm volatile ("rdtsc":"=A" (v));
+ asm volatile("rdtsc" : "=A" (v));
return v;
}
static inline uint32_t rdtscl(void)
{
uint32_t v;
- asm volatile ("rdtsc":"=a" (v)::"edx");
+ asm volatile("rdtsc" : "=a" (v) : : "edx");
return v;
}
@@ -23,8 +23,11 @@ static inline void cpuid_count(uint32_t op, uint32_t cnt,
uint32_t * eax, uint32_t * ebx,
uint32_t * ecx, uint32_t * edx)
{
-asm("cpuid":"=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx)
-: "a"(op), "c"(cnt));
+ asm volatile("movl %%ebx,%1 ; "
+ "cpuid ; "
+ "xchgl %1,%%ebx"
+ : "=a" (*eax), "=SD" (*ebx), "=c" (*ecx), "=d" (*edx)
+ : "a"(op), "c"(cnt));
}
static inline void cpuid(uint32_t op, uint32_t * eax, uint32_t * ebx,
@@ -37,7 +40,12 @@ static inline __constfunc uint32_t cpuid_eax(uint32_t level)
{
uint32_t v;
-asm("cpuid": "=a"(v): "a"(level):"ebx", "ecx", "edx");
+ asm volatile("pushl %%ebx ; "
+ "cpuid ; "
+ "popl %%ebx"
+ : "=a" (v)
+ : "a"(level)
+ : "ecx", "edx");
return v;
}
@@ -45,7 +53,11 @@ static inline __constfunc uint32_t cpuid_ebx(uint32_t level)
{
uint32_t v;
-asm("cpuid": "=b"(v), "+a"(level): :"ecx", "edx");
+ asm volatile("movl %%ebx,%0 ; "
+ "cpuid ; "
+ "xchgl %0,%%ebx"
+ : "=SD" (v), "+a" (level)
+ : : "ecx", "edx");
return v;
}
@@ -53,7 +65,11 @@ static inline __constfunc uint32_t cpuid_ecx(uint32_t level)
{
uint32_t v;
-asm("cpuid": "=c"(v), "+a"(level): :"ebx", "edx");
+ asm volatile("pushl %%ebx ; "
+ "cpuid ; "
+ "popl %%ebx"
+ : "=c" (v), "+a" (level)
+ : : "edx");
return v;
}
@@ -61,51 +77,66 @@ static inline __constfunc uint32_t cpuid_edx(uint32_t level)
{
uint32_t v;
-asm("cpuid": "=d"(v), "+a"(level): :"ebx", "ecx");
+ asm volatile("pushl %%ebx ; "
+ "cpuid ; "
+ "popl %%ebx"
+ : "=d" (v), "+a" (level)
+ : : "ecx");
return v;
}
/* Standard macro to see if a specific flag is changeable */
static inline __constfunc bool cpu_has_eflag(uint32_t flag)
{
- uint32_t f1, f2;
-
-asm("pushfl\n\t" "pushfl\n\t" "popl %0\n\t" "movl %0,%1\n\t" "xorl %2,%0\n\t" "pushl %0\n\t" "popfl\n\t" "pushfl\n\t" "popl %0\n\t" "popfl\n\t":"=&r"(f1),
- "=&r"
- (f2)
-: "ir"(flag));
-
- return ((f1 ^ f2) & flag) != 0;
+ uint32_t f0, f1;
+
+ asm("pushfl ; "
+ "pushfl ; "
+ "popl %0 ; "
+ "movl %0,%1 ; "
+ "xorl %2,%1 ; "
+ "pushl %1 ; "
+ "popfl ; "
+ "pushfl ; "
+ "popl %1 ; "
+ "popfl"
+ : "=&r" (f0), "=&r" (f1)
+ : "ri" (flag));
+
+ return !!((f0^f1) & flag);
}
static inline uint64_t rdmsr(uint32_t msr)
{
uint64_t v;
- asm volatile ("rdmsr":"=A" (v):"c"(msr));
+ asm volatile("rdmsr" : "=A" (v) : "c"(msr));
return v;
}
static inline void wrmsr(uint64_t v, uint32_t msr)
{
- asm volatile ("wrmsr"::"A" (v), "c"(msr));
+ asm volatile("wrmsr" : : "A" (v), "c" (msr));
}
static inline void cpu_relax(void)
{
- asm volatile ("rep ; nop");
+ asm volatile("rep ; nop");
}
-/* These are local cli/sti; not SMP-safe!!! */
+static inline void hlt(void)
+{
+ asm volatile("hlt");
+}
static inline void cli(void)
{
- asm volatile ("cli");
+ asm volatile("cli");
}
static inline void sti(void)
{
- asm volatile ("sti");
+ asm volatile("sti");
}
#endif
diff --git a/com32/include/sys/dirent.h b/com32/include/sys/dirent.h
new file mode 100644
index 00000000..bb5e52c7
--- /dev/null
+++ b/com32/include/sys/dirent.h
@@ -0,0 +1,45 @@
+/*
+ * sys/dirent.h
+ */
+
+#ifndef DIRENT_H
+#define DIRENT_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#ifndef NAME_MAX
+#define NAME_MAX 255
+#endif
+
+struct dirent {
+ uint32_t d_ino;
+ uint32_t d_off;
+ uint16_t d_reclen;
+ uint16_t d_type;
+ char d_name[NAME_MAX + 1];
+};
+
+enum dirent_type {
+ DT_UNKNOWN = 0,
+ DT_FIFO = 1,
+ DT_CHR = 2,
+ DT_DIR = 4,
+ DT_BLK = 6,
+ DT_REG = 8,
+ DT_LNK = 10,
+ DT_SOCK = 12,
+ DT_WHT = 14,
+};
+
+/*
+ * Convert between stat structure mode types and directory types.
+ * The stat structure mode types are the same as in Linux.
+ */
+#define IFTODT(mode) (((mode) & 0170000) >> 12)
+#define DTTOIF(dt) ((dt) << 12)
+
+struct _DIR_;
+typedef struct _DIR_ DIR;
+
+#endif /* sys/dirent.h */
diff --git a/com32/include/sys/times.h b/com32/include/sys/times.h
index 961c7b6d..90470063 100644
--- a/com32/include/sys/times.h
+++ b/com32/include/sys/times.h
@@ -11,10 +11,10 @@ struct tms {
/* Empty */
};
-#define HZ 18 /* Piddly resolution... */
+#define HZ 1000
#define CLK_TCK HZ
-typedef uint16_t clock_t;
+typedef uint32_t clock_t;
clock_t times(struct tms *);
diff --git a/com32/include/syslinux/boot.h b/com32/include/syslinux/boot.h
index 87c05e99..21bea01a 100644
--- a/com32/include/syslinux/boot.h
+++ b/com32/include/syslinux/boot.h
@@ -37,7 +37,7 @@
#include <stdint.h>
#include <klibc/compiler.h>
-__noreturn syslinux_run_command(const char *);
+int syslinux_run_command(const char *);
__noreturn syslinux_run_default(void);
void syslinux_local_boot(uint16_t flags);
diff --git a/com32/include/syslinux/config.h b/com32/include/syslinux/config.h
index 868b0f10..79a4750e 100644
--- a/com32/include/syslinux/config.h
+++ b/com32/include/syslinux/config.h
@@ -54,6 +54,14 @@ struct syslinux_version {
const char *copyright_string;
};
+struct syslinux_ipinfo {
+ uint32_t ipver;
+ uint32_t myip;
+ uint32_t serverip;
+ uint32_t gateway;
+ uint32_t netmask;
+};
+
extern __nocommon struct syslinux_version __syslinux_version;
static inline const struct syslinux_version *syslinux_version(void)
{
@@ -104,6 +112,7 @@ union syslinux_derivative_info {
uint32_t _eflags;
const void *ptab_ptr;
const uint32_t *esdi_ptr;
+ const uint64_t *partoffset;
} disk; /* syslinux/extlinux */
struct {
uint16_t _gs, _fs, _es, _ds;
@@ -116,6 +125,7 @@ union syslinux_derivative_info {
uint32_t _eflags;
const void *pxenvptr;
const void *stack;
+ const struct syslinux_ipinfo *ipinfo;
} pxe; /* pxelinux */
struct {
uint16_t _gs, _fs, _es, _ds;
@@ -129,6 +139,7 @@ union syslinux_derivative_info {
uint32_t _eflags;
const void *spec_packet;
const uint32_t *esdi_ptr;
+ const uint64_t *partoffset;
} iso; /* isolinux */
};
diff --git a/com32/include/syslinux/idle.h b/com32/include/syslinux/idle.h
index 4c5947b7..6a45236e 100644
--- a/com32/include/syslinux/idle.h
+++ b/com32/include/syslinux/idle.h
@@ -33,5 +33,6 @@
#define _SYSLINUX_IDLE_H
void syslinux_idle(void);
+void syslinux_reset_idle(void);
#endif
diff --git a/com32/include/syslinux/pmapi.h b/com32/include/syslinux/pmapi.h
new file mode 100644
index 00000000..fa390185
--- /dev/null
+++ b/com32/include/syslinux/pmapi.h
@@ -0,0 +1,79 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2002-2009 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * pmapi.h
+ *
+ * Definitions for the Syslinux 4 protected-mode ABI
+ */
+
+#ifndef _SYSLINUX_PMAPI_H
+#define _SYSLINUX_PMAPI_H
+
+#include <stddef.h>
+#include <inttypes.h>
+
+/*
+ * Note: add new members to this structure only at the end.
+ * The position of elements in this structure is an ABI.
+ */
+struct _DIR_;
+struct dirent;
+
+struct com32_filedata {
+ size_t size; /* File size */
+ int blocklg2; /* log2(block size) */
+ uint16_t handle; /* File handle */
+};
+
+struct com32_pmapi {
+ size_t __pmapi_size;
+
+ void *(*lmalloc)(size_t);
+ void (*lfree)(void *);
+
+ int (*open_file)(const char *, struct com32_filedata *);
+ size_t (*read_file)(uint16_t *, void *, size_t);
+ void (*close_file)(uint16_t);
+
+ struct _DIR_ *(*opendir)(const char *);
+ struct dirent *(*readdir)(struct _DIR_ *);
+ int (*closedir)(struct _DIR_ *);
+
+ void (*idle)(void);
+ void (*reset_idle)(void);
+
+ int (*chdir)(const char *);
+ char *(*getcwd)(char *, size_t);
+
+ /* Should be "const volatile", but gcc miscompiles that sometimes */
+ volatile uint32_t *jiffies;
+ volatile uint32_t *ms_timer;
+};
+
+#endif /* _SYSLINUX_PMAPI_H */
diff --git a/com32/include/syslinux/pxe.h b/com32/include/syslinux/pxe.h
index 6e2a769b..4e8a3369 100644
--- a/com32/include/syslinux/pxe.h
+++ b/com32/include/syslinux/pxe.h
@@ -34,491 +34,10 @@
#ifndef _SYSLINUX_PXE_H
#define _SYSLINUX_PXE_H
-#include <stdint.h>
-#include <netinet/in.h>
-#include <klibc/compiler.h>
-#include <com32.h>
-
-/* PXE spec structures and definitions. These mostly follow the PXE
- spec, except when the PXE spec is unnecessarily stupid. Of course,
- that is most of the time. */
-
-/* Basic types; use Unix-like _t convention instead of SCREAMING; also
- re-use types we already have, like in_addr_t. */
-
-typedef uint16_t pxenv_status_t;
-
-#define MAC_ADDR_LEN 16
-typedef uint8_t mac_addr_t[MAC_ADDR_LEN];
-
-/* "Protected mode segment descriptor" according to PXE... */
-typedef struct {
- uint16_t segaddr;
- uint32_t physaddr;
- uint16_t segsize;
-} __packed pxe_segdesc_t;
-
-typedef far_ptr_t segoff16_t;
-
-typedef struct {
- uint8_t opcode;
-#define BOOTP_REQ 1
-#define BOOTP_REP 2
- uint8_t Hardware;
- uint8_t Hardlen;
- uint8_t Gatehops;
- uint32_t ident;
- uint16_t seconds;
- uint16_t Flags;
-#define BOOTP_BCAST 0x8000
- in_addr_t cip; /* Client IP address */
- in_addr_t yip; /* You IP address */
- in_addr_t sip; /* next server IP address */
- in_addr_t gip; /*relay agent IP address */
- mac_addr_t CAddr;
- uint8_t Sname[64];
- uint8_t bootfile[128];
- union {
-#define BOOTP_DHCPVEND 1024
- uint8_t d[BOOTP_DHCPVEND];
- struct {
- uint8_t magic[4];
-#define VM_RFC1048 0x63825363L
- uint32_t flags;
- uint8_t pad[56];
- } v;
- } vendor;
-} __packed pxe_bootp_t;
-
-/* Function calling structures and constants */
-
-typedef struct s_PXENV_GET_CACHED_INFO {
- pxenv_status_t Status;
- uint16_t PacketType;
-#define PXENV_PACKET_TYPE_DHCP_DISCOVER 1
-#define PXENV_PACKET_TYPE_DHCP_ACK 2
-#define PXENV_PACKET_TYPE_CACHED_REPLY 3
- uint16_t BufferSize;
- segoff16_t Buffer;
- uint16_t BufferLimit;
-} __packed t_PXENV_GET_CACHED_INFO;
-
-typedef struct s_PXENV_START_UNDI {
- pxenv_status_t Status;
- uint16_t AX;
- uint16_t BX;
- uint16_t DX;
- uint16_t DI;
- uint16_t ES;
-} __packed t_PXENV_START_UNDI;
-
-typedef struct s_PXENV_STOP_UNDI {
- pxenv_status_t Status;
-} __packed t_PXENV_STOP_UNDI;
-
-typedef struct s_PXENV_START_BASE {
- pxenv_status_t Status;
-} __packed t_PXENV_START_BASE;
-
-typedef struct s_PXENV_STOP_BASE {
- pxenv_status_t Status;
-} __packed t_PXENV_STOP_BASE;
-
-typedef struct s_PXENV_TFTP_OPEN {
- pxenv_status_t Status;
- in_addr_t ServerIPAddress;
- in_addr_t GatewayIPAddress;
- uint8_t FileName[128];
- in_port_t TFTPPort;
- uint16_t PacketSize;
-} __packed t_PXENV_TFTP_OPEN;
-
-typedef struct s_PXENV_TFTP_CLOSE {
- pxenv_status_t Status;
-} __packed t_PXENV_TFTP_CLOSE;
-
-typedef struct s_PXENV_TFTP_READ {
- pxenv_status_t Status;
- uint16_t PacketNumber;
- uint16_t BufferSize;
- segoff16_t Buffer;
-} __packed t_PXENV_TFTP_READ;
-
-typedef struct s_PXENV_TFTP_READ_FILE {
- pxenv_status_t Status;
- uint8_t FileName[128];
- uint32_t BufferSize;
- void *Buffer;
- in_addr_t ServerIPAddress;
- in_addr_t GatewayIPAddress;
- in_addr_t McastIPAddress;
- in_port_t TFTPClntPort;
- in_port_t TFTPSrvPort;
- uint16_t TFTPOpenTimeOut;
- uint16_t TFTPReopenDelay;
-} __packed t_PXENV_TFTP_READ_FILE;
-
-typedef struct s_PXENV_TFTP_GET_FSIZE {
- pxenv_status_t Status;
- in_addr_t ServerIPAddress;
- in_addr_t GatewayIPAddress;
- uint8_t FileName[128];
- uint32_t FileSize;
-} __packed t_PXENV_TFTP_GET_FSIZE;
-
-typedef struct s_PXENV_UDP_OPEN {
- pxenv_status_t status;
- in_addr_t src_ip;
-} __packed t_PXENV_UDP_OPEN;
-
-typedef struct s_PXENV_UDP_CLOSE {
- pxenv_status_t status;
-} __packed t_PXENV_UDP_CLOSE;
-
-typedef struct s_PXENV_UDP_WRITE {
- pxenv_status_t status;
- in_addr_t ip;
- in_addr_t gw;
- in_port_t src_port;
- in_port_t dst_port;
- uint16_t buffer_size;
- segoff16_t buffer;
-} __packed t_PXENV_UDP_WRITE;
-
-typedef struct s_PXENV_UDP_READ {
- pxenv_status_t status;
- in_addr_t src_ip;
- in_addr_t dest_ip;
- in_port_t s_port;
- in_port_t d_port;
- uint16_t buffer_size;
- segoff16_t buffer;
-} __packed t_PXENV_UDP_READ;
-
-typedef struct s_PXENV_UNDI_STARTUP {
- pxenv_status_t Status;
-} __packed t_PXENV_UNDI_STARTUP;
-
-typedef struct s_PXENV_UNDI_CLEANUP {
- pxenv_status_t Status;
-} __packed t_PXENV_UNDI_CLEANUP;
-
-typedef struct s_PXENV_UNDI_INITIALIZE {
- pxenv_status_t Status;
- void *ProtocolIni;
- uint8_t reserved[8];
-} __packed t_PXENV_UNDI_INITIALIZE;
-
-#define MAXNUM_MCADDR 8
-typedef struct s_PXENV_UNDI_MCAST_ADDRESS {
- uint16_t MCastAddrCount;
- mac_addr_t McastAddr[MAXNUM_MCADDR];
-} __packed t_PXENV_UNDI_MCAST_ADDRESS;
-
-typedef struct s_PXENV_UNDI_RESET {
- pxenv_status_t Status;
- t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
-} __packed t_PXENV_UNDI_RESET;
-
-typedef struct s_PXENV_UNDI_SHUTDOWN {
- pxenv_status_t Status;
-} __packed t_PXENV_UNDI_SHUTDOWN;
-
-typedef struct s_PXENV_UNDI_OPEN {
- pxenv_status_t Status;
- uint16_t OpenFlag;
- uint16_t PktFilter;
-#define FLTR_DIRECTED 0x0001
-#define FLTR_BRDCST 0x0002
-#define FLTR_PRMSCS 0x0004
-#define FLTR_SRC_RTG 0x0008
- t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
-} __packed t_PXENV_UNDI_OPEN;
-
-typedef struct s_PXENV_UNDI_CLOSE {
- pxenv_status_t Status;
-} __packed t_PXENV_UNDI_CLOSE;
-
-typedef struct s_PXENV_UNDI_TRANSMIT {
- pxenv_status_t Status;
- uint8_t Protocol;
-#define P_UNKNOWN 0
-#define P_IP 1
-#define P_ARP 2
-#define P_RARP 3
- uint8_t XmitFlag;
-#define XMT_DESTADDR 0x0000
-#define XMT_BROADCAST 0x0001
- segoff16_t DestAddr;
- segoff16_t TBD;
- uint32_t Reserved[2];
-} __packed t_PXENV_UNDI_TRANSMIT;
-#define MAX_DATA_BLKS 8
-typedef struct s_PXENV_UNDI_TBD {
- uint16_t ImmedLength;
- segoff16_t Xmit;
- uint16_t DataBlkCount;
- struct DataBlk {
- uint8_t TDPtrType;
- uint8_t TDRsvdByte;
- uint16_t TDDataLen;
- segoff16_t TDDataPtr;
- } DataBlock[MAX_DATA_BLKS];
-} __packed t_PXENV_UNDI_TBD;
-
-typedef struct s_PXENV_UNDI_SET_MCAST_ADDRESS {
- pxenv_status_t Status;
- t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
-} __packed t_PXENV_UNDI_SET_MCAST_ADDR;
-
-typedef struct s_PXENV_UNDI_SET_STATION_ADDRESS {
- pxenv_status_t Status;
- mac_addr_t StationAddress;
-} __packed t_PXENV_UNDI_SET_STATION_ADDR;
-
-typedef struct s_PXENV_UNDI_SET_PACKET_FILTER {
- pxenv_status_t Status;
- uint8_t filter;
-} __packed t_PXENV_UNDI_SET_PACKET_FILTER;
-
-typedef struct s_PXENV_UNDI_GET_INFORMATION {
- pxenv_status_t Status;
- uint16_t BaseIo;
- uint16_t IntNumber;
- uint16_t MaxTranUnit;
- uint16_t HwType;
-#define ETHER_TYPE 1
-#define EXP_ETHER_TYPE 2
-#define IEEE_TYPE 6
-#define ARCNET_TYPE 7
- uint16_t HwAddrLen;
- mac_addr_t CurrentNodeAddress;
- mac_addr_t PermNodeAddress;
- uint16_t ROMAddress;
- uint16_t RxBufCt;
- uint16_t TxBufCt;
-} __packed t_PXENV_UNDI_GET_INFORMATION;
-
-typedef struct s_PXENV_UNDI_GET_STATISTICS {
- pxenv_status_t Status;
- uint32_t XmtGoodFrames;
- uint32_t RcvGoodFrames;
- uint32_t RcvCRCErrors;
- uint32_t RcvResourceErrors;
-} __packed t_PXENV_UNDI_GET_STATISTICS;
-
-typedef struct s_PXENV_UNDI_CLEAR_STATISTICS {
- pxenv_status_t Status;
-} __packed t_PXENV_UNDI_CLEAR_STATISTICS;
-
-typedef struct s_PXENV_UNDI_INITIATE_DIAGS {
- pxenv_status_t Status;
-} __packed t_PXENV_UNDI_INITIATE_DIAGS;
-
-typedef struct s_PXENV_UNDI_FORCE_INTERRUPT {
- pxenv_status_t Status;
-} __packed t_PXENV_UNDI_FORCE_INTERRUPT;
-
-typedef struct s_PXENV_UNDI_GET_MCAST_ADDRESS {
- pxenv_status_t Status;
- in_addr_t InetAddr;
- mac_addr_t MediaAddr;
-} __packed t_PXENV_UNDI_GET_MCAST_ADDR;
-
-typedef struct s_PXENV_UNDI_GET_NIC_TYPE {
- pxenv_status_t Status;
- uint8_t NicType;
-#define PCI_NIC 2
-#define PnP_NIC 3
-#define CardBus_NIC 4
- union {
- struct {
- uint16_t Vendor_ID;
- uint16_t Dev_ID;
- uint8_t Base_Class;
- uint8_t Sub_Class;
- uint8_t Prog_Intf;
- uint8_t Rev;
- uint16_t BusDevFunc;
- uint16_t SubVendor_ID;
- uint16_t SubDevice_ID;
- } pci, cardbus;
- struct {
- uint32_t EISA_Dev_ID;
- uint8_t Base_Class;
- uint8_t Sub_Class;
- uint8_t Prog_Intf;
- uint16_t CardSelNum;
- } __packed pnp;
- } __packed info;
-} __packed t_PXENV_UNDI_GET_NIC_TYPE;
-
-typedef struct s_PXENV_UNDI_GET_IFACE_INFO {
- pxenv_status_t Status;
- uint8_t IfaceType[16];
- uint32_t LinkSpeed;
- uint32_t ServiceFlags;
- uint32_t Reserved[4];
-} __packed t_PXENV_UNDI_GET_NDIS_INFO;
-
-typedef struct s_PXENV_UNDI_GET_STATE {
-#define PXE_UNDI_GET_STATE_STARTED 1
-#define PXE_UNDI_GET_STATE_INITIALIZED 2
-#define PXE_UNDI_GET_STATE_OPENED 3
- pxenv_status_t Status;
- uint8_t UNDIstate;
-} __packed t_PXENV_UNDI_GET_STATE;
-
-typedef struct s_PXENV_UNDI_ISR {
- pxenv_status_t Status;
- uint16_t FuncFlag;
- uint16_t BufferLength;
- uint16_t FrameLength;
- uint16_t FrameHeaderLength;
- segoff16_t Frame;
- uint8_t ProtType;
- uint8_t PktType;
-} __packed t_PXENV_UNDI_ISR;
-#define PXENV_UNDI_ISR_IN_START 1
-#define PXENV_UNDI_ISR_IN_PROCESS 2
-#define PXENV_UNDI_ISR_IN_GET_NEXT 3
-/* One of these will be returned for
- PXENV_UNDI_ISR_IN_START */
-#define PXENV_UNDI_ISR_OUT_OURS 0
-#define PXENV_UNDI_USR_OUT_NOT_OURS 1
-/* One of these will be returned for
- PXENV_UNDI_ISR_IN_PROCESS and
- PXENV_UNDI_ISR_IN_GET_NEXT */
-#define PXENV_UNDI_ISR_OUT_DONE 0
-#define PXENV_UNDI_ISR_OUT_TRANSMIT 2
-#define PXENV_UNDI_ISR_OUT_RECEIVE 3
-#define PXENV_UNDI_ISR_OUT_BUSY 4
-
-/* Function numbers and error codes */
-
-#define PXENV_TFTP_OPEN 0x0020
-#define PXENV_TFTP_CLOSE 0x0021
-#define PXENV_TFTP_READ 0x0022
-#define PXENV_TFTP_READ_FILE 0x0023
-#define PXENV_TFTP_READ_FILE_PMODE 0x0024
-#define PXENV_TFTP_GET_FSIZE 0x0025
-
-#define PXENV_UDP_OPEN 0x0030
-#define PXENV_UDP_CLOSE 0x0031
-#define PXENV_UDP_READ 0x0032
-#define PXENV_UDP_WRITE 0x0033
-
-#define PXENV_START_UNDI 0x0000
-#define PXENV_UNDI_STARTUP 0x0001
-#define PXENV_UNDI_CLEANUP 0x0002
-#define PXENV_UNDI_INITIALIZE 0x0003
-#define PXENV_UNDI_RESET_NIC 0x0004
-#define PXENV_UNDI_SHUTDOWN 0x0005
-#define PXENV_UNDI_OPEN 0x0006
-#define PXENV_UNDI_CLOSE 0x0007
-#define PXENV_UNDI_TRANSMIT 0x0008
-#define PXENV_UNDI_SET_MCAST_ADDR 0x0009
-#define PXENV_UNDI_SET_STATION_ADDR 0x000A
-#define PXENV_UNDI_SET_PACKET_FILTER 0x000B
-#define PXENV_UNDI_GET_INFORMATION 0x000C
-#define PXENV_UNDI_GET_STATISTICS 0x000D
-#define PXENV_UNDI_CLEAR_STATISTICS 0x000E
-#define PXENV_UNDI_INITIATE_DIAGS 0x000F
-#define PXENV_UNDI_FORCE_INTERRUPT 0x0010
-#define PXENV_UNDI_GET_MCAST_ADDR 0x0011
-#define PXENV_UNDI_GET_NIC_TYPE 0x0012
-#define PXENV_UNDI_GET_IFACE_INFO 0x0013
-#define PXENV_UNDI_ISR 0x0014
-#define PXENV_STOP_UNDI 0x0015 /* Overlap...? */
-#define PXENV_UNDI_GET_STATE 0x0015 /* Overlap...? */
-
-#define PXENV_UNLOAD_STACK 0x0070
-#define PXENV_GET_CACHED_INFO 0x0071
-#define PXENV_RESTART_DHCP 0x0072
-#define PXENV_RESTART_TFTP 0x0073
-#define PXENV_MODE_SWITCH 0x0074
-#define PXENV_START_BASE 0x0075
-#define PXENV_STOP_BASE 0x0076
-
-#define PXENV_EXIT_SUCCESS 0x0000
-#define PXENV_EXIT_FAILURE 0x0001
-
-#define PXENV_STATUS_SUCCESS 0x00
-#define PXENV_STATUS_FAILURE 0x01
-#define PXENV_STATUS_BAD_FUNC 0x02
-#define PXENV_STATUS_UNSUPPORTED 0x03
-#define PXENV_STATUS_KEEP_UNDI 0x04
-#define PXENV_STATUS_KEEP_ALL 0x05
-#define PXENV_STATUS_OUT_OF_RESOURCES 0x06
-#define PXENV_STATUS_ARP_TIMEOUT 0x11
-#define PXENV_STATUS_UDP_CLOSED 0x18
-#define PXENV_STATUS_UDP_OPEN 0x19
-#define PXENV_STATUS_TFTP_CLOSED 0x1A
-#define PXENV_STATUS_TFTP_OPEN 0x1B
-#define PXENV_STATUS_MCOPY_PROBLEM 0x20
-#define PXENV_STATUS_BIS_INTEGRITY_FAILURE 0x21
-#define PXENV_STATUS_BIS_VALIDATE_FAILURE 0x22
-#define PXENV_STATUS_BIS_INIT_FAILURE 0x23
-#define PXENV_STATUS_BIS_SHUTDOWN_FAILURE 0x24
-#define PXENV_STATUS_BIS_GBOA_FAILURE 0x25
-#define PXENV_STATUS_BIS_FREE_FAILURE 0x26
-#define PXENV_STATUS_BIS_GSI_FAILURE 0x27
-#define PXENV_STATUS_BIS_BAD_CKSUM 0x28
-#define PXENV_STATUS_TFTP_CANNOT_ARP_ADDRESS 0x30
-#define PXENV_STATUS_TFTP_OPEN_TIMEOUT 0x32
-
-#define PXENV_STATUS_TFTP_UNKNOWN_OPCODE 0x33
-#define PXENV_STATUS_TFTP_READ_TIMEOUT 0x35
-#define PXENV_STATUS_TFTP_ERROR_OPCODE 0x36
-#define PXENV_STATUS_TFTP_CANNOT_OPEN_CONNECTION 0x38
-#define PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION 0x39
-#define PXENV_STATUS_TFTP_TOO_MANY_PACKAGES 0x3A
-#define PXENV_STATUS_TFTP_FILE_NOT_FOUND 0x3B
-#define PXENV_STATUS_TFTP_ACCESS_VIOLATION 0x3C
-#define PXENV_STATUS_TFTP_NO_MCAST_ADDRESS 0x3D
-#define PXENV_STATUS_TFTP_NO_FILESIZE 0x3E
-#define PXENV_STATUS_TFTP_INVALID_PACKET_SIZE 0x3F
-#define PXENV_STATUS_DHCP_TIMEOUT 0x51
-#define PXENV_STATUS_DHCP_NO_IP_ADDRESS 0x52
-#define PXENV_STATUS_DHCP_NO_BOOTFILE_NAME 0x53
-#define PXENV_STATUS_DHCP_BAD_IP_ADDRESS 0x54
-#define PXENV_STATUS_UNDI_INVALID_FUNCTION 0x60
-#define PXENV_STATUS_UNDI_MEDIATEST_FAILED 0x61
-#define PXENV_STATUS_UNDI_CANNOT_INIT_NIC_FOR_MCAST 0x62
-#define PXENV_STATUS_UNDI_CANNOT_INITIALIZE_NIC 0x63
-#define PXENV_STATUS_UNDI_CANNOT_INITIALIZE_PHY 0x64
-#define PXENV_STATUS_UNDI_CANNOT_READ_CONFIG_DATA 0x65
-#define PXENV_STATUS_UNDI_CANNOT_READ_INIT_DATA 0x66
-#define PXENV_STATUS_UNDI_BAD_MAC_ADDRESS 0x67
-#define PXENV_STATUS_UNDI_BAD_EEPROM_CHECKSUM 0x68
-#define PXENV_STATUS_UNDI_ERROR_SETTING_ISR 0x69
-#define PXENV_STATUS_UNDI_INVALID_STATE 0x6A
-#define PXENV_STATUS_UNDI_TRANSMIT_ERROR 0x6B
-#define PXENV_STATUS_UNDI_INVALID_PARAMETER 0x6C
-#define PXENV_STATUS_BSTRAP_PROMPT_MENU 0x74
-#define PXENV_STATUS_BSTRAP_MCAST_ADDR 0x76
-#define PXENV_STATUS_BSTRAP_MISSING_LIST 0x77
-#define PXENV_STATUS_BSTRAP_NO_RESPONSE 0x78
-#define PXENV_STATUS_BSTRAP_FILE_TOO_BIG 0x79
-#define PXENV_STATUS_BINL_CANCELED_BY_KEYSTROKE 0xA0
-#define PXENV_STATUS_BINL_NO_PXE_SERVER 0xA1
-#define PXENV_STATUS_NOT_AVAILABLE_IN_PMODE 0xA2
-#define PXENV_STATUS_NOT_AVAILABLE_IN_RMODE 0xA3
-#define PXENV_STATUS_BUSD_DEVICE_NOT_SUPPORTED 0xB0
-#define PXENV_STATUS_LOADER_NO_FREE_BASE_MEMORY 0xC0
-#define PXENV_STATUS_LOADER_NO_BC_ROMID 0xC1
-#define PXENV_STATUS_LOADER_BAD_BC_ROMID 0xC2
-#define PXENV_STATUS_LOADER_BAD_BC_RUNTIME_IMAGE 0xC3
-#define PXENV_STATUS_LOADER_NO_UNDI_ROMID 0xC4
-#define PXENV_STATUS_LOADER_BAD_UNDI_ROMID 0xC5
-#define PXENV_STATUS_LOADER_BAD_UNDI_DRIVER_IMAGE 0xC6
-#define PXENV_STATUS_LOADER_NO_PXE_STRUCT 0xC8
-#define PXENV_STATUS_LOADER_NO_PXENV_STRUCT 0xC9
-#define PXENV_STATUS_LOADER_UNDI_START 0xCA
-#define PXENV_STATUS_LOADER_BC_START 0xCB
+#include <syslinux/pxe_api.h>
/* SYSLINUX-defined PXE utility functions */
-int pxe_get_cached_info(int level, void **buf, size_t * len);
+int pxe_get_cached_info(int level, void **buf, size_t *len);
int pxe_get_nic_type(t_PXENV_UNDI_GET_NIC_TYPE * gnt);
uint32_t pxe_dns(const char *hostname);
diff --git a/com32/include/syslinux/pxe_api.h b/com32/include/syslinux/pxe_api.h
new file mode 100644
index 00000000..27166b0b
--- /dev/null
+++ b/com32/include/syslinux/pxe_api.h
@@ -0,0 +1,571 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * syslinux/pxe_api.h
+ *
+ * PXE type and constant definitions for SYSLINUX
+ */
+
+#ifndef _SYSLINUX_PXE_API_H
+#define _SYSLINUX_PXE_API_H
+
+#include <stdint.h>
+#include <netinet/in.h>
+#include <klibc/compiler.h>
+#include <com32.h>
+
+/* PXE spec structures and definitions. These mostly follow the PXE
+ spec, except when the PXE spec is unnecessarily stupid. Of course,
+ that is most of the time. */
+
+/* Basic types; use Unix-like _t convention instead of SCREAMING; also
+ re-use types we already have, like in_addr_t. */
+
+typedef uint16_t pxenv_status_t;
+
+#define MAC_ADDR_LEN 16
+typedef uint8_t mac_addr_t[MAC_ADDR_LEN];
+
+/* "Protected mode segment descriptor" according to PXE... */
+typedef struct {
+ uint16_t sel;
+ uint32_t base;
+ uint16_t size;
+} __packed pxe_segdesc_t;
+
+typedef far_ptr_t segoff16_t;
+
+typedef struct {
+ uint8_t opcode;
+#define BOOTP_REQ 1
+#define BOOTP_REP 2
+ uint8_t Hardware;
+ uint8_t Hardlen;
+ uint8_t Gatehops;
+ uint32_t ident;
+ uint16_t seconds;
+ uint16_t Flags;
+#define BOOTP_BCAST 0x8000
+ in_addr_t cip; /* Client IP address */
+ in_addr_t yip; /* You IP address */
+ in_addr_t sip; /* next server IP address */
+ in_addr_t gip; /*relay agent IP address */
+ mac_addr_t CAddr;
+ uint8_t Sname[64];
+ uint8_t bootfile[128];
+ union {
+#define BOOTP_DHCPVEND 1024
+ uint8_t d[BOOTP_DHCPVEND];
+ struct {
+ uint8_t magic[4];
+#define VM_RFC1048 0x63825363L
+ uint32_t flags;
+ uint8_t pad[56];
+ } v;
+ } vendor;
+} __packed pxe_bootp_t;
+
+/* Function calling structures and constants */
+
+typedef struct s_PXENV_GET_CACHED_INFO {
+ pxenv_status_t Status;
+ uint16_t PacketType;
+#define PXENV_PACKET_TYPE_DHCP_DISCOVER 1
+#define PXENV_PACKET_TYPE_DHCP_ACK 2
+#define PXENV_PACKET_TYPE_CACHED_REPLY 3
+ uint16_t BufferSize;
+ segoff16_t Buffer;
+ uint16_t BufferLimit;
+} __packed t_PXENV_GET_CACHED_INFO;
+
+typedef struct s_PXENV_START_UNDI {
+ pxenv_status_t Status;
+ uint16_t AX;
+ uint16_t BX;
+ uint16_t DX;
+ uint16_t DI;
+ uint16_t ES;
+} __packed t_PXENV_START_UNDI;
+
+typedef struct s_PXENV_STOP_UNDI {
+ pxenv_status_t Status;
+} __packed t_PXENV_STOP_UNDI;
+
+typedef struct s_PXENV_START_BASE {
+ pxenv_status_t Status;
+} __packed t_PXENV_START_BASE;
+
+typedef struct s_PXENV_STOP_BASE {
+ pxenv_status_t Status;
+} __packed t_PXENV_STOP_BASE;
+
+typedef struct s_PXENV_TFTP_OPEN {
+ pxenv_status_t Status;
+ in_addr_t ServerIPAddress;
+ in_addr_t GatewayIPAddress;
+ uint8_t FileName[128];
+ in_port_t TFTPPort;
+ uint16_t PacketSize;
+} __packed t_PXENV_TFTP_OPEN;
+
+typedef struct s_PXENV_TFTP_CLOSE {
+ pxenv_status_t Status;
+} __packed t_PXENV_TFTP_CLOSE;
+
+typedef struct s_PXENV_TFTP_READ {
+ pxenv_status_t Status;
+ uint16_t PacketNumber;
+ uint16_t BufferSize;
+ segoff16_t Buffer;
+} __packed t_PXENV_TFTP_READ;
+
+typedef struct s_PXENV_TFTP_READ_FILE {
+ pxenv_status_t Status;
+ uint8_t FileName[128];
+ uint32_t BufferSize;
+ void *Buffer;
+ in_addr_t ServerIPAddress;
+ in_addr_t GatewayIPAddress;
+ in_addr_t McastIPAddress;
+ in_port_t TFTPClntPort;
+ in_port_t TFTPSrvPort;
+ uint16_t TFTPOpenTimeOut;
+ uint16_t TFTPReopenDelay;
+} __packed t_PXENV_TFTP_READ_FILE;
+
+typedef struct s_PXENV_TFTP_GET_FSIZE {
+ pxenv_status_t Status;
+ in_addr_t ServerIPAddress;
+ in_addr_t GatewayIPAddress;
+ uint8_t FileName[128];
+ uint32_t FileSize;
+} __packed t_PXENV_TFTP_GET_FSIZE;
+
+typedef struct s_PXENV_UDP_OPEN {
+ pxenv_status_t status;
+ in_addr_t src_ip;
+} __packed t_PXENV_UDP_OPEN;
+
+typedef struct s_PXENV_UDP_CLOSE {
+ pxenv_status_t status;
+} __packed t_PXENV_UDP_CLOSE;
+
+typedef struct s_PXENV_UDP_WRITE {
+ pxenv_status_t status;
+ in_addr_t ip;
+ in_addr_t gw;
+ in_port_t src_port;
+ in_port_t dst_port;
+ uint16_t buffer_size;
+ segoff16_t buffer;
+} __packed t_PXENV_UDP_WRITE;
+
+typedef struct s_PXENV_UDP_READ {
+ pxenv_status_t status;
+ in_addr_t src_ip;
+ in_addr_t dest_ip;
+ in_port_t s_port;
+ in_port_t d_port;
+ uint16_t buffer_size;
+ segoff16_t buffer;
+} __packed t_PXENV_UDP_READ;
+
+typedef struct s_PXENV_UNDI_STARTUP {
+ pxenv_status_t Status;
+} __packed t_PXENV_UNDI_STARTUP;
+
+typedef struct s_PXENV_UNDI_CLEANUP {
+ pxenv_status_t Status;
+} __packed t_PXENV_UNDI_CLEANUP;
+
+typedef struct s_PXENV_UNDI_INITIALIZE {
+ pxenv_status_t Status;
+ void *ProtocolIni;
+ uint8_t reserved[8];
+} __packed t_PXENV_UNDI_INITIALIZE;
+
+#define MAXNUM_MCADDR 8
+typedef struct s_PXENV_UNDI_MCAST_ADDRESS {
+ uint16_t MCastAddrCount;
+ mac_addr_t McastAddr[MAXNUM_MCADDR];
+} __packed t_PXENV_UNDI_MCAST_ADDRESS;
+
+typedef struct s_PXENV_UNDI_RESET {
+ pxenv_status_t Status;
+ t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
+} __packed t_PXENV_UNDI_RESET;
+
+typedef struct s_PXENV_UNDI_SHUTDOWN {
+ pxenv_status_t Status;
+} __packed t_PXENV_UNDI_SHUTDOWN;
+
+typedef struct s_PXENV_UNDI_OPEN {
+ pxenv_status_t Status;
+ uint16_t OpenFlag;
+ uint16_t PktFilter;
+#define FLTR_DIRECTED 0x0001
+#define FLTR_BRDCST 0x0002
+#define FLTR_PRMSCS 0x0004
+#define FLTR_SRC_RTG 0x0008
+ t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
+} __packed t_PXENV_UNDI_OPEN;
+
+typedef struct s_PXENV_UNDI_CLOSE {
+ pxenv_status_t Status;
+} __packed t_PXENV_UNDI_CLOSE;
+
+typedef struct s_PXENV_UNDI_TRANSMIT {
+ pxenv_status_t Status;
+ uint8_t Protocol;
+#define P_UNKNOWN 0
+#define P_IP 1
+#define P_ARP 2
+#define P_RARP 3
+ uint8_t XmitFlag;
+#define XMT_DESTADDR 0x0000
+#define XMT_BROADCAST 0x0001
+ segoff16_t DestAddr;
+ segoff16_t TBD;
+ uint32_t Reserved[2];
+} __packed t_PXENV_UNDI_TRANSMIT;
+#define MAX_DATA_BLKS 8
+typedef struct s_PXENV_UNDI_TBD {
+ uint16_t ImmedLength;
+ segoff16_t Xmit;
+ uint16_t DataBlkCount;
+ struct DataBlk {
+ uint8_t TDPtrType;
+ uint8_t TDRsvdByte;
+ uint16_t TDDataLen;
+ segoff16_t TDDataPtr;
+ } DataBlock[MAX_DATA_BLKS];
+} __packed t_PXENV_UNDI_TBD;
+
+typedef struct s_PXENV_UNDI_SET_MCAST_ADDRESS {
+ pxenv_status_t Status;
+ t_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
+} __packed t_PXENV_UNDI_SET_MCAST_ADDR;
+
+typedef struct s_PXENV_UNDI_SET_STATION_ADDRESS {
+ pxenv_status_t Status;
+ mac_addr_t StationAddress;
+} __packed t_PXENV_UNDI_SET_STATION_ADDR;
+
+typedef struct s_PXENV_UNDI_SET_PACKET_FILTER {
+ pxenv_status_t Status;
+ uint8_t filter;
+} __packed t_PXENV_UNDI_SET_PACKET_FILTER;
+
+typedef struct s_PXENV_UNDI_GET_INFORMATION {
+ pxenv_status_t Status;
+ uint16_t BaseIo;
+ uint16_t IntNumber;
+ uint16_t MaxTranUnit;
+ uint16_t HwType;
+#define ETHER_TYPE 1
+#define EXP_ETHER_TYPE 2
+#define IEEE_TYPE 6
+#define ARCNET_TYPE 7
+ uint16_t HwAddrLen;
+ mac_addr_t CurrentNodeAddress;
+ mac_addr_t PermNodeAddress;
+ uint16_t ROMAddress;
+ uint16_t RxBufCt;
+ uint16_t TxBufCt;
+} __packed t_PXENV_UNDI_GET_INFORMATION;
+
+typedef struct s_PXENV_UNDI_GET_STATISTICS {
+ pxenv_status_t Status;
+ uint32_t XmtGoodFrames;
+ uint32_t RcvGoodFrames;
+ uint32_t RcvCRCErrors;
+ uint32_t RcvResourceErrors;
+} __packed t_PXENV_UNDI_GET_STATISTICS;
+
+typedef struct s_PXENV_UNDI_CLEAR_STATISTICS {
+ pxenv_status_t Status;
+} __packed t_PXENV_UNDI_CLEAR_STATISTICS;
+
+typedef struct s_PXENV_UNDI_INITIATE_DIAGS {
+ pxenv_status_t Status;
+} __packed t_PXENV_UNDI_INITIATE_DIAGS;
+
+typedef struct s_PXENV_UNDI_FORCE_INTERRUPT {
+ pxenv_status_t Status;
+} __packed t_PXENV_UNDI_FORCE_INTERRUPT;
+
+typedef struct s_PXENV_UNDI_GET_MCAST_ADDRESS {
+ pxenv_status_t Status;
+ in_addr_t InetAddr;
+ mac_addr_t MediaAddr;
+} __packed t_PXENV_UNDI_GET_MCAST_ADDR;
+
+typedef struct s_PXENV_UNDI_GET_NIC_TYPE {
+ pxenv_status_t Status;
+ uint8_t NicType;
+#define PCI_NIC 2
+#define PnP_NIC 3
+#define CardBus_NIC 4
+ union {
+ struct {
+ uint16_t Vendor_ID;
+ uint16_t Dev_ID;
+ uint8_t Base_Class;
+ uint8_t Sub_Class;
+ uint8_t Prog_Intf;
+ uint8_t Rev;
+ uint16_t BusDevFunc;
+ uint16_t SubVendor_ID;
+ uint16_t SubDevice_ID;
+ } pci, cardbus;
+ struct {
+ uint32_t EISA_Dev_ID;
+ uint8_t Base_Class;
+ uint8_t Sub_Class;
+ uint8_t Prog_Intf;
+ uint16_t CardSelNum;
+ } __packed pnp;
+ } __packed info;
+} __packed t_PXENV_UNDI_GET_NIC_TYPE;
+
+typedef struct s_PXENV_UNDI_GET_IFACE_INFO {
+ pxenv_status_t Status;
+ uint8_t IfaceType[16];
+ uint32_t LinkSpeed;
+ uint32_t ServiceFlags;
+ uint32_t Reserved[4];
+} __packed t_PXENV_UNDI_GET_NDIS_INFO;
+
+typedef struct s_PXENV_UNDI_GET_STATE {
+#define PXE_UNDI_GET_STATE_STARTED 1
+#define PXE_UNDI_GET_STATE_INITIALIZED 2
+#define PXE_UNDI_GET_STATE_OPENED 3
+ pxenv_status_t Status;
+ uint8_t UNDIstate;
+} __packed t_PXENV_UNDI_GET_STATE;
+
+typedef struct s_PXENV_UNDI_ISR {
+ pxenv_status_t Status;
+ uint16_t FuncFlag;
+ uint16_t BufferLength;
+ uint16_t FrameLength;
+ uint16_t FrameHeaderLength;
+ segoff16_t Frame;
+ uint8_t ProtType;
+ uint8_t PktType;
+} __packed t_PXENV_UNDI_ISR;
+
+typedef struct s_PXENV_FILE_API_CHECK {
+ pxenv_status_t Status;
+ uint16_t Size;
+ uint32_t Magic;
+ uint32_t Provider;
+ uint32_t APIMask;
+ uint32_t Flags;
+} __packed t_PXENV_FILE_API_CHECK;
+
+typedef struct s_PXENV_FILE_READ {
+ pxenv_status_t Status;
+ uint16_t FileHandle;
+ uint16_t BufferSize;
+ segoff16_t Buffer;
+} __packed t_PXENV_FILE_READ;
+
+typedef struct s_PXENV_FILE_OPEN {
+ pxenv_status_t Status;
+ uint16_t FileHandle;
+ segoff16_t FileName;
+ uint32_t Reserved;
+} __packed t_PXENV_FILE_OPEN;
+
+typedef struct s_PXENV_FILE_CLOSE {
+ pxenv_status_t Status;
+ uint16_t FileHandle;
+} __packed t_PXENV_FILE_CLOSE;
+
+typedef struct s_PXENV_GET_FILE_SIZE {
+ pxenv_status_t Status;
+ uint16_t FileHandle;
+ uint32_t FileSize;
+} __packed t_PXENV_GET_FILE_SIZE;
+
+typedef struct s_PXENV_UNLOAD_STACK {
+ pxenv_status_t Status;
+ uint8_t reserved[10];
+} __packed t_PXENV_UNLOAD_STACK;
+
+#define PXENV_UNDI_ISR_IN_START 1
+#define PXENV_UNDI_ISR_IN_PROCESS 2
+#define PXENV_UNDI_ISR_IN_GET_NEXT 3
+/* One of these will be returned for
+ PXENV_UNDI_ISR_IN_START */
+#define PXENV_UNDI_ISR_OUT_OURS 0
+#define PXENV_UNDI_USR_OUT_NOT_OURS 1
+/* One of these will be returned for
+ PXENV_UNDI_ISR_IN_PROCESS and
+ PXENV_UNDI_ISR_IN_GET_NEXT */
+#define PXENV_UNDI_ISR_OUT_DONE 0
+#define PXENV_UNDI_ISR_OUT_TRANSMIT 2
+#define PXENV_UNDI_ISR_OUT_RECEIVE 3
+#define PXENV_UNDI_ISR_OUT_BUSY 4
+
+/* Function numbers and error codes */
+
+#define PXENV_TFTP_OPEN 0x0020
+#define PXENV_TFTP_CLOSE 0x0021
+#define PXENV_TFTP_READ 0x0022
+#define PXENV_TFTP_READ_FILE 0x0023
+#define PXENV_TFTP_READ_FILE_PMODE 0x0024
+#define PXENV_TFTP_GET_FSIZE 0x0025
+
+#define PXENV_UDP_OPEN 0x0030
+#define PXENV_UDP_CLOSE 0x0031
+#define PXENV_UDP_READ 0x0032
+#define PXENV_UDP_WRITE 0x0033
+
+#define PXENV_START_UNDI 0x0000
+#define PXENV_UNDI_STARTUP 0x0001
+#define PXENV_UNDI_CLEANUP 0x0002
+#define PXENV_UNDI_INITIALIZE 0x0003
+#define PXENV_UNDI_RESET_NIC 0x0004
+#define PXENV_UNDI_SHUTDOWN 0x0005
+#define PXENV_UNDI_OPEN 0x0006
+#define PXENV_UNDI_CLOSE 0x0007
+#define PXENV_UNDI_TRANSMIT 0x0008
+#define PXENV_UNDI_SET_MCAST_ADDR 0x0009
+#define PXENV_UNDI_SET_STATION_ADDR 0x000A
+#define PXENV_UNDI_SET_PACKET_FILTER 0x000B
+#define PXENV_UNDI_GET_INFORMATION 0x000C
+#define PXENV_UNDI_GET_STATISTICS 0x000D
+#define PXENV_UNDI_CLEAR_STATISTICS 0x000E
+#define PXENV_UNDI_INITIATE_DIAGS 0x000F
+#define PXENV_UNDI_FORCE_INTERRUPT 0x0010
+#define PXENV_UNDI_GET_MCAST_ADDR 0x0011
+#define PXENV_UNDI_GET_NIC_TYPE 0x0012
+#define PXENV_UNDI_GET_IFACE_INFO 0x0013
+#define PXENV_UNDI_ISR 0x0014
+#define PXENV_STOP_UNDI 0x0015 /* Overlap...? */
+#define PXENV_UNDI_GET_STATE 0x0015 /* Overlap...? */
+
+#define PXENV_UNLOAD_STACK 0x0070
+#define PXENV_GET_CACHED_INFO 0x0071
+#define PXENV_RESTART_DHCP 0x0072
+#define PXENV_RESTART_TFTP 0x0073
+#define PXENV_MODE_SWITCH 0x0074
+#define PXENV_START_BASE 0x0075
+#define PXENV_STOP_BASE 0x0076
+
+/* gPXE extensions... */
+#define PXENV_FILE_OPEN 0x00e0
+#define PXENV_FILE_CLOSE 0x00e1
+#define PXENV_FILE_SELECT 0x00e2
+#define PXENV_FILE_READ 0x00e3
+#define PXENV_GET_FILE_SIZE 0x00e4
+#define PXENV_FILE_EXEC 0x00e5
+#define PXENV_FILE_API_CHECK 0x00e6
+
+/* Exit codes */
+#define PXENV_EXIT_SUCCESS 0x0000
+#define PXENV_EXIT_FAILURE 0x0001
+
+/* Status codes */
+#define PXENV_STATUS_SUCCESS 0x00
+#define PXENV_STATUS_FAILURE 0x01
+#define PXENV_STATUS_BAD_FUNC 0x02
+#define PXENV_STATUS_UNSUPPORTED 0x03
+#define PXENV_STATUS_KEEP_UNDI 0x04
+#define PXENV_STATUS_KEEP_ALL 0x05
+#define PXENV_STATUS_OUT_OF_RESOURCES 0x06
+#define PXENV_STATUS_ARP_TIMEOUT 0x11
+#define PXENV_STATUS_UDP_CLOSED 0x18
+#define PXENV_STATUS_UDP_OPEN 0x19
+#define PXENV_STATUS_TFTP_CLOSED 0x1a
+#define PXENV_STATUS_TFTP_OPEN 0x1b
+#define PXENV_STATUS_MCOPY_PROBLEM 0x20
+#define PXENV_STATUS_BIS_INTEGRITY_FAILURE 0x21
+#define PXENV_STATUS_BIS_VALIDATE_FAILURE 0x22
+#define PXENV_STATUS_BIS_INIT_FAILURE 0x23
+#define PXENV_STATUS_BIS_SHUTDOWN_FAILURE 0x24
+#define PXENV_STATUS_BIS_GBOA_FAILURE 0x25
+#define PXENV_STATUS_BIS_FREE_FAILURE 0x26
+#define PXENV_STATUS_BIS_GSI_FAILURE 0x27
+#define PXENV_STATUS_BIS_BAD_CKSUM 0x28
+#define PXENV_STATUS_TFTP_CANNOT_ARP_ADDRESS 0x30
+#define PXENV_STATUS_TFTP_OPEN_TIMEOUT 0x32
+
+#define PXENV_STATUS_TFTP_UNKNOWN_OPCODE 0x33
+#define PXENV_STATUS_TFTP_READ_TIMEOUT 0x35
+#define PXENV_STATUS_TFTP_ERROR_OPCODE 0x36
+#define PXENV_STATUS_TFTP_CANNOT_OPEN_CONNECTION 0x38
+#define PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION 0x39
+#define PXENV_STATUS_TFTP_TOO_MANY_PACKAGES 0x3a
+#define PXENV_STATUS_TFTP_FILE_NOT_FOUND 0x3b
+#define PXENV_STATUS_TFTP_ACCESS_VIOLATION 0x3c
+#define PXENV_STATUS_TFTP_NO_MCAST_ADDRESS 0x3d
+#define PXENV_STATUS_TFTP_NO_FILESIZE 0x3e
+#define PXENV_STATUS_TFTP_INVALID_PACKET_SIZE 0x3f
+#define PXENV_STATUS_DHCP_TIMEOUT 0x51
+#define PXENV_STATUS_DHCP_NO_IP_ADDRESS 0x52
+#define PXENV_STATUS_DHCP_NO_BOOTFILE_NAME 0x53
+#define PXENV_STATUS_DHCP_BAD_IP_ADDRESS 0x54
+#define PXENV_STATUS_UNDI_INVALID_FUNCTION 0x60
+#define PXENV_STATUS_UNDI_MEDIATEST_FAILED 0x61
+#define PXENV_STATUS_UNDI_CANNOT_INIT_NIC_FOR_MCAST 0x62
+#define PXENV_STATUS_UNDI_CANNOT_INITIALIZE_NIC 0x63
+#define PXENV_STATUS_UNDI_CANNOT_INITIALIZE_PHY 0x64
+#define PXENV_STATUS_UNDI_CANNOT_READ_CONFIG_DATA 0x65
+#define PXENV_STATUS_UNDI_CANNOT_READ_INIT_DATA 0x66
+#define PXENV_STATUS_UNDI_BAD_MAC_ADDRESS 0x67
+#define PXENV_STATUS_UNDI_BAD_EEPROM_CHECKSUM 0x68
+#define PXENV_STATUS_UNDI_ERROR_SETTING_ISR 0x69
+#define PXENV_STATUS_UNDI_INVALID_STATE 0x6a
+#define PXENV_STATUS_UNDI_TRANSMIT_ERROR 0x6b
+#define PXENV_STATUS_UNDI_INVALID_PARAMETER 0x6c
+#define PXENV_STATUS_BSTRAP_PROMPT_MENU 0x74
+#define PXENV_STATUS_BSTRAP_MCAST_ADDR 0x76
+#define PXENV_STATUS_BSTRAP_MISSING_LIST 0x77
+#define PXENV_STATUS_BSTRAP_NO_RESPONSE 0x78
+#define PXENV_STATUS_BSTRAP_FILE_TOO_BIG 0x79
+#define PXENV_STATUS_BINL_CANCELED_BY_KEYSTROKE 0xa0
+#define PXENV_STATUS_BINL_NO_PXE_SERVER 0xa1
+#define PXENV_STATUS_NOT_AVAILABLE_IN_PMODE 0xa2
+#define PXENV_STATUS_NOT_AVAILABLE_IN_RMODE 0xa3
+#define PXENV_STATUS_BUSD_DEVICE_NOT_SUPPORTED 0xb0
+#define PXENV_STATUS_LOADER_NO_FREE_BASE_MEMORY 0xc0
+#define PXENV_STATUS_LOADER_NO_BC_ROMID 0xc1
+#define PXENV_STATUS_LOADER_BAD_BC_ROMID 0xc2
+#define PXENV_STATUS_LOADER_BAD_BC_RUNTIME_IMAGE 0xc3
+#define PXENV_STATUS_LOADER_NO_UNDI_ROMID 0xc4
+#define PXENV_STATUS_LOADER_BAD_UNDI_ROMID 0xc5
+#define PXENV_STATUS_LOADER_BAD_UNDI_DRIVER_IMAGE 0xc6
+#define PXENV_STATUS_LOADER_NO_PXE_STRUCT 0xc8
+#define PXENV_STATUS_LOADER_NO_PXENV_STRUCT 0xc9
+#define PXENV_STATUS_LOADER_UNDI_START 0xca
+#define PXENV_STATUS_LOADER_BC_START 0xcb
+
+#endif /* _SYSLINUX_PXE_API_H */
diff --git a/com32/include/unistd.h b/com32/include/unistd.h
index c0b52d60..9e13381a 100644
--- a/com32/include/unistd.h
+++ b/com32/include/unistd.h
@@ -25,6 +25,13 @@ __extern int getscreensize(int, int *, int *);
__extern char *getcwd(char *, int);
__extern int chdir(const char *);
+__extern unsigned int sleep(unsigned int);
+__extern unsigned int msleep(unsigned int);
+
+__extern int getopt(int, char *const *, const char *);
+__extern char *optarg;
+__extern int optind, opterr, optopt;
+
/* Standard file descriptor numbers. */
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
diff --git a/com32/include/zconf.h b/com32/include/zconf.h
index 031f08d2..02ce56c4 100644
--- a/com32/include/zconf.h
+++ b/com32/include/zconf.h
@@ -1,53 +1,134 @@
/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2003 Jean-loup Gailly.
+ * Copyright (C) 1995-2010 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.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 deflatePrime z_deflatePrime
-# define deflateParams z_deflateParams
-# define deflateBound z_deflateBound
-# define inflateInit2_ z_inflateInit2_
-# define inflateSetDictionary z_inflateSetDictionary
-# define inflateSync z_inflateSync
-# define inflateSyncPoint z_inflateSyncPoint
-# define inflateCopy z_inflateCopy
-# define inflateReset z_inflateReset
-# define compress z_compress
-# define compress2 z_compress2
-# define compressBound z_compressBound
-# define uncompress z_uncompress
-# define adler32 z_adler32
-# define crc32 z_crc32
-# define get_crc_table z_get_crc_table
-
-# 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
+#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
+
+/* 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
+# define compress z_compress
+# define compress2 z_compress2
+# define compressBound z_compressBound
+# 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 deflatePrime z_deflatePrime
+# define deflateReset z_deflateReset
+# 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
+# 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 gzflush z_gzflush
+# 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
+# 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 inflate_copyright z_inflate_copyright
+# define inflate_fast z_inflate_fast
+# define inflate_table z_inflate_table
+# define uncompress z_uncompress
+# define zError z_zError
+# define zcalloc z_zcalloc
+# define zcfree z_zcfree
+# define zlibCompileFlags z_zlibCompileFlags
+# define zlibVersion z_zlibVersion
+
+/* 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
+# define gzFile z_gzFile
+# define gz_header z_gz_header
+# define gz_headerp z_gz_headerp
+# 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 */
+# define gz_header_s z_gz_header_s
+# define internal_state z_internal_state
+
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
@@ -59,8 +140,10 @@
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
-#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
-# define WIN32
+#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__)
@@ -104,13 +187,13 @@
# define STDC
#endif
-#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
+#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 /* note: need a more gentle solution here */
+# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
+# define const /* note: need a more gentle solution here */
# endif
#endif
@@ -134,7 +217,7 @@
* gzip.)
*/
#ifndef MAX_WBITS
-# define MAX_WBITS 15 /* 32K LZ77 window */
+# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
@@ -150,9 +233,9 @@
for small objects.
*/
- /* Type declarations */
+ /* Type declarations */
-#ifndef OF /* function prototypes */
+#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
@@ -199,7 +282,7 @@
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
-# endif /* ZLIB_DLL */
+# 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.
@@ -247,75 +330,99 @@
#endif
#if !defined(__MACTYPES__)
-typedef unsigned char Byte; /* 8 bits */
+typedef unsigned char Byte; /* 8 bits */
#endif
-typedef unsigned int uInt; /* 16 bits or more */
-typedef unsigned long uLong; /* 32 bits or more */
+typedef unsigned int uInt; /* 16 bits or more */
+typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
-typedef Byte FAR Bytef;
+ typedef Byte FAR Bytef;
#endif
-typedef char FAR charf;
-typedef int FAR intf;
-typedef uInt FAR uIntf;
+typedef char FAR charf;
+typedef int FAR intf;
+typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
-typedef void const *voidpc;
-typedef void FAR *voidpf;
-typedef void *voidp;
+ typedef void const *voidpc;
+ typedef void FAR *voidpf;
+ typedef void *voidp;
#else
-typedef Byte const *voidpc;
-typedef Byte FAR *voidpf;
-typedef Byte *voidp;
+ typedef Byte const *voidpc;
+ typedef Byte FAR *voidpf;
+ typedef Byte *voidp;
+#endif
+
+#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
+# define Z_HAVE_UNISTD_H
+#endif
+
+#ifdef STDC
+# include <sys/types.h> /* for off_t */
#endif
-#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
-# include <sys/types.h> /* for off_t */
-# include <unistd.h> /* for SEEK_* and off_t */
+/* 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(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
+# include <unistd.h> /* for SEEK_* and off_t */
# ifdef VMS
-# include <unixio.h> /* for off_t */
+# include <unixio.h> /* for off_t */
+# endif
+# ifndef z_off_t
+# define z_off_t off_t
# endif
-# define z_off_t off_t
#endif
+
#ifndef SEEK_SET
-# 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" */
+# 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(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
+# define z_off64_t off64_t
+#else
+# define z_off64_t z_off_t
#endif
#if defined(__OS400__)
-#define NO_vsnprintf
+# define NO_vsnprintf
#endif
#if defined(__MVS__)
# define NO_vsnprintf
-# ifdef FAR
-# undef FAR
-# 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(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")
+ #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 */
diff --git a/com32/include/zlib.h b/com32/include/zlib.h
index 92edf96f..bfbba83e 100644
--- a/com32/include/zlib.h
+++ b/com32/include/zlib.h
@@ -1,7 +1,7 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.2.1, November 17th, 2003
+ version 1.2.5, April 19th, 2010
- Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler
+ Copyright (C) 1995-2010 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
@@ -37,43 +37,44 @@
extern "C" {
#endif
-#define ZLIB_VERSION "1.2.1"
-#define ZLIB_VERNUM 0x1210
+#define ZLIB_VERSION "1.2.5"
+#define ZLIB_VERNUM 0x1250
+#define ZLIB_VER_MAJOR 1
+#define ZLIB_VER_MINOR 2
+#define ZLIB_VER_REVISION 5
+#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.
-
- 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
+ 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,
+ 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 compressed data format used 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 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 also supports reading and writing files in gzip (.gz) format
+ 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.
- The zlib format was designed to be compact and fast for use in memory
+ 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.
- This library does not provide any functions to write gzip files in memory.
- However such functions could be easily written using zlib's deflate function,
- the documentation in the gzip RFC, and the examples in gzio.c.
-
- 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 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));
@@ -97,7 +98,7 @@ typedef struct z_stream_s {
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;
@@ -105,45 +106,68 @@ typedef struct z_stream_s {
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;
+
+typedef gz_header FAR *gz_headerp;
- 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
+/*
+ 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).
-
- 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).
+ 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).
*/
/* 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
#define Z_BLOCK 5
+#define Z_TREES 6
/* Allowed flush values; see deflate() and inflate() below for details */
#define Z_OK 0
@@ -155,8 +179,8 @@ typedef z_stream FAR *z_streamp;
#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
@@ -168,11 +192,13 @@ typedef z_stream FAR *z_streamp;
#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 (though see inflate()) */
@@ -184,115 +210,140 @@ typedef z_stream FAR *z_streamp;
#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.
-
- 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.
+ 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.
+
+ 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). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
+ 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
- the value returned by deflateBound (see below). If deflate does not return
+ is to be done in a single step. In this case, avail_out must be at least the
+ value returned by deflateBound (see below). If deflate does not return
Z_STREAM_END, then 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). Note that Z_BUF_ERROR is not
+ 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.
*/
@@ -301,13 +352,13 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
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).
*/
@@ -315,10 +366,10 @@ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
/*
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
@@ -326,95 +377,108 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
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 introduce
+ 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).
-
- 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.
-
- The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
- Z_FINISH, or Z_BLOCK. 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 get 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.
+ 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.
+
+ 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.
+ 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 approach
- 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 never required, but can be
+ used to inform inflate that a faster approach may be used for the single
+ inflate() call.
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 only effect of the flush parameter in this implementation
+ first call. So the only effect of the flush parameter in this implementation
is on the return value of inflate(), as noted below, or when it returns early
- because Z_BLOCK is used.
+ because Z_BLOCK or Z_TREES is used.
If a preset dictionary is needed after this call (see inflateSetDictionary
- below), inflate sets strm-adler to the adler32 checksum of the dictionary
+ 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
+ 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() will decompress and check either zlib-wrapped or gzip-wrapped
- deflate data. The header type is detected automatically. 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.
+ 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.
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
@@ -422,27 +486,28 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
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 check
value), 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,
+ 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
+ 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.
+ 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 */
/*
@@ -457,52 +522,57 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
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
+ (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
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
+ 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
+ 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).
+ 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), 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 to
- compress them better. The effect of Z_FILTERED is to force more Huffman
+ encoding). 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. Z_RLE is designed to be almost as fast as
- Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy
- parameter only affects the compression ratio but not the correctness of the
- compressed output even if it is not set appropriately.
-
- deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
- method). msg is set to null if there is no error message. deflateInit2 does
- not perform any compression: this will be done by deflate().
+ Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as
+ fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The
+ strategy parameter only affects the compression ratio but not the
+ correctness of the compressed output even if it is not set appropriately.
+ Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler
+ decoder for special applications.
+
+ deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid
+ method), 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. deflateInit2 does not perform any
+ compression: this will be done by deflate().
*/
ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
@@ -510,35 +580,37 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
uInt dictLength));
/*
Initializes the compression dictionary from the given byte sequence
- without producing any compressed output. This function must be called
- immediately after deflateInit, deflateInit2 or deflateReset, before any
- call of deflate. The compressor and decompressor must use exactly the same
+ without producing any compressed output. This function must be called
+ immediately after deflateInit, deflateInit2 or deflateReset, before any call
+ of deflate. The compressor and decompressor must use exactly the same
dictionary (see inflateSetDictionary).
The dictionary should consist of strings (byte sequences) that are likely
to be encountered later in the data to be compressed, with the most commonly
- used strings preferably put towards the end of the dictionary. Using a
+ used strings preferably put towards the end of the dictionary. Using a
dictionary is most useful when the data to be compressed is short and can be
predicted with good accuracy; the data can then be compressed better than
with the default empty dictionary.
Depending on the size of the compression data structures selected by
deflateInit or deflateInit2, a part of the dictionary may in effect be
- discarded, for example if the dictionary is larger than the window size in
- deflate or deflate2. Thus the strings most likely to be useful should be
- put at the end of the dictionary, not at the front.
+ discarded, for example if the dictionary is larger than the window size
+ provided in deflateInit or deflateInit2. Thus the strings most likely to be
+ useful should be put at the end of the dictionary, not at the front. In
+ addition, the current implementation of deflate will use at most the window
+ size minus 262 bytes of the provided dictionary.
Upon return of this function, strm->adler is set to the adler32 value
of the dictionary; the decompressor may later use this value to determine
- which dictionary has been used by the compressor. (The adler32 value
+ which dictionary has been used by the compressor. (The adler32 value
applies to the whole dictionary even if only a subset of the dictionary is
actually used by the compressor.) If a raw deflate was requested, then the
adler32 value is not computed and strm->adler is not set.
deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
- parameter is invalid (such as NULL dictionary) or the stream state is
+ parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
inconsistent (for example if deflate has already been called for this stream
- or if the compression method is bsort). deflateSetDictionary does not
+ or if the compression method is bsort). deflateSetDictionary does not
perform any compression: this will be done by deflate().
*/
@@ -549,26 +621,26 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
This function can be useful when several compression strategies will be
tried, for example when there are several ways of pre-processing the input
- data with a filter. The streams that will be discarded should then be freed
+ data with a filter. The streams that will be discarded should then be freed
by calling deflateEnd. Note that deflateCopy duplicates the internal
- compression state which can be quite large, so this strategy is slow and
- can consume lots of memory.
+ compression state which can be quite large, so this strategy is slow and can
+ consume lots of memory.
deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
- (such as zalloc being NULL). msg is left unchanged in both source and
+ (such as zalloc being Z_NULL). msg is left unchanged in both source and
destination.
*/
ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
/*
This function is equivalent to deflateEnd followed by deflateInit,
- but does not free and reallocate all the internal compression state.
- The stream will keep the same compression level and any other attributes
- that may have been set by deflateInit2.
+ but does not free and reallocate all the internal compression state. The
+ stream will keep the same compression level and any other attributes that
+ may have been set by deflateInit2.
- deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being NULL).
+ deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent (such as zalloc or state being Z_NULL).
*/
ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
@@ -578,27 +650,45 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
Dynamically update the compression level and compression strategy. The
interpretation of level and strategy is as in deflateInit2. This can be
used to switch between compression and straight copy of the input data, or
- to switch to a different kind of input data requiring a different
- strategy. If the compression level is changed, the input available so far
- is compressed with the old level (and may be flushed); the new level will
- take effect only at the next call of deflate().
+ to switch to a different kind of input data requiring a different strategy.
+ If the compression level is changed, the input available so far is
+ compressed with the old level (and may be flushed); the new level will take
+ effect only at the next call of deflate().
Before the call of deflateParams, the stream state must be set as for
- a call of deflate(), since the currently available input may have to
- be compressed and flushed. In particular, strm->avail_out must be non-zero.
+ a call of deflate(), since the currently available input may have to be
+ compressed and flushed. In particular, strm->avail_out must be non-zero.
deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
- stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
- if strm->avail_out was zero.
+ stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if
+ strm->avail_out was zero.
*/
+ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
+ int good_length,
+ int max_lazy,
+ int nice_length,
+ int max_chain));
+/*
+ Fine tune deflate's internal compression parameters. This should only be
+ used by someone who understands the algorithm used by zlib's deflate for
+ searching for the best matching string, and even then only by the most
+ fanatic optimizer trying to squeeze out the last compressed bit for their
+ specific input data. Read the deflate.c source code for the meaning of the
+ max_lazy, good_length, nice_length, and max_chain parameters.
+
+ deflateTune() can be called after deflateInit() or deflateInit2(), and
+ returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
+ */
+
ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
uLong sourceLen));
/*
deflateBound() returns an upper bound on the compressed size after
- deflation of sourceLen bytes. It must be called after deflateInit()
- or deflateInit2(). This would be used to allocate an output buffer
- for deflation in a single pass, and so would be called before deflate().
+ deflation of sourceLen bytes. It must be called after deflateInit() or
+ deflateInit2(), and after deflateSetHeader(), if used. This would be used
+ to allocate an output buffer for deflation in a single pass, and so would be
+ called before deflate().
*/
ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
@@ -606,14 +696,38 @@ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
int value));
/*
deflatePrime() inserts bits in the deflate output stream. The intent
- is that this function is used to start off the deflate output with the
- bits leftover from a previous deflate stream when appending to it. As such,
- this function can only be used for raw deflate, and must be used before the
- first deflate() call after a deflateInit2() or deflateReset(). bits must be
- less than or equal to 16, and that many of the least significant bits of
- value will be inserted in the output.
-
- deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
+ is that this function is used to start off the deflate output with the bits
+ leftover from a previous deflate stream when appending to it. As such, this
+ function can only be used for raw deflate, and must be used before the first
+ deflate() call after a deflateInit2() or deflateReset(). bits must be less
+ than or equal to 16, and that many of the least significant bits of value
+ will be inserted in the output.
+
+ deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent.
+*/
+
+ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
+ gz_headerp head));
+/*
+ deflateSetHeader() provides gzip header information for when a gzip
+ stream is requested by deflateInit2(). deflateSetHeader() may be called
+ after deflateInit2() or deflateReset() and before the first call of
+ deflate(). The text, time, os, extra field, name, and comment information
+ in the provided gz_header structure are written to the gzip header (xflag is
+ ignored -- the extra flags are set according to the compression level). The
+ caller must assure that, if not Z_NULL, name and comment are terminated with
+ a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
+ available there. If hcrc is true, a gzip header crc is included. Note that
+ the current versions of the command-line version of gzip (up through version
+ 1.3.x) do not support header crc's, and will report that it is a "multi-part
+ gzip file" and give up.
+
+ If deflateSetHeader is not used, the default gzip header has text false,
+ the time set to zero, and os set to 255, with no extra, name, or comment
+ fields. The gzip header is returned to the default state by deflateReset().
+
+ deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent.
*/
@@ -621,42 +735,50 @@ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
int windowBits));
- This is another version of inflateInit with an extra parameter. The
+ This is another version of inflateInit with an extra parameter. The
fields next_in, avail_in, zalloc, zfree and opaque must be initialized
before by the caller.
The windowBits parameter is the base two logarithm of the maximum window
size (the size of the history buffer). It should be in the range 8..15 for
- this version of the library. The default value is 15 if inflateInit is used
- instead. windowBits must be greater than or equal to the windowBits value
+ this version of the library. The default value is 15 if inflateInit is used
+ instead. windowBits must be greater than or equal to the windowBits value
provided to deflateInit2() while compressing, or it must be equal to 15 if
- deflateInit2() was not used. If a compressed stream with a larger window
+ deflateInit2() was not used. If a compressed stream with a larger window
size is given as input, inflate() will return with the error code
Z_DATA_ERROR instead of trying to allocate a larger window.
- windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
- determines the window size. inflate() will then process raw deflate data,
+ windowBits can also be zero to request that inflate use the window size in
+ the zlib header of the compressed stream.
+
+ windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
+ determines the window size. inflate() will then process raw deflate data,
not looking for a zlib or gzip header, not generating a check value, and not
- looking for any check values for comparison at the end of the stream. This
+ looking for any check values for comparison at the end of the stream. This
is for use with other formats that use the deflate compressed data format
- such as zip. Those formats provide their own check values. If a custom
+ such as zip. Those formats provide their own check values. If a custom
format is developed using the raw deflate format for compressed data, it is
recommended that a check value such as an adler32 or a crc32 be applied to
the uncompressed data as is done in the zlib, gzip, and zip formats. For
- most applications, the zlib format should be used as is. Note that comments
+ most applications, the zlib format should be used as is. Note that comments
above on the use in deflateInit2() applies to the magnitude of windowBits.
- windowBits can also be greater than 15 for optional gzip decoding. Add
+ windowBits can also be greater than 15 for optional gzip decoding. Add
32 to windowBits to enable zlib and gzip decoding with automatic header
detection, or add 16 to decode only the gzip format (the zlib format will
- return a Z_DATA_ERROR).
+ return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a
+ crc32 instead of an adler32.
inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
- memLevel). msg is set to null if there is no error message. inflateInit2
- 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.)
+ memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
+ 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. inflateInit2 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 inflateInit2() does not process any header information -- that is
+ deferred until inflate() is called.
*/
ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
@@ -664,33 +786,36 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
uInt dictLength));
/*
Initializes the decompression dictionary from the given uncompressed byte
- sequence. This function must be called immediately after a call of inflate
- if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
- can be determined from the adler32 value returned by this call of
- inflate. The compressor and decompressor must use exactly the same
- dictionary (see deflateSetDictionary).
+ sequence. This function must be called immediately after a call of inflate,
+ if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
+ can be determined from the adler32 value returned by that call of inflate.
+ The compressor and decompressor must use exactly the same dictionary (see
+ deflateSetDictionary). For raw inflate, this function can be called
+ immediately after inflateInit2() or inflateReset() and before any call of
+ inflate() to set the dictionary. The application must insure that the
+ dictionary that was used for compression is provided.
inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
- parameter is invalid (such as NULL dictionary) or the stream state is
+ parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
- expected one (incorrect adler32 value). inflateSetDictionary does not
+ expected one (incorrect adler32 value). inflateSetDictionary does not
perform any decompression: this will be done by subsequent calls of
inflate().
*/
ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
/*
- Skips invalid compressed data until a full flush point (see above the
- description of deflate with Z_FULL_FLUSH) can be found, or until all
- available input is skipped. No output is provided.
-
- inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
- if no more input was provided, Z_DATA_ERROR if no flush point has been found,
- or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
- case, the application may save the current current value of total_in which
- indicates where valid compressed data was found. In the error case, the
- application may repeatedly call inflateSync, providing more input each time,
- until success or end of the input data.
+ Skips invalid compressed data until a full flush point (see above the
+ description of deflate with Z_FULL_FLUSH) can be found, or until all
+ available input is skipped. No output is provided.
+
+ inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
+ if no more input was provided, Z_DATA_ERROR if no flush point has been
+ found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the
+ success case, the application may save the current current value of total_in
+ which indicates where valid compressed data was found. In the error case,
+ the application may repeatedly call inflateSync, providing more input each
+ time, until success or end of the input data.
*/
ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
@@ -705,22 +830,123 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
- (such as zalloc being NULL). msg is left unchanged in both source and
+ (such as zalloc being Z_NULL). msg is left unchanged in both source and
destination.
*/
ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
/*
This function is equivalent to inflateEnd followed by inflateInit,
- but does not free and reallocate all the internal decompression state.
- The stream will keep attributes that may have been set by inflateInit2.
+ but does not free and reallocate all the internal decompression state. The
+ stream will keep attributes that may have been set by inflateInit2.
+
+ inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent (such as zalloc or state being Z_NULL).
+*/
- inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being NULL).
+ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
+ int windowBits));
+/*
+ This function is the same as inflateReset, but it also permits changing
+ the wrap and window size requests. The windowBits parameter is interpreted
+ the same as it is for inflateInit2.
+
+ inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent (such as zalloc or state being Z_NULL), or if
+ the windowBits parameter is invalid.
+*/
+
+ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
+ int bits,
+ int value));
+/*
+ This function inserts bits in the inflate input stream. The intent is
+ that this function is used to start inflating at a bit position in the
+ middle of a byte. The provided bits will be used before any bytes are used
+ from next_in. This function should only be used with raw inflate, and
+ should be used before the first inflate() call after inflateInit2() or
+ inflateReset(). bits must be less than or equal to 16, and that many of the
+ least significant bits of value will be inserted in the input.
+
+ If bits is negative, then the input stream bit buffer is emptied. Then
+ inflatePrime() can be called again to put bits in the buffer. This is used
+ to clear out bits leftover after feeding inflate a block description prior
+ to feeding inflate codes.
+
+ inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent.
*/
+ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
/*
-ZEXTERN int ZEXPORT inflateBackInit OF((z_stream FAR *strm, int windowBits,
+ This function returns two values, one in the lower 16 bits of the return
+ value, and the other in the remaining upper bits, obtained by shifting the
+ return value down 16 bits. If the upper value is -1 and the lower value is
+ zero, then inflate() is currently decoding information outside of a block.
+ If the upper value is -1 and the lower value is non-zero, then inflate is in
+ the middle of a stored block, with the lower value equaling the number of
+ bytes from the input remaining to copy. If the upper value is not -1, then
+ it is the number of bits back from the current bit position in the input of
+ the code (literal or length/distance pair) currently being processed. In
+ that case the lower value is the number of bytes already emitted for that
+ code.
+
+ A code is being processed if inflate is waiting for more input to complete
+ decoding of the code, or if it has completed decoding but is waiting for
+ more output space to write the literal or match data.
+
+ inflateMark() is used to mark locations in the input data for random
+ access, which may be at bit positions, and to note those cases where the
+ output of a code may span boundaries of random access blocks. The current
+ location in the input stream can be determined from avail_in and data_type
+ as noted in the description for the Z_BLOCK flush parameter for inflate.
+
+ inflateMark returns the value noted above or -1 << 16 if the provided
+ source stream state was inconsistent.
+*/
+
+ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
+ gz_headerp head));
+/*
+ inflateGetHeader() requests that gzip header information be stored in the
+ provided gz_header structure. inflateGetHeader() may be called after
+ inflateInit2() or inflateReset(), and before the first call of inflate().
+ As inflate() processes the gzip stream, head->done is zero until the header
+ is completed, at which time head->done is set to one. If a zlib stream is
+ being decoded, then head->done is set to -1 to indicate that there will be
+ no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be
+ used to force inflate() to return immediately after header processing is
+ complete and before any actual data is decompressed.
+
+ The text, time, xflags, and os fields are filled in with the gzip header
+ contents. hcrc is set to true if there is a header CRC. (The header CRC
+ was valid if done is set to one.) If extra is not Z_NULL, then extra_max
+ contains the maximum number of bytes to write to extra. Once done is true,
+ extra_len contains the actual extra field length, and extra contains the
+ extra field, or that field truncated if extra_max is less than extra_len.
+ If name is not Z_NULL, then up to name_max characters are written there,
+ terminated with a zero unless the length is greater than name_max. If
+ comment is not Z_NULL, then up to comm_max characters are written there,
+ terminated with a zero unless the length is greater than comm_max. When any
+ of extra, name, or comment are not Z_NULL and the respective field is not
+ present in the header, then that field is set to Z_NULL to signal its
+ absence. This allows the use of deflateSetHeader() with the returned
+ structure to duplicate the header. However if those fields are set to
+ allocated memory, then the application will need to save those pointers
+ elsewhere so that they can be eventually freed.
+
+ If inflateGetHeader is not used, then the header information is simply
+ discarded. The header is always checked for validity, including the header
+ CRC if present. inflateReset() will reset the process to discard the header
+ information. The application would need to call inflateGetHeader() again to
+ retrieve the header from the next gzip stream.
+
+ inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent.
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
unsigned char FAR *window));
Initialize the internal stream state for decompression using inflateBack()
@@ -736,15 +962,15 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_stream FAR *strm, int windowBits,
See inflateBack() for the usage of these routines.
inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
- the paramaters are invalid, Z_MEM_ERROR if the internal state could not
- be allocated, or Z_VERSION_ERROR if the version of the library does not
- match the version of the header file.
+ the paramaters are invalid, Z_MEM_ERROR if the internal state could not be
+ allocated, or Z_VERSION_ERROR if the version of the library does not match
+ the version of the header file.
*/
typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
-ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm,
+ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
in_func in, void FAR *in_desc,
out_func out, void FAR *out_desc));
/*
@@ -758,15 +984,15 @@ ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm,
inflateBackInit() must be called first to allocate the internal state
and to initialize the state with the user-provided window buffer.
inflateBack() may then be used multiple times to inflate a complete, raw
- deflate stream with each call. inflateBackEnd() is then called to free
- the allocated state.
+ deflate stream with each call. inflateBackEnd() is then called to free the
+ allocated state.
A raw deflate stream is one with no zlib or gzip header or trailer.
This routine would normally be used in a utility that reads zip or gzip
files and writes out uncompressed files. The utility would decode the
- header and process the trailer on its own, hence this routine expects
- only the raw deflate stream to decompress. This is different from the
- normal behavior of inflate(), which expects either a zlib or gzip header and
+ header and process the trailer on its own, hence this routine expects only
+ the raw deflate stream to decompress. This is different from the normal
+ behavior of inflate(), which expects either a zlib or gzip header and
trailer around the deflate stream.
inflateBack() uses two subroutines supplied by the caller that are then
@@ -792,7 +1018,7 @@ ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm,
calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called
immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in
must also be initialized, and then if strm->avail_in is not zero, input will
- initially be taken from strm->next_in[0 .. strm->avail_in - 1].
+ initially be taken from strm->next_in[0 .. strm->avail_in - 1].
The in_desc and out_desc parameters of inflateBack() is passed as the
first parameter of in() and out() respectively when they are called. These
@@ -802,18 +1028,18 @@ ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm,
On return, inflateBack() will set strm->next_in and strm->avail_in to
pass back any unused input that was provided by the last in() call. The
return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
- if in() or out() returned an error, Z_DATA_ERROR if there was a format
- error in the deflate stream (in which case strm->msg is set to indicate the
- nature of the error), or Z_STREAM_ERROR if the stream was not properly
- initialized. In the case of Z_BUF_ERROR, an input or output error can be
- distinguished using strm->next_in which will be Z_NULL only if in() returned
- an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to
- out() returning non-zero. (in() will always be called before out(), so
- strm->next_in is assured to be defined if out() returns non-zero.) Note
- that inflateBack() cannot return Z_OK.
+ if in() or out() returned an error, Z_DATA_ERROR if there was a format error
+ in the deflate stream (in which case strm->msg is set to indicate the nature
+ of the error), or Z_STREAM_ERROR if the stream was not properly initialized.
+ In the case of Z_BUF_ERROR, an input or output error can be distinguished
+ using strm->next_in which will be Z_NULL only if in() returned an error. If
+ strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
+ non-zero. (in() will always be called before out(), so strm->next_in is
+ assured to be defined if out() returns non-zero.) Note that inflateBack()
+ cannot return Z_OK.
*/
-ZEXTERN int ZEXPORT inflateBackEnd OF((z_stream FAR *strm));
+ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
/*
All memory allocated by inflateBackInit() is freed.
@@ -866,23 +1092,22 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
/* utility functions */
/*
- The following utility functions are implemented on top of the
- basic stream-oriented functions. To simplify the interface, some
- default options are assumed (compression level and memory usage,
- standard memory allocation functions). The source code of these
- utility functions can easily be modified if you need special options.
+ The following utility functions are implemented on top of the basic
+ stream-oriented functions. To simplify the interface, some default options
+ are assumed (compression level and memory usage, standard memory allocation
+ functions). The source code of these utility functions can be modified if
+ you need special options.
*/
ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen));
/*
Compresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be at least the value returned
- by compressBound(sourceLen). Upon exit, destLen is the actual size of the
+ the byte length of the source buffer. Upon entry, destLen is the total size
+ of the destination buffer, which must be at least the value returned by
+ compressBound(sourceLen). Upon exit, destLen is the actual size of the
compressed buffer.
- This function can be used to compress a whole file at once if the
- input file is mmap'ed.
+
compress returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_BUF_ERROR if there was not enough room in the output
buffer.
@@ -892,11 +1117,11 @@ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen,
int level));
/*
- Compresses the source buffer into the destination buffer. The level
+ Compresses the source buffer into the destination buffer. The level
parameter has the same meaning as in deflateInit. sourceLen is the byte
- length of the source buffer. Upon entry, destLen is the total size of the
+ length of the source buffer. Upon entry, destLen is the total size of the
destination buffer, which must be at least the value returned by
- compressBound(sourceLen). Upon exit, destLen is the actual size of the
+ compressBound(sourceLen). Upon exit, destLen is the actual size of the
compressed buffer.
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
@@ -907,22 +1132,20 @@ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
/*
compressBound() returns an upper bound on the compressed size after
- compress() or compress2() on sourceLen bytes. It would be used before
- a compress() or compress2() call to allocate the destination buffer.
+ compress() or compress2() on sourceLen bytes. It would be used before a
+ compress() or compress2() call to allocate the destination buffer.
*/
ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen));
/*
Decompresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be large enough to hold the
- entire uncompressed data. (The size of the uncompressed data must have
- been saved previously by the compressor and transmitted to the decompressor
- by some mechanism outside the scope of this compression library.)
- Upon exit, destLen is the actual size of the compressed buffer.
- This function can be used to decompress a whole file at once if the
- input file is mmap'ed.
+ the byte length of the source buffer. Upon entry, destLen is the total size
+ of the destination buffer, which must be large enough to hold the entire
+ uncompressed data. (The size of the uncompressed data must have been saved
+ previously by the compressor and transmitted to the decompressor by some
+ mechanism outside the scope of this compression library.) Upon exit, destLen
+ is the actual size of the uncompressed buffer.
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_BUF_ERROR if there was not enough room in the output
@@ -930,136 +1153,199 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
*/
-typedef voidp gzFile;
+ /* gzip file access functions */
+
+/*
+ This library 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.
+*/
+
+typedef voidp gzFile; /* opaque gzip file descriptor */
-ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
/*
- Opens a gzip (.gz) file for reading or writing. The mode parameter
- is as in fopen ("rb" or "wb") but can also include a compression level
- ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
- Huffman only compression as in "wb1h", or 'R' for run-length encoding
- as in "wb1R". (See the description of deflateInit2 for more information
- about the strategy parameter.)
+ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
+
+ Opens a gzip (.gz) file for reading or writing. The mode parameter is as
+ in fopen ("rb" or "wb") but can also include a compression level ("wb9") or
+ a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
+ compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'
+ for fixed code compression as in "wb9F". (See the description of
+ deflateInit2 for more information about the strategy parameter.) Also "a"
+ can be used instead of "w" to request that the gzip stream that will be
+ written be appended to the file. "+" will result in an error, since reading
+ and writing to the same gzip file is not supported.
gzopen can be used to read a file which is not in gzip format; in this
case gzread will directly read from the file without decompression.
- gzopen returns NULL if the file could not be opened or if there was
- insufficient memory to allocate the (de)compression state; errno
- can be checked to distinguish the two cases (if errno is zero, the
- zlib error is Z_MEM_ERROR). */
+ gzopen returns NULL if the file could not be opened, if there was
+ insufficient memory to allocate the gzFile state, or if an invalid mode was
+ specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
+ errno can be checked to determine if the reason gzopen failed was that the
+ file could not be opened.
+*/
+
+ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
+/*
+ gzdopen associates a gzFile with the file descriptor fd. File descriptors
+ are obtained from calls like open, dup, creat, pipe or fileno (if the file
+ has been previously opened with fopen). The mode parameter is as in gzopen.
+
+ The next call of gzclose on the returned gzFile will also close the file
+ descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
+ fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,
+ mode);. The duplicated descriptor should be saved to avoid a leak, since
+ gzdopen does not close fd if it fails.
+
+ gzdopen returns NULL if there was insufficient memory to allocate the
+ gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not
+ provided, or '+' was provided), or if fd is -1. The file descriptor is not
+ used until the next gz* read, write, seek, or close operation, so gzdopen
+ will not detect if fd is invalid (unless fd is -1).
+*/
-ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
+ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
/*
- gzdopen() associates a gzFile with the file descriptor fd. File
- descriptors are obtained from calls like open, dup, creat, pipe or
- fileno (in the file has been previously opened with fopen).
- The mode parameter is as in gzopen.
- The next call of gzclose on the returned gzFile will also close the
- file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
- descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
- gzdopen returns NULL if there was insufficient memory to allocate
- the (de)compression state.
+ Set the internal buffer size used by this library's functions. The
+ default buffer size is 8192 bytes. This function must be called after
+ gzopen() or gzdopen(), and before any other calls that read or write the
+ file. The buffer memory allocation is always deferred to the first read or
+ write. Two buffers are allocated, either both of the specified size when
+ writing, or one of the specified size and the other twice that size when
+ reading. A larger buffer size of, for example, 64K or 128K bytes will
+ noticeably increase the speed of decompression (reading).
+
+ The new buffer size also affects the maximum length for gzprintf().
+
+ gzbuffer() returns 0 on success, or -1 on failure, such as being called
+ too late.
*/
ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
/*
- Dynamically update the compression level or strategy. See the description
+ Dynamically update the compression level or strategy. See the description
of deflateInit2 for the meaning of these parameters.
+
gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
opened for writing.
*/
-ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
+ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
/*
- Reads the given number of uncompressed bytes from the compressed file.
- If the input file was not in gzip format, gzread copies the given number
- of bytes into the buffer.
- gzread returns the number of uncompressed bytes actually read (0 for
- end of file, -1 for error). */
+ Reads the given number of uncompressed bytes from the compressed file. If
+ the input file was not in gzip format, gzread copies the given number of
+ bytes into the buffer.
+
+ After reaching the end of a gzip stream in the input, gzread will continue
+ to read, looking for another gzip stream, or failing that, reading the rest
+ of the input file directly without decompression. The entire input file
+ will be read if gzread is called until it returns less than the requested
+ len.
+
+ gzread returns the number of uncompressed bytes actually read, less than
+ len for end of file, or -1 for error.
+*/
-ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
- voidpc buf, unsigned len));
+ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
+ voidpc buf, unsigned len));
/*
Writes the given number of uncompressed bytes into the compressed file.
- gzwrite returns the number of uncompressed bytes actually written
- (0 in case of error).
+ gzwrite returns the number of uncompressed bytes written or 0 in case of
+ error.
*/
-ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
+ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
/*
- Converts, formats, and writes the args to the compressed file under
- control of the format string, as in fprintf. gzprintf returns the number of
- uncompressed bytes actually written (0 in case of error). The number of
- uncompressed bytes written is limited to 4095. The caller should assure that
- this limit is not exceeded. If it is exceeded, then gzprintf() will return
- return an error (0) with nothing written. In this case, there may also be a
- buffer overflow with unpredictable consequences, which is possible only if
- zlib was compiled with the insecure functions sprintf() or vsprintf()
- because the secure snprintf() or vsnprintf() functions were not available.
+ Converts, formats, and writes the arguments to the compressed file under
+ control of the format string, as in fprintf. gzprintf returns the number of
+ uncompressed bytes actually written, or 0 in case of error. The number of
+ uncompressed bytes written is limited to 8191, or one less than the buffer
+ size given to gzbuffer(). The caller should assure that this limit is not
+ exceeded. If it is exceeded, then gzprintf() will return an error (0) with
+ nothing written. In this case, there may also be a buffer overflow with
+ unpredictable consequences, which is possible only if zlib was compiled with
+ the insecure functions sprintf() or vsprintf() because the secure snprintf()
+ or vsnprintf() functions were not available. This can be determined using
+ zlibCompileFlags().
*/
ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
/*
- Writes the given null-terminated string to the compressed file, excluding
+ Writes the given null-terminated string to the compressed file, excluding
the terminating null character.
- gzputs returns the number of characters written, or -1 in case of error.
+
+ gzputs returns the number of characters written, or -1 in case of error.
*/
ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
/*
- Reads bytes from the compressed file until len-1 characters are read, or
- a newline character is read and transferred to buf, or an end-of-file
- condition is encountered. The string is then terminated with a null
- character.
- gzgets returns buf, or Z_NULL in case of error.
+ Reads bytes from the compressed file until len-1 characters are read, or a
+ newline character is read and transferred to buf, or an end-of-file
+ condition is encountered. If any characters are read or if len == 1, the
+ string is terminated with a null character. If no characters are read due
+ to an end-of-file or len < 1, then the buffer is left untouched.
+
+ gzgets returns buf which is a null-terminated string, or it returns NULL
+ for end-of-file or in case of error. If there was an error, the contents at
+ buf are indeterminate.
*/
-ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
+ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
/*
- Writes c, converted to an unsigned char, into the compressed file.
- gzputc returns the value that was written, or -1 in case of error.
+ Writes c, converted to an unsigned char, into the compressed file. gzputc
+ returns the value that was written, or -1 in case of error.
*/
-ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
+ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
/*
- Reads one byte from the compressed file. gzgetc returns this byte
- or -1 in case of end of file or error.
+ Reads one byte from the compressed file. gzgetc returns this byte or -1
+ in case of end of file or error.
*/
-ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
+ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
/*
- Push one character back onto the stream to be read again later.
- Only one character of push-back is allowed. gzungetc() returns the
- character pushed, or -1 on failure. gzungetc() will fail if a
- character has been pushed but not read yet, or if c is -1. The pushed
- character will be discarded if the stream is repositioned with gzseek()
- or gzrewind().
+ Push one character back onto the stream to be read as the first character
+ on the next read. At least one character of push-back is allowed.
+ gzungetc() returns the character pushed, or -1 on failure. gzungetc() will
+ fail if c is -1, and may fail if a character has been pushed but not read
+ yet. If gzungetc is used immediately after gzopen or gzdopen, at least the
+ output buffer size of pushed characters is allowed. (See gzbuffer above.)
+ The pushed character will be discarded if the stream is repositioned with
+ gzseek() or gzrewind().
*/
-ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
+ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
/*
- Flushes all pending output into the compressed file. The parameter
- flush is as in the deflate() function. The return value is the zlib
- error number (see function gzerror below). gzflush returns Z_OK if
- the flush parameter is Z_FINISH and all output could be flushed.
- gzflush should be called only when strictly necessary because it can
- degrade compression.
+ Flushes all pending output into the compressed file. The parameter flush
+ is as in the deflate() function. The return value is the zlib error number
+ (see function gzerror below). gzflush is only permitted when writing.
+
+ If the flush parameter is Z_FINISH, the remaining data is written and the
+ gzip stream is completed in the output. If gzwrite() is called again, a new
+ gzip stream will be started in the output. gzread() is able to read such
+ concatented gzip streams.
+
+ gzflush should be called only when strictly necessary because it will
+ degrade compression if called too often.
*/
-ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
- z_off_t offset, int whence));
/*
- Sets the starting position for the next gzread or gzwrite on the
- given compressed file. The offset represents a number of bytes in the
- uncompressed data stream. The whence parameter is defined as in lseek(2);
+ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
+ z_off_t offset, int whence));
+
+ Sets the starting position for the next gzread or gzwrite on the given
+ compressed file. The offset represents a number of bytes in the
+ uncompressed data stream. The whence parameter is defined as in lseek(2);
the value SEEK_END is not supported.
+
If the file is opened for reading, this function is emulated but can be
- extremely slow. If the file is opened for writing, only forward seeks are
+ extremely slow. If the file is opened for writing, only forward seeks are
supported; gzseek then compresses a sequence of zeroes up to the new
starting position.
- gzseek returns the resulting offset location as measured in bytes from
+ gzseek returns the resulting offset location as measured in bytes from
the beginning of the uncompressed stream, or -1 in case of error, in
particular if the file is opened for writing and the new starting position
would be before the current position.
@@ -1069,63 +1355,127 @@ ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
/*
Rewinds the given file. This function is supported only for reading.
- gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
+ gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
*/
+/*
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
+
+ Returns the starting position for the next gzread or gzwrite on the given
+ compressed file. This position represents a number of bytes in the
+ uncompressed data stream, and is zero when starting, even if appending or
+ reading a gzip stream from the middle of a file using gzdopen().
+
+ gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
+*/
+
/*
- Returns the starting position for the next gzread or gzwrite on the
- given compressed file. This position represents a number of bytes in the
- uncompressed data stream.
+ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
- gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
+ Returns the current offset in the file being read or written. This offset
+ includes the count of bytes that precede the gzip stream, for example when
+ appending or when using gzdopen() for reading. When reading, the offset
+ does not include as yet unused buffered input. This information can be used
+ for a progress indicator. On error, gzoffset() returns -1.
*/
ZEXTERN int ZEXPORT gzeof OF((gzFile file));
/*
- Returns 1 when EOF has previously been detected reading the given
- input stream, otherwise zero.
+ Returns true (1) if the end-of-file indicator has been set while reading,
+ false (0) otherwise. Note that the end-of-file indicator is set only if the
+ read tried to go past the end of the input, but came up short. Therefore,
+ just like feof(), gzeof() may return false even if there is no more data to
+ read, in the event that the last read request was for the exact number of
+ bytes remaining in the input file. This will happen if the input file size
+ is an exact multiple of the buffer size.
+
+ If gzeof() returns true, then the read functions will return no more data,
+ unless the end-of-file indicator is reset by gzclearerr() and the input file
+ has grown since the previous end of file was detected.
+*/
+
+ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
+/*
+ Returns true (1) if file is being copied directly while reading, or false
+ (0) if file is a gzip stream being decompressed. This state can change from
+ false to true while reading the input file if the end of a gzip stream is
+ reached, but is followed by data that is not another gzip stream.
+
+ If the input file is empty, gzdirect() will return true, since the input
+ does not contain a gzip stream.
+
+ If gzdirect() is used immediately after gzopen() or gzdopen() it will
+ cause buffers to be allocated to allow reading the file to determine if it
+ is a gzip file. Therefore if gzbuffer() is used, it should be called before
+ gzdirect().
*/
ZEXTERN int ZEXPORT gzclose OF((gzFile file));
/*
- Flushes all pending output if necessary, closes the compressed file
- and deallocates all the (de)compression state. The return value is the zlib
- error number (see function gzerror below).
+ Flushes all pending output if necessary, closes the compressed file and
+ deallocates the (de)compression state. Note that once file is closed, you
+ cannot call gzerror with file, since its structures have been deallocated.
+ gzclose must not be called more than once on the same file, just as free
+ must not be called more than once on the same allocation.
+
+ gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
+ file operation error, or Z_OK on success.
+*/
+
+ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
+ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
+/*
+ Same as gzclose(), but gzclose_r() is only for use when reading, and
+ gzclose_w() is only for use when writing or appending. The advantage to
+ using these instead of gzclose() is that they avoid linking in zlib
+ compression or decompression code that is not used when only reading or only
+ writing respectively. If gzclose() is used, then both compression and
+ decompression code will be included the application when linking to a static
+ zlib library.
*/
ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
/*
- Returns the error message for the last error which occurred on the
- given compressed file. errnum is set to zlib error number. If an
- error occurred in the file system and not in the compression library,
- errnum is set to Z_ERRNO and the application may consult errno
- to get the exact error code.
+ Returns the error message for the last error which occurred on the given
+ compressed file. errnum is set to zlib error number. If an error occurred
+ in the file system and not in the compression library, errnum is set to
+ Z_ERRNO and the application may consult errno to get the exact error code.
+
+ The application must not modify the returned string. Future calls to
+ this function may invalidate the previously returned string. If file is
+ closed, then the string previously returned by gzerror will no longer be
+ available.
+
+ gzerror() should be used to distinguish errors from end-of-file for those
+ functions above that do not distinguish those cases in their return values.
*/
ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
/*
- Clears the error and end-of-file flags for file. This is analogous to the
- clearerr() function in stdio. This is useful for continuing to read a gzip
+ Clears the error and end-of-file flags for file. This is analogous to the
+ clearerr() function in stdio. This is useful for continuing to read a gzip
file that is being written concurrently.
*/
+
/* checksum functions */
/*
These functions are not related to compression but are exported
- anyway because they might be useful in applications using the
- compression library.
+ anyway because they might be useful in applications using the compression
+ library.
*/
ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
-
/*
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
- return the updated checksum. If buf is NULL, this function returns
- the required initial value for the checksum.
- An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
- much faster. Usage example:
+ return the updated checksum. If buf is Z_NULL, this function returns the
+ required initial value for the checksum.
+
+ An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
+ much faster.
+
+ Usage example:
uLong adler = adler32(0L, Z_NULL, 0);
@@ -1135,12 +1485,24 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
if (adler != original_adler) error();
*/
+/*
+ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
+ z_off_t len2));
+
+ Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
+ and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
+ each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
+ seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
+*/
+
ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
/*
- Update a running crc with the bytes buf[0..len-1] and return the updated
- crc. If buf is NULL, this function returns the required initial value
- for the crc. Pre- and post-conditioning (one's complement) is performed
- within this function so it shouldn't be done by the application.
+ Update a running CRC-32 with the bytes buf[0..len-1] and return the
+ updated CRC-32. If buf is Z_NULL, this function returns the required
+ initial value for the for the crc. Pre- and post-conditioning (one's
+ complement) is performed within this function so it shouldn't be done by the
+ application.
+
Usage example:
uLong crc = crc32(0L, Z_NULL, 0);
@@ -1151,6 +1513,16 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
if (crc != original_crc) error();
*/
+/*
+ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
+
+ Combine two CRC-32 check values into one. For two sequences of bytes,
+ seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
+ calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
+ check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
+ len2.
+*/
+
/* various hacks, don't look :) */
@@ -1167,7 +1539,7 @@ ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
int stream_size));
ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateBackInit_ OF((z_stream FAR *strm, int windowBits,
+ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
unsigned char FAR *window,
const char *version,
int stream_size));
@@ -1182,16 +1554,57 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_stream FAR *strm, int windowBits,
inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
#define inflateBackInit(strm, windowBits, window) \
inflateBackInit_((strm), (windowBits), (window), \
- ZLIB_VERSION, sizeof(z_stream))
+ ZLIB_VERSION, sizeof(z_stream))
+/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
+ * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
+ * both are true, the application gets the *64 functions, and the regular
+ * functions are changed to 64 bits) -- in case these are set on systems
+ * without large file support, _LFS64_LARGEFILE must also be true
+ */
+#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
+ ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
+ ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
+ ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
+ ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
+ ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
+ ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
+#endif
+
+#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0
+# define gzopen gzopen64
+# define gzseek gzseek64
+# define gztell gztell64
+# define gzoffset gzoffset64
+# define adler32_combine adler32_combine64
+# define crc32_combine crc32_combine64
+# ifdef _LARGEFILE64_SOURCE
+ ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
+ ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
+ ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
+ ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
+ ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
+ ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
+# endif
+#else
+ ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
+ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
+ ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
+ ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
+ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
+ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
+#endif
+/* hack for buggy compilers */
#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
- struct internal_state {int dummy;}; /* hack for buggy compilers */
+ struct internal_state {int dummy;};
#endif
-ZEXTERN const char * ZEXPORT zError OF((int err));
-ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
+/* undocumented functions */
+ZEXTERN const char * ZEXPORT zError OF((int));
+ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
+ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
#ifdef __cplusplus
}
diff --git a/com32/lib/MCONFIG b/com32/lib/MCONFIG
index 1ae83bc7..44278bd1 100644
--- a/com32/lib/MCONFIG
+++ b/com32/lib/MCONFIG
@@ -2,9 +2,20 @@
include $(topdir)/MCONFIG
-GCCOPT := $(call gcc_ok,-std=gnu99,) \
- $(call gcc_ok,-m32,) \
- $(call gcc_ok,-fno-stack-protector,) \
+GCCOPT := $(call gcc_ok,-std=gnu99,)
+GCCOPT += $(call gcc_ok,-m32,)
+GCCOPT += $(call gcc_ok,-fno-stack-protector,)
+GCCOPT += $(call gcc_ok,-fwrapv,)
+GCCOPT += $(call gcc_ok,-freg-struct-return,)
+GCCOPT += $(call gcc_ok,-fPIE,-fPIC)
+GCCOPT += $(call gcc_ok,-fno-exceptions,)
+GCCOPT += $(call gcc_ok,-fno-asynchronous-unwind-tables,)
+GCCOPT += $(call gcc_ok,-fno-strict-aliasing,)
+GCCOPT += $(call gcc_ok,-falign-functions=0,-malign-functions=0)
+GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0)
+GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0)
+GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0)
+GCCOPT += $(call gcc_ok,-mpreferred-stack-boundary=2,)
INCLUDE = -I.
STRIP = strip --strip-all -R .comment -R .note
diff --git a/com32/lib/Makefile b/com32/lib/Makefile
index 250c3962..2035df22 100644
--- a/com32/lib/Makefile
+++ b/com32/lib/Makefile
@@ -11,13 +11,14 @@ LIBOBJS = \
abort.o atexit.o atoi.o atol.o atoll.o calloc.o creat.o \
ctypes.o errno.o fgetc.o fgets.o fopen.o fprintf.o fputc.o \
fclose.o putchar.o setjmp.o \
- fputs.o fread2.o fread.o free.o fwrite2.o fwrite.o getopt.o \
+ fputs.o fread2.o fread.o free.o fwrite2.o fwrite.o \
+ getopt.o getopt_long.o \
lrand48.o malloc.o stack.o memccpy.o memchr.o memcmp.o \
memcpy.o mempcpy.o memmem.o memmove.o memset.o memswap.o \
exit.o onexit.o \
perror.o printf.o puts.o qsort.o realloc.o seed48.o snprintf.o \
sprintf.o srand48.o sscanf.o stack.o strcasecmp.o strcat.o \
- strchr.o strcmp.o strcpy.o strpcpy.o strdup.o strlen.o \
+ strchr.o strcmp.o strcpy.o strdup.o strlen.o \
strerror.o strnlen.o \
strncasecmp.o strncat.o strncmp.o strncpy.o strndup.o \
stpcpy.o stpncpy.o \
@@ -27,19 +28,22 @@ LIBOBJS = \
asprintf.o vasprintf.o strlcpy.o strlcat.o \
vsscanf.o zalloc.o \
\
+ lmalloc.o lstrdup.o \
+ \
dprintf.o vdprintf.o \
\
- opendir.o readdir.o closedir.o getcwd.o chdir.o fdopendir.o \
+ sys/readdir.o getcwd.o chdir.o fdopendir.o \
\
- libgcc/__ashldi3.o libgcc/__udivdi3.o \
+ libgcc/__ashldi3.o libgcc/__udivdi3.o \
libgcc/__negdi2.o libgcc/__ashrdi3.o libgcc/__lshrdi3.o \
libgcc/__muldi3.o libgcc/__udivmoddi4.o libgcc/__umoddi3.o \
libgcc/__divdi3.o libgcc/__moddi3.o \
\
sys/intcall.o sys/farcall.o sys/cfarcall.o sys/zeroregs.o \
- sys/entry.o sys/exit.o sys/argv.o sys/times.o \
+ sys/entry.o sys/exit.o sys/argv.o sys/times.o sys/sleep.o \
sys/fileinfo.o sys/opendev.o sys/read.o sys/write.o sys/ftell.o \
sys/close.o sys/open.o sys/fileread.o sys/fileclose.o \
+ sys/openmem.o \
sys/isatty.o sys/fstat.o \
\
sys/zfile.o sys/zfopen.o \
@@ -117,6 +121,25 @@ LIBOBJS = \
syslinux/video/fontquery.o syslinux/video/forcetext.o \
syslinux/video/reportmode.o
+# These are the objects which are also imported into the core
+LIBCOREOBJS = \
+ memcpy.o mempcpy.o memset.o memcmp.o memmove.o \
+ strlen.o stpcpy.o strcpy.o strcmp.o strlcpy.o strlcat.o \
+ strchr.o strncmp.o strncpy.o \
+ \
+ snprintf.o sprintf.o vsnprintf.o \
+ \
+ dprintf.o vdprintf.o \
+ \
+ zalloc.o strdup.o \
+ \
+ sys/intcall.o sys/farcall.o sys/cfarcall.o sys/zeroregs.o \
+ \
+ libgcc/__ashldi3.o libgcc/__udivdi3.o \
+ libgcc/__negdi2.o libgcc/__ashrdi3.o libgcc/__lshrdi3.o \
+ libgcc/__muldi3.o libgcc/__udivmoddi4.o libgcc/__umoddi3.o \
+ libgcc/__divdi3.o libgcc/__moddi3.o
+
BINDIR = /usr/bin
LIBDIR = /usr/lib
DATADIR = /usr/share
@@ -124,13 +147,18 @@ AUXDIR = $(DATADIR)/syslinux
INCDIR = /usr/include
COM32DIR = $(AUXDIR)/com32
-all: libcom32.a
+all: libcom32.a libcomcore.a
libcom32.a : $(LIBOBJS)
rm -f $@
$(AR) cq $@ $^
$(RANLIB) $@
+libcomcore.a : $(LIBCOREOBJS)
+ rm -f $@
+ $(AR) cq $@ $^
+ $(RANLIB) $@
+
tidy dist clean:
rm -f sys/vesa/alphatbl.c
find . \( -name \*.o -o -name \*.a -o -name .\*.d -o -name \*.tmp \) -print0 | \
diff --git a/com32/lib/chdir.c b/com32/lib/chdir.c
index 6a365f3b..00670e35 100644
--- a/com32/lib/chdir.c
+++ b/com32/lib/chdir.c
@@ -6,12 +6,10 @@
#include <stdio.h>
#include <errno.h>
+#include <com32.h>
+#include <syslinux/pmapi.h>
+
int chdir(const char *path)
{
- /* Actually implement something here... */
-
- (void)path;
-
- errno = ENOSYS;
- return -1;
+ return __com32.cs_pm->chdir(path);
}
diff --git a/com32/lib/closedir.c b/com32/lib/closedir.c
deleted file mode 100644
index a2d11105..00000000
--- a/com32/lib/closedir.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * closedir.c
- */
-
-#include <dirent.h>
-#include <stdio.h>
-#include <errno.h>
-
-#include <com32.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
-
-int closedir(DIR * dir)
-{
- int rv;
- com32sys_t regs;
- if (dir == NULL) {
- rv = 0;
- } else {
- memset(&regs, 0, sizeof regs); /* ?Needed? */
- regs.eax.w[0] = 0x0022;
- regs.esi.w[0] = dir->dd_fd;
- __com32.cs_intcall(0x22, &regs, &regs);
- free(dir); /* garbage collection? */
- rv = 0;
- }
- return rv;
-}
diff --git a/com32/lib/com32.ld b/com32/lib/com32.ld
index 36d5b6ed..37ee46cf 100644
--- a/com32/lib/com32.ld
+++ b/com32/lib/com32.ld
@@ -11,8 +11,9 @@ ENTRY(_start)
SECTIONS
{
/* Read-only sections, merged into text segment: */
- . = 0x101000;
+ . = 0;
PROVIDE (__executable_start = .);
+ PROVIDE (_stext = .);
.init :
{
@@ -28,40 +29,52 @@ SECTIONS
{
KEEP (*(.fini))
} =0x90909090
- PROVIDE (__etext = .);
PROVIDE (_etext = .);
- PROVIDE (etext = .);
+
+ __rodata_start = .;
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
.rodata1 : { *(.rodata1) }
+ __rodata_end = .;
/* Ensure the __preinit_array_start label is properly aligned. We
could instead move the label definition inside the section, but
the linker would then create the section even if it turns out to
be empty, which isn't pretty. */
. = ALIGN(4);
- PROVIDE (__preinit_array_start = .);
- .preinit_array : { *(.preinit_array) }
- PROVIDE (__preinit_array_end = .);
- PROVIDE (__init_array_start = .);
- .init_array : { *(.init_array) }
- PROVIDE (__init_array_end = .);
- PROVIDE (__fini_array_start = .);
- .fini_array : { *(.fini_array) }
- PROVIDE (__fini_array_end = .);
- PROVIDE (__ctors_start = .);
- .ctors :
- {
+ .preinit_array : {
+ PROVIDE (__preinit_array_start = .);
+ *(.preinit_array)
+ PROVIDE (__preinit_array_end = .);
+ }
+ .init_array : {
+ PROVIDE (__init_array_start = .);
+ *(.init_array)
+ PROVIDE (__init_array_end = .);
+ }
+ .fini_array : {
+ PROVIDE (__fini_array_start = .);
+ *(.fini_array)
+ PROVIDE (__fini_array_end = .);
+ }
+ .ctors : {
+ PROVIDE (__ctors_start = .);
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
+ PROVIDE (__ctors_end = .);
}
- PROVIDE (__ctors_end = .);
- PROVIDE (__dtors_start = .);
- .dtors :
- {
+ .dtors : {
+ PROVIDE (__dtors_start = .);
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
+ PROVIDE (__dtors_end = .);
+ }
+
+ .got : {
+ PROVIDE (__got_start = .);
+ KEEP (*(.got.plt))
+ KEEP (*(.got))
+ PROVIDE (__got_end = .);
}
- PROVIDE (__dtors_end = .);
/* Adjust the address for the data segment. Avoid mixing code and
data within same 128-byte chunk. */
@@ -69,12 +82,14 @@ SECTIONS
.data :
{
- *(.data .data.* .gnu.linkonce.d.*)
+ _sdata = .;
+ KEEP(*(.data .data.* .gnu.linkonce.d.*))
SORT(CONSTRUCTORS)
+ *(.data1)
+ . = ALIGN(4);
+ _edata = .;
}
- .data1 : { *(.data1) }
- _edata = .;
- PROVIDE (edata = .);
+
__bss_start = .;
.bss :
{
@@ -84,11 +99,10 @@ SECTIONS
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
- . = ALIGN(32 / 8);
+ . = ALIGN(4);
}
- . = ALIGN(32 / 8);
+ . = ALIGN(4);
_end = .;
- PROVIDE (end = .);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
diff --git a/com32/lib/fprintf.c b/com32/lib/fprintf.c
index 36b86265..5eb8e079 100644
--- a/com32/lib/fprintf.c
+++ b/com32/lib/fprintf.c
@@ -5,8 +5,6 @@
#include <stdio.h>
#include <stdarg.h>
-#define BUFFER_SIZE 16384
-
int fprintf(FILE * file, const char *format, ...)
{
va_list ap;
diff --git a/com32/lib/getcwd.c b/com32/lib/getcwd.c
index 38fae52a..5ce62ec0 100644
--- a/com32/lib/getcwd.c
+++ b/com32/lib/getcwd.c
@@ -2,29 +2,10 @@
* getcwd.c
*/
-#include <syslinux/config.h>
-#include <klibc/compiler.h>
#include <com32.h>
-
-#include <dirent.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
+#include <syslinux/pmapi.h>
char *getcwd(char *buf, size_t size)
{
- static com32sys_t reg;
- char *pwdstr, *ret;
-
- reg.eax.w[0] = 0x001f;
- __intcall(0x22, &reg, &reg);
- pwdstr = MK_PTR(reg.es, reg.ebx.w[0]);
- if ((strlen(pwdstr) < size) && (buf != NULL)) {
- strcpy(buf, pwdstr);
- ret = buf;
- } else {
- ret = NULL;
- errno = ERANGE;
- }
- return ret;
+ return __com32.cs_pm->getcwd(buf, size);
}
diff --git a/com32/lib/getopt.c b/com32/lib/getopt.c
index 5e9b7c63..806735d7 100644
--- a/com32/lib/getopt.c
+++ b/com32/lib/getopt.c
@@ -9,64 +9,89 @@
#include <string.h>
char *optarg;
-int optind = 1;
-int opterr, optopt;
-static const char *__optptr;
+int optind, opterr, optopt;
+static struct getopt_private_state {
+ const char *optptr;
+ const char *last_optstring;
+ char *const *last_argv;
+} pvt;
int getopt(int argc, char *const *argv, const char *optstring)
{
- const char *carg = argv[optind];
- const char *osptr;
- int opt;
+ const char *carg;
+ const char *osptr;
+ int opt;
- /* We don't actually need argc */
- (void)argc;
+ /* getopt() relies on a number of different global state
+ variables, which can make this really confusing if there is
+ more than one use of getopt() in the same program. This
+ attempts to detect that situation by detecting if the
+ "optstring" or "argv" argument have changed since last time
+ we were called; if so, reinitialize the query state. */
- /* First, eliminate all non-option cases */
-
- if (!carg || carg[0] != '-' || !carg[1]) {
- return -1;
- }
+ if (optstring != pvt.last_optstring || argv != pvt.last_argv ||
+ optind < 1 || optind > argc) {
+ /* optind doesn't match the current query */
+ pvt.last_optstring = optstring;
+ pvt.last_argv = argv;
+ optind = 1;
+ pvt.optptr = NULL;
+ }
- if (carg[1] == '-' && !carg[2]) {
- optind++;
- return -1;
- }
+ carg = argv[optind];
- if ((uintptr_t) (__optptr - carg) > (uintptr_t) strlen(carg))
- __optptr = carg + 1; /* Someone frobbed optind, change to new opt. */
+ /* First, eliminate all non-option cases */
- opt = *__optptr++;
+ if (!carg || carg[0] != '-' || !carg[1]) {
+ return -1;
+ }
- if (opt != ':' && (osptr = strchr(optstring, opt))) {
- if (osptr[1] == ':') {
- if (*__optptr) {
- /* Argument-taking option with attached argument */
- optarg = (char *)__optptr;
+ if (carg[1] == '-' && !carg[2]) {
optind++;
- } else {
- /* Argument-taking option with non-attached argument */
- if (argv[optind + 1]) {
- optarg = (char *)argv[optind + 1];
- optind += 2;
+ return -1;
+ }
+
+ if ((uintptr_t) (pvt.optptr - carg) > (uintptr_t) strlen(carg)) {
+ /* Someone frobbed optind, change to new opt. */
+ pvt.optptr = carg + 1;
+ }
+
+ opt = *pvt.optptr++;
+
+ if (opt != ':' && (osptr = strchr(optstring, opt))) {
+ if (osptr[1] == ':') {
+ if (*pvt.optptr) {
+ /* Argument-taking option with attached
+ argument */
+ optarg = (char *)pvt.optptr;
+ optind++;
+ } else {
+ /* Argument-taking option with non-attached
+ argument */
+ if (argv[optind + 1]) {
+ optarg = (char *)argv[optind+1];
+ optind += 2;
+ } else {
+ /* Missing argument */
+ optind++;
+ return (optstring[0] == ':')
+ ? ':' : '?';
+ }
+ }
+ return opt;
} else {
- /* Missing argument */
- return (optstring[0] == ':') ? ':' : '?';
+ /* Non-argument-taking option */
+ /* pvt.optptr will remember the exact position to
+ resume at */
+ if (!*pvt.optptr)
+ optind++;
+ return opt;
}
- }
- return opt;
} else {
- /* Non-argument-taking option */
- /* __optptr will remember the exact position to resume at */
- if (!*__optptr)
- optind++;
- return opt;
+ /* Unknown option */
+ optopt = opt;
+ if (!*pvt.optptr)
+ optind++;
+ return '?';
}
- } else {
- /* Unknown option */
- optopt = opt;
- if (!*__optptr)
- optind++;
- return '?';
- }
}
diff --git a/com32/lib/getopt_long.c b/com32/lib/getopt_long.c
new file mode 100644
index 00000000..e3d064b0
--- /dev/null
+++ b/com32/lib/getopt_long.c
@@ -0,0 +1,152 @@
+/*
+ * getopt.c
+ *
+ * getopt_long(), or at least a common subset thereof:
+ *
+ * - Option reordering is not supported
+ * - -W foo is not supported
+ * - First optstring character "-" not supported.
+ */
+
+#include <stdint.h>
+#include <unistd.h>
+#include <string.h>
+#include <getopt.h>
+
+char *optarg;
+int optind, opterr, optopt;
+static struct getopt_private_state {
+ const char *optptr;
+ const char *last_optstring;
+ char *const *last_argv;
+} pvt;
+
+static inline const char *option_matches(const char *arg_str,
+ const char *opt_name)
+{
+ while (*arg_str != '\0' && *arg_str != '=') {
+ if (*arg_str++ != *opt_name++)
+ return NULL;
+ }
+
+ if (*opt_name)
+ return NULL;
+
+ return arg_str;
+}
+
+int getopt_long(int argc, char *const *argv, const char *optstring,
+ const struct option *longopts, int *longindex)
+{
+ const char *carg;
+ const char *osptr;
+ int opt;
+
+ /* getopt() relies on a number of different global state
+ variables, which can make this really confusing if there is
+ more than one use of getopt() in the same program. This
+ attempts to detect that situation by detecting if the
+ "optstring" or "argv" argument have changed since last time
+ we were called; if so, reinitialize the query state. */
+
+ if (optstring != pvt.last_optstring || argv != pvt.last_argv ||
+ optind < 1 || optind > argc) {
+ /* optind doesn't match the current query */
+ pvt.last_optstring = optstring;
+ pvt.last_argv = argv;
+ optind = 1;
+ pvt.optptr = NULL;
+ }
+
+ carg = argv[optind];
+
+ /* First, eliminate all non-option cases */
+
+ if (!carg || carg[0] != '-' || !carg[1])
+ return -1;
+
+ if (carg[1] == '-') {
+ const struct option *lo;
+ const char *opt_end = NULL;
+
+ optind++;
+
+ /* Either it's a long option, or it's -- */
+ if (!carg[2]) {
+ /* It's -- */
+ return -1;
+ }
+
+ for (lo = longopts; lo->name; lo++) {
+ if ((opt_end = option_matches(carg+2, lo->name)))
+ break;
+ }
+ if (!opt_end)
+ return '?';
+
+ if (longindex)
+ *longindex = lo-longopts;
+
+ if (*opt_end == '=') {
+ if (lo->has_arg)
+ optarg = (char *)opt_end+1;
+ else
+ return '?';
+ } else if (lo->has_arg == 1) {
+ if (!(optarg = argv[optind]))
+ return '?';
+ optind++;
+ }
+
+ if (lo->flag) {
+ *lo->flag = lo->val;
+ return 0;
+ } else {
+ return lo->val;
+ }
+ }
+
+ if ((uintptr_t) (pvt.optptr - carg) > (uintptr_t) strlen(carg)) {
+ /* Someone frobbed optind, change to new opt. */
+ pvt.optptr = carg + 1;
+ }
+
+ opt = *pvt.optptr++;
+
+ if (opt != ':' && (osptr = strchr(optstring, opt))) {
+ if (osptr[1] == ':') {
+ if (*pvt.optptr) {
+ /* Argument-taking option with attached
+ argument */
+ optarg = (char *)pvt.optptr;
+ optind++;
+ } else {
+ /* Argument-taking option with non-attached
+ argument */
+ if (argv[optind + 1]) {
+ optarg = (char *)argv[optind+1];
+ optind += 2;
+ } else {
+ /* Missing argument */
+ optind++;
+ return (optstring[0] == ':')
+ ? ':' : '?';
+ }
+ }
+ return opt;
+ } else {
+ /* Non-argument-taking option */
+ /* pvt.optptr will remember the exact position to
+ resume at */
+ if (!*pvt.optptr)
+ optind++;
+ return opt;
+ }
+ } else {
+ /* Unknown option */
+ optopt = opt;
+ if (!*pvt.optptr)
+ optind++;
+ return '?';
+ }
+}
diff --git a/com32/lib/libpng/ANNOUNCE b/com32/lib/libpng/ANNOUNCE
index e40b94a0..b0824ee7 100644
--- a/com32/lib/libpng/ANNOUNCE
+++ b/com32/lib/libpng/ANNOUNCE
@@ -1,32 +1,57 @@
-Libpng 1.2.8 - December 3, 2004
+Libpng 1.2.44 - June 26, 2010
This is a public release of libpng, intended for use in production codes.
-Changes since the last public release (1.2.7):
-
- Fixed bug in png_text_compress() that would fail to complete a large block.
- Fixed bug, introduced in libpng-1.2.7, that overruns a buffer during
- strip alpha operation in png_do_strip_filler().
- Added PNG_1_2_X definition in pngconf.h
- #ifdef out png_info_init in png.c and png_read_init in pngread.c (as of 1.3.0)
- Reduce color_type to a nonalpha type after strip alpha operation in
- png_do_strip_filler().
- Revised definitions of PNG_MAX_UINT_32, PNG_MAX_SIZE, and PNG_MAXSUM
- Fixed (again) definition of PNG_LIBPNG_VER_DLLNUM in png.h (Cosmin).
- Added PNG_LIBPNG_BUILD_PRIVATE in png.h (Cosmin).
- Set png_ptr->zstream.data_type to Z_BINARY, to avoid unnecessary detection
- of data type in deflate (Cosmin).
- Deprecated but continue to support SPECIALBUILD and PRIVATEBUILD in favor of
- PNG_LIBPNG_BUILD_SPECIAL_STRING and PNG_LIBPNG_BUILD_PRIVATE_STRING.
- Despammed mailing addresses by masking "@" with "at".
- Added scripts/makefile.elf with supporting code in pngconf.h for symbol
- versioning (John Bowler).
- Added projects/visualc71 (Simon-pierre).
-
-Send comments/corrections/commendations to
-png-implement at ccrc.wustl.edu (subscription required; write to
-majordomo at ccrc.wustl.edu with "subscribe png-implement" in the message)
-or to glennrp at users.sourceforge.net
+Files available for download:
+
+Source files with LF line endings (for Unix/Linux) and with a
+"configure" script
+
+ libpng-1.2.44.tar.xz (LZMA-compressed, recommended)
+ libpng-1.2.44.tar.gz
+ libpng-1.2.44.tar.bz2
+
+Source files with LF line endings (for Unix/Linux) without the
+"configure" script
+
+ libpng-1.2.44-no-config.tar.xz (LZMA-compressed, recommended)
+ libpng-1.2.44-no-config.tar.gz
+ libpng-1.2.44-no-config.tar.bz2
+
+Source files with CRLF line endings (for Windows), without the
+"configure" script
+
+ lpng1244.zip
+ lpng1244.7z
+ lpng1244.tar.bz2
+
+Project files
+
+ libpng-1.2.44-project-netware.zip
+ libpng-1.2.44-project-wince.zip
+
+Other information:
+
+ libpng-1.2.44-README.txt
+ libpng-1.2.44-KNOWNBUGS.txt
+ libpng-1.2.44-LICENSE.txt
+ libpng-1.2.44-Y2K-compliance.txt
+ libpng-1.2.44-[previous version]-diff.txt
+
+Changes since the last public release (1.2.43):
+
+version 1.2.44 [June 26, 2010]
+
+ Rewrote png_process_IDAT_data to consistently treat extra data as warnings
+ and handle end conditions more cleanly.
+ Removed the now-redundant check for out-of-bounds new_row from example.c
+
+
+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
diff --git a/com32/lib/libpng/CHANGES b/com32/lib/libpng/CHANGES
index 46f43dc9..90a3e2be 100644
--- a/com32/lib/libpng/CHANGES
+++ b/com32/lib/libpng/CHANGES
@@ -1,4 +1,4 @@
-
+/*
CHANGES - changes for libpng
version 0.2
@@ -10,7 +10,7 @@ version 0.3
split up pngwrite.c to several files
added pnglib.txt
added example.c
- cleaned up writer, adding a few new tranformations
+ cleaned up writer, adding a few new transformations
fixed some bugs in writer
interfaced with zlib 0.5
added K&R support
@@ -22,7 +22,7 @@ version 0.4
created png_color_16 and png_color_8 to handle color needs
cleaned up color type defines
fixed various bugs
- made various names more consistant
+ 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
@@ -151,7 +151,7 @@ version 0.95 [March, 1997]
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 neccesarily a good idea)
+ 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)
@@ -172,7 +172,7 @@ version 0.95 [March, 1997]
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 infomation in info_ptr. This isolates
+ 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).
@@ -522,9 +522,9 @@ version 1.0.5b [November 23, 1999]
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 accomodate ansi2knr.
+ 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
- accomodate making DLL's: Moved usr_png_ver from global variable to function
+ 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
@@ -539,7 +539,8 @@ version 1.0.5d [November 29, 1999]
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".
- #ifdef out all the new declarations when PNG_USE_GLOBAL_ARRAYS is defined.
+ Remove all the new declarations with #ifdef/#endif 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
@@ -1300,7 +1301,7 @@ version 1.2.6beta4 [July 28, 2004]
Added PNG_NO_SEQUENTIAL_READ_SUPPORTED macro to conditionally remove
sequential read support.
Added some "#if PNG_WRITE_SUPPORTED" blocks.
- #ifdef'ed out some redundancy in png_malloc_default().
+ Removed some redundancy with #ifdef/#endif in png_malloc_default().
Use png_malloc instead of png_zalloc to allocate the pallete.
version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
Fixed buffer overflow vulnerability in png_handle_tRNS()
@@ -1345,7 +1346,7 @@ version 1.0.16rc5 and 1.2.6rc5 [August 10, 2004]
Moved "PNG_HANDLE_CHUNK_*" macros out of PNG_ASSEMBLER_CODE_SUPPORTED
section of png.h where they were inadvertently placed in version rc3.
-version 1.0.16 and 1.2.6 [August 15, 2004]
+version 1.2.6 and 1.0.16 [August 15, 2004]
Revised pngtest so memory allocation testing is only done when PNG_DEBUG==1.
version 1.2.7beta1 [August 26, 2004]
Removed unused pngasmrd.h file.
@@ -1361,7 +1362,8 @@ version 1.2.7beta2 [August 28, 2004]
Added png_set_add_alpha() that updates color type.
version 1.0.17rc1 and 1.2.7rc1 [September 4, 2004]
Revised png_set_strip_filler() to not remove alpha if color_type has alpha.
-version 1.0.17 and 1.2.7 [September 12, 2004]
+
+version 1.2.7 and 1.0.17 [September 12, 2004]
Added makefile.hp64
Changed projects/msvc/png32ms.def to scripts/png32ms.def in makefile.cygwin
version 1.2.8beta1 [November 1, 2004]
@@ -1369,7 +1371,8 @@ version 1.2.8beta1 [November 1, 2004]
Fixed bug, introduced in libpng-1.2.7, that overruns a buffer during
strip alpha operation in png_do_strip_filler().
Added PNG_1_2_X definition in pngconf.h
- #ifdef out png_info_init in png.c and png_read_init in pngread.c (as of 1.3.0)
+ Comment out with #ifdef/#endif png_info_init in png.c and png_read_init
+ in pngread.c (as of 1.3.0)
version 1.2.8beta2 [November 2, 2004]
Reduce color_type to a nonalpha type after strip alpha operation in
png_do_strip_filler().
@@ -1408,12 +1411,1304 @@ version 1.2.8rc4 [November 29, 2004]
Added projects/visualc7 (Simon-pierre).
version 1.2.8rc5 [November 29, 2004]
Fixed new typo in scripts/pngw32.rc
+
version 1.2.8 [December 3, 2004]
Removed projects/visualc7, added projects/visualc71.
-Send comments/corrections/commendations to
-png-implement at ccrc.wustl.edu (subscription required; write to
-majordomo at ccrc.wustl.edu with "subscribe png-implement" in the message)
+version 1.2.9beta1 [February 21, 2006]
+
+ Initialized some structure members in pngwutil.c to avoid gcc-4.0.0 complaints
+ Revised man page and libpng.txt to make it clear that one should not call
+ png_read_end or png_write_end after png_read_png or png_write_png.
+ Updated references to png-mng-implement mailing list.
+ Fixed an incorrect typecast in pngrutil.c
+ Added PNG_NO_READ_SUPPORTED conditional for making a write-only library.
+ Added PNG_NO_WRITE_INTERLACING_SUPPORTED conditional.
+ Optimized alpha-inversion loops in pngwtran.c
+ Moved test for nonzero gamma outside of png_build_gamma_table() in pngrtran.c
+ Make sure num_trans is <= 256 before copying data in png_set_tRNS().
+ Make sure num_palette is <= 256 before copying data in png_set_PLTE().
+ Interchanged order of write_swap_alpha and write_invert_alpha transforms.
+ Added parentheses in the definition of PNG_LIBPNG_BUILD_TYPE (Cosmin).
+ Optimized zlib window flag (CINFO) in contrib/pngsuite/*.png (Cosmin).
+ Updated scripts/makefile.bc32 for Borland C++ 5.6 (Cosmin).
+ Exported png_get_uint_32, png_save_uint_32, png_get_uint_16, png_save_uint_16,
+ png_get_int_32, png_save_int_32, png_get_uint_31 (Cosmin).
+ Added type cast (png_byte) in png_write_sCAL() (Cosmin).
+ Fixed scripts/makefile.cygwin (Christian Biesinger, Cosmin).
+ Default iTXt support was inadvertently enabled.
+
+version 1.2.9beta2 [February 21, 2006]
+
+ Check for png_rgb_to_gray and png_gray_to_rgb read transformations before
+ checking for png_read_dither in pngrtran.c
+ Revised checking of chromaticity limits to accommodate extended RGB
+ colorspace (John Denker).
+ Changed line endings in some of the project files to CRLF, even in the
+ "Unix" tar distributions (Cosmin).
+ Made png_get_int_32 and png_save_int_32 always available (Cosmin).
+ Updated scripts/pngos2.def, scripts/pngw32.def and projects/wince/png32ce.def
+ with the newly exported functions.
+ Eliminated distributions without the "configure" script.
+ Updated INSTALL instructions.
+
+version 1.2.9beta3 [February 24, 2006]
+
+ Fixed CRCRLF line endings in contrib/visupng/VisualPng.dsp
+ Made libpng.pc respect EXEC_PREFIX (D. P. Kreil, J. Bowler)
+ Removed reference to pngasmrd.h from Makefile.am
+ Renamed CHANGES to ChangeLog.
+ Renamed LICENSE to COPYING.
+ Renamed ANNOUNCE to NEWS.
+ Created AUTHORS file.
+
+version 1.2.9beta4 [March 3, 2006]
+
+ Changed definition of PKGCONFIG from $prefix/lib to $libdir in configure.ac
+ Reverted to filenames LICENSE and ANNOUNCE; removed AUTHORS and COPYING.
+ Removed newline from the end of some error and warning messages.
+ Removed test for sqrt() from configure.ac and configure.
+ Made swap tables in pngtrans.c PNG_CONST (Carlo Bramix).
+ Disabled default iTXt support that was inadvertently enabled in
+ libpng-1.2.9beta1.
+ Added "OS2" to list of systems that don't need underscores, in pnggccrd.c
+ Removed libpng version and date from *.c files.
+
+version 1.2.9beta5 [March 4, 2006]
+ Removed trailing blanks from source files.
+ Put version and date of latest change in each source file, and changed
+ copyright year accordingly.
+ More cleanup of configure.ac, Makefile.ac, and associated scripts.
+ Restored scripts/makefile.elf which was inadvertently deleted.
+
+version 1.2.9beta6 [March 6, 2006]
+ Fixed typo (RELEASE) in configuration files.
+
+version 1.2.9beta7 [March 7, 2006]
+ Removed libpng.vers and libpng.sym from libpng12_la_SOURCES in Makefile.am
+ Fixed inconsistent #ifdef's around png_sig_bytes() and png_set_sCAL_s()
+ in png.h.
+ Updated makefile.elf as suggested by debian.
+ Made cosmetic changes to some makefiles, adding LN_SF and other macros.
+ Made some makefiles accept "exec_prefix".
+
+version 1.2.9beta8 [March 9, 2006]
+ Fixed some "#if defined (..." which should be "#if defined(..."
+ Bug introduced in libpng-1.2.8.
+ Fixed inconsistency in definition of png_default_read_data()
+ Restored blank that was lost from makefile.sggcc "clean" target in beta7.
+ Revised calculation of "current" and "major" for irix in ltmain.sh
+ Changed "mkdir" to "MKDIR_P" in some makefiles.
+ Separated PNG_EXPAND and PNG_EXPAND_tRNS.
+ Added png_set_expand_gray_1_2_4_to_8() and deprecated
+ png_set_gray_1_2_4_to_8() which also expands tRNS to alpha.
+
+version 1.2.9beta9 [March 10, 2006]
+ Include "config.h" in pngconf.h when available.
+ Added some checks for NULL png_ptr or NULL info_ptr (timeless)
+
+version 1.2.9beta10 [March 20, 2006]
+ Removed extra CR from contrib/visualpng/VisualPng.dsw (Cosmin)
+ Made pnggccrd.c PIC-compliant (Christian Aichinger).
+ Added makefile.mingw (Wolfgang Glas).
+ Revised pngconf.h MMX checking.
+
+version 1.2.9beta11 [March 22, 2006]
+ Fixed out-of-order declaration in pngwrite.c that was introduced in beta9
+ Simplified some makefiles by using LIBSO, LIBSOMAJ, and LIBSOVER macros.
+
+version 1.2.9rc1 [March 31, 2006]
+ Defined PNG_USER_PRIVATEBUILD when including "pngusr.h" (Cosmin).
+ Removed nonsensical assertion check from pngtest.c (Cosmin).
+
+version 1.2.9 [April 14, 2006]
+ Revised makefile.beos and added "none" selector in ltmain.sh
+
+version 1.2.10beta1 [April 15, 2006]
+ Renamed "config.h" to "png_conf.h" and revised Makefile.am to add
+ -DPNG_BUILDING_LIBPNG to compile directive, and modified pngconf.h
+ to include png_conf.h only when PNG_BUILDING_LIBPNG is defined.
+
+version 1.2.10beta2 [April 15, 2006]
+ Manually updated Makefile.in and configure. Changed png_conf.h.in
+ back to config.h.
+
+version 1.2.10beta3 [April 15, 2006]
+ Change png_conf.h back to config.h in pngconf.h.
+
+version 1.2.10beta4 [April 16, 2006]
+ Change PNG_BUILDING_LIBPNG to PNG_CONFIGURE_LIBPNG in config/Makefile*.
+
+version 1.2.10beta5 [April 16, 2006]
+ Added a configure check for compiling assembler code in pnggccrd.c
+
+version 1.2.10beta6 [April 17, 2006]
+ Revised the configure check for pnggccrd.c
+ Moved -DPNG_CONFIGURE_LIBPNG into @LIBPNG_DEFINES@
+ Added @LIBPNG_DEFINES@ to arguments when building libpng.sym
+
+version 1.2.10beta7 [April 18, 2006]
+ Change "exec_prefix=$prefix" to "exec_prefix=$(prefix)" in makefiles.
+
+version 1.2.10rc1 [April 19, 2006]
+ Ensure pngconf.h doesn't define both PNG_USE_PNGGCCRD and PNG_USE_PNGVCRD
+ Fixed "LN_FS" typo in makefile.sco and makefile.solaris.
+
+version 1.2.10rc2 [April 20, 2006]
+ Added a backslash between -DPNG_CONFIGURE_LIBPNG and -DPNG_NO_ASSEMBLER_CODE
+ in configure.ac and configure
+ Made the configure warning about versioned symbols less arrogant.
+
+version 1.2.10rc3 [April 21, 2006]
+ Added a note in libpng.txt that png_set_sig_bytes(8) can be used when
+ writing an embedded PNG without the 8-byte signature.
+ Revised makefiles and configure to avoid making links to libpng.so.*
+
+version 1.2.10 [April 23, 2006]
+ Reverted configure to "rc2" state.
+
+version 1.2.11beta1 [May 31, 2006]
+ scripts/libpng.pc.in contained "configure" style version info and would
+ not work with makefiles.
+ The shared-library makefiles were linking to libpng.so.0 instead of
+ libpng.so.3 compatibility as the library.
+
+version 1.2.11beta2 [June 2, 2006]
+ Increased sprintf buffer from 50 to 52 chars in pngrutil.c to avoid
+ buffer overflow.
+ Fixed bug in example.c (png_set_palette_rgb -> png_set_palette_to_rgb)
+
+version 1.2.11beta3 [June 5, 2006]
+ Prepended "#! /bin/sh" to ltmail.sh and contrib/pngminus/*.sh (Cosmin).
+ Removed the accidental leftover Makefile.in~ (Cosmin).
+ Avoided potential buffer overflow and optimized buffer in
+ png_write_sCAL(), png_write_sCAL_s() (Cosmin).
+ Removed the include directories and libraries from CFLAGS and LDFLAGS
+ in scripts/makefile.gcc (Nelson A. de Oliveira, Cosmin).
+
+version 1.2.11beta4 [June 6, 2006]
+ Allow zero-length IDAT chunks after the entire zlib datastream, but not
+ after another intervening chunk type.
+
+version 1.0.19rc1, 1.2.11rc1 [June 13, 2006]
+ Deleted extraneous square brackets from [config.h] in configure.ac
+
+version 1.0.19rc2, 1.2.11rc2 [June 14, 2006]
+ Added prototypes for PNG_INCH_CONVERSIONS functions to png.h
+ Revised INSTALL and autogen.sh
+ Fixed typo in several makefiles (-W1 should be -Wl)
+ Added typedef for png_int_32 and png_uint_32 on 64-bit systems.
+
+version 1.0.19rc3, 1.2.11rc3 [June 15, 2006]
+ Removed the new typedefs for 64-bit systems (delay until version 1.4.0)
+ Added one zero element to png_gamma_shift[] array in pngrtran.c to avoid
+ reading out of bounds.
+
+version 1.0.19rc4, 1.2.11rc4 [June 15, 2006]
+ Really removed the new typedefs for 64-bit systems.
+
+version 1.0.19rc5, 1.2.11rc5 [June 22, 2006]
+ Removed png_sig_bytes entry from scripts/pngw32.def
+
+version 1.0.19, 1.2.11 [June 26, 2006]
+ None.
+
+version 1.0.20, 1.2.12 [June 27, 2006]
+ Really increased sprintf buffer from 50 to 52 chars in pngrutil.c to avoid
+ buffer overflow.
+
+version 1.2.13beta1 [October 2, 2006]
+ Removed AC_FUNC_MALLOC from configure.ac
+ Work around Intel-Mac compiler bug by setting PNG_NO_MMX_CODE in pngconf.h
+ Change "logical" to "bitwise" throughout documentation.
+ Detect and fix attempt to write wrong iCCP profile length.
+
+version 1.0.21, 1.2.13 [November 14, 2006]
+ Fix potential buffer overflow in sPLT chunk handler.
+ Fix Makefile.am to not try to link to noexistent files.
+ Check all exported functions for NULL png_ptr.
+
+version 1.2.14beta1 [November 17, 2006]
+ Relocated three misplaced tests for NULL png_ptr.
+ Built Makefile.in with automake-1.9.6 instead of 1.9.2.
+ Build configure with autoconf-2.60 instead of 2.59
+
+version 1.2.14beta2 [November 17, 2006]
+ Added some typecasts in png_zalloc().
+
+version 1.2.14rc1 [November 20, 2006]
+ Changed "strtod" to "png_strtod" in pngrutil.c
+
+version 1.0.22, 1.2.14 [November 27, 2006]
+ Added missing "$(srcdir)" in Makefile.am and Makefile.in
+
+version 1.2.15beta1 [December 3, 2006]
+ Ge