Skip to content

Commit cf1607e

Browse files
committed
nsp: cleanup nsp_interface_fetch_property
1 parent ba38df6 commit cf1607e

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

exch/nsp/nsp_interface.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static ec_error_t nsp_fetchprop(const ab_tree::ab_node &node, cpid_t codepage, u
186186

187187
static ec_error_t nsp_interface_fetch_property(const ab_tree::ab_node &node,
188188
bool b_ephid, cpid_t codepage, proptag_t proptag, PROPERTY_VALUE *pprop,
189-
void *pbuff, size_t temp_len)
189+
char *pbuff, size_t temp_len)
190190
{
191191
std::string dn;
192192
EPHEMERAL_ENTRYID ephid;
@@ -214,7 +214,7 @@ static ec_error_t nsp_interface_fetch_property(const ab_tree::ab_node &node,
214214
if (pprop->value.pstr == nullptr)
215215
return ecServerOOM;
216216
} else {
217-
pprop->value.pstr = static_cast<char *>(pbuff);
217+
pprop->value.pstr = pbuff;
218218
}
219219
gx_strlcpy(pprop->value.pstr, mdbdn.c_str(), temp_len);
220220
return ecSuccess;
@@ -225,7 +225,7 @@ static ec_error_t nsp_interface_fetch_property(const ab_tree::ab_node &node,
225225
if (pprop->value.bin.pv == nullptr)
226226
return ecServerOOM;
227227
} else {
228-
pprop->value.bin.pv = deconst(pbuff);
228+
pprop->value.bin.pv = pbuff;
229229
}
230230
FLATUID f = node.guid();
231231
memcpy(pprop->value.bin.pv, &f, sizeof(f));
@@ -249,7 +249,7 @@ static ec_error_t nsp_interface_fetch_property(const ab_tree::ab_node &node,
249249
if (pprop->value.pstr == nullptr)
250250
return ecServerOOM;
251251
} else {
252-
pprop->value.pstr = static_cast<char *>(pbuff);
252+
pprop->value.pstr = pbuff;
253253
}
254254
gx_strlcpy(pprop->value.pstr, dn.c_str(), temp_len);
255255
return ecSuccess;
@@ -269,12 +269,12 @@ static ec_error_t nsp_interface_fetch_property(const ab_tree::ab_node &node,
269269
case PR_MAPPING_SIGNATURE:
270270
if (pbuff == nullptr || temp_len < 16) {
271271
pprop->value.bin.pv = ndr_stack_alloc(NDR_STACK_OUT, 16);
272-
if (pprop->value.bin.pb == nullptr)
272+
if (pprop->value.bin.pv == nullptr)
273273
return ecServerOOM;
274274
} else {
275275
pprop->value.bin.pv = pbuff;
276276
}
277-
memcpy(pprop->value.bin.pb, &muidEMSAB, sizeof(muidEMSAB));
277+
memcpy(pprop->value.bin.pv, &muidEMSAB, sizeof(muidEMSAB));
278278
pprop->value.bin.cb = 16;
279279
return ecSuccess;
280280
case PR_TEMPLATEID:
@@ -311,7 +311,7 @@ static ec_error_t nsp_interface_fetch_property(const ab_tree::ab_node &node,
311311
if (pprop->value.bin.pc == nullptr)
312312
return ecServerOOM;
313313
} else {
314-
pprop->value.bin.pc = static_cast<char *>(pbuff);
314+
pprop->value.bin.pc = pbuff;
315315
}
316316
snprintf(pprop->value.bin.pc, temp_len, "EX:%s", dn.c_str());
317317
HX_strupper(pprop->value.bin.pc);
@@ -343,7 +343,7 @@ static ec_error_t nsp_interface_fetch_property(const ab_tree::ab_node &node,
343343
if (pprop->value.pstr == nullptr)
344344
return ecServerOOM;
345345
} else {
346-
pprop->value.pstr = static_cast<char *>(pbuff);
346+
pprop->value.pstr = pbuff;
347347
}
348348
gx_strlcpy(pprop->value.pstr, dn.c_str(), temp_len);
349349
return ecSuccess;
@@ -359,12 +359,11 @@ static ec_error_t nsp_interface_fetch_property(const ab_tree::ab_node &node,
359359
return ecNotFound;
360360
if (NULL == pbuff) {
361361
temp_len = utf8_to_mb_len(dn.c_str());
362-
pprop->value.pv = ndr_stack_alloc(
363-
NDR_STACK_OUT, temp_len);
362+
pprop->value.pstr = static_cast<char *>(ndr_stack_alloc(NDR_STACK_OUT, temp_len));
364363
if (pprop->value.pstr == nullptr)
365364
return ecServerOOM;
366365
} else {
367-
pprop->value.pv = pbuff;
366+
pprop->value.pstr = pbuff;
368367
}
369368
cu_utf8_to_mb(codepage, dn.c_str(),
370369
pprop->value.pstr, temp_len);
@@ -378,7 +377,7 @@ static ec_error_t nsp_interface_fetch_property(const ab_tree::ab_node &node,
378377
if (pprop->value.pstr == nullptr)
379378
return ecServerOOM;
380379
} else {
381-
pprop->value.pstr = static_cast<char *>(pbuff);
380+
pprop->value.pstr = pbuff;
382381
}
383382
gx_strlcpy(pprop->value.pstr, dn.c_str(), temp_len);
384383
return ecSuccess;
@@ -387,11 +386,11 @@ static ec_error_t nsp_interface_fetch_property(const ab_tree::ab_node &node,
387386
return ecNotFound;
388387
if (NULL == pbuff) {
389388
temp_len = utf8_to_mb_len(dn.c_str());
390-
pprop->value.pv = ndr_stack_alloc(NDR_STACK_OUT, temp_len);
389+
pprop->value.pstr = static_cast<char *>(ndr_stack_alloc(NDR_STACK_OUT, temp_len));
391390
if (pprop->value.pstr == nullptr)
392391
return ecServerOOM;
393392
} else {
394-
pprop->value.pv = pbuff;
393+
pprop->value.pstr = pbuff;
395394
}
396395
cu_utf8_to_mb(codepage,
397396
dn.c_str(), pprop->value.pstr, temp_len);
@@ -405,7 +404,7 @@ static ec_error_t nsp_interface_fetch_property(const ab_tree::ab_node &node,
405404
if (pprop->value.pstr == nullptr)
406405
return ecServerOOM;
407406
} else {
408-
pprop->value.pstr = static_cast<char *>(pbuff);
407+
pprop->value.pstr = pbuff;
409408
}
410409
gx_strlcpy(pprop->value.pstr, dn.c_str(), temp_len);
411410
return ecSuccess;
@@ -418,7 +417,7 @@ static ec_error_t nsp_interface_fetch_property(const ab_tree::ab_node &node,
418417
if (pprop->value.pstr == nullptr)
419418
return ecServerOOM;
420419
} else {
421-
pprop->value.pstr = static_cast<char *>(pbuff);
420+
pprop->value.pstr = pbuff;
422421
}
423422
cu_utf8_to_mb(codepage, dn.c_str(),
424423
pprop->value.pstr, temp_len);
@@ -441,7 +440,7 @@ static ec_error_t nsp_interface_fetch_property(const ab_tree::ab_node &node,
441440
if (pprop->value.pstr == nullptr)
442441
return ecServerOOM;
443442
} else {
444-
pprop->value.pstr = static_cast<char *>(pbuff);
443+
pprop->value.pstr = pbuff;
445444
}
446445
gx_strlcpy(pprop->value.pstr, dn.c_str(), temp_len);
447446
return ecSuccess;

0 commit comments

Comments
 (0)