Skip to content

Commit

Permalink
Properly exclude browserify's annoying _process, again, fixes #502
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Nov 29, 2016
1 parent 3c16e46 commit 51fe456
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 17 deletions.
16 changes: 8 additions & 8 deletions dist/protobuf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/protobuf.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/protobuf.min.js

Large diffs are not rendered by default.

Binary file modified dist/protobuf.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/protobuf.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/root.js
Expand Up @@ -104,7 +104,7 @@ RootPrototype.load = function load(filename, callback) {
// Fetches a single file
function fetch(filename, weak) {

// Check if this file references a bundled definition
// Strip path if this file references a bundled definition
var idx = filename.indexOf("google/protobuf/");
if (idx > -1) {
var altname = filename.substring(idx);
Expand Down
2 changes: 1 addition & 1 deletion src/util.js
Expand Up @@ -15,7 +15,7 @@ util.codegen = require("./util/codegen");
* @memberof util
* @type {boolean}
*/
var isNode = util.isNode = Boolean(typeof process !== 'undefined' && process.versions && process.versions.node);
var isNode = util.isNode = Boolean(global.process && global.process.versions && global.process.versions.node);

/**
* Optional buffer class to use.
Expand Down
6 changes: 3 additions & 3 deletions src/writer.js
Expand Up @@ -356,14 +356,14 @@ WriterPrototype.bytes = function write_bytes(value) {
};

function writeString(buf, pos, val) {
for (var i = 0, len = val.length, c1, c2; i < len; ++i) {
c1 = val.charCodeAt(i);
for (var i = 0; i < val.length; ++i) {
var c1 = val.charCodeAt(i), c2;
if (c1 < 128) {
buf[pos++] = c1;
} else if (c1 < 2048) {
buf[pos++] = c1 >> 6 | 192;
buf[pos++] = c1 & 63 | 128;
} else if ((c1 & 0xFC00) === 0xD800 && i + 1 < len && ((c2 = val.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {
} else if ((c1 & 0xFC00) === 0xD800 && i + 1 < val.length && ((c2 = val.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {
c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);
++i;
buf[pos++] = c1 >> 18 | 240;
Expand Down
5 changes: 5 additions & 0 deletions tests/browser.html
@@ -0,0 +1,5 @@
<html>
<head>
<script src="../dist/protobuf.js"></script>
</head>
</html>

0 comments on commit 51fe456

Please sign in to comment.