Lines Matching refs:ms

47 	php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract;  in php_stream_memory_write()  local
48 assert(ms != NULL); in php_stream_memory_write()
50 if (ms->mode & TEMP_STREAM_READONLY) { in php_stream_memory_write()
52 } else if (ms->mode & TEMP_STREAM_APPEND) { in php_stream_memory_write()
53 ms->fpos = ms->fsize; in php_stream_memory_write()
55 if (ms->fpos + count > ms->fsize) { in php_stream_memory_write()
57 if (!ms->data) { in php_stream_memory_write()
58 tmp = emalloc(ms->fpos + count); in php_stream_memory_write()
60 tmp = erealloc(ms->data, ms->fpos + count); in php_stream_memory_write()
62 ms->data = tmp; in php_stream_memory_write()
63 ms->fsize = ms->fpos + count; in php_stream_memory_write()
65 if (!ms->data) in php_stream_memory_write()
69 memcpy(ms->data+ms->fpos, (char*)buf, count); in php_stream_memory_write()
70 ms->fpos += count; in php_stream_memory_write()
80 php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; in php_stream_memory_read() local
81 assert(ms != NULL); in php_stream_memory_read()
83 if (ms->fpos == ms->fsize) { in php_stream_memory_read()
87 if (ms->fpos + count >= ms->fsize) { in php_stream_memory_read()
88 count = ms->fsize - ms->fpos; in php_stream_memory_read()
91 assert(ms->data!= NULL); in php_stream_memory_read()
93 memcpy(buf, ms->data+ms->fpos, count); in php_stream_memory_read()
94 ms->fpos += count; in php_stream_memory_read()
105 php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; in php_stream_memory_close() local
106 assert(ms != NULL); in php_stream_memory_close()
108 if (ms->data && close_handle && ms->mode != TEMP_STREAM_READONLY) { in php_stream_memory_close()
109 efree(ms->data); in php_stream_memory_close()
111 efree(ms); in php_stream_memory_close()
129 php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; in php_stream_memory_seek() local
130 assert(ms != NULL); in php_stream_memory_seek()
135 if (ms->fpos < (size_t)(-offset)) { in php_stream_memory_seek()
136 ms->fpos = 0; in php_stream_memory_seek()
140 ms->fpos = ms->fpos + offset; in php_stream_memory_seek()
141 *newoffs = ms->fpos; in php_stream_memory_seek()
146 if (ms->fpos + (size_t)(offset) > ms->fsize) { in php_stream_memory_seek()
147 ms->fpos = ms->fsize; in php_stream_memory_seek()
151 ms->fpos = ms->fpos + offset; in php_stream_memory_seek()
152 *newoffs = ms->fpos; in php_stream_memory_seek()
158 if (ms->fsize < (size_t)(offset)) { in php_stream_memory_seek()
159 ms->fpos = ms->fsize; in php_stream_memory_seek()
163 ms->fpos = offset; in php_stream_memory_seek()
164 *newoffs = ms->fpos; in php_stream_memory_seek()
170 ms->fpos = ms->fsize; in php_stream_memory_seek()
173 } else if (ms->fsize < (size_t)(-offset)) { in php_stream_memory_seek()
174 ms->fpos = 0; in php_stream_memory_seek()
178 ms->fpos = ms->fsize + offset; in php_stream_memory_seek()
179 *newoffs = ms->fpos; in php_stream_memory_seek()
184 *newoffs = ms->fpos; in php_stream_memory_seek()
200 php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; in php_stream_memory_stat() local
201 assert(ms != NULL); in php_stream_memory_stat()
206 ssb->sb.st_mode = ms->mode & TEMP_STREAM_READONLY ? 0444 : 0666; in php_stream_memory_stat()
208 ssb->sb.st_size = ms->fsize; in php_stream_memory_stat()
231 php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; in php_stream_memory_set_option() local
241 if (ms->mode & TEMP_STREAM_READONLY) { in php_stream_memory_set_option()
245 if (newsize <= ms->fsize) { in php_stream_memory_set_option()
246 if (newsize < ms->fpos) { in php_stream_memory_set_option()
247 ms->fpos = newsize; in php_stream_memory_set_option()
250 ms->data = erealloc(ms->data, newsize); in php_stream_memory_set_option()
251 memset(ms->data+ms->fsize, 0, newsize - ms->fsize); in php_stream_memory_set_option()
252 ms->fsize = newsize; in php_stream_memory_set_option()
254 ms->fsize = newsize; in php_stream_memory_set_option()
321 php_stream_memory_data *ms; in _php_stream_memory_open() local
324 ms = (php_stream_memory_data*)stream->abstract; in _php_stream_memory_open()
328 ms->data = (char *) buf; in _php_stream_memory_open()
329 ms->fsize = length; in _php_stream_memory_open()
345 php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; in _php_stream_memory_get_buffer() local
347 assert(ms != NULL); in _php_stream_memory_get_buffer()
350 *length = ms->fsize; in _php_stream_memory_get_buffer()
351 return ms->data; in _php_stream_memory_get_buffer()