Posted
almost 10 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-09-01 03:32:13 -0400 (Tue, 01 Sep 2015)
New Revision: 9807
Modified:
trunk/tests/imageloading.c
Log:
plug memleaks in imageloading test
Modified: trunk/tests/imageloading.c
... [More]
===================================================================
--- trunk/tests/imageloading.c2015-09-01 01:58:37 UTC (rev 9806)
trunk/tests/imageloading.c2015-09-01 07:32:13 UTC (rev 9807)
< at >< at > -22,62 22,64 < at >< at >
/* Display a PNG file with transparency */
AG_LabelNewS(vBox, 0, "Imported axe.png:");
if (!AG_ConfigFile("load-path", "axe", "png", path, sizeof(path))) {
-if ((su = AG_SurfaceFromPNG(path)) == NULL) {
-AG_LabelNew(vBox, 0, "%s: %s", path, AG_GetError());
-} else {
if ((su = AG_SurfaceFromPNG(path)) != NULL) {
AG_PixmapFromSurface(vBox, 0, su);
-}
-AG_LabelNewS(vBox, 0, "Exported axe-save.png:");
-if (AG_SurfaceExportPNG(su, "axe-save.png", 0) == -1) {
-AG_LabelNew(vBox, 0, "Save failed: %s", AG_GetError());
-} else {
-if ((su2 = AG_SurfaceFromPNG("axe-save.png")) == NULL) {
-AG_LabelNew(vBox, 0, "Load failed: %s", AG_GetError());
AG_LabelNewS(vBox, 0, "Exported axe-save.png:");
if (AG_SurfaceExportPNG(su, "axe-save.png", 0) == 0) {
if ((su2 = AG_SurfaceFromPNG("axe-save.png")) != NULL) {
AG_PixmapFromSurface(vBox, 0, su2);
AG_SurfaceFree(su2);
} else {
AG_LabelNew(vBox, 0, "Load failed: %s", AG_GetError());
}
} else {
-AG_PixmapFromSurface(vBox, 0, su2);
AG_LabelNew(vBox, 0, "Save failed: %s", AG_GetError());
}
AG_SurfaceFree(su);
} else {
AG_LabelNew(vBox, 0, "%s: %s", path, AG_GetError());
}
} else {
AG_LabelNewS(vBox, 0, AG_GetError());
}
-
/* Load, display and save a PNG file. */
AG_LabelNewS(vBox, 0, "Imported agar.png:");
if (!AG_ConfigFile("load-path", "agar", "png", path, sizeof(path))) {
-if ((su = AG_SurfaceFromPNG(path)) == NULL) {
-AG_LabelNew(vBox, 0, "%s: %s", path, AG_GetError());
-} else {
if ((su = AG_SurfaceFromPNG(path)) != NULL) {
AG_PixmapFromSurface(vBox, 0, su);
-}
-AG_LabelNewS(vBox, 0, "Converted to {8,16,24,32}bpp:");
-bppBox = AG_BoxNewHoriz(vBox, 0 );
-{
-const int testDepths[4] = { 8,16,24,32 };
-int i;
AG_LabelNewS(vBox, 0, "Converted to {8,16,24,32}bpp:");
bppBox = AG_BoxNewHoriz(vBox, 0 );
{
const int testDepths[4] = { 8,16,24,32 };
int i;
-for (i = 0; i < 4; i ) {
-pfTest = AG_PixelFormatRGB(testDepths[i],
- 0xff000000, 0x00ff0000, 0x0000ff00);
-if ((su2 = AG_SurfaceConvert(su, pfTest)) != NULL) {
-AG_PixmapFromSurface(bppBox, 0, su2);
for (i = 0; i < 4; i ) {
pfTest = AG_PixelFormatRGB(testDepths[i], 0xff000000, 0x00ff0000, 0x0000ff00);
if ((su2 = AG_SurfaceConvert(su, pfTest)) != NULL) {
AG_PixmapFromSurface(bppBox, 0, su2);
AG_SurfaceFree(su2);
} else {
AG_LabelNew(bppBox, 0, "Convert failed: %s", AG_GetError());
}
AG_PixelFormatFree(pfTest);
}
}
AG_LabelNewS(vBox, 0, "Exported agar-save.png:");
if (AG_SurfaceExportPNG(su, "agar-save.png", 0) == -1) {
AG_LabelNew(vBox, 0, "Save failed: %s", AG_GetError());
} else {
if ((su2 = AG_SurfaceFromPNG("agar-save.png")) != NULL) {
AG_PixmapFromSurface(vBox, 0, su2);
AG_SurfaceFree(su2);
} else {
-AG_LabelNew(bppBox, 0, "Convert failed: %s", AG_GetError());
AG_LabelNew(vBox, 0, "Load failed: %s", AG_GetError());
}
-AG_PixelFormatFree(pfTest);
}
-}
-
-AG_LabelNewS(vBox, 0, "Exported agar-save.png:");
-if (AG_SurfaceExportPNG(su, "agar-save.png", 0) == -1) {
-AG_LabelNew(vBox, 0, "Save failed: %s", AG_GetError());
AG_SurfaceFree(su);
} else {
-if ((su2 = AG_SurfaceFromPNG("agar-save.png")) == NULL) {
-AG_LabelNew(vBox, 0, "Load failed: %s", AG_GetError());
-} else {
-AG_PixmapFromSurface(vBox, 0, su2);
-}
AG_LabelNew(vBox, 0, "%s: %s", path, AG_GetError());
}
} else {
AG_LabelNewS(vBox, 0, AG_GetError());
< at >< at > -86,39 88,42 < at >< at >
/* Load/save a PNG file in indexed color format. */
AG_LabelNewS(vBox, 0, "Imported agar-index.png:");
if (!AG_ConfigFile("load-path", "agar-index", "png", path, sizeof(path))) {
-if ((su = AG_SurfaceFromPNG(path)) == NULL) {
-AG_LabelNew(vBox, 0, "Failed: %s", AG_GetError());
-} else {
if ((su = AG_SurfaceFromPNG(path)) != NULL) {
AG_PixmapFromSurface(vBox, 0, su);
-}
-AG_LabelNewS(vBox, 0, "Converted to {8,16,24,32}bpp:");
-bppBox = AG_BoxNewHoriz(vBox, 0 );
-{
-const int testDepths[4] = { 8,16,24,32 };
-int i;
AG_LabelNewS(vBox, 0, "Converted to {8,16,24,32}bpp:");
bppBox = AG_BoxNewHoriz(vBox, 0 );
{
const int testDepths[4] = { 8,16,24,32 };
int i;
-for (i = 0; i < 4; i ) {
-pfTest = AG_PixelFormatRGB(testDepths[i],
- 0xff000000, 0x00ff0000, 0x0000ff00);
-if ((su2 = AG_SurfaceConvert(su, pfTest)) != NULL) {
-AG_PixmapFromSurface(bppBox, 0, su2);
for (i = 0; i < 4; i ) {
pfTest = AG_PixelFormatRGB(testDepths[i], 0xff000000, 0x00ff0000, 0x0000ff00);
if ((su2 = AG_SurfaceConvert(su, pfTest)) != NULL) {
AG_PixmapFromSurface(bppBox, 0, su2);
AG_SurfaceFree(su2);
} else {
AG_LabelNew(bppBox, 0, "Convert failed: %s", AG_GetError());
}
AG_PixelFormatFree(pfTest);
}
}
AG_LabelNewS(vBox, 0, "Exported agar-index-save.png:");
if (AG_SurfaceExportPNG(su, "agar-index-save.png", 0) == -1) {
AG_LabelNew(vBox, 0, "Save failed: %s", AG_GetError());
} else {
if ((su2 = AG_SurfaceFromPNG("agar-index-save.png")) == NULL) {
AG_LabelNew(vBox, 0, "Load failed: %s", AG_GetError());
} else {
-AG_LabelNew(bppBox, 0, "Convert failed: %s", AG_GetError());
AG_PixmapFromSurface(vBox, 0, su2);
AG_SurfaceFree(su2);
}
-AG_PixelFormatFree(pfTest);
}
-}
-AG_LabelNewS(vBox, 0, "Exported agar-index-save.png:");
-if (AG_SurfaceExportPNG(su, "agar-index-save.png", 0) == -1) {
-AG_LabelNew(vBox, 0, "Save failed: %s", AG_GetError());
AG_SurfaceFree(su);
} else {
-if ((su2 = AG_SurfaceFromPNG("agar-index-save.png")) == NULL) {
-AG_LabelNew(vBox, 0, "Load failed: %s", AG_GetError());
-} else {
-AG_PixmapFromSurface(vBox, 0, su2);
-}
AG_LabelNew(vBox, 0, "Failed: %s", AG_GetError());
}
} else {
AG_LabelNewS(vBox, 0, AG_GetError());
< at >< at > -133,26 138,30 < at >< at >
AG_LabelNew(vBox, 0, "Failed: %s", AG_GetError());
} else {
AG_PixmapFromSurface(vBox, 0, su);
-}
-AG_LabelNewS(vBox, 0, "Exported pepe.jpg (Quality = 10%):");
-if (AG_SurfaceExportJPEG(su, "pepe-save.jpg", 10, 0) == -1) {
-AG_LabelNew(vBox, 0, "Save failed: %s", AG_GetError());
-} else {
-if ((su2 = AG_SurfaceFromJPEG("pepe-save.jpg")) == NULL) {
-AG_LabelNew(vBox, 0, "Load failed: %s", AG_GetError());
AG_LabelNewS(vBox, 0, "Exported pepe.jpg (Quality = 10%):");
if (AG_SurfaceExportJPEG(su, "pepe-save.jpg", 10, 0) == -1) {
AG_LabelNew(vBox, 0, "Save failed: %s", AG_GetError());
} else {
-AG_PixmapFromSurface(vBox, 0, su2);
if ((su2 = AG_SurfaceFromJPEG("pepe-save.jpg")) == NULL) {
AG_LabelNew(vBox, 0, "Load failed: %s", AG_GetError());
} else {
AG_PixmapFromSurface(vBox, 0, su2);
AG_SurfaceFree(su2);
}
}
-}
-AG_LabelNewS(vBox, 0, "Exported pepe.jpg (Quality = 100%):");
-if (AG_SurfaceExportJPEG(su, "pepe-save.jpg", 100, 0) == -1) {
-AG_LabelNew(vBox, 0, "Save failed: %s", AG_GetError());
-} else {
-if ((su2 = AG_SurfaceFromJPEG("pepe-save.jpg")) == NULL) {
-AG_LabelNew(vBox, 0, "Load failed: %s", AG_GetError());
AG_LabelNewS(vBox, 0, "Exported pepe.jpg (Quality = 100%):");
if (AG_SurfaceExportJPEG(su, "pepe-save.jpg", 100, 0) == -1) {
AG_LabelNew(vBox, 0, "Save failed: %s", AG_GetError());
} else {
-AG_PixmapFromSurface(vBox, 0, su2);
if ((su2 = AG_SurfaceFromJPEG("pepe-save.jpg")) == NULL) {
AG_LabelNew(vBox, 0, "Load failed: %s", AG_GetError());
} else {
AG_PixmapFromSurface(vBox, 0, su2);
AG_SurfaceFree(su2);
}
}
AG_SurfaceFree(su);
}
} else {
AG_LabelNewS(vBox, 0, AG_GetError());
[Less]
|
Posted
almost 10 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-08-31 21:58:37 -0400 (Mon, 31 Aug 2015)
New Revision: 9806
Modified:
trunk/gui/editable.c
Log:
if pasting a multiline string in a single-line Editable, truncate at first \n.
Modified: trunk/gui/editable.c
... [More]
===================================================================
--- trunk/gui/editable.c2015-09-01 01:46:32 UTC (rev 9805)
+++ trunk/gui/editable.c2015-09-01 01:58:37 UTC (rev 9806)
< at >< at > -1202,8 +1202,8 < at >< at >
if (!(ed->flags & AG_EDITABLE_MULTILINE)) {
for (c = &cb->s[0]; *c != '\0'; c++) {
if (*c == '\n') {
-AG_SetError(_("Cannot paste newlines here"));
-goto fail;
+*c = '\0';
+break;
}
}
}
[Less]
|
Posted
almost 10 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-08-31 21:46:32 -0400 (Mon, 31 Aug 2015)
New Revision: 9805
Modified:
trunk/core/object.c
Log:
fix possible memleak due to AG_SetStringNODUP() in AG_ObjectLoad()
Modified: trunk/core/object.c
... [More]
===================================================================
--- trunk/core/object.c2015-08-31 05:49:13 UTC (rev 9804)
trunk/core/object.c2015-09-01 01:46:32 UTC (rev 9805)
< at >< at > -1137,6 1137,7 < at >< at >
for (i = 0; i < count; i ) {
char key[64];
Sint32 code;
char *s;
if (AG_CopyString(key, ds, sizeof(key)) >= sizeof(key)) {
AG_SetError("Variable name too long: %s", key);
< at >< at > -1173,7 1174,12 < at >< at >
case AG_VARIABLE_LONG_DOUBLE: AG_SetLongDouble(ob, key, AG_ReadLongDouble(ds)); break;
#endif
case AG_VARIABLE_STRING:
-AG_SetStringNODUP(ob, key, AG_ReadString(ds));
if ((s = AG_ReadString(ds)) != NULL) {
AG_SetString(ob, key, s);
free(s);
} else {
AG_SetString(ob, key, "");
}
break;
default:
AG_SetError("Attempt to load variable of type %s",
[Less]
|
Posted
almost 10 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-08-31 01:49:13 -0400 (Mon, 31 Aug 2015)
New Revision: 9804
Modified:
trunk/au/au_dev_out.c
trunk/core/class.c
trunk/core/string.c
trunk/math/m_polygon.c
trunk/math/m_polyhedron.c
trunk/vg/vg.c
... [More]
trunk/vg/vg_polygon.h
Log:
fix offset in memmove() usage
Modified: trunk/au/au_dev_out.c
===================================================================
--- trunk/au/au_dev_out.c2015-08-31 05:47:34 UTC (rev 9803)
+++ trunk/au/au_dev_out.c2015-08-31 05:49:13 UTC (rev 9804)
< at >< at > -179,7 +179,7 < at >< at >
}
if (ch < dev->nChan-1) {
memmove(&dev->chan[ch], &dev->chan[ch+1],
- (dev->nChan-1)*sizeof(AU_Channel));
+ (dev->nChan - ch - 1)*sizeof(AU_Channel));
}
dev->nChan--;
AG_MutexUnlock(&dev->lock);
Modified: trunk/core/class.c
===================================================================
--- trunk/core/class.c2015-08-31 05:47:34 UTC (rev 9803)
+++ trunk/core/class.c2015-08-31 05:49:13 UTC (rev 9804)
< at >< at > -90,15 +90,13 < at >< at >
void
AG_DestroyClassTbl(void)
{
-Free(agNamespaceTbl);
-agNamespaceTbl = NULL;
+free(agNamespaceTbl); agNamespaceTbl = NULL;
agNamespaceCount = 0;
agClassTree = NULL;
AG_TblDestroy(agClassTbl);
-free(agClassTbl);
-agClassTbl = NULL;
+free(agClassTbl); agClassTbl = NULL;
AG_MutexDestroy(&agClassLock);
}
< at >< at > -441,14 +439,13 < at >< at >
if (strcmp(agNamespaceTbl[i].name, name) == 0)
break;
}
-if (i == agNamespaceCount) {
-return;
+if (i < agNamespaceCount) {
+if (i < agNamespaceCount-1) {
+memmove(&agNamespaceTbl[i], &agNamespaceTbl[i+1],
+ (agNamespaceCount-i-1)*sizeof(AG_Namespace));
+}
+agNamespaceCount--;
}
-if (i < agNamespaceCount-1) {
-memmove(&agNamespaceTbl[i], &agNamespaceTbl[i+1],
- (agNamespaceCount-1)*sizeof(AG_Namespace));
-}
-agNamespaceCount--;
}
/* Register a new module directory path. */
< at >< at > -474,15 +471,14 < at >< at >
if (strcmp(agModuleDirs[i], path) == 0)
break;
}
-if (i == agModuleDirCount) {
-return;
+if (i < agModuleDirCount) {
+free(agModuleDirs[i]);
+if (i < agModuleDirCount-1) {
+memmove(&agModuleDirs[i], &agModuleDirs[i+1],
+ (agModuleDirCount-i-1)*sizeof(char *));
+}
+agModuleDirCount--;
}
-Free(agModuleDirs[i]);
-if (i < agModuleDirCount-1) {
-memmove(&agModuleDirs[i], &agModuleDirs[i+1],
- (agModuleDirCount-1)*sizeof(char *));
-}
-agModuleDirCount--;
}
/* General case fallback for AG_ClassIsNamed() */
Modified: trunk/core/string.c
===================================================================
--- trunk/core/string.c2015-08-31 05:47:34 UTC (rev 9803)
+++ trunk/core/string.c2015-08-31 05:49:13 UTC (rev 9804)
< at >< at > -184,10 +184,10 < at >< at >
break;
}
if (i < agFmtExtensionCount) {
-Free(agFmtExtensions[i].fmt);
+free(agFmtExtensions[i].fmt);
if (i < agFmtExtensionCount-1) {
memmove(&agFmtExtensions[i], &agFmtExtensions[i+1],
- (agFmtExtensionCount-1)*sizeof(AG_FmtStringExt));
+ (agFmtExtensionCount-i-1)*sizeof(AG_FmtStringExt));
}
agFmtExtensionCount--;
}
Modified: trunk/math/m_polygon.c
===================================================================
--- trunk/math/m_polygon.c2015-08-31 05:47:34 UTC (rev 9803)
+++ trunk/math/m_polygon.c2015-08-31 05:49:13 UTC (rev 9804)
< at >< at > -210,14 +210,14 < at >< at >
/* Remove a vertex from a polygon. */
int
-M_PolygonDelVertex(M_Polygon *P, int v)
+M_PolygonDelVertex(M_Polygon *P, int i)
{
-if (v < 0 || v >= P->n) {
+if (i < 0 || i >= P->n) {
AG_SetError("Bad vertex");
return (-1);
}
-if (v < P->n-1) {
-memmove(&P->v[v], &P->v[v+1], (P->n - 1)*sizeof(M_Vector2));
+if (i < P->n - 1) {
+memmove(&P->v[i], &P->v[i+1], (P->n - i - 1)*sizeof(M_Vector2));
}
P->n--;
return (0);
Modified: trunk/math/m_polyhedron.c
===================================================================
--- trunk/math/m_polyhedron.c2015-08-31 05:47:34 UTC (rev 9803)
+++ trunk/math/m_polyhedron.c2015-08-31 05:49:13 UTC (rev 9804)
< at >< at > -165,15 +165,15 < at >< at >
/* Remove a vertex from a polyhedron. Vertex must not be in use. */
void
-M_PolyhedronDelVertex(M_Polyhedron *P, Uint v)
+M_PolyhedronDelVertex(M_Polyhedron *P, Uint i)
{
-if (v >= P->nv) {
-return;
+if (i < P->nv) {
+if (i < P->nv - 1) {
+memmove(&P->v[i], &P->v[i+1],
+ (P->nv - i - 1)*sizeof(M_Vector3));
+}
+P->nv--;
}
-if (v < P->nv-1) {
-memmove(&P->v[v], &P->v[v+1], (P->nv - 1)*sizeof(M_Vector3));
-}
-P->nv--;
}
/*
< at >< at > -207,15 +207,15 < at >< at >
void
M_PolyhedronDelEdge(M_Polyhedron *P, Uint e)
{
-Uint eHead = (P->e[e].oe < e) ? P->e[e].oe : e;
+Uint i = (P->e[e].oe < e) ? P->e[e].oe : e;/* Pick head HE */
-if (e >= P->ne)
-return;
-
-if (eHead < P->ne-2) {
-memmove(&P->e[eHead], &P->e[eHead+2], (P->ne-2)*sizeof(M_Halfedge));
+if (i < P->ne) {
+if (i < P->ne - 2) {
+memmove(&P->e[i], &P->e[i+2],
+ (P->ne - i - 2)*sizeof(M_Halfedge));
+}
+P->ne--;
}
-P->ne--;
}
/*
< at >< at > -245,15 +245,14 < at >< at >
/* Remove a facet from a polyhedron. */
void
-M_PolyhedronDelFacet(M_Polyhedron *P, Uint f)
+M_PolyhedronDelFacet(M_Polyhedron *P, Uint i)
{
-if (f >= P->nv) {
-return;
+if (i < P->nv) {
+Free(P->f[i].e);
+if (i < P->nf - 1) {
+memmove(&P->f[i], &P->f[i+1],
+ (P->nf - i - 1)*sizeof(M_Facet));
+}
+P->nf--;
}
-Free(P->f[f].e);
-
-if (f < P->nf-1) {
-memmove(&P->f[f], &P->f[f+1], (P->nf-1)*sizeof(M_Facet));
-}
-P->nf--;
}
Modified: trunk/vg/vg.c
===================================================================
--- trunk/vg/vg.c2015-08-31 05:47:34 UTC (rev 9803)
+++ trunk/vg/vg.c2015-08-31 05:49:13 UTC (rev 9804)
< at >< at > -237,7 +237,7 < at >< at >
}
if (i < vgNodeClassCount-1) {
memmove(&vgNodeClasses[i], &vgNodeClasses[i+1],
- (vgNodeClassCount-1)*sizeof(VG_NodeOps *));
+ (vgNodeClassCount-i-1)*sizeof(VG_NodeOps *));
}
vgNodeClassCount--;
}
< at >< at > -350,7 +350,7 < at >< at >
}
if (i < vn->nRefs-1) {
memmove(&vn->refs[i], &vn->refs[i+1],
- (vn->nRefs-1)*sizeof(VG_Node *));
+ (vn->nRefs-i-1)*sizeof(VG_Node *));
}
vn->nRefs--;
newDeps = (--VGNODE(pRef)->nDeps);
Modified: trunk/vg/vg_polygon.h
===================================================================
--- trunk/vg/vg_polygon.h2015-08-31 05:47:34 UTC (rev 9803)
+++ trunk/vg/vg_polygon.h2015-08-31 05:49:13 UTC (rev 9804)
< at >< at > -48,16 +48,14 < at >< at >
VG_PolygonDelVertex(VG_Polygon *vP, Uint vtx)
{
VG_Lock(VGNODE(vP)->vg);
-if (vtx >= vP->nPts) {
-goto out;
+if (vtx < vP->nPts) {
+VG_DelRef(vP, vP->pts[vtx]);
+if (vtx < vP->nPts-1) {
+memmove(&vP->pts[vtx], &vP->pts[vtx+1],
+ (vP->nPts - vtx - 1)*sizeof(VG_Point *));
+}
+vP->nPts--;
}
-VG_DelRef(vP, vP->pts[vtx]);
-if (vtx < vP->nPts-1) {
-memmove(&vP->pts[vtx], &vP->pts[vtx+1],
- (vP->nPts - 1)*sizeof(VG_Point *));
-}
-vP->nPts--;
-out:
VG_Unlock(VGNODE(vP)->vg);
}
__END_DECLS
[Less]
|
Posted
almost 10 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-08-31 01:47:34 -0400 (Mon, 31 Aug 2015)
New Revision: 9803
Modified:
trunk/tests/math.c
trunk/tests/objsystem.c
trunk/tests/plotting.c
trunk/tests/string.c
trunk/tests/widgets.c
Log:
remove unsafe
... [More]
M_DestroySubsystem() calls in Destroy()
Modified: trunk/tests/math.c
===================================================================
--- trunk/tests/math.c2015-07-20 04:56:42 UTC (rev 9802)
+++ trunk/tests/math.c2015-08-31 05:47:34 UTC (rev 9803)
< at >< at > -129,12 +129,6 < at >< at >
}
static void
-Destroy(void *obj)
-{
-M_DestroySubsystem();
-}
-
-static void
TestComplex(AG_TestInstance *ti)
{
M_Complex C1, C2, C1mi, C1plusC2, C1multC2;
< at >< at > -373,7 +367,7 < at >< at >
0,
sizeof(MyTestInstance),
Init,
-Destroy,
+NULL,/* destroy */
Test,
NULL,/* testGUI */
Bench
Modified: trunk/tests/objsystem.c
===================================================================
--- trunk/tests/objsystem.c2015-07-20 04:56:42 UTC (rev 9802)
+++ trunk/tests/objsystem.c2015-08-31 05:47:34 UTC (rev 9803)
< at >< at > -53,8 +53,6 < at >< at >
/* Unregister our classes for a complete cleanup. */
AG_UnregisterClass(&AnimalClass);
AG_UnregisterClass(&MammalClass);
-
-DEV_DestroySubsystem();
}
}
Modified: trunk/tests/plotting.c
===================================================================
--- trunk/tests/plotting.c2015-07-20 04:56:42 UTC (rev 9802)
+++ trunk/tests/plotting.c2015-08-31 05:47:34 UTC (rev 9803)
< at >< at > -174,12 +174,6 < at >< at >
return (0);
}
-static void
-Destroy(void *obj)
-{
-M_DestroySubsystem();
-}
-
static int
TestGUI(void *obj, AG_Window *win)
{
< at >< at > -269,7 +263,7 < at >< at >
0,
sizeof(AG_TestInstance),
Init,
-Destroy,
+NULL,/* destroy */
NULL,/* test */
TestGUI,
NULL/* bench */
Modified: trunk/tests/string.c
===================================================================
--- trunk/tests/string.c2015-07-20 04:56:42 UTC (rev 9802)
+++ trunk/tests/string.c2015-08-31 05:47:34 UTC (rev 9803)
< at >< at > -17,12 +17,6 < at >< at >
return (0);
}
-static void
-Destroy(void *obj)
-{
-M_DestroySubsystem();
-}
-
static int
Test(void *obj)
{
< at >< at > -89,7 +83,7 < at >< at >
0,
sizeof(AG_TestInstance),
Init,
-Destroy,
+NULL,/* destroy */
Test,
NULL,/* testGUI */
NULL/* bench */
Modified: trunk/tests/widgets.c
===================================================================
--- trunk/tests/widgets.c2015-07-20 04:56:42 UTC (rev 9802)
+++ trunk/tests/widgets.c2015-08-31 05:47:34 UTC (rev 9803)
< at >< at > -369,7 +369,6 < at >< at >
MyTestInstance *ti = obj;
Free(ti->someText);
-DEV_DestroySubsystem();
}
const AG_TestCase widgetsTest = {
[Less]
|
Posted
almost 10 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-07-20 00:56:42 -0400 (Mon, 20 Jul 2015)
New Revision: 9802
Modified:
trunk/Makefile
Log:
pre-package: use sed to convert newlines
Modified: trunk/Makefile
... [More]
===================================================================
--- trunk/Makefile2015-07-19 13:10:45 UTC (rev 9801)
+++ trunk/Makefile2015-07-20 04:56:42 UTC (rev 9802)
< at >< at > -101,32 +101,24 < at >< at >
echo '<meta http-equiv="refresh" content="1;url=http://libagar.org/docs/compile-msvc.html" />' > VisualC.html; \
echo "install-sdk.exe" >> ${PROJFILELIST}; \
echo "VisualC.html" >> ${PROJFILELIST}; \
-if [ -e "`which unix2dos 2>/dev/null`" ]; then \
-V=`perl mk/get-version.pl`; \
-cat README |unix2dos >README.txt; \
-cat INSTALL.txt |unix2dos >INSTALL-Windows.txt; \
-cat ChangeLogs/Release-$$V.txt | \
- unix2dos >RELEASE-$$V.txt; \
-cat mk/LICENSE.txt |unix2dos >LICENSE.txt; \
-cat gui/fonts/Vera-Copyright.txt |unix2dos > \
- LICENSE-Vera.txt; \
-cat au/portaudio/LICENSE.txt |unix2dos > \
- LICENSE-PortAudio.txt; \
-cp -f mk/agar-logo.png Logo.png; \
-echo "README.txt" >> ${PROJFILELIST}; \
-echo "INSTALL-Windows.txt" >> ${PROJFILELIST}; \
-echo "RELEASE-$$V.txt" >> ${PROJFILELIST}; \
-echo "LICENSE.txt" >> ${PROJFILELIST}; \
-echo "LICENSE-Vera.txt" >> ${PROJFILELIST}; \
-echo "LICENSE-PortAudio.txt" >> ${PROJFILELIST}; \
-echo "Logo.png" >> ${PROJFILELIST}; \
-fi; \
+V=`perl mk/get-version.pl`; \
+cat README |sed "s/$/`echo -e \\\r`/" >README.txt; \
+cat INSTALL.txt |sed "s/$/`echo -e \\\r`/" >INSTALL-Windows.txt; \
+cat ChangeLogs/Release-$$V.txt |sed "s/$/`echo -e \\\r`/" >RELEASE-$$V.txt; \
+cat mk/LICENSE.txt |sed "s/$/`echo -e \\\r`/" >LICENSE.txt; \
+cat gui/fonts/Vera-Copyright.txt |sed "s/$/`echo -e \\\r`/" >LICENSE-Vera.txt; \
+cp -f mk/agar-logo.png Logo.png; \
+echo "README.txt" >> ${PROJFILELIST}; \
+echo "INSTALL-Windows.txt" >> ${PROJFILELIST}; \
+echo "RELEASE-$$V.txt" >> ${PROJFILELIST}; \
+echo "LICENSE.txt" >> ${PROJFILELIST}; \
+echo "LICENSE-Vera.txt" >> ${PROJFILELIST}; \
+echo "Logo.png" >> ${PROJFILELIST}; \
else \
V=`perl mk/get-version.pl`; \
cp ChangeLogs/Release-$$V.txt RELEASE-$$V; \
cp mk/LICENSE.txt LICENSE; \
cp gui/fonts/Vera-Copyright.txt LICENSE-Vera; \
-cp au/portaudio/LICENSE.txt LICENSE-PortAudio; \
cp mk/agar-logo.png Logo.png; \
fi
[Less]
|
Posted
almost 10 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-07-19 09:10:45 -0400 (Sun, 19 Jul 2015)
New Revision: 9801
Modified:
trunk/gui/pixmap.c
Log:
ensure surface index is >=0 in SizeRequest()
Modified: trunk/gui/pixmap.c
... [More]
===================================================================
--- trunk/gui/pixmap.c2015-07-19 13:02:32 UTC (rev 9800)
+++ trunk/gui/pixmap.c2015-07-19 13:10:45 UTC (rev 9801)
< at >< at > -300,7 +300,7 < at >< at >
{
AG_Pixmap *px = obj;
-if ((px->flags & AG_PIXMAP_FORCE_SIZE) == 0) {
+if ((px->flags & AG_PIXMAP_FORCE_SIZE) == 0 && px->n >= 0) {
r->w = WSURFACE(px,px->n)->w;
r->h = WSURFACE(px,px->n)->h;
} else {
[Less]
|
Posted
almost 10 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-07-15 11:56:14 -0400 (Wed, 15 Jul 2015)
New Revision: 9799
Modified:
trunk/core/AG_Intro.3
Log:
remove broken link; thanks DarkUranium!
Modified: trunk/core/AG_Intro.3
... [More]
===================================================================
--- trunk/core/AG_Intro.32015-05-26 03:38:27 UTC (rev 9798)
+++ trunk/core/AG_Intro.32015-07-15 15:56:14 UTC (rev 9799)
< at >< at > -190,8 +190,6 < at >< at >
Pixel blending functions.
.It Xr AG_Color 3
Color structure.
-.It Xr AG_Colors 3
-Color scheme interface.
.It Xr AG_Cursor 3
Cursor configuration.
.It Xr AG_Driver 3
[Less]
|
Posted
about 10 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-05-25 23:38:27 -0400 (Mon, 25 May 2015)
New Revision: 9798
Modified:
trunk/tests/agartest.c
Log:
display error message if running a GL or SDL test on a driver without
GL or SDL support
Modified: trunk/tests/agartest.c
... [More]
===================================================================
--- trunk/tests/agartest.c2015-05-26 03:27:35 UTC (rev 9797)
trunk/tests/agartest.c2015-05-26 03:38:27 UTC (rev 9798)
< at >< at > -172,11 172,31 < at >< at >
{
AG_Tlist *tl = AG_PTR(1);
AG_Window *winParent = AG_PTR(2);
AG_Driver *drv = AGWIDGET(winParent)->drv;
AG_DriverClass *drvClass = AGDRIVER_CLASS(drv);
AG_TestCase *tc = AG_TlistSelectedItemPtr(tl);
AG_TestInstance *ti;
if (tc == NULL || (tc->test == NULL && tc->testGUI == NULL))
return;
if (tc->flags & AG_TEST_OPENGL) {
if (!(drvClass->flags & AG_DRIVER_OPENGL)) {
AG_TextMsg(AG_MSG_ERROR,
_("The `%s' test requires OpenGL.\n"
"Current driver (%s) has no GL support"),
tc->name, drvClass->name);
return;
}
}
if (tc->flags & AG_TEST_SDL) {
if (!(drvClass->flags & AG_DRIVER_SDL)) {
AG_TextMsg(AG_MSG_ERROR,
_("The `%s' test requires SDL.\n"
"Current driver (%s) has no SDL support"),
tc->name, drvClass->name);
return;
}
}
if ((ti = CreateTestInstance(tc)) == NULL)
return;
[Less]
|
Posted
about 10 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-05-25 23:27:35 -0400 (Mon, 25 May 2015)
New Revision: 9797
Modified:
trunk/gui/drv_sdl_common.c
trunk/gui/drv_sw.c
trunk/gui/window.c
Log:
fix window focus cycling behavior in SW mode.
Modified:
... [More]
trunk/gui/drv_sdl_common.c
===================================================================
--- trunk/gui/drv_sdl_common.c2015-05-25 13:08:26 UTC (rev 9796)
trunk/gui/drv_sdl_common.c2015-05-26 03:27:35 UTC (rev 9797)
< at >< at > -798,8 798,7 < at >< at >
drv->mouse->xRel, drv->mouse->yRel,
drv->mouse->btnState);
if (winTop == NULL &&
- AG_WidgetArea(win, dev->data.motion.x,
- dev->data.motion.y)) {
AG_WidgetArea(win, dev->data.motion.x, dev->data.motion.y)) {
winTop = win;
AG_MouseCursorUpdate(win,
dev->data.motion.x,
< at >< at > -822,7 821,8 < at >< at >
AG_ObjectUnlock(win);
continue;
}
-if (win != agWindowFocused) {
if (win != agWindowFocused &&
!(win->flags & AG_WINDOW_DENYFOCUS)) {
agWindowToFocus = win;
}
if (win->wBorderBot > 0 &&
Modified: trunk/gui/drv_sw.c
===================================================================
--- trunk/gui/drv_sw.c2015-05-25 13:08:26 UTC (rev 9796)
trunk/gui/drv_sw.c2015-05-26 03:27:35 UTC (rev 9797)
< at >< at > -337,7 337,9 < at >< at >
{
AG_DriverSw *dsw = (AG_DriverSw *)WIDGET(win)->drv;
-agWindowToFocus = win;
if (!(win->flags & AG_WINDOW_DENYFOCUS)) {
agWindowToFocus = win;
}
dsw->winSelected = win;
if (!(win->flags & AG_WINDOW_NOMOVE))
dsw->winop = AG_WINOP_MOVE;
< at >< at > -384,6 386,10 < at >< at >
void
AG_WM_CommitWindowFocus(AG_Window *win)
{
#ifdef AG_DEBUG
if (win->flags & AG_WINDOW_DENYFOCUS)
AG_FatalError("Window is not focusable");
#endif
if (agWindowFocused != NULL) {
if (win != NULL &&
win == agWindowFocused) {/* Nothing to do */
< at >< at > -397,8 403,9 < at >< at >
AG_ObjectMoveToTail(win);
}
agWindowFocused = win;
AG_PostEvent(NULL, win, "window-gainfocus", NULL);
win->dirty = 1;
AG_ObjectUnlock(win);
-AG_PostEvent(NULL, win, "window-gainfocus", NULL);
} else {
agWindowFocused = NULL;
}
Modified: trunk/gui/window.c
===================================================================
--- trunk/gui/window.c2015-05-25 13:08:26 UTC (rev 9796)
trunk/gui/window.c2015-05-26 03:27:35 UTC (rev 9797)
< at >< at > -779,10 779,8 < at >< at >
AG_PostEvent(NULL, win, "window-shown", NULL);
/* Implicit focus change. */
-if (!(win->flags & AG_WINDOW_DENYFOCUS)) {
-agWindowFocused = win;
-AG_PostEvent(NULL, win, "window-gainfocus", NULL);
-}
if (!(win->flags & AG_WINDOW_DENYFOCUS))
agWindowToFocus = win;
/* Mark for redraw */
win->dirty = 1;
< at >< at > -804,29 802,39 < at >< at >
AG_Driver *drv = WIDGET(win)->drv;
AG_DriverSw *dsw;
int i;
-
win->visible = 0;
WIDGET(win)->flags &= ~(AG_WIDGET_VISIBLE);
win->dirty = 0;
win->flags |= AG_WINDOW_NOCURSORCHG;
/* Cancel focus state or any focus change requests. */
-if (win == agWindowToFocus) {
if (win == agWindowToFocus)
agWindowToFocus = NULL;
-}
-if (win == agWindowFocused) {
-AG_PostEvent(NULL, win, "window-lostfocus", NULL);
-agWindowFocused = NULL;
-}
switch (AGDRIVER_CLASS(drv)->wm) {
case AG_WM_SINGLE:
dsw = (AG_DriverSw *)drv;
#ifdef AG_DEBUG
if (OBJECT(drv)->parent == NULL)
AG_FatalError("NULL parent");
#endif
if (win == agWindowFocused) {
AG_Window *wOther;
-if (OBJECT(drv)->parent == NULL)
-break;
AG_PostEvent(NULL, win, "window-lostfocus", NULL);
agWindowFocused = NULL;
AG_FOREACH_WINDOW_REVERSE(wOther, dsw) {
if (wOther->visible &&
!(wOther->flags & AG_WINDOW_DENYFOCUS))
break;
}
if (wOther != NULL)
agWindowToFocus = wOther;
}
-if (win->flags & AG_WINDOW_MODAL) {/* Per-driver stack */
if (win->flags & AG_WINDOW_MODAL) {
for (i = 0; i < dsw->Lmodal->n; i ) {
if (dsw->Lmodal->v[i].data.p == win)
break;
< at >< at > -844,7 852,11 < at >< at >
}
break;
case AG_WM_MULTIPLE:
-if (win->flags & AG_WINDOW_MODAL) {/* Global stack */
if (win == agWindowFocused) {
AG_PostEvent(NULL, win, "window-lostfocus", NULL);
agWindowFocused = NULL;
}
if (win->flags & AG_WINDOW_MODAL) {
for (i = 0; i < agModalWindows->n; i ) {
if (agModalWindows->v[i].data.p == win)
break;
< at >< at > -896,6 908,7 < at >< at >
{
AG_Window *win = AG_SELF();
/*Verbose("%s (\"%s\"): Gained Focus\n", OBJECT(win)->name, win->caption); */
WidgetGainFocus(WIDGET(win));
}
< at >< at > -904,6 917,7 < at >< at >
{
AG_Window *win = AG_SELF();
/*Verbose("%s (\"%s\"): Lost Focus\n", OBJECT(win)->name, win->caption); */
WidgetLostFocus(WIDGET(win));
}
[Less]
|