Commits (3)
......@@ -3,7 +3,6 @@
#include "gen_defs.h"
#include "fidodefs.h"
#include "xpendian.h" /* swap */
#include "dirwrap.h" /* _PATH_DEVNULL */
#include <stdio.h>
#include <string.h>
......
......@@ -381,11 +381,11 @@ void sbbs_t::qwk_sec()
int s;
uint i;
ulong msgcnt;
ulong *sav_ptr;
uint32_t* sav_ptr;
getusrdirs();
if((sav_ptr=(ulong *)malloc(sizeof(ulong)*cfg.total_subs))==NULL) {
errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(ulong)*cfg.total_subs);
if((sav_ptr=(uint32_t *)malloc(sizeof(uint32_t)*cfg.total_subs))==NULL) {
errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(uint32_t)*cfg.total_subs);
return;
}
for(i=0;i<cfg.total_subs;i++)
......
......@@ -158,7 +158,7 @@ int main(int argc, char **argv)
char str[256],tmp[128],tag[256],addr[256],*p;
int i,j,mode=0,cmd=0,o_mode,max_age=0;
ushort smm,sbl;
ulong *crc=NULL,curcrc,total_crcs=0,l;
uint32_t *crc=NULL,curcrc,total_crcs=0,l;
FILE *route,*users,*nodes;
time_t now;
smbmsg_t msg;
......@@ -315,10 +315,10 @@ int main(int argc, char **argv)
break;
if(l==total_crcs) {
total_crcs++;
if((crc=(ulong *)realloc(crc
,sizeof(ulong)*total_crcs))==NULL) {
if((crc=(uint32_t *)realloc(crc
,sizeof(uint32_t)*total_crcs))==NULL) {
printf("Error allocating %lu bytes\n"
,sizeof(ulong)*total_crcs);
,sizeof(uint32_t)*total_crcs);
break;
}
crc[l]=curcrc;
......
......@@ -2367,7 +2367,7 @@ int attachment(const char *bundlename, fidoaddr_t dest, enum attachment_mode mod
char str[MAX_PATH+1],*path,*p;
char bundle_list_filename[MAX_PATH+1];
int fmsg,file,error=0L;
long fncrc,*mfncrc=0L,num_mfncrc=0L,crcidx;
uint32_t fncrc,*mfncrc=0L,num_mfncrc=0L,crcidx;
attach_t attach;
fmsghdr_t hdr;
size_t f;
......@@ -2432,9 +2432,9 @@ int attachment(const char *bundlename, fidoaddr_t dest, enum attachment_mode mod
continue;
num_mfncrc++;
p=getfname(hdr.subj);
if((mfncrc=(long *)realloc(mfncrc,num_mfncrc*sizeof(long)))==NULL) {
if((mfncrc=(uint32_t *)realloc(mfncrc,num_mfncrc*sizeof(uint32_t)))==NULL) {
lprintf(LOG_ERR,"ERROR line %d allocating %lu for bundle name crc"
,__LINE__,num_mfncrc*sizeof(long));
,__LINE__,num_mfncrc*sizeof(uint32_t));
continue;
}
mfncrc[num_mfncrc-1]=crc32(strupr(p),0);
......
......@@ -580,7 +580,7 @@ BOOL read_msgs_cfg(scfg_t* cfg, char* error, size_t maxerrlen)
if(k) {
if((cfg->qhub[i]->sub=(sub_t**)malloc(sizeof(sub_t*)*k))==NULL)
return allocerr(instream, error, maxerrlen, offset,fname,sizeof(ulong)*k);
return allocerr(instream, error, maxerrlen, offset,fname,sizeof(sub_t)*k);
if((cfg->qhub[i]->conf=(ushort *)malloc(sizeof(ushort)*k))==NULL)
return allocerr(instream, error, maxerrlen, offset,fname,sizeof(ushort)*k);
if((cfg->qhub[i]->mode=(char *)malloc(sizeof(char)*k))==NULL)
......
/* xpendian.h */
/* Macros to convert integer "endianness" */
/* $Id: xpendian.h,v 1.6 2018/07/24 01:13:10 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -15,41 +11,27 @@
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
#ifndef _XPENDIAN_H
#define _XPENDIAN_H
#include "gen_defs.h"
/************************/
/* byte-swapping macros */
/************************/
#define BYTE_SWAP_16(x) ((((short)(x)&0xff00)>>8) | (((short)(x)&0x00ff)<<8))
#define BYTE_SWAP_32(x) ((((long)(x)&0xff000000)>>24) | (((long)(x)&0x00ff0000)>>8) | (((long)(x)&0x0000ff00)<<8) | (((long)(x)&0x000000ff)<<24))
/* these may need to be updated for > 32-bit platforms */
#define BYTE_SWAP_SHORT(x) BYTE_SWAP_16(x)
#define BYTE_SWAP_LONG(x) BYTE_SWAP_32(x)
#define BYTE_SWAP_16(x) ((((WORD)(x)&0xff00)>>8) | (((WORD)(x)&0x00ff)<<8))
#define BYTE_SWAP_32(x) ((((DWORD)(x)&0xff000000)>>24) | (((DWORD)(x)&0x00ff0000)>>8) | (((DWORD)(x)&0x0000ff00)<<8) | (((DWORD)(x)&0x000000ff)<<24))
/* auto-detect integer size */
#define BYTE_SWAP_INT(x) (sizeof(x)==sizeof(short) ? BYTE_SWAP_SHORT(x) : sizeof(x)==sizeof(long) ? BYTE_SWAP_LONG(x) : (x))
#define BYTE_SWAP_INT(x) (sizeof(x)==2 ? BYTE_SWAP_16(x) : sizeof(x)==4 ? BYTE_SWAP_32(x) : (x))
/********************************/
/* Architecture-specific macros */
......@@ -61,8 +43,8 @@
#define BE_INT16(x) (x)
#define BE_INT32(x) (x)
#define BE_INT(x) (x)
#define LE_SHORT(x) BYTE_SWAP_SHORT(x)
#define LE_LONG(x) BYTE_SWAP_LONG(x)
#define LE_SHORT(x) BYTE_SWAP_16(x)
#define LE_LONG(x) BYTE_SWAP_32(x)
#define LE_INT16(x) BYTE_SWAP_16(x)
#define LE_INT32(x) BYTE_SWAP_32(x)
#define LE_INT(x) BYTE_SWAP_INT(x)
......@@ -74,8 +56,8 @@
#define LE_INT16(x) (x)
#define LE_INT32(x) (x)
#define LE_INT(x) (x)
#define BE_SHORT(x) BYTE_SWAP_SHORT(x)
#define BE_LONG(x) BYTE_SWAP_LONG(x)
#define BE_SHORT(x) BYTE_SWAP_16(x)
#define BE_LONG(x) BYTE_SWAP_32(x)
#define BE_INT16(x) BYTE_SWAP_16(x)
#define BE_INT32(x) BYTE_SWAP_32(x)
#define BE_INT(x) BYTE_SWAP_INT(x)
......