diff options
author | Pierre-André Jacquod <pjacquod@alumni.ethz.ch> | 2011-10-03 14:09:11 +0200 |
---|---|---|
committer | Pierre-André Jacquod <pjacquod@alumni.ethz.ch> | 2011-10-07 15:57:54 +0200 |
commit | 1fc34c75a8a2356ed03c52ca839a7ad771c51ba1 (patch) | |
tree | 93d0253f8e59998abe83a6444ad1529d4e5f7c43 | |
parent | 2dc8787d06cb8e12d9309c0cc149befc02c405aa (diff) |
cppcheck scope reduction of var in soltools/...javadep.c
-rw-r--r-- | soltools/javadep/javadep.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/soltools/javadep/javadep.c b/soltools/javadep/javadep.c index 351177a76c6c..ced9f3842df3 100644 --- a/soltools/javadep/javadep.c +++ b/soltools/javadep/javadep.c @@ -198,15 +198,13 @@ read_utf8(const file_t *pfile) * Data is still in network byteorder */ - utf8_t a_utf8; - size_t nread; - + utf8_t a_utf8; a_utf8.pdata = NULL; a_utf8.nlen = read_uint16(pfile); if (a_utf8.nlen > 0) { a_utf8.pdata = xmalloc(a_utf8.nlen*sizeof(char)); - nread = fread(a_utf8.pdata, a_utf8.nlen*sizeof(char), 1, pfile->pfs); + size_t nread = fread(a_utf8.pdata, a_utf8.nlen*sizeof(char), 1, pfile->pfs); if ( !nread ) { fclose(pfile->pfs); err_quit("%s: truncated class file", pfile->pname); @@ -265,8 +263,7 @@ add_to_dependencies(struct growable *pdep, const char *pclass_file) { /* create dependencies */ - int i; - size_t nlen_filt, nlen_str, nlen_pdepstr; + size_t nlen_pdepstr; char *pstr, *ptrunc; char path[PATH_MAX+1]; char cnp_class_file[PATH_MAX+1]; @@ -282,9 +279,10 @@ add_to_dependencies(struct growable *pdep, append_to_growable(pdep, strdup(pstr)); } } else { - nlen_str = strlen(pstr); + size_t nlen_str = strlen(pstr); + int i; for ( i = 0; i < pfilt->ncur; i++ ) { - nlen_filt = strlen(pfilt->parray[i]); + size_t nlen_filt = strlen(pfilt->parray[i]); if ( nlen_filt + 1 + nlen_str > PATH_MAX ) err_quit("path to long"); memcpy(path, pfilt->parray[i], nlen_filt); |