Diff

Differences From Artifact [57ce2c31b4]:

To Artifact [da060cbcb2]:


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

<?
	package require xvfs
	xvfs::main $argv
?>
static long xvfs_<?= $::xvfs::fsName ?>_nameToIndex(const char *path) {
	unsigned int pathHash;

	
	if (path == NULL) {
		return(XVFS_NAME_LOOKUP_ERROR);
	}
	

	pathHash = Tcl_ZlibAdler32(0, (const unsigned char *) path, strlen(path));
	switch (pathHash) {
<?
	for {set index 0} {$index < [llength $::xvfs::outputFiles]} {incr index} {
		set outputFile [lindex $::xvfs::outputFiles $index]
		set outputFileHash [zlib adler32 $outputFile 0]
		lappend outputFileHashToIndex($outputFileHash) $index
	}
	
	foreach {outputFileHash outputFileIndexes} [lsort -stride 2 -dictionary [array get outputFileHashToIndex]] {
?>		case <?= $outputFileHash ?>:
<?
			foreach outputFileIndex $outputFileIndexes {



?>			if (strcmp(path, xvfs_<?= $::xvfs::fsName ?>_data[<?= $outputFileIndex ?>].name) == 0) {
				return(<?= $outputFileIndex ?>);
			}
<?
			}
?>			break;
<?	} ?>
	}







>




|
>
|












>
>
>
|







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

<?
	package require xvfs
	xvfs::main $argv
?>
static long xvfs_<?= $::xvfs::fsName ?>_nameToIndex(const char *path) {
	unsigned int pathHash;
	size_t pathLen;
	
	if (path == NULL) {
		return(XVFS_NAME_LOOKUP_ERROR);
	}

	pathLen = strlen(path);
	pathHash = Tcl_ZlibAdler32(0, (const unsigned char *) path, pathLen);
	switch (pathHash) {
<?
	for {set index 0} {$index < [llength $::xvfs::outputFiles]} {incr index} {
		set outputFile [lindex $::xvfs::outputFiles $index]
		set outputFileHash [zlib adler32 $outputFile 0]
		lappend outputFileHashToIndex($outputFileHash) $index
	}
	
	foreach {outputFileHash outputFileIndexes} [lsort -stride 2 -dictionary [array get outputFileHashToIndex]] {
?>		case <?= $outputFileHash ?>:
<?
			foreach outputFileIndex $outputFileIndexes {
				set outputFileName [lindex $::xvfs::outputFiles $outputFileIndex]
				set outputFileName [encoding convertto utf-8 $outputFileName]
				set outputFileNameLen [string length $outputFileName]
?>			if (pathLen == <?= $outputFileNameLen ?> && memcmp(path, xvfs_<?= $::xvfs::fsName ?>_data[<?= $outputFileIndex ?>].name, pathLen) == 0) {
				return(<?= $outputFileIndex ?>);
			}
<?
			}
?>			break;
<?	} ?>
	}