Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-16 Thread Michael Van Canneyt
Applied, thank you very much ! Michael. On Sat, 16 May 2020, Noel Duffy via fpc-pascal wrote: Per discussions, I've posted a proposed patch on bug 37060 https://bugs.freepascal.org/view.php?id=37060 I've also attached a test program that exercises the new functions.

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-15 Thread Noel Duffy via fpc-pascal
Per discussions, I've posted a proposed patch on bug 37060 https://bugs.freepascal.org/view.php?id=37060 I've also attached a test program that exercises the new functions. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Noel Duffy via fpc-pascal
On 14/05/20 12:36 am, Michael Van Canneyt wrote: On Wed, 13 May 2020, Noel Duffy via fpc-pascal wrote: On 13/05/20 9:24 pm, Bart via fpc-pascal wrote: On Wed, May 13, 2020 at 10:40 AM Noel Duffy via fpc-pascal As I've already learned the hard way, the sockets unit is compiled in "fpc"

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Michael Van Canneyt
On Wed, 13 May 2020, Noel Duffy via fpc-pascal wrote: On 13/05/20 9:24 pm, Bart via fpc-pascal wrote: On Wed, May 13, 2020 at 10:40 AM Noel Duffy via fpc-pascal As I've already learned the hard way, the sockets unit is compiled in "fpc" mode, so there's no "out" parameters. Otherwise I

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Marco van de Voort
Op 12/05/2020 om 23:05 schreef Noel Duffy via fpc-pascal: function TryStrToHostAddr(IP: String; var ip4: in_addr): Boolean; function TryStrToHostAddr6(IP: String; var ip6: in6_addr): Boolean; Rationale for this request: All conversion calls in sysutils and dateutils use this naming scheme,

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Noel Duffy via fpc-pascal
On 13/05/20 9:24 pm, Bart via fpc-pascal wrote: On Wed, May 13, 2020 at 10:40 AM Noel Duffy via fpc-pascal As I've already learned the hard way, the sockets unit is compiled in "fpc" mode, so there's no "out" parameters. Otherwise I would definitely have used one. {$modeswicth out} perhaps?

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Bart via fpc-pascal
On Wed, May 13, 2020 at 10:40 AM Noel Duffy via fpc-pascal wrote: > > And maybe change the var into an out I agree, it gives unnecessary warning about uninitialized variables. > As I've already learned the hard way, the sockets unit is compiled in > "fpc" mode, so there's no "out" parameters.

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Noel Duffy via fpc-pascal
On 13/05/20 8:36 pm, Michael Van Canneyt wrote: On Wed, 13 May 2020, Noel Duffy via fpc-pascal wrote: On 13/05/20 7:26 pm, Michael Van Canneyt wrote: BTW, I didn't see an obvious way within Mantis to link one bug to another, or to indicate any kind of relationship. Is this possible?

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Noel Duffy via fpc-pascal
On 13/05/20 6:41 pm, Marc Weustink via fpc-pascal wrote: On 12-5-2020 14:56, Marco van de Voort wrote: Op 2020-05-12 om 12:32 schreef Michael Van Canneyt: I'm all for it, but please use the following names: function TryStrToHostAddr(IP: String; var ip4: in_addr): Boolean; function

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Michael Van Canneyt
On Wed, 13 May 2020, Noel Duffy via fpc-pascal wrote: On 13/05/20 7:26 pm, Michael Van Canneyt wrote: Always a new issue for new changes. Makes it easier to track where something went wrong if something is wrong. Done. https://bugs.freepascal.org/view.php?id=37060 I will try to get a

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Noel Duffy via fpc-pascal
On 13/05/20 7:26 pm, Michael Van Canneyt wrote: Always a new issue for new changes. Makes it easier to track where something went wrong if something is wrong. Done. https://bugs.freepascal.org/view.php?id=37060 I will try to get a patch ready for this in the next couple of days. BTW, I

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Christo Crause via fpc-pascal
On Wed, May 13, 2020 at 9:31 AM Michael Van Canneyt wrote: > > On Wed, 13 May 2020, Christo Crause via fpc-pascal wrote: > > > On Tue, May 12, 2020 at 11:11 PM Noel Duffy via fpc-pascal < > > fpc-pascal@lists.freepascal.org> wrote: > > > >> Sure, I can do that. I will look at creating a patch

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Michael Van Canneyt
On Wed, 13 May 2020, Christo Crause via fpc-pascal wrote: On Tue, May 12, 2020 at 11:11 PM Noel Duffy via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: Sure, I can do that. I will look at creating a patch for this. For your purposes, do you prefer to have a new bug in the bug tracker

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Michael Van Canneyt
On Wed, 13 May 2020, Noel Duffy via fpc-pascal wrote: On 12/05/20 10:32 pm, Michael Van Canneyt wrote:> On Tue, 12 May 2020, Noel Duffy via fpc-pascal wrote: A simple solution is to add functions to the sockets unit which accep a var record into which the output will be written and which

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Marc Weustink via fpc-pascal
On 12-5-2020 14:56, Marco van de Voort wrote: Op 2020-05-12 om 12:32 schreef Michael Van Canneyt: The names I use here are the libc names, which many other languages also use. Now, StrToHostAddr and StrToHostAddr6 can call the appropriate function, and programs that use those functions

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Christo Crause via fpc-pascal
On Tue, May 12, 2020 at 11:11 PM Noel Duffy via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > Sure, I can do that. I will look at creating a patch for this. For your > purposes, do you prefer to have a new bug in the bug tracker opened for > tracking this change? > If your patch is

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-12 Thread Noel Duffy via fpc-pascal
On 12/05/20 10:32 pm, Michael Van Canneyt wrote:> On Tue, 12 May 2020, Noel Duffy via fpc-pascal wrote: A simple solution is to add functions to the sockets unit which accep a var record into which the output will be written and which return a boolean to indicate success or failure. E.g,

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-12 Thread Noel Duffy via fpc-pascal
On 13/05/20 12:56 am, Marco van de Voort wrote: Op 2020-05-12 om 12:32 schreef Michael Van Canneyt: The names I use here are the libc names, which many other languages also use. Now, StrToHostAddr and StrToHostAddr6 can call the appropriate function, and programs that use those functions

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-12 Thread Marco van de Voort
Op 2020-05-12 om 12:32 schreef Michael Van Canneyt: The names I use here are the libc names, which many other languages also use. Now, StrToHostAddr and StrToHostAddr6 can call the appropriate function, and programs that use those functions won't notice any change. But new code will be

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-12 Thread Michael Van Canneyt
On Tue, 12 May 2020, Noel Duffy via fpc-pascal wrote: While working with StrToHostAddr and StrToHostAddr6 over the past couple of weeks I've run into issues caused by the functions returning all zero addresses to indicate errors. All-zero addresses are technically valid according to the

[fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-12 Thread Noel Duffy via fpc-pascal
While working with StrToHostAddr and StrToHostAddr6 over the past couple of weeks I've run into issues caused by the functions returning all zero addresses to indicate errors. All-zero addresses are technically valid according to the RFCs, so an all-zero address shouldn't be used as an error