fix remaining lint errors

This commit is contained in:
Alan Kligman 2013-11-12 13:14:23 -05:00
parent c590f930e5
commit 638109f911
1 changed files with 46 additions and 46 deletions

View File

@ -121,46 +121,46 @@ define(function(require) {
var name = basename(path);
var parentPath = dirname(path);
if(ROOT_DIRECTORY_NAME == name) {
function check_root_directory_node(error, rootDirectoryNode) {
if(error) {
callback(error);
} else if(!rootDirectoryNode) {
function check_root_directory_node(error, rootDirectoryNode) {
if(error) {
callback(error);
} else if(!rootDirectoryNode) {
callback(new ENoEntry('path does not exist'));
} else {
callback(undefined, rootDirectoryNode);
}
}
// in: parent directory node
// out: parent directory data
function read_parent_directory_data(error, parentDirectoryNode) {
if(error) {
callback(error);
} else if(!(_(parentDirectoryNode).has('data') && parentDirectoryNode.type == MODE_DIRECTORY)) {
callback(new ENotDirectory('a component of the path prefix is not a directory'));
} else {
read_object(objectStore, parentDirectoryNode.data, get_node_id_from_parent_directory_data);
}
}
// in: parent directory data
// out: searched node id
function get_node_id_from_parent_directory_data(error, parentDirectoryData) {
if(error) {
callback(error);
} else {
if(!_(parentDirectoryData).has(name)) {
callback(new ENoEntry('path does not exist'));
} else {
callback(undefined, rootDirectoryNode);
var nodeId = parentDirectoryData[name].id;
read_object(objectStore, nodeId, callback);
}
}
}
if(ROOT_DIRECTORY_NAME == name) {
read_object(objectStore, ROOT_NODE_ID, check_root_directory_node);
} else {
// in: parent directory node
// out: parent directory data
function read_parent_directory_data(error, parentDirectoryNode) {
if(error) {
callback(error);
} else if(!_(parentDirectoryNode).has('data') || !parentDirectoryNode.type == MODE_DIRECTORY) {
callback(new ENotDirectory('a component of the path prefix is not a directory'));
} else {
read_object(objectStore, parentDirectoryNode.data, get_node_id_from_parent_directory_data);
}
}
// in: parent directory data
// out: searched node id
function get_node_id_from_parent_directory_data(error, parentDirectoryData) {
if(error) {
callback(error);
} else {
if(!_(parentDirectoryData).has(name)) {
callback(new ENoEntry('path does not exist'));
} else {
var nodeId = parentDirectoryData[name].id;
read_object(objectStore, nodeId, callback);
}
}
}
find_node(objectStore, parentPath, read_parent_directory_data);
}
}
@ -1374,6 +1374,19 @@ define(function(require) {
}
}
function update_descriptor_position(error, stats) {
if(error) {
deferred.reject(error);
} else {
if(stats.size + offset < 0) {
deferred.reject(new EInvalid('resulting file offset would be negative'));
} else {
ofd.position = stats.size + offset;
deferred.resolve(ofd.position);
}
}
}
var ofd = that.openFiles[fd];
if(!ofd) {
@ -1398,19 +1411,6 @@ define(function(require) {
var transaction = that.db.transaction([FILE_STORE_NAME], IDB_RW);
var files = transaction.objectStore(FILE_STORE_NAME);
function update_descriptor_position(error, stats) {
if(error) {
deferred.reject(error);
} else {
if(stats.size + offset < 0) {
deferred.reject(new EInvalid('resulting file offset would be negative'));
} else {
ofd.position = stats.size + offset;
deferred.resolve(ofd.position);
}
}
}
fstat_file(files, ofd, update_descriptor_position);
} else {
deferred.reject(new EInvalid('whence argument is not a proper value'));