@@ -288,10 +288,8 @@ void zs_notification_proc(const char *dir, BOOL b_table, uint32_t notify_id,
288288 uint64_t message_id;
289289 struct pollfd fdpoll;
290290 uint64_t old_parentid;
291- PROPTAG_ARRAY proptags;
292291 TPROPVAL_ARRAY propvals;
293292 DOUBLE_LIST_NODE *pnode;
294- uint32_t proptag_buff[2 ];
295293 ZNOTIFICATION *pnotification;
296294 NEWMAIL_ZNOTIFICATION *pnew_mail;
297295 OBJECT_ZNOTIFICATION *pobj_notify;
@@ -335,10 +333,8 @@ void zs_notification_proc(const char *dir, BOOL b_table, uint32_t notify_id,
335333 if (pbin == nullptr )
336334 return ;
337335 pnew_mail->parentid = *pbin;
338- proptags.count = 2 ;
339- proptags.pproptag = proptag_buff;
340- proptag_buff[0 ] = PR_MESSAGE_CLASS;
341- proptag_buff[1 ] = PR_MESSAGE_FLAGS;
336+ static constexpr proptag_t proptag_buff[] = {PR_MESSAGE_CLASS, PR_MESSAGE_FLAGS};
337+ static constexpr PROPTAG_ARRAY proptags = {std::size (proptag_buff), deconst (proptag_buff)};
342338 if (!exmdb_client::get_message_properties (dir, nullptr , CP_ACP,
343339 message_id, &proptags, &propvals))
344340 return ;
@@ -1628,8 +1624,6 @@ ec_error_t zs_createmessage(GUID hsession,
16281624 uint32_t tag_access;
16291625 uint32_t permission;
16301626 uint64_t message_id;
1631- uint32_t proptag_buff[4 ];
1632- PROPTAG_ARRAY tmp_proptags;
16331627 TPROPVAL_ARRAY tmp_propvals;
16341628
16351629 auto pinfo = zs_query_session (hsession);
@@ -1657,12 +1651,11 @@ ec_error_t zs_createmessage(GUID hsession,
16571651 } else {
16581652 tag_access = MAPI_ACCESS_MODIFY | MAPI_ACCESS_READ | MAPI_ACCESS_DELETE;
16591653 }
1660- tmp_proptags.count = 4 ;
1661- tmp_proptags.pproptag = proptag_buff;
1662- proptag_buff[0 ] = PR_MESSAGE_SIZE_EXTENDED;
1663- proptag_buff[1 ] = PR_STORAGE_QUOTA_LIMIT;
1664- proptag_buff[2 ] = PR_ASSOC_CONTENT_COUNT;
1665- proptag_buff[3 ] = PR_CONTENT_COUNT;
1654+
1655+ static constexpr proptag_t proptag_buff[] =
1656+ {PR_MESSAGE_SIZE_EXTENDED, PR_STORAGE_QUOTA_LIMIT,
1657+ PR_ASSOC_CONTENT_COUNT, PR_CONTENT_COUNT};
1658+ static constexpr PROPTAG_ARRAY tmp_proptags = {std::size (proptag_buff), deconst (proptag_buff)};
16661659 if (!pstore->get_properties (&tmp_proptags, &tmp_propvals))
16671660 return ecError;
16681661 auto num = tmp_propvals.get <const uint32_t >(PR_STORAGE_QUOTA_LIMIT);
@@ -1710,8 +1703,6 @@ ec_error_t zs_deletemessages(GUID hsession, uint32_t hfolder,
17101703 uint32_t permission;
17111704 uint64_t message_id;
17121705 MESSAGE_CONTENT *pbrief;
1713- uint32_t proptag_buff[2 ];
1714- PROPTAG_ARRAY tmp_proptags;
17151706 TPROPVAL_ARRAY tmp_propvals;
17161707 bool notify_non_read = flags & GX_DELMSG_NOTIFY_UNREAD;
17171708
@@ -1770,10 +1761,10 @@ ec_error_t zs_deletemessages(GUID hsession, uint32_t hfolder,
17701761 if (!b_owner)
17711762 continue ;
17721763 }
1773- tmp_proptags. count = 2 ;
1774- tmp_proptags. pproptag = proptag_buff ;
1775- proptag_buff[ 0 ] = PR_NON_RECEIPT_NOTIFICATION_REQUESTED;
1776- proptag_buff[ 1 ] = PR_READ ;
1764+ static constexpr proptag_t proptag_buff[] =
1765+ {PR_NON_RECEIPT_NOTIFICATION_REQUESTED, PR_READ} ;
1766+ static constexpr PROPTAG_ARRAY tmp_proptags =
1767+ { std::size ( proptag_buff), deconst (proptag_buff)} ;
17771768 if (!exmdb_client::get_message_properties (pstore->get_dir (),
17781769 nullptr , CP_ACP, i_eid, &tmp_proptags, &tmp_propvals))
17791770 return ecError;
@@ -1922,10 +1913,8 @@ ec_error_t zs_setreadflags(GUID hsession, uint32_t hfolder,
19221913 uint64_t folder_id;
19231914 TARRAY_SET tmp_set;
19241915 uint64_t message_id;
1925- uint32_t tmp_proptag;
19261916 BOOL b_notify = TRUE ; /* TODO: Read from config or USER_INFO. */
19271917 BINARY_ARRAY tmp_bins;
1928- PROPTAG_ARRAY proptags;
19291918 PROBLEM_ARRAY problems;
19301919 MESSAGE_CONTENT *pbrief;
19311920 TPROPVAL_ARRAY propvals;
@@ -1955,9 +1944,9 @@ ec_error_t zs_setreadflags(GUID hsession, uint32_t hfolder,
19551944 pfolder->folder_id , username, TABLE_FLAG_NONOTIFICATIONS,
19561945 &restriction, nullptr , &table_id, &row_count))
19571946 return ecError;
1958- proptags. count = 1 ;
1959- proptags. pproptag = & tmp_proptag;
1960- tmp_proptag = PR_ENTRYID ;
1947+
1948+ static constexpr proptag_t tmp_proptag[] = {PR_ENTRYID} ;
1949+ static constexpr PROPTAG_ARRAY proptags = { std::size (tmp_proptag), deconst (tmp_proptag)} ;
19611950 if (!exmdb_client::query_table (pstore->get_dir (), username,
19621951 CP_ACP, table_id, &proptags, 0 , row_count, &tmp_set)) {
19631952 exmdb_client::unload_table (pstore->get_dir (), table_id);
@@ -3356,8 +3345,6 @@ ec_error_t zs_submitmessage(GUID hsession, uint32_t hmessage) try
33563345 zs_objtype mapi_type;
33573346 uint16_t rcpt_num;
33583347 char command_buff[1024 ];
3359- uint32_t proptag_buff[6 ];
3360- PROPTAG_ARRAY tmp_proptags;
33613348 TPROPVAL_ARRAY tmp_propvals;
33623349
33633350 auto pinfo = zs_query_session (hsession);
@@ -3388,10 +3375,9 @@ ec_error_t zs_submitmessage(GUID hsession, uint32_t hmessage) try
33883375 if (rcpt_num > g_max_rcpt)
33893376 return ecTooManyRecips;
33903377
3391- tmp_proptags.count = 1 ;
3392- tmp_proptags.pproptag = proptag_buff;
3393- proptag_buff[0 ] = PR_ASSOCIATED;
3394- if (!pmessage->get_properties (&tmp_proptags, &tmp_propvals))
3378+ static constexpr proptag_t proptag_buff1[] = {PR_ASSOCIATED};
3379+ static constexpr PROPTAG_ARRAY tmp_proptags1 = {std::size (proptag_buff1), deconst (proptag_buff1)};
3380+ if (!pmessage->get_properties (&tmp_proptags1, &tmp_propvals))
33953381 return ecError;
33963382 auto flag = tmp_propvals.get <const uint8_t >(PR_ASSOCIATED);
33973383 /* FAI message cannot be sent */
@@ -3417,12 +3403,11 @@ ec_error_t zs_submitmessage(GUID hsession, uint32_t hmessage) try
34173403 repr_grant >= repr_grant::send_as);
34183404 if (err != ecSuccess)
34193405 return err;
3420- tmp_proptags.count = 3 ;
3421- tmp_proptags.pproptag = proptag_buff;
3422- proptag_buff[0 ] = PR_MAX_SUBMIT_MESSAGE_SIZE;
3423- proptag_buff[1 ] = PR_PROHIBIT_SEND_QUOTA;
3424- proptag_buff[2 ] = PR_MESSAGE_SIZE_EXTENDED;
3425- if (!pstore->get_properties (&tmp_proptags, &tmp_propvals))
3406+ static constexpr proptag_t proptag_buff2[] =
3407+ {PR_MAX_SUBMIT_MESSAGE_SIZE, PR_PROHIBIT_SEND_QUOTA, PR_MESSAGE_SIZE_EXTENDED};
3408+ static const PROPTAG_ARRAY tmp_proptags2 =
3409+ {std::size (proptag_buff2), deconst (proptag_buff2)};
3410+ if (!pstore->get_properties (&tmp_proptags2, &tmp_propvals))
34263411 return ecError;
34273412
34283413 auto sendquota = tmp_propvals.get <uint32_t >(PR_PROHIBIT_SEND_QUOTA);
@@ -3436,15 +3421,14 @@ ec_error_t zs_submitmessage(GUID hsession, uint32_t hmessage) try
34363421 ssize_t max_length = -1 ;
34373422 if (num != nullptr )
34383423 max_length = *num;
3439- tmp_proptags.count = 6 ;
3440- tmp_proptags.pproptag = proptag_buff;
3441- proptag_buff[0 ] = PR_MESSAGE_SIZE;
3442- proptag_buff[1 ] = PR_MESSAGE_FLAGS;
3443- proptag_buff[2 ] = PR_DEFERRED_SEND_TIME;
3444- proptag_buff[3 ] = PR_DEFERRED_SEND_NUMBER;
3445- proptag_buff[4 ] = PR_DEFERRED_SEND_UNITS;
3446- proptag_buff[5 ] = PR_DELETE_AFTER_SUBMIT;
3447- if (!pmessage->get_properties (&tmp_proptags, &tmp_propvals))
3424+
3425+ static constexpr proptag_t proptag_buff3[] =
3426+ {PR_MESSAGE_SIZE, PR_MESSAGE_FLAGS, PR_DEFERRED_SEND_TIME,
3427+ PR_DEFERRED_SEND_NUMBER, PR_DEFERRED_SEND_UNITS,
3428+ PR_DELETE_AFTER_SUBMIT};
3429+ static constexpr PROPTAG_ARRAY tmp_proptags3 =
3430+ {std::size (proptag_buff3), deconst (proptag_buff3)};
3431+ if (!pmessage->get_properties (&tmp_proptags3, &tmp_propvals))
34483432 return ecError;
34493433 num = tmp_propvals.get <uint32_t >(PR_MESSAGE_SIZE);
34503434 if (num == nullptr )
@@ -4784,8 +4768,6 @@ ec_error_t zs_importreadstates(GUID hsession,
47844768 zs_objtype mapi_type;
47854769 uint64_t folder_id;
47864770 uint32_t permission;
4787- uint32_t proptag_buff[2 ];
4788- PROPTAG_ARRAY tmp_proptags;
47894771 TPROPVAL_ARRAY tmp_propvals;
47904772
47914773 auto pinfo = zs_query_session (hsession);
@@ -4824,10 +4806,8 @@ ec_error_t zs_importreadstates(GUID hsession,
48244806 if (!b_owner)
48254807 continue ;
48264808 }
4827- tmp_proptags.count = 2 ;
4828- tmp_proptags.pproptag = proptag_buff;
4829- proptag_buff[0 ] = PR_ASSOCIATED;
4830- proptag_buff[1 ] = PR_READ;
4809+ static constexpr proptag_t proptag_buff[] = {PR_ASSOCIATED, PR_READ};
4810+ static constexpr PROPTAG_ARRAY tmp_proptags = {std::size (proptag_buff), deconst (proptag_buff)};
48314811 if (!exmdb_client::get_message_properties (pstore->get_dir (),
48324812 nullptr , CP_ACP, message_id, &tmp_proptags, &tmp_propvals))
48334813 return ecError;
0 commit comments