| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "nacl_io/httpfs/http_fs.h" | 5 #include "nacl_io/httpfs/http_fs.h" |
| 6 | 6 |
| 7 #include <assert.h> | 7 #include <assert.h> |
| 8 #include <ctype.h> | 8 #include <ctype.h> |
| 9 #include <errno.h> | 9 #include <errno.h> |
| 10 #include <fcntl.h> | 10 #include <fcntl.h> |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 Error HttpFs::LoadManifest(const std::string& manifest_name, | 383 Error HttpFs::LoadManifest(const std::string& manifest_name, |
| 384 char** out_manifest) { | 384 char** out_manifest) { |
| 385 Path manifest_path(manifest_name); | 385 Path manifest_path(manifest_name); |
| 386 ScopedNode manifest_node; | 386 ScopedNode manifest_node; |
| 387 *out_manifest = NULL; | 387 *out_manifest = NULL; |
| 388 | 388 |
| 389 int error = Open(manifest_path, O_RDONLY, &manifest_node); | 389 int error = Open(manifest_path, O_RDONLY, &manifest_node); |
| 390 if (error) | 390 if (error) |
| 391 return error; | 391 return error; |
| 392 | 392 |
| 393 size_t size; | 393 off_t size; |
| 394 error = manifest_node->GetSize(&size); | 394 error = manifest_node->GetSize(&size); |
| 395 if (error) | 395 if (error) |
| 396 return error; | 396 return error; |
| 397 | 397 |
| 398 char* text = new char[size + 1]; | 398 char* text = new char[size + 1]; |
| 399 int len; | 399 int len; |
| 400 error = manifest_node->Read(HandleAttr(), text, size, &len); | 400 error = manifest_node->Read(HandleAttr(), text, size, &len); |
| 401 if (error) | 401 if (error) |
| 402 return error; | 402 return error; |
| 403 | 403 |
| 404 text[len] = 0; | 404 text[len] = 0; |
| 405 *out_manifest = text; | 405 *out_manifest = text; |
| 406 return 0; | 406 return 0; |
| 407 } | 407 } |
| 408 | 408 |
| 409 std::string HttpFs::MakeUrl(const Path& path) { | 409 std::string HttpFs::MakeUrl(const Path& path) { |
| 410 return url_root_ + | 410 return url_root_ + |
| 411 (path.IsAbsolute() ? path.Range(1, path.Size()) : path.Join()); | 411 (path.IsAbsolute() ? path.Range(1, path.Size()) : path.Join()); |
| 412 } | 412 } |
| 413 | 413 |
| 414 } // namespace nacl_io | 414 } // namespace nacl_io |
| OLD | NEW |