|
|
|
@ -480,7 +480,7 @@ static char maps_line[MAP_SEARCHLINE_LEN*4];
|
|
|
|
* parameter: pos - entry position inside file
|
|
|
|
* parameter: pos - entry position inside file
|
|
|
|
* data - destination of found data
|
|
|
|
* data - destination of found data
|
|
|
|
* size - size of data block
|
|
|
|
* size - size of data block
|
|
|
|
* return: next position to read data.
|
|
|
|
* return: final start of current data block
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
unsigned long int maps_readpos (unsigned long int pos, struct map_search_data *data, int *size) {
|
|
|
|
unsigned long int maps_readpos (unsigned long int pos, struct map_search_data *data, int *size) {
|
|
|
|
size_t realpos;
|
|
|
|
size_t realpos;
|
|
|
|
@ -505,7 +505,7 @@ unsigned long int maps_readpos (unsigned long int pos, struct map_search_data *d
|
|
|
|
d_printf ("maps_readpos: found no start. pos:%ld realpos:%lld", pos, realpos);
|
|
|
|
d_printf ("maps_readpos: found no start. pos:%ld realpos:%lld", pos, realpos);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
d_printf ("start:%d", start);
|
|
|
|
// d_printf ("start:%d", start);
|
|
|
|
|
|
|
|
|
|
|
|
/* search where the current line ends */
|
|
|
|
/* search where the current line ends */
|
|
|
|
for (end = start; end < readsize && maps_line[end] != '\n'; end++);
|
|
|
|
for (end = start; end < readsize && maps_line[end] != '\n'; end++);
|
|
|
|
@ -517,12 +517,12 @@ unsigned long int maps_readpos (unsigned long int pos, struct map_search_data *d
|
|
|
|
*data = map_search_line2data (maps_line+start);
|
|
|
|
*data = map_search_line2data (maps_line+start);
|
|
|
|
*size = end-start;
|
|
|
|
*size = end-start;
|
|
|
|
|
|
|
|
|
|
|
|
return realpos+start;
|
|
|
|
return start;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int map_search (char *name, struct map_search_data *data, int datasize) {
|
|
|
|
int map_search (char *name, struct map_search_data *data, int datasize) {
|
|
|
|
size_t blocksize, blockstart;
|
|
|
|
uint64_t blocksize, blockstart;
|
|
|
|
struct stat buf;
|
|
|
|
struct stat buf;
|
|
|
|
int i, j, cmpres, k;
|
|
|
|
int i, j, cmpres, k;
|
|
|
|
|
|
|
|
|
|
|
|
@ -541,9 +541,9 @@ int map_search (char *name, struct map_search_data *data, int datasize) {
|
|
|
|
d_printf ("map_search something went wrong. i < 0 name:%s", name);
|
|
|
|
d_printf ("map_search something went wrong. i < 0 name:%s", name);
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
d_printf ("search blocksize:%lld blockstart:%lld i:%d j:%d", blocksize, blockstart, i, j);
|
|
|
|
d_printf ("search blocksize:%lld blockstart:%lld i:%d j:%d", blocksize, blockstart, i, j, data->name);
|
|
|
|
|
|
|
|
d_printf ("compare: '%s' with '%s'", name, data->name);
|
|
|
|
if ((cmpres = strcasecmp (name, data->name)) > 0) {
|
|
|
|
if ((cmpres = strncasecmp (name, data->name, strlen (name)))> 0) {
|
|
|
|
/* name is lager than data */
|
|
|
|
/* name is lager than data */
|
|
|
|
blocksize = blocksize - ((i+j) - blockstart);
|
|
|
|
blocksize = blocksize - ((i+j) - blockstart);
|
|
|
|
blockstart = i+j;
|
|
|
|
blockstart = i+j;
|
|
|
|
@ -552,9 +552,10 @@ int map_search (char *name, struct map_search_data *data, int datasize) {
|
|
|
|
/* name is smaller than data */
|
|
|
|
/* name is smaller than data */
|
|
|
|
blocksize = i - blockstart;
|
|
|
|
blocksize = i - blockstart;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
d_printf ("cmpres: %d", cmpres);
|
|
|
|
} while (cmpres != 0 && blocksize > MAP_SEARCHLINE_LEN*2);
|
|
|
|
} while (cmpres != 0 && blocksize > MAP_SEARCHLINE_LEN*2);
|
|
|
|
|
|
|
|
|
|
|
|
d_printf ("found blockstart:%lld datasize:%d, i:%d", blockstart, datasize, i);
|
|
|
|
d_printf ("found blockstart:%lld datasize:%d, i:%d text:'%-12s'", blockstart, datasize, i, data->name);
|
|
|
|
blockstart = i-MAP_SEARCHLINE_LEN;
|
|
|
|
blockstart = i-MAP_SEARCHLINE_LEN;
|
|
|
|
if (blockstart < 0) blockstart = 0;
|
|
|
|
if (blockstart < 0) blockstart = 0;
|
|
|
|
for (i = 0, k = 0; i < datasize*2 && k < datasize; i++) {
|
|
|
|
for (i = 0, k = 0; i < datasize*2 && k < datasize; i++) {
|
|
|
|
|