Issue Details (XML | Word | Printable)

Key: CORE-2095
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Adriano dos Santos Fernandes
Reporter: Kovalenko Dmitry
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Firebird Core

BUG at CVJIS_eucj_to_unicode

Created: 29/Sep/08 12:05 PM   Updated: 08/Nov/09 07:58 PM
Component/s: Charsets/Collation, Engine
Affects Version/s: 2.0.0, 1.5.4, 2.0.1, 2.1 Alpha 1, 2.1 Beta 1, 2.0.2, 2.0.3, 2.1 Beta 2, 1.5.5, 2.1 RC1, 2.5 Initial, 2.1 RC2, 2.1.0, 2.0.4, 2.5 Alpha 1, 2.1.1
Fix Version/s: 2.5 Beta 1

Time Tracking:
Not Specified

Environment: Any

Planning Status: Unspecified


 Description  « Hide
cv_jis.cpp [version 1.19]

function: CVJIS_eucj_to_unicode

line 77: else if (!src_len || !(*src_ptr & 0x80)) {

----
I think, should be

if(src_len==1 || !(*src_ptr & 0x80))

 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Kovalenko Dmitry added a comment - 29/Sep/08 12:45 PM
Also

----
if (p_dest_ptr == NULL)
return (src_len);

----
Should be

if (p_dest_ptr == NULL)
return (sizeof(USHORT)*src_len);

???

Kovalenko Dmitry added a comment - 30/Sep/08 09:20 AM
Also.

This function not uses the EUC1, EUC2 for check of ch1 and ch2

Is it right?

Kovalenko Dmitry added a comment - 30/Sep/08 11:36 AM - edited
Also #3 :)

This common problem(?) at

CVBIG5_big5_to_unicode
CVGB_gb2312_to_unicode
CVKSC_ksc_to_unicode
CVJIS_eucj_to_unicode
CVJIS_sjis_to_unicode

functions:

wide=(ch1<<8)+ch2;

ucs2_ch=a1[a2[wide/256]+wide%256]

---
I'm not sure that is correctly works at all platforms (big/little endian)

----
Similar situation with macros

#define isodd(x) ((x)&1)

Instead: (((x)%2)!=0)

Kovalenko Dmitry added a comment - 01/Oct/08 03:47 AM
Also #4 [for cv_jis.cpp]

seven2eight has very strange (from India?) code

if(isodd(*p1))
 {...}
else
if(!isodd(*p1))
 {...}

Adriano dos Santos Fernandes added a comment - 02/Oct/08 12:39 PM
EUC1, EUC2 is not used but direct checking (& 0x80) is present.

Your worries about endian seems not correct. We use machine endian intermediary unicode.

(x & 1) vs (x % 2 != 0) will work ok despite endian AFAIK.