Skip Menu |

This queue is for tickets about the Digest-Nilsimsa CPAN distribution.

Report information
The Basics
Id: 58571
Status: new
Priority: 0/
Queue: Digest-Nilsimsa

People
Owner: Nobody in particular
Requestors: JNW [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.06
Fixed in: (no value)



Subject: avoid undefined operations
modern gcc warns about code like ret +=!++ret this patch avoids that. (Hopefully correctly)
Subject: no_undef_operation.patch
--- Digest-Nilsimsa-0.06/_nilsimsa.c.orig 2002-06-13 06:15:03.000000000 +0200 +++ Digest-Nilsimsa-0.06/_nilsimsa.c 2010-06-22 01:05:21.000000000 +0200 @@ -256,7 +256,7 @@ int accbuf(unsigned char *buf,int buflen * -3 error, buf contains illegal chars (>255) */ {unsigned int chcount; - char msg[512]; + // char msg[512]; int ch,lastch[4],hflag; int illegalchars = 0; catflag = noheaderflag = 0; @@ -324,7 +324,9 @@ int accfile(FILE *file,struct nsrecord * hflag=noheaderflag; do {ch=mboxflag?defromulate(file):getc(file); if (ch>=0) + { if (hflag) + { if ((lastch[0]=='\n' && lastch[1]=='\n') ||(lastch[0]=='\r' && lastch[1]=='\r') ||(lastch[0]=='\n' && lastch[1]=='\r' && lastch[2]=='\n' && lastch[3]=='\r')) @@ -333,6 +335,7 @@ int accfile(FILE *file,struct nsrecord * } else ; + } else ; if (!hflag && ch>=0) @@ -353,6 +356,7 @@ int accfile(FILE *file,struct nsrecord * a->acc[tran3(lastch[3],lastch[2],ch,7)]++; } } + } lastch[3]=lastch[2]; lastch[2]=lastch[1]; lastch[1]=lastch[0]; @@ -476,7 +480,12 @@ int codeorfile(struct nsrecord *a,char * makecode(a); if (ret==-3) a->flag=INVALID; - ret+=!++ret; + + // he had this here: ret+=!++ret; + // I guess this was meant: + ret++; + if (!ret) ret++; + return ret; }