Remove debug printfs
diff --git a/lib/zip_close.c b/lib/zip_close.c
index a46cc4c..816fcef 100644
--- a/lib/zip_close.c
+++ b/lib/zip_close.c
@@ -191,17 +191,11 @@
de = entry->changes;
if (_zip_read_local_ef(za, i) < 0) {
-#ifdef _WIN32
- printf("close error case 1\n");
-#endif
error = 1;
break;
}
if ((off = zip_source_tell_write(za->src)) < 0) {
-#ifdef _WIN32
- printf("close error case 2: off = %llu\n", off);
-#endif
_zip_error_set_from_source(&za->error, za->src);
error = 1;
break;
@@ -214,9 +208,6 @@
zs = NULL;
if (!ZIP_ENTRY_DATA_CHANGED(entry)) {
if ((zs = _zip_source_zip_new(za, za, i, ZIP_FL_UNCHANGED, 0, 0, NULL)) == NULL) {
-#ifdef _WIN32
- printf("close error case 3\n");
-#endif
error = 1;
break;
}
@@ -224,9 +215,6 @@
/* add_data writes dirent */
if (add_data(za, zs ? zs : entry->source, de, entry->changes ? entry->changes->changed : 0) < 0) {
-#ifdef _WIN32
- printf("close error case 4\n");
-#endif
error = 1;
if (zs)
zip_source_free(zs);
@@ -244,40 +232,25 @@
de->bitflags &= (zip_uint16_t)~ZIP_GPBF_DATA_DESCRIPTOR;
}
if (_zip_dirent_write(za, de, ZIP_FL_LOCAL) < 0) {
-#ifdef _WIN32
- printf("close error case 5\n");
-#endif
error = 1;
break;
}
if ((offset = _zip_file_get_offset(za, i, &za->error)) == 0) {
-#ifdef _WIN32
- printf("close error case 6\n");
-#endif
error = 1;
break;
}
if (zip_source_seek(za->src, (zip_int64_t)offset, SEEK_SET) < 0) {
_zip_error_set_from_source(&za->error, za->src);
-#ifdef _WIN32
- printf("close error case 7\n");
-#endif
error = 1;
break;
}
if (copy_data(za, de->comp_size) < 0) {
-#ifdef _WIN32
- printf("close error case 8\n");
-#endif
error = 1;
break;
}
if (de->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) {
if (write_data_descriptor(za, de, _zip_dirent_needs_zip64(de, 0)) < 0) {
-#ifdef _WIN32
- printf("close error case 9\n");
-#endif
error = 1;
break;
}
diff --git a/lib/zip_dirent.c b/lib/zip_dirent.c
index cc7ba0f..91ff3c2 100644
--- a/lib/zip_dirent.c
+++ b/lib/zip_dirent.c
@@ -422,9 +422,6 @@
if (from_buffer) {
if (_zip_buffer_left(buffer) < variable_size) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("dirent inconsistency 1\n");
-#endif
return -1;
}
}
@@ -441,9 +438,6 @@
if (!zde->filename) {
if (zip_error_code_zip(error) == ZIP_ER_EOF) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("dirent inconsistency 2\n");
-#endif
}
if (!from_buffer) {
_zip_buffer_free(buffer);
@@ -454,9 +448,6 @@
if (zde->bitflags & ZIP_GPBF_ENCODING_UTF_8) {
if (_zip_guess_encoding(zde->filename, ZIP_ENCODING_UTF8_KNOWN) == ZIP_ENCODING_ERROR) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("dirent inconsistency 3\n");
-#endif
if (!from_buffer) {
_zip_buffer_free(buffer);
}
@@ -497,9 +488,6 @@
if (zde->bitflags & ZIP_GPBF_ENCODING_UTF_8) {
if (_zip_guess_encoding(zde->comment, ZIP_ENCODING_UTF8_KNOWN) == ZIP_ENCODING_ERROR) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("dirent inconsistency 4\n");
-#endif
if (!from_buffer) {
_zip_buffer_free(buffer);
}
@@ -575,9 +563,6 @@
}
if (!ok) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("dirent inconsistency 5\n");
-#endif
_zip_buffer_free(ef_buffer);
if (!from_buffer) {
_zip_buffer_free(buffer);
@@ -667,9 +652,6 @@
if (ef == NULL || ef_len < 7) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("dirent inconsistency 6\n");
-#endif
return false;
}
@@ -723,9 +705,6 @@
if (ef_len != 7) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("dirent inconsistency 7\n");
-#endif
_zip_buffer_free(buffer);
return false;
}
diff --git a/lib/zip_open.c b/lib/zip_open.c
index c2ddedc..019cd98 100644
--- a/lib/zip_open.c
+++ b/lib/zip_open.c
@@ -278,9 +278,6 @@
if (cd->offset + cd->size > buf_offset + eocd_offset) {
/* cdir spans past EOCD record */
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("open inconsistency 1\n");
-#endif
_zip_cdir_free(cd);
return NULL;
}
@@ -293,9 +290,6 @@
if (tail_len < comment_len || ((za->open_flags & ZIP_CHECKCONS) && tail_len != comment_len)) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("open inconsistency 2\n");
-#endif
_zip_cdir_free(cd);
return NULL;
}
@@ -315,9 +309,6 @@
if ((data = _zip_buffer_get(buffer, cd->size)) == NULL) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("open inconsistency 3\n");
-#endif
_zip_cdir_free(cd);
return NULL;
}
@@ -369,9 +360,6 @@
if ((cd->entry[i].orig = _zip_dirent_new()) == NULL || (entry_size = _zip_dirent_read(cd->entry[i].orig, za->src, cd_buffer, false, error)) < 0) {
if (grown && zip_error_code_zip(error) == ZIP_ER_NOZIP) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("open inconsistency 4\n");
-#endif
}
_zip_cdir_free(cd);
_zip_buffer_free(cd_buffer);
@@ -383,9 +371,6 @@
if (i != cd->nentry || left > 0) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("open inconsistency 5: i = %llu, nentry = %llu, left = %llu, size = %llu\n", i, cd->nentry, left, cd->size);
-#endif
_zip_buffer_free(cd_buffer);
_zip_cdir_free(cd);
return NULL;
@@ -410,9 +395,6 @@
if (!ok) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("open inconsistency 6\n");
-#endif
_zip_buffer_free(cd_buffer);
_zip_cdir_free(cd);
return NULL;
@@ -472,9 +454,6 @@
if (_zip_headercomp(cd->entry[i].orig, &temp) != 0) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("open inconsistency 7\n");
-#endif
_zip_dirent_finalize(&temp);
return -1;
}
@@ -666,9 +645,6 @@
if (_zip_buffer_left(buffer) < EOCDLEN) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("open inconsistency 8\n");
-#endif
return NULL;
}
@@ -702,17 +678,11 @@
if (offset + size > buf_offset + eocd_offset) {
/* cdir spans past EOCD record */
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("open inconsistency 9\n");
-#endif
return NULL;
}
if ((flags & ZIP_CHECKCONS) && offset + size != buf_offset + eocd_offset) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("open inconsistency 10\n");
-#endif
return NULL;
}
@@ -754,9 +724,6 @@
/* does EOCD fit before EOCD locator? */
if (eocd_offset + EOCD64LEN > eocdloc_offset + buf_offset) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("open inconsistency 11\n");
-#endif
return NULL;
}
@@ -778,9 +745,6 @@
if (memcmp(_zip_buffer_get(buffer, 4), EOCD64_MAGIC, 4) != 0) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("open inconsistency 12\n");
-#endif
if (free_buffer) {
_zip_buffer_free(buffer);
}
@@ -793,9 +757,6 @@
/* is there a hole between EOCD and EOCD locator, or do they overlap? */
if ((flags & ZIP_CHECKCONS) && size + eocd_offset + 12 != buf_offset + eocdloc_offset) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("open inconsistency 13\n");
-#endif
if (free_buffer) {
_zip_buffer_free(buffer);
}
@@ -818,9 +779,6 @@
}
if ((flags & ZIP_CHECKCONS) && (eocd_disk != eocd_disk64 || num_disks != num_disks64)) {
zip_error_set(error, ZIP_ER_INCONS, 0);
-#ifdef _WIN32
- printf("open inconsistency 14\n");
-#endif
if (free_buffer) {
_zip_buffer_free(buffer);
}
diff --git a/lib/zip_source_file_win32.c b/lib/zip_source_file_win32.c
index ba3bfff..f79d95f 100644
--- a/lib/zip_source_file_win32.c
+++ b/lib/zip_source_file_win32.c
@@ -87,7 +87,6 @@
/* TODO: cap len to "DWORD_MAX" */
if (!ReadFile((HANDLE)ctx->f, buf, (DWORD)len, &i, NULL)) {
- printf("win32 read error: %d\n", (int)GetLastError());
zip_error_set(&ctx->error, ZIP_ER_READ, _zip_win32_error_to_errno(GetLastError()));
return -1;
}
diff --git a/lib/zip_source_file_win32_utf16.c b/lib/zip_source_file_win32_utf16.c
index cc43862..d5f13e1 100644
--- a/lib/zip_source_file_win32_utf16.c
+++ b/lib/zip_source_file_win32_utf16.c
@@ -96,7 +96,6 @@
return CreateFile2((const wchar_t *)name, access, share_mode, creation_disposition, &extParams);
#else
- // wprintf(L"CreateFileW(\"%s\", %x, %x, %x, %p, %x)\n", (const wchar_t *)name, access, share_mode, creation_disposition, security_attributes, file_attributes);
return CreateFileW((const wchar_t *)name, access, share_mode, security_attributes, creation_disposition, file_attributes, template_file);
#endif
}
@@ -128,7 +127,6 @@
static BOOL
utf16_move_file(const char *from, const char *to, DWORD flags) {
- // wprintf(L"MoveFileExW(\"%s\", \"%s\", %d)\n", (const wchar_t *)from, (const wchar_t *)to, (int)flags);
return MoveFileExW((const wchar_t *)from, (const wchar_t *)to, flags);
}
diff --git a/lib/zip_source_file_win32_write.c b/lib/zip_source_file_win32_write.c
index ed36b2f..de68925 100644
--- a/lib/zip_source_file_win32_write.c
+++ b/lib/zip_source_file_win32_write.c
@@ -203,7 +203,6 @@
st->exists = false;
return true;
}
- printf("get_file_attributes_ex failed: %u / %d\n", error, _zip_win32_error_to_errno(error));
zip_error_set(&ctx->error, ZIP_ER_READ, _zip_win32_error_to_errno(error));
return false;
}
@@ -211,7 +210,6 @@
st->exists = true;
st->regular_file = true; /* TODO: Is this always right? How to determine without a HANDLE? */
if (!_zip_filetime_to_time_t(file_attributes.ftLastWriteTime, &st->mtime)) {
- printf("filetime_to_time_t failed\n");
zip_error_set(&ctx->error, ZIP_ER_READ, ERANGE);
return false;
}
@@ -219,7 +217,6 @@
/* TODO: fill in ctx->attributes */
- //wprintf(L"stat(%s) = { size = %llu }\n", (wchar_t *)ctx->fname, st->size);
return true;
}