author | zautrix <zautrix> | 2004-10-25 15:27:39 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-25 15:27:39 (UTC) |
commit | 03ca6830a9e6742b8873aee04d77b3e094b65d30 (patch) (unidiff) | |
tree | 170ab278ffeb371aae783815101f64275cd30c53 /libkcal/versit/vcc.c | |
parent | 62e92aa86b6281b4e4c2a2bdb57f3ceb5a87f4e3 (diff) | |
download | kdepimpi-03ca6830a9e6742b8873aee04d77b3e094b65d30.zip kdepimpi-03ca6830a9e6742b8873aee04d77b3e094b65d30.tar.gz kdepimpi-03ca6830a9e6742b8873aee04d77b3e094b65d30.tar.bz2 |
fix of vcal crash
-rw-r--r-- | libkcal/versit/vcc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libkcal/versit/vcc.c b/libkcal/versit/vcc.c index 9be752d..5413813 100644 --- a/libkcal/versit/vcc.c +++ b/libkcal/versit/vcc.c | |||
@@ -1741,49 +1741,50 @@ static void lexAppendc(int c) | |||
1741 | if (lexBuf.strsLen > lexBuf.maxToken) { | 1741 | if (lexBuf.strsLen > lexBuf.maxToken) { |
1742 | /* double the token string size */ | 1742 | /* double the token string size */ |
1743 | lexBuf.maxToken <<= 1; | 1743 | lexBuf.maxToken <<= 1; |
1744 | lexBuf.strs = (char*) realloc(lexBuf.strs,(size_t)lexBuf.maxToken); | 1744 | lexBuf.strs = (char*) realloc(lexBuf.strs,(size_t)lexBuf.maxToken); |
1745 | } | 1745 | } |
1746 | } | 1746 | } |
1747 | 1747 | ||
1748 | static char* lexStr() { | 1748 | static char* lexStr() { |
1749 | return dupStr(lexBuf.strs,(size_t)lexBuf.strsLen+1); | 1749 | return dupStr(lexBuf.strs,(size_t)lexBuf.strsLen+1); |
1750 | } | 1750 | } |
1751 | 1751 | ||
1752 | static void lexSkipWhite() { | 1752 | static void lexSkipWhite() { |
1753 | int c = lexLookahead(); | 1753 | int c = lexLookahead(); |
1754 | while (c == ' ' || c == '\t') { | 1754 | while (c == ' ' || c == '\t') { |
1755 | lexSkipLookahead(); | 1755 | lexSkipLookahead(); |
1756 | c = lexLookahead(); | 1756 | c = lexLookahead(); |
1757 | } | 1757 | } |
1758 | } | 1758 | } |
1759 | 1759 | ||
1760 | static char* lexGetWord() { | 1760 | static char* lexGetWord() { |
1761 | int c; | 1761 | int c; |
1762 | lexSkipWhite(); | 1762 | lexSkipWhite(); |
1763 | lexClearToken(); | 1763 | lexClearToken(); |
1764 | c = lexLookahead(); | 1764 | c = lexLookahead(); |
1765 | while (c != EOF && !strchr("\t\n ;:=",c)) { | 1765 | // LR while (c != EOF && !strchr("\t\n ;:=",c)) { |
1766 | while (c != EOF && !strchr("\t\n;:=",c)) { | ||
1766 | lexAppendc(c); | 1767 | lexAppendc(c); |
1767 | lexSkipLookahead(); | 1768 | lexSkipLookahead(); |
1768 | c = lexLookahead(); | 1769 | c = lexLookahead(); |
1769 | } | 1770 | } |
1770 | lexAppendc(0); | 1771 | lexAppendc(0); |
1771 | return lexStr(); | 1772 | return lexStr(); |
1772 | } | 1773 | } |
1773 | 1774 | ||
1774 | static void lexPushLookaheadc(int c) { | 1775 | static void lexPushLookaheadc(int c) { |
1775 | int putptr; | 1776 | int putptr; |
1776 | /* can't putback EOF, because it never leaves lookahead buffer */ | 1777 | /* can't putback EOF, because it never leaves lookahead buffer */ |
1777 | if (c == EOF) return; | 1778 | if (c == EOF) return; |
1778 | putptr = (int)lexBuf.getPtr - 1; | 1779 | putptr = (int)lexBuf.getPtr - 1; |
1779 | if (putptr < 0) putptr += MAX_LEX_LOOKAHEAD; | 1780 | if (putptr < 0) putptr += MAX_LEX_LOOKAHEAD; |
1780 | lexBuf.getPtr = putptr; | 1781 | lexBuf.getPtr = putptr; |
1781 | lexBuf.buf[putptr] = c; | 1782 | lexBuf.buf[putptr] = c; |
1782 | lexBuf.len += 1; | 1783 | lexBuf.len += 1; |
1783 | } | 1784 | } |
1784 | 1785 | ||
1785 | static char* lexLookaheadWord() { | 1786 | static char* lexLookaheadWord() { |
1786 | /* this function can lookahead word with max size of MAX_LEX_LOOKAHEAD_0 | 1787 | /* this function can lookahead word with max size of MAX_LEX_LOOKAHEAD_0 |
1787 | / and thing bigger than that will stop the lookahead and return 0; | 1788 | / and thing bigger than that will stop the lookahead and return 0; |
1788 | / leading white spaces are not recoverable. | 1789 | / leading white spaces are not recoverable. |
1789 | */ | 1790 | */ |