Mailing List Archive

r3709 - in trunk: c_src/KinoSearch/Store c_src/KinoSearch/Util/Compat perl/lib perl/lib/KinoSearch/Store
Author: creamyg
Date: 2008-08-03 16:23:46 -0700 (Sun, 03 Aug 2008)
New Revision: 3709

Modified:
trunk/c_src/KinoSearch/Store/Folder.c
trunk/c_src/KinoSearch/Util/Compat/DirManip.c
trunk/perl/lib/KinoSearch.pm
trunk/perl/lib/KinoSearch/Store/FSFolder.pm
trunk/perl/lib/KinoSearch/Store/Folder.pm
trunk/perl/lib/KinoSearch/Store/RAMFolder.pm
Log:
Fix crashing bug in DirManip_absolutify, and exploit fixed version by
tightening up constructor code for subclasses of Folder.


Modified: trunk/c_src/KinoSearch/Store/Folder.c
===================================================================
--- trunk/c_src/KinoSearch/Store/Folder.c 2008-08-03 22:49:34 UTC (rev 3708)
+++ trunk/c_src/KinoSearch/Store/Folder.c 2008-08-03 23:23:46 UTC (rev 3709)
@@ -10,6 +10,7 @@
#include "KinoSearch/Store/Lock.h"
#include "KinoSearch/Store/OutStream.h"
#include "KinoSearch/Util/ByteBuf.h"
+#include "KinoSearch/Util/Compat/DirManip.h"


/* If the file might belong in a virtual file and the appropriate compound
@@ -34,8 +35,8 @@
self->path = CB_new_from_trusted_utf8("", 0);
}
else {
- /* Copy path, strip trailing slash or equivalent. */
- self->path = CB_Clone(path);
+ /* Copy path, absolutify it, strip trailing slash or equivalent. */
+ self->path = DirManip_absolutify(path);
if (CB_Ends_With_Str(self->path, DIR_SEP, strlen(DIR_SEP)))
CB_Chop(self->path, 1);
}

Modified: trunk/c_src/KinoSearch/Util/Compat/DirManip.c
===================================================================
--- trunk/c_src/KinoSearch/Util/Compat/DirManip.c 2008-08-03 22:49:34 UTC (rev 3708)
+++ trunk/c_src/KinoSearch/Util/Compat/DirManip.c 2008-08-03 23:23:46 UTC (rev 3709)
@@ -31,8 +31,8 @@
kino_DirManip_absolutify(const kino_CharBuf *path)
{

- return (kino_CharBuf*)kino_Native_callback_obj(&KINO_DIRMANIP,
- "absolutify", 1, KINO_ARG_OBJ("path", path));
+ return kino_Native_callback_str(&KINO_DIRMANIP,
+ "absolutify", 1, KINO_ARG_STR("path", path));
}

kino_VArray*

Modified: trunk/perl/lib/KinoSearch/Store/FSFolder.pm
===================================================================
--- trunk/perl/lib/KinoSearch/Store/FSFolder.pm 2008-08-03 22:49:34 UTC (rev 3708)
+++ trunk/perl/lib/KinoSearch/Store/FSFolder.pm 2008-08-03 23:23:46 UTC (rev 3709)
@@ -15,7 +15,7 @@
my $constructor = $synopsis;

{ "KinoSearch::Store::FSFolder" => {
- make_constructors => ["_new"],
+ make_constructors => ["new"],
make_pod => {
synopsis => $synopsis,
constructor => { sample => $constructor },

Modified: trunk/perl/lib/KinoSearch/Store/Folder.pm
===================================================================
--- trunk/perl/lib/KinoSearch/Store/Folder.pm 2008-08-03 22:49:34 UTC (rev 3708)
+++ trunk/perl/lib/KinoSearch/Store/Folder.pm 2008-08-03 23:23:46 UTC (rev 3709)
@@ -23,7 +23,7 @@
close
)
],
- make_constructors => ["_new"],
+ make_constructors => ["new"],
make_getters => [qw( path )],
make_pod => {
synopsis => " # Abstract base class.\n",

Modified: trunk/perl/lib/KinoSearch/Store/RAMFolder.pm
===================================================================
--- trunk/perl/lib/KinoSearch/Store/RAMFolder.pm 2008-08-03 22:49:34 UTC (rev 3708)
+++ trunk/perl/lib/KinoSearch/Store/RAMFolder.pm 2008-08-03 23:23:46 UTC (rev 3709)
@@ -23,7 +23,7 @@

{ "KinoSearch::Store::RAMFolder" => {
bind_methods => [qw( ram_file )],
- make_constructors => ["_new"],
+ make_constructors => ["new"],
make_pod => {
synopsis => $synopsis,
constructor => { sample => $constructor },

Modified: trunk/perl/lib/KinoSearch.pm
===================================================================
--- trunk/perl/lib/KinoSearch.pm 2008-08-03 22:49:34 UTC (rev 3708)
+++ trunk/perl/lib/KinoSearch.pm 2008-08-03 23:23:46 UTC (rev 3709)
@@ -657,52 +657,19 @@

{
package KinoSearch::Store::Folder;
- use File::Spec::Functions qw( rel2abs );

- sub new {
- my ( $either, %args ) = @_;
- if ( defined $args{path} ) {
- $args{path} = rel2abs( $args{path} );
- }
- return $either->_new(%args);
- }
-
sub list { shift->_list->to_perl }
sub list_real_files { shift->_list_real_files->to_perl }
sub slurp_file { $_[0]->_slurp_file( $_[1] )->to_perl }
}

{
- package KinoSearch::Store::FSFolder;
- use File::Spec::Functions qw( rel2abs );
-
- sub new {
- my ( $either, %args ) = @_;
- $args{path} = rel2abs( $args{path} );
- return $either->_new(%args);
- }
-}
-
-{
package KinoSearch::Store::RAMFileDes;

sub contents { shift->_contents->to_perl }
}

{
- package KinoSearch::Store::RAMFolder;
- use File::Spec::Functions qw( rel2abs );
-
- sub new {
- my ( $either, %args ) = @_;
- if ( defined $args{path} ) {
- $args{path} = rel2abs( $args{path} );
- }
- return $either->_new(%args);
- }
-}
-
-{
package KinoSearch::Util::BitVector;

sub to_arrayref { shift->to_array->to_arrayref }


_______________________________________________
kinosearch-commits mailing list
kinosearch-commits@rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch-commits