Commit Graph

78 Commits

Author SHA1 Message Date
Max Kellermann 393d57b387 util/NumberParser: rename to CNumberParser
A new NumberParser library based on std::from_chars() will be added.
2024-01-04 21:02:45 +01:00
Max Kellermann 1132a1c9a7 protocol/ArgParser: use libfmt 2023-03-06 20:10:06 +01:00
Max Kellermann 148aca23be use SPDX IDs, replacing the long copyright headers 2023-03-06 14:59:48 +01:00
Max Kellermann cc0def15c4 Copyright year 2022 2022-07-14 17:59:35 +02:00
Rosen Penev 29ae84e199 manual braced init
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-22 23:30:04 -08:00
Max Kellermann 72621531e0 protocol/Result: convert to Client method 2021-10-22 11:55:39 +02:00
Thomas Zander 6a2e7bbc02 protocol/ArgParser.cxx: Add missing #include <stdio.h>
Fixes a build problem on platforms where stdio.h is not included
transitively. snprintf() is defined in stdio.h.
2021-10-16 17:38:07 +02:00
Max Kellermann 792411384d protocol/ArgParser: add function MakeArgError()
Replaces FormatProtocolError().
2021-05-27 16:01:44 +02:00
Max Kellermann 157ddcbab1 protocol/RangeArg: add methods ClipRelaxed(), CheckClip(), CheckAdjustEnd() 2021-02-15 22:50:49 +01:00
Max Kellermann a6c10e9a1c protocol/ArgParser: check for invalid ranges
Catch errors like that early, before invalid ranges get passed to
internal MPD subsystems.
2021-02-15 20:55:30 +01:00
Max Kellermann 19a46064e9 protocol/RangeArg: add methods IsWellFormed(), IsEmpty(), HasAtLeast(), Count() 2021-02-15 20:54:51 +01:00
Max Kellermann b57eeaa720 protocol/RangeArg: add static method Single() 2021-02-15 20:29:37 +01:00
Max Kellermann ad059d5804 protocol/RangeArg: add method IsOpenEnded() 2021-02-15 20:29:35 +01:00
Max Kellermann 6e1940e930 protocol/RangeArg: add static method OpenEnded() 2021-02-15 20:29:34 +01:00
Max Kellermann 103194e32d protocol/RangeArg: add missing `noexcept` 2021-02-15 19:56:02 +01:00
Max Kellermann 5348f8c9c8 copyright year 2021 2021-01-01 19:54:28 +01:00
Max Kellermann 1195eb266e protocol/Ack: remove unused variable `ack_domain` 2020-10-28 15:47:05 +01:00
Rosen Penev a2f5a63bbc
replace stdint.h with cstdint
The former is deprecated by C++14. The standard says they are the same:

The header defines all types and macros the same as the C standard library
header<stdint.h>.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 19:04:39 -07:00
Max Kellermann 07e0a31d02 release v0.21.20
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAl5Jm2cQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEj3nEACkdgWh02NT0EGpmumCn4cB1mZ78ef0GyGm
 OOJi6qrnfuQdFX89UlL1+Nrx1U4Q6O6XvlIuuWTdKUjRQ+g5ktWuN48uEIKJ38If
 5ZbAqEZOvrH2b2lHNX15v7OvwXeGYK28fBbAjKf7txOJtW86azZ3NTjn4bb2a77B
 cio+Rhj9+fXzx/nBxHGVhLY3OQWQySFTm2Nbaz6zQoQYgm2xZ0htHNsGYKV6nl8I
 2Xt5zPEIlbjqdK9moSL1qyCevLZc7ME1Ha1v45pLwrXeCKlqhr5+6xFe2BEc1+DZ
 NHVmVs4e0GqSnyNTEd8eHXn70lpJ5ZSfrrk/HIHkx0Jk2hoGmAasHIUQViYxBiMN
 LqET7vM9nslrvuHl1Dd7wE66rrkGW6ILYKB7w48Jw00W5BjBtgcEVSj3PoKwchdh
 m4+JNZFJvubrXFKWjuXfRtY3MXsDKfy7lMd0iXDAxjh0YJuC8VGpGwRLL4V2uEzs
 tr2UvWIpjlw96kvvjTDnJp5kjA7D77xomxNkCHmj2/LOsA/bd4ljoCcmX033DBRr
 b7ddcESVcqTYXtMnYSWxmcHqizGjwIAVr7SsRgNbzZzs0/DVNpFAb/tGz3K9DzzF
 vdpm3y5KqdGyVoMAsIZDsxannmxcpivI6iOITAQH5aIRSLN/8ZGzCZ6ucS2GTjwq
 TZUR7iOjVQ==
 =ejSV
 -----END PGP SIGNATURE-----

Merge tag 'v0.21.20'

release v0.21.20
2020-02-16 20:46:13 +01:00
Max Kellermann 5397d18ed9 protocol/ArgParser: cast seek offset to SignedSongTime
"The issue is that ParseCommandArgSignedSongTime parses with
SongTime::FromS, not SignedSongTime::FromS, before casting back to a
SignedSongTime for the return. With x86 overflow rules this doesn't
matter, but on ARM the first cast turns negative values to zero."

Closes https://github.com/MusicPlayerDaemon/MPD/issues/757
2020-02-10 09:18:37 +01:00
Max Kellermann 2817bf9e95 copyright year 2020 2020-01-18 19:23:49 +01:00
Max Kellermann d663f81420 include cleanups (powered by iwyu) 2019-07-05 09:59:58 +02:00
Max Kellermann a139279575 Copyright year 2019 2019-06-17 11:17:30 +02:00
Max Kellermann 95d8b30864 protocol/Ack: add `noexcept` 2019-03-25 19:01:34 +01:00
Max Kellermann eb94f409d5 protocol/Ack: perfect forwarding in the ProtocolError constructor 2019-03-25 19:01:27 +01:00
Max Kellermann ce49d99c2f check.h: remove obsolete header
Since we switched from autotools to Meson in commit
94592c1406, we don't need to include
`config.h` early to properly enable large file support.  Meson passes
the required macros on the compiler command line instead of defining
them in `config.h`.

This means we can include `config.h` at any time, whenever we want to
check its macros, and there are no ordering constraints.
2018-11-19 16:33:49 +01:00
Max Kellermann f5c9071494 *: copyright year 2018 2018-10-31 17:54:59 +01:00
Max Kellermann 15b2a4862e protocol/RangeArg: add Contains() 2018-09-02 08:17:22 +02:00
Max Kellermann 2915d2dd0f protocol/RangeArg: add IsAll() 2018-09-02 08:17:22 +02:00
Max Kellermann 590687fdea protocol/RangeArg: eliminate SetAll() 2018-09-02 08:17:22 +02:00
Max Kellermann 68f824a186 protocol/ArgParser: move struct RangeArg to separate header 2018-09-02 08:17:22 +02:00
Max Kellermann 5b0e8c6de0 Merge branch 'v0.20.x' 2018-03-05 11:13:42 +01:00
Max Kellermann dadd3ca671 protocol/ArgParser: disallow negative seek times
Instead of stopping playback (due to seek time overflow), reject the
seek command.  Closes #240

Relative negative values (with "seekcur") are still allowed, and MPD
will fix the resulting position if it turns out to be negative.  But
the "seek" and "seekid" commands use an unsigned time stamp which must
not be negative.
2018-03-04 11:46:11 +01:00
Max Kellermann 65bbb0e0aa release v0.20.17
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlqAMO0QHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEg8eD/49NlFvlNdkamgYvh7MI1Sn67yKAwQt+N51
 W0hVnmXwPoSg76gfWw8J9kVyQy/jEkaCxsPF/UuEbH5jzqAC0y8hwYVRkJaRc9wN
 ZfwHvLHeaUxQweoguEwRSREy4ZC4ImQOK+eAxI1R43mqxxyhko1Akc1NmRVWzYfv
 /FGmAjTi1U6FR/yDpdSFn1NdlPmIgZ4WDuRsDT2NrshX/Bb32FiyZBytvek2P8n/
 QNgXv18E4yWXSb+zBYhPy/eaKhGasyjI3cbht1F0hNW9Yo/BsFxDuwXrX1vNBaOS
 E3Dux4s/nfcJ4RMRjmrkFwXImCvxt7+AGfh8RYBXuwqMExXz2kZjIs4ZVvO7Nu9A
 pFDJQwRIojXMfk73LU/MEpmNNEXhvfQLYkrM7poSqYaOr8SWMszqSgNnnfq6+flB
 sJbstgAStI6lL0jy0HrtMTvPVEiAGh6wCvMy/r2G9XUAyw76ccOg7MaIldn0MHJv
 A51+GfRTi4ILH0ReL1BGAg9nG97uFmRAWGkfkhtyD540xGRk7x5R8/ml4zFogHN6
 SbrV0NPdwk+uFd0y2znQT2gWyjc0id4WEKEoHX+Gl6c5qtPIfrq+PQPyk9kR+u+i
 AxwqMoKQer6Ji5qnsvCiKSkaGGiVNivrZ11jDWNCZaKjmvlKlvj/P5GxbPpORorq
 v4ru/4vNXQ==
 =v4t8
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.17'

release v0.20.17
2018-02-11 13:22:43 +01:00
Max Kellermann 0f8d223c7f protocol/ArgParser: move strtof()/strtod() switch to util/NumberParser.hxx 2018-02-09 22:54:22 +01:00
Max Kellermann 19a2885fd5 protocol/ArgParser: use strtod() instead of strtof() on Android
For Android pre-5.0 compatibility (#213).
2018-02-09 22:54:22 +01:00
Max Kellermann 97f670658f util/StringFormat: new utility library 2018-01-24 13:28:28 +01:00
Max Kellermann 4faef28cc5 release v0.20.7
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlkaFL0QHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEr4ID/9iAQC+7fFv06uLOm48Ufu+PgoD8uJkAwF5
 QuLQkc85g9urn+bu9N7Qs7Vypp7aLyGcJKY0jyA8wxkOj24pUC3GYk80daUt561V
 5s20FnoS/Uoman3CSJL94IfCUBxejizE6vgIIHTc5bb6U0qIsPub/8JTTE2Ih7uP
 nvFZ5uBQ+YTc7at+iIH9123eUMKkitkh8osNblovqQT9v42++Tm4ztAytRHBjwUA
 Itew5HhlvahbLKqFs/7vmICh/YX1FcOV7cV+erEWYfkH0KCI2bhSle4u2d0CBOvD
 VJlDnBCo9bM7WKcPYqJiFFFXA0CRk06wbkkkAtwF4zjp8xos7aQcq4FyQnYL8KXo
 5lijIhRwBURBd+nt8oA9kuEhBt/T75otcemJkzVaYappHTJCLjhxSGcPt8mw+nE9
 9WQzsp/MIVzg9l5g3D9S/43xM7uhvn98Tn1Qf2s8YRd2o8CZeOhW+X3RvbCvVPv2
 mOlx4sFAv8DOJ3KxMdqiJT+PmylPyJluQdqH+tMc8BdPg/kpSpYIPTuSjjRqK1yh
 ld5do0HtAAwiHtvXfk5YVFjJSpO0c8yVn6xci2Cl4k/5ZHj2UE1ln+N5vCea2BRF
 2J3HAjROwtcwY3lU1jFnEAogf24KWiFJqhhC0EqBGUdlrM8Dn37P5cEWWjROIMNK
 lPEdovokNw==
 =CdDy
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.7'

release v0.20.7
2017-05-15 23:01:49 +02:00
Max Kellermann 788e3b31e1 *: remove "pure" and "const" attributes from throwing functions
The "pure" and "const" attributes are not so well-defined, and a
recent clang version implements an optimization which pushes the
definition's boundary beyond what I believed it was.  clang now
assumes that functions declared "pure" cannot throw exceptions, even
if they lack the "noexcept" specification.

When compiled with this new clang version, MPD will crash randomly if
an exception happens to get thrown by such as "pure" function
(https://github.com/MusicPlayerDaemon/MPD/issues/41).

This commit removes all such misplaced "pure" and "const" attributes,
closing #41.
2017-05-08 17:25:06 +02:00
Max Kellermann 16b260e371 Client: eliminate client_puts(), use Client::Write() instead 2017-02-03 20:46:53 +01:00
Max Kellermann 5900253b85 update copyright year 2017-01-03 20:48:59 +01:00
Max Kellermann 6ff01cc72c Merge branch 'v0.19.x' 2016-03-07 14:30:43 +01:00
Max Kellermann 1532ffe215 protocol/ArgParser: fix range check
The old check

 unsigned(value) > std::numeric_limits<unsigned>::max()

.. cannot ever fail.
2016-03-06 23:41:08 +01:00
Max Kellermann 1aee89f5ea *: include cleanup (using iwyu) 2016-03-01 22:08:13 +01:00
Max Kellermann 1d67aa7bf2 update copyright year to 2016 2016-02-26 17:54:05 +01:00
Max Kellermann e939d667d9 protocol/Ack: add exception class wrapping enum ack 2015-12-18 09:53:02 +01:00
Max Kellermann 8e408725e9 protocol/Result: move current_command to class Response 2015-08-14 19:04:00 +02:00
Max Kellermann d053797340 protocol/Result: move command_list_num to class Response 2015-08-14 19:00:02 +02:00
Max Kellermann c8d0f947d2 protocol/Result: move error code to class Response 2015-08-14 18:57:44 +02:00
Max Kellermann 7652a2986b client/Response: new Client wrapper class for writing responses 2015-08-12 08:41:05 +02:00