File: catalog.diff

package info (click to toggle)
hfsplus 1.0.4-19
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,944 kB
  • sloc: ansic: 7,726; sh: 431; makefile: 55
file content (80 lines) | stat: -rw-r--r-- 2,062 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
80,84c80
< /* Utility function to count subdirectories. 
<  *
<  * Linux wants to know this but HFS+ does not know.
<  * (Does linux really need this ?)
<  */
---
> /* Utility function to count subdirectories */
103c99
< 			break; // End of current directory
---
> 			break;
107c103
< 		if(size < 2) // Unable tro retrive type, very bad ...
---
> 		if(size < 2)
115,116d110
< /* Compare two catalog keys liek strcmp */
< 
120d113
< 	hfsplus_unistr* u1, *u2;
124,130c117,120
< 	int diff = k2p - k1p;
< 	u1 = &k1->u.cat.name; // Feed he RISC pipeline
< 	u2 = &k2->u.cat.name;	
< 	if (!diff) 
< 		diff = hfsplus_unistrcmp(u1, u2);
< 
< 	return diff;
---
> 	if(k1p != k2p) {
> 		return (k1p < k2p) ? -1 : 1;
> 	}
> 	return hfsplus_unistrcmp(&(k1->u.cat.name), &(k2->u.cat.name));
133d122
< /* Intialize a catalog key by ist parent and name */
144,145c133,135
< 		int len = hfsplus_asc2uni(&(key->u.cat.name), name);
< 		hfsp_put_hs(6 + len << 1, key->key_len);
---
> 		hfsplus_asc2uni(&(key->u.cat.name), name);
> 		hfsp_put_hs(6 + 2 * hfsp_get_hs(key->u.cat.name.length),
> 			    key->key_len);
174d163
< /* Convert an catalog entry (file or foler) into a linux inode */
215,216c204
< 	} else { // folder/file thread, not handled here.
< 		 // Hasi: You could handle '..' here with the Folder thread
---
> 	} else {
221,225d208
< /* Find a folder thread (similar to linux '..') by its id
<  *
<  * returns value !=0 on succes.
<  */
< 
232d214
< 	hfsp_u8 type;
239,242c221,222
< 	if (!len)
< 		return 0;
< 	type = hfsp_get_hs(entry->type);	
< 	if(type != HFSPLUS_FOLDER_THREAD)
---
> 	if(!len || ((hfsp_get_hs(entry->type) != HFSPLUS_FOLDER_THREAD) &&
> 		    (hfsp_get_hs(entry->type) != HFSPLUS_FILE_THREAD))) {
244,245c224
< 	
< 	// Hasi: I think this is already code elsewhere	, mmh
---
> 	}
256,260c235,236
< 	if (!len)
< 		return 0;
< 	type = hfsp_get_hs(entry->type);	
< 	if((type != HFSPLUS_FOLDER) &&
< 	   (type != HFSPLUS_FILE)) {
---
> 	if(!len || ((hfsp_get_hs(entry->type) != HFSPLUS_FOLDER) &&
> 		    (hfsp_get_hs(entry->type) != HFSPLUS_FILE))) {