const char* Card::can_attack(Game* g, Player* p) const { CHECK_RETURN(controller == p); CHECK_RETURN(!tapped); CHECK_RETURN(has_text("creature")); CHECK_RETURN(!sick || has_ability("haste")); return nullptr; }
int broadcast_angles() { #if defined(THREEBODY) int num_angles = 0; angle_t angle; atom_t* atom = NULL; memset(&angle, 0, sizeof(angle)); for (int i = 0; i < g_config.natoms; ++i) { atom = g_config.conf_atoms + i - g_mpi.firstatom; if (g_mpi.myid == 0) num_angles = g_config.atoms[i].num_angles; CHECK_RETURN(MPI_Bcast(&num_angles, 1, MPI_INT, 0, MPI_COMM_WORLD)); if (i >= g_mpi.firstatom && i < (g_mpi.firstatom + g_mpi.myatoms)) { atom->angle_part = (angle_t*)Malloc(num_angles * sizeof(angle_t)); for (int j = 0; j < num_angles; ++j) memset(atom->angle_part + j, 0, sizeof(angle_t)); } for (int j = 0; j < num_angles; ++j) { if (g_mpi.myid == 0) angle = g_config.atoms[i].angle_part[j]; CHECK_RETURN(MPI_Bcast(&angle, 1, g_mpi.MPI_ANGL, 0, MPI_COMM_WORLD)); if (i >= g_mpi.firstatom && i < (g_mpi.firstatom + g_mpi.myatoms)) atom->angle_part[j] = angle; } } #endif // THREEBODY return MPI_SUCCESS; }
int broadcast_neighbors() { int num_neighs = 0; neigh_t neigh; atom_t* atom = NULL; memset(&neigh, 0, sizeof(neigh)); for (int i = 0; i < g_config.natoms; ++i) { atom = g_config.conf_atoms + i - g_mpi.firstatom; if (g_mpi.myid == 0) num_neighs = g_config.atoms[i].num_neigh; CHECK_RETURN(MPI_Bcast(&num_neighs, 1, MPI_INT, 0, MPI_COMM_WORLD)); if (num_neighs > 0 && i >= g_mpi.firstatom && i < (g_mpi.firstatom + g_mpi.myatoms)) { atom->neigh = (neigh_t*)Malloc(num_neighs * sizeof(neigh_t)); for (int j = 0; j < num_neighs; ++j) memset(atom->neigh + j, 0, sizeof(neigh_t)); } for (int j = 0; j < num_neighs; ++j) { if (g_mpi.myid == 0) neigh = g_config.atoms[i].neigh[j]; CHECK_RETURN(MPI_Bcast(&neigh, 1, g_mpi.MPI_NEIGH, 0, MPI_COMM_WORLD)); if (i >= g_mpi.firstatom && i < (g_mpi.firstatom + g_mpi.myatoms)) atom->neigh[j] = neigh; } } return MPI_SUCCESS; }
byte CRPlayer::_RspLianDui(byte byRspType, byte &byGrade, byte &byCount) { byte byRtnType = TYPE_GVP; word _bitmap = 0; switch (byRspType) { case TYPE_GVP: case TYPE_LIANDUI: _bitmap = bitmap[1] | bitmap[2] | bitmap[3]; _bitmap &= MASK_SHUNZI; _bitmap &= TblContraryMask[byGrade]; //更大的牌 word mask; while (mask = TblShunZi3[_bitmap]) { if (WORD_BIT_COUNT(mask) >= byCount) { byGrade = TblBitIndex[(mask & -mask) % 37]; return TYPE_LIANDUI; } _bitmap ^= mask; //连对长度不够 } byGrade = GRADE_INIT; byCount = 0; case TYPE_BOMB: byRtnType = _RspAnyBomb(byGrade, byCount); CHECK_RETURN(byRtnType); byRtnType = _RspAnyRocket(byGrade, byCount); CHECK_RETURN(byRtnType); } return TYPE_GVP; }
result versions(const std::string &project, redmine::config &config, redmine::options &options, std::vector<version> &versions) { std::string body; CHECK_RETURN(http::get( "/projects/" + project + "/versions.json?offset=0&limit=1000000", config, options, body)); auto Root = json::read(body, false); CHECK_JSON_TYPE(Root, json::TYPE_OBJECT); CHECK(options.debug, printf("%s\n", json::write(Root, " ").c_str())); auto Versions = Root.object().get("versions"); CHECK_JSON_PTR(Versions, json::TYPE_ARRAY); for (auto &Version : Versions->array()) { CHECK_JSON_TYPE(Version, json::TYPE_OBJECT); redmine::version version; CHECK_RETURN(version.init(Version.object())); versions.push_back(version); } return SUCCESS; }
char *get_next_line(const int fd) { static t_get *g; static int k = 0; if (k == 0) { CHECK_RETURN(g = malloc(sizeof(t_get)), NULL, NULL); g->j = 0; g->len = 0; } k = 1; g->count = 0; g->i = 0; if (++(g->j) >= g->len) { CHECK_RETURN(g->len = read(fd, g->buff, READ), 0, NULL); g->j = 0; } if (g->len <= 0 || READ <= 0) return (NULL); CHECK_RETURN(g->str = malloc(sizeof(char) * READ + 1), NULL, NULL); g->str[0] = '\0'; g->buff[g->len] = '\0'; CHECK_RETURN(traitement(g, fd), NULL, NULL); tronque(g->buff, 1, g->len - (g->i - 2)); return (g->str); }
/** Starts an infrastructure WiFi network * @param ssid : A null terminated string containing the SSID name of the network to join * @param auth_type : Authentication type: * - WICED_SECURITY_OPEN - Open Security * - WICED_SECURITY_WPA_TKIP_PSK - WPA Security * - WICED_SECURITY_WPA2_AES_PSK - WPA2 Security using AES cipher * - WICED_SECURITY_WPA2_MIXED_PSK - WPA2 Security using AES and/or TKIP ciphers * - WEP security is currently unimplemented due to lack of security * @param security_key : A byte array containing the cleartext security key for the network * @param key_length : The length of the security_key in bytes. * @param channel : 802.11 Channel number * * @return WWD_SUCCESS : if successfully creates an AP * Error code : if an error occurred */ wwd_result_t wwd_wifi_start_ap( wiced_ssid_t* ssid, wiced_security_t auth_type, const uint8_t* security_key, uint8_t key_length, uint8_t channel ) { CHECK_RETURN( wwd_wifi_ap_init( ssid, auth_type, security_key, key_length, channel ) ); CHECK_RETURN( wwd_wifi_ap_up() ); return WWD_SUCCESS; }
wwd_result_t wwd_wifi_stop_ap( void ) { uint32_t* data; wiced_buffer_t buffer; wiced_buffer_t response; wwd_result_t result; wwd_result_t result2; /* Query bss state (does it exist? if so is it UP?) */ data = (uint32_t*) wwd_sdpcm_get_iovar_buffer( &buffer, (uint16_t) 4, IOVAR_STR_BSS ); CHECK_IOCTL_BUFFER( data ); *data = wwd_get_bss_index( WWD_AP_INTERFACE ); result = wwd_sdpcm_send_iovar( SDPCM_GET, buffer, &response, WWD_STA_INTERFACE ); if ( result == WWD_WLAN_NOTFOUND ) { /* AP interface does not exist - i.e. it is down */ wwd_wifi_ap_is_up = WICED_FALSE; return WWD_SUCCESS; } CHECK_RETURN( result ); data = (uint32_t*) host_buffer_get_current_piece_data_pointer( response ); if ( data[0] != (uint32_t) BSS_UP ) { /* AP interface indicates it is not up - i.e. it is down */ host_buffer_release( response, WWD_NETWORK_RX ); wwd_wifi_ap_is_up = WICED_FALSE; return WWD_SUCCESS; } host_buffer_release( response, WWD_NETWORK_RX ); /* set BSS down */ data = (uint32_t*) wwd_sdpcm_get_iovar_buffer( &buffer, (uint16_t) 8, IOVAR_STR_BSS ); CHECK_IOCTL_BUFFER( data ); data[0] = wwd_get_bss_index( WWD_AP_INTERFACE ); data[1] = (uint32_t) BSS_DOWN; CHECK_RETURN( wwd_sdpcm_send_iovar( SDPCM_SET, buffer, 0, WWD_STA_INTERFACE ) ); /* Wait until AP is brought down */ result = host_rtos_get_semaphore( &wwd_wifi_sleep_flag, (uint32_t) 10000, WICED_FALSE ); result2 = host_rtos_deinit_semaphore( &wwd_wifi_sleep_flag ); if ( result != WWD_SUCCESS ) { return result; } if ( result2 != WWD_SUCCESS ) { return result2; } CHECK_RETURN( wwd_management_set_event_handler( apsta_events, NULL, NULL, WWD_AP_INTERFACE ) ); wwd_wifi_ap_is_up = WICED_FALSE; return WWD_SUCCESS; }
/* Init Toneport device. */ int toneport_init(struct usb_interface *interface, struct usb_line6_toneport *toneport) { int err, ticks; struct usb_line6 *line6 = &toneport->line6; struct usb_device *usbdev; if ((interface == NULL) || (toneport == NULL)) return -ENODEV; /* initialize audio system: */ err = line6_init_audio(line6); if (err < 0) { toneport_destruct(interface); return err; } /* initialize PCM subsystem: */ err = line6_init_pcm(line6, &toneport_pcm_properties); if (err < 0) { toneport_destruct(interface); return err; } /* register audio system: */ err = line6_register_audio(line6); if (err < 0) { toneport_destruct(interface); return err; } usbdev = line6->usbdev; line6_read_serial_number(line6, &toneport->serial_number); line6_read_data(line6, 0x80c2, &toneport->firmware_version, 1); /* sync time on device with host: */ ticks = (int)get_seconds(); line6_write_data(line6, 0x80c6, &ticks, 4); /* seems to work without the first two... */ /* toneport_send_cmd(usbdev, 0x0201, 0x0002); */ /* toneport_send_cmd(usbdev, 0x0801, 0x0000); */ /* only one that works for me; on GP, TP might be different? */ toneport_send_cmd(usbdev, 0x0301, 0x0000); if (usbdev->descriptor.idProduct != LINE6_DEVID_GUITARPORT) { CHECK_RETURN(device_create_file (&interface->dev, &dev_attr_led_red)); CHECK_RETURN(device_create_file (&interface->dev, &dev_attr_led_green)); toneport_update_led(&usbdev->dev); } return 0; }
int CAppCtrl::WorkInit() { ///停止主循环,待Init执行完毕后再执行主循环 m_InitFinish = false; //初始化数据缓冲区 m_stClientEncodeBuf.Attach(NULL, STREAM_BUFF_LENGTH, 0); m_stServerEncodeBuf.Attach(NULL, STREAM_BUFF_LENGTH, 0); m_stClientDecodeBuf.Attach(NULL, STREAM_BUFF_LENGTH, 0); ///初始化後台連接 int iRet = 0; bool NewServer = false; for (size_t i = 0; i < APP_CONF->SvrConnectInfo.size(); ++i) { CSvrConnectParam& stParam = APP_CONF->SvrConnectInfo[i]; if(stParam.Index < 0 || stParam.Index >= EMAX_SVRCONN_COUNT) { SL_ERROR("invalid svr index %d, must in[0~%d]", stParam.Index, EMAX_SVRCONN_COUNT); return -1; } iRet = m_SvrConnect[stParam.Index].Init(GetEpoll(), stParam); CHECK_RETURN(iRet); iRet = m_SvrConnect[stParam.Index].ConnectSvr(); CHECK_RETURN(iRet); } //加载业务so /*iRet = m_stSoLoader.LoadAppSo(APP_CONF->SoPath.c_str()); CHECK_RETURN(iRet); CAppSoInf* pstAppSo = m_stSoLoader.CreateAppSo(); if(pstAppSo == NULL) { return -1; }*/ //调用so的onInit //iRet = SL_APPSO->OnInitConfig(); CHECK_RETURN(iRet); SL_TRACE("appctrl init OnInitConfig"); ///内存预分配 iRet = InitAppBuffer(); CHECK_RETURN(iRet); SL_TRACE("appctrl init InitAppBuffer"); /*iRet = SL_APPSO->OnInitBuffer(); CHECK_RETURN(iRet); SL_TRACE("appctrl init OnInitBuffer");*/ iRet = m_stShmBuff.CreateBuff("key/appsvr.key"); CHECK_RETURN(iRet); SL_TRACE("appctrl init CreateBuff"); }
byte CRPlayer::_RspBomb(byte byRspType, byte &byGrade, byte &byCount) { byte byRtnType = TYPE_GVP; switch (byRspType) { case TYPE_GVP: case TYPE_BOMB: byRtnType = _RspAnyBomb(byGrade, byCount); CHECK_RETURN(byRtnType); byRtnType = _RspAnyRocket(byGrade, byCount); CHECK_RETURN(byRtnType); } return TYPE_GVP; }
const char* Card::can_tap(Game* g, Player* p) const { // Does the player control it? CHECK_RETURN(controller == p); // Is it not tapped? CHECK_RETURN(!tapped); // Is it in play? CHECK_RETURN(g->is_in_play(this)); // If it's a creature, is it sick? CHECK_RETURN(!has_text("creature") || !sick || has_ability("haste")); return nullptr; }
void PlanetWars::IssueOrder(int source_planet, int destination_planet, int num_ships) const { LOG("IssueOrder : (%3d -> %3d) [%3d]\n", source_planet, destination_planet, num_ships); CHECK_RETURN(GetPlanet(source_planet).GetOwner() == 1, "Error : Bad Source Planet\n"); CHECK_RETURN(source_planet != destination_planet, "Error : Same Planet\n"); CHECK_RETURN(GetPlanet(source_planet).GetRealShipsCount() >= num_ships, "Error : Too many Ship (%d pour %d)\n", num_ships, GetPlanet(source_planet).GetRealShipsCount()); CHECK_RETURN(num_ships > 0, "Error : Negative ship count\n"); cout << source_planet << " " << destination_planet << " " << num_ships << endl; cout.flush(); }
byte CRPlayer::_RspQuadP(byte byRspType, byte &byGrade, byte &byCount, word &wAttach, word &wChoice) { byte byRtnType = TYPE_GVP; switch (byRspType) { case TYPE_GVP: case TYPE_QUAD_P: byRtnType = _RspAnyQuadP(byGrade, byCount, wAttach, wChoice); CHECK_RETURN(byRtnType); case TYPE_BOMB: byRtnType = _RspAnyBomb(byGrade, byCount); CHECK_RETURN(byRtnType); byRtnType = _RspAnyRocket(byGrade, byCount); CHECK_RETURN(byRtnType); } return TYPE_GVP; }
int main(int argc, char* argv[]){ int ret; AppContext ctx; ret = parseArgs(argc, argv, ctx); CHECK_RETURN(ret); ret = loadWords(ctx); CHECK_RETURN(ret); ret = process(ctx); return ret; }
/** @ingroup n8_packet * @brief Precomputes values for MD5 hashes. * * @param cipherInfo_p RW: Cipher information * @param packetObject_p RO: Pointer to packet object. May be NULL. * @param req_pp RW: Pointer to request pointer. * * @par Externals * None * * @return * Status code * * @par Errors * None * @par Assumptions * None *****************************************************************************/ static N8_Status_t n8_initializeSSL_req(N8_CipherInfo_t *cipherInfo_p, N8_Packet_t *packetObject_p, N8_Buffer_t **ctx_pp, uint32_t *ctxa_p, API_Request_t **req_pp) { N8_Status_t ret = N8_STATUS_OK; API_Request_t *req_p = NULL; do { CHECK_OBJECT(cipherInfo_p, ret); CHECK_OBJECT(packetObject_p, ret); /* initialize set the return request pointer to NULL. it wil be reset * with an actual value later if necessary. */ *req_pp = NULL; ret = n8_precompute_ssl_ipad_opad(packetObject_p->cipherInfo.macSecret, packetObject_p->cipherInfo.precompute1, packetObject_p->cipherInfo.precompute2); CHECK_RETURN(ret); } while (FALSE); /* * Clean up if we arrived from an error condition. */ if (ret != N8_STATUS_OK) { freeRequest(req_p); } return ret; } /* n8_initializeSSL_req */
static void DrawBitmap(HDC hdc, HBITMAP hBitmap, int x, int y, int rop) { BITMAP bm; HDC hdcMem; POINT ptSize, ptOrg; HBITMAP tmp; ASSERT(hdc != NULL); ASSERT(hBitmap != NULL); hdcMem = CreateCompatibleDC(hdc); ASSERT(hdcMem != NULL); CHECK_RETURN(tmp = SelectObject(hdcMem, hBitmap)); SetMapMode(hdcMem, GetMapMode(hdc)); GetObject(hBitmap, sizeof(BITMAP), (LPVOID)&bm); ptSize.x = bm.bmWidth; ptSize.y = bm.bmHeight; DPtoLP(hdc, &ptSize, 1); ptOrg.x = 0; ptOrg.y = 0; DPtoLP(hdcMem, &ptOrg, 1); BitBlt(hdc, x, y, ptSize.x, ptSize.y, hdcMem, ptOrg.x, ptOrg.y, rop); SelectObject(hdcMem, tmp); DeleteDC(hdcMem); }
/// Causes an invariant failure dependent on first argument value. /// One ignored argument is accepted to conform with the test.pl script, /// which would be the input source file for other cbmc driver programs. /// Returns 1 on unexpected arguments. int main(int argc, char** argv) { if(argc!=3) return 1; std::string arg=argv[1]; if(arg=="structured") INVARIANT_STRUCTURED(false, structured_error_testt, 1, "Structured error"); // NOLINT else if(arg=="string") INVARIANT(false, "Test invariant failure"); else if(arg=="precondition-structured") PRECONDITION_STRUCTURED(false, structured_error_testt, 1, "Structured error"); // NOLINT else if(arg=="precondition-string") PRECONDITION(false); else if(arg=="postcondition-structured") POSTCONDITION_STRUCTURED(false, structured_error_testt, 1, "Structured error"); // NOLINT else if(arg=="postcondition-string") POSTCONDITION(false); else if(arg=="check-return-structured") CHECK_RETURN_STRUCTURED(false, structured_error_testt, 1, "Structured error"); // NOLINT else if(arg=="check-return-string") CHECK_RETURN(false); else if(arg=="unreachable-structured") UNREACHABLE_STRUCTURED(structured_error_testt, 1, "Structured error"); // NOLINT else if(arg=="unreachable-string") UNREACHABLE; else if(arg=="data-invariant-structured") DATA_INVARIANT_STRUCTURED(false, structured_error_testt, 1, "Structured error"); // NOLINT else if(arg=="data-invariant-string") DATA_INVARIANT(false, "Test invariant failure"); else if(arg=="irep") INVARIANT_WITH_IREP(false, "error with irep", pointer_type(void_typet())); else return 1; }
/* Numerics Matrix wrapper for y <- alpha A x + beta y */ void NM_gemv(const double alpha, NumericsMatrix* A, const double *x, const double beta, double *y) { switch (A->storageType) { case NM_DENSE: { cblas_dgemv(CblasColMajor, CblasNoTrans, A->size0, A->size1, alpha, A->matrix0, A->size0, x, 1, beta, y, 1); break; } case NM_SPARSE_BLOCK: { prodSBM(A->size1, A->size0, alpha, A->matrix1, x, beta, y); break; } default: { assert(A->storageType == NM_SPARSE); CHECK_RETURN(cs_aaxpy(alpha, NM_csc(A), x, beta, y)); } } }
void PlanetWars::EditFleet(uint16 id, uint16 iShipCount, sint16 iStartTurn) { FleetMap::iterator it = m_aFleets.find(id); ASSERT(it != m_aFleets.end()); Fleet& oFleet = it->second; CHECK_RETURN(oFleet.GetStartTurn() >= 0, "Error : try to edit an flying Fleet\n"); Planet& SrcPlanet = GetPlanet(oFleet.GetSourcePlanet()); Planet& DstPlanet = GetPlanet(oFleet.GetDestinationPlanet()); if (iStartTurn == 0) RemoveInfluence(SrcPlanet); SrcPlanet.RemoveFleet(oFleet); DstPlanet.RemoveFleet(oFleet); oFleet.m_iShipsCount = iShipCount; oFleet.m_iStartTurn = iStartTurn; SrcPlanet.AddFleet(oFleet); DstPlanet.AddFleet(oFleet); SrcPlanet.Compute(); DstPlanet.Compute(); if (iStartTurn == 0) ApplyInfluence(SrcPlanet); }
/** @ingroup SystemInfo * @brief Get the sizes of the SKS memory for all PKP units. * * Currently all of the hardware or emulation types have only one unit of any * type. When this ceases to be true, we will need to revisit this call. * * @param value_p WO: Pointer in which to store unit types. * * @par Externals: * None. * * @return * N8_STATUS_OK: The function worked correctly. * N8_INVALID_OBJECT: The output pointer is NULL. * * @par Errors: * N8_INVALID_OBJECT as described in the return section. * * * @par Locks: * None. * * @par Assumptions: * This function can not be called until the initialization of the API * is complete. The value_p pointer points to a "reasonable" array. *****************************************************************************/ static N8_Status_t setSKSsize(N8_Buffer_t *value_p) { N8_Status_t ret = N8_STATUS_OK; int nStructs; int i; unsigned long *vPtr_p; DBG(("setSKSSize\n")); do { CHECK_OBJECT(value_p, ret); nStructs = nspDriverInfo.numChips; vPtr_p = (unsigned long *)value_p; for (i = 0; i < nStructs; i++) { memcpy(vPtr_p, &nspDriverInfo.chipInfo[i].SKS_size, sizeof(unsigned long)); vPtr_p ++; } CHECK_RETURN(ret); }while (FALSE); DBG(("setSKSSize - OK\n")); return ret; } /* setSKSsize */
void *traitement(t_get *g, const int fd) { while (g->buff[g->i] != '\n' && g->buff[g->i] != 0) if (g->j + 1 == g->len || (g->buff[g->i + 1] == '\n' || g->buff[g->i + 1] < 32)) { while (g->str[g->count++]); if (g->str) CHECK_RETURN(g->str = my_realloc(g->str, (g->count + g->i + 1)), NULL, NULL); my_strncat(g->str, g->buff, g->i + 1); tronque(g->buff, g->i + 1, g->len); ++(g->j); g->i = 0; if (g->buff[g->i] == '\n' || g->buff[g->i] < 32) if (g->buff[g->i] == '\0') { if ((g->len = read(fd, g->buff, READ)) == 0) return (g->str); g->j = 0; } } else { ++(g->j); ++(g->i); } }
int sdp_encode_list_to_file (session_desc_t *sptr, const char *filename, int append) { FILE *ofile; sdp_encode_t sdp; int retval; CHECK_RETURN(prepare_sdp_encode(&sdp)); ofile = fopen(filename, append ? "a" : "w"); if (ofile == NULL) { free(sdp.buffer); return (-1); } while (sptr != NULL) { sdp.used = 0; retval = sdp_encode(sptr, &sdp); if (retval != 0) { break; } fputs(sdp.buffer, ofile); sptr = sptr->next; } fclose(ofile); free(sdp.buffer); return (0); }
bool CLoginKernel::CreateConfig() { CHECK_RETURN(m_pDb, false); SQLBUF strSQL; strSQL << "SELECT * FROM " << TBL_CONFIG; const CGameRecordset& rRes = m_pDb->Select(strSQL); for (int i = 0; i < rRes.size(); ++i) { const CGameRecordRow& rRow = rRes.at(i); int nType = rRow[CONFIGDATA_TYPE]; switch (nType) { case GAME_CFGTYPE_OPEN_TIME: { m_u32OpenTime = rRow[CONFIGDATA_DATA1]; } break; default: break; } } return true; }
bool CLoginKernel::Create() { bool bSucc = IKernel::Create(); CHECK_RETURN(bSucc, false); INIReader objIni(CONFIG_FILE_NAME); DbConfig_t stDbConfig; CHECK_RETURN(GameServer()->GetGameDbConfig(stDbConfig), false); m_pDb = CGameDatabase::CreateGameDatabase(stDbConfig.strServer.c_str(), stDbConfig.strUser.c_str(), stDbConfig.strPassword.c_str(), stDbConfig.strDatabase.c_str()); CHECK_RETURN(m_pDb, false); m_tClientTimeOut.StartTimer(); return true; }
bool CAccountSocketKernel::Create() { bool bSucc = IKernel::Create(); CHECK_RETURN(bSucc, false); return true; }
/* Create sysfs entries. */ static int variax_create_files2(struct device *dev) { int err; CHECK_RETURN(device_create_file(dev, &dev_attr_model)); CHECK_RETURN(device_create_file(dev, &dev_attr_volume)); CHECK_RETURN(device_create_file(dev, &dev_attr_tone)); CHECK_RETURN(device_create_file(dev, &dev_attr_name)); CHECK_RETURN(device_create_file(dev, &dev_attr_bank)); CHECK_RETURN(device_create_file(dev, &dev_attr_dump)); CHECK_RETURN(device_create_file(dev, &dev_attr_active)); CHECK_RETURN(device_create_file(dev, &dev_attr_guitar)); #ifdef CONFIG_LINE6_USB_RAW CHECK_RETURN(device_create_file(dev, &dev_attr_raw)); CHECK_RETURN(device_create_file(dev, &dev_attr_raw2)); #endif return 0; }
bool CClient::Create(RakNet::Packet* pPacket) { CHECK_RETURN(pPacket, false); m_idClient = pPacket->guid.g; m_objAddr = pPacket->systemAddress; return true; }
int sdp_encode_one_to_file (session_desc_t *sptr, const char *filename, int append) { FILE *ofile; sdp_encode_t sdp; CHECK_RETURN(prepare_sdp_encode(&sdp)); CHECK_RETURN(sdp_encode(sptr, &sdp)); ofile = fopen(filename, append ? "a" : "w"); if (ofile == NULL) { sdp_debug(LOG_CRIT, "Cannot open file %s", filename); free(sdp.buffer); return (-1); } fputs(sdp.buffer, ofile); fclose(ofile); free(sdp.buffer); return (0); }
/* Create sysfs entries. */ static int variax_create_files2(struct device *dev) { int err; CHECK_RETURN(device_create_file(dev, &dev_attr_model)); CHECK_RETURN(device_create_file(dev, &dev_attr_volume)); CHECK_RETURN(device_create_file(dev, &dev_attr_tone)); CHECK_RETURN(device_create_file(dev, &dev_attr_name)); CHECK_RETURN(device_create_file(dev, &dev_attr_bank)); CHECK_RETURN(device_create_file(dev, &dev_attr_dump)); CHECK_RETURN(device_create_file(dev, &dev_attr_active)); #if CREATE_RAW_FILE CHECK_RETURN(device_create_file(dev, &dev_attr_raw)); CHECK_RETURN(device_create_file(dev, &dev_attr_raw2)); #endif return 0; }