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

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/mount_node_http.cc

Issue 73083005: [NaCl SDK] Enable linux host build for nacl_io and nacl_io_tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/mount_node_http.h" 5 #include "nacl_io/mount_node_http.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <stdio.h> 9 #include <stdio.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 bool ParseContentRange(const StringMap_t& headers, 94 bool ParseContentRange(const StringMap_t& headers,
95 size_t* read_start, 95 size_t* read_start,
96 size_t* read_end, 96 size_t* read_end,
97 size_t* entity_length) { 97 size_t* entity_length) {
98 StringMap_t::const_iterator iter = headers.find("Content-Range"); 98 StringMap_t::const_iterator iter = headers.find("Content-Range");
99 if (iter == headers.end()) 99 if (iter == headers.end())
100 return false; 100 return false;
101 101
102 // The key should look like "bytes ##-##/##" or "bytes ##-##/*". The last 102 // The key should look like "bytes ##-##/##" or "bytes ##-##/*". The last
103 // value is the entity length, which can potentially be * (i.e. unknown). 103 // value is the entity length, which can potentially be * (i.e. unknown).
104 int read_start_int; 104 size_t read_start_int;
105 int read_end_int; 105 size_t read_end_int;
106 int entity_length_int; 106 size_t entity_length_int;
107 int result = sscanf(iter->second.c_str(), 107 int result = sscanf(iter->second.c_str(),
108 "bytes %" SCNuS "-%" SCNuS "/%" SCNuS, 108 "bytes %" SCNuS "-%" SCNuS "/%" SCNuS,
109 &read_start_int, 109 &read_start_int,
110 &read_end_int, 110 &read_end_int,
111 &entity_length_int); 111 &entity_length_int);
112 112
113 // The Content-Range header specifies an inclusive range: e.g. the first ten 113 // The Content-Range header specifies an inclusive range: e.g. the first ten
114 // bytes is "bytes 0-9/*". Convert it to a half-open range by incrementing 114 // bytes is "bytes 0-9/*". Convert it to a half-open range by incrementing
115 // read_end. 115 // read_end.
116 if (result == 2) { 116 if (result == 2) {
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 bytes_to_read -= bytes_read; 542 bytes_to_read -= bytes_read;
543 out_buffer += bytes_read; 543 out_buffer += bytes_read;
544 } 544 }
545 545
546 *out_bytes = count; 546 *out_bytes = count;
547 return 0; 547 return 0;
548 } 548 }
549 549
550 } // namespace nacl_io 550 } // namespace nacl_io
551 551
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/mount_dev.cc ('k') | native_client_sdk/src/libraries/nacl_io/mount_node_mem.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698