Fwd: Re: libxml2 support in AbiWord


Subject: Fwd: Re: libxml2 support in AbiWord
From: Aaron Lehmann (aaronl@vitelus.com)
Date: Thu Aug 02 2001 - 19:48:43 CDT


I'm really busy ATM, so can somebody else please take a look at this?

----- Forwarded message from Alec Wolman <wolman@cs.washington.edu> -----

From: "Alec Wolman" <wolman@cs.washington.edu>
Date: Sun, 08 Jul 2001 01:38:15 -0700
To: Aaron Lehmann <aaronl@vitelus.com>
Subject: Re: libxml2 support in AbiWord

> On Mon, Jul 02, 2001 at 06:46:01PM -0700, Alec Wolman wrote:
> > Looking at the cvs log, it appears that you wrote much
> > of this code, so I thought I'd ask: do you want to fix
> > this, or do you want me to try to create a patch?
>
> A patch would be much appreciated. I'm not maintaining that code
> anymore, but I'll be glad to check in a correct fix.

Ok.

The following patch prevents AbiWord from crashing when
the preferences file is missing and AbiWord has been compiled
to use libxml2 rather than expat.

--- af/xap/xp/xap_Prefs.cpp.orig Sat Jul 7 17:43:02 2001
+++ af/xap/xp/xap_Prefs.cpp Sat Jul 7 19:35:02 2001
@@ -907,11 +907,11 @@
                 goto Cleanup;
         }
 #ifdef HAVE_LIBXML2
- else
- {
- bResult = _sax (szFilename, false);
+ bResult = _sax (szFilename, false);
+ if (!bResult) {
+ UT_DEBUGMSG(("could not open and parse preferences file.\n"));
+ goto Cleanup;
         }
- Cleanup:
 #else
         fp = fopen(szFilename, "r");
         if (!fp)
@@ -950,6 +950,7 @@
                         goto Cleanup;
                 }
         }
+#endif /* HAVE_LIBXML2 */
 
         // we succeeded in parsing the file,
         // now check for higher-level consistency.
@@ -974,7 +975,6 @@
                 UT_DEBUGMSG(("Did not find <Geometry...>\n"));
                 // Note: it's ok if we didn't find it...
         }
-#endif
 
         UT_ASSERT(m_parserState.m_szSelectedSchemeName);
         if (!setCurrentScheme(m_parserState.m_szSelectedSchemeName))
@@ -984,7 +984,9 @@
                 goto Cleanup;
         }
 
-#ifndef HAVE_LIBXML2
+#ifdef HAVE_LIBXML2
+Cleanup:
+#else
         bResult = true;
 Cleanup:
         FREEP(m_parserState.m_szSelectedSchemeName);

----- End forwarded message -----

-- 
#define m(i)(x[i]^s[i+84])<< /* I do not condone improper use of this code */
unsigned char x[5],y,s[2048];main(n){for(read(0,x,5);read(0,s,n=2048);write(1,s
,n))if(s[y=s[13]%8+20]/16%4==1){int i=m(1)17^256+m(0)8,k=m(2)0,j=m(4)17^m(3)9^k
*2-k%8^8,a=0,c=26;for(s[y]-=16;--c;j*=2)a=a*2^i&1,i=i/2^j&1<<24;for(j=127;++j<n
;c=c>y)c+=y=i^i/8^i>>4^i>>12,i=i>>8^y<<17,a^=a>>14,y=a^a*8^a<<6,a=a>>8^y<<9,k=s
[j],k="7Wo~'G_\216"[k&7]+2^"cr3sfw6v;*k+>/n."[k>>4]*2^k*257/8,s[j]=k^(k&k*2&34)
*6^c+~y;}}//Please join us in civil disobedience and distribute DeCSS(or efdtt!)



This archive was generated by hypermail 2b25 : Thu Aug 02 2001 - 19:48:53 CDT