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

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to