From 9763167d39aa912dd69b1720c2aefa0c278054c1 Mon Sep 17 00:00:00 2001 From: chai2010 Date: Sun, 23 Jun 2019 07:57:58 +0800 Subject: [PATCH] base64: fix build $ cat hello_world.v import base64 println('Hello!') $ v run hello_world.v ============running hello_world============================== Hello! 10 vlang-zh.cn chai-mba:examples chai$ v run hello_world.v println println Generating main()... /Users/chai//.vlang0.0.12//hello_world.c:3783:22: error: used type 'string' (aka 'struct string') where arithmetic or pointer type is required return (/*casttt*/ (string)( /*77*/ str ) ) ; ^ ~~~~~~~~~~~~~~ 1 error generated. V panic: clang error --- base64/base64.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base64/base64.v b/base64/base64.v index 266b1e99c6..6f8c5df43d 100644 --- a/base64/base64.v +++ b/base64/base64.v @@ -44,6 +44,6 @@ fn decode(data string) string { } } str[str_len + 1] = `\0` - return string(str) + return tos(str, str_len+2) }