Changeset 7f9df7b9 in mainline for uspace/lib/posix/src/stdio/scanf.c
- Timestamp:
- 2018-01-22T22:42:57Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7a08c70
- Parents:
- e0f47f5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/src/stdio/scanf.c
re0f47f5 r7f9df7b9 33 33 */ 34 34 35 #define LIBPOSIX_INTERNAL36 #define __POSIX_DEF__(x) posix_##x37 38 35 #include <assert.h> 39 36 … … 119 116 /* Initialize internal structures. */ 120 117 self->consumed = 0; 121 ssize_t fetched = posix_getline(118 ssize_t fetched = getline( 122 119 &self->window, &self->window_size, self->source.stream); 123 120 if (fetched != -1) { … … 140 137 /* Initialize internal structures. */ 141 138 self->consumed = 0; 142 self->fetched = posix_strlen(self->source.string);139 self->fetched = strlen(self->source.string); 143 140 self->window = (char *) self->source.string; 144 141 self->window_size = self->fetched + 1; … … 158 155 /* Do we need to fetch a new line from the source? */ 159 156 if (*self->cursor == '\0') { 160 ssize_t fetched = posix_getline(&self->window,157 ssize_t fetched = getline(&self->window, 161 158 &self->window_size, self->source.stream); 162 159 if (fetched != -1) { … … 208 205 * containing newline, while at the same time newline is the character 209 206 * that breaks the matching process. */ 210 int rc = posix_fseek( 211 self->source.stream, -1, SEEK_CUR); 207 int rc = fseek(self->source.stream, -1, SEEK_CUR); 212 208 if (rc == -1) { 213 209 /* Seek failed. */ 214 210 return 0; 215 211 } 216 ssize_t fetched = posix_getline(&self->window,212 ssize_t fetched = getline(&self->window, 217 213 &self->window_size, self->source.stream); 218 214 if (fetched != -1) { … … 266 262 if (*self->cursor == '\0') { 267 263 /* Window was completely consumed, fetch new data. */ 268 ssize_t fetched = posix_getline(&self->window,264 ssize_t fetched = getline(&self->window, 269 265 &self->window_size, self->source.stream); 270 266 if (fetched != -1) { … … 298 294 /* Try to correct the difference between the stream position and what was 299 295 * actually consumed. If it is not possible, continue anyway. */ 300 posix_fseek(self->source.stream, self->consumed - self->fetched, SEEK_CUR);296 fseek(self->source.stream, self->consumed - self->fetched, SEEK_CUR); 301 297 302 298 /* Destruct internal structures. */ … … 638 634 * than allowed by width. */ 639 635 if (width != -1) { 640 cur_duplicated = posix_strndup(cur_borrowed, width);636 cur_duplicated = strndup(cur_borrowed, width); 641 637 cur_limited = cur_duplicated; 642 638 } else { … … 812 808 * than allowed by width. */ 813 809 if (width != -1) { 814 cur_duplicated = posix_strndup(cur_borrowed, width);810 cur_duplicated = strndup(cur_borrowed, width); 815 811 cur_limited = cur_duplicated; 816 812 } else { … … 826 822 switch (length_mod) { 827 823 case LMOD_NONE: 828 fres = posix_strtof(cur_limited, (char **) &cur_updated);824 fres = strtof(cur_limited, (char **) &cur_updated); 829 825 break; 830 826 case LMOD_l: 831 dres = posix_strtod(cur_limited, (char **) &cur_updated);827 dres = strtod(cur_limited, (char **) &cur_updated); 832 828 break; 833 829 case LMOD_L: 834 ldres = posix_strtold(cur_limited, (char **) &cur_updated);830 ldres = strtold(cur_limited, (char **) &cur_updated); 835 831 break; 836 832 default: … … 1194 1190 * @return The number of converted output items or EOF on failure. 1195 1191 */ 1196 int posix_vfscanf(1192 int vfscanf( 1197 1193 FILE *restrict stream, const char *restrict format, va_list arg) 1198 1194 { … … 1214 1210 * @return The number of converted output items or EOF on failure. 1215 1211 */ 1216 int posix_vsscanf(1212 int vsscanf( 1217 1213 const char *restrict s, const char *restrict format, va_list arg) 1218 1214 {
Note:
See TracChangeset
for help on using the changeset viewer.