free(bs->array);
free(bs);
}
+
+int bs_readblock(FILE *fp, char *data, Uint32 pagesize)
+{
+ Uint32 i=0;
+
+ while ((!feof(fp)) && (i < pagesize)) {
+ data[i++] = fgetc(fp);
+ }
+
+ /* Saco un EOF que lee de mas */
+ if (i<pagesize) i--;
+
+ return i;
+}
+
*/
void bs_restore(char *dst, char *c, Uint32 k, Uint32 len);
+int bs_readblock(FILE *fp, char *data, Uint32 pagesize);
+
#endif
total = 0;
while (!feof(fp)) {
i = 0;
- while ((!feof(fp)) && (i < pagesize)) {
- data[i++] = fgetc(fp);
- total++;
- }
+ i = bs_readblock(fp, data, pagesize);
+ total += i;
- /* Saco un EOF que lee de mas */
- if (i<pagesize) i--;
/* Aplico BS guardando su resultado + el K en salida */
bs_solve(data, salida, bs, &k, i);