librpc/ndr: Use portable format specifiers
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 10 May 2021 22:28:07 +0000 (10:28 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 27 Sep 2023 02:43:28 +0000 (02:43 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
15 files changed:
librpc/ndr/ndr.c
librpc/ndr/ndr_basic.c
librpc/ndr/ndr_cab.c
librpc/ndr/ndr_compression.c
librpc/ndr/ndr_dns.c
librpc/ndr/ndr_dns_utils.c
librpc/ndr/ndr_dnsp.c
librpc/ndr/ndr_drsblobs.c
librpc/ndr/ndr_drsuapi.c
librpc/ndr/ndr_misc.c
librpc/ndr/ndr_nbt.c
librpc/ndr/ndr_sec_helper.c
librpc/ndr/ndr_string.c
librpc/ndr/ndr_xattr.c
librpc/ndr/uuid.c

index a2a8585249e086c3f8339315440a2029a84cc315..fc74fa31fb8271d2870ecf031e63c4ba54f8c470 100644 (file)
@@ -218,7 +218,7 @@ static enum ndr_err_code ndr_pull_set_offset(struct ndr_pull *ndr, uint32_t ofs)
        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;
@@ -266,7 +266,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_expand(struct ndr_push *ndr, uint32_t extra_
 
        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);
        }
 
@@ -277,7 +277,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_expand(struct ndr_push *ndr, uint32_t extra_
                return ndr_push_error(ndr,
                                      NDR_ERR_BUFSIZE,
                                      "Overflow of fixed buffer in "
-                                     "push_expand to %u",
+                                     "push_expand to %"PRIu32,
                                      size);
        }
 
@@ -294,7 +294,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_expand(struct ndr_push *ndr, uint32_t extra_
        }
        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);
        }
 
@@ -707,10 +707,10 @@ _PUBLIC_ enum ndr_err_code ndr_pull_subcontext_start(struct ndr_pull *ndr,
                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;
@@ -720,10 +720,10 @@ _PUBLIC_ enum ndr_err_code ndr_pull_subcontext_start(struct ndr_pull *ndr,
                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;
@@ -745,8 +745,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_subcontext_start(struct ndr_pull *ndr,
 
                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);
                }
 
                /*
@@ -760,16 +760,16 @@ _PUBLIC_ enum ndr_err_code ndr_pull_subcontext_start(struct ndr_pull *ndr,
                        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 */
@@ -781,14 +781,14 @@ _PUBLIC_ enum ndr_err_code ndr_pull_subcontext_start(struct ndr_pull *ndr,
                /* 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;
 
@@ -814,8 +814,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_subcontext_start(struct ndr_pull *ndr,
                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);
@@ -870,7 +870,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_subcontext_end(struct ndr_pull *ndr,
        }
        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);
        }
 
@@ -918,8 +918,8 @@ _PUBLIC_ enum ndr_err_code ndr_push_subcontext_end(struct ndr_push *ndr,
        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;
        }
@@ -972,8 +972,8 @@ _PUBLIC_ enum ndr_err_code ndr_push_subcontext_end(struct ndr_push *ndr,
                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));
@@ -1147,7 +1147,7 @@ _PUBLIC_ enum ndr_err_code ndr_check_array_size(struct ndr_pull *ndr, const void
        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;
@@ -1163,7 +1163,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_array_length(struct ndr_pull *ndr, const voi
        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);
@@ -1201,7 +1201,7 @@ _PUBLIC_ enum ndr_err_code ndr_check_steal_array_length(struct ndr_pull *ndr, co
        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;
@@ -1232,10 +1232,10 @@ _PUBLIC_ enum ndr_err_code ndr_check_pipe_chunk_trailer(struct ndr_pull *ndr, in
                }
 
                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;
@@ -1337,7 +1337,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLO
        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;
@@ -1423,7 +1423,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC
        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;
@@ -1472,7 +1472,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_struct_into_fixed_blob(
        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);
        }
 
@@ -1665,13 +1665,13 @@ static enum ndr_err_code ndr_push_relative_ptr2(struct ndr_push *ndr, const void
        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));
@@ -1696,7 +1696,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_short_relative_ptr2(struct ndr_push *ndr, co
 
        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);
        }
 
@@ -1720,7 +1720,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_short_relative_ptr2(struct ndr_push *ndr, co
        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);
        }
 
@@ -1728,7 +1728,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_short_relative_ptr2(struct ndr_push *ndr, co
        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;
@@ -1754,7 +1754,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_relative_ptr2_start(struct ndr_push *ndr, co
 
                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);
                }
 
@@ -1779,7 +1779,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_relative_ptr2_start(struct ndr_push *ndr, co
        }
        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,
@@ -1823,7 +1823,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_relative_ptr2_end(struct ndr_push *ndr, cons
        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);
        }
 
@@ -1835,15 +1835,15 @@ _PUBLIC_ enum ndr_err_code ndr_push_relative_ptr2_end(struct ndr_push *ndr, cons
        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 */
@@ -1868,7 +1868,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_relative_ptr2_end(struct ndr_push *ndr, cons
        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);
        }
 
@@ -1951,7 +1951,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_relative_ptr1(struct ndr_pull *ndr, const vo
        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);
index ecd66a8fa39e151142d8b80018f001cfe2cacabf..8820c0f5cec0715051b8c1cecf691dfe975fdcce 100644 (file)
@@ -92,7 +92,7 @@ _PUBLIC_ void ndr_check_padding(struct ndr_pull *ndr, size_t n)
                }
        }
        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]));
                }
@@ -162,7 +162,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_uint1632(struct ndr_pull *ndr, int ndr_flags
                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;
@@ -213,10 +213,10 @@ _PUBLIC_ enum ndr_err_code ndr_pull_uint3264(struct ndr_pull *ndr, int ndr_flags
        }
        *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;
 }
@@ -421,7 +421,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_enum_uint1632(struct ndr_pull *ndr, int ndr_
                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;
@@ -971,8 +971,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_uid_t(struct ndr_pull *ndr, int ndr_flags, u
        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;
@@ -997,8 +997,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_gid_t(struct ndr_pull *ndr, int ndr_flags, g
        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;
@@ -1121,9 +1121,9 @@ _PUBLIC_ void ndr_print_enum(struct ndr_print *ndr, const char *name, const char
                    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);
        }
 }
 
@@ -1141,9 +1141,9 @@ _PUBLIC_ void ndr_print_bitmap_flag(struct ndr_print *ndr, size_t size, const ch
                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);
        }
 }
 
@@ -1153,7 +1153,7 @@ _PUBLIC_ void ndr_print_int8(struct ndr_print *ndr, const char *name, int8_t v)
                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)
@@ -1162,7 +1162,7 @@ _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)
@@ -1171,7 +1171,7 @@ _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)
@@ -1180,7 +1180,7 @@ _PUBLIC_ void ndr_print_uint16(struct ndr_print *ndr, const char *name, uint16_t
                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)
@@ -1189,7 +1189,7 @@ _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)
@@ -1198,7 +1198,7 @@ _PUBLIC_ void ndr_print_uint32(struct ndr_print *ndr, const char *name, uint32_t
                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)
@@ -1207,7 +1207,7 @@ _PUBLIC_ void ndr_print_int3264(struct ndr_print *ndr, const char *name, int32_t
                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)
@@ -1216,12 +1216,12 @@ _PUBLIC_ void ndr_print_uint3264(struct ndr_print *ndr, const char *name, uint32
                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)
@@ -1235,7 +1235,7 @@ _PUBLIC_ void ndr_print_dlong(struct ndr_print *ndr, const char *name, int64_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)
@@ -1315,36 +1315,36 @@ _PUBLIC_ void ndr_print_union(struct ndr_print *ndr, const char *name, int level
 
 _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;
@@ -1353,7 +1353,7 @@ _PUBLIC_ void ndr_print_array_uint8(struct ndr_print *ndr, const char *name,
        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);
                }
@@ -1385,7 +1385,7 @@ static void ndr_dump_data(struct ndr_print *ndr, const uint8_t *buf, int len)
 
 _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);
        }
index 3efb14fc8743c972a461bc33a1357feb263ad2bd..950c6dcf671f18dedf1b570a62051c09230c77d9 100644 (file)
@@ -49,7 +49,7 @@ _PUBLIC_ void ndr_print_cf_date(struct ndr_print *ndr, const char *name, const s
        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);
index 047971a9bbfd8a2d0ef6f4dbce519df8e76e0255..1a2dea6e6d700a950c93ccc84f4d8ff65802c06a 100644 (file)
@@ -70,14 +70,14 @@ static enum ndr_err_code ndr_pull_compression_mszip_cab_chunk(struct ndr_pull *n
 
        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;
@@ -92,8 +92,8 @@ static enum ndr_err_code ndr_pull_compression_mszip_cab_chunk(struct ndr_pull *n
 
        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' ||
@@ -296,9 +296,9 @@ static enum ndr_err_code ndr_push_compression_mszip_cab_chunk(struct ndr_push *n
        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;
@@ -321,13 +321,13 @@ static enum ndr_err_code ndr_pull_compression_mszip_chunk(struct ndr_pull *ndrpu
 
        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;
@@ -342,8 +342,8 @@ static enum ndr_err_code ndr_pull_compression_mszip_chunk(struct ndr_pull *ndrpu
 
        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' ||
@@ -533,9 +533,9 @@ static enum ndr_err_code ndr_push_compression_mszip_chunk(struct ndr_push *ndrpu
        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;
@@ -556,7 +556,7 @@ static enum ndr_err_code ndr_pull_compression_xpress_chunk(struct ndr_pull *ndrp
 
        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);
        }
 
@@ -572,7 +572,7 @@ static enum ndr_err_code ndr_pull_compression_xpress_chunk(struct ndr_pull *ndrp
        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 */
@@ -582,8 +582,8 @@ static enum ndr_err_code ndr_pull_compression_xpress_chunk(struct ndr_pull *ndrp
                                  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;
 
@@ -636,8 +636,8 @@ static enum ndr_err_code ndr_push_compression_xpress_chunk(struct ndr_push *ndrp
                                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;
 
@@ -867,10 +867,10 @@ enum ndr_err_code ndr_pull_compression_start(struct ndr_pull *subndr,
        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);
index 966e0b5978647892966088dc48b091d185dc462c..e85cc15d4d03b503b308e052b91ad5ef876aa7e1 100644 (file)
@@ -87,7 +87,7 @@ static enum ndr_err_code ndr_pull_component(struct ndr_pull *ndr,
                        /* 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) {
index d89affe8a9a178eca18c188f5bc3e4c5a70cea7d..e9c43681feb1603b2fe8105836f4ce45911d83a2 100644 (file)
@@ -61,7 +61,7 @@ enum ndr_err_code ndr_push_dns_string_list(struct ndr_push *ndr,
                                        return ndr_push_error(ndr, NDR_ERR_STRING,
                                                              "offset for dns string " \
                                                              "label pointer " \
-                                                             "%u[%08X] > 0x00003FFF",
+                                                             "%"PRIu32"[%08"PRIX32"] > 0x00003FFF",
                                                              offset, offset);
                                }
 
@@ -77,10 +77,10 @@ enum ndr_err_code ndr_push_dns_string_list(struct ndr_push *ndr,
                /* 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] == '.') {
index d75c58fca3773e67ebbc11538e6424a640cabe34..ac469c312d5b3ebcb0a38f476a9296f9673e5782 100644 (file)
@@ -84,7 +84,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_dnsp_name(struct ndr_pull *ndr, int ndr_flag
                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 */
index b0d3f50b4a41f68f745fe936e8c4e7585b65791f..99dd32e0416e17418bf6d93d084a7a5e74deb5e7 100644 (file)
@@ -133,7 +133,7 @@ _PUBLIC_ void ndr_print_drsuapi_MSPrefixMap_Entry(struct ndr_print *ndr, const c
                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);
index c07ba48ff4b5e4339295ef7d65cdd6b0943bcbbe..39c1cd245b48856aec83b280ed51ca916845969b 100644 (file)
@@ -72,7 +72,7 @@ _PUBLIC_ void ndr_print_drsuapi_DsReplicaOID(struct ndr_print *ndr, const char *
        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);
@@ -142,11 +142,11 @@ static void _print_drsuapi_DsAttributeValueCtr(struct ndr_print *ndr,
        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);
index d7ebb066b8a278df4bd5558280b29827557520e2..de8dcb468edff10ef8db97a14dab6debc1a202e7 100644 (file)
@@ -46,9 +46,9 @@ char *ndr_syntax_id_buf_string(
 
        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;
 }
index 8ed9f0a5f05489288fe912cb7c7ae51991bcf5c4..6a5f356471b33d43592cf78d9b2e06daebe6e833 100644 (file)
@@ -379,7 +379,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netlogon_samlogon_response(struct ndr_pull *
                        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) {
index e16f8fe1f268f02f2c503b49010cf50add917575..ca229d027c30b08aaa00221432f95140def66609 100644 (file)
@@ -191,7 +191,7 @@ enum ndr_err_code ndr_pull_dom_sid2(struct ndr_pull *ndr, int ndr_flags, struct
        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;
@@ -262,7 +262,7 @@ enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const
 
        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);
        }
 
index de0dddcd920c49294dd2ae42ccfff4c2a323462a..82a1a2b18f3349dec11c55e9297a161711418c22 100644 (file)
@@ -74,16 +74,16 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags,
                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;
@@ -104,7 +104,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags,
        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));
@@ -141,7 +141,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_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);
                }
                conv_src_len = ndr->data_size - ndr->offset;
@@ -149,7 +149,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_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);
        }
 
@@ -173,7 +173,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_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);
                }
        }
 
@@ -204,7 +204,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_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;
 
@@ -252,7 +252,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_flags,
                                          &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) {
@@ -299,7 +299,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_flags,
                        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);
        }
 
@@ -456,7 +456,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string_array(struct ndr_pull *ndr, int ndr_f
 
        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);
                }
                /*
@@ -498,7 +498,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string_array(struct ndr_pull *ndr, int ndr_f
                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);
        }
 
@@ -533,7 +533,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_string_array(struct ndr_push *ndr, int ndr_f
 
        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);
                }
 
@@ -550,7 +550,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_string_array(struct ndr_push *ndr, int ndr_f
                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);
        }
 
@@ -565,11 +565,11 @@ _PUBLIC_ void ndr_print_string_array(struct ndr_print *ndr, const char *name, co
 
        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);
                }
index 930f5106122d3834290460bfe93755afaa818327..641e16161a0b3f10f307c0d27c4c953cbfff6005 100644 (file)
@@ -29,15 +29,15 @@ static char *ndr_compat_xattr_attrib_hex(TALLOC_CTX *mem_ctx,
 
        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:
@@ -45,7 +45,7 @@ static char *ndr_compat_xattr_attrib_hex(TALLOC_CTX *mem_ctx,
                        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:
@@ -116,7 +116,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_xattr_DOSATTRIB(struct ndr_pull *ndr, int nd
                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));
index 6a8d31e065fe3a29eb467521ff40da319ab34206..a7599008c3c951ec3eb5fd10c2459107b8ff3ed8 100644 (file)
@@ -209,7 +209,7 @@ _PUBLIC_ char* GUID_buf_string(const struct GUID *guid,
                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],