Skip to content

Commit

Permalink
Merge pull request #4 from boutil/master
Browse files Browse the repository at this point in the history
port to Ruby1.9+ a little bit further
  • Loading branch information
duairc committed Dec 24, 2013
2 parents 51d6ed7 + 0324e9f commit 13eca50
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ext/fusefs_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <ruby.h>
#include <unistd.h>
#include <ctype.h>

#ifdef DEBUG
#include <stdarg.h>
Expand Down Expand Up @@ -660,7 +662,8 @@ rf_open(const char *path, struct fuse_file_info *fi) {
/* We have the body, now save it the entire contents to our
* opened_file lists. */
newfile = ALLOC(opened_file);
value = rb_str2cstr(body,&newfile->size);
value = RSTRING_PTR(body);
newfile->size = RSTRING_LEN(body);
newfile->value = ALLOC_N(char,(newfile->size)+1);
memcpy(newfile->value,value,newfile->size);
newfile->value[newfile->size] = '\0';
Expand Down Expand Up @@ -715,7 +718,8 @@ rf_open(const char *path, struct fuse_file_info *fi) {
/* We have the body, now save it the entire contents to our
* opened_file lists. */
newfile = ALLOC(opened_file);
value = rb_str2cstr(body,&newfile->size);
value = RSTRING_PTR(body);
newfile->size = RSTRING_LEN(body);
newfile->value = ALLOC_N(char,(newfile->size)+1);
memcpy(newfile->value,value,newfile->size);
newfile->writesize = newfile->size+1;
Expand Down Expand Up @@ -1074,7 +1078,8 @@ rf_truncate(const char *path, off_t offset) {
rf_call(path,id_write_to,newstr);
} else {
long size;
char *str = rb_str2cstr(body,&size);
char *str = RSTRING_PTR(body);
size = RSTRING_LEN(body);

/* Just in case offset is bigger than the file. */
if (offset >= size) return 0;
Expand Down

0 comments on commit 13eca50

Please sign in to comment.