ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CV/CV.xs
(Generate patch)

Comparing CV/CV.xs (file contents):
Revision 1.10 by root, Tue Feb 8 10:34:19 2005 UTC vs.
Revision 1.11 by root, Tue Feb 8 10:43:44 2005 UTC

251 av = (AV *) SvRV (ar); 251 av = (AV *) SvRV (ar);
252 result = newAV (); 252 result = newAV ();
253 253
254 for (i = 0; i <= av_len (av); ++i) 254 for (i = 0; i <= av_len (av); ++i)
255 { 255 {
256 int bigst = 1; 256 int bigst, j;
257 int j = 0;
258 SV *sv = *av_fetch (av, i, 1); 257 SV *sv = *av_fetch (av, i, 1);
259 STRLEN len; 258 STRLEN len;
260 char *buf = SvPVbyte (sv, len); 259 char *buf = SvPVbyte (sv, len);
260
261 int tmphist[256]; 261 int tmphist[256];
262 char *hist; 262 char *hist;
263 263
264 SV *histsv = newSV (257);//("", 0); 264 SV *histsv = newSV (257);
265 sv_upgrade (histsv, SVt_PV); 265 sv_upgrade (histsv, SVt_PV);
266 SvCUR_set (histsv, 256); 266 SvCUR_set (histsv, 256);
267 hist = SvPV_nolen (histsv); 267 hist = SvPV_nolen (histsv);
268 268
269 Zero (tmphist, 256, int); 269 Zero (tmphist, 256, int);
270 270
271 while (len--) 271 while (len--)
272 ++tmphist[*buf++]; 272 ++tmphist[(unsigned char)*buf++];
273 273
274 bigst = 1;
274 for (j = 0; j < 256; ++j) 275 for (j = 0; j < 256; ++j)
275 if (tmphist[j] > bigst) 276 if (tmphist[j] > bigst)
276 bigst = tmphist[j]; 277 bigst = tmphist[j];
277 278
278 for (j = 0; j < 256; ++j) 279 for (j = 0; j < 256; ++j)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines