» Home » buffer » Page 1
boost::asio::buffer: Getting the buffer size and preventing buffer overflow?
by brainhulk in Programming Languages

I have the two following functions for sending and receiving packets.

void send(std::string protocol)
char *request=new char[protocol.size()+1];
request[protocol.size()] = 0;
request_length = std::strlen(request);

segfault while sending buffer pointer as pass-by-value to a function, inside which reallocate happens on that buffer
by Hai Nguyen in Programming Languages

If I have the following code, where I allocate my memory in the main function and then pass it to a function, which fills it for me like this:

char *bar = (char*) malloc(sizeof(char));
bar = (char*) malloc(sizeof(char));
foo(char *bar)

How to copy a region or a whole buffer to another buffer in Emacs without affecting the kill ring?
by mdiezb in Web Design

I'd like to copy the region to another (temporary) buffer in Emacs, but if there's no (acive) region, I'd like to copy the whole current buffer. What I did is as follows:

(defun do-something-with-region-or-buffer ()
(let ((begin (point-min)) (end (point-max)))
(when (region-active-p)
(setq begin (region

Is there an emacs defun that converts XML in a buffer to JSON? jsonify-buffer? JSONize?
by novatv.stdios in Programming Languages

Ever seen Htmlize? Invoked in an existing buffer, it produces a new buffer with the HTML-ized version of the original buffer contents.

I'd like something similar, but I want it for XML-to-JSON. (and Vice versa for bonus points).

Given an XML buffer, I'd like to produce an "equivalent" JSON buffer, constructed based on a few settings or assuumptions.


Parsing Buffer C - Advance buffer past whitespace, store word
by DaleS in Programming Languages

It's been awhile since I worked with the standard C library's string parsing code (sprintf, atoi, etc).

My specific, current need is as follows:

advance_buf( const char*& buf, const char* removed_chars, int size );

It should advance the buf pointer to beyond the group of whitespace and copy the removed characters into remove

c++ boost would async_read_some be blocked by buffer if the buffer is being fill by a data stream?
by Michiel Overtoom in Programming Languages

For example, if a server is sending a packet of bit stream to my tcp client, and I am beginning to use async_read_some to retrieve it.

Is this async_read_some operation might retrieve only part of the packet from the buffer, or is the buffer mutable so the async_read_some would be blocked until this packet stream is fully arrived?

Recenter a named buffer that is not neccessarily the current buffer in Emacs Lisp
by SMOGZINN in Web Design

I'd like to recenter a buffer, called *Lense*, where I've inserted some text. I wished to make it the current buffer by (set-buffer "*Lense*"), then (recenter 0)). By the following code segments:

(save-excursion (set-buffer "*Lense*")
(recenter 0))

However, it seems that the above code would only re

Dalvik message - Default buffer size used in BufferedInputStream constructor. It would be better to be explicit if an 8k buffer is required
by iyogee in Programming Languages

When I used BufferedInputStream and I specify a buffer size, Dalvik gives me this warning - Default buffer size used in BufferedInputStream constructor. It would be better to be explicit if an 8k buffer is required.

But right now, my buffer size is already at 8k. What am I doing wrong?

Is it possible malloc() allocates a buffer that overlaps another buffer allocated using mmap()?
by debuke in Programming Languages

I plan to use mmap() to allocate a buffer close to a specific address.

What I'm worried about is, the buffer allocated using mmap() will overlap other buffers allocated by malloc() or new operator (C++). Is it possible?

How to convert char buffer (with pcm audio data) to short buffer
by dantino in Programming Languages

I have char pAudioBuffer buffer which i got from function ffmpeg:

int len = avcodec_decode_audio3(av_codec_context,
(int16_t *) pAudioBuffer, &out_size, &packet);

I know that audio format is two bytes per sample, i need to convert every two bytes to short value, i have tried to use code snippet below, but i often got zero

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .