mirror of
https://github.com/openharmony/developtools_syscap_codec.git
synced 2026-08-28 04:40:02 -04:00
修改PCID以及RPCID大写为小写
Signed-off-by: liutuantuan <liutuantuan1@huawei.com>
This commit is contained in:
+3
-3
@@ -213,7 +213,7 @@ int32_t GetPriSyscapLen(uint32_t privateCapSize, cJSON *jsonPriSyscapObj, uint16
|
||||
|
||||
static int32_t CheckConvertedContextSaveAsFile(char *outDirPath, PCIDMain *pcidBuffer, uint16_t pcidLength, int32_t ret)
|
||||
{
|
||||
const char pcidFileName[] = "PCID.sc";
|
||||
const char pcidFileName[] = "pcid.sc";
|
||||
ret = ConvertedContextSaveAsFile(outDirPath, pcidFileName, (char *)pcidBuffer, pcidLength);
|
||||
if (ret != 0) {
|
||||
PRINT_ERR("Save as file failed, outDirPath:%s, filename:%s\n", outDirPath, pcidFileName);
|
||||
@@ -502,7 +502,7 @@ int32_t DecodePCID(char *inputFile, char *outDirPath)
|
||||
freePcidJsonInfo.sysCapObj = NULL; // avoid being released repeatedly.
|
||||
|
||||
char *strJson = cJSON_Print(freePcidJsonInfo.jsonRootObj);
|
||||
const char outputFileName[] = "PCID.json";
|
||||
const char outputFileName[] = "pcid.json";
|
||||
ret = ConvertedContextSaveAsFile(outDirPath, outputFileName, strJson, strlen(strJson));
|
||||
if (ret != 0) {
|
||||
PRINT_ERR("ConvertedContextSaveAsFile failed, outDirPath:%s, filename:%s\n", outDirPath, outputFileName);
|
||||
@@ -706,7 +706,7 @@ int32_t DecodeStringPCIDToJson(char *input, char *outDirPath)
|
||||
}
|
||||
// save as json file
|
||||
char *jsonBuffer = cJSON_Print(rootObj);
|
||||
const char outputFileName[] = "PCID.json";
|
||||
const char outputFileName[] = "pcid.json";
|
||||
if (ConvertedContextSaveAsFile(outDirPath, outputFileName,
|
||||
jsonBuffer, strlen(jsonBuffer)) != 0) {
|
||||
PRINT_ERR("Save as json file failed.\n");
|
||||
|
||||
+16
-16
@@ -50,8 +50,8 @@ int32_t OperateByBitMap(char *const *argv, uint16_t bitMap, char *outputpath);
|
||||
static struct option g_longOptions[] = {
|
||||
{"help", no_argument, 0, 'h' },
|
||||
{"version", no_argument, 0, 'v' },
|
||||
{"RPCID", no_argument, 0, 'R' },
|
||||
{"PCID", no_argument, 0, 'P' },
|
||||
{"rpcid", no_argument, 0, 'r' },
|
||||
{"pcid", no_argument, 0, 'p' },
|
||||
{"compare", required_argument, 0, 'C' },
|
||||
{"encode", no_argument, 0, 'e' },
|
||||
{"decode", no_argument, 0, 'd' },
|
||||
@@ -103,28 +103,28 @@ int32_t OperateByBitMap(char *const *argv, uint16_t bitMap, char *outputpath)
|
||||
{
|
||||
int32_t ret = 0;
|
||||
switch (bitMap) {
|
||||
case 0x109: // 0x109, -Rei inputfile
|
||||
case 0x109: // 0x109, -rei inputfile
|
||||
ret = RPCIDEncode(g_customerfileinfo.inputfile, outputpath); break;
|
||||
case 0x10A: // 0x10A, -Rdi inputfile
|
||||
case 0x10A: // 0x10A, -rdi inputfile
|
||||
ret = RPCIDDecode(g_customerfileinfo.inputfile, outputpath); break;
|
||||
case 0x10D: // 0x10D, -Resi inputfile
|
||||
case 0x10D: // 0x10D, -resi inputfile
|
||||
ret = EncodeRpcidscToString(g_customerfileinfo.inputfile, outputpath); break;
|
||||
case 0x115: // 0x115, -Pesi inputfile
|
||||
case 0x115: // 0x115, -pesi inputfile
|
||||
ret = EncodePcidscToString(g_customerfileinfo.inputfile, outputpath); break;
|
||||
case 0x60: // 0x60, -C PCID.txt RPCID.txt
|
||||
case 0x60: // 0x60, -C pcid.txt rpcid.txt
|
||||
ret = ComparePcidWithRpcidString(g_customerfileinfo.pcidfile, g_customerfileinfo.rpcidfile, TYPE_FILE);
|
||||
break;
|
||||
case 0x64: // 0x64, -sC "pcidstring" "rpcidstring"
|
||||
case 0x64: // 0x64, -sc "pcidstring" "rpcidstring"
|
||||
ret = ComparePcidWithRpcidString(g_customerfileinfo.pcidfile, g_customerfileinfo.rpcidfile, TYPE_STRING);
|
||||
break;
|
||||
case 0x111: // 0x111, -Pei inputfile
|
||||
case 0x111: // 0x111, -pei inputfile
|
||||
ret = CreatePCID(g_customerfileinfo.inputfile, outputpath); break;
|
||||
case 0x112: // 0x112, -Pdi inputfile
|
||||
case 0x112: // 0x112, -pdi inputfile
|
||||
ret = DecodePCID(g_customerfileinfo.inputfile, outputpath); break;
|
||||
case 0x116: // 0x116, -Pdsi inputfile
|
||||
case 0x116: // 0x116, -pdsi inputfile
|
||||
ret = DecodeStringPCIDToJson(g_customerfileinfo.inputfile, outputpath); break;
|
||||
case 0x10E: // 0x10E, -Rdsi inputfile
|
||||
printf("-Rdsi is not support currently.\n"); break;
|
||||
case 0x10E: // 0x10E, -rdsi inputfile
|
||||
printf("-rdsi is not support currently.\n"); break;
|
||||
case 0x80: // 0x80, -v
|
||||
(void)OutputVersion(argv[optind], optind); break;
|
||||
default:
|
||||
@@ -186,10 +186,10 @@ void PrintVersion(void)
|
||||
|
||||
void PrintHelp(void)
|
||||
{
|
||||
printf("syscap_tool -R/P -e/d -i filepath [-o outpath]\n");
|
||||
printf("syscap_tool -r/p -e/d -i filepath [-o outpath]\n");
|
||||
printf("-h, --help\t: how to use\n");
|
||||
printf("-R, --RPCID\t: encode or decode RPCID\n");
|
||||
printf("-P, --PCID\t: encode or decode PCID\n");
|
||||
printf("-r, --rpcid\t: encode or decode rpcid\n");
|
||||
printf("-p, --pcid\t: encode or decode pcid\n");
|
||||
printf("-C, --compare\t: compare pcid with rpcid string format.\n\t"
|
||||
"-s, --string : input string.\n");
|
||||
printf("-e, --encode\t: encode to sc format.\n\t-s, --string : encode to string format.\n");
|
||||
|
||||
+3
-3
@@ -179,7 +179,7 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath)
|
||||
if (ret == -1) {
|
||||
return FreeAfterRPCIDEncode(convertedBuffer, contextBuffer, FREE_CONVERT_OUT_RPCID_ENCODE, ret);
|
||||
}
|
||||
ret = ConvertedContextSaveAsFile(outputPath, "RPCID.sc", convertedBuffer, convertedBufLen);
|
||||
ret = ConvertedContextSaveAsFile(outputPath, "rpcid.sc", convertedBuffer, convertedBufLen);
|
||||
if (ret != 0) {
|
||||
PRINT_ERR("ConvertedContextSaveAsFile failed, outputPath:%s, filename:rpcid.sc\n", outputPath);
|
||||
}
|
||||
@@ -258,7 +258,7 @@ int32_t RPCIDDecode(char *inputFile, char *outputPath)
|
||||
|
||||
// save to json file
|
||||
convertedBuffer = cJSON_Print(rpcidRoot);
|
||||
ret = ConvertedContextSaveAsFile(outputPath, "RPCID.json", convertedBuffer, strlen(convertedBuffer));
|
||||
ret = ConvertedContextSaveAsFile(outputPath, "rpcid.json", convertedBuffer, strlen(convertedBuffer));
|
||||
if (ret != 0) {
|
||||
PRINT_ERR("ConvertedContextSaveAsFile failed, outputPath:%s, filename:rpcid.json\n", outputPath);
|
||||
goto FREE_RPCID_ROOT;
|
||||
@@ -333,7 +333,7 @@ static int32_t PrintOutputToFile(struct FreeAfterEncodeRpcidscInfo freeAfterEnco
|
||||
}
|
||||
}
|
||||
|
||||
const char outputFilename[] = "RPCID.txt";
|
||||
const char outputFilename[] = "rpcid.txt";
|
||||
ret = ConvertedContextSaveAsFile(outDirPath, outputFilename, freeAfterEncodeRpcidscInfo.outBuffer,
|
||||
strlen(freeAfterEncodeRpcidscInfo.outBuffer));
|
||||
if (ret != 0) {
|
||||
|
||||
Reference in New Issue
Block a user