Change-Id: I4958028e552cd85fa31ae44f86c6b8129f291914
This commit is contained in:
yudechen
2023-05-27 10:33:53 +08:00
14 changed files with 53 additions and 31 deletions
+4 -3
View File
@@ -13,15 +13,16 @@
* limitations under the License.
*/
#include <stdbool.h>
#include "endian_internal.h"
#define B_L_SWAP16(A) ((((uint16_t)(A) & 0xff00) >> 8) | (((uint16_t)(A) & 0x00ff) << 8))
#define B_L_SWAP32(A) ((((uint32_t)(A) & 0xff000000) >> 24) | (((uint32_t)(A) & 0x00ff0000) >> 8) | \
(((uint32_t)(A) & 0x0000ff00) << 8) | (((uint32_t)(A) & 0x000000ff) << 24))
int32_t CheckEndian(void);
static bool CheckEndian(void);
int32_t CheckEndian(void)
static bool CheckEndian(void)
{
union {
int32_t i;
@@ -29,7 +30,7 @@ int32_t CheckEndian(void)
} c;
c.i = 0x12345678;
return (0x12 == c.s[0]);
return (c.s[0] == 0x12);
}
uint32_t HtonlInter(uint32_t h)
+3 -3
View File
@@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef _ENDIAN_INTERNAL_H
#define _ENDIAN_INTERNAL_H
#ifndef ENDIAN_INTERNAL_H
#define ENDIAN_INTERNAL_H
#include <stdint.h>
@@ -35,4 +35,4 @@ extern uint16_t NtohsInter(uint16_t n);
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _ENDIAN_INTERNAL_H */
#endif /* ENDIAN_INTERNAL_H */
+2 -2
View File
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
char *outputpath = getcwd(curpath, sizeof(curpath));
while (1) {
static struct option long_options[] = {
static struct option longOptions[] = {
{"help", no_argument, 0, 'h' },
{"version", no_argument, 0, 'v' },
{"RPCID", no_argument, 0, 'R' },
@@ -74,7 +74,7 @@ int main(int argc, char **argv)
{0, 0, 0, 0 }
};
int32_t flag = getopt_long(argc, argv, "hvRPC:edsi:o:", long_options, &optIndex);
int32_t flag = getopt_long(argc, argv, "hvRPC:edsi:o:", longOptions, &optIndex);
if (flag == -1) {
break;
}
+2 -2
View File
@@ -335,7 +335,7 @@ FREE_SYSCAP_OUT:
return ret;
}
static int32_t CheckRpcidFormat(char *inputFile, char **Buffer, uint32_t *Len)
static int32_t CheckRpcidFormat(char *inputFile, char **buffer, uint32_t *Len)
{
uint32_t bufferLen;
uint16_t sysCaptype, sysCapLength;
@@ -366,7 +366,7 @@ static int32_t CheckRpcidFormat(char *inputFile, char **Buffer, uint32_t *Len)
return -1;
}
*Buffer = contextBuffer;
*buffer = contextBuffer;
*Len = bufferLen;
return 0;
}