Enlightenment CVS committal

Author  : rephorm
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/bin


Modified Files:
        edje_cc_out.c 


Log Message:
add some validation to spectra

===================================================================
RCS file: /cvs/e/e17/libs/edje/src/bin/edje_cc_out.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -3 -r1.49 -r1.50
--- edje_cc_out.c       2 Aug 2006 10:52:44 -0000       1.49
+++ edje_cc_out.c       4 Aug 2006 08:55:05 -0000       1.50
@@ -154,22 +154,37 @@
 static void
 check_program (Edje_Part_Collection *pc, Edje_Program *ep, Eet_File *ef)
 {
-   switch (ep->action) {
+   switch (ep->action) 
+     {
       case EDJE_ACTION_TYPE_STATE_SET:
       case EDJE_ACTION_TYPE_ACTION_STOP:
       case EDJE_ACTION_TYPE_DRAG_VAL_SET:
       case EDJE_ACTION_TYPE_DRAG_VAL_STEP:
       case EDJE_ACTION_TYPE_DRAG_VAL_PAGE:
-        if (!ep->targets) {
+        if (!ep->targets) 
+          {
              fprintf(stderr, "%s: Error. collection %i: "
                    "target missing in program %s\n",
                    progname, pc->id, ep->name);
              ABORT_WRITE(ef, file_out);
-        }
+          }
         break;
       default:
         break;
-   }
+     }
+}
+
+static void
+check_spectrum (Edje_Spectrum_Directory_Entry *se, Eet_File *ef)
+{
+   if (!se->entry) 
+     fprintf(stderr, "%s: Error. Spectrum missing a name.\n", progname);
+   else if (!se->color_list)
+     fprintf(stderr, "%s: Error. Spectrum %s is empty. At least one color must 
be given.", progname, se->entry);
+   else
+     return;
+
+   ABORT_WRITE(ef, file_out);
 }
 
 void
@@ -497,6 +512,13 @@
             ABORT_WRITE(ef, file_out);
          }
      }
+   /* check that all spectra are valid */
+   for (l = edje_file->spectrum_dir->entries; l; l = l->next)
+     {
+       Edje_Spectrum_Directory_Entry *se;
+       se = l->data;
+       check_spectrum(se, ef);
+     }
    /* sanity checks for parts and programs */
    for (l = edje_collections; l; l = l->next)
      {
@@ -915,7 +937,6 @@
        
        il = spectrum_lookups->data;
 
-       printf("spectrum lookup\n");
        if (!edje_file->spectrum_dir)
          l = NULL;
        else
@@ -928,7 +949,6 @@
                  *(il->dest) = 1;
                  if ((de->entry) && (!strcmp(de->entry, il->name)))
                    {
-                      printf("found spectrum: %s (%d)\n", de->entry, de->id);
                       handle_slave_lookup(spectrum_slave_lookups, il->dest, 
de->id);
                       *(il->dest) = de->id;
                       break;



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to