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

Side by Side Diff: native_client_sdk/src/examples/demo/nacl_io/handlers.c

Issue 14607005: [NaCl SDK] Cleanup examples. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: feedback Created 7 years, 7 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 | Annotate | Revision Log
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 5
6 #include "handlers.h" 6 #include "handlers.h"
7 7
8 #include <assert.h> 8 #include <assert.h>
9 #include <errno.h> 9 #include <errno.h>
10 #include <stdio.h> 10 #include <stdio.h>
11 #include <stdlib.h> 11 #include <stdlib.h>
12 #include <string.h> 12 #include <string.h>
13 #include <sys/stat.h> 13 #include <sys/stat.h>
14 14
15 #include "hello_nacl_io.h" 15 #include "nacl_io.h"
16 16
17 #define MAX_OPEN_FILES 10 17 #define MAX_OPEN_FILES 10
18 18
19 /** 19 /**
20 * A mapping from int -> FILE*, so the JavaScript messages can refer to an open 20 * A mapping from int -> FILE*, so the JavaScript messages can refer to an open
21 * File. */ 21 * File. */
22 static FILE* g_OpenFiles[MAX_OPEN_FILES]; 22 static FILE* g_OpenFiles[MAX_OPEN_FILES];
23 23
24 /** 24 /**
25 * Add the file to the g_OpenFiles map. 25 * Add the file to the g_OpenFiles map.
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 memset(&buf, 0, sizeof(buf)); 365 memset(&buf, 0, sizeof(buf));
366 int result = stat(filename, &buf); 366 int result = stat(filename, &buf);
367 if (result == -1) { 367 if (result == -1) {
368 *output = PrintfToNewString("Error: stat returned error %d.", errno); 368 *output = PrintfToNewString("Error: stat returned error %d.", errno);
369 return 2; 369 return 2;
370 } 370 }
371 371
372 *output = PrintfToNewString("stat\1%s\1%d", filename, buf.st_size); 372 *output = PrintfToNewString("stat\1%s\1%d", filename, buf.st_size);
373 return 0; 373 return 0;
374 } 374 }
OLDNEW
« no previous file with comments | « native_client_sdk/src/examples/demo/nacl_io/example.dsc ('k') | native_client_sdk/src/examples/demo/nacl_io/hello_nacl_io.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698