OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "courgette/encoded_program.h" | 5 #include "courgette/encoded_program.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 INCLUDE_MISC = 0x1000 | 293 INCLUDE_MISC = 0x1000 |
294 }; | 294 }; |
295 | 295 |
296 static FieldSelect GetFieldSelect() { | 296 static FieldSelect GetFieldSelect() { |
297 #if 1 | 297 #if 1 |
298 // TODO(sra): Use better configuration. | 298 // TODO(sra): Use better configuration. |
299 scoped_ptr<base::Environment> env(base::Environment::Create()); | 299 scoped_ptr<base::Environment> env(base::Environment::Create()); |
300 std::string s; | 300 std::string s; |
301 env->GetVar("A_FIELDS", &s); | 301 env->GetVar("A_FIELDS", &s); |
302 if (!s.empty()) { | 302 if (!s.empty()) { |
303 return static_cast<FieldSelect>(wcstoul(ASCIIToWide(s).c_str(), 0, 0)); | 303 return static_cast<FieldSelect>( |
| 304 wcstoul(base::ASCIIToWide(s).c_str(), 0, 0)); |
304 } | 305 } |
305 #endif | 306 #endif |
306 return static_cast<FieldSelect>(~0); | 307 return static_cast<FieldSelect>(~0); |
307 } | 308 } |
308 | 309 |
309 CheckBool EncodedProgram::WriteTo(SinkStreamSet* streams) { | 310 CheckBool EncodedProgram::WriteTo(SinkStreamSet* streams) { |
310 FieldSelect select = GetFieldSelect(); | 311 FieldSelect select = GetFieldSelect(); |
311 | 312 |
312 // The order of fields must be consistent in WriteTo and ReadFrom, regardless | 313 // The order of fields must be consistent in WriteTo and ReadFrom, regardless |
313 // of the streams used. The code can be configured with all kStreamXXX | 314 // of the streams used. The code can be configured with all kStreamXXX |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 if (assembled) | 793 if (assembled) |
793 return C_OK; | 794 return C_OK; |
794 return C_ASSEMBLY_FAILED; | 795 return C_ASSEMBLY_FAILED; |
795 } | 796 } |
796 | 797 |
797 void DeleteEncodedProgram(EncodedProgram* encoded) { | 798 void DeleteEncodedProgram(EncodedProgram* encoded) { |
798 delete encoded; | 799 delete encoded; |
799 } | 800 } |
800 | 801 |
801 } // end namespace | 802 } // end namespace |
OLD | NEW |