[Pkg-javascript-commits] [node-iconv] 01/01: some cleaning

matthew pideil mpideil-guest at moszumanska.debian.org
Tue May 6 06:43:12 UTC 2014


This is an automated email from the git hooks/post-receive script.

mpideil-guest pushed a commit to branch master
in repository node-iconv.

commit dfa5a2a0c0bebe1917dd74a0a7af0c788fbc5a4c
Author: Matthew Pideil <matthewp_debian at teledetection.fr>
Date:   Tue May 6 06:41:25 2014 +0000

    some cleaning
---
 .gitignore                                  |   1 +
 .pc/.quilt_patches                          |   1 -
 .pc/.quilt_series                           |   1 -
 .pc/.version                                |   1 -
 .pc/applied-patches                         |   2 -
 .pc/fix-gyp-callto-nodejs.patch/.timestamp  |   0
 .pc/fix-gyp-callto-nodejs.patch/binding.gyp |  38 -------
 .pc/fix-libiconv-call.patch/.timestamp      |   0
 .pc/fix-libiconv-call.patch/lib/iconv.js    | 166 ----------------------------
 binding.gyp                                 |   2 +-
 lib/iconv.js                                |   2 +-
 11 files changed, 3 insertions(+), 211 deletions(-)

diff --git a/.gitignore b/.gitignore
index f1eba27..cd63e62 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
 .project
 /build/
 /node_modules/
+.pc
diff --git a/.pc/.quilt_patches b/.pc/.quilt_patches
deleted file mode 100644
index 6857a8d..0000000
--- a/.pc/.quilt_patches
+++ /dev/null
@@ -1 +0,0 @@
-debian/patches
diff --git a/.pc/.quilt_series b/.pc/.quilt_series
deleted file mode 100644
index c206706..0000000
--- a/.pc/.quilt_series
+++ /dev/null
@@ -1 +0,0 @@
-series
diff --git a/.pc/.version b/.pc/.version
deleted file mode 100644
index 0cfbf08..0000000
--- a/.pc/.version
+++ /dev/null
@@ -1 +0,0 @@
-2
diff --git a/.pc/applied-patches b/.pc/applied-patches
deleted file mode 100644
index 0a142e8..0000000
--- a/.pc/applied-patches
+++ /dev/null
@@ -1,2 +0,0 @@
-fix-gyp-callto-nodejs.patch
-fix-libiconv-call.patch
diff --git a/.pc/fix-gyp-callto-nodejs.patch/.timestamp b/.pc/fix-gyp-callto-nodejs.patch/.timestamp
deleted file mode 100644
index e69de29..0000000
diff --git a/.pc/fix-gyp-callto-nodejs.patch/binding.gyp b/.pc/fix-gyp-callto-nodejs.patch/binding.gyp
deleted file mode 100644
index 143bb15..0000000
--- a/.pc/fix-gyp-callto-nodejs.patch/binding.gyp
+++ /dev/null
@@ -1,38 +0,0 @@
-{
-  'targets': [
-    {
-      'target_name': 'iconv',
-      'defines': [
-        'ICONV_CONST=const',
-        'USE_AIX=1',
-        'USE_DOS=1',
-        'USE_EXTRA=1',
-        'USE_OSF1=1',
-        'LIBDIR="."', # not actually used
-      ],
-      'include_dirs': [
-        'deps/libiconv/srclib',
-        'support',
-        '<!(node -e "require(\'nan\')")',
-      ],
-      'sources': [
-        'deps/libiconv/libcharset/lib/localcharset.c',
-        'deps/libiconv/lib/iconv.c',
-        'src/binding.cc',
-      ],
-      'conditions': [
-        ['OS == "win"', {
-          'defines': ['WIN32_NATIVE=1'],
-        }, {
-          'defines': ['HAVE_WORKING_O_NOFOLLOW=1'],
-          'cflags': [
-            # silence warnings from iconv.c
-            '-Wno-unused-function',
-            '-Wno-unused-parameter',
-            '-Wno-unused-variable',
-          ],
-        }],
-      ],
-    }
-  ]
-}
diff --git a/.pc/fix-libiconv-call.patch/.timestamp b/.pc/fix-libiconv-call.patch/.timestamp
deleted file mode 100644
index e69de29..0000000
diff --git a/.pc/fix-libiconv-call.patch/lib/iconv.js b/.pc/fix-libiconv-call.patch/lib/iconv.js
deleted file mode 100644
index 2b6cf77..0000000
--- a/.pc/fix-libiconv-call.patch/lib/iconv.js
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (c) 2013, Ben Noordhuis <info at bnoordhuis.nl>
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-exports.Iconv = Iconv;
-
-var stream = require('stream');
-var util = require('util');
-
-var bindings;
-try {
-  bindings = require('../build/Release/iconv.node');
-}
-catch (e) {
-  bindings = require('../build/Debug/iconv.node');
-}
-
-var E2BIG = bindings.E2BIG | 0;
-var EILSEQ = bindings.EILSEQ | 0;
-var EINVAL = bindings.EINVAL | 0;
-
-// Marker object.
-var FLUSH = {};
-
-function Iconv(fromEncoding, toEncoding)
-{
-  if (!(this instanceof Iconv)) {
-    return new Iconv(fromEncoding, toEncoding);
-  }
-
-  stream.Stream.call(this);
-  this.writable = true;
-
-  var conv = bindings.make(fixEncoding(fromEncoding),
-                           fixEncoding(toEncoding));
-  if (conv === null) throw new Error('Conversion not supported.');
-
-  var convert_ = convert.bind({ conv_: conv });
-  var context_ = { trailer: null };
-
-  this.convert = function(input, encoding) {
-    if (typeof(input) === 'string') {
-      input = new Buffer(input, encoding || 'utf8');
-    }
-    return convert_(input, null);
-  };
-
-  this.write = function(input, encoding) {
-    if (typeof(input) === 'string') {
-      input = new Buffer(input, encoding || 'utf8');
-    }
-    try {
-      var buf = convert_(input, context_);
-    }
-    catch (e) {
-      this.emit('error', e);
-      return false;
-    }
-    if (buf && buf.length !== 0) {
-      this.emit('data', buf);
-    }
-    return true;
-  };
-
-  this.end = function(input, encoding) {
-    if (typeof(input) !== 'undefined') {
-      this.write(input, encoding);
-    }
-    this.write(FLUSH);
-    this.emit('end');
-  };
-}
-util.inherits(Iconv, stream.Stream);
-
-function fixEncoding(encoding)
-{
-  // Convert "utf8" to "utf-8".
-  return /^utf[^-]/i.test(encoding) ? 'utf-' + encoding.substr(3) : encoding;
-}
-
-function convert(input, context) {
-  if (!(input instanceof Buffer) && input !== FLUSH) {
-    throw new Error('Bad argument.');  // Not a buffer or a string.
-  }
-  if (context !== null && context.trailer !== null) {
-    // Prepend input buffer with trailer from last chunk.
-    var newbuf = new Buffer(context.trailer.length + input.length);
-    context.trailer.copy(newbuf, 0, 0, context.trailer.length);
-    input.copy(newbuf, context.trailer.length, 0, input.length);
-    context.trailer = null;
-    input = newbuf;
-  }
-  var output = new Buffer(input.length * 2);  // To a first approximation.
-  var input_start = 0;
-  var output_start = 0;
-  var input_size = input.length;
-  var output_size = output.length;
-  var out = [0,0];
-  for (;;) {
-    var errno = bindings.convert(this.conv_,
-                                 input,
-                                 input_start,
-                                 input_size,
-                                 output,
-                                 output_start,
-                                 output_size,
-                                 out);
-    var input_consumed = out[0];
-    var output_consumed = out[1];
-    input_start += input_consumed;
-    input_size -= input_consumed;
-    output_start += output_consumed;
-    output_size -= output_consumed;
-    if (errno) {
-      if (errno === E2BIG) {
-        output_size += output.length;
-        var newbuf = new Buffer(output.length * 2);
-        output.copy(newbuf, 0, 0, output_start);
-        output = newbuf;
-        continue;
-      }
-      else if (errno === EILSEQ) {
-        throw errnoException('EILSEQ', 'Illegal character sequence.');
-      }
-      else if (errno === EINVAL) {
-        if (context === null || input === FLUSH) {
-          throw errnoException('EINVAL', 'Incomplete character sequence.');
-        }
-        else {
-          context.trailer = input.slice(input_start);
-          return output.slice(0, output_start);
-        }
-      }
-      else {
-        throw 'unexpected error';
-      }
-    }
-    if (input !== FLUSH) {
-      input = FLUSH;
-      continue;
-    }
-    if (output_start < output.length) {
-      output = output.slice(0, output_start);
-    }
-    return output;
-  }
-}
-
-function errnoException(code, errmsg)
-{
-  var err = new Error(errmsg);
-  err.code = code;
-  return err;
-}
diff --git a/binding.gyp b/binding.gyp
index 06087d2..143bb15 100644
--- a/binding.gyp
+++ b/binding.gyp
@@ -13,7 +13,7 @@
       'include_dirs': [
         'deps/libiconv/srclib',
         'support',
-        '<!(nodejs -e "require(\'nan\')")',
+        '<!(node -e "require(\'nan\')")',
       ],
       'sources': [
         'deps/libiconv/libcharset/lib/localcharset.c',
diff --git a/lib/iconv.js b/lib/iconv.js
index 20e284e..2b6cf77 100644
--- a/lib/iconv.js
+++ b/lib/iconv.js
@@ -21,7 +21,7 @@ var util = require('util');
 
 var bindings;
 try {
-  bindings = require('/usr/lib/nodejs/iconv/lib/iconv.node');
+  bindings = require('../build/Release/iconv.node');
 }
 catch (e) {
   bindings = require('../build/Debug/iconv.node');

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-iconv.git



More information about the Pkg-javascript-commits mailing list