From 00a65ba10a88e083a8061bef79a0adb49e426d3d Mon Sep 17 00:00:00 2001 From: Per Hedbor <ph@opera.com> Date: Wed, 11 Dec 2013 13:26:45 +0100 Subject: [PATCH] Some more string -> string(0..255). encode_value_*, read_{file,bytes} and string2hex and hex2string. I have only updated the return values, to avoid making it even more impossible to write strict types code. --- lib/modules/Stdio.pmod/module.pmod | 4 ++-- src/builtin.cmod | 4 ++-- src/builtin_functions.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/modules/Stdio.pmod/module.pmod b/lib/modules/Stdio.pmod/module.pmod index e745a7907c..4ef5052feb 100644 --- a/lib/modules/Stdio.pmod/module.pmod +++ b/lib/modules/Stdio.pmod/module.pmod @@ -2307,7 +2307,7 @@ void report_file_open_places (string file) //! @seealso //! @[read_bytes()], @[write_file()] //! -string read_file(string filename,void|int start,void|int len) +string(0..255) read_file(string filename,void|int start,void|int len) { FILE f; string ret; @@ -2386,7 +2386,7 @@ string read_file(string filename,void|int start,void|int len) //! @seealso //! @[read_file], @[write_file()], @[append_file()] //! -string read_bytes(string filename, void|int start,void|int len) +string(0..255) read_bytes(string filename, void|int start,void|int len) { string ret; File f = File(); diff --git a/src/builtin.cmod b/src/builtin.cmod index 00f69c0021..800f639a14 100644 --- a/src/builtin.cmod +++ b/src/builtin.cmod @@ -949,7 +949,7 @@ static const unsigned char hexdecode[256] = }; PMOD_EXPORT -PIKEFUN string string2hex(string s) + PIKEFUN string(0..255) string2hex(string s) errname String.string2hex; optflags OPT_TRY_OPTIMIZE; { @@ -982,7 +982,7 @@ PIKEFUN string string2hex(string s) *! @[string2hex()] */ PMOD_EXPORT -PIKEFUN string hex2string(string hex) +PIKEFUN string(0..255) hex2string(string hex) errname String.hex2string; optflags OPT_TRY_OPTIMIZE; { diff --git a/src/builtin_functions.c b/src/builtin_functions.c index 30c56dfac8..e1bc1a6d9e 100644 --- a/src/builtin_functions.c +++ b/src/builtin_functions.c @@ -10266,11 +10266,11 @@ void init_builtin_efuns(void) /* function(mixed,void|object:string) */ ADD_EFUN("encode_value", f_encode_value, - tFunc(tMix tOr(tVoid,tObj),tStr), OPT_TRY_OPTIMIZE); + tFunc(tMix tOr(tVoid,tObj),tStr8), OPT_TRY_OPTIMIZE); /* function(mixed,void|object:string) */ ADD_EFUN("encode_value_canonic", f_encode_value_canonic, - tFunc(tMix tOr(tVoid,tObj),tStr), OPT_TRY_OPTIMIZE); + tFunc(tMix tOr(tVoid,tObj),tStr8), OPT_TRY_OPTIMIZE); /* function(string,void|object:mixed) */ ADD_EFUN("decode_value", f_decode_value, -- GitLab