[macruby-changes] [2060] MacRuby/branches/experimental/ext/digest
source_changes at macosforge.org
source_changes at macosforge.org
Thu Jul 23 19:12:20 PDT 2009
Revision: 2060
http://trac.macosforge.org/projects/ruby/changeset/2060
Author: lsansonetti at apple.com
Date: 2009-07-23 19:12:20 -0700 (Thu, 23 Jul 2009)
Log Message:
-----------
force bytestring creation
Modified Paths:
--------------
MacRuby/branches/experimental/ext/digest/bubblebabble/bubblebabble.c
MacRuby/branches/experimental/ext/digest/digest.c
Modified: MacRuby/branches/experimental/ext/digest/bubblebabble/bubblebabble.c
===================================================================
--- MacRuby/branches/experimental/ext/digest/bubblebabble/bubblebabble.c 2009-07-24 01:20:20 UTC (rev 2059)
+++ MacRuby/branches/experimental/ext/digest/bubblebabble/bubblebabble.c 2009-07-24 02:12:20 UTC (rev 2060)
@@ -21,7 +21,7 @@
{
const char *digest;
size_t digest_len;
- char *p;
+ UInt8 *p;
int i, j, seed = 1;
static const char vowels[] = {
'a', 'e', 'i', 'o', 'u', 'y'
@@ -40,7 +40,7 @@
}
const size_t p_len = (digest_len | 1) * 3 + 2;
- p = (char *)alloca(p_len + 1);
+ p = (UInt8 *)alloca(p_len + 1);
i = j = 0;
p[j++] = 'x';
@@ -74,7 +74,7 @@
p[j] = 'x';
- return rb_str_new(p, p_len);
+ return rb_bytestring_new_with_data(p, p_len);
}
/*
Modified: MacRuby/branches/experimental/ext/digest/digest.c
===================================================================
--- MacRuby/branches/experimental/ext/digest/digest.c 2009-07-24 01:20:20 UTC (rev 2059)
+++ MacRuby/branches/experimental/ext/digest/digest.c 2009-07-24 02:12:20 UTC (rev 2060)
@@ -37,7 +37,7 @@
const char *digest;
size_t digest_len;
int i;
- char *p;
+ UInt8 *p;
static const char hex[] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f'
@@ -52,7 +52,7 @@
}
const size_t p_len = digest_len * 2;
- p = (char *)alloca(p_len + 1);
+ p = (UInt8 *)alloca(p_len + 1);
for (i = 0; i < digest_len; i++) {
unsigned char byte = digest[i];
@@ -61,7 +61,7 @@
p[i + i + 1] = hex[byte & 0x0f];
}
- return rb_str_new(p, p_len);
+ return rb_bytestring_new_with_data(p, p_len);
}
/*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090723/e943458e/attachment.html>
More information about the macruby-changes
mailing list