[svn:parrot] r49748 - in branches/string_checks: compilers/imcc config/gen/config_pm config/gen/makefiles src src/dynpmc src/io src/pmc src/string src/string/encoding t/compilers/imcc/syn t/library t/op t/pmc t/pmc/testlib tools/dev
nwellnhof at svn.parrot.org
nwellnhof at svn.parrot.org
Sun Oct 31 15:00:07 UTC 2010
Author: nwellnhof
Date: Sun Oct 31 15:00:04 2010
New Revision: 49748
URL: https://trac.parrot.org/parrot/changeset/49748
Log:
[str] Encoding cleanup
There are several places where strings are created with the default
ASCII encoding and filled with binary data. This commit fixes hopefully
all of these cases and adds checks for ASCII data in Parrot_str_new_init
and STRING_iter_set_and_advance.
This commit also adds the "b" flag to FileHandle.open as a shortcut to
open a file in binary mode.
Modified:
branches/string_checks/compilers/imcc/pbc.c
branches/string_checks/config/gen/config_pm/config_pir.in
branches/string_checks/config/gen/makefiles/root.in
branches/string_checks/src/dynpmc/gziphandle.pmc
branches/string_checks/src/global_setup.c
branches/string_checks/src/io/api.c
branches/string_checks/src/io/buffer.c
branches/string_checks/src/io/socket_unix.c
branches/string_checks/src/io/socket_win32.c
branches/string_checks/src/library.c
branches/string_checks/src/multidispatch.c
branches/string_checks/src/pmc/eval.pmc
branches/string_checks/src/pmc/fixedbooleanarray.pmc
branches/string_checks/src/string/api.c
branches/string_checks/src/string/encoding/ascii.c
branches/string_checks/src/string/encoding/binary.c
branches/string_checks/src/string/encoding/latin1.c
branches/string_checks/src/string/encoding/null.c
branches/string_checks/src/string/encoding/shared.c
branches/string_checks/src/string/encoding/shared.h
branches/string_checks/t/compilers/imcc/syn/objects.t
branches/string_checks/t/library/mime_base64.t
branches/string_checks/t/op/stringu.t
branches/string_checks/t/pmc/freeze.t
branches/string_checks/t/pmc/packfile.t
branches/string_checks/t/pmc/testlib/packfile_common.pir
branches/string_checks/tools/dev/pbc_to_exe.pir
Modified: branches/string_checks/compilers/imcc/pbc.c
==============================================================================
--- branches/string_checks/compilers/imcc/pbc.c Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/compilers/imcc/pbc.c Sun Oct 31 15:00:04 2010 (r49748)
@@ -933,7 +933,7 @@
"Unknown encoding '%s'", encoding_name);
}
if (s_encoding->max_bytes_per_codepoint == 1)
- src_encoding = Parrot_ascii_encoding_ptr;
+ src_encoding = s_encoding;
else
src_encoding = Parrot_utf8_encoding_ptr;
Modified: branches/string_checks/config/gen/config_pm/config_pir.in
==============================================================================
--- branches/string_checks/config/gen/config_pm/config_pir.in Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/config/gen/config_pm/config_pir.in Sun Oct 31 15:00:04 2010 (r49748)
@@ -70,6 +70,7 @@
.local pmc CONF
CONF = new 'FileHandle'
push_eh error
+ CONF.'encoding'('binary')
.local string image
image = CONF.'readall'(conf_file)
pop_eh
Modified: branches/string_checks/config/gen/makefiles/root.in
==============================================================================
--- branches/string_checks/config/gen/makefiles/root.in Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/config/gen/makefiles/root.in Sun Oct 31 15:00:04 2010 (r49748)
@@ -1646,7 +1646,8 @@
src/string/encoding/shared$(O) : $(PARROT_H_HEADERS) \
src/string/encoding/shared.h \
src/string/encoding/tables.h
-src/string/encoding/null$(O) : $(PARROT_H_HEADERS)
+src/string/encoding/null$(O) : $(PARROT_H_HEADERS) \
+ src/string/encoding/shared.h
src/string/encoding/ascii$(O) : $(PARROT_H_HEADERS) \
src/string/encoding/shared.h \
src/string/encoding/tables.h
Modified: branches/string_checks/src/dynpmc/gziphandle.pmc
==============================================================================
--- branches/string_checks/src/dynpmc/gziphandle.pmc Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/src/dynpmc/gziphandle.pmc Sun Oct 31 15:00:04 2010 (r49748)
@@ -208,7 +208,8 @@
GET_ATTR_file(INTERP, SELF, file);
result = gzread(file, buf, length);
if (result > 0) {
- str = Parrot_str_new(INTERP, buf, result);
+ str = Parrot_str_new_init(INTERP, buf, result,
+ Parrot_binary_encoding_ptr, 0);
}
mem_sys_free(buf);
RETURN(STRING *str);
@@ -263,7 +264,8 @@
switch (rc) {
case Z_OK:
- dst = Parrot_str_new(INTERP, buf, dstLen);
+ dst = Parrot_str_new_init(INTERP, buf, dstLen,
+ Parrot_binary_encoding_ptr, 0);
mem_sys_free(buf);
break;
@@ -314,7 +316,8 @@
switch (rc) {
case Z_OK:
Parrot_str_free_cstring(src);
- dst = Parrot_str_new(INTERP, buf, dstLen);
+ dst = Parrot_str_new_init(INTERP, buf, dstLen,
+ Parrot_binary_encoding_ptr, 0);
mem_sys_free(buf);
break;
Modified: branches/string_checks/src/global_setup.c
==============================================================================
--- branches/string_checks/src/global_setup.c Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/src/global_setup.c Sun Oct 31 15:00:04 2010 (r49748)
@@ -99,7 +99,7 @@
STRING * const config_string =
Parrot_str_new_init(interp,
(const char *)parrot_config_stored, parrot_config_size_stored,
- Parrot_default_encoding_ptr,
+ Parrot_binary_encoding_ptr,
PObj_external_FLAG|PObj_constant_FLAG);
config_hash = Parrot_thaw(interp, config_string);
Modified: branches/string_checks/src/io/api.c
==============================================================================
--- branches/string_checks/src/io/api.c Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/src/io/api.c Sun Oct 31 15:00:04 2010 (r49748)
@@ -122,7 +122,6 @@
{
ASSERT_ARGS(Parrot_io_open)
PMC *new_filehandle, *filehandle;
- INTVAL flags;
const INTVAL typenum = Parrot_get_ctx_HLL_type(interp,
Parrot_PMC_typenum(interp, "FileHandle"));
if (PMC_IS_NULL(pmc)) {
@@ -131,8 +130,8 @@
else
new_filehandle = pmc;
- flags = Parrot_io_parse_open_flags(interp, mode);
if (new_filehandle->vtable->base_type == typenum) {
+ const INTVAL flags = Parrot_io_parse_open_flags(interp, mode);
/* TODO: a filehandle shouldn't allow a NULL path. */
PARROT_ASSERT(new_filehandle->vtable->base_type == typenum);
filehandle = PIO_OPEN(interp, new_filehandle, path, flags);
@@ -143,6 +142,9 @@
SETATTR_FileHandle_flags(interp, new_filehandle, flags);
SETATTR_FileHandle_filename(interp, new_filehandle, path);
SETATTR_FileHandle_mode(interp, new_filehandle, mode);
+ if (!STRING_IS_NULL(mode)
+ && STRING_index(interp, mode, CONST_STRING(interp, "b"), 0) >= 0)
+ SETATTR_FileHandle_encoding(interp, new_filehandle, CONST_STRING(interp, "binary"));
Parrot_io_setbuf(interp, filehandle, PIO_UNBOUND);
}
else
@@ -328,7 +330,9 @@
if (pmc->vtable->base_type == enum_class_FileHandle) {
INTVAL ignored;
INTVAL flags;
+ STRING *encoding_str;
GETATTR_FileHandle_flags(interp, pmc, flags);
+ GETATTR_FileHandle_encoding(interp, pmc, encoding_str);
if (Parrot_io_is_closed_filehandle(interp, pmc)
|| !(flags & PIO_F_READ))
@@ -338,10 +342,17 @@
result = Parrot_str_new_noinit(interp, length);
result->bufused = length;
- if (Parrot_io_is_encoding(interp, pmc, CONST_STRING(interp, "utf8")))
+ if (Parrot_str_equal(interp, encoding_str, CONST_STRING(interp, "utf8")))
ignored = Parrot_io_read_utf8(interp, pmc, &result);
- else
+ else {
ignored = Parrot_io_read_buffer(interp, pmc, &result);
+
+ if (!STRING_IS_NULL(encoding_str))
+ result->encoding = Parrot_get_encoding(interp,
+ Parrot_encoding_number(interp, encoding_str));
+
+ STRING_validate(interp, result);
+ }
}
else if (pmc->vtable->base_type == enum_class_StringHandle) {
STRING *string_orig;
Modified: branches/string_checks/src/io/buffer.c
==============================================================================
--- branches/string_checks/src/io/buffer.c Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/src/io/buffer.c Sun Oct 31 15:00:04 2010 (r49748)
@@ -189,7 +189,8 @@
*/
if (buffer_flags & PIO_BF_WRITEBUF) {
size_t to_write = buffer_next - buffer_start;
- STRING *s = Parrot_str_new(interp, (char *)buffer_start, to_write);
+ STRING *s = Parrot_str_new_init(interp, (char *)buffer_start,
+ to_write, Parrot_binary_encoding_ptr, 0);
/* Flush to next layer */
long wrote = PIO_WRITE(interp, filehandle, s);
if (wrote == (long)to_write) {
@@ -232,7 +233,7 @@
char *buf = (char *) Parrot_io_get_buffer_start(interp, filehandle);
size_t size = Parrot_io_get_buffer_size(interp, filehandle);
STRING *s = Parrot_str_new_init(interp, buf, size,
- Parrot_default_encoding_ptr,
+ Parrot_binary_encoding_ptr,
PObj_external_FLAG);
size_t got = PIO_READ(interp, filehandle, &s);
Modified: branches/string_checks/src/io/socket_unix.c
==============================================================================
--- branches/string_checks/src/io/socket_unix.c Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/src/io/socket_unix.c Sun Oct 31 15:00:04 2010 (r49748)
@@ -349,11 +349,8 @@
AGAIN:
if ((error = recv(io->os_handle, buf, 2048, 0)) >= 0) {
bytesread += error;
- /* The encoding should probably be 'binary', but right now httpd.pir
- * only works with 'ascii'
- */
*s = Parrot_str_new_init(interp, buf, bytesread,
- Parrot_ascii_encoding_ptr, 0);
+ Parrot_binary_encoding_ptr, 0);
return bytesread;
}
else {
Modified: branches/string_checks/src/io/socket_win32.c
==============================================================================
--- branches/string_checks/src/io/socket_win32.c Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/src/io/socket_win32.c Sun Oct 31 15:00:04 2010 (r49748)
@@ -299,11 +299,8 @@
AGAIN:
if ((error = recv((int)io->os_handle, buf, 2048, 0)) >= 0) {
bytesread += error;
- /* The encoding should probably be 'binary', but right now httpd.pir
- * only works with 'ascii'
- */
*s = Parrot_str_new_init(interp, buf, bytesread,
- Parrot_ascii_encoding_ptr, 0);
+ Parrot_binary_encoding_ptr, 0);
return bytesread;
}
else {
Modified: branches/string_checks/src/library.c
==============================================================================
--- branches/string_checks/src/library.c Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/src/library.c Sun Oct 31 15:00:04 2010 (r49748)
@@ -842,12 +842,9 @@
/* This is a quick fix for TT #65
* TODO: redo it with the string reimplementation
*/
- STRING * const slash1 = Parrot_str_new_init(interp, "/", 1,
- in->encoding, PObj_external_FLAG|PObj_constant_FLAG);
- STRING * const slash2 = Parrot_str_new_init(interp, "\\", 1,
- in->encoding, PObj_external_FLAG|PObj_constant_FLAG);
- STRING * const dot = Parrot_str_new_init(interp, ".", 1,
- in->encoding, PObj_external_FLAG|PObj_constant_FLAG);
+ STRING * const slash1 = CONST_STRING(interp, "/");
+ STRING * const slash2 = CONST_STRING(interp, "\\");
+ STRING * const dot = CONST_STRING(interp, ".");
const INTVAL len = Parrot_str_byte_length(interp, in);
STRING *stem;
Modified: branches/string_checks/src/multidispatch.c
==============================================================================
--- branches/string_checks/src/multidispatch.c Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/src/multidispatch.c Sun Oct 31 15:00:04 2010 (r49748)
@@ -1146,7 +1146,8 @@
if (name)
strcpy((char *)(type_ids + num_values), name);
- key = Parrot_str_new(interp, (char *)type_ids, id_size);
+ key = Parrot_str_new_init(interp, (char *)type_ids, id_size,
+ Parrot_binary_encoding_ptr, 0);
mem_gc_free(interp, type_ids);
return key;
@@ -1248,7 +1249,8 @@
if (name)
strcpy((char *)(type_ids + num_types), name);
- key = Parrot_str_new(interp, (char *)type_ids, id_size);
+ key = Parrot_str_new_init(interp, (char *)type_ids, id_size,
+ Parrot_binary_encoding_ptr, 0);
mem_gc_free(interp, type_ids);
return key;
Modified: branches/string_checks/src/pmc/eval.pmc
==============================================================================
--- branches/string_checks/src/pmc/eval.pmc Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/src/pmc/eval.pmc Sun Oct 31 15:00:04 2010 (r49748)
@@ -249,7 +249,8 @@
* effect
*/
aligned_size = size + 15;
- res = Parrot_str_new_noinit(INTERP, aligned_size);
+ res = Parrot_str_new_init(INTERP, NULL, aligned_size,
+ Parrot_binary_encoding_ptr, 0);
res->strlen = res->bufused = size;
if ((size_t)(res->strstart) & 0xf) {
Modified: branches/string_checks/src/pmc/fixedbooleanarray.pmc
==============================================================================
--- branches/string_checks/src/pmc/fixedbooleanarray.pmc Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/src/pmc/fixedbooleanarray.pmc Sun Oct 31 15:00:04 2010 (r49748)
@@ -559,8 +559,9 @@
GET_ATTR_resize_threshold(INTERP, SELF, resize_threshold);
GET_ATTR_bit_array(INTERP, SELF, bit_array);
- s = Parrot_str_new(INTERP, (char*)bit_array,
- (resize_threshold / BITS_PER_CHAR));
+ s = Parrot_str_new_init(INTERP, (char*)bit_array,
+ (resize_threshold / BITS_PER_CHAR),
+ Parrot_binary_encoding_ptr, 0);
VTABLE_push_integer(INTERP, info, size);
VTABLE_push_string(INTERP, info, s);
Modified: branches/string_checks/src/string/api.c
==============================================================================
--- branches/string_checks/src/string/api.c Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/src/string/api.c Sun Oct 31 15:00:04 2010 (r49748)
@@ -717,10 +717,7 @@
Buffer_bufstart(s) = s->strstart = PARROT_const_cast(char *, buffer);
Buffer_buflen(s) = s->bufused = len;
- if (encoding->max_bytes_per_codepoint == 1)
- s->strlen = len;
- else
- s->strlen = STRING_scan(interp, s);
+ s->strlen = STRING_scan(interp, s);
return s;
}
@@ -730,10 +727,7 @@
if (buffer && len) {
mem_sys_memcopy(s->strstart, buffer, len);
s->bufused = len;
- if (encoding->max_bytes_per_codepoint == 1)
- s->strlen = len;
- else
- s->strlen = STRING_scan(interp, s);
+ s->strlen = STRING_scan(interp, s);
}
else
s->strlen = s->bufused = 0;
Modified: branches/string_checks/src/string/encoding/ascii.c
==============================================================================
--- branches/string_checks/src/string/encoding/ascii.c Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/src/string/encoding/ascii.c Sun Oct 31 15:00:04 2010 (r49748)
@@ -40,6 +40,11 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
+PARROT_WARN_UNUSED_RESULT
+static UINTVAL ascii_scan(PARROT_INTERP, ARGIN(const STRING *src))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
PARROT_CANNOT_RETURN_NULL
static STRING* ascii_titlecase(PARROT_INTERP, ARGIN(const STRING *src))
__attribute__nonnull__(1)
@@ -66,11 +71,6 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-PARROT_WARN_UNUSED_RESULT
-static UINTVAL ascii_validate(PARROT_INTERP, ARGIN(const STRING *src))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
#define ASSERT_ARGS_ascii_chr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_ascii_downcase __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -79,6 +79,9 @@
#define ASSERT_ARGS_ascii_downcase_first __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
+#define ASSERT_ARGS_ascii_scan __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_ascii_titlecase __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
@@ -94,9 +97,6 @@
#define ASSERT_ARGS_ascii_upcase_first __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
-#define ASSERT_ARGS_ascii_validate __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(src))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
@@ -143,12 +143,12 @@
Parrot_ascii_encoding_ptr, 0);
}
+
/*
-=item C<static UINTVAL ascii_validate(PARROT_INTERP, const STRING *src)>
+=item C<static UINTVAL ascii_scan(PARROT_INTERP, const STRING *src)>
-Verifies that the given string is valid ASCII. Returns 1 if it is ASCII,
-returns 0 otherwise.
+Returns the number of codepoints in string C<src>.
=cut
@@ -156,21 +156,22 @@
PARROT_WARN_UNUSED_RESULT
static UINTVAL
-ascii_validate(PARROT_INTERP, ARGIN(const STRING *src))
+ascii_scan(PARROT_INTERP, ARGIN(const STRING *src))
{
- ASSERT_ARGS(ascii_validate)
- String_iter iter;
- const UINTVAL length = Parrot_str_length(interp, src);
-
- STRING_ITER_INIT(interp, &iter);
- while (iter.charpos < length) {
- const UINTVAL codepoint = STRING_iter_get_and_advance(interp, src, &iter);
- if (codepoint >= 0x80)
- return 0;
+ ASSERT_ARGS(ascii_scan)
+ unsigned char *p = (unsigned char *)src->strstart;
+ UINTVAL i;
+
+ for (i = 0; i < src->bufused; ++i) {
+ if (p[i] >= 0x80)
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_STRING_REPRESENTATION,
+ "Invalid character in ASCII string");
}
- return 1;
+
+ return src->bufused;
}
+
/*
=item C<static STRING* ascii_upcase(PARROT_INTERP, const STRING *src)>
@@ -356,9 +357,9 @@
fixed8_index,
fixed8_rindex,
fixed8_hash,
- ascii_validate,
+ encoding_validate,
- fixed8_scan,
+ ascii_scan,
fixed8_ord,
fixed_substr,
Modified: branches/string_checks/src/string/encoding/binary.c
==============================================================================
--- branches/string_checks/src/string/encoding/binary.c Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/src/string/encoding/binary.c Sun Oct 31 15:00:04 2010 (r49748)
@@ -49,12 +49,15 @@
SHIM(const STRING *src),
SHIM(UINTVAL offset));
+static UINTVAL binary_scan(PARROT_INTERP, ARGIN(const STRING *src))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
PARROT_CANNOT_RETURN_NULL
static STRING* binary_to_encoding(PARROT_INTERP, ARGIN(const STRING *src))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-static UINTVAL binary_validate(SHIM_INTERP, SHIM(const STRING *src));
#define ASSERT_ARGS_binary_change_case __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_binary_chr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -62,10 +65,12 @@
#define ASSERT_ARGS_binary_find_cclass __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_binary_find_not_cclass __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_binary_is_cclass __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_binary_scan __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_binary_to_encoding __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
-#define ASSERT_ARGS_binary_validate __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
@@ -121,20 +126,21 @@
/*
-=item C<static UINTVAL binary_validate(PARROT_INTERP, const STRING *src)>
+=item C<static UINTVAL binary_scan(PARROT_INTERP, const STRING *src)>
-Returns 1. All sequential data is valid binary data.
+Returns the number of codepoints in string C<src>. No scanning needed
+for fixed encodings.
=cut
*/
-/* Binary's always valid */
static UINTVAL
-binary_validate(SHIM_INTERP, SHIM(const STRING *src))
+binary_scan(PARROT_INTERP, ARGIN(const STRING *src))
{
- ASSERT_ARGS(binary_validate)
- return 1;
+ ASSERT_ARGS(binary_scan)
+
+ return src->bufused;
}
@@ -230,9 +236,9 @@
fixed8_index,
fixed8_rindex,
fixed8_hash,
- binary_validate,
+ encoding_validate,
- fixed8_scan,
+ binary_scan,
fixed8_ord,
fixed_substr,
Modified: branches/string_checks/src/string/encoding/latin1.c
==============================================================================
--- branches/string_checks/src/string/encoding/latin1.c Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/src/string/encoding/latin1.c Sun Oct 31 15:00:04 2010 (r49748)
@@ -40,6 +40,10 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
+static UINTVAL latin1_scan(PARROT_INTERP, ARGIN(const STRING *src))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
PARROT_CANNOT_RETURN_NULL
static STRING* latin1_titlecase(PARROT_INTERP, ARGIN(const STRING *src))
__attribute__nonnull__(1)
@@ -67,10 +71,6 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-static UINTVAL latin1_validate(PARROT_INTERP, ARGIN(const STRING *src))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
#define ASSERT_ARGS_latin1_chr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_latin1_downcase __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -79,6 +79,9 @@
#define ASSERT_ARGS_latin1_downcase_first __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
+#define ASSERT_ARGS_latin1_scan __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_latin1_titlecase __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
@@ -94,9 +97,6 @@
#define ASSERT_ARGS_latin1_upcase_first __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
-#define ASSERT_ARGS_latin1_validate __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(src))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
@@ -146,27 +146,21 @@
/*
-=item C<static UINTVAL latin1_validate(PARROT_INTERP, const STRING *src)>
+=item C<static UINTVAL latin1_scan(PARROT_INTERP, const STRING *src)>
-Returns 1 if the STRING C<src> is a valid ISO-8859-1 STRING. Returns 0 otherwise.
+Returns the number of codepoints in string C<src>. No scanning needed
+for fixed encodings.
=cut
*/
static UINTVAL
-latin1_validate(PARROT_INTERP, ARGIN(const STRING *src))
+latin1_scan(PARROT_INTERP, ARGIN(const STRING *src))
{
- ASSERT_ARGS(latin1_validate)
- INTVAL offset;
- const INTVAL length = Parrot_str_length(interp, src);
-
- for (offset = 0; offset < length; ++offset) {
- const UINTVAL codepoint = STRING_ord(interp, src, offset);
- if (codepoint >= 0x100)
- return 0;
- }
- return 1;
+ ASSERT_ARGS(latin1_scan)
+
+ return src->bufused;
}
@@ -393,9 +387,9 @@
fixed8_index,
fixed8_rindex,
fixed8_hash,
- latin1_validate,
+ encoding_validate,
- fixed8_scan,
+ latin1_scan,
fixed8_ord,
fixed_substr,
Modified: branches/string_checks/src/string/encoding/null.c
==============================================================================
--- branches/string_checks/src/string/encoding/null.c Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/src/string/encoding/null.c Sun Oct 31 15:00:04 2010 (r49748)
@@ -17,6 +17,7 @@
*/
#include "parrot/parrot.h"
+#include "shared.h"
/* HEADERIZER HFILE: none */
@@ -51,11 +52,6 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-PARROT_WARN_UNUSED_RESULT
-static UINTVAL null_validate(PARROT_INTERP, ARGIN(const STRING *src))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
#define ASSERT_ARGS_null_compare __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(lhs) \
@@ -71,9 +67,6 @@
#define ASSERT_ARGS_null_scan __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
-#define ASSERT_ARGS_null_validate __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(src))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
@@ -164,25 +157,6 @@
/*
-=item C<static UINTVAL null_validate(PARROT_INTERP, const STRING *src)>
-
-Verifies the null string. Always returns 1.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-static UINTVAL
-null_validate(PARROT_INTERP, ARGIN(const STRING *src))
-{
- ASSERT_ARGS(null_validate)
- return 1;
-}
-
-
-/*
-
=item C<static UINTVAL null_scan(PARROT_INTERP, const STRING *src)>
Scans the null string. Always returns 0.
@@ -214,7 +188,7 @@
(str_vtable_index_t)null_error,
(str_vtable_rindex_t)null_error,
null_hash,
- null_validate,
+ encoding_validate,
null_scan,
(str_vtable_ord_t)null_error,
Modified: branches/string_checks/src/string/encoding/shared.c
==============================================================================
--- branches/string_checks/src/string/encoding/shared.c Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/src/string/encoding/shared.c Sun Oct 31 15:00:04 2010 (r49748)
@@ -45,9 +45,6 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
-#define UNIMPL Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED, \
- "unimpl fixed_8")
-
/*
@@ -197,7 +194,8 @@
{
ASSERT_ARGS(encoding_rindex)
/* TODO: https://trac.parrot.org/parrot/wiki/StringsTasklist Implement this. */
- UNIMPL;
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Unicode rindex not implemented");
}
@@ -333,6 +331,27 @@
/*
+=item C<UINTVAL encoding_validate(PARROT_INTERP, const STRING *src)>
+
+Verifies that the given string is valid. Returns 1 if it is valid,
+returns 0 otherwise.
+
+=cut
+
+*/
+
+PARROT_WARN_UNUSED_RESULT
+UINTVAL
+encoding_validate(PARROT_INTERP, ARGIN(const STRING *src))
+{
+ ASSERT_ARGS(encoding_validate)
+
+ return STRING_scan(interp, src) == src->strlen;
+}
+
+
+/*
+
=item C<void encoding_ord_error(PARROT_INTERP, const STRING *s, INTVAL offset)>
Throws the right exception if STRING_ord was called with a wrong index.
@@ -591,7 +610,8 @@
{
ASSERT_ARGS(encoding_decompose)
/* TODO: https://trac.parrot.org/parrot/wiki/StringsTasklist Implement this. */
- UNIMPL;
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Decompose not implemented");
}
@@ -863,26 +883,6 @@
/*
-=item C<UINTVAL fixed8_scan(PARROT_INTERP, const STRING *src)>
-
-Returns the number of codepoints in string C<src>. No scanning needed
-for fixed encodings.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-UINTVAL
-fixed8_scan(PARROT_INTERP, ARGIN(const STRING *src))
-{
- ASSERT_ARGS(fixed8_scan)
- return src->bufused;
-}
-
-
-/*
-
=item C<UINTVAL fixed8_ord(PARROT_INTERP, const STRING *src, INTVAL idx)>
codepoints are bytes, so delegate
@@ -1587,7 +1587,8 @@
{
ASSERT_ARGS(unicode_upcase_first)
/* TODO: https://trac.parrot.org/parrot/wiki/StringsTasklist Implement this. */
- UNIMPL;
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Unicode upcase_first not implemented");
}
@@ -1608,7 +1609,8 @@
{
ASSERT_ARGS(unicode_downcase_first)
/* TODO: https://trac.parrot.org/parrot/wiki/StringsTasklist Implement this. */
- UNIMPL;
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Unicode downcase_first not implemented");
}
@@ -1629,7 +1631,8 @@
{
ASSERT_ARGS(unicode_titlecase_first)
/* TODO: https://trac.parrot.org/parrot/wiki/StringsTasklist Implement this. */
- UNIMPL;
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Unicode titlecase_first not implemented");
}
Modified: branches/string_checks/src/string/encoding/shared.h
==============================================================================
--- branches/string_checks/src/string/encoding/shared.h Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/src/string/encoding/shared.h Sun Oct 31 15:00:04 2010 (r49748)
@@ -109,6 +109,11 @@
__attribute__nonnull__(2);
PARROT_WARN_UNUSED_RESULT
+UINTVAL encoding_validate(PARROT_INTERP, ARGIN(const STRING *src))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_WARN_UNUSED_RESULT
INTVAL fixed8_compare(PARROT_INTERP,
ARGIN(const STRING *lhs),
ARGIN(const STRING *rhs))
@@ -224,11 +229,6 @@
__attribute__nonnull__(2)
__attribute__nonnull__(3);
-PARROT_WARN_UNUSED_RESULT
-UINTVAL fixed8_scan(PARROT_INTERP, ARGIN(const STRING *src))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
PARROT_CANNOT_RETURN_NULL
STRING * fixed8_to_encoding(PARROT_INTERP,
ARGIN(const STRING *src),
@@ -323,6 +323,9 @@
#define ASSERT_ARGS_encoding_substr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
+#define ASSERT_ARGS_encoding_validate __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_fixed8_compare __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(lhs) \
@@ -374,9 +377,6 @@
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src) \
, PARROT_ASSERT_ARG(search_string))
-#define ASSERT_ARGS_fixed8_scan __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_fixed8_to_encoding __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src) \
Modified: branches/string_checks/t/compilers/imcc/syn/objects.t
==============================================================================
--- branches/string_checks/t/compilers/imcc/syn/objects.t Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/t/compilers/imcc/syn/objects.t Sun Oct 31 15:00:04 2010 (r49748)
@@ -28,7 +28,7 @@
.namespace ["Foo"]
.namespace [ ]
.namespace []
-.namespace [utf8:"»ö«"; ascii:"perl6"]
+.namespace [utf8:"\xbb\xf6\xab"; ascii:"perl6"]
.sub test
$I0 = 42
Modified: branches/string_checks/t/library/mime_base64.t
==============================================================================
--- branches/string_checks/t/library/mime_base64.t Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/t/library/mime_base64.t Sun Oct 31 15:00:04 2010 (r49748)
@@ -165,137 +165,137 @@
["|","fA=="],
["}","fQ=="],
["~","fg=="],
- ["","fw=="],
- ["","gA=="],
- ["","gQ=="],
- ["","gg=="],
- ["","gw=="],
- ["","hA=="],
- ["
","hQ=="],
- ["","hg=="],
- ["","hw=="],
- ["","iA=="],
- ["","iQ=="],
- ["","ig=="],
- ["","iw=="],
- ["","jA=="],
- ["","jQ=="],
- ["","jg=="],
- ["","jw=="],
- ["","kA=="],
- ["","kQ=="],
- ["","kg=="],
- ["","kw=="],
- ["","lA=="],
- ["","lQ=="],
- ["","lg=="],
- ["","lw=="],
- ["","mA=="],
- ["","mQ=="],
- ["","mg=="],
- ["","mw=="],
- ["","nA=="],
- ["","nQ=="],
- ["","ng=="],
- ["","nw=="],
- [" ","oA=="],
- ["¡","oQ=="],
- ["¢","og=="],
- ["£","ow=="],
- ["¤","pA=="],
- ["¥","pQ=="],
- ["¦","pg=="],
- ["§","pw=="],
- ["¨","qA=="],
- ["©","qQ=="],
- ["ª","qg=="],
- ["«","qw=="],
- ["¬","rA=="],
- ["","rQ=="],
- ["®","rg=="],
- ["¯","rw=="],
- ["°","sA=="],
- ["±","sQ=="],
- ["²","sg=="],
- ["³","sw=="],
- ["´","tA=="],
- ["µ","tQ=="],
- ["¶","tg=="],
- ["·","tw=="],
- ["¸","uA=="],
- ["¹","uQ=="],
- ["º","ug=="],
- ["»","uw=="],
- ["¼","vA=="],
- ["½","vQ=="],
- ["¾","vg=="],
- ["¿","vw=="],
- ["À","wA=="],
- ["Á","wQ=="],
- ["Â","wg=="],
- ["Ã","ww=="],
- ["Ä","xA=="],
- ["Å","xQ=="],
- ["Æ","xg=="],
- ["Ç","xw=="],
- ["È","yA=="],
- ["É","yQ=="],
- ["Ê","yg=="],
- ["Ë","yw=="],
- ["Ì","zA=="],
- ["Í","zQ=="],
- ["Î","zg=="],
- ["Ï","zw=="],
- ["Ð","0A=="],
- ["Ñ","0Q=="],
- ["Ò","0g=="],
- ["Ó","0w=="],
- ["Ô","1A=="],
- ["Õ","1Q=="],
- ["Ö","1g=="],
- ["×","1w=="],
- ["Ø","2A=="],
- ["Ù","2Q=="],
- ["Ú","2g=="],
- ["Û","2w=="],
- ["Ü","3A=="],
- ["Ý","3Q=="],
- ["Þ","3g=="],
- ["ß","3w=="],
- ["à","4A=="],
- ["á","4Q=="],
- ["â","4g=="],
- ["ã","4w=="],
- ["ä","5A=="],
- ["å","5Q=="],
- ["æ","5g=="],
- ["ç","5w=="],
- ["è","6A=="],
- ["é","6Q=="],
- ["ê","6g=="],
- ["ë","6w=="],
- ["ì","7A=="],
- ["í","7Q=="],
- ["î","7g=="],
- ["ï","7w=="],
- ["ð","8A=="],
- ["ñ","8Q=="],
- ["ò","8g=="],
- ["ó","8w=="],
- ["ô","9A=="],
- ["õ","9Q=="],
- ["ö","9g=="],
- ["÷","9w=="],
- ["ø","+A=="],
- ["ù","+Q=="],
- ["ú","+g=="],
- ["û","+w=="],
- ["ü","/A=="],
- ["ý","/Q=="],
- ["þ","/g=="],
- ["ÿ","/w=="],
- ["\u0000ÿ","AP8="],
- ["ÿ\u0000","/wA="],
+ ["\u007f","fw=="],
+ ["\u0080","gA=="],
+ ["\u0081","gQ=="],
+ ["\u0082","gg=="],
+ ["\u0083","gw=="],
+ ["\u0084","hA=="],
+ ["\u0085","hQ=="],
+ ["\u0086","hg=="],
+ ["\u0087","hw=="],
+ ["\u0088","iA=="],
+ ["\u0089","iQ=="],
+ ["\u008a","ig=="],
+ ["\u008b","iw=="],
+ ["\u008c","jA=="],
+ ["\u008d","jQ=="],
+ ["\u008e","jg=="],
+ ["\u008f","jw=="],
+ ["\u0090","kA=="],
+ ["\u0091","kQ=="],
+ ["\u0092","kg=="],
+ ["\u0093","kw=="],
+ ["\u0094","lA=="],
+ ["\u0095","lQ=="],
+ ["\u0096","lg=="],
+ ["\u0097","lw=="],
+ ["\u0098","mA=="],
+ ["\u0099","mQ=="],
+ ["\u009a","mg=="],
+ ["\u009b","mw=="],
+ ["\u009c","nA=="],
+ ["\u009d","nQ=="],
+ ["\u009e","ng=="],
+ ["\u009f","nw=="],
+ ["\u00a0","oA=="],
+ ["\u00a1","oQ=="],
+ ["\u00a2","og=="],
+ ["\u00a3","ow=="],
+ ["\u00a4","pA=="],
+ ["\u00a5","pQ=="],
+ ["\u00a6","pg=="],
+ ["\u00a7","pw=="],
+ ["\u00a8","qA=="],
+ ["\u00a9","qQ=="],
+ ["\u00aa","qg=="],
+ ["\u00ab","qw=="],
+ ["\u00ac","rA=="],
+ ["\u00ad","rQ=="],
+ ["\u00ae","rg=="],
+ ["\u00af","rw=="],
+ ["\u00b0","sA=="],
+ ["\u00b1","sQ=="],
+ ["\u00b2","sg=="],
+ ["\u00b3","sw=="],
+ ["\u00b4","tA=="],
+ ["\u00b5","tQ=="],
+ ["\u00b6","tg=="],
+ ["\u00b7","tw=="],
+ ["\u00b8","uA=="],
+ ["\u00b9","uQ=="],
+ ["\u00ba","ug=="],
+ ["\u00bb","uw=="],
+ ["\u00bc","vA=="],
+ ["\u00bd","vQ=="],
+ ["\u00be","vg=="],
+ ["\u00bf","vw=="],
+ ["\u00c0","wA=="],
+ ["\u00c1","wQ=="],
+ ["\u00c2","wg=="],
+ ["\u00c3","ww=="],
+ ["\u00c4","xA=="],
+ ["\u00c5","xQ=="],
+ ["\u00c6","xg=="],
+ ["\u00c7","xw=="],
+ ["\u00c8","yA=="],
+ ["\u00c9","yQ=="],
+ ["\u00ca","yg=="],
+ ["\u00cb","yw=="],
+ ["\u00cc","zA=="],
+ ["\u00cd","zQ=="],
+ ["\u00ce","zg=="],
+ ["\u00cf","zw=="],
+ ["\u00d0","0A=="],
+ ["\u00d1","0Q=="],
+ ["\u00d2","0g=="],
+ ["\u00d3","0w=="],
+ ["\u00d4","1A=="],
+ ["\u00d5","1Q=="],
+ ["\u00d6","1g=="],
+ ["\u00d7","1w=="],
+ ["\u00d8","2A=="],
+ ["\u00d9","2Q=="],
+ ["\u00da","2g=="],
+ ["\u00db","2w=="],
+ ["\u00dc","3A=="],
+ ["\u00dd","3Q=="],
+ ["\u00de","3g=="],
+ ["\u00df","3w=="],
+ ["\u00e0","4A=="],
+ ["\u00e1","4Q=="],
+ ["\u00e2","4g=="],
+ ["\u00e3","4w=="],
+ ["\u00e4","5A=="],
+ ["\u00e5","5Q=="],
+ ["\u00e6","5g=="],
+ ["\u00e7","5w=="],
+ ["\u00e8","6A=="],
+ ["\u00e9","6Q=="],
+ ["\u00ea","6g=="],
+ ["\u00eb","6w=="],
+ ["\u00ec","7A=="],
+ ["\u00ed","7Q=="],
+ ["\u00ee","7g=="],
+ ["\u00ef","7w=="],
+ ["\u00f0","8A=="],
+ ["\u00f1","8Q=="],
+ ["\u00f2","8g=="],
+ ["\u00f3","8w=="],
+ ["\u00f4","9A=="],
+ ["\u00f5","9Q=="],
+ ["\u00f6","9g=="],
+ ["\u00f7","9w=="],
+ ["\u00f8","+A=="],
+ ["\u00f9","+Q=="],
+ ["\u00fa","+g=="],
+ ["\u00fb","+w=="],
+ ["\u00fc","/A=="],
+ ["\u00fd","/Q=="],
+ ["\u00fe","/g=="],
+ ["\u00ff","/w=="],
+ ["\u0000\u00ff","AP8="],
+ ["\u00ff\u0000","/wA="],
["\u0000\u0000\u0000","AAAA"],
["",""],
["a","YQ=="],
Modified: branches/string_checks/t/op/stringu.t
==============================================================================
--- branches/string_checks/t/op/stringu.t Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/t/op/stringu.t Sun Oct 31 15:00:04 2010 (r49748)
@@ -269,7 +269,7 @@
print "\n"
end
CODE
-/Lossy conversion/
+/Invalid character/
OUTPUT
pasm_output_is( <<'CODE', <<OUTPUT, "substr with a UTF8 replacement #36794" );
Modified: branches/string_checks/t/pmc/freeze.t
==============================================================================
--- branches/string_checks/t/pmc/freeze.t Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/t/pmc/freeze.t Sun Oct 31 15:00:04 2010 (r49748)
@@ -378,7 +378,7 @@
.const string fpmc = "temp.fpmc"
.sub 'main' :main
$P0 = new ['FileHandle']
- $P0.'open'(fpmc, 'r')
+ $P0.'open'(fpmc, 'rb')
if $P0 goto ok1
.include 'stdio.pasm'
@@ -449,7 +449,7 @@
.const string fpmc = "temp.fpmc"
.sub 'main' :main
$P0 = new ['FileHandle']
- $P0.'open'(fpmc, 'r')
+ $P0.'open'(fpmc, 'rb')
if $P0 goto ok1
.include 'stdio.pasm'
@@ -593,7 +593,7 @@
.const string fpmc = 'temp.fpmc'
.sub 'main' :main
$P0 = new ['FileHandle']
- $P0.'open'(fpmc, 'r')
+ $P0.'open'(fpmc, 'rb')
if $P0 goto ok1
.include 'stdio.pasm'
Modified: branches/string_checks/t/pmc/packfile.t
==============================================================================
--- branches/string_checks/t/pmc/packfile.t Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/t/pmc/packfile.t Sun Oct 31 15:00:04 2010 (r49748)
@@ -422,7 +422,7 @@
push_eh load_error
$S0 = '_filename'()
$P0 = new ['FileHandle']
- $P0.'open'($S0, 'r')
+ $P0.'open'($S0, 'rb')
orig = $P0.'readall'()
Modified: branches/string_checks/t/pmc/testlib/packfile_common.pir
==============================================================================
--- branches/string_checks/t/pmc/testlib/packfile_common.pir Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/t/pmc/testlib/packfile_common.pir Sun Oct 31 15:00:04 2010 (r49748)
@@ -21,7 +21,7 @@
pf = new ['Packfile']
$S0 = '_filename'()
pio = new ['FileHandle']
- pio.'open'($S0, 'r')
+ pio.'open'($S0, 'rb')
$S0 = pio.'readall'()
pio.'close'()
pf = $S0
Modified: branches/string_checks/tools/dev/pbc_to_exe.pir
==============================================================================
--- branches/string_checks/tools/dev/pbc_to_exe.pir Sun Oct 31 14:58:40 2010 (r49747)
+++ branches/string_checks/tools/dev/pbc_to_exe.pir Sun Oct 31 15:00:04 2010 (r49748)
@@ -274,7 +274,7 @@
.param string infile
.local pmc ifh
ifh = new ['FileHandle']
- ifh.'open'(infile, 'r')
+ ifh.'open'(infile, 'rb')
unless ifh goto err_infile
.local pmc codestring
@@ -364,7 +364,7 @@
.param string infile
.local pmc ifh
ifh = new ['FileHandle']
- ifh.'open'(infile, 'r')
+ ifh.'open'(infile, 'rb')
unless ifh goto err_infile
.local pmc encoding_table
More information about the parrot-commits
mailing list