Patches: Browse | Submit New | Admin

[#28800] Fix rbuic4's incorrect handling of long string literals

Date:
2010-12-25 03:41
Priority:
3
Submitted By:
Kai Xiong Chong (kaixiong)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
Fix rbuic4's incorrect handling of long string literals

Detailed description
rbuic4 incorrectly breaks string literals (used in labels, etc.) when they exceed 1024 characters in length.

The problem lies with the fixString() function in rbuic/utils.h. Whenever the length of cursegment exceeds 1024, the
string is split into two with a newline added in between. This splitting repeats itself for every subsequent 1024th
character.

A long string such as:
"a very very ... very long string" (where ... represents a mass of characters) 

is broken up into:
"a very very ... "
"very long string"

.. which is legal in C++, but not Ruby.

Attached is a patch that fixes this by inserting '+'. With this, the given example is split into:
"a very very ... " +
"long string"

The patch also performs splitting whenever newline characters are encountered in the input. This gives us a very neat
alignment of the string parts.

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
rbuic4-multiline-string-fix.patch Fix string splitting with + Download
output.diff Diff showing the difference in output when using the patched fixString Download

Changes:

Field Old Value Date By
File Added5053: output.diff2010-12-25 03:44kaixiong
File Added5052: rbuic4-multiline-string-fix.patch2010-12-25 03:41kaixiong