ndr->offset = ofs;
if (ndr->offset > ndr->data_size) {
return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
- "ndr_pull_set_offset %u failed",
+ "ndr_pull_set_offset %"PRIu32" failed",
ofs);
}
return NDR_ERR_SUCCESS;
if (size < ndr->offset) {
/* extra_size overflowed the offset */
- return ndr_push_error(ndr, NDR_ERR_BUFSIZE, "Overflow in push_expand to %u",
+ return ndr_push_error(ndr, NDR_ERR_BUFSIZE, "Overflow in push_expand to %"PRIu32,
size);
}
return ndr_push_error(ndr,
NDR_ERR_BUFSIZE,
"Overflow of fixed buffer in "
- "push_expand to %u",
+ "push_expand to %"PRIu32,
size);
}
}
ndr->data = talloc_realloc(ndr, ndr->data, uint8_t, ndr->alloc_size);
if (!ndr->data) {
- return ndr_push_error(ndr, NDR_ERR_ALLOC, "Failed to push_expand to %u",
+ return ndr_push_error(ndr, NDR_ERR_ALLOC, "Failed to push_expand to %"PRIu32,
ndr->alloc_size);
}
uint16_t content_size;
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &content_size));
if (size_is >= 0 && size_is != content_size) {
- return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) size_is(%d) (0x%04x) mismatch content_size %d (0x%04x)",
- (int)size_is, (int)size_is,
- (int)content_size,
- (int)content_size);
+ return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) size_is(%zd) (0x%04zx) mismatch content_size %"PRIu16" (0x%04"PRIx16")",
+ size_is, size_is,
+ content_size,
+ content_size);
}
r_content_size = content_size;
break;
uint32_t content_size;
NDR_CHECK(ndr_pull_uint3264(ndr, NDR_SCALARS, &content_size));
if (size_is >= 0 && size_is != content_size) {
- return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) size_is(%d) (0x%08x) mismatch content_size %d (0x%08x)",
- (int)size_is, (int)size_is,
- (int)content_size,
- (int)content_size);
+ return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) size_is(%zd) (0x%08zx) mismatch content_size %"PRIu32" (0x%08"PRIx32")",
+ size_is, size_is,
+ content_size,
+ content_size);
}
r_content_size = content_size;
break;
if (version != 1) {
return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT,
- "Bad subcontext (PULL) Common Type Header version %d != 1",
- (int)version);
+ "Bad subcontext (PULL) Common Type Header version %"PRIu8" != 1",
+ version);
}
/*
force_be = true;
} else {
return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT,
- "Bad subcontext (PULL) Common Type Header invalid drep 0x%02X",
- (unsigned int)drep);
+ "Bad subcontext (PULL) Common Type Header invalid drep 0x%02"PRIX8,
+ drep);
}
/* length of the "Private Header for Constructed Type" */
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &hdrlen));
if (hdrlen != 8) {
return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT,
- "Bad subcontext (PULL) Common Type Header length %d != 8",
- (int)hdrlen);
+ "Bad subcontext (PULL) Common Type Header length %"PRIu16" != 8",
+ hdrlen);
}
/* filler should be ignored */
/* length - will be updated later */
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &content_size));
if (size_is >= 0 && size_is != content_size) {
- return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) size_is(%d) mismatch content_size %d",
- (int)size_is, (int)content_size);
+ return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) size_is(%zd) mismatch content_size %"PRIu32,
+ size_is, content_size);
}
/* the content size must be a multiple of 8 */
if ((content_size % 8) != 0) {
return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT,
- "Bad subcontext (PULL) size_is(%d) not padded to 8 content_size %d",
- (int)size_is, (int)content_size);
+ "Bad subcontext (PULL) size_is(%zd) not padded to 8 content_size %"PRIu32,
+ size_is, content_size);
}
r_content_size = content_size;
return NDR_ERR_SUCCESS;
default:
- return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) header_size %d",
- (int)header_size);
+ return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) header_size %zu",
+ header_size);
}
NDR_PULL_NEED_BYTES(ndr, r_content_size);
}
if (highest_ofs < advance) {
return ndr_pull_error(subndr, NDR_ERR_UNREAD_BYTES,
- "not all bytes consumed ofs[%u] advance[%u]",
+ "not all bytes consumed ofs[%"PRIu32"] advance[%"PRIu32"]",
highest_ofs, advance);
}
if (size_is >= 0) {
padding_len = size_is - subndr->offset;
if (padding_len < 0) {
- return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PUSH) content_size %d is larger than size_is(%d)",
- (int)subndr->offset, (int)size_is);
+ return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PUSH) content_size %"PRIu32" is larger than size_is(%zd)",
+ subndr->offset, size_is);
}
subndr->offset = size_is;
}
break;
default:
- return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext header size %d",
- (int)header_size);
+ return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext header size %zu",
+ header_size);
}
NDR_CHECK(ndr_push_bytes(ndr, subndr->data, subndr->offset));
NDR_CHECK(ndr_get_array_size(ndr, p, &stored));
if (stored != size) {
return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
- "Bad array size - got %u expected %u\n",
+ "Bad array size - got %"PRIu32" expected %"PRIu32"\n",
stored, size);
}
return NDR_ERR_SUCCESS;
NDR_CHECK(ndr_pull_uint3264(ndr, NDR_SCALARS, &offset));
if (offset != 0) {
return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
- "non-zero array offset %u\n", offset);
+ "non-zero array offset %"PRIu32"\n", offset);
}
NDR_CHECK(ndr_pull_uint3264(ndr, NDR_SCALARS, &length));
ret = ndr_token_store(ndr, &ndr->array_length_list, p, length);
NDR_CHECK(ndr_steal_array_length(ndr, p, &stored));
if (stored != length) {
return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
- "Bad array length - got %u expected %u\n",
+ "Bad array length: got %"PRIu32" expected %"PRIu32"\n",
stored, length);
}
return NDR_ERR_SUCCESS;
}
return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
- "Bad pipe trailer[%lld should be %lld] size was %lu\"",
- (unsigned long long)ncount2,
- (unsigned long long)ncount1,
- (unsigned long)count);
+ "Bad pipe trailer[%"PRIu64" should be %"PRIu64"] size was %"PRIu32"\"",
+ ncount2,
+ ncount1,
+ count);
}
return NDR_ERR_SUCCESS;
if (highest_ofs < ndr->data_size) {
enum ndr_err_code ret;
ret = ndr_pull_error(ndr, NDR_ERR_UNREAD_BYTES,
- "not all bytes consumed ofs[%u] size[%u]",
+ "not all bytes consumed ofs[%"PRIu32"] size[%"PRIu32"]",
highest_ofs, ndr->data_size);
talloc_free(ndr);
return ret;
if (highest_ofs < ndr->data_size) {
enum ndr_err_code ret;
ret = ndr_pull_error(ndr, NDR_ERR_UNREAD_BYTES,
- "not all bytes consumed ofs[%u] size[%u]",
+ "not all bytes consumed ofs[%"PRIu32"] size[%"PRIu32"]",
highest_ofs, ndr->data_size);
talloc_free(ndr);
return ret;
if (ndr.offset != blob->length) {
return ndr_push_error(&ndr, NDR_ERR_BUFSIZE,
"buffer was either to large or small "
- "ofs[%u] size[%zu]",
+ "ofs[%"PRIu32"] size[%zu]",
ndr.offset, blob->length);
}
NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, p, &ptr_offset));
if (ptr_offset > ndr->offset) {
return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
- "ndr_push_relative_ptr2 ptr_offset(%u) > ndr->offset(%u)",
+ "ndr_push_relative_ptr2 ptr_offset(%"PRIu32") > ndr->offset(%"PRIu32")",
ptr_offset, ndr->offset);
}
ndr->offset = ptr_offset;
if (save_offset < ndr->relative_base_offset) {
return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
- "ndr_push_relative_ptr2 save_offset(%u) < ndr->relative_base_offset(%u)",
+ "ndr_push_relative_ptr2 save_offset(%"PRIu32") < ndr->relative_base_offset(%"PRIu32")",
save_offset, ndr->relative_base_offset);
}
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, save_offset - ndr->relative_base_offset));
if (ndr->offset < ndr->relative_base_offset) {
return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
- "ndr_push_relative_ptr2 ndr->offset(%u) < ndr->relative_base_offset(%u)",
+ "ndr_push_relative_ptr2 ndr->offset(%"PRIu32") < ndr->relative_base_offset(%"PRIu32")",
ndr->offset, ndr->relative_base_offset);
}
relative_offset = ndr->offset - ndr->relative_base_offset;
if (relative_offset > UINT16_MAX) {
return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
- "ndr_push_relative_ptr2 relative_offset(%u) > UINT16_MAX",
+ "ndr_push_relative_ptr2 relative_offset(%"PRIu32") > UINT16_MAX",
relative_offset);
}
NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, p, &ptr_offset));
if (ptr_offset > ndr->offset) {
return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
- "ndr_push_short_relative_ptr2 ptr_offset(%u) > ndr->offset(%u)",
+ "ndr_push_short_relative_ptr2 ptr_offset(%"PRIu32") > ndr->offset(%"PRIu32")",
ptr_offset, ndr->offset);
}
ndr->offset = ptr_offset;
if (ndr->offset < ndr->relative_base_offset) {
return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
- "ndr_push_relative_ptr2_start ndr->offset(%u) < ndr->relative_base_offset(%u)",
+ "ndr_push_relative_ptr2_start ndr->offset(%"PRIu32") < ndr->relative_base_offset(%"PRIu32")",
ndr->offset, ndr->relative_base_offset);
}
}
if (ndr->relative_end_offset == -1) {
return ndr_push_error(ndr, NDR_ERR_RELATIVE,
- "ndr_push_relative_ptr2_start RELATIVE_REVERSE flag set and relative_end_offset %d",
+ "ndr_push_relative_ptr2_start RELATIVE_REVERSE flag set and relative_end_offset %"PRIu32,
ndr->relative_end_offset);
}
ret = ndr_token_store(ndr,
if (ndr->relative_end_offset < ndr->offset) {
return ndr_push_error(ndr, NDR_ERR_RELATIVE,
"ndr_push_relative_ptr2_end:"
- "relative_end_offset %u < offset %u",
+ "relative_end_offset %"PRIu32" < offset %"PRIu32,
ndr->relative_end_offset, ndr->offset);
}
if (len < 0) {
return ndr_push_error(ndr, NDR_ERR_RELATIVE,
"ndr_push_relative_ptr2_end:"
- "offset %u - begin_offset %u < 0",
+ "offset %"PRIu32" - begin_offset %"PRIu32" < 0",
ndr->offset, begin_offset);
}
if (ndr->relative_end_offset < len) {
return ndr_push_error(ndr, NDR_ERR_RELATIVE,
"ndr_push_relative_ptr2_end:"
- "relative_end_offset %u < len %lld",
- ndr->offset, (long long)len);
+ "relative_end_offset %"PRIu32" < len %zd",
+ ndr->offset, len);
}
/* the reversed offset is at the end of the main buffer */
if (correct_offset < begin_offset) {
return ndr_push_error(ndr, NDR_ERR_RELATIVE,
"ndr_push_relative_ptr2_end: "
- "correct_offset %u < begin_offset %u",
+ "correct_offset %"PRIu32" < begin_offset %"PRIu32,
correct_offset, begin_offset);
}
rel_offset += ndr->relative_base_offset;
if (rel_offset > ndr->data_size) {
return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
- "ndr_pull_relative_ptr1 rel_offset(%u) > ndr->data_size(%u)",
+ "ndr_pull_relative_ptr1 rel_offset(%"PRIu32") > ndr->data_size(%"PRIu32")",
rel_offset, ndr->data_size);
}
ret = ndr_token_store(ndr, &ndr->relative_list, p, rel_offset);
}
}
if (i<ofs2) {
- DEBUG(0,("WARNING: Non-zero padding to %d: ", (int)n));
+ DEBUG(0,("WARNING: Non-zero padding to %zu: ", n));
for (i=ndr->offset;i<ofs2;i++) {
DEBUG(0,("%02x ", ndr->data[i]));
}
enum ndr_err_code err = ndr_pull_uint32(ndr, ndr_flags, &v32);
*v = v32;
if (unlikely(v32 != *v)) {
- DEBUG(0,(__location__ ": non-zero upper 16 bits 0x%08x\n", (unsigned)v32));
+ DEBUG(0,(__location__ ": non-zero upper 16 bits 0x%08"PRIx32"\n", v32));
return NDR_ERR_NDR64;
}
return err;
}
*v = (uint32_t)v64;
if (unlikely(v64 != *v)) {
- DEBUG(0,(__location__ ": non-zero upper 32 bits 0x%016llx\n",
- (unsigned long long)v64));
- return ndr_pull_error(ndr, NDR_ERR_NDR64, __location__ ": non-zero upper 32 bits 0x%016llx\n",
- (unsigned long long)v64);
+ DEBUG(0,(__location__ ": non-zero upper 32 bits 0x%016"PRIx64"\n",
+ v64));
+ return ndr_pull_error(ndr, NDR_ERR_NDR64, __location__ ": non-zero upper 32 bits 0x%016"PRIx64"\n",
+ v64);
}
return err;
}
NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &v32));
*v = v32;
if (v32 != *v) {
- DEBUG(0,(__location__ ": non-zero upper 16 bits 0x%08x\n", (unsigned)v32));
+ DEBUG(0,(__location__ ": non-zero upper 16 bits 0x%08"PRIx32"\n", v32));
return NDR_ERR_NDR64;
}
return NDR_ERR_SUCCESS;
NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &uu));
*u = (uid_t)uu;
if (unlikely(uu != *u)) {
- DEBUG(0,(__location__ ": uid_t pull doesn't fit 0x%016llx\n",
- (unsigned long long)uu));
+ DEBUG(0,(__location__ ": uid_t pull doesn't fit 0x%016"PRIx64"\n",
+ uu));
return NDR_ERR_NDR64;
}
return NDR_ERR_SUCCESS;
NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &gg));
*g = (gid_t)gg;
if (unlikely(gg != *g)) {
- DEBUG(0,(__location__ ": gid_t pull doesn't fit 0x%016llx\n",
- (unsigned long long)gg));
+ DEBUG(0,(__location__ ": gid_t pull doesn't fit 0x%016"PRIx64"\n",
+ gg));
return NDR_ERR_NDR64;
}
return NDR_ERR_SUCCESS;
const char *val, uint32_t value)
{
if (ndr->flags & LIBNDR_PRINT_ARRAY_HEX) {
- ndr->print(ndr, "%-25s: %s (0x%X)", name, val?val:"UNKNOWN_ENUM_VALUE", value);
+ ndr->print(ndr, "%-25s: %s (0x%"PRIX32")", name, val?val:"UNKNOWN_ENUM_VALUE", value);
} else {
- ndr->print(ndr, "%-25s: %s (%d)", name, val?val:"UNKNOWN_ENUM_VALUE", value);
+ ndr->print(ndr, "%-25s: %s (%"PRIu32")", name, val?val:"UNKNOWN_ENUM_VALUE", value);
}
}
value >>= 1;
}
if (flag == 1) {
- ndr->print(ndr, " %d: %-25s", value, flag_name);
+ ndr->print(ndr, " %"PRIu32": %-25s", value, flag_name);
} else {
- ndr->print(ndr, "0x%02x: %-25s (%d)", value, flag_name, value);
+ ndr->print(ndr, "0x%02"PRIx32": %-25s (%"PRIu32")", value, flag_name, value);
}
}
ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
return;
}
- ndr->print(ndr, "%-25s: %d", name, v);
+ ndr->print(ndr, "%-25s: %"PRId8, name, v);
}
_PUBLIC_ void ndr_print_uint8(struct ndr_print *ndr, const char *name, uint8_t v)
ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
return;
}
- ndr->print(ndr, "%-25s: 0x%02x (%u)", name, v, v);
+ ndr->print(ndr, "%-25s: 0x%02"PRIx8" (%"PRIu8")", name, v, v);
}
_PUBLIC_ void ndr_print_int16(struct ndr_print *ndr, const char *name, int16_t v)
ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
return;
}
- ndr->print(ndr, "%-25s: %d", name, v);
+ ndr->print(ndr, "%-25s: %"PRId16, name, v);
}
_PUBLIC_ void ndr_print_uint16(struct ndr_print *ndr, const char *name, uint16_t v)
ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
return;
}
- ndr->print(ndr, "%-25s: 0x%04x (%u)", name, v, v);
+ ndr->print(ndr, "%-25s: 0x%04"PRIx16" (%"PRIu16")", name, v, v);
}
_PUBLIC_ void ndr_print_int32(struct ndr_print *ndr, const char *name, int32_t v)
ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
return;
}
- ndr->print(ndr, "%-25s: %d", name, v);
+ ndr->print(ndr, "%-25s: %"PRId32, name, v);
}
_PUBLIC_ void ndr_print_uint32(struct ndr_print *ndr, const char *name, uint32_t v)
ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
return;
}
- ndr->print(ndr, "%-25s: 0x%08x (%u)", name, v, v);
+ ndr->print(ndr, "%-25s: 0x%08"PRIx32" (%"PRIu32")", name, v, v);
}
_PUBLIC_ void ndr_print_int3264(struct ndr_print *ndr, const char *name, int32_t v)
ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
return;
}
- ndr->print(ndr, "%-25s: %d", name, v);
+ ndr->print(ndr, "%-25s: %"PRId32, name, v);
}
_PUBLIC_ void ndr_print_uint3264(struct ndr_print *ndr, const char *name, uint32_t v)
ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
return;
}
- ndr->print(ndr, "%-25s: 0x%08x (%u)", name, v, v);
+ ndr->print(ndr, "%-25s: 0x%08"PRIx32" (%"PRIu32")", name, v, v);
}
_PUBLIC_ void ndr_print_udlong(struct ndr_print *ndr, const char *name, uint64_t v)
{
- ndr->print(ndr, "%-25s: 0x%016llx (%llu)", name, (unsigned long long)v, (unsigned long long)v);
+ ndr->print(ndr, "%-25s: 0x%016"PRIx64" (%"PRIu64")", name, v, v);
}
_PUBLIC_ void ndr_print_udlongr(struct ndr_print *ndr, const char *name, uint64_t v)
ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name);
return;
}
- ndr->print(ndr, "%-25s: 0x%016llx (%lld)", name, (unsigned long long)v, (long long)v);
+ ndr->print(ndr, "%-25s: 0x%016"PRIx64" (%"PRId64")", name, v, v);
}
_PUBLIC_ void ndr_print_double(struct ndr_print *ndr, const char *name, double v)
_PUBLIC_ void ndr_print_bad_level(struct ndr_print *ndr, const char *name, uint16_t level)
{
- ndr->print(ndr, "UNKNOWN LEVEL %u", level);
+ ndr->print(ndr, "UNKNOWN LEVEL %"PRIu16, level);
}
_PUBLIC_ void ndr_print_array_uint8(struct ndr_print *ndr, const char *name,
const uint8_t *data, uint32_t count)
{
- int i;
+ uint32_t i;
#define _ONELINE_LIMIT 32
if (data == NULL) {
- ndr->print(ndr, "%s: ARRAY(%d) : NULL", name, count);
+ ndr->print(ndr, "%s: ARRAY(%"PRIu32") : NULL", name, count);
return;
}
if (NDR_HIDE_SECRET(ndr)) {
- ndr->print(ndr, "%s: ARRAY(%d): <REDACTED SECRET VALUES>", name, count);
+ ndr->print(ndr, "%s: ARRAY(%"PRIu32"): <REDACTED SECRET VALUES>", name, count);
return;
}
if (count <= _ONELINE_LIMIT && (ndr->flags & LIBNDR_PRINT_ARRAY_HEX)) {
char s[(_ONELINE_LIMIT + 1) * 2];
for (i=0;i<count;i++) {
- snprintf(&s[i*2], 3, "%02x", data[i]);
+ snprintf(&s[i*2], 3, "%02"PRIx8, data[i]);
}
s[i*2] = 0;
ndr->print(ndr, "%-25s: %s", name, s);
return;
}
- ndr->print(ndr, "%s: ARRAY(%d)", name, count);
+ ndr->print(ndr, "%s: ARRAY(%"PRIu32")", name, count);
if (count > _ONELINE_LIMIT && (ndr->flags & LIBNDR_PRINT_ARRAY_HEX)) {
ndr_dump_data(ndr, data, count);
return;
ndr->depth++;
for (i=0;i<count;i++) {
char *idx=NULL;
- if (asprintf(&idx, "[%d]", i) != -1) {
+ if (asprintf(&idx, "[%"PRIu32"]", i) != -1) {
ndr_print_uint8(ndr, idx, data[i]);
free(idx);
}
_PUBLIC_ void ndr_print_DATA_BLOB(struct ndr_print *ndr, const char *name, DATA_BLOB r)
{
- ndr->print(ndr, "%-25s: DATA_BLOB length=%u", name, (unsigned)r.length);
+ ndr->print(ndr, "%-25s: DATA_BLOB length=%zu", name, r.length);
if (r.length) {
ndr_dump_data(ndr, r.data, r.length);
}
year += 1980;
month = (r->date >> 5 & 0xf);
day = (r->date & 0x1f);
- s = talloc_asprintf(ndr, "%02d/%02d/%04d", day, month, year);
+ s = talloc_asprintf(ndr, "%02"PRIu8"/%02"PRIu8"/%04"PRIu16, day, month, year);
if (s == NULL) { return; }
ndr_print_string(ndr, "date", s);
talloc_free(s);
if (plain_chunk_size > 0x00008000) {
return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
- "Bad MSZIP CAB plain chunk size %08X > 0x00008000 (PULL)",
+ "Bad MSZIP CAB plain chunk size %08"PRIX32" > 0x00008000 (PULL)",
plain_chunk_size);
}
comp_chunk_size = compressed_len;
- DEBUG(9,("MSZIP CAB plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
+ DEBUG(9,("MSZIP CAB plain_chunk_size: %08"PRIX32" (%"PRIu32") comp_chunk_size: %08"PRIX32" (%"PRIu32")\n",
plain_chunk_size, plain_chunk_size, comp_chunk_size, comp_chunk_size));
comp_chunk_offset = ndrpull->offset;
if (comp_chunk.length < 2) {
return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
- "Bad MSZIP CAB comp chunk size %u < 2 (PULL)",
- (unsigned int)comp_chunk.length);
+ "Bad MSZIP CAB comp chunk size %zu < 2 (PULL)",
+ comp_chunk.length);
}
/* CK = Chris Kirmse, official Microsoft purloiner */
if (comp_chunk.data[0] != 'C' ||
memcpy(state->alg.mszip.dict, plain_chunk.data, plain_chunk.length);
state->alg.mszip.dict_size = plain_chunk.length;
- DEBUG(9,("MSZIP comp plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
- (unsigned int)plain_chunk.length,
- (unsigned int)plain_chunk.length,
+ DEBUG(9,("MSZIP comp plain_chunk_size: %08zX (%zu) comp_chunk_size: %08"PRIX32" (%"PRIu32")\n",
+ plain_chunk.length,
+ plain_chunk.length,
comp_chunk_size, comp_chunk_size));
ndrpush->offset += comp_chunk_size;
NDR_CHECK(ndr_pull_uint32(ndrpull, NDR_SCALARS, &plain_chunk_size));
if (plain_chunk_size > 0x00008000) {
- return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION, "Bad MSZIP plain chunk size %08X > 0x00008000 (PULL)",
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION, "Bad MSZIP plain chunk size %08"PRIX32" > 0x00008000 (PULL)",
plain_chunk_size);
}
NDR_CHECK(ndr_pull_uint32(ndrpull, NDR_SCALARS, &comp_chunk_size));
- DEBUG(9,("MSZIP plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
+ DEBUG(9,("MSZIP plain_chunk_size: %08"PRIX32" (%"PRIu32") comp_chunk_size: %08"PRIX32" (%"PRIu32")\n",
plain_chunk_size, plain_chunk_size, comp_chunk_size, comp_chunk_size));
comp_chunk_offset = ndrpull->offset;
if (comp_chunk.length < 2) {
return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
- "Bad MSZIP comp chunk size %u < 2 (PULL)",
- (unsigned int)comp_chunk.length);
+ "Bad MSZIP comp chunk size %zu < 2 (PULL)",
+ comp_chunk.length);
}
/* CK = Chris Kirmse, official Microsoft purloiner */
if (comp_chunk.data[0] != 'C' ||
NDR_CHECK(ndr_push_uint32(ndrpush, NDR_SCALARS, comp_chunk_size));
ndrpush->offset = tmp_offset;
- DEBUG(9,("MSZIP comp plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
- (unsigned int)plain_chunk.length,
- (unsigned int)plain_chunk.length,
+ DEBUG(9,("MSZIP comp plain_chunk_size: %08zX (%zu) comp_chunk_size: %08"PRIX32" (%"PRIu32")\n",
+ plain_chunk.length,
+ plain_chunk.length,
comp_chunk_size, comp_chunk_size));
ndrpush->offset += comp_chunk_size;
NDR_CHECK(ndr_pull_uint32(ndrpull, NDR_SCALARS, &plain_chunk_size));
if (plain_chunk_size > 0x00010000) {
- return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION, "Bad XPRESS plain chunk size %08X > 0x00010000 (PULL)",
+ return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION, "Bad XPRESS plain chunk size %08"PRIX32" > 0x00010000 (PULL)",
plain_chunk_size);
}
plain_chunk.length = plain_chunk_size;
plain_chunk.data = ndrpush->data + plain_chunk_offset;
- DEBUG(9,("XPRESS plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
+ DEBUG(9,("XPRESS plain_chunk_size: %08"PRIX32" (%"PRIu32") comp_chunk_size: %08"PRIX32" (%"PRIu32")\n",
plain_chunk_size, plain_chunk_size, comp_chunk_size, comp_chunk_size));
/* Uncompressing the buffer using LZ Xpress algorithm */
plain_chunk.length);
if (ret < 0) {
return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
- "XPRESS lzxpress_decompress() returned %d\n",
- (int)ret);
+ "XPRESS lzxpress_decompress() returned %zd\n",
+ ret);
}
plain_chunk.length = ret;
comp_chunk.length);
if (ret < 0) {
return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
- "XPRESS lzxpress_compress() returned %d\n",
- (int)ret);
+ "XPRESS lzxpress_compress() returned %zd\n",
+ ret);
}
comp_chunk.length = ret;
uncompressed = ndr_push_blob(ndrpush);
if (uncompressed.length != decompressed_len) {
return ndr_pull_error(subndr, NDR_ERR_COMPRESSION,
- "Bad uncompressed_len [%u] != [%u](0x%08X) (PULL)",
- (int)uncompressed.length,
- (int)decompressed_len,
- (int)decompressed_len);
+ "Bad uncompressed_len [%zu] != [%zd](0x%08zX) (PULL)",
+ uncompressed.length,
+ decompressed_len,
+ decompressed_len);
}
comndr = talloc_zero(subndr, struct ndr_pull);
/* its a reserved length field */
return ndr_pull_error(ndr, NDR_ERR_STRING,
"BAD DNS NAME component, " \
- "reserved length field: 0x%02x",
+ "reserved length field: 0x%02"PRIx8,
(len &0xC));
}
if (*offset + len + 1 > ndr->data_size) {
return ndr_push_error(ndr, NDR_ERR_STRING,
"offset for dns string " \
"label pointer " \
- "%u[%08X] > 0x00003FFF",
+ "%"PRIu32"[%08"PRIX32"] > 0x00003FFF",
offset, offset);
}
/* the length must fit into 6 bits (i.e. <= 63) */
if (complen > 0x3F) {
return ndr_push_error(ndr, NDR_ERR_STRING,
- "component length %u[%08X] > " \
+ "component length %zu[%08zX] > " \
"0x0000003F",
- (unsigned)complen,
- (unsigned)complen);
+ complen,
+ complen);
}
if (complen == 0 && s[complen] == '.') {
return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull dnsp_name - not NUL terminated");
}
if (ndr->offset > raw_offset + len) {
- return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull dnsp_name - overrun by %u bytes",
+ return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Failed to pull dnsp_name - overrun by %"PRIu32" bytes",
ndr->offset - (raw_offset + len));
}
/* there could be additional pad bytes */
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
ndr->depth++;
ndr_print_uint16(ndr, "entryID", r->entryID);
- ndr->print(ndr, "%-25s: length=%u", "oid", r->length);
+ ndr->print(ndr, "%-25s: length=%"PRIu16, "oid", r->length);
if (r->binary_oid) {
char *partial_oid = NULL;
DATA_BLOB oid_blob = data_blob_const(r->binary_oid, r->length);
ndr_print_struct(ndr, name, "drsuapi_DsReplicaOID");
ndr->depth++;
ndr_print_uint32(ndr, "length", r->length);
- ndr->print(ndr, "%-25s: length=%u", "oid", r->length);
+ ndr->print(ndr, "%-25s: length=%"PRIu32, "oid", r->length);
if (r->binary_oid) {
char *partial_oid = NULL;
DATA_BLOB oid_blob = data_blob_const(r->binary_oid, r->length);
ndr_print_ptr(ndr, "values", r->values);
ndr->depth++;
if (r->values) {
- ndr->print(ndr, "%s: ARRAY(%d)", "values", (int)r->num_values);
+ ndr->print(ndr, "%s: ARRAY(%"PRIu32")", "values", r->num_values);
ndr->depth++;
for (cntr_values_1=0;cntr_values_1<r->num_values;cntr_values_1++) {
char *idx_1=NULL;
- if (asprintf(&idx_1, "[%d]", cntr_values_1) != -1) {
+ if (asprintf(&idx_1, "[%"PRIu32"]", cntr_values_1) != -1) {
//ndr_print_drsuapi_DsAttributeValue(ndr, "values", &r->values[cntr_values_1]);
print_val_fn(ndr, "values", &r->values[cntr_values_1]);
free(idx_1);
snprintf(dst->buf,
sizeof(dst->buf),
- "%s/0x%08x",
+ "%s/0x%08"PRIx32,
GUID_buf_string(&id->uuid, &guid_buf),
- (unsigned int)id->if_version);
+ id->if_version);
return dst->buf;
}
ndr, ndr_flags, &r->data.nt5_ex, r->ntver));
if (ndr->offset < ndr->data_size) {
return ndr_pull_error(ndr, NDR_ERR_UNREAD_BYTES,
- "not all bytes consumed ofs[%u] size[%u]",
+ "not all bytes consumed ofs[%"PRIu32"] size[%"PRIu32"]",
ndr->offset, ndr->data_size);
}
} else if (r->ntver & NETLOGON_NT_VERSION_5) {
NDR_CHECK(ndr_pull_dom_sid(ndr, ndr_flags, sid));
if (sid->num_auths != num_auths) {
return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
- "Bad num_auths %u; should equal %u",
+ "Bad num_auths %"PRIu32"; should equal %"PRId8,
num_auths, sid->num_auths);
}
return NDR_ERR_SUCCESS;
if (sid->num_auths > 5) {
return ndr_push_error(ndr, NDR_ERR_RANGE,
- "dom_sid28 allows only up to 5 sub auth [%u]",
+ "dom_sid28 allows only up to 5 sub auths [%"PRId8"]",
sid->num_auths);
}
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &len1));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &ofs));
if (ofs != 0) {
- return ndr_pull_error(ndr, NDR_ERR_STRING, "non-zero array offset with string flags 0x%x\n",
+ return ndr_pull_error(ndr, NDR_ERR_STRING, "non-zero array offset with string flags 0x%"PRIx32"\n",
ndr->flags & LIBNDR_STRING_FLAGS);
}
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &len2));
if (len2 > len1) {
return ndr_pull_error(ndr, NDR_ERR_STRING,
- "Bad string lengths len1=%u ofs=%u len2=%u\n",
+ "Bad string lengths len1=%"PRIu32" ofs=%"PRIu32" len2=%"PRIu32"\n",
len1, ofs, len2);
} else if (len1 != len2) {
- DEBUG(6,("len1[%u] != len2[%u] '%s'\n", len1, len2, as));
+ DEBUG(6,("len1[%"PRIu32"] != len2[%"PRIu32"] '%s'\n", len1, len2, as));
}
conv_src_len = len2 + c_len_term;
break;
case LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_NOTERM:
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &ofs));
if (ofs != 0) {
- return ndr_pull_error(ndr, NDR_ERR_STRING, "non-zero array offset with string flags 0x%x\n",
+ return ndr_pull_error(ndr, NDR_ERR_STRING, "non-zero array offset with string flags 0x%"PRIx32"\n",
ndr->flags & LIBNDR_STRING_FLAGS);
}
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &len1));
case LIBNDR_FLAG_STR_NOTERM:
if (!(ndr->flags & LIBNDR_FLAG_REMAINING)) {
- return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x (missing NDR_REMAINING)\n",
+ return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%"PRIx32" (missing NDR_REMAINING)\n",
ndr->flags & LIBNDR_STRING_FLAGS);
}
conv_src_len = ndr->data_size - ndr->offset;
break;
default:
- return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x\n",
+ return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%"PRIx32"\n",
ndr->flags & LIBNDR_STRING_FLAGS);
}
&as,
&converted_size)) {
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
- "Bad character conversion with flags 0x%x", flags);
+ "Bad character conversion with flags 0x%"PRIx32, flags);
}
}
ssize_t s_len, c_len;
size_t d_len;
int do_convert = 1, chset = CH_UTF16;
- unsigned flags = ndr->flags;
+ uint32_t flags = ndr->flags;
unsigned byte_mul = 2;
uint8_t *dest = NULL;
&dest, &d_len))
{
return ndr_push_error(ndr, NDR_ERR_CHARCNV,
- "Bad character push conversion with flags 0x%x", flags);
+ "Bad character push conversion with flags 0x%"PRIx32, flags);
}
if (flags & LIBNDR_FLAG_STR_BYTESIZE) {
break;
}
- return ndr_push_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x\n",
+ return ndr_push_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%"PRIx32"\n",
ndr->flags & LIBNDR_STRING_FLAGS);
}
case LIBNDR_FLAG_STR_NOTERM:
if (!(ndr->flags & LIBNDR_FLAG_REMAINING)) {
- return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x (missing NDR_REMAINING)\n",
+ return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%"PRIx32" (missing NDR_REMAINING)\n",
ndr->flags & LIBNDR_STRING_FLAGS);
}
/*
break;
default:
- return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x\n",
+ return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%"PRIx32"\n",
ndr->flags & LIBNDR_STRING_FLAGS);
}
case LIBNDR_FLAG_STR_NOTERM:
if (!(ndr->flags & LIBNDR_FLAG_REMAINING)) {
- return ndr_push_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x (missing NDR_REMAINING)\n",
+ return ndr_push_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%"PRIx32" (missing NDR_REMAINING)\n",
ndr->flags & LIBNDR_STRING_FLAGS);
}
break;
default:
- return ndr_push_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x\n",
+ return ndr_push_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%"PRIx32"\n",
ndr->flags & LIBNDR_STRING_FLAGS);
}
for (count = 0; a && a[count]; count++) {}
- ndr->print(ndr, "%s: ARRAY(%d)", name, count);
+ ndr->print(ndr, "%s: ARRAY(%"PRIu32")", name, count);
ndr->depth++;
for (i=0;i<count;i++) {
char *idx=NULL;
- if (asprintf(&idx, "[%d]", i) != -1) {
+ if (asprintf(&idx, "[%"PRIu32"]", i) != -1) {
ndr_print_string(ndr, idx, a[i]);
free(idx);
}
switch (r->version) {
case 0xFFFF:
- attrib_hex = talloc_asprintf(mem_ctx, "0x%x",
+ attrib_hex = talloc_asprintf(mem_ctx, "0x%"PRIx32,
r->info.compatinfoFFFF.attrib);
break;
case 1:
- attrib_hex = talloc_asprintf(mem_ctx, "0x%x",
+ attrib_hex = talloc_asprintf(mem_ctx, "0x%"PRIx32,
r->info.info1.attrib);
break;
case 2:
- attrib_hex = talloc_asprintf(mem_ctx, "0x%x",
+ attrib_hex = talloc_asprintf(mem_ctx, "0x%"PRIx32,
r->info.oldinfo2.attrib);
break;
case 3:
attrib_hex = talloc_strdup(mem_ctx, "");
break;
}
- attrib_hex = talloc_asprintf(mem_ctx, "0x%x",
+ attrib_hex = talloc_asprintf(mem_ctx, "0x%"PRIx32,
r->info.info3.attrib);
break;
default:
if (r->version == 0xFFFF) {
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH,
"ndr_pull_xattr_DOSATTRIB: "
- "invalid level 0x%02X",
+ "invalid level 0x%02"PRIX16,
r->version);
}
NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->info, r->version));
return NULL;
}
snprintf(dst->buf, sizeof(dst->buf),
- "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ "%08"PRIx32"-%04"PRIx16"-%04"PRIx16"-%02"PRIx8"%02"PRIx8"-%02"PRIx8"%02"PRIx8"%02"PRIx8"%02"PRIx8"%02"PRIx8"%02"PRIx8,
guid->time_low, guid->time_mid,
guid->time_hi_and_version,
guid->clock_seq[0],