[Xastir] can't compile - missing CompressColormap()
Bob Nielsen
nielsen at oz.net
Mon Oct 7 17:54:27 EDT 2002
On Mon, Oct 07, 2002 at 11:37:37PM +1000, Hamish Moffatt wrote:
>
> Hi,
>
> I have an up-to-date Debian system, but xastir 1.1.0 won't compile any
> more as the function CompressColormap() called in maps.c seems to have
> disappeared. Any ideas?
>
> xastir 1.1.0 isn't in Debian 'testing' because I compiled it with
> festival support, which doesn't work on the hppa platform. I disabled
> festival for hppa in the next version (1.1.0-3) so it should appear in
> 'testing' in a couple of weeks.
>
I just did a cvs update and noticed that maps.c had changed
considerably, but xastir still compiles for me running Debian testing.
Below is the diff, in case it helps.
Bob, N7XY
2c2
< * $Id: maps.c,v 1.148 2002/10/03 23:06:46 we7u Exp $
---
> * $Id: maps.c,v 1.141 2002/09/24 23:49:22 we7u Exp $
1211d1210
< char status_text[300];
1671d1669
<
1676,1678d1673
< xastir_snprintf(status_text, sizeof(status_text), langcode ("BBARSTA039"), filenm);
< statusline(status_text,0); // Indexing ...
<
1680c1675
< index_update_ll(filenm, // Filename only
---
> index_update_ll(file, // Full filename
1767,1778d1761
< // Update the statusline for this map name
< // Check whether we're indexing or drawing the map
< if ( (destination_pixmap == INDEX_CHECK_TIMESTAMPS)
< || (destination_pixmap == INDEX_NO_TIMESTAMPS) ) {
< xastir_snprintf(status_text, sizeof(status_text), langcode ("BBARSTA039"), filenm);
< }
< else {
< xastir_snprintf(status_text, sizeof(status_text), langcode ("BBARSTA028"), filenm);
< }
< statusline(status_text,0); // Loading/Indexing ...
<
<
3973d3955
< char status_text[300];
3986,4002d3967
<
< // The map extents in the map index are checked in draw_map to
< // see whether we should draw the map at all.
<
<
< // Update the statusline for this map name
< // Check whether we're indexing or drawing the map
< if ( (destination_pixmap == INDEX_CHECK_TIMESTAMPS)
< || (destination_pixmap == INDEX_NO_TIMESTAMPS) ) {
< xastir_snprintf(status_text, sizeof(status_text), langcode ("BBARSTA039"), filenm);
< }
< else {
< xastir_snprintf(status_text, sizeof(status_text), langcode ("BBARSTA028"), filenm);
< }
< statusline(status_text,0); // Loading/Indexing ...
<
<
4517d4481
<
4523c4487
< index_update_xastir(filenm, // Filename only
---
> index_update_xastir(file, // Full filename
4554c4518
< int locate_place( Widget w, char *name_in, char *state_in, char *county_in,
---
> int locate_place( Widget w, char *name_in, char *state_in, char *county_in,
5320c5284
< index_update_xastir(filenm, // Filename only
---
> index_update_xastir(fileimg, // Full filename
5347,5357c5311,5312
<
< // Check whether we're indexing or drawing the map
< if ( (destination_pixmap == INDEX_CHECK_TIMESTAMPS)
< || (destination_pixmap == INDEX_NO_TIMESTAMPS) ) {
< xastir_snprintf(map_it, sizeof(map_it), langcode ("BBARSTA039"), filenm);
< }
< else {
< xastir_snprintf(map_it, sizeof(map_it), langcode ("BBARSTA028"), filenm);
< }
< statusline(map_it,0); // Loading/Indexing ...
<
---
> xastir_snprintf(map_it, sizeof(map_it), langcode ("BBARSTA028"), filenm);
> statusline(map_it,0); // Loading ...
5404c5359
< printf("Couldn't download the geo or Terraserver image\n");
---
> printf("Couldn't download the image\n");
5471,5472c5426,5427
< MagickWarning(exception.severity, exception.reason, exception.description);
< //printf ("MagickWarning\n");
---
> MagickError(exception.severity, exception.reason, exception.description);
> //printf ("MagickError\n");
5962d5916
<
5966d5919
<
6110c6063
< printf("Couldn't download the Tigermap image\n");
---
> printf("Couldn't download the image\n");
6114,6118d6066
<
< // For debugging the MagickError/MagickWarning segfaults.
< //system("cat /dev/null >/var/tmp/xastir_hacker_map.gif");
<
<
6125d6072
<
6128d6074
<
6149,6150c6095,6096
< MagickWarning(exception.severity, exception.reason, exception.description);
< //printf ("MagickWarning\n");
---
> MagickError(exception.severity, exception.reason, exception.description);
> //printf ("MagickError\n");
6990,7008c6936,6943
<
< // Check whether we're indexing or drawing the map
< if ( (destination_pixmap != INDEX_CHECK_TIMESTAMPS)
< && (destination_pixmap != INDEX_NO_TIMESTAMPS) ) {
<
< // We're drawing.
< if (!map_visible( south_bounding + 1000,
< north_bounding - 1000,
< west_bounding - 1000,
< east_bounding + 1000 ) ) {
< if (debug_level & 16) {
< printf ("Map not within current view.\n");
< printf ("Skipping map: %s\n", file);
< }
<
< // Map isn't inside our current view. We're done.
< // Free any memory used and return.
< //
< return; // Skip this map
---
> if (!map_visible( south_bounding + 1000,
> north_bounding - 1000,
> west_bounding - 1000,
> east_bounding + 1000 ) )
> {
> if (debug_level & 16) {
> printf ("Map not within current view.\n");
> printf ("Skipping map: %s\n", file);
7009a6945,6949
>
> /* Map isn't inside our current view. We're done.
> * Free any memory used and return.
> */
> return; /* Skip this map */
7323d7262
< printf("Did you follow the instructions for installing PROJ?\n");
7333,7334d7271
< printf("Did you follow the instructions for installing PROJ?\n");
<
7344,7345d7280
< printf("Did you follow the instructions for installing PROJ?\n");
<
7355,7356d7289
< printf("Did you follow the instructions for installing PROJ?\n");
<
7394,7396d7326
< xastir_snprintf(map_it, sizeof(map_it), langcode ("BBARSTA039"), filenm);
< statusline(map_it,0); // Indexing ...
<
7398c7328
< index_update_xastir(filenm, // Filename only
---
> index_update_xastir(file, // Full filename
7512,7520c7442,7443
< // Check whether we're indexing or drawing the map
< if ( (destination_pixmap == INDEX_CHECK_TIMESTAMPS)
< || (destination_pixmap == INDEX_NO_TIMESTAMPS) ) {
< xastir_snprintf(map_it, sizeof(map_it), langcode ("BBARSTA039"), filenm);
< }
< else {
< xastir_snprintf(map_it, sizeof(map_it), langcode ("BBARSTA028"), filenm);
< }
< statusline(map_it,0); // Loading/Indexing ...
---
> xastir_snprintf(map_it, sizeof(map_it), langcode ("BBARSTA028"), filenm);
> statusline(map_it,0); // Loading ...
8791d8713
< char status_text[300];
8863c8785
< index_update_xastir(filenm, // Filename only
---
> index_update_xastir(filename, // Full filename
8876,8888d8797
<
< // Update the statusline for this map name
< // Check whether we're indexing or drawing the map
< if ( (destination_pixmap == INDEX_CHECK_TIMESTAMPS)
< || (destination_pixmap == INDEX_NO_TIMESTAMPS) ) {
< xastir_snprintf(status_text, sizeof(status_text), langcode ("BBARSTA039"), filenm);
< }
< else {
< xastir_snprintf(status_text, sizeof(status_text), langcode ("BBARSTA028"), filenm);
< }
< statusline(status_text,0); // Loading/Indexing ...
<
<
9223a9133
> xastir_snprintf(file, sizeof(file), "%s/%s", dir, filenm);
9225,9240c9135,9136
< // Skip maps that end in .dbf or .shx
< ext = get_map_ext(filenm);
<
< if (ext == NULL)
< return;
<
< // Only crunch data on known map types, skipping all other junk
< // that might be in the map directory. draw_map() gets called
< // on every file in the map directory during auto_maps runs and
< // during map indexing.
< if ( (strcasecmp(ext,"pdb" ) != 0)
< && (strcasecmp(ext,"map" ) != 0)
< && (strcasecmp(ext,"shp" ) != 0)
< && (strcasecmp(ext,"tif" ) != 0)
< && (strcasecmp(ext,"geo" ) != 0)
< && (strcasecmp(ext,"gnis") != 0) ) {
---
> // Check map index to see if map is visible. If not, skip it.
> if (map_onscreen_index(file) == 0) {
9244,9267d9139
<
< // Check map index
< // Returns: 0 if map is _not_ visible
< // 1 if map _is_ visible
< // 2 if the map is not in the index
< i = map_onscreen_index(filenm);
<
< // Check whether we're indexing or drawing the map
< if ( (destination_pixmap == INDEX_CHECK_TIMESTAMPS)
< || (destination_pixmap == INDEX_NO_TIMESTAMPS) ) {
<
< // We're indexing maps
< if (i != 2) // We already have an index entry for this map.
< return; // Skip it.
< }
< else { // We're drawing maps
< // See if map is visible. If not, skip it.
< if (i == 0) // Map is not visible, skip it.
< return;
< }
<
<
< xastir_snprintf(file, sizeof(file), "%s/%s", dir, filenm);
<
9272a9145,9146
> ext = get_map_ext (filenm);
>
9317c9191
< //printf("calling draw_palmimage_map: %s/%s\n", dir, filenm);
---
> //printf("calling draw_palm_image_map: %s/%s\n", dir, filenm);
9483c9357
< index_update_xastir(filenm, // Filename only
---
> index_update_xastir(file, // Full filename
9500,9512c9374,9375
<
<
< // Check whether we're indexing or drawing the map
< if ( (destination_pixmap == INDEX_CHECK_TIMESTAMPS)
< || (destination_pixmap == INDEX_NO_TIMESTAMPS) ) {
< xastir_snprintf(map_it, sizeof(map_it), langcode ("BBARSTA039"), filenm);
< }
< else {
< xastir_snprintf(map_it, sizeof(map_it), langcode ("BBARSTA028"), filenm);
< }
< statusline(map_it,0); // Loading/Indexing ...
<
<
---
> xastir_snprintf(map_it, sizeof(map_it), langcode ("BBARSTA028"), filenm);
> statusline(map_it,0); // Loading ...
9986,9989c9849
< // Look for well-known non-map types. Note that this code
< // doesn't get reached for these types anymore due to the code
< // at the top that exits the function if the file extension is
< // not one of the known map types.
---
> // Look for well-known non-map types:
10358c10218,10226
< // List pointer for the map index linked list.
---
> // Struct and list pointers for the map index linked list.
> typedef struct _map_index_record{
> char filename[400];
> unsigned long bottom;
> unsigned long top;
> unsigned long left;
> unsigned long right;
> struct _map_index_record *next;
> } map_index_record;
10374c10242
< // considerations. Records are inserted in alphanumerical order.
---
> // considerations.
10382,10383d10249
< map_index_record *previous = map_index_head;
< map_index_record *temp_record = map_index_head;
10387c10253
< //printf( "File Index: %s: (%lu,%lu)\n\t(%lu,%lu)\n",
---
> //printf( "File Index: %s: (%15.10g,%15.10g)\n\t(%15.10g,%15.10g)\n",
10393,10401d10258
< // Skip dbf and shx map extensions. Really should make this
< // case-independent...
< if ( strstr(filename,"shx")
< || strstr(filename,"dbf")
< || strstr(filename,"SHX")
< || strstr(filename,"DBF")) {
< return;
< }
<
10404d10260
< int test;
10408,10409c10264
< test = strcmp(current->filename,filename);
< if (test == 0) {
---
> if (strcmp(current->filename,filename) == 0) {
10412d10266
< temp_record = current;
10415,10442c10269
< else if (test > 0) { // Found a string past us in the
< // alphabet. Insert ahead of this
< // last record.
<
< //printf("\n%s\n%s\n",current->filename,filename);
<
< //printf("Not Found: Inserting an index record for %s\n",filename);
< temp_record = (map_index_record *)malloc(sizeof(map_index_record));
<
< if (previous == current) { // Start of list!
< // Insert new record at head of list
< temp_record->next = map_index_head;
< map_index_head = temp_record;
< //printf("Inserting at head of list\n");
< }
< else {
< // Insert new record before "current"
< previous->next = temp_record;
< temp_record->next = current;
< //printf("Inserting before current\n");
< }
< //printf("Adding:%d:%s\n",strlen(filename),filename);
<
< //current = current->next;
< done++;
< }
< else { // Haven't gotten to the correct insertion point yet
< previous = current; // Save ptr to last record
---
> else {
10448c10275
< // record to the end of the list
---
> // record to the head of the list
10450,10461c10277,10279
< temp_record = (map_index_record *)malloc(sizeof(map_index_record));
< temp_record->next = NULL;
<
< if (previous == NULL) { // Empty list
< map_index_head = temp_record;
< //printf("First record in new list\n");
< }
< else { // Else at end of list
< previous->next = temp_record;
< //printf("Adding to end of list: %s\n",filename);
< }
<
---
> current = (map_index_record *)malloc(sizeof(map_index_record));
> current->next = map_index_head;
> map_index_head = current;
10468,10475c10286,10293
< strncpy(temp_record->filename,filename,399);
< temp_record->filename[399] = '\0';
< // xastir_snprintf(temp_record->filename,strlen(temp_record->filename),"%s",filename);
<
< temp_record->bottom = bottom;
< temp_record->top = top;
< temp_record->left = left;
< temp_record->right = right;
---
> strncpy(current->filename,filename,399);
> current->filename[399] = '\0';
> // xastir_snprintf(current->filename,strlen(current->filename),"%s",filename);
>
> current->bottom = bottom;
> current->top = top;
> current->left = left;
> current->right = right;
10485,10486c10303
< // coordinates for storage due to speed considerations. Records are
< // inserted in alphanumerical order.
---
> // coordinates for storage due to speed considerations.
10494,10495d10310
< map_index_record *previous = map_index_head;
< map_index_record *temp_record = map_index_head;
10507,10515d10321
< // Skip dbf and shx map extensions. Really should make this
< // case-independent...
< if ( strstr(filename,"shx")
< || strstr(filename,"dbf")
< || strstr(filename,"SHX")
< || strstr(filename,"DBF")) {
< return;
< }
<
10518d10323
< int test;
10522,10524c10327
< test = strcmp(current->filename,filename);
<
< if (test == 0) {
---
> if (strcmp(current->filename,filename) == 0) {
10527d10329
< temp_record = current;
10530,10558c10332
<
< else if (test > 0) {
< // Found a string past us in the alphabet. Insert ahead
< // of this last record.
<
< //printf("\n%s\n%s\n",current->filename,filename);
<
< //printf("Not Found: Inserting an index record for %s\n",filename);
< temp_record = (map_index_record *)malloc(sizeof(map_index_record));
<
< if (previous == current) { // Start of list!
< // Insert new record at head of list
< temp_record->next = map_index_head;
< map_index_head = temp_record;
< //printf("Inserting at head of list\n");
< }
< else {
< // Insert new record before "current"
< previous->next = temp_record;
< temp_record->next = current;
< //printf("Inserting before current\n");
< }
< //printf("Adding:%d:%s\n",strlen(filename),filename);
<
< //current = current->next;
< done++;
< }
< else { // Haven't gotten to the correct insertion point yet
< previous = current; // Save ptr to last record
---
> else {
10563,10566c10337,10338
< if (!done) { // Matching record not found, didn't find alpha
< // chars after our string either, add record to
< // the end of the list.
<
---
> if (!done) { // Matching record not found, add a
> // record to the head of the list
10568,10580c10340,10342
< temp_record = (map_index_record *)malloc(sizeof(map_index_record));
< temp_record->next = NULL;
<
< if (previous == NULL) { // Empty list
< map_index_head = temp_record;
< //printf("First record in new list\n");
< }
< else { // Else at end of list
< previous->next = temp_record;
< //printf("Adding to end of list: %s\n",filename);
< }
<
< //printf("Adding:%d:%s\n",strlen(filename),filename);
---
> current = (map_index_record *)malloc(sizeof(map_index_record));
> current->next = map_index_head;
> map_index_head = current;
10586,10588c10348,10350
< strncpy(temp_record->filename,filename,399);
< temp_record->filename[399] = '\0';
< // xastir_snprintf(temp_record->filename,strlen(temp_record->filename),"%s",filename);
---
> strncpy(current->filename,filename,399);
> current->filename[399] = '\0';
> // xastir_snprintf(current->filename,strlen(current->filename),"%s",filename);
10604,10607c10366,10369
< temp_record->bottom = temp_bottom;
< temp_record->top = temp_top;
< temp_record->left = temp_left;
< temp_record->right = temp_right;
---
> current->bottom = temp_bottom;
> current->top = temp_top;
> current->left = temp_left;
> current->right = temp_right;
10629,10633d10390
< //WE7U
< // Note that since we've alphanumerically ordered the list, we can
< // stop when we hit something after this filename in the alphabet.
< // It'll speed things up a bit. Make this change sometime soon.
< //
10666,10667d10422
< // Keeps the same order as the memory linked list.
< //
10694c10449
< "%010lu,%010lu,%010lu,%010lu,%s\n",
---
> "%ld,%ld,%ld,%ld,%s\n",
10718,10719c10473
< // map_index_head pointer. The memory linked list keeps the same
< // order as the entries in the file.
---
> // map_index_head pointer.
10724d10477
< map_index_record *temp_record;
10730,10732d10482
< map_index_head = NULL; // Starting with empty list
< current = NULL;
<
10741,10742c10491
<
< if (strlen(in_string) >= 8) { // We have some data
---
> if (strlen(in_string) >= 8) {
10746,10758c10495,10498
< temp_record = (map_index_record *)malloc(sizeof(map_index_record));
< temp_record->next = NULL;
<
< if (current == NULL) { // Empty list
< map_index_head = temp_record;
< current = temp_record;
< }
< else {
< current->next = temp_record;
< current = temp_record;
< }
<
< // Fill in the values
---
> current = (map_index_record *)malloc(sizeof(map_index_record));
> current->next = map_index_head;
> map_index_head = current;
>
10760,10767c10500,10505
< "%lu,%lu,%lu,%lu,%400c",
< &temp_record->bottom,
< &temp_record->top,
< &temp_record->left,
< &temp_record->right,
< temp_record->filename);
<
< temp_record->filename[399] = '\0';
---
> "%ld,%ld,%ld,%ld,%400c",
> ¤t->bottom,
> ¤t->top,
> ¤t->left,
> ¤t->right,
> current->filename);
10769c10507
< // Link the new record to the end of the list
---
> current->filename[399] = '\0';
10771c10509
< //printf("Restored: %s\n",temp_record->filename);
---
> //printf("Restored: %s\n",current->filename);
11022,11026c10760,10761
< * NEW: Uses the in-memory map_index to scan through the
< * maps.
< *
< * OLD: Recurses through the map directories looking for
< * maps to load.
---
> * Recurses through the map directories looking for maps
> * to load.
11029,11060c10764
< map_index_record *current = map_index_head;
<
<
< // Run through the entire map_index linked list
< while (current != NULL) {
<
< // I included GNIS here at this time because the files are
< // very large (at least for a state-wide file), and they
< // take a long time to load. They're obviously not a raster
< // format file.
< if (auto_maps_skip_raster
< && ( strstr(current->filename,"geo")
< || strstr(current->filename,"GEO")
< || strstr(current->filename,"tif")
< || strstr(current->filename,"TIF")
< || strstr(current->filename,"gnis")
< || strstr(current->filename,"GNIS") ) ) {
< // Skip this map
< }
< else { // Draw this map
<
< //printf("Loading: %s/%s\n",SELECTED_MAP_DIR,current->filename);
<
< draw_map (w,
< SELECTED_MAP_DIR,
< current->filename,
< NULL,
< '\0',
< DRAW_TO_PIXMAP);
< }
< current = current->next;
< }
---
> map_search (w, dir, NULL, NULL, (int)TRUE, DRAW_TO_PIXMAP);
More information about the Xastir
mailing list