Skip to content

Commit 937f7fa

Browse files
committed
Initialize variable with fixed value for avoiding compile warnings
1 parent caff611 commit 937f7fa

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

ext/phar/phar.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
667667
php_uint32 manifest_len, manifest_count, manifest_flags, manifest_index, tmp_len, sig_flags;
668668
php_uint16 manifest_ver;
669669
long offset;
670-
int register_alias, sig_len, temp_alias = 0;
670+
int sig_len, register_alias = 0, temp_alias = 0;
671671
char *signature = NULL;
672672

673673
if (pphar) {
@@ -3391,6 +3391,7 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type
33913391
res = phar_orig_compile_file(file_handle, type TSRMLS_CC);
33923392
} zend_catch {
33933393
failed = 1;
3394+
res = NULL;
33943395
} zend_end_try();
33953396

33963397
if (name) {

ext/phar/phar_object.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ PHP_METHOD(Phar, webPhar)
663663
const char *basename;
664664
int fname_len, entry_len, code, index_php_len = 0, not_cgi;
665665
phar_archive_data *phar = NULL;
666-
phar_entry_info *info;
666+
phar_entry_info *info = NULL;
667667

668668
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!saz", &alias, &alias_len, &index_php, &index_php_len, &f404, &f404_len, &mimeoverride, &rewrite) == FAILURE) {
669669
return;
@@ -890,7 +890,7 @@ PHP_METHOD(Phar, webPhar)
890890

891891
zend_bailout();
892892
} else {
893-
char *tmp, sa;
893+
char *tmp = NULL, sa = '\0';
894894
sapi_header_line ctr = {0};
895895
ctr.response_code = 301;
896896
ctr.line_len = sizeof("HTTP/1.1 301 Moved Permanently")+1;

ext/phar/util.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ php_stream *phar_get_efp(phar_entry_info *entry, int follow_links TSRMLS_DC) /*
124124
int phar_seek_efp(phar_entry_info *entry, off_t offset, int whence, off_t position, int follow_links TSRMLS_DC) /* {{{ */
125125
{
126126
php_stream *fp = phar_get_efp(entry, follow_links TSRMLS_CC);
127-
off_t temp = 0, eoffset = 0;
127+
off_t temp, eoffset;
128128

129129
if (!fp) {
130130
return -1;
@@ -154,6 +154,8 @@ int phar_seek_efp(phar_entry_info *entry, off_t offset, int whence, off_t positi
154154
case SEEK_SET:
155155
temp = eoffset + offset;
156156
break;
157+
default:
158+
temp = 0;
157159
}
158160

159161
if (temp > eoffset + (off_t) entry->uncompressed_filesize) {
@@ -1203,7 +1205,7 @@ int phar_get_archive(phar_archive_data **archive, char *fname, int fname_len, ch
12031205
phar_archive_data *fd, **fd_ptr;
12041206
char *my_realpath, *save;
12051207
int save_len;
1206-
ulong fhash, ahash;
1208+
ulong fhash, ahash = 0;
12071209

12081210
phar_request_initialize(TSRMLS_C);
12091211

0 commit comments

Comments
 (0)