[Gambas-devel] Net component patches

Benoit Minisini gambas at ...1...
Sun Nov 7 16:36:05 CET 2004


On Saturday 06 November 2004 21:34, Daniel Campos wrote:
> Hi:
>
>  Here's to files to replace the old ones in the "net" component:
>
> 1º) CDnsClient.c --> fixes a bug that could generate a segmentation
> fault when using DnsClient in synchronous mode.
>

OK.

> 2º) CNet.c --> Adds a static method to "Net" class:
>
> ToIp4(Cad As String) As String
>
> This function evaluates a string, and returns a well-formated IP
> address. This way, it is easier to check if an IP address is valid
> (returns it), or is not valid (returns ""). For example:
>
> "  216.051.31.112   " --> "216.51.31.112"
> " 216.509.112.24 "  --> ""
> "001.00.02.34  " --> "1.0.2.34"
> ... and so on
>
> Specially for use in values from a textbox filled by a non-expert
> user :-)))
>

You could have used a static buffer to format the IP address: this save one 
call to malloc().

Can I replace the name "ToIPv4" by "Format" ?

Here is what I imagine:

  Net.Format("address")

And in the future:

  Net.Format("address", Net.IPV4)
  Net.Format("address", Net.IPV6)

What do you think ? Remember that I like short names :-)


> Regards,
>
> Daniel Campos

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the Devel mailing list