• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ qstrncpy函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中qstrncpy函数的典型用法代码示例。如果您正苦于以下问题:C++ qstrncpy函数的具体用法?C++ qstrncpy怎么用?C++ qstrncpy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了qstrncpy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: qstrncpy

void idaapi function_list::get_line(void *obj,uint32 n,char * const *arrptr)
{
  if ( n == 0 ) // generate the column headers
  {
    for ( int i=0; i < qnumber(header); i++ )
      qstrncpy(arrptr[i], header[i], MAXSTR);
    return;
  }
  function_list & ms = *(function_list*)obj;

  ea_t ea = ms.functions[n-1];
  qsnprintf(arrptr[0], MAXSTR, "%08a", ea);
  get_func_name(ea, arrptr[1], MAXSTR);
  //get_short_name(BADADDR, ea, arrptr[1], MAXSTR);
  //get_demangled_name(BADADDR, ea,  arrptr[1], MAXSTR, inf.long_demnames, DEMNAM_NAME, 0);
  func_t * f = get_func(ea);
  if(f)
  {
	  const char * cmt = get_func_cmt(f, true);
	  if(cmt)
	  {
		  qstrncpy(arrptr[2], cmt, MAXSTR);		
	  }
	
  }

}
开发者ID:caznova,项目名称:hexrays_tools,代码行数:27,代码来源:choosers.cpp


示例2: qstrncpy

int CSyncThread::getauth(const char *prompt,
                         char *buf,
                         size_t len,
                         int echo,
                         int verify,
                         void *userdata
                         )
{
    int re = 0;

    QString qPrompt = QString::fromLocal8Bit( prompt ).trimmed();
    _mutex.lock();

    if( qPrompt == QLatin1String("Enter your username:") ) {
        // qDebug() << "OOO Username requested!";
        qstrncpy( buf, _user.toUtf8().constData(), len );
    } else if( qPrompt == QLatin1String("Enter your password:") ) {
        // qDebug() << "OOO Password requested!";
        qstrncpy( buf, _passwd.toUtf8().constData(), len );
    } else {
        if( qPrompt.startsWith( QLatin1String("There are problems with the SSL certificate:"))) {
            // SSL is requested. If the program came here, the SSL check was done by mirall
            // the answer is simply yes here.
            qstrcpy( buf, "yes" );
        } else {
            qDebug() << "Unknown prompt: <" << prompt << ">";
            re = -1;
        }
    }
    _mutex.unlock();
    return re;
}
开发者ID:valarauco,项目名称:galletica,代码行数:32,代码来源:csyncthread.cpp


示例3: TFuncMallocWrapper

	TFuncMallocWrapper(char* f_name, char* _ancestor, int m_size_count )
	{
		qstrncpy(alloc_func_name,f_name,MAXSTR);
		qstrncpy(ancestor,_ancestor,MAXSTR);
		push_malloc_size_count =m_size_count;
		address= BADADDR;
		type = STANDART;
	}
开发者ID:melbcat,项目名称:findMalloc,代码行数:8,代码来源:findMalloc.cpp


示例4: createMenuItem

/* Helper function to create a menu item */
static struct PluginMenuItem* createMenuItem(enum PluginMenuType type, int id, const char* text, const char* icon)
{
    struct PluginMenuItem* menuItem = (struct PluginMenuItem*)malloc(sizeof(struct PluginMenuItem));
    menuItem->type = type;
    menuItem->id = id;
    qstrncpy(menuItem->text, text, PLUGIN_MENU_BUFSZ);
    qstrncpy(menuItem->icon, icon, PLUGIN_MENU_BUFSZ);
    return menuItem;
}
开发者ID:AngryJoker,项目名称:CrossTalk,代码行数:10,代码来源:ts_context_menu_qt.cpp


示例5: locker

int ownCloudFolder::getauth(const char *prompt,
                         char *buf,
                         size_t len,
                         int echo,
                         int verify,
                         void *userdata
                         )
{
    int re = 0;
    QMutex mutex;

    QString qPrompt = QString::fromLatin1( prompt ).trimmed();
    QString user = CredentialStore::instance()->user();
    QString pwd  = CredentialStore::instance()->password();

    if( qPrompt == QLatin1String("Enter your username:") ) {
        // qDebug() << "OOO Username requested!";
        QMutexLocker locker( &mutex );
        qstrncpy( buf, user.toUtf8().constData(), len );
    } else if( qPrompt == QLatin1String("Enter your password:") ) {
        QMutexLocker locker( &mutex );
        // qDebug() << "OOO Password requested!";
        qstrncpy( buf, pwd.toUtf8().constData(), len );
    } else {
        if( qPrompt.startsWith( QLatin1String("There are problems with the SSL certificate:"))) {
            // SSL is requested. If the program came here, the SSL check was done by mirall
            // It needs to be checked if the  chain is still equal to the one which
            // was verified by the user.
            QRegExp regexp("fingerprint: ([\\w\\d:]+)");
            bool certOk = false;

            int pos = 0;

            // This is the set of certificates which QNAM accepted, so we should accept
            // them as well
            QList<QSslCertificate> certs = ownCloudInfo::instance()->certificateChain();

            while (!certOk && (pos = regexp.indexIn(qPrompt, 1+pos)) != -1) {
                QString neon_fingerprint = regexp.cap(1);

                foreach( const QSslCertificate& c, certs ) {
                    QString verified_shasum = Utility::formatFingerprint(c.digest(QCryptographicHash::Sha1).toHex());
                    qDebug() << "SSL Fingerprint from neon: " << neon_fingerprint << " compared to verified: " << verified_shasum;
                    if( verified_shasum == neon_fingerprint ) {
                        certOk = true;
                        break;
                    }
                }
            }
            // certOk = false;     DEBUG setting, keep disabled!
            if( !certOk ) { // Problem!
                qstrcpy( buf, "no" );
                re = -1;
            } else {
                qstrcpy( buf, "yes" ); // Certificate is fine!
            }
        } else {
开发者ID:SilentHunter124,项目名称:mirall,代码行数:57,代码来源:owncloudfolder.cpp


示例6: ch_getl

//---------------------------------------------------------------------------
static void idaapi ch_getl(void *obj, uint32 n, char *const *arrptr)
{
  x86seh_ctx_t *ctx = (x86seh_ctx_t *)obj;
  if ( n == 0 )
  {
    qstrncpy(arrptr[0], x86seh_chooser_cols[0], MAXSTR);
    qstrncpy(arrptr[1], x86seh_chooser_cols[1], MAXSTR);
    return;
  }
  uint32 addr = ctx->handlers[n-1];
  qsnprintf(arrptr[0], MAXSTR, "%08X", addr);
  get_nice_colored_name(addr, arrptr[1], MAXSTR, GNCN_NOCOLOR | GNCN_NOLABEL);
}
开发者ID:nihilus,项目名称:ida_objectivec_plugins,代码行数:14,代码来源:w32sehch.cpp


示例7: split_chooser_caption

  bool split_chooser_caption(qstring *out_title, qstring *out_caption, const char *caption) const
  {
    if ( get_embedded() != NULL )
    {
      // For embedded chooser, the "caption" will be overloaded to encode
      // the AskUsingForm's title, caption and embedded chooser id
      // Title:EmbeddedChooserID:Caption

      char title_buf[MAXSTR];
      const char *ptitle;

      static const char delimiter[] = ":";
      char temp[MAXSTR];
      qstrncpy(temp, caption, sizeof(temp));

      char *ctx;
      char *p = qstrtok(temp, delimiter, &ctx);
      if ( p == NULL )
        return false;

      // Copy the title
      char title_str[MAXSTR];
      qstrncpy(title_str, p, sizeof(title_str));

      // Copy the echooser ID
      p = qstrtok(NULL, delimiter, &ctx);
      if ( p == NULL )
        return false;

      char id_str[10];
      qstrncpy(id_str, p, sizeof(id_str));

      // Form the new title of the form: "AskUsingFormTitle:EchooserId"
      qsnprintf(title_buf, sizeof(title_buf), "%s:%s", title_str, id_str);

      // Adjust the title
      *out_title = title_buf;

      // Adjust the caption
      p = qstrtok(NULL, delimiter, &ctx);
      *out_caption = caption + (p - temp);
    }
    else
    {
      *out_title = title;
      *out_caption = caption;
    }
    return true;
  }
开发者ID:Hehouhua,项目名称:idapython,代码行数:49,代码来源:py_choose2.hpp


示例8: choose_device

inline static bool idaapi choose_device(TView *[] = NULL, int = 0)
{
    bool ok = choose_ioport_device(cfgname, device, sizeof(device), NULL);
    if ( !ok )
        qstrncpy(device, NONEPROC, sizeof(device));
    return ok;
}
开发者ID:nealey,项目名称:vera,代码行数:7,代码来源:reg.cpp


示例9: accept_file

//----------------------------------------------------------------------------
int idaapi accept_file(
        linput_t *li,
        char fileformatname[MAX_FILE_FORMAT_NAME],
        int n)
{
  if ( n > 0 )
    return 0;

  int32 spc_file_size = qlsize(li);
  if ( spc_file_size < 0x10200 )
    return 0;

  spc_file_t spc_info;
  if ( qlseek(li, 0) != 0 )
    return 0;
  if ( qlread(li, &spc_info, sizeof(spc_file_t)) != sizeof(spc_file_t) )
    return 0;

  if (memcmp(spc_info.signature, "SNES-SPC700 Sound File Data", 27) != 0
    || spc_info.signature[0x21] != 0x1a || spc_info.signature[0x22] != 0x1a)
    return 0;

  qstrncpy(fileformatname, "SNES-SPC700 Sound File Data", MAX_FILE_FORMAT_NAME);
  return 1;
}
开发者ID:gocha,项目名称:ida-snes_spc-ldr,代码行数:26,代码来源:snes_spc.cpp


示例10: load_file

//-----------------------------------------------------------------------------
// load a macro assembler file in IDA.
void load_file(linput_t *li, ushort /*neflag*/, const char * /*fileformatname*/) {
    // already read the 2 first bytes
    qlseek(li, 2);

    // initialize static variables
    qstrncpy(creator, "UNKNOWN", sizeof(creator));
    entry_point = -1;

    bool finished = false;

    while (!finished) {
        uchar record_type = 0;

        // read the record type
        if (qlread(li, &record_type, 1) != 1)
            mas_error("unable to read the record type");

        finished = process_record(li, record_type, true);
    }

#if defined(DEBUG)
    msg("MAS: reading complete\n");
#endif

    mas_write_comments();
}
开发者ID:trietptm,项目名称:usefulres,代码行数:28,代码来源:mas.cpp


示例11: accept_file

//----------------------------------------------------------------------
//
//      check input file format. if recognized, then return 1
//      and fill 'fileformatname'.
//      otherwise return 0
//
int accept_file(linput_t *li, char fileformatname[MAX_FILE_FORMAT_NAME], int n)
{
	if( n!= 0 )
		return 0;

	// quit if file is smaller than size of iNes header
	if (qlsize(li) < sizeof(ines_hdr))
		return 0;

	// set filepos to offset 0
	qlseek(li, 0, SEEK_SET);

	// read NES header
	if(qlread(li, &hdr, INES_HDR_SIZE) != INES_HDR_SIZE)
		return 0;

	// is it a valid ROM image in iNes format?
	if( memcmp("NES", &hdr.id, sizeof(hdr.id)) != 0 || hdr.term != 0x1A )
		return 0;

	// this is the name of the file format which will be
	// displayed in IDA's dialog
	qstrncpy(fileformatname, "Nintendo Entertainment System ROM", MAX_FILE_FORMAT_NAME);

	// set processor to 6502
	if ( ph.id != PLFM_6502 )
	{
		msg("Nintendo Entertainment System ROM detected: setting processor type to M6502.\n");
		set_processor_type("M6502", SETPROC_ALL|SETPROC_FATAL);
	}


	return (1 | ACCEPT_FIRST);
}
开发者ID:IDA-RE-things,项目名称:nesldr,代码行数:40,代码来源:nes.cpp


示例12: strlen

Module::Module(const char * _moduleName)
{
    size_t length = strlen(_moduleName) + 1;
    qstrncpy(moduleName,
             _moduleName,
             (length > MAX_MODULE_NAME_LENGTH) ? (MAX_MODULE_NAME_LENGTH) : (length));
}
开发者ID:bureg,项目名称:amg-codec-tool,代码行数:7,代码来源:module.cpp


示例13: putVal

//---------------------------------------------------------------------------
uchar putVal(const op_t &x, uchar mode, uchar warn)
{
  char *ptr = get_output_ptr();
  {
    flags_t sv_uFlag = uFlag;
    uFlag = 0;
    OutValue(x, mode);
    uFlag = sv_uFlag;
  }

  char str[MAXSTR];
  char *end = set_output_ptr(ptr);
  size_t len = end - ptr;
  qstrncpy(str, ptr, qmin(len+1, sizeof(str)));

  if ( warn )
    out_tagon(COLOR_ERROR);

  if ( warn )
    len = tag_remove(str, str, 0);
  else
    len = tag_strlen(str);

  if ( chkOutLine(str, len) )
    return 0;

  if ( warn )
    out_tagoff(COLOR_ERROR);
  return 1;
}
开发者ID:nihilus,项目名称:ida_objectivec_plugins,代码行数:31,代码来源:oututil.cpp


示例14: defined

QFileSystemEntry QFileSystemEngine::currentPath()
{
    QFileSystemEntry result;
    QT_STATBUF st;
    if (QT_STAT(".", &st) == 0) {
#if defined(__GLIBC__) && !defined(PATH_MAX)
        char *currentName = ::get_current_dir_name();
        if (currentName) {
            result = QFileSystemEntry(QByteArray(currentName), QFileSystemEntry::FromNativePath());
            ::free(currentName);
        }
#else
        char currentName[PATH_MAX+1];
        if (::getcwd(currentName, PATH_MAX)) {
#if defined(Q_OS_VXWORKS) && defined(VXWORKS_VXSIM)
            QByteArray dir(currentName);
            if (dir.indexOf(':') < dir.indexOf('/'))
                dir.remove(0, dir.indexOf(':')+1);

            qstrncpy(currentName, dir.constData(), PATH_MAX);
#endif
            result = QFileSystemEntry(QByteArray(currentName), QFileSystemEntry::FromNativePath());
        }
# if defined(QT_DEBUG)
        if (result.isEmpty())
            qWarning("QFileSystemEngine::currentPath: getcwd() failed");
# endif
#endif
    } else {
# if defined(QT_DEBUG)
        qWarning("QFileSystemEngine::currentPath: stat(\".\") failed");
# endif
    }
    return result;
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:35,代码来源:qfilesystemengine_unix.cpp


示例15: accept_file

//--------------------------------------------------------------------------
int idaapi accept_file(linput_t *li, char fileformatname[MAX_FILE_FORMAT_NAME], int n)
{
  char str[80];

  if ( n) return(0 );

  qlgets(str, sizeof(str), li);

  const char *p = str;
  while ( *p == ' ' ) p++;
  int  type = 0;
  if ( qisxdigit((uchar)*(p+1)) && qisxdigit((uchar)*(p+2))) switch(*p ) {
    case ':':
      p = "Intel Hex Object Format";
      type = f_HEX;
      break;

    case ';':
      p = "MOS Technology Hex Object Format";
      type = f_MEX;
      break;

    case 'S':
      p = "Intel S-record Format";
      type = f_SREC;
    default:
      break;

  }
  if ( type) qstrncpy(fileformatname, p, MAX_FILE_FORMAT_NAME );
  return(type);
}
开发者ID:Artorios,项目名称:IDAplugins-1,代码行数:33,代码来源:hex.cpp


示例16: read_user_config

int read_user_config(const char * key, char * result, int max)
{
    KConfig * cfg;
    if (!strncmp(key,"Sound",5))
        // Any key starting with Sound is in ktalkannouncerc
        // talkprg is there too, but we don't care about it here
        cfg = ktkanncfg;
    else
        cfg = ktalkdcfg;

    if (!cfg) return 0; // file doesn't exist
    QString Qresult;
    if ((Qresult = cfg -> readEntry(key, "unset")) != "unset")
    {
        qstrncpy( result, Qresult.ascii(), max);

        if (Options.debug_mode) syslog(LOG_DEBUG,"User option %s : %s", key, result);
        return 1;
    }
    else 
    {
        ktalk_debug("User option %s NOT found", key);
        return 0;
    }
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:25,代码来源:readcfg++.cpp


示例17: accept_file

/* verify if we can process the target file
 * return true if yes
 * false otherwise
 */
int idaapi
accept_file(linput_t *li, char fileformatname[MAX_FILE_FORMAT_NAME], int n)
{
    if (n != 0)
    {
        return 0;
    }
    qlseek(li, 0);
    EFI_IMAGE_TE_HEADER teHeader = {0};
    if (qlread(li, &teHeader, sizeof(EFI_IMAGE_TE_HEADER)) == sizeof(EFI_IMAGE_TE_HEADER) &&
        teHeader.Signature == EFI_IMAGE_TE_SIGNATURE)
    {
        msg("Signature: 0x%hx\n", teHeader.Signature);
        msg("Machine: 0x%hx\n", teHeader.Machine);
        msg("Number of Sections: 0x%hhx\n", teHeader.NumberOfSections);
        msg("Subsystem: 0x%hhx\n", teHeader.Subsystem);
        msg("Stripped size: 0x%hx\n", teHeader.StrippedSize);
        msg("Address of EntryPoint: 0x%0x\n", teHeader.AddressOfEntryPoint);
        msg("Base of code: 0x%x\n", teHeader.BaseOfCode);
        msg("Image base: 0x%llx\n", teHeader.ImageBase);
        qstrncpy(fileformatname, "TE put.as Loader", MAX_FILE_FORMAT_NAME);
        return true;
    }
    return 0;
}
开发者ID:Yukariin,项目名称:TELoader,代码行数:29,代码来源:teloader.cpp


示例18: qstrncpy

Result Request::syncRequest(const std::string &url, Method method,
							const RequestParam &params, Response *response)
{
	if(!response)
		return RESULT_NULL_POINTER;

	CURLcode res = ::curl_easy_setopt(m_curl, CURLOPT_URL, url.c_str());
	if(url.npos != url.find("https"))
	{
		// https
		::curl_easy_setopt(m_curl, CURLOPT_SSL_VERIFYPEER, 0L);
		::curl_easy_setopt(m_curl, CURLOPT_SSL_VERIFYHOST, 0L);
	}

	::curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, Request::_receive);
	::curl_easy_setopt(m_curl, CURLOPT_WRITEDATA, response);
	//curl_easy_setopt(m_curl, CURLOPT_VERBOSE, 1L);
	//curl_easy_setopt(m_curl, CURLOPT_HEADER, 1L);
	::curl_easy_setopt(m_curl, CURLOPT_FOLLOWLOCATION, 1L);

	if(method == Post)
	{
		char paramStr[1024];
//		::strncpy_s(paramStr, 1024, params.toString().c_str(), params.toString().length());
        qstrncpy(paramStr, params.toString().c_str(), params.toString().length()+1);
//        qDebug() << QString(paramStr);
		::curl_easy_setopt(m_curl, CURLOPT_POSTFIELDS, paramStr);
		::curl_easy_setopt(m_curl, CURLOPT_POST, 1L);
	}

	res = ::curl_easy_perform(m_curl);

	return RESULT_OK;
}
开发者ID:gateslu,项目名称:renrentest,代码行数:34,代码来源:Request.cpp


示例19: TFuncMalloc

	TFuncMalloc(char* f_name,int m_size_count, ea_t _addr, int _type )
	{
		qstrncpy(alloc_func_name,f_name,MAXSTR);
		push_malloc_size_count =m_size_count;
		address = _addr;
		type = _type;
	}
开发者ID:melbcat,项目名称:findMalloc,代码行数:7,代码来源:findMalloc.cpp


示例20: formatResult

 int formatResult(char * buffer, int bufferSize, T number, int significantDigits)
 {
     QString result = formatResult(number, significantDigits);
     qstrncpy(buffer, result.toAscii().constData(), bufferSize);
     int size = result.count();
     return size;
 }
开发者ID:ManoharUpputuri,项目名称:qt-labs-qtest-qml,代码行数:7,代码来源:qplaintestlogger.cpp



注:本文中的qstrncpy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ qtDbString函数代码示例发布时间:2022-05-30
下一篇:
C++ qstrncmp函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap