OLD | NEW |
---|---|
1 /* Copyright 2010, Google Inc. | 1 /* Copyright 2010, Google Inc. |
2 * All rights reserved. | 2 * All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 #include <inttypes.h> | 45 #include <inttypes.h> |
46 | 46 |
47 #include "lib/lib_vpd.h" | 47 #include "lib/lib_vpd.h" |
48 #include "lib/fmap.h" | 48 #include "lib/fmap.h" |
49 | 49 |
50 | 50 |
51 void fmapNormalizeAreaName(uint8_t *name) { | 51 void fmapNormalizeAreaName(uint8_t *name) { |
52 assert(name); | 52 assert(name); |
53 | 53 |
54 while (*name) { | 54 while (*name) { |
55 if (!(isascii(*name) && isalnum(*name))) { | 55 if (!(isascii(*name) && (isalnum(*name) || *name == ' '))) { |
dhendrix
2011/03/10 01:33:51
Is isascii() required if isalnum() used?
Louis
2011/03/10 08:22:51
I think isalnum() is locale-dependent implementati
| |
56 *name = '_'; | 56 *name = '_'; |
57 } | 57 } |
58 name++; | 58 name++; |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 off_t fmapFind(const uint8_t *image, size_t image_len) { | 62 off_t fmapFind(const uint8_t *image, size_t image_len) { |
63 off_t offset; | 63 off_t offset; |
64 uint64_t sig; | 64 uint64_t sig; |
65 | 65 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 for (i = 0; i < fmap->nareas; i++) { | 97 for (i = 0; i < fmap->nareas; i++) { |
98 if (0 == strcmp(fmap->areas[i].name, name)) { | 98 if (0 == strcmp(fmap->areas[i].name, name)) { |
99 *offset = fmap->areas[i].offset; | 99 *offset = fmap->areas[i].offset; |
100 *size = fmap->areas[i].size; | 100 *size = fmap->areas[i].size; |
101 return FMAP_OK; | 101 return FMAP_OK; |
102 } | 102 } |
103 } | 103 } |
104 | 104 |
105 return FMAP_FAIL; | 105 return FMAP_FAIL; |
106 } | 106 } |
OLD | NEW |