ObjFW  History of src/of_asprintf.m of ecca60907923b5ca

History of file src/of_asprintf.m at check-in ecca60907923b5ca

2024-08-17
09:51
Move private functions into private headers file: [68c676e291] check-in: [b829f3e798] user: js, branch: trunk, size: 17152 [annotate] [blame] [check-ins using] [diff]
2024-04-29
21:42
Properly hide private symbols file: [862e4e73cc] check-in: [f16bccc7b3] user: js, branch: trunk, size: 17123 [annotate] [blame] [check-ins using] [diff]
2024-04-03
02:16
Change license to LGPLv3 only file: [e60e10983b] check-in: [7413a728a7] user: js, branch: trunk, size: 17120 [annotate] [blame] [check-ins using] [diff]
2024-01-02
17:17
Update copyright file: [164c33d955] check-in: [26ddd2e4e4] user: js, branch: trunk, size: 16912 [annotate] [blame] [check-ins using] [diff]
2023-08-23
13:54
OFStrFTime: Don't use OFASPrintF() file: [ebfc63953a] check-in: [ff64ec30f4] user: js, branch: trunk, size: 16912 [annotate] [blame] [check-ins using] [diff]
12:44
Add OFStrFTime() consistent with OFStrPTime() file: [1c0f37cece] check-in: [05d675eb07] user: js, branch: trunk, size: 17114 [annotate] [blame] [check-ins using] [diff]
2023-04-10
14:33
Fall back to uselocale() if it's available file: [84a6c0408a] check-in: [6e786896e0] user: js, branch: trunk, size: 16889 [annotate] [blame] [check-ins using] [diff]
2023-01-06
09:04
Update copyright file: [ee2ef84a44] check-in: [8939cbdb52] user: js, branch: trunk, size: 16257 [annotate] [blame] [check-ins using] [diff]
2022-09-29
20:27
OFLocale: Rename a few methods file: [882db55cea] check-in: [915bfc7431] user: js, branch: trunk, size: 16257 [annotate] [blame] [check-ins using] [diff]
2022-02-12
07:46
Update copyright file: [31044637f2] check-in: [1a86b8175b] user: js, branch: trunk, size: 16253 [annotate] [blame] [check-ins using] [diff]
2021-05-02
09:25
A few more missed renames file: [55b5185ec7] check-in: [19236ddfe7] user: js, branch: trunk, size: 16253 [annotate] [blame] [check-ins using] [diff]
2021-04-25
19:58
Last round of renames (hopefully) file: [88da2745a9] check-in: [6ae98c1dcf] user: js, branch: trunk, size: 16253 [annotate] [blame] [check-ins using] [diff]
11:05
A few last renames file: [2d355cbec1] check-in: [27103855c2] user: js, branch: new-naming-convention, size: 16253 [annotate] [blame] [check-ins using] [diff]
2021-04-18
22:56
Rename all symbols marked extern file: [700e7dd91c] check-in: [e73c65a849] user: js, branch: new-naming-convention, size: 16263 [annotate] [blame] [check-ins using] [diff]
20:51
Renamed src/of_asprintf.m → src/OFASPrintF.m. Rename everything in several smaller files file: [44b0400cd9] check-in: [35de667566] user: js, branch: new-naming-convention, size: 16272 [annotate] [blame] [check-ins using] [diff]
2021-04-17
01:32
of_unichar_t -> OFUnichar file: [32debbce88] check-in: [2d3790870d] user: js, branch: new-naming-convention, size: 16620 [annotate] [blame] [check-ins using] [diff]
2021-01-31
15:16
of_asprintf: Fix type mismatch on LP64 systems file: [d2e16772ed] check-in: [07f4a82038] user: js, branch: trunk, size: 16629 [annotate] [blame] [check-ins using] [diff]
2021-01-14
01:45
Fix fallback asprintf implementation for length 0 file: [489f8ebee0] check-in: [99862df65a] user: js, branch: trunk, size: 16602 [annotate] [blame] [check-ins using] [diff]
2021-01-02
22:06
Update copyright file: [bdf6534c80] check-in: [27b401c7c2] user: js, branch: amiga-library, size: 16784 [annotate] [blame] [check-ins using] [diff]
22:04
Update copyright file: [f0147f7049] check-in: [374e1a1bfa] user: js, branch: trunk, size: 16601 [annotate] [blame] [check-ins using] [diff]
2021-01-01
22:38
of_asprintf: Work around %j & %t missing on HP-UX file: [7048f84bee] check-in: [1ba0dc33b4] user: js, branch: trunk, size: 16690 [annotate] [blame] [check-ins using] [diff]
22:34
of_asprintf: Work around %z missing on HP-UX file: [00ae3c010b] check-in: [8c41063a76] user: js, branch: trunk, size: 16650 [annotate] [blame] [check-ins using] [diff]
18:36
Better fallback asprintf() implementation

Instead of trying if it's C99 compliant and falling back to a 64 KB
buffer if it is not, resize the buffer in powers of 2 until it fits.

The problem is that some implementations that are not compliant with C99
don't just return -1 for a length of 0, but actually crash (e.g. HP-UX). file: [35d52654ca] check-in: [7267f55840] user: js, branch: trunk, size: 16630 [annotate] [blame] [check-ins using] [diff]

2020-05-16
17:17
Don't use %I on Windows

Older versions only understand I64. So only use I64 where appropriate
and drop it entirely where not. file: [cd42320784] check-in: [ecca609079] user: js, branch: trunk, size: 16873 [annotate] [blame] [check-ins using] [diff]

16:46
Do not require snprintf to return expected length file: [36d94b6a4d] check-in: [c5beed7277] user: js, branch: trunk, size: 16808 [annotate] [blame] [check-ins using] [diff]
2020-03-09
00:54
of_asprintf.m: Small optimization

Don't replace the decimal point with "." if the decimal point is ".". file: [0f7da4996c] check-in: [e0b659378f] user: js, branch: trunk, size: 16235 [annotate] [blame] [check-ins using] [diff]

2020-01-02
01:51
Update copyright file: [04c9933717] check-in: [c7f0229795] user: js, branch: trunk, size: 16189 [annotate] [blame] [check-ins using] [diff]
2019-03-08
00:35
Use dot syntax file: [53badc787e] check-in: [bceb7ed4c9] user: js, branch: trunk, size: 16186 [annotate] [blame] [check-ins using] [diff]
2019-01-03
19:13
Update copyright file: [3f7a200743] check-in: [0509d7a844] user: js, branch: trunk, size: 16194 [annotate] [blame] [check-ins using] [diff]
2018-07-28
18:45
Rename OFLocalization -> OFLocale file: [b4c808b218] check-in: [aa0384d1bf] user: js, branch: trunk, size: 16188 [annotate] [blame] [check-ins using] [diff]
2018-01-03
19:49
Update copyright notice file: [bda9482e58] check-in: [7e5c81e186] user: js, branch: trunk, size: 16208 [annotate] [blame] [check-ins using] [diff]
2017-08-11
15:47
of_asprintf: Don't require set up OFLocalization file: [e20ce9de33] check-in: [17098e76eb] user: js, branch: trunk, size: 16185 [annotate] [blame] [check-ins using] [diff]
2017-06-03
18:37
Properly check for sys/types.h file: [3e2fecec3f] check-in: [4ec0948b1b] user: js, branch: trunk, size: 16163 [annotate] [blame] [check-ins using] [diff]
2017-05-07
20:10
Small code style change

Casts are now written like types in variable declarations. file: [dfdbe062d8] check-in: [4af49a13c3] user: js, branch: trunk, size: 16128 [annotate] [blame] [check-ins using] [diff]

2017-05-06
22:06
configure: Check for wchar_t and wchar.h file: [eefc8c03cc] check-in: [13768d7743] user: js, branch: trunk, size: 16122 [annotate] [blame] [check-ins using] [diff]
2017-04-02
01:06
Add OF_CONSTRUCTOR() / OF_DESTRUCTOR() file: [81c730c736] check-in: [d07c56a8bb] user: js, branch: trunk, size: 16036 [annotate] [blame] [check-ins using] [diff]
2017-03-12
01:33
Fix using asprintf_l file: [c0ebec1591] check-in: [df2ee1f2f9] user: js, branch: trunk, size: 16071 [annotate] [blame] [check-ins using] [diff]
2017-01-09
17:36
Update copyright

Forgot to add 2017, even though I already did quite some changes in
2017. file: [096a7db2b7] check-in: [44f45c2e35] user: js, branch: trunk, size: 16175 [annotate] [blame] [check-ins using] [diff]

06:26
Add OFLocalization

This singleton gives access to all things locale, including the ability
to get localized strings.

This also adds the OF_LOCALIZED() macro. Its first argument is an ID for
the string to be localized and its second argument is the fallback
string to be used if it cannot retrieve the localized string. Following
that are variable name / value pairs to be replaced in the localized
string.

Getting translated strings is not implemented yet: Instead, it always
uses the fallback string.

This also switches ofhttp to localized strings. file: [5de6ff2576] check-in: [06bcb21fc7] user: js, branch: trunk, size: 16169 [annotate] [blame] [check-ins using] [diff]

2017-01-07
03:26
Use strtof_l, strtod_l and asprintf_l if available

This avoids the hacks introduced in the previous commit, if those
functions are available. file: [78991846e2] check-in: [0ad678f125] user: js, branch: trunk, size: 16165 [annotate] [blame] [check-ins using] [diff]

02:34
Always use "." for the decimal point

This is achieved by replacing the locale's decimal point with "." after
formatting and replacing "." with the locale's decimal point before
parsing.

To still use the decimal point from the locale for formatting, the new
flag "," is introduced to formats. This is useful for just printing a
string to the user that is not saved to a file or sent via a network.

While this is an ugly hack, there is no better way to do this other than
implementing the functionality of printf and strtod myself, as POSIX
does not specify versions of these that take a locale as an argument.
While this is a lot of work and error-prone, I will most likely end up
doing this eventually.

This commit also enables the locale in OFApplication to notice when
things break. As a nice side effect, ofhttp now uses the locale's
decimal point in its user interface. file: [91cd8b629a] check-in: [6dff0f5922] user: js, branch: trunk, size: 15256 [annotate] [blame] [check-ins using] [diff]

2016-02-21
15:37
Make use of C99-style for loops file: [bff5bd9808] check-in: [e0b9167693] user: js, branch: trunk, size: 14348 [annotate] [blame] [check-ins using] [diff]
2016-01-03
00:43
Update copyright

While at it, also update the mail address. file: [d2c505f580] check-in: [cec0f072f8] user: js, branch: 0.8, size: 14318 [annotate] [blame] [check-ins using] [diff]

00:41
Update copyright

While at it, also update the mail address. file: [45f853ae7d] check-in: [2a27cf3000] user: js, branch: trunk, size: 14338 [annotate] [blame] [check-ins using] [diff]

2015-10-19
22:15
Add platform.h & make platform defines consistent file: [4c2fb9e2fa] check-in: [1ba08eebc5] user: js, branch: trunk, size: 14334 [annotate] [blame] [check-ins using] [diff]
2015-09-17
21:19
Fix compilation for PSP file: [7771a499a7] check-in: [719ec38eb0] user: js, branch: trunk, size: 14314 [annotate] [blame] [check-ins using] [diff]
2015-01-03
20:57
Update copyright file: [e5f48e3c7d] check-in: [cfd374b906] user: js, branch: trunk, size: 14050 [annotate] [blame] [check-ins using] [diff]
2014-08-06
00:04
Don't export (v)asprintf implementation

In case (v)asprintf was missing, this was exported instead of only being
used internally, potentially causing problems when linking against
another library which also detected libc is missing it. file: [a27170a922] check-in: [ddbbd50e56] user: js, branch: trunk, size: 14044 [annotate] [blame] [check-ins using] [diff]

2014-06-21
21:43
Move all macros from OFObject.h to macros.h

This means that OFObject.h imports macros.h now, making it unnecessary
to manually import macros.h in almost every file. And while at it, also
import autorelease.h in OFObject.h, so that this doesn't need to be
manually imported in almost every file as well. file: [6eaf017199] check-in: [13ee56edf3] user: js, branch: trunk, size: 13463 [annotate] [blame] [check-ins using] [diff]

2014-05-15
01:50
Don't define _*_SOURCE

Instead, just define _GNU_SOURCE when __GLIBC__ is defined. After all,
that's the only libc that doesn't work properly without any defines. file: [db322fe9c1] check-in: [17be12b6e5] user: js, branch: trunk, size: 13506 [annotate] [blame] [check-ins using] [diff]

2014-04-26
01:02
of_asprintf: Generalize some #ifdefs

All workarounds that were for Wii and PSP are caused by newlib, so it's
better to check for newlib instead. file: [b1b058c113] check-in: [1bf25c9a98] user: js, branch: trunk, size: 13527 [annotate] [blame] [check-ins using] [diff]

2014-02-13
23:26
Use -std=c11 instead of -std=gnu11

Not using -std=gnu11 means _GNU_SOURCE does not get defined anymore,
therefore this commit also adds the required feature defines for glibc.

Additionally, this adds of_strdup in macros.h, as strdup is an
extension. file: [9e4f7d3917] check-in: [2f5af58573] user: js, branch: trunk, size: 13554 [annotate] [blame] [check-ins using] [diff]

2014-01-04
00:24
Update copyright. file: [0550f8c820] check-in: [3b97fc3cd9] user: js, branch: trunk, size: 13553 [annotate] [blame] [check-ins using] [diff]
2013-11-24
17:28
of_asprintf: Change %k to %C and %K to %S.

This reverts 2943b43. It turned out that using %C and %S is possible,
even when mixing code with Cocoa code, as it is possible to introduce
__attribute__((format(__OFString__, ...))) to Clang which just handles
%C and %S as being of_unichar_t instead of unichar like they are handled
for __attribute__((format(__NSString__, ...))).

The Clang patch for __attribute__((format(__OFString__, ...))) has been
submitted, but is not upstream yet, thus the changes for that are not
being committed yet. file: [ceb4eae89b] check-in: [4b56450a24] user: js, branch: trunk, size: 13547 [annotate] [blame] [check-ins using] [diff]

2013-11-23
17:48
of_asprintf: Add %K format specifier.

%K is for const of_unichar_t*. file: [0045836345] check-in: [945ff1043d] user: js, branch: trunk, size: 13547 [annotate] [blame] [check-ins using] [diff]

03:24
of_asprintf: Change %C to %k.

In Cocoa, %C means unichar, which is unsigned short and thus compilers
expect %C to be unichar when the language is set to ObjC. It would be
hard to let compilers detect whether %C should be unichar or
of_unichar_t, especially when mixing ObjFW and Cocoa code, thus the
change to %k. file: [3466f7d906] check-in: [5eada9f7b0] user: js, branch: trunk, size: 12902 [annotate] [blame] [check-ins using] [diff]

03:02
of_asprintf: Don't accept length modifiers for %@.

Same for %C. file: [7dd06b0a1f] check-in: [0232e0c975] user: js, branch: trunk, size: 12902 [annotate] [blame] [check-ins using] [diff]

2013-11-22
19:27
of_asprintf: Add %C format specifier. file: [0f6776e0aa] check-in: [e803913a9d] user: js, branch: trunk, size: 12764 [annotate] [blame] [check-ins using] [diff]
18:23
of_asprintf.m: Fix coding style.

This file still used the very old coding style. file: [fa426a4240] check-in: [619cced011] user: js, branch: trunk, size: 12393 [annotate] [blame] [check-ins using] [diff]

2013-06-26
17:18
Revive the PSP port. file: [aad6d97af9] check-in: [530decab01] user: js, branch: trunk, size: 12534 [annotate] [blame] [check-ins using] [diff]
2013-04-27
02:22
Initial Wii port.

Threads and sockets still missing. file: [2e133e3806] check-in: [2713b481a1] user: js, branch: trunk, size: 12483 [annotate] [blame] [check-ins using] [diff]

2013-01-09
22:24
Update copyright. file: [1e3eba5867] check-in: [813c00ccf0] user: js, branch: trunk, size: 12233 [annotate] [blame] [check-ins using] [diff]
2012-10-15
11:08
Fix some forgotten renames. file: [e1cad94c32] check-in: [06251136e5] user: js, branch: trunk, size: 12227 [annotate] [blame] [check-ins using] [diff]
2012-10-08
08:12
Coding style. file: [a758901adf] check-in: [9276a1c3c8] user: js, branch: trunk, size: 12224 [annotate] [blame] [check-ins using] [diff]
2012-08-19
23:26
Get rid of OFAutoreleasePool in of_asprintf. file: [31d446cae5] check-in: [5f04d5b720] user: js, branch: trunk, size: 12057 [annotate] [blame] [check-ins using] [diff]
2012-04-03
17:53
Add a missing include. file: [2b51c08162] check-in: [d0f8cffed5] user: js, branch: trunk, size: 12076 [annotate] [blame] [check-ins using] [diff]
2012-01-05
00:56
Update copyright. file: [72b4dbe204] check-in: [ce70e17b38] user: js, branch: trunk, size: 12057 [annotate] [blame] [check-ins using] [diff]
2011-12-26
16:24
Fix exception handling in of_asprintf. file: [231103bb7a] check-in: [fa81b2657c] user: js, branch: trunk, size: 12051 [annotate] [blame] [check-ins using] [diff]
2011-11-23
02:17
of_asprintf: Work around more Win32 brokenness. file: [3dba5d325a] check-in: [ccb0a96ebc] user: js, branch: trunk, size: 12110 [annotate] [blame] [check-ins using] [diff]
2011-09-22
23:25
Exceptions are now autoreleased.

This is safe as an "exception loop" can't happen, since if allocating
an exception fails, it throws an OFAllocFailedException which is
preallocated and can always be thrown.

So, the worst case would be that an autorelease of an exception fails,
triggering an OFOutOfMemoryException for which there is no memory,
resulting in an OFAllocFailedException to be thrown. file: [d33bc3adcc] check-in: [e1e7ffa903] user: js, branch: trunk, size: 11946 [annotate] [blame] [check-ins using] [diff]

2011-09-12
19:57
Rename -[cString] to -[UTF8String]. file: [31524fd43b] check-in: [e6fd39d11e] user: js, branch: trunk, size: 11962 [annotate] [blame] [check-ins using] [diff]
2011-07-17
02:11
Include sys/types.h in of_asprintf.m. file: [6a4139bc4d] check-in: [e9768d31bb] user: js, branch: 0.5, size: 11229 [annotate] [blame] [check-ins using] [diff]
02:11
Include sys/types.h in of_asprintf.m. file: [e1e1de1e89] check-in: [506c012ec2] user: js, branch: trunk, size: 11947 [annotate] [blame] [check-ins using] [diff]
2011-06-30
23:28
Fix wrong variable names resulting from backport. file: [ff2c736c3a] check-in: [c7c8a3e053] user: js, branch: 0.5, size: 11205 [annotate] [blame] [check-ins using] [diff]
20:50
of_asprintf: Work around Win32 breaking C99 standard length modifiers. file: [379e3421b7] check-in: [4075c85e25] user: js, branch: 0.5, size: 11008 [annotate] [blame] [check-ins using] [diff]
2011-06-26
00:45
Handle q length modifier in of_asprintf on iOS. file: [e3742f904d] check-in: [3092cda94b] user: js, branch: 0.5, size: 11217 [annotate] [blame] [check-ins using] [diff]
00:45
Handle q length modifier in of_asprintf on iOS. file: [5101db410e] check-in: [58f7af5290] user: js, branch: trunk, size: 11923 [annotate] [blame] [check-ins using] [diff]
2011-06-16
01:05
of_asprintf: Work around Win32 breaking C99 standard length modifiers. file: [0950c4780b] check-in: [6c20d8bff4] user: js, branch: trunk, size: 11714 [annotate] [blame] [check-ins using] [diff]
2011-04-23
00:11
More style improvements. file: [e2f58222ca] check-in: [d8c31454b4] user: js, branch: trunk, size: 11179 [annotate] [blame] [check-ins using] [diff]
2011-03-22
00:55
Add -Wshorten-64-to-32. file: [983a2f4cc6] check-in: [6d4dfb5bc7] user: js, branch: trunk, size: 10503 [annotate] [blame] [check-ins using] [diff]
2011-02-19
13:14
of_asprintf: Use format even if object is nil. file: [7a9c826b78] check-in: [5fdaa5b909] user: js, branch: trunk, size: 10397 [annotate] [blame] [check-ins using] [diff]
2011-02-07
21:05
of_vasprintf: Preserve exceptions that happen in -[description]. file: [ca529b4e62] check-in: [151463e32a] user: js, branch: trunk, size: 10402 [annotate] [blame] [check-ins using] [diff]
2011-02-06
15:11
Add missing include. file: [0c6c3ac0b6] check-in: [578e7598a8] user: js, branch: trunk, size: 10454 [annotate] [blame] [check-ins using] [diff]
2011-02-05
14:47
Make sure we always have a return buffer in of_asprintf. file: [8bf00513bd] check-in: [a0ff17e12b] user: js, branch: trunk, size: 10434 [annotate] [blame] [check-ins using] [diff]
2011-02-02
17:38
Work around some annoying compiler bugs. file: [75df7de9af] check-in: [1dcfbcb479] user: js, branch: trunk, size: 10576 [annotate] [blame] [check-ins using] [diff]
2011-01-31
23:15
Work around glibc weirdness. file: [6358474411] check-in: [41af19cfbc] user: js, branch: trunk, size: 10573 [annotate] [blame] [check-ins using] [diff]
22:35
wint_t might be smaller than int so that integer promotions apply. file: [ebb2514163] check-in: [f17bdd0722] user: js, branch: trunk, size: 10553 [annotate] [blame] [check-ins using] [diff]
2011-01-30
00:24
Allow nil for %@. file: [07a6d8ae59] check-in: [e9c2c2c599] user: js, branch: trunk, size: 10443 [annotate] [blame] [check-ins using] [diff]
2011-01-29
19:01
Added: Add of_asprintf and allow %@ in format strings. file: [939c56bbd9] check-in: [4c4608fbba] user: js, branch: trunk, size: 10366 [annotate] [blame] [check-ins using]