--- parser3/src/main/pa_globals.C 2002/11/26 15:09:12 1.143 +++ parser3/src/main/pa_globals.C 2003/04/04 09:08:24 1.154 @@ -1,11 +1,11 @@ /** @file Parser: globals. - Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_GLOBALS_C="$Date: 2002/11/26 15:09:12 $"; +static const char* IDENT_GLOBALS_C="$Date: 2003/04/04 09:08:24 $"; #include "pa_config_includes.h" @@ -32,6 +32,7 @@ extern "C" { String *content_type_name; String *charset_name; String *body_name; +String *download_name; String *value_name; String *expires_name; String *path_name; @@ -40,6 +41,7 @@ String *size_name; String *text_name; String *content_disposition_name; +String *content_disposition_value; String *content_disposition_filename_name; String *conf_method_name; @@ -79,6 +81,7 @@ String *hash_default_element_name; String *http_method_name; String *http_timeout_name; String *http_headers_name; +String *http_any_status_name; String *file_status_name; @@ -256,33 +259,18 @@ xmlFileOpenLocalhost (const char *filena * Returns the number of bytes written */ static int -xmlFileRead (void * context, char * buffer, int len) { +pa_xmlFileRead (void * context, char * buffer, int len) { return(fread(&buffer[0], 1, len, (FILE *) context)); } /** - * xmlFileWrite: - * @context: the I/O context - * @buffer: where to drop data - * @len: number of bytes to write - * - * Write @len bytes from @buffer to the I/O channel. - * - * Returns the number of bytes written - */ -static int -xmlFileWrite (void * context, const char * buffer, int len) { - return(fwrite(&buffer[0], 1, len, (FILE *) context)); -} - -/** * xmlFileClose: * @context: the I/O context * * Close an I/O channel */ static int -xmlFileClose (void * context) { +pa_xmlFileClose (void * context) { return ( ( fclose((FILE *) context) == EOF ) ? -1 : 0 ); } @@ -318,6 +306,7 @@ void pa_globals_init(Pool& pool) { content_type_name=NEW String(pool, CONTENT_TYPE_NAME); charset_name=NEW String(pool, CHARSET_NAME); body_name=NEW String(pool, BODY_NAME); + download_name=NEW String(pool, DOWNLOAD_NAME); value_name=NEW String(pool, VALUE_NAME); expires_name=NEW String(pool, EXPIRES_NAME); path_name=NEW String(pool, PATH_NAME); @@ -326,6 +315,7 @@ void pa_globals_init(Pool& pool) { text_name=NEW String(pool, TEXT_NAME); content_disposition_name=NEW String(pool, CONTENT_DISPOSITION_NAME); + content_disposition_value=NEW String(pool, CONTENT_DISPOSITION_VALUE); content_disposition_filename_name=NEW String(pool, CONTENT_DISPOSITION_FILENAME_NAME); conf_method_name=NEW String(pool, CONF_METHOD_NAME); @@ -370,14 +360,16 @@ void pa_globals_init(Pool& pool) { http_method_name=NEW String(pool, HTTP_METHOD_NAME); http_timeout_name=NEW String(pool, HTTP_TIMEOUT_NAME); http_headers_name=NEW String(pool, HTTP_HEADERS_NAME); + http_any_status_name=NEW String(pool, HTTP_ANY_STATUS_NAME); file_status_name=NEW String(pool, FILE_STATUS_NAME); // hashes untaint_lang_name2enum=NEW Hash(pool); #define ULN(cstr, LANG) \ - untaint_lang_name2enum->put(*NEW String(pool, (void *)cstr), (int)String::UL_##LANG); + untaint_lang_name2enum->put(*NEW String(pool, cstr), (int)String::UL_##LANG); ULN("as-is", AS_IS); + ULN("optimized-as-is", AS_IS|String::UL_OPTIMIZE_BIT); ULN("file-spec", FILE_SPEC); ULN("http-header", HTTP_HEADER); ULN("mail-header", MAIL_HEADER); @@ -386,6 +378,7 @@ void pa_globals_init(Pool& pool) { ULN("sql", SQL); ULN("js", JS); ULN("xml", XML); + ULN("optimized-xml", XML|String::UL_OPTIMIZE_BIT); ULN("html", HTML); ULN("optimized-html", HTML|String::UL_OPTIMIZE_BIT); @@ -393,7 +386,7 @@ void pa_globals_init(Pool& pool) { exif_tag_value2name=NEW Hash(pool); #define EXIF_TAG(tag, name) \ { \ - char *buf=(char *)malloc(MAX_NUMBER); \ + char *buf=(char *)pool.malloc(MAX_NUMBER); \ snprintf(buf, MAX_NUMBER, "%u", tag); \ exif_tag_value2name->put(*NEW String(pool, buf), (void *)#name); \ } @@ -582,7 +575,7 @@ void pa_globals_init(Pool& pool) { // http://localhost/abc -> $ENV{DOCUMENT_ROOT}/abc | ./abc xmlRegisterInputCallbacks( xmlFileMatchLocalhost, xmlFileOpenLocalhost, - xmlFileRead, xmlFileClose); + pa_xmlFileRead, pa_xmlFileClose); // XSLT stylesheet manager cache_managers->put(*NEW String(pool, "stylesheet"), @@ -591,7 +584,7 @@ void pa_globals_init(Pool& pool) { } #if defined(XML) && defined(_MSC_VER) -# define GNOME_LIBS "/parser3project/win32xml/win32/gnome" +# define GNOME_LIBS "../../../../win32xml/win32/gnome" # pragma comment(lib, GNOME_LIBS "/glib/lib/libglib-1.3-11.lib") # ifdef _DEBUG # pragma comment(lib, GNOME_LIBS "/libxml2-x.x.x/win32/dsp/libxml2_so_debug/libxml2.lib")