Changeset - r20987:a313d4924904
[Not reviewed]
master
0 3 0
rubidium - 11 years ago 2013-11-23 13:17:45
rubidium@openttd.org
(svn r26061) -Fix: negative result of ftell wasn't handled correctly in some cases
3 files changed with 8 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/fileio.cpp
Show inline comments
 
@@ -254,7 +254,8 @@ void FioOpenFile(int slot, const char *f
 
#endif /* LIMITED_FDS */
 
	f = FioFOpenFile(filename, "rb", subdir);
 
	if (f == NULL) usererror("Cannot open file '%s'", filename);
 
	uint32 pos = ftell(f);
 
	long pos = ftell(f);
 
	if (pos < 0) usererror("Cannot read file '%s'", filename);
 

	
 
	FioCloseFile(slot); // if file was opened before, close it
 
	_fio.handles[slot] = f;
 
@@ -271,7 +272,7 @@ void FioOpenFile(int slot, const char *f
 
	_fio.usage_count[slot] = 0;
 
	_fio.open_handles++;
 
#endif /* LIMITED_FDS */
 
	FioSeekToFile(slot, pos);
 
	FioSeekToFile(slot, (uint32)pos);
 
}
 

	
 
static const char * const _subdirs[] = {
src/newgrf_config.cpp
Show inline comments
 
@@ -360,10 +360,10 @@ static bool CalcGRFMD5Sum(GRFConfig *con
 
	f = FioFOpenFile(config->filename, "rb", subdir, &size);
 
	if (f == NULL) return false;
 

	
 
	size_t start = ftell(f);
 
	long start = ftell(f);
 
	size = min(size, GRFGetSizeOfDataSection(f));
 

	
 
	if (fseek(f, start, SEEK_SET) < 0) {
 
	if (start < 0 || fseek(f, start, SEEK_SET) < 0) {
 
		FioFCloseFile(f);
 
		return false;
 
	}
src/smallmap_gui.cpp
Show inline comments
 
@@ -1418,10 +1418,12 @@ int SmallMapWindow::GetPositionOnLegend(
 
		case WID_SM_LEGEND: // Legend
 
			if (this->map_type == SMT_INDUSTRY || this->map_type == SMT_LINKSTATS || this->map_type == SMT_OWNER) {
 
				int click_pos = this->GetPositionOnLegend(pt);
 
				if (click_pos < 0) break;
 

	
 
				/* If industry type small map*/
 
				if (this->map_type == SMT_INDUSTRY) {
 
					/* If click on industries label, find right industry type and enable/disable it. */
 
					if (click_pos >= 0 && click_pos < _smallmap_industry_count) {
 
					if (click_pos < _smallmap_industry_count) {
 
						this->SelectLegendItem(click_pos, _legend_from_industries, _smallmap_industry_count);
 
					}
 
				} else if (this->map_type == SMT_LINKSTATS) {
0 comments (0 inline, 0 general)