OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 if (file_length == 0) return FAILURE; | 68 if (file_length == 0) return FAILURE; |
69 | 69 |
70 MemoryBuffer<uint8> buffer; | 70 MemoryBuffer<uint8> buffer; |
71 buffer.Allocate(file_length); | 71 buffer.Allocate(file_length); |
72 uint8 *p = buffer; | 72 uint8 *p = buffer; |
73 | 73 |
74 // Test by reading in a tar.gz file and sending through the | 74 // Test by reading in a tar.gz file and sending through the |
75 // progressive streaming system | 75 // progressive streaming system |
76 FILE *fp = fopen(filename, "rb"); | 76 FILE *fp = fopen(filename, "rb"); |
77 if (!fp) return FAILURE; // can't open file! | 77 if (!fp) return FAILURE; // can't open file! |
78 if (static_cast<size_t>(file_length) != | 78 if (static_cast<size_t>(file_length) != |
79 fread(p, sizeof(uint8), file_length, fp)) | 79 fread(p, sizeof(uint8), file_length, fp)) |
80 return FAILURE; | 80 return FAILURE; |
81 if (0 != fclose(fp)) return FAILURE; | 81 if (0 != fclose(fp)) return FAILURE; |
82 | 82 |
83 MemoryReadStream stream(p, file_length); | 83 MemoryReadStream stream(p, file_length); |
84 | 84 |
85 return ProcessEntireStream(&stream); | 85 return ProcessEntireStream(&stream); |
86 } | 86 } |
87 | 87 |
88 } // namespace o3d | 88 } // namespace o3d |
OLD | NEW |