Пример #1
0
BOOL FileTransfer::SendFileDownloadRequest()
{
  char path[rfbMAX_PATH + rfbMAX_PATH];

  if (!m_FTServerItemInfo.IsFile(m_currentDownloadIndex)) {
    SetWindowText(m_hwndFTStatus, "Cannot download: not a regular file.");
    // Send message to start download for next selected file
    PostMessage(m_hwndFileTransfer, WM_COMMAND, IDC_FTCOPY, 0);
    return TRUE;
  }
  ListView_GetItemText(m_hwndFTServerList, m_currentDownloadIndex, 0,
                       m_ServerFilename, rfbMAX_PATH);
  STRCPY(m_ClientFilename, m_ServerFilename);
  char buffer[rfbMAX_PATH + rfbMAX_PATH + rfbMAX_PATH];
  SPRINTF(buffer, "Downloading: %s\\%s -> %s\\%s ...",
          m_ServerPath, m_ServerFilename, m_ClientPath, m_ClientFilename);
  SetWindowText(m_hwndFTStatus, buffer);
  m_sizeDownloadFile = m_FTServerItemInfo.GetIntSizeAt(m_currentDownloadIndex);
  rfbFileDownloadRequestMsg fdr;
  fdr.type = rfbFileDownloadRequest;
  fdr.compressedLevel = 0;
  fdr.position = Swap32IfLE(0);
  SPRINTF(path, "%s\\%s", m_ServerPath, m_ServerFilename);
  ConvertPath(path);
  int len = (int)strlen(path);
  fdr.fNameSize = Swap16IfLE(len);
  m_clientconn->WriteExact((char *)&fdr, sz_rfbFileDownloadRequestMsg);
  m_clientconn->WriteExact(path, len);
  return TRUE;
}
Пример #2
0
static int proc_info (struct Scsi_Host *host, char *buffer,
		char **start, off_t offset, int length, int inout)
{
	char *pos = buffer;

	
	if (inout)
		return length;

	
	SPRINTF("   Host scsi%d: %s\n", host->host_no, CR_DRIVER_NAME);

	
	SPRINTF("       Vendor: Realtek Corp.\n");
	SPRINTF("      Product: PCIE Card Reader\n");
	SPRINTF("      Version: %s\n", DRIVER_VERSION);
	SPRINTF("        Build: %s\n", DRIVER_MAKE_TIME);

	/*
	 * Calculate start of next buffer, and return value.
	 */
	*start = buffer + offset;

	if ((pos - buffer) < offset)
		return (0);
	else if ((pos - buffer - offset) < length)
		return (pos - buffer - offset);
	else
		return (length);
}
Пример #3
0
static bool_t get_lyrics_step_3(void *buf, int64_t len, void *requri)
{
	if (strcmp(state.uri, requri))
	{
		free(buf);
		str_unref(requri);
		return FALSE;
	}
	str_unref(requri);

	if(!len)
	{
		SPRINTF(error, _("Unable to fetch %s"), state.uri);
		update_lyrics_window(_("Error"), NULL, error);
		free(buf);
		return FALSE;
	}

	char *lyrics = scrape_lyrics_from_lyricwiki_edit_page(buf, len);

	if(!lyrics)
	{
		SPRINTF(error, _("Unable to parse %s"), state.uri);
		update_lyrics_window(_("Error"), NULL, error);
		free(buf);
		return FALSE;
	}

	update_lyrics_window(state.title, state.artist, lyrics);

	free(lyrics);
	return TRUE;
}
Пример #4
0
SEXP check_scalar_string(SEXP sP, char *vals, char *nm)
{
    SEXP val = ScalarLogical(1);
    char *buf;
    /* only allocate when needed: in good case, none is needed */
#define SPRINTF buf = Alloca(Matrix_Error_Bufsiz, char); R_CheckStack(); sprintf

    if (length(sP) != 1) {
	SPRINTF(buf, _("'%s' slot must have length 1"), nm);
    } else {
	const char *str = CHAR(STRING_ELT(sP, 0));
	if (strlen(str) != 1) {
	    SPRINTF(buf, _("'%s' must have string length 1"), nm);
	} else {
	    int i, len, match;
	    for (i = 0, len = strlen(vals), match = 0; i < len; i++) {
		if (str[0] == vals[i])
		    return R_NilValue;
	    }
	    SPRINTF(buf, _("'%s' must be in '%s'"), nm, vals);
	}
    }
    /* 'error' returns : */
    val = mkString(buf);
    return val;
#undef SPRINTF
}
Пример #5
0
static int
decode_bitstring_vlmcsd(const char **cpp, char *dn, const char *eom)
{
	const char *cp = *cpp;
	char *beg = dn, tc;
	int b, blen, plen;

	if ((blen = (*cp & 0xff)) == 0)
		blen = 256;
	plen = (blen + 3) / 4;
	plen += sizeof("\\[x/]") + (blen > 99 ? 3 : (blen > 9) ? 2 : 1);
	if (dn + plen >= eom)
		return(-1);

	cp++;
	dn += SPRINTF((dn, "\\[x"));
	for (b = blen; b > 7; b -= 8, cp++)
		dn += SPRINTF((dn, "%02x", *cp & 0xff));
	if (b > 4) {
		tc = *cp++;
		dn += SPRINTF((dn, "%02x", tc & (0xff << (8 - b))));
	} else if (b > 0) {
		tc = *cp++;
		dn += SPRINTF((dn, "%1x",
			       ((tc >> 4) & 0x0f) & (0x0f << (4 - b)))); 
	}
Пример #6
0
/*----------------------------------------------------------------------------*/
static int procTxStatisticsRead(char *page, char **start, off_t off, int count, int *eof, void *data)
{
	P_GLUE_INFO_T prGlueInfo = ((struct net_device *)data)->priv;
	char *p = page;
	UINT_32 u4Count;

	GLUE_SPIN_LOCK_DECLARATION();

	ASSERT(data);

	/* Kevin: Apply PROC read method 1. */
	if (off != 0)
		return 0;	/* To indicate end of file. */

	SPRINTF(p, ("TX STATISTICS (Write 1 to clear):"));
	SPRINTF(p, ("\n=================================\n"));

	GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_FSM);

	wlanoidQueryTxStatisticsForLinuxProc(prGlueInfo->prAdapter, p, &u4Count);

	GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_FSM);

	u4Count += (UINT_32) (p - page);

	*eof = 1;

	return (int)u4Count;

}				/* end of procTxStatisticsRead() */
Пример #7
0
/*----------------------------------------------------------------------------*/
static int procDrvStatusRead(char *page, char **start, off_t off, int count, int *eof, void *data)
{
	P_GLUE_INFO_T prGlueInfo = ((struct net_device *)data)->priv;
	char *p = page;
	UINT_32 u4Count;

	GLUE_SPIN_LOCK_DECLARATION();

	ASSERT(data);

	/* Kevin: Apply PROC read method 1. */
	if (off != 0)
		return 0;	/* To indicate end of file. */

	SPRINTF(p, ("GLUE LAYER STATUS:"));
	SPRINTF(p, ("\n=================="));

	SPRINTF(p, ("\n* Number of Pending Frames: %ld\n", prGlueInfo->u4TxPendingFrameNum));

	GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_FSM);

	wlanoidQueryDrvStatusForLinuxProc(prGlueInfo->prAdapter, p, &u4Count);

	GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_FSM);

	u4Count += (UINT_32) (p - page);

	*eof = 1;

	return (int)u4Count;

}				/* end of procDrvStatusRead() */
void CGroupsInfo::printGroupInfo(FILE *file) const
{
	size_t i = GetAt(0)->numMatrices() ? 0 : 1;
	const size_t iMax = GetSize();
	if (i == iMax)
		return;			// Nothing was constructed

#define SHIFT "    "
	char buffer[256], line[256];
	size_t len = SPRINTF(buffer, "\n" SHIFT "    |Aut(D)|          Nd:             Ns:            Ndt:            Nst:\n");
	outString(buffer, file);

	strcpy_s(line, countof(line), SHIFT);
	const size_t l_Shift = strlen(SHIFT);
	memset(line + l_Shift, '_', len);
	len += l_Shift;
	strcpy_s(line + len, countof(line) - len, "\n");
	outString(line, file);

	COrderInfo total(0, 0);
	for (; i < iMax; i++) {
		const COrderInfo *pInfo = GetAt(i);
		total.addMatrix(pInfo);
		len = SPRINTF(buffer, SHIFT"%10zd", pInfo->groupOrder());
		pInfo->outNumbInfo(buffer, countof(buffer) - len, len);
		outString(buffer, file);
	}

	outString(line, file);
	len = SPRINTF(buffer, "        Total:");
	total.outNumbInfo(buffer, countof(buffer) - len, len);
	outString(buffer, file);
}
Пример #9
0
void debugpageptr(UINT32 addr) {

	FILEH	fh;
	char	buf[256];
	UINT32	pde;
	UINT32	pte;
	UINT	i;
	UINT32	a;

	fh = file_create("page.txt");
	SPRINTF(buf, "CR3=%.8x\r\n", CPU_CR3);
	file_write(fh, buf, strlen(buf));
	for (i=0; i<1024; i++) {
		a = CPU_STAT_PDE_BASE + (i * 4);
		pde = cpu_memoryread_d(a);
		SPRINTF(buf, "%.8x=>%.8x [%.8x]\r\n", (i << 22), pde, a);
		file_write(fh, buf, strlen(buf));
	}
	addr >>= 22;
	pde = cpu_memoryread_d(CPU_STAT_PDE_BASE + (addr * 4));
	for (i=0; i<1024; i++) {
		a = (pde & CPU_PDE_BASEADDR_MASK) + (i * 4);
		pte = cpu_memoryread_d(a);
		SPRINTF(buf, "%.8x=>%.8x [%.8x]\r\n", (addr << 22) + (i << 12), pte, a);
		file_write(fh, buf, strlen(buf));
	}
	file_close(fh);
}
Пример #10
0
static int proc_info(struct Scsi_Host *host, char *buffer,
		char **start, off_t offset, int length, int inout)
{
	char *pos = buffer;

	/* if someone is sending us data, just throw it away */
	if (inout)
		return length;

	/* print the controller name */
	SPRINTF("   Host scsi%d: %s\n", host->host_no, CR_DRIVER_NAME);

	/* print product, vendor, and driver version strings */
	SPRINTF("       Vendor: Realtek Corp.\n");
	SPRINTF("      Product: PCIE Card Reader\n");
	SPRINTF("      Version: %s\n", DRIVER_VERSION);

	/*
	 * Calculate start of next buffer, and return value.
	 */
	*start = buffer + offset;

	if ((pos - buffer) < offset)
		return 0;
	else if ((pos - buffer - offset) < length)
		return pos - buffer - offset;
	else
		return length;
}
void CEnumInfo<T>::outEnumInfo(FILE **pOutFile, bool removeReportFile, const CGroupsInfo *pGroupInfo)
{
	setRunTime();
	FILE *outFile = pOutFile ? *pOutFile : NULL;
	if (!outFile)
		return;

	if (!pGroupInfo)
		pGroupInfo = this;

	pGroupInfo->printGroupInfo(outFile);
	const ulonglong nConstrMatr = constrCanonical();
	char buff[256];
	SPRINTF(buff, "\n%10llu matri%s" CONSTRUCTED_IN " ", nConstrMatr, nConstrMatr == 1 ? "x" : "ces");
	const size_t len = strlen(buff);
	convertTime(runTime(), buff + len, countof(buff) - len, false);
	outString(buff, outFile);

	const ulonglong nMatr = numbSimpleDesign();
	if (nConstrMatr > 0) {
		SPRINTF(buff, "%10llu matri%s ha%s no replicated blocks\n", nMatr, nMatr == 1 ? "x" : "ces", nMatr == 1 ? "s" : "ve");
		outString(buff, outFile);
	}

	SPRINTF(buff, "%10llu matri%s fully constructed\n", constrTotal(), constrTotal() == 1 ? "x was" : "ces were");
	outString(buff, outFile);

	outEnumInformation(pOutFile);
	if (removeReportFile) // Remove temporary file with the intermediate results	
		remove(reportFileName());
}
Пример #12
0
/* This function does the bulk of the conversion for i82mval and ui82mval. The primary routines set the sgn flag and pass the
 * absolute value to xi82mval(). In the case of a >18 digit number, xi82mval() examines the sgn flag to determine whether to
 * switch back to a signed value before string conversion.
 */
void xi82mval(mval *v, gtm_uint64_t i)
{
	int	exp;
	uint4	low;
	uint4	high;
	char    buf[21];	/* [possible] sign, [up to] 19L/20UL digits, and terminator. */
	int	len;

	if (i < INT_HI)
	{
		v->mvtype |= MV_INT;
		v->m[1] = MV_BIAS * (v->sgn ? -(int4)i : (uint4)i);
	} else
	{
		if (i < MANT_HI)
		{
			low = 0;
			high = i;
			exp = EXP_IDX_BIAL;
			while (high < MANT_LO)
			{
				high *= 10;
				exp--;
			}
			v->e = exp;
			v->m[0] = low;
			v->m[1] = high;
		} else if (i < (gtm_uint64_t)MANT_HI * MANT_HI)
		{
			low = i % MANT_HI;
			high = i / MANT_HI;
			exp = EXP_IDX_BIAL + 9;
			while (high < MANT_LO)
			{
				high = (high * 10) + (low / MANT_LO);
				low = (low % MANT_LO) * 10;
				exp--;
			}
			v->e = exp;
			v->m[0] = low;
			v->m[1] = high;
		} else
		{	/* The value won't fit in 18 digits, so return a string. */
			if (v->sgn)
				len = SPRINTF(buf, "%lld", -(gtm_int64_t)i);
			else
				len = SPRINTF(buf, "%llu", i);
			assert(18 < len);
			ENSURE_STP_FREE_SPACE(len);
			memcpy(stringpool.free, buf, len);
			v->mvtype = MV_STR;
			v->str.len = len;
			v->str.addr = (char *)stringpool.free;
			stringpool.free += len;
		}
		assert((v->mvtype != MV_NM) || (v->m[1] < MANT_HI));
		assert((v->mvtype != MV_NM) || (v->m[1] >= MANT_LO));
	}
}
Пример #13
0
/*
 * static char *
 * inet_net_ntop_ipv4(src, bits, dst, size)
 *	convert IPv4 network number from network to presentation format.
 *	generates CIDR style result always.
 * return:
 *	pointer to dst, or NULL if an error occurred (check errno).
 * note:
 *	network byte order assumed.  this means 192.5.5.240/28 has
 *	0b11110000 in its fourth octet.
 * author:
 *	Paul Vixie (ISC), July 1996
 */
static char *
inet_net_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size)
{
	char *odst = dst;
	char *t;
	u_int m;
	int b;

	if (bits < 0 || bits > 32) {
		errno = EINVAL;
		return (NULL);
	}

	if (bits == 0) {
		if (size < sizeof "0")
			goto emsgsize;
		*dst++ = '0';
		size--;
		*dst = '\0';
	}

	/* Format whole octets. */
	for (b = bits / 8; b > 0; b--) {
		if (size <= sizeof "255.")
			goto emsgsize;
		t = dst;
		dst += SPRINTF((dst, "%u", *src++));
		if (b > 1) {
			*dst++ = '.';
			*dst = '\0';
		}
		size -= (size_t)(dst - t);
	}

	/* Format partial octet. */
	b = bits % 8;
	if (b > 0) {
		if (size <= sizeof ".255")
			goto emsgsize;
		t = dst;
		if (dst != odst)
			*dst++ = '.';
		m = ((1 << b) - 1) << (8 - b);
		dst += SPRINTF((dst, "%u", *src & m));
		size -= (size_t)(dst - t);
	}

	/* Format CIDR /width. */
	if (size <= sizeof "/32")
		goto emsgsize;
	dst += SPRINTF((dst, "/%u", bits));
	return (odst);

 emsgsize:
	errno = EMSGSIZE;
	return (NULL);
}
Пример #14
0
ERROR_CODE to_string_type(struct type_t *type, unsigned char **buffer_pointer) {
    /* allocates space for both the buffer reference and
    the value to hold the necessary buffer size */
    unsigned char *buffer;
    size_t buffer_size;

    /* retrieves the necessary buffer size for the string
    representation of the given type, then uses the buffer size
    to allocate an appropriate buffer */
    _size_type(type, &buffer_size);
    buffer = (unsigned char *) MALLOC(buffer_size);

    /* switches over the type's type in order to
    execute the proper type conversion */
    switch(type->type) {
        case INTEGER_TYPE:
            /* converts the integer value using the string
            conversion function for integer values */
            SPRINTF((char *) buffer, buffer_size, "%d", type->value.value_int);

            /* breaks the switch */
            break;

        case FLOAT_TYPE:
            /* converts the float value using the string
            conversion function for float values */
            SPRINTF((char *) buffer, buffer_size, "%f", type->value.value_float);

            /* breaks the switch */
            break;

        case STRING_TYPE:
            /* copies the memory buffer of the value in string
            representation to the buffer */
            memcpy(buffer, type->value.value_string, strlen(type->value.value_string) + 1);

            /* breaks the switch */
            break;

        default:
            /* copies the undefined value to the buffer (no conversion
            is possible) */
            memcpy(buffer, "undefined", 10);

            /* breaks the switch */
            break;
    }

    /* sets the buffer pointer reference to the
    value in the buffer */
    *buffer_pointer = buffer;

    /* raise no error */
    RAISE_NO_ERROR;
}
Пример #15
0
/* On OSF/1 (Digital Unix), pointers are 64 bits wide; the only exception to this is C programs for which one may
 * specify compiler and link editor options in order to use (and allocate) 32-bit pointers.  However, since C is
 * the only exception and, in particular because the operating system does not support such an exception, the argv
 * array passed to the main program is an array of 64-bit pointers.  Thus the C program needs to declare argv[]
 * as an array of 64-bit pointers and needs to do the same for any pointer it sets to an element of argv[].
 */
int main(int argc, char_ptr_t argv[])
{
	omi_conn_ll	conns;
	bool	  	set_pset();
	int 		ret_val;
	DCL_THREADGBL_ACCESS;

	GTM_THREADGBL_INIT;
	ctxt = NULL;
	common_startup_init(GTCM_SERVER_IMAGE);
	SPRINTF(image_id,"%s=gtcm_server", image_id);
#	ifdef SEQUOIA
	if (!set_pset())
		exit(-1);
#	endif
	/*  Initialize everything but the network */
	err_init(gtcm_exit_ch);
	gtm_chk_dist(argv[0]);
	omi_errno = OMI_ER_NO_ERROR;
	ctxt = ctxt;
	ESTABLISH_RET(omi_dbms_ch, -1);	/* any return value to signify error return */
	gtcm_init(argc, argv);
	gtcm_ltime = gtcm_stime = (int4)time(0);
#	ifdef GTCM_RC
	rc_create_cpt();
#	endif
	REVERT;
	if (OMI_ER_NO_ERROR != omi_errno)
		exit(omi_errno);
	/*  Initialize the network interface */
	if (0 != (ret_val = gtcm_bgn_net(&conns)))	/* Warning - assignment */
	{
		gtcm_rep_err("Error initializing TCP", ret_val);
		gtcm_exi_condition = ret_val;
		gtcm_exit();
	}
	SPRINTF(image_id,"%s(pid=%d) %s %s %s -id %d -service %s",
		image_id,
		omi_pid,
		( history ? "-hist" : "" ),
		( authenticate ? "-auth" : "" ),
		( ping_keepalive ? "-ping" : "" ),
		rc_server_id,
		omi_service
		);
	OPERATOR_LOG_MSG;
	omi_conns = &conns;
	/*  Should be forever, unless an error occurs */
	gtcm_loop(&conns);
	/*  Clean up */
	gtcm_end_net(&conns);
	gtcm_exit();
	return 0;
}
Пример #16
0
static void iniwrsetarg8(char *work, int size, const BYTE *ptr, int arg) {

	int		i;
	char	tmp[8];

	if (arg > 0) {
		SPRINTF(tmp, "%.2x", ptr[0]);
		milstr_ncpy(work, tmp, size);
	}
	for (i=1; i<arg; i++) {
		SPRINTF(tmp, " %.2x", ptr[i]);
		milstr_ncat(work, tmp, size);
	}
}
Пример #17
0
void	mupcli_edit_offset_size_value(sm_uc_ptr_t buff, uint4 offset, uint4 size, gtm_uint64_t value, boolean_t value_present)
{
	char		temp_str[256], temp_str1[256];
	gtm_uint64_t	old_value;

	memset(temp_str, 0, 256);
	memset(temp_str1, 0, 256);
	if (sizeof(char) == size)
	{
		SPRINTF(temp_str, "!UB [0x!XB]");
		old_value = *(sm_uc_ptr_t)buff;
	}
	else if (sizeof(short) == size)
	{
		SPRINTF(temp_str, "!UW [0x!XW]");
		old_value = *(sm_ushort_ptr_t)buff;
	}
	else if (sizeof(int4) == size)
	{
		SPRINTF(temp_str, "!UL [0x!XL]");
		old_value = *(sm_uint_ptr_t)buff;
	}
	else if (sizeof(gtm_int64_t) == size)
	{
		SPRINTF(temp_str, "!@UQ [0x!@XQ]");
		old_value = *(qw_num_ptr_t)buff;
	}
	if (value_present)
	{
		if (sizeof(char) == size)
			*(sm_uc_ptr_t)buff = (unsigned char)value;
		else if (sizeof(short) == size)
			*(sm_ushort_ptr_t)buff = (unsigned short)value;
		else if (sizeof(int4) == size)
			*(sm_uint_ptr_t)buff = (unsigned int)value;
		else if (sizeof(gtm_int64_t) == size)
			*(qw_num_ptr_t)buff = value;
	} else
		value = old_value;
	SPRINTF(temp_str1, "Offset !UL [0x!XL] : Old Value = %s : New Value = %s : Size = !UB [0x!XB]",
		temp_str, temp_str);
	if (sizeof(int4) >= size)
		util_out_print(temp_str1, TRUE, offset, offset, (uint4)old_value, (uint4)old_value,
			(uint4)value, (uint4)value, size, size);
	else
		util_out_print(temp_str1, TRUE, offset, offset, &old_value, &old_value,
			&value, &value, size, size);
}
Пример #18
0
static
LONG
CDECL
comm_write(FILEPTR *    f,
           const BYTE * buf,
           LONG         nbytes)
{
  char deb[100];

  SPRINTF(deb,
          "srv_comm_device: write: %ld bytes, devinfo = 0x%lx, f = 0x%lx, flags = 0x%lx",
          nbytes,
          f->devinfo,
          (LONG)f,
          f->flags);
  TRACE(deb);

  if((f->flags & O_ACCMODE) == O_RDWR)
  {
    srv_call((COMM_HANDLE)f,
             (C_SRV *)buf);
    TRACE("Returned from srv_call");
  }
  else
  {
    TRACE("Poll events!");
    srv_handle_events();
  }

  return nbytes;
}
Пример #19
0
static void
equalizerwin_read_winamp_eqf(VFSFile * file)
{
    Index * presets = aud_import_winamp_presets (file);

    if (! presets)
    {
        SPRINTF (error, _("Error importing Winamp EQF file '%s'"), vfs_get_filename (file));
        aud_interface_show_error (error);
        return;
    }

    if (! index_count (presets))
        goto DONE;

    /* just get the first preset --asphyx */
    EqualizerPreset * preset = index_get (presets, 0);
    equalizerwin_set_preamp(preset->preamp);

    for (int i = 0; i < AUD_EQUALIZER_NBANDS; i ++)
        equalizerwin_set_band(i, preset->bands[i]);

    equalizerwin_eq_changed();

DONE:
    index_free_full (presets, (IndexFreeFunc) aud_equalizer_preset_free);
}
Пример #20
0
static void confirm_delete (void)
{
    int playlist = aud_playlist_get_active ();
    int entry_count = aud_playlist_entry_count (playlist);

    for (int i = 0; i < entry_count; i ++)
    {
        if (! aud_playlist_entry_get_selected (playlist, i))
            continue;

        char * uri = aud_playlist_entry_get_filename (playlist, i);
        char * filename = uri_to_filename (uri);

        if (filename)
        {
            if (aud_get_bool ("delete_files", "use_trash"))
                move_to_trash (filename);
            else
                really_delete (filename);

            str_unref (filename);
        }
        else
        {
            SPRINTF (error, _("Error deleting %s: not a local file."), uri);
            aud_interface_show_error (error);
        }

        str_unref (uri);
    }

    aud_playlist_delete_selected (playlist);
}
Пример #21
0
static
LONG
CDECL
comm_open(FILEPTR * f)
{
  char deb[100];

  NOT_USED(f);


  /* Create and initialize internal file handle */
  FH(f) = (LONG)KMALLOC(sizeof(FileHandle));
  
  FH(f)->bytes_out = 0;
  FH(f)->selected = 0;
  FH(f)->queued = 0;

  SPRINTF(deb,
          "srv_comm_device: open: devinfo = 0x%lx, f = 0x%lx",
          f->devinfo,
          f);
  TRACE(deb);

  return 0;
}
Пример #22
0
/*----------------------------------------------------------------------------*/
static int
procDbgLevelRead (
    char *page,
    char **start,
    off_t off,
    int count,
    int *eof,
    void *data
    )
{
    char *p = page;
    int i;



    // Kevin: Apply PROC read method 1.
    if (off != 0) {
        return 0; // To indicate end of file.
    }

    for (i = 0; i < (sizeof(aucDbModuleName)/PROC_DBG_LEVEL_MAX_DISPLAY_STR_LEN); i++) {
        SPRINTF(p, ("%c %-15s(0x%02x): %02x\n",
            ((i == u4DebugModule) ? '*' : ' '),
            &aucDbModuleName[i][0],
            i,
            aucDebugModule[i]));
    }

    *eof = 1;
    return (int)(p - page);
}
Пример #23
0
size_t write_http_headers(
    struct connection_t *connection,
    char *buffer, size_t size,
    enum http_version_e version,
    int status_code,
    char *status_message,
    enum http_keep_alive_e keep_alive,
    char close
) {
    /* writes the header information into the provided buffer, the writing
    into this buffer uses the most of static structures possible in order
    to accelerate the writing speed at the end of the writing the number
    of written bytes is retrieved as the count value */
    size_t count = SPRINTF(
        buffer,
        size,
        "%s %d %s\r\n"
        CONNECTION_H ": %s\r\n"
        SERVER_H ": %s\r\n"
        "%s",
        http_version_codes[version - 1],
        status_code,
        status_message,
        keep_alive_codes[keep_alive - 1],
        connection->service->description,
        close_codes[(size_t) close]
    );

    /* returns the number of bytes written into the buffer */
    return count;
}
Пример #24
0
EXPORT void audgui_jump_to_time (void)
{
    if (audgui_reshow_unique_window (AUDGUI_JUMP_TO_TIME_WINDOW))
        return;

    GtkWidget * entry = gtk_entry_new ();
    gtk_entry_set_activates_default ((GtkEntry *) entry, TRUE);

    GtkWidget * button1 = audgui_button_new (_("Jump"), "go-jump", jump_cb, entry);
    GtkWidget * button2 = audgui_button_new (_("Cancel"), "process-stop", NULL, NULL);

    GtkWidget * dialog = audgui_dialog_new (GTK_MESSAGE_OTHER,
     _("Jump to Time"), _("Enter time (minutes:seconds):"), button1, button2);

    audgui_dialog_add_widget (dialog, entry);

    if (aud_drct_get_playing ())
    {
        int time = aud_drct_get_time () / 1000;
        SPRINTF (buf, "%u:%02u", time / 60, time % 60);
        gtk_entry_set_text ((GtkEntry *) entry, buf);
    }

    audgui_show_unique_window (AUDGUI_JUMP_TO_TIME_WINDOW, dialog);
}
Пример #25
0
static bool_t title_change_cb (void)
{
    if (delayed_title_change_source)
    {
        g_source_remove (delayed_title_change_source);
        delayed_title_change_source = 0;
    }

    if (aud_drct_get_playing ())
    {
        if (aud_drct_get_ready ())
        {
            char * title = aud_drct_get_title ();
            SPRINTF (title_s, _("%s - Audacious"), title);
            gtk_window_set_title ((GtkWindow *) window, title_s);
            str_unref (title);
        }
        else
            gtk_window_set_title ((GtkWindow *) window, _("Buffering ..."));
    }
    else
        gtk_window_set_title ((GtkWindow *) window, _("Audacious"));

    return FALSE;
}
Пример #26
0
void GlobalLocalNode::setMyNodeNameIfNecessary() 
{

    // FIXME: should change Symbol for the name

    const char *suffix = NULL;
    if (this->isGlobalNode())
	suffix = "Global";	
    else if (this->isLocalNode())
	suffix = "Local";	

    if (suffix) {
	char newname[1024];
	Symbol nameSym = this->Node::getNameSymbol(); 
	const char *name = theSymbolManager->getSymbolString(nameSym); 
	SPRINTF(newname,"%s%s",name,suffix);	
	this->myNodeNameSymbol = theSymbolManager->registerSymbol(newname);

	//
	// This resets the text in the notation field in the cdb
	//
	this->setLabelString(newname);
    } else {
	this->clearMyNodeName();
    }

}
Пример #27
0
static int flagload(const char *ext, const char *title, BOOL force) {

	int		ret;
	int		id;
	char	path[MAX_PATH];
	char	buf[1024];
	char	buf2[1024 + 256];

	getstatfilename(path, ext, sizeof(path));
	id = DID_YES;
	ret = statsave_check(path, buf, sizeof(buf));
#ifndef EMSCRIPTEN
	if (ret & (~STATFLAG_DISKCHG)) {
		menumbox("Couldn't restart", title, MBOX_OK | MBOX_ICONSTOP);
		id = DID_NO;
	}
	else if ((!force) && (ret & STATFLAG_DISKCHG)) {
		SPRINTF(buf2, "Conflict!\n\n%s\nContinue?", buf);
		id = menumbox(buf2, title, MBOX_YESNOCAN | MBOX_ICONQUESTION);
	}
#endif
	if (id == DID_YES) {
		statsave_load(path);
	}
	return(id);
}
Пример #28
0
	/// <summary>
	/// <para name='Name'>SLog::getDateTimeString</para>
	/// <para name='Purpose'>Return a formatted date time string</para>
	/// </summary>
	/// <param name='logFormat'>indicate whether to return the date time string in log format or decoration format</param>
	/// <returns>a formatted date/time string</returns>
	/// <remarks>
	/// <para name='Notes'></para>
	/// <para name='Author'>Kenn Guilstorf</para>
	/// <para name='LastModified'>2015-10-26</para>
	/// </remarks>
	TSTRING SLog::getDateTimeString(bool logFormat)
	{
		TSTRING retValue;
		TSTRING strFormat;
		TCHAR* chBuffer = new TCHAR[50];
		SYSTEMTIME st;

		if (logFormat)
		{
			strFormat = TSTRING(_T("%04d-%02d-%02d %02d:%02d:%02d.%03d | "));
		}
		else
		{
			strFormat = TSTRING(_T(".%04d%02d%02d.%02d%02d%02d%03d"));
		}

		GetLocalTime(&st);

		SPRINTF(chBuffer,
			50,
			strFormat.c_str(),
			(int)st.wYear, 
			(int)st.wMonth, 
			(int)st.wDay, 
			(int)st.wHour, 
			(int)st.wMinute, 
			(int)st.wSecond, 
			(int)st.wMilliseconds);
		
		retValue = TSTRING(chBuffer);

		return retValue;
	}
Пример #29
0
/*----------------------------------------------------------------------------*/
static int procMCRRead(char *page, char **start, off_t off, int count, int *eof, void *data)
{
	P_GLUE_INFO_T prGlueInfo;
	PARAM_CUSTOM_MCR_RW_STRUC_T rMcrInfo;
	UINT_32 u4BufLen;
	char *p = page;
	UINT_32 u4Count;
	WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS;


	ASSERT(data);

	/* Kevin: Apply PROC read method 1. */
	if (off != 0) {
		return 0;	/* To indicate end of file. */
	}

	prGlueInfo = (P_GLUE_INFO_T) netdev_priv((struct net_device *)data);

	rMcrInfo.u4McrOffset = u4McrOffset;

	rStatus = kalIoctl(prGlueInfo,
			   wlanoidQueryMcrRead,
			   (PVOID) & rMcrInfo, sizeof(rMcrInfo), TRUE, TRUE, TRUE, &u4BufLen);


	SPRINTF(p, ("MCR (0x%08lxh): 0x%08lx\n", rMcrInfo.u4McrOffset, rMcrInfo.u4McrData));

	u4Count = (UINT_32) (p - page);

	*eof = 1;

	return (int)u4Count;

}				/* end of procMCRRead() */
void CContactInfo::CountMultiFields(AECHAR *pwzField, int &nCount)
{
	if (NULL==pwzField ) return;

	nCount++;

	AECHAR pwzNewTag[]=NEW_FIELD;
	char pszNewtag[10];
	SPRINTF(pszNewtag, "%S", pwzNewTag);

	char *pszTmp=NULL;
	int nLen=WSTRLEN(pwzField);
	pszTmp = (char*)MALLOC(nLen+1);
	if ( NULL==pszTmp ) return;
	WSTRTOSTR(pwzField, pszTmp, nLen+1);

	char *pNext=pszTmp;
	char *pFound=NULL;
	while ( NULL!=(pFound=STRSTR(pNext, pszNewtag)))
	{
		nCount++;
		pNext = pFound+1;
	}

	FREEIF(pszTmp);
}