summaryrefslogtreecommitdiff
path: root/enc
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-21 03:35:05 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-21 03:35:05 +0000
commit463af63468620614074f024fb4310dc1cd332495 (patch)
treeafb315b64617c1cbacb95ae5a75a115bafe84bd7 /enc
parent76e19bc534c36daf2d093ff3eb434737756a86ef (diff)
* transcode.c (transcode_loop, str_transcoding_resize): use unsigned
char. [ruby-dev:33232] * transcode_data.h (rb_transcoding, rb_transcoder): removed callback parameters. * enc/trans/japanese.c: ditto. * enc/trans/utf_16_32.c: parenthesized bit-or operands. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enc')
-rw-r--r--enc/trans/japanese.c24
-rw-r--r--enc/trans/utf_16_32.c32
2 files changed, 28 insertions, 28 deletions
diff --git a/enc/trans/japanese.c b/enc/trans/japanese.c
index d065d18240..f4f28ddea2 100644
--- a/enc/trans/japanese.c
+++ b/enc/trans/japanese.c
@@ -23671,10 +23671,10 @@ enum ISO_2022_ESCSEQ {
#define ISO_2022_GZ_JIS_X_0213_2004_1 ISO_2022_ENCODING(ISO_2022_GZDM4,'Q')
static int
-get_iso_2022_mode(char **in_pos)
+get_iso_2022_mode(unsigned char **in_pos)
{
int new_mode;
- char *in_p = *in_pos;
+ unsigned char *in_p = *in_pos;
switch (*in_p++)
{
case '(':
@@ -23719,15 +23719,15 @@ get_iso_2022_mode(char **in_pos)
}
static void
-from_iso_2022_jp_transcoder_preprocessor(char **in_pos, char **out_pos,
- char *in_stop, char *out_stop,
+from_iso_2022_jp_transcoder_preprocessor(unsigned char **in_pos, unsigned char **out_pos,
+ unsigned char *in_stop, unsigned char *out_stop,
rb_transcoding *my_transcoding)
{
const rb_transcoder *my_transcoder = my_transcoding->transcoder;
- char *in_p = *in_pos, *out_p = *out_pos;
+ unsigned char *in_p = *in_pos, *out_p = *out_pos;
int cur_mode = ISO_2022_GZ_ASCII;
unsigned char c1;
- char *out_s = out_stop - my_transcoder->max_output + 1;
+ unsigned char *out_s = out_stop - my_transcoder->max_output + 1;
while (in_p < in_stop) {
if (out_p >= out_s) {
int len = (out_p - *out_pos);
@@ -23770,9 +23770,9 @@ from_iso_2022_jp_transcoder_preprocessor(char **in_pos, char **out_pos,
}
static int
-select_iso_2022_mode(char **out_pos, int new_mode)
+select_iso_2022_mode(unsigned char **out_pos, int new_mode)
{
- char *out_p = *out_pos;
+ unsigned char *out_p = *out_pos;
*out_p++ = '\x1b';
switch (new_mode>>8)
{
@@ -23799,15 +23799,15 @@ select_iso_2022_mode(char **out_pos, int new_mode)
}
static void
-to_iso_2022_jp_transcoder_postprocessor(char **in_pos, char **out_pos,
- char *in_stop, char *out_stop,
+to_iso_2022_jp_transcoder_postprocessor(unsigned char **in_pos, unsigned char **out_pos,
+ unsigned char *in_stop, unsigned char *out_stop,
rb_transcoding *my_transcoding)
{
const rb_transcoder *my_transcoder = my_transcoding->transcoder;
- char *in_p = *in_pos, *out_p = *out_pos;
+ unsigned char *in_p = *in_pos, *out_p = *out_pos;
int cur_mode = ISO_2022_GZ_ASCII, new_mode = 0;
unsigned char next_byte;
- char *out_s = out_stop - my_transcoder->max_output + 1;
+ unsigned char *out_s = out_stop - my_transcoder->max_output + 1;
while (in_p < in_stop) {
if (out_p >= out_s) {
int len = (out_p - *out_pos);
diff --git a/enc/trans/utf_16_32.c b/enc/trans/utf_16_32.c
index 1eb04c1519..0247e5dce6 100644
--- a/enc/trans/utf_16_32.c
+++ b/enc/trans/utf_16_32.c
@@ -12,21 +12,21 @@ fun_so_from_utf_16be(const unsigned char* s, unsigned char* o)
}
else if (s[0]<0x08) {
o[0] = 0xC0 | (s[0]<<2) | (s[1]>>6);
- o[1] = 0x80 | s[1]&0x3F;
+ o[1] = 0x80 | (s[1]&0x3F);
return 2;
}
else if ((s[0]&0xF8)!=0xD8) {
o[0] = 0xE0 | s[0]>>4;
o[1] = 0x80 | ((s[0]&0x0F)<<2) | (s[1]>>6);
- o[2] = 0x80 | s[1]&0x3F;
+ o[2] = 0x80 | (s[1]&0x3F);
return 3;
}
else {
unsigned int u = (((s[0]&0x03)<<2)|(s[1]>>6)) + 1;
o[0] = 0xF0 | u>>2;
- o[1] = 0x80 | ((u&0x03)<<4) | (s[1]>>2)&0x0F;
+ o[1] = 0x80 | ((u&0x03)<<4) | ((s[1]>>2)&0x0F);
o[2] = 0x80 | ((s[1]&0x03)<<4) | ((s[2]&0x03)<<2) | (s[3]>>6);
- o[3] = 0x80 | s[3]&0x3F;
+ o[3] = 0x80 | (s[3]&0x3F);
return 4;
}
}
@@ -41,16 +41,16 @@ fun_so_to_utf_16be(const unsigned char* s, unsigned char* o)
}
else if ((s[0]&0xE0)==0xC0) {
o[0] = (s[0]>>2)&0x07;
- o[1] = ((s[0]&0x03)<<6) | s[1]&0x3F;
+ o[1] = ((s[0]&0x03)<<6) | (s[1]&0x3F);
return 2;
}
else if ((s[0]&0xF0)==0xE0) {
- o[0] = (s[0]<<4) | (s[1]>>2)^0x20;
- o[1] = (s[1]<<6) | s[2]^0x80;
+ o[0] = (s[0]<<4) | ((s[1]>>2)^0x20);
+ o[1] = (s[1]<<6) | (s[2]^0x80);
return 2;
}
else {
- int w = (((s[0]&0x07)<<2) | (s[1]>>4)&0x03) - 1;
+ int w = (((s[0]&0x07)<<2) | ((s[1]>>4)&0x03)) - 1;
o[0] = 0xD8 | (w>>2);
o[1] = (w<<6) | ((s[1]&0x0F)<<2) | ((s[2]>>4)-8);
o[2] = 0xDC | ((s[2]>>2)&0x03);
@@ -68,21 +68,21 @@ fun_so_from_utf_16le(const unsigned char* s, unsigned char* o)
}
else if (s[1]<0x08) {
o[0] = 0xC0 | (s[1]<<2) | (s[0]>>6);
- o[1] = 0x80 | s[0]&0x3F;
+ o[1] = 0x80 | (s[0]&0x3F);
return 2;
}
else if ((s[1]&0xF8)!=0xD8) {
o[0] = 0xE0 | s[1]>>4;
o[1] = 0x80 | ((s[1]&0x0F)<<2) | (s[0]>>6);
- o[2] = 0x80 | s[0]&0x3F;
+ o[2] = 0x80 | (s[0]&0x3F);
return 3;
}
else {
unsigned int u = (((s[1]&0x03)<<2)|(s[0]>>6)) + 1;
o[0] = 0xF0 | u>>2;
- o[1] = 0x80 | ((u&0x03)<<4) | (s[0]>>2)&0x0F;
+ o[1] = 0x80 | ((u&0x03)<<4) | ((s[0]>>2)&0x0F);
o[2] = 0x80 | ((s[0]&0x03)<<4) | ((s[3]&0x03)<<2) | (s[2]>>6);
- o[3] = 0x80 | s[2]&0x3F;
+ o[3] = 0x80 | (s[2]&0x3F);
return 4;
}
}
@@ -97,16 +97,16 @@ fun_so_to_utf_16le(const unsigned char* s, unsigned char* o)
}
else if ((s[0]&0xE0)==0xC0) {
o[1] = (s[0]>>2)&0x07;
- o[0] = ((s[0]&0x03)<<6) | s[1]&0x3F;
+ o[0] = ((s[0]&0x03)<<6) | (s[1]&0x3F);
return 2;
}
else if ((s[0]&0xF0)==0xE0) {
- o[1] = (s[0]<<4) | (s[1]>>2)^0x20;
- o[0] = (s[1]<<6) | s[2]^0x80;
+ o[1] = (s[0]<<4) | ((s[1]>>2)^0x20);
+ o[0] = (s[1]<<6) | (s[2]^0x80);
return 2;
}
else {
- int w = (((s[0]&0x07)<<2) | (s[1]>>4)&0x03) - 1;
+ int w = (((s[0]&0x07)<<2) | ((s[1]>>4)&0x03)) - 1;
o[1] = 0xD8 | (w>>2);
o[0] = (w<<6) | ((s[1]&0x0F)<<2) | ((s[2]>>4)-8);
o[3] = 0xDC | ((s[2]>>2)&0x03);