diff options
| author | bptato <nincsnevem662@gmail.com> | 2025-04-24 00:38:32 +0200 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2025-04-24 00:49:12 +0200 |
| commit | c8504a02bf5980e61545ddf24a3d92f078de5043 (patch) | |
| tree | d1ba5dea9a5b7e57bf4cda3606c19c3b43d2dc29 | |
| parent | 9ef6c67681991ec8df7b9caf77dafd76d7cdc790 (diff) | |
| download | chawan-c8504a02bf5980e61545ddf24a3d92f078de5043.tar.gz | |
http: cast away GCC complaints properly
| -rw-r--r-- | adapter/protocol/http.nim | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/adapter/protocol/http.nim b/adapter/protocol/http.nim index 9cd1427f..655af7a5 100644 --- a/adapter/protocol/http.nim +++ b/adapter/protocol/http.nim @@ -76,7 +76,9 @@ const libbrotlidecCflags = staticExec("pkg-config --cflags libbrotlidec") type BrotliDecoderState {.importc, header: "<brotli/decode.h>", incompleteStruct.} = object -type uint8PConst {.importc: "const uint8_t *".} = distinct ptr uint8 +type + uint8PConstPImpl {.importc: "const uint8_t**".} = cstring + uint8PConstP = distinct uint8PConstPImpl type BrotliDecoderResult {.size: sizeof(cint).} = enum BROTLI_DECODER_RESULT_ERROR = 0 @@ -97,7 +99,7 @@ proc BrotliDecoderCreateInstance(alloc_func: brotli_alloc_func; free_func: brotli_free_func; opaque: pointer): ptr BrotliDecoderState proc BrotliDecoderDestroyInstance(state: ptr BrotliDecoderState) proc BrotliDecoderDecompressStream(state: ptr BrotliDecoderState; - available_in: var csize_t; next_in: var uint8PConst; + available_in: var csize_t; next_in: uint8PConstP; available_out: out csize_t; next_out: var ptr uint8; total_out: ptr csize_t): BrotliDecoderResult proc BrotliDecoderGetErrorCode(state: ptr BrotliDecoderState): @@ -211,9 +213,10 @@ proc unbrotli(op: HTTPHandle) = while true: var iqn = csize_t(len) - n var oqn = csize_t(oq.len) - var next_in = cast[uint8PConst](addr iq[n]) + var next_in = addr iq[n] var next_out = addr oq[0] - let status = decomp.BrotliDecoderDecompressStream(iqn, next_in, oqn, + let next_inP = cast[uint8PConstP](addr next_in) + let status = decomp.BrotliDecoderDecompressStream(iqn, next_inP, oqn, next_out, nil) if not os.writeDataLoop(oq.toOpenArray(0, oq.len - int(oqn) - 1)): quit(1) |