/[svn]/libgig/trunk/src/helper.h
ViewVC logotype

Diff of /libgig/trunk/src/helper.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 933 by schoenebeck, Fri Nov 24 12:50:05 2006 UTC revision 1180 by persson, Sat May 12 12:39:25 2007 UTC
# Line 48  inline long Abs(long val) { Line 48  inline long Abs(long val) {
48  }  }
49    
50  /**  /**
51     * Stores a 16 bit integer in memory using little-endian format.
52     *
53     * @param pData - memory pointer
54     * @param data  - integer to be stored
55     */
56    inline void store16(uint8_t* pData, uint16_t data) {
57        pData[0] = data;
58        pData[1] = data >> 8;
59    }
60    
61    /**
62     * Stores a 32 bit integer in memory using little-endian format.
63     *
64     * @param pData - memory pointer
65     * @param data  - integer to be stored
66     */
67    inline void store32(uint8_t* pData, uint32_t data) {
68        pData[0] = data;
69        pData[1] = data >> 8;
70        pData[2] = data >> 16;
71        pData[3] = data >> 24;
72    }
73    
74    /**
75   * Swaps the order of the data words in the given memory area   * Swaps the order of the data words in the given memory area
76   * with a granularity given by \a WordSize.   * with a granularity given by \a WordSize.
77   *   *
# Line 144  inline void SaveString(uint32_t ChunkID, Line 168  inline void SaveString(uint32_t ChunkID,
168          ck->Resize(size);          ck->Resize(size);
169          char* pData = (char*) ck->LoadChunkData();          char* pData = (char*) ck->LoadChunkData();
170          strncpy(pData, s.c_str(), size);          strncpy(pData, s.c_str(), size);
171      } else if (s != "" || sDefault != "") { // create chunk      } else if (s != "" || sDefault != "" || bUseFixedLengthStrings) { // create chunk
172          const std::string& sToSave = (s != "") ? s : sDefault;          const std::string& sToSave = (s != "") ? s : sDefault;
173          if (!bUseFixedLengthStrings) size = sToSave.size() + 1;          if (!bUseFixedLengthStrings) size = sToSave.size() + 1;
174          ck = lstINFO->AddSubChunk(ChunkID, size);          ck = lstINFO->AddSubChunk(ChunkID, size);

Legend:
Removed from v.933  
changed lines
  Added in v.1180

  ViewVC Help
Powered by ViewVC