Index: third_party/hunspell/src/hunspell/filemgr.cxx |
=================================================================== |
--- third_party/hunspell/src/hunspell/filemgr.cxx (revision 50428) |
+++ third_party/hunspell/src/hunspell/filemgr.cxx (working copy) |
@@ -7,6 +7,32 @@ |
#include "filemgr.hxx" |
+#ifdef HUNSPELL_CHROME_CLIENT |
+#include "third_party/hunspell/google/bdict_reader.h" |
+ |
+FileMgr::FileMgr(hunspell::LineIterator* iterator) : iterator_(iterator) { |
+} |
+ |
+FileMgr::~FileMgr() { |
+} |
+ |
+char * FileMgr::getline() { |
+ // Read one line from a BDICT file and store the line to our line buffer. |
+ // To emulate the original FileMgr::getline(), this function returns |
+ // the pointer to our line buffer if we can read a line without errors. |
+ // Otherwise, this function returns NULL. |
+ bool result = iterator_->AdvanceAndCopy(line_, BUFSIZE - 1); |
+ return result ? line_ : NULL; |
+} |
+ |
+int FileMgr::getlinenum() { |
+ // This function is used only for displaying a line number that causes a |
+ // parser error. For a BDICT file, providing a line number doesn't help |
+ // identifying the place where causes a parser error so much since it is a |
+ // binary file. So, we just return 0. |
+ return 0; |
+} |
+#else |
int FileMgr::fail(const char * err, const char * par) { |
fprintf(stderr, err, par); |
return -1; |
@@ -47,3 +73,4 @@ |
int FileMgr::getlinenum() { |
return linenum; |
} |
+#endif |