| 1814 | return err; |
| 1815 | } |
| 1816 | int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) |
| 1817 | { |
| 1818 | int err = ZIP_OK; |
| 1819 | |
| 1820 | /*signature*/ |
| 1821 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ENDHEADERMAGIC,4); |
| 1822 | |
| 1823 | if (err==ZIP_OK) /* number of this disk */ |
| 1824 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2); |
| 1825 | |
| 1826 | if (err==ZIP_OK) /* number of the disk with the start of the central directory */ |
| 1827 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2); |
| 1828 | |
| 1829 | if (err==ZIP_OK) /* total number of entries in the central dir on this disk */ |
| 1830 | { |
| 1831 | { |
| 1832 | if(zi->number_entry >= 0xFFFF) |
| 1833 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0xffff,2); // use value in ZIP64 record |
| 1834 | else |
| 1835 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2); |
| 1836 | } |
| 1837 | } |
| 1838 | |
| 1839 | if (err==ZIP_OK) /* total number of entries in the central dir */ |
| 1840 | { |
| 1841 | if(zi->number_entry >= 0xFFFF) |
| 1842 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0xffff,2); // use value in ZIP64 record |
| 1843 | else |
| 1844 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2); |
| 1845 | } |
| 1846 | |
| 1847 | if (err==ZIP_OK) /* size of the central directory */ |
| 1848 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_centraldir,4); |
| 1849 | |
| 1850 | if (err==ZIP_OK) /* offset of start of central directory with respect to the starting disk number */ |
| 1851 | { |
| 1852 | ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writing_offset; |
| 1853 | if(pos >= 0xffffffff) |
| 1854 | { |
| 1855 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)0xffffffff,4); |
| 1856 | } |
| 1857 | else |
| 1858 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)(centraldir_pos_inzip - zi->add_position_when_writing_offset),4); |
| 1859 | } |
| 1860 | |
| 1861 | return err; |
| 1862 | } |
| 1863 | |
| 1864 | int Write_GlobalComment(zip64_internal* zi, const char* global_comment) |
| 1865 | { |
no test coverage detected