summaryrefslogtreecommitdiff
path: root/inc/aspell.php
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-06-11 14:10:59 +0200
committerandi <andi@splitbrain.org>2005-06-11 14:10:59 +0200
commita08eb37aafd19cb62b1d58d188547fb14b27fbb8 (patch)
tree9f26ff6ad70b85cae5c020fc7a384dec513a59fd /inc/aspell.php
parentea2eed85b6afedcf37443a4953bade0186b9aef2 (diff)
downloadrpg-a08eb37aafd19cb62b1d58d188547fb14b27fbb8.tar.gz
rpg-a08eb37aafd19cb62b1d58d188547fb14b27fbb8.tar.bz2
spellchecker: compensate for aspell error and blocking problems
Sometimes Aspell seems to output not enough blank lines to signal a line change. This patch tries to compensate for this by trying the next two lines as well. This patch also fixes a problem were reading from aspell could produce a deadlock on the socket and would cause the spellchecker to never return darcs-hash:20050611121059-9977f-c772aa52ea0e73e7b7e5537afda047fa44a22395.gz
Diffstat (limited to 'inc/aspell.php')
-rw-r--r--inc/aspell.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/inc/aspell.php b/inc/aspell.php
index 8267fb839..c0dc429bd 100644
--- a/inc/aspell.php
+++ b/inc/aspell.php
@@ -178,11 +178,14 @@ class Aspell{
foreach($data as $line){
fwrite($pipes[0],"^$line\n"); // aspell uses ^ to escape the line
fflush($pipes[0]);
+ $line = '';
do{
- $r = fgets($pipes[1],8192);
- $out .= $r;
+ $r = fread($pipes[1],1);
+ $line .= $r;
if(feof($pipes[1])) break;
- }while($r != "\n");
+ if($r == "\n") break;
+ }while($line != "\n");
+ $out .= $line;
}
fclose($pipes[0]);