!4 【轻量级 PR】:optimize code by removing ending return statements in void-function

Merge pull request !4 from Gymee/N/A
This commit is contained in:
Gymee 2020-09-18 11:37:31 +08:00 committed by openharmony_ci
parent 67c92a7703
commit 92796f0b20
5 changed files with 1 additions and 17 deletions

View File

@ -38,7 +38,6 @@ void HapPutByte(const HapBuf *hapBuffer, int offset, char value)
if ((offset >= 0) && (hapBuffer->len - offset >= (int)(sizeof(value)))) {
*(char *)((char *)hapBuffer->buffer + offset) = value;
}
return;
}
void HapPutData(const HapBuf *hapBuffer, int offset, const unsigned char *data, int len)
@ -65,7 +64,6 @@ void HapSetInt32(const HapBuf *buffer, int offset, int value)
if ((offset >= 0) && ((buffer->len - offset) >= (int)(sizeof(value)))) {
HapPutInt32((unsigned char *)buffer->buffer + offset, buffer->len - offset, (int)(value));
}
return;
}
bool CreateHapBuffer(HapBuf *hapBuffer, int len)

View File

@ -72,5 +72,4 @@ void HapPutInt32(unsigned char *buf, int len, int value)
buf[i] = var;
var = var >> (BYTE_BITS);
}
return;
}

View File

@ -27,9 +27,7 @@ static void ProfInit(ProfileProf *pf)
int ret = memset_s(pf, sizeof(ProfileProf), 0, sizeof(ProfileProf));
if (ret != V_OK) {
LOG_ERROR("memset failed");
return;
}
return;
}
static char *GetStringTag(const cJSON *root, const char *tag)
@ -69,7 +67,6 @@ static void FreeStringAttay(char **array, int num)
}
}
APPV_FREE(array);
return;
}
static char **GetStringArrayTag(const cJSON *root, const char *tag, int *numReturn)
@ -238,7 +235,6 @@ static void FreeProfPerssion(ProfPermission *pfval)
FreeStringAttay(pfval->restricPermission, pfval->restricNum);
pfval->restricNum = 0;
pfval->restricPermission = NULL;
return;
}
static void FreeProfDebuginfo(ProfDebugInfo *pfval)
@ -248,8 +244,6 @@ static void FreeProfDebuginfo(ProfDebugInfo *pfval)
FreeStringAttay(pfval->deviceId, pfval->devidNum);
pfval->devidNum = 0;
pfval->deviceId = NULL;
return;
}
void ProfFreeData(ProfileProf *pf)
@ -266,7 +260,6 @@ void ProfFreeData(ProfileProf *pf)
FreeProfDebuginfo(&pf->debugInfo);
FREE_IF_NOT_NULL(pf->issuer);
FREE_IF_NOT_NULL(pf->appid);
return;
}
/* parse profile */

View File

@ -82,7 +82,6 @@ static void SignHeadN2H(HwSignHead *signHead)
signHead->magicLow = HapGetInt64((unsigned char *)&signHead->magicLow, sizeof(signHead->magicLow));
signHead->magicHigh = HapGetInt64((unsigned char *)&signHead->magicHigh, sizeof(signHead->magicHigh));
signHead->version = HapGetInt((unsigned char *)&signHead->version, sizeof(signHead->version));
return;
}
static void BlockHeadN2H(BlockHead *blockHead)
@ -90,7 +89,6 @@ static void BlockHeadN2H(BlockHead *blockHead)
blockHead->type = HapGetInt((unsigned char *)&blockHead->type, sizeof(blockHead->type));
blockHead->length = HapGetInt((unsigned char *)&blockHead->length, sizeof(blockHead->length));
blockHead->offset = HapGetInt((unsigned char *)&blockHead->offset, sizeof(blockHead->offset));
return;
}
static void ContentN2H(ContentInfo *content)
@ -99,7 +97,6 @@ static void ContentN2H(ContentInfo *content)
content->size = HapGetInt((unsigned char *)&content->size, sizeof(content->size));
content->algId = HapGetInt((unsigned char *)&content->algId, sizeof(content->algId));
content->length = HapGetInt((unsigned char *)&content->length, sizeof(content->length));
return;
}
static int GetSignHead(const FileRead *file, SignatureInfo *signInfo)
@ -235,7 +232,6 @@ int CalculateHash(const unsigned char *input, int len, int hashAlg, unsigned cha
int ret = mbedtls_md(mbedtls_md_info_from_type((mbedtls_md_type_t)hashAlg), input, len, output);
if (ret) {
LOG_ERROR("Error: calc digest failed");
return ret;
}
return ret;
}
@ -535,6 +531,7 @@ EXIT:
APPV_FREE(profileData);
return V_ERR;
}
static unsigned char *GetRsaPk(const mbedtls_pk_context *pk, int *len)
{
unsigned char *buf = APPV_MALLOC(MAX_PK_BUF);
@ -673,7 +670,6 @@ static void FreeAppSignPublicKey(AppSignPk *pk)
if (pk->pk != NULL) {
APPV_FREE(pk->pk);
}
return;
}
int GetAppid(ProfileProf *profile)

View File

@ -683,7 +683,6 @@ static void FreeSignedDataCerts(Pkcs7 *pkcs7)
static void FreeSignedDataCrl(Pkcs7 *pkcs7)
{
mbedtls_x509_crl_free(&pkcs7->signedData.crl);
return;
}
static int GetCertsNumOfSignedData(const mbedtls_x509_crt *crts)
@ -1316,5 +1315,4 @@ void PKCS7_FreeRes(Pkcs7 *pkcs7)
FreeSignedDataCerts(pkcs7);
FreeSignedDataCrl(pkcs7);
UnLoadRootCert();
return;
}