Пример #1
0
void StdoutConsumer::Consume(const Log::Entry& entry)
{
   PrintHeader(entry);
   PrintMessage(std::cout, entry, true);
   PrintContext(entry);
   PrintNewLine(std::cout, true);
}
Пример #2
0
STDMETHODIMP P7ZipArchiveUpdateCallback::GetStream(UInt32 index, ISequentialInStream **inStream)
{
  RINOK(Finilize());

  const CDirItem &dirItem = (*DirItems)[index];
  GetStream2(dirItem.Name);
 
  if (dirItem.isDir())
    return S_OK;

  {
    CInFileStream *inStreamSpec = new CInFileStream;
    CMyComPtr<ISequentialInStream> inStreamLoc(inStreamSpec);
    UString path = DirPrefix + dirItem.FullPath;
    if (!inStreamSpec->Open(path))
    {
      DWORD sysError = ::GetLastError();
      FailedCodes.Add(sysError);
      FailedFiles.Add(path);
      // if (systemError == ERROR_SHARING_VIOLATION)
      {
        PrintNewLine();
        PrintError("WARNING: can't open file");
        // PrintString(NError::MyFormatMessageW(systemError));
        return S_FALSE;
      }
      // return sysError;
    }
    *inStream = inStreamLoc.Detach();
  }
  return S_OK;
}
Пример #3
0
HRESULT P7ZipArchiveUpdateCallback::Finilize()
{
  if (m_NeedBeClosed)
  {
    PrintNewLine();
    m_NeedBeClosed = false;
  }
  return S_OK;
}
Пример #4
0
STDMETHODIMP P7ZipArchiveExtractCallback::SetOperationResult(Int32 operationResult)
{
  switch(operationResult)
  {
    case NArchive::NExtract::NOperationResult::kOK:
      break;
    default:
    {
      NumErrors++;
      PrintString("     ");
      switch(operationResult)
      {
        case NArchive::NExtract::NOperationResult::kUnSupportedMethod:
          PrintString(kUnsupportedMethod);
          break;
        case NArchive::NExtract::NOperationResult::kCRCError:
          PrintString(kCRCFailed);
          break;
        case NArchive::NExtract::NOperationResult::kDataError:
          PrintString(kDataError);
          break;
        default:
          PrintString(kUnknownError);
      }
    }
  }

  if (_outFileStream != NULL)
  {
    if (_processedFileInfo.MTimeDefined)
      _outFileStreamSpec->SetMTime(&_processedFileInfo.MTime);
    RINOK(_outFileStreamSpec->Close());
  }
  _outFileStream.Release();
  if (_extractMode && _processedFileInfo.AttribDefined)
    NFile::NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attrib);
  PrintNewLine();
  return S_OK;
}
Пример #5
0
Файл: test.c Проект: 0xc0170/cox
//*****************************************************************************
//
//! \brief Test execution thread function.
//!
//! \param None
//!
//! \details Test execution thread function.
//!
//! \return The test result xtrue or xfalse.
//
//*****************************************************************************
xtBoolean 
TestMain(void) 
{
    int i, j;

    TestIOInit();

    PrintLine("");
    PrintLine("*** CooCox CoIDE components test suites");
    PrintLine("***");
#ifdef TEST_COMPONENTS_NAME
    Print("*** Components: ");
    PrintLine(TEST_COMPONENTS_NAME);
#endif
#ifdef TEST_COMPONENTS_VERSION
    Print("*** Version:       ");
    PrintLine(TEST_COMPONENTS_VERSION);
#endif
#ifdef TEST_BOARD_NAME
    Print("*** Test Board:   ");
    PrintLine(TEST_BOARD_NAME);
#endif
    PrintLine("");

    g_bGlobalFail = xfalse;
    i = 0;
    while (g_psPatterns[i]) 
    {
        j = 0;
        while (g_psPatterns[i][j]) 
        {
            PrintNewLine();
            Print("--- Test Case ");
            PrintN(i + 1);
            Print(".");
            PrintN(j + 1);
            Print(" (");
            Print((char *)g_psPatterns[i][j]->GetTest());
            PrintLine(")");

            ExecuteTest(g_psPatterns[i][j]);
            if (g_bLocalFail == xtrue)
            {
                Print("--- Result: FAILURE ");
                PrintLine("");
                //
                //printf error information
                //
                Print(g_pcErrorInfoBuffer);
                PrintLine("");
                if (g_pcTokensBuffer < g_pcTok)
                {
                    Print(" The tokens in buffer is: ");
                    PrintTokens();
                    PrintLine("");
                }
            }
            else
            {
                PrintLine("--- Result: SUCCESS ");
            }
            j++;
        }
        i++;
    }

    PrintNewLine();
    PrintLine("");
    Print("Final result: ");

    if (g_bGlobalFail == xtrue)
    PrintLine("FAILURE");
    else
    PrintLine("SUCCESS");

    return g_bGlobalFail;
}