![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Is this a bug? length(Buffer b, int len) not trucating fully Topic Summary: Created On: 7-Feb-2008 10:55 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: Too lazy to look it up, but we did some work on this earlier in the formums. Perhaps look for 'length'. IIRC, reducing the length of a buffer with the 'length' function is a disaster if you set it longer than the existing length. IIRC, reducing the length works in some situation but fails in others. IIRC, setting the null character as a mechanism for reducing the length works in some situation, but fails in others. IIRC, setting the 'length' AND setting a null character worked. Give the attached function a try, let us know if it works. But sure to set the length of a buffer to a value smaller than the original length, but larger than a previous set. - Louie | |
![]() |
|
Hi all,
I have observed a strange behaviour of the 'length' perm and would like to ask you if I get something wrong or whether this can be considered a bug: When I truncate a Buffer b using length(b,len) and then use the truncated buffer by concatenating it to a second buffer, the full buffer content (before the truncation) is added. The attached code illustrates this: first, two buffers 'a' and 'b' are created and set to "hello world " then, both are truncated to "hallo ", 'a' using the length perm, 'b' using the range The contents of 'a' and 'b' are appended to a new Buffer 'c', which should then be "hello hello ", but instead shows "hello world hello". As a workaround, a fourth Buffer d is created using the 'combine' perm and the explicit lengths of 'a' and 'b', which shows the expected result. As we are still running DOORS 7.0, I would be curious to know if this is actually a bug, and whether it persists in later DOORS versions. Regards, Peter |
|
![]() |
|
![]() |
|
Hm, strange.
Same behaviour with 7.1 and 8.3.0.1 Cheers, Frank ------------------------- Frank Jensen TRW Automotive frank.jensenREMOVE_ME@trw.com |
|
![]() |
|
![]() |
|
- removed -
------------------------- Frank Jensen TRW Automotive frank.jensenREMOVE_ME@trw.com Edited: 7-Feb-2008 at 12:46 by Frank Jensen |
|
![]() |
|
![]() |
|
- removed -
------------------------- Frank Jensen TRW Automotive frank.jensenREMOVE_ME@trw.com Edited: 7-Feb-2008 at 12:46 by Frank Jensen |
|
![]() |
|
![]() |
|
Ups, sorry for tripple posting. I keep getting errors when pressing the 'Reply to Topic' button.
Cheers, Frank ------------------------- Frank Jensen TRW Automotive frank.jensenREMOVE_ME@trw.com |
|
![]() |
|
![]() |
|
Too lazy to look it up, but we did some work on this earlier in the formums. Perhaps look for 'length'.
IIRC, reducing the length of a buffer with the 'length' function is a disaster if you set it longer than the existing length. IIRC, reducing the length works in some situation but fails in others. IIRC, setting the null character as a mechanism for reducing the length works in some situation, but fails in others. IIRC, setting the 'length' AND setting a null character worked. Give the attached function a try, let us know if it works. But sure to set the length of a buffer to a value smaller than the original length, but larger than a previous set. - Louie |
|
![]() |
|
![]() |
|
Hi Louie,
thanks for your reply, 'ShortenBuffer' does the trick; when I replace the 'length' call in my code snippet with a call to your routine, everything works as one expects. Regards, Peter |
|
![]() |
|
![]() |
|
Bug fix, had to swap the last two statements in fShortenBuffer. Before that, tempStringOf retrieval was incorrect. That is, insert a null char and THEN reduce the length.
Attached is the new function and a simple test driver for it. I was unable to cleverly extend the length of the buffer, neither for a buffer that had never been longer nor from a buffer that was long, then set short. the set 'length' command appears to be ignored with the desired length is longer than the actual. The set buffer character command likewise appears to be ignored when the desired location is beyond the length of the buffer. I'd be interested to see if anyone can do more testing and break this fShortenBuffer. - Louie Edited: 8-Feb-2008 at 17:40 by Louie Landale |
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.