NetSurf
Functions | Variables
fetch.c File Reference

Fetch operation implementation for win32. More...

#include <stdlib.h>
#include <string.h>
#include "utils/log.h"
#include "utils/file.h"
#include "utils/filepath.h"
#include "content/fetch.h"
#include "netsurf/fetch.h"
#include "windows/fetch.h"
#include "windows/gui.h"
Include dependency graph for fetch.c:

Go to the source code of this file.

Functions

static const char * fetch_filetype (const char *unix_path)
 determine the MIME type of a local file. More...
 
static nsurlnsw32_get_resource_url (const char *path)
 Translate resource to full win32 url. More...
 
nserror nsw32_get_resource_data (const char *path, const uint8_t **data_out, size_t *data_len_out)
 Translate resource to win32 resource data. More...
 

Variables

static struct gui_fetch_table fetch_table
 win32 fetch operation table More...
 
struct gui_fetch_tablewin32_fetch_table = &fetch_table
 win32 API fetch operation table More...
 

Detailed Description

Fetch operation implementation for win32.

Definition in file fetch.c.

Function Documentation

◆ fetch_filetype()

static const char * fetch_filetype ( const char *  unix_path)
static

determine the MIME type of a local file.

Parameters
unix_pathThe unix style path to the file.
Returns
The mime type of the file.

Definition at line 42 of file fetch.c.

References NSLOG.

◆ nsw32_get_resource_data()

nserror nsw32_get_resource_data ( const char *  path,
const uint8_t **  data_out,
size_t *  data_len_out 
)

Translate resource to win32 resource data.

Obtains the data for a resource directly

Parameters
pathThe path of the resource to locate.
dataPointer to recive data into
data_lenPointer to length of returned data
Returns
NSERROR_OK and the data and length values updated else appropriate error code.

Definition at line 90 of file fetch.c.

References NSERROR_NOT_FOUND, NSERROR_OK, and path().

Referenced by nsw32_messages_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsw32_get_resource_url()

static nsurl * nsw32_get_resource_url ( const char *  path)
static

Translate resource to full win32 url.

Transforms a resource: path into a full URL. The returned URL is used as the target for a redirect. The caller takes ownership of the returned nsurl including unrefing it when finished with it.

Parameters
pathThe path of the resource to locate.
Returns
A string containing the full URL of the target object or NULL if no suitable resource can be found.

Definition at line 77 of file fetch.c.

References filepath_sfind(), G_resource_pathv, netsurf_path_to_nsurl(), path(), and PATH_MAX.

Here is the call graph for this function:

Variable Documentation

◆ fetch_table

struct gui_fetch_table fetch_table
static
Initial value:
= {
.filetype = fetch_filetype,
.get_resource_url = nsw32_get_resource_url,
.get_resource_data = nsw32_get_resource_data,
}
const char * fetch_filetype(const char *unix_path)
filetype – determine the MIME type of a local file
Definition: fetch.c:184
static nsurl * nsw32_get_resource_url(const char *path)
Translate resource to full win32 url.
Definition: fetch.c:77
nserror nsw32_get_resource_data(const char *path, const uint8_t **data_out, size_t *data_len_out)
Translate resource to win32 resource data.
Definition: fetch.c:90

win32 fetch operation table

Definition at line 126 of file fetch.c.

◆ win32_fetch_table

struct gui_fetch_table* win32_fetch_table = &fetch_table

win32 API fetch operation table

Definition at line 133 of file fetch.c.

Referenced by WinMain().