mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 10:15:41 +00:00
Bug 780483 - Make {read, write} become {_read, _write} and {readTo, writeFrom} become {read, write}. r=froydnj
This commit is contained in:
parent
0201a5df77
commit
5648cd14d2
@ -50,7 +50,7 @@ AbstractFile.prototype = {
|
||||
* bytes read and the number of bytes read. Note that |buffer| may be
|
||||
* larger than the number of bytes actually read.
|
||||
*/
|
||||
readAll: function readAll(bytes) {
|
||||
read: function read(bytes) {
|
||||
if (bytes == null) {
|
||||
bytes = this.stat().size;
|
||||
}
|
||||
@ -88,7 +88,7 @@ AbstractFile.prototype = {
|
||||
options.offset);
|
||||
let pos = 0;
|
||||
while (pos < bytes) {
|
||||
let chunkSize = this.read(pointer, bytes - pos, options);
|
||||
let chunkSize = this._read(pointer, bytes - pos, options);
|
||||
if (chunkSize == 0) {
|
||||
break;
|
||||
}
|
||||
@ -117,7 +117,7 @@ AbstractFile.prototype = {
|
||||
* @return {number} The number of bytes actually written, which may be
|
||||
* less than |bytes| if |options.once| was set.
|
||||
*/
|
||||
writeFrom: function writeFrom(buffer, bytes, options) {
|
||||
write: function write(buffer, bytes, options) {
|
||||
options = options || noOptions;
|
||||
|
||||
let pointer = AbstractFile.normalizeToPointer(buffer, bytes,
|
||||
@ -125,7 +125,7 @@ AbstractFile.prototype = {
|
||||
|
||||
let pos = 0;
|
||||
while (pos < bytes) {
|
||||
let chunkSize = this.write(pointer, bytes - pos, options);
|
||||
let chunkSize = this._write(pointer, bytes - pos, options);
|
||||
pos += chunkSize;
|
||||
pointer = exports.OS.Shared.offsetBy(pointer, chunkSize);
|
||||
}
|
||||
|
@ -92,7 +92,7 @@
|
||||
* the end of the file has been reached.
|
||||
* @throws {OS.File.Error} In case of I/O error.
|
||||
*/
|
||||
File.prototype.read = function read(buffer, nbytes, options) {
|
||||
File.prototype._read = function _read(buffer, nbytes, options) {
|
||||
return throw_on_negative("read",
|
||||
UnixFile.read(this.fd, buffer, nbytes)
|
||||
);
|
||||
@ -111,7 +111,7 @@
|
||||
* @return {number} The number of bytes effectively written.
|
||||
* @throws {OS.File.Error} In case of I/O error.
|
||||
*/
|
||||
File.prototype.write = function write(buffer, nbytes, options) {
|
||||
File.prototype._write = function _write(buffer, nbytes, options) {
|
||||
return throw_on_negative("write",
|
||||
UnixFile.write(this.fd, buffer, nbytes)
|
||||
);
|
||||
@ -401,8 +401,8 @@
|
||||
if (!pump_buffer || pump_buffer.length < bufSize) {
|
||||
pump_buffer = new (ctypes.ArrayType(ctypes.char))(bufSize);
|
||||
}
|
||||
let read = source.read.bind(source);
|
||||
let write = dest.write.bind(dest);
|
||||
let read = source._read.bind(source);
|
||||
let write = dest._write.bind(dest);
|
||||
// Perform actual copy
|
||||
let total_read = 0;
|
||||
while (true) {
|
||||
|
@ -111,7 +111,7 @@
|
||||
* the end of the file has been reached.
|
||||
* @throws {OS.File.Error} In case of I/O error.
|
||||
*/
|
||||
File.prototype.read = function read(buffer, nbytes, options) {
|
||||
File.prototype._read = function _read(buffer, nbytes, options) {
|
||||
// |gBytesReadPtr| is a pointer to |gBytesRead|.
|
||||
throw_on_zero("read",
|
||||
WinFile.ReadFile(this.fd, buffer, nbytes, gBytesReadPtr, null)
|
||||
@ -132,7 +132,7 @@
|
||||
* @return {number} The number of bytes effectively written.
|
||||
* @throws {OS.File.Error} In case of I/O error.
|
||||
*/
|
||||
File.prototype.write = function write(buffer, nbytes, options) {
|
||||
File.prototype._write = function _write(buffer, nbytes, options) {
|
||||
// |gBytesWrittenPtr| is a pointer to |gBytesWritten|.
|
||||
throw_on_zero("write",
|
||||
WinFile.WriteFile(this.fd, buffer, nbytes, gBytesWrittenPtr, null)
|
||||
|
Loading…
Reference in New Issue
Block a user