LinkModules.cpp: don't repeat names in comments.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@220662 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/Linker/LinkModules.cpp
+++ lib/Linker/LinkModules.cpp
@@ -36,47 +36,44 @@
 //===----------------------------------------------------------------------===//

 namespace {
-  typedef SmallPtrSet<StructType*, 32> TypeSet;
+typedef SmallPtrSet<StructType *, 32> TypeSet;

 class TypeMapTy : public ValueMapTypeRemapper {
-  /// MappedTypes - This is a mapping from a source type to a destination type
-  /// to use.
+  /// This is a mapping from a source type to a destination type to use.
   DenseMap<Type*, Type*> MappedTypes;

-  /// SpeculativeTypes - When checking to see if two subgraphs are isomorphic,
-  /// we speculatively add types to MappedTypes, but keep track of them here in
-  /// case we need to roll back.
+  /// When checking to see if two subgraphs are isomorphic, we speculatively
+  /// add types to MappedTypes, but keep track of them here in case we need to
+  /// roll back.
   SmallVector<Type*, 16> SpeculativeTypes;

-  /// SrcDefinitionsToResolve - This is a list of non-opaque structs in the
-  /// source module that are mapped to an opaque struct in the destination
-  /// module.
+  /// This is a list of non-opaque structs in the source module that are mapped
+  /// to an opaque struct in the destination module.
   SmallVector<StructType*, 16> SrcDefinitionsToResolve;

-  /// DstResolvedOpaqueTypes - This is the set of opaque types in the
-  /// destination modules who are getting a body from the source module.
+  /// This is the set of opaque types in the destination modules who are
+  /// getting a body from the source module.
   SmallPtrSet<StructType*, 16> DstResolvedOpaqueTypes;

 public:
   TypeMapTy(TypeSet &Set) : DstStructTypesSet(Set) {}

   TypeSet &DstStructTypesSet;
-  /// addTypeMapping - Indicate that the specified type in the destination
-  /// module is conceptually equivalent to the specified type in the source
-  /// module.
+  /// Indicate that the specified type in the destination module is conceptually
+  /// equivalent to the specified type in the source module.
   void addTypeMapping(Type *DstTy, Type *SrcTy);

   /// linkDefinedTypeBodies - Produce a body for an opaque type in the dest
   /// module from a type definition in the source module.
   void linkDefinedTypeBodies();

-  /// get - Return the mapped type to use for the specified input type from the
+  /// Return the mapped type to use for the specified input type from the
   /// source module.
   Type *get(Type *SrcTy);

   FunctionType *get(FunctionType *T) {return cast<FunctionType>(get((Type*)T));}

-  /// dump - Dump out the type map for debugging purposes.
+  /// Dump out the type map for debugging purposes.
   void dump() const {
     for (DenseMap<Type*, Type*>::const_iterator
            I = MappedTypes.begin(), E = MappedTypes.end(); I != E; ++I) {
@@ -90,7 +87,7 @@

 private:
   Type *getImpl(Type *T);
-  /// remapType - Implement the ValueMapTypeRemapper interface.
+  /// Implement the ValueMapTypeRemapper interface.
   Type *remapType(Type *SrcTy) override {
     return get(SrcTy);
   }
@@ -119,8 +116,8 @@
   SpeculativeTypes.clear();
 }

-/// areTypesIsomorphic - Recursively walk this pair of types, returning true
-/// if they are isomorphic, false if they are not.
+/// Recursively walk this pair of types, returning true if they are isomorphic,
+/// false if they are not.
 bool TypeMapTy::areTypesIsomorphic(Type *DstTy, Type *SrcTy) {
   // Two types with differing kinds are clearly not isomorphic.
   if (DstTy->getTypeID() != SrcTy->getTypeID()) return false;
@@ -204,8 +201,8 @@
   return true;
 }

-/// linkDefinedTypeBodies - Produce a body for an opaque type in the dest
-/// module from a type definition in the source module.
+/// Produce a body for an opaque type in the dest module from a type definition
+/// in the source module.
 void TypeMapTy::linkDefinedTypeBodies() {
   SmallVector<Type*, 16> Elements;
   SmallString<16> TmpName;
@@ -245,8 +242,6 @@
   DstResolvedOpaqueTypes.clear();
 }

-/// get - Return the mapped type to use for the specified input type from the
-/// source module.
 Type *TypeMapTy::get(Type *Ty) {
   Type *Result = getImpl(Ty);

@@ -256,7 +251,7 @@
   return Result;
 }

-/// getImpl - This is the recursive version of get().
+/// This is the recursive version of get().
 Type *TypeMapTy::getImpl(Type *Ty) {
   // If we already have an entry for this type, return it.
   Type **Entry = &MappedTypes[Ty];
@@ -362,9 +357,9 @@
 namespace {
   class ModuleLinker;

-  /// ValueMaterializerTy - Creates prototypes for functions that are lazily
-  /// linked on the fly. This speeds up linking for modules with many
-  /// lazily linked functions of which few get used.
+  /// Creates prototypes for functions that are lazily linked on the fly. This
+  /// speeds up linking for modules with many/ lazily linked functions of which
+  /// few get used.
   class ValueMaterializerTy : public ValueMaterializer {
     TypeMapTy &TypeMap;
     Module *DstM;
@@ -393,18 +388,18 @@
   void LinkDiagnosticInfo::print(DiagnosticPrinter &DP) const { DP << Msg; }
   }

-  /// ModuleLinker - This is an implementation class for the LinkModules
-  /// function, which is the entrypoint for this file.
+  /// This is an implementation class for the LinkModules function, which is the
+  /// entrypoint for this file.
   class ModuleLinker {
     Module *DstM, *SrcM;

     TypeMapTy TypeMap;
     ValueMaterializerTy ValMaterializer;

-    /// ValueMap - Mapping of values from what they used to be in Src, to what
-    /// they are now in DstM.  ValueToValueMapTy is a ValueMap, which involves
-    /// some overhead due to the use of Value handles which the Linker doesn't
-    /// actually need, but this allows us to reuse the ValueMapper code.
+    /// Mapping of values from what they used to be in Src, to what they are now
+    /// in DstM.  ValueToValueMapTy is a ValueMap, which involves some overhead
+    /// due to the use of Value handles which the Linker doesn't actually need,
+    /// but this allows us to reuse the ValueMapper code.
     ValueToValueMapTy ValueMap;

     struct AppendingVarInfo {
@@ -456,15 +451,15 @@
     bool getComdatResult(const Comdat *SrcC, Comdat::SelectionKind &SK,
                          bool &LinkFromSrc);

-    /// getLinkageResult - This analyzes the two global values and determines
-    /// what the result will look like in the destination module.
+    /// This analyzes the two global values and determines what the result will
+    /// look like in the destination module.
     bool getLinkageResult(GlobalValue *Dest, const GlobalValue *Src,
                           GlobalValue::LinkageTypes &LT,
                           GlobalValue::VisibilityTypes &Vis,
                           bool &LinkFromSrc);

-    /// getLinkedToGlobal - Given a global in the source module, return the
-    /// global in the destination module that is being linked to, if any.
+    /// Given a global in the source module, return the global in the
+    /// destination module that is being linked to, if any.
     GlobalValue *getLinkedToGlobal(GlobalValue *SrcGV) {
       // If the source has no name it can't link.  If it has local linkage,
       // there is no name match-up going on.
@@ -503,9 +498,9 @@
   };
 }

-/// forceRenaming - The LLVM SymbolTable class autorenames globals that conflict
-/// in the symbol table.  This is good for all clients except for us.  Go
-/// through the trouble to force this back.
+/// The LLVM SymbolTable class autorenames globals that conflict in the symbol
+/// table. This is good for all clients except for us. Go through the trouble
+/// to force this back.
 static void forceRenaming(GlobalValue *GV, StringRef Name) {
   // If the global doesn't force its name or if it already has the right name,
   // there is nothing for us to do.
@@ -524,8 +519,8 @@
   }
 }

-/// copyGVAttributes - copy additional attributes (those not needed to construct
-/// a GlobalValue) from the SrcGV to the DestGV.
+/// copy additional attributes (those not needed to construct a GlobalValue)
+/// from the SrcGV to the DestGV.
 static void copyGVAttributes(GlobalValue *DestGV, const GlobalValue *SrcGV) {
   // Use the maximum alignment, rather than just copying the alignment of SrcGV.
   auto *DestGO = dyn_cast<GlobalObject>(DestGV);
@@ -789,10 +784,10 @@
   return false;
 }

-/// computeTypeMapping - Loop over all of the linked values to compute type
-/// mappings.  For example, if we link "extern Foo *x" and "Foo *x = NULL", then
-/// we have two struct types 'Foo' but one got renamed when the module was
-/// loaded into the same LLVMContext.
+/// Loop over all of the linked values to compute type mappings.  For example,
+/// if we link "extern Foo *x" and "Foo *x = NULL", then we have two struct
+/// types 'Foo' but one got renamed when the module was loaded into the same
+/// LLVMContext.
 void ModuleLinker::computeTypeMapping() {
   // Incorporate globals.
   for (Module::global_iterator I = SrcM->global_begin(),
@@ -944,8 +939,8 @@
   upgradeMismatchedGlobalArray("llvm.global_dtors");
 }

-/// linkAppendingVarProto - If there were any appending global variables, link
-/// them together now.  Return true on error.
+/// If there were any appending global variables, link them together now.
+/// Return true on error.
 bool ModuleLinker::linkAppendingVarProto(GlobalVariable *DstGV,
                                          GlobalVariable *SrcGV) {

@@ -1012,8 +1007,8 @@
   return false;
 }

-/// linkGlobalProto - Loop through the global variables in the src module and
-/// merge them into the dest module.
+/// Loop through the global variables in the src module and merge them into the
+/// dest module.
 bool ModuleLinker::linkGlobalProto(GlobalVariable *SGV) {
   GlobalValue *DGV = getLinkedToGlobal(SGV);
   llvm::Optional<GlobalValue::VisibilityTypes> NewVisibility;
@@ -1114,8 +1109,8 @@
   return false;
 }

-/// linkFunctionProto - Link the function in the source module into the
-/// destination module if needed, setting up mapping information.
+/// Link the function in the source module into the destination module if
+/// needed, setting up mapping information.
 bool ModuleLinker::linkFunctionProto(Function *SF) {
   GlobalValue *DGV = getLinkedToGlobal(SF);
   llvm::Optional<GlobalValue::VisibilityTypes> NewVisibility;
@@ -1195,8 +1190,7 @@
   return false;
 }

-/// LinkAliasProto - Set up prototypes for any aliases that come over from the
-/// source module.
+/// Set up prototypes for any aliases that come over from the source module.
 bool ModuleLinker::linkAliasProto(GlobalAlias *SGA) {
   GlobalValue *DGV = getLinkedToGlobal(SGA);
   llvm::Optional<GlobalValue::VisibilityTypes> NewVisibility;
@@ -1305,8 +1299,8 @@
   AVI.NewGV->setInitializer(ConstantArray::get(NewType, DstElements));
 }

-/// linkGlobalInits - Update the initializers in the Dest module now that all
-/// globals that may be referenced are in Dest.
+/// Update the initializers in the Dest module now that all globals that may be
+/// referenced are in Dest.
 void ModuleLinker::linkGlobalInits() {
   // Loop over all of the globals in the src module, mapping them over as we go
   for (Module::const_global_iterator I = SrcM->global_begin(),
@@ -1323,9 +1317,9 @@
   }
 }

-/// linkFunctionBody - Copy the source function over into the dest function and
-/// fix up references to values.  At this point we know that Dest is an external
-/// function, and that Src is not.
+/// Copy the source function over into the dest function and fix up references
+/// to values. At this point we know that Dest is an external function, and
+/// that Src is not.
 void ModuleLinker::linkFunctionBody(Function *Dst, Function *Src) {
   assert(Src && Dst && Dst->isDeclaration() && !Src->isDeclaration());

@@ -1366,7 +1360,7 @@

 }

-/// linkAliasBodies - Insert all of the aliases in Src into the Dest module.
+/// Insert all of the aliases in Src into the Dest module.
 void ModuleLinker::linkAliasBodies() {
   for (Module::alias_iterator I = SrcM->alias_begin(), E = SrcM->alias_end();
        I != E; ++I) {
@@ -1381,8 +1375,7 @@
   }
 }

-/// linkNamedMDNodes - Insert all of the named MDNodes in Src into the Dest
-/// module.
+/// Insert all of the named MDNodes in Src into the Dest module.
 void ModuleLinker::linkNamedMDNodes() {
   const NamedMDNode *SrcModFlags = SrcM->getModuleFlagsMetadata();
   for (Module::const_named_metadata_iterator I = SrcM->named_metadata_begin(),
@@ -1397,8 +1390,7 @@
   }
 }

-/// linkModuleFlagsMetadata - Merge the linker flags in Src into the Dest
-/// module.
+/// Merge the linker flags in Src into the Dest module.
 bool ModuleLinker::linkModuleFlagsMetadata() {
   // If the source module has no module flags, we are done.
   const NamedMDNode *SrcModFlags = SrcM->getModuleFlagsMetadata();
@@ -1752,11 +1744,11 @@
 // LinkModules entrypoint.
 //===----------------------------------------------------------------------===//

-/// LinkModules - This function links two modules together, with the resulting
-/// Dest module modified to be the composite of the two input modules.  If an
-/// error occurs, true is returned and ErrorMsg (if not null) is set to indicate
-/// the problem.  Upon failure, the Dest module could be in a modified state,
-/// and shouldn't be relied on to be consistent.
+/// This function links two modules together, with the resulting Dest module
+/// modified to be the composite of the two input modules. If an error occurs,
+/// true is returned and ErrorMsg (if not null) is set to indicate the problem.
+/// Upon failure, the Dest module could be in a modified state, and shouldn't be
+/// relied on to be consistent.
 bool Linker::LinkModules(Module *Dest, Module *Src, unsigned Mode) {
   Linker L(Dest);
   return L.linkInModule(Src, Mode);


Cleanup

Cleanup

--- src/assets.cpp
+++ src/assets.cpp
@@ -1185,14 +1185,7 @@
         line3.emplace_back("Difference (need)");

         for (auto& clas : all_asset_classes()) {
-            budget::money desired_alloc;
-
-            for (auto& c : desired.classes) {
-                if (c.first == clas.id) {
-                    desired_alloc = c.second;
-                    break;
-                }
-            }
+            auto desired_alloc = get_asset_class_allocation(desired, clas);

             line1.emplace_back(to_string(desired_alloc));
             line2.emplace_back(to_string(total * (float(desired_alloc) / 100.0)));


Refactor ELFObjectWriter.
+ ARM/X86/MBlaze now share a common RecordRelocation
+ ARM/X86/MBlaze arch specific routines are limited to GetRelocType()

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@121043 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/MC/ELFObjectWriter.cpp
+++ lib/MC/ELFObjectWriter.cpp
@@ -286,10 +286,8 @@
                           const SectionIndexMapTy &SectionIndexMap);

     virtual void RecordRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout,
-                          const MCFragment *Fragment, const MCFixup &Fixup,
-                                  MCValue Target, uint64_t &FixedValue) {
-      assert(0 && "RecordRelocation is not specific enough");
-    }
+                                  const MCFragment *Fragment, const MCFixup &Fixup,
+                                  MCValue Target, uint64_t &FixedValue);

     virtual uint64_t getSymbolIndexInSymbolTable(const MCAssembler &Asm,
                                          const MCSymbol *S);
@@ -348,6 +346,13 @@
                       uint32_t GroupSymbolIndex,
                       uint64_t Offset, uint64_t Size, uint64_t Alignment,
                       const MCSectionELF &Section);
+
+  protected:
+    virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
+                                  bool IsPCRel, bool IsRelocWithSymbol,
+                                  int64_t Addend) = 0;
+
+    virtual bool isFixupKindPCRel(unsigned Kind) const = 0;
   };

   //===- X86ELFObjectWriter -------------------------------------------===//
@@ -359,14 +364,12 @@
                        Triple::OSType _OSType);

     virtual ~X86ELFObjectWriter();
-    virtual void RecordRelocation(const MCAssembler &Asm,
-                                  const MCAsmLayout &Layout,
-                                  const MCFragment *Fragment,
-                                  const MCFixup &Fixup, MCValue Target,
-                                  uint64_t &FixedValue);
-
-  private:
-    static bool isFixupKindPCRel(unsigned Kind) {
+  protected:
+    virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
+                                  bool IsPCRel, bool IsRelocWithSymbol,
+                                  int64_t Addend);
+
+    virtual bool isFixupKindPCRel(unsigned Kind) const {
       switch (Kind) {
       default:
         return false;
@@ -390,18 +393,11 @@
                        Triple::OSType _OSType);

     virtual ~ARMELFObjectWriter();
-    virtual void RecordRelocation(const MCAssembler &Asm,
-                                  const MCAsmLayout &Layout,
-                                  const MCFragment *Fragment,
-                                  const MCFixup &Fixup, MCValue Target,
-                                  uint64_t &FixedValue);
-
   protected:
-    // Fixme: pull up to ELFObjectWriter
-    unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
-                          bool IsPCRel);
-  private:
-    static bool isFixupKindPCRel(unsigned Kind) {
+    virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
+                                  bool IsPCRel, bool IsRelocWithSymbol,
+                                  int64_t Addend);
+    virtual bool isFixupKindPCRel(unsigned Kind) const {
       switch (Kind) {
       default:
         return false;
@@ -425,14 +421,12 @@
                           Triple::OSType _OSType);

     virtual ~MBlazeELFObjectWriter();
-    virtual void RecordRelocation(const MCAssembler &Asm,
-                                  const MCAsmLayout &Layout,
-                                  const MCFragment *Fragment,
-                                  const MCFixup &Fixup, MCValue Target,
-                                  uint64_t &FixedValue);
-
-  private:
-    static bool isFixupKindPCRel(unsigned Kind) {
+  protected:
+    virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
+                                  bool IsPCRel, bool IsRelocWithSymbol,
+                                  int64_t Addend);
+
+    virtual bool isFixupKindPCRel(unsigned Kind) const {
       switch (Kind) {
       default:
         return false;
@@ -758,6 +752,70 @@
   }

   return NULL;
+}
+
+
+void ELFObjectWriter::RecordRelocation(const MCAssembler &Asm,
+                                       const MCAsmLayout &Layout,
+                                       const MCFragment *Fragment,
+                                       const MCFixup &Fixup,
+                                       MCValue Target,
+                                       uint64_t &FixedValue) {
+  int64_t Addend = 0;
+  int Index = 0;
+  int64_t Value = Target.getConstant();
+  const MCSymbol *RelocSymbol = NULL;
+
+  bool IsPCRel = isFixupKindPCRel(Fixup.getKind());
+  if (!Target.isAbsolute()) {
+    const MCSymbol &Symbol = Target.getSymA()->getSymbol();
+    const MCSymbol &ASymbol = Symbol.AliasedSymbol();
+    RelocSymbol = SymbolToReloc(Asm, Target, *Fragment);
+
+    if (const MCSymbolRefExpr *RefB = Target.getSymB()) {
+      const MCSymbol &SymbolB = RefB->getSymbol();
+      MCSymbolData &SDB = Asm.getSymbolData(SymbolB);
+      IsPCRel = true;
+
+      // Offset of the symbol in the section
+      int64_t a = Layout.getSymbolOffset(&SDB);
+
+      // Ofeset of the relocation in the section
+      int64_t b = Layout.getFragmentOffset(Fragment) + Fixup.getOffset();
+      Value += b - a;
+    }
+
+    if (!RelocSymbol) {
+      MCSymbolData &SD = Asm.getSymbolData(ASymbol);
+      MCFragment *F = SD.getFragment();
+
+      Index = F->getParent()->getOrdinal() + 1;
+
+      // Offset of the symbol in the section
+      Value += Layout.getSymbolOffset(&SD);
+    } else {
+      if (Asm.getSymbolData(Symbol).getFlags() & ELF_Other_Weakref)
+        WeakrefUsedInReloc.insert(RelocSymbol);
+      else
+        UsedInReloc.insert(RelocSymbol);
+      Index = -1;
+    }
+    Addend = Value;
+    // Compensate for the addend on i386.
+    if (Is64Bit)
+      Value = 0;
+  }
+
+  FixedValue = Value;
+  unsigned Type = GetRelocType(Target, Fixup, IsPCRel,
+                               (RelocSymbol != 0), Addend);
+
+  uint64_t RelocOffset = Layout.getFragmentOffset(Fragment) +
+    Fixup.getOffset();
+
+  if (!HasRelocationAddend) Addend = 0;
+  ELFRelocationEntry ERE(RelocOffset, Index, Type, RelocSymbol, Addend);
+  Relocations[Fragment->getParent()].push_back(ERE);
 }

@@ -1467,7 +1525,9 @@

 unsigned ARMELFObjectWriter::GetRelocType(const MCValue &Target,
                                           const MCFixup &Fixup,
-                                          bool IsPCRel) {
+                                          bool IsPCRel,
+                                          bool IsRelocWithSymbol,
+                                          int64_t Addend) {
   MCSymbolRefExpr::VariantKind Modifier = Target.isAbsolute() ?
     MCSymbolRefExpr::VK_None : Target.getSymA()->getKind();

@@ -1501,70 +1561,6 @@
   return -1;
 }

-void ARMELFObjectWriter::RecordRelocation(const MCAssembler &Asm,
-                                          const MCAsmLayout &Layout,
-                                          const MCFragment *Fragment,
-                                          const MCFixup &Fixup,
-                                          MCValue Target,
-                                          uint64_t &FixedValue) {
-  int64_t Addend = 0;
-  int Index = 0;
-  int64_t Value = Target.getConstant();
-  const MCSymbol *RelocSymbol = NULL;
-
-  bool IsPCRel = isFixupKindPCRel(Fixup.getKind());
-  if (!Target.isAbsolute()) {
-    const MCSymbol &Symbol = Target.getSymA()->getSymbol();
-    const MCSymbol &ASymbol = Symbol.AliasedSymbol();
-    RelocSymbol = SymbolToReloc(Asm, Target, *Fragment);
-
-    if (const MCSymbolRefExpr *RefB = Target.getSymB()) {
-      const MCSymbol &SymbolB = RefB->getSymbol();
-      MCSymbolData &SDB = Asm.getSymbolData(SymbolB);
-      IsPCRel = true;
-
-      // Offset of the symbol in the section
-      int64_t a = Layout.getSymbolOffset(&SDB);
-
-      // Ofeset of the relocation in the section
-      int64_t b = Layout.getFragmentOffset(Fragment) + Fixup.getOffset();
-      Value += b - a;
-    }
-
-    if (!RelocSymbol) {
-      MCSymbolData &SD = Asm.getSymbolData(ASymbol);
-      MCFragment *F = SD.getFragment();
-
-      Index = F->getParent()->getOrdinal() + 1;
-
-      // Offset of the symbol in the section
-      Value += Layout.getSymbolOffset(&SD);
-    } else {
-      if (Asm.getSymbolData(Symbol).getFlags() & ELF_Other_Weakref)
-        WeakrefUsedInReloc.insert(RelocSymbol);
-      else
-        UsedInReloc.insert(RelocSymbol);
-      Index = -1;
-    }
-    Addend = Value;
-    // Compensate for the addend on i386.
-    if (Is64Bit)
-      Value = 0;
-  }
-
-  FixedValue = Value;
-
-  // determine the type of the relocation
-  unsigned Type = GetRelocType(Target, Fixup, IsPCRel);
-
-  uint64_t RelocOffset = Layout.getFragmentOffset(Fragment) +
-    Fixup.getOffset();
-
-  if (!HasRelocationAddend) Addend = 0;
-  ELFRelocationEntry ERE(RelocOffset, Index, Type, RelocSymbol, Addend);
-  Relocations[Fragment->getParent()].push_back(ERE);
-}
-
 //===- MBlazeELFObjectWriter -------------------------------------------===//

 MBlazeELFObjectWriter::MBlazeELFObjectWriter(raw_ostream &_OS, bool _Is64Bit,
@@ -1579,54 +1575,11 @@
 MBlazeELFObjectWriter::~MBlazeELFObjectWriter() {
 }

-void MBlazeELFObjectWriter::RecordRelocation(const MCAssembler &Asm,
-                                             const MCAsmLayout &Layout,
-                                             const MCFragment *Fragment,
+unsigned MBlazeELFObjectWriter::GetRelocType(const MCValue &Target,
                                              const MCFixup &Fixup,
-                                             MCValue Target,
-                                             uint64_t &FixedValue) {
-  int64_t Addend = 0;
-  int Index = 0;
-  int64_t Value = Target.getConstant();
-  const MCSymbol &Symbol = Target.getSymA()->getSymbol();
-  const MCSymbol &ASymbol = Symbol.AliasedSymbol();
-  const MCSymbol *RelocSymbol = SymbolToReloc(Asm, Target, *Fragment);
-
-  bool IsPCRel = isFixupKindPCRel(Fixup.getKind());
-  if (!Target.isAbsolute()) {
-    if (const MCSymbolRefExpr *RefB = Target.getSymB()) {
-      const MCSymbol &SymbolB = RefB->getSymbol();
-      MCSymbolData &SDB = Asm.getSymbolData(SymbolB);
-      IsPCRel = true;
-
-      // Offset of the symbol in the section
-      int64_t a = Layout.getSymbolOffset(&SDB);
-
-      // Ofeset of the relocation in the section
-      int64_t b = Layout.getFragmentOffset(Fragment) + Fixup.getOffset();
-      Value += b - a;
-    }
-
-    if (!RelocSymbol) {
-      MCSymbolData &SD = Asm.getSymbolData(ASymbol);
-      MCFragment *F = SD.getFragment();
-
-      Index = F->getParent()->getOrdinal();
-
-      // Offset of the symbol in the section
-      Value += Layout.getSymbolOffset(&SD);
-    } else {
-      if (Asm.getSymbolData(Symbol).getFlags() & ELF_Other_Weakref)
-        WeakrefUsedInReloc.insert(RelocSymbol);
-      else
-        UsedInReloc.insert(RelocSymbol);
-      Index = -1;
-    }
-    Addend = Value;
-  }
-
-  FixedValue = Value;
-
+                                             bool IsPCRel,
+                                             bool IsRelocWithSymbol,
+                                             int64_t Addend) {
   // determine the type of the relocation
   unsigned Type;
   if (IsPCRel) {
@@ -1644,25 +1597,16 @@
     switch ((unsigned)Fixup.getKind()) {
     default: llvm_unreachable("invalid fixup kind!");
     case FK_Data_4:
-      Type = (RelocSymbol || Addend !=0) ? ELF::R_MICROBLAZE_32
-                                         : ELF::R_MICROBLAZE_64;
+      Type = ((IsRelocWithSymbol || Addend !=0)
+              ? ELF::R_MICROBLAZE_32
+              : ELF::R_MICROBLAZE_64);
       break;
     case FK_Data_2:
       Type = ELF::R_MICROBLAZE_32;
       break;
     }
   }
-
-  MCSymbolRefExpr::VariantKind Modifier = Target.getSymA()->getKind();
-  if (RelocNeedsGOT(Modifier))
-    NeedsGOT = true;
-
-  uint64_t RelocOffset = Layout.getFragmentOffset(Fragment) +
-    Fixup.getOffset();
-
-  if (!HasRelocationAddend) Addend = 0;
-  ELFRelocationEntry ERE(RelocOffset, Index, Type, RelocSymbol, Addend);
-  Relocations[Fragment->getParent()].push_back(ERE);
+  return Type;
 }

 //===- X86ELFObjectWriter -------------------------------------------===//
@@ -1679,59 +1623,11 @@
 X86ELFObjectWriter::~X86ELFObjectWriter()
 {}

-void X86ELFObjectWriter::RecordRelocation(const MCAssembler &Asm,
-                                       const MCAsmLayout &Layout,
-                                       const MCFragment *Fragment,
-                                       const MCFixup &Fixup,
-                                       MCValue Target,
-                                       uint64_t &FixedValue) {
-  int64_t Addend = 0;
-  int Index = 0;
-  int64_t Value = Target.getConstant();
-  const MCSymbol *RelocSymbol = NULL;
-
-  bool IsPCRel = isFixupKindPCRel(Fixup.getKind());
-  if (!Target.isAbsolute()) {
-    const MCSymbol &Symbol = Target.getSymA()->getSymbol();
-    const MCSymbol &ASymbol = Symbol.AliasedSymbol();
-    RelocSymbol = SymbolToReloc(Asm, Target, *Fragment);
-
-    if (const MCSymbolRefExpr *RefB = Target.getSymB()) {
-      const MCSymbol &SymbolB = RefB->getSymbol();
-      MCSymbolData &SDB = Asm.getSymbolData(SymbolB);
-      IsPCRel = true;
-
-      // Offset of the symbol in the section
-      int64_t a = Layout.getSymbolOffset(&SDB);
-
-      // Ofeset of the relocation in the section
-      int64_t b = Layout.getFragmentOffset(Fragment) + Fixup.getOffset();
-      Value += b - a;
-    }
-
-    if (!RelocSymbol) {
-      MCSymbolData &SD = Asm.getSymbolData(ASymbol);
-      MCFragment *F = SD.getFragment();
-
-      Index = F->getParent()->getOrdinal() + 1;
-
-      // Offset of the symbol in the section
-      Value += Layout.getSymbolOffset(&SD);
-    } else {
-      if (Asm.getSymbolData(Symbol).getFlags() & ELF_Other_Weakref)
-        WeakrefUsedInReloc.insert(RelocSymbol);
-      else
-        UsedInReloc.insert(RelocSymbol);
-      Index = -1;
-    }
-    Addend = Value;
-    // Compensate for the addend on i386.
-    if (Is64Bit)
-      Value = 0;
-  }
-
-  FixedValue = Value;
-
+unsigned X86ELFObjectWriter::GetRelocType(const MCValue &Target,
+                                          const MCFixup &Fixup,
+                                          bool IsPCRel,
+                                          bool IsRelocWithSymbol,
+                                          int64_t Addend) {
   // determine the type of the relocation

   MCSymbolRefExpr::VariantKind Modifier = Target.isAbsolute() ?
@@ -1866,11 +1762,5 @@
   if (RelocNeedsGOT(Modifier))
     NeedsGOT = true;

-
-  uint64_t RelocOffset = Layout.getFragmentOffset(Fragment) +
-    Fixup.getOffset();
-
-  if (!HasRelocationAddend) Addend = 0;
-  ELFRelocationEntry ERE(RelocOffset, Index, Type, RelocSymbol, Addend);
-  Relocations[Fragment->getParent()].push_back(ERE);
-}
+  return Type;
+}


Exit cleanly from CSOLNP on user interrupt

--- src/asubnp.cpp
+++ src/asubnp.cpp
@@ -1129,8 +1129,7 @@

                 }
             }
-	    bool bb = Global->interrupted();
-	    if(bb) return;
+	    if (Global->interrupted()) mxThrow("User interrupt");
         } // end while(go <= 0){

         alp[0] = 0;
@@ -1315,8 +1314,7 @@
                     mxLog("%f", go);
                 }
             }
-            bool bbb = Global->interrupted();
-            if(bbb) return;
+	    if (Global->interrupted()) mxThrow("User interrupt");
         } // 	while(go > tol){

         if (verbose >= 3){


Don't assume requests only finish one at a time

This reverts the spirit of 11498adc. As seen in #28, this is a bad
assumption that might lead to hangs under certain conditions.

--- src/aur/aur.cc
+++ src/aur/aur.cc
@@ -367,17 +367,19 @@
 }

 int Aur::CheckFinished() {
-  int unused;
-  auto msg = curl_multi_info_read(curl_, &unused);
-  if (msg == nullptr || msg->msg != CURLMSG_DONE) {
-    return 0;
-  }
-
-  auto r = FinishRequest(msg->easy_handle, msg->data.result,
-                         /* dispatch_callback = */ true);
-  if (r < 0) {
-    CancelAll();
-    return r;
+  for (;;) {
+    int unused;
+    auto msg = curl_multi_info_read(curl_, &unused);
+    if (msg == nullptr || msg->msg != CURLMSG_DONE) {
+      break;
+    }
+
+    auto r = FinishRequest(msg->easy_handle, msg->data.result,
+                           /* dispatch_callback = */ true);
+    if (r < 0) {
+      CancelAll();
+      return r;
+    }
   }

   return 0;


minor code cleanups, reduce indentation since 'if' block can't fall through.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@61795 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/Parse/ParseDeclCXX.cpp
+++ lib/Parse/ParseDeclCXX.cpp
@@ -134,20 +134,18 @@

 /// ParseUsingDirectiveOrDeclaration - Parse C++ using using-declaration or
 /// using-directive. Assumes that current token is 'using'.
-Parser::DeclTy *Parser::ParseUsingDirectiveOrDeclaration(unsigned Context)
-{
+Parser::DeclTy *Parser::ParseUsingDirectiveOrDeclaration(unsigned Context) {
   assert(Tok.is(tok::kw_using) && "Not using token");

   // Eat 'using'.
   SourceLocation UsingLoc = ConsumeToken();

-  if (Tok.is(tok::kw_namespace)) {
+  if (Tok.is(tok::kw_namespace))
     // Next token after 'using' is 'namespace' so it must be using-directive
     return ParseUsingDirective(Context, UsingLoc);
-  } else {
-    // Otherwise, it must be using-declaration.
-    return ParseUsingDeclaration(Context, UsingLoc); //FIXME: It is just stub.
-  }
+
+  // Otherwise, it must be using-declaration.
+  return ParseUsingDeclaration(Context, UsingLoc);
 }

 /// ParseUsingDirective - Parse C++ using-directive, assumes


Fix adding buildconfigurations for symbian emualator

Really fixes
Task-Nr: QTCREATORBUG-4649

--- src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
+++ src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
@@ -749,7 +749,7 @@
                                         version,
                                         (version->defaultBuildConfig() | QtVersion::DebugBuild),
                                         QString(), QString());
-    if (id != Constants::S60_EMULATOR_TARGET_ID) {
+    if (qt4Target->id() != Constants::S60_EMULATOR_TARGET_ID) {
         //: Release build configuration. We recommend not translating it.
         bc = qt4Target->addQt4BuildConfiguration(tr("%1 Release").arg(buildConfigurationName),
                                                  version,


Allow DestroyValueInst before addresses are lowered.

--- lib/SIL/SILInstruction.cpp
+++ lib/SIL/SILInstruction.cpp
@@ -864,6 +864,10 @@
   case ValueKind::ReleaseValueInst:
     return true;

+  case ValueKind::DestroyValueInst:
+    assert(!SILModuleConventions(getModule()).useLoweredAddresses());
+    return true;
+
   case ValueKind::UnconditionalCheckedCastAddrInst: {
     // Failing casts with take_always can release.
     auto *Cast = cast<UnconditionalCheckedCastAddrInst>(this);


Remove the redundant namespace closing brace

Summary: Fix the build breaking brace

Test Plan: make check

Reviewers: #bitcoin_abc, deadalnix, dagurval, schancel

Reviewed By: #bitcoin_abc, schancel

Differential Revision: https://reviews.bitcoinabc.org/D684

--- src/base58.cpp
+++ src/base58.cpp
@@ -259,8 +259,6 @@
 }
 } // namespace

-} // namespace
-
 void CBitcoinSecret::SetKey(const CKey &vchSecret) {
     assert(vchSecret.IsValid());
     SetData(Params().Base58Prefix(CChainParams::SECRET_KEY), vchSecret.begin(),


Delete base58.cpp

Delete base58.cpp

--- src/base58.cpp
+++ src/base58.cpp
@@ -1,313 +0,0 @@
-// Copyright (c) 2014 The Bitcoin developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#include "base58.h"
-
-#include "hash.h"
-#include "uint256.h"
-
-#include <assert.h>
-#include <stdint.h>
-#include <string.h>
-#include <vector>
-#include <string>
-#include <boost/variant/apply_visitor.hpp>
-#include <boost/variant/static_visitor.hpp>
-
-/** All alphanumeric characters except for "0", "I", "O", and "l" */
-static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
-
-bool DecodeBase58(const char* psz, std::vector<unsigned char>& vch)
-{
-    // Skip leading spaces.
-    while (*psz && isspace(*psz))
-        psz++;
-    // Skip and count leading '1's.
-    int zeroes = 0;
-    while (*psz == '1') {
-        zeroes++;
-        psz++;
-    }
-    // Allocate enough space in big-endian base256 representation.
-    std::vector<unsigned char> b256(strlen(psz) * 733 / 1000 + 1); // log(58) / log(256), rounded up.
-    // Process the characters.
-    while (*psz && !isspace(*psz)) {
-        // Decode base58 character
-        const char* ch = strchr(pszBase58, *psz);
-        if (ch == NULL)
-            return false;
-        // Apply "b256 = b256 * 58 + ch".
-        int carry = ch - pszBase58;
-        for (std::vector<unsigned char>::reverse_iterator it = b256.rbegin(); it != b256.rend(); it++) {
-            carry += 58 * (*it);
-            *it = carry % 256;
-            carry /= 256;
-        }
-        assert(carry == 0);
-        psz++;
-    }
-    // Skip trailing spaces.
-    while (isspace(*psz))
-        psz++;
-    if (*psz != 0)
-        return false;
-    // Skip leading zeroes in b256.
-    std::vector<unsigned char>::iterator it = b256.begin();
-    while (it != b256.end() && *it == 0)
-        it++;
-    // Copy result into output vector.
-    vch.reserve(zeroes + (b256.end() - it));
-    vch.assign(zeroes, 0x00);
-    while (it != b256.end())
-        vch.push_back(*(it++));
-    return true;
-}
-
-std::string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend)
-{
-    // Skip & count leading zeroes.
-    int zeroes = 0;
-    while (pbegin != pend && *pbegin == 0) {
-        pbegin++;
-        zeroes++;
-    }
-    // Allocate enough space in big-endian base58 representation.
-    std::vector<unsigned char> b58((pend - pbegin) * 138 / 100 + 1); // log(256) / log(58), rounded up.
-    // Process the bytes.
-    while (pbegin != pend) {
-        int carry = *pbegin;
-        // Apply "b58 = b58 * 256 + ch".
-        for (std::vector<unsigned char>::reverse_iterator it = b58.rbegin(); it != b58.rend(); it++) {
-            carry += 256 * (*it);
-            *it = carry % 58;
-            carry /= 58;
-        }
-        assert(carry == 0);
-        pbegin++;
-    }
-    // Skip leading zeroes in base58 result.
-    std::vector<unsigned char>::iterator it = b58.begin();
-    while (it != b58.end() && *it == 0)
-        it++;
-    // Translate the result into a string.
-    std::string str;
-    str.reserve(zeroes + (b58.end() - it));
-    str.assign(zeroes, '1');
-    while (it != b58.end())
-        str += pszBase58[*(it++)];
-    return str;
-}
-
-std::string EncodeBase58(const std::vector<unsigned char>& vch)
-{
-    return EncodeBase58(&vch[0], &vch[0] + vch.size());
-}
-
-bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vchRet)
-{
-    return DecodeBase58(str.c_str(), vchRet);
-}
-
-std::string EncodeBase58Check(const std::vector<unsigned char>& vchIn)
-{
-    // add 4-byte hash check to the end
-    std::vector<unsigned char> vch(vchIn);
-    uint256 hash = Hash(vch.begin(), vch.end());
-    vch.insert(vch.end(), (unsigned char*)&hash, (unsigned char*)&hash + 4);
-    return EncodeBase58(vch);
-}
-
-/*
-bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet)
-{
-    if (!DecodeBase58(psz, vchRet) ||
-        (vchRet.size() < 4)) {
-        vchRet.clear();
-        return false;
-    }
-    // re-calculate the checksum, insure it matches the included 4-byte checksum
-    uint256 hash = Hash(vchRet.begin(), vchRet.end() - 4);
-    if (memcmp(&hash, &vchRet.end()[-4], 4) != 0) {
-        vchRet.clear();
-        return false;
-    }
-    vchRet.resize(vchRet.size() - 4);
-    return true;
-}
-
-bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRet)
-{
-    return DecodeBase58Check(str.c_str(), vchRet);
-}
-*/
-
-CBase58Data::CBase58Data()
-{
-    vchVersion.clear();
-    vchData.clear();
-}
-
-void CBase58Data::SetData(const std::vector<unsigned char>& vchVersionIn, const void* pdata, size_t nSize)
-{
-    vchVersion = vchVersionIn;
-    vchData.resize(nSize);
-    if (!vchData.empty())
-        memcpy(&vchData[0], pdata, nSize);
-}
-
-void CBase58Data::SetData(const std::vector<unsigned char>& vchVersionIn, const unsigned char* pbegin, const unsigned char* pend)
-{
-    SetData(vchVersionIn, (void*)pbegin, pend - pbegin);
-}
-
-bool CBase58Data::SetString(const char* psz, unsigned int nVersionBytes)
-{
-    std::vector<unsigned char> vchTemp;
-    bool rc58 = DecodeBase58Check(psz, vchTemp);
-    if ((!rc58) || (vchTemp.size() < nVersionBytes)) {
-        vchData.clear();
-        vchVersion.clear();
-        return false;
-    }
-    vchVersion.assign(vchTemp.begin(), vchTemp.begin() + nVersionBytes);
-    vchData.resize(vchTemp.size() - nVersionBytes);
-    if (!vchData.empty())
-        memcpy(&vchData[0], &vchTemp[nVersionBytes], vchData.size());
-    OPENSSL_cleanse(&vchTemp[0], vchData.size());
-    return true;
-}
-
-bool CBase58Data::SetString(const std::string& str)
-{
-    return SetString(str.c_str());
-}
-
-std::string CBase58Data::ToString() const
-{
-    std::vector<unsigned char> vch = vchVersion;
-    vch.insert(vch.end(), vchData.begin(), vchData.end());
-    return EncodeBase58Check(vch);
-}
-
-int CBase58Data::CompareTo(const CBase58Data& b58) const
-{
-    if (vchVersion < b58.vchVersion)
-        return -1;
-    if (vchVersion > b58.vchVersion)
-        return 1;
-    if (vchData < b58.vchData)
-        return -1;
-    if (vchData > b58.vchData)
-        return 1;
-    return 0;
-}
-
-namespace
-{
-class CBitcoinAddressVisitor : public boost::static_visitor<bool>
-{
-private:
-    CBitcoinAddress* addr;
-
-public:
-    CBitcoinAddressVisitor(CBitcoinAddress* addrIn) : addr(addrIn) {}
-
-    bool operator()(const CKeyID& id) const { return addr->Set(id); }
-    bool operator()(const CScriptID& id) const { return addr->Set(id); }
-    bool operator()(const CNoDestination& no) const { return false; }
-};
-
-} // anon namespace
-
-bool CBitcoinAddress::Set(const CKeyID& id)
-{
-    SetData(Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS), &id, 20);
-    return true;
-}
-
-bool CBitcoinAddress::Set(const CScriptID& id)
-{
-    SetData(Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS), &id, 20);
-    return true;
-}
-
-bool CBitcoinAddress::Set(const CTxDestination& dest)
-{
-    return boost::apply_visitor(CBitcoinAddressVisitor(this), dest);
-}
-
-bool CBitcoinAddress::IsValid() const
-{
-    return IsValid(Params());
-}
-
-bool CBitcoinAddress::IsValid(const CChainParams& params) const
-{
-    bool fCorrectSize = vchData.size() == 20;
-    bool fKnownVersion = vchVersion == params.Base58Prefix(CChainParams::PUBKEY_ADDRESS) ||
-                         vchVersion == params.Base58Prefix(CChainParams::SCRIPT_ADDRESS);
-    return fCorrectSize && fKnownVersion;
-}
-
-CTxDestination CBitcoinAddress::Get() const
-{
-    if (!IsValid())
-        return CNoDestination();
-    uint160 id;
-    memcpy(&id, &vchData[0], 20);
-    if (vchVersion == Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS))
-        return CKeyID(id);
-    else if (vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS))
-        return CScriptID(id);
-    else
-        return CNoDestination();
-}
-
-bool CBitcoinAddress::GetKeyID(CKeyID& keyID) const
-{
-    if (!IsValid() || vchVersion != Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS))
-        return false;
-    uint160 id;
-    memcpy(&id, &vchData[0], 20);
-    keyID = CKeyID(id);
-    return true;
-}
-
-bool CBitcoinAddress::IsScript() const
-{
-    return IsValid() && vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS);
-}
-
-void CBitcoinSecret::SetKey(const CKey& vchSecret)
-{
-    assert(vchSecret.IsValid());
-    SetData(Params().Base58Prefix(CChainParams::SECRET_KEY), vchSecret.begin(), vchSecret.size());
-    if (vchSecret.IsCompressed())
-        vchData.push_back(1);
-}
-
-CKey CBitcoinSecret::GetKey()
-{
-    CKey ret;
-    assert(vchData.size() >= 32);
-    ret.Set(vchData.begin(), vchData.begin() + 32, vchData.size() > 32 && vchData[32] == 1);
-    return ret;
-}
-
-bool CBitcoinSecret::IsValid() const
-{
-    bool fExpectedFormat = vchData.size() == 32 || (vchData.size() == 33 && vchData[32] == 1);
-    bool fCorrectVersion = vchVersion == Params().Base58Prefix(CChainParams::SECRET_KEY);
-    return fExpectedFormat && fCorrectVersion;
-}
-
-bool CBitcoinSecret::SetString(const char* pszSecret)
-{
-    return CBase58Data::SetString(pszSecret) && IsValid();
-}
-
-bool CBitcoinSecret::SetString(const std::string& strSecret)
-{
-    return SetString(strSecret.c_str());
-}


One more signed vs unsigned fix

One more signed vs unsigned fix

--- src/simplifier/constantBitP/ConstantBitP_Arithmetic.cpp
+++ src/simplifier/constantBitP/ConstantBitP_Arithmetic.cpp
@@ -102,7 +102,7 @@
 	assert(inflowMin <= inflowMax);
 	assert(inflowMin >=0);
 	assert(index >=0);
-	assert(index < children[0]->getWidth());
+	assert(index < (int)children[0]->getWidth());

 	const int maxCarryIn = maximumCarryInForAddition(children.size(), index);


less vertical space wasted in ui

less vertical space wasted in ui

--- src/editor/studio_app.cpp
+++ src/editor/studio_app.cpp
@@ -1431,7 +1431,7 @@
 		io.KeyMap[ImGuiKey_Z] = SDLK_z;

 		ImGuiStyle& style = ImGui::GetStyle();
-		style.FramePadding.y = 2;
+		style.FramePadding.y = 0;
 		style.ItemSpacing.y = 2;
 		style.ItemInnerSpacing.x = 2;
 	}


Added possibility to query memory on Windows without WMI

--- src/systemcapabilities/generalcapabilitiescomponent.cpp
+++ src/systemcapabilities/generalcapabilitiescomponent.cpp
@@ -230,6 +230,13 @@
         convert >> value;
         _installedMainMemory = static_cast<unsigned int>((value / 1024) / 1024);
     }
+#else
+	ULONGLONG installedMainMemory;
+	// get installed memory in kB
+	BOOL success = GetPhysicallyInstalledSystemMemory(&installedMainMemory);
+	if (success == TRUE) {
+		_installedMainMemory = static_cast<unsigned int>(installedMainMemory / 1024);
+	}
 #endif
 #elif defined(__APPLE__)


print getresult instruction.

print getresult instruction.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@47461 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/VMCore/Instruction.cpp
+++ lib/VMCore/Instruction.cpp
@@ -138,6 +138,7 @@
   case ExtractElement: return "extractelement";
   case InsertElement:  return "insertelement";
   case ShuffleVector:  return "shufflevector";
+  case GetResult:      return "getresult";

   default: return "<Invalid operator> ";
   }


remove these methods.

remove these methods.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@20474 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/VMCore/SymbolTable.cpp
+++ lib/VMCore/SymbolTable.cpp
@@ -290,48 +290,6 @@
 #endif
   }
 }
-
-
-// Determine how many entries for a given type.
-unsigned SymbolTable::type_size(const Type *Ty) const {
-  plane_const_iterator PI = pmap.find(Ty);
-  if ( PI == pmap.end() ) return 0;
-  return PI->second.size();
-}
-
-
-// Get the name of a value
-std::string SymbolTable::get_name( const Value* V ) const {
-  value_const_iterator VI = this->value_begin( V->getType() );
-  value_const_iterator VE = this->value_end( V->getType() );
-
-  // Search for the entry
-  while ( VI != VE && VI->second != V )
-    ++VI;
-
-  if ( VI != VE )
-    return VI->first;
-
-  return "";
-}
-
-
-// Get the name of a type
-std::string SymbolTable::get_name(const Type* T) const {
-  if (tmap.empty()) return ""; // No types at all.
-
-  type_const_iterator TI = tmap.begin();
-  type_const_iterator TE = tmap.end();
-
-  // Search for the entry
-  while (TI != TE && TI->second != T )
-    ++TI;
-
-  if (TI != TE)  // Must have found an entry!
-    return TI->first;
-  return "";     // Must not have found anything...
-}
-

 // Strip the symbol table of its names.
 bool SymbolTable::strip() {


Fix logic

Fix logic

--- src/bigint.cpp
+++ src/bigint.cpp
@@ -1685,16 +1685,11 @@
     }

     if (x->digit_count == 1) {
-        if (x->is_negative) {
-            if (x->data.digit != 0) {
-                x->data.digit -= 1;
-            }
+        if (x->is_negative && x->data.digit != 0) {
+            x->data.digit -= 1;
             return;
-        }
-        else {
-            if (x->data.digit != UINT64_MAX) {
-                x->data.digit += 1;
-            }
+        } else if (!x->is_negative && x->data.digit != UINT64_MAX) {
+            x->data.digit += 1;
             return;
         }
     }


rename the argument to SELECT_POCKET() to be more clear

--- src/emc/nml_intf/canon.hh
+++ src/emc/nml_intf/canon.hh
@@ -541,7 +541,7 @@
 before the change_tool command, and the value of slot must be the slot
 number of the selected tool. */

-extern void SELECT_POCKET(int i);	/* i is slot number */
+extern void SELECT_POCKET(int pocket);

 extern void CHANGE_TOOL_NUMBER(int number);


since 7 years 8 months ago there are better ways to monitor this morsel of status

--- src/emc/usr_intf/emcsh.cc
+++ src/emc/usr_intf/emcsh.cc
@@ -3127,11 +3127,6 @@
     Tcl_SetObjResult(interp,
 		     Tcl_NewIntObj(emcStatus->motion.traj.mode ==
 				   EMC_TRAJ_MODE_TELEOP));
-    /*! \todo FIXME */
-    if (EMC_DEBUG & EMC_DEBUG_TRAJ) {
-	printf("emcStatus->motion.traj.mode = %d\n",
-	       emcStatus->motion.traj.mode);
-    }
     return TCL_OK;
 }

@@ -3147,11 +3142,6 @@
     Tcl_SetObjResult(interp,
 		     Tcl_NewIntObj(emcStatus->motion.traj.
 				   kinematics_type));
-    /*! \todo FIXME */
-    if (EMC_DEBUG & EMC_DEBUG_TRAJ) {
-	printf("emcStatus->motion.traj.mode = %d\n",
-	       emcStatus->motion.traj.mode);
-    }
     return TCL_OK;
 }


Fix for attribute checking of schema declarations.

git-svn-id: 3ec853389310512053d525963cab269c063bb453@174640 13f79535-47bb-0310-9956-ffa450edef68

--- src/xercesc/validators/schema/GeneralAttributeCheck.cpp
+++ src/xercesc/validators/schema/GeneralAttributeCheck.cpp
@@ -56,6 +56,9 @@

 /*
  * $Log$
+ * Revision 1.12  2003/01/17 15:35:57  knoaman
+ * Fix for attribute checking of schema declarations.
+ *
  * Revision 1.11  2003/01/15 18:33:11  knoaman
  * Make sure that the namespace of schema declarations is the schema namespace.
  *
@@ -426,15 +429,17 @@
             continue;
         }

-        const XMLCh* attrVal = attribute->getNodeValue();
-
         if (fgElemAttTable[elemContext][attNameId] & Att_Mask) {

             attList[attNameId] = 1;
-
-            if (attrVal && *attrVal) {
-                validate(elem, attName, attrVal, fgElemAttTable[elemContext][attNameId] & DV_Mask, schema);
-            }
+            validate
+            (
+                elem
+                , attName
+                , attribute->getNodeValue()
+                , fgElemAttTable[elemContext][attNameId] & DV_Mask
+                , schema
+            );
         }
         else {
             schema->reportSchemaError(elem, XMLUni::fgXMLErrDomain,


INTEGRATION: CWS vgbugs07 (1.21.354); FILE MERGED 2007/06/04 13:26:09 vg 1.21.354.1: #i76605# Remove -I .../inc/module hack introduced by hedaburemove01

--- svx/source/accessibility/svxrectctaccessiblecontext.cxx
+++ svx/source/accessibility/svxrectctaccessiblecontext.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: svxrectctaccessiblecontext.cxx,v $
  *
- *  $Revision: 1.21 $
+ *  $Revision: 1.22 $
  *
- *  last change: $Author: obo $ $Date: 2006-09-17 04:05:54 $
+ *  last change: $Author: hr $ $Date: 2007-06-27 16:42:32 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -88,12 +88,12 @@
 #include <tools/gen.hxx>
 #endif

-#include "dialogs.hrc"
+#include <svx/dialogs.hrc>
 #include "accessibility.hrc"
-#include "dlgctrl.hxx"
+#include <svx/dlgctrl.hxx>

 #ifndef _SVX_DIALMGR_HXX
-#include <dialmgr.hxx>
+#include <svx/dialmgr.hxx>
 #endif
 #ifndef COMPHELPER_ACCESSIBLE_EVENT_NOTIFIER
 #include <comphelper/accessibleeventnotifier.hxx>


WaE: 0x80000000 -> MIN_INT32

WaE: 0x80000000 -> MIN_INT32

Change-Id: Ifc892a5c0e436cce345a329bcef10b875eeb839f

--- svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
+++ svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
@@ -6465,7 +6465,7 @@
 static const SvxMSDffHandle mso_sptTextRingInsideHandle[] =
 {
     {   MSDFF_HANDLE_FLAGS_RANGE| MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL,
-        10800, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 10800, 21600 }
+        10800, 0x100, 10800, 10800, MIN_INT32, 0x7fffffff, 10800, 21600 }
 };
 static const mso_CustomShape msoTextRingInside =
 {
@@ -6475,7 +6475,7 @@
     (sal_Int32*)mso_sptDefault13500,
     (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
     21600, 21600,
-    0x80000000, 0x80000000,
+    MIN_INT32, MIN_INT32,
     NULL, 0,
     (SvxMSDffHandle*)mso_sptTextRingInsideHandle, sizeof( mso_sptTextRingInsideHandle ) / sizeof( SvxMSDffHandle )
 };


Use shader for saveCorePNG.

Use shader for saveCorePNG.

git-svn-id: 1d207c470b2136084517b1b032773f9117bf89a1@555 27a91dd4-ec73-4ff0-838b-64dfa05f697e

--- source/Engine/backdrop.cpp
+++ source/Engine/backdrop.cpp
@@ -1483,8 +1483,15 @@
 				-xoffset, -yoffset+th, 0,
 				tw-xoffset, -yoffset+th, 0
 			};
+
+			glUseProgram(shader.texture);
+			setPMVMatrix(shader.texture);
+			glUniform1i(glGetUniformLocation(shader.texture, "zBuffer"), 0);
+
 fprintf(stdout, "QUAD: saveCorePng\n");
-			drawTexturedQuad(vertices, texCoords);
+			drawTexturedQuadNew(shader.texture, vertices, 1, texCoords);
+
+			glUseProgram(0);

 			for (int i = 0; i<h; i++)	{
 				glReadPixels(viewportOffsetX, viewportOffsetY+i, w, 1, GL_RGBA, GL_UNSIGNED_BYTE, image+xoffset*4+(yoffset+i)*4*tw);


*** empty log message ***

*** empty log message ***

--- source/KERNEL/nucleotide.C
+++ source/KERNEL/nucleotide.C
@@ -1,4 +1,4 @@
-// $Id: nucleotide.C,v 1.3 2000/05/10 18:54:30 amoll Exp $
+// $Id: nucleotide.C,v 1.4 2000/05/15 16:01:01 amoll Exp $

 #include <BALL/KERNEL/nucleotide.h>

@@ -184,21 +184,44 @@

 	bool Nucleotide::isTerminal() const
 	{
-		// BAUSTELLE
+		const NucleicAcid* parent = (*this).getNucleicAcid();
+		/*if (parent != 0)
+		{
+			if (parent->get3Prime() == this ||
+					parent->get5Prime() == this)
+			{
+				return true;
+			}
+		}*/
 		return false;
 	}

 	bool Nucleotide::is5Prime() const
 	{
-		// BAUSTELLE
+		const NucleicAcid* parent = getNucleicAcid();
+		if (parent != 0)
+		{
+			if (parent->get5Prime() == this)
+			{
+				return true;
+			}
+		}
 		return false;
 	}

 	bool Nucleotide::is3Prime() const
 	{
+		const NucleicAcid* parent = getNucleicAcid();
+		if (parent != 0)
+		{
+			if (parent->get3Prime() == this)
+			{
+				return true;
+			}
+		}
 		return false;
 	}
-
+
 	bool Nucleotide::isValid() const
 	{
 		if (Fragment::isValid() == false


fixed: copy&paste error led to uninitialized variables


Fix memory leak if a node evaluation fails due to a divide by zero exception.

PiperOrigin-RevId: 169644909

--- tensorflow/core/grappler/optimizers/constant_folding.cc
+++ tensorflow/core/grappler/optimizers/constant_folding.cc
@@ -414,9 +414,15 @@
 Status ConstantFolding::EvaluateOneFoldable(const NodeDef& node,
                                             std::vector<NodeDef>* outputs) {
   TensorVector inputs;
-  auto inputs_cleanup = gtl::MakeCleanup([&inputs] {
+  TensorVector output_tensors;
+  auto inputs_cleanup = gtl::MakeCleanup([&inputs, &output_tensors] {
     for (const auto& input : inputs) {
       delete input.tensor;
+    }
+    for (const auto& output : output_tensors) {
+      if (output.tensor) {
+        delete output.tensor;
+      }
     }
   });

@@ -439,7 +445,6 @@
     inputs.emplace_back(value);
   }

-  TensorVector output_tensors;
   TF_RETURN_IF_ERROR(EvaluateNode(node, inputs, &output_tensors));
   if (output_tensors.empty()) {
     return Status(error::INVALID_ARGUMENT, "Expected at least one output.");
@@ -452,7 +457,6 @@
     }
     if (output_tensors[i].tensor) {
       outputs->push_back(CreateNodeDef(node_name, output_tensors[i]));
-      delete output_tensors[i].tensor;
     } else {
       // Create an empty NodeDef to identify dead outputs (e.g. the output of a
       // switch that's not selected by the switch predicate).


Adds accessor to executor thread handle.

--- src/executor/Executor.hxx
+++ src/executor/Executor.hxx
@@ -123,6 +123,8 @@

     virtual bool empty() = 0;

+    os_thread_t thread_handle() { return OSThread::get_handle(); }
+
 protected:
     /** Thread entry point.
      * @return Should never return


add more check statements in test case t_MerchantScoreManager

--- test/mining-manager/MerchantScoreManagerTestFixture.cpp
+++ test/mining-manager/MerchantScoreManagerTestFixture.cpp
@@ -382,6 +382,14 @@
     insertCategoryId_(subNode);
     checkIdScoreClose_(merchant, subNode, 9.8);

+    subNode = "手机数码 手机通讯 手机配件";
+    insertCategoryId_(subNode);
+    checkIdScoreClose_(merchant, subNode, 8.8);
+
+    subNode = "手机数码 配件";
+    insertCategoryId_(subNode);
+    checkIdScoreClose_(merchant, subNode, 7.8);
+
     merchant = "一号店";
     checkIdScoreEqual_(merchant, "", 0);
     checkIdScoreEqual_(merchant, "食品", 8);


Fix compiler warning for self assignment (#206)

See this discussion https://reviews.llvm.org/D45766#1097736

--- test/unit/core/container/parallel_resize_vector_test.cc
+++ test/unit/core/container/parallel_resize_vector_test.cc
@@ -136,7 +136,7 @@
   EXPECT_EQ(0u, v.capacity());

   v.resize(17576, 123);
-  v = v;
+  v = static_cast<ParallelResizeVector<int>&>(v);

   EXPECT_EQ(17576u, v.size());
   EXPECT_EQ(17576u, v.capacity());


fix case

fix case

--- src/firmware/OpenDeck.cpp
+++ src/firmware/OpenDeck.cpp
@@ -477,6 +477,7 @@

             switch(messageType)
             {
+                case midiMessageSystemExclusive:
                 sysEx.handleMessage(midi.getSysExArray(dinInterface), midi.getSysExArrayLength(dinInterface));
                 break;


flushing fix

flushing fix

--- src/fmitcp/src/common.cpp
+++ src/fmitcp/src/common.cpp
@@ -9,7 +9,7 @@
     lw_stream_write(c, s.c_str(), s.size());
     std::string newline = "\n";
     lw_stream_write(c, newline.c_str(),newline.size());
-    //fflush(NULL);
+    fflush(NULL);
 }

 std::string fmitcp::dataToString(const char* data, long size) {


fix nonsensical errors when no interfaces are currently available (possibly due to insufficient privileges)

--- src/binding.cc
+++ src/binding.cc
@@ -465,7 +465,7 @@
   HandleScope scope;

   char errbuf[PCAP_ERRBUF_SIZE];
-  pcap_if_t *alldevs, *cur_dev;
+  pcap_if_t *alldevs = NULL, *cur_dev;
   pcap_addr_t *cur_addr;
   int i, j, af;

@@ -474,8 +474,8 @@
   Local<Array> DevsArray;
   Local<Array> AddrArray;

-  if (pcap_findalldevs(&alldevs, errbuf) == -1 || alldevs == NULL)
-    return ThrowException(Exception::TypeError(String::New(errbuf)));
+  if (pcap_findalldevs(&alldevs, errbuf) == -1)
+    return ThrowException(Exception::Error(String::New(errbuf)));

   DevsArray = Array::New();

@@ -513,7 +513,8 @@
     DevsArray->Set(Integer::New(i), Dev);
   }

-  pcap_freealldevs(alldevs);
+  if (alldevs)
+    pcap_freealldevs(alldevs);

   return scope.Close(DevsArray);
 }
@@ -526,7 +527,7 @@
   char name4[INET_ADDRSTRLEN];
   char name6[INET6_ADDRSTRLEN];
   char *ip = NULL;
-  pcap_if_t *alldevs, *dev;
+  pcap_if_t *alldevs = NULL, *dev;
   pcap_addr_t *addr;
   bool found = false;

@@ -541,7 +542,7 @@
     strcpy(ip, *ipstr);
   }

-  if (pcap_findalldevs(&alldevs, errbuf) == -1 || alldevs == NULL)
+  if (pcap_findalldevs(&alldevs, errbuf) == -1)
     return ThrowException(Exception::Error(String::New(errbuf)));

   for (dev = alldevs; dev != NULL; dev = dev->next) {
@@ -574,7 +575,8 @@
     }
   }

-  pcap_freealldevs(alldevs);
+  if (alldevs)
+    pcap_freealldevs(alldevs);
   if (ip)
     free(ip);
   return scope.Close(ret);


src: use 200 as default statusCode for answer()

--- src/binding.cc
+++ src/binding.cc
@@ -262,7 +262,8 @@
       prm.statusCode = static_cast<pjsip_status_code>(args[0]->Int32Value());
       if (args.Length() > 1 && args[1]->IsString())
         prm.reason = string(*String::Utf8Value(args[1]->ToString()));
-    }
+    } else
+      prm.statusCode = PJSIP_SC_OK;

     try {
       call->answer(prm);


Cleanup

Cleanup

--- src/budget.cpp
+++ src/budget.cpp
@@ -15,6 +15,7 @@

 int main(int argc, const char* argv[]) {
     if(argc == 1){
+        //TODO In the future, display the default module
         std::cout << "A command is necessary" << std::endl;

         return 1;
@@ -31,7 +32,7 @@
     } else if(command == "debt"){
         return handle_debts(args);
     } else {
-        std::cout << "Invalid command \"" << command << "\"" << std::endl;
+        std::cout << "Unhandled command \"" << command << "\"" << std::endl;

         return 1;
     }


return early when nothing to render

return early when nothing to render

--- src/gui/gl/shrenderer.cpp
+++ src/gui/gl/shrenderer.cpp
@@ -147,7 +147,7 @@
     bool minmaxScaling = m_dataset->getProperty( "minmaxScaling" ).toBool();

     QString s = createSettingsString( xi, yi, zi, lod, orient, lowerX, upperX, lowerY, upperY, lowerZ, upperZ, minmaxScaling);
-    if ( s == m_previousSettings )
+    if ( s == m_previousSettings || orient == 0 )
     {
         return;
     }


Use Lua ref func rather than index.

Use Lua ref func rather than index.

Same results.

--- examples/tables/tables.cpp
+++ examples/tables/tables.cpp
@@ -44,10 +44,9 @@
 {
     lua_newtable( L );

-    int index = 1;
     for( auto ap = list.begin(); ap != list.end(); ap++ ) {
         MyActorBinding::push( L, *ap );
-        lua_rawseti( L, -2, index++ );
+        luaL_ref( L, -2 );
     }
 }

@@ -87,6 +86,8 @@
         pushToLua( L, actors );
         lua_setglobal( L, "actors" );
     }
+
+    run( L, "for k,v in pairs(actors) do print( k, v.name ) end" );

     cout << "Editing actor list..." << endl;
     run( L, "actors[2] = nil                    -- Who is this? Pfft, delete." );


missed a reference to setClockFrequency

missed a reference to setClockFrequency

--- examples/testmm/testmm.cpp
+++ examples/testmm/testmm.cpp
@@ -122,7 +122,7 @@

   long req_freq = 100000000;
   long freq = 0;
-  poller->setClockFrequency(0, req_freq, &freq);
+  setClockFrequency(0, req_freq, &freq);
   fprintf(stderr, "Requested FCLK[0]=%d actually %d\n", req_freq, freq);

   matAllocator = new PortalMatAllocator(dmap, dma);


fix spark core support

fix spark core support

core doesn’t have mutex

--- firmware/ADXL362DMA.cpp
+++ firmware/ADXL362DMA.cpp
@@ -9,7 +9,12 @@
 // Data Sheet:
 // http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL362.pdf

+#if PLATFORM_ID != 0
 static Mutex syncCallbackMutex;
+#else
+#define NO_MUTEX 1
+static bool syncCallbackDone;
+#endif

 static ADXL362Data *readFifoData;
 static ADXL362DMA *readFifoObject;
@@ -338,6 +343,7 @@
 }

 void ADXL362DMA::syncTransaction(void *req, void *resp, size_t len) {
+#ifndef NO_MUTEX
 	syncCallbackMutex.lock();

 	beginTransaction();
@@ -348,11 +354,26 @@
 	endTransaction();

 	syncCallbackMutex.unlock();
+#else
+	syncCallbackDone = false;
+	beginTransaction();
+
+	spi.transfer(req, resp, len, syncCallback);
+
+	while(!syncCallbackDone) {
+	}
+
+	endTransaction();
+#endif
 }

 // [static]
 void ADXL362DMA::syncCallback(void) {
+#ifndef NO_MUTEX
 	syncCallbackMutex.unlock();
+#else
+	syncCallbackDone = true;
+#endif
 }

 ADXL362Data::ADXL362Data() {


update description about the issue.

update description about the issue.

--- windowCloseError.cpp
+++ windowCloseError.cpp
@@ -5,12 +5,8 @@
 #pragma comment(lib, "Release/ace_engine.lib")
 #endif
 /*
-e: EBhEIɃG[
-
-錴:
-O[oϐɃeNX`ȂǂāAEngine::Terminate()Ă΂ꂽƂ
-\[XNƃG[ɂȂB
-
+e:
+O[öɃeNX`ƁAvOIɃG[ɂȂ
 */

@@ -45,9 +41,9 @@

 int main() {
 	EngineProvider engineProvider;
+	auto tex = Engine::GetGraphics()->CreateTexture2D(ToAString("img.png").c_str());;
 	ImgManager::init();
 	while(Engine::DoEvents()) {

 	}
-
 }


Backend: Refine GenRegiter::offset

Backend: Refine GenRegiter::offset

Convert the subnr into nr if the subnr is bigger than 32, this will make
offset usage universally.

Signed-off-by: Pan Xiuli <e5a665b1e626c5dc0826076a8b5a209eb48bf6ee@intel.com>
Reviewed-by: Yang Rong <78759e37dc7114caed18f74e7515c5cb519dbf6d@intel.com>

--- backend/src/backend/gen_register.hpp
+++ backend/src/backend/gen_register.hpp
@@ -268,6 +268,10 @@

     static INLINE GenRegister offset(GenRegister reg, int nr, int subnr = 0) {
       GenRegister r = reg;
+      if(subnr >= 32){
+        nr += subnr / 32;
+        subnr = subnr % 32;
+      }
       r.nr += nr;
       r.subnr += subnr;
       r.subphysical = 1;


Minor optimization in skyline_lu::factorize()

--- amgcl/solver/skyline_lu.hpp
+++ amgcl/solver/skyline_lu.hpp
@@ -345,11 +345,12 @@
          */
         void factorize() {
             precondition(!math::is_zero(D[0]), "Zero diagonal in skyline_lu");
+            D[0] = math::inverse(D[0]);

             for(int k = 0; k < n - 1; ++k) {
                 // check whether A(1,k+1) lies within the skyline structure
                 if (ptr[k + 1] + k + 1 == ptr[k + 2]) {
-                    U[ptr[k+1]] = math::inverse(D[0]) * U[ptr[k+1]];
+                    U[ptr[k+1]] = D[0] * U[ptr[k+1]];
                 }

                 // Compute column k+1 of U
@@ -369,7 +370,7 @@
                     for(int j = jBeginMult; j < i; ++j, ++indexL, ++indexU)
                         sum -= L[indexL] * U[indexU];

-                    U[indexEntry] = math::inverse(D[i]) * sum;
+                    U[indexEntry] = D[i] * sum;
                 }

                 // Compute row k+1 of L
@@ -394,18 +395,15 @@
                 }

                 // Find element in diagonal
-                value_type sum = D[k + 1];
+                value_type sum = D[k+1];
                 for(int j = ptr[k+1]; j < ptr[k+2]; ++j)
                     sum -= L[j] * U[j];

                 precondition(!math::is_zero(sum),
                         "Zero sum in skyline_lu factorization");

-                D[k+1] = sum;
-            }
-
-            // Invert diagonal
-            for(int i = 0; i < n; ++i) D[i] = math::inverse(D[i]);
+                D[k+1] = math::inverse(sum);
+            }
         }
 };


drop mystrdp here

drop mystrdp here

--- src/hunspell/affixmgr.cxx
+++ src/hunspell/affixmgr.cxx
@@ -3133,7 +3133,7 @@
     return std::string();

   if (morphcmp(morph, targetmorph) == 0)
-    return mystrdup(ts);
+    return ts;

   size_t stemmorphcatpos;
   std::string mymorph;


Dot file generation can now be invoked using the -V option to the parent. We now require an input file. If standard in is used then we don't have a file name on which to base the output.

--- ragel/main.cpp
+++ ragel/main.cpp
@@ -70,6 +70,7 @@

 bool printStatistics = false;
 bool frontendOnly = false;
+bool generateDot = false;

 typedef Vector<char*> ArgsVector;
 ArgsVector frontendArgs;
@@ -90,7 +91,9 @@
 "   -m                   Minimize at the end of the compilation\n"
 "   -l                   Minimize after most operations (default)\n"
 "   -e                   Minimize after every operation\n"
-"machine selection:\n"
+"visualization:\n"
+"   -V                   Generate a dot file for Graphviz\n"
+"   -p                   Display printable characters on labels\n"
 "   -S <spec>            FSM specification to output (for rlgen-dot)\n"
 "   -M <machine>         Machine definition/instantiation to output (for rlgen-dot)\n"
 "host language:\n"
@@ -98,6 +101,18 @@
 "   -D                   The host language is D\n"
 "   -J                   The host language is Java\n"
 "   -R                   The host language is Ruby\n"
+"line direcives: (C/D only)\n"
+"   -L                   Inhibit writing of #line directives\n"
+"code style: (C/Ruby only)\n"
+"   -T0                  Table driven FSM (default)\n"
+"   -T1                  Faster table driven FSM\n"
+"   -F0                  Flat table driven FSM\n"
+"   -F1                  Faster flat table-driven FSM\n"
+"code style: (C only)\n"
+"   -G0                  Goto-driven FSM\n"
+"   -G1                  Faster goto-driven FSM\n"
+"   -G2                  Really fast goto-driven FSM\n"
+"   -P<N>                N-Way Split really fast goto-driven FSM\n"
 	;
 }

@@ -148,12 +163,16 @@

 void processArgs( int argc, char **argv, char *&inputFileName, char *&outputFileName )
 {
-	ParamCheck pc("fo:nmleabjkS:M:CDJRvHh?-:sT:F:G:P:Lp", argc, argv);
+	ParamCheck pc("fo:nmleabjkS:M:CDJRvHh?-:sT:F:G:P:LpV", argc, argv);

 	while ( pc.check() ) {
 		switch ( pc.state ) {
 		case ParamCheck::match:
 			switch ( pc.parameter ) {
+			case 'V':
+				generateDot = true;
+				break;
+
 			case 'f':
 				frontendOnly = true;
 				break;
@@ -323,18 +342,11 @@
 int frontend( char *inputFileName, char *outputFileName )
 {
 	/* Open the input file for reading. */
-	istream *inStream;
-	if ( inputFileName != 0 ) {
-		/* Open the input file for reading. */
-		ifstream *inFile = new ifstream( inputFileName );
-		inStream = inFile;
-		if ( ! inFile->is_open() )
-			error() << "could not open " << inputFileName << " for reading" << endp;
-	}
-	else {
-		inputFileName = "<stdin>";
-		inStream = &cin;
-	}
+	assert( inputFileName != 0 );
+	ifstream *inFile = new ifstream( inputFileName );
+	istream *inStream = inFile;
+	if ( ! inFile->is_open() )
+		error() << "could not open " << inputFileName << " for reading" << endp;

 	/* Used for just a few things. */
 	std::ostringstream hostData;
@@ -608,17 +620,21 @@
 {
 	/* Locate the backend program */
 	char *progName = 0;
-	switch ( hostLang->lang ) {
-		case HostLang::C:
-		case HostLang::D:
-			progName = "rlgen-cd";
-			break;
-		case HostLang::Java:
-			progName = "rlgen-java";
-			break;
-		case HostLang::Ruby:
-			progName = "rlgen-ruby";
-			break;
+	if ( generateDot )
+		progName = "rlgen-dot";
+	else {
+		switch ( hostLang->lang ) {
+			case HostLang::C:
+			case HostLang::D:
+				progName = "rlgen-cd";
+				break;
+			case HostLang::Java:
+				progName = "rlgen-java";
+				break;
+			case HostLang::Ruby:
+				progName = "rlgen-ruby";
+				break;
+		}
 	}

 	backendArgs.insert( 0, progName );
@@ -646,7 +662,12 @@

 	processArgs( argc, argv, inputFileName, outputFileName );

-	/* Bail on above errors. */
+	/* Require an input file. If we use standard in then we won't have a file
+	 * name on which to base the output. */
+	if ( inputFileName == 0 )
+		error() << "no input file given" << endl;
+
+	/* Bail on argument processing errors. */
 	if ( gblErrorCount > 0 )
 		exit(1);


Uniformize spacing between functions.

Uniformize spacing between functions.

    * src/runner/interpreter-visit.hxx: Here.

--- src/runner/interpreter-visit.hxx
+++ src/runner/interpreter-visit.hxx
@@ -45,6 +45,7 @@
   using boost::bind;
   using libport::Finally;

+
   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::And* e)
   {
@@ -76,6 +77,7 @@
     return object::void_class;
   }

+
   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::Assignment* e)
   {
@@ -83,6 +85,7 @@
     stacks_.set(e, val);
     return val;
   }
+

   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::Call* e)
@@ -93,6 +96,7 @@
     return apply(tgt, e->name_get(), e->arguments_get(), e->location_get());
   }

+
   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::CallMsg*)
   {
@@ -108,11 +112,13 @@
     return val;
   }

+
   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::Float* e)
   {
     return new object::Float(e->value_get());
   }
+

   LIBPORT_SPEED_INLINE object::rObject Interpreter::visit(const ast::Routine* e, bool closure)
   {
@@ -136,11 +142,13 @@
     return res;
   }

+
   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::Function* e)
   {
     return visit(e, false);
   }
+

   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::Closure* e)
@@ -190,6 +198,7 @@
     //ECHO ("result: " << *result_);
   }

+
   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::Lazy* e)
   {
@@ -211,6 +220,7 @@
     else
       return value;
   }
+

   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::Message* e)
@@ -332,6 +342,7 @@
     return res;
   }

+
   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::Noop*)
   {
@@ -350,6 +361,7 @@
     JAECHO ("rhs", e->rhs_get ());
     return operator() (e->rhs_get().get());
   }
+

   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::Scope* e)
@@ -361,6 +373,7 @@
     return operator()(e->body_get().get());
   }

+
   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::Do* e)
   {
@@ -377,6 +390,7 @@
     return tgt;
   }

+
   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::Stmt* e)
   {
@@ -384,17 +398,20 @@
     return operator()(e->expression_get().get());
   }

+
   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::String* e)
   {
     return new object::String(libport::Symbol(e->value_get()));
   }

+
   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::Tag* t)
   {
     return eval_tag(t->exp_get());
   }
+

   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::TaggedStmt* t)
@@ -439,11 +456,13 @@
     }
   }

+
   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::This*)
   {
     return stacks_.self();
   }
+

   LIBPORT_SPEED_INLINE object::rObject
   Interpreter::visit(const ast::While* e)
@@ -466,6 +485,7 @@
     }
     return object::void_class;
   }
+

   // Invalid nodes
 #define INVALID(Node)                                      \


allow empty affixpath and use std::string

--- src/hunspell/hunspell.cxx
+++ src/hunspell/hunspell.cxx
@@ -127,7 +127,7 @@
   AffixMgr* pAMgr;
   std::vector<HashMgr*> m_HMgrs;
   SuggestMgr* pSMgr;
-  char* affixpath;
+  std::string affixpath;
   std::string encoding;
   struct cs_info* csconv;
   int langnum;
@@ -169,11 +169,11 @@
   HunspellImpl& operator=(const HunspellImpl&);
 };

-HunspellImpl::HunspellImpl(const char* affpath, const char* dpath, const char* key) {
+HunspellImpl::HunspellImpl(const char* affpath, const char* dpath, const char* key)
+  : affixpath(affpath) {
   csconv = NULL;
   utf8 = 0;
   complexprefixes = 0;
-  affixpath = mystrdup(affpath);

   /* first set up the hash manager */
   m_HMgrs.push_back(new HashMgr(dpath, affpath, key));
@@ -209,15 +209,11 @@
   delete[] csconv;
 #endif
   csconv = NULL;
-  delete[] affixpath;
-  affixpath = NULL;
 }

 // load extra dictionaries
 int HunspellImpl::add_dic(const char* dpath, const char* key) {
-  if (!affixpath)
-    return 1;
-  m_HMgrs.push_back(new HashMgr(dpath, affixpath, key));
+  m_HMgrs.push_back(new HashMgr(dpath, affixpath.c_str(), key));
   return 0;
 }


freerds: fix freerds.instance generation

--- session-manager/common/appcontext/ApplicationContext.cpp
+++ session-manager/common/appcontext/ApplicationContext.cpp
@@ -152,7 +152,7 @@
 				"prefix=\"%s\"\n"
 				"bindir=\"%s\"\n"
 				"sbindir=\"%s\"\n"
-				"libdir=\"\"%s\n"
+				"libdir=\"%s\"\n"
 				"datarootdir=\"%s\"\n"
 				"localstatedir=\"%s\"\n"
 				"sysconfdir=\"%s\"\n"


gltrace: Fix warning for issue 316.

gltrace: Fix warning for issue 316.

--- wrappers/glcaps.cpp
+++ wrappers/glcaps.cpp
@@ -205,10 +205,12 @@
     switch (pname) {
     case GL_NUM_PROGRAM_BINARY_FORMATS:
         if (params) {
-            if (params[0] > 0) {
+            GLint numProgramBinaryFormats = 0;
+            _glGetIntegerv(pname, &numProgramBinaryFormats);
+            if (numProgramBinaryFormats > 0) {
                 os::log("apitrace: warning: hiding program binary formats (https://github.com/apitrace/apitrace/issues/316)\n");
-                params[0] = 0;
             }
+            params[0] = 0;
         }
         return;
     case GL_PROGRAM_BINARY_FORMATS:


Updated for current master

Updated for current master

--- utilities/PostProcessing/FieldConvert/OutputTecplot.cpp
+++ utilities/PostProcessing/FieldConvert/OutputTecplot.cpp
@@ -195,7 +195,7 @@
             }
             else
             {
-                m_f->m_exp[0]->GetExp(expansion)->WriteTecplotZone(outfile);
+                m_f->m_exp[0]->WriteTecplotZone(outfile,expansion);
             }
         }

@@ -257,10 +257,7 @@
             }
             else
             {
-                m_f->m_exp[field]->GetExp(expansion)->SetPhys(
-                                  m_f->m_exp[field]->GetPhys()+
-                                  m_f->m_exp[field]->GetPhys_Offset(expansion));
-                m_f->m_exp[field]->GetExp(expansion)->WriteTecplotField(outfile);
+                m_f->m_exp[field]->WriteTecplotField(outfile,expansion);
             }
         }


Add realloc_dbg to satisfy the libcpmtd which is provided with Visual Studio 2012.
Review URL: https://codereview.chromium.org/11361071

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@165933 0039d316-1c4b-4281-b951-d872f2087c98

--- base/allocator/generic_allocators.cc
+++ base/allocator/generic_allocators.cc
@@ -149,6 +149,10 @@
   return malloc(size);
 }

+void* _realloc_dbg(void* ptr, size_t size, int, const char*, int) {
+  return realloc(ptr, size);
+}
+
 void _free_dbg(void* ptr, int) {
   free(ptr);
 }


codeforce; avoid using ceil when looking for integer division

If you want to compute n / k such that:
	* if n % k == 0 (n = k * m), then n / k = m
	* if n % k != 0 and m is the biggest integer: k * m < n, then
	  n / k = m + 1

better use n / k = (n + k - 1) / k, instead of
cast_to_integer(ceil(n / cast_to_double(k)))

--- codeforces/beta-round-1/theatre_square.cpp
+++ codeforces/beta-round-1/theatre_square.cpp
@@ -1,4 +1,3 @@
-#include <cmath>
 #include <iostream>

 using namespace std;
@@ -13,18 +12,21 @@
 {
     use_io_iptimizations();

-    unsigned int theatre_square_width;
-    unsigned int theatre_square_height;
-    unsigned int flagstone_size;
+    unsigned long long theatre_square_width;
+    unsigned long long theatre_square_height;
+    unsigned long long flagstone_size;

     cin >> theatre_square_width >> theatre_square_height >> flagstone_size;

-    cout << static_cast<long long>(
-                (ceil(theatre_square_width  /
-                      static_cast<double>(flagstone_size)) *
-                 ceil(theatre_square_height /
-                      static_cast<double>(flagstone_size)))
-            );
+    unsigned long long horizontal {
+        (theatre_square_width + flagstone_size - 1) / flagstone_size
+    };
+
+    unsigned long long vertical {
+        (theatre_square_height + flagstone_size - 1) / flagstone_size
+    };
+
+    cout << horizontal * vertical << '\n';

     return 0;
 }


INTEGRATION: CWS sb18 (1.6.4); FILE MERGED 2004/04/28 08:58:49 sb 1.6.4.1: #i21150# Constness improvements.

--- codemaker/source/codemaker/typemanager.cxx
+++ codemaker/source/codemaker/typemanager.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: typemanager.cxx,v $
  *
- *  $Revision: 1.6 $
- *
- *  last change: $Author: rt $ $Date: 2004-03-30 16:52:33 $
+ *  $Revision: 1.7 $
+ *
+ *  last change: $Author: obo $ $Date: 2004-06-04 03:11:06 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -199,7 +199,7 @@
 }

 typereg::Reader RegistryTypeManager::getTypeReader(
-    const OString& name, sal_Bool * pIsExtraType )
+    const OString& name, sal_Bool * pIsExtraType ) const
 {
     typereg::Reader reader;
     RegistryKey key(searchTypeKey(name, pIsExtraType));
@@ -223,7 +223,7 @@
     return reader;
 }

-RTTypeClass RegistryTypeManager::getTypeClass(const OString& name)
+RTTypeClass RegistryTypeManager::getTypeClass(const OString& name) const
 {
     if (m_pImpl->m_t2TypeClass.count(name) > 0)
     {
@@ -287,6 +287,7 @@
 }

 RegistryKey RegistryTypeManager::searchTypeKey(const OString& name_, sal_Bool * pIsExtraType )
+    const
 {
     OUString name( OStringToOUString(m_pImpl->m_base + name_, RTL_TEXTENCODING_UTF8) );
     RegistryKey key, rootKey;


- Attempts at fixing Windows GL rendering

--- coffee/core/context/cglbindingrenderer.cpp
+++ coffee/core/context/cglbindingrenderer.cpp
@@ -58,10 +58,10 @@
     CString tmp;

     for(GLint i=0;i<exts;i++){
-		byte_t* str = (byte_t*)glGetStringi(GL_EXTENSIONS, i);
+		const ubyte_t* str = glGetStringi(GL_EXTENSIONS, i);
 		if (!str)
 			continue;
-        tmp.append(str);
+        tmp.append((cstring)str);
         if(i<exts-1)
             tmp.push_back('\n');
     }


Check for ComponentPackageImpl::isRegistered_ in the current rdb

...not the old one that does not contain the changes from the current session.
Otherwise, actively registered components in bundled extensions would not
necessarily be re-registered upon start up.  Any old instance would be removed,
but the new instance would not be registered as isRegistered_ would still
return true.

To me it looks like 7a400caaa6946399ea31614d056d435350f42dc1 "jl145: #i99257#
Extension Manager prevents running of multiple instances which acces the same
shared data" erroneously introduced a call to getRDB_RO instead of getRDB into
isRegistered_.  That (only) call of getRDB_RO gone allowed some clean up, incl.
renaming remaining variables from ..._RO to ..._orig.

Change-Id: I7eccac699e6fa5799f77b038b15d62e0a9c1ad17

--- desktop/source/deployment/registry/component/dp_component.cxx
+++ desktop/source/deployment/registry/component/dp_component.cxx
@@ -155,10 +155,6 @@

         const Reference<registry::XSimpleRegistry> getRDB() const;

-        //Provides the read-only registry (e.g. not the one based on the duplicated
-        //rdb files
-        const Reference<registry::XSimpleRegistry> getRDB_RO() const;
-
     public:
         ComponentPackageImpl(
             ::rtl::Reference<PackageRegistryBackend> const & myBackend,
@@ -305,9 +301,9 @@
     OUString m_commonRDB;
     OUString m_nativeRDB;

-    //URLs of the read-only rdbs (e.g. not the ones of the duplicated files)
-    OUString m_commonRDB_RO;
-    OUString m_nativeRDB_RO;
+    //URLs of the original rdbs (before any switching):
+    OUString m_commonRDB_orig;
+    OUString m_nativeRDB_orig;

     std::auto_ptr<ComponentBackendDb> m_backendDb;

@@ -315,17 +311,8 @@
     ComponentBackendDb::Data readDataFromDb(OUString const & url);
     void revokeEntryFromDb(OUString const & url);

-
-    //These rdbs are for writing new service entries. The rdb files are copies
-    //which are created when services are added or removed.
     Reference<registry::XSimpleRegistry> m_xCommonRDB;
     Reference<registry::XSimpleRegistry> m_xNativeRDB;
-
-    //These rdbs are created on the read-only rdbs which are already used
-    //by UNO since the startup of the current session.
-    Reference<registry::XSimpleRegistry> m_xCommonRDB_RO;
-    Reference<registry::XSimpleRegistry> m_xNativeRDB_RO;
-

     void unorc_verify_init( Reference<XCommandEnvironment> const & xCmdEnv );
     void unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv );
@@ -359,9 +346,6 @@

     //Will be called from ComponentPackageImpl
     void initServiceRdbFiles();
-
-    //Creates the READ ONLY registries (m_xCommonRDB_RO,m_xNativeRDB_RO)
-    void initServiceRdbFiles_RO();
 };

 //______________________________________________________________________________
@@ -402,18 +386,6 @@
         return that->m_xCommonRDB;
 }

-//Returns the read only RDB.
-const Reference<registry::XSimpleRegistry>
-BackendImpl::ComponentPackageImpl::getRDB_RO() const
-{
-    BackendImpl * that = getMyBackend();
-
-    if ( m_loader == "com.sun.star.loader.SharedLibrary" )
-        return that->m_xNativeRDB_RO;
-    else
-        return that->m_xCommonRDB_RO;
-}
-
 BackendImpl * BackendImpl::ComponentPackageImpl::getMyBackend() const
 {
     BackendImpl * pBackend = static_cast<BackendImpl *>(m_myBackend.get());
@@ -479,13 +451,13 @@
     ::ucbhelper::Content cacheDir( getCachePath(), xCmdEnv );
     ::ucbhelper::Content oldRDB;
     // switch common rdb:
-    if (!m_commonRDB_RO.isEmpty())
+    if (!m_commonRDB_orig.isEmpty())
     {
         create_ucb_content(
-            &oldRDB, makeURL( getCachePath(), m_commonRDB_RO),
+            &oldRDB, makeURL( getCachePath(), m_commonRDB_orig),
             xCmdEnv, false /* no throw */ );
     }
-    m_commonRDB = m_commonRDB_RO == "common.rdb" ? OUSTR("common_.rdb") : OUSTR("common.rdb");
+    m_commonRDB = m_commonRDB_orig == "common.rdb" ? OUSTR("common_.rdb") : OUSTR("common.rdb");
     if (oldRDB.get().is())
     {
         if (! cacheDir.transferContent(
@@ -499,15 +471,15 @@
         oldRDB = ::ucbhelper::Content();
     }
     // switch native rdb:
-    if (!m_nativeRDB_RO.isEmpty())
+    if (!m_nativeRDB_orig.isEmpty())
     {
         create_ucb_content(
-            &oldRDB, makeURL(getCachePath(), m_nativeRDB_RO),
+            &oldRDB, makeURL(getCachePath(), m_nativeRDB_orig),
             xCmdEnv, false /* no throw */ );
     }
     const OUString plt_rdb( getPlatformString() + OUSTR(".rdb") );
     const OUString plt_rdb_( getPlatformString() + OUSTR("_.rdb") );
-    m_nativeRDB = m_nativeRDB_RO.equals( plt_rdb ) ? plt_rdb_ : plt_rdb;
+    m_nativeRDB = m_nativeRDB_orig.equals( plt_rdb ) ? plt_rdb_ : plt_rdb;
     if (oldRDB.get().is())
     {
         if (! cacheDir.transferContent(
@@ -545,38 +517,6 @@
     }
 }

-void BackendImpl::initServiceRdbFiles_RO()
-{
-    const Reference<XCommandEnvironment> xCmdEnv;
-
-    // common rdb for java, native rdb for shared lib components
-    if (!m_commonRDB_RO.isEmpty())
-    {
-        m_xCommonRDB_RO.set(
-            m_xComponentContext->getServiceManager()
-            ->createInstanceWithContext(
-            OUSTR("com.sun.star.registry.SimpleRegistry"),
-            m_xComponentContext), UNO_QUERY_THROW);
-        m_xCommonRDB_RO->open(
-            makeURL(expandUnoRcUrl(getCachePath()), m_commonRDB_RO),
-            sal_True, //read-only
-            sal_True); // create data source if necessary
-    }
-    if (!m_nativeRDB_RO.isEmpty())
-    {
-        m_xNativeRDB_RO.set(
-            m_xComponentContext->getServiceManager()
-            ->createInstanceWithContext(
-            OUSTR("com.sun.star.registry.SimpleRegistry"),
-            m_xComponentContext), UNO_QUERY_THROW);
-        m_xNativeRDB_RO->open(
-            makeURL(expandUnoRcUrl(getCachePath()), m_nativeRDB_RO),
-            sal_True, //read-only
-            sal_True); // create data source if necessary
-    }
-}
-
-//______________________________________________________________________________
 BackendImpl::BackendImpl(
     Sequence<Any> const & args,
     Reference<XComponentContext> const & xComponentContext )
@@ -657,12 +597,7 @@
     }
     else
     {
-        //do this before initServiceRdbFiles_RO, because it determines
-        //m_commonRDB and m_nativeRDB
         unorc_verify_init( xCmdEnv );
-
-        initServiceRdbFiles_RO();
-
         OUString dbFile = makeURL(getCachePath(), OUSTR("backenddb.xml"));
         m_backendDb.reset(
             new ComponentBackendDb(getComponentContext(), dbFile));
@@ -936,7 +871,7 @@
                             token.matchAsciiL(
                                 RTL_CONSTASCII_STRINGPARAM("?$ORIGIN/")))
                         {
-                            m_commonRDB_RO = token.copy(
+                            m_commonRDB_orig = token.copy(
                                 RTL_CONSTASCII_LENGTH("?$ORIGIN/"));
                             state = 2;
                         }
@@ -964,7 +899,7 @@
                     xCmdEnv, false /* no throw */ )) {
                 if (readLine( &line, OUSTR("UNO_SERVICES="), ucb_content,
                               RTL_TEXTENCODING_UTF8 )) {
-                    m_nativeRDB_RO = line.copy(
+                    m_nativeRDB_orig = line.copy(
                         sizeof ("UNO_SERVICES=?$ORIGIN/") - 1 );
                 }
             }
@@ -1025,10 +960,10 @@
     }

     // If we duplicated the common or native rdb then we must use those urls
-    //otherwise we use those of the original files. That is, m_commonRDB_RO and
-    //m_nativeRDB_RO;
-    OUString sCommonRDB(m_commonRDB.isEmpty() ? m_commonRDB_RO : m_commonRDB );
-    OUString sNativeRDB(m_nativeRDB.isEmpty() ? m_nativeRDB_RO : m_nativeRDB );
+    //otherwise we use those of the original files. That is, m_commonRDB_orig
+    //and m_nativeRDB_orig;
+    OUString sCommonRDB(m_commonRDB.isEmpty() ? m_commonRDB_orig : m_commonRDB );
+    OUString sNativeRDB(m_nativeRDB.isEmpty() ? m_nativeRDB_orig : m_nativeRDB );

     if (!sCommonRDB.isEmpty() || !sNativeRDB.isEmpty() ||
         !m_components.empty())
@@ -1443,7 +1378,7 @@
     {
         m_registered = REG_NOT_REGISTERED;
         bool bAmbiguousComponentName = false;
-        const Reference<registry::XSimpleRegistry> xRDB( getRDB_RO() );
+        const Reference<registry::XSimpleRegistry> xRDB( getRDB() );
         if (xRDB.is())
         {
             // lookup rdb for location URL:


Eliminate the possibility of buffer overflow

--- lib/mrn_path_mapper.cpp
+++ lib/mrn_path_mapper.cpp
@@ -48,9 +48,10 @@
       return db_path_;
     }

+    size_t db_len = strlen(db_path_);
     if (strncmp(mysql_path_, "./", 2) == 0) {
       if (path_prefix_) {
-        strncat(db_path_, path_prefix_, MRN_MAX_PATH_SIZE);
+        strncat(db_path_, path_prefix_, MRN_MAX_PATH_SIZE - db_len - 1);
       }

       int i = 2, j = strlen(db_path_), len;


Aligned the XML definition of a socket's bone by its name instead of its ID

git-svn-id: 28d9401aa571d5108e51b194aae6f24ca5964c06@34731 8cc4aa7f-3514-0410-904f-f2cc9021211c

--- plugins/mesh/animesh/persist/standard/animeshldr.cpp
+++ plugins/mesh/animesh/persist/standard/animeshldr.cpp
@@ -296,9 +296,23 @@
 	break;
       case XMLTOKEN_SOCKET:
         {
+	  CS::Animation::iSkeletonFactory2* skelFact = amfact->GetSkeletonFactory ();
+          if (!skelFact)
+          {
+            synldr->ReportError (msgidFactory, child, "No skeleton defined while creating socket");
+            return 0;
+          }
+
+          const char* boneName = child->GetAttributeValue ("bone");
+	  CS::Animation::BoneID bone = skelFact->FindBone (boneName);
+          if (bone == CS::Animation::InvalidBoneID)
+          {
+            synldr->ReportError (msgidFactory, child, "Could not find bone %s in skeleton", boneName);
+            return 0;
+          }
+
+          const char* name = child->GetAttributeValue ("name");
           csReversibleTransform transform;
-          CS::Animation::BoneID bone = child->GetAttributeValueAsInt ("bone");
-          const char* name = child->GetAttributeValue ("name");

           csRef<iDocumentNode> tnode = child->GetNode ("transform");
           if (tnode)