+// ListParser::VersionHash - Compute a unique hash for this version /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+unsigned short debListParser::VersionHash()
+{
+ const char *Sections[] ={"Installed-Size",
+ "Depends",
+ "Pre-Depends",
+// "Suggests",
+// "Recommends",
+ "Conflicts",
+ "Replaces",0};
+ unsigned long Result = INIT_FCS;
+ char S[1024];
+ for (const char **I = Sections; *I != 0; I++)
+ {
+ const char *Start;
+ const char *End;
+ if (Section.Find(*I,Start,End) == false || End - Start >= (signed)sizeof(S))
+ continue;
+
+ /* Strip out any spaces from the text, this undoes dpkgs reformatting
+ of certain fields. dpkg also has the rather interesting notion of
+ reformatting depends operators < -> <= */
+ char *I = S;
+ for (; Start != End; Start++)
+ {
+ if (isspace(*Start) == 0)
+ *I++ = tolower(*Start);
+ if (*Start == '<' && Start[1] != '<' && Start[1] != '=')
+ *I++ = '=';
+ if (*Start == '>' && Start[1] != '>' && Start[1] != '=')
+ *I++ = '=';
+ }
+
+ Result = AddCRC16(Result,S,I - S);
+ }
+
+ return Result;
+}
+ /*}}}*/