Changeset 988 for vendor/current/source3/lib/srprs.c
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/lib/srprs.c
r740 r988 25 25 */ 26 26 27 #include "includes.h" 27 28 #include "srprs.h" 28 29 #include "cbuf.h" 29 #include <ctype.h>30 #include <string.h>31 #include <assert.h>32 #include <stdio.h>33 30 34 31 bool srprs_skipws(const char** ptr) { … … 129 126 bool srprs_hex(const char** ptr, size_t len, unsigned* u) 130 127 { 131 static const char* FMT[] = { 132 "%1x","%2x","%3x","%4x","%5x","%6x","%7x","%8x", 133 "%9x","%10x","%11x","%12x","%13x","%14x","%15x","%16x" 134 }; 135 136 const char* pos = *ptr; 128 const char *str = *ptr; 129 const char *pos = *ptr; 137 130 int ret; 138 131 int i; 139 140 assert((len > 0) 141 && (len <= 2*sizeof(unsigned)) 142 && (len <= sizeof(FMT)/sizeof(const char*))); 132 char buf[8+1] = {}; 133 134 assert((len >= 1) && (len <= 8)); 143 135 144 136 for (i=0; i<len; i++) { … … 146 138 break; 147 139 } 148 } 149 150 ret = sscanf(*ptr, FMT[len-1], u); 140 buf[i] = str[i]; 141 } 142 143 ret = sscanf(buf, "%8x", u); 151 144 152 145 if ( ret != 1 ) {
Note:
See TracChangeset
for help on using the changeset viewer.