Skip to content

Commit fd4adec

Browse files
committed
genimport: annotate code with propid_t/proptag_t types
1 parent 5cb1b50 commit fd4adec

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

doc/mtformat.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,13 @@ All integers are to be in little-endian form.
4747
Number of entries in the NP map
4848
* Repeat *np_entries* times:
4949
* ``uint32_t proptag;``
50-
The named property's assigned proptag for the MT stream.
51-
The high 16 bits convey the propid, the low 16 bits can be
52-
ignored.
50+
The named property's assigned proptag for the MT stream. The
51+
high 16 bits convey the propid, the low 16 bits the proptype.
52+
An MT writer may emit PT_UNSPECIFIED for the proptype to
53+
signal that an MT reader shall mask/disregard proptypes
54+
during propid-to-propid remapping. If an MT writer emits any
55+
other proptype, the MT reader should only do propid-to-propid
56+
translations if the proptype matches.
5357
* PROPERTY_NAME serialized struct
5458

5559
The remainder of the stream is a set of "instructions" (so to speak) to mt2exm

tools/genimport.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct gi_delete : public gromox::stdlib_delete {
3636
inline void operator()(TARRAY_SET *x) const { tarray_set_free(x); }
3737
};
3838

39-
using gi_name_map = std::unordered_map<uint32_t, PROPERTY_XNAME>;
39+
using gi_name_map = std::unordered_map<gromox::proptag_t, PROPERTY_XNAME>;
4040
struct namedprop_bimap;
4141

4242
struct parent_desc {
@@ -98,7 +98,7 @@ extern void gi_folder_map_read(const void *, size_t, gi_folder_map_t &);
9898
extern void gi_folder_map_write(const gi_folder_map_t &);
9999
extern void gi_name_map_read(const void *, size_t, gi_name_map &);
100100
extern void gi_name_map_write(const gi_name_map &);
101-
extern uint16_t gi_resolve_namedprop(const PROPERTY_XNAME &);
101+
extern gromox::propid_t gi_resolve_namedprop(const PROPERTY_XNAME &);
102102
extern int exm_set_change_keys(TPROPVAL_ARRAY *props, eid_t cn);
103103
extern int exm_create_folder(uint64_t parent_fld, TPROPVAL_ARRAY *props, bool o_excl, uint64_t *new_fld_id);
104104
extern int exm_permissions(eid_t, const std::vector<PERMISSION_DATA> &);

tools/staticnpmap.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@
1010

1111
struct namedprop_bimap {
1212
public:
13-
uint16_t emplace(uint16_t, PROPERTY_XNAME &&);
13+
gromox::propid_t emplace(gromox::propid_t, PROPERTY_XNAME &&);
1414

15-
gi_name_map fwd; /* note this is uint32_t -> */
16-
std::unordered_map<std::string, uint16_t> rev;
17-
uint16_t nextid = 0x8000;
15+
gi_name_map fwd;
16+
std::unordered_map<std::string, gromox::propid_t> rev;
17+
gromox::propid_t nextid = 0x8000;
1818
};
1919

2020
static struct namedprop_bimap static_namedprop_map;
2121

22-
uint16_t namedprop_bimap::emplace(uint16_t desired_propid, PROPERTY_XNAME &&name)
22+
gromox::propid_t namedprop_bimap::emplace(gromox::propid_t desired_propid,
23+
PROPERTY_XNAME &&name)
2324
{
2425
if (desired_propid == 0)
2526
desired_propid = nextid;
@@ -39,7 +40,7 @@ uint16_t namedprop_bimap::emplace(uint16_t desired_propid, PROPERTY_XNAME &&name
3940
if (!newly_added)
4041
return iter->second;
4142
fwd.emplace(PROP_TAG(PT_UNSPECIFIED, desired_propid), std::move(name));
42-
nextid = std::max(nextid, static_cast<uint16_t>(desired_propid + 1));
43+
nextid = std::max(nextid, static_cast<gromox::propid_t>(desired_propid + 1));
4344
return desired_propid;
4445
}
4546

@@ -55,8 +56,8 @@ static BOOL ee_get_propids(const PROPNAME_ARRAY *names, PROPID_ARRAY *ids) try
5556
return false;
5657
}
5758

58-
static const PROPERTY_XNAME *ee_get_propname(uint16_t) __attribute__((unused));
59-
static const PROPERTY_XNAME *ee_get_propname(uint16_t propid)
59+
static const PROPERTY_XNAME *ee_get_propname(gromox::propid_t) __attribute__((unused));
60+
static const PROPERTY_XNAME *ee_get_propname(gromox::propid_t propid)
6061
{
6162
auto i = static_namedprop_map.fwd.find(propid);
6263
return i != static_namedprop_map.fwd.end() ? &i->second : nullptr;

0 commit comments

Comments
 (0)