Skip to content

Commit

Permalink
Change u_char data types to the portable uint8_t, GitHub #1589
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmark committed Oct 4, 2024
1 parent d27d7a3 commit 283ed80
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 38 deletions.
10 changes: 5 additions & 5 deletions etc/afpd/acls.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,9 @@ static int posix_acl_rights(const AFPObj *obj,
*
* @returns access rights
*/
static u_char acl_permset_to_uarights(acl_entry_t entry) {
static uint8_t acl_permset_to_uarights(acl_entry_t entry) {
acl_permset_t permset;
u_char rights = 0;
uint8_t rights = 0;

if (acl_get_permset(entry, &permset) == -1)
return rights;
Expand Down Expand Up @@ -589,9 +589,9 @@ static int posix_acls_to_uaperms(const AFPObj *obj, const char *path, struct sta
gid_t *gid;
uid_t whoami = geteuid();

u_char group_rights = 0x00;
u_char acl_rights = 0x00;
u_char mask = 0xff;
uint8_t group_rights = 0x00;
uint8_t acl_rights = 0x00;
uint8_t mask = 0xff;

acl = acl_get_file(path, ACL_TYPE_ACCESS);
if (acl == NULL) {
Expand Down
4 changes: 2 additions & 2 deletions etc/afpd/afp_dsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ void afp_over_dsi(AFPObj *obj)

case DSIFUNC_CMD:

function = (u_char) dsi->commands[0];
function = (uint8_t) dsi->commands[0];

/* AFP replay cache */
rc_idx = dsi->clientID % REPLAYCACHE_SIZE;
Expand Down Expand Up @@ -656,7 +656,7 @@ void afp_over_dsi(AFPObj *obj)
break;

case DSIFUNC_WRITE: /* FPWrite and FPAddIcon */
function = (u_char) dsi->commands[0];
function = (uint8_t) dsi->commands[0];
if ( afp_switch[ function ] != NULL ) {
dsi->datalen = DSI_DATASIZ;
dsi->flags |= DSI_RUNNING;
Expand Down
2 changes: 1 addition & 1 deletion etc/afpd/appl.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static int pathcmp(char *p, int plen, char *q, int qlen)
return (( plen == qlen && memcmp( p, q, plen ) == 0 ) ? 0 : 1 );
}

static int applopen(struct vol *vol, u_char creator[ 4 ], int flags, int mode)
static int applopen(struct vol *vol, uint8_t creator[ 4 ], int flags, int mode)
{
char *dtf, *adt, *adts;

Expand Down
18 changes: 9 additions & 9 deletions etc/afpd/desktop.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,12 @@ int afp_closedt(AFPObj *obj _U_, char *ibuf _U_, size_t ibuflen _U_, char *rbuf

static struct savedt si = { { 0, 0, 0, 0 }, -1, 0, 0 };

static char *icon_dtfile(struct vol *vol, u_char creator[ 4 ])
static char *icon_dtfile(struct vol *vol, uint8_t creator[ 4 ])
{
return dtfile( vol, creator, ".icon" );
}

static int iconopen(struct vol *vol, u_char creator[ 4 ], int flags, int mode)
static int iconopen(struct vol *vol, uint8_t creator[ 4 ], int flags, int mode)
{
char *dtf, *adt, *adts;

Expand Down Expand Up @@ -328,7 +328,7 @@ int afp_addicon(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t
#ifndef NO_DDP
struct iovec iov[2];
#endif
u_char fcreator[4], imh[12], irh[12], * p;
uint8_t fcreator[4], imh[12], irh[12], * p;
int itype, cc = AFP_OK, iovcnt = 0;
size_t buflen;
uint32_t ftype, itag;
Expand Down Expand Up @@ -491,9 +491,9 @@ int afp_addicon(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t
return( AFP_OK );
}

static const u_char utag[] = { 0, 0, 0, 0 };
static const u_char ucreator[] = { 0, 0, 0, 0 };/* { 'U', 'N', 'I', 'X' };*/
static const u_char utype[] = { 0, 0, 0, 0 };/* { 'T', 'E', 'X', 'T' };*/
static const uint8_t utag[] = { 0, 0, 0, 0 };
static const uint8_t ucreator[] = { 0, 0, 0, 0 };/* { 'U', 'N', 'I', 'X' };*/
static const uint8_t utype[] = { 0, 0, 0, 0 };/* { 'T', 'E', 'X', 'T' };*/
static const short usize = 256;


Expand Down Expand Up @@ -573,7 +573,7 @@ int afp_geticon(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t
struct vol *vol;
off_t offset;
ssize_t rc, buflen;
u_char fcreator[ 4 ], ftype[ 4 ], itype, ih[ 12 ];
uint8_t fcreator[ 4 ], ftype[ 4 ], itype, ih[ 12 ];
uint16_t vid, bsize, rsize;

buflen = *rbuflen;
Expand Down Expand Up @@ -705,7 +705,7 @@ int afp_geticon(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t

/* ---------------------- */
static const char hexdig[] = "0123456789abcdef";
char *dtfile(const struct vol *vol, u_char creator[], char *ext )
char *dtfile(const struct vol *vol, uint8_t creator[], char *ext )
{
static char path[ MAXPATHLEN + 1];
char *p;
Expand Down Expand Up @@ -832,7 +832,7 @@ static int ad_addcomment(const AFPObj *obj, struct vol *vol, struct path *path,
int clen;
struct adouble ad, *adp;

clen = (u_char)*ibuf++;
clen = (uint8_t)*ibuf++;
clen = min( clen, 199 );

upath = path->u_name;
Expand Down
4 changes: 2 additions & 2 deletions etc/afpd/desktop.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
#define APPLEDESKTOP ".AppleDesktop"

struct savedt {
u_char sdt_creator[ 4 ];
uint8_t sdt_creator[ 4 ];
int sdt_fd;
int sdt_index;
short sdt_vid;
};

typedef unsigned char CreatorType[4];

extern char *dtfile (const struct vol *, u_char [], char *);
extern char *dtfile (const struct vol *, uint8_t [], char *);
extern char *mtoupath (const struct vol *, char *, cnid_t, int utf8);
extern char *utompath (const struct vol *, char *, cnid_t, int utf8);

Expand Down
2 changes: 1 addition & 1 deletion etc/afpd/directory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,7 @@ int setdirparams(struct vol *vol, struct path *path, uint16_t d_bitmap, char *bu
int change_parent_mdate = 0;
int newdate = 0;
uint16_t bitmap = d_bitmap;
u_char finder_buf[32];
uint8_t finder_buf[32];
uint32_t upriv;
mode_t mpriv = 0;
bool set_upriv = false, set_maccess = false;
Expand Down
8 changes: 4 additions & 4 deletions etc/afpd/directory.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@
#define CNID(a,b) ((a)->st_ino & 0xffffffff)

struct maccess {
u_char ma_user;
u_char ma_world;
u_char ma_group;
u_char ma_owner;
uint8_t ma_user;
uint8_t ma_world;
uint8_t ma_group;
uint8_t ma_owner;
};

#define AR_USEARCH (1<<0)
Expand Down
2 changes: 1 addition & 1 deletion etc/afpd/enumerate.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ static int enumerate(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_,
}

header = (ext)?4:2;
header *=sizeof( u_char );
header *=sizeof( uint8_t );

maxsz = min(maxsz, *rbuflen - REPLY_PARAM_MAXLEN);
o_path = cname( vol, dir, &ibuf );
Expand Down
16 changes: 8 additions & 8 deletions etc/afpd/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@
* putawayID 4 home directory id
*/

const u_char ufinderi[ADEDLEN_FINDERI] = {
const uint8_t ufinderi[ADEDLEN_FINDERI] = {
0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};

static const u_char old_ufinderi[] = {
static const uint8_t old_ufinderi[] = {
'T', 'E', 'X', 'T', 'U', 'N', 'I', 'X'
};

Expand Down Expand Up @@ -279,7 +279,7 @@ int getmetadata(const AFPObj *obj,
uint32_t aint;
cnid_t id = 0;
uint16_t ashort;
u_char achar, fdType[4];
uint8_t achar, fdType[4];
uint32_t utf8 = 0;
struct stat *st;
struct maccess ma;
Expand Down Expand Up @@ -828,8 +828,8 @@ int setfilparams(const AFPObj *obj, struct vol *vol,
int bit, isad = 1, err = AFP_OK;
char *upath;
char *ade = NULL;
u_char achar, xyy[4];
const u_char *fdType = NULL;
uint8_t achar, xyy[4];
const uint8_t *fdType = NULL;
uint16_t ashort = 0;
uint16_t bshort;
uint16_t oshort;
Expand All @@ -845,7 +845,7 @@ int setfilparams(const AFPObj *obj, struct vol *vol,
gid_t f_gid;
uint16_t bitmap = f_bitmap;
uint32_t cdate,bdate;
u_char finder_buf[32];
uint8_t finder_buf[32];
int symlinked = S_ISLNK(path->st.st_mode);
int fp;
ssize_t len;
Expand Down Expand Up @@ -957,10 +957,10 @@ int setfilparams(const AFPObj *obj, struct vol *vol,
buf += 2;
/* Keep special case to support crlf translations */
if ((unsigned int) achar == 0x04) {
fdType = (u_char *)"TEXT";
fdType = (uint8_t *)"TEXT";
buf += 2;
} else {
xyy[0] = ( u_char ) 'p';
xyy[0] = ( uint8_t ) 'p';
xyy[1] = achar;
xyy[3] = *buf++;
xyy[2] = *buf++;
Expand Down
2 changes: 1 addition & 1 deletion etc/afpd/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "directory.h"
#include "volume.h"

extern const u_char ufinderi[];
extern const uint8_t ufinderi[];

#define FILPBIT_ATTR 0
#define FILPBIT_PDID 1
Expand Down
2 changes: 1 addition & 1 deletion etc/afpd/filedir.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ int afp_getfildirparams(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *r
rbuf += sizeof( fbitmap );
dbitmap = htons( dbitmap );
memcpy( rbuf, &dbitmap, sizeof( dbitmap ));
rbuf += sizeof( dbitmap ) + sizeof( u_char );
rbuf += sizeof( dbitmap ) + sizeof( uint8_t );
*rbuf = 0;

return( AFP_OK );
Expand Down
2 changes: 1 addition & 1 deletion etc/afpd/unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void accessmode(const AFPObj *obj, const struct vol *vol, char *path, struct mac
#endif
}

static mode_t mtoubits(u_char bits)
static mode_t mtoubits(uint8_t bits)
{
mode_t mode;

Expand Down
4 changes: 2 additions & 2 deletions libatalk/acl/unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ int posix_chmod(const char *name, mode_t mode) {
acl_entry_t group_entry;
acl_tag_t tag;
acl_t acl;
u_char not_found = (SEARCH_GROUP_OBJ|SEARCH_MASK); /* used as flags */
uint8_t not_found = (SEARCH_GROUP_OBJ|SEARCH_MASK); /* used as flags */

LOG(log_maxdebug, logtype_afpd, "posix_chmod(\"%s\", mode: %04o) BEGIN",
fullpathname(name), mode);
Expand Down Expand Up @@ -417,7 +417,7 @@ int posix_fchmod(int fd, mode_t mode) {
acl_entry_t group_entry;
acl_tag_t tag;
acl_t acl;
u_char not_found = (SEARCH_GROUP_OBJ|SEARCH_MASK); /* used as flags */
uint8_t not_found = (SEARCH_GROUP_OBJ|SEARCH_MASK); /* used as flags */

/* Call chmod() first because there might be some special bits to be set which
* aren't related to access control.
Expand Down

0 comments on commit 283ed80

Please sign in to comment.