예제 #1
0
파일: http.c 프로젝트: LiuFeiChen/olivehc
static int http_parse_connection(ohc_request_t *r, char *p, ssize_t len)
{
	if(strncmp(p, "close", 5) == 0) {
		r->keepalive = 0;
	}
	return OHC_OK;
}

#define GENERAL_HEADERS \
	{STRING_INIT("Host:"), http_parse_host}, \
	{STRING_INIT("OHC-Key:"),  http_parse_ohc_key}, \
	{STRING_INIT("Connection:"),  http_parse_connection}, \
	{STRING_INIT(""),  NULL}, 

static struct http_header_s http_request_header_get[] = {
	{STRING_INIT("Range:"), http_parse_get_range},
	GENERAL_HEADERS
};

static struct http_header_s http_request_header_put[] = {
	{STRING_INIT("Content-Length:"), http_parse_put_content_length},
	{STRING_INIT("Cache-Control:"), http_parse_put_cache_control},
	{STRING_INIT("Expires"), http_parse_put_expires},
	GENERAL_HEADERS
};

static struct http_header_s http_request_header_delete[] = {
	GENERAL_HEADERS
};

static void http_add_put_headers(ohc_request_t *r, char *base, ssize_t len)
예제 #2
0
파일: ui_i18n.c 프로젝트: Chuongv/uTox
#endif
#ifdef LANG_PRIORITY
  #error "LANG_PRIORITY is already defined"
#endif

/***** Parsing localized strings *****/

#define msgid(x) curr_id = (STR_##x);
#define msgstr(x) \
    localized_strings[_LANG_ID][curr_id].str = (uint8_t*)(x); \
    localized_strings[_LANG_ID][curr_id].length = sizeof(x) - 1;
#define LANG_WINDOWS_ID(x)
#define LANG_POSIX_LOCALE(x)
#define LANG_PRIORITY(x)

static STRING canary = STRING_INIT("BUG. PLEASE REPORT.");

static void init_strings(STRING (*localized_strings)[NUM_STRS]) {
    UI_LANG_ID i;
    UI_STRING_ID j;

    for(i = 0; i < NUM_LANGS; i++) {
        for(j = 0; j < NUM_STRS; j++) {
            localized_strings[i][j] = canary;
        }
    }

    UI_STRING_ID curr_id = 0;

#include "ui_i18n.h"