Exemplo n.º 1
0
CRecBinViewer::CRecBinViewer()
:m_hWnd (NULL),
m_bNeedUpdate (false)
{
    m_pFolder2		= NULL;
	m_pRecycleBin	= NULL;

	ZeroMemory (&m_pidlDrives, sizeof (m_pidlDrives));
	ZeroMemory (&m_hNotifyDrives, sizeof (m_hNotifyDrives));
	FillHeader();
	
}
Exemplo n.º 2
0
  bool CTarArchive::WriteData(const std::string& _input, const std::string& output)
  {
    bool Ret = false;

    /*int iAmountToRound = 0;
    static bool bFirstEntry = true;
    std::fstream f_In, f_Out;
    std::string strData = strTarfile;*/

    posix_header lheader;
    if(FillHeader(_input, lheader))
    {
      std::ofstream l_out(output.c_str(), std::ios::out | std::ios::binary | std::ios::app | std::ios::ate);

      if(!l_out.good())
      {
        std::cerr << i8n("[ERR] Error output file: ") << output << '\n';
        Ret = false;
      }
      else
      {
        std::ifstream l_in(_input.c_str(), std::ios::in | std::ios::binary);

        if(!l_in.good())
        {
          std::cerr << i8n("[WNG] Error in file: ") << _input << i8n(" (file is skipped)") << '\n';
          Ret = true;            // If we cannot read a file it's not vital, we skip, but we need to inform user !
        }
        else
        {
          //Round it to % 512
          if(m_FirstFile)
          {
            int l_AmountToRound = RoundTo512(l_out.tellp()) - l_out.tellp();

            for(int i = 0; i < l_AmountToRound; ++i)
              l_out.put('\0');
          }

          m_FirstFile = true;

          //Write header
          l_out.write(reinterpret_cast<char*>(&lheader), sizeof(lheader));

          //Append file content
          char l_char;
          while(l_in.get(l_char))
            l_out.put(l_char);

          l_in.close();
          l_out.close();
          Ret = true;
        }
      }
    }
    else
    {
      std::cerr << i8n("[WNG] File '") << _input << i8n("' hasn't been add to tar archive !") << '\n';
      Ret = true;                // If we cannot compute header, we skip it.
    }

    return Ret;
  }
Exemplo n.º 3
0
CDriveViewer::CDriveViewer()
{
	FillHeader();
	m_bGetState = false;
}
Exemplo n.º 4
0
void GPSSensorUBX::PollCmd(UBXMessageClass msgClass, UBXMessageId msgId) {
	UBXMsg *msg = (UBXMsg*)recvBuff;
	FillHeader(msg,msgClass,msgId,0);
    AppendCheckSum(msg);
    SendFrame((char*)msg,(msg->hdr.length)+UBX_OVERHEAD_SIZE);
}
Exemplo n.º 5
0
	LoadResult TGAImage::Load(byte *data, unsigned long size)
	{
		LoadResult result;

		// Clear out any existing image and palette
		if (_image)
		{
			delete[] _image;
			_image = NULL;
		}
 
		if (_palette)
		{
			delete[] _palette;
			_palette = NULL;
		}
  
		// Process the header
		result = FillHeader(data);
 
		if (result != RISE_OK)
			return result;
 
		switch (_header.ImageType)
		{
			case RGB:
			{
				// Check filesize against header values
				if ((_size + TGAHeader::SIZE + _header.IdentSize) > size)
					return RISE_ERR_BAD_FORMAT;
  
				// Load image data
				result = LoadRawData(data);
				if (result != RISE_OK)
					return result;
 
				BGRtoRGB(); // Convert to RGB
				break;
			}
			case Grayscale:
			{
				break;
			}
			case RLE_RGB:
			{
				// Load image data
				result = LoadTgaRLEData(data);
				if(result != RISE_OK)
					return result;
 
				BGRtoRGB(); // Convert to RGB
				break;
			}
 
			default:
			return RISE_ERR_UNSUPPORTED;
		}
 
		// Check flip bit
		if ((data[17] & 0x10)) 
			FlipImg();
 
		return RISE_OK;
	}