OSDN Git Service

* WorkBackup: 2015/04/30(Thr) AM 05:44 (Fixing LibEditText_AppendLine Bug)
authorKoine Yuusuke(koinec) <koinec@users.sourceforge.jp>
Wed, 29 Apr 2015 20:45:21 +0000 (05:45 +0900)
committerKoine Yuusuke(koinec) <koinec@users.sourceforge.jp>
Wed, 29 Apr 2015 20:45:21 +0000 (05:45 +0900)
libedittext/drd64_libedittext_config.h
libedittext/drd64_libedittext_debug.c
libedittext/drd64_libedittext_file.c
libedittext/drd64_libedittext_section.c
libedittext/test_libedittext_line.c

index 66cb0ee..9d0e385 100644 (file)
@@ -37,7 +37,7 @@ Comment:
 #ifndef DRD64_HEADER_LIBEDITTEXT_CONFIG
 #define DRD64_HEADER_LIBEDITTEXT_CONFIG
 
-#define DEBUG_TEXTINFO_OUTPUT                                          0x01
+#define DEBUG_TEXTINFO_OUTPUT                                          0x02
        /* Output TextData for Console if this value isn't 0x00 when run test_drcc program.*/
 
 
index cf798be..1e42ec8 100644 (file)
@@ -184,7 +184,8 @@ int
        puts(  "[5] Text Data ");
 
        p_before        = NULL;
-       p_line          = p_tinfo->p_lineinfo;
+       //p_line                = p_tinfo->p_lineinfo;
+       p_line          = LINFO(p_tinfo, p_tinfo->dw_line_start);
        for( dw_nowrow = 0; dw_nowrow < p_tinfo->dw_maxline; dw_nowrow++ )      {
                printf("%04u [%3u:%3u] ",
                                        dw_nowrow, p_line->dw_strlen, p_line->dw_linelen );
index 2b7665b..16b227d 100644 (file)
@@ -268,6 +268,7 @@ int
 
        p_tinfo->i_fd           = -1;
        p_tinfo->dw_line_start  = p_line->dw_id;
+       p_tinfo->dw_line_end    = p_line->dw_id;
        
        i_result        = LibEditText_Line_AddSortChain( p_tinfo, p_line );     
        if( 0x00 != i_result )  { return -0x02; }
index 0a45003..509469f 100644 (file)
@@ -207,6 +207,9 @@ int
 
        assert( NULL != p_tinfo );
 
+       if(( 1 == p_tinfo->dw_maxline) && ( 0 == p_tinfo->dw_sections ))
+               { p_tinfo->dw_sections  = 1; }
+
        p_section       = p_tinfo->p_section;
 
        for( dw_cnt = 0; dw_cnt < p_tinfo->dw_sections; dw_cnt++ )      {
index e43d02a..4a3d572 100644 (file)
@@ -113,8 +113,11 @@ void Test_LibEditText_API_AppendLine_test00_001(void)
        i_tinfoid       = LibEditText_CreateTextFile( "./testdata", NULL );
        CU_ASSERT( 0x00 == i_result );
 
+       i_result        = LibEditText_Debug_DebugTextInfo( i_tinfoid, DEBUG_TEXTINFO_OUTPUT );
+       CU_ASSERT( 0x00 == i_result );
+
        i_len   = snprintf( str_testdata, 255, "%d Dr.deamon64 libeditext testdata---\n", 1);
-       i_result        = LibEditText_AppendLine( i_tinfoid, (Byte *)str_testdata, i_len + 1);
+       i_result        = LibEditText_AppendLine( i_tinfoid, (Byte *)str_testdata, i_len);
        CU_ASSERT( 0x00 == i_result );
 
        i_result        = LibEditText_Debug_DebugTextInfo( i_tinfoid, DEBUG_TEXTINFO_OUTPUT );