Diff for /parser3/src/classes/file.C between versions 1.209 and 1.212

version 1.209, 2010/08/04 13:31:07 version 1.212, 2010/10/21 15:06:27
Line 43  extern String sql_offset_name; Line 43  extern String sql_offset_name;
   
 class MFile: public Methoded {  class MFile: public Methoded {
 public: // VStateless_class  public: // VStateless_class
           
         Value* create_new_value(Pool&) { return new VFile(); }          Value* create_new_value(Pool&) { return new VFile(); }
   
 public: // Methoded  
         bool used_directly() { return true; }  
   
 public:  public:
         MFile();          MFile();
   
 };  };
   
 // global variable  // global variable
Line 290  static void _create(Request& r, MethodPa Line 284  static void _create(Request& r, MethodPa
         const String& content=params.as_string(2, "content must be string");          const String& content=params.as_string(2, "content must be string");
         String::Body content_body=content.cstr_to_string_body_untaint(String::L_AS_IS); // explode content, honor tainting changes          String::Body content_body=content.cstr_to_string_body_untaint(String::L_AS_IS); // explode content, honor tainting changes
   
         if(params.count()>3){          VString* vcontent_type=0;
                 Charset* asked_charset=0;          if(params.count()>3)
                   if(HashStringValue* options=params.as_hash(3)){
                           Charset* asked_charset=0;
   
                 if(HashStringValue* options=params.as_no_junction(3, OPTIONS_MUST_NOT_BE_CODE).get_hash()){  
                         int valid_options=0;                          int valid_options=0;
                         if(Value* vcharset_name=options->get(PA_CHARSET_NAME)){                          if(Value* vcharset_name=options->get(PA_CHARSET_NAME)){
                                 asked_charset=&::charsets.get(vcharset_name->as_string().change_case(r.charsets.source(), String::CC_UPPER));                                  asked_charset=&::charsets.get(vcharset_name->as_string().change_case(r.charsets.source(), String::CC_UPPER));
                                 valid_options++;                                  valid_options++;
                         }                          }
                           if(Value* value=options->get(CONTENT_TYPE_NAME)) {
                                   vcontent_type=new VString(value->as_string());
                                   valid_options++;
                           }
                         if(valid_options != options->count())                          if(valid_options != options->count())
                                 throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION);                                  throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION);
                 }  
   
                 if(asked_charset != 0)                          if(asked_charset)
                         content_body=Charset::transcode(content_body, r.charsets.source(), *asked_charset);                                  content_body=Charset::transcode(content_body, r.charsets.source(), *asked_charset);
         }                  }
   
         VString* vcontent_type=new VString(r.mime_type_of(user_file_name_cstr));          if(!vcontent_type)
                   vcontent_type=new VString(r.mime_type_of(user_file_name_cstr));
                   
         VFile& self=GET_SELF(r, VFile);          VFile& self=GET_SELF(r, VFile);
         self.set(true/*tainted*/, content_body.cstr(), content_body.length(), user_file_name_cstr, vcontent_type);          self.set(true/*tainted*/, content_body.cstr(), content_body.length(), user_file_name_cstr, vcontent_type);
Line 848  public: Line 847  public:
                                                 user_content_type=new String(str, String::L_TAINTED);                                                  user_content_type=new String(str, String::L_TAINTED);
                                         break;                                          break;
                                 default:                                  default:
                                         error=SQL_Error(PARSER_RUNTIME, "result must not contain more then one row, three rows");                                          error=SQL_Error(PARSER_RUNTIME, "result must not contain more then one row, three columns");
                                         return true;                                          return true;
                         }                          }
                         return false;                          return false;

Removed from v.1.209  
changed lines
  Added in v.1.212


E-mail: