D
David student
Guest
Hello All,
Coverity tool is showing the below warning message
deprecated_string_conv_gen: conversion from a string literal to pointer-to-character (non-const) is deprecated
at the below two lines:
mcTskInfo.pwszTaskTrigger = ADD_MCUPDTPATH;
mcTskInfo.pwszTaskParams = SILENT_UPDT;
Below is the code snippet:
SubscriptionMgr.cpp
void SubscriptionMgr::createMcUpdateTask()
{
TASKINFO pcTskInfo = { 0 };
pcTskInfo.cbSize = sizeof(TASKINFO);
pcTskInfo.pwszTaskTrigger = ADD_MCUPDTPATH;
pcTskInfo.pwszTaskParams = SILENT_UPDT;
pcTskInfo.mcTaskType = MCTASK_TYPE_SCHEDULED;
}
constants.h
#define ADD_MCUPDTPATH L"C:\\Program Files\\update.exe"
#define SILENT_UPDT L"/silentupdate"
mctask.h
struct TASKINFO : public TASKINFO_BASE
{
BOOL bRunInRetailMode;
LPWSTR m_szAppID = nullptr;
LPWSTR m_szRuleName = nullptr;
TASKINFO() {}
TASKINFO(unsigned char v)
{
std::fill((unsigned char*)this, (unsigned char*)this + sizeof(TASKINFO), v);
this->cbSize = sizeof(TASKINFO);
}
};
struct TASKINFO_BASE
{
DWORD cbSize;
MCTASK_TYPE mcTaskType;
LPWSTR pwszTaskTrigger;
LPWSTR pwszTaskParams;
};
could anyone please suggest me how to resolve this warning?
Regards
Continue reading...
Coverity tool is showing the below warning message
deprecated_string_conv_gen: conversion from a string literal to pointer-to-character (non-const) is deprecated
at the below two lines:
mcTskInfo.pwszTaskTrigger = ADD_MCUPDTPATH;
mcTskInfo.pwszTaskParams = SILENT_UPDT;
Below is the code snippet:
SubscriptionMgr.cpp
void SubscriptionMgr::createMcUpdateTask()
{
TASKINFO pcTskInfo = { 0 };
pcTskInfo.cbSize = sizeof(TASKINFO);
pcTskInfo.pwszTaskTrigger = ADD_MCUPDTPATH;
pcTskInfo.pwszTaskParams = SILENT_UPDT;
pcTskInfo.mcTaskType = MCTASK_TYPE_SCHEDULED;
}
constants.h
#define ADD_MCUPDTPATH L"C:\\Program Files\\update.exe"
#define SILENT_UPDT L"/silentupdate"
mctask.h
struct TASKINFO : public TASKINFO_BASE
{
BOOL bRunInRetailMode;
LPWSTR m_szAppID = nullptr;
LPWSTR m_szRuleName = nullptr;
TASKINFO() {}
TASKINFO(unsigned char v)
{
std::fill((unsigned char*)this, (unsigned char*)this + sizeof(TASKINFO), v);
this->cbSize = sizeof(TASKINFO);
}
};
struct TASKINFO_BASE
{
DWORD cbSize;
MCTASK_TYPE mcTaskType;
LPWSTR pwszTaskTrigger;
LPWSTR pwszTaskParams;
};
could anyone please suggest me how to resolve this warning?
Regards
Continue reading...