本文整理汇总了C++中writeError函数的典型用法代码示例。如果您正苦于以下问题:C++ writeError函数的具体用法?C++ writeError怎么用?C++ writeError使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writeError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bsPutBit
/*---------------------------------------------*/
void bsPutBit ( BitStream* bs, Int32 bit )
{
if (bs->buffLive == 8) {
Int32 retVal = putc ( (UChar) bs->buffer, bs->handle );
if (retVal == EOF) writeError();
bytesOut++;
bs->buffLive = 1;
bs->buffer = bit & 0x1;
} else {
bs->buffer = ( (bs->buffer << 1) | (bit & 0x1) );
bs->buffLive++;
};
}
示例2: setUdpBufferSize
bool LogType::parseUdpBufferSize()
{
setUdpBufferSize( human2size( iniGetValue( ini::SECTION,
ini::VAR_SWA_UDPBUFFERSIZE, size2human(ini::settings::udpBufferSize) )));
if (iniGetError())
{
writeError( "Can't get 'UDP Buffer Size'" );
return false;
}
if ( getUdpBufferSize() == 0 )
{
writeError( "'UDP Buffer Size' invalid" );
return false;
}
writeInfo ( "UDP Buffer Size = %s (%lu bytes)",
size2human(getUdpBufferSize()).c_str(),
getUdpBufferSize());
return true;
}
示例3: Flash_Write
int Flash_Write(ioAddress offset, ioData data)
{
ioData status = 0;
IO_Write(CommandRegister, ProgramCommand);
IO_Write(offset, data);
while ((status & ReadyBit) == 0)
status = IO_Read(StatusRegister);
if (status != ReadyBit)
return writeError(status);
if (data != IO_Read(offset))
return FLASH_READ_BACK_ERROR;
return FLASH_SUCCESS;
}
示例4: sayQUIT
int sayQUIT(int hSocket)
{
unsigned char bufSend[BUF_SIZE];
memset(bufSend, 0, sizeof(bufSend));
sprintf(bufSend, "QUIT\r\n");
if (medusaSend(hSocket, bufSend, strlen(bufSend), 0) < 0)
{
writeError(ERR_ERROR, "%s failed: medusaSend was not successful", MODULE_NAME);
}
return SUCCESS;
}
示例5: getTimerByCode
Timer* getTimerByCode(int timerCode) {
int i;
for (i = 0; i < timerList.size; i++) {
Timer* timer = getTimerByIndex(i);
if (timer == NULL) {
writeError(TIMER_NULL);
return NULL;
}
if (timer->timerCode == timerCode) {
return timer;
}
}
return NULL;
}
示例6: addGameTarget
void addGameTarget(GameTarget* target, char* targetName, float gain, Location* location) {
unsigned char size = targets.size;
if (size < MAX_TARGET) {
target->name = targetName;
target->status = TARGET_AVAILABLE;
target->gain = gain;
target->location = location;
targets.targets[size] = target;
targets.size++;
}
else {
writeError(TOO_MUCH_TARGETS);
}
}
示例7: socket
clientId_t *createClient(int portno, char *hostname)
{
clientId_t *thisClient = (clientId_t *)malloc(sizeof(clientId_t));
int iret;
struct sockaddr_in serv_addr;
struct hostent *server;
thisClient->sockfd = socket(AF_INET, SOCK_STREAM, 0);
if(thisClient->sockfd < 0)
{
writeError(ERROR_SOCKET_CREATE);
return NULL;
}
server = gethostbyname(hostname);
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
bcopy((char *)server->h_addr, (char *)&serv_addr.sin_addr.s_addr,server->h_length);
serv_addr.sin_port = htons(portno);
while(connect(thisClient->sockfd,(struct sockaddr *) &serv_addr,sizeof(serv_addr)) < 0)
{
printf(" jumping\n");
}
bzero((char *)&thisClient->outbuffer,256);
bzero((char *)&thisClient->inputbuffer,256);
thisClient->newinput = 0;
thisClient->newoutput = 0;
thisClient->isDisconnect = 0;
iret = pthread_create(&thisClient->clientThread, NULL, handleCommunicationOutput, (void *)thisClient);
if(iret < 0)
{
writeError(ERROR_CLIENT_THREAD);
return NULL;
}
return thisClient;
}
示例8: go
// The "main" of the medusa module world - this is what gets called to actually do the work
int go(sLogin* logins, int argc, char *argv[])
{
int i;
char *strtok_ptr = NULL, *pOpt = NULL, *pOptTmp = NULL;
_MYSQL_DATA *psSessionData;
psSessionData = malloc(sizeof(_MYSQL_DATA));
memset(psSessionData, 0, sizeof(_MYSQL_DATA));
psSessionData->protoFlag = PROTO_NEW;
if ((argc < 0) || (argc > 1))
{
writeError(ERR_ERROR, "%s: Incorrect number of parameters passed to module (%d). Use \"-q\" option to display module usage.", MODULE_NAME, argc);
return FAILURE;
}
else
{
writeError(ERR_DEBUG_MODULE, "OMG teh %s module has been called!!", MODULE_NAME);
psSessionData->hashFlag = PASSWORD;
for (i=0; i<argc; i++) {
pOptTmp = malloc( strlen(argv[i]) + 1);
memset(pOptTmp, 0, strlen(argv[i]) + 1);
strncpy(pOptTmp, argv[i], strlen(argv[i]));
writeError(ERR_DEBUG_MODULE, "Processing complete option: %s", pOptTmp);
pOpt = strtok_r(pOptTmp, ":", &strtok_ptr);
writeError(ERR_DEBUG_MODULE, "Processing option: %s", pOpt);
if (strcmp(pOpt, "PASS") == 0) {
pOpt = strtok_r(NULL, "\0", &strtok_ptr);
writeError(ERR_DEBUG_MODULE, "Processing option parameter: %s", pOpt);
if (pOpt == NULL)
writeError(ERR_WARNING, "Method PASS requires value to be set.");
else if (strcmp(pOpt, "PASSWORD") == 0)
psSessionData->hashFlag = PASSWORD;
else if (strcmp(pOpt, "HASH") == 0)
psSessionData->hashFlag = HASH;
else
writeError(ERR_WARNING, "Invalid value for method PASS.");
}
free(pOptTmp);
}
initModule(logins, psSessionData);
}
FREE(psSessionData);
return SUCCESS;
}
示例9: go
// The "main" of the medusa module world - this is what gets called to actually do the work
int go(sLogin* logins, int argc, char *argv[])
{
int i;
char *strtok_ptr, *pOpt, *pOptTmp;
_CVS_DATA *psSessionData;
psSessionData = malloc(sizeof(_CVS_DATA));
memset(psSessionData, 0, sizeof(_CVS_DATA));
if ((argc < 0) || (argc > 1))
{
writeError(ERR_ERROR, "%s: Incorrect number of parameters passed to module (%d). Use \"-q\" option to display module usage.", MODULE_NAME, argc);
return FAILURE;
}
else
{
writeError(ERR_DEBUG_MODULE, "OMG teh %s module has been called!!", MODULE_NAME);
for (i=0; i<argc; i++) {
pOptTmp = malloc( strlen(argv[i]) + 1);
memset(pOptTmp, 0, strlen(argv[i]) + 1);
strncpy(pOptTmp, argv[i], strlen(argv[i]));
writeError(ERR_DEBUG_MODULE, "Processing complete option: %s", pOptTmp);
pOpt = strtok_r(pOptTmp, ":", &strtok_ptr);
writeError(ERR_DEBUG_MODULE, "Processing option: %s", pOpt);
if (strcmp(pOpt, "DIR") == 0)
{
pOpt = strtok_r(NULL, "\0", &strtok_ptr);
writeError(ERR_DEBUG_MODULE, "Processing option parameter: %s", pOpt);
if ( pOpt )
{
psSessionData->szDir = malloc(strlen(pOpt) + 1);
memset(psSessionData->szDir, 0, (strlen(pOpt) + 1));
strncpy((char *)psSessionData->szDir, pOpt, strlen(pOpt));
}
else
writeError(ERR_WARNING, "Method DIR requires value to be set.");
}
else
writeError(ERR_WARNING, "Invalid method: %s.", pOpt);
free(pOptTmp);
}
initModule(logins, psSessionData);
}
FREE(psSessionData);
return 0;
}
示例10: go
// The "main" of the medusa module world - this is what gets called to actually do the work
int go(sLogin* logins, int argc, char *argv[])
{
int i;
char *strtok_ptr, *pOpt, *pOptTmp;
_MODULE_DATA *psSessionData;
psSessionData = malloc(sizeof(_MODULE_DATA));
memset(psSessionData, 0, sizeof(_MODULE_DATA));
if ( !(0 <= argc <= 3) )
{
// Show usage information
writeError(ERR_ERROR, "%s is expecting 0 parameters, but it was passed %d", MODULE_NAME, argc);
}
else
{
writeError(ERR_DEBUG_MODULE, "OMG teh %s module has been called!!", MODULE_NAME);
for (i=0; i<argc; i++) {
pOptTmp = malloc( strlen(argv[i]) + 1);
memset(pOptTmp, 0, strlen(argv[i]) + 1);
strncpy(pOptTmp, argv[i], strlen(argv[i]));
writeError(ERR_DEBUG_MODULE, "Processing complete option: %s", pOptTmp);
pOpt = strtok_r(pOptTmp, ":", &strtok_ptr);
writeError(ERR_DEBUG_MODULE, "Processing option: %s", pOpt);
if (strcmp(pOpt, "EHLO") == 0)
{
pOpt = strtok_r(NULL, "\0", &strtok_ptr);
writeError(ERR_DEBUG_MODULE, "Processing option parameter: %s", pOpt);
if ( pOpt )
{
psSessionData->szEHLO = malloc(strlen(pOpt) + 1);
memset(psSessionData->szEHLO, 0, strlen(pOpt) + 1);
strncpy((char *)psSessionData->szEHLO, pOpt, strlen(pOpt));
}
else
writeError(ERR_WARNING, "Method EHLO requires value to be set.");
}
else
writeError(ERR_WARNING, "Invalid method: %s.", pOpt);
free(pOptTmp);
}
initModule(logins, psSessionData);
}
return 0;
}
示例11: LogSyslog
LogType::LogType(LogType& copy):
LogSyslog(false)
{
copy.closeUdp();
setVerbose(copy.getVerbose());
setConfigFile(copy.getConfigFile());
setStorageType(copy.getStorageType());
setIpAddress(copy.getIpAddress());
setRemotePort(copy.getRemotePort());
setSourcePort(copy.getSourcePort());
setUdpBufferSize(copy.getUdpBufferSize());
__swaParser = boost::make_shared<SWAParser>(
boost::bind(&LogType::callbackSWA, this, _1, _2, _3));
if (!__swaParser) {
writeError ("SWA Parser not allocated");
// impossible, but if something corrupt memory.
throw std::runtime_error( "Wrong log priority." );
}
// check if config file exists
if( !iniParse(getConfigFile()) )
{
writeError ("Can't parse config FILE = %s", getConfigFile().c_str());
// impossible, but if something corrupt memory.
throw std::runtime_error( "Wrong log priority." );
}
__threadRun = false;
__swaHelloReceive = false;
__terminate = false;
__udp_socket = NULL;
__udp_remote_endpoint = NULL;
}
示例12: _terminate_all_places
int32_t _terminate_all_places(){
int32_t success = -1;
//tell everyone else to exit
int32_t i;
//writeDebug("Starting thread _terminate_all_places at place");
for (i = _max_places()-1; i >= 0 ; --i) {
success = dispatcher_terminate(_toplace(i));
if (success != EXIT_SUCCESS) {
writeError("ERROR: Failed thread _terminate_all_places at place");
return EXIT_FAILURE;
}
}
writeDebug("Finished thread _terminate_all_places at place");
return success;
}
示例13: processIAClogout
/*
The sender of this command REQUESTS that the receiver forcibly log
off the user process at the receiver's end, or confirms that the
receiver has its permission to do so.
*/
int processIAClogout(int hSocket, _MODULE_DATA* _psSessionData)
{
unsigned char bufSend[] = { 0xFF, 0xFD, 0x12 }; /* IAC DO LOGOUT */
char* bufReceive = NULL;
int nReceiveBufferSize = 0;
writeError(ERR_DEBUG_MODULE, "[%s] Sending IAC DO LOGOUT command.", MODULE_NAME);
if (medusaSend(hSocket, bufSend, 3, 0) < 0)
{
writeError(ERR_ERROR, "%s failed: medusaSend was not successful", MODULE_NAME);
return FAILURE;
}
/* Receive any remaining IAC commands */
/*
bufReceive = medusaReceiveLineDelay(hSocket, &nReceiveBufferSize, RECEIVE_DELAY_1, RECEIVE_DELAY_2);
if (bufReceive == NULL)
return FAILURE;
processIAC(hSocket, _psSessionData, &bufReceive, &nReceiveBufferSize);
*/
return SUCCESS;
}
示例14: startTimerList
void startTimerList(bool enabledAll) {
_initTimers();
timerList.started = true;
if (enabledAll) {
int i;
for (i = 0; i < timerList.size; i++) {
Timer* timer = getTimerByIndex(i);
if (timer == NULL) {
writeError(TIMER_NULL);
return;
}
startTimer(timer);
}
}
}
示例15: bufferGetFirstChar
char bufferGetFirstChar(Buffer* buffer) {
int isEmpty = isBufferEmpty(buffer);
if (!isEmpty) {
char* sPointer = (char*) buffer->s;
// Shift to the right cell index
sPointer += buffer->readIndex;
char result = *sPointer;
return result;
} else {
// We must log the problem
writeError(IO_BUFFER_EMPTY);
}
return 0;
}