On Tue, Jul 14, 2009 at 06:28:36AM +0200, Niels Kristian Bech Jensen wrote:
> 
> > Date: Sun, 12 Jul 2009 11:11:05 +0200
> > From: [email protected]
> > To: [email protected]
> > Subject: [UFRaw-Devel] loading/saving ID file with createid==only doesn't   
> > work
> > 
> > When the ID file specifies createID==only_id as in
> > 
> >     <CreateID>2</CreateID>
> > 
> > and I fire up ufraw with this ID file as argument then the save button
> > does not behave as expected: it also converts and saves the image. It
> > appears that ufraw silently decides to replace "only_id" by "also_id"
> > when read from an ID file, see around line 162 in ufraw_ufraw.c
> > 
> > >From the outside this looks like a bug because ufraw is just not doing
> > what it has been told. Is there any special reason for this "magic"
> > or can we just remove it?
> > 
> ... seems the code is needed to get ufraw-batch to save the image file when 
> given a ID file as input.

IMHO, these kind of magic decisions underneath (though it superficially
may seem a good thing to do) is not helping at all on the long term
where it will be perceived as a bug/stubborn behavior or just illogic.

Anyway, here is take 2 of the patch. Essentially it makes the old
behavior ufraw-batch specific (apparently ufraw-batch.c itself assumes
this particular behavior):


diff --git a/ufraw-batch.c b/ufraw-batch.c
index aec3942..a208698 100644
--- a/ufraw-batch.c
+++ b/ufraw-batch.c
@@ -79,6 +79,9 @@ int main (int argc, char **argv)
     for (; optInd<argc; optInd++, fileIndex++) {
        argFile = uf_win32_locale_to_utf8(argv[optInd]);
        uf = ufraw_open(argFile);
+       if (uf->conf && uf->conf->createID == only_id) {
+           uf->conf->createID = also_id;
+       }
        uf_win32_locale_free(argFile);
        if (uf==NULL) {
            exitCode = 1;
diff --git a/ufraw.h b/ufraw.h
index 0417abd..aeed445 100644
--- a/ufraw.h
+++ b/ufraw.h
@@ -149,7 +149,7 @@ typedef struct {
  * CONF|ID: curve/profile are added to the list from RC.
  * CONF: inputFilename, outputFilename are ignored.
  * outputPath can only be specified in CMD or guessed in interactive mode.
- * ID: createID==only_id is switched to also_id.
+ * ID: createID==only_id is switched to also_id in case of ufraw-batch.
  * ID: chanMul[] override wb, green, temperature.
  */
 typedef struct {
diff --git a/ufraw_ufraw.c b/ufraw_ufraw.c
index adf6852..c3fb7bf 100644
--- a/ufraw_ufraw.c
+++ b/ufraw_ufraw.c
@@ -159,7 +159,6 @@ ufraw_data *ufraw_open(char *filename)
            g_free(conf);
            return NULL;
        }
-       if (conf->createID==only_id) conf->createID = also_id;
 
        /* If inputFilename and outputFilename have the same path,
         * then inputFilename is searched for in the path of the ID file.

-- 
Frank

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
ufraw-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-devel

Reply via email to