Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Unified Diff: native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.cc

Issue 2156503002: [NaCl SDK] Expose Google Drive to nacl_io. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.cc b/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.cc
index 954d8e3632e855a24f789463a2853298204f8cbf..f0819fa94d6b74e0c905256731401dbe9d14896f 100644
--- a/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.cc
@@ -14,6 +14,7 @@
#include <ppapi/c/pp_completion_callback.h>
#include <ppapi/c/pp_errors.h>
+#include "nacl_io/hash.h"
#include "nacl_io/html5fs/html5_fs_node.h"
#include "sdk_util/auto_lock.h"
@@ -29,29 +30,6 @@ int64_t strtoull(const char* nptr, char** endptr, int base) {
} // namespace
-// Continuing DJB2a hash
-ino_t Html5Fs::HashPathSegment(ino_t hash, const char *str, size_t len) {
- // First add the path seperator
- hash = (hash * static_cast<ino_t>(33)) ^ '/';
- while (len--) {
- hash = (hash * static_cast<ino_t>(33)) ^ *str++;
- }
- return hash;
-}
-
-ino_t Html5Fs::HashPath(const Path& path) {
- // Prime the DJB2a hash
- ino_t hash = 5381;
-
- // Apply a running DJB2a to each part of the path
- for (size_t segment = 0; segment < path.Size(); segment++) {
- const std::string& part = path.Part(segment);
- hash = HashPathSegment(hash, part.c_str(), part.length());
- }
- return hash;
-}
-
-
// For HTML5, the INO should be the one used by the system, however PPAPI
// does not provide access to the real INO. Instead, since HTML5 does not
// suport links, we assume that files are unique based on path to the base

Powered by Google App Engine
This is Rietveld 408576698