当前位置: 首页>>代码示例>>C++>>正文


C++ qstrncpy函数代码示例

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


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


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