[MPlayer-dev-eng] PATCH [7/12] CoreAVC support (Take 3)

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Mar 3 18:22:49 CET 2007


Hello,
On Wed, Feb 28, 2007 at 08:29:33PM +0100, Reimar D?ffinger wrote:
> On Tue, Feb 27, 2007 at 12:43:49PM -0800, Alan Nisota wrote:
> > >007widereg.patch: adds support for Querying registry items as wide
> > >strings.  the strings are always stored as standard char strings, so it
> > >just converts back-and-forth
> 
> > Index: loader/ext.c
> > ===================================================================
> > --- loader/ext.c.orig	2007-02-15 09:42:47.000000000 -0800
> > +++ loader/ext.c	2007-02-15 09:43:25.000000000 -0800
> > @@ -570,9 +570,9 @@
> >      {
> >      for(i=0; i<srclen; i++)
> >      {
> > -	src++;
> >      	if(*src==0)
> >  	    return i+1;
> > +	src++;
> >      }
> >  	return srclen+1;
> >      }
> > @@ -581,17 +581,30 @@
> >      for(i=0; i<min(srclen, destlen); i++)
> >      {
> >  	*dest=(char)*src;
> > -	dest++;
> > -	src++;
> >  	if(*src==0)
> >  	    return i+1;
> > +	dest++;
> > +	src++;
> >      }
> >      return min(srclen, destlen);
> >  }
> 
> I intend to apply this part soon as a bugfix, since the old code does
> not make much sense to me.

I looked at the documentation and this code still looks overcomplicated
and wrong to me.
Can you test attached patch?

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: loader/ext.c
===================================================================
--- loader/ext.c	(revision 22419)
+++ loader/ext.c	(working copy)
@@ -559,33 +559,13 @@
      INT srclen,LPSTR dest, INT destlen, LPCSTR defch, WIN_BOOL* used_defch)
 {
     int i;
-    if(src==0)
-	return 0;
-    if ((srclen==-1)&&(dest==0)) return 0;
     if(srclen==-1){srclen=0; while(src[srclen++]);}
-//    for(i=0; i<srclen; i++)
-//	printf("%c", src[i]);
-//    printf("\n");
-    if(dest==0)
-    {
-    for(i=0; i<srclen; i++)
-    {
-	src++;
-    	if(*src==0)
-	    return i+1;
-    }
-	return srclen+1;
-    }
+    if(destlen==0)
+	return srclen;
     if(used_defch)
 	*used_defch=0;
     for(i=0; i<min(srclen, destlen); i++)
-    {
-	*dest=(char)*src;
-	dest++;
-	src++;
-	if(*src==0)
-	    return i+1;
-    }
+	*dest++=(char)*src++;
     return min(srclen, destlen);
 }
 INT WINAPI MultiByteToWideChar(UINT codepage,DWORD flags, LPCSTR src, INT srclen,


More information about the MPlayer-dev-eng mailing list