Version: 1.15.3 [2009-01-22]
o Fixed a minor Rd problem.
git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/affxparser@37308 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -51,7 +51,7 @@ |
51 | 51 |
# \item Data Group \#1 |
52 | 52 |
# \enumerate{ |
53 | 53 |
# \item Data Set \#1 |
54 |
-# \itemize { |
|
54 |
+# \itemize{ |
|
55 | 55 |
# \item Parameters |
56 | 56 |
# \item Column definitions |
57 | 57 |
# \item Matrix of data |
... | ... |
@@ -225,6 +225,15 @@ readCcg <- function(pathname, verbose=0, .filter=NULL, ...) { |
225 | 225 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
226 | 226 |
# Local functions |
227 | 227 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
228 |
+ rawToString <- function(raw, ...) { |
|
229 |
+ # This approach drops all '\0', in order to avoid warnings |
|
230 |
+ # in rawToChar(). Note, it does not truncate the string after |
|
231 |
+ # the first '\0'. However, such strings should never occur in |
|
232 |
+ # the first place. |
|
233 |
+ raw <- raw[raw != as.raw(0)]; |
|
234 |
+ rawToChar(raw); |
|
235 |
+ } |
|
236 |
+ |
|
228 | 237 |
readInt <- function(con, n=1, ...) { |
229 | 238 |
readBin(con, what=integer(), size=4, signed=TRUE, endian="big", n=n); |
230 | 239 |
} |
... | ... |
@@ -239,9 +248,7 @@ readCcg <- function(pathname, verbose=0, .filter=NULL, ...) { |
239 | 248 |
return(""); |
240 | 249 |
bfr <- readBin(con, what=raw(), n=2*nchars); |
241 | 250 |
bfr <- bfr[seq(from=2, to=length(bfr), by=2)]; |
242 |
- bfr <- rawToChar(bfr, multiple=TRUE); |
|
243 |
- bfr <- paste(bfr, collapse=""); |
|
244 |
- bfr; |
|
251 |
+ rawToString(bfr); |
|
245 | 252 |
} |
246 | 253 |
|
247 | 254 |
readRaw <- function(con, ...) { |
... | ... |
@@ -311,6 +318,15 @@ readCcg <- function(pathname, verbose=0, .filter=NULL, ...) { |
311 | 318 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
312 | 319 |
# Local functions |
313 | 320 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
321 |
+ rawToString <- function(raw, ...) { |
|
322 |
+ # This approach drops all '\0', in order to avoid warnings |
|
323 |
+ # in rawToChar(). Note, it does not truncate the string after |
|
324 |
+ # the first '\0'. However, such strings should never occur in |
|
325 |
+ # the first place. |
|
326 |
+ raw <- raw[raw != as.raw(0)]; |
|
327 |
+ rawToChar(raw); |
|
328 |
+ } |
|
329 |
+ |
|
314 | 330 |
readByte <- function(con, n=1, ...) { |
315 | 331 |
readBin(con, what=integer(), size=1, signed=TRUE, endian="big", n=n); |
316 | 332 |
} |
... | ... |
@@ -336,9 +352,7 @@ readCcg <- function(pathname, verbose=0, .filter=NULL, ...) { |
336 | 352 |
return(""); |
337 | 353 |
bfr <- readBin(con, what=raw(), n=2*nchars); |
338 | 354 |
bfr <- bfr[seq(from=2, to=length(bfr), by=2)]; |
339 |
- bfr <- rawToChar(bfr, multiple=TRUE); |
|
340 |
- bfr <- paste(bfr, collapse=""); |
|
341 |
- bfr; |
|
355 |
+ rawToString(bfr); |
|
342 | 356 |
} |
343 | 357 |
|
344 | 358 |
readRaw <- function(con, ...) { |
... | ... |
@@ -369,15 +383,14 @@ readCcg <- function(pathname, verbose=0, .filter=NULL, ...) { |
369 | 383 |
|
370 | 384 |
value <- switch(type, |
371 | 385 |
"text/ascii" = { |
372 |
- rawToChar(raw); |
|
386 |
+ rawToString(raw); |
|
373 | 387 |
}, |
374 | 388 |
|
375 | 389 |
"text/plain" = { |
376 | 390 |
# Unicode/UTF-16?!? |
377 | 391 |
raw <- matrix(raw, ncol=2, byrow=TRUE); |
378 | 392 |
raw <- raw[,2]; |
379 |
- value <- rawToChar(raw); |
|
380 |
- paste(value); # Terminate string at first '\0'. |
|
393 |
+ rawToString(raw); |
|
381 | 394 |
}, |
382 | 395 |
|
383 | 396 |
"text/x-calvin-integer-8" = { |
... | ... |
@@ -566,6 +579,9 @@ readCcg <- function(pathname, verbose=0, .filter=NULL, ...) { |
566 | 579 |
|
567 | 580 |
############################################################################ |
568 | 581 |
# HISTORY: |
582 |
+# 2009-02-10 |
|
583 |
+# o Added internal rawToString() replacing rawToChar() to avoid warnings |
|
584 |
+# on "truncating string with embedded nul". |
|
569 | 585 |
# 2008-08-23 |
570 | 586 |
# o SPEED UP: Removed all gc() calls. |
571 | 587 |
# 2008-01-13 |
... | ... |
@@ -171,6 +171,15 @@ readCcgHeader <- function(pathname, verbose=0, .filter=list(fileHeader=TRUE, dat |
171 | 171 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
172 | 172 |
# Local functions |
173 | 173 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
174 |
+ rawToString <- function(raw, ...) { |
|
175 |
+ # This approach drops all '\0', in order to avoid warnings |
|
176 |
+ # in rawToChar(). Note, it does not truncate the string after |
|
177 |
+ # the first '\0'. However, such strings should never occur in |
|
178 |
+ # the first place. |
|
179 |
+ raw <- raw[raw != as.raw(0)]; |
|
180 |
+ rawToChar(raw); |
|
181 |
+ } |
|
182 |
+ |
|
174 | 183 |
readByte <- function(con, n=1, ...) { |
175 | 184 |
readBin(con, what=integer(), size=1, signed=TRUE, endian="big", n=n); |
176 | 185 |
} |
... | ... |
@@ -200,8 +209,7 @@ readCcgHeader <- function(pathname, verbose=0, .filter=list(fileHeader=TRUE, dat |
200 | 209 |
return(""); |
201 | 210 |
raw <- readBin(con, what=raw(), n=2*nchars); |
202 | 211 |
raw <- raw[seq(from=2, to=length(raw), by=2)]; |
203 |
- value <- rawToChar(raw); |
|
204 |
- paste(value, collapse=""); # Terminate string at first '\0'. |
|
212 |
+ rawToString(raw); |
|
205 | 213 |
} |
206 | 214 |
|
207 | 215 |
readRaw <- function(con, ...) { |
... | ... |
@@ -228,15 +236,14 @@ readCcgHeader <- function(pathname, verbose=0, .filter=list(fileHeader=TRUE, dat |
228 | 236 |
n <- length(raw); |
229 | 237 |
value <- switch(type, |
230 | 238 |
"text/ascii" = { |
231 |
- paste(rawToChar(raw)); |
|
239 |
+ rawToString(raw); |
|
232 | 240 |
}, |
233 | 241 |
|
234 | 242 |
"text/plain" = { |
235 | 243 |
# Unicode/UTF-16?!? |
236 | 244 |
raw <- matrix(raw, ncol=2, byrow=TRUE); |
237 | 245 |
raw <- raw[,2]; |
238 |
- value <- rawToChar(raw); |
|
239 |
- paste(value); # Terminate string at first '\0'. |
|
246 |
+ rawToString(raw); |
|
240 | 247 |
}, |
241 | 248 |
|
242 | 249 |
"text/x-calvin-integer-8" = { |
... | ... |
@@ -330,6 +337,9 @@ readCcgHeader <- function(pathname, verbose=0, .filter=list(fileHeader=TRUE, dat |
330 | 337 |
|
331 | 338 |
############################################################################ |
332 | 339 |
# HISTORY: |
340 |
+# 2009-02-10 |
|
341 |
+# o Added internal rawToString() replacing rawToChar() to avoid warnings |
|
342 |
+# on "truncating string with embedded nul". |
|
333 | 343 |
# 2007-08-16 |
334 | 344 |
# o Now the read data is converted according to the mime type. See internal |
335 | 345 |
# readWVT() function. The code is still ad hoc, so it is not generic. |
... | ... |
@@ -1,6 +1,16 @@ |
1 | 1 |
Package: affxparser |
2 | 2 |
=================== |
3 | 3 |
|
4 |
+Version: 1.15.4 [2009-02-10] |
|
5 |
+o readCcg() and readCcgHeader() no longer give warnings |
|
6 |
+ on 'truncating string with embedded nul' in rawToChar(). |
|
7 |
+ These warnings made no difference, but were annoying. |
|
8 |
+ |
|
9 |
+ |
|
10 |
+Version: 1.15.3 [2009-01-22] |
|
11 |
+o Fixed a minor Rd problem. |
|
12 |
+ |
|
13 |
+ |
|
4 | 14 |
Version: 1.15.2 [2008-12-30] |
5 | 15 |
o Same bug fix as in release version v1.14.2. |
6 | 16 |
|