summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2015-06-25 14:05:37 +0200
committerGünther Deschner <gd@samba.org>2015-07-03 02:00:28 +0200
commit2b163012aa243e682c5ba7bb23f1af265783a940 (patch)
treec0381f5e21b90092a3f785b976aec025fe9464ac /librpc
parent4a0370bdfdb599aa1798855a6074210583dd7cc4 (diff)
downloadsamba-2b163012aa243e682c5ba7bb23f1af265783a940.tar.gz
librpc/ndr: make use of dump_data_cb() in ndr_dump_data()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'librpc')
-rw-r--r--librpc/ndr/ndr_basic.c39
1 files changed, 5 insertions, 34 deletions
diff --git a/librpc/ndr/ndr_basic.c b/librpc/ndr/ndr_basic.c
index 67aebe40bcc..12e39422a03 100644
--- a/librpc/ndr/ndr_basic.c
+++ b/librpc/ndr/ndr_basic.c
@@ -1229,11 +1229,11 @@ _PUBLIC_ void ndr_print_array_uint8(struct ndr_print *ndr, const char *name,
#undef _ONELINE_LIMIT
}
-static void ndr_print_asc(struct ndr_print *ndr, const uint8_t *buf, int len)
+static void ndr_print_dump_data_cb(const char *buf, void *private_data)
{
- int i;
- for (i=0;i<len;i++)
- ndr->print(ndr, "%c", isprint(buf[i])?buf[i]:'.');
+ struct ndr_print *ndr = (struct ndr_print *)private_data;
+
+ ndr->print(ndr, "%s", buf);
}
/*
@@ -1241,37 +1241,8 @@ static void ndr_print_asc(struct ndr_print *ndr, const uint8_t *buf, int len)
*/
static void ndr_dump_data(struct ndr_print *ndr, const uint8_t *buf, int len)
{
- int i=0;
-
ndr->no_newline = true;
-
- for (i=0;i<len;) {
- if (i%16 == 0 && i<len) {
- ndr->print(ndr, "[%04X] ",i);
- }
-
- ndr->print(ndr, "%02X ",(int)buf[i]);
- i++;
- if (i%8 == 0) ndr->print(ndr," ");
- if (i%16 == 0) {
- ndr_print_asc(ndr,&buf[i-16],8); ndr->print(ndr," ");
- ndr_print_asc(ndr,&buf[i-8],8); ndr->print(ndr, "\n");
- }
- }
-
- if (i%16) {
- int n;
- n = 16 - (i%16);
- ndr->print(ndr, " ");
- if (n>8) ndr->print(ndr," ");
- while (n--) ndr->print(ndr," ");
- n = MIN(8,i%16);
- ndr_print_asc(ndr,&buf[i-(i%16)],n); ndr->print(ndr, " ");
- n = (i%16) - n;
- if (n>0) ndr_print_asc(ndr,&buf[i-n],n);
- ndr->print(ndr,"\n");
- }
-
+ dump_data_cb(buf, len, true, ndr_print_dump_data_cb, ndr);
ndr->no_newline = false;
}