Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG at CVJIS_eucj_to_unicode [CORE2095] #2529

Closed
firebird-automations opened this issue Sep 29, 2008 · 10 comments
Closed

BUG at CVJIS_eucj_to_unicode [CORE2095] #2529

firebird-automations opened this issue Sep 29, 2008 · 10 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @ibprovider

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))

Commits: 795e426

@firebird-automations
Copy link
Collaborator Author

Commented by: @ibprovider

Also

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

----
Should be

if \(p\_dest\_ptr == NULL\)
	return \(sizeof\(USHORT\)\*src\_len\);

???

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @ibprovider

Also.

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

Is it right?

@firebird-automations
Copy link
Collaborator Author

Commented by: @ibprovider

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)

@firebird-automations
Copy link
Collaborator Author

Commented by: @ibprovider

Also #⁠4 [for cv_jis.cpp]

seven2eight has very strange (from India?) code

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

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

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.

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

Fix Version: 2.5 Beta 1 [ 10251 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment