diff options
author | Francis Rowe <info@gluglug.org.uk> | 2015-01-10 22:23:40 (EST) |
---|---|---|
committer | Francis Rowe <info@gluglug.org.uk> | 2015-01-10 22:23:40 (EST) |
commit | f6e9a7417a098c417a4a6067ef2fb2701cd5852d (patch) | |
tree | 4fee7f840d833f02e057668c17bb8c2f0aa42170 /resources/utilities/ich9deblob | |
parent | b833801ae4a0179ff29a661a9932fe0f56173d80 (diff) | |
download | libreboot-f6e9a7417a098c417a4a6067ef2fb2701cd5852d.zip libreboot-f6e9a7417a098c417a4a6067ef2fb2701cd5852d.tar.gz libreboot-f6e9a7417a098c417a4a6067ef2fb2701cd5852d.tar.bz2 |
ich9deblob/ich9gen: re-factor descriptor/gbe file creation
Diffstat (limited to 'resources/utilities/ich9deblob')
-rw-r--r-- | resources/utilities/ich9deblob/src/common/descriptor_gbe.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/resources/utilities/ich9deblob/src/common/descriptor_gbe.c b/resources/utilities/ich9deblob/src/common/descriptor_gbe.c index 581f755..6a87452 100644 --- a/resources/utilities/ich9deblob/src/common/descriptor_gbe.c +++ b/resources/utilities/ich9deblob/src/common/descriptor_gbe.c @@ -30,14 +30,6 @@ int notCreatedDescriptorGbeFile(struct DESCRIPTORREGIONRECORD descriptorStruct, { FILE* fileStream = NULL; - /* These will have the structs copied to them */ - uint8_t descriptorBuffer[DESCRIPTORREGIONSIZE]; - uint8_t gbeBuffer8k[GBEREGIONSIZE_8K]; - - /* Copy the structs to buffers, to make writing them as files easier */ - memcpy(&descriptorBuffer, &descriptorStruct, DESCRIPTORREGIONSIZE); /* descriptor */ - memcpy(&gbeBuffer8k, &gbeStruct8k, GBEREGIONSIZE_8K); /* gbe */ - /* delete old file before continuing */ remove(fileName); @@ -45,14 +37,14 @@ int notCreatedDescriptorGbeFile(struct DESCRIPTORREGIONRECORD descriptorStruct, fileStream = fopen(fileName, "ab"); /* write the descriptor region into the first part */ - if (DESCRIPTORREGIONSIZE != fwrite(descriptorBuffer, 1, DESCRIPTORREGIONSIZE, fileStream)) + if (DESCRIPTORREGIONSIZE != fwrite((uint8_t*)&descriptorStruct, 1, sizeof(descriptorStruct), fileStream)) { printf("\nerror: writing descriptor region failed\n"); return 1; } /* add gbe to the end of the file */ - if (GBEREGIONSIZE_8K != fwrite(gbeBuffer8k, 1, GBEREGIONSIZE_8K, fileStream)) + if (GBEREGIONSIZE_8K != fwrite((uint8_t*)&gbeStruct8k, 1, sizeof(gbeStruct8k), fileStream)) { printf("\nerror: writing GBe region failed\n"); return 1; |