int serialGetC(HANDLE fd, uint8_t* c, int timeout) { COMMTIMEOUTS timeouts; unsigned long res; COMSTAT comStat; DWORD errors; if(!ClearCommError(fd, &errors, &comStat)) { printErr("could not reset comm errors", GetLastError()); return -1; } if(!GetCommTimeouts(fd, &timeouts)) { printErr("error getting comm timeouts", GetLastError()); return -1; } timeouts.ReadIntervalTimeout = timeout; timeouts.ReadTotalTimeoutConstant = timeout; timeouts.ReadTotalTimeoutMultiplier = 10; if(!SetCommTimeouts(fd, &timeouts)) { printErr("error setting comm timeouts", GetLastError()); return -1; } if(!ReadFile(fd, c, 1, &res, NULL)) { printErr("error reading from serial port", GetLastError()); return -1; } if(res != 1) return -1; return *c; }
Boolean WISInput::initALSA(UsageEnvironment& env) { do { int arg; #ifdef WORDS_BIGENDIAN arg = AFMT_S16_BE; #else arg = AFMT_S16_LE; #endif if (ioctl(fOurAudioFileNo, SNDCTL_DSP_SETFMT, &arg) < 0) { printErr(env, "SNDCTL_DSP_SETFMT"); break; } arg = audioSamplingFrequency; if (ioctl(fOurAudioFileNo, SNDCTL_DSP_SPEED, &arg) < 0) { printErr(env, "SNDCTL_DSP_SPEED"); break; } arg = audioNumChannels > 1 ? 1 : 0; if (ioctl(fOurAudioFileNo, SNDCTL_DSP_STEREO, &arg) < 0) { printErr(env, "SNDCTL_DSP_STEREO"); break; } return True; } while (0); // An error occurred: return False; }
int serialSetBaudrate(HANDLE fd, int baudrate) { DCB dcb; memset(&dcb, 0x00, sizeof(dcb)); dcb.DCBlength = sizeof(dcb); if(!GetCommState(fd, &dcb)) { printErr("error getting serial port state", GetLastError()); return -1; } dcb.BaudRate = baudrate; dcb.ByteSize = 8; dcb.StopBits = ONESTOPBIT; dcb.Parity = NOPARITY; dcb.fBinary = 1; dcb.fOutxCtsFlow = 0; dcb.fOutxDsrFlow = 0; dcb.fOutX = 0; dcb.fInX = 0; dcb.fNull = 0; dcb.fTXContinueOnXoff = 0; dcb.fDtrControl = DTR_CONTROL_DISABLE; dcb.fDsrSensitivity = 0; dcb.fRtsControl = RTS_CONTROL_DISABLE; if(!SetCommState(fd, &dcb)) { printErr("error setting serial port state", GetLastError()); return -1; } return 0; }
/** \brief Set up event processing. * * Sets up the module for event processing, based on the options in the configuration file. * * \param conf Configuration file instance. * \return Enum indicating the setup state. */ uint8_t Initializer::setUpEvtProc(shared_ptr<Config> conf) { // Create event detector instance. shared_ptr<EvtProcessor> processor(new EvtProcessor); // Add operator for acceleration event detection. shared_ptr<OpAcceleration> accEvents(new OpAcceleration(14000)); if (!processor->op_append(accEvents)) { printErr(INIT_ERR_DEV_APPEND, "event operator"); return INIT_ERR_DEV_APPEND; } // Add operator for gyroscope event detection. shared_ptr<OpGyroscope> gyroEvents(new OpGyroscope(1500)); if (!processor->op_append(gyroEvents)) { printErr(INIT_ERR_DEV_APPEND, "event operator"); return INIT_ERR_DEV_APPEND; } // Finally add processors to event processing module. this->evt.evt_append(processor); this->evt.addChild(processor); return INIT_OK; }
static bool handleTrFunctionAliases(const QString &arg) { foreach (const QString &pair, arg.split(QLatin1Char(','), QString::SkipEmptyParts)) { const int equalSign = pair.indexOf(QLatin1Char('=')); if (equalSign < 0) { printErr(LU::tr("tr-function mapping '%1' in -tr-function-alias is missing the '='.\n").arg(pair)); return false; } const bool plusEqual = equalSign > 0 && pair[equalSign-1] == QLatin1Char('+'); const int trFunctionEnd = plusEqual ? equalSign-1 : equalSign; const QString trFunctionName = pair.left(trFunctionEnd).trimmed(); const QString alias = pair.mid(equalSign+1).trimmed(); const int trFunction = trFunctionByDefaultName(trFunctionName); if (trFunction < 0) { printErr(LU::tr("Unknown tr-function '%1' in -tr-function-alias option.\n" "Available tr-functions are: %2") .arg(trFunctionName, availableFunctions().join(QLatin1Char(',')))); return false; } if (alias.isEmpty()) { printErr(LU::tr("Empty alias for tr-function '%1' in -tr-function-alias option.\n") .arg(trFunctionName)); return false; } trFunctionAliasManager.modifyAlias(trFunction, alias.toLatin1(), plusEqual ? TrFunctionAliasManager::AddAlias : TrFunctionAliasManager::SetAlias); } return true; }
int main(int argc, char** args) { char s[1024+1]; gets_s(s); void* expr; int res = ParseExpression(s, 1024, &expr); printErr("ParseExpression", res); if (res <= 0) return 1; res = PrintExpression(expr, s, 1024); printErr("PrintExpression", res); if (res <= 0) return 1; s[res] = 0; printf("%s\n", s); uint8 output[1024]; res = CompileExpression(expr, output, 1024, IdentifierInfoCallback); printErr("CompileExpression", res); if (res <= 0) return 1; std::ofstream f("output.bin"); f.write((char*)output, res); f.close(); res = ReleaseExpression(expr); printErr("ReleaseExpression", res); if (res <= 0) return 1; return 0; }
bool LuaInterp::loadFile( const char* fileName ) { LuaStackCheck lsc(_luaState); int errCode = LUA_OK; errCode = luaL_loadfile( _luaState, fileName ); if( errCode != LUA_OK ) { printErr( "luaL_loadfile errCode %d \"%s\"\n", errCode, lua_tolstring( _luaState, -1, 0 ) ); lua_pop( _luaState, 1 ); return false; } int numArgs = 0; int numResults = 0; int ehi = 0; // error handler index lua_getglobal( _luaState, "debug" ); lua_getfield( _luaState, -1, "traceback" ); lua_remove( _luaState, -2 ); ehi = -2; lua_insert( _luaState, ehi ); errCode = lua_pcall( _luaState, numArgs, numResults, ehi ); if( errCode != LUA_OK ) { printErr( "lua_pcall %d \"%s\"\n", errCode, lua_tolstring( _luaState, -1, 0 ) ); lua_pop( _luaState, 2 ); return false; } lua_pop( _luaState, 1 ); return true; }
static bool releaseTranslator(Translator &tor, const QString &qmFileName, ConversionData &cd, bool removeIdentical) { tor.reportDuplicates(tor.resolveDuplicates(), qmFileName, cd.isVerbose()); if (cd.isVerbose()) printOut(LR::tr("Updating '%1'...\n").arg(qmFileName)); if (removeIdentical) { if (cd.isVerbose()) printOut(LR::tr("Removing translations equal to source text in '%1'...\n").arg(qmFileName)); tor.stripIdenticalSourceTranslations(); } QFile file(qmFileName); if (!file.open(QIODevice::WriteOnly)) { printErr(LR::tr("lrelease error: cannot create '%1': %2\n") .arg(qmFileName, file.errorString())); return false; } tor.normalizeTranslations(cd); bool ok = saveQM(tor, file, cd); file.close(); if (!ok) { printErr(LR::tr("lrelease error: cannot save '%1': %2") .arg(qmFileName, cd.error())); } else if (!cd.errors().isEmpty()) { printOut(cd.error()); } cd.clearErrors(); return ok; }
/* * Function to initialize global config struct */ static Config initConfig(CMap cmap) { char * val; int i = 0; Config c = mallocConfig(); FILE * file = fopen(DEFAULT_OPTIONS_FILENAME, "r"); if (file == NULL) { die("Default config file not found.", 2); } defCMap = getCMap(file); /* Load default config map from file */ for (i = 0; i < ARYLEN; ++i) { /* Load default values into config ary 1st */ config[i].value = getCValue(defCMap, config[i].keyword); } for (i = 0; i < ARYLEN; ++i) { val = getCValue(cmap, config[i].keyword); /* get user config value */ if (val != NULL) { if (!setConfigValue(c, i, val)) /* check & set configuration */ printErr("Invalid parameter value: ", "initConfig()", 1); /* ... or log an error */ } else if (!setConfigValue(c, i, config[i].value)) printErr("Error in default config file: ", "initConfig()", 1); } fclose(file); return c; }
static int getConeFloatArr(char *key, scs_float **varr, scs_int *vsize, PyObject *cone) { /* get cone['key'] */ scs_int i, n = 0; scs_float *q = SCS_NULL; PyObject *obj = PyDict_GetItemString(cone, key); if (obj) { if (PyList_Check(obj)) { n = (scs_int)PyList_Size(obj); q = scs_calloc(n, sizeof(scs_float)); for (i = 0; i < n; ++i) { PyObject *qi = PyList_GetItem(obj, i); q[i] = (scs_float)PyFloat_AsDouble(qi); } } else if (PyInt_Check(obj) || PyLong_Check(obj) || PyFloat_Check(obj)) { n = 1; q = scs_malloc(sizeof(scs_float)); q[0] = (scs_float)PyFloat_AsDouble(obj); } else { return printErr(key); } if (PyErr_Occurred()) { /* potentially could have been triggered before */ return printErr(key); } } *vsize = n; *varr = q; return 0; }
void welcome() { int cnt; //open the count file. FILE* fp = fopen((PWD + "/Config/counts.txt").c_str(),"r+"); //file error check. if(!fp) printErr(COUNT_FILE_ERROR); //incrementing the count. if(fscanf(fp, "%d", &cnt)) { if(cnt==0) { giveIntro(); } } else printErr(COUNT_FILE_ERROR); }
static void print(const QString &fileName, int lineNo, const QString &msg) { if (lineNo) printErr(QString::fromLatin1("%2(%1): %3").arg(lineNo).arg(fileName, msg)); else printErr(msg); }
int main(int argc, char *argv[]) { int rc = 0; if (argc == 3 || argc == 5) { struct stat DirStat; if ( stat(argv[2], &DirStat) == 0 && S_ISDIR(DirStat.st_mode)) { char *pszContent; rc = readFile(argv[1], &pszContent, NULL); if (!rc) { FILE *pFileList = NULL; if (argc == 5) rc = openMakefileList(argv[3], argv[4], &pFileList); if (argc < 4 || pFileList) rc = splitFile(argv[2], pszContent, pFileList); if (pFileList) rc = closeMakefileList(pFileList, rc); free(pszContent); } } else rc = printErr("Given argument \"%s\" is not a valid directory.\n", argv[2]); } else rc = printErr("Syntax error: usage: filesplitter <infile> <outdir> [<list.kmk> <kmkvar>]\n"); return rc; }
STATUS wdbUdpSockIfInit ( WDB_COMM_IF * pWdbCommIf ) { struct sockaddr_in srvAddr; pWdbCommIf->rcvfrom = wdbUdpSockRcvfrom; pWdbCommIf->sendto = wdbUdpSockSendto; pWdbCommIf->modeSet = wdbUdpSockModeSet; pWdbCommIf->cancel = wdbUdpSockCancel; pWdbCommIf->hookAdd = NULL; pWdbCommIf->notifyHost = NULL; /* Create the wdbUdpSocket */ if ((wdbUdpSock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { printErr ("Socket failed\n"); return (ERROR); } /* Bind to WDB agents port number */ bzero ((char *)&srvAddr, sizeof(srvAddr)); srvAddr.sin_family = AF_INET; srvAddr.sin_port = htons(WDBPORT); srvAddr.sin_addr.s_addr = htonl(INADDR_ANY); if (bind (wdbUdpSock, (struct sockaddr *)&srvAddr, sizeof(srvAddr)) < 0 ) { printErr ("Bind failed\n"); return (ERROR); } /* Create the wdbUdpCancelSocket */ if ((wdbUdpCancelSock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { printErr ("Socket failed\n"); return (ERROR); } /* connect it (for writes) to the wdbUdpSocket */ bzero ((char *)&srvAddr, sizeof(srvAddr)); srvAddr.sin_family = AF_INET; srvAddr.sin_port = htons(WDBPORT); srvAddr.sin_addr.s_addr = inet_addr ("127.0.0.1"); if (connect (wdbUdpCancelSock, (struct sockaddr *)&srvAddr, sizeof(srvAddr)) == ERROR) { printErr ("Connect failed\n"); return (ERROR); } return (OK); }
static void print(const QString &fileName, int lineNo, const QString &msg) { if (lineNo > 0) printErr(QString::fromLatin1("WARNING: %1:%2: %3\n").arg(fileName, QString::number(lineNo), msg)); else if (lineNo) printErr(QString::fromLatin1("WARNING: %1: %2\n").arg(fileName, msg)); else printErr(QString::fromLatin1("WARNING: %1\n").arg(msg)); }
/********************************************************************** *%FUNCTION: discovery *%ARGUMENTS: * conn -- PPPoE connection info structure *%RETURNS: * Nothing *%DESCRIPTION: * Performs the PPPoE discovery phase ***********************************************************************/ void discovery(PPPoEConnection *conn) { int padiAttempts = 0; int padrAttempts = 0; int timeout = conn->discoveryTimeout; conn->discoverySocket = openInterface(conn->ifName, Eth_PPPOE_Discovery, conn->myEth); do { padiAttempts++; if (padiAttempts > MAX_PADI_ATTEMPTS) { printErr("Timeout waiting for PADO packets"); close(conn->discoverySocket); conn->discoverySocket = -1; return; } sendPADI(conn); conn->discoveryState = STATE_SENT_PADI; waitForPADO(conn, timeout); timeout *= 3; if (timeout > 60) timeout = 10; } while (conn->discoveryState == STATE_SENT_PADI); timeout = conn->discoveryTimeout; do { padrAttempts++; if (padrAttempts > MAX_PADI_ATTEMPTS) { printErr("Timeout waiting for PADS packets"); close(conn->discoverySocket); conn->discoverySocket = -1; return; } sendPADR(conn); conn->discoveryState = STATE_SENT_PADR; waitForPADS(conn, timeout); timeout *= 3; if (timeout > 60) timeout = 10; } while (conn->discoveryState == STATE_SENT_PADR); if (!conn->seenMaxPayload) { /* RFC 4638: MUST limit MTU/MRU to 1492 */ if (lcp_allowoptions[0].mru > ETH_PPPOE_MTU) lcp_allowoptions[0].mru = ETH_PPPOE_MTU; if (lcp_wantoptions[0].mru > ETH_PPPOE_MTU) lcp_wantoptions[0].mru = ETH_PPPOE_MTU; } /* We're done. */ conn->discoveryState = STATE_SESSION; return; }
void printUnhandledException(const char *iname, const std::exception *e) { if (e) printErr(iname,"unhandled exception: %s\n", prettyName(e->what())); else printErr(iname,"internal error: unhandled exception!\n"); if (opt->cmd != CMD_COMPRESS) { printErr(iname," this file has possibly been modified/hacked; take care!\n"); } }
void WISVideoOpenFileSource::readFromFile() { // Retrieve a filled video buffer from the kernel: unsigned i; struct v4l2_buffer buf; if (capture_start) { capture_start = 0; for (i = 0; i < MAX_BUFFERS; ++i) { memset(&buf, 0, sizeof buf); buf.index = i; buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; if (ioctl(fFileNo, VIDIOC_QBUF, &buf) < 0) { printErr(envir(), "VIDIOC_QBUF"); return; } } // Start capturing: i = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl(fFileNo, VIDIOC_STREAMON, &i) < 0) { printErr(envir(), "VIDIOC_STREAMON"); return; } } memset(&buf, 0, sizeof buf); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; if (ioctl(fFileNo, VIDIOC_DQBUF, &buf) < 0) { printErr(envir(), "VIDIOC_DQBUF"); return; } // Note the timestamp and size: fPresentationTime = buf.timestamp; fFrameSize = buf.bytesused; if (fFrameSize > fMaxSize) { fNumTruncatedBytes = fFrameSize - fMaxSize; fFrameSize = fMaxSize; } else { fNumTruncatedBytes = 0; } // Copy to the desired place: memmove(fTo, buffers[buf.index].addr, fFrameSize); // Send the buffer back to the kernel to be filled in again: if (ioctl(fFileNo, VIDIOC_QBUF, &buf) < 0) { printErr(envir(), "VIDIOC_QBUF"); return; } }
__MSSHELL_WRAPPER_ __WINCALL static void _MS__private __system colFileLoader(const sel_typ argc, char ** argv) { char path[MAX_PATH_LENGTH]; #ifdef WINOS if(isnSett(BOOLS_ITEMSSELECTBYPATH)) { const bool wHandler = windowsFileHandler(path, "Settings Configuration (*."DEFAULT_COLORS_FILE_EXTENSION")\0*."DEFAULT_COLORS_FILE_EXTENSION"\0Text Documents (*.txt)\0*.txt\0All Files (*.*)\0*.*\0", DEFAULT_COLORS_FILE_EXTENSION, true); if(wHandler) { _colFileLoader(path); sprint("%s\nFile has been correctly loaded.\n\n", path); } else printErr(14, "Failed to select Colors Settings File"); } else #endif { if(argc) { if(!file_exists(argv[0])) { printErr(2, "Inserted Path:\n%s\nrefers to non-existent File", argv[0]); return; } strcpy(path, argv[0]); } else { bool assert; printf2(COLOR_CREDITS, "Enter the Path of the "DEFAULT_LAYOUT_FILE_EXTENSION" File you wish to load.\n"); printf2(COLOR_CREDITS, "or insert %c to exit SubProgram.\n\n", SCANFEXIT_CHAR); PRINTL(); while(scanf("%s", path) != 1 || path[0] == SCANFEXIT_CHAR || (assert = !file_exists(path))) { CLEARBUFFER(); if(path[0] == SCANFEXIT_CHAR) return; if(assert) { printErr(2, "Inserted Path:\n%s\nrefers to non-existent File", argv[0]); return; } // mustcreatefile = true; } } _colFileLoader(path); sprint("%s\nFile has been correctly loaded.\n\n", path); } return; }
STATUS usrFdConfig ( int drive, /* drive number of floppy disk (0 - 3) */ int type, /* type of floppy disk */ char * fileName /* mount point */ ) { BLK_DEV *pBootDev; CBIO_DEV_ID cbio ; char bootDir [BOOT_FILE_LEN]; if( type == NONE) return OK; if ((UINT)drive >= FD_MAX_DRIVES) { printErr ("drive is out of range (0-%d).\n", FD_MAX_DRIVES - 1); return (ERROR); } /* create a block device spanning entire disk (non-distructive!) */ if ((pBootDev = fdDevCreate (drive, type, 0, 0)) == NULL) { printErr ("fdDevCreate failed.\n"); return (ERROR); } /* create a disk cache to speed up Floppy operation */ cbio = dcacheDevCreate( (CBIO_DEV_ID) pBootDev, NULL, FD_CACHE_SIZE, bootDir ); if( cbio == NULL ) { /* insufficient memory, will avoid the cache */ cbio = cbioWrapBlkDev (pBootDev); } /* split off boot device from boot file */ devSplit (fileName, bootDir); /* initialize device as a dosFs device named <bootDir> */ if (dosFsDevCreate (bootDir, cbio, 20, NONE) == ERROR) { printErr ("dosFsDevCreate failed.\n"); return (ERROR); } return (OK); }
void timex ( FUNCPTR func, /* function to time (optional) */ int arg1, /* first of up to 8 args to call function with (optional) */ int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8 ) { int scale; int time; int error; int percent; /* if function specified, clear any existing functions and add this one */ if (func != NULL) { timexClrArrays (); timexAddCall (timexTimeCalls, 0, func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); } /* calibrate if necessary */ if (overhead == 0) timexCal (); /* time calls */ timexTime (1, timexPreCalls, timexTimeCalls, timexPostCalls, &scale, &time, &error, &percent); if (percent > 50) { printErr ( "timex: execution time too short to be measured meaningfully\n"); printErr (" in a single execution.\n"); printErr (" Type \"timexN\" to time repeated execution.\n"); printErr (" Type \"timexHelp\" for more information.\n"); } else printErr ("timex: time of execution = %d +/- %d (%d%%) %s\n", time, error, percent, timexScaleText [scale]); }
int main(int argc, char *argv[]){ char fileName[30],heroName[30],super[30],appear[6]; char slash[2],slash2[2], command[10] = "null"; char newLine; if(argc == 3){ strcpy(command, argv[2]); strcpy(fileName, argv[1]); }else if(argc ==2){ strcpy(fileName, argv[1]); }else{ printErr(argv[0]); return -1; } FILE *f = fopen(fileName, "r"); if(f ==NULL){ fprintf(stderr,"Error opening file %s.\n", fileName); return 42; } struct Hero heroes[100]; int count = 0; while(fscanf(f,"%[^/]%[/]%[^/]%[/]%s%c",heroName,slash, super,slash2, appear,&newLine)==6){ strcpy(heroes[count].name,heroName); strcpy(heroes[count].super,super); strcpy(heroes[count].appear,appear); count++; } if(strcmp(command,"plain")==0){ qsort(heroes,count,sizeof(struct Hero),compare_name); printTable(heroes,command,count); }else if(strcmp(command,"super")==0){ qsort(heroes,count,sizeof(struct Hero),compare_super); printTable(heroes,command,count); }else if(strcmp(command,"appear")==0){ qsort(heroes,count,sizeof(struct Hero), compare_appear); printTable(heroes,command,count); }else if(strcmp(command,"null")==0){ printTable(heroes,command,count); }else{ printErr(argv[0]); } fclose(f); return 0; }
HANDLE serialOpen(const char* dev) { char str[64]; HANDLE fd; int err; snprintf(str, sizeof(str), "\\\\.\\%s", dev); fd = CreateFileA(str, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if(fd == INVALID_HANDLE_VALUE) { err = GetLastError(); if(err == ERROR_FILE_NOT_FOUND) { fprintf(stderr, "could not open %s: serial port does not exist\n", dev); } else { snprintf(str, sizeof(str), "could not open %s", dev); printErr(str, err); } goto failed; } if(serialSetBaudrate(fd, 115200) < 0) goto failed; return fd; failed: if(fd != INVALID_HANDLE_VALUE) CloseHandle(fd); return INVALID_HANDLE_VALUE; }
/********************************************************************** *%FUNCTION: sysErr *%ARGUMENTS: * str -- error message *%RETURNS: * Nothing *%DESCRIPTION: * Prints a message plus the errno value to syslog. ***********************************************************************/ void sysErr(char const *str) { char buf[1024]; sprintf(buf, "%.256s: %.256s", str, strerror(errno)); printErr(buf); }
void check_return(int ret, char *msg) { if (ret==-1) { sprintf(errbuf, "\n ERROR: %s\n\n", msg); printErr(errbuf); } }
/********************************************************************** *%FUNCTION: rp_fatal *%ARGUMENTS: * str -- error message *%RETURNS: * Nothing *%DESCRIPTION: * Prints a message to stderr and syslog and exits. ***********************************************************************/ void rp_fatal(char const *str) { printErr(str); sendPADTf(conn, "RP-PPPoE: %.256s", str); exit(1); }
int cltStopLiveAudio(HP2PSESS hsess, const char *s) { MYSESSDATA *pSessData; pSessData = P2pSessGetUserData(hsess); if(pSessData->dwLiveMediaMask & AUDIO) { int err = P2pSessSendRequest(hsess, 0, CMD_STOP_AUDIO, NULL, 0); if(err) { printErr("P2pSessSendRequest, CMD_STOP_AUDIO", err); } P2pSessCloseChannel(hsess, SCT_MEDIA_RCV, LIVE_AUDIO_CHNO); pSessData->dwLiveMediaMask &= ~AUDIO; if(pSessData->dwLiveMediaMask == 0) { pSessData->bRunLive = FALSE; PA_ThreadWaitUntilTerminate(pSessData->thdLive); PA_ThreadCloseHandle(pSessData->thdLive); } } return 0; }
/** * Closes the makefile list. * * @returns Exit code derived from @a rc. * @param pFile The file stream of the makefile list. * @param rc The current exit code. */ static int closeMakefileList(FILE *pFile, int rc) { fprintf(pFile, "\n\n"); if (fclose(pFile)) return printErr("Error closing the file list file: %s\n", strerror(errno)); return rc; }
virtual void fileMessage(int type, const QString &msg) { if (verbose && !(type & CumulativeEvalMessage) && (type & CategoryMask) == ErrorMessage) { // "Downgrade" errors, as we don't really care for them printErr(QLatin1String("WARNING: ") + msg + QLatin1Char('\n')); } }
static RTEXITCODE compareFiles(FILE *pFile1, FILE *pFile2) { if (!pFile1 || !pFile2) return RTEXITCODE_FAILURE; uint32_t cMismatches = 1; RTEXITCODE rcRet = RTEXITCODE_SUCCESS; uint64_t off = 0; for (;;) { uint8_t b1; size_t cb1 = fread(&b1, sizeof(b1), 1, pFile1); uint8_t b2; size_t cb2 = fread(&b2, sizeof(b2), 1, pFile2); if (cb1 != 1 || cb2 != 1) break; if (b1 != b2) { printErr("0x%x%08x: %#04x (%3d) != %#04x (%3d)\n", (uint32_t)(off >> 32), (uint32_t)off, b1, b1, b2, b2); rcRet = RTEXITCODE_FAILURE; cMismatches++; if (cMismatches > 128) { printErr("Too many mismatches, giving up\n"); return rcRet; } } off++; }