summarylogtreecommitdiffstats
path: root/0007-fix-wrong-return-value.patch
blob: 8f4bd4fcfcf9612624ec5600825a56c167e3944b (plain)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
--- ./src/dos/drive_physfs.cpp.orig	2015-01-25 08:51:05.573082100 +0100
+++ ./src/dos/drive_physfs.cpp	2017-02-12 23:33:04.972086247 +0100
@@ -57,7 +57,7 @@
 	bool prepareWrite();
 	bool Close();
 	Bit16u GetInformation(void);
-	bool UpdateDateTimeFromHost(void);   
+	bool UpdateDateTimeFromHost(void);
 private:
 	PHYSFS_file * fhandle;
 	enum { READ,WRITE } last_action;
@@ -94,7 +94,7 @@
 
 	/* Test if file exists, don't add to dirCache then */
 	bool existing_file=PHYSFS_exists(newname);
-	
+
 	char *slash = strrchr(newname,'/');
 	if (slash && slash != newname) {
 		char file[CROSS_LEN];
@@ -131,7 +131,7 @@
 	normalize(newname,basedir);
 
 	PHYSFS_file * hand;
-	
+
 	if (!PHYSFS_exists(newname)) return false;
 	if ((flags&0xf) == OPEN_READ) {
 		hand = PHYSFS_openRead(newname);
@@ -141,7 +141,7 @@
 		hand = PHYSFS_openRead(newname);
 	}
 
-	if (!hand) { 
+	if (!hand) {
 		if((flags&0xf) != OPEN_READ) {
 			PHYSFS_file *hmm = PHYSFS_openRead(newname);
 			if (hmm) {
@@ -151,7 +151,7 @@
 		}
 		return false;
 	}
-   
+
 	*file=new physfsFile(name,hand,0x202,newname,false);
 	(*file)->flags=flags;  //for the inheritance flag and maybe check for others.
 	return true;
@@ -182,7 +182,7 @@
 
 	char end[2]={CROSS_FILESPLIT,0};
 	if (tempDir[strlen(tempDir)-1]!=CROSS_FILESPLIT) strcat(tempDir,end);
-	
+
 	Bit16u id;
 	if (!dirCache.FindFirst(tempDir,id))
 	{
@@ -191,7 +191,7 @@
 	}
 	strcpy(srchInfo[id].srch_dir,tempDir);
 	dta.SetDirID(id);
-	
+
 	Bit8u sAttr;
 	dta.GetSearchParams(sAttr,tempDir);
 
@@ -203,7 +203,7 @@
 		}
 		dta.SetResult(dirCache.GetLabel(),0,0,0,DOS_ATTR_VOLUME);
 		return true;
-	} else if ((sAttr & DOS_ATTR_VOLUME)  && (*_dir == 0) && !fcb_findfirst) { 
+	} else if ((sAttr & DOS_ATTR_VOLUME)  && (*_dir == 0) && !fcb_findfirst) {
 	//should check for a valid leading directory instead of 0
 	//exists==true if the volume label matches the searchmask and the path is valid
 		if ( strcmp(dirCache.GetLabel(), "") == 0 ) {
@@ -228,7 +228,7 @@
 	Bit8u find_attr;
 
 	dta.GetSearchParams(srch_attr,srch_pattern);
-	
+
 	Bitu id = dta.GetDirID();
 
 again:
@@ -242,17 +242,17 @@
 	if(strlen(dir_ent)<DOS_NAMELENGTH_ASCII){
 		strcpy(find_name,dir_ent);
 		upcase(find_name);
-	} 
+	}
 
 	strcpy(full_name,srchInfo[id].srch_dir);
 	strcat(full_name,dir_ent);
 	dirCache.ExpandName(full_name);
 	normalize(full_name,basedir);
-	
+
 	if (PHYSFS_isDirectory(full_name)) find_attr=DOS_ATTR_DIRECTORY|DOS_ATTR_ARCHIVE;
 	else find_attr=DOS_ATTR_ARCHIVE;
  	if (~srch_attr & find_attr & (DOS_ATTR_DIRECTORY | DOS_ATTR_HIDDEN | DOS_ATTR_SYSTEM)) goto again;
-	
+
 	/*file is okay, setup everything to be copied in DTA Block */
 	find_size=(Bit32u)PHYSFS_fileLength(full_name);
 	time_t mytime = PHYSFS_getLastModTime(full_name);
@@ -261,7 +261,7 @@
 		find_date=DOS_PackDate((Bit16u)(time->tm_year+1900),(Bit16u)(time->tm_mon+1),(Bit16u)time->tm_mday);
 		find_time=DOS_PackTime((Bit16u)time->tm_hour,(Bit16u)time->tm_min,(Bit16u)time->tm_sec);
 	} else {
-		find_time=6; 
+		find_time=6;
 		find_date=4;
 	}
 	dta.SetResult(find_name,find_size,find_date,find_time,find_attr);
@@ -332,7 +332,7 @@
 	CROSS_FILENAME(newold);
 	dirCache.ExpandName(newold);
 	normalize(newold,basedir);
-	
+
 	char newnew[CROSS_LEN];
 	strcpy(newnew,basedir);
 	strcat(newnew,newname);
@@ -415,7 +415,7 @@
 	char myname[CROSS_LEN];
 	strcpy(myname,name);
 	normalize(myname,basedir);
-	if (!PHYSFS_isDirectory(myname)) return false;
+	if (!PHYSFS_isDirectory(myname)) return NULL;
 
 	struct opendirinfo *oinfo = (struct opendirinfo *)malloc(sizeof(struct opendirinfo));
 	oinfo->files = PHYSFS_enumerateFiles(myname);
@@ -476,7 +476,7 @@
 		strcpy(newname,startdir);
 	}
 
-	CROSS_FILENAME(newname);	
+	CROSS_FILENAME(newname);
 	if (!physfs_used) {
 		PHYSFS_init("");
 		PHYSFS_permitSymbolicLinks(1);
@@ -510,7 +510,7 @@
 			PHYSFS_setWriteDir(oldwrite);
 	}
 	if (oldwrite) free((char *)oldwrite);
-	
+
 	strcpy(basedir,lastdir);
 
 	allocation.bytes_sector=_bytes_sector;
@@ -599,7 +599,7 @@
 	}
 
 	if (!PHYSFS_seek(fhandle,mypos)) {
-		// Out of file range, pretend everythings ok 
+		// Out of file range, pretend everythings ok
 		// and move file pointer top end of file... ?! (Black Thorne)
 		PHYSFS_seek(fhandle,PHYSFS_fileLength(fhandle));
 	};
@@ -682,7 +682,7 @@
 Bit16u physfsFile::GetInformation(void) {
 	return info;
 }
-	
+
 
 physfsFile::physfsFile(const char* _name, PHYSFS_file * handle,Bit16u devinfo, const char* physname, bool write) {
 	fhandle=handle;