Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(607)

Side by Side Diff: chrome/installer/mac/third_party/bsdiff/goobspatch.c

Issue 2875008: Emergency goobsdiff patch: don't use LZMA_RUN after LZMA_FINISH (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /*- 1 /*-
2 * Copyright 2003-2005 Colin Percival 2 * Copyright 2003-2005 Colin Percival
3 * All rights reserved 3 * All rights reserved
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted providing that the following conditions 6 * modification, are permitted providing that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 xzf->ls.next_in = xzf->in; 187 xzf->ls.next_in = xzf->in;
188 xzf->ls.avail_in = fread(xzf->in, 1, BUFSIZ, 188 xzf->ls.avail_in = fread(xzf->in, 1, BUFSIZ,
189 xzf->f); 189 xzf->f);
190 if (ferror(xzf->f)) { 190 if (ferror(xzf->f)) {
191 /* Map I/O errors to LZMA_STREAM_END. */ 191 /* Map I/O errors to LZMA_STREAM_END. */
192 xzf->err = LZMA_STREAM_END; 192 xzf->err = LZMA_STREAM_END;
193 if (err) *err = xzf->err; 193 if (err) *err = xzf->err;
194 return 0; 194 return 0;
195 } else if (feof(xzf->f)) { 195 } else if (feof(xzf->f)) {
196 xzf->eof = 1; 196 xzf->eof = 1;
197 /* LZMA_FINISH is not critical because
198 * LZMA_CONCATENATED is not in use. */
199 action = LZMA_FINISH;
200 } 197 }
201 } 198 }
202 199
203 /* Use the full output buffer. */ 200 /* Use the full output buffer. */
204 xzf->ls.next_out = xzf->out; 201 xzf->ls.next_out = xzf->out;
205 xzf->ls.avail_out = BUFSIZ; 202 xzf->ls.avail_out = BUFSIZ;
206 203
207 /* There must be something to decode. */ 204 /* There must be something to decode. */
208 if (xzf->ls.avail_in == 0) { 205 if (xzf->ls.avail_in == 0) {
209 xzf->err = LZMA_BUF_ERROR; 206 xzf->err = LZMA_BUF_ERROR;
210 if (err) *err = xzf->err; 207 if (err) *err = xzf->err;
211 return 0; 208 return 0;
212 } 209 }
213 210
211 /* LZMA_FINISH is not critical because
212 * LZMA_CONCATENATED is not in use. */
213 if (xzf->eof)
214 action = LZMA_FINISH;
215
214 /* Run the decoder. */ 216 /* Run the decoder. */
215 xzf->err = lzma_code(&xzf->ls, action); 217 xzf->err = lzma_code(&xzf->ls, action);
216 if (xzf->err == LZMA_STREAM_END) { 218 if (xzf->err == LZMA_STREAM_END) {
217 xzf->eof = 1; 219 xzf->eof = 1;
218 xzf->err = LZMA_OK; 220 xzf->err = LZMA_OK;
219 } else if (xzf->err != LZMA_OK) { 221 } else if (xzf->err != LZMA_OK) {
220 if (err) *err = xzf->err; 222 if (err) *err = xzf->err;
221 return 0; 223 return 0;
222 } 224 }
223 225
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 /* Write the new file */ 526 /* Write the new file */
525 if(((fd=open(argv[2],O_CREAT|O_TRUNC|O_WRONLY,0644))<0) || 527 if(((fd=open(argv[2],O_CREAT|O_TRUNC|O_WRONLY,0644))<0) ||
526 (write(fd,new,newsize)!=newsize) || (close(fd)==-1)) 528 (write(fd,new,newsize)!=newsize) || (close(fd)==-1))
527 err(1,"open/write/close(%s)",argv[2]); 529 err(1,"open/write/close(%s)",argv[2]);
528 530
529 free(new); 531 free(new);
530 free(old); 532 free(old);
531 533
532 return 0; 534 return 0;
533 } 535 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698