1
/******************************* LICENSE **************************************
2
* Any code in this file may be redistributed or modified under the terms of
3
* the GNU General Public License as published by the Free Software
4
* Foundation; version 2 of the license.
5
****************************** END LICENSE ***********************************/
7
/******************************************************************************
9
* Andrew Smith, http://littlesvr.ca/misc/contactandrew.php
11
* Copyright 2005-2007 Andrew Smith <andrew-smith@mail.ru>
15
******************************************************************************/
18
#include <sys/types.h>
21
#include "bkInternal.h"
24
/* strings cannot be equal */
25
bool rightIsBigger(char* leftStr, char* rightStr)
33
leftLen = strlen(leftStr);
34
rightLen = strlen(rightStr);
37
for (count = 0; count < leftLen && count < rightLen && !resultFound; count++) {
38
if (rightStr[count] > leftStr[count]) {
41
} else if (rightStr[count] < leftStr[count]) {
48
/* strings are the same up to the length of the shorter one */
50
if (rightLen > leftLen)
59
void sortDir(DirToWrite* dir, int filenameType)
63
child = dir->children;
64
while (child != NULL) {
65
if (IS_DIR(child->posixFileMode))
66
sortDir(DIRTW_PTR(child), filenameType);
71
BaseToWrite** outerPtr;
72
BaseToWrite** innerPtr;
74
outerPtr = &(dir->children);
75
while (*outerPtr != NULL) {
76
innerPtr = &((*outerPtr)->next);
77
while (*innerPtr != NULL) {
78
if ((filenameType & FNTYPE_JOLIET &&
79
rightIsBigger((*innerPtr)->nameJoliet, (*outerPtr)->nameJoliet)) ||
80
(filenameType & FNTYPE_9660 &&
81
rightIsBigger((*innerPtr)->name9660, (*outerPtr)->name9660))) {
82
BaseToWrite* outer = *outerPtr;
83
BaseToWrite* inner = *innerPtr;
85
if ((*outerPtr)->next != *innerPtr) {
89
BaseToWrite* oldInnerNext = inner->next;
90
inner->next = outer->next;
91
outer->next = oldInnerNext;
94
innerPtr = &(inner->next);
96
BaseToWrite* oldInnerNext = inner->next;
98
outer->next = oldInnerNext;
102
innerPtr = &((*innerPtr)->next);
105
outerPtr = &((*outerPtr)->next);