[Development] Octal IP in Version 5,1 ?

Thiago Macieira thiago.macieira at intel.com
Sun Aug 18 20:02:45 CEST 2013


On domingo, 18 de agosto de 2013 16:59:13, Randolph D. wrote:
> I wounder who invented this nonsense, that with entering an IP Address and

I did.

>  if there is a leading 0, it is interpreted as octal, base 8
>  010 octal is 8 decimal
> 
> this means users have to enter this carefully?
> 
> Any idea how to make it simple like in Qt 4,8

The idea was to make the IP parsing do what inet_aton does.

Testing with python:
>>> import socket
>>> socket.inet_aton("010.1.1.1")
'\x08\x01\x01\x01'
>>> socket.inet_aton("0.0.0.010")
'\x00\x00\x00\x08'
>>> socket.inet_aton("0.0.0.018")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
socket.error: illegal IP address string passed to inet_aton

If you don't like this behaviour, edit qipaddress.cpp and on line 97, change
        quint64 ll = qstrtoull(ptr, &endptr, 0, &ok);
to
        quint64 ll = qstrtoull(ptr, &endptr, 10, &ok);

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130818/ddba14ac/attachment.sig>


More information about the Development mailing list