Changeset 5065
- Timestamp:
- 12/03/07 19:26:06 (9 months ago)
- Files:
-
- wired/trunk/wired/files.c (modified) (6 diffs)
- wired/trunk/wired/files.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wired/trunk/wired/files.c
r5064 r5065 635 635 /* get file type */ 636 636 type = wd_files_type_with_stat(filepath, &sb); 637 name = w d_files_path_with_decomposed_cstring(p->fts_name);638 639 if(w i_string_contains_string(name, query, WI_STRING_CASE_INSENSITIVE)) {637 name = wi_string_with_cstring(p->fts_name); 638 639 if(wd_files_name_matches_query(name, query, wi_make_range(0, wi_string_length(name)))) { 640 640 /* matched, get size */ 641 641 switch(type) { … … 732 732 range.length = index; 733 733 734 if(w i_string_index_of_string_in_range(string, query, WI_STRING_CASE_INSENSITIVE, range) != WI_NOT_FOUND) {734 if(wd_files_name_matches_query(string, query, range)) { 735 735 if(account->files) { 736 736 pathrange.location = index + 1; … … 878 878 WI_FTS *fts = NULL; 879 879 WI_FTSENT *p; 880 wi_string_t *filepath, *virtualpath, * name, *string;880 wi_string_t *filepath, *virtualpath, *string; 881 881 wi_number_t *number; 882 882 wi_file_offset_t size; … … 958 958 /* get file type & size */ 959 959 type = wd_files_type_with_stat(filepath, &sb); 960 name = wd_files_path_with_decomposed_cstring(p->fts_name);961 960 962 961 switch(type) { … … 980 979 981 980 wi_file_write(file, WI_STR("%#s%c%#s%#@%c%u%c%llu%c%#@%c%#@\n"), 982 name,WD_FIELD_SEPARATOR,981 p->fts_name, WD_FIELD_SEPARATOR, 983 982 pathprefix, 984 983 virtualpath, WD_FIELD_SEPARATOR, … … 1325 1324 1326 1325 1327 wi_string_t * wd_files_path_with_decomposed_cstring(const char *cstring) { 1328 wi_string_t *path; 1329 1326 wi_boolean_t wd_files_name_matches_query(wi_string_t *name, wi_string_t *query, wi_range_t range) { 1330 1327 #ifdef HAVE_CORESERVICES_CORESERVICES_H 1331 CFMutableStringRef string; 1332 char buffer[WI_PATH_SIZE]; 1333 1334 string = CFStringCreateMutable(NULL, 0); 1335 CFStringAppendCString(string, cstring, kCFStringEncodingUTF8); 1336 CFStringNormalize(string, kCFStringNormalizationFormC); 1337 CFStringGetCString(string, buffer, sizeof(buffer), kCFStringEncodingUTF8); 1338 path = wi_string_with_cstring(buffer); 1339 CFRelease(string); 1328 CFMutableStringRef nameString; 1329 CFStringRef queryString; 1330 wi_boolean_t matches; 1331 1332 nameString = CFStringCreateMutable(NULL, 0); 1333 CFStringAppendCString(nameString, wi_string_cstring(name), kCFStringEncodingUTF8); 1334 CFStringNormalize(nameString, kCFStringNormalizationFormC); 1335 1336 queryString = CFStringCreateWithCString(NULL, wi_string_cstring(query), kCFStringEncodingUTF8); 1337 1338 matches = CFStringFindWithOptions(nameString, queryString, CFRangeMake(range.location, range.length), kCFCompareCaseInsensitive, NULL); 1339 1340 CFRelease(nameString); 1341 CFRelease(queryString); 1342 1343 return matches; 1340 1344 #else 1341 path = wi_string_with_cstring(cstring);1345 return (wi_string_index_of_string_in_range(name, query, WI_STRING_CASE_INSENSITIVE, range) != WI_NOT_FOUND); 1342 1346 #endif 1343 1344 return path;1345 1347 } 1346 1348 wired/trunk/wired/files.h
r5064 r5065 73 73 wi_boolean_t wd_files_path_is_dropbox(wi_string_t *); 74 74 wi_string_t * wd_files_real_path(wi_string_t *); 75 wi_ string_t * wd_files_path_with_decomposed_cstring(const char *);75 wi_boolean_t wd_files_name_matches_query(wi_string_t *, wi_string_t *, wi_range_t); 76 76 77 77
