diff options
author | iphydf <iphydf@users.noreply.github.com> | 2020-03-23 00:46:02 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2020-04-04 21:18:05 +0000 |
commit | 09649615575b7a3286892a433479512df2a7eb40 (patch) | |
tree | 4baab7a37f834c1483a96c70081d5b6dbf287c7b | |
parent | 40dd88596eda0eea5df67e747e93baf65cab2cbf (diff) |
Migrate format-source script to new apidsl web app.
This one is unfortunately a little more complicated to use. I may add a
simpler API later, but for now, it's JSON-based (because I couldn't get
binary data to work without it getting mangled somewhere along the way -
JSON is at least text-transport-safe).
-rwxr-xr-x | other/astyle/format-source | 24 | ||||
-rw-r--r-- | toxcore/tox.api.h | 10 |
2 files changed, 27 insertions, 7 deletions
diff --git a/other/astyle/format-source b/other/astyle/format-source index c2238841..7fa8b677 100755 --- a/other/astyle/format-source +++ b/other/astyle/format-source | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/bash |
2 | 2 | ||
3 | set -ex | 3 | set -ex |
4 | 4 | ||
@@ -30,8 +30,28 @@ if ! which "$APIDSL"; then | |||
30 | fi | 30 | fi |
31 | fi | 31 | fi |
32 | 32 | ||
33 | TO_JSON='s/\\/\\\\/g;s/\n/\\n/g;s/"/\\"/g;s/^(.*)$/"$1"/' | ||
34 | FROM_JSON='s/\\"/"/g;s/^"(.*)"$/$1/;s/\\\\/\\/g;s/\\n/\n/g' | ||
35 | |||
36 | apidsl_request() { | ||
37 | TMPFILE=$(mktemp /tmp/apidsl.XXXXXX) | ||
38 | curl -o "$TMPFILE" -X POST --data @<( | ||
39 | echo '["Request",'; | ||
40 | cat $2; | ||
41 | echo ']') https://apidsl2.herokuapp.com/$1 | ||
42 | if grep '\[1,"' "$TMPFILE" > /dev/null; then | ||
43 | echo "Error: $(grep -o '".*"' /tmp/apidsl-$$ | perl -0777 -pe "$FROM_JSON")" >&2 | ||
44 | rm "$TMPFILE" | ||
45 | exit 1 | ||
46 | fi | ||
47 | perl -0777 -pe 's/^\[0,(.*)\]$/$1/' "$TMPFILE" | ||
48 | rm "$TMPFILE" | ||
49 | } | ||
50 | |||
33 | apidsl_curl() { | 51 | apidsl_curl() { |
34 | curl -X POST --data-binary @"$1" https://apidsl.herokuapp.com/apidsl | 52 | apidsl_request "c" <( |
53 | apidsl_request "parse" <( | ||
54 | perl -0777 -pe "$TO_JSON" $1)) | perl -0777 -pe "$FROM_JSON" | ||
35 | } | 55 | } |
36 | 56 | ||
37 | # Check if apidsl generated sources are up to date. | 57 | # Check if apidsl generated sources are up to date. |
diff --git a/toxcore/tox.api.h b/toxcore/tox.api.h index c0901d0a..87c3219a 100644 --- a/toxcore/tox.api.h +++ b/toxcore/tox.api.h | |||
@@ -2279,9 +2279,9 @@ namespace conference { | |||
2279 | namespace peer { | 2279 | namespace peer { |
2280 | 2280 | ||
2281 | /** | 2281 | /** |
2282 | * Return the number of online peers in the conference. The unsigned | 2282 | * Return the number of online peers in the conference. The unsigned |
2283 | * integers less than this number are the valid values of peer_number for | 2283 | * integers less than this number are the valid values of peer_number for |
2284 | * the functions querying these peers. Return value is unspecified on | 2284 | * the functions querying these peers. Return value is unspecified on |
2285 | * failure. | 2285 | * failure. |
2286 | */ | 2286 | */ |
2287 | const uint32_t count(uint32_t conference_number) | 2287 | const uint32_t count(uint32_t conference_number) |
@@ -2330,8 +2330,8 @@ namespace conference { | |||
2330 | namespace offline_peer { | 2330 | namespace offline_peer { |
2331 | 2331 | ||
2332 | /** | 2332 | /** |
2333 | * Return the number of offline peers in the conference. The unsigned | 2333 | * Return the number of offline peers in the conference. The unsigned |
2334 | * integers less than this number are the valid values of offline_peer_number for | 2334 | * integers less than this number are the valid values of offline_peer_number for |
2335 | * the functions querying these peers. Return value is unspecified on failure. | 2335 | * the functions querying these peers. Return value is unspecified on failure. |
2336 | */ | 2336 | */ |
2337 | const uint32_t count(uint32_t conference_number) | 2337 | const uint32_t count(uint32_t conference_number) |