--- libgig/trunk/src/helper.h 2006/10/24 22:24:45 929 +++ libgig/trunk/src/helper.h 2007/09/09 10:36:23 1330 @@ -1,6 +1,6 @@ /*************************************************************************** * * - * libgig - C++ cross-platform Gigasampler format file loader library * + * libgig - C++ cross-platform Gigasampler format file access library * * * * Copyright (C) 2003-2006 by Christian Schoenebeck * * * @@ -28,6 +28,12 @@ #include #include +#if defined(WIN32) && !HAVE_CONFIG_H +# include "../win32/libgig_private.h" // like config.h, automatically generated by Dev-C++ +# define PACKAGE "libgig" +# define VERSION VER_STRING // VER_STRING defined in libgig_private.h +#endif // WIN32 + #include "RIFF.h" // *************** Helper Functions ************** @@ -48,6 +54,30 @@ } /** + * Stores a 16 bit integer in memory using little-endian format. + * + * @param pData - memory pointer + * @param data - integer to be stored + */ +inline void store16(uint8_t* pData, uint16_t data) { + pData[0] = data; + pData[1] = data >> 8; +} + +/** + * Stores a 32 bit integer in memory using little-endian format. + * + * @param pData - memory pointer + * @param data - integer to be stored + */ +inline void store32(uint8_t* pData, uint32_t data) { + pData[0] = data; + pData[1] = data >> 8; + pData[2] = data >> 16; + pData[3] = data >> 24; +} + +/** * Swaps the order of the data words in the given memory area * with a granularity given by \a WordSize. * @@ -144,7 +174,7 @@ ck->Resize(size); char* pData = (char*) ck->LoadChunkData(); strncpy(pData, s.c_str(), size); - } else if (s != "" || sDefault != "") { // create chunk + } else if (s != "" || sDefault != "" || bUseFixedLengthStrings) { // create chunk const std::string& sToSave = (s != "") ? s : sDefault; if (!bUseFixedLengthStrings) size = sToSave.size() + 1; ck = lstINFO->AddSubChunk(ChunkID, size);