[xiph-cvs] cvs commit: vorbis-python/src pyvorbisinfo.c

Andrew Catham Master of Python andrew at xiph.org
Sat May 31 12:41:13 PDT 2003



andrew      03/05/31 15:41:13

  Modified:    .        ChangeLog
               src      pyvorbisinfo.c
  Log:
  2003-5-31   Andrew H. Chatham <pyogg at andrewchatham.com>
          * pyvorbisinfo.c (py_comment_subscript) Applied patch from Brian
          Warner to fix a bug where I wasn't clearing the Python error
          correctly in unicode conversion.
  
          * pyvorbisinfo.c (write_comments) Applied patch from Csaba Henk to
          fix comment modification in Windows.

Revision  Changes    Path
1.22      +8 -0      vorbis-python/ChangeLog

Index: ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/vorbis-python/ChangeLog,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- ChangeLog	13 May 2003 08:29:45 -0000	1.21
+++ ChangeLog	31 May 2003 19:41:13 -0000	1.22
@@ -1,3 +1,11 @@
+2003-5-31   Andrew H. Chatham <pyogg at andrewchatham.com>
+	* pyvorbisinfo.c (py_comment_subscript) Applied patch from Brian
+	Warner to fix a bug where I wasn't clearing the Python error
+	correctly in unicode conversion.
+
+	* pyvorbisinfo.c (write_comments) Applied patch from Csaba Henk to
+	fix comment modification in Windows.
+	
 2003-5-13   Andrew H. Chatham <pyogg at andrewchatham.com>
         * pyvorbisinfo.c (py_info_new): Applied patch from 
         Andrew Mahone to allow negative quality values

<p><p>1.17      +19 -0     vorbis-python/src/pyvorbisinfo.c

Index: pyvorbisinfo.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-python/src/pyvorbisinfo.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- pyvorbisinfo.c	13 May 2003 08:29:46 -0000	1.16
+++ pyvorbisinfo.c	31 May 2003 19:41:13 -0000	1.17
@@ -423,6 +423,8 @@
 #if PY_UNICODE
     item = PyUnicode_DecodeUTF8(res, vallen, NULL);
     if (!item) {
+      /* must clear the exception raised by PyUnicode_DecodeUTF8() */
+      PyErr_Clear();
       /* To deal with non-UTF8 comments (against the standard) */
       item = PyString_FromStringAndSize(res, vallen); 
     }
@@ -1024,6 +1026,23 @@
   fclose(in_file);
   fclose(out_file);
 
+  /* The following comment, quoted from the vorbiscomment/vcomment.c file
+   * of the vorbis-tools package, regards to, e.g., Windows:
+   * 
+   * Some platforms fail to rename a file if the new name already exists, so
+   * we need to remove, then rename. How stupid.
+   * 
+   * This is why the following block had to be inserted to make things work under
+   * Windows also.
+   * 
+   * <Csaba Henk (ekho at renyi.hu)>
+   */
+  
+  if (remove(filename)) {
+    PyErr_SetFromErrno(PyExc_IOError);
+    return NULL;
+  }
+  
   if (rename(tempfile, filename)) {
     PyErr_SetFromErrno(PyExc_IOError);
     return NULL;

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list