Пример #1
0
static DWORD WINAPI FileWatcherThread(void* param) {
    UNUSED(param);
    HANDLE handles[1];
    // must be alertable to receive ReadDirectoryChangesW() callbacks and APCs
    BOOL alertable = TRUE;

    for (;;) {
        handles[0] = g_threadControlHandle;
        DWORD timeout = GetTimeoutInMs();
        DWORD obj = WaitForMultipleObjectsEx(1, handles, FALSE, timeout, alertable);
        if (WAIT_TIMEOUT == obj) {
            RunManualChecks();
            continue;
        }

        if (WAIT_IO_COMPLETION == obj) {
            // APC complete. Nothing to do
            lf("FileWatcherThread(): APC complete");
            continue;
        }

        int n = (int)(obj - WAIT_OBJECT_0);

        if (n == 0) {
            // a thread was explicitly awaken
            ResetEvent(g_threadControlHandle);
            lf("FileWatcherThread(): g_threadControlHandle signalled");
        } else {
            dbglog::CrashLogF("FileWatcherThread(): n=%d", n);
            CrashIf(true);
        }
    }
}
Пример #2
0
 float ilf(float nf, float x, float r){
   unsigned int n = floor(nf);
   nf = nf - n;
   while(n--)
     x = lf(x, r);
   float xn = lf(x, r);
   return (x*(1.0-nf) + xn*nf)/2;
 }
Пример #3
0
static void CALLBACK ReadDirectoryChangesNotification(DWORD errCode,
    DWORD bytesTransfered, LPOVERLAPPED overlapped)
{
    ScopedCritSec cs(&g_threadCritSec);

    OverlappedEx *over = (OverlappedEx*)overlapped;
    WatchedDir* wd = (WatchedDir*)over->data;

    lf(L"ReadDirectoryChangesNotification() dir: %s, numBytes: %d", wd->dirPath, (int)bytesTransfered);

    CrashIf(wd != wd->overlapped.data);

    if (errCode == ERROR_OPERATION_ABORTED) {
        lf("   ERROR_OPERATION_ABORTED");
        DeleteWatchedDir(wd);
        InterlockedDecrement(&gRemovalsPending);
        return;
    }

    // This might mean overflow? Not sure.
    if (!bytesTransfered)
        return;

    FILE_NOTIFY_INFORMATION *notify = (FILE_NOTIFY_INFORMATION*)wd->buf;

    // collect files that changed, removing duplicates
    WStrVec changedFiles;
    for (;;) {
        ScopedMem<WCHAR> fileName(str::DupN(notify->FileName, notify->FileNameLength / sizeof(WCHAR)));
        // files can get updated either by writing to them directly or
        // by writing to a .tmp file first and then moving that file in place
        // (the latter only yields a RENAMED action with the expected file name)
        if (notify->Action == FILE_ACTION_MODIFIED || notify->Action == FILE_ACTION_RENAMED_NEW_NAME) {
            if (!changedFiles.Contains(fileName)) {
                lf(L"ReadDirectoryChangesNotification() FILE_ACTION_MODIFIED, for '%s'", fileName);
                changedFiles.Append(fileName.StealData());
            } else {
                lf(L"ReadDirectoryChangesNotification() eliminating duplicate notification for '%s'", fileName);
            }
        } else {
            lf(L"ReadDirectoryChangesNotification() action=%d, for '%s'", (int)notify->Action, fileName);
        }

        // step to the next entry if there is one
        DWORD nextOff = notify->NextEntryOffset;
        if (!nextOff)
            break;
        notify = (FILE_NOTIFY_INFORMATION *)((char*)notify + nextOff);
    }

    StartMonitoringDirForChanges(wd);

    for (const WCHAR *f : changedFiles) {
        NotifyAboutFile(wd, f);
    }
}
Пример #4
0
static void CALLBACK ReadDirectoryChangesNotification(DWORD errCode,
    DWORD bytesTransfered, LPOVERLAPPED overlapped)
{
    ScopedCritSec cs(&g_threadCritSec);

    OverlappedEx *over = (OverlappedEx*)overlapped;
    WatchedDir* wd = (WatchedDir*)over->data;

    lf(L"ReadDirectoryChangesNotification() dir: %s, numBytes: %d", wd->dirPath, (int)bytesTransfered);

    CrashIf(wd != wd->overlapped.data);

    if (errCode == ERROR_OPERATION_ABORTED) {
        lf("   ERROR_OPERATION_ABORTED");
        DeleteWatchedDir(wd);
        return;
    }

    // This might mean overflow? Not sure.
    if (!bytesTransfered)
        return;

    FILE_NOTIFY_INFORMATION *notify = (FILE_NOTIFY_INFORMATION*)wd->buf;

    // collect files that changed, removing duplicates
    WStrVec changedFiles;
    for (;;) {
        WCHAR *fileName = str::DupN(notify->FileName, notify->FileNameLength / sizeof(WCHAR));
        if (notify->Action == FILE_ACTION_MODIFIED) {
            if (!changedFiles.Contains(fileName)) {
                lf(L"ReadDirectoryChangesNotification() FILE_ACTION_MODIFIED, for '%s'", fileName);
                changedFiles.Append(fileName);
                fileName = NULL;
            } else {
                lf(L"ReadDirectoryChangesNotification() eliminating duplicate notification for '%s'", fileName);
            }
        } else {
            lf(L"ReadDirectoryChangesNotification() action=%d, for '%s'", (int)notify->Action, fileName);
        }
        free(fileName);

        // step to the next entry if there is one
        DWORD nextOff = notify->NextEntryOffset;
        if (!nextOff)
            break;
        notify = (FILE_NOTIFY_INFORMATION *)((char*)notify + nextOff);
    }

    StartMonitoringDirForChanges(wd);

    for (WCHAR **f = changedFiles.IterStart(); f; f = changedFiles.IterNext()) {
        NotifyAboutFile(wd, *f);
    }
}
Пример #5
0
static BOOL ProcessDetach()
{
    lf("memtrace.dll: ProcessDetach()");
    TerminateSendingThread();
    ClosePipe();
    DeleteCriticalSection(&gMemMutex);
    CloseHandle(gSendThreadEvent);
    FreeAllBlocks();
    lf("memtrace.dll: allocated total %d blocks", gBlocksAllocated);
    HeapDestroy(gHeap);
    return TRUE;
}
Пример #6
0
static void InstallHooks()
{
    gNtdllIntercept.Init("ntdll.dll");
    bool ok = gNtdllIntercept.AddHook("RtlAllocateHeap", reinterpret_cast<intptr_t>(RtlAllocateHeapHook), (void**) &gRtlAllocateHeapOrig);
    if (ok)
        lf("memtrace.dll: Hooked RtlAllocateHeap");
    else
        lf("memtrace.dll: failed to hook RtlAllocateHeap");

    ok = gNtdllIntercept.AddHook("RtlFreeHeap", reinterpret_cast<intptr_t>(RtlFreeHeapHook), (void**) &gRtlFreeHeapOrig);
    if (ok)
        lf("memtrace.dll: Hooked RtlFreeHeap");
    else
        lf("memtrace.dll: failed to hook RtlFreeHeap");
}
Пример #7
0
void LinuxProcess::drawChar(int c) {

  if(c < 0) c += 256;
  
  ldf && fprintf(ldf, "%c", c); ldf && fflush(ldf);
  
  if(st == sNormal) {
    if(c == 0) {
      }
      
    else if(c == 13) { // cr
      curx = 0;
      }
    else if(c == 10) { // lf
      lf();
      }
  
    else if(c == 7) {
      bell = true;
      }

    else if(c == 8) { // del
      if(curx) curx--;
      // s->get(curx, cury) = brush0;
      }
  
    else if(c == 9) { // tab
      do {
        s->get(curx, cury) = brush0;
        curx++;
        if(curx == s->sx) curx = 0, lf();
        }
        while(curx % 8);
      }

    else if(c == 0x1b)
      st = sESC;
    
    else if(0) { // assuming not UTF8 if(c >= 192) {
      uniwait = 0;
      while((c >> (6-uniwait)) & 1) uniwait++;
      s->get(curx, cury) = brush0;
      curx++;
      if(curx == s->sx) curx = 0, lf();
      }
      
    else {
      if(uniwait) { uniwait--; return; }
Пример #8
0
static char *BuildCrashInfoText()
{
    lf("BuildCrashInfoText(): start");

    str::Str<char> s(16 * 1024, gCrashHandlerAllocator);
    if (gSystemInfo)
        s.Append(gSystemInfo);

    GetStressTestInfo(&s);
    s.Append("\r\n");

    dbghelp::GetExceptionInfo(s, gMei.ExceptionPointers);
    dbghelp::GetAllThreadsCallstacks(s);
    s.Append("\r\n");
#if 0 // disabled because crashes in release builds
    s.AppendFmt("Thread: %x\r\n", GetCurrentThreadId());
    dbghelp::GetCurrentThreadCallstack(s);
    s.Append("\r\n");
#endif
    s.Append(gModulesInfo);

    s.Append("\r\n");
    s.Append(gAdditionalInfo->LendData());

    return s.StealData();
}
Пример #9
0
void
manager::_mapper_fill(mapper &m, const std::string &name) {
    ACE_DEBUG((LM_DEBUG, "lang::manager: filling mapper for %s\n", name.c_str()));
    
    // First find the matching file
    std::list<info>::const_iterator i = _infos.begin();
    for (; i != _infos.end(); i++) {
        if (i->lang() == name) break;
    }
    
    if (i == _infos.end())
        throw exceptionf(0, "No language file found for %s. "
                         "Reinstall RV House", name.c_str());

    ACE_DEBUG((LM_DEBUG, "lang::manager: parsing file %s\n", i->file().c_str()));
    config_file lf(config_file::ini_file);
    lf.load(i->file());
    
    config_file::key_value_map_type key_value_map;
    lf.keys_and_values_as_map(key_value_map);
    config_file::key_value_map_type::iterator kv_i;
    for (kv_i = key_value_map.begin(); kv_i != key_value_map.end(); ++kv_i) {
        m.set(kv_i->first.c_str(), kv_i->second.c_str());
    }
}
Пример #10
0
DEF_TEST(LumaColorFilter, reporter) {
    SkPMColor in, out;
    SkAutoTUnref<SkColorFilter> lf(SkLumaColorFilter::Create());

    // Applying luma to white produces black with the same transparency.
    for (unsigned i = 0; i < 256; ++i) {
        in = SkPackARGB32(i, i, i, i);
        lf->filterSpan(&in, 1, &out);
        REPORTER_ASSERT(reporter, SkGetPackedA32(out) == i);
        REPORTER_ASSERT(reporter, SkGetPackedR32(out) == 0);
        REPORTER_ASSERT(reporter, SkGetPackedG32(out) == 0);
        REPORTER_ASSERT(reporter, SkGetPackedB32(out) == 0);
    }

    // Applying luma to black yields transparent black (luminance(black) == 0)
    for (unsigned i = 0; i < 256; ++i) {
        in = SkPackARGB32(i, 0, 0, 0);
        lf->filterSpan(&in, 1, &out);
        REPORTER_ASSERT(reporter, out == SK_ColorTRANSPARENT);
    }

    // For general colors, a luma filter generates black with an attenuated alpha channel.
    for (unsigned i = 1; i < 256; ++i) {
        in = SkPackARGB32(i, i, i / 2, i / 3);
        lf->filterSpan(&in, 1, &out);
        REPORTER_ASSERT(reporter, out != in);
        REPORTER_ASSERT(reporter, SkGetPackedA32(out) <= i);
        REPORTER_ASSERT(reporter, SkGetPackedR32(out) == 0);
        REPORTER_ASSERT(reporter, SkGetPackedG32(out) == 0);
        REPORTER_ASSERT(reporter, SkGetPackedB32(out) == 0);
    }
}
Пример #11
0
int main(int argc, char* argv[])
{
    QApplication app(argc, argv);
    qApp->setOrganizationName("deepin");
    qApp->setApplicationName("dde-lock");
    qApp->setApplicationVersion("2015.1.0");
    LogManager::instance()->debug_log_console_on();

    QTranslator translator;
    translator.load("/usr/share/dde-session-ui/translations/dde-session-ui_" + QLocale::system().name());
    app.installTranslator(&translator);

    // hide dde-control-center
    DBusControlCenter *DCCInter = new DBusControlCenter;
    if (DCCInter->isValid())
        DCCInter->HideImmediately();
    DCCInter->deleteLater();

    if(QDBusConnection::sessionBus().registerService(DBUS_NAME)){
        qDebug() << "DBUS_NAME:" << DBUS_NAME;
        const QString &backgroundUrl = ":/theme/background/default_background.jpg";

        LockFrame lf(backgroundUrl);
        lf.show();
        lf.grabKeyboard();

        return app.exec();
       }
       else {
           qWarning() << "lockFront is running...";
           return 0;
       }

}
Пример #12
0
void jvm::virtual_machine::check_exception(JNIEnv *e) const
{
    e = env(e);

	local_frame lf(16, e);

	jthrowable x = e->ExceptionOccurred();
	if (x != 0)
	{
		e->ExceptionDescribe();
		e->ExceptionClear();

		std::string msg("(Exception message not available)");

        jmethodID getMessage = e->GetMethodID(e->GetObjectClass(x), "getMessage", "()Ljava/lang/String;");
		e->ExceptionClear();

		if (getMessage != 0)
		{
			jobject s = e->CallObjectMethod(x, getMessage);
			e->ExceptionClear();

			if (s != 0)
				msg = string((jstring)s);
		}

		throw std::logic_error(msg);
	}
}
Пример #13
0
void OGraphicsEllipseItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
	DBG_p("OGraphicsEllipseItem::mouseReleaseEvent\n");
	OGraphicsScene *s = dynamic_cast<OGraphicsScene *>(scene());
	OASSET(s != NULL);
	QList<QGraphicsItem *> il = s->selectedItems();
//	extractItemsByType(&il, ClassInfo::OConfNode);
	extractItemsByTypes(&il, ClassInfo::OConfNode, ClassInfo::OLogpoolNode);
	DBG_p("il.size()=%d\n", il.size());
	if (il.size() == 2) {
		OAbstractNode *no1 = dynamic_cast<OAbstractNode*>(il[0]);
		OAbstractNode *no2 = dynamic_cast<OAbstractNode*>(il[1]);
		if (no1 == NULL || no2 == NULL) return;
		OGraphicsEllipseItem *el1 = no1->getSelectedPoint();
		OGraphicsEllipseItem *el2 = no2->getSelectedPoint();
		if (OAbstractNode::connect(no1, el1, no2, el2)) {
			QPointF e_size = QPointF(ELLIPSE_SIZE / 2, ELLIPSE_SIZE / 2);
			QLineF lf(el1->getAbsolutePos() + e_size, el2->getAbsolutePos() + e_size);
			QGraphicsLineItem *gli = new QGraphicsLineItem(lf);
//			gli->setFlag(QGraphicsItem::ItemIsSelectable);
			el1->setLine(gli);
			el2->setLine(gli);
			QPen p;
			p.setColor(ELLIPSE_DEFAULT_COLOR);
			p.setCapStyle(Qt::RoundCap);
			p.setWidth(5);
			gli->setPen(p);
			s->addItem(gli);
		}
		el1->unselect();
		el2->unselect();
		s->clearSelection();
	}
}
Пример #14
0
Letters::Letters( const std::string& letterFileName )
{
    std::ifstream lf( letterFileName.c_str() );
    std::string line;

    if ( lf.is_open() )
    {
        char letter;
        while ( ( letter = lf.get() ) != -1 )
        {
            // Skip the comma.
            lf.get();

            int score = 0;
            char sch;
            while ( ( sch = lf.get() ) != '\n' )
            {
                score *= 10;
                score += sch - '0';
            }

            mLetterScores[ letter ] = score;
        }
    }

    lf.close();
}
Пример #15
0
// \n - new line, \t - tabulation
void putchar(char c)
{
    switch(c)
    {
    case '\n': 
        lf();
        break;
    case '\t': 
        tab();
        break;
    default:
        vidmem[cur_pos].chr = c;
        vidmem[cur_pos].attr = console_color;
        cur_pos++;
        break;
    }

    // If the cursor position is more scr_size then scrolling screen
    if(cur_pos >= scr_size)
    {
        memcpy(vidmem, vidmem+80, sizeof(vidmem)*24*80);
        cur_pos-=80;
    }

}
Пример #16
0
int main()
{
   typedef boost::multiprecision::number<boost::multiprecision::backends::cpp_bin_float<256> > ext_float_t;
   typedef boost::multiprecision::number<boost::multiprecision::backends::cpp_bin_float<2046> > long_ext_float_t;

   ext_float_t x = 5e15;
   x += 0.5;
   ext_float_t x1 = x + 255.0 / (1 << 20); // + 2^-12 - eps
   ext_float_t x2 = x + 257.0 / (1 << 20); // + 2^-12 + eps
   double d1 = x1.convert_to<double>();
   double d2 = x2.convert_to<double>();

   std::cout << std::setprecision(18) << d1 << std::endl;
   std::cout << std::setprecision(18) << d2 << std::endl;

   x = 1e7 + 0.5;
   x1 = x + ldexp(255.0, -38); // + 2^-30 - eps
   x2 = x + ldexp(257.0, -38); // + 2^-30 + eps
   float f1 = x1.convert_to<float>();
   float f2 = x2.convert_to<float>();

   std::cout << std::setprecision(9) << f1 << std::endl;
   std::cout << std::setprecision(9) << f2 << std::endl;

   long_ext_float_t lf(1);
   lf += std::numeric_limits<long_ext_float_t>::epsilon();
   lf += std::numeric_limits<float>::epsilon() / 2;
   BOOST_ASSERT(lf != 1);
   float f3 = lf.convert_to<float>();
   std::cout << std::setprecision(9) << f3 << std::endl;

   return (d1 == d2) && (f1 == f2) && (f3 != 1) ? 0 : 1;
}
Пример #17
0
int main() {
  QTextStream qout(stdout);
  QTextStream qin(stdin);

  qout << "---===>>>> File locking example <<<<===---\n";

  QtLockedFile lf("foo");
  lf.open(QFile::ReadWrite);

  QString line;
  bool blocking = true;
  while (line != "q") {
    int m = lf.lockMode();

    if (m == 0)
      qout << "\n[*] You have no locks.";
    else if (m == QFile::ReadOnly)
      qout << "\n[*] You have a read lock.";
    else
      qout << "\n[*] You have a read/write lock.";
    qout << " Blocking wait is ";
    if (blocking)
      qout << "ON.\n";
    else
      qout << "OFF.\n";

    qout << "Acquire [r]ead lock, read/[w]rite lock, re[l]ease lock, [t]oggle "
            "or [q]uit? ";
    qout.flush();

    line = qin.readLine();
    if (line.isNull())
      break;

    if (line == "r") {
      qout << "Acquiring a read lock... ";
      qout.flush();
      if (lf.lock(QtLockedFile::ReadLock, blocking))
        qout << "done!\n";
      else
        qout << "not currently possible!\n";
    } else if (line == "w") {
      qout << "Acquiring a read/write lock... ";
      qout.flush();
      if (lf.lock(QtLockedFile::WriteLock, blocking))
        qout << "done!\n";
      else
        qout << "not currently possible!\n";
    } else if (line == "l") {
      qout << "Releasing lock... ";
      qout.flush();
      lf.unlock();
      qout << "done!\n";
    } else if (line == "t") {
      blocking = !blocking;
    }

    qout.flush();
  }
}
Пример #18
0
int lf(int x)
{
	int temp = two(x);
	if ( temp == 1)
		return ( x - 1);
	return lf( x - (1 << (temp - 1)));
}
Пример #19
0
NS_IMETHODIMP
nsOperaProfileMigrator::GetSourceHomePageURL(nsACString& aResult)
{
    nsresult rv;
    nsCAutoString val;

    nsCOMPtr<nsIFile> operaPrefs;
    mOperaProfile->Clone(getter_AddRefs(operaPrefs));
    operaPrefs->Append(OPERA_PREFERENCES_FILE_NAME);

    nsCOMPtr<nsILocalFile> lf(do_QueryInterface(operaPrefs));
    NS_ENSURE_TRUE(lf, NS_ERROR_UNEXPECTED);

    nsINIParser parser;
    rv = parser.Init(lf);
    NS_ENSURE_SUCCESS(rv, rv);

    rv = parser.GetString("User Prefs",
                          "Home URL",
                          val);

    if (NS_SUCCEEDED(rv))
        aResult.Assign(val);

    return NS_OK;
}
Пример #20
0
void MainWindow::saveOutput()
{
	QString file = QFileDialog::getSaveFileName(this, tr("Save list to..."), QString(), tr("List (*.list)"));
	if (file.isEmpty())
		return;

	QFile lf(file);
	if (!lf.open(QFile::WriteOnly)) {
		qWarning("Open file for write failed!");
		return;
	}
	QTextStream ts(&lf);
	ts.setCodec("UTF-8");
	if (ts.status() != QTextStream::Ok) {
		lf.close();
		qWarning("Cannot construct text stream!");
		return;
	}

	QTreeWidgetItemIterator it(outputList->invisibleRootItem());
	while (*++it)		// Ignore root
		ts << "\"" << (*it)->text(0) << "\" \"" << (*it)->text(1) << "\"\n";

	lf.close();
}
Пример #21
0
//Run inference with Lazy Flipper initialized to setting in initlab
void runLazyFlipper(GraphicalModelType* gm,std::string ofname, std::string initlab, size_t subGraphsize)
{
	//Initial Labelling
	std::vector<LabelType> startPoint(gm->numberOfVariables());
	std::ifstream input;
	input.open(initlab.c_str());
	int label;
	for(size_t i=0;i<gm->numberOfVariables();i++)
	{
		input>>label;	
		startPoint[i] = LabelType(label);	
#ifdef DEBUG
		std::cout<<"L"<<i<<":"<<label<<" ";
#endif
	}

	//Run Inference
	size_t maxSubgraphsize;
	if(subGraphsize<=0)
		maxSubgraphsize = gm->numberOfVariables()/2;
	else
		maxSubgraphsize = subGraphsize;
	LazyFlipper::Parameter para(maxSubgraphsize);
	LazyFlipper lf(*gm,para);
	lf.setStartingPoint(startPoint.begin());
	
	std::cout<<"Running Inference"<<std::endl;
	lf.infer();
	std::cout << "MAP Result: " << lf.value() << " Bound: "<<lf.bound()<<std::endl;
	std::vector<LabelType> result;
	lf.arg(result);
	//Write Result
	writeResult(result,ofname);
}
Пример #22
0
nsresult
nsOperaProfileMigrator::SetFile(void* aTransform, nsIPrefBranch* aBranch)
{
    PrefTransform* xform = (PrefTransform*)aTransform;
    nsCOMPtr<nsILocalFile> lf(do_CreateInstance("@mozilla.org/file/local;1"));
    lf->InitWithPath(NS_ConvertUTF8toUTF16(xform->stringValue));
    return aBranch->SetComplexValue(xform->targetPrefName, NS_GET_IID(nsILocalFile), lf);
}
Пример #23
0
static DWORD WINAPI DataSendThreadProc(void* data)
{
    // if pipe was closed, we exit the thread
    while (gPipe) {
        DWORD res = WaitForSingleObject(gSendThreadEvent, INFINITE);
        if (gStopSendThread) {
            lf("memtrace.dll: DataSendThreadProc, gStopSendThread is true");
            return 0;
        }
        if (WAIT_OBJECT_0 != res)
            continue;

        SendQueuedMessages();
    }
    lf("memtrace.dll: DataSendThreadProc ended");
    return 0;
}
Пример #24
0
void Utils::log(const QString &filePath, const QByteArray &message) {
    QFile lf(filePath);

    if (lf.open(QIODevice::Append)) {
        lf.write(QDateTime::currentDateTime().toString().toUtf8() + ": " + message + "\n");
    }

    lf.close();
}
Пример #25
0
// If we can't resolve the symbols, we assume it's because we don't have symbols
// so we'll try to download them and retry. If we can resolve symbols, we'll
// get the callstacks etc. and submit to our server for analysis.
void SubmitCrashInfo()
{
    if (!dir::Create(gSymbolsDir)) {
        plog("SubmitCrashInfo(): couldn't create symbols dir");
        return;
    }

    lf("SubmitCrashInfo(): start");
    lf(L"SubmitCrashInfo(): gSymbolPathW: '%s'", gSymbolPathW);
    if (!CrashHandlerCanUseNet()) {
        plog("SubmitCrashInfo(): internet access not allowed");
        return;
    }

    char *s = NULL;
    if (!dbghelp::Initialize(gSymbolPathW)) {
        plog("SubmitCrashInfo(): dbghelp::Initialize() failed");
        return;
    }

    if (!dbghelp::HasSymbols()) {
        if (!DownloadAndUnzipSymbols(gPdbZipPath, gSymbolsDir)) {
            plog("SubmitCrashInfo(): failed to download symbols");
            return;
        }

        if (!dbghelp::Initialize(gSymbolPathW, true)) {
            plog("SubmitCrashInfo(): second dbghelp::Initialize() failed");
            return;
        }
    }

    if (!dbghelp::HasSymbols()) {
        plog("SubmitCrashInfo(): HasSymbols() false after downloading symbols");
        return;
    }

    s = BuildCrashInfoText();
    if (!s)
        return;
    SendCrashInfo(s);
    gCrashHandlerAllocator->Free(s);
}
Пример #26
0
// static (single .exe) build
static bool UnpackStaticSymbols(const WCHAR *pdbZipPath, const WCHAR *symDir)
{
    lf(L"UnpackStaticSymbols(): unpacking %s to dir %s", pdbZipPath, symDir);
    ZipFile archive(pdbZipPath, Zip_Any, gCrashHandlerAllocator);
    if (!archive.UnzipFile(L"SumatraPDF.pdb", symDir)) {
        plog("Failed to unzip SumatraPDF.pdb");
        return false;
    }
    return true;
}
Пример #27
0
TEST_F(LoadFileTests, basic_load_file_test) {
  auto t = io::Loader::shortcuts::load("test/tables/employees.tbl");

  LoadFile lf("tables/employees.tbl");
  lf.execute();

  const auto &result = lf.getResultTable();

  ASSERT_TABLE_EQUAL(result, t);
}
Пример #28
0
// an installer
static bool UnpackInstallerSymbols(const TCHAR *pdbZipPath, const TCHAR *symDir)
{
    lf(_T("UnpackInstallerSymbols(): unpacking %s to dir %s"), pdbZipPath, symDir);
    ZipFile archive(pdbZipPath, gCrashHandlerAllocator);
    if (!archive.UnzipFile(_T("Installer.pdb"), symDir)) {
        plog("Failed to unzip Installer.pdb");
        return false;
    }
    return true;
}
Пример #29
0
static object
rando(object x, object rs) {

  enum type tx;
  object base,out,z;
  fixnum fbase;
  double d;
  
  tx = type_of(x);
  if (number_compare(x, small_fixnum(0)) != 1)
    FEwrong_type_argument(TSpositive_number, x);
  
  if (tx==t_bignum) {
    out=new_bignum();
    base=x;
    fbase=-1;
  } else {
    out=big_fixnum1;
    fbase=tx==t_fixnum ? fix(x) : MOST_POSITIVE_FIX;
    mpz_set_si(MP(big_fixnum2),fbase);
    base=big_fixnum2;
  }
  
  mpz_urandomm(MP(out),&rs->rnd.rnd_state,MP(base));
  
  switch (tx) {
    
  case t_fixnum:
    return make_fixnum(mpz_get_si(MP(out)));
  case t_bignum:
    return normalize_big(out);
  case t_shortfloat: case t_longfloat:
    d=mpz_get_d(MP(out));
    d/=(double)fbase;
    z=alloc_object(tx);
    if (tx==t_shortfloat) sf(z)=sf(x)*d; else lf(z)=lf(x)*d;
    return z;
  default:
    FEerror("~S is not an integer nor a floating-point number.", 1, x);
    return(Cnil);
  }
}
void EbookController::DeletePages(Vec<HtmlPage*>** pages)
{
    CrashIf((pagesFromBeginning != *pages) &&
            (pagesFromPage != *pages));
#if 0
    if (pagesFromPage && (*pages == pagesFromPage))
        lf("Deleting pages from page");
#endif
    ::DeletePages(*pages);
    *pages = NULL;
}