Changeset 08e103d4 in mainline for uspace/app
- Timestamp:
- 2019-02-05T18:26:05Z (7 years ago)
- Children:
- 1d2f85e
- Parents:
- d066259
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-05 16:16:55)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-05 18:26:05)
- Location:
- uspace/app
- Files:
-
- 33 edited
-
bdsh/cmds/modules/cp/cp.c (modified) (2 diffs)
-
bdsh/cmds/modules/ls/ls.c (modified) (3 diffs)
-
bdsh/cmds/modules/printf/printf.c (modified) (1 diff)
-
bdsh/cmds/modules/rm/rm.c (modified) (1 diff)
-
bdsh/compl.c (modified) (2 diffs)
-
bdsh/tok.c (modified) (1 diff)
-
date/date.c (modified) (2 diffs)
-
edit/edit.c (modified) (6 diffs)
-
edit/search.c (modified) (1 diff)
-
edit/sheet.c (modified) (1 diff)
-
fdisk/fdisk.c (modified) (2 diffs)
-
hbench/env.c (modified) (2 diffs)
-
hbench/main.c (modified) (1 diff)
-
kio/kio.c (modified) (1 diff)
-
lprint/lprint.c (modified) (2 diffs)
-
netecho/netecho.c (modified) (1 diff)
-
nic/nic.c (modified) (1 diff)
-
sbi/src/builtin/bi_string.c (modified) (2 diffs)
-
sbi/src/lex.c (modified) (1 diff)
-
sbi/src/os/helenos.c (modified) (4 diffs)
-
sbi/src/os/os.h (modified) (1 diff)
-
sbi/src/os/posix.c (modified) (1 diff)
-
sportdmp/sportdmp.c (modified) (1 diff)
-
sysinfo/sysinfo.c (modified) (2 diffs)
-
taskdump/elf_core.c (modified) (2 diffs)
-
tester/hw/serial/serial1.c (modified) (1 diff)
-
tester/tester.c (modified) (1 diff)
-
tetris/screen.c (modified) (1 diff)
-
tetris/tetris.c (modified) (1 diff)
-
tmon/tests.c (modified) (1 diff)
-
usbinfo/list.c (modified) (1 diff)
-
wavplay/wave.c (modified) (1 diff)
-
websrv/websrv.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cp/cp.c
rd066259 r08e103d4 188 188 dentry_type_t dest_type = get_type(dest); 189 189 190 const size_t src_len = str_ size(src);190 const size_t src_len = str_bytes(src); 191 191 192 192 if (src_type == TYPE_FILE) { … … 214 214 dest_type = get_type(dest_path); 215 215 } else if (dest_type == TYPE_NONE) { 216 if (dest_path[str_ size(dest_path) - 1] == '/') {216 if (dest_path[str_bytes(dest_path) - 1] == '/') { 217 217 /* e.g. cp /textdemo /data/dirnotexists/ */ 218 218 -
uspace/app/bdsh/cmds/modules/ls/ls.c
rd066259 r08e103d4 174 174 175 175 /* fill the name field */ 176 tosort[nbdirs].name = (char *) malloc(str_ size(dp->d_name) + 1);176 tosort[nbdirs].name = (char *) malloc(str_bytes(dp->d_name) + 1); 177 177 if (!tosort[nbdirs].name) { 178 178 cli_error(CL_ENOMEM, "ls: failed to scan %s", d); … … 180 180 } 181 181 182 str_cpy(tosort[nbdirs].name, str_ size(dp->d_name) + 1, dp->d_name);182 str_cpy(tosort[nbdirs].name, str_bytes(dp->d_name) + 1, dp->d_name); 183 183 len = snprintf(buff, PATH_MAX - 1, "%s/%s", d, tosort[nbdirs].name); 184 184 buff[len] = '\0'; … … 264 264 memset(subdir_path, 0, PATH_MAX); 265 265 266 if (str_ size(subdir_path) + str_size(path) + 1 <= PATH_MAX)266 if (str_bytes(subdir_path) + str_bytes(path) + 1 <= PATH_MAX) 267 267 str_append(subdir_path, PATH_MAX, path); 268 if (path[str_ size(path) - 1] != '/' &&269 str_ size(subdir_path) + str_size(trailing_slash) + 1 <= PATH_MAX)268 if (path[str_bytes(path) - 1] != '/' && 269 str_bytes(subdir_path) + str_bytes(trailing_slash) + 1 <= PATH_MAX) 270 270 str_append(subdir_path, PATH_MAX, trailing_slash); 271 if (str_ size(subdir_path) +272 str_ size(dir_list[i].name) + 1 <= PATH_MAX)271 if (str_bytes(subdir_path) + 272 str_bytes(dir_list[i].name) + 1 <= PATH_MAX) 273 273 str_append(subdir_path, PATH_MAX, dir_list[i].name); 274 274 -
uspace/app/bdsh/cmds/modules/printf/printf.c
rd066259 r08e103d4 135 135 136 136 fmt = argv[1]; 137 fmt_sz = str_ size(fmt);137 fmt_sz = str_bytes(fmt); 138 138 pos = 0; 139 139 carg = 2; -
uspace/app/bdsh/cmds/modules/rm/rm.c
rd066259 r08e103d4 302 302 i = optind; 303 303 while (NULL != argv[i]) { 304 len = str_ size(argv[i]) + 2;304 len = str_bytes(argv[i]) + 2; 305 305 buff = (char *) realloc(buff, len); 306 306 if (buff == NULL) { -
uspace/app/bdsh/compl.c
rd066259 r08e103d4 160 160 * XXX: handle strings, etc. 161 161 */ 162 pref_size = str_l size(stext, pos - *cstart);162 pref_size = str_lbytes(stext, pos - *cstart); 163 163 prefix = malloc(pref_size + 1); 164 164 if (prefix == NULL) { … … 237 237 } 238 238 239 cs->prefix_len = str_ length(cs->prefix);239 cs->prefix_len = str_code_points(cs->prefix); 240 240 241 241 tok_fini(&tok); -
uspace/app/bdsh/tok.c
rd066259 r08e103d4 65 65 66 66 /* Prepare a buffer where all the token strings will be stored */ 67 size_t len = str_ size(input) + max_tokens + 1;67 size_t len = str_bytes(input) + max_tokens + 1; 68 68 char *tmp = malloc(len); 69 69 -
uspace/app/date/date.c
rd066259 r08e103d4 203 203 uint32_t tmp; 204 204 205 if (str_ size(wdate) != 10) /* str_size("DD/MM/YYYY") == 10 */205 if (str_bytes(wdate) != 10) /* str_bytes("DD/MM/YYYY") == 10 */ 206 206 return EINVAL; 207 207 … … 236 236 { 237 237 errno_t rc; 238 size_t len = str_ size(wtime);238 size_t len = str_bytes(wtime); 239 239 bool sec_present = len == 8; 240 240 uint32_t tmp; 241 241 242 /* str_ size("HH:MM") == 5 */243 /* str_ size("HH:MM:SS") == 8 */242 /* str_bytes("HH:MM") == 5 */ 243 /* str_bytes("HH:MM:SS") == 8 */ 244 244 if (len != 8 && len != 5) 245 245 return EINVAL; -
uspace/app/edit/edit.c
rd066259 r08e103d4 637 637 asprintf(&str, "%s: %s", prompt, init_value); 638 638 status_display(str); 639 console_set_pos(con, 1 + str_ length(str), scr_rows - 1);639 console_set_pos(con, 1 + str_code_points(str), scr_rows - 1); 640 640 free(str); 641 641 642 642 console_set_style(con, STYLE_INVERTED); 643 643 644 max_len = min(INFNAME_MAX_LEN, scr_columns - 4 - str_ length(prompt));644 max_len = min(INFNAME_MAX_LEN, scr_columns - 4 - str_code_points(prompt)); 645 645 str_to_wstr(buffer, max_len + 1, init_value); 646 nc = wstr_ length(buffer);646 nc = wstr_code_points(buffer); 647 647 done = false; 648 648 … … 747 747 do { 748 748 sheet_copy_out(doc.sh, &sp, epos, buf, BUF_SIZE, &bep); 749 bytes = str_ size(buf);749 bytes = str_bytes(buf); 750 750 751 751 n_written = fwrite(buf, 1, bytes, f); … … 783 783 sheet_copy_out(doc.sh, &sp, epos, &buf[bpos], buf_size - bpos, 784 784 &bep); 785 bytes = str_ size(&buf[bpos]);785 bytes = str_bytes(&buf[bpos]); 786 786 bpos += bytes; 787 787 sp = bep; … … 893 893 894 894 console_set_pos(con, 0, i); 895 size = str_ size(row_buf);895 size = str_bytes(row_buf); 896 896 pos = 0; 897 897 s_column = pane.sh_column; … … 1012 1012 /* Compute position where we overwrite with '..\0' */ 1013 1013 if (fnw >= nextra + 2) { 1014 p = fname + str_l size(fname, fnw - nextra - 2);1014 p = fname + str_lbytes(fname, fnw - nextra - 2); 1015 1015 } else { 1016 1016 p = fname; … … 1609 1609 { 1610 1610 size_t offset = 0; 1611 return str_decode(str, &offset, str_ size(str));1611 return str_decode(str, &offset, str_bytes(str)); 1612 1612 } 1613 1613 -
uspace/app/edit/search.c
rd066259 r08e103d4 56 56 } 57 57 58 search->pattern_length = wstr_ length(p);58 search->pattern_length = wstr_code_points(p); 59 59 60 60 if (reverse) { -
uspace/app/edit/sheet.c
rd066259 r08e103d4 107 107 char *newp; 108 108 109 sz = str_ size(str);109 sz = str_bytes(str); 110 110 if (sh->text_size + sz > sh->dbuf_size) { 111 111 /* Enlarge data buffer. */ -
uspace/app/fdisk/fdisk.c
rd066259 r08e103d4 617 617 } 618 618 619 if (str_ size(pinfo.label) > 0)619 if (str_bytes(pinfo.label) > 0) 620 620 label = pinfo.label; 621 621 else … … 1010 1010 } 1011 1011 1012 if (str_ size(pinfo.label) > 0)1012 if (str_bytes(pinfo.label) > 0) 1013 1013 label = pinfo.label; 1014 1014 else -
uspace/app/hbench/env.c
rd066259 r08e103d4 49 49 { 50 50 param_t *param = hash_table_get_inst(item, param_t, link); 51 return str_ size(param->key);51 return str_bytes(param->key); 52 52 } 53 53 … … 55 55 { 56 56 char *key_str = key; 57 return str_ size(key_str);57 return str_bytes(key_str); 58 58 } 59 59 -
uspace/app/hbench/main.c
rd066259 r08e103d4 291 291 size_t len = 0; 292 292 for (size_t i = 0; i < benchmark_count; i++) { 293 size_t len_now = str_ length(benchmarks[i]->name);293 size_t len_now = str_code_points(benchmarks[i]->name); 294 294 if (len_now > len) 295 295 len = len_now; -
uspace/app/kio/kio.c
rd066259 r08e103d4 245 245 } 246 246 247 kio_command(str, str_ size(str));247 kio_command(str, str_bytes(str)); 248 248 free(str); 249 249 } -
uspace/app/lprint/lprint.c
rd066259 r08e103d4 100 100 ++argv; 101 101 102 rc = chardev_write(chardev, msg, str_ size(msg), &nbytes);102 rc = chardev_write(chardev, msg, str_bytes(msg), &nbytes); 103 103 if (rc != EOK) { 104 104 printf(NAME ": Failed sending data.\n"); … … 108 108 sep = argc > 0 ? " " : "\n"; 109 109 110 rc = chardev_write(chardev, sep, str_ size(sep), &nbytes);110 rc = chardev_write(chardev, sep, str_bytes(sep), &nbytes); 111 111 if (rc != EOK) { 112 112 printf(NAME ": Failed sending data.\n"); -
uspace/app/netecho/netecho.c
rd066259 r08e103d4 139 139 140 140 while (*msgs != NULL) { 141 rc = comm_send(*msgs, str_ size(*msgs));141 rc = comm_send(*msgs, str_bytes(*msgs)); 142 142 if (rc != EOK) { 143 143 printf("[Failed sending data]\n"); -
uspace/app/nic/nic.c
rd066259 r08e103d4 452 452 } 453 453 454 if (str_ size(str) != 17) {454 if (str_bytes(str) != 17) { 455 455 printf("Invalid MAC address specified"); 456 456 return EINVAL; -
uspace/app/sbi/src/builtin/bi_string.c
rd066259 r08e103d4 86 86 assert(self_value_var->vc == vc_string); 87 87 str = self_value_var->u.string_v->value; 88 str_l = os_str_ length(str);88 str_l = os_str_code_points(str); 89 89 90 90 #ifdef DEBUG_RUN_TRACE … … 131 131 assert(self_value_var->vc == vc_string); 132 132 str = self_value_var->u.string_v->value; 133 str_l = os_str_ length(str);133 str_l = os_str_code_points(str); 134 134 135 135 /* Get argument @a start. */ -
uspace/app/sbi/src/lex.c
rd066259 r08e103d4 597 597 lex_char_string_core(lex, cs_chr); 598 598 599 len = os_str_ length(strlit_buf);599 len = os_str_code_points(strlit_buf); 600 600 if (len != 1) { 601 601 printf("Character literal should contain one character, " -
uspace/app/sbi/src/os/helenos.c
rd066259 r08e103d4 60 60 char *str; 61 61 62 a_size = str_ size(a);63 b_size = str_ size(b);62 a_size = str_bytes(a); 63 b_size = str_bytes(b); 64 64 65 65 str = malloc(a_size + b_size + 1); … … 96 96 wchar_t c; 97 97 98 assert(start + length <= str_ length(str));98 assert(start + length <= str_code_points(str)); 99 99 100 100 offset = 0; … … 106 106 } 107 107 108 size = str_l size(str, length);108 size = str_lbytes(str, length); 109 109 slice = str_ndup(str + offset, size); 110 110 … … 128 128 * @return Number of characters in @a str. 129 129 */ 130 size_t os_str_ length(const char *str)131 { 132 return str_ length(str);130 size_t os_str_code_points(const char *str) 131 { 132 return str_code_points(str); 133 133 } 134 134 -
uspace/app/sbi/src/os/os.h
rd066259 r08e103d4 36 36 int os_str_cmp(const char *a, const char *b); 37 37 char *os_str_dup(const char *str); 38 size_t os_str_ length(const char *str);38 size_t os_str_code_points(const char *str); 39 39 errno_t os_str_get_char(const char *str, int index, int *out_char); 40 40 char *os_chr_to_astr(wchar_t chr); -
uspace/app/sbi/src/os/posix.c
rd066259 r08e103d4 124 124 * @return Number of characters in @a str. 125 125 */ 126 size_t os_str_ length(const char *str)126 size_t os_str_code_points(const char *str) 127 127 { 128 128 return strlen(str); -
uspace/app/sportdmp/sportdmp.c
rd066259 r08e103d4 54 54 55 55 if (argc > arg && str_test_prefix(argv[arg], "--baud=")) { 56 size_t arg_offset = str_l size(argv[arg], 7);56 size_t arg_offset = str_lbytes(argv[arg], 7); 57 57 char *arg_str = argv[arg] + arg_offset; 58 if (str_ length(arg_str) == 0) {58 if (str_code_points(arg_str) == 0) { 59 59 fprintf(stderr, "--baud requires an argument\n"); 60 60 syntax_print(); -
uspace/app/sysinfo/sysinfo.c
rd066259 r08e103d4 129 129 while (pos < size) { 130 130 /* Process each key with sanity checks */ 131 size_t cur_size = str_n size(keys + pos, size - pos);131 size_t cur_size = str_nbytes(keys + pos, size - pos); 132 132 if (keys[pos + cur_size] != 0) 133 133 break; 134 134 135 size_t path_size = str_ size(path) + cur_size + 2;135 size_t path_size = str_bytes(path) + cur_size + 2; 136 136 char *cur_path = (char *) malloc(path_size); 137 137 if (cur_path == NULL) … … 143 143 print_spaces(spaces); 144 144 printf(".%s\n", keys + pos); 145 length = str_ length(keys + pos) + 1;145 length = str_code_points(keys + pos) + 1; 146 146 147 147 snprintf(cur_path, path_size, "%s.%s", path, keys + pos); 148 148 } else { 149 149 printf("%s\n", keys + pos); 150 length = str_ length(keys + pos);150 length = str_code_points(keys + pos); 151 151 152 152 snprintf(cur_path, path_size, "%s", keys + pos); -
uspace/app/taskdump/elf_core.c
rd066259 r08e103d4 177 177 p_hdr[0].p_paddr = 0; 178 178 p_hdr[0].p_filesz = sizeof(elf_note_t) + 179 ALIGN_UP((str_ size("CORE") + 1), word_size) +179 ALIGN_UP((str_bytes("CORE") + 1), word_size) + 180 180 ALIGN_UP(sizeof(elf_prstatus_t), word_size); 181 181 p_hdr[0].p_memsz = 0; … … 230 230 * Write note header 231 231 */ 232 note.namesz = str_ size("CORE") + 1;232 note.namesz = str_bytes("CORE") + 1; 233 233 note.descsz = sizeof(elf_prstatus_t); 234 234 note.type = NT_PRSTATUS; -
uspace/app/tester/hw/serial/serial1.c
rd066259 r08e103d4 198 198 TPRINTF("Trying to write EOT banner to the serial device\n"); 199 199 200 size_t eot_size = str_ size(EOT);200 size_t eot_size = str_bytes(EOT); 201 201 rc = chardev_write(chardev, (void *) EOT, eot_size, &nwritten); 202 202 -
uspace/app/tester/tester.c
rd066259 r08e103d4 142 142 test_t *test; 143 143 for (test = tests; test->name != NULL; test++) { 144 if (str_ length(test->name) > len)145 len = str_ length(test->name);144 if (str_code_points(test->name) > len) 145 len = str_code_points(test->name); 146 146 } 147 147 -
uspace/app/tetris/screen.c
rd066259 r08e103d4 321 321 void scr_msg(char *s, bool set) 322 322 { 323 int l = str_ size(s);323 int l = str_bytes(s); 324 324 325 325 moveto(Rows - 2, ((Cols - l) >> 1) - 1); -
uspace/app/tetris/tetris.c
rd066259 r08e103d4 268 268 break; 269 269 case 'k': 270 if (str_ size(keys = optarg) != 6)270 if (str_bytes(keys = optarg) != 6) 271 271 usage(); 272 272 break; -
uspace/app/tmon/tests.c
rd066259 r08e103d4 130 130 131 131 if (params->transfer_size) { 132 char *str_ size= tmon_format_size(params->transfer_size, "%.3f %s");133 printf("Transfer size: %s\n", str_ size);134 free(str_ size);132 char *str_bytes = tmon_format_size(params->transfer_size, "%.3f %s"); 133 printf("Transfer size: %s\n", str_bytes); 134 free(str_bytes); 135 135 } else { 136 136 printf("Transfer size: (max. transfer size)\n"); -
uspace/app/usbinfo/list.c
rd066259 r08e103d4 98 98 /* Get handle of parent device */ 99 99 devman_handle_t fh; 100 path[str_ size(path) - str_size(name) - 1] = '\0';100 path[str_bytes(path) - str_bytes(name) - 1] = '\0'; 101 101 rc = devman_fun_get_handle(path, &fh, IPC_FLAG_BLOCKING); 102 102 if (rc != EOK) { -
uspace/app/wavplay/wave.c
rd066259 r08e103d4 151 151 { 152 152 assert(header); 153 #define COPY_STR(dst, src) memcpy(dst, src, str_ size(src))153 #define COPY_STR(dst, src) memcpy(dst, src, str_bytes(src)) 154 154 155 155 COPY_STR(&header->chunk_id, CHUNK_ID); -
uspace/app/websrv/websrv.c
rd066259 r08e103d4 227 227 static errno_t send_response(tcp_conn_t *conn, const char *msg) 228 228 { 229 size_t response_size = str_ size(msg);229 size_t response_size = str_bytes(msg); 230 230 231 231 if (verbose) … … 322 322 char *end_uri = str_chr(uri, ' '); 323 323 if (end_uri == NULL) { 324 end_uri = reqline + str_ size(reqline) - 2;324 end_uri = reqline + str_bytes(reqline) - 2; 325 325 assert(*end_uri == '\r'); 326 326 }
Note:
See TracChangeset
for help on using the changeset viewer.
