Thread: Problematic min length value

  1. #1
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733

    Problematic min length value

    This is where it's set for something like "%80c":
    src/libpaw/std/printf.c * c5c1db9626180e1c7d27254225ffe89d22e8dc04 * Lee Shallis / Dragonbuilder * GitLab
    For it's usage just go to the top of the file, the function there shifts the output across if needed &/or appends to eat if needed.

    The output of such an argument with '=' as the input should be:
    ================================================== ==============================
    Instead I get just: =

    I've been struggling for a while to locate the source of the issue, somehow between the read of the value and the read of the character to output the min length suddenly goes below 1 triggering the override to 1 which is only supposed to be triggered when the value is below 1 (is 0 by default before reading the min length).

    Would appreciate some fresh eyes on the code, maybe someone will spot what I haven't, for reference pawhhs just maps to either char const * or wchar_t const * depending on whether CHAR_BIT is less than 8 or not since it's for UTF-8 input, all the number & string typedefs are in include/std/number.h & include/std/string.h

    You can just treat the part after "paw" as the matching specifier for numbers & strings, I followed the linux printf spec to start with and then added a few of my own for convenience such as b for binary output, hhs/hhc for UTF-8, hs/hc for UTF-16 lls/llc for UTF-32, js/jc for maximum character sized output (currently UTF-32) ts/tc for TCHAR/char output. Originally I wanted the entire paw api to just use UTF-8 besides when interacting with the system, now I'm realising that ironically complicated the code a lot more than if I just used pawlc/pawls (wchar_t/wchar_t const *) instead so I'm gonna change all that after this bug is fixed.

    Edit: After plenty of debugging I finally managed to narrow it down to 1 function:
    pawva_putstr_init in src/libpaw/std/putstr.c

    Edit 2: Finally found the source of the issue, I overlooked the details of a copy when I changed the storage method of what character to print, fixing that fixed the issue

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Length not quite what it should be
    By awsdert in forum C Programming
    Replies: 2
    Last Post: 10-26-2019, 01:37 AM
  2. Replies: 5
    Last Post: 12-12-2018, 01:22 PM
  3. Two problematic recursive programs
    By Kelton2 in forum C++ Programming
    Replies: 13
    Last Post: 10-26-2014, 08:01 PM
  4. Book's code: Problematic
    By RoD in forum Game Programming
    Replies: 14
    Last Post: 01-21-2003, 09:08 AM
  5. my problematic first program
    By lisab in forum C Programming
    Replies: 0
    Last Post: 10-28-2002, 09:58 AM

Tags for this Thread