Enlightenment CVS committal

Author  : doursse
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/bin


Modified Files:
        edje_cc.h edje_cc_handlers.c edje_cc_out.c edje_cc_parse.c 
        edje_decc.c 


Log Message:
open files in binary mode, to fix problems on Windows. Fix a constness

===================================================================
RCS file: /cvs/e/e17/libs/edje/src/bin/edje_cc.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- edje_cc.h   1 Apr 2008 21:28:28 -0000       1.31
+++ edje_cc.h   28 Jun 2008 09:11:48 -0000      1.32
@@ -3,6 +3,15 @@
 
 #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 */
 typedef struct _New_Object_Handler    New_Object_Handler;
 typedef struct _New_Statement_Handler New_Statement_Handler;
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/bin/edje_cc_handlers.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -3 -r1.85 -r1.86
--- edje_cc_handlers.c  29 May 2008 02:00:03 -0000      1.85
+++ edje_cc_handlers.c  28 Jun 2008 09:11:48 -0000      1.86
@@ -749,7 +749,7 @@
    di->key = parse_str(0);
    filename = parse_str(1);
 
-   fd = open(filename, O_RDONLY);
+   fd = open(filename, O_RDONLY | O_BINARY);
    if (fd < 0)
      {
         fprintf(stderr, "%s: Error. %s:%i when opening file \"%s\": \"%s\"\n",
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/bin/edje_cc_out.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -3 -r1.62 -r1.63
--- edje_cc_out.c       6 Jun 2008 18:52:19 -0000       1.62
+++ edje_cc_out.c       28 Jun 2008 09:11:48 -0000      1.63
@@ -610,7 +610,7 @@
                  char tmpo[4096];
                  int ret;
 
-                 f = fopen(tmpn, "w");
+                 f = fopen(tmpn, "wb");
                  if (f)
                    {
                       Evas_List *ll;
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/bin/edje_cc_parse.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -3 -r1.52 -r1.53
--- edje_cc_parse.c     19 Jun 2008 12:47:04 -0000      1.52
+++ edje_cc_parse.c     28 Jun 2008 09:11:48 -0000      1.53
@@ -611,7 +611,7 @@
    int fd;
    off_t size;
    char *data, *p;
-   char *tmpdir;
+   const char *tmpdir;
 
 #ifdef HAVE_EVIL
    tmpdir = evil_tmpdir_get();
@@ -693,7 +693,7 @@
        free(def);
  */
      }
-   fd = open(file_in, O_RDONLY);
+   fd = open(file_in, O_RDONLY | O_BINARY);
    if (fd < 0)
      {
        fprintf(stderr, "%s: Error. cannot open file \"%s\" for input. %s\n",
===================================================================
RCS file: /cvs/e/e17/libs/edje/src/bin/edje_decc.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- edje_decc.c 7 Jun 2008 10:06:13 -0000       1.27
+++ edje_decc.c 28 Jun 2008 09:11:48 -0000      1.28
@@ -226,7 +226,7 @@
             printf("ERROR: potential security violation. attempt to write in 
parent dir.\n");
             exit (-1);
          }
-       f = fopen(out, "w");
+       f = fopen(out, "wb");
        if (!f)
          {
             printf("ERROR: unable to write file (%s).\n", out);
@@ -292,7 +292,7 @@
             printf("ERROR: potential security violation. attempt to write in 
parent dir.\n");
             exit (-1);
          }
-       f = fopen(out, "w");
+       f = fopen(out, "wb");
        fprintf(f, "#!/bin/sh\n");
        fprintf(f, "%s $@ -id . -fd . %s -o %s.edj\n", edje_file->compiler, 
sf->name, outdir);
        fclose(f);



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to