fix: struct init

Signed-off-by: liujiandong <liujiandong1@huawei.com>
This commit is contained in:
YOUR_NAME 2023-04-17 10:11:55 +08:00
parent b0864112e1
commit c773d6d982
17 changed files with 164 additions and 164 deletions

View File

@ -136,8 +136,8 @@ enum JsErrorCode {
};
struct JsError {
JsErrorCode errorCode;
std::string errorMessage;
JsErrorCode errorCode = JsErrorCode::JS_ERROR_TELEPHONY_UNKNOW_ERROR;
std::string errorMessage = "";
};
} // namespace Telephony
} // namespace OHOS

View File

@ -156,7 +156,7 @@ struct RadioTechContext : BaseContext {
struct SignalInfoListContext : BaseContext {
int32_t slotId = DEFAULT_SIM_SLOT_ID;
std::vector<sptr<SignalInformation>> signalInfoList;
std::vector<sptr<SignalInformation>> signalInfoList {};
};
struct GetSelectModeContext : CallbackContext {
@ -239,7 +239,7 @@ struct SendUpdateCellLocationRequest : CallbackContext {
struct CellInformationContext : BaseContext {
int32_t slotId = DEFAULT_SIM_SLOT_ID;
std::vector<sptr<CellInformation>> cellInformations;
std::vector<sptr<CellInformation>> cellInformations {};
napi_value callbackValue = nullptr;
};
@ -277,8 +277,8 @@ struct ImsRegStateCallback {
napi_env env = nullptr;
napi_ref thisVar = nullptr;
napi_ref callbackRef = nullptr;
int32_t slotId;
ImsServiceType imsSrvType;
int32_t slotId = DEFAULT_SIM_SLOT_ID;
ImsServiceType imsSrvType = ImsServiceType::TYPE_VOICE;
sptr<ImsRegInfoCallback> imsCallback = nullptr;
};

View File

@ -52,7 +52,7 @@ struct AsyncContextPIN {
struct AsyncIccAccountInfo {
AsyncContext<napi_value> asyncContext;
std::vector<IccAccountInfo> vecInfo;
std::vector<IccAccountInfo> vecInfo {};
};
struct ConfigInfo {
@ -76,7 +76,7 @@ template<typename T>
struct AsyncDiallingNumbers {
AsyncContext<T> asyncContext;
int32_t type = ERROR_DEFAULT;
std::vector<TelNumbersInfo> infoVec;
std::vector<TelNumbersInfo> infoVec {};
};
struct AsyncVoiceMail {

View File

@ -33,8 +33,8 @@ enum RadioTechFamily {
};
struct ImsResponseInfo {
int32_t slotId;
ImsErrType error;
int32_t slotId = 0;
ImsErrType error = ImsErrType::IMS_FAILED;
};
struct ImsServiceStatus {
@ -46,8 +46,8 @@ struct ImsServiceStatus {
};
struct ImsRegistrationStatus {
bool isRegisterd;
RadioTechFamily radioTechFamily;
bool isRegisterd = false;
RadioTechFamily radioTechFamily = RadioTechFamily::RADIO_TECH_FAMILY_3GPP;
};
} // namespace Telephony
} // namespace OHOS

View File

@ -226,9 +226,9 @@ enum class PreferredNetworkMode {
};
struct OperatorInformation {
std::string operatorNumeric;
std::string fullName;
std::string shortName;
std::string operatorNumeric = "";
std::string fullName = "";
std::string shortName = "";
};
enum class RadioProtocolTech {

View File

@ -81,14 +81,14 @@ constexpr const char *KEY_PNN_CUST_STRING_ARRAY = "pnn_cust_string_array";
constexpr const char *KEY_OPL_CUST_STRING_ARRAY = "opl_cust_string_array";
struct OperatorConfig : public Parcelable {
std::map<std::u16string, std::u16string> configValue;
std::map<std::string, std::string> stringValue;
std::map<std::string, std::vector<std::string>> stringArrayValue;
std::map<std::string, int32_t> intValue;
std::map<std::string, std::vector<int32_t>> intArrayValue;
std::map<std::string, int64_t> longValue;
std::map<std::string, std::vector<int64_t>> longArrayValue;
std::map<std::string, bool> boolValue;
std::map<std::u16string, std::u16string> configValue {};
std::map<std::string, std::string> stringValue {};
std::map<std::string, std::vector<std::string>> stringArrayValue {};
std::map<std::string, int32_t> intValue {};
std::map<std::string, std::vector<int32_t>> intArrayValue {};
std::map<std::string, int64_t> longValue {};
std::map<std::string, std::vector<int64_t>> longArrayValue {};
std::map<std::string, bool> boolValue {};
const int32_t MAX_CONFIG_SIZE = 10000;
bool Marshalling(Parcel &parcel) const;
bool MarshallingU16StringMap(Parcel &parcel) const;

View File

@ -138,14 +138,14 @@ enum class LockState {
};
struct LockInfo {
LockType lockType;
std::u16string password;
LockState lockState;
LockType lockType = LockType::PIN_LOCK;
std::u16string password = u"";
LockState lockState = LockState::LOCK_ERROR;
};
struct PersoLockInfo {
PersoLockType lockType;
std::u16string password;
PersoLockType lockType = PersoLockType::PN_PIN_LOCK;
std::u16string password = u"";
};
enum UnlockResult {
@ -155,14 +155,14 @@ enum UnlockResult {
};
struct LockStatusResponse {
int32_t result;
int32_t remain;
int32_t result = 0;
int32_t remain = 0;
};
struct SimAuthenticationResponse {
int32_t sw1;
int32_t sw2;
std::string response;
int32_t sw1 = 0;
int32_t sw2 = 0;
std::string response = "";
};
enum SimAuthResult {
@ -171,13 +171,13 @@ enum SimAuthResult {
};
struct IccAccountInfo : public Parcelable {
int32_t simId; // sim Id for card
int32_t slotIndex; // slot index for card
bool isEsim; // mark card is eSim or not
bool isActive; // active status for card
std::u16string iccId; // iccId for card
std::u16string showName; // show name for card
std::u16string showNumber; // show number for card
int32_t simId = 0; // sim Id for card
int32_t slotIndex = 0; // slot index for card
bool isEsim = false; // mark card is eSim or not
bool isActive = false; // active status for card
std::u16string iccId = u""; // iccId for card
std::u16string showName = u""; // show name for card
std::u16string showNumber = u""; // show number for card
inline static const std::u16string DEFAULT_SHOW_NAME = u"Card";
inline static const std::u16string DEFAULT_SHOW_NUMBER = u"";
inline static const std::u16string DEFAULT_ICC_ID = u"";

View File

@ -72,107 +72,107 @@ enum ModemPowerState { CORE_SERVICE_POWER_NOT_AVAILABLE = -1, CORE_SERVICE_POWER
template<typename T>
struct TelRilResponseInfo {
int32_t slotId;
int32_t flag;
int32_t errorNo;
int32_t slotId = DEFAULT_SIM_SLOT_ID;
int32_t flag = 0;
int32_t errorNo = 0;
T object;
};
struct LinkBandwidthRule {
int32_t rat;
int32_t delayMs;
int32_t delayUplinkKbps;
int32_t delayDownlinkKbps;
std::vector<int32_t> maximumUplinkKbps;
std::vector<int32_t> maximumDownlinkKbps;
int32_t rat = 0;
int32_t delayMs = 0;
int32_t delayUplinkKbps = 0;
int32_t delayDownlinkKbps = 0;
std::vector<int32_t> maximumUplinkKbps {};
std::vector<int32_t> maximumDownlinkKbps {};
};
struct DataProfile {
int profileId;
int profileId = 0;
/** (Access Point Name) a string parameter which is a logical name that is used to select the
* GGSN or the external packet data network. from 3GPP TS 27.007 10.1 V4.3.0 (2001-12)
*/
std::string apn;
std::string apn = "";
/** (Packet Data Protocol type) a string parameter which specifies the type of packet
* data protocol from 3GPP TS 27.007 10.1 V4.3.0 (2001-12)
*/
std::string protocol;
int32_t verType;
std::string userName;
std::string password;
std::string roamingProtocol;
std::string protocol = "";
int32_t verType = 0;
std::string userName = "";
std::string password = "";
std::string roamingProtocol = "";
};
struct ActivateDataParam {
int32_t param; // eg:AppExecFwk::InnerEvent::Get(eventId, activateData.param);
int32_t radioTechnology;
int32_t param = 0; // eg:AppExecFwk::InnerEvent::Get(eventId, activateData.param);
int32_t radioTechnology = 0;
struct DataProfile dataProfile;
bool isRoaming;
bool allowRoaming;
bool isRoaming = false;
bool allowRoaming = false;
};
struct DeactivateDataParam {
int32_t param; // eg:AppExecFwk::InnerEvent::Get(eventId, deactivateData.param);
int32_t cid;
int32_t reason;
int32_t param = 0; // eg:AppExecFwk::InnerEvent::Get(eventId, deactivateData.param);
int32_t cid = 0;
int32_t reason = 0;
};
struct CallTransferParam {
int32_t mode;
int32_t reason;
int32_t classx;
std::string number;
int32_t mode = 0;
int32_t reason = 0;
int32_t classx = 0;
std::string number = "";
};
struct CallRestrictionParam {
int32_t mode;
char password[MAX_PARAMETER_LENGTH + 1];
std::string fac;
int32_t mode = 0;
char password[MAX_PARAMETER_LENGTH + 1] = { 0 };
std::string fac = "";
};
struct DtmfParam {
int32_t index;
int32_t switchOn;
int32_t switchOff;
std::string sDTMFCode;
int32_t index = 0;
int32_t switchOn = 0;
int32_t switchOff = 0;
std::string sDTMFCode = "";
};
struct CBConfigParam {
int32_t mode;
std::string idList;
std::string dcsList;
int32_t mode = 0;
std::string idList = "";
std::string dcsList = "";
};
struct CdmaSimMessageParam {
int32_t cdmaIndex;
int32_t status;
std::string pdu;
int32_t cdmaIndex = 0;
int32_t status = 0;
std::string pdu = "";
};
struct GsmSimMessageParam {
int64_t refId;
std::string smscPdu;
std::string pdu;
int64_t refId = 0;
std::string smscPdu = "";
std::string pdu = "";
};
struct SimMessageParam {
int32_t gsmIndex;
int32_t status;
std::string smscPdu;
std::string pdu;
int32_t gsmIndex = 0;
int32_t status = 0;
std::string smscPdu = "";
std::string pdu = "";
};
struct SimLockParam {
std::string fac;
int32_t mode;
std::string passwd;
std::string fac = "";
int32_t mode = 0;
std::string passwd = "";
};
struct SimPasswordParam {
int32_t passwordLength;
std::string fac;
std::string oldPassword;
std::string newPassword;
int32_t passwordLength = 0;
std::string fac = "";
std::string oldPassword = "";
std::string newPassword = "";
};
enum class EccType : int32_t {
@ -195,11 +195,11 @@ enum class AbnormalServiceType : int32_t {
};
struct EmergencyCall {
std::string eccNum;
std::string mcc;
EccType eccType;
SimpresentType simpresent;
AbnormalServiceType abnormalService;
std::string eccNum = "";
std::string mcc = "";
EccType eccType = EccType::TYPE_CATEGORY;
SimpresentType simpresent = SimpresentType::TYPE_NO_CARD;
AbnormalServiceType abnormalService = AbnormalServiceType::TYPE_ALL;
bool operator==(const EmergencyCall &call)
{
return (eccNum == call.eccNum && mcc == call.mcc);
@ -207,8 +207,8 @@ struct EmergencyCall {
};
struct SetEccListResponse {
int32_t result;
int32_t value;
int32_t result = 0;
int32_t value = 0;
};
struct PlmnNetworkName {
@ -238,77 +238,77 @@ enum class RadioProtocolStatus {
};
struct RadioProtocol {
int32_t slotId;
int32_t sessionId;
RadioProtocolPhase phase;
int32_t technology;
int32_t modemId;
RadioProtocolStatus status;
int32_t slotId = DEFAULT_SIM_SLOT_ID;
int32_t sessionId = 0;
RadioProtocolPhase phase = RadioProtocolPhase::RADIO_PROTOCOL_PHASE_INITIAL;
int32_t technology = 0;
int32_t modemId = 0;
RadioProtocolStatus status = RadioProtocolStatus::RADIO_PROTOCOL_STATUS_NONE;
};
struct SsBaseResult {
int32_t index; /* command index, use for find the ss command to retry */
int32_t result; /* the result of execute command */
int32_t reason; /* This use for remaind message code */
int32_t index = 0; /* command index, use for find the ss command to retry */
int32_t result = 0; /* the result of execute command */
int32_t reason = 0; /* This use for remaind message code */
std::string message = ""; /* This use for remaind message */
};
struct GetClipResult {
SsBaseResult result; /* query results */
int32_t action; /* parameter sets/shows the result code presentation status in the TA */
int32_t clipStat; /* parameter shows the subscriber CLIP service status in the network, <0-4> */
int32_t action = 0; /* parameter sets/shows the result code presentation status in the TA */
int32_t clipStat = 0; /* parameter shows the subscriber CLIP service status in the network, <0-4> */
};
struct GetClirResult {
SsBaseResult result; /* query results */
int32_t action; /* parameter sets/shows the result code presentation status in the TA */
int32_t clirStat; /* parameter shows the subscriber CLIP service status in the network, <0-4> */
int32_t action = 0; /* parameter sets/shows the result code presentation status in the TA */
int32_t clirStat = 0; /* parameter shows the subscriber CLIP service status in the network, <0-4> */
};
struct GetColrResult {
SsBaseResult result; /* query results */
int32_t action; /* parameter sets/shows the result code presentation status in the TA */
int32_t colrStat; /* parameter shows the subscriber COLR service status in the network, <0-4> */
int32_t action = 0; /* parameter sets/shows the result code presentation status in the TA */
int32_t colrStat = 0; /* parameter shows the subscriber COLR service status in the network, <0-4> */
};
struct GetColpResult {
SsBaseResult result; /* query results */
int32_t action; /* parameter sets/shows the result code presentation status in the TA */
int32_t colpStat; /* parameter shows the subscriber COLP service status in the network, <0-4> */
int32_t action = 0; /* parameter sets/shows the result code presentation status in the TA */
int32_t colpStat = 0; /* parameter shows the subscriber COLP service status in the network, <0-4> */
};
struct CallWaitResult {
SsBaseResult result; /* query results */
int32_t status; /* parameter sets/shows the result code presentation status in the TA */
int32_t classCw; /* parameter shows the subscriber CLIP service status in the network, <0-4> */
int32_t status = 0; /* parameter sets/shows the result code presentation status in the TA */
int32_t classCw = 0; /* parameter shows the subscriber CLIP service status in the network, <0-4> */
};
struct CallRestrictionResult {
SsBaseResult result; /* query results */
int32_t status; /* parameter sets/shows the result code presentation status in the TA */
int32_t classCw; /* parameter shows the subscriber CLIP service status in the network, <0-4> */
int32_t status = 0; /* parameter sets/shows the result code presentation status in the TA */
int32_t classCw = 0; /* parameter shows the subscriber CLIP service status in the network, <0-4> */
};
struct CallForwardQueryResult {
int32_t serial;
int32_t result; /* query results */
int32_t status;
int32_t classx;
std::string number;
int32_t type;
int32_t reason;
int32_t time;
int32_t startHour;
int32_t startMinute;
int32_t endHour;
int32_t endMinute;
int32_t serial = 0;
int32_t result = 0; /* query results */
int32_t status = 0;
int32_t classx = 0;
std::string number = "";
int32_t type = 0;
int32_t reason = 0;
int32_t time = 0;
int32_t startHour = 0;
int32_t startMinute = 0;
int32_t endHour = 0;
int32_t endMinute = 0;
};
struct CallForwardQueryInfoList {
SsBaseResult result;
int32_t callSize;
int32_t flag;
std::vector<CallForwardQueryResult> calls;
int32_t callSize = 0;
int32_t flag = 0;
std::vector<CallForwardQueryResult> calls {};
};
} // namespace Telephony
} // namespace OHOS

View File

@ -57,15 +57,15 @@ struct NetworkSearchManagerInner {
std::unique_ptr<ObserverHandler> observerHandler_ = nullptr;
std::shared_ptr<DeviceStateHandler> deviceStateHandler_ = nullptr;
std::shared_ptr<DeviceStateObserver> deviceStateObserver_ = nullptr;
sptr<AutoTimeObserver> settingAutoTimeObserver_;
sptr<AutoTimezoneObserver> settingAutoTimezoneObserver_;
sptr<AirplaneModeObserver> airplaneModeObserver_;
sptr<AutoTimeObserver> settingAutoTimeObserver_ = nullptr;
sptr<AutoTimezoneObserver> settingAutoTimezoneObserver_ = nullptr;
sptr<AirplaneModeObserver> airplaneModeObserver_ = nullptr;
HandleRunningState state_ = HandleRunningState::STATE_NOT_START;
std::unique_ptr<NetworkSearchResult> networkSearchResult_ = nullptr;
SelectionMode selection_ = SelectionMode::MODE_TYPE_UNKNOWN;
ModemPowerState radioState_ = ModemPowerState::CORE_SERVICE_POWER_OFF;
std::u16string imei_;
std::u16string meid_;
std::u16string imei_ = u"";
std::u16string meid_ = u"";
NrMode nrMode_ = NrMode::NR_MODE_UNKNOWN;
FrequencyType freqType_ = FrequencyType::FREQ_TYPE_UNKNOWN;
std::mutex mutex_;

View File

@ -31,8 +31,8 @@
namespace OHOS {
namespace Telephony {
struct NetworkSearchCallbackInfo {
int32_t param_;
sptr<INetworkSearchCallback> networkSearchItem_;
int32_t param_ = 0;
sptr<INetworkSearchCallback> networkSearchItem_ = nullptr;
NetworkSearchCallbackInfo(int32_t param, sptr<INetworkSearchCallback> callback)
{

View File

@ -32,13 +32,13 @@ public:
void AutoTimeChange();
void AutoTimeZoneChange();
struct NetworkTime {
int32_t year;
int32_t month;
int32_t day;
int32_t hour;
int32_t minute;
int32_t second;
int32_t offset;
int32_t year = 0;
int32_t month = 0;
int32_t day = 0;
int32_t hour = 0;
int32_t minute = 0;
int32_t second = 0;
int32_t offset = 0;
};
private:

View File

@ -71,8 +71,8 @@ using NsTestFunc = void (*)();
std::map<int32_t, NsTestFunc> memberFuncMap_;
std::shared_ptr<TestBroadCast> subscriber = nullptr;
struct ImsRegStateCallback {
int32_t slotId;
int32_t imsSrvType;
int32_t slotId = 0;
int32_t imsSrvType = 0;
sptr<ImsRegInfoCallback> imsCallback = nullptr;
};
std::list<ImsRegStateCallback> imsRegStateCallbackList_;

View File

@ -53,8 +53,8 @@ private:
private:
struct SimAccountCallbackRecord {
std::string bundleName;
sptr<SimAccountCallback> simAccountCallback;
std::string bundleName = "";
sptr<SimAccountCallback> simAccountCallback = nullptr;
};
bool ready_ = false;

View File

@ -34,7 +34,7 @@ struct IccControllerHolder {
bool getAllFile = false;
std::string filePath = "";
AppExecFwk::InnerEvent::Pointer fileLoaded = AppExecFwk::InnerEvent::Pointer(nullptr, nullptr);
std::vector<std::string> fileResults;
std::vector<std::string> fileResults {};
IccControllerHolder(int efId, int recordNum) : fileId(efId), fileNum(recordNum), getAllFile(false) {}
IccControllerHolder(int efId, int recordNum, std::string path)
: fileId(efId), fileNum(recordNum), getAllFile(false), filePath(path)
@ -75,7 +75,7 @@ struct ControllerToFileMsg : public FileToControllerMsg, IccFileData {
struct IccToRilMsg {
explicit IccToRilMsg(std::shared_ptr<IccControllerHolder> holder) : controlHolder(holder) {}
std::shared_ptr<IccControllerHolder> controlHolder;
std::shared_ptr<IccControllerHolder> controlHolder = nullptr;
int arg1 = INVALID_VALUE;
int arg2 = INVALID_VALUE;
};
@ -108,7 +108,7 @@ struct MultiRecordResult : public FileToControllerMsg {
iccLoader = cmd->iccLoader;
}
}
std::vector<std::string> fileResults;
std::vector<std::string> fileResults {};
int resultLength = 0;
std::shared_ptr<void> exception = nullptr;
};

View File

@ -90,9 +90,9 @@ constexpr const char *FDN_PIN_LOCK = "P2";
constexpr const char *FDN_PIN2_LOCK = "FD";
struct UnlockData {
int32_t result;
int32_t remain;
int32_t lockState;
int32_t result = 0;
int32_t remain = 0;
int32_t lockState = 0;
};
class SimStateHandle : public AppExecFwk::EventHandler {

View File

@ -31,7 +31,7 @@ enum UsimMessage {
};
struct UsimDiallingNumberFile {
std::map<int, std::shared_ptr<TagData>> fileIds_;
std::map<int, std::shared_ptr<TagData>> fileIds_ {};
int fileNumber_ = 0;
};

View File

@ -179,8 +179,8 @@ private:
};
struct ImsRegStateCallback {
int32_t slotId;
ImsServiceType imsSrvType;
int32_t slotId = 0;
ImsServiceType imsSrvType = ImsServiceType::TYPE_VOICE;
sptr<ImsRegInfoCallback> imsCallback = nullptr;
};