Fix compiler signedness warnings

This commit is contained in:
Mr-Dave
2024-07-21 15:09:45 -06:00
parent 0da6af0bf5
commit 5f71dbadc6
32 changed files with 405 additions and 333 deletions

View File

@@ -119,6 +119,25 @@ void myunquote(std::string &parm)
}
void mymemset(void *dst, int src, int sz)
{
memset(dst, src, (ulong)sz);
}
void mymemset(void *dst, int src, ulong sz)
{
memset(dst, src, sz);
}
void mymemcpy(void *dst, void *src, int sz)
{
memcpy(dst, src, (ulong)sz);
}
void mymemcpy(void *dst, void *src, ulong sz)
{
memcpy(dst, src, sz);
}
/* Free memory and set the pointer to NULL*/
void myfree(void *ptr_addr) {
@@ -130,6 +149,36 @@ void myfree(void *ptr_addr) {
}
}
/** mymalloc */
void *mymalloc(int nbytes)
{
void *dummy = calloc((size_t)nbytes, 1);
if (!dummy) {
MOTPLS_LOG(EMG, TYPE_ALL, SHOW_ERRNO
, _("Could not allocate %d bytes of memory!")
, nbytes);
exit(1);
}
return dummy;
}
/** mymalloc */
void *mymalloc(uint nbytes)
{
void *dummy = calloc((size_t)nbytes, 1);
if (!dummy) {
MOTPLS_LOG(EMG, TYPE_ALL, SHOW_ERRNO
, _("Could not allocate %llu bytes of memory!")
, (unsigned long long)nbytes);
exit(1);
}
return dummy;
}
/** mymalloc */
void *mymalloc(size_t nbytes)
{
@@ -282,7 +331,7 @@ static void mystrftime_long (const ctx_dev *cam,
int width, const char *word, int l, char *out)
{
#define SPECIFIERWORD(k) ((strlen(k)==l) && (!strncmp (k, word, l)))
#define SPECIFIERWORD(k) ((strlen(k)==(uint)l) && (!strncmp(k, word, (uint)l)))
if (SPECIFIERWORD("host")) {
snprintf (out, PATH_MAX, "%*s", width, cam->hostname);