• src/xpdev/genwrap.c

    From deuce@VERT to CVS commit on Wednesday, February 05, 2014 02:17:28
    src/xpdev genwrap.c 1.90 1.91
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv9404

    Modified Files:
    genwrap.c
    Log Message:
    Fix warning found by clang... 1U and 1UL may be difference sizes.




    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Wednesday, April 23, 2014 03:59:03
    src/xpdev genwrap.c 1.92 1.93
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv12903

    Modified Files:
    genwrap.c
    Log Message:
    Fix integer overflow in msclock() on *nix.




    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Wednesday, April 23, 2014 23:49:53
    src/xpdev genwrap.c 1.93 1.94
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv31204

    Modified Files:
    genwrap.c
    Log Message:
    #ifdef out dead code to make Coverity happy.




    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Thursday, April 24, 2014 00:01:39
    src/xpdev genwrap.c 1.94 1.95
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv31286

    Modified Files:
    genwrap.c
    Log Message:
    Fix unused variable warnings caused by last commit.




    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Sunday, April 27, 2014 22:19:11
    src/xpdev genwrap.c 1.95 1.96
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv18914

    Modified Files:
    genwrap.c
    Log Message:
    Use lower-case for windows headers.




    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From rswindell@VERT to CVS commit on Friday, August 25, 2017 18:46:57
    src/xpdev genwrap.c 1.101 1.102
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/home/rswindell/sbbs/src/xpdev

    Modified Files:
    genwrap.c
    Log Message:
    Insure c_escape_str escapes (hex-encodes) all control chars, not just those that have standard C mnemonics.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Sunday, November 05, 2017 22:57:10
    src/xpdev genwrap.c 1.103 1.104
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv14902

    Modified Files:
    genwrap.c
    Log Message:
    Resolve some new(ish) GCC warnings.


    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From deuce@VERT to CVS commit on Saturday, February 03, 2018 00:36:41
    src/xpdev genwrap.c 1.104 1.105
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv2416

    Modified Files:
    genwrap.c
    Log Message:
    Make safe_snprintf() safer.




    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From deuce@VERT to CVS commit on Saturday, February 03, 2018 01:15:02
    src/xpdev genwrap.c 1.105 1.106
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv5983

    Modified Files:
    genwrap.c
    Log Message:
    Switch to using safe_snprintf() where the return value is used.

    With the supported compilers, we can't rely on the return value of snprintf() and historically have replaced it with safe_snprintf(). For macOS however, snprintf() is apparently a macro, not a function, so gendefs.h throws and
    error due to redefinition.

    Rather than hack around on that, just ensure that we never use the return
    value of snprintf() and use safe_snprintf() to ensure we know what the
    return value will be.




    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Sunday, May 05, 2019 17:31:20
    src/xpdev genwrap.c 1.109 1.110
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv9673

    Modified Files:
    genwrap.c
    Log Message:
    The Win32 implementation of strcasestr() defined here is currently very heavy-handed (performs strdup/malloc's and modifications of the strings),
    so a temporary hack is to perform a case-sensitive search (using the standard strstr() function) first. The results won't exactly match the traditional strstr() and the performance improvement is only for positive matches
    (where the correct case was guessed in the passed 'needle' string arg).
    TODO: re-write or copy a good/fast strcasestr() implementation for Win32 builds.


    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Tuesday, July 16, 2019 14:49:27
    src/xpdev genwrap.c 1.110 1.111
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv12029

    Modified Files:
    genwrap.c
    Log Message:
    Less heavy brute-force version of strcaststr() for Windows (i.e. no mallocs).


    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Tuesday, July 23, 2019 21:09:52
    src/xpdev genwrap.c 1.111 1.112
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv8816

    Modified Files:
    genwrap.c
    Log Message:
    Address compiler warnings about printf-format in Windows build.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Saturday, August 08, 2020 18:47:26
    src/xpdev genwrap.c 1.116 1.117
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/home/rswindell/sbbs/src/xpdev

    Modified Files:
    genwrap.c
    Log Message:
    Fix safe_strerror() for GNU builds (must use the return value of strerror_r()).



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Sunday, August 09, 2020 21:11:45
    src/xpdev genwrap.c 1.117 1.118
    Update of /cvsroot/sbbs/src/xpdev
    In directory cvs:/tmp/cvs-serv32696

    Modified Files:
    genwrap.c
    Log Message:
    Provide a (non-ideal) implementation of safe_strerror() for Borland C builds that don't have strerror_s:
    Error: Unresolved external '_strerror_s' referenced from genwrap



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Stephen Hurd@VERT to Git commit to sbbs/master on Tuesday, November 10, 2020 12:55:53
    https://gitlab.synchro.net/sbbs/sbbs/-/commit/678627dbcfc2b6eab9a7a7cb
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Use the crappy strerror() wrapper for all _WIN32 that's not MSC,
    not just for Borland.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Thursday, December 02, 2021 21:03:26
    https://gitlab.synchro.net/main/sbbs/-/commit/01bda6a85c3621f211f8b5d6
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Work around GetVersionEx deprecation warning/error

    For some reason this deprecation warning is being treated as an error (and only with newer Windows platform SDKs). Just disable this warning for the GetVersionEx line.
    See https://stackoverflow.com/questions/22303824/warning-c4996-getversionexw-was-declared-deprecated for details.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¨@VERT to Git commit to main/sbbs/master on Friday, February 11, 2022 20:49:58
    https://gitlab.synchro.net/main/sbbs/-/commit/f587a43e6fee5458e3376d5a
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    When a double is cast to an int, but the double has a larger value
    than the int supports, it's set to 0x80000000 to indicate overflow.

    msclock() is *always* overflowing, and clock_t is only 32-bits on
    some platforms (specifically FreeBSD). To "avoid" problems, just
    keep subtracting UIN32_MAX from the value until it's less than INT_MAX
    then cast.

    This function is, of course, terrible and shouldn't actually be used,
    but it should at least sorta kinda workish.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¨@VERT to Git commit to main/sbbs/master on Friday, February 11, 2022 23:43:24
    https://gitlab.synchro.net/main/sbbs/-/commit/d2eda12d2c30356cc14461d5
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Fix Win32 builds maybe?

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¨@VERT to Git commit to main/sbbs/master on Friday, February 11, 2022 23:47:10
    https://gitlab.synchro.net/main/sbbs/-/commit/e7761bb1b03cbbf6b3ab0662
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Fix Win32 harder

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¨@VERT to Git commit to main/sbbs/master on Friday, February 11, 2022 23:49:49
    https://gitlab.synchro.net/main/sbbs/-/commit/c3c6d783f4da67a9b2a1f1ed
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Moar!

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Saturday, February 12, 2022 00:00:22
    https://gitlab.synchro.net/main/sbbs/-/commit/f0a83672aa0c8d0d638bfd62
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Resolve new msvc warning

    warning C4244: '=': conversion from 'double' to 'uint64_t', possible loss of data

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¨@VERT to Git commit to main/sbbs/master on Saturday, February 12, 2022 00:07:16
    https://gitlab.synchro.net/main/sbbs/-/commit/f8da2a2f2ff8668017906f48
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    More Win32 optimizations.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¨@VERT to Git commit to main/sbbs/master on Saturday, February 12, 2022 00:15:39
    https://gitlab.synchro.net/main/sbbs/-/commit/7d1fc057418fe859028b1c54
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    More Win32 optimizations.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¨@VERT to Git commit to main/sbbs/master on Saturday, February 12, 2022 00:40:31
    https://gitlab.synchro.net/main/sbbs/-/commit/489c0c3c20b98f74f54046d0
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Borland doesn't have roundl() so do terrible things instead.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¨@VERT to Git commit to main/sbbs/master on Saturday, February 12, 2022 00:45:48
    https://gitlab.synchro.net/main/sbbs/-/commit/0488082a3e46f9cd25efc140
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Not *that* t.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Friday, February 25, 2022 14:30:46
    https://gitlab.synchro.net/main/sbbs/-/commit/7a3dcb6c2ad19812fd674660
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Fix MSVC warning in xp_timer64()

    genwrap.c(855): warning C4244: '=': conversion from 'LONGLONG' to 'uint32_t', possible loss of data

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Wednesday, July 06, 2022 21:18:35
    https://gitlab.synchro.net/main/sbbs/-/commit/a302a01b1b42887cdece9b23
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Escape chars >= 0x7f too (DEL and ex-ASCII/UTF-8 and whatnot)

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Wednesday, July 06, 2022 21:23:26
    https://gitlab.synchro.net/main/sbbs/-/commit/735aa51e4f3bcaa8a6640416
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Fix for previous commit and escaped char values > 127 (0x7F)

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (in GitKraken)@VERT to Git commit to main/sbbs/master on Saturday, March 11, 2023 17:27:03
    https://gitlab.synchro.net/main/sbbs/-/commit/7081a525902dcc4acf4f00a2
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Fix mysterious double overflow issue in parse_byte_count()

    It's possible that some values (e.g. "16384P") exceed the storage (count of bytes) of a 64-bit integer, and such values were causing floating point exceptions when running sbbsctrl.exe, e.g.
    Faulting application name: sbbsctrl.exe, version: 3.20.0.0, time stamp: 0x00000000
    Faulting module name: gdi32full.dll, version: 10.0.19041.2604, time stamp: 0x2b5302d5
    Exception code: 0xc0000090

    but interesting (and perhaps a clue), not with sbbs.exe.

    Anyway, this added range checking, limiting the maximum value to INT64_MAX (after division by unit, though there was no division-unit in the problem
    case, the "min_dspace" value parsing in scfglib2.c). Using conditional/ternary return statement had the same floating point exception occurrences, so this if-statement shouldn't be removed/changed/optimized!

    I suspect this has something to do with mix of Borland and MSVC run-time libs and perhaps different expectations or setups with regards to floating point exceptions. I did notice that when stepping through read_file_cfg(), I would get different return values for the same call to iniGetBytes() depending on whether it was initiated from sbbsctrl.exe (built with C++Builder) or
    sbbs.dll (built with MSVC).

    Thanks to Codefenix for providing the sample file.ini file that demonstrated the issue. This problem would've been very hard to root-cause otherwise!

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (in GitKraken)@VERT to Git commit to main/sbbs/master on Friday, March 17, 2023 19:26:55
    https://gitlab.synchro.net/main/sbbs/-/commit/973b548fcd8c126de3633b5c
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Use const doubles for time durations

    Instead of copy/pasta. No change in function,.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Tuesday, March 28, 2023 15:27:09
    https://gitlab.synchro.net/main/sbbs/-/commit/ea44c50ad1ffe1a9cef1a7ff
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Fix clang warning: implicit conversion from 'long' to 'double'

    changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-const-int-float-conversion]
    if(bytes < 0 || bytes > INT64_MAX)
    ~ ^~~~~~~~~
    /usr/include/x86/_stdint.h:90:19: note: expanded from macro 'INT64_MAX'
    #define INT64_MAX 0x7fffffffffffffff
    ^~~~~~~~~~~~~~~~~~

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Monday, December 18, 2023 02:32:05
    https://gitlab.synchro.net/main/sbbs/-/commit/58b4de5093abeb6c7d2371f1
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    The %g printf specifier doesn't work the same as %f, use %f instead

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Windows 11)@VERT to Git commit to main/sbbs/master on Monday, December 18, 2023 17:21:37
    https://gitlab.synchro.net/main/sbbs/-/commit/9031ac11bbc1003e9cd13f3e
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Cosmetic improvements to duration*_to_[v]str() functions

    Use lower case y/w/d/h/m suffix.

    If a duration is an exact multiple, don't display ".0" fraction. This is not consistent with byte_estimate_to_str() string generation, but I think it's
    more in line with human expectations.

    Don't display "90d" as "12.9w" (unless the requested unit is one-week).

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Saturday, February 24, 2024 02:08:25
    https://gitlab.synchro.net/main/sbbs/-/commit/984f1eb68d22b45de08fd723
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Insure all builds of safe_strerror() write the string to the passed buf

    The GNU_SOURCE build of this function was (sometimes?) just returning the string and not actually copying it to the passed buf. This is consistent
    with the GNU manpage on strerror_r():
    "This may be either a pointer to a string that the function stores in buf ..." but was inconsistent with all the other build types of this function.

    Also updated to use strlcpy and write the problematic error number to the default string (if unknown).

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¨@VERT to Git commit to main/sbbs/master on Friday, March 22, 2024 11:31:27
    https://gitlab.synchro.net/main/sbbs/-/commit/0d60813bb295908d35ad556e
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Fix issue in last commit

    Need to update the parameter names as well.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Windows 11)@VERT to Git commit to main/sbbs/master on Saturday, March 23, 2024 00:10:09
    https://gitlab.synchro.net/main/sbbs/-/commit/78ae0fd80623b830fe86b6d6
    Modified Files:
    src/xpdev/genwrap.c
    Log Message:
    Change spaces to tabs in new strlcpy()

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net