MCPcopy Create free account
hub / github.com/catboost/catboost / next_dir

Function next_dir

util/folder/dirut.cpp:145–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143// postcondition: *ptr != '\\'
144template <typename T>
145static int next_dir(T*& ptr) {
146 int has_blank = 0;
147 int has_dot = 0;
148 int has_letter = 0;
149 int has_ctrl = 0;
150
151 while (*ptr && *ptr != '\\') {
152 int c = (unsigned char)*ptr++;
153 switch (c) {
154 case ' ':
155 ++has_blank;
156 break;
157 case '.':
158 ++has_dot;
159 break;
160 case '/':
161 case ':':
162 case '*':
163 case '?':
164 case '"':
165 case '<':
166 case '>':
167 case '|':
168 ++has_ctrl;
169 break;
170 default:
171 if (c == 127 || c < ' ') {
172 ++has_ctrl;
173 } else {
174 ++has_letter;
175 }
176 }
177 }
178 if (*ptr) {
179 ++ptr;
180 }
181 if (has_ctrl) {
182 return dt_error;
183 }
184 if (has_letter) {
185 return dt_dir;
186 }
187 if (has_dot && has_blank) {
188 return dt_error;
189 }
190 if (has_dot == 1) {
191 return dt_empty;
192 }
193 if (has_dot == 2) {
194 return dt_up;
195 }
196 return dt_error;
197}
198
199using disk_type = enum {
200 dk_noflags = 0,

Callers 2

skip_diskFunction · 0.85
correctpathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected