mirror of
https://gitee.com/openharmony/xts_dcts
synced 2024-11-27 18:00:50 +00:00
!50 【distributeddatamgr】【master】strcat改成strcat_s
Merge pull request !50 from wuxiaodan/master
This commit is contained in:
commit
12d3882f28
@ -119,7 +119,7 @@ int waitDataWithCode(char* code, char* data)
|
||||
|
||||
int writeCodeDataToShm(int code, char* buf)
|
||||
{
|
||||
char str[1024] = { 0 };
|
||||
char str[MAX_DATA_LENGTH] = { 0 };
|
||||
char codeStr[5] = { 0 };
|
||||
char* str2 = Int2String(code, codeStr);
|
||||
if (str2 == nullptr) {
|
||||
@ -128,11 +128,16 @@ int writeCodeDataToShm(int code, char* buf)
|
||||
if (strcpy_s(str, strlen(codeStr) + 1, codeStr) != EOK) {
|
||||
return -1;
|
||||
}
|
||||
strcat(str, ":");
|
||||
if (strcat_s(str, strlen(":") + 1, ":") != EOK) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf == nullptr) {
|
||||
return -1;
|
||||
}
|
||||
strcat(str, buf);
|
||||
if (strcat_s(str, strlen(buf) + 1, buf) != EOK) {
|
||||
return -1;
|
||||
}
|
||||
int nres = writeDataToShm(str);
|
||||
if (nres == -1) {
|
||||
return -1;
|
||||
|
@ -98,8 +98,7 @@ void KvStoreSyncCallbackTestImpl::SyncCompleted(const std::map<std::string, Stat
|
||||
class Observer : public KvStoreObserver {
|
||||
void OnChange(const ChangeNotification& changeNotification);
|
||||
};
|
||||
void Observer::OnChange(
|
||||
const ChangeNotification& changeNotification)
|
||||
void Observer::OnChange(const ChangeNotification& changeNotification)
|
||||
{
|
||||
LOG("%s OnChange begin", LOGSTR);
|
||||
cout << "OnChange insert: " << changeNotification.GetInsertEntries().size()
|
||||
@ -757,8 +756,8 @@ HWTEST_F(DistributedKvDataManagerTest, DistribitedKvDataManager_Sync_Push_0700,
|
||||
|
||||
char strKV[MAX_DATA_LENGTH] = { "math_score_int" };
|
||||
strcpy_s(strKV, strlen(stringKey.c_str()) + 1, stringKey.c_str());
|
||||
strcat(strKV, ":");
|
||||
strcat(strKV, strvc.c_str());
|
||||
strcat_s(strKV, MAX_DATA_LENGTH, ":");
|
||||
strcat_s(strKV, MAX_DATA_LENGTH, strvc.c_str());
|
||||
|
||||
std::cout << "strvc = " << strvc << std::endl;
|
||||
std::cout << "strvc.c_str() = " << strvc.c_str() << std::endl;
|
||||
@ -1443,8 +1442,8 @@ HWTEST_F(DistributedKvDataManagerTest, DistribitedKvDataManager_Sync_Pull_0700,
|
||||
|
||||
char strKV[MAX_DATA_LENGTH] = { "math_score_int" };
|
||||
strcpy_s(strKV, strlen(stringKey.c_str()) + 1, stringKey.c_str());
|
||||
strcat(strKV, ":");
|
||||
strcat(strKV, strvc.c_str());
|
||||
strcat_s(strKV, MAX_DATA_LENGTH, ":");
|
||||
strcat_s(strKV, MAX_DATA_LENGTH, strvc.c_str());
|
||||
|
||||
std::cout << "strvc = " << strvc << std::endl;
|
||||
std::cout << "strvc.c_str() = " << strvc.c_str() << std::endl;
|
||||
@ -2497,8 +2496,8 @@ HWTEST_F(DistributedKvDataManagerTest, SubscribeWithQuery_0700, TestSize.Level1)
|
||||
|
||||
char strKV[MAX_DATA_LENGTH] = { "math_score_int" };
|
||||
strcpy_s(strKV, strlen(stringKey.c_str()) + 1, stringKey.c_str());
|
||||
strcat(strKV, ":");
|
||||
strcat(strKV, strvc.c_str());
|
||||
strcat_s(strKV, MAX_DATA_LENGTH, ":");
|
||||
strcat_s(strKV, MAX_DATA_LENGTH, strvc.c_str());
|
||||
DisKvTest::RemotePutData(strKV);
|
||||
// 5.远端getvect
|
||||
LOG("%s 5.远端get vect ", LOGSTR);
|
||||
@ -2844,8 +2843,8 @@ HWTEST_F(DistributedKvDataManagerTest, SyncWithCondition_0700, TestSize.Level1)
|
||||
strvc.assign(vect2.begin(), vect2.end());
|
||||
char strKV[MAX_DATA_LENGTH] = { "math_score_int" };
|
||||
strcpy_s(strKV, strlen(stringKey.c_str()) + 1, stringKey.c_str());
|
||||
strcat(strKV, ":");
|
||||
strcat(strKV, strvc.c_str());
|
||||
strcat_s(strKV, MAX_DATA_LENGTH, ":");
|
||||
strcat_s(strKV, MAX_DATA_LENGTH, strvc.c_str());
|
||||
std::cout << "strvc = " << strvc << std::endl;
|
||||
std::cout << "strvc.c_str() = " << strvc.c_str() << std::endl;
|
||||
std::cout << "strKV = " << strKV << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user