本文整理汇总了C++中LogErr函数的典型用法代码示例。如果您正苦于以下问题:C++ LogErr函数的具体用法?C++ LogErr怎么用?C++ LogErr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LogErr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: curl_easy_setopt
bool CurlWrapper::download_text(const std::string &url, std::string &content)
{
auto curl = std::shared_ptr<CURL>(curl_easy_init(), curl_easy_cleanup);
std::string readBuffer;
if (nullptr != curl) {
CURLcode res;
curl_easy_setopt(curl.get(), CURLOPT_CONNECTTIMEOUT, 5L);
curl_easy_setopt(curl.get(), CURLOPT_URL, url.c_str());
curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, write_callback);
curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, &readBuffer);
res = curl_easy_perform(curl.get());
content = readBuffer;
if (res == CURLcode::CURLE_OK) {
return true;
} else {
LogErr() << "Error while downloading text, curl error code: "
<< curl_easy_strerror(res);
return false;
}
} else {
LogErr() << "Error: cannot start uploading because of curl initialization error. ";
return false;
}
}
开发者ID:zzxcv1314,项目名称:StealthDrone-Purdue-,代码行数:27,代码来源:curl_wrapper.cpp
示例2: gather_statistic
static rc_t gather_statistic( statistic * data,
KDirectory *dir,
context *ctx )
{
VDBManager *my_manager;
/* because this tool is linked against the write-version
of vdb and kdb, there is no Read-Manager available... */
rc_t rc = VDBManagerMakeUpdate ( &my_manager, dir );
if ( rc != 0 )
LogErr( klogInt, rc, "VDBManagerMakeUpdate() failed\n" );
else
{
const VDatabase *my_database;
rc = VDBManagerOpenDBRead( my_manager, &my_database, NULL, "%s", ctx->src_path );
if ( rc != 0 )
LogErr( klogInt, rc, "VDBManagerOpenDBRead() failed\n" );
else
{
/* ******************************************************* */
rc = read_statistic_from_table( data, dir, ctx, my_database,
"PRIMARY_ALIGNMENT" );
/* ******************************************************* */
VDatabaseRelease( my_database );
}
VDBManagerRelease( my_manager );
}
return rc;
}
开发者ID:zengfengbo,项目名称:sra-tools,代码行数:28,代码来源:qual-recalib-stat.c
示例3: LogDebug
Json::Value Playlist::LoadJSON(const char *filename)
{
LogDebug(VB_PLAYLIST, "Playlist::LoadJSON(%s)\n", filename);
Json::Value root;
Json::Reader reader;
if (!FileExists(m_filename.c_str()))
{
LogErr(VB_PLAYLIST, "Playlist %s does not exist\n", m_filename.c_str());
return root;
}
struct stat attr;
stat(m_filename.c_str(), &attr);
LogDebug(VB_PLAYLIST, "Playlist Last Modified: %s\n", ctime(&attr.st_mtime));
m_fileTime = attr.st_mtime;
std::ifstream t(m_filename);
std::stringstream buffer;
buffer << t.rdbuf();
bool success = reader.parse(buffer.str(), root);
if (!success)
{
LogErr(VB_PLAYLIST, "Error parsing %s\n", m_filename.c_str());
return root;
}
return root;
}
开发者ID:FalconChristmas,项目名称:fpp,代码行数:34,代码来源:Playlist.cpp
示例4: curl_slist_append
bool CurlWrapper::upload_file(const std::string &url,
const std::string &path,
const progress_callback_t &progress_callback)
{
auto curl = std::shared_ptr<CURL>(curl_easy_init(), curl_easy_cleanup);
CURLcode res;
if (nullptr != curl) {
struct dl_up_progress prog;
prog.progress_callback = progress_callback;
curl_httppost *post = NULL;
curl_httppost *last = NULL;
struct curl_slist *chunk = NULL;
// avoid sending 'Expect: 100-Continue' header, required by some server implementations
chunk = curl_slist_append(chunk, "Expect:");
// disable chunked upload
chunk = curl_slist_append(chunk, "Content-Encoding: ");
// to allow efficient file upload, we need to add the file size to the header
std::string filesize_header = "File-Size: " + to_string(get_file_size(path));
chunk = curl_slist_append(chunk, filesize_header.c_str());
curl_formadd(
&post, &last, CURLFORM_COPYNAME, "file", CURLFORM_FILE, path.c_str(), CURLFORM_END);
curl_easy_setopt(curl.get(), CURLOPT_CONNECTTIMEOUT, 5L);
curl_easy_setopt(curl.get(), CURLOPT_PROGRESSFUNCTION, upload_progress_update);
curl_easy_setopt(curl.get(), CURLOPT_PROGRESSDATA, &prog);
curl_easy_setopt(curl.get(), CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, chunk);
curl_easy_setopt(curl.get(), CURLOPT_URL, url.c_str());
curl_easy_setopt(curl.get(), CURLOPT_HTTPPOST, post);
curl_easy_setopt(curl.get(), CURLOPT_NOPROGRESS, 0L);
res = curl_easy_perform(curl.get());
curl_slist_free_all(chunk);
curl_formfree(post);
if (res == CURLcode::CURLE_OK) {
if (nullptr != progress_callback) {
progress_callback(100, Status::Finished, CURLcode::CURLE_OK);
}
return true;
} else {
if (nullptr != progress_callback) {
progress_callback(0, Status::Error, res);
}
LogErr() << "Error while uploading file, curl error code: " << curl_easy_strerror(res);
return false;
}
} else {
LogErr() << "Error: cannot start uploading because of curl initialization error.";
return false;
}
}
开发者ID:zzxcv1314,项目名称:StealthDrone-Purdue-,代码行数:60,代码来源:curl_wrapper.cpp
示例5: LogErr
bool TileManager::LoadTileInfo( const TiXmlElement *strip ) {
std::string tileName, tileType;
int tileId = 0;
const char *name = strip->Attribute( "name" );
if ( name ) {
tileName = name;
} else {
LogErr( "No name specified for tile." );
return false;
}
const char *type = strip->Attribute( "type" );
if ( type ) {
tileType = type;
} else {
LogErr( "No type specified for tile." );
return false;
}
strip->QueryIntAttribute( "id", &tileId );
Tile tile( tileType, tileName, tileId );
m_tileDataName.insert(
std::pair<std::string, Tile>( tileName, tile ));
m_tileDataId.insert(
std::pair<int, Tile*>( tileId, &m_tileDataName[tileName] ));
return true;
}
开发者ID:jashank,项目名称:NT-Engine,代码行数:30,代码来源:TileManager.cpp
示例6: MemInit
void *MemAlloc (unsigned int size, char * var, char * pszFile, int nLine, int bZeroFill)
{
int *ptr;
if (!bMemInitialized)
MemInit ();
if (!size)
return NULL;
if (nMemBlockId == nDbgMemBlockId)
nDbgMemBlockId = nDbgMemBlockId;
#if LONG_MEM_ID
ptr = malloc (size + CHECKSIZE + sizeof (int) + 256);
#else
ptr = malloc (size + CHECKSIZE + sizeof (int));
#endif
if (!ptr) {
LogErr ("\nMEM_OUT_OF_MEMORY: Malloc returned NULL\n");
LogErr ("\tVar %s, file %s, nLine %d.\n", var, pszFile, nLine);
Int3 ();
return NULL;
}
#if LONG_MEM_ID
sprintf ((char *) ptr, "%s:%d", pszFile, nLine);
ptr = (int *) (((char *) ptr) + 256);
#endif
*ptr++ = size;
nBytesMalloced += size;
memset ((char *) ptr + size, CHECKBYTE, CHECKSIZE);
if (bZeroFill)
memset (ptr, 0, size);
RegisterMemBlock (ptr, pszFile, nLine);
return (void *) ptr;
}
开发者ID:paud,项目名称:d2x-xl,代码行数:34,代码来源:mem.c
示例7: assert
void NetCore::_connect(SockData* sockData)
{
assert(sockData != NULL);
SockData* newSock = new SockData;
socklen_t addrLen = sizeof(sockaddr_in);
newSock->sock = accept(sockData->sock, (sockaddr*)&(newSock->addr), &addrLen);
if (newSock->sock < 0)
{
LogErr("accept Failed: %s\n", strerror(errno));
delete newSock;
return;
}
newSock->key = rand();
struct epoll_event ev;
ev.events = EPOLLIN;
ev.data.ptr = newSock;
if (epoll_ctl(_eplFd, EPOLL_CTL_ADD, newSock->sock, &ev) < 0)
{
LogErr("epoll_ctl failed: %s\n", strerror(errno));
::close(newSock->sock);
delete newSock;
return;
}
_cliMap.insert(make_pair(newSock->sock, newSock));
LogMsg("%s:%u connect in\n", inet_ntoa(newSock->addr.sin_addr), ntohs(newSock->addr.sin_port));
}
开发者ID:cnzoupeng,项目名称:ltServ,代码行数:30,代码来源:netCore.cpp
示例8: Server
static
rc_t
Server( KNSManager* mgr )
{
rc_t rc = 0;
KEndPoint ep;
String name;
CONST_STRING(&name, KEYRING_IPC_NAME);
rc = KNSManagerInitIPCEndpoint(mgr, &ep, &name);
if (rc == 0)
{
KSocket* listener;
rc = KNSMakeListener ( &listener, &ep );
if (rc == 0)
{
shutDown = false;
while (!shutDown && rc == 0)
{
KStream* stream;
LogMsg ( klogInfo, "KeyringServer: listening");
rc = KNSListen ( listener, &stream ); /* may not return from here if no more incoming connections arrive */
if (rc == 0)
{
KThread* worker;
LogMsg ( klogInfo, "KeyringServer: detected connection");
rc = KThreadMake ( &worker, WorkerThreadFn, stream);
if (rc == 0 && worker != NULL)
{
KThreadWait(worker, NULL);
LogMsg ( klogInfo, "KeyringServer: out of worker");
}
else
LogErr(klogErr, rc, "KeyringServer: KThreadMake failed");
}
else
LogErr(klogErr, rc, "KeyringServer: KNSListen failed");
}
LogMsg ( klogInfo, "KeyringServer: shutting down");
/* TODO: make sure no incoming messages get dropped (stop accepting connections? wait for all active threads to exit?)
- lock the server */
if (keyring != NULL)
{
KeyRingRelease(keyring);
keyring = NULL;
}
KSocketRelease(listener);
}
else
LogErr(klogErr, rc, "KeyringServer: KNSMakeListener failed");
}
else
LogErr(klogErr, rc, "KeyringServer: KNSManagerInitIPCEndpoint failed");
LogMsg ( klogInfo, "KeyringServer: listener shut down");
return rc;
}
开发者ID:Jingyu9,项目名称:sra-tools,代码行数:59,代码来源:keyring-srv-main.c
示例9: KMain
rc_t CC KMain (int argc, char * argv[])
{
rc_t rc = 0;
KDirectory* wd;
KLogLevelSet(klogInfo);
LogMsg ( klogInfo, "KeyringServer: starting");
rc = KDirectoryNativeDir (&wd);
if (rc == 0)
{
KFile* lockedFile;
const char* dataDir;
char lockFileName[MAX_PATH];
if (argc < 2 || argv[1] == NULL)
dataDir = KeyRingDefaultDataDir;
else
dataDir = argv[1];
rc = string_printf(lockFileName, sizeof(lockFileName)-1, NULL, "%s/keyring_lock", dataDir);
if (rc == 0)
{
rc = KDirectoryCreateExclusiveAccessFile(wd, &lockedFile, true, 0600, kcmOpen, "%s", lockFileName);
if (rc == 0)
{
KNSManager* mgr;
rc = KNSManagerMake(&mgr);
if (rc == 0)
{
rc = string_printf(keyRingFileName, sizeof(keyRingFileName)-1, NULL, "%s/keyring", dataDir);
if (rc == 0)
rc = Server(mgr);
KNSManagerRelease(mgr);
}
else
LogErr(klogErr, rc, "KeyringServer: KNSManagerMake failed");
KFileRelease(lockedFile);
LogMsg ( klogInfo, "KeyringServer: removing lock file.");
KDirectoryRemove(wd, true, "%s", lockFileName);
}
else
{ /*TODO: check for stale lock file*/
LogMsg ( klogInfo, "KeyringServer: another instance appears to be running.");
rc = 0;
}
}
else
LogErr ( klogErr, rc, "KeyringServer: failed to build the lock file name" );
KDirectoryRelease(wd);
}
else
LogErr(klogErr, rc, "KeyringServer: KDirectoryNativeDir failed");
LogMsg ( klogInfo, "KeyringServer: finishing");
return rc;
}
开发者ID:Jingyu9,项目名称:sra-tools,代码行数:58,代码来源:keyring-srv-main.c
示例10: omxplayer_StartPlaying
int omxplayer_StartPlaying(const char *filename)
{
char fullVideoPath[2048];
LogDebug(VB_MEDIAOUT, "omxplayer_StartPlaying(%s)\n", filename);
bzero(&mediaOutputStatus, sizeof(mediaOutputStatus));
if (snprintf(fullVideoPath, 2048, "%s/%s", getVideoDirectory(), filename)
>= 2048)
{
LogErr(VB_MEDIAOUT, "Unable to play %s, full path name too long\n",
filename);
return 0;
}
if (getFPPmode() == REMOTE_MODE)
CheckForHostSpecificFile(getSetting("HostName"), fullVideoPath);
if (!FileExists(fullVideoPath))
{
LogErr(VB_MEDIAOUT, "%s does not exist!\n", fullVideoPath);
return 0;
}
// Create Pipes to/from omxplayer
pid_t omxplayerPID = forkpty(&pipeFromOMX[0], 0, 0, 0);
if (omxplayerPID == 0) // omxplayer process
{
ShutdownControlSocket();
seteuid(1000); // 'pi' user
execl("/opt/fpp/scripts/omxplayer", "/opt/fpp/scripts/omxplayer", fullVideoPath, NULL);
LogErr(VB_MEDIAOUT, "omxplayer_StartPlaying(), ERROR, we shouldn't "
"be here, this means that execl() failed\n");
exit(EXIT_FAILURE);
}
else // Parent process
{
mediaOutput->childPID = omxplayerPID;
}
// Clear active file descriptor sets
FD_ZERO (&omx_active_fd_set);
// Set description for reading from omxplayer
FD_SET (pipeFromOMX[0], &omx_active_fd_set);
mediaOutputStatus.status = MEDIAOUTPUTSTATUS_PLAYING;
omxVolumeShift = omxplayer_GetVolumeShift(getVolume());
return 1;
}
开发者ID:darylc,项目名称:fpp,代码行数:56,代码来源:omxplayer.c
示例11: dumpraddr
static void dumpraddr (unsigned char *a)
{
unsigned short port;
LogErr (" [%u.%u.%u.%u",a [0],a [1],a [2],a [3]);
port= (unsigned short)ntohs (* (unsigned short *) (a+4));
if (port)
LogErr (":%u",port);
LogErr ("]");
}
开发者ID:paud,项目名称:d2x-xl,代码行数:10,代码来源:ipx_udp.c
示例12: Ast
bool CConnClient::Send(const void* pData,uint32 uCurSize)
{
Ast( uCurSize> 0 );
if( !IsConnected() )
return false;
if(uCurSize<=0xff)
{
CGac2GasGC_Small_Shell_Message cmd;
m_pSlowSigner->SlowSignOnData(pData,uCurSize,&cmd);
cmd.uobClientTime = CTimeSystemClient::Inst()->GetFrameTime();
cmd.uobClientKnownServerFrameTime = m_uLastSyncedServerFrameTime;
cmd.usbDataLength = static_cast<uint8>(uCurSize);
TConnection<CTraitsClient>::SendCoreCmd(&cmd);
if(m_uLastSyncedServerFrameTime > 100000000000000000)
{
ostringstream strm;
strm << "CGac2GasGC_Small_Shell_Message" << m_uLastSyncedServerFrameTime;
LogErr("ClientKnownServerFrameTime Err", strm.str());
}
}
else if(uCurSize<=0xffff)
{
CGac2GasGC_Middle_Shell_Message cmd;
m_pSlowSigner->SlowSignOnData(pData,uCurSize,&cmd);
cmd.uobClientTime = CTimeSystemClient::Inst()->GetFrameTime();
cmd.uobClientKnownServerFrameTime = m_uLastSyncedServerFrameTime;
cmd.udbDataLength = static_cast<uint16>(uCurSize);
TConnection<CTraitsClient>::SendCoreCmd(&cmd);
if(m_uLastSyncedServerFrameTime > 100000000000000000)
{
ostringstream strm;
strm << "CGac2GasGC_Middle_Shell_Message" << m_uLastSyncedServerFrameTime;
LogErr("ClientKnownServerFrameTime Err", strm.str());
}
}
else
{
LogErr("客户端逻辑消息大小最大不能超过64k");
CoreShutDown("客户端逻辑消息大小最大不能超过64k");
}
SendCoreMsg(pData,uCurSize);
return true;
}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:53,代码来源:CConnClient.cpp
示例13: read_statistic_from_table
static rc_t read_statistic_from_table( statistic * data,
KDirectory *dir,
context *ctx,
const VDatabase *my_database,
const char *table_name )
{
const VTable *my_table;
rc_t rc = VDatabaseOpenTableRead( my_database, &my_table, "%s", table_name );
if ( rc != 0 )
{
LogErr( klogInt, rc, "VDatabaseOpenTableRead() failed\n" );
}
else
{
const VCursor *my_cursor;
rc = VTableCreateCursorRead( my_table, &my_cursor );
if ( rc != 0 )
LogErr( klogInt, rc, "VTableCreateCursorRead() failed\n" );
else
{
/*
spot_pos sequence;
rc = make_spot_pos( &sequence, my_database );
if ( rc == 0 )
{
*/
statistic_reader reader;
/*
rc = make_statistic_reader( &reader, &sequence, dir, my_cursor,
ctx->exclude_file_path, ctx->info );
*/
rc = make_statistic_reader( &reader, NULL, dir, my_cursor,
ctx->exclude_file_path, ctx->info );
if ( rc == 0 )
{
/* ******************************************************* */
rc = read_loop( data, ctx, &reader, my_cursor );
/* ******************************************************* */
whack_reader( &reader );
}
/*
whack_spot_pos( &sequence );
}
*/
VCursorRelease( my_cursor );
}
VTableRelease( my_table );
}
return rc;
}
开发者ID:zengfengbo,项目名称:sra-tools,代码行数:53,代码来源:qual-recalib-stat.c
示例14: LoadTerrain
void LoadTerrain (char *filename)
{
grsBitmap bmHeight;
int iff_error;
int i, j;
ubyte h, hMin, hMax;
LogErr (" loading terrain height map\n");
iff_error = iff_read_bitmap (filename, &bmHeight, BM_LINEAR);
if (iff_error != IFF_NO_ERROR) {
#if TRACE
con_printf (1, "File %s - IFF error: %s", filename, iff_errormsg (iff_error));
#endif
Error ("File %s - IFF error: %s", filename, iff_errormsg (iff_error));
}
if (gameData.render.terrain.pHeightMap)
D2_FREE (gameData.render.terrain.pHeightMap)
else
atexit (FreeTerrainHeightMap); //first time
gameData.render.terrain.nGridW = bmHeight.bmProps.w;
gameData.render.terrain.nGridH = bmHeight.bmProps.h;
Assert (gameData.render.terrain.nGridW <= TERRAIN_GRID_MAX_SIZE);
Assert (gameData.render.terrain.nGridH <= TERRAIN_GRID_MAX_SIZE);
LogErr ("heightmap loaded, size=%dx%d\n", gameData.render.terrain.nGridW, gameData.render.terrain.nGridH);
gameData.render.terrain.pHeightMap = bmHeight.bmTexBuf;
hMax = 0;
hMin = 255;
for (i = 0; i < gameData.render.terrain.nGridW; i++)
for (j = 0; j < gameData.render.terrain.nGridH; j++) {
h = HEIGHT (i, j);
if (h > hMax)
hMax = h;
if (h < hMin)
hMin = h;
}
for (i = 0; i < gameData.render.terrain.nGridW; i++) {
for (j = 0; j < gameData.render.terrain.nGridH; j++) {
HEIGHT (i, j) -= hMin;
}
}
// D2_FREE (bmHeight.bmTexBuf);
gameData.render.terrain.bmP = gameData.endLevel.terrain.bmP;
#if 0 //the following code turns the (palettized) terrain texture into a white TGA texture for testing
gameData.render.terrain.bmP->bmProps.rowSize *= 4;
gameData.render.terrain.bmP->bmProps.flags |= BM_FLAG_TGA;
D2_FREE (gameData.render.terrain.bmP->bmTexBuf);
gameData.render.terrain.bmP->bmTexBuf = D2_ALLOC (gameData.render.terrain.bmP->bmProps.h * gameData.render.terrain.bmP->bmProps.rowSize);
memset (gameData.render.terrain.bmP->bmTexBuf, 0xFF, gameData.render.terrain.bmP->bmProps.h * gameData.render.terrain.bmP->bmProps.rowSize);
#endif
LogErr (" building terrain light map\n");
BuildTerrainLightMap ();
}
开发者ID:paud,项目名称:d2x-xl,代码行数:52,代码来源:terrain.c
示例15: LogErr
int NetCore::_listen(u16 port)
{
struct sockaddr_in my_addr;
if ((_servSock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
LogErr("create socket failed: %s\n", strerror(errno));
return -1;
}
my_addr.sin_family = AF_INET;
my_addr.sin_port = htons(port);
my_addr.sin_addr.s_addr = INADDR_ANY;
int flag = 1, len = sizeof(int);
if(setsockopt(_servSock, SOL_SOCKET, SO_REUSEADDR, &flag, len) < 0)
{
LogErr("setsockopt Failed: %s\n", strerror(errno));
::close(_servSock);
return -1;
}
if (bind(_servSock, (struct sockaddr *)&my_addr, sizeof(struct sockaddr)) == -1)
{
LogErr("bind 0.0.0.0:%u failed: %s\n", port, strerror(errno));
::close(_servSock);
return -1;
}
if (listen(_servSock, EPL_MAX_EVENTS) == -1)
{
LogErr("listen on 0.0.0.0:%u failed: %s\n", port, strerror(errno));
::close(_servSock);
return -1;
}
SockData* skData = new SockData();
skData->sock = _servSock;
skData->key = 0;
struct epoll_event ev;
ev.events = EPOLLIN;
ev.data.ptr = skData;
if (epoll_ctl(_eplFd, EPOLL_CTL_ADD, _servSock, &ev) < 0)
{
LogErr("epoll_ctl failed: %s\n", strerror(errno));
::close(_servSock);
delete skData;
return -1;
}
return 0;
}
开发者ID:cnzoupeng,项目名称:ltServ,代码行数:50,代码来源:netCore.cpp
示例16: KMain
rc_t CC KMain( int argc, char * argv[] )
{
Args * args;
rc_t rc = ArgsMakeAndHandle ( &args, argc, argv, 1,
MyOptions, sizeof MyOptions / sizeof ( OptDef ) );
if ( rc != 0 )
LogErr( klogInt, rc, "ArgsMakeAndHandle() failed\n" );
else
{
context *ctx;
KLogHandlerSetStdErr();
rc = context_init( &ctx );
if ( rc != 0 )
LogErr( klogInt, rc, "context_init() failed\n" );
else
{
rc = context_capture_arguments_and_options( args, ctx );
if ( rc != 0 )
LogErr( klogInt, rc, "context_capture_arguments_and_options() failed\n" );
else
{
if ( ctx->usage_requested )
MiniUsage( args );
else
{
switch( ctx->output_mode[ 0 ] )
{
case 'd' :
case 't' : if ( context_schema_count( ctx ) == 0 )
{
OUTMSG(( "cannot write, schema-file is missing:\n" ));
Usage( args );
rc = RC( rcApp, rcNoTarg, rcConstructing, rcSelf, rcNull );
}
}
if ( rc == 0 )
{
/* ************************* */
rc = gater_and_write( ctx );
/* ************************* */
}
}
}
context_destroy ( ctx );
}
ArgsWhack ( args );
}
return rc;
}
开发者ID:zengfengbo,项目名称:sra-tools,代码行数:49,代码来源:qual-recalib-stat.c
示例17: OglInitAttributes
void OglInitAttributes (void)
{
int t;
/***/LogErr ("setting OpenGL attributes\n");
OglSetAttribute ("-gl_red", "SDL_GL_RED_SIZE", SDL_GL_RED_SIZE, 8);
OglSetAttribute ("-gl_green", "SDL_GL_GREEN_SIZE", SDL_GL_GREEN_SIZE, 8);
OglSetAttribute ("-gl_blue", "SDL_GL_BLUE_SIZE", SDL_GL_BLUE_SIZE, 8);
OglSetAttribute ("-gl_alpha", "SDL_GL_ALPHA_SIZE", SDL_GL_ALPHA_SIZE, 8);
OglSetAttribute ("-gl_buffer", "SDL_GL_BUFFER_SIZE", SDL_GL_BUFFER_SIZE, 32);
OglSetAttribute ("-gl_stencil", "SDL_GL_STENCIL_SIZE", SDL_GL_STENCIL_SIZE, 8);
if ((t = FindArg ("-gl_depth")) && Args [t+1]) {
gameStates.ogl.nDepthBits = atoi (Args [t + 1]);
if (gameStates.ogl.nDepthBits <= 0)
gameStates.ogl.nDepthBits = 24;
else if (gameStates.ogl.nDepthBits > 24)
gameStates.ogl.nDepthBits = 24;
OglSetAttribute (NULL, "SDL_GL_DEPTH_SIZE", SDL_GL_DEPTH_SIZE, gameStates.ogl.nDepthBits);
OglSetAttribute (NULL, "SDL_GL_STENCIL_SIZE", SDL_GL_STENCIL_SIZE, 8);
}
OglSetAttribute (NULL, "SDL_GL_ACCUM_RED_SIZE", SDL_GL_ACCUM_RED_SIZE, 5);
OglSetAttribute (NULL, "SDL_GL_ACCUM_GREEN_SIZE", SDL_GL_ACCUM_GREEN_SIZE, 5);
OglSetAttribute (NULL, "SDL_GL_ACCUM_BLUE_SIZE", SDL_GL_ACCUM_BLUE_SIZE, 5);
OglSetAttribute (NULL, "SDL_GL_ACCUM_ALPHA_SIZE", SDL_GL_ACCUM_ALPHA_SIZE, 5);
OglSetAttribute (NULL, "SDL_GL_DOUBLEBUFFER", SDL_GL_DOUBLEBUFFER, 1);
}
开发者ID:paud,项目名称:d2x-xl,代码行数:26,代码来源:sdlgl.c
示例18: FPD_SendData
int FPD_SendData(void *data, char *channelData, int channelCount)
{
LogDebug(VB_CHANNELDATA, "FPD_SendData(%p, %p, %d)\n",
data, channelData, channelCount);
FPDPrivData *privData = (FPDPrivData *)data;
if (channelCount > PIXELNET_DMX_DATA_SIZE)
{
LogErr(VB_CHANNELOUT,
"FPD_SendData() tried to send %d bytes when max is %d\n",
channelCount, PIXELNET_DMX_DATA_SIZE);
return 0;
}
// Copy latest data to our input buffer for processing
pthread_mutex_lock(&privData->bufLock);
memcpy(privData->inBuf, channelData, channelCount);
privData->dataWaiting = 1;
pthread_mutex_unlock(&privData->bufLock);
if (privData->threadIsRunning)
pthread_cond_signal(&privData->sendCond);
else
SendOutputBuffer(privData);
return 1;
}
开发者ID:bagumondigi,项目名称:fpp,代码行数:28,代码来源:FPD.c
示例19: FPD_Open
int FPD_Open(char *configStr, void **privDataPtr) {
LogDebug(VB_CHANNELOUT, "FPD_Open()\n");
if (!FileExists(getPixelnetFile())) {
LogDebug(VB_CHANNELOUT, "FPD config file does not exist, creating it.\n");
CreatePixelnetDMXfile(getPixelnetFile());
}
if (!InitializePixelnetDMX())
return 0;
FPDPrivData *privData =
(FPDPrivData *)malloc(sizeof(FPDPrivData));
if (privData == NULL)
{
LogErr(VB_CHANNELOUT, "Error %d allocating private memory: %s\n",
errno, strerror(errno));
return 0;
}
bzero(privData, sizeof(FPDPrivData));
pthread_mutex_init(&privData->bufLock, NULL);
pthread_mutex_init(&privData->sendLock, NULL);
pthread_cond_init(&privData->sendCond, NULL);
FPD_Dump(privData);
*privDataPtr = privData;
return 1;
}
开发者ID:bagumondigi,项目名称:fpp,代码行数:32,代码来源:FPD.c
示例20: SendFPDConfig
void SendFPDConfig()
{
int i,index;
unsigned char bufferPixelnetDMX[PIXELNET_DMX_BUF_SIZE];
memset(bufferPixelnetDMX,0,PIXELNET_DMX_BUF_SIZE);
memcpy(bufferPixelnetDMX,PixelnetDMXcontrolHeader,PIXELNET_HEADER_SIZE);
index = PIXELNET_HEADER_SIZE;
for(i=0;i<pixelnetDMXcount;i++)
{
bufferPixelnetDMX[index++] = pixelnetDMX[i].type;
bufferPixelnetDMX[index++] = (char)(pixelnetDMX[i].startChannel%256);
bufferPixelnetDMX[index++] = (char)(pixelnetDMX[i].startChannel/256);
}
if (LogMaskIsSet(VB_CHANNELOUT) && LogLevelIsSet(LOG_DEBUG))
HexDump("FPD Config Header & Data", bufferPixelnetDMX,
PIXELNET_HEADER_SIZE + (pixelnetDMXcount*3));
i = wiringPiSPIDataRW (0, (unsigned char *)bufferPixelnetDMX, PIXELNET_DMX_BUF_SIZE);
if (i != PIXELNET_DMX_BUF_SIZE)
LogErr(VB_CHANNELOUT, "Error: wiringPiSPIDataRW returned %d, expecting %d\n", i, PIXELNET_DMX_BUF_SIZE);
delayMicroseconds (10000) ;
// i = wiringPiSPIDataRW (0, bufferPixelnetDMX, PIXELNET_DMX_BUF_SIZE);
// if (i != PIXELNET_DMX_BUF_SIZE)
// LogErr(VB_CHANNELOUT, "Error: wiringPiSPIDataRW returned %d, expecting %d\n", i, PIXELNET_DMX_BUF_SIZE);
}
开发者ID:bagumondigi,项目名称:fpp,代码行数:28,代码来源:FPD.c
注:本文中的LogErr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论