Skip to content

Commit b0e0da6

Browse files
committed
lib: use more ec_error_t
1 parent cbca010 commit b0e0da6

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

include/gromox/defs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ enum cpid_t : uint32_t {
8484
};
8585

8686
extern GX_EXPORT const char *mapi_errname_r(unsigned int, char *, size_t);
87-
extern GX_EXPORT const char *mapi_strerror(unsigned int);
87+
extern GX_EXPORT const char *mapi_strerror(ec_error_t);
8888

8989
template<typename T> constexpr T *deconst(const T *x) { return const_cast<T *>(x); }
9090
#undef roundup /* you naughty glibc */

lib/exmdb_ext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2571,7 +2571,7 @@ static pack_result exmdb_pull(EXT_PULL &x, exresp_get_mapping_replid &d)
25712571
static pack_result exmdb_push(EXT_PUSH &x, const exresp_get_mapping_replid &d)
25722572
{
25732573
TRY(x.p_uint16(d.replid));
2574-
return x.p_uint32(d.e_result);
2574+
return x.p_err32(d.e_result);
25752575
}
25762576

25772577
static pack_result exmdb_pull(EXT_PULL &x, exresp_get_store_all_proptags &d)
@@ -3225,7 +3225,7 @@ static pack_result exmdb_pull(EXT_PULL &x, exresp_error &d)
32253225

32263226
static pack_result exmdb_push(EXT_PUSH &x, const exresp_error &d)
32273227
{
3228-
return x.p_uint32(d.e_result);
3228+
return x.p_err32(d.e_result);
32293229
}
32303230

32313231
static pack_result exmdb_pull(EXT_PULL &x, exresp_get_instance_all_proptags &d)

lib/rfbl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: AGPL-3.0-or-later
2-
// SPDX-FileCopyrightText: 2021-2024 grommunio GmbH
2+
// SPDX-FileCopyrightText: 2021-2025 grommunio GmbH
33
// This file is part of Gromox.
44
#ifdef HAVE_CONFIG_H
55
# include "config.h"
@@ -191,11 +191,11 @@ const char *mapi_errname_r(unsigned int e, char *b, size_t bz)
191191
return b;
192192
}
193193

194-
const char *mapi_strerror(unsigned int e)
194+
const char *mapi_strerror(ec_error_t e)
195195
{
196196
// STG = storage
197-
#define E(v, s) case v: return s;
198197
switch (e) {
198+
#define E(v, s) case v: return s;
199199
E(ecSuccess, "The operation succeeded")
200200
E(ecUnknownUser, "User is unknown to the system")
201201
E(ecServerOOM, "Server could not allocate memory")
@@ -278,7 +278,7 @@ const char *mapi_strerror(unsigned int e)
278278
E(ecZOutOfHandles, "Too many object handles open")
279279
default: {
280280
thread_local char xbuf[40];
281-
snprintf(xbuf, sizeof(xbuf), "Unknown MAPI error code %xh", e);
281+
snprintf(xbuf, sizeof(xbuf), "Unknown MAPI error code %xh", static_cast<uint32_t>(e));
282282
return xbuf;
283283
}
284284
}

lib/ruleproc.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,9 @@ static ec_error_t op_switch(rxparam &par, const rule_node &rule,
800800
case OP_MOVE:
801801
case OP_COPY: {
802802
auto mc = static_cast<MOVECOPY_ACTION *>(act.pdata);
803-
return mc != nullptr ? op_copy(par, rule, *mc, act.type) : ecSuccess;
803+
if (mc == nullptr)
804+
return ecSuccess;
805+
return op_copy(par, rule, *mc, act.type);
804806
}
805807
case OP_MARK_AS_READ:
806808
return op_read(par, rule);

tools/eml2mt.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ static errno_t do_vcard(const char *file, std::vector<message_ptr> &mv)
245245
std::vector<vcard> cardvec;
246246
auto ret = vcard_load_multi_from_str_move(slurp_data.get(), cardvec);
247247
if (ret != ecSuccess) {
248-
fprintf(stderr, "vcard_parse %s unsuccessful (ecode=%xh)\n", file, ret);
248+
fprintf(stderr, "vcard_parse %s unsuccessful (ecode=%xh)\n",
249+
file, static_cast<unsigned int>(ret));
249250
return EIO;
250251
}
251252
for (const auto &card : cardvec) {

0 commit comments

Comments
 (0)