Better commenting on methods

This commit is contained in:
Michelle Bergeron
2014-10-23 01:16:35 -04:00
parent affcb84d36
commit d9f55e9c8f
10 changed files with 63 additions and 2 deletions
+11
View File
@@ -8,6 +8,7 @@ void BbInitializeWrappedBuffer(PBYTE_BUFFER buff, char* data, int offset, int le
buff->byteOrder = byteOrder;
}
/* Get the long long in the correct byte order */
static long long byteSwapLongLong(PBYTE_BUFFER buff, long long l) {
if (buff->byteOrder == BYTE_ORDER_BIG) {
return HTONLL(l);
@@ -17,6 +18,7 @@ static long long byteSwapLongLong(PBYTE_BUFFER buff, long long l) {
}
}
/* Get the int in the correct byte order */
static int byteSwapInt(PBYTE_BUFFER buff, int i) {
if (buff->byteOrder == BYTE_ORDER_BIG) {
return htonl(i);
@@ -26,6 +28,7 @@ static int byteSwapInt(PBYTE_BUFFER buff, int i) {
}
}
/* Get the short in the correct byte order */
static int byteSwapShort(PBYTE_BUFFER buff, short s) {
if (buff->byteOrder == BYTE_ORDER_BIG) {
return htons(s);
@@ -35,6 +38,7 @@ static int byteSwapShort(PBYTE_BUFFER buff, short s) {
}
}
/* Get a byte from the byte buffer */
int BbGet(PBYTE_BUFFER buff, char *c) {
if (buff->position + sizeof(*c) > buff->length) {
return 0;
@@ -46,6 +50,7 @@ int BbGet(PBYTE_BUFFER buff, char *c) {
return 1;
}
/* Get a short from the byte buffer */
int BbGetShort(PBYTE_BUFFER buff, short *s) {
if (buff->position + sizeof(*s) >= buff->length) {
return 0;
@@ -59,6 +64,7 @@ int BbGetShort(PBYTE_BUFFER buff, short *s) {
return 1;
}
/* Get an int from the byte buffer */
int BbGetInt(PBYTE_BUFFER buff, int *i) {
if (buff->position + sizeof(*i) > buff->length) {
return 0;
@@ -72,6 +78,7 @@ int BbGetInt(PBYTE_BUFFER buff, int *i) {
return 1;
}
/* Get a long from the byte buffer */
int BbGetLong(PBYTE_BUFFER buff, long long *l) {
if (buff->position + sizeof(*l) > buff->length) {
return 0;
@@ -85,6 +92,7 @@ int BbGetLong(PBYTE_BUFFER buff, long long *l) {
return 1;
}
/* Put an int into the byte buffer */
int BbPutInt(PBYTE_BUFFER buff, int i) {
if (buff->position + sizeof(i) > buff->length) {
return 0;
@@ -98,6 +106,7 @@ int BbPutInt(PBYTE_BUFFER buff, int i) {
return 1;
}
/* Put a long into the byte buffer */
int BbPutLong(PBYTE_BUFFER buff, long long l) {
if (buff->position + sizeof(l) > buff->length) {
return 0;
@@ -111,6 +120,7 @@ int BbPutLong(PBYTE_BUFFER buff, long long l) {
return 1;
}
/* Put a short into the byte buffer */
int BbPutShort(PBYTE_BUFFER buff, short s) {
if (buff->position + sizeof(s) > buff->length) {
return 0;
@@ -124,6 +134,7 @@ int BbPutShort(PBYTE_BUFFER buff, short s) {
return 1;
}
/* Put a byte into the buffer */
int BbPut(PBYTE_BUFFER buff, char c) {
if (buff->position + sizeof(c) > buff->length) {
return 0;