Skip to content

Commit

Permalink
exmdb: consistently pass/take account_id as int32_t
Browse files Browse the repository at this point in the history
The function signatures used ``int``, but the serialization structures
``uint32_t``. Normalize that.
  • Loading branch information
jengelh committed Sep 22, 2023
1 parent 2ad0333 commit 95763a8
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 32 deletions.
22 changes: 10 additions & 12 deletions exch/exmdb_provider/message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,9 @@ unsigned int format_as(proptag_t x) { return x; }
*
* Can be used when submitting message.
*/
BOOL exmdb_server::movecopy_message(const char *dir,
int account_id, cpid_t cpid, uint64_t message_id,
uint64_t dst_fid, uint64_t dst_id, BOOL b_move,
BOOL *pb_result)
BOOL exmdb_server::movecopy_message(const char *dir, int32_t account_id,
cpid_t cpid, uint64_t message_id, uint64_t dst_fid, uint64_t dst_id,
BOOL b_move, BOOL *pb_result)
{
*pb_result = false;
auto pdb = db_engine_get_db(dir);
Expand Down Expand Up @@ -251,10 +250,10 @@ BOOL exmdb_server::movecopy_message(const char *dir,
* @src_fid: The folder from which the action was invoked (this way, we know
* if it came from a search folder or a generic folder).
*/
BOOL exmdb_server::movecopy_messages(const char *dir,
int account_id, cpid_t cpid, BOOL b_guest,
const char *username, uint64_t src_fid, uint64_t dst_fid,
BOOL b_copy, const EID_ARRAY *pmessage_ids, BOOL *pb_partial)
BOOL exmdb_server::movecopy_messages(const char *dir, int32_t account_id,
cpid_t cpid, BOOL b_guest, const char *username, uint64_t src_fid,
uint64_t dst_fid, BOOL b_copy, const EID_ARRAY *pmessage_ids,
BOOL *pb_partial)
{
BOOL b_check, b_owner, b_result;
uint32_t permission, folder_type;
Expand Down Expand Up @@ -457,10 +456,9 @@ BOOL exmdb_server::movecopy_messages(const char *dir,
* of the store, or 0 for autodetect from @dir.
* @username: Used for evaluating delete permission.
*/
BOOL exmdb_server::delete_messages(const char *dir,
int account_id, cpid_t cpid, const char *username,
uint64_t folder_id, const EID_ARRAY *pmessage_ids,
BOOL b_hard, BOOL *pb_partial)
BOOL exmdb_server::delete_messages(const char *dir, int32_t account_id,
cpid_t cpid, const char *username, uint64_t folder_id,
const EID_ARRAY *pmessage_ids, BOOL b_hard, BOOL *pb_partial)
{
void *pvalue;
BOOL b_check;
Expand Down
10 changes: 5 additions & 5 deletions include/gromox/exmdb_idef.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ EXMIDL(remove_folder_properties, (const char *dir, uint64_t folder_id, const PRO
EXMIDL(delete_folder, (const char *dir, cpid_t cpid, uint64_t folder_id, BOOL b_hard, IDLOUT BOOL *b_result))
EXMIDL(empty_folder, (const char *dir, cpid_t cpid, const char *username, uint64_t folder_id, uint32_t flags, IDLOUT BOOL *b_partial))
EXMIDL(check_folder_cycle, (const char *dir, uint64_t src_fid, uint64_t dst_fid, IDLOUT BOOL *b_cycle))
EXMIDL(copy_folder_internal, (const char *dir, int account_id, cpid_t cpid, BOOL b_guest, const char *username, uint64_t src_fid, BOOL b_normal, BOOL b_fai, BOOL b_sub, uint64_t dst_fid, IDLOUT BOOL *b_collid, BOOL *b_partial))
EXMIDL(copy_folder_internal, (const char *dir, int32_t account_id, cpid_t cpid, BOOL b_guest, const char *username, uint64_t src_fid, BOOL b_normal, BOOL b_fai, BOOL b_sub, uint64_t dst_fid, IDLOUT BOOL *b_collid, BOOL *b_partial))
EXMIDL(get_search_criteria, (const char *dir, uint64_t folder_id, IDLOUT uint32_t *search_status, RESTRICTION **prestriction, LONGLONG_ARRAY *folder_ids))
EXMIDL(set_search_criteria, (const char *dir, cpid_t cpid, uint64_t folder_id, uint32_t search_flags, const RESTRICTION *prestriction, const LONGLONG_ARRAY *pfolder_ids, IDLOUT BOOL *b_result))
EXMIDL(movecopy_message, (const char *dir, int account_id, cpid_t cpid, uint64_t message_id, uint64_t dst_fid, uint64_t dst_id, BOOL b_move, IDLOUT BOOL *b_result))
EXMIDL(movecopy_messages, (const char *dir, int account_id, cpid_t cpid, BOOL b_guest, const char *username, uint64_t src_fid, uint64_t dst_fid, BOOL b_copy, const EID_ARRAY *pmessage_ids, IDLOUT BOOL *b_partial))
EXMIDL(movecopy_folder, (const char *dir, int account_id, cpid_t cpid, BOOL b_guest, const char *username, uint64_t src_pid, uint64_t src_fid, uint64_t dst_fid, const char *str_new, BOOL b_copy, IDLOUT BOOL *b_exist, BOOL *b_partial))
EXMIDL(delete_messages, (const char *dir, int account_id, cpid_t cpid, const char *username, uint64_t folder_id, const EID_ARRAY *pmessage_ids, BOOL b_hard, IDLOUT BOOL *b_partial))
EXMIDL(movecopy_message, (const char *dir, int32_t account_id, cpid_t cpid, uint64_t message_id, uint64_t dst_fid, uint64_t dst_id, BOOL b_move, IDLOUT BOOL *b_result))
EXMIDL(movecopy_messages, (const char *dir, int32_t account_id, cpid_t cpid, BOOL b_guest, const char *username, uint64_t src_fid, uint64_t dst_fid, BOOL b_copy, const EID_ARRAY *pmessage_ids, IDLOUT BOOL *b_partial))
EXMIDL(movecopy_folder, (const char *dir, int32_t account_id, cpid_t cpid, BOOL b_guest, const char *username, uint64_t src_pid, uint64_t src_fid, uint64_t dst_fid, const char *str_new, BOOL b_copy, IDLOUT BOOL *b_exist, BOOL *b_partial))
EXMIDL(delete_messages, (const char *dir, int32_t account_id, cpid_t cpid, const char *username, uint64_t folder_id, const EID_ARRAY *pmessage_ids, BOOL b_hard, IDLOUT BOOL *b_partial))
EXMIDL(get_message_brief, (const char *dir, cpid_t cpid, uint64_t message_id, IDLOUT MESSAGE_CONTENT **pbrief))
EXMIDL(sum_hierarchy, (const char *dir, uint64_t folder_id, const char *username, BOOL b_depth, IDLOUT uint32_t *count))
EXMIDL(load_hierarchy_table, (const char *dir, uint64_t folder_id, const char *username, uint8_t table_flags, const RESTRICTION *prestriction, IDLOUT uint32_t *table_id, uint32_t *row_count))
Expand Down
10 changes: 5 additions & 5 deletions include/gromox/exmdb_rpc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ struct exreq_check_folder_cycle : public exreq {
};

struct exreq_copy_folder_internal : public exreq {
uint32_t account_id;
int32_t account_id;
cpid_t cpid;
BOOL b_guest;
char *username;
Expand All @@ -310,7 +310,7 @@ struct exreq_set_search_criteria : public exreq {
};

struct exreq_movecopy_message : public exreq {
uint32_t account_id;
int32_t account_id;
cpid_t cpid;
uint64_t message_id;
uint64_t dst_fid;
Expand All @@ -319,7 +319,7 @@ struct exreq_movecopy_message : public exreq {
};

struct exreq_movecopy_messages : public exreq {
uint32_t account_id;
int32_t account_id;
cpid_t cpid;
BOOL b_guest;
char *username;
Expand All @@ -330,7 +330,7 @@ struct exreq_movecopy_messages : public exreq {
};

struct exreq_movecopy_folder : public exreq {
uint32_t account_id;
int32_t account_id;
cpid_t cpid;
BOOL b_guest;
char *username;
Expand All @@ -342,7 +342,7 @@ struct exreq_movecopy_folder : public exreq {
};

struct exreq_delete_messages : public exreq {
uint32_t account_id;
int32_t account_id;
cpid_t cpid;
char *username;
uint64_t folder_id;
Expand Down
20 changes: 10 additions & 10 deletions lib/exmdb_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ static pack_result exmdb_pull(EXT_PULL &x, exreq_copy_folder_internal &d)
{
uint8_t tmp_byte;

TRY(x.g_uint32(&d.account_id));
TRY(x.g_int32(&d.account_id));
TRY(x.g_nlscp(&d.cpid));
TRY(x.g_bool(&d.b_guest));
TRY(x.g_uint8(&tmp_byte));
Expand All @@ -397,7 +397,7 @@ static pack_result exmdb_pull(EXT_PULL &x, exreq_copy_folder_internal &d)

static pack_result exmdb_push(EXT_PUSH &x, const exreq_copy_folder_internal &d)
{
TRY(x.p_uint32(d.account_id));
TRY(x.p_int32(d.account_id));
TRY(x.p_uint32(d.cpid));
TRY(x.p_bool(d.b_guest));
if (d.username == nullptr) {
Expand Down Expand Up @@ -461,7 +461,7 @@ static pack_result exmdb_push(EXT_PUSH &x, const exreq_set_search_criteria &d)

static pack_result exmdb_pull(EXT_PULL &x, exreq_movecopy_message &d)
{
TRY(x.g_uint32(&d.account_id));
TRY(x.g_int32(&d.account_id));
TRY(x.g_nlscp(&d.cpid));
TRY(x.g_uint64(&d.message_id));
TRY(x.g_uint64(&d.dst_fid));
Expand All @@ -471,7 +471,7 @@ static pack_result exmdb_pull(EXT_PULL &x, exreq_movecopy_message &d)

static pack_result exmdb_push(EXT_PUSH &x, const exreq_movecopy_message &d)
{
TRY(x.p_uint32(d.account_id));
TRY(x.p_int32(d.account_id));
TRY(x.p_uint32(d.cpid));
TRY(x.p_uint64(d.message_id));
TRY(x.p_uint64(d.dst_fid));
Expand All @@ -483,7 +483,7 @@ static pack_result exmdb_pull(EXT_PULL &x, exreq_movecopy_messages &d)
{
uint8_t tmp_byte;

TRY(x.g_uint32(&d.account_id));
TRY(x.g_int32(&d.account_id));
TRY(x.g_nlscp(&d.cpid));
TRY(x.g_bool(&d.b_guest));
TRY(x.g_uint8(&tmp_byte));
Expand All @@ -502,7 +502,7 @@ static pack_result exmdb_pull(EXT_PULL &x, exreq_movecopy_messages &d)

static pack_result exmdb_push(EXT_PUSH &x, const exreq_movecopy_messages &d)
{
TRY(x.p_uint32(d.account_id));
TRY(x.p_int32(d.account_id));
TRY(x.p_uint32(d.cpid));
TRY(x.p_bool(d.b_guest));
if (d.username == nullptr) {
Expand All @@ -521,7 +521,7 @@ static pack_result exmdb_pull(EXT_PULL &x, exreq_movecopy_folder &d)
{
uint8_t tmp_byte;

TRY(x.g_uint32(&d.account_id));
TRY(x.g_int32(&d.account_id));
TRY(x.g_nlscp(&d.cpid));
TRY(x.g_bool(&d.b_guest));
TRY(x.g_uint8(&tmp_byte));
Expand All @@ -538,7 +538,7 @@ static pack_result exmdb_pull(EXT_PULL &x, exreq_movecopy_folder &d)

static pack_result exmdb_push(EXT_PUSH &x, const exreq_movecopy_folder &d)
{
TRY(x.p_uint32(d.account_id));
TRY(x.p_int32(d.account_id));
TRY(x.p_uint32(d.cpid));
TRY(x.p_bool(d.b_guest));
if (d.username == nullptr) {
Expand All @@ -558,7 +558,7 @@ static pack_result exmdb_pull(EXT_PULL &x, exreq_delete_messages &d)
{
uint8_t tmp_byte;

TRY(x.g_uint32(&d.account_id));
TRY(x.g_int32(&d.account_id));
TRY(x.g_nlscp(&d.cpid));
TRY(x.g_uint8(&tmp_byte));
if (tmp_byte == 0)
Expand All @@ -575,7 +575,7 @@ static pack_result exmdb_pull(EXT_PULL &x, exreq_delete_messages &d)

static pack_result exmdb_push(EXT_PUSH &x, const exreq_delete_messages &d)
{
TRY(x.p_uint32(d.account_id));
TRY(x.p_int32(d.account_id));
TRY(x.p_uint32(d.cpid));
if (d.username == nullptr) {
TRY(x.p_uint8(0));
Expand Down

0 comments on commit 95763a8

Please sign in to comment.