Index: trunk/Nebulous/nebclient/src/nebclient.c
===================================================================
--- trunk/Nebulous/nebclient/src/nebclient.c	(revision 24999)
+++ trunk/Nebulous/nebclient/src/nebclient.c	(revision 25000)
@@ -1057,12 +1057,7 @@
 static off_t nebCopyFilehandle(nebServer *server, int sourceFH, int destFH)
 {
-    off_t           bytesTotal;
-    off_t           bytesRemaining;
-    off_t           writeSize;
-    char            writeBuf[64 * 1024];
+    REQUIRE_SERVER;
+
     struct stat     sourceStat;
-
-    REQUIRE_SERVER;
-
     if(fstat(sourceFH, &sourceStat)) {
         nebSetErr(server, "can not stat filehandles: %s", strerror(errno));
@@ -1072,5 +1067,5 @@
 
     // the size of the file to copied
-    bytesTotal = sourceStat.st_size;
+    off_t bytesTotal = sourceStat.st_size;
 
     /*
@@ -1080,7 +1075,9 @@
     */
 
-    bytesRemaining = bytesTotal;
+    off_t bytesRemaining = bytesTotal;
 
     while (bytesRemaining) {
+        off_t writeSize;
+        char writeBuf[64 * 1024];
         if (bytesRemaining <= sizeof(writeBuf)) {
             writeSize = bytesRemaining;
@@ -1110,13 +1107,4 @@
 static size_t nebParseURI(nebServer *server, const char *URI, char **filename)
 {
-    regex_t         myregex;
-    regmatch_t      mymatch[2];
-    char            errbuf[ERRBUF_SIZE];
-    char            *pattern = "^file://(.*)$";
-    int             status;
-    size_t          matchStart, matchEnd;
-    size_t          matchLength;
-    size_t          filename_size;
-
     REQUIRE_SERVER;
 
@@ -1133,5 +1121,10 @@
     }
 
-    status = regcomp(&myregex, pattern, REG_EXTENDED);
+    regex_t myregex;
+    regmatch_t mymatch[2];
+    char *pattern = "^file://(.*)$";
+    char errbuf[ERRBUF_SIZE];
+
+    int status = regcomp(&myregex, pattern, REG_EXTENDED);
     if (status != 0) {
         regerror(status, &myregex, errbuf, ERRBUF_SIZE);
@@ -1151,7 +1144,7 @@
     regfree(&myregex);
 
-    matchStart = (size_t)mymatch[1].rm_so;
-    matchEnd   = (size_t)mymatch[1].rm_eo;
-    matchLength = matchEnd - matchStart;
+    size_t matchStart = (size_t)mymatch[1].rm_so;
+    size_t matchEnd   = (size_t)mymatch[1].rm_eo;
+    size_t matchLength = matchEnd - matchStart;
 
     if (matchStart == -1) {
@@ -1159,5 +1152,5 @@
     }
 
-    filename_size = matchLength + 1;
+    size_t filename_size = matchLength + 1;
     *filename = xmalloc(filename_size);
 
