nsresult SVGTransformList::SetValueFromString(const nsAString& aValue) { SVGTransformListParser parser(aValue); if (!parser.Parse()) { // there was a parse error. return NS_ERROR_DOM_SYNTAX_ERR; } return CopyFrom(parser.GetTransformList()); }
nsresult SVGPointList::SetValueFromString(const nsAString& aValue) { // The spec says that the list is parsed and accepted up to the first error // encountered, so we must call CopyFrom even if an error occurs. We still // want to throw any error code from setAttribute if there's a problem // though, so we must take care to return any error code. nsresult rv = NS_OK; SVGPointList temp; nsCharSeparatedTokenizerTemplate<nsContentUtils::IsHTMLWhitespace> tokenizer( aValue, ',', nsCharSeparatedTokenizer::SEPARATOR_OPTIONAL); while (tokenizer.hasMoreTokens()) { const nsAString& token = tokenizer.nextToken(); RangedPtr<const char16_t> iter = SVGContentUtils::GetStartRangedPtr(token); const RangedPtr<const char16_t> end = SVGContentUtils::GetEndRangedPtr(token); float x; if (!SVGContentUtils::ParseNumber(iter, end, x)) { rv = NS_ERROR_DOM_SYNTAX_ERR; break; } float y; if (iter == end) { if (!tokenizer.hasMoreTokens() || !SVGContentUtils::ParseNumber(tokenizer.nextToken(), y)) { rv = NS_ERROR_DOM_SYNTAX_ERR; break; } } else { // It's possible for the token to be 10-30 which has // no separator but needs to be parsed as 10, -30 const nsAString& leftOver = Substring(iter.get(), end.get()); if (leftOver[0] != '-' || !SVGContentUtils::ParseNumber(leftOver, y)) { rv = NS_ERROR_DOM_SYNTAX_ERR; break; } } temp.AppendItem(SVGPoint(x, y)); } if (tokenizer.separatorAfterCurrentToken()) { rv = NS_ERROR_DOM_SYNTAX_ERR; // trailing comma } nsresult rv2 = CopyFrom(temp); if (NS_FAILED(rv2)) { return rv2; // prioritize OOM error code over syntax errors } return rv; }
WidgetLayout::WidgetLayout(const WidgetLayout& other): ActorTransform(mnew Data()), anchorMin(this), anchorMax(this), offsetMin(this), offsetMax(this), anchorLeft(this), anchorRight(this), anchorBottom(this), anchorTop(this), offsetLeft(this), offsetBottom(this), offsetTop(this), minSize(this), minWidth(this), minHeight(this), maxSize(this), maxWidth(this), maxHeight(this), weight(this), widthWeight(this), heigthWeight(this), offsetRight(this) { mData = (Data*)ActorTransform::mData; CopyFrom(other); mCheckMinMaxFunc = other.mCheckMinMaxFunc; }
static inline void _distpach_remote_service_cmsg(RpcServerImpl * impl, int fd, const char * buff, int ibuff){ dcrpc_msg_t rpc_msg; if (!rpc_msg.Unpack(buff, ibuff)){ GLOG_ERR("unpack rpc msg error ! buff length:%d", ibuff); return; } GLOG_TRA("recv [%d] [%s] [%s]", fd, rpc_msg.path().c_str() , rpc_msg.ShortDebugString().c_str()); auto it = impl->dispatcher.find(rpc_msg.path()); if (it == impl->dispatcher.end()){//not found rpc_msg.clear_request(); rpc_msg.set_status(RpcMsg_StatusCode_RPC_STATUS_NOT_EXIST); } else { rpc_msg.set_status(RpcMsg_StatusCode_RPC_STATUS_SUCCESS); RpcValues args((const RpcValuesImpl &)(rpc_msg.request().args())); RpcService * service = it->second; uint64_t transac_cookie = rpc_msg.cookie().transaction(); if (service->isasync()){ if (transac_cookie == 0){ GLOG_ERR("transaction is 0 but in a async call ... %s", rpc_msg.Debug()); return; } else { async_rpc_yield_call(impl, transac_cookie, fd, rpc_msg); int ret = service->yield(transac_cookie, args, *rpc_msg.mutable_response()->mutable_error(), fd); rpc_msg.mutable_response()->set_status(ret); if (ret == 0){ return; } else { rpc_msg.clear_request(); } } } else { RpcValues result; rpc_msg.mutable_response()->set_status( service->call(result, args, *rpc_msg.mutable_response()->mutable_error(), fd)); auto msg_result = rpc_msg.mutable_response()->mutable_result(); msg_result->CopyFrom(*(decltype(msg_result))result.data()); rpc_msg.clear_request(); } } if (rpc_msg.cookie().transaction() > 0){ _rpc_send_msg(impl, fd, rpc_msg); } }
//handling open request void open_handler(Msg *msg, int sender_pid) { //msg->ptr1 is pathname, msg->num1 is length of pathname, msg->num2 is proc_inode char pathname[MAXPATHNAMELEN]; CopyFrom(sender_pid,pathname,msg->ptr1,msg->num1+1); int open_inum = path_to_inum(pathname,msg->num1,msg->num2,0); if (open_inum<=0) { msg->type = ERROR; } else { msg->num1 = open_inum; inode_cache *n = read_inode(open_inum); msg->num2 = n->data.reuse; } }
//handling chdir request void chdir_handler(Msg *msg, int sender_pid) { char pathname[MAXPATHNAMELEN]; CopyFrom(sender_pid,pathname,msg->ptr1,msg->num1+1); int target_inum = path_to_inum(pathname,msg->num1,msg->num2,0); if (target_inum<=0) { perror("illegal destination directory!"); msg->type = ERROR; return; } inode_cache *n = read_inode(target_inum); if (n->data.type!=INODE_DIRECTORY) { perror("trying to change current directory to a non-directory place"); msg->type = ERROR; return; } msg->num1 = target_inum; }
CObjectImageArray &CObjectImageArray::operator= (const CObjectImageArray &Source) // Operator = { if (m_pRotationOffset) delete [] m_pRotationOffset; if (m_pGlowImages) delete [] m_pGlowImages; if (m_pScaledImages) delete [] m_pScaledImages; CopyFrom(Source); return *this; }
protocol::AccountAssetResponse PbQueryResponseFactory::serializeAccountAssetResponse( const model::AccountAssetResponse &accountAssetResponse) const { protocol::AccountAssetResponse pb_response; auto pb_account_asset = pb_response.mutable_account_assets(); for (auto &asset: accountAssetResponse.acct_assets) { auto pb_asset = new iroha::protocol::AccountAsset(); pb_asset->set_asset_id( asset.asset_id); pb_asset->set_account_id( asset.account_id); auto pb_amount = pb_asset->mutable_balance(); pb_amount->CopyFrom( serializeAmount(asset.balance)); pb_account_asset->AddAllocated(pb_asset); } return pb_response; }
int RpcServer::reply(RpcService *, uint64_t cookie, const RpcValues & result, int ret, const char * error){ RpcServiceCallContext * ctx = async_rpc_get_context(impl, cookie); if (ctx){ dcrpc_msg_t & rpc_msg = ctx->msg; rpc_msg.mutable_response()->set_status(ret); if (error){ rpc_msg.mutable_response()->set_error(error); } auto msg_result = rpc_msg.mutable_response()->mutable_result(); msg_result->CopyFrom(*(decltype(msg_result))result.data()); rpc_msg.clear_request(); ret = _rpc_send_msg(impl, ctx->fd, rpc_msg); async_rpc_resume_call(impl, cookie); return ret; } else { return -1; } }
nsresult SVGLengthList::SetValueFromString(const nsAString& aValue) { SVGLengthList temp; nsCharSeparatedTokenizerTemplate<nsContentUtils::IsHTMLWhitespace> tokenizer( aValue, ',', nsCharSeparatedTokenizer::SEPARATOR_OPTIONAL); while (tokenizer.hasMoreTokens()) { SVGLength length; if (!length.SetValueFromString(tokenizer.nextToken())) { return NS_ERROR_DOM_SYNTAX_ERR; } if (!temp.AppendItem(length)) { return NS_ERROR_OUT_OF_MEMORY; } } if (tokenizer.separatorAfterCurrentToken()) { return NS_ERROR_DOM_SYNTAX_ERR; // trailing comma } return CopyFrom(temp); }
WString WriteNamespace(List<WString>& currentNamespaces, List<WString>& namespaces, StreamWriter& writer) { vint common = 0; for (vint i = 0; i < currentNamespaces.Count() && i < namespaces.Count(); i++) { if (currentNamespaces[i] == namespaces[i]) { common++; } else { break; } } for (vint i = 0; i < currentNamespaces.Count() - common; i++) { WString prefix; for (vint j = 0; j < currentNamespaces.Count() - i - 1; j++) { prefix += L"\t"; } writer.WriteLine(prefix + L"}"); } WString prefix; FOREACH_INDEXER(WString, ns, i, namespaces) { if (i >= common) { writer.WriteLine(prefix + L"namespace " + ns); writer.WriteLine(prefix + L"{"); } prefix += L"\t"; } CopyFrom(currentNamespaces, namespaces); return prefix; }
nsresult SVGNumberList::SetValueFromString(const nsAString& aValue) { SVGNumberList temp; nsCharSeparatedTokenizerTemplate<IsSVGWhitespace> tokenizer(aValue, ',', nsCharSeparatedTokenizer::SEPARATOR_OPTIONAL); while (tokenizer.hasMoreTokens()) { float num; if (!SVGContentUtils::ParseNumber(tokenizer.nextToken(), num)) { return NS_ERROR_DOM_SYNTAX_ERR; } if (!temp.AppendItem(num)) { return NS_ERROR_OUT_OF_MEMORY; } } if (tokenizer.separatorAfterCurrentToken()) { return NS_ERROR_DOM_SYNTAX_ERR; // trailing comma } return CopyFrom(temp); }
void UAssetImportData::Serialize(FArchive& Ar) { if (Ar.UE4Ver() >= VER_UE4_ASSET_IMPORT_DATA_AS_JSON) { FString Json; if (Ar.IsLoading()) { Ar << Json; TOptional<FAssetImportInfo> Copy = FromJson(MoveTemp(Json)); if (Copy.IsSet()) { CopyFrom(Copy.GetValue()); } } else if (Ar.IsSaving()) { Json = ToJson(); Ar << Json; } } Super::Serialize(Ar); }
/** \brief Loads the main UI theme, and a menu theme. * * See also foundtheme(void), it will return true when called after * this method if this method was successful. * * \param menufile name of menu item xml file */ void MythThemedMenu::Init(const QString &menufile) { if (!m_state->m_loaded) { if (m_state->Create()) m_foundtheme = true; } else m_foundtheme = true; if (!m_foundtheme) return; CopyFrom(m_state); connect(m_buttonList, SIGNAL(itemSelected(MythUIButtonListItem*)), SLOT(setButtonActive(MythUIButtonListItem*))); connect(m_buttonList, SIGNAL(itemClicked(MythUIButtonListItem*)), SLOT(buttonAction(MythUIButtonListItem*))); if (!parseMenu(menufile)) m_foundtheme = false; }
nsresult SVGLengthList::SetValueFromString(const nsAString& aValue) { SVGLengthList temp; nsCharSeparatedTokenizerTemplate<IsSVGWhitespace> tokenizer(aValue, ',', nsCharSeparatedTokenizer::SEPARATOR_OPTIONAL); nsCAutoString str; // outside loop to minimize memory churn while (tokenizer.hasMoreTokens()) { SVGLength length; if (!length.SetValueFromString(tokenizer.nextToken())) { return NS_ERROR_DOM_SYNTAX_ERR; } if (!temp.AppendItem(length)) { return NS_ERROR_OUT_OF_MEMORY; } } if (tokenizer.lastTokenEndedWithSeparator()) { return NS_ERROR_DOM_SYNTAX_ERR; // trailing comma } return CopyFrom(temp); }
int main (int argc, char **argv) { char pname[MAXPATHNAMELEN]; char *temp_buff; int pid; struct my_msg msg; struct read_struct msg_read; struct read_struct msg_write; struct stat_struct msg_stat; struct old_new msg_link; struct Stat res_stat; struct readlink msg_readlink; struct seek_struct msg_seek; printf("\nYFS: Started File Server"); Initialize_Server(); if (Fork() == 0) { printf("\nCHILD\n"); pid=Exec(argv[1],argv); printf("\nval returned by exec is %d",pid); return 0; } else printf("\nPARENT\n"); while(1) { pid=Receive(&msg); //printf("\nInside while"); switch(msg.type) { case CREATE: //for create,type=1,data2=inode of current dir,ptr=ptr to path { printf("\nInside Server Create"); CopyFrom(pid,(void *)pname,msg.ptr,MAXPATHNAMELEN); msg.data2=Server_Create(pname,msg.data2); printf("\nInside Server Returning %d",msg.data2); if(msg.data2!=ERROR) msg.type=0; else msg.type=ERROR; printf("\nInside Server Returning %d",msg.type); Reply(&msg,pid); break; } case OPEN: //for Open,type=1,data2=inode of current dir,ptr=ptr to path { CopyFrom(pid,(void *)pname,msg.ptr,MAXPATHNAMELEN); msg.data2=Server_Open(pname,msg.data2); printf("\nVal returned by open is %d\n",msg.data2); if(msg.data2!=ERROR) msg.type=0; else msg.type=ERROR; printf("\nInside Server Returning %d\n",msg.type); Reply(&msg,pid); break; } case MKDIR: //for MkDir,type=1,data2=inode of current dir,ptr=ptr to path { CopyFrom(pid,(void *)pname,msg.ptr,MAXPATHNAMELEN); msg.data2=Server_MkDir(pname,msg.data2); printf("\nInside Server MkDir with name as %s and curr inode %d\n",pname,msg.data2); if(msg.data2!=ERROR) msg.type=0; else msg.type=ERROR; Reply(&msg,pid); break; } case CHDIR: //for ChDir,type=1,data2=inode of current dir,ptr=ptr to new dir { CopyFrom(pid,(void *)pname,msg.ptr,MAXPATHNAMELEN); printf("\nInside Server ChDir with name as %s and curr inode %d\n",pname,msg.data2); msg.data2=Server_ChDir(pname,msg.data2); if(msg.data2!=ERROR) msg.type=0; else msg.type=ERROR; Reply(&msg,pid); break; } case RMDIR: //for ChDir,type=1,data2=inode of current dir,ptr=ptr to dir { CopyFrom(pid,(void *)pname,msg.ptr,MAXPATHNAMELEN); msg.type=Server_RmDir(pname,msg.data2); Reply((void *)&msg,pid); break; } case READ: { CopyFrom(pid,(void *)&msg_read,msg.ptr,sizeof(struct read_struct)); temp_buff=(char *)malloc(msg_read.len+1); msg.type=Server_Read(msg.data2,msg_read.len,msg_read.offset,temp_buff); CopyTo(pid,msg_read.buff,temp_buff,msg_read.len); printf("\nInside Server ReturningRead %d",msg.type); printf("\n"); Reply((void *)&msg,pid); //free(temp_buff); break; } case WRITE: { printf("\nInside write in while"); CopyFrom(pid,(void *)&msg_write,msg.ptr,sizeof(struct read_struct)); temp_buff=(char *)malloc(msg_write.len+1); temp_buff[msg_write.len]='\0'; CopyFrom(pid,temp_buff,msg_write.buff,msg_write.len); printf("\nData for writing is %s and len =%d",temp_buff,msg_write.len); msg.type=Server_Write(msg.data2,msg_write.len,msg_write.offset,temp_buff); // //free(temp_buff); Reply((void *)&msg,pid); break; } case STAT: { CopyFrom(pid,(void *)&msg_stat,msg.ptr,sizeof(struct stat_struct)); msg.type=Server_Stat(msg.data2,msg_stat.pathname,&res_stat); if(msg.type!=ERROR) CopyTo(pid,(void *)msg_stat.statbuf,(void *)&res_stat,sizeof(struct Stat)); Reply(&msg,pid); break; } case LINK: { CopyFrom(pid,(void *)&msg_link,msg.ptr,sizeof(struct old_new)); msg.data2=Server_Link(msg.data2,msg_link.oldname,msg_link.newname); if(msg.data2==ERROR) msg.type=ERROR; else msg.type=0; Reply(&msg,pid); break; } case UNLINK: { temp_buff=(char *)malloc(MAXPATHNAMELEN*sizeof(char)); CopyFrom(pid,(void *)temp_buff,msg.ptr,MAXPATHNAMELEN); msg.type=Server_UnLink(msg.data2,temp_buff); Reply(&msg,pid); free(temp_buff); break; } case READLINK: { CopyFrom(pid,(void *)&msg_readlink,msg.ptr,sizeof(struct readlink)); temp_buff=(char *)malloc(msg_readlink.len+1); msg.type=Server_ReadLink(msg.data2,msg_readlink.pathname,msg_readlink.len,temp_buff); CopyTo(pid,msg_readlink.buf,temp_buff,msg_readlink.len); Reply(&msg,pid); break; } case SYMLINK: { CopyFrom(pid,(void *)&msg_link,msg.ptr,sizeof(struct old_new)); msg.data2=Server_SymLink(msg.data2,msg_link.oldname,msg_link.newname); if(msg.data2==ERROR) msg.type=ERROR; else msg.type=0; Reply(&msg,pid); break; } case SEEK: { CopyFrom(pid,(void *)&msg_seek,msg.ptr,sizeof(struct stat_struct)); msg.type=Server_Seek(msg.data2,msg_seek.curr_offset,msg_seek.new_offset,msg_seek.whence); Reply(&msg,pid); break; } case SHUTDOWN: { //Server_Sync(); TtyPrintf(0,"\nShutting Down Yalnix File Server!"); msg.type=0; Reply((void *)&msg,pid); Exit(0); break; } case SYNC: { Reply((void *)&msg,pid); //Server_sync(); break; } default: { msg.type=ERROR; Reply(&msg,pid); break; } } Reply(&msg,pid); } printf("\nExiting Yfs"); return 0;; }
GuestEnvironment& GuestEnvironment::operator=(const GuestEnvironmentArray &that) { CopyFrom(that); return *this; }
Guid& Guid::operator=(const Guid& other) { CopyFrom(other); return *this; }
Guid::Guid(const Guid& other) { CopyFrom(other); }
ByteQueue & ByteQueue::operator=(const ByteQueue &rhs) { Destroy(); CopyFrom(rhs); return *this; }
ByteQueue::ByteQueue(const ByteQueue ©) { CopyFrom(copy); }
Call::Call(const Call& other) :ISyntaxComponent(ISyntaxComponent::TYPE_CALL) { CopyFrom(other); }
nsresult SVGTransformList::CopyFrom(const SVGTransformList& rhs) { return CopyFrom(rhs.mItems); }
void P3DMaterialDef::operator = (const P3DMaterialDef &Source) { CopyFrom(&Source); }
nsresult SVGPointList::SetValueFromString(const nsAString& aValue) { // The spec says that the list is parsed and accepted up to the first error // encountered, so we must call CopyFrom even if an error occurs. We still // want to throw any error code from setAttribute if there's a problem // though, so we must take care to return any error code. nsresult rv = NS_OK; SVGPointList temp; nsCharSeparatedTokenizerTemplate<IsSVGWhitespace> tokenizer(aValue, ',', nsCharSeparatedTokenizer::SEPARATOR_OPTIONAL); nsAutoCString str1, str2; // outside loop to minimize memory churn while (tokenizer.hasMoreTokens()) { CopyUTF16toUTF8(tokenizer.nextToken(), str1); const char *token1 = str1.get(); if (*token1 == '\0') { rv = NS_ERROR_DOM_SYNTAX_ERR; break; } char *end; float x = float(PR_strtod(token1, &end)); if (end == token1 || !NS_finite(x)) { rv = NS_ERROR_DOM_SYNTAX_ERR; break; } const char *token2; if (*end == '-') { // It's possible for the token to be 10-30 which has // no separator but needs to be parsed as 10, -30 token2 = end; } else { if (!tokenizer.hasMoreTokens()) { rv = NS_ERROR_DOM_SYNTAX_ERR; break; } CopyUTF16toUTF8(tokenizer.nextToken(), str2); token2 = str2.get(); if (*token2 == '\0') { rv = NS_ERROR_DOM_SYNTAX_ERR; break; } } float y = float(PR_strtod(token2, &end)); if (*end != '\0' || !NS_finite(y)) { rv = NS_ERROR_DOM_SYNTAX_ERR; break; } temp.AppendItem(SVGPoint(x, y)); } if (tokenizer.lastTokenEndedWithSeparator()) { rv = NS_ERROR_DOM_SYNTAX_ERR; // trailing comma } nsresult rv2 = CopyFrom(temp); if (NS_FAILED(rv2)) { return rv2; // prioritize OOM error code over syntax errors } return rv; }
SafeArray::SafeArray(const SafeArray& other) : m_safeArray(nullptr) { CopyFrom(other); }
ECode CCellSignalStrengthGsm::constructor( /* [in] */ ICellSignalStrengthGsm* css) { return CopyFrom(css); }
void CMatrix::operator = (const CMatrix& right) { CopyFrom(right); }
void AssOverrideParameter::operator= (const AssOverrideParameter ¶m) { CopyFrom(param); }
SafeArray& SafeArray::operator=(const SafeArray& other) { CopyFrom(other); return *this; }