mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Tidy use of sized datatypes. Check for invalid asumption of interchangability
of int/long in encoder/decoder methods. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22291 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7d11eb6607
commit
bb1ce663a4
19 changed files with 283 additions and 285 deletions
|
@ -93,7 +93,7 @@
|
|||
/*
|
||||
* Largest chunk of data possible in DO
|
||||
*/
|
||||
static gsu32 maxDataLength = 32 * 1024 * 1024;
|
||||
static uint32_t maxDataLength = 32 * 1024 * 1024;
|
||||
|
||||
#if 0
|
||||
#define M_LOCK(X) {NSDebugMLLog(@"NSMessagePort",@"lock %@",X); [X lock];}
|
||||
|
@ -121,8 +121,8 @@ typedef enum {
|
|||
* Its contents are transmitted in network byte order.
|
||||
*/
|
||||
typedef struct {
|
||||
gsu32 type; /* A GSPortItemType as a 4-byte number. */
|
||||
gsu32 length; /* The length of the item (excluding header). */
|
||||
uint32_t type; /* A GSPortItemType as a 4-byte number. */
|
||||
uint32_t length; /* The length of the item (excluding header). */
|
||||
} GSPortItemHeader;
|
||||
|
||||
/*
|
||||
|
@ -132,8 +132,8 @@ typedef struct {
|
|||
* NB. additional data counts as part of the same item.
|
||||
*/
|
||||
typedef struct {
|
||||
gsu32 mId; /* The ID for the message starting with this. */
|
||||
gsu32 nItems; /* Number of items (including this one). */
|
||||
uint32_t mId; /* The ID for the message starting with this. */
|
||||
uint32_t nItems; /* Number of items (including this one). */
|
||||
} GSPortMsgHeader;
|
||||
|
||||
typedef struct {
|
||||
|
@ -237,11 +237,11 @@ typedef enum {
|
|||
unsigned wLength; /* Ammount written so far. */
|
||||
NSMutableArray *wMsgs; /* Message in progress. */
|
||||
NSMutableData *rData; /* Buffer for incoming data */
|
||||
gsu32 rLength; /* Amount read so far. */
|
||||
gsu32 rWant; /* Amount desired. */
|
||||
uint32_t rLength; /* Amount read so far. */
|
||||
uint32_t rWant; /* Amount desired. */
|
||||
NSMutableArray *rItems; /* Message in progress. */
|
||||
GSPortItemType rType; /* Type of data being read. */
|
||||
gsu32 rId; /* Id of incoming message. */
|
||||
uint32_t rId; /* Id of incoming message. */
|
||||
unsigned nItems; /* Number of items to be read. */
|
||||
GSHandleState state; /* State of the handle. */
|
||||
unsigned int addrNum; /* Address number within host. */
|
||||
|
@ -1164,17 +1164,10 @@ typedef struct {
|
|||
#define lDesc ((internal*)_internal)->_listener
|
||||
|
||||
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
static unsigned wordAlign;
|
||||
#endif
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSMessagePort class])
|
||||
{
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
wordAlign = objc_alignof_type(@encode(gsu32));
|
||||
#endif
|
||||
messagePortClass = self;
|
||||
messagePortMap = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||
|
@ -1862,7 +1855,7 @@ static unsigned wordAlign;
|
|||
* word boundary, so we work with an aligned buffer
|
||||
* and use memcmpy()
|
||||
*/
|
||||
if ((hLength % wordAlign) != 0)
|
||||
if ((hLength % __alignof__(uint32_t)) != 0)
|
||||
{
|
||||
GSPortItemHeader itemHeader;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue