Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-10235

Indicating the byte order in the format string does not work

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT11.2.0, 6.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • 2
    • Storage Engines - 2022-12-12

      This ticket comes from this conversation.

      The packing documentation says the following:

      The first character of the format string can be used to indicate the byte order, size and alignment of the packed data
      

      To reproduce the issue apply the following diff:

      diff --git a/examples/c/ex_pack.c b/examples/c/ex_pack.c
      index b0e03114e..1af9af122 100644
      --- a/examples/c/ex_pack.c
      +++ b/examples/c/ex_pack.c
      @@ -57,7 +57,7 @@ main(int argc, char *argv[])
                   /* Allocate a bigger buffer. */
               }
       
      -        error_check(wiredtiger_struct_pack(session, buf, size, "iii", 42, 1000, -9));
      +        error_check(wiredtiger_struct_pack(session, buf, size, ">iii", 42, 1000, -9));
       
               error_check(wiredtiger_struct_unpack(session, buf, size, "iii", &i, &j, &k));
               /*! [packing] */
      

      And then execute the ex_pack.c test after compiling the changes:

      > ~/wiredtiger/build/examples/c/ex_pack$ pwd
      /home/ubuntu/wiredtiger/build/examples/c/ex_pack
      > ./ex_pack
      

            Assignee:
            etienne.petrel@mongodb.com Etienne Petrel
            Reporter:
            etienne.petrel@mongodb.com Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: