OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
550 | 550 |
551 NPString pathString = NPVARIANT_TO_STRING(args[2]); | 551 NPString pathString = NPVARIANT_TO_STRING(args[2]); |
552 char* path = toCString(pathString); | 552 char* path = toCString(pathString); |
553 | 553 |
554 NPString contentsString = NPVARIANT_TO_STRING(args[3]); | 554 NPString contentsString = NPVARIANT_TO_STRING(args[3]); |
555 | 555 |
556 FILE* tempFile = fopen(path, "w"); | 556 FILE* tempFile = fopen(path, "w"); |
557 if (!tempFile) | 557 if (!tempFile) |
558 return false; | 558 return false; |
559 | 559 |
560 fwrite(contentsString.UTF8Characters, contentsString.UTF8Length, 1, tempFile ); | 560 int written = fwrite(contentsString.UTF8Characters, contentsString.UTF8Lengt h, 1, tempFile); |
agl
2009/02/22 01:25:35
size_t, not int
| |
561 DCHECK(written == 1); | |
561 fclose(tempFile); | 562 fclose(tempFile); |
562 | 563 |
563 NPError error = browser->posturl(obj->npp, url, target, pathString.UTF8Lengt h, path, TRUE); | 564 NPError error = browser->posturl(obj->npp, url, target, pathString.UTF8Lengt h, path, TRUE); |
564 | 565 |
565 free(path); | 566 free(path); |
566 free(target); | 567 free(target); |
567 free(url); | 568 free(url); |
568 | 569 |
569 BOOLEAN_TO_NPVARIANT(error == NPERR_NO_ERROR, *result); | 570 BOOLEAN_TO_NPVARIANT(error == NPERR_NO_ERROR, *result); |
570 return true; | 571 return true; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
835 object->firstUrl = strdup(url); | 836 object->firstUrl = strdup(url); |
836 if (headers) | 837 if (headers) |
837 object->firstHeaders = strdup(headers); | 838 object->firstHeaders = strdup(headers); |
838 } else { | 839 } else { |
839 free(object->lastUrl); | 840 free(object->lastUrl); |
840 free(object->lastHeaders); | 841 free(object->lastHeaders); |
841 object->lastUrl = (url ? strdup(url) : NULL); | 842 object->lastUrl = (url ? strdup(url) : NULL); |
842 object->lastHeaders = (headers ? strdup(headers) : NULL); | 843 object->lastHeaders = (headers ? strdup(headers) : NULL); |
843 } | 844 } |
844 } | 845 } |
OLD | NEW |