ccscript3-1.0.9/modules/sort.cpp: some broken code
d binderman <[email protected]> Thu, 24 Dec 2009 10:29:51 +0000
| Newsgroups | gmane.comp.gnu.ccscript.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello there=2C
I just had a look at the source code of ccscript3-1.0.9/modules/sort.cpp=2C
around line 140
=A0=A0=A0=A0=A0=A0=A0 Symbol *sym =3D mapSymbol(getOption(NULL))=3B
=A0=A0=A0=A0=A0=A0=A0 size_t count =3D 0=3B
=A0=A0=A0=A0=A0=A0=A0 Array *a =3D (Array *)&sym->data=3B
=A0=A0=A0=A0=A0=A0=A0 char *base =3D sym->data + sizeof(Array)=3B
=A0=A0=A0=A0=A0=A0=A0 size_t size =3D a->rec + 1=3B
=A0=A0=A0=A0=A0=A0=A0 if(!sym)
=A0=A0=A0=A0=A0=A0=A0 {
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 error("sort-missing-symbol")=
=3B
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return true=3B
=A0=A0=A0=A0=A0=A0=A0 }
In assigning to base=2C sym is assumed to be non-NULL. Suggest new code
=A0=A0=A0=A0=A0=A0=A0 Symbol *sym =3D mapSymbol(getOption(NULL))=3B
=A0=A0=A0=A0=A0=A0=A0 if(!sym)
=A0=A0=A0=A0=A0=A0=A0 {
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 error("sort-missing-symbol")=
=3B
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return true=3B
=A0=A0=A0=A0=A0=A0=A0 }
=A0=A0=A0=A0=A0=A0=A0 size_t count =3D 0=3B
=A0=A0=A0=A0=A0=A0=A0 Array *a =3D (Array *)&sym->data=3B
=A0=A0=A0=A0=A0=A0=A0 char *base =3D sym->data + sizeof(Array)=3B
=A0=A0=A0=A0=A0=A0=A0 size_t size =3D a->rec + 1=3B
Regards
David Binderman
=20
_________________________________________________________________
Got more than one Hotmail account? Save time by linking them together
http://clk.atdmt.com/UKM/go/186394591/direct/01/=