Mercurial > hg > orthanc-stone
comparison Platforms/Wasm/WasmWebService.js @ 419:d638d5721f1c
replace deprecated writeStringToMemory by stringToUTF8
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 15 Nov 2018 18:41:50 +0100 |
parents | aee3d7941c9b |
children | e641d3978856 |
comparison
equal
deleted
inserted
replaced
418:c23df8b3433b | 419:d638d5721f1c |
---|---|
17 xhr.onreadystatechange = function() { | 17 xhr.onreadystatechange = function() { |
18 if (this.readyState == XMLHttpRequest.DONE) { | 18 if (this.readyState == XMLHttpRequest.DONE) { |
19 if (xhr.status === 200) { | 19 if (xhr.status === 200) { |
20 var s = xhr.getAllResponseHeaders(); | 20 var s = xhr.getAllResponseHeaders(); |
21 var headers = _malloc(s.length + 1); | 21 var headers = _malloc(s.length + 1); |
22 writeStringToMemory(s, headers); | 22 stringToUTF8(s, headers, s.length + 1); |
23 | 23 |
24 // TODO - Is "new Uint8Array()" necessary? This copies the | 24 // TODO - Is "new Uint8Array()" necessary? This copies the |
25 // answer to the WebAssembly stack, hence necessitating | 25 // answer to the WebAssembly stack, hence necessitating |
26 // increasing the TOTAL_STACK parameter of Emscripten | 26 // increasing the TOTAL_STACK parameter of Emscripten |
27 WasmWebService_NotifySuccess(callableSuccess, url_, new Uint8Array(this.response), | 27 WasmWebService_NotifySuccess(callableSuccess, url_, new Uint8Array(this.response), |
52 xhr.onreadystatechange = function() { | 52 xhr.onreadystatechange = function() { |
53 if (this.readyState == XMLHttpRequest.DONE) { | 53 if (this.readyState == XMLHttpRequest.DONE) { |
54 if (xhr.status === 200) { | 54 if (xhr.status === 200) { |
55 var s = xhr.getAllResponseHeaders(); | 55 var s = xhr.getAllResponseHeaders(); |
56 var headers = _malloc(s.length + 1); | 56 var headers = _malloc(s.length + 1); |
57 writeStringToMemory(s, headers); | 57 stringToUTF8(s, headers, s.length + 1); |
58 | 58 |
59 WasmWebService_NotifySuccess(callableSuccess, url_, new Uint8Array(this.response), | 59 WasmWebService_NotifySuccess(callableSuccess, url_, new Uint8Array(this.response), |
60 this.response.byteLength, headers, payload); | 60 this.response.byteLength, headers, payload); |
61 } else { | 61 } else { |
62 WasmWebService_NotifyError(callableFailure, url_, payload); | 62 WasmWebService_NotifyError(callableFailure, url_, payload); |
84 xhr.onreadystatechange = function() { | 84 xhr.onreadystatechange = function() { |
85 if (this.readyState == XMLHttpRequest.DONE) { | 85 if (this.readyState == XMLHttpRequest.DONE) { |
86 if (xhr.status === 200) { | 86 if (xhr.status === 200) { |
87 var s = xhr.getAllResponseHeaders(); | 87 var s = xhr.getAllResponseHeaders(); |
88 var headers = _malloc(s.length + 1); | 88 var headers = _malloc(s.length + 1); |
89 writeStringToMemory(s, headers); | 89 stringToUTF8(s, headers, s.length + 1); |
90 | 90 |
91 WasmWebService_NotifySuccess(callableSuccess, url_, new Uint8Array(this.response), | 91 WasmWebService_NotifySuccess(callableSuccess, url_, new Uint8Array(this.response), |
92 this.response.byteLength, headers, payload); | 92 this.response.byteLength, headers, payload); |
93 } else { | 93 } else { |
94 WasmWebService_NotifyError(callableFailure, url_, payload); | 94 WasmWebService_NotifyError(callableFailure, url_, payload); |