romanbsd-jsmin-ffi 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/ext/jsmin.cpp +5 -2
  3. data/ext/jsmin.h +1 -0
  4. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/ext/jsmin.cpp CHANGED
@@ -60,6 +60,9 @@ int Jsmin::get()
60
60
  {
61
61
  int c = theLookahead;
62
62
  theLookahead = 0;
63
+ if ( index_in >= m_size ) {
64
+ return 0;
65
+ }
63
66
  if (c == 0) {
64
67
  c = input_buf[index_in++];
65
68
  }
@@ -200,8 +203,8 @@ char* Jsmin::minify(char *original)
200
203
  free(output_buf);
201
204
  output_buf = NULL;
202
205
  }
203
-
204
- output_buf = (char *)malloc(sizeof(char) * strlen(original));
206
+ m_size = strlen(original);
207
+ output_buf = (char *)malloc(sizeof(char) * (m_size+1));
205
208
 
206
209
  theA = '\n';
207
210
  action(3);
data/ext/jsmin.h CHANGED
@@ -15,6 +15,7 @@ private:
15
15
  int index_out;
16
16
  char *input_buf;
17
17
  char *output_buf;
18
+ int m_size;
18
19
 
19
20
  int isAlphanum(int c);
20
21
  int get();
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: romanbsd-jsmin-ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Shterenzon