You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/05/02 01:50:38 UTC

[lucy-commits] svn commit: r1098445 [15/23] - in /incubator/lucy/trunk: charmonizer/ charmonizer/src/Charmonizer/ charmonizer/src/Charmonizer/Core/ charmonizer/src/Charmonizer/Probe/ charmonizer/src/Charmonizer/Test/ clownfish/lib/ clownfish/lib/Clownfish/Binding/ cl...

Modified: incubator/lucy/trunk/core/Lucy/Search/TermQuery.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/TermQuery.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/TermQuery.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Search/TermQuery.cfh Sun May  1 23:50:24 2011
@@ -23,7 +23,7 @@ parcel Lucy;
  * individual terms in a specific field.
  */
 
-class Lucy::Search::TermQuery inherits Lucy::Search::Query 
+class Lucy::Search::TermQuery inherits Lucy::Search::Query
     : dumpable {
 
     CharBuf *field;
@@ -78,7 +78,7 @@ class Lucy::Search::TermCompiler inherit
     new(Query *parent, Searcher *searcher, float boost);
 
     inert TermCompiler*
-    init(TermCompiler *self, Query *parent, Searcher *searcher, 
+    init(TermCompiler *self, Query *parent, Searcher *searcher,
          float boost);
 
     public incremented nullable Matcher*
@@ -94,7 +94,7 @@ class Lucy::Search::TermCompiler inherit
     Apply_Norm_Factor(TermCompiler *self, float factor);
 
     public incremented VArray*
-    Highlight_Spans(TermCompiler *self, Searcher *searcher, 
+    Highlight_Spans(TermCompiler *self, Searcher *searcher,
                     DocVector *doc_vec, const CharBuf *field);
 
     public bool_t

Modified: incubator/lucy/trunk/core/Lucy/Search/TopDocs.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Search/TopDocs.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Search/TopDocs.c (original)
+++ incubator/lucy/trunk/core/Lucy/Search/TopDocs.c Sun May  1 23:50:24 2011
@@ -26,37 +26,32 @@
 #include "Lucy/Store/OutStream.h"
 
 TopDocs*
-TopDocs_new(VArray *match_docs, uint32_t total_hits)
-{
+TopDocs_new(VArray *match_docs, uint32_t total_hits) {
     TopDocs *self = (TopDocs*)VTable_Make_Obj(TOPDOCS);
     return TopDocs_init(self, match_docs, total_hits);
 }
 
 TopDocs*
-TopDocs_init(TopDocs *self, VArray *match_docs, uint32_t total_hits)
-{
+TopDocs_init(TopDocs *self, VArray *match_docs, uint32_t total_hits) {
     self->match_docs = (VArray*)INCREF(match_docs);
     self->total_hits = total_hits;
     return self;
 }
 
 void
-TopDocs_destroy(TopDocs *self)
-{
+TopDocs_destroy(TopDocs *self) {
     DECREF(self->match_docs);
     SUPER_DESTROY(self, TOPDOCS);
 }
 
 void
-TopDocs_serialize(TopDocs *self, OutStream *outstream)
-{
+TopDocs_serialize(TopDocs *self, OutStream *outstream) {
     VA_Serialize(self->match_docs, outstream);
     OutStream_Write_C32(outstream, self->total_hits);
 }
 
 TopDocs*
-TopDocs_deserialize(TopDocs *self, InStream *instream)
-{
+TopDocs_deserialize(TopDocs *self, InStream *instream) {
     self = self ? self : (TopDocs*)VTable_Make_Obj(TOPDOCS);
     self->match_docs = VA_deserialize(NULL, instream);
     self->total_hits = InStream_Read_C32(instream);
@@ -64,18 +59,23 @@ TopDocs_deserialize(TopDocs *self, InStr
 }
 
 VArray*
-TopDocs_get_match_docs(TopDocs *self) { return self->match_docs; }
+TopDocs_get_match_docs(TopDocs *self) {
+    return self->match_docs;
+}
+
 uint32_t
-TopDocs_get_total_hits(TopDocs *self) { return self->total_hits; }
+TopDocs_get_total_hits(TopDocs *self) {
+    return self->total_hits;
+}
 
 void
-TopDocs_set_match_docs(TopDocs *self, VArray *match_docs)
-{
+TopDocs_set_match_docs(TopDocs *self, VArray *match_docs) {
     DECREF(self->match_docs);
     self->match_docs = (VArray*)INCREF(match_docs);
 }
 void
-TopDocs_set_total_hits(TopDocs *self, uint32_t total_hits) 
-    { self->total_hits = total_hits; }
+TopDocs_set_total_hits(TopDocs *self, uint32_t total_hits) {
+    self->total_hits = total_hits;
+}
 
 

Modified: incubator/lucy/trunk/core/Lucy/Store/CompoundFileReader.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/CompoundFileReader.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/CompoundFileReader.c (original)
+++ incubator/lucy/trunk/core/Lucy/Store/CompoundFileReader.c Sun May  1 23:50:24 2011
@@ -27,16 +27,14 @@
 #include "Lucy/Util/StringHelper.h"
 
 CompoundFileReader*
-CFReader_open(Folder *folder)
-{
-    CompoundFileReader *self 
+CFReader_open(Folder *folder) {
+    CompoundFileReader *self
         = (CompoundFileReader*)VTable_Make_Obj(COMPOUNDFILEREADER);
     return CFReader_do_open(self, folder);
 }
 
 CompoundFileReader*
-CFReader_do_open(CompoundFileReader *self, Folder *folder)
-{
+CFReader_do_open(CompoundFileReader *self, Folder *folder) {
     CharBuf *cfmeta_file = (CharBuf*)ZCB_WRAP_STR("cfmeta.json", 11);
     Hash *metadata = (Hash*)Json_slurp_json((Folder*)folder, cfmeta_file);
     Err *error = NULL;
@@ -46,25 +44,24 @@ CFReader_do_open(CompoundFileReader *sel
     // Parse metadata file.
     if (!metadata || !Hash_Is_A(metadata, HASH)) {
         error = Err_new(CB_newf("Can't read '%o' in '%o'", cfmeta_file,
-            Folder_Get_Path(folder)));
+                                Folder_Get_Path(folder)));
     }
     else {
         Obj *format = Hash_Fetch_Str(metadata, "format", 6);
         self->format = format ? (int32_t)Obj_To_I64(format) : 0;
         self->records = (Hash*)INCREF(Hash_Fetch_Str(metadata, "files", 5));
-        if (self->format < 1) { 
-            error = Err_new(CB_newf(
-                "Corrupt %o file: Missing or invalid 'format'", 
-                cfmeta_file)); 
+        if (self->format < 1) {
+            error = Err_new(CB_newf("Corrupt %o file: Missing or invalid 'format'",
+                                    cfmeta_file));
         }
         else if (self->format > CFWriter_current_file_format) {
             error = Err_new(CB_newf("Unsupported compound file format: %i32 "
-                "(current = %i32", self->format, 
-                CFWriter_current_file_format));
+                                    "(current = %i32", self->format,
+                                    CFWriter_current_file_format));
         }
         else if (!self->records) {
             error = Err_new(CB_newf("Corrupt %o file: missing 'files' key",
-                cfmeta_file));
+                                    cfmeta_file));
         }
     }
     DECREF(metadata);
@@ -77,7 +74,7 @@ CFReader_do_open(CompoundFileReader *sel
     // Open an instream which we'll clone over and over.
     CharBuf *cf_file = (CharBuf*)ZCB_WRAP_STR("cf.dat", 6);
     self->instream = Folder_Open_In(folder, cf_file);
-    if(!self->instream) {
+    if (!self->instream) {
         ERR_ADD_FRAME(Err_get_error());
         DECREF(self);
         return NULL;
@@ -111,8 +108,7 @@ CFReader_do_open(CompoundFileReader *sel
 }
 
 void
-CFReader_destroy(CompoundFileReader *self)
-{
+CFReader_destroy(CompoundFileReader *self) {
     DECREF(self->real_folder);
     DECREF(self->instream);
     DECREF(self->records);
@@ -120,26 +116,25 @@ CFReader_destroy(CompoundFileReader *sel
 }
 
 Folder*
-CFReader_get_real_folder(CompoundFileReader *self) { return self->real_folder; }
+CFReader_get_real_folder(CompoundFileReader *self) {
+    return self->real_folder;
+}
 
 void
-CFReader_set_path(CompoundFileReader *self, const CharBuf *path)
-{
+CFReader_set_path(CompoundFileReader *self, const CharBuf *path) {
     Folder_Set_Path(self->real_folder, path);
     Folder_set_path((Folder*)self, path);
 }
 
 FileHandle*
-CFReader_local_open_filehandle(CompoundFileReader *self, 
-                               const CharBuf *name, uint32_t flags)
-{
+CFReader_local_open_filehandle(CompoundFileReader *self,
+                               const CharBuf *name, uint32_t flags) {
     Hash *entry = (Hash*)Hash_Fetch(self->records, (Obj*)name);
     FileHandle *fh = NULL;
 
     if (entry) {
-        Err_set_error(Err_new(CB_newf(
-            "Can't open FileHandle for virtual file %o in '%o'", name,
-            self->path)));
+        Err_set_error(Err_new(CB_newf("Can't open FileHandle for virtual file %o in '%o'",
+                                      name, self->path)));
     }
     else {
         fh = Folder_Local_Open_FileHandle(self->real_folder, name, flags);
@@ -152,15 +147,14 @@ CFReader_local_open_filehandle(CompoundF
 }
 
 bool_t
-CFReader_local_delete(CompoundFileReader *self, const CharBuf *name)
-{
+CFReader_local_delete(CompoundFileReader *self, const CharBuf *name) {
     Hash *record = (Hash*)Hash_Delete(self->records, (Obj*)name);
     DECREF(record);
 
-    if (record == NULL) { 
+    if (record == NULL) {
         return Folder_Local_Delete(self->real_folder, name);
     }
-    else { 
+    else {
         // Once the number of virtual files falls to 0, remove the compound
         // files.
         if (Hash_Get_Size(self->records) == 0) {
@@ -179,8 +173,7 @@ CFReader_local_delete(CompoundFileReader
 }
 
 InStream*
-CFReader_local_open_in(CompoundFileReader *self, const CharBuf *name)
-{
+CFReader_local_open_in(CompoundFileReader *self, const CharBuf *name) {
     Hash *entry = (Hash*)Hash_Fetch(self->records, (Obj*)name);
 
     if (!entry) {
@@ -195,48 +188,44 @@ CFReader_local_open_in(CompoundFileReade
         Obj *offset = Hash_Fetch_Str(entry, "offset", 6);
         if (!len || !offset) {
             Err_set_error(Err_new(CB_newf("Malformed entry for '%o' in '%o'",
-                name, Folder_Get_Path(self->real_folder))));
+                                          name, Folder_Get_Path(self->real_folder))));
             return NULL;
         }
         else if (CB_Get_Size(self->path)) {
             CharBuf *fullpath = CB_newf("%o/%o", self->path, name);
-            InStream *instream = InStream_Reopen(self->instream, 
-                fullpath, Obj_To_I64(offset), Obj_To_I64(len));
+            InStream *instream = InStream_Reopen(self->instream, fullpath,
+                                                 Obj_To_I64(offset), Obj_To_I64(len));
             DECREF(fullpath);
             return instream;
         }
         else {
-            return InStream_Reopen(self->instream, name,
-                Obj_To_I64(offset), Obj_To_I64(len));
+            return InStream_Reopen(self->instream, name, Obj_To_I64(offset),
+                                   Obj_To_I64(len));
         }
     }
 }
 
 bool_t
-CFReader_local_exists(CompoundFileReader *self, const CharBuf *name)
-{
+CFReader_local_exists(CompoundFileReader *self, const CharBuf *name) {
     if (Hash_Fetch(self->records, (Obj*)name))        { return true; }
     if (Folder_Local_Exists(self->real_folder, name)) { return true; }
     return false;
 }
 
 bool_t
-CFReader_local_is_directory(CompoundFileReader *self, const CharBuf *name)
-{
+CFReader_local_is_directory(CompoundFileReader *self, const CharBuf *name) {
     if (Hash_Fetch(self->records, (Obj*)name))              { return false; }
     if (Folder_Local_Is_Directory(self->real_folder, name)) { return true; }
     return false;
 }
 
 void
-CFReader_close(CompoundFileReader *self)
-{
+CFReader_close(CompoundFileReader *self) {
     InStream_Close(self->instream);
 }
 
 bool_t
-CFReader_local_mkdir(CompoundFileReader *self, const CharBuf *name)
-{
+CFReader_local_mkdir(CompoundFileReader *self, const CharBuf *name) {
     if (Hash_Fetch(self->records, (Obj*)name)) {
         Err_set_error(Err_new(CB_newf("Can't MkDir: '%o' exists", name)));
         return false;
@@ -249,31 +238,27 @@ CFReader_local_mkdir(CompoundFileReader 
 }
 
 Folder*
-CFReader_local_find_folder(CompoundFileReader *self, const CharBuf *name)
-{
+CFReader_local_find_folder(CompoundFileReader *self, const CharBuf *name) {
     if (Hash_Fetch(self->records, (Obj*)name)) { return false; }
     return Folder_Local_Find_Folder(self->real_folder, name);
 }
 
 DirHandle*
-CFReader_local_open_dir(CompoundFileReader *self)
-{
+CFReader_local_open_dir(CompoundFileReader *self) {
     return (DirHandle*)CFReaderDH_new(self);
 }
 
 /****************************************************************************/
 
 CFReaderDirHandle*
-CFReaderDH_new(CompoundFileReader *cf_reader)
-{
-    CFReaderDirHandle *self 
+CFReaderDH_new(CompoundFileReader *cf_reader) {
+    CFReaderDirHandle *self
         = (CFReaderDirHandle*)VTable_Make_Obj(CFREADERDIRHANDLE);
     return CFReaderDH_init(self, cf_reader);
 }
 
 CFReaderDirHandle*
-CFReaderDH_init(CFReaderDirHandle *self, CompoundFileReader *cf_reader)
-{
+CFReaderDH_init(CFReaderDirHandle *self, CompoundFileReader *cf_reader) {
     DH_init((DirHandle*)self, CFReader_Get_Path(cf_reader));
     self->cf_reader = (CompoundFileReader*)INCREF(cf_reader);
     self->elems  = Hash_Keys(self->cf_reader->records);
@@ -291,8 +276,7 @@ CFReaderDH_init(CFReaderDirHandle *self,
 }
 
 bool_t
-CFReaderDH_close(CFReaderDirHandle *self)
-{
+CFReaderDH_close(CFReaderDirHandle *self) {
     if (self->elems) {
         VA_Dec_RefCount(self->elems);
         self->elems = NULL;
@@ -305,13 +289,12 @@ CFReaderDH_close(CFReaderDirHandle *self
 }
 
 bool_t
-CFReaderDH_next(CFReaderDirHandle *self)
-{
+CFReaderDH_next(CFReaderDirHandle *self) {
     if (self->elems) {
         self->tick++;
         if (self->tick < (int32_t)VA_Get_Size(self->elems)) {
             CharBuf *path = (CharBuf*)CERTIFY(
-                VA_Fetch(self->elems, self->tick), CHARBUF);
+                                VA_Fetch(self->elems, self->tick), CHARBUF);
             CB_Mimic(self->entry, (Obj*)path);
             return true;
         }
@@ -324,8 +307,7 @@ CFReaderDH_next(CFReaderDirHandle *self)
 }
 
 bool_t
-CFReaderDH_entry_is_dir(CFReaderDirHandle *self)
-{
+CFReaderDH_entry_is_dir(CFReaderDirHandle *self) {
     if (self->elems) {
         CharBuf *name = (CharBuf*)VA_Fetch(self->elems, self->tick);
         if (name) {

Modified: incubator/lucy/trunk/core/Lucy/Store/CompoundFileReader.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/CompoundFileReader.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/CompoundFileReader.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Store/CompoundFileReader.cfh Sun May  1 23:50:24 2011
@@ -70,7 +70,7 @@ class Lucy::Store::CompoundFileReader cn
     Local_Is_Directory(CompoundFileReader *self, const CharBuf *name);
 
     incremented nullable FileHandle*
-    Local_Open_FileHandle(CompoundFileReader *self, const CharBuf *name, 
+    Local_Open_FileHandle(CompoundFileReader *self, const CharBuf *name,
                           uint32_t flags);
 
     incremented nullable InStream*

Modified: incubator/lucy/trunk/core/Lucy/Store/CompoundFileWriter.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/CompoundFileWriter.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/CompoundFileWriter.c (original)
+++ incubator/lucy/trunk/core/Lucy/Store/CompoundFileWriter.c Sun May  1 23:50:24 2011
@@ -35,34 +35,30 @@ static void
 S_clean_up_old_temp_files(CompoundFileWriter *self);
 
 CompoundFileWriter*
-CFWriter_new(Folder *folder)
-{
-    CompoundFileWriter *self 
+CFWriter_new(Folder *folder) {
+    CompoundFileWriter *self
         = (CompoundFileWriter*)VTable_Make_Obj(COMPOUNDFILEWRITER);
     return CFWriter_init(self, folder);
 }
 
 CompoundFileWriter*
-CFWriter_init(CompoundFileWriter *self, Folder *folder)
-{
+CFWriter_init(CompoundFileWriter *self, Folder *folder) {
     self->folder = (Folder*)INCREF(folder);
     return self;
 }
 
 void
-CFWriter_destroy(CompoundFileWriter *self)
-{
+CFWriter_destroy(CompoundFileWriter *self) {
     DECREF(self->folder);
     SUPER_DESTROY(self, COMPOUNDFILEWRITER);
 }
 
 void
-CFWriter_consolidate(CompoundFileWriter *self)
-{
+CFWriter_consolidate(CompoundFileWriter *self) {
     CharBuf *cfmeta_file = (CharBuf*)ZCB_WRAP_STR("cfmeta.json", 11);
     if (Folder_Exists(self->folder, cfmeta_file)) {
-        THROW(ERR, "Merge already performed for %o", 
-            Folder_Get_Path(self->folder));
+        THROW(ERR, "Merge already performed for %o",
+              Folder_Get_Path(self->folder));
     }
     else {
         S_clean_up_old_temp_files(self);
@@ -71,8 +67,7 @@ CFWriter_consolidate(CompoundFileWriter 
 }
 
 static void
-S_clean_up_old_temp_files(CompoundFileWriter *self)
-{
+S_clean_up_old_temp_files(CompoundFileWriter *self) {
     Folder  *folder      = self->folder;
     CharBuf *cfmeta_temp = (CharBuf*)ZCB_WRAP_STR("cfmeta.json.temp", 16);
     CharBuf *cf_file     = (CharBuf*)ZCB_WRAP_STR("cf.dat", 6);
@@ -90,14 +85,13 @@ S_clean_up_old_temp_files(CompoundFileWr
 }
 
 static void
-S_do_consolidate(CompoundFileWriter *self)
-{
+S_do_consolidate(CompoundFileWriter *self) {
     Folder    *folder       = self->folder;
     Hash      *metadata     = Hash_new(0);
     Hash      *sub_files    = Hash_new(0);
     VArray    *files        = Folder_List(folder, NULL);
     VArray    *merged       = VA_new(VA_Get_Size(files));
-    CharBuf   *cf_file     = (CharBuf*)ZCB_WRAP_STR("cf.dat", 6);
+    CharBuf   *cf_file      = (CharBuf*)ZCB_WRAP_STR("cf.dat", 6);
     OutStream *outstream    = Folder_Open_Out(folder, (CharBuf*)cf_file);
     uint32_t   i, max;
     bool_t     rename_success;
@@ -106,8 +100,8 @@ S_do_consolidate(CompoundFileWriter *sel
 
     // Start metadata.
     Hash_Store_Str(metadata, "files", 5, INCREF(sub_files));
-    Hash_Store_Str(metadata, "format", 6, 
-        (Obj*)CB_newf("%i32", CFWriter_current_file_format) );
+    Hash_Store_Str(metadata, "format", 6,
+                   (Obj*)CB_newf("%i32", CFWriter_current_file_format));
 
     CharBuf *infilepath = CB_new(30);
     size_t base_len = 0;
@@ -128,10 +122,10 @@ S_do_consolidate(CompoundFileWriter *sel
             len = OutStream_Tell(outstream) - offset;
 
             // Record offset and length.
-            Hash_Store_Str(file_data, "offset", 6, 
-                (Obj*)CB_newf("%i64", offset) );
-            Hash_Store_Str(file_data, "length", 6, 
-                (Obj*)CB_newf("%i64", len) );
+            Hash_Store_Str(file_data, "offset", 6,
+                           (Obj*)CB_newf("%i64", offset));
+            Hash_Store_Str(file_data, "length", 6,
+                           (Obj*)CB_newf("%i64", len));
             CB_Set_Size(infilepath, base_len);
             CB_Cat(infilepath, infilename);
             Hash_Store(sub_files, (Obj*)infilepath, (Obj*)file_data);

Modified: incubator/lucy/trunk/core/Lucy/Store/DirHandle.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/DirHandle.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/DirHandle.c (original)
+++ incubator/lucy/trunk/core/Lucy/Store/DirHandle.c Sun May  1 23:50:24 2011
@@ -20,8 +20,7 @@
 #include "Lucy/Store/DirHandle.h"
 
 DirHandle*
-DH_init(DirHandle *self, const CharBuf *dir)
-{
+DH_init(DirHandle *self, const CharBuf *dir) {
     self->dir   = CB_Clone(dir);
     self->entry = CB_new(32);
     ABSTRACT_CLASS_CHECK(self, DIRHANDLE);
@@ -29,8 +28,7 @@ DH_init(DirHandle *self, const CharBuf *
 }
 
 void
-DH_destroy(DirHandle *self)
-{
+DH_destroy(DirHandle *self) {
     DH_Close(self);
     DECREF(self->dir);
     DECREF(self->entry);
@@ -38,8 +36,13 @@ DH_destroy(DirHandle *self)
 }
 
 CharBuf*
-DH_get_dir(DirHandle *self)   { return self->dir; }
+DH_get_dir(DirHandle *self) {
+    return self->dir;
+}
+
 CharBuf*
-DH_get_entry(DirHandle *self) { return self->entry; }
+DH_get_entry(DirHandle *self) {
+    return self->entry;
+}
 
 

Modified: incubator/lucy/trunk/core/Lucy/Store/DirHandle.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/DirHandle.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/DirHandle.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Store/DirHandle.cfh Sun May  1 23:50:24 2011
@@ -18,7 +18,7 @@ parcel Lucy;
 
 /** Iterate over the files in a directory.
  */
-abstract class Lucy::Store::DirHandle cnick DH 
+abstract class Lucy::Store::DirHandle cnick DH
     inherits Lucy::Object::Obj {
 
     CharBuf  *dir;

Modified: incubator/lucy/trunk/core/Lucy/Store/FSDirHandle.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/FSDirHandle.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/FSDirHandle.c (original)
+++ incubator/lucy/trunk/core/Lucy/Store/FSDirHandle.c Sun May  1 23:50:24 2011
@@ -32,15 +32,13 @@
 #endif
 
 FSDirHandle*
-FSDH_open(const CharBuf *dir)
-{
+FSDH_open(const CharBuf *dir) {
     FSDirHandle *self = (FSDirHandle*)VTable_Make_Obj(FSDIRHANDLE);
     return FSDH_do_open(self, dir);
 }
 
 void
-FSDH_destroy(FSDirHandle *self)
-{
+FSDH_destroy(FSDirHandle *self) {
     // Throw away saved error -- it's too late to call Close() now.
     DECREF(self->saved_error);
     self->saved_error = NULL;
@@ -48,8 +46,7 @@ FSDH_destroy(FSDirHandle *self)
 }
 
 static INLINE bool_t
-SI_is_updir(const char *name, size_t len)
-{
+SI_is_updir(const char *name, size_t len) {
     if (len == 2 && strncmp(name, "..", 2) == 0) {
         return true;
     }
@@ -67,8 +64,7 @@ SI_is_updir(const char *name, size_t len
 #include <dirent.h>
 
 FSDirHandle*
-FSDH_do_open(FSDirHandle *self, const CharBuf *dir)
-{
+FSDH_do_open(FSDirHandle *self, const CharBuf *dir) {
     char *dir_path_ptr = (char*)CB_Get_Ptr8(dir);
 
     DH_init((DirHandle*)self, dir);
@@ -81,17 +77,16 @@ FSDH_do_open(FSDirHandle *self, const Ch
         DECREF(self);
         return NULL;
     }
-    
+
     return self;
 }
 
 bool_t
-FSDH_next(FSDirHandle *self)
-{
+FSDH_next(FSDirHandle *self) {
     self->sys_dir_entry = (struct dirent*)readdir((DIR*)self->sys_dirhandle);
-    if (!self->sys_dir_entry) { 
+    if (!self->sys_dir_entry) {
         CB_Set_Size(self->entry, 0);
-        return false; 
+        return false;
     }
     else {
         struct dirent *sys_dir_entry = (struct dirent*)self->sys_dir_entry;
@@ -111,8 +106,7 @@ FSDH_next(FSDirHandle *self)
 }
 
 bool_t
-FSDH_entry_is_dir(FSDirHandle *self)
-{
+FSDH_entry_is_dir(FSDirHandle *self) {
     struct dirent *sys_dir_entry = (struct dirent*)self->sys_dir_entry;
     if (!sys_dir_entry) { return false; }
 
@@ -128,11 +122,11 @@ FSDH_entry_is_dir(FSDirHandle *self)
     #endif
 
     struct stat stat_buf;
-    if (!self->fullpath) { 
+    if (!self->fullpath) {
         self->fullpath = CB_new(CB_Get_Size(self->dir) + 20);
     }
     CB_setf(self->fullpath, "%o%s%o", self->dir, CHY_DIR_SEP,
-        self->entry);
+            self->entry);
     if (stat((char*)CB_Get_Ptr8(self->fullpath), &stat_buf) != -1) {
         if (stat_buf.st_mode & S_IFDIR) { return true; }
     }
@@ -140,21 +134,20 @@ FSDH_entry_is_dir(FSDirHandle *self)
 }
 
 bool_t
-FSDH_entry_is_symlink(FSDirHandle *self)
-{
+FSDH_entry_is_symlink(FSDirHandle *self) {
     struct dirent *sys_dir_entry = (struct dirent*)self->sys_dir_entry;
     if (!sys_dir_entry) { return false; }
 
     #ifdef CHY_HAS_DIRENT_D_TYPE
     return sys_dir_entry->d_type == DT_LNK ? true : false;
-    #else 
+    #else
     {
         struct stat stat_buf;
-        if (!self->fullpath) { 
+        if (!self->fullpath) {
             self->fullpath = CB_new(CB_Get_Size(self->dir) + 20);
         }
         CB_setf(self->fullpath, "%o%s%o", self->dir, CHY_DIR_SEP,
-            self->entry);
+                self->entry);
         if (stat((char*)CB_Get_Ptr8(self->fullpath), &stat_buf) != -1) {
             if (stat_buf.st_mode & S_IFLNK) return true;
         }
@@ -164,8 +157,7 @@ FSDH_entry_is_symlink(FSDirHandle *self)
 }
 
 bool_t
-FSDH_close(FSDirHandle *self)
-{
+FSDH_close(FSDirHandle *self) {
     if (self->fullpath) {
         CB_Dec_RefCount(self->fullpath);
         self->fullpath = NULL;
@@ -174,8 +166,8 @@ FSDH_close(FSDirHandle *self)
         DIR *sys_dirhandle = (DIR*)self->sys_dirhandle;
         self->sys_dirhandle = NULL;
         if (closedir(sys_dirhandle) == -1) {
-            Err_set_error(Err_new(CB_newf("Error closing dirhandle: %s", 
-                strerror(errno))));
+            Err_set_error(Err_new(CB_newf("Error closing dirhandle: %s",
+                                          strerror(errno))));
             return false;
         }
     }
@@ -188,8 +180,7 @@ FSDH_close(FSDirHandle *self)
 #include <windows.h>
 
 FSDirHandle*
-FSDH_do_open(FSDirHandle *self, const CharBuf *dir)
-{
+FSDH_do_open(FSDirHandle *self, const CharBuf *dir) {
     size_t  dir_path_size = CB_Get_Size(dir);
     char   *dir_path_ptr  = (char*)CB_Get_Ptr8(dir);
     char    search_string[MAX_PATH + 1];
@@ -199,11 +190,11 @@ FSDH_do_open(FSDirHandle *self, const Ch
     self->sys_dir_entry    = MALLOCATE(sizeof(WIN32_FIND_DATA));
     self->sys_dirhandle    = INVALID_HANDLE_VALUE;
     self->saved_error      = NULL;
-    
+
     if (dir_path_size >= MAX_PATH - 2) {
         // Deal with Windows ceiling on file path lengths.
-        Err_set_error(Err_new(CB_newf("Directory path is too long: %o", 
-            dir)));
+        Err_set_error(Err_new(CB_newf("Directory path is too long: %o",
+                                      dir)));
         DECREF(self);
         return NULL;
     }
@@ -213,8 +204,8 @@ FSDH_do_open(FSDirHandle *self, const Ch
     memcpy(path_ptr, dir_path_ptr, dir_path_size);
     memcpy(path_ptr + dir_path_size, "\\*\0", 3);
 
-    self->sys_dirhandle = FindFirstFile(search_string, 
-        (WIN32_FIND_DATA*)self->sys_dir_entry);
+    self->sys_dirhandle
+        = FindFirstFile(search_string, (WIN32_FIND_DATA*)self->sys_dir_entry);
     if (INVALID_HANDLE_VALUE == self->sys_dirhandle) {
         // Directory inaccessible or doesn't exist.
         Err_set_error(Err_new(CB_newf("Failed to open dir '%o'", dir)));
@@ -232,45 +223,43 @@ FSDH_do_open(FSDirHandle *self, const Ch
 }
 
 bool_t
-FSDH_entry_is_dir(FSDirHandle *self)
-{
+FSDH_entry_is_dir(FSDirHandle *self) {
     WIN32_FIND_DATA *find_data = (WIN32_FIND_DATA*)self->sys_dir_entry;
-    if (find_data) { 
+    if (find_data) {
         if ((find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
             return true;
         }
     }
-    return false; 
+    return false;
 }
 
 bool_t
-FSDH_entry_is_symlink(FSDirHandle *self)
-{
+FSDH_entry_is_symlink(FSDirHandle *self) {
     WIN32_FIND_DATA *find_data = (WIN32_FIND_DATA*)self->sys_dir_entry;
-    if (find_data) { 
+    if (find_data) {
         if ((find_data->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) {
             return true;
         }
     }
-    return false; 
+    return false;
 }
 
 bool_t
-FSDH_close(FSDirHandle *self)
-{
+FSDH_close(FSDirHandle *self) {
     if (self->sys_dirhandle && self->sys_dirhandle != INVALID_HANDLE_VALUE) {
         HANDLE dirhandle = (HANDLE)self->sys_dirhandle;
         self->sys_dirhandle = NULL;
         if (dirhandle != INVALID_HANDLE_VALUE && !FindClose(dirhandle)) {
             if (!self->saved_error) {
                 char *win_error = Err_win_error();
-                self->saved_error = Err_new(CB_newf(
-                    "Error while closing directory: %s", win_error));
+                self->saved_error
+                    = Err_new(CB_newf("Error while closing directory: %s",
+                                      win_error));
                 FREEMEM(win_error);
             }
         }
     }
-    if (self->sys_dir_entry) { 
+    if (self->sys_dir_entry) {
         FREEMEM(self->sys_dir_entry);
         self->sys_dir_entry = NULL;
     }
@@ -286,8 +275,7 @@ FSDH_close(FSDirHandle *self)
 }
 
 bool_t
-FSDH_next(FSDirHandle *self)
-{
+FSDH_next(FSDirHandle *self) {
     HANDLE           dirhandle = (HANDLE)self->sys_dirhandle;
     WIN32_FIND_DATA *find_data = (WIN32_FIND_DATA*)self->sys_dir_entry;
 
@@ -303,8 +291,9 @@ FSDH_next(FSDirHandle *self)
         CB_Set_Size(self->entry, 0);
         if (GetLastError() != ERROR_NO_MORE_FILES) {
             char *win_error = Err_win_error();
-            self->saved_error = Err_new(CB_newf(
-                "Error while traversing directory: %s", win_error));
+            self->saved_error
+                = Err_new(CB_newf("Error while traversing directory: %s",
+                                  win_error));
             FREEMEM(win_error);
         }
         return false;

Modified: incubator/lucy/trunk/core/Lucy/Store/FSDirHandle.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/FSDirHandle.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/FSDirHandle.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Store/FSDirHandle.cfh Sun May  1 23:50:24 2011
@@ -18,9 +18,9 @@ parcel Lucy;
 
 /** File system DirHandle.
  */
-class Lucy::Store::FSDirHandle cnick FSDH 
+class Lucy::Store::FSDirHandle cnick FSDH
     inherits Lucy::Store::DirHandle {
-    
+
     void    *sys_dirhandle;
     void    *sys_dir_entry;
     CharBuf *fullpath;

Modified: incubator/lucy/trunk/core/Lucy/Store/FSFileHandle.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/FSFileHandle.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/FSFileHandle.c (original)
+++ incubator/lucy/trunk/core/Lucy/Store/FSFileHandle.c Sun May  1 23:50:24 2011
@@ -23,7 +23,7 @@
 #include <fcntl.h> // open, POSIX flags
 #include <stdarg.h>
 
-#ifdef CHY_HAS_UNISTD_H 
+#ifdef CHY_HAS_UNISTD_H
   #include <unistd.h> // close
 #endif
 
@@ -41,8 +41,7 @@
 
 // Convert FileHandle flags to POSIX flags.
 static INLINE int
-SI_posix_flags(uint32_t fh_flags)
-{
+SI_posix_flags(uint32_t fh_flags) {
     int posix_flags = 0;
     if (fh_flags & FH_WRITE_ONLY) { posix_flags |= O_WRONLY; }
     if (fh_flags & FH_READ_ONLY)  { posix_flags |= O_RDONLY; }
@@ -51,7 +50,7 @@ SI_posix_flags(uint32_t fh_flags)
 #ifdef O_LARGEFILE
     posix_flags |= O_LARGEFILE;
 #endif
-#ifdef _O_BINARY 
+#ifdef _O_BINARY
     posix_flags |= _O_BINARY;
 #endif
     return posix_flags;
@@ -74,25 +73,23 @@ static INLINE bool_t
 SI_window(FSFileHandle *self, FileWindow *window, int64_t offset, int64_t len);
 
 // Architecture- and OS- specific initialization for a read-only FSFileHandle.
-static INLINE bool_t 
+static INLINE bool_t
 SI_init_read_only(FSFileHandle *self);
 
 // Windows-specific routine needed for closing read-only handles.
 #ifdef CHY_HAS_WINDOWS_H
-static INLINE bool_t 
+static INLINE bool_t
 SI_close_win_handles(FSFileHandle *self);
 #endif
 
 FSFileHandle*
-FSFH_open(const CharBuf *path, uint32_t flags) 
-{
+FSFH_open(const CharBuf *path, uint32_t flags) {
     FSFileHandle *self = (FSFileHandle*)VTable_Make_Obj(FSFILEHANDLE);
     return FSFH_do_open(self, path, flags);
 }
 
 FSFileHandle*
-FSFH_do_open(FSFileHandle *self, const CharBuf *path, uint32_t flags) 
-{
+FSFH_do_open(FSFileHandle *self, const CharBuf *path, uint32_t flags) {
     FH_do_open((FileHandle*)self, path, flags);
     if (!path || !CB_Get_Size(path)) {
         Err_set_error(Err_new(CB_newf("Missing required param 'path'")));
@@ -103,10 +100,10 @@ FSFH_do_open(FSFileHandle *self, const C
     // Attempt to open file.
     if (flags & FH_WRITE_ONLY) {
         self->fd = open((char*)CB_Get_Ptr8(path), SI_posix_flags(flags), 0666);
-        if (self->fd == -1) { 
+        if (self->fd == -1) {
             self->fd = 0;
-            Err_set_error(Err_new(CB_newf("Attempt to open '%o' failed: %s", 
-                path, strerror(errno))));
+            Err_set_error(Err_new(CB_newf("Attempt to open '%o' failed: %s",
+                                          path, strerror(errno))));
             DECREF(self);
             return NULL;
         }
@@ -117,16 +114,16 @@ FSFH_do_open(FSFileHandle *self, const C
             // Derive length.
             self->len = lseek64(self->fd, I64_C(0), SEEK_END);
             if (self->len == -1) {
-                Err_set_error(Err_new(CB_newf("lseek64 on %o failed: %s", 
-                    self->path, strerror(errno))));
+                Err_set_error(Err_new(CB_newf("lseek64 on %o failed: %s",
+                                              self->path, strerror(errno))));
                 DECREF(self);
                 return NULL;
             }
             else {
                 int64_t check_val = lseek64(self->fd, I64_C(0), SEEK_SET);
                 if (check_val == -1) {
-                    Err_set_error(Err_new(CB_newf("lseek64 on %o failed: %s", 
-                        self->path, strerror(errno))));
+                    Err_set_error(Err_new(CB_newf("lseek64 on %o failed: %s",
+                                                  self->path, strerror(errno))));
                     DECREF(self);
                     return NULL;
                 }
@@ -138,7 +135,7 @@ FSFH_do_open(FSFileHandle *self, const C
             // On 64-bit systems, map the whole file up-front.
             if (IS_64_BIT && self->len) {
                 self->buf = (char*)SI_map(self, 0, self->len);
-                if (!self->buf) { 
+                if (!self->buf) {
                     // An error occurred during SI_map, which has set
                     // Err_error for us already.
                     DECREF(self);
@@ -152,9 +149,8 @@ FSFH_do_open(FSFileHandle *self, const C
         }
     }
     else {
-        Err_set_error(Err_new(CB_newf(
-            "Must specify FH_READ_ONLY or FH_WRITE_ONLY to open '%o'", 
-            path)));
+        Err_set_error(Err_new(CB_newf("Must specify FH_READ_ONLY or FH_WRITE_ONLY to open '%o'",
+                                      path)));
         DECREF(self);
         return NULL;
     }
@@ -163,19 +159,18 @@ FSFH_do_open(FSFileHandle *self, const C
 }
 
 bool_t
-FSFH_close(FSFileHandle *self)
-{
+FSFH_close(FSFileHandle *self) {
     // On 64-bit systems, cancel the whole-file mapping.
     if (IS_64_BIT && (self->flags & FH_READ_ONLY)) {
-        if ( !SI_unmap(self, self->buf, self->len) ) { return false; }
+        if (!SI_unmap(self, self->buf, self->len)) { return false; }
         self->buf = NULL;
     }
-    
+
     // Close system-specific handles.
     if (self->fd) {
         if (close(self->fd)) {
-            Err_set_error(Err_new(CB_newf("Failed to close file: %s", 
-                strerror(errno))));
+            Err_set_error(Err_new(CB_newf("Failed to close file: %s",
+                                          strerror(errno))));
             return false;
         }
         self->fd  = 0;
@@ -190,22 +185,19 @@ FSFH_close(FSFileHandle *self)
 }
 
 bool_t
-FSFH_write(FSFileHandle *self, const void *data, size_t len) 
-{
-    if (len) { 
+FSFH_write(FSFileHandle *self, const void *data, size_t len) {
+    if (len) {
         // Write data, track file length, check for errors.
         int64_t check_val = write(self->fd, data, len);
         self->len += check_val;
         if ((size_t)check_val != len) {
             if (check_val == -1) {
-                Err_set_error(Err_new(CB_newf(
-                    "Error when writing %u64 bytes: %s",
-                    (uint64_t)len, strerror(errno))));
+                Err_set_error(Err_new(CB_newf("Error when writing %u64 bytes: %s",
+                                              (uint64_t)len, strerror(errno))));
             }
             else {
-                Err_set_error(Err_new(CB_newf(
-                    "Attempted to write %u64 bytes, but wrote %i64", 
-                    (uint64_t)len, check_val)));
+                Err_set_error(Err_new(CB_newf("Attempted to write %u64 bytes, but wrote %i64",
+                                              (uint64_t)len, check_val)));
             }
             return false;
         }
@@ -215,33 +207,31 @@ FSFH_write(FSFileHandle *self, const voi
 }
 
 int64_t
-FSFH_length(FSFileHandle *self)
-{
+FSFH_length(FSFileHandle *self) {
     return self->len;
 }
 
 bool_t
-FSFH_window(FSFileHandle *self, FileWindow *window, int64_t offset, int64_t len)
-{
+FSFH_window(FSFileHandle *self, FileWindow *window, int64_t offset,
+            int64_t len) {
     const int64_t end = offset + len;
     if (!(self->flags & FH_READ_ONLY)) {
         Err_set_error(Err_new(CB_newf("Can't read from write-only handle")));
         return false;
     }
     else if (offset < 0) {
-        Err_set_error(Err_new(CB_newf("Can't read from negative offset %i64", 
-            offset)));
+        Err_set_error(Err_new(CB_newf("Can't read from negative offset %i64",
+                                      offset)));
         return false;
     }
     else if (end > self->len) {
-        Err_set_error(Err_new(CB_newf(
-            "Tried to read past EOF: offset %i64 + request %i64 > len %i64", 
-            offset, len, self->len)));
+        Err_set_error(Err_new(CB_newf("Tried to read past EOF: offset %i64 + request %i64 > len %i64",
+                                      offset, len, self->len)));
         return false;
     }
     else {
-		return SI_window(self, window, offset, len);
-	}
+        return SI_window(self, window, offset, len);
+    }
 }
 
 /********************************* 64-bit *********************************/
@@ -249,39 +239,35 @@ FSFH_window(FSFileHandle *self, FileWind
 #if IS_64_BIT
 
 static INLINE bool_t
-SI_window(FSFileHandle *self, FileWindow *window, int64_t offset, int64_t len)
-{
-	FileWindow_Set_Window(window, self->buf + offset, offset, len);
-	return true;
+SI_window(FSFileHandle *self, FileWindow *window, int64_t offset,
+          int64_t len) {
+    FileWindow_Set_Window(window, self->buf + offset, offset, len);
+    return true;
 }
 
 bool_t
-FSFH_release_window(FSFileHandle *self, FileWindow *window)
-{
+FSFH_release_window(FSFileHandle *self, FileWindow *window) {
     UNUSED_VAR(self);
     FileWindow_Set_Window(window, NULL, 0, 0);
     return true;
 }
 
 bool_t
-FSFH_read(FSFileHandle *self, char *dest, int64_t offset, size_t len)
-{
+FSFH_read(FSFileHandle *self, char *dest, int64_t offset, size_t len) {
     const int64_t end = offset + len;
 
     if (self->flags & FH_WRITE_ONLY) {
-        Err_set_error(Err_new(CB_newf(
-            "Can't read from write-only filehandle")));
+        Err_set_error(Err_new(CB_newf("Can't read from write-only filehandle")));
         return false;
     }
     if (offset < 0) {
-        Err_set_error(Err_new(CB_newf(
-            "Can't read from an offset less than 0 (%i64)", offset)));
+        Err_set_error(Err_new(CB_newf("Can't read from an offset less than 0 (%i64)",
+                                      offset)));
         return false;
     }
     else if (end > self->len) {
-        Err_set_error(Err_new(CB_newf(
-            "Tried to read past EOF: offset %i64 + request %u64 > len %i64", 
-            offset, (uint64_t)len, self->len)));
+        Err_set_error(Err_new(CB_newf("Tried to read past EOF: offset %i64 + request %u64 > len %i64",
+                                      offset, (uint64_t)len, self->len)));
         return false;
     }
     memcpy(dest, self->buf + offset, len);
@@ -293,36 +279,35 @@ FSFH_read(FSFileHandle *self, char *dest
 #else
 
 static INLINE bool_t
-SI_window(FSFileHandle *self, FileWindow *window, int64_t offset, int64_t len)
-{
-	// Release the previously mmap'd region, if any.
-	FSFH_release_window(self, window);
-
-	{
-		// Start map on a page boundary.  Ensure that the window is at
-		// least wide enough to view all the data spec'd in the original
-		// request.
-		const int64_t remainder       = offset % self->page_size;
-		const int64_t adjusted_offset = offset - remainder;
-		const int64_t adjusted_len    = len + remainder;
-		char *const buf 
-			= (char*)SI_map(self, adjusted_offset, adjusted_len);
-		if (len && buf == NULL) {
-			return false;
-		}
-		else {
-			FileWindow_Set_Window(window, buf, adjusted_offset, 
-				adjusted_len);
-		}
-	}
+SI_window(FSFileHandle *self, FileWindow *window, int64_t offset,
+          int64_t len) {
+    // Release the previously mmap'd region, if any.
+    FSFH_release_window(self, window);
+
+    {
+        // Start map on a page boundary.  Ensure that the window is at
+        // least wide enough to view all the data spec'd in the original
+        // request.
+        const int64_t remainder       = offset % self->page_size;
+        const int64_t adjusted_offset = offset - remainder;
+        const int64_t adjusted_len    = len + remainder;
+        char *const buf
+            = (char*)SI_map(self, adjusted_offset, adjusted_len);
+        if (len && buf == NULL) {
+            return false;
+        }
+        else {
+            FileWindow_Set_Window(window, buf, adjusted_offset,
+                                  adjusted_len);
+        }
+    }
 
-	return true;
+    return true;
 }
 
 bool_t
-FSFH_release_window(FSFileHandle *self, FileWindow *window)
-{
-    if ( !SI_unmap(self, window->buf, window->len) ) { return false; }
+FSFH_release_window(FSFileHandle *self, FileWindow *window) {
+    if (!SI_unmap(self, window->buf, window->len)) { return false; }
     FileWindow_Set_Window(window, NULL, 0, 0);
     return true;
 }
@@ -333,16 +318,15 @@ FSFH_release_window(FSFileHandle *self, 
 
 #ifdef CHY_HAS_SYS_MMAN_H
 
-static INLINE bool_t 
-SI_init_read_only(FSFileHandle *self)
-{
+static INLINE bool_t
+SI_init_read_only(FSFileHandle *self) {
     // Open.
-    self->fd = open((char*)CB_Get_Ptr8(self->path), 
-        SI_posix_flags(self->flags), 0666);
+    self->fd = open((char*)CB_Get_Ptr8(self->path),
+                    SI_posix_flags(self->flags), 0666);
     if (self->fd == -1) {
         self->fd = 0;
         Err_set_error(Err_new(CB_newf("Can't open '%o': %s", self->path,
-            strerror(errno))));
+                                      strerror(errno))));
         return false;
     }
 
@@ -350,14 +334,14 @@ SI_init_read_only(FSFileHandle *self)
     self->len = lseek64(self->fd, I64_C(0), SEEK_END);
     if (self->len == -1) {
         Err_set_error(Err_new(CB_newf("lseek64 on %o failed: %s", self->path,
-            strerror(errno))));
+                                      strerror(errno))));
         return false;
     }
     else {
         int64_t check_val = lseek64(self->fd, I64_C(0), SEEK_SET);
         if (check_val == -1) {
             Err_set_error(Err_new(CB_newf("lseek64 on %o failed: %s",
-                self->path, strerror(errno))));
+                                          self->path, strerror(errno))));
             return false;
         }
     }
@@ -370,23 +354,22 @@ SI_init_read_only(FSFileHandle *self)
 #else
     #error "Can't determine system memory page size"
 #endif
-    
+
     return true;
 }
 
 static INLINE void*
-SI_map(FSFileHandle *self, int64_t offset, int64_t len)
-{
+SI_map(FSFileHandle *self, int64_t offset, int64_t len) {
     void *buf = NULL;
 
     if (len) {
         // Read-only memory mapping.
         buf = mmap(NULL, len, PROT_READ, MAP_SHARED, self->fd, offset);
         if (buf == (void*)-1) {
-            Err_set_error(Err_new(CB_newf(
-                "mmap of offset %i64 and length %i64 (page size %i64) "
-                "against '%o' failed: %s", offset, len, self->page_size,
-                self->path, strerror(errno))));
+            Err_set_error(Err_new(CB_newf("mmap of offset %i64 and length %i64 (page size %i64) "
+                                          "against '%o' failed: %s",
+                                          offset, len, self->page_size,
+                                          self->path, strerror(errno))));
             return NULL;
         }
     }
@@ -395,12 +378,11 @@ SI_map(FSFileHandle *self, int64_t offse
 }
 
 static INLINE bool_t
-SI_unmap(FSFileHandle *self, char *buf, int64_t len)
-{
+SI_unmap(FSFileHandle *self, char *buf, int64_t len) {
     if (buf != NULL) {
         if (munmap(buf, len)) {
             Err_set_error(Err_new(CB_newf("Failed to munmap '%o': %s",
-                self->path, strerror(errno))));
+                                          self->path, strerror(errno))));
             return false;
         }
     }
@@ -409,14 +391,13 @@ SI_unmap(FSFileHandle *self, char *buf, 
 
 #if !IS_64_BIT
 bool_t
-FSFH_read(FSFileHandle *self, char *dest, int64_t offset, size_t len)
-{
+FSFH_read(FSFileHandle *self, char *dest, int64_t offset, size_t len) {
     int64_t check_val;
-    
+
     // Sanity check.
     if (offset < 0) {
-        Err_set_error(Err_new(CB_newf(
-            "Can't read from an offset less than 0 (%i64)", offset)));
+        Err_set_error(Err_new(CB_newf("Can't read from an offset less than 0 (%i64)",
+                                      offset)));
         return false;
     }
 
@@ -424,14 +405,12 @@ FSFH_read(FSFileHandle *self, char *dest
     check_val = pread64(self->fd, dest, len, offset);
     if (check_val != (int64_t)len) {
         if (check_val == -1) {
-            Err_set_error(Err_new(CB_newf(
-                "Tried to read %u64 bytes, got %i64: %s",
-                (uint64_t)len, check_val, strerror(errno))));
+            Err_set_error(Err_new(CB_newf("Tried to read %u64 bytes, got %i64: %s",
+                                          (uint64_t)len, check_val, strerror(errno))));
         }
         else {
-            Err_set_error(Err_new(CB_newf(
-                "Tried to read %u64 bytes, got %i64", 
-                (uint64_t)len, check_val)));
+            Err_set_error(Err_new(CB_newf("Tried to read %u64 bytes, got %i64",
+                                          (uint64_t)len, check_val)));
         }
         return false;
     }
@@ -444,9 +423,8 @@ FSFH_read(FSFileHandle *self, char *dest
 
 #elif defined(CHY_HAS_WINDOWS_H)
 
-static INLINE bool_t 
-SI_init_read_only(FSFileHandle *self)
-{
+static INLINE bool_t
+SI_init_read_only(FSFileHandle *self) {
     LARGE_INTEGER large_int;
     char *filepath = (char*)CB_Get_Ptr8(self->path);
     SYSTEM_INFO sys_info;
@@ -457,18 +435,18 @@ SI_init_read_only(FSFileHandle *self)
 
     // Open.
     self->win_fhandle = CreateFile(
-        filepath,
-        GENERIC_READ,
-        FILE_SHARE_READ,
-        NULL,
-        OPEN_EXISTING,
-        FILE_ATTRIBUTE_READONLY | FILE_FLAG_OVERLAPPED,
-        NULL
-    );
+                            filepath,
+                            GENERIC_READ,
+                            FILE_SHARE_READ,
+                            NULL,
+                            OPEN_EXISTING,
+                            FILE_ATTRIBUTE_READONLY | FILE_FLAG_OVERLAPPED,
+                            NULL
+                        );
     if (self->win_fhandle == INVALID_HANDLE_VALUE) {
         char *win_error = Err_win_error();
-        Err_set_error(Err_new(CB_newf("CreateFile for %o failed: %s", 
-            self->path, win_error)));
+        Err_set_error(Err_new(CB_newf("CreateFile for %o failed: %s",
+                                      self->path, win_error)));
         FREEMEM(win_error);
         return false;
     }
@@ -477,9 +455,8 @@ SI_init_read_only(FSFileHandle *self)
     GetFileSizeEx(self->win_fhandle, &large_int);
     self->len = large_int.QuadPart;
     if (self->len < 0) {
-        Err_set_error(Err_new(CB_newf(
-            "GetFileSizeEx for %o returned a negative length: '%i64'", 
-            self->path, self->len)));
+        Err_set_error(Err_new(CB_newf("GetFileSizeEx for %o returned a negative length: '%i64'",
+                                      self->path, self->len)));
         return false;
     }
 
@@ -487,23 +464,21 @@ SI_init_read_only(FSFileHandle *self)
     self->buf = NULL;
     if (self->len) {
         self->win_maphandle = CreateFileMapping(self->win_fhandle, NULL,
-            PAGE_READONLY, 0, 0, NULL);
+                                                PAGE_READONLY, 0, 0, NULL);
         if (self->win_maphandle == NULL) {
             char *win_error = Err_win_error();
-            Err_set_error(Err_new(CB_newf(
-                "CreateFileMapping for %o failed: %s", 
-                self->path, win_error)));
+            Err_set_error(Err_new(CB_newf("CreateFileMapping for %o failed: %s",
+                                          self->path, win_error)));
             FREEMEM(win_error);
             return false;
         }
     }
-    
+
     return true;
 }
 
 static INLINE void*
-SI_map(FSFileHandle *self, int64_t offset, int64_t len)
-{
+SI_map(FSFileHandle *self, int64_t offset, int64_t len) {
     void *buf = NULL;
 
     if (len) {
@@ -512,18 +487,12 @@ SI_map(FSFileHandle *self, int64_t offse
         DWORD file_offset_hi = offs >> 32;
         DWORD file_offset_lo = offs & 0xFFFFFFFF;
         size_t amount = (size_t)len;
-        buf = MapViewOfFile(
-            self->win_maphandle, 
-            FILE_MAP_READ, 
-            file_offset_hi,
-            file_offset_lo,
-            amount
-        );
+        buf = MapViewOfFile(self->win_maphandle, FILE_MAP_READ,
+                            file_offset_hi, file_offset_lo, amount);
         if (buf == NULL) {
             char *win_error = Err_win_error();
-            Err_set_error(Err_new(CB_newf(
-                "MapViewOfFile for %o failed: %s", 
-                self->path, win_error)));
+            Err_set_error(Err_new(CB_newf("MapViewOfFile for %o failed: %s",
+                                          self->path, win_error)));
             FREEMEM(win_error);
         }
     }
@@ -532,13 +501,12 @@ SI_map(FSFileHandle *self, int64_t offse
 }
 
 static INLINE bool_t
-SI_unmap(FSFileHandle *self, char *buf, int64_t len)
-{
+SI_unmap(FSFileHandle *self, char *buf, int64_t len) {
     if (buf != NULL) {
         if (!UnmapViewOfFile(buf)) {
             char *win_error = Err_win_error();
-            Err_set_error(Err_new(CB_newf("Failed to unmap '%o': %s", 
-                self->path, win_error)));
+            Err_set_error(Err_new(CB_newf("Failed to unmap '%o': %s",
+                                          self->path, win_error)));
             FREEMEM(win_error);
             return false;
         }
@@ -546,15 +514,14 @@ SI_unmap(FSFileHandle *self, char *buf, 
     return true;
 }
 
-static INLINE bool_t 
-SI_close_win_handles(FSFileHandle *self)
-{
+static INLINE bool_t
+SI_close_win_handles(FSFileHandle *self) {
     // Close both standard handle and mapping handle.
     if (self->win_maphandle) {
         if (!CloseHandle(self->win_maphandle)) {
             char *win_error = Err_win_error();
-            Err_set_error(Err_new(CB_newf(
-                "Failed to close file mapping handle: %s", win_error)));
+            Err_set_error(Err_new(CB_newf("Failed to close file mapping handle: %s",
+                                          win_error)));
             FREEMEM(win_error);
             return false;
         }
@@ -564,7 +531,7 @@ SI_close_win_handles(FSFileHandle *self)
         if (!CloseHandle(self->win_fhandle)) {
             char *win_error = Err_win_error();
             Err_set_error(Err_new(CB_newf("Failed to close file handle: %s",
-                win_error)));
+                                          win_error)));
             FREEMEM(win_error);
             return false;
         }
@@ -576,8 +543,7 @@ SI_close_win_handles(FSFileHandle *self)
 
 #if !IS_64_BIT
 bool_t
-FSFH_read(FSFileHandle *self, char *dest, int64_t offset, size_t len)
-{
+FSFH_read(FSFileHandle *self, char *dest, int64_t offset, size_t len) {
     BOOL check_val;
     DWORD got;
     OVERLAPPED read_op_state;
@@ -586,19 +552,19 @@ FSFH_read(FSFileHandle *self, char *dest
     read_op_state.hEvent     = NULL;
     read_op_state.OffsetHigh = offs >> 32;
     read_op_state.Offset     = offs & 0xFFFFFFFF;
-    
+
     // Sanity check.
     if (offset < 0) {
-        Err_set_error(Err_new(CB_newf(
-            "Can't read from an offset less than 0 (%i64)", offset)));
+        Err_set_error(Err_new(CB_newf("Can't read from an offset less than 0 (%i64)",
+                                      offset)));
         return false;
     }
 
     // ReadFile() takes a DWORD (unsigned 32-bit integer) as a length
     // argument, so throw a sensible error rather than wrap around.
     if (len > U32_MAX) {
-        Err_set_error(Err_new(CB_newf(
-            "Can't read more than 4 GB (%u64)", (uint64_t)len))); 
+        Err_set_error(Err_new(CB_newf("Can't read more than 4 GB (%u64)",
+                                      (uint64_t)len)));
         return false;
     }
 
@@ -609,14 +575,14 @@ FSFH_read(FSFileHandle *self, char *dest
         // it, since this is a blocking IO call from the point of the rest of
         // the library.
         check_val = GetOverlappedResult(self->win_fhandle, &read_op_state,
-           &got, TRUE);
+                                        &got, TRUE);
     }
 
     // Verify that the read has succeeded by now.
     if (!check_val) {
         char *win_error = Err_win_error();
         Err_set_error(Err_new(CB_newf("Failed to read %u64 bytes: %s",
-            (uint64_t)len, win_error)));
+                                      (uint64_t)len, win_error)));
         FREEMEM(win_error);
         return false;
     }

Modified: incubator/lucy/trunk/core/Lucy/Store/FSFileHandle.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/FSFileHandle.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/FSFileHandle.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Store/FSFileHandle.cfh Sun May  1 23:50:24 2011
@@ -18,7 +18,7 @@ parcel Lucy;
 
 /** File system FileHandle.
  */
-class Lucy::Store::FSFileHandle cnick FSFH 
+class Lucy::Store::FSFileHandle cnick FSFH
     inherits Lucy::Store::FileHandle {
 
     int      fd;
@@ -34,10 +34,10 @@ class Lucy::Store::FSFileHandle cnick FS
      * @param path Filepath.
      * @param flags FileHandle constructor flags.
      */
-    inert incremented nullable FSFileHandle* 
+    inert incremented nullable FSFileHandle*
     open(const CharBuf *path = NULL, uint32_t flags);
 
-    inert nullable FSFileHandle* 
+    inert nullable FSFileHandle*
     do_open(FSFileHandle *self, const CharBuf *path = NULL, uint32_t flags);
 
     bool_t

Modified: incubator/lucy/trunk/core/Lucy/Store/FSFolder.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/FSFolder.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/FSFolder.c (original)
+++ incubator/lucy/trunk/core/Lucy/Store/FSFolder.c Sun May  1 23:50:24 2011
@@ -67,15 +67,13 @@ bool_t
 S_hard_link(CharBuf *from_path, CharBuf *to_path);
 
 FSFolder*
-FSFolder_new(const CharBuf *path) 
-{
+FSFolder_new(const CharBuf *path) {
     FSFolder *self = (FSFolder*)VTable_Make_Obj(FSFOLDER);
     return FSFolder_init(self, path);
 }
 
 FSFolder*
-FSFolder_init(FSFolder *self, const CharBuf *path)
-{
+FSFolder_init(FSFolder *self, const CharBuf *path) {
     CharBuf *abs_path = FSFolder_absolutify(path);
     Folder_init((Folder*)self, abs_path);
     DECREF(abs_path);
@@ -83,8 +81,7 @@ FSFolder_init(FSFolder *self, const Char
 }
 
 void
-FSFolder_initialize(FSFolder *self)
-{
+FSFolder_initialize(FSFolder *self) {
     if (!S_dir_ok(self->path)) {
         if (!S_create_dir(self->path)) {
             RETHROW(INCREF(Err_get_error()));
@@ -93,14 +90,13 @@ FSFolder_initialize(FSFolder *self)
 }
 
 bool_t
-FSFolder_check(FSFolder *self)
-{
+FSFolder_check(FSFolder *self) {
     return S_dir_ok(self->path);
 }
 
 FileHandle*
-FSFolder_local_open_filehandle(FSFolder *self, const CharBuf *name, uint32_t flags)
-{
+FSFolder_local_open_filehandle(FSFolder *self, const CharBuf *name,
+                               uint32_t flags) {
     CharBuf      *fullpath = S_fullpath(self, name);
     FSFileHandle *fh = FSFH_open(fullpath, flags);
     if (!fh) { ERR_ADD_FRAME(Err_get_error()); }
@@ -109,8 +105,7 @@ FSFolder_local_open_filehandle(FSFolder 
 }
 
 bool_t
-FSFolder_local_mkdir(FSFolder *self, const CharBuf *name)
-{
+FSFolder_local_mkdir(FSFolder *self, const CharBuf *name) {
     CharBuf *dir = S_fullpath(self, name);
     bool_t result = S_create_dir(dir);
     if (!result) { ERR_ADD_FRAME(Err_get_error()); }
@@ -119,16 +114,14 @@ FSFolder_local_mkdir(FSFolder *self, con
 }
 
 DirHandle*
-FSFolder_local_open_dir(FSFolder *self)
-{
+FSFolder_local_open_dir(FSFolder *self) {
     DirHandle *dh = (DirHandle*)FSDH_open(self->path);
     if (!dh) { ERR_ADD_FRAME(Err_get_error()); }
     return dh;
 }
 
 bool_t
-FSFolder_local_exists(FSFolder *self, const CharBuf *name)
-{
+FSFolder_local_exists(FSFolder *self, const CharBuf *name) {
     if (Hash_Fetch(self->entries, (Obj*)name)) {
         return true;
     }
@@ -148,12 +141,11 @@ FSFolder_local_exists(FSFolder *self, co
 }
 
 bool_t
-FSFolder_local_is_directory(FSFolder *self, const CharBuf *name)
-{
+FSFolder_local_is_directory(FSFolder *self, const CharBuf *name) {
     // Check for a cached object, then fall back to a system call.
     Obj *elem = Hash_Fetch(self->entries, (Obj*)name);
-    if (elem && Obj_Is_A(elem, FOLDER)) { 
-        return true; 
+    if (elem && Obj_Is_A(elem, FOLDER)) {
+        return true;
     }
     else {
         CharBuf *fullpath = S_fullpath(self, name);
@@ -164,15 +156,14 @@ FSFolder_local_is_directory(FSFolder *se
 }
 
 bool_t
-FSFolder_rename(FSFolder *self, const CharBuf* from, const CharBuf *to)
-{
+FSFolder_rename(FSFolder *self, const CharBuf* from, const CharBuf *to) {
     CharBuf *from_path = S_fullpath(self, from);
     CharBuf *to_path   = S_fullpath(self, to);
-    bool_t   retval    = !rename((char*)CB_Get_Ptr8(from_path), 
-        (char*)CB_Get_Ptr8(to_path));
+    bool_t   retval    = !rename((char*)CB_Get_Ptr8(from_path),
+                                 (char*)CB_Get_Ptr8(to_path));
     if (!retval) {
         Err_set_error(Err_new(CB_newf("rename from '%o' to '%o' failed: %s",
-            from_path, to_path, strerror(errno))));
+                                      from_path, to_path, strerror(errno))));
     }
     DECREF(from_path);
     DECREF(to_path);
@@ -180,9 +171,8 @@ FSFolder_rename(FSFolder *self, const Ch
 }
 
 bool_t
-FSFolder_hard_link(FSFolder *self, const CharBuf *from, 
-                   const CharBuf *to)
-{
+FSFolder_hard_link(FSFolder *self, const CharBuf *from,
+                   const CharBuf *to) {
     CharBuf *from_path = S_fullpath(self, from);
     CharBuf *to_path   = S_fullpath(self, to);
     bool_t   retval    = S_hard_link(from_path, to_path);
@@ -192,14 +182,13 @@ FSFolder_hard_link(FSFolder *self, const
 }
 
 bool_t
-FSFolder_local_delete(FSFolder *self, const CharBuf *name)
-{
+FSFolder_local_delete(FSFolder *self, const CharBuf *name) {
     CharBuf *fullpath = S_fullpath(self, name);
     char    *path_ptr = (char*)CB_Get_Ptr8(fullpath);
 #ifdef CHY_REMOVE_ZAPS_DIRS
     bool_t result = !remove(path_ptr);
-#else 
-    bool_t result = !rmdir(path_ptr) || !remove(path_ptr); 
+#else
+    bool_t result = !rmdir(path_ptr) || !remove(path_ptr);
 #endif
     DECREF(Hash_Delete(self->entries, (Obj*)name));
     DECREF(fullpath);
@@ -207,14 +196,12 @@ FSFolder_local_delete(FSFolder *self, co
 }
 
 void
-FSFolder_close(FSFolder *self)
-{
+FSFolder_close(FSFolder *self) {
     Hash_Clear(self->entries);
 }
 
 Folder*
-FSFolder_local_find_folder(FSFolder *self, const CharBuf *name)
-{
+FSFolder_local_find_folder(FSFolder *self, const CharBuf *name) {
     Folder *subfolder = NULL;
     if (!name || !CB_Get_Size(name)) {
         // No entity can be identified by NULL or empty string.
@@ -261,8 +248,7 @@ FSFolder_local_find_folder(FSFolder *sel
 }
 
 static CharBuf*
-S_fullpath(FSFolder *self, const CharBuf *path)
-{
+S_fullpath(FSFolder *self, const CharBuf *path) {
     CharBuf *fullpath = CB_newf("%o%s%o", self->path, DIR_SEP, path);
     if (DIR_SEP[0] != '/') {
         CB_Swap_Chars(fullpath, '/', DIR_SEP[0]);
@@ -271,8 +257,7 @@ S_fullpath(FSFolder *self, const CharBuf
 }
 
 static bool_t
-S_dir_ok(const CharBuf *path)
-{
+S_dir_ok(const CharBuf *path) {
     struct stat stat_buf;
     if (stat((char*)CB_Get_Ptr8(path), &stat_buf) != -1) {
         if (stat_buf.st_mode & S_IFDIR) return true;
@@ -281,19 +266,17 @@ S_dir_ok(const CharBuf *path)
 }
 
 bool_t
-S_create_dir(const CharBuf *path)
-{
+S_create_dir(const CharBuf *path) {
     if (-1 == chy_makedir((char*)CB_Get_Ptr8(path), 0777)) {
-        Err_set_error(Err_new(CB_newf(
-            "Couldn't create directory '%o': %s", path, strerror(errno))));
+        Err_set_error(Err_new(CB_newf("Couldn't create directory '%o': %s",
+                                      path, strerror(errno))));
         return false;
     }
     return true;
 }
 
 bool_t
-S_is_local_entry(const CharBuf *path)
-{
+S_is_local_entry(const CharBuf *path) {
     ZombieCharBuf *scratch = ZCB_WRAP(path);
     uint32_t code_point;
     while (0 != (code_point = ZCB_Nip_One(scratch))) {
@@ -307,15 +290,13 @@ S_is_local_entry(const CharBuf *path)
 #ifdef CHY_HAS_UNISTD_H
 
 bool_t
-S_hard_link(CharBuf *from_path, CharBuf *to_path)
-{
+S_hard_link(CharBuf *from_path, CharBuf *to_path) {
     char *from8 = (char*)CB_Get_Ptr8(from_path);
     char *to8   = (char*)CB_Get_Ptr8(to_path);
 
     if (-1 == link(from8, to8)) {
-        Err_set_error(Err_new(CB_newf(
-            "hard link for new file '%o' from '%o' failed: %s",
-                to_path, from_path, strerror(errno))));
+        Err_set_error(Err_new(CB_newf("hard link for new file '%o' from '%o' failed: %s",
+                                      to_path, from_path, strerror(errno))));
         return false;
     }
     else {
@@ -338,8 +319,7 @@ S_hard_link(CharBuf *from_path, CharBuf 
 #include <windows.h>
 
 bool_t
-S_hard_link(CharBuf *from_path, CharBuf *to_path)
-{
+S_hard_link(CharBuf *from_path, CharBuf *to_path) {
     char *from8 = (char*)CB_Get_Ptr8(from_path);
     char *to8   = (char*)CB_Get_Ptr8(to_path);
 
@@ -348,9 +328,8 @@ S_hard_link(CharBuf *from_path, CharBuf 
     }
     else {
         char *win_error = Err_win_error();
-        Err_set_error(Err_new(CB_newf(
-            "CreateHardLink for new file '%o' from '%o' failed: %s",
-                to_path, from_path, win_error)));
+        Err_set_error(Err_new(CB_newf("CreateHardLink for new file '%o' from '%o' failed: %s",
+                                      to_path, from_path, win_error)));
         FREEMEM(win_error);
         return false;
     }

Modified: incubator/lucy/trunk/core/Lucy/Store/FSFolder.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/FSFolder.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/FSFolder.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Store/FSFolder.cfh Sun May  1 23:50:24 2011
@@ -51,13 +51,13 @@ class Lucy::Store::FSFolder inherits Luc
     Close(FSFolder *self);
 
     incremented nullable FileHandle*
-    Local_Open_FileHandle(FSFolder *self, const CharBuf *name, 
+    Local_Open_FileHandle(FSFolder *self, const CharBuf *name,
                           uint32_t flags);
 
     incremented nullable DirHandle*
     Local_Open_Dir(FSFolder *self);
 
-    bool_t 
+    bool_t
     Local_MkDir(FSFolder *self, const CharBuf *name);
 
     bool_t
@@ -69,10 +69,10 @@ class Lucy::Store::FSFolder inherits Luc
     nullable Folder*
     Local_Find_Folder(FSFolder *self, const CharBuf *name);
 
-    bool_t 
+    bool_t
     Local_Delete(FSFolder *self, const CharBuf *name);
 
-    public bool_t 
+    public bool_t
     Rename(FSFolder *self, const CharBuf* from, const CharBuf *to);
 
     public bool_t

Modified: incubator/lucy/trunk/core/Lucy/Store/FileHandle.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/FileHandle.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/FileHandle.c (original)
+++ incubator/lucy/trunk/core/Lucy/Store/FileHandle.c Sun May  1 23:50:24 2011
@@ -24,8 +24,7 @@
 int32_t FH_object_count = 0;
 
 FileHandle*
-FH_do_open(FileHandle *self, const CharBuf *path, uint32_t flags)
-{
+FH_do_open(FileHandle *self, const CharBuf *path, uint32_t flags) {
     self->path    = path ? CB_Clone(path) : CB_new(0);
     self->flags   = flags;
 
@@ -37,8 +36,7 @@ FH_do_open(FileHandle *self, const CharB
 }
 
 void
-FH_destroy(FileHandle *self)
-{
+FH_destroy(FileHandle *self) {
     FH_Close(self);
     DECREF(self->path);
     SUPER_DESTROY(self, FILEHANDLE);
@@ -48,20 +46,20 @@ FH_destroy(FileHandle *self)
 }
 
 bool_t
-FH_grow(FileHandle *self, int64_t length)
-{
+FH_grow(FileHandle *self, int64_t length) {
     UNUSED_VAR(self);
     UNUSED_VAR(length);
     return true;
 }
 
 void
-FH_set_path(FileHandle *self, const CharBuf *path)
-{
+FH_set_path(FileHandle *self, const CharBuf *path) {
     CB_Mimic(self->path, (Obj*)path);
 }
 
 CharBuf*
-FH_get_path(FileHandle *self) { return self->path; }
+FH_get_path(FileHandle *self) {
+    return self->path;
+}
 
 

Modified: incubator/lucy/trunk/core/Lucy/Store/FileHandle.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/FileHandle.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/FileHandle.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Store/FileHandle.cfh Sun May  1 23:50:24 2011
@@ -43,7 +43,7 @@ abstract class Lucy::Store::FileHandle c
      * FileHandle objects, they're the canary in the coal mine for detecting
      * object-destruction memory leaks.
      */
-    inert int32_t object_count; 
+    inert int32_t object_count;
 
     /** Abstract constructor.
      *
@@ -70,7 +70,7 @@ abstract class Lucy::Store::FileHandle c
      *
      * @return true on success, false on failure (sets Err_error)
      */
-    abstract bool_t 
+    abstract bool_t
     Release_Window(FileHandle *self, FileWindow *window);
 
     /** Copy file content into the supplied buffer.
@@ -95,7 +95,7 @@ abstract class Lucy::Store::FileHandle c
     /** Return the current length of the file in bytes, or set Err_error and
      * return -1 on failure.
      */
-    abstract int64_t 
+    abstract int64_t
     Length(FileHandle *self);
 
     /** Advisory call alerting the FileHandle that it should prepare to occupy

Modified: incubator/lucy/trunk/core/Lucy/Store/FileWindow.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/FileWindow.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/FileWindow.c (original)
+++ incubator/lucy/trunk/core/Lucy/Store/FileWindow.c Sun May  1 23:50:24 2011
@@ -20,33 +20,30 @@
 #include "Lucy/Store/FileWindow.h"
 
 FileWindow*
-FileWindow_new()
-{
+FileWindow_new() {
     FileWindow *self = (FileWindow*)VTable_Make_Obj(FILEWINDOW);
     return FileWindow_init(self);
 }
 
 FileWindow*
-FileWindow_init(FileWindow *self)
-{
+FileWindow_init(FileWindow *self) {
     return self;
 }
 
 void
-FileWindow_set_offset(FileWindow *self, int64_t offset)
-{
+FileWindow_set_offset(FileWindow *self, int64_t offset) {
     if (self->buf != NULL) {
         if (offset != self->offset) {
             THROW(ERR, "Can't set offset to %i64 instead of %i64 unless buf "
-                "is NULL", offset, self->offset);
+                  "is NULL", offset, self->offset);
         }
     }
     self->offset = offset;
 }
 
 void
-FileWindow_set_window(FileWindow *self, char *buf, int64_t offset, int64_t len)
-{
+FileWindow_set_window(FileWindow *self, char *buf, int64_t offset,
+                      int64_t len) {
     self->buf    = buf;
     self->offset = offset;
     self->len    = len;

Modified: incubator/lucy/trunk/core/Lucy/Store/Folder.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/Folder.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/Folder.c (original)
+++ incubator/lucy/trunk/core/Lucy/Store/Folder.c Sun May  1 23:50:24 2011
@@ -33,8 +33,7 @@
 #include "Lucy/Util/IndexFileNames.h"
 
 Folder*
-Folder_init(Folder *self, const CharBuf *path)
-{
+Folder_init(Folder *self, const CharBuf *path) {
     // Init.
     self->entries = Hash_new(16);
 
@@ -55,16 +54,14 @@ Folder_init(Folder *self, const CharBuf 
 }
 
 void
-Folder_destroy(Folder *self)
-{
+Folder_destroy(Folder *self) {
     DECREF(self->path);
     DECREF(self->entries);
     SUPER_DESTROY(self, FOLDER);
 }
 
 InStream*
-Folder_open_in(Folder *self, const CharBuf *path)
-{
+Folder_open_in(Folder *self, const CharBuf *path) {
     Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
     InStream *instream = NULL;
 
@@ -86,11 +83,10 @@ Folder_open_in(Folder *self, const CharB
  * necessary because calling CFReader_Local_Open_FileHandle() won't find
  * virtual files.  No other class should need to override it. */
 InStream*
-Folder_local_open_in(Folder *self, const CharBuf *name)
-{
+Folder_local_open_in(Folder *self, const CharBuf *name) {
     FileHandle *fh = Folder_Local_Open_FileHandle(self, name, FH_READ_ONLY);
     InStream *instream = NULL;
-    if (fh) { 
+    if (fh) {
         instream = InStream_open((Obj*)fh);
         DECREF(fh);
         if (!instream) {
@@ -104,12 +100,11 @@ Folder_local_open_in(Folder *self, const
 }
 
 OutStream*
-Folder_open_out(Folder *self, const CharBuf *path)
-{
+Folder_open_out(Folder *self, const CharBuf *path) {
     const uint32_t flags = FH_WRITE_ONLY | FH_CREATE | FH_EXCLUSIVE;
     FileHandle *fh = Folder_Open_FileHandle(self, path, flags);
     OutStream *outstream = NULL;
-    if (fh) { 
+    if (fh) {
         outstream = OutStream_open((Obj*)fh);
         DECREF(fh);
         if (!outstream) {
@@ -123,15 +118,14 @@ Folder_open_out(Folder *self, const Char
 }
 
 FileHandle*
-Folder_open_filehandle(Folder *self, const CharBuf *path, uint32_t flags)
-{
+Folder_open_filehandle(Folder *self, const CharBuf *path, uint32_t flags) {
     Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
     FileHandle *fh = NULL;
 
     if (enclosing_folder) {
         ZombieCharBuf *name = IxFileNames_local_part(path, ZCB_BLANK());
-        fh = Folder_Local_Open_FileHandle(enclosing_folder, 
-            (CharBuf*)name, flags);
+        fh = Folder_Local_Open_FileHandle(enclosing_folder,
+                                          (CharBuf*)name, flags);
         if (!fh) {
             ERR_ADD_FRAME(Err_get_error());
         }
@@ -144,8 +138,7 @@ Folder_open_filehandle(Folder *self, con
 }
 
 bool_t
-Folder_delete(Folder *self, const CharBuf *path)
-{
+Folder_delete(Folder *self, const CharBuf *path) {
     Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
     if (enclosing_folder) {
         ZombieCharBuf *name = IxFileNames_local_part(path, ZCB_BLANK());
@@ -158,8 +151,7 @@ Folder_delete(Folder *self, const CharBu
 }
 
 bool_t
-Folder_delete_tree(Folder *self, const CharBuf *path)
-{
+Folder_delete_tree(Folder *self, const CharBuf *path) {
     Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
 
     // Don't allow Folder to delete itself.
@@ -168,31 +160,31 @@ Folder_delete_tree(Folder *self, const C
     if (enclosing_folder) {
         ZombieCharBuf *local = IxFileNames_local_part(path, ZCB_BLANK());
         if (Folder_Local_Is_Directory(enclosing_folder, (CharBuf*)local)) {
-            Folder *inner_folder 
+            Folder *inner_folder
                 = Folder_Local_Find_Folder(enclosing_folder, (CharBuf*)local);
             DirHandle *dh = Folder_Local_Open_Dir(inner_folder);
             if (dh) {
                 VArray *files = VA_new(20);
                 VArray *dirs  = VA_new(20);
                 CharBuf *entry = DH_Get_Entry(dh);
-                while (DH_Next(dh)) { 
-                    VA_Push(files, (Obj*)CB_Clone(entry)); 
+                while (DH_Next(dh)) {
+                    VA_Push(files, (Obj*)CB_Clone(entry));
                     if (DH_Entry_Is_Dir(dh) && !DH_Entry_Is_Symlink(dh)) {
-                        VA_Push(dirs, (Obj*)CB_Clone(entry)); 
+                        VA_Push(dirs, (Obj*)CB_Clone(entry));
                     }
                 }
                 for (uint32_t i = 0, max = VA_Get_Size(dirs); i < max; i++) {
                     CharBuf *name = (CharBuf*)VA_Fetch(files, i);
                     bool_t success = Folder_Delete_Tree(inner_folder, name);
-                    if (!success && Folder_Local_Exists(inner_folder, name)) { 
-                        break; 
+                    if (!success && Folder_Local_Exists(inner_folder, name)) {
+                        break;
                     }
                 }
                 for (uint32_t i = 0, max = VA_Get_Size(files); i < max; i++) {
                     CharBuf *name = (CharBuf*)VA_Fetch(files, i);
                     bool_t success = Folder_Local_Delete(inner_folder, name);
-                    if (!success && Folder_Local_Exists(inner_folder, name)) { 
-                        break; 
+                    if (!success && Folder_Local_Exists(inner_folder, name)) {
+                        break;
                     }
                 }
                 DECREF(dirs);
@@ -209,8 +201,7 @@ Folder_delete_tree(Folder *self, const C
 }
 
 static bool_t
-S_is_updir(CharBuf *path)
-{
+S_is_updir(CharBuf *path) {
     if (CB_Equals_Str(path, ".", 1) || CB_Equals_Str(path, "..", 2)) {
         return true;
     }
@@ -220,8 +211,7 @@ S_is_updir(CharBuf *path)
 }
 
 static void
-S_add_to_file_list(Folder *self, VArray *list, CharBuf *dir, CharBuf *prefix)
-{
+S_add_to_file_list(Folder *self, VArray *list, CharBuf *dir, CharBuf *prefix) {
     size_t     orig_prefix_size = CB_Get_Size(prefix);
     DirHandle *dh = Folder_Open_Dir(self, dir);
     CharBuf   *entry;
@@ -240,9 +230,9 @@ S_add_to_file_list(Folder *self, VArray 
             VA_Push(list, (Obj*)relpath);
 
             if (DH_Entry_Is_Dir(dh) && !DH_Entry_Is_Symlink(dh)) {
-                CharBuf *subdir = CB_Get_Size(dir) 
-                                ? CB_newf("%o/%o", dir, entry)
-                                : CB_Clone(entry);
+                CharBuf *subdir = CB_Get_Size(dir)
+                                  ? CB_newf("%o/%o", dir, entry)
+                                  : CB_Clone(entry);
                 CB_catf(prefix, "%o/", entry);
                 S_add_to_file_list(self, list, subdir, prefix); // recurse
                 CB_Set_Size(prefix, orig_prefix_size);
@@ -258,11 +248,9 @@ S_add_to_file_list(Folder *self, VArray 
 }
 
 DirHandle*
-Folder_open_dir(Folder *self, const CharBuf *path)
-{
-    DirHandle *dh     = NULL;
-    Folder    *folder = Folder_Find_Folder(self, 
-        path ? path : (CharBuf*)&EMPTY);
+Folder_open_dir(Folder *self, const CharBuf *path) {
+    DirHandle *dh = NULL;
+    Folder *folder = Folder_Find_Folder(self, path ? path : (CharBuf*)&EMPTY);
     if (!folder) {
         Err_set_error(Err_new(CB_newf("Invalid path: '%o'", path)));
     }
@@ -276,8 +264,7 @@ Folder_open_dir(Folder *self, const Char
 }
 
 bool_t
-Folder_mkdir(Folder *self, const CharBuf *path)
-{
+Folder_mkdir(Folder *self, const CharBuf *path) {
     Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
     bool_t result = false;
 
@@ -285,8 +272,8 @@ Folder_mkdir(Folder *self, const CharBuf
         Err_set_error(Err_new(CB_newf("Invalid path: '%o'", path)));
     }
     else if (!enclosing_folder) {
-        Err_set_error(Err_new(CB_newf(
-            "Can't recursively create dir %o", path)));
+        Err_set_error(Err_new(CB_newf("Can't recursively create dir %o",
+                                      path)));
     }
     else {
         ZombieCharBuf *name = IxFileNames_local_part(path, ZCB_BLANK());
@@ -300,8 +287,7 @@ Folder_mkdir(Folder *self, const CharBuf
 }
 
 bool_t
-Folder_exists(Folder *self, const CharBuf *path)
-{
+Folder_exists(Folder *self, const CharBuf *path) {
     Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
     bool_t retval = false;
     if (enclosing_folder) {
@@ -314,8 +300,7 @@ Folder_exists(Folder *self, const CharBu
 }
 
 bool_t
-Folder_is_directory(Folder *self, const CharBuf *path)
-{
+Folder_is_directory(Folder *self, const CharBuf *path) {
     Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
     bool_t retval = false;
     if (enclosing_folder) {
@@ -328,8 +313,7 @@ Folder_is_directory(Folder *self, const 
 }
 
 VArray*
-Folder_list(Folder *self, const CharBuf *path)
-{
+Folder_list(Folder *self, const CharBuf *path) {
     Folder *local_folder = Folder_Find_Folder(self, path);
     VArray *list = NULL;
     DirHandle *dh = Folder_Local_Open_Dir(local_folder);
@@ -346,8 +330,7 @@ Folder_list(Folder *self, const CharBuf 
 }
 
 VArray*
-Folder_list_r(Folder *self, const CharBuf *path)
-{
+Folder_list_r(Folder *self, const CharBuf *path) {
     Folder *local_folder = Folder_Find_Folder(self, path);
     VArray *list =  VA_new(0);
     if (local_folder) {
@@ -364,13 +347,12 @@ Folder_list_r(Folder *self, const CharBu
 }
 
 ByteBuf*
-Folder_slurp_file(Folder *self, const CharBuf *path)
-{
+Folder_slurp_file(Folder *self, const CharBuf *path) {
     InStream *instream = Folder_Open_In(self, path);
     ByteBuf  *retval   = NULL;
 
-    if (!instream) { 
-        RETHROW(INCREF(Err_get_error())); 
+    if (!instream) {
+        RETHROW(INCREF(Err_get_error()));
     }
     else {
         uint64_t length = InStream_Length(instream);
@@ -379,8 +361,8 @@ Folder_slurp_file(Folder *self, const Ch
             InStream_Close(instream);
             DECREF(instream);
             THROW(ERR, "File %o is too big to slurp (%u64 bytes)", path,
-                length);
-        } 
+                  length);
+        }
         else {
             size_t size = (size_t)length;
             char *ptr = (char*)MALLOCATE((size_t)size + 1);
@@ -396,17 +378,18 @@ Folder_slurp_file(Folder *self, const Ch
 }
 
 CharBuf*
-Folder_get_path(Folder *self) { return self->path; }
+Folder_get_path(Folder *self) {
+    return self->path;
+}
+
 void
-Folder_set_path(Folder *self, const CharBuf *path)
-{
+Folder_set_path(Folder *self, const CharBuf *path) {
     DECREF(self->path);
     self->path = CB_Clone(path);
 }
 
 void
-Folder_consolidate(Folder *self, const CharBuf *path)
-{
+Folder_consolidate(Folder *self, const CharBuf *path) {
     Folder *folder = Folder_Find_Folder(self, path);
     Folder *enclosing_folder = Folder_Enclosing_Folder(self, path);
     if (!folder) {
@@ -423,15 +406,14 @@ Folder_consolidate(Folder *self, const C
             ZombieCharBuf *name = IxFileNames_local_part(path, ZCB_BLANK());
             CompoundFileReader *cf_reader = CFReader_open(folder);
             if (!cf_reader) { RETHROW(INCREF(Err_get_error())); }
-            Hash_Store(enclosing_folder->entries, (Obj*)name, 
-                (Obj*)cf_reader);
+            Hash_Store(enclosing_folder->entries, (Obj*)name,
+                       (Obj*)cf_reader);
         }
     }
 }
 
 static Folder*
-S_enclosing_folder(Folder *self, ZombieCharBuf *path) 
-{
+S_enclosing_folder(Folder *self, ZombieCharBuf *path) {
     size_t path_component_len = 0;
     uint32_t code_point;
 
@@ -442,10 +424,10 @@ S_enclosing_folder(Folder *self, ZombieC
     ZombieCharBuf *scratch        = ZCB_WRAP((CharBuf*)path);
     ZombieCharBuf *path_component = ZCB_WRAP((CharBuf*)path);
     while (0 != (code_point = ZCB_Nip_One(scratch))) {
-        if (code_point == '/') { 
+        if (code_point == '/') {
             ZCB_Truncate(path_component, path_component_len);
             ZCB_Nip(path, path_component_len + 1);
-            break; 
+            break;
         }
         path_component_len++;
     }
@@ -454,7 +436,7 @@ S_enclosing_folder(Folder *self, ZombieC
     if (ZCB_Get_Size(scratch) == 0) { return self; }
 
     {
-        Folder *local_folder 
+        Folder *local_folder
             = Folder_Local_Find_Folder(self, (CharBuf*)path_component);
         if (!local_folder) {
             /* This element of the filepath doesn't exist, or it's not a
@@ -470,15 +452,13 @@ S_enclosing_folder(Folder *self, ZombieC
 }
 
 Folder*
-Folder_enclosing_folder(Folder *self, const CharBuf *path)
-{
+Folder_enclosing_folder(Folder *self, const CharBuf *path) {
     ZombieCharBuf *scratch = ZCB_WRAP(path);
     return S_enclosing_folder(self, scratch);
 }
 
 Folder*
-Folder_find_folder(Folder *self, const CharBuf *path)
-{
+Folder_find_folder(Folder *self, const CharBuf *path) {
     if (!path || !CB_Get_Size(path)) {
         return self;
     }
@@ -489,8 +469,8 @@ Folder_find_folder(Folder *self, const C
             return NULL;
         }
         else {
-            return Folder_Local_Find_Folder(enclosing_folder, 
-                (CharBuf*)scratch);
+            return Folder_Local_Find_Folder(enclosing_folder,
+                                            (CharBuf*)scratch);
         }
     }
 }

Modified: incubator/lucy/trunk/core/Lucy/Store/Folder.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Store/Folder.cfh?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Store/Folder.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Store/Folder.cfh Sun May  1 23:50:24 2011
@@ -33,7 +33,7 @@ abstract class Lucy::Store::Folder inher
 
     public inert nullable Folder*
     init(Folder *self, const CharBuf *path);
-    
+
     public void
     Destroy(Folder *self);
 
@@ -46,7 +46,7 @@ abstract class Lucy::Store::Folder inher
      */
     void
     Set_Path(Folder *self, const CharBuf *path);
-    
+
     /** Open an OutStream, or set Err_error and return NULL on failure.
      *
      * @param path A relative filepath.
@@ -147,7 +147,7 @@ abstract class Lucy::Store::Folder inher
      * @param to The filepath after renaming.
      * @return true on success, false on failure.
      */
-    public abstract bool_t 
+    public abstract bool_t
     Rename(Folder *self, const CharBuf *from, const CharBuf *to);
 
     /** Create a hard link at path <code>to</code> pointing at the existing
@@ -202,7 +202,7 @@ abstract class Lucy::Store::Folder inher
      *
      * @return true on success.
      */
-    public abstract bool_t 
+    public abstract bool_t
     Check(Folder *self);
 
     /** Close the folder and release implementation-specific resources.