open files in binary mode, to fix problems on Windows. Fix a constness
SVN revision: 34931
This commit is contained in:
parent
d7a634d3da
commit
074765d3aa
|
@ -3,6 +3,15 @@
|
||||||
|
|
||||||
#include "edje_main.h"
|
#include "edje_main.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* On Windows, if the file is not opened in binary mode,
|
||||||
|
* read does not return the correct size, because of
|
||||||
|
* CR / LF translation.
|
||||||
|
*/
|
||||||
|
#ifndef O_BINARY
|
||||||
|
# define O_BINARY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/* types */
|
/* types */
|
||||||
typedef struct _New_Object_Handler New_Object_Handler;
|
typedef struct _New_Object_Handler New_Object_Handler;
|
||||||
typedef struct _New_Statement_Handler New_Statement_Handler;
|
typedef struct _New_Statement_Handler New_Statement_Handler;
|
||||||
|
|
|
@ -749,7 +749,7 @@ st_data_file(void)
|
||||||
di->key = parse_str(0);
|
di->key = parse_str(0);
|
||||||
filename = parse_str(1);
|
filename = parse_str(1);
|
||||||
|
|
||||||
fd = open(filename, O_RDONLY);
|
fd = open(filename, O_RDONLY | O_BINARY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error. %s:%i when opening file \"%s\": \"%s\"\n",
|
fprintf(stderr, "%s: Error. %s:%i when opening file \"%s\": \"%s\"\n",
|
||||||
|
|
|
@ -610,7 +610,7 @@ data_write(void)
|
||||||
char tmpo[4096];
|
char tmpo[4096];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
f = fopen(tmpn, "w");
|
f = fopen(tmpn, "wb");
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
Evas_List *ll;
|
Evas_List *ll;
|
||||||
|
|
|
@ -611,7 +611,7 @@ compile(void)
|
||||||
int fd;
|
int fd;
|
||||||
off_t size;
|
off_t size;
|
||||||
char *data, *p;
|
char *data, *p;
|
||||||
char *tmpdir;
|
const char *tmpdir;
|
||||||
|
|
||||||
#ifdef HAVE_EVIL
|
#ifdef HAVE_EVIL
|
||||||
tmpdir = evil_tmpdir_get();
|
tmpdir = evil_tmpdir_get();
|
||||||
|
@ -693,7 +693,7 @@ compile(void)
|
||||||
free(def);
|
free(def);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
fd = open(file_in, O_RDONLY);
|
fd = open(file_in, O_RDONLY | O_BINARY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error. cannot open file \"%s\" for input. %s\n",
|
fprintf(stderr, "%s: Error. cannot open file \"%s\" for input. %s\n",
|
||||||
|
|
|
@ -226,7 +226,7 @@ output(void)
|
||||||
printf("ERROR: potential security violation. attempt to write in parent dir.\n");
|
printf("ERROR: potential security violation. attempt to write in parent dir.\n");
|
||||||
exit (-1);
|
exit (-1);
|
||||||
}
|
}
|
||||||
f = fopen(out, "w");
|
f = fopen(out, "wb");
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
printf("ERROR: unable to write file (%s).\n", out);
|
printf("ERROR: unable to write file (%s).\n", out);
|
||||||
|
@ -292,7 +292,7 @@ output(void)
|
||||||
printf("ERROR: potential security violation. attempt to write in parent dir.\n");
|
printf("ERROR: potential security violation. attempt to write in parent dir.\n");
|
||||||
exit (-1);
|
exit (-1);
|
||||||
}
|
}
|
||||||
f = fopen(out, "w");
|
f = fopen(out, "wb");
|
||||||
fprintf(f, "#!/bin/sh\n");
|
fprintf(f, "#!/bin/sh\n");
|
||||||
fprintf(f, "%s $@ -id . -fd . %s -o %s.edj\n", edje_file->compiler, sf->name, outdir);
|
fprintf(f, "%s $@ -id . -fd . %s -o %s.edj\n", edje_file->compiler, sf->name, outdir);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
Loading…
Reference in New Issue