Changeset bc417660 in mainline


Ignore:
Timestamp:
2019-02-23T16:28:16Z (5 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ab87db5
Parents:
098e16a5 (diff), 76ec309b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge pcut tests and corrections by matthieuriolo

Location:
uspace
Files:
7 added
7 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/df/df.c

    r098e16a5 rbc417660  
    7070
    7171        /* Parse command-line options */
    72         while ((optres = getopt(argc, argv, ":ubh")) != -1) {
     72        while ((optres = getopt(argc, argv, "ubh")) != -1) {
    7373                switch (optres) {
    7474                case 'h':
     
    7878                case 'b':
    7979                        display_blocks = true;
    80                         break;
    81 
    82                 case ':':
    83                         fprintf(stderr, "Option -%c requires an operand\n",
    84                             optopt);
    85                         errflg++;
    8680                        break;
    8781
  • uspace/lib/c/Makefile

    r098e16a5 rbc417660  
    190190TEST_SOURCES = \
    191191        test/adt/circ_buf.c \
     192        test/adt/odict.c \
     193        test/cap.c \
    192194        test/casting.c \
     195        test/double_to_str.c \
    193196        test/fibril/timer.c \
     197        test/getopt.c \
     198        test/gsort.c \
     199        test/ieee_double.c \
     200        test/imath.c \
     201        test/inttypes.c \
     202        test/io/table.c \
    194203        test/main.c \
    195204        test/mem.c \
    196         test/inttypes.c \
    197         test/io/table.c \
    198         test/stdio/scanf.c \
    199         test/odict.c \
    200205        test/perf.c \
    201206        test/perm.c \
    202207        test/qsort.c \
    203208        test/sprintf.c \
     209        test/stdio/scanf.c \
    204210        test/stdio.c \
    205211        test/stdlib.c \
    206212        test/str.c \
    207         test/string.c
     213        test/string.c \
     214        test/uuid.c
    208215
    209216include $(USPACE_PREFIX)/Makefile.common
  • uspace/lib/c/generic/gsort.c

    r098e16a5 rbc417660  
    3333/**
    3434 * @file
    35  * @brief Sorting functions.
     35 * @brief Gnome Sort.
    3636 *
    37  * This files contains functions implementing several sorting
    38  * algorithms (e.g. quick sort and gnome sort).
     37 * This file contains an implementation of gnome sort
    3938 *
    4039 */
  • uspace/lib/c/generic/imath.c

    r098e16a5 rbc417660  
    5050errno_t ipow10_u64(unsigned exp, uint64_t *res)
    5151{
    52         unsigned a;
     52        uint64_t a;
    5353        uint64_t r;
    5454
  • uspace/lib/c/generic/uuid.c

    r098e16a5 rbc417660  
    3939#include <stddef.h>
    4040#include <str.h>
     41#include <stdio.h>
    4142
    4243/** Generate UUID.
     
    6768        uuid->b[8] = (uuid->b[8] & 0x3f) | 0x80;
    6869
    69         return EOK;
    7070error:
    7171        rndgen_destroy(rndgen);
     
    139139
    140140        rc = str_uint64_t(str + 24, &eptr, 16, false, &node);
    141         if (rc != EOK || eptr != str + 36 || *eptr != '\0')
     141        if (rc != EOK || eptr != str + 36)
    142142                return EINVAL;
    143143
     
    176176 * @return EOK on success, ENOMEM if out of memory
    177177 */
    178 errno_t uuid_format(uuid_t *uuid, char **rstr)
     178errno_t uuid_format(uuid_t *uuid, char **rstr, bool uppercase)
    179179{
    180         return ENOTSUP;
     180        size_t size = 37;
     181        char *str = malloc(sizeof(char) * size);
     182        if (str == NULL)
     183                return ENOMEM;
     184
     185        const char *format = "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x";
     186        if (uppercase)
     187                format = "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X";
     188
     189        int ret = snprintf(str, size, format, uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4], uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9], uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14], uuid->b[15]);
     190
     191        if (ret != 36)
     192                return EINVAL;
     193
     194        *rstr = str;
     195        return EOK;
    181196}
    182197
  • uspace/lib/c/include/uuid.h

    r098e16a5 rbc417660  
    3838#include <stdint.h>
    3939#include <types/uuid.h>
     40#include <stdbool.h>
    4041
    4142extern errno_t uuid_generate(uuid_t *);
     
    4344extern void uuid_decode(uint8_t *, uuid_t *);
    4445extern errno_t uuid_parse(const char *, uuid_t *, const char **);
    45 extern errno_t uuid_format(uuid_t *, char **);
     46extern errno_t uuid_format(uuid_t *, char **, bool);
    4647
    4748#endif
  • uspace/lib/c/test/main.c

    r098e16a5 rbc417660  
    3232PCUT_INIT;
    3333
     34PCUT_IMPORT(cap);
    3435PCUT_IMPORT(casting);
    3536PCUT_IMPORT(circ_buf);
     37PCUT_IMPORT(double_to_str);
    3638PCUT_IMPORT(fibril_timer);
     39PCUT_IMPORT(getopt);
     40PCUT_IMPORT(gsort);
     41PCUT_IMPORT(ieee_double);
     42PCUT_IMPORT(imath);
    3743PCUT_IMPORT(inttypes);
    3844PCUT_IMPORT(mem);
     
    4854PCUT_IMPORT(string);
    4955PCUT_IMPORT(table);
     56PCUT_IMPORT(uuid);
    5057
    5158PCUT_MAIN();
Note: See TracChangeset for help on using the changeset viewer.