Skip to content

Commit 28a1d26

Browse files
committed
Make genVerifyKey actually generate conditions for 32bit values and bool, fixes #546
1 parent 01365ba commit 28a1d26

File tree

9 files changed

+22
-52
lines changed

9 files changed

+22
-52
lines changed

Diff for: README.md

+4-41
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ import * as protobuf from "protobufjs";
215215

216216
Module Structure
217217
----------------
218-
The library exports a flat `protobuf` namespace with the following members, ordered by category:
218+
The library exports a flat `protobuf` namespace including but not restricted to the following members, ordered by category:
219219

220220
### Parser
221221

@@ -225,49 +225,19 @@ The library exports a flat `protobuf` namespace with the following members, orde
225225
* **loadSync(filename: `string|string[]`, [root: `Root`]): `Root`** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/index.js)]<br />
226226
Synchronously loads one or multiple .proto or preprocessed .json files into a common root namespace (node only).
227227

228-
* **tokenize(source: `string`): `Object`** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/tokenize.js)]<br />
229-
Tokenizes the given .proto source and returns an object with useful utility functions.
230-
231228
* **parse(source: `string`): `Object`** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/parse.js)]<br />
232229
Parses the given .proto source and returns an object with the parsed contents.
233230

234-
* **package: `string|undefined`**<br />
235-
The package name, if declared.
236-
237-
* **imports: `string[]|undefined`**<br />
238-
File names of imported files, if any.
239-
240-
* **weakImports: `string[]|undefined`**<br />
241-
File names of weakly imported files, if any.
242-
243-
* **syntax: `string|undefined`**<br />
244-
Source syntax, if defined.
245-
246-
* **root: `Root`**<br />
247-
The root namespace.
248-
249231
### Serialization
250232

251233
* **Writer** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/writer.js)]<br />
252234
Wire format writer using `Uint8Array` if available, otherwise `Array`.
253235

254-
* **BufferWriter** _extends **Writer**_ [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/writer.js)]<br />
255-
Wire format writer using node buffers.
256-
257236
* **Reader** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/reader.js)]<br />
258237
Wire format reader using `Uint8Array` if available, otherwise `Array`.
259238

260-
* **BufferReader** _extends **Reader**_ [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/reader.js)]<br />
261-
Wire format reader using node buffers.
262-
263-
* **codegen** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/codegen.js)]<br />
264-
A closure for generating functions programmatically.
265-
266239
### Reflection
267240

268-
* **ReflectionObject** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/object.js)]<br />
269-
Base class of all reflection objects.
270-
271241
* **Namespace** _extends **ReflectionObject**_ [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/namespace.js)]<br />
272242
Base class of all reflection objects containing nested objects.
273243

@@ -302,18 +272,11 @@ The library exports a flat `protobuf` namespace with the following members, orde
302272

303273
### Utility
304274

305-
* **types: `Object`** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/types.js)]<br />
306-
Common type constants.
307-
308-
* **common(name: `string`, json: `Object`)** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/common.js)]<br />
309-
Provides common type definitions.
310-
311-
* **rpc: `Object`** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/rpc.js)]<br />
312-
Streaming RPC helpers.
313-
314-
* **util: `Object`** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/util.js)]<br />
275+
* **util** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/util.js)]<br />
315276
Various utility functions.
316277

278+
For less common members, see the API documentation.
279+
317280
Documentation
318281
-------------
319282

Diff for: cli/wrappers/es6.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import * as $protobuf from "protobufjs";
2+
3+
%OUTPUT%
4+
5+
$protobuf.roots[%ROOT%] = $root;
6+
7+
export default $root;

Diff for: dist/protobuf.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/protobuf.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/protobuf.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/protobuf.min.js.gz

9 Bytes
Binary file not shown.

Diff for: dist/protobuf.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/verify.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,11 @@ function genVerifyKey(gen, field, ref) {
211211
case "uint32":
212212
case "sint32":
213213
case "fixed32":
214-
case "sfixed32":
214+
case "sfixed32": gen
215215
("if(!/^-?(?:0|[1-9]\\d*)$/.test(%s))", ref)
216216
("return%j", invalid(field, "integer key"));
217217
break;
218-
case "bool":
218+
case "bool": gen
219219
("if(!/^true|false|0|1$/.test(%s))", ref)
220220
("return%j", invalid(field, "boolean key"));
221221
break;

Diff for: types/protobuf.js.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* protobuf.js v6.1.0 TypeScript definitions
3-
* Generated Sun, 11 Dec 2016 23:22:51 UTC
3+
* Generated Mon, 12 Dec 2016 00:01:07 UTC
44
*/
55
declare module "protobufjs" {
66

0 commit comments

Comments
 (0)