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

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

Issue 16122002: [NaCl SDK] MountNodeDir::GetDents sets d_off instead of leaving it undefined. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 6 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 unified diff | Download patch
OLDNEW
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2012 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_dir.h" 5 #include "nacl_io/mount_node_dir.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "nacl_io/osdirent.h" 10 #include "nacl_io/osdirent.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 122 }
123 123
124 void MountNodeDir::BuildCache() { 124 void MountNodeDir::BuildCache() {
125 if (map_.size()) { 125 if (map_.size()) {
126 cache_ = (struct dirent *) malloc(sizeof(struct dirent) * map_.size()); 126 cache_ = (struct dirent *) malloc(sizeof(struct dirent) * map_.size());
127 MountNodeMap_t::iterator it = map_.begin(); 127 MountNodeMap_t::iterator it = map_.begin();
128 for (size_t index = 0; it != map_.end(); it++, index++) { 128 for (size_t index = 0; it != map_.end(); it++, index++) {
129 MountNode* node = it->second; 129 MountNode* node = it->second;
130 size_t len = it->first.length(); 130 size_t len = it->first.length();
131 cache_[index].d_ino = node->stat_.st_ino; 131 cache_[index].d_ino = node->stat_.st_ino;
132 cache_[index].d_off = sizeof(struct dirent);
132 cache_[index].d_reclen = sizeof(struct dirent); 133 cache_[index].d_reclen = sizeof(struct dirent);
133 cache_[index].d_name[len] = 0; 134 cache_[index].d_name[len] = 0;
134 strncpy(cache_[index].d_name, &it->first[0], len); 135 strncpy(cache_[index].d_name, &it->first[0], len);
135 } 136 }
136 } 137 }
137 } 138 }
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/mount_node.cc ('k') | native_client_sdk/src/libraries/nacl_io_test/mount_node_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698