Decouple <cstddef>

This commit is contained in:
Martin Natano
2023-04-20 11:21:29 +02:00
parent 093675cdc3
commit 78fb2e9fc3
171 changed files with 2012 additions and 1786 deletions
+11 -10
View File
@@ -1,6 +1,7 @@
#include "global.h"
#include <stdio.h>
#include <cstddef>
#include <cstdio>
#if defined(_WINDOWS)
#include <tchar.h>
@@ -144,7 +145,7 @@ typedef char TCHAR;
typedef unsigned char uch; // unsigned 8-bit value
typedef unsigned short ush; // unsigned 16-bit value
typedef unsigned long ulg; // unsigned 32-bit value
typedef size_t extent; // file size
typedef std::size_t extent; // file size
typedef unsigned Pos; // must be at least 32 bits
typedef unsigned IPos; // A Pos is an index in the character window. Pos is used only for parameter passing
@@ -347,7 +348,7 @@ typedef struct iztimes {
typedef struct zlist {
ush vem, ver, flg, how; // See central header in zipfile.c for what vem..off are
ulg tim, crc, siz, len;
size_t nam, ext, cext, com; // offset of ext must be >= LOCHEAD
std::size_t nam, ext, cext, com; // offset of ext must be >= LOCHEAD
ush dsk, att, lflg; // offset of lflg must be >= LOCHEAD
ulg atx, off;
char name[MAX_PATH]; // File name in zip file
@@ -400,12 +401,12 @@ int putlocal(struct zlist *z, WRITEFUNC wfunc,void *param)
PUTLG(z->len, f);
PUTSH(z->nam, f);
PUTSH(z->ext, f);
size_t res = (size_t)wfunc(param, z->iname, (unsigned int)z->nam);
std::size_t res = (std::size_t)wfunc(param, z->iname, (unsigned int)z->nam);
if (res!=z->nam)
return ZE_TEMP;
if (z->ext)
{
res = (size_t)wfunc(param, z->extra, (unsigned int)z->ext);
res = (std::size_t)wfunc(param, z->extra, (unsigned int)z->ext);
if (res!=z->ext)
return ZE_TEMP;
}
@@ -441,15 +442,15 @@ int putcentral(struct zlist *z, WRITEFUNC wfunc, void *param)
PUTSH(z->att, f);
PUTLG(z->atx, f);
PUTLG(z->off, f);
if ((size_t)wfunc(param, z->iname, (unsigned int)z->nam) != z->nam ||
(z->cext && (size_t)wfunc(param, z->cextra, (unsigned int)z->cext) != z->cext) ||
(z->com && (size_t)wfunc(param, z->comment, (unsigned int)z->com) != z->com))
if ((std::size_t)wfunc(param, z->iname, (unsigned int)z->nam) != z->nam ||
(z->cext && (std::size_t)wfunc(param, z->cextra, (unsigned int)z->cext) != z->cext) ||
(z->com && (std::size_t)wfunc(param, z->comment, (unsigned int)z->com) != z->com))
return ZE_TEMP;
return ZE_OK;
}
int putend(int n, ulg s, ulg c, size_t m, char *z, WRITEFUNC wfunc, void *param)
int putend(int n, ulg s, ulg c, std::size_t m, char *z, WRITEFUNC wfunc, void *param)
{
// write the end of the central-directory-data to file *f.
PUTLG(ENDSIG, f);
@@ -530,7 +531,7 @@ const ulg crc_table[256] = {
#define DO4(buf) DO2(buf); DO2(buf)
#define DO8(buf) DO4(buf); DO4(buf)
ulg crc32(ulg crc, const uch *buf, size_t len)
ulg crc32(ulg crc, const uch *buf, std::size_t len)
{
if (buf== nullptr) return 0L;
crc = crc ^ 0xffffffffL;