Skip to content

Commit 37efb84

Browse files
committed
nsp: split some code out into NSPROW::has_properror
1 parent bf05656 commit 37efb84

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

exch/mh/nsp_common.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,8 @@ static BOOL cu_nsp_proprow_to_proprow(const LPROPTAG_ARRAY &cols,
286286
if (abrow.pppropval == nullptr)
287287
return false;
288288
}
289-
size_t i;
290-
for (i = 0; i < nsprow.cvalues; ++i)
291-
if (PROP_TYPE(nsprow.pprops[i].proptag) == PT_ERROR)
292-
break;
293-
abrow.flag = i < nsprow.cvalues ? PROPERTY_ROW_FLAG_FLAGGED : PROPERTY_ROW_FLAG_NONE;
294-
for (i = 0; i < nsprow.cvalues; ++i) {
289+
abrow.flag = nsprow.has_properror() ? PROPERTY_ROW_FLAG_FLAGGED : PROPERTY_ROW_FLAG_NONE;
290+
for (size_t i = 0; i < nsprow.cvalues; ++i) {
295291
auto &nsprop = nsprow.pprops[i];
296292
if (PROP_TYPE(nsprop.proptag) == PT_ERROR) {
297293
auto ap = cu_alloc<FLAGGED_PROPVAL>();

exch/nsp/nsp_interface.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,13 +1686,8 @@ ec_error_t nsp_interface_get_props(NSPI_HANDLE handle, uint32_t flags,
16861686
count++;
16871687
}
16881688
rowset->cvalues = count;
1689-
} else {
1690-
for (size_t i = 0; i < rowset->cvalues; ++i) {
1691-
if (PROP_TYPE(rowset->pprops[i].proptag) == PT_ERROR) {
1692-
result = ecWarnWithErrors;
1693-
break;
1694-
}
1695-
}
1689+
} else if (rowset->has_properror()) {
1690+
result = ecWarnWithErrors;
16961691
}
16971692
if (result == ecSuccess || result == ecWarnWithErrors)
16981693
*pprows = rowset;

exch/nsp/nsp_types.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ struct NSP_PROPROW {
8383
auto v = find(tag);
8484
return v != nullptr ? &v->value : nullptr;
8585
}
86+
bool has_properror() const {
87+
for (size_t i = 0; i < cvalues; ++i)
88+
if (PROP_TYPE(pprops[i].proptag) == PT_ERROR)
89+
return true;
90+
return false;
91+
}
8692

8793
uint32_t reserved;
8894
uint32_t cvalues;

0 commit comments

Comments
 (0)