I guess that is a better way to go. Assume the worst case. I'll do
that, instead of measuring the string's bytes just multiply it's
length by 4 and then divide.
On 2007-01-19, at 17:34 EST, Henry Minsky wrote:
I just was conservative and assumed four byte chars, so I split the
strings at about 10Kbytes.
On 1/19/07, P T Withington < [EMAIL PROTECTED]> wrote:Hum.
Grumble. You damn mathematicians!
I can't think of a more general solution other than looping splitting
and measuring. Do you think it important enough that I should do
that instead? Or have you got another idea.
On 2007-01-19, at 10:25 EST, Philip Romanik wrote:
> approved.
>
> However, you can construct a case where the splitting will fail.
> For example, consider this string:
> 15000 instances of a 4-byte character
> 1M instances of a 1-byte character
>
> The string has 1,015,000 characters and 1,060,000 bytes. When you
> compute the number of chunks you get 17. And when you compute the
> number of characters per chunk you get 1,015,000/17 = 59705.
> However, 59705 characters in the first chunk is 104705 bytes.
>
>
>
>
>> Change 20070118-ptw-n by [EMAIL PROTECTED] on 2007-01-18
>> 14:29:28 EST
>> in /Users/ptw/OpenLaszlo/legals-2
>>
>> Summary: Split gigantic strings in SWF
>>
>> Bugs Fixed:
>> LPP-3415: 'Compiler error running charting test (swf)'
>>
>> Technical Reviewer: promanik (pending)
>> QA Reviewer: hminsky (pending)
>> Doc Reviewer: n/a
>>
>> Details:
>> Instructions: measure size of Strings accurately.
>>
>> CodeGenerator: If string would exceed SWF limit, split it
>> until it
>> does not and join the splits in the runtime.
>>
>> Tests:
>> test/charts/linechart/test_line_06.lzx
>>
>> Files:
>> M WEB-INF/lps/server/src/org/openlaszlo/sc/Instructions.java
>> M WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
>>
>>
>> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20070118-
ptw-
>> n.tar
>
--
Henry Minsky
Software Architect
[EMAIL PROTECTED]