|
SASC
DVBSoftCAM
|
#include <stdlib.h>#include <stdio.h>#include <string.h>#include "parse.h"#include "misc.h"#include "log.h"Go to the source code of this file.
Functions | |
| static void | SortNanos (unsigned char *dest, const unsigned char *src, int len) |
| static void SortNanos | ( | unsigned char * | dest, |
| const unsigned char * | src, | ||
| int | len | ||
| ) | [static] |
Definition at line 30 of file parse.c.
References j, L_GEN_ERROR, and PRINTF.
{
int w=0, c=-1;
while(1) {
int n=0x100;
for(int j=0; j<len;) {
int l=src[j+1]+2;
if(src[j]==c) {
if(w+l>len) {
PRINTF(L_GEN_ERROR,"sortnanos: sanity check failed. Exceeding memory area. Probably corrupted nanos!");
memset(dest,0,len); // zero out everything
return;
}
memcpy(&dest[w],&src[j],l);
w+=l;
}
else if(src[j]>c && src[j]<n)
n=src[j];
j+=l;
}
if(n==0x100) break;
c=n;
}
}