Changeset 29

Show
Ignore:
Timestamp:
06/30/06 07:05:01 (2 years ago)
Author:
yossarian
Message:

memory bug-free

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lex_util.d

    r27 r29  
    307307    for (i = 0; cp_in[i] == ' ' || cp_in[i] == '\t'; i++) {} 
    308308    int start = i; 
    309     for(i = cp_in.length; i > 0 && (cp_in[i] == ' ' || cp_in[i] == '\t'); i--) {} 
     309    for(i = cp_in.length - 1; i > 0 && (cp_in[i] == ' ' || cp_in[i] == '\t'); i--) {} 
    310310    int end = i; 
    311311     
  • trunk/node_set.d

    r28 r29  
    341341        ptr_and_flag[] pafp_list; 
    342342        uint u_node; 
    343      
     343    // u_nb_node = vpp_node_set.length; 
    344344        if (u_nb_node < 2) 
    345345            return; 
     
    347347        // well, next problem is, if we want to make a clean library, we can't use static variables 
    348348        // the only way for us to sort the vpp_node_set / op_attrib is to make it the other way up 
    349         pafp_list = new ptr_and_flag [u_nb_node]; 
    350         for (u_node = 0; u_node < u_nb_node; u_node++) 
    351         { 
     349        pafp_list.length = u_nb_node; 
     350        for (u_node = 0; u_node < u_nb_node; u_node++) 
     351        { 
     352            pafp_list[u_node] = new ptr_and_flag; 
    352353            pafp_list [u_node] . vp_ptr = vpp_node_set [u_node]; 
    353354            pafp_list [u_node] . o_flag = op_attrib [u_node]; 
  • trunk/xpath_processor.d

    r28 r29  
    14731473            rv = false; 
    14741474        else 
    1475             rv = (S_arg_2[0..S_arg_1.length] == S_arg_1); 
     1475            rv = (S_arg_1[0..S_arg_2.length] == S_arg_2); 
    14761476             
    14771477        v_push_bool (rv); 
     
    14971497            throw new execution_error (29); 
    14981498        S_base = erpp_arg [0].S_get_string (); 
    1499         i_start = erpp_arg [1].i_get_int ()
     1499        i_start = erpp_arg [1].i_get_int () - 1
    15001500        if (u_nb_arg == 3) 
    15011501            i_length = erpp_arg [2].i_get_int (); 
     
    15051505        if (i_length == 0) 
    15061506            i_length = S_base.length; 
    1507              
     1507         
     1508        i_length += i_start; 
     1509        if (i_length > S_base.length) 
     1510            i_length = S_base.length; 
     1511 
    15081512        v_push_string (S_base[i_start..i_length]); 
    15091513    } 
  • trunk/xpath_syntax.d

    r27 r29  
    5959        uint u_nb_recurs; 
    6060        bool o_recognize (xpath_construct xc_current, bool o_final) 
    61         in { writefln("Recognizing: %s (par: %s)", cp_disp_construct(xc_current), cp_disp_class_lex(ltp_get(0).lex_get_value())); } 
     61        in { writefln("Recognizing: %s (par: %s)", cp_disp_construct(xc_current), (ltp_get(0) is null)?"(null)":cp_disp_class_lex(ltp_get(0).lex_get_value())); } 
    6262        body 
    6363        {