Revision 1797 trunk/plugins/decoder/decoder.c
| decoder.c (revision 1797) | ||
|---|---|---|
| 369 | 369 |
} else if (!strncmp(line + i, "line=", 5)) {
|
| 370 | 370 |
*num_lines = atoi(line + i + 5); |
| 371 | 371 |
} else if (!strncmp(line + i, "size=", 5)) {
|
| 372 |
*size = atoll(line + i + 5); |
|
| 372 |
*size = g_ascii_strtoull (line + i + 5, NULL, 10); |
|
| 373 | 373 |
} else if (!strncmp(line + i, "name=", 5)) {
|
| 374 | 374 |
strcpy(name, line + i + 5); |
| 375 | 375 |
strip_newline(name); |
| ... | ... | |
| 409 | 409 |
len = strlen(line); |
| 410 | 410 |
for (i = 0; i < len; i++) {
|
| 411 | 411 |
if (!strncmp(line + i, "begin=", 6)) {
|
| 412 |
*begin = atoll(line + i + 6); |
|
| 412 |
*begin = g_ascii_strtoull(line + i + 6, NULL, 10); |
|
| 413 | 413 |
} else if (!strncmp(line + i, "end=", 4)) {
|
| 414 |
*end = atoll(line + i + 4); |
|
| 414 |
*end = g_ascii_strtoull(line + i + 4, NULL, 10); |
|
| 415 | 415 |
} |
| 416 | 416 |
} |
| 417 | 417 |
|
| ... | ... | |
| 557 | 557 |
|
| 558 | 558 |
/* Open the output file (if it wasn't already open) */ |
| 559 | 559 |
memset(path, 0, sizeof(path)); |
| 560 |
snprintf(path, sizeof(path) - 1, "%s%s%s", target_directory, G_DIR_SEPARATOR_S, filename_out); |
|
| 560 |
g_snprintf(path, sizeof(path) - 1, "%s%s%s", target_directory, G_DIR_SEPARATOR_S, filename_out); |
|
| 561 | 561 |
|
| 562 | 562 |
if (strcmp(filename_out, prev_filename_out) != 0) {
|
| 563 | 563 |
char path_orig[4096]; |
| ... | ... | |
| 579 | 579 |
/* If there's already a file at 'path', append a suffix to it and try again */ |
| 580 | 580 |
strcpy(path_orig, path); |
| 581 | 581 |
while (g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
|
| 582 |
snprintf(path, sizeof(path) - 1, "%s.%i", path_orig, suffix); |
|
| 582 |
g_snprintf(path, sizeof(path) - 1, "%s.%i", path_orig, suffix); |
|
| 583 | 583 |
suffix++; |
| 584 | 584 |
} |
| 585 | 585 |
|
| ... | ... | |
| 792 | 792 |
memset(prev_real_filename_out, 0, sizeof(prev_real_filename_out)); |
| 793 | 793 |
|
| 794 | 794 |
memset(target_path, 0, sizeof(target_path)); |
| 795 |
snprintf(target_path, sizeof(target_path) - 1, "%s%s%s", target_directory, G_DIR_SEPARATOR_S, collection_name); |
|
| 795 |
g_snprintf(target_path, sizeof(target_path) - 1, "%s"G_DIR_SEPARATOR_S"%s", target_directory, collection_name); |
|
| 796 | 796 |
|
| 797 | 797 |
ng_plugin_emit_log_msg(plugin_data, NG_LOG_LEVEL_INFO, _("File '%s' of collection '%s' is now being decoded to directory '%s'"), file->subject, collection_name, target_path);
|
| 798 | 798 |
|
| ... | ... | |
| 820 | 820 |
struct decoded_file *list; |
| 821 | 821 |
|
| 822 | 822 |
memset(filename, 0, sizeof(filename) - 1); |
| 823 |
snprintf(filename, sizeof(filename) - 1, "%s%s%s.%i", temp_directory, G_DIR_SEPARATOR_S, file->tmp_filename, i + 1); |
|
| 823 |
g_snprintf(filename, sizeof(filename) - 1, "%s%s%s.%i", temp_directory, G_DIR_SEPARATOR_S, file->tmp_filename, i + 1); |
|
| 824 | 824 |
|
| 825 | 825 |
if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_EXISTS)) {
|
| 826 | 826 |
continue; |
| ... | ... | |
| 957 | 957 |
// Remove all the temp parts on success |
| 958 | 958 |
for (i = 0; i < file->num_parts; i++) {
|
| 959 | 959 |
memset(&filename, 0, sizeof(filename)); |
| 960 |
snprintf(filename, sizeof(filename) - 1, "%s%s%s.%i", temp_directory, G_DIR_SEPARATOR_S, file->tmp_filename, i + 1); |
|
| 960 |
g_snprintf(filename, sizeof(filename) - 1, "%s%s%s.%i", temp_directory, G_DIR_SEPARATOR_S, file->tmp_filename, i + 1); |
|
| 961 | 961 |
g_unlink(filename); |
| 962 | 962 |
|
| 963 | 963 |
} |
Also available in: Unified diff
NNTPGrab

