Changeset a18a8b9 in mainline


Ignore:
Timestamp:
2015-04-23T23:53:49Z (9 years ago)
Author:
Michal Koutný <xm.koutny+hos@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8d1f92f
Parents:
055a68a
Message:

libc: Fix str_ltrim + tests

Location:
uspace/lib/c
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/Makefile

    r055a68a ra18a8b9  
    171171TEST_SOURCES = \
    172172        test/main.c \
    173         test/sprintf.c
     173        test/sprintf.c \
     174        test/str.c
    174175
    175176include $(USPACE_PREFIX)/Makefile.common
  • uspace/lib/c/generic/str.c

    r055a68a ra18a8b9  
    534534
    535535                if (c1 == 0 || c2 == 0)
    536                         break;         
     536                        break;
    537537        }
    538538
     
    588588                        break;
    589589
    590                 ++len; 
     590                ++len;
    591591        }
    592592
     
    10581058                memmove(str, &str[pos], str_sz - pos);
    10591059                pos = str_sz - pos;
    1060                 str[str_sz - pos] = '\0';
     1060                str[pos] = '\0';
    10611061        }
    10621062}
     
    11511151}
    11521152
    1153 /** Convert string to a number. 
     1153/** Convert string to a number.
    11541154 * Core of strtol and strtoul functions.
    11551155 *
     
    11971197                                str += 2;
    11981198                        }
    1199                 } 
     1199                }
    12001200        }
    12011201       
     
    12361236                *endptr = (char *) str;
    12371237
    1238         if (nptr == str) { 
     1238        if (nptr == str) {
    12391239                /*FIXME: errno = EINVAL*/
    12401240                return 0;
     
    12671267                if ((sgn) && (number == (unsigned long) (LONG_MAX) + 1)) {
    12681268                        /* FIXME: set 0 to errno */
    1269                         return number;         
     1269                        return number;
    12701270                }
    12711271                /* FIXME: set ERANGE to errno */
    1272                 return (sgn ? LONG_MIN : LONG_MAX);     
     1272                return (sgn ? LONG_MIN : LONG_MAX);
    12731273        }
    12741274       
  • uspace/lib/c/test/main.c

    r055a68a ra18a8b9  
    3333
    3434PCUT_IMPORT(sprintf);
     35PCUT_IMPORT(str);
    3536
    3637PCUT_MAIN()
Note: See TracChangeset for help on using the changeset viewer.