[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[open-cobol-list] Bug Report : INSPECT
From: |
Peg |
Subject: |
[open-cobol-list] Bug Report : INSPECT |
Date: |
Thu Jun 9 22:49:52 2005 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |
Hello all,
INSPECT of OpenCOBOL doesn't work correctly.
--------------------------------------------------
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTINSP.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 S PIC X(8).
01 I PIC 9(3).
PROCEDURE DIVISION.
MOVE "ABCDEF " TO S.
MOVE ZERO TO I.
INSPECT S TALLYING I
FOR CHARACTERS BEFORE INITIAL " ".
DISPLAY S ":" I.
*
MOVE "ABCDEFG " TO S.
MOVE ZERO TO I.
INSPECT S TALLYING I
FOR CHARACTERS BEFORE INITIAL " ".
DISPLAY S ":" I.
*
MOVE "ABCDEFGH" TO S.
MOVE ZERO TO I.
INSPECT S TALLYING I
FOR CHARACTERS BEFORE INITIAL " ".
DISPLAY S ":" I.
EXIT PROGRAM.
$ cobc TESTINSP.COB
$ ./TESTINSP
ABCDEF :006
ABCDEFG :008 <- NG (I think that 007 is correct.)
ABCDEFGH:008
OpenCOBOL 0.32 or CVS(20050610)
--------------------------------------------------
It seems to work correctly by the following corrections.
Could you confirm it?
--------------------------------------------------
--- open-cobol.org/libcob/strings.c 2005-02-05 04:57:49.000000000 +0900
+++ open-cobol/libcob/strings.c 2005-06-10 00:00:00.000000000 +0900
@@ -79,7 +79,7 @@
cob_inspect_before (cob_field *str)
{
unsigned char *p;
- for (p = inspect_start; p < inspect_end - str->size; p++)
+ for (p = inspect_start; p < inspect_end - str->size + 1; p++)
if (memcmp (p, str->data, str->size) == 0)
{
inspect_end = p;
--------------------------------------------------
regards,
--
Peg, PegStyle mailto:address@hidden
http://members8.tsukaeru.net/pegstyle/
(OpenCOBOL Cygwin/MinGW Binary Download Site.
But Japanese Page Only)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [open-cobol-list] Bug Report : INSPECT,
Peg <=