Returns true if file sizes are all within limit, false if not. The client's lock is released, and an error sent to client in the false case.
511976
function checkFileSizeLimit(client, srcList) {
  function maxSizeExceeded(obj) {
    var errorMsg;

    client.lock.release(function(err) {
      if(err) {
        log.error({err: err, client: client}, 'Error releasing sync lock');
      }

      releaseLock(client);

      errorMsg = SyncMessage.error.maxsizeExceeded;
      errorMsg.content = {path: obj.path};
      client.sendMessage(errorMsg);
    });
  }

  for (var key in srcList) {
    if(srcList.hasOwnProperty(key)) {
      var obj = srcList[key];
      for (var prop in obj) {
        if(obj.hasOwnProperty(prop) && prop === 'size') {
          if(obj.size > MAX_SYNC_SIZE_BYTES) {
            // Fail this sync, contains a file that is too large.
            log.warn({client: client},
                     'Client tried to exceed file sync size limit: file was %s bytes, limit is %s',
                     obj.size, MAX_SYNC_SIZE_BYTES);
            maxSizeExceeded(obj);
            return false;
          }
        }
      }
    }
  }

  return true;
}
426464
def max_recv_data_size(self):
        
        with self.lock:
            if self.device is None:
                raise IOError(errno.ENODEV, os.strerror(errno.ENODEV))
            else:
                return self.device.get_max_recv_data_size(self.target)
806556
function checkLimit (limit, keys) {
  if (limit && typeof limit === 'string') limit = +limit;
  if (!limit || Number(limit) !== limit || limit % 1 !== 0 ||
      limit > keys.length)
    limit = keys.length;
  if (limit < 0) limit = 0;
  return limit;
}
265725
@SuppressWarnings("rawtypes")
    public static boolean areFileExtensionsEnabled() {
        Config config = GrailsWebUtil.currentApplication().getConfig();
        return config.getProperty(ENABLE_FILE_EXTENSIONS, Boolean.class, true);
    }
122835
def check_downloaded_files_sizes(self):
        
        for file_url in self.file_urls:
            local_path = file_url.get_local_path(self.dest_directory)
            self.check_file_size(file_url.size, local_path)
1314013
private static function areFileUploadsEnabled() {
		if (self::parseIniBoolean(\ini_get('file_uploads')) === false) {
			return false;
		}

		if (((int) \ini_get('max_file_uploads')) <= 0) {
			return false;
		}

		return true;
	}
1326937
def isHeld(self):
        '''
            
        '''
        if not os.path.exists(self.lockPath):
            return False
        
        try:
            mtime = os.stat(self.lockPath).st_mtime
        except FileNotFoundError as e:
            return False
        
        if self.__checkExpiration(mtime):
            return False

        return True
519118
public function isValidExtension()
    {
        return !count($this->allowedExtensions)
            || in_array($this->getFileExtension(), $this->allowedExtensions, true);
    }
1041637
public boolean isFileServingEnabled() {
        // PK54499 START
        disallowAllFileServingProp = WCCustomProperties.DISALLOW_ALL_FILE_SERVING;
        if (disallowAllFileServingProp != null && !this.getApplicationName().equalsIgnoreCase("isclite")) {
            try
            {
                if (Boolean.valueOf(disallowAllFileServingProp).booleanValue())
                {
                    this.fileServingEnabled = Boolean.FALSE;
                }
                if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
                {
                    logger.logp(Level.FINE, CLASS_NAME, "isFileServing", "PK54499: disallowAllFileServingProp set to " + disallowAllFileServingProp + " for application: "
                                    + this.getApplicationName());
                }
            }
            catch (Exception x)
            {
                logger.logp(Level.SEVERE, CLASS_NAME, "isFileServing", "Illegal value set for property com.ibm.ws.webcontainer.disallowallfileserving");
            }
        }
        // PK54499 END

        if (this.fileServingEnabled != null)
            return this.fileServingEnabled.booleanValue();

        return WCCustomProperties.FILE_SERVING_ENABLED;
    }
1256495
def check_file_size(file_size, path):
        
        stat_info = os.stat(path)
        if stat_info.st_size != file_size:
            format_str = "Error occurred downloading {}. Got a file size {}. Expected file size:{}"
            msg = format_str.format(path, stat_info.st_size, file_size)
            raise ValueError(msg)
549747
def check_size_all(self):
        
        result = self.rpc_srv.get_all_account(self.token)
        print "debug: %s" % result
        for it in result:
            size = getFolderSize(it["path"])
            result = self.rpc_srv.set_account_size(self.token, it["id"], size)
359045
def volumes_maximum_size_bytes(self):
        
        return utils.max_safe([member.volumes.maximum_size_bytes
                               for member in self.get_members()])
5531
function validateMaxFileSize(pluginDir) {
  return (maxBytes, filePath) => {
    try {
      const stat = fs.statSync(path.join(pluginDir, filePath));
      return stat.size <= maxBytes;
    } catch (e) {
      return false;
    }
  };
}
1127232
private final synchronized boolean _decrementTotal(int sizeInBytes)
    {
        boolean doCallback = false;

        // Decrement the count before we check for the watermark being reached
        // (510343)
        _countTotal--;
        if (_watermarkCountLow == _countTotal)
        {
            // guaranteed to go below....
            doCallback = true;
        }

        boolean wasAboveLowLimit = (_countTotalBytes >= _watermarkBytesLow);

        _countTotalBytes = _countTotalBytes - sizeInBytes;

        if (wasAboveLowLimit && _countTotalBytes < _watermarkBytesLow)
        {
            doCallback = true;
        }

        return doCallback;
    }
325815
private boolean hasFileChangedUnexpectedly() {
        synchronized (this) {
            if (mDiskWritesInFlight > 0) {
                // If we know we caused it, it's not unexpected.
                if (DEBUG) System.out.println( "disk write in flight, not unexpected.");
                return false;
            }
        }
        if (!mFile.canRead()) {
            return true;
        }
        synchronized (this) {
            return mStatTimestamp != mFile.lastModified() || mStatSize != mFile.length();
        }
    }
1077407
function _ruleCheckMaxFileSize($elementValue, $maxSize)
    {
        if (!empty($elementValue['error']) && 
            (UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error'])) {
            return false;
        }
        if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
            return true;
        }
        return ($maxSize >= @filesize($elementValue['tmp_name']));
    }
1301429
def safe_size(source):
    

    if source is None:
        return None

    total_bytes = 0
    bytes = []
    b = source.read(MIN_READ_SIZE)
    while b:
        total_bytes += len(b)
        bytes.append(b)
        if total_bytes > MAX_STRING_SIZE:
            try:
                data = FileString(TemporaryFile())
                for bb in bytes:
                    data.write(bb)
                del bytes
                del bb
                b = source.read(MIN_READ_SIZE)
                while b:
                    total_bytes += len(b)
                    data.write(b)
                    b = source.read(MIN_READ_SIZE)
                data.seek(0)
                Log.note("Using file of size {{length}} instead of str()",  length= total_bytes)

                return data
            except Exception as e:
                Log.error("Could not write file > {{num}} bytes",  num= total_bytes, cause=e)
        b = source.read(MIN_READ_SIZE)

    data = b"".join(bytes)
    del bytes
    return data