1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

Added routines for arrays of uint16s.

(This used to be commit 370512f6644507ed0457de71ab5a50207e00e750)
This commit is contained in:
Tim Potter 2003-12-12 06:26:34 +00:00
parent fece5b7aba
commit d68d1558f7

View File

@ -278,6 +278,21 @@ NTSTATUS ndr_push_array_uint8(struct ndr_push *ndr, int ndr_flags, const char *d
return ndr_push_bytes(ndr, data, n);
}
/*
push an array of uint16
*/
NTSTATUS ndr_push_array_uint16(struct ndr_push *ndr, int ndr_flags, const uint16 *data, uint32 n)
{
int i;
if (!(ndr_flags & NDR_SCALARS)) {
return NT_STATUS_OK;
}
for (i=0;i<n;i++) {
NDR_CHECK(ndr_push_uint16(ndr, data[i]));
}
return NT_STATUS_OK;
}
/*
push an array of uint32
*/
@ -702,6 +717,24 @@ void ndr_print_array_uint32(struct ndr_print *ndr, const char *name,
ndr->depth--;
}
void ndr_print_array_uint16(struct ndr_print *ndr, const char *name,
const uint16 *data, uint32 count)
{
int i;
ndr->print(ndr, "%s: ARRAY(%d)", name, count);
ndr->depth++;
for (i=0;i<count;i++) {
char *idx=NULL;
asprintf(&idx, "[%d]", i);
if (idx) {
ndr_print_uint16(ndr, idx, data[i]);
free(idx);
}
}
ndr->depth--;
}
void ndr_print_array_uint8(struct ndr_print *ndr, const char *name,
const uint8 *data, uint32 count)
{