diff options
-rw-r--r-- | src/html.cc | 25 | ||||
-rw-r--r-- | src/html_common.hh | 5 |
2 files changed, 15 insertions, 15 deletions
diff --git a/src/html.cc b/src/html.cc index 5d282209..997287ca 100644 --- a/src/html.cc +++ b/src/html.cc @@ -134,7 +134,7 @@ void DilloHtml::bugMessage(const char *format, ... ) dStr_sprintfa(bw->page_bugs, "HTML warning: line %d, ", - getCurTagLineNumber()); + getCurrLineNumber()); va_start(argp, format); dStr_vsprintfa(bw->page_bugs, format, argp); va_end(argp); @@ -397,9 +397,8 @@ DilloHtml::DilloHtml(BrowserWindow *p_bw, const DilloUrl *url, stop_parser = false; - CurrTagOfs = 0; - OldTagOfs = 0; - OldTagLine = 1; + CurrOfs = OldOfs = 0; + OldLine = 1; DocType = DT_NONE; /* assume Tag Soup 0.0! :-) */ DocTypeVersion = 0.0f; @@ -539,10 +538,10 @@ void DilloHtml::write(char *Buf, int BufSize, int Eof) } /* - * Return the line number of the tag being processed by the parser. + * Return the line number of the tag/word being processed by the parser. * Also update the offsets. */ -int DilloHtml::getCurTagLineNumber() +int DilloHtml::getCurrLineNumber() { int i, ofs, line; const char *p = Start_Buf; @@ -551,13 +550,13 @@ int DilloHtml::getCurTagLineNumber() /* Disable line counting for META hack. Buffers differ. */ dReturn_val_if((InFlags & IN_META_HACK), -1); - ofs = CurrTagOfs; - line = OldTagLine; - for (i = OldTagOfs; i < ofs; ++i) + ofs = CurrOfs; + line = OldLine; + for (i = OldOfs; i < ofs; ++i) if (p[i] == '\n' || (p[i] == '\r' && p[i+1] != '\n')) ++line; - OldTagOfs = CurrTagOfs; - OldTagLine = line; + OldOfs = CurrOfs; + OldLine = line; return line; } @@ -4251,7 +4250,7 @@ static int Html_write_raw(DilloHtml *html, char *buf, int bufsize, int Eof) buf_index = bufsize; } else { /* Tag: search end of tag (skipping over quoted strings) */ - html->CurrTagOfs = html->Start_Ofs + token_start; + html->CurrOfs = html->Start_Ofs + token_start; while ( buf_index < bufsize ) { buf_index++; @@ -4295,6 +4294,8 @@ static int Html_write_raw(DilloHtml *html, char *buf, int bufsize, int Eof) } } else { /* A Word: search for whitespace or tag open */ + html->CurrOfs = html->Start_Ofs + token_start; + while (++buf_index < bufsize) { buf_index += strcspn(buf + buf_index, " <\n\r\t\f\v"); if (buf[buf_index] == '<' && (ch = buf[buf_index + 1]) && diff --git a/src/html_common.hh b/src/html_common.hh index 147807b3..68ed0d08 100644 --- a/src/html_common.hh +++ b/src/html_common.hh @@ -156,8 +156,7 @@ public: //BUG: for now everything is public char *content_type, *charset; bool stop_parser; - size_t CurrTagOfs; - size_t OldTagOfs, OldTagLine; + size_t CurrOfs, OldOfs, OldLine; DilloHtmlDocumentType DocType; /* as given by DOCTYPE tag */ float DocTypeVersion; /* HTML or XHTML version number */ @@ -211,7 +210,7 @@ public: void bugMessage(const char *format, ... ); void connectSignals(dw::core::Widget *dw); void write(char *Buf, int BufSize, int Eof); - int getCurTagLineNumber(); + int getCurrLineNumber(); void finishParsing(int ClientKey); int formNew(DilloHtmlMethod method, const DilloUrl *action, DilloHtmlEnc enc, const char *charset); |