changed: now we do not use std::string and char* in the Winix API

everywhere we are using std::wstring and wchar_t*
         (std::string and char* is used only locally in some places
         especially when creating a path to OS file system etc.)
added:   to the special thread when winix closes:
         a write function for curl: FetchPageOnExitCurlCallback()
         without this function the curl library will print
         the page's content to the standart output
changed: TextStream<> class from core can make
         UTF8<->wide strings conversions
removed: from config: utf8 option
         now winix expects UTF8 from the user's input (html forms, url-es)
         and outputs strings in the UTF8 format




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@965 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2014-10-09 20:44:56 +00:00
parent 4abf6642f7
commit 8196fb77d1
74 changed files with 1911 additions and 1612 deletions

View File

@@ -48,15 +48,9 @@ namespace Winix
FunctionParser::FunctionParser()
{
utf8 = false;
}
void FunctionParser::UTF8(bool use_utf8)
{
utf8 = use_utf8;
}
bool FunctionParser::Parse(Cur * pcur, Db * pdb, Functions * pfunctions, System * psystem)
{
@@ -65,11 +59,7 @@ bool FunctionParser::Parse(Cur * pcur, Db * pdb, Functions * pfunctions, System
system = psystem;
functions = pfunctions;
last_dir = 0;
path = cur->request->env_request_uri;
//!! mozna dodac sprawdzanie dlugosci path
// jesli wieksza niz np 2048 to zglosic incorrect url
// i nie parsowac
path = cur->request->env_request_uri.c_str();
ParseDirsItemFunction();
ParseParams();
@@ -225,7 +215,7 @@ void FunctionParser::ParseParams()
void FunctionParser::ParseOrdinaryParams()
{
if( *path=='?' )
if( *path == '?' )
path += 1;
do
@@ -297,7 +287,7 @@ void FunctionParser::ParseAnchor()
while( *path )
name_ascii += GetChar();
ToWide(name_ascii, cur->request->anchor);
PT::UTF8ToWide(name_ascii, cur->request->anchor);
if( !cur->request->anchor.empty() )
log << log3 << "FP: anchor: " << cur->request->anchor << logend;
@@ -354,17 +344,6 @@ return c;
}
void FunctionParser::ToWide(const std::string & src, std::wstring & dst)
{
dst.clear();
if( utf8 )
PT::UTF8ToWide(src, dst, false);
else
AssignString(src, dst, false);
}
void FunctionParser::ReadName()
{
@@ -374,7 +353,7 @@ void FunctionParser::ReadName()
while( *path && *path!='/' && *path!='?' && *path!='#' )
name_ascii += GetChar();
ToWide(name_ascii, name);
PT::UTF8ToWide(name_ascii, name);
}
@@ -385,7 +364,7 @@ void FunctionParser::ReadOrdinaryParName()
while( *path && *path!='=' && *path!='&' && *path!='#' )
name_ascii += GetChar();
ToWide(name_ascii, name);
PT::UTF8ToWide(name_ascii, name);
}
@@ -399,7 +378,7 @@ void FunctionParser::ReadOrdinaryParValue()
while( *path && *path!='&' && *path!='#' )
value_ascii += GetChar();
ToWide(value_ascii, value);
PT::UTF8ToWide(value_ascii, value);
}
@@ -410,7 +389,7 @@ void FunctionParser::ReadWinixParName()
while( *path && *path!='/' && *path!=':' && *path!='#' )
name_ascii += GetChar();
ToWide(name_ascii, name);
PT::UTF8ToWide(name_ascii, name);
}
@@ -418,13 +397,13 @@ void FunctionParser::ReadWinixParValue()
{
value_ascii.clear();
if( *path==':' )
if( *path == ':' )
path += 1;
while( *path && *path!='/' && *path!='#' )
value_ascii += GetChar();
ToWide(value_ascii, value);
PT::UTF8ToWide(value_ascii, value);
}