| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |