/*
* This file is part of DisOrder
- * Copyright (C) 2005, 2006 Richard Kettlewell
+ * Copyright (C) 2005, 2006, 2007 Richard Kettlewell
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "regsub.h"
#include "log.h"
#include "filepart.h"
-#include "words.h"
+#include "unicode.h"
-const char *find_track_root(const char *track) {
+const struct collection *find_track_collection(const char *track) {
int n;
size_t l, tl = strlen(track);
&& track[l] == '/')
break;
}
- if(n >= config->collection.n) return 0;
- return config->collection.s[n].root;
+ if(n < config->collection.n)
+ return &config->collection.s[n];
+ else
+ return 0;
+}
+
+const char *find_track_root(const char *track) {
+ const struct collection *c = find_track_collection(track);
+ if(c)
+ return c->root;
+ error(0, "found track in no collection '%s'", track);
+ return 0;
}
const char *track_rootless(const char *track) {
const char *ta, const char *tb) {
int c;
- if((c = strcmp(casefold(sa), casefold(sb)))) return c;
+ if((c = strcmp(utf8_casefold_canon(sa, strlen(sa), 0),
+ utf8_casefold_canon(sb, strlen(sb), 0))))
+ return c;
if((c = strcmp(sa, sb))) return c;
- if((c = strcmp(casefold(da), casefold(db)))) return c;
+ if((c = strcmp(utf8_casefold_canon(da, strlen(da), 0),
+ utf8_casefold_canon(db, strlen(db), 0))))
+ return c;
if((c = strcmp(da, db))) return c;
return compare_path(ta, tb);
}
int compare_path_raw(const unsigned char *ap, size_t an,
const unsigned char *bp, size_t bn) {
+ /* Don't change this function! The database sort order depends on it */
while(an > 0 && bn > 0) {
if(*ap == *bp) {
ap++;
fill-column:79
End:
*/
-/* arch-tag:xMbRRluU86PaVSSnyIR77A */