return 1;
}
+void
+cache_flush(struct cache *cache, void *id)
+{
+ struct cache_entry *entry=g_hash_table_lookup(cache->hash, id);
+ if (entry)
+ cache_remove(cache, entry);
+}
+
void *
cache_lookup(struct cache *cache, void *id) {
void *cache_lookup(struct cache *cache, void *id);
void cache_insert(struct cache *cache, void *data);
void *cache_insert_new(struct cache *cache, void *id, int size);
+void cache_flush(struct cache *cache, void *id);
void cache_dump(struct cache *cache);
/* end of prototypes */
return file;
}
+struct file *
+file_create_url(char *url)
+{
+ struct file *file= g_new0(struct file,1);
+ char *cmd=g_strdup_printf("curl %s",url);
+ file->name = g_strdup(url);
+ file->stdfile=popen(cmd,"r");
+ file->fd=fileno(file->stdfile);
+ file->special=1;
+ g_free(cmd);
+ return file;
+}
+
int file_is_dir(char *name)
{
struct stat buf;
}
-int
+long long
file_size(struct file *file)
{
return file->size;
}
int
+file_data_write(struct file *file, long long offset, int size, unsigned char *data)
+{
+ if (file_cache) {
+ struct file_cache_id id={offset,size,file->name_id,0};
+ cache_flush(file_cache,&id);
+ }
+ lseek(file->fd, offset, SEEK_SET);
+ if (write(file->fd, data, size) != size)
+ return 0;
+ return 1;
+}
+
+int
file_get_contents(char *name, unsigned char **buffer, int *size)
{
struct file *file;
#include <time.h>
#endif
#include "param.h"
+#include <stdio.h>
struct file {
struct file *next;
long map_file;
#endif
char *name;
+ FILE *stdfile;
+ int special;
};
/* prototypes */
struct param_list;
struct file *file_create(char *name);
int file_is_dir(char *name);
-int file_size(struct file *file);
+long long file_size(struct file *file);
int file_mkdir(char *name, int pflag);
int file_mmap(struct file *file);
unsigned char *file_data_read(struct file *file, long long offset, int size);
unsigned char *file_data_read_all(struct file *file);
+int file_data_write(struct file *file, long long offset, int size, unsigned char *data);
int file_get_contents(char *name, unsigned char **buffer, int *size);
unsigned char *file_data_read_compressed(struct file *file, long long offset, int size, int size_uncomp);
void file_data_free(struct file *file, unsigned char *data);
struct map_priv *m=mr->m;
struct file *f=m->fi;
struct tile t;
- struct zip_cd *cd=(struct zip_cd *)(file_data_read(f, m->eoc->zipeofst + zipfile*m->cde_size, sizeof(struct zip_cd)));
+ struct zip_cd *cd=(struct zip_cd *)(file_data_read(f, m->eoc->zipeofst + zipfile*m->cde_size, m->cde_size));
cd_to_cpu(cd);
+ if (!cd->zipcunc) {
+ char tilename[cd->zipcfnl+1];
+ struct zip_cd *cd_copy=g_malloc(m->cde_size);
+ memcpy(cd_copy, cd, m->cde_size);
+ file_data_free(f, (unsigned char *)cd);
+ cd=NULL;
+ strncpy(tilename,(char *)(cd_copy+1),cd_copy->zipcfnl);
+ tilename[cd_copy->zipcfnl]='\0';
+ dbg(0,"encountered missing tile %s, downloading at %Ld\n",tilename,file_size(m->file));
+ g_free(cd_copy);
+
+ }
dbg(1,"enter %p %d\n", mr, zipfile);
#ifdef DEBUG_SIZE
mr->size+=cd->zipcunc;
--- /dev/null
+<?xml version="1.0"?>
+<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <xsl:template match="/config/navit">
+ <xsl:copy><xsl:copy-of select="@*"/><xsl:attribute name="drag_bitmap">yes</xsl:attribute><xsl:apply-templates/></xsl:copy>
+ </xsl:template>
+</xsl:transform>
--- /dev/null
+<?xml version="1.0"?>
+<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <xsl:output method="xml" doctype-system="navit.dtd" />
+ <xsl:include href="gui_internal.xslt"/>
+ <xsl:include href="navit_drag_bitmap.xslt"/>
+ <xsl:include href="osd_enable_zoom.xslt"/>
+ <xsl:template match="@*|node()"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template>
+</xsl:transform>
--- /dev/null
+<?xml version="1.0"?>
+<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <xsl:template match="/config/navit/osd[@type='button'][@command='zoom_in()' or @command='zoom_out()']">
+ <xsl:copy><xsl:copy-of select="@*"/><xsl:attribute name="enabled">yes</xsl:attribute><xsl:apply-templates/></xsl:copy>
+ </xsl:template>
+</xsl:transform>