libUEMF
A portable library for reading and writing WMF, EMF and EMF+ files
|
Functions for converting EMF records between Big Endian and Little Endian byte orders. More...
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "uemf.h"
#include "uemf_endian.h"
Functions | |
int | U_emf_endian (char *contents, size_t length, int torev) |
Convert an entire EMF in memory from Big Endian to Little Endian. More... | |
Functions for converting EMF records between Big Endian and Little Endian byte orders.
EMF files use Little Endian order. On a Big Endian machine the data must be converted to/from Little Endian when it is writen to/read from a file. On a Little Endian machine no conversion is required, but it is good to be able to test the routines on either platform. When "torev" is true these routines convert from the native byte order to the reverse. When "torev" is false these routines convert from the reverse byte order to the native. Routines that do not use that variable swap byte order, and the way in which they do so does not depend on the native byte order.
The only function here which should be called directly is U_emf_endian(), and then,except for testing purposes, only on a BE machine.
Many variables are initialized to zero even though they will always be set because some versions of gcc give spurious "may be used uninitialized" warnings otherwise.
int U_emf_endian | ( | char * | contents, |
size_t | length, | ||
int | torev | ||
) |
Convert an entire EMF in memory from Big Endian to Little Endian.
contents | pointer to the buffer holding the entire EMF in memory |
length | number of bytes in the buffer |
torev | 1 for native to reversed, 0 for reversed to native |
Normally this would be called immediately before writing the data to a file or immediately after reading the data from a file.