Use fopen with binary mode everywhere (for Windows compat)
This commit is contained in:
		
							parent
							
								
									f7a3e3c5d2
								
							
						
					
					
						commit
						5c3f4b905a
					
				
					 4 changed files with 6 additions and 6 deletions
				
			
		| 
						 | 
					@ -192,7 +192,7 @@ static void
 | 
				
			||||||
runCustomScript(mrb_state *mrb, mrbc_context *ctx, const char *filename)
 | 
					runCustomScript(mrb_state *mrb, mrbc_context *ctx, const char *filename)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	/* Execute custom script */
 | 
						/* Execute custom script */
 | 
				
			||||||
	FILE *f = fopen(filename, "r");
 | 
						FILE *f = fopen(filename, "rb");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!f)
 | 
						if (!f)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
| 
						 | 
					@ -217,7 +217,7 @@ static void
 | 
				
			||||||
runMrbFile(mrb_state *mrb, const char *filename)
 | 
					runMrbFile(mrb_state *mrb, const char *filename)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	/* Execute compiled script */
 | 
						/* Execute compiled script */
 | 
				
			||||||
	FILE *f = fopen(filename, "r");
 | 
						FILE *f = fopen(filename, "rb");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!f)
 | 
						if (!f)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -178,7 +178,7 @@ static bool writeBindings(const BDescVec &d, const std::string &dir,
 | 
				
			||||||
	char path[1024];
 | 
						char path[1024];
 | 
				
			||||||
	buildPath(dir, rgssVersion, path, sizeof(path));
 | 
						buildPath(dir, rgssVersion, path, sizeof(path));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	FILE *f = fopen(path, "w");
 | 
						FILE *f = fopen(path, "wb");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!f)
 | 
						if (!f)
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
| 
						 | 
					@ -263,7 +263,7 @@ static bool readBindings(BDescVec &out, const std::string &dir,
 | 
				
			||||||
	char path[1024];
 | 
						char path[1024];
 | 
				
			||||||
	buildPath(dir, rgssVersion, path, sizeof(path));
 | 
						buildPath(dir, rgssVersion, path, sizeof(path));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	FILE *f = fopen(path, "r");
 | 
						FILE *f = fopen(path, "rb");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!f)
 | 
						if (!f)
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -125,7 +125,7 @@ struct SharedStatePrivate
 | 
				
			||||||
		std::string archPath = defGameArchive();
 | 
							std::string archPath = defGameArchive();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* Check if a game archive exists */
 | 
							/* Check if a game archive exists */
 | 
				
			||||||
		FILE *tmp = fopen(archPath.c_str(), "r");
 | 
							FILE *tmp = fopen(archPath.c_str(), "rb");
 | 
				
			||||||
		if (tmp)
 | 
							if (tmp)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			fileSystem.addPath(archPath.c_str());
 | 
								fileSystem.addPath(archPath.c_str());
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -66,7 +66,7 @@ findNextPow2(int start)
 | 
				
			||||||
inline bool readFile(const char *path,
 | 
					inline bool readFile(const char *path,
 | 
				
			||||||
                     std::string &out)
 | 
					                     std::string &out)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	FILE *f = fopen(path, "r");
 | 
						FILE *f = fopen(path, "rb");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!f)
 | 
						if (!f)
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue