diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/base64/base64.tm | 14 | ||||
| -rw-r--r-- | examples/http/http.tm | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/examples/base64/base64.tm b/examples/base64/base64.tm index f22883cd..698c6bce 100644 --- a/examples/base64/base64.tm +++ b/examples/base64/base64.tm @@ -2,7 +2,7 @@ _enc := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/":utf8_bytes() -_EQUAL_BYTE := 0x3D[B] +_EQUAL_BYTE := Byte(0x3D) _dec := [ :Byte @@ -29,9 +29,9 @@ lang Base64: return Base64.from_bytes(text:utf8_bytes()) func from_bytes(bytes:[Byte] -> Base64?): - output := [0[B] for _ in bytes.length * 4 / 3 + 4] - src := 1[64] - dest := 1[64] + output := [Byte(0) for _ in bytes.length * 4 / 3 + 4] + src := Int64(1) + dest := Int64(1) while src + 2 <= bytes.length: chunk24 := ( (Int32(bytes[src]) <<< 16) or (Int32(bytes[src+1]) <<< 8) or Int32(bytes[src+2]) @@ -66,9 +66,9 @@ lang Base64: func decode_bytes(b64:Base64 -> [Byte]?): bytes := b64.text_content:utf8_bytes() - output := [0[B] for _ in bytes.length/4 * 3] - src := 1[64] - dest := 1[64] + output := [Byte(0) for _ in bytes.length/4 * 3] + src := Int64(1) + dest := Int64(1) while src + 3 <= bytes.length: chunk24 := ( (Int32(_dec[1+bytes[src]]) <<< 18) or diff --git a/examples/http/http.tm b/examples/http/http.tm index 934c8690..f64a5048 100644 --- a/examples/http/http.tm +++ b/examples/http/http.tm @@ -64,7 +64,7 @@ func _send(method:_Method, url:Text, data:Text?, headers=[:Text] -> HTTPResponse curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk); } - code := 0[64] + code := Int64(0) inline C { CURLcode res = curl_easy_perform(curl); if (res != CURLE_OK) @@ -75,7 +75,7 @@ func _send(method:_Method, url:Text, data:Text?, headers=[:Text] -> HTTPResponse curl_slist_free_all(chunk); curl_easy_cleanup(curl); } - return HTTPResponse(code, "":join(chunks)) + return HTTPResponse(Int(code), "":join(chunks)) func get(url:Text, headers=[:Text] -> HTTPResponse): return _send(GET, url, !Text, headers) |
